@pinecall/protocol 0.2.0 → 0.4.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.
- package/dist/generated/commands.d.ts +18 -8
- package/dist/generated/defs.d.ts +50 -41
- package/dist/generated/defs.js +2 -0
- package/dist/generated/events.d.ts +62 -60
- package/dist/generated/events.js +4 -2
- package/dist/generated/registry.d.ts +82 -72
- package/dist/generated/rest.d.ts +748 -63
- package/dist/generated/rest.js +214 -6
- package/dist/generated/room.d.ts +7 -7
- package/dist/generated/state.d.ts +29 -29
- package/dist/reduce.js +13 -1
- package/package.json +1 -1
package/dist/generated/rest.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated from schema/rest.json: the envelopes the read doors answer in. Never edited by hand.
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { ChannelSchema, ContactSchema, CostSchema, DirectionSchema, EndReasonSchema, EnvSchema, KnowledgeFileSchema, PlatformToolSchema, } from "./defs.js";
|
|
3
|
+
import { ChannelSchema, ContactSchema, CostSchema, DirectionSchema, DocsConfigSchema, EndReasonSchema, EnvSchema, GreetingConfigSchema, HangupConfigSchema, KnowledgeFileSchema, MemoryConfigSchema, PlatformToolSchema, PronunciationSchema, TurnConfigSchema, } from "./defs.js";
|
|
4
4
|
import { EntrySchema } from "./envelope.js";
|
|
5
5
|
import { CallStatusSchema, StateSchema } from "./state.js";
|
|
6
6
|
/** GET /v1/calls/{call}/state: the whole log folded, and the seq a stream resumes from. */
|
|
@@ -241,6 +241,65 @@ export const OrgMailWantedSchema = z.strictObject({
|
|
|
241
241
|
password: z.string().nullish(),
|
|
242
242
|
from: z.string(),
|
|
243
243
|
});
|
|
244
|
+
/**
|
|
245
|
+
* GET and PUT /v1/ops/mail: the SMTP account the BOX posts its letters through — what the operator
|
|
246
|
+
* stored, or the environment's two variables — how the last one went, and never the password. An
|
|
247
|
+
* org's own account (OrgMail) still wins over both.
|
|
248
|
+
*/
|
|
249
|
+
export const BoxMailSchema = z.strictObject({
|
|
250
|
+
configured: z.boolean(),
|
|
251
|
+
source: z.string().nullable(),
|
|
252
|
+
host: z.string().nullable(),
|
|
253
|
+
port: z.int().nullable(),
|
|
254
|
+
security: z.string().nullable(),
|
|
255
|
+
username: z.string().nullable(),
|
|
256
|
+
from: z.string().nullable(),
|
|
257
|
+
verified_at: z.string().nullable(),
|
|
258
|
+
last_error: z.string().nullable(),
|
|
259
|
+
});
|
|
260
|
+
/**
|
|
261
|
+
* GET and PUT /v1/ops/brand, and `brand` on GET /.well-known/pinecall: what this box's letters and
|
|
262
|
+
* its sign-in page are called and painted with. Pinecall, its accent and no logo until the
|
|
263
|
+
* operator says.
|
|
264
|
+
*/
|
|
265
|
+
export const BoxBrandSchema = z.strictObject({
|
|
266
|
+
name: z.string(),
|
|
267
|
+
logo_url: z.string().nullable(),
|
|
268
|
+
accent: z.string(),
|
|
269
|
+
});
|
|
270
|
+
/**
|
|
271
|
+
* PUT /v1/ops/brand, the body. A field left out keeps what it had; an empty string goes back to
|
|
272
|
+
* the default — which for the logo is none at all, the only way to clear one.
|
|
273
|
+
*/
|
|
274
|
+
export const BoxBrandWantedSchema = z.strictObject({
|
|
275
|
+
name: z.string().nullable().nullish(),
|
|
276
|
+
logo_url: z.string().nullable().nullish(),
|
|
277
|
+
accent: z.string().nullable().nullish(),
|
|
278
|
+
});
|
|
279
|
+
/**
|
|
280
|
+
* One box-wide identity provider as the operator reads it: whether it is usable, the client this
|
|
281
|
+
* gateway is at it, and the URI to register there. Never the secret.
|
|
282
|
+
*/
|
|
283
|
+
export const BoxProviderSchema = z.strictObject({
|
|
284
|
+
configured: z.boolean(),
|
|
285
|
+
client_id: z.string().nullable(),
|
|
286
|
+
redirect_uri: z.string(),
|
|
287
|
+
});
|
|
288
|
+
/**
|
|
289
|
+
* GET /v1/ops/signin: every provider this box can offer every org's people, wired or not, one key
|
|
290
|
+
* each. Only `google` today; a second is a key here and a row on the box.
|
|
291
|
+
*/
|
|
292
|
+
export const BoxSignInSchema = z.strictObject({
|
|
293
|
+
google: BoxProviderSchema,
|
|
294
|
+
});
|
|
295
|
+
/**
|
|
296
|
+
* PUT /v1/ops/signin/google, the body: the OAuth client the operator made at Google for this
|
|
297
|
+
* gateway. Replaced whole, the secret write-only; the issuer is Google's own and is not a field.
|
|
298
|
+
*/
|
|
299
|
+
export const BoxProviderWantedSchema = z.strictObject({
|
|
300
|
+
client_id: z.string(),
|
|
301
|
+
client_secret: z.string(),
|
|
302
|
+
});
|
|
244
303
|
/**
|
|
245
304
|
* POST /v1/org/mail/test: one letter, waited for — the only door of this runtime that waits for a
|
|
246
305
|
* mail server, because it is the one a person is watching.
|
|
@@ -340,13 +399,15 @@ export const KnowledgeScoreSchema = z.strictObject({
|
|
|
340
399
|
misses: z.array(GoldenMissSchema),
|
|
341
400
|
});
|
|
342
401
|
/**
|
|
343
|
-
* PUT /v1/knowledge/{base}, the answer: which base, how many chunks it became,
|
|
344
|
-
*
|
|
402
|
+
* PUT /v1/knowledge/{base}, the answer: which base, how many chunks it became, how long that took,
|
|
403
|
+
* and what its whole files weigh on every call.
|
|
345
404
|
*/
|
|
346
405
|
export const KnowledgePushedSchema = z.strictObject({
|
|
347
406
|
base: z.string(),
|
|
348
407
|
chunks: z.int(),
|
|
349
408
|
took_ms: z.number(),
|
|
409
|
+
whole_tokens: z.int().nullish(),
|
|
410
|
+
notice: z.string().nullable().nullish(),
|
|
350
411
|
});
|
|
351
412
|
/** One knowledge base as the list draws it: its name, its size, and when it was last pushed. */
|
|
352
413
|
export const KnowledgeBaseSchema = z.strictObject({
|
|
@@ -492,8 +553,9 @@ export const ExtractionRunSchema = z.strictObject({
|
|
|
492
553
|
});
|
|
493
554
|
/**
|
|
494
555
|
* POST /v1/calls/{call}/lookup, the body: which platform tool to run for this turn, and what to
|
|
495
|
-
* run it with.
|
|
496
|
-
*
|
|
556
|
+
* run it with. Asked by the worker for the call it serves, and by the app for a call of its own
|
|
557
|
+
* org — `this.knowledge.search` in a tool; the gateway runs it against its own stores and writes
|
|
558
|
+
* memory.ops or docs.sources on the call's log itself.
|
|
497
559
|
*/
|
|
498
560
|
export const LookupRequestSchema = z.strictObject({
|
|
499
561
|
tool: PlatformToolSchema,
|
|
@@ -509,6 +571,19 @@ export const LookupResultSchema = z.strictObject({
|
|
|
509
571
|
output: z.record(z.string(), z.unknown()),
|
|
510
572
|
took_ms: z.number(),
|
|
511
573
|
});
|
|
574
|
+
/** One chunk search found: the file it came from, the heading it sits under, and its text. */
|
|
575
|
+
export const FoundChunkSchema = z.strictObject({
|
|
576
|
+
path: z.string(),
|
|
577
|
+
heading: z.string().nullable(),
|
|
578
|
+
text: z.string(),
|
|
579
|
+
});
|
|
580
|
+
/**
|
|
581
|
+
* What search answers in a lookup's output: the best chunks of every base the agent reads, the
|
|
582
|
+
* best first. The app's `this.knowledge.search` hands the chunks to the tool that asked.
|
|
583
|
+
*/
|
|
584
|
+
export const SearchFoundSchema = z.strictObject({
|
|
585
|
+
chunks: z.array(FoundChunkSchema),
|
|
586
|
+
});
|
|
512
587
|
/**
|
|
513
588
|
* POST /v1/calls/{call}/remember, the answer: what the call taught about the contact, counted.
|
|
514
589
|
* Worker-only; the body is empty, the gateway reads the turns off its own log and writes
|
|
@@ -534,7 +609,6 @@ export const DialGuardsSchema = z.strictObject({
|
|
|
534
609
|
dial_anywhere: z.boolean(),
|
|
535
610
|
per_minute: z.int(),
|
|
536
611
|
per_day: z.int(),
|
|
537
|
-
countries: z.array(z.string()),
|
|
538
612
|
max_duration_s: z.int(),
|
|
539
613
|
});
|
|
540
614
|
/**
|
|
@@ -556,3 +630,137 @@ export const OutboundProvisionedSchema = z.strictObject({
|
|
|
556
630
|
trunk: z.string().nullish(),
|
|
557
631
|
address: z.string().nullish(),
|
|
558
632
|
});
|
|
633
|
+
/**
|
|
634
|
+
* An agent's tuning: what the org set over what the app declared, per world and per corner. Every
|
|
635
|
+
* field is optional; one left out is not set, and what the app declared — or the runtime's own
|
|
636
|
+
* default — stands for it.
|
|
637
|
+
*/
|
|
638
|
+
export const TuningBodySchema = z.strictObject({
|
|
639
|
+
voice: z.string().nullish(),
|
|
640
|
+
tts: z.string().nullish(),
|
|
641
|
+
tts_model: z.string().nullish(),
|
|
642
|
+
stt: z.string().nullish(),
|
|
643
|
+
llm: z.string().nullish(),
|
|
644
|
+
greeting: GreetingConfigSchema.nullish(),
|
|
645
|
+
hangup: HangupConfigSchema.nullish(),
|
|
646
|
+
turn: TurnConfigSchema.nullish(),
|
|
647
|
+
memory: MemoryConfigSchema.nullish(),
|
|
648
|
+
knowledge: z.array(DocsConfigSchema).nullish(),
|
|
649
|
+
});
|
|
650
|
+
/**
|
|
651
|
+
* One kept version of an agent's tuning: whose corner, which version, who set it and when, and
|
|
652
|
+
* what it says.
|
|
653
|
+
*/
|
|
654
|
+
export const TuningRowSchema = z.strictObject({
|
|
655
|
+
holder: z.string(),
|
|
656
|
+
version: z.int(),
|
|
657
|
+
author: z.string(),
|
|
658
|
+
note: z.string().nullable(),
|
|
659
|
+
set_at: z.number(),
|
|
660
|
+
config: TuningBodySchema,
|
|
661
|
+
});
|
|
662
|
+
/**
|
|
663
|
+
* GET /v1/agents/{slug}/settings: the agent's tuning as this key sees it — its own corner's, the
|
|
664
|
+
* team's and production's, each corner's own newest row, or null when that corner set nothing.
|
|
665
|
+
*/
|
|
666
|
+
export const TuningAnswerSchema = z.strictObject({
|
|
667
|
+
world: EnvSchema,
|
|
668
|
+
yours: TuningRowSchema.nullable(),
|
|
669
|
+
team: TuningRowSchema.nullable(),
|
|
670
|
+
production: TuningRowSchema.nullable(),
|
|
671
|
+
});
|
|
672
|
+
/**
|
|
673
|
+
* PUT /v1/agents/{slug}/settings, the body: the whole set, the version it was read at, why, and
|
|
674
|
+
* whose corner.
|
|
675
|
+
*/
|
|
676
|
+
export const TuningPutSchema = z.strictObject({
|
|
677
|
+
config: TuningBodySchema,
|
|
678
|
+
if_version: z.int().nullable().nullish(),
|
|
679
|
+
note: z.string().nullable().nullish(),
|
|
680
|
+
team: z.boolean().nullish(),
|
|
681
|
+
});
|
|
682
|
+
/** GET /v1/agents/{slug}/settings/history: one corner's versions, newest first. */
|
|
683
|
+
export const TuningHistorySchema = z.strictObject({
|
|
684
|
+
world: EnvSchema,
|
|
685
|
+
holder: z.string(),
|
|
686
|
+
rows: z.array(TuningRowSchema),
|
|
687
|
+
});
|
|
688
|
+
/**
|
|
689
|
+
* GET /v1/agents/{slug}/settings/diff: what this key's corner reads against another corner's
|
|
690
|
+
* newest, and which fields differ.
|
|
691
|
+
*/
|
|
692
|
+
export const TuningDiffSchema = z.strictObject({
|
|
693
|
+
ours: TuningRowSchema.nullable(),
|
|
694
|
+
theirs: TuningRowSchema.nullable(),
|
|
695
|
+
changed: z.array(z.string()),
|
|
696
|
+
});
|
|
697
|
+
/**
|
|
698
|
+
* POST /v1/agents/{slug}/settings/rollback, the body: which version to bring back. It comes back
|
|
699
|
+
* as a NEW version; nothing is deleted.
|
|
700
|
+
*/
|
|
701
|
+
export const RollbackSchema = z.strictObject({
|
|
702
|
+
version: z.int(),
|
|
703
|
+
team: z.boolean().nullish(),
|
|
704
|
+
});
|
|
705
|
+
/**
|
|
706
|
+
* The org's lexicon: how the voice says the words it would get wrong, and the words the ears must
|
|
707
|
+
* know. Shared by every agent of the org, laid over each one's own says and hears.
|
|
708
|
+
*/
|
|
709
|
+
export const LexiconBodySchema = z.strictObject({
|
|
710
|
+
said: z.array(PronunciationSchema),
|
|
711
|
+
heard: z.array(z.string()),
|
|
712
|
+
});
|
|
713
|
+
/** One kept version of the org's lexicon. */
|
|
714
|
+
export const LexiconRowSchema = z.strictObject({
|
|
715
|
+
holder: z.string(),
|
|
716
|
+
version: z.int(),
|
|
717
|
+
author: z.string(),
|
|
718
|
+
note: z.string().nullable(),
|
|
719
|
+
set_at: z.number(),
|
|
720
|
+
lexicon: LexiconBodySchema,
|
|
721
|
+
});
|
|
722
|
+
/**
|
|
723
|
+
* GET /v1/lexicon: the org's words as this key sees them — its own corner's, the team's and
|
|
724
|
+
* production's, each corner's own newest, or null.
|
|
725
|
+
*/
|
|
726
|
+
export const LexiconAnswerSchema = z.strictObject({
|
|
727
|
+
world: EnvSchema,
|
|
728
|
+
yours: LexiconRowSchema.nullable(),
|
|
729
|
+
team: LexiconRowSchema.nullable(),
|
|
730
|
+
production: LexiconRowSchema.nullable(),
|
|
731
|
+
});
|
|
732
|
+
/** PUT /v1/lexicon, the body: the whole lexicon, the version it was read at, why, and whose corner. */
|
|
733
|
+
export const LexiconPutSchema = z.strictObject({
|
|
734
|
+
lexicon: LexiconBodySchema,
|
|
735
|
+
if_version: z.int().nullable().nullish(),
|
|
736
|
+
note: z.string().nullable().nullish(),
|
|
737
|
+
team: z.boolean().nullish(),
|
|
738
|
+
});
|
|
739
|
+
/** GET /v1/lexicon/history: one corner's versions, newest first. */
|
|
740
|
+
export const LexiconHistorySchema = z.strictObject({
|
|
741
|
+
world: EnvSchema,
|
|
742
|
+
holder: z.string(),
|
|
743
|
+
rows: z.array(LexiconRowSchema),
|
|
744
|
+
});
|
|
745
|
+
/**
|
|
746
|
+
* GET /v1/calls/{call}/settings: the exact tuning and lexicon a call was built on, by the versions
|
|
747
|
+
* its head row recorded.
|
|
748
|
+
*/
|
|
749
|
+
export const CallTuningSchema = z.strictObject({
|
|
750
|
+
config_version: z.int().nullable(),
|
|
751
|
+
lexicon_version: z.int().nullable(),
|
|
752
|
+
config: TuningRowSchema.nullable(),
|
|
753
|
+
lexicon: LexiconRowSchema.nullable(),
|
|
754
|
+
});
|
|
755
|
+
/** One base and the agents whose settings attach it. */
|
|
756
|
+
export const KnowledgeUseSchema = z.strictObject({
|
|
757
|
+
base: z.string(),
|
|
758
|
+
agents: z.array(z.string()),
|
|
759
|
+
});
|
|
760
|
+
/**
|
|
761
|
+
* GET /v1/knowledge/attached: which agents read each base, off every agent's newest settings in
|
|
762
|
+
* this world.
|
|
763
|
+
*/
|
|
764
|
+
export const KnowledgeUsesSchema = z.strictObject({
|
|
765
|
+
bases: z.array(KnowledgeUseSchema),
|
|
766
|
+
});
|
package/dist/generated/room.d.ts
CHANGED
|
@@ -23,9 +23,9 @@ export declare const ParticipantJoinedSchema: z.ZodObject<{
|
|
|
23
23
|
kind: z.ZodEnum<{
|
|
24
24
|
agent: "agent";
|
|
25
25
|
caller: "caller";
|
|
26
|
-
supervisor: "supervisor";
|
|
27
26
|
listener: "listener";
|
|
28
27
|
sip: "sip";
|
|
28
|
+
supervisor: "supervisor";
|
|
29
29
|
}>;
|
|
30
30
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
31
|
attributes: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
@@ -51,15 +51,15 @@ export declare const TrackPublishedSchema: z.ZodObject<{
|
|
|
51
51
|
identity: z.ZodString;
|
|
52
52
|
kind: z.ZodEnum<{
|
|
53
53
|
audio: "audio";
|
|
54
|
-
video: "video";
|
|
55
54
|
screen: "screen";
|
|
55
|
+
video: "video";
|
|
56
56
|
}>;
|
|
57
57
|
source: z.ZodEnum<{
|
|
58
|
-
unknown: "unknown";
|
|
59
|
-
microphone: "microphone";
|
|
60
58
|
camera: "camera";
|
|
59
|
+
microphone: "microphone";
|
|
61
60
|
screen_share: "screen_share";
|
|
62
61
|
screen_share_audio: "screen_share_audio";
|
|
62
|
+
unknown: "unknown";
|
|
63
63
|
}>;
|
|
64
64
|
}, z.core.$strict>;
|
|
65
65
|
export type TrackPublished = z.infer<typeof TrackPublishedSchema>;
|
|
@@ -71,15 +71,15 @@ export declare const TrackUnpublishedSchema: z.ZodObject<{
|
|
|
71
71
|
identity: z.ZodString;
|
|
72
72
|
kind: z.ZodEnum<{
|
|
73
73
|
audio: "audio";
|
|
74
|
-
video: "video";
|
|
75
74
|
screen: "screen";
|
|
75
|
+
video: "video";
|
|
76
76
|
}>;
|
|
77
77
|
source: z.ZodEnum<{
|
|
78
|
-
unknown: "unknown";
|
|
79
|
-
microphone: "microphone";
|
|
80
78
|
camera: "camera";
|
|
79
|
+
microphone: "microphone";
|
|
81
80
|
screen_share: "screen_share";
|
|
82
81
|
screen_share_audio: "screen_share_audio";
|
|
82
|
+
unknown: "unknown";
|
|
83
83
|
}>;
|
|
84
84
|
}, z.core.$strict>;
|
|
85
85
|
export type TrackUnpublished = z.infer<typeof TrackUnpublishedSchema>;
|
|
@@ -4,11 +4,11 @@ import { z } from "zod";
|
|
|
4
4
|
* looks like.
|
|
5
5
|
*/
|
|
6
6
|
export declare const CallStatusSchema: z.ZodEnum<{
|
|
7
|
-
idle: "idle";
|
|
8
|
-
ringing: "ringing";
|
|
9
|
-
dialing: "dialing";
|
|
10
7
|
active: "active";
|
|
8
|
+
dialing: "dialing";
|
|
11
9
|
ended: "ended";
|
|
10
|
+
idle: "idle";
|
|
11
|
+
ringing: "ringing";
|
|
12
12
|
}>;
|
|
13
13
|
export type CallStatus = z.infer<typeof CallStatusSchema>;
|
|
14
14
|
/** One finished turn of the caller, with what the session measured about it. */
|
|
@@ -277,9 +277,9 @@ export declare const ToolRunSchema: z.ZodObject<{
|
|
|
277
277
|
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
278
278
|
speech_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
279
279
|
status: z.ZodEnum<{
|
|
280
|
-
running: "running";
|
|
281
280
|
done: "done";
|
|
282
281
|
failed: "failed";
|
|
282
|
+
running: "running";
|
|
283
283
|
}>;
|
|
284
284
|
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
285
285
|
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -312,9 +312,9 @@ export declare const ConfirmSchema: z.ZodObject<{
|
|
|
312
312
|
audience: z.ZodString;
|
|
313
313
|
phrase: z.ZodString;
|
|
314
314
|
status: z.ZodEnum<{
|
|
315
|
-
pending: "pending";
|
|
316
|
-
granted: "granted";
|
|
317
315
|
declined: "declined";
|
|
316
|
+
granted: "granted";
|
|
317
|
+
pending: "pending";
|
|
318
318
|
}>;
|
|
319
319
|
said: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
320
320
|
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -372,9 +372,9 @@ export declare const ParticipantSchema: z.ZodObject<{
|
|
|
372
372
|
kind: z.ZodEnum<{
|
|
373
373
|
agent: "agent";
|
|
374
374
|
caller: "caller";
|
|
375
|
-
supervisor: "supervisor";
|
|
376
375
|
listener: "listener";
|
|
377
376
|
sip: "sip";
|
|
377
|
+
supervisor: "supervisor";
|
|
378
378
|
}>;
|
|
379
379
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
380
380
|
joined_at: z.ZodNumber;
|
|
@@ -391,9 +391,9 @@ export declare const RoomSchema: z.ZodObject<{
|
|
|
391
391
|
kind: z.ZodEnum<{
|
|
392
392
|
agent: "agent";
|
|
393
393
|
caller: "caller";
|
|
394
|
-
supervisor: "supervisor";
|
|
395
394
|
listener: "listener";
|
|
396
395
|
sip: "sip";
|
|
396
|
+
supervisor: "supervisor";
|
|
397
397
|
}>;
|
|
398
398
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
399
399
|
joined_at: z.ZodNumber;
|
|
@@ -430,11 +430,11 @@ export declare const StateSchema: z.ZodObject<{
|
|
|
430
430
|
agent: z.ZodString;
|
|
431
431
|
call: z.ZodNullable<z.ZodString>;
|
|
432
432
|
status: z.ZodEnum<{
|
|
433
|
-
idle: "idle";
|
|
434
|
-
ringing: "ringing";
|
|
435
|
-
dialing: "dialing";
|
|
436
433
|
active: "active";
|
|
434
|
+
dialing: "dialing";
|
|
437
435
|
ended: "ended";
|
|
436
|
+
idle: "idle";
|
|
437
|
+
ringing: "ringing";
|
|
438
438
|
}>;
|
|
439
439
|
channel: z.ZodNullable<z.ZodEnum<{
|
|
440
440
|
phone: "phone";
|
|
@@ -462,9 +462,9 @@ export declare const StateSchema: z.ZodObject<{
|
|
|
462
462
|
kind: z.ZodEnum<{
|
|
463
463
|
agent: "agent";
|
|
464
464
|
caller: "caller";
|
|
465
|
-
supervisor: "supervisor";
|
|
466
465
|
listener: "listener";
|
|
467
466
|
sip: "sip";
|
|
467
|
+
supervisor: "supervisor";
|
|
468
468
|
}>;
|
|
469
469
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
470
470
|
joined_at: z.ZodNumber;
|
|
@@ -476,29 +476,29 @@ export declare const StateSchema: z.ZodObject<{
|
|
|
476
476
|
started_at: z.ZodNullable<z.ZodNumber>;
|
|
477
477
|
ended_at: z.ZodNullable<z.ZodNumber>;
|
|
478
478
|
end_reason: z.ZodNullable<z.ZodEnum<{
|
|
479
|
-
caller_hung_up: "caller_hung_up";
|
|
480
479
|
agent_hung_up: "agent_hung_up";
|
|
481
|
-
|
|
482
|
-
transferred: "transferred";
|
|
483
|
-
no_answer: "no_answer";
|
|
480
|
+
app_detached: "app_detached";
|
|
484
481
|
busy: "busy";
|
|
482
|
+
caller_hung_up: "caller_hung_up";
|
|
485
483
|
dial_failed: "dial_failed";
|
|
486
|
-
timeout: "timeout";
|
|
487
484
|
drained: "drained";
|
|
488
|
-
app_detached: "app_detached";
|
|
489
485
|
error: "error";
|
|
486
|
+
no_answer: "no_answer";
|
|
487
|
+
supervisor_ended: "supervisor_ended";
|
|
488
|
+
timeout: "timeout";
|
|
489
|
+
transferred: "transferred";
|
|
490
490
|
}>>;
|
|
491
491
|
outcome: z.ZodNullable<z.ZodString>;
|
|
492
492
|
user_state: z.ZodNullable<z.ZodEnum<{
|
|
493
|
+
away: "away";
|
|
493
494
|
listening: "listening";
|
|
494
495
|
speaking: "speaking";
|
|
495
|
-
away: "away";
|
|
496
496
|
}>>;
|
|
497
497
|
agent_state: z.ZodNullable<z.ZodEnum<{
|
|
498
|
+
idle: "idle";
|
|
499
|
+
initializing: "initializing";
|
|
498
500
|
listening: "listening";
|
|
499
501
|
speaking: "speaking";
|
|
500
|
-
initializing: "initializing";
|
|
501
|
-
idle: "idle";
|
|
502
502
|
thinking: "thinking";
|
|
503
503
|
}>>;
|
|
504
504
|
live: z.ZodObject<{
|
|
@@ -714,9 +714,9 @@ export declare const StateSchema: z.ZodObject<{
|
|
|
714
714
|
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
715
715
|
speech_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
716
716
|
status: z.ZodEnum<{
|
|
717
|
-
running: "running";
|
|
718
717
|
done: "done";
|
|
719
718
|
failed: "failed";
|
|
719
|
+
running: "running";
|
|
720
720
|
}>;
|
|
721
721
|
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
722
722
|
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -746,18 +746,18 @@ export declare const StateSchema: z.ZodObject<{
|
|
|
746
746
|
audience: z.ZodString;
|
|
747
747
|
phrase: z.ZodString;
|
|
748
748
|
status: z.ZodEnum<{
|
|
749
|
-
pending: "pending";
|
|
750
|
-
granted: "granted";
|
|
751
749
|
declined: "declined";
|
|
750
|
+
granted: "granted";
|
|
751
|
+
pending: "pending";
|
|
752
752
|
}>;
|
|
753
753
|
said: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
754
754
|
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
755
755
|
}, z.core.$strict>>;
|
|
756
756
|
memory: z.ZodArray<z.ZodObject<{
|
|
757
757
|
op: z.ZodEnum<{
|
|
758
|
+
forget: "forget";
|
|
758
759
|
recall: "recall";
|
|
759
760
|
remember: "remember";
|
|
760
|
-
forget: "forget";
|
|
761
761
|
}>;
|
|
762
762
|
contact: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
763
763
|
query: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -857,12 +857,12 @@ export declare const StateSchema: z.ZodObject<{
|
|
|
857
857
|
provider: z.ZodString;
|
|
858
858
|
model: z.ZodString;
|
|
859
859
|
unit: z.ZodEnum<{
|
|
860
|
-
|
|
861
|
-
cached_input_tokens: "cached_input_tokens";
|
|
860
|
+
audio_seconds: "audio_seconds";
|
|
862
861
|
cache_creation_tokens: "cache_creation_tokens";
|
|
863
|
-
|
|
862
|
+
cached_input_tokens: "cached_input_tokens";
|
|
864
863
|
characters: "characters";
|
|
865
|
-
|
|
864
|
+
input_tokens: "input_tokens";
|
|
865
|
+
output_tokens: "output_tokens";
|
|
866
866
|
requests: "requests";
|
|
867
867
|
session_seconds: "session_seconds";
|
|
868
868
|
}>;
|
package/dist/reduce.js
CHANGED
|
@@ -151,7 +151,8 @@ function applyEvent(state, entry, event) {
|
|
|
151
151
|
state.live.user = event.data.final ? null : event.data.text;
|
|
152
152
|
return;
|
|
153
153
|
case "agent.transcript":
|
|
154
|
-
|
|
154
|
+
// A delta, not the reply so far: one word of a spoken reply, one token of a written one.
|
|
155
|
+
state.live.agent = event.data.final ? null : saidSoFar(state.live.agent, event.data);
|
|
155
156
|
return;
|
|
156
157
|
case "turn.user":
|
|
157
158
|
state.turns.push({ role: "user", ...event.data });
|
|
@@ -350,3 +351,14 @@ function lastIndex(items, matches) {
|
|
|
350
351
|
}
|
|
351
352
|
return -1;
|
|
352
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* The reply in flight with one more delta. A word the voice aligned arrives bare and is set a
|
|
356
|
+
* space apart; a token of a written reply carries its own spacing, and a space glued between
|
|
357
|
+
* "clean" and "ing" would be a word nobody said.
|
|
358
|
+
*/
|
|
359
|
+
function saidSoFar(soFar, delta) {
|
|
360
|
+
if (soFar === null || soFar === "")
|
|
361
|
+
return delta.text;
|
|
362
|
+
const apart = /\s$/.test(soFar) || /^\s/.test(delta.text);
|
|
363
|
+
return delta.start != null && !apart ? `${soFar} ${delta.text}` : `${soFar}${delta.text}`;
|
|
364
|
+
}
|
package/package.json
CHANGED