@avow-finance/sdk 0.0.0-stage → 0.2.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/LICENSE +201 -0
- package/README.md +122 -2
- package/dist/agent-entry.d.ts +15 -0
- package/dist/agent-entry.d.ts.map +1 -0
- package/dist/agent-entry.js +11 -0
- package/dist/agent-entry.js.map +1 -0
- package/dist/agent-key.d.ts +34 -0
- package/dist/agent-key.d.ts.map +1 -0
- package/dist/agent-key.js +33 -0
- package/dist/agent-key.js.map +1 -0
- package/dist/agent.d.ts +261 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +493 -0
- package/dist/agent.js.map +1 -0
- package/dist/avow-api.d.ts +78 -0
- package/dist/avow-api.d.ts.map +1 -0
- package/dist/avow-api.js +2 -0
- package/dist/avow-api.js.map +1 -0
- package/dist/contest.d.ts +135 -0
- package/dist/contest.d.ts.map +1 -0
- package/dist/contest.js +186 -0
- package/dist/contest.js.map +1 -0
- package/dist/http.d.ts +161 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +311 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/job/accept.d.ts +84 -0
- package/dist/job/accept.d.ts.map +1 -0
- package/dist/job/accept.js +136 -0
- package/dist/job/accept.js.map +1 -0
- package/dist/job/customer.d.ts +43 -0
- package/dist/job/customer.d.ts.map +1 -0
- package/dist/job/customer.js +83 -0
- package/dist/job/customer.js.map +1 -0
- package/dist/job/quote.d.ts +34 -0
- package/dist/job/quote.d.ts.map +1 -0
- package/dist/job/quote.js +37 -0
- package/dist/job/quote.js.map +1 -0
- package/dist/lock.d.ts +269 -0
- package/dist/lock.d.ts.map +1 -0
- package/dist/lock.js +283 -0
- package/dist/lock.js.map +1 -0
- package/dist/moderato.d.ts +27 -0
- package/dist/moderato.d.ts.map +1 -0
- package/dist/moderato.js +34 -0
- package/dist/moderato.js.map +1 -0
- package/dist/node/cli.d.ts +3 -0
- package/dist/node/cli.d.ts.map +1 -0
- package/dist/node/cli.js +346 -0
- package/dist/node/cli.js.map +1 -0
- package/dist/node/connect.d.ts +15 -0
- package/dist/node/connect.d.ts.map +1 -0
- package/dist/node/connect.js +91 -0
- package/dist/node/connect.js.map +1 -0
- package/dist/node/eval.d.ts +3 -0
- package/dist/node/eval.d.ts.map +1 -0
- package/dist/node/eval.js +67 -0
- package/dist/node/eval.js.map +1 -0
- package/dist/node/first-run.d.ts +50 -0
- package/dist/node/first-run.d.ts.map +1 -0
- package/dist/node/first-run.js +149 -0
- package/dist/node/first-run.js.map +1 -0
- package/dist/node/job.d.ts +50 -0
- package/dist/node/job.d.ts.map +1 -0
- package/dist/node/job.js +176 -0
- package/dist/node/job.js.map +1 -0
- package/dist/node/mailbox.d.ts +19 -0
- package/dist/node/mailbox.d.ts.map +1 -0
- package/dist/node/mailbox.js +81 -0
- package/dist/node/mailbox.js.map +1 -0
- package/dist/node/mcp.d.ts +74 -0
- package/dist/node/mcp.d.ts.map +1 -0
- package/dist/node/mcp.js +367 -0
- package/dist/node/mcp.js.map +1 -0
- package/dist/node/platform.d.ts +35 -0
- package/dist/node/platform.d.ts.map +1 -0
- package/dist/node/platform.js +102 -0
- package/dist/node/platform.js.map +1 -0
- package/dist/node/runner-session.d.ts +41 -0
- package/dist/node/runner-session.d.ts.map +1 -0
- package/dist/node/runner-session.js +100 -0
- package/dist/node/runner-session.js.map +1 -0
- package/dist/node/runner.d.ts +63 -0
- package/dist/node/runner.d.ts.map +1 -0
- package/dist/node/runner.js +341 -0
- package/dist/node/runner.js.map +1 -0
- package/dist/node/service-child.d.ts +2 -0
- package/dist/node/service-child.d.ts.map +1 -0
- package/dist/node/service-child.js +40 -0
- package/dist/node/service-child.js.map +1 -0
- package/dist/node/service-excerpt.d.ts +21 -0
- package/dist/node/service-excerpt.d.ts.map +1 -0
- package/dist/node/service-excerpt.js +32 -0
- package/dist/node/service-excerpt.js.map +1 -0
- package/dist/node/service-process.d.ts +12 -0
- package/dist/node/service-process.d.ts.map +1 -0
- package/dist/node/service-process.js +132 -0
- package/dist/node/service-process.js.map +1 -0
- package/dist/node/session-input.d.ts +12 -0
- package/dist/node/session-input.d.ts.map +1 -0
- package/dist/node/session-input.js +42 -0
- package/dist/node/session-input.js.map +1 -0
- package/dist/node/session-view.d.ts +20 -0
- package/dist/node/session-view.d.ts.map +1 -0
- package/dist/node/session-view.js +198 -0
- package/dist/node/session-view.js.map +1 -0
- package/dist/node-agent.d.ts +2 -0
- package/dist/node-agent.d.ts.map +1 -0
- package/dist/node-agent.js +6 -0
- package/dist/node-agent.js.map +1 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +9 -0
- package/dist/node.js.map +1 -0
- package/dist/sandbox/agent.d.ts +187 -0
- package/dist/sandbox/agent.d.ts.map +1 -0
- package/dist/sandbox/agent.js +468 -0
- package/dist/sandbox/agent.js.map +1 -0
- package/dist/sandbox/business-store.d.ts +19 -0
- package/dist/sandbox/business-store.d.ts.map +1 -0
- package/dist/sandbox/business-store.js +19 -0
- package/dist/sandbox/business-store.js.map +1 -0
- package/dist/sandbox/business.d.ts +70 -0
- package/dist/sandbox/business.d.ts.map +1 -0
- package/dist/sandbox/business.js +115 -0
- package/dist/sandbox/business.js.map +1 -0
- package/dist/sandbox/connect.d.ts +64 -0
- package/dist/sandbox/connect.d.ts.map +1 -0
- package/dist/sandbox/connect.js +182 -0
- package/dist/sandbox/connect.js.map +1 -0
- package/dist/sandbox/deployment.d.ts +14 -0
- package/dist/sandbox/deployment.d.ts.map +1 -0
- package/dist/sandbox/deployment.js +38 -0
- package/dist/sandbox/deployment.js.map +1 -0
- package/dist/sandbox/keys.d.ts +45 -0
- package/dist/sandbox/keys.d.ts.map +1 -0
- package/dist/sandbox/keys.js +132 -0
- package/dist/sandbox/keys.js.map +1 -0
- package/dist/sandbox/mailbox.d.ts +90 -0
- package/dist/sandbox/mailbox.d.ts.map +1 -0
- package/dist/sandbox/mailbox.js +400 -0
- package/dist/sandbox/mailbox.js.map +1 -0
- package/dist/sandbox/mandate.d.ts +84 -0
- package/dist/sandbox/mandate.d.ts.map +1 -0
- package/dist/sandbox/mandate.js +107 -0
- package/dist/sandbox/mandate.js.map +1 -0
- package/dist/sandbox/namespace.d.ts +16 -0
- package/dist/sandbox/namespace.d.ts.map +1 -0
- package/dist/sandbox/namespace.js +16 -0
- package/dist/sandbox/namespace.js.map +1 -0
- package/dist/sandbox/session.d.ts +60 -0
- package/dist/sandbox/session.d.ts.map +1 -0
- package/dist/sandbox/session.js +94 -0
- package/dist/sandbox/session.js.map +1 -0
- package/dist/sandbox/setup.d.ts +136 -0
- package/dist/sandbox/setup.d.ts.map +1 -0
- package/dist/sandbox/setup.js +490 -0
- package/dist/sandbox/setup.js.map +1 -0
- package/dist/sandbox/store.d.ts +69 -0
- package/dist/sandbox/store.d.ts.map +1 -0
- package/dist/sandbox/store.js +115 -0
- package/dist/sandbox/store.js.map +1 -0
- package/dist/sandbox/supplier-key.d.ts +73 -0
- package/dist/sandbox/supplier-key.d.ts.map +1 -0
- package/dist/sandbox/supplier-key.js +180 -0
- package/dist/sandbox/supplier-key.js.map +1 -0
- package/dist/sandbox/suppliers.d.ts +7 -0
- package/dist/sandbox/suppliers.d.ts.map +1 -0
- package/dist/sandbox/suppliers.js +29 -0
- package/dist/sandbox/suppliers.js.map +1 -0
- package/dist/sandbox/terms.d.ts +32 -0
- package/dist/sandbox/terms.d.ts.map +1 -0
- package/dist/sandbox/terms.js +58 -0
- package/dist/sandbox/terms.js.map +1 -0
- package/dist/sandbox/vault.d.ts +24 -0
- package/dist/sandbox/vault.d.ts.map +1 -0
- package/dist/sandbox/vault.js +54 -0
- package/dist/sandbox/vault.js.map +1 -0
- package/dist/send.d.ts +122 -0
- package/dist/send.d.ts.map +1 -0
- package/dist/send.js +328 -0
- package/dist/send.js.map +1 -0
- package/dist/service-entry.d.ts +6 -0
- package/dist/service-entry.d.ts.map +1 -0
- package/dist/service-entry.js +6 -0
- package/dist/service-entry.js.map +1 -0
- package/dist/session/anthropic.d.ts +17 -0
- package/dist/session/anthropic.d.ts.map +1 -0
- package/dist/session/anthropic.js +215 -0
- package/dist/session/anthropic.js.map +1 -0
- package/dist/session/charge.d.ts +13 -0
- package/dist/session/charge.d.ts.map +1 -0
- package/dist/session/charge.js +33 -0
- package/dist/session/charge.js.map +1 -0
- package/dist/session/data.d.ts +8 -0
- package/dist/session/data.d.ts.map +1 -0
- package/dist/session/data.js +20 -0
- package/dist/session/data.js.map +1 -0
- package/dist/session/eval.d.ts +41 -0
- package/dist/session/eval.d.ts.map +1 -0
- package/dist/session/eval.js +281 -0
- package/dist/session/eval.js.map +1 -0
- package/dist/session/executor.d.ts +80 -0
- package/dist/session/executor.d.ts.map +1 -0
- package/dist/session/executor.js +381 -0
- package/dist/session/executor.js.map +1 -0
- package/dist/session/fixture-world.d.ts +29 -0
- package/dist/session/fixture-world.d.ts.map +1 -0
- package/dist/session/fixture-world.js +708 -0
- package/dist/session/fixture-world.js.map +1 -0
- package/dist/session/live-world.d.ts +22 -0
- package/dist/session/live-world.d.ts.map +1 -0
- package/dist/session/live-world.js +329 -0
- package/dist/session/live-world.js.map +1 -0
- package/dist/session/ollama.d.ts +29 -0
- package/dist/session/ollama.d.ts.map +1 -0
- package/dist/session/ollama.js +177 -0
- package/dist/session/ollama.js.map +1 -0
- package/dist/session/provider.d.ts +79 -0
- package/dist/session/provider.d.ts.map +1 -0
- package/dist/session/provider.js +19 -0
- package/dist/session/provider.js.map +1 -0
- package/dist/session/scripted.d.ts +45 -0
- package/dist/session/scripted.d.ts.map +1 -0
- package/dist/session/scripted.js +236 -0
- package/dist/session/scripted.js.map +1 -0
- package/dist/session/selection.d.ts +37 -0
- package/dist/session/selection.d.ts.map +1 -0
- package/dist/session/selection.js +104 -0
- package/dist/session/selection.js.map +1 -0
- package/dist/session/service-check.d.ts +48 -0
- package/dist/session/service-check.d.ts.map +1 -0
- package/dist/session/service-check.js +86 -0
- package/dist/session/service-check.js.map +1 -0
- package/dist/session/service.d.ts +128 -0
- package/dist/session/service.d.ts.map +1 -0
- package/dist/session/service.js +150 -0
- package/dist/session/service.js.map +1 -0
- package/dist/session/session.d.ts +95 -0
- package/dist/session/session.d.ts.map +1 -0
- package/dist/session/session.js +312 -0
- package/dist/session/session.js.map +1 -0
- package/dist/session/toolbox.d.ts +69 -0
- package/dist/session/toolbox.d.ts.map +1 -0
- package/dist/session/toolbox.js +391 -0
- package/dist/session/toolbox.js.map +1 -0
- package/dist/session/tools.d.ts +45 -0
- package/dist/session/tools.d.ts.map +1 -0
- package/dist/session/tools.js +137 -0
- package/dist/session/tools.js.map +1 -0
- package/dist/session/world.d.ts +188 -0
- package/dist/session/world.d.ts.map +1 -0
- package/dist/session/world.js +2 -0
- package/dist/session/world.js.map +1 -0
- package/dist/sign.d.ts +19 -0
- package/dist/sign.d.ts.map +1 -0
- package/dist/sign.js +33 -0
- package/dist/sign.js.map +1 -0
- package/dist/supplier.d.ts +41 -0
- package/dist/supplier.d.ts.map +1 -0
- package/dist/supplier.js +57 -0
- package/dist/supplier.js.map +1 -0
- package/package.json +56 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-excerpt.js","sourceRoot":"","sources":["../../src/node/service-excerpt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC9B,MAAM,IAAI,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC7E,MAAM,QAAQ,GAAG,IAAI,CAAC,iCAAiC,CAAC,CAAA;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AAO,EAAE,EAAE,CAAC,CAAC;QAC3E,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;KAC1C,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReservedJob, type ServicePolicy, type Verdict } from '../session/service.js';
|
|
2
|
+
import type { ChildChain } from '../session/world.js';
|
|
3
|
+
/** The budget and the compute switch in `service.ts`, read again on every call. */
|
|
4
|
+
export declare function readServicePolicy(file: string, cwd?: string): Promise<ServicePolicy>;
|
|
5
|
+
/**
|
|
6
|
+
* Runs `checkBeforeWork` in `service.ts` on a job the customer reserved for, and gives its verdict,
|
|
7
|
+
* or why there's none. No verdict starts nothing.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runCheckBeforeWork(file: string, job: ReservedJob, chain: ChildChain, cwd?: string): Promise<Verdict | {
|
|
10
|
+
failed: string;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=service-process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-process.d.ts","sourceRoot":"","sources":["../../src/node/service-process.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,aAAa,EAClB,KAAK,OAAO,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AA6GrD,mFAAmF;AACnF,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAMjG;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,UAAU,EACjB,GAAG,SAAgB,GAClB,OAAO,CAAC,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAUvC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join, resolve, sep } from 'node:path';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
+
import { encodeData } from '../session/data.js';
|
|
7
|
+
import { readPolicy, readVerdict, } from '../session/service.js';
|
|
8
|
+
import { childEnv, command } from './runner.js';
|
|
9
|
+
/**
|
|
10
|
+
* Runs the developer's `service.ts` in a process of its own, the way the runner runs `agent.ts` and
|
|
11
|
+
* reads `business.ts`. The process starts in a session of its own with no terminal, no input and
|
|
12
|
+
* no `AVOW_` variable, and the session passes it no key. It runs as the developer's own user, so
|
|
13
|
+
* it could read the key files in `.avow` itself, since `service.ts` is the developer's own code.
|
|
14
|
+
* It gets its job as a file of public data and answers with one line of JSON, read here at the
|
|
15
|
+
* boundary, and nothing else passes between the two.
|
|
16
|
+
*/
|
|
17
|
+
/** How long `checkBeforeWork` may take before the session gives up and starts nothing. */
|
|
18
|
+
const CHECK_TIMEOUT_MS = 60_000;
|
|
19
|
+
/** How long reading the budget and the switch may take. */
|
|
20
|
+
const POLICY_TIMEOUT_MS = 30_000;
|
|
21
|
+
/**
|
|
22
|
+
* The module the child runs: the built one beside this one, or under a test running the sources,
|
|
23
|
+
* the package's built one, which plain Node can run.
|
|
24
|
+
*/
|
|
25
|
+
function childModule() {
|
|
26
|
+
const here = fileURLToPath(import.meta.url);
|
|
27
|
+
const beside = here.replace(/service-process\.(ts|js)$/, 'service-child.js');
|
|
28
|
+
const built = beside.replace(`${sep}src${sep}node${sep}`, `${sep}dist${sep}node${sep}`);
|
|
29
|
+
return pathToFileURL(existsSync(beside) ? beside : built).href;
|
|
30
|
+
}
|
|
31
|
+
/** Ends a child's whole process group, so nothing it left behind keeps running. */
|
|
32
|
+
function killGroup(pid) {
|
|
33
|
+
if (process.platform === 'win32') {
|
|
34
|
+
spawnSync('taskkill', ['/pid', String(pid), '/T', '/F'], { stdio: 'ignore' });
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
process.kill(-pid, 'SIGKILL');
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// The group is already gone.
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Runs the child once with its input, and gives its one line of output or why there's none. */
|
|
45
|
+
async function runChild(file, cwd, input, timeoutMs) {
|
|
46
|
+
const dir = mkdtempSync(join(tmpdir(), 'avow-service-'));
|
|
47
|
+
try {
|
|
48
|
+
const loader = join(dir, 'run.mjs');
|
|
49
|
+
const inputPath = join(dir, 'input.json');
|
|
50
|
+
writeFileSync(loader, 'const [child, service, input] = process.argv.slice(2); const m = await import(child); await m.runServiceChild(service, input)\n');
|
|
51
|
+
writeFileSync(inputPath, encodeData(input));
|
|
52
|
+
const serviceUrl = pathToFileURL(resolve(cwd, file)).href;
|
|
53
|
+
const [first, ...rest] = command(file, cwd);
|
|
54
|
+
const args = first === file
|
|
55
|
+
? [loader, childModule(), serviceUrl, inputPath]
|
|
56
|
+
: [first, loader, childModule(), serviceUrl, inputPath, ...rest.slice(1)];
|
|
57
|
+
return await new Promise((done) => {
|
|
58
|
+
const child = spawn(process.execPath, args, {
|
|
59
|
+
cwd,
|
|
60
|
+
env: childEnv(null),
|
|
61
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
62
|
+
detached: true,
|
|
63
|
+
windowsHide: true,
|
|
64
|
+
});
|
|
65
|
+
let output = '';
|
|
66
|
+
let errors = '';
|
|
67
|
+
let timedOut = false;
|
|
68
|
+
const timer = setTimeout(() => {
|
|
69
|
+
timedOut = true;
|
|
70
|
+
if (child.pid)
|
|
71
|
+
killGroup(child.pid);
|
|
72
|
+
}, timeoutMs);
|
|
73
|
+
child.stdout.on('data', (chunk) => {
|
|
74
|
+
output += chunk.toString();
|
|
75
|
+
});
|
|
76
|
+
child.stderr.on('data', (chunk) => {
|
|
77
|
+
errors += chunk.toString();
|
|
78
|
+
});
|
|
79
|
+
child.on('error', (error) => {
|
|
80
|
+
errors += error.message;
|
|
81
|
+
});
|
|
82
|
+
child.on('close', (code) => {
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
if (child.pid)
|
|
85
|
+
killGroup(child.pid);
|
|
86
|
+
if (timedOut)
|
|
87
|
+
return done({ ok: false, why: `${file} took longer than ${timeoutMs / 1000} seconds` });
|
|
88
|
+
const last = output.trim().split('\n').at(-1) ?? '';
|
|
89
|
+
if (code !== 0 || !last) {
|
|
90
|
+
const said = errors.trim().split('\n').slice(-3).join(' ').slice(0, 300);
|
|
91
|
+
return done({ ok: false, why: `${file} stopped with an error${said ? `: ${said}` : ''}` });
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
done({ ok: true, json: JSON.parse(last) });
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
done({ ok: false, why: `${file} answered with something that isn't JSON` });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
rmSync(dir, { recursive: true, force: true });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** The budget and the compute switch in `service.ts`, read again on every call. */
|
|
107
|
+
export async function readServicePolicy(file, cwd = process.cwd()) {
|
|
108
|
+
const answer = await runChild(file, cwd, { mode: 'policy' }, POLICY_TIMEOUT_MS);
|
|
109
|
+
if (!answer.ok)
|
|
110
|
+
throw new Error(`${answer.why}, so the session can't read its budget and switch.`);
|
|
111
|
+
const policy = readPolicy(answer.json);
|
|
112
|
+
if (!policy)
|
|
113
|
+
throw new Error(`${file} gave a budget or a switch that doesn't read.`);
|
|
114
|
+
return policy;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Runs `checkBeforeWork` in `service.ts` on a job the customer reserved for, and gives its verdict,
|
|
118
|
+
* or why there's none. No verdict starts nothing.
|
|
119
|
+
*/
|
|
120
|
+
export async function runCheckBeforeWork(file, job, chain, cwd = process.cwd()) {
|
|
121
|
+
const answer = await runChild(file, cwd, { mode: 'check', job, chain }, CHECK_TIMEOUT_MS);
|
|
122
|
+
if (!answer.ok)
|
|
123
|
+
return { failed: `${answer.why}, so nothing was accepted and no work started.` };
|
|
124
|
+
const verdict = readVerdict(answer.json);
|
|
125
|
+
if (!verdict) {
|
|
126
|
+
return {
|
|
127
|
+
failed: `checkBeforeWork in ${file} gave a verdict that doesn't read, so nothing was accepted and no work started.`,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return verdict;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=service-process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-process.js","sourceRoot":"","sources":["../../src/node/service-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAEL,UAAU,EACV,WAAW,GAGZ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE/C;;;;;;;GAOG;AAEH,0FAA0F;AAC1F,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAC/B,2DAA2D;AAC3D,MAAM,iBAAiB,GAAG,MAAM,CAAA;AAEhC;;;GAGG;AACH,S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IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,gBAAgB,CAAC,CAAA;IACzF,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,gDAAgD,EAAE,CAAA;IAChG,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,MAAM,EAAE,sBAAsB,IAAI,iFAAiF;SACpH,CAAA;IACH,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Rail } from '@avow-finance/terminal';
|
|
2
|
+
import type { SessionInput } from '../session/session.js';
|
|
3
|
+
/**
|
|
4
|
+
* What the developer types to the agent, on the rail's "you ›" line. A line typed while the agent
|
|
5
|
+
* or the executor is busy waits for the next turn, and when something is in flight it gets a notice
|
|
6
|
+
* saying typing can't undo it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function terminalInput(prompts: {
|
|
9
|
+
ask(prompt: string, hidden?: boolean): Promise<string | null>;
|
|
10
|
+
onLine(listener: (line: string) => void): void;
|
|
11
|
+
}, rail: Pick<Rail, 'quiet' | 'settle' | 'you'>): SessionInput;
|
|
12
|
+
//# sourceMappingURL=session-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-input.d.ts","sourceRoot":"","sources":["../../src/node/session-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE;IACP,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAC7D,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAA;CAC/C,EACD,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC,GAC3C,YAAY,CA+Bd"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the developer types to the agent, on the rail's "you ›" line. A line typed while the agent
|
|
3
|
+
* or the executor is busy waits for the next turn, and when something is in flight it gets a notice
|
|
4
|
+
* saying typing can't undo it.
|
|
5
|
+
*/
|
|
6
|
+
export function terminalInput(prompts, rail) {
|
|
7
|
+
const typed = [];
|
|
8
|
+
let waiting = null;
|
|
9
|
+
let flying = null;
|
|
10
|
+
prompts.onLine((line) => {
|
|
11
|
+
if (flying)
|
|
12
|
+
rail.quiet(`Typing can't undo ${flying}. What you typed applies once it's done.`);
|
|
13
|
+
if (waiting) {
|
|
14
|
+
const resolve = waiting;
|
|
15
|
+
waiting = null;
|
|
16
|
+
resolve(line);
|
|
17
|
+
}
|
|
18
|
+
else
|
|
19
|
+
typed.push(line);
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
inFlight(what) {
|
|
23
|
+
flying = what;
|
|
24
|
+
},
|
|
25
|
+
next() {
|
|
26
|
+
const queued = typed.shift();
|
|
27
|
+
if (queued !== undefined)
|
|
28
|
+
return Promise.resolve(queued);
|
|
29
|
+
rail.settle();
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
waiting = resolve;
|
|
32
|
+
prompts.ask(rail.you).then((line) => {
|
|
33
|
+
if (waiting === resolve) {
|
|
34
|
+
waiting = null;
|
|
35
|
+
resolve(line);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=session-input.js.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CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type CardClock } from '@avow-finance/spec';
|
|
2
|
+
import { type Look, type Rail } from '@avow-finance/terminal';
|
|
3
|
+
import type { SessionView } from '../session/session.js';
|
|
4
|
+
/** A moment as the terminal says it, in the clock of the machine it runs on. */
|
|
5
|
+
export declare const localClock: CardClock;
|
|
6
|
+
/**
|
|
7
|
+
* The rail view. Each commitment draws as a card once it's accepted, the compute booking when its
|
|
8
|
+
* supplier accepted it and the job when the business's own code did. A brief view, the default,
|
|
9
|
+
* draws each thing once beside the cards, in the job lines code writes, and leaves the tool calls,
|
|
10
|
+
* the customer's words and the commitment receipts to the details and to the screen, which shows
|
|
11
|
+
* everything.
|
|
12
|
+
*/
|
|
13
|
+
export declare function railView(rail: Rail, look: Look, options: {
|
|
14
|
+
fixture: boolean;
|
|
15
|
+
write: (text: string) => void;
|
|
16
|
+
brief?: boolean;
|
|
17
|
+
/** How a card says a moment, the machine's own clock by default. */
|
|
18
|
+
clock?: CardClock;
|
|
19
|
+
}): SessionView;
|
|
20
|
+
//# sourceMappingURL=session-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-view.d.ts","sourceRoot":"","sources":["../../src/node/session-view.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAYf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAiB,KAAK,IAAI,EAAE,KAAK,IAAI,EAAY,MAAM,wBAAwB,CAAA;AAEtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAwCxD,gFAAgF;AAChF,eAAO,MAAM,UAAU,EAAE,SAKrB,CAAA;AAUJ;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IACP,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,oEAAoE;IACpE,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,GACA,WAAW,CA8Ib"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { commitmentCards, DECISIVE_SENTENCE, formatUsd, jobEventSentence, RECOVERED_DECISIVE_SENTENCE, refusalSentence, SIMULATED_LINE, TEST_CUSTOMER_LABEL, } from '@avow-finance/spec';
|
|
2
|
+
import { setApart } from '@avow-finance/terminal';
|
|
3
|
+
import { verifyUrl } from '../sandbox/session.js';
|
|
4
|
+
/**
|
|
5
|
+
* The session drawn on the rail. Each event draws as the session makes it, so the terminal and the
|
|
6
|
+
* screen show the same things. Speech draws under its speaker's name and evidence draws as facts
|
|
7
|
+
* and receipts with their block and reference, never the one as the other. A fixture world's facts
|
|
8
|
+
* and receipts draw as plain lines that say they're the fixture's, so none can pass for a read of
|
|
9
|
+
* the chain.
|
|
10
|
+
*/
|
|
11
|
+
const JOB_STATES = ['reserved', 'accepted', 'released'];
|
|
12
|
+
function evidenceOf(e, reference) {
|
|
13
|
+
return {
|
|
14
|
+
verifiedBy: e.verifiedBy,
|
|
15
|
+
block: e.block.number,
|
|
16
|
+
reference: {
|
|
17
|
+
chain: reference.chainId,
|
|
18
|
+
lock: reference.lock,
|
|
19
|
+
commitmentId: reference.commitmentId,
|
|
20
|
+
side: reference.side,
|
|
21
|
+
},
|
|
22
|
+
...(e.transactionHash ? { transactionHash: e.transactionHash } : {}),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Who checked, as the rail says it for a chain read, here for the fixture world's own lines. */
|
|
26
|
+
const WHO = {
|
|
27
|
+
service: 'checked by your service.ts',
|
|
28
|
+
customer: "Avow's test customer says it checked",
|
|
29
|
+
avow: "checked by Avow's API",
|
|
30
|
+
};
|
|
31
|
+
/** A moment as the terminal says it, in the clock of the machine it runs on. */
|
|
32
|
+
export const localClock = (seconds) => new Date(Number(seconds) * 1000).toLocaleTimeString(undefined, {
|
|
33
|
+
hour: '2-digit',
|
|
34
|
+
minute: '2-digit',
|
|
35
|
+
hour12: false,
|
|
36
|
+
});
|
|
37
|
+
const CARD_NAMES = { job: 'JOB', compute: 'COMPUTE' };
|
|
38
|
+
/** The tools whose result a code-written job line already says, so a brief view leaves it out. */
|
|
39
|
+
const SAID_BY_JOB_LINES = new Set(['read_order', 'book_compute', 'submit_quote', 'cancel_compute']);
|
|
40
|
+
/** A 32-character id, such as an order's, cut to its first six characters for a brief view. */
|
|
41
|
+
const LONG_ID = /\b([0-9a-f]{6})[0-9a-f]{26}\b/g;
|
|
42
|
+
/**
|
|
43
|
+
* The rail view. Each commitment draws as a card once it's accepted, the compute booking when its
|
|
44
|
+
* supplier accepted it and the job when the business's own code did. A brief view, the default,
|
|
45
|
+
* draws each thing once beside the cards, in the job lines code writes, and leaves the tool calls,
|
|
46
|
+
* the customer's words and the commitment receipts to the details and to the screen, which shows
|
|
47
|
+
* everything.
|
|
48
|
+
*/
|
|
49
|
+
export function railView(rail, look, options) {
|
|
50
|
+
const { fixture } = options;
|
|
51
|
+
const brief = options.brief === true;
|
|
52
|
+
const clock = options.clock ?? localClock;
|
|
53
|
+
/** Every event so far, which a card's rows are read from. */
|
|
54
|
+
const seen = [];
|
|
55
|
+
/** Draws the card of an order's commitment, saying so when it's the fixture world's. */
|
|
56
|
+
const card = (orderId, role) => {
|
|
57
|
+
const drawn = commitmentCards(seen, orderId, clock).find((c) => c.role === role);
|
|
58
|
+
if (!drawn)
|
|
59
|
+
return;
|
|
60
|
+
rail.card({
|
|
61
|
+
name: CARD_NAMES[role],
|
|
62
|
+
from: drawn.from,
|
|
63
|
+
to: drawn.to,
|
|
64
|
+
state: fixture ? `${drawn.promise} in the fixture world` : drawn.promise,
|
|
65
|
+
...(drawn.promise === 'broken' ? { broken: true } : {}),
|
|
66
|
+
rows: drawn.rows,
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const shown = (text) => (brief ? text.replace(LONG_ID, '$1') : text);
|
|
70
|
+
/** The last refusal drawn, so a brief view leaves out the tool result that says it again. */
|
|
71
|
+
let refusal = null;
|
|
72
|
+
const fixtureLine = (e, text) => rail.line(`In the fixture world at block ${e.block.number}, ${WHO[e.verifiedBy]}. ${text}`);
|
|
73
|
+
function draw(e) {
|
|
74
|
+
seen.push(e);
|
|
75
|
+
switch (e.type) {
|
|
76
|
+
case 'said':
|
|
77
|
+
// A model's words drew as they arrived. The customer's draw now, under its name.
|
|
78
|
+
if (e.speaker.kind === 'customer' && !brief)
|
|
79
|
+
rail.said(TEST_CUSTOMER_LABEL, e.text);
|
|
80
|
+
return;
|
|
81
|
+
case 'tool_call':
|
|
82
|
+
if (!brief)
|
|
83
|
+
rail.call(e.tool, e.summary);
|
|
84
|
+
return;
|
|
85
|
+
case 'tool_result':
|
|
86
|
+
if (e.recalled)
|
|
87
|
+
return;
|
|
88
|
+
if (brief && e.ok && SAID_BY_JOB_LINES.has(e.tool))
|
|
89
|
+
return;
|
|
90
|
+
if (brief && !e.ok && refusal?.startsWith(e.summary))
|
|
91
|
+
return;
|
|
92
|
+
rail.returned(e.ok, shown(e.ok ? e.summary : `${e.summary} (${e.layer}, ${e.code})`));
|
|
93
|
+
return;
|
|
94
|
+
case 'fact':
|
|
95
|
+
// A brief view leaves each check's own line to the details, since the cards carry them.
|
|
96
|
+
if (brief)
|
|
97
|
+
return;
|
|
98
|
+
if (fixture)
|
|
99
|
+
fixtureLine(e, e.text);
|
|
100
|
+
else
|
|
101
|
+
rail.fact({ ...evidenceOf(e, e.reference), text: e.text });
|
|
102
|
+
return;
|
|
103
|
+
case 'commitment': {
|
|
104
|
+
const title = e.role === 'job'
|
|
105
|
+
? "The job: the customer's commitment to your business"
|
|
106
|
+
: 'Your compute booking';
|
|
107
|
+
if (brief)
|
|
108
|
+
return;
|
|
109
|
+
if (fixture) {
|
|
110
|
+
fixtureLine(e, `${title} is ${e.state}, with ${formatUsd(e.amount)} reserved.`);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const at = JOB_STATES.indexOf(e.state);
|
|
114
|
+
rail.receipt({
|
|
115
|
+
title,
|
|
116
|
+
lines: [
|
|
117
|
+
e.role === 'job'
|
|
118
|
+
? `Avow's test customer reserved ${formatUsd(e.amount)} in its own lock for your business.`
|
|
119
|
+
: `Your business reserved ${formatUsd(e.amount)} in its own lock for the GPU supplier.`,
|
|
120
|
+
],
|
|
121
|
+
states: JOB_STATES.map((name, i) => ({ name, reached: at >= i })),
|
|
122
|
+
evidence: evidenceOf(e, e.reference),
|
|
123
|
+
link: verifyUrl(e.reference, undefined),
|
|
124
|
+
});
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
case 'refused':
|
|
128
|
+
refusal = refusalSentence(e);
|
|
129
|
+
rail.fail(shown(refusal));
|
|
130
|
+
return;
|
|
131
|
+
case 'job_customer_verifying':
|
|
132
|
+
// The customer's answer follows at once, so a brief view waits for it.
|
|
133
|
+
if (!brief)
|
|
134
|
+
rail.done(jobEventSentence(e));
|
|
135
|
+
return;
|
|
136
|
+
case 'job_compute_secured':
|
|
137
|
+
// The card says what the sentence does, so a brief view draws the card alone.
|
|
138
|
+
if (!brief)
|
|
139
|
+
rail.done(jobEventSentence(e));
|
|
140
|
+
card(e.orderId, 'compute');
|
|
141
|
+
return;
|
|
142
|
+
case 'job_commitment_checked': {
|
|
143
|
+
const sentence = e.acceptedIn === null ? RECOVERED_DECISIVE_SENTENCE : DECISIVE_SENTENCE;
|
|
144
|
+
card(e.orderId, 'job');
|
|
145
|
+
if (brief) {
|
|
146
|
+
rail.done(sentence);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
rail.settle();
|
|
150
|
+
options.write(`${setApart(look, [sentence])}\n`);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
case 'job_commitment_refused':
|
|
154
|
+
case 'job_customer_refused':
|
|
155
|
+
rail.fail(shown(jobEventSentence(e)));
|
|
156
|
+
return;
|
|
157
|
+
case 'job_charge_confirmed':
|
|
158
|
+
case 'job_charge_paused':
|
|
159
|
+
case 'job_charge_paid':
|
|
160
|
+
// The card says the promise is broken and where the money stands, each on its own row.
|
|
161
|
+
rail.done(shown(jobEventSentence(e)));
|
|
162
|
+
card(e.orderId, 'job');
|
|
163
|
+
return;
|
|
164
|
+
case 'job_work_started':
|
|
165
|
+
rail.done(shown(jobEventSentence(e)));
|
|
166
|
+
rail.quiet(SIMULATED_LINE);
|
|
167
|
+
return;
|
|
168
|
+
default:
|
|
169
|
+
if (e.type.startsWith('job_'))
|
|
170
|
+
rail.done(shown(jobEventSentence(e)));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
intro(lines) {
|
|
175
|
+
if (fixture)
|
|
176
|
+
rail.stage('The fixture world, in memory, for tests and the eval. Nothing here is on chain.');
|
|
177
|
+
for (const line of lines)
|
|
178
|
+
rail.quiet(line);
|
|
179
|
+
},
|
|
180
|
+
event: draw,
|
|
181
|
+
speak(model) {
|
|
182
|
+
let speech = null;
|
|
183
|
+
return {
|
|
184
|
+
write: (piece) => {
|
|
185
|
+
if (!piece)
|
|
186
|
+
return;
|
|
187
|
+
speech ??= rail.speak(model);
|
|
188
|
+
speech.write(shown(piece));
|
|
189
|
+
},
|
|
190
|
+
end: () => speech?.end(),
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
quiet: (line) => rail.quiet(line),
|
|
194
|
+
fail: (line) => rail.fail(line),
|
|
195
|
+
evidence: (table) => rail.table({ ...table, notes: [...table.notes] }),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=session-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-view.js","sourceRoot":"","sources":["../../src/node/session-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,eAAe,EACf,iBAAiB,EACjB,S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AC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;gBAC5B,CAAC;gBACD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;aACzB,CAAA;QACH,CAAC;QACD,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACjC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;KACvE,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-agent.d.ts","sourceRoot":"","sources":["../src/node-agent.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The agent's side of the SDK as Node loads it, keeping to the `.avow` folder and the runner's session. */
|
|
2
|
+
import { nodePlatform } from './node/platform.js';
|
|
3
|
+
import { setSandboxPlatform } from './sandbox/agent.js';
|
|
4
|
+
setSandboxPlatform(nodePlatform);
|
|
5
|
+
export * from './agent-entry.js';
|
|
6
|
+
//# sourceMappingURL=node-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-agent.js","sourceRoot":"","sources":["../src/node-agent.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD,kBAAkB,CAAC,YAAY,CAAC,CAAA;AAEhC,cAAc,kBAAkB,CAAA"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AASA,cAAc,YAAY,CAAA"}
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SDK as Node loads it. It's the same SDK, with the sandbox keeping its keys in the working
|
|
3
|
+
* directory's `.avow` folder and reporting to the session its runner opened.
|
|
4
|
+
*/
|
|
5
|
+
import { nodePlatform } from './node/platform.js';
|
|
6
|
+
import { setSandboxPlatform } from './sandbox/agent.js';
|
|
7
|
+
setSandboxPlatform(nodePlatform);
|
|
8
|
+
export * from './index.js';
|
|
9
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD,kBAAkB,CAAC,YAAY,CAAC,CAAA;AAEhC,cAAc,YAAY,CAAA"}
|