@agimon-ai/po-voice 0.0.0-alpha.0

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 (84) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +13 -0
  3. package/README.md +249 -0
  4. package/dist/apiContracts.cjs +809 -0
  5. package/dist/apiContracts.cjs.map +1 -0
  6. package/dist/apiContracts.d.mts +53 -0
  7. package/dist/apiContracts.d.mts.map +1 -0
  8. package/dist/apiContracts.mjs +805 -0
  9. package/dist/apiContracts.mjs.map +1 -0
  10. package/dist/assets/browserCaptureWorklet-Droj0fW0.js +13 -0
  11. package/dist/assets/silero_vad_v6.2.1-SjbCxFXk.onnx +0 -0
  12. package/dist/clientCaptureActivity-DN4xQtmw.d.mts +234 -0
  13. package/dist/clientCaptureActivity-DN4xQtmw.d.mts.map +1 -0
  14. package/dist/clientMedia-CfTfc9_4.mjs +49 -0
  15. package/dist/clientMedia-CfTfc9_4.mjs.map +1 -0
  16. package/dist/clientMedia-DuA4aYhD.cjs +156 -0
  17. package/dist/clientMedia-DuA4aYhD.cjs.map +1 -0
  18. package/dist/clientMedia.cjs +134 -0
  19. package/dist/clientMedia.cjs.map +1 -0
  20. package/dist/clientMedia.d.mts +2 -0
  21. package/dist/clientMedia.mjs +114 -0
  22. package/dist/clientMedia.mjs.map +1 -0
  23. package/dist/extensions/server.cjs +8975 -0
  24. package/dist/extensions/server.cjs.map +1 -0
  25. package/dist/extensions/server.d.mts +5 -0
  26. package/dist/extensions/server.d.mts.map +1 -0
  27. package/dist/extensions/server.mjs +8968 -0
  28. package/dist/extensions/server.mjs.map +1 -0
  29. package/dist/extensions/web.mjs +4530 -0
  30. package/dist/extensions/web.mjs.map +1 -0
  31. package/dist/index-C95HCjmT.d.mts +212 -0
  32. package/dist/index-C95HCjmT.d.mts.map +1 -0
  33. package/dist/index.cjs +637 -0
  34. package/dist/index.cjs.map +1 -0
  35. package/dist/index.d.mts +603 -0
  36. package/dist/index.d.mts.map +1 -0
  37. package/dist/index.mjs +557 -0
  38. package/dist/index.mjs.map +1 -0
  39. package/dist/narrationBargeIn-C_Po8fgw.mjs +62 -0
  40. package/dist/narrationBargeIn-C_Po8fgw.mjs.map +1 -0
  41. package/dist/narrationBargeIn-Dje82XOm.cjs +73 -0
  42. package/dist/narrationBargeIn-Dje82XOm.cjs.map +1 -0
  43. package/dist/sileroVadWorker-D894njUe.mjs +110 -0
  44. package/dist/sileroVadWorker-D894njUe.mjs.map +1 -0
  45. package/dist/vad-DDe4RIdW.mjs +315 -0
  46. package/dist/vad-DDe4RIdW.mjs.map +1 -0
  47. package/dist/vad-n2RlruzB.cjs +332 -0
  48. package/dist/vad-n2RlruzB.cjs.map +1 -0
  49. package/dist/voiceReloadHandoff.cjs +9 -0
  50. package/dist/voiceReloadHandoff.d.mts +1 -0
  51. package/dist/voiceReloadHandoff.mjs +2 -0
  52. package/dist/voiceTools-CRQHK_Uc.cjs +616 -0
  53. package/dist/voiceTools-CRQHK_Uc.cjs.map +1 -0
  54. package/dist/voiceTools-aCCREMjS.mjs +611 -0
  55. package/dist/voiceTools-aCCREMjS.mjs.map +1 -0
  56. package/dist/voiceTools.cjs +12 -0
  57. package/dist/voiceTools.d.mts +7 -0
  58. package/dist/voiceTools.d.mts.map +1 -0
  59. package/dist/voiceTools.mjs +3 -0
  60. package/dist/voiceWorker.cjs +1929 -0
  61. package/dist/voiceWorker.cjs.map +1 -0
  62. package/dist/voiceWorker.d.mts +200 -0
  63. package/dist/voiceWorker.d.mts.map +1 -0
  64. package/dist/voiceWorker.mjs +1925 -0
  65. package/dist/voiceWorker.mjs.map +1 -0
  66. package/dist/voiceWorkerProtocol-0H3czPjt.cjs +2385 -0
  67. package/dist/voiceWorkerProtocol-0H3czPjt.cjs.map +1 -0
  68. package/dist/voiceWorkerProtocol-B_4B2_fR.mjs +2085 -0
  69. package/dist/voiceWorkerProtocol-B_4B2_fR.mjs.map +1 -0
  70. package/dist/voiceWorkerSessionController-DaYemiL3.cjs +1800 -0
  71. package/dist/voiceWorkerSessionController-DaYemiL3.cjs.map +1 -0
  72. package/dist/voiceWorkerSessionController-GB3SJ6YE.mjs +1734 -0
  73. package/dist/voiceWorkerSessionController-GB3SJ6YE.mjs.map +1 -0
  74. package/licenses/Codex-Apache-2.0.txt +201 -0
  75. package/llms.txt +9 -0
  76. package/package.json +153 -0
  77. package/src/extensions/workspaces/sessions/(frontend)/lifecycle/_lib/models/README.md +11 -0
  78. package/src/extensions/workspaces/sessions/(frontend)/lifecycle/_lib/models/SILERO-LICENSE +21 -0
  79. package/src/prompts/po-use-voice/SKILL.md +35 -0
  80. package/src/types/clientCaptureActivity.ts +155 -0
  81. package/src/types/clientMedia.ts +226 -0
  82. package/src/types/manualTranscription.ts +53 -0
  83. package/src/types/realtime.ts +107 -0
  84. package/src/types/voiceOwnership.ts +315 -0
@@ -0,0 +1,809 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
6
+ let typebox = require("typebox");
7
+ //#region src/schemas/voiceControl.ts
8
+ const voiceControlMethod = (0, require("@agimon-ai/po-core/pluginProtocol").defineDoomPluginMethod)({
9
+ service: "voice",
10
+ method: "control",
11
+ scope: "session",
12
+ direction: "client-to-server",
13
+ input: typebox.Type.Object({
14
+ action: typebox.Type.Union([
15
+ "status",
16
+ "manual",
17
+ "activate",
18
+ "deactivate",
19
+ "mute",
20
+ "unmute",
21
+ "interrupt",
22
+ "transfer"
23
+ ].map((value) => typebox.Type.Literal(value))),
24
+ target: typebox.Type.Optional(typebox.Type.Integer({ minimum: 1 })),
25
+ revision: typebox.Type.Optional(typebox.Type.String({
26
+ minLength: 1,
27
+ maxLength: 128
28
+ }))
29
+ }, { additionalProperties: false }),
30
+ output: typebox.Type.Object({
31
+ state: typebox.Type.String(),
32
+ mode: typebox.Type.String(),
33
+ manual: typebox.Type.String(),
34
+ muted: typebox.Type.Boolean(),
35
+ error: typebox.Type.Optional(typebox.Type.String())
36
+ }, { additionalProperties: false })
37
+ });
38
+ //#endregion
39
+ //#region src/schemas/apiContracts.ts
40
+ const S = typebox.Type.String();
41
+ const N = typebox.Type.Number();
42
+ const B = typebox.Type.Boolean();
43
+ const O = typebox.Type.Optional;
44
+ const values = (items) => typebox.Type.Union(items.map((item) => typebox.Type.Literal(item)));
45
+ const Client = {
46
+ clientId: S,
47
+ connectionId: S
48
+ };
49
+ const Configuration = typebox.Type.Object({
50
+ mode: values(["manual", "autonomous"]),
51
+ activityControl: values(["host", "client"]),
52
+ endpointSilenceMs: O(typebox.Type.Integer({ minimum: 250 }))
53
+ });
54
+ const Playback = {
55
+ playbackId: S,
56
+ outcome: values([
57
+ "completed",
58
+ "stopped",
59
+ "aborted",
60
+ "failed"
61
+ ]),
62
+ error: O(S)
63
+ };
64
+ const Sequence = { sequence: N };
65
+ const Control = values([
66
+ "mute",
67
+ "unmute",
68
+ "interrupt"
69
+ ]);
70
+ const Browser = typebox.Type.Object({
71
+ connection: values([
72
+ "connecting",
73
+ "connected",
74
+ "closed",
75
+ "failed"
76
+ ]),
77
+ listening: B,
78
+ speaking: B,
79
+ muted: B,
80
+ error: O(S)
81
+ });
82
+ const VoiceMediaEventSchema = typebox.Type.Union([
83
+ typebox.Type.Object({
84
+ ...Sequence,
85
+ type: typebox.Type.Literal("capture-start"),
86
+ captureId: S,
87
+ sampleRate: typebox.Type.Literal(16e3),
88
+ channels: typebox.Type.Literal(1),
89
+ bitsPerSample: typebox.Type.Literal(16),
90
+ configuration: Configuration
91
+ }),
92
+ typebox.Type.Object({
93
+ ...Sequence,
94
+ type: values(["capture-stop", "capture-abort"]),
95
+ captureId: S
96
+ }),
97
+ typebox.Type.Object({
98
+ ...Sequence,
99
+ type: typebox.Type.Literal("playback-start"),
100
+ playbackId: S,
101
+ text: S,
102
+ delivery: O(values(["client", "streamed"])),
103
+ voice: O(S),
104
+ rate: O(N)
105
+ }),
106
+ typebox.Type.Object({
107
+ ...Sequence,
108
+ type: values(["playback-stop", "playback-abort"]),
109
+ playbackId: S
110
+ }),
111
+ typebox.Type.Object({
112
+ ...Sequence,
113
+ type: values(["realtime-start", "realtime-stop"]),
114
+ activationId: S
115
+ }),
116
+ typebox.Type.Object({
117
+ ...Sequence,
118
+ type: typebox.Type.Literal("realtime-control"),
119
+ activationId: S,
120
+ action: Control
121
+ }),
122
+ typebox.Type.Object({
123
+ ...Sequence,
124
+ type: typebox.Type.Literal("realtime-send"),
125
+ activationId: S,
126
+ messages: typebox.Type.Array(S)
127
+ })
128
+ ]);
129
+ const RealtimeEvent = typebox.Type.Union([
130
+ typebox.Type.Object({ type: typebox.Type.Literal("ready") }),
131
+ typebox.Type.Object({
132
+ type: typebox.Type.Literal("transcript"),
133
+ role: values(["user", "assistant"]),
134
+ text: S,
135
+ complete: B
136
+ }),
137
+ typebox.Type.Object({
138
+ type: typebox.Type.Literal("request"),
139
+ requestId: S,
140
+ text: S
141
+ }),
142
+ typebox.Type.Object({
143
+ type: typebox.Type.Literal("error"),
144
+ code: S
145
+ })
146
+ ]);
147
+ const RealtimeSnapshot = typebox.Type.Object({
148
+ activationId: S,
149
+ state: values([
150
+ "connecting",
151
+ "active",
152
+ "closed",
153
+ "failed"
154
+ ]),
155
+ cursor: N,
156
+ events: typebox.Type.Array(typebox.Type.Object({
157
+ sequence: N,
158
+ event: RealtimeEvent
159
+ })),
160
+ browser: O(Browser)
161
+ });
162
+ const Wake = typebox.Type.Object({
163
+ eventEpoch: S,
164
+ sequence: N
165
+ });
166
+ const GlobalLiveStatus = typebox.Type.Object({
167
+ version: typebox.Type.Literal(1),
168
+ state: values([
169
+ "disabled",
170
+ "starting",
171
+ "active",
172
+ "draining",
173
+ "shuttingDown"
174
+ ]),
175
+ activeSessionId: typebox.Type.Union([S, typebox.Type.Null()]),
176
+ muted: B,
177
+ error: O(S),
178
+ media: typebox.Type.Object({
179
+ client: B,
180
+ realtime: B
181
+ })
182
+ });
183
+ const Version = { version: typebox.Type.Literal(3) };
184
+ const Targets = typebox.Type.Array(typebox.Type.Object({
185
+ handle: S,
186
+ label: S,
187
+ order: N
188
+ }), { maxItems: 32 });
189
+ const OwnershipAction = values([
190
+ "catalog",
191
+ "prepare",
192
+ "activate",
193
+ "deactivate",
194
+ "readiness",
195
+ "fence"
196
+ ]);
197
+ const Acknowledgement = typebox.Type.Object({
198
+ ...Version,
199
+ commandId: S,
200
+ action: OwnershipAction,
201
+ ok: B,
202
+ active: B,
203
+ error: O(S)
204
+ });
205
+ const Command = typebox.Type.Object({
206
+ ...Version,
207
+ commandId: S,
208
+ action: OwnershipAction,
209
+ targets: O(Targets),
210
+ catalogRevision: O(S),
211
+ handoffId: O(S),
212
+ controllerId: O(S),
213
+ leaseId: O(S),
214
+ revision: O(N)
215
+ });
216
+ const Snapshot = typebox.Type.Object({
217
+ registration: O(typebox.Type.Object({
218
+ ...Version,
219
+ leaseId: S,
220
+ revision: N,
221
+ label: S,
222
+ eligible: B,
223
+ active: B
224
+ })),
225
+ targets: Targets,
226
+ catalogRevision: O(S),
227
+ activation: O(typebox.Type.Object({
228
+ ...Version,
229
+ requestId: S
230
+ })),
231
+ handoff: O(typebox.Type.Object({
232
+ ...Version,
233
+ requestId: S,
234
+ handle: S,
235
+ catalogRevision: S
236
+ })),
237
+ acknowledgement: O(Acknowledgement)
238
+ });
239
+ const Errors = Object.fromEntries([
240
+ 400,
241
+ 404,
242
+ 409,
243
+ 410,
244
+ 413,
245
+ 415,
246
+ 429,
247
+ 500,
248
+ 502,
249
+ 503,
250
+ 504
251
+ ].map((status) => [status, {
252
+ description: "Voice request failed.",
253
+ schema: typebox.Type.Object({
254
+ error: S,
255
+ code: O(S)
256
+ })
257
+ }]));
258
+ const route = (path, method, output, input, query = [], status = 200) => ({
259
+ id: `voice.${path.slice(1).replaceAll("/", ".")}`,
260
+ scope: "session",
261
+ basePath: "voice-media",
262
+ path,
263
+ method,
264
+ authentication: "owner",
265
+ description: `Voice media ${path}.`,
266
+ ...path.startsWith("/host/") || path.startsWith("/hub/") ? { availability: "Internal broker route; requires the host-issued bearer token for this route namespace." } : {},
267
+ parameters: [...query.map((name) => ({
268
+ name,
269
+ in: "query",
270
+ required: !["after", "wait"].includes(name),
271
+ schema: S
272
+ })), ...path.startsWith("/host/") || path.startsWith("/hub/") ? [{
273
+ name: "Authorization",
274
+ in: "header",
275
+ required: true,
276
+ schema: typebox.Type.String({ pattern: "^Bearer .+" })
277
+ }] : []],
278
+ ...input ? { body: {
279
+ required: true,
280
+ contentType: "application/json",
281
+ schema: input
282
+ } } : {},
283
+ responses: {
284
+ ...Errors,
285
+ [output ? status : 204]: {
286
+ description: output ? "Voice response." : "Accepted with no response body.",
287
+ ...output ? { schema: output } : {}
288
+ }
289
+ }
290
+ });
291
+ const pcm = (path, method, query) => {
292
+ const result = route(path, method, void 0, void 0, query);
293
+ result.description = "PCM signed 16-bit little-endian, 16000 Hz, mono. Chunks contain complete samples. Activity headers carry state, level, elapsed time, epoch and speech duration. A 204 response carries x-po-capture-state or x-po-playback-state when applicable.";
294
+ if (method === "POST") result.body = {
295
+ required: true,
296
+ contentType: "application/vnd.po.pcm-s16le",
297
+ schema: S
298
+ };
299
+ else result.responses["200"] = {
300
+ description: "PCM bytes.",
301
+ contentType: "application/vnd.po.pcm-s16le",
302
+ schema: S
303
+ };
304
+ return result;
305
+ };
306
+ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
307
+ version: 1,
308
+ protocols: {
309
+ "voice-media": "6",
310
+ "voice-ownership": "3"
311
+ },
312
+ dynamic: ["Realtime event strings and SDP are provider-defined protocol documents passed through the media broker."],
313
+ http: [
314
+ {
315
+ id: "voice.status",
316
+ scope: "session",
317
+ basePath: "voice",
318
+ path: "/status",
319
+ method: "GET",
320
+ authentication: "owner",
321
+ description: "Voice session status and media readiness.",
322
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
323
+ ...voiceControlMethod.output.properties,
324
+ media: typebox.Type.Object({
325
+ closed: B,
326
+ capture: B,
327
+ playback: B,
328
+ realtime: B
329
+ }),
330
+ readiness: typebox.Type.Object({
331
+ configured: B,
332
+ transcription: B,
333
+ error: O(S),
334
+ engine: O(S),
335
+ mode: O(S),
336
+ correctionModel: O(S)
337
+ })
338
+ }))
339
+ },
340
+ {
341
+ id: "voice.control.http",
342
+ scope: "session",
343
+ basePath: "voice",
344
+ path: "/control",
345
+ method: "POST",
346
+ authentication: "owner",
347
+ description: "Control the voice session.",
348
+ body: {
349
+ required: true,
350
+ contentType: "application/json",
351
+ schema: voiceControlMethod.input
352
+ },
353
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(voiceControlMethod.output)
354
+ },
355
+ route("/client/connect", "POST", typebox.Type.Object({
356
+ version: typebox.Type.Literal(6),
357
+ cursor: N,
358
+ eventEpoch: O(S),
359
+ heartbeatMs: O(N)
360
+ }), typebox.Type.Object({
361
+ version: typebox.Type.Literal(6),
362
+ ...Client,
363
+ clientKind: values(["browser", "native"]),
364
+ controlLocation: values(["local", "remote"]),
365
+ capabilities: typebox.Type.Object({
366
+ capture: B,
367
+ playback: B,
368
+ captureActivity: B,
369
+ autonomousOrchestration: B,
370
+ playbackDucking: O(B),
371
+ realtime: O(B)
372
+ })
373
+ })),
374
+ route("/client/disconnect", "POST", void 0, typebox.Type.Object(Client)),
375
+ route("/client/heartbeat", "POST", Wake, typebox.Type.Object(Client)),
376
+ {
377
+ ...route("/client/events", "GET", VoiceMediaEventSchema, void 0, [
378
+ "clientId",
379
+ "connectionId",
380
+ "after",
381
+ "wait"
382
+ ]),
383
+ responses: {
384
+ ...Errors,
385
+ "200": {
386
+ description: "Next event.",
387
+ schema: VoiceMediaEventSchema
388
+ },
389
+ "204": { description: "No pending event." }
390
+ }
391
+ },
392
+ pcm("/client/audio", "POST", [
393
+ "clientId",
394
+ "connectionId",
395
+ "captureId"
396
+ ]),
397
+ route("/client/capture-stopped", "POST", void 0, typebox.Type.Object({
398
+ ...Client,
399
+ captureId: S,
400
+ error: O(S)
401
+ })),
402
+ pcm("/client/playback-audio", "GET", [
403
+ "clientId",
404
+ "connectionId",
405
+ "playbackId"
406
+ ]),
407
+ route("/client/playback-result", "POST", void 0, typebox.Type.Object({
408
+ ...Client,
409
+ ...Playback
410
+ })),
411
+ route("/host/capture/start", "POST", typebox.Type.Object({ configuration: Configuration }), typebox.Type.Object({
412
+ captureId: S,
413
+ configuration: O(Configuration)
414
+ }), [], 201),
415
+ pcm("/host/capture/audio", "GET", ["captureId"]),
416
+ ...["stop", "abort"].map((action) => route(`/host/capture/${action}`, "POST", void 0, typebox.Type.Object({ captureId: S }))),
417
+ route("/host/playback/start", "POST", typebox.Type.Object({ delivery: values(["client", "streamed"]) }), typebox.Type.Object({
418
+ playbackId: S,
419
+ text: S,
420
+ voice: O(S),
421
+ rate: O(N)
422
+ }), [], 201),
423
+ pcm("/host/playback/audio", "POST", ["playbackId"]),
424
+ route("/host/playback/audio-end", "POST", void 0, typebox.Type.Object({
425
+ playbackId: S,
426
+ error: O(S)
427
+ })),
428
+ {
429
+ ...route("/host/playback/result", "GET", typebox.Type.Object(Playback), void 0, ["playbackId"]),
430
+ responses: {
431
+ ...Errors,
432
+ "200": {
433
+ description: "Playback outcome.",
434
+ schema: typebox.Type.Object(Playback)
435
+ },
436
+ "204": { description: "Playback is pending." }
437
+ }
438
+ },
439
+ ...["stop", "abort"].map((action) => route(`/host/playback/${action}`, "POST", void 0, typebox.Type.Object({ playbackId: S }))),
440
+ route("/hub/ownership/state", "GET", Snapshot),
441
+ route("/hub/ownership/command", "POST", Acknowledgement, Command),
442
+ route("/host/ownership/sync", "POST", typebox.Type.Object({ command: O(Command) }), Snapshot),
443
+ route("/host/realtime/start", "POST", typebox.Type.Object({}), typebox.Type.Object({
444
+ activationId: S,
445
+ instructions: typebox.Type.String({ maxLength: 16384 })
446
+ }), [], 201),
447
+ route("/host/realtime/stop", "POST", void 0, typebox.Type.Object({ activationId: S })),
448
+ route("/host/realtime/poll", "GET", RealtimeSnapshot, void 0, ["activationId", "after"]),
449
+ route("/host/realtime/send", "POST", void 0, typebox.Type.Object({
450
+ activationId: S,
451
+ messages: typebox.Type.Array(S, { maxItems: 64 })
452
+ })),
453
+ route("/host/realtime/control", "POST", void 0, typebox.Type.Object({
454
+ activationId: S,
455
+ action: Control
456
+ })),
457
+ route("/client/realtime/negotiate", "POST", typebox.Type.Object({ sdp: S }), typebox.Type.Object({
458
+ ...Client,
459
+ activationId: S,
460
+ sdp: S
461
+ })),
462
+ route("/client/realtime/event", "POST", void 0, typebox.Type.Object({
463
+ ...Client,
464
+ activationId: S,
465
+ event: S
466
+ })),
467
+ route("/client/realtime/state", "POST", void 0, typebox.Type.Object({
468
+ ...Client,
469
+ activationId: S,
470
+ state: Browser
471
+ })),
472
+ {
473
+ id: "voice.manual",
474
+ scope: "session",
475
+ basePath: "voice-media",
476
+ path: "/manual/transcribe",
477
+ method: "POST",
478
+ authentication: "owner",
479
+ description: "Transcribe at most 4 MiB of WebM/Opus or MP4/AAC audio, at most 300000 milliseconds.",
480
+ parameters: [{
481
+ name: "x-doom-audio-duration-ms",
482
+ in: "header",
483
+ required: true,
484
+ schema: typebox.Type.Integer({
485
+ minimum: 0,
486
+ maximum: 3e5
487
+ })
488
+ }],
489
+ body: {
490
+ required: true,
491
+ contentType: "audio/webm",
492
+ contentTypes: ["audio/webm", "audio/mp4"],
493
+ schema: S
494
+ },
495
+ responses: {
496
+ ...Errors,
497
+ "200": {
498
+ description: "Transcript.",
499
+ schema: typebox.Type.Object({ transcript: S })
500
+ }
501
+ }
502
+ },
503
+ ...[
504
+ [
505
+ "readiness",
506
+ "/live/agent",
507
+ "GET"
508
+ ],
509
+ [
510
+ "prepare",
511
+ "/live/agent/prepare",
512
+ "POST"
513
+ ],
514
+ [
515
+ "admit",
516
+ "/live/agent/admit",
517
+ "POST"
518
+ ],
519
+ [
520
+ "results",
521
+ "/live/agent/results",
522
+ "GET"
523
+ ],
524
+ [
525
+ "ack",
526
+ "/live/agent/results/ack",
527
+ "POST"
528
+ ],
529
+ [
530
+ "fence",
531
+ "/live/agent/fence",
532
+ "POST"
533
+ ],
534
+ [
535
+ "select",
536
+ "/live/agent/select",
537
+ "POST"
538
+ ],
539
+ [
540
+ "revoke",
541
+ "/live/agent/revoke",
542
+ "POST"
543
+ ]
544
+ ].map(([name, path, method]) => ({
545
+ id: `voice.agent.${name}`,
546
+ scope: "session",
547
+ basePath: "voice",
548
+ path,
549
+ method,
550
+ authentication: "owner",
551
+ description: `Native Voice agent ${name}. Only the host-issued hub bearer can access this route.`,
552
+ parameters: [{
553
+ name: "Authorization",
554
+ in: "header",
555
+ required: true,
556
+ schema: typebox.Type.String({ pattern: "^Bearer .+" })
557
+ }, ...name === "results" ? [
558
+ "activationId",
559
+ "routeGeneration",
560
+ "sessionIncarnation",
561
+ "after"
562
+ ].map((key) => ({
563
+ name: key,
564
+ in: "query",
565
+ required: key !== "after",
566
+ schema: S
567
+ })) : []],
568
+ ...method === "POST" ? { body: {
569
+ required: true,
570
+ contentType: "application/json",
571
+ schema: name === "select" ? typebox.Type.Object({
572
+ activationId: S,
573
+ routeGeneration: typebox.Type.Integer({ minimum: 1 }),
574
+ transactionId: S,
575
+ sessionIncarnation: S,
576
+ nativeTransferAllowed: B,
577
+ catalog: typebox.Type.Object({
578
+ revision: S,
579
+ targets: typebox.Type.Array(typebox.Type.Object({
580
+ order: typebox.Type.Integer({ minimum: 1 }),
581
+ label: S
582
+ }), { maxItems: 256 })
583
+ })
584
+ }) : name === "revoke" ? typebox.Type.Object({
585
+ activationId: S,
586
+ routeGeneration: typebox.Type.Integer({ minimum: 1 }),
587
+ transactionId: S,
588
+ sessionIncarnation: S
589
+ }) : typebox.Type.Unknown()
590
+ } } : {},
591
+ responses: {
592
+ ...(0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Unknown()),
593
+ "204": { description: "Agent result acknowledged or route fenced." }
594
+ }
595
+ })),
596
+ {
597
+ id: "voice.peer",
598
+ scope: "global",
599
+ basePath: "voice",
600
+ path: "/peer",
601
+ method: "POST",
602
+ authentication: "none",
603
+ description: "Accept an HMAC-authenticated bounded Voice media relay request from a configured peer.",
604
+ body: {
605
+ required: true,
606
+ contentType: "application/json",
607
+ schema: typebox.Type.Unknown()
608
+ },
609
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Unknown())
610
+ },
611
+ {
612
+ id: "voice.peerOwnership",
613
+ scope: "global",
614
+ basePath: "voice",
615
+ path: "/peer-ownership",
616
+ method: "POST",
617
+ authentication: "none",
618
+ description: "Discover and stage Voice ownership through an HMAC-authenticated paired host.",
619
+ body: {
620
+ required: true,
621
+ contentType: "application/json",
622
+ schema: typebox.Type.Unknown()
623
+ },
624
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Unknown())
625
+ },
626
+ {
627
+ id: "voice.peerAgent",
628
+ scope: "global",
629
+ basePath: "voice",
630
+ path: "/peer-agent",
631
+ method: "POST",
632
+ authentication: "none",
633
+ description: "Accept a signed, replay-guarded, grant-scoped native Voice agent request from a configured peer.",
634
+ body: {
635
+ required: true,
636
+ contentType: "application/json",
637
+ schema: typebox.Type.Unknown()
638
+ },
639
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Unknown())
640
+ },
641
+ {
642
+ id: "voice.relayBinding",
643
+ scope: "global",
644
+ basePath: "voice",
645
+ path: "/relay-binding",
646
+ method: "POST",
647
+ authentication: "owner",
648
+ description: "Issue an expiring controller-bound handle for a granted paired Voice session.",
649
+ body: {
650
+ required: true,
651
+ contentType: "application/json",
652
+ schema: typebox.Type.Object({
653
+ target: S,
654
+ connectionId: S
655
+ })
656
+ },
657
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
658
+ binding: S,
659
+ expiresAt: N
660
+ }))
661
+ },
662
+ {
663
+ id: "voice.relay",
664
+ scope: "global",
665
+ basePath: "voice",
666
+ path: "/relay",
667
+ method: "POST",
668
+ authentication: "owner",
669
+ description: "Relay a browser Voice media operation through an expiring controller-bound handle.",
670
+ parameters: [{
671
+ name: "binding",
672
+ in: "query",
673
+ required: true,
674
+ schema: S
675
+ }],
676
+ body: {
677
+ required: true,
678
+ contentType: "application/json",
679
+ schema: typebox.Type.Unknown()
680
+ },
681
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Unknown())
682
+ },
683
+ {
684
+ id: "voice.nativeTransfer",
685
+ scope: "global",
686
+ basePath: "voice",
687
+ path: "/live/native-transfer",
688
+ method: "POST",
689
+ authentication: "owner",
690
+ description: "Host-only revision-bound native Live transfer. Requires the host hub bearer.",
691
+ parameters: [{
692
+ name: "Authorization",
693
+ in: "header",
694
+ required: true,
695
+ schema: typebox.Type.String({ pattern: "^Bearer .+" })
696
+ }],
697
+ body: {
698
+ required: true,
699
+ contentType: "application/json",
700
+ schema: typebox.Type.Object({
701
+ sourceSessionId: S,
702
+ activationId: S,
703
+ routeGeneration: typebox.Type.Integer({ minimum: 0 }),
704
+ sessionIncarnation: S,
705
+ ordinal: typebox.Type.Integer({ minimum: 1 }),
706
+ catalogRevision: S
707
+ })
708
+ },
709
+ responses: {
710
+ ...Errors,
711
+ "202": {
712
+ description: "Transfer requested; source work drains before commit.",
713
+ schema: typebox.Type.Object({ requested: typebox.Type.Literal(true) })
714
+ }
715
+ }
716
+ },
717
+ {
718
+ id: "voice.liveStatus",
719
+ scope: "global",
720
+ basePath: "voice",
721
+ path: "/live/status",
722
+ method: "GET",
723
+ authentication: "owner",
724
+ description: "Read the host-global live companion state without activating media.",
725
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(GlobalLiveStatus)
726
+ },
727
+ {
728
+ id: "voice.liveControl",
729
+ scope: "global",
730
+ basePath: "voice",
731
+ path: "/live/control",
732
+ method: "POST",
733
+ authentication: "owner",
734
+ description: "Explicitly activate, transfer, mute, interrupt or end the host-global live companion.",
735
+ body: {
736
+ required: true,
737
+ contentType: "application/json",
738
+ schema: typebox.Type.Object({
739
+ action: values([
740
+ "activate",
741
+ "transfer",
742
+ "mute",
743
+ "unmute",
744
+ "interrupt",
745
+ "end"
746
+ ]),
747
+ sessionId: O(S),
748
+ expectedSourceSessionId: O(S)
749
+ })
750
+ },
751
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(GlobalLiveStatus)
752
+ },
753
+ {
754
+ id: "voice.readiness",
755
+ scope: "global",
756
+ basePath: "voice",
757
+ path: "/readiness",
758
+ method: "GET",
759
+ authentication: "owner",
760
+ description: "Read configured voice readiness.",
761
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
762
+ configured: B,
763
+ transcription: B,
764
+ error: O(S),
765
+ engine: O(S),
766
+ mode: O(S),
767
+ correctionModel: O(S)
768
+ }))
769
+ }
770
+ ],
771
+ sockets: [{
772
+ id: "voice.control",
773
+ scope: "session",
774
+ service: voiceControlMethod.service,
775
+ member: voiceControlMethod.method,
776
+ kind: "method",
777
+ direction: "client-to-server",
778
+ description: "Voice session control through the scoped plugin service.",
779
+ input: voiceControlMethod.input,
780
+ output: voiceControlMethod.output
781
+ }, ...["global", "workspace"].flatMap((scope) => [{
782
+ id: "voice.wake",
783
+ scope,
784
+ service: "po.hub.v1",
785
+ member: "voice_media_wake",
786
+ kind: "channel",
787
+ direction: "server-to-client",
788
+ description: "Voice media wake channel payload.",
789
+ input: Wake
790
+ }, {
791
+ id: "voice.ownership",
792
+ scope,
793
+ service: "po.hub.v1",
794
+ member: "voice_ownership",
795
+ kind: "channel",
796
+ direction: "server-to-client",
797
+ description: "Browser media ownership channel payload.",
798
+ input: typebox.Type.Object({
799
+ type: typebox.Type.Literal("browser-media-session"),
800
+ ...Version,
801
+ activeSessionId: typebox.Type.Union([S, typebox.Type.Null()])
802
+ })
803
+ }])]
804
+ });
805
+ //#endregion
806
+ exports.apiContracts = apiContracts;
807
+ exports.default = apiContracts;
808
+
809
+ //# sourceMappingURL=apiContracts.cjs.map