@deepseek-ai/dsh-headless 0.0.1-rc.1 → 0.0.1-rc.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
@@ -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: 31a4894dbb191d2244371ca7272339e96e253053
6
- README.zh.md: 6e8d28f10071fbab175c4f14f1aaa9618b8f598a
5
+ README.md: 3d9ca350f5f8891e60cfc57c9ca89ef57d9790d3
6
+ README.zh.md: 1dcba9635b37efebeb0cc1129cc67bc7c01d0d1d
package/README.md CHANGED
@@ -4,7 +4,7 @@ English | [中文](README.zh.md)
4
4
 
5
5
  The dsh one-shot bundle. [`cordis.patch.yml`](cordis.patch.yml) rides directly over [`dsh-base`](../base/README.md): it supplies the coding persona and tool mode, disables HMR, mounts Code Mode's worker as a core execution capability, and inserts this package's `headless-runner` plugin (config `{task}`, resolved from the injected `headlessStartup` provider). It mounts no Host, HTTP server, Web runtime, or browser plugin.
6
6
 
7
- After the Loader settles, the runner reads the shared [`ctx.agentDefaultModel`](../../core/agent-default-model/README.md), creates one fresh persisted Agent through `ctx.agents`, submits the task as an ordinary user message, and waits for quiescence. It flushes the Session before folding the owned durable event interval, writes the last non-empty assistant text to stdout, and requests exit through the launcher-provided `ctx.headlessIo` host hook (final `turn/end` completed → 0, otherwise 1). A terminal `error` reason also writes its code and message to stderr; successful runs keep stderr empty. The process opens no listening port. The task text is this app's command line: the ordinary `headless-startup` provider ([`src/startup.ts`](src/startup.ts)) injects `ctx.cmdlineArgs` ([`dsh-cmdline`](../../boot/cmdline/README.md)), reads the positional argument of `dsh --profile headless "task"`, prints the app's `--help`, and provides `headlessStartup`; the runner injects that service and reads its task from lazy config. A missing or whitespace-only task is rejected before the runner activates.
7
+ After the Loader settles, the runner reads the shared [`ctx.agentDefaultModel`](../../core/agent-default-model/README.md), creates one fresh persisted Agent through `ctx.agents`, submits the task as an ordinary user message, and waits for quiescence. It flushes the Session before folding the owned durable event interval, writes the last non-empty assistant text to stdout, and requests exit through the launcher-provided `ctx.appExit` host hook ([`dsh-cmdline`](../../boot/cmdline/README.md)) (final `turn/end` completed → 0, otherwise 1). A terminal `error` reason also writes its code and message to stderr; successful runs keep stderr empty. The process opens no listening port. The task text is this app's command line: the ordinary `headless-startup` provider ([`src/startup.ts`](src/startup.ts)) injects `ctx.cmdlineArgs` ([`dsh-cmdline`](../../boot/cmdline/README.md)), reads the positional argument of `dsh --profile headless "task"`, prints the app's `--help`, and provides `headlessStartup`; the runner injects that service and reads its task from lazy config. A missing or whitespace-only task is rejected before the runner activates.
8
8
 
9
9
  ## Model Experience
10
10
 
@@ -17,4 +17,4 @@ None; the runner adds nothing to the request prefix.
17
17
  ## Known Limitations and Deferred Work
18
18
 
19
19
  - **One submitted task only** — the runner has no interactive follow-up surface; it waits through any work the Agent completes before returning to idle and prints the last non-empty assistant message in that interval.
20
- - **`ctx.headlessIo` is launcher-owned** — booting the headless profile outside the `dsh` launcher fails loud at activation until the host provides the hook.
20
+ - **`ctx.appExit` is launcher-owned** — booting the headless profile outside the `dsh` launcher fails loud at activation until the host provides the exit request.
package/README.zh.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  dsh 一次性任务组合包。[`cordis.patch.yml`](cordis.patch.yml) 直接叠加在 [`dsh-base`](../base/README.md) 之上:提供编码 persona 和工具模式、禁用 HMR(热模块替换)、将 Code Mode 的 worker 作为核心执行能力挂载,并插入本包的 `headless-runner` 插件(配置为 `{task}`,从注入的 `headlessStartup` 提供方解析)。它不挂载任何 Host、HTTP server、Web runtime 或浏览器插件。
6
6
 
7
- Loader 结算后,runner 读取共享的 [`ctx.agentDefaultModel`](../../core/agent-default-model/README.md),通过 `ctx.agents` 创建一个全新的持久化 Agent(智能体),将任务作为普通用户消息提交,并等待完全停稳。它对 Session 执行 flush 后再汇总自身持有的持久化事件区间,将最后一条非空 assistant 文本写入 stdout,再经启动器提供的 `ctx.headlessIo` 宿主钩子请求退出(最终 `turn/end` 完成 → 0,否则为 1)。最终 reason 为 `error` 时,还会将持久化的 code 与 message 写入 stderr;成功运行时 stderr 保持为空。进程不会打开监听端口。任务文本就是这个应用的命令行:普通 `headless-startup` 提供方([`src/startup.ts`](src/startup.ts))注入 `ctx.cmdlineArgs`([`dsh-cmdline`](../../boot/cmdline/README.md)),读取 `dsh --profile headless "task"` 的位置参数、打印应用自己的 `--help`,并提供 `headlessStartup`;runner 注入该服务,再从惰性配置中读取任务。缺失或只有空白的任务会在 runner 激活前被拒绝。
7
+ Loader 结算后,runner 读取共享的 [`ctx.agentDefaultModel`](../../core/agent-default-model/README.md),通过 `ctx.agents` 创建一个全新的持久化 Agent(智能体),将任务作为普通用户消息提交,并等待完全停稳。它对 Session 执行 flush 后再汇总自身持有的持久化事件区间,将最后一条非空 assistant 文本写入 stdout,再经启动器提供的 `ctx.appExit` 宿主钩子([`dsh-cmdline`](../../boot/cmdline/README.md))请求退出(最终 `turn/end` 完成 → 0,否则为 1)。最终 reason 为 `error` 时,还会将持久化的 code 与 message 写入 stderr;成功运行时 stderr 保持为空。进程不会打开监听端口。任务文本就是这个应用的命令行:普通 `headless-startup` 提供方([`src/startup.ts`](src/startup.ts))注入 `ctx.cmdlineArgs`([`dsh-cmdline`](../../boot/cmdline/README.md)),读取 `dsh --profile headless "task"` 的位置参数、打印应用自己的 `--help`,并提供 `headlessStartup`;runner 注入该服务,再从惰性配置中读取任务。缺失或只有空白的任务会在 runner 激活前被拒绝。
8
8
 
9
9
  ## 模型体验
10
10
 
@@ -17,4 +17,4 @@ Loader 结算后,runner 读取共享的 [`ctx.agentDefaultModel`](../../core/a
17
17
  ## 已知限制与延期工作
18
18
 
19
19
  - **只提交一个任务**:runner 没有用于交互式后续输入的 surface;它会等待 Agent 在返回 idle 前完成的所有工作,并打印该区间内最后一条非空 assistant 消息。
20
- - **`ctx.headlessIo` 由启动器持有**:在 `dsh` 启动器之外启动 headless profile 会在激活时明确报错,直到宿主提供该钩子。
20
+ - **`ctx.appExit` 由启动器持有**:在 `dsh` 启动器之外启动 headless profile 会在激活时明确报错,直到宿主提供该退出请求。
package/cordis.patch.yml CHANGED
@@ -9,7 +9,8 @@
9
9
  persona: >-
10
10
  You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
11
11
 
12
- # One-shot runs never watch or reload their composition.
12
+ # The shared module-reload HMR row stays off; the launcher's watch-only
13
+ # fallback still keeps the user patch layers live until the run exits.
13
14
  - id: hmr
14
15
  disabled: true
15
16
 
package/lib/index.js CHANGED
@@ -21,6 +21,11 @@ const inject = [
21
21
  "sessions"
22
22
  ];
23
23
  const Config = z.object({ task: z.string().required() });
24
+ /** The process streams the runner writes to; tests substitute captures. */
25
+ const internals = {
26
+ stdout: process.stdout,
27
+ stderr: process.stderr
28
+ };
24
29
  /** Aggregate the last assistant text and turn outcome in one owned interval. */
25
30
  function summarize(events, firstSeq) {
26
31
  let started = false;
@@ -94,15 +99,20 @@ async function run(ctx, task, io) {
94
99
  }
95
100
  /**
96
101
  * Mount the one-shot direct driver.
97
- * @param ctx - plugin context carrying core services and the launcher-owned IO seam.
102
+ * @param ctx - plugin context carrying core services and the launcher-provided exit request.
98
103
  * @param config - validated task config.
99
104
  */
100
105
  function apply(ctx, config) {
101
- const io = ctx.headlessIo;
102
- if (io === void 0) throw new Error("headless-runner: the launcher must provide ctx.headlessIo before the tree mounts");
106
+ const exit = ctx.get("appExit");
107
+ if (exit === void 0) throw new Error("headless-runner: the launcher must provide ctx.appExit before the tree mounts");
108
+ const io = {
109
+ stdout: internals.stdout,
110
+ stderr: internals.stderr,
111
+ exit
112
+ };
103
113
  run(ctx, config.task, io).catch((error) => {
104
114
  fail(io, error);
105
115
  });
106
116
  }
107
117
  //#endregion
108
- export { Config, apply, inject, name };
118
+ export { Config, apply, inject, internals, name };
@@ -18,11 +18,8 @@ export interface Config {
18
18
  task: string;
19
19
  }
20
20
  export declare const Config: z<Config>;
21
- /**
22
- * Process-facing effects of one run, injectable for tests. The launcher owns
23
- * bounded tree shutdown and wires `exit()` to it.
24
- */
25
- export interface HeadlessIo {
21
+ /** Process-facing effects of one run: output streams plus the launcher's bounded exit request. */
22
+ interface HeadlessIo {
26
23
  stdout: {
27
24
  write(chunk: string): unknown;
28
25
  };
@@ -32,16 +29,16 @@ export interface HeadlessIo {
32
29
  /** Request process exit with `code` after the tree disposes. */
33
30
  exit(code: number): void;
34
31
  }
35
- declare module '@deepseek-ai/cordis' {
36
- interface Context {
37
- /** Process-facing effects provided before the headless tree mounts. */
38
- headlessIo?: HeadlessIo;
39
- }
40
- }
32
+ /** The process streams the runner writes to; tests substitute captures. */
33
+ export declare const internals: {
34
+ stdout: HeadlessIo['stdout'];
35
+ stderr: HeadlessIo['stderr'];
36
+ };
41
37
  /**
42
38
  * Mount the one-shot direct driver.
43
- * @param ctx - plugin context carrying core services and the launcher-owned IO seam.
39
+ * @param ctx - plugin context carrying core services and the launcher-provided exit request.
44
40
  * @param config - validated task config.
45
41
  */
46
42
  export declare function apply(ctx: Context, config: Config): void;
43
+ export {};
47
44
  //# sourceMappingURL=index.d.ts.map
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.0.1-rc.1",
4
+ "version": "0.0.1-rc.2",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },
@@ -45,26 +45,26 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "commander": "^15.0.0",
48
- "@deepseek-ai/dsh-cmdline": "^0.0.1-rc.1",
49
- "@deepseek-ai/schemastery": "^3.18.1-rc.1",
50
- "@deepseek-ai/dsh-code-runtime-worker": "^0.0.1-rc.1"
48
+ "@deepseek-ai/dsh-cmdline": "^0.0.1-rc.2",
49
+ "@deepseek-ai/dsh-code-runtime-worker": "^0.0.1-rc.2",
50
+ "@deepseek-ai/schemastery": "^3.18.1-rc.1"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@deepseek-ai/cordis-plugin-loader": "^1.0.1-rc.1",
54
- "@deepseek-ai/dsh-agent": "^0.0.1-rc.1",
55
- "@deepseek-ai/dsh-agent-default-model": "^0.0.1-rc.1",
56
- "@deepseek-ai/dsh-invariants": "^0.0.1-rc.1",
57
- "@deepseek-ai/dsh-llm": "^0.0.1-rc.1",
58
- "@deepseek-ai/dsh-session": "^0.0.1-rc.1",
54
+ "@deepseek-ai/dsh-agent": "^0.0.1-rc.2",
55
+ "@deepseek-ai/dsh-agent-default-model": "^0.0.1-rc.2",
56
+ "@deepseek-ai/dsh-invariants": "^0.0.1-rc.2",
57
+ "@deepseek-ai/dsh-llm": "^0.0.1-rc.2",
58
+ "@deepseek-ai/dsh-session": "^0.0.1-rc.2",
59
59
  "@deepseek-ai/cordis": "^4.0.1-rc.1"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@deepseek-ai/cordis-plugin-loader": "^1.0.1-rc.1",
63
- "@deepseek-ai/dsh-agent-default-model": "^0.0.1-rc.1",
64
- "@deepseek-ai/dsh-invariants": "^0.0.1-rc.1",
65
- "@deepseek-ai/dsh-agent": "^0.0.1-rc.1",
66
- "@deepseek-ai/dsh-llm": "^0.0.1-rc.1",
67
- "@deepseek-ai/dsh-session": "^0.0.1-rc.1",
68
- "@deepseek-ai/cordis": "^4.0.1-rc.1"
63
+ "@deepseek-ai/dsh-agent": "^0.0.1-rc.2",
64
+ "@deepseek-ai/dsh-agent-default-model": "^0.0.1-rc.2",
65
+ "@deepseek-ai/dsh-invariants": "^0.0.1-rc.2",
66
+ "@deepseek-ai/dsh-llm": "^0.0.1-rc.2",
67
+ "@deepseek-ai/cordis": "^4.0.1-rc.1",
68
+ "@deepseek-ai/dsh-session": "^0.0.1-rc.2"
69
69
  }
70
70
  }