@assemblyline-agents/runtime 1.0.0 → 3.0.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 +1 -1
- package/dist/a2a-client.d.ts +22 -0
- package/dist/a2a-client.d.ts.map +1 -0
- package/dist/a2a-client.js +211 -0
- package/dist/a2a-client.js.map +1 -0
- package/dist/agent-capability-snapshot.d.ts +32 -0
- package/dist/agent-capability-snapshot.d.ts.map +1 -0
- package/dist/agent-capability-snapshot.js +77 -0
- package/dist/agent-capability-snapshot.js.map +1 -0
- package/dist/agent-event-handlers.d.ts +21 -0
- package/dist/agent-event-handlers.d.ts.map +1 -0
- package/dist/agent-event-handlers.js +64 -0
- package/dist/agent-event-handlers.js.map +1 -0
- package/dist/agent-hook-context.d.ts +8 -0
- package/dist/agent-hook-context.d.ts.map +1 -0
- package/dist/agent-hook-context.js +29 -0
- package/dist/agent-hook-context.js.map +1 -0
- package/dist/agent-hook-evaluation.d.ts +61 -0
- package/dist/agent-hook-evaluation.d.ts.map +1 -0
- package/dist/agent-hook-evaluation.js +197 -0
- package/dist/agent-hook-evaluation.js.map +1 -0
- package/dist/agent-hook-run-lifecycle.d.ts +44 -0
- package/dist/agent-hook-run-lifecycle.d.ts.map +1 -0
- package/dist/agent-hook-run-lifecycle.js +76 -0
- package/dist/agent-hook-run-lifecycle.js.map +1 -0
- package/dist/agent-state.d.ts +31 -0
- package/dist/agent-state.d.ts.map +1 -0
- package/dist/agent-state.js +80 -0
- package/dist/agent-state.js.map +1 -0
- package/dist/agent-surface.d.ts +32 -0
- package/dist/agent-surface.d.ts.map +1 -0
- package/dist/agent-surface.js +85 -0
- package/dist/agent-surface.js.map +1 -0
- package/dist/attachments.d.ts +5 -1
- package/dist/attachments.d.ts.map +1 -1
- package/dist/attachments.js +58 -32
- package/dist/attachments.js.map +1 -1
- package/dist/audience.d.ts +30 -0
- package/dist/audience.d.ts.map +1 -0
- package/dist/audience.js +68 -0
- package/dist/audience.js.map +1 -0
- package/dist/authored-hooks.d.ts +6 -0
- package/dist/authored-hooks.d.ts.map +1 -0
- package/dist/authored-hooks.js +17 -0
- package/dist/authored-hooks.js.map +1 -0
- package/dist/automation-event-match.d.ts +8 -0
- package/dist/automation-event-match.d.ts.map +1 -0
- package/dist/automation-event-match.js +25 -0
- package/dist/automation-event-match.js.map +1 -0
- package/dist/background-review-trigger.d.ts +9 -0
- package/dist/background-review-trigger.d.ts.map +1 -0
- package/dist/background-review-trigger.js +72 -0
- package/dist/background-review-trigger.js.map +1 -0
- package/dist/background-review-types.d.ts +60 -0
- package/dist/background-review-types.d.ts.map +1 -0
- package/dist/background-review-types.js +2 -0
- package/dist/background-review-types.js.map +1 -0
- package/dist/background-review-worker.d.ts +14 -0
- package/dist/background-review-worker.d.ts.map +1 -0
- package/dist/background-review-worker.js +61 -0
- package/dist/background-review-worker.js.map +1 -0
- package/dist/background-review.d.ts +5 -0
- package/dist/background-review.d.ts.map +1 -0
- package/dist/background-review.js +332 -0
- package/dist/background-review.js.map +1 -0
- package/dist/builtin-tool-executors.d.ts +50 -27
- package/dist/builtin-tool-executors.d.ts.map +1 -1
- package/dist/builtin-tool-executors.js +332 -124
- package/dist/builtin-tool-executors.js.map +1 -1
- package/dist/builtin-tools.d.ts +16 -9
- package/dist/builtin-tools.d.ts.map +1 -1
- package/dist/builtin-tools.js +308 -116
- package/dist/builtin-tools.js.map +1 -1
- package/dist/capability-catalog.d.ts +3 -2
- package/dist/capability-catalog.d.ts.map +1 -1
- package/dist/capability-catalog.js +12 -7
- package/dist/capability-catalog.js.map +1 -1
- package/dist/capability-inspection.d.ts +31 -0
- package/dist/capability-inspection.d.ts.map +1 -0
- package/dist/capability-inspection.js +58 -0
- package/dist/capability-inspection.js.map +1 -0
- package/dist/channel-http-util.d.ts.map +1 -1
- package/dist/channel-http-util.js +6 -5
- package/dist/channel-http-util.js.map +1 -1
- package/dist/channel-ingress.d.ts +16 -1
- package/dist/channel-ingress.d.ts.map +1 -1
- package/dist/channel-ingress.js +152 -14
- package/dist/channel-ingress.js.map +1 -1
- package/dist/channel.d.ts +73 -3
- package/dist/channel.d.ts.map +1 -1
- package/dist/checkpoints.d.ts +1 -1
- package/dist/checkpoints.d.ts.map +1 -1
- package/dist/checkpoints.js +6 -6
- package/dist/checkpoints.js.map +1 -1
- package/dist/child-process-env.d.ts +7 -0
- package/dist/child-process-env.d.ts.map +1 -0
- package/dist/child-process-env.js +41 -0
- package/dist/child-process-env.js.map +1 -0
- package/dist/computer-relay-protocol.d.ts.map +1 -1
- package/dist/computer-relay-protocol.js +4 -4
- package/dist/computer-relay-protocol.js.map +1 -1
- package/dist/concurrency.d.ts +1 -1
- package/dist/concurrency.js +1 -1
- package/dist/connection-auth-util.d.ts +1 -0
- package/dist/connection-auth-util.d.ts.map +1 -1
- package/dist/connection-auth-util.js +3 -1
- package/dist/connection-auth-util.js.map +1 -1
- package/dist/connection-clients.d.ts +11 -3
- package/dist/connection-clients.d.ts.map +1 -1
- package/dist/connection-clients.js +71 -8
- package/dist/connection-clients.js.map +1 -1
- package/dist/connection-event-store.d.ts +98 -0
- package/dist/connection-event-store.d.ts.map +1 -0
- package/dist/connection-event-store.js +162 -0
- package/dist/connection-event-store.js.map +1 -0
- package/dist/connection-events.d.ts +51 -0
- package/dist/connection-events.d.ts.map +1 -0
- package/dist/connection-events.js +343 -0
- package/dist/connection-events.js.map +1 -0
- package/dist/connection-stores.d.ts +6 -0
- package/dist/connection-stores.d.ts.map +1 -1
- package/dist/connection-stores.js +20 -1
- package/dist/connection-stores.js.map +1 -1
- package/dist/connection-util.d.ts +3 -2
- package/dist/connection-util.d.ts.map +1 -1
- package/dist/connection-util.js +18 -1
- package/dist/connection-util.js.map +1 -1
- package/dist/connections.d.ts +60 -5
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +390 -57
- package/dist/connections.js.map +1 -1
- package/dist/context-policy-util.d.ts.map +1 -1
- package/dist/context-policy-util.js +1 -3
- package/dist/context-policy-util.js.map +1 -1
- package/dist/conversation-context.d.ts +9 -4
- package/dist/conversation-context.d.ts.map +1 -1
- package/dist/conversation-context.js +65 -19
- package/dist/conversation-context.js.map +1 -1
- package/dist/conversation-transcript.d.ts +8 -5
- package/dist/conversation-transcript.d.ts.map +1 -1
- package/dist/conversation-transcript.js +24 -5
- package/dist/conversation-transcript.js.map +1 -1
- package/dist/conversation-turn-coalescing.d.ts +22 -0
- package/dist/conversation-turn-coalescing.d.ts.map +1 -0
- package/dist/conversation-turn-coalescing.js +121 -0
- package/dist/conversation-turn-coalescing.js.map +1 -0
- package/dist/conversation-turn-dispatch.d.ts +5 -2
- package/dist/conversation-turn-dispatch.d.ts.map +1 -1
- package/dist/conversation-turn-dispatch.js +59 -22
- package/dist/conversation-turn-dispatch.js.map +1 -1
- package/dist/default-outbound-route.d.ts +29 -0
- package/dist/default-outbound-route.d.ts.map +1 -0
- package/dist/default-outbound-route.js +105 -0
- package/dist/default-outbound-route.js.map +1 -0
- package/dist/delivery-artifacts.d.ts +2 -0
- package/dist/delivery-artifacts.d.ts.map +1 -0
- package/dist/delivery-artifacts.js +34 -0
- package/dist/delivery-artifacts.js.map +1 -0
- package/dist/delivery-files.d.ts +5 -0
- package/dist/delivery-files.d.ts.map +1 -0
- package/dist/delivery-files.js +33 -0
- package/dist/delivery-files.js.map +1 -0
- package/dist/delivery-queue.d.ts +21 -1
- package/dist/delivery-queue.d.ts.map +1 -1
- package/dist/delivery-queue.js +144 -1
- package/dist/delivery-queue.js.map +1 -1
- package/dist/delivery-send.d.ts +2 -2
- package/dist/delivery-send.d.ts.map +1 -1
- package/dist/delivery-send.js +256 -100
- package/dist/delivery-send.js.map +1 -1
- package/dist/durable-files.d.ts +37 -0
- package/dist/durable-files.d.ts.map +1 -0
- package/dist/durable-files.js +63 -0
- package/dist/durable-files.js.map +1 -0
- package/dist/harness-loop.d.ts +18 -9
- package/dist/harness-loop.d.ts.map +1 -1
- package/dist/harness-loop.js +245 -50
- package/dist/harness-loop.js.map +1 -1
- package/dist/heic-transcode-worker.d.ts +2 -0
- package/dist/heic-transcode-worker.d.ts.map +1 -0
- package/dist/heic-transcode-worker.js +59 -0
- package/dist/heic-transcode-worker.js.map +1 -0
- package/dist/heic-transcode.d.ts +18 -0
- package/dist/heic-transcode.d.ts.map +1 -0
- package/dist/heic-transcode.js +99 -0
- package/dist/heic-transcode.js.map +1 -0
- package/dist/human-input-routing.d.ts +22 -0
- package/dist/human-input-routing.d.ts.map +1 -0
- package/dist/human-input-routing.js +26 -0
- package/dist/human-input-routing.js.map +1 -0
- package/dist/in-memory-agent-state-store.d.ts +21 -0
- package/dist/in-memory-agent-state-store.d.ts.map +1 -0
- package/dist/in-memory-agent-state-store.js +97 -0
- package/dist/in-memory-agent-state-store.js.map +1 -0
- package/dist/in-memory-conversation-turn-store.d.ts +3 -1
- package/dist/in-memory-conversation-turn-store.d.ts.map +1 -1
- package/dist/in-memory-conversation-turn-store.js +41 -2
- package/dist/in-memory-conversation-turn-store.js.map +1 -1
- package/dist/in-memory-run-store.d.ts +8 -0
- package/dist/in-memory-run-store.d.ts.map +1 -1
- package/dist/in-memory-run-store.js +28 -5
- package/dist/in-memory-run-store.js.map +1 -1
- package/dist/in-memory-sandbox-session-store.d.ts +2 -1
- package/dist/in-memory-sandbox-session-store.d.ts.map +1 -1
- package/dist/in-memory-sandbox-session-store.js +65 -1
- package/dist/in-memory-sandbox-session-store.js.map +1 -1
- package/dist/in-memory-small-stores.d.ts +18 -1
- package/dist/in-memory-small-stores.d.ts.map +1 -1
- package/dist/in-memory-small-stores.js +107 -1
- package/dist/in-memory-small-stores.js.map +1 -1
- package/dist/in-memory-workspace-store.d.ts +40 -0
- package/dist/in-memory-workspace-store.d.ts.map +1 -0
- package/dist/in-memory-workspace-store.js +370 -0
- package/dist/in-memory-workspace-store.js.map +1 -0
- package/dist/index.d.ts +116 -45
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +637 -566
- package/dist/index.js.map +1 -1
- package/dist/json-util.d.ts +8 -0
- package/dist/json-util.d.ts.map +1 -1
- package/dist/json-util.js +8 -0
- package/dist/json-util.js.map +1 -1
- package/dist/learning-store.d.ts +111 -0
- package/dist/learning-store.d.ts.map +1 -0
- package/dist/learning-store.js +193 -0
- package/dist/learning-store.js.map +1 -0
- package/dist/local-sandbox.d.ts +3 -2
- package/dist/local-sandbox.d.ts.map +1 -1
- package/dist/local-sandbox.js +69 -25
- package/dist/local-sandbox.js.map +1 -1
- package/dist/mcp-client.d.ts.map +1 -1
- package/dist/mcp-client.js +3 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/media-processor.d.ts +42 -0
- package/dist/media-processor.d.ts.map +1 -0
- package/dist/media-processor.js +2 -0
- package/dist/media-processor.js.map +1 -0
- package/dist/model-media.d.ts +13 -1
- package/dist/model-media.d.ts.map +1 -1
- package/dist/model-media.js +81 -18
- package/dist/model-media.js.map +1 -1
- package/dist/model-visible-interrupts.d.ts +10 -0
- package/dist/model-visible-interrupts.d.ts.map +1 -0
- package/dist/model-visible-interrupts.js +41 -0
- package/dist/model-visible-interrupts.js.map +1 -0
- package/dist/operator-controls.d.ts.map +1 -1
- package/dist/operator-controls.js +16 -3
- package/dist/operator-controls.js.map +1 -1
- package/dist/outbound-http-policy.d.ts +7 -0
- package/dist/outbound-http-policy.d.ts.map +1 -0
- package/dist/outbound-http-policy.js +155 -0
- package/dist/outbound-http-policy.js.map +1 -0
- package/dist/principals.d.ts +18 -0
- package/dist/principals.d.ts.map +1 -0
- package/dist/principals.js +90 -0
- package/dist/principals.js.map +1 -0
- package/dist/public-api.d.ts +21 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +19 -0
- package/dist/public-api.js.map +1 -0
- package/dist/replay-resume.d.ts +15 -3
- package/dist/replay-resume.d.ts.map +1 -1
- package/dist/replay-resume.js +256 -24
- package/dist/replay-resume.js.map +1 -1
- package/dist/resource-projection-util.d.ts +1 -1
- package/dist/resource-projection-util.d.ts.map +1 -1
- package/dist/resource-projection-util.js +21 -10
- package/dist/resource-projection-util.js.map +1 -1
- package/dist/resource-projection.d.ts +8 -1
- package/dist/resource-projection.d.ts.map +1 -1
- package/dist/resource-projection.js +230 -26
- package/dist/resource-projection.js.map +1 -1
- package/dist/run-heartbeat.d.ts +12 -2
- package/dist/run-heartbeat.d.ts.map +1 -1
- package/dist/run-heartbeat.js +31 -4
- package/dist/run-heartbeat.js.map +1 -1
- package/dist/run-outcome.d.ts +9 -5
- package/dist/run-outcome.d.ts.map +1 -1
- package/dist/run-outcome.js +16 -5
- package/dist/run-outcome.js.map +1 -1
- package/dist/run-recovery.d.ts +31 -2
- package/dist/run-recovery.d.ts.map +1 -1
- package/dist/run-recovery.js +211 -32
- package/dist/run-recovery.js.map +1 -1
- package/dist/run-replay.d.ts +35 -0
- package/dist/run-replay.d.ts.map +1 -0
- package/dist/run-replay.js +193 -0
- package/dist/run-replay.js.map +1 -0
- package/dist/run-result.d.ts +4 -0
- package/dist/run-result.d.ts.map +1 -0
- package/dist/run-result.js +18 -0
- package/dist/run-result.js.map +1 -0
- package/dist/run-timeline-query.d.ts +38 -0
- package/dist/run-timeline-query.d.ts.map +1 -0
- package/dist/run-timeline-query.js +99 -0
- package/dist/run-timeline-query.js.map +1 -0
- package/dist/runs-query.d.ts.map +1 -1
- package/dist/runs-query.js +12 -4
- package/dist/runs-query.js.map +1 -1
- package/dist/runtime-bundle.d.ts.map +1 -1
- package/dist/runtime-bundle.js +2 -0
- package/dist/runtime-bundle.js.map +1 -1
- package/dist/runtime-learning.d.ts +88 -0
- package/dist/runtime-learning.d.ts.map +1 -0
- package/dist/runtime-learning.js +260 -0
- package/dist/runtime-learning.js.map +1 -0
- package/dist/runtime-types.d.ts +79 -10
- package/dist/runtime-types.d.ts.map +1 -1
- package/dist/sandbox-fs.d.ts +9 -5
- package/dist/sandbox-fs.d.ts.map +1 -1
- package/dist/sandbox-fs.js +50 -33
- package/dist/sandbox-fs.js.map +1 -1
- package/dist/sandbox-handle.d.ts +25 -0
- package/dist/sandbox-handle.d.ts.map +1 -0
- package/dist/sandbox-handle.js +120 -0
- package/dist/sandbox-handle.js.map +1 -0
- package/dist/sandbox-session-identity.d.ts +14 -0
- package/dist/sandbox-session-identity.d.ts.map +1 -0
- package/dist/sandbox-session-identity.js +33 -0
- package/dist/sandbox-session-identity.js.map +1 -0
- package/dist/sandbox-session-key.d.ts.map +1 -1
- package/dist/sandbox-session-key.js +14 -10
- package/dist/sandbox-session-key.js.map +1 -1
- package/dist/sandbox-session-lifecycle.d.ts +12 -0
- package/dist/sandbox-session-lifecycle.d.ts.map +1 -0
- package/dist/sandbox-session-lifecycle.js +261 -0
- package/dist/sandbox-session-lifecycle.js.map +1 -0
- package/dist/sandbox-snapshot-policy.js +3 -3
- package/dist/sandbox-snapshot-policy.js.map +1 -1
- package/dist/sandbox-state-sync.d.ts +22 -0
- package/dist/sandbox-state-sync.d.ts.map +1 -0
- package/dist/sandbox-state-sync.js +147 -0
- package/dist/sandbox-state-sync.js.map +1 -0
- package/dist/sandbox-sync-worker.d.ts +11 -2
- package/dist/sandbox-sync-worker.d.ts.map +1 -1
- package/dist/sandbox-sync-worker.js +143 -31
- package/dist/sandbox-sync-worker.js.map +1 -1
- package/dist/schedule-execution.d.ts.map +1 -1
- package/dist/schedule-execution.js +187 -57
- package/dist/schedule-execution.js.map +1 -1
- package/dist/sdk-api-client.d.ts +17 -0
- package/dist/sdk-api-client.d.ts.map +1 -0
- package/dist/sdk-api-client.js +55 -0
- package/dist/sdk-api-client.js.map +1 -0
- package/dist/security.js +2 -2
- package/dist/security.js.map +1 -1
- package/dist/self-improvement.d.ts +34 -6
- package/dist/self-improvement.d.ts.map +1 -1
- package/dist/self-improvement.js +140 -34
- package/dist/self-improvement.js.map +1 -1
- package/dist/skill-bundles.d.ts +55 -0
- package/dist/skill-bundles.d.ts.map +1 -0
- package/dist/skill-bundles.js +134 -0
- package/dist/skill-bundles.js.map +1 -0
- package/dist/source-loader.d.ts +8 -0
- package/dist/source-loader.d.ts.map +1 -1
- package/dist/source-loader.js +41 -10
- package/dist/source-loader.js.map +1 -1
- package/dist/state-store-helpers.d.ts +2 -0
- package/dist/state-store-helpers.d.ts.map +1 -1
- package/dist/state-store-helpers.js +11 -1
- package/dist/state-store-helpers.js.map +1 -1
- package/dist/state-stores.d.ts +2 -0
- package/dist/state-stores.d.ts.map +1 -1
- package/dist/state-stores.js +40 -7
- package/dist/state-stores.js.map +1 -1
- package/dist/state.d.ts +344 -5
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +44 -2
- package/dist/state.js.map +1 -1
- package/dist/storage.d.ts +59 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +183 -6
- package/dist/storage.js.map +1 -1
- package/dist/subagent-execution.d.ts +7 -6
- package/dist/subagent-execution.d.ts.map +1 -1
- package/dist/subagent-execution.js +58 -19
- package/dist/subagent-execution.js.map +1 -1
- package/dist/target-instructions.d.ts +14 -0
- package/dist/target-instructions.d.ts.map +1 -0
- package/dist/target-instructions.js +18 -0
- package/dist/target-instructions.js.map +1 -0
- package/dist/tool-apis.d.ts.map +1 -1
- package/dist/tool-apis.js +55 -10
- package/dist/tool-apis.js.map +1 -1
- package/dist/tool-execution.d.ts +26 -13
- package/dist/tool-execution.d.ts.map +1 -1
- package/dist/tool-execution.js +368 -239
- package/dist/tool-execution.js.map +1 -1
- package/dist/turn-media.d.ts +29 -0
- package/dist/turn-media.d.ts.map +1 -0
- package/dist/turn-media.js +233 -0
- package/dist/turn-media.js.map +1 -0
- package/dist/usage-reconciliation.d.ts +1 -1
- package/dist/usage-reconciliation.js +1 -1
- package/dist/workspace-id.d.ts +10 -0
- package/dist/workspace-id.d.ts.map +1 -0
- package/dist/workspace-id.js +55 -0
- package/dist/workspace-id.js.map +1 -0
- package/dist/workspace-manifest.d.ts +24 -0
- package/dist/workspace-manifest.d.ts.map +1 -0
- package/dist/workspace-manifest.js +111 -0
- package/dist/workspace-manifest.js.map +1 -0
- package/dist/workspace-operation-limiter.d.ts +16 -0
- package/dist/workspace-operation-limiter.d.ts.map +1 -0
- package/dist/workspace-operation-limiter.js +31 -0
- package/dist/workspace-operation-limiter.js.map +1 -0
- package/dist/workspace-operations.d.ts +145 -0
- package/dist/workspace-operations.d.ts.map +1 -0
- package/dist/workspace-operations.js +420 -0
- package/dist/workspace-operations.js.map +1 -0
- package/dist/workspace-runtime.d.ts +110 -0
- package/dist/workspace-runtime.d.ts.map +1 -0
- package/dist/workspace-runtime.js +240 -0
- package/dist/workspace-runtime.js.map +1 -0
- package/dist/workspace-search.d.ts +55 -0
- package/dist/workspace-search.d.ts.map +1 -0
- package/dist/workspace-search.js +262 -0
- package/dist/workspace-search.js.map +1 -0
- package/dist/workspace-service.d.ts +173 -0
- package/dist/workspace-service.d.ts.map +1 -0
- package/dist/workspace-service.js +619 -0
- package/dist/workspace-service.js.map +1 -0
- package/dist/workspace.d.ts +7 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +7 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +7 -4
- package/dist/agent-harness.d.ts +0 -108
- package/dist/agent-harness.d.ts.map +0 -1
- package/dist/agent-harness.js +0 -2
- package/dist/agent-harness.js.map +0 -1
- package/dist/attachments-legacy.d.ts +0 -17
- package/dist/attachments-legacy.d.ts.map +0 -1
- package/dist/attachments-legacy.js +0 -273
- package/dist/attachments-legacy.js.map +0 -1
- package/dist/code-mode.d.ts +0 -20
- package/dist/code-mode.d.ts.map +0 -1
- package/dist/code-mode.js +0 -658
- package/dist/code-mode.js.map +0 -1
- package/dist/hook-dispatch.d.ts +0 -19
- package/dist/hook-dispatch.d.ts.map +0 -1
- package/dist/hook-dispatch.js +0 -37
- package/dist/hook-dispatch.js.map +0 -1
- package/dist/pi-agent-harness.d.ts +0 -40
- package/dist/pi-agent-harness.d.ts.map +0 -1
- package/dist/pi-agent-harness.js +0 -222
- package/dist/pi-agent-harness.js.map +0 -1
- package/dist/pi-harness.d.ts +0 -42
- package/dist/pi-harness.d.ts.map +0 -1
- package/dist/pi-harness.js +0 -142
- package/dist/pi-harness.js.map +0 -1
- package/dist/run-resolver.d.ts +0 -35
- package/dist/run-resolver.d.ts.map +0 -1
- package/dist/run-resolver.js +0 -84
- package/dist/run-resolver.js.map +0 -1
- package/dist/usage-budget.d.ts +0 -29
- package/dist/usage-budget.d.ts.map +0 -1
- package/dist/usage-budget.js +0 -145
- package/dist/usage-budget.js.map +0 -1
package/dist/code-mode.js
DELETED
|
@@ -1,658 +0,0 @@
|
|
|
1
|
-
import { approvalNever } from "@openeve/core";
|
|
2
|
-
export const READ_TOOL_NAME = "read";
|
|
3
|
-
export const WRITE_TOOL_NAME = "write";
|
|
4
|
-
export const EDIT_TOOL_NAME = "edit";
|
|
5
|
-
export const DELETE_TOOL_NAME = "delete";
|
|
6
|
-
export const LIST_TOOL_NAME = "list";
|
|
7
|
-
export const GREP_TOOL_NAME = "grep";
|
|
8
|
-
export const BASH_TOOL_NAME = "bash";
|
|
9
|
-
export const ASK_QUESTION_TOOL_NAME = "ask_question";
|
|
10
|
-
export const SPAWN_SUBAGENT_TOOL_NAME = "spawn_subagent";
|
|
11
|
-
export const LOAD_SKILL_TOOL_NAME = "load_skill";
|
|
12
|
-
export const TOOL_SEARCH_TOOL_NAME = "tool_search";
|
|
13
|
-
export const TOOL_DESCRIBE_TOOL_NAME = "tool_describe";
|
|
14
|
-
export const TOOL_CALL_TOOL_NAME = "tool_call";
|
|
15
|
-
export const CORE_HARNESS_TOOL_NAMES = [
|
|
16
|
-
READ_TOOL_NAME,
|
|
17
|
-
WRITE_TOOL_NAME,
|
|
18
|
-
EDIT_TOOL_NAME,
|
|
19
|
-
DELETE_TOOL_NAME,
|
|
20
|
-
LIST_TOOL_NAME,
|
|
21
|
-
GREP_TOOL_NAME,
|
|
22
|
-
BASH_TOOL_NAME,
|
|
23
|
-
ASK_QUESTION_TOOL_NAME,
|
|
24
|
-
SPAWN_SUBAGENT_TOOL_NAME,
|
|
25
|
-
LOAD_SKILL_TOOL_NAME,
|
|
26
|
-
TOOL_SEARCH_TOOL_NAME,
|
|
27
|
-
TOOL_DESCRIBE_TOOL_NAME,
|
|
28
|
-
TOOL_CALL_TOOL_NAME
|
|
29
|
-
];
|
|
30
|
-
const CORE_HARNESS_TOOL_NAME_SET = new Set(CORE_HARNESS_TOOL_NAMES);
|
|
31
|
-
const BUILTIN_SOURCE = {
|
|
32
|
-
path: "__builtin__/harness",
|
|
33
|
-
sha256: "builtin-harness"
|
|
34
|
-
};
|
|
35
|
-
const PATH_SCHEMA = {
|
|
36
|
-
type: "string",
|
|
37
|
-
description: "Absolute sandbox path, such as /memory/notes.md, /skills/name/SKILL.md, /runtime/report.txt, or /workspace/app.ts."
|
|
38
|
-
};
|
|
39
|
-
const READ_COMPILED_TOOL = {
|
|
40
|
-
name: READ_TOOL_NAME,
|
|
41
|
-
description: "Read a file from the sandbox filesystem. Lazily hydrates logical OpenEve paths before reading.",
|
|
42
|
-
inputSchema: {
|
|
43
|
-
type: "object",
|
|
44
|
-
additionalProperties: false,
|
|
45
|
-
properties: {
|
|
46
|
-
path: PATH_SCHEMA,
|
|
47
|
-
maxBytes: { type: "number", description: "Maximum bytes to return. Defaults to 65536." }
|
|
48
|
-
},
|
|
49
|
-
required: ["path"]
|
|
50
|
-
},
|
|
51
|
-
needsApproval: approvalNever(),
|
|
52
|
-
defaultEnabled: true,
|
|
53
|
-
visibility: "always",
|
|
54
|
-
execution: "sandbox",
|
|
55
|
-
tags: ["filesystem", "sandbox", "read"],
|
|
56
|
-
aliases: ["read_file", "cat"],
|
|
57
|
-
hasToModelOutput: true,
|
|
58
|
-
source: BUILTIN_SOURCE
|
|
59
|
-
};
|
|
60
|
-
const WRITE_COMPILED_TOOL = {
|
|
61
|
-
name: WRITE_TOOL_NAME,
|
|
62
|
-
description: "Write a file in the sandbox filesystem. Mutations are durably queued for async sync before the write.",
|
|
63
|
-
inputSchema: {
|
|
64
|
-
type: "object",
|
|
65
|
-
additionalProperties: false,
|
|
66
|
-
properties: {
|
|
67
|
-
path: PATH_SCHEMA,
|
|
68
|
-
content: { type: "string", description: "File contents to write." },
|
|
69
|
-
contents: { type: "string", description: "Alias for content." },
|
|
70
|
-
encoding: { type: "string", enum: ["utf8", "base64"], description: "Input encoding. Defaults to utf8." }
|
|
71
|
-
},
|
|
72
|
-
required: ["path"]
|
|
73
|
-
},
|
|
74
|
-
needsApproval: approvalNever(),
|
|
75
|
-
defaultEnabled: true,
|
|
76
|
-
visibility: "always",
|
|
77
|
-
execution: "sandbox",
|
|
78
|
-
tags: ["filesystem", "sandbox", "write"],
|
|
79
|
-
aliases: ["write_file"],
|
|
80
|
-
hasToModelOutput: true,
|
|
81
|
-
source: BUILTIN_SOURCE
|
|
82
|
-
};
|
|
83
|
-
const EDIT_COMPILED_TOOL = {
|
|
84
|
-
name: EDIT_TOOL_NAME,
|
|
85
|
-
description: "Edit a sandbox file by replacing exact text. Hydrates the path first when it is a logical OpenEve resource.",
|
|
86
|
-
inputSchema: {
|
|
87
|
-
type: "object",
|
|
88
|
-
additionalProperties: false,
|
|
89
|
-
properties: {
|
|
90
|
-
path: PATH_SCHEMA,
|
|
91
|
-
search: { type: "string", description: "Exact text to replace." },
|
|
92
|
-
replace: { type: "string", description: "Replacement text." },
|
|
93
|
-
expectedOccurrences: { type: "number", description: "Optional exact occurrence count guard." },
|
|
94
|
-
all: { type: "boolean", description: "Replace all occurrences. Defaults to true." }
|
|
95
|
-
},
|
|
96
|
-
required: ["path", "search", "replace"]
|
|
97
|
-
},
|
|
98
|
-
needsApproval: approvalNever(),
|
|
99
|
-
defaultEnabled: true,
|
|
100
|
-
visibility: "always",
|
|
101
|
-
execution: "sandbox",
|
|
102
|
-
tags: ["filesystem", "sandbox", "edit"],
|
|
103
|
-
aliases: ["patch", "replace"],
|
|
104
|
-
hasToModelOutput: true,
|
|
105
|
-
source: BUILTIN_SOURCE
|
|
106
|
-
};
|
|
107
|
-
const DELETE_COMPILED_TOOL = {
|
|
108
|
-
name: DELETE_TOOL_NAME,
|
|
109
|
-
description: "Delete a writable sandbox file or directory and record a tombstone for durable async sync.",
|
|
110
|
-
inputSchema: {
|
|
111
|
-
type: "object",
|
|
112
|
-
additionalProperties: false,
|
|
113
|
-
properties: {
|
|
114
|
-
path: PATH_SCHEMA,
|
|
115
|
-
recursive: { type: "boolean", description: "Allow deleting directories recursively. Defaults to true." }
|
|
116
|
-
},
|
|
117
|
-
required: ["path"]
|
|
118
|
-
},
|
|
119
|
-
needsApproval: approvalNever(),
|
|
120
|
-
defaultEnabled: true,
|
|
121
|
-
visibility: "always",
|
|
122
|
-
execution: "sandbox",
|
|
123
|
-
tags: ["filesystem", "sandbox", "delete"],
|
|
124
|
-
aliases: ["rm", "remove"],
|
|
125
|
-
hasToModelOutput: true,
|
|
126
|
-
source: BUILTIN_SOURCE
|
|
127
|
-
};
|
|
128
|
-
const LIST_COMPILED_TOOL = {
|
|
129
|
-
name: LIST_TOOL_NAME,
|
|
130
|
-
description: "List files under a sandbox path. Lazily hydrates bounded logical OpenEve roots before listing.",
|
|
131
|
-
inputSchema: {
|
|
132
|
-
type: "object",
|
|
133
|
-
additionalProperties: false,
|
|
134
|
-
properties: {
|
|
135
|
-
path: PATH_SCHEMA,
|
|
136
|
-
limit: { type: "number", description: "Maximum entries. Defaults to 200." }
|
|
137
|
-
},
|
|
138
|
-
required: ["path"]
|
|
139
|
-
},
|
|
140
|
-
needsApproval: approvalNever(),
|
|
141
|
-
defaultEnabled: true,
|
|
142
|
-
visibility: "always",
|
|
143
|
-
execution: "sandbox",
|
|
144
|
-
tags: ["filesystem", "sandbox", "list"],
|
|
145
|
-
aliases: ["ls"],
|
|
146
|
-
hasToModelOutput: true,
|
|
147
|
-
source: BUILTIN_SOURCE
|
|
148
|
-
};
|
|
149
|
-
const GREP_COMPILED_TOOL = {
|
|
150
|
-
name: GREP_TOOL_NAME,
|
|
151
|
-
description: "Search files under a sandbox path with a regular expression or literal pattern.",
|
|
152
|
-
inputSchema: {
|
|
153
|
-
type: "object",
|
|
154
|
-
additionalProperties: false,
|
|
155
|
-
properties: {
|
|
156
|
-
pattern: { type: "string" },
|
|
157
|
-
path: PATH_SCHEMA,
|
|
158
|
-
literal: { type: "boolean", description: "Treat pattern as literal text. Defaults to false." },
|
|
159
|
-
limit: { type: "number", description: "Maximum matches. Defaults to 100." }
|
|
160
|
-
},
|
|
161
|
-
required: ["pattern"]
|
|
162
|
-
},
|
|
163
|
-
needsApproval: approvalNever(),
|
|
164
|
-
defaultEnabled: true,
|
|
165
|
-
visibility: "always",
|
|
166
|
-
execution: "sandbox",
|
|
167
|
-
tags: ["filesystem", "sandbox", "search"],
|
|
168
|
-
aliases: ["search", "rg"],
|
|
169
|
-
hasToModelOutput: true,
|
|
170
|
-
source: BUILTIN_SOURCE
|
|
171
|
-
};
|
|
172
|
-
const BASH_COMPILED_TOOL = {
|
|
173
|
-
name: BASH_TOOL_NAME,
|
|
174
|
-
description: "Run a Bash command in the sandbox. The sandbox is marked dirty and queued for async sync before execution.",
|
|
175
|
-
inputSchema: {
|
|
176
|
-
type: "object",
|
|
177
|
-
additionalProperties: false,
|
|
178
|
-
properties: {
|
|
179
|
-
command: { type: "string" },
|
|
180
|
-
cwd: { type: "string" },
|
|
181
|
-
timeoutMs: { type: "number" }
|
|
182
|
-
},
|
|
183
|
-
required: ["command"]
|
|
184
|
-
},
|
|
185
|
-
needsApproval: approvalNever(),
|
|
186
|
-
defaultEnabled: true,
|
|
187
|
-
visibility: "always",
|
|
188
|
-
execution: "sandbox",
|
|
189
|
-
tags: ["sandbox", "bash", "shell"],
|
|
190
|
-
aliases: ["shell", "terminal"],
|
|
191
|
-
hasToModelOutput: true,
|
|
192
|
-
source: BUILTIN_SOURCE
|
|
193
|
-
};
|
|
194
|
-
const ASK_QUESTION_COMPILED_TOOL = {
|
|
195
|
-
name: ASK_QUESTION_TOOL_NAME,
|
|
196
|
-
description: "Ask the user a concise clarifying question and pause the run until the answer is available.",
|
|
197
|
-
inputSchema: {
|
|
198
|
-
type: "object",
|
|
199
|
-
additionalProperties: false,
|
|
200
|
-
properties: {
|
|
201
|
-
question: { type: "string" },
|
|
202
|
-
choices: { type: "array", items: { type: "string" } },
|
|
203
|
-
allowFreeform: { type: "boolean" },
|
|
204
|
-
metadata: { type: "object", additionalProperties: true }
|
|
205
|
-
},
|
|
206
|
-
required: ["question"]
|
|
207
|
-
},
|
|
208
|
-
needsApproval: approvalNever(),
|
|
209
|
-
defaultEnabled: true,
|
|
210
|
-
visibility: "always",
|
|
211
|
-
execution: "direct",
|
|
212
|
-
tags: ["human", "question"],
|
|
213
|
-
aliases: ["clarify"],
|
|
214
|
-
hasToModelOutput: true,
|
|
215
|
-
source: BUILTIN_SOURCE
|
|
216
|
-
};
|
|
217
|
-
const SPAWN_SUBAGENT_COMPILED_TOOL = {
|
|
218
|
-
name: SPAWN_SUBAGENT_TOOL_NAME,
|
|
219
|
-
description: "Spawn a configured subagent by name for delegated work.",
|
|
220
|
-
inputSchema: {
|
|
221
|
-
type: "object",
|
|
222
|
-
additionalProperties: true,
|
|
223
|
-
properties: {
|
|
224
|
-
name: { type: "string", description: "Subagent name." },
|
|
225
|
-
task: { type: "string" },
|
|
226
|
-
expectedOutput: { type: "string" },
|
|
227
|
-
constraints: { type: "array", items: { type: "string" } }
|
|
228
|
-
},
|
|
229
|
-
required: ["name", "task"]
|
|
230
|
-
},
|
|
231
|
-
needsApproval: approvalNever(),
|
|
232
|
-
defaultEnabled: true,
|
|
233
|
-
visibility: "always",
|
|
234
|
-
execution: "direct",
|
|
235
|
-
tags: ["subagent", "delegate"],
|
|
236
|
-
aliases: ["delegate", "agent"],
|
|
237
|
-
hasToModelOutput: true,
|
|
238
|
-
source: BUILTIN_SOURCE
|
|
239
|
-
};
|
|
240
|
-
const LOAD_SKILL_COMPILED_TOOL = {
|
|
241
|
-
name: LOAD_SKILL_TOOL_NAME,
|
|
242
|
-
description: "Load a skill's full instructions by name from the durable skill store. Loading a skill does not reveal additional tools.",
|
|
243
|
-
inputSchema: {
|
|
244
|
-
type: "object",
|
|
245
|
-
additionalProperties: false,
|
|
246
|
-
properties: {
|
|
247
|
-
name: { type: "string", description: "Skill name, such as skill-creator." },
|
|
248
|
-
skillName: { type: "string", description: "Alias for name." }
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
needsApproval: approvalNever(),
|
|
252
|
-
defaultEnabled: true,
|
|
253
|
-
visibility: "always",
|
|
254
|
-
execution: "direct",
|
|
255
|
-
tags: ["skills", "instructions", "progressive-disclosure"],
|
|
256
|
-
aliases: ["skill_view", "load_instructions"],
|
|
257
|
-
hasToModelOutput: true,
|
|
258
|
-
source: BUILTIN_SOURCE
|
|
259
|
-
};
|
|
260
|
-
const TOOL_SEARCH_COMPILED_TOOL = {
|
|
261
|
-
name: TOOL_SEARCH_TOOL_NAME,
|
|
262
|
-
description: "Search deferred non-core tools by name, description, tags, aliases, or connection. Returns compact metadata only.",
|
|
263
|
-
inputSchema: {
|
|
264
|
-
type: "object",
|
|
265
|
-
additionalProperties: false,
|
|
266
|
-
properties: {
|
|
267
|
-
query: { type: "string" },
|
|
268
|
-
limit: { type: "number" },
|
|
269
|
-
kind: { type: "string" },
|
|
270
|
-
connection: { type: "string" }
|
|
271
|
-
},
|
|
272
|
-
required: ["query"]
|
|
273
|
-
},
|
|
274
|
-
needsApproval: approvalNever(),
|
|
275
|
-
defaultEnabled: true,
|
|
276
|
-
visibility: "always",
|
|
277
|
-
execution: "direct",
|
|
278
|
-
tags: ["tools", "deferred", "search"],
|
|
279
|
-
aliases: ["tools"],
|
|
280
|
-
hasToModelOutput: true,
|
|
281
|
-
source: BUILTIN_SOURCE
|
|
282
|
-
};
|
|
283
|
-
const TOOL_DESCRIBE_COMPILED_TOOL = {
|
|
284
|
-
name: TOOL_DESCRIBE_TOOL_NAME,
|
|
285
|
-
description: "Return the full schema for one deferred tool previously found with tool_search.",
|
|
286
|
-
inputSchema: {
|
|
287
|
-
type: "object",
|
|
288
|
-
additionalProperties: false,
|
|
289
|
-
properties: {
|
|
290
|
-
name: { type: "string" }
|
|
291
|
-
},
|
|
292
|
-
required: ["name"]
|
|
293
|
-
},
|
|
294
|
-
needsApproval: approvalNever(),
|
|
295
|
-
defaultEnabled: true,
|
|
296
|
-
visibility: "always",
|
|
297
|
-
execution: "direct",
|
|
298
|
-
tags: ["tools", "deferred", "describe"],
|
|
299
|
-
aliases: ["schema"],
|
|
300
|
-
hasToModelOutput: true,
|
|
301
|
-
source: BUILTIN_SOURCE
|
|
302
|
-
};
|
|
303
|
-
const TOOL_CALL_COMPILED_TOOL = {
|
|
304
|
-
name: TOOL_CALL_TOOL_NAME,
|
|
305
|
-
description: "Call a deferred non-core tool by name with JSON arguments. The underlying tool is logged and policy-checked directly.",
|
|
306
|
-
inputSchema: {
|
|
307
|
-
type: "object",
|
|
308
|
-
additionalProperties: false,
|
|
309
|
-
properties: {
|
|
310
|
-
name: { type: "string" },
|
|
311
|
-
arguments: { type: "object", additionalProperties: true },
|
|
312
|
-
input: { type: "object", additionalProperties: true }
|
|
313
|
-
},
|
|
314
|
-
required: ["name"]
|
|
315
|
-
},
|
|
316
|
-
needsApproval: approvalNever(),
|
|
317
|
-
defaultEnabled: true,
|
|
318
|
-
visibility: "always",
|
|
319
|
-
execution: "direct",
|
|
320
|
-
tags: ["tools", "deferred", "call"],
|
|
321
|
-
aliases: ["invoke"],
|
|
322
|
-
hasToModelOutput: true,
|
|
323
|
-
source: BUILTIN_SOURCE
|
|
324
|
-
};
|
|
325
|
-
const BUILT_IN_COMPILED_TOOLS = [
|
|
326
|
-
READ_COMPILED_TOOL,
|
|
327
|
-
WRITE_COMPILED_TOOL,
|
|
328
|
-
EDIT_COMPILED_TOOL,
|
|
329
|
-
DELETE_COMPILED_TOOL,
|
|
330
|
-
LIST_COMPILED_TOOL,
|
|
331
|
-
GREP_COMPILED_TOOL,
|
|
332
|
-
BASH_COMPILED_TOOL,
|
|
333
|
-
ASK_QUESTION_COMPILED_TOOL,
|
|
334
|
-
SPAWN_SUBAGENT_COMPILED_TOOL,
|
|
335
|
-
LOAD_SKILL_COMPILED_TOOL,
|
|
336
|
-
TOOL_SEARCH_COMPILED_TOOL,
|
|
337
|
-
TOOL_DESCRIBE_COMPILED_TOOL,
|
|
338
|
-
TOOL_CALL_COMPILED_TOOL
|
|
339
|
-
];
|
|
340
|
-
export function runtimeToolsForManifest(manifest) {
|
|
341
|
-
return [
|
|
342
|
-
...manifest.tools.filter((tool) => !CORE_HARNESS_TOOL_NAME_SET.has(tool.name)),
|
|
343
|
-
...BUILT_IN_COMPILED_TOOLS
|
|
344
|
-
];
|
|
345
|
-
}
|
|
346
|
-
export function builtInToolDefinition(name) {
|
|
347
|
-
if (name === READ_TOOL_NAME)
|
|
348
|
-
return readToolDefinition;
|
|
349
|
-
if (name === WRITE_TOOL_NAME)
|
|
350
|
-
return writeToolDefinition;
|
|
351
|
-
if (name === EDIT_TOOL_NAME)
|
|
352
|
-
return editToolDefinition;
|
|
353
|
-
if (name === DELETE_TOOL_NAME)
|
|
354
|
-
return deleteToolDefinition;
|
|
355
|
-
if (name === LIST_TOOL_NAME)
|
|
356
|
-
return listToolDefinition;
|
|
357
|
-
if (name === GREP_TOOL_NAME)
|
|
358
|
-
return grepToolDefinition;
|
|
359
|
-
if (name === BASH_TOOL_NAME)
|
|
360
|
-
return bashToolDefinition;
|
|
361
|
-
if (name === ASK_QUESTION_TOOL_NAME)
|
|
362
|
-
return askQuestionToolDefinition;
|
|
363
|
-
if (name === SPAWN_SUBAGENT_TOOL_NAME)
|
|
364
|
-
return spawnSubagentToolDefinition;
|
|
365
|
-
if (name === LOAD_SKILL_TOOL_NAME)
|
|
366
|
-
return runtimeHandledToolDefinition(LOAD_SKILL_COMPILED_TOOL);
|
|
367
|
-
if (name === TOOL_SEARCH_TOOL_NAME)
|
|
368
|
-
return runtimeHandledToolDefinition(TOOL_SEARCH_COMPILED_TOOL);
|
|
369
|
-
if (name === TOOL_DESCRIBE_TOOL_NAME)
|
|
370
|
-
return runtimeHandledToolDefinition(TOOL_DESCRIBE_COMPILED_TOOL);
|
|
371
|
-
if (name === TOOL_CALL_TOOL_NAME)
|
|
372
|
-
return runtimeHandledToolDefinition(TOOL_CALL_COMPILED_TOOL);
|
|
373
|
-
return undefined;
|
|
374
|
-
}
|
|
375
|
-
export function isBuiltInToolName(name) {
|
|
376
|
-
return CORE_HARNESS_TOOL_NAME_SET.has(name);
|
|
377
|
-
}
|
|
378
|
-
const readToolDefinition = {
|
|
379
|
-
...toolDefinitionBase(READ_COMPILED_TOOL),
|
|
380
|
-
async execute(input, ctx) {
|
|
381
|
-
const raw = recordInput(input);
|
|
382
|
-
const path = requiredPath(raw.path);
|
|
383
|
-
const maxBytes = boundedNumber(raw.maxBytes, 65_536, 1, 10 * 1024 * 1024);
|
|
384
|
-
await ctx.hydrateSandboxPath?.(path);
|
|
385
|
-
const sandbox = await ctx.getSandbox();
|
|
386
|
-
const contents = await sandbox.readFile(path);
|
|
387
|
-
const bytes = Buffer.from(contents);
|
|
388
|
-
const truncated = bytes.byteLength > maxBytes;
|
|
389
|
-
return {
|
|
390
|
-
path,
|
|
391
|
-
content: bytes.subarray(0, maxBytes).toString("utf8"),
|
|
392
|
-
bytes: bytes.byteLength,
|
|
393
|
-
truncated
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
const writeToolDefinition = {
|
|
398
|
-
...toolDefinitionBase(WRITE_COMPILED_TOOL),
|
|
399
|
-
async execute(input, ctx) {
|
|
400
|
-
const raw = recordInput(input);
|
|
401
|
-
const path = requiredWritablePath(raw.path);
|
|
402
|
-
const content = typeof raw.content === "string" ? raw.content : typeof raw.contents === "string" ? raw.contents : "";
|
|
403
|
-
const encoding = raw.encoding === "base64" ? "base64" : "utf8";
|
|
404
|
-
const bytes = encoding === "base64" ? Buffer.from(content, "base64") : content;
|
|
405
|
-
const sandbox = await ctx.getSandbox();
|
|
406
|
-
await sandbox.writeFile(path, bytes);
|
|
407
|
-
return {
|
|
408
|
-
path,
|
|
409
|
-
bytes: typeof bytes === "string" ? Buffer.byteLength(bytes) : bytes.byteLength,
|
|
410
|
-
encoding
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
const editToolDefinition = {
|
|
415
|
-
...toolDefinitionBase(EDIT_COMPILED_TOOL),
|
|
416
|
-
async execute(input, ctx) {
|
|
417
|
-
const raw = recordInput(input);
|
|
418
|
-
const path = requiredWritablePath(raw.path);
|
|
419
|
-
const search = typeof raw.search === "string" ? raw.search : "";
|
|
420
|
-
const replace = typeof raw.replace === "string" ? raw.replace : "";
|
|
421
|
-
if (!search)
|
|
422
|
-
throw new Error("edit requires a non-empty search string.");
|
|
423
|
-
await ctx.hydrateSandboxPath?.(path);
|
|
424
|
-
const sandbox = await ctx.getSandbox();
|
|
425
|
-
const original = await sandbox.readFile(path);
|
|
426
|
-
const occurrences = countOccurrences(original, search);
|
|
427
|
-
if (typeof raw.expectedOccurrences === "number" && occurrences !== raw.expectedOccurrences) {
|
|
428
|
-
throw new Error(`edit expected ${raw.expectedOccurrences} occurrences but found ${occurrences}.`);
|
|
429
|
-
}
|
|
430
|
-
if (occurrences === 0)
|
|
431
|
-
throw new Error(`edit found no occurrences in ${path}.`);
|
|
432
|
-
const all = raw.all !== false;
|
|
433
|
-
const updated = all ? original.split(search).join(replace) : original.replace(search, replace);
|
|
434
|
-
await sandbox.writeFile(path, updated);
|
|
435
|
-
return {
|
|
436
|
-
path,
|
|
437
|
-
occurrences,
|
|
438
|
-
replaced: all ? occurrences : 1,
|
|
439
|
-
bytes: Buffer.byteLength(updated)
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
const deleteToolDefinition = {
|
|
444
|
-
...toolDefinitionBase(DELETE_COMPILED_TOOL),
|
|
445
|
-
async execute(input, ctx) {
|
|
446
|
-
const raw = recordInput(input);
|
|
447
|
-
const path = requiredWritablePath(raw.path);
|
|
448
|
-
const sandbox = await ctx.getSandbox();
|
|
449
|
-
await ctx.recordSandboxTombstone?.(path);
|
|
450
|
-
const flag = raw.recursive === false ? "" : "-r";
|
|
451
|
-
const result = await sandbox.shell(`rm ${flag} -f -- ${shellQuote(path)}`.replace(/\s+/g, " ").trim());
|
|
452
|
-
if (result.exitCode !== 0)
|
|
453
|
-
throw new Error(result.stderr || `delete failed for ${path}`);
|
|
454
|
-
return { path, deleted: true };
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
const listToolDefinition = {
|
|
458
|
-
...toolDefinitionBase(LIST_COMPILED_TOOL),
|
|
459
|
-
async execute(input, ctx) {
|
|
460
|
-
const raw = recordInput(input);
|
|
461
|
-
const path = requiredPath(raw.path);
|
|
462
|
-
const limit = boundedNumber(raw.limit, 200, 1, 2000);
|
|
463
|
-
await ctx.hydrateSandboxPath?.(path, { list: true, limit });
|
|
464
|
-
const sandbox = await ctx.getSandbox();
|
|
465
|
-
const entries = await listSandboxEntries(sandbox, path, limit);
|
|
466
|
-
return { path, entries, count: entries.length, truncated: entries.length >= limit };
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
const grepToolDefinition = {
|
|
470
|
-
...toolDefinitionBase(GREP_COMPILED_TOOL),
|
|
471
|
-
async execute(input, ctx) {
|
|
472
|
-
const raw = recordInput(input);
|
|
473
|
-
const pattern = typeof raw.pattern === "string" ? raw.pattern : "";
|
|
474
|
-
if (!pattern)
|
|
475
|
-
throw new Error("grep requires a non-empty pattern.");
|
|
476
|
-
const path = typeof raw.path === "string" ? normalizeSandboxPath(raw.path) : "/workspace";
|
|
477
|
-
const limit = boundedNumber(raw.limit, 100, 1, 2000);
|
|
478
|
-
await ctx.hydrateSandboxPath?.(path, { list: true, limit });
|
|
479
|
-
const sandbox = await ctx.getSandbox();
|
|
480
|
-
const matches = await grepSandbox(sandbox, path, pattern, raw.literal === true, limit);
|
|
481
|
-
return { pattern, path, matches, count: matches.length, truncated: matches.length >= limit };
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
const bashToolDefinition = {
|
|
485
|
-
...toolDefinitionBase(BASH_COMPILED_TOOL),
|
|
486
|
-
async execute(input, ctx) {
|
|
487
|
-
const raw = recordInput(input);
|
|
488
|
-
const command = typeof raw.command === "string" ? raw.command : "";
|
|
489
|
-
if (!command.trim())
|
|
490
|
-
throw new Error("bash requires a non-empty command.");
|
|
491
|
-
const sandbox = await ctx.getSandbox();
|
|
492
|
-
const options = {};
|
|
493
|
-
if (typeof raw.cwd === "string")
|
|
494
|
-
options.cwd = raw.cwd;
|
|
495
|
-
if (typeof raw.timeoutMs === "number" && Number.isFinite(raw.timeoutMs))
|
|
496
|
-
options.timeoutMs = raw.timeoutMs;
|
|
497
|
-
return sandbox.shell(command, options);
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
const askQuestionToolDefinition = {
|
|
501
|
-
...toolDefinitionBase(ASK_QUESTION_COMPILED_TOOL),
|
|
502
|
-
async execute(input, ctx) {
|
|
503
|
-
const raw = recordInput(input);
|
|
504
|
-
const question = typeof raw.question === "string" ? raw.question.trim() : "";
|
|
505
|
-
if (!question)
|
|
506
|
-
throw new Error("ask_question requires a non-empty question.");
|
|
507
|
-
const options = {};
|
|
508
|
-
if (Array.isArray(raw.choices))
|
|
509
|
-
options.choices = raw.choices.map(String).filter(Boolean);
|
|
510
|
-
if (typeof raw.allowFreeform === "boolean")
|
|
511
|
-
options.allowFreeform = raw.allowFreeform;
|
|
512
|
-
if (raw.metadata && typeof raw.metadata === "object" && !Array.isArray(raw.metadata)) {
|
|
513
|
-
options.metadata = raw.metadata;
|
|
514
|
-
}
|
|
515
|
-
return ctx.askQuestion(question, options);
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
const spawnSubagentToolDefinition = {
|
|
519
|
-
...toolDefinitionBase(SPAWN_SUBAGENT_COMPILED_TOOL),
|
|
520
|
-
async execute(input, ctx) {
|
|
521
|
-
if (!ctx.spawnSubagent)
|
|
522
|
-
throw new Error("Subagent spawning is not available in this runtime.");
|
|
523
|
-
const raw = recordInput(input);
|
|
524
|
-
const name = typeof raw.name === "string" ? raw.name.trim() : "";
|
|
525
|
-
const task = typeof raw.task === "string" ? raw.task.trim() : "";
|
|
526
|
-
if (!name || !task)
|
|
527
|
-
throw new Error("spawn_subagent requires name and task.");
|
|
528
|
-
return ctx.spawnSubagent({
|
|
529
|
-
name,
|
|
530
|
-
task,
|
|
531
|
-
...(typeof raw.expectedOutput === "string" ? { expectedOutput: raw.expectedOutput } : {}),
|
|
532
|
-
...(Array.isArray(raw.constraints) ? { constraints: raw.constraints.map(String) } : {})
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
function toolDefinitionBase(tool) {
|
|
537
|
-
const definition = {
|
|
538
|
-
description: tool.description,
|
|
539
|
-
inputSchema: tool.inputSchema,
|
|
540
|
-
needsApproval: false,
|
|
541
|
-
defaultEnabled: tool.defaultEnabled,
|
|
542
|
-
capability: {
|
|
543
|
-
visibility: tool.visibility,
|
|
544
|
-
execution: tool.execution,
|
|
545
|
-
tags: tool.tags,
|
|
546
|
-
aliases: tool.aliases
|
|
547
|
-
},
|
|
548
|
-
toModelOutput(output) {
|
|
549
|
-
return output;
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
if (tool.outputSchema)
|
|
553
|
-
definition.outputSchema = tool.outputSchema;
|
|
554
|
-
return definition;
|
|
555
|
-
}
|
|
556
|
-
function runtimeHandledToolDefinition(tool) {
|
|
557
|
-
return {
|
|
558
|
-
...toolDefinitionBase(tool),
|
|
559
|
-
async execute() {
|
|
560
|
-
throw new Error(`${tool.name} is handled by the OpenEve runtime dispatcher.`);
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
function recordInput(input) {
|
|
565
|
-
if (input && typeof input === "object" && !Array.isArray(input))
|
|
566
|
-
return input;
|
|
567
|
-
return {};
|
|
568
|
-
}
|
|
569
|
-
function requiredPath(value) {
|
|
570
|
-
if (typeof value !== "string" || value.trim().length === 0)
|
|
571
|
-
throw new Error("path is required.");
|
|
572
|
-
return normalizeSandboxPath(value);
|
|
573
|
-
}
|
|
574
|
-
function requiredWritablePath(value) {
|
|
575
|
-
const path = requiredPath(value);
|
|
576
|
-
if (path === "/history" || path.startsWith("/history/") || path === "/files" || path.startsWith("/files/")) {
|
|
577
|
-
throw new Error(`${path} is read-only.`);
|
|
578
|
-
}
|
|
579
|
-
return path;
|
|
580
|
-
}
|
|
581
|
-
function normalizeSandboxPath(path) {
|
|
582
|
-
const normalized = path.replace(/\\/g, "/").replace(/\/+/g, "/").trim();
|
|
583
|
-
const absolute = normalized.startsWith("/") ? normalized : `/${normalized}`;
|
|
584
|
-
if (absolute.split("/").some((part) => part === ".."))
|
|
585
|
-
throw new Error(`Invalid sandbox path: ${path}`);
|
|
586
|
-
return absolute === "/" ? "/" : absolute.replace(/\/$/u, "");
|
|
587
|
-
}
|
|
588
|
-
function boundedNumber(value, fallback, min, max) {
|
|
589
|
-
if (typeof value !== "number" || !Number.isFinite(value))
|
|
590
|
-
return fallback;
|
|
591
|
-
return Math.max(min, Math.min(max, Math.floor(value)));
|
|
592
|
-
}
|
|
593
|
-
async function listSandboxEntries(sandbox, path, limit) {
|
|
594
|
-
if (!sandbox.listFiles)
|
|
595
|
-
throw new Error("This sandbox adapter does not support file listing.");
|
|
596
|
-
const entries = await sandbox.listFiles(path);
|
|
597
|
-
return entries.slice(0, limit).map((entry) => {
|
|
598
|
-
const out = { path: entry.path };
|
|
599
|
-
if (entry.size !== undefined)
|
|
600
|
-
out.size = entry.size;
|
|
601
|
-
return out;
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
async function grepSandbox(sandbox, path, pattern, literal, limit) {
|
|
605
|
-
if (!sandbox.listFiles)
|
|
606
|
-
throw new Error("This sandbox adapter does not support grep without file listing.");
|
|
607
|
-
const entries = await sandbox.listFiles(path);
|
|
608
|
-
const matches = [];
|
|
609
|
-
const regexp = literal ? undefined : new RegExp(pattern, "u");
|
|
610
|
-
for (const entry of entries) {
|
|
611
|
-
if (matches.length >= limit)
|
|
612
|
-
break;
|
|
613
|
-
const contents = entryContents(entry);
|
|
614
|
-
if (contents === undefined)
|
|
615
|
-
continue;
|
|
616
|
-
const lines = contents.split(/\r?\n/u);
|
|
617
|
-
for (let index = 0; index < lines.length; index += 1) {
|
|
618
|
-
const text = lines[index] ?? "";
|
|
619
|
-
const matched = literal ? text.includes(pattern) : regexp?.test(text);
|
|
620
|
-
if (!matched)
|
|
621
|
-
continue;
|
|
622
|
-
matches.push({ path: entry.path, line: index + 1, text });
|
|
623
|
-
if (matches.length >= limit)
|
|
624
|
-
break;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
return matches;
|
|
628
|
-
}
|
|
629
|
-
function entryContents(entry) {
|
|
630
|
-
if (typeof entry.contents === "string")
|
|
631
|
-
return entry.contents;
|
|
632
|
-
if (entry.contents instanceof Uint8Array)
|
|
633
|
-
return Buffer.from(entry.contents).toString("utf8");
|
|
634
|
-
return undefined;
|
|
635
|
-
}
|
|
636
|
-
function countOccurrences(value, search) {
|
|
637
|
-
if (!search)
|
|
638
|
-
return 0;
|
|
639
|
-
let count = 0;
|
|
640
|
-
let index = value.indexOf(search);
|
|
641
|
-
while (index >= 0) {
|
|
642
|
-
count += 1;
|
|
643
|
-
index = value.indexOf(search, index + search.length);
|
|
644
|
-
}
|
|
645
|
-
return count;
|
|
646
|
-
}
|
|
647
|
-
function shellQuote(value) {
|
|
648
|
-
return `'${value.replace(/'/gu, "'\\''")}'`;
|
|
649
|
-
}
|
|
650
|
-
export function builtInToolContext(tool) {
|
|
651
|
-
if (!isBuiltInToolName(tool.name))
|
|
652
|
-
return undefined;
|
|
653
|
-
return {
|
|
654
|
-
builtin: true,
|
|
655
|
-
source: tool.source.path
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
//# sourceMappingURL=code-mode.js.map
|