@selesai/code 0.8.12 → 0.9.0
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 +14 -0
- package/dist/core/agent-session.js +41 -29
- package/dist/core/resource-loader.d.ts +1 -1
- package/dist/core/resource-loader.js +2 -2
- package/dist/defaults/models.json +15 -3
- package/dist/defaults/settings.json +10 -8
- package/dist/extensions/model-prompt-injector/config.json +6 -0
- package/dist/extensions/package.json +2 -1
- package/dist/extensions/pi-subagents/README.md +4 -4
- package/dist/extensions/pi-subagents/docs/configuration.md +3 -54
- package/dist/extensions/pi-subagents/docs/extension-api.md +4 -15
- package/dist/extensions/pi-subagents/docs/missions.md +2 -39
- package/dist/extensions/pi-subagents/docs/observability.md +2 -42
- package/dist/extensions/pi-subagents/docs/tool-reference.md +1 -2
- package/dist/extensions/pi-subagents/docs/watchdog.md +0 -57
- package/dist/extensions/pi-subagents/docs/workflows.md +2 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +4 -49
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +1 -2
- package/dist/extensions/pi-subagents/src/extension/config.ts +3 -15
- package/dist/extensions/pi-subagents/src/extension/index.ts +1 -53
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +4 -10
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +1 -2
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +1 -12
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +1 -2
- package/dist/extensions/pi-subagents/src/policy/authority.ts +0 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +33 -102
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +0 -2
- package/dist/extensions/pi-subagents/src/shared/types.ts +1 -1
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +4 -58
- package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +2 -8
- package/dist/extensions/pi-subagents/src/watchdog/tool-actions.ts +1 -2
- package/dist/extensions/pi-subagents/src/workflows/workflow-auto-relaunch.ts +16 -3
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +0 -95
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +0 -15
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +0 -59
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +0 -59
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +0 -47
- package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +0 -1
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +5 -5
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +0 -8
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/workflow-auto-relaunch.test.ts +21 -1
- package/dist/modes/interactive/components/model-selector.d.ts +10 -1
- package/dist/modes/interactive/components/model-selector.js +10 -6
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.js +3 -0
- package/dist/modes/interactive/interactive-mode.js +7 -0
- package/dist/skills/pi-subagents/references/constraints-and-recipes.md +1 -1
- package/dist/skills/pi-subagents/references/execution-controls.md +2 -32
- package/dist/skills/pi-subagents/references/management-authoring-rpc.md +1 -1
- package/dist/skills/pi-subagents/references/prompting-and-roles.md +3 -3
- package/docs/custom-provider.md +1 -0
- package/package.json +3 -3
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +0 -803
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +0 -691
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +0 -1314
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/cli.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/register-bedrock.d.ts +0 -2
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/restore-sandbox-env.d.ts +0 -17
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/args.d.ts +0 -57
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/config-selector.d.ts +0 -16
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/file-processor.d.ts +0 -15
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/initial-message.d.ts +0 -18
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/list-models.d.ts +0 -9
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/project-trust.d.ts +0 -10
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/session-picker.d.ts +0 -10
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/startup-ui.d.ts +0 -20
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/config.d.ts +0 -96
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-runtime.d.ts +0 -119
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-services.d.ts +0 -85
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session.d.ts +0 -620
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-guidance.d.ts +0 -5
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-storage.d.ts +0 -56
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/bash-executor.d.ts +0 -32
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/cache-stats.d.ts +0 -49
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/branch-summarization.d.ts +0 -93
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/compaction.d.ts +0 -128
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/index.d.ts +0 -7
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/utils.d.ts +0 -38
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/defaults.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/diagnostics.d.ts +0 -15
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/event-bus.d.ts +0 -9
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/exec.d.ts +0 -29
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/experimental.d.ts +0 -2
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/ansi-to-html.d.ts +0 -22
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/index.d.ts +0 -37
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/tool-renderer.d.ts +0 -34
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/index.d.ts +0 -12
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/loader.d.ts +0 -23
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/runner.d.ts +0 -171
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/types.d.ts +0 -1263
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/wrapper.d.ts +0 -20
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/footer-data-provider.d.ts +0 -54
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/http-dispatcher.d.ts +0 -22
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/index.d.ts +0 -13
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/keybindings.d.ts +0 -358
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/messages.d.ts +0 -77
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-config.d.ts +0 -512
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-registry.d.ts +0 -43
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-resolver.d.ts +0 -121
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-runtime.d.ts +0 -82
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/models-store.d.ts +0 -17
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/output-guard.d.ts +0 -7
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/package-manager.d.ts +0 -210
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/project-trust.d.ts +0 -15
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/prompt-templates.d.ts +0 -54
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-attribution.d.ts +0 -4
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-composer.d.ts +0 -55
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/radius.d.ts +0 -2
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/remote-catalog-provider.d.ts +0 -5
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resolve-config-value.d.ts +0 -30
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resource-loader.d.ts +0 -206
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/runtime-credentials.d.ts +0 -15
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/sdk.d.ts +0 -106
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-cwd.d.ts +0 -19
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-manager.d.ts +0 -356
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/settings-manager.d.ts +0 -297
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/skills.d.ts +0 -60
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/slash-commands.d.ts +0 -15
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/source-info.d.ts +0 -18
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/system-prompt.d.ts +0 -28
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/telemetry.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/timings.d.ts +0 -10
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/bash.d.ts +0 -68
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit-diff.d.ts +0 -106
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit.d.ts +0 -51
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/file-mutation-queue.d.ts +0 -6
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/find.d.ts +0 -35
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/grep.d.ts +0 -37
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/index.d.ts +0 -40
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/ls.d.ts +0 -37
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/output-accumulator.d.ts +0 -52
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/path-utils.d.ts +0 -10
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/read.d.ts +0 -35
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/render-utils.d.ts +0 -24
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/tool-definition-wrapper.d.ts +0 -14
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/truncate.d.ts +0 -70
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/write.d.ts +0 -26
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/trust-manager.d.ts +0 -36
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/usage-totals.d.ts +0 -19
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/index.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/client.d.ts +0 -61
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/huggingface.d.ts +0 -23
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/index.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/provider.d.ts +0 -10
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/ui.d.ts +0 -42
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/index.d.ts +0 -35
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/main.d.ts +0 -12
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/migrations.d.ts +0 -33
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/index.d.ts +0 -9
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/armin.d.ts +0 -34
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/assistant-message.d.ts +0 -22
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bash-execution.d.ts +0 -34
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/config-selector.d.ts +0 -102
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-editor.d.ts +0 -21
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-entry.d.ts +0 -19
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-message.d.ts +0 -20
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/daxnuts.d.ts +0 -23
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/diff.d.ts +0 -12
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-editor.d.ts +0 -22
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-input.d.ts +0 -23
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-selector.d.ts +0 -26
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/first-time-setup.d.ts +0 -25
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/footer.d.ts +0 -32
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/index.d.ts +0 -34
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/keybinding-hints.d.ts +0 -13
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/login-dialog.d.ts +0 -52
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/model-selector.d.ts +0 -54
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/oauth-selector.d.ts +0 -33
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -42
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector.d.ts +0 -95
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/settings-selector.d.ts +0 -77
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/status-indicator.d.ts +0 -28
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/theme-selector.d.ts +0 -11
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/thinking-selector.d.ts +0 -11
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tool-execution.d.ts +0 -63
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tree-selector.d.ts +0 -94
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/trust-selector.d.ts +0 -23
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message.d.ts +0 -14
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/interactive-mode.d.ts +0 -394
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/model-search.d.ts +0 -12
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme-controller.d.ts +0 -29
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme.d.ts +0 -120
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/print-mode.d.ts +0 -28
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/jsonl.d.ts +0 -17
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-client.d.ts +0 -246
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-mode.d.ts +0 -20
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-types.d.ts +0 -457
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/package-manager-cli.d.ts +0 -8
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/rpc-entry.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/ansi.d.ts +0 -2
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/changelog.d.ts +0 -22
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/child-process.d.ts +0 -18
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-image.d.ts +0 -11
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-native.d.ts +0 -11
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard.d.ts +0 -4
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/deprecation.d.ts +0 -4
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/exif-orientation.d.ts +0 -5
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/frontmatter.d.ts +0 -8
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/fs-watch.d.ts +0 -5
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/git.d.ts +0 -26
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/html.d.ts +0 -7
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-convert.d.ts +0 -10
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-process.d.ts +0 -18
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-core.d.ts +0 -30
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-worker.d.ts +0 -2
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize.d.ts +0 -16
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/json.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/mime.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/open-browser.d.ts +0 -9
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/paths.d.ts +0 -31
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/photon.d.ts +0 -21
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/pi-user-agent.d.ts +0 -2
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/shell.d.ts +0 -31
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/sleep.d.ts +0 -5
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/syntax-highlight.d.ts +0 -12
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/tools-manager.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/version-check.d.ts +0 -15
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/windows-self-update.d.ts +0 -3
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +0 -1004
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +0 -1511
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +0 -634
- package/dist/extensions/pi-subagents/test/unit/scheduled-store-root.test.ts +0 -67
|
@@ -26,8 +26,6 @@ import { buildDoctorReport } from "../../extension/doctor.ts";
|
|
|
26
26
|
import { readSubagentGuide } from "../../extension/subagent-guide.ts";
|
|
27
27
|
import { normalizePublicSubagentExecution } from "../../extension/public-execution.ts";
|
|
28
28
|
import { runSync } from "./execution.ts";
|
|
29
|
-
import { handleWatchdogToolAction, WATCHDOG_TOOL_ACTIONS } from "../../watchdog/tool-actions.ts";
|
|
30
|
-
import type { MainWatchdogRuntime } from "../../watchdog/runtime.ts";
|
|
31
29
|
import { buildModelCandidates, normalizeParentModel, resolveEffectiveSubagentModel, resolveModelCandidate, type ParentModel } from "../shared/model-fallback.ts";
|
|
32
30
|
import { formatRetainedChildren, listRetainedChildren } from "../background/retained-children.ts";
|
|
33
31
|
import type { ModelScopeConfig } from "../shared/model-scope.ts";
|
|
@@ -56,7 +54,6 @@ import { discoverAvailableSkills, normalizeSkillInput } from "../../agents/skill
|
|
|
56
54
|
import { buildAsyncRunnerSteps, DEFAULT_ASYNC_TIMEOUT_MS, executeAsyncChain, executeAsyncSingle, formatAsyncStartedMessage, isAsyncAvailable, workflowAwaitedAsyncResultPath } from "../background/async-execution.ts";
|
|
57
55
|
import { updateActiveRunIndex } from "../background/active-run-index.ts";
|
|
58
56
|
import { acquireActiveAsyncCapacity, ActiveAsyncCapacityError, getActiveAsyncCapacitySnapshot, resolveMaxActiveAsyncRunsPerSession, transferActiveAsyncCapacity, type ActiveAsyncCapacityHandle } from "../background/active-async-capacity.ts";
|
|
59
|
-
import { isScheduledRunAction, type ScheduledRunAction } from "../background/scheduled-runs.ts";
|
|
60
57
|
import { enqueueChainAppendRequest, readPendingChainAppendRequests, runnerStepOutputNames } from "../background/chain-append.ts";
|
|
61
58
|
import { ChainOutputValidationError, validateChainOutputBindingsWithContext } from "../shared/chain-outputs.ts";
|
|
62
59
|
import { normalizeGateAcceptance, validateExecutionAcceptance } from "../shared/acceptance.ts";
|
|
@@ -173,8 +170,8 @@ import {
|
|
|
173
170
|
wrapForkTask,
|
|
174
171
|
} from "../../shared/types.ts";
|
|
175
172
|
|
|
176
|
-
const MUTATING_MANAGEMENT_ACTIONS = new Set(["create", "update", "delete", "eject", "disable", "enable", "reset", "grant-spawn-budget", "
|
|
177
|
-
const DESTRUCTIVE_MANAGEMENT_ACTIONS = new Set(["delete", "eject", "disable", "reset", "mission.close", "worktree.discard", "refine.rollback", "inspector.close", "project.close", "stop", "interrupt", "reject-checkpoint"
|
|
173
|
+
const MUTATING_MANAGEMENT_ACTIONS = new Set(["create", "update", "delete", "eject", "disable", "enable", "reset", "grant-spawn-budget", "mission.create", "mission.update", "mission.resolve-decision", "mission.attach-run", "mission.close", "inspector.open", "inspector.close", "project.open", "project.close", "worktree.discard", "refine", "refine.rollback", "dismiss"]);
|
|
174
|
+
const DESTRUCTIVE_MANAGEMENT_ACTIONS = new Set(["delete", "eject", "disable", "reset", "mission.close", "worktree.discard", "refine.rollback", "inspector.close", "project.close", "stop", "interrupt", "reject-checkpoint"]);
|
|
178
175
|
|
|
179
176
|
function editDistance(left: string, right: string): number {
|
|
180
177
|
const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
|
|
@@ -374,8 +371,6 @@ interface ExecutorDeps {
|
|
|
374
371
|
config: ExtensionConfig;
|
|
375
372
|
asyncByDefault: boolean;
|
|
376
373
|
waitToolEnabled?: boolean;
|
|
377
|
-
handleScheduledRunAction?: (params: SubagentParamsLike, ctx: ExtensionContext) => Promise<AgentToolResult<Details>>;
|
|
378
|
-
watchdog?: MainWatchdogRuntime;
|
|
379
374
|
tempArtifactsDir: string;
|
|
380
375
|
getSubagentSessionRoot: (parentSessionFile: string | null) => string;
|
|
381
376
|
expandTilde: (p: string) => string;
|
|
@@ -4759,36 +4754,6 @@ function workflowChatProgressUpdate(
|
|
|
4759
4754
|
};
|
|
4760
4755
|
}
|
|
4761
4756
|
|
|
4762
|
-
function createScheduledOwnerState(source: SubagentState, ownerSessionId: string, ctx: ExtensionContext): SubagentState {
|
|
4763
|
-
const ownerSpawns = source.subagentSpawns?.sessionId === ownerSessionId
|
|
4764
|
-
? {
|
|
4765
|
-
...source.subagentSpawns,
|
|
4766
|
-
grantHistory: [...(source.subagentSpawns.grantHistory ?? [])],
|
|
4767
|
-
}
|
|
4768
|
-
: undefined;
|
|
4769
|
-
return {
|
|
4770
|
-
...source,
|
|
4771
|
-
baseCwd: ctx.cwd,
|
|
4772
|
-
currentSessionId: ownerSessionId,
|
|
4773
|
-
parentSessionFile: ctx.sessionManager.getSessionFile() ?? null,
|
|
4774
|
-
subagentInProgress: false,
|
|
4775
|
-
...(ownerSpawns ? { subagentSpawns: ownerSpawns } : { subagentSpawns: undefined }),
|
|
4776
|
-
asyncJobs: new Map(),
|
|
4777
|
-
fleetJobs: new Map(),
|
|
4778
|
-
foregroundRuns: new Map(),
|
|
4779
|
-
foregroundControls: new Map(),
|
|
4780
|
-
lastForegroundControlId: null,
|
|
4781
|
-
cleanupTimers: new Map(),
|
|
4782
|
-
lastUiContext: null,
|
|
4783
|
-
poller: null,
|
|
4784
|
-
completionSeen: new Map(),
|
|
4785
|
-
watcher: null,
|
|
4786
|
-
watcherRestartTimer: null,
|
|
4787
|
-
waitSubscriptions: new Map(),
|
|
4788
|
-
workflowControllers: new Map(),
|
|
4789
|
-
};
|
|
4790
|
-
}
|
|
4791
|
-
|
|
4792
4757
|
export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
4793
4758
|
execute: (
|
|
4794
4759
|
id: string,
|
|
@@ -4817,19 +4782,11 @@ export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
4817
4782
|
onUpdate: ((r: AgentToolResult<Details>) => void) | undefined,
|
|
4818
4783
|
ctx: ExtensionContext,
|
|
4819
4784
|
) => Promise<AgentToolResult<Details>>;
|
|
4820
|
-
/** Scheduled launches retain their owning context without replacing the live active session. */
|
|
4821
|
-
executeScheduled: (
|
|
4822
|
-
id: string,
|
|
4823
|
-
params: SubagentParamsLike,
|
|
4824
|
-
signal: AbortSignal,
|
|
4825
|
-
ctx: ExtensionContext,
|
|
4826
|
-
) => Promise<AgentToolResult<Details>>;
|
|
4827
4785
|
} {
|
|
4828
4786
|
const delegatedThinkingOverrides = new WeakMap<object, AgentConfig["thinking"]>();
|
|
4829
4787
|
const delegatedZeroToolBudgets = new WeakSet<object>();
|
|
4830
4788
|
const delegatedExecutions = new WeakSet<object>();
|
|
4831
4789
|
const warnedArtifactPackageDirs = new Set<string>();
|
|
4832
|
-
const scheduledOwnerExecutors = new Map<string, ReturnType<typeof createSubagentExecutor>>();
|
|
4833
4790
|
const execute = async (
|
|
4834
4791
|
_id: string,
|
|
4835
4792
|
params: SubagentParamsLike,
|
|
@@ -5123,23 +5080,34 @@ export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
5123
5080
|
const autoRelaunchCap = resolveMaxWorkflowAutoRelaunches(deps.config.maxWorkflowAutoRelaunches);
|
|
5124
5081
|
let relaunched = 0;
|
|
5125
5082
|
let capReached = false;
|
|
5083
|
+
let stallReason: "fanout-limited" | "usage-budget" | "no-progress" | undefined;
|
|
5126
5084
|
let workflow: Awaited<ReturnType<typeof runWorkflowScript>> | undefined;
|
|
5085
|
+
let roundProgress = { launched: 0, fanoutRejected: 0, usageBudgetBlocked: 0, stateWrites: 0 };
|
|
5127
5086
|
while (true) {
|
|
5128
5087
|
if (relaunched > 0) {
|
|
5129
5088
|
workflowFanoutBudget = createRunFanoutBudget(`${workflowRunId}#${relaunched + 1}`, workflowFanoutBudget.limit);
|
|
5130
|
-
|
|
5089
|
+
workflowSteps.clear();
|
|
5090
|
+
projectedTraceLength = 0;
|
|
5091
|
+
projectedTraceTail = undefined;
|
|
5092
|
+
status = { ...status, steps: [], currentStep: undefined, workflow: { trace: [], emits: [], console: [] } };
|
|
5131
5093
|
}
|
|
5094
|
+
roundProgress = { launched: 0, fanoutRejected: 0, usageBudgetBlocked: 0, stateWrites: 0 };
|
|
5132
5095
|
workflow = await runWorkflowScript({
|
|
5133
5096
|
script: workflowScript,
|
|
5134
5097
|
timeoutMs: timeout,
|
|
5135
5098
|
signal: controller.signal,
|
|
5136
5099
|
prompts: workflowPrompts,
|
|
5137
|
-
...(workflowState ? { state: workflowState } : {}),
|
|
5100
|
+
...(workflowState ? { state: { get: (key: string) => workflowState.get(key), set: (key: string, value: unknown) => { roundProgress.stateWrites += 1; workflowState.set(key, value); } } } : {}),
|
|
5138
5101
|
onTrace: updateTrace,
|
|
5139
5102
|
admit: (calls) => {
|
|
5140
5103
|
const outputClaims = workflowChildOutputClaims({ ctxCwd: ctx.cwd, workflowCwd, artifactsDir: workflowArtifactsDir, workflowRunId, aggregateOutputPath: workflowAggregateOutputPath, configuredOutputBaseDir, discoverAgents: deps.discoverAgents, workflowAgentScope: workflowChildDefaults.agentScope, claimedOutputPaths, entries: calls });
|
|
5141
5104
|
if (outputClaims.error) throw new Error(outputClaims.error);
|
|
5142
|
-
|
|
5105
|
+
try {
|
|
5106
|
+
status.runFanoutBudget = claimRunFanoutBatch(workflowFanoutBudget, calls.map(({ key }) => `workflow[${key}]`));
|
|
5107
|
+
} catch (error) {
|
|
5108
|
+
if (error instanceof RunFanoutLimitError) roundProgress.fanoutRejected += calls.length;
|
|
5109
|
+
throw error;
|
|
5110
|
+
}
|
|
5143
5111
|
if (outputClaims.claims) applyWorkflowChildOutputClaims(claimedOutputPaths, outputClaims.claims);
|
|
5144
5112
|
persist();
|
|
5145
5113
|
},
|
|
@@ -5152,7 +5120,11 @@ export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
5152
5120
|
launch: async (key, childParams, workflowSignal, admission) => {
|
|
5153
5121
|
if (workflowUsageBudget.budget && childParams.async === true) return workflowChildResult(key, buildRequestedModeError(childParams as SubagentParamsLike, "workflow usageBudget does not support async runs.run launches."));
|
|
5154
5122
|
const budgetState = usageBudgetState(workflowUsageBudget.budget, sumResultsCost(workflowResults));
|
|
5155
|
-
if (budgetState?.exhausted)
|
|
5123
|
+
if (budgetState?.exhausted) {
|
|
5124
|
+
roundProgress.usageBudgetBlocked += 1;
|
|
5125
|
+
return workflowChildResult(key, buildRequestedModeError(childParams as SubagentParamsLike, usageBudgetExceededMessage(budgetState)));
|
|
5126
|
+
}
|
|
5127
|
+
roundProgress.launched += 1;
|
|
5156
5128
|
const childPhase = typeof childParams.phase === "string" && childParams.phase.trim() ? childParams.phase.trim() : undefined;
|
|
5157
5129
|
const childLabel = typeof childParams.label === "string" && childParams.label.trim() ? childParams.label.trim() : undefined;
|
|
5158
5130
|
recordMissionWorkflowChild(missionBinding, workflowRunId, key, {
|
|
@@ -5231,9 +5203,10 @@ export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
5231
5203
|
},
|
|
5232
5204
|
status: async (keyOrRunId, workflowSignal) => workflowChildResult(keyOrRunId, await execute(randomUUID(), { action: "status", id: keyOrRunId }, workflowSignal, undefined, ctx, preserveActiveSession)),
|
|
5233
5205
|
});
|
|
5234
|
-
const decision = resolveAutoRelaunchDecision(workflow?.value, relaunched, autoRelaunchCap);
|
|
5206
|
+
const decision = resolveAutoRelaunchDecision(workflow?.value, relaunched, autoRelaunchCap, roundProgress);
|
|
5235
5207
|
if (!decision.relaunch) {
|
|
5236
5208
|
capReached = decision.capped;
|
|
5209
|
+
stallReason = decision.stallReason;
|
|
5237
5210
|
break;
|
|
5238
5211
|
}
|
|
5239
5212
|
relaunched += 1;
|
|
@@ -5247,8 +5220,14 @@ export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
5247
5220
|
const relaunchNote = relaunched > 0 ? `Auto-relaunched ${relaunched} time(s) with a fresh fan-out budget. ` : "";
|
|
5248
5221
|
const summary = `${relaunchNote}Workflow completed with ${workflow.children.length} child run(s). Return: ${returnPreview}${emitPreview} Trace: ${workflow.trace.length} event(s).`;
|
|
5249
5222
|
const workflowUsage = sumResultsUsage(workflowResults);
|
|
5250
|
-
if (capReached) {
|
|
5251
|
-
const relaunchCapError =
|
|
5223
|
+
if (capReached || stallReason) {
|
|
5224
|
+
const relaunchCapError = stallReason === "usage-budget"
|
|
5225
|
+
? "Workflow auto-relaunch stopped because the usage budget is exhausted; a fresh fan-out budget cannot make another child run."
|
|
5226
|
+
: stallReason === "fanout-limited"
|
|
5227
|
+
? `Workflow auto-relaunch stopped because the fan-out budget rejected ${roundProgress.fanoutRejected} child launch(es) and the fresh budget has the same limit.`
|
|
5228
|
+
: stallReason === "no-progress"
|
|
5229
|
+
? "Workflow auto-relaunch stopped because the budget result made no progress: no child launched and no workflow state changed."
|
|
5230
|
+
: `Workflow auto-relaunch cap reached after ${relaunched} relaunch(es); the goal is not clean yet. The progress file is current; raise config.maxWorkflowAutoRelaunches or relaunch manually.`;
|
|
5252
5231
|
status = compactOptional<AsyncStatus>({ ...status, state: "failed", error: relaunchCapError, endedAt: Date.now(), workflow: { value: workflow.value, trace: workflow.trace, emits: workflow.emits, console: workflow.console } });
|
|
5253
5232
|
const outputWarning = writeWorkflowAggregateOutput(workflowAggregateOutputPath, relaunchCapError);
|
|
5254
5233
|
const resultSummary = appendWorkflowOutputWarning(relaunchCapError, outputWarning);
|
|
@@ -5485,7 +5464,7 @@ export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
5485
5464
|
...(currentSessionId ? { currentSessionId } : {}),
|
|
5486
5465
|
});
|
|
5487
5466
|
}
|
|
5488
|
-
const policyAction = action === "stop" ? "stopRun" : action === "steer" ? "steerRun" :
|
|
5467
|
+
const policyAction = action === "stop" ? "stopRun" : action === "steer" ? "steerRun" : undefined;
|
|
5489
5468
|
if (policyAction) {
|
|
5490
5469
|
const decision = resolveAuthorityDecision({ action: policyAction, ...(deps.config.authorityPolicy === undefined ? {} : { policy: deps.config.authorityPolicy }) });
|
|
5491
5470
|
if (decision === "forbid") {
|
|
@@ -5497,16 +5476,6 @@ export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
5497
5476
|
if (!confirmed) return { content: [{ type: "text", text: `Action '${action}' canceled; authority was not granted.` }], details: { mode: "management", results: [] } };
|
|
5498
5477
|
}
|
|
5499
5478
|
}
|
|
5500
|
-
if ((WATCHDOG_TOOL_ACTIONS as readonly string[]).includes(action)) {
|
|
5501
|
-
if (deps.allowMutatingManagementActions === false && MUTATING_MANAGEMENT_ACTIONS.has(action)) {
|
|
5502
|
-
return {
|
|
5503
|
-
content: [{ type: "text", text: `Action '${action}' is not available from child-safe subagent fanout mode.` }],
|
|
5504
|
-
isError: true,
|
|
5505
|
-
details: { mode: "management" as const, results: [] },
|
|
5506
|
-
};
|
|
5507
|
-
}
|
|
5508
|
-
return handleWatchdogToolAction(action, paramsWithResolvedCwd, ctx, deps.watchdog);
|
|
5509
|
-
}
|
|
5510
5479
|
if (action === "refine" || action === "refine.show" || action === "refine.rollback") {
|
|
5511
5480
|
if (deps.allowMutatingManagementActions === false && MUTATING_MANAGEMENT_ACTIONS.has(action)) {
|
|
5512
5481
|
return {
|
|
@@ -5875,26 +5844,6 @@ export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
5875
5844
|
if (action === "append-step") {
|
|
5876
5845
|
return appendStepToAsyncChain(omitUndefinedProperties({ params: paramsWithResolvedCwd, requestCwd, ctx, deps, parentModel: requestParentModel }));
|
|
5877
5846
|
}
|
|
5878
|
-
if (action.startsWith("schedule.")) {
|
|
5879
|
-
if (!isScheduledRunAction(action)) {
|
|
5880
|
-
return { content: [{ type: "text", text: unknownSubagentActionMessage(action) }], isError: true, details: { mode: "management", results: [] } };
|
|
5881
|
-
}
|
|
5882
|
-
if (deps.allowMutatingManagementActions === false && MUTATING_MANAGEMENT_ACTIONS.has(action)) {
|
|
5883
|
-
return {
|
|
5884
|
-
content: [{ type: "text", text: `Action '${action}' is not available from child-safe subagent fanout mode.` }],
|
|
5885
|
-
isError: true,
|
|
5886
|
-
details: { mode: "management", results: [] },
|
|
5887
|
-
};
|
|
5888
|
-
}
|
|
5889
|
-
if (!deps.handleScheduledRunAction) {
|
|
5890
|
-
return {
|
|
5891
|
-
content: [{ type: "text", text: `Action '${action}' is not available in this subagent context.` }],
|
|
5892
|
-
isError: true,
|
|
5893
|
-
details: { mode: "management", results: [] },
|
|
5894
|
-
};
|
|
5895
|
-
}
|
|
5896
|
-
return deps.handleScheduledRunAction(paramsWithResolvedCwd, ctx);
|
|
5897
|
-
}
|
|
5898
5847
|
if (deps.allowMutatingManagementActions === false && MUTATING_MANAGEMENT_ACTIONS.has(action)) {
|
|
5899
5848
|
return {
|
|
5900
5849
|
content: [{ type: "text", text: `Action '${action}' is not available from child-safe subagent fanout mode.` }],
|
|
@@ -6660,23 +6609,5 @@ export function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
6660
6609
|
return execute(id, delegatedParams, signal, onUpdate, ctx);
|
|
6661
6610
|
};
|
|
6662
6611
|
|
|
6663
|
-
|
|
6664
|
-
id: string,
|
|
6665
|
-
params: SubagentParamsLike,
|
|
6666
|
-
signal: AbortSignal,
|
|
6667
|
-
ctx: ExtensionContext,
|
|
6668
|
-
) => {
|
|
6669
|
-
const ownerSessionId = resolveCurrentSessionId(ctx.sessionManager);
|
|
6670
|
-
let ownerExecutor = scheduledOwnerExecutors.get(ownerSessionId);
|
|
6671
|
-
if (!ownerExecutor) {
|
|
6672
|
-
ownerExecutor = createSubagentExecutor({
|
|
6673
|
-
...deps,
|
|
6674
|
-
state: createScheduledOwnerState(deps.state, ownerSessionId, ctx),
|
|
6675
|
-
});
|
|
6676
|
-
scheduledOwnerExecutors.set(ownerSessionId, ownerExecutor);
|
|
6677
|
-
}
|
|
6678
|
-
return ownerExecutor.execute(id, params, signal, undefined, ctx);
|
|
6679
|
-
};
|
|
6680
|
-
|
|
6681
|
-
return { execute: executeWithSingleDispatchGuard, executePublic, executeDelegated, executeScheduled };
|
|
6612
|
+
return { execute: executeWithSingleDispatchGuard, executePublic, executeDelegated };
|
|
6682
6613
|
}
|
|
@@ -19,7 +19,6 @@ import { TOOL_BUDGET_ENV, TOOL_BUDGET_ZERO_AUTH_ENV, decodeToolBudgetEnv, should
|
|
|
19
19
|
import type { JsonSchemaObject, ResolvedToolBudget, SubagentState } from "../../shared/types.ts";
|
|
20
20
|
import { resolveCurrentSessionId } from "../../shared/session-identity.ts";
|
|
21
21
|
import { resolveWatchPath } from "../../shared/utils.ts";
|
|
22
|
-
import { registerChildWatchdog } from "../../watchdog/register-child.ts";
|
|
23
22
|
import { CHILD_WATCHDOG_CONFIG_ENV } from "../../watchdog/child-status.ts";
|
|
24
23
|
import { requestWatchdogPermission, type WatchdogPermissionRequest, type WatchdogPermissionResult } from "../../watchdog/permission-arbiter.ts";
|
|
25
24
|
import { SUBAGENT_WATCHDOG_WARNING_TYPE } from "../../watchdog/types.ts";
|
|
@@ -562,7 +561,6 @@ export default function registerSubagentPromptRuntime(pi: ExtensionAPI): void {
|
|
|
562
561
|
registerSteeringInbox(pi);
|
|
563
562
|
registerPermissionGate(pi);
|
|
564
563
|
registerToolBudget(pi, decodeToolBudgetEnv(process.env[TOOL_BUDGET_ENV], { allowZero: process.env[TOOL_BUDGET_ZERO_AUTH_ENV] === "1" }));
|
|
565
|
-
registerChildWatchdog(pi);
|
|
566
564
|
const waitToolEnabled = resolveWaitToolConfig().enabled;
|
|
567
565
|
const waitState = {
|
|
568
566
|
baseCwd: "",
|
|
@@ -2106,7 +2106,7 @@ export const SLASH_SUBAGENT_CANCEL_EVENT = "subagent:slash:cancel";
|
|
|
2106
2106
|
export const POLL_INTERVAL_MS = 250;
|
|
2107
2107
|
export const MAX_WIDGET_JOBS = 4;
|
|
2108
2108
|
export const DEFAULT_SUBAGENT_MAX_DEPTH = 2;
|
|
2109
|
-
export const SUBAGENT_ACTIONS = ["list", "get", "models", "children.list", "guide", "create", "update", "delete", "eject", "disable", "enable", "reset", "mission.create", "mission.list", "mission.show", "mission.update", "mission.resolve-decision", "mission.attach-run", "mission.close", "worktree.discard", "refine", "refine.show", "refine.rollback", "inspector.open", "inspector.status", "inspector.close", "project.open", "project.status", "project.close", "status", "debug.run", "grant-spawn-budget", "interrupt", "resume", "steer", "stop", "dismiss", "append-step", "approve-checkpoint", "reject-checkpoint", "doctor", "watchdog.status", "watchdog.check"
|
|
2109
|
+
export const SUBAGENT_ACTIONS = ["list", "get", "models", "children.list", "guide", "create", "update", "delete", "eject", "disable", "enable", "reset", "mission.create", "mission.list", "mission.show", "mission.update", "mission.resolve-decision", "mission.attach-run", "mission.close", "worktree.discard", "refine", "refine.show", "refine.rollback", "inspector.open", "inspector.status", "inspector.close", "project.open", "project.status", "project.close", "status", "debug.run", "grant-spawn-budget", "interrupt", "resume", "steer", "stop", "dismiss", "append-step", "approve-checkpoint", "reject-checkpoint", "doctor", "watchdog.status", "watchdog.check"] as const;
|
|
2110
2110
|
|
|
2111
2111
|
export const DEFAULT_FORK_PREAMBLE =
|
|
2112
2112
|
"You are a delegated subagent running from a fork of the parent session. " +
|
|
@@ -19,13 +19,11 @@ import type { SubagentParamsLike } from "../runs/foreground/subagent-executor.ts
|
|
|
19
19
|
import { findModelInfo, toModelInfo } from "../shared/model-info.ts";
|
|
20
20
|
import { formatTokens, shortenPath } from "../shared/formatters.ts";
|
|
21
21
|
import { listAsyncRuns, formatAsyncRunProgressLabel, type AsyncRunSummary } from "../runs/background/async-status.ts";
|
|
22
|
-
import { listScheduledRunSummaries } from "../runs/background/scheduled-runs.ts";
|
|
23
22
|
import { SUBAGENT_FANOUT_CHILD_ENV } from "../runs/shared/pi-args.ts";
|
|
24
23
|
import type { SlashSubagentResponse, SlashSubagentUpdate } from "./slash-bridge.ts";
|
|
25
24
|
import { registerPromptWorkflowCommands } from "./prompt-workflows.ts";
|
|
26
25
|
import { openSubagentsAdmin } from "./subagents-admin.ts";
|
|
27
26
|
import { SUBAGENT_GUIDE_TOPICS } from "../extension/subagent-guide.ts";
|
|
28
|
-
import { openSubagentFleet } from "../tui/fleet.ts";
|
|
29
27
|
import {
|
|
30
28
|
applySlashUpdate,
|
|
31
29
|
buildSlashInitialResult,
|
|
@@ -154,7 +152,7 @@ async function withSlashStatus<T>(
|
|
|
154
152
|
type Theme = ExtensionContext["ui"]["theme"];
|
|
155
153
|
|
|
156
154
|
type StopSelectorTarget = {
|
|
157
|
-
kind: "async"
|
|
155
|
+
kind: "async";
|
|
158
156
|
id: string;
|
|
159
157
|
label: string;
|
|
160
158
|
detail: string;
|
|
@@ -164,9 +162,7 @@ type StopSelectorTarget = {
|
|
|
164
162
|
type StopSelectorResult = { confirmed: boolean; target?: StopSelectorTarget };
|
|
165
163
|
|
|
166
164
|
function commandForTarget(target: StopSelectorTarget): string {
|
|
167
|
-
return
|
|
168
|
-
? `subagent({ action: "schedule.pause", id: ${JSON.stringify(target.id)} })`
|
|
169
|
-
: `subagent({ action: "stop", id: ${JSON.stringify(target.id)} })`;
|
|
165
|
+
return `subagent({ action: "stop", id: ${JSON.stringify(target.id)} })`;
|
|
170
166
|
}
|
|
171
167
|
|
|
172
168
|
function formatAsyncStopTarget(run: AsyncRunSummary): StopSelectorTarget {
|
|
@@ -181,30 +177,13 @@ function formatAsyncStopTarget(run: AsyncRunSummary): StopSelectorTarget {
|
|
|
181
177
|
};
|
|
182
178
|
}
|
|
183
179
|
|
|
184
|
-
function scheduledStopTargets(ctx: ExtensionContext, _state: SubagentState): StopSelectorTarget[] {
|
|
185
|
-
try {
|
|
186
|
-
return listScheduledRunSummaries(ctx.cwd)
|
|
187
|
-
.filter((schedule) => !schedule.paused && !schedule.activeRunId && schedule.trigger.nextRunAt)
|
|
188
|
-
.sort((left, right) => left.trigger.nextRunAt!.localeCompare(right.trigger.nextRunAt!))
|
|
189
|
-
.map((schedule) => ({
|
|
190
|
-
kind: "scheduled" as const,
|
|
191
|
-
id: schedule.id,
|
|
192
|
-
label: `${schedule.id} · ${schedule.name}`,
|
|
193
|
-
detail: `scheduled · ${schedule.trigger.nextRunAt}`,
|
|
194
|
-
actionLabel: "pause schedule",
|
|
195
|
-
}));
|
|
196
|
-
} catch {
|
|
197
|
-
return [];
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
180
|
function discoverStopTargets(ctx: ExtensionContext, state: SubagentState): StopSelectorTarget[] {
|
|
202
181
|
const sessionId = state.currentSessionId ?? ctx.sessionManager.getSessionId() ?? undefined;
|
|
203
182
|
const asyncTargets = listAsyncRuns(DIRS.async, {
|
|
204
183
|
states: ["queued", "running"],
|
|
205
184
|
...(sessionId ? { sessionId } : {}),
|
|
206
185
|
}).map(formatAsyncStopTarget);
|
|
207
|
-
return
|
|
186
|
+
return asyncTargets;
|
|
208
187
|
}
|
|
209
188
|
|
|
210
189
|
function stopFallbackText(targets: StopSelectorTarget[]): string {
|
|
@@ -294,7 +273,7 @@ class SubagentsStopSelector implements Component {
|
|
|
294
273
|
const selected = index === this.selected;
|
|
295
274
|
const marker = selected ? "›" : " ";
|
|
296
275
|
const actionLabel = target.actionLabel;
|
|
297
|
-
const action =
|
|
276
|
+
const action = this.theme.fg("accent", actionLabel);
|
|
298
277
|
const labelWidth = Math.max(0, contentWidth - marker.length - actionLabel.length - 2);
|
|
299
278
|
lines.push(`${marker} ${action} ${target.label.slice(0, labelWidth)}`);
|
|
300
279
|
if (selected) lines.push(this.theme.fg("dim", ` ${target.detail}`.slice(0, contentWidth)));
|
|
@@ -635,25 +614,6 @@ export function registerSlashCommands(
|
|
|
635
614
|
options: { fleetKeybindings?: FleetKeybindingsConfig; foregroundDetachShortcut?: string } = {},
|
|
636
615
|
): void {
|
|
637
616
|
registerInlineSubagentInvocation(pi, state);
|
|
638
|
-
let fleetOpen = false;
|
|
639
|
-
const showFleet = async (ctx: ExtensionContext) => {
|
|
640
|
-
state.lastUiContext = ctx;
|
|
641
|
-
if (!ctx.hasUI) {
|
|
642
|
-
await runSlashSubagent(pi, ctx, { action: "status", view: "fleet" });
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
if (fleetOpen) {
|
|
646
|
-
ctx.ui.notify("Subagent fleet inspector is already open.", "info");
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
fleetOpen = true;
|
|
650
|
-
try {
|
|
651
|
-
await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings });
|
|
652
|
-
} finally {
|
|
653
|
-
fleetOpen = false;
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
|
|
657
617
|
pi.registerCommand("subagents", {
|
|
658
618
|
description: "Administer subagents: inspect metadata and update models, thinking, or prompts",
|
|
659
619
|
handler: async (args, ctx) => {
|
|
@@ -733,16 +693,6 @@ export function registerSlashCommands(
|
|
|
733
693
|
},
|
|
734
694
|
});
|
|
735
695
|
|
|
736
|
-
pi.registerCommand("subagents-fleet", {
|
|
737
|
-
description: "Open the live subagent fleet inspector",
|
|
738
|
-
handler: async (_args, ctx) => showFleet(ctx),
|
|
739
|
-
});
|
|
740
|
-
|
|
741
|
-
pi.registerShortcut(Key.ctrlAlt("f"), {
|
|
742
|
-
description: "Open subagent fleet inspector",
|
|
743
|
-
handler: async (ctx) => showFleet(ctx),
|
|
744
|
-
});
|
|
745
|
-
|
|
746
696
|
const detachForegroundRun = (args: string, ctx: ExtensionContext): void => {
|
|
747
697
|
const id = args.trim();
|
|
748
698
|
let control: ReturnType<typeof selectForegroundDetachControl>;
|
|
@@ -815,10 +765,6 @@ export function registerSlashCommands(
|
|
|
815
765
|
{ overlay: true, overlayOptions: { anchor: "center", width: 88, maxHeight: "80%" } },
|
|
816
766
|
);
|
|
817
767
|
if (!result?.confirmed || !result.target) return;
|
|
818
|
-
if (result.target.kind === "scheduled") {
|
|
819
|
-
await runSlashSubagent(pi, ctx, { action: "schedule.pause", id: result.target.id });
|
|
820
|
-
return;
|
|
821
|
-
}
|
|
822
768
|
await runSlashSubagent(pi, ctx, { action: "stop", id: result.target.id });
|
|
823
769
|
},
|
|
824
770
|
});
|
|
@@ -141,13 +141,7 @@ export function buildWatchdogStatus(snapshot: ReturnType<MainWatchdogRuntime["ge
|
|
|
141
141
|
"Sources:",
|
|
142
142
|
...snapshot.sources.map(sourceLine),
|
|
143
143
|
"",
|
|
144
|
-
"Model
|
|
145
|
-
"- /subagents-watchdog recommend-model",
|
|
146
|
-
"- /subagents-watchdog model recommended",
|
|
147
|
-
"- /subagents-watchdog model <provider/model[:thinking]>",
|
|
148
|
-
"- /subagents-watchdog model inherit",
|
|
149
|
-
"- /subagents-watchdog session model recommended",
|
|
150
|
-
"Agent action: subagent({ action: \"watchdog.configure\", model: \"recommended\", scope: \"session\" })",
|
|
144
|
+
"Model configuration is managed through Selesai settings.",
|
|
151
145
|
);
|
|
152
146
|
return lines.join("\n");
|
|
153
147
|
}
|
|
@@ -371,7 +365,7 @@ async function handleWatchdogCommand(
|
|
|
371
365
|
pi.sendMessage(createWatchdogWarningMessage(details, { display: true, details }));
|
|
372
366
|
return;
|
|
373
367
|
}
|
|
374
|
-
ctx.ui.notify(`Usage: /subagents-watchdog [status|on|off|session on|session off|
|
|
368
|
+
ctx.ui.notify(`Usage: /subagents-watchdog [status|on|off|session on|session off|check|test concern <text>|test blocker <text>]`, "error");
|
|
375
369
|
}
|
|
376
370
|
|
|
377
371
|
export function registerMainWatchdog(pi: ExtensionAPI, options: RegisterMainWatchdogOptions = {}): MainWatchdogRuntime {
|
|
@@ -114,7 +114,6 @@ export function handleWatchdogToolAction(action: string, params: WatchdogToolPar
|
|
|
114
114
|
if (!runtime) return result("Subagent watchdog runtime is unavailable.", true);
|
|
115
115
|
return result(buildWatchdogStatus(runtime.getSnapshot(ctx.cwd), ctx));
|
|
116
116
|
}
|
|
117
|
-
if (action === "watchdog.recommend-model") return result(buildRecommendationText(ctx));
|
|
118
117
|
if (action === "watchdog.check") return result(buildCheckText(runtime, ctx));
|
|
119
118
|
if (action !== "watchdog.configure") return result(`Unknown watchdog action: ${action}`, true);
|
|
120
119
|
|
|
@@ -151,5 +150,5 @@ export function handleWatchdogToolAction(action: string, params: WatchdogToolPar
|
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
export const WATCHDOG_TOOL_ACTIONS = ["watchdog.status", "watchdog.check"
|
|
153
|
+
export const WATCHDOG_TOOL_ACTIONS = ["watchdog.status", "watchdog.check"] as const;
|
|
155
154
|
export const WATCHDOG_THINKING_VALUES = ["inherit", ...THINKING_LEVELS] as const;
|
|
@@ -9,9 +9,17 @@
|
|
|
9
9
|
|
|
10
10
|
export const DEFAULT_MAX_WORKFLOW_AUTO_RELAUNCHES = 12;
|
|
11
11
|
|
|
12
|
+
export interface WorkflowRoundProgress {
|
|
13
|
+
launched: number;
|
|
14
|
+
fanoutRejected: number;
|
|
15
|
+
usageBudgetBlocked: number;
|
|
16
|
+
stateWrites: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
export interface AutoRelaunchDecision {
|
|
13
20
|
relaunch: boolean;
|
|
14
21
|
capped: boolean;
|
|
22
|
+
stallReason?: "fanout-limited" | "usage-budget" | "no-progress";
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
export function resolveMaxWorkflowAutoRelaunches(raw: unknown): number | undefined {
|
|
@@ -20,9 +28,14 @@ export function resolveMaxWorkflowAutoRelaunches(raw: unknown): number | undefin
|
|
|
20
28
|
return raw === 0 ? undefined : raw;
|
|
21
29
|
}
|
|
22
30
|
|
|
23
|
-
export function resolveAutoRelaunchDecision(value: unknown, relaunched: number, cap: number | undefined): AutoRelaunchDecision {
|
|
31
|
+
export function resolveAutoRelaunchDecision(value: unknown, relaunched: number, cap: number | undefined, progress?: WorkflowRoundProgress): AutoRelaunchDecision {
|
|
24
32
|
const budgetExhausted = !!value && typeof value === "object" && !Array.isArray(value) && (value as Record<string, unknown>).result === "budget";
|
|
25
33
|
if (!budgetExhausted) return { relaunch: false, capped: false };
|
|
26
|
-
if (cap
|
|
27
|
-
|
|
34
|
+
if (cap !== undefined && relaunched >= cap) return { relaunch: false, capped: true };
|
|
35
|
+
if (progress) {
|
|
36
|
+
if (progress.usageBudgetBlocked > 0) return { relaunch: false, capped: false, stallReason: "usage-budget" };
|
|
37
|
+
if (progress.fanoutRejected > 0 && progress.launched === 0) return { relaunch: false, capped: false, stallReason: "fanout-limited" };
|
|
38
|
+
if (progress.launched === 0 && progress.stateWrites === 0) return { relaunch: false, capped: false, stallReason: "no-progress" };
|
|
39
|
+
}
|
|
40
|
+
return { relaunch: true, capped: false };
|
|
28
41
|
}
|
|
@@ -3655,101 +3655,6 @@ describe("async execution utilities", { skip: !available ? "pi packages not avai
|
|
|
3655
3655
|
fs.rmSync(path.join(ACTIVE_ASYNC_CAPACITY_DIR, activeAsyncCapacitySessionKey("session-cap")), { recursive: true, force: true });
|
|
3656
3656
|
});
|
|
3657
3657
|
|
|
3658
|
-
it("scheduled executor launches retain the live active session ownership", { skip: !isAsyncAvailable() || !createSubagentExecutor ? "jiti or executor not available" : undefined }, async () => {
|
|
3659
|
-
mockPi.onCall({ output: "Scheduled work completed" });
|
|
3660
|
-
const liveCwd = path.join(tempDir, "live-project");
|
|
3661
|
-
fs.mkdirSync(liveCwd);
|
|
3662
|
-
const state = {
|
|
3663
|
-
baseCwd: liveCwd,
|
|
3664
|
-
currentSessionId: "session-b",
|
|
3665
|
-
lastParentModel: { provider: "deepseek", id: "live-model" },
|
|
3666
|
-
subagentSpawns: { sessionId: "session-b", count: 1, configuredLimit: 1, granted: 1, grantHistory: [] },
|
|
3667
|
-
asyncJobs: new Map(),
|
|
3668
|
-
fleetJobs: new Map(),
|
|
3669
|
-
foregroundControls: new Map(),
|
|
3670
|
-
lastForegroundControlId: null,
|
|
3671
|
-
};
|
|
3672
|
-
const executor = createSubagentExecutor!({
|
|
3673
|
-
pi: { events: createEventBus(), getSessionName: () => undefined },
|
|
3674
|
-
state,
|
|
3675
|
-
config: { maxSubagentSpawnsPerSession: 1 },
|
|
3676
|
-
asyncByDefault: false,
|
|
3677
|
-
tempArtifactsDir: tempDir,
|
|
3678
|
-
getSubagentSessionRoot: () => path.join(tempDir, "sessions"),
|
|
3679
|
-
expandTilde: (p: string) => p,
|
|
3680
|
-
discoverAgents: () => ({ agents: [makeAgent("worker")] }),
|
|
3681
|
-
});
|
|
3682
|
-
const retainedCtx = makeMinimalCtx(tempDir);
|
|
3683
|
-
retainedCtx.sessionManager.getSessionId = () => "session-a";
|
|
3684
|
-
retainedCtx.model = { provider: "deepseek", id: "scheduled-model" };
|
|
3685
|
-
const launch = await executor.executeScheduled(
|
|
3686
|
-
`scheduled-owner-${Date.now().toString(36)}`,
|
|
3687
|
-
{ agent: "worker", task: "Run retained project timer", async: true, acceptance: false },
|
|
3688
|
-
new AbortController().signal,
|
|
3689
|
-
retainedCtx,
|
|
3690
|
-
) as AsyncExecutionResult;
|
|
3691
|
-
|
|
3692
|
-
assert.equal(launch.isError, undefined);
|
|
3693
|
-
assert.ok(launch.details.asyncId);
|
|
3694
|
-
assert.equal(state.currentSessionId, "session-b");
|
|
3695
|
-
assert.equal(state.baseCwd, liveCwd);
|
|
3696
|
-
assert.deepEqual(state.lastParentModel, { provider: "deepseek", id: "live-model" });
|
|
3697
|
-
assert.deepEqual(state.subagentSpawns, { sessionId: "session-b", count: 1, configuredLimit: 1, granted: 1, grantHistory: [] });
|
|
3698
|
-
const blocked = await executor.executeScheduled(
|
|
3699
|
-
`scheduled-owner-blocked-${Date.now().toString(36)}`,
|
|
3700
|
-
{ agent: "worker", task: "Exceed the retained owner budget", async: true, acceptance: false },
|
|
3701
|
-
new AbortController().signal,
|
|
3702
|
-
retainedCtx,
|
|
3703
|
-
);
|
|
3704
|
-
assert.equal(blocked.isError, true);
|
|
3705
|
-
assert.match(blocked.content[0]?.type === "text" ? blocked.content[0].text : "", /1\/1 used/);
|
|
3706
|
-
assert.deepEqual(state.subagentSpawns, { sessionId: "session-b", count: 1, configuredLimit: 1, granted: 1, grantHistory: [] });
|
|
3707
|
-
await readAsyncPayload(launch.details.asyncId);
|
|
3708
|
-
});
|
|
3709
|
-
|
|
3710
|
-
it("scheduled workflows keep owner status and registries isolated from the live session", { skip: !isAsyncAvailable() || !createSubagentExecutor ? "jiti or executor not available" : undefined }, async () => {
|
|
3711
|
-
const liveCwd = path.join(tempDir, "live-workflow-project");
|
|
3712
|
-
fs.mkdirSync(liveCwd);
|
|
3713
|
-
const state = {
|
|
3714
|
-
baseCwd: liveCwd,
|
|
3715
|
-
currentSessionId: "session-b",
|
|
3716
|
-
subagentSpawns: { sessionId: "session-b", count: 4, configuredLimit: 5, granted: 0, grantHistory: [] },
|
|
3717
|
-
asyncJobs: new Map(),
|
|
3718
|
-
fleetJobs: new Map(),
|
|
3719
|
-
foregroundControls: new Map(),
|
|
3720
|
-
lastForegroundControlId: null,
|
|
3721
|
-
};
|
|
3722
|
-
const executor = createSubagentExecutor!({
|
|
3723
|
-
pi: { events: createEventBus(), getSessionName: () => undefined },
|
|
3724
|
-
state,
|
|
3725
|
-
config: { maxSubagentSpawnsPerSession: 5 },
|
|
3726
|
-
asyncByDefault: false,
|
|
3727
|
-
tempArtifactsDir: tempDir,
|
|
3728
|
-
getSubagentSessionRoot: () => path.join(tempDir, "sessions"),
|
|
3729
|
-
expandTilde: (p: string) => p,
|
|
3730
|
-
discoverAgents: () => ({ agents: [makeAgent("worker")] }),
|
|
3731
|
-
});
|
|
3732
|
-
const retainedCtx = makeMinimalCtx(tempDir);
|
|
3733
|
-
retainedCtx.sessionManager.getSessionId = () => "session-a";
|
|
3734
|
-
const workflowId = `scheduled-workflow-${Date.now().toString(36)}`;
|
|
3735
|
-
const launch = await executor.executeScheduled(
|
|
3736
|
-
workflowId,
|
|
3737
|
-
{ workflowScript: `return await runs.status("${workflowId}")`, async: true },
|
|
3738
|
-
new AbortController().signal,
|
|
3739
|
-
retainedCtx,
|
|
3740
|
-
) as AsyncExecutionResult;
|
|
3741
|
-
|
|
3742
|
-
assert.equal(launch.isError, undefined);
|
|
3743
|
-
assert.equal(state.asyncJobs.size, 0);
|
|
3744
|
-
assert.equal(state.fleetJobs.size, 0);
|
|
3745
|
-
assert.deepEqual(state.subagentSpawns, { sessionId: "session-b", count: 4, configuredLimit: 5, granted: 0, grantHistory: [] });
|
|
3746
|
-
const payload = await readAsyncPayload(launch.details.asyncId);
|
|
3747
|
-
assert.equal(state.asyncJobs.size, 0);
|
|
3748
|
-
assert.equal(state.fleetJobs.size, 0);
|
|
3749
|
-
assert.match(payload.workflow.value.output, /Spawn budget: 0\/5 used/);
|
|
3750
|
-
assert.match(payload.workflow.value.output, new RegExp(workflowId));
|
|
3751
|
-
});
|
|
3752
|
-
|
|
3753
3658
|
it("async executor keeps the last parent session model after continuation drops ctx.model", { skip: !isAsyncAvailable() || !createSubagentExecutor ? "jiti or executor not available" : undefined }, async () => {
|
|
3754
3659
|
mockPi.onCall({ output: "Done asynchronously" });
|
|
3755
3660
|
const state = {
|
|
@@ -4,7 +4,6 @@ import * as path from "node:path";
|
|
|
4
4
|
import { afterEach, describe, it } from "node:test";
|
|
5
5
|
import { getArtifactsDir } from "../../src/shared/artifacts.ts";
|
|
6
6
|
import { updateActiveRunIndex } from "../../src/runs/background/active-run-index.ts";
|
|
7
|
-
import { SubagentFleetComponent } from "../../src/tui/fleet.ts";
|
|
8
7
|
import { createNestedRoute } from "../../src/runs/shared/nested-events.ts";
|
|
9
8
|
import { createTempDir, removeTempDir, tryImport } from "../support/helpers.ts";
|
|
10
9
|
|
|
@@ -317,20 +316,6 @@ describe("async job tracker", { skip: !available ? "pi packages not available" :
|
|
|
317
316
|
assert.ok(state.poller, "expected restored active jobs to start polling");
|
|
318
317
|
assert.ok(ui.renderRequests >= 2, "expected reset and restore to request widget renders");
|
|
319
318
|
assert.equal(typeof ui.widgets.at(-1), "function", "expected restored jobs to render the widget");
|
|
320
|
-
|
|
321
|
-
const component = new SubagentFleetComponent(
|
|
322
|
-
{ terminal: { rows: 28, columns: 100 }, requestRender() {} } as never,
|
|
323
|
-
ui.ctx.ui.theme as never,
|
|
324
|
-
state as never,
|
|
325
|
-
() => {},
|
|
326
|
-
{ refreshMs: 60_000 },
|
|
327
|
-
);
|
|
328
|
-
try {
|
|
329
|
-
assert.ok(component.render(100).some((line) => line.includes("Restored custom cwd transcript")));
|
|
330
|
-
} finally {
|
|
331
|
-
component.dispose();
|
|
332
|
-
}
|
|
333
|
-
|
|
334
319
|
await new Promise((resolve) => setTimeout(resolve, 30));
|
|
335
320
|
assert.equal(recorder.events.length, 0, "historical control events should not be replayed during restore");
|
|
336
321
|
} finally {
|