@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.
- package/README.md +79 -1
- package/dist/actions.cjs +452 -0
- package/dist/actions.d.cts +348 -0
- package/dist/actions.d.ts +348 -0
- package/dist/actions.js +443 -0
- package/dist/agents.cjs +1176 -0
- package/dist/agents.d.cts +1138 -0
- package/dist/agents.d.ts +1138 -0
- package/dist/agents.js +1166 -0
- package/dist/built-in-actions.cjs +456 -0
- package/dist/built-in-actions.d.cts +53 -0
- package/dist/built-in-actions.d.ts +53 -0
- package/dist/built-in-actions.js +453 -0
- package/dist/client.cjs +29 -0
- package/dist/client.d.cts +15 -0
- package/dist/client.d.ts +15 -0
- package/dist/client.js +25 -0
- package/dist/code-action/defaults.cjs +11 -0
- package/dist/code-action/defaults.d.cts +7 -0
- package/dist/code-action/defaults.d.ts +7 -0
- package/dist/code-action/defaults.js +8 -0
- package/dist/code-action/define-action.cjs +78 -0
- package/dist/code-action/define-action.d.cts +99 -0
- package/dist/code-action/define-action.d.ts +99 -0
- package/dist/code-action/define-action.js +73 -0
- package/dist/code-action/index.cjs +11 -0
- package/dist/code-action/index.d.cts +4 -0
- package/dist/code-action/index.d.ts +4 -0
- package/dist/code-action/index.js +3 -0
- package/dist/code-action/llm.cjs +34 -0
- package/dist/code-action/llm.d.cts +28 -0
- package/dist/code-action/llm.d.ts +28 -0
- package/dist/code-action/llm.js +31 -0
- package/dist/code-action/types.cjs +14 -0
- package/dist/code-action/types.d.cts +19 -0
- package/dist/code-action/types.d.ts +19 -0
- package/dist/code-action/types.js +11 -0
- package/dist/code-action/workflow.cjs +29 -0
- package/dist/code-action/workflow.d.cts +53 -0
- package/dist/code-action/workflow.d.ts +53 -0
- package/dist/code-action/workflow.js +26 -0
- package/dist/data.cjs +98 -0
- package/dist/data.d.cts +44 -0
- package/dist/data.d.ts +44 -0
- package/dist/data.js +94 -0
- package/dist/http.cjs +72 -0
- package/dist/http.d.cts +14 -0
- package/dist/http.d.ts +14 -0
- package/dist/http.js +69 -0
- package/dist/index.cjs +71 -1597
- package/dist/index.d.cts +12 -780
- package/dist/index.d.ts +12 -780
- package/dist/index.js +10 -1311
- package/dist/projects.cjs +234 -0
- package/dist/projects.d.cts +24 -0
- package/dist/projects.d.ts +24 -0
- package/dist/projects.js +228 -0
- package/dist/schemas.cjs +50 -0
- package/dist/schemas.d.cts +81 -0
- package/dist/schemas.d.ts +81 -0
- package/dist/schemas.js +47 -0
- package/dist/shared/errors.cjs +31 -0
- package/dist/shared/errors.d.cts +22 -0
- package/dist/shared/errors.d.ts +22 -0
- package/dist/shared/errors.js +26 -0
- package/package.json +27 -31
- package/dist/chunk-V4E5PSKB.js +0 -267
- package/dist/chunk-V4E5PSKB.js.map +0 -1
- package/dist/code-action-CDt77m7I.d.cts +0 -191
- package/dist/code-action-CDt77m7I.d.ts +0 -191
- package/dist/code-action.cjs +0 -282
- package/dist/code-action.cjs.map +0 -1
- package/dist/code-action.d.cts +0 -2
- package/dist/code-action.d.ts +0 -2
- package/dist/code-action.js +0 -9
- package/dist/code-action.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,1598 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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: "cloudflare-worker",
|
|
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
|
-
var SIMPLE_ACTION_RUNTIME = /* @__PURE__ */ Symbol.for("simple-ai.action-runtime");
|
|
1429
|
-
function defineAction(handler) {
|
|
1430
|
-
const wrapped = async (invocation) => {
|
|
1431
|
-
const { inputs, config } = invocation;
|
|
1432
|
-
const runtime = invocation[SIMPLE_ACTION_RUNTIME];
|
|
1433
|
-
const client = runtime === void 0 ? new SimpleAI() : new SimpleAI(runtime);
|
|
1434
|
-
return handler({ inputs, config, client });
|
|
1435
|
-
};
|
|
1436
|
-
const brand = { [SIMPLE_ACTION_BRAND]: true };
|
|
1437
|
-
return Object.assign(wrapped, brand);
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
// src/projects.ts
|
|
1441
|
-
function defineAgentSnapshot(definition) {
|
|
1442
|
-
return { kind: "agent-snapshot", ...definition };
|
|
1443
|
-
}
|
|
1444
|
-
function replaceActionVersionUuid({
|
|
1445
|
-
versionUuid,
|
|
1446
|
-
actions,
|
|
1447
|
-
options
|
|
1448
|
-
}) {
|
|
1449
|
-
const actionDefinition = actions.find((item) => item.sourceVersionUuid === versionUuid);
|
|
1450
|
-
if (actionDefinition === void 0) {
|
|
1451
|
-
return versionUuid;
|
|
1452
|
-
}
|
|
1453
|
-
return options.actionVersionUuids?.[actionDefinition.key] ?? versionUuid;
|
|
1454
|
-
}
|
|
1455
|
-
function compileSnapshotNode({
|
|
1456
|
-
node: node2,
|
|
1457
|
-
actions,
|
|
1458
|
-
options
|
|
1459
|
-
}) {
|
|
1460
|
-
if (node2.type === "action_node") {
|
|
1461
|
-
return {
|
|
1462
|
-
...node2,
|
|
1463
|
-
actionVersionUuid: replaceActionVersionUuid({
|
|
1464
|
-
versionUuid: node2.actionVersionUuid,
|
|
1465
|
-
actions,
|
|
1466
|
-
options
|
|
1467
|
-
})
|
|
1468
|
-
};
|
|
1469
|
-
}
|
|
1470
|
-
if (node2.type === "standard" && node2.perTurnAction != null) {
|
|
1471
|
-
return {
|
|
1472
|
-
...node2,
|
|
1473
|
-
perTurnAction: {
|
|
1474
|
-
...node2.perTurnAction,
|
|
1475
|
-
actionVersionUuid: replaceActionVersionUuid({
|
|
1476
|
-
versionUuid: node2.perTurnAction.actionVersionUuid,
|
|
1477
|
-
actions,
|
|
1478
|
-
options
|
|
1479
|
-
})
|
|
1480
|
-
}
|
|
1481
|
-
};
|
|
1482
|
-
}
|
|
1483
|
-
return node2;
|
|
1484
|
-
}
|
|
1485
|
-
function compileSnapshot(definition, options) {
|
|
1486
|
-
const snapshotActionValues = (values) => {
|
|
1487
|
-
switch (values.actionType) {
|
|
1488
|
-
case "code":
|
|
1489
|
-
return {
|
|
1490
|
-
...values,
|
|
1491
|
-
operation: {
|
|
1492
|
-
...values.operation,
|
|
1493
|
-
compiledJs: null
|
|
1494
|
-
}
|
|
1495
|
-
};
|
|
1496
|
-
case "http":
|
|
1497
|
-
case "custom_data":
|
|
1498
|
-
case "knowledge_base":
|
|
1499
|
-
return values;
|
|
1500
|
-
}
|
|
1501
|
-
};
|
|
1502
|
-
return {
|
|
1503
|
-
agent: definition.agent,
|
|
1504
|
-
branch: definition.branch,
|
|
1505
|
-
actions: definition.actions.map((item) => ({
|
|
1506
|
-
key: item.key,
|
|
1507
|
-
versionUuid: replaceActionVersionUuid({
|
|
1508
|
-
versionUuid: item.sourceVersionUuid,
|
|
1509
|
-
actions: definition.actions,
|
|
1510
|
-
options
|
|
1511
|
-
}),
|
|
1512
|
-
values: snapshotActionValues(item.values)
|
|
1513
|
-
})),
|
|
1514
|
-
content: {
|
|
1515
|
-
...definition.content,
|
|
1516
|
-
config: {
|
|
1517
|
-
...definition.content.config,
|
|
1518
|
-
...definition.content.config.toolUseSites === void 0 ? {} : {
|
|
1519
|
-
toolUseSites: definition.content.config.toolUseSites.map((useSite) => ({
|
|
1520
|
-
...useSite,
|
|
1521
|
-
actionVersionUuid: replaceActionVersionUuid({
|
|
1522
|
-
versionUuid: useSite.actionVersionUuid,
|
|
1523
|
-
actions: definition.actions,
|
|
1524
|
-
options
|
|
1525
|
-
})
|
|
1526
|
-
}))
|
|
1527
|
-
},
|
|
1528
|
-
automaticActions: {
|
|
1529
|
-
beforeCallStart: definition.content.config.automaticActions.beforeCallStart === null ? null : {
|
|
1530
|
-
...definition.content.config.automaticActions.beforeCallStart,
|
|
1531
|
-
actionVersionUuid: replaceActionVersionUuid({
|
|
1532
|
-
versionUuid: definition.content.config.automaticActions.beforeCallStart.actionVersionUuid,
|
|
1533
|
-
actions: definition.actions,
|
|
1534
|
-
options
|
|
1535
|
-
})
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
},
|
|
1539
|
-
nodes: definition.content.nodes.map(
|
|
1540
|
-
(node2) => compileSnapshotNode({ node: node2, actions: definition.actions, options })
|
|
1541
|
-
)
|
|
1542
|
-
}
|
|
1543
|
-
};
|
|
1544
|
-
}
|
|
1545
|
-
function compileAgentProject(definition, options = {}) {
|
|
1546
|
-
return definition.kind === "agent-definition" ? compileAgent(definition, options) : compileSnapshot(definition, options);
|
|
1547
|
-
}
|
|
1548
|
-
function collectActionVersionUuids(content) {
|
|
1549
|
-
const versionUuids = /* @__PURE__ */ new Set();
|
|
1550
|
-
for (const useSite of content.config.toolUseSites ?? []) {
|
|
1551
|
-
versionUuids.add(useSite.actionVersionUuid);
|
|
1552
|
-
}
|
|
1553
|
-
const beforeCallAction = content.config.automaticActions.beforeCallStart;
|
|
1554
|
-
if (beforeCallAction !== null) {
|
|
1555
|
-
versionUuids.add(beforeCallAction.actionVersionUuid);
|
|
1556
|
-
}
|
|
1557
|
-
for (const node2 of content.nodes) {
|
|
1558
|
-
if (node2.type === "action_node") {
|
|
1559
|
-
versionUuids.add(node2.actionVersionUuid);
|
|
1560
|
-
}
|
|
1561
|
-
if (node2.type === "standard" && node2.perTurnAction != null) {
|
|
1562
|
-
versionUuids.add(node2.perTurnAction.actionVersionUuid);
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1565
|
-
return [...versionUuids];
|
|
1566
|
-
}
|
|
1567
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1568
|
-
0 && (module.exports = {
|
|
1569
|
-
DataClient,
|
|
1570
|
-
MAX_BATCH_ROWS,
|
|
1571
|
-
MAX_QUERY_SIZE,
|
|
1572
|
-
SIMPLE_ACTION_BRAND,
|
|
1573
|
-
SimpleAI,
|
|
1574
|
-
SimpleAIError,
|
|
1575
|
-
action,
|
|
1576
|
-
actionsIoSchemaFromZod,
|
|
1577
|
-
batchUpsertRowsSchema,
|
|
1578
|
-
canonicalAuthoringKey,
|
|
1579
|
-
canonicalAuthoringKeys,
|
|
1580
|
-
collectActionVersionUuids,
|
|
1581
|
-
compileAction,
|
|
1582
|
-
compileAgent,
|
|
1583
|
-
compileAgentProject,
|
|
1584
|
-
dataColumnPathSchema,
|
|
1585
|
-
dataFilterSchema,
|
|
1586
|
-
defineAction,
|
|
1587
|
-
defineAgent,
|
|
1588
|
-
defineAgentSnapshot,
|
|
1589
|
-
listOptionsSchema,
|
|
1590
|
-
node,
|
|
1591
|
-
prompt,
|
|
1592
|
-
queryInputSchema,
|
|
1593
|
-
recordPayloadSchema,
|
|
1594
|
-
reference,
|
|
1595
|
-
sourceFile,
|
|
1596
|
-
tableNameSchema
|
|
1597
|
-
});
|
|
1598
|
-
//# sourceMappingURL=index.cjs.map
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
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.WEB_SEARCH_OUTPUT_SCHEMA = exports.WEB_SEARCH_OUTPUT_MAPPINGS = exports.WEB_SEARCH_INPUT_SCHEMA = 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.resolveActionIoSchema = exports.resolveActionHttpHeaders = exports.compileAction = exports.canonicalActionSource = exports.actionsIoSchemaFromZod = exports.action = void 0;
|
|
4
|
+
exports.SimpleAIError = exports.MissingCapabilityError = exports.tableNameSchema = exports.recordPayloadSchema = exports.queryInputSchema = exports.MAX_QUERY_SIZE = exports.MAX_BATCH_ROWS = exports.listOptionsSchema = void 0;
|
|
5
|
+
var actions_1 = require("./actions.cjs");
|
|
6
|
+
Object.defineProperty(exports, "action", { enumerable: true, get: function () { return actions_1.action; } });
|
|
7
|
+
Object.defineProperty(exports, "actionsIoSchemaFromZod", { enumerable: true, get: function () { return actions_1.actionsIoSchemaFromZod; } });
|
|
8
|
+
Object.defineProperty(exports, "canonicalActionSource", { enumerable: true, get: function () { return actions_1.canonicalActionSource; } });
|
|
9
|
+
Object.defineProperty(exports, "compileAction", { enumerable: true, get: function () { return actions_1.compileAction; } });
|
|
10
|
+
Object.defineProperty(exports, "resolveActionHttpHeaders", { enumerable: true, get: function () { return actions_1.resolveActionHttpHeaders; } });
|
|
11
|
+
Object.defineProperty(exports, "resolveActionIoSchema", { enumerable: true, get: function () { return actions_1.resolveActionIoSchema; } });
|
|
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
|
+
Object.defineProperty(exports, "WEB_SEARCH_INPUT_SCHEMA", { enumerable: true, get: function () { return built_in_actions_1.WEB_SEARCH_INPUT_SCHEMA; } });
|
|
43
|
+
Object.defineProperty(exports, "WEB_SEARCH_OUTPUT_MAPPINGS", { enumerable: true, get: function () { return built_in_actions_1.WEB_SEARCH_OUTPUT_MAPPINGS; } });
|
|
44
|
+
Object.defineProperty(exports, "WEB_SEARCH_OUTPUT_SCHEMA", { enumerable: true, get: function () { return built_in_actions_1.WEB_SEARCH_OUTPUT_SCHEMA; } });
|
|
45
|
+
var client_1 = require("./client.cjs");
|
|
46
|
+
Object.defineProperty(exports, "SimpleAI", { enumerable: true, get: function () { return client_1.SimpleAI; } });
|
|
47
|
+
var define_action_1 = require("./code-action/define-action.cjs");
|
|
48
|
+
Object.defineProperty(exports, "defineAction", { enumerable: true, get: function () { return define_action_1.defineAction; } });
|
|
49
|
+
Object.defineProperty(exports, "defineCustomDataTransform", { enumerable: true, get: function () { return define_action_1.defineCustomDataTransform; } });
|
|
50
|
+
Object.defineProperty(exports, "SIMPLE_ACTION_BRAND", { enumerable: true, get: function () { return define_action_1.SIMPLE_ACTION_BRAND; } });
|
|
51
|
+
var types_1 = require("./code-action/types.cjs");
|
|
52
|
+
Object.defineProperty(exports, "ActionCapability", { enumerable: true, get: function () { return types_1.ActionCapability; } });
|
|
53
|
+
var data_1 = require("./data.cjs");
|
|
54
|
+
Object.defineProperty(exports, "DataClient", { enumerable: true, get: function () { return data_1.DataClient; } });
|
|
55
|
+
var projects_1 = require("./projects.cjs");
|
|
56
|
+
Object.defineProperty(exports, "collectActionVersionUuids", { enumerable: true, get: function () { return projects_1.collectActionVersionUuids; } });
|
|
57
|
+
Object.defineProperty(exports, "compileAgentProject", { enumerable: true, get: function () { return projects_1.compileAgentProject; } });
|
|
58
|
+
Object.defineProperty(exports, "defineAgentSnapshot", { enumerable: true, get: function () { return projects_1.defineAgentSnapshot; } });
|
|
59
|
+
Object.defineProperty(exports, "normalizeAgentV2CommitContent", { enumerable: true, get: function () { return projects_1.normalizeAgentV2CommitContent; } });
|
|
60
|
+
var schemas_1 = require("./schemas.cjs");
|
|
61
|
+
Object.defineProperty(exports, "batchUpsertRowsSchema", { enumerable: true, get: function () { return schemas_1.batchUpsertRowsSchema; } });
|
|
62
|
+
Object.defineProperty(exports, "dataColumnPathSchema", { enumerable: true, get: function () { return schemas_1.dataColumnPathSchema; } });
|
|
63
|
+
Object.defineProperty(exports, "dataFilterSchema", { enumerable: true, get: function () { return schemas_1.dataFilterSchema; } });
|
|
64
|
+
Object.defineProperty(exports, "listOptionsSchema", { enumerable: true, get: function () { return schemas_1.listOptionsSchema; } });
|
|
65
|
+
Object.defineProperty(exports, "MAX_BATCH_ROWS", { enumerable: true, get: function () { return schemas_1.MAX_BATCH_ROWS; } });
|
|
66
|
+
Object.defineProperty(exports, "MAX_QUERY_SIZE", { enumerable: true, get: function () { return schemas_1.MAX_QUERY_SIZE; } });
|
|
67
|
+
Object.defineProperty(exports, "queryInputSchema", { enumerable: true, get: function () { return schemas_1.queryInputSchema; } });
|
|
68
|
+
Object.defineProperty(exports, "recordPayloadSchema", { enumerable: true, get: function () { return schemas_1.recordPayloadSchema; } });
|
|
69
|
+
Object.defineProperty(exports, "tableNameSchema", { enumerable: true, get: function () { return schemas_1.tableNameSchema; } });
|
|
70
|
+
var errors_1 = require("./shared/errors.cjs");
|
|
71
|
+
Object.defineProperty(exports, "MissingCapabilityError", { enumerable: true, get: function () { return errors_1.MissingCapabilityError; } });
|
|
72
|
+
Object.defineProperty(exports, "SimpleAIError", { enumerable: true, get: function () { return errors_1.SimpleAIError; } });
|