@theoremjs/web 0.3.4-next.729.g096feb6 → 0.3.4-next.731.g189a95d
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 +1 -1
- package/package.json +2 -2
- package/server/handler.js +7 -1
package/README.md
CHANGED
|
@@ -264,7 +264,7 @@ const transport = withPageToolDispatch(
|
|
|
264
264
|
| `provider` | Host options, including the credential vault. A function can return these options per request, for example for tenant-specific credentials. |
|
|
265
265
|
| `session` | Returns the session id of the caller, for example `${userId}:${conversationId}`. Return `undefined` to refuse the request with a 401. Default: a random id in an HttpOnly, SameSite=Lax cookie that lasts 30 days. |
|
|
266
266
|
| `host` | App data for the tool handlers (`ctx.host`), such as the signed-in user. |
|
|
267
|
-
| `prepare` | Your app's own turn, from the one the handler builds (`TurnWiring.prepare` from `@theoremjs/agents`). Set what your app sets per turn, such as `system`, `credentials`, `onStage` and `onAgentCall`; read your app data as `turn.host`. The handler keeps its profile, its tool execution and its abort. Your `onStage` runs before the handler's steering, and your `credentials` are read before the session's. A call held at a gate runs on, once answered, with the `host`, `onStage` and `credentials` you give for that call's turn. |
|
|
267
|
+
| `prepare` | Your app's own turn, from the one the handler builds (`TurnWiring.prepare` from `@theoremjs/agents`). Set what your app sets per turn, such as `system`, `credentials`, `onStage`, `onEvent` and `onAgentCall`; read your app data as `turn.host`. The handler keeps its profile, its tool execution and its abort. Your `onStage` runs before the handler's steering, and your `credentials` are read before the session's. A call held at a gate runs on, once answered, with the `host`, `onStage` and `credentials` you give for that call's turn; that turn has `answersHeldCall`, and its `onEvent` is not called, because no new turn runs. |
|
|
268
268
|
| `onStage` | The server's own stage handler, on every call the handler runs, a host profile's included: after your app's (`prepare`), before steering. For a rule the server adds to whatever the app says, such as a question before each tool that writes. |
|
|
269
269
|
| `pageToolBroker` | Delivers results to active page dispatches. Default: bounded process memory. |
|
|
270
270
|
| `pageStatesTurn` | Let the page say which prompt lines a turn gets, through `stated` on a turn or a live call. Set it only for a page you trust as yourself, such as a builder's own tool. Without it, a request with `stated` is refused. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theoremjs/web",
|
|
3
|
-
"version": "0.3.4-next.
|
|
3
|
+
"version": "0.3.4-next.731.g189a95d",
|
|
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.
|
|
28
|
+
"@theoremjs/agents": "^0.3.4-next.731.g189a95d"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/server/handler.js
CHANGED
|
@@ -363,7 +363,13 @@ async function* settleAnswered(ctx, request, session, answered) {
|
|
|
363
363
|
async function* invokeAnswered(ctx, request, sessionId, { callId, pending, answer }) {
|
|
364
364
|
const host = await ctx.options.host?.(request);
|
|
365
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, {
|
|
366
|
+
const prepared = await preparedTurn(ctx.options.prepare, {
|
|
367
|
+
profile: ctx.profile.id,
|
|
368
|
+
input: pending.turnInput ?? {},
|
|
369
|
+
host,
|
|
370
|
+
signal: request.signal,
|
|
371
|
+
answersHeldCall: true,
|
|
372
|
+
}, {
|
|
367
373
|
credentials: sessionCredentials(ctx, sessionId),
|
|
368
374
|
...(ctx.options.onStage ? { onStage: ctx.options.onStage } : {}),
|
|
369
375
|
});
|