@deepseek-ai/dsh-tool-workflow 0.2.2-rc.5 → 0.2.3-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -18,8 +18,8 @@
18
18
  en: a0a9d655187f285d
19
19
  zh: 230b4556fff9f08b
20
20
  /deepseek-ai-dsh-tool-workflow/use-this-package/calling-the-tool:
21
- en: aeebba9469f0558d
22
- zh: e2e74d4272e94201
21
+ en: 6c0da68a33e5501e
22
+ zh: ff683dd4de65fc7b
23
23
  /deepseek-ai-dsh-tool-workflow/use-this-package/what-to-expect-during-a-run:
24
24
  en: 19ec4f830edb8e1a
25
25
  zh: 8579ae5274aca6de
@@ -36,8 +36,8 @@
36
36
  en: 6d09119d1393c254
37
37
  zh: a7cc03daa59650ec
38
38
  /deepseek-ai-dsh-tool-workflow/understand-the-implementation/run-lifecycle:
39
- en: 8ea9ce564251249a
40
- zh: a59b88cc14a25a1f
39
+ en: ef2c2a573b30c262
40
+ zh: 5a078b9fe31e333d
41
41
  /deepseek-ai-dsh-tool-workflow/understand-the-implementation/background-lifecycle:
42
42
  en: 35950b2015800ec5
43
43
  zh: 5ae6f5a5e53dc585
@@ -87,8 +87,8 @@
87
87
  en: 9717b983b6a857e3
88
88
  zh: 611a2dadf7c0c706
89
89
  /deepseek-ai-dsh-tool-workflow/model-experience/tool-call-history-and-result/what-the-model-sees:
90
- en: acd5e87161ced588
91
- zh: 5ffe85926ee1b88d
90
+ en: 483515bf4c1dc710
91
+ zh: 69b23bd7f331ddea
92
92
  /deepseek-ai-dsh-tool-workflow/model-experience/tool-call-history-and-result/token-effect:
93
93
  en: 88cfc89c7dc19dbb
94
94
  zh: 75e674844f311937
package/README.md CHANGED
@@ -31,7 +31,7 @@ The `workflow` tool runs a model-authored orchestration script that fans work ou
31
31
 
32
32
  The model submits three parameters plus one flag: `meta` (required identity data: `name`, `description`, and optional `whenToUse` and `phases`), `script` (required plain JavaScript body — no `export const meta` statement; its parameter description carries the body rules and the tool description carries the hook contract), `args` (optional JSON object exposed to the script as the `args` global; wrap a bare list in a field so the wire schema stays honest), and `run_in_background` (optional; present only while `enableRunInBackground` holds).
33
33
 
34
- A foreground success returns the envelope `{ kind: 'foreground', runId, agentsStarted, result }`, rendered to the model as `workflow "<name>" completed (<count> agent<optional-s>).` followed by `Return value:` and the pretty-printed JSON. A workflow that cannot start — a script parse or meta validation failure — returns an error the model can correct from. Cancellation and execution failures return `Error: workflow run was cancelled` or `Error: workflow run failed: <error>`; partial output is never reported as success.
34
+ A foreground success returns the envelope `{ kind: 'foreground', runId, agentsStarted, result }`, rendered to the model as `workflow "<name>" completed (<count> agent<optional-s>).` followed by `Return value:` and the pretty-printed JSON. A workflow that cannot start — a script parse or meta validation failure — returns an error the model can correct from. Cancelling the calling step returns the tool runtime's `AbortError` `ABORTED` result; any other cancellation and execution failures return `Error: workflow run was cancelled` (`WorkflowError` `CANCELLED`) or `Error: workflow run failed: <error>` (`WorkflowError` with the fatal code that ended the run, such as `AGENT_CAP`, or `RUN_FAILED` without one); partial output is never reported as success.
35
35
 
36
36
  ### What to expect during a run
37
37
 
@@ -67,7 +67,7 @@ The consumer owns the model-facing schema, the `tool:<toolName>` system-prompt g
67
67
 
68
68
  ### Run lifecycle
69
69
 
70
- `execute` starts the run and awaits `run.result` inside a `try/finally` that always disposes the run. `exec.signal` is bridged to `run.cancel()`, including the already-aborted-before-start case. A non-`completed` stop reason maps to an `isError` result reporting the reason; completion renders `{ kind, runId, agentsStarted, result }`, with the Native renderer truncating only that projection at `maxResultChars`.
70
+ `execute` starts the run and awaits `run.result` inside a `try/finally` that always disposes the run. `exec.signal` is bridged to `run.cancel()`, including the already-aborted-before-start case. A non-`completed` stop reason maps to an `isError` result reporting the reason, rethrowing the caller's abort reason when `exec.signal` aborted and otherwise throwing a `WorkflowError`; completion renders `{ kind, runId, agentsStarted, result }`, with the Native renderer truncating only that projection at `maxResultChars`.
71
71
 
72
72
  ### Background lifecycle
73
73
 
@@ -150,7 +150,7 @@ Prefix-stable while `toolName`, definition, and visibility are unchanged. Renami
150
150
 
151
151
  #### What the model sees
152
152
 
153
- The full model-written script, metadata, and args remain in the assistant tool call. A foreground success is exactly `workflow "<name>" completed (<count> agent<optional-s>).`, newline, `Return value:`, newline, and pretty-printed data-dependent JSON; a cap adds `… [truncated: <omitted> more characters]` on a new line. A background acceptance is exactly `workflow "<name>" started in the background as job <jobId>. Its return value arrives with the completion notice; check on it with job_output, stop it with job_kill.`, and the same rendered value later reaches the model through the job's completion notice and `job_output`. Failures are exactly `Error: workflow run was cancelled`, optionally suffixed ` (<error>)`, `Error: workflow run failed: <error-or-unknown error>`, or defensively `Error: workflow run ended abnormally (<reason>)`; a call without an owning agent becomes `Error: workflow tool requires a calling agent (exec.agent was undefined)`. Intermediate child messages are omitted.
153
+ The full model-written script, metadata, and args remain in the assistant tool call. A foreground success is exactly `workflow "<name>" completed (<count> agent<optional-s>).`, newline, `Return value:`, newline, and pretty-printed data-dependent JSON; a cap adds `… [truncated: <omitted> more characters]` on a new line. A background acceptance is exactly `workflow "<name>" started in the background as job <jobId>. Its return value arrives with the completion notice; check on it with job_output, stop it with job_kill.`, and the same rendered value later reaches the model through the job's completion notice and `job_output`. Failures after a caller abort render the abort reason; other failures are exactly `Error: workflow run was cancelled`, optionally suffixed ` (<error>)`, `Error: workflow run failed: <error-or-unknown error>`, or defensively `Error: workflow run ended abnormally (<reason>)`; a call without an owning agent becomes `Error: workflow tool requires a calling agent (exec.agent was undefined)` (`ToolContextUnavailableError`). Intermediate child messages are omitted.
154
154
 
155
155
  #### Token effect
156
156
 
package/README.zh.md CHANGED
@@ -31,7 +31,7 @@ kind: "package-reference"
31
31
 
32
32
  模型提交三个参数外加一个开关:`meta`(必需的身份数据:`name`、`description`,以及可选的 `whenToUse` 与 `phases`)、`script`(必需的纯 JavaScript 脚本体——不含 `export const meta` 语句;其参数描述携带脚本体规则,工具描述携带钩子约定)、`args`(可选 JSON 对象,作为全局变量 `args` 向脚本公开;裸列表应包装到字段中,使协议 schema 如实表达形态),以及 `run_in_background`(可选;仅在 `enableRunInBackground` 生效时存在)。
33
33
 
34
- 前台成功返回包络 `{ kind: 'foreground', runId, agentsStarted, result }`,向模型渲染为 `workflow "<name>" completed (<count> agent<optional-s>).`,后接 `Return value:` 与美化打印的 JSON。无法启动的工作流——脚本解析或 meta 校验失败——返回模型可以修正的错误。取消与执行失败返回 `Error: workflow run was cancelled` 或 `Error: workflow run failed: <error>`;部分输出绝不会被报告为成功。
34
+ 前台成功返回包络 `{ kind: 'foreground', runId, agentsStarted, result }`,向模型渲染为 `workflow "<name>" completed (<count> agent<optional-s>).`,后接 `Return value:` 与美化打印的 JSON。无法启动的工作流——脚本解析或 meta 校验失败——返回模型可以修正的错误。取消调用方步骤时返回工具运行时的 `AbortError` `ABORTED` 结果;其他取消与执行失败返回 `Error: workflow run was cancelled`(`WorkflowError` `CANCELLED`)或 `Error: workflow run failed: <error>`(`WorkflowError`,code 为结束运行的致命 code,如 `AGENT_CAP`,没有时为 `RUN_FAILED`);部分输出绝不会被报告为成功。
35
35
 
36
36
  ### 运行期间的预期
37
37
 
@@ -67,7 +67,7 @@ kind: "package-reference"
67
67
 
68
68
  ### 运行生命周期
69
69
 
70
- `execute` 启动运行,并在 `try/finally` 内等待 `run.result`;该结构总会对运行执行 dispose。`exec.signal` 会桥接到 `run.cancel()`,包括启动前已经中止的情况。非 `completed` 结束原因会映射为报告原因的 `isError` 结果;完成时渲染 `{ kind, runId, agentsStarted, result }`,Native 渲染器只会在 `maxResultChars` 处截断该投影。
70
+ `execute` 启动运行,并在 `try/finally` 内等待 `run.result`;该结构总会对运行执行 dispose。`exec.signal` 会桥接到 `run.cancel()`,包括启动前已经中止的情况。非 `completed` 结束原因会映射为报告原因的 `isError` 结果:`exec.signal` 已中止时重新抛出调用方的中止原因,否则抛出 `WorkflowError`;完成时渲染 `{ kind, runId, agentsStarted, result }`,Native 渲染器只会在 `maxResultChars` 处截断该投影。
71
71
 
72
72
  ### 后台生命周期
73
73
 
@@ -150,7 +150,7 @@ Use the <toolName> tool ONLY when the user explicitly asks for a workflow or for
150
150
 
151
151
  #### 模型看到什么
152
152
 
153
- 由模型编写的完整脚本、元数据与 args 会保留在 assistant 工具调用中。前台成功结果精确为 `workflow "<name>" completed (<count> agent<optional-s>).`、换行、`Return value:`、换行,以及美化打印且依赖数据的 JSON;达到上限时,会在新行添加 `… [truncated: <omitted> more characters]`。后台受理结果精确为 `workflow "<name>" started in the background as job <jobId>. Its return value arrives with the completion notice; check on it with job_output, stop it with job_kill.`,同样渲染的值稍后经任务完成播报与 `job_output` 抵达模型。失败结果精确为 `Error: workflow run was cancelled`(可以追加后缀 ` (<error>)`)、`Error: workflow run failed: <error-or-unknown error>` 或防御性的 `Error: workflow run ended abnormally (<reason>)`;没有所属 agent 的调用变为 `Error: workflow tool requires a calling agent (exec.agent was undefined)`。中间子 agent 消息会被省略。
153
+ 由模型编写的完整脚本、元数据与 args 会保留在 assistant 工具调用中。前台成功结果精确为 `workflow "<name>" completed (<count> agent<optional-s>).`、换行、`Return value:`、换行,以及美化打印且依赖数据的 JSON;达到上限时,会在新行添加 `… [truncated: <omitted> more characters]`。后台受理结果精确为 `workflow "<name>" started in the background as job <jobId>. Its return value arrives with the completion notice; check on it with job_output, stop it with job_kill.`,同样渲染的值稍后经任务完成播报与 `job_output` 抵达模型。调用方中止后的失败渲染中止原因;其他失败结果精确为 `Error: workflow run was cancelled`(可以追加后缀 ` (<error>)`)、`Error: workflow run failed: <error-or-unknown error>` 或防御性的 `Error: workflow run ended abnormally (<reason>)`;没有所属 agent 的调用变为 `Error: workflow tool requires a calling agent (exec.agent was undefined)`(`ToolContextUnavailableError`)。中间子 agent 消息会被省略。
154
154
 
155
155
  #### Token 影响
156
156
 
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
- import { defineTool } from "@deepseek-ai/dsh-tools";
2
+ import { ToolArgsError, ToolContextUnavailableError, defineTool } from "@deepseek-ai/dsh-tools";
3
+ import { WorkflowError } from "@deepseek-ai/dsh-workflow";
3
4
  //#region lib/types/record.js
4
5
  /**
5
6
  * Live-progress mirror for background workflow runs: streams the engine's
@@ -162,10 +163,10 @@ function presentWorkflowResult(args, result) {
162
163
  function stopReasonError(result) {
163
164
  switch (result.stopReason) {
164
165
  case "completed": return;
165
- case "cancelled": return `workflow run was cancelled${result.error !== void 0 ? ` (${result.error})` : ""}`;
166
- case "error": return `workflow run failed: ${result.error ?? "unknown error"}`;
166
+ case "cancelled": return new WorkflowError(`workflow run was cancelled${result.error !== void 0 ? ` (${result.error})` : ""}`, "CANCELLED");
167
+ case "error": return new WorkflowError(`workflow run failed: ${result.error ?? "unknown error"}`, result.errorCode ?? "RUN_FAILED");
167
168
  /* v8 ignore start -- defensive: WorkflowStopReason is a closed union, exhaustive by construction; a future variant fails here loudly */
168
- default: return `workflow run ended abnormally (${String(result.stopReason)})`;
169
+ default: return new WorkflowError(`workflow run ended abnormally (${String(result.stopReason)})`, "RUN_FAILED");
169
170
  }
170
171
  }
171
172
  /**
@@ -217,7 +218,7 @@ function renderResult(name, agentsStarted, value, maxChars) {
217
218
  */
218
219
  function startBackgroundRun(ctx, args, parent, toolCall, recordsRun, deps) {
219
220
  const jobs = ctx.get("jobs");
220
- if (jobs === void 0) throw new Error("background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs");
221
+ if (jobs === void 0) throw new ToolContextUnavailableError("background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs");
221
222
  let run;
222
223
  return {
223
224
  kind: "background",
@@ -265,7 +266,8 @@ function apply(ctx, config) {
265
266
  ctx.systemPrompt.section({
266
267
  name: `tool:${toolName}`,
267
268
  order: ctx.systemPrompt.getSectionOrder("TOOL_WORKFLOW"),
268
- text: `Use the ${toolName} tool ONLY when the user explicitly asks for a workflow or for large multi-agent orchestration: you write a JavaScript script (the tool description documents the exact format) that fans work out across many subagents with phases and structured results. For one or two delegations, prefer plain subagent calls.`
269
+ text: `Use the ${toolName} tool ONLY when the user explicitly asks for a workflow or for large multi-agent orchestration: you write a JavaScript script (the tool description documents the exact format) that fans work out across many subagents with phases and structured results. For one or two delegations, prefer plain subagent calls.`,
270
+ retirement: `The ${toolName} tool is no longer available. Its instructions no longer apply.`
269
271
  });
270
272
  ctx.tools.register(defineTool({
271
273
  name: toolName,
@@ -384,9 +386,9 @@ function apply(ctx, config) {
384
386
  },
385
387
  async execute(args, exec) {
386
388
  const parent = exec.agent;
387
- if (!parent) throw new Error("workflow tool requires a calling agent (exec.agent was undefined)");
389
+ if (!parent) throw new ToolContextUnavailableError("workflow tool requires a calling agent (exec.agent was undefined)");
388
390
  if (args.run_in_background === true) {
389
- if (!enableRunInBackground) throw new Error("run_in_background is disabled for this tool");
391
+ if (!enableRunInBackground) throw new ToolArgsError(["run_in_background is disabled for this tool"]);
390
392
  return startBackgroundRun(ctx, args, parent, {
391
393
  callId: exec.callId,
392
394
  rootCallId: exec.rootCallId
@@ -413,7 +415,10 @@ function apply(ctx, config) {
413
415
  try {
414
416
  result = await run.result;
415
417
  const error = stopReasonError(result);
416
- if (error !== void 0) throw new Error(error);
418
+ if (error !== void 0) {
419
+ exec.signal.throwIfAborted();
420
+ throw error;
421
+ }
417
422
  return {
418
423
  kind: "foreground",
419
424
  runId: run.id,
@@ -426,7 +431,7 @@ function apply(ctx, config) {
426
431
  await run.dispose();
427
432
  if (recordsRun) {
428
433
  /* v8 ignore next -- WorkflowRun.result never rejects by contract, so result is assigned before finally. */
429
- if (result === void 0) throw new Error("workflow run settled without a result");
434
+ if (result === void 0) throw new WorkflowError("workflow run settled without a result", "RUN_FAILED");
430
435
  recorder.finish(run.id, result.stopReason);
431
436
  }
432
437
  } finally {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;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CAAC,MAAM,CAI3B,CAAA;AA+PF,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA6KxD"}
@@ -12,7 +12,8 @@
12
12
  * @module @deepseek-ai/dsh-tool-workflow
13
13
  */
14
14
  import z from '@deepseek-ai/schemastery';
15
- import { defineTool } from '@deepseek-ai/dsh-tools';
15
+ import { defineTool, ToolArgsError, ToolContextUnavailableError } from '@deepseek-ai/dsh-tools';
16
+ import { WorkflowError } from '@deepseek-ai/dsh-workflow';
16
17
  import { createWorkflowRecordMirror } from "./record.js";
17
18
  export const name = 'tool-workflow';
18
19
  export const inject = ['tools', 'workflowEngine', 'systemPrompt'];
@@ -124,12 +125,12 @@ function stopReasonError(result) {
124
125
  case 'completed':
125
126
  return undefined;
126
127
  case 'cancelled':
127
- return `workflow run was cancelled${result.error !== undefined ? ` (${result.error})` : ''}`;
128
+ return new WorkflowError(`workflow run was cancelled${result.error !== undefined ? ` (${result.error})` : ''}`, 'CANCELLED');
128
129
  case 'error':
129
- return `workflow run failed: ${result.error ?? 'unknown error'}`;
130
+ return new WorkflowError(`workflow run failed: ${result.error ?? 'unknown error'}`, result.errorCode ?? 'RUN_FAILED');
130
131
  /* v8 ignore start -- defensive: WorkflowStopReason is a closed union, exhaustive by construction; a future variant fails here loudly */
131
132
  default:
132
- return `workflow run ended abnormally (${String(result.stopReason)})`;
133
+ return new WorkflowError(`workflow run ended abnormally (${String(result.stopReason)})`, 'RUN_FAILED');
133
134
  /* v8 ignore stop */
134
135
  }
135
136
  }
@@ -185,7 +186,7 @@ function renderResult(name, agentsStarted, value, maxChars) {
185
186
  function startBackgroundRun(ctx, args, parent, toolCall, recordsRun, deps) {
186
187
  const jobs = ctx.get('jobs');
187
188
  if (jobs === undefined) {
188
- throw new Error('background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs');
189
+ throw new ToolContextUnavailableError('background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs');
189
190
  }
190
191
  let run;
191
192
  const jobId = jobs.start({
@@ -243,6 +244,7 @@ export function apply(ctx, config) {
243
244
  name: `tool:${toolName}`,
244
245
  order: ctx.systemPrompt.getSectionOrder('TOOL_WORKFLOW'),
245
246
  text: `Use the ${toolName} tool ONLY when the user explicitly asks for a workflow or for large multi-agent orchestration: you write a JavaScript script (the tool description documents the exact format) that fans work out across many subagents with phases and structured results. For one or two delegations, prefer plain subagent calls.`,
247
+ retirement: `The ${toolName} tool is no longer available. Its instructions no longer apply.`,
246
248
  });
247
249
  ctx.tools.register(defineTool({
248
250
  name: toolName,
@@ -328,11 +330,12 @@ export function apply(ctx, config) {
328
330
  // The loop sets `exec.agent` for every model-driven call; its absence
329
331
  // means a non-agent caller invoked the tool directly, which has no
330
332
  // parent to attribute the children to. Fail loud rather than guess.
331
- throw new Error('workflow tool requires a calling agent (exec.agent was undefined)');
333
+ throw new ToolContextUnavailableError('workflow tool requires a calling agent (exec.agent was undefined)');
332
334
  }
333
335
  if (args.run_in_background === true) {
334
336
  if (!enableRunInBackground) {
335
- throw new Error('run_in_background is disabled for this tool');
337
+ // The schema omits the field when disabled, so the model corrects by omitting it.
338
+ throw new ToolArgsError(['run_in_background is disabled for this tool']);
336
339
  }
337
340
  // No pre-abort check here, unlike bash/pwsh: ToolRuntime re-reads the
338
341
  // caller signal right before execute(), and this branch reaches
@@ -369,9 +372,11 @@ export function apply(ctx, config) {
369
372
  result = await run.result;
370
373
  const error = stopReasonError(result);
371
374
  if (error !== undefined) {
372
- // Map a non-clean finish to an isError result (the registry turns a
373
- // throw into an isError). Report the reason, not partial output.
374
- throw new Error(error);
375
+ // Caller cancellation keeps the registry's AbortError identity; any
376
+ // other non-clean finish becomes a coded isError result. Report the
377
+ // reason, not partial output.
378
+ exec.signal.throwIfAborted();
379
+ throw error;
375
380
  }
376
381
  return {
377
382
  kind: 'foreground',
@@ -389,7 +394,7 @@ export function apply(ctx, config) {
389
394
  if (recordsRun) {
390
395
  /* v8 ignore next -- WorkflowRun.result never rejects by contract, so result is assigned before finally. */
391
396
  if (result === undefined)
392
- throw new Error('workflow run settled without a result');
397
+ throw new WorkflowError('workflow run settled without a result', 'RUN_FAILED');
393
398
  recorder.finish(run.id, result.stopReason);
394
399
  }
395
400
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAUnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAaxD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAA;AACnC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAA;AAkBjE,MAAM,CAAC,MAAM,MAAM,GAAc,CAAC,CAAC,MAAM,CAAC;IACxC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;IACxC,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAClD,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CACjD,CAAC,CAAA;AAiBF,8EAA8E;AAC9E,SAAS,oBAAoB,CAAC,KAAc;IAC1C,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,6BAA6B,CAAA;IACtC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,sBAAsB,CAAC,GAAY;IAC1C,MAAM,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAA;IAChD,MAAM,MAAM,GAAG,CACb,OAAgB,EAChB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BACjD,IAAI,CAAC;oBACH,8DAA8D;oBAC9D,iEAAiE;oBACjE,MAAM,GAAG,CAAC,OAAO,EAAE,CAAA;oBACnB,IAAI,UAAU,EAAE,CAAC;wBACf,2GAA2G;wBAC3G,IAAI,MAAM,KAAK,SAAS;4BAAE,MAAM,IAAI,aAAa,CAAC,uCAAuC,EAAE,YAAY,CAAC,CAAA;wBACxG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;oBAC5C,CAAC;gBACH,CAAC;wBAAS,CAAC;oBACT,IAAI,UAAU;wBAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;gBAC1C,CAAC;YACH,CAAC;QACH,CAAC;QACD,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC;QAC9C,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC;KACrE,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import type { Context } from '@deepseek-ai/cordis';
11
11
  import type { JobHandle } from '@deepseek-ai/dsh-jobs';
12
- import type { WorkflowRunId } from '@deepseek-ai/dsh-workflow';
12
+ import type { WorkflowRunId } from '@deepseek-ai/dsh-workflow/types';
13
13
  /** Job-ring taps for the background runs the tool tracks. */
14
14
  export interface WorkflowRecordMirror {
15
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,6DAA6D;AAC7D,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAAA;IACjD;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CA2B7E"}
1
+ {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAEpE,6DAA6D;AAC7D,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAAA;IACjD;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CA2B7E"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-tool-workflow",
3
3
  "description": "Model-facing workflow tool: run a JavaScript orchestration script over ctx.workflowEngine",
4
- "version": "0.2.2-rc.5",
4
+ "version": "0.2.3-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -37,34 +37,35 @@
37
37
  ],
38
38
  "license": "MIT",
39
39
  "peerDependencies": {
40
- "@deepseek-ai/cordis": "~4.1.0",
41
- "@deepseek-ai/dsh-agent": "0.2.2-rc.5",
42
- "@deepseek-ai/dsh-jobs": "0.2.2-rc.5",
43
- "@deepseek-ai/dsh-llm": "0.2.2-rc.5",
44
- "@deepseek-ai/dsh-session": "0.2.2-rc.5",
45
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.5",
46
- "@deepseek-ai/dsh-tools": "0.2.2-rc.5",
47
- "@deepseek-ai/dsh-workflow": "0.2.2-rc.5"
40
+ "@deepseek-ai/cordis": "~4.2.0-alpha.1",
41
+ "@deepseek-ai/dsh-agent": "0.2.3-alpha.2",
42
+ "@deepseek-ai/dsh-jobs": "0.2.3-alpha.2",
43
+ "@deepseek-ai/dsh-llm": "0.2.3-alpha.2",
44
+ "@deepseek-ai/dsh-session": "0.2.3-alpha.2",
45
+ "@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.2",
46
+ "@deepseek-ai/dsh-tools": "0.2.3-alpha.2",
47
+ "@deepseek-ai/dsh-workflow": "0.2.3-alpha.2"
48
48
  },
49
49
  "dependencies": {
50
- "@deepseek-ai/schemastery": "~3.19.0"
50
+ "@deepseek-ai/schemastery": "~3.20.0-alpha.1"
51
51
  },
52
52
  "devDependencies": {
53
- "@deepseek-ai/cordis": "~4.1.0",
54
- "@deepseek-ai/dsh-agent": "0.2.2-rc.5",
55
- "@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-rc.5",
56
- "@deepseek-ai/dsh-jobs": "0.2.2-rc.5",
57
- "@deepseek-ai/dsh-jobs-local": "0.2.2-rc.5",
58
- "@deepseek-ai/dsh-llm": "0.2.2-rc.5",
59
- "@deepseek-ai/dsh-session": "0.2.2-rc.5",
60
- "@deepseek-ai/dsh-session-projection": "0.2.2-rc.5",
61
- "@deepseek-ai/dsh-subagent": "0.2.2-rc.5",
62
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.5",
63
- "@deepseek-ai/dsh-tool-executor-native": "0.2.2-rc.5",
64
- "@deepseek-ai/dsh-tool-jobs": "0.2.2-rc.5",
65
- "@deepseek-ai/dsh-tool-testkit": "0.2.2-rc.5",
66
- "@deepseek-ai/dsh-tools": "0.2.2-rc.5",
67
- "@deepseek-ai/dsh-workflow": "0.2.2-rc.5",
68
- "@deepseek-ai/dsh-workflow-ptc": "0.2.2-rc.5"
53
+ "@deepseek-ai/dsh-brand": "0.2.3-alpha.2",
54
+ "@deepseek-ai/cordis": "~4.2.0-alpha.1",
55
+ "@deepseek-ai/dsh-agent": "0.2.3-alpha.2",
56
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.3-alpha.2",
57
+ "@deepseek-ai/dsh-jobs": "0.2.3-alpha.2",
58
+ "@deepseek-ai/dsh-jobs-local": "0.2.3-alpha.2",
59
+ "@deepseek-ai/dsh-llm": "0.2.3-alpha.2",
60
+ "@deepseek-ai/dsh-session": "0.2.3-alpha.2",
61
+ "@deepseek-ai/dsh-session-projection": "0.2.3-alpha.2",
62
+ "@deepseek-ai/dsh-subagent": "0.2.3-alpha.2",
63
+ "@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.2",
64
+ "@deepseek-ai/dsh-tool-executor-native": "0.2.3-alpha.2",
65
+ "@deepseek-ai/dsh-tool-jobs": "0.2.3-alpha.2",
66
+ "@deepseek-ai/dsh-tool-testkit": "0.2.3-alpha.2",
67
+ "@deepseek-ai/dsh-tools": "0.2.3-alpha.2",
68
+ "@deepseek-ai/dsh-workflow": "0.2.3-alpha.2",
69
+ "@deepseek-ai/dsh-workflow-ptc": "0.2.3-alpha.2"
69
70
  }
70
71
  }
package/src/index.ts CHANGED
@@ -14,16 +14,18 @@
14
14
 
15
15
  import type { Context } from '@deepseek-ai/cordis'
16
16
  import z from '@deepseek-ai/schemastery'
17
- import { defineTool } from '@deepseek-ai/dsh-tools'
17
+ import { defineTool, ToolArgsError, ToolContextUnavailableError } from '@deepseek-ai/dsh-tools'
18
18
  import type { ToolCallView, ToolResultView } from '@deepseek-ai/dsh-tools'
19
19
  import type { Agent } from '@deepseek-ai/dsh-agent'
20
20
  import type { ContentBlock } from '@deepseek-ai/dsh-llm'
21
21
  import type { JobId, JobOutcome, JobToolCall } from '@deepseek-ai/dsh-jobs'
22
22
  import type { Session, SessionEventMap } from '@deepseek-ai/dsh-session'
23
23
  import type { JsonValue } from '@deepseek-ai/dsh-util-values'
24
+ import { WorkflowError } from '@deepseek-ai/dsh-workflow'
24
25
  import type {
25
- WorkflowResult, WorkflowRun, WorkflowRunId, WorkflowStopReason,
26
+ WorkflowResult, WorkflowRun, WorkflowStopReason,
26
27
  } from '@deepseek-ai/dsh-workflow'
28
+ import type { WorkflowRunId } from '@deepseek-ai/dsh-workflow/types'
27
29
  import { createWorkflowRecordMirror } from './record.ts'
28
30
  import type { WorkflowRecordMirror } from './record.ts'
29
31
  import type {
@@ -194,17 +196,17 @@ function presentWorkflowResult(args: WorkflowCallArgs, result: { content: Conten
194
196
  }
195
197
 
196
198
  /** A non-`completed` stop reason means the script did not finish cleanly. */
197
- function stopReasonError(result: WorkflowResult): string | undefined {
199
+ function stopReasonError(result: WorkflowResult): WorkflowError | undefined {
198
200
  switch (result.stopReason) {
199
201
  case 'completed':
200
202
  return undefined
201
203
  case 'cancelled':
202
- return `workflow run was cancelled${result.error !== undefined ? ` (${result.error})` : ''}`
204
+ return new WorkflowError(`workflow run was cancelled${result.error !== undefined ? ` (${result.error})` : ''}`, 'CANCELLED')
203
205
  case 'error':
204
- return `workflow run failed: ${result.error ?? 'unknown error'}`
206
+ return new WorkflowError(`workflow run failed: ${result.error ?? 'unknown error'}`, result.errorCode ?? 'RUN_FAILED')
205
207
  /* v8 ignore start -- defensive: WorkflowStopReason is a closed union, exhaustive by construction; a future variant fails here loudly */
206
208
  default:
207
- return `workflow run ended abnormally (${String(result.stopReason satisfies never)})`
209
+ return new WorkflowError(`workflow run ended abnormally (${String(result.stopReason satisfies never)})`, 'RUN_FAILED')
208
210
  /* v8 ignore stop */
209
211
  }
210
212
  }
@@ -270,7 +272,7 @@ function startBackgroundRun(
270
272
  ): { kind: 'background'; jobId: JobId; runId: WorkflowRunId } {
271
273
  const jobs = ctx.get('jobs')
272
274
  if (jobs === undefined) {
273
- throw new Error('background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs')
275
+ throw new ToolContextUnavailableError('background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs')
274
276
  }
275
277
  let run!: WorkflowRun
276
278
  const jobId = jobs.start({
@@ -327,6 +329,7 @@ export function apply(ctx: Context, config: Config): void {
327
329
  name: `tool:${toolName}`,
328
330
  order: ctx.systemPrompt.getSectionOrder('TOOL_WORKFLOW'),
329
331
  text: `Use the ${toolName} tool ONLY when the user explicitly asks for a workflow or for large multi-agent orchestration: you write a JavaScript script (the tool description documents the exact format) that fans work out across many subagents with phases and structured results. For one or two delegations, prefer plain subagent calls.`,
332
+ retirement: `The ${toolName} tool is no longer available. Its instructions no longer apply.`,
330
333
  })
331
334
  ctx.tools.register(defineTool({
332
335
  name: toolName,
@@ -412,11 +415,12 @@ export function apply(ctx: Context, config: Config): void {
412
415
  // The loop sets `exec.agent` for every model-driven call; its absence
413
416
  // means a non-agent caller invoked the tool directly, which has no
414
417
  // parent to attribute the children to. Fail loud rather than guess.
415
- throw new Error('workflow tool requires a calling agent (exec.agent was undefined)')
418
+ throw new ToolContextUnavailableError('workflow tool requires a calling agent (exec.agent was undefined)')
416
419
  }
417
420
  if (args.run_in_background === true) {
418
421
  if (!enableRunInBackground) {
419
- throw new Error('run_in_background is disabled for this tool')
422
+ // The schema omits the field when disabled, so the model corrects by omitting it.
423
+ throw new ToolArgsError(['run_in_background is disabled for this tool'])
420
424
  }
421
425
  // No pre-abort check here, unlike bash/pwsh: ToolRuntime re-reads the
422
426
  // caller signal right before execute(), and this branch reaches
@@ -455,9 +459,11 @@ export function apply(ctx: Context, config: Config): void {
455
459
  result = await run.result
456
460
  const error = stopReasonError(result)
457
461
  if (error !== undefined) {
458
- // Map a non-clean finish to an isError result (the registry turns a
459
- // throw into an isError). Report the reason, not partial output.
460
- throw new Error(error)
462
+ // Caller cancellation keeps the registry's AbortError identity; any
463
+ // other non-clean finish becomes a coded isError result. Report the
464
+ // reason, not partial output.
465
+ exec.signal.throwIfAborted()
466
+ throw error
461
467
  }
462
468
  return {
463
469
  kind: 'foreground' as const,
@@ -473,7 +479,7 @@ export function apply(ctx: Context, config: Config): void {
473
479
  await run.dispose()
474
480
  if (recordsRun) {
475
481
  /* v8 ignore next -- WorkflowRun.result never rejects by contract, so result is assigned before finally. */
476
- if (result === undefined) throw new Error('workflow run settled without a result')
482
+ if (result === undefined) throw new WorkflowError('workflow run settled without a result', 'RUN_FAILED')
477
483
  recorder.finish(run.id, result.stopReason)
478
484
  }
479
485
  } finally {
package/src/record.ts CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  import type { Context } from '@deepseek-ai/cordis'
12
12
  import type { JobHandle } from '@deepseek-ai/dsh-jobs'
13
- import type { WorkflowRunId } from '@deepseek-ai/dsh-workflow'
13
+ import type { WorkflowRunId } from '@deepseek-ai/dsh-workflow/types'
14
14
 
15
15
  /** Job-ring taps for the background runs the tool tracks. */
16
16
  export interface WorkflowRecordMirror {