@theoremjs/web 0.3.4-next.673.ga492632 → 0.3.4-next.677.g14b70fe

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/web",
3
- "version": "0.3.4-next.673.ga492632",
3
+ "version": "0.3.4-next.677.g14b70fe",
4
4
  "description": "Theorem on the web platform, with no UI framework: Web-standard server handlers that serve a profile, and the browser client that talks to them.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,6 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "^4.6.5",
28
- "@theoremjs/agents": "^0.3.4-next.673.ga492632"
28
+ "@theoremjs/agents": "^0.3.4-next.677.g14b70fe"
29
29
  }
30
30
  }
@@ -70,7 +70,7 @@ export type TheoremHandlerOptions = {
70
70
  * value the application's other call sites use too. The handler keeps its profile, its tool
71
71
  * execution and its abort. The application's `onStage` runs before the handler's steering, and
72
72
  * its `credentials` are read before the session's. A call held at a gate runs on, once
73
- * answered, with the `onStage` and `credentials` it gives for that call's turn.
73
+ * answered, with the `host`, `onStage` and `credentials` it gives for that call's turn.
74
74
  */
75
75
  prepare?: TurnWiring['prepare'];
76
76
  /**
package/server/handler.js CHANGED
@@ -362,8 +362,8 @@ async function* settleAnswered(ctx, request, session, answered) {
362
362
  }
363
363
  async function* invokeAnswered(ctx, request, sessionId, { callId, pending, answer }) {
364
364
  const host = await ctx.options.host?.(request);
365
- // why: The held call goes on with what the application set for its turn: its stage handler and credentials.
366
- const { credentials, onStage } = await preparedTurn(ctx.options.prepare, { profile: ctx.profile.id, input: pending.turnInput ?? {}, host, signal: request.signal }, {
365
+ // why: The held call goes on with what the application set for its turn: its context, stage handler and credentials.
366
+ const prepared = await preparedTurn(ctx.options.prepare, { profile: ctx.profile.id, input: pending.turnInput ?? {}, host, signal: request.signal }, {
367
367
  credentials: sessionCredentials(ctx, sessionId),
368
368
  ...(ctx.options.onStage ? { onStage: ctx.options.onStage } : {}),
369
369
  });
@@ -381,14 +381,14 @@ async function* invokeAnswered(ctx, request, sessionId, { callId, pending, answe
381
381
  ? { page: answer.page ?? { unanswered: true } }
382
382
  : {}),
383
383
  sessionPermissions: answer.sessionPermissions,
384
- credentials,
385
- ...(onStage ? { onStage } : {}),
384
+ credentials: prepared.credentials,
385
+ ...(prepared.onStage ? { onStage: prepared.onStage } : {}),
386
386
  turnInput: pending.turnInput,
387
387
  snapshot: pending.snapshot,
388
388
  promoted: pending.promoted,
389
389
  model: pending.model,
390
390
  signal: request.signal,
391
- host,
391
+ host: prepared.host,
392
392
  });
393
393
  }
394
394
  /** A settled call's answer, streamed again. */