@superpanel-sdk/runtime 0.5.0 → 0.7.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 +3 -3
- package/dist/builder/codegen/emit.d.ts +5 -10
- package/dist/builder/codegen/emit.js +100 -106
- package/dist/builder/codegen/generate.d.ts +3 -5
- package/dist/builder/codegen/generate.js +13 -32
- package/dist/builder/company-imports.d.ts +5 -0
- package/dist/builder/company-imports.js +9 -1
- package/dist/builder/compile/compile-sequence.d.ts +13 -11
- package/dist/builder/compile/compile-sequence.js +135 -83
- package/dist/builder/compile/function-code.d.ts +15 -9
- package/dist/builder/compile/function-code.js +59 -29
- package/dist/builder/compile/registry.d.ts +4 -4
- package/dist/builder/compile/registry.js +14 -12
- package/dist/builder/errors.d.ts +9 -0
- package/dist/builder/errors.js +17 -0
- package/dist/builder/function-params.d.ts +10 -0
- package/dist/builder/function-params.js +203 -0
- package/dist/builder/load.d.ts +17 -17
- package/dist/builder/load.js +27 -25
- package/dist/builder/paths.d.ts +6 -1
- package/dist/builder/paths.js +16 -2
- package/dist/builder/schedules.d.ts +9 -7
- package/dist/builder/schedules.js +20 -21
- package/dist/builder/typecheck.d.ts +1 -1
- package/dist/builder/typecheck.js +3 -6
- package/dist/builder/types.d.ts +41 -5
- package/dist/builder/types.js +19 -0
- package/dist/cli/calls/index.d.ts +177 -0
- package/dist/cli/calls/index.js +96 -0
- package/dist/cli/debug/index.d.ts +31 -0
- package/dist/cli/debug/index.js +119 -0
- package/dist/cli/exec/index.d.ts +39 -0
- package/dist/cli/exec/index.js +138 -0
- package/dist/cli/exec/session.d.ts +48 -0
- package/dist/cli/exec/session.js +82 -0
- package/dist/cli/exec/trace.d.ts +18 -0
- package/dist/cli/exec/trace.js +52 -0
- package/dist/cli/index.js +84 -1
- package/dist/cli/logs/index.d.ts +47 -0
- package/dist/cli/logs/index.js +113 -0
- package/dist/cli/mobile/index.d.ts +12 -0
- package/dist/cli/mobile/index.js +405 -0
- package/dist/cli/serve/index.d.ts +40 -4
- package/dist/cli/serve/index.js +167 -28
- package/dist/cli/turns/index.d.ts +105 -0
- package/dist/cli/turns/index.js +128 -0
- package/dist/cli/turns/run.d.ts +13 -0
- package/dist/cli/turns/run.js +57 -0
- package/dist/cli/turns/shadow.d.ts +112 -0
- package/dist/cli/turns/shadow.js +54 -0
- package/dist/cli/type-gen/index.js +0 -1
- package/dist/compute-host/compute-host.d.ts +5 -6
- package/dist/compute-host/compute-host.js +4 -13
- package/dist/compute-host/source-compute-host.d.ts +5 -7
- package/dist/compute-host/source-compute-host.js +12 -33
- package/dist/core/case-orchestrator/contact-hours.d.ts +26 -6
- package/dist/core/case-orchestrator/contact-hours.js +27 -8
- package/dist/core/case-orchestrator/index.d.ts +1 -4
- package/dist/core/case-orchestrator/index.js +1 -4
- package/dist/core/case-orchestrator/render.d.ts +1 -1
- package/dist/core/case-orchestrator/render.js +15 -10
- package/dist/core/case-orchestrator/types.d.ts +83 -128
- package/dist/core/case-orchestrator/types.js +0 -4
- package/dist/core/context/email-message.d.ts +40 -1
- package/dist/core/context/email-message.js +27 -0
- package/dist/core/context/email.d.ts +13 -1
- package/dist/core/context/email.js +2 -3
- package/dist/core/context/exchanges.d.ts +25 -0
- package/dist/core/context/exchanges.js +25 -7
- package/dist/core/context/instances.d.ts +31 -2
- package/dist/core/context/instances.js +18 -4
- package/dist/core/context/platform-registry.d.ts +35 -0
- package/dist/core/context/sms.d.ts +30 -0
- package/dist/core/context/sms.js +20 -0
- package/dist/core/context/types.d.ts +29 -1
- package/dist/core/conversation/index.d.ts +58 -4
- package/dist/core/conversation/index.js +123 -4
- package/dist/core/functions/errors.d.ts +74 -0
- package/dist/core/functions/errors.js +26 -0
- package/dist/core/functions/events.d.ts +23 -78
- package/dist/core/functions/events.js +8 -17
- package/dist/core/functions/schedules.d.ts +9 -10
- package/dist/core/functions/schedules.js +2 -2
- package/dist/core/functions/types.d.ts +17 -72
- package/dist/core/functions/types.js +1 -9
- package/dist/core/page/define.d.ts +230 -160
- package/dist/core/page/define.js +145 -104
- package/dist/core/page/envelope.d.ts +55 -0
- package/dist/core/page/envelope.js +4 -0
- package/dist/core/page/fns.d.ts +448 -0
- package/dist/core/page/fns.js +539 -0
- package/dist/core/page/memory-reader.d.ts +27 -0
- package/dist/core/page/memory-reader.js +299 -0
- package/dist/core/page/page-host.d.ts +20 -0
- package/dist/core/page/page-host.js +57 -0
- package/dist/core/page/records-query.d.ts +234 -0
- package/dist/core/page/records-query.js +780 -0
- package/dist/core/page/render.d.ts +67 -25
- package/dist/core/page/render.js +492 -272
- package/dist/core/page/sandbox.d.ts +85 -0
- package/dist/core/page/sandbox.js +357 -0
- package/dist/core/page/time-format.d.ts +27 -0
- package/dist/core/page/time-format.js +84 -0
- package/dist/core/page/typed.d.ts +165 -159
- package/dist/core/page/workspace.d.ts +25 -1
- package/dist/core/page/workspace.js +48 -13
- package/dist/core/party/schema.d.ts +74 -3
- package/dist/core/party/schema.js +39 -6
- package/dist/core/party/types.d.ts +8 -13
- package/dist/core/sequence/define.d.ts +1 -2
- package/dist/core/slot/company-metadata.d.ts +11 -22
- package/dist/core/slot/company-metadata.js +12 -39
- package/dist/core/slot/compile-schema.js +6 -6
- package/dist/core/slot/field.d.ts +1 -2
- package/dist/core/slot/field.js +0 -2
- package/dist/core/slot/index.d.ts +3 -3
- package/dist/core/slot/index.js +3 -3
- package/dist/core/slot/naming.d.ts +1 -1
- package/dist/core/slot/naming.js +1 -1
- package/dist/core/slot/platform-fields.d.ts +4 -4
- package/dist/core/slot/platform-fields.js +5 -5
- package/dist/core/slot/schema-compat.d.ts +8 -7
- package/dist/core/slot/schema-compat.js +22 -31
- package/dist/core/slot/schema.d.ts +3 -59
- package/dist/core/slot/schema.js +0 -15
- package/dist/core/slot/types.d.ts +4 -10
- package/dist/core/slot/value.d.ts +2 -0
- package/dist/core/slot/value.js +6 -2
- package/dist/dev-overlay/protocol.d.ts +38 -5
- package/dist/fn-context/build-context.js +10 -4
- package/dist/fn-context/fake/index.d.ts +2 -0
- package/dist/fn-context/fake/index.js +5 -3
- package/dist/fn-context/fn-params.d.ts +2 -5
- package/dist/fn-context/fn-params.js +6 -9
- package/dist/fn-context/index.d.ts +1 -1
- package/dist/fn-context/make-ctx.js +5 -4
- package/dist/fn-context/rpc/case-orchestrator-tools.d.ts +11 -3
- package/dist/fn-context/rpc/case-orchestrator-tools.js +0 -1
- package/dist/fn-context/rpc/errors.d.ts +13 -0
- package/dist/fn-context/rpc/errors.js +22 -0
- package/dist/fn-context/rpc/index.d.ts +1 -1
- package/dist/fn-context/rpc/index.js +1 -1
- package/dist/fn-context/rpc/integration/index.d.ts +11 -1
- package/dist/fn-context/rpc/log.d.ts +11 -1
- package/dist/fn-context/rpc/platform.d.ts +11 -1
- package/dist/fn-context/rpc/records.d.ts +13 -6
- package/dist/fn-context/rpc/records.js +2 -4
- package/dist/fn-context/rpc/trpc-client.d.ts +42 -0
- package/dist/fn-context/rpc/trpc-client.js +151 -22
- package/dist/fn-context/rpc/trpc-init.d.ts +19 -1
- package/dist/fn-context/rpc/trpc-init.js +10 -4
- package/dist/fn-context/rpc/trpc-router-factory.d.ts +66 -8
- package/dist/fn-context/run-scope.js +1 -1
- package/dist/fn-context/types.d.ts +20 -6
- package/dist/index.d.ts +11 -12
- package/dist/index.js +5 -8
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +8 -0
- package/dist/platform.d.ts +32 -33
- package/dist/platform.js +23 -22
- package/dist/testing-compile-child.d.ts +2 -0
- package/dist/testing-compile-child.js +20 -0
- package/dist/testing.d.ts +368 -0
- package/dist/testing.js +439 -0
- package/dist/voice-service/actions.d.ts +12 -35
- package/dist/voice-service/index.d.ts +2 -0
- package/dist/voice-service/index.js +2 -0
- package/dist/voice-service/protocol.d.ts +604 -0
- package/dist/voice-service/protocol.js +67 -0
- package/dist/voice-service/types.d.ts +16 -6
- package/dist/worker.d.ts +2 -1
- package/dist/worker.js +2 -1
- package/package.json +20 -16
- package/dist/core/case-orchestrator/follow-ups.d.ts +0 -31
- package/dist/core/case-orchestrator/follow-ups.js +0 -103
- package/dist/core/case-orchestrator/tools.d.ts +0 -29
- package/dist/core/case-orchestrator/tools.js +0 -31
- package/dist/core/case-orchestrator/validate.d.ts +0 -11
- package/dist/core/case-orchestrator/validate.js +0 -63
- package/dist/core/functions/define/bind.d.ts +0 -25
- package/dist/core/functions/define/bind.js +0 -14
- package/dist/core/functions/define/case.d.ts +0 -9
- package/dist/core/functions/define/case.js +0 -13
- package/dist/core/functions/define/events.d.ts +0 -20
- package/dist/core/functions/define/events.js +0 -21
- package/dist/core/functions/define/no-case.d.ts +0 -4
- package/dist/core/functions/define/no-case.js +0 -9
- package/dist/core/functions/func-ref.d.ts +0 -25
- package/dist/core/functions/func-ref.js +0 -20
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import type { CompiledSlotSchema, RuntimeFieldDef } from '../slot/types.js';
|
|
2
|
+
import { type ActionParameters, type PageToolName } from './define.js';
|
|
2
3
|
import type { ChannelAction, PageAction, PageChannel, SlotRef, SlotState } from './define.js';
|
|
4
|
+
import { type Spoken } from '../conversation/index.js';
|
|
3
5
|
/**
|
|
4
|
-
* `table
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* `table:` and the last 12 hex digits of the row's uuid (33): what the row is called in logs, the
|
|
7
|
+
* timeline and the database too, so the same in every conversation and every process; nothing to keep.
|
|
8
|
+
* A name comes from the id alone, never from which row came first: two rows of a table alike in those
|
|
9
|
+
* digits (one page of n rows: about n² / 2⁴⁹) are both named by their whole id from then on, and the
|
|
10
|
+
* short name they share resolves to neither. So a name from an earlier conversation, or another
|
|
11
|
+
* process, means the row it meant or no row (the AI is told), never another row. A name resolves only
|
|
12
|
+
* to a row named here, and the AI's names are checked against the page's own (`one-of`, `enum`) first.
|
|
7
13
|
*/
|
|
8
14
|
export declare class RowNames {
|
|
9
|
-
|
|
10
|
-
private readonly
|
|
11
|
-
|
|
15
|
+
/** The rows named here: id → table. */
|
|
16
|
+
private readonly tables;
|
|
17
|
+
/** A short name → the ids of its table ending in its digits. */
|
|
18
|
+
private readonly byShort;
|
|
12
19
|
name(table: string, id: string): string;
|
|
13
20
|
resolve(name: string): {
|
|
14
21
|
table: string;
|
|
15
22
|
id: string;
|
|
16
23
|
} | undefined;
|
|
17
24
|
nameOf(id: string): string | undefined;
|
|
18
|
-
toJSON(): Array<[string, string, string]>;
|
|
19
|
-
static fromJSON(entries: Array<[string, string, string]>): RowNames;
|
|
20
25
|
}
|
|
21
26
|
export type ReadSlot = {
|
|
22
27
|
value: unknown;
|
|
@@ -67,8 +72,10 @@ export type PageNode = BlockNode
|
|
|
67
72
|
export type RenderedCell = {
|
|
68
73
|
slotId: string;
|
|
69
74
|
ref: SlotRef;
|
|
70
|
-
/** The row's page name, `table
|
|
75
|
+
/** The row's page name, `table:<uuid tail>`. */
|
|
71
76
|
row: string;
|
|
77
|
+
/** A ref's value, by its row's name (33). */
|
|
78
|
+
valueRow?: string;
|
|
72
79
|
label: string;
|
|
73
80
|
description?: string;
|
|
74
81
|
/** The schema's; the page's `$extraction` for its `table.field` replaces it (`RenderedPage.extractions`). */
|
|
@@ -155,42 +162,53 @@ export type RenderedAction = {
|
|
|
155
162
|
parentId: string | null;
|
|
156
163
|
set: Record<string, unknown>;
|
|
157
164
|
fields: string[];
|
|
158
|
-
required: string[];
|
|
165
|
+
required: string[]; /** The run key, when the page named one. */
|
|
166
|
+
key?: string;
|
|
159
167
|
} | {
|
|
160
168
|
kind: 'deleteRow';
|
|
161
169
|
table: string;
|
|
162
170
|
rowId: string;
|
|
163
|
-
reason?: string;
|
|
171
|
+
reason?: string; /** The run key, when the page named one. */
|
|
172
|
+
key?: string;
|
|
164
173
|
} | {
|
|
165
174
|
kind: 'custom';
|
|
166
175
|
name: string;
|
|
167
|
-
prefill: Record<string, unknown>;
|
|
176
|
+
prefill: Record<string, unknown>; /** The run key, when the page named one. */
|
|
177
|
+
key?: string;
|
|
168
178
|
} | {
|
|
169
179
|
kind: 'channel';
|
|
170
180
|
spec: ChannelAction;
|
|
171
181
|
}
|
|
172
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* Book the case's next step (40 §2.2) on one of `channels`; `prefill`: what the page fixed (the
|
|
184
|
+
* channel, the contact's id), not asked of the AI.
|
|
185
|
+
*/
|
|
173
186
|
| {
|
|
174
|
-
kind: '
|
|
175
|
-
channel: 'sms' | 'email';
|
|
187
|
+
kind: 'followUp';
|
|
176
188
|
key: string;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
189
|
+
channels: Array<'call' | 'sms' | 'email'>;
|
|
190
|
+
prefill: {
|
|
191
|
+
channel?: 'call' | 'sms' | 'email';
|
|
192
|
+
contactId?: string;
|
|
193
|
+
};
|
|
181
194
|
}
|
|
182
|
-
/**
|
|
195
|
+
/** Cancel the case's next step (40 §2.2), with why. */
|
|
183
196
|
| {
|
|
184
|
-
kind: '
|
|
197
|
+
kind: 'cancelFollowUp';
|
|
185
198
|
key: string;
|
|
186
|
-
|
|
199
|
+
}
|
|
200
|
+
/** A platform tool (76 §2.18): the platform runs it, the AI reads the result next turn. */
|
|
201
|
+
| {
|
|
202
|
+
kind: 'tool';
|
|
203
|
+
tool: PageToolName;
|
|
187
204
|
}
|
|
188
205
|
/** A company function (20 §6.2): run on the Worker by the platform, waited for, with the page's prefilled arguments. */
|
|
189
206
|
| {
|
|
190
207
|
kind: 'function';
|
|
191
|
-
name: string;
|
|
192
|
-
say?:
|
|
193
|
-
prefill?: Record<string, unknown>;
|
|
208
|
+
name: string; /** Per language (66): the engine says the call's. */
|
|
209
|
+
say?: Spoken;
|
|
210
|
+
prefill?: Record<string, unknown>; /** The run key, when the page named one. */
|
|
211
|
+
key?: string;
|
|
194
212
|
};
|
|
195
213
|
};
|
|
196
214
|
/**
|
|
@@ -224,6 +242,8 @@ export type RenderedPage = {
|
|
|
224
242
|
}>;
|
|
225
243
|
/** The page's `$extraction` (26 §15.3): how to fill a field on this page, by `table.field`; replaces the schema's. */
|
|
226
244
|
extractions?: Record<string, string>;
|
|
245
|
+
/** The voice the page asks for (`page({ voice })`, 76). */
|
|
246
|
+
voice?: unknown;
|
|
227
247
|
warnings: string[];
|
|
228
248
|
};
|
|
229
249
|
export declare class PageDocumentError extends Error {
|
|
@@ -236,8 +256,30 @@ export type RenderDocumentInput = {
|
|
|
236
256
|
names: RowNames;
|
|
237
257
|
/** The conversation's channel: a button the channel cannot do (a transfer by text) is an error (20 §5.2). */
|
|
238
258
|
channel?: PageChannel;
|
|
259
|
+
/** The sequence's functions' parameters, from their `args` types (38 §2.4): a function button's. */
|
|
260
|
+
functions?: Readonly<Record<string, {
|
|
261
|
+
parameters?: ActionParameters;
|
|
262
|
+
}>>;
|
|
263
|
+
/** The page's actions' parameters, from their `args` types (38 §2.9): a page action button's. */
|
|
264
|
+
actions?: Readonly<Record<string, {
|
|
265
|
+
parameters?: ActionParameters;
|
|
266
|
+
}>>;
|
|
239
267
|
};
|
|
240
268
|
export declare function renderDocument(input: RenderDocumentInput): RenderedPage;
|
|
269
|
+
/**
|
|
270
|
+
* The buttons' ids (46 §2.1), in page order: what each does (its run key's words: a function's name,
|
|
271
|
+
* `add:injury`, `remove`, `transfer`, …); where several on the page do the same, the rows that tell them
|
|
272
|
+
* apart, by page name (`voidInjury@injury:3f9a2c1d7e04`); where that still leaves two alike, `#2`, `#3`
|
|
273
|
+
* after the first. Unique on the page, and the same from one render to the next while the button does
|
|
274
|
+
* the same thing to the same rows.
|
|
275
|
+
*/
|
|
276
|
+
export declare function buttonIds(buttons: readonly RenderedAction[], rows: RenderedPage['rows']): string[];
|
|
277
|
+
/**
|
|
278
|
+
* The button the AI means by `id` on this page (46 §2.1), or null. Its own id first; else an id it read
|
|
279
|
+
* on an earlier page, where alike buttons needed their rows (`bookSlot@slot_option:d12f648904ec`) and now
|
|
280
|
+
* one is left (`bookSlot`): the one button doing that to those rows. Never a guess among several.
|
|
281
|
+
*/
|
|
282
|
+
export declare function pressedButton(page: RenderedPage, id: string): string | null;
|
|
241
283
|
/**
|
|
242
284
|
* The run key of a button on the page (17b §7): the action's own key, whoever runs it — the model
|
|
243
285
|
* pressing it, or the page function returning it — not its place on the page, which moves with rows.
|