@simple-ai-lab/sdk 0.4.0 → 0.8.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 (78) hide show
  1. package/README.md +79 -1
  2. package/dist/actions.cjs +452 -0
  3. package/dist/actions.d.cts +348 -0
  4. package/dist/actions.d.ts +348 -0
  5. package/dist/actions.js +443 -0
  6. package/dist/agents.cjs +1176 -0
  7. package/dist/agents.d.cts +1138 -0
  8. package/dist/agents.d.ts +1138 -0
  9. package/dist/agents.js +1166 -0
  10. package/dist/built-in-actions.cjs +456 -0
  11. package/dist/built-in-actions.d.cts +53 -0
  12. package/dist/built-in-actions.d.ts +53 -0
  13. package/dist/built-in-actions.js +453 -0
  14. package/dist/client.cjs +29 -0
  15. package/dist/client.d.cts +15 -0
  16. package/dist/client.d.ts +15 -0
  17. package/dist/client.js +25 -0
  18. package/dist/code-action/defaults.cjs +11 -0
  19. package/dist/code-action/defaults.d.cts +7 -0
  20. package/dist/code-action/defaults.d.ts +7 -0
  21. package/dist/code-action/defaults.js +8 -0
  22. package/dist/code-action/define-action.cjs +78 -0
  23. package/dist/code-action/define-action.d.cts +99 -0
  24. package/dist/code-action/define-action.d.ts +99 -0
  25. package/dist/code-action/define-action.js +73 -0
  26. package/dist/code-action/index.cjs +11 -0
  27. package/dist/code-action/index.d.cts +4 -0
  28. package/dist/code-action/index.d.ts +4 -0
  29. package/dist/code-action/index.js +3 -0
  30. package/dist/code-action/llm.cjs +34 -0
  31. package/dist/code-action/llm.d.cts +28 -0
  32. package/dist/code-action/llm.d.ts +28 -0
  33. package/dist/code-action/llm.js +31 -0
  34. package/dist/code-action/types.cjs +14 -0
  35. package/dist/code-action/types.d.cts +19 -0
  36. package/dist/code-action/types.d.ts +19 -0
  37. package/dist/code-action/types.js +11 -0
  38. package/dist/code-action/workflow.cjs +29 -0
  39. package/dist/code-action/workflow.d.cts +53 -0
  40. package/dist/code-action/workflow.d.ts +53 -0
  41. package/dist/code-action/workflow.js +26 -0
  42. package/dist/data.cjs +98 -0
  43. package/dist/data.d.cts +44 -0
  44. package/dist/data.d.ts +44 -0
  45. package/dist/data.js +94 -0
  46. package/dist/http.cjs +72 -0
  47. package/dist/http.d.cts +14 -0
  48. package/dist/http.d.ts +14 -0
  49. package/dist/http.js +69 -0
  50. package/dist/index.cjs +71 -1597
  51. package/dist/index.d.cts +12 -780
  52. package/dist/index.d.ts +12 -780
  53. package/dist/index.js +10 -1311
  54. package/dist/projects.cjs +234 -0
  55. package/dist/projects.d.cts +24 -0
  56. package/dist/projects.d.ts +24 -0
  57. package/dist/projects.js +228 -0
  58. package/dist/schemas.cjs +50 -0
  59. package/dist/schemas.d.cts +81 -0
  60. package/dist/schemas.d.ts +81 -0
  61. package/dist/schemas.js +47 -0
  62. package/dist/shared/errors.cjs +31 -0
  63. package/dist/shared/errors.d.cts +22 -0
  64. package/dist/shared/errors.d.ts +22 -0
  65. package/dist/shared/errors.js +26 -0
  66. package/package.json +27 -31
  67. package/dist/chunk-V4E5PSKB.js +0 -267
  68. package/dist/chunk-V4E5PSKB.js.map +0 -1
  69. package/dist/code-action-CDt77m7I.d.cts +0 -191
  70. package/dist/code-action-CDt77m7I.d.ts +0 -191
  71. package/dist/code-action.cjs +0 -282
  72. package/dist/code-action.cjs.map +0 -1
  73. package/dist/code-action.d.cts +0 -2
  74. package/dist/code-action.d.ts +0 -2
  75. package/dist/code-action.js +0 -9
  76. package/dist/code-action.js.map +0 -1
  77. package/dist/index.cjs.map +0 -1
  78. package/dist/index.js.map +0 -1
@@ -0,0 +1,1138 @@
1
+ import { z } from 'zod';
2
+ import type { ActionDefinition, ActionOutputParameterMappings, ActionOutputParameters, ActionRunDefinition, ActionVersionValues, BackgroundMessage, CallableActionDefinition, SourceFileReference } from "./actions.cjs";
3
+ /** A leaf path: `currentNode.name`, or a dot-delimited path rooted at `params`. */
4
+ export type TransitionFilterPath = string;
5
+ export type TransitionFilterValue = string | number | boolean | null;
6
+ export declare const TRANSITION_FILTER_EQUALITY_OPERATORS: readonly ["equals", "not_equals"];
7
+ export declare const TRANSITION_FILTER_NUMERIC_OPERATORS: readonly ["greater_than", "greater_than_or_equals", "less_than", "less_than_or_equals"];
8
+ export declare const TRANSITION_FILTER_CONTAINS_OPERATORS: readonly ["contains", "not_contains"];
9
+ export declare const TRANSITION_FILTER_STRING_OPERATORS: readonly ["starts_with", "ends_with"];
10
+ export declare const TRANSITION_FILTER_EXISTENCE_OPERATORS: readonly ["exists", "not_exists"];
11
+ export type TransitionFilterCondition = {
12
+ path: TransitionFilterPath;
13
+ operator: (typeof TRANSITION_FILTER_EQUALITY_OPERATORS)[number];
14
+ value: TransitionFilterValue;
15
+ } | {
16
+ path: TransitionFilterPath;
17
+ operator: (typeof TRANSITION_FILTER_NUMERIC_OPERATORS)[number];
18
+ value: number;
19
+ } | {
20
+ path: TransitionFilterPath;
21
+ operator: (typeof TRANSITION_FILTER_CONTAINS_OPERATORS)[number];
22
+ value: TransitionFilterValue;
23
+ } | {
24
+ path: TransitionFilterPath;
25
+ operator: (typeof TRANSITION_FILTER_STRING_OPERATORS)[number];
26
+ value: string;
27
+ } | {
28
+ path: TransitionFilterPath;
29
+ operator: (typeof TRANSITION_FILTER_EXISTENCE_OPERATORS)[number];
30
+ };
31
+ /**
32
+ * An inline-JavaScript predicate evaluated every turn. `code` is a full
33
+ * `function isAvailable(params) { ... }` declaration returning a boolean, which
34
+ * the Agent runs sandboxed.
35
+ */
36
+ export type TransitionFilterJs = {
37
+ type: 'js_filter';
38
+ code: string;
39
+ };
40
+ /**
41
+ * A deterministic condition evaluated inside the Agent process. `all`, `any`
42
+ * and `not` compose leaves into a condition tree.
43
+ *
44
+ * An edge filter may not read `currentNode.name`, because a node's own
45
+ * transitions always run from that node; an always-available filter may.
46
+ */
47
+ export type TransitionFilter = TransitionFilterCondition | TransitionFilterJs | {
48
+ all: TransitionFilter[];
49
+ } | {
50
+ any: TransitionFilter[];
51
+ } | {
52
+ not: TransitionFilter;
53
+ };
54
+ export declare const TRANSITION_FILTER_MAX_DEPTH = 8;
55
+ export declare const TRANSITION_FILTER_MAX_CONDITIONS = 100;
56
+ /**
57
+ * Declarative availability filter. Agent v2 owns the evaluator and validates
58
+ * filters when a commit is created; the SDK carries the value and checks only
59
+ * its shape.
60
+ */
61
+ export type TransitionFilterWire = TransitionFilter;
62
+ /** `disabled` stays silent, `authored` speaks `text` verbatim, `model` treats `text` as its instructions. */
63
+ export type TransitionMessageWire = {
64
+ source: 'disabled' | 'authored' | 'model';
65
+ text: string;
66
+ };
67
+ /** Speaking on a transition is opt-in per edge. */
68
+ export declare const DEFAULT_TRANSITION_MESSAGE: TransitionMessageWire;
69
+ export type BackgroundNoise = 'office' | 'coffee_shop' | 'driving' | 'restaurant' | 'street' | 'airport' | 'shopping_mall' | 'park' | 'off';
70
+ /**
71
+ * Agent v2's `call.backgroundNoise`: the track played under the call, and how
72
+ * loud it is relative to the recorded track.
73
+ */
74
+ export type BackgroundNoiseConfig = {
75
+ trackName: BackgroundNoise;
76
+ /** Optional in Agent v2, so leaving it out keeps the key out of the commit. */
77
+ gainMultiplier?: number;
78
+ };
79
+ /**
80
+ * The `call.backgroundNoise` a definition that says nothing about it compiles
81
+ * to, taken from `voice.backgroundNoise`. The CLI renders against this to tell
82
+ * a block it has to write from one `defineAgent` produces on its own.
83
+ */
84
+ export declare function defaultBackgroundNoise({ voiceBackgroundNoise, }: {
85
+ voiceBackgroundNoise: BackgroundNoise;
86
+ }): BackgroundNoiseConfig;
87
+ /** How readily the agent yields the floor to a caller talking over it, 1 (most reluctant) to 5 (stops on every barge-in). */
88
+ export type InterruptionEagerness = 1 | 2 | 3 | 4 | 5;
89
+ /** How eagerly end-of-turn detection hands the floor back, 1 (most patient) to 5 (most eager). */
90
+ export type EotEagerness = 1 | 2 | 3 | 4 | 5;
91
+ /**
92
+ * Automatic knowledge-base retrieval on every user turn. Independent of a prompt
93
+ * node's `knowledgeBases`, which builds the model-invoked search tool: a node can
94
+ * retrieve from a knowledge base it exposes no tool for, and vice versa.
95
+ */
96
+ export type PerTurnRetrievalWire = {
97
+ enabled: boolean;
98
+ knowledgeBaseUuids: string[];
99
+ topK: number;
100
+ recentTurns: number;
101
+ minScore: number | null;
102
+ };
103
+ /**
104
+ * How the agent should say a word the voice would otherwise mangle: `match` is
105
+ * compared case-sensitively against whole words, `say` is what gets spoken.
106
+ */
107
+ export type Pronunciation = {
108
+ match: string;
109
+ say: string;
110
+ };
111
+ export type RemoteReference = {
112
+ uuid: string;
113
+ };
114
+ /** How long the agent waits before checking in on a silent caller. Matches the product default. */
115
+ export declare const DEFAULT_CHECK_IN_AFTER_SILENCE_DELAY_SECONDS = 30;
116
+ /**
117
+ * Authored form: `delaySeconds` is left absent when it is not authored, so a
118
+ * commit that never carried the key keeps it that way. The runtime falls back to
119
+ * `DEFAULT_CHECK_IN_AFTER_SILENCE_DELAY_SECONDS` for an absent value.
120
+ */
121
+ export type CheckInAfterSilence = {
122
+ enabled: boolean;
123
+ prompt: string | null;
124
+ delaySeconds?: number;
125
+ };
126
+ /** Input form: `delaySeconds` may be left off to accept the default. */
127
+ export type CheckInAfterSilenceInput = {
128
+ enabled: boolean;
129
+ prompt: string | null;
130
+ delaySeconds?: number;
131
+ };
132
+ /** A prompt example, given inline or as a file read with `readPromptFile` at compile time. */
133
+ export type PromptExample = string | null | SourceFileReference;
134
+ export type PromptReference = {
135
+ kind: 'inline';
136
+ text: string | null;
137
+ example: PromptExample;
138
+ generatedExamples?: GeneratedExamples | null;
139
+ } | {
140
+ kind: 'file';
141
+ path: string;
142
+ example: PromptExample;
143
+ } | {
144
+ kind: 'version';
145
+ versionId: string;
146
+ };
147
+ export type ExtractionField = {
148
+ name: string;
149
+ type: string;
150
+ description: string;
151
+ required: boolean;
152
+ enum?: (string | number | boolean)[];
153
+ items?: ExtractionField;
154
+ properties?: ExtractionField[];
155
+ };
156
+ export type AgentV2EdgeWire = {
157
+ uuid: string;
158
+ toNodeUuid: string;
159
+ description: string;
160
+ priority: number;
161
+ condition: {
162
+ variable: string;
163
+ operator: string;
164
+ value: string;
165
+ } | null;
166
+ /** Optional only for commit snapshots written before edge filters existed. */
167
+ filter?: TransitionFilterWire | null;
168
+ message: TransitionMessageWire;
169
+ agentContext: string | null;
170
+ };
171
+ export type EnabledWithDescription = {
172
+ enabled: boolean;
173
+ description: string | null;
174
+ };
175
+ export type AlwaysAvailableTransitionFilterWire = TransitionFilterWire;
176
+ export type AlwaysAvailableCapability = EnabledWithDescription & {
177
+ filter?: TransitionFilterWire | null;
178
+ };
179
+ export type TransferCapability = {
180
+ enabled: boolean;
181
+ phoneNumber: string | null;
182
+ timeout: number;
183
+ mode: 'cold' | 'warm';
184
+ description: string | null;
185
+ voicemailMessage: string | null;
186
+ };
187
+ type NodeBuiltInCapabilities = {
188
+ alwaysAvailable?: EnabledWithDescription & {
189
+ filter?: AlwaysAvailableTransitionFilterWire | null;
190
+ };
191
+ transfer?: TransferCapability;
192
+ };
193
+ type PromptWire = {
194
+ type: 'inline';
195
+ prompt: string | null;
196
+ example: string | null;
197
+ generatedExamples?: GeneratedExamples | null;
198
+ } | {
199
+ type: 'reference';
200
+ promptVersionId: string;
201
+ };
202
+ type ActionUseSiteWire = {
203
+ actionUseSiteUuid: string;
204
+ actionVersionUuid: string;
205
+ inputMappings: Record<string, string>;
206
+ outputParameterMappings: Record<string, string>;
207
+ };
208
+ export type ToolUseSiteWire = ActionUseSiteWire & {
209
+ name: string;
210
+ description: string;
211
+ inputDescriptions: Record<string, string>;
212
+ /**
213
+ * Spoken while the Action runs. The platform stores `null` when none is set;
214
+ * commits that predate the field omit the key, and normalization fills null.
215
+ */
216
+ backgroundMessage?: BackgroundMessage | null;
217
+ };
218
+ /** A JSON Pointer into a cart value; the empty pointer means the value itself. */
219
+ export type CartPointer = string;
220
+ export type CartSummaryLineWire = {
221
+ key: string;
222
+ label: string;
223
+ amount: CartPointer;
224
+ };
225
+ /** Where things are inside the cart parameter. Mirrors server-v2's `cartViewMappingSchema`. */
226
+ export type CartViewWire = {
227
+ currency: string;
228
+ amountUnit: 'dollars' | 'cents';
229
+ sections: {
230
+ from: CartPointer | null;
231
+ title: CartPointer | null;
232
+ rows: {
233
+ from: CartPointer;
234
+ key: CartPointer;
235
+ label: CartPointer;
236
+ quantity: CartPointer | null;
237
+ amount: CartPointer | null;
238
+ unitPrice: CartPointer | null;
239
+ detail: CartPointer | null;
240
+ children: {
241
+ from: CartPointer;
242
+ label: CartPointer;
243
+ quantity: CartPointer | null;
244
+ } | null;
245
+ };
246
+ summary: CartSummaryLineWire[];
247
+ };
248
+ summary: CartSummaryLineWire[];
249
+ totalKey: string | null;
250
+ };
251
+ export type CartCheckoutWhenWire = {
252
+ kind: 'action_succeeded';
253
+ actionUseSiteUuids: string[];
254
+ } | {
255
+ kind: 'node_reached';
256
+ nodeUuids: string[];
257
+ } | {
258
+ kind: 'parameter_equals';
259
+ parameter: string;
260
+ value: string | number | boolean | null;
261
+ };
262
+ /** Mirrors server-v2's `cartConfigSchema`. */
263
+ export type CartConfigWire = {
264
+ parameter: string;
265
+ view: CartViewWire;
266
+ reasonArgument: string | null;
267
+ actions: {
268
+ actionUseSiteUuid: string;
269
+ label: string;
270
+ }[];
271
+ checkout: {
272
+ when: CartCheckoutWhenWire;
273
+ orderIds: {
274
+ from: CartPointer | null;
275
+ id: CartPointer;
276
+ } | null;
277
+ } | null;
278
+ };
279
+ export type AgentV2ConfigWire = {
280
+ voice: {
281
+ voiceUuid: string | null;
282
+ backgroundNoise: BackgroundNoise;
283
+ };
284
+ llm: {
285
+ model: string;
286
+ llmModelUuid: string | null;
287
+ temperature: number;
288
+ };
289
+ speech: {
290
+ language: string;
291
+ keyterms: string[];
292
+ voiceFormattingEnabled?: boolean;
293
+ pronunciations?: Pronunciation[];
294
+ };
295
+ /** Free-text guidance on how the agent should sound. Omitted by commits that predate the setting. */
296
+ toneGuidelines?: string | null;
297
+ call: {
298
+ agentSpeaksFirst: boolean;
299
+ firstSentence: string | null;
300
+ maxCallLengthSeconds: number;
301
+ record: boolean;
302
+ checkInAfterSilence: {
303
+ enabled: boolean;
304
+ prompt: string | null;
305
+ /** Optional only for commit snapshots written before the delay was configurable. */
306
+ delaySeconds?: number;
307
+ };
308
+ endCallAfterExtendedSilence: boolean;
309
+ pciEnabled: boolean;
310
+ /** Absent in commits with no background noise configured. */
311
+ backgroundNoise?: BackgroundNoiseConfig;
312
+ /** Optional only for commit snapshots written before the Voice Analysis settings existed. */
313
+ voiceAnalysisConfig?: {
314
+ interruptionEagerness?: InterruptionEagerness;
315
+ endOfTurnEagerness?: EotEagerness;
316
+ };
317
+ };
318
+ preCallWebhook: {
319
+ enabled: boolean;
320
+ url: string | null;
321
+ authToken: string | null;
322
+ timeout: number;
323
+ parameters: string[];
324
+ };
325
+ builtInTools: {
326
+ dtmf: EnabledWithDescription;
327
+ hangup: {
328
+ enabled: boolean;
329
+ description: string | null;
330
+ message: string | null;
331
+ };
332
+ transfer: TransferCapability;
333
+ };
334
+ assignedToolIds: string[];
335
+ toolUseSites?: ToolUseSiteWire[];
336
+ automaticActions: {
337
+ beforeCallStart: (ActionUseSiteWire & {
338
+ trigger: 'before_call_start';
339
+ }) | null;
340
+ };
341
+ knowledgeBaseIds: string[];
342
+ abTestGroupIds: string[];
343
+ /** Absent in commits written before carts existed. */
344
+ cart?: CartConfigWire | null;
345
+ };
346
+ type AgentV2NodeBaseWire = {
347
+ uuid: string;
348
+ name: string;
349
+ isRoot: boolean;
350
+ position: {
351
+ x: number;
352
+ y: number;
353
+ };
354
+ behavior: {
355
+ waitAfterExecuting: number;
356
+ [key: string]: number | undefined;
357
+ };
358
+ edges: AgentV2EdgeWire[];
359
+ builtInTools?: NodeBuiltInCapabilities;
360
+ };
361
+ export type AgentV2NodeWire = (AgentV2NodeBaseWire & {
362
+ type: 'global';
363
+ prompt: PromptWire;
364
+ }) | (AgentV2NodeBaseWire & {
365
+ type: 'standard';
366
+ prompt: PromptWire;
367
+ toolUuids: string[];
368
+ toolUseSiteUuids?: string[];
369
+ knowledgeBaseUuids: string[];
370
+ customDataTableNames: string[];
371
+ builtInTools: NodeBuiltInCapabilities;
372
+ sopSpec: SopSpec | null;
373
+ overrides: {
374
+ voice?: {
375
+ voiceUuid: string | null;
376
+ };
377
+ llm?: LlmOverrideWire;
378
+ };
379
+ perTurnWebhook?: {
380
+ enabled: boolean;
381
+ url: string;
382
+ authToken?: string | null;
383
+ } | null;
384
+ perTurnExtractionFields?: ExtractionField[] | null;
385
+ perTurnRetrieval?: PerTurnRetrievalWire | null;
386
+ perTurnAction?: (ActionUseSiteWire & {
387
+ trigger: 'every_turn';
388
+ }) | null;
389
+ }) | (AgentV2NodeBaseWire & {
390
+ type: 'http';
391
+ url: string;
392
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
393
+ headers: Record<string, string>;
394
+ body: unknown;
395
+ responseSelectors: {
396
+ name: string;
397
+ value: string;
398
+ }[];
399
+ runInBackground: boolean;
400
+ backgroundMessage: string | null;
401
+ executionMessage: string | null;
402
+ mockResponseData: unknown;
403
+ builtInTools: NodeBuiltInCapabilities;
404
+ }) | (AgentV2NodeBaseWire & {
405
+ type: 'action_node';
406
+ actionVersionUuid: string;
407
+ inputMappings: Record<string, string>;
408
+ outputParameterMappings: Record<string, string>;
409
+ runInBackground: boolean;
410
+ backgroundMessage: string | null;
411
+ executionMessage: string | null;
412
+ mockResponseData: unknown;
413
+ builtInTools: NodeBuiltInCapabilities;
414
+ }) | (AgentV2NodeBaseWire & {
415
+ type: 'extract';
416
+ fields: ExtractionField[];
417
+ /**
418
+ * A shared Schema to extract with instead of `fields`, which must then be
419
+ * empty. The platform stores `null` when none is set; commits that predate
420
+ * the field omit the key, and normalization fills null.
421
+ */
422
+ schemaUuid?: string | null;
423
+ executionMessage: string | null;
424
+ builtInTools: NodeBuiltInCapabilities;
425
+ }) | (AgentV2NodeBaseWire & {
426
+ type: 'say';
427
+ executionMessage: string | null;
428
+ overrides: {
429
+ voice?: {
430
+ voiceUuid: string | null;
431
+ };
432
+ };
433
+ builtInTools: NodeBuiltInCapabilities;
434
+ }) | (AgentV2NodeBaseWire & {
435
+ type: 'end_call';
436
+ executionMessage: string | null;
437
+ /**
438
+ * Five9 routing headers attached to the BYE that ends the call; values are
439
+ * templates rendered against call parameters at hangup. Optional only for
440
+ * commit snapshots written before the setting existed.
441
+ */
442
+ sipByeHeaders?: Record<string, string>;
443
+ builtInTools: NodeBuiltInCapabilities;
444
+ }) | (AgentV2NodeBaseWire & {
445
+ type: 'ab_test';
446
+ abTestGroupUuid: string;
447
+ builtInTools: NodeBuiltInCapabilities;
448
+ }) | (AgentV2NodeBaseWire & {
449
+ type: 'update_parameters';
450
+ /** No model runs here, so the platform stores no capabilities for this node. */
451
+ parameterUpdates: ParameterUpdate[];
452
+ }) | (AgentV2NodeBaseWire & {
453
+ type: 'static_router';
454
+ /**
455
+ * Carried only so the router can be marked always-available: a standard
456
+ * node hands off to it and is then routed onward by its conditions.
457
+ */
458
+ builtInTools: NodeBuiltInCapabilities;
459
+ }) | (AgentV2NodeBaseWire & {
460
+ type: 'collect_credit_card';
461
+ instructions: string | null;
462
+ /** When true the authored instructions replace the built-in collector prompt. */
463
+ overrideCollectorPrompt?: boolean;
464
+ toolUseSiteUuids?: string[];
465
+ /**
466
+ * Only the responder that talks to the caller. The silent per-turn card
467
+ * extraction is pinned to a fixed model and is not authorable.
468
+ */
469
+ overrides: {
470
+ llm?: LlmOverrideWire;
471
+ };
472
+ }) | (AgentV2NodeBaseWire & {
473
+ type: 'transfer';
474
+ executionMessage: string | null;
475
+ builtInTools: NodeBuiltInCapabilities & {
476
+ transfer: TransferCapability;
477
+ };
478
+ }) | (AgentV2NodeBaseWire & {
479
+ type: 'transfer_chat';
480
+ executionMessage?: string | null;
481
+ mode?: 'five9' | 'teammate_handoff';
482
+ five9TenantName: string;
483
+ five9CampaignName: string;
484
+ five9ContactMapping: Record<string, unknown>;
485
+ five9AttributesMapping: Record<string, unknown>[];
486
+ builtInTools: NodeBuiltInCapabilities;
487
+ });
488
+ export type AgentV2CommitContentWire = {
489
+ config: AgentV2ConfigWire;
490
+ nodes: AgentV2NodeWire[];
491
+ summaryPrompt: string | null;
492
+ };
493
+ export type EdgeDefinition = {
494
+ key?: string;
495
+ to: string;
496
+ when: string;
497
+ priority?: number;
498
+ condition?: {
499
+ variable: string;
500
+ operator: string;
501
+ value: string;
502
+ } | null;
503
+ /** Model-routed availability guard; mutually exclusive with `condition`. */
504
+ filter?: TransitionFilterWire | null;
505
+ message?: TransitionMessageWire;
506
+ /** Told to the agent as this edge is taken, on the transition tool result. */
507
+ agentContext?: string | null;
508
+ };
509
+ /**
510
+ * One row of an Update Parameters node's map. Mirrors `ParameterUpdateSchema`
511
+ * in `@simple-ai-lab/shared` (`serialization/calls.ts`), which this package
512
+ * cannot depend on. Values resolve against the parameters as of node entry, so
513
+ * row order never changes the outcome.
514
+ */
515
+ export type ParameterUpdate = {
516
+ name: string;
517
+ value: string;
518
+ };
519
+ /** A per-node model override on the wire, where the model UUID is `llmModelUuid`. */
520
+ export type LlmOverrideWire = {
521
+ model: string | null;
522
+ llmModelUuid: string | null;
523
+ temperature: number | null;
524
+ };
525
+ /**
526
+ * Authoring form of `LlmOverrideWire`. Every node that can override the model
527
+ * takes this one type, so the prompt node and the collect-credit-card node
528
+ * cannot drift; `modelUuid` is the authoring spelling of `llmModelUuid`.
529
+ */
530
+ export type LlmOverrideDefinition = {
531
+ model: string | null;
532
+ modelUuid: string | null;
533
+ temperature: number | null;
534
+ };
535
+ type NodeBaseDefinition = {
536
+ key: string;
537
+ name: string;
538
+ root?: boolean;
539
+ position?: {
540
+ x: number;
541
+ y: number;
542
+ };
543
+ waitAfterExecuting?: number;
544
+ edges?: EdgeDefinition[];
545
+ alwaysAvailable?: AlwaysAvailableCapability;
546
+ };
547
+ export type GlobalNodeDefinition = NodeBaseDefinition & {
548
+ type: 'global';
549
+ prompt: PromptReference;
550
+ };
551
+ /** A tool a SOP section may use, by the uuid the graph already assigns it. */
552
+ export declare const SOP_TOOL_REF_TYPES: readonly ["http", "knowledge-base", "action"];
553
+ export type SopToolRef = {
554
+ type: (typeof SOP_TOOL_REF_TYPES)[number];
555
+ uuid: string;
556
+ };
557
+ /**
558
+ * A section's scoping of one edge's transition tool. An edge becomes restricted
559
+ * once a section sets `restrictToSection`, and is then offered only in sections
560
+ * that set it; `description` overrides the tool's wording for this section.
561
+ */
562
+ export type SopSectionEdge = {
563
+ edgeUuid: string;
564
+ description: string | null;
565
+ restrictToSection: boolean;
566
+ };
567
+ export type SopSection = {
568
+ uuid: string;
569
+ id: string;
570
+ name: string;
571
+ header: string;
572
+ prompt: string;
573
+ exampleUtterances: string[];
574
+ tools: SopToolRef[];
575
+ /** Absent means no edges are scoped. */
576
+ edges?: SopSectionEdge[];
577
+ };
578
+ export type SopGlobalContext = {
579
+ globalPrompt: string;
580
+ globalTools: SopToolRef[];
581
+ };
582
+ /** A node's standard operating procedure: shared context plus ordered sections. */
583
+ export type SopSpec = {
584
+ globalContext: SopGlobalContext;
585
+ sections: SopSection[];
586
+ };
587
+ /** The policy distilled from a node prompt, ordered most-important-first. */
588
+ export type GeneratedExamplesPolicy = {
589
+ goals: string[];
590
+ mustDoRules: string[];
591
+ mustNotDoRules: string[];
592
+ successCriteria: string[];
593
+ edgeCases: string[];
594
+ };
595
+ /**
596
+ * The artifact the example-generation pipeline persists on a prompt. The SDK
597
+ * carries it so a pull keeps it; `coverageCases`, `selectedPlans` and the
598
+ * examples themselves stay opaque because the pipeline owns their shape and the
599
+ * SDK never constructs one.
600
+ */
601
+ export type GeneratedExamples = {
602
+ policy: GeneratedExamplesPolicy;
603
+ coverageCases: unknown[];
604
+ selectedPlans: unknown[];
605
+ examples: {
606
+ goodExamples: unknown[];
607
+ badExamples: unknown[];
608
+ };
609
+ };
610
+ export type PromptNodeDefinition = NodeBaseDefinition & {
611
+ type: 'prompt';
612
+ prompt: PromptReference;
613
+ actions?: CallableActionDefinition[];
614
+ /** Legacy v1 tools on this node, by uuid. See `AgentDefinition.tools`. */
615
+ tools?: RemoteReference[];
616
+ knowledgeBases?: RemoteReference[];
617
+ customDataTables?: string[];
618
+ sopSpec?: SopSpec | null;
619
+ voiceOverride?: {
620
+ voiceUuid: string | null;
621
+ };
622
+ llmOverride?: LlmOverrideDefinition;
623
+ vadMinSilenceDuration?: number;
624
+ waitAfterTransfer?: number;
625
+ perTurnWebhook?: {
626
+ enabled: boolean;
627
+ url: string;
628
+ authToken?: string | null;
629
+ } | null;
630
+ perTurnExtraction?: ExtractionInput | null;
631
+ perTurnRetrieval?: PerTurnRetrievalDefinition | null;
632
+ perTurnAction?: ActionRunDefinition | null;
633
+ transfer?: Pick<TransferCapability, 'enabled'> & Partial<Omit<TransferCapability, 'enabled'>>;
634
+ };
635
+ /** Authoring form of `PerTurnRetrievalWire`; omitted settings take the product defaults. */
636
+ export type PerTurnRetrievalDefinition = {
637
+ /** Defaults to true: supplying the object at all means you want retrieval on. */
638
+ enabled?: boolean;
639
+ knowledgeBases: RemoteReference[];
640
+ topK?: number;
641
+ recentTurns?: number;
642
+ minScore?: number | null;
643
+ };
644
+ export type ActionNodeDefinition = NodeBaseDefinition & {
645
+ type: 'action';
646
+ action: ActionDefinition;
647
+ inputs: Record<string, string>;
648
+ outputParameters?: ActionOutputParameters;
649
+ outputParameterMappings?: ActionOutputParameterMappings;
650
+ runInBackground?: boolean;
651
+ backgroundMessage?: string | null;
652
+ executionMessage?: string | null;
653
+ mockResponseData?: unknown;
654
+ };
655
+ /**
656
+ * An HTTP request node in the Agent graph.
657
+ *
658
+ * Prefer `action.http(...)` plus `node.action(...)` for new work: Actions are
659
+ * versioned and reusable, HTTP nodes are neither. This exists so Agents that
660
+ * already contain HTTP nodes can be pulled into, edited as, and published from
661
+ * real source instead of an opaque snapshot.
662
+ */
663
+ export type HttpNodeDefinition = NodeBaseDefinition & {
664
+ type: 'http';
665
+ url: string;
666
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
667
+ headers?: Record<string, string>;
668
+ body?: unknown;
669
+ responseSelectors?: {
670
+ name: string;
671
+ value: string;
672
+ }[];
673
+ runInBackground?: boolean;
674
+ backgroundMessage?: string | null;
675
+ executionMessage?: string | null;
676
+ mockResponseData?: unknown;
677
+ };
678
+ export type ExtractNodeDefinition = NodeBaseDefinition & {
679
+ type: 'extract';
680
+ /**
681
+ * The fields to extract: a Zod object compiled into the node, or a
682
+ * `reference(...)` to a shared Schema of the organization, resolved live when
683
+ * the call is serialized, like knowledge bases.
684
+ */
685
+ schema: ExtractionInput | RemoteReference;
686
+ message?: string | null;
687
+ };
688
+ export type SayNodeDefinition = NodeBaseDefinition & {
689
+ type: 'say';
690
+ /** `null` for a say node that has not been given its line yet. */
691
+ text: string | null;
692
+ voiceUuid?: string | null;
693
+ waitAfterSay?: number;
694
+ };
695
+ /**
696
+ * The only headers Five9's SIP trunk contract forwards on the BYE, and so the
697
+ * only ones the platform accepts. Mirrors `FIVE9_SIP_ATTRIBUTES_TO_HEADERS` in
698
+ * `@simple-ai-lab/shared` (`public/sip-bye-headers.ts`), which this package
699
+ * cannot depend on; the platform rejects any other name at publish.
700
+ */
701
+ export declare const FIVE9_SIP_BYE_HEADER_NAMES: readonly ["X-RouteReason", "X-RouteType", "X-RouteValue", "X-MetaData"];
702
+ export type Five9SipByeHeaderName = (typeof FIVE9_SIP_BYE_HEADER_NAMES)[number];
703
+ export type EndCallNodeDefinition = NodeBaseDefinition & {
704
+ type: 'end-call';
705
+ message?: string | null;
706
+ /**
707
+ * Five9 routing headers attached to the BYE that ends the call, keyed by
708
+ * header name; values are templates rendered against call parameters at
709
+ * hangup. Only the four names the platform accepts may be used.
710
+ */
711
+ sipByeHeaders?: Partial<Record<Five9SipByeHeaderName, string>>;
712
+ };
713
+ export type AbTestNodeDefinition = NodeBaseDefinition & {
714
+ type: 'ab-test';
715
+ abTestGroupUuid: string;
716
+ };
717
+ /**
718
+ * Writes a static map of call parameters, then takes the first edge whose
719
+ * condition matches. No model runs, so there is nothing to speak and nothing to
720
+ * expose as a tool: `alwaysAvailable` is omitted because the platform stores no
721
+ * capabilities for this node and setting one would be silently dropped.
722
+ *
723
+ * `parameterUpdates` is required rather than defaulted: the map is the whole
724
+ * node, and an empty one is a deliberate choice worth writing.
725
+ */
726
+ export type UpdateParametersNodeDefinition = Omit<NodeBaseDefinition, 'alwaysAvailable'> & {
727
+ type: 'update-parameters';
728
+ parameterUpdates: ParameterUpdate[];
729
+ };
730
+ /**
731
+ * Takes the first edge whose condition matches. No model runs, so it neither
732
+ * speaks nor overrides anything; `alwaysAvailable` is kept so a prompt node can
733
+ * hand off to it and be routed onward deterministically.
734
+ */
735
+ export type StaticRouterNodeDefinition = NodeBaseDefinition & {
736
+ type: 'static-router';
737
+ };
738
+ /**
739
+ * Collects a card number inside the conversation. The runtime supplies the
740
+ * PCI-safe collection prompt and the Luhn check, so `instructions` only adds
741
+ * business-specific wording. `alwaysAvailable` is omitted for the same reason
742
+ * as the update-parameters node: the platform stores no capabilities here.
743
+ */
744
+ export type CollectCreditCardNodeDefinition = Omit<NodeBaseDefinition, 'alwaysAvailable'> & {
745
+ type: 'collect-credit-card';
746
+ instructions?: string | null;
747
+ /**
748
+ * When true the instructions replace the built-in collector prompt instead of being
749
+ * appended to it, and the author owns asking for every card detail.
750
+ */
751
+ overridePrompt?: boolean;
752
+ /** Actions the node can invoke while collecting, for example an in-node card save. */
753
+ actions?: CallableActionDefinition[];
754
+ llmOverride?: LlmOverrideDefinition;
755
+ vadMinSilenceDuration?: number;
756
+ };
757
+ /**
758
+ * Every field here takes its type from `TransferCapability`, the one
759
+ * description of a transfer, so the two cannot drift. `enabled` is deliberately
760
+ * absent: a transfer node *is* the transfer, and the call serializer reports
761
+ * `transfer_enabled: true` for one whatever the stored flag says.
762
+ *
763
+ * `phoneNumber` is nullable because Agent v2 stores it that way. A transfer
764
+ * node whose number has not been chosen yet is published and served, failing
765
+ * only when the transfer is attempted.
766
+ *
767
+ * `enabled` defaults to true. Agent v2 stores the flag and the call serializer
768
+ * reports `transfer_enabled: true` for a transfer node whatever it holds, so a
769
+ * stored `false` changes nothing at runtime but is part of the commit.
770
+ */
771
+ export type TransferNodeDefinition = NodeBaseDefinition & {
772
+ type: 'transfer';
773
+ message?: string | null;
774
+ enabled?: TransferCapability['enabled'];
775
+ phoneNumber: TransferCapability['phoneNumber'];
776
+ mode?: TransferCapability['mode'];
777
+ timeout?: TransferCapability['timeout'];
778
+ description?: TransferCapability['description'];
779
+ voicemailMessage?: TransferCapability['voicemailMessage'];
780
+ waitAfterTransfer?: number;
781
+ };
782
+ export type TransferChatNodeDefinition = NodeBaseDefinition & {
783
+ type: 'transfer-chat';
784
+ /**
785
+ * Three states, like the commit: absent keeps the key out, `null` writes an
786
+ * explicit null, a string writes it.
787
+ */
788
+ message?: string | null;
789
+ /**
790
+ * Required, because Agent v2 and the agent both read an absent mode as
791
+ * `five9` and run a Five9 transfer against whatever tenant is set. Write
792
+ * `undefined` to reproduce a commit that stores no mode.
793
+ */
794
+ mode: 'five9' | 'teammate_handoff' | undefined;
795
+ five9TenantName?: string;
796
+ five9CampaignName?: string;
797
+ five9ContactMapping?: Record<string, unknown>;
798
+ five9AttributesMapping?: Record<string, unknown>[];
799
+ };
800
+ export type NodeDefinition = GlobalNodeDefinition | PromptNodeDefinition | ActionNodeDefinition | HttpNodeDefinition | ExtractNodeDefinition | SayNodeDefinition | EndCallNodeDefinition | AbTestNodeDefinition | UpdateParametersNodeDefinition | StaticRouterNodeDefinition | CollectCreditCardNodeDefinition | TransferNodeDefinition | TransferChatNodeDefinition;
801
+ /** One call parameter compared against a value, as containment rules read it. */
802
+ export type CallParameterFilter = {
803
+ path: string;
804
+ type: 'string';
805
+ op: 'eq' | 'ne' | 'contains' | 'not_contains' | 'starts_with' | 'ends_with' | 'exists' | 'not_exists';
806
+ value: string | null;
807
+ } | {
808
+ path: string;
809
+ type: 'number';
810
+ op: 'eq' | 'ne' | 'gt' | 'lt' | 'gte' | 'lte' | 'exists' | 'not_exists';
811
+ value: number | null;
812
+ } | {
813
+ path: string;
814
+ type: 'boolean';
815
+ op: 'eq' | 'ne' | 'exists' | 'not_exists';
816
+ value: boolean | null;
817
+ };
818
+ export type ContainmentParameterCondition = {
819
+ type: 'parameter';
820
+ filter: CallParameterFilter;
821
+ };
822
+ export declare const CONTAINMENT_RULE_MATCHES: readonly ["all", "any"];
823
+ export declare const CONTAINMENT_CONTAINABLE_CONDITION_TYPES: readonly ["parameter", "tag", "visited_node"];
824
+ export declare const CONTAINMENT_CONTAINED_CONDITION_TYPES: readonly ["parameter", "visited_node", "ended_by"];
825
+ export type ContainmentTagCondition = {
826
+ type: 'tag';
827
+ tagUuid: string;
828
+ operator: 'has' | 'does_not_have';
829
+ };
830
+ export type ContainmentVisitedNodeCondition = {
831
+ type: 'visited_node';
832
+ nodeUuid: string | null;
833
+ nodeName: string;
834
+ operator: 'visited' | 'not_visited';
835
+ };
836
+ export type ContainmentEndedByCondition = {
837
+ type: 'ended_by';
838
+ party: 'agent' | 'user';
839
+ };
840
+ export type ContainableCondition = ContainmentParameterCondition | ContainmentTagCondition | ContainmentVisitedNodeCondition;
841
+ export type ContainedCondition = ContainmentParameterCondition | ContainmentVisitedNodeCondition | ContainmentEndedByCondition;
842
+ export type ContainableRuleGroup = {
843
+ match: (typeof CONTAINMENT_RULE_MATCHES)[number];
844
+ conditions: (ContainableCondition | ContainableRuleGroup)[];
845
+ };
846
+ export type ContainedRuleGroup = {
847
+ match: (typeof CONTAINMENT_RULE_MATCHES)[number];
848
+ conditions: (ContainedCondition | ContainedRuleGroup)[];
849
+ };
850
+ export type ContainableRuleSet = {
851
+ mode: 'always';
852
+ } | {
853
+ mode: 'rules';
854
+ rules: ContainableRuleGroup;
855
+ };
856
+ export type ContainedRuleSet = {
857
+ mode: 'always';
858
+ } | {
859
+ mode: 'rules';
860
+ rules: ContainedRuleGroup;
861
+ };
862
+ /** When a call counts as containable, and when it counts as contained. */
863
+ export type ContainmentConfig = {
864
+ version: 2;
865
+ containable: ContainableRuleSet;
866
+ contained: ContainedRuleSet;
867
+ };
868
+ export declare const MAX_CONTAINMENT_RULE_DEPTH = 5;
869
+ /**
870
+ * An Action that changes the cart, named by what the author wrote rather than by uuid:
871
+ * a callable Action's key, an Action node's key, the per-turn Action on a node, or the
872
+ * before-call Action.
873
+ */
874
+ export type CartActionRef = {
875
+ callable: string;
876
+ } | {
877
+ actionNode: string;
878
+ } | {
879
+ perTurnAction: string;
880
+ } | {
881
+ beforeCallAction: true;
882
+ };
883
+ /**
884
+ * When the order counts as placed (checkout). Order ids come from an Action's outputs, so only an `action_succeeded`
885
+ * rule can name them, and each rule names at least one Action or node.
886
+ */
887
+ export type CartCheckoutDefinition = {
888
+ when: {
889
+ kind: 'action_succeeded';
890
+ actions: [CartActionRef, ...CartActionRef[]];
891
+ };
892
+ /** Where the order ids are in the Action's outputs. */
893
+ orderIds?: {
894
+ from: CartPointer | null;
895
+ id: CartPointer;
896
+ } | null;
897
+ } | {
898
+ when: {
899
+ kind: 'node_reached';
900
+ nodes: [string, ...string[]];
901
+ };
902
+ orderIds?: null;
903
+ } | {
904
+ when: {
905
+ kind: 'parameter_equals';
906
+ parameter: string;
907
+ value: string | number | boolean | null;
908
+ };
909
+ orderIds?: null;
910
+ };
911
+ /**
912
+ * Where the Agent keeps its cart and how the call page shows it. Configuration only: nothing in
913
+ * the graph or prompts changes. Node and Action references use authoring keys.
914
+ */
915
+ export type CartDefinition = {
916
+ parameter: string;
917
+ view: CartViewWire;
918
+ reasonArgument?: string | null;
919
+ actions?: {
920
+ action: CartActionRef;
921
+ label: string;
922
+ }[];
923
+ checkout?: CartCheckoutDefinition | null;
924
+ };
925
+ export type AgentDefinition = {
926
+ kind: 'agent-definition';
927
+ key: string;
928
+ name: string;
929
+ description: string | null;
930
+ branch: string;
931
+ modality: 'voice' | 'text';
932
+ folderUuid: string | null;
933
+ analyzerUuids: string[];
934
+ tagUuids: string[];
935
+ containmentConfig: ContainmentConfig | null;
936
+ voice: {
937
+ voiceUuid: string | null;
938
+ backgroundNoise: BackgroundNoise;
939
+ };
940
+ llm: {
941
+ model: string;
942
+ modelUuid: string | null;
943
+ temperature: number;
944
+ };
945
+ speech: {
946
+ language: string;
947
+ keyterms: string[];
948
+ voiceFormattingEnabled: boolean;
949
+ pronunciations: Pronunciation[];
950
+ };
951
+ /**
952
+ * Free-text guidance on how the agent should sound: pronunciation, brevity,
953
+ * read-back style. Three states, like the per-turn node settings: absent keeps
954
+ * the key out of the commit, `null` writes an explicit null, a string writes it.
955
+ */
956
+ toneGuidelines?: string | null;
957
+ /** Three states like `toneGuidelines`: absent keeps the key out of the commit. */
958
+ cart?: CartDefinition | null;
959
+ call: {
960
+ agentSpeaksFirst: boolean;
961
+ firstSentence: string | null;
962
+ maxCallLengthSeconds: number;
963
+ record: boolean;
964
+ checkInAfterSilence: CheckInAfterSilence;
965
+ endCallAfterExtendedSilence: boolean;
966
+ pciEnabled: boolean;
967
+ /**
968
+ * Agent v2's `call.backgroundNoise`, which is what a call actually plays.
969
+ * It is stored apart from `voice.backgroundNoise`, and the two can
970
+ * legitimately disagree (`voice: 'off'`, track: `'coffee_shop'`).
971
+ *
972
+ * `null` leaves the block out of the commit entirely. Left unset, it
973
+ * follows `voice.backgroundNoise` — see `defaultBackgroundNoise`.
974
+ */
975
+ backgroundNoise: BackgroundNoiseConfig | null;
976
+ /** `null` omits interruption config entirely rather than defaulting it. */
977
+ interruptionEagerness: InterruptionEagerness | null;
978
+ /** `null` omits the setting entirely, leaving the product default in charge. */
979
+ eotEagerness: EotEagerness | null;
980
+ };
981
+ preCallWebhook: {
982
+ enabled: boolean;
983
+ url: string | null;
984
+ authToken: string | null;
985
+ timeout: number;
986
+ parameters: string[];
987
+ };
988
+ capabilities: {
989
+ dtmf: EnabledWithDescription;
990
+ hangup: EnabledWithDescription & {
991
+ message: string | null;
992
+ };
993
+ transfer: TransferCapability;
994
+ };
995
+ /**
996
+ * Legacy v1 tools assigned to the Agent, by uuid. Superseded by callable
997
+ * Actions; held as an opaque reference the SDK never interprets, so Agents
998
+ * that still carry them round-trip.
999
+ */
1000
+ tools: RemoteReference[];
1001
+ knowledgeBases: RemoteReference[];
1002
+ beforeCallAction: ActionRunDefinition | null;
1003
+ summaryPrompt: string | null;
1004
+ /**
1005
+ * A/B test groups on the Agent.
1006
+ *
1007
+ * `null` derives the set from `ab-test` nodes, which is what authoring in code
1008
+ * produces. Pulled Agents can carry groups with no corresponding node, so they
1009
+ * set this explicitly.
1010
+ */
1011
+ abTestGroupIds: string[] | null;
1012
+ /**
1013
+ * The Agent's callable Action use sites, in the order Agent v2 stores them. A
1014
+ * node points into this list, so it can carry an order the nodes do not, a use
1015
+ * site shared by several nodes, and one no node references.
1016
+ *
1017
+ * `null` derives the list from the nodes, in node order.
1018
+ */
1019
+ actions: CallableActionDefinition[] | null;
1020
+ nodes: NodeDefinition[];
1021
+ };
1022
+ export type AgentDefinitionInput = {
1023
+ key: string;
1024
+ name: string;
1025
+ description?: string | null;
1026
+ branch: string;
1027
+ modality?: 'voice' | 'text';
1028
+ folderUuid?: string | null;
1029
+ analyzerUuids?: string[];
1030
+ tagUuids?: string[];
1031
+ containmentConfig?: ContainmentConfig | null;
1032
+ voice?: {
1033
+ voiceUuid?: string | null;
1034
+ backgroundNoise?: BackgroundNoise;
1035
+ };
1036
+ llm?: {
1037
+ model?: string;
1038
+ modelUuid?: string | null;
1039
+ temperature?: number;
1040
+ };
1041
+ speech?: {
1042
+ language?: string;
1043
+ keyterms?: string[];
1044
+ voiceFormattingEnabled?: boolean;
1045
+ pronunciations?: Pronunciation[];
1046
+ };
1047
+ toneGuidelines?: string | null;
1048
+ cart?: CartDefinition | null;
1049
+ call?: Partial<Omit<AgentDefinition['call'], 'checkInAfterSilence'>> & {
1050
+ checkInAfterSilence?: CheckInAfterSilenceInput;
1051
+ };
1052
+ preCallWebhook?: Partial<AgentDefinition['preCallWebhook']>;
1053
+ capabilities?: {
1054
+ dtmf?: Partial<EnabledWithDescription>;
1055
+ hangup?: Partial<EnabledWithDescription & {
1056
+ message: string | null;
1057
+ }>;
1058
+ transfer?: Partial<TransferCapability>;
1059
+ };
1060
+ tools?: RemoteReference[];
1061
+ knowledgeBases?: RemoteReference[];
1062
+ beforeCallAction?: ActionRunDefinition | null;
1063
+ summaryPrompt?: string | null;
1064
+ abTestGroupIds?: string[] | null;
1065
+ actions?: CallableActionDefinition[] | null;
1066
+ nodes: NodeDefinition[];
1067
+ };
1068
+ export type AgentIdentityKind = 'node' | 'edge' | 'action-use-site' | 'action-version-placeholder';
1069
+ export type AgentCompileOptions = {
1070
+ actionVersionUuids?: Record<string, string>;
1071
+ identity?: (input: {
1072
+ kind: AgentIdentityKind;
1073
+ key: string;
1074
+ }) => string | undefined;
1075
+ readPromptFile?: (path: string) => string;
1076
+ readActionSourceFile?: (path: string) => string;
1077
+ allowUnresolvedActionVersions?: boolean;
1078
+ };
1079
+ export type CompiledAgentProject = {
1080
+ agent: {
1081
+ key: string;
1082
+ name: string;
1083
+ description: string | null;
1084
+ modality: 'voice' | 'text';
1085
+ folderUuid: string | null;
1086
+ analyzerUuids: string[];
1087
+ tagUuids: string[];
1088
+ containmentConfig: ContainmentConfig | null;
1089
+ };
1090
+ branch: {
1091
+ name: string;
1092
+ };
1093
+ actions: {
1094
+ key: string;
1095
+ versionUuid: string;
1096
+ values: ActionVersionValues;
1097
+ }[];
1098
+ content: AgentV2CommitContentWire;
1099
+ };
1100
+ export declare function defineAgent(input: AgentDefinitionInput): AgentDefinition;
1101
+ export declare const node: {
1102
+ global(config: Omit<GlobalNodeDefinition, "type">): GlobalNodeDefinition;
1103
+ prompt(config: Omit<PromptNodeDefinition, "type">): PromptNodeDefinition;
1104
+ action(config: Omit<ActionNodeDefinition, "type">): ActionNodeDefinition;
1105
+ http(config: Omit<HttpNodeDefinition, "type">): HttpNodeDefinition;
1106
+ extract(config: Omit<ExtractNodeDefinition, "type">): ExtractNodeDefinition;
1107
+ say(config: Omit<SayNodeDefinition, "type">): SayNodeDefinition;
1108
+ endCall(config: Omit<EndCallNodeDefinition, "type">): EndCallNodeDefinition;
1109
+ abTest(config: Omit<AbTestNodeDefinition, "type">): AbTestNodeDefinition;
1110
+ updateParameters(config: Omit<UpdateParametersNodeDefinition, "type">): UpdateParametersNodeDefinition;
1111
+ staticRouter(config: Omit<StaticRouterNodeDefinition, "type">): StaticRouterNodeDefinition;
1112
+ collectCreditCard(config: Omit<CollectCreditCardNodeDefinition, "type">): CollectCreditCardNodeDefinition;
1113
+ transfer(config: Omit<TransferNodeDefinition, "type">): TransferNodeDefinition;
1114
+ transferChat(config: Omit<TransferChatNodeDefinition, "type">): TransferChatNodeDefinition;
1115
+ };
1116
+ export declare const prompt: {
1117
+ inline(text: string | null, example?: PromptExample, generatedExamples?: GeneratedExamples | null): PromptReference;
1118
+ file(path: string, example?: PromptExample): PromptReference;
1119
+ version(versionId: string): PromptReference;
1120
+ };
1121
+ export declare function reference(uuid: string): RemoteReference;
1122
+ export declare function canonicalAuthoringKey(value: string, fallback: string): string;
1123
+ export declare function canonicalAuthoringKeys(values: {
1124
+ value: string;
1125
+ fallback: string;
1126
+ }[]): string[];
1127
+ /**
1128
+ * The fields to extract. `ExtractionField[]` is what Agent v2 stores and Zod is
1129
+ * a convenience over it, so the stored form is accepted directly for the shapes
1130
+ * Zod has no equivalent for.
1131
+ */
1132
+ export type ExtractionInput = z.ZodObject<z.ZodRawShape> | ExtractionField[];
1133
+ export declare function resolveExtractionFields(schema: ExtractionInput): ExtractionField[];
1134
+ /** Product defaults for retrieval settings the author leaves out. */
1135
+ export declare const DEFAULT_PER_TURN_RETRIEVAL_TOP_K = 3;
1136
+ export declare const DEFAULT_PER_TURN_RETRIEVAL_RECENT_TURNS = 4;
1137
+ export declare function compileAgent(definition: AgentDefinition, options?: AgentCompileOptions): CompiledAgentProject;
1138
+ export {};