@simple-ai-lab/sdk 0.3.0 → 0.6.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 (64) hide show
  1. package/README.md +56 -3
  2. package/dist/actions.cjs +438 -0
  3. package/dist/actions.d.cts +336 -0
  4. package/dist/actions.d.ts +336 -0
  5. package/dist/actions.js +429 -0
  6. package/dist/agents.cjs +1054 -0
  7. package/dist/agents.d.cts +1016 -0
  8. package/dist/agents.d.ts +1016 -0
  9. package/dist/agents.js +1044 -0
  10. package/dist/built-in-actions.cjs +356 -0
  11. package/dist/built-in-actions.d.cts +41 -0
  12. package/dist/built-in-actions.d.ts +41 -0
  13. package/dist/built-in-actions.js +353 -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 +74 -0
  23. package/dist/code-action/define-action.d.cts +94 -0
  24. package/dist/code-action/define-action.d.ts +94 -0
  25. package/dist/code-action/define-action.js +69 -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/types.cjs +13 -0
  31. package/dist/code-action/types.d.cts +13 -0
  32. package/dist/code-action/types.d.ts +13 -0
  33. package/dist/code-action/types.js +10 -0
  34. package/dist/code-action/workflow.cjs +29 -0
  35. package/dist/code-action/workflow.d.cts +53 -0
  36. package/dist/code-action/workflow.d.ts +53 -0
  37. package/dist/code-action/workflow.js +26 -0
  38. package/dist/data.cjs +98 -0
  39. package/dist/data.d.cts +44 -0
  40. package/dist/data.d.ts +44 -0
  41. package/dist/data.js +94 -0
  42. package/dist/http.cjs +65 -0
  43. package/dist/http.d.cts +14 -0
  44. package/dist/http.d.ts +14 -0
  45. package/dist/http.js +62 -0
  46. package/dist/index.cjs +68 -1593
  47. package/dist/index.d.cts +12 -961
  48. package/dist/index.d.ts +12 -961
  49. package/dist/index.js +10 -1540
  50. package/dist/projects.cjs +234 -0
  51. package/dist/projects.d.cts +24 -0
  52. package/dist/projects.d.ts +24 -0
  53. package/dist/projects.js +228 -0
  54. package/dist/schemas.cjs +50 -0
  55. package/dist/schemas.d.cts +81 -0
  56. package/dist/schemas.d.ts +81 -0
  57. package/dist/schemas.js +47 -0
  58. package/dist/shared/errors.cjs +31 -0
  59. package/dist/shared/errors.d.cts +22 -0
  60. package/dist/shared/errors.d.ts +22 -0
  61. package/dist/shared/errors.js +26 -0
  62. package/package.json +27 -21
  63. package/dist/index.cjs.map +0 -1
  64. package/dist/index.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,1594 +1,69 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- DataClient: () => DataClient,
24
- MAX_BATCH_ROWS: () => MAX_BATCH_ROWS,
25
- MAX_QUERY_SIZE: () => MAX_QUERY_SIZE,
26
- SIMPLE_ACTION_BRAND: () => SIMPLE_ACTION_BRAND,
27
- SimpleAI: () => SimpleAI,
28
- SimpleAIError: () => SimpleAIError,
29
- action: () => action,
30
- actionsIoSchemaFromZod: () => actionsIoSchemaFromZod,
31
- batchUpsertRowsSchema: () => batchUpsertRowsSchema,
32
- canonicalAuthoringKey: () => canonicalAuthoringKey,
33
- canonicalAuthoringKeys: () => canonicalAuthoringKeys,
34
- collectActionVersionUuids: () => collectActionVersionUuids,
35
- compileAction: () => compileAction,
36
- compileAgent: () => compileAgent,
37
- compileAgentProject: () => compileAgentProject,
38
- dataColumnPathSchema: () => dataColumnPathSchema,
39
- dataFilterSchema: () => dataFilterSchema,
40
- defineAction: () => defineAction,
41
- defineAgent: () => defineAgent,
42
- defineAgentSnapshot: () => defineAgentSnapshot,
43
- listOptionsSchema: () => listOptionsSchema,
44
- node: () => node,
45
- prompt: () => prompt,
46
- queryInputSchema: () => queryInputSchema,
47
- recordPayloadSchema: () => recordPayloadSchema,
48
- reference: () => reference,
49
- sourceFile: () => sourceFile,
50
- tableNameSchema: () => tableNameSchema
51
- });
52
- module.exports = __toCommonJS(index_exports);
53
-
54
- // src/actions.ts
55
- var import_zod = require("zod");
56
- function isRecord(value) {
57
- return value !== null && typeof value === "object" && !Array.isArray(value);
58
- }
59
- function nullableJsonSchema(value) {
60
- const type = value.type;
61
- if (Array.isArray(type)) {
62
- const nonNullTypes = type.filter((item) => item !== "null");
63
- if (nonNullTypes.length === 1 && typeof nonNullTypes[0] === "string") {
64
- return { schema: { ...value, type: nonNullTypes[0] }, nullable: type.includes("null") };
65
- }
66
- }
67
- const anyOf = value.anyOf;
68
- if (Array.isArray(anyOf)) {
69
- const schemas = anyOf.filter(isRecord);
70
- const nonNullSchemas = schemas.filter((schema) => schema.type !== "null");
71
- const containsNull = schemas.some((schema) => schema.type === "null");
72
- if (containsNull && nonNullSchemas.length === 1) {
73
- const nonNullSchema = nonNullSchemas[0] ?? {};
74
- return {
75
- schema: {
76
- ...nonNullSchema,
77
- ...typeof value.description === "string" ? { description: value.description } : {}
78
- },
79
- nullable: true
80
- };
81
- }
82
- }
83
- return { schema: value, nullable: false };
84
- }
85
- function schemaDescription(schema) {
86
- return typeof schema.description === "string" ? schema.description : "";
87
- }
88
- function convertJsonSchemaNode(value, path) {
89
- if (!isRecord(value)) {
90
- throw new Error(`${path} is not a representable Zod schema`);
91
- }
92
- const { schema, nullable } = nullableJsonSchema(value);
93
- if (schema.enum !== void 0 || schema.const !== void 0) {
94
- throw new Error(`${path} uses enum/const, which Actions I/O schemas do not support`);
95
- }
96
- switch (schema.type) {
97
- case "string":
98
- case "number":
99
- case "boolean":
100
- return {
101
- type: schema.type,
102
- description: schemaDescription(schema),
103
- nullable
104
- };
105
- case "object": {
106
- const rawProperties = isRecord(schema.properties) ? schema.properties : {};
107
- const properties = {};
108
- for (const [name, child] of Object.entries(rawProperties)) {
109
- if (!/^[A-Za-z_]\w*$/.test(name) || ["__proto__", "constructor", "prototype"].includes(name)) {
110
- throw new Error(`${path}.${name} is not a valid Actions I/O property name`);
111
- }
112
- properties[name] = convertJsonSchemaNode(child, `${path}.${name}`);
113
- }
114
- const required = Array.isArray(schema.required) ? schema.required.filter((name) => typeof name === "string") : [];
115
- const additionalProperties = schema.additionalProperties === true;
116
- return {
117
- type: "object",
118
- description: schemaDescription(schema),
119
- nullable,
120
- properties,
121
- required,
122
- additionalProperties
123
- };
124
- }
125
- case "array":
126
- return {
127
- type: "array",
128
- description: schemaDescription(schema),
129
- nullable,
130
- ...schema.items === void 0 ? {} : { items: convertJsonSchemaNode(schema.items, `${path}[]`) }
131
- };
132
- case "integer":
133
- return {
134
- type: "number",
135
- description: schemaDescription(schema),
136
- nullable
137
- };
138
- default:
139
- throw new Error(`${path} uses unsupported Zod/JSON Schema type "${String(schema.type)}"`);
140
- }
141
- }
142
- function actionsIoSchemaFromZod(schema) {
143
- const converted = convertJsonSchemaNode(import_zod.z.toJSONSchema(schema), "schema");
144
- if (converted.type !== "object") {
145
- throw new Error("Action input and output schemas must be Zod objects");
146
- }
147
- return {
148
- type: "object",
149
- description: converted.description,
150
- properties: converted.properties,
151
- required: converted.required,
152
- additionalProperties: converted.additionalProperties
153
- };
154
- }
155
- function pointerForName(name) {
156
- const escaped = name.replace(/~/g, "~0").replace(/\//g, "~1");
157
- return `/${escaped}`;
158
- }
159
- function normalizeOutputMappings({
160
- mappings,
161
- outputSchema
162
- }) {
163
- const normalized = Object.fromEntries(
164
- Object.entries(mappings).map(([name, template]) => [name.startsWith("/") ? name : pointerForName(name), template])
165
- );
166
- for (const name of Object.keys(outputSchema.properties)) {
167
- const pointer = pointerForName(name);
168
- if (normalized[pointer] === void 0) {
169
- throw new Error(`Action output "${name}" needs an output mapping`);
170
- }
171
- }
172
- for (const pointer of Object.keys(normalized)) {
173
- const firstToken = pointer.slice(1).split("/")[0]?.replace(/~1/g, "/").replace(/~0/g, "~");
174
- if (firstToken === void 0 || outputSchema.properties[firstToken] === void 0) {
175
- throw new Error(`Action output mapping "${pointer}" does not reference a declared output`);
176
- }
177
- }
178
- return normalized;
179
- }
180
- function compileContracts({
181
- input,
182
- output
183
- }) {
184
- return {
185
- inputSchema: actionsIoSchemaFromZod(input),
186
- outputSchema: actionsIoSchemaFromZod(output)
187
- };
188
- }
189
- function requireSourceFile({
190
- reference: reference2,
191
- options
192
- }) {
193
- if (options.readSourceFile === void 0) {
194
- throw new Error(`Action source file "${reference2.path}" requires a readSourceFile compiler option`);
195
- }
196
- return options.readSourceFile(reference2.path);
197
- }
198
- function compileHttpAction(config) {
199
- const contract = compileContracts(config);
200
- return {
201
- kind: "inline",
202
- key: config.key,
203
- contract,
204
- compile: () => ({
205
- actionType: "http",
206
- name: config.name,
207
- description: config.description,
208
- ...contract,
209
- outputMappings: normalizeOutputMappings({
210
- mappings: config.outputMappings,
211
- outputSchema: contract.outputSchema
212
- }),
213
- operation: {
214
- type: "request",
215
- method: config.request.method,
216
- urlTemplate: config.request.url,
217
- headers: Object.entries(config.request.headers ?? {}).map(([name, valueTemplate]) => ({
218
- name,
219
- valueTemplate
220
- })),
221
- bodyTemplate: config.request.body ?? null
222
- }
223
- })
224
- };
225
- }
226
- function compileCodeAction(config) {
227
- const contract = compileContracts(config);
228
- return {
229
- kind: "inline",
230
- key: config.key,
231
- contract,
232
- compile: (options) => ({
233
- actionType: "code",
234
- name: config.name,
235
- description: config.description,
236
- ...contract,
237
- outputMappings: normalizeOutputMappings({
238
- mappings: config.outputMappings,
239
- outputSchema: contract.outputSchema
240
- }),
241
- operation: {
242
- type: "execute",
243
- language: "typescript",
244
- source: typeof config.source === "string" ? config.source : requireSourceFile({ reference: config.source, options }),
245
- compiledJs: null,
246
- runtime: "node22",
247
- timeoutMs: config.timeoutMs ?? 3e4
248
- }
249
- })
250
- };
251
- }
252
- function compileCustomDataQueryAction(config) {
253
- const contract = compileContracts(config);
254
- return {
255
- kind: "inline",
256
- key: config.key,
257
- contract,
258
- compile: () => ({
259
- actionType: "custom_data",
260
- name: config.name,
261
- description: config.description,
262
- ...contract,
263
- outputMappings: normalizeOutputMappings({
264
- mappings: config.outputMappings,
265
- outputSchema: contract.outputSchema
266
- }),
267
- operation: { type: "query", sql: config.sql }
268
- })
269
- };
270
- }
271
- function compileCustomDataSearchAction(config) {
272
- const contract = compileContracts(config);
273
- return {
274
- kind: "inline",
275
- key: config.key,
276
- contract,
277
- compile: () => ({
278
- actionType: "custom_data",
279
- name: config.name,
280
- description: config.description,
281
- ...contract,
282
- outputMappings: normalizeOutputMappings({
283
- mappings: config.outputMappings,
284
- outputSchema: contract.outputSchema
285
- }),
286
- operation: { type: "search", table: config.table, bodyTemplate: config.body }
287
- })
288
- };
289
- }
290
- function compileKnowledgeBaseSearchAction(config) {
291
- const contract = compileContracts(config);
292
- return {
293
- kind: "inline",
294
- key: config.key,
295
- contract,
296
- compile: () => ({
297
- actionType: "knowledge_base",
298
- name: config.name,
299
- description: config.description,
300
- ...contract,
301
- outputMappings: normalizeOutputMappings({
302
- mappings: config.outputMappings,
303
- outputSchema: contract.outputSchema
304
- }),
305
- operation: {
306
- type: "search",
307
- knowledgeBaseIds: config.knowledgeBaseIds,
308
- bodyTemplate: config.body
309
- }
310
- })
311
- };
312
- }
313
- var action = {
314
- http(config) {
315
- return compileHttpAction(config);
316
- },
317
- code(config) {
318
- return compileCodeAction(config);
319
- },
320
- customDataQuery(config) {
321
- return compileCustomDataQueryAction(config);
322
- },
323
- customDataSearch(config) {
324
- return compileCustomDataSearchAction(config);
325
- },
326
- knowledgeBaseSearch(config) {
327
- return compileKnowledgeBaseSearchAction(config);
328
- },
329
- ref(config) {
330
- return {
331
- kind: "reference",
332
- key: config.key,
333
- versionUuid: config.versionUuid,
334
- contract: config.contract ?? null
335
- };
336
- },
337
- callable(config) {
338
- return { kind: "callable", ...config };
339
- },
340
- run(config) {
341
- return { kind: "run", ...config };
342
- },
343
- fromAgent(description) {
344
- return { source: "agent", description };
345
- },
346
- from(value) {
347
- return { source: "template", value };
348
- }
349
- };
350
- function compileAction(definition, options = {}) {
351
- return definition.compile(options);
352
- }
353
- function sourceFile(path) {
354
- return { kind: "source-file", path };
355
- }
356
-
357
- // src/agents.ts
358
- var import_node_crypto = require("crypto");
359
- var import_zod2 = require("zod");
360
- function defaultTransferCapability() {
361
- return {
362
- enabled: false,
363
- phoneNumber: null,
364
- timeout: 120,
365
- mode: "cold",
366
- description: null,
367
- voicemailMessage: null
368
- };
369
- }
370
- function defineAgent(input) {
371
- const transferDefaults = defaultTransferCapability();
372
- return {
373
- kind: "agent-definition",
374
- key: input.key,
375
- name: input.name,
376
- description: input.description ?? null,
377
- branch: input.branch,
378
- modality: input.modality ?? "voice",
379
- folderUuid: input.folderUuid ?? null,
380
- analyzerUuids: input.analyzerUuids ?? [],
381
- tagUuids: input.tagUuids ?? [],
382
- containmentConfig: input.containmentConfig ?? null,
383
- voice: {
384
- voiceUuid: input.voice?.voiceUuid ?? null,
385
- backgroundNoise: input.voice?.backgroundNoise ?? "off"
386
- },
387
- llm: {
388
- model: input.llm?.model ?? "gpt-4.1",
389
- modelUuid: input.llm?.modelUuid ?? null,
390
- temperature: input.llm?.temperature ?? 0.65
391
- },
392
- speech: {
393
- language: input.speech?.language ?? "en",
394
- keyterms: input.speech?.keyterms ?? []
395
- },
396
- call: {
397
- agentSpeaksFirst: input.call?.agentSpeaksFirst ?? false,
398
- firstSentence: input.call?.firstSentence ?? null,
399
- maxCallLengthSeconds: input.call?.maxCallLengthSeconds ?? 1800,
400
- record: input.call?.record ?? true,
401
- checkInAfterSilence: input.call?.checkInAfterSilence ?? { enabled: false, prompt: null },
402
- endCallAfterExtendedSilence: input.call?.endCallAfterExtendedSilence ?? false,
403
- pciEnabled: input.call?.pciEnabled ?? false,
404
- backgroundNoiseTrack: input.call?.backgroundNoiseTrack ?? null,
405
- backgroundNoiseGain: input.call?.backgroundNoiseGain === void 0 ? 1 : input.call.backgroundNoiseGain,
406
- interruptionMode: input.call?.interruptionMode === void 0 ? "medium" : input.call.interruptionMode
407
- },
408
- preCallWebhook: {
409
- enabled: input.preCallWebhook?.enabled ?? false,
410
- url: input.preCallWebhook?.url ?? null,
411
- authToken: input.preCallWebhook?.authToken ?? null,
412
- timeout: input.preCallWebhook?.timeout ?? 5,
413
- parameters: input.preCallWebhook?.parameters ?? []
414
- },
415
- capabilities: {
416
- dtmf: {
417
- enabled: input.capabilities?.dtmf?.enabled ?? false,
418
- description: input.capabilities?.dtmf?.description ?? null
419
- },
420
- hangup: {
421
- enabled: input.capabilities?.hangup?.enabled ?? true,
422
- description: input.capabilities?.hangup?.description ?? null,
423
- message: input.capabilities?.hangup?.message ?? null
424
- },
425
- transfer: {
426
- enabled: input.capabilities?.transfer?.enabled ?? transferDefaults.enabled,
427
- phoneNumber: input.capabilities?.transfer?.phoneNumber ?? transferDefaults.phoneNumber,
428
- timeout: input.capabilities?.transfer?.timeout ?? transferDefaults.timeout,
429
- mode: input.capabilities?.transfer?.mode ?? transferDefaults.mode,
430
- description: input.capabilities?.transfer?.description ?? transferDefaults.description,
431
- voicemailMessage: input.capabilities?.transfer?.voicemailMessage ?? transferDefaults.voicemailMessage
432
- }
433
- },
434
- knowledgeBases: input.knowledgeBases ?? [],
435
- beforeCallAction: input.beforeCallAction ?? null,
436
- summaryPrompt: input.summaryPrompt ?? null,
437
- abTestGroupIds: input.abTestGroupIds ?? null,
438
- nodes: input.nodes
439
- };
440
- }
441
- var node = {
442
- global(config) {
443
- return { type: "global", ...config };
444
- },
445
- prompt(config) {
446
- return { type: "prompt", ...config };
447
- },
448
- action(config) {
449
- return { type: "action", ...config };
450
- },
451
- http(config) {
452
- return { type: "http", ...config };
453
- },
454
- extract(config) {
455
- return { type: "extract", ...config };
456
- },
457
- say(config) {
458
- return { type: "say", ...config };
459
- },
460
- endCall(config) {
461
- return { type: "end-call", ...config };
462
- },
463
- route(config) {
464
- return { type: "route", ...config };
465
- },
466
- abTest(config) {
467
- return { type: "ab-test", ...config };
468
- },
469
- transfer(config) {
470
- return { type: "transfer", ...config };
471
- },
472
- transferChat(config) {
473
- return { type: "transfer-chat", ...config };
474
- }
475
- };
476
- var prompt = {
477
- inline(text, example = null, generatedExamples) {
478
- return { kind: "inline", text, example, ...generatedExamples === void 0 ? {} : { generatedExamples } };
479
- },
480
- file(path, example = null) {
481
- return { kind: "file", path, example };
482
- },
483
- version(versionId) {
484
- return { kind: "version", versionId };
485
- }
486
- };
487
- function reference(uuid) {
488
- return { uuid };
489
- }
490
- function isRecord2(value) {
491
- return value !== null && typeof value === "object" && !Array.isArray(value);
492
- }
493
- function deterministicUuid(input) {
494
- const bytes = Buffer.from((0, import_node_crypto.createHash)("sha256").update(`${input.kind}:${input.key}`).digest().subarray(0, 16));
495
- bytes[6] = (bytes[6] ?? 0) & 15 | 64;
496
- bytes[8] = (bytes[8] ?? 0) & 63 | 128;
497
- const hex = bytes.toString("hex");
498
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
499
- }
500
- function resolveIdentity({
501
- options,
502
- kind,
503
- key,
504
- fallbackKeys = []
505
- }) {
506
- for (const candidateKey of [key, ...fallbackKeys]) {
507
- const identity = options.identity?.({ kind, key: candidateKey });
508
- if (identity !== void 0) {
509
- return identity;
510
- }
511
- }
512
- return deterministicUuid({ kind, key });
513
- }
514
- function canonicalAuthoringKey(value, fallback) {
515
- const normalizedCharacters = [];
516
- let needsSeparator = false;
517
- for (const character of value.toLowerCase()) {
518
- const characterCode = character.charCodeAt(0);
519
- const isLowercaseLetter = characterCode >= 97 && characterCode <= 122;
520
- const isDigit = characterCode >= 48 && characterCode <= 57;
521
- if (isLowercaseLetter || isDigit) {
522
- if (needsSeparator && normalizedCharacters.length > 0) {
523
- normalizedCharacters.push("-");
524
- }
525
- normalizedCharacters.push(character);
526
- needsSeparator = false;
527
- } else if (normalizedCharacters.length > 0) {
528
- needsSeparator = true;
529
- }
530
- }
531
- const normalized = normalizedCharacters.join("");
532
- return normalized === "" ? fallback : normalized;
533
- }
534
- function canonicalAuthoringKeys(values) {
535
- const used = /* @__PURE__ */ new Set();
536
- return values.map(({ value, fallback }) => {
537
- const base = canonicalAuthoringKey(value, fallback);
538
- let candidate = base;
539
- let sequence = 2;
540
- while (used.has(candidate)) {
541
- candidate = `${base}-${sequence}`;
542
- sequence += 1;
543
- }
544
- used.add(candidate);
545
- return candidate;
546
- });
547
- }
548
- function jsonSchemaDescription(value) {
549
- return typeof value.description === "string" ? value.description : "";
550
- }
551
- function extractionFieldFromJsonSchema({
552
- name,
553
- value,
554
- required,
555
- path
556
- }) {
557
- if (!isRecord2(value)) {
558
- throw new Error(`${path} is not a representable extraction field`);
559
- }
560
- const enumValues = Array.isArray(value.enum) ? value.enum.filter(
561
- (item) => typeof item === "string" || typeof item === "number" || typeof item === "boolean"
562
- ) : void 0;
563
- if (value.type === "object") {
564
- const rawProperties = isRecord2(value.properties) ? value.properties : {};
565
- const requiredNames = new Set(
566
- Array.isArray(value.required) ? value.required.filter((item) => typeof item === "string") : []
567
- );
568
- return {
569
- name,
570
- type: "object",
571
- description: jsonSchemaDescription(value),
572
- required,
573
- properties: Object.entries(rawProperties).map(
574
- ([childName, child]) => extractionFieldFromJsonSchema({
575
- name: childName,
576
- value: child,
577
- required: requiredNames.has(childName),
578
- path: `${path}.${childName}`
579
- })
580
- )
581
- };
582
- }
583
- if (value.type === "array") {
584
- if (value.items === void 0) {
585
- throw new Error(`${path} must declare an array item schema`);
586
- }
587
- return {
588
- name,
589
- type: "array",
590
- description: jsonSchemaDescription(value),
591
- required,
592
- items: extractionFieldFromJsonSchema({
593
- name: "item",
594
- value: value.items,
595
- required: true,
596
- path: `${path}[]`
597
- })
598
- };
599
- }
600
- if (!["string", "number", "integer", "boolean"].includes(String(value.type))) {
601
- throw new Error(`${path} uses unsupported extraction type "${String(value.type)}"`);
602
- }
603
- return {
604
- name,
605
- type: value.type === "integer" ? "number" : String(value.type),
606
- description: jsonSchemaDescription(value),
607
- required,
608
- ...enumValues === void 0 ? {} : { enum: enumValues }
609
- };
610
- }
611
- function extractionFieldsFromZod(schema) {
612
- const jsonSchema = import_zod2.z.toJSONSchema(schema);
613
- if (!isRecord2(jsonSchema) || jsonSchema.type !== "object") {
614
- throw new Error("Extraction schemas must be Zod objects");
615
- }
616
- const rawProperties = isRecord2(jsonSchema.properties) ? jsonSchema.properties : {};
617
- const requiredNames = new Set(
618
- Array.isArray(jsonSchema.required) ? jsonSchema.required.filter((item) => typeof item === "string") : []
619
- );
620
- return Object.entries(rawProperties).map(
621
- ([name, value]) => extractionFieldFromJsonSchema({
622
- name,
623
- value,
624
- required: requiredNames.has(name),
625
- path: `schema.${name}`
626
- })
627
- );
628
- }
629
- function compilePrompt(referenceValue, options) {
630
- switch (referenceValue.kind) {
631
- case "inline":
632
- return {
633
- type: "inline",
634
- prompt: referenceValue.text,
635
- example: referenceValue.example,
636
- // Product-generated; preserved verbatim so pulled prompts round-trip.
637
- ...referenceValue.generatedExamples === void 0 ? {} : { generatedExamples: referenceValue.generatedExamples }
638
- };
639
- case "file": {
640
- if (options.readPromptFile === void 0) {
641
- throw new Error(`Prompt file "${referenceValue.path}" requires a readPromptFile compiler option`);
642
- }
643
- return {
644
- type: "inline",
645
- prompt: options.readPromptFile(referenceValue.path),
646
- example: referenceValue.example
647
- };
648
- }
649
- case "version":
650
- return { type: "reference", promptVersionId: referenceValue.versionId };
651
- }
652
- }
653
- function resolveActionVersion({
654
- definition,
655
- options
656
- }) {
657
- if (definition.kind === "reference") {
658
- return definition.versionUuid;
659
- }
660
- const resolved = options.actionVersionUuids?.[definition.key];
661
- if (resolved !== void 0) {
662
- return resolved;
663
- }
664
- if (options.allowUnresolvedActionVersions === true) {
665
- return resolveIdentity({
666
- options,
667
- kind: "action-version-placeholder",
668
- key: definition.key
669
- });
670
- }
671
- throw new Error(`Action "${definition.key}" does not have a resolved version UUID`);
672
- }
673
- function pointerForInputName(name) {
674
- return `/${name.replace(/~/g, "~0").replace(/\//g, "~1")}`;
675
- }
676
- function compileOutputParameterMappings(outputParameters) {
677
- const mappedParameters = /* @__PURE__ */ new Set();
678
- const mappings = [];
679
- for (const [outputName, parameterName] of Object.entries(outputParameters)) {
680
- if (mappedParameters.has(parameterName)) {
681
- throw new Error(`Agent parameter "${parameterName}" is mapped from more than one Action output`);
682
- }
683
- mappedParameters.add(parameterName);
684
- mappings.push([parameterName, `{{ outputs.${outputName} }}`]);
685
- }
686
- return Object.fromEntries(mappings);
687
- }
688
- function compileCallableUseSite({
689
- callable,
690
- canonicalKey,
691
- options
692
- }) {
693
- const inputMappings = {};
694
- const inputDescriptions = {};
695
- for (const [name, input] of Object.entries(callable.inputs)) {
696
- const pointer = pointerForInputName(name);
697
- if (input.source === "agent") {
698
- inputDescriptions[pointer] = input.description;
699
- } else {
700
- inputMappings[pointer] = input.value;
701
- }
702
- }
703
- const contractProperties = callable.action.contract?.inputSchema.properties ?? {};
704
- for (const [name, schema] of Object.entries(contractProperties)) {
705
- const pointer = pointerForInputName(name);
706
- if (inputMappings[pointer] !== void 0 || inputDescriptions[pointer] !== void 0) {
707
- continue;
708
- }
709
- if (schema.description.trim() === "") {
710
- throw new Error(`Callable Action "${callable.key}" input "${name}" needs an agent-facing description`);
711
- }
712
- inputDescriptions[pointer] = schema.description;
713
- }
714
- return {
715
- actionUseSiteUuid: resolveIdentity({
716
- options,
717
- kind: "action-use-site",
718
- key: callable.key,
719
- fallbackKeys: [canonicalKey]
720
- }),
721
- actionVersionUuid: resolveActionVersion({ definition: callable.action, options }),
722
- name: callable.name,
723
- description: callable.description,
724
- inputDescriptions,
725
- inputMappings,
726
- outputParameterMappings: compileOutputParameterMappings(callable.outputParameters)
727
- };
728
- }
729
- function compileActionRun({
730
- run,
731
- trigger,
732
- canonicalKey,
733
- options
734
- }) {
735
- return {
736
- actionUseSiteUuid: resolveIdentity({
737
- options,
738
- kind: "action-use-site",
739
- key: run.key,
740
- fallbackKeys: [canonicalKey]
741
- }),
742
- actionVersionUuid: resolveActionVersion({ definition: run.action, options }),
743
- inputMappings: Object.fromEntries(
744
- Object.entries(run.inputs).map(([name, value]) => [
745
- name.startsWith("/") ? name : pointerForInputName(name),
746
- value
747
- ])
748
- ),
749
- outputParameterMappings: compileOutputParameterMappings(run.outputParameters),
750
- trigger
751
- };
752
- }
753
- function collectCallableActions(nodes) {
754
- const byKey = /* @__PURE__ */ new Map();
755
- for (const definition of nodes) {
756
- if (definition.type !== "prompt") {
757
- continue;
758
- }
759
- for (const callable of definition.actions ?? []) {
760
- const existing = byKey.get(callable.key);
761
- if (existing !== void 0 && existing !== callable) {
762
- throw new Error(`Callable Action key "${callable.key}" is defined more than once`);
763
- }
764
- byKey.set(callable.key, callable);
765
- }
766
- }
767
- return [...byKey.values()];
768
- }
769
- function collectInlineActions(definition) {
770
- const byKey = /* @__PURE__ */ new Map();
771
- const visit = (actionDefinition) => {
772
- if (actionDefinition.kind !== "inline") {
773
- return;
774
- }
775
- const existing = byKey.get(actionDefinition.key);
776
- if (existing !== void 0 && existing !== actionDefinition) {
777
- throw new Error(`Inline Action key "${actionDefinition.key}" is defined more than once`);
778
- }
779
- byKey.set(actionDefinition.key, actionDefinition);
780
- };
781
- for (const callable of collectCallableActions(definition.nodes)) {
782
- visit(callable.action);
783
- }
784
- if (definition.beforeCallAction !== null) {
785
- visit(definition.beforeCallAction.action);
786
- }
787
- for (const definitionNode of definition.nodes) {
788
- if (definitionNode.type === "action") {
789
- visit(definitionNode.action);
790
- }
791
- if (definitionNode.type === "prompt" && definitionNode.perTurnAction !== null && definitionNode.perTurnAction !== void 0) {
792
- visit(definitionNode.perTurnAction.action);
793
- }
794
- }
795
- return [...byKey.values()];
796
- }
797
- function compileEdges({
798
- definition,
799
- canonicalNodeKey,
800
- nodeUuids,
801
- options
802
- }) {
803
- return (definition.edges ?? []).map((edgeDefinition, index) => {
804
- const targetUuid = nodeUuids.get(edgeDefinition.to);
805
- if (targetUuid === void 0) {
806
- throw new Error(`Node "${definition.key}" points to unknown node "${edgeDefinition.to}"`);
807
- }
808
- const edgeKey = edgeDefinition.key ?? `${definition.key}:${index}`;
809
- return {
810
- uuid: resolveIdentity({
811
- options,
812
- kind: "edge",
813
- key: edgeKey,
814
- fallbackKeys: [`${canonicalNodeKey}:${index}`]
815
- }),
816
- toNodeUuid: targetUuid,
817
- description: edgeDefinition.when,
818
- priority: edgeDefinition.priority ?? index,
819
- condition: edgeDefinition.condition ?? null
820
- };
821
- });
822
- }
823
- function baseNodeWire({
824
- definition,
825
- canonicalNodeKey,
826
- index,
827
- nodeUuids,
828
- options
829
- }) {
830
- const uuid = nodeUuids.get(definition.key);
831
- if (uuid === void 0) {
832
- throw new Error(`Node "${definition.key}" has no compiled identity`);
833
- }
834
- return {
835
- uuid,
836
- name: definition.name,
837
- isRoot: definition.root ?? false,
838
- position: definition.position ?? { x: index % 4 * 320, y: Math.floor(index / 4) * 220 },
839
- behavior: { waitAfterExecuting: definition.waitAfterExecuting ?? 0 },
840
- edges: compileEdges({ definition, canonicalNodeKey, nodeUuids, options })
841
- };
842
- }
843
- function nodeCapabilities(definition) {
844
- return definition.alwaysAvailable === void 0 ? {} : { alwaysAvailable: definition.alwaysAvailable };
845
- }
846
- function promptNodeCapabilities(definition) {
847
- const base = nodeCapabilities(definition);
848
- if (definition.transfer === void 0) {
849
- return base;
850
- }
851
- return {
852
- ...base,
853
- transfer: {
854
- enabled: definition.transfer.enabled,
855
- phoneNumber: definition.transfer.phoneNumber ?? null,
856
- timeout: definition.transfer.timeout ?? 120,
857
- mode: definition.transfer.mode ?? "cold",
858
- description: definition.transfer.description ?? null,
859
- voicemailMessage: definition.transfer.voicemailMessage ?? null
860
- }
861
- };
862
- }
863
- function compileNode({
864
- definition,
865
- canonicalNodeKey,
866
- canonicalCallableKeys,
867
- index,
868
- nodeUuids,
869
- options
870
- }) {
871
- const base = baseNodeWire({ definition, canonicalNodeKey, index, nodeUuids, options });
872
- const builtInTools = nodeCapabilities(definition);
873
- switch (definition.type) {
874
- case "global":
875
- return {
876
- ...base,
877
- type: "global",
878
- prompt: compilePrompt(definition.prompt, options)
879
- };
880
- case "prompt": {
881
- const perTurnAction = definition.perTurnAction === null || definition.perTurnAction === void 0 ? null : compileActionRun({
882
- run: definition.perTurnAction,
883
- trigger: "every_turn",
884
- canonicalKey: `${canonicalNodeKey}:every-turn`,
885
- options
886
- });
887
- return {
888
- ...base,
889
- type: "standard",
890
- prompt: compilePrompt(definition.prompt, options),
891
- toolUuids: [],
892
- // Present whenever `actions` is declared, even when empty, so an
893
- // explicit empty list survives the round trip.
894
- ...definition.actions === void 0 ? {} : {
895
- toolUseSiteUuids: definition.actions.map(
896
- (callable) => resolveIdentity({
897
- options,
898
- kind: "action-use-site",
899
- key: callable.key,
900
- fallbackKeys: [canonicalCallableKeys.get(callable.key) ?? callable.key]
901
- })
902
- )
903
- },
904
- knowledgeBaseUuids: (definition.knowledgeBases ?? []).map((item) => item.uuid),
905
- customDataTableNames: definition.customDataTables ?? [],
906
- builtInTools: promptNodeCapabilities(definition),
907
- sopSpec: definition.sopSpec ?? null,
908
- overrides: {
909
- ...definition.voiceOverride === void 0 ? {} : { voice: definition.voiceOverride },
910
- ...definition.llmOverride === void 0 ? {} : {
911
- llm: {
912
- model: definition.llmOverride.model,
913
- llmModelUuid: definition.llmOverride.modelUuid,
914
- temperature: definition.llmOverride.temperature
915
- }
916
- }
917
- },
918
- behavior: {
919
- ...base.behavior,
920
- ...definition.vadMinSilenceDuration === void 0 ? {} : { vadMinSilenceDuration: definition.vadMinSilenceDuration },
921
- ...definition.waitAfterTransfer === void 0 ? {} : { waitAfterTransfer: definition.waitAfterTransfer }
922
- },
923
- // These three round-trip three states each: absent, explicit null, or a
924
- // value. The product emits all three across different nodes, so
925
- // `undefined` means "omit the key" and `null` means "write null".
926
- ...definition.perTurnWebhook === void 0 ? {} : { perTurnWebhook: definition.perTurnWebhook },
927
- ...definition.perTurnExtraction === void 0 ? {} : {
928
- perTurnExtractionFields: definition.perTurnExtraction === null ? null : extractionFieldsFromZod(definition.perTurnExtraction)
929
- },
930
- ...definition.perTurnAction === void 0 ? {} : { perTurnAction }
931
- };
932
- }
933
- case "action":
934
- return {
935
- ...base,
936
- type: "action_node",
937
- actionVersionUuid: resolveActionVersion({ definition: definition.action, options }),
938
- inputMappings: Object.fromEntries(
939
- Object.entries(definition.inputs).map(([name, value]) => [
940
- name.startsWith("/") ? name : pointerForInputName(name),
941
- value
942
- ])
943
- ),
944
- outputParameterMappings: compileOutputParameterMappings(definition.outputParameters ?? {}),
945
- runInBackground: definition.runInBackground ?? false,
946
- backgroundMessage: definition.backgroundMessage ?? null,
947
- executionMessage: definition.executionMessage ?? null,
948
- mockResponseData: definition.mockResponseData ?? null,
949
- builtInTools
950
- };
951
- case "http":
952
- return {
953
- ...base,
954
- type: "http",
955
- url: definition.url,
956
- method: definition.method,
957
- headers: definition.headers ?? {},
958
- body: definition.body ?? null,
959
- responseSelectors: definition.responseSelectors ?? [],
960
- runInBackground: definition.runInBackground ?? false,
961
- backgroundMessage: definition.backgroundMessage ?? null,
962
- executionMessage: definition.executionMessage ?? null,
963
- mockResponseData: definition.mockResponseData ?? null,
964
- builtInTools
965
- };
966
- case "extract":
967
- return {
968
- ...base,
969
- type: "extract",
970
- fields: extractionFieldsFromZod(definition.schema),
971
- executionMessage: definition.message ?? null,
972
- builtInTools
973
- };
974
- case "say":
975
- return {
976
- ...base,
977
- type: "say",
978
- executionMessage: definition.text,
979
- overrides: definition.voiceUuid === void 0 ? {} : { voice: { voiceUuid: definition.voiceUuid } },
980
- behavior: {
981
- ...base.behavior,
982
- ...definition.waitAfterSay === void 0 ? {} : { waitAfterSay: definition.waitAfterSay }
983
- },
984
- builtInTools
985
- };
986
- case "end-call":
987
- return {
988
- ...base,
989
- type: "end_call",
990
- executionMessage: definition.message ?? null,
991
- builtInTools
992
- };
993
- case "route":
994
- return {
995
- ...base,
996
- type: "routing",
997
- description: definition.description,
998
- builtInTools
999
- };
1000
- case "ab-test":
1001
- return {
1002
- ...base,
1003
- type: "ab_test",
1004
- abTestGroupUuid: definition.abTestGroupUuid,
1005
- builtInTools
1006
- };
1007
- case "transfer": {
1008
- const transfer = {
1009
- enabled: true,
1010
- phoneNumber: definition.phoneNumber,
1011
- timeout: definition.timeout ?? 120,
1012
- mode: definition.mode ?? "cold",
1013
- description: definition.description ?? null,
1014
- voicemailMessage: definition.voicemailMessage ?? null
1015
- };
1016
- return {
1017
- ...base,
1018
- type: "transfer",
1019
- executionMessage: definition.message ?? null,
1020
- behavior: {
1021
- ...base.behavior,
1022
- ...definition.waitAfterTransfer === void 0 ? {} : { waitAfterTransfer: definition.waitAfterTransfer }
1023
- },
1024
- builtInTools: { ...builtInTools, transfer }
1025
- };
1026
- }
1027
- case "transfer-chat":
1028
- return {
1029
- ...base,
1030
- type: "transfer_chat",
1031
- executionMessage: definition.message ?? null,
1032
- mode: definition.mode,
1033
- five9TenantName: definition.five9TenantName ?? "",
1034
- five9CampaignName: definition.five9CampaignName ?? "",
1035
- five9ContactMapping: definition.five9ContactMapping ?? {},
1036
- five9AttributesMapping: definition.five9AttributesMapping ?? [],
1037
- builtInTools
1038
- };
1039
- }
1040
- }
1041
- function validateDefinition(definition) {
1042
- const keys = definition.nodes.map((definitionNode) => definitionNode.key);
1043
- if (new Set(keys).size !== keys.length) {
1044
- throw new Error("Every node key must be unique");
1045
- }
1046
- if (definition.nodes.length === 0) {
1047
- return;
1048
- }
1049
- const roots = definition.nodes.filter((definitionNode) => definitionNode.root === true);
1050
- if (roots.length !== 1) {
1051
- throw new Error(`An agent with nodes must contain exactly one root node; received ${roots.length}`);
1052
- }
1053
- if (definition.nodes.some((definitionNode) => definitionNode.type === "global" && definitionNode.root === true)) {
1054
- throw new Error("The global node cannot be the root node");
1055
- }
1056
- }
1057
- function compileAgent(definition, options = {}) {
1058
- validateDefinition(definition);
1059
- const canonicalNodeKeys = canonicalAuthoringKeys(
1060
- definition.nodes.map((definitionNode, index) => ({
1061
- value: definitionNode.name,
1062
- fallback: `node-${index + 1}`
1063
- }))
1064
- );
1065
- const canonicalNodeKeysByDefinitionKey = new Map(
1066
- definition.nodes.map((definitionNode, index) => [
1067
- definitionNode.key,
1068
- canonicalNodeKeys[index] ?? definitionNode.key
1069
- ])
1070
- );
1071
- const nodeUuids = new Map(
1072
- definition.nodes.map((definitionNode, index) => [
1073
- definitionNode.key,
1074
- resolveIdentity({
1075
- options,
1076
- kind: "node",
1077
- key: definitionNode.key,
1078
- fallbackKeys: [canonicalNodeKeys[index] ?? definitionNode.key]
1079
- })
1080
- ])
1081
- );
1082
- const callables = collectCallableActions(definition.nodes);
1083
- const canonicalCallableKeys = canonicalAuthoringKeys(
1084
- callables.map((callable, index) => ({
1085
- value: callable.name,
1086
- fallback: `action-${index + 1}`
1087
- }))
1088
- );
1089
- const canonicalCallableKeysByDefinitionKey = new Map(
1090
- callables.map((callable, index) => [callable.key, canonicalCallableKeys[index] ?? callable.key])
1091
- );
1092
- const toolUseSites = callables.map(
1093
- (callable) => compileCallableUseSite({
1094
- callable,
1095
- canonicalKey: canonicalCallableKeysByDefinitionKey.get(callable.key) ?? callable.key,
1096
- options
1097
- })
1098
- );
1099
- const inlineActions = collectInlineActions(definition);
1100
- const abTestGroupIds = [
1101
- ...new Set(
1102
- definition.nodes.flatMap(
1103
- (definitionNode) => definitionNode.type === "ab-test" ? [definitionNode.abTestGroupUuid] : []
1104
- )
1105
- )
1106
- ];
1107
- return {
1108
- agent: {
1109
- key: definition.key,
1110
- name: definition.name,
1111
- description: definition.description,
1112
- modality: definition.modality,
1113
- folderUuid: definition.folderUuid,
1114
- analyzerUuids: definition.analyzerUuids,
1115
- tagUuids: definition.tagUuids,
1116
- containmentConfig: definition.containmentConfig
1117
- },
1118
- branch: { name: definition.branch },
1119
- actions: inlineActions.map((definitionAction) => ({
1120
- key: definitionAction.key,
1121
- versionUuid: resolveActionVersion({
1122
- definition: definitionAction,
1123
- options
1124
- }),
1125
- values: compileAction(definitionAction, {
1126
- ...options.readActionSourceFile === void 0 ? {} : { readSourceFile: options.readActionSourceFile }
1127
- })
1128
- })),
1129
- content: {
1130
- config: {
1131
- voice: {
1132
- voiceUuid: definition.voice.voiceUuid,
1133
- backgroundNoise: definition.voice.backgroundNoise
1134
- },
1135
- llm: {
1136
- model: definition.llm.model,
1137
- llmModelUuid: definition.llm.modelUuid,
1138
- temperature: definition.llm.temperature
1139
- },
1140
- speech: definition.speech,
1141
- call: {
1142
- agentSpeaksFirst: definition.call.agentSpeaksFirst,
1143
- firstSentence: definition.call.firstSentence,
1144
- maxCallLengthSeconds: definition.call.maxCallLengthSeconds,
1145
- record: definition.call.record,
1146
- checkInAfterSilence: definition.call.checkInAfterSilence,
1147
- endCallAfterExtendedSilence: definition.call.endCallAfterExtendedSilence,
1148
- pciEnabled: definition.call.pciEnabled,
1149
- backgroundNoise: {
1150
- trackName: definition.call.backgroundNoiseTrack ?? definition.voice.backgroundNoise,
1151
- ...definition.call.backgroundNoiseGain === null ? {} : { gainMultiplier: definition.call.backgroundNoiseGain }
1152
- },
1153
- ...definition.call.interruptionMode === null ? {} : { interruptionConfig: { mode: definition.call.interruptionMode } }
1154
- },
1155
- preCallWebhook: definition.preCallWebhook,
1156
- builtInTools: definition.capabilities,
1157
- assignedToolIds: [],
1158
- // Emitted whenever any node declares an `actions` array, so an Agent
1159
- // that once had callable Actions keeps its explicit empty list rather
1160
- // than dropping the key.
1161
- ...definition.nodes.some(
1162
- (definitionNode) => definitionNode.type === "prompt" && definitionNode.actions !== void 0
1163
- ) ? { toolUseSites } : {},
1164
- automaticActions: {
1165
- beforeCallStart: definition.beforeCallAction === null ? null : compileActionRun({
1166
- run: definition.beforeCallAction,
1167
- trigger: "before_call_start",
1168
- canonicalKey: "before-call-start",
1169
- options
1170
- })
1171
- },
1172
- knowledgeBaseIds: definition.knowledgeBases.map((item) => item.uuid),
1173
- abTestGroupIds: definition.abTestGroupIds ?? abTestGroupIds
1174
- },
1175
- nodes: definition.nodes.map(
1176
- (definitionNode, index) => compileNode({
1177
- definition: definitionNode,
1178
- canonicalNodeKey: canonicalNodeKeysByDefinitionKey.get(definitionNode.key) ?? definitionNode.key,
1179
- canonicalCallableKeys: canonicalCallableKeysByDefinitionKey,
1180
- index,
1181
- nodeUuids,
1182
- options
1183
- })
1184
- ),
1185
- summaryPrompt: definition.summaryPrompt
1186
- }
1187
- };
1188
- }
1189
-
1190
- // src/schemas.ts
1191
- var import_zod3 = require("zod");
1192
- var MAX_QUERY_SIZE = 50;
1193
- var MAX_BATCH_ROWS = 1e3;
1194
- var tableNameSchema = import_zod3.z.string().regex(/^[a-z0-9_]+$/, "Table names are lowercase snake_case identifiers");
1195
- var filterValueSchema = import_zod3.z.union([import_zod3.z.string(), import_zod3.z.number(), import_zod3.z.boolean()]);
1196
- var dataColumnPathSchema = import_zod3.z.string().trim().min(1).max(1024).refine((path) => path.split(".").every((segment) => segment.length > 0), {
1197
- message: "Must be a dot-separated column path with no empty segments"
1198
- });
1199
- var dataFilterSchema = import_zod3.z.object({
1200
- column: dataColumnPathSchema,
1201
- values: import_zod3.z.array(filterValueSchema)
1202
- });
1203
- var queryInputSchema = import_zod3.z.object({
1204
- tableName: tableNameSchema,
1205
- filters: import_zod3.z.array(dataFilterSchema).optional(),
1206
- text: import_zod3.z.string().max(5e3).optional(),
1207
- size: import_zod3.z.number().int().min(0).max(MAX_QUERY_SIZE).optional(),
1208
- from: import_zod3.z.number().int().min(0).optional()
1209
- });
1210
- var listOptionsSchema = import_zod3.z.object({
1211
- page: import_zod3.z.number().int().min(1).optional(),
1212
- perPage: import_zod3.z.number().int().min(1).max(200).optional(),
1213
- orderBy: import_zod3.z.string().optional(),
1214
- orderDirection: import_zod3.z.enum(["asc", "desc"]).optional(),
1215
- /** Column-name → value equality filters applied server-side. */
1216
- filters: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.string()).optional()
1217
- });
1218
- var recordPayloadSchema = import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown());
1219
- var batchUpsertRowsSchema = import_zod3.z.array(recordPayloadSchema).min(1).max(MAX_BATCH_ROWS);
1220
-
1221
- // src/data.ts
1222
- function encodeTable(tableName) {
1223
- return encodeURIComponent(tableNameSchema.parse(tableName));
1224
- }
1225
- var DataClient = class {
1226
- #http;
1227
- constructor(http) {
1228
- this.#http = http;
1229
- }
1230
- /** Facet-filtered search over an indexed table (Elasticsearch-backed, max 50 hits). */
1231
- async query(input) {
1232
- const parsed = queryInputSchema.parse(input);
1233
- const result = await this.#http.request({ method: "POST", path: "/data/query", body: parsed });
1234
- return result;
1235
- }
1236
- /** Facet values for an indexed table. */
1237
- async facets(tableName) {
1238
- const result = await this.#http.request({ method: "GET", path: `/data/facets/${encodeTable(tableName)}` });
1239
- return result;
1240
- }
1241
- /** Paginated listing straight from the relational store. */
1242
- async list(tableName, options = {}) {
1243
- const parsed = listOptionsSchema.parse(options);
1244
- const query = { ...parsed.filters ?? {} };
1245
- if (parsed.page !== void 0) {
1246
- query.page = String(parsed.page);
1247
- }
1248
- if (parsed.perPage !== void 0) {
1249
- query.per_page = String(parsed.perPage);
1250
- }
1251
- if (parsed.orderBy !== void 0) {
1252
- query.order_by = parsed.orderBy;
1253
- }
1254
- if (parsed.orderDirection !== void 0) {
1255
- query.order_direction = parsed.orderDirection;
1256
- }
1257
- const result = await this.#http.request({ method: "GET", path: `/data/${encodeTable(tableName)}`, query });
1258
- return result;
1259
- }
1260
- async get(tableName, id) {
1261
- const result = await this.#http.request({ method: "GET", path: `/data/${encodeTable(tableName)}/${id}` });
1262
- return result;
1263
- }
1264
- async create(tableName, payload) {
1265
- const result = await this.#http.request({
1266
- method: "PUT",
1267
- path: `/data/${encodeTable(tableName)}`,
1268
- body: recordPayloadSchema.parse(payload)
1269
- });
1270
- return result;
1271
- }
1272
- async update(tableName, id, payload) {
1273
- const result = await this.#http.request({
1274
- method: "PATCH",
1275
- path: `/data/${encodeTable(tableName)}/${id}`,
1276
- body: recordPayloadSchema.parse(payload)
1277
- });
1278
- return result;
1279
- }
1280
- async delete(tableName, id) {
1281
- const result = await this.#http.request({ method: "DELETE", path: `/data/${encodeTable(tableName)}/${id}` });
1282
- return result;
1283
- }
1284
- /** Deletes every record in the table. Irreversible. */
1285
- async deleteAll(tableName) {
1286
- const result = await this.#http.request({ method: "DELETE", path: `/data/${encodeTable(tableName)}` });
1287
- return result;
1288
- }
1289
- /**
1290
- * Asynchronous bulk upsert (max 1000 rows per call). Rows are FULL-ROW
1291
- * REPLACE on key conflict — omitted columns are cleared, not preserved.
1292
- * Returns a batch handle; poll `getBatch` for completion.
1293
- */
1294
- async batchUpsert(tableName, rows) {
1295
- const result = await this.#http.request({
1296
- method: "PUT",
1297
- path: `/data/${encodeTable(tableName)}/batch`,
1298
- body: { rows: batchUpsertRowsSchema.parse(rows) }
1299
- });
1300
- return result;
1301
- }
1302
- /** Status of an async upsert batch created by `batchUpsert`. */
1303
- async getBatch(ingestBatchId) {
1304
- const result = await this.#http.request({
1305
- method: "GET",
1306
- path: `/data/_batches/${encodeURIComponent(ingestBatchId)}`
1307
- });
1308
- return result;
1309
- }
1310
- };
1311
-
1312
- // src/errors.ts
1313
- var SimpleAIError = class extends Error {
1314
- /** HTTP status code, or 0 when the request never reached the API. */
1315
- status;
1316
- /** Machine-readable error code from the API body, when present. */
1317
- code;
1318
- /** The parsed response body (JSON when possible, otherwise raw text). */
1319
- body;
1320
- constructor({
1321
- message,
1322
- status,
1323
- code,
1324
- body,
1325
- cause
1326
- }) {
1327
- super(message, cause === void 0 ? void 0 : { cause });
1328
- this.name = "SimpleAIError";
1329
- this.status = status;
1330
- this.code = code;
1331
- this.body = body;
1332
- }
1333
- };
1334
-
1335
- // src/http.ts
1336
- function parseBody(text) {
1337
- if (text.length === 0) {
1338
- return null;
1339
- }
1340
- try {
1341
- return JSON.parse(text);
1342
- } catch {
1343
- return text;
1344
- }
1345
- }
1346
- function errorDetails(body) {
1347
- if (body !== null && typeof body === "object") {
1348
- const record = body;
1349
- const code = typeof record.code === "string" ? record.code : null;
1350
- const message = typeof record.message === "string" ? record.message : typeof record.error === "string" ? record.error : null;
1351
- return { code, message };
1352
- }
1353
- return { code: null, message: typeof body === "string" && body.length > 0 ? body : null };
1354
- }
1355
- function createHttpClient({
1356
- baseUrl,
1357
- apiKey,
1358
- fetchImplementation
1359
- }) {
1360
- const normalizedBase = baseUrl.replace(/\/+$/, "");
1361
- return {
1362
- request: async ({ method, path, query, body }) => {
1363
- const queryString = query === void 0 || Object.keys(query).length === 0 ? "" : `?${new URLSearchParams(query).toString()}`;
1364
- const url = `${normalizedBase}${path}${queryString}`;
1365
- let response;
1366
- try {
1367
- response = await fetchImplementation(url, {
1368
- method,
1369
- headers: {
1370
- authorization: `Bearer ${apiKey}`,
1371
- "content-type": "application/json",
1372
- accept: "application/json"
1373
- },
1374
- ...body === void 0 ? {} : { body: JSON.stringify(body) }
1375
- });
1376
- } catch (e) {
1377
- throw new SimpleAIError({
1378
- message: `Request to ${method} ${path} failed: ${e instanceof Error ? e.message : String(e)}`,
1379
- status: 0,
1380
- code: "network_error",
1381
- body: null,
1382
- cause: e
1383
- });
1384
- }
1385
- const parsed = parseBody(await response.text());
1386
- if (!response.ok) {
1387
- const { code, message } = errorDetails(parsed);
1388
- throw new SimpleAIError({
1389
- message: message ?? `Request to ${method} ${path} failed with status ${response.status}`,
1390
- status: response.status,
1391
- code,
1392
- body: parsed
1393
- });
1394
- }
1395
- return parsed;
1396
- }
1397
- };
1398
- }
1399
-
1400
- // src/client.ts
1401
- var DEFAULT_BASE_URL = "https://api.prod.usesimple.ai/api/v1";
1402
- function envVar(name) {
1403
- if (typeof process === "undefined" || process.env === void 0) {
1404
- return void 0;
1405
- }
1406
- const value = process.env[name];
1407
- return value === void 0 || value === "" ? void 0 : value;
1408
- }
1409
- var SimpleAI = class {
1410
- /** Custom data tables — query, read, and write records. */
1411
- data;
1412
- constructor(options = {}) {
1413
- const apiKey = options.apiKey ?? envVar("SIMPLE_API_KEY");
1414
- if (apiKey === void 0) {
1415
- throw new Error(
1416
- "Missing API key. Pass `apiKey` to new SimpleAI(...) or set the SIMPLE_API_KEY environment variable. Inside Simple AI code actions the key is injected automatically."
1417
- );
1418
- }
1419
- const baseUrl = options.baseUrl ?? envVar("SIMPLE_BASE_URL") ?? DEFAULT_BASE_URL;
1420
- const fetchImplementation = options.fetch ?? ((url, init) => fetch(url, init));
1421
- const http = createHttpClient({ baseUrl, apiKey, fetchImplementation });
1422
- this.data = new DataClient(http);
1423
- }
1424
- };
1425
-
1426
- // src/define-action.ts
1427
- var SIMPLE_ACTION_BRAND = /* @__PURE__ */ Symbol.for("simple-ai.action");
1428
- function defineAction(handler) {
1429
- const wrapped = async ({ inputs, config }) => {
1430
- const client = new SimpleAI();
1431
- return handler({ inputs, config, client });
1432
- };
1433
- return Object.assign(wrapped, { [SIMPLE_ACTION_BRAND]: true });
1434
- }
1435
-
1436
- // src/projects.ts
1437
- function defineAgentSnapshot(definition) {
1438
- return { kind: "agent-snapshot", ...definition };
1439
- }
1440
- function replaceActionVersionUuid({
1441
- versionUuid,
1442
- actions,
1443
- options
1444
- }) {
1445
- const actionDefinition = actions.find((item) => item.sourceVersionUuid === versionUuid);
1446
- if (actionDefinition === void 0) {
1447
- return versionUuid;
1448
- }
1449
- return options.actionVersionUuids?.[actionDefinition.key] ?? versionUuid;
1450
- }
1451
- function compileSnapshotNode({
1452
- node: node2,
1453
- actions,
1454
- options
1455
- }) {
1456
- if (node2.type === "action_node") {
1457
- return {
1458
- ...node2,
1459
- actionVersionUuid: replaceActionVersionUuid({
1460
- versionUuid: node2.actionVersionUuid,
1461
- actions,
1462
- options
1463
- })
1464
- };
1465
- }
1466
- if (node2.type === "standard" && node2.perTurnAction != null) {
1467
- return {
1468
- ...node2,
1469
- perTurnAction: {
1470
- ...node2.perTurnAction,
1471
- actionVersionUuid: replaceActionVersionUuid({
1472
- versionUuid: node2.perTurnAction.actionVersionUuid,
1473
- actions,
1474
- options
1475
- })
1476
- }
1477
- };
1478
- }
1479
- return node2;
1480
- }
1481
- function compileSnapshot(definition, options) {
1482
- const snapshotActionValues = (values) => {
1483
- switch (values.actionType) {
1484
- case "code":
1485
- return {
1486
- ...values,
1487
- operation: {
1488
- ...values.operation,
1489
- compiledJs: null
1490
- }
1491
- };
1492
- case "http":
1493
- case "custom_data":
1494
- case "knowledge_base":
1495
- return values;
1496
- }
1497
- };
1498
- return {
1499
- agent: definition.agent,
1500
- branch: definition.branch,
1501
- actions: definition.actions.map((item) => ({
1502
- key: item.key,
1503
- versionUuid: replaceActionVersionUuid({
1504
- versionUuid: item.sourceVersionUuid,
1505
- actions: definition.actions,
1506
- options
1507
- }),
1508
- values: snapshotActionValues(item.values)
1509
- })),
1510
- content: {
1511
- ...definition.content,
1512
- config: {
1513
- ...definition.content.config,
1514
- ...definition.content.config.toolUseSites === void 0 ? {} : {
1515
- toolUseSites: definition.content.config.toolUseSites.map((useSite) => ({
1516
- ...useSite,
1517
- actionVersionUuid: replaceActionVersionUuid({
1518
- versionUuid: useSite.actionVersionUuid,
1519
- actions: definition.actions,
1520
- options
1521
- })
1522
- }))
1523
- },
1524
- automaticActions: {
1525
- beforeCallStart: definition.content.config.automaticActions.beforeCallStart === null ? null : {
1526
- ...definition.content.config.automaticActions.beforeCallStart,
1527
- actionVersionUuid: replaceActionVersionUuid({
1528
- versionUuid: definition.content.config.automaticActions.beforeCallStart.actionVersionUuid,
1529
- actions: definition.actions,
1530
- options
1531
- })
1532
- }
1533
- }
1534
- },
1535
- nodes: definition.content.nodes.map(
1536
- (node2) => compileSnapshotNode({ node: node2, actions: definition.actions, options })
1537
- )
1538
- }
1539
- };
1540
- }
1541
- function compileAgentProject(definition, options = {}) {
1542
- return definition.kind === "agent-definition" ? compileAgent(definition, options) : compileSnapshot(definition, options);
1543
- }
1544
- function collectActionVersionUuids(content) {
1545
- const versionUuids = /* @__PURE__ */ new Set();
1546
- for (const useSite of content.config.toolUseSites ?? []) {
1547
- versionUuids.add(useSite.actionVersionUuid);
1548
- }
1549
- const beforeCallAction = content.config.automaticActions.beforeCallStart;
1550
- if (beforeCallAction !== null) {
1551
- versionUuids.add(beforeCallAction.actionVersionUuid);
1552
- }
1553
- for (const node2 of content.nodes) {
1554
- if (node2.type === "action_node") {
1555
- versionUuids.add(node2.actionVersionUuid);
1556
- }
1557
- if (node2.type === "standard" && node2.perTurnAction != null) {
1558
- versionUuids.add(node2.perTurnAction.actionVersionUuid);
1559
- }
1560
- }
1561
- return [...versionUuids];
1562
- }
1563
- // Annotate the CommonJS export names for ESM import in node:
1564
- 0 && (module.exports = {
1565
- DataClient,
1566
- MAX_BATCH_ROWS,
1567
- MAX_QUERY_SIZE,
1568
- SIMPLE_ACTION_BRAND,
1569
- SimpleAI,
1570
- SimpleAIError,
1571
- action,
1572
- actionsIoSchemaFromZod,
1573
- batchUpsertRowsSchema,
1574
- canonicalAuthoringKey,
1575
- canonicalAuthoringKeys,
1576
- collectActionVersionUuids,
1577
- compileAction,
1578
- compileAgent,
1579
- compileAgentProject,
1580
- dataColumnPathSchema,
1581
- dataFilterSchema,
1582
- defineAction,
1583
- defineAgent,
1584
- defineAgentSnapshot,
1585
- listOptionsSchema,
1586
- node,
1587
- prompt,
1588
- queryInputSchema,
1589
- recordPayloadSchema,
1590
- reference,
1591
- sourceFile,
1592
- tableNameSchema
1593
- });
1594
- //# sourceMappingURL=index.cjs.map
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_QUERY_SIZE = exports.MAX_BATCH_ROWS = exports.listOptionsSchema = exports.dataFilterSchema = exports.dataColumnPathSchema = exports.batchUpsertRowsSchema = exports.normalizeAgentV2CommitContent = exports.defineAgentSnapshot = exports.compileAgentProject = exports.collectActionVersionUuids = exports.DataClient = exports.ActionCapability = exports.SIMPLE_ACTION_BRAND = exports.defineCustomDataTransform = exports.defineAction = exports.SimpleAI = exports.VALIDATE_ADDRESS_OUTPUT_SCHEMA = exports.VALIDATE_ADDRESS_OUTPUT_MAPPINGS = exports.VALIDATE_ADDRESS_INPUT_SCHEMA = exports.SEND_TEXT_MESSAGE_OUTPUT_SCHEMA = exports.SEND_TEXT_MESSAGE_OUTPUT_MAPPINGS = exports.SEND_TEXT_MESSAGE_INPUT_SCHEMA = exports.SEND_EMAIL_OUTPUT_SCHEMA = exports.SEND_EMAIL_OUTPUT_MAPPINGS = exports.SEND_EMAIL_INPUT_SCHEMA = exports.BUILT_IN_ACTION_CONTRACTS = exports.TRANSITION_FILTER_MAX_DEPTH = exports.TRANSITION_FILTER_MAX_CONDITIONS = exports.resolveExtractionFields = exports.reference = exports.prompt = exports.node = exports.MAX_CONTAINMENT_RULE_DEPTH = exports.FIVE9_SIP_BYE_HEADER_NAMES = exports.defineAgent = exports.defaultBackgroundNoise = exports.DEFAULT_TRANSITION_MESSAGE = exports.DEFAULT_PER_TURN_RETRIEVAL_TOP_K = exports.DEFAULT_PER_TURN_RETRIEVAL_RECENT_TURNS = exports.DEFAULT_CHECK_IN_AFTER_SILENCE_DELAY_SECONDS = exports.compileAgent = exports.canonicalAuthoringKeys = exports.canonicalAuthoringKey = exports.sourceFile = exports.compileAction = exports.canonicalActionSource = exports.actionsIoSchemaFromZod = exports.action = exports.resolveActionIoSchema = exports.resolveActionHttpHeaders = void 0;
4
+ exports.SimpleAIError = exports.MissingCapabilityError = exports.tableNameSchema = exports.recordPayloadSchema = exports.queryInputSchema = void 0;
5
+ var actions_1 = require("./actions.cjs");
6
+ Object.defineProperty(exports, "resolveActionHttpHeaders", { enumerable: true, get: function () { return actions_1.resolveActionHttpHeaders; } });
7
+ Object.defineProperty(exports, "resolveActionIoSchema", { enumerable: true, get: function () { return actions_1.resolveActionIoSchema; } });
8
+ Object.defineProperty(exports, "action", { enumerable: true, get: function () { return actions_1.action; } });
9
+ Object.defineProperty(exports, "actionsIoSchemaFromZod", { enumerable: true, get: function () { return actions_1.actionsIoSchemaFromZod; } });
10
+ Object.defineProperty(exports, "canonicalActionSource", { enumerable: true, get: function () { return actions_1.canonicalActionSource; } });
11
+ Object.defineProperty(exports, "compileAction", { enumerable: true, get: function () { return actions_1.compileAction; } });
12
+ Object.defineProperty(exports, "sourceFile", { enumerable: true, get: function () { return actions_1.sourceFile; } });
13
+ var agents_1 = require("./agents.cjs");
14
+ Object.defineProperty(exports, "canonicalAuthoringKey", { enumerable: true, get: function () { return agents_1.canonicalAuthoringKey; } });
15
+ Object.defineProperty(exports, "canonicalAuthoringKeys", { enumerable: true, get: function () { return agents_1.canonicalAuthoringKeys; } });
16
+ Object.defineProperty(exports, "compileAgent", { enumerable: true, get: function () { return agents_1.compileAgent; } });
17
+ Object.defineProperty(exports, "DEFAULT_CHECK_IN_AFTER_SILENCE_DELAY_SECONDS", { enumerable: true, get: function () { return agents_1.DEFAULT_CHECK_IN_AFTER_SILENCE_DELAY_SECONDS; } });
18
+ Object.defineProperty(exports, "DEFAULT_PER_TURN_RETRIEVAL_RECENT_TURNS", { enumerable: true, get: function () { return agents_1.DEFAULT_PER_TURN_RETRIEVAL_RECENT_TURNS; } });
19
+ Object.defineProperty(exports, "DEFAULT_PER_TURN_RETRIEVAL_TOP_K", { enumerable: true, get: function () { return agents_1.DEFAULT_PER_TURN_RETRIEVAL_TOP_K; } });
20
+ Object.defineProperty(exports, "DEFAULT_TRANSITION_MESSAGE", { enumerable: true, get: function () { return agents_1.DEFAULT_TRANSITION_MESSAGE; } });
21
+ Object.defineProperty(exports, "defaultBackgroundNoise", { enumerable: true, get: function () { return agents_1.defaultBackgroundNoise; } });
22
+ Object.defineProperty(exports, "defineAgent", { enumerable: true, get: function () { return agents_1.defineAgent; } });
23
+ Object.defineProperty(exports, "FIVE9_SIP_BYE_HEADER_NAMES", { enumerable: true, get: function () { return agents_1.FIVE9_SIP_BYE_HEADER_NAMES; } });
24
+ Object.defineProperty(exports, "MAX_CONTAINMENT_RULE_DEPTH", { enumerable: true, get: function () { return agents_1.MAX_CONTAINMENT_RULE_DEPTH; } });
25
+ Object.defineProperty(exports, "node", { enumerable: true, get: function () { return agents_1.node; } });
26
+ Object.defineProperty(exports, "prompt", { enumerable: true, get: function () { return agents_1.prompt; } });
27
+ Object.defineProperty(exports, "reference", { enumerable: true, get: function () { return agents_1.reference; } });
28
+ Object.defineProperty(exports, "resolveExtractionFields", { enumerable: true, get: function () { return agents_1.resolveExtractionFields; } });
29
+ Object.defineProperty(exports, "TRANSITION_FILTER_MAX_CONDITIONS", { enumerable: true, get: function () { return agents_1.TRANSITION_FILTER_MAX_CONDITIONS; } });
30
+ Object.defineProperty(exports, "TRANSITION_FILTER_MAX_DEPTH", { enumerable: true, get: function () { return agents_1.TRANSITION_FILTER_MAX_DEPTH; } });
31
+ var built_in_actions_1 = require("./built-in-actions.cjs");
32
+ Object.defineProperty(exports, "BUILT_IN_ACTION_CONTRACTS", { enumerable: true, get: function () { return built_in_actions_1.BUILT_IN_ACTION_CONTRACTS; } });
33
+ Object.defineProperty(exports, "SEND_EMAIL_INPUT_SCHEMA", { enumerable: true, get: function () { return built_in_actions_1.SEND_EMAIL_INPUT_SCHEMA; } });
34
+ Object.defineProperty(exports, "SEND_EMAIL_OUTPUT_MAPPINGS", { enumerable: true, get: function () { return built_in_actions_1.SEND_EMAIL_OUTPUT_MAPPINGS; } });
35
+ Object.defineProperty(exports, "SEND_EMAIL_OUTPUT_SCHEMA", { enumerable: true, get: function () { return built_in_actions_1.SEND_EMAIL_OUTPUT_SCHEMA; } });
36
+ Object.defineProperty(exports, "SEND_TEXT_MESSAGE_INPUT_SCHEMA", { enumerable: true, get: function () { return built_in_actions_1.SEND_TEXT_MESSAGE_INPUT_SCHEMA; } });
37
+ Object.defineProperty(exports, "SEND_TEXT_MESSAGE_OUTPUT_MAPPINGS", { enumerable: true, get: function () { return built_in_actions_1.SEND_TEXT_MESSAGE_OUTPUT_MAPPINGS; } });
38
+ Object.defineProperty(exports, "SEND_TEXT_MESSAGE_OUTPUT_SCHEMA", { enumerable: true, get: function () { return built_in_actions_1.SEND_TEXT_MESSAGE_OUTPUT_SCHEMA; } });
39
+ Object.defineProperty(exports, "VALIDATE_ADDRESS_INPUT_SCHEMA", { enumerable: true, get: function () { return built_in_actions_1.VALIDATE_ADDRESS_INPUT_SCHEMA; } });
40
+ Object.defineProperty(exports, "VALIDATE_ADDRESS_OUTPUT_MAPPINGS", { enumerable: true, get: function () { return built_in_actions_1.VALIDATE_ADDRESS_OUTPUT_MAPPINGS; } });
41
+ Object.defineProperty(exports, "VALIDATE_ADDRESS_OUTPUT_SCHEMA", { enumerable: true, get: function () { return built_in_actions_1.VALIDATE_ADDRESS_OUTPUT_SCHEMA; } });
42
+ var client_1 = require("./client.cjs");
43
+ Object.defineProperty(exports, "SimpleAI", { enumerable: true, get: function () { return client_1.SimpleAI; } });
44
+ var define_action_1 = require("./code-action/define-action.cjs");
45
+ Object.defineProperty(exports, "defineAction", { enumerable: true, get: function () { return define_action_1.defineAction; } });
46
+ Object.defineProperty(exports, "defineCustomDataTransform", { enumerable: true, get: function () { return define_action_1.defineCustomDataTransform; } });
47
+ Object.defineProperty(exports, "SIMPLE_ACTION_BRAND", { enumerable: true, get: function () { return define_action_1.SIMPLE_ACTION_BRAND; } });
48
+ var types_1 = require("./code-action/types.cjs");
49
+ Object.defineProperty(exports, "ActionCapability", { enumerable: true, get: function () { return types_1.ActionCapability; } });
50
+ var data_1 = require("./data.cjs");
51
+ Object.defineProperty(exports, "DataClient", { enumerable: true, get: function () { return data_1.DataClient; } });
52
+ var projects_1 = require("./projects.cjs");
53
+ Object.defineProperty(exports, "collectActionVersionUuids", { enumerable: true, get: function () { return projects_1.collectActionVersionUuids; } });
54
+ Object.defineProperty(exports, "compileAgentProject", { enumerable: true, get: function () { return projects_1.compileAgentProject; } });
55
+ Object.defineProperty(exports, "defineAgentSnapshot", { enumerable: true, get: function () { return projects_1.defineAgentSnapshot; } });
56
+ Object.defineProperty(exports, "normalizeAgentV2CommitContent", { enumerable: true, get: function () { return projects_1.normalizeAgentV2CommitContent; } });
57
+ var schemas_1 = require("./schemas.cjs");
58
+ Object.defineProperty(exports, "batchUpsertRowsSchema", { enumerable: true, get: function () { return schemas_1.batchUpsertRowsSchema; } });
59
+ Object.defineProperty(exports, "dataColumnPathSchema", { enumerable: true, get: function () { return schemas_1.dataColumnPathSchema; } });
60
+ Object.defineProperty(exports, "dataFilterSchema", { enumerable: true, get: function () { return schemas_1.dataFilterSchema; } });
61
+ Object.defineProperty(exports, "listOptionsSchema", { enumerable: true, get: function () { return schemas_1.listOptionsSchema; } });
62
+ Object.defineProperty(exports, "MAX_BATCH_ROWS", { enumerable: true, get: function () { return schemas_1.MAX_BATCH_ROWS; } });
63
+ Object.defineProperty(exports, "MAX_QUERY_SIZE", { enumerable: true, get: function () { return schemas_1.MAX_QUERY_SIZE; } });
64
+ Object.defineProperty(exports, "queryInputSchema", { enumerable: true, get: function () { return schemas_1.queryInputSchema; } });
65
+ Object.defineProperty(exports, "recordPayloadSchema", { enumerable: true, get: function () { return schemas_1.recordPayloadSchema; } });
66
+ Object.defineProperty(exports, "tableNameSchema", { enumerable: true, get: function () { return schemas_1.tableNameSchema; } });
67
+ var errors_1 = require("./shared/errors.cjs");
68
+ Object.defineProperty(exports, "MissingCapabilityError", { enumerable: true, get: function () { return errors_1.MissingCapabilityError; } });
69
+ Object.defineProperty(exports, "SimpleAIError", { enumerable: true, get: function () { return errors_1.SimpleAIError; } });