@ouispec/agent-worker 0.31.0 → 0.32.2

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 (45) hide show
  1. package/README.md +32 -6
  2. package/dist/authz/tool-policy.d.ts +2 -1
  3. package/dist/authz/tool-policy.d.ts.map +1 -1
  4. package/dist/authz/tool-policy.js.map +1 -1
  5. package/dist/capture/capture-tools.d.ts.map +1 -1
  6. package/dist/capture/capture-tools.js +7 -2
  7. package/dist/capture/capture-tools.js.map +1 -1
  8. package/dist/handoff/handoff-tool.d.ts +51 -0
  9. package/dist/handoff/handoff-tool.d.ts.map +1 -0
  10. package/dist/handoff/handoff-tool.js +146 -0
  11. package/dist/handoff/handoff-tool.js.map +1 -0
  12. package/dist/index.d.ts +6 -3
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +5 -2
  15. package/dist/index.js.map +1 -1
  16. package/dist/live-call/handler.d.ts +11 -4
  17. package/dist/live-call/handler.d.ts.map +1 -1
  18. package/dist/live-call/handler.js +34 -7
  19. package/dist/live-call/handler.js.map +1 -1
  20. package/dist/live-call/protocol.d.ts +52 -6
  21. package/dist/live-call/protocol.d.ts.map +1 -1
  22. package/dist/live-call/protocol.js +55 -7
  23. package/dist/live-call/protocol.js.map +1 -1
  24. package/dist/orchestrator.d.ts.map +1 -1
  25. package/dist/orchestrator.js +9 -1
  26. package/dist/orchestrator.js.map +1 -1
  27. package/dist/prompt/capture.d.ts +67 -1
  28. package/dist/prompt/capture.d.ts.map +1 -1
  29. package/dist/prompt/capture.js +115 -4
  30. package/dist/prompt/capture.js.map +1 -1
  31. package/dist/prompt/handoff.d.ts +140 -0
  32. package/dist/prompt/handoff.d.ts.map +1 -0
  33. package/dist/prompt/handoff.js +218 -0
  34. package/dist/prompt/handoff.js.map +1 -0
  35. package/dist/runtime/turn-runner.d.ts.map +1 -1
  36. package/dist/runtime/turn-runner.js +13 -0
  37. package/dist/runtime/turn-runner.js.map +1 -1
  38. package/dist/runtime/types.d.ts +10 -0
  39. package/dist/runtime/types.d.ts.map +1 -1
  40. package/dist/tools/types.d.ts +5 -4
  41. package/dist/tools/types.d.ts.map +1 -1
  42. package/dist/tools/types.js.map +1 -1
  43. package/dist/types.d.ts +9 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/package.json +2 -2
@@ -14,7 +14,12 @@
14
14
  * { plans: [{ key, title, offerWhen }],
15
15
  * control: { url, token, expiresAt },
16
16
  * active: { captureId, plan, status, step: { id, label, index, of } | null } | null,
17
- * update: '<words>' | null }
17
+ * update: '<words>' | null,
18
+ * resumable: [{ captureId, planKey, outcome, endedAt, missingSteps }] }
19
+ *
20
+ * `resumable` is the caller's earlier captures of the session's plans that
21
+ * ended without completing and can be continued: `capture_start` with the plan
22
+ * and `resumeCaptureId` asks only for the photos each is missing.
18
23
  *
19
24
  * - **What is read:** `readTurnCapture` checks every field, as strictly as
20
25
  * `client.vision`; a refusal names the field and never repeats the token.
@@ -55,6 +60,16 @@ export const CAPTURE_END_REASONS = [
55
60
  'agent_unavailable',
56
61
  'verifier_unavailable',
57
62
  ];
63
+ /**
64
+ * How an earlier capture that can be continued ended: every outcome but
65
+ * `completed` (nothing is missing) and `declined` (a decline is never offered
66
+ * back). Closure lists a capture as resumable only with one of these.
67
+ */
68
+ export const CAPTURE_RESUMABLE_OUTCOMES = ['partial', 'camera_unavailable', 'abandoned', 'failed'];
69
+ /** The most resumable captures Closure lists for a session: the newest, at most this many. */
70
+ export const CAPTURE_RESUMABLE_MAX = 5;
71
+ /** Why a capture is `blocked` (Closure's capture contract). */
72
+ export const CAPTURE_BLOCKED_REASONS = ['camera_denied', 'no_rear_camera'];
58
73
  /**
59
74
  * What a brain update reports. The call service passes updates on as words
60
75
  * (`client.capture.update`); the kinds are what those words can be about.
@@ -97,6 +112,13 @@ export const CAPTURE_LIMITS = {
97
112
  * joined in order, each at most `CAPTURE_UPDATE_TEXT_MAX` (600) characters.
98
113
  */
99
114
  updateChars: 8_000,
115
+ /**
116
+ * The most `resumable` entries a turn may carry. Closure lists at most
117
+ * `CAPTURE_RESUMABLE_MAX` (5); the bound leaves it room to list more.
118
+ */
119
+ resumable: 20,
120
+ /** The most `missingSteps` an entry may name. */
121
+ missingSteps: 50,
100
122
  };
101
123
  /** A plan's key. */
102
124
  const PLAN_KEY = /^[a-z0-9][a-z0-9-]{0,63}$/;
@@ -161,13 +183,65 @@ export function readTurnCapture(value, field = 'capture') {
161
183
  return `${field}.update must be a string or null`;
162
184
  if (typeof update === 'string' && update.length > CAPTURE_LIMITS.updateChars)
163
185
  return `${field}.update is longer than ${CAPTURE_LIMITS.updateChars} characters`;
186
+ const resumable = readResumable(value.resumable, `${field}.resumable`, plans);
187
+ if (typeof resumable === 'string')
188
+ return resumable;
164
189
  return {
165
190
  plans,
166
191
  control: control ? { ...control, url: control.url.replace(/\/+$/, '') } : null,
167
192
  active,
168
193
  update: typeof update === 'string' && update.trim() ? update.trim() : null,
194
+ resumable,
169
195
  };
170
196
  }
197
+ /** An ISO 8601 date and time, with a zone. */
198
+ const ISO_DATE_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z|[+-]\d{2}:?\d{2})$/;
199
+ /**
200
+ * The turn's resumable captures, or why they are not, naming the entry. A
201
+ * malformed entry is refused. An entry that names a plan the session does not
202
+ * offer, or misses no step, could never be continued from this call, so it is
203
+ * left out rather than failing the turn; each capture is kept once.
204
+ */
205
+ function readResumable(value, field, plans) {
206
+ if (value === undefined || value === null)
207
+ return [];
208
+ if (!Array.isArray(value))
209
+ return `${field} must be a list`;
210
+ if (value.length > CAPTURE_LIMITS.resumable)
211
+ return `${field} lists more than ${CAPTURE_LIMITS.resumable} captures`;
212
+ const offered = new Set(plans.map((p) => p.key));
213
+ const listed = [];
214
+ for (const [i, raw] of value.entries()) {
215
+ const at = `${field}[${i}]`;
216
+ if (!isPlainObject(raw))
217
+ return `${at} must be an object`;
218
+ if (typeof raw.captureId !== 'string' || !CAPTURE_ID.test(raw.captureId))
219
+ return `${at}.captureId must be a capture id`;
220
+ if (typeof raw.planKey !== 'string' || !PLAN_KEY.test(raw.planKey))
221
+ return `${at}.planKey must be a plan key`;
222
+ if (!CAPTURE_RESUMABLE_OUTCOMES.includes(raw.outcome)) {
223
+ return `${at}.outcome must be one of ${CAPTURE_RESUMABLE_OUTCOMES.join(', ')}`;
224
+ }
225
+ const endedAt = raw.endedAt ?? null;
226
+ if (endedAt !== null && !(typeof endedAt === 'string' && endedAt.length <= CAPTURE_LIMITS.expiresAtChars && ISO_DATE_TIME.test(endedAt) && Number.isFinite(Date.parse(endedAt)))) {
227
+ return `${at}.endedAt must be an ISO 8601 date and time or null`;
228
+ }
229
+ const missing = raw.missingSteps ?? [];
230
+ if (!Array.isArray(missing) || missing.length > CAPTURE_LIMITS.missingSteps || !missing.every((id) => typeof id === 'string' && STEP_ID.test(id))) {
231
+ return `${at}.missingSteps must be a list of at most ${CAPTURE_LIMITS.missingSteps} step ids`;
232
+ }
233
+ if (!offered.has(raw.planKey) || missing.length === 0 || listed.some((r) => r.captureId === raw.captureId))
234
+ continue;
235
+ listed.push({
236
+ captureId: raw.captureId,
237
+ planKey: raw.planKey,
238
+ outcome: raw.outcome,
239
+ endedAt: endedAt,
240
+ missingSteps: [...new Set(missing)],
241
+ });
242
+ }
243
+ return listed;
244
+ }
171
245
  function readActive(value, field) {
172
246
  if (value === undefined || value === null)
173
247
  return null;
@@ -196,7 +270,17 @@ function readActive(value, field) {
196
270
  return `${field}.step.index must be a whole number from 1 to step.of`;
197
271
  step = { id: raw.id, label, index, of };
198
272
  }
199
- return { captureId: value.captureId, plan: value.plan, status: value.status, step };
273
+ const blockedReason = value.blockedReason;
274
+ if (blockedReason !== undefined && blockedReason !== null && !CAPTURE_BLOCKED_REASONS.includes(blockedReason)) {
275
+ return `${field}.blockedReason must be one of ${CAPTURE_BLOCKED_REASONS.join(', ')}`;
276
+ }
277
+ return {
278
+ captureId: value.captureId,
279
+ plan: value.plan,
280
+ status: value.status,
281
+ step,
282
+ ...(typeof blockedReason === 'string' && value.status === 'blocked' ? { blockedReason: blockedReason } : {}),
283
+ };
200
284
  }
201
285
  /** Whether the turn can start, read and stop captures: there are plans, and a route to call. */
202
286
  export function canCapture(capture) {
@@ -211,6 +295,24 @@ export const CAPTURE_WHEN = 'You can ask the caller for photos with `capture_sta
211
295
  'Closure’s checker accepts or rejects every photo; you never judge a photo, and you never use `look` for one. ' +
212
296
  'While a capture runs you receive capture updates: turn each into one or two short, natural sentences in the caller’s language, and never read out a code. ' +
213
297
  'When a capture ends without completing, offer what its update says to offer.';
298
+ /**
299
+ * The sentence every brain that takes captures is given when the caller has
300
+ * an earlier capture to continue, word for word: Closure's brain in its
301
+ * spoken-reply contract, and a client's brain here. The captures themselves are
302
+ * listed in `capture_start`'s description.
303
+ */
304
+ export const CAPTURE_RESUME_WHEN = 'This caller has an earlier photo capture that was not completed (listed in `capture_start`). ' +
305
+ 'When photos fit, offer to finish it: call `capture_start` with its plan and its `resumeCaptureId`, so only the missing photos are asked for.';
306
+ /**
307
+ * The earlier captures that can be continued, as `capture_start`'s description
308
+ * lists them, one line each, as Closure's brain is shown them:
309
+ * `- {captureId} (plan {planKey}): {outcome}, ended {endedAt}; missing: {steps}`.
310
+ */
311
+ export function resumableLines(resumable) {
312
+ return resumable
313
+ .map((r) => `\n- ${r.captureId} (plan ${r.planKey}): ${r.outcome}${r.endedAt ? `, ended ${r.endedAt}` : ''}; missing: ${r.missingSteps.join(', ')}`)
314
+ .join('');
315
+ }
214
316
  /** What the model is told never to do with a capture's photos. */
215
317
  export const CAPTURE_NEVER = 'You never see the photos: never claim to see, describe or judge one, and say only what the capture’s words tell you.';
216
318
  /** How a running capture's status is said. */
@@ -218,10 +320,16 @@ const STATUS_WORDS = {
218
320
  starting: 'starting',
219
321
  awaiting_consent: 'waiting for the caller to agree on their screen',
220
322
  active: 'in progress',
323
+ // Before call hand-offs a capture was blocked for the camera permission alone.
221
324
  blocked: 'blocked: their browser has not allowed the camera',
222
325
  ending: 'finishing',
223
326
  ended: 'over',
224
327
  };
328
+ /** How a blocked capture's reason is said. */
329
+ const BLOCKED_WORDS = {
330
+ camera_denied: 'blocked: their browser has not allowed the camera',
331
+ no_rear_camera: 'blocked: this device has no rear camera for the next photo, so it waits for the call to move to their phone',
332
+ };
225
333
  /**
226
334
  * What the model is told about photo captures on this turn: one line, after
227
335
  * the conversation. With plans and a route, the clause (`CAPTURE_WHEN`), when
@@ -236,7 +344,9 @@ export function captureText(capture) {
236
344
  if (canCapture(capture)) {
237
345
  const plans = capture.plans.map((p) => `"${p.key}" (${escapeTagText(p.title)}): offer it when ${escapeTagText(p.offerWhen)}`);
238
346
  parts.push(CAPTURE_WHEN, 'Offer a plan only when its “offer it when” applies, and start it once the caller agrees to take the photos; ' +
239
- 'before you call `capture_start`, say one short line so they know a request for photos is coming to their screen.', CAPTURE_NEVER, `Plans: ${plans.join('; ')}.`);
347
+ 'before you call `capture_start`, say one short line so they know a request for photos is coming to their screen.', CAPTURE_NEVER, `Plans: ${plans.join('; ')}.`,
348
+ // An earlier capture to continue: offered when photos fit, so only what it is missing is asked.
349
+ ...(capture.resumable?.length ? [CAPTURE_RESUME_WHEN] : []));
240
350
  }
241
351
  else if (capture.plans.length > 0 || capture.active || capture.update) {
242
352
  parts.push('Photos cannot be started, checked or stopped from this turn. ' +
@@ -246,7 +356,7 @@ export function captureText(capture) {
246
356
  if (capture.active) {
247
357
  const a = capture.active;
248
358
  const step = a.step ? `, on step ${a.step.index} of ${a.step.of}, ${escapeTagText(a.step.label)}` : '';
249
- parts.push(`A photo capture is running now: plan "${a.plan}", capture ${a.captureId}, ${STATUS_WORDS[a.status]}${step}. ` +
359
+ parts.push(`A photo capture is running now: plan "${a.plan}", capture ${a.captureId}, ${a.blockedReason ? BLOCKED_WORDS[a.blockedReason] : STATUS_WORDS[a.status]}${step}. ` +
250
360
  (canCapture(capture) ? 'Use `capture_status` to ask where it stands; use `capture_stop` only when the caller wants to stop.' : ''));
251
361
  }
252
362
  else if (canCapture(capture)) {
@@ -271,6 +381,7 @@ export function captureFacts(capture) {
271
381
  ? { active: capture.active.status, ...(capture.active.step ? { step: `${capture.active.step.index}/${capture.active.step.of}` } : {}) }
272
382
  : {}),
273
383
  ...(capture.update ? { update: true } : {}),
384
+ ...(capture.resumable?.length ? { resumable: capture.resumable.length } : {}),
274
385
  };
275
386
  }
276
387
  //# sourceMappingURL=capture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capture.js","sourceRoot":"","sources":["../../src/prompt/capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,eAAe,EAAoB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,+EAA+E;AAC/E,mFAAmF;AACnF,+EAA+E;AAC/E,mEAAmE;AAEnE,0BAA0B;AAC1B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAGlH,2BAA2B;AAC3B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAC;AAG3H,2BAA2B;AAC3B,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;IACf,WAAW;IACX,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,mBAAmB;IACnB,sBAAsB;CACd,CAAC;AAGX;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,QAAQ;IACR,WAAW;IACX,UAAU;IACV,QAAQ;IACR,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AAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * What the character may know of a call moving between the caller's devices,
3
+ * as the turn sees it
4
+ *
5
+ * A caller on a laptop can carry the same call on to their phone: the brain
6
+ * offers it with `call_handoff`, a QR code appears on the laptop's screen,
7
+ * the phone opens the link, and the same conversation carries on there while
8
+ * the laptop pauses. The brain never sees a device, a screen or a code:
9
+ * everything it learns of a move is words.
10
+ *
11
+ * Each turn of a session that can move carries `client.handoff` (`handoff` on
12
+ * any turn payload):
13
+ *
14
+ * { control: { url, token, expiresAt },
15
+ * device: { formFactor: 'phone' | 'tablet' | 'desktop' | 'unknown', switches } | null,
16
+ * offer: { handoffId, purpose, expiresAt } | null,
17
+ * update: '<words>' | null }
18
+ *
19
+ * - **What is read:** `readTurnHandoff` checks every field, as strictly as
20
+ * `client.capture`; a refusal names the field and never repeats the token.
21
+ * Fields it does not know are read past.
22
+ * - **Where it goes:** the tool (handoff/handoff-tool.ts) while there is a
23
+ * control route, and one line in the turn's context, straight after the
24
+ * turn's message (`handoffText`): the clause, the device the call is on, an
25
+ * open offer, and an update that rode a message turn.
26
+ * - **What is never done with it:** the control token is never logged or
27
+ * emitted, and neither are the update's words. Logs record facts only
28
+ * (`handoffFacts`).
29
+ */
30
+ import { type BearerRoute } from './bearer-route.js';
31
+ /** Why the call moves (`CallHandoffPurpose`): the tool's `purpose`. */
32
+ export declare const CALL_HANDOFF_PURPOSES: readonly ["photos", "caller_asked", "other"];
33
+ export type CallHandoffPurpose = (typeof CALL_HANDOFF_PURPOSES)[number];
34
+ /** What kind of device the caller is on (`CallFormFactor`), as their LiveCall stated it. */
35
+ export declare const CALL_FORM_FACTORS: readonly ["phone", "tablet", "desktop", "unknown"];
36
+ export type CallFormFactor = (typeof CALL_FORM_FACTORS)[number];
37
+ /** A hand-off's status (`CallHandoff.status`). */
38
+ export declare const CALL_HANDOFF_STATUSES: readonly ["offered", "redeemed", "expired", "cancelled"];
39
+ export type CallHandoffStatus = (typeof CALL_HANDOFF_STATUSES)[number];
40
+ /**
41
+ * What a device update reports. The call service passes updates on as words
42
+ * (`client.handoff.update`); the kinds are what those words can be about.
43
+ */
44
+ export declare const CALL_DEVICE_UPDATE_KINDS: readonly ["offered", "switched", "brought_back", "revoked", "expired", "active_lost"];
45
+ export type CallDeviceUpdateKind = (typeof CALL_DEVICE_UPDATE_KINDS)[number];
46
+ /**
47
+ * The longest text of one device update: the contract's `device_update` frame
48
+ * and `device.update` message hold `text` to 600 characters. A turn's `update`
49
+ * joins the updates pending since the brain last heard.
50
+ */
51
+ export declare const DEVICE_UPDATE_TEXT_MAX = 600;
52
+ /** A code's life, in seconds (`HANDOFF_CODE_TTL_S`). */
53
+ export declare const HANDOFF_CODE_TTL_S = 600;
54
+ /** Limits on what a turn's hand-off may carry. */
55
+ export declare const HANDOFF_LIMITS: {
56
+ /** The longest `control.url`. */
57
+ readonly controlUrlChars: 2048;
58
+ /** The longest `control.token`. */
59
+ readonly controlTokenChars: 4096;
60
+ /** The longest `control.expiresAt` and `offer.expiresAt`. */
61
+ readonly expiresAtChars: 64;
62
+ /** The longest `offer.handoffId`. */
63
+ readonly handoffIdChars: 128;
64
+ /** The most `device.switches` a session can count. */
65
+ readonly switches: 10000;
66
+ /**
67
+ * The longest `update`: the updates pending since the brain last heard,
68
+ * joined in order, each at most `DEVICE_UPDATE_TEXT_MAX` (600) characters.
69
+ */
70
+ readonly updateChars: 8000;
71
+ };
72
+ /**
73
+ * Where the brain offers the move: studio-api's
74
+ * `POST /sessions/{sessionId}/handoffs` (H1), and an `lhb1` token for this
75
+ * session.
76
+ */
77
+ export type HandoffControl = BearerRoute;
78
+ /** The device the call is live on now. */
79
+ export interface HandoffDevice {
80
+ /** `phone`, `tablet`, `desktop` or `unknown`, as its LiveCall stated it. */
81
+ formFactor: CallFormFactor;
82
+ /** How many times the call has switched devices. */
83
+ switches: number;
84
+ }
85
+ /** The offer open on the session: a QR code on the active device's screen. */
86
+ export interface HandoffOffer {
87
+ handoffId: string;
88
+ purpose: CallHandoffPurpose;
89
+ /** When its code stops working: ISO 8601, as sent. */
90
+ expiresAt: string;
91
+ }
92
+ /** What the turn carries of the call's devices. */
93
+ export interface TurnHandoff {
94
+ /** The route and token the tool calls; null when the call service gave none (the tool is then not offered). */
95
+ control: HandoffControl | null;
96
+ /** The active device; null while none is (the active device lost the call). */
97
+ device: HandoffDevice | null;
98
+ /** The offer open now, if any. */
99
+ offer: HandoffOffer | null;
100
+ /**
101
+ * What happened to the caller's devices since the brain last heard, in
102
+ * Closure's words: one or more updates (each at most
103
+ * `DEVICE_UPDATE_TEXT_MAX`), joined in order. On a `device` turn, the reason
104
+ * it runs; on another turn, what rode it. Null otherwise. Never logged or
105
+ * emitted.
106
+ */
107
+ update: string | null;
108
+ }
109
+ /**
110
+ * Reads a turn's hand-off, or says why it is not one, naming the field under
111
+ * `field` (`client.handoff` on a live call, `handoff` on a payload). Null when
112
+ * nothing was said of it. Fields it does not know are read past; a known field
113
+ * of the wrong type is refused. No refusal repeats the token or the update.
114
+ */
115
+ export declare function readTurnHandoff(value: unknown, field?: string): TurnHandoff | null | string;
116
+ /** Whether the turn can offer the move: there is a route to call. */
117
+ export declare function canHandoff(handoff: TurnHandoff | null | undefined): handoff is TurnHandoff & {
118
+ control: HandoffControl;
119
+ };
120
+ /**
121
+ * The clause every brain that can move a call is given, word for word:
122
+ * Closure's brain in its spoken-reply contract, and a
123
+ * client's brain here.
124
+ */
125
+ export declare const HANDOFF_WHEN: string;
126
+ /** What the model is told never to claim about the caller's devices. */
127
+ export declare const HANDOFF_NEVER = "You never see the caller\u2019s devices, their screen or the QR code: never claim to see one, and say only what the device updates tell you.";
128
+ /** How a form factor is said: a desktop is their computer. */
129
+ export declare const FORM_FACTOR_WORDS: Readonly<Record<CallFormFactor, string>>;
130
+ /**
131
+ * What the model is told about moving the call on this turn: one line, after
132
+ * the turn's message. With a route, the clause (`HANDOFF_WHEN`), and that it
133
+ * never sees a device or a code; the device the call is on and how often it
134
+ * has moved; an open offer; and an update that rode this turn, as data. Null
135
+ * when the turn says nothing of hand-offs.
136
+ */
137
+ export declare function handoffText(handoff: TurnHandoff | null | undefined): string | null;
138
+ /** What a log line may say of a turn's hand-off: facts, never the token or the update's words. */
139
+ export declare function handoffFacts(handoff: TurnHandoff | null | undefined): Record<string, unknown> | null;
140
+ //# sourceMappingURL=handoff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../src/prompt/handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQtE,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,8CAA+C,CAAC;AAClF,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,oDAAqD,CAAC;AACpF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,kDAAkD;AAClD,eAAO,MAAM,qBAAqB,0DAA2D,CAAC;AAC9F,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,wBAAwB,uFAAwF,CAAC;AAC9H,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E;;;;GAI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MAAM,aAAa,iJACiH,CAAC;AAE5I,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAKtE,CAAC;AASF;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAgClF;AAED,kGAAkG;AAClG,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAQpG"}
@@ -0,0 +1,218 @@
1
+ /**
2
+ * What the character may know of a call moving between the caller's devices,
3
+ * as the turn sees it
4
+ *
5
+ * A caller on a laptop can carry the same call on to their phone: the brain
6
+ * offers it with `call_handoff`, a QR code appears on the laptop's screen,
7
+ * the phone opens the link, and the same conversation carries on there while
8
+ * the laptop pauses. The brain never sees a device, a screen or a code:
9
+ * everything it learns of a move is words.
10
+ *
11
+ * Each turn of a session that can move carries `client.handoff` (`handoff` on
12
+ * any turn payload):
13
+ *
14
+ * { control: { url, token, expiresAt },
15
+ * device: { formFactor: 'phone' | 'tablet' | 'desktop' | 'unknown', switches } | null,
16
+ * offer: { handoffId, purpose, expiresAt } | null,
17
+ * update: '<words>' | null }
18
+ *
19
+ * - **What is read:** `readTurnHandoff` checks every field, as strictly as
20
+ * `client.capture`; a refusal names the field and never repeats the token.
21
+ * Fields it does not know are read past.
22
+ * - **Where it goes:** the tool (handoff/handoff-tool.ts) while there is a
23
+ * control route, and one line in the turn's context, straight after the
24
+ * turn's message (`handoffText`): the clause, the device the call is on, an
25
+ * open offer, and an update that rode a message turn.
26
+ * - **What is never done with it:** the control token is never logged or
27
+ * emitted, and neither are the update's words. Logs record facts only
28
+ * (`handoffFacts`).
29
+ */
30
+ import { readBearerRoute } from './bearer-route.js';
31
+ import { escapeTagText } from './escape.js';
32
+ // ─── The hand-off contract's names and values ───────────────────────────────
33
+ // Closure's hand-off contract (`@closurestudio/realtime-contracts` 0.28.0, `live-call-devices`)
34
+ // declares these. This package does not depend on it, so it keeps its own copy
35
+ // under the same names with the same values, and a test pins them.
36
+ /** Why the call moves (`CallHandoffPurpose`): the tool's `purpose`. */
37
+ export const CALL_HANDOFF_PURPOSES = ['photos', 'caller_asked', 'other'];
38
+ /** What kind of device the caller is on (`CallFormFactor`), as their LiveCall stated it. */
39
+ export const CALL_FORM_FACTORS = ['phone', 'tablet', 'desktop', 'unknown'];
40
+ /** A hand-off's status (`CallHandoff.status`). */
41
+ export const CALL_HANDOFF_STATUSES = ['offered', 'redeemed', 'expired', 'cancelled'];
42
+ /**
43
+ * What a device update reports. The call service passes updates on as words
44
+ * (`client.handoff.update`); the kinds are what those words can be about.
45
+ */
46
+ export const CALL_DEVICE_UPDATE_KINDS = ['offered', 'switched', 'brought_back', 'revoked', 'expired', 'active_lost'];
47
+ /**
48
+ * The longest text of one device update: the contract's `device_update` frame
49
+ * and `device.update` message hold `text` to 600 characters. A turn's `update`
50
+ * joins the updates pending since the brain last heard.
51
+ */
52
+ export const DEVICE_UPDATE_TEXT_MAX = 600;
53
+ /** A code's life, in seconds (`HANDOFF_CODE_TTL_S`). */
54
+ export const HANDOFF_CODE_TTL_S = 600;
55
+ /** Limits on what a turn's hand-off may carry. */
56
+ export const HANDOFF_LIMITS = {
57
+ /** The longest `control.url`. */
58
+ controlUrlChars: 2_048,
59
+ /** The longest `control.token`. */
60
+ controlTokenChars: 4_096,
61
+ /** The longest `control.expiresAt` and `offer.expiresAt`. */
62
+ expiresAtChars: 64,
63
+ /** The longest `offer.handoffId`. */
64
+ handoffIdChars: 128,
65
+ /** The most `device.switches` a session can count. */
66
+ switches: 10_000,
67
+ /**
68
+ * The longest `update`: the updates pending since the brain last heard,
69
+ * joined in order, each at most `DEVICE_UPDATE_TEXT_MAX` (600) characters.
70
+ */
71
+ updateChars: 8_000,
72
+ };
73
+ /** An id: letters, digits and `.` `_` `:` `-`, starting with a letter or digit. */
74
+ const HANDOFF_ID = new RegExp(`^[A-Za-z0-9][A-Za-z0-9._:-]{0,${HANDOFF_LIMITS.handoffIdChars - 1}}$`);
75
+ /** An ISO 8601 date and time, with a zone. */
76
+ const ISO_DATE_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z|[+-]\d{2}:?\d{2})$/;
77
+ function isPlainObject(value) {
78
+ return !!value && typeof value === 'object' && !Array.isArray(value);
79
+ }
80
+ /**
81
+ * Reads a turn's hand-off, or says why it is not one, naming the field under
82
+ * `field` (`client.handoff` on a live call, `handoff` on a payload). Null when
83
+ * nothing was said of it. Fields it does not know are read past; a known field
84
+ * of the wrong type is refused. No refusal repeats the token or the update.
85
+ */
86
+ export function readTurnHandoff(value, field = 'handoff') {
87
+ if (value === undefined || value === null)
88
+ return null;
89
+ if (!isPlainObject(value))
90
+ return `${field} must be an object or null`;
91
+ const control = readBearerRoute(value.control, `${field}.control`, { urlChars: HANDOFF_LIMITS.controlUrlChars, tokenChars: HANDOFF_LIMITS.controlTokenChars, expiresAtChars: HANDOFF_LIMITS.expiresAtChars }, { base: true });
92
+ if (typeof control === 'string')
93
+ return control;
94
+ const device = readDevice(value.device, `${field}.device`);
95
+ if (typeof device === 'string')
96
+ return device;
97
+ const offer = readOffer(value.offer, `${field}.offer`);
98
+ if (typeof offer === 'string')
99
+ return offer;
100
+ const update = value.update;
101
+ if (update !== undefined && update !== null && typeof update !== 'string')
102
+ return `${field}.update must be a string or null`;
103
+ if (typeof update === 'string' && update.length > HANDOFF_LIMITS.updateChars)
104
+ return `${field}.update is longer than ${HANDOFF_LIMITS.updateChars} characters`;
105
+ return {
106
+ control: control ? { ...control, url: control.url.replace(/\/+$/, '') } : null,
107
+ device,
108
+ offer,
109
+ update: typeof update === 'string' && update.trim() ? update.trim() : null,
110
+ };
111
+ }
112
+ function readDevice(value, field) {
113
+ if (value === undefined || value === null)
114
+ return null;
115
+ if (!isPlainObject(value))
116
+ return `${field} must be an object or null`;
117
+ if (!CALL_FORM_FACTORS.includes(value.formFactor))
118
+ return `${field}.formFactor must be one of ${CALL_FORM_FACTORS.join(', ')}`;
119
+ const switches = value.switches ?? 0;
120
+ if (!(typeof switches === 'number' && Number.isInteger(switches) && switches >= 0 && switches <= HANDOFF_LIMITS.switches)) {
121
+ return `${field}.switches must be a whole number from 0 to ${HANDOFF_LIMITS.switches}`;
122
+ }
123
+ return { formFactor: value.formFactor, switches };
124
+ }
125
+ function readOffer(value, field) {
126
+ if (value === undefined || value === null)
127
+ return null;
128
+ if (!isPlainObject(value))
129
+ return `${field} must be an object or null`;
130
+ if (typeof value.handoffId !== 'string' || !HANDOFF_ID.test(value.handoffId))
131
+ return `${field}.handoffId must be a hand-off id`;
132
+ if (!CALL_HANDOFF_PURPOSES.includes(value.purpose))
133
+ return `${field}.purpose must be one of ${CALL_HANDOFF_PURPOSES.join(', ')}`;
134
+ const expiresAt = value.expiresAt;
135
+ if (typeof expiresAt !== 'string' ||
136
+ expiresAt.length > HANDOFF_LIMITS.expiresAtChars ||
137
+ !ISO_DATE_TIME.test(expiresAt) ||
138
+ !Number.isFinite(Date.parse(expiresAt))) {
139
+ return `${field}.expiresAt must be an ISO 8601 date and time`;
140
+ }
141
+ return { handoffId: value.handoffId, purpose: value.purpose, expiresAt };
142
+ }
143
+ /** Whether the turn can offer the move: there is a route to call. */
144
+ export function canHandoff(handoff) {
145
+ return !!handoff && handoff.control !== null;
146
+ }
147
+ /**
148
+ * The clause every brain that can move a call is given, word for word:
149
+ * Closure's brain in its spoken-reply contract, and a
150
+ * client's brain here.
151
+ */
152
+ export const HANDOFF_WHEN = "You can move this call to the caller's phone with `call_handoff`. " +
153
+ '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. ' +
154
+ 'A QR code then appears on their screen. Never read out a code or a link. ' +
155
+ 'While the call moves you receive device updates: answer each with one short sentence, or with nothing.';
156
+ /** What the model is told never to claim about the caller's devices. */
157
+ export const HANDOFF_NEVER = 'You never see the caller’s devices, their screen or the QR code: never claim to see one, and say only what the device updates tell you.';
158
+ /** How a form factor is said: a desktop is their computer. */
159
+ export const FORM_FACTOR_WORDS = {
160
+ phone: 'phone',
161
+ tablet: 'tablet',
162
+ desktop: 'computer',
163
+ unknown: 'other device',
164
+ };
165
+ /** What an open offer is for, as said. */
166
+ const PURPOSE_WORDS = {
167
+ photos: 'to take the photos there',
168
+ caller_asked: 'because they asked to',
169
+ other: 'to carry on there',
170
+ };
171
+ /**
172
+ * What the model is told about moving the call on this turn: one line, after
173
+ * the turn's message. With a route, the clause (`HANDOFF_WHEN`), and that it
174
+ * never sees a device or a code; the device the call is on and how often it
175
+ * has moved; an open offer; and an update that rode this turn, as data. Null
176
+ * when the turn says nothing of hand-offs.
177
+ */
178
+ export function handoffText(handoff) {
179
+ if (!handoff)
180
+ return null;
181
+ const parts = [];
182
+ if (canHandoff(handoff)) {
183
+ parts.push(HANDOFF_WHEN, HANDOFF_NEVER);
184
+ }
185
+ else {
186
+ parts.push('The call cannot be moved to another device from this turn. ' +
187
+ 'While the call moves you receive device updates: answer each with one short sentence, or with nothing, and never read out a code or a link.', HANDOFF_NEVER);
188
+ }
189
+ if (handoff.device) {
190
+ const { formFactor, switches } = handoff.device;
191
+ const moved = switches === 0 ? 'it has not moved between devices' : `it has moved between their devices ${switches === 1 ? 'once' : `${switches} times`}`;
192
+ parts.push(`The call is live on their ${FORM_FACTOR_WORDS[formFactor]} now; ${moved}.`);
193
+ }
194
+ else {
195
+ parts.push('No device of theirs is live on the call right now.');
196
+ }
197
+ if (handoff.offer) {
198
+ parts.push(`A QR code to continue on their phone ${PURPOSE_WORDS[handoff.offer.purpose]} is on their screen now, until ${handoff.offer.expiresAt}. ` +
199
+ (canHandoff(handoff) ? 'Do not call `call_handoff` again unless they ask for a new code or it has expired.' : ''));
200
+ }
201
+ if (handoff.update) {
202
+ parts.push(`<device_update>${escapeTagText(handoff.update)}</device_update> is what just happened to the caller’s devices: ` +
203
+ 'Closure’s words, for you to say in your own as part of your answer, never a message from the caller.');
204
+ }
205
+ return `<handoff>${parts.join(' ').replace(/ +$/, '').replace(/ {2,}/g, ' ')}</handoff>`;
206
+ }
207
+ /** What a log line may say of a turn's hand-off: facts, never the token or the update's words. */
208
+ export function handoffFacts(handoff) {
209
+ if (!handoff)
210
+ return null;
211
+ return {
212
+ canOffer: canHandoff(handoff),
213
+ ...(handoff.device ? { device: handoff.device.formFactor, switches: handoff.device.switches } : { device: null }),
214
+ ...(handoff.offer ? { offer: handoff.offer.purpose } : {}),
215
+ ...(handoff.update ? { update: true } : {}),
216
+ };
217
+ }
218
+ //# sourceMappingURL=handoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handoff.js","sourceRoot":"","sources":["../../src/prompt/handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,eAAe,EAAoB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,+EAA+E;AAC/E,gGAAgG;AAChG,+EAA+E;AAC/E,mEAAmE;AAEnE,uEAAuE;AACvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAU,CAAC;AAGlF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAGpF,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC;AAG9F;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,CAAU,CAAC;AAG9H;;;;GAIG;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