@simple-ai-lab/sdk 0.1.0 → 0.3.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/index.d.cts CHANGED
@@ -1,5 +1,747 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ type ActionsIoScalarType = 'string' | 'number' | 'boolean';
4
+ type ActionsIoSchemaNode = {
5
+ type: ActionsIoScalarType;
6
+ description: string;
7
+ nullable: boolean;
8
+ } | {
9
+ type: 'object';
10
+ description: string;
11
+ nullable: boolean;
12
+ properties: Record<string, ActionsIoSchemaNode>;
13
+ required: string[];
14
+ additionalProperties: boolean;
15
+ } | {
16
+ type: 'array';
17
+ description: string;
18
+ nullable: boolean;
19
+ items?: ActionsIoSchemaNode;
20
+ };
21
+ type ActionsIoSchema = {
22
+ type: 'object';
23
+ description: string;
24
+ properties: Record<string, ActionsIoSchemaNode>;
25
+ required: string[];
26
+ additionalProperties: boolean;
27
+ };
28
+ type HttpActionValues = {
29
+ actionType: 'http';
30
+ name: string;
31
+ description: string;
32
+ inputSchema: ActionsIoSchema;
33
+ outputSchema: ActionsIoSchema;
34
+ outputMappings: Record<string, string>;
35
+ operation: {
36
+ type: 'request';
37
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
38
+ urlTemplate: string;
39
+ headers: {
40
+ name: string;
41
+ valueTemplate: string;
42
+ }[];
43
+ bodyTemplate: string | null;
44
+ };
45
+ };
46
+ type CodeActionValues = {
47
+ actionType: 'code';
48
+ name: string;
49
+ description: string;
50
+ inputSchema: ActionsIoSchema;
51
+ outputSchema: ActionsIoSchema;
52
+ outputMappings: Record<string, string>;
53
+ operation: {
54
+ type: 'execute';
55
+ language: 'typescript';
56
+ source: string;
57
+ compiledJs: string | null;
58
+ runtime: 'node22';
59
+ timeoutMs: number;
60
+ };
61
+ };
62
+ type CustomDataActionValues = {
63
+ actionType: 'custom_data';
64
+ name: string;
65
+ description: string;
66
+ inputSchema: ActionsIoSchema;
67
+ outputSchema: ActionsIoSchema;
68
+ outputMappings: Record<string, string>;
69
+ operation: {
70
+ type: 'query';
71
+ sql: string;
72
+ } | {
73
+ type: 'search';
74
+ table: string;
75
+ bodyTemplate: string;
76
+ };
77
+ };
78
+ type KnowledgeBaseActionValues = {
79
+ actionType: 'knowledge_base';
80
+ name: string;
81
+ description: string;
82
+ inputSchema: ActionsIoSchema;
83
+ outputSchema: ActionsIoSchema;
84
+ outputMappings: Record<string, string>;
85
+ operation: {
86
+ type: 'search';
87
+ knowledgeBaseIds: string[];
88
+ bodyTemplate: string;
89
+ };
90
+ };
91
+ type ActionVersionValues = HttpActionValues | CodeActionValues | CustomDataActionValues | KnowledgeBaseActionValues;
92
+ type ActionContract = {
93
+ inputSchema: ActionsIoSchema;
94
+ outputSchema: ActionsIoSchema;
95
+ };
96
+ type InlineActionDefinition = {
97
+ kind: 'inline';
98
+ key: string;
99
+ contract: ActionContract;
100
+ compile: (options: ActionCompileOptions) => ActionVersionValues;
101
+ };
102
+ type ReferencedActionDefinition = {
103
+ kind: 'reference';
104
+ key: string;
105
+ versionUuid: string;
106
+ contract: ActionContract | null;
107
+ };
108
+ type ActionDefinition = InlineActionDefinition | ReferencedActionDefinition;
109
+ type AgentActionInput = {
110
+ source: 'agent';
111
+ description: string;
112
+ } | {
113
+ source: 'template';
114
+ value: string;
115
+ };
116
+ /** Maps each Action output name to the Agent parameter that should receive its value. */
117
+ type ActionOutputParameters = Record<string, string>;
118
+ type CallableActionDefinition = {
119
+ kind: 'callable';
120
+ key: string;
121
+ action: ActionDefinition;
122
+ name: string;
123
+ description: string;
124
+ inputs: Record<string, AgentActionInput>;
125
+ outputParameters: ActionOutputParameters;
126
+ };
127
+ type ActionRunDefinition = {
128
+ kind: 'run';
129
+ key: string;
130
+ action: ActionDefinition;
131
+ inputs: Record<string, string>;
132
+ outputParameters: ActionOutputParameters;
133
+ };
134
+ type SourceFileReference = {
135
+ kind: 'source-file';
136
+ path: string;
137
+ };
138
+ type CommonActionConfig<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape> = {
139
+ key: string;
140
+ name: string;
141
+ description: string;
142
+ input: z.ZodObject<TInputShape>;
143
+ output: z.ZodObject<TOutputShape>;
144
+ outputMappings: Record<string, string>;
145
+ };
146
+ type HttpActionConfig<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape> = CommonActionConfig<TInputShape, TOutputShape> & {
147
+ request: {
148
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
149
+ url: string;
150
+ headers?: Record<string, string>;
151
+ body?: string | null;
152
+ };
153
+ };
154
+ type CodeActionConfig<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape> = CommonActionConfig<TInputShape, TOutputShape> & {
155
+ source: string | SourceFileReference;
156
+ timeoutMs?: number;
157
+ };
158
+ type CustomDataQueryActionConfig<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape> = CommonActionConfig<TInputShape, TOutputShape> & {
159
+ sql: string;
160
+ };
161
+ type CustomDataSearchActionConfig<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape> = CommonActionConfig<TInputShape, TOutputShape> & {
162
+ table: string;
163
+ body: string;
164
+ };
165
+ type KnowledgeBaseSearchActionConfig<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape> = CommonActionConfig<TInputShape, TOutputShape> & {
166
+ knowledgeBaseIds: string[];
167
+ body: string;
168
+ };
169
+ type ActionCompileOptions = {
170
+ readSourceFile?: (path: string) => string;
171
+ };
172
+ declare function actionsIoSchemaFromZod<TShape extends z.ZodRawShape>(schema: z.ZodObject<TShape>): ActionsIoSchema;
173
+ declare const action: {
174
+ http<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape>(config: HttpActionConfig<TInputShape, TOutputShape>): InlineActionDefinition;
175
+ code<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape>(config: CodeActionConfig<TInputShape, TOutputShape>): InlineActionDefinition;
176
+ customDataQuery<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape>(config: CustomDataQueryActionConfig<TInputShape, TOutputShape>): InlineActionDefinition;
177
+ customDataSearch<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape>(config: CustomDataSearchActionConfig<TInputShape, TOutputShape>): InlineActionDefinition;
178
+ knowledgeBaseSearch<TInputShape extends z.ZodRawShape, TOutputShape extends z.ZodRawShape>(config: KnowledgeBaseSearchActionConfig<TInputShape, TOutputShape>): InlineActionDefinition;
179
+ ref(config: {
180
+ key: string;
181
+ versionUuid: string;
182
+ contract?: ActionContract;
183
+ }): ReferencedActionDefinition;
184
+ callable(config: Omit<CallableActionDefinition, "kind">): CallableActionDefinition;
185
+ run(config: Omit<ActionRunDefinition, "kind">): ActionRunDefinition;
186
+ fromAgent(description: string): AgentActionInput;
187
+ from(value: string): AgentActionInput;
188
+ };
189
+ declare function compileAction(definition: InlineActionDefinition, options?: ActionCompileOptions): ActionVersionValues;
190
+ declare function sourceFile(path: string): SourceFileReference;
191
+
192
+ type BackgroundNoise = 'office' | 'coffee_shop' | 'driving' | 'restaurant' | 'street' | 'airport' | 'shopping_mall' | 'park' | 'off';
193
+ type InterruptionMode = 'harder' | 'medium' | 'easier' | 'always';
194
+ type RemoteReference = {
195
+ uuid: string;
196
+ };
197
+ type PromptReference = {
198
+ kind: 'inline';
199
+ text: string | null;
200
+ example: string | null;
201
+ generatedExamples?: unknown;
202
+ } | {
203
+ kind: 'file';
204
+ path: string;
205
+ example: string | null;
206
+ } | {
207
+ kind: 'version';
208
+ versionId: string;
209
+ };
210
+ type ExtractionField = {
211
+ name: string;
212
+ type: string;
213
+ description: string;
214
+ required: boolean;
215
+ enum?: (string | number | boolean)[];
216
+ items?: ExtractionField;
217
+ properties?: ExtractionField[];
218
+ };
219
+ type AgentV2EdgeWire = {
220
+ uuid: string;
221
+ toNodeUuid: string;
222
+ description: string;
223
+ priority: number;
224
+ condition: {
225
+ variable: string;
226
+ operator: string;
227
+ value: string;
228
+ } | null;
229
+ };
230
+ type EnabledWithDescription = {
231
+ enabled: boolean;
232
+ description: string | null;
233
+ };
234
+ type TransferCapability = {
235
+ enabled: boolean;
236
+ phoneNumber: string | null;
237
+ timeout: number;
238
+ mode: 'cold' | 'warm';
239
+ description: string | null;
240
+ voicemailMessage: string | null;
241
+ };
242
+ type NodeBuiltInCapabilities = {
243
+ alwaysAvailable?: EnabledWithDescription;
244
+ transfer?: TransferCapability;
245
+ };
246
+ type PromptWire = {
247
+ type: 'inline';
248
+ prompt: string | null;
249
+ example: string | null;
250
+ generatedExamples?: unknown;
251
+ } | {
252
+ type: 'reference';
253
+ promptVersionId: string;
254
+ };
255
+ type ActionUseSiteWire = {
256
+ actionUseSiteUuid: string;
257
+ actionVersionUuid: string;
258
+ inputMappings: Record<string, string>;
259
+ outputParameterMappings: Record<string, string>;
260
+ };
261
+ type ToolUseSiteWire = ActionUseSiteWire & {
262
+ name: string;
263
+ description: string;
264
+ inputDescriptions: Record<string, string>;
265
+ };
266
+ type AgentV2ConfigWire = {
267
+ voice: {
268
+ voiceUuid: string | null;
269
+ backgroundNoise: BackgroundNoise;
270
+ };
271
+ llm: {
272
+ model: string;
273
+ llmModelUuid: string | null;
274
+ temperature: number;
275
+ };
276
+ speech: {
277
+ language: string;
278
+ keyterms: string[];
279
+ };
280
+ call: {
281
+ agentSpeaksFirst: boolean;
282
+ firstSentence: string | null;
283
+ maxCallLengthSeconds: number;
284
+ record: boolean;
285
+ checkInAfterSilence: {
286
+ enabled: boolean;
287
+ prompt: string | null;
288
+ };
289
+ endCallAfterExtendedSilence: boolean;
290
+ pciEnabled: boolean;
291
+ backgroundNoise?: {
292
+ trackName: string;
293
+ gainMultiplier?: number;
294
+ };
295
+ interruptionConfig?: {
296
+ mode: InterruptionMode;
297
+ } | null;
298
+ };
299
+ preCallWebhook: {
300
+ enabled: boolean;
301
+ url: string | null;
302
+ authToken: string | null;
303
+ timeout: number;
304
+ parameters: string[];
305
+ };
306
+ builtInTools: {
307
+ dtmf: EnabledWithDescription;
308
+ hangup: {
309
+ enabled: boolean;
310
+ description: string | null;
311
+ message: string | null;
312
+ };
313
+ transfer: TransferCapability;
314
+ };
315
+ assignedToolIds: string[];
316
+ toolUseSites?: ToolUseSiteWire[];
317
+ automaticActions: {
318
+ beforeCallStart: (ActionUseSiteWire & {
319
+ trigger: 'before_call_start';
320
+ }) | null;
321
+ };
322
+ knowledgeBaseIds: string[];
323
+ abTestGroupIds: string[];
324
+ };
325
+ type AgentV2NodeBaseWire = {
326
+ uuid: string;
327
+ name: string;
328
+ isRoot: boolean;
329
+ position: {
330
+ x: number;
331
+ y: number;
332
+ };
333
+ behavior: {
334
+ waitAfterExecuting: number;
335
+ [key: string]: number | undefined;
336
+ };
337
+ edges: AgentV2EdgeWire[];
338
+ builtInTools?: NodeBuiltInCapabilities;
339
+ };
340
+ type AgentV2NodeWire = (AgentV2NodeBaseWire & {
341
+ type: 'global';
342
+ prompt: PromptWire;
343
+ }) | (AgentV2NodeBaseWire & {
344
+ type: 'standard';
345
+ prompt: PromptWire;
346
+ toolUuids: string[];
347
+ toolUseSiteUuids?: string[];
348
+ knowledgeBaseUuids: string[];
349
+ customDataTableNames: string[];
350
+ builtInTools: NodeBuiltInCapabilities;
351
+ sopSpec: unknown;
352
+ overrides: {
353
+ voice?: {
354
+ voiceUuid: string | null;
355
+ };
356
+ llm?: {
357
+ model: string | null;
358
+ llmModelUuid: string | null;
359
+ temperature: number | null;
360
+ };
361
+ };
362
+ perTurnWebhook?: {
363
+ enabled: boolean;
364
+ url: string;
365
+ authToken?: string | null;
366
+ } | null;
367
+ perTurnExtractionFields?: ExtractionField[] | null;
368
+ perTurnAction?: (ActionUseSiteWire & {
369
+ trigger: 'every_turn';
370
+ }) | null;
371
+ }) | (AgentV2NodeBaseWire & {
372
+ type: 'http';
373
+ url: string;
374
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
375
+ headers: Record<string, string>;
376
+ body: unknown;
377
+ responseSelectors: {
378
+ name: string;
379
+ value: string;
380
+ }[];
381
+ runInBackground: boolean;
382
+ backgroundMessage: string | null;
383
+ executionMessage: string | null;
384
+ mockResponseData: unknown;
385
+ builtInTools: NodeBuiltInCapabilities;
386
+ }) | (AgentV2NodeBaseWire & {
387
+ type: 'action_node';
388
+ actionVersionUuid: string;
389
+ inputMappings: Record<string, string>;
390
+ outputParameterMappings: Record<string, string>;
391
+ runInBackground: boolean;
392
+ backgroundMessage: string | null;
393
+ executionMessage: string | null;
394
+ mockResponseData: unknown;
395
+ builtInTools: NodeBuiltInCapabilities;
396
+ }) | (AgentV2NodeBaseWire & {
397
+ type: 'extract';
398
+ fields: ExtractionField[];
399
+ executionMessage: string | null;
400
+ builtInTools: NodeBuiltInCapabilities;
401
+ }) | (AgentV2NodeBaseWire & {
402
+ type: 'say';
403
+ executionMessage: string | null;
404
+ overrides: {
405
+ voice?: {
406
+ voiceUuid: string | null;
407
+ };
408
+ };
409
+ builtInTools: NodeBuiltInCapabilities;
410
+ }) | (AgentV2NodeBaseWire & {
411
+ type: 'end_call';
412
+ executionMessage: string | null;
413
+ builtInTools: NodeBuiltInCapabilities;
414
+ }) | (AgentV2NodeBaseWire & {
415
+ type: 'routing';
416
+ description: string;
417
+ builtInTools: NodeBuiltInCapabilities;
418
+ }) | (AgentV2NodeBaseWire & {
419
+ type: 'ab_test';
420
+ abTestGroupUuid: string;
421
+ builtInTools: NodeBuiltInCapabilities;
422
+ }) | (AgentV2NodeBaseWire & {
423
+ type: 'transfer';
424
+ executionMessage: string | null;
425
+ builtInTools: NodeBuiltInCapabilities & {
426
+ transfer: TransferCapability;
427
+ };
428
+ }) | (AgentV2NodeBaseWire & {
429
+ type: 'transfer_chat';
430
+ executionMessage?: string | null;
431
+ mode?: 'five9' | 'teammate_handoff';
432
+ five9TenantName: string;
433
+ five9CampaignName: string;
434
+ five9ContactMapping: Record<string, unknown>;
435
+ five9AttributesMapping: Record<string, unknown>[];
436
+ builtInTools: NodeBuiltInCapabilities;
437
+ });
438
+ type AgentV2CommitContentWire = {
439
+ config: AgentV2ConfigWire;
440
+ nodes: AgentV2NodeWire[];
441
+ summaryPrompt: string | null;
442
+ };
443
+ type EdgeDefinition = {
444
+ key?: string;
445
+ to: string;
446
+ when: string;
447
+ priority?: number;
448
+ condition?: {
449
+ variable: string;
450
+ operator: string;
451
+ value: string;
452
+ } | null;
453
+ };
454
+ type NodeBaseDefinition = {
455
+ key: string;
456
+ name: string;
457
+ root?: boolean;
458
+ position?: {
459
+ x: number;
460
+ y: number;
461
+ };
462
+ waitAfterExecuting?: number;
463
+ edges?: EdgeDefinition[];
464
+ alwaysAvailable?: EnabledWithDescription;
465
+ };
466
+ type GlobalNodeDefinition = NodeBaseDefinition & {
467
+ type: 'global';
468
+ prompt: PromptReference;
469
+ };
470
+ type PromptNodeDefinition = NodeBaseDefinition & {
471
+ type: 'prompt';
472
+ prompt: PromptReference;
473
+ actions?: CallableActionDefinition[];
474
+ knowledgeBases?: RemoteReference[];
475
+ customDataTables?: string[];
476
+ sopSpec?: unknown;
477
+ voiceOverride?: {
478
+ voiceUuid: string | null;
479
+ };
480
+ llmOverride?: {
481
+ model: string | null;
482
+ modelUuid: string | null;
483
+ temperature: number | null;
484
+ };
485
+ vadMinSilenceDuration?: number;
486
+ waitAfterTransfer?: number;
487
+ perTurnWebhook?: {
488
+ enabled: boolean;
489
+ url: string;
490
+ authToken?: string | null;
491
+ } | null;
492
+ perTurnExtraction?: z.ZodObject<z.ZodRawShape> | null;
493
+ perTurnAction?: ActionRunDefinition | null;
494
+ transfer?: Pick<TransferCapability, 'enabled'> & Partial<Omit<TransferCapability, 'enabled'>>;
495
+ };
496
+ type ActionNodeDefinition = NodeBaseDefinition & {
497
+ type: 'action';
498
+ action: ActionDefinition;
499
+ inputs: Record<string, string>;
500
+ outputParameters?: ActionOutputParameters;
501
+ runInBackground?: boolean;
502
+ backgroundMessage?: string | null;
503
+ executionMessage?: string | null;
504
+ mockResponseData?: unknown;
505
+ };
506
+ /**
507
+ * An HTTP request node in the Agent graph.
508
+ *
509
+ * Prefer `action.http(...)` plus `node.action(...)` for new work: Actions are
510
+ * versioned and reusable, HTTP nodes are neither. This exists so Agents that
511
+ * already contain HTTP nodes can be pulled into, edited as, and published from
512
+ * real source instead of an opaque snapshot.
513
+ */
514
+ type HttpNodeDefinition = NodeBaseDefinition & {
515
+ type: 'http';
516
+ url: string;
517
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
518
+ headers?: Record<string, string>;
519
+ body?: unknown;
520
+ responseSelectors?: {
521
+ name: string;
522
+ value: string;
523
+ }[];
524
+ runInBackground?: boolean;
525
+ backgroundMessage?: string | null;
526
+ executionMessage?: string | null;
527
+ mockResponseData?: unknown;
528
+ };
529
+ type ExtractNodeDefinition = NodeBaseDefinition & {
530
+ type: 'extract';
531
+ schema: z.ZodObject<z.ZodRawShape>;
532
+ message?: string | null;
533
+ };
534
+ type SayNodeDefinition = NodeBaseDefinition & {
535
+ type: 'say';
536
+ /** `null` for a say node that has not been given its line yet. */
537
+ text: string | null;
538
+ voiceUuid?: string | null;
539
+ waitAfterSay?: number;
540
+ };
541
+ type EndCallNodeDefinition = NodeBaseDefinition & {
542
+ type: 'end-call';
543
+ message?: string | null;
544
+ };
545
+ type RouteNodeDefinition = NodeBaseDefinition & {
546
+ type: 'route';
547
+ description: string;
548
+ };
549
+ type AbTestNodeDefinition = NodeBaseDefinition & {
550
+ type: 'ab-test';
551
+ abTestGroupUuid: string;
552
+ };
553
+ type TransferNodeDefinition = NodeBaseDefinition & {
554
+ type: 'transfer';
555
+ message?: string | null;
556
+ phoneNumber: string;
557
+ mode?: 'cold' | 'warm';
558
+ timeout?: number;
559
+ description?: string | null;
560
+ voicemailMessage?: string | null;
561
+ waitAfterTransfer?: number;
562
+ };
563
+ type TransferChatNodeDefinition = NodeBaseDefinition & {
564
+ type: 'transfer-chat';
565
+ message?: string | null;
566
+ mode: 'five9' | 'teammate_handoff';
567
+ five9TenantName?: string;
568
+ five9CampaignName?: string;
569
+ five9ContactMapping?: Record<string, unknown>;
570
+ five9AttributesMapping?: Record<string, unknown>[];
571
+ };
572
+ type NodeDefinition = GlobalNodeDefinition | PromptNodeDefinition | ActionNodeDefinition | HttpNodeDefinition | ExtractNodeDefinition | SayNodeDefinition | EndCallNodeDefinition | RouteNodeDefinition | AbTestNodeDefinition | TransferNodeDefinition | TransferChatNodeDefinition;
573
+ type AgentDefinition = {
574
+ kind: 'agent-definition';
575
+ key: string;
576
+ name: string;
577
+ description: string | null;
578
+ branch: string;
579
+ modality: 'voice' | 'text';
580
+ folderUuid: string | null;
581
+ analyzerUuids: string[];
582
+ tagUuids: string[];
583
+ containmentConfig: unknown;
584
+ voice: {
585
+ voiceUuid: string | null;
586
+ backgroundNoise: BackgroundNoise;
587
+ };
588
+ llm: {
589
+ model: string;
590
+ modelUuid: string | null;
591
+ temperature: number;
592
+ };
593
+ speech: {
594
+ language: string;
595
+ keyterms: string[];
596
+ };
597
+ call: {
598
+ agentSpeaksFirst: boolean;
599
+ firstSentence: string | null;
600
+ maxCallLengthSeconds: number;
601
+ record: boolean;
602
+ checkInAfterSilence: {
603
+ enabled: boolean;
604
+ prompt: string | null;
605
+ };
606
+ endCallAfterExtendedSilence: boolean;
607
+ pciEnabled: boolean;
608
+ /**
609
+ * Background noise track, when it differs from `voice.backgroundNoise`.
610
+ *
611
+ * The product keeps the selected track after noise is switched off, so the
612
+ * two can legitimately disagree (`voice: 'off'`, track: `'coffee_shop'`).
613
+ * `null` mirrors `voice.backgroundNoise`, which is the common case.
614
+ */
615
+ backgroundNoiseTrack: BackgroundNoise | null;
616
+ /** `null` omits the gain entirely rather than sending a default. */
617
+ backgroundNoiseGain: number | null;
618
+ /** `null` omits interruption config entirely rather than defaulting it. */
619
+ interruptionMode: InterruptionMode | null;
620
+ };
621
+ preCallWebhook: {
622
+ enabled: boolean;
623
+ url: string | null;
624
+ authToken: string | null;
625
+ timeout: number;
626
+ parameters: string[];
627
+ };
628
+ capabilities: {
629
+ dtmf: EnabledWithDescription;
630
+ hangup: EnabledWithDescription & {
631
+ message: string | null;
632
+ };
633
+ transfer: TransferCapability;
634
+ };
635
+ knowledgeBases: RemoteReference[];
636
+ beforeCallAction: ActionRunDefinition | null;
637
+ summaryPrompt: string | null;
638
+ /**
639
+ * A/B test groups on the Agent.
640
+ *
641
+ * `null` derives the set from `ab-test` nodes, which is what authoring in code
642
+ * produces. Pulled Agents can carry groups with no corresponding node, so they
643
+ * set this explicitly.
644
+ */
645
+ abTestGroupIds: string[] | null;
646
+ nodes: NodeDefinition[];
647
+ };
648
+ type AgentDefinitionInput = {
649
+ key: string;
650
+ name: string;
651
+ description?: string | null;
652
+ branch: string;
653
+ modality?: 'voice' | 'text';
654
+ folderUuid?: string | null;
655
+ analyzerUuids?: string[];
656
+ tagUuids?: string[];
657
+ containmentConfig?: unknown;
658
+ voice?: {
659
+ voiceUuid?: string | null;
660
+ backgroundNoise?: BackgroundNoise;
661
+ };
662
+ llm?: {
663
+ model?: string;
664
+ modelUuid?: string | null;
665
+ temperature?: number;
666
+ };
667
+ speech?: {
668
+ language?: string;
669
+ keyterms?: string[];
670
+ };
671
+ call?: Partial<AgentDefinition['call']>;
672
+ preCallWebhook?: Partial<AgentDefinition['preCallWebhook']>;
673
+ capabilities?: {
674
+ dtmf?: Partial<EnabledWithDescription>;
675
+ hangup?: Partial<EnabledWithDescription & {
676
+ message: string | null;
677
+ }>;
678
+ transfer?: Partial<TransferCapability>;
679
+ };
680
+ knowledgeBases?: RemoteReference[];
681
+ beforeCallAction?: ActionRunDefinition | null;
682
+ summaryPrompt?: string | null;
683
+ abTestGroupIds?: string[] | null;
684
+ nodes: NodeDefinition[];
685
+ };
686
+ type AgentIdentityKind = 'node' | 'edge' | 'action-use-site' | 'action-version-placeholder';
687
+ type AgentCompileOptions = {
688
+ actionVersionUuids?: Record<string, string>;
689
+ identity?: (input: {
690
+ kind: AgentIdentityKind;
691
+ key: string;
692
+ }) => string | undefined;
693
+ readPromptFile?: (path: string) => string;
694
+ readActionSourceFile?: (path: string) => string;
695
+ allowUnresolvedActionVersions?: boolean;
696
+ };
697
+ type CompiledAgentProject = {
698
+ agent: {
699
+ key: string;
700
+ name: string;
701
+ description: string | null;
702
+ modality: 'voice' | 'text';
703
+ folderUuid: string | null;
704
+ analyzerUuids: string[];
705
+ tagUuids: string[];
706
+ containmentConfig: unknown;
707
+ };
708
+ branch: {
709
+ name: string;
710
+ };
711
+ actions: {
712
+ key: string;
713
+ versionUuid: string;
714
+ values: ActionVersionValues;
715
+ }[];
716
+ content: AgentV2CommitContentWire;
717
+ };
718
+ declare function defineAgent(input: AgentDefinitionInput): AgentDefinition;
719
+ declare const node: {
720
+ global(config: Omit<GlobalNodeDefinition, "type">): GlobalNodeDefinition;
721
+ prompt(config: Omit<PromptNodeDefinition, "type">): PromptNodeDefinition;
722
+ action(config: Omit<ActionNodeDefinition, "type">): ActionNodeDefinition;
723
+ http(config: Omit<HttpNodeDefinition, "type">): HttpNodeDefinition;
724
+ extract(config: Omit<ExtractNodeDefinition, "type">): ExtractNodeDefinition;
725
+ say(config: Omit<SayNodeDefinition, "type">): SayNodeDefinition;
726
+ endCall(config: Omit<EndCallNodeDefinition, "type">): EndCallNodeDefinition;
727
+ route(config: Omit<RouteNodeDefinition, "type">): RouteNodeDefinition;
728
+ abTest(config: Omit<AbTestNodeDefinition, "type">): AbTestNodeDefinition;
729
+ transfer(config: Omit<TransferNodeDefinition, "type">): TransferNodeDefinition;
730
+ transferChat(config: Omit<TransferChatNodeDefinition, "type">): TransferChatNodeDefinition;
731
+ };
732
+ declare const prompt: {
733
+ inline(text: string | null, example?: string | null, generatedExamples?: unknown): PromptReference;
734
+ file(path: string, example?: string | null): PromptReference;
735
+ version(versionId: string): PromptReference;
736
+ };
737
+ declare function reference(uuid: string): RemoteReference;
738
+ declare function canonicalAuthoringKey(value: string, fallback: string): string;
739
+ declare function canonicalAuthoringKeys(values: {
740
+ value: string;
741
+ fallback: string;
742
+ }[]): string[];
743
+ declare function compileAgent(definition: AgentDefinition, options?: AgentCompileOptions): CompiledAgentProject;
744
+
3
745
  type FetchLike = (url: string, init: RequestInit) => Promise<Response>;
4
746
  type HttpClient = {
5
747
  request: (args: {
@@ -199,4 +941,21 @@ declare class SimpleAIError extends Error {
199
941
  });
200
942
  }
201
943
 
202
- export { type ActionContext, type ActionHandler, type BatchUpsertResult, DataClient, type DataFilter, type DataRecord, type DeleteResult, type FacetsResult, type IngestBatchStatus, type ListOptions, type ListResult, MAX_BATCH_ROWS, MAX_QUERY_SIZE, type QueryInput, type QueryResult, type RecordPayload, type RecordResult, SIMPLE_ACTION_BRAND, SimpleAI, SimpleAIError, type SimpleAIOptions, batchUpsertRowsSchema, dataColumnPathSchema, dataFilterSchema, defineAction, listOptionsSchema, queryInputSchema, recordPayloadSchema, tableNameSchema };
944
+ type AgentProjectSource = AgentDefinition | AgentSnapshotDefinition;
945
+ type SnapshotAction = {
946
+ key: string;
947
+ sourceVersionUuid: string;
948
+ values: ActionVersionValues;
949
+ };
950
+ type AgentSnapshotDefinition = {
951
+ kind: 'agent-snapshot';
952
+ agent: CompiledAgentProject['agent'];
953
+ branch: CompiledAgentProject['branch'];
954
+ actions: SnapshotAction[];
955
+ content: AgentV2CommitContentWire;
956
+ };
957
+ declare function defineAgentSnapshot(definition: Omit<AgentSnapshotDefinition, 'kind'>): AgentSnapshotDefinition;
958
+ declare function compileAgentProject(definition: AgentProjectSource, options?: AgentCompileOptions): CompiledAgentProject;
959
+ declare function collectActionVersionUuids(content: AgentV2CommitContentWire): string[];
960
+
961
+ export { type AbTestNodeDefinition, type ActionCompileOptions, type ActionContext, type ActionDefinition, type ActionHandler, type ActionNodeDefinition, type ActionOutputParameters, type ActionRunDefinition, type ActionVersionValues, type ActionsIoSchema, type ActionsIoSchemaNode, type AgentActionInput, type AgentCompileOptions, type AgentDefinition, type AgentDefinitionInput, type AgentIdentityKind, type AgentProjectSource, type AgentSnapshotDefinition, type AgentV2CommitContentWire, type AgentV2ConfigWire, type AgentV2EdgeWire, type AgentV2NodeWire, type BackgroundNoise, type BatchUpsertResult, type CallableActionDefinition, type CompiledAgentProject, DataClient, type DataFilter, type DataRecord, type DeleteResult, type EdgeDefinition, type EnabledWithDescription, type EndCallNodeDefinition, type ExtractNodeDefinition, type ExtractionField, type FacetsResult, type GlobalNodeDefinition, type HttpNodeDefinition, type IngestBatchStatus, type InlineActionDefinition, type InterruptionMode, type ListOptions, type ListResult, MAX_BATCH_ROWS, MAX_QUERY_SIZE, type NodeDefinition, type PromptNodeDefinition, type PromptReference, type QueryInput, type QueryResult, type RecordPayload, type RecordResult, type ReferencedActionDefinition, type RemoteReference, type RouteNodeDefinition, SIMPLE_ACTION_BRAND, type SayNodeDefinition, SimpleAI, SimpleAIError, type SimpleAIOptions, type SnapshotAction, type SourceFileReference, type ToolUseSiteWire, type TransferCapability, type TransferChatNodeDefinition, type TransferNodeDefinition, action, actionsIoSchemaFromZod, batchUpsertRowsSchema, canonicalAuthoringKey, canonicalAuthoringKeys, collectActionVersionUuids, compileAction, compileAgent, compileAgentProject, dataColumnPathSchema, dataFilterSchema, defineAction, defineAgent, defineAgentSnapshot, listOptionsSchema, node, prompt, queryInputSchema, recordPayloadSchema, reference, sourceFile, tableNameSchema };