@artenx/dshb 0.1.7 → 0.1.9

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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/lib/auth/index.js +2 -1
  3. package/lib/auth/index.js.map +1 -1
  4. package/lib/client.js +1 -1
  5. package/lib/client.js.map +1 -1
  6. package/lib/core/index.js +1 -1
  7. package/lib/core/workspace-instruction-context.d.ts +281 -122
  8. package/lib/core/workspace-instruction-context.js +1 -1
  9. package/lib/exec-docker/docker-backend.d.ts +1 -1
  10. package/lib/exec-docker/docker-client.d.ts +1 -1
  11. package/lib/exec-docker/docker-client.js +4 -1
  12. package/lib/exec-docker/docker-client.js.map +1 -1
  13. package/lib/exec-docker/process-provider.d.ts +3 -1
  14. package/lib/exec-docker/process-provider.js +68 -5
  15. package/lib/exec-docker/process-provider.js.map +1 -1
  16. package/lib/exec-docker/remote-docker-cli.d.ts +1 -1
  17. package/lib/exec-docker/remote-docker-cli.js +1 -1
  18. package/lib/exec-docker/remote-docker-cli.js.map +1 -1
  19. package/lib/exec-docker/world.d.ts +1 -1
  20. package/lib/exec-ssh/executor.d.ts +1 -2
  21. package/lib/exec-ssh/executor.js +7 -5
  22. package/lib/exec-ssh/executor.js.map +1 -1
  23. package/lib/exec-ssh/process-provider.d.ts +3 -1
  24. package/lib/exec-ssh/process-provider.js +65 -5
  25. package/lib/exec-ssh/process-provider.js.map +1 -1
  26. package/lib/exec-ssh/world.d.ts +1 -1
  27. package/lib/router/decorate-shell.d.ts +11 -2
  28. package/lib/router/decorate-shell.js +80 -18
  29. package/lib/router/decorate-shell.js.map +1 -1
  30. package/lib/router/index.d.ts +1 -1
  31. package/lib/router/index.js +20 -0
  32. package/lib/router/index.js.map +1 -1
  33. package/lib/router/resolve.d.ts +1 -1
  34. package/lib/router/router-shell.d.ts +2 -3
  35. package/lib/router/router-shell.js +4 -13
  36. package/lib/router/router-shell.js.map +1 -1
  37. package/lib/router/types.d.ts +1 -1
  38. package/lib/{types-C0TtEO7z.d.ts → types-ekJQQ4x6.d.ts} +4 -2
  39. package/lib/{workspace-instruction-context-CxUldQkP.js → workspace-instruction-context-DzHFTN87.js} +156 -76
  40. package/lib/workspace-instruction-context-DzHFTN87.js.map +1 -0
  41. package/package.json +34 -33
  42. package/lib/workspace-instruction-context-CxUldQkP.js.map +0 -1
@@ -1,35 +1,97 @@
1
1
  import { sharedWorldResolver } from "./resolve.js";
2
2
  //#region src/router/decorate-shell.ts
3
+ function outputReader(pick, current) {
4
+ return { readFrom: (fromByte) => {
5
+ const result = current();
6
+ if (!result) return {
7
+ text: "",
8
+ nextOffset: fromByte,
9
+ lossy: false
10
+ };
11
+ const output = pick(result);
12
+ const bytes = Buffer.from(output.text, "utf8");
13
+ const start = Math.max(0, Math.min(fromByte, bytes.length));
14
+ return {
15
+ text: bytes.subarray(start).toString("utf8"),
16
+ nextOffset: bytes.length,
17
+ lossy: output.truncated && start === 0,
18
+ ...output.spillPath ? { spillPath: output.spillPath } : {}
19
+ };
20
+ } };
21
+ }
22
+ /**
23
+ * DSH 0.1.6+ collapses the shell seam into `resolve`/`execute`, and the
24
+ * `ShellExecution` handle replaces the old `run`/`start` pair. Remote worlds
25
+ * still expose a foreground `run`, so this adapts one remote run into a live
26
+ * execution handle: the foreground projection is the run's result, and the
27
+ * handle's status, exit classification, and collectors settle from it.
28
+ */
29
+ function executionFromRemoteRun(shell, spec) {
30
+ const resultPromise = shell.run(spec);
31
+ let status = "running";
32
+ let exitCode = null;
33
+ let signal = null;
34
+ let collected;
35
+ let consumed = false;
36
+ const execution = {
37
+ get status() {
38
+ return status;
39
+ },
40
+ get exitCode() {
41
+ return exitCode;
42
+ },
43
+ get signal() {
44
+ return signal;
45
+ },
46
+ done: resultPromise.then((result) => {
47
+ collected = result;
48
+ status = "completed";
49
+ exitCode = result.exitCode;
50
+ signal = result.signal;
51
+ }, () => {
52
+ status = "killed";
53
+ }),
54
+ readOutput: () => {
55
+ if (!collected || consumed) return {
56
+ delta: "",
57
+ lossy: false
58
+ };
59
+ consumed = true;
60
+ const result = collected;
61
+ return {
62
+ delta: result.stdout.text + result.stderr.text,
63
+ lossy: result.stdout.truncated || result.stderr.truncated,
64
+ ...result.stdout.spillPath ? { stdoutSpillPath: result.stdout.spillPath } : {},
65
+ ...result.stderr.spillPath ? { stderrSpillPath: result.stderr.spillPath } : {}
66
+ };
67
+ },
68
+ observed: {
69
+ stdout: outputReader((result) => result.stdout, () => collected),
70
+ stderr: outputReader((result) => result.stderr, () => collected)
71
+ },
72
+ kill: () => false,
73
+ result: () => resultPromise
74
+ };
75
+ return Promise.resolve(execution);
76
+ }
3
77
  function decorateShell(shell) {
4
78
  const resolver = sharedWorldResolver();
5
- const origRun = shell.run.bind(shell);
6
- const origStart = shell.start.bind(shell);
7
- shell.run = async (spec) => {
79
+ const origExecute = shell.execute.bind(shell);
80
+ shell.execute = async (spec) => {
8
81
  const ref = resolver.resolve(spec.workdir ?? "");
9
- if (ref.kind === "local") return origRun(spec);
82
+ if (ref.kind === "local") return origExecute(spec);
10
83
  if (ref.kind === "unrouted") throw new Error(`node ${ref.nodeId} world not available`);
11
84
  await ref.provider.ensureDir(ref.remotePath).catch(() => {});
12
- return ref.provider.shell.run({
13
- ...spec,
14
- workdir: ref.remotePath
15
- });
16
- };
17
- shell.start = (spec) => {
18
- const ref = resolver.resolve(spec.workdir ?? "");
19
- if (ref.kind === "local") return origStart(spec);
20
- if (ref.kind === "unrouted") throw new Error(`node ${ref.nodeId} world not available`);
21
- ref.provider.ensureDir(ref.remotePath).catch(() => {});
22
- return ref.provider.shell.start({
85
+ return executionFromRemoteRun(ref.provider.shell, {
23
86
  ...spec,
24
87
  workdir: ref.remotePath
25
88
  });
26
89
  };
27
90
  return () => {
28
- shell.run = origRun;
29
- shell.start = origStart;
91
+ shell.execute = origExecute;
30
92
  };
31
93
  }
32
94
  //#endregion
33
- export { decorateShell };
95
+ export { decorateShell, executionFromRemoteRun };
34
96
 
35
97
  //# sourceMappingURL=decorate-shell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorate-shell.js","names":[],"sources":["../../src/router/decorate-shell.ts"],"sourcesContent":["import type { ShellExecutor } from '@deepseek-ai/dsh-shell'\nimport type { ShellExecRequest, ShellExecSpec, ShellProcess, ShellRunResult } from '@deepseek-ai/dsh-shell'\nimport { sharedWorldResolver } from './resolve.js'\n\nexport function decorateShell(shell: ShellExecutor): () => void {\n const resolver = sharedWorldResolver()\n\n const origRun = shell.run.bind(shell)\n const origStart = shell.start.bind(shell)\n\n shell.run = async (spec: ShellExecSpec): Promise<ShellRunResult> => {\n const ref = resolver.resolve(spec.workdir ?? '')\n if (ref.kind === 'local') return origRun(spec)\n if (ref.kind === 'unrouted') throw new Error(`node ${ref.nodeId} world not available`)\n await ref.provider.ensureDir(ref.remotePath).catch(() => {})\n return ref.provider.shell.run({ ...spec, workdir: ref.remotePath })\n }\n\n shell.start = (spec: ShellExecSpec): ShellProcess => {\n const ref = resolver.resolve(spec.workdir ?? '')\n if (ref.kind === 'local') return origStart(spec)\n if (ref.kind === 'unrouted') throw new Error(`node ${ref.nodeId} world not available`)\n void ref.provider.ensureDir(ref.remotePath).catch(() => {})\n return ref.provider.shell.start({ ...spec, workdir: ref.remotePath })\n }\n\n return () => {\n shell.run = origRun\n shell.start = origStart\n }\n}\n"],"mappings":";;AAIA,SAAgB,cAAc,OAAkC;CAC9D,MAAM,WAAW,oBAAoB;CAErC,MAAM,UAAU,MAAM,IAAI,KAAK,KAAK;CACpC,MAAM,YAAY,MAAM,MAAM,KAAK,KAAK;CAExC,MAAM,MAAM,OAAO,SAAiD;EAClE,MAAM,MAAM,SAAS,QAAQ,KAAK,WAAW,EAAE;EAC/C,IAAI,IAAI,SAAS,SAAS,OAAO,QAAQ,IAAI;EAC7C,IAAI,IAAI,SAAS,YAAY,MAAM,IAAI,MAAM,QAAQ,IAAI,OAAO,qBAAqB;EACrF,MAAM,IAAI,SAAS,UAAU,IAAI,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;EAC3D,OAAO,IAAI,SAAS,MAAM,IAAI;GAAE,GAAG;GAAM,SAAS,IAAI;EAAW,CAAC;CACpE;CAEA,MAAM,SAAS,SAAsC;EACnD,MAAM,MAAM,SAAS,QAAQ,KAAK,WAAW,EAAE;EAC/C,IAAI,IAAI,SAAS,SAAS,OAAO,UAAU,IAAI;EAC/C,IAAI,IAAI,SAAS,YAAY,MAAM,IAAI,MAAM,QAAQ,IAAI,OAAO,qBAAqB;EACrF,IAAS,SAAS,UAAU,IAAI,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;EAC1D,OAAO,IAAI,SAAS,MAAM,MAAM;GAAE,GAAG;GAAM,SAAS,IAAI;EAAW,CAAC;CACtE;CAEA,aAAa;EACX,MAAM,MAAM;EACZ,MAAM,QAAQ;CAChB;AACF"}
1
+ {"version":3,"file":"decorate-shell.js","names":[],"sources":["../../src/router/decorate-shell.ts"],"sourcesContent":["import type { ShellExecutor, ShellExecSpec, ShellExecution, ShellProcessRead, ShellProcessStatus, ShellRunResult } from '@deepseek-ai/dsh-shell'\nimport type { CollectedOutput, SubprocessOutputReader } from '@deepseek-ai/dsh-subprocess'\nimport { sharedWorldResolver } from './resolve.js'\nimport type { ShellDelegate } from './types.js'\n\nfunction outputReader(pick: (result: ShellRunResult) => CollectedOutput, current: () => ShellRunResult | undefined): SubprocessOutputReader {\n return {\n readFrom: (fromByte: number) => {\n const result = current()\n if (!result) return { text: '', nextOffset: fromByte, lossy: false }\n const output = pick(result)\n const bytes = Buffer.from(output.text, 'utf8')\n const start = Math.max(0, Math.min(fromByte, bytes.length))\n const text = bytes.subarray(start).toString('utf8')\n return {\n text,\n nextOffset: bytes.length,\n lossy: output.truncated && start === 0,\n ...(output.spillPath ? { spillPath: output.spillPath } : {}),\n }\n },\n }\n}\n\n/**\n * DSH 0.1.6+ collapses the shell seam into `resolve`/`execute`, and the\n * `ShellExecution` handle replaces the old `run`/`start` pair. Remote worlds\n * still expose a foreground `run`, so this adapts one remote run into a live\n * execution handle: the foreground projection is the run's result, and the\n * handle's status, exit classification, and collectors settle from it.\n */\nexport function executionFromRemoteRun(shell: ShellDelegate, spec: ShellExecSpec): Promise<ShellExecution> {\n const resultPromise = shell.run(spec)\n let status: ShellProcessStatus = 'running'\n let exitCode: number | null = null\n let signal: NodeJS.Signals | null = null\n let collected: ShellRunResult | undefined\n let consumed = false\n\n const done = resultPromise.then(\n (result) => {\n collected = result\n status = 'completed'\n exitCode = result.exitCode\n signal = result.signal\n },\n () => {\n status = 'killed'\n },\n )\n\n const execution = {\n get status() {\n return status\n },\n get exitCode() {\n return exitCode\n },\n get signal() {\n return signal\n },\n done,\n readOutput: (): ShellProcessRead => {\n if (!collected || consumed) return { delta: '', lossy: false }\n consumed = true\n const result = collected\n return {\n delta: result.stdout.text + result.stderr.text,\n lossy: result.stdout.truncated || result.stderr.truncated,\n ...(result.stdout.spillPath ? { stdoutSpillPath: result.stdout.spillPath } : {}),\n ...(result.stderr.spillPath ? { stderrSpillPath: result.stderr.spillPath } : {}),\n }\n },\n observed: {\n stdout: outputReader((result) => result.stdout, () => collected),\n stderr: outputReader((result) => result.stderr, () => collected),\n },\n kill: () => false,\n result: () => resultPromise,\n }\n\n return Promise.resolve(execution as unknown as ShellExecution)\n}\n\nexport function decorateShell(shell: ShellExecutor): () => void {\n const resolver = sharedWorldResolver()\n\n const origExecute = shell.execute.bind(shell)\n\n shell.execute = async (spec: ShellExecSpec): Promise<ShellExecution> => {\n const ref = resolver.resolve(spec.workdir ?? '')\n if (ref.kind === 'local') return origExecute(spec)\n if (ref.kind === 'unrouted') throw new Error(`node ${ref.nodeId} world not available`)\n await ref.provider.ensureDir(ref.remotePath).catch(() => {})\n return executionFromRemoteRun(ref.provider.shell, { ...spec, workdir: ref.remotePath })\n }\n\n return () => {\n shell.execute = origExecute\n }\n}\n"],"mappings":";;AAKA,SAAS,aAAa,MAAmD,SAAmE;CAC1I,OAAO,EACL,WAAW,aAAqB;EAC9B,MAAM,SAAS,QAAQ;EACvB,IAAI,CAAC,QAAQ,OAAO;GAAE,MAAM;GAAI,YAAY;GAAU,OAAO;EAAM;EACnE,MAAM,SAAS,KAAK,MAAM;EAC1B,MAAM,QAAQ,OAAO,KAAK,OAAO,MAAM,MAAM;EAC7C,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,UAAU,MAAM,MAAM,CAAC;EAE1D,OAAO;GACL,MAFW,MAAM,SAAS,KAAK,CAAC,CAAC,SAAS,MAEvC;GACH,YAAY,MAAM;GAClB,OAAO,OAAO,aAAa,UAAU;GACrC,GAAI,OAAO,YAAY,EAAE,WAAW,OAAO,UAAU,IAAI,CAAC;EAC5D;CACF,EACF;AACF;;;;;;;;AASA,SAAgB,uBAAuB,OAAsB,MAA8C;CACzG,MAAM,gBAAgB,MAAM,IAAI,IAAI;CACpC,IAAI,SAA6B;CACjC,IAAI,WAA0B;CAC9B,IAAI,SAAgC;CACpC,IAAI;CACJ,IAAI,WAAW;CAcf,MAAM,YAAY;EAChB,IAAI,SAAS;GACX,OAAO;EACT;EACA,IAAI,WAAW;GACb,OAAO;EACT;EACA,IAAI,SAAS;GACX,OAAO;EACT;EACA,MAtBW,cAAc,MACxB,WAAW;GACV,YAAY;GACZ,SAAS;GACT,WAAW,OAAO;GAClB,SAAS,OAAO;EAClB,SACM;GACJ,SAAS;EACX,CAaG;EACH,kBAAoC;GAClC,IAAI,CAAC,aAAa,UAAU,OAAO;IAAE,OAAO;IAAI,OAAO;GAAM;GAC7D,WAAW;GACX,MAAM,SAAS;GACf,OAAO;IACL,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO;IAC1C,OAAO,OAAO,OAAO,aAAa,OAAO,OAAO;IAChD,GAAI,OAAO,OAAO,YAAY,EAAE,iBAAiB,OAAO,OAAO,UAAU,IAAI,CAAC;IAC9E,GAAI,OAAO,OAAO,YAAY,EAAE,iBAAiB,OAAO,OAAO,UAAU,IAAI,CAAC;GAChF;EACF;EACA,UAAU;GACR,QAAQ,cAAc,WAAW,OAAO,cAAc,SAAS;GAC/D,QAAQ,cAAc,WAAW,OAAO,cAAc,SAAS;EACjE;EACA,YAAY;EACZ,cAAc;CAChB;CAEA,OAAO,QAAQ,QAAQ,SAAsC;AAC/D;AAEA,SAAgB,cAAc,OAAkC;CAC9D,MAAM,WAAW,oBAAoB;CAErC,MAAM,cAAc,MAAM,QAAQ,KAAK,KAAK;CAE5C,MAAM,UAAU,OAAO,SAAiD;EACtE,MAAM,MAAM,SAAS,QAAQ,KAAK,WAAW,EAAE;EAC/C,IAAI,IAAI,SAAS,SAAS,OAAO,YAAY,IAAI;EACjD,IAAI,IAAI,SAAS,YAAY,MAAM,IAAI,MAAM,QAAQ,IAAI,OAAO,qBAAqB;EACrF,MAAM,IAAI,SAAS,UAAU,IAAI,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;EAC3D,OAAO,uBAAuB,IAAI,SAAS,OAAO;GAAE,GAAG;GAAM,SAAS,IAAI;EAAW,CAAC;CACxF;CAEA,aAAa;EACX,MAAM,UAAU;CAClB;AACF"}
@@ -1,4 +1,4 @@
1
- import { _ as WorkspaceBindings, a as NodeTestReport, t as ExecutionWorldProvider, v as WorldRef, y as WorldRegistry } from "../types-C0TtEO7z.js";
1
+ import { _ as WorkspaceBindings, a as NodeTestReport, t as ExecutionWorldProvider, v as WorldRef, y as WorldRegistry } from "../types-ekJQQ4x6.js";
2
2
  import { sharedWorldResolver } from "./resolve.js";
3
3
  import { Context } from "@deepseek-ai/cordis";
4
4
  //#region src/router/index.d.ts
@@ -14,6 +14,26 @@ function apply(ctx) {
14
14
  decorateFileSystem(ctx.fs);
15
15
  decorateSubprocess(ctx.subprocess);
16
16
  decorateShell(ctx.shell);
17
+ decorateTerminalController(ctx);
18
+ }
19
+ function decorateTerminalController(ctx) {
20
+ ctx.inject(["terminalController"], (terminalCtx) => {
21
+ const controller = terminalCtx.terminalController;
22
+ const originalExecution = controller.execution.bind(controller);
23
+ controller.execution = (agent) => {
24
+ const execution = originalExecution(agent);
25
+ const ref = sharedWorldResolver().resolve(agent.session.header.cwd);
26
+ if (ref.kind === "local") return execution;
27
+ if (ref.kind === "unrouted") throw new Error(`node ${ref.nodeId} world not available`);
28
+ const subprocess = Object.create(execution.subprocess);
29
+ subprocess.terminalEnvironment = ref.provider.subprocess.terminalEnvironment.bind(ref.provider.subprocess);
30
+ subprocess.resolveExecutable = ref.provider.subprocess.resolveExecutable.bind(ref.provider.subprocess);
31
+ return {
32
+ ...execution,
33
+ subprocess
34
+ };
35
+ };
36
+ });
17
37
  }
18
38
  //#endregion
19
39
  export { apply, inject, name, sharedWorldResolver };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/router/index.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis'\nimport { decorateFileSystem } from './decorate-fs.js'\nimport { decorateSubprocess } from './decorate-subprocess.js'\nimport { decorateShell } from './decorate-shell.js'\nimport { sharedWorldResolver } from './resolve.js'\n\nexport const name = 'dshb-router'\n\nexport const inject = ['fs', 'subprocess', 'shell']\n\nexport function apply(ctx: Context): void {\n ctx.provide('dshbRouter', sharedWorldResolver())\n decorateFileSystem(ctx.fs)\n decorateSubprocess(ctx.subprocess)\n decorateShell(ctx.shell)\n}\n\nexport { sharedWorldResolver } from './resolve.js'\nexport type { ExecutionWorldProvider, WorkspaceBindings, WorldRegistry, WorldRef, NodeTestReport } from './types.js'\n"],"mappings":";;;;;AAMA,MAAa,OAAO;AAEpB,MAAa,SAAS;CAAC;CAAM;CAAc;AAAO;AAElD,SAAgB,MAAM,KAAoB;CACxC,IAAI,QAAQ,cAAc,oBAAoB,CAAC;CAC/C,mBAAmB,IAAI,EAAE;CACzB,mBAAmB,IAAI,UAAU;CACjC,cAAc,IAAI,KAAK;AACzB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/router/index.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis'\nimport type { SubprocessRuntime } from '@deepseek-ai/dsh-subprocess'\nimport { decorateFileSystem } from './decorate-fs.js'\nimport { decorateSubprocess } from './decorate-subprocess.js'\nimport { decorateShell } from './decorate-shell.js'\nimport { sharedWorldResolver } from './resolve.js'\n\nexport const name = 'dshb-router'\n\nexport const inject = ['fs', 'subprocess', 'shell']\n\nexport function apply(ctx: Context): void {\n ctx.provide('dshbRouter', sharedWorldResolver())\n decorateFileSystem(ctx.fs)\n decorateSubprocess(ctx.subprocess)\n decorateShell(ctx.shell)\n decorateTerminalController(ctx)\n}\n\ninterface TerminalAgentLike {\n session: { header: { cwd: string } }\n}\n\ninterface TerminalControllerLike {\n execution(agent: TerminalAgentLike): { subprocess: SubprocessRuntime; sandboxPolicy: unknown }\n}\n\nfunction decorateTerminalController(ctx: Context): void {\n ctx.inject(['terminalController'], (terminalCtx: Context) => {\n const controller = (terminalCtx as unknown as { terminalController: TerminalControllerLike }).terminalController\n const originalExecution = controller.execution.bind(controller)\n\n controller.execution = (agent) => {\n const execution = originalExecution(agent)\n const ref = sharedWorldResolver().resolve(agent.session.header.cwd)\n if (ref.kind === 'local') return execution\n if (ref.kind === 'unrouted') throw new Error(`node ${ref.nodeId} world not available`)\n\n const subprocess = Object.create(execution.subprocess) as SubprocessRuntime\n subprocess.terminalEnvironment = ref.provider.subprocess.terminalEnvironment.bind(ref.provider.subprocess)\n subprocess.resolveExecutable = ref.provider.subprocess.resolveExecutable.bind(ref.provider.subprocess)\n return { ...execution, subprocess }\n }\n })\n}\n\nexport { sharedWorldResolver } from './resolve.js'\nexport type { ExecutionWorldProvider, WorkspaceBindings, WorldRegistry, WorldRef, NodeTestReport } from './types.js'\n"],"mappings":";;;;;AAOA,MAAa,OAAO;AAEpB,MAAa,SAAS;CAAC;CAAM;CAAc;AAAO;AAElD,SAAgB,MAAM,KAAoB;CACxC,IAAI,QAAQ,cAAc,oBAAoB,CAAC;CAC/C,mBAAmB,IAAI,EAAE;CACzB,mBAAmB,IAAI,UAAU;CACjC,cAAc,IAAI,KAAK;CACvB,2BAA2B,GAAG;AAChC;AAUA,SAAS,2BAA2B,KAAoB;CACtD,IAAI,OAAO,CAAC,oBAAoB,IAAI,gBAAyB;EAC3D,MAAM,aAAc,YAA0E;EAC9F,MAAM,oBAAoB,WAAW,UAAU,KAAK,UAAU;EAE9D,WAAW,aAAa,UAAU;GAChC,MAAM,YAAY,kBAAkB,KAAK;GACzC,MAAM,MAAM,oBAAoB,CAAC,CAAC,QAAQ,MAAM,QAAQ,OAAO,GAAG;GAClE,IAAI,IAAI,SAAS,SAAS,OAAO;GACjC,IAAI,IAAI,SAAS,YAAY,MAAM,IAAI,MAAM,QAAQ,IAAI,OAAO,qBAAqB;GAErF,MAAM,aAAa,OAAO,OAAO,UAAU,UAAU;GACrD,WAAW,sBAAsB,IAAI,SAAS,WAAW,oBAAoB,KAAK,IAAI,SAAS,UAAU;GACzG,WAAW,oBAAoB,IAAI,SAAS,WAAW,kBAAkB,KAAK,IAAI,SAAS,UAAU;GACrG,OAAO;IAAE,GAAG;IAAW;GAAW;EACpC;CACF,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
- import { _ as WorkspaceBindings, v as WorldRef, y as WorldRegistry } from "../types-C0TtEO7z.js";
1
+ import { _ as WorkspaceBindings, v as WorldRef, y as WorldRegistry } from "../types-ekJQQ4x6.js";
2
2
  //#region src/router/resolve.d.ts
3
3
  interface BindingHit {
4
4
  nodeId: string;
@@ -1,13 +1,12 @@
1
1
  import { Context } from "@deepseek-ai/cordis";
2
2
  import SandboxBashExecutor from "@deepseek-ai/dsh-bash-sandbox";
3
- import { ShellExecRequest, ShellExecSpec, ShellProcess, ShellRunResult } from "@deepseek-ai/dsh-shell";
3
+ import { ShellExecRequest, ShellExecSpec, ShellExecution } from "@deepseek-ai/dsh-shell";
4
4
  //#region src/router/router-shell.d.ts
5
5
  declare class RouterShell extends SandboxBashExecutor {
6
6
  private readonly resolver;
7
7
  constructor(ctx: Context, config: unknown);
8
8
  resolve(request: ShellExecRequest): ShellExecSpec;
9
- run(spec: ShellExecSpec): Promise<ShellRunResult>;
10
- start(spec: ShellExecSpec): ShellProcess;
9
+ execute(spec: ShellExecSpec): Promise<ShellExecution>;
11
10
  }
12
11
  //#endregion
13
12
  export { RouterShell as default };
@@ -1,4 +1,5 @@
1
1
  import { sharedWorldResolver } from "./resolve.js";
2
+ import { executionFromRemoteRun } from "./decorate-shell.js";
2
3
  import SandboxBashExecutor from "@deepseek-ai/dsh-bash-sandbox";
3
4
  //#region src/router/router-shell.ts
4
5
  var RouterShell = class extends SandboxBashExecutor {
@@ -9,22 +10,12 @@ var RouterShell = class extends SandboxBashExecutor {
9
10
  resolve(request) {
10
11
  return super.resolve(request);
11
12
  }
12
- async run(spec) {
13
+ async execute(spec) {
13
14
  const ref = this.resolver.resolve(spec.workdir ?? "");
14
- if (ref.kind === "local") return super.run(spec);
15
+ if (ref.kind === "local") return super.execute(spec);
15
16
  if (ref.kind === "unrouted") throw new Error(`node ${ref.nodeId} world not available`);
16
17
  await ref.provider.ensureDir(ref.remotePath).catch(() => {});
17
- return ref.provider.shell.run({
18
- ...spec,
19
- workdir: ref.remotePath
20
- });
21
- }
22
- start(spec) {
23
- const ref = this.resolver.resolve(spec.workdir ?? "");
24
- if (ref.kind === "local") return super.start(spec);
25
- if (ref.kind === "unrouted") throw new Error(`node ${ref.nodeId} world not available`);
26
- ref.provider.ensureDir(ref.remotePath).catch(() => {});
27
- return ref.provider.shell.start({
18
+ return executionFromRemoteRun(ref.provider.shell, {
28
19
  ...spec,
29
20
  workdir: ref.remotePath
30
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"router-shell.js","names":[],"sources":["../../src/router/router-shell.ts"],"sourcesContent":["import SandboxBashExecutor from '@deepseek-ai/dsh-bash-sandbox'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { ShellExecRequest, ShellExecSpec, ShellProcess, ShellRunResult } from '@deepseek-ai/dsh-shell'\nimport { sharedWorldResolver } from './resolve.js'\n\nexport default class RouterShell extends SandboxBashExecutor {\n private readonly resolver = sharedWorldResolver()\n\n constructor(ctx: Context, config: unknown) {\n super(ctx, config as never)\n }\n\n override resolve(request: ShellExecRequest): ShellExecSpec {\n return super.resolve(request)\n }\n\n override async run(spec: ShellExecSpec): Promise<ShellRunResult> {\n const ref = this.resolver.resolve(spec.workdir ?? '')\n if (ref.kind === 'local') return super.run(spec)\n if (ref.kind === 'unrouted') throw new Error(`node ${ref.nodeId} world not available`)\n await ref.provider.ensureDir(ref.remotePath).catch(() => {})\n return ref.provider.shell.run({ ...spec, workdir: ref.remotePath })\n }\n\n override start(spec: ShellExecSpec): ShellProcess {\n const ref = this.resolver.resolve(spec.workdir ?? '')\n if (ref.kind === 'local') return super.start(spec)\n if (ref.kind === 'unrouted') throw new Error(`node ${ref.nodeId} world not available`)\n void ref.provider.ensureDir(ref.remotePath).catch(() => {})\n return ref.provider.shell.start({ ...spec, workdir: ref.remotePath })\n }\n}\n"],"mappings":";;;AAKA,IAAqB,cAArB,cAAyC,oBAAoB;CAC3D,WAA4B,oBAAoB;CAEhD,YAAY,KAAc,QAAiB;EACzC,MAAM,KAAK,MAAe;CAC5B;CAEA,QAAiB,SAA0C;EACzD,OAAO,MAAM,QAAQ,OAAO;CAC9B;CAEA,MAAe,IAAI,MAA8C;EAC/D,MAAM,MAAM,KAAK,SAAS,QAAQ,KAAK,WAAW,EAAE;EACpD,IAAI,IAAI,SAAS,SAAS,OAAO,MAAM,IAAI,IAAI;EAC/C,IAAI,IAAI,SAAS,YAAY,MAAM,IAAI,MAAM,QAAQ,IAAI,OAAO,qBAAqB;EACrF,MAAM,IAAI,SAAS,UAAU,IAAI,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;EAC3D,OAAO,IAAI,SAAS,MAAM,IAAI;GAAE,GAAG;GAAM,SAAS,IAAI;EAAW,CAAC;CACpE;CAEA,MAAe,MAAmC;EAChD,MAAM,MAAM,KAAK,SAAS,QAAQ,KAAK,WAAW,EAAE;EACpD,IAAI,IAAI,SAAS,SAAS,OAAO,MAAM,MAAM,IAAI;EACjD,IAAI,IAAI,SAAS,YAAY,MAAM,IAAI,MAAM,QAAQ,IAAI,OAAO,qBAAqB;EACrF,IAAS,SAAS,UAAU,IAAI,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;EAC1D,OAAO,IAAI,SAAS,MAAM,MAAM;GAAE,GAAG;GAAM,SAAS,IAAI;EAAW,CAAC;CACtE;AACF"}
1
+ {"version":3,"file":"router-shell.js","names":[],"sources":["../../src/router/router-shell.ts"],"sourcesContent":["import SandboxBashExecutor from '@deepseek-ai/dsh-bash-sandbox'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { ShellExecRequest, ShellExecSpec, ShellExecution } from '@deepseek-ai/dsh-shell'\nimport { sharedWorldResolver } from './resolve.js'\nimport { executionFromRemoteRun } from './decorate-shell.js'\n\nexport default class RouterShell extends SandboxBashExecutor {\n private readonly resolver = sharedWorldResolver()\n\n constructor(ctx: Context, config: unknown) {\n super(ctx, config as never)\n }\n\n override resolve(request: ShellExecRequest): ShellExecSpec {\n return super.resolve(request)\n }\n\n override async execute(spec: ShellExecSpec): Promise<ShellExecution> {\n const ref = this.resolver.resolve(spec.workdir ?? '')\n if (ref.kind === 'local') return super.execute(spec)\n if (ref.kind === 'unrouted') throw new Error(`node ${ref.nodeId} world not available`)\n await ref.provider.ensureDir(ref.remotePath).catch(() => {})\n return executionFromRemoteRun(ref.provider.shell, { ...spec, workdir: ref.remotePath })\n }\n}\n"],"mappings":";;;;AAMA,IAAqB,cAArB,cAAyC,oBAAoB;CAC3D,WAA4B,oBAAoB;CAEhD,YAAY,KAAc,QAAiB;EACzC,MAAM,KAAK,MAAe;CAC5B;CAEA,QAAiB,SAA0C;EACzD,OAAO,MAAM,QAAQ,OAAO;CAC9B;CAEA,MAAe,QAAQ,MAA8C;EACnE,MAAM,MAAM,KAAK,SAAS,QAAQ,KAAK,WAAW,EAAE;EACpD,IAAI,IAAI,SAAS,SAAS,OAAO,MAAM,QAAQ,IAAI;EACnD,IAAI,IAAI,SAAS,YAAY,MAAM,IAAI,MAAM,QAAQ,IAAI,OAAO,qBAAqB;EACrF,MAAM,IAAI,SAAS,UAAU,IAAI,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;EAC3D,OAAO,uBAAuB,IAAI,SAAS,OAAO;GAAE,GAAG;GAAM,SAAS,IAAI;EAAW,CAAC;CACxF;AACF"}
@@ -1,2 +1,2 @@
1
- import { _ as WorkspaceBindings, a as NodeTestReport, c as ShellExecSpec, d as SubprocessDelegate, f as SubprocessHandle, g as SubprocessTerminalSpawnSpec, h as SubprocessTerminalHandle, i as FsTargetLike, l as ShellProcess, m as SubprocessSpawnSpec, n as FileSystem, o as ShellDelegate, p as SubprocessRuntime, r as FsDelegate, s as ShellExecRequest, t as ExecutionWorldProvider, u as ShellRunResult, v as WorldRef, y as WorldRegistry } from "../types-C0TtEO7z.js";
1
+ import { _ as WorkspaceBindings, a as NodeTestReport, c as ShellExecSpec, d as SubprocessDelegate, f as SubprocessHandle, g as SubprocessTerminalSpawnSpec, h as SubprocessTerminalHandle, i as FsTargetLike, l as ShellProcess, m as SubprocessSpawnSpec, n as FileSystem, o as ShellDelegate, p as SubprocessRuntime, r as FsDelegate, s as ShellExecRequest, t as ExecutionWorldProvider, u as ShellRunResult, v as WorldRef, y as WorldRegistry } from "../types-ekJQQ4x6.js";
2
2
  export { ExecutionWorldProvider, type FileSystem, FsDelegate, FsTargetLike, NodeTestReport, ShellDelegate, type ShellExecRequest, type ShellExecSpec, type ShellProcess, type ShellRunResult, SubprocessDelegate, type SubprocessHandle, type SubprocessRuntime, type SubprocessSpawnSpec, type SubprocessTerminalHandle, type SubprocessTerminalSpawnSpec, WorkspaceBindings, WorldRef, WorldRegistry };
@@ -1,5 +1,5 @@
1
+ import { SubprocessHandle as SubprocessHandle$1, SubprocessRuntime as SubprocessRuntime$1, SubprocessSpawnSpec as SubprocessSpawnSpec$1, SubprocessTerminalEnvironment, SubprocessTerminalHandle as SubprocessTerminalHandle$1, SubprocessTerminalSpawnSpec as SubprocessTerminalSpawnSpec$1 } from "@deepseek-ai/dsh-subprocess";
1
2
  import { FileSystem as FileSystem$1 } from "@deepseek-ai/dsh-fs";
2
- import { SubprocessHandle as SubprocessHandle$1, SubprocessRuntime as SubprocessRuntime$1, SubprocessSpawnSpec as SubprocessSpawnSpec$1, SubprocessTerminalHandle as SubprocessTerminalHandle$1, SubprocessTerminalSpawnSpec as SubprocessTerminalSpawnSpec$1 } from "@deepseek-ai/dsh-subprocess";
3
3
  import { ShellExecRequest as ShellExecRequest$1, ShellExecSpec as ShellExecSpec$1, ShellProcess as ShellProcess$1, ShellRunResult as ShellRunResult$1 } from "@deepseek-ai/dsh-shell";
4
4
  //#region src/router/types.d.ts
5
5
  interface NodeTestReport {
@@ -27,6 +27,8 @@ interface FsDelegate {
27
27
  }
28
28
  type FsTargetLike = string;
29
29
  interface SubprocessDelegate {
30
+ terminalEnvironment(signal?: AbortSignal): Promise<SubprocessTerminalEnvironment>;
31
+ resolveExecutable(command: string, env?: Readonly<Record<string, string>>, signal?: AbortSignal): Promise<string>;
30
32
  spawn(spec: SubprocessSpawnSpec$1): SubprocessHandle$1;
31
33
  spawnTerminal(spec: SubprocessTerminalSpawnSpec$1): Promise<SubprocessTerminalHandle$1>;
32
34
  }
@@ -64,4 +66,4 @@ type WorldRef = {
64
66
  };
65
67
  //#endregion
66
68
  export { WorkspaceBindings as _, NodeTestReport as a, ShellExecSpec$1 as c, SubprocessDelegate as d, SubprocessHandle$1 as f, SubprocessTerminalSpawnSpec$1 as g, SubprocessTerminalHandle$1 as h, FsTargetLike as i, ShellProcess$1 as l, SubprocessSpawnSpec$1 as m, FileSystem$1 as n, ShellDelegate as o, SubprocessRuntime$1 as p, FsDelegate as r, ShellExecRequest$1 as s, ExecutionWorldProvider as t, ShellRunResult$1 as u, WorldRef as v, WorldRegistry as y };
67
- //# sourceMappingURL=types-C0TtEO7z.d.ts.map
69
+ //# sourceMappingURL=types-ekJQQ4x6.d.ts.map