@selesai/code 0.8.3 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +7 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/defaults/models.json +41 -55
- package/dist/defaults/settings.json +7 -8
- 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 +225 -14
- package/dist/extensions/pi-subagents/README.md +66 -1613
- 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 +372 -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 +38 -19
- 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 +62 -8
- package/dist/extensions/pi-subagents/src/extension/control-notices.ts +2 -2
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +40 -0
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +51 -26
- package/dist/extensions/pi-subagents/src/extension/index.ts +140 -50
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +77 -0
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +18 -24
- 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/intercom-bridge.ts +4 -1
- 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 -17
- package/dist/extensions/pi-subagents/src/missions/store.ts +151 -9
- package/dist/extensions/pi-subagents/src/missions/types.ts +58 -3
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +260 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +8 -8
- package/dist/extensions/pi-subagents/src/runs/background/active-async-capacity.ts +374 -0
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +46 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +158 -36
- 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 +26 -4
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +45 -6
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +33 -15
- 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/owned-process-tree.ts +104 -0
- package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +17 -3
- 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 +26 -3
- 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 +233 -101
- 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 +40 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +188 -46
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-control.ts +12 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +137 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/prompt-audit.ts +171 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1365 -252
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +187 -0
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +178 -26
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/llm-intent-arbiter.ts +286 -0
- 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 +32 -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 +3 -0
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +509 -117
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +10 -10
- package/dist/extensions/pi-subagents/src/runs/shared/run-fanout-budget.ts +280 -0
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +4 -2
- 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 +21 -5
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +20 -8
- 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 +192 -3
- package/dist/extensions/pi-subagents/src/shared/utf8.ts +11 -0
- package/dist/extensions/pi-subagents/src/shared/utils.ts +46 -34
- 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 +37 -21
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +375 -42
- 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 +332 -27
- 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 +102 -15
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +507 -306
- 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 +124 -58
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +62 -16
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +167 -113
- 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 +139 -58
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +324 -59
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +98 -22
- 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 +1122 -96
- 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 +194 -59
- package/dist/extensions/pi-subagents/test/unit/active-async-capacity.test.ts +317 -0
- 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 +118 -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 +18 -3
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +99 -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 +94 -23
- 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 +70 -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 +30 -2
- 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 +91 -47
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +468 -38
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +14 -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 +7 -6
- package/dist/extensions/pi-subagents/test/unit/llm-intent-arbiter.test.ts +171 -0
- 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 +81 -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 +42 -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/owned-process-tree.test.ts +69 -0
- 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 +440 -92
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +24 -8
- 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 +59 -6
- 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 +51 -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 +111 -31
- package/dist/extensions/pi-subagents/test/unit/run-fanout-budget.test.ts +121 -0
- 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 +65 -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 +60 -44
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +424 -49
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +28 -0
- 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 +130 -92
- 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 +65 -26
- package/dist/extensions/pi-subagents/test/unit/timeout-defaults.test.ts +138 -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 +68 -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/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.js +48 -1
- 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/docs/quickstart.md +27 -43
- package/docs/settings.md +4 -0
- package/docs/usage.md +1 -0
- package/package.json +2 -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
|
@@ -10,6 +10,9 @@ const { inspect } = require("node:util");
|
|
|
10
10
|
let nextCallId = 0;
|
|
11
11
|
const pending = new Map();
|
|
12
12
|
const runKeyPattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
13
|
+
const trackedPromisePatch = Symbol("trackedPromisePatch");
|
|
14
|
+
const trackedPromiseObservations = new WeakMap();
|
|
15
|
+
let suppressRunObservation = 0;
|
|
13
16
|
|
|
14
17
|
function stableRunJson(value) {
|
|
15
18
|
if (Array.isArray(value)) return "[" + value.map(stableRunJson).join(",") + "]";
|
|
@@ -17,12 +20,124 @@ function stableRunJson(value) {
|
|
|
17
20
|
return JSON.stringify(value) ?? "undefined";
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
function isDirectWorkflowScriptPromiseHandlerCall() {
|
|
24
|
+
const stack = new Error().stack;
|
|
25
|
+
if (typeof stack !== "string") return false;
|
|
26
|
+
const frame = stack.split("\n").slice(1).map((line) => line.trim()).find((line) =>
|
|
27
|
+
line &&
|
|
28
|
+
!line.includes("isDirectWorkflowScriptPromiseHandlerCall") &&
|
|
29
|
+
!line.includes("markObserved") &&
|
|
30
|
+
!line.includes("promise.then") &&
|
|
31
|
+
!line.includes("promise.catch") &&
|
|
32
|
+
!line.includes("promise.finally")
|
|
33
|
+
);
|
|
34
|
+
return frame ? frame.includes("workflow-script.js") && !frame.includes("at async ") : false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function mergeObservations(...groups) {
|
|
38
|
+
const seen = new Set();
|
|
39
|
+
const merged = [];
|
|
40
|
+
for (const group of groups) {
|
|
41
|
+
for (const observation of group) {
|
|
42
|
+
if (!observation || typeof observation.callId !== "number" || typeof observation.key !== "string" || seen.has(observation.callId)) continue;
|
|
43
|
+
seen.add(observation.callId);
|
|
44
|
+
merged.push(observation);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return merged;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function trackedObservations(value) {
|
|
51
|
+
return value && (typeof value === "object" || typeof value === "function") ? trackedPromiseObservations.get(value) ?? [] : [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function withSuppressedRunObservation(callback) {
|
|
55
|
+
suppressRunObservation += 1;
|
|
56
|
+
try {
|
|
57
|
+
return callback();
|
|
58
|
+
} finally {
|
|
59
|
+
suppressRunObservation -= 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function trackRunObservation(observations, promise) {
|
|
64
|
+
const merged = mergeObservations(trackedObservations(promise), observations);
|
|
65
|
+
if (merged.length === 0 || !promise || typeof promise.then !== "function") return promise;
|
|
66
|
+
trackedPromiseObservations.set(promise, merged);
|
|
67
|
+
if (promise[trackedPromisePatch]) return promise;
|
|
68
|
+
|
|
69
|
+
const observedCallIds = new Set();
|
|
70
|
+
const markObserved = () => {
|
|
71
|
+
if (suppressRunObservation > 0 || isDirectWorkflowScriptPromiseHandlerCall()) return;
|
|
72
|
+
for (const observation of trackedObservations(promise)) {
|
|
73
|
+
if (observedCallIds.has(observation.callId)) continue;
|
|
74
|
+
observedCallIds.add(observation.callId);
|
|
75
|
+
parentPort.postMessage({ type: "runObserved", callId: observation.callId, key: observation.key });
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const originalThen = promise.then.bind(promise);
|
|
79
|
+
const originalCatch = promise.catch.bind(promise);
|
|
80
|
+
const originalFinally = promise.finally.bind(promise);
|
|
81
|
+
Object.defineProperty(promise, trackedPromisePatch, { value: true });
|
|
82
|
+
promise.then = (onFulfilled, onRejected) => {
|
|
83
|
+
markObserved();
|
|
84
|
+
return trackRunObservation(trackedObservations(promise), originalThen(onFulfilled, onRejected));
|
|
85
|
+
};
|
|
86
|
+
promise.catch = (onRejected) => {
|
|
87
|
+
markObserved();
|
|
88
|
+
return trackRunObservation(trackedObservations(promise), originalCatch(onRejected));
|
|
89
|
+
};
|
|
90
|
+
promise.finally = (onFinally) => {
|
|
91
|
+
markObserved();
|
|
92
|
+
return trackRunObservation(trackedObservations(promise), originalFinally(onFinally));
|
|
93
|
+
};
|
|
94
|
+
return promise;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function trackPromiseCombinator(items, createPromise) {
|
|
98
|
+
const values = Array.from(items);
|
|
99
|
+
const observations = mergeObservations(...values.map(trackedObservations));
|
|
100
|
+
const promise = withSuppressedRunObservation(() => createPromise(values));
|
|
101
|
+
return observations.length > 0 ? trackRunObservation(observations, promise) : promise;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const workflowPromise = new Proxy(Promise, {
|
|
105
|
+
construct(target, args) {
|
|
106
|
+
return new target(...args);
|
|
107
|
+
},
|
|
108
|
+
get(target, prop) {
|
|
109
|
+
if (prop === "all") return (items) => trackPromiseCombinator(items, (values) => target.all(values));
|
|
110
|
+
if (prop === "allSettled") return (items) => trackPromiseCombinator(items, (values) => target.allSettled(values));
|
|
111
|
+
if (prop === "race") return (items) => trackPromiseCombinator(items, (values) => target.race(values));
|
|
112
|
+
if (prop === "any") return (items) => trackPromiseCombinator(items, (values) => target.any(values));
|
|
113
|
+
if (prop === "resolve") return (value) => {
|
|
114
|
+
const observations = trackedObservations(value);
|
|
115
|
+
const promise = withSuppressedRunObservation(() => target.resolve(value));
|
|
116
|
+
return observations.length > 0 ? trackRunObservation(observations, promise) : promise;
|
|
117
|
+
};
|
|
118
|
+
const value = target[prop];
|
|
119
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
function hostCall(method, args, observation) {
|
|
124
|
+
const callId = ++nextCallId;
|
|
125
|
+
const promise = new Promise((resolve, reject) => {
|
|
23
126
|
pending.set(callId, { resolve, reject });
|
|
24
127
|
parentPort.postMessage({ type: "call", callId, method, args });
|
|
25
128
|
});
|
|
129
|
+
return observation && typeof observation.key === "string"
|
|
130
|
+
? trackRunObservation([{ key: observation.key, callId }], promise)
|
|
131
|
+
: promise;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function runHostCall(key, params, collectFailure, batch) {
|
|
135
|
+
const callId = ++nextCallId;
|
|
136
|
+
const promise = new Promise((resolve, reject) => {
|
|
137
|
+
pending.set(callId, { resolve, reject });
|
|
138
|
+
parentPort.postMessage({ type: "call", callId, method: "run", args: { key, params, ...(collectFailure ? { collectFailure: true } : {}), ...(batch ? { batch } : {}) } });
|
|
139
|
+
});
|
|
140
|
+
return { key, callId, promise };
|
|
26
141
|
}
|
|
27
142
|
|
|
28
143
|
function formatRef(result) {
|
|
@@ -37,11 +152,17 @@ const runFingerprints = new Map();
|
|
|
37
152
|
function validateRunCall(key, params, label, fingerprints) {
|
|
38
153
|
if (typeof key !== "string" || !runKeyPattern.test(key)) throw new Error(label + " has an invalid key.");
|
|
39
154
|
if (!params || typeof params !== "object" || Array.isArray(params)) throw new Error(label + " requires a params object.");
|
|
40
|
-
if (Object.prototype.hasOwnProperty.call(params, "action") || Object.prototype.hasOwnProperty.call(params, "workflowScript") || Object.prototype.hasOwnProperty.call(params, "tasks") || Object.prototype.hasOwnProperty.call(params, "chain") || Object.prototype.hasOwnProperty.call(params, "concurrency") || Object.prototype.hasOwnProperty.call(params, "chainDir")) {
|
|
155
|
+
if (Object.prototype.hasOwnProperty.call(params, "action") || Object.prototype.hasOwnProperty.call(params, "workflowScript") || Object.prototype.hasOwnProperty.call(params, "tasks") || Object.prototype.hasOwnProperty.call(params, "chain") || Object.prototype.hasOwnProperty.call(params, "parallel") || Object.prototype.hasOwnProperty.call(params, "concurrency") || Object.prototype.hasOwnProperty.call(params, "chainDir")) {
|
|
41
156
|
const hint = label === "runs.run" ? "; use runs.all(...) and JavaScript control flow for orchestration." : ".";
|
|
42
157
|
throw new Error(label + " accepts one child via { agent, task } and execution controls only" + hint);
|
|
43
158
|
}
|
|
44
159
|
if (params.worktree !== undefined && typeof params.worktree !== "boolean") throw new Error(label + " worktree must be true or false.");
|
|
160
|
+
if (params.gate !== undefined && (typeof params.gate !== "string" || !params.gate.trim())) throw new Error(label + " gate must be a non-empty command string.");
|
|
161
|
+
if (params.gate !== undefined && params.acceptance !== undefined) throw new Error(label + " gate cannot be combined with acceptance; use one gate command or acceptance.verify.");
|
|
162
|
+
if (params.gate !== undefined && params.resume !== undefined) throw new Error(label + " gate is not supported with retained resume.");
|
|
163
|
+
if (params.resume !== undefined && (typeof params.resume !== "string" || !params.resume.trim())) throw new Error(label + " resume must be a non-empty retained run id.");
|
|
164
|
+
if (params.resume !== undefined && params.agent !== undefined) throw new Error(label + " resume and agent are mutually exclusive.");
|
|
165
|
+
if (params.resume !== undefined && (typeof params.task !== "string" || !params.task.trim())) throw new Error(label + " resume requires a non-empty task follow-up.");
|
|
45
166
|
assertJsonValue(params, label + " params");
|
|
46
167
|
const fingerprint = stableRunJson(params);
|
|
47
168
|
const existing = fingerprints.get(key);
|
|
@@ -52,7 +173,7 @@ function validateRunCall(key, params, label, fingerprints) {
|
|
|
52
173
|
const runs = Object.freeze({
|
|
53
174
|
run(key, params) {
|
|
54
175
|
validateRunCall(key, params, "runs.run", runFingerprints);
|
|
55
|
-
return hostCall("run", { key, params });
|
|
176
|
+
return hostCall("run", { key, params }, { key });
|
|
56
177
|
},
|
|
57
178
|
all(items) {
|
|
58
179
|
if (!Array.isArray(items)) throw new Error("runs.all(items) requires an array.");
|
|
@@ -67,7 +188,9 @@ const runs = Object.freeze({
|
|
|
67
188
|
calls.push({ key, params });
|
|
68
189
|
}
|
|
69
190
|
for (const { key, params } of calls) runFingerprints.set(key, stableRunJson(params));
|
|
70
|
-
|
|
191
|
+
const batch = { id: "batch-" + (++nextCallId), calls };
|
|
192
|
+
const launched = calls.map(({ key, params }) => runHostCall(key, params, true, batch));
|
|
193
|
+
return trackRunObservation(launched.map(({ key, callId }) => ({ key, callId })), Promise.all(launched.map(({ promise }) => promise)));
|
|
71
194
|
},
|
|
72
195
|
status(keyOrRunId) { return hostCall("status", { keyOrRunId }); },
|
|
73
196
|
ref: formatRef,
|
|
@@ -77,6 +200,28 @@ const runs = Object.freeze({
|
|
|
77
200
|
},
|
|
78
201
|
});
|
|
79
202
|
|
|
203
|
+
function validateStateKey(key) {
|
|
204
|
+
if (typeof key !== "string" || !runKeyPattern.test(key)) throw new Error("state key must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.");
|
|
205
|
+
return key;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const state = Object.freeze({
|
|
209
|
+
get(key) { return hostCall("state.get", { key: validateStateKey(key) }); },
|
|
210
|
+
set(key, value) {
|
|
211
|
+
const validKey = validateStateKey(key);
|
|
212
|
+
assertJsonValue(value, "state.set('" + validKey + "') value");
|
|
213
|
+
return hostCall("state.set", { key: validKey, value });
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
const prompts = Object.freeze({
|
|
218
|
+
render(ref, vars) {
|
|
219
|
+
if (typeof ref !== "string" || !ref.trim()) throw new Error("prompts.render(ref, vars) requires a non-empty ref string.");
|
|
220
|
+
if (vars !== undefined) assertJsonValue(vars, "prompts.render vars");
|
|
221
|
+
return hostCall("prompts.render", { ref, vars });
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
|
|
80
225
|
let contextObjectPrototype;
|
|
81
226
|
|
|
82
227
|
const capturedConsole = Object.freeze(Object.fromEntries(
|
|
@@ -85,6 +230,17 @@ const capturedConsole = Object.freeze(Object.fromEntries(
|
|
|
85
230
|
}]),
|
|
86
231
|
));
|
|
87
232
|
|
|
233
|
+
function formatWorkflowScriptSyntaxError(error) {
|
|
234
|
+
const details = error && error.stack ? error.stack : String(error);
|
|
235
|
+
return [
|
|
236
|
+
"workflowScript must be valid JavaScript.",
|
|
237
|
+
"If task text contains Markdown fences or backticks, use an array joined with \"\\n\" or escaped strings instead of a raw backtick template literal.",
|
|
238
|
+
"",
|
|
239
|
+
"Original SyntaxError:",
|
|
240
|
+
details,
|
|
241
|
+
].join("\n");
|
|
242
|
+
}
|
|
243
|
+
|
|
88
244
|
function assertJsonValue(value, path = "emit", seen = new Set()) {
|
|
89
245
|
if (value === null || typeof value === "string" || typeof value === "boolean") return;
|
|
90
246
|
if (typeof value === "number") {
|
|
@@ -108,6 +264,25 @@ function assertJsonValue(value, path = "emit", seen = new Set()) {
|
|
|
108
264
|
seen.delete(value);
|
|
109
265
|
}
|
|
110
266
|
|
|
267
|
+
function isPlainWorkflowObject(value) {
|
|
268
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
269
|
+
const prototype = Object.getPrototypeOf(value);
|
|
270
|
+
return prototype === null || prototype === Object.prototype || prototype === contextObjectPrototype;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function omitUndefinedWorkflowValues(value, seen = new Set()) {
|
|
274
|
+
if (value === null || typeof value !== "object") return value;
|
|
275
|
+
if (seen.has(value)) return value;
|
|
276
|
+
seen.add(value);
|
|
277
|
+
const normalized = Array.isArray(value)
|
|
278
|
+
? value.map((entry) => entry === undefined ? null : omitUndefinedWorkflowValues(entry, seen))
|
|
279
|
+
: isPlainWorkflowObject(value) && Object.getOwnPropertySymbols(value).length === 0
|
|
280
|
+
? Object.fromEntries(Object.entries(value).flatMap(([key, entry]) => entry === undefined ? [] : [[key, omitUndefinedWorkflowValues(entry, seen)]]))
|
|
281
|
+
: value;
|
|
282
|
+
seen.delete(value);
|
|
283
|
+
return normalized;
|
|
284
|
+
}
|
|
285
|
+
|
|
111
286
|
parentPort.on("message", async (message) => {
|
|
112
287
|
if (message.type === "response") {
|
|
113
288
|
const entry = pending.get(message.callId);
|
|
@@ -119,12 +294,20 @@ parentPort.on("message", async (message) => {
|
|
|
119
294
|
}
|
|
120
295
|
if (message.type !== "start") return;
|
|
121
296
|
try {
|
|
122
|
-
const sandbox = { runs, emit(value) { assertJsonValue(value); parentPort.postMessage({ type: "emit", value }); }, console: capturedConsole };
|
|
297
|
+
const sandbox = { runs, prompts, Promise: workflowPromise, emit(value) { assertJsonValue(value); parentPort.postMessage({ type: "emit", value }); }, console: capturedConsole };
|
|
298
|
+
if (message.stateEnabled) sandbox.state = state;
|
|
123
299
|
const context = vm.createContext(sandbox, { codeGeneration: { strings: false, wasm: false } });
|
|
124
300
|
contextObjectPrototype = vm.runInContext("Object.prototype", context);
|
|
125
|
-
|
|
301
|
+
let compiled;
|
|
302
|
+
try {
|
|
303
|
+
compiled = new vm.Script("(async () => {\n" + message.script + "\n})()", { filename: "workflow-script.js" });
|
|
304
|
+
} catch (error) {
|
|
305
|
+
if (!(error instanceof SyntaxError)) throw error;
|
|
306
|
+
parentPort.postMessage({ type: "error", error: formatWorkflowScriptSyntaxError(error) });
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
126
309
|
const value = await compiled.runInContext(context);
|
|
127
|
-
const persistedValue = value === undefined ? null : value;
|
|
310
|
+
const persistedValue = value === undefined ? null : omitUndefinedWorkflowValues(value);
|
|
128
311
|
assertJsonValue(persistedValue, "return");
|
|
129
312
|
parentPort.postMessage({ type: "complete", value: persistedValue });
|
|
130
313
|
} catch (error) {
|
|
@@ -136,6 +319,8 @@ parentPort.on("message", async (message) => {
|
|
|
136
319
|
export interface WorkflowScriptChildResult {
|
|
137
320
|
key: string;
|
|
138
321
|
ok: boolean;
|
|
322
|
+
/** Canonical child agent name when launch resolution produced one. */
|
|
323
|
+
agent?: string;
|
|
139
324
|
runId?: string;
|
|
140
325
|
output: string;
|
|
141
326
|
error?: string;
|
|
@@ -148,6 +333,8 @@ export interface WorkflowScriptTraceEntry {
|
|
|
148
333
|
operation: "run" | "status";
|
|
149
334
|
key: string;
|
|
150
335
|
state: "started" | "completed" | "failed" | "reused";
|
|
336
|
+
/** Canonical child agent name when resolved launch or result data is available. */
|
|
337
|
+
agent?: string;
|
|
151
338
|
runId?: string;
|
|
152
339
|
durationMs?: number;
|
|
153
340
|
phase?: string;
|
|
@@ -175,10 +362,18 @@ export class WorkflowScriptError extends Error {
|
|
|
175
362
|
|
|
176
363
|
export interface RunWorkflowScriptOptions {
|
|
177
364
|
script: string;
|
|
178
|
-
timeoutMs
|
|
365
|
+
timeoutMs?: number;
|
|
179
366
|
signal?: AbortSignal;
|
|
180
|
-
|
|
367
|
+
admit?: (calls: Array<{ key: string; params: Record<string, unknown> }>) => void | Promise<void>;
|
|
368
|
+
launch: (key: string, params: Record<string, unknown>, signal: AbortSignal, admission: { admitted: boolean }) => Promise<WorkflowScriptChildResult>;
|
|
181
369
|
status: (keyOrRunId: string, signal: AbortSignal) => Promise<WorkflowScriptChildResult>;
|
|
370
|
+
state?: {
|
|
371
|
+
get: (key: string) => unknown | Promise<unknown>;
|
|
372
|
+
set: (key: string, value: unknown) => void | Promise<void>;
|
|
373
|
+
};
|
|
374
|
+
prompts?: {
|
|
375
|
+
render: (ref: string, vars?: unknown) => string | Promise<string>;
|
|
376
|
+
};
|
|
182
377
|
onTrace?: (trace: WorkflowScriptTraceEntry[]) => void;
|
|
183
378
|
onEmit?: (emits: unknown[]) => void;
|
|
184
379
|
}
|
|
@@ -239,29 +434,56 @@ export function formatWorkflowJsonPreview(value: unknown, maxLength: number): st
|
|
|
239
434
|
}
|
|
240
435
|
}
|
|
241
436
|
|
|
437
|
+
export interface SimpleWorkflowRunPreview {
|
|
438
|
+
agent?: string;
|
|
439
|
+
task?: string;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** Display-only preview for the exact simple `return runs.run(key, {...})` form. */
|
|
443
|
+
export function previewSimpleWorkflowRun(script: string | undefined): SimpleWorkflowRunPreview | undefined {
|
|
444
|
+
const body = script?.match(/^\s*return\s+(?:await\s+)?runs\.run\s*\(\s*(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`[^`$\\]*`)\s*,\s*\{([\s\S]*)\}\s*\)\s*;?\s*$/)?.[1];
|
|
445
|
+
if (body === undefined) return undefined;
|
|
446
|
+
const readProperty = (name: "agent" | "task"): string | undefined => {
|
|
447
|
+
const match = body.match(new RegExp(`(?:^|,)\\s*(?:${name}|["']${name}["'])\\s*:\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\u0060[^\u0060$\\\\]*\u0060)`));
|
|
448
|
+
if (!match?.[1]) return undefined;
|
|
449
|
+
const literal = match[1];
|
|
450
|
+
if (literal.startsWith('"')) {
|
|
451
|
+
try { return JSON.parse(literal) as string; } catch { return undefined; }
|
|
452
|
+
}
|
|
453
|
+
if (literal.slice(1, -1).includes("\\")) return undefined;
|
|
454
|
+
return literal.slice(1, -1);
|
|
455
|
+
};
|
|
456
|
+
const agent = readProperty("agent");
|
|
457
|
+
const task = readProperty("task");
|
|
458
|
+
return { ...(agent !== undefined ? { agent } : {}), ...(task !== undefined ? { task } : {}) };
|
|
459
|
+
}
|
|
460
|
+
|
|
242
461
|
function stableJson(value: unknown): string {
|
|
243
462
|
if (Array.isArray(value)) return `[${value.map(stableJson).join(",")}]`;
|
|
244
463
|
if (isRecord(value)) return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableJson(value[key])}`).join(",")}}`;
|
|
245
464
|
return JSON.stringify(value) ?? "undefined";
|
|
246
465
|
}
|
|
247
466
|
|
|
248
|
-
function validateKey(value: unknown): string {
|
|
467
|
+
function validateKey(value: unknown, owner = "runs.run"): string {
|
|
249
468
|
if (typeof value !== "string" || !KEY_PATTERN.test(value)) {
|
|
250
|
-
throw new Error(
|
|
469
|
+
throw new Error(`${owner} key must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.`);
|
|
251
470
|
}
|
|
252
471
|
return value;
|
|
253
472
|
}
|
|
254
473
|
|
|
255
|
-
function workflowStringMetadata(params: Record<string, unknown>): Pick<WorkflowScriptTraceEntry, "phase" | "label"> {
|
|
474
|
+
function workflowStringMetadata(params: Record<string, unknown>): Pick<WorkflowScriptTraceEntry, "phase" | "label" | "agent"> {
|
|
256
475
|
return {
|
|
257
476
|
...(typeof params.phase === "string" && params.phase.trim() ? { phase: params.phase.trim() } : {}),
|
|
258
477
|
...(typeof params.label === "string" && params.label.trim() ? { label: params.label.trim() } : {}),
|
|
478
|
+
// Requested agent name, so a child is identifiable while it runs. Launch
|
|
479
|
+
// resolution overwrites this with the canonical name on the terminal entry.
|
|
480
|
+
...(typeof params.agent === "string" && params.agent.trim() ? { agent: params.agent.trim() } : {}),
|
|
259
481
|
};
|
|
260
482
|
}
|
|
261
483
|
|
|
262
484
|
export async function runWorkflowScript(options: RunWorkflowScriptOptions): Promise<WorkflowScriptResult> {
|
|
263
485
|
if (!options.script.trim()) throw new Error("workflowScript must not be empty.");
|
|
264
|
-
if (!Number.isInteger(options.timeoutMs) || options.timeoutMs < 1) throw new Error("workflow script timeout must be a positive integer.");
|
|
486
|
+
if (options.timeoutMs !== undefined && (!Number.isInteger(options.timeoutMs) || options.timeoutMs < 1)) throw new Error("workflow script timeout must be a positive integer.");
|
|
265
487
|
|
|
266
488
|
const worker = new Worker(WORKER_SOURCE, { eval: true });
|
|
267
489
|
const emits: unknown[] = [];
|
|
@@ -269,7 +491,9 @@ export async function runWorkflowScript(options: RunWorkflowScriptOptions): Prom
|
|
|
269
491
|
const trace: WorkflowScriptTraceEntry[] = [];
|
|
270
492
|
const children = new Map<string, WorkflowScriptChildResult>();
|
|
271
493
|
const childOrder: string[] = [];
|
|
272
|
-
const launches = new Map<string, { fingerprint: string; promise: Promise<WorkflowScriptChildResult
|
|
494
|
+
const launches = new Map<string, { fingerprint: string; promise: Promise<WorkflowScriptChildResult>; observed: boolean }>();
|
|
495
|
+
const batchAdmissions = new Map<string, Promise<void>>();
|
|
496
|
+
const observedRunCalls = new Set<number>();
|
|
273
497
|
const childController = new AbortController();
|
|
274
498
|
let settled = false;
|
|
275
499
|
|
|
@@ -283,15 +507,22 @@ export async function runWorkflowScript(options: RunWorkflowScriptOptions): Prom
|
|
|
283
507
|
const finish = (outcome: { value: unknown } | { error: Error }) => {
|
|
284
508
|
if (settled) return;
|
|
285
509
|
settled = true;
|
|
286
|
-
clearTimeout(timer);
|
|
510
|
+
if (timer) clearTimeout(timer);
|
|
287
511
|
options.signal?.removeEventListener("abort", onAbort);
|
|
288
512
|
void worker.terminate();
|
|
289
|
-
|
|
513
|
+
const unobservedKeys = "value" in outcome ? [...launches].filter(([, launch]) => !launch.observed).map(([key]) => key) : [];
|
|
514
|
+
const completionError = unobservedKeys.length > 0
|
|
515
|
+
? new Error(`workflowScript completed with unawaited runs.run launch(es): ${unobservedKeys.map((key) => `'${key}'`).join(", ")}. Await or return each launch.`)
|
|
516
|
+
: undefined;
|
|
517
|
+
childController.abort("error" in outcome ? outcome.error : completionError ?? new Error("Workflow script completed."));
|
|
290
518
|
if ("error" in outcome) reject(new WorkflowScriptError(outcome.error.message, partial()));
|
|
519
|
+
else if (completionError) reject(new WorkflowScriptError(completionError.message, partial()));
|
|
291
520
|
else resolve({ value: outcome.value, ...partial() });
|
|
292
521
|
};
|
|
293
522
|
const onAbort = () => finish({ error: new Error("Workflow script aborted.") });
|
|
294
|
-
const timer =
|
|
523
|
+
const timer = options.timeoutMs === undefined
|
|
524
|
+
? undefined
|
|
525
|
+
: setTimeout(() => finish({ error: new Error(`Workflow script timed out after ${options.timeoutMs}ms.`) }), options.timeoutMs);
|
|
295
526
|
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
296
527
|
if (options.signal?.aborted) return onAbort();
|
|
297
528
|
|
|
@@ -330,15 +561,55 @@ export async function runWorkflowScript(options: RunWorkflowScriptOptions): Prom
|
|
|
330
561
|
return finish({ value: message.value });
|
|
331
562
|
}
|
|
332
563
|
if (message.type === "error") return finish({ error: new Error(typeof message.error === "string" ? message.error : "Workflow script failed.") });
|
|
564
|
+
if (message.type === "runObserved" && typeof message.callId === "number") {
|
|
565
|
+
const key = typeof message.key === "string" ? message.key : undefined;
|
|
566
|
+
const launch = key ? launches.get(key) : undefined;
|
|
567
|
+
if (launch) launch.observed = true;
|
|
568
|
+
else observedRunCalls.add(message.callId);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
333
571
|
if (message.type !== "call" || typeof message.callId !== "number" || typeof message.method !== "string" || !isRecord(message.args)) return;
|
|
334
572
|
|
|
335
|
-
const respond = (promise: Promise<
|
|
573
|
+
const respond = (promise: Promise<unknown>) => {
|
|
336
574
|
void promise.then(
|
|
337
|
-
(value) =>
|
|
338
|
-
|
|
575
|
+
(value) => {
|
|
576
|
+
if (!settled) worker.postMessage({ type: "response", callId: message.callId, ok: true, value: omitUndefinedWorkflowValues(value) });
|
|
577
|
+
},
|
|
578
|
+
(error: unknown) => {
|
|
579
|
+
if (!settled) worker.postMessage({ type: "response", callId: message.callId, ok: false, error: error instanceof Error ? error.message : String(error) });
|
|
580
|
+
},
|
|
339
581
|
);
|
|
340
582
|
};
|
|
341
583
|
|
|
584
|
+
if (message.method === "prompts.render") {
|
|
585
|
+
if (!options.prompts) return respond(Promise.reject(new Error("Workflow prompt rendering is unavailable.")));
|
|
586
|
+
const ref = message.args.ref;
|
|
587
|
+
const vars = message.args.vars;
|
|
588
|
+
if (typeof ref !== "string" || !ref.trim()) return respond(Promise.reject(new Error("prompts.render(ref, vars) requires a non-empty ref string.")));
|
|
589
|
+
return respond(Promise.resolve().then(() => options.prompts!.render(ref, vars)).then((rendered) => {
|
|
590
|
+
if (typeof rendered !== "string") throw new Error("prompts.render must return task text.");
|
|
591
|
+
return rendered;
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (message.method === "state.get" || message.method === "state.set") {
|
|
596
|
+
if (!options.state) return respond(Promise.reject(new Error("Workflow state is unavailable without a mission.")));
|
|
597
|
+
let key: string;
|
|
598
|
+
try {
|
|
599
|
+
key = validateKey(message.args.key, "state");
|
|
600
|
+
} catch (error) {
|
|
601
|
+
return respond(Promise.reject(error));
|
|
602
|
+
}
|
|
603
|
+
if (message.method === "state.get") return respond(Promise.resolve().then(() => options.state!.get(key)));
|
|
604
|
+
const value = message.args.value;
|
|
605
|
+
try {
|
|
606
|
+
assertWorkflowJsonValue(value, `state.set('${key}') value`);
|
|
607
|
+
} catch (error) {
|
|
608
|
+
return respond(Promise.reject(error));
|
|
609
|
+
}
|
|
610
|
+
return respond(Promise.resolve().then(() => options.state!.set(key, value)));
|
|
611
|
+
}
|
|
612
|
+
|
|
342
613
|
if (message.method === "status") {
|
|
343
614
|
const keyOrRunId = message.args.keyOrRunId;
|
|
344
615
|
if (typeof keyOrRunId !== "string" || !keyOrRunId.trim()) return respond(Promise.reject(new Error("runs.status(keyOrRunId) requires a non-empty string.")));
|
|
@@ -366,13 +637,32 @@ export async function runWorkflowScript(options: RunWorkflowScriptOptions): Prom
|
|
|
366
637
|
if (!isRecord(params)) return respond(Promise.reject(new Error(`runs.run('${key}', params) requires a params object.`)));
|
|
367
638
|
if (params.action !== undefined) return respond(Promise.reject(new Error(`runs.run('${key}') accepts execution params only; management action is not allowed.`)));
|
|
368
639
|
if (params.workflowScript !== undefined) return respond(Promise.reject(new Error(`runs.run('${key}') cannot start a nested workflow script.`)));
|
|
369
|
-
if (params.tasks !== undefined || params.chain !== undefined || params.concurrency !== undefined || params.chainDir !== undefined) {
|
|
640
|
+
if (params.tasks !== undefined || params.chain !== undefined || params.parallel !== undefined || params.concurrency !== undefined || params.chainDir !== undefined) {
|
|
370
641
|
return respond(Promise.reject(new Error(`runs.run('${key}') accepts one child via { agent, task }; use runs.all(...) and JavaScript control flow for orchestration.`)));
|
|
371
642
|
}
|
|
372
643
|
if (params.worktree !== undefined && typeof params.worktree !== "boolean") {
|
|
373
644
|
return respond(Promise.reject(new Error(`runs.run('${key}') worktree must be true or false.`)));
|
|
374
645
|
}
|
|
646
|
+
if (params.gate !== undefined && (typeof params.gate !== "string" || !params.gate.trim())) {
|
|
647
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') gate must be a non-empty command string.`)));
|
|
648
|
+
}
|
|
649
|
+
if (params.gate !== undefined && params.acceptance !== undefined) {
|
|
650
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') gate cannot be combined with acceptance; use one gate command or acceptance.verify.`)));
|
|
651
|
+
}
|
|
652
|
+
if (params.gate !== undefined && params.resume !== undefined) {
|
|
653
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') gate is not supported with retained resume.`)));
|
|
654
|
+
}
|
|
655
|
+
if (params.resume !== undefined && (typeof params.resume !== "string" || !params.resume.trim())) {
|
|
656
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') resume must be a non-empty retained run id.`)));
|
|
657
|
+
}
|
|
658
|
+
if (params.resume !== undefined && params.agent !== undefined) {
|
|
659
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') resume and agent are mutually exclusive.`)));
|
|
660
|
+
}
|
|
661
|
+
if (params.resume !== undefined && (typeof params.task !== "string" || !params.task.trim())) {
|
|
662
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') resume requires a non-empty task follow-up.`)));
|
|
663
|
+
}
|
|
375
664
|
const collectFailure = message.args.collectFailure === true;
|
|
665
|
+
const callObserved = observedRunCalls.delete(message.callId);
|
|
376
666
|
const deliver = (promise: Promise<WorkflowScriptChildResult>) => collectFailure
|
|
377
667
|
? promise
|
|
378
668
|
: promise.then((result) => {
|
|
@@ -383,6 +673,7 @@ export async function runWorkflowScript(options: RunWorkflowScriptOptions): Prom
|
|
|
383
673
|
const existing = launches.get(key);
|
|
384
674
|
if (existing) {
|
|
385
675
|
if (existing.fingerprint !== fingerprint) return respond(Promise.reject(new Error(`Duplicate workflow key '${key}' used with incompatible launch params.`)));
|
|
676
|
+
if (callObserved) existing.observed = true;
|
|
386
677
|
trace.push({ operation: "run", key, state: "reused", ...workflowStringMetadata(params) });
|
|
387
678
|
traceChanged();
|
|
388
679
|
return respond(deliver(existing.promise));
|
|
@@ -392,10 +683,24 @@ export async function runWorkflowScript(options: RunWorkflowScriptOptions): Prom
|
|
|
392
683
|
childOrder.push(key);
|
|
393
684
|
trace.push({ operation: "run", key, state: "started", ...workflowStringMetadata(params) });
|
|
394
685
|
traceChanged();
|
|
395
|
-
const
|
|
686
|
+
const batch = isRecord(message.args.batch) && typeof message.args.batch.id === "string" && Array.isArray(message.args.batch.calls)
|
|
687
|
+
? { id: message.args.batch.id, calls: message.args.batch.calls.filter((call): call is { key: string; params: Record<string, unknown> } => isRecord(call) && typeof call.key === "string" && isRecord(call.params)) }
|
|
688
|
+
: undefined;
|
|
689
|
+
let admission = batch ? batchAdmissions.get(batch.id) : undefined;
|
|
690
|
+
if (!admission) {
|
|
691
|
+
const seenKeys = new Set<string>();
|
|
692
|
+
const calls = (batch?.calls ?? [{ key, params }]).filter((call) => {
|
|
693
|
+
if (seenKeys.has(call.key) || launches.has(call.key) || call.params.resume !== undefined) return false;
|
|
694
|
+
seenKeys.add(call.key);
|
|
695
|
+
return true;
|
|
696
|
+
});
|
|
697
|
+
admission = Promise.resolve().then(() => options.admit?.(calls));
|
|
698
|
+
if (batch) batchAdmissions.set(batch.id, admission);
|
|
699
|
+
}
|
|
700
|
+
const promise = admission.then(() => options.launch(key, { ...params, async: params.async ?? false }, childController.signal, { admitted: true })).then((result) => {
|
|
396
701
|
const normalized = !result.ok && !result.error ? { ...result, error: result.output } : result;
|
|
397
702
|
children.set(key, normalized);
|
|
398
|
-
trace.push({ operation: "run", key, state: normalized.ok ? "completed" : "failed", durationMs: Date.now() - startedAt, ...workflowStringMetadata(params), ...(normalized.runId ? { runId: normalized.runId } : {}), ...(!normalized.ok ? { error: normalized.error ?? normalized.output } : {}) });
|
|
703
|
+
trace.push({ operation: "run", key, state: normalized.ok ? "completed" : "failed", durationMs: Date.now() - startedAt, ...workflowStringMetadata(params), ...(normalized.agent ? { agent: normalized.agent } : {}), ...(normalized.runId ? { runId: normalized.runId } : {}), ...(!normalized.ok ? { error: normalized.error ?? normalized.output } : {}) });
|
|
399
704
|
traceChanged();
|
|
400
705
|
return normalized;
|
|
401
706
|
}, (error: unknown) => {
|
|
@@ -406,10 +711,10 @@ export async function runWorkflowScript(options: RunWorkflowScriptOptions): Prom
|
|
|
406
711
|
traceChanged();
|
|
407
712
|
return failure;
|
|
408
713
|
});
|
|
409
|
-
launches.set(key, { fingerprint, promise });
|
|
714
|
+
launches.set(key, { fingerprint, promise, observed: callObserved });
|
|
410
715
|
respond(deliver(promise));
|
|
411
716
|
});
|
|
412
717
|
|
|
413
|
-
worker.postMessage({ type: "start", script: options.script });
|
|
718
|
+
worker.postMessage({ type: "start", script: options.script, stateEnabled: options.state !== undefined });
|
|
414
719
|
});
|
|
415
720
|
}
|
|
@@ -18,9 +18,9 @@ import * as path from "node:path";
|
|
|
18
18
|
import { tryImport } from "../support/helpers.ts";
|
|
19
19
|
import type { RealSessionRun } from "../support/real-session-runner.ts";
|
|
20
20
|
|
|
21
|
-
const piCodingAgent = await tryImport<
|
|
21
|
+
const piCodingAgent = await tryImport<{ __piSubagentsTestShim?: boolean }>("@selesai/code");
|
|
22
22
|
const piAi = await tryImport<unknown>("@earendil-works/pi-ai");
|
|
23
|
-
const available = Boolean(piCodingAgent && piAi);
|
|
23
|
+
const available = Boolean(piCodingAgent && !piCodingAgent.__piSubagentsTestShim && piAi);
|
|
24
24
|
|
|
25
25
|
const CHILD_MARKER = "CHILD_REAL_SESSION_OK";
|
|
26
26
|
// Env vars the runner must clear so a parent that was itself spawned as a
|
|
@@ -51,7 +51,7 @@ describe("real Pi-session subagent E2E", { skip: !available ? "pi runtime packag
|
|
|
51
51
|
it("loads requested extension tools in direct and workflow children and diagnoses missing providers", async () => {
|
|
52
52
|
const { runRealSubagentSession, subagentCall, subagentToolResults } = await import("../support/real-session-runner.ts");
|
|
53
53
|
const extensionAgent = `---
|
|
54
|
-
name: extension-
|
|
54
|
+
name: extension-worker
|
|
55
55
|
description: Uses a child-only fixture tool
|
|
56
56
|
tools: read, fixture_search
|
|
57
57
|
subagentOnlyExtensions: ./fixture-extension.ts
|
|
@@ -59,7 +59,7 @@ completionGuard: false
|
|
|
59
59
|
---
|
|
60
60
|
Use the available tools.`;
|
|
61
61
|
const missingAgent = `---
|
|
62
|
-
name: missing-extension-
|
|
62
|
+
name: missing-extension-worker
|
|
63
63
|
description: Requests an extension tool without loading its provider
|
|
64
64
|
tools: read, missing_search
|
|
65
65
|
completionGuard: false
|
|
@@ -80,22 +80,22 @@ Use the available tools.`;
|
|
|
80
80
|
childText: CHILD_MARKER,
|
|
81
81
|
reportChildTools: true,
|
|
82
82
|
projectFiles: {
|
|
83
|
-
".selesai/agents/extension-
|
|
84
|
-
".selesai/agents/missing-extension-
|
|
83
|
+
".selesai/agents/extension-worker.md": extensionAgent,
|
|
84
|
+
".selesai/agents/missing-extension-worker.md": missingAgent,
|
|
85
85
|
"fixture-extension.ts": fixtureExtension,
|
|
86
86
|
},
|
|
87
87
|
respond(context) {
|
|
88
88
|
const resultCount = (context.messages as Array<{ role?: string; toolName?: string }>).filter((message) => message.role === "toolResult" && message.toolName === "subagent").length;
|
|
89
89
|
if (resultCount === 0) {
|
|
90
|
-
return subagentCall({ agent: "extension-
|
|
90
|
+
return subagentCall({ agent: "extension-worker", task: "Report active tools.", context: "fresh", async: false, clarify: false, agentScope: "project" }, "call-direct-extension");
|
|
91
91
|
}
|
|
92
92
|
if (resultCount === 1) {
|
|
93
93
|
return subagentCall({
|
|
94
94
|
workflowScript: `return await runs.all([
|
|
95
|
-
{ key: "extension", agent: "extension-
|
|
95
|
+
{ key: "extension", agent: "extension-worker", task: "Report active tools." },
|
|
96
96
|
{
|
|
97
97
|
key: "structured",
|
|
98
|
-
agent: "extension-
|
|
98
|
+
agent: "extension-worker",
|
|
99
99
|
task: "Submit the required structured marker.",
|
|
100
100
|
outputSchema: {
|
|
101
101
|
type: "object",
|
|
@@ -111,7 +111,7 @@ Use the available tools.`;
|
|
|
111
111
|
}, "call-workflow-extension");
|
|
112
112
|
}
|
|
113
113
|
if (resultCount === 2) {
|
|
114
|
-
return subagentCall({ agent: "missing-extension-
|
|
114
|
+
return subagentCall({ agent: "missing-extension-worker", task: "Report active tools.", context: "fresh", async: false, clarify: false, agentScope: "project" }, "call-missing-extension");
|
|
115
115
|
}
|
|
116
116
|
return "Child tool checks complete.";
|
|
117
117
|
},
|
|
@@ -134,7 +134,7 @@ Use the available tools.`;
|
|
|
134
134
|
it("accepts child tools registered by async before_agent_start hooks", async () => {
|
|
135
135
|
const { runRealSubagentSession, subagentCall, subagentToolResults } = await import("../support/real-session-runner.ts");
|
|
136
136
|
const asyncExtensionAgent = `---
|
|
137
|
-
name: async-extension-
|
|
137
|
+
name: async-extension-worker
|
|
138
138
|
description: Uses a child-only tool registered from before_agent_start
|
|
139
139
|
tools: read, fixture_async_search
|
|
140
140
|
subagentOnlyExtensions: ./fixture-async-extension.ts
|
|
@@ -159,13 +159,13 @@ Report active tools.`;
|
|
|
159
159
|
childText: CHILD_MARKER,
|
|
160
160
|
reportChildTools: true,
|
|
161
161
|
projectFiles: {
|
|
162
|
-
".selesai/agents/async-extension-
|
|
162
|
+
".selesai/agents/async-extension-worker.md": asyncExtensionAgent,
|
|
163
163
|
"fixture-async-extension.ts": fixtureAsyncExtension,
|
|
164
164
|
},
|
|
165
165
|
respond(context) {
|
|
166
166
|
const resultCount = (context.messages as Array<{ role?: string; toolName?: string }>).filter((message) => message.role === "toolResult" && message.toolName === "subagent").length;
|
|
167
167
|
if (resultCount > 0) return "Async child tool check complete.";
|
|
168
|
-
return subagentCall({ agent: "async-extension-
|
|
168
|
+
return subagentCall({ agent: "async-extension-worker", task: "Report active tools.", context: "fresh", async: false, clarify: false, agentScope: "project" }, "call-async-extension");
|
|
169
169
|
},
|
|
170
170
|
timeoutMs: 60_000,
|
|
171
171
|
});
|
|
@@ -191,12 +191,12 @@ Report active tools.`;
|
|
|
191
191
|
|
|
192
192
|
try {
|
|
193
193
|
run = await runRealSubagentSession({
|
|
194
|
-
prompt: "Delegate to a
|
|
194
|
+
prompt: "Delegate to a worker and report its exact result.",
|
|
195
195
|
childText: CHILD_MARKER,
|
|
196
196
|
respond: routeParentThroughSubagent({
|
|
197
197
|
childMarker: CHILD_MARKER,
|
|
198
198
|
subagentArgs: {
|
|
199
|
-
agent: "
|
|
199
|
+
agent: "worker",
|
|
200
200
|
task: "Return the marker from the faux child provider.",
|
|
201
201
|
context: "fresh",
|
|
202
202
|
async: false,
|