@selesai/code 0.9.11 → 0.9.12
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 +11 -0
- package/dist/config.d.ts +4 -6
- package/dist/config.js +10 -14
- package/dist/core/agent-session.d.ts +0 -1
- package/dist/core/agent-session.js +3 -49
- package/dist/core/extensions/types.d.ts +0 -2
- package/dist/core/settings-manager.d.ts +0 -2
- package/dist/core/settings-manager.js +0 -3
- package/dist/core/tools/index.d.ts +0 -1
- package/dist/core/tools/index.js +0 -1
- package/dist/defaults/settings.json +0 -1
- package/dist/extensions/model-prompt-injector/index.test.ts +0 -10
- package/dist/extensions/model-prompt-injector/index.ts +0 -3
- package/dist/extensions/pi-intercom/CHANGELOG.md +53 -16
- package/dist/extensions/pi-intercom/README.md +41 -8
- package/dist/extensions/pi-intercom/banner.png +0 -0
- package/dist/extensions/pi-intercom/broker/broker.ts +498 -215
- package/dist/extensions/pi-intercom/broker/client.ts +39 -12
- package/dist/extensions/pi-intercom/broker/extension.test.ts +102 -3
- package/dist/extensions/pi-intercom/broker/paths.test.ts +2 -2
- package/dist/extensions/pi-intercom/broker/protocol.ts +26 -0
- package/dist/extensions/pi-intercom/broker/spawn.test.ts +5 -20
- package/dist/extensions/pi-intercom/config.test.ts +41 -0
- package/dist/extensions/pi-intercom/config.ts +21 -0
- package/dist/extensions/pi-intercom/extension-api.ts +40 -0
- package/dist/extensions/pi-intercom/index.ts +362 -26
- package/dist/extensions/pi-intercom/intercom.integration.test.ts +819 -13
- package/dist/extensions/pi-intercom/package.json +1 -1
- package/dist/extensions/pi-intercom/project-agent.ts +2 -2
- package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +8 -110
- package/dist/extensions/pi-intercom/types.ts +32 -5
- package/dist/extensions/pi-intercom/ui/inline-message.ts +6 -0
- package/dist/extensions/pi-subagents/.github/assets/subagent-fleet-inspector.png +0 -0
- package/dist/extensions/pi-subagents/.github/workflows/release.yml +28 -0
- package/dist/extensions/pi-subagents/.github/workflows/test.yml +51 -0
- package/dist/extensions/pi-subagents/.greptile/config.json +33 -0
- package/dist/extensions/pi-subagents/.greptile/files.json +8 -0
- package/dist/extensions/pi-subagents/.greptile/rules.md +16 -0
- package/dist/extensions/pi-subagents/CHANGELOG.md +309 -87
- package/dist/extensions/pi-subagents/README.md +15 -17
- package/dist/extensions/pi-subagents/agents/oracle.md +3 -1
- package/dist/extensions/pi-subagents/agents/researcher.md +32 -13
- package/dist/extensions/pi-subagents/agents/reviewer.md +13 -2
- package/dist/extensions/pi-subagents/agents/scout.md +2 -2
- package/dist/extensions/pi-subagents/agents/worker.md +2 -1
- package/dist/extensions/pi-subagents/async-retention-discovery-worker.mjs +180 -0
- package/dist/extensions/pi-subagents/docs/configuration.md +106 -27
- package/dist/extensions/pi-subagents/docs/extension-api.md +85 -21
- package/dist/extensions/pi-subagents/docs/missions.md +41 -4
- package/dist/extensions/pi-subagents/docs/models.md +52 -9
- package/dist/extensions/pi-subagents/docs/observability.md +103 -16
- package/dist/extensions/pi-subagents/docs/tool-reference.md +60 -45
- package/dist/extensions/pi-subagents/docs/watchdog.md +60 -3
- package/dist/extensions/pi-subagents/docs/workflows.md +181 -7
- package/dist/extensions/pi-subagents/index.ts +10 -1
- package/dist/extensions/pi-subagents/install.mjs +4 -4
- package/dist/extensions/pi-subagents/package-lock.json +1483 -1470
- package/dist/extensions/pi-subagents/package.json +6 -3
- package/dist/extensions/pi-subagents/prompts/council.md +60 -0
- package/dist/extensions/pi-subagents/prompts/parallel-review.md +5 -1
- package/dist/extensions/pi-subagents/prompts/review-loop.md +9 -5
- package/dist/extensions/pi-subagents/skills/council-mode/SKILL.md +254 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +18 -17
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +31 -9
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +107 -140
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +9 -12
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +39 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +44 -92
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +261 -368
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +6 -2
- package/dist/extensions/pi-subagents/src/agents/agents.ts +388 -85
- package/dist/extensions/pi-subagents/src/agents/builtin-names.ts +14 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-registry.ts +418 -0
- package/dist/extensions/pi-subagents/src/agents/skills.ts +1 -1
- package/dist/extensions/pi-subagents/src/api/agents.ts +7 -0
- package/dist/extensions/pi-subagents/src/api/external-job-provider.ts +195 -0
- package/dist/extensions/pi-subagents/src/api/preflight.ts +88 -27
- package/dist/extensions/pi-subagents/src/api/project-panes.ts +2 -0
- package/dist/extensions/pi-subagents/src/api/shared-types.ts +2 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +20 -11
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +14 -6
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +5 -4
- package/dist/extensions/pi-subagents/src/extension/index.ts +270 -187
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +65 -28
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +120 -11
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +46 -64
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +51 -37
- package/dist/extensions/pi-subagents/src/extension/tool-result.ts +19 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +2 -2
- package/dist/extensions/pi-subagents/src/inspectors/herdr/client.ts +3 -3
- package/dist/extensions/pi-subagents/src/inspectors/herdr/focus.ts +55 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +2 -1
- package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +230 -46
- package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +26 -4
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +32 -10
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +6 -1
- package/dist/extensions/pi-subagents/src/missions/store.ts +4 -9
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +2 -2
- package/dist/extensions/pi-subagents/src/policy/authority.ts +2 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +31 -8
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +210 -52
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +63 -33
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +71 -17
- package/dist/extensions/pi-subagents/src/runs/background/async-retention.ts +886 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-status-snapshot.ts +14 -5
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +49 -56
- package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +1 -0
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +3 -33
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +5 -0
- package/dist/extensions/pi-subagents/src/runs/background/completion-dedupe.ts +5 -1
- package/dist/extensions/pi-subagents/src/runs/background/completion-replay.ts +22 -12
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +105 -71
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +68 -19
- package/dist/extensions/pi-subagents/src/runs/background/index-segment.ts +59 -0
- package/dist/extensions/pi-subagents/src/runs/background/inspect-rpc.ts +443 -0
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +94 -10
- package/dist/extensions/pi-subagents/src/runs/background/result-files.ts +158 -90
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +141 -53
- package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +8 -5
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +14 -4
- package/dist/extensions/pi-subagents/src/runs/background/run-id-query.ts +7 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +13 -14
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +46 -25
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +823 -0
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +9 -3
- package/dist/extensions/pi-subagents/src/runs/background/steering.ts +11 -1
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +594 -216
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +17 -13
- package/dist/extensions/pi-subagents/src/runs/background/terminal-run-index.ts +138 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +23 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +82 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +5 -3
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +21 -14
- package/dist/extensions/pi-subagents/src/runs/foreground/async-stop-action.ts +23 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +153 -58
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +7 -9
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1283 -1657
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +274 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +6 -5
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +59 -10
- package/dist/extensions/pi-subagents/src/runs/shared/agent-contract.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/chain-outputs.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/child-identity.ts +36 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +52 -2
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/extension-bindings.ts +78 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-bridge.ts +460 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-runner.ts +389 -0
- package/dist/extensions/pi-subagents/src/runs/shared/fast-mode-extension.ts +10 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +14 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-exclusions.ts +243 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +201 -85
- package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +106 -39
- package/dist/extensions/pi-subagents/src/runs/shared/mutation-evidence.ts +145 -0
- package/dist/extensions/pi-subagents/src/runs/shared/orca-progress-tabs.ts +150 -27
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +46 -4
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +19 -15
- package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +5 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +86 -2
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +9 -9
- package/dist/extensions/pi-subagents/src/runs/shared/session-lease.ts +0 -6
- package/dist/extensions/pi-subagents/src/runs/shared/structured-output.ts +18 -4
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-control.ts +51 -7
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +62 -21
- package/dist/extensions/pi-subagents/src/runs/shared/tool-availability.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/tool-timeout.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/workflow-graph.ts +1 -23
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +14 -2
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +2 -2
- package/dist/extensions/pi-subagents/src/shared/atomic-json.ts +22 -2
- package/dist/extensions/pi-subagents/src/shared/capacity-resilient-json.ts +102 -0
- package/dist/extensions/pi-subagents/src/shared/completion-owner.ts +14 -0
- package/dist/extensions/pi-subagents/src/shared/file-system-retry.ts +49 -1
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +59 -1
- package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +12 -5
- package/dist/extensions/pi-subagents/src/shared/model-info.ts +20 -0
- package/dist/extensions/pi-subagents/src/shared/prompt-resources.ts +0 -40
- package/dist/extensions/pi-subagents/src/shared/settings.ts +11 -30
- package/dist/extensions/pi-subagents/src/shared/thinking-ceiling.ts +52 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +228 -49
- package/dist/extensions/pi-subagents/src/shared/utils.ts +11 -3
- package/dist/extensions/pi-subagents/src/shared/watch-strategy.ts +10 -0
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +0 -162
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +2 -5
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +105 -13
- package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +6 -36
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +829 -0
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +1415 -0
- package/dist/extensions/pi-subagents/src/tui/render.ts +78 -7
- package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +1 -0
- package/dist/extensions/pi-subagents/src/watchdog/permission-arbiter.ts +59 -51
- package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +8 -2
- package/dist/extensions/pi-subagents/src/watchdog/tool-actions.ts +2 -1
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +4 -4
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +471 -86
- package/dist/extensions/pi-subagents/src/workflows/workflow-receipt.ts +140 -0
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/args.d.ts +57 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/config-selector.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/file-processor.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/initial-message.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/list-models.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/project-trust.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/session-picker.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/startup-ui.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/config.d.ts +96 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-runtime.d.ts +119 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-services.d.ts +85 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session.d.ts +620 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-guidance.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-storage.d.ts +56 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/bash-executor.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/cache-stats.d.ts +49 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/branch-summarization.d.ts +93 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/compaction.d.ts +128 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/index.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/utils.d.ts +38 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/defaults.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/diagnostics.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/event-bus.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/exec.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/experimental.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/index.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/index.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/loader.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/runner.d.ts +171 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/types.d.ts +1261 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/footer-data-provider.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/index.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/keybindings.d.ts +358 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/messages.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-config.d.ts +512 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-registry.d.ts +43 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-resolver.d.ts +121 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-runtime.d.ts +82 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/models-store.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/output-guard.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/package-manager.d.ts +210 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/project-trust.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/prompt-templates.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-attribution.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-composer.d.ts +55 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/radius.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resource-loader.d.ts +206 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/sdk.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-cwd.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-manager.d.ts +356 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/settings-manager.d.ts +297 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/skills.d.ts +60 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/slash-commands.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/source-info.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/system-prompt.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/telemetry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/timings.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/bash.d.ts +68 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit-diff.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit.d.ts +51 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/find.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/grep.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/index.d.ts +40 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/ls.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/read.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/render-utils.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/truncate.d.ts +70 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/write.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/trust-manager.d.ts +36 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/usage-totals.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/index.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/main.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/migrations.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/index.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/assistant-message.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/config-selector.d.ts +102 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/footer.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/index.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/model-selector.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/settings-selector.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/status-indicator.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tool-execution.d.ts +63 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tree-selector.d.ts +94 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/interactive-mode.d.ts +394 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme.d.ts +120 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/print-mode.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-client.d.ts +246 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-types.d.ts +457 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/package-manager-cli.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/rpc-entry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/ansi.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/changelog.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/child-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/deprecation.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/frontmatter.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/fs-watch.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/git.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/html.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-convert.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/json.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/mime.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/open-browser.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/paths.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/photon.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/shell.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/sleep.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/tools-manager.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/version-check.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/index.mjs +1 -1
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +0 -54
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +1053 -414
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +194 -4
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +59 -4
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +0 -77
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +107 -6
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +211 -897
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +265 -375
- package/dist/extensions/pi-subagents/test/integration/orca-progress-tabs.test.ts +77 -7
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +547 -30
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +2112 -310
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +274 -34
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +20 -3
- package/dist/extensions/pi-subagents/test/support/isolated-temp-root.mjs +9 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +30 -5
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +2 -0
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +4 -2
- package/dist/extensions/pi-subagents/test/support/register-loader.mjs +1 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +197 -0
- package/dist/extensions/pi-subagents/test/unit/agent-contract.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +204 -27
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +444 -145
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +256 -4
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +9 -7
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +152 -22
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +29 -0
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +205 -23
- package/dist/extensions/pi-subagents/test/unit/async-retention.test.ts +579 -0
- package/dist/extensions/pi-subagents/test/unit/atomic-json.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/auto-drain.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/capacity-resilient-json.test.ts +155 -0
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +7 -0
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +123 -0
- package/dist/extensions/pi-subagents/test/unit/completion-replay.test.ts +81 -3
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +109 -7
- package/dist/extensions/pi-subagents/test/unit/default-extensions.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +5 -2
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +3 -2
- package/dist/extensions/pi-subagents/test/unit/extension-bindings.test.ts +79 -0
- package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/external-job-runner.test.ts +961 -0
- package/dist/extensions/pi-subagents/test/unit/file-system-retry.test.ts +64 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +1110 -0
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +1664 -0
- package/dist/extensions/pi-subagents/test/unit/fork-context.test.ts +81 -1
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +138 -11
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +41 -2
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +210 -79
- package/dist/extensions/pi-subagents/test/unit/index-segment.test.ts +95 -0
- package/dist/extensions/pi-subagents/test/unit/inspect-rpc.test.ts +596 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +10 -1
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +3 -5
- package/dist/extensions/pi-subagents/test/unit/model-exclusions.test.ts +167 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +319 -18
- package/dist/extensions/pi-subagents/test/unit/model-info.test.ts +78 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +19 -5
- package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +44 -0
- package/dist/extensions/pi-subagents/test/unit/mutation-evidence.test.ts +129 -0
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +231 -2
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +28 -1
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +106 -2
- package/dist/extensions/pi-subagents/test/unit/orca-progress-tabs.test.ts +204 -7
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +59 -4
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +2 -6
- package/dist/extensions/pi-subagents/test/unit/pi-args-permission-system.test.ts +34 -2
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +116 -6
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +12 -3
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +56 -61
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +416 -1
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +9 -2
- package/dist/extensions/pi-subagents/test/unit/project-panes-public-api.test.ts +42 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +21 -30
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +86 -11
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +49 -1
- package/dist/extensions/pi-subagents/test/unit/result-files.test.ts +233 -5
- package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +28 -5
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +323 -20
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +66 -10
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +68 -5
- package/dist/extensions/pi-subagents/test/unit/runtime-agent-registration.test.ts +174 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +679 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-store-root.test.ts +67 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +55 -44
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +399 -84
- package/dist/extensions/pi-subagents/test/unit/session-lease.test.ts +13 -0
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +15 -10
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +11 -7
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -0
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +40 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +10 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +38 -3
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +110 -12
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +204 -19
- package/dist/extensions/pi-subagents/test/unit/temp-paths.test.ts +25 -0
- package/dist/extensions/pi-subagents/test/unit/thinking-ceiling.test.ts +73 -0
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +90 -50
- package/dist/extensions/pi-subagents/test/unit/tool-timeout.test.ts +1 -2
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +234 -7
- package/dist/extensions/pi-subagents/test/unit/watch-strategy.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-permission-arbiter.test.ts +36 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +37 -9
- package/dist/extensions/pi-subagents/test/unit/workflow-detach-reconcile.test.ts +302 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +167 -7
- package/dist/extensions/pi-subagents/test/unit/workflow-receipt.test.ts +113 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +6 -6
- package/dist/extensions/ponytail/index.js +31 -25
- package/dist/extensions/ponytail/ponytail-config.cjs +34 -7
- package/dist/extensions/ponytail/ponytail-instructions.cjs +7 -9
- package/dist/extensions/ponytail/test/extension.test.js +7 -8
- package/dist/extensions/ponytail/test/helpers.test.js +1 -1
- package/dist/skills/brandkit/SKILL.md +799 -0
- package/dist/skills/design-taste-frontend/SKILL.md +1207 -0
- package/dist/skills/design-taste-frontend-v1/SKILL.md +227 -0
- package/dist/skills/full-output-enforcement/SKILL.md +50 -0
- package/dist/skills/gpt-taste/SKILL.md +75 -0
- package/dist/skills/high-end-visual-design/SKILL.md +99 -0
- package/dist/skills/image-to-code/SKILL.md +1229 -0
- package/dist/skills/imagegen-frontend-mobile/SKILL.md +1466 -0
- package/dist/skills/imagegen-frontend-web/SKILL.md +988 -0
- package/dist/skills/industrial-brutalist-ui/SKILL.md +93 -0
- package/dist/skills/minimalist-ui/SKILL.md +86 -0
- package/dist/skills/pi-subagents/SKILL.md +18 -17
- package/dist/skills/pi-subagents/references/constraints-and-recipes.md +31 -9
- package/dist/skills/pi-subagents/references/execution-controls.md +95 -143
- package/dist/skills/pi-subagents/references/management-authoring-rpc.md +9 -12
- package/dist/skills/pi-subagents/references/multi-lane-orchestration.md +39 -0
- package/dist/skills/pi-subagents/references/prompting-and-roles.md +45 -94
- package/dist/skills/ponytail/SKILL.md +12 -8
- package/dist/skills/ponytail-audit/SKILL.md +0 -1
- package/dist/skills/ponytail-debt/SKILL.md +0 -1
- package/dist/skills/ponytail-gain/SKILL.md +0 -1
- package/dist/skills/ponytail-help/SKILL.md +4 -3
- package/dist/skills/ponytail-review/SKILL.md +0 -1
- package/dist/skills/redesign-existing-projects/SKILL.md +179 -0
- package/dist/skills/stitch-design-taste/SKILL.md +185 -0
- package/dist/skills/unlazy/CHANGELOG.md +100 -0
- package/dist/skills/unlazy/CONTRIBUTING.md +66 -0
- package/dist/skills/unlazy/LICENSE +21 -0
- package/dist/skills/unlazy/README.md +242 -0
- package/dist/skills/unlazy/SECURITY.md +70 -0
- package/dist/skills/unlazy/SKILL.md +100 -0
- package/dist/skills/unlazy/package.json +13 -0
- package/dist/skills/unlazy/references/dispatch.md +82 -0
- package/dist/skills/unlazy/references/gates.md +132 -0
- package/dist/skills/unlazy/references/method.md +49 -0
- package/dist/skills/unlazy/references/orchestration.md +99 -0
- package/dist/skills/unlazy/references/parallel.md +123 -0
- package/dist/skills/unlazy/references/token-economy.md +39 -0
- package/dist/skills/unlazy/research/validation-protocol.md +81 -0
- package/dist/skills/unlazy/scripts/dispatch-check.mjs +108 -0
- package/dist/skills/unlazy/scripts/gate-check.mjs +894 -0
- package/dist/skills/unlazy/scripts/gate-lint.mjs +178 -0
- package/dist/skills/unlazy/scripts/install-hooks.mjs +206 -0
- package/dist/skills/unlazy/scripts/lib/check-supervisor.mjs +46 -0
- package/dist/skills/unlazy/scripts/lib/dispatch.mjs +283 -0
- package/dist/skills/unlazy/scripts/lib/gates.mjs +629 -0
- package/dist/skills/unlazy/scripts/lib/process-tree.mjs +161 -0
- package/dist/skills/unlazy/scripts/lib/regex-worker.mjs +9 -0
- package/dist/skills/unlazy/scripts/stop-hook.mjs +174 -0
- package/dist/skills/unlazy/templates/PLAN.md +65 -0
- package/dist/skills/unlazy/templates/gates-leaf.md +51 -0
- package/dist/skills/unlazy/templates/gates-node.md +50 -0
- package/dist/skills/unlazy/tests/contract-tests.mjs +127 -0
- package/dist/skills/unlazy/tests/dispatch-tests.mjs +481 -0
- package/dist/skills/unlazy/tests/hardening-tests.mjs +903 -0
- package/dist/skills/unlazy/tests/lint-tests.mjs +242 -0
- package/dist/skills/unlazy/tests/run-tests.mjs +554 -0
- package/dist/skills/unlazy/tests/self-check.mjs +165 -0
- package/dist/skills/unlazy/tests/stress-tests.mjs +356 -0
- package/dist/skills/web-design-guidelines/SKILL.md +40 -0
- package/docs/settings.md +0 -5
- package/package.json +1 -1
- package/dist/core/tools/schema-prune.d.ts +0 -16
- package/dist/core/tools/schema-prune.js +0 -39
- package/dist/core/tools/schema-prune.test.d.ts +0 -1
- package/dist/core/tools/schema-prune.test.js +0 -111
- package/dist/extensions/pi-subagents/UPSTREAM-V0.50-MAPPING.md +0 -172
- package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +0 -55
- package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +0 -61
- package/dist/extensions/pi-subagents/src/agents/task-aware-routing.ts +0 -132
- package/dist/extensions/pi-subagents/src/extension/chain-validation.ts +0 -181
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +0 -1354
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +0 -1581
- package/dist/extensions/pi-subagents/src/shared/env.ts +0 -16
- package/dist/extensions/pi-subagents/src/shared/session-lineage.ts +0 -71
- package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +0 -136
- package/dist/extensions/pi-subagents/src/workflows/workflow-auto-relaunch.ts +0 -41
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +0 -466
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +0 -1859
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +0 -733
- package/dist/extensions/pi-subagents/test/unit/builtin-agent-documentation.test.ts +0 -63
- package/dist/extensions/pi-subagents/test/unit/chain-validation.test.ts +0 -326
- package/dist/extensions/pi-subagents/test/unit/handoff-adoption.test.ts +0 -103
- package/dist/extensions/pi-subagents/test/unit/inline-subagents.test.ts +0 -127
- package/dist/extensions/pi-subagents/test/unit/session-lineage.test.ts +0 -73
- package/dist/extensions/pi-subagents/test/unit/task-aware-routing.test.ts +0 -213
- package/dist/extensions/pi-subagents/test/unit/workflow-auto-relaunch.test.ts +0 -65
|
@@ -0,0 +1,829 @@
|
|
|
1
|
+
import type { ExtensionContext } from "@selesai/code";
|
|
2
|
+
import { type EditorComponent, isKeyRelease, Key, matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
3
|
+
import { snapshotExternalRuns } from "../api/external-runs.ts";
|
|
4
|
+
import { formatModelThinking } from "../shared/formatters.ts";
|
|
5
|
+
import type { AsyncJobState, AsyncJobStep, FleetViewPlacement, HerdrProjectPaneSnapshot, NestedRunSummary, NestedStepSummary, SubagentState } from "../shared/types.ts";
|
|
6
|
+
import { formatWorkflowJsonPreview } from "../workflows/scripted-workflow.ts";
|
|
7
|
+
|
|
8
|
+
export const FLEET_STATUS_WIDGET_KEY = "subagent-fleet-status";
|
|
9
|
+
|
|
10
|
+
// Six rows fit the accepted collapsed hierarchy: one owner, four visible descendants, and overflow.
|
|
11
|
+
const MAX_AGENT_ROWS = 6;
|
|
12
|
+
const REFRESH_MS = 500;
|
|
13
|
+
|
|
14
|
+
type Theme = ExtensionContext["ui"]["theme"];
|
|
15
|
+
type FleetStatusTui = {
|
|
16
|
+
requestRender(): void;
|
|
17
|
+
};
|
|
18
|
+
type FleetStatusEntry = {
|
|
19
|
+
key: string;
|
|
20
|
+
surface?: "project-pane";
|
|
21
|
+
parentKey?: string;
|
|
22
|
+
workflowWrapper?: boolean;
|
|
23
|
+
agent: string;
|
|
24
|
+
modelThinking?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
startedAt: number;
|
|
27
|
+
tokens: number;
|
|
28
|
+
state: string;
|
|
29
|
+
external?: true;
|
|
30
|
+
projectPane?: HerdrProjectPaneSnapshot;
|
|
31
|
+
nestedChildren?: NestedRunSummary[];
|
|
32
|
+
workflowRows?: FleetWorkflowRow[];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type FleetWorkflowRow = {
|
|
36
|
+
name: string;
|
|
37
|
+
state: AsyncJobStep["status"];
|
|
38
|
+
modelThinking?: string;
|
|
39
|
+
activity?: string;
|
|
40
|
+
startedAt?: number;
|
|
41
|
+
tokens?: number;
|
|
42
|
+
overflow?: number;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type FleetNestedRow = {
|
|
46
|
+
name: string;
|
|
47
|
+
state: NestedRunSummary["state"] | NestedStepSummary["status"];
|
|
48
|
+
modelThinking?: string;
|
|
49
|
+
activity?: string;
|
|
50
|
+
startedAt?: number;
|
|
51
|
+
depth: number;
|
|
52
|
+
overflow?: number;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type FleetTreeRow =
|
|
56
|
+
| { kind: "owner"; entry: FleetStatusEntry }
|
|
57
|
+
| { kind: "child"; entry: FleetStatusEntry; last: boolean }
|
|
58
|
+
| { kind: "workflow"; ownerKey: string; row: FleetWorkflowRow; last: boolean }
|
|
59
|
+
| { kind: "nested"; ownerKey: string; row: FleetNestedRow; last: boolean };
|
|
60
|
+
|
|
61
|
+
export interface FleetStatusOptions {
|
|
62
|
+
refreshMs?: number;
|
|
63
|
+
maxAgentRows?: number;
|
|
64
|
+
placement?: FleetViewPlacement;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function resolveFleetViewPlacement(value: unknown): FleetViewPlacement {
|
|
68
|
+
return value === "aboveEditor" ? "aboveEditor" : "belowEditor";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function formatFleetElapsed(ms: number): string {
|
|
72
|
+
return `${Math.max(0, Math.round(ms / 1000))}s`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function formatFleetTokens(count: number): string {
|
|
76
|
+
let compact: string;
|
|
77
|
+
if (count >= 1_000_000) compact = `${(count / 1_000_000).toFixed(1)}M`;
|
|
78
|
+
else if (count >= 1_000) compact = `${(count / 1_000).toFixed(1)}k`;
|
|
79
|
+
else compact = `${Math.max(0, Math.round(count))}`;
|
|
80
|
+
return `↓ ${compact} tokens`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function rightAlign(left: string, right: string, width: number): string {
|
|
84
|
+
const rightWidth = visibleWidth(right);
|
|
85
|
+
const maxLeftWidth = Math.max(0, width - rightWidth - 1);
|
|
86
|
+
const leftClamped = truncateToWidth(left, maxLeftWidth);
|
|
87
|
+
const gap = Math.max(1, width - visibleWidth(leftClamped) - rightWidth);
|
|
88
|
+
return truncateToWidth(`${leftClamped}${" ".repeat(gap)}${right}`, width);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function isActiveState(value: string): boolean {
|
|
92
|
+
return value === "running" || value === "queued" || value === "pending";
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function nestedRunLabel(run: NestedRunSummary): string {
|
|
96
|
+
if (run.agent) return run.agent;
|
|
97
|
+
if (run.agents?.length) return run.agents.length === 1 ? run.agents[0]! : `${run.agents.slice(0, 2).join(", ")}${run.agents.length > 2 ? ` +${run.agents.length - 2}` : ""}`;
|
|
98
|
+
return run.id;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function nestedActivity(node: NestedRunSummary | NestedStepSummary): string | undefined {
|
|
102
|
+
if (node.currentTool) return `tool ${node.currentTool}`;
|
|
103
|
+
if (node.currentPath) return node.currentPath.split(/[\\/]/).at(-1);
|
|
104
|
+
if (node.activityState === "needs_attention") return "needs attention";
|
|
105
|
+
if (node.activityState === "active_long_running") return "long-running";
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function workflowStepActivity(step: AsyncJobStep): string | undefined {
|
|
110
|
+
if (step.currentTool) return `tool ${step.currentTool}`;
|
|
111
|
+
if (step.currentPath) return step.currentPath.split(/[\\/]/).at(-1);
|
|
112
|
+
if (step.activityState === "needs_attention") return "needs attention";
|
|
113
|
+
if (step.activityState === "active_long_running") return "long-running";
|
|
114
|
+
if (step.turnCount !== undefined) return `${step.turnCount} turns`;
|
|
115
|
+
if (step.toolCount !== undefined) return `${step.toolCount} tools`;
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function workflowStepName(step: AsyncJobStep, index: number): string {
|
|
120
|
+
const key = step.workflowKey ?? `step ${index + 1}`;
|
|
121
|
+
const label = step.label && step.label !== key ? ` · ${step.label}` : "";
|
|
122
|
+
const phase = step.phase ? `${step.phase}: ` : "";
|
|
123
|
+
return `${phase}${key}${label} (${step.agent})`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function workflowFleetRows(steps: AsyncJobStep[] | undefined): FleetWorkflowRow[] {
|
|
127
|
+
return (steps ?? []).map((step, index) => {
|
|
128
|
+
const modelThinking = formatModelThinking(step.model, step.thinking) || undefined;
|
|
129
|
+
const activity = workflowStepActivity(step);
|
|
130
|
+
return {
|
|
131
|
+
name: workflowStepName(step, index),
|
|
132
|
+
state: step.status,
|
|
133
|
+
...(modelThinking ? { modelThinking } : {}),
|
|
134
|
+
...(activity ? { activity } : {}),
|
|
135
|
+
...(step.startedAt !== undefined ? { startedAt: step.startedAt } : {}),
|
|
136
|
+
...(step.tokens?.total !== undefined ? { tokens: step.tokens.total } : {}),
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function visibleWorkflowRows(rows: FleetWorkflowRow[] | undefined, visibleLimit: number): FleetWorkflowRow[] {
|
|
142
|
+
if (!rows?.length) return [];
|
|
143
|
+
if (rows.length <= visibleLimit) return rows;
|
|
144
|
+
const selected = new Set<number>();
|
|
145
|
+
for (const [index, row] of rows.entries()) {
|
|
146
|
+
if (row.state !== "complete" && row.state !== "completed") selected.add(index);
|
|
147
|
+
if (selected.size >= visibleLimit) break;
|
|
148
|
+
}
|
|
149
|
+
for (let index = rows.length - 1; index >= 0 && selected.size < visibleLimit; index--) selected.add(index);
|
|
150
|
+
const visible = [...selected].sort((left, right) => left - right).map((index) => rows[index]!);
|
|
151
|
+
return [{ name: `… +${rows.length - visible.length} hidden workflow steps`, state: "complete", overflow: rows.length - visible.length }, ...visible];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function nestedStatusGlyph(state: FleetNestedRow["state"], theme: Theme): string {
|
|
155
|
+
if (state === "running") return theme.fg("accent", "●");
|
|
156
|
+
if (state === "queued" || state === "pending") return theme.fg("muted", "◦");
|
|
157
|
+
if (state === "complete" || state === "completed") return theme.fg("success", "✓");
|
|
158
|
+
if (state === "failed" || state === "rejected") return theme.fg("error", "✗");
|
|
159
|
+
return theme.fg("warning", "■");
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function nestedStepDisplayCount(steps: NestedStepSummary[] | undefined, start = 0): number {
|
|
163
|
+
let count = 0;
|
|
164
|
+
for (let index = start; index < (steps?.length ?? 0); index++) {
|
|
165
|
+
count += 1 + nestedDisplayCount(steps![index]!.children);
|
|
166
|
+
}
|
|
167
|
+
return count;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function nestedDisplayCount(children: NestedRunSummary[] | undefined, start = 0): number {
|
|
171
|
+
let count = 0;
|
|
172
|
+
for (let index = start; index < (children?.length ?? 0); index++) {
|
|
173
|
+
const child = children![index]!;
|
|
174
|
+
const steps = (child.mode === "parallel" || child.mode === "chain") ? child.steps ?? [] : [];
|
|
175
|
+
count += steps.length > 0 ? nestedStepDisplayCount(steps) : 1;
|
|
176
|
+
count += nestedDisplayCount(child.children);
|
|
177
|
+
}
|
|
178
|
+
return count;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function nestedFleetRows(children: NestedRunSummary[] | undefined, visibleLimit: number): FleetNestedRow[] {
|
|
182
|
+
const rows: FleetNestedRow[] = [];
|
|
183
|
+
let omitted = 0;
|
|
184
|
+
const appendRuns = (runs: NestedRunSummary[] | undefined, depth: number): boolean => {
|
|
185
|
+
for (let runIndex = 0; runIndex < (runs?.length ?? 0); runIndex++) {
|
|
186
|
+
const child = runs![runIndex]!;
|
|
187
|
+
const steps = (child.mode === "parallel" || child.mode === "chain") ? child.steps ?? [] : [];
|
|
188
|
+
if (steps.length > 0) {
|
|
189
|
+
for (let stepIndex = 0; stepIndex < steps.length; stepIndex++) {
|
|
190
|
+
if (rows.length >= visibleLimit) {
|
|
191
|
+
omitted += nestedStepDisplayCount(steps, stepIndex);
|
|
192
|
+
omitted += nestedDisplayCount(child.children);
|
|
193
|
+
omitted += nestedDisplayCount(runs, runIndex + 1);
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
const step = steps[stepIndex]!;
|
|
197
|
+
const modelThinking = formatModelThinking(step.model, step.thinking) || undefined;
|
|
198
|
+
const activity = nestedActivity(step);
|
|
199
|
+
rows.push({
|
|
200
|
+
name: step.agent,
|
|
201
|
+
state: step.status,
|
|
202
|
+
depth,
|
|
203
|
+
...(modelThinking ? { modelThinking } : {}),
|
|
204
|
+
...(activity ? { activity } : {}),
|
|
205
|
+
...(step.startedAt !== undefined ? { startedAt: step.startedAt } : {}),
|
|
206
|
+
});
|
|
207
|
+
if (!appendRuns(step.children, depth + 1)) {
|
|
208
|
+
omitted += nestedStepDisplayCount(steps, stepIndex + 1);
|
|
209
|
+
omitted += nestedDisplayCount(child.children);
|
|
210
|
+
omitted += nestedDisplayCount(runs, runIndex + 1);
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
} else {
|
|
215
|
+
if (rows.length >= visibleLimit) {
|
|
216
|
+
omitted += nestedDisplayCount(runs, runIndex);
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
const modelThinking = formatModelThinking(child.model, child.thinking) || undefined;
|
|
220
|
+
const activity = nestedActivity(child);
|
|
221
|
+
rows.push({
|
|
222
|
+
name: nestedRunLabel(child),
|
|
223
|
+
state: child.state,
|
|
224
|
+
depth,
|
|
225
|
+
...(modelThinking ? { modelThinking } : {}),
|
|
226
|
+
...(activity ? { activity } : {}),
|
|
227
|
+
...(child.startedAt !== undefined ? { startedAt: child.startedAt } : {}),
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
if (!appendRuns(child.children, depth + 1)) {
|
|
231
|
+
omitted += nestedDisplayCount(runs, runIndex + 1);
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return true;
|
|
236
|
+
};
|
|
237
|
+
appendRuns(children, 0);
|
|
238
|
+
if (omitted > 0) rows.push({ name: `… +${omitted} more nested leaves`, state: "complete", depth: 0, overflow: omitted });
|
|
239
|
+
return rows;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function fleetTreeRows(entries: FleetStatusEntry[]): FleetTreeRow[] {
|
|
243
|
+
const rows: FleetTreeRow[] = [];
|
|
244
|
+
const entryKeys = new Set(entries.map((entry) => entry.key));
|
|
245
|
+
const childrenByParent = new Map<string, FleetStatusEntry[]>();
|
|
246
|
+
for (const entry of entries) {
|
|
247
|
+
if (!entry.parentKey || !entryKeys.has(entry.parentKey)) continue;
|
|
248
|
+
const children = childrenByParent.get(entry.parentKey) ?? [];
|
|
249
|
+
children.push(entry);
|
|
250
|
+
childrenByParent.set(entry.parentKey, children);
|
|
251
|
+
}
|
|
252
|
+
for (const entry of entries) {
|
|
253
|
+
if (entry.parentKey && entryKeys.has(entry.parentKey)) continue;
|
|
254
|
+
rows.push({ kind: "owner", entry });
|
|
255
|
+
const attached = childrenByParent.get(entry.key) ?? [];
|
|
256
|
+
const workflowRows = visibleWorkflowRows(entry.workflowRows, attached.length > 0 ? 2 : 4);
|
|
257
|
+
for (const [index, child] of attached.entries()) {
|
|
258
|
+
const nested = nestedFleetRows(child.nestedChildren, 3);
|
|
259
|
+
const laterRows = index < attached.length - 1 || workflowRows.length > 0 || Boolean(entry.nestedChildren?.length);
|
|
260
|
+
rows.push({ kind: "child", entry: child, last: !laterRows && nested.length === 0 });
|
|
261
|
+
for (const [nestedIndex, row] of nested.entries()) rows.push({
|
|
262
|
+
kind: "nested",
|
|
263
|
+
ownerKey: child.key,
|
|
264
|
+
row: { ...row, depth: row.depth + 1 },
|
|
265
|
+
last: nestedIndex === nested.length - 1 && !laterRows,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
for (const [index, row] of workflowRows.entries()) rows.push({ kind: "workflow", ownerKey: entry.key, row, last: index === workflowRows.length - 1 && !entry.nestedChildren?.length });
|
|
269
|
+
const nested = nestedFleetRows(entry.nestedChildren, attached.length > 0 ? 3 : 4);
|
|
270
|
+
for (const [index, row] of nested.entries()) rows.push({ kind: "nested", ownerKey: entry.key, row, last: index === nested.length - 1 });
|
|
271
|
+
}
|
|
272
|
+
return rows;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function isStaleExtensionContextError(error: unknown): boolean {
|
|
276
|
+
// Pi currently exposes stale contexts as plain Errors without a stable code or subtype.
|
|
277
|
+
return error instanceof Error
|
|
278
|
+
&& (error.message.includes("This extension ctx is stale")
|
|
279
|
+
|| error.message.includes("Extension context no longer active"));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function foregroundDescription(control: { parentWorkflowRunId?: string; workflowKey?: string }, description: string | undefined): string | undefined {
|
|
283
|
+
if (!control.parentWorkflowRunId) return description;
|
|
284
|
+
const workflow = `workflow child: ${control.parentWorkflowRunId}${control.workflowKey ? ` (${control.workflowKey})` : ""}`;
|
|
285
|
+
return description ? `${workflow} · ${description}` : workflow;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function activeLeafAgentCount(entries: FleetStatusEntry[]): number {
|
|
289
|
+
return entries.filter((entry) => !entry.workflowWrapper && !entry.surface).length;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function projectPaneNeedsAttention(pane: HerdrProjectPaneSnapshot): boolean {
|
|
293
|
+
return ["attention", "blocked", "paused", "failed", "error"].some((status) => pane.agentStatus.includes(status))
|
|
294
|
+
|| pane.summary?.includes("⚠") === true;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function projectName(projectRoot: string): string {
|
|
298
|
+
return projectRoot.split(/[\\/]/).filter(Boolean).at(-1) ?? projectRoot;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function projectPaneEntries(state: SubagentState): FleetStatusEntry[] {
|
|
302
|
+
return [...(state.herdrProjectPanes?.values() ?? [])]
|
|
303
|
+
.filter((pane) => pane.state === "open")
|
|
304
|
+
.sort((left, right) => left.openedAt.localeCompare(right.openedAt) || left.projectRoot.localeCompare(right.projectRoot))
|
|
305
|
+
.map((pane) => ({
|
|
306
|
+
key: `project-pane:${pane.projectRoot}`,
|
|
307
|
+
surface: "project-pane" as const,
|
|
308
|
+
agent: `${projectName(pane.projectRoot)} · ${pane.paneId}`,
|
|
309
|
+
description: pane.summary,
|
|
310
|
+
startedAt: Date.parse(pane.openedAt) || pane.refreshedAt,
|
|
311
|
+
tokens: 0,
|
|
312
|
+
state: pane.agentStatus || "unknown",
|
|
313
|
+
projectPane: pane,
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export function collectFleetStatusEntries(state: SubagentState): FleetStatusEntry[] {
|
|
318
|
+
const entries: FleetStatusEntry[] = [];
|
|
319
|
+
const activeWorkflowKeys = new Set([...state.asyncJobs.values()]
|
|
320
|
+
.filter((job) => job.mode === "workflow" && isActiveState(job.status))
|
|
321
|
+
.map((job) => `async:${job.asyncId}`));
|
|
322
|
+
for (const control of state.foregroundControls.values()) {
|
|
323
|
+
const parentKey = control.parentWorkflowRunId ? `async:${control.parentWorkflowRunId}` : undefined;
|
|
324
|
+
const linkedParentKey = parentKey && activeWorkflowKeys.has(parentKey) ? parentKey : undefined;
|
|
325
|
+
if (control.activeChildren) {
|
|
326
|
+
for (const child of [...control.activeChildren.values()].sort((left, right) => left.index - right.index)) {
|
|
327
|
+
const modelThinking = formatModelThinking(child.model, child.thinking) || undefined;
|
|
328
|
+
entries.push({
|
|
329
|
+
key: `foreground-active:${control.runId}:${child.index}`,
|
|
330
|
+
...(linkedParentKey ? { parentKey: linkedParentKey } : {}),
|
|
331
|
+
agent: child.agent,
|
|
332
|
+
...(modelThinking ? { modelThinking } : {}),
|
|
333
|
+
description: foregroundDescription(control, child.description),
|
|
334
|
+
startedAt: child.startedAt,
|
|
335
|
+
tokens: child.tokens ?? 0,
|
|
336
|
+
state: "running",
|
|
337
|
+
...((control.nestedChildren?.filter((nested) => nested.parentStepIndex === child.index).length ?? 0) > 0
|
|
338
|
+
? { nestedChildren: control.nestedChildren!.filter((nested) => nested.parentStepIndex === child.index) }
|
|
339
|
+
: control.activeChildren.size === 1 && control.nestedChildren?.length ? { nestedChildren: control.nestedChildren } : {}),
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
const modelThinking = formatModelThinking(control.model, control.thinking) || undefined;
|
|
345
|
+
entries.push({
|
|
346
|
+
key: `foreground-active:${control.runId}:${control.currentIndex ?? 0}`,
|
|
347
|
+
...(linkedParentKey ? { parentKey: linkedParentKey } : {}),
|
|
348
|
+
agent: control.currentAgent ?? control.mode,
|
|
349
|
+
...(modelThinking ? { modelThinking } : {}),
|
|
350
|
+
description: foregroundDescription(control, control.description),
|
|
351
|
+
startedAt: control.startedAt,
|
|
352
|
+
tokens: control.tokens ?? 0,
|
|
353
|
+
state: "running",
|
|
354
|
+
...(control.nestedChildren?.length ? { nestedChildren: control.nestedChildren } : {}),
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
for (const job of state.asyncJobs.values()) {
|
|
359
|
+
if (!isActiveState(job.status)) continue;
|
|
360
|
+
const startedAt = job.startedAt ?? job.updatedAt ?? Date.now();
|
|
361
|
+
if (job.mode === "workflow") {
|
|
362
|
+
const latestEmit = job.workflow?.emits?.length ? formatWorkflowJsonPreview(job.workflow.emits.at(-1), 120) : undefined;
|
|
363
|
+
entries.push({
|
|
364
|
+
key: `async:${job.asyncId}`,
|
|
365
|
+
workflowWrapper: true,
|
|
366
|
+
agent: "workflow",
|
|
367
|
+
description: latestEmit !== undefined ? `latest emit: ${latestEmit}` : job.description,
|
|
368
|
+
startedAt,
|
|
369
|
+
tokens: job.totalTokens?.total ?? 0,
|
|
370
|
+
state: job.status,
|
|
371
|
+
...(job.steps?.length ? { workflowRows: workflowFleetRows(job.steps) } : {}),
|
|
372
|
+
...(job.nestedChildren?.length ? { nestedChildren: job.nestedChildren } : {}),
|
|
373
|
+
});
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
const steps: AsyncJobStep[] | undefined = job.steps?.length
|
|
377
|
+
? job.steps
|
|
378
|
+
: job.agents?.map((agent, index) => {
|
|
379
|
+
const pending = job.status === "queued"
|
|
380
|
+
|| (job.mode === "chain" && !job.activeParallelGroup && index !== (job.currentStep ?? 0));
|
|
381
|
+
return { agent, index, status: pending ? "pending" : "running" };
|
|
382
|
+
});
|
|
383
|
+
if (!steps?.length) {
|
|
384
|
+
entries.push({
|
|
385
|
+
key: `async:${job.asyncId}`,
|
|
386
|
+
agent: job.mode ?? "subagent",
|
|
387
|
+
description: job.description,
|
|
388
|
+
startedAt,
|
|
389
|
+
tokens: job.totalTokens?.total ?? 0,
|
|
390
|
+
state: job.status,
|
|
391
|
+
...(job.nestedChildren?.length ? { nestedChildren: job.nestedChildren } : {}),
|
|
392
|
+
});
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
for (const [offset, step] of steps.entries()) {
|
|
396
|
+
if (!isActiveState(step.status)) continue;
|
|
397
|
+
const index = step.index ?? offset;
|
|
398
|
+
if (step.status === "pending" && job.mode === "chain" && !job.activeParallelGroup && index !== (job.currentStep ?? 0)) continue;
|
|
399
|
+
const modelThinking = formatModelThinking(step.model, step.thinking) || undefined;
|
|
400
|
+
entries.push({
|
|
401
|
+
key: `async:${job.asyncId}:${index}`,
|
|
402
|
+
agent: step.label ? `${step.label} (${step.agent})` : step.agent,
|
|
403
|
+
...(modelThinking ? { modelThinking } : {}),
|
|
404
|
+
description: step.description ?? job.description,
|
|
405
|
+
startedAt: step.startedAt ?? startedAt,
|
|
406
|
+
tokens: step.tokens?.total ?? (steps.length === 1 ? job.totalTokens?.total ?? 0 : 0),
|
|
407
|
+
state: step.status,
|
|
408
|
+
...((step.children?.length ?? 0) > 0
|
|
409
|
+
? { nestedChildren: step.children }
|
|
410
|
+
: job.nestedChildren?.filter((nested) => nested.parentStepIndex === index).length
|
|
411
|
+
? { nestedChildren: job.nestedChildren.filter((nested) => nested.parentStepIndex === index) }
|
|
412
|
+
: {}),
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (state.currentSessionId) {
|
|
418
|
+
try {
|
|
419
|
+
for (const run of snapshotExternalRuns(state.currentSessionId, { ignoreMalformed: true, onMalformedRecord: (message) => console.warn(`[pi-subagents] Removed ${message}`) })) {
|
|
420
|
+
if (!isActiveState(run.state)) continue;
|
|
421
|
+
entries.push({
|
|
422
|
+
key: `external:${run.id}`,
|
|
423
|
+
agent: `external · ${run.label}`,
|
|
424
|
+
description: run.currentAction ?? `source: ${run.source}`,
|
|
425
|
+
startedAt: run.startedAt,
|
|
426
|
+
tokens: 0,
|
|
427
|
+
state: run.state,
|
|
428
|
+
external: true,
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
} catch (cause) {
|
|
432
|
+
console.warn(`[pi-subagents] Failed to inspect external jobs: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
entries.push(...projectPaneEntries(state));
|
|
437
|
+
return entries.sort((left, right) => left.startedAt - right.startedAt || left.key.localeCompare(right.key));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export class SubagentFleetStatus {
|
|
441
|
+
private ctx: ExtensionContext | undefined;
|
|
442
|
+
private ui: ExtensionContext["ui"] | undefined;
|
|
443
|
+
private tui: FleetStatusTui | undefined;
|
|
444
|
+
private inputUnsubscribe: (() => void) | undefined;
|
|
445
|
+
private timer: ReturnType<typeof setInterval> | undefined;
|
|
446
|
+
private widgetRegistered = false;
|
|
447
|
+
private active = false;
|
|
448
|
+
private selectedKey = "main";
|
|
449
|
+
private inspectorOpen = false;
|
|
450
|
+
private lastRenderKey = "";
|
|
451
|
+
private entries: FleetStatusEntry[] = [];
|
|
452
|
+
private readonly state: SubagentState;
|
|
453
|
+
private readonly openInspector: (itemKey: string) => Promise<void> | void;
|
|
454
|
+
private readonly refreshMs: number;
|
|
455
|
+
private readonly maxAgentRows: number;
|
|
456
|
+
private readonly placement: FleetViewPlacement;
|
|
457
|
+
|
|
458
|
+
constructor(
|
|
459
|
+
state: SubagentState,
|
|
460
|
+
openInspector: (itemKey: string) => Promise<void> | void,
|
|
461
|
+
options: FleetStatusOptions = {},
|
|
462
|
+
) {
|
|
463
|
+
this.state = state;
|
|
464
|
+
this.openInspector = openInspector;
|
|
465
|
+
this.refreshMs = options.refreshMs ?? REFRESH_MS;
|
|
466
|
+
this.maxAgentRows = options.maxAgentRows ?? MAX_AGENT_ROWS;
|
|
467
|
+
this.placement = options.placement ?? "belowEditor";
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
setContext(ctx: ExtensionContext): void {
|
|
471
|
+
if (!ctx.hasUI) return;
|
|
472
|
+
const ui = ctx.ui;
|
|
473
|
+
if (this.ui === ui) {
|
|
474
|
+
this.ctx = ctx;
|
|
475
|
+
this.refresh();
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
this.clearUiRegistration();
|
|
479
|
+
this.ctx = ctx;
|
|
480
|
+
this.ui = ui;
|
|
481
|
+
if (typeof ui.onTerminalInput === "function") {
|
|
482
|
+
this.inputUnsubscribe = ui.onTerminalInput((data) => this.handleKey(data));
|
|
483
|
+
}
|
|
484
|
+
this.timer = setInterval(() => this.refresh(), this.refreshMs);
|
|
485
|
+
this.timer.unref?.();
|
|
486
|
+
this.refresh();
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
dispose(): void {
|
|
490
|
+
this.clearUiRegistration();
|
|
491
|
+
this.ctx = undefined;
|
|
492
|
+
this.ui = undefined;
|
|
493
|
+
this.entries = [];
|
|
494
|
+
this.active = false;
|
|
495
|
+
this.selectedKey = "main";
|
|
496
|
+
this.inspectorOpen = false;
|
|
497
|
+
this.lastRenderKey = "";
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
refresh(): void {
|
|
501
|
+
const ctx = this.getActiveUiContext();
|
|
502
|
+
if (!ctx) return;
|
|
503
|
+
if (this.state.widgetsSuspended) {
|
|
504
|
+
this.clearWidget();
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
this.entries = collectFleetStatusEntries(this.state);
|
|
508
|
+
this.clampSelection();
|
|
509
|
+
if (this.inspectorOpen || this.state.fleetInspectorOpen) {
|
|
510
|
+
this.lastRenderKey = "";
|
|
511
|
+
this.clearWidget();
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
if (!this.hasInlineSurface()) {
|
|
515
|
+
this.active = false;
|
|
516
|
+
this.selectedKey = "main";
|
|
517
|
+
this.lastRenderKey = "";
|
|
518
|
+
this.clearWidget();
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const renderKey = this.getRenderKey();
|
|
523
|
+
if (!this.widgetRegistered) {
|
|
524
|
+
ctx.ui.setWidget(FLEET_STATUS_WIDGET_KEY, (tui, theme) => {
|
|
525
|
+
this.tui = tui;
|
|
526
|
+
return {
|
|
527
|
+
render: (width: number) => this.render(width, theme),
|
|
528
|
+
invalidate: () => {
|
|
529
|
+
this.lastRenderKey = "";
|
|
530
|
+
},
|
|
531
|
+
dispose: () => {
|
|
532
|
+
if (this.tui !== tui) return;
|
|
533
|
+
this.widgetRegistered = false;
|
|
534
|
+
this.tui = undefined;
|
|
535
|
+
},
|
|
536
|
+
};
|
|
537
|
+
}, { placement: this.placement });
|
|
538
|
+
this.widgetRegistered = true;
|
|
539
|
+
this.lastRenderKey = renderKey;
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (renderKey === this.lastRenderKey) return;
|
|
543
|
+
this.lastRenderKey = renderKey;
|
|
544
|
+
this.tui?.requestRender();
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
handleKey(data: string): { consume?: boolean; data?: string } | undefined {
|
|
548
|
+
if (this.state.widgetsSuspended) return undefined;
|
|
549
|
+
const ctx = this.getActiveUiContext();
|
|
550
|
+
if (!ctx || this.entries.length === 0 || isKeyRelease(data)) return undefined;
|
|
551
|
+
if (this.inspectorOpen) return undefined;
|
|
552
|
+
if (!this.editorHasFocus()) {
|
|
553
|
+
if (this.active) this.deactivate();
|
|
554
|
+
return undefined;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
if (!this.active) {
|
|
558
|
+
const activates = matchesKey(data, "down") || matchesKey(data, "left");
|
|
559
|
+
if (!activates || ctx.ui.getEditorText() !== "") return undefined;
|
|
560
|
+
this.active = true;
|
|
561
|
+
this.selectedKey = "main";
|
|
562
|
+
this.refresh();
|
|
563
|
+
return { consume: true };
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
const roster = this.rosterKeys();
|
|
567
|
+
const selectedIndex = Math.max(0, roster.indexOf(this.selectedKey));
|
|
568
|
+
if (matchesKey(data, "down") || matchesKey(data, "j")) {
|
|
569
|
+
this.selectedKey = roster[Math.min(roster.length - 1, selectedIndex + 1)] ?? "main";
|
|
570
|
+
this.refresh();
|
|
571
|
+
return { consume: true };
|
|
572
|
+
}
|
|
573
|
+
if (matchesKey(data, "up") || matchesKey(data, "k")) {
|
|
574
|
+
if (selectedIndex === 0) {
|
|
575
|
+
this.deactivate();
|
|
576
|
+
return { consume: true };
|
|
577
|
+
}
|
|
578
|
+
this.selectedKey = roster[selectedIndex - 1] ?? "main";
|
|
579
|
+
this.refresh();
|
|
580
|
+
return { consume: true };
|
|
581
|
+
}
|
|
582
|
+
if (matchesKey(data, "escape")) {
|
|
583
|
+
this.deactivate();
|
|
584
|
+
return { consume: true };
|
|
585
|
+
}
|
|
586
|
+
if (matchesKey(data, Key.enter)) {
|
|
587
|
+
if (this.selectedKey === "main") {
|
|
588
|
+
this.deactivate();
|
|
589
|
+
return { consume: true };
|
|
590
|
+
}
|
|
591
|
+
this.inspectorOpen = true;
|
|
592
|
+
this.refresh();
|
|
593
|
+
const selectedKey = this.selectedKey;
|
|
594
|
+
void Promise.resolve()
|
|
595
|
+
.then(() => this.openInspector(selectedKey))
|
|
596
|
+
.catch((error) => ctx.ui.notify(error instanceof Error ? error.message : String(error), "error"))
|
|
597
|
+
.finally(() => {
|
|
598
|
+
this.inspectorOpen = false;
|
|
599
|
+
this.refresh();
|
|
600
|
+
});
|
|
601
|
+
return { consume: true };
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
this.deactivate();
|
|
605
|
+
return undefined;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
render(width: number, theme: Theme): string[] {
|
|
609
|
+
if (!this.hasInlineSurface()) return [];
|
|
610
|
+
if (!this.active) {
|
|
611
|
+
const workEntries = this.entries.filter((entry) => !entry.surface);
|
|
612
|
+
const projectEntries = this.entries.filter((entry) => entry.surface === "project-pane");
|
|
613
|
+
const tokens = workEntries.reduce((total, entry) => total + entry.tokens, 0);
|
|
614
|
+
const capacity = this.state.activeAsyncCapacity;
|
|
615
|
+
const hasNativeRows = workEntries.some((entry) => !entry.external);
|
|
616
|
+
const showNativeSummary = hasNativeRows || Boolean(capacity?.used);
|
|
617
|
+
const asyncRuns = capacity && showNativeSummary ? `Async runs ${capacity.used}/${capacity.limit || "∞"}` : "";
|
|
618
|
+
const activeEntries = activeLeafAgentCount(workEntries);
|
|
619
|
+
const noun = workEntries.some((entry) => entry.external) ? "job" : "agent";
|
|
620
|
+
const agents = activeEntries > 0 ? `${activeEntries} active ${noun}${activeEntries === 1 ? "" : "s"}` : "";
|
|
621
|
+
const paneAttention = projectEntries.filter((entry) => entry.projectPane && projectPaneNeedsAttention(entry.projectPane)).length;
|
|
622
|
+
const panes = projectEntries.length > 0 ? `${projectEntries.length} pane${projectEntries.length === 1 ? "" : "s"}${paneAttention ? ` (${paneAttention} ⚠)` : ""}` : "";
|
|
623
|
+
const label = [agents, asyncRuns, panes].filter(Boolean).join(" · ");
|
|
624
|
+
const detail = [showNativeSummary ? formatFleetTokens(tokens) : undefined, "↓/← to inspect"].filter(Boolean).join(" · ");
|
|
625
|
+
return [truncateToWidth(` ${theme.fg("muted", label)}${label && detail ? " · " : ""}${theme.fg("dim", detail)}`, width)];
|
|
626
|
+
}
|
|
627
|
+
const roster = this.rosterKeys();
|
|
628
|
+
const selectedIndex = Math.max(0, roster.indexOf(this.selectedKey));
|
|
629
|
+
const lines = [truncateToWidth(` ${theme.fg("dim", "↑↓/jk select · enter inspect · esc back")}`, width), ""];
|
|
630
|
+
lines.push(truncateToWidth(` ${this.bullet(0, selectedIndex, theme)} main`, width));
|
|
631
|
+
|
|
632
|
+
const workEntries = this.entries.filter((entry) => !entry.surface);
|
|
633
|
+
const tree = fleetTreeRows(workEntries);
|
|
634
|
+
const selectedTreeIndex = Math.max(0, tree.findIndex((row) => (row.kind === "owner" || row.kind === "child") && row.entry.key === this.selectedKey));
|
|
635
|
+
const visibleCount = Math.min(this.maxAgentRows, tree.length);
|
|
636
|
+
const start = selectedTreeIndex < visibleCount ? 0 : selectedTreeIndex - visibleCount + 1;
|
|
637
|
+
const hiddenBelow = tree.length - (start + visibleCount);
|
|
638
|
+
if (start > 0) lines.push(rightAlign("", theme.fg("dim", `↑ ${start} more`), width));
|
|
639
|
+
for (let index = start; index < start + visibleCount; index++) {
|
|
640
|
+
const row = tree[index]!;
|
|
641
|
+
if (row.kind === "owner" || row.kind === "child") {
|
|
642
|
+
const ownerIndex = this.entries.findIndex((entry) => entry.key === row.entry.key);
|
|
643
|
+
lines.push(this.renderEntry(ownerIndex + 1, selectedIndex, row.entry, width, theme, row.kind === "child" ? (row.last ? "└─" : "├─") : undefined));
|
|
644
|
+
} else if (row.kind === "workflow") {
|
|
645
|
+
lines.push(this.renderWorkflowRow(row.row, row.last, width, theme));
|
|
646
|
+
} else {
|
|
647
|
+
lines.push(this.renderNestedRow(row.row, row.last, width, theme));
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
if (hiddenBelow > 0) lines.push(rightAlign("", theme.fg("dim", `↓ ${hiddenBelow} more`), width));
|
|
651
|
+
this.renderProjectPaneSection(lines, selectedIndex, width, theme);
|
|
652
|
+
return lines;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
private renderProjectPaneSection(lines: string[], selectedIndex: number, width: number, theme: Theme): void {
|
|
656
|
+
const entries = this.entries.filter((entry) => entry.surface === "project-pane");
|
|
657
|
+
if (!entries.length) return;
|
|
658
|
+
lines.push("", truncateToWidth(` ${theme.fg("dim", "project panes")}`, width));
|
|
659
|
+
for (const entry of entries) {
|
|
660
|
+
const rosterIndex = this.entries.findIndex((candidate) => candidate.key === entry.key) + 1;
|
|
661
|
+
lines.push(this.renderEntry(rosterIndex, selectedIndex, entry, width, theme));
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
private renderEntry(rosterIndex: number, selectedIndex: number, entry: FleetStatusEntry, width: number, theme: Theme, branch?: string): string {
|
|
667
|
+
const agent = entry.modelThinking ? `${entry.agent} (${entry.modelThinking})` : entry.agent;
|
|
668
|
+
const prefix = branch ? ` ${branch}` : " ";
|
|
669
|
+
const left = `${prefix} ${this.bullet(rosterIndex, selectedIndex, theme)} ${theme.fg("muted", agent)} · ${entry.state}`;
|
|
670
|
+
const elapsed = Date.now() - entry.startedAt;
|
|
671
|
+
const rightText = entry.projectPane
|
|
672
|
+
? `${entry.projectPane.summary ?? "—"} · ${formatFleetElapsed(Date.now() - entry.projectPane.refreshedAt)} ago`
|
|
673
|
+
: entry.external ? formatFleetElapsed(elapsed) : `${formatFleetElapsed(elapsed)} · ${formatFleetTokens(entry.tokens)}`;
|
|
674
|
+
const right = theme.fg("dim", rightText);
|
|
675
|
+
return rightAlign(left, right, width);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
private renderNestedRow(row: FleetNestedRow, last: boolean, width: number, theme: Theme): string {
|
|
679
|
+
const marker = last ? "└─" : "├─";
|
|
680
|
+
const indent = " ".repeat(row.depth + 1);
|
|
681
|
+
if (row.overflow !== undefined) return truncateToWidth(`${indent}${marker} ${theme.fg("dim", `+${row.overflow} nested leaves`)}`, width);
|
|
682
|
+
const modelThinking = row.modelThinking ? ` (${row.modelThinking})` : "";
|
|
683
|
+
const activity = row.activity ? ` · ${row.activity}` : "";
|
|
684
|
+
const left = `${indent}${marker} ${nestedStatusGlyph(row.state, theme)} ${theme.fg("muted", `${row.name}${modelThinking}`)} · ${row.state}${activity}`;
|
|
685
|
+
const elapsed = row.startedAt !== undefined ? ` · ${formatFleetElapsed(Date.now() - row.startedAt)}` : "";
|
|
686
|
+
return truncateToWidth(`${left}${theme.fg("dim", elapsed)}`, width);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
private renderWorkflowRow(row: FleetWorkflowRow, last: boolean, width: number, theme: Theme): string {
|
|
690
|
+
const marker = last ? "└─" : "├─";
|
|
691
|
+
const indent = " ";
|
|
692
|
+
if (row.overflow !== undefined) return truncateToWidth(`${indent}${marker} ${theme.fg("dim", `+${row.overflow} hidden workflow steps`)}`, width);
|
|
693
|
+
const modelThinking = row.modelThinking ? ` (${row.modelThinking})` : "";
|
|
694
|
+
const activity = row.activity ? ` · ${row.activity}` : "";
|
|
695
|
+
const left = `${indent}${marker} ${nestedStatusGlyph(row.state, theme)} ${theme.fg("muted", `${row.name}${modelThinking}`)} · ${row.state}${activity}`;
|
|
696
|
+
const details = [
|
|
697
|
+
row.startedAt !== undefined ? formatFleetElapsed(Date.now() - row.startedAt) : undefined,
|
|
698
|
+
row.tokens !== undefined ? formatFleetTokens(row.tokens) : undefined,
|
|
699
|
+
].filter(Boolean).join(" · ");
|
|
700
|
+
return truncateToWidth(`${left}${details ? theme.fg("dim", ` · ${details}`) : ""}`, width);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
private bullet(rosterIndex: number, selectedIndex: number, theme: Theme): string {
|
|
704
|
+
return rosterIndex === selectedIndex ? theme.fg("accent", ">") : " ";
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
private rosterKeys(): string[] {
|
|
708
|
+
return ["main", ...this.entries.map((entry) => entry.key)];
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
private clampSelection(): void {
|
|
712
|
+
if (!this.rosterKeys().includes(this.selectedKey)) this.selectedKey = "main";
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
private deactivate(): void {
|
|
716
|
+
this.active = false;
|
|
717
|
+
this.selectedKey = "main";
|
|
718
|
+
this.refresh();
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
private editorHasFocus(): boolean {
|
|
722
|
+
// pi-tui exposes focus mutation but no focus getter, so inspect the focused
|
|
723
|
+
// component structurally. instanceof is unreliable across jiti module boundaries.
|
|
724
|
+
const focused = (this.tui as unknown as { focusedComponent?: unknown } | undefined)?.focusedComponent;
|
|
725
|
+
if (!focused || typeof focused !== "object") return false;
|
|
726
|
+
const candidate = focused as Partial<EditorComponent>;
|
|
727
|
+
return typeof candidate.render === "function"
|
|
728
|
+
&& typeof candidate.invalidate === "function"
|
|
729
|
+
&& typeof candidate.handleInput === "function"
|
|
730
|
+
&& typeof candidate.getText === "function"
|
|
731
|
+
&& typeof candidate.setText === "function";
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
private getRenderKey(): string {
|
|
735
|
+
const now = Date.now();
|
|
736
|
+
return JSON.stringify({
|
|
737
|
+
active: this.active,
|
|
738
|
+
selected: this.selectedKey,
|
|
739
|
+
inspectorOpen: this.inspectorOpen,
|
|
740
|
+
entries: this.entries.map((entry) => this.active
|
|
741
|
+
? [
|
|
742
|
+
entry.key,
|
|
743
|
+
entry.surface,
|
|
744
|
+
entry.parentKey,
|
|
745
|
+
entry.agent,
|
|
746
|
+
entry.state,
|
|
747
|
+
entry.modelThinking,
|
|
748
|
+
entry.description,
|
|
749
|
+
entry.external,
|
|
750
|
+
Math.round((now - entry.startedAt) / 1000),
|
|
751
|
+
entry.tokens,
|
|
752
|
+
visibleWorkflowRows(entry.workflowRows, entry.parentKey ? 2 : 4).map((row) => [
|
|
753
|
+
row.name,
|
|
754
|
+
row.state,
|
|
755
|
+
row.modelThinking,
|
|
756
|
+
row.activity,
|
|
757
|
+
row.startedAt,
|
|
758
|
+
row.tokens,
|
|
759
|
+
row.overflow,
|
|
760
|
+
]),
|
|
761
|
+
nestedFleetRows(entry.nestedChildren, entry.parentKey ? 3 : 4).map((row) => [
|
|
762
|
+
row.name,
|
|
763
|
+
row.state,
|
|
764
|
+
row.modelThinking,
|
|
765
|
+
row.activity,
|
|
766
|
+
row.startedAt,
|
|
767
|
+
row.depth,
|
|
768
|
+
row.overflow,
|
|
769
|
+
]),
|
|
770
|
+
]
|
|
771
|
+
: [entry.key, entry.state, entry.external, entry.surface, entry.tokens, entry.projectPane?.refreshedAt, entry.projectPane?.summary]),
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
private hasInlineSurface(): boolean {
|
|
776
|
+
return this.entries.length > 0 || Boolean(this.state.activeAsyncCapacity?.used);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
private getActiveUiContext(): ExtensionContext | undefined {
|
|
780
|
+
const ctx = this.ctx;
|
|
781
|
+
if (!ctx) return undefined;
|
|
782
|
+
try {
|
|
783
|
+
return ctx.hasUI ? ctx : undefined;
|
|
784
|
+
} catch (error) {
|
|
785
|
+
if (!isStaleExtensionContextError(error)) throw error;
|
|
786
|
+
this.clearUiRegistration();
|
|
787
|
+
return undefined;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
private clearWidget(): void {
|
|
792
|
+
if (!this.widgetRegistered) return;
|
|
793
|
+
this.ui?.setWidget(FLEET_STATUS_WIDGET_KEY, undefined);
|
|
794
|
+
this.widgetRegistered = false;
|
|
795
|
+
this.tui = undefined;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
private clearUiRegistration(): void {
|
|
799
|
+
if (this.timer) clearInterval(this.timer);
|
|
800
|
+
this.timer = undefined;
|
|
801
|
+
|
|
802
|
+
const inputUnsubscribe = this.inputUnsubscribe;
|
|
803
|
+
const ui = this.ui;
|
|
804
|
+
const widgetRegistered = this.widgetRegistered;
|
|
805
|
+
this.inputUnsubscribe = undefined;
|
|
806
|
+
this.ctx = undefined;
|
|
807
|
+
this.ui = undefined;
|
|
808
|
+
this.widgetRegistered = false;
|
|
809
|
+
this.tui = undefined;
|
|
810
|
+
|
|
811
|
+
const cleanupErrors: unknown[] = [];
|
|
812
|
+
try {
|
|
813
|
+
inputUnsubscribe?.();
|
|
814
|
+
} catch (error) {
|
|
815
|
+
if (!isStaleExtensionContextError(error)) cleanupErrors.push(error);
|
|
816
|
+
}
|
|
817
|
+
if (ui && widgetRegistered) {
|
|
818
|
+
try {
|
|
819
|
+
ui.setWidget(FLEET_STATUS_WIDGET_KEY, undefined);
|
|
820
|
+
} catch (error) {
|
|
821
|
+
if (!isStaleExtensionContextError(error)) cleanupErrors.push(error);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
if (cleanupErrors.length === 1) throw cleanupErrors[0];
|
|
825
|
+
if (cleanupErrors.length > 1) {
|
|
826
|
+
throw new AggregateError(cleanupErrors, "Failed to clean up FleetView UI registration");
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|