@selesai/code 0.8.3 → 0.8.4
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 +5 -0
- package/dist/extensions/handoff-new.ts +1 -1
- package/dist/extensions/inline-skills.test.ts +1 -0
- package/dist/extensions/inline-skills.ts +1 -1
- package/dist/extensions/pi-intercom/CHANGELOG.md +25 -3
- package/dist/extensions/pi-intercom/README.md +34 -15
- package/dist/extensions/pi-intercom/broker/broker.ts +38 -141
- package/dist/extensions/pi-intercom/broker/client-liveness.test.ts +173 -0
- package/dist/extensions/pi-intercom/broker/client.ts +78 -150
- package/dist/extensions/pi-intercom/broker/extension-state.ts +18 -7
- package/dist/extensions/pi-intercom/broker/framing.ts +1 -1
- package/dist/extensions/pi-intercom/broker/protocol.ts +182 -0
- package/dist/extensions/pi-intercom/broker/spawn.test.ts +106 -7
- package/dist/extensions/pi-intercom/broker/spawn.ts +37 -11
- package/dist/extensions/pi-intercom/config.test.ts +8 -10
- package/dist/extensions/pi-intercom/config.ts +3 -3
- package/dist/extensions/pi-intercom/index.ts +218 -147
- package/dist/extensions/pi-intercom/intercom.integration.test.ts +891 -103
- package/dist/extensions/pi-intercom/package.json +3 -2
- package/dist/extensions/pi-intercom/project-agent.test.ts +145 -0
- package/dist/extensions/pi-intercom/project-agent.ts +324 -0
- package/dist/extensions/pi-intercom/reply-tracker.test.ts +86 -1
- package/dist/extensions/pi-intercom/reply-tracker.ts +41 -9
- package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +49 -9
- package/dist/extensions/pi-intercom/test/inline-message.test.ts +9 -9
- package/dist/extensions/pi-intercom/types.ts +3 -1
- package/dist/extensions/pi-intercom/ui/inline-message.ts +7 -7
- package/dist/extensions/pi-powerline-footer/.github/workflows/test.yml +2 -2
- package/dist/extensions/pi-powerline-footer/CHANGELOG.md +14 -1
- package/dist/extensions/pi-powerline-footer/README.md +20 -37
- package/dist/extensions/pi-powerline-footer/bash-mode/completion.ts +40 -25
- package/dist/extensions/pi-powerline-footer/bash-mode/editor.ts +149 -18
- package/dist/extensions/pi-powerline-footer/bash-mode/types.ts +1 -0
- package/dist/extensions/pi-powerline-footer/editor-performance.ts +99 -0
- package/dist/extensions/pi-powerline-footer/git-status.ts +15 -0
- package/dist/extensions/pi-powerline-footer/index.ts +394 -317
- package/dist/extensions/pi-powerline-footer/package.json +1 -1
- package/dist/extensions/pi-powerline-footer/powerline-config.ts +0 -12
- package/dist/extensions/pi-powerline-footer/queue/store.ts +8 -56
- package/dist/extensions/pi-powerline-footer/queue/types.ts +1 -2
- package/dist/extensions/pi-powerline-footer/segments.ts +0 -3
- package/dist/extensions/pi-powerline-footer/tests/bash-mode.test.ts +231 -1
- package/dist/extensions/pi-powerline-footer/tests/custom-items.test.ts +5 -19
- package/dist/extensions/pi-powerline-footer/tests/editor-performance.test.ts +43 -0
- package/dist/extensions/pi-powerline-footer/tests/git-optional-locks.test.ts +64 -0
- package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +116 -0
- package/dist/extensions/pi-powerline-footer/tests/queue-store.test.ts +19 -149
- package/dist/extensions/pi-powerline-footer/tests/remaining-regressions.test.ts +6 -0
- package/dist/extensions/pi-powerline-footer/tests/usage-display.test.ts +5 -5
- package/dist/extensions/pi-powerline-footer/types.ts +1 -2
- package/dist/extensions/pi-subagents/CHANGELOG.md +202 -14
- package/dist/extensions/pi-subagents/README.md +65 -1614
- package/dist/extensions/pi-subagents/agents/builder.md +0 -1
- package/dist/extensions/pi-subagents/agents/delegate.md +14 -0
- package/dist/extensions/pi-subagents/agents/oracle.md +74 -0
- package/dist/extensions/pi-subagents/agents/reviewer.md +78 -0
- package/dist/extensions/pi-subagents/agents/scout.md +50 -0
- package/dist/extensions/pi-subagents/agents/worker.md +58 -0
- package/dist/extensions/pi-subagents/docs/configuration.md +328 -0
- package/dist/extensions/pi-subagents/docs/extension-api.md +308 -0
- package/dist/extensions/pi-subagents/docs/missions.md +119 -0
- package/dist/extensions/pi-subagents/docs/models.md +192 -0
- package/dist/extensions/pi-subagents/docs/observability.md +174 -0
- package/dist/extensions/pi-subagents/docs/tool-reference.md +343 -0
- package/dist/extensions/pi-subagents/docs/watchdog.md +176 -0
- package/dist/extensions/pi-subagents/docs/workflows.md +163 -0
- package/dist/extensions/pi-subagents/inspector-runner.mjs +11 -0
- package/dist/extensions/pi-subagents/package-lock.json +152 -194
- package/dist/extensions/pi-subagents/package.json +9 -10
- package/dist/extensions/pi-subagents/prompts/gather-context-and-clarify.md +1 -1
- package/dist/extensions/pi-subagents/prompts/parallel-cleanup.md +9 -9
- package/dist/extensions/pi-subagents/prompts/parallel-research.md +6 -6
- package/dist/extensions/pi-subagents/prompts/parallel-review.md +8 -8
- package/dist/extensions/pi-subagents/prompts/review-loop.md +12 -12
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +22 -17
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +77 -72
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +177 -69
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +28 -8
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +88 -66
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +3 -3
- package/dist/extensions/pi-subagents/src/agents/agent-refinements.ts +624 -0
- package/dist/extensions/pi-subagents/src/agents/agents.ts +29 -16
- package/dist/extensions/pi-subagents/src/agents/frontmatter.ts +7 -3
- package/dist/extensions/pi-subagents/src/agents/proactive-skills.ts +2 -2
- package/dist/extensions/pi-subagents/src/agents/skills.ts +2 -9
- package/dist/extensions/pi-subagents/src/api/delegation.ts +1 -2
- package/dist/extensions/pi-subagents/src/api/project-panes.ts +30 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +56 -8
- package/dist/extensions/pi-subagents/src/extension/control-notices.ts +2 -2
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +51 -26
- package/dist/extensions/pi-subagents/src/extension/index.ts +119 -50
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +72 -0
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +15 -15
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +58 -21
- package/dist/extensions/pi-subagents/src/extension/subagent-guide.ts +39 -0
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +47 -25
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +3 -3
- package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +460 -64
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +102 -4
- package/dist/extensions/pi-subagents/src/missions/actions.ts +77 -16
- package/dist/extensions/pi-subagents/src/missions/goal-driver.ts +162 -0
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +65 -14
- package/dist/extensions/pi-subagents/src/missions/store.ts +147 -5
- package/dist/extensions/pi-subagents/src/missions/types.ts +58 -3
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +256 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +8 -8
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +42 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +41 -7
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +294 -134
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +19 -3
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +39 -6
- package/dist/extensions/pi-subagents/src/runs/background/completion-replay.ts +267 -0
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +145 -60
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +114 -6
- package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +33 -0
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +68 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +71 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +21 -2
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +42 -14
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +12 -24
- package/dist/extensions/pi-subagents/src/runs/background/steering.ts +7 -5
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +152 -68
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +17 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +146 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +21 -5
- package/dist/extensions/pi-subagents/src/runs/foreground/async-dismiss-action.ts +85 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +43 -18
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +20 -19
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +3 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +55 -26
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +137 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +798 -112
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +187 -0
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +165 -22
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +9 -5
- package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +12 -2
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +1 -0
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +465 -116
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +10 -10
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +189 -32
- package/dist/extensions/pi-subagents/src/runs/shared/task-intent.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +3 -3
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +128 -3
- package/dist/extensions/pi-subagents/src/shared/display-text.ts +100 -0
- package/dist/extensions/pi-subagents/src/shared/file-coalescer.ts +9 -0
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +13 -0
- package/dist/extensions/pi-subagents/src/shared/formatters.ts +4 -6
- package/dist/extensions/pi-subagents/src/shared/prompt-resources.ts +51 -0
- package/dist/extensions/pi-subagents/src/shared/settings.ts +41 -11
- package/dist/extensions/pi-subagents/src/shared/types.ts +100 -3
- package/dist/extensions/pi-subagents/src/shared/utf8.ts +11 -0
- package/dist/extensions/pi-subagents/src/shared/utils.ts +43 -33
- package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +1 -14
- package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +1 -1
- package/dist/extensions/pi-subagents/src/slash/prompt-template-bridge.ts +14 -12
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +176 -21
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +12 -6
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +52 -18
- package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +36 -5
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +30 -16
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +151 -31
- package/dist/extensions/pi-subagents/src/tui/render.ts +201 -68
- package/dist/extensions/pi-subagents/src/types/pi-runtime-compat.d.ts +0 -6
- package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +5 -4
- package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +0 -1
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +313 -25
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +15 -15
- 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 +84 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/package.json +14 -0
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +15 -15
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +411 -300
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +309 -123
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +99 -56
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +62 -16
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +159 -108
- package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +4 -2
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +56 -56
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +114 -45
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +57 -19
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +106 -106
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +416 -106
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +287 -17
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +809 -87
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +107 -20
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +26 -6
- package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/support/helpers.ts +2 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +1 -1
- package/dist/extensions/pi-subagents/test/support/ts-loader.mjs +0 -8
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +163 -58
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +15 -15
- package/dist/extensions/pi-subagents/test/unit/agent-eject-disable.test.ts +66 -66
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +334 -248
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +52 -52
- package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +26 -26
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +99 -99
- package/dist/extensions/pi-subagents/test/unit/agent-refinements.test.ts +160 -0
- package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +43 -1
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +36 -10
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +387 -30
- package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +94 -40
- package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +5 -3
- package/dist/extensions/pi-subagents/test/unit/builtin-agent-documentation.test.ts +7 -7
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +19 -19
- package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +19 -19
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +20 -20
- package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +35 -5
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +52 -52
- package/dist/extensions/pi-subagents/test/unit/completion-replay.test.ts +187 -0
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +125 -71
- package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +18 -3
- package/dist/extensions/pi-subagents/test/unit/default-extensions.test.ts +12 -12
- package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +17 -23
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +25 -25
- package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/file-coalescer.test.ts +15 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +62 -44
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +329 -37
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/foreground-tool-call-compaction.test.ts +37 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector-bootstrap.test.ts +69 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +79 -2
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +102 -49
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +98 -32
- package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +5 -5
- package/dist/extensions/pi-subagents/test/unit/mission-goal-driver.test.ts +116 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +55 -7
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +289 -13
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +28 -1
- package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +11 -2
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +84 -10
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +122 -8
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +24 -24
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +16 -2
- package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +7 -7
- package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/path-resolution.test.ts +26 -17
- package/dist/extensions/pi-subagents/test/unit/pi-args-permission-system.test.ts +405 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +357 -92
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +22 -6
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +6 -6
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +43 -43
- package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/process-terminal.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +19 -19
- package/dist/extensions/pi-subagents/test/unit/project-panes-public-api.test.ts +243 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +68 -168
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +58 -15
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +40 -0
- package/dist/extensions/pi-subagents/test/unit/reads-resolution.test.ts +66 -0
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +47 -28
- package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +12 -12
- package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +57 -0
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +107 -27
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +56 -50
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +69 -28
- package/dist/extensions/pi-subagents/test/unit/scheduled-store-root.test.ts +67 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +59 -44
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +424 -49
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +23 -1
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +32 -5
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +120 -91
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +85 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +35 -35
- package/dist/extensions/pi-subagents/test/unit/subagent-guide.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +312 -22
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +150 -15
- package/dist/extensions/pi-subagents/test/unit/task-intent.test.ts +26 -26
- package/dist/extensions/pi-subagents/test/unit/timeout-defaults.test.ts +73 -0
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +76 -25
- package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +5 -5
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +55 -6
- package/dist/extensions/pi-subagents/test/unit/watchdog-child-status.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/watchdog-lsp-diagnostics.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-runtime.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-settings.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +6 -6
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +138 -11
- package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +113 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +7 -7
- package/dist/extensions/pi-subagents/test/unit/writer-budget-guidance.test.ts +6 -6
- package/dist/extensions/workflow/extension.ts +21 -19
- package/dist/extensions/workflow/modes.ts +65 -0
- package/dist/skills/pi-subagents/SKILL.md +20 -15
- package/dist/skills/pi-subagents/references/constraints-and-recipes.md +77 -83
- package/dist/skills/pi-subagents/references/execution-controls.md +215 -106
- package/dist/skills/pi-subagents/references/management-authoring-rpc.md +29 -9
- package/dist/skills/pi-subagents/references/prompting-and-roles.md +58 -43
- package/docs/plans/workflow-autoloop-reference.md +192 -0
- package/docs/plans/workflow-subagent-consolidation-planb.md +374 -0
- package/docs/plans/workflow-subagent-scripted-merge.md +406 -0
- package/package.json +1 -1
- package/dist/extensions/workflow/adapter.ts +0 -949
- package/dist/extensions/workflow/modes/loop.ts +0 -74
- package/dist/extensions/workflow/modes/prototype.ts +0 -170
- package/dist/extensions/workflow/modes/quicktype.ts +0 -150
- package/dist/extensions/workflow/modes/task.ts +0 -105
- package/dist/extensions/workflow/run-state.ts +0 -124
- package/dist/extensions/workflow/state-machine.ts +0 -484
- package/dist/extensions/workflow/validators.ts +0 -42
|
@@ -6,6 +6,7 @@ import * as fs from "node:fs";
|
|
|
6
6
|
import * as os from "node:os";
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
import type { Message } from "@earendil-works/pi-ai";
|
|
9
|
+
import { previewDisplayText, sanitizeDisplayText, truncateDisplayText } from "./display-text.ts";
|
|
9
10
|
import { formatToolCall } from "./formatters.ts";
|
|
10
11
|
import type { AgentProgress, AsyncStatus, Details, DisplayItem, ErrorInfo, NestedRunSummary, SingleResult, ToolCallSummary, Usage } from "./types.ts";
|
|
11
12
|
|
|
@@ -101,6 +102,23 @@ export function getAgentDir(): string {
|
|
|
101
102
|
|
|
102
103
|
const statusCache = new Map<string, { mtime: number; ctime: number; size: number; ino: number; status: AsyncStatus }>();
|
|
103
104
|
|
|
105
|
+
export function pruneStatusCacheForAsyncRoot(asyncDirRoot: string, runIds: Iterable<string>): number {
|
|
106
|
+
const root = path.resolve(asyncDirRoot);
|
|
107
|
+
const currentStatusPaths = new Set(
|
|
108
|
+
Array.from(runIds, (runId) => path.resolve(root, runId, "status.json")),
|
|
109
|
+
);
|
|
110
|
+
let removed = 0;
|
|
111
|
+
for (const statusPath of statusCache.keys()) {
|
|
112
|
+
const resolved = path.resolve(statusPath);
|
|
113
|
+
const relative = path.relative(root, resolved);
|
|
114
|
+
if (relative && !relative.startsWith("..") && !path.isAbsolute(relative) && !currentStatusPaths.has(resolved)) {
|
|
115
|
+
statusCache.delete(statusPath);
|
|
116
|
+
removed++;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return removed;
|
|
120
|
+
}
|
|
121
|
+
|
|
104
122
|
function getErrorMessage(error: unknown): string {
|
|
105
123
|
return error instanceof Error ? error.message : String(error);
|
|
106
124
|
}
|
|
@@ -127,7 +145,10 @@ export function readStatus(asyncDir: string): AsyncStatus | null {
|
|
|
127
145
|
try {
|
|
128
146
|
stat = fs.statSync(statusPath);
|
|
129
147
|
} catch (error) {
|
|
130
|
-
if (isNotFoundError(error))
|
|
148
|
+
if (isNotFoundError(error)) {
|
|
149
|
+
statusCache.delete(statusPath);
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
131
152
|
throw new Error(`Failed to inspect async status file '${statusPath}': ${getErrorMessage(error)}`, {
|
|
132
153
|
cause: error instanceof Error ? error : undefined,
|
|
133
154
|
});
|
|
@@ -148,7 +169,10 @@ export function readStatus(asyncDir: string): AsyncStatus | null {
|
|
|
148
169
|
try {
|
|
149
170
|
content = fs.readFileSync(statusPath, "utf-8");
|
|
150
171
|
} catch (error) {
|
|
151
|
-
if (isNotFoundError(error))
|
|
172
|
+
if (isNotFoundError(error)) {
|
|
173
|
+
statusCache.delete(statusPath);
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
152
176
|
throw new Error(`Failed to read async status file '${statusPath}': ${getErrorMessage(error)}`, {
|
|
153
177
|
cause: error instanceof Error ? error : undefined,
|
|
154
178
|
});
|
|
@@ -170,10 +194,6 @@ export function readStatus(asyncDir: string): AsyncStatus | null {
|
|
|
170
194
|
ino: stat.ino,
|
|
171
195
|
status,
|
|
172
196
|
});
|
|
173
|
-
if (statusCache.size > 50) {
|
|
174
|
-
const firstKey = statusCache.keys().next().value;
|
|
175
|
-
if (firstKey) statusCache.delete(firstKey);
|
|
176
|
-
}
|
|
177
197
|
return status;
|
|
178
198
|
}
|
|
179
199
|
|
|
@@ -522,11 +542,8 @@ export function detectSubagentError(messages: Message[]): ErrorInfo {
|
|
|
522
542
|
* Extract a preview of tool arguments for display
|
|
523
543
|
*/
|
|
524
544
|
export function extractToolArgsPreview(args: Record<string, unknown>): string {
|
|
525
|
-
const truncatePreview = (value: string, maxLength: number): string =>
|
|
526
|
-
value.length > maxLength ? `${value.slice(0, maxLength - 3)}...` : value;
|
|
527
|
-
|
|
528
545
|
const stringifyPreviewValue = (value: unknown): string | undefined => {
|
|
529
|
-
if (typeof value === "string" && value.trim().length > 0) return value;
|
|
546
|
+
if (typeof value === "string" && value.trim().length > 0) return sanitizeDisplayText(value);
|
|
530
547
|
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
531
548
|
return undefined;
|
|
532
549
|
};
|
|
@@ -539,39 +556,32 @@ export function extractToolArgsPreview(args: Record<string, unknown>): string {
|
|
|
539
556
|
return `${first}${suffix}`;
|
|
540
557
|
};
|
|
541
558
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
return `${server}${args.tool}${toolArgs}`;
|
|
559
|
+
if (typeof args.tool === "string") {
|
|
560
|
+
const server = typeof args.server === "string" ? `${sanitizeDisplayText(args.server)}/` : "";
|
|
561
|
+
const toolArgs = typeof args.args === "string" ? ` ${truncateDisplayText(sanitizeDisplayText(args.args), 40)}` : "";
|
|
562
|
+
return sanitizeDisplayText(`${server}${args.tool}${toolArgs}`);
|
|
547
563
|
}
|
|
548
564
|
|
|
549
565
|
const queriesPreview = previewArray(args.queries);
|
|
550
|
-
if (queriesPreview) return
|
|
551
|
-
if (typeof args.query === "string" && args.query.trim().length > 0) return
|
|
552
|
-
if (typeof args.workflow === "string" && args.workflow.trim().length > 0) return `workflow=${
|
|
566
|
+
if (queriesPreview) return previewDisplayText(queriesPreview, 60);
|
|
567
|
+
if (typeof args.query === "string" && args.query.trim().length > 0) return previewDisplayText(args.query, 60);
|
|
568
|
+
if (typeof args.workflow === "string" && args.workflow.trim().length > 0) return `workflow=${previewDisplayText(args.workflow, 48)}`;
|
|
553
569
|
|
|
554
|
-
if (typeof args.url === "string" && args.url.trim().length > 0) return
|
|
570
|
+
if (typeof args.url === "string" && args.url.trim().length > 0) return previewDisplayText(args.url, 60);
|
|
555
571
|
const urlsPreview = previewArray(args.urls);
|
|
556
|
-
if (urlsPreview) return
|
|
557
|
-
if (typeof args.prompt === "string" && args.prompt.trim().length > 0) return
|
|
558
|
-
|
|
572
|
+
if (urlsPreview) return previewDisplayText(urlsPreview, 60);
|
|
573
|
+
if (typeof args.prompt === "string" && args.prompt.trim().length > 0) return previewDisplayText(args.prompt, 60);
|
|
574
|
+
|
|
559
575
|
const previewKeys = ["command", "path", "file_path", "pattern", "query", "url", "task", "describe", "search"];
|
|
560
576
|
for (const key of previewKeys) {
|
|
561
|
-
if (
|
|
562
|
-
const value = args[key] as string;
|
|
563
|
-
return truncatePreview(value, 60);
|
|
564
|
-
}
|
|
577
|
+
if (typeof args[key] === "string") return previewDisplayText(args[key], 60);
|
|
565
578
|
}
|
|
566
|
-
|
|
567
|
-
// Fallback: show first string value found
|
|
579
|
+
|
|
568
580
|
for (const [key, value] of Object.entries(args)) {
|
|
581
|
+
const displayKey = sanitizeDisplayText(key);
|
|
569
582
|
const arrayPreview = previewArray(value);
|
|
570
|
-
if (arrayPreview) return `${
|
|
571
|
-
if (typeof value === "string" && value.length > 0) {
|
|
572
|
-
const preview = truncatePreview(value, 50);
|
|
573
|
-
return `${key}=${preview}`;
|
|
574
|
-
}
|
|
583
|
+
if (arrayPreview) return `${displayKey}=${previewDisplayText(arrayPreview, 50)}`;
|
|
584
|
+
if (typeof value === "string" && value.length > 0) return `${displayKey}=${previewDisplayText(value, 50)}`;
|
|
575
585
|
}
|
|
576
586
|
return "";
|
|
577
587
|
}
|
|
@@ -251,7 +251,7 @@ export function toDelegationUpdate(requestId: string, update: PromptTemplateBrid
|
|
|
251
251
|
: undefined;
|
|
252
252
|
return {
|
|
253
253
|
index: entry.index,
|
|
254
|
-
agent: entry.agent ?? "
|
|
254
|
+
agent: entry.agent ?? "delegate",
|
|
255
255
|
status: entry.status,
|
|
256
256
|
currentTool: entry.currentTool,
|
|
257
257
|
currentToolArgs: entry.currentToolArgs,
|
|
@@ -286,19 +286,6 @@ export function toDelegationUpdate(requestId: string, update: PromptTemplateBrid
|
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
export function toLegacyExecutionParams(request: PromptTemplateDelegationRequest): DelegatedSubagentExecutionParams {
|
|
290
|
-
return {
|
|
291
|
-
agent: request.agent,
|
|
292
|
-
task: request.task,
|
|
293
|
-
context: request.context,
|
|
294
|
-
model: request.model,
|
|
295
|
-
cwd: request.cwd,
|
|
296
|
-
async: false,
|
|
297
|
-
foregroundOnly: true,
|
|
298
|
-
clarify: false,
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
|
|
302
289
|
export function toSubagentDelegationExecutionParams(request: SubagentDelegationRequest): DelegatedSubagentExecutionParams {
|
|
303
290
|
return {
|
|
304
291
|
agent: request.agent,
|
|
@@ -103,7 +103,7 @@ export function createInlineSubagentAutocompleteProvider(
|
|
|
103
103
|
*/
|
|
104
104
|
export function registerInlineSubagentInvocation(pi: ExtensionAPI, state: SubagentState): void {
|
|
105
105
|
pi.on("session_start", (_event, ctx) => {
|
|
106
|
-
ctx.ui.addAutocompleteProvider((current) => createInlineSubagentAutocompleteProvider(state, current));
|
|
106
|
+
ctx.ui.addAutocompleteProvider?.((current) => createInlineSubagentAutocompleteProvider(state, current));
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
pi.on("input", (event, ctx) => {
|
|
@@ -12,7 +12,6 @@ import { parseSubagentDelegationRequest } from "./delegation-request.ts";
|
|
|
12
12
|
import {
|
|
13
13
|
parsePromptTemplateRequest,
|
|
14
14
|
toDelegationUpdate,
|
|
15
|
-
toLegacyExecutionParams,
|
|
16
15
|
toPromptTemplateResponse,
|
|
17
16
|
toSubagentDelegationExecutionParams,
|
|
18
17
|
toSubagentDelegationResponse,
|
|
@@ -183,22 +182,25 @@ export function registerPromptTemplateDelegationBridge<Ctx extends { cwd?: strin
|
|
|
183
182
|
} else {
|
|
184
183
|
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
185
184
|
const legacy = data as Record<string, unknown>;
|
|
186
|
-
if (legacy.tasks !== undefined || legacy.worktree !== undefined) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
});
|
|
194
|
-
}
|
|
185
|
+
if ((legacy.tasks !== undefined || legacy.worktree !== undefined) && typeof legacy.requestId === "string" && legacy.requestId) {
|
|
186
|
+
options.events.emit(PROMPT_TEMPLATE_SUBAGENT_RESPONSE_EVENT, {
|
|
187
|
+
requestId: legacy.requestId,
|
|
188
|
+
messages: [],
|
|
189
|
+
isError: true,
|
|
190
|
+
errorText: "Legacy prompt-template tasks/worktree orchestration was removed; use workflowScript.",
|
|
191
|
+
});
|
|
195
192
|
return;
|
|
196
193
|
}
|
|
197
194
|
}
|
|
198
195
|
legacyRequest = parsePromptTemplateRequest(data);
|
|
199
196
|
if (!legacyRequest) return;
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
options.events.emit(PROMPT_TEMPLATE_SUBAGENT_RESPONSE_EVENT, {
|
|
198
|
+
...legacyRequest,
|
|
199
|
+
messages: [],
|
|
200
|
+
isError: true,
|
|
201
|
+
errorText: "Legacy prompt-template direct delegation was removed; use workflowScript through the subagent tool or structured delegation.",
|
|
202
|
+
} satisfies PromptTemplateDelegationResponse);
|
|
203
|
+
return;
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
if (!structuredRequest && legacyControllers.has(requestId)) return;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
3
|
import type { ExtensionAPI, ExtensionContext } from "@selesai/code";
|
|
5
4
|
import { parseFrontmatter } from "../agents/frontmatter.ts";
|
|
5
|
+
import { discoverAgents, discoverAgentsAll, resolveAgentName, type ChainConfig, type ChainStepConfig } from "../agents/agents.ts";
|
|
6
6
|
import type { SubagentParamsLike } from "../runs/foreground/subagent-executor.ts";
|
|
7
|
-
import {
|
|
7
|
+
import type { ChainStep } from "../shared/settings.ts";
|
|
8
|
+
import { getPromptDirectories } from "../shared/prompt-resources.ts";
|
|
8
9
|
|
|
9
10
|
interface PromptWorkflow {
|
|
10
11
|
name: string;
|
|
@@ -32,21 +33,9 @@ const RESERVED_COMMAND_NAMES = new Set([
|
|
|
32
33
|
"subagents-models",
|
|
33
34
|
]);
|
|
34
35
|
|
|
35
|
-
function packagePromptsDir(): string {
|
|
36
|
-
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "prompts");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function promptDirs(cwd: string): string[] {
|
|
40
|
-
return [
|
|
41
|
-
packagePromptsDir(),
|
|
42
|
-
path.join(getAgentDir(), "prompts"),
|
|
43
|
-
path.join(getProjectConfigDir(cwd), "prompts"),
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
36
|
function readPromptFiles(cwd: string): string[] {
|
|
48
37
|
const files: string[] = [];
|
|
49
|
-
for (const dir of
|
|
38
|
+
for (const dir of Object.values(getPromptDirectories(cwd))) {
|
|
50
39
|
let entries: fs.Dirent[];
|
|
51
40
|
try {
|
|
52
41
|
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
@@ -85,7 +74,7 @@ function parseSkill(value: string | undefined): string | string[] | false | unde
|
|
|
85
74
|
|
|
86
75
|
function parseAgent(frontmatter: Record<string, string>): string {
|
|
87
76
|
const subagent = stringField(frontmatter, "subagent");
|
|
88
|
-
if (!subagent || subagent === "true") return "
|
|
77
|
+
if (!subagent || subagent === "true") return "delegate";
|
|
89
78
|
return subagent;
|
|
90
79
|
}
|
|
91
80
|
|
|
@@ -213,13 +202,19 @@ function workflowParams(workflow: PromptWorkflow, args: string[], runtime: Retur
|
|
|
213
202
|
return {
|
|
214
203
|
agent: runtime.agentOverride ?? workflow.agent,
|
|
215
204
|
task,
|
|
216
|
-
clarify: false,
|
|
217
205
|
agentScope: "both",
|
|
218
206
|
...(context ? { context } : {}),
|
|
219
207
|
...(workflow.model ? { model: workflow.model } : {}),
|
|
220
208
|
...(workflow.skill !== undefined ? { skill: workflow.skill } : {}),
|
|
221
209
|
...(workflow.cwd ? { cwd: workflow.cwd } : {}),
|
|
222
|
-
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function promptWorkflowExecutionParams(workflows: PromptWorkflow[], args: string[], runtime: ReturnType<typeof parseRuntimeOptions>): SubagentParamsLike {
|
|
214
|
+
return {
|
|
215
|
+
workflowScript: promptWorkflowScript(workflows, args, runtime),
|
|
216
|
+
agentScope: "both",
|
|
217
|
+
async: runtime.bg ? true : false,
|
|
223
218
|
};
|
|
224
219
|
}
|
|
225
220
|
|
|
@@ -228,7 +223,7 @@ function promptWorkflowScript(workflows: PromptWorkflow[], args: string[], runti
|
|
|
228
223
|
const params = workflowParams(workflow, args, runtime);
|
|
229
224
|
const task = params.task ?? "";
|
|
230
225
|
const child = {
|
|
231
|
-
agent: params.agent ?? "
|
|
226
|
+
agent: params.agent ?? "delegate",
|
|
232
227
|
task,
|
|
233
228
|
...(params.model ? { model: params.model } : {}),
|
|
234
229
|
...(params.skill !== undefined ? { skill: params.skill } : {}),
|
|
@@ -252,6 +247,75 @@ function formatWorkflowList(workflows: PromptWorkflow[]): string {
|
|
|
252
247
|
].join("\n");
|
|
253
248
|
}
|
|
254
249
|
|
|
250
|
+
// --- Selesai additions: native chain / parallel / saved-chain slash commands ---
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Parse `agent task | agent task | ...` into chain steps. Runtime flags
|
|
254
|
+
* (`--bg`, `--fork`, `--fresh`) are stripped before splitting on `|`.
|
|
255
|
+
*/
|
|
256
|
+
function parseStepList(input: string): { agent: string; task: string }[] {
|
|
257
|
+
const words = shellWords(input);
|
|
258
|
+
const args: string[] = [];
|
|
259
|
+
let fork = false;
|
|
260
|
+
let fresh = false;
|
|
261
|
+
let bg = false;
|
|
262
|
+
for (let i = 0; i < words.length; i++) {
|
|
263
|
+
const word = words[i]!;
|
|
264
|
+
if (word === "--fork") { fork = true; continue; }
|
|
265
|
+
if (word === "--fresh") { fresh = true; continue; }
|
|
266
|
+
if (word === "--bg" || word === "--async") { bg = true; continue; }
|
|
267
|
+
args.push(word);
|
|
268
|
+
}
|
|
269
|
+
const steps: { agent: string; task: string }[] = [];
|
|
270
|
+
let current = "";
|
|
271
|
+
for (const word of args) {
|
|
272
|
+
if (word === "|") {
|
|
273
|
+
if (current.trim()) steps.push(parseStep(current));
|
|
274
|
+
current = "";
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
current += (current ? " " : "") + word;
|
|
278
|
+
}
|
|
279
|
+
if (current.trim()) steps.push(parseStep(current));
|
|
280
|
+
return steps.map((step) => ({ ...step, ...(fork ? { context: "fork" as const } : {}), ...(fresh ? { context: "fresh" as const } : {}) }));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function parseStep(stepText: string): { agent: string; task: string } {
|
|
284
|
+
const space = stepText.indexOf(" ");
|
|
285
|
+
if (space === -1) return { agent: stepText, task: "" };
|
|
286
|
+
return { agent: stepText.slice(0, space), task: stepText.slice(space + 1).trim() };
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function resolveStepsAgents(steps: { agent: string; task: string }[], cwd: string): { agent: string; task: string }[] {
|
|
290
|
+
const agents = discoverAgents(cwd, "both").agents;
|
|
291
|
+
return steps.map((step) => {
|
|
292
|
+
const resolved = resolveAgentName(step.agent, agents);
|
|
293
|
+
if (resolved.error || !resolved.agent) throw new Error(`Unknown agent: ${step.agent}`);
|
|
294
|
+
return { agent: resolved.agent.name, task: step.task };
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function normalizeChainStep(step: ChainStepConfig): Record<string, unknown> {
|
|
299
|
+
const normalized: Record<string, unknown> = {};
|
|
300
|
+
for (const [key, value] of Object.entries(step)) {
|
|
301
|
+
if (value === undefined) continue;
|
|
302
|
+
if (key === "skills") {
|
|
303
|
+
if (value !== false) normalized.skill = value;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
normalized[key] = value;
|
|
307
|
+
}
|
|
308
|
+
return normalized;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function formatChainList(chains: ChainConfig[]): string {
|
|
312
|
+
if (chains.length === 0) return "No saved chains found in user or project chains.";
|
|
313
|
+
return [
|
|
314
|
+
"Saved chains:",
|
|
315
|
+
...chains.map((chain) => `- ${chain.name}: ${chain.description ?? chain.filePath}`),
|
|
316
|
+
].join("\n");
|
|
317
|
+
}
|
|
318
|
+
|
|
255
319
|
export function registerPromptWorkflowCommands(input: {
|
|
256
320
|
pi: ExtensionAPI;
|
|
257
321
|
run: PromptWorkflowRunner;
|
|
@@ -281,14 +345,105 @@ export function registerPromptWorkflowCommands(input: {
|
|
|
281
345
|
if (!step) throw new Error(`Unknown prompt workflow in chain '${workflow.name}': ${stepName}`);
|
|
282
346
|
return step;
|
|
283
347
|
});
|
|
284
|
-
await run(
|
|
348
|
+
await run(promptWorkflowExecutionParams(chain, runtime.args, runtime), ctx);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
await run(promptWorkflowExecutionParams([workflow], runtime.args, runtime), ctx);
|
|
352
|
+
} catch (error) {
|
|
353
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
pi.registerCommand("chain", {
|
|
359
|
+
description: "Launch a chain of steps: /chain <agent> <task> | <agent> <task> [--bg] [--fork] [--fresh]",
|
|
360
|
+
handler: async (rawArgs, ctx) => {
|
|
361
|
+
try {
|
|
362
|
+
const steps = resolveStepsAgents(parseStepList(rawArgs), ctx.cwd);
|
|
363
|
+
if (steps.length === 0) {
|
|
364
|
+
ctx.ui.notify("Usage: /chain <agent> <task> | <agent> <task> [--bg] [--fork] [--fresh]", "error");
|
|
285
365
|
return;
|
|
286
366
|
}
|
|
287
|
-
|
|
367
|
+
const bg = rawArgs.includes("--bg") || rawArgs.includes("--async");
|
|
368
|
+
await run({ chain: steps as ChainStep[], agentScope: "both", ...(bg ? { async: true } : {}) }, ctx);
|
|
288
369
|
} catch (error) {
|
|
289
370
|
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
290
371
|
}
|
|
291
372
|
},
|
|
292
373
|
});
|
|
293
374
|
|
|
375
|
+
pi.registerCommand("parallel", {
|
|
376
|
+
description: "Launch top-level parallel tasks: /parallel <agent> <task> | <agent> <task> [--bg]",
|
|
377
|
+
handler: async (rawArgs, ctx) => {
|
|
378
|
+
try {
|
|
379
|
+
const steps = resolveStepsAgents(parseStepList(rawArgs), ctx.cwd);
|
|
380
|
+
if (steps.length === 0) {
|
|
381
|
+
ctx.ui.notify("Usage: /parallel <agent> <task> | <agent> <task> [--bg]", "error");
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const bg = rawArgs.includes("--bg") || rawArgs.includes("--async");
|
|
385
|
+
await run({ tasks: steps, agentScope: "both", ...(bg ? { async: true } : {}) }, ctx);
|
|
386
|
+
} catch (error) {
|
|
387
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
pi.registerCommand("run-chain", {
|
|
393
|
+
description: "Run a saved .chain.md/.chain.json workflow: /run-chain <name> [--bg]",
|
|
394
|
+
handler: async (rawArgs, ctx) => {
|
|
395
|
+
const words = shellWords(rawArgs);
|
|
396
|
+
const name = words.find((word) => !word.startsWith("--"));
|
|
397
|
+
const bg = words.includes("--bg") || words.includes("--async");
|
|
398
|
+
const chains = discoverAgentsAll(ctx.cwd).chains;
|
|
399
|
+
if (!name || name === "list") {
|
|
400
|
+
pi.sendMessage({ content: formatChainList(chains), display: true } as Parameters<typeof pi.sendMessage>[0]);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const chain = chains.find((candidate) => candidate.name === name || candidate.localName === name);
|
|
404
|
+
if (!chain) {
|
|
405
|
+
ctx.ui.notify(`Unknown saved chain: ${name}`, "error");
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
try {
|
|
409
|
+
await run({ chain: chain.steps.map(normalizeChainStep) as unknown as ChainStep[], agentScope: "both", ...(bg ? { async: true } : {}) }, ctx);
|
|
410
|
+
} catch (error) {
|
|
411
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
pi.registerCommand("chain-prompts", {
|
|
417
|
+
description: "Run a prompt template whose frontmatter declares a chain, as a native chain: /chain-prompts <name> [args]",
|
|
418
|
+
handler: async (rawArgs, ctx) => {
|
|
419
|
+
const words = shellWords(rawArgs);
|
|
420
|
+
const name = words.shift();
|
|
421
|
+
const workflows = discoverPromptWorkflows(ctx.cwd);
|
|
422
|
+
if (!name || name === "list") {
|
|
423
|
+
pi.sendMessage({ content: formatWorkflowList(workflows), display: true } as Parameters<typeof pi.sendMessage>[0]);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const workflow = findWorkflow(workflows, name);
|
|
427
|
+
if (!workflow) {
|
|
428
|
+
ctx.ui.notify(`Unknown prompt workflow: ${name}`, "error");
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const runtime = parseRuntimeOptions(words);
|
|
432
|
+
try {
|
|
433
|
+
if (workflow.chain) {
|
|
434
|
+
const steps = splitPromptChain(workflow.chain).map((stepName) => {
|
|
435
|
+
const step = findWorkflow(workflows, stepName);
|
|
436
|
+
if (!step) throw new Error(`Unknown prompt workflow in chain '${workflow.name}': ${stepName}`);
|
|
437
|
+
const params = workflowParams(step, runtime.args, runtime);
|
|
438
|
+
return { agent: params.agent, task: params.task };
|
|
439
|
+
});
|
|
440
|
+
await run({ chain: steps as ChainStep[], agentScope: "both", ...(runtime.bg ? { async: true } : {}) }, ctx);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
ctx.ui.notify(`Prompt workflow '${name}' has no chain frontmatter; use /prompt-workflow for single-step templates.`, "warning");
|
|
444
|
+
} catch (error) {
|
|
445
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
});
|
|
294
449
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
2
2
|
import type { ExtensionContext } from "@selesai/code";
|
|
3
|
+
import { normalizePublicSubagentExecution } from "../extension/public-execution.ts";
|
|
3
4
|
import type { SubagentParamsLike } from "../runs/foreground/subagent-executor.ts";
|
|
4
5
|
import {
|
|
5
6
|
SLASH_SUBAGENT_CANCEL_EVENT,
|
|
@@ -27,6 +28,8 @@ export interface SlashSubagentResponse {
|
|
|
27
28
|
export interface SlashSubagentUpdate {
|
|
28
29
|
requestId: string;
|
|
29
30
|
progress?: Details["progress"];
|
|
31
|
+
workflow?: Details["workflow"];
|
|
32
|
+
chatProgress?: Details["chatProgress"];
|
|
30
33
|
currentTool?: string;
|
|
31
34
|
toolCount?: number;
|
|
32
35
|
}
|
|
@@ -77,21 +80,22 @@ export function registerSlashSubagentBridge(options: SlashBridgeOptions): {
|
|
|
77
80
|
if (!data || typeof data !== "object") return;
|
|
78
81
|
const request = data as Partial<SlashSubagentRequest>;
|
|
79
82
|
if (typeof request.requestId !== "string" || !request.params) return;
|
|
80
|
-
const { requestId
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
const { requestId } = request as SlashSubagentRequest;
|
|
84
|
+
const normalized = normalizePublicSubagentExecution((request as SlashSubagentRequest).params);
|
|
85
|
+
if (!normalized.ok) {
|
|
83
86
|
options.events.emit(SLASH_SUBAGENT_RESPONSE_EVENT, {
|
|
84
87
|
requestId,
|
|
85
88
|
result: {
|
|
86
|
-
content: [{ type: "text", text:
|
|
89
|
+
content: [{ type: "text", text: normalized.error }],
|
|
87
90
|
isError: true,
|
|
88
|
-
details: { mode:
|
|
91
|
+
details: { mode: normalized.mode, results: [] },
|
|
89
92
|
},
|
|
90
93
|
isError: true,
|
|
91
|
-
errorText:
|
|
94
|
+
errorText: normalized.error,
|
|
92
95
|
} satisfies SlashSubagentResponse);
|
|
93
96
|
return;
|
|
94
97
|
}
|
|
98
|
+
const params = normalized.params;
|
|
95
99
|
|
|
96
100
|
const ctx = request.ctx ?? options.getContext();
|
|
97
101
|
if (!ctx) {
|
|
@@ -140,6 +144,8 @@ export function registerSlashSubagentBridge(options: SlashBridgeOptions): {
|
|
|
140
144
|
const payload: SlashSubagentUpdate = {
|
|
141
145
|
requestId,
|
|
142
146
|
progress,
|
|
147
|
+
workflow: update.details?.workflow,
|
|
148
|
+
chatProgress: update.details?.chatProgress,
|
|
143
149
|
currentTool: first?.currentTool,
|
|
144
150
|
toolCount: first?.toolCount,
|
|
145
151
|
};
|