@gobing-ai/ts-ai-runner 0.4.62 → 0.4.66

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.md CHANGED
@@ -33,7 +33,7 @@ bun add @gobing-ai/ts-ai-runner
33
33
  | `AGENT_SHIMS` / `TIER1_PRIORITY` / `TIER2_AGENTS` / `DISPLAY_ORDER` | Agent registry constants |
34
34
  | `isAgentName()` | Type guard for supported agent identifiers |
35
35
 
36
- Supported agent identifiers: `claude`, `codex`, `gemini` (deprecated), `pi`, `omp`, `opencode`, `antigravity-cli`, `openclaw`, `hermes`, `grok`. The `antigravity` id is a deprecated alias of `antigravity-cli`. See [Deprecation & Aliases](#deprecation--aliases).
36
+ Supported agent identifiers: `claude`, `codex`, `gemini` (deprecated), `pi`, `omp`, `opencode`, `antigravity-cli`, `openclaw`, `hermes`, `grok`, `deepseek`. The `antigravity` id is a deprecated alias of `antigravity-cli`. See [Deprecation & Aliases](#deprecation--aliases).
37
37
 
38
38
  ## Architecture
39
39
 
@@ -99,9 +99,10 @@ sequenceDiagram
99
99
  end
100
100
  AiRunner->>AgentShim: getPromptCommand(enrichedOptions)
101
101
  AgentShim-->>AiRunner: { command, args }
102
- AiRunner->>EventBus: emit("agent.invoke.start")
103
102
  AiRunner->>Executor: run({ command, args, cwd, timeout })
104
103
  Executor->>Agent: spawn CLI subprocess
104
+ Executor->>AiRunner: onSpawn(pid)
105
+ AiRunner->>EventBus: emit("agent.invoke.start")
105
106
  Agent-->>Executor: stdout / stderr / exit
106
107
  Executor-->>AiRunner: ProcessResult { exitCode, stdout, stderr, durationMs }
107
108
  AiRunner->>EventBus: emit("agent.invoke.exit")
@@ -337,6 +338,7 @@ const { args } = getAgentShim('omp').getPromptCommand({
337
338
  | codex | ✗ | ✗ (ignored) | — | degrade → fresh `exec` | `exec resume --last` |
338
339
  | agy | ✓ | ✗ (ignored) | — | `--conversation <id>` | `--continue` |
339
340
  | grok | ✓ | ✗ (ignored) | — | `--resume <id>` | `-c` |
341
+ | deepseek | ✗ | ✗ (ignored) | — | degrade → fresh headless one-shot | degrade → fresh headless one-shot |
340
342
 
341
343
  **Degrade rule:** when `sessionDir`/`sessionId` is set and the agent lacks resume-by-id or a
342
344
  session-store flag, the shim opens **fresh in isolation** (or plain fresh) — never bare global
@@ -366,7 +368,7 @@ Available events:
366
368
 
367
369
  | Event | When |
368
370
  | ------- | ------ |
369
- | `agent.invoke.start` | Immediately before an agent CLI invocation starts |
371
+ | `agent.invoke.start` | After the process executor confirms spawn; absent on pre-spawn failure |
370
372
  | `agent.invoke.exit` | After an agent CLI invocation exits |
371
373
  | `agent.started` | When a long-running team agent process starts |
372
374
  | `agent.stopped` | When a long-running team agent process stops |
@@ -488,6 +490,7 @@ Agent-specific behavior:
488
490
  | `openclaw` | `openclaw` | 2 | `openclaw health` | `agent --local -m` |
489
491
  | `hermes` | `hermes` | 1 | `hermes doctor` | `chat -q`, `--continue`, `-m` |
490
492
  | `grok` | `grok` | 1 | env/file (`XAI_API_KEY` or `~/.grok/auth.json`) | `-p`, `-c` (resume), `-m`, `--output-format plain\|json` (maps ai-runner `text` → `plain`) |
493
+ | `deepseek` | `dsh` | 1 | env-only / `~/.dsh` (no status verb) | `--profile headless <task>`; session/model options degrade to a fresh one-shot (no flags at 0.1.5-rc.1) |
491
494
 
492
495
  This is the right layer for UI previews, audit logging, and custom launchers.
493
496
 
@@ -515,6 +518,7 @@ resolveAgentName('cursor'); // → undefined
515
518
  | `omp` | canonical | `omp` | First-class; NOT a pi alias. |
516
519
  | `hermes` | canonical | `hermes` | First-class; OpenClaw-compatible but distinct binary. |
517
520
  | `grok` | canonical | `grok` | Grok Build CLI; headless via `-p`; auth is env/file only (no status verb). |
521
+ | `deepseek` | canonical | `deepseek` | DeepSeek `dsh` CLI; headless via `--profile headless`; auth is env/file only (no status verb). |
518
522
 
519
523
  `getAgentShim()` and `isAgentName()` are alias-aware: passing `'antigravity'` resolves to the `antigravity-cli` shim. `DoctorResult` and `DetectedAgent` surface `deprecated` + `replacedBy` when the resolved canonical id is marked deprecated.
520
524
 
@@ -1,5 +1,5 @@
1
1
  /** Identifier for one supported coding agent (canonical id). */
2
- export type AgentName = 'claude' | 'codex' | 'gemini' | 'pi' | 'opencode' | 'antigravity-cli' | 'openclaw' | 'hermes' | 'omp' | 'grok';
2
+ export type AgentName = 'claude' | 'codex' | 'gemini' | 'pi' | 'opencode' | 'antigravity-cli' | 'openclaw' | 'hermes' | 'omp' | 'grok' | 'deepseek';
3
3
  /** Output mode for prompt invocations. */
4
4
  export type OutputMode = 'text' | 'json';
5
5
  /** Concrete executable and argv pair returned by an agent shim. */
@@ -1 +1 @@
1
- {"version":3,"file":"shims.d.ts","sourceRoot":"","sources":["../../src/agents/shims.ts"],"names":[],"mappings":"AAEA,gEAAgE;AAChE,MAAM,MAAM,SAAS,GACf,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,IAAI,GACJ,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,CAAC;AAEb,0CAA0C;AAC1C,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,mEAAmE;AACnE,MAAM,WAAW,WAAW;IACxB,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,4CAA4C;AAC5C,MAAM,WAAW,aAAa;IAC1B,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,8EAA8E;IA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AS,CAMxD"}
@@ -252,6 +252,29 @@ const grokShim = {
252
252
  },
253
253
  getAuthCommand: () => null,
254
254
  };
255
+ /**
256
+ * DeepSeek coding agent (`dsh`, @deepseek-ai/dsh) — tier-1. Boot model is
257
+ * `dsh --profile <name>`; the headless one-shot surface is the `headless`
258
+ * profile: `dsh --profile headless "<task>"` streams reasoning to stderr and
259
+ * prints the final assistant message to stdout. At 0.1.5-rc.1 the headless
260
+ * app accepts only the positional task and `-h` — no resume/model/mode flags.
261
+ * No auth subcommand; credentials resolve via env references / `~/.dsh`.
262
+ */
263
+ const dshShim = {
264
+ name: 'deepseek',
265
+ command: 'dsh',
266
+ tier: 1,
267
+ getHelpCommand: () => ({ command: 'dsh', args: ['--help'] }),
268
+ getVersionCommand: () => ({ command: 'dsh', args: ['--version'] }),
269
+ getPromptCommand: (options) => {
270
+ // Always a fresh one-shot headless dispatch: sessionId/sessionDir/
271
+ // continue/model degrade silently — the HEADLESS app takes only the
272
+ // task + `-h`; no resume/model flags exist at dsh 0.1.5-rc.1.
273
+ // mode/workspace/timeoutMs have no dsh flag — best-effort ignored.
274
+ return { command: 'dsh', args: ['--profile', 'headless', options.input ?? ''] };
275
+ },
276
+ getAuthCommand: () => null,
277
+ };
255
278
  /** All bundled agent shims keyed by canonical agent name. */
256
279
  export const AGENT_SHIMS = {
257
280
  claude: claudeShim,
@@ -264,6 +287,7 @@ export const AGENT_SHIMS = {
264
287
  hermes: hermesShim,
265
288
  omp: ompShim,
266
289
  grok: grokShim,
290
+ deepseek: dshShim,
267
291
  };
268
292
  /**
269
293
  * Session-affinity capability metadata per agent. Callers must consult this
@@ -288,6 +312,8 @@ const AGENT_SESSION_CAPABILITY = {
288
312
  opencode: { supportsResumeById: false, supportsSessionDir: false },
289
313
  openclaw: { supportsResumeById: false, supportsSessionDir: false },
290
314
  hermes: { supportsResumeById: false, supportsSessionDir: false },
315
+ // dsh headless has no resume/session flags — fresh-dispatch degrade.
316
+ deepseek: { supportsResumeById: false, supportsSessionDir: false },
291
317
  };
292
318
  /** Query a bundled agent's session-affinity capability by canonical name. */
293
319
  export function getAgentSessionCapability(agent) {
@@ -303,6 +329,7 @@ export const TIER1_PRIORITY = [
303
329
  'hermes',
304
330
  'opencode',
305
331
  'grok',
332
+ 'deepseek',
306
333
  ];
307
334
  /** Display order for doctor and list commands. */
308
335
  export const DISPLAY_ORDER = [
@@ -316,6 +343,7 @@ export const DISPLAY_ORDER = [
316
343
  'openclaw',
317
344
  'hermes',
318
345
  'grok',
346
+ 'deepseek',
319
347
  ];
320
348
  /** Set of gateway/TUI-constrained agents. */
321
349
  export const TIER2_AGENTS = new Set(['openclaw']);
@@ -1 +1 @@
1
- {"version":3,"file":"ai-runner.d.ts","sourceRoot":"","sources":["../src/ai-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,QAAQ,EAAa,KAAK,MAAM,EAAc,MAAM,qBAAqB,CAAC;AAC5G,OAAO,EAGH,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAgB,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEnE,OAAO,EAGH,KAAK,gBAAgB,EAExB,MAAM,SAAS,CAAC;AAGjB,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC3B,uEAAuE;IACvE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC5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2FAA2F;IAC3F,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2B;IACzD,qIAAqI;IACrI,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;gBAExD,OAAO,GAAE,eAAoB;IAiCzC,iCAAiC;IACjC,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAIxF,oCAAoC;IACpC,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAI3F,mCAAmC;IACnC,gBAAgB,CACZ,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,aAAa,EAC5B,OAAO,GAAE,eAAoB,GAC9B,OAAO,CAAC,cAAc,CAAC;IAI1B,6EAA6E;IAC7E,eAAe,CACX,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,aAAa,EAC5B,OAAO,GAAE,eAAoB,GAC9B,OAAO,CAAC,cAAc,CAAC;IAI1B,0DAA0D;IAC1D,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,GAAE,eAAoB,GAAG,WAAW;IAa9G,4EAA4E;IAC5E,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;YAKjF,MAAM;CAuEvB;AAWD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAC/B,WAAW,CAKb"}
package/dist/ai-runner.js CHANGED
@@ -120,13 +120,6 @@ export class AiRunner {
120
120
  async invoke(agent, operation, command, options, forceBuffered) {
121
121
  const label = `ai-runner.${agent}.${operation}`;
122
122
  this.logger.debug('invoke', { label, command: command.command, args: command.args.join(' ') });
123
- void this.events?.emit('agent.invoke.start', {
124
- agent,
125
- operation,
126
- label,
127
- ...(options.correlation !== undefined ? { correlation: options.correlation } : {}),
128
- severity: 'info',
129
- });
130
123
  const correlationEnv = options.correlation === undefined ? undefined : buildCorrelationEnv(options.correlation);
131
124
  const result = await this.processExecutor.run({
132
125
  command: command.command,
@@ -136,6 +129,17 @@ export class AiRunner {
136
129
  forceBuffered,
137
130
  cwd: options.cwd ?? this.defaultCwd,
138
131
  timeout: options.timeout ?? this.defaultTimeout,
132
+ // A request is accepted only once a process exists; pre-spawn
133
+ // failures must leave claimed inbox messages safe to retry.
134
+ onSpawn: () => {
135
+ void this.events?.emit('agent.invoke.start', {
136
+ agent,
137
+ operation,
138
+ label,
139
+ ...(options.correlation !== undefined ? { correlation: options.correlation } : {}),
140
+ severity: 'info',
141
+ });
142
+ },
139
143
  ...(correlationEnv !== undefined ? { env: correlationEnv } : {}),
140
144
  ...(options.signal !== undefined ? { signal: options.signal } : {}),
141
145
  ...(options.onOutput !== undefined ? { onOutput: options.onOutput } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobing-ai/ts-ai-runner",
3
- "version": "0.4.62",
3
+ "version": "0.4.66",
4
4
  "description": "@gobing-ai/ts-ai-runner — Coding-agent shims, detection, doctor checks, and prompt execution.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -47,12 +47,12 @@
47
47
  "release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-ai-runner-v<version> && git push --tags' && exit 1"
48
48
  },
49
49
  "dependencies": {
50
- "@gobing-ai/ts-infra": "^0.4.62",
51
- "@gobing-ai/ts-runtime": "^0.4.62"
50
+ "@gobing-ai/ts-infra": "^0.4.66",
51
+ "@gobing-ai/ts-runtime": "^0.4.66"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/bun": "1.3.14",
55
- "@gobing-ai/ts-db": "^0.4.62"
55
+ "@gobing-ai/ts-db": "^0.4.66"
56
56
  },
57
57
  "publishConfig": {
58
58
  "access": "public"
@@ -11,7 +11,8 @@ export type AgentName =
11
11
  | 'openclaw'
12
12
  | 'hermes'
13
13
  | 'omp'
14
- | 'grok';
14
+ | 'grok'
15
+ | 'deepseek';
15
16
 
16
17
  /** Output mode for prompt invocations. */
17
18
  export type OutputMode = 'text' | 'json';
@@ -331,6 +332,30 @@ const grokShim: AgentShim = {
331
332
  getAuthCommand: () => null,
332
333
  };
333
334
 
335
+ /**
336
+ * DeepSeek coding agent (`dsh`, @deepseek-ai/dsh) — tier-1. Boot model is
337
+ * `dsh --profile <name>`; the headless one-shot surface is the `headless`
338
+ * profile: `dsh --profile headless "<task>"` streams reasoning to stderr and
339
+ * prints the final assistant message to stdout. At 0.1.5-rc.1 the headless
340
+ * app accepts only the positional task and `-h` — no resume/model/mode flags.
341
+ * No auth subcommand; credentials resolve via env references / `~/.dsh`.
342
+ */
343
+ const dshShim: AgentShim = {
344
+ name: 'deepseek',
345
+ command: 'dsh',
346
+ tier: 1,
347
+ getHelpCommand: () => ({ command: 'dsh', args: ['--help'] }),
348
+ getVersionCommand: () => ({ command: 'dsh', args: ['--version'] }),
349
+ getPromptCommand: (options) => {
350
+ // Always a fresh one-shot headless dispatch: sessionId/sessionDir/
351
+ // continue/model degrade silently — the HEADLESS app takes only the
352
+ // task + `-h`; no resume/model flags exist at dsh 0.1.5-rc.1.
353
+ // mode/workspace/timeoutMs have no dsh flag — best-effort ignored.
354
+ return { command: 'dsh', args: ['--profile', 'headless', options.input ?? ''] };
355
+ },
356
+ getAuthCommand: () => null,
357
+ };
358
+
334
359
  /** All bundled agent shims keyed by canonical agent name. */
335
360
  export const AGENT_SHIMS: Readonly<Record<AgentName, AgentShim>> = {
336
361
  claude: claudeShim,
@@ -343,6 +368,7 @@ export const AGENT_SHIMS: Readonly<Record<AgentName, AgentShim>> = {
343
368
  hermes: hermesShim,
344
369
  omp: ompShim,
345
370
  grok: grokShim,
371
+ deepseek: dshShim,
346
372
  };
347
373
 
348
374
  /** Session-affinity capability for one coding agent (ADR-047). */
@@ -376,6 +402,8 @@ const AGENT_SESSION_CAPABILITY: Readonly<Record<AgentName, AgentSessionCapabilit
376
402
  opencode: { supportsResumeById: false, supportsSessionDir: false },
377
403
  openclaw: { supportsResumeById: false, supportsSessionDir: false },
378
404
  hermes: { supportsResumeById: false, supportsSessionDir: false },
405
+ // dsh headless has no resume/session flags — fresh-dispatch degrade.
406
+ deepseek: { supportsResumeById: false, supportsSessionDir: false },
379
407
  };
380
408
 
381
409
  /** Query a bundled agent's session-affinity capability by canonical name. */
@@ -393,6 +421,7 @@ export const TIER1_PRIORITY: readonly AgentName[] = [
393
421
  'hermes',
394
422
  'opencode',
395
423
  'grok',
424
+ 'deepseek',
396
425
  ];
397
426
 
398
427
  /** Display order for doctor and list commands. */
@@ -407,6 +436,7 @@ export const DISPLAY_ORDER: readonly AgentName[] = [
407
436
  'openclaw',
408
437
  'hermes',
409
438
  'grok',
439
+ 'deepseek',
410
440
  ];
411
441
 
412
442
  /** Set of gateway/TUI-constrained agents. */
package/src/ai-runner.ts CHANGED
@@ -229,13 +229,6 @@ export class AiRunner {
229
229
  ): Promise<AgentRunResult> {
230
230
  const label = `ai-runner.${agent}.${operation}`;
231
231
  this.logger.debug('invoke', { label, command: command.command, args: command.args.join(' ') });
232
- void this.events?.emit('agent.invoke.start', {
233
- agent,
234
- operation,
235
- label,
236
- ...(options.correlation !== undefined ? { correlation: options.correlation } : {}),
237
- severity: 'info',
238
- });
239
232
  const correlationEnv = options.correlation === undefined ? undefined : buildCorrelationEnv(options.correlation);
240
233
  const result: ProcessResult = await this.processExecutor.run({
241
234
  command: command.command,
@@ -245,6 +238,17 @@ export class AiRunner {
245
238
  forceBuffered,
246
239
  cwd: options.cwd ?? this.defaultCwd,
247
240
  timeout: options.timeout ?? this.defaultTimeout,
241
+ // A request is accepted only once a process exists; pre-spawn
242
+ // failures must leave claimed inbox messages safe to retry.
243
+ onSpawn: () => {
244
+ void this.events?.emit('agent.invoke.start', {
245
+ agent,
246
+ operation,
247
+ label,
248
+ ...(options.correlation !== undefined ? { correlation: options.correlation } : {}),
249
+ severity: 'info',
250
+ });
251
+ },
248
252
  ...(correlationEnv !== undefined ? { env: correlationEnv } : {}),
249
253
  ...(options.signal !== undefined ? { signal: options.signal } : {}),
250
254
  ...(options.onOutput !== undefined ? { onOutput: options.onOutput } : {}),