@superpanel-sdk/runtime 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/codegen/generate.js +15 -9
- package/dist/builder/company-import-graph.d.ts +11 -0
- package/dist/builder/company-import-graph.js +105 -0
- package/dist/builder/compile/compile-agenda.js +9 -4
- package/dist/builder/compile/compile-sequence.d.ts +4 -1
- package/dist/builder/compile/compile-sequence.js +28 -9
- package/dist/builder/load.js +3 -3
- package/dist/builder/types.d.ts +5 -0
- package/dist/cli/serve/index.js +107 -47
- package/dist/compute-host/index.d.ts +2 -0
- package/dist/compute-host/index.js +1 -0
- package/dist/compute-host/read-only-cache.d.ts +20 -0
- package/dist/compute-host/read-only-cache.js +61 -0
- package/dist/compute-host/source-compute-host.d.ts +4 -0
- package/dist/compute-host/source-compute-host.js +12 -2
- package/dist/core/context/types.d.ts +19 -1
- package/dist/core/functions/define/custom.d.ts +1 -1
- package/dist/core/functions/types.d.ts +4 -4
- package/dist/core/slot/index.d.ts +1 -1
- package/dist/core/slot/index.js +1 -1
- package/dist/core/slot/types.d.ts +2 -0
- package/dist/core/slot/write.d.ts +8 -1
- package/dist/core/slot/write.js +145 -38
- package/dist/core/stage/builders.d.ts +23 -5
- package/dist/core/stage/builders.js +3 -0
- package/dist/core/stage/drive.d.ts +1 -1
- package/dist/core/stage/drive.js +9 -8
- package/dist/core/stage/flatten.js +13 -11
- package/dist/core/stage/index.d.ts +8 -4
- package/dist/core/stage/index.js +5 -2
- package/dist/core/stage/interrupts.d.ts +28 -0
- package/dist/core/stage/interrupts.js +120 -0
- package/dist/core/stage/ivr-fields.d.ts +9 -0
- package/dist/core/stage/ivr-fields.js +75 -0
- package/dist/core/stage/transfer-fields.d.ts +6 -1
- package/dist/core/stage/transfer-fields.js +44 -3
- package/dist/core/stage/transfer-spec.d.ts +48 -0
- package/dist/core/stage/transfer-spec.js +113 -0
- package/dist/core/stage/types.d.ts +45 -14
- package/dist/core/stage/validate.js +105 -1
- package/dist/core/stage/walk.d.ts +5 -0
- package/dist/core/stage/walk.js +33 -10
- package/dist/fn-context/index.d.ts +1 -1
- package/dist/fn-context/index.js +1 -1
- package/dist/fn-context/rpc/index.d.ts +1 -1
- package/dist/fn-context/rpc/index.js +1 -1
- package/dist/fn-context/rpc/request-id.d.ts +5 -0
- package/dist/fn-context/rpc/request-id.js +11 -0
- package/dist/fn-context/rpc/trpc-client.d.ts +2 -0
- package/dist/fn-context/rpc/trpc-client.js +5 -1
- package/dist/fn-context/rpc/trpc-init.d.ts +1 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -4
- package/dist/voice-service/types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -2,7 +2,9 @@ import { getCompiledTable } from '../slot/compile-schema.js';
|
|
|
2
2
|
import { parseFieldPath } from '../slot/path.js';
|
|
3
3
|
import { extractTemplateFields } from './condition.js';
|
|
4
4
|
import { whenFields } from './finish-when.js';
|
|
5
|
+
import { headerHasTransferInterrupt, validateInterrupts } from './interrupts.js';
|
|
5
6
|
import { LAST_TRANSFER_RESULT_FIELD } from './transfer-fields.js';
|
|
7
|
+
import { validateTransferDestinations } from './transfer-spec.js';
|
|
6
8
|
function fieldExists(schema, path) {
|
|
7
9
|
const parsed = parseFieldPath(path);
|
|
8
10
|
if (!parsed)
|
|
@@ -28,6 +30,10 @@ function earlierCollected(items, index) {
|
|
|
28
30
|
for (const field of item.fields)
|
|
29
31
|
collected.add(field);
|
|
30
32
|
}
|
|
33
|
+
if (item.kind === 'ivr') {
|
|
34
|
+
for (const field of whenFields(item.finishWhen))
|
|
35
|
+
collected.add(field);
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
return collected;
|
|
33
39
|
}
|
|
@@ -74,6 +80,13 @@ export function validateCompiledAgenda(compiled, options) {
|
|
|
74
80
|
const seenPlacement = new Set();
|
|
75
81
|
const transferByResult = transferIndexByResultField(items);
|
|
76
82
|
const firstTransfer = firstTransferIndex(items);
|
|
83
|
+
const transferInterrupt = headerHasTransferInterrupt(compiled.header);
|
|
84
|
+
if (compiled.header) {
|
|
85
|
+
issues.push(...validateInterrupts(compiled.header.interrupts, {
|
|
86
|
+
schema,
|
|
87
|
+
agendaId: prefix,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
77
90
|
if (compiled.header?.channel && compiled.header.channel !== 'call') {
|
|
78
91
|
for (const item of items) {
|
|
79
92
|
if (item.kind === 'transfer') {
|
|
@@ -83,6 +96,13 @@ export function validateCompiledAgenda(compiled, options) {
|
|
|
83
96
|
path: `${prefix}/${item.placementId}`,
|
|
84
97
|
});
|
|
85
98
|
}
|
|
99
|
+
if (item.kind === 'ivr') {
|
|
100
|
+
issues.push({
|
|
101
|
+
code: 'ivr-channel',
|
|
102
|
+
message: `IVR ${item.id} is only valid on call agendas`,
|
|
103
|
+
path: `${prefix}/${item.placementId}`,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
86
106
|
}
|
|
87
107
|
}
|
|
88
108
|
if (compiled.header?.firstMessage?.kind === 'template') {
|
|
@@ -128,7 +148,7 @@ export function validateCompiledAgenda(compiled, options) {
|
|
|
128
148
|
continue;
|
|
129
149
|
}
|
|
130
150
|
if (field === LAST_TRANSFER_RESULT_FIELD) {
|
|
131
|
-
if (firstTransfer < 0 || firstTransfer >= index) {
|
|
151
|
+
if (!transferInterrupt && (firstTransfer < 0 || firstTransfer >= index)) {
|
|
132
152
|
issues.push({
|
|
133
153
|
code: 'transfer-result-before-node',
|
|
134
154
|
message: `applyWhen reads ${LAST_TRANSFER_RESULT_FIELD} before any transfer`,
|
|
@@ -152,6 +172,56 @@ export function validateCompiledAgenda(compiled, options) {
|
|
|
152
172
|
}
|
|
153
173
|
}
|
|
154
174
|
requireBoolWhen(item.applyWhen, functions, issues, `${path}/applyWhen`, 'applyWhen');
|
|
175
|
+
if (item.kind === 'ivr') {
|
|
176
|
+
requireBoolWhen(item.finishWhen, functions, issues, `${path}/finishWhen`, 'finishWhen');
|
|
177
|
+
if (item.finishWhen.kind === 'rules') {
|
|
178
|
+
requireFields(schema, whenFields(item.finishWhen), issues, `${path}/finishWhen`);
|
|
179
|
+
}
|
|
180
|
+
const run = functions?.[item.onDtmfResult];
|
|
181
|
+
if (functions && !run) {
|
|
182
|
+
issues.push({
|
|
183
|
+
code: 'unknown-function',
|
|
184
|
+
message: `IVR '${item.id}' onDtmfResult unknown function '${item.onDtmfResult}'. Custom functions: ${listedCustomFunctions(functions)}`,
|
|
185
|
+
path: `${path}/onDtmfResult`,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
else if (run && run.kind !== 'custom') {
|
|
189
|
+
issues.push({
|
|
190
|
+
code: 'ivr-run-not-custom',
|
|
191
|
+
message: `IVR '${item.id}' onDtmfResult '${item.onDtmfResult}' must be defineCustomFunc`,
|
|
192
|
+
path: `${path}/onDtmfResult`,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (!item.loopSay.trim()) {
|
|
196
|
+
issues.push({
|
|
197
|
+
code: 'ivr-say-empty',
|
|
198
|
+
message: 'ivr loopSay must not be empty',
|
|
199
|
+
path: `${path}/loopSay`,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (!(item.confirmTimeoutMs > 0) || !(item.pauseAfterSayMs >= 0)) {
|
|
203
|
+
issues.push({
|
|
204
|
+
code: 'ivr-timing',
|
|
205
|
+
message: 'ivr confirmTimeoutMs must be > 0 and pauseAfterSayMs must be >= 0',
|
|
206
|
+
path: `${path}/timing`,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if (item.fallbackAction !== 'end-call' && item.fallbackAction !== 'restore-normal-call-state') {
|
|
210
|
+
issues.push({
|
|
211
|
+
code: 'ivr-fallback',
|
|
212
|
+
message: 'ivr fallbackAction must be end-call or restore-normal-call-state',
|
|
213
|
+
path: `${path}/fallbackAction`,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
const digits = (item.validateDigits ?? []).map((digit) => digit.trim()).filter(Boolean);
|
|
217
|
+
if (!item.finishOnKey && digits.length === 0) {
|
|
218
|
+
issues.push({
|
|
219
|
+
code: 'ivr-digits-empty',
|
|
220
|
+
message: 'ivr needs validateDigits when finishOnKey is not set',
|
|
221
|
+
path: `${path}/validateDigits`,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
155
225
|
if (item.kind === 'topic') {
|
|
156
226
|
requireFields(schema, item.fields, issues, `${path}/fields`);
|
|
157
227
|
const referenced = whenFields(item.finishWhen);
|
|
@@ -194,6 +264,26 @@ export function validateCompiledAgenda(compiled, options) {
|
|
|
194
264
|
for (const number of item.numbers) {
|
|
195
265
|
requireFields(schema, extractTemplateFields(number), issues, `${path}/numbers`);
|
|
196
266
|
}
|
|
267
|
+
if (item.arguments) {
|
|
268
|
+
for (const key of ['sendDigits', 'sipUrl', 'sipUsername', 'sipPassword']) {
|
|
269
|
+
const text = item.arguments[key];
|
|
270
|
+
if (text) {
|
|
271
|
+
requireFields(schema, extractTemplateFields(text), issues, `${path}/arguments/${key}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (typeof item.say === 'string') {
|
|
276
|
+
requireFields(schema, extractTemplateFields(item.say), issues, `${path}/say`);
|
|
277
|
+
}
|
|
278
|
+
else if (item.say) {
|
|
279
|
+
for (const text of Object.values(item.say)) {
|
|
280
|
+
requireFields(schema, extractTemplateFields(text), issues, `${path}/say`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
issues.push(...validateTransferDestinations(item.numbers, {
|
|
284
|
+
path: `${path}/numbers`,
|
|
285
|
+
code: 'transfer-target',
|
|
286
|
+
}));
|
|
197
287
|
requireFields(schema, [item.resultField, LAST_TRANSFER_RESULT_FIELD], issues, `${path}/result`);
|
|
198
288
|
}
|
|
199
289
|
}
|
|
@@ -215,10 +305,24 @@ const FATAL_AGENDA_CODES = new Set([
|
|
|
215
305
|
'branch-no-explicit',
|
|
216
306
|
'otherwise-unexpanded',
|
|
217
307
|
'transfer-channel',
|
|
308
|
+
'ivr-channel',
|
|
309
|
+
'ivr-run-not-custom',
|
|
310
|
+
'ivr-fallback',
|
|
311
|
+
'ivr-timing',
|
|
312
|
+
'ivr-say-empty',
|
|
313
|
+
'ivr-digits-empty',
|
|
218
314
|
'transfer-result-before-node',
|
|
219
315
|
'action-run-not-custom',
|
|
220
316
|
'duplicate-placement',
|
|
221
317
|
'block-kind-mismatch',
|
|
318
|
+
'interrupt-tool-reserved',
|
|
319
|
+
'interrupt-tool-duplicate',
|
|
320
|
+
'interrupt-priority-tie',
|
|
321
|
+
'interrupt-languages-empty',
|
|
322
|
+
'interrupt-language-field',
|
|
323
|
+
'interrupt-transfer-number',
|
|
324
|
+
'interrupt-escalation-criteria',
|
|
325
|
+
'transfer-target',
|
|
222
326
|
]);
|
|
223
327
|
export function fatalAgendaIssues(issues) {
|
|
224
328
|
return issues.filter((issue) => FATAL_AGENDA_CODES.has(issue.code));
|
|
@@ -9,11 +9,16 @@ export type WalkSkip = {
|
|
|
9
9
|
reason: WalkSkipReason;
|
|
10
10
|
};
|
|
11
11
|
export type WalkHitReason = 'sticky' | 'scan';
|
|
12
|
+
export type WalkStats = {
|
|
13
|
+
durationMs: number;
|
|
14
|
+
evals: number;
|
|
15
|
+
};
|
|
12
16
|
export type WalkResult = {
|
|
13
17
|
hit: FlatAgendaItem | null;
|
|
14
18
|
reason: WalkHitReason | 'complete';
|
|
15
19
|
skipped: WalkSkip[];
|
|
16
20
|
decisions: WalkDecision[];
|
|
21
|
+
stats: WalkStats;
|
|
17
22
|
};
|
|
18
23
|
export type WalkDecision = {
|
|
19
24
|
placementId: string;
|
package/dist/core/stage/walk.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { evaluateWhen } from './finish-when.js';
|
|
2
|
+
import { ivrAttempted } from './ivr-fields.js';
|
|
2
3
|
function startsWithGroup(groupPath, prefix) {
|
|
3
4
|
if (prefix.length === 0)
|
|
4
5
|
return true;
|
|
@@ -6,7 +7,7 @@ function startsWithGroup(groupPath, prefix) {
|
|
|
6
7
|
return false;
|
|
7
8
|
return prefix.every((id, i) => groupPath[i] === id);
|
|
8
9
|
}
|
|
9
|
-
async function consider(item, snapshot, compute, skip, via, skipped, decisions) {
|
|
10
|
+
async function consider(item, snapshot, compute, skip, via, skipped, decisions, stats) {
|
|
10
11
|
if (skip.has(item.placementId)) {
|
|
11
12
|
skipped.push({ placementId: item.placementId, blockId: item.id, reason: 'skipped' });
|
|
12
13
|
decisions.push({
|
|
@@ -19,6 +20,7 @@ async function consider(item, snapshot, compute, skip, via, skipped, decisions)
|
|
|
19
20
|
});
|
|
20
21
|
return 'skip';
|
|
21
22
|
}
|
|
23
|
+
stats.evals += 1;
|
|
22
24
|
const applies = await evaluateWhen(item.applyWhen, snapshot, compute);
|
|
23
25
|
if (!applies.pass) {
|
|
24
26
|
skipped.push({ placementId: item.placementId, blockId: item.id, reason: 'folded' });
|
|
@@ -32,6 +34,19 @@ async function consider(item, snapshot, compute, skip, via, skipped, decisions)
|
|
|
32
34
|
});
|
|
33
35
|
return 'fold';
|
|
34
36
|
}
|
|
37
|
+
if (item.kind === 'ivr' && ivrAttempted(item, snapshot)) {
|
|
38
|
+
skipped.push({ placementId: item.placementId, blockId: item.id, reason: 'done' });
|
|
39
|
+
decisions.push({
|
|
40
|
+
placementId: item.placementId,
|
|
41
|
+
blockId: item.id,
|
|
42
|
+
status: 'done',
|
|
43
|
+
via,
|
|
44
|
+
applyWhen: true,
|
|
45
|
+
finishWhen: true,
|
|
46
|
+
});
|
|
47
|
+
return 'done';
|
|
48
|
+
}
|
|
49
|
+
stats.evals += 1;
|
|
35
50
|
const finished = await evaluateWhen(item.finishWhen, snapshot, compute);
|
|
36
51
|
if (finished.done) {
|
|
37
52
|
skipped.push({ placementId: item.placementId, blockId: item.id, reason: 'done' });
|
|
@@ -55,40 +70,48 @@ async function consider(item, snapshot, compute, skip, via, skipped, decisions)
|
|
|
55
70
|
});
|
|
56
71
|
return 'hit';
|
|
57
72
|
}
|
|
58
|
-
async function firstHit(items, snapshot, compute, skip, via, skipped, decisions, considered) {
|
|
73
|
+
async function firstHit(items, snapshot, compute, skip, via, skipped, decisions, considered, stats) {
|
|
59
74
|
for (const item of items) {
|
|
60
75
|
if (considered.has(item.placementId))
|
|
61
76
|
continue;
|
|
62
77
|
considered.add(item.placementId);
|
|
63
|
-
if ((await consider(item, snapshot, compute, skip, via, skipped, decisions)) === 'hit') {
|
|
78
|
+
if ((await consider(item, snapshot, compute, skip, via, skipped, decisions, stats)) === 'hit') {
|
|
64
79
|
return item;
|
|
65
80
|
}
|
|
66
81
|
}
|
|
67
82
|
return null;
|
|
68
83
|
}
|
|
69
84
|
export async function walkAgenda(items, snapshot, options = {}) {
|
|
85
|
+
const started = Date.now();
|
|
70
86
|
const skip = options.skipPlacementIds ?? new Set();
|
|
71
87
|
const skipped = [];
|
|
72
88
|
const decisions = [];
|
|
73
89
|
const considered = new Set();
|
|
90
|
+
const stats = { evals: 0 };
|
|
74
91
|
const currentId = options.currentPlacementId ?? null;
|
|
92
|
+
const finish = (hit, reason) => ({
|
|
93
|
+
hit,
|
|
94
|
+
reason,
|
|
95
|
+
skipped,
|
|
96
|
+
decisions,
|
|
97
|
+
stats: { durationMs: Date.now() - started, evals: stats.evals },
|
|
98
|
+
});
|
|
75
99
|
if (currentId) {
|
|
76
100
|
const current = items.find((item) => item.placementId === currentId);
|
|
77
101
|
if (current && current.groupPath.length > 0) {
|
|
78
102
|
for (let depth = current.groupPath.length; depth >= 1; depth--) {
|
|
79
103
|
const prefix = current.groupPath.slice(0, depth);
|
|
80
104
|
const groupItems = items.filter((item) => startsWithGroup(item.groupPath, prefix));
|
|
81
|
-
const hit = await firstHit(groupItems, snapshot, options.compute, skip, 'sticky', skipped, decisions, considered);
|
|
82
|
-
if (hit)
|
|
83
|
-
return
|
|
84
|
-
}
|
|
105
|
+
const hit = await firstHit(groupItems, snapshot, options.compute, skip, 'sticky', skipped, decisions, considered, stats);
|
|
106
|
+
if (hit)
|
|
107
|
+
return finish(hit, 'sticky');
|
|
85
108
|
}
|
|
86
109
|
}
|
|
87
110
|
}
|
|
88
|
-
const hit = await firstHit(items, snapshot, options.compute, skip, 'scan', skipped, decisions, considered);
|
|
111
|
+
const hit = await firstHit(items, snapshot, options.compute, skip, 'scan', skipped, decisions, considered, stats);
|
|
89
112
|
if (hit)
|
|
90
|
-
return
|
|
91
|
-
return
|
|
113
|
+
return finish(hit, 'scan');
|
|
114
|
+
return finish(null, 'complete');
|
|
92
115
|
}
|
|
93
116
|
export async function unresolvedFinishWhenFields(item, snapshot, compute) {
|
|
94
117
|
return (await evaluateWhen(item.finishWhen, snapshot, compute)).failedFields;
|
|
@@ -3,7 +3,7 @@ export { buildActionContext, type BuildActionContextOptions } from './build-cont
|
|
|
3
3
|
export { resolveSystemFnParams } from './system-args.js';
|
|
4
4
|
export { createFakeApiHost, type FakeApiHostOptions } from './fake/index.js';
|
|
5
5
|
export { defaultPlatformApis, emptyIntegration, type PlatformApiOverrides } from './fake/empty-api.js';
|
|
6
|
-
export { createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, encodeLogTagsHeader, readLogTagsHeader, readRequestIdHeader, } from './rpc/index.js';
|
|
6
|
+
export { createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, RUNTIME_VERSION_HEADER, encodeLogTagsHeader, formatRuntimeVersion, readLogTagsHeader, readRequestIdHeader, readRuntimeVersionHeader, } from './rpc/index.js';
|
|
7
7
|
export { bindLogMeta, noopLog } from './log.js';
|
|
8
8
|
export { makeCtx, makeCtxAsync } from './make-ctx.js';
|
|
9
9
|
export { defaultHttpApi } from '../core/context/http.js';
|
package/dist/fn-context/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { buildActionContext } from './build-context.js';
|
|
|
2
2
|
export { resolveSystemFnParams } from './system-args.js';
|
|
3
3
|
export { createFakeApiHost } from './fake/index.js';
|
|
4
4
|
export { defaultPlatformApis, emptyIntegration } from './fake/empty-api.js';
|
|
5
|
-
export { createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, encodeLogTagsHeader, readLogTagsHeader, readRequestIdHeader, } from './rpc/index.js';
|
|
5
|
+
export { createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, RUNTIME_VERSION_HEADER, encodeLogTagsHeader, formatRuntimeVersion, readLogTagsHeader, readRequestIdHeader, readRuntimeVersionHeader, } from './rpc/index.js';
|
|
6
6
|
export { bindLogMeta, noopLog } from './log.js';
|
|
7
7
|
export { makeCtx, makeCtxAsync } from './make-ctx.js';
|
|
8
8
|
export { defaultHttpApi } from '../core/context/http.js';
|
|
@@ -6,5 +6,5 @@ export { createListBindingsProcedure } from './integration/list-bindings.js';
|
|
|
6
6
|
export { createPlatformRouter, type PlatformInvokeHandler } from './platform.js';
|
|
7
7
|
export { createLogRouter, type LogEmitHandler } from './log.js';
|
|
8
8
|
export { createRpcApiHost } from './trpc-client.js';
|
|
9
|
-
export { LOG_TAGS_HEADER, REQUEST_ID_HEADER, encodeLogTagsHeader, readLogTagsHeader, readRequestIdHeader, } from './request-id.js';
|
|
9
|
+
export { LOG_TAGS_HEADER, REQUEST_ID_HEADER, RUNTIME_VERSION_HEADER, encodeLogTagsHeader, formatRuntimeVersion, readLogTagsHeader, readRequestIdHeader, readRuntimeVersionHeader, } from './request-id.js';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -5,5 +5,5 @@ export { createListBindingsProcedure } from './integration/list-bindings.js';
|
|
|
5
5
|
export { createPlatformRouter } from './platform.js';
|
|
6
6
|
export { createLogRouter } from './log.js';
|
|
7
7
|
export { createRpcApiHost } from './trpc-client.js';
|
|
8
|
-
export { LOG_TAGS_HEADER, REQUEST_ID_HEADER, encodeLogTagsHeader, readLogTagsHeader, readRequestIdHeader, } from './request-id.js';
|
|
8
|
+
export { LOG_TAGS_HEADER, REQUEST_ID_HEADER, RUNTIME_VERSION_HEADER, encodeLogTagsHeader, formatRuntimeVersion, readLogTagsHeader, readRequestIdHeader, readRuntimeVersionHeader, } from './request-id.js';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
export declare const REQUEST_ID_HEADER = "x-request-id";
|
|
2
2
|
export declare const LOG_TAGS_HEADER = "x-superpanel-log-tags";
|
|
3
|
+
export declare const RUNTIME_VERSION_HEADER = "x-superpanel-runtime-version";
|
|
4
|
+
export declare function formatRuntimeVersion(version: string, source: 'local-file' | 'npm'): string;
|
|
3
5
|
export declare function readRequestIdHeader(headers: {
|
|
4
6
|
get(name: string): string | null;
|
|
5
7
|
} | Record<string, string | string[] | undefined>): string | undefined;
|
|
8
|
+
export declare function readRuntimeVersionHeader(headers: {
|
|
9
|
+
get(name: string): string | null;
|
|
10
|
+
} | Record<string, string | string[] | undefined>): string | undefined;
|
|
6
11
|
export declare function encodeLogTagsHeader(tags: string[]): string;
|
|
7
12
|
export declare function readLogTagsHeader(headers: {
|
|
8
13
|
get(name: string): string | null;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export const REQUEST_ID_HEADER = 'x-request-id';
|
|
2
2
|
export const LOG_TAGS_HEADER = 'x-superpanel-log-tags';
|
|
3
|
+
export const RUNTIME_VERSION_HEADER = 'x-superpanel-runtime-version';
|
|
4
|
+
export function formatRuntimeVersion(version, source) {
|
|
5
|
+
return `${version}-${source}`;
|
|
6
|
+
}
|
|
3
7
|
function firstString(value) {
|
|
4
8
|
const raw = Array.isArray(value) ? value[0] : value;
|
|
5
9
|
return typeof raw === 'string' && raw.length > 0 ? raw : undefined;
|
|
@@ -11,6 +15,13 @@ export function readRequestIdHeader(headers) {
|
|
|
11
15
|
const record = headers;
|
|
12
16
|
return firstString(record[REQUEST_ID_HEADER]);
|
|
13
17
|
}
|
|
18
|
+
export function readRuntimeVersionHeader(headers) {
|
|
19
|
+
if (typeof headers.get === 'function') {
|
|
20
|
+
return firstString(headers.get(RUNTIME_VERSION_HEADER));
|
|
21
|
+
}
|
|
22
|
+
const record = headers;
|
|
23
|
+
return firstString(record[RUNTIME_VERSION_HEADER]);
|
|
24
|
+
}
|
|
14
25
|
export function encodeLogTagsHeader(tags) {
|
|
15
26
|
return JSON.stringify(tags);
|
|
16
27
|
}
|
|
@@ -2,6 +2,8 @@ import type { ApiHost } from '../types.js';
|
|
|
2
2
|
export declare function createRpcApiHost(options: {
|
|
3
3
|
baseUrl: string;
|
|
4
4
|
getToken: () => string | Promise<string>;
|
|
5
|
+
runtimeVersion: string;
|
|
6
|
+
runtimeSource: 'local-file' | 'npm';
|
|
5
7
|
getRequestId?: () => string | undefined;
|
|
6
8
|
getTags?: () => string[] | undefined;
|
|
7
9
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
@@ -3,7 +3,7 @@ import { platformSurfaces } from '../../core/context/platform-registry.js';
|
|
|
3
3
|
import { defaultHttpApi } from '../../core/context/http.js';
|
|
4
4
|
import { integrationSurfaceKeys, } from '../../core/context/types.js';
|
|
5
5
|
import { bindEnvService } from '../../core/context/env.js';
|
|
6
|
-
import { REQUEST_ID_HEADER } from './request-id.js';
|
|
6
|
+
import { REQUEST_ID_HEADER, RUNTIME_VERSION_HEADER, formatRuntimeVersion, } from './request-id.js';
|
|
7
7
|
function rpcLogger(c, getTags, waitUntil) {
|
|
8
8
|
const emit = (level, message, extra) => {
|
|
9
9
|
const pending = c.log.emit.mutate({ level, message, extra, tags: getTags?.() }).catch(() => { });
|
|
@@ -86,6 +86,7 @@ export function createRpcApiHost(options) {
|
|
|
86
86
|
headers: async () => {
|
|
87
87
|
const headers = {
|
|
88
88
|
authorization: `Bearer ${await options.getToken()}`,
|
|
89
|
+
[RUNTIME_VERSION_HEADER]: formatRuntimeVersion(options.runtimeVersion, options.runtimeSource),
|
|
89
90
|
};
|
|
90
91
|
const requestId = options.getRequestId?.();
|
|
91
92
|
if (requestId)
|
|
@@ -102,7 +103,10 @@ export function createRpcApiHost(options) {
|
|
|
102
103
|
return {
|
|
103
104
|
async buildApi(_run) {
|
|
104
105
|
const c = getClient(options.baseUrl);
|
|
106
|
+
const started = Date.now();
|
|
107
|
+
console.log(`[rpc timing] integration.listBindings start url=${options.baseUrl}`);
|
|
105
108
|
const metas = await rpcSafe(c.integration.listBindings.query());
|
|
109
|
+
console.log(`[rpc timing] integration.listBindings ok ${Date.now() - started}ms count=${metas.length}`);
|
|
106
110
|
return {
|
|
107
111
|
...buildPlatformApis(c),
|
|
108
112
|
integration: buildSurfaces(c, metas),
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { idRef } from './core/slot/id-ref.js';
|
|
|
5
5
|
export type { HubspotApi, HubspotAssociationListOutput, HubspotCreateContactInput, HubspotCreateContactOutput, HubspotCreateDealInput, HubspotCreateDealOutput, HubspotCreateNoteInput, HubspotCreateTaskInput, HubspotEngagementOutput, HubspotGetAssociatedContactsInput, HubspotGetAssociatedDealsInput, HubspotGetContactInput, HubspotGetContactOutput, HubspotGetCrmUrlInput, HubspotGetCrmUrlOutput, HubspotGetDealInput, HubspotGetDealOutput, HubspotGetOwnerInput, HubspotGetOwnerOutput, HubspotLogCallInput, HubspotLogEmailInput, HubspotLogSmsInput, HubspotRecord, HubspotSearchContactsInput, HubspotSearchContactsOutput, HubspotService, HubspotUpdateContactInput, HubspotUpdateContactOutput, HubspotUpdateDealInput, HubspotUpdateDealOutput, HubspotUpsertContactInput, HubspotUpsertContactOutput, } from './core/context/hubspot.js';
|
|
6
6
|
export type { DocusignApi, DocusignCreateEnvelopeFromTemplateInput, DocusignCreateEnvelopeFromTemplateOutput, DocusignCreateRecipientViewFromTemplateInput, DocusignCreateRecipientViewFromTemplateOutput, DocusignEnvelopeIdInput, DocusignGetEnvelopeRecipientsOutput, DocusignGetEnvelopeSigningStatusOutput, DocusignGetEnvelopeStatusOutput, DocusignListRecentEnvelopesInput, DocusignListRecentEnvelopesOutput, DocusignListTemplatesOutput, DocusignRecentEnvelope, DocusignRecipient, DocusignSearchEnvelopesByEmailInput, DocusignSearchEnvelopesByEmailOutput, DocusignService, } from './core/context/docusign.js';
|
|
7
7
|
export type { FilevineAddHashtagToProjectInput, FilevineAddHashtagToProjectOutput, FilevineApi, FilevineCollectionItemInput, FilevineCommentOutput, FilevineCreateCommentInput, FilevineCreateContactInput, FilevineCreateContactOutput, FilevineCreateNoteInput, FilevineCreateNoteWithCommentInput, FilevineCreateNoteWithCommentOutput, FilevineCreateProjectCollectionItemInput, FilevineCreateProjectCollectionItemOutput, FilevineCreateProjectInput, FilevineCreateProjectOutput, FilevineDeleteProjectCollectionItemInput, FilevineDeleteProjectCollectionItemOutput, FilevineFolder, FilevineGetAssociatedProjectsInput, FilevineGetAssociatedProjectsOutput, FilevineGetContactInput, FilevineGetContactOutput, FilevineGetCrmUrlInput, FilevineGetCrmUrlOutput, FilevineGetProjectCollectionItemInput, FilevineGetProjectCollectionItemOutput, FilevineGetProjectCollectionItemsInput, FilevineGetProjectCollectionItemsOutput, FilevineGetProjectFoldersInput, FilevineGetProjectFoldersOutput, FilevineGetProjectInput, FilevineGetProjectOutput, FilevineLogCallInput, FilevineLogEmailInput, FilevineLogSmsInput, FilevineNoteOutput, FilevineProperties, FilevineRecord, FilevineSearchContactsInput, FilevineSearchContactsOutput, FilevineService, FilevineUpdateContactInput, FilevineUpdateContactOutput, FilevineUpdateProjectCollectionItemInput, FilevineUpdateProjectCollectionItemOutput, FilevineUpdateProjectInput, FilevineUpdateProjectOutput, FilevineUploadDocumentInput, FilevineUploadDocumentOutput, } from './core/context/filevine.js';
|
|
8
|
-
export type { CaseContext, ContactApi, BoundIntegrationMeta, EnvApi, EnvService, FieldState, HttpApi, IntegrationAccountFields, IntegrationApi, IntegrationStub, IntegrationSurfaceKey, IntegrationTarget, TwilioApi, TwilioCreateCallInput, TwilioCreateCallOutput, TwilioIncomingNumber, TwilioListIncomingNumbersOutput, TwilioSendSmsInput, TwilioSendSmsOutput, TwilioService, Logger, MakeCtxOverrides, Slots, SystemContext, Writes, } from './core/context/types.js';
|
|
8
|
+
export type { CaseContext, ContactApi, BoundIntegrationMeta, EnvApi, EnvService, FieldState, HttpApi, IntegrationAccountFields, IntegrationApi, IntegrationStub, IntegrationSurfaceKey, IntegrationTarget, TwilioApi, TwilioCreateCallInput, TwilioCreateCallOutput, TwilioIncomingNumber, TwilioListIncomingNumbersOutput, TwilioSendSmsInput, TwilioSendSmsOutput, TwilioService, Logger, MakeCtxOverrides, Slots, SystemContext, FieldWrites, RowWrite, StructuredWrites, Writes, } from './core/context/types.js';
|
|
9
9
|
export { CONTACT_PAGE_LIMIT_MAX, contactListInput, contactListOutput, contactMockService, contactSummary, contactSurface, type ContactListParams, type ContactListResult, type ContactSummary, } from './core/context/contact.js';
|
|
10
10
|
export { dbDelInput, dbDelOutput, dbGetInput, dbGetOutput, dbMockService, dbSetInput, dbSetOutput, dbSurface, KV_KEY_MAX, KV_TTL_SECONDS_MAX, KV_VALUE_MAX, type DbApi, type DbDelInput, type DbDelOutput, type DbGetInput, type DbGetOutput, type DbSetInput, type DbSetOutput, } from './core/context/db.js';
|
|
11
11
|
export { bindEnvService, envMockService, readEnvGet } from './core/context/env.js';
|
|
@@ -19,18 +19,18 @@ export { twilioCreateCallInput, twilioCreateCallOutput, twilioIncomingNumber, tw
|
|
|
19
19
|
export type { ApplyWritesOptions, ApplyWritesResult, CompiledSlotSchema, ExtractedField, FieldHistoryEntry, FieldValue, HistoryAppend, MultiRowProjection, MultiRowRecord, MultiRowTableData, RecomputeResult, RuntimeDerivedFieldDef, RuntimeFieldDef, RuntimeNormalFieldDef, RuntimeSlotsSnapshot, RuntimeTableDef, SingleRowProjection, SingleRowTableData, SlotCurrent, SlotFillingOutput, SlotFillingValidateResult, TableData, UpdatedBy, ValidationIssue, ValidationResult, WriteSource, } from './core/slot/types.js';
|
|
20
20
|
export type { FuncRef } from './core/functions/func-ref.js';
|
|
21
21
|
export { resolveFuncName } from './core/functions/func-ref.js';
|
|
22
|
-
export type { SequenceBuild } from './builder/types.js';
|
|
22
|
+
export type { RuntimePackageSource, SequenceBuild } from './builder/types.js';
|
|
23
23
|
export type { CaseContextViewRegistryEntry, ComputeFn, CustomFn, DefinedFunc, FuncMap, FuncOptions, FuncRegistration, FunctionCall, FunctionCtx, FunctionRegistry, FunctionRegistryEntry, GetFirstMessageFunction, GetFirstMessageParams, SystemFuncMap, WebHookFunction, WebHookFunctionParams, } from './core/functions/types.js';
|
|
24
24
|
export { toFuncRegistrations } from './core/functions/types.js';
|
|
25
25
|
export { toCaseContextViewRegistry, toFunctionRegistry } from './builder/compile/registry.js';
|
|
26
26
|
export { compileFunctionCode } from './builder/compile/function-code.js';
|
|
27
|
-
export { compileAll, compileSequence, runtimePackageVersion, snapshotCompanySchema, type CompileSequenceOptions, type CompileSequenceResult, } from './builder/compile/compile-sequence.js';
|
|
27
|
+
export { compileAll, compileSequence, runtimePackageSource, runtimePackageVersion, snapshotCompanySchema, type CompileSequenceOptions, type CompileSequenceResult, } from './builder/compile/compile-sequence.js';
|
|
28
28
|
export { compileSequenceAgendas, fatalAgendaIssues } from './builder/compile/compile-agenda.js';
|
|
29
29
|
export { loadSequenceCaseContextView, loadSequenceFunctions } from './builder/load.js';
|
|
30
30
|
export { findTsModule } from './builder/paths.js';
|
|
31
31
|
export type { OverlayClientMessage, OverlayExecuteMessage, OverlayExecuteResultMessage, OverlayAuthErrorMessage, OverlayAuthMessage, OverlayAuthOkMessage, OverlayMessage, OverlayPushMessage, OverlayReplacedMessage, OverlayServerMessage, } from './dev-overlay/protocol.js';
|
|
32
32
|
export { encodeOverlayMessage, OVERLAY_REPLACED_CLOSE_CODE, parseOverlayMessage } from './dev-overlay/protocol.js';
|
|
33
|
-
export { buildActionContext, bindLogMeta, createFakeApiHost, defaultPlatformApis, emptyIntegration, createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, encodeLogTagsHeader, readLogTagsHeader, readRequestIdHeader, makeCtx, makeCtxAsync, noopLog, type ActionContext, type ActionDataSlice, type ApiHost, type FakeApiHostOptions, type RunScope, } from './fn-context/index.js';
|
|
33
|
+
export { buildActionContext, bindLogMeta, createFakeApiHost, defaultPlatformApis, emptyIntegration, createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, RUNTIME_VERSION_HEADER, encodeLogTagsHeader, formatRuntimeVersion, readLogTagsHeader, readRequestIdHeader, readRuntimeVersionHeader, makeCtx, makeCtxAsync, noopLog, type ActionContext, type ActionDataSlice, type ApiHost, type FakeApiHostOptions, type RunScope, } from './fn-context/index.js';
|
|
34
34
|
export { createAppRouter, createIntegrationRouter, createListBindingsProcedure, createLogRouter, createPlatformRouter, isRpcCodedError, parseScriptInput, ScriptInputError, type AppRouter, type RpcCodedError, type RpcErrorCode, type IntegrationInvokeHandler, type LogEmitHandler, type PlatformInvokeHandler, type RpcContext, } from './fn-context/rpc/index.js';
|
|
35
35
|
export * from './compute-host/index.js';
|
|
36
36
|
export { defineBoolComputeFunc, defineComputeFunc } from './core/functions/define/compute.js';
|
|
@@ -39,9 +39,9 @@ export { defineCustomFunc } from './core/functions/define/custom.js';
|
|
|
39
39
|
export { defineSystemFunc } from './core/functions/define/system.js';
|
|
40
40
|
export { mergeEffectiveSchema } from './builder/merge.js';
|
|
41
41
|
export { emitCaseContextSource, emitSlotsSource } from './builder/codegen/emit.js';
|
|
42
|
-
export { affectedDerivedFields, applyFieldPatch, applyFieldPatchAndRecompute, applySlotFilling, applySlotFillingAndRecompute, applyWrites, applyWritesAndRecompute, buildDependencyGraph, buildFieldCatalog, buildSlotFillingJsonSchema, cloneSnapshot, commitFieldWrite, compiledTableEntries, compileSlotSchema, emptyFieldValue, emptyMultiRow, emptySlotRow, fieldChanged, formatFieldPath, getCompiledTable, getFieldState, getFieldValue, getLastThreeValues, getRowField, getSingleField, getSnapshotTable, isFieldValue, isReservedTableName, isResolved, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, isSnapshotSingleRow, isValidDataTypeValue, listConversationFields, makeFieldValue, markAskedUnknown, parseFieldPath, recomputeDerived, requireFieldPath, rowValueEntries, slotFieldEntries, slotFieldNames, snapshotFrom, toEffectiveSchema, toHistoryEntry, validateBareValue, validateExtractedField, validateFieldRefs, validateSlotFillingOutput, } from './core/slot/index.js';
|
|
42
|
+
export { affectedDerivedFields, applyFieldPatch, applyFieldPatchAndRecompute, applySlotFilling, applySlotFillingAndRecompute, applyWrites, applyWritesAndRecompute, buildDependencyGraph, buildFieldCatalog, buildSlotFillingJsonSchema, cloneSnapshot, commitFieldWrite, compiledTableEntries, compileSlotSchema, emptyFieldValue, emptyMultiRow, emptySlotRow, fieldChanged, formatFieldPath, getCompiledTable, getFieldState, getFieldValue, getLastThreeValues, getRowField, getSingleField, getSnapshotTable, isFieldValue, isReservedTableName, isResolved, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, isSnapshotSingleRow, isValidDataTypeValue, listConversationFields, makeFieldValue, markAskedUnknown, isRowWrite, isStructuredWrites, normalizeWrites, parseFieldPath, recomputeDerived, requireFieldPath, rowValueEntries, slotFieldEntries, slotFieldNames, snapshotFrom, toEffectiveSchema, toHistoryEntry, validateBareValue, validateExtractedField, validateFieldRefs, validateSlotFillingOutput, } from './core/slot/index.js';
|
|
43
43
|
export type { ApplySlotFillingOptions, DependencyGraphResult, FieldPatchInput, FieldPath, ParsedFieldPath, RecomputeOptions, SfSchemaOptions, SlotRow, SnapshotSeed, ValidateSlotFillingOptions, } from './core/slot/index.js';
|
|
44
|
-
export type { ActionBlock, ActionNode, AgendaBlock, AgendaConfig, AgendaHeader, AgendaTree, ApplyWhen, AuthoringNode, AuthoringWhen, BranchNode, Channel, CompiledActionBlock, CompiledAgenda, CompiledAgendaBlock, CompiledTopicBlock, CompiledTransferBlock, CompiledWhen, Condition, ConditionEval, FirstMessage, FinishWhen, FinishWhenEval, FlatActionItem, FlatAgendaItem, FlatNodePlacement, FlatTopicItem, FlatTransferItem, FlattenOptions, FlattenResult, Interrupt, SequenceAgendas, JsonRulesCondition, NodePlacement, OnNoProgress, OtherwiseSentinel, Placement, SectionNode, SectionPlacement, SimulateResult, SimulatedItem, SimulatedItemStatus, SwitchOnNode, TopicBlock, TopicNode, TransferBlock, TransferNode, ValidateAgendaOptions, WalkDecision, WalkHitReason, WalkOptions, WalkResult, WalkSkip, WalkSkipReason, When, WhenEval, AdvanceResult, StageDriveHooks, StageDriveResult, StageDriveState, } from './core/stage/index.js';
|
|
45
|
-
export { DEFAULT_MAX_ACTIONS_PER_TURN, LAST_TRANSFER_RESULT_FIELD, action, advanceAgenda, agenda, andCompiledWhen, branch, collectJsonRulesFacts, collectTransferBlocks, compileAuthoringWhen, compileFinishWhen, compileWhen, driveAgenda, evaluateFinishWhen, evaluateJsonRules, evaluateWhen, extractBlocksFromTree, extractTemplateFields, finishWhenFields, flattenAgendaConfig, flattenAgendaPlacements, flattenAgendaTree, isAgendaTree, isSequenceAgendas, isOtherwise, jsonRules, looksLikeJsonRules, normalizeJsonRules, normalizeSequenceAgendas, notAnyWhen, otherwise, parseJsonRules, registerTransferSessionFields, section, simulateAgenda, switchOn, topic, transfer, transferFieldKey, transferResultField, transferWrites, treeToPlacements, unresolvedFinishWhenFields, validateCompiledAgenda, walkAgenda, watchdogHint, whenFields, } from './core/stage/index.js';
|
|
44
|
+
export type { ActionBlock, ActionNode, AgendaBlock, AgendaConfig, AgendaHeader, AgendaTree, ApplyWhen, AuthoringNode, AuthoringWhen, BranchNode, Channel, CompiledActionBlock, CompiledAgenda, CompiledAgendaBlock, CompiledTopicBlock, CompiledIvrBlock, CompiledTransferBlock, CompiledWhen, Condition, ConditionEval, FirstMessage, FinishWhen, FinishWhenEval, FlatActionItem, FlatAgendaItem, FlatIvrItem, FlatNodePlacement, FlatTopicItem, FlatTransferItem, DtmfResult, IvrAttemptResult, IvrBlock, IvrDigit, IvrFallbackAction, IvrNode, FlattenOptions, FlattenResult, Interrupt, SpokenLanguage, SequenceAgendas, JsonRulesCondition, NodePlacement, OnNoProgress, OtherwiseSentinel, Placement, SectionNode, SectionPlacement, SimulateResult, SimulatedItem, SimulatedItemStatus, SwitchOnNode, TopicBlock, TopicNode, TransferArguments, TransferBlock, TransferCallerIdShown, TransferConfirmKey, TransferConfirmMethod, TransferDial, TransferFallbackAction, TransferInterruptAction, TransferMode, TransferNode, TransferSay, ValidateAgendaOptions, WalkDecision, WalkHitReason, WalkOptions, WalkResult, WalkSkip, WalkStats, WalkSkipReason, When, WhenEval, AdvanceResult, StageDriveHooks, StageDriveResult, StageDriveState, } from './core/stage/index.js';
|
|
45
|
+
export { DEFAULT_MAX_ACTIONS_PER_TURN, CASE_LAST_TRANSFER_AT, CASE_LAST_TRANSFER_RESULT, CASE_TRANSFER_ATTEMPT_COUNT, E164_NUMBER, LAST_TRANSFER_RESULT_FIELD, CONTACT_LANGUAGE_FIELD, getContactLang, inboundIvrCollect, ivrAttempted, ivrOf, ivrResultField, languageFieldOf, RESERVED_INTERRUPT_TOOL_NAMES, SIP_URI, action, advanceAgenda, agenda, andCompiledWhen, branch, collectJsonRulesFacts, collectTransferBlocks, collectTransferInterruptHeaders, compileAuthoringWhen, compileFinishWhen, compileWhen, driveAgenda, evaluateFinishWhen, evaluateJsonRules, evaluateWhen, extractBlocksFromTree, extractTemplateFields, finishWhenFields, flattenAgendaConfig, flattenAgendaPlacements, flattenAgendaTree, headerHasTransferInterrupt, ivr, interpolateFromSnapshot, interpolateTemplate, isTransferDestinationLiteral, isAgendaTree, isSequenceAgendas, isOtherwise, isSpokenLanguage, jsonRules, looksLikeJsonRules, normalizeJsonRules, normalizeSequenceAgendas, notAnyWhen, otherwise, parseJsonRules, registerIvrSessionFields, collectIvrBlocks, registerTransferSessionFields, resolveTransferArguments, resolveTransferDestinations, resolveTransferSay, section, simulateAgenda, switchOn, topic, transfer, transferArgumentsJson, transferFieldKey, transferResultField, transferWrites, validateTransferDestinations, treeToPlacements, unresolvedFinishWhenFields, validateCompiledAgenda, validateInterrupts, walkAgenda, watchdogHint, whenFields, } from './core/stage/index.js';
|
|
46
46
|
export * from './voice-service/index.js';
|
|
47
47
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -14,12 +14,12 @@ export { resolveFuncName } from './core/functions/func-ref.js';
|
|
|
14
14
|
export { toFuncRegistrations } from './core/functions/types.js';
|
|
15
15
|
export { toCaseContextViewRegistry, toFunctionRegistry } from './builder/compile/registry.js';
|
|
16
16
|
export { compileFunctionCode } from './builder/compile/function-code.js';
|
|
17
|
-
export { compileAll, compileSequence, runtimePackageVersion, snapshotCompanySchema, } from './builder/compile/compile-sequence.js';
|
|
17
|
+
export { compileAll, compileSequence, runtimePackageSource, runtimePackageVersion, snapshotCompanySchema, } from './builder/compile/compile-sequence.js';
|
|
18
18
|
export { compileSequenceAgendas, fatalAgendaIssues } from './builder/compile/compile-agenda.js';
|
|
19
19
|
export { loadSequenceCaseContextView, loadSequenceFunctions } from './builder/load.js';
|
|
20
20
|
export { findTsModule } from './builder/paths.js';
|
|
21
21
|
export { encodeOverlayMessage, OVERLAY_REPLACED_CLOSE_CODE, parseOverlayMessage } from './dev-overlay/protocol.js';
|
|
22
|
-
export { buildActionContext, bindLogMeta, createFakeApiHost, defaultPlatformApis, emptyIntegration, createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, encodeLogTagsHeader, readLogTagsHeader, readRequestIdHeader, makeCtx, makeCtxAsync, noopLog, } from './fn-context/index.js';
|
|
22
|
+
export { buildActionContext, bindLogMeta, createFakeApiHost, defaultPlatformApis, emptyIntegration, createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, RUNTIME_VERSION_HEADER, encodeLogTagsHeader, formatRuntimeVersion, readLogTagsHeader, readRequestIdHeader, readRuntimeVersionHeader, makeCtx, makeCtxAsync, noopLog, } from './fn-context/index.js';
|
|
23
23
|
export { createAppRouter, createIntegrationRouter, createListBindingsProcedure, createLogRouter, createPlatformRouter, isRpcCodedError, parseScriptInput, ScriptInputError, } from './fn-context/rpc/index.js';
|
|
24
24
|
export * from './compute-host/index.js';
|
|
25
25
|
export { defineBoolComputeFunc, defineComputeFunc } from './core/functions/define/compute.js';
|
|
@@ -28,7 +28,7 @@ export { defineCustomFunc } from './core/functions/define/custom.js';
|
|
|
28
28
|
export { defineSystemFunc } from './core/functions/define/system.js';
|
|
29
29
|
export { mergeEffectiveSchema } from './builder/merge.js';
|
|
30
30
|
export { emitCaseContextSource, emitSlotsSource } from './builder/codegen/emit.js';
|
|
31
|
-
export { affectedDerivedFields, applyFieldPatch, applyFieldPatchAndRecompute, applySlotFilling, applySlotFillingAndRecompute, applyWrites, applyWritesAndRecompute, buildDependencyGraph, buildFieldCatalog, buildSlotFillingJsonSchema, cloneSnapshot, commitFieldWrite, compiledTableEntries, compileSlotSchema, emptyFieldValue, emptyMultiRow, emptySlotRow, fieldChanged, formatFieldPath, getCompiledTable, getFieldState, getFieldValue, getLastThreeValues, getRowField, getSingleField, getSnapshotTable, isFieldValue, isReservedTableName, isResolved, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, isSnapshotSingleRow, isValidDataTypeValue, listConversationFields, makeFieldValue, markAskedUnknown, parseFieldPath, recomputeDerived, requireFieldPath, rowValueEntries, slotFieldEntries, slotFieldNames, snapshotFrom, toEffectiveSchema, toHistoryEntry, validateBareValue, validateExtractedField, validateFieldRefs, validateSlotFillingOutput, } from './core/slot/index.js';
|
|
32
|
-
export { DEFAULT_MAX_ACTIONS_PER_TURN, LAST_TRANSFER_RESULT_FIELD, action, advanceAgenda, agenda, andCompiledWhen, branch, collectJsonRulesFacts, collectTransferBlocks, compileAuthoringWhen, compileFinishWhen, compileWhen, driveAgenda, evaluateFinishWhen, evaluateJsonRules, evaluateWhen, extractBlocksFromTree, extractTemplateFields, finishWhenFields, flattenAgendaConfig, flattenAgendaPlacements, flattenAgendaTree, isAgendaTree, isSequenceAgendas, isOtherwise, jsonRules, looksLikeJsonRules, normalizeJsonRules, normalizeSequenceAgendas, notAnyWhen, otherwise, parseJsonRules, registerTransferSessionFields, section, simulateAgenda, switchOn, topic, transfer, transferFieldKey, transferResultField, transferWrites, treeToPlacements, unresolvedFinishWhenFields, validateCompiledAgenda, walkAgenda, watchdogHint, whenFields, } from './core/stage/index.js';
|
|
31
|
+
export { affectedDerivedFields, applyFieldPatch, applyFieldPatchAndRecompute, applySlotFilling, applySlotFillingAndRecompute, applyWrites, applyWritesAndRecompute, buildDependencyGraph, buildFieldCatalog, buildSlotFillingJsonSchema, cloneSnapshot, commitFieldWrite, compiledTableEntries, compileSlotSchema, emptyFieldValue, emptyMultiRow, emptySlotRow, fieldChanged, formatFieldPath, getCompiledTable, getFieldState, getFieldValue, getLastThreeValues, getRowField, getSingleField, getSnapshotTable, isFieldValue, isReservedTableName, isResolved, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, isSnapshotSingleRow, isValidDataTypeValue, listConversationFields, makeFieldValue, markAskedUnknown, isRowWrite, isStructuredWrites, normalizeWrites, parseFieldPath, recomputeDerived, requireFieldPath, rowValueEntries, slotFieldEntries, slotFieldNames, snapshotFrom, toEffectiveSchema, toHistoryEntry, validateBareValue, validateExtractedField, validateFieldRefs, validateSlotFillingOutput, } from './core/slot/index.js';
|
|
32
|
+
export { DEFAULT_MAX_ACTIONS_PER_TURN, CASE_LAST_TRANSFER_AT, CASE_LAST_TRANSFER_RESULT, CASE_TRANSFER_ATTEMPT_COUNT, E164_NUMBER, LAST_TRANSFER_RESULT_FIELD, CONTACT_LANGUAGE_FIELD, getContactLang, inboundIvrCollect, ivrAttempted, ivrOf, ivrResultField, languageFieldOf, RESERVED_INTERRUPT_TOOL_NAMES, SIP_URI, action, advanceAgenda, agenda, andCompiledWhen, branch, collectJsonRulesFacts, collectTransferBlocks, collectTransferInterruptHeaders, compileAuthoringWhen, compileFinishWhen, compileWhen, driveAgenda, evaluateFinishWhen, evaluateJsonRules, evaluateWhen, extractBlocksFromTree, extractTemplateFields, finishWhenFields, flattenAgendaConfig, flattenAgendaPlacements, flattenAgendaTree, headerHasTransferInterrupt, ivr, interpolateFromSnapshot, interpolateTemplate, isTransferDestinationLiteral, isAgendaTree, isSequenceAgendas, isOtherwise, isSpokenLanguage, jsonRules, looksLikeJsonRules, normalizeJsonRules, normalizeSequenceAgendas, notAnyWhen, otherwise, parseJsonRules, registerIvrSessionFields, collectIvrBlocks, registerTransferSessionFields, resolveTransferArguments, resolveTransferDestinations, resolveTransferSay, section, simulateAgenda, switchOn, topic, transfer, transferArgumentsJson, transferFieldKey, transferResultField, transferWrites, validateTransferDestinations, treeToPlacements, unresolvedFinishWhenFields, validateCompiledAgenda, validateInterrupts, walkAgenda, watchdogHint, whenFields, } from './core/stage/index.js';
|
|
33
33
|
export * from './voice-service/index.js';
|
|
34
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -369,6 +369,9 @@ export interface FieldCollectConfig extends LoopConfirmConfig {
|
|
|
369
369
|
unsuccessSayText: string | null;
|
|
370
370
|
validateDigits: DtmfDigit[];
|
|
371
371
|
digitsValueMap: Record<string, string>;
|
|
372
|
+
finishOnKey?: DtmfDigit;
|
|
373
|
+
minDigits?: number;
|
|
374
|
+
maxDigits?: number;
|
|
372
375
|
}
|
|
373
376
|
export interface WarmTransferSession {
|
|
374
377
|
conferenceName: string;
|