@bastani/atomic 0.9.14-alpha.6 → 0.9.15-alpha.1
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/CHANGELOG.md +90 -0
- package/README.md +1 -1
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +14 -0
- package/dist/builtin/mcp/package.json +4 -4
- package/dist/builtin/mcp/sampling-handler.ts +2 -2
- package/dist/builtin/mcp/types.ts +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +42 -0
- package/dist/builtin/subagents/README.md +5 -22
- package/dist/builtin/subagents/agents/code-simplifier.md +2 -2
- package/dist/builtin/subagents/agents/codebase-analyzer.md +2 -2
- package/dist/builtin/subagents/agents/codebase-locator.md +2 -2
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +2 -2
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +2 -2
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +2 -2
- package/dist/builtin/subagents/agents/codebase-research-locator.md +2 -2
- package/dist/builtin/subagents/agents/worker.md +2 -2
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/subagents/skills/subagent/SKILL.md +6 -6
- package/dist/builtin/subagents/src/agents/agent-loaders.ts +0 -4
- package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +1 -12
- package/dist/builtin/subagents/src/agents/agent-management.ts +0 -1
- package/dist/builtin/subagents/src/agents/agent-serializer.ts +7 -6
- package/dist/builtin/subagents/src/agents/agent-types.ts +0 -1
- package/dist/builtin/subagents/src/extension/schemas.ts +2 -2
- package/dist/builtin/subagents/src/extension/startup-maintenance.ts +2 -2
- package/dist/builtin/subagents/src/intercom/result-intercom.ts +0 -127
- package/dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts +1 -3
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +15 -106
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +0 -3
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +2 -13
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +2 -12
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +1 -20
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +0 -6
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +10 -21
- package/dist/builtin/subagents/src/runs/inprocess/attempt-handles.ts +104 -0
- package/dist/builtin/subagents/src/runs/inprocess/index.ts +10 -21
- package/dist/builtin/subagents/src/runs/inprocess/prompt-behavior.ts +2 -3
- package/dist/builtin/subagents/src/runs/inprocess/runner.ts +11 -32
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/temp-cleanup.ts +69 -0
- package/dist/builtin/subagents/src/shared/model-resolution.ts +1 -1
- package/dist/builtin/subagents/src/shared/types-config.ts +0 -4
- package/dist/builtin/subagents/src/shared/types-depth.ts +15 -103
- package/dist/builtin/subagents/src/shared/types-foreground-state.ts +56 -0
- package/dist/builtin/subagents/src/shared/types-results.ts +1 -59
- package/dist/builtin/subagents/src/shared/types-runtime.ts +0 -2
- package/dist/builtin/subagents/src/shared/types.ts +1 -1
- package/dist/builtin/subagents/src/shared/utils.ts +1 -1
- package/dist/builtin/subagents/src/slash/slash-live-state.ts +1 -1
- package/dist/builtin/web-access/CHANGELOG.md +16 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/web-access/summary-review.ts +2 -2
- package/dist/builtin/web-access/web-search-summary.ts +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +84 -0
- package/dist/builtin/workflows/README.md +2 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +60473 -401
- package/dist/builtin/workflows/src/extension/public-types.ts +1 -1
- package/dist/builtin/workflows/src/extension/wiring.ts +1 -1
- package/dist/builtin/workflows/src/extension/workflow-heartbeat-delivery.ts +48 -4
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +5 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +35 -2
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-pause.ts +6 -0
- package/dist/builtin/workflows/src/tui/chat-surface-message.ts +15 -13
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +25 -2
- package/dist/bun/cli.js +1 -1
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/register-bedrock.js +2 -2
- package/dist/bun/register-bedrock.js.map +1 -1
- package/dist/cli/auth-check.d.ts +1 -1
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js +1 -1
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/credential-print.d.ts +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +2 -2
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/file-processor.d.ts +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +1 -1
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +1 -1
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +1 -1
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +1 -1
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +2 -2
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +2 -2
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +2 -2
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +1 -1
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +1 -1
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime-auth.js +1 -1
- package/dist/core/agent-session-runtime-auth.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-state.d.ts +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +1 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/anthropic-thinking-guard.d.ts +1 -1
- package/dist/core/anthropic-thinking-guard.d.ts.map +1 -1
- package/dist/core/anthropic-thinking-guard.js +1 -1
- package/dist/core/anthropic-thinking-guard.js.map +1 -1
- package/dist/core/auth-storage.d.ts +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/cache-stats.d.ts +1 -1
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/cloudflare-gateway-binding.d.ts +1 -1
- package/dist/core/cloudflare-gateway-binding.d.ts.map +1 -1
- package/dist/core/cloudflare-gateway-binding.js +1 -1
- package/dist/core/cloudflare-gateway-binding.js.map +1 -1
- package/dist/core/codex-fast-mode.d.ts +2 -2
- package/dist/core/codex-fast-mode.d.ts.map +1 -1
- package/dist/core/codex-fast-mode.js +3 -2
- package/dist/core/codex-fast-mode.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +2 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction-runner.d.ts +2 -2
- package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/compaction-runner.js.map +1 -1
- package/dist/core/compaction/compaction-types.d.ts +2 -2
- package/dist/core/compaction/compaction-types.d.ts.map +1 -1
- package/dist/core/compaction/compaction-types.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/fallback-planner.d.ts +1 -1
- package/dist/core/compaction/fallback-planner.d.ts.map +1 -1
- package/dist/core/compaction/fallback-planner.js.map +1 -1
- package/dist/core/compaction/planner-outcome.d.ts +1 -1
- package/dist/core/compaction/planner-outcome.d.ts.map +1 -1
- package/dist/core/compaction/planner-outcome.js +1 -1
- package/dist/core/compaction/planner-outcome.js.map +1 -1
- package/dist/core/compaction/range-planner-diagnostics.d.ts +1 -1
- package/dist/core/compaction/range-planner-diagnostics.d.ts.map +1 -1
- package/dist/core/compaction/range-planner-diagnostics.js +1 -1
- package/dist/core/compaction/range-planner-diagnostics.js.map +1 -1
- package/dist/core/compaction/range-planner.d.ts +2 -2
- package/dist/core/compaction/range-planner.d.ts.map +1 -1
- package/dist/core/compaction/range-planner.js +2 -2
- package/dist/core/compaction/range-planner.js.map +1 -1
- package/dist/core/compaction/session-summarization.d.ts +2 -2
- package/dist/core/compaction/session-summarization.d.ts.map +1 -1
- package/dist/core/compaction/session-summarization.js +2 -2
- package/dist/core/compaction/session-summarization.js.map +1 -1
- package/dist/core/compaction/transcript-serialization.d.ts +1 -1
- package/dist/core/compaction/transcript-serialization.d.ts.map +1 -1
- package/dist/core/compaction/transcript-serialization.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/experimental.d.ts +1 -1
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/agent-events.d.ts +2 -2
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +2 -2
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +1 -7
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/event-results.d.ts +1 -1
- package/dist/core/extensions/event-results.d.ts.map +1 -1
- package/dist/core/extensions/event-results.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +21 -9
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +2 -2
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/reactive-widget.d.ts +6 -0
- package/dist/core/extensions/reactive-widget.d.ts.map +1 -1
- package/dist/core/extensions/reactive-widget.js +62 -6
- package/dist/core/extensions/reactive-widget.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +1 -1
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner-events.d.ts +1 -1
- package/dist/core/extensions/runner-events.d.ts.map +1 -1
- package/dist/core/extensions/runner-events.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +2 -2
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/tool-events.d.ts +1 -1
- package/dist/core/extensions/tool-events.d.ts.map +1 -1
- package/dist/core/extensions/tool-events.js.map +1 -1
- package/dist/core/extensions/tool-types.d.ts +2 -2
- package/dist/core/extensions/tool-types.d.ts.map +1 -1
- package/dist/core/extensions/tool-types.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +2 -0
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/fallback-models.d.ts +1 -1
- package/dist/core/fallback-models.d.ts.map +1 -1
- package/dist/core/fallback-models.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +14 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-capabilities.d.ts +1 -1
- package/dist/core/model-capabilities.d.ts.map +1 -1
- package/dist/core/model-capabilities.js.map +1 -1
- package/dist/core/model-fallback-failures.d.ts.map +1 -1
- package/dist/core/model-fallback-failures.js +18 -1
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/model-registry.d.ts +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-cli.js.map +1 -1
- package/dist/core/model-resolver-defaults.d.ts +1 -1
- package/dist/core/model-resolver-defaults.d.ts.map +1 -1
- package/dist/core/model-resolver-defaults.js +1 -1
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/model-resolver-initial.d.ts +1 -1
- package/dist/core/model-resolver-initial.d.ts.map +1 -1
- package/dist/core/model-resolver-initial.js.map +1 -1
- package/dist/core/model-resolver-patterns.d.ts +1 -1
- package/dist/core/model-resolver-patterns.d.ts.map +1 -1
- package/dist/core/model-resolver-patterns.js.map +1 -1
- package/dist/core/model-resolver-scope.d.ts +1 -1
- package/dist/core/model-resolver-scope.d.ts.map +1 -1
- package/dist/core/model-resolver-scope.js +1 -1
- package/dist/core/model-resolver-scope.js.map +1 -1
- package/dist/core/model-resolver-types.d.ts +1 -1
- package/dist/core/model-resolver-types.d.ts.map +1 -1
- package/dist/core/model-resolver-types.js.map +1 -1
- package/dist/core/model-runtime-auth.d.ts +1 -1
- package/dist/core/model-runtime-auth.d.ts.map +1 -1
- package/dist/core/model-runtime-auth.js.map +1 -1
- package/dist/core/model-runtime-providers.d.ts +2 -2
- package/dist/core/model-runtime-providers.d.ts.map +1 -1
- package/dist/core/model-runtime-providers.js +2 -2
- package/dist/core/model-runtime-providers.js.map +1 -1
- package/dist/core/model-runtime-restoration.d.ts +1 -1
- package/dist/core/model-runtime-restoration.d.ts.map +1 -1
- package/dist/core/model-runtime-restoration.js.map +1 -1
- package/dist/core/model-runtime-snapshot.d.ts +1 -1
- package/dist/core/model-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/model-runtime-snapshot.js.map +1 -1
- package/dist/core/model-runtime-streaming.d.ts +1 -1
- package/dist/core/model-runtime-streaming.d.ts.map +1 -1
- package/dist/core/model-runtime-streaming.js +1 -1
- package/dist/core/model-runtime-streaming.js.map +1 -1
- package/dist/core/model-runtime-types.d.ts +1 -1
- package/dist/core/model-runtime-types.d.ts.map +1 -1
- package/dist/core/model-runtime-types.js.map +1 -1
- package/dist/core/model-runtime.d.ts +8 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +15 -3
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.d.ts +1 -1
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/oauth-login.d.ts +1 -1
- package/dist/core/oauth-login.d.ts.map +1 -1
- package/dist/core/oauth-login.js.map +1 -1
- package/dist/core/oauth-provider-metadata.d.ts +1 -1
- package/dist/core/oauth-provider-metadata.d.ts.map +1 -1
- package/dist/core/oauth-provider-metadata.js.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.d.ts +1 -1
- package/dist/core/openai-responses-payload-sanitizer.d.ts.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.js.map +1 -1
- package/dist/core/provider-attribution.d.ts +1 -1
- package/dist/core/provider-attribution.d.ts.map +1 -1
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/provider-composer-internal.d.ts +1 -1
- package/dist/core/provider-composer-internal.d.ts.map +1 -1
- package/dist/core/provider-composer-internal.js.map +1 -1
- package/dist/core/provider-composer.d.ts +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +2 -2
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/provider-context-usage.d.ts.map +1 -1
- package/dist/core/provider-context-usage.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +1 -1
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk-types.d.ts +1 -1
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +30 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +2 -2
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-entries.d.ts +1 -1
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +1 -1
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/session-manager-validation.js +1 -1
- package/dist/core/session-manager-validation.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +11 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-types.d.ts +2 -1
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/summarization-retry.d.ts +1 -1
- package/dist/core/summarization-retry.d.ts.map +1 -1
- package/dist/core/summarization-retry.js.map +1 -1
- package/dist/core/tools/bash-session-environment.d.ts +1 -1
- package/dist/core/tools/bash-session-environment.d.ts.map +1 -1
- package/dist/core/tools/bash-session-environment.js.map +1 -1
- package/dist/core/tools/oversized-tool-result.d.ts +1 -1
- package/dist/core/tools/oversized-tool-result.d.ts.map +1 -1
- package/dist/core/tools/oversized-tool-result.js.map +1 -1
- package/dist/core/tools/read-url.d.ts +1 -1
- package/dist/core/tools/read-url.d.ts.map +1 -1
- package/dist/core/tools/read-url.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/resource-selectors.d.ts +1 -1
- package/dist/core/tools/resource-selectors.d.ts.map +1 -1
- package/dist/core/tools/resource-selectors.js +2 -7
- package/dist/core/tools/resource-selectors.js.map +1 -1
- package/dist/core/typebox-compat.js +1 -1
- package/dist/core/typebox-compat.js.map +1 -1
- package/dist/core/usage-totals.d.ts +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +1 -1
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/main-app-mode.d.ts +1 -1
- package/dist/main-app-mode.d.ts.map +1 -1
- package/dist/main-app-mode.js.map +1 -1
- package/dist/main-session-options.js +1 -1
- package/dist/main-session-options.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +1 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-context.js +26 -0
- package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +7 -2
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +1 -0
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -1
- package/dist/modes/interactive/streaming-assistant-message.d.ts +1 -1
- package/dist/modes/interactive/streaming-assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/streaming-assistant-message.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts +3 -0
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +26 -3
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts +2 -1
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +14 -0
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.js.map +1 -1
- package/dist/modes/json-event.d.ts +1 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/print-mode.d.ts +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +2 -2
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-api.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.js +4 -1
- package/dist/modes/rpc/rpc-extension-ui.js.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.d.ts +1 -1
- package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +2 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/tool-result-images.d.ts +1 -1
- package/dist/utils/tool-result-images.d.ts.map +1 -1
- package/dist/utils/tool-result-images.js.map +1 -1
- package/docs/custom-provider.md +11 -8
- package/docs/development.md +0 -2
- package/docs/extensions.md +2 -2
- package/docs/json.md +1 -1
- package/docs/models/artificial-analysis-index.md +2 -2
- package/docs/models/model-selection.md +8 -8
- package/docs/models/pareto-efficiency.md +10 -10
- package/docs/models.md +9 -3
- package/docs/packages.md +1 -1
- package/docs/providers.md +5 -3
- package/docs/quickstart.md +1 -1
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +2 -2
- package/docs/session-format.md +2 -2
- package/docs/settings.md +2 -1
- package/docs/subagents.md +5 -6
- package/docs/tui.md +3 -0
- package/docs/workflows.md +3 -1
- package/examples/extensions/README.md +1 -1
- package/examples/extensions/custom-footer.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
- package/examples/extensions/handoff.ts +2 -2
- package/examples/extensions/hello.ts +1 -1
- package/examples/extensions/plan-mode/index.ts +1 -1
- package/examples/extensions/preset.ts +1 -1
- package/examples/extensions/qna.ts +1 -1
- package/examples/extensions/subagent/display.ts +1 -1
- package/examples/extensions/subagent/runner.ts +1 -1
- package/examples/extensions/subagent/types.ts +1 -1
- package/examples/extensions/summarize.ts +2 -2
- package/examples/extensions/tool-override.ts +1 -1
- package/examples/sdk/02-custom-model.ts +1 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +54 -31
- package/package.json +3 -3
- package/dist/builtin/subagents/src/extension/fanout-child.ts +0 -259
- package/dist/builtin/subagents/src/runs/inprocess/nested-routing.ts +0 -218
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-api.ts +0 -55
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-control.ts +0 -178
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-core.ts +0 -187
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-paths.ts +0 -57
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-projection.ts +0 -42
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-registry.ts +0 -352
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-rendering.ts +0 -136
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-sanitize.ts +0 -252
- package/dist/builtin/subagents/src/shared/types-nested.ts +0 -127
- package/dist/core/copilot-env-routing.d.ts +0 -36
- package/dist/core/copilot-env-routing.d.ts.map +0 -1
- package/dist/core/copilot-env-routing.js +0 -94
- package/dist/core/copilot-env-routing.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ExtensionAPI, isStaleExtensionContextError } from "@bastani/atomic";
|
|
2
2
|
import { type IntercomBridgeState, resolveSubagentIntercomTarget } from "../../intercom/intercom-bridge.js";
|
|
3
3
|
import {
|
|
4
|
-
attachNestedChildrenToResultChildren,
|
|
5
4
|
buildSubagentResultIntercomPayload,
|
|
6
5
|
deliverSubagentResultIntercomEvent,
|
|
7
6
|
formatSubagentResultReceipt,
|
|
@@ -11,7 +10,6 @@ import {
|
|
|
11
10
|
import {
|
|
12
11
|
type ControlEvent,
|
|
13
12
|
type Details,
|
|
14
|
-
type NestedRunSummary,
|
|
15
13
|
type SingleResult,
|
|
16
14
|
SUBAGENT_CONTROL_EVENT,
|
|
17
15
|
SUBAGENT_CONTROL_INTERCOM_EVENT,
|
|
@@ -20,8 +18,6 @@ import {
|
|
|
20
18
|
type SubagentToolResult,
|
|
21
19
|
} from "../../shared/types.js";
|
|
22
20
|
import { compactForegroundDetails, compactForegroundResult, getSingleResultOutput } from "../../shared/utils.js";
|
|
23
|
-
import { updateForegroundNestedProjection } from "../inprocess/runtime-support/nested-api.js";
|
|
24
|
-
import { formatNestedRunStatusLines } from "../inprocess/runtime-support/nested-rendering.js";
|
|
25
21
|
import {
|
|
26
22
|
formatControlIntercomMessage,
|
|
27
23
|
formatControlNoticeMessage,
|
|
@@ -68,12 +64,6 @@ function formatForegroundActivity(control: ForegroundControl): string | undefine
|
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
export function foregroundStatusResult(control: ForegroundControl): SubagentToolResult {
|
|
71
|
-
let nestedWarning: string | undefined;
|
|
72
|
-
try {
|
|
73
|
-
updateForegroundNestedProjection(control);
|
|
74
|
-
} catch (error) {
|
|
75
|
-
nestedWarning = `Nested status unavailable: ${error instanceof Error ? error.message : String(error)}`;
|
|
76
|
-
}
|
|
77
67
|
const activity = formatForegroundActivity(control);
|
|
78
68
|
const lines = [
|
|
79
69
|
`Run: ${control.runId}`,
|
|
@@ -84,8 +74,6 @@ export function foregroundStatusResult(control: ForegroundControl): SubagentTool
|
|
|
84
74
|
: undefined,
|
|
85
75
|
activity ? `Activity: ${activity}` : undefined,
|
|
86
76
|
].filter((line): line is string => Boolean(line));
|
|
87
|
-
lines.push(...formatNestedRunStatusLines(control.nestedChildren, { indent: "", commandHints: true, maxLines: 20 }));
|
|
88
|
-
if (nestedWarning) lines.push(`Warning: ${nestedWarning}`);
|
|
89
77
|
return { content: [{ type: "text", text: lines.join("\n") }], details: { mode: "management", results: [] } };
|
|
90
78
|
}
|
|
91
79
|
|
|
@@ -132,8 +120,6 @@ export function rememberForegroundRun(
|
|
|
132
120
|
mode: "single" | "parallel";
|
|
133
121
|
cwd: string;
|
|
134
122
|
results: SingleResult[];
|
|
135
|
-
/** Effective delegation limit per child, aligned with `results` by index. */
|
|
136
|
-
maxSubagentDepths?: readonly (number | undefined)[];
|
|
137
123
|
},
|
|
138
124
|
): void {
|
|
139
125
|
state.foregroundRuns ??= new Map();
|
|
@@ -144,7 +130,6 @@ export function rememberForegroundRun(
|
|
|
144
130
|
updatedAt: Date.now(),
|
|
145
131
|
children: input.results.map((originalResult, index) => {
|
|
146
132
|
const result = takeEarlyDetachedResult(state, input.runId, index) ?? originalResult;
|
|
147
|
-
const maxSubagentDepth = input.maxSubagentDepths?.[index];
|
|
148
133
|
return {
|
|
149
134
|
agent: result.agent,
|
|
150
135
|
index,
|
|
@@ -154,7 +139,6 @@ export function rememberForegroundRun(
|
|
|
154
139
|
detached: result.detached,
|
|
155
140
|
}),
|
|
156
141
|
...(result.sessionFile ? { sessionFile: result.sessionFile } : {}),
|
|
157
|
-
...(maxSubagentDepth === undefined ? {} : { maxSubagentDepth }),
|
|
158
142
|
result,
|
|
159
143
|
};
|
|
160
144
|
}),
|
|
@@ -323,7 +307,6 @@ async function emitForegroundResultIntercom(input: {
|
|
|
323
307
|
runId: string;
|
|
324
308
|
mode: SubagentRunMode;
|
|
325
309
|
results: SingleResult[];
|
|
326
|
-
nestedChildren?: NestedRunSummary[];
|
|
327
310
|
}): Promise<ReturnType<typeof buildSubagentResultIntercomPayload> | null> {
|
|
328
311
|
if (!input.intercomBridge.active || !input.intercomBridge.orchestratorTarget) return null;
|
|
329
312
|
const children = input.results.flatMap((result, index) =>
|
|
@@ -350,7 +333,7 @@ async function emitForegroundResultIntercom(input: {
|
|
|
350
333
|
to: input.intercomBridge.orchestratorTarget,
|
|
351
334
|
runId: input.runId,
|
|
352
335
|
mode: input.mode,
|
|
353
|
-
children
|
|
336
|
+
children,
|
|
354
337
|
});
|
|
355
338
|
const delivered = await deliverSubagentResultIntercomEvent(input.pi.events, payload);
|
|
356
339
|
if (!delivered) return null;
|
|
@@ -363,7 +346,6 @@ export async function maybeBuildForegroundIntercomReceipt(input: {
|
|
|
363
346
|
runId: string;
|
|
364
347
|
mode: SubagentRunMode;
|
|
365
348
|
details: Details;
|
|
366
|
-
nestedChildren?: NestedRunSummary[];
|
|
367
349
|
}): Promise<{ text: string; details: Details } | null> {
|
|
368
350
|
const payload = await emitForegroundResultIntercom({
|
|
369
351
|
pi: input.pi,
|
|
@@ -371,7 +353,6 @@ export async function maybeBuildForegroundIntercomReceipt(input: {
|
|
|
371
353
|
runId: input.runId,
|
|
372
354
|
mode: input.mode,
|
|
373
355
|
results: input.details.results,
|
|
374
|
-
...(input.nestedChildren?.length ? { nestedChildren: input.nestedChildren } : {}),
|
|
375
356
|
});
|
|
376
357
|
if (!payload) return null;
|
|
377
358
|
return {
|
|
@@ -6,7 +6,6 @@ import type {
|
|
|
6
6
|
ArtifactConfig,
|
|
7
7
|
ControlConfig,
|
|
8
8
|
MaxOutputConfig,
|
|
9
|
-
NestedRouteInfo,
|
|
10
9
|
ResolvedControlConfig,
|
|
11
10
|
SUBAGENT_ACTIONS,
|
|
12
11
|
SubagentState,
|
|
@@ -105,7 +104,6 @@ export interface ExecutionContextData {
|
|
|
105
104
|
parentDepth?: number;
|
|
106
105
|
controlConfig: ResolvedControlConfig;
|
|
107
106
|
intercomBridge: IntercomBridgeState;
|
|
108
|
-
nestedRoute?: NestedRouteInfo;
|
|
109
107
|
}
|
|
110
108
|
|
|
111
109
|
export interface PreparedExecutionContext {
|
|
@@ -117,10 +115,6 @@ export interface PreparedExecutionContext {
|
|
|
117
115
|
foregroundMode: "single" | "parallel";
|
|
118
116
|
execData: ExecutionContextData;
|
|
119
117
|
foregroundControl?: SubagentState["foregroundControls"] extends Map<string, infer T> ? T : never;
|
|
120
|
-
writeNestedForegroundEvent: (
|
|
121
|
-
type: "subagent.nested.started" | "subagent.nested.completed",
|
|
122
|
-
result?: SubagentToolResult,
|
|
123
|
-
) => void;
|
|
124
118
|
}
|
|
125
119
|
|
|
126
120
|
export interface ExecutionContextBuildResult {
|
|
@@ -24,8 +24,6 @@ import {
|
|
|
24
24
|
DEFAULT_ARTIFACT_CONFIG,
|
|
25
25
|
getCurrentSubagentDepth,
|
|
26
26
|
isWorkflowStageOrchestrationContext,
|
|
27
|
-
resolveChildMaxSubagentDepth,
|
|
28
|
-
resolveWorkflowStageMaxSubagentDepth,
|
|
29
27
|
type SingleResult,
|
|
30
28
|
SUBAGENT_ACTIONS,
|
|
31
29
|
type SubagentToolResult,
|
|
@@ -39,7 +37,7 @@ import {
|
|
|
39
37
|
import { inheritedIntercomGroup } from "../shared/intercom-group.js";
|
|
40
38
|
import { currentModelFullId } from "../shared/model-fallback.js";
|
|
41
39
|
import { resolveControlConfig } from "../shared/subagent-control.js";
|
|
42
|
-
import {
|
|
40
|
+
import { prepareExecutionContext, refuseSubagentChildDelegation } from "./subagent-executor-context.js";
|
|
43
41
|
import { toExecutionErrorResult, withForkContext } from "./subagent-executor-input.js";
|
|
44
42
|
import { runParallelPath } from "./subagent-executor-parallel.js";
|
|
45
43
|
import { resolveRequestedCwd } from "./subagent-executor-resume.js";
|
|
@@ -132,12 +130,6 @@ async function resumeRetainedForegroundChild(
|
|
|
132
130
|
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
133
131
|
artifactConfig,
|
|
134
132
|
maxOutput: params.maxOutput,
|
|
135
|
-
maxSubagentDepth:
|
|
136
|
-
child.maxSubagentDepth ??
|
|
137
|
-
resolveChildMaxSubagentDepth(
|
|
138
|
-
resolveWorkflowStageMaxSubagentDepth(ctx, deps.config.maxSubagentDepth),
|
|
139
|
-
agentConfig.maxSubagentDepth,
|
|
140
|
-
),
|
|
141
133
|
parentDepth: getCurrentSubagentDepth(ctx),
|
|
142
134
|
workflowStageSubagentGuard: isWorkflowStageOrchestrationContext(ctx),
|
|
143
135
|
workflowSessionMetadata: workflowSessionMetadataFromContext(ctx),
|
|
@@ -234,6 +226,12 @@ async function handleManagementRequest(input: {
|
|
|
234
226
|
details: { mode: "management" as const, results: [] },
|
|
235
227
|
};
|
|
236
228
|
}
|
|
229
|
+
// Delegation is one level deep: a session admitted as a subagent child may
|
|
230
|
+
// never start or continue another agent, whatever else it is authorized for.
|
|
231
|
+
if (!READ_ONLY_MANAGEMENT_ACTIONS.has(action)) {
|
|
232
|
+
const childRefusal = refuseSubagentChildDelegation(ctx, "management");
|
|
233
|
+
if (childRefusal) return childRefusal;
|
|
234
|
+
}
|
|
237
235
|
if (action === "doctor") {
|
|
238
236
|
let currentSessionFile: string | null = null;
|
|
239
237
|
let currentSessionId = deps.state.currentSessionId;
|
|
@@ -388,32 +386,23 @@ export function createSubagentExecutor(rawDeps: ExecutorDeps): {
|
|
|
388
386
|
};
|
|
389
387
|
}
|
|
390
388
|
|
|
391
|
-
const
|
|
392
|
-
if (
|
|
389
|
+
const childRefusal = refuseSubagentChildDelegation(ctx, inferExecutionMode(params));
|
|
390
|
+
if (childRefusal) return childRefusal;
|
|
393
391
|
|
|
394
392
|
const built = prepareExecutionContext({ params: paramsWithResolvedCwd, ctx, signal, onUpdate, deps });
|
|
395
393
|
if (built.error) return built.error;
|
|
396
394
|
const prepared = built.prepared!;
|
|
397
|
-
let nestedForegroundStarted = false;
|
|
398
395
|
try {
|
|
399
|
-
if (prepared.foregroundControl) {
|
|
400
|
-
prepared.writeNestedForegroundEvent("subagent.nested.started");
|
|
401
|
-
nestedForegroundStarted = true;
|
|
402
|
-
}
|
|
403
396
|
if (prepared.hasTasks && prepared.effectiveParams.tasks) {
|
|
404
397
|
const result = await runParallelPath(prepared.execData, deps);
|
|
405
|
-
prepared.writeNestedForegroundEvent("subagent.nested.completed", result);
|
|
406
398
|
return withForkContext(result, prepared.effectiveParams.context);
|
|
407
399
|
}
|
|
408
400
|
if (prepared.hasSingle) {
|
|
409
401
|
const result = await runSinglePath(prepared.execData, deps);
|
|
410
|
-
prepared.writeNestedForegroundEvent("subagent.nested.completed", result);
|
|
411
402
|
return withForkContext(result, prepared.effectiveParams.context);
|
|
412
403
|
}
|
|
413
404
|
} catch (error) {
|
|
414
|
-
|
|
415
|
-
if (nestedForegroundStarted) prepared.writeNestedForegroundEvent("subagent.nested.completed", errorResult);
|
|
416
|
-
return errorResult;
|
|
405
|
+
return toExecutionErrorResult(prepared.effectiveParams, error);
|
|
417
406
|
} finally {
|
|
418
407
|
if (prepared.foregroundControl) {
|
|
419
408
|
clearPendingForegroundControlNotices(deps.state, prepared.runId);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-process attempt handles for a top-level session's direct children.
|
|
3
|
+
*
|
|
4
|
+
* Delegation is one level deep, so this registry only ever holds a parent's own
|
|
5
|
+
* children. A live child is addressed by its run id or canonical task path, and
|
|
6
|
+
* interrupt/resume reach it through the handle registered when its attempt
|
|
7
|
+
* started — never through a request file, a capability token, or a poller.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface InProcessAttemptResumeOutcome {
|
|
11
|
+
readonly status: "ok" | "error" | "interrupted" | "continued";
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly sessionFile?: string;
|
|
14
|
+
readonly envelope?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface InProcessAttemptHandle {
|
|
18
|
+
readonly runId: string;
|
|
19
|
+
readonly path: string;
|
|
20
|
+
readonly status: () => string;
|
|
21
|
+
readonly interrupt: () => Promise<void>;
|
|
22
|
+
readonly resume: (message: string) => Promise<InProcessAttemptResumeOutcome>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface InProcessAttemptControlResult {
|
|
26
|
+
readonly ok: boolean;
|
|
27
|
+
readonly message: string;
|
|
28
|
+
readonly outcome?: InProcessAttemptResumeOutcome;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const attemptHandles = new Map<string, Map<string, InProcessAttemptHandle>>();
|
|
32
|
+
|
|
33
|
+
function attemptKey(id: string): string {
|
|
34
|
+
return id.trim();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function registerInProcessAttempt(handle: InProcessAttemptHandle): () => void {
|
|
38
|
+
const key = attemptKey(handle.runId);
|
|
39
|
+
let handles = attemptHandles.get(key);
|
|
40
|
+
if (!handles) {
|
|
41
|
+
handles = new Map();
|
|
42
|
+
attemptHandles.set(key, handles);
|
|
43
|
+
}
|
|
44
|
+
handles.set(handle.path, handle);
|
|
45
|
+
const pathKey = attemptKey(handle.path);
|
|
46
|
+
if (pathKey !== key) {
|
|
47
|
+
let byPath = attemptHandles.get(pathKey);
|
|
48
|
+
if (!byPath) {
|
|
49
|
+
byPath = new Map();
|
|
50
|
+
attemptHandles.set(pathKey, byPath);
|
|
51
|
+
}
|
|
52
|
+
byPath.set(handle.path, handle);
|
|
53
|
+
}
|
|
54
|
+
return () => {
|
|
55
|
+
for (const lookupKey of [key, pathKey]) {
|
|
56
|
+
const current = attemptHandles.get(lookupKey);
|
|
57
|
+
if (!current || current.get(handle.path) !== handle) continue;
|
|
58
|
+
current.delete(handle.path);
|
|
59
|
+
if (current.size === 0) attemptHandles.delete(lookupKey);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function handlesFor(id: string): InProcessAttemptHandle[] {
|
|
65
|
+
return [...(attemptHandles.get(attemptKey(id))?.values() ?? [])];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function interruptInProcessAttempt(targetId: string): Promise<InProcessAttemptControlResult | undefined> {
|
|
69
|
+
const handles = handlesFor(targetId);
|
|
70
|
+
if (handles.length === 0) return undefined;
|
|
71
|
+
const active = handles.filter((handle) => handle.status() === "running" || handle.status() === "continued");
|
|
72
|
+
if (active.length === 0) {
|
|
73
|
+
return { ok: false, message: `Run ${targetId} has no active child attempt to interrupt.` };
|
|
74
|
+
}
|
|
75
|
+
await Promise.all(active.map((handle) => handle.interrupt()));
|
|
76
|
+
return { ok: true, message: `Interrupt requested for run ${targetId}.` };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function resumeInProcessAttempt(
|
|
80
|
+
targetId: string,
|
|
81
|
+
message: string,
|
|
82
|
+
): Promise<InProcessAttemptControlResult | undefined> {
|
|
83
|
+
const handles = handlesFor(targetId);
|
|
84
|
+
if (handles.length === 0) return undefined;
|
|
85
|
+
const handle =
|
|
86
|
+
handles.find((candidate) => candidate.status() === "interrupted" || candidate.status() === "error") ?? handles[0];
|
|
87
|
+
if (!handle) return undefined;
|
|
88
|
+
if (handle.status() === "running" || handle.status() === "continued") {
|
|
89
|
+
return { ok: false, message: `Run ${targetId} is still running; resume is not required.` };
|
|
90
|
+
}
|
|
91
|
+
const outcome = await handle.resume(message);
|
|
92
|
+
return {
|
|
93
|
+
ok: outcome.status === "ok" || outcome.status === "continued",
|
|
94
|
+
message:
|
|
95
|
+
outcome.status === "ok"
|
|
96
|
+
? `Reloaded run ${targetId} through the in-process control plane.`
|
|
97
|
+
: `Run ${targetId} resume ended with status '${outcome.status}'.`,
|
|
98
|
+
outcome,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function clearInProcessAttemptHandles(): void {
|
|
103
|
+
attemptHandles.clear();
|
|
104
|
+
}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
InProcessAttemptControlResult,
|
|
3
|
+
InProcessAttemptHandle,
|
|
4
|
+
InProcessAttemptResumeOutcome,
|
|
5
|
+
} from "./attempt-handles.js";
|
|
1
6
|
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
interruptInProcessNestedAttempt,
|
|
8
|
-
readInProcessControlRequests,
|
|
9
|
-
readInProcessControlResults,
|
|
10
|
-
readInProcessNestedEvents,
|
|
11
|
-
registerInProcessNestedAttempt,
|
|
12
|
-
registerInProcessNestedRoute,
|
|
13
|
-
removeInProcessControlRequest,
|
|
14
|
-
resumeInProcessNestedAttempt,
|
|
15
|
-
subscribeInProcessControlRequests,
|
|
16
|
-
unregisterInProcessNestedRoute,
|
|
17
|
-
} from "./nested-routing.js";
|
|
7
|
+
clearInProcessAttemptHandles,
|
|
8
|
+
interruptInProcessAttempt,
|
|
9
|
+
registerInProcessAttempt,
|
|
10
|
+
resumeInProcessAttempt,
|
|
11
|
+
} from "./attempt-handles.js";
|
|
18
12
|
export type {
|
|
19
13
|
AdmissionRefusal,
|
|
20
14
|
AdmittedResult,
|
|
@@ -25,11 +19,6 @@ export type {
|
|
|
25
19
|
ChildSpec,
|
|
26
20
|
ChildStatus,
|
|
27
21
|
ContinuationReason,
|
|
28
|
-
InProcessControlRequest,
|
|
29
|
-
InProcessControlResult,
|
|
30
|
-
InProcessNestedAttemptHandle,
|
|
31
|
-
InProcessNestedResumeOutcome,
|
|
32
|
-
InProcessNestedRouteKey,
|
|
33
22
|
ModelCandidate,
|
|
34
23
|
ParentContext,
|
|
35
24
|
ResultEnvelope,
|
|
@@ -11,9 +11,8 @@ export const CHILD_SUBAGENT_BOUNDARY_INSTRUCTIONS = [
|
|
|
11
11
|
export const CHILD_FANOUT_BOUNDARY_INSTRUCTIONS = [
|
|
12
12
|
"You are a child subagent with explicit fanout responsibility for this assigned task.",
|
|
13
13
|
"The parent session owns final orchestration, completion decisions, and follow-up implementation launches.",
|
|
14
|
-
"
|
|
15
|
-
"Do
|
|
16
|
-
"The maxSubagentDepth cap still applies and may block further fanout.",
|
|
14
|
+
"Delegation is one level deep: the `subagent` tool refuses every launch, resume, and interrupt from inside a subagent.",
|
|
15
|
+
"Do the assigned fanout work yourself and report what you found; do not plan around delegating it.",
|
|
17
16
|
"If you need to edit files, call the actual edit/write tools. Do not print tool-call syntax, patches, or pseudo-tool calls as text.",
|
|
18
17
|
].join("\n");
|
|
19
18
|
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
type TerminationCause as NativeTerminationCause,
|
|
24
24
|
SubagentControl,
|
|
25
25
|
} from "@bastani/atomic-natives";
|
|
26
|
-
import type { Api, Model } from "@
|
|
26
|
+
import type { Api, Model } from "@bastani/pi-ai/compat";
|
|
27
27
|
import type { AgentConfig } from "../../agents/agent-types.js";
|
|
28
28
|
import {
|
|
29
29
|
buildSkillInjection,
|
|
@@ -43,11 +43,10 @@ import {
|
|
|
43
43
|
type ArtifactPaths,
|
|
44
44
|
DEFAULT_MAX_OUTPUT,
|
|
45
45
|
type MaxOutputConfig,
|
|
46
|
-
normalizeMaxSubagentDepth,
|
|
47
46
|
truncateOutput,
|
|
48
47
|
} from "../../shared/types.js";
|
|
48
|
+
import { type InProcessAttemptResumeOutcome, registerInProcessAttempt } from "./attempt-handles.js";
|
|
49
49
|
import { type ChildModePolicy, resolveChildModePolicy } from "./child-policy.js";
|
|
50
|
-
import { type InProcessNestedResumeOutcome, registerInProcessNestedAttempt } from "./nested-routing.js";
|
|
51
50
|
import { createInProcessChildPromptBehavior, createInProcessChildSystemPromptTransform } from "./prompt-behavior.js";
|
|
52
51
|
|
|
53
52
|
export type ChildStatus = NativeAgentStatus;
|
|
@@ -99,12 +98,6 @@ export interface ChildSpec {
|
|
|
99
98
|
/** Typed identity/capability resolved by the parent before admission. */
|
|
100
99
|
readonly intercom?: SubagentIntercomIdentity;
|
|
101
100
|
readonly sessionFile?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Effective delegation limit for this child, already narrowed by the parent's
|
|
104
|
-
* limit and the child agent's own `maxSubagentDepth`. Retained on the spec so
|
|
105
|
-
* a cold reload reissues the same limit.
|
|
106
|
-
*/
|
|
107
|
-
readonly maxSubagentDepth?: number;
|
|
108
101
|
readonly testSession?: boolean | TestSessionOptions;
|
|
109
102
|
readonly artifactJsonlPath?: string;
|
|
110
103
|
/**
|
|
@@ -316,16 +309,6 @@ function workflowMetadataFromContext(
|
|
|
316
309
|
};
|
|
317
310
|
}
|
|
318
311
|
|
|
319
|
-
/**
|
|
320
|
-
* Effective delegation limit for an admitted child. A caller that already
|
|
321
|
-
* narrowed the parent's limit against the agent definition puts the result on
|
|
322
|
-
* the spec; a caller admitting a child directly still gets the agent's own
|
|
323
|
-
* declared limit rather than an unbounded policy.
|
|
324
|
-
*/
|
|
325
|
-
export function effectiveChildMaxSubagentDepth(spec: ChildSpec): number | undefined {
|
|
326
|
-
return spec.maxSubagentDepth ?? normalizeMaxSubagentDepth(spec.agent.maxSubagentDepth);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
312
|
/**
|
|
330
313
|
* In-process children must load the same bundled extensions as the host.
|
|
331
314
|
* Workflow extensions are disabled inside workflow-owned sessions because their
|
|
@@ -618,8 +601,9 @@ function writeEvent(pathValue: string | undefined, event: AgentSessionEvent): vo
|
|
|
618
601
|
|
|
619
602
|
/**
|
|
620
603
|
* A child identity whose constructor is private. Depth and path validation happen
|
|
621
|
-
* at the Rust admission door, so callers cannot manufacture an admitted
|
|
622
|
-
*
|
|
604
|
+
* at the Rust admission door, so callers cannot manufacture an admitted child
|
|
605
|
+
* below the single permitted delegation level or bypass canonical identity
|
|
606
|
+
* allocation.
|
|
623
607
|
*/
|
|
624
608
|
interface AdmittedChildInput {
|
|
625
609
|
readonly identity: ChildIdentity;
|
|
@@ -655,7 +639,7 @@ export class AdmittedChild {
|
|
|
655
639
|
}
|
|
656
640
|
|
|
657
641
|
static create(input: AdmittedChildInput): AdmittedChild {
|
|
658
|
-
if (input.identity.depth >
|
|
642
|
+
if (input.identity.depth > 1) throw new Error("child depth exceeds maximum 1");
|
|
659
643
|
validatePath(input.identity.path);
|
|
660
644
|
return new AdmittedChild(input);
|
|
661
645
|
}
|
|
@@ -747,9 +731,6 @@ export class SubagentControlRuntime {
|
|
|
747
731
|
intercomGroup: parent.intercomGroup,
|
|
748
732
|
intercom: spec.intercom,
|
|
749
733
|
depth: identity.depth,
|
|
750
|
-
...(effectiveChildMaxSubagentDepth(spec) === undefined
|
|
751
|
-
? {}
|
|
752
|
-
: { maxSubagentDepth: effectiveChildMaxSubagentDepth(spec) }),
|
|
753
734
|
},
|
|
754
735
|
sessionDir,
|
|
755
736
|
sessionFile: spec.sessionFile,
|
|
@@ -1228,16 +1209,17 @@ export class SubagentControlRuntime {
|
|
|
1228
1209
|
};
|
|
1229
1210
|
}
|
|
1230
1211
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1212
|
+
/** Expose a direct child's live attempt so `interrupt`/`resume` can reach it by run id or path. */
|
|
1213
|
+
registerAttempt(runId: string, running: RunningAttempt, candidate: ModelCandidate): void {
|
|
1214
|
+
registerInProcessAttempt({
|
|
1233
1215
|
runId,
|
|
1234
1216
|
path: running.child.identity.path,
|
|
1235
1217
|
status: () => running.status,
|
|
1236
1218
|
interrupt: () => this.terminateChildAttempt(running, "interrupt"),
|
|
1237
|
-
resume: async (message): Promise<
|
|
1219
|
+
resume: async (message): Promise<InProcessAttemptResumeOutcome> => {
|
|
1238
1220
|
const admission = this.reloadColdChild(running.child.identity.path, message);
|
|
1239
1221
|
if (!admission.admitted) {
|
|
1240
|
-
throw new Error(admission.refusal?.reason ?? "
|
|
1222
|
+
throw new Error(admission.refusal?.reason ?? "child cold reload was refused");
|
|
1241
1223
|
}
|
|
1242
1224
|
const neverAbort = new AbortController().signal;
|
|
1243
1225
|
const resumed = this.startAttempt(admission.admitted, candidate, {
|
|
@@ -1344,9 +1326,6 @@ export class SubagentControlRuntime {
|
|
|
1344
1326
|
thinkingLevel: spec.thinkingLevel ?? (spec.agent.thinking as ChildPolicy["thinkingLevel"]),
|
|
1345
1327
|
intercomGroup: spec.parent?.intercomGroup,
|
|
1346
1328
|
depth,
|
|
1347
|
-
...(effectiveChildMaxSubagentDepth(spec) === undefined
|
|
1348
|
-
? {}
|
|
1349
|
-
: { maxSubagentDepth: effectiveChildMaxSubagentDepth(spec) }),
|
|
1350
1329
|
};
|
|
1351
1330
|
}
|
|
1352
1331
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup housekeeping for the subagent runtime temp root.
|
|
3
|
+
*
|
|
4
|
+
* The multi-level route/event pipeline that once wrote into this directory is
|
|
5
|
+
* gone, so nothing creates entries here any more. The scanner stays because
|
|
6
|
+
* users' machines still hold directories written by earlier versions, and
|
|
7
|
+
* nothing else would ever reap them.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as fs from "node:fs";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import { TEMP_ROOT_DIR } from "../../../shared/types.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Historical directory name. It must keep matching what earlier versions wrote,
|
|
16
|
+
* or their leftovers become unreachable garbage.
|
|
17
|
+
*/
|
|
18
|
+
export const SUBAGENT_RUNTIME_TEMP_DIR = path.join(TEMP_ROOT_DIR, "nested-subagent-events");
|
|
19
|
+
|
|
20
|
+
/** Whether any entry in the tree rooted at filePath has an mtime at or after cutoff, stopping at the first hit. */
|
|
21
|
+
export function hasEntryNewerThan(filePath: string, cutoff: number): boolean {
|
|
22
|
+
const stat = fs.statSync(filePath);
|
|
23
|
+
if (stat.mtimeMs >= cutoff) return true;
|
|
24
|
+
if (!stat.isDirectory()) return false;
|
|
25
|
+
return directoryHasEntryNewerThan(filePath, cutoff);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function directoryHasEntryNewerThan(dirPath: string, cutoff: number): boolean {
|
|
29
|
+
let entries: string[];
|
|
30
|
+
try {
|
|
31
|
+
entries = fs.readdirSync(dirPath);
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
for (const entry of entries) {
|
|
36
|
+
const childPath = path.join(dirPath, entry);
|
|
37
|
+
try {
|
|
38
|
+
const stat = fs.statSync(childPath);
|
|
39
|
+
if (stat.mtimeMs >= cutoff) return true;
|
|
40
|
+
if (stat.isDirectory() && directoryHasEntryNewerThan(childPath, cutoff)) return true;
|
|
41
|
+
} catch {
|
|
42
|
+
// Runtime cleanup is best-effort housekeeping.
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function cleanupOldSubdirectories(root: string, maxAgeDays: number): void {
|
|
49
|
+
let entries: string[];
|
|
50
|
+
try {
|
|
51
|
+
entries = fs.readdirSync(root);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return;
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
const cutoff = Date.now() - maxAgeDays * 24 * 60 * 60 * 1000;
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
const entryPath = path.join(root, entry);
|
|
59
|
+
try {
|
|
60
|
+
if (!hasEntryNewerThan(entryPath, cutoff)) fs.rmSync(entryPath, { recursive: true, force: true });
|
|
61
|
+
} catch {
|
|
62
|
+
// Keep startup resilient if a child process removes or rewrites an entry while scanning.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function cleanupOldSubagentRuntimeDirs(maxAgeDays: number): void {
|
|
68
|
+
cleanupOldSubdirectories(SUBAGENT_RUNTIME_TEMP_DIR, maxAgeDays);
|
|
69
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* string means.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import type { Api, Model } from "@
|
|
18
|
+
import type { Api, Model } from "@bastani/pi-ai/compat";
|
|
19
19
|
import { splitKnownThinkingSuffix, THINKING_LEVELS, type ThinkingLevel } from "./model-info.js";
|
|
20
20
|
|
|
21
21
|
/** Registry surface needed to resolve a candidate; satisfied by `ctx.modelRegistry`. */
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import type { AgentSessionEvent, SessionWorkflowMetadata } from "@bastani/atomic";
|
|
6
6
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
7
7
|
import type { CandidateModelResolver } from "./model-resolution.js";
|
|
8
|
-
import type { NestedRouteInfo } from "./types-nested.js";
|
|
9
8
|
import type {
|
|
10
9
|
ArtifactConfig,
|
|
11
10
|
ControlConfig,
|
|
@@ -88,12 +87,10 @@ export interface RunSyncOptions {
|
|
|
88
87
|
share?: boolean;
|
|
89
88
|
outputPath?: string;
|
|
90
89
|
outputMode?: OutputMode;
|
|
91
|
-
maxSubagentDepth?: number;
|
|
92
90
|
/** Current session depth passed to the in-process admission door. */
|
|
93
91
|
parentDepth?: number;
|
|
94
92
|
workflowStageSubagentGuard?: boolean;
|
|
95
93
|
workflowSessionMetadata?: SessionWorkflowMetadata;
|
|
96
|
-
nestedRoute?: NestedRouteInfo;
|
|
97
94
|
/** Override the agent's default model (format: "provider/id" or just "id") */
|
|
98
95
|
modelOverride?: string;
|
|
99
96
|
/** Registry models available for heuristic bare-model resolution */
|
|
@@ -160,7 +157,6 @@ interface TopLevelParallelConfig {
|
|
|
160
157
|
|
|
161
158
|
export interface ExtensionConfig {
|
|
162
159
|
defaultSessionDir?: string;
|
|
163
|
-
maxSubagentDepth?: number;
|
|
164
160
|
control?: ControlConfig;
|
|
165
161
|
parallel?: TopLevelParallelConfig;
|
|
166
162
|
worktreeSetupHook?: string;
|