@myagentroam/agent 0.11.33 → 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,62 @@
|
|
|
1
|
+
import { AgentError } from '../error.js';
|
|
2
|
+
import { loadAgentInstructions } from '../runtime/context/instructions.js';
|
|
3
|
+
/** Builds the Session prompt preview using the same capability and Skill boundaries as execution. */
|
|
4
|
+
export function createSessionExtensionPrompt(ports) {
|
|
5
|
+
return async (facts, call) => {
|
|
6
|
+
call.signal.throwIfAborted();
|
|
7
|
+
const defaults = ports.execution();
|
|
8
|
+
const state = defaults ?? ports.models();
|
|
9
|
+
const modelId = facts.modelId ?? defaults?.modelId ?? ports.models().defaultModelId;
|
|
10
|
+
const instruction = defaults ? defaults.instruction : ports.instruction();
|
|
11
|
+
const model = state.models.get(modelId);
|
|
12
|
+
if (!model)
|
|
13
|
+
throw new AgentError('MAR_AGENT_MODEL_DISABLED', 'Selected model is unavailable.');
|
|
14
|
+
const mode = facts.mode ?? defaults?.mode ?? 'run';
|
|
15
|
+
const bindings = ports.capture(call);
|
|
16
|
+
if (!bindings)
|
|
17
|
+
throw new AgentError('MAR_AGENT_EXTENSION_PROMPT_UNAVAILABLE', 'Session prompt tool sources are unavailable.');
|
|
18
|
+
const definitions = [...bindings.values()]
|
|
19
|
+
.filter((binding) => binding.available?.(call) !== false)
|
|
20
|
+
.map((binding) => binding.definition)
|
|
21
|
+
.filter((tool) => !(ports.source === 'subagent' &&
|
|
22
|
+
(tool.agentScope === 'ROOT_ONLY' ||
|
|
23
|
+
tool.name.startsWith('agent_') ||
|
|
24
|
+
tool.name === 'question')) &&
|
|
25
|
+
!(tool.name === 'question' && mode !== 'plan') &&
|
|
26
|
+
!(tool.name === 'view_image' && !model.inputCapabilities.includes('IMAGE')) &&
|
|
27
|
+
!(['code_exec', 'code_exec_wait'].includes(tool.name) &&
|
|
28
|
+
(!model.codeMode || !ports.codeExecute)));
|
|
29
|
+
const byName = new Map(definitions.map((tool) => [tool.name, tool]));
|
|
30
|
+
const tools = facts.tools === undefined
|
|
31
|
+
? definitions
|
|
32
|
+
: facts.tools.flatMap((name) => {
|
|
33
|
+
const tool = byName.get(name);
|
|
34
|
+
return tool ? [tool] : [];
|
|
35
|
+
});
|
|
36
|
+
const executionId = call.executionId ?? defaults?.executionId;
|
|
37
|
+
if (executionId === undefined &&
|
|
38
|
+
ports.host.listExecutionExtensions &&
|
|
39
|
+
!ports.host.listSessionSkills)
|
|
40
|
+
throw new AgentError('MAR_AGENT_EXTENSION_PROMPT_UNAVAILABLE', 'The Host does not provide an idle Session Skill catalog.');
|
|
41
|
+
const hostSkills = executionId !== undefined
|
|
42
|
+
? ((await ports.host.listExecutionExtensions?.({
|
|
43
|
+
sessionId: ports.sessionId,
|
|
44
|
+
modelId,
|
|
45
|
+
executionId
|
|
46
|
+
}))?.skills ?? [])
|
|
47
|
+
: ((await ports.host.listSessionSkills?.({ sessionId: ports.sessionId, modelId })) ?? []);
|
|
48
|
+
call.signal.throwIfAborted();
|
|
49
|
+
const instructions = await loadAgentInstructions({
|
|
50
|
+
home: ports.home,
|
|
51
|
+
workspace: ports.workspace,
|
|
52
|
+
availableTools: new Set(tools.map((tool) => tool.name)),
|
|
53
|
+
hostSkills,
|
|
54
|
+
...(ports.workspaceMapped() ? { workspaceDisplayPath: ports.displayWorkspace } : {})
|
|
55
|
+
});
|
|
56
|
+
call.signal.throwIfAborted();
|
|
57
|
+
return {
|
|
58
|
+
sections: ports.sections(tools, mode, model, instruction, instructions?.skillCatalog),
|
|
59
|
+
facts: { modelId, mode, tools: tools.map((tool) => tool.name) }
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ExtensionManager } from '../extensions/manager.js';
|
|
2
|
+
import type { AgentHost } from '../host/contracts.js';
|
|
3
|
+
import type { SessionStore } from '../session/store/contracts.js';
|
|
4
|
+
import type { SessionRegistry } from './session-registry.js';
|
|
5
|
+
import type { SessionRuntime } from './session-runtime.js';
|
|
6
|
+
/** Agent-level maintenance admission and tree cleanup, sharing the Agent writer owner. */
|
|
7
|
+
export declare class SessionMaintenanceCoordinator {
|
|
8
|
+
#private;
|
|
9
|
+
private readonly store;
|
|
10
|
+
private readonly registry;
|
|
11
|
+
private readonly extensions;
|
|
12
|
+
private readonly host;
|
|
13
|
+
private readonly writerOwner;
|
|
14
|
+
private readonly disposed;
|
|
15
|
+
private readonly generation;
|
|
16
|
+
constructor(store: SessionStore, registry: SessionRegistry<SessionRuntime>, extensions: ExtensionManager, host: AgentHost, writerOwner: object, disposed: () => boolean, generation: () => number);
|
|
17
|
+
epoch(id: string): number;
|
|
18
|
+
canPublish(id: string, epoch: number): boolean;
|
|
19
|
+
assertAdmission(id?: string): void;
|
|
20
|
+
join(): Promise<void>;
|
|
21
|
+
clear(id: string): Promise<void>;
|
|
22
|
+
delete(id: string): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/** Complete all independent stages, reporting the first authoritative failure. */
|
|
25
|
+
export declare function completeAgentCleanup(steps: readonly (() => unknown | Promise<unknown>)[]): Promise<void>;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { AgentError } from '../error.js';
|
|
2
|
+
import { closeModelAdapters } from './model-runtime.js';
|
|
3
|
+
/** Agent-level maintenance admission and tree cleanup, sharing the Agent writer owner. */
|
|
4
|
+
export class SessionMaintenanceCoordinator {
|
|
5
|
+
store;
|
|
6
|
+
registry;
|
|
7
|
+
extensions;
|
|
8
|
+
host;
|
|
9
|
+
writerOwner;
|
|
10
|
+
disposed;
|
|
11
|
+
generation;
|
|
12
|
+
#epochs = new Map();
|
|
13
|
+
#operations = new Map();
|
|
14
|
+
#treeAdmissions = new Map();
|
|
15
|
+
constructor(store, registry, extensions, host, writerOwner, disposed, generation) {
|
|
16
|
+
this.store = store;
|
|
17
|
+
this.registry = registry;
|
|
18
|
+
this.extensions = extensions;
|
|
19
|
+
this.host = host;
|
|
20
|
+
this.writerOwner = writerOwner;
|
|
21
|
+
this.disposed = disposed;
|
|
22
|
+
this.generation = generation;
|
|
23
|
+
}
|
|
24
|
+
epoch(id) {
|
|
25
|
+
return this.#epochs.get(id) ?? 0;
|
|
26
|
+
}
|
|
27
|
+
canPublish(id, epoch) {
|
|
28
|
+
return !this.disposed() && !this.#treeAdmissions.has(id) && this.epoch(id) === epoch;
|
|
29
|
+
}
|
|
30
|
+
assertAdmission(id) {
|
|
31
|
+
if (this.disposed())
|
|
32
|
+
throw new AgentError('MAR_AGENT_DISPOSED', 'Agent is disposed.');
|
|
33
|
+
if (id !== undefined && (this.#operations.has(id) || this.#treeAdmissions.has(id)))
|
|
34
|
+
throw new AgentError('MAR_AGENT_SESSION_CLOSING', 'Session is closing.');
|
|
35
|
+
}
|
|
36
|
+
async join() {
|
|
37
|
+
const results = await Promise.allSettled([...this.#operations.values()].map(({ pending }) => pending));
|
|
38
|
+
const failure = results.find((result) => result.status === 'rejected');
|
|
39
|
+
if (failure?.status === 'rejected')
|
|
40
|
+
throw failure.reason;
|
|
41
|
+
}
|
|
42
|
+
clear(id) {
|
|
43
|
+
return this.#track(id, 'clear', async () => {
|
|
44
|
+
if (this.registry.get(id)?.activeExecutionId !== undefined)
|
|
45
|
+
throw new AgentError('MAR_AGENT_EXECUTION_ACTIVE', 'A session cannot be cleared while an execution is active.');
|
|
46
|
+
const maintenance = await this.store.acquireSessionMaintenance(id, 'clear', this.writerOwner);
|
|
47
|
+
this.#invalidate([id]);
|
|
48
|
+
let failed = false;
|
|
49
|
+
try {
|
|
50
|
+
let runtime;
|
|
51
|
+
await completeAgentCleanup([
|
|
52
|
+
() => this.registry.whenIdle([id]),
|
|
53
|
+
() => {
|
|
54
|
+
runtime = this.registry.get(id);
|
|
55
|
+
},
|
|
56
|
+
() => this.extensions.endSession(id, 'clear'),
|
|
57
|
+
() => this.extensions.retireSession(id),
|
|
58
|
+
() => this.extensions.clearSession(id),
|
|
59
|
+
() => runtime?.retireInputs(),
|
|
60
|
+
() => runtime?.disposeSubagents(),
|
|
61
|
+
() => closeModelAdapters(runtime === undefined
|
|
62
|
+
? []
|
|
63
|
+
: runtime
|
|
64
|
+
.takeAdaptersForClose()
|
|
65
|
+
.filter((adapter) => ![...this.registry].some(([otherId, other]) => otherId !== id && other.hasModelAdapter(adapter)))),
|
|
66
|
+
() => runtime?.resetAfterClear(this.generation()),
|
|
67
|
+
() => this.host.disposeSessionResources?.(id),
|
|
68
|
+
() => this.store.clearSession(id, maintenance)
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
failed = true;
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
try {
|
|
77
|
+
await maintenance.release();
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (!failed)
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
delete(id) {
|
|
87
|
+
return this.#track(id, 'delete', async () => {
|
|
88
|
+
const maintenance = await this.store.acquireSessionMaintenance(id, 'delete', this.writerOwner);
|
|
89
|
+
let failed = false;
|
|
90
|
+
const ids = maintenance.sessionIds;
|
|
91
|
+
for (const sessionId of ids)
|
|
92
|
+
this.#treeAdmissions.set(sessionId, (this.#treeAdmissions.get(sessionId) ?? 0) + 1);
|
|
93
|
+
try {
|
|
94
|
+
this.#invalidate(ids);
|
|
95
|
+
let runtimes = [];
|
|
96
|
+
await completeAgentCleanup([
|
|
97
|
+
() => this.registry.whenIdle(ids),
|
|
98
|
+
() => {
|
|
99
|
+
runtimes = ids.flatMap((sessionId) => {
|
|
100
|
+
const runtime = this.registry.get(sessionId);
|
|
101
|
+
return runtime ? [runtime] : [];
|
|
102
|
+
});
|
|
103
|
+
for (const runtime of runtimes)
|
|
104
|
+
runtime.cancelExecutions();
|
|
105
|
+
},
|
|
106
|
+
async () => {
|
|
107
|
+
let failure;
|
|
108
|
+
await Promise.all(ids.map(async (sessionId) => {
|
|
109
|
+
try {
|
|
110
|
+
await this.extensions.endSession(sessionId, 'other', false);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
failure ??= { error };
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
if (failure)
|
|
117
|
+
throw failure.error;
|
|
118
|
+
},
|
|
119
|
+
...ids.map((sessionId) => () => this.extensions.retireSession(sessionId)),
|
|
120
|
+
...ids.map((sessionId) => () => this.extensions.clearSession(sessionId)),
|
|
121
|
+
() => completeAgentCleanup(runtimes.map((runtime) => () => runtime.retireInputs())),
|
|
122
|
+
() => completeAgentCleanup(runtimes.map((runtime) => () => runtime.disposeSubagents())),
|
|
123
|
+
() => Promise.all(runtimes.map((runtime) => runtime.joinExecutions())),
|
|
124
|
+
() => {
|
|
125
|
+
for (const sessionId of ids) {
|
|
126
|
+
const runtime = this.registry.get(sessionId);
|
|
127
|
+
if (runtime)
|
|
128
|
+
this.registry.unregister(sessionId, runtime);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
() => closeModelAdapters(runtimes
|
|
132
|
+
.flatMap((runtime) => runtime.takeAdaptersForClose())
|
|
133
|
+
.filter((adapter) => ![...this.registry.values()].some((other) => other.hasModelAdapter(adapter)))),
|
|
134
|
+
...ids.map((sessionId) => () => this.host.disposeSessionResources?.(sessionId)),
|
|
135
|
+
() => this.store.delete(id, maintenance)
|
|
136
|
+
]);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
failed = true;
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
try {
|
|
144
|
+
await maintenance.release();
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (!failed)
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
for (const sessionId of ids) {
|
|
152
|
+
const count = this.#treeAdmissions.get(sessionId);
|
|
153
|
+
if (count === 1)
|
|
154
|
+
this.#treeAdmissions.delete(sessionId);
|
|
155
|
+
else
|
|
156
|
+
this.#treeAdmissions.set(sessionId, count - 1);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
#invalidate(ids) {
|
|
163
|
+
for (const id of ids)
|
|
164
|
+
this.#epochs.set(id, this.epoch(id) + 1);
|
|
165
|
+
}
|
|
166
|
+
#track(id, kind, operation) {
|
|
167
|
+
if (this.disposed())
|
|
168
|
+
return Promise.reject(new AgentError('MAR_AGENT_DISPOSED', 'Agent is disposed.'));
|
|
169
|
+
const current = this.#operations.get(id);
|
|
170
|
+
if (current)
|
|
171
|
+
return current.kind === kind
|
|
172
|
+
? current.pending
|
|
173
|
+
: Promise.reject(new AgentError('MAR_AGENT_SESSION_CLOSING', 'Session is closing.'));
|
|
174
|
+
if (this.#treeAdmissions.has(id))
|
|
175
|
+
return Promise.reject(new AgentError('MAR_AGENT_SESSION_CLOSING', 'Session is closing.'));
|
|
176
|
+
const completion = Promise.withResolvers();
|
|
177
|
+
const pending = completion.promise.finally(() => this.#operations.delete(id));
|
|
178
|
+
this.#operations.set(id, { kind, pending });
|
|
179
|
+
void pending.catch(() => undefined);
|
|
180
|
+
try {
|
|
181
|
+
completion.resolve(operation());
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
completion.reject(error);
|
|
185
|
+
}
|
|
186
|
+
return pending;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/** Complete all independent stages, reporting the first authoritative failure. */
|
|
190
|
+
export async function completeAgentCleanup(steps) {
|
|
191
|
+
let failed = false;
|
|
192
|
+
let failure;
|
|
193
|
+
for (const step of steps) {
|
|
194
|
+
try {
|
|
195
|
+
await step();
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
if (!failed)
|
|
199
|
+
failure = error;
|
|
200
|
+
failed = true;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (failed)
|
|
204
|
+
throw failure;
|
|
205
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ModelAdapter } from '../model/contracts.js';
|
|
2
|
+
import type { ModelCredentialProvider } from '../model/configuration.js';
|
|
3
|
+
import { type ResolvedModelConfiguration } from './model-runtime.js';
|
|
4
|
+
/** Session-owned cache; Agent coordinates references shared across Sessions. */
|
|
5
|
+
export declare class SessionModelAdapters {
|
|
6
|
+
#private;
|
|
7
|
+
readonly createAdapter: (modelId: string, models: ReadonlyMap<string, ResolvedModelConfiguration>) => ModelAdapter;
|
|
8
|
+
readonly hasCustomAdapters: boolean;
|
|
9
|
+
constructor(generation: number, createAdapter: (modelId: string, models: ReadonlyMap<string, ResolvedModelConfiguration>) => ModelAdapter, hasCustomAdapters: boolean);
|
|
10
|
+
getOrCreate(modelId: string, models: ReadonlyMap<string, ResolvedModelConfiguration>): ModelAdapter;
|
|
11
|
+
snapshot(): readonly ModelAdapter[];
|
|
12
|
+
collectActiveReferences(target: Set<ModelAdapter>): void;
|
|
13
|
+
collectCredentialProviders(target: Set<ModelCredentialProvider>): void;
|
|
14
|
+
hasReference(adapter: ModelAdapter): boolean;
|
|
15
|
+
static closeSessions(sessions: readonly SessionModelAdapters[]): Promise<void>;
|
|
16
|
+
/** Stage one coordinated transition; each cache owns its own retirement and generation. */
|
|
17
|
+
static stageReconfiguration(sessions: readonly SessionModelAdapters[], models: ReadonlyMap<string, ResolvedModelConfiguration>, active: ReadonlySet<ModelAdapter>, assertOpen: () => void): Promise<(generation: number) => void>;
|
|
18
|
+
refresh(generation: number, retainedByActive: ReadonlySet<ModelAdapter>): Promise<void>;
|
|
19
|
+
prepareReconfigure(models: ReadonlyMap<string, ResolvedModelConfiguration>, activeAdapters: ReadonlySet<ModelAdapter>): readonly {
|
|
20
|
+
readonly adapter: ModelAdapter;
|
|
21
|
+
readonly commit: () => void;
|
|
22
|
+
}[];
|
|
23
|
+
/** Remove unretained references; the caller deduplicates and closes across Sessions. */
|
|
24
|
+
retire(retained: ReadonlySet<ModelAdapter>): readonly ModelAdapter[];
|
|
25
|
+
setGeneration(generation: number): void;
|
|
26
|
+
/** Transfer close responsibility once, so shared references can be closed as a group. */
|
|
27
|
+
drain(): readonly ModelAdapter[];
|
|
28
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { addModelCredentialProviders, closeModelAdapters } from './model-runtime.js';
|
|
2
|
+
/** Session-owned cache; Agent coordinates references shared across Sessions. */
|
|
3
|
+
export class SessionModelAdapters {
|
|
4
|
+
createAdapter;
|
|
5
|
+
hasCustomAdapters;
|
|
6
|
+
#adapters = new Map();
|
|
7
|
+
#generation;
|
|
8
|
+
constructor(generation, createAdapter, hasCustomAdapters) {
|
|
9
|
+
this.createAdapter = createAdapter;
|
|
10
|
+
this.hasCustomAdapters = hasCustomAdapters;
|
|
11
|
+
this.#generation = generation;
|
|
12
|
+
}
|
|
13
|
+
getOrCreate(modelId, models) {
|
|
14
|
+
const existing = this.#adapters.get(modelId);
|
|
15
|
+
if (existing !== undefined)
|
|
16
|
+
return existing;
|
|
17
|
+
const adapter = this.createAdapter(modelId, models);
|
|
18
|
+
// Stateless custom adapters belong to the individual Execution instead.
|
|
19
|
+
if (!this.hasCustomAdapters || adapter.createTurnSession !== undefined)
|
|
20
|
+
this.#adapters.set(modelId, adapter);
|
|
21
|
+
return adapter;
|
|
22
|
+
}
|
|
23
|
+
snapshot() {
|
|
24
|
+
return [...this.#adapters.values()];
|
|
25
|
+
}
|
|
26
|
+
collectActiveReferences(target) {
|
|
27
|
+
for (const adapter of this.#adapters.values())
|
|
28
|
+
target.add(adapter);
|
|
29
|
+
}
|
|
30
|
+
collectCredentialProviders(target) {
|
|
31
|
+
for (const adapter of this.#adapters.values())
|
|
32
|
+
addModelCredentialProviders(target, adapter.configuration);
|
|
33
|
+
}
|
|
34
|
+
hasReference(adapter) {
|
|
35
|
+
return [...this.#adapters.values()].includes(adapter);
|
|
36
|
+
}
|
|
37
|
+
static closeSessions(sessions) {
|
|
38
|
+
return closeModelAdapters(sessions.flatMap((session) => session.drain()));
|
|
39
|
+
}
|
|
40
|
+
/** Stage one coordinated transition; each cache owns its own retirement and generation. */
|
|
41
|
+
static async stageReconfiguration(sessions, models, active, assertOpen) {
|
|
42
|
+
const commits = new Map();
|
|
43
|
+
for (const session of sessions)
|
|
44
|
+
for (const { adapter, commit } of session.prepareReconfigure(models, active))
|
|
45
|
+
commits.set(adapter, commit);
|
|
46
|
+
const retained = new Set(commits.keys());
|
|
47
|
+
const retired = new Set(sessions.flatMap((session) => session.retire(retained)));
|
|
48
|
+
await closeModelAdapters([...retired].filter((adapter) => !active.has(adapter)));
|
|
49
|
+
return (generation) => {
|
|
50
|
+
assertOpen();
|
|
51
|
+
for (const commit of commits.values())
|
|
52
|
+
commit();
|
|
53
|
+
for (const session of sessions)
|
|
54
|
+
session.setGeneration(generation);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async refresh(generation, retainedByActive) {
|
|
58
|
+
if (this.#generation === generation)
|
|
59
|
+
return;
|
|
60
|
+
await closeModelAdapters(this.snapshot().filter((adapter) => !retainedByActive.has(adapter)));
|
|
61
|
+
this.#adapters.clear();
|
|
62
|
+
this.#generation = generation;
|
|
63
|
+
}
|
|
64
|
+
prepareReconfigure(models, activeAdapters) {
|
|
65
|
+
const plans = [];
|
|
66
|
+
for (const [modelId, adapter] of this.#adapters) {
|
|
67
|
+
if (activeAdapters.has(adapter))
|
|
68
|
+
continue;
|
|
69
|
+
const configuration = models.get(modelId);
|
|
70
|
+
const commit = configuration === undefined ? undefined : adapter.prepareReconfigure?.(configuration);
|
|
71
|
+
if (commit !== undefined)
|
|
72
|
+
plans.push({ adapter, commit });
|
|
73
|
+
}
|
|
74
|
+
return plans;
|
|
75
|
+
}
|
|
76
|
+
/** Remove unretained references; the caller deduplicates and closes across Sessions. */
|
|
77
|
+
retire(retained) {
|
|
78
|
+
const removed = [];
|
|
79
|
+
for (const [modelId, adapter] of this.#adapters) {
|
|
80
|
+
if (!retained.has(adapter)) {
|
|
81
|
+
removed.push(adapter);
|
|
82
|
+
this.#adapters.delete(modelId);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return removed;
|
|
86
|
+
}
|
|
87
|
+
setGeneration(generation) {
|
|
88
|
+
this.#generation = generation;
|
|
89
|
+
}
|
|
90
|
+
/** Transfer close responsibility once, so shared references can be closed as a group. */
|
|
91
|
+
drain() {
|
|
92
|
+
const adapters = this.snapshot();
|
|
93
|
+
this.#adapters.clear();
|
|
94
|
+
return adapters;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ModelAdapter } from '../model/contracts.js';
|
|
2
|
+
import type { SessionStore } from '../session/store/contracts.js';
|
|
3
|
+
import type { SubagentSessionController } from '../subagent/session-controller.js';
|
|
4
|
+
import type { ResolvedModelConfiguration } from './model-runtime.js';
|
|
5
|
+
import { type SessionRegistry } from './session-registry.js';
|
|
6
|
+
import { SessionRuntime } from './session-runtime.js';
|
|
7
|
+
type StoredSession = Awaited<ReturnType<SessionStore['getSession']>>;
|
|
8
|
+
interface SessionOpenPorts<Handle> {
|
|
9
|
+
readonly registry: SessionRegistry<SessionRuntime>;
|
|
10
|
+
readonly getSession: (id: string) => Promise<StoredSession>;
|
|
11
|
+
readonly generation: () => number;
|
|
12
|
+
readonly createAdapter: (id: string, models: ReadonlyMap<string, ResolvedModelConfiguration>) => ModelAdapter;
|
|
13
|
+
readonly hasCustomAdapters: boolean;
|
|
14
|
+
readonly openSubagents: (id: string, workspace: string) => Promise<SubagentSessionController>;
|
|
15
|
+
readonly assertAdmission: (id: string) => void;
|
|
16
|
+
readonly epoch: (id: string) => number;
|
|
17
|
+
readonly canPublish: (id: string, epoch: number) => boolean;
|
|
18
|
+
readonly createHandle: (id: string, runtime: SessionRuntime, stored: StoredSession, workspace?: string) => Handle;
|
|
19
|
+
}
|
|
20
|
+
/** The open flow owns unpublished candidates; the registry owns only identity and barriers. */
|
|
21
|
+
export declare function createSessionOpen<Handle>(ports: SessionOpenPorts<Handle>): (id: string, workspace?: string) => Promise<Handle>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AgentError } from '../error.js';
|
|
2
|
+
import { SessionOpenCleanupError } from './session-registry.js';
|
|
3
|
+
import { SessionRuntime } from './session-runtime.js';
|
|
4
|
+
/** The open flow owns unpublished candidates; the registry owns only identity and barriers. */
|
|
5
|
+
export function createSessionOpen(ports) {
|
|
6
|
+
return async (id, workspace) => {
|
|
7
|
+
ports.assertAdmission(id);
|
|
8
|
+
const epoch = ports.epoch(id);
|
|
9
|
+
return ports.registry.trackOpen(id, async () => {
|
|
10
|
+
const runtime = await ports.registry.getOrCreate(id, epoch, () => ports.canPublish(id, epoch), async (publish) => {
|
|
11
|
+
const stored = await ports.getSession(id);
|
|
12
|
+
const candidate = new SessionRuntime(stored, ports.generation(), ports.createAdapter, ports.hasCustomAdapters);
|
|
13
|
+
try {
|
|
14
|
+
if (stored.source.type === 'user')
|
|
15
|
+
await candidate.ensureSubagents(() => ports.openSubagents(id, stored.workspace));
|
|
16
|
+
ports.createHandle(id, candidate, stored, workspace);
|
|
17
|
+
if (!publish(candidate))
|
|
18
|
+
throw new AgentError('MAR_AGENT_SESSION_CLOSING', 'Session is closing.');
|
|
19
|
+
return candidate;
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
try {
|
|
23
|
+
await candidate.disposeSubagents();
|
|
24
|
+
}
|
|
25
|
+
catch (cleanupError) {
|
|
26
|
+
throw new SessionOpenCleanupError(cleanupError);
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
ports.assertAdmission(id);
|
|
32
|
+
const stored = await ports.getSession(id);
|
|
33
|
+
ports.assertAdmission(id);
|
|
34
|
+
if (!ports.canPublish(id, epoch))
|
|
35
|
+
throw new AgentError('MAR_AGENT_SESSION_CLOSING', 'Session is closing.');
|
|
36
|
+
if (stored.source.type === 'user' && runtime.subagents === undefined) {
|
|
37
|
+
await runtime.ensureSubagents(() => ports.openSubagents(id, stored.workspace));
|
|
38
|
+
if (!ports.canPublish(id, epoch))
|
|
39
|
+
throw new AgentError('MAR_AGENT_SESSION_CLOSING', 'Session is closing.');
|
|
40
|
+
}
|
|
41
|
+
return ports.createHandle(id, runtime, stored, workspace);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** An identity index and completion barrier; the open flow owns candidate resources. */
|
|
2
|
+
export declare class SessionRegistry<Runtime extends object> {
|
|
3
|
+
private readonly runtimes;
|
|
4
|
+
private readonly pending;
|
|
5
|
+
private readonly opens;
|
|
6
|
+
get(sessionId: string): Runtime | undefined;
|
|
7
|
+
values(): IterableIterator<Runtime>;
|
|
8
|
+
[Symbol.iterator](): IterableIterator<[string, Runtime]>;
|
|
9
|
+
trackOpen<T>(sessionId: string | undefined, open: () => Promise<T>): Promise<T>;
|
|
10
|
+
getOrCreate(sessionId: string, epoch: number, canPublish: () => boolean, initialize: (publish: (runtime: Runtime) => boolean) => Promise<Runtime>): Promise<Runtime>;
|
|
11
|
+
unregister(sessionId: string, runtime: Runtime): void;
|
|
12
|
+
whenIdle(sessionIds?: readonly string[]): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/** Marks candidate cleanup failures without treating normal invalidation as cleanup failure. */
|
|
15
|
+
export declare class SessionOpenCleanupError extends Error {
|
|
16
|
+
constructor(cause: unknown);
|
|
17
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** An identity index and completion barrier; the open flow owns candidate resources. */
|
|
2
|
+
export class SessionRegistry {
|
|
3
|
+
runtimes = new Map();
|
|
4
|
+
pending = new Map();
|
|
5
|
+
opens = new Map();
|
|
6
|
+
get(sessionId) {
|
|
7
|
+
return this.runtimes.get(sessionId);
|
|
8
|
+
}
|
|
9
|
+
values() {
|
|
10
|
+
return this.runtimes.values();
|
|
11
|
+
}
|
|
12
|
+
[Symbol.iterator]() {
|
|
13
|
+
return this.runtimes[Symbol.iterator]();
|
|
14
|
+
}
|
|
15
|
+
trackOpen(sessionId, open) {
|
|
16
|
+
let opens = this.opens.get(sessionId);
|
|
17
|
+
if (!opens) {
|
|
18
|
+
opens = new Set();
|
|
19
|
+
this.opens.set(sessionId, opens);
|
|
20
|
+
}
|
|
21
|
+
const group = opens;
|
|
22
|
+
const pending = Promise.resolve().then(open);
|
|
23
|
+
group.add(pending);
|
|
24
|
+
const remove = () => {
|
|
25
|
+
group.delete(pending);
|
|
26
|
+
if (group.size === 0 && this.opens.get(sessionId) === group)
|
|
27
|
+
this.opens.delete(sessionId);
|
|
28
|
+
};
|
|
29
|
+
void pending.then(remove, remove);
|
|
30
|
+
return pending;
|
|
31
|
+
}
|
|
32
|
+
getOrCreate(sessionId, epoch, canPublish, initialize) {
|
|
33
|
+
const existingPending = this.pending.get(sessionId)?.get(epoch);
|
|
34
|
+
if (existingPending)
|
|
35
|
+
return existingPending;
|
|
36
|
+
const existing = this.runtimes.get(sessionId);
|
|
37
|
+
if (existing)
|
|
38
|
+
return Promise.resolve(existing);
|
|
39
|
+
let byEpoch = this.pending.get(sessionId);
|
|
40
|
+
if (!byEpoch) {
|
|
41
|
+
byEpoch = new Map();
|
|
42
|
+
this.pending.set(sessionId, byEpoch);
|
|
43
|
+
}
|
|
44
|
+
const epochs = byEpoch;
|
|
45
|
+
const pending = Promise.resolve().then(() => initialize((runtime) => {
|
|
46
|
+
if (!canPublish() || this.runtimes.has(sessionId))
|
|
47
|
+
return false;
|
|
48
|
+
this.runtimes.set(sessionId, runtime);
|
|
49
|
+
return true;
|
|
50
|
+
}));
|
|
51
|
+
epochs.set(epoch, pending);
|
|
52
|
+
const removePending = () => {
|
|
53
|
+
if (epochs.get(epoch) !== pending)
|
|
54
|
+
return;
|
|
55
|
+
epochs.delete(epoch);
|
|
56
|
+
if (epochs.size === 0 && this.pending.get(sessionId) === epochs)
|
|
57
|
+
this.pending.delete(sessionId);
|
|
58
|
+
};
|
|
59
|
+
void pending.then(removePending, removePending);
|
|
60
|
+
return pending;
|
|
61
|
+
}
|
|
62
|
+
unregister(sessionId, runtime) {
|
|
63
|
+
if (this.runtimes.get(sessionId) === runtime)
|
|
64
|
+
this.runtimes.delete(sessionId);
|
|
65
|
+
}
|
|
66
|
+
async whenIdle(sessionIds) {
|
|
67
|
+
const selected = sessionIds === undefined ? undefined : new Set(sessionIds);
|
|
68
|
+
const pending = [...this.opens].flatMap(([sessionId, opens]) => selected === undefined || (sessionId !== undefined && selected.has(sessionId))
|
|
69
|
+
? [...opens]
|
|
70
|
+
: []);
|
|
71
|
+
pending.push(...[...this.pending].flatMap(([sessionId, epochs]) => selected === undefined || selected.has(sessionId) ? [...epochs.values()] : []));
|
|
72
|
+
const results = await Promise.allSettled(pending);
|
|
73
|
+
const failedCleanup = results.find((result) => result.status === 'rejected' && result.reason instanceof SessionOpenCleanupError);
|
|
74
|
+
if (failedCleanup?.status === 'rejected')
|
|
75
|
+
throw failedCleanup.reason.cause;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** Marks candidate cleanup failures without treating normal invalidation as cleanup failure. */
|
|
79
|
+
export class SessionOpenCleanupError extends Error {
|
|
80
|
+
constructor(cause) {
|
|
81
|
+
super('Session open candidate cleanup failed.', { cause });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ExtensionRequestSnapshots, type ExtensionRequestSnapshot } from '../extensions/model-request.js';
|
|
2
|
+
import type { ExtensionSessionBackend, SessionInputCoordinator } from '../extensions/session-input.js';
|
|
3
|
+
import type { ExtensionAgentsBackend } from '../extensions/agents.js';
|
|
4
|
+
import type { ModelAdapter } from '../model/contracts.js';
|
|
5
|
+
import type { ModelCredentialProvider } from '../model/configuration.js';
|
|
6
|
+
import type { SessionModelRequest as ModelRequest } from '../session/model-request.js';
|
|
7
|
+
import type { SessionStore } from '../session/store/contracts.js';
|
|
8
|
+
import { type ContextualWorldState } from '../runtime/context/world-state.js';
|
|
9
|
+
import type { SubagentSessionController } from '../subagent/session-controller.js';
|
|
10
|
+
import { TodoStore } from '../tools/agent/todo.js';
|
|
11
|
+
import type { ExecutionResult } from './types.js';
|
|
12
|
+
import type { ResolvedModelConfiguration } from './model-runtime.js';
|
|
13
|
+
import type { SessionExecution, SessionExecutionContext } from './session-execution.js';
|
|
14
|
+
export declare class SessionRuntime {
|
|
15
|
+
#private;
|
|
16
|
+
readonly storedSession: Awaited<ReturnType<SessionStore['getSession']>>;
|
|
17
|
+
readonly scheduleTool: <T>(definition: import("../host.js").ClientToolDefinition | undefined, run: () => Promise<T>) => Promise<T>;
|
|
18
|
+
constructor(storedSession: Awaited<ReturnType<SessionStore['getSession']>>, generation: number, createAdapter: (modelId: string, models: ReadonlyMap<string, ResolvedModelConfiguration>) => ModelAdapter, hasCustomAdapters: boolean);
|
|
19
|
+
adapter(modelId: string, models: ReadonlyMap<string, ResolvedModelConfiguration>): ModelAdapter;
|
|
20
|
+
refreshAdapters(generation: number, retained: ReadonlySet<ModelAdapter>): Promise<void>;
|
|
21
|
+
static stageModelReconfiguration(sessions: readonly SessionRuntime[], models: ReadonlyMap<string, ResolvedModelConfiguration>, active: ReadonlySet<ModelAdapter>, assertOpen: () => void): Promise<(generation: number) => void>;
|
|
22
|
+
collectActiveModelAdapters(target: Set<ModelAdapter>): void;
|
|
23
|
+
collectModelCredentialProviders(target: Set<ModelCredentialProvider>): void;
|
|
24
|
+
hasModelAdapter(adapter: ModelAdapter): boolean;
|
|
25
|
+
takeAdaptersForClose(): readonly ModelAdapter[];
|
|
26
|
+
static closeModelAdapters(sessions: readonly SessionRuntime[]): Promise<void>;
|
|
27
|
+
retireInputs(): Promise<unknown> | undefined;
|
|
28
|
+
getOrCreateInputs(create: () => SessionInputCoordinator): SessionInputCoordinator;
|
|
29
|
+
disposeSubagents(): Promise<unknown> | undefined;
|
|
30
|
+
get subagents(): SubagentSessionController | undefined;
|
|
31
|
+
ensureSubagents(open: () => Promise<SubagentSessionController>): Promise<SubagentSessionController>;
|
|
32
|
+
resetAfterClear(generation: number): void;
|
|
33
|
+
recordRequest(modelId: string, request: ModelRequest): ExtensionRequestSnapshot;
|
|
34
|
+
completeRequest(snapshot: ExtensionRequestSnapshot): void;
|
|
35
|
+
captureRequest(input: Parameters<ExtensionRequestSnapshots['capture']>[0]): ExtensionRequestSnapshot | undefined;
|
|
36
|
+
resolveRequest(snapshot: ExtensionRequestSnapshot): {
|
|
37
|
+
modelId: string;
|
|
38
|
+
request: ModelRequest;
|
|
39
|
+
view: import("../extensions/model-request.js").ExtensionModelRequest;
|
|
40
|
+
};
|
|
41
|
+
withRecordProjection<T>(action: () => Promise<T>): Promise<T>;
|
|
42
|
+
joinRecordProjection(): Promise<void>;
|
|
43
|
+
get sourceType(): 'user' | 'subagent';
|
|
44
|
+
restoreTodo(snapshot: Parameters<typeof TodoStore.restore>[0], retained: boolean): TodoStore;
|
|
45
|
+
restoreExecutionState(store: Pick<SessionStore, 'readExecutionState' | 'readContextualWorldState' | 'hasRetainedSessionLease'>, writerOwner: object): Promise<{
|
|
46
|
+
todo: TodoStore;
|
|
47
|
+
contextRecords: import("../session/record-contract.js").SessionRecord[];
|
|
48
|
+
generation: string | undefined;
|
|
49
|
+
world: ContextualWorldState;
|
|
50
|
+
}>;
|
|
51
|
+
get sessionBackend(): (ExtensionSessionBackend & {
|
|
52
|
+
kick(): void;
|
|
53
|
+
}) | undefined;
|
|
54
|
+
ensureSessionBackend(create: () => ExtensionSessionBackend & {
|
|
55
|
+
kick(): void;
|
|
56
|
+
}): void;
|
|
57
|
+
get agentsBackend(): ExtensionAgentsBackend | undefined;
|
|
58
|
+
ensureAgentsBackend(create: () => ExtensionAgentsBackend): void;
|
|
59
|
+
get execution(): SessionExecutionContext | undefined;
|
|
60
|
+
bindExecutionContext(context: SessionExecutionContext): void;
|
|
61
|
+
unbindExecutionContext(context: SessionExecutionContext): void;
|
|
62
|
+
get contextualWorldState(): ContextualWorldState | undefined;
|
|
63
|
+
updateContextualWorldState(state: ContextualWorldState): void;
|
|
64
|
+
get activeExecutionId(): string | undefined;
|
|
65
|
+
assertCanExecute(): void;
|
|
66
|
+
registerExecution(execution: SessionExecution): void;
|
|
67
|
+
deactivateExecution(execution: SessionExecution): void;
|
|
68
|
+
unregisterExecution(execution: SessionExecution): void;
|
|
69
|
+
cancelExecution(executionId: string): void;
|
|
70
|
+
cancelExecutions(): void;
|
|
71
|
+
joinExecutions(): Promise<PromiseSettledResult<ExecutionResult>[]>;
|
|
72
|
+
}
|