@deepseek-ai/dsh-headless 0.1.2-alpha.3 → 0.1.2-alpha.5

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/bundle/headless/README.md
5
- README.md: 282fa76dd720751d61ba7f44e5e35884d5f21e8f
6
- README.zh.md: 5a2727a25e6e4840900ebc9dc70d10ff13db12dd
5
+ README.md: 644a96ebb19c9ccecbfb3a08fdf4182dc668f0e5
6
+ README.zh.md: e1b954f876b7f90167e4dab313b88f66b1d20512
package/README.md CHANGED
@@ -78,13 +78,13 @@ A completed final `turn/end` exits 0; any other outcome — aborted, error, or n
78
78
  | [`src/index.ts`](src/index.ts) | The `headless-runner` plugin: run flow, output contract, exit mapping |
79
79
  | [`src/startup.ts`](src/startup.ts) | The `headless-startup` provider: task positional and `--help` |
80
80
  | [`cordis.patch.yml`](cordis.patch.yml) | The one-shot patch over `dsh-base` |
81
- | [`src/invariant.ts`](src/invariant.ts) | Invariant companion: no runtime invariant; the observable contract is process-level |
81
+ | — | No runtime invariant companion is published; the runner's observable contract (provider reasoning on stderr, final text on stdout, exit code by turn-end reason) is process-level and owned by the launcher e2e; it registers nothing and holds no mutable relation to audit inside the tree. |
82
82
  | [`tests/headless.spec.ts`](tests/headless.spec.ts) | Run flow, aggregation, flush, and exit mapping |
83
83
  | [`tests/startup.spec.ts`](tests/startup.spec.ts) | Command-line parsing over a real Loader tree |
84
84
 
85
85
  ### Invariant ownership
86
86
 
87
- The invariant companion registers an empty installer because the runner's observable contract (final text on stdout, exit code by turn-end reason) is process-level and owned by the launcher e2e; the plugin registers nothing and holds no mutable relation to audit inside the tree.
87
+ No invariant companion is published because the runner's observable contract (final text on stdout, exit code by turn-end reason) is process-level and owned by the launcher e2e; the plugin registers nothing and holds no mutable relation to audit inside the tree.
88
88
 
89
89
  </details>
90
90
 
package/README.zh.md CHANGED
@@ -78,13 +78,13 @@ patch 叠加在 `dsh-base` 之上:继承投影缓存,在基础 `system-promp
78
78
  | [`src/index.ts`](src/index.ts) | `headless-runner` 插件:运行流程、输出约定、退出映射 |
79
79
  | [`src/startup.ts`](src/startup.ts) | `headless-startup` 提供方:任务位置参数与 `--help` |
80
80
  | [`cordis.patch.yml`](cordis.patch.yml) | 叠加在 `dsh-base` 之上的一次性 patch |
81
- | [`src/invariant.ts`](src/invariant.ts) | 不变式伴生插件:无运行时不变式;可观察约定是进程级的 |
81
+ | — | 不发布运行时不变式伴生入口;可观察的行为属于进程级组合,本包只持有静态 patch 列表。 |
82
82
  | [`tests/headless.spec.ts`](tests/headless.spec.ts) | 运行流程、汇总、flush 与退出映射 |
83
83
  | [`tests/startup.spec.ts`](tests/startup.spec.ts) | 在真实 Loader 树上的命令行解析 |
84
84
 
85
85
  ### 不变式归属
86
86
 
87
- 不变式伴生插件注册一个空安装器,因为 runner 的可观察约定(stdout 的最终文本、按轮次结束原因决定的退出码)是进程级的、由启动器 e2e 负责;插件不注册任何内容,树内也没有任何可变关系可审计。
87
+ 不发布不变式伴生入口,因为 runner 的可观察约定(stdout 的最终文本、按轮次结束原因决定的退出码)是进程级的、由启动器 e2e 负责;插件不注册任何内容,树内也没有任何可变关系可审计。
88
88
 
89
89
  </details>
90
90
 
package/lib/index.js CHANGED
@@ -4,6 +4,7 @@ import { brandString } from "@deepseek-ai/dsh-brand";
4
4
  import { installModelSelection } from "@deepseek-ai/dsh-agent";
5
5
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
6
6
  import { assertNever } from "@deepseek-ai/dsh-util-values";
7
+ import { SessionSeq } from "@deepseek-ai/dsh-session";
7
8
  //#region lib/types/index.js
8
9
  /**
9
10
  * @deepseek-ai/dsh-headless — one-shot direct Agent driver. The bundle patch
@@ -29,12 +30,14 @@ const internals = {
29
30
  stderr: process.stderr
30
31
  };
31
32
  /** Aggregate the last assistant text and turn outcome in one owned interval. */
32
- function summarize(events, firstSeq) {
33
+ function summarize(session, firstSeq) {
33
34
  let started = false;
34
35
  let text = "";
35
36
  let reason;
36
- for (const event of events) {
37
- if (event.seq < firstSeq) continue;
37
+ const length = session.seq;
38
+ for (let seq = firstSeq; seq < length; seq++) {
39
+ const event = session.eventAt(SessionSeq(seq));
40
+ if (event === void 0) throw new Error(`headless summary cannot read seq ${String(seq)} below captured length ${String(length)}`);
38
41
  if (event.type === "turn/start") {
39
42
  started = true;
40
43
  continue;
@@ -157,7 +160,7 @@ async function run(ctx, task, io) {
157
160
  stopReasoning();
158
161
  }
159
162
  await sessions.flush(agent.session);
160
- const outcome = summarize(agent.session.events, firstSeq);
163
+ const outcome = summarize(agent.session, firstSeq);
161
164
  io.stdout.write(outcome.text + "\n");
162
165
  if (outcome.reason?.kind === "error") io.stderr.write(`dsh: ${outcome.reason.error.code}: ${outcome.reason.error.message}\n`);
163
166
  io.exit(outcome.reason?.kind === "completed" ? 0 : 1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-headless",
3
3
  "description": "The dsh one-shot bundle: a direct core Agent/Session runner over dsh-base with no Host, HTTP, or browser layer",
4
- "version": "0.1.2-alpha.3",
4
+ "version": "0.1.2-alpha.5",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -22,17 +22,12 @@
22
22
  "types": "./lib/types/startup.d.ts",
23
23
  "default": "./lib/startup.js"
24
24
  },
25
- "./invariant": {
26
- "types": "./lib/types/invariant.d.ts",
27
- "default": "./lib/invariant.js"
28
- },
29
25
  "./cordis.patch.yml": "./cordis.patch.yml",
30
26
  "./src/*": "./src/*",
31
27
  "./package.json": "./package.json"
32
28
  },
33
29
  "files": [
34
30
  "lib/index.js",
35
- "lib/invariant.js",
36
31
  "lib/startup.js",
37
32
  "cordis.patch.yml",
38
33
  "lib/types/**/*.d.ts"
@@ -45,28 +40,26 @@
45
40
  },
46
41
  "dependencies": {
47
42
  "commander": "^15.0.0",
48
- "@deepseek-ai/dsh-brand": "^0.1.2-alpha.3",
49
- "@deepseek-ai/dsh-cmdline": "^0.1.2-alpha.3",
50
- "@deepseek-ai/dsh-code-runtime-worker-thread": "^0.1.2-alpha.3",
51
- "@deepseek-ai/dsh-util-values": "^0.1.2-alpha.3",
43
+ "@deepseek-ai/dsh-cmdline": "^0.1.2-alpha.5",
44
+ "@deepseek-ai/dsh-brand": "^0.1.2-alpha.5",
45
+ "@deepseek-ai/dsh-code-runtime-worker-thread": "^0.1.2-alpha.5",
46
+ "@deepseek-ai/dsh-util-values": "^0.1.2-alpha.5",
52
47
  "@deepseek-ai/schemastery": "^3.18.2"
53
48
  },
54
49
  "peerDependencies": {
55
50
  "@deepseek-ai/cordis": "^4.0.2",
56
51
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
57
- "@deepseek-ai/dsh-agent": "^0.1.2-alpha.3",
58
- "@deepseek-ai/dsh-agent-default-model": "^0.1.2-alpha.3",
59
- "@deepseek-ai/dsh-llm": "^0.1.2-alpha.3",
60
- "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
61
- "@deepseek-ai/dsh-session": "^0.1.2-alpha.3"
52
+ "@deepseek-ai/dsh-agent": "^0.1.2-alpha.5",
53
+ "@deepseek-ai/dsh-llm": "^0.1.2-alpha.5",
54
+ "@deepseek-ai/dsh-session": "^0.1.2-alpha.5",
55
+ "@deepseek-ai/dsh-agent-default-model": "^0.1.2-alpha.5"
62
56
  },
63
57
  "devDependencies": {
64
58
  "@deepseek-ai/cordis": "^4.0.2",
65
59
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
66
- "@deepseek-ai/dsh-agent": "^0.1.2-alpha.3",
67
- "@deepseek-ai/dsh-agent-default-model": "^0.1.2-alpha.3",
68
- "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
69
- "@deepseek-ai/dsh-llm": "^0.1.2-alpha.3",
70
- "@deepseek-ai/dsh-session": "^0.1.2-alpha.3"
60
+ "@deepseek-ai/dsh-agent": "^0.1.2-alpha.5",
61
+ "@deepseek-ai/dsh-agent-default-model": "^0.1.2-alpha.5",
62
+ "@deepseek-ai/dsh-llm": "^0.1.2-alpha.5",
63
+ "@deepseek-ai/dsh-session": "^0.1.2-alpha.5"
71
64
  }
72
65
  }
package/lib/invariant.js DELETED
@@ -1,25 +0,0 @@
1
- //#region lib/types/invariant.js
2
- /**
3
- * Package-owned invariant companion for `@deepseek-ai/dsh-headless`.
4
- * @module @deepseek-ai/dsh-headless/invariant
5
- */
6
- const PACKAGE_NAME = "@deepseek-ai/dsh-headless";
7
- /** Cordis companion plugin name. */
8
- const name = "headless-invariant";
9
- /** Service required before the companion can register. */
10
- const inject = ["invariants"];
11
- /**
12
- * No runtime invariant: the runner's observable contract (provider reasoning
13
- * on stderr, final text on stdout, exit code by turn-end reason) is
14
- * process-level and owned by the launcher e2e; it registers nothing and holds
15
- * no mutable relation to audit inside the tree.
16
- */
17
- const install = () => {};
18
- /**
19
- * Register this package's invariant companion.
20
- * @param ctx - Cordis context carrying the invariant service.
21
- * @returns the installed registration's disposer after setup succeeds.
22
- */
23
- const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
24
- //#endregion
25
- export { apply, inject, name };
@@ -1,16 +0,0 @@
1
- /**
2
- * Package-owned invariant companion for `@deepseek-ai/dsh-headless`.
3
- * @module @deepseek-ai/dsh-headless/invariant
4
- */
5
- import type { Context } from '@deepseek-ai/cordis';
6
- /** Cordis companion plugin name. */
7
- export declare const name = "headless-invariant";
8
- /** Service required before the companion can register. */
9
- export declare const inject: string[];
10
- /**
11
- * Register this package's invariant companion.
12
- * @param ctx - Cordis context carrying the invariant service.
13
- * @returns the installed registration's disposer after setup succeeds.
14
- */
15
- export declare const apply: (ctx: Context) => Promise<() => void>;
16
- //# sourceMappingURL=invariant.d.ts.map