@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
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
let cachedUserAgent;
|
|
3
|
-
/**
|
|
4
|
-
* Product identity sent to upstream model endpoints. Runtime credential headers may
|
|
5
|
-
* override this value per request.
|
|
6
|
-
*/
|
|
7
|
-
export function productUserAgent() {
|
|
8
|
-
cachedUserAgent ??= resolveProductUserAgent();
|
|
9
|
-
return cachedUserAgent;
|
|
10
|
-
}
|
|
11
|
-
function resolveProductUserAgent() {
|
|
12
|
-
try {
|
|
13
|
-
const raw = readFileSync(new URL('../../../package.json', import.meta.url), 'utf8');
|
|
14
|
-
const version = JSON.parse(raw).version;
|
|
15
|
-
if (typeof version === 'string' && version.length > 0 && version.length <= 64)
|
|
16
|
-
return 'MyAgentRoam/' + version + ' (' + process.platform + '; ' + process.arch + ')';
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
// Fall through to the identity-preserving fallback below.
|
|
20
|
-
}
|
|
21
|
-
return 'MyAgentRoam/unknown (' + process.platform + '; ' + process.arch + ')';
|
|
22
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { MarAgentError } from '../error.js';
|
|
2
|
-
import { isAnthropicRecoverableStreamError } from './anthropic-messages.js';
|
|
3
|
-
import { isRetryableModelRequestError, modelRetryMaxAttempts, waitForModelRetry } from './http.js';
|
|
4
|
-
import { isOpenAiResponsesRecoverableStreamError } from './openai-responses.js';
|
|
5
|
-
/** Retry only classified recoverable failures within the attempt budget; never retry cancellation. */
|
|
6
|
-
export async function recoverModelStream(error, retryState, signal) {
|
|
7
|
-
if (signal.aborted ||
|
|
8
|
-
!((error instanceof MarAgentError &&
|
|
9
|
-
error.code === 'MAR_AGENT_MODEL_OUTPUT_INCOMPLETE' &&
|
|
10
|
-
error.retryable) ||
|
|
11
|
-
isRetryableModelRequestError(error) ||
|
|
12
|
-
isOpenAiResponsesRecoverableStreamError(error) ||
|
|
13
|
-
isAnthropicRecoverableStreamError(error)) ||
|
|
14
|
-
retryState.attempts >= modelRetryMaxAttempts(retryState))
|
|
15
|
-
return false;
|
|
16
|
-
const delayMs = retryState.retryDelayMs;
|
|
17
|
-
delete retryState.retryDelayMs;
|
|
18
|
-
try {
|
|
19
|
-
await waitForModelRetry(typeof error.details?.retryAfter === 'string' ? error.details.retryAfter : null, retryState.attempts - 1, signal, delayMs);
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
signal.throwIfAborted();
|
|
23
|
-
throw error;
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
const PROVIDER_CONTEXT_OVERFLOW_CODES = new Set([
|
|
28
|
-
'mar_agent_context_limit',
|
|
29
|
-
'context_length_exceeded',
|
|
30
|
-
'context_overflow',
|
|
31
|
-
'context_window_exceeded',
|
|
32
|
-
'prompt_too_long',
|
|
33
|
-
'request_too_large',
|
|
34
|
-
'string_above_max_length'
|
|
35
|
-
]);
|
|
36
|
-
const PROVIDER_CONTEXT_OVERFLOW_PATTERNS = [
|
|
37
|
-
/prompt is too long/iu,
|
|
38
|
-
/request_too_large/iu,
|
|
39
|
-
/input is too long for requested model/iu,
|
|
40
|
-
/exceeds (?:the )?(?:model'?s )?(?:maximum )?context (?:length|window)/iu,
|
|
41
|
-
/input token count.*exceeds the maximum/iu,
|
|
42
|
-
/tokens in request more than max tokens allowed/iu,
|
|
43
|
-
/maximum prompt length is \d+/iu,
|
|
44
|
-
/reduce the length of the messages/iu,
|
|
45
|
-
/maximum context length is \d+ tokens/iu,
|
|
46
|
-
/exceeds (?:the )?maximum allowed input length/iu,
|
|
47
|
-
/greater than the context length/iu,
|
|
48
|
-
/context window exceeds limit/iu,
|
|
49
|
-
/exceeded model token limit/iu,
|
|
50
|
-
/context[_ ]length[_ ]exceeded/iu,
|
|
51
|
-
/request entity too large/iu,
|
|
52
|
-
/input length.*exceeds.*context length/iu,
|
|
53
|
-
/prompt too long; exceeded (?:max )?context length/iu,
|
|
54
|
-
/model_context_window_exceeded/iu,
|
|
55
|
-
/too many tokens/iu,
|
|
56
|
-
/token limit exceeded/iu
|
|
57
|
-
];
|
|
58
|
-
const PROVIDER_CONTEXT_OVERFLOW_EXCLUSIONS = [
|
|
59
|
-
/^(?:[^:]+: )?(?:throttling error|service unavailable):/iu,
|
|
60
|
-
/rate limit/iu,
|
|
61
|
-
/too many requests/iu
|
|
62
|
-
];
|
|
63
|
-
export function isProviderContextOverflow(error) {
|
|
64
|
-
if (!(error instanceof MarAgentError))
|
|
65
|
-
return false;
|
|
66
|
-
const code = error.code.trim().toLowerCase();
|
|
67
|
-
if (PROVIDER_CONTEXT_OVERFLOW_CODES.has(code))
|
|
68
|
-
return true;
|
|
69
|
-
if (error.details?.status === 413)
|
|
70
|
-
return true;
|
|
71
|
-
const message = error.message;
|
|
72
|
-
// K3-compatible gateways report context overflow as HTTP 401 instead of a
|
|
73
|
-
// standard provider error code. Keep this exception scoped to that exact shape.
|
|
74
|
-
if (error.details?.status === 401 && /supports only [\d,.]+[km]? context/iu.test(message))
|
|
75
|
-
return true;
|
|
76
|
-
if (code !== 'invalid_request_error' && code !== 'mar_agent_model_protocol_error')
|
|
77
|
-
return false;
|
|
78
|
-
return (!PROVIDER_CONTEXT_OVERFLOW_EXCLUSIONS.some((pattern) => pattern.test(message)) &&
|
|
79
|
-
PROVIDER_CONTEXT_OVERFLOW_PATTERNS.some((pattern) => pattern.test(message)));
|
|
80
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type MarAgentModelConfiguration, type MarAgentReasoningEffort } from './configuration.js';
|
|
2
|
-
import type { ModelMessage } from './contracts.js';
|
|
3
|
-
/** Resolve request effort and native updates without owning their persistence or timing. */
|
|
4
|
-
export declare function prepareModelConfiguration(model: Pick<MarAgentModelConfiguration, 'id' | 'protocol' | 'responsesConfigurationUpdates' | 'codexCredential'>, effort: MarAgentReasoningEffort, context: {
|
|
5
|
-
readonly baselineEffort: MarAgentReasoningEffort | undefined;
|
|
6
|
-
readonly messages: readonly ModelMessage[];
|
|
7
|
-
readonly checkpointAdopted?: false;
|
|
8
|
-
} | {
|
|
9
|
-
readonly checkpointAdopted: true;
|
|
10
|
-
}): {
|
|
11
|
-
readonly requestReasoningEffort?: MarAgentReasoningEffort;
|
|
12
|
-
readonly updates: readonly ModelMessage[];
|
|
13
|
-
readonly contextProjection: {
|
|
14
|
-
readonly modelProtocol: MarAgentModelConfiguration['protocol'];
|
|
15
|
-
readonly responsesConfigurationUpdates: boolean;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { marAgentReasoningEffortSchema, usesResponsesConfigurationUpdates } from './configuration.js';
|
|
2
|
-
/** Resolve request effort and native updates without owning their persistence or timing. */
|
|
3
|
-
export function prepareModelConfiguration(model, effort, context) {
|
|
4
|
-
const useUpdates = usesResponsesConfigurationUpdates(model);
|
|
5
|
-
const contextProjection = {
|
|
6
|
-
modelProtocol: model.protocol,
|
|
7
|
-
responsesConfigurationUpdates: useUpdates
|
|
8
|
-
};
|
|
9
|
-
if (context.checkpointAdopted)
|
|
10
|
-
return { requestReasoningEffort: effort, updates: [], contextProjection };
|
|
11
|
-
if (!useUpdates)
|
|
12
|
-
return { updates: [], contextProjection };
|
|
13
|
-
const requestReasoningEffort = context.baselineEffort ?? effort;
|
|
14
|
-
const effectiveEffort = context.baselineEffort === undefined
|
|
15
|
-
? requestReasoningEffort
|
|
16
|
-
: (lastConfigurationEffort(context.messages, model.id) ?? requestReasoningEffort);
|
|
17
|
-
return {
|
|
18
|
-
requestReasoningEffort,
|
|
19
|
-
contextProjection,
|
|
20
|
-
updates: effectiveEffort === effort
|
|
21
|
-
? []
|
|
22
|
-
: [
|
|
23
|
-
{
|
|
24
|
-
role: 'provider',
|
|
25
|
-
content: '',
|
|
26
|
-
provider: 'OPENAI_RESPONSES',
|
|
27
|
-
providerModelId: model.id,
|
|
28
|
-
item: { type: 'configuration_update', reasoning: { effort } }
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function lastConfigurationEffort(messages, modelId) {
|
|
34
|
-
for (let index = messages.length - 1; index >= 0; index--) {
|
|
35
|
-
const message = messages[index];
|
|
36
|
-
if (message.role !== 'provider' ||
|
|
37
|
-
message.provider !== 'OPENAI_RESPONSES' ||
|
|
38
|
-
message.providerModelId !== modelId ||
|
|
39
|
-
message.item?.type !== 'configuration_update')
|
|
40
|
-
continue;
|
|
41
|
-
const reasoning = message.item.reasoning;
|
|
42
|
-
const effort = marAgentReasoningEffortSchema.safeParse(reasoning?.effort);
|
|
43
|
-
if (effort.success)
|
|
44
|
-
return effort.data;
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SecretValue, type MarAgentModelConfiguration, type ModelCredentialProvider, type ModelCredential, type ModelCredentialAcquireReason } from './configuration.js';
|
|
2
|
-
export declare function acquireModelCredential(configuration: Pick<MarAgentModelConfiguration, 'apiKey' | 'credentialProvider'> | {
|
|
3
|
-
readonly apiKey?: SecretValue;
|
|
4
|
-
readonly credentialProvider?: ModelCredentialProvider;
|
|
5
|
-
}, reason: ModelCredentialAcquireReason, missingCredentialMessage: string, signal?: AbortSignal): Promise<ModelCredential>;
|
|
6
|
-
export declare function appendModelCredentialHeaders(headers: Headers, credential: ModelCredential, reservedHeaders: ReadonlySet<string>): Headers;
|
|
7
|
-
/** Values known to be credentials, used only when producing public HTTP error diagnostics. */
|
|
8
|
-
export declare function modelCredentialSensitiveValues(credential: ModelCredential): readonly string[];
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { MarAgentError } from '../error.js';
|
|
2
|
-
import { SecretValue } from './configuration.js';
|
|
3
|
-
export async function acquireModelCredential(configuration, reason, missingCredentialMessage, signal) {
|
|
4
|
-
signal?.throwIfAborted();
|
|
5
|
-
if (configuration.credentialProvider !== undefined) {
|
|
6
|
-
if (configuration.apiKey !== undefined)
|
|
7
|
-
throw new MarAgentError('MAR_AGENT_MODEL_CONFIG_INVALID', 'Model credential sources are ambiguous.');
|
|
8
|
-
const credential = await waitForModelCredential(configuration.credentialProvider, reason, signal);
|
|
9
|
-
signal?.throwIfAborted();
|
|
10
|
-
if (!Number.isSafeInteger(credential.revision) ||
|
|
11
|
-
credential.revision < 0 ||
|
|
12
|
-
!Number.isFinite(credential.expiresAt) ||
|
|
13
|
-
!(credential.bearer instanceof SecretValue) ||
|
|
14
|
-
credential.headers === null ||
|
|
15
|
-
typeof credential.headers !== 'object' ||
|
|
16
|
-
Array.isArray(credential.headers) ||
|
|
17
|
-
(credential.socks5Url !== undefined && !(credential.socks5Url instanceof SecretValue)))
|
|
18
|
-
throw new MarAgentError('MAR_AGENT_MODEL_CONFIG_INVALID', 'Dynamic model credential is invalid.');
|
|
19
|
-
return credential;
|
|
20
|
-
}
|
|
21
|
-
if (configuration.apiKey === undefined)
|
|
22
|
-
throw new MarAgentError('MAR_AGENT_MODEL_CONFIG_INVALID', missingCredentialMessage);
|
|
23
|
-
return {
|
|
24
|
-
revision: 0,
|
|
25
|
-
expiresAt: Number.MAX_SAFE_INTEGER,
|
|
26
|
-
bearer: configuration.apiKey,
|
|
27
|
-
headers: {}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
async function waitForModelCredential(provider, reason, signal) {
|
|
31
|
-
if (signal === undefined)
|
|
32
|
-
return provider.acquire(reason);
|
|
33
|
-
let abort = () => { };
|
|
34
|
-
try {
|
|
35
|
-
return await new Promise((resolve, reject) => {
|
|
36
|
-
// Cancel only this request's wait; the shared provider remains caller-owned.
|
|
37
|
-
abort = () => reject(signal.reason);
|
|
38
|
-
signal.addEventListener('abort', abort, { once: true });
|
|
39
|
-
if (signal.aborted) {
|
|
40
|
-
abort();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
provider.acquire(reason).then(resolve, reject);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
finally {
|
|
47
|
-
signal.removeEventListener('abort', abort);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export function appendModelCredentialHeaders(headers, credential, reservedHeaders) {
|
|
51
|
-
for (const [name, value] of Object.entries(credential.headers)) {
|
|
52
|
-
if (reservedHeaders.has(name.toLowerCase()))
|
|
53
|
-
throw new MarAgentError('MAR_AGENT_MODEL_CONFIG_INVALID', 'Dynamic model credential contains a reserved header.');
|
|
54
|
-
headers.set(name, value instanceof SecretValue ? value.reveal() : value);
|
|
55
|
-
}
|
|
56
|
-
return headers;
|
|
57
|
-
}
|
|
58
|
-
/** Values known to be credentials, used only when producing public HTTP error diagnostics. */
|
|
59
|
-
export function modelCredentialSensitiveValues(credential) {
|
|
60
|
-
const values = [
|
|
61
|
-
credential.bearer.reveal(),
|
|
62
|
-
...Object.values(credential.headers)
|
|
63
|
-
.filter((value) => value instanceof SecretValue)
|
|
64
|
-
.map((value) => value.reveal())
|
|
65
|
-
];
|
|
66
|
-
if (credential.socks5Url !== undefined) {
|
|
67
|
-
const proxy = credential.socks5Url.reveal();
|
|
68
|
-
const url = new URL(proxy);
|
|
69
|
-
values.push(proxy, decodeURIComponent(url.username), decodeURIComponent(url.password));
|
|
70
|
-
}
|
|
71
|
-
return values;
|
|
72
|
-
}
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import { MarAgentError } from '../error.js';
|
|
2
|
-
import { isRetryableModelHttpStatus } from './http.js';
|
|
3
|
-
const DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS = 300_000;
|
|
4
|
-
const streamEventObservedAt = new WeakMap();
|
|
5
|
-
export function observeModelStreamEvent(value, observedAt) {
|
|
6
|
-
if (typeof value === 'object' && value !== null && observedAt !== undefined)
|
|
7
|
-
streamEventObservedAt.set(value, observedAt);
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
export function modelStreamEventObservedAt(value) {
|
|
11
|
-
return typeof value === 'object' && value !== null ? streamEventObservedAt.get(value) : undefined;
|
|
12
|
-
}
|
|
13
|
-
export async function* parseSse(response, signal, maxBytes = 16 * 1024 * 1024, idleTimeoutMs = DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS, sensitiveValues = []) {
|
|
14
|
-
if (!response.ok) {
|
|
15
|
-
const redact = responseRedactor(sensitiveValues);
|
|
16
|
-
const body = redact(await readResponseText(response, signal, maxBytes, idleTimeoutMs));
|
|
17
|
-
const header = (name, limit) => {
|
|
18
|
-
const value = response.headers.get(name);
|
|
19
|
-
return value === null ? null : redact(value).slice(0, limit);
|
|
20
|
-
};
|
|
21
|
-
const upstream = upstreamError(body);
|
|
22
|
-
const code = upstream?.code ??
|
|
23
|
-
(response.status === 401 || response.status === 403
|
|
24
|
-
? 'MAR_AGENT_MODEL_AUTH_FAILED'
|
|
25
|
-
: response.status === 429
|
|
26
|
-
? 'MAR_AGENT_MODEL_RATE_LIMITED'
|
|
27
|
-
: response.status === 408 || response.status === 504
|
|
28
|
-
? 'MAR_AGENT_MODEL_TIMEOUT'
|
|
29
|
-
: 'MAR_AGENT_MODEL_PROTOCOL_ERROR');
|
|
30
|
-
throw new MarAgentError(code, upstream?.message ?? `Model endpoint returned HTTP ${response.status}.`, {
|
|
31
|
-
details: {
|
|
32
|
-
status: response.status,
|
|
33
|
-
body: body.slice(0, 4096),
|
|
34
|
-
bodyTruncated: body.length > 4096,
|
|
35
|
-
contentType: header('content-type', 256),
|
|
36
|
-
requestId: header('x-request-id', 256) ?? header('request-id', 256),
|
|
37
|
-
retryAfter: header('retry-after', 128)
|
|
38
|
-
},
|
|
39
|
-
retryable: isRetryableModelHttpStatus(response.status)
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
if (response.body === null)
|
|
43
|
-
throw new MarAgentError('MAR_AGENT_MODEL_PROTOCOL_ERROR', 'Model response has no body.');
|
|
44
|
-
const reader = response.body.getReader();
|
|
45
|
-
const decoder = new TextDecoder();
|
|
46
|
-
let buffer = '';
|
|
47
|
-
let total = 0;
|
|
48
|
-
let streamCompleted = false;
|
|
49
|
-
const receiverAbort = new AbortController();
|
|
50
|
-
const receiverSignal = AbortSignal.any([signal, receiverAbort.signal]);
|
|
51
|
-
const chunks = [];
|
|
52
|
-
let nextChunk = 0;
|
|
53
|
-
let receivedAll = false;
|
|
54
|
-
let receiverFailure;
|
|
55
|
-
let wake;
|
|
56
|
-
const notify = () => {
|
|
57
|
-
wake?.();
|
|
58
|
-
wake = undefined;
|
|
59
|
-
};
|
|
60
|
-
// Keep transport receipt independent of async SDK publication and persistence.
|
|
61
|
-
// The cumulative response byte limit also bounds the pending raw chunk queue.
|
|
62
|
-
const receive = (async () => {
|
|
63
|
-
try {
|
|
64
|
-
while (true) {
|
|
65
|
-
const { value, done } = await readStreamChunk(reader, receiverSignal, idleTimeoutMs);
|
|
66
|
-
const observedAt = performance.now();
|
|
67
|
-
if (done) {
|
|
68
|
-
streamCompleted = true;
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
total += value.byteLength;
|
|
72
|
-
enforceResponseSize(total, maxBytes);
|
|
73
|
-
if (value.byteLength === 0)
|
|
74
|
-
continue;
|
|
75
|
-
chunks.push({ value, observedAt });
|
|
76
|
-
notify();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
receiverFailure = { error };
|
|
81
|
-
await reader.cancel(error).catch(() => undefined);
|
|
82
|
-
}
|
|
83
|
-
finally {
|
|
84
|
-
receivedAll = true;
|
|
85
|
-
notify();
|
|
86
|
-
}
|
|
87
|
-
})();
|
|
88
|
-
try {
|
|
89
|
-
while (true) {
|
|
90
|
-
signal.throwIfAborted();
|
|
91
|
-
const chunk = chunks[nextChunk];
|
|
92
|
-
if (chunk === undefined) {
|
|
93
|
-
if (receivedAll) {
|
|
94
|
-
if (receiverFailure !== undefined)
|
|
95
|
-
throw receiverFailure.error;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
await new Promise((resolve) => {
|
|
99
|
-
wake = resolve;
|
|
100
|
-
});
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
chunks[nextChunk++] = undefined;
|
|
104
|
-
if (nextChunk >= 1_024 && nextChunk * 2 >= chunks.length) {
|
|
105
|
-
chunks.splice(0, nextChunk);
|
|
106
|
-
nextChunk = 0;
|
|
107
|
-
}
|
|
108
|
-
const { value, observedAt } = chunk;
|
|
109
|
-
const text = decoder.decode(value, { stream: true });
|
|
110
|
-
// Normalize CRLF across transport chunks as well as within each chunk.
|
|
111
|
-
if (buffer.endsWith('\r') && text.startsWith('\n'))
|
|
112
|
-
buffer = buffer.slice(0, -1);
|
|
113
|
-
buffer += text.replaceAll('\r\n', '\n');
|
|
114
|
-
let boundary;
|
|
115
|
-
while ((boundary = buffer.indexOf('\n\n')) >= 0) {
|
|
116
|
-
const frame = buffer.slice(0, boundary);
|
|
117
|
-
buffer = buffer.slice(boundary + 2);
|
|
118
|
-
const data = frame
|
|
119
|
-
.split('\n')
|
|
120
|
-
.filter((line) => line.startsWith('data:'))
|
|
121
|
-
.map((line) => line.slice(5).trimStart())
|
|
122
|
-
.join('\n');
|
|
123
|
-
if (data.length === 0 || data === '[DONE]')
|
|
124
|
-
continue;
|
|
125
|
-
try {
|
|
126
|
-
yield observeModelStreamEvent(JSON.parse(data), observedAt);
|
|
127
|
-
}
|
|
128
|
-
catch (cause) {
|
|
129
|
-
throw new MarAgentError('MAR_AGENT_MODEL_PROTOCOL_ERROR', 'Model SSE contained invalid JSON.', { cause });
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
buffer += decoder.decode();
|
|
134
|
-
if (buffer.trim().length > 0)
|
|
135
|
-
throw new MarAgentError('MAR_AGENT_MODEL_PROTOCOL_ERROR', 'Model SSE ended with an incomplete frame.');
|
|
136
|
-
}
|
|
137
|
-
finally {
|
|
138
|
-
receiverAbort.abort();
|
|
139
|
-
await receive;
|
|
140
|
-
await closeReader(reader, streamCompleted);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
async function readResponseText(response, signal, maxBytes, idleTimeoutMs) {
|
|
144
|
-
if (response.body === null)
|
|
145
|
-
return '';
|
|
146
|
-
const reader = response.body.getReader();
|
|
147
|
-
const decoder = new TextDecoder();
|
|
148
|
-
let body = '';
|
|
149
|
-
let total = 0;
|
|
150
|
-
let streamCompleted = false;
|
|
151
|
-
try {
|
|
152
|
-
while (true) {
|
|
153
|
-
const { value, done } = await readStreamChunk(reader, signal, idleTimeoutMs);
|
|
154
|
-
if (done) {
|
|
155
|
-
streamCompleted = true;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
total += value.byteLength;
|
|
159
|
-
enforceResponseSize(total, maxBytes);
|
|
160
|
-
body += decoder.decode(value, { stream: true });
|
|
161
|
-
}
|
|
162
|
-
return body + decoder.decode();
|
|
163
|
-
}
|
|
164
|
-
finally {
|
|
165
|
-
await closeReader(reader, streamCompleted);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function enforceResponseSize(total, maxBytes) {
|
|
169
|
-
if (total > maxBytes)
|
|
170
|
-
throw new MarAgentError('MAR_AGENT_MODEL_PROTOCOL_ERROR', 'Model response exceeded the size limit.');
|
|
171
|
-
}
|
|
172
|
-
async function closeReader(reader, streamCompleted) {
|
|
173
|
-
if (!streamCompleted)
|
|
174
|
-
await reader.cancel().catch(() => undefined);
|
|
175
|
-
try {
|
|
176
|
-
reader.releaseLock();
|
|
177
|
-
}
|
|
178
|
-
catch {
|
|
179
|
-
// Preserve the original read failure if cancellation could not settle the reader.
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
async function readStreamChunk(reader, signal, idleTimeoutMs) {
|
|
183
|
-
if (signal.aborted) {
|
|
184
|
-
void reader.cancel(signal.reason).catch(() => undefined);
|
|
185
|
-
throw signal.reason;
|
|
186
|
-
}
|
|
187
|
-
const timeoutError = new MarAgentError('MAR_AGENT_MODEL_TIMEOUT', 'Model stream was idle for too long.', {
|
|
188
|
-
details: { reason: 'MODEL_STREAM_IDLE_TIMEOUT' },
|
|
189
|
-
retryable: true
|
|
190
|
-
});
|
|
191
|
-
return await new Promise((resolve, reject) => {
|
|
192
|
-
let settled = false;
|
|
193
|
-
const cleanup = () => {
|
|
194
|
-
clearTimeout(timeout);
|
|
195
|
-
signal.removeEventListener('abort', abortFromCaller);
|
|
196
|
-
};
|
|
197
|
-
const resolveOnce = (result) => {
|
|
198
|
-
if (settled)
|
|
199
|
-
return;
|
|
200
|
-
settled = true;
|
|
201
|
-
cleanup();
|
|
202
|
-
resolve(result);
|
|
203
|
-
};
|
|
204
|
-
const rejectOnce = (reason) => {
|
|
205
|
-
if (settled)
|
|
206
|
-
return;
|
|
207
|
-
settled = true;
|
|
208
|
-
cleanup();
|
|
209
|
-
reject(reason);
|
|
210
|
-
};
|
|
211
|
-
const interrupt = (reason) => {
|
|
212
|
-
void reader.cancel(reason).catch(() => undefined);
|
|
213
|
-
rejectOnce(reason);
|
|
214
|
-
};
|
|
215
|
-
const abortFromCaller = () => interrupt(signal.reason);
|
|
216
|
-
signal.addEventListener('abort', abortFromCaller, { once: true });
|
|
217
|
-
const timeout = setTimeout(() => interrupt(timeoutError), Math.max(1, idleTimeoutMs));
|
|
218
|
-
reader.read().then(resolveOnce, (error) => {
|
|
219
|
-
rejectOnce(signal.aborted ? (signal.reason ?? error) : error);
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
function responseRedactor(sensitiveValues) {
|
|
224
|
-
const secrets = [
|
|
225
|
-
...new Set(sensitiveValues.flatMap((value) => value ? [value, JSON.stringify(value).slice(1, -1), encodeURIComponent(value)] : []))
|
|
226
|
-
].sort((left, right) => right.length - left.length);
|
|
227
|
-
return (value) => secrets.reduce((text, secret) => text.replaceAll(secret, '[REDACTED]'), value);
|
|
228
|
-
}
|
|
229
|
-
function upstreamError(body) {
|
|
230
|
-
let parsed;
|
|
231
|
-
try {
|
|
232
|
-
parsed = JSON.parse(body);
|
|
233
|
-
}
|
|
234
|
-
catch {
|
|
235
|
-
return undefined;
|
|
236
|
-
}
|
|
237
|
-
const root = record(parsed);
|
|
238
|
-
if (typeof root.error === 'string') {
|
|
239
|
-
const message = bounded(root.error, 1_000);
|
|
240
|
-
return message === undefined ? undefined : { message };
|
|
241
|
-
}
|
|
242
|
-
const error = record(root.error);
|
|
243
|
-
// K3-compatible gateways can put the error discriminator in `type` and omit `code`.
|
|
244
|
-
const code = bounded(text(error.code) ?? text(error.type), 80);
|
|
245
|
-
const message = bounded(text(error.message), 1_000);
|
|
246
|
-
return message === undefined ? undefined : { ...(code === undefined ? {} : { code }), message };
|
|
247
|
-
}
|
|
248
|
-
const RETRYABLE_UPSTREAM_OVERLOAD_CODES = new Set([
|
|
249
|
-
'rate_limit_error',
|
|
250
|
-
'overloaded_error',
|
|
251
|
-
'api_overloaded',
|
|
252
|
-
'server_is_overloaded',
|
|
253
|
-
'system_cpu_overloaded',
|
|
254
|
-
'resource_exhausted',
|
|
255
|
-
'temporarily_unavailable',
|
|
256
|
-
'service_unavailable'
|
|
257
|
-
]);
|
|
258
|
-
// Closed set of transient upstream capacity/overload error codes; never grows into a
|
|
259
|
-
// vendor-specific or free-text error classification table.
|
|
260
|
-
export function isRetryableUpstreamOverloadCode(code) {
|
|
261
|
-
return code !== undefined && RETRYABLE_UPSTREAM_OVERLOAD_CODES.has(code.toLowerCase());
|
|
262
|
-
}
|
|
263
|
-
function bounded(value, maximum) {
|
|
264
|
-
if (value === undefined)
|
|
265
|
-
return undefined;
|
|
266
|
-
const normalized = value.trim();
|
|
267
|
-
if (normalized.length === 0)
|
|
268
|
-
return undefined;
|
|
269
|
-
return [...normalized].slice(0, maximum).join('');
|
|
270
|
-
}
|
|
271
|
-
export function record(value) {
|
|
272
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
273
|
-
? value
|
|
274
|
-
: {};
|
|
275
|
-
}
|
|
276
|
-
export function text(value) {
|
|
277
|
-
return typeof value === 'string' ? value : undefined;
|
|
278
|
-
}
|
|
279
|
-
export function number(value) {
|
|
280
|
-
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
281
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { MarAgentError } from '../error.js';
|
|
2
|
-
/** Preserve explicit blocks only while their complete texts still match the actual prefix. */
|
|
3
|
-
export function resolveModelTextBlocks(text, blocks) {
|
|
4
|
-
if (typeof text !== 'string' || !Array.isArray(blocks))
|
|
5
|
-
throw invalid();
|
|
6
|
-
const copied = blocks.map((block) => {
|
|
7
|
-
if (!block ||
|
|
8
|
-
typeof block !== 'object' ||
|
|
9
|
-
typeof block.text !== 'string' ||
|
|
10
|
-
(block.cache !== undefined && block.cache !== true))
|
|
11
|
-
throw invalid();
|
|
12
|
-
return { text: block.text, ...(block.cache === true ? { cache: true } : {}) };
|
|
13
|
-
});
|
|
14
|
-
let offset = 0;
|
|
15
|
-
const result = [];
|
|
16
|
-
for (const block of copied) {
|
|
17
|
-
if (!text.startsWith(block.text, offset))
|
|
18
|
-
break;
|
|
19
|
-
result.push(block);
|
|
20
|
-
offset += block.text.length;
|
|
21
|
-
}
|
|
22
|
-
if (offset < text.length)
|
|
23
|
-
result.push({ text: text.slice(offset) });
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
export function modelTextInput(value) {
|
|
27
|
-
if (typeof value === 'string')
|
|
28
|
-
return { text: value };
|
|
29
|
-
if (!Array.isArray(value))
|
|
30
|
-
throw invalid();
|
|
31
|
-
for (const block of value) {
|
|
32
|
-
if (!block || typeof block !== 'object' || typeof block.text !== 'string')
|
|
33
|
-
throw invalid();
|
|
34
|
-
}
|
|
35
|
-
const text = value.map((block) => block.text).join('');
|
|
36
|
-
return { text, blocks: resolveModelTextBlocks(text, value) };
|
|
37
|
-
}
|
|
38
|
-
function invalid() {
|
|
39
|
-
return new MarAgentError('MAR_AGENT_MODEL_TEXT_BLOCK_INVALID', 'Model text blocks are invalid.');
|
|
40
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { MarAgentModelConfiguration } from './configuration.js';
|
|
2
|
-
import type { ClientToolDefinition } from './contracts.js';
|
|
3
|
-
/** Native Responses discovery carries deferred definitions in history, not the top-level catalog. */
|
|
4
|
-
export declare function projectModelRequestTools(model: Pick<MarAgentModelConfiguration, 'protocol'>, tools: readonly ClientToolDefinition[], residentNames: ReadonlySet<string>): readonly ClientToolDefinition[];
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { MarAgentModelConfiguration } from './configuration.js';
|
|
2
|
-
/** Probe a configured protocol without exposing its adapter or wire events. */
|
|
3
|
-
export declare function testMarAgentModelTransport(configuration: MarAgentModelConfiguration, signal: AbortSignal): Promise<boolean>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AnthropicMessagesAdapter } from './anthropic-messages.js';
|
|
2
|
-
import { OpenAiResponsesAdapter } from './openai-responses.js';
|
|
3
|
-
/** Probe a configured protocol without exposing its adapter or wire events. */
|
|
4
|
-
export async function testMarAgentModelTransport(configuration, signal) {
|
|
5
|
-
const adapter = configuration.protocol === 'OPENAI_RESPONSES'
|
|
6
|
-
? new OpenAiResponsesAdapter(configuration)
|
|
7
|
-
: new AnthropicMessagesAdapter(configuration);
|
|
8
|
-
try {
|
|
9
|
-
let completed = false;
|
|
10
|
-
for await (const event of adapter.start({
|
|
11
|
-
system: 'You are performing a model transport connectivity test.',
|
|
12
|
-
messages: [{ role: 'user', content: 'Reply with OK.' }],
|
|
13
|
-
tools: [],
|
|
14
|
-
allowTools: false
|
|
15
|
-
}, signal))
|
|
16
|
-
if (event.type === 'completed')
|
|
17
|
-
completed = true;
|
|
18
|
-
return completed;
|
|
19
|
-
}
|
|
20
|
-
finally {
|
|
21
|
-
await adapter.close?.();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { MarAgentModelConfiguration } from './configuration.js';
|
|
2
|
-
import type { ModelEvent, ModelRequest } from './contracts.js';
|
|
3
|
-
/** Safe request facts, independent of conversation events and provider payloads. */
|
|
4
|
-
export interface ModelRequestUsage {
|
|
5
|
-
readonly recordId: string;
|
|
6
|
-
readonly requestId: string;
|
|
7
|
-
readonly revision: number;
|
|
8
|
-
readonly modelConfigurationId: string;
|
|
9
|
-
readonly modelName: string;
|
|
10
|
-
readonly provider: string;
|
|
11
|
-
readonly requestedModel: string;
|
|
12
|
-
readonly actualModel?: string;
|
|
13
|
-
readonly responseId?: string;
|
|
14
|
-
readonly startedAt: number;
|
|
15
|
-
readonly endedAt?: number;
|
|
16
|
-
readonly state: 'running' | 'succeeded' | 'failed' | 'cancelled' | 'interrupted';
|
|
17
|
-
readonly inputTokens?: string;
|
|
18
|
-
readonly outputTokens?: string;
|
|
19
|
-
readonly cacheReadTokens?: string;
|
|
20
|
-
readonly cacheWriteTokens?: string;
|
|
21
|
-
readonly reasoningTokens?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface ModelUsageObservation extends ModelRequestUsage {
|
|
24
|
-
readonly sessionId: string;
|
|
25
|
-
readonly executionId?: string;
|
|
26
|
-
readonly purpose: 'conversation' | 'compact' | 'title' | 'other';
|
|
27
|
-
readonly agentRole: 'root' | 'subagent';
|
|
28
|
-
}
|
|
29
|
-
export type ModelUsageObserver = (usage: ModelUsageObservation) => Promise<void> | void;
|
|
30
|
-
/** Observe before retry prelude buffering so failed attempts retain reported usage. */
|
|
31
|
-
export declare function observeModelRequestUsage(start: () => AsyncIterable<ModelEvent>, request: ModelRequest, configuration: MarAgentModelConfiguration, signal: AbortSignal, now?: () => number): AsyncIterable<ModelEvent>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ExecutionMode } from '../runtime/contracts.js';
|
|
2
|
-
import { type CorePromptPart } from '../extensions/prompt-composition.js';
|
|
3
|
-
export declare const MAR_AGENT_PROMPT_VERSION = "1.67";
|
|
4
|
-
interface SystemPromptInput {
|
|
5
|
-
mode: ExecutionMode;
|
|
6
|
-
platform: string;
|
|
7
|
-
architecture?: string;
|
|
8
|
-
shell?: {
|
|
9
|
-
readonly name: string;
|
|
10
|
-
readonly path: string;
|
|
11
|
-
};
|
|
12
|
-
guaranteedCommands?: Readonly<Record<string, string>>;
|
|
13
|
-
workspace: string;
|
|
14
|
-
tools: readonly string[];
|
|
15
|
-
directTools?: readonly string[];
|
|
16
|
-
extension?: string | undefined;
|
|
17
|
-
}
|
|
18
|
-
export declare function buildSystemPrompt(input: SystemPromptInput): string;
|
|
19
|
-
export declare function buildSystemPromptSections(input: SystemPromptInput): readonly CorePromptPart[];
|
|
20
|
-
export {};
|