@superpanel-sdk/runtime 0.2.3 → 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 +30 -10
- package/dist/builder/codegen/emit.d.ts +25 -12
- package/dist/builder/codegen/emit.js +339 -78
- package/dist/builder/codegen/generate.d.ts +21 -2
- package/dist/builder/codegen/generate.js +147 -34
- package/dist/builder/company-import-graph.d.ts +2 -0
- package/dist/builder/company-import-graph.js +40 -8
- package/dist/builder/company-imports.d.ts +29 -0
- package/dist/builder/company-imports.js +122 -0
- package/dist/builder/compile/compile-sequence.d.ts +61 -8
- package/dist/builder/compile/compile-sequence.js +334 -80
- package/dist/builder/compile/function-code.d.ts +19 -3
- package/dist/builder/compile/function-code.js +123 -45
- package/dist/builder/compile/registry.d.ts +7 -3
- package/dist/builder/compile/registry.js +30 -27
- 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 +70 -10
- package/dist/builder/load.js +258 -67
- package/dist/builder/paths.d.ts +9 -1
- package/dist/builder/paths.js +32 -2
- package/dist/builder/schedules.d.ts +25 -0
- package/dist/builder/schedules.js +101 -0
- package/dist/builder/slot-schema-validation.d.ts +4 -0
- package/dist/builder/slot-schema-validation.js +10 -0
- package/dist/builder/typecheck.d.ts +8 -0
- package/dist/builder/typecheck.js +102 -0
- package/dist/builder/types.d.ts +127 -19
- package/dist/builder/types.js +21 -1
- package/dist/cli/auth/auth.d.ts +37 -0
- package/dist/cli/auth/auth.js +211 -0
- package/dist/cli/auth/backend-url.d.ts +5 -0
- package/dist/cli/auth/backend-url.js +25 -0
- package/dist/cli/auth/clipboard.d.ts +9 -0
- package/dist/cli/auth/clipboard.js +38 -0
- package/dist/cli/auth/http.d.ts +20 -0
- package/dist/cli/auth/http.js +27 -0
- package/dist/cli/auth/index.d.ts +10 -0
- package/dist/cli/auth/index.js +27 -0
- package/dist/cli/auth/progress.d.ts +12 -0
- package/dist/cli/auth/progress.js +15 -0
- package/dist/cli/auth/serve-login.d.ts +8 -0
- package/dist/cli/auth/serve-login.js +24 -0
- package/dist/cli/calls/index.d.ts +177 -0
- package/dist/cli/calls/index.js +96 -0
- package/dist/cli/compile/index.js +3 -0
- package/dist/cli/config.d.ts +10 -0
- package/dist/cli/config.js +52 -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 +112 -9
- 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 +109 -3
- package/dist/cli/serve/index.js +506 -118
- 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 +9 -9
- package/dist/compiler.d.ts +7 -0
- package/dist/compiler.js +7 -0
- package/dist/compute-host/compute-host.d.ts +14 -23
- package/dist/compute-host/compute-host.js +18 -30
- package/dist/compute-host/index.d.ts +2 -4
- package/dist/compute-host/index.js +1 -2
- package/dist/compute-host/source-compute-host.d.ts +10 -10
- package/dist/compute-host/source-compute-host.js +33 -40
- package/dist/core/case-orchestrator/contact-hours.d.ts +70 -0
- package/dist/core/case-orchestrator/contact-hours.js +127 -0
- package/dist/core/case-orchestrator/index.d.ts +3 -0
- package/dist/core/case-orchestrator/index.js +3 -0
- package/dist/core/case-orchestrator/render.d.ts +75 -0
- package/dist/core/case-orchestrator/render.js +244 -0
- package/dist/core/case-orchestrator/time.d.ts +11 -0
- package/dist/core/case-orchestrator/time.js +29 -0
- package/dist/core/case-orchestrator/types.d.ts +708 -0
- package/dist/core/case-orchestrator/types.js +42 -0
- package/dist/core/context/call.d.ts +291 -0
- package/dist/core/context/call.js +94 -0
- package/dist/core/context/channels.d.ts +60 -0
- package/dist/core/context/channels.js +35 -0
- package/dist/core/context/contact.d.ts +96 -6
- package/dist/core/context/contact.js +48 -2
- package/dist/core/context/email-message.d.ts +198 -0
- package/dist/core/context/email-message.js +86 -0
- package/dist/core/context/email.d.ts +109 -0
- package/dist/core/context/email.js +90 -0
- package/dist/core/context/exchanges.d.ts +167 -0
- package/dist/core/context/exchanges.js +81 -0
- package/dist/core/context/instances.d.ts +307 -0
- package/dist/core/context/instances.js +137 -0
- package/dist/core/context/kv.d.ts +113 -0
- package/dist/core/context/kv.js +60 -0
- package/dist/core/context/platform-registry.d.ts +544 -4
- package/dist/core/context/platform-registry.js +14 -2
- package/dist/core/context/platform.d.ts +2 -1
- package/dist/core/context/sms.d.ts +177 -0
- package/dist/core/context/sms.js +77 -0
- package/dist/core/context/types.d.ts +79 -48
- package/dist/core/context/types.js +1 -7
- package/dist/core/conversation/index.d.ts +85 -0
- package/dist/core/conversation/index.js +133 -0
- package/dist/core/functions/errors.d.ts +74 -0
- package/dist/core/functions/errors.js +26 -0
- package/dist/core/functions/events.d.ts +192 -0
- package/dist/core/functions/events.js +23 -0
- package/dist/core/functions/schedules.d.ts +50 -0
- package/dist/core/functions/schedules.js +20 -0
- package/dist/core/functions/types.d.ts +29 -73
- package/dist/core/functions/types.js +1 -4
- package/dist/core/office-hours/index.d.ts +39 -0
- package/dist/core/office-hours/index.js +187 -0
- package/dist/core/page/define.d.ts +904 -0
- package/dist/core/page/define.js +518 -0
- 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/ops.d.ts +58 -0
- package/dist/core/page/ops.js +220 -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 +295 -0
- package/dist/core/page/render.js +1060 -0
- 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 +46 -0
- package/dist/core/page/time-format.js +125 -0
- package/dist/core/page/timeline.d.ts +40 -0
- package/dist/core/page/timeline.js +2 -0
- package/dist/core/page/typed.d.ts +648 -0
- package/dist/core/page/typed.js +2 -0
- package/dist/core/page/workspace.d.ts +57 -0
- package/dist/core/page/workspace.js +266 -0
- package/dist/core/party/index.d.ts +3 -0
- package/dist/core/party/index.js +3 -0
- package/dist/core/party/schema.d.ts +208 -0
- package/dist/core/party/schema.js +113 -0
- package/dist/core/party/types.d.ts +35 -0
- package/dist/core/party/types.js +15 -0
- package/dist/core/sequence/define.d.ts +56 -0
- package/dist/core/sequence/define.js +10 -0
- package/dist/core/sequence/index.d.ts +63 -0
- package/dist/core/sequence/index.js +231 -0
- package/dist/core/slot/binding.d.ts +40 -0
- package/dist/core/slot/binding.js +2 -0
- package/dist/core/slot/company-metadata.d.ts +102 -0
- package/dist/core/slot/company-metadata.js +536 -0
- package/dist/core/slot/compile-schema.d.ts +19 -13
- package/dist/core/slot/compile-schema.js +51 -248
- package/dist/core/slot/contact-timezone.d.ts +110 -0
- package/dist/core/slot/contact-timezone.js +186 -0
- package/dist/core/slot/field.d.ts +2 -25
- package/dist/core/slot/field.js +0 -71
- package/dist/core/slot/id-ref.d.ts +17 -2
- package/dist/core/slot/id-ref.js +16 -8
- package/dist/core/slot/index.d.ts +12 -13
- package/dist/core/slot/index.js +11 -12
- package/dist/core/slot/naming.d.ts +15 -0
- package/dist/core/slot/naming.js +96 -0
- package/dist/core/slot/platform-fields.d.ts +119 -0
- package/dist/core/slot/platform-fields.js +121 -0
- package/dist/core/slot/ref.d.ts +16 -0
- package/dist/core/slot/ref.js +14 -0
- package/dist/core/slot/row.d.ts +2 -9
- package/dist/core/slot/row.js +13 -23
- package/dist/core/slot/schema-compat.d.ts +17 -0
- package/dist/core/slot/schema-compat.js +103 -0
- package/dist/core/slot/schema.d.ts +353 -76
- package/dist/core/slot/schema.js +163 -10
- package/dist/core/slot/types.d.ts +30 -103
- package/dist/core/slot/value.d.ts +28 -3
- package/dist/core/slot/value.js +93 -57
- package/dist/dev-overlay/protocol.d.ts +74 -8
- package/dist/fn-context/build-context.d.ts +3 -1
- package/dist/fn-context/build-context.js +26 -10
- package/dist/fn-context/fake/empty-api.js +9 -28
- package/dist/fn-context/fake/index.d.ts +13 -4
- package/dist/fn-context/fake/index.js +29 -2
- package/dist/fn-context/fn-params.d.ts +3 -0
- package/dist/fn-context/fn-params.js +10 -0
- package/dist/fn-context/index.d.ts +5 -5
- package/dist/fn-context/index.js +4 -4
- package/dist/fn-context/log.js +2 -2
- package/dist/fn-context/make-ctx.d.ts +11 -0
- package/dist/fn-context/make-ctx.js +20 -9
- package/dist/fn-context/rpc/case-orchestrator-tools.d.ts +32 -0
- package/dist/fn-context/rpc/case-orchestrator-tools.js +12 -0
- 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 +4 -2
- package/dist/fn-context/rpc/index.js +4 -2
- package/dist/fn-context/rpc/integration/index.d.ts +15 -5
- package/dist/fn-context/rpc/integration/index.js +1 -1
- package/dist/fn-context/rpc/integration/list-surfaces.d.ts +21 -0
- package/dist/fn-context/rpc/integration/{list-bindings.js → list-surfaces.js} +4 -4
- package/dist/fn-context/rpc/log.d.ts +11 -1
- package/dist/fn-context/rpc/platform.d.ts +13 -3
- package/dist/fn-context/rpc/platform.js +1 -1
- package/dist/fn-context/rpc/records.d.ts +85 -0
- package/dist/fn-context/rpc/records.js +24 -0
- package/dist/fn-context/rpc/trpc-client.d.ts +44 -2
- package/dist/fn-context/rpc/trpc-client.js +222 -12
- package/dist/fn-context/rpc/trpc-init.d.ts +21 -3
- package/dist/fn-context/rpc/trpc-init.js +10 -4
- package/dist/fn-context/rpc/trpc-router-factory.d.ts +111 -7
- package/dist/fn-context/rpc/trpc-router-factory.js +2 -0
- package/dist/fn-context/run-scope.d.ts +4 -0
- package/dist/fn-context/run-scope.js +9 -0
- package/dist/fn-context/types.d.ts +52 -5
- package/dist/index.d.ts +36 -46
- package/dist/index.js +30 -33
- package/dist/logger.d.ts +11 -0
- package/dist/logger.js +49 -0
- package/dist/platform.d.ts +75 -0
- package/dist/platform.js +57 -0
- 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 +50 -6
- 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 +55 -8
- package/dist/worker.d.ts +11 -0
- package/dist/worker.js +11 -0
- package/package.json +38 -15
- package/dist/builder/compile/compile-agenda.d.ts +0 -15
- package/dist/builder/compile/compile-agenda.js +0 -64
- package/dist/builder/merge.d.ts +0 -4
- package/dist/builder/merge.js +0 -19
- package/dist/compute-host/read-only-cache.d.ts +0 -20
- package/dist/compute-host/read-only-cache.js +0 -61
- package/dist/core/context/db.d.ts +0 -69
- package/dist/core/context/db.js +0 -44
- package/dist/core/context/docusign.d.ts +0 -134
- package/dist/core/context/docusign.js +0 -108
- package/dist/core/context/filevine.d.ts +0 -323
- package/dist/core/context/filevine.js +0 -254
- package/dist/core/context/http.d.ts +0 -9
- package/dist/core/context/http.js +0 -4
- package/dist/core/context/hubspot.d.ts +0 -250
- package/dist/core/context/hubspot.js +0 -191
- package/dist/core/context/twilio.d.ts +0 -50
- package/dist/core/context/twilio.js +0 -42
- package/dist/core/functions/define/case-context.d.ts +0 -14
- package/dist/core/functions/define/case-context.js +0 -15
- package/dist/core/functions/define/compute.d.ts +0 -7
- package/dist/core/functions/define/compute.js +0 -17
- package/dist/core/functions/define/custom.d.ts +0 -4
- package/dist/core/functions/define/custom.js +0 -8
- package/dist/core/functions/define/system.d.ts +0 -7
- package/dist/core/functions/define/system.js +0 -12
- package/dist/core/functions/func-ref.d.ts +0 -16
- package/dist/core/functions/func-ref.js +0 -20
- package/dist/core/slot/deps.d.ts +0 -15
- package/dist/core/slot/deps.js +0 -88
- package/dist/core/slot/derived.d.ts +0 -32
- package/dist/core/slot/derived.js +0 -115
- package/dist/core/slot/platform-session-fields.d.ts +0 -38
- package/dist/core/slot/platform-session-fields.js +0 -48
- package/dist/core/slot/sf-schema.d.ts +0 -23
- package/dist/core/slot/sf-schema.js +0 -125
- package/dist/core/slot/sf-validate.d.ts +0 -14
- package/dist/core/slot/sf-validate.js +0 -132
- package/dist/core/slot/snapshot.d.ts +0 -18
- package/dist/core/slot/snapshot.js +0 -138
- package/dist/core/slot/write.d.ts +0 -48
- package/dist/core/slot/write.js +0 -426
- package/dist/core/stage/builders.d.ts +0 -54
- package/dist/core/stage/builders.js +0 -31
- package/dist/core/stage/condition.d.ts +0 -17
- package/dist/core/stage/condition.js +0 -198
- package/dist/core/stage/drive.d.ts +0 -43
- package/dist/core/stage/drive.js +0 -78
- package/dist/core/stage/finish-when.d.ts +0 -20
- package/dist/core/stage/finish-when.js +0 -82
- package/dist/core/stage/flatten.d.ts +0 -27
- package/dist/core/stage/flatten.js +0 -466
- package/dist/core/stage/index.d.ts +0 -15
- package/dist/core/stage/index.js +0 -13
- package/dist/core/stage/interrupts.d.ts +0 -28
- package/dist/core/stage/interrupts.js +0 -120
- package/dist/core/stage/ivr-fields.d.ts +0 -9
- package/dist/core/stage/ivr-fields.js +0 -75
- package/dist/core/stage/simulate.d.ts +0 -24
- package/dist/core/stage/simulate.js +0 -33
- package/dist/core/stage/transfer-fields.d.ts +0 -19
- package/dist/core/stage/transfer-fields.js +0 -129
- package/dist/core/stage/transfer-spec.d.ts +0 -48
- package/dist/core/stage/transfer-spec.js +0 -113
- package/dist/core/stage/types.d.ts +0 -208
- package/dist/core/stage/types.js +0 -2
- package/dist/core/stage/validate.d.ts +0 -11
- package/dist/core/stage/validate.js +0 -330
- package/dist/core/stage/walk.d.ts +0 -39
- package/dist/core/stage/walk.js +0 -119
- package/dist/fn-context/rpc/integration/list-bindings.d.ts +0 -21
- package/dist/fn-context/system-args.d.ts +0 -6
- package/dist/fn-context/system-args.js +0 -14
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `superpanel-sdk-runtime mobile` (68 §5.4): a test customer's phone in the terminal. This repository's code
|
|
3
|
+
* serves the environment (as `connect()` does); you are the customer: call a line and talk in text, text it,
|
|
4
|
+
* email it, and get what the environment sends you on its own (its texts, its emails, its calls ringing),
|
|
5
|
+
* answered or let ring. Plain lines are what you say on the call you are on, else a text to the line.
|
|
6
|
+
* Commands start with `/` (`/help`). Lines piped in run one after another, so a script or an agent can
|
|
7
|
+
* drive it: `printf '/call\nHi, this is Carl\n/hangup\n' | npm run mobile`.
|
|
8
|
+
*/
|
|
9
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { createInterface } from 'node:readline';
|
|
12
|
+
import { connect } from '../../testing.js';
|
|
13
|
+
import { formatTurnLine } from '../turns/index.js';
|
|
14
|
+
const HELP = `What you type:
|
|
15
|
+
<text> say it on the call you are on; else text it to the line
|
|
16
|
+
/call [line] call a line (the line you text when left out)
|
|
17
|
+
/sms <text> text the line, on a call or not
|
|
18
|
+
/burst <a> | <b> | … several texts in a row, batched as a carrier's are (one run after 15 s quiet)
|
|
19
|
+
/email <subject> | <body> email the mailbox (a new thread)
|
|
20
|
+
/reply <body> answer the last email you got, in its thread
|
|
21
|
+
/answer [voicemail|screening|ivr] pick up the call ringing you (a person when left out)
|
|
22
|
+
/decline [busy] let it ring (no-answer), or be busy
|
|
23
|
+
/press <keys> press keys for the keypad the call asked for
|
|
24
|
+
/transfer answered|failed the transfer the call asked for: taken, or not
|
|
25
|
+
/hangup hang up
|
|
26
|
+
/wait sms|email|call [s] wait for the environment to send you one (60 s when left out)
|
|
27
|
+
/due do your case's next scheduled step now (a call or text booked for a later day)
|
|
28
|
+
/inbox everything sent to you since you started
|
|
29
|
+
/turns your case's turns: what was heard, said, pressed and written
|
|
30
|
+
/line <name>, /mailbox <name> where calls, texts and emails go
|
|
31
|
+
/whoami your number, address, line, mailbox and case
|
|
32
|
+
/help, /quit`;
|
|
33
|
+
const tty = process.stdout.isTTY === true;
|
|
34
|
+
const paint = (code) => (text) => (tty ? `\x1b[${code}m${text}\x1b[0m` : text);
|
|
35
|
+
const ai = paint('36');
|
|
36
|
+
const dim = paint('2');
|
|
37
|
+
const alert = paint('33');
|
|
38
|
+
const bad = paint('31');
|
|
39
|
+
/** The test customer this repository last used for an environment, kept in .superpanel/mobile/. */
|
|
40
|
+
function identity(repoRoot, environmentId, fresh, make) {
|
|
41
|
+
const file = path.join(repoRoot, '.superpanel', 'mobile', `${environmentId}.json`);
|
|
42
|
+
if (!fresh) {
|
|
43
|
+
try {
|
|
44
|
+
const kept = JSON.parse(readFileSync(file, 'utf8'));
|
|
45
|
+
if (typeof kept.phone === 'string' && typeof kept.email === 'string')
|
|
46
|
+
return { phone: kept.phone, email: kept.email };
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// none yet
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const made = make();
|
|
53
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
54
|
+
writeFileSync(file, `${JSON.stringify(made, null, 2)}\n`);
|
|
55
|
+
return made;
|
|
56
|
+
}
|
|
57
|
+
export async function runMobile(repoRoot, options) {
|
|
58
|
+
const out = (line) => print(line);
|
|
59
|
+
out(dim(`connecting to ${options.env ?? 'sandbox'}: this repository's code serves it while the phone is on…`));
|
|
60
|
+
const sandbox = await connect({ env: options.env ?? 'sandbox', repoRoot, ...(options.url ? { url: options.url } : {}) });
|
|
61
|
+
const probe = sandbox.sim.customer();
|
|
62
|
+
const me = identity(repoRoot, sandbox.environment.id, options.new === true, () => ({ phone: probe.phone, email: probe.email }));
|
|
63
|
+
const customer = sandbox.sim.customer(me);
|
|
64
|
+
const state = {
|
|
65
|
+
line: options.line ?? 'Main line',
|
|
66
|
+
mailbox: options.mailbox ?? 'Support',
|
|
67
|
+
call: null,
|
|
68
|
+
ringing: [],
|
|
69
|
+
lastEmail: null,
|
|
70
|
+
/** Your cases, the latest last: your number and your address may be different contacts, each with its own. */
|
|
71
|
+
cases: [],
|
|
72
|
+
};
|
|
73
|
+
const since = new Date(Date.now() - 1_000).toISOString();
|
|
74
|
+
const seen = new Set();
|
|
75
|
+
const arrived = [];
|
|
76
|
+
const waiters = [];
|
|
77
|
+
// ── Output while you type ──────────────────────────────────────────────────────────────────────
|
|
78
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout, terminal: tty });
|
|
79
|
+
rl.setPrompt(tty ? '📱 ' : '');
|
|
80
|
+
function print(line) {
|
|
81
|
+
if (tty)
|
|
82
|
+
process.stdout.write('\r\x1b[K');
|
|
83
|
+
process.stdout.write(`${line}\n`);
|
|
84
|
+
if (tty && rl)
|
|
85
|
+
rl.prompt(true);
|
|
86
|
+
}
|
|
87
|
+
const showItem = (item) => {
|
|
88
|
+
if (item.kind === 'sms')
|
|
89
|
+
out(`${alert('💬 text')} from ${item.line ?? item.from}: ${item.body}`);
|
|
90
|
+
if (item.kind === 'email') {
|
|
91
|
+
out(`${alert('✉ email')} from ${item.mailbox ?? item.from}: ${item.subject}`);
|
|
92
|
+
for (const line of item.body.split('\n'))
|
|
93
|
+
out(` ${line}`);
|
|
94
|
+
out(dim(' (/reply <body> to answer)'));
|
|
95
|
+
}
|
|
96
|
+
if (item.kind === 'call')
|
|
97
|
+
out(`${alert('📞 ringing')} from ${item.line ?? item.from} ${dim('(/answer or /decline)')}`);
|
|
98
|
+
};
|
|
99
|
+
const take = (item, show) => {
|
|
100
|
+
if (seen.has(item.id))
|
|
101
|
+
return;
|
|
102
|
+
seen.add(item.id);
|
|
103
|
+
if (item.kind === 'call')
|
|
104
|
+
state.ringing.push(item);
|
|
105
|
+
if (item.kind === 'email')
|
|
106
|
+
state.lastEmail = item;
|
|
107
|
+
if (show)
|
|
108
|
+
showItem(item);
|
|
109
|
+
const waiter = waiters.findIndex((w) => w.kind === item.kind);
|
|
110
|
+
if (waiter >= 0)
|
|
111
|
+
waiters.splice(waiter, 1)[0].resolve(item);
|
|
112
|
+
else
|
|
113
|
+
arrived.push(item);
|
|
114
|
+
};
|
|
115
|
+
const showTurns = (turns) => {
|
|
116
|
+
for (const turn of turns) {
|
|
117
|
+
if (turn.instanceId)
|
|
118
|
+
state.cases = [...state.cases.filter((id) => id !== turn.instanceId), turn.instanceId];
|
|
119
|
+
for (const thought of turn.thoughts ?? [])
|
|
120
|
+
out(dim(` (thought) ${thought}`));
|
|
121
|
+
for (const action of turn.actions)
|
|
122
|
+
out(dim(` ${action.key}: ${action.status}${action.error ? ` (${action.error})` : ''}`));
|
|
123
|
+
for (const write of turn.writes)
|
|
124
|
+
out(dim(` wrote ${write.table}.${write.field} = ${JSON.stringify(write.value)}${write.state && write.state !== 'filled' ? ` (${write.state})` : ''}`));
|
|
125
|
+
if (turn.error)
|
|
126
|
+
out(bad(` ${turn.error}`));
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const showOrchestrator = (orchestrator) => {
|
|
130
|
+
if (!orchestrator)
|
|
131
|
+
return;
|
|
132
|
+
const booked = orchestrator.scheduled.map((a) => {
|
|
133
|
+
const action = a;
|
|
134
|
+
return `${action.kind ?? 'step'} at ${action.scheduledFor ?? '?'}${action.reason ? ` (${action.reason})` : ''}`;
|
|
135
|
+
});
|
|
136
|
+
out(dim(` Orchestrator: ${orchestrator.status}${booked.length ? `; booked ${booked.join('; ')}` : ''}${orchestrator.cancelled.length ? `; cancelled ${orchestrator.cancelled.length}` : ''}`));
|
|
137
|
+
};
|
|
138
|
+
const showStep = (step) => {
|
|
139
|
+
for (const said of step.said)
|
|
140
|
+
out(`${ai('AI:')} ${said}`);
|
|
141
|
+
for (const event of step.events) {
|
|
142
|
+
if (event.kind === 'keypad')
|
|
143
|
+
out(alert(` ⌨ keypad ${event.key}: "${event.say}" (${event.digits.join(', ')}) — /press <keys>`));
|
|
144
|
+
else if (event.kind === 'transfer')
|
|
145
|
+
out(alert(` ↪ transfer to ${event.to} (${event.mode}) — /transfer answered|failed`));
|
|
146
|
+
else if (event.kind === 'voicemail')
|
|
147
|
+
out(alert(` 📼 voicemail left: "${event.text}"`));
|
|
148
|
+
else if (event.kind === 'language')
|
|
149
|
+
out(dim(` language: ${event.language}`));
|
|
150
|
+
else if (event.kind === 'far_end')
|
|
151
|
+
out(dim(` who answered (${event.farEnd}): ${event.decision}`));
|
|
152
|
+
}
|
|
153
|
+
showTurns(step.turns);
|
|
154
|
+
if (step.ended) {
|
|
155
|
+
out(alert(`📴 call ended (${step.ended.by})`));
|
|
156
|
+
showOrchestrator(step.ended.orchestrator);
|
|
157
|
+
state.call = null;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const showSent = (result) => {
|
|
161
|
+
showTurns(result.turns);
|
|
162
|
+
for (const reply of result.replies)
|
|
163
|
+
take(reply, true);
|
|
164
|
+
if (!result.replies.length)
|
|
165
|
+
out(dim(' (no reply)'));
|
|
166
|
+
showOrchestrator(result.orchestrator);
|
|
167
|
+
};
|
|
168
|
+
// ── What the environment sends you, as it comes ────────────────────────────────────────────────
|
|
169
|
+
let polling = true;
|
|
170
|
+
const poll = async () => {
|
|
171
|
+
while (polling) {
|
|
172
|
+
try {
|
|
173
|
+
for (const item of await customer.inbox(since))
|
|
174
|
+
take(item, true);
|
|
175
|
+
// A call that stopped ringing (answered elsewhere, or ended) is no longer to answer.
|
|
176
|
+
const ringingNow = new Set((await customer.inbox(since)).filter((i) => i.kind === 'call').map((i) => i.id));
|
|
177
|
+
state.ringing = state.ringing.filter((c) => ringingNow.has(c.id));
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
out(bad(`inbox: ${error instanceof Error ? error.message : String(error)}`));
|
|
181
|
+
}
|
|
182
|
+
await new Promise((resolve) => setTimeout(resolve, 2_000));
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const waitFor = (kind, seconds) => new Promise((resolve) => {
|
|
186
|
+
const ready = arrived.findIndex((item) => item.kind === kind);
|
|
187
|
+
if (ready >= 0)
|
|
188
|
+
return resolve(arrived.splice(ready, 1)[0]);
|
|
189
|
+
const waiter = { kind, resolve: (item) => (clearTimeout(timer), resolve(item)) };
|
|
190
|
+
const timer = setTimeout(() => {
|
|
191
|
+
waiters.splice(waiters.indexOf(waiter), 1);
|
|
192
|
+
resolve(null);
|
|
193
|
+
}, seconds * 1_000);
|
|
194
|
+
waiters.push(waiter);
|
|
195
|
+
});
|
|
196
|
+
/** Your open cases, the latest first: the ones you talked on here, else the ones your number and address have. */
|
|
197
|
+
const caseIds = async () => {
|
|
198
|
+
if (!state.cases.length) {
|
|
199
|
+
for (const lookup of [{ phone: me.phone }, { email: me.email }]) {
|
|
200
|
+
const { contacts } = await sandbox.ctx.api.contact.find(lookup);
|
|
201
|
+
for (const contact of contacts) {
|
|
202
|
+
const { instances } = await sandbox.ctx.api.instances.findForContact({ contactId: contact.id, activeOnly: true });
|
|
203
|
+
for (const instance of instances)
|
|
204
|
+
if (!state.cases.includes(instance.id))
|
|
205
|
+
state.cases.push(instance.id);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return [...state.cases].reverse();
|
|
210
|
+
};
|
|
211
|
+
const onCall = () => {
|
|
212
|
+
if (!state.call)
|
|
213
|
+
throw new Error('you are not on a call: /call, or /answer one ringing you');
|
|
214
|
+
return state.call;
|
|
215
|
+
};
|
|
216
|
+
const ringingCall = () => {
|
|
217
|
+
const call = state.ringing.shift();
|
|
218
|
+
if (!call)
|
|
219
|
+
throw new Error('nothing is ringing you (/wait call waits for one)');
|
|
220
|
+
return call;
|
|
221
|
+
};
|
|
222
|
+
// ── What you type ─────────────────────────────────────────────────────────────────────────────
|
|
223
|
+
const commands = {
|
|
224
|
+
help: async () => out(HELP),
|
|
225
|
+
whoami: async () => out(`you: ${me.phone}, ${me.email}\nline: ${state.line}; mailbox: ${state.mailbox}\nenvironment: ${sandbox.environment.name}${state.cases.length ? `\ncases: ${state.cases.join(', ')}` : ''}`),
|
|
226
|
+
line: async (rest) => {
|
|
227
|
+
if (!rest)
|
|
228
|
+
throw new Error('/line <name>');
|
|
229
|
+
state.line = rest;
|
|
230
|
+
const line = await sandbox.sim.line(rest);
|
|
231
|
+
out(dim(`line ${line.name}: ${line.number}`));
|
|
232
|
+
},
|
|
233
|
+
mailbox: async (rest) => {
|
|
234
|
+
if (!rest)
|
|
235
|
+
throw new Error('/mailbox <name>');
|
|
236
|
+
state.mailbox = rest;
|
|
237
|
+
const box = await sandbox.sim.mailbox(rest);
|
|
238
|
+
out(dim(`mailbox ${box.name}: ${box.address}`));
|
|
239
|
+
},
|
|
240
|
+
call: async (rest) => {
|
|
241
|
+
if (state.call)
|
|
242
|
+
throw new Error('you are on a call: /hangup first');
|
|
243
|
+
if (rest)
|
|
244
|
+
state.line = rest;
|
|
245
|
+
await sandbox.sim.line(state.line);
|
|
246
|
+
out(dim(`calling ${state.line}…`));
|
|
247
|
+
const call = await sandbox.call.inbound({ from: me.phone, to: state.line });
|
|
248
|
+
state.call = call;
|
|
249
|
+
showStep(call.opening);
|
|
250
|
+
},
|
|
251
|
+
sms: async (rest) => {
|
|
252
|
+
if (!rest)
|
|
253
|
+
throw new Error('/sms <text>');
|
|
254
|
+
await sandbox.sim.line(state.line);
|
|
255
|
+
showSent(await customer.text(rest, { to: state.line, orchestrator: 'now' }));
|
|
256
|
+
},
|
|
257
|
+
burst: async (rest) => {
|
|
258
|
+
const texts = rest.split('|').map((part) => part.trim()).filter(Boolean);
|
|
259
|
+
if (texts.length < 2)
|
|
260
|
+
throw new Error('/burst <text> | <text> | …');
|
|
261
|
+
await sandbox.sim.line(state.line);
|
|
262
|
+
for (const body of texts)
|
|
263
|
+
await customer.text(body, { to: state.line, debounce: 'real' });
|
|
264
|
+
out(dim(`${texts.length} texts sent; the line answers once they stop coming (about 15 s)…`));
|
|
265
|
+
if (!(await waitFor('sms', 90)))
|
|
266
|
+
throw new Error('no reply came within 90 s');
|
|
267
|
+
},
|
|
268
|
+
email: async (rest) => {
|
|
269
|
+
const [subject, ...body] = rest.split('|');
|
|
270
|
+
if (!subject?.trim() || !body.join('|').trim())
|
|
271
|
+
throw new Error('/email <subject> | <body>');
|
|
272
|
+
await sandbox.sim.mailbox(state.mailbox);
|
|
273
|
+
showSent(await customer.sendEmail({ to: state.mailbox, subject: subject.trim(), body: body.join('|').trim(), orchestrator: 'now' }));
|
|
274
|
+
},
|
|
275
|
+
reply: async (rest) => {
|
|
276
|
+
const last = state.lastEmail;
|
|
277
|
+
if (!last)
|
|
278
|
+
throw new Error('no email to answer yet: /email starts a thread');
|
|
279
|
+
if (!rest)
|
|
280
|
+
throw new Error('/reply <body>');
|
|
281
|
+
const subject = /^re:/i.test(last.subject) ? last.subject : `Re: ${last.subject}`;
|
|
282
|
+
showSent(await customer.sendEmail({ to: last.from, subject, body: rest, threadId: last.threadId, orchestrator: 'now' }));
|
|
283
|
+
},
|
|
284
|
+
answer: async (rest) => {
|
|
285
|
+
if (state.call)
|
|
286
|
+
throw new Error('you are on a call: /hangup first');
|
|
287
|
+
const as = (rest || 'human');
|
|
288
|
+
if (!['human', 'voicemail', 'screening', 'ivr'].includes(as))
|
|
289
|
+
throw new Error('/answer [voicemail|screening|ivr]');
|
|
290
|
+
const call = await customer.answer(ringingCall(), { as, orchestrator: 'now' });
|
|
291
|
+
state.call = call.ended ? null : call;
|
|
292
|
+
showStep(call.opening);
|
|
293
|
+
},
|
|
294
|
+
decline: async (rest) => {
|
|
295
|
+
const status = rest === 'busy' ? 'busy' : 'no-answer';
|
|
296
|
+
showStep(await customer.decline(ringingCall(), { status, orchestrator: 'now' }));
|
|
297
|
+
},
|
|
298
|
+
press: async (rest) => {
|
|
299
|
+
if (!rest)
|
|
300
|
+
throw new Error('/press <keys>');
|
|
301
|
+
showStep(await onCall().press(rest));
|
|
302
|
+
},
|
|
303
|
+
transfer: async (rest) => {
|
|
304
|
+
if (rest !== 'answered' && rest !== 'failed')
|
|
305
|
+
throw new Error('/transfer answered|failed');
|
|
306
|
+
showStep(await onCall().transfer(rest));
|
|
307
|
+
},
|
|
308
|
+
hangup: async () => showStep(await onCall().hangup()),
|
|
309
|
+
wait: async (rest) => {
|
|
310
|
+
const [kind, seconds] = rest.split(/\s+/);
|
|
311
|
+
if (kind !== 'sms' && kind !== 'email' && kind !== 'call')
|
|
312
|
+
throw new Error('/wait sms|email|call [seconds]');
|
|
313
|
+
const wait = Number(seconds) > 0 ? Number(seconds) : 60;
|
|
314
|
+
out(dim(`waiting up to ${wait} s for ${kind === 'sms' ? 'a text' : kind === 'call' ? 'a call' : 'an email'}…`));
|
|
315
|
+
if (!(await waitFor(kind, wait)))
|
|
316
|
+
throw new Error(`no ${kind} came within ${wait} s`);
|
|
317
|
+
},
|
|
318
|
+
due: async () => {
|
|
319
|
+
const cases = await caseIds();
|
|
320
|
+
if (!cases.length)
|
|
321
|
+
throw new Error('you have no open case yet: call, text or email first');
|
|
322
|
+
// The latest case with something scheduled: its earliest step.
|
|
323
|
+
for (const instanceId of cases) {
|
|
324
|
+
const due = await sandbox.runDue({ instanceId });
|
|
325
|
+
if (!due.action)
|
|
326
|
+
continue;
|
|
327
|
+
out(dim(`done now: ${due.action.kind}${due.action.reason ? ` (${due.action.reason})` : ''}, booked for ${due.action.scheduledFor}`));
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
out(dim('nothing scheduled on your cases'));
|
|
331
|
+
},
|
|
332
|
+
inbox: async () => {
|
|
333
|
+
const items = await customer.inbox(since);
|
|
334
|
+
if (!items.length)
|
|
335
|
+
out(dim('nothing yet'));
|
|
336
|
+
for (const item of items)
|
|
337
|
+
showItem(item);
|
|
338
|
+
},
|
|
339
|
+
turns: async () => {
|
|
340
|
+
const cases = await caseIds();
|
|
341
|
+
if (!cases.length)
|
|
342
|
+
throw new Error('you have no case yet');
|
|
343
|
+
for (const instanceId of [...cases].reverse()) {
|
|
344
|
+
out(dim(`case ${instanceId}`));
|
|
345
|
+
for (const turn of await sandbox.turns({ instanceId }))
|
|
346
|
+
out(formatTurnLine(turn));
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
};
|
|
350
|
+
out(`📱 ${me.phone} · ${me.email} on ${sandbox.environment.name} — /help for what you can do`);
|
|
351
|
+
void poll();
|
|
352
|
+
if (tty)
|
|
353
|
+
rl.prompt();
|
|
354
|
+
let quitting = false;
|
|
355
|
+
for await (const raw of rl) {
|
|
356
|
+
const line = raw.trim();
|
|
357
|
+
if (!line) {
|
|
358
|
+
if (tty)
|
|
359
|
+
rl.prompt();
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (!tty)
|
|
363
|
+
out(dim(`> ${line}`));
|
|
364
|
+
try {
|
|
365
|
+
if (line.startsWith('/')) {
|
|
366
|
+
const [name = '', ...rest] = line.slice(1).split(' ');
|
|
367
|
+
if (name === 'quit' || name === 'exit') {
|
|
368
|
+
quitting = true;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
const command = commands[name];
|
|
372
|
+
if (!command)
|
|
373
|
+
throw new Error(`/${name}: no such command (/help)`);
|
|
374
|
+
await command(rest.join(' ').trim());
|
|
375
|
+
}
|
|
376
|
+
else if (state.call) {
|
|
377
|
+
showStep(await state.call.say(line));
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
await commands.sms(line);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
out(bad(error instanceof Error ? error.message : String(error)));
|
|
385
|
+
}
|
|
386
|
+
if (tty)
|
|
387
|
+
rl.prompt();
|
|
388
|
+
}
|
|
389
|
+
// Leave nothing open: the call you are on is hung up, so its case moves on.
|
|
390
|
+
if (state.call) {
|
|
391
|
+
try {
|
|
392
|
+
showStep(await state.call.hangup());
|
|
393
|
+
}
|
|
394
|
+
catch {
|
|
395
|
+
// ended meanwhile
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
polling = false;
|
|
399
|
+
rl.close();
|
|
400
|
+
await sandbox.close();
|
|
401
|
+
if (!quitting && !tty)
|
|
402
|
+
out(dim('input ended'));
|
|
403
|
+
process.exit(0);
|
|
404
|
+
}
|
|
405
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,115 @@
|
|
|
1
|
+
import type { AnyEventHandlers } from '../../core/functions/events.js';
|
|
2
|
+
import type { FuncMap } from '../../core/functions/types.js';
|
|
3
|
+
import { type CompanyPart, type RuntimePackageSource, type SequenceBuild, type SourceMaps } from '../../builder/types.js';
|
|
4
|
+
import { type OverlayAuthErrorMessage } from '../../dev-overlay/protocol.js';
|
|
1
5
|
export type ServeOptions = {
|
|
2
6
|
url?: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
environment?: string;
|
|
8
|
+
openBrowser?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type LoadedSequence = {
|
|
11
|
+
build: SequenceBuild;
|
|
12
|
+
/** Its code's maps by `functionKey` (the page script's: the backend runs the page this compiled). */
|
|
13
|
+
sourceMaps: SourceMaps;
|
|
14
|
+
functions: FuncMap;
|
|
15
|
+
events: AnyEventHandlers;
|
|
16
|
+
generation: number;
|
|
17
|
+
};
|
|
18
|
+
/** The company-level functions (22 §5), compiled without code, and their implementations. */
|
|
19
|
+
type LoadedCompany = {
|
|
20
|
+
/** Its `schema` comes from `schema/`, apart from any sequence: a repository with no sequence still pushes it. */
|
|
21
|
+
part: CompanyPart;
|
|
22
|
+
functions: FuncMap;
|
|
23
|
+
};
|
|
24
|
+
/** What one execute runs on: a sequence's functions, or the company's. */
|
|
25
|
+
type Executable = {
|
|
26
|
+
functions: FuncMap;
|
|
27
|
+
events: AnyEventHandlers;
|
|
28
|
+
runtimeVersion: string;
|
|
29
|
+
runtimeSource: RuntimePackageSource;
|
|
6
30
|
};
|
|
7
31
|
export declare function overlayWebSocketUrl(raw: string): string;
|
|
32
|
+
/** Not the repository's code: dependencies, git, and what compiling writes. */
|
|
33
|
+
export declare function isIgnoredServePath(repoRoot: string, file: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* What a changed file recompiles (22-sequence-as-business-unit §6): a file of one sequence, that
|
|
36
|
+
* sequence; anything else (`schema/`, `resolve.ts`, shared code) can reach every sequence, so all.
|
|
37
|
+
*/
|
|
38
|
+
export declare function reloadScopeForPath(repoRoot: string, file: string): 'all' | {
|
|
39
|
+
sequenceId: string;
|
|
40
|
+
} | null;
|
|
41
|
+
export declare function loadCompany(repoRoot: string): Promise<LoadedCompany>;
|
|
42
|
+
/** What a reload recompiles: the whole repository, or these sequences. */
|
|
43
|
+
export type ReloadJob = {
|
|
44
|
+
all: boolean;
|
|
45
|
+
ids: Set<string>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The changes waiting to be reloaded. A reload that fails keeps its scope (`fail`) for the next one,
|
|
49
|
+
* which a new file change starts (no retry on its own: the failure is in the code until it is
|
|
50
|
+
* edited); it is cleared only once a reload of it loads.
|
|
51
|
+
*/
|
|
52
|
+
export declare class ReloadQueue {
|
|
53
|
+
private pending;
|
|
54
|
+
private failed;
|
|
55
|
+
add(scope: 'all' | {
|
|
56
|
+
sequenceId: string;
|
|
57
|
+
}): void;
|
|
58
|
+
/** Something changed since the last reload. */
|
|
59
|
+
hasChanges(): boolean;
|
|
60
|
+
/** The next reload: the new changes plus what failed before. */
|
|
61
|
+
take(): ReloadJob;
|
|
62
|
+
fail(job: ReloadJob): void;
|
|
63
|
+
}
|
|
64
|
+
/** What a serve runs and pushes: the company's code and every loaded sequence. */
|
|
65
|
+
export type ServeState = {
|
|
66
|
+
company: LoadedCompany;
|
|
67
|
+
sequences: Map<string, LoadedSequence>;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The state after a reload (`all`: the whole repository; else the sequences `ids` names), built
|
|
71
|
+
* aside: if any part fails to load it throws and the current state stays whole, never new company
|
|
72
|
+
* code with old sequences.
|
|
73
|
+
*/
|
|
74
|
+
export declare function reloadServeState(repoRoot: string, current: ServeState, job: {
|
|
75
|
+
all: boolean;
|
|
76
|
+
ids: Iterable<string>;
|
|
77
|
+
}, generation: number): Promise<ServeState>;
|
|
78
|
+
/**
|
|
79
|
+
* Push the local company build: the company's functions and every loaded sequence, as one overlay.
|
|
80
|
+
* With no sequence left it is still pushed, so the environment drops the ones it had (22 §11).
|
|
81
|
+
*/
|
|
82
|
+
export declare function pushOverlay(ws: Pick<WebSocket, 'send'>, company: LoadedCompany, sequences: Map<string, LoadedSequence>, generation: number): void;
|
|
83
|
+
/**
|
|
84
|
+
* What the company is shown of a failed function's stack (the backend's company logs): the error's first
|
|
85
|
+
* line and the frames of the repository's own files, by their path from its root. tsx runs the original
|
|
86
|
+
* files, so their lines are already the company's. Undefined when no frame is the repository's.
|
|
87
|
+
*/
|
|
88
|
+
export declare function repositoryStack(error: unknown, repoRoot: string): string | undefined;
|
|
89
|
+
export declare function toOverlayError(message: OverlayAuthErrorMessage): Error;
|
|
90
|
+
/**
|
|
91
|
+
* Runs each `execute` the backend sends, unless its deadline has passed: the backend has then reported
|
|
92
|
+
* it as failed (a paused process, a laptop that slept), and running it would repeat its effects when
|
|
93
|
+
* the call is retried. One already started is not interrupted.
|
|
94
|
+
*/
|
|
95
|
+
export declare function attachExecuteHandler(ws: Pick<WebSocket, 'addEventListener' | 'send'>, find: (scope: string) => Executable | undefined, rpcUrl: string, repoRoot: string): void;
|
|
8
96
|
export declare function runServe(repoRoot: string, options?: ServeOptions): Promise<void>;
|
|
97
|
+
/** A Local Serve opened from code (the integration tests' `connect`): the repository's code on one environment until `close`. */
|
|
98
|
+
export type OpenOverlay = {
|
|
99
|
+
/** Stops serving: the environment runs its release again. */
|
|
100
|
+
close(): Promise<void>;
|
|
101
|
+
/** The sequences served. */
|
|
102
|
+
sequences: string[];
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* The repository served on `environmentId` as `serve` serves it, once (no file watch, no reconnect): its
|
|
106
|
+
* code loaded through the company import graph (an import the compile refuses fails here), pushed, and
|
|
107
|
+
* every function the environment runs meanwhile run here. Resolves once the environment took it.
|
|
108
|
+
*/
|
|
109
|
+
export declare function openOverlay(repoRoot: string, options: {
|
|
110
|
+
backendUrl: string;
|
|
111
|
+
token: string;
|
|
112
|
+
environmentId: string;
|
|
113
|
+
}): Promise<OpenOverlay>;
|
|
114
|
+
export {};
|
|
9
115
|
//# sourceMappingURL=index.d.ts.map
|