@animalabs/agent-framework 0.23.1 → 0.24.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 +212 -42
- package/dist/src/agent.d.ts +60 -9
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +92 -12
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +14 -12
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/code-execution/engine.d.ts +177 -0
- package/dist/src/code-execution/engine.d.ts.map +1 -0
- package/dist/src/code-execution/engine.js +494 -0
- package/dist/src/code-execution/engine.js.map +1 -0
- package/dist/src/code-execution/index.d.ts +5 -10
- package/dist/src/code-execution/index.d.ts.map +1 -1
- package/dist/src/code-execution/index.js +5 -9
- package/dist/src/code-execution/index.js.map +1 -1
- package/dist/src/code-execution/isolate/calls.d.ts +114 -0
- package/dist/src/code-execution/isolate/calls.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/calls.js +145 -0
- package/dist/src/code-execution/isolate/calls.js.map +1 -0
- package/dist/src/code-execution/isolate/child-entry.d.ts +2 -0
- package/dist/src/code-execution/isolate/child-entry.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/child-entry.js +5 -0
- package/dist/src/code-execution/isolate/child-entry.js.map +1 -0
- package/dist/src/code-execution/isolate/child-main.d.ts +26 -0
- package/dist/src/code-execution/isolate/child-main.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/child-main.js +132 -0
- package/dist/src/code-execution/isolate/child-main.js.map +1 -0
- package/dist/src/code-execution/isolate/child.d.ts +44 -0
- package/dist/src/code-execution/isolate/child.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/child.js +315 -0
- package/dist/src/code-execution/isolate/child.js.map +1 -0
- package/dist/src/code-execution/isolate/frames.d.ts +80 -0
- package/dist/src/code-execution/isolate/frames.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/frames.js +210 -0
- package/dist/src/code-execution/isolate/frames.js.map +1 -0
- package/dist/src/code-execution/isolate/output.d.ts +68 -0
- package/dist/src/code-execution/isolate/output.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/output.js +143 -0
- package/dist/src/code-execution/isolate/output.js.map +1 -0
- package/dist/src/code-execution/isolate/prelude.d.ts +109 -0
- package/dist/src/code-execution/isolate/prelude.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/prelude.js +401 -0
- package/dist/src/code-execution/isolate/prelude.js.map +1 -0
- package/dist/src/code-execution/isolate/protocol.d.ts +151 -0
- package/dist/src/code-execution/isolate/protocol.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/protocol.js +150 -0
- package/dist/src/code-execution/isolate/protocol.js.map +1 -0
- package/dist/src/code-execution/isolate/render.d.ts +57 -0
- package/dist/src/code-execution/isolate/render.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/render.js +214 -0
- package/dist/src/code-execution/isolate/render.js.map +1 -0
- package/dist/src/code-execution/isolate/runner.d.ts +250 -0
- package/dist/src/code-execution/isolate/runner.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/runner.js +854 -0
- package/dist/src/code-execution/isolate/runner.js.map +1 -0
- package/dist/src/code-execution/isolate/scripts.d.ts +175 -0
- package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/scripts.js +357 -0
- package/dist/src/code-execution/isolate/scripts.js.map +1 -0
- package/dist/src/code-execution/quickjs.wasm +0 -0
- package/dist/src/code-execution/tool-definition.d.ts +93 -43
- package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
- package/dist/src/code-execution/tool-definition.js +176 -142
- package/dist/src/code-execution/tool-definition.js.map +1 -1
- package/dist/src/deadline-timer.d.ts +3 -0
- package/dist/src/deadline-timer.d.ts.map +1 -1
- package/dist/src/deadline-timer.js +1 -1
- package/dist/src/deadline-timer.js.map +1 -1
- package/dist/src/framework.d.ts +1036 -440
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +4131 -2228
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +28 -1
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +88 -10
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/held-writes.d.ts +16 -3
- package/dist/src/held-writes.d.ts.map +1 -1
- package/dist/src/held-writes.js +16 -3
- package/dist/src/held-writes.js.map +1 -1
- package/dist/src/index.d.ts +6 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -8
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +471 -75
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +1673 -337
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts +12 -7
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- package/dist/src/mcpl/conversation-router.js +12 -7
- package/dist/src/mcpl/conversation-router.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts.map +1 -1
- package/dist/src/mcpl/convert-block.js +9 -5
- package/dist/src/mcpl/convert-block.js.map +1 -1
- package/dist/src/mcpl/inbound-source.d.ts +50 -0
- package/dist/src/mcpl/inbound-source.d.ts.map +1 -1
- package/dist/src/mcpl/inbound-source.js +130 -0
- package/dist/src/mcpl/inbound-source.js.map +1 -1
- package/dist/src/mcpl/index.d.ts +2 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +3 -2
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/log-value.d.ts +6 -0
- package/dist/src/mcpl/log-value.d.ts.map +1 -1
- package/dist/src/mcpl/log-value.js +8 -0
- package/dist/src/mcpl/log-value.js.map +1 -1
- package/dist/src/mcpl/modern-connection.d.ts +15 -6
- package/dist/src/mcpl/modern-connection.d.ts.map +1 -1
- package/dist/src/mcpl/modern-connection.js +168 -53
- package/dist/src/mcpl/modern-connection.js.map +1 -1
- package/dist/src/mcpl/prose-grammar.d.ts +4 -5
- package/dist/src/mcpl/prose-grammar.d.ts.map +1 -1
- package/dist/src/mcpl/prose-grammar.js +4 -5
- package/dist/src/mcpl/prose-grammar.js.map +1 -1
- package/dist/src/mcpl/protocol-family.d.ts +97 -10
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
- package/dist/src/mcpl/protocol-family.js +173 -16
- package/dist/src/mcpl/protocol-family.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +132 -14
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +227 -50
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +6 -1
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js +4 -1
- package/dist/src/mcpl/push-handler.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +2 -2
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +4 -4
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +50 -21
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +158 -74
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/tags.d.ts +24 -0
- package/dist/src/mcpl/tags.d.ts.map +1 -1
- package/dist/src/mcpl/tags.js +33 -0
- package/dist/src/mcpl/tags.js.map +1 -1
- package/dist/src/mcpl/tool-result-normalize.d.ts +2 -1
- package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -1
- package/dist/src/mcpl/tool-result-normalize.js.map +1 -1
- package/dist/src/mcpl/transport.d.ts +55 -7
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +163 -34
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +22 -6
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/module-registry.d.ts +4 -2
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +100 -13
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +8 -13
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +27 -4
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +15 -3
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +27 -5
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/index.d.ts +1 -1
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js.map +1 -1
- package/dist/src/modules/unknown-tool.d.ts +4 -1
- package/dist/src/modules/unknown-tool.d.ts.map +1 -1
- package/dist/src/modules/unknown-tool.js +4 -1
- package/dist/src/modules/unknown-tool.js.map +1 -1
- package/dist/src/modules/workspace/branch-intent.d.ts +3 -1
- package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -1
- package/dist/src/modules/workspace/branch-intent.js +3 -1
- package/dist/src/modules/workspace/branch-intent.js.map +1 -1
- package/dist/src/modules/workspace/edit-plan.d.ts +265 -0
- package/dist/src/modules/workspace/edit-plan.d.ts.map +1 -0
- package/dist/src/modules/workspace/edit-plan.js +794 -0
- package/dist/src/modules/workspace/edit-plan.js.map +1 -0
- package/dist/src/modules/workspace/edit-text.d.ts +117 -0
- package/dist/src/modules/workspace/edit-text.d.ts.map +1 -0
- package/dist/src/modules/workspace/edit-text.js +584 -0
- package/dist/src/modules/workspace/edit-text.js.map +1 -0
- package/dist/src/modules/workspace/effects.d.ts +5 -4
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +78 -25
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +484 -61
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +2173 -645
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +213 -38
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +416 -36
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
- package/dist/src/modules/workspace/reconcile.js +15 -8
- package/dist/src/modules/workspace/reconcile.js.map +1 -1
- package/dist/src/modules/workspace/text.d.ts +32 -0
- package/dist/src/modules/workspace/text.d.ts.map +1 -0
- package/dist/src/modules/workspace/text.js +67 -0
- package/dist/src/modules/workspace/text.js.map +1 -0
- package/dist/src/modules/workspace/types.d.ts +210 -6
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.js.map +1 -1
- package/dist/src/modules/workspace/watcher.d.ts +3 -2
- package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
- package/dist/src/modules/workspace/watcher.js.map +1 -1
- package/dist/src/operator-log.d.ts +52 -24
- package/dist/src/operator-log.d.ts.map +1 -1
- package/dist/src/operator-log.js.map +1 -1
- package/dist/src/recovery/discord-awareness-outbox.d.ts +496 -72
- package/dist/src/recovery/discord-awareness-outbox.d.ts.map +1 -1
- package/dist/src/recovery/discord-awareness-outbox.js +1196 -289
- package/dist/src/recovery/discord-awareness-outbox.js.map +1 -1
- package/dist/src/recovery/offline-branch.d.ts +26 -1
- package/dist/src/recovery/offline-branch.d.ts.map +1 -1
- package/dist/src/recovery/offline-branch.js +164 -39
- package/dist/src/recovery/offline-branch.js.map +1 -1
- package/dist/src/recovery/recover-cli.js +23 -4
- package/dist/src/recovery/recover-cli.js.map +1 -1
- package/dist/src/send-tools.d.ts +11 -0
- package/dist/src/send-tools.d.ts.map +1 -0
- package/dist/src/send-tools.js +11 -0
- package/dist/src/send-tools.js.map +1 -0
- package/dist/src/tool-result-guard.d.ts +4 -3
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +5 -4
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tool-result-history.d.ts +1 -1
- package/dist/src/tool-result-history.js +1 -1
- package/dist/src/tune-out/coordinator.d.ts +21 -0
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +139 -37
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/types/agent.d.ts +4 -0
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +62 -9
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +62 -58
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +40 -8
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +111 -10
- package/dist/src/types/trace.d.ts.map +1 -1
- package/dist/src/usage/types.d.ts +16 -0
- package/dist/src/usage/types.d.ts.map +1 -1
- package/dist/src/usage/usage-tracker.d.ts +14 -1
- package/dist/src/usage/usage-tracker.d.ts.map +1 -1
- package/dist/src/usage/usage-tracker.js +81 -41
- package/dist/src/usage/usage-tracker.js.map +1 -1
- package/package.json +6 -5
- package/src/agent.ts +93 -12
- package/src/api/server.ts +14 -12
- package/src/code-execution/engine.ts +595 -0
- package/src/code-execution/index.ts +5 -17
- package/src/code-execution/isolate/calls.ts +199 -0
- package/src/code-execution/isolate/child-entry.ts +5 -0
- package/src/code-execution/isolate/child-main.ts +132 -0
- package/src/code-execution/isolate/child.ts +327 -0
- package/src/code-execution/isolate/frames.ts +209 -0
- package/src/code-execution/isolate/output.ts +161 -0
- package/src/code-execution/isolate/prelude.ts +409 -0
- package/src/code-execution/isolate/protocol.ts +240 -0
- package/src/code-execution/isolate/render.ts +230 -0
- package/src/code-execution/isolate/runner.ts +911 -0
- package/src/code-execution/isolate/scripts.ts +479 -0
- package/src/code-execution/quickjs.wasm +0 -0
- package/src/code-execution/quickjs.wasm.LICENSES +149 -0
- package/src/code-execution/tool-definition.ts +236 -167
- package/src/deadline-timer.ts +1 -1
- package/src/framework.ts +4507 -2406
- package/src/gate/event-gate.ts +78 -11
- package/src/held-writes.ts +17 -3
- package/src/index.ts +30 -22
- package/src/mcpl/channel-registry.ts +1825 -368
- package/src/mcpl/conversation-router.ts +12 -7
- package/src/mcpl/convert-block.ts +9 -5
- package/src/mcpl/inbound-source.ts +131 -0
- package/src/mcpl/index.ts +4 -2
- package/src/mcpl/log-value.ts +9 -0
- package/src/mcpl/modern-connection.ts +162 -53
- package/src/mcpl/prose-grammar.ts +4 -5
- package/src/mcpl/protocol-family.ts +199 -21
- package/src/mcpl/push-coalescer.ts +306 -62
- package/src/mcpl/push-handler.ts +10 -2
- package/src/mcpl/reference-fetcher.ts +4 -4
- package/src/mcpl/server-connection.ts +180 -79
- package/src/mcpl/tags.ts +36 -0
- package/src/mcpl/tool-result-normalize.ts +2 -1
- package/src/mcpl/transport.ts +162 -33
- package/src/mcpl/types.ts +23 -6
- package/src/module-registry.ts +92 -13
- package/src/modules/discord/index.ts +8 -13
- package/src/modules/history/index.ts +25 -3
- package/src/modules/history/semantic.ts +29 -6
- package/src/modules/index.ts +1 -0
- package/src/modules/unknown-tool.ts +4 -1
- package/src/modules/workspace/branch-intent.ts +3 -1
- package/src/modules/workspace/edit-plan.ts +954 -0
- package/src/modules/workspace/edit-text.ts +618 -0
- package/src/modules/workspace/effects.ts +70 -19
- package/src/modules/workspace/index.ts +2247 -642
- package/src/modules/workspace/observe.ts +465 -56
- package/src/modules/workspace/reconcile.ts +14 -7
- package/src/modules/workspace/text.ts +68 -0
- package/src/modules/workspace/types.ts +211 -6
- package/src/modules/workspace/watcher.ts +3 -2
- package/src/operator-log.ts +47 -19
- package/src/recovery/discord-awareness-outbox.ts +1500 -356
- package/src/recovery/offline-branch.ts +189 -55
- package/src/recovery/recover-cli.ts +25 -4
- package/src/send-tools.ts +11 -0
- package/src/tool-result-guard.ts +6 -5
- package/src/tool-result-history.ts +1 -1
- package/src/tune-out/coordinator.ts +163 -42
- package/src/types/agent.ts +4 -0
- package/src/types/events.ts +62 -9
- package/src/types/framework.ts +62 -58
- package/src/types/module.ts +40 -8
- package/src/types/trace.ts +121 -15
- package/src/usage/types.ts +16 -0
- package/src/usage/usage-tracker.ts +86 -43
- package/dist/src/code-execution/py-runner.d.ts +0 -191
- package/dist/src/code-execution/py-runner.d.ts.map +0 -1
- package/dist/src/code-execution/py-runner.js +0 -655
- package/dist/src/code-execution/py-runner.js.map +0 -1
- package/dist/src/code-execution/runtime-py.d.ts +0 -50
- package/dist/src/code-execution/runtime-py.d.ts.map +0 -1
- package/dist/src/code-execution/runtime-py.js +0 -677
- package/dist/src/code-execution/runtime-py.js.map +0 -1
- package/dist/src/mcpl/prose-stream-router.d.ts +0 -88
- package/dist/src/mcpl/prose-stream-router.d.ts.map +0 -1
- package/dist/src/mcpl/prose-stream-router.js +0 -291
- package/dist/src/mcpl/prose-stream-router.js.map +0 -1
- package/src/code-execution/py-runner.ts +0 -791
- package/src/code-execution/runtime-py.ts +0 -677
- package/src/mcpl/prose-stream-router.ts +0 -268
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A script's call record, kept in the parent, outside the child, so losing
|
|
3
|
+
* the child loses none of it. A call goes in at
|
|
4
|
+
* dispatch, as running until it's answered. Answered calls are counted; those
|
|
5
|
+
* whose answer the script didn't see are named, with their arguments, so an
|
|
6
|
+
* agent can tell which effects may have taken place. A script can live a day,
|
|
7
|
+
* so the record is bounded: it names at most CALLS_NAMED and counts the rest
|
|
8
|
+
* by tool, and it holds a counted call only while it runs. A named call stays
|
|
9
|
+
* until the script ends, and its state can still change after the call ends,
|
|
10
|
+
* as when a timed-out call's answer comes.
|
|
11
|
+
*/
|
|
12
|
+
/** A call's arguments, or a later answer's start, as a return names it: at most this many characters. */
|
|
13
|
+
export declare const CALL_BRIEF_CHARS = 120;
|
|
14
|
+
/** How many calls whose answer the script didn't see a return names; it counts the rest by tool. */
|
|
15
|
+
export declare const CALLS_NAMED = 10;
|
|
16
|
+
/** How a return names a tool, as the agent writes it in a script. */
|
|
17
|
+
export declare const toolRef: (tool: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* A copy of `text` that shares no storage with it. A slice of a string can
|
|
20
|
+
* keep the whole string it was cut from alive, in V8 and in JavaScriptCore, so
|
|
21
|
+
* a short piece kept from a long text is copied first.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fresh(text: string): string;
|
|
24
|
+
/** `text` cut to CALL_BRIEF_CHARS with "…", never between a surrogate pair's halves, as a copy of its own. */
|
|
25
|
+
export declare function callBrief(text: string): string;
|
|
26
|
+
/** A call whose answer the script didn't see, as a return names it. */
|
|
27
|
+
export interface NamedCall {
|
|
28
|
+
tool: string;
|
|
29
|
+
/** Its arguments as the script sent them, cut to CALL_BRIEF_CHARS. */
|
|
30
|
+
args: string;
|
|
31
|
+
/**
|
|
32
|
+
* - `uncertain`: still running when the script ended, so it may or may not take effect.
|
|
33
|
+
* - `timed-out`: no answer came within the call's timeout, so it may still take effect. The script was given a TimeoutError, unless it ended before reading it.
|
|
34
|
+
* - `timed-out-answered`: no answer came within the call's timeout, and one came later; `answer` is its start.
|
|
35
|
+
* - `too-large`: answered, with a result the script couldn't receive (too large for its memory, or nested too deep), so it got ResultTooLarge in its place.
|
|
36
|
+
* - `unseen`: answered, and the script was stopped or crashed before it read the answer.
|
|
37
|
+
*/
|
|
38
|
+
state: 'uncertain' | 'timed-out' | 'timed-out-answered' | 'too-large' | 'unseen';
|
|
39
|
+
/** For `timed-out-answered`: the answer's start, cut to CALL_BRIEF_CHARS. */
|
|
40
|
+
answer?: string;
|
|
41
|
+
}
|
|
42
|
+
/** The record as a return reports it. */
|
|
43
|
+
export interface CallSummary {
|
|
44
|
+
/** Calls the script made. */
|
|
45
|
+
made: number;
|
|
46
|
+
/** Answered while the script waited, with a result that wasn't an error. */
|
|
47
|
+
answered: number;
|
|
48
|
+
/** Answered while the script waited, with a result marked as an error. */
|
|
49
|
+
failed: number;
|
|
50
|
+
/** Refused before they ran: nothing was done. */
|
|
51
|
+
refused: number;
|
|
52
|
+
/** Never sent, so nothing was done: they timed out while they waited for room in the host, the run ended while they waited, or the host read them once the script's process had exited. */
|
|
53
|
+
unsent: number;
|
|
54
|
+
/** Still in flight, the script waiting on them. */
|
|
55
|
+
running: number;
|
|
56
|
+
/** Waiting their turn in the host, not sent yet: calls waiting for room, and wakes waiting for theirs. */
|
|
57
|
+
waiting: number;
|
|
58
|
+
/** Those whose answer the script didn't see, the first CALLS_NAMED of them, in the order each became so. */
|
|
59
|
+
named: NamedCall[];
|
|
60
|
+
/** The rest of those, counted by tool. */
|
|
61
|
+
more: Record<string, number>;
|
|
62
|
+
}
|
|
63
|
+
/** How a call that the script waited on was answered. */
|
|
64
|
+
export type CallOutcome = 'answered' | 'failed' | 'refused' | 'too-large';
|
|
65
|
+
/** One call the record still follows, held by the caller between its start and its end. */
|
|
66
|
+
export interface CallEntry {
|
|
67
|
+
readonly tool: string;
|
|
68
|
+
readonly args: string;
|
|
69
|
+
/** Set once the call has a place among the named, so a later answer can say what it was. */
|
|
70
|
+
named: NamedCall | null;
|
|
71
|
+
/** True once the call's timeout passed with no answer: the script is given a TimeoutError, unless it ended before reading it. */
|
|
72
|
+
timedOut: boolean;
|
|
73
|
+
/** True once the record holds the call's last word. */
|
|
74
|
+
done: boolean;
|
|
75
|
+
}
|
|
76
|
+
export declare class CallLog {
|
|
77
|
+
private made;
|
|
78
|
+
private readonly counts;
|
|
79
|
+
private readonly running;
|
|
80
|
+
/** Timed-out calls among the named whose answer hasn't come: it can still be named, until the script ends. */
|
|
81
|
+
private readonly awaiting;
|
|
82
|
+
private readonly named;
|
|
83
|
+
private readonly more;
|
|
84
|
+
/** A call went out: it's running until it's answered. */
|
|
85
|
+
start(tool: string, argsJson: string): CallEntry;
|
|
86
|
+
/**
|
|
87
|
+
* A call or wake the script made was never sent, so nothing was done: a
|
|
88
|
+
* call that timed out while it waited for room in the host, or that the run
|
|
89
|
+
* ended, or its process exited, before it went out, and one read after the
|
|
90
|
+
* process exited; a wake still waiting for its turn when the run ended, or
|
|
91
|
+
* once a stop was asked or the process exited.
|
|
92
|
+
*/
|
|
93
|
+
unsent(): void;
|
|
94
|
+
/** The call's timeout passed with no answer, and the script is given a TimeoutError. Its answer may still come. */
|
|
95
|
+
timedOut(entry: CallEntry): void;
|
|
96
|
+
/** The call's answer came. `brief` is the start of what the tool answered, for a call the script stopped waiting for. */
|
|
97
|
+
answered(entry: CallEntry, outcome: CallOutcome, brief: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* The call was answered, and the script ended before it read the answer: a
|
|
100
|
+
* refusal did nothing, and is counted; any other answer is named.
|
|
101
|
+
*/
|
|
102
|
+
unseen(entry: CallEntry, outcome: CallOutcome): void;
|
|
103
|
+
/**
|
|
104
|
+
* The script ended: every call still running may or may not take effect,
|
|
105
|
+
* and the record stays as it stands, so it names the calls as the host saw
|
|
106
|
+
* them when the script ended.
|
|
107
|
+
*/
|
|
108
|
+
ended(): void;
|
|
109
|
+
/** The record, with `waiting` calls the host holds back, for room or a wake's turn, which the script has made too. */
|
|
110
|
+
summary(waiting?: number): CallSummary;
|
|
111
|
+
/** A place among the named, or a count by tool past CALLS_NAMED. */
|
|
112
|
+
private name;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../../../src/code-execution/isolate/calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,yGAAyG;AACzG,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,oGAAoG;AACpG,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,q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S,GAAG,IAAI,CAAC;IACxB,iIAAiI;IACjI,QAAQ,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,IAAI,EAAE,OAAO,CAAC;CACf;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqD;IAC5E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,8GAA8G;IAC9G,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA6B;IAElD,yDAAyD;IACzD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAK/C;IAED;;;;;;OAMG;IACH,MAAM,IAAI,IAAI,CAGb;IAED,mHAAmH;IACnH,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAO/B;IAED,yHAAyH;IACzH,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAcpE;IAED;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAOnD;IAED;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAQZ;IAED,sHAAsH;IACtH,OAAO,CAAC,OAAO,SAAI,GAAG,WAAW,CAShC;IAED,oEAAoE;IACpE,OAAO,CAAC,IAAI;CASb"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A script's call record, kept in the parent, outside the child, so losing
|
|
3
|
+
* the child loses none of it. A call goes in at
|
|
4
|
+
* dispatch, as running until it's answered. Answered calls are counted; those
|
|
5
|
+
* whose answer the script didn't see are named, with their arguments, so an
|
|
6
|
+
* agent can tell which effects may have taken place. A script can live a day,
|
|
7
|
+
* so the record is bounded: it names at most CALLS_NAMED and counts the rest
|
|
8
|
+
* by tool, and it holds a counted call only while it runs. A named call stays
|
|
9
|
+
* until the script ends, and its state can still change after the call ends,
|
|
10
|
+
* as when a timed-out call's answer comes.
|
|
11
|
+
*/
|
|
12
|
+
/** A call's arguments, or a later answer's start, as a return names it: at most this many characters. */
|
|
13
|
+
export const CALL_BRIEF_CHARS = 120;
|
|
14
|
+
/** How many calls whose answer the script didn't see a return names; it counts the rest by tool. */
|
|
15
|
+
export const CALLS_NAMED = 10;
|
|
16
|
+
/** How a return names a tool, as the agent writes it in a script. */
|
|
17
|
+
export const toolRef = (tool) => (tool === 'wake_agent' ? 'wake_agent()' : `tools[${JSON.stringify(tool)}]`);
|
|
18
|
+
/**
|
|
19
|
+
* A copy of `text` that shares no storage with it. A slice of a string can
|
|
20
|
+
* keep the whole string it was cut from alive, in V8 and in JavaScriptCore, so
|
|
21
|
+
* a short piece kept from a long text is copied first.
|
|
22
|
+
*/
|
|
23
|
+
export function fresh(text) {
|
|
24
|
+
return JSON.parse(JSON.stringify(text));
|
|
25
|
+
}
|
|
26
|
+
/** `text` cut to CALL_BRIEF_CHARS with "…", never between a surrogate pair's halves, as a copy of its own. */
|
|
27
|
+
export function callBrief(text) {
|
|
28
|
+
if (text.length <= CALL_BRIEF_CHARS)
|
|
29
|
+
return fresh(text);
|
|
30
|
+
let cut = CALL_BRIEF_CHARS - 1;
|
|
31
|
+
const before = text.charCodeAt(cut - 1);
|
|
32
|
+
if (before >= 0xd800 && before <= 0xdbff)
|
|
33
|
+
cut -= 1;
|
|
34
|
+
return fresh(`${text.slice(0, cut)}…`);
|
|
35
|
+
}
|
|
36
|
+
export class CallLog {
|
|
37
|
+
made = 0;
|
|
38
|
+
counts = { answered: 0, failed: 0, refused: 0, unsent: 0 };
|
|
39
|
+
running = new Set();
|
|
40
|
+
/** Timed-out calls among the named whose answer hasn't come: it can still be named, until the script ends. */
|
|
41
|
+
awaiting = new Set();
|
|
42
|
+
named = [];
|
|
43
|
+
more = new Map();
|
|
44
|
+
/** A call went out: it's running until it's answered. */
|
|
45
|
+
start(tool, argsJson) {
|
|
46
|
+
this.made += 1;
|
|
47
|
+
const entry = { tool, args: callBrief(argsJson), named: null, timedOut: false, done: false };
|
|
48
|
+
this.running.add(entry);
|
|
49
|
+
return entry;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A call or wake the script made was never sent, so nothing was done: a
|
|
53
|
+
* call that timed out while it waited for room in the host, or that the run
|
|
54
|
+
* ended, or its process exited, before it went out, and one read after the
|
|
55
|
+
* process exited; a wake still waiting for its turn when the run ended, or
|
|
56
|
+
* once a stop was asked or the process exited.
|
|
57
|
+
*/
|
|
58
|
+
unsent() {
|
|
59
|
+
this.made += 1;
|
|
60
|
+
this.counts.unsent += 1;
|
|
61
|
+
}
|
|
62
|
+
/** The call's timeout passed with no answer, and the script is given a TimeoutError. Its answer may still come. */
|
|
63
|
+
timedOut(entry) {
|
|
64
|
+
if (entry.done || entry.timedOut)
|
|
65
|
+
return;
|
|
66
|
+
entry.timedOut = true;
|
|
67
|
+
this.running.delete(entry);
|
|
68
|
+
entry.named = this.name(entry, 'timed-out');
|
|
69
|
+
if (entry.named)
|
|
70
|
+
this.awaiting.add(entry);
|
|
71
|
+
else
|
|
72
|
+
entry.done = true;
|
|
73
|
+
}
|
|
74
|
+
/** The call's answer came. `brief` is the start of what the tool answered, for a call the script stopped waiting for. */
|
|
75
|
+
answered(entry, outcome, brief) {
|
|
76
|
+
if (entry.done)
|
|
77
|
+
return;
|
|
78
|
+
entry.done = true;
|
|
79
|
+
this.running.delete(entry);
|
|
80
|
+
this.awaiting.delete(entry);
|
|
81
|
+
if (entry.timedOut) {
|
|
82
|
+
if (entry.named) {
|
|
83
|
+
entry.named.state = 'timed-out-answered';
|
|
84
|
+
entry.named.answer = callBrief(brief);
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (outcome === 'too-large')
|
|
89
|
+
this.name(entry, 'too-large');
|
|
90
|
+
else
|
|
91
|
+
this.counts[outcome] += 1;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The call was answered, and the script ended before it read the answer: a
|
|
95
|
+
* refusal did nothing, and is counted; any other answer is named.
|
|
96
|
+
*/
|
|
97
|
+
unseen(entry, outcome) {
|
|
98
|
+
if (entry.done)
|
|
99
|
+
return;
|
|
100
|
+
entry.done = true;
|
|
101
|
+
this.running.delete(entry);
|
|
102
|
+
this.awaiting.delete(entry);
|
|
103
|
+
if (outcome === 'refused')
|
|
104
|
+
this.counts.refused += 1;
|
|
105
|
+
else
|
|
106
|
+
this.name(entry, 'unseen');
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The script ended: every call still running may or may not take effect,
|
|
110
|
+
* and the record stays as it stands, so it names the calls as the host saw
|
|
111
|
+
* them when the script ended.
|
|
112
|
+
*/
|
|
113
|
+
ended() {
|
|
114
|
+
for (const entry of this.running) {
|
|
115
|
+
entry.done = true;
|
|
116
|
+
this.name(entry, 'uncertain');
|
|
117
|
+
}
|
|
118
|
+
this.running.clear();
|
|
119
|
+
for (const entry of this.awaiting)
|
|
120
|
+
entry.done = true;
|
|
121
|
+
this.awaiting.clear();
|
|
122
|
+
}
|
|
123
|
+
/** The record, with `waiting` calls the host holds back, for room or a wake's turn, which the script has made too. */
|
|
124
|
+
summary(waiting = 0) {
|
|
125
|
+
return {
|
|
126
|
+
made: this.made + waiting,
|
|
127
|
+
...this.counts,
|
|
128
|
+
running: this.running.size,
|
|
129
|
+
waiting,
|
|
130
|
+
named: this.named.map((c) => ({ ...c })),
|
|
131
|
+
more: Object.fromEntries(this.more),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** A place among the named, or a count by tool past CALLS_NAMED. */
|
|
135
|
+
name(entry, state) {
|
|
136
|
+
if (this.named.length < CALLS_NAMED) {
|
|
137
|
+
const named = { tool: entry.tool, args: entry.args, state };
|
|
138
|
+
this.named.push(named);
|
|
139
|
+
return named;
|
|
140
|
+
}
|
|
141
|
+
this.more.set(entry.tool, (this.more.get(entry.tool) ?? 0) + 1);
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=calls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.js","sourceRoot":"","sources":["../../../../src/code-execution/isolate/calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,yGAAyG;AACzG,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,oGAAoG;AACpG,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,qEAAqE;AACrE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE7H;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAW,CAAC;AACpD,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,IAAI,CAAC,MAAM,IAAI,gBAAgB;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;IACxD,IAAI,GAAG,GAAG,gBAAgB,GAAG,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACxC,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM;QAAE,GAAG,IAAI,CAAC,CAAC;IACnD,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC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AG,CAAC,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child-entry.d.ts","sourceRoot":"","sources":["../../../../src/code-execution/isolate/child-entry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child-entry.js","sourceRoot":"","sources":["../../../../src/code-execution/isolate/child-entry.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,SAAS,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The child's process: reads the parent's frames on stdin, writes its own on
|
|
3
|
+
* fd 3, runs the script with the engine, and exits. Spawned by the parent with
|
|
4
|
+
* the parent's own runtime (`process.execPath`), Node's or Bun's.
|
|
5
|
+
*
|
|
6
|
+
* The channel is the one way that works the same under both runtimes, as
|
|
7
|
+
* probes under Bun 1.4.3, Node 24.19.0 and Node 20.20.2 showed: a socket on
|
|
8
|
+
* another fd reads nothing under Bun, and a file stream on one leaves Node's
|
|
9
|
+
* exit waiting on a blocked read. The child writes with `writeSync`, since its slots run while
|
|
10
|
+
* the engine is mid-call, and output has to reach the parent while a guest
|
|
11
|
+
* computes without queuing in memory.
|
|
12
|
+
*
|
|
13
|
+
* `runChildProcess` takes the engine loader so a test can spawn a child whose
|
|
14
|
+
* engine is a stand-in; the entry the parent spawns in production passes the
|
|
15
|
+
* engine's binding.
|
|
16
|
+
*/
|
|
17
|
+
import { type LoadEngine } from './child.js';
|
|
18
|
+
export declare function runChildProcess(loadEngine: LoadEngine): Promise<number>;
|
|
19
|
+
/**
|
|
20
|
+
* The child's process as the parent spawns it: run the script, and exit. An
|
|
21
|
+
* engine that fails, rather than the script, ends the child with its reason
|
|
22
|
+
* on one line of stderr, which the parent puts in the crash it reports; any
|
|
23
|
+
* other throw is a fault here, and its stack goes there instead.
|
|
24
|
+
*/
|
|
25
|
+
export declare function childMain(loadEngine: LoadEngine): void;
|
|
26
|
+
//# sourceMappingURL=child-main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child-main.d.ts","sourceRoot":"","sources":["../../../../src/code-execution/isolate/child-main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAuErE,wBAAsB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB7E;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAatD"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The child's process: reads the parent's frames on stdin, writes its own on
|
|
3
|
+
* fd 3, runs the script with the engine, and exits. Spawned by the parent with
|
|
4
|
+
* the parent's own runtime (`process.execPath`), Node's or Bun's.
|
|
5
|
+
*
|
|
6
|
+
* The channel is the one way that works the same under both runtimes, as
|
|
7
|
+
* probes under Bun 1.4.3, Node 24.19.0 and Node 20.20.2 showed: a socket on
|
|
8
|
+
* another fd reads nothing under Bun, and a file stream on one leaves Node's
|
|
9
|
+
* exit waiting on a blocked read. The child writes with `writeSync`, since its slots run while
|
|
10
|
+
* the engine is mid-call, and output has to reach the parent while a guest
|
|
11
|
+
* computes without queuing in memory.
|
|
12
|
+
*
|
|
13
|
+
* `runChildProcess` takes the engine loader so a test can spawn a child whose
|
|
14
|
+
* engine is a stand-in; the entry the parent spawns in production passes the
|
|
15
|
+
* engine's binding.
|
|
16
|
+
*/
|
|
17
|
+
import { writeSync } from 'node:fs';
|
|
18
|
+
import { performance } from 'node:perf_hooks';
|
|
19
|
+
import { EngineError, MAX_MEMORY_BYTES } from '../engine.js';
|
|
20
|
+
import { runChild } from './child.js';
|
|
21
|
+
import { encodeFrame, FrameDecoder, RESULT_FRAME_OVERHEAD } from './frames.js';
|
|
22
|
+
import { MAX_CHILD_FRAME_BYTES } from './protocol.js';
|
|
23
|
+
const TO_PARENT_FD = 3;
|
|
24
|
+
/**
|
|
25
|
+
* The largest frame the child takes from its parent: a result as large as the
|
|
26
|
+
* largest memory can be given (a third of it, as the parent bounds a result),
|
|
27
|
+
* with its header. The parent is trusted; this only bounds a broken one.
|
|
28
|
+
*/
|
|
29
|
+
const MAX_PARENT_FRAME_BYTES = Math.floor(MAX_MEMORY_BYTES / 3) + RESULT_FRAME_OVERHEAD;
|
|
30
|
+
/** A shared buffer to wait on, so a full pipe is retried after a short sleep without the event loop. */
|
|
31
|
+
const sleeper = new Int32Array(new SharedArrayBuffer(4));
|
|
32
|
+
/** Write all of `buf` to `fd`, synchronously, waiting a moment when the pipe is full. */
|
|
33
|
+
function writeAll(fd, buf) {
|
|
34
|
+
let offset = 0;
|
|
35
|
+
while (offset < buf.length) {
|
|
36
|
+
try {
|
|
37
|
+
offset += writeSync(fd, buf, offset, buf.length - offset);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
const code = err.code;
|
|
41
|
+
if (code !== 'EAGAIN' && code !== 'EWOULDBLOCK')
|
|
42
|
+
throw err;
|
|
43
|
+
Atomics.wait(sleeper, 0, 0, 1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** The parent's frames, as messages, from the child's stdin. The parent's frames are trusted: a bad one ends the child. */
|
|
48
|
+
function parentFrames() {
|
|
49
|
+
const decoder = new FrameDecoder(MAX_PARENT_FRAME_BYTES, true);
|
|
50
|
+
const queue = [];
|
|
51
|
+
let ended = false;
|
|
52
|
+
let failure = null;
|
|
53
|
+
let wake = null;
|
|
54
|
+
const stream = process.stdin;
|
|
55
|
+
stream.on('data', (chunk) => {
|
|
56
|
+
try {
|
|
57
|
+
for (const value of decoder.push(chunk))
|
|
58
|
+
queue.push(value);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
failure = err;
|
|
62
|
+
}
|
|
63
|
+
wake?.();
|
|
64
|
+
});
|
|
65
|
+
const finish = () => {
|
|
66
|
+
ended = true;
|
|
67
|
+
wake?.();
|
|
68
|
+
};
|
|
69
|
+
stream.on('end', finish);
|
|
70
|
+
stream.on('error', (err) => {
|
|
71
|
+
failure = err;
|
|
72
|
+
finish();
|
|
73
|
+
});
|
|
74
|
+
return async () => {
|
|
75
|
+
for (;;) {
|
|
76
|
+
if (failure)
|
|
77
|
+
throw failure;
|
|
78
|
+
const next = queue.shift();
|
|
79
|
+
if (next)
|
|
80
|
+
return next;
|
|
81
|
+
if (ended)
|
|
82
|
+
return null;
|
|
83
|
+
await new Promise((resolve) => {
|
|
84
|
+
wake = () => {
|
|
85
|
+
wake = null;
|
|
86
|
+
resolve();
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export async function runChildProcess(loadEngine) {
|
|
93
|
+
const next = parentFrames();
|
|
94
|
+
const first = await next();
|
|
95
|
+
if (first === null)
|
|
96
|
+
return 0;
|
|
97
|
+
if (first.t !== 'start')
|
|
98
|
+
throw new Error('the first frame from the parent was not a start');
|
|
99
|
+
const start = first;
|
|
100
|
+
const io = {
|
|
101
|
+
next,
|
|
102
|
+
// Against the parent's cap, so the two can't drift apart.
|
|
103
|
+
send: (message) => writeAll(TO_PARENT_FD, encodeFrame(message, MAX_CHILD_FRAME_BYTES)),
|
|
104
|
+
now: () => performance.now(),
|
|
105
|
+
// On Linux and macOS an orphan is reparented, so its parent's pid isn't
|
|
106
|
+
// the one the start named once its parent has gone, even if that went
|
|
107
|
+
// before this ran. Windows keeps the pid, so an orphan isn't seen there.
|
|
108
|
+
parentGone: () => process.ppid !== start.parentPid,
|
|
109
|
+
orphaned: () => process.exit(0),
|
|
110
|
+
};
|
|
111
|
+
await runChild(io, start, loadEngine);
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The child's process as the parent spawns it: run the script, and exit. An
|
|
116
|
+
* engine that fails, rather than the script, ends the child with its reason
|
|
117
|
+
* on one line of stderr, which the parent puts in the crash it reports; any
|
|
118
|
+
* other throw is a fault here, and its stack goes there instead.
|
|
119
|
+
*/
|
|
120
|
+
export function childMain(loadEngine) {
|
|
121
|
+
runChildProcess(loadEngine).then((code) => process.exit(code), (err) => {
|
|
122
|
+
// Written at once: a write to a pipe is asynchronous on macOS, and the exit would drop it.
|
|
123
|
+
try {
|
|
124
|
+
writeSync(2, err instanceof EngineError ? `${err.message}\n` : `${err instanceof Error ? err.stack : String(err)}\n`);
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// The parent learns of the crash from the exit either way.
|
|
128
|
+
}
|
|
129
|
+
process.exit(1);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=child-main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child-main.js","sourceRoot":"","sources":["../../../../src/code-execution/isolate/child-main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAiC,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAyC,MAAM,eAAe,CAAC;AAE7F,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB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AY;QAClB,IAAI;QACJ,0DAA0D;QAC1D,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;QACtF,GAAG,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;QAC5B,wEAAwE;QACxE,sEAAsE;QACtE,yEAAyE;QACzE,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,SAAS;QAClD,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KAChC,CAAC;IACF,MAAM,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACtC,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,UAAsB;IAC9C,eAAe,CAAC,UAAU,CAAC,CAAC,IAAI,CAC9B,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5B,CAAC,GAAY,EAAE,EAAE;QACf,2FAA2F;QAC3F,IAAI,CAAC;YACH,SAAS,CAAC,CAAC,EAAE,GAAG,YAAY,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxH,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A script's child: one process per script, which runs it in the engine and
|
|
3
|
+
* answers the engine's four imports. It takes its start from the parent's
|
|
4
|
+
* first frame, sends each tool call to the parent and settles it with the
|
|
5
|
+
* parent's answer, flushes the output in bounded batches, and reports how the
|
|
6
|
+
* script ended. A crash it can't report: the parent sees that the child ended
|
|
7
|
+
* without saying how.
|
|
8
|
+
*
|
|
9
|
+
* Stopping: the parent creates the stop file and sends a stop frame. A
|
|
10
|
+
* computing guest's interrupt import sees the file, checked at most every few
|
|
11
|
+
* milliseconds, so a stop reaches a spinning guest without its event loop; an
|
|
12
|
+
* idle guest's child reads the frame. Why the stop was asked is the parent's
|
|
13
|
+
* to say, so the child reports only that the script stopped.
|
|
14
|
+
*/
|
|
15
|
+
import { type Engine, type EngineLimits, type EngineSlots } from '../engine.js';
|
|
16
|
+
import type { ParentMessage, StartMessage } from './protocol.js';
|
|
17
|
+
/** How often, at most, the interrupt import looks for the stop file. */
|
|
18
|
+
export declare const STOP_CHECK_MS = 3;
|
|
19
|
+
export type LoadEngine = (limits: EngineLimits, slots: EngineSlots) => Promise<Engine>;
|
|
20
|
+
export interface ChildIo {
|
|
21
|
+
/** The parent's frames, in order, each already decoded; done when the parent closes its end. */
|
|
22
|
+
next(): Promise<ParentMessage | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Send one message now, synchronously: the engine may be mid-call. A message
|
|
25
|
+
* too long for a frame throws its FrameError, and nothing is sent.
|
|
26
|
+
*/
|
|
27
|
+
send(message: unknown): void;
|
|
28
|
+
/** Milliseconds from some fixed point. */
|
|
29
|
+
now(): number;
|
|
30
|
+
/** Whether the parent has gone, so no one is left to stop the script or read its ending. */
|
|
31
|
+
parentGone?(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* End the child's process at once, its parent having gone: nothing it does
|
|
34
|
+
* reaches anyone, its unsent output included, and nothing is left to kill
|
|
35
|
+
* it if its guest keeps a stop from ending it. The child looks for its
|
|
36
|
+
* parent at the engine's interrupt checks, at most once a stop check
|
|
37
|
+
* (`STOP_CHECK_MS`), after a stop as before one. Without this, the child
|
|
38
|
+
* stops its guest instead.
|
|
39
|
+
*/
|
|
40
|
+
orphaned?(): never;
|
|
41
|
+
}
|
|
42
|
+
/** Run the script `start` names to its end. Resolves once its ending is sent, or when the parent closes the channel. */
|
|
43
|
+
export declare function runChild(io: ChildIo, start: StartMessage, loadEngine: LoadEngine): Promise<void>;
|
|
44
|
+
//# sourceMappingURL=child.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child.d.ts","sourceRoot":"","sources":["../../../../src/code-execution/isolate/child.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAoB,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAmC,MAAM,cAAc,CAAC;AAKnI,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEjE,wEAAwE;AACxE,eAAO,MAAM,aAAa,IAAI,CAAC;AAS/B,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEvF,MAAM,WAAW,OAAO;IACtB,gGAAgG;IAChG,IAAI,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACtC;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,0CAA0C;IAC1C,GAAG,IAAI,MAAM,CAAC;IACd,4FAA4F;IAC5F,UAAU,CAAC,IAAI,OAAO,CAAC;IACvB;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,KAAK,CAAC;CACpB;AAYD,wHAAwH;AACxH,wBAAsB,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAmOtG"}
|