@sessionbus/dsh 0.1.0-pre.4 → 0.1.0-pre.7

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
@@ -19,13 +19,25 @@ lifetime (trusted host).
19
19
 
20
20
  See [Installing a DSH lane host](docs/HOST-INSTALL.md) for the complete
21
21
  preflight, installation, verification, and rollback procedure.
22
+ Its provider-parity step must be completed for both the lane and plain peer
23
+ profiles before either one runs a model turn.
22
24
 
23
- Create the base-only lane profile with:
25
+ Create the base-only lane profile for the package-owned `sessionbus-dsh`
26
+ product with:
24
27
 
25
28
  ```sh
26
29
  dsh plugin --profile sessionbus add @sessionbus/dsh && dsh plugin --profile sessionbus exec sessionbus-dsh-install
27
30
  ```
28
31
 
32
+ On a host that already uses dashi, one product can own both peers and lanes:
33
+
34
+ ```sh
35
+ dsh plugin --profile sessionbus add @sessionbus/dsh && dsh plugin --profile sessionbus exec sessionbus-dsh-install --product dashi
36
+ ```
37
+
38
+ In that form `SESSIONBUS_PRODUCTS` contains `dashi`, not `sessionbus-dsh`,
39
+ and the daemon maps it to `@antst/dashi-launcher`'s `dashi` bin.
40
+
29
41
  Add the peer plugin to another profile, such as `web`, with:
30
42
 
31
43
  ```sh
@@ -41,12 +53,12 @@ operator-chosen identifier matching `^[a-z0-9][a-z0-9-]{0,31}$`.
41
53
  Non-web profiles also receive the no-upload provider required by DSH's Session
42
54
  Controller; ordinary text prompts work while file-upload receipts are rejected.
43
55
 
44
- Register the daemon's `sessionbus-dsh` product command as the package's
45
- `sessionbus-dsh` bin. With a launch token it selects the installed `sessionbus`
46
- profile; without one it forwards arguments to `dsh` unchanged.
47
- The daemon finds that command on `PATH`, so install this package alongside
48
- `dsh` at the host level too—for example, run `pnpm add @sessionbus/dsh` in the
49
- directory where `dsh` is installed—so both bins share one `node_modules/.bin`.
56
+ For the two-product form, register the daemon's `sessionbus-dsh` product as the
57
+ package's `sessionbus-dsh` bin. For the one-product form, register only `dashi`
58
+ as the `dashi` bin. Both launchers select the installed `sessionbus` profile
59
+ when given a launch token. Install the selected launcher alongside `dsh` at the
60
+ host level and put their shared `node_modules/.bin` on the daemon service's
61
+ `PATH`; the `dashi` launcher resolves its child `dsh` by name.
50
62
 
51
63
  Uninstall without invoking DSH by running the installed bin from the profile:
52
64
 
@@ -62,4 +74,8 @@ installer removes the package first, then strips its managed `sessionbus` and
62
74
  `SESSIONBUS_GROUPS` configures peer identities only. Lane membership is owned
63
75
  by the daemon; the plugin accepts and does not consume groups in `session.open`.
64
76
 
77
+ ## Run results
78
+
79
+ A DSH error before its input commit returns `failed`, native stop reason `error`, and result `<code>: <message>` verbatim from the durable `turn/end`.
80
+
65
81
  See [Lane without a TUI](docs/LANE-WITHOUT-TUI.md) for the daemon launch contract.
package/install.mjs CHANGED
@@ -6,7 +6,7 @@ import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { spawnSync } from "node:child_process";
8
8
 
9
- const profilePatch = `- id: system-prompt
9
+ const profilePatch = (product) => `- id: system-prompt
10
10
  config:
11
11
  persona: >-
12
12
  You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
@@ -26,7 +26,7 @@ const profilePatch = `- id: system-prompt
26
26
  - { id: session-controller, name: '@deepseek-ai/dsh-api-session-controller' }
27
27
  - id: sessionbus
28
28
  name: '@sessionbus/dsh'
29
- config: { mode: lane, product: sessionbus-dsh }
29
+ config: { mode: lane, product: ${product} }
30
30
  `;
31
31
  const peerPatch = (product) => `- insert:
32
32
  - { id: sessionbus, name: '@sessionbus/dsh', config: { product: ${product} } }
@@ -133,8 +133,9 @@ export function install(profileNames = [], options = {}) {
133
133
  const root = options.root || path.dirname(fileURLToPath(import.meta.url));
134
134
  const run = options.run || ((args) => spawnSync("dsh", args, { cwd: root, encoding: "utf8" }));
135
135
  const names = [...new Set(profileNames.length ? profileNames : ["sessionbus"])];
136
+ const laneProduct = options.product ?? "sessionbus-dsh";
136
137
  if (options.product !== undefined && (typeof options.product !== "string" || !productPattern.test(options.product))) throw new Error(`invalid product ${JSON.stringify(options.product)}; expected ^[a-z0-9][a-z0-9-]{0,31}$`);
137
- if (names.includes("sessionbus") && options.product !== undefined && options.product !== "sessionbus-dsh") throw new Error("the sessionbus profile product must be sessionbus-dsh");
138
+ if (names.includes("sessionbus") && !["sessionbus-dsh", "dashi"].includes(laneProduct)) throw new Error("the sessionbus profile product must be sessionbus-dsh or dashi");
138
139
  if (names.some((name) => name !== "sessionbus") && options.product === undefined) throw new Error("--product is required for peer profiles");
139
140
  for (const name of names) {
140
141
  if (!validProfile(name)) throw new Error(`invalid profile name ${JSON.stringify(name)}`);
@@ -159,7 +160,7 @@ export function install(profileNames = [], options = {}) {
159
160
  dsh: { profile: { bundles: ["@deepseek-ai/dsh-base"], patchReload: "startup" } },
160
161
  };
161
162
  writeChanged(manifestFile, `${JSON.stringify(manifest, null, 2)}\n`);
162
- writeChanged(path.join(profile, "cordis.patch.yml"), profilePatch);
163
+ writeChanged(path.join(profile, "cordis.patch.yml"), profilePatch(laneProduct));
163
164
  }
164
165
  }
165
166
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sessionbus/dsh",
3
- "version": "0.1.0-pre.4",
3
+ "version": "0.1.0-pre.7",
4
4
  "type": "commonjs",
5
5
  "main": "plugin.cjs",
6
6
  "exports": "./plugin.cjs",
package/plugin.cjs CHANGED
@@ -191,15 +191,23 @@ class NativeSession {
191
191
  run.turn = run.openTurn;
192
192
  }
193
193
  if (event.type === "assistant/message" && run.turn === event.data.turn) run.output += textOf(event.data.message);
194
- if (event.type === "turn/end" && run.turn === event.data.turn) {
195
- try { run.end = terminal(event.data.reason); }
194
+ const earlyError = event.type === "turn/end" && run.turn === null && run.openTurn === event.data.turn && event.data.reason?.kind === "error";
195
+ if (event.type === "turn/end" && (run.turn === event.data.turn || earlyError)) {
196
+ try {
197
+ run.end = terminal(event.data.reason);
198
+ if (earlyError) run.output = `${event.data.reason.error.code}: ${event.data.reason.error.message}`;
199
+ }
196
200
  catch (error) { run.endError = error; }
197
201
  }
198
202
  }
199
203
 
200
204
  async run(cancel, token, input) {
201
205
  if (token.Interrupted()) return { outcome: "interrupted", result: "" };
202
- const message = this.message(input);
206
+ // @sessionbus/kit sdk/js/index.js:108-120 passes its text or delivery seed here.
207
+ const delivery = typeof input?.delivery?.body === "string" ? input.delivery : undefined;
208
+ const body = typeof input === "string" ? input : typeof input?.text === "string" ? input.text : delivery?.body;
209
+ if (body === undefined) throw new Error("sessionbus received an unexpected run input seed shape");
210
+ const message = this.message(body);
203
211
  const record = { message, openTurn: null, turn: null, output: "", cancelled: deferred() };
204
212
  const receipt = this.receipt(message, this.agent.session, cancel);
205
213
  this.active = record;
@@ -211,6 +219,7 @@ class NativeSession {
211
219
  try { this.agent.followup(message); }
212
220
  catch (error) { receipt.reject(error); throw error; }
213
221
  await receipt.promise;
222
+ if (delivery) await token.ReportDelivery({ disposition: "injected" });
214
223
  const idle = this.agent.whenIdle();
215
224
  idle.catch(() => {});
216
225
  await Promise.race([idle, record.cancelled.promise]);