@selesai/code 0.9.11 → 0.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/config.d.ts +4 -6
- package/dist/config.js +10 -14
- package/dist/core/agent-session.d.ts +0 -1
- package/dist/core/agent-session.js +3 -49
- package/dist/core/extensions/types.d.ts +0 -2
- package/dist/core/settings-manager.d.ts +0 -2
- package/dist/core/settings-manager.js +0 -3
- package/dist/core/tools/index.d.ts +0 -1
- package/dist/core/tools/index.js +0 -1
- package/dist/defaults/settings.json +0 -1
- package/dist/extensions/model-prompt-injector/index.test.ts +0 -10
- package/dist/extensions/model-prompt-injector/index.ts +0 -3
- package/dist/extensions/pi-intercom/CHANGELOG.md +53 -16
- package/dist/extensions/pi-intercom/README.md +41 -8
- package/dist/extensions/pi-intercom/banner.png +0 -0
- package/dist/extensions/pi-intercom/broker/broker.ts +498 -215
- package/dist/extensions/pi-intercom/broker/client.ts +39 -12
- package/dist/extensions/pi-intercom/broker/extension.test.ts +102 -3
- package/dist/extensions/pi-intercom/broker/paths.test.ts +2 -2
- package/dist/extensions/pi-intercom/broker/protocol.ts +26 -0
- package/dist/extensions/pi-intercom/broker/spawn.test.ts +5 -20
- package/dist/extensions/pi-intercom/config.test.ts +41 -0
- package/dist/extensions/pi-intercom/config.ts +21 -0
- package/dist/extensions/pi-intercom/extension-api.ts +40 -0
- package/dist/extensions/pi-intercom/index.ts +362 -26
- package/dist/extensions/pi-intercom/intercom.integration.test.ts +819 -13
- package/dist/extensions/pi-intercom/package.json +1 -1
- package/dist/extensions/pi-intercom/project-agent.ts +2 -2
- package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +8 -110
- package/dist/extensions/pi-intercom/types.ts +32 -5
- package/dist/extensions/pi-intercom/ui/inline-message.ts +6 -0
- package/dist/extensions/pi-subagents/.github/assets/subagent-fleet-inspector.png +0 -0
- package/dist/extensions/pi-subagents/.github/workflows/release.yml +28 -0
- package/dist/extensions/pi-subagents/.github/workflows/test.yml +51 -0
- package/dist/extensions/pi-subagents/.greptile/config.json +33 -0
- package/dist/extensions/pi-subagents/.greptile/files.json +8 -0
- package/dist/extensions/pi-subagents/.greptile/rules.md +16 -0
- package/dist/extensions/pi-subagents/CHANGELOG.md +309 -87
- package/dist/extensions/pi-subagents/README.md +15 -17
- package/dist/extensions/pi-subagents/agents/oracle.md +3 -1
- package/dist/extensions/pi-subagents/agents/researcher.md +32 -13
- package/dist/extensions/pi-subagents/agents/reviewer.md +13 -2
- package/dist/extensions/pi-subagents/agents/scout.md +2 -2
- package/dist/extensions/pi-subagents/agents/worker.md +2 -1
- package/dist/extensions/pi-subagents/async-retention-discovery-worker.mjs +180 -0
- package/dist/extensions/pi-subagents/docs/configuration.md +106 -27
- package/dist/extensions/pi-subagents/docs/extension-api.md +85 -21
- package/dist/extensions/pi-subagents/docs/missions.md +41 -4
- package/dist/extensions/pi-subagents/docs/models.md +52 -9
- package/dist/extensions/pi-subagents/docs/observability.md +103 -16
- package/dist/extensions/pi-subagents/docs/tool-reference.md +60 -45
- package/dist/extensions/pi-subagents/docs/watchdog.md +60 -3
- package/dist/extensions/pi-subagents/docs/workflows.md +181 -7
- package/dist/extensions/pi-subagents/index.ts +10 -1
- package/dist/extensions/pi-subagents/install.mjs +4 -4
- package/dist/extensions/pi-subagents/package-lock.json +1483 -1470
- package/dist/extensions/pi-subagents/package.json +6 -3
- package/dist/extensions/pi-subagents/prompts/council.md +60 -0
- package/dist/extensions/pi-subagents/prompts/parallel-review.md +5 -1
- package/dist/extensions/pi-subagents/prompts/review-loop.md +9 -5
- package/dist/extensions/pi-subagents/skills/council-mode/SKILL.md +254 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +18 -17
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +31 -9
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +107 -140
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +9 -12
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +39 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +44 -92
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +261 -368
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +6 -2
- package/dist/extensions/pi-subagents/src/agents/agents.ts +388 -85
- package/dist/extensions/pi-subagents/src/agents/builtin-names.ts +14 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-registry.ts +418 -0
- package/dist/extensions/pi-subagents/src/agents/skills.ts +1 -1
- package/dist/extensions/pi-subagents/src/api/agents.ts +7 -0
- package/dist/extensions/pi-subagents/src/api/external-job-provider.ts +195 -0
- package/dist/extensions/pi-subagents/src/api/preflight.ts +88 -27
- package/dist/extensions/pi-subagents/src/api/project-panes.ts +2 -0
- package/dist/extensions/pi-subagents/src/api/shared-types.ts +2 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +20 -11
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +14 -6
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +5 -4
- package/dist/extensions/pi-subagents/src/extension/index.ts +270 -187
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +65 -28
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +120 -11
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +46 -64
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +51 -37
- package/dist/extensions/pi-subagents/src/extension/tool-result.ts +19 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +2 -2
- package/dist/extensions/pi-subagents/src/inspectors/herdr/client.ts +3 -3
- package/dist/extensions/pi-subagents/src/inspectors/herdr/focus.ts +55 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +2 -1
- package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +230 -46
- package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +26 -4
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +32 -10
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +6 -1
- package/dist/extensions/pi-subagents/src/missions/store.ts +4 -9
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +2 -2
- package/dist/extensions/pi-subagents/src/policy/authority.ts +2 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +31 -8
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +210 -52
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +63 -33
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +71 -17
- package/dist/extensions/pi-subagents/src/runs/background/async-retention.ts +886 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-status-snapshot.ts +14 -5
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +49 -56
- package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +1 -0
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +3 -33
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +5 -0
- package/dist/extensions/pi-subagents/src/runs/background/completion-dedupe.ts +5 -1
- package/dist/extensions/pi-subagents/src/runs/background/completion-replay.ts +22 -12
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +105 -71
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +68 -19
- package/dist/extensions/pi-subagents/src/runs/background/index-segment.ts +59 -0
- package/dist/extensions/pi-subagents/src/runs/background/inspect-rpc.ts +443 -0
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +94 -10
- package/dist/extensions/pi-subagents/src/runs/background/result-files.ts +158 -90
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +141 -53
- package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +8 -5
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +14 -4
- package/dist/extensions/pi-subagents/src/runs/background/run-id-query.ts +7 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +13 -14
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +46 -25
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +823 -0
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +9 -3
- package/dist/extensions/pi-subagents/src/runs/background/steering.ts +11 -1
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +594 -216
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +17 -13
- package/dist/extensions/pi-subagents/src/runs/background/terminal-run-index.ts +138 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +23 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +82 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +5 -3
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +21 -14
- package/dist/extensions/pi-subagents/src/runs/foreground/async-stop-action.ts +23 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +153 -58
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +7 -9
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1283 -1657
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +274 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +6 -5
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +59 -10
- package/dist/extensions/pi-subagents/src/runs/shared/agent-contract.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/chain-outputs.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/child-identity.ts +36 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +52 -2
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/extension-bindings.ts +78 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-bridge.ts +460 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-runner.ts +389 -0
- package/dist/extensions/pi-subagents/src/runs/shared/fast-mode-extension.ts +10 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +14 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-exclusions.ts +243 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +201 -85
- package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +106 -39
- package/dist/extensions/pi-subagents/src/runs/shared/mutation-evidence.ts +145 -0
- package/dist/extensions/pi-subagents/src/runs/shared/orca-progress-tabs.ts +150 -27
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +46 -4
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +19 -15
- package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +5 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +86 -2
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +9 -9
- package/dist/extensions/pi-subagents/src/runs/shared/session-lease.ts +0 -6
- package/dist/extensions/pi-subagents/src/runs/shared/structured-output.ts +18 -4
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-control.ts +51 -7
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +62 -21
- package/dist/extensions/pi-subagents/src/runs/shared/tool-availability.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/tool-timeout.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/workflow-graph.ts +1 -23
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +14 -2
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +2 -2
- package/dist/extensions/pi-subagents/src/shared/atomic-json.ts +22 -2
- package/dist/extensions/pi-subagents/src/shared/capacity-resilient-json.ts +102 -0
- package/dist/extensions/pi-subagents/src/shared/completion-owner.ts +14 -0
- package/dist/extensions/pi-subagents/src/shared/file-system-retry.ts +49 -1
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +59 -1
- package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +12 -5
- package/dist/extensions/pi-subagents/src/shared/model-info.ts +20 -0
- package/dist/extensions/pi-subagents/src/shared/prompt-resources.ts +0 -40
- package/dist/extensions/pi-subagents/src/shared/settings.ts +11 -30
- package/dist/extensions/pi-subagents/src/shared/thinking-ceiling.ts +52 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +228 -49
- package/dist/extensions/pi-subagents/src/shared/utils.ts +11 -3
- package/dist/extensions/pi-subagents/src/shared/watch-strategy.ts +10 -0
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +0 -162
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +2 -5
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +105 -13
- package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +6 -36
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +829 -0
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +1415 -0
- package/dist/extensions/pi-subagents/src/tui/render.ts +78 -7
- package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +1 -0
- package/dist/extensions/pi-subagents/src/watchdog/permission-arbiter.ts +59 -51
- package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +8 -2
- package/dist/extensions/pi-subagents/src/watchdog/tool-actions.ts +2 -1
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +4 -4
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +471 -86
- package/dist/extensions/pi-subagents/src/workflows/workflow-receipt.ts +140 -0
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/args.d.ts +57 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/config-selector.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/file-processor.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/initial-message.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/list-models.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/project-trust.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/session-picker.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/startup-ui.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/config.d.ts +96 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-runtime.d.ts +119 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-services.d.ts +85 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session.d.ts +620 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-guidance.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-storage.d.ts +56 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/bash-executor.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/cache-stats.d.ts +49 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/branch-summarization.d.ts +93 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/compaction.d.ts +128 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/index.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/utils.d.ts +38 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/defaults.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/diagnostics.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/event-bus.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/exec.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/experimental.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/index.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/index.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/loader.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/runner.d.ts +171 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/types.d.ts +1261 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/footer-data-provider.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/index.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/keybindings.d.ts +358 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/messages.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-config.d.ts +512 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-registry.d.ts +43 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-resolver.d.ts +121 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-runtime.d.ts +82 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/models-store.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/output-guard.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/package-manager.d.ts +210 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/project-trust.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/prompt-templates.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-attribution.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-composer.d.ts +55 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/radius.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resource-loader.d.ts +206 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/sdk.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-cwd.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-manager.d.ts +356 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/settings-manager.d.ts +297 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/skills.d.ts +60 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/slash-commands.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/source-info.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/system-prompt.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/telemetry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/timings.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/bash.d.ts +68 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit-diff.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit.d.ts +51 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/find.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/grep.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/index.d.ts +40 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/ls.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/read.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/render-utils.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/truncate.d.ts +70 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/write.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/trust-manager.d.ts +36 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/usage-totals.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/index.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/main.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/migrations.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/index.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/assistant-message.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/config-selector.d.ts +102 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/footer.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/index.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/model-selector.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/settings-selector.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/status-indicator.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tool-execution.d.ts +63 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tree-selector.d.ts +94 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/interactive-mode.d.ts +394 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme.d.ts +120 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/print-mode.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-client.d.ts +246 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-types.d.ts +457 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/package-manager-cli.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/rpc-entry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/ansi.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/changelog.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/child-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/deprecation.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/frontmatter.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/fs-watch.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/git.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/html.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-convert.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/json.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/mime.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/open-browser.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/paths.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/photon.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/shell.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/sleep.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/tools-manager.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/version-check.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/index.mjs +1 -1
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +0 -54
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +1053 -414
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +194 -4
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +59 -4
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +0 -77
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +107 -6
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +211 -897
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +265 -375
- package/dist/extensions/pi-subagents/test/integration/orca-progress-tabs.test.ts +77 -7
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +547 -30
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +2112 -310
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +274 -34
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +20 -3
- package/dist/extensions/pi-subagents/test/support/isolated-temp-root.mjs +9 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +30 -5
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +2 -0
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +4 -2
- package/dist/extensions/pi-subagents/test/support/register-loader.mjs +1 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +197 -0
- package/dist/extensions/pi-subagents/test/unit/agent-contract.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +204 -27
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +444 -145
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +256 -4
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +9 -7
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +152 -22
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +29 -0
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +205 -23
- package/dist/extensions/pi-subagents/test/unit/async-retention.test.ts +579 -0
- package/dist/extensions/pi-subagents/test/unit/atomic-json.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/auto-drain.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/capacity-resilient-json.test.ts +155 -0
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +7 -0
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +123 -0
- package/dist/extensions/pi-subagents/test/unit/completion-replay.test.ts +81 -3
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +109 -7
- package/dist/extensions/pi-subagents/test/unit/default-extensions.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +5 -2
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +3 -2
- package/dist/extensions/pi-subagents/test/unit/extension-bindings.test.ts +79 -0
- package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/external-job-runner.test.ts +961 -0
- package/dist/extensions/pi-subagents/test/unit/file-system-retry.test.ts +64 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +1110 -0
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +1664 -0
- package/dist/extensions/pi-subagents/test/unit/fork-context.test.ts +81 -1
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +138 -11
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +41 -2
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +210 -79
- package/dist/extensions/pi-subagents/test/unit/index-segment.test.ts +95 -0
- package/dist/extensions/pi-subagents/test/unit/inspect-rpc.test.ts +596 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +10 -1
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +3 -5
- package/dist/extensions/pi-subagents/test/unit/model-exclusions.test.ts +167 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +319 -18
- package/dist/extensions/pi-subagents/test/unit/model-info.test.ts +78 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +19 -5
- package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +44 -0
- package/dist/extensions/pi-subagents/test/unit/mutation-evidence.test.ts +129 -0
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +231 -2
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +28 -1
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +106 -2
- package/dist/extensions/pi-subagents/test/unit/orca-progress-tabs.test.ts +204 -7
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +59 -4
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +2 -6
- package/dist/extensions/pi-subagents/test/unit/pi-args-permission-system.test.ts +34 -2
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +116 -6
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +12 -3
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +56 -61
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +416 -1
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +9 -2
- package/dist/extensions/pi-subagents/test/unit/project-panes-public-api.test.ts +42 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +21 -30
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +86 -11
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +49 -1
- package/dist/extensions/pi-subagents/test/unit/result-files.test.ts +233 -5
- package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +28 -5
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +323 -20
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +66 -10
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +68 -5
- package/dist/extensions/pi-subagents/test/unit/runtime-agent-registration.test.ts +174 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +679 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-store-root.test.ts +67 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +55 -44
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +399 -84
- package/dist/extensions/pi-subagents/test/unit/session-lease.test.ts +13 -0
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +15 -10
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +11 -7
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -0
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +40 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +10 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +38 -3
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +110 -12
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +204 -19
- package/dist/extensions/pi-subagents/test/unit/temp-paths.test.ts +25 -0
- package/dist/extensions/pi-subagents/test/unit/thinking-ceiling.test.ts +73 -0
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +90 -50
- package/dist/extensions/pi-subagents/test/unit/tool-timeout.test.ts +1 -2
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +234 -7
- package/dist/extensions/pi-subagents/test/unit/watch-strategy.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-permission-arbiter.test.ts +36 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +37 -9
- package/dist/extensions/pi-subagents/test/unit/workflow-detach-reconcile.test.ts +302 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +167 -7
- package/dist/extensions/pi-subagents/test/unit/workflow-receipt.test.ts +113 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +6 -6
- package/dist/extensions/ponytail/index.js +31 -25
- package/dist/extensions/ponytail/ponytail-config.cjs +34 -7
- package/dist/extensions/ponytail/ponytail-instructions.cjs +7 -9
- package/dist/extensions/ponytail/test/extension.test.js +7 -8
- package/dist/extensions/ponytail/test/helpers.test.js +1 -1
- package/dist/skills/brandkit/SKILL.md +799 -0
- package/dist/skills/design-taste-frontend/SKILL.md +1207 -0
- package/dist/skills/design-taste-frontend-v1/SKILL.md +227 -0
- package/dist/skills/full-output-enforcement/SKILL.md +50 -0
- package/dist/skills/gpt-taste/SKILL.md +75 -0
- package/dist/skills/high-end-visual-design/SKILL.md +99 -0
- package/dist/skills/image-to-code/SKILL.md +1229 -0
- package/dist/skills/imagegen-frontend-mobile/SKILL.md +1466 -0
- package/dist/skills/imagegen-frontend-web/SKILL.md +988 -0
- package/dist/skills/industrial-brutalist-ui/SKILL.md +93 -0
- package/dist/skills/minimalist-ui/SKILL.md +86 -0
- package/dist/skills/pi-subagents/SKILL.md +18 -17
- package/dist/skills/pi-subagents/references/constraints-and-recipes.md +31 -9
- package/dist/skills/pi-subagents/references/execution-controls.md +95 -143
- package/dist/skills/pi-subagents/references/management-authoring-rpc.md +9 -12
- package/dist/skills/pi-subagents/references/multi-lane-orchestration.md +39 -0
- package/dist/skills/pi-subagents/references/prompting-and-roles.md +45 -94
- package/dist/skills/ponytail/SKILL.md +12 -8
- package/dist/skills/ponytail-audit/SKILL.md +0 -1
- package/dist/skills/ponytail-debt/SKILL.md +0 -1
- package/dist/skills/ponytail-gain/SKILL.md +0 -1
- package/dist/skills/ponytail-help/SKILL.md +4 -3
- package/dist/skills/ponytail-review/SKILL.md +0 -1
- package/dist/skills/redesign-existing-projects/SKILL.md +179 -0
- package/dist/skills/stitch-design-taste/SKILL.md +185 -0
- package/dist/skills/unlazy/CHANGELOG.md +100 -0
- package/dist/skills/unlazy/CONTRIBUTING.md +66 -0
- package/dist/skills/unlazy/LICENSE +21 -0
- package/dist/skills/unlazy/README.md +242 -0
- package/dist/skills/unlazy/SECURITY.md +70 -0
- package/dist/skills/unlazy/SKILL.md +100 -0
- package/dist/skills/unlazy/package.json +13 -0
- package/dist/skills/unlazy/references/dispatch.md +82 -0
- package/dist/skills/unlazy/references/gates.md +132 -0
- package/dist/skills/unlazy/references/method.md +49 -0
- package/dist/skills/unlazy/references/orchestration.md +99 -0
- package/dist/skills/unlazy/references/parallel.md +123 -0
- package/dist/skills/unlazy/references/token-economy.md +39 -0
- package/dist/skills/unlazy/research/validation-protocol.md +81 -0
- package/dist/skills/unlazy/scripts/dispatch-check.mjs +108 -0
- package/dist/skills/unlazy/scripts/gate-check.mjs +894 -0
- package/dist/skills/unlazy/scripts/gate-lint.mjs +178 -0
- package/dist/skills/unlazy/scripts/install-hooks.mjs +206 -0
- package/dist/skills/unlazy/scripts/lib/check-supervisor.mjs +46 -0
- package/dist/skills/unlazy/scripts/lib/dispatch.mjs +283 -0
- package/dist/skills/unlazy/scripts/lib/gates.mjs +629 -0
- package/dist/skills/unlazy/scripts/lib/process-tree.mjs +161 -0
- package/dist/skills/unlazy/scripts/lib/regex-worker.mjs +9 -0
- package/dist/skills/unlazy/scripts/stop-hook.mjs +174 -0
- package/dist/skills/unlazy/templates/PLAN.md +65 -0
- package/dist/skills/unlazy/templates/gates-leaf.md +51 -0
- package/dist/skills/unlazy/templates/gates-node.md +50 -0
- package/dist/skills/unlazy/tests/contract-tests.mjs +127 -0
- package/dist/skills/unlazy/tests/dispatch-tests.mjs +481 -0
- package/dist/skills/unlazy/tests/hardening-tests.mjs +903 -0
- package/dist/skills/unlazy/tests/lint-tests.mjs +242 -0
- package/dist/skills/unlazy/tests/run-tests.mjs +554 -0
- package/dist/skills/unlazy/tests/self-check.mjs +165 -0
- package/dist/skills/unlazy/tests/stress-tests.mjs +356 -0
- package/dist/skills/web-design-guidelines/SKILL.md +40 -0
- package/docs/settings.md +0 -5
- package/package.json +1 -1
- package/dist/core/tools/schema-prune.d.ts +0 -16
- package/dist/core/tools/schema-prune.js +0 -39
- package/dist/core/tools/schema-prune.test.d.ts +0 -1
- package/dist/core/tools/schema-prune.test.js +0 -111
- package/dist/extensions/pi-subagents/UPSTREAM-V0.50-MAPPING.md +0 -172
- package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +0 -55
- package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +0 -61
- package/dist/extensions/pi-subagents/src/agents/task-aware-routing.ts +0 -132
- package/dist/extensions/pi-subagents/src/extension/chain-validation.ts +0 -181
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +0 -1354
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +0 -1581
- package/dist/extensions/pi-subagents/src/shared/env.ts +0 -16
- package/dist/extensions/pi-subagents/src/shared/session-lineage.ts +0 -71
- package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +0 -136
- package/dist/extensions/pi-subagents/src/workflows/workflow-auto-relaunch.ts +0 -41
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +0 -466
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +0 -1859
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +0 -733
- package/dist/extensions/pi-subagents/test/unit/builtin-agent-documentation.test.ts +0 -63
- package/dist/extensions/pi-subagents/test/unit/chain-validation.test.ts +0 -326
- package/dist/extensions/pi-subagents/test/unit/handoff-adoption.test.ts +0 -103
- package/dist/extensions/pi-subagents/test/unit/inline-subagents.test.ts +0 -127
- package/dist/extensions/pi-subagents/test/unit/session-lineage.test.ts +0 -73
- package/dist/extensions/pi-subagents/test/unit/task-aware-routing.test.ts +0 -213
- package/dist/extensions/pi-subagents/test/unit/workflow-auto-relaunch.test.ts +0 -65
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { describe, it } from "node:test";
|
|
6
|
+
import {
|
|
7
|
+
encodeInspectReply,
|
|
8
|
+
handleInspectRpcArgs,
|
|
9
|
+
INSPECT_REPLY_KIND,
|
|
10
|
+
INSPECT_REPLY_VERSION,
|
|
11
|
+
INSPECT_WIDGET_PREFIX,
|
|
12
|
+
MAX_SERIALIZED_BYTES,
|
|
13
|
+
buildInspectReply,
|
|
14
|
+
parseInspectRequest,
|
|
15
|
+
type InspectDeps,
|
|
16
|
+
} from "../../src/runs/background/inspect-rpc.ts";
|
|
17
|
+
import { writeAsyncResultFile } from "../../src/runs/background/result-files.ts";
|
|
18
|
+
import { recordWaitCompletion } from "../../src/runs/background/wait-completions.ts";
|
|
19
|
+
import { completionArchivePath, completionReplayPath } from "../../src/runs/background/completion-replay.ts";
|
|
20
|
+
import { formatOutputArtifactContent } from "../../src/shared/artifacts.ts";
|
|
21
|
+
import type { SubagentState } from "../../src/shared/types.ts";
|
|
22
|
+
|
|
23
|
+
const SESSION_ID = "session-current";
|
|
24
|
+
|
|
25
|
+
function makeState(root: string, sessionId: string | null = SESSION_ID): SubagentState {
|
|
26
|
+
return {
|
|
27
|
+
currentSessionId: sessionId,
|
|
28
|
+
foregroundControls: new Map(),
|
|
29
|
+
foregroundRuns: new Map(),
|
|
30
|
+
asyncJobs: new Map(),
|
|
31
|
+
trustedSessionRoots: [root],
|
|
32
|
+
} as unknown as SubagentState;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface FixtureOptions {
|
|
36
|
+
runId: string;
|
|
37
|
+
sessionId?: string;
|
|
38
|
+
state?: string;
|
|
39
|
+
mode?: string;
|
|
40
|
+
context?: string;
|
|
41
|
+
steps?: Array<Record<string, unknown>>;
|
|
42
|
+
sessionMessages?: Array<Record<string, unknown>>;
|
|
43
|
+
resultPayload?: Record<string, unknown>;
|
|
44
|
+
error?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function makeRun(root: string, options: FixtureOptions): { asyncDir: string; resultsDir: string; sessionFile: string } {
|
|
48
|
+
const asyncRoot = path.join(root, "runs");
|
|
49
|
+
const resultsDir = path.join(root, "results");
|
|
50
|
+
const asyncDir = path.join(asyncRoot, options.runId);
|
|
51
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
52
|
+
fs.mkdirSync(resultsDir, { recursive: true });
|
|
53
|
+
const sessionFile = path.join(root, `${options.runId}-session.jsonl`);
|
|
54
|
+
const records = (options.sessionMessages ?? []).map((message) => JSON.stringify({ message }));
|
|
55
|
+
fs.writeFileSync(sessionFile, records.length > 0 ? `${records.join("\n")}\n` : "", "utf-8");
|
|
56
|
+
const steps = (options.steps ?? [{ agent: "worker", status: options.state ?? "complete", startedAt: 100, endedAt: 150, sessionFile }])
|
|
57
|
+
.map((step) => ({ ...step }));
|
|
58
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify({
|
|
59
|
+
runId: options.runId,
|
|
60
|
+
sessionId: options.sessionId ?? SESSION_ID,
|
|
61
|
+
mode: options.mode ?? "single",
|
|
62
|
+
state: options.state ?? "complete",
|
|
63
|
+
...(options.context ? { context: options.context } : {}),
|
|
64
|
+
startedAt: 100,
|
|
65
|
+
endedAt: 200,
|
|
66
|
+
lastUpdate: 200,
|
|
67
|
+
...(options.error ? { error: options.error } : {}),
|
|
68
|
+
sessionFile,
|
|
69
|
+
steps,
|
|
70
|
+
}, null, 2), "utf-8");
|
|
71
|
+
if (options.resultPayload) {
|
|
72
|
+
writeAsyncResultFile(path.join(resultsDir, `${options.runId}.json`), {
|
|
73
|
+
runId: options.runId,
|
|
74
|
+
sessionId: options.sessionId ?? SESSION_ID,
|
|
75
|
+
...options.resultPayload,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return { asyncDir, resultsDir, sessionFile };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function makeDeps(root: string, resultsDir: string, state?: SubagentState): InspectDeps {
|
|
82
|
+
return {
|
|
83
|
+
state: state ?? makeState(root),
|
|
84
|
+
asyncDirRoot: path.join(root, "runs"),
|
|
85
|
+
resultsDir,
|
|
86
|
+
kill: () => true,
|
|
87
|
+
now: () => 1_000,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const userMessage = (text: string) => ({ role: "user", content: text });
|
|
92
|
+
const assistantMessage = (text: string) => ({ role: "assistant", content: [{ type: "text", text }] });
|
|
93
|
+
const toolCallMessage = (name: string, args: unknown) => ({ role: "assistant", content: [{ type: "toolCall", name, args }] });
|
|
94
|
+
|
|
95
|
+
describe("inspect-rpc request parsing", () => {
|
|
96
|
+
it("parses positional args and --lines", () => {
|
|
97
|
+
const parsed = parseInspectRequest("req-1 run-1 child-2 --lines 25");
|
|
98
|
+
assert.deepEqual(parsed.request, { requestId: "req-1", asyncId: "run-1", childId: "child-2", lines: 25 });
|
|
99
|
+
});
|
|
100
|
+
it("rejects bad requestId charset, unknown flags, extra positionals", () => {
|
|
101
|
+
assert.match(parseInspectRequest("bad!id run-1").error ?? "", /requestId/);
|
|
102
|
+
assert.match(parseInspectRequest("req-1 run-1 --bogus").error ?? "", /Unknown flag/);
|
|
103
|
+
assert.match(parseInspectRequest("req-1 run-1 a b").error ?? "", /Too many positional/);
|
|
104
|
+
assert.match(parseInspectRequest("req-1 run-1 --lines nope").error ?? "", /--lines/);
|
|
105
|
+
assert.match(parseInspectRequest("req-1").error ?? "", /Usage/);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe("inspect-rpc resolution and ownership", () => {
|
|
110
|
+
it("does not expose async artifact paths when status is malformed", () => {
|
|
111
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-malformed-"));
|
|
112
|
+
const { asyncDir, resultsDir } = makeRun(root, { runId: "run-malformed" });
|
|
113
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), "{ not json", "utf-8");
|
|
114
|
+
const reply = buildInspectReply({ requestId: "r-malformed", asyncId: "run-malformed" }, makeDeps(root, resultsDir));
|
|
115
|
+
assert.equal(reply.error?.code, "internal");
|
|
116
|
+
assert.equal(JSON.stringify(reply).includes(root), false);
|
|
117
|
+
});
|
|
118
|
+
it("returns not_found for an unknown run", () => {
|
|
119
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-missing-"));
|
|
120
|
+
const reply = buildInspectReply({ requestId: "r1", asyncId: "nope" }, makeDeps(root, path.join(root, "results")));
|
|
121
|
+
assert.equal(reply.error?.code, "not_found");
|
|
122
|
+
assert.equal(reply.requestId, "r1");
|
|
123
|
+
});
|
|
124
|
+
it("returns foreign_session and no data for runs owned by another session", () => {
|
|
125
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-foreign-"));
|
|
126
|
+
const { resultsDir } = makeRun(root, { runId: "run-foreign", sessionId: "session-other" });
|
|
127
|
+
const reply = buildInspectReply({ requestId: "r2", asyncId: "run-foreign" }, makeDeps(root, resultsDir));
|
|
128
|
+
assert.equal(reply.error?.code, "foreign_session");
|
|
129
|
+
assert.equal(reply.messages, undefined);
|
|
130
|
+
assert.equal(reply.task, undefined);
|
|
131
|
+
assert.equal(reply.finalOutput, undefined);
|
|
132
|
+
});
|
|
133
|
+
it("returns no_active_session when the request cannot be attributed", () => {
|
|
134
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-nosession-"));
|
|
135
|
+
const { resultsDir } = makeRun(root, { runId: "run-x" });
|
|
136
|
+
const reply = buildInspectReply({ requestId: "r3", asyncId: "run-x" }, makeDeps(root, resultsDir, makeState(root, null)));
|
|
137
|
+
assert.equal(reply.error?.code, "no_active_session");
|
|
138
|
+
});
|
|
139
|
+
it("returns stale when artifacts are gone", () => {
|
|
140
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-stale-"));
|
|
141
|
+
const asyncRoot = path.join(root, "runs");
|
|
142
|
+
fs.mkdirSync(path.join(asyncRoot, "run-stale"), { recursive: true });
|
|
143
|
+
const reply = buildInspectReply({ requestId: "r4", asyncId: "run-stale" }, makeDeps(root, path.join(root, "results")));
|
|
144
|
+
assert.equal(reply.error?.code, "stale");
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
describe("inspect-rpc reply content", () => {
|
|
149
|
+
it("returns task, messages, and final output without leaking paths", () => {
|
|
150
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-full-"));
|
|
151
|
+
const sessionFile = path.join(root, "run-1-session.jsonl");
|
|
152
|
+
const { resultsDir } = makeRun(root, {
|
|
153
|
+
runId: "run-1",
|
|
154
|
+
sessionMessages: [
|
|
155
|
+
userMessage("Summarize the repo"),
|
|
156
|
+
toolCallMessage("bash", { command: "ls" }),
|
|
157
|
+
assistantMessage("Done."),
|
|
158
|
+
],
|
|
159
|
+
resultPayload: { summary: "Run summary", results: [{ agent: "worker", output: "final answer", success: true }] },
|
|
160
|
+
});
|
|
161
|
+
const reply = buildInspectReply({ requestId: "r5", asyncId: "run-1" }, makeDeps(root, resultsDir));
|
|
162
|
+
assert.equal(reply.error, undefined);
|
|
163
|
+
assert.equal(reply.kind, INSPECT_REPLY_KIND);
|
|
164
|
+
assert.equal(reply.version, INSPECT_REPLY_VERSION);
|
|
165
|
+
assert.equal(reply.status, "complete");
|
|
166
|
+
assert.equal(reply.task, "Summarize the repo");
|
|
167
|
+
assert.equal(reply.finalOutput, "Run summary");
|
|
168
|
+
assert.equal(reply.messages?.length, 3);
|
|
169
|
+
assert.equal(reply.messages?.[1]?.kind, "toolCall");
|
|
170
|
+
assert.equal(reply.messages?.[1]?.name, "bash");
|
|
171
|
+
const serialized = JSON.stringify(reply);
|
|
172
|
+
assert.equal(serialized.includes(sessionFile), false);
|
|
173
|
+
assert.equal(serialized.includes(root), false);
|
|
174
|
+
});
|
|
175
|
+
it("resolves a direct step child by snapshot node id", () => {
|
|
176
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-child-"));
|
|
177
|
+
const childSession = path.join(root, "child.jsonl");
|
|
178
|
+
fs.writeFileSync(childSession, `${JSON.stringify({ message: userMessage("child task") })}\n`, "utf-8");
|
|
179
|
+
const { resultsDir } = makeRun(root, {
|
|
180
|
+
runId: "run-parent",
|
|
181
|
+
mode: "workflow",
|
|
182
|
+
steps: [
|
|
183
|
+
{ agent: "planner", label: "plan", status: "complete", workflowKey: "step-a", startedAt: 100, endedAt: 150, sessionFile: childSession },
|
|
184
|
+
],
|
|
185
|
+
resultPayload: { summary: "parent", results: [{ agent: "planner", output: "child output", success: true }] },
|
|
186
|
+
});
|
|
187
|
+
const reply = buildInspectReply({ requestId: "r6", asyncId: "run-parent", childId: "step-a" }, makeDeps(root, resultsDir));
|
|
188
|
+
assert.equal(reply.error, undefined);
|
|
189
|
+
assert.equal(reply.childId, "step-a");
|
|
190
|
+
assert.equal(reply.label, "plan");
|
|
191
|
+
assert.equal(reply.task, "child task");
|
|
192
|
+
assert.equal(reply.finalOutput, "child output");
|
|
193
|
+
});
|
|
194
|
+
it("returns not_found for an unknown childId", () => {
|
|
195
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-nochild-"));
|
|
196
|
+
const { resultsDir } = makeRun(root, { runId: "run-p2" });
|
|
197
|
+
const reply = buildInspectReply({ requestId: "r7", asyncId: "run-p2", childId: "step:9" }, makeDeps(root, resultsDir));
|
|
198
|
+
assert.equal(reply.error?.code, "not_found");
|
|
199
|
+
});
|
|
200
|
+
it("omits task for fork-context children", () => {
|
|
201
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-fork-"));
|
|
202
|
+
const { resultsDir } = makeRun(root, {
|
|
203
|
+
runId: "run-fork",
|
|
204
|
+
context: "fork",
|
|
205
|
+
sessionMessages: [userMessage("inherited parent text"), assistantMessage("answer")],
|
|
206
|
+
});
|
|
207
|
+
const reply = buildInspectReply({ requestId: "r8", asyncId: "run-fork" }, makeDeps(root, resultsDir));
|
|
208
|
+
assert.equal(reply.error, undefined);
|
|
209
|
+
assert.equal(reply.task, undefined);
|
|
210
|
+
assert.equal(reply.messages?.length, 2);
|
|
211
|
+
});
|
|
212
|
+
it("reports running state with messages so far and no final output", () => {
|
|
213
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-running-"));
|
|
214
|
+
const { resultsDir } = makeRun(root, {
|
|
215
|
+
runId: "run-live",
|
|
216
|
+
state: "running",
|
|
217
|
+
sessionMessages: [userMessage("do work"), assistantMessage("working on it")],
|
|
218
|
+
});
|
|
219
|
+
const reply = buildInspectReply({ requestId: "r9", asyncId: "run-live" }, makeDeps(root, resultsDir));
|
|
220
|
+
assert.equal(reply.error, undefined);
|
|
221
|
+
assert.equal(reply.status, "running");
|
|
222
|
+
assert.equal(reply.messages?.length, 2);
|
|
223
|
+
assert.equal(reply.finalOutput, undefined);
|
|
224
|
+
});
|
|
225
|
+
it("returns completed output from durable replay after the result payload is consumed", () => {
|
|
226
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-"));
|
|
227
|
+
const { resultsDir } = makeRun(root, { runId: "run-replay" });
|
|
228
|
+
recordWaitCompletion(makeState(root), "run-replay", {
|
|
229
|
+
runId: "run-replay",
|
|
230
|
+
sessionId: SESSION_ID,
|
|
231
|
+
results: [{ agent: "worker", output: "finished output" }],
|
|
232
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
233
|
+
const reply = buildInspectReply({ requestId: "r-replay", asyncId: "run-replay" }, makeDeps(root, resultsDir));
|
|
234
|
+
assert.equal(reply.error, undefined);
|
|
235
|
+
assert.equal(reply.finalOutput, "finished output");
|
|
236
|
+
assert.equal(JSON.stringify(reply).includes(root), false);
|
|
237
|
+
});
|
|
238
|
+
it("returns legacy single-child replay output at run level when resultIndex is absent", () => {
|
|
239
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-legacy-single-"));
|
|
240
|
+
const { resultsDir } = makeRun(root, { runId: "run-replay-legacy-single" });
|
|
241
|
+
recordWaitCompletion(makeState(root), "run-replay-legacy-single", {
|
|
242
|
+
runId: "run-replay-legacy-single",
|
|
243
|
+
sessionId: SESSION_ID,
|
|
244
|
+
results: [{ agent: "worker", output: "finished output" }],
|
|
245
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
246
|
+
const archivePath = completionArchivePath(resultsDir, "run-replay-legacy-single");
|
|
247
|
+
const archive = JSON.parse(fs.readFileSync(archivePath, "utf-8"));
|
|
248
|
+
for (const entry of archive.entries) delete entry.resultIndex;
|
|
249
|
+
fs.writeFileSync(archivePath, JSON.stringify(archive), "utf-8");
|
|
250
|
+
const reply = buildInspectReply({ requestId: "r-replay-legacy-single", asyncId: "run-replay-legacy-single" }, makeDeps(root, resultsDir));
|
|
251
|
+
assert.equal(reply.error, undefined);
|
|
252
|
+
assert.equal(reply.finalOutput, "finished output");
|
|
253
|
+
});
|
|
254
|
+
it("returns output from a durable replay artifact without exposing its path", () => {
|
|
255
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-artifact-"));
|
|
256
|
+
const outputPath = path.join(root, "output.txt");
|
|
257
|
+
fs.writeFileSync(outputPath, "artifact output", "utf-8");
|
|
258
|
+
const { resultsDir } = makeRun(root, { runId: "run-replay-artifact" });
|
|
259
|
+
recordWaitCompletion(makeState(root), "run-replay-artifact", {
|
|
260
|
+
runId: "run-replay-artifact",
|
|
261
|
+
sessionId: SESSION_ID,
|
|
262
|
+
results: [{ artifactPaths: { outputPath }, output: "ignored fallback" }],
|
|
263
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
264
|
+
const reply = buildInspectReply({ requestId: "r-replay-artifact", asyncId: "run-replay-artifact" }, makeDeps(root, resultsDir));
|
|
265
|
+
assert.equal(reply.error, undefined);
|
|
266
|
+
assert.equal(reply.finalOutput, "artifact output");
|
|
267
|
+
assert.equal(JSON.stringify(reply).includes(outputPath), false);
|
|
268
|
+
});
|
|
269
|
+
it("returns a failed replay artifact error without private metadata", () => {
|
|
270
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-failed-artifact-"));
|
|
271
|
+
const outputPath = path.join(root, "output.txt");
|
|
272
|
+
const transcriptPath = path.join(root, "transcript.jsonl");
|
|
273
|
+
const metadataPath = path.join(root, "metadata.json");
|
|
274
|
+
const childError = `${"x".repeat(12_000)} child failure tail ${"x".repeat(28_000)}`;
|
|
275
|
+
fs.writeFileSync(outputPath, formatOutputArtifactContent({ output: "", error: childError, transcriptPath, metadataPath }), "utf-8");
|
|
276
|
+
const { resultsDir } = makeRun(root, {
|
|
277
|
+
runId: "run-replay-failed-artifact",
|
|
278
|
+
mode: "workflow",
|
|
279
|
+
steps: [{ agent: "worker", status: "failed", workflowKey: "worker", startedAt: 100, endedAt: 150 }],
|
|
280
|
+
});
|
|
281
|
+
recordWaitCompletion(makeState(root), "run-replay-failed-artifact", {
|
|
282
|
+
runId: "run-replay-failed-artifact",
|
|
283
|
+
sessionId: SESSION_ID,
|
|
284
|
+
results: [{ artifactPaths: { outputPath } }],
|
|
285
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
286
|
+
const reply = buildInspectReply({ requestId: "r-replay-failed-artifact", asyncId: "run-replay-failed-artifact", childId: "worker" }, makeDeps(root, resultsDir));
|
|
287
|
+
const serialized = JSON.stringify(reply);
|
|
288
|
+
assert.equal(reply.error, undefined);
|
|
289
|
+
assert.ok(reply.finalOutput?.includes("child failure tail"));
|
|
290
|
+
for (const privateText of [root, outputPath, transcriptPath, metadataPath, "Transcript:", "Metadata:"]) assert.equal(serialized.includes(privateText), false);
|
|
291
|
+
});
|
|
292
|
+
it("returns the selected child output from a multi-step replay artifact archive", () => {
|
|
293
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-children-"));
|
|
294
|
+
const firstOutputPath = path.join(root, "first-output.txt");
|
|
295
|
+
const secondOutputPath = path.join(root, "second-output.txt");
|
|
296
|
+
fs.writeFileSync(firstOutputPath, "first output", "utf-8");
|
|
297
|
+
fs.writeFileSync(secondOutputPath, "second output", "utf-8");
|
|
298
|
+
const { resultsDir } = makeRun(root, {
|
|
299
|
+
runId: "run-replay-children",
|
|
300
|
+
mode: "workflow",
|
|
301
|
+
steps: [
|
|
302
|
+
{ agent: "first", status: "complete", workflowKey: "first", startedAt: 100, endedAt: 150 },
|
|
303
|
+
{ agent: "second", status: "complete", workflowKey: "second", startedAt: 100, endedAt: 150 },
|
|
304
|
+
],
|
|
305
|
+
});
|
|
306
|
+
recordWaitCompletion(makeState(root), "run-replay-children", {
|
|
307
|
+
runId: "run-replay-children",
|
|
308
|
+
sessionId: SESSION_ID,
|
|
309
|
+
results: [
|
|
310
|
+
{ artifactPaths: { outputPath: firstOutputPath } },
|
|
311
|
+
{ artifactPaths: { outputPath: secondOutputPath } },
|
|
312
|
+
],
|
|
313
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
314
|
+
const reply = buildInspectReply({ requestId: "r-replay-children", asyncId: "run-replay-children", childId: "second" }, makeDeps(root, resultsDir));
|
|
315
|
+
assert.equal(reply.error, undefined);
|
|
316
|
+
assert.equal(reply.finalOutput, "second output");
|
|
317
|
+
assert.equal(JSON.stringify(reply).includes(root), false);
|
|
318
|
+
});
|
|
319
|
+
it("uses the child result index when a replay mixes inline and artifact output", () => {
|
|
320
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-mixed-"));
|
|
321
|
+
const secondOutputPath = path.join(root, "second-output.txt");
|
|
322
|
+
fs.writeFileSync(secondOutputPath, "second artifact output", "utf-8");
|
|
323
|
+
const { resultsDir } = makeRun(root, {
|
|
324
|
+
runId: "run-replay-mixed",
|
|
325
|
+
mode: "workflow",
|
|
326
|
+
steps: [
|
|
327
|
+
{ agent: "first", status: "complete", workflowKey: "first", startedAt: 100, endedAt: 150 },
|
|
328
|
+
{ agent: "second", status: "complete", workflowKey: "second", startedAt: 100, endedAt: 150 },
|
|
329
|
+
],
|
|
330
|
+
});
|
|
331
|
+
recordWaitCompletion(makeState(root), "run-replay-mixed", {
|
|
332
|
+
runId: "run-replay-mixed",
|
|
333
|
+
sessionId: SESSION_ID,
|
|
334
|
+
results: [
|
|
335
|
+
{ agent: "first", output: "first inline output" },
|
|
336
|
+
{ agent: "second", artifactPaths: { outputPath: secondOutputPath } },
|
|
337
|
+
],
|
|
338
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
339
|
+
const first = buildInspectReply({ requestId: "r-replay-mixed-first", asyncId: "run-replay-mixed", childId: "first" }, makeDeps(root, resultsDir));
|
|
340
|
+
assert.equal(first.error, undefined);
|
|
341
|
+
assert.equal(first.finalOutput, "first inline output");
|
|
342
|
+
const second = buildInspectReply({ requestId: "r-replay-mixed", asyncId: "run-replay-mixed", childId: "second" }, makeDeps(root, resultsDir));
|
|
343
|
+
assert.equal(second.error, undefined);
|
|
344
|
+
assert.equal(second.finalOutput, "second artifact output");
|
|
345
|
+
const topLevel = buildInspectReply({ requestId: "r-replay-mixed-top", asyncId: "run-replay-mixed" }, makeDeps(root, resultsDir));
|
|
346
|
+
assert.equal(topLevel.error, undefined);
|
|
347
|
+
assert.equal(topLevel.finalOutput, undefined);
|
|
348
|
+
assert.equal(JSON.stringify(first).includes(root), false);
|
|
349
|
+
});
|
|
350
|
+
it("returns session-backed replay output from the child's archived session transcript", () => {
|
|
351
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-session-"));
|
|
352
|
+
const childSession = path.join(root, "child-session.jsonl");
|
|
353
|
+
fs.writeFileSync(childSession, [
|
|
354
|
+
JSON.stringify({ message: userMessage("child task") }),
|
|
355
|
+
JSON.stringify({ message: assistantMessage("session-backed answer") }),
|
|
356
|
+
].join("\n") + "\n", "utf-8");
|
|
357
|
+
const { resultsDir } = makeRun(root, {
|
|
358
|
+
runId: "run-replay-session",
|
|
359
|
+
mode: "workflow",
|
|
360
|
+
steps: [{ agent: "worker", status: "complete", workflowKey: "worker", startedAt: 100, endedAt: 150, sessionFile: childSession }],
|
|
361
|
+
});
|
|
362
|
+
recordWaitCompletion(makeState(root), "run-replay-session", {
|
|
363
|
+
runId: "run-replay-session",
|
|
364
|
+
sessionId: SESSION_ID,
|
|
365
|
+
results: [{ sessionFile: childSession }],
|
|
366
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
367
|
+
const reply = buildInspectReply({ requestId: "r-replay-session", asyncId: "run-replay-session", childId: "worker" }, makeDeps(root, resultsDir));
|
|
368
|
+
assert.equal(reply.error, undefined);
|
|
369
|
+
assert.equal(reply.finalOutput, "session-backed answer");
|
|
370
|
+
assert.equal(JSON.stringify(reply).includes(childSession), false);
|
|
371
|
+
});
|
|
372
|
+
it("omits finalOutput for run-level inspection of a multi-child replay instead of attributing a child output", () => {
|
|
373
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-toplevel-"));
|
|
374
|
+
const firstOutputPath = path.join(root, "first-output.txt");
|
|
375
|
+
const secondOutputPath = path.join(root, "second-output.txt");
|
|
376
|
+
fs.writeFileSync(firstOutputPath, "first output", "utf-8");
|
|
377
|
+
fs.writeFileSync(secondOutputPath, "second output", "utf-8");
|
|
378
|
+
const { resultsDir } = makeRun(root, {
|
|
379
|
+
runId: "run-replay-toplevel",
|
|
380
|
+
mode: "workflow",
|
|
381
|
+
steps: [
|
|
382
|
+
{ agent: "first", status: "complete", workflowKey: "first", startedAt: 100, endedAt: 150 },
|
|
383
|
+
{ agent: "second", status: "complete", workflowKey: "second", startedAt: 100, endedAt: 150 },
|
|
384
|
+
],
|
|
385
|
+
});
|
|
386
|
+
recordWaitCompletion(makeState(root), "run-replay-toplevel", {
|
|
387
|
+
runId: "run-replay-toplevel",
|
|
388
|
+
sessionId: SESSION_ID,
|
|
389
|
+
results: [
|
|
390
|
+
{ artifactPaths: { outputPath: firstOutputPath } },
|
|
391
|
+
{ artifactPaths: { outputPath: secondOutputPath } },
|
|
392
|
+
],
|
|
393
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
394
|
+
const reply = buildInspectReply({ requestId: "r-replay-toplevel", asyncId: "run-replay-toplevel" }, makeDeps(root, resultsDir));
|
|
395
|
+
assert.equal(reply.error, undefined);
|
|
396
|
+
assert.equal(reply.finalOutput, undefined);
|
|
397
|
+
});
|
|
398
|
+
it("routes legacy replay archives (no resultIndex) by agent and keeps child output out of run-level replies", () => {
|
|
399
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-legacy-"));
|
|
400
|
+
const firstOutputPath = path.join(root, "first-output.txt");
|
|
401
|
+
const secondOutputPath = path.join(root, "second-output.txt");
|
|
402
|
+
fs.writeFileSync(firstOutputPath, "first output", "utf-8");
|
|
403
|
+
fs.writeFileSync(secondOutputPath, "second output", "utf-8");
|
|
404
|
+
const { resultsDir } = makeRun(root, {
|
|
405
|
+
runId: "run-replay-legacy",
|
|
406
|
+
mode: "workflow",
|
|
407
|
+
steps: [
|
|
408
|
+
{ agent: "first", status: "complete", workflowKey: "first", startedAt: 100, endedAt: 150 },
|
|
409
|
+
{ agent: "second", status: "complete", workflowKey: "second", startedAt: 100, endedAt: 150 },
|
|
410
|
+
],
|
|
411
|
+
});
|
|
412
|
+
recordWaitCompletion(makeState(root), "run-replay-legacy", {
|
|
413
|
+
runId: "run-replay-legacy",
|
|
414
|
+
sessionId: SESSION_ID,
|
|
415
|
+
results: [
|
|
416
|
+
{ agent: "first", artifactPaths: { outputPath: firstOutputPath } },
|
|
417
|
+
{ agent: "second", artifactPaths: { outputPath: secondOutputPath } },
|
|
418
|
+
],
|
|
419
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
420
|
+
// Downgrade the archive to the pre-resultIndex legacy shape.
|
|
421
|
+
const archivePath = completionArchivePath(resultsDir, "run-replay-legacy");
|
|
422
|
+
const archive = JSON.parse(fs.readFileSync(archivePath, "utf-8"));
|
|
423
|
+
for (const entry of archive.entries) delete entry.resultIndex;
|
|
424
|
+
fs.writeFileSync(archivePath, JSON.stringify(archive), "utf-8");
|
|
425
|
+
|
|
426
|
+
const child = buildInspectReply({ requestId: "r-legacy-child", asyncId: "run-replay-legacy", childId: "second" }, makeDeps(root, resultsDir));
|
|
427
|
+
assert.equal(child.error, undefined);
|
|
428
|
+
assert.equal(child.finalOutput, "second output");
|
|
429
|
+
|
|
430
|
+
const topLevel = buildInspectReply({ requestId: "r-legacy-top", asyncId: "run-replay-legacy" }, makeDeps(root, resultsDir));
|
|
431
|
+
assert.equal(topLevel.error, undefined);
|
|
432
|
+
assert.equal(topLevel.finalOutput, undefined);
|
|
433
|
+
});
|
|
434
|
+
it("does not attribute a legacy same-agent sibling's output to a later child", () => {
|
|
435
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-legacy-dup-"));
|
|
436
|
+
const firstOutputPath = path.join(root, "first-output.txt");
|
|
437
|
+
const secondOutputPath = path.join(root, "second-output.txt");
|
|
438
|
+
fs.writeFileSync(firstOutputPath, "first output", "utf-8");
|
|
439
|
+
fs.writeFileSync(secondOutputPath, "second output", "utf-8");
|
|
440
|
+
const { resultsDir } = makeRun(root, {
|
|
441
|
+
runId: "run-replay-legacy-dup",
|
|
442
|
+
mode: "workflow",
|
|
443
|
+
steps: [
|
|
444
|
+
{ agent: "worker", status: "complete", workflowKey: "first", startedAt: 100, endedAt: 150 },
|
|
445
|
+
{ agent: "worker", status: "complete", workflowKey: "second", startedAt: 100, endedAt: 150 },
|
|
446
|
+
],
|
|
447
|
+
});
|
|
448
|
+
recordWaitCompletion(makeState(root), "run-replay-legacy-dup", {
|
|
449
|
+
runId: "run-replay-legacy-dup",
|
|
450
|
+
sessionId: SESSION_ID,
|
|
451
|
+
results: [
|
|
452
|
+
{ agent: "worker", artifactPaths: { outputPath: firstOutputPath } },
|
|
453
|
+
{ agent: "worker", artifactPaths: { outputPath: secondOutputPath } },
|
|
454
|
+
],
|
|
455
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
456
|
+
const archivePath = completionArchivePath(resultsDir, "run-replay-legacy-dup");
|
|
457
|
+
const archive = JSON.parse(fs.readFileSync(archivePath, "utf-8"));
|
|
458
|
+
for (const entry of archive.entries) delete entry.resultIndex;
|
|
459
|
+
fs.writeFileSync(archivePath, JSON.stringify(archive), "utf-8");
|
|
460
|
+
|
|
461
|
+
const second = buildInspectReply({ requestId: "r-legacy-dup", asyncId: "run-replay-legacy-dup", childId: "second" }, makeDeps(root, resultsDir));
|
|
462
|
+
assert.equal(second.error, undefined);
|
|
463
|
+
assert.equal(second.finalOutput, undefined);
|
|
464
|
+
});
|
|
465
|
+
it("joins all text parts of the terminal assistant message for session-backed output", () => {
|
|
466
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-multipart-"));
|
|
467
|
+
const childSession = path.join(root, "multipart-session.jsonl");
|
|
468
|
+
fs.writeFileSync(childSession, [
|
|
469
|
+
JSON.stringify({ message: userMessage("child task") }),
|
|
470
|
+
JSON.stringify({ message: { role: "assistant", content: [{ type: "text", text: "part one" }, { type: "text", text: "part two" }] } }),
|
|
471
|
+
].join("\n") + "\n", "utf-8");
|
|
472
|
+
const { resultsDir } = makeRun(root, {
|
|
473
|
+
runId: "run-replay-multipart",
|
|
474
|
+
mode: "workflow",
|
|
475
|
+
steps: [{ agent: "worker", status: "complete", workflowKey: "worker", startedAt: 100, endedAt: 150, sessionFile: childSession }],
|
|
476
|
+
});
|
|
477
|
+
recordWaitCompletion(makeState(root), "run-replay-multipart", {
|
|
478
|
+
runId: "run-replay-multipart",
|
|
479
|
+
sessionId: SESSION_ID,
|
|
480
|
+
results: [{ sessionFile: childSession }],
|
|
481
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
482
|
+
const reply = buildInspectReply({ requestId: "r-multipart", asyncId: "run-replay-multipart", childId: "worker" }, makeDeps(root, resultsDir));
|
|
483
|
+
assert.equal(reply.error, undefined);
|
|
484
|
+
assert.equal(reply.finalOutput, "part one\npart two");
|
|
485
|
+
});
|
|
486
|
+
it("reports an internal error when a current-version replay record fails validation", () => {
|
|
487
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-invalid-"));
|
|
488
|
+
const runId = "run-replay-invalid";
|
|
489
|
+
const { resultsDir } = makeRun(root, { runId });
|
|
490
|
+
recordWaitCompletion(makeState(root), runId, {
|
|
491
|
+
runId,
|
|
492
|
+
sessionId: SESSION_ID,
|
|
493
|
+
results: [{ output: "finished output" }],
|
|
494
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
495
|
+
// Corrupt the record's archivePath so validation rejects it while the
|
|
496
|
+
// record still parses and names this run and session.
|
|
497
|
+
const replayFile = completionReplayPath(resultsDir, runId);
|
|
498
|
+
const record = JSON.parse(fs.readFileSync(replayFile, "utf-8"));
|
|
499
|
+
record.archivePath = path.join(root, "elsewhere.json");
|
|
500
|
+
fs.writeFileSync(replayFile, JSON.stringify(record), "utf-8");
|
|
501
|
+
const reply = buildInspectReply({ requestId: "r-replay-invalid", asyncId: runId }, makeDeps(root, resultsDir));
|
|
502
|
+
assert.equal(reply.error?.code, "internal");
|
|
503
|
+
assert.equal(reply.finalOutput, undefined);
|
|
504
|
+
});
|
|
505
|
+
it("reports an internal error when a durable replay archive is malformed", () => {
|
|
506
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-replay-malformed-"));
|
|
507
|
+
const runId = "run-replay-malformed";
|
|
508
|
+
const { resultsDir } = makeRun(root, { runId });
|
|
509
|
+
recordWaitCompletion(makeState(root), runId, {
|
|
510
|
+
runId,
|
|
511
|
+
sessionId: SESSION_ID,
|
|
512
|
+
results: [{ output: "finished output" }],
|
|
513
|
+
}, Date.now(), 60_000, { resultsDir, sessionId: SESSION_ID });
|
|
514
|
+
fs.writeFileSync(completionArchivePath(resultsDir, runId), JSON.stringify({ version: 1, runId, createdAt: 1, entries: "not-an-array" }), "utf-8");
|
|
515
|
+
const reply = buildInspectReply({ requestId: "r-replay-malformed", asyncId: runId }, makeDeps(root, resultsDir));
|
|
516
|
+
assert.equal(reply.error?.code, "internal");
|
|
517
|
+
assert.equal(reply.finalOutput, undefined);
|
|
518
|
+
assert.equal(JSON.stringify(reply).includes(root), false);
|
|
519
|
+
});
|
|
520
|
+
it("reports an internal error when an indexed result payload is malformed", () => {
|
|
521
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-result-malformed-"));
|
|
522
|
+
const { resultsDir } = makeRun(root, { runId: "run-result-malformed", resultPayload: { summary: "valid" } });
|
|
523
|
+
fs.writeFileSync(path.join(resultsDir, "run-result-malformed.json"), "{ invalid", "utf-8");
|
|
524
|
+
const reply = buildInspectReply({ requestId: "r-result-malformed", asyncId: "run-result-malformed" }, makeDeps(root, resultsDir));
|
|
525
|
+
assert.equal(reply.error?.code, "internal");
|
|
526
|
+
assert.equal(reply.finalOutput, undefined);
|
|
527
|
+
assert.equal(JSON.stringify(reply).includes(root), false);
|
|
528
|
+
});
|
|
529
|
+
it("fails closed instead of returning a private status error", () => {
|
|
530
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-status-error-"));
|
|
531
|
+
const { resultsDir } = makeRun(root, { runId: "run-status-error", state: "failed", error: `Failed to write ${path.join(root, "result.json")}` });
|
|
532
|
+
const reply = buildInspectReply({ requestId: "r-status-error", asyncId: "run-status-error" }, makeDeps(root, resultsDir));
|
|
533
|
+
assert.equal(reply.error?.code, "internal");
|
|
534
|
+
assert.equal(reply.finalOutput, undefined);
|
|
535
|
+
assert.equal(JSON.stringify(reply).includes(root), false);
|
|
536
|
+
});
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
describe("inspect-rpc bounds", () => {
|
|
540
|
+
it("keeps the serialized reply under the global byte budget", () => {
|
|
541
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-budget-"));
|
|
542
|
+
const big = "x".repeat(1_000);
|
|
543
|
+
const { resultsDir } = makeRun(root, {
|
|
544
|
+
runId: "run-big",
|
|
545
|
+
sessionMessages: Array.from({ length: 300 }, (_, index) => assistantMessage(`${index}:${big}`)),
|
|
546
|
+
resultPayload: { summary: big.repeat(9), results: [] },
|
|
547
|
+
});
|
|
548
|
+
const reply = buildInspectReply({ requestId: "r10", asyncId: "run-big", lines: 200 }, makeDeps(root, resultsDir));
|
|
549
|
+
assert.equal(reply.error, undefined);
|
|
550
|
+
const bytes = Buffer.byteLength(JSON.stringify(reply), "utf-8");
|
|
551
|
+
assert.ok(bytes <= MAX_SERIALIZED_BYTES, `reply ${bytes} exceeds ${MAX_SERIALIZED_BYTES}`);
|
|
552
|
+
assert.ok((reply.truncated?.messages ?? 0) > 0);
|
|
553
|
+
});
|
|
554
|
+
it("caps per-field lengths", () => {
|
|
555
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-caps-"));
|
|
556
|
+
const { resultsDir } = makeRun(root, {
|
|
557
|
+
runId: "run-caps",
|
|
558
|
+
sessionMessages: [userMessage(`task ${"t".repeat(10_000)}`)],
|
|
559
|
+
resultPayload: { summary: `out ${"o".repeat(20_000)}`, results: [] },
|
|
560
|
+
});
|
|
561
|
+
const reply = buildInspectReply({ requestId: "r11", asyncId: "run-caps" }, makeDeps(root, resultsDir));
|
|
562
|
+
assert.ok(reply.task && reply.task.length <= 2_000 && reply.truncated?.task);
|
|
563
|
+
assert.ok(reply.finalOutput && reply.finalOutput.length <= 8_000 && reply.truncated?.finalOutput);
|
|
564
|
+
});
|
|
565
|
+
it("preserves newlines in long-form content", () => {
|
|
566
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-lines-"));
|
|
567
|
+
const { resultsDir } = makeRun(root, {
|
|
568
|
+
runId: "run-lines",
|
|
569
|
+
sessionMessages: [userMessage("line one\nline two")],
|
|
570
|
+
resultPayload: { summary: "first\nsecond", results: [] },
|
|
571
|
+
});
|
|
572
|
+
const reply = buildInspectReply({ requestId: "r12", asyncId: "run-lines" }, makeDeps(root, resultsDir));
|
|
573
|
+
assert.equal(reply.task, "line one\nline two");
|
|
574
|
+
assert.equal(reply.finalOutput, "first\nsecond");
|
|
575
|
+
// The wire line itself must stay single-line for prefix parsing.
|
|
576
|
+
assert.equal(encodeInspectReply(reply)[0]?.includes("\n"), false);
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
describe("inspect-rpc command surface", () => {
|
|
581
|
+
it("answers unparseable args with an invalid_request reply", () => {
|
|
582
|
+
const reply = handleInspectRpcArgs("not valid at all", { state: makeState(fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-args-"))) });
|
|
583
|
+
assert.equal(reply.error?.code, "invalid_request");
|
|
584
|
+
assert.equal(reply.requestId, "not");
|
|
585
|
+
});
|
|
586
|
+
it("encodes replies with the widget prefix", () => {
|
|
587
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-inspect-encode-"));
|
|
588
|
+
const { resultsDir } = makeRun(root, { runId: "run-e" });
|
|
589
|
+
const lines = encodeInspectReply(buildInspectReply({ requestId: "r13", asyncId: "run-e" }, makeDeps(root, resultsDir)));
|
|
590
|
+
assert.equal(lines.length, 1);
|
|
591
|
+
assert.ok(lines[0]!.startsWith(INSPECT_WIDGET_PREFIX));
|
|
592
|
+
const parsed = JSON.parse(lines[0]!.slice(INSPECT_WIDGET_PREFIX.length));
|
|
593
|
+
assert.equal(parsed.kind, INSPECT_REPLY_KIND);
|
|
594
|
+
assert.equal(parsed.requestId, "r13");
|
|
595
|
+
});
|
|
596
|
+
});
|
|
@@ -136,7 +136,7 @@ describe("mission launch lifecycle", () => {
|
|
|
136
136
|
config: test.missionConfig,
|
|
137
137
|
});
|
|
138
138
|
assert.ok(binding);
|
|
139
|
-
const missionDir = path.join(worktreeRoot, ".
|
|
139
|
+
const missionDir = path.join(worktreeRoot, ".selesai", "subagents", "missions");
|
|
140
140
|
assert.throws(() => prepareMissionLaunch({
|
|
141
141
|
params: { missionId: binding.missionId, task: "Prepare worktree work" },
|
|
142
142
|
projectRoot: worktreeRoot,
|
|
@@ -232,8 +232,16 @@ describe("mission launch lifecycle", () => {
|
|
|
232
232
|
state: "complete",
|
|
233
233
|
success: true,
|
|
234
234
|
});
|
|
235
|
+
const repeated = syncMissionFromAsyncCompletion({
|
|
236
|
+
runId: "async-missing-mission",
|
|
237
|
+
asyncDir,
|
|
238
|
+
mode: "single",
|
|
239
|
+
state: "complete",
|
|
240
|
+
success: true,
|
|
241
|
+
});
|
|
235
242
|
|
|
236
243
|
assert.equal(completed, undefined);
|
|
244
|
+
assert.equal(repeated, undefined);
|
|
237
245
|
const events = fs.readFileSync(path.join(asyncDir, "events.jsonl"), "utf-8").trim().split("\n").map((line) => JSON.parse(line) as Record<string, unknown>);
|
|
238
246
|
assert.deepEqual(events, [{
|
|
239
247
|
type: "subagent.mission.sync.skipped",
|
|
@@ -244,6 +252,7 @@ describe("mission launch lifecycle", () => {
|
|
|
244
252
|
missionPath: path.join(binding.location.missionDir, `${binding.missionId}.json`),
|
|
245
253
|
}]);
|
|
246
254
|
assert.equal(typeof events[0]?.ts, "number");
|
|
255
|
+
assert.equal(fs.readdirSync(asyncDir).filter((name) => name.startsWith(".mission-sync-skipped-")).length, 1);
|
|
247
256
|
} finally {
|
|
248
257
|
fs.rmSync(test.root, { recursive: true, force: true });
|
|
249
258
|
}
|
|
@@ -40,8 +40,8 @@ describe("mission store", () => {
|
|
|
40
40
|
assert.equal(path.relative(test.projectRoot, test.location.missionDir).startsWith(".."), true);
|
|
41
41
|
assert.equal(test.location.missionDir.startsWith(path.join(test.agentDir, "missions", "projects")), true);
|
|
42
42
|
assert.equal(
|
|
43
|
-
resolveMissionStoreLocation({ projectRoot: test.projectRoot, agentDir: test.agentDir, config: { directory: ".pi
|
|
44
|
-
path.join(test.projectRoot, ".pi
|
|
43
|
+
resolveMissionStoreLocation({ projectRoot: test.projectRoot, agentDir: test.agentDir, config: { directory: ".pi-subagents/missions" } }).missionDir,
|
|
44
|
+
path.join(test.projectRoot, ".pi-subagents", "missions"),
|
|
45
45
|
);
|
|
46
46
|
} finally {
|
|
47
47
|
fs.rmSync(test.root, { recursive: true, force: true });
|
|
@@ -344,15 +344,13 @@ describe("mission store", () => {
|
|
|
344
344
|
}
|
|
345
345
|
});
|
|
346
346
|
|
|
347
|
-
it("loads older records that do not have receipts
|
|
347
|
+
it("loads older records that do not have receipts", () => {
|
|
348
348
|
const test = fixture();
|
|
349
349
|
try {
|
|
350
350
|
const created = createMission(test.location, { title: "Older record", objective: "Stay readable" });
|
|
351
351
|
const recordPath = path.join(test.location.missionDir, `${created.id}.json`);
|
|
352
352
|
const raw = JSON.parse(fs.readFileSync(recordPath, "utf-8")) as Record<string, unknown>;
|
|
353
353
|
delete raw.receipts;
|
|
354
|
-
delete raw.objective;
|
|
355
|
-
raw.goal = "Stay readable";
|
|
356
354
|
fs.writeFileSync(recordPath, JSON.stringify(raw), "utf-8");
|
|
357
355
|
|
|
358
356
|
const mission = readMission(test.location, created.id);
|