@deepseek-ai/dsh-workflow 0.1.5-rc.2 → 0.1.6-alpha.1

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
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/workflow/workflow/README.md
5
- README.md: e350f511c4acec0d50a22afb7882d3b21d207060
6
- README.zh.md: 51153ca75a680783c5e67b0f7932e935207621b5
5
+ README.md: de167e520e34d823f14cb6c13c57b24067ceb85a
6
+ README.zh.md: 77f2cddd3dbdb07df994d203892d1ed3ab359eed
package/README.md CHANGED
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- Run a plain-JavaScript orchestration script that fans work out to subagents and returns the script's final JSON value. Scripts can use `agent()`, `parallel()`, `pipeline()`, `phase()`, and `log()`; models normally access them through the `workflow` tool. Each run belongs to its caller, attributes every child to the invoking agent, resolves failures and cancellation without rejecting its result, and stops disposal within a bounded grace period. The caller must supply an execution engine, allowing the isolation strategy to change without altering visible behavior.
12
+ Run a plain-JavaScript orchestration script that fans work out to subagents and returns the script's final JSON value. Scripts can use `agent()`, `parallel()`, `pipeline()`, `phase()`, and `log()`; models normally access them through the `workflow` tool. Each run belongs to its caller, attributes every child to the invoking agent, resolves failures and cancellation without rejecting its result, and awaits script and child cleanup during disposal. The caller must supply an execution engine, allowing the isolation strategy to change without altering visible behavior.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -50,7 +50,7 @@ When the script settles, the run's result resolves with the returned value, the
50
50
 
51
51
  Plugin consumers can start a run directly: `ctx.workflowEngine.start({ script, meta, args?, parent, signal? })`. `parent` attributes every child to the invoking agent; `signal` cancels the run when aborted. `start()` validates the meta block and parses the script before a run exists, so a malformed request fails immediately with a violation list.
52
52
 
53
- A returned run exposes `id`, `meta`, `result`, `cancel(reason?)`, and `dispose()`. The result never rejects: a script failure resolves with `stopReason: 'error'`, cancellation with `'cancelled'`. The caller owns the run — call `dispose()` on every path; it cancels remaining work and waits for script and children to settle within a bounded grace.
53
+ A returned run exposes `id`, `meta`, `result`, `cancel(reason?)`, and `dispose()`. The result never rejects: a script failure resolves with `stopReason: 'error'`, cancellation with `'cancelled'`. The caller owns the run — call `dispose()` on every path; it cancels remaining work and waits for script and child cleanup under the providers' lifecycle contracts.
54
54
 
55
55
  ### Failures and recovery
56
56
 
@@ -68,7 +68,7 @@ This section explains how the capability is split and where the contracts live;
68
68
 
69
69
  ### Design concept
70
70
 
71
- The package separates the script, run, result, and event contracts from execution: any engine can implement `ctx.workflowEngine` behind the same vocabulary, and one engine serves a context at a time — loading a second engine fails loud, so swapping engines means changing which engine plugin the composition loads. The `workflow/*` events are observe-only: payloads carry run identity snapshots, never the live run, so listeners cannot acquire cancellation or disposal authority.
71
+ The package separates the script, run, result, and event contracts from execution: any engine can implement `ctx.workflowEngine` behind the same vocabulary, and one engine serves a context at a time — loading a second engine fails loudly, so swapping engines means changing which engine plugin the composition loads. The `workflow/*` events are observe-only: payloads carry run identity snapshots, never the live run, so listeners cannot acquire cancellation or disposal authority.
72
72
 
73
73
  ### Source map
74
74
 
@@ -81,7 +81,7 @@ The package separates the script, run, result, and event contracts from executio
81
81
 
82
82
  ### Lifecycle and ownership
83
83
 
84
- A run is holder-owned: engine-plugin unload prevents new starts but does not revoke accepted runs, and the caller must dispose every run it starts. `dispose()` cancels if needed and awaits script and child quiescence within the engine's documented bound, so a consumer awaiting `result` is never wedged past a cancellation.
84
+ A run is holder-owned: engine-plugin unload prevents new starts but does not revoke accepted runs, and the caller must dispose every run it starts. `dispose()` cancels if needed and awaits script and child cleanup. The PTC engine aborts its managed process immediately; child disposal still follows each subagent provider's lifecycle contract.
85
85
 
86
86
  `workflow/start` and `workflow/end` pair the run; `workflow/phase` and `workflow/log` carry script narration; `workflow/agent-start` and `workflow/agent-end` pair each child call by `seq`. Every listener is independently contained: a throwing listener is logged without starving peers or changing execution, and each receives its own payload clone.
87
87
 
@@ -103,7 +103,7 @@ Read these pages when the package-level contract is not enough. They move from t
103
103
  - [Workflow subsystem](../../../docs/subsystems/workflow.md) — the full type vocabulary, start request, and event payloads.
104
104
  - [Group map](../README.md) — the workflow capability family and its packages.
105
105
  - [workflow tool](../tool-workflow/README.md) — the model-facing consumer that owns the call schema and result envelope.
106
- - [Worker-thread engine](../workflow-worker-thread/README.md) — the current execution engine and its isolation boundary.
106
+ - [PTC workflow engine](../workflow-ptc/README.md) — the current execution engine and its isolation boundary.
107
107
  - [Dynamic workflows Agent Note](../../../.agents/notes/implemented/feature/2026-07-05-dynamic-workflows.md) — the seam design and its decisions.
108
108
 
109
109
  -----
@@ -138,6 +138,6 @@ These limits define what the capability does not yet support. They are current c
138
138
 
139
139
  This Dev Note is working context for maintainers: open directions that are not decided. It is explicitly non-authoritative — shipped behavior, limits, and accepted rationale live in the sections above, the package code, and the linked Agent Notes.
140
140
 
141
- Deferred directions: a background start/poll API with spill handles and detached collection; saved and nested workflows; a token-budget vocabulary across children; and the seam's promise that a future process or sandbox engine can replace the worker-thread engine without changing the model-facing surface.
141
+ Deferred directions: a background start/poll API with spill handles and detached collection; saved and nested workflows; and a token-budget vocabulary across children.
142
142
 
143
143
  </details>
package/README.zh.md CHANGED
@@ -9,7 +9,7 @@ kind: "package-reference"
9
9
 
10
10
  ## 概述
11
11
 
12
- 运行一段纯 JavaScript 编排脚本,将工作扇出给 subagent,并返回脚本的最终 JSON 值。脚本可以使用 `agent()`、`parallel()`、`pipeline()`、`phase()` 和 `log()`;模型通常通过 `workflow` 工具访问它们。每次运行都归调用方所有,将每个子 agent 归属于调用它的 agent,在失败或取消时以结果兑现而不拒绝,并在有界宽限期内完成 dispose。调用方必须提供执行引擎,因此可以更换隔离策略而不改变可见行为。
12
+ 运行一段纯 JavaScript 编排脚本,将工作扇出给 subagent,并返回脚本的最终 JSON 值。脚本可以使用 `agent()`、`parallel()`、`pipeline()`、`phase()` 和 `log()`;模型通常通过 `workflow` 工具访问它们。每次运行都归调用方所有,将每个子 agent(智能体)归属于调用它的 agent,在失败或取消时以结果兑现而不拒绝,并在 dispose(资源释放)期间等待脚本与子 agent 清理完成。调用方必须提供执行引擎,因此可以更换隔离策略而不改变可见行为。
13
13
 
14
14
  ## 目录
15
15
 
@@ -50,11 +50,11 @@ return { reviewed: reviews.length }
50
50
 
51
51
  插件消费方可以直接启动运行:`ctx.workflowEngine.start({ script, meta, args?, parent, signal? })`。`parent` 把每个子 agent 归属于调用它的 agent;`signal` 在中止时取消运行。`start()` 在运行存在之前校验 meta 块并解析脚本,因此格式错误的请求会立即以违规清单失败。
52
52
 
53
- 返回的运行公开 `id`、`meta`、`result`、`cancel(reason?)` 与 `dispose()`。result 绝不拒绝:脚本失败以 `stopReason: 'error'` 兑现,取消以 `'cancelled'` 兑现。调用方拥有该运行——每条路径都要调用 `dispose()`;它会取消剩余工作,并在有界宽限期内等待脚本与子 agent 完全停稳。
53
+ 返回的运行公开 `id`、`meta`、`result`、`cancel(reason?)` 与 `dispose()`。result 绝不拒绝:脚本失败以 `stopReason: 'error'` 兑现,取消以 `'cancelled'` 兑现。调用方拥有该运行——每条路径都要调用 `dispose()`;它会取消剩余工作,并按提供方的生命周期约定等待脚本与子 agent 清理完成。
54
54
 
55
55
  ### 失败与恢复
56
56
 
57
- 无法解析的脚本、格式错误的 meta 块、不可用的提供方路由或不受支持的单次运行限制,都会在运行存在之前被同步拒绝;`workflow` 工具把这些报告为模型可以修正的错误。执行期间,钩子误用——错误参数、未知选项、不支持的 schema、超出上限——会响亮地终止脚本,而不会溶解为逐项 `null`。普通子 agent 失败不是基础设施错误:`agent()` 以 `null` 兑现,由脚本决定如何处理。
57
+ 无法解析的脚本、格式错误的 meta 块、不可用的提供方路由或不受支持的单次运行限制,都会在运行存在之前被同步拒绝;`workflow` 工具把这些报告为模型可以修正的错误。执行期间,钩子误用——错误参数、未知选项、不支持的 schema、超出上限——会明确终止脚本,而不会转为逐项 `null`。普通子 agent 失败不是基础设施错误:`agent()` 以 `null` 兑现,由脚本决定如何处理。
58
58
 
59
59
  -----
60
60
 
@@ -64,11 +64,11 @@ return { reviewed: reviews.length }
64
64
  <details>
65
65
  <summary>实现细节——点击展开</summary>
66
66
 
67
- 本节解释能力如何拆分、契约位于何处;可观察行为已在[使用本包](#use-this-package)中完整说明。
67
+ 本节解释能力如何拆分、约定位于何处;可观察行为已在[使用本包](#use-this-package)中完整说明。
68
68
 
69
69
  ### 设计理念
70
70
 
71
- 本包把脚本、运行、结果与事件契约同执行分开:任何引擎都可以在同一词汇背后实现 `ctx.workflowEngine`,一个上下文同时只有一个引擎——加载第二个引擎会立即失败,因此更换引擎意味着更改组合所加载的引擎插件。`workflow/*` 事件只供观察:payload 携带运行身份快照,绝不携带活动运行,因此监听器无法取得取消或 dispose 权限。
71
+ 本包把脚本、运行、结果与事件约定同执行分开:任何引擎都可以在同一词汇背后实现 `ctx.workflowEngine`,一个上下文同时只有一个引擎——加载第二个引擎会明确报错,因此更换引擎意味着更改组合所加载的引擎插件。`workflow/*` 事件只供观察:payload 携带运行身份快照,绝不携带活动运行,因此监听器无法取得取消或 dispose 权限。
72
72
 
73
73
  ### 源码地图
74
74
 
@@ -81,13 +81,13 @@ return { reviewed: reviews.length }
81
81
 
82
82
  ### 生命周期与归属
83
83
 
84
- 运行由持有方负责:引擎插件卸载会阻止新的启动,但不会撤销已接受的运行,调用方必须 dispose 自己启动的每个运行。`dispose()` 在需要时取消,并在引擎文档规定的期限内等待脚本与子 agent 完全停稳,因此等待 `result` 的消费方绝不会因取消而卡死。
84
+ 运行由持有方负责:引擎插件卸载会阻止新的启动,但不会撤销已接受的运行,调用方必须 dispose 自己启动的每个运行。`dispose()` 在需要时取消,并等待脚本与子 agent 清理完成。PTC 引擎立即中止受管进程;子 agent 的资源释放仍遵循各 subagent 提供方的生命周期约定。
85
85
 
86
86
  `workflow/start` 与 `workflow/end` 为运行配对;`workflow/phase` 与 `workflow/log` 携带脚本叙述;`workflow/agent-start` 与 `workflow/agent-end` 按 `seq` 为每次子 agent 调用配对。每个监听器都独立隔离:抛错的监听器只记录日志,不会饿死同级监听器或改变执行,并且每个监听器都会收到自己的 payload 副本。
87
87
 
88
88
  ### 失败纪律
89
89
 
90
- `WorkflowError` 携带机器可路由的 code 与 `fatal` 标志;每个 code 都是致命的,`parallel()` 与 `pipeline()` 会重新抛出致命错误,而不是把条目映射为 `null`——拼错的选项必须响亮地终止脚本。code 覆盖启动失败、契约违规、超出上限、提供方与结果故障、不可序列化值与取消;完整集合与含义见 [`src/index.ts`](src/index.ts)。
90
+ `WorkflowError` 携带机器可路由的 code 与 `fatal` 标志;每个 code 都是致命的,`parallel()` 与 `pipeline()` 会重新抛出致命错误,而不是把条目映射为 `null`——拼错的选项必须明确终止脚本。code 覆盖启动失败、约定违规、超出上限、提供方与结果故障、不可序列化值与取消;完整集合与含义见 [`src/index.ts`](src/index.ts)。
91
91
 
92
92
  逐项 `null` 只保留给子运行失败与阶段内普通脚本错误,因此以非完成结束原因正常结算的子 agent 不属于基础设施异常:`agent()` 返回 `null`,让脚本处理普通子 agent 失败。
93
93
 
@@ -103,7 +103,7 @@ return { reviewed: reviews.length }
103
103
  - [工作流子系统](../../../docs/subsystems/workflow.zh.md)——完整类型词汇、启动请求与事件载荷。
104
104
  - [组地图](../README.zh.md)——工作流能力家族及其包。
105
105
  - [workflow 工具](../tool-workflow/README.zh.md)——拥有调用 schema 与结果包络的模型侧消费方。
106
- - [worker-thread 引擎](../workflow-worker-thread/README.zh.md)——当前执行引擎及其隔离边界。
106
+ - [PTC 工作流引擎](../workflow-ptc/README.zh.md)——当前执行引擎及其隔离边界。
107
107
  - [动态工作流 Agent Note](../../../.agents/notes/implemented/feature/2026-07-05-dynamic-workflows.zh.md)——seam 设计及其决策。
108
108
 
109
109
  -----
@@ -138,6 +138,6 @@ return { reviewed: reviews.length }
138
138
 
139
139
  本开发备注是维护者的工作上下文:尚未决定的开放方向。它明确不具权威性——已交付的行为、限制与既定理由以上文、包代码与相关 Agent Note 为准。
140
140
 
141
- 暂缓的方向:带 spill 句柄与分离收集的后台启动/轮询 API;已保存与嵌套工作流;跨子 agent 的 token 预算词汇;以及该 seam 的承诺——未来的进程或沙箱引擎可以在不改变模型侧表面的前提下替换 worker-thread 引擎。
141
+ 暂缓的方向:带 spill 句柄与分离收集的后台启动/轮询 API;已保存与嵌套工作流;以及跨子 agent 的 token 预算词汇。
142
142
 
143
143
  </details>
package/lib/index.js CHANGED
@@ -51,8 +51,8 @@ function isFatalWorkflowError(error) {
51
51
  }
52
52
  /**
53
53
  * Workflow Service Definition contract. Invalid requests throw before publication; a live
54
- * run is holder-owned, its result never rejects, cancellation and disposal are
55
- * bounded, and disposal waits for child cleanup within that bound. Lifecycle
54
+ * run is holder-owned, its result never rejects, and disposal waits for script
55
+ * and child cleanup. Lifecycle
56
56
  * listener failures are contained, and `workflow/end` fires exactly once as the
57
57
  * result settles.
58
58
  */
@@ -51,7 +51,7 @@ declare module '@deepseek-ai/cordis' {
51
51
  * One `agent()` call settled (clean result, child failure, or run
52
52
  * cancellation). Paired with {@link Events['workflow/agent-start']} by
53
53
  * `agent.seq`, exactly once per started call on every stop path — on an
54
- * engine termination path (a worker killed past its grace) the end is
54
+ * engine termination path the end is
55
55
  * engine-synthesized with outcome `'cancelled'`.
56
56
  * @param info - the run's identity snapshot.
57
57
  * @param agent - the call identity plus its outcome.
@@ -103,8 +103,8 @@ export declare class WorkflowError extends HarnessError {
103
103
  export declare function isFatalWorkflowError(error: unknown): boolean;
104
104
  /**
105
105
  * Workflow Service Definition contract. Invalid requests throw before publication; a live
106
- * run is holder-owned, its result never rejects, cancellation and disposal are
107
- * bounded, and disposal waits for child cleanup within that bound. Lifecycle
106
+ * run is holder-owned, its result never rejects, and disposal waits for script
107
+ * and child cleanup. Lifecycle
108
108
  * listener failures are contained, and `workflow/end` fires exactly once as the
109
109
  * result settles.
110
110
  */
@@ -34,8 +34,8 @@ export function isFatalWorkflowError(error) {
34
34
  }
35
35
  /**
36
36
  * Workflow Service Definition contract. Invalid requests throw before publication; a live
37
- * run is holder-owned, its result never rejects, cancellation and disposal are
38
- * bounded, and disposal waits for child cleanup within that bound. Lifecycle
37
+ * run is holder-owned, its result never rejects, and disposal waits for script
38
+ * and child cleanup. Lifecycle
39
39
  * listener failures are contained, and `workflow/end` fires exactly once as the
40
40
  * result settles.
41
41
  */
@@ -39,7 +39,7 @@ export interface WorkflowRun {
39
39
  readonly result: Promise<WorkflowResult>;
40
40
  /** Cancel the run and its children. */
41
41
  cancel(reason?: string): void;
42
- /** Cancel if needed and await bounded settlement and cleanup. */
42
+ /** Cancel if needed and await script and child cleanup. */
43
43
  dispose(): Promise<void>;
44
44
  }
45
45
  //# sourceMappingURL=runtime-types.d.ts.map
@@ -70,8 +70,8 @@ export interface WorkflowResult {
70
70
  /**
71
71
  * How many `agent()` calls the run accepted over its whole lifetime. On a
72
72
  * graceful settlement this is the script-side count (calls still queued for
73
- * a concurrency slot included); on a termination path (grace force-settle,
74
- * worker death) it degrades to the host-observed count — calls queued
73
+ * a concurrency slot included); on a termination path (cancellation or
74
+ * process failure) it degrades to the host-observed count — calls queued
75
75
  * inside a terminated script are unknowable then.
76
76
  */
77
77
  agentsStarted: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-workflow",
3
3
  "description": "Workflow capability seam: ctx.workflowEngine service, run vocabulary, and workflow/* events",
4
- "version": "0.1.5-rc.2",
4
+ "version": "0.1.6-alpha.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -37,19 +37,19 @@
37
37
  ],
38
38
  "license": "MIT",
39
39
  "peerDependencies": {
40
- "@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
41
- "@deepseek-ai/dsh-brand": "^0.1.5-rc.2",
42
- "@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
43
- "@deepseek-ai/dsh-llm": "^0.1.5-rc.2",
44
- "@deepseek-ai/dsh-session": "^0.1.5-rc.2",
40
+ "@deepseek-ai/dsh-brand": "^0.1.6-alpha.1",
41
+ "@deepseek-ai/dsh-agent": "^0.1.6-alpha.1",
42
+ "@deepseek-ai/dsh-llm": "^0.1.6-alpha.1",
43
+ "@deepseek-ai/dsh-invariants": "^0.1.6-alpha.1",
44
+ "@deepseek-ai/dsh-session": "^0.1.6-alpha.1",
45
45
  "@deepseek-ai/cordis": "^4.0.2"
46
46
  },
47
47
  "devDependencies": {
48
- "@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
49
- "@deepseek-ai/dsh-brand": "^0.1.5-rc.2",
50
- "@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
51
- "@deepseek-ai/dsh-llm": "^0.1.5-rc.2",
52
- "@deepseek-ai/dsh-session": "^0.1.5-rc.2",
48
+ "@deepseek-ai/dsh-agent": "^0.1.6-alpha.1",
49
+ "@deepseek-ai/dsh-brand": "^0.1.6-alpha.1",
50
+ "@deepseek-ai/dsh-invariants": "^0.1.6-alpha.1",
51
+ "@deepseek-ai/dsh-llm": "^0.1.6-alpha.1",
52
+ "@deepseek-ai/dsh-session": "^0.1.6-alpha.1",
53
53
  "@deepseek-ai/cordis": "^4.0.2"
54
54
  }
55
55
  }