@sessionbus/dsh 0.1.0-pre.6 → 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.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/package.json +1 -1
  3. package/plugin.cjs +12 -3
package/README.md CHANGED
@@ -19,6 +19,8 @@ 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
25
  Create the base-only lane profile for the package-owned `sessionbus-dsh`
24
26
  product with:
@@ -72,4 +74,8 @@ installer removes the package first, then strips its managed `sessionbus` and
72
74
  `SESSIONBUS_GROUPS` configures peer identities only. Lane membership is owned
73
75
  by the daemon; the plugin accepts and does not consume groups in `session.open`.
74
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
+
75
81
  See [Lane without a TUI](docs/LANE-WITHOUT-TUI.md) for the daemon launch contract.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sessionbus/dsh",
3
- "version": "0.1.0-pre.6",
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]);