@ouispec/agent-worker 0.31.0 → 0.32.1
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 +30 -6
- package/dist/authz/tool-policy.d.ts +2 -1
- package/dist/authz/tool-policy.d.ts.map +1 -1
- package/dist/authz/tool-policy.js.map +1 -1
- package/dist/handoff/handoff-tool.d.ts +51 -0
- package/dist/handoff/handoff-tool.d.ts.map +1 -0
- package/dist/handoff/handoff-tool.js +146 -0
- package/dist/handoff/handoff-tool.js.map +1 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/live-call/handler.d.ts +11 -4
- package/dist/live-call/handler.d.ts.map +1 -1
- package/dist/live-call/handler.js +34 -7
- package/dist/live-call/handler.js.map +1 -1
- package/dist/live-call/protocol.d.ts +52 -6
- package/dist/live-call/protocol.d.ts.map +1 -1
- package/dist/live-call/protocol.js +55 -7
- package/dist/live-call/protocol.js.map +1 -1
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +9 -1
- package/dist/orchestrator.js.map +1 -1
- package/dist/prompt/capture.d.ts +9 -0
- package/dist/prompt/capture.d.ts.map +1 -1
- package/dist/prompt/capture.js +20 -2
- package/dist/prompt/capture.js.map +1 -1
- package/dist/prompt/handoff.d.ts +140 -0
- package/dist/prompt/handoff.d.ts.map +1 -0
- package/dist/prompt/handoff.js +218 -0
- package/dist/prompt/handoff.js.map +1 -0
- package/dist/runtime/turn-runner.d.ts.map +1 -1
- package/dist/runtime/turn-runner.js +13 -0
- package/dist/runtime/turn-runner.js.map +1 -1
- package/dist/runtime/types.d.ts +10 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/tools/types.d.ts +5 -4
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -76,8 +76,8 @@ Every other key is the page's context, which a persona prompt shows as the curre
|
|
|
76
76
|
Each step of a turn (each call to the model: the first, and one after every round of tool calls) sends, in this order:
|
|
77
77
|
|
|
78
78
|
1. **The system prompt**, with a cache breakpoint, then the page's index (`<page_index>`) when the client has a page, with its own. The same on every step, and on every turn on the same page.
|
|
79
|
-
2. **The conversation** as the host stored it, ending with the turn's own message: the person's words, or the instruction that stands for them (a call's opening, glance or
|
|
80
|
-
3. **The turn's context**, straight after the turn's message: what is true for the whole turn and for no other. In this order: the clock (`<now>`), how the message was entered (`<input>`), how the reply is delivered (`<output>`), whether the model can look at the caller (`<vision>`, a glance's observation included), the photo plans and the running capture (`<capture>`), calls whose approval expired, and the host's `stepContext` (what `getHistory` returns beside the messages: an index of work notes, a dealer's notes on what the customer needs). Every step sends it in the same place, in the same words.
|
|
79
|
+
2. **The conversation** as the host stored it, ending with the turn's own message: the person's words, or the instruction that stands for them (a call's opening, glance, capture update or device update).
|
|
80
|
+
3. **The turn's context**, straight after the turn's message: what is true for the whole turn and for no other. In this order: the clock (`<now>`), how the message was entered (`<input>`), how the reply is delivered (`<output>`), whether the model can look at the caller (`<vision>`, a glance's observation included), the photo plans and the running capture (`<capture>`), the device the call is on and whether it can move (`<handoff>`), calls whose approval expired, and the host's `stepContext` (what `getHistory` returns beside the messages: an index of work notes, a dealer's notes on what the customer needs). Every step sends it in the same place, in the same words.
|
|
81
81
|
4. **The turn's rounds so far**: each round's text and tool calls, then their results. A cache breakpoint moves with the end of the conversation: on the turn's context on the first step, then on the newest result, so each step reads all of the step before it from the cache.
|
|
82
82
|
5. **What is true for this step only**, after that breakpoint, when there is any: the page's state (`<page_state>`: the page as the user's screen sent it, then as the newest answer that carried it left it) and the step's notes (`<step_note>`: the turn policy's `note`, a forced action, the turn's record after a call that failed, a step that has to plan less).
|
|
83
83
|
|
|
@@ -314,7 +314,7 @@ const liveCall = createLiveCallTurnHandler({
|
|
|
314
314
|
resolveTurn: async (request, { signal }) => {
|
|
315
315
|
const conversation = await findConversationByCallRef(request.clientRef);
|
|
316
316
|
if (!conversation) return null; // answered 404
|
|
317
|
-
// What the person said, redacted; for an opening, a glance or a
|
|
317
|
+
// What the person said, redacted; for an opening, a glance, a capture or a device update, the instruction that stands for it.
|
|
318
318
|
const said = request.kind === 'message' ? redactCardNumbers(request.text) : liveCallTurnMessage(request);
|
|
319
319
|
await storeUserMessage(conversation.id, said, request.input);
|
|
320
320
|
return {
|
|
@@ -356,13 +356,13 @@ process.on('SIGTERM', () => liveCall.close()); // waits for running turns
|
|
|
356
356
|
| `sessionId` | The call service's session. |
|
|
357
357
|
| `clientRef` | Your conversation reference, given to the call service when the call was created. |
|
|
358
358
|
| `turnId` | Unique per turn; the turn runs under it. |
|
|
359
|
-
| `kind` | `message`: the person said `text`. `opening`: the call has just connected, `text` is empty, and the agent greets: the model reads `liveCallOpeningMessage(request)` where the person's words would be (`LIVE_CALL_OPENING_MESSAGE` when no disclosure was sent). `glance`: nobody has spoken for a while and the call service's look noticed something; `text` is empty, `client.vision` carries `remarks` on and the `observation`, and the model reads `LIVE_CALL_GLANCE_MESSAGE` ("Vision"). `capture`: something happened in a photo capture; `text` is empty, `client.capture.update` says what, and the model reads `liveCallCaptureMessage(update)` ("Photo captures"). `liveCallTurnMessage(request)` is what the model reads for any kind, and the row to store for it. |
|
|
359
|
+
| `kind` | `message`: the person said `text`. `opening`: the call has just connected, `text` is empty, and the agent greets: the model reads `liveCallOpeningMessage(request)` where the person's words would be (`LIVE_CALL_OPENING_MESSAGE` when no disclosure was sent). `glance`: nobody has spoken for a while and the call service's look noticed something; `text` is empty, `client.vision` carries `remarks` on and the `observation`, and the model reads `LIVE_CALL_GLANCE_MESSAGE` ("Vision"). `capture`: something happened in a photo capture; `text` is empty, `client.capture.update` says what, and the model reads `liveCallCaptureMessage(update)` ("Photo captures"). `device`: something happened to the caller's devices (the call moved, came back, was disconnected or lost); `text` is empty, `client.handoff.update` says what, and the model reads `liveCallDeviceMessage(update)` ("Moving the call to another device"). `liveCallTurnMessage(request)` is what the model reads for any kind, and the row to store for it. |
|
|
360
360
|
| `text` | What the person said, as transcribed; at most 8,000 characters. |
|
|
361
361
|
| `input` | `{ mode: 'voice', language? }` for what the person said: set as the turn's `context.input`, so the model is told it was transcribed. `{ mode: 'text' }` for a message they typed during the call: read as typed, with no `context.input`. Dropped on an `opening`. |
|
|
362
362
|
| `output` | `{ mode: 'voice', voiceDirections? }`: set as the turn's `context.output`, so the model writes for the ear, and may use the voice's tags when `voiceDirections: { engine, tags, guidance }` offers them ("What a UI client sends with a turn"). |
|
|
363
363
|
| `disclosureLine` | On an `opening`: what the call service has just said to the person before the greeting (that they are talking with an AI assistant), as spoken; at most 1,000 characters. The model is told it was said, and greets following on from it without repeating it. Not read on a `message`. |
|
|
364
364
|
| `supersedes` | Turns this one replaces. Each still running in this process is stopped at once, and the turn's `getHistory` is given them to wait for, as for any superseding message. |
|
|
365
|
-
| `client` | `{ ui, vision, capture }`. `ui`: the person's page, when it sent its UI into the call (Closure's `<LiveCall uiContext>`), as its typed turns carry it: `{ buildId?, currentPath?, oui?, uiKnowledge? }`, at most 64 KiB (`LIVE_CALL_LIMITS.clientUiBytes`). Its `oui`, `uiKnowledge` and `currentPath` go on the turn's context under those names, so the turn's UI tools are the page's and its UI actions reach that page through the room, as on a typed turn; a key your target's `context` sets itself is kept. `buildId` stays on `request.client.ui`, for your `resolveTurn` to check against the build you expect. Fields it does not know are read past. Absent, or `ui: null`, for a call with no page (a phone call): the turn has only your context. `vision`: whether and how the character may look at the caller's camera ("Vision"). `capture`: the session's photo plans, the route the capture tools call, the capture running now and what happened in it ("Photo captures"). |
|
|
365
|
+
| `client` | `{ ui, vision, capture, handoff }`. `ui`: the person's page, when it sent its UI into the call (Closure's `<LiveCall uiContext>`), as its typed turns carry it: `{ buildId?, currentPath?, oui?, uiKnowledge? }`, at most 64 KiB (`LIVE_CALL_LIMITS.clientUiBytes`). Its `oui`, `uiKnowledge` and `currentPath` go on the turn's context under those names, so the turn's UI tools are the page's and its UI actions reach that page through the room, as on a typed turn; a key your target's `context` sets itself is kept. `buildId` stays on `request.client.ui`, for your `resolveTurn` to check against the build you expect. Fields it does not know are read past. Absent, or `ui: null`, for a call with no page (a phone call): the turn has only your context. `vision`: whether and how the character may look at the caller's camera ("Vision"). `capture`: the session's photo plans, the route the capture tools call, the capture running now and what happened in it ("Photo captures"). `handoff`: the route `call_handoff` calls, the device the call is live on, an open offer, and what happened to the caller's devices ("Moving the call to another device"). |
|
|
366
366
|
|
|
367
367
|
`readLiveCallTurnRequest` reads a body as the handler does, and `LIVE_CALL_LIMITS` holds its limits.
|
|
368
368
|
|
|
@@ -372,7 +372,7 @@ process.on('SIGTERM', () => liveCall.close()); // waits for running turns
|
|
|
372
372
|
|---|---|---|
|
|
373
373
|
| `text` | `{ text }` | The reply; concatenate the pieces. With `speak: 'all'`, as the model writes it: rounds written between tool calls are separated by a blank line, as in the room. With `final-round`, the holding line and the turn's last round. |
|
|
374
374
|
| `readback` | `{ approvalId, text, expiresAt }` | The turn stopped at a call that needs approval. `text` is the preview's `spokenReadback` when your `approvals.preview` wrote one, else its `readback`, verbatim; `expiresAt` is ISO 8601. Sent once the turn has ended by itself, after all of its text. A turn that was stopped withdrew its approval, and sends none. |
|
|
375
|
-
| `done` | `{ stopReason? }` | The turn is over: `complete`, `awaiting_approval`, `present_options`, `time_limit`, `output_limit` or `step_count` when it ended by itself; `user_stop`, `superseded` or `deadline` when it was stopped. A turn whose reply is nothing (a glance with nothing worth a remark, a capture update not worth a word) is `done` alone, with no `text` before it: silence. |
|
|
375
|
+
| `done` | `{ stopReason? }` | The turn is over: `complete`, `awaiting_approval`, `present_options`, `time_limit`, `output_limit` or `step_count` when it ended by itself; `user_stop`, `superseded` or `deadline` when it was stopped. A turn whose reply is nothing (a glance with nothing worth a remark, a capture or device update not worth a word) is `done` alone, with no `text` before it: silence. |
|
|
376
376
|
| `error` | `{ code, message }` | The turn failed or did not run: `RATE_LIMIT`, `SERVICE_UNAVAILABLE`, `MODEL_TIMEOUT`, `TURN_TIMEOUT`, `TURN_DEADLINE_EXCEEDED`, `TURN_REFUSED` (your turn record refused it), `TURN_DECLINED` (your `beforeTurn` refused it) or `WORKER_ERROR`. `message` is a fixed line for the code; the cause stays in your logs. |
|
|
377
377
|
|
|
378
378
|
The stream is written from the turn's own events as the room receives them (`TurnHost.observe`): the same text, from the same model call. Before the stream opens, a refusal is a status and `{ error: { code, message } }`: `400 INVALID_REQUEST` naming the field, `401 UNAUTHORIZED`, `404 UNKNOWN_CLIENT_REF`, `405`, `409 TURN_RUNNING`, `413 BODY_TOO_LARGE`, `415`, `500 RESOLVE_FAILED` (your `resolveTurn` threw, or returned a target that is not a turn; nothing ran) and `503 UNAVAILABLE`.
|
|
@@ -422,6 +422,30 @@ The capture's names and values are those of Closure's capture contract (`@closur
|
|
|
422
422
|
|
|
423
423
|
The token is never logged or emitted, and neither are an update's words: the turn's log lines carry facts only, `capture: { plans, canStart, active?, step?, update? }`. Nothing changes for a host but the opt-in and the stored row: `resolveTurn` sees `request.client.capture` and need not touch it.
|
|
424
424
|
|
|
425
|
+
A capture can say why it is `blocked`: `active.blockedReason` is `camera_denied` or `no_rear_camera` (`CAPTURE_BLOCKED_REASONS`). With `no_rear_camera`, the call can move to the caller's phone, and the capture's words say to offer it with `call_handoff` ("Moving the call to another device").
|
|
426
|
+
|
|
427
|
+
**Moving the call to another device.** A caller on a laptop can carry the same call on to their phone (Closure Studio's call hand-off): the character offers it, a QR code appears on the laptop's screen, the phone opens the link on your own site, and the same conversation carries on there while the laptop pauses. Nothing moves on the server: the session, the room, your conversation and a running capture are the same throughout. The character never sees a device, a screen or a code: everything it learns of a move is words, and it never gets the code or the link.
|
|
428
|
+
|
|
429
|
+
Set `acceptsHandoff: true` on your brain endpoint once you run this version: the call service then sends every turn of a session whose call can move `client.handoff`, and sends `device` turns. A worker before it answers a `device` turn `400` (`kind must be one of message, opening, glance, capture`), which is why the call service sends neither without the opt-in. Without it, the caller can still move the call with their own **Continue on phone** control; your brain is simply not told.
|
|
430
|
+
|
|
431
|
+
```json
|
|
432
|
+
{ "control": { "url": "https://…/api/v1/sessions/{id}/handoffs", "token": "lhb1.…", "expiresAt": "2026-11-18T11:16:30.000Z" },
|
|
433
|
+
"device": { "formFactor": "desktop", "switches": 0 },
|
|
434
|
+
"offer": { "handoffId": "3c1d9e2a-…", "purpose": "photos", "expiresAt": "2026-11-18T10:26:30.000Z" },
|
|
435
|
+
"update": null }
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
`control` is the call service's hand-offs route for the session and an `lhb1` token for it, sent only over https (or to this machine), with no query. `device` is the device the call is live on (`formFactor` one of `CALL_FORM_FACTORS`: `phone`, `tablet`, `desktop`, `unknown`) and how many times the call has switched devices, or null while no device is live. `offer` is the code on the caller's screen now, or null. `update` is what happened since the brain last heard, in Closure's words: the updates pending since then, joined in order, each at most `DEVICE_UPDATE_TEXT_MAX` (600) characters; the whole at most 8,000. It is read as strictly as `client.capture`: a wrong field answers `400` naming it, and no refusal repeats the token. The handler sets it as the turn payload's `handoff` (`TurnHandoff`; `payloadRefusal` checks it), and the worker gives the model:
|
|
439
|
+
|
|
440
|
+
- while there is a `control` route, the **hand-off tool** `call_handoff({ purpose })` (`handoffTool`, the SDK's `handoff` tool class, `kind: 'backend'`, a `mutate`): `POST {url}` with `{ purpose }` and `Authorization: Bearer <token>`. `purpose` is `photos` (a photo capture needs a phone's rear camera), `caller_asked` (the caller asked to continue on their phone) or `other` (`CALL_HANDOFF_PURPOSES`). The result is `{ handoffId, status, words }`: the route's `words` are what the model says from ("A QR code is on their screen. Tell them to scan it with their phone's camera…"). It never carries the code or the link, even if an answer did. A refusal fails with a line chosen by its code, never the route's own words (`HANDOFF_REFUSALS`): `HANDOFF_UNAVAILABLE` is "This call can't move to another device.", `HANDOFF_UNSUPPORTED_CALL` is "This call's app can't move to another device.", `RATE_LIMITED` is "A code was offered several times already; ask them to use the one on their screen.", and `SESSION_NOT_LIVE`, `NO_ACTIVE_DEVICE`, `HANDOFF_TOKEN_WRONG_SESSION`, `401`/`403`, a timeout (15 s) or an expired token each say what to do instead. A host tool of the same name gives way to it; a tool policy that admits by name should admit the `handoff` class;
|
|
441
|
+
- one line in the turn's context: "You can move this call to the caller's phone with `call_handoff`. Offer it when photos need a rear camera this device lacks, or when the caller would be better off on their phone, and call it once they agree. A QR code then appears on their screen. Never read out a code or a link. While the call moves you receive device updates: answer each with one short sentence, or with nothing." (`HANDOFF_WHEN`, the clause Closure's own brain is given), that it never sees the caller's devices, their screen or the code and never claims to (`HANDOFF_NEVER`), the device the call is live on and how often it has moved, and the open offer. Without a `control` route the tool is not offered, and the line says the call cannot be moved from this turn.
|
|
442
|
+
|
|
443
|
+
A **device** turn passes on what happened to the caller's devices (`CALL_DEVICE_UPDATE_KINDS`): a code offered from the caller's own control (`offered`), the call moved to the device that redeemed it (`switched`), brought back (`brought_back`), the other device disconnected by "That wasn't me" (`revoked`), a code that expired unused (`expired`), or the live device lost (`active_lost`). `text` is empty and `client.handoff.update` is the words, for example `The caller moved the call to their phone. Their computer is paused. Carry on where you left off.` The model reads `liveCallDeviceMessage(update)` where the person's words would be: the update in a `<device_update>` tag, as data, and the instruction to answer it in one short sentence, or to say nothing, and the stream is `done` with no `text` event. Capture updates that arrived with it ride the same turn: its message is then `liveCallDeviceMessage(update)` followed by `liveCallCaptureMessage(client.capture.update)`. Store `liveCallTurnMessage(request)` for the turn, as for a capture: it is a readable row with which device the call moved to. An update can also ride a `message` turn (the caller spoke first): it then reaches the model in the turn's hand-off line, for that turn only. A device turn without an update answers `400`.
|
|
444
|
+
|
|
445
|
+
The hand-off's names and values are those of Closure's hand-off contract (`@closurestudio/realtime-contracts`, `live-call-devices`), exported here without depending on it: `CALL_HANDOFF_PURPOSES` / `CallHandoffPurpose`, `CALL_FORM_FACTORS` / `CallFormFactor`, `CALL_HANDOFF_STATUSES` / `CallHandoffStatus`, `CALL_DEVICE_UPDATE_KINDS` / `CallDeviceUpdateKind`, `DEVICE_UPDATE_TEXT_MAX` (600) and `HANDOFF_CODE_TTL_S` (600).
|
|
446
|
+
|
|
447
|
+
The token is never logged or emitted, and neither are an update's words: the turn's log lines carry facts only, `handoff: { canOffer, device, switches?, offer?, update? }`. Nothing changes for a host but the opt-in and the stored row: `resolveTurn` sees `request.client.handoff` and need not touch it.
|
|
448
|
+
|
|
425
449
|
**Barge-in.** When the person speaks over the reply, the call service closes the connection. The turn is stopped as a superseding message stops it (`stopReason: 'superseded'`): what it had produced is stored with the mark and announced to the room, and the next request names it in `supersedes`. A stop asked for through the realtime server (the person's Stop on a page) is heard too, and that stream ends with `done`.
|
|
426
450
|
|
|
427
451
|
Keep the turn's deadline (`turnDeadlineMs`) and the model to a call's pace: a voice turn waits on its first `text` event, so run it on the container adapter, never behind a queue.
|
|
@@ -31,7 +31,8 @@ export interface ToolPolicyContext {
|
|
|
31
31
|
toolKind: 'ui' | 'backend';
|
|
32
32
|
/**
|
|
33
33
|
* The SDK's class for a tool it owns: `attachment` for the attachment
|
|
34
|
-
* tools, `vision` for `look`, `capture` for the capture tools
|
|
34
|
+
* tools, `vision` for `look`, `capture` for the capture tools, `handoff`
|
|
35
|
+
* for `call_handoff`. A policy that
|
|
35
36
|
* admits by name should admit the
|
|
36
37
|
* class too, so a tool the SDK adds to it later needs no change.
|
|
37
38
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-policy.d.ts","sourceRoot":"","sources":["../../src/authz/tool-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAElE;;;;;;;GAOG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,MAAM,EAAE,MAAM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AM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,MAAM,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAE/B,CAAC;AAEF;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAU7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-policy.js","sourceRoot":"","sources":["../../src/authz/tool-policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-policy.js","sourceRoot":"","sources":["../../src/authz/tool-policy.ts"],"names":[],"mappings":"AAmEA;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAe;IAC3C,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAgB,EAAE,CAAC;CACrD,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAAkB,EAClB,GAAsB;IAEtB,IAAI,CAAC;QACH,OAAO,MAAM,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC;QAChF,OAAO;YACL,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,2CAA2C,OAAO,EAAE;SAC7D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The hand-off tool: the character moves the call to the caller's phone
|
|
3
|
+
*.
|
|
4
|
+
*
|
|
5
|
+
* The turn's `client.handoff.control` names studio-api's hand-offs route for
|
|
6
|
+
* the session (H1, `POST /sessions/{sessionId}/handoffs`) and an `lhb1` token
|
|
7
|
+
* for it. `call_handoff({ purpose })` calls it as the capture tools call
|
|
8
|
+
* theirs: studio-api mints a single-use code, and the caller's LiveCall shows
|
|
9
|
+
* it as a QR code on their screen. The route answers an `lhb1` caller without
|
|
10
|
+
* the link, and the tool would drop one if it came: the model never gets the
|
|
11
|
+
* code or the link, so it can never read one out.
|
|
12
|
+
*
|
|
13
|
+
* The result is the route's answer's `words` with the hand-off's id and
|
|
14
|
+
* status. A refusal fails with a line chosen by its code, never the route's
|
|
15
|
+
* own message. The token is never logged or emitted.
|
|
16
|
+
*/
|
|
17
|
+
import type { RegisteredTool } from '../tools/types.js';
|
|
18
|
+
import { type TurnHandoff } from '../prompt/handoff.js';
|
|
19
|
+
export declare const CALL_HANDOFF_TOOL = "call_handoff";
|
|
20
|
+
/** The SDK's class for the hand-off tool, as a host's tool policy sees it. */
|
|
21
|
+
export declare const HANDOFF_TOOL_CLASS = "handoff";
|
|
22
|
+
/** Limits on a hand-off call. */
|
|
23
|
+
export declare const HANDOFF_TOOL_LIMITS: {
|
|
24
|
+
/** The longest words the tool gives the model. */
|
|
25
|
+
readonly wordsChars: 2000;
|
|
26
|
+
/** The longest `handoffId` read from an answer. */
|
|
27
|
+
readonly handoffIdChars: 128;
|
|
28
|
+
/** How long a call may take: studio-api mints the code and sends it to the caller's screen. */
|
|
29
|
+
readonly timeoutMs: 15000;
|
|
30
|
+
};
|
|
31
|
+
/** The lines the hand-off contract gives a refusal, by code. */
|
|
32
|
+
export declare const HANDOFF_REFUSALS: {
|
|
33
|
+
readonly HANDOFF_UNAVAILABLE: "This call can't move to another device.";
|
|
34
|
+
readonly HANDOFF_UNSUPPORTED_CALL: "This call's app can't move to another device.";
|
|
35
|
+
readonly RATE_LIMITED: "A code was offered several times already; ask them to use the one on their screen.";
|
|
36
|
+
/** The call has ended: nothing to say. */
|
|
37
|
+
readonly SESSION_NOT_LIVE: "The call has already ended. Say nothing about moving it.";
|
|
38
|
+
readonly NO_ACTIVE_DEVICE: "Their device isn't connected to the call right now, so it can't move yet. Wait until they're back, then offer it again.";
|
|
39
|
+
readonly NOT_ALLOWED: "This call can't move to another device right now. Go on without it.";
|
|
40
|
+
readonly FAILED: "Moving the call failed just now. Go on; you may offer it again in a little while.";
|
|
41
|
+
};
|
|
42
|
+
/** The tool's description: when to offer, and that the code and link are never the model's. */
|
|
43
|
+
export declare const CALL_HANDOFF_DESCRIPTION: string;
|
|
44
|
+
/**
|
|
45
|
+
* Builds the turn's hand-off tool, bound to its control route and token: none
|
|
46
|
+
* unless the turn has a route (`canHandoff`).
|
|
47
|
+
*/
|
|
48
|
+
export declare function handoffTool(handoff: TurnHandoff | null | undefined, options?: {
|
|
49
|
+
fetch?: typeof fetch;
|
|
50
|
+
}): RegisteredTool[];
|
|
51
|
+
//# sourceMappingURL=handoff-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff-tool.d.ts","sourceRoot":"","sources":["../../src/handoff/handoff-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAOL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C,iCAAiC;AACjC,eAAO,MAAM,mBAAmB;IAC9B,kDAAkD;;IAElD,mDAAmD;;IAEnD,+FAA+F;;CAEvF,CAAC;AA4CX,gEAAgE;AAChE,eAAO,MAAM,gBAAgB;;;;IAI3B,0CAA0C;;;;;CAKlC,CAAC;AA2BX,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,QAKqE,CAAC;AAE3G;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GAAG,cAAc,EAAE,CAwD7H"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { CALL_HANDOFF_PURPOSES, CALL_HANDOFF_STATUSES, canHandoff, } from '../prompt/handoff.js';
|
|
2
|
+
export const CALL_HANDOFF_TOOL = 'call_handoff';
|
|
3
|
+
/** The SDK's class for the hand-off tool, as a host's tool policy sees it. */
|
|
4
|
+
export const HANDOFF_TOOL_CLASS = 'handoff';
|
|
5
|
+
/** Limits on a hand-off call. */
|
|
6
|
+
export const HANDOFF_TOOL_LIMITS = {
|
|
7
|
+
/** The longest words the tool gives the model. */
|
|
8
|
+
wordsChars: 2_000,
|
|
9
|
+
/** The longest `handoffId` read from an answer. */
|
|
10
|
+
handoffIdChars: 128,
|
|
11
|
+
/** How long a call may take: studio-api mints the code and sends it to the caller's screen. */
|
|
12
|
+
timeoutMs: 15_000,
|
|
13
|
+
};
|
|
14
|
+
const HANDOFF_ID = new RegExp(`^[A-Za-z0-9][A-Za-z0-9._:-]{0,${HANDOFF_TOOL_LIMITS.handoffIdChars - 1}}$`);
|
|
15
|
+
const fail = (error) => ({ success: false, error });
|
|
16
|
+
function isPlainObject(value) {
|
|
17
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
18
|
+
}
|
|
19
|
+
/** Words the model is given: trimmed and bounded. */
|
|
20
|
+
function wordsOf(value) {
|
|
21
|
+
if (typeof value !== 'string' || !value.trim())
|
|
22
|
+
return null;
|
|
23
|
+
return value.trim().slice(0, HANDOFF_TOOL_LIMITS.wordsChars);
|
|
24
|
+
}
|
|
25
|
+
function readAnswer(body) {
|
|
26
|
+
if (!isPlainObject(body))
|
|
27
|
+
return null;
|
|
28
|
+
const words = wordsOf(body.words);
|
|
29
|
+
if (typeof body.handoffId !== 'string' || !HANDOFF_ID.test(body.handoffId) || !words)
|
|
30
|
+
return null;
|
|
31
|
+
if (!CALL_HANDOFF_STATUSES.includes(body.status))
|
|
32
|
+
return null;
|
|
33
|
+
// Only these three: never `url`, which an API key's answer carries and the model must never have.
|
|
34
|
+
return { handoffId: body.handoffId, status: body.status, words };
|
|
35
|
+
}
|
|
36
|
+
function readRefusal(status, body) {
|
|
37
|
+
const outer = isPlainObject(body) ? body : {};
|
|
38
|
+
const inner = isPlainObject(outer.error) ? outer.error : outer;
|
|
39
|
+
return { status, code: typeof inner.code === 'string' ? inner.code : null };
|
|
40
|
+
}
|
|
41
|
+
/** The lines the hand-off contract gives a refusal, by code. */
|
|
42
|
+
export const HANDOFF_REFUSALS = {
|
|
43
|
+
HANDOFF_UNAVAILABLE: "This call can't move to another device.",
|
|
44
|
+
HANDOFF_UNSUPPORTED_CALL: "This call's app can't move to another device.",
|
|
45
|
+
RATE_LIMITED: 'A code was offered several times already; ask them to use the one on their screen.',
|
|
46
|
+
/** The call has ended: nothing to say. */
|
|
47
|
+
SESSION_NOT_LIVE: 'The call has already ended. Say nothing about moving it.',
|
|
48
|
+
NO_ACTIVE_DEVICE: "Their device isn't connected to the call right now, so it can't move yet. Wait until they're back, then offer it again.",
|
|
49
|
+
NOT_ALLOWED: "This call can't move to another device right now. Go on without it.",
|
|
50
|
+
FAILED: 'Moving the call failed just now. Go on; you may offer it again in a little while.',
|
|
51
|
+
};
|
|
52
|
+
/** What the model is told of a refusal: a line chosen by its code (else its status), never the route's own words. */
|
|
53
|
+
function refusalLine(refusal) {
|
|
54
|
+
switch (refusal.code) {
|
|
55
|
+
case 'HANDOFF_UNAVAILABLE':
|
|
56
|
+
case 'HANDOFF_UNSUPPORTED_CALL':
|
|
57
|
+
case 'RATE_LIMITED':
|
|
58
|
+
case 'SESSION_NOT_LIVE':
|
|
59
|
+
case 'NO_ACTIVE_DEVICE':
|
|
60
|
+
return HANDOFF_REFUSALS[refusal.code];
|
|
61
|
+
case 'HANDOFF_TOKEN_WRONG_SESSION':
|
|
62
|
+
return HANDOFF_REFUSALS.NOT_ALLOWED;
|
|
63
|
+
}
|
|
64
|
+
switch (refusal.status) {
|
|
65
|
+
case 401:
|
|
66
|
+
case 403:
|
|
67
|
+
return HANDOFF_REFUSALS.NOT_ALLOWED;
|
|
68
|
+
case 409:
|
|
69
|
+
return HANDOFF_REFUSALS.HANDOFF_UNAVAILABLE;
|
|
70
|
+
case 429:
|
|
71
|
+
return HANDOFF_REFUSALS.RATE_LIMITED;
|
|
72
|
+
default:
|
|
73
|
+
return HANDOFF_REFUSALS.FAILED;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** The tool's description: when to offer, and that the code and link are never the model's. */
|
|
77
|
+
export const CALL_HANDOFF_DESCRIPTION = 'Moves this live call to the caller’s phone: a QR code appears on their screen, they scan it with their phone’s camera, ' +
|
|
78
|
+
'and the same conversation carries on there while this device pauses. ' +
|
|
79
|
+
'Offer it when photos need a rear camera this device lacks, or when the caller would be better off on their phone, and call it once they agree. ' +
|
|
80
|
+
'You never get the code or the link, and you never read one out: tell them to scan the code on their screen. ' +
|
|
81
|
+
'A code works once, for 10 minutes; call this again only when they ask for a new one or it has expired.';
|
|
82
|
+
/**
|
|
83
|
+
* Builds the turn's hand-off tool, bound to its control route and token: none
|
|
84
|
+
* unless the turn has a route (`canHandoff`).
|
|
85
|
+
*/
|
|
86
|
+
export function handoffTool(handoff, options = {}) {
|
|
87
|
+
if (!canHandoff(handoff))
|
|
88
|
+
return [];
|
|
89
|
+
const send = options.fetch ?? fetch;
|
|
90
|
+
const control = handoff.control;
|
|
91
|
+
const offer = {
|
|
92
|
+
name: CALL_HANDOFF_TOOL,
|
|
93
|
+
toolClass: HANDOFF_TOOL_CLASS,
|
|
94
|
+
kind: 'backend',
|
|
95
|
+
effect: 'mutate',
|
|
96
|
+
description: CALL_HANDOFF_DESCRIPTION,
|
|
97
|
+
inputSchema: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
properties: {
|
|
100
|
+
purpose: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
enum: [...CALL_HANDOFF_PURPOSES],
|
|
103
|
+
description: "Why the call moves: 'photos' when a photo capture needs a phone's rear camera; 'caller_asked' when the caller asked to continue on their phone; 'other' otherwise.",
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
required: ['purpose'],
|
|
107
|
+
additionalProperties: false,
|
|
108
|
+
},
|
|
109
|
+
execute: async (input, ctx) => {
|
|
110
|
+
const purpose = input.purpose;
|
|
111
|
+
if (typeof purpose !== 'string' || !CALL_HANDOFF_PURPOSES.includes(purpose)) {
|
|
112
|
+
return fail(`"purpose" is one of ${CALL_HANDOFF_PURPOSES.map((p) => `"${p}"`).join(', ')}.`);
|
|
113
|
+
}
|
|
114
|
+
if (Date.parse(control.expiresAt) <= Date.now())
|
|
115
|
+
return fail(HANDOFF_REFUSALS.NOT_ALLOWED);
|
|
116
|
+
const timeout = AbortSignal.timeout(HANDOFF_TOOL_LIMITS.timeoutMs);
|
|
117
|
+
const signal = ctx.abortSignal ? AbortSignal.any([ctx.abortSignal, timeout]) : timeout;
|
|
118
|
+
let res;
|
|
119
|
+
try {
|
|
120
|
+
res = await send(control.url, {
|
|
121
|
+
method: 'POST',
|
|
122
|
+
headers: { authorization: `Bearer ${control.token}`, accept: 'application/json', 'content-type': 'application/json' },
|
|
123
|
+
body: JSON.stringify({ purpose: purpose }),
|
|
124
|
+
signal,
|
|
125
|
+
redirect: 'error',
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
// The turn's stop is said by the orchestrator; a timeout or a lost connection is said here.
|
|
130
|
+
if (ctx.abortSignal?.aborted)
|
|
131
|
+
throw err;
|
|
132
|
+
return fail(HANDOFF_REFUSALS.FAILED);
|
|
133
|
+
}
|
|
134
|
+
// A body that is not JSON reads as no answer: a failure, or a refusal known only by its status.
|
|
135
|
+
const parsed = await res.json().catch(() => null);
|
|
136
|
+
if (!res.ok)
|
|
137
|
+
return fail(refusalLine(readRefusal(res.status, parsed)));
|
|
138
|
+
const answer = readAnswer(parsed);
|
|
139
|
+
if (!answer)
|
|
140
|
+
return fail(HANDOFF_REFUSALS.FAILED);
|
|
141
|
+
return { success: true, data: { handoffId: answer.handoffId, status: answer.status, words: answer.words } };
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
return [offer];
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=handoff-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff-tool.js","sourceRoot":"","sources":["../../src/handoff/handoff-tool.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,UAAU,GAKX,MAAM,sBAAsB,CAAC;AAE9B,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAE5C,iCAAiC;AACjC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,kDAAkD;IAClD,UAAU,EAAE,KAAK;IACjB,mDAAmD;IACnD,cAAc,EAAE,GAAG;IACnB,+FAA+F;IAC/F,SAAS,EAAE,MAAM;CACT,CAAC;AAeX,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,iCAAiC,mBAAmB,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,CAAC;AAE3G,MAAM,IAAI,GAAG,CAAC,KAAa,EAAuB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAEjF,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC;AAED,qDAAqD;AACrD,SAAS,OAAO,CA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|
package/dist/index.d.ts
CHANGED
|
@@ -85,16 +85,19 @@ export { startContainerAgentWorker, DEFAULT_LIVE_CALL_PATH } from './container/s
|
|
|
85
85
|
export type { ContainerAgentConfig, ContainerAgentWorker, ContainerLiveCallRoute } from './container/server.js';
|
|
86
86
|
export { createLiveCallTurnHandler, liveCallTurnMessage, LIVE_CALL_SPEECH, LIVE_CALL_CHANNEL, LIVE_CALL_APPROVAL_CHANNELS, LIVE_CALL_MAX_BODY_BYTES, } from './live-call/handler.js';
|
|
87
87
|
export type { LiveCallSpeech, LiveCallApprovalChannel, LiveCallTurnHandler, LiveCallTurnHandlerConfig, LiveCallTurnOptions, LiveCallTurnTarget, LiveCallTurnCallContext, LiveCallTurnMessageSource, } from './live-call/handler.js';
|
|
88
|
-
export { readLiveCallTurnRequest, liveCallError, LIVE_CALL_TURN_KINDS, LIVE_CALL_OPENING_MESSAGE, LIVE_CALL_GLANCE_MESSAGE, liveCallCaptureMessage, liveCallOpeningMessage, LIVE_CALL_TYPED_INPUT_MODE, LIVE_CALL_LIMITS, LIVE_CALL_ERROR_MESSAGES, } from './live-call/protocol.js';
|
|
88
|
+
export { readLiveCallTurnRequest, liveCallError, LIVE_CALL_TURN_KINDS, LIVE_CALL_OPENING_MESSAGE, LIVE_CALL_GLANCE_MESSAGE, liveCallCaptureMessage, liveCallDeviceMessage, liveCallOpeningMessage, LIVE_CALL_TYPED_INPUT_MODE, LIVE_CALL_LIMITS, LIVE_CALL_ERROR_MESSAGES, } from './live-call/protocol.js';
|
|
89
89
|
export type { LiveCallTurnKind, LiveCallTurnRequest, LiveCallStreamEvents, LiveCallStreamEventName, LiveCallRequestReading, LiveCallClient, LiveCallClientUi, } from './live-call/protocol.js';
|
|
90
90
|
export { DEFAULT_KEEP_ALIVE_MS as LIVE_CALL_KEEP_ALIVE_MS } from './live-call/event-stream.js';
|
|
91
91
|
export { readTurnVision, visionText, visionFacts, VISION_ABSENCES, VISION_LIMITS, LOOK_WHEN } from './prompt/vision.js';
|
|
92
92
|
export type { TurnVision, VisionLook, VisionAbsence } from './prompt/vision.js';
|
|
93
93
|
export { lookTool, LOOK_TOOL, LOOK_LIMITS, LOOK_ABSENCES, VISION_TOOL_CLASS } from './vision/look-tool.js';
|
|
94
94
|
export type { LookAbsence } from './vision/look-tool.js';
|
|
95
|
-
export { readTurnCapture, captureText, captureFacts, canCapture, CAPTURE_LIMITS, CAPTURE_WHEN, CAPTURE_NEVER, CAPTURE_STATUSES, CAPTURE_OUTCOMES, CAPTURE_END_REASONS, CAPTURE_BRAIN_UPDATE_KINDS, CAPTURE_UPDATE_TEXT_MAX, } from './prompt/capture.js';
|
|
96
|
-
export type { TurnCapture, CapturePlanOffer, CaptureControl, CaptureActive, CaptureActiveStep, CaptureStatus, CaptureOutcome, CaptureEndReason, CaptureBrainUpdateKind, } from './prompt/capture.js';
|
|
95
|
+
export { readTurnCapture, captureText, captureFacts, canCapture, CAPTURE_LIMITS, CAPTURE_WHEN, CAPTURE_NEVER, CAPTURE_STATUSES, CAPTURE_OUTCOMES, CAPTURE_END_REASONS, CAPTURE_BRAIN_UPDATE_KINDS, CAPTURE_UPDATE_TEXT_MAX, CAPTURE_BLOCKED_REASONS, } from './prompt/capture.js';
|
|
96
|
+
export type { TurnCapture, CapturePlanOffer, CaptureControl, CaptureActive, CaptureActiveStep, CaptureStatus, CaptureOutcome, CaptureEndReason, CaptureBrainUpdateKind, CaptureBlockedReason, } from './prompt/capture.js';
|
|
97
97
|
export { captureTools, CAPTURE_START_TOOL, CAPTURE_STATUS_TOOL, CAPTURE_STOP_TOOL, CAPTURE_TOOLS, CAPTURE_TOOL_CLASS, CAPTURE_TOOL_LIMITS, } from './capture/capture-tools.js';
|
|
98
|
+
export { readTurnHandoff, handoffText, handoffFacts, canHandoff, HANDOFF_LIMITS, HANDOFF_WHEN, HANDOFF_NEVER, HANDOFF_CODE_TTL_S, CALL_HANDOFF_PURPOSES, CALL_HANDOFF_STATUSES, CALL_FORM_FACTORS, CALL_DEVICE_UPDATE_KINDS, DEVICE_UPDATE_TEXT_MAX, FORM_FACTOR_WORDS, } from './prompt/handoff.js';
|
|
99
|
+
export type { TurnHandoff, HandoffControl, HandoffDevice, HandoffOffer, CallHandoffPurpose, CallHandoffStatus, CallFormFactor, CallDeviceUpdateKind, } from './prompt/handoff.js';
|
|
100
|
+
export { handoffTool, CALL_HANDOFF_TOOL, CALL_HANDOFF_DESCRIPTION, HANDOFF_TOOL_CLASS, HANDOFF_TOOL_LIMITS, HANDOFF_REFUSALS, } from './handoff/handoff-tool.js';
|
|
98
101
|
export { buildAgentSystemPrompt } from './prompt/index.js';
|
|
99
102
|
export type { AgentPersonaConfig, AgentKnowledgeEntry, AgentWorkflow, AgentFewShotExample, AgentPersonaOverrides, PromptBuildContext, CommunicationStyle, CommunicationFormat, CommunicationStyleOptions, CommunicationStyleSetting, ResolvedCommunicationStyle, } from './prompt/index.js';
|
|
100
103
|
export { getBaseRules, getCommunicationRules, resolveCommunicationStyle, COMMUNICATION_STYLES, COMMUNICATION_FORMATS, getToolStrategyRules, getUIControlRules, } from './prompt/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACxJ,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,eAAe,EAA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B,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -67,14 +67,17 @@ export { startContainerAgentWorker, DEFAULT_LIVE_CALL_PATH } from './container/s
|
|
|
67
67
|
// Live calls: the call service's turns, answered by the product's own agent as
|
|
68
68
|
// a server-sent event stream, while the turn streams to its room as any turn does.
|
|
69
69
|
export { createLiveCallTurnHandler, liveCallTurnMessage, LIVE_CALL_SPEECH, LIVE_CALL_CHANNEL, LIVE_CALL_APPROVAL_CHANNELS, LIVE_CALL_MAX_BODY_BYTES, } from './live-call/handler.js';
|
|
70
|
-
export { readLiveCallTurnRequest, liveCallError, LIVE_CALL_TURN_KINDS, LIVE_CALL_OPENING_MESSAGE, LIVE_CALL_GLANCE_MESSAGE, liveCallCaptureMessage, liveCallOpeningMessage, LIVE_CALL_TYPED_INPUT_MODE, LIVE_CALL_LIMITS, LIVE_CALL_ERROR_MESSAGES, } from './live-call/protocol.js';
|
|
70
|
+
export { readLiveCallTurnRequest, liveCallError, LIVE_CALL_TURN_KINDS, LIVE_CALL_OPENING_MESSAGE, LIVE_CALL_GLANCE_MESSAGE, liveCallCaptureMessage, liveCallDeviceMessage, liveCallOpeningMessage, LIVE_CALL_TYPED_INPUT_MODE, LIVE_CALL_LIMITS, LIVE_CALL_ERROR_MESSAGES, } from './live-call/protocol.js';
|
|
71
71
|
export { DEFAULT_KEEP_ALIVE_MS as LIVE_CALL_KEEP_ALIVE_MS } from './live-call/event-stream.js';
|
|
72
72
|
// Whether the model may look at the person's camera on a turn: read, and told to the model; and the look itself.
|
|
73
73
|
export { readTurnVision, visionText, visionFacts, VISION_ABSENCES, VISION_LIMITS, LOOK_WHEN } from './prompt/vision.js';
|
|
74
74
|
export { lookTool, LOOK_TOOL, LOOK_LIMITS, LOOK_ABSENCES, VISION_TOOL_CLASS } from './vision/look-tool.js';
|
|
75
75
|
// A client's photo captures on a call: read, told to the model, and the tools that start, read and stop them.
|
|
76
|
-
export { readTurnCapture, captureText, captureFacts, canCapture, CAPTURE_LIMITS, CAPTURE_WHEN, CAPTURE_NEVER, CAPTURE_STATUSES, CAPTURE_OUTCOMES, CAPTURE_END_REASONS, CAPTURE_BRAIN_UPDATE_KINDS, CAPTURE_UPDATE_TEXT_MAX, } from './prompt/capture.js';
|
|
76
|
+
export { readTurnCapture, captureText, captureFacts, canCapture, CAPTURE_LIMITS, CAPTURE_WHEN, CAPTURE_NEVER, CAPTURE_STATUSES, CAPTURE_OUTCOMES, CAPTURE_END_REASONS, CAPTURE_BRAIN_UPDATE_KINDS, CAPTURE_UPDATE_TEXT_MAX, CAPTURE_BLOCKED_REASONS, } from './prompt/capture.js';
|
|
77
77
|
export { captureTools, CAPTURE_START_TOOL, CAPTURE_STATUS_TOOL, CAPTURE_STOP_TOOL, CAPTURE_TOOLS, CAPTURE_TOOL_CLASS, CAPTURE_TOOL_LIMITS, } from './capture/capture-tools.js';
|
|
78
|
+
// The call moving between the caller's devices: read, told to the model, and the tool that offers the move.
|
|
79
|
+
export { readTurnHandoff, handoffText, handoffFacts, canHandoff, HANDOFF_LIMITS, HANDOFF_WHEN, HANDOFF_NEVER, HANDOFF_CODE_TTL_S, CALL_HANDOFF_PURPOSES, CALL_HANDOFF_STATUSES, CALL_FORM_FACTORS, CALL_DEVICE_UPDATE_KINDS, DEVICE_UPDATE_TEXT_MAX, FORM_FACTOR_WORDS, } from './prompt/handoff.js';
|
|
80
|
+
export { handoffTool, CALL_HANDOFF_TOOL, CALL_HANDOFF_DESCRIPTION, HANDOFF_TOOL_CLASS, HANDOFF_TOOL_LIMITS, HANDOFF_REFUSALS, } from './handoff/handoff-tool.js';
|
|
78
81
|
// Prompt Framework
|
|
79
82
|
export { buildAgentSystemPrompt } from './prompt/index.js';
|
|
80
83
|
export { getBaseRules, getCommunicationRules, resolveCommunicationStyle, COMMUNICATION_STYLES, COMMUNICATION_FORMATS, getToolStrategyRules, getUIControlRules, } from './prompt/index.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,oDAAoD;AACpD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,oEAAoE;AACpE,iEAAiE;AACjE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,o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H,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE3G,8GAA8G;AAC9G,OAAO,EACL,eAAe,EACf,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAa7B,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,4GAA4G;AAC5G,OAAO,EACL,eAAe,EACf,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAW7B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAEnC,mBAAmB;AACnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAc3D,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { type AgentTurnRunner, type TurnOutcome } from '../runtime/turn-runner.j
|
|
|
4
4
|
import { type TurnSlots } from '../runtime/turn-slots.js';
|
|
5
5
|
import { type LiveCallTurnRequest } from './protocol.js';
|
|
6
6
|
import { type TurnCapture } from '../prompt/capture.js';
|
|
7
|
+
import { type TurnHandoff } from '../prompt/handoff.js';
|
|
7
8
|
/** Who and where a live-call turn is, in the product: what the host resolves a call's `clientRef` to. */
|
|
8
9
|
export interface LiveCallTurnTarget {
|
|
9
10
|
/** The product's conversation: the call is one more way to reach it. */
|
|
@@ -174,16 +175,22 @@ export declare function createLiveCallTurnHandler(config: LiveCallTurnHandlerCon
|
|
|
174
175
|
export declare function liveCallRoute(options: LiveCallTurnOptions, host: LiveCallRouteHost): (req: IncomingMessage, res: ServerResponse) => void;
|
|
175
176
|
/** What of a request its turn's message is made from. */
|
|
176
177
|
export type LiveCallTurnMessageSource = Pick<LiveCallTurnRequest, 'kind' | 'text' | 'disclosureLine'> & {
|
|
177
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* On a `capture` turn, its `client.capture.update` is the message. On a
|
|
180
|
+
* `device` turn, its `client.handoff.update` is, followed by a
|
|
181
|
+
* `client.capture.update` that arrived with it.
|
|
182
|
+
*/
|
|
178
183
|
client?: {
|
|
179
184
|
capture?: Pick<TurnCapture, 'update'> | null;
|
|
185
|
+
handoff?: Pick<TurnHandoff, 'update'> | null;
|
|
180
186
|
} | null;
|
|
181
187
|
};
|
|
182
188
|
/**
|
|
183
189
|
* What the model reads as the person's message, unless the host's target
|
|
184
|
-
* gives its own `content`: what they said, or for an `opening`, a `glance
|
|
185
|
-
* a `
|
|
186
|
-
* happened, `liveCallCaptureMessage(update)
|
|
190
|
+
* gives its own `content`: what they said, or for an `opening`, a `glance`, a
|
|
191
|
+
* `capture` and a `device` turn the instruction that stands in for it (a
|
|
192
|
+
* capture's carries what happened, `liveCallCaptureMessage(update)`; a device
|
|
193
|
+
* turn's, `liveCallDeviceMessage(update)`). A host that stores the person's
|
|
187
194
|
* messages stores the same, so its history has a readable row for each turn.
|
|
188
195
|
*/
|
|
189
196
|
export declare function liveCallTurnMessage(request: LiveCallTurnMessageSource): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/live-call/handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/live-call/handler.ts"],"names":[],"mappings":"AAgFA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAKL,KAAK,oBAAoB,EAE1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAkB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAInG,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAI3E,OAAO,EAQL,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEtE,yGAAyG;AACzG,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,cAAc,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,kHAAkH;IAClH,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACnC;AAED,qEAAqE;AACrE,eAAO,MAAM,2BAA2B,6BAAmE,CAAC;AAE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,CAAC,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CAChH,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CAE9E;AA4BD,sFAAsF;AACtF,eAAO,MAAM,iBAAiB,cAAc,CAAC"}
|
|
@@ -50,6 +50,17 @@
|
|
|
50
50
|
* words would be, and says it in a short line or stays silent. The log line
|
|
51
51
|
* records facts only: never the capture token or the update's words.
|
|
52
52
|
*
|
|
53
|
+
* The character can move the call to the caller's phone when the session
|
|
54
|
+
* allows it: the call service carries `client.handoff` on every
|
|
55
|
+
* turn, and the handler sets it as the turn's `handoff`. With a control
|
|
56
|
+
* route, the model has `call_handoff` (handoff/handoff-tool.ts), and is told
|
|
57
|
+
* when to offer it (prompt/handoff.ts). A `device` turn passes on what
|
|
58
|
+
* happened to the caller's devices: the model reads
|
|
59
|
+
* `liveCallDeviceMessage(update)` where the person's words would be (with
|
|
60
|
+
* `liveCallCaptureMessage` after it when a capture update arrived with it),
|
|
61
|
+
* and answers in one short sentence or stays silent. The log line records
|
|
62
|
+
* facts only: never the hand-off token or the update's words.
|
|
63
|
+
*
|
|
53
64
|
* A call is a voice: an approval is read back (the host's `spokenReadback`
|
|
54
65
|
* when it wrote one) and the person's next words confirm it, as on any voice
|
|
55
66
|
* channel. A UI action's too: its card is also on the person's
|
|
@@ -74,9 +85,10 @@ import { CLIENT_KNOWLEDGE_KEY } from '../ui/knowledge.js';
|
|
|
74
85
|
import { USER_INPUT_TOOLS } from '../orchestrator.js';
|
|
75
86
|
import { createTurnSlots } from '../runtime/turn-slots.js';
|
|
76
87
|
import { DEFAULT_KEEP_ALIVE_MS, openLiveCallEventStream } from './event-stream.js';
|
|
77
|
-
import { LIVE_CALL_GLANCE_MESSAGE, liveCallCaptureMessage, liveCallError, liveCallOpeningMessage, readLiveCallTurnRequest, } from './protocol.js';
|
|
88
|
+
import { LIVE_CALL_GLANCE_MESSAGE, liveCallCaptureMessage, liveCallDeviceMessage, liveCallError, liveCallOpeningMessage, readLiveCallTurnRequest, } from './protocol.js';
|
|
78
89
|
import { visionFacts } from '../prompt/vision.js';
|
|
79
90
|
import { captureFacts } from '../prompt/capture.js';
|
|
91
|
+
import { handoffFacts } from '../prompt/handoff.js';
|
|
80
92
|
/** The approval channels a live call can be: it is always spoken. */
|
|
81
93
|
export const LIVE_CALL_APPROVAL_CHANNELS = ['voice', 'phone'];
|
|
82
94
|
/** What of a live-call turn's reply is spoken (`LiveCallTurnOptions.speak`). */
|
|
@@ -255,6 +267,8 @@ export function liveCallRoute(options, host) {
|
|
|
255
267
|
...(request.client?.vision ? { vision: visionFacts(request.client.vision) } : {}),
|
|
256
268
|
// Facts only: how many plans, whether it can start, where a capture stands. Never the token or the update's words.
|
|
257
269
|
...(request.client?.capture ? { capture: captureFacts(request.client.capture) } : {}),
|
|
270
|
+
// Facts only: whether it can offer, the live device, an open offer. Never the token or the update's words.
|
|
271
|
+
...(request.client?.handoff ? { handoff: handoffFacts(request.client.handoff) } : {}),
|
|
258
272
|
});
|
|
259
273
|
let outcome;
|
|
260
274
|
try {
|
|
@@ -321,7 +335,7 @@ function turnPayload(request, target) {
|
|
|
321
335
|
userId: target.userId,
|
|
322
336
|
accountId: target.accountId,
|
|
323
337
|
socketRoom: target.socketRoom,
|
|
324
|
-
// An opening's, a glance's or a
|
|
338
|
+
// An opening's, a glance's, a capture's or a device turn's blank content is no redaction: the model reads the instruction that stands for it.
|
|
325
339
|
content: request.kind !== 'message' && !(typeof target.content === 'string' && target.content.trim())
|
|
326
340
|
? turnMessage(request)
|
|
327
341
|
: (target.content ?? turnMessage(request)),
|
|
@@ -333,17 +347,22 @@ function turnPayload(request, target) {
|
|
|
333
347
|
...(request.supersedes.length > 0 ? { supersedes: request.supersedes } : {}),
|
|
334
348
|
// What the caller's camera shows, for this turn only.
|
|
335
349
|
...(request.client?.vision ? { vision: request.client.vision } : {}),
|
|
336
|
-
// The session's photo captures. A capture turn's update is its message, so it is not said twice.
|
|
350
|
+
// The session's photo captures. A capture or device turn's update is its message, so it is not said twice.
|
|
337
351
|
...(request.client?.capture
|
|
338
|
-
? { capture: request.kind === 'capture' ? { ...request.client.capture, update: null } : request.client.capture }
|
|
352
|
+
? { capture: request.kind === 'capture' || request.kind === 'device' ? { ...request.client.capture, update: null } : request.client.capture }
|
|
353
|
+
: {}),
|
|
354
|
+
// The call's devices. A device turn's update is its message, so it is not said twice.
|
|
355
|
+
...(request.client?.handoff
|
|
356
|
+
? { handoff: request.kind === 'device' ? { ...request.client.handoff, update: null } : request.client.handoff }
|
|
339
357
|
: {}),
|
|
340
358
|
};
|
|
341
359
|
}
|
|
342
360
|
/**
|
|
343
361
|
* What the model reads as the person's message, unless the host's target
|
|
344
|
-
* gives its own `content`: what they said, or for an `opening`, a `glance
|
|
345
|
-
* a `
|
|
346
|
-
* happened, `liveCallCaptureMessage(update)
|
|
362
|
+
* gives its own `content`: what they said, or for an `opening`, a `glance`, a
|
|
363
|
+
* `capture` and a `device` turn the instruction that stands in for it (a
|
|
364
|
+
* capture's carries what happened, `liveCallCaptureMessage(update)`; a device
|
|
365
|
+
* turn's, `liveCallDeviceMessage(update)`). A host that stores the person's
|
|
347
366
|
* messages stores the same, so its history has a readable row for each turn.
|
|
348
367
|
*/
|
|
349
368
|
export function liveCallTurnMessage(request) {
|
|
@@ -361,6 +380,14 @@ function turnMessage(request) {
|
|
|
361
380
|
throw new Error('[agent-sdk] A capture turn’s message needs its client.capture.update');
|
|
362
381
|
return liveCallCaptureMessage(update);
|
|
363
382
|
}
|
|
383
|
+
case 'device': {
|
|
384
|
+
const update = request.client?.handoff?.update;
|
|
385
|
+
if (typeof update !== 'string' || !update.trim())
|
|
386
|
+
throw new Error('[agent-sdk] A device turn’s message needs its client.handoff.update');
|
|
387
|
+
// Device and capture updates that arrived together are one turn: both are its message.
|
|
388
|
+
const capture = request.client?.capture?.update;
|
|
389
|
+
return typeof capture === 'string' && capture.trim() ? `${liveCallDeviceMessage(update)} ${liveCallCaptureMessage(capture)}` : liveCallDeviceMessage(update);
|
|
390
|
+
}
|
|
364
391
|
default:
|
|
365
392
|
return request.text;
|
|
366
393
|
}
|