@bastani/atomic 0.9.5-alpha.9 → 0.9.5
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 +106 -0
- package/README.md +2 -2
- package/dist/builtin/cursor/CHANGELOG.md +12 -0
- package/dist/builtin/cursor/package.json +3 -3
- package/dist/builtin/cursor/src/model-mapper.ts +6 -3
- package/dist/builtin/intercom/CHANGELOG.md +37 -0
- package/dist/builtin/intercom/README.md +4 -2
- package/dist/builtin/intercom/broker/broker.ts +6 -114
- package/dist/builtin/intercom/broker/client.ts +29 -54
- package/dist/builtin/intercom/broker/delivered-message-cache.ts +44 -0
- package/dist/builtin/intercom/broker/pending-send-registry.ts +142 -0
- package/dist/builtin/intercom/broker/send-handler.ts +106 -0
- package/dist/builtin/intercom/broker/send-signature.ts +37 -0
- package/dist/builtin/intercom/foreground-detach-handoff.ts +136 -0
- package/dist/builtin/intercom/index-heavy.ts +49 -53
- package/dist/builtin/intercom/index.ts +278 -262
- package/dist/builtin/intercom/lazy-heavy-proxy.ts +114 -0
- package/dist/builtin/intercom/lazy-subagent-ack.ts +20 -0
- package/dist/builtin/intercom/lazy-tool-execution.ts +39 -0
- package/dist/builtin/intercom/lifecycle-lease.ts +51 -0
- package/dist/builtin/intercom/lifecycle.ts +37 -20
- package/dist/builtin/intercom/package.json +3 -6
- package/dist/builtin/intercom/reply-routing.ts +17 -0
- package/dist/builtin/intercom/subagent-relay.ts +58 -12
- package/dist/builtin/intercom/types.ts +3 -3
- package/dist/builtin/mcp/CHANGELOG.md +27 -0
- package/dist/builtin/mcp/OAUTH.md +1 -0
- package/dist/builtin/mcp/README.md +4 -0
- package/dist/builtin/mcp/apps-cancellation.ts +32 -0
- package/dist/builtin/mcp/call-tool-result.ts +9 -0
- package/dist/builtin/mcp/caller-wait.ts +50 -0
- package/dist/builtin/mcp/command-registration.ts +82 -0
- package/dist/builtin/mcp/direct-tool-executor.ts +279 -0
- package/dist/builtin/mcp/direct-tools.ts +6 -239
- package/dist/builtin/mcp/host-html-template.ts +4 -2
- package/dist/builtin/mcp/index.ts +258 -250
- package/dist/builtin/mcp/init.ts +96 -87
- package/dist/builtin/mcp/mcp-auth-flow.ts +247 -237
- package/dist/builtin/mcp/mcp-callback-server.ts +89 -68
- package/dist/builtin/mcp/mcp-oauth-provider.ts +23 -1
- package/dist/builtin/mcp/metadata-hydration.ts +21 -6
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/mcp/proxy-auth.ts +4 -4
- package/dist/builtin/mcp/proxy-call.ts +111 -40
- package/dist/builtin/mcp/proxy-connect.ts +35 -15
- package/dist/builtin/mcp/proxy-info-modes.ts +49 -19
- package/dist/builtin/mcp/proxy-modes.ts +3 -3
- package/dist/builtin/mcp/session-cleanup-barrier.ts +43 -0
- package/dist/builtin/mcp/state-lease.ts +12 -0
- package/dist/builtin/mcp/ui-server.ts +8 -8
- package/dist/builtin/mcp/ui-session.ts +9 -18
- package/dist/builtin/subagents/CHANGELOG.md +66 -0
- package/dist/builtin/subagents/README.md +30 -29
- 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/debugger.md +2 -2
- package/dist/builtin/subagents/agents/worker.md +2 -2
- package/dist/builtin/subagents/package.json +5 -5
- package/dist/builtin/subagents/prompts/review-loop.md +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +37 -36
- package/dist/builtin/subagents/src/extension/api-lifecycle.ts +64 -0
- package/dist/builtin/subagents/src/extension/fanout-child.ts +44 -51
- package/dist/builtin/subagents/src/extension/index.ts +287 -307
- package/dist/builtin/subagents/src/extension/prompt-guidance.ts +7 -10
- package/dist/builtin/subagents/src/extension/schemas.ts +22 -5
- package/dist/builtin/subagents/src/extension/tool-description.ts +29 -0
- package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +13 -2
- package/dist/builtin/subagents/src/intercom/result-intercom.ts +4 -4
- package/dist/builtin/subagents/src/runs/background/async-event-journal.ts +106 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-common.ts +3 -2
- package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +13 -2
- package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +3 -0
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +1 -1
- package/dist/builtin/subagents/src/runs/background/completion-claims.ts +189 -0
- package/dist/builtin/subagents/src/runs/background/completion-dedupe.ts +44 -7
- package/dist/builtin/subagents/src/runs/background/completion-notification.ts +34 -0
- package/dist/builtin/subagents/src/runs/background/notify.ts +72 -22
- package/dist/builtin/subagents/src/runs/background/result-delivery-processor.ts +232 -0
- package/dist/builtin/subagents/src/runs/background/result-file-claims.ts +151 -0
- package/dist/builtin/subagents/src/runs/background/result-quarantine.ts +72 -0
- package/dist/builtin/subagents/src/runs/background/result-retry-scheduler.ts +48 -0
- package/dist/builtin/subagents/src/runs/background/result-status.ts +81 -0
- package/dist/builtin/subagents/src/runs/background/result-watcher-data.ts +59 -0
- package/dist/builtin/subagents/src/runs/background/result-watcher.ts +172 -238
- package/dist/builtin/subagents/src/runs/background/run-id-resolver.ts +3 -2
- package/dist/builtin/subagents/src/runs/background/stale-run-reconciler.ts +73 -14
- package/dist/builtin/subagents/src/runs/background/subagent-runner-streaming.ts +17 -13
- package/dist/builtin/subagents/src/runs/background/top-level-async.ts +1 -2
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-dynamic-step.ts +1 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +1 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +1 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +7 -9
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-types.ts +3 -13
- package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +2 -15
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-finalize.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +53 -44
- package/dist/builtin/subagents/src/runs/foreground/execution-detach-reservations.ts +48 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-detach-route.ts +17 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +39 -26
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +3 -1
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-chain.ts +3 -51
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +6 -11
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-input.ts +11 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +5 -112
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-resume.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +68 -118
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +79 -7
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +3 -0
- package/dist/builtin/subagents/src/runs/shared/pi-args.ts +2 -2
- package/dist/builtin/subagents/src/runs/shared/pi-spawn.ts +27 -11
- package/dist/builtin/subagents/src/shared/artifacts.ts +22 -11
- package/dist/builtin/subagents/src/shared/event-jsonl-writer.ts +294 -0
- package/dist/builtin/subagents/src/shared/exclusive-file-publication.ts +44 -0
- package/dist/builtin/subagents/src/shared/jsonl-writer.ts +1 -0
- package/dist/builtin/subagents/src/shared/model-info.ts +2 -2
- package/dist/builtin/subagents/src/shared/settings.ts +20 -10
- package/dist/builtin/subagents/src/shared/types-async.ts +3 -1
- package/dist/builtin/subagents/src/shared/types-config.ts +2 -0
- package/dist/builtin/subagents/src/shared/types-runtime.ts +3 -2
- package/dist/builtin/subagents/src/slash/slash-commands.ts +9 -12
- package/dist/builtin/subagents/src/slash/slash-live-state.ts +63 -32
- package/dist/builtin/subagents/src/tui/render-result.ts +7 -0
- package/dist/builtin/subagents/src/tui/render-stable-output.ts +1 -0
- package/dist/builtin/subagents/src/tui/render-widget.ts +128 -89
- package/dist/builtin/web-access/CHANGELOG.md +28 -0
- package/dist/builtin/web-access/README.md +4 -0
- package/dist/builtin/web-access/content-tools.ts +8 -3
- package/dist/builtin/web-access/index-heavy.ts +1 -1
- package/dist/builtin/web-access/index.ts +190 -46
- package/dist/builtin/web-access/lifecycle-lease.ts +38 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/web-access/result-renderers.ts +1 -1
- package/dist/builtin/web-access/summary-review.ts +1 -1
- package/dist/builtin/web-access/web-search-activity.ts +1 -1
- package/dist/builtin/web-access/web-search-return.ts +7 -0
- package/dist/builtin/web-access/web-search-summary.ts +1 -1
- package/dist/builtin/web-access/web-search-tool.ts +4 -2
- package/dist/builtin/workflows/CHANGELOG.md +68 -0
- package/dist/builtin/workflows/README.md +4 -4
- package/dist/builtin/workflows/builtin/deep-research-codebase-utils.ts +27 -4
- package/dist/builtin/workflows/builtin/goal-runner.ts +47 -26
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +10 -0
- package/dist/builtin/workflows/builtin/ralph-core.ts +9 -9
- package/dist/builtin/workflows/builtin/ralph-models.ts +71 -36
- package/dist/builtin/workflows/builtin/ralph-runner.ts +20 -31
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/durable/stage-primitive.ts +2 -1
- package/dist/builtin/workflows/src/engine/primitives/task.ts +2 -1
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +17 -22
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +15 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-hil.ts +1 -2
- package/dist/builtin/workflows/src/runs/shared/model-fallback-candidates.ts +1 -1
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +2 -2
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +2 -2
- package/dist/builtin/workflows/src/shared/resume-continuation.ts +2 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +1 -23
- package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +54 -9
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +5 -2
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +2 -1
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +1 -1
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +1 -1
- package/dist/core/agent-session-prompt.js.map +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-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +3 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/anthropic-thinking-guard.d.ts +5 -5
- package/dist/core/anthropic-thinking-guard.d.ts.map +1 -1
- package/dist/core/anthropic-thinking-guard.js +42 -32
- package/dist/core/anthropic-thinking-guard.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +15 -15
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +14 -9
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +2 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +79 -46
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/context-assistant-turns.d.ts +42 -0
- package/dist/core/compaction/context-assistant-turns.d.ts.map +1 -0
- package/dist/core/compaction/context-assistant-turns.js +87 -0
- package/dist/core/compaction/context-assistant-turns.js.map +1 -0
- package/dist/core/compaction/context-compaction-critical.d.ts +1 -1
- package/dist/core/compaction/context-compaction-critical.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-critical.js +2 -2
- package/dist/core/compaction/context-compaction-critical.js.map +1 -1
- package/dist/core/compaction/context-compaction-eviction-alternates.d.ts +18 -0
- package/dist/core/compaction/context-compaction-eviction-alternates.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-eviction-alternates.js +186 -0
- package/dist/core/compaction/context-compaction-eviction-alternates.js.map +1 -0
- package/dist/core/compaction/context-compaction-eviction.d.ts +10 -2
- package/dist/core/compaction/context-compaction-eviction.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-eviction.js +196 -146
- package/dist/core/compaction/context-compaction-eviction.js.map +1 -1
- package/dist/core/compaction/context-compaction-prompt.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-prompt.js +1 -1
- package/dist/core/compaction/context-compaction-prompt.js.map +1 -1
- package/dist/core/compaction/context-compaction-types.d.ts +2 -0
- package/dist/core/compaction/context-compaction-types.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-types.js.map +1 -1
- package/dist/core/compaction/context-deletion-application.d.ts +5 -4
- package/dist/core/compaction/context-deletion-application.d.ts.map +1 -1
- package/dist/core/compaction/context-deletion-application.js +17 -15
- package/dist/core/compaction/context-deletion-application.js.map +1 -1
- package/dist/core/compaction/context-deletion-store.d.ts.map +1 -1
- package/dist/core/compaction/context-deletion-store.js +1 -1
- package/dist/core/compaction/context-deletion-store.js.map +1 -1
- package/dist/core/compaction/context-deletion-targets.d.ts +2 -1
- package/dist/core/compaction/context-deletion-targets.d.ts.map +1 -1
- package/dist/core/compaction/context-deletion-targets.js +36 -31
- package/dist/core/compaction/context-deletion-targets.js.map +1 -1
- package/dist/core/compaction/context-deletion-tool-helpers.d.ts.map +1 -1
- package/dist/core/compaction/context-deletion-tool-helpers.js +116 -43
- package/dist/core/compaction/context-deletion-tool-helpers.js.map +1 -1
- package/dist/core/compaction/context-transcript-analysis.d.ts +1 -2
- package/dist/core/compaction/context-transcript-analysis.d.ts.map +1 -1
- package/dist/core/compaction/context-transcript-analysis.js +33 -37
- package/dist/core/compaction/context-transcript-analysis.js.map +1 -1
- package/dist/core/copilot-model-synthesis.d.ts.map +1 -1
- package/dist/core/copilot-model-synthesis.js +3 -1
- package/dist/core/copilot-model-synthesis.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +2 -7
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/messages.d.ts +9 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +100 -18
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry-builtins.d.ts.map +1 -1
- package/dist/core/model-registry-builtins.js +5 -0
- package/dist/core/model-registry-builtins.js.map +1 -1
- package/dist/core/model-registry-custom-loader.d.ts.map +1 -1
- package/dist/core/model-registry-custom-loader.js +49 -8
- package/dist/core/model-registry-custom-loader.js.map +1 -1
- package/dist/core/model-registry-dynamic.d.ts.map +1 -1
- package/dist/core/model-registry-dynamic.js +11 -5
- package/dist/core/model-registry-dynamic.js.map +1 -1
- package/dist/core/model-registry-loader.d.ts.map +1 -1
- package/dist/core/model-registry-loader.js +8 -0
- package/dist/core/model-registry-loader.js.map +1 -1
- package/dist/core/model-registry-schemas.d.ts +93 -8
- package/dist/core/model-registry-schemas.d.ts.map +1 -1
- package/dist/core/model-registry-schemas.js +24 -12
- package/dist/core/model-registry-schemas.js.map +1 -1
- package/dist/core/model-registry-types.d.ts +7 -6
- package/dist/core/model-registry-types.d.ts.map +1 -1
- package/dist/core/model-registry-types.js.map +1 -1
- package/dist/core/model-registry.d.ts +5 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +23 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-cli.d.ts.map +1 -1
- package/dist/core/model-resolver-cli.js +33 -5
- package/dist/core/model-resolver-cli.js.map +1 -1
- package/dist/core/model-resolver-initial.d.ts +6 -1
- package/dist/core/model-resolver-initial.d.ts.map +1 -1
- package/dist/core/model-resolver-initial.js +12 -7
- package/dist/core/model-resolver-initial.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/resource-loader-context-files.d.ts +1 -0
- package/dist/core/resource-loader-context-files.d.ts.map +1 -1
- package/dist/core/resource-loader-context-files.js +13 -10
- package/dist/core/resource-loader-context-files.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +2 -2
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-entry-normalization.d.ts +7 -0
- package/dist/core/session-entry-normalization.d.ts.map +1 -0
- package/dist/core/session-entry-normalization.js +14 -0
- package/dist/core/session-entry-normalization.js.map +1 -0
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +1 -0
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-history.d.ts +2 -2
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +127 -108
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +2 -2
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-types.d.ts +1 -1
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +11 -8
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +1 -0
- package/dist/main-session.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-options.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-options.js +3 -1
- package/dist/modes/interactive/components/settings-selector-options.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +2 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +2 -1
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-child-ordering.d.ts +7 -0
- package/dist/modes/interactive/interactive-child-ordering.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-child-ordering.js +26 -0
- package/dist/modes/interactive/interactive-child-ordering.js.map +1 -0
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +2 -2
- package/dist/modes/interactive/interactive-deferred-startup.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-model-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +8 -3
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +2 -0
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +3 -0
- package/dist/utils/clipboard-image.js.map +1 -1
- package/docs/changelog.mdx +19 -0
- package/docs/compaction.md +55 -48
- package/docs/custom-provider.md +18 -5
- package/docs/extensions.md +7 -3
- package/docs/models.md +69 -10
- package/docs/providers.md +1 -1
- package/docs/quickstart.md +11 -7
- package/docs/rpc.md +2 -2
- package/docs/sdk.md +1 -1
- package/docs/settings.md +3 -3
- package/docs/subagents.md +36 -5
- package/docs/tools.md +1 -1
- package/docs/usage.md +4 -2
- package/docs/workflows.md +26 -43
- package/examples/extensions/preset.ts +2 -2
- package/examples/extensions/subagent/README.md +2 -2
- package/examples/extensions/subagent/index.ts +1 -2
- package/examples/extensions/subagent/schemas.ts +4 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/npm-shrinkwrap.json +48 -51
- package/package.json +7 -7
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-behavior.ts +0 -75
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-component.ts +0 -202
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-edit.ts +0 -97
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-editor.ts +0 -160
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-frame.ts +0 -72
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-modes.ts +0 -161
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-selectors.ts +0 -203
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-selectors.ts +0 -234
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-state.ts +0 -103
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-types.ts +0 -29
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +0 -9
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-clarify.ts +0 -117
|
@@ -102,6 +102,22 @@ export async function runSync(
|
|
|
102
102
|
}
|
|
103
103
|
if (options.artifactConfig?.includeJsonl !== false) jsonlPath = artifactPathsResult.jsonlPath;
|
|
104
104
|
}
|
|
105
|
+
const persistArtifacts = (value: SingleResult): void => {
|
|
106
|
+
if (!artifactPathsResult || options.artifactConfig?.enabled === false) return;
|
|
107
|
+
value.artifactPaths = artifactPathsResult;
|
|
108
|
+
if (options.artifactConfig?.includeOutput !== false) {
|
|
109
|
+
writeArtifact(artifactPathsResult.outputPath, artifactOutputByResult.get(value) ?? value.finalOutput ?? "");
|
|
110
|
+
}
|
|
111
|
+
if (options.artifactConfig?.includeMetadata !== false) {
|
|
112
|
+
writeMetadata(artifactPathsResult.metadataPath, {
|
|
113
|
+
runId: options.runId, agent: agentName, task, exitCode: value.exitCode,
|
|
114
|
+
usage: value.usage, model: value.model, fastMode: value.fastMode,
|
|
115
|
+
attemptedModels: value.attemptedModels, modelAttempts: value.modelAttempts,
|
|
116
|
+
durationMs: value.progressSummary?.durationMs, toolCount: value.progressSummary?.toolCount,
|
|
117
|
+
error: value.error, skills: value.skills, skillsWarning: value.skillsWarning, timestamp: Date.now(),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
105
121
|
|
|
106
122
|
let lastResult: SingleResult | undefined;
|
|
107
123
|
const modelsToTry = candidates.length > 0 ? candidates : (rawCandidates.length === 0 ? [undefined] : []);
|
|
@@ -109,11 +125,29 @@ export async function runSync(
|
|
|
109
125
|
const candidate = modelsToTry[i];
|
|
110
126
|
if (candidate) attemptedModels.push(candidate);
|
|
111
127
|
const outputSnapshot = captureSingleOutputSnapshot(options.outputPath);
|
|
112
|
-
|
|
128
|
+
const detachedExit = options.onDetachedExit;
|
|
129
|
+
let attemptOptions: RunSyncOptions = {
|
|
130
|
+
...options,
|
|
131
|
+
onDetachedExit: (recovered) => {
|
|
132
|
+
recovered.attemptedModels = attemptedModels.length > 0 ? [...attemptedModels] : undefined;
|
|
133
|
+
const recoveredModel = applyThinkingSuffix(candidate, agent.thinking) ?? recovered.model ?? agent.model ?? "default";
|
|
134
|
+
const completedAttempt: ModelAttempt = {
|
|
135
|
+
model: recoveredModel,
|
|
136
|
+
reasoningLevel: resolveEffectiveThinking(recoveredModel, agent.thinking),
|
|
137
|
+
success: recovered.exitCode === 0 && !recovered.error,
|
|
138
|
+
exitCode: recovered.exitCode,
|
|
139
|
+
error: recovered.error,
|
|
140
|
+
usage: { ...recovered.usage },
|
|
141
|
+
};
|
|
142
|
+
recovered.modelAttempts = [...modelAttempts.slice(0, -1), completedAttempt];
|
|
143
|
+
persistArtifacts(recovered);
|
|
144
|
+
detachedExit?.(recovered);
|
|
145
|
+
},
|
|
146
|
+
};
|
|
113
147
|
if (i < modelsToTry.length - 1 && options.onUpdate) {
|
|
114
148
|
const forwardUpdate = options.onUpdate;
|
|
115
149
|
attemptOptions = {
|
|
116
|
-
...
|
|
150
|
+
...attemptOptions,
|
|
117
151
|
onUpdate: (update) => {
|
|
118
152
|
if (shouldSuppressIntermediateRetryableFailureUpdate(update)) return;
|
|
119
153
|
forwardUpdate(update);
|
|
@@ -149,6 +183,7 @@ export async function runSync(
|
|
|
149
183
|
};
|
|
150
184
|
modelAttempts.push(attempt);
|
|
151
185
|
if (attemptSucceeded) break;
|
|
186
|
+
if (result.detached) break;
|
|
152
187
|
const retrySignal = modelFailureSignalByResult.get(result) ?? result.error;
|
|
153
188
|
if (isRetryableModelFailure(retrySignal) && i < modelsToTry.length - 1) {
|
|
154
189
|
pendingAttemptNotes.push(formatModelAttemptNote(attempt, modelsToTry[i + 1]));
|
|
@@ -182,30 +217,8 @@ export async function runSync(
|
|
|
182
217
|
if (result.progress.recentOutput.length > 50) result.progress.recentOutput.splice(50);
|
|
183
218
|
}
|
|
184
219
|
|
|
185
|
-
if (artifactPathsResult && options.artifactConfig?.enabled !== false) {
|
|
186
|
-
result
|
|
187
|
-
if (options.artifactConfig?.includeOutput !== false) {
|
|
188
|
-
writeArtifact(artifactPathsResult.outputPath, artifactOutputByResult.get(result) ?? result.finalOutput ?? "");
|
|
189
|
-
}
|
|
190
|
-
if (options.artifactConfig?.includeMetadata !== false) {
|
|
191
|
-
writeMetadata(artifactPathsResult.metadataPath, {
|
|
192
|
-
runId: options.runId,
|
|
193
|
-
agent: agentName,
|
|
194
|
-
task,
|
|
195
|
-
exitCode: result.exitCode,
|
|
196
|
-
usage: result.usage,
|
|
197
|
-
model: result.model,
|
|
198
|
-
fastMode: result.fastMode,
|
|
199
|
-
attemptedModels: result.attemptedModels,
|
|
200
|
-
modelAttempts: result.modelAttempts,
|
|
201
|
-
durationMs: result.progressSummary?.durationMs,
|
|
202
|
-
toolCount: result.progressSummary?.toolCount,
|
|
203
|
-
error: result.error,
|
|
204
|
-
skills: result.skills,
|
|
205
|
-
skillsWarning: result.skillsWarning,
|
|
206
|
-
timestamp: Date.now(),
|
|
207
|
-
});
|
|
208
|
-
}
|
|
220
|
+
if (artifactPathsResult && options.artifactConfig?.enabled !== false && !result.detached) {
|
|
221
|
+
persistArtifacts(result);
|
|
209
222
|
|
|
210
223
|
if (options.maxOutput) {
|
|
211
224
|
const config = { ...DEFAULT_MAX_OUTPUT, ...options.maxOutput };
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
resolveTopLevelParallelMaxTasks,
|
|
12
12
|
wrapForkTask,
|
|
13
13
|
} from "../../shared/types.ts";
|
|
14
|
-
import { type ChainStep } from "../../shared/settings.ts";
|
|
14
|
+
import { resolveSingleProgress, type ChainStep } from "../../shared/settings.ts";
|
|
15
15
|
import { normalizeSingleOutputOverride } from "../shared/single-output.ts";
|
|
16
16
|
import type { ExecutionContextData, ResolvedExecutorDeps } from "./subagent-executor-types.ts";
|
|
17
17
|
import { collectChainSessionFiles, wrapChainTasksForFork } from "./subagent-executor-input.ts";
|
|
@@ -178,6 +178,7 @@ export function runAsyncPath(data: ExecutionContextData, deps: ResolvedExecutorD
|
|
|
178
178
|
const skills = normalizedSkills === false ? [] : normalizedSkills;
|
|
179
179
|
const maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, a.maxSubagentDepth);
|
|
180
180
|
const modelOverride = resolveModelCandidate((params.model as string | undefined) ?? a.model, availableModels, currentProvider);
|
|
181
|
+
const progress = resolveSingleProgress(a, params.progress, params.task);
|
|
181
182
|
return deps.runtime.executeAsyncSingle(id, {
|
|
182
183
|
agent: params.agent!,
|
|
183
184
|
task: params.context === "fork" ? wrapForkTask(params.task ?? "") : (params.task ?? ""),
|
|
@@ -195,6 +196,7 @@ export function runAsyncPath(data: ExecutionContextData, deps: ResolvedExecutorD
|
|
|
195
196
|
skills,
|
|
196
197
|
output: effectiveOutput,
|
|
197
198
|
outputMode: effectiveOutputMode,
|
|
199
|
+
progress,
|
|
198
200
|
modelOverride,
|
|
199
201
|
maxSubagentDepth,
|
|
200
202
|
workflowStageSubagentGuard,
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { APP_NAME } from "@bastani/atomic";
|
|
3
1
|
import { executeChain } from "./chain-execution.ts";
|
|
4
|
-
import { currentModelFullId } from "../shared/model-fallback.ts";
|
|
5
|
-
import { toModelInfo } from "../../shared/model-info.ts";
|
|
6
2
|
import { normalizeSkillInput } from "../../agents/skills.ts";
|
|
7
3
|
import { updateForegroundNestedProjection } from "../shared/nested-events.ts";
|
|
8
4
|
import { resolveSubagentIntercomTarget } from "../../intercom/intercom-bridge.ts";
|
|
@@ -10,8 +6,8 @@ import { compactForegroundDetails } from "../../shared/utils.ts";
|
|
|
10
6
|
import { resolveSubagentDepthPolicy } from "../../shared/types.ts";
|
|
11
7
|
import type { ChainStep } from "../../shared/settings.ts";
|
|
12
8
|
import type { ExecutionContextData, ResolvedExecutorDeps } from "./subagent-executor-types.ts";
|
|
13
|
-
import {
|
|
14
|
-
import { createForegroundControlNotifier, maybeBuildForegroundIntercomReceipt, rememberForegroundRun } from "./subagent-executor-status.ts";
|
|
9
|
+
import { wrapChainTasksForFork } from "./subagent-executor-input.ts";
|
|
10
|
+
import { createForegroundControlNotifier, maybeBuildForegroundIntercomReceipt, rememberForegroundRun, replaceForegroundRunChild } from "./subagent-executor-status.ts";
|
|
15
11
|
|
|
16
12
|
export async function runChainPath(data: ExecutionContextData, deps: ResolvedExecutorDeps): Promise<import("../../shared/types.ts").SubagentToolResult> {
|
|
17
13
|
const {
|
|
@@ -27,7 +23,6 @@ export async function runChainPath(data: ExecutionContextData, deps: ResolvedExe
|
|
|
27
23
|
artifactsDir,
|
|
28
24
|
artifactConfig,
|
|
29
25
|
onUpdate,
|
|
30
|
-
sessionRoot,
|
|
31
26
|
controlConfig,
|
|
32
27
|
} = data;
|
|
33
28
|
const onControlEvent = createForegroundControlNotifier(data, deps);
|
|
@@ -54,7 +49,6 @@ export async function runChainPath(data: ExecutionContextData, deps: ResolvedExe
|
|
|
54
49
|
artifactsDir,
|
|
55
50
|
artifactConfig,
|
|
56
51
|
includeProgress: params.includeProgress,
|
|
57
|
-
clarify: params.clarify,
|
|
58
52
|
onUpdate,
|
|
59
53
|
onControlEvent,
|
|
60
54
|
controlConfig,
|
|
@@ -70,51 +64,9 @@ export async function runChainPath(data: ExecutionContextData, deps: ResolvedExe
|
|
|
70
64
|
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
71
65
|
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
72
66
|
runSync: deps.runtime.runSync,
|
|
67
|
+
onDetachedExit: (index, result) => replaceForegroundRunChild(deps.state, runId, index, result),
|
|
73
68
|
});
|
|
74
69
|
|
|
75
|
-
if (chainResult.requestedAsync) {
|
|
76
|
-
if (!deps.runtime.isAsyncAvailable()) {
|
|
77
|
-
return {
|
|
78
|
-
content: [{ type: "text", text: `Background mode requires upstream jiti for TypeScript execution but it could not be found. Ensure the ${APP_NAME}-subagents package dependencies are installed.` }],
|
|
79
|
-
isError: true,
|
|
80
|
-
details: { mode: "chain" as const, results: [] },
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
const id = randomUUID();
|
|
84
|
-
const asyncCtx = {
|
|
85
|
-
pi: deps.pi,
|
|
86
|
-
cwd: ctx.cwd,
|
|
87
|
-
currentSessionId: deps.state.currentSessionId!,
|
|
88
|
-
currentModelProvider: ctx.model?.provider,
|
|
89
|
-
currentModel: currentModelFullId(ctx.model),
|
|
90
|
-
};
|
|
91
|
-
const asyncChain = wrapChainTasksForFork(chainResult.requestedAsync.chain, params.context);
|
|
92
|
-
return deps.runtime.executeAsyncChain(id, {
|
|
93
|
-
chain: asyncChain,
|
|
94
|
-
task: params.task,
|
|
95
|
-
agents,
|
|
96
|
-
ctx: asyncCtx,
|
|
97
|
-
availableModels: ctx.modelRegistry.getAvailable().map(toModelInfo),
|
|
98
|
-
cwd: effectiveCwd,
|
|
99
|
-
maxOutput: params.maxOutput,
|
|
100
|
-
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
101
|
-
artifactConfig,
|
|
102
|
-
shareEnabled,
|
|
103
|
-
sessionRoot,
|
|
104
|
-
chainSkills: chainResult.requestedAsync.chainSkills,
|
|
105
|
-
sessionFilesByFlatIndex: collectChainSessionFiles(asyncChain, sessionFileForIndex),
|
|
106
|
-
dynamicFanoutMaxItems: deps.config.chain?.dynamicFanout?.maxItems,
|
|
107
|
-
maxSubagentDepth: currentMaxSubagentDepth,
|
|
108
|
-
workflowStageSubagentGuard,
|
|
109
|
-
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
110
|
-
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
111
|
-
controlConfig,
|
|
112
|
-
controlIntercomTarget: data.intercomBridge.active ? data.intercomBridge.orchestratorTarget : undefined,
|
|
113
|
-
childIntercomTarget: data.intercomBridge.active ? (agent, index) => resolveSubagentIntercomTarget(id, agent, index) : undefined,
|
|
114
|
-
nestedRoute: data.nestedRoute,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
70
|
const chainDetails = chainResult.details ? compactForegroundDetails({ ...chainResult.details, runId }) : undefined;
|
|
119
71
|
if (foregroundControl) updateForegroundNestedProjection(foregroundControl);
|
|
120
72
|
if (chainDetails) rememberForegroundRun(deps.state, { runId, mode: "chain", cwd: effectiveCwd, results: chainDetails.results });
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
type ArtifactConfig,
|
|
30
30
|
type SubagentToolResult,
|
|
31
31
|
} from "../../shared/types.ts";
|
|
32
|
-
import { isParallelStep as isSettingsParallelStep, type SequentialStep } from "../../shared/settings.ts";
|
|
32
|
+
import { buildReadInstruction, isParallelStep as isSettingsParallelStep, type SequentialStep } from "../../shared/settings.ts";
|
|
33
33
|
import type { ExecutionContextBuildResult, ExecutorDeps, ResolvedExecutorDeps, SubagentParamsLike } from "./subagent-executor-types.ts";
|
|
34
34
|
import {
|
|
35
35
|
applyAgentDefaultContext,
|
|
@@ -100,20 +100,18 @@ export function prepareExecutionContext(input: {
|
|
|
100
100
|
const hasChain = (effectiveParams.chain?.length ?? 0) > 0;
|
|
101
101
|
const hasTasks = (effectiveParams.tasks?.length ?? 0) > 0;
|
|
102
102
|
const hasSingle = !hasChain && !hasTasks && Boolean(effectiveParams.agent);
|
|
103
|
-
const allowClarifyTaskPrompt = hasChain
|
|
104
|
-
&& effectiveParams.clarify === true
|
|
105
|
-
&& ctx.hasUI
|
|
106
|
-
&& !(effectiveParams.chain?.some(isSettingsParallelStep) ?? false);
|
|
107
|
-
|
|
108
103
|
const validationError = validateExecutionInput(
|
|
109
104
|
effectiveParams,
|
|
110
105
|
agents,
|
|
111
106
|
hasChain,
|
|
112
107
|
hasTasks,
|
|
113
108
|
hasSingle,
|
|
114
|
-
allowClarifyTaskPrompt,
|
|
115
109
|
);
|
|
116
110
|
if (validationError) return { error: validationError };
|
|
111
|
+
if (hasSingle) {
|
|
112
|
+
const readInstruction = buildReadInstruction(effectiveParams.reads, effectiveCwd);
|
|
113
|
+
if (readInstruction) effectiveParams = { ...effectiveParams, task: `${readInstruction}\n\n${effectiveParams.task ?? ""}` };
|
|
114
|
+
}
|
|
117
115
|
|
|
118
116
|
let sessionFileForIndex: (idx?: number) => string | undefined = () => undefined;
|
|
119
117
|
try {
|
|
@@ -121,9 +119,7 @@ export function prepareExecutionContext(input: {
|
|
|
121
119
|
} catch (error) {
|
|
122
120
|
return { error: toExecutionErrorResult(effectiveParams, error) };
|
|
123
121
|
}
|
|
124
|
-
const
|
|
125
|
-
const backgroundRequestedWhileClarifying = (hasChain || hasTasks) && requestedAsync && effectiveParams.clarify === true;
|
|
126
|
-
const effectiveAsync = requestedAsync && effectiveParams.clarify !== true;
|
|
122
|
+
const effectiveAsync = effectiveParams.async ?? deps.asyncByDefault;
|
|
127
123
|
const controlConfig = resolveControlConfig(deps.config.control, effectiveParams.control);
|
|
128
124
|
|
|
129
125
|
const artifactConfig: ArtifactConfig = {
|
|
@@ -175,7 +171,6 @@ export function prepareExecutionContext(input: {
|
|
|
175
171
|
sessionFileForIndex: childSessionFileForIndex,
|
|
176
172
|
artifactConfig,
|
|
177
173
|
artifactsDir,
|
|
178
|
-
backgroundRequestedWhileClarifying,
|
|
179
174
|
effectiveAsync,
|
|
180
175
|
controlConfig,
|
|
181
176
|
intercomBridge,
|
|
@@ -9,7 +9,6 @@ export function validateExecutionInput(
|
|
|
9
9
|
hasChain: boolean,
|
|
10
10
|
hasTasks: boolean,
|
|
11
11
|
hasSingle: boolean,
|
|
12
|
-
allowClarifyTaskPrompt: boolean,
|
|
13
12
|
): SubagentToolResult | null {
|
|
14
13
|
if (Number(hasChain) + Number(hasTasks) + Number(hasSingle) !== 1) {
|
|
15
14
|
return {
|
|
@@ -23,6 +22,16 @@ export function validateExecutionInput(
|
|
|
23
22
|
details: { mode: "single" as const, results: [] },
|
|
24
23
|
};
|
|
25
24
|
}
|
|
25
|
+
if (hasSingle) {
|
|
26
|
+
const reads = (params as SubagentParamsLike & { reads?: unknown }).reads;
|
|
27
|
+
if (reads !== undefined && reads !== false && (!Array.isArray(reads) || reads.some((entry) => typeof entry !== "string"))) {
|
|
28
|
+
return {
|
|
29
|
+
content: [{ type: "text", text: "reads must be an array of file path strings or false" }],
|
|
30
|
+
isError: true,
|
|
31
|
+
details: { mode: "single", results: [] },
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
26
35
|
|
|
27
36
|
if (hasSingle && params.agent && !agents.find((agent) => agent.name === params.agent)) {
|
|
28
37
|
return {
|
|
@@ -69,7 +78,7 @@ export function validateExecutionInput(
|
|
|
69
78
|
isError: true,
|
|
70
79
|
details: { mode: "chain" as const, results: [] },
|
|
71
80
|
};
|
|
72
|
-
} else if (!(firstStep as SequentialStep).task && !params.task
|
|
81
|
+
} else if (!(firstStep as SequentialStep).task && !params.task) {
|
|
73
82
|
return {
|
|
74
83
|
content: [{ type: "text", text: "First step in chain must have a task" }],
|
|
75
84
|
isError: true,
|
|
@@ -51,6 +51,7 @@ interface ForegroundParallelRunInput {
|
|
|
51
51
|
liveResults: (SingleResult | undefined)[];
|
|
52
52
|
liveProgress: (AgentProgress | undefined)[];
|
|
53
53
|
onUpdate?: (r: SubagentToolResult) => void;
|
|
54
|
+
onDetachedExit?: (index: number, result: SingleResult) => void;
|
|
54
55
|
worktreeSetup?: WorktreeSetup;
|
|
55
56
|
runtime: Pick<SubagentExecutorRuntimeDeps, "runSync">;
|
|
56
57
|
}
|
|
@@ -108,6 +109,7 @@ export async function runForegroundParallelTasks(input: ForegroundParallelRunInp
|
|
|
108
109
|
onControlEvent: input.onControlEvent,
|
|
109
110
|
intercomSessionName: input.childIntercomTarget?.(task.agent, index),
|
|
110
111
|
orchestratorIntercomTarget: input.orchestratorIntercomTarget,
|
|
112
|
+
onDetachedExit: (result) => input.onDetachedExit?.(index, result),
|
|
111
113
|
nestedRoute: input.foregroundControl?.nestedRoute,
|
|
112
114
|
modelOverride: input.modelOverrides[index],
|
|
113
115
|
availableModels: input.availableModels,
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { APP_NAME } from "@bastani/atomic";
|
|
3
|
-
import { ChainClarifyComponent, type ChainClarifyResult } from "./chain-clarify.ts";
|
|
4
|
-
import { currentModelFullId, resolveModelCandidate } from "../shared/model-fallback.ts";
|
|
1
|
+
import { resolveModelCandidate } from "../shared/model-fallback.ts";
|
|
5
2
|
import { collectKnownModelProviders, toModelInfo, type ModelInfo } from "../../shared/model-info.ts";
|
|
6
|
-
import {
|
|
3
|
+
import { normalizeSkillInput } from "../../agents/skills.ts";
|
|
7
4
|
import { aggregateParallelOutputs } from "../shared/parallel-utils.ts";
|
|
8
5
|
import { recordRun } from "../shared/run-history.ts";
|
|
9
6
|
import {
|
|
10
7
|
resolveStepBehavior,
|
|
11
8
|
suppressProgressForReadOnlyTask,
|
|
12
|
-
taskDisallowsFileUpdates,
|
|
13
9
|
type StepOverrides,
|
|
14
10
|
} from "../../shared/settings.ts";
|
|
15
11
|
import {
|
|
@@ -46,7 +42,7 @@ import {
|
|
|
46
42
|
findDuplicateParallelOutputPath,
|
|
47
43
|
resolveParallelTaskCwd,
|
|
48
44
|
} from "./subagent-executor-worktree.ts";
|
|
49
|
-
import { createForegroundControlNotifier, maybeBuildForegroundIntercomReceipt, rememberForegroundRun } from "./subagent-executor-status.ts";
|
|
45
|
+
import { createForegroundControlNotifier, maybeBuildForegroundIntercomReceipt, rememberForegroundRun, replaceForegroundRunChild } from "./subagent-executor-status.ts";
|
|
50
46
|
|
|
51
47
|
export async function runParallelPath(data: ExecutionContextData, deps: ResolvedExecutorDeps): Promise<SubagentToolResult> {
|
|
52
48
|
const {
|
|
@@ -61,9 +57,7 @@ export async function runParallelPath(data: ExecutionContextData, deps: Resolved
|
|
|
61
57
|
shareEnabled,
|
|
62
58
|
artifactConfig,
|
|
63
59
|
artifactsDir,
|
|
64
|
-
backgroundRequestedWhileClarifying,
|
|
65
60
|
onUpdate,
|
|
66
|
-
sessionRoot,
|
|
67
61
|
controlConfig,
|
|
68
62
|
} = data;
|
|
69
63
|
const onControlEvent = createForegroundControlNotifier(data, deps);
|
|
@@ -125,107 +119,6 @@ export async function runParallelPath(data: ExecutionContextData, deps: Resolved
|
|
|
125
119
|
resolveModelCandidate(behaviorOverrides[i]?.model ?? agentConfigs[i]?.model, availableModels, currentProvider),
|
|
126
120
|
);
|
|
127
121
|
|
|
128
|
-
if (params.clarify === true && ctx.hasUI) {
|
|
129
|
-
const behaviors = agentConfigs.map((c, i) =>
|
|
130
|
-
resolveStepBehavior(c, behaviorOverrides[i]!),
|
|
131
|
-
);
|
|
132
|
-
const availableSkills = discoverAvailableSkills(effectiveCwd);
|
|
133
|
-
|
|
134
|
-
const result = await ctx.ui.custom<ChainClarifyResult>(
|
|
135
|
-
(tui, theme, _kb, done) =>
|
|
136
|
-
new ChainClarifyComponent(
|
|
137
|
-
tui, theme,
|
|
138
|
-
agentConfigs,
|
|
139
|
-
taskTexts,
|
|
140
|
-
"",
|
|
141
|
-
undefined,
|
|
142
|
-
behaviors,
|
|
143
|
-
availableModels,
|
|
144
|
-
currentProvider,
|
|
145
|
-
availableSkills,
|
|
146
|
-
done,
|
|
147
|
-
"parallel",
|
|
148
|
-
),
|
|
149
|
-
{ overlay: true, overlayOptions: { anchor: "center", width: 84, maxHeight: "80%" } },
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
if (!result || !result.confirmed) {
|
|
153
|
-
return { content: [{ type: "text", text: "Cancelled" }], details: { mode: "parallel", results: [] } };
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
taskTexts = result.templates;
|
|
157
|
-
for (let i = 0; i < result.behaviorOverrides.length; i++) {
|
|
158
|
-
const override = result.behaviorOverrides[i];
|
|
159
|
-
if (override?.model) {
|
|
160
|
-
modelOverrides[i] = override.model;
|
|
161
|
-
behaviorOverrides[i]!.model = override.model;
|
|
162
|
-
}
|
|
163
|
-
if (override?.output !== undefined) behaviorOverrides[i]!.output = override.output;
|
|
164
|
-
if (override?.reads !== undefined) behaviorOverrides[i]!.reads = override.reads;
|
|
165
|
-
if (override?.progress !== undefined) behaviorOverrides[i]!.progress = override.progress;
|
|
166
|
-
if (override?.skills !== undefined) {
|
|
167
|
-
skillOverrides[i] = override.skills;
|
|
168
|
-
behaviorOverrides[i]!.skills = override.skills;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (result.runInBackground) {
|
|
173
|
-
if (!deps.runtime.isAsyncAvailable()) {
|
|
174
|
-
return {
|
|
175
|
-
content: [{ type: "text", text: `Background mode requires upstream jiti for TypeScript execution but it could not be found. Ensure the ${APP_NAME}-subagents package dependencies are installed.` }],
|
|
176
|
-
isError: true,
|
|
177
|
-
details: { mode: "parallel" as const, results: [] },
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
const id = randomUUID();
|
|
181
|
-
const asyncCtx = {
|
|
182
|
-
pi: deps.pi,
|
|
183
|
-
cwd: ctx.cwd,
|
|
184
|
-
currentSessionId: deps.state.currentSessionId!,
|
|
185
|
-
currentModelProvider: ctx.model?.provider,
|
|
186
|
-
currentModel: currentModelFullId(ctx.model),
|
|
187
|
-
};
|
|
188
|
-
const parallelTasks = tasks.map((t, i) => {
|
|
189
|
-
const taskText = params.context === "fork" ? wrapForkTask(taskTexts[i]!) : taskTexts[i]!;
|
|
190
|
-
const progress = taskDisallowsFileUpdates(taskText) ? false : behaviorOverrides[i]?.progress;
|
|
191
|
-
return {
|
|
192
|
-
agent: t.agent,
|
|
193
|
-
task: taskText,
|
|
194
|
-
cwd: t.cwd,
|
|
195
|
-
...(modelOverrides[i] ? { model: modelOverrides[i] } : {}),
|
|
196
|
-
...(skillOverrides[i] !== undefined ? { skill: skillOverrides[i] } : {}),
|
|
197
|
-
...(behaviorOverrides[i]?.output !== undefined ? { output: behaviorOverrides[i]!.output } : {}),
|
|
198
|
-
...(behaviorOverrides[i]?.outputMode !== undefined ? { outputMode: behaviorOverrides[i]!.outputMode } : {}),
|
|
199
|
-
...(behaviorOverrides[i]?.reads !== undefined ? { reads: behaviorOverrides[i]!.reads } : {}),
|
|
200
|
-
...(progress !== undefined ? { progress } : {}),
|
|
201
|
-
};
|
|
202
|
-
});
|
|
203
|
-
return deps.runtime.executeAsyncChain(id, {
|
|
204
|
-
chain: [{ parallel: parallelTasks, concurrency: parallelConcurrency, worktree: params.worktree }],
|
|
205
|
-
resultMode: "parallel",
|
|
206
|
-
agents,
|
|
207
|
-
ctx: asyncCtx,
|
|
208
|
-
availableModels,
|
|
209
|
-
knownModelProviders,
|
|
210
|
-
cwd: effectiveCwd,
|
|
211
|
-
maxOutput: params.maxOutput,
|
|
212
|
-
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
213
|
-
artifactConfig,
|
|
214
|
-
shareEnabled,
|
|
215
|
-
sessionRoot,
|
|
216
|
-
chainSkills: [],
|
|
217
|
-
sessionFilesByFlatIndex: tasks.map((_, index) => sessionFileForIndex(index)),
|
|
218
|
-
maxSubagentDepth: currentMaxSubagentDepth,
|
|
219
|
-
workflowStageSubagentGuard,
|
|
220
|
-
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
221
|
-
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
222
|
-
controlConfig,
|
|
223
|
-
controlIntercomTarget: data.intercomBridge.active ? data.intercomBridge.orchestratorTarget : undefined,
|
|
224
|
-
childIntercomTarget: data.intercomBridge.active ? (agent, index) => resolveSubagentIntercomTarget(id, agent, index) : undefined,
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
122
|
const behaviors = agentConfigs.map((config, index) => suppressProgressForReadOnlyTask(resolveStepBehavior(config, behaviorOverrides[index]!), taskTexts[index]));
|
|
230
123
|
const firstProgressIndex = behaviors.findIndex((behavior) => behavior.progress);
|
|
231
124
|
const liveResults: (SingleResult | undefined)[] = new Array(tasks.length).fill(undefined);
|
|
@@ -267,6 +160,7 @@ export async function runParallelPath(data: ExecutionContextData, deps: Resolved
|
|
|
267
160
|
}
|
|
268
161
|
|
|
269
162
|
const results = await runForegroundParallelTasks({
|
|
163
|
+
onDetachedExit: (index, result) => replaceForegroundRunChild(deps.state, runId, index, result),
|
|
270
164
|
tasks,
|
|
271
165
|
taskTexts,
|
|
272
166
|
agents,
|
|
@@ -352,7 +246,6 @@ export async function runParallelPath(data: ExecutionContextData, deps: Resolved
|
|
|
352
246
|
|
|
353
247
|
const worktreeSuffix = buildParallelWorktreeSuffix(worktreeSetup, artifactsDir, tasks as TaskParam[]);
|
|
354
248
|
const ok = results.filter((result) => result.exitCode === 0).length;
|
|
355
|
-
const downgradeNote = backgroundRequestedWhileClarifying ? " (background requested, but clarify kept this run foreground)" : "";
|
|
356
249
|
const aggregatedOutput = aggregateParallelOutputs(
|
|
357
250
|
results.map((result) => ({
|
|
358
251
|
agent: result.agent,
|
|
@@ -363,7 +256,7 @@ export async function runParallelPath(data: ExecutionContextData, deps: Resolved
|
|
|
363
256
|
(i, agent) => `=== Task ${i + 1}: ${agent} ===`,
|
|
364
257
|
);
|
|
365
258
|
|
|
366
|
-
const summary = `${ok}/${results.length} succeeded
|
|
259
|
+
const summary = `${ok}/${results.length} succeeded`;
|
|
367
260
|
const fullContent = worktreeSuffix
|
|
368
261
|
? `${summary}\n\n${aggregatedOutput}\n\n${worktreeSuffix}`
|
|
369
262
|
: `${summary}\n\n${aggregatedOutput}`;
|
|
@@ -7,6 +7,7 @@ import { readStatus } from "../../shared/utils.ts";
|
|
|
7
7
|
import { buildRevivedAsyncTask, resolveAsyncResumeTarget } from "../background/async-resume.ts";
|
|
8
8
|
import { resolveSubagentRunId, type ResolvedSubagentRunId } from "../background/run-id-resolver.ts";
|
|
9
9
|
import { toModelInfo } from "../../shared/model-info.ts";
|
|
10
|
+
import { resolveSingleProgress } from "../../shared/settings.ts";
|
|
10
11
|
import {
|
|
11
12
|
createNestedRoute,
|
|
12
13
|
readNestedControlResults,
|
|
@@ -419,6 +420,7 @@ export async function resumeAsyncRun(input: {
|
|
|
419
420
|
agent: target.agent,
|
|
420
421
|
task: buildRevivedAsyncTask(target, followUp),
|
|
421
422
|
agentConfig,
|
|
423
|
+
progress: resolveSingleProgress(agentConfig, input.params.progress, followUp),
|
|
422
424
|
ctx: {
|
|
423
425
|
pi: input.deps.pi,
|
|
424
426
|
cwd: input.requestCwd,
|