@myagentroam/agent 0.11.32 → 0.11.34
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/dist/cli/catalog-file.d.ts +78 -0
- package/dist/cli/catalog-file.js +102 -0
- package/dist/cli/codex-auth-file.d.ts +1 -1
- package/dist/cli/codex-auth-file.js +9 -10
- package/dist/cli/main.js +44 -54
- package/dist/error.d.ts +15 -0
- package/dist/error.js +74 -0
- package/dist/extensions/agents.d.ts +100 -0
- package/dist/extensions/agents.js +121 -0
- package/dist/extensions/capabilities.d.ts +4 -0
- package/dist/extensions/commands.d.ts +23 -0
- package/dist/extensions/commands.js +45 -0
- package/dist/extensions/compaction.d.ts +36 -0
- package/dist/extensions/contracts.d.ts +147 -0
- package/dist/extensions/data.d.ts +81 -0
- package/dist/extensions/data.js +78 -0
- package/dist/extensions/environment.d.ts +39 -0
- package/dist/extensions/environment.js +52 -0
- package/dist/extensions/files.d.ts +68 -0
- package/dist/extensions/files.js +26 -0
- package/dist/extensions/hooks.d.ts +32 -0
- package/dist/extensions/host-ports.d.ts +24 -0
- package/dist/extensions/manager.d.ts +42 -0
- package/dist/extensions/manager.js +457 -0
- package/dist/extensions/mcp.d.ts +116 -0
- package/dist/extensions/mcp.js +434 -0
- package/dist/extensions/model-request.d.ts +65 -0
- package/dist/extensions/model-request.js +197 -0
- package/dist/extensions/model-stream.d.ts +18 -0
- package/dist/extensions/model-stream.js +108 -0
- package/dist/extensions/models.d.ts +46 -0
- package/dist/extensions/models.js +7 -0
- package/dist/extensions/network.d.ts +40 -0
- package/dist/extensions/network.js +97 -0
- package/dist/extensions/operation.d.ts +32 -0
- package/dist/extensions/processes.d.ts +64 -0
- package/dist/extensions/processes.js +284 -0
- package/dist/extensions/prompt-composition.d.ts +38 -0
- package/dist/extensions/prompt-composition.js +100 -0
- package/dist/extensions/prompt-input.d.ts +30 -0
- package/dist/extensions/prompt-input.js +48 -0
- package/dist/extensions/prompts.d.ts +31 -0
- package/dist/extensions/prompts.js +88 -0
- package/dist/extensions/resources.d.ts +26 -0
- package/dist/extensions/resources.js +221 -0
- package/dist/extensions/services.d.ts +31 -0
- package/dist/extensions/services.js +61 -0
- package/dist/extensions/session-api.d.ts +6 -0
- package/dist/extensions/session-api.js +52 -0
- package/dist/extensions/session-input.d.ts +184 -0
- package/dist/extensions/session-input.js +422 -0
- package/dist/extensions/session-messages.d.ts +41 -0
- package/dist/extensions/session-messages.js +76 -0
- package/dist/extensions/session-tools.d.ts +32 -0
- package/dist/extensions/session-tools.js +208 -0
- package/dist/extensions/session.d.ts +60 -0
- package/dist/extensions/session.js +265 -0
- package/dist/extensions/settings.d.ts +76 -0
- package/dist/extensions/settings.js +115 -0
- package/dist/extensions/store.d.ts +10 -0
- package/dist/extensions/store.js +131 -0
- package/dist/extensions/tool-runtime.d.ts +16 -0
- package/dist/extensions/tools.d.ts +80 -0
- package/dist/extensions/tools.js +270 -0
- package/dist/extensions.d.ts +22 -0
- package/dist/host/contracts.d.ts +58 -0
- package/dist/host/contracts.js +18 -0
- package/dist/host/description.d.ts +19 -0
- package/dist/host/local-agent-host.d.ts +96 -0
- package/dist/host/local-agent-host.js +429 -0
- package/dist/host/local-exec-tool.d.ts +26 -0
- package/dist/host/local-exec-tool.js +686 -0
- package/dist/host/local-file-access.d.ts +30 -0
- package/dist/host/local-file-access.js +107 -0
- package/dist/host/local-network-access.d.ts +6 -0
- package/dist/host/local-network-access.js +101 -0
- package/dist/host/local-process-executor.d.ts +5 -0
- package/dist/host/local-process-executor.js +17 -0
- package/dist/host/local-session-environment.d.ts +18 -0
- package/dist/host/local-shell.d.ts +3 -0
- package/dist/host/local-tool-registry.d.ts +34 -0
- package/dist/host/local-tool-registry.js +134 -0
- package/dist/host/network.d.ts +5 -0
- package/dist/host/network.js +42 -0
- package/dist/host/process-control.d.ts +2 -0
- package/dist/host/process-control.js +26 -0
- package/dist/host/skill-contract.d.ts +6 -0
- package/dist/host.d.ts +17 -0
- package/dist/host.js +3 -0
- package/dist/index.d.ts +26 -51
- package/dist/index.js +9 -12
- package/dist/model/anthropic-messages.d.ts +10 -0
- package/dist/model/anthropic-messages.js +692 -0
- package/dist/model/anthropic-thinking.js +33 -0
- package/dist/model/configuration.d.ts +111 -0
- package/dist/model/configuration.js +201 -0
- package/dist/model/contracts.d.ts +229 -0
- package/dist/model/http.d.ts +13 -0
- package/dist/model/http.js +119 -0
- package/dist/model/image-contract.d.ts +10 -0
- package/dist/model/image.d.ts +9 -0
- package/dist/model/inline-media-budget.d.ts +7 -0
- package/dist/model/inline-media-budget.js +36 -0
- package/dist/model/input-images.d.ts +3 -0
- package/dist/model/input-images.js +16 -0
- package/dist/model/openai-responses.d.ts +59 -0
- package/dist/model/openai-responses.js +1586 -0
- package/dist/model/recovery.js +80 -0
- package/dist/model/request-configuration.d.ts +17 -0
- package/dist/model/request-configuration.js +47 -0
- package/dist/model/responses-event-projection.d.ts +24 -0
- package/dist/model/responses-event-projection.js +194 -0
- package/dist/model/responses-request.d.ts +5 -0
- package/dist/model/responses-request.js +363 -0
- package/dist/model/responses-session-cache.d.ts +33 -0
- package/dist/model/responses-session-cache.js +64 -0
- package/dist/model/runtime-credential.d.ts +1 -0
- package/dist/model/runtime-credential.js +1 -0
- package/dist/model/sse.js +281 -0
- package/dist/model/text-blocks.js +40 -0
- package/dist/model/tool-declarations.d.ts +4 -0
- package/dist/model/tool-definition-projection.d.ts +6 -0
- package/dist/model/tool-definition-projection.js +11 -0
- package/dist/model/tool-schema.d.ts +2 -0
- package/dist/model/tool-schema.js +17 -0
- package/dist/model/transport-test.d.ts +10 -0
- package/dist/model/transport-test.js +27 -0
- package/dist/model/usage-observer.d.ts +5 -0
- package/dist/model/usage.d.ts +40 -0
- package/dist/network/credential-runtime.d.ts +8 -0
- package/dist/network/credential-runtime.js +72 -0
- package/dist/network/credentials.d.ts +20 -0
- package/dist/network/credentials.js +18 -0
- package/dist/network/http.d.ts +20 -0
- package/dist/network/http.js +421 -0
- package/dist/network/product-user-agent.d.ts +5 -0
- package/dist/network/product-user-agent.js +22 -0
- package/dist/network/transport-error.d.ts +5 -0
- package/dist/network/transport-error.js +31 -0
- package/dist/process/contracts.d.ts +26 -0
- package/dist/prompts/index.d.ts +20 -0
- package/dist/prompts/index.js +49 -0
- package/dist/prompts/prompt-sections.d.ts +6 -0
- package/dist/prompts/prompt-sections.js +6 -0
- package/dist/prompts/read-context.js +152 -0
- package/dist/runtime/compaction/contracts.d.ts +23 -0
- package/dist/runtime/compaction/coordinator.js +88 -0
- package/dist/runtime/compaction/generate.d.ts +31 -0
- package/dist/runtime/compaction/generate.js +84 -0
- package/dist/runtime/compaction/history.d.ts +16 -0
- package/dist/runtime/compaction/operation.d.ts +30 -0
- package/dist/runtime/compaction/operation.js +131 -0
- package/dist/runtime/compaction/requests.d.ts +16 -0
- package/dist/runtime/compaction/requests.js +114 -0
- package/dist/runtime/compaction/retained-context.d.ts +6 -0
- package/dist/runtime/compaction/retained-context.js +48 -0
- package/dist/runtime/compaction/smart.d.ts +14 -0
- package/dist/runtime/compaction/smart.js +59 -0
- package/dist/runtime/context/contextual-blocks.d.ts +31 -0
- package/dist/runtime/context/contextual-blocks.js +158 -0
- package/dist/runtime/context/environment.d.ts +5 -0
- package/dist/runtime/context/gc-candidates-code.d.ts +6 -0
- package/dist/runtime/context/gc-candidates-code.js +102 -0
- package/dist/runtime/context/gc-candidates-exec.d.ts +6 -0
- package/dist/runtime/context/gc-candidates-exec.js +131 -0
- package/dist/runtime/context/gc-candidates-read-patch.d.ts +7 -0
- package/dist/runtime/context/gc-candidates-read-patch.js +118 -0
- package/dist/runtime/context/gc-candidates-subagent.d.ts +6 -0
- package/dist/runtime/context/gc-candidates-subagent.js +100 -0
- package/dist/runtime/context/gc-candidates-web.d.ts +6 -0
- package/dist/runtime/context/gc-candidates-web.js +58 -0
- package/dist/runtime/context/gc-candidates.d.ts +12 -0
- package/dist/runtime/context/gc-candidates.js +192 -0
- package/dist/runtime/context/gc-contracts.d.ts +57 -0
- package/dist/runtime/context/gc-economics.d.ts +48 -0
- package/dist/runtime/context/gc-economics.js +161 -0
- package/dist/runtime/context/gc-runtime.d.ts +43 -0
- package/dist/runtime/context/gc-tokens.d.ts +26 -0
- package/dist/runtime/context/gc-tokens.js +106 -0
- package/dist/runtime/context/gc.d.ts +7 -0
- package/dist/runtime/context/gc.js +552 -0
- package/dist/runtime/context/instructions.d.ts +37 -0
- package/dist/runtime/context/instructions.js +297 -0
- package/dist/runtime/context/normalize.d.ts +5 -0
- package/dist/runtime/context/projection.d.ts +23 -0
- package/dist/runtime/context/projection.js +284 -0
- package/dist/runtime/context/request-budget.d.ts +5 -0
- package/dist/runtime/context/request-budget.js +25 -0
- package/dist/runtime/context/restore.d.ts +27 -0
- package/dist/runtime/context/restore.js +186 -0
- package/dist/runtime/context/usage.d.ts +17 -0
- package/dist/runtime/context/usage.js +124 -0
- package/dist/runtime/context/world-state.d.ts +34 -0
- package/dist/runtime/context/world-state.js +232 -0
- package/dist/runtime/contracts.d.ts +29 -0
- package/dist/runtime/event-projection.d.ts +14 -0
- package/dist/runtime/event-projection.js +87 -0
- package/dist/runtime/events.d.ts +195 -0
- package/dist/runtime/execution-handle.d.ts +12 -0
- package/dist/runtime/execution-handle.js +1 -0
- package/dist/runtime/execution.d.ts +55 -0
- package/dist/runtime/execution.js +444 -0
- package/dist/runtime/model-progress.js +85 -0
- package/dist/runtime/resource-publication.d.ts +27 -0
- package/dist/runtime/resource-publication.js +60 -0
- package/dist/runtime/tool-round-contract.d.ts +19 -0
- package/dist/runtime/tool-round-contract.js +1 -0
- package/dist/runtime/wait.js +82 -0
- package/dist/sandbox/linux/bubblewrap-sandbox-executor.d.ts +1 -1
- package/dist/sandbox/linux/bubblewrap-sandbox-executor.js +8 -8
- package/dist/sdk/agent.d.ts +7 -0
- package/dist/sdk/agent.js +321 -0
- package/dist/sdk/execution-code-mode.d.ts +18 -0
- package/dist/sdk/execution-code-mode.js +51 -0
- package/dist/sdk/execution-compact-commit.d.ts +23 -0
- package/dist/sdk/execution-compact-commit.js +41 -0
- package/dist/sdk/execution-compact-extension.d.ts +12 -0
- package/dist/sdk/execution-compact-extension.js +46 -0
- package/dist/sdk/execution-compact-generation.d.ts +17 -0
- package/dist/sdk/execution-compact-generation.js +30 -0
- package/dist/sdk/execution-compaction-flight.d.ts +31 -0
- package/dist/sdk/execution-compaction-flight.js +50 -0
- package/dist/sdk/execution-compaction.d.ts +47 -0
- package/dist/sdk/execution-compaction.js +121 -0
- package/dist/sdk/execution-context-coordinator.d.ts +56 -0
- package/dist/sdk/execution-context-coordinator.js +102 -0
- package/dist/sdk/execution-input.d.ts +58 -0
- package/dist/sdk/execution-input.js +266 -0
- package/dist/sdk/execution-model-context.d.ts +52 -0
- package/dist/sdk/execution-model-context.js +156 -0
- package/dist/sdk/execution-model-lifecycle.d.ts +39 -0
- package/dist/sdk/execution-model-lifecycle.js +73 -0
- package/dist/sdk/execution-model-request.d.ts +40 -0
- package/dist/sdk/execution-model-request.js +45 -0
- package/dist/sdk/execution-round-preparation.d.ts +11 -0
- package/dist/sdk/execution-round-preparation.js +18 -0
- package/dist/sdk/execution-round-request.d.ts +30 -0
- package/dist/sdk/execution-round-request.js +31 -0
- package/dist/sdk/execution-tool-catalog.d.ts +46 -0
- package/dist/sdk/execution-tool-catalog.js +103 -0
- package/dist/sdk/execution-tool-scope.d.ts +67 -0
- package/dist/sdk/execution-tool-scope.js +147 -0
- package/dist/sdk/extension-agent-controller.d.ts +3 -0
- package/dist/sdk/extension-agent-controller.js +69 -0
- package/dist/sdk/extension-agents.d.ts +9 -0
- package/dist/sdk/extension-agents.js +58 -0
- package/dist/sdk/extension-models.d.ts +17 -0
- package/dist/sdk/extension-models.js +142 -0
- package/dist/sdk/extension-session-launch.d.ts +18 -0
- package/dist/sdk/extension-session-launch.js +73 -0
- package/dist/sdk/extension-session.d.ts +30 -0
- package/dist/sdk/extension-session.js +107 -0
- package/dist/sdk/extension-tool-runtime.d.ts +2 -0
- package/dist/sdk/extension-tool-runtime.js +14 -0
- package/dist/sdk/extension-tools.d.ts +16 -0
- package/dist/sdk/extension-tools.js +126 -0
- package/dist/sdk/model-input-projection.d.ts +4 -0
- package/dist/sdk/model-input-projection.js +27 -0
- package/dist/sdk/model-runtime.d.ts +21 -0
- package/dist/sdk/model-runtime.js +91 -0
- package/dist/sdk/native-steer.d.ts +20 -0
- package/dist/sdk/native-steer.js +84 -0
- package/dist/sdk/request-preparation.d.ts +9 -0
- package/dist/sdk/resource-input.d.ts +33 -0
- package/dist/sdk/resource-input.js +402 -0
- package/dist/sdk/session-catalog.d.ts +2 -0
- package/dist/sdk/session-catalog.js +12 -0
- package/dist/sdk/session-composition.d.ts +54 -0
- package/dist/sdk/session-composition.js +1 -0
- package/dist/sdk/session-execution-factory.d.ts +43 -0
- package/dist/sdk/session-execution-factory.js +937 -0
- package/dist/sdk/session-execution.d.ts +163 -0
- package/dist/sdk/session-execution.js +388 -0
- package/dist/sdk/session-extension-messages.d.ts +16 -0
- package/dist/sdk/session-extension-messages.js +64 -0
- package/dist/sdk/session-extension-prompt.d.ts +35 -0
- package/dist/sdk/session-extension-prompt.js +62 -0
- package/dist/sdk/session-maintenance.d.ts +25 -0
- package/dist/sdk/session-maintenance.js +205 -0
- package/dist/sdk/session-model-adapters.d.ts +28 -0
- package/dist/sdk/session-model-adapters.js +96 -0
- package/dist/sdk/session-open.d.ts +22 -0
- package/dist/sdk/session-open.js +44 -0
- package/dist/sdk/session-registry.d.ts +17 -0
- package/dist/sdk/session-registry.js +83 -0
- package/dist/sdk/session-runtime.d.ts +72 -0
- package/dist/sdk/session-runtime.js +205 -0
- package/dist/sdk/session.d.ts +3 -0
- package/dist/sdk/session.js +313 -0
- package/dist/sdk/subagent-backend.d.ts +3 -0
- package/dist/sdk/subagent-backend.js +49 -0
- package/dist/sdk/types.d.ts +80 -0
- package/dist/sdk/types.js +1 -0
- package/dist/session/catalog.d.ts +70 -0
- package/dist/session/catalog.js +194 -0
- package/dist/session/code-observation-contract.d.ts +40 -0
- package/dist/session/code-observation-contract.js +1 -0
- package/dist/session/code-observation-projection.d.ts +54 -0
- package/dist/session/code-observation-projection.js +165 -0
- package/dist/session/code-state.d.ts +27 -0
- package/dist/session/code-state.js +89 -0
- package/dist/session/context-gc-checkpoint.d.ts +26 -0
- package/dist/session/context-gc-checkpoint.js +935 -0
- package/dist/session/context-gc-contract.d.ts +141 -0
- package/dist/session/context-gc-contract.js +1 -0
- package/dist/session/context-gc-observations.d.ts +58 -0
- package/dist/session/context-gc-observations.js +187 -0
- package/dist/session/context-gc-replacements.d.ts +63 -0
- package/dist/session/context-gc-subagent.d.ts +54 -0
- package/dist/session/deferred-input.d.ts +5 -0
- package/dist/session/deferred-input.js +74 -0
- package/dist/session/extension-checkpoint.d.ts +8 -0
- package/dist/session/extension-checkpoint.js +30 -0
- package/dist/session/history-input-limits.d.ts +4 -0
- package/dist/session/history-input-limits.js +4 -0
- package/dist/session/inline-media-contract.d.ts +16 -0
- package/dist/session/inline-media-contract.js +1 -0
- package/dist/session/inline-media.d.ts +26 -0
- package/dist/session/inline-media.js +138 -0
- package/dist/session/model-request.d.ts +14 -0
- package/dist/session/model-request.js +1 -0
- package/dist/session/record-contract.d.ts +19 -0
- package/dist/session/record-contract.js +1 -0
- package/dist/session/record-projection.d.ts +6 -0
- package/dist/session/record-projection.js +80 -0
- package/dist/session/resource-contract.d.ts +9 -0
- package/dist/session/resource-contract.js +1 -0
- package/dist/session/rollback.d.ts +13 -0
- package/dist/session/rollback.js +46 -0
- package/dist/session/store/contracts.d.ts +160 -0
- package/dist/session/store/contracts.js +1 -0
- package/dist/session/store/current-state.d.ts +17 -0
- package/dist/session/store/current-state.js +53 -0
- package/dist/session/store/execution-state.d.ts +13 -0
- package/dist/session/store/execution-state.js +103 -0
- package/dist/session/store/index.d.ts +4 -0
- package/dist/session/store/index.js +2 -0
- package/dist/session/store/jsonl/directory-index.d.ts +26 -0
- package/dist/session/store/jsonl/directory-index.js +283 -0
- package/dist/session/store/jsonl/fs-durability.d.ts +3 -0
- package/dist/session/store/jsonl/fs-durability.js +17 -0
- package/dist/session/store/jsonl/history-replacement.d.ts +48 -0
- package/dist/session/store/jsonl/history-replacement.js +147 -0
- package/dist/session/store/jsonl/history.d.ts +25 -0
- package/dist/session/store/jsonl/history.js +181 -0
- package/dist/session/store/jsonl/images.d.ts +19 -0
- package/dist/session/store/jsonl/images.js +122 -0
- package/dist/session/store/jsonl/index-transaction.d.ts +13 -0
- package/dist/session/store/jsonl/index-transaction.js +87 -0
- package/dist/session/store/jsonl/jsonl-admission.d.ts +10 -0
- package/dist/session/store/jsonl/jsonl-admission.js +205 -0
- package/dist/session/store/jsonl/jsonl-codec.d.ts +11 -0
- package/dist/session/store/jsonl/jsonl-codec.js +138 -0
- package/dist/session/store/jsonl/jsonl-migration.d.ts +12 -0
- package/dist/session/store/jsonl/jsonl-migration.js +105 -0
- package/dist/session/store/jsonl/jsonl-store.d.ts +171 -0
- package/dist/session/store/jsonl/jsonl-store.js +2482 -0
- package/dist/session/store/jsonl/open-recovery.d.ts +13 -0
- package/dist/session/store/jsonl/open-recovery.js +131 -0
- package/dist/session/store/jsonl/read-pins.d.ts +4 -0
- package/dist/session/store/jsonl/read-pins.js +131 -0
- package/dist/session/store/jsonl/record-append.d.ts +16 -0
- package/dist/session/store/jsonl/record-append.js +49 -0
- package/dist/session/store/jsonl/records.d.ts +30 -0
- package/dist/session/store/jsonl/records.js +313 -0
- package/dist/session/store/jsonl/resources.d.ts +19 -0
- package/dist/session/store/jsonl/resources.js +209 -0
- package/dist/session/store/jsonl/store-pool.d.ts +12 -0
- package/dist/session/store/jsonl/store-pool.js +55 -0
- package/dist/session/store/jsonl/transaction-recovery.d.ts +48 -0
- package/dist/session/store/jsonl/transaction-recovery.js +374 -0
- package/dist/session/store/jsonl/tree-maintenance.d.ts +12 -0
- package/dist/session/store/jsonl/tree-maintenance.js +59 -0
- package/dist/session/store/types.d.ts +69 -0
- package/dist/session/store/types.js +1 -0
- package/dist/session/summary.d.ts +18 -0
- package/dist/session/summary.js +1 -0
- package/dist/session/todo.d.ts +11 -0
- package/dist/session/todo.js +30 -0
- package/dist/session/tool-result-resources.d.ts +27 -0
- package/dist/session/tool-result-resources.js +255 -0
- package/dist/session/types.js +1 -0
- package/dist/session/user-history.d.ts +17 -0
- package/dist/session/user-history.js +1 -0
- package/dist/session-store.d.ts +2 -0
- package/dist/session-store.js +1 -0
- package/dist/shared/auto-title.d.ts +3 -3
- package/dist/shared/auto-title.js +6 -6
- package/dist/shared/model-text.d.ts +8 -8
- package/dist/shared/model-text.js +8 -7
- package/dist/storage/file-lock.js +83 -0
- package/dist/subagent/contracts.d.ts +107 -0
- package/dist/subagent/contracts.js +1 -0
- package/dist/subagent/limits.d.ts +17 -0
- package/dist/subagent/limits.js +17 -0
- package/dist/subagent/model-update.js +81 -0
- package/dist/subagent/session-controller.d.ts +148 -0
- package/dist/subagent/session-controller.js +1761 -0
- package/dist/subagent/wait-targets.d.ts +10 -0
- package/dist/subagent/wait-targets.js +26 -0
- package/dist/subagent/wait.d.ts +26 -0
- package/dist/subagent/wait.js +73 -0
- package/dist/tools/agent/agent-cancel.d.ts +7 -0
- package/dist/tools/agent/agent-cancel.js +29 -0
- package/dist/tools/agent/agent-message.d.ts +7 -0
- package/dist/tools/agent/agent-message.js +57 -0
- package/dist/tools/agent/agent-start.d.ts +12 -0
- package/dist/tools/agent/agent-start.js +106 -0
- package/dist/tools/agent/agent-wait.d.ts +7 -0
- package/dist/tools/agent/agent-wait.js +91 -0
- package/dist/tools/agent/question.d.ts +7 -0
- package/dist/tools/agent/question.js +125 -0
- package/dist/tools/agent/skill.d.ts +11 -0
- package/dist/tools/agent/skill.js +38 -0
- package/dist/tools/agent/sleep.d.ts +9 -0
- package/dist/tools/agent/sleep.js +54 -0
- package/dist/tools/agent/smart-compact.d.ts +9 -0
- package/dist/tools/agent/smart-compact.js +23 -0
- package/dist/tools/agent/todo-read.d.ts +14 -0
- package/dist/tools/agent/todo-write.d.ts +14 -0
- package/dist/tools/agent/todo-write.js +66 -0
- package/dist/tools/agent/todo.d.ts +25 -0
- package/dist/tools/agent/todo.js +32 -0
- package/dist/tools/callers.d.ts +7 -0
- package/dist/tools/callers.js +39 -0
- package/dist/tools/code-mode/cells.d.ts +29 -0
- package/dist/tools/code-mode/cells.js +338 -0
- package/dist/tools/code-mode/dispatch.d.ts +20 -0
- package/dist/tools/code-mode/dispatch.js +80 -0
- package/dist/tools/code-mode/engine.d.ts +60 -0
- package/dist/tools/code-mode/engine.js +1 -0
- package/dist/tools/code-mode/index.d.ts +31 -0
- package/dist/tools/code-mode/index.js +751 -0
- package/dist/tools/code-mode/observations.d.ts +8 -0
- package/dist/tools/code-mode/observations.js +64 -0
- package/dist/tools/code-mode/worker.d.ts +1 -0
- package/dist/tools/contracts.d.ts +193 -0
- package/dist/tools/contracts.js +1 -0
- package/dist/tools/definition-projection.d.ts +1 -0
- package/dist/tools/definition-projection.js +1 -0
- package/dist/tools/execution-limits.d.ts +69 -0
- package/dist/tools/execution-limits.js +58 -0
- package/dist/tools/execution.d.ts +30 -0
- package/dist/tools/execution.js +191 -0
- package/dist/tools/local/apply-patch-parser.js +177 -0
- package/dist/tools/local/apply-patch.d.ts +19 -0
- package/dist/tools/local/apply-patch.js +489 -0
- package/dist/tools/local/exec.d.ts +28 -0
- package/dist/tools/local/exec.js +194 -0
- package/dist/tools/local/image-processing.js +146 -0
- package/dist/tools/local/read.d.ts +43 -0
- package/dist/tools/local/read.js +470 -0
- package/dist/tools/local/view-image.d.ts +15 -0
- package/dist/tools/local/view-image.js +317 -0
- package/dist/tools/mcp/catalog.js +220 -0
- package/dist/tools/mcp/history.d.ts +4 -0
- package/dist/tools/mcp/tool-search.d.ts +45 -0
- package/dist/tools/mcp/tool-search.js +294 -0
- package/dist/tools/output-projection.d.ts +18 -0
- package/dist/tools/output-projection.js +341 -0
- package/dist/tools/permission-contract.d.ts +25 -0
- package/dist/tools/permission-contract.js +1 -0
- package/dist/tools/permissions.d.ts +61 -0
- package/dist/tools/permissions.js +237 -0
- package/dist/tools/registry.d.ts +7 -0
- package/dist/tools/result-extension-contract.d.ts +37 -0
- package/dist/tools/result-extension-contract.js +32 -0
- package/dist/tools/result-extensions.d.ts +12 -0
- package/dist/tools/result-extensions.js +104 -0
- package/dist/tools/runtime-context.d.ts +89 -0
- package/dist/tools/runtime-context.js +1 -0
- package/dist/tools/runtime-resource-handles.js +28 -0
- package/dist/tools/runtime.js +77 -0
- package/dist/tools/scheduler.d.ts +12 -0
- package/dist/tools/shared/path-resolver.js +133 -0
- package/dist/tools/wait.d.ts +1 -0
- package/dist/tools/wait.js +1 -0
- package/package.json +15 -3
- package/dist/agent-core/error.d.ts +0 -15
- package/dist/agent-core/error.js +0 -74
- package/dist/agent-core/extensions/agents.d.ts +0 -79
- package/dist/agent-core/extensions/agents.js +0 -186
- package/dist/agent-core/extensions/compaction.d.ts +0 -48
- package/dist/agent-core/extensions/contracts.d.ts +0 -265
- package/dist/agent-core/extensions/data.d.ts +0 -84
- package/dist/agent-core/extensions/data.js +0 -83
- package/dist/agent-core/extensions/environment.d.ts +0 -27
- package/dist/agent-core/extensions/environment.js +0 -52
- package/dist/agent-core/extensions/files.d.ts +0 -64
- package/dist/agent-core/extensions/files.js +0 -26
- package/dist/agent-core/extensions/hooks.d.ts +0 -32
- package/dist/agent-core/extensions/manager.d.ts +0 -39
- package/dist/agent-core/extensions/manager.js +0 -458
- package/dist/agent-core/extensions/mcp.d.ts +0 -99
- package/dist/agent-core/extensions/mcp.js +0 -433
- package/dist/agent-core/extensions/model-request.d.ts +0 -56
- package/dist/agent-core/extensions/model-request.js +0 -197
- package/dist/agent-core/extensions/model-stream.d.ts +0 -9
- package/dist/agent-core/extensions/model-stream.js +0 -108
- package/dist/agent-core/extensions/models.d.ts +0 -43
- package/dist/agent-core/extensions/network.d.ts +0 -32
- package/dist/agent-core/extensions/network.js +0 -97
- package/dist/agent-core/extensions/operation.d.ts +0 -30
- package/dist/agent-core/extensions/processes.d.ts +0 -52
- package/dist/agent-core/extensions/processes.js +0 -284
- package/dist/agent-core/extensions/prompt-composition.d.ts +0 -24
- package/dist/agent-core/extensions/prompt-composition.js +0 -106
- package/dist/agent-core/extensions/prompt-input.d.ts +0 -23
- package/dist/agent-core/extensions/prompt-input.js +0 -48
- package/dist/agent-core/extensions/resources.d.ts +0 -27
- package/dist/agent-core/extensions/resources.js +0 -221
- package/dist/agent-core/extensions/services.d.ts +0 -31
- package/dist/agent-core/extensions/services.js +0 -61
- package/dist/agent-core/extensions/session-input.d.ts +0 -163
- package/dist/agent-core/extensions/session-input.js +0 -411
- package/dist/agent-core/extensions/session-messages.d.ts +0 -41
- package/dist/agent-core/extensions/session-messages.js +0 -76
- package/dist/agent-core/extensions/session.d.ts +0 -69
- package/dist/agent-core/extensions/session.js +0 -607
- package/dist/agent-core/extensions/settings.d.ts +0 -59
- package/dist/agent-core/extensions/settings.js +0 -115
- package/dist/agent-core/extensions/store.d.ts +0 -10
- package/dist/agent-core/extensions/store.js +0 -131
- package/dist/agent-core/extensions/tools.d.ts +0 -61
- package/dist/agent-core/extensions/tools.js +0 -269
- package/dist/agent-core/host/contracts.d.ts +0 -100
- package/dist/agent-core/host/contracts.js +0 -18
- package/dist/agent-core/host/local-agent-host.d.ts +0 -96
- package/dist/agent-core/host/local-agent-host.js +0 -425
- package/dist/agent-core/host/local-file-access.d.ts +0 -30
- package/dist/agent-core/host/local-file-access.js +0 -107
- package/dist/agent-core/host/local-network-access.d.ts +0 -6
- package/dist/agent-core/host/local-network-access.js +0 -101
- package/dist/agent-core/host/local-process-executor.d.ts +0 -29
- package/dist/agent-core/host/local-process-executor.js +0 -41
- package/dist/agent-core/host/local-session-environment.d.ts +0 -18
- package/dist/agent-core/host/local-shell.d.ts +0 -3
- package/dist/agent-core/host/network.d.ts +0 -4
- package/dist/agent-core/host/network.js +0 -6
- package/dist/agent-core/model/anthropic-messages.d.ts +0 -10
- package/dist/agent-core/model/anthropic-messages.js +0 -707
- package/dist/agent-core/model/anthropic-thinking.js +0 -33
- package/dist/agent-core/model/catalog-file.d.ts +0 -80
- package/dist/agent-core/model/catalog-file.js +0 -103
- package/dist/agent-core/model/configuration.d.ts +0 -127
- package/dist/agent-core/model/configuration.js +0 -168
- package/dist/agent-core/model/contracts.d.ts +0 -229
- package/dist/agent-core/model/http.d.ts +0 -27
- package/dist/agent-core/model/http.js +0 -534
- package/dist/agent-core/model/image.d.ts +0 -17
- package/dist/agent-core/model/openai-responses.d.ts +0 -77
- package/dist/agent-core/model/openai-responses.js +0 -2123
- package/dist/agent-core/model/product-user-agent.d.ts +0 -5
- package/dist/agent-core/model/product-user-agent.js +0 -22
- package/dist/agent-core/model/recovery.js +0 -80
- package/dist/agent-core/model/request-configuration.d.ts +0 -17
- package/dist/agent-core/model/request-configuration.js +0 -47
- package/dist/agent-core/model/runtime-credential.d.ts +0 -8
- package/dist/agent-core/model/runtime-credential.js +0 -72
- package/dist/agent-core/model/sse.js +0 -281
- package/dist/agent-core/model/text-blocks.js +0 -40
- package/dist/agent-core/model/tool-declarations.d.ts +0 -4
- package/dist/agent-core/model/transport-test.d.ts +0 -3
- package/dist/agent-core/model/transport-test.js +0 -23
- package/dist/agent-core/model/usage-observer.d.ts +0 -31
- package/dist/agent-core/prompts/index.d.ts +0 -20
- package/dist/agent-core/prompts/index.js +0 -49
- package/dist/agent-core/runtime/compaction/coordinator.js +0 -88
- package/dist/agent-core/runtime/compaction/generate.d.ts +0 -28
- package/dist/agent-core/runtime/compaction/generate.js +0 -84
- package/dist/agent-core/runtime/compaction/history.d.ts +0 -16
- package/dist/agent-core/runtime/compaction/operation.d.ts +0 -29
- package/dist/agent-core/runtime/compaction/operation.js +0 -131
- package/dist/agent-core/runtime/compaction/requests.d.ts +0 -16
- package/dist/agent-core/runtime/compaction/requests.js +0 -114
- package/dist/agent-core/runtime/compaction/retained-context.d.ts +0 -6
- package/dist/agent-core/runtime/compaction/retained-context.js +0 -47
- package/dist/agent-core/runtime/compaction/smart.d.ts +0 -14
- package/dist/agent-core/runtime/compaction/smart.js +0 -59
- package/dist/agent-core/runtime/context/contextual-blocks.d.ts +0 -30
- package/dist/agent-core/runtime/context/contextual-blocks.js +0 -146
- package/dist/agent-core/runtime/context/environment.d.ts +0 -5
- package/dist/agent-core/runtime/context/gc-runtime.d.ts +0 -38
- package/dist/agent-core/runtime/context/gc-tokens.d.ts +0 -25
- package/dist/agent-core/runtime/context/gc-tokens.js +0 -103
- package/dist/agent-core/runtime/context/gc.d.ts +0 -75
- package/dist/agent-core/runtime/context/gc.js +0 -1386
- package/dist/agent-core/runtime/context/instructions.d.ts +0 -37
- package/dist/agent-core/runtime/context/instructions.js +0 -297
- package/dist/agent-core/runtime/context/normalize.d.ts +0 -5
- package/dist/agent-core/runtime/context/projection.d.ts +0 -23
- package/dist/agent-core/runtime/context/projection.js +0 -284
- package/dist/agent-core/runtime/context/request-budget.d.ts +0 -4
- package/dist/agent-core/runtime/context/request-budget.js +0 -25
- package/dist/agent-core/runtime/context/restore.d.ts +0 -25
- package/dist/agent-core/runtime/context/restore.js +0 -186
- package/dist/agent-core/runtime/context/usage.d.ts +0 -17
- package/dist/agent-core/runtime/context/usage.js +0 -124
- package/dist/agent-core/runtime/context/world-state.d.ts +0 -33
- package/dist/agent-core/runtime/context/world-state.js +0 -232
- package/dist/agent-core/runtime/contracts.d.ts +0 -41
- package/dist/agent-core/runtime/event-projection.d.ts +0 -14
- package/dist/agent-core/runtime/event-projection.js +0 -87
- package/dist/agent-core/runtime/events.d.ts +0 -197
- package/dist/agent-core/runtime/execution-handle.d.ts +0 -12
- package/dist/agent-core/runtime/execution.d.ts +0 -50
- package/dist/agent-core/runtime/execution.js +0 -445
- package/dist/agent-core/runtime/model-progress.js +0 -85
- package/dist/agent-core/runtime/resource-publication.d.ts +0 -8
- package/dist/agent-core/runtime/resource-publication.js +0 -60
- package/dist/agent-core/sdk/agent.d.ts +0 -11
- package/dist/agent-core/sdk/agent.js +0 -474
- package/dist/agent-core/sdk/extension-agents.d.ts +0 -9
- package/dist/agent-core/sdk/extension-agents.js +0 -58
- package/dist/agent-core/sdk/extension-models.d.ts +0 -13
- package/dist/agent-core/sdk/extension-models.js +0 -137
- package/dist/agent-core/sdk/extension-session.d.ts +0 -30
- package/dist/agent-core/sdk/extension-session.js +0 -105
- package/dist/agent-core/sdk/extension-tools.d.ts +0 -16
- package/dist/agent-core/sdk/extension-tools.js +0 -126
- package/dist/agent-core/sdk/model-runtime.d.ts +0 -18
- package/dist/agent-core/sdk/model-runtime.js +0 -93
- package/dist/agent-core/sdk/native-steer.d.ts +0 -20
- package/dist/agent-core/sdk/native-steer.js +0 -84
- package/dist/agent-core/sdk/request-preparation.d.ts +0 -7
- package/dist/agent-core/sdk/resource-input.d.ts +0 -32
- package/dist/agent-core/sdk/resource-input.js +0 -403
- package/dist/agent-core/sdk/session.d.ts +0 -94
- package/dist/agent-core/sdk/session.js +0 -2377
- package/dist/agent-core/sdk/subagent-backend.d.ts +0 -3
- package/dist/agent-core/sdk/subagent-backend.js +0 -49
- package/dist/agent-core/sdk/types.d.ts +0 -81
- package/dist/agent-core/session/catalog.d.ts +0 -99
- package/dist/agent-core/session/catalog.js +0 -200
- package/dist/agent-core/session/context-gc-checkpoint.d.ts +0 -165
- package/dist/agent-core/session/context-gc-checkpoint.js +0 -935
- package/dist/agent-core/session/context-gc-observations.d.ts +0 -60
- package/dist/agent-core/session/context-gc-observations.js +0 -187
- package/dist/agent-core/session/context-gc-replacements.d.ts +0 -62
- package/dist/agent-core/session/context-gc-subagent.d.ts +0 -53
- package/dist/agent-core/session/deferred-input.d.ts +0 -5
- package/dist/agent-core/session/deferred-input.js +0 -74
- package/dist/agent-core/session/inline-media.d.ts +0 -45
- package/dist/agent-core/session/inline-media.js +0 -163
- package/dist/agent-core/session/rollback.d.ts +0 -13
- package/dist/agent-core/session/rollback.js +0 -46
- package/dist/agent-core/session/store/contracts.d.ts +0 -158
- package/dist/agent-core/session/store/current-state.d.ts +0 -17
- package/dist/agent-core/session/store/current-state.js +0 -53
- package/dist/agent-core/session/store/directory-index.d.ts +0 -18
- package/dist/agent-core/session/store/directory-index.js +0 -169
- package/dist/agent-core/session/store/execution-state.d.ts +0 -18
- package/dist/agent-core/session/store/execution-state.js +0 -175
- package/dist/agent-core/session/store/history.d.ts +0 -25
- package/dist/agent-core/session/store/history.js +0 -181
- package/dist/agent-core/session/store/images.d.ts +0 -19
- package/dist/agent-core/session/store/images.js +0 -110
- package/dist/agent-core/session/store/index.d.ts +0 -4
- package/dist/agent-core/session/store/index.js +0 -2
- package/dist/agent-core/session/store/jsonl-store.d.ts +0 -171
- package/dist/agent-core/session/store/jsonl-store.js +0 -2078
- package/dist/agent-core/session/store/records.d.ts +0 -23
- package/dist/agent-core/session/store/records.js +0 -261
- package/dist/agent-core/session/store/resources.d.ts +0 -26
- package/dist/agent-core/session/store/resources.js +0 -197
- package/dist/agent-core/session/store/types.d.ts +0 -82
- package/dist/agent-core/session/tool-result-resources.d.ts +0 -26
- package/dist/agent-core/session/tool-result-resources.js +0 -256
- package/dist/agent-core/session/transaction-recovery.d.ts +0 -16
- package/dist/agent-core/session/transaction-recovery.js +0 -135
- package/dist/agent-core/storage/file-lock.js +0 -83
- package/dist/agent-core/subagent/contracts.d.ts +0 -117
- package/dist/agent-core/subagent/model-update.js +0 -81
- package/dist/agent-core/subagent/scheduler.d.ts +0 -135
- package/dist/agent-core/subagent/scheduler.js +0 -369
- package/dist/agent-core/subagent/session-controller.d.ts +0 -138
- package/dist/agent-core/subagent/session-controller.js +0 -1594
- package/dist/agent-core/subagent/wait.d.ts +0 -14
- package/dist/agent-core/subagent/wait.js +0 -32
- package/dist/agent-core/tools/agent/agent-cancel.d.ts +0 -7
- package/dist/agent-core/tools/agent/agent-cancel.js +0 -29
- package/dist/agent-core/tools/agent/agent-message.d.ts +0 -7
- package/dist/agent-core/tools/agent/agent-message.js +0 -57
- package/dist/agent-core/tools/agent/agent-start.d.ts +0 -12
- package/dist/agent-core/tools/agent/agent-start.js +0 -106
- package/dist/agent-core/tools/agent/agent-wait.d.ts +0 -7
- package/dist/agent-core/tools/agent/agent-wait.js +0 -91
- package/dist/agent-core/tools/agent/question.d.ts +0 -7
- package/dist/agent-core/tools/agent/question.js +0 -125
- package/dist/agent-core/tools/agent/skill.d.ts +0 -11
- package/dist/agent-core/tools/agent/skill.js +0 -38
- package/dist/agent-core/tools/agent/sleep.d.ts +0 -12
- package/dist/agent-core/tools/agent/sleep.js +0 -54
- package/dist/agent-core/tools/agent/smart-compact.d.ts +0 -9
- package/dist/agent-core/tools/agent/smart-compact.js +0 -23
- package/dist/agent-core/tools/agent/todo-read.d.ts +0 -14
- package/dist/agent-core/tools/agent/todo-write.d.ts +0 -14
- package/dist/agent-core/tools/agent/todo-write.js +0 -66
- package/dist/agent-core/tools/agent/todo.d.ts +0 -26
- package/dist/agent-core/tools/agent/todo.js +0 -60
- package/dist/agent-core/tools/callers.d.ts +0 -6
- package/dist/agent-core/tools/callers.js +0 -39
- package/dist/agent-core/tools/code-mode/cells.d.ts +0 -29
- package/dist/agent-core/tools/code-mode/cells.js +0 -337
- package/dist/agent-core/tools/code-mode/dispatch.d.ts +0 -20
- package/dist/agent-core/tools/code-mode/dispatch.js +0 -80
- package/dist/agent-core/tools/code-mode/engine.d.ts +0 -60
- package/dist/agent-core/tools/code-mode/index.d.ts +0 -29
- package/dist/agent-core/tools/code-mode/index.js +0 -749
- package/dist/agent-core/tools/code-mode/observations.d.ts +0 -98
- package/dist/agent-core/tools/code-mode/observations.js +0 -228
- package/dist/agent-core/tools/code-mode/state.d.ts +0 -9
- package/dist/agent-core/tools/code-mode/state.js +0 -82
- package/dist/agent-core/tools/contracts.d.ts +0 -211
- package/dist/agent-core/tools/definition-projection.d.ts +0 -7
- package/dist/agent-core/tools/definition-projection.js +0 -26
- package/dist/agent-core/tools/execution-limits.d.ts +0 -69
- package/dist/agent-core/tools/execution-limits.js +0 -69
- package/dist/agent-core/tools/execution.d.ts +0 -46
- package/dist/agent-core/tools/execution.js +0 -191
- package/dist/agent-core/tools/local/apply-patch-parser.js +0 -177
- package/dist/agent-core/tools/local/apply-patch.d.ts +0 -19
- package/dist/agent-core/tools/local/apply-patch.js +0 -489
- package/dist/agent-core/tools/local/exec.d.ts +0 -53
- package/dist/agent-core/tools/local/exec.js +0 -877
- package/dist/agent-core/tools/local/image-processing.js +0 -146
- package/dist/agent-core/tools/local/read-context.js +0 -152
- package/dist/agent-core/tools/local/read.d.ts +0 -43
- package/dist/agent-core/tools/local/read.js +0 -470
- package/dist/agent-core/tools/local/registry.d.ts +0 -34
- package/dist/agent-core/tools/local/registry.js +0 -132
- package/dist/agent-core/tools/local/view-image.d.ts +0 -15
- package/dist/agent-core/tools/local/view-image.js +0 -317
- package/dist/agent-core/tools/local/workspace-tools.d.ts +0 -12
- package/dist/agent-core/tools/local/workspace-tools.js +0 -28
- package/dist/agent-core/tools/mcp/catalog.js +0 -220
- package/dist/agent-core/tools/mcp/history.d.ts +0 -4
- package/dist/agent-core/tools/mcp/tool-search.d.ts +0 -45
- package/dist/agent-core/tools/mcp/tool-search.js +0 -294
- package/dist/agent-core/tools/output-projection.d.ts +0 -18
- package/dist/agent-core/tools/output-projection.js +0 -341
- package/dist/agent-core/tools/permissions.d.ts +0 -85
- package/dist/agent-core/tools/permissions.js +0 -237
- package/dist/agent-core/tools/registry.d.ts +0 -7
- package/dist/agent-core/tools/result-extensions.d.ts +0 -46
- package/dist/agent-core/tools/result-extensions.js +0 -134
- package/dist/agent-core/tools/runtime-context.d.ts +0 -74
- package/dist/agent-core/tools/runtime-resource-handles.js +0 -28
- package/dist/agent-core/tools/runtime.js +0 -77
- package/dist/agent-core/tools/scheduler.d.ts +0 -12
- package/dist/agent-core/tools/shared/path-resolver.js +0 -133
- package/dist/agent-core/tools/wait.js +0 -82
- /package/dist/{agent-core/extensions/models.js → extensions/capabilities.js} +0 -0
- /package/dist/{agent-core/extensions → extensions}/compaction.js +0 -0
- /package/dist/{agent-core/model → extensions}/contracts.js +0 -0
- /package/dist/{agent-core/extensions → extensions}/hooks.js +0 -0
- /package/dist/{agent-core/runtime/context/contracts.js → extensions/host-ports.js} +0 -0
- /package/dist/{agent-core/extensions → extensions}/operation.js +0 -0
- /package/dist/{agent-core/runtime/contracts.js → extensions/tool-runtime.js} +0 -0
- /package/dist/{agent-core/extensions/contracts.js → extensions.js} +0 -0
- /package/dist/{agent-core/runtime/events.js → host/description.js} +0 -0
- /package/dist/{agent-core/host → host}/local-session-environment.js +0 -0
- /package/dist/{agent-core/host → host}/local-shell.js +0 -0
- /package/dist/{agent-core/runtime/execution-handle.js → host/skill-contract.js} +0 -0
- /package/dist/{agent-core/model → model}/anthropic-thinking.d.ts +0 -0
- /package/dist/{agent-core/model → model}/attempt-diagnostics.d.ts +0 -0
- /package/dist/{agent-core/model → model}/attempt-diagnostics.js +0 -0
- /package/dist/{agent-core/session/store → model}/contracts.js +0 -0
- /package/dist/{agent-core/sdk/types.js → model/image-contract.js} +0 -0
- /package/dist/{agent-core/model → model}/image.js +0 -0
- /package/dist/{agent-core/model → model}/native-context.d.ts +0 -0
- /package/dist/{agent-core/model → model}/native-context.js +0 -0
- /package/dist/{agent-core/model → model}/recovery.d.ts +0 -0
- /package/dist/{agent-core/model → model}/sse.d.ts +0 -0
- /package/dist/{agent-core/model → model}/text-blocks.d.ts +0 -0
- /package/dist/{agent-core/model → model}/tool-declarations.js +0 -0
- /package/dist/{agent-core/model → model}/tool-input.d.ts +0 -0
- /package/dist/{agent-core/model → model}/tool-input.js +0 -0
- /package/dist/{agent-core/model → model}/usage-observer.js +0 -0
- /package/dist/{agent-core/session/store/types.js → model/usage.js} +0 -0
- /package/dist/{agent-core/subagent → process}/contracts.js +0 -0
- /package/dist/{agent-core/prompts → prompts}/compact.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/compact.js +0 -0
- /package/dist/{agent-core/prompts → prompts}/core.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/core.js +0 -0
- /package/dist/{agent-core/prompts → prompts}/markup.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/markup.js +0 -0
- /package/dist/{agent-core/prompts → prompts}/modes.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/modes.js +0 -0
- /package/dist/{agent-core/prompts → prompts}/output.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/output.js +0 -0
- /package/dist/{agent-core/prompts → prompts}/permissions.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/permissions.js +0 -0
- /package/dist/{agent-core/tools/local → prompts}/read-context.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/resources.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/resources.js +0 -0
- /package/dist/{agent-core/prompts → prompts}/subagent.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/subagent.js +0 -0
- /package/dist/{agent-core/prompts → prompts}/workflow.d.ts +0 -0
- /package/dist/{agent-core/prompts → prompts}/workflow.js +0 -0
- /package/dist/{agent-core/runtime → runtime}/async-queue.d.ts +0 -0
- /package/dist/{agent-core/runtime → runtime}/async-queue.js +0 -0
- /package/dist/{agent-core/tools → runtime/compaction}/contracts.js +0 -0
- /package/dist/{agent-core/runtime → runtime}/compaction/coordinator.d.ts +0 -0
- /package/dist/{agent-core/runtime → runtime}/compaction/history.js +0 -0
- /package/dist/{agent-core/runtime → runtime}/context/contracts.d.ts +0 -0
- /package/dist/{agent-core/session/types.js → runtime/context/contracts.js} +0 -0
- /package/dist/{agent-core/runtime → runtime}/context/environment.js +0 -0
- /package/dist/{agent-core/tools/code-mode/engine.js → runtime/context/gc-contracts.js} +0 -0
- /package/dist/{agent-core/runtime → runtime}/context/gc-runtime.js +0 -0
- /package/dist/{agent-core/runtime → runtime}/context/normalize.js +0 -0
- /package/dist/{agent-core/tools/code-mode/worker.d.ts → runtime/contracts.js} +0 -0
- /package/dist/{agent-core/tools/runtime-context.js → runtime/events.js} +0 -0
- /package/dist/{agent-core/runtime → runtime}/execution-policy.d.ts +0 -0
- /package/dist/{agent-core/runtime → runtime}/execution-policy.js +0 -0
- /package/dist/{agent-core/runtime → runtime}/model-generation-timing.d.ts +0 -0
- /package/dist/{agent-core/runtime → runtime}/model-generation-timing.js +0 -0
- /package/dist/{agent-core/runtime → runtime}/model-progress.d.ts +0 -0
- /package/dist/{agent-core/runtime → runtime}/plan-output.d.ts +0 -0
- /package/dist/{agent-core/runtime → runtime}/plan-output.js +0 -0
- /package/dist/{agent-core/tools/public-metadata.d.ts → runtime/public-tool-metadata.d.ts} +0 -0
- /package/dist/{agent-core/tools/public-metadata.js → runtime/public-tool-metadata.js} +0 -0
- /package/dist/{agent-core/runtime → runtime}/token-budget.d.ts +0 -0
- /package/dist/{agent-core/runtime → runtime}/token-budget.js +0 -0
- /package/dist/{agent-core/tools → runtime}/wait.d.ts +0 -0
- /package/dist/{agent-core/sdk → sdk}/request-preparation.js +0 -0
- /package/dist/{agent-core/session → session}/context-gc-markup.d.ts +0 -0
- /package/dist/{agent-core/session → session}/context-gc-markup.js +0 -0
- /package/dist/{agent-core/session → session}/context-gc-replacements.js +0 -0
- /package/dist/{agent-core/session → session}/context-gc-subagent.js +0 -0
- /package/dist/{agent-core/session → session}/types.d.ts +0 -0
- /package/dist/{agent-core/storage → storage}/file-lock.d.ts +0 -0
- /package/dist/{agent-core/subagent → subagent}/model-update.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/agent/todo-read.js +0 -0
- /package/dist/{agent-core/tools → tools}/code-mode/quickjs-engine.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/code-mode/quickjs-engine.js +0 -0
- /package/dist/{agent-core/tools → tools}/code-mode/text-output.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/code-mode/text-output.js +0 -0
- /package/dist/{agent-core/tools → tools}/code-mode/worker.js +0 -0
- /package/dist/{agent-core/tools → tools}/file-change-diff.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/file-change-diff.js +0 -0
- /package/dist/{agent-core/tools → tools}/input-diagnostics/source-preview.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/input-diagnostics/source-preview.js +0 -0
- /package/dist/{agent-core/tools → tools}/input.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/input.js +0 -0
- /package/dist/{agent-core/tools → tools}/local/apply-patch-parser.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/local/image-processing.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/mcp/catalog.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/mcp/history.js +0 -0
- /package/dist/{agent-core/tools → tools}/registry.js +0 -0
- /package/dist/{agent-core/tools → tools}/runtime-resource-handles.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/runtime.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/scheduler.js +0 -0
- /package/dist/{agent-core/tools → tools}/shared/patch-result.d.ts +0 -0
- /package/dist/{agent-core/tools → tools}/shared/patch-result.js +0 -0
- /package/dist/{agent-core/tools → tools}/shared/path-resolver.d.ts +0 -0
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { MarAgentError } from '../error.js';
|
|
3
|
-
import { isProviderContextOverflow, recoverModelStream } from '../model/recovery.js';
|
|
4
|
-
import { modelStreamEventObservedAt } from '../model/sse.js';
|
|
5
|
-
import { modelOutputContinuationMessage } from '../prompts/output.js';
|
|
6
|
-
import { executeRoundTools } from '../tools/execution.js';
|
|
7
|
-
import { publicHostedToolEvents, publicModelUsage } from './event-projection.js';
|
|
8
|
-
import { PlanOutputPrefix, splitPlanOutput } from './plan-output.js';
|
|
9
|
-
import { ModelGenerationTiming } from './model-generation-timing.js';
|
|
10
|
-
/** Own the single model/tool loop; the SDK owns its handle, terminal events and cleanup. */
|
|
11
|
-
export class ExecutionLoop {
|
|
12
|
-
input;
|
|
13
|
-
#finalAnswer = '';
|
|
14
|
-
planOutputPrefixes = new Map();
|
|
15
|
-
get finalAnswer() {
|
|
16
|
-
return this.#finalAnswer;
|
|
17
|
-
}
|
|
18
|
-
set finalAnswer(value) {
|
|
19
|
-
this.#finalAnswer = value;
|
|
20
|
-
}
|
|
21
|
-
constructor(input) {
|
|
22
|
-
this.input = input;
|
|
23
|
-
}
|
|
24
|
-
async run() {
|
|
25
|
-
const input = this.input;
|
|
26
|
-
const { mode, messages } = input;
|
|
27
|
-
let recoveringFromContextOverflow = false;
|
|
28
|
-
let maxOutputContinuationUsed = false;
|
|
29
|
-
let pendingOutputContinuation;
|
|
30
|
-
const modelRetryState = { attempts: 0 };
|
|
31
|
-
while (true) {
|
|
32
|
-
let stop;
|
|
33
|
-
let sawTool = false;
|
|
34
|
-
let latestUsage;
|
|
35
|
-
let roundServerUsage;
|
|
36
|
-
const pendingTools = [];
|
|
37
|
-
let incompleteToolCall = false;
|
|
38
|
-
const round = await input.prepareRound(pendingOutputContinuation);
|
|
39
|
-
const reasoningScope = randomUUID();
|
|
40
|
-
const publishedReasoning = new Set();
|
|
41
|
-
const startedMessages = new Set();
|
|
42
|
-
const leadingMessageWhitespace = new Map();
|
|
43
|
-
let sawModelSemanticEvent = false;
|
|
44
|
-
let requestStartedAt;
|
|
45
|
-
let firstModelResponseAt;
|
|
46
|
-
let generation = new ModelGenerationTiming();
|
|
47
|
-
let requestCompletedAt;
|
|
48
|
-
let requestOutputTokens;
|
|
49
|
-
const roundMessageCount = messages.length;
|
|
50
|
-
const emitLatency = async () => {
|
|
51
|
-
if (mode === 'compact' || firstModelResponseAt === undefined)
|
|
52
|
-
return;
|
|
53
|
-
await input.publish({
|
|
54
|
-
type: 'model.performance',
|
|
55
|
-
latencyMs: Math.max(0, Math.round(firstModelResponseAt - requestStartedAt))
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
const emitFinalPerformance = async (completedAt) => {
|
|
59
|
-
if (mode === 'compact')
|
|
60
|
-
return;
|
|
61
|
-
generation.finish(completedAt);
|
|
62
|
-
const outputDuration = generation.durationMs;
|
|
63
|
-
const outputTokens = requestOutputTokens;
|
|
64
|
-
if (outputTokens === undefined || outputDuration === undefined)
|
|
65
|
-
return;
|
|
66
|
-
await input.publish({
|
|
67
|
-
type: 'model.performance',
|
|
68
|
-
...(firstModelResponseAt === undefined
|
|
69
|
-
? {}
|
|
70
|
-
: { latencyMs: Math.max(0, Math.round(firstModelResponseAt - requestStartedAt)) }),
|
|
71
|
-
outputTokens,
|
|
72
|
-
outputDurationMs: Math.round(outputDuration),
|
|
73
|
-
tokensPerSecond: Number(((outputTokens * 1000) / outputDuration).toFixed(2))
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
const persistToolCalls = async (calls) => {
|
|
77
|
-
for (const call of calls) {
|
|
78
|
-
const message = {
|
|
79
|
-
role: 'tool_call',
|
|
80
|
-
callId: call.callId,
|
|
81
|
-
name: call.name,
|
|
82
|
-
arguments: call.arguments,
|
|
83
|
-
...(call.inputMode ? { inputMode: call.inputMode } : {}),
|
|
84
|
-
content: ''
|
|
85
|
-
};
|
|
86
|
-
messages.push(message);
|
|
87
|
-
await input.appendContext(message);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
try {
|
|
91
|
-
requestStartedAt = performance.now();
|
|
92
|
-
for await (const event of input.startModel({
|
|
93
|
-
...round.request,
|
|
94
|
-
retryState: modelRetryState
|
|
95
|
-
})) {
|
|
96
|
-
if (event.type === 'output.reset') {
|
|
97
|
-
generation = new ModelGenerationTiming();
|
|
98
|
-
requestCompletedAt = undefined;
|
|
99
|
-
requestOutputTokens = undefined;
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
const observedAt = Math.max(requestStartedAt, modelStreamEventObservedAt(event) ?? performance.now());
|
|
103
|
-
if (event.type === 'output.started') {
|
|
104
|
-
generation.start(observedAt);
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
if (event.type === 'output.completed') {
|
|
108
|
-
generation.finish(observedAt);
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
if (event.type === 'output.paused') {
|
|
112
|
-
generation.pause(observedAt);
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
const modelResponseAt = mode !== 'compact' && isModelResponseEvent(event) ? observedAt : undefined;
|
|
116
|
-
const isFirstModelResponse = modelResponseAt !== undefined && firstModelResponseAt === undefined;
|
|
117
|
-
if (modelResponseAt !== undefined) {
|
|
118
|
-
if (event.type !== 'output.delta')
|
|
119
|
-
sawModelSemanticEvent = true;
|
|
120
|
-
firstModelResponseAt ??= modelResponseAt;
|
|
121
|
-
if (event.type === 'output.delta' ||
|
|
122
|
-
(event.type === 'text.delta' && event.delta.length > 0)) {
|
|
123
|
-
generation.start(modelResponseAt);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (event.type === 'response.item') {
|
|
127
|
-
// Compaction keeps only its successful checkpoint, never intermediate native output.
|
|
128
|
-
if (mode === 'compact')
|
|
129
|
-
continue;
|
|
130
|
-
const message = {
|
|
131
|
-
role: 'provider',
|
|
132
|
-
content: '',
|
|
133
|
-
provider: event.provider,
|
|
134
|
-
providerModelId: input.model.id,
|
|
135
|
-
...(event.contextKind === undefined ? {} : { contextKind: event.contextKind }),
|
|
136
|
-
item: event.item
|
|
137
|
-
};
|
|
138
|
-
messages.push(message);
|
|
139
|
-
await input.appendContext(message);
|
|
140
|
-
}
|
|
141
|
-
else if (event.type === 'text.delta') {
|
|
142
|
-
let delta = event.delta;
|
|
143
|
-
if (mode === 'plan' && input.sourceType !== 'subagent') {
|
|
144
|
-
let prefix = this.planOutputPrefixes.get(event.itemId);
|
|
145
|
-
if (!prefix) {
|
|
146
|
-
prefix = new PlanOutputPrefix();
|
|
147
|
-
this.planOutputPrefixes.set(event.itemId, prefix);
|
|
148
|
-
}
|
|
149
|
-
delta = prefix.push(delta);
|
|
150
|
-
}
|
|
151
|
-
if (mode !== 'compact' && delta) {
|
|
152
|
-
if (!startedMessages.has(event.itemId)) {
|
|
153
|
-
delta = (leadingMessageWhitespace.get(event.itemId) ?? '') + delta;
|
|
154
|
-
if (!delta.trim()) {
|
|
155
|
-
leadingMessageWhitespace.set(event.itemId, delta);
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
leadingMessageWhitespace.delete(event.itemId);
|
|
159
|
-
startedMessages.add(event.itemId);
|
|
160
|
-
await input.publish({
|
|
161
|
-
type: 'message.started',
|
|
162
|
-
itemId: event.itemId,
|
|
163
|
-
phase: event.phase
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
await input.publish({
|
|
167
|
-
type: 'message.delta',
|
|
168
|
-
itemId: event.itemId,
|
|
169
|
-
phase: event.phase,
|
|
170
|
-
delta
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
else if (event.type === 'text.completed') {
|
|
175
|
-
leadingMessageWhitespace.delete(event.itemId);
|
|
176
|
-
const phase = event.phase ?? 'final_answer';
|
|
177
|
-
if (phase === 'final_answer')
|
|
178
|
-
this.finalAnswer = event.text;
|
|
179
|
-
this.planOutputPrefixes.delete(event.itemId);
|
|
180
|
-
if (mode !== 'compact') {
|
|
181
|
-
if (mode === 'plan' && input.sourceType !== 'subagent') {
|
|
182
|
-
const parts = splitPlanOutput(event.text);
|
|
183
|
-
for (const [index, part] of parts.entries()) {
|
|
184
|
-
const itemId = index === 0 ? event.itemId : `${event.itemId}:plan-part:${index}`;
|
|
185
|
-
if (part.kind === 'plan')
|
|
186
|
-
await input.publish({ type: 'plan.completed', itemId, text: part.text });
|
|
187
|
-
else {
|
|
188
|
-
await input.publish({
|
|
189
|
-
type: 'message.completed',
|
|
190
|
-
itemId,
|
|
191
|
-
phase,
|
|
192
|
-
text: part.text,
|
|
193
|
-
modelId: input.model.id,
|
|
194
|
-
modelName: input.model.name
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
await input.publish({
|
|
201
|
-
type: 'message.completed',
|
|
202
|
-
itemId: event.itemId,
|
|
203
|
-
phase,
|
|
204
|
-
text: event.text,
|
|
205
|
-
modelId: input.model.id,
|
|
206
|
-
modelName: input.model.name
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
messages.push({ role: 'assistant', content: event.text });
|
|
211
|
-
}
|
|
212
|
-
else if (event.type === 'usage') {
|
|
213
|
-
latestUsage = event.usage;
|
|
214
|
-
if (event.final === true)
|
|
215
|
-
generation.finish(observedAt);
|
|
216
|
-
const outputTokens = typeof event.usage.outputTokens === 'number' &&
|
|
217
|
-
Number.isSafeInteger(event.usage.outputTokens) &&
|
|
218
|
-
event.usage.outputTokens >= 0
|
|
219
|
-
? event.usage.outputTokens
|
|
220
|
-
: undefined;
|
|
221
|
-
if (event.final !== false && (outputTokens !== undefined || event.final === true))
|
|
222
|
-
requestOutputTokens = outputTokens;
|
|
223
|
-
const reportedContext = event.usage.contextInputTokens ?? event.usage.inputTokens;
|
|
224
|
-
if (reportedContext !== undefined &&
|
|
225
|
-
Number.isSafeInteger(reportedContext) &&
|
|
226
|
-
reportedContext >= 0) {
|
|
227
|
-
input.observeContextTokens(reportedContext);
|
|
228
|
-
roundServerUsage = {
|
|
229
|
-
contextInputTokens: reportedContext,
|
|
230
|
-
outputTokens: typeof event.usage.outputTokens === 'number' &&
|
|
231
|
-
Number.isSafeInteger(event.usage.outputTokens) &&
|
|
232
|
-
event.usage.outputTokens >= 0
|
|
233
|
-
? event.usage.outputTokens
|
|
234
|
-
: undefined
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
await input.publish({ type: 'usage.updated', ...publicModelUsage(event.usage) });
|
|
238
|
-
}
|
|
239
|
-
else if (event.type === 'reasoning.completed') {
|
|
240
|
-
if (mode !== 'compact' && event.text.trim() && !publishedReasoning.has(event.itemId)) {
|
|
241
|
-
await input.publish({
|
|
242
|
-
type: 'reasoning.completed',
|
|
243
|
-
itemId: `${reasoningScope}:${event.itemId}`,
|
|
244
|
-
representation: event.representation,
|
|
245
|
-
text: event.text
|
|
246
|
-
});
|
|
247
|
-
publishedReasoning.add(event.itemId);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
else if (event.type === 'hosted_tool') {
|
|
251
|
-
if (mode !== 'compact')
|
|
252
|
-
for (const toolEvent of publicHostedToolEvents(event))
|
|
253
|
-
await input.publish(toolEvent);
|
|
254
|
-
}
|
|
255
|
-
else if (event.type === 'citation') {
|
|
256
|
-
if (mode !== 'compact')
|
|
257
|
-
await input.publish({
|
|
258
|
-
type: 'citation.added',
|
|
259
|
-
id: event.citation.id,
|
|
260
|
-
url: event.citation.url,
|
|
261
|
-
...(event.citation.title ? { title: event.citation.title } : {})
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
else if (event.type === 'client_tool.call') {
|
|
265
|
-
if (mode === 'compact')
|
|
266
|
-
throw new MarAgentError('MAR_AGENT_MODEL_PROTOCOL_ERROR', 'Compaction returned a tool call while tools were disabled.');
|
|
267
|
-
sawTool = true;
|
|
268
|
-
pendingTools.push(event);
|
|
269
|
-
}
|
|
270
|
-
else if (event.type === 'completed') {
|
|
271
|
-
stop = event.reason;
|
|
272
|
-
requestCompletedAt = observedAt;
|
|
273
|
-
}
|
|
274
|
-
if (isFirstModelResponse)
|
|
275
|
-
await emitLatency();
|
|
276
|
-
}
|
|
277
|
-
if (mode !== 'compact' &&
|
|
278
|
-
stop !== 'cancelled' &&
|
|
279
|
-
!input.signal.aborted &&
|
|
280
|
-
requestCompletedAt !== undefined)
|
|
281
|
-
await emitFinalPerformance(requestCompletedAt);
|
|
282
|
-
pendingOutputContinuation = undefined;
|
|
283
|
-
incompleteToolCall = pendingTools.some((call) => call.argumentError !== undefined);
|
|
284
|
-
if (!(stop === 'max_output' && incompleteToolCall)) {
|
|
285
|
-
await persistToolCalls(pendingTools);
|
|
286
|
-
}
|
|
287
|
-
else
|
|
288
|
-
pendingTools.splice(0, pendingTools.length);
|
|
289
|
-
}
|
|
290
|
-
catch (error) {
|
|
291
|
-
this.planOutputPrefixes.clear();
|
|
292
|
-
if (await recoverModelStream(error, modelRetryState, input.recoverySignal())) {
|
|
293
|
-
this.finalAnswer = '';
|
|
294
|
-
if (mode === 'compact')
|
|
295
|
-
messages.splice(roundMessageCount);
|
|
296
|
-
if (pendingTools.some((call) => call.argumentError !== undefined))
|
|
297
|
-
pendingTools.splice(0, pendingTools.length);
|
|
298
|
-
else if (pendingTools.length > 0)
|
|
299
|
-
await persistToolCalls(pendingTools);
|
|
300
|
-
if (pendingTools.length === 0)
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
else if (mode === 'compact' &&
|
|
304
|
-
!sawModelSemanticEvent &&
|
|
305
|
-
isProviderContextOverflow(error) &&
|
|
306
|
-
input.compactionFallback?.()) {
|
|
307
|
-
modelRetryState.attempts = 0;
|
|
308
|
-
this.finalAnswer = '';
|
|
309
|
-
continue;
|
|
310
|
-
}
|
|
311
|
-
else if (mode !== 'compact' &&
|
|
312
|
-
!sawModelSemanticEvent &&
|
|
313
|
-
isProviderContextOverflow(error)) {
|
|
314
|
-
if (!recoveringFromContextOverflow && (await input.compactContext())) {
|
|
315
|
-
modelRetryState.attempts = 0;
|
|
316
|
-
recoveringFromContextOverflow = true;
|
|
317
|
-
continue;
|
|
318
|
-
}
|
|
319
|
-
throw new MarAgentError('MAR_AGENT_CONTEXT_LIMIT', 'The model rejected the compacted context as too large.', { cause: error });
|
|
320
|
-
}
|
|
321
|
-
else
|
|
322
|
-
throw error;
|
|
323
|
-
}
|
|
324
|
-
recoveringFromContextOverflow = false;
|
|
325
|
-
input.observeUsage(roundServerUsage);
|
|
326
|
-
const emptyCompletion = stop === 'completed' && !sawTool && !this.finalAnswer.trim();
|
|
327
|
-
await input.afterModel?.(pendingTools.length ? roundMessageCount : messages.length, emptyCompletion || stop === 'cancelled' ? undefined : round.request);
|
|
328
|
-
const toolResults = await executeRoundTools(pendingTools, round.toolScope);
|
|
329
|
-
for (const result of toolResults) {
|
|
330
|
-
if ('sourceImages' in result && result.sourceImages?.length)
|
|
331
|
-
input.toolImages.push(...result.sourceImages
|
|
332
|
-
.filter((image) => image.dataBase64 !== undefined)
|
|
333
|
-
.map((image) => ({
|
|
334
|
-
mimeType: image.mimeType,
|
|
335
|
-
data: Buffer.from(image.dataBase64, 'base64')
|
|
336
|
-
})));
|
|
337
|
-
const toolSearchTools = result.call.name === 'tool_search' && !result.failed
|
|
338
|
-
? result.output.toolSearchTools
|
|
339
|
-
: undefined;
|
|
340
|
-
const message = {
|
|
341
|
-
role: 'tool',
|
|
342
|
-
callId: result.call.callId,
|
|
343
|
-
name: result.call.name,
|
|
344
|
-
isError: result.failed,
|
|
345
|
-
content: result.content,
|
|
346
|
-
...(result.calls ? { calls: result.calls } : {}),
|
|
347
|
-
...(result.observations ? { observations: result.observations } : {}),
|
|
348
|
-
...(toolSearchTools === undefined ? {} : { toolSearchTools }),
|
|
349
|
-
...('images' in result && result.images?.length ? { images: result.images } : {})
|
|
350
|
-
};
|
|
351
|
-
messages.push(message);
|
|
352
|
-
await input.appendContext({
|
|
353
|
-
role: message.role,
|
|
354
|
-
callId: result.call.callId,
|
|
355
|
-
name: result.call.name,
|
|
356
|
-
isError: result.failed,
|
|
357
|
-
content: message.content,
|
|
358
|
-
...(message.calls ? { calls: message.calls } : {}),
|
|
359
|
-
...(message.observations ? { observations: message.observations } : {}),
|
|
360
|
-
...(message.images?.length
|
|
361
|
-
? { images: message.images.map(({ dataBase64: _bytes, ...image }) => image) }
|
|
362
|
-
: {}),
|
|
363
|
-
...(message.toolSearchTools === undefined
|
|
364
|
-
? {}
|
|
365
|
-
: { toolSearchTools: message.toolSearchTools })
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
if (sawTool) {
|
|
369
|
-
modelRetryState.attempts = 0;
|
|
370
|
-
if (input.sourceType === 'subagent')
|
|
371
|
-
this.finalAnswer = '';
|
|
372
|
-
}
|
|
373
|
-
if (mode !== 'compact' && stop === 'max_output') {
|
|
374
|
-
const needsContinuation = !sawTool || incompleteToolCall;
|
|
375
|
-
if (needsContinuation) {
|
|
376
|
-
if (maxOutputContinuationUsed)
|
|
377
|
-
throw new MarAgentError('MAR_AGENT_MODEL_OUTPUT_INCOMPLETE', 'Model output reached its limit before completing.');
|
|
378
|
-
maxOutputContinuationUsed = true;
|
|
379
|
-
pendingOutputContinuation = {
|
|
380
|
-
role: 'user',
|
|
381
|
-
content: modelOutputContinuationMessage
|
|
382
|
-
};
|
|
383
|
-
this.finalAnswer = '';
|
|
384
|
-
modelRetryState.attempts = 0;
|
|
385
|
-
continue;
|
|
386
|
-
}
|
|
387
|
-
maxOutputContinuationUsed = false;
|
|
388
|
-
}
|
|
389
|
-
else
|
|
390
|
-
maxOutputContinuationUsed = false;
|
|
391
|
-
await input.checkpoint(round, latestUsage);
|
|
392
|
-
if (input.signal.aborted) {
|
|
393
|
-
const aborted = toolResults.find((result) => result.failed)?.error;
|
|
394
|
-
throw aborted ?? new MarAgentError('MAR_AGENT_EXECUTION_CANCELLED', 'Execution cancelled.');
|
|
395
|
-
}
|
|
396
|
-
if (input.permissionStop?.()) {
|
|
397
|
-
input.mailbox.close();
|
|
398
|
-
this.finalAnswer = '';
|
|
399
|
-
return { finalAnswer: '', ...(latestUsage === undefined ? {} : { usage: latestUsage }) };
|
|
400
|
-
}
|
|
401
|
-
if (input.mailbox.hasPending() && (await input.mailbox.append())) {
|
|
402
|
-
this.finalAnswer = '';
|
|
403
|
-
modelRetryState.attempts = 0;
|
|
404
|
-
continue;
|
|
405
|
-
}
|
|
406
|
-
if (stop === 'completed' && !sawTool) {
|
|
407
|
-
const compactSummary = mode === 'compact' ? this.finalAnswer.trim() : '';
|
|
408
|
-
if (mode === 'compact' && !compactSummary)
|
|
409
|
-
throw new MarAgentError('MAR_AGENT_COMPACT_FAILED', 'Compaction returned an empty handoff.');
|
|
410
|
-
if (mode !== 'compact' && emptyCompletion) {
|
|
411
|
-
const error = new MarAgentError(input.sourceType === 'subagent'
|
|
412
|
-
? 'MAR_AGENT_SUBAGENT_FAILED'
|
|
413
|
-
: 'MAR_AGENT_MODEL_OUTPUT_INCOMPLETE', input.sourceType === 'subagent'
|
|
414
|
-
? 'Subagent completed without a final summary.'
|
|
415
|
-
: 'Model completed without an answer or tool request.', { retryable: input.sourceType !== 'subagent' });
|
|
416
|
-
this.planOutputPrefixes.clear();
|
|
417
|
-
if (await recoverModelStream(error, modelRetryState, input.recoverySignal())) {
|
|
418
|
-
this.finalAnswer = '';
|
|
419
|
-
continue;
|
|
420
|
-
}
|
|
421
|
-
throw error;
|
|
422
|
-
}
|
|
423
|
-
input.mailbox.close();
|
|
424
|
-
return {
|
|
425
|
-
finalAnswer: this.finalAnswer,
|
|
426
|
-
...(latestUsage === undefined ? {} : { usage: latestUsage })
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
if (!sawTool && stop !== 'pause')
|
|
430
|
-
throw new MarAgentError('MAR_AGENT_MODEL_OUTPUT_INCOMPLETE', 'Model did not complete or request a tool.');
|
|
431
|
-
modelRetryState.attempts = 0;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
function isModelResponseEvent(event) {
|
|
436
|
-
if (event.type === 'text.delta')
|
|
437
|
-
return event.delta.length > 0;
|
|
438
|
-
if (event.type === 'text.completed' || event.type === 'reasoning.completed')
|
|
439
|
-
return event.text.length > 0;
|
|
440
|
-
return (event.type === 'response.item' ||
|
|
441
|
-
event.type === 'output.delta' ||
|
|
442
|
-
event.type === 'client_tool.call' ||
|
|
443
|
-
event.type === 'hosted_tool' ||
|
|
444
|
-
event.type === 'citation');
|
|
445
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { MarAgentError } from '../error.js';
|
|
2
|
-
const MODEL_PROGRESS_TIMEOUT_MS = 300_000;
|
|
3
|
-
/** Watch normalized generation progress, not transport traffic or consumer processing. */
|
|
4
|
-
export async function* observeModelProgress(start, parent) {
|
|
5
|
-
parent.throwIfAborted();
|
|
6
|
-
const controller = new AbortController();
|
|
7
|
-
const signal = AbortSignal.any([parent, controller.signal]);
|
|
8
|
-
const iterator = start(signal)[Symbol.asyncIterator]();
|
|
9
|
-
const hostedStates = new Map();
|
|
10
|
-
let remainingMs = MODEL_PROGRESS_TIMEOUT_MS;
|
|
11
|
-
let failed = false;
|
|
12
|
-
try {
|
|
13
|
-
for (;;) {
|
|
14
|
-
signal.throwIfAborted();
|
|
15
|
-
const startedAt = performance.now();
|
|
16
|
-
let abort;
|
|
17
|
-
const timer = setTimeout(() => {
|
|
18
|
-
controller.abort(new MarAgentError('MAR_AGENT_MODEL_TIMEOUT', 'Model request produced no generation progress for 300 seconds.', { details: { reason: 'MODEL_PROGRESS_TIMEOUT' }, retryable: true }));
|
|
19
|
-
}, Math.ceil(remainingMs));
|
|
20
|
-
timer.unref();
|
|
21
|
-
let next;
|
|
22
|
-
try {
|
|
23
|
-
next = await Promise.race([
|
|
24
|
-
iterator.next(),
|
|
25
|
-
new Promise((_resolve, reject) => {
|
|
26
|
-
abort = () => reject(signal.reason);
|
|
27
|
-
signal.addEventListener('abort', abort, { once: true });
|
|
28
|
-
if (signal.aborted)
|
|
29
|
-
abort();
|
|
30
|
-
})
|
|
31
|
-
]);
|
|
32
|
-
signal.throwIfAborted();
|
|
33
|
-
}
|
|
34
|
-
finally {
|
|
35
|
-
clearTimeout(timer);
|
|
36
|
-
if (abort)
|
|
37
|
-
signal.removeEventListener('abort', abort);
|
|
38
|
-
}
|
|
39
|
-
remainingMs = Math.max(0, remainingMs - (performance.now() - startedAt));
|
|
40
|
-
if (next.done)
|
|
41
|
-
return;
|
|
42
|
-
if (isGenerationProgress(next.value, hostedStates))
|
|
43
|
-
remainingMs = MODEL_PROGRESS_TIMEOUT_MS;
|
|
44
|
-
yield next.value;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
failed = true;
|
|
49
|
-
parent.throwIfAborted();
|
|
50
|
-
if (signal.aborted)
|
|
51
|
-
throw signal.reason;
|
|
52
|
-
throw error;
|
|
53
|
-
}
|
|
54
|
-
finally {
|
|
55
|
-
controller.abort();
|
|
56
|
-
try {
|
|
57
|
-
await iterator.return?.();
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
if (!failed)
|
|
61
|
-
throw error;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function isGenerationProgress(event, hostedStates) {
|
|
66
|
-
switch (event.type) {
|
|
67
|
-
case 'output.delta':
|
|
68
|
-
case 'client_tool.call':
|
|
69
|
-
case 'citation':
|
|
70
|
-
case 'completed':
|
|
71
|
-
return true;
|
|
72
|
-
case 'text.delta':
|
|
73
|
-
return event.delta.length > 0;
|
|
74
|
-
case 'text.completed':
|
|
75
|
-
case 'reasoning.completed':
|
|
76
|
-
return event.text.length > 0;
|
|
77
|
-
case 'hosted_tool': {
|
|
78
|
-
const previous = hostedStates.get(event.itemId);
|
|
79
|
-
hostedStates.set(event.itemId, event.status);
|
|
80
|
-
return previous !== event.status;
|
|
81
|
-
}
|
|
82
|
-
default:
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { MarAgentHost } from '../host/contracts.js';
|
|
2
|
-
import type { ModelImage } from '../model/image.js';
|
|
3
|
-
import type { SessionStore } from '../session/store/contracts.js';
|
|
4
|
-
/** Persist immutable bytes first; publication never changes an existing resource URL. */
|
|
5
|
-
export declare function publishModelResources<T extends ModelImage>(host: MarAgentHost, images: readonly T[] | undefined, context: {
|
|
6
|
-
sessionId: string;
|
|
7
|
-
executionId: string;
|
|
8
|
-
}, store?: SessionStore): Promise<readonly T[] | undefined>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { isModelImageUrl } from '../model/image.js';
|
|
2
|
-
import { MarAgentError } from '../error.js';
|
|
3
|
-
const pending = new WeakMap();
|
|
4
|
-
/** Persist immutable bytes first; publication never changes an existing resource URL. */
|
|
5
|
-
export async function publishModelResources(host, images, context, store) {
|
|
6
|
-
if (!images?.length)
|
|
7
|
-
return images;
|
|
8
|
-
if (store === undefined) {
|
|
9
|
-
if (host.publishModelResource === undefined)
|
|
10
|
-
return images;
|
|
11
|
-
throw new MarAgentError('MAR_AGENT_IMAGE_PUBLICATION_FAILED', 'Image publication requires a SessionStore.');
|
|
12
|
-
}
|
|
13
|
-
let publications = pending.get(store);
|
|
14
|
-
if (publications === undefined)
|
|
15
|
-
pending.set(store, (publications = new Map()));
|
|
16
|
-
return Promise.all(images.map(async (image) => {
|
|
17
|
-
if (image.dataBase64 === undefined &&
|
|
18
|
-
image.resourceId === undefined &&
|
|
19
|
-
isModelImageUrl(image.url))
|
|
20
|
-
return image;
|
|
21
|
-
let resource = await store.persistResource(context.sessionId, image);
|
|
22
|
-
if (resource.url === undefined && image.url !== undefined && image.urlExpiresAt !== undefined)
|
|
23
|
-
resource = await store.setResourceUrl(context.sessionId, resource.resourceId, {
|
|
24
|
-
url: image.url,
|
|
25
|
-
urlExpiresAt: image.urlExpiresAt
|
|
26
|
-
});
|
|
27
|
-
const key = `${context.sessionId}\0${resource.resourceId}`;
|
|
28
|
-
let publication = publications.get(key);
|
|
29
|
-
if (publication === undefined) {
|
|
30
|
-
publication = (async () => {
|
|
31
|
-
if (resource.url === undefined && host.publishModelResource !== undefined) {
|
|
32
|
-
const published = await host.publishModelResource(resource, {
|
|
33
|
-
...context,
|
|
34
|
-
homeDirectory: (await host.describe()).homeDirectory
|
|
35
|
-
});
|
|
36
|
-
if (published === undefined ||
|
|
37
|
-
!isModelImageUrl(published.url) ||
|
|
38
|
-
!Number.isSafeInteger(published.urlExpiresAt) ||
|
|
39
|
-
published.urlExpiresAt <= 0)
|
|
40
|
-
throw new MarAgentError('MAR_AGENT_IMAGE_PUBLICATION_FAILED', 'Image publication did not return a valid fixed URL.');
|
|
41
|
-
resource = await store.setResourceUrl(context.sessionId, resource.resourceId, published);
|
|
42
|
-
}
|
|
43
|
-
const { sha256: _hash, ...reference } = resource;
|
|
44
|
-
return resource.url === undefined && image.dataBase64 !== undefined
|
|
45
|
-
? { ...reference, dataBase64: image.dataBase64 }
|
|
46
|
-
: reference;
|
|
47
|
-
})();
|
|
48
|
-
publications.set(key, publication);
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
const published = await publication;
|
|
52
|
-
const { dataBase64: _bytes, ...metadata } = image;
|
|
53
|
-
return { ...metadata, ...published, resourceInputVersion: 1 };
|
|
54
|
-
}
|
|
55
|
-
finally {
|
|
56
|
-
if (publications.get(key) === publication)
|
|
57
|
-
publications.delete(key);
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type MarAgentModelConfiguration } from '../model/configuration.js';
|
|
2
|
-
import type { ModelAdapter } from '../model/contracts.js';
|
|
3
|
-
import type { CreateMarAgentOptions, MarAgent } from './types.js';
|
|
4
|
-
interface InternalCreateMarAgentOptions extends CreateMarAgentOptions {
|
|
5
|
-
readonly adapterFactory?: (configuration: MarAgentModelConfiguration) => ModelAdapter;
|
|
6
|
-
}
|
|
7
|
-
/** Validate models before Host negotiation and expose only built-in protocol adapters. */
|
|
8
|
-
export declare function createMarAgent(options: CreateMarAgentOptions): Promise<MarAgent>;
|
|
9
|
-
/** Package-internal seam for deterministic adapter tests; not a package export. */
|
|
10
|
-
export declare function createMarAgentWithAdapter(options: InternalCreateMarAgentOptions): Promise<MarAgent>;
|
|
11
|
-
export {};
|