@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
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { lstat, mkdir, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { AgentError } from '../error.js';
|
|
5
|
+
import { parseToolResultExtensions } from '../tools/result-extensions.js';
|
|
6
|
+
const REF = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/u;
|
|
7
|
+
const MAX_BYTES = 16 * 1024 * 1024;
|
|
8
|
+
export async function writeToolResultResource(directory, text) {
|
|
9
|
+
const bytes = Buffer.from(text);
|
|
10
|
+
if (bytes.length > MAX_BYTES)
|
|
11
|
+
throw resourceError('LIMIT', 'Tool result resource exceeds its limit.');
|
|
12
|
+
const resourceRef = randomUUID();
|
|
13
|
+
const folder = join(directory, 'tool_results');
|
|
14
|
+
await mkdir(folder, { recursive: true, mode: 0o700 });
|
|
15
|
+
const temporary = join(folder, `.${resourceRef}.tmp`);
|
|
16
|
+
await writeFile(join(folder, `.${resourceRef}.pending`), '', {
|
|
17
|
+
flag: 'wx',
|
|
18
|
+
mode: 0o600,
|
|
19
|
+
flush: true
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
await writeFile(temporary, bytes, { flag: 'wx', mode: 0o600, flush: true });
|
|
23
|
+
await rename(temporary, join(folder, `${resourceRef}.diff`));
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
await rm(temporary, { force: true });
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
status: 'available',
|
|
30
|
+
resourceRef,
|
|
31
|
+
format: 'unified-diff',
|
|
32
|
+
byteSize: bytes.length,
|
|
33
|
+
sha256: createHash('sha256').update(bytes).digest('hex')
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function recordToolResources(record) {
|
|
37
|
+
if (!['tool.completed', 'tool.failed'].includes(record.type))
|
|
38
|
+
return [];
|
|
39
|
+
const payload = record.payload;
|
|
40
|
+
const sources = [
|
|
41
|
+
payload?.resultExtensions,
|
|
42
|
+
...(Array.isArray(payload?.data?.calls)
|
|
43
|
+
? payload.data.calls.map((call) => call.resultExtensions)
|
|
44
|
+
: [])
|
|
45
|
+
];
|
|
46
|
+
return sources.flatMap((source) => (parseToolResultExtensions(source) ?? []).flatMap((extension) => extension.entries.flatMap((entry) => (entry.diff.status === 'available' ? [entry.diff] : []))));
|
|
47
|
+
}
|
|
48
|
+
/** A locator is only a hint: reads must verify its exact committed record identity. */
|
|
49
|
+
export async function bindToolResultResources(directory, record, readRecord, degrade = false) {
|
|
50
|
+
for (const resource of recordToolResources(record)) {
|
|
51
|
+
try {
|
|
52
|
+
await bindToolResultResource(directory, record, resource, readRecord);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (!degrade)
|
|
56
|
+
throw error;
|
|
57
|
+
// Shared descriptors are downgraded before persistence and live publication, never the tool outcome.
|
|
58
|
+
const payload = record.payload;
|
|
59
|
+
for (const extensions of [
|
|
60
|
+
payload.resultExtensions,
|
|
61
|
+
...(payload.data?.calls ?? []).map((call) => call.resultExtensions)
|
|
62
|
+
]) {
|
|
63
|
+
for (const extension of extensions ?? [])
|
|
64
|
+
for (const entry of extension.entries) {
|
|
65
|
+
if (entry.diff.status === 'available' &&
|
|
66
|
+
entry.diff.resourceRef === resource.resourceRef)
|
|
67
|
+
entry.diff = { status: 'unavailable', reason: 'storage-failed' };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function bindToolResultResource(directory, record, resource, readRecord) {
|
|
74
|
+
const path = join(directory, 'tool_results', `${resource.resourceRef}.json`);
|
|
75
|
+
try {
|
|
76
|
+
await writeFile(path, JSON.stringify({ sequence: record.sequence, recordId: record.recordId }), { flag: 'wx', mode: 0o600, flush: true });
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (error.code !== 'EEXIST')
|
|
80
|
+
throw error;
|
|
81
|
+
try {
|
|
82
|
+
const locator = JSON.parse(await readFile(path, 'utf8'));
|
|
83
|
+
const existing = locator.sequence === record.sequence && locator.recordId === record.recordId
|
|
84
|
+
? record
|
|
85
|
+
: Number.isSafeInteger(locator.sequence)
|
|
86
|
+
? await readRecord?.(locator.sequence)
|
|
87
|
+
: undefined;
|
|
88
|
+
if (!existing ||
|
|
89
|
+
existing.recordId !== locator.recordId ||
|
|
90
|
+
!recordToolResources(existing).some((entry) => entry.resourceRef === resource.resourceRef && entry.sha256 === resource.sha256))
|
|
91
|
+
throw resourceError('CORRUPT', 'Tool resource locator conflicts with committed history.');
|
|
92
|
+
}
|
|
93
|
+
catch (cause) {
|
|
94
|
+
throw normalizedResourceError(cause);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export function toolResultResourceFiles(records) {
|
|
99
|
+
return new Set(records.flatMap((record) => recordToolResources(record).flatMap((resource) => [
|
|
100
|
+
`${resource.resourceRef}.diff`,
|
|
101
|
+
`${resource.resourceRef}.json`
|
|
102
|
+
])));
|
|
103
|
+
}
|
|
104
|
+
export async function copyToolResultResources(source, target, records) {
|
|
105
|
+
const copied = new Set();
|
|
106
|
+
for (const record of records) {
|
|
107
|
+
for (const resource of recordToolResources(record)) {
|
|
108
|
+
if (copied.has(resource.resourceRef))
|
|
109
|
+
continue;
|
|
110
|
+
copied.add(resource.resourceRef);
|
|
111
|
+
try {
|
|
112
|
+
const bytes = await readResourceBytes(source, resource);
|
|
113
|
+
const directory = join(target, 'tool_results');
|
|
114
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
115
|
+
await writeFile(join(directory, `${resource.resourceRef}.diff`), bytes, {
|
|
116
|
+
flag: 'wx',
|
|
117
|
+
mode: 0o600,
|
|
118
|
+
flush: true
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (error instanceof AgentError && error.code === 'MAR_AGENT_TOOL_RESOURCE_NOT_FOUND')
|
|
123
|
+
continue;
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (recordToolResources(record).length) {
|
|
128
|
+
await mkdir(join(target, 'tool_results'), { recursive: true, mode: 0o700 });
|
|
129
|
+
await bindToolResultResources(target, record, async (sequence) => records.find((item) => item.sequence === sequence));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export async function completeToolResultResources(directory, record) {
|
|
134
|
+
await Promise.all(recordToolResources(record).map((resource) => rm(join(directory, 'tool_results', `.${resource.resourceRef}.pending`), {
|
|
135
|
+
force: true
|
|
136
|
+
}).catch(() => undefined)));
|
|
137
|
+
}
|
|
138
|
+
export async function cleanupUnreferencedToolResources(directory, readRecords) {
|
|
139
|
+
const folder = join(directory, 'tool_results');
|
|
140
|
+
let names;
|
|
141
|
+
try {
|
|
142
|
+
names = await readdir(folder);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (error.code === 'ENOENT')
|
|
146
|
+
return;
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
const pending = names.filter((name) => name.startsWith('.') && name.endsWith('.pending') && REF.test(name.slice(1, -8)));
|
|
150
|
+
if (!pending.length)
|
|
151
|
+
return;
|
|
152
|
+
const retained = toolResultResourceFiles(await readRecords());
|
|
153
|
+
for (const marker of pending) {
|
|
154
|
+
const ref = marker.slice(1, -8);
|
|
155
|
+
for (const name of [`${ref}.diff`, `${ref}.json`, `.${ref}.tmp`]) {
|
|
156
|
+
if (retained.has(name))
|
|
157
|
+
continue;
|
|
158
|
+
const path = join(folder, name);
|
|
159
|
+
try {
|
|
160
|
+
if ((await lstat(path)).isFile())
|
|
161
|
+
await rm(path);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
if (error.code !== 'ENOENT')
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
await rm(join(folder, marker), { force: true });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/** Caller must hold a stable history and resource generation for the entire read. */
|
|
172
|
+
export async function readToolResultResource(directory, sessionId, input, readRecord) {
|
|
173
|
+
if (!REF.test(input.resourceRef) ||
|
|
174
|
+
(input.maxBytes !== undefined &&
|
|
175
|
+
(!Number.isSafeInteger(input.maxBytes) || input.maxBytes < 4 || input.maxBytes > 256 * 1024)))
|
|
176
|
+
throw resourceError('INPUT_INVALID', 'Invalid tool resource request.');
|
|
177
|
+
let locator;
|
|
178
|
+
try {
|
|
179
|
+
const file = join(directory, 'tool_results', `${input.resourceRef}.json`);
|
|
180
|
+
locator = JSON.parse(await readFile(file, 'utf8'));
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
throw normalizedResourceError(error);
|
|
184
|
+
}
|
|
185
|
+
if (!Number.isSafeInteger(locator.sequence) ||
|
|
186
|
+
locator.sequence < 1 ||
|
|
187
|
+
typeof locator.recordId !== 'string')
|
|
188
|
+
throw resourceError('CORRUPT', 'Invalid tool resource locator.');
|
|
189
|
+
const record = await readRecord(locator.sequence);
|
|
190
|
+
const resource = record?.recordId === locator.recordId
|
|
191
|
+
? recordToolResources(record).find((entry) => entry.resourceRef === input.resourceRef)
|
|
192
|
+
: undefined;
|
|
193
|
+
if (!resource)
|
|
194
|
+
throw resourceError('NOT_FOUND', 'Tool resource is not part of this session history.');
|
|
195
|
+
const bytes = await readResourceBytes(directory, resource);
|
|
196
|
+
let offset = 0;
|
|
197
|
+
if (input.cursor !== undefined) {
|
|
198
|
+
try {
|
|
199
|
+
if (input.cursor.length > 1024)
|
|
200
|
+
throw new Error('cursor');
|
|
201
|
+
const cursor = JSON.parse(Buffer.from(input.cursor, 'base64url').toString('utf8'));
|
|
202
|
+
if (cursor.sessionId !== sessionId ||
|
|
203
|
+
cursor.ref !== resource.resourceRef ||
|
|
204
|
+
cursor.sha256 !== resource.sha256 ||
|
|
205
|
+
!Number.isSafeInteger(cursor.offset) ||
|
|
206
|
+
cursor.offset < 0 ||
|
|
207
|
+
cursor.offset >= bytes.length)
|
|
208
|
+
throw new Error('cursor');
|
|
209
|
+
offset = cursor.offset;
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
throw resourceError('INPUT_INVALID', 'Invalid tool resource cursor.');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (offset > 0 && (bytes[offset] & 0xc0) === 0x80)
|
|
216
|
+
throw resourceError('INPUT_INVALID', 'Invalid tool resource cursor boundary.');
|
|
217
|
+
let end = Math.min(bytes.length, offset + (input.maxBytes ?? 256 * 1024));
|
|
218
|
+
while (end < bytes.length && (bytes[end] & 0xc0) === 0x80)
|
|
219
|
+
end--;
|
|
220
|
+
return {
|
|
221
|
+
type: 'file_changes',
|
|
222
|
+
version: 1,
|
|
223
|
+
format: resource.format,
|
|
224
|
+
resourceRef: resource.resourceRef,
|
|
225
|
+
byteSize: resource.byteSize,
|
|
226
|
+
sha256: resource.sha256,
|
|
227
|
+
content: bytes.subarray(offset, end).toString('utf8'),
|
|
228
|
+
...(end < bytes.length
|
|
229
|
+
? {
|
|
230
|
+
nextCursor: Buffer.from(JSON.stringify({
|
|
231
|
+
sessionId,
|
|
232
|
+
ref: resource.resourceRef,
|
|
233
|
+
sha256: resource.sha256,
|
|
234
|
+
offset: end
|
|
235
|
+
})).toString('base64url')
|
|
236
|
+
}
|
|
237
|
+
: {})
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
async function readResourceBytes(directory, resource) {
|
|
241
|
+
try {
|
|
242
|
+
return await readFile(join(directory, 'tool_results', `${resource.resourceRef}.diff`));
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
throw normalizedResourceError(error);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function resourceError(suffix, message) {
|
|
249
|
+
return new AgentError(`MAR_AGENT_TOOL_RESOURCE_${suffix}`, message);
|
|
250
|
+
}
|
|
251
|
+
function normalizedResourceError(error) {
|
|
252
|
+
if (error instanceof AgentError)
|
|
253
|
+
return error;
|
|
254
|
+
return resourceError(error?.code === 'ENOENT' ? 'NOT_FOUND' : 'CORRUPT', 'Tool result resource is unavailable.');
|
|
255
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentImageMetadata } from '../runtime/contracts.js';
|
|
2
|
+
export interface AgentSessionHistoryImageMetadata extends AgentImageMetadata {
|
|
3
|
+
readable: boolean;
|
|
4
|
+
}
|
|
5
|
+
export type AgentUserHistoryEntry = {
|
|
6
|
+
kind: 'user';
|
|
7
|
+
recordId?: string;
|
|
8
|
+
sequence: number;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
sessionId: string;
|
|
11
|
+
executionId: string;
|
|
12
|
+
turnId: string;
|
|
13
|
+
text: string;
|
|
14
|
+
clientMessageId?: string;
|
|
15
|
+
inputSource?: 'user' | 'parent_agent';
|
|
16
|
+
images?: readonly AgentSessionHistoryImageMetadata[];
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { ExtensionCheckpoint, ExtensionJsonValue } from './session/extension-checkpoint.js';
|
|
2
|
+
export type { AvailableToolResultResource, CodeModeStateEntry, CodeObservation, CodeToolCallRecord, CompactHistoryMessage, CompactUserInput, ContextGcBase, ContextGcCheckpointDraft, ContextGcEconomicsPolicy, ContextGcMetrics, ContextGcPlatform, ContextGcReadItemReplacement, ContextGcReplacement, ContextGcSubagentToolName, ContextGcTarget, ContextGcWebToolName, EnvironmentContextState, ModelContextualBlock, ModelInputMetadata, ModelMessage, ModelTextBlock, ModelUsage, RestoredSessionInputImage, SessionExecutionState, SessionInputImage, SessionInputImageData, SessionInputImageMetadata, SessionRecord, SessionRecordInput, SessionResource, SessionStore, SessionStoreCompactInput, SessionStoreMaintenance, SessionStoreSession, TodoItem, TodoSnapshot } from './session/store/contracts.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type AgentModelConfiguration } from '../model/configuration.js';
|
|
2
2
|
export interface GenerateSessionTitleInput {
|
|
3
|
-
readonly onModelUsage?: (usage: import('../
|
|
3
|
+
readonly onModelUsage?: (usage: import('../model/usage-observer.js').ModelRequestUsage) => Promise<void> | void;
|
|
4
4
|
readonly onModelUsageFailure?: () => void;
|
|
5
|
-
readonly models: readonly
|
|
5
|
+
readonly models: readonly AgentModelConfiguration[];
|
|
6
6
|
readonly currentModelId: string;
|
|
7
7
|
readonly prompt: string;
|
|
8
8
|
/** Used only when the user message does not establish a language. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import {
|
|
3
|
-
import { AnthropicMessagesAdapter } from '../
|
|
4
|
-
import { resolveModelDefaultReasoningEffort } from '../
|
|
5
|
-
import { OpenAiResponsesAdapter } from '../
|
|
2
|
+
import { AgentError } from '../error.js';
|
|
3
|
+
import { AnthropicMessagesAdapter } from '../model/anthropic-messages.js';
|
|
4
|
+
import { resolveModelDefaultReasoningEffort } from '../model/configuration.js';
|
|
5
|
+
import { OpenAiResponsesAdapter } from '../model/openai-responses.js';
|
|
6
6
|
const sessionTitlePrompt = `You are a session title generator. Output only one title and nothing else.
|
|
7
7
|
|
|
8
8
|
Create a brief title that helps the user find this conversation later.
|
|
@@ -16,12 +16,12 @@ Create a brief title that helps the user find this conversation later.
|
|
|
16
16
|
export async function generateSessionTitle(input) {
|
|
17
17
|
const defaultLanguage = input.defaultLanguage?.trim();
|
|
18
18
|
if (input.defaultLanguage !== undefined && (!defaultLanguage || defaultLanguage.length > 128))
|
|
19
|
-
throw new
|
|
19
|
+
throw new AgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Default title language is invalid.');
|
|
20
20
|
const models = input.models.filter((model) => model.enabled);
|
|
21
21
|
const model = models.find((candidate) => candidate.titleGeneration) ??
|
|
22
22
|
models.find((candidate) => candidate.id === input.currentModelId);
|
|
23
23
|
if (!model)
|
|
24
|
-
throw new
|
|
24
|
+
throw new AgentError('MAR_AGENT_MODEL_DISABLED', 'Selected title model is unavailable.');
|
|
25
25
|
const signal = AbortSignal.any([input.signal, AbortSignal.timeout(30_000)]);
|
|
26
26
|
signal.throwIfAborted();
|
|
27
27
|
const adapter = model.protocol === 'OPENAI_RESPONSES'
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { ModelAttemptDiagnostic, ModelUsage } from '../
|
|
3
|
-
import type {
|
|
4
|
-
import type { ClientToolDefinition, ToolCall } from '../
|
|
1
|
+
import { type AgentModelConfiguration, type AgentReasoningEffort } from '../model/configuration.js';
|
|
2
|
+
import type { ModelAttemptDiagnostic, ModelUsage } from '../model/contracts.js';
|
|
3
|
+
import type { ExtensionCompactMessage } from '../extensions/compaction.js';
|
|
4
|
+
import type { ClientToolDefinition, ToolCall } from '../tools/contracts.js';
|
|
5
5
|
export interface GenerateModelTextInput {
|
|
6
|
-
readonly onModelUsage?: (usage: import('../
|
|
6
|
+
readonly onModelUsage?: (usage: import('../model/usage-observer.js').ModelRequestUsage) => Promise<void> | void;
|
|
7
7
|
readonly onModelUsageFailure?: () => void;
|
|
8
|
-
readonly model:
|
|
8
|
+
readonly model: AgentModelConfiguration;
|
|
9
9
|
readonly system: string;
|
|
10
|
-
readonly messages: readonly
|
|
10
|
+
readonly messages: readonly ExtensionCompactMessage[];
|
|
11
11
|
/** Declarative client tools only. Returned calls are never executed or continued here. */
|
|
12
12
|
readonly tools?: readonly ClientToolDefinition[];
|
|
13
13
|
readonly promptCacheKey?: string;
|
|
14
14
|
readonly cachePrefixMessages?: number;
|
|
15
|
-
readonly reasoningEffort?:
|
|
15
|
+
readonly reasoningEffort?: AgentReasoningEffort;
|
|
16
16
|
readonly outputLimit?: number;
|
|
17
17
|
readonly signal: AbortSignal;
|
|
18
18
|
readonly onAttemptDiagnostic?: (diagnostic: ModelAttemptDiagnostic) => Promise<void> | void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import {
|
|
3
|
-
import { AnthropicMessagesAdapter } from '../
|
|
4
|
-
import { OpenAiResponsesAdapter } from '../
|
|
5
|
-
import {
|
|
2
|
+
import { AgentError } from '../error.js';
|
|
3
|
+
import { AnthropicMessagesAdapter } from '../model/anthropic-messages.js';
|
|
4
|
+
import { OpenAiResponsesAdapter } from '../model/openai-responses.js';
|
|
5
|
+
import { projectModelRequest } from '../sdk/model-input-projection.js';
|
|
6
|
+
import { resolveModelDefaultReasoningEffort } from '../model/configuration.js';
|
|
6
7
|
/** One request using the SDK transports, without tool execution or a Session. */
|
|
7
8
|
export async function generateModelText(input) {
|
|
8
9
|
input.signal.throwIfAborted();
|
|
@@ -19,7 +20,7 @@ export async function generateModelText(input) {
|
|
|
19
20
|
const toolCalls = [];
|
|
20
21
|
let usage;
|
|
21
22
|
try {
|
|
22
|
-
for await (const event of adapter.start({
|
|
23
|
+
for await (const event of adapter.start(projectModelRequest({
|
|
23
24
|
retryState: { attempts: 0, maxAttempts: 1 },
|
|
24
25
|
usageRequestId: randomUUID(),
|
|
25
26
|
...(input.onModelUsage === undefined ? {} : { onModelUsage: input.onModelUsage }),
|
|
@@ -38,7 +39,7 @@ export async function generateModelText(input) {
|
|
|
38
39
|
...(input.promptCacheKey === undefined ? {} : { promptCacheKey: input.promptCacheKey }),
|
|
39
40
|
...(input.onAttemptDiagnostic ? { onAttemptDiagnostic: input.onAttemptDiagnostic } : {}),
|
|
40
41
|
...(input.outputLimit === undefined ? {} : { outputLimit: input.outputLimit })
|
|
41
|
-
}, input.signal)) {
|
|
42
|
+
}), input.signal)) {
|
|
42
43
|
input.signal.throwIfAborted();
|
|
43
44
|
if (event.type === 'text.completed' && (event.phase ?? 'final_answer') === 'final_answer')
|
|
44
45
|
text = event.text.trim();
|
|
@@ -49,7 +50,7 @@ export async function generateModelText(input) {
|
|
|
49
50
|
event.reason === 'completed' || (event.reason === 'tool_use' && toolCalls.length > 0);
|
|
50
51
|
else if (event.type === 'client_tool.call') {
|
|
51
52
|
if (!tools.some((tool) => tool.name === event.name) || event.argumentError !== undefined)
|
|
52
|
-
throw new
|
|
53
|
+
throw new AgentError('MAR_AGENT_MODEL_PROTOCOL_ERROR', 'Standalone generation returned an undeclared tool or invalid tool arguments.');
|
|
53
54
|
toolCalls.push({ name: event.name, callId: event.callId, arguments: event.arguments });
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { open, readFile, rm } from 'node:fs/promises';
|
|
2
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
3
|
+
import { AgentError } from '../error.js';
|
|
4
|
+
export async function acquireFileLock(path, message = 'Session index is busy.', waitMs = 5000, options = {}) {
|
|
5
|
+
const deadline = Date.now() + waitMs;
|
|
6
|
+
for (;;) {
|
|
7
|
+
options.signal?.throwIfAborted();
|
|
8
|
+
let handle;
|
|
9
|
+
try {
|
|
10
|
+
handle = await open(path, 'wx', 0o600);
|
|
11
|
+
}
|
|
12
|
+
catch (cause) {
|
|
13
|
+
if (cause.code !== 'EEXIST')
|
|
14
|
+
throw cause;
|
|
15
|
+
if (await removeDeadOwner(path))
|
|
16
|
+
continue;
|
|
17
|
+
if (Date.now() >= deadline)
|
|
18
|
+
throw new AgentError(options.code ?? 'MAR_AGENT_SESSION_LOCKED', message, { cause });
|
|
19
|
+
await delay(25 + Math.floor(Math.random() * 25), undefined, options.signal ? { signal: options.signal } : {});
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
await handle.writeFile(JSON.stringify({ pid: process.pid, createdAt: new Date().toISOString() }));
|
|
24
|
+
options.signal?.throwIfAborted();
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
try {
|
|
28
|
+
await handle.close();
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
await rm(path, { force: true });
|
|
32
|
+
}
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
let released = false;
|
|
36
|
+
return async () => {
|
|
37
|
+
if (released)
|
|
38
|
+
return;
|
|
39
|
+
released = true;
|
|
40
|
+
await handle.close();
|
|
41
|
+
await rm(path, { force: true });
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function removeDeadOwner(path) {
|
|
46
|
+
const reclaimerPath = `${path}.reclaim`;
|
|
47
|
+
let reclaimer;
|
|
48
|
+
try {
|
|
49
|
+
// Only one process may unlink a dead owner's path; all other contenders wait.
|
|
50
|
+
reclaimer = await open(reclaimerPath, 'wx', 0o600);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (error.code === 'EEXIST')
|
|
54
|
+
return false;
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const owner = JSON.parse(await readFile(path, 'utf8'));
|
|
59
|
+
if (typeof owner.pid !== 'number' || !Number.isSafeInteger(owner.pid))
|
|
60
|
+
return false;
|
|
61
|
+
try {
|
|
62
|
+
process.kill(owner.pid, 0);
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (error.code !== 'ESRCH')
|
|
67
|
+
return false;
|
|
68
|
+
await rm(path, { force: true });
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
try {
|
|
77
|
+
await reclaimer.close();
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
await rm(reclaimerPath, { force: true });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { AgentReasoningEffort } from '../model/configuration.js';
|
|
2
|
+
import type { ExecutionResult } from '../runtime/contracts.js';
|
|
3
|
+
export interface SubagentTaskInput {
|
|
4
|
+
description: string;
|
|
5
|
+
prompt: string;
|
|
6
|
+
role: 'general-purpose' | 'explore';
|
|
7
|
+
modelId?: string;
|
|
8
|
+
reasoningEffort?: AgentReasoningEffort;
|
|
9
|
+
background?: boolean;
|
|
10
|
+
parentSubagentId?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SubagentLatestMessage {
|
|
13
|
+
itemId: string;
|
|
14
|
+
turnId: string;
|
|
15
|
+
phase: 'commentary' | 'final_answer';
|
|
16
|
+
text: string;
|
|
17
|
+
timestamp: string;
|
|
18
|
+
truncated: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type SubagentLatestActivity = {
|
|
21
|
+
kind: 'message';
|
|
22
|
+
timestamp: string;
|
|
23
|
+
phase: 'commentary' | 'final_answer';
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'tool';
|
|
26
|
+
timestamp: string;
|
|
27
|
+
toolName: string;
|
|
28
|
+
status: 'started' | 'completed' | 'failed';
|
|
29
|
+
};
|
|
30
|
+
export interface SubagentTaskSnapshot extends Record<string, unknown> {
|
|
31
|
+
permissionStop?: ExecutionResult['permissionStop'];
|
|
32
|
+
agentId: string;
|
|
33
|
+
description: string;
|
|
34
|
+
role?: SubagentTaskInput['role'];
|
|
35
|
+
extensionId?: string;
|
|
36
|
+
status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled' | 'interrupted';
|
|
37
|
+
modelId?: string;
|
|
38
|
+
modelName?: string;
|
|
39
|
+
reasoningEffort?: AgentReasoningEffort;
|
|
40
|
+
latestMessage?: SubagentLatestMessage;
|
|
41
|
+
latestActivity?: SubagentLatestActivity;
|
|
42
|
+
summary?: string;
|
|
43
|
+
changedFiles?: string[];
|
|
44
|
+
verification?: string[];
|
|
45
|
+
evidence?: Array<{
|
|
46
|
+
path: string;
|
|
47
|
+
startLine?: number;
|
|
48
|
+
endLine?: number;
|
|
49
|
+
}>;
|
|
50
|
+
errorCode?: string;
|
|
51
|
+
errorMessage?: string;
|
|
52
|
+
messageId?: string;
|
|
53
|
+
turnId?: string;
|
|
54
|
+
deliveryStatus?: 'accepted' | 'applied' | 'cancelled' | 'failed';
|
|
55
|
+
waitOutcome?: SubagentWaitOutcome;
|
|
56
|
+
reason?: 'steer';
|
|
57
|
+
}
|
|
58
|
+
export type SubagentWaitFor = 'completion' | 'message';
|
|
59
|
+
export type SubagentWaitOutcome = Exclude<import('../runtime/wait.js').ToolWaitOutcome, 'yield'>;
|
|
60
|
+
export interface SubagentMessageOptions {
|
|
61
|
+
delivery?: 'append' | 'replace';
|
|
62
|
+
signal?: AbortSignal;
|
|
63
|
+
}
|
|
64
|
+
export interface SubagentRunOptions {
|
|
65
|
+
turnSignal?: AbortSignal;
|
|
66
|
+
waitFor?: 'start' | 'completion';
|
|
67
|
+
signal?: AbortSignal;
|
|
68
|
+
onCreated?: (task: SubagentTaskSnapshot) => Promise<void> | void;
|
|
69
|
+
}
|
|
70
|
+
export interface SubagentOutputOptions {
|
|
71
|
+
waitInterrupt?: import('../runtime/wait.js').ToolWaitInterrupt | undefined;
|
|
72
|
+
untilSettled?: true;
|
|
73
|
+
waitMs?: number;
|
|
74
|
+
waitFor?: SubagentWaitFor;
|
|
75
|
+
signal?: AbortSignal;
|
|
76
|
+
}
|
|
77
|
+
export type SubagentWaitMode = 'any' | 'all';
|
|
78
|
+
export interface SubagentManyOutputOptions extends Omit<SubagentOutputOptions, 'untilSettled'> {
|
|
79
|
+
mode?: SubagentWaitMode;
|
|
80
|
+
}
|
|
81
|
+
export interface SubagentManyOutput {
|
|
82
|
+
mode: SubagentWaitMode;
|
|
83
|
+
waitFor: SubagentWaitFor;
|
|
84
|
+
waitOutcome: SubagentWaitOutcome;
|
|
85
|
+
reason?: 'steer';
|
|
86
|
+
agents: SubagentTaskSnapshot[];
|
|
87
|
+
pendingAgentIds: string[];
|
|
88
|
+
}
|
|
89
|
+
export interface SubagentHandledResult {
|
|
90
|
+
readonly outcome: 'handled';
|
|
91
|
+
readonly value?: unknown;
|
|
92
|
+
}
|
|
93
|
+
export type SubagentRunResult = SubagentTaskSnapshot | SubagentHandledResult;
|
|
94
|
+
export interface SubagentController {
|
|
95
|
+
run(input: SubagentTaskInput, options?: SubagentRunOptions): Promise<SubagentRunResult>;
|
|
96
|
+
output(agentId: string, options?: SubagentOutputOptions): Promise<SubagentTaskSnapshot>;
|
|
97
|
+
outputAny(options?: SubagentOutputOptions): Promise<SubagentTaskSnapshot>;
|
|
98
|
+
outputMany(agentIds: readonly string[], options?: SubagentManyOutputOptions): Promise<SubagentManyOutput>;
|
|
99
|
+
message(agentId: string, message: string, options?: SubagentMessageOptions): Promise<SubagentTaskSnapshot>;
|
|
100
|
+
cancel(agentId: string): Promise<SubagentTaskSnapshot>;
|
|
101
|
+
listSessionResources(): readonly {
|
|
102
|
+
agentId: string;
|
|
103
|
+
status: SubagentTaskSnapshot['status'];
|
|
104
|
+
description: string;
|
|
105
|
+
}[];
|
|
106
|
+
dispose(): Promise<void>;
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const SUBAGENT_LIMITS: Readonly<{
|
|
2
|
+
agentWaitMinWaitMs: 0;
|
|
3
|
+
agentWaitWaitFloorMs: 10000;
|
|
4
|
+
agentWaitDefaultWaitMs: 30000;
|
|
5
|
+
agentWaitMaxWaitMs: 300000;
|
|
6
|
+
agentWaitMaxAgents: 8;
|
|
7
|
+
subagentDescriptionMaxCharacters: 80;
|
|
8
|
+
subagentPromptMaxBytes: 131072;
|
|
9
|
+
subagentMessageMaxBytes: 131072;
|
|
10
|
+
subagentReasoningEffortMaxCharacters: 64;
|
|
11
|
+
subagentSummaryMaxBytes: 16384;
|
|
12
|
+
subagentUpdateMaxBytes: 32768;
|
|
13
|
+
subagentRunningLatestMessageMaxCharacters: 2000;
|
|
14
|
+
subagentEvidenceMaxItems: 64;
|
|
15
|
+
subagentVerificationMaxItems: 16;
|
|
16
|
+
subagentChangedFilesMaxItems: 200;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const SUBAGENT_LIMITS = Object.freeze({
|
|
2
|
+
agentWaitMinWaitMs: 0,
|
|
3
|
+
agentWaitWaitFloorMs: 10_000,
|
|
4
|
+
agentWaitDefaultWaitMs: 30_000,
|
|
5
|
+
agentWaitMaxWaitMs: 300_000,
|
|
6
|
+
agentWaitMaxAgents: 8,
|
|
7
|
+
subagentDescriptionMaxCharacters: 80,
|
|
8
|
+
subagentPromptMaxBytes: 131_072,
|
|
9
|
+
subagentMessageMaxBytes: 131_072,
|
|
10
|
+
subagentReasoningEffortMaxCharacters: 64,
|
|
11
|
+
subagentSummaryMaxBytes: 16_384,
|
|
12
|
+
subagentUpdateMaxBytes: 32_768,
|
|
13
|
+
subagentRunningLatestMessageMaxCharacters: 2_000,
|
|
14
|
+
subagentEvidenceMaxItems: 64,
|
|
15
|
+
subagentVerificationMaxItems: 16,
|
|
16
|
+
subagentChangedFilesMaxItems: 200
|
|
17
|
+
});
|