From 70eab5706e9027bcf5e7a200fb5d1a1545892ed1 Mon Sep 17 00:00:00 2001 From: turtle1999 Date: Mon, 12 Oct 2026 20:40:48 +0800 Subject: [PATCH] feat(jobs): deliver job output in completion notices and drop repeated notice text - tool-jobs: a completion notice carries the job's unread output when it fits inlineOutputBytes (default 2048); job_output withdraws a notice still pending, and the label is its first line bounded to 120 characters - tool-bash, tool-pwsh: the promotion result keeps only the still-running marker - subagent: a settlement notice omits the closing message when the child's last action was a message to its parent --- docs/config-catalog.md | 9 +- docs/config-catalog.zh.md | 9 +- packages/jobs/tool-jobs/README.i18n.yaml | 28 ++-- packages/jobs/tool-jobs/README.md | 13 +- packages/jobs/tool-jobs/README.zh.md | 13 +- packages/jobs/tool-jobs/src/index.ts | 85 +++++++++++- .../jobs/tool-jobs/tests/tool-jobs.spec.ts | 129 +++++++++++++++++- packages/shell/tool-bash/README.i18n.yaml | 4 +- packages/shell/tool-bash/README.md | 2 +- packages/shell/tool-bash/README.zh.md | 2 +- packages/shell/tool-bash/src/render.ts | 6 +- .../shell/tool-bash/tests/background.spec.ts | 6 +- .../shell/tool-bash/tests/integration.spec.ts | 17 +-- packages/shell/tool-pwsh/README.i18n.yaml | 4 +- packages/shell/tool-pwsh/README.md | 2 +- packages/shell/tool-pwsh/README.zh.md | 2 +- packages/shell/tool-pwsh/src/render.ts | 6 +- .../shell/tool-pwsh/tests/background.spec.ts | 6 +- packages/subagent/subagent/README.i18n.yaml | 4 +- packages/subagent/subagent/README.md | 2 +- packages/subagent/subagent/README.zh.md | 2 +- packages/subagent/subagent/src/activation.ts | 7 + .../subagent/src/continuation-messages.ts | 11 +- packages/subagent/subagent/src/manager.ts | 11 +- .../tests/continuation-messages.spec.ts | 12 ++ .../subagent/tests/continuation.spec.ts | 74 +++++++++- .../subagent-send-message/session.v4.jsonl | 4 +- .../session.v4.jsonl | 4 +- .../replay.override.json | 118 ++++++++++++++++ .../background-job-notice/session.v4.jsonl | 34 +++++ .../background-job-notice/snapshot.yml | 10 ++ .../bash-startup-timeout/session.v4.jsonl | 2 +- 32 files changed, 556 insertions(+), 82 deletions(-) create mode 100644 snapshots/session/background-job-notice/replay.override.json create mode 100644 snapshots/session/background-job-notice/session.v4.jsonl create mode 100644 snapshots/session/background-job-notice/snapshot.yml diff --git a/docs/config-catalog.md b/docs/config-catalog.md index 451c7f9e99..9f051e2568 100644 --- a/docs/config-catalog.md +++ b/docs/config-catalog.md @@ -3785,7 +3785,7 @@ export interface Config { ## `@deepseek-ai/dsh-tool-jobs` - `inject`: `tools` · `jobs` · `systemPrompt` -- `source`: [`packages/jobs/tool-jobs/src/index.ts:41`](../packages/jobs/tool-jobs/src/index.ts) +- `source`: [`packages/jobs/tool-jobs/src/index.ts:43`](../packages/jobs/tool-jobs/src/index.ts) ```ts config-catalog /** Configures bounded `job_output` waits and completion-notice delivery. */ @@ -3805,6 +3805,13 @@ export interface Config { * the next user input. */ maxConsecutiveWakes?: number + /** + * Largest complete completion notice, in UTF-8 bytes, that carries the + * job's unread output (default 2048); a larger one leaves that output for + * `job_output`. The producer's `outputLimitBytes` also bounds it, and 0 + * never inlines output. + */ + inlineOutputBytes?: number } /** diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md index cfbd0cfbf2..f24d90a1da 100644 --- a/docs/config-catalog.zh.md +++ b/docs/config-catalog.zh.md @@ -3787,7 +3787,7 @@ export interface Config { ## `@deepseek-ai/dsh-tool-jobs` - `inject`: `tools` · `jobs` · `systemPrompt` -- `source`: [`packages/jobs/tool-jobs/src/index.ts:41`](../packages/jobs/tool-jobs/src/index.ts) +- `source`: [`packages/jobs/tool-jobs/src/index.ts:43`](../packages/jobs/tool-jobs/src/index.ts) ```ts config-catalog /** Configures bounded `job_output` waits and completion-notice delivery. */ @@ -3807,6 +3807,13 @@ export interface Config { * the next user input. */ maxConsecutiveWakes?: number + /** + * Largest complete completion notice, in UTF-8 bytes, that carries the + * job's unread output (default 2048); a larger one leaves that output for + * `job_output`. The producer's `outputLimitBytes` also bounds it, and 0 + * never inlines output. + */ + inlineOutputBytes?: number } /** diff --git a/packages/jobs/tool-jobs/README.i18n.yaml b/packages/jobs/tool-jobs/README.i18n.yaml index 6499336f5e..36796f39a4 100644 --- a/packages/jobs/tool-jobs/README.i18n.yaml +++ b/packages/jobs/tool-jobs/README.i18n.yaml @@ -9,8 +9,8 @@ en: 256894de7b318e7e zh: a6f3cb0060fe2c4d /deepseek-ai-dsh-tool-jobs/summary: - en: b32de88c29a3c2e0 - zh: 63142a605332b4b7 + en: 571a1caca9a46ee0 + zh: 7d243d648abf9592 /deepseek-ai-dsh-tool-jobs/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb @@ -21,11 +21,11 @@ en: e9e9cb2ee5cea462 zh: 833beb2bca84bd6a /deepseek-ai-dsh-tool-jobs/use-this-package/completion-notices: - en: f69e3f96353234c3 - zh: 6caa74174a2d79b1 + en: d39d17ea069c8efd + zh: 20d9b35959cba853 /deepseek-ai-dsh-tool-jobs/use-this-package/minimal-configuration: - en: fc08838f1843b8c7 - zh: e5d3c11216967aca + en: 7cce8568898e2dd8 + zh: 2979e3584d4ee34d /deepseek-ai-dsh-tool-jobs/use-this-package/what-can-go-wrong: en: a09c5c8225dec06c zh: 3e9fcab42613775e @@ -36,14 +36,14 @@ en: e1d89b73fdcc5b24 zh: 38dd176ae111561f /deepseek-ai-dsh-tool-jobs/understand-the-implementation/source-map: - en: 6f006ff2d901bc92 - zh: 779d18ba7bec4202 + en: e6278ea246410c01 + zh: d202575c3e53852e /deepseek-ai-dsh-tool-jobs/understand-the-implementation/output-capping: en: ca18e4bdfb12a1e2 zh: 6592697c561c6e6d /deepseek-ai-dsh-tool-jobs/understand-the-implementation/notice-delivery-lanes: - en: 2540b7abbb3c9710 - zh: 4fb355bceab2f865 + en: eaf309257bd77534 + zh: 1f0b7119676c9db7 /deepseek-ai-dsh-tool-jobs/further-exploration: en: 11250fc631d55d99 zh: 7885ce173bd1cd5f @@ -81,11 +81,11 @@ en: 8160e01d6bfc5e0c zh: 570dc95be7f13260 /deepseek-ai-dsh-tool-jobs/model-experience/results-and-notices/what-the-model-sees: - en: 960436b3f61c7f96 - zh: 2c956bb4fee134c2 + en: 209f0d45364dcedd + zh: 2dd51778a3f99adc /deepseek-ai-dsh-tool-jobs/model-experience/results-and-notices/token-effect: - en: 16efd9cb948ca4bf - zh: 563cc4c78dc63b4d + en: 40aeb5a93409f4a4 + zh: 6f894bb247ffff14 /deepseek-ai-dsh-tool-jobs/model-experience/results-and-notices/kv-cache-effect: en: 2fbf2175168e8244 zh: f681f89596f500f5 diff --git a/packages/jobs/tool-jobs/README.md b/packages/jobs/tool-jobs/README.md index 681010d71d..fb4a7ddcfd 100644 --- a/packages/jobs/tool-jobs/README.md +++ b/packages/jobs/tool-jobs/README.md @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -Use `dsh-tool-jobs` to inspect and control background commands and PTY work through `job_output`, `job_list`, and `job_kill`. Reads can wait within a configured timeout, list results identify each job's kind and status, and cancellation settles only after the work stops. When owned work finishes, the agent receives an in-session notice: busy agents receive it in their next step, while idle agents are woken by a follow-up turn. Configuration controls wait limits, completion delivery, and an optional cap on consecutive wakeups. Stream output is consumed by one reader, and pending notices do not survive owner disposal. +Use `dsh-tool-jobs` to inspect and control background commands and PTY work through `job_output`, `job_list`, and `job_kill`. Reads can wait within a configured timeout, list results identify each job's kind and status, and cancellation settles only after the work stops. When owned work finishes, the agent receives an in-session notice that carries short output inline: busy agents receive it in their next step, while idle agents are woken by a follow-up turn. Configuration controls wait limits, completion delivery, and an optional cap on consecutive wakeups. Stream output is consumed by one reader, and pending notices do not survive owner disposal. ## Table of Contents @@ -37,7 +37,7 @@ The three tools return `{ text, job }`, `PublicJobSnapshot[]`, and `{ outcome: ' ### Completion notices -When a job finishes, the owning agent receives `background job (: