@selesai/code 0.13.15 → 0.13.18
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 +37 -0
- package/README.md +2 -14
- package/dist/bun/cli.d.ts +3 -1
- package/dist/bun/cli.js +3 -9
- package/dist/bun/{register-bedrock.js → runtime-setup.js} +5 -0
- package/dist/bun/sandbox-env-setup.d.ts +1 -0
- package/dist/bun/sandbox-env-setup.js +3 -0
- package/dist/cli/auth-command.d.ts +23 -0
- package/dist/cli/auth-command.js +102 -0
- package/dist/cli/config-selector.js +2 -1
- package/dist/cli/setup.d.ts +1 -0
- package/dist/cli/setup.js +11 -0
- package/dist/cli.js +2 -14
- package/dist/config.d.ts +3 -2
- package/dist/config.js +9 -4
- package/dist/core/agent-session-runtime.js +15 -7
- package/dist/core/agent-session.d.ts +2 -6
- package/dist/core/agent-session.js +15 -4
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.js +2 -1
- package/dist/core/extensions/loader.js +3 -0
- package/dist/core/extensions/types.d.ts +16 -2
- package/dist/core/http-dispatcher.js +2 -0
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.js +4 -0
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/model-config.d.ts +15 -0
- package/dist/core/model-config.js +3 -0
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.js +5 -2
- package/dist/core/provider-composer.js +8 -2
- package/dist/core/session-export.d.ts +3 -0
- package/dist/core/session-export.js +31 -0
- package/dist/core/session-manager.d.ts +3 -2
- package/dist/core/session-manager.js +40 -13
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.js +4 -2
- package/dist/core/system-prompt.js +10 -10
- package/dist/core/tools/bash.js +3 -117
- package/dist/core/tools/edit.d.ts +1 -12
- package/dist/core/tools/edit.js +5 -163
- package/dist/core/tools/find.js +4 -55
- package/dist/core/tools/grep.js +4 -60
- package/dist/core/tools/ls.js +4 -49
- package/dist/core/tools/read.d.ts +4 -0
- package/dist/core/tools/read.js +10 -122
- package/dist/core/tools/renderers/bash.d.ts +11 -0
- package/dist/core/tools/renderers/bash.js +129 -0
- package/dist/core/tools/renderers/edit.d.ts +22 -0
- package/dist/core/tools/renderers/edit.js +166 -0
- package/dist/core/tools/renderers/find.d.ts +9 -0
- package/dist/core/tools/renderers/find.js +63 -0
- package/dist/core/tools/renderers/grep.d.ts +9 -0
- package/dist/core/tools/renderers/grep.js +68 -0
- package/dist/core/tools/renderers/index.d.ts +27 -0
- package/dist/core/tools/renderers/index.js +46 -0
- package/dist/core/tools/renderers/ls.d.ts +9 -0
- package/dist/core/tools/renderers/ls.js +57 -0
- package/dist/core/tools/renderers/read.d.ts +10 -0
- package/dist/core/tools/renderers/read.js +128 -0
- package/dist/core/tools/renderers/write.d.ts +9 -0
- package/dist/core/tools/renderers/write.js +152 -0
- package/dist/core/tools/write.js +5 -146
- package/dist/extensions/capability-gateway/index.ts +12 -1
- package/dist/extensions/capability-gateway/integration.test.ts +23 -0
- package/dist/extensions/pi-hermes-memory/CHANGELOG.md +18 -0
- package/dist/extensions/pi-hermes-memory/README.md +16 -12
- package/dist/extensions/pi-hermes-memory/docs/ROADMAP.md +1 -1
- package/dist/extensions/pi-hermes-memory/package-lock.json +587 -62
- package/dist/extensions/pi-hermes-memory/package.json +4 -4
- package/dist/extensions/pi-hermes-memory/src/config.ts +32 -0
- package/dist/extensions/pi-hermes-memory/src/constants.ts +12 -2
- package/dist/extensions/pi-hermes-memory/src/handlers/background-review.ts +109 -51
- package/dist/extensions/pi-hermes-memory/src/handlers/index-sessions.ts +9 -3
- package/dist/extensions/pi-hermes-memory/src/handlers/review-memory-ops.ts +257 -98
- package/dist/extensions/pi-hermes-memory/src/handlers/session-backfill.ts +9 -2
- package/dist/extensions/pi-hermes-memory/src/handlers/sync-markdown-memories.ts +5 -0
- package/dist/extensions/pi-hermes-memory/src/index.ts +22 -2
- package/dist/extensions/pi-hermes-memory/src/paths.ts +1 -1
- package/dist/extensions/pi-hermes-memory/src/store/db.ts +6 -0
- package/dist/extensions/pi-hermes-memory/src/store/fts-query.ts +58 -1
- package/dist/extensions/pi-hermes-memory/src/store/memory-store.ts +60 -8
- package/dist/extensions/pi-hermes-memory/src/store/session-indexer.ts +169 -7
- package/dist/extensions/pi-hermes-memory/src/store/session-search.ts +7 -21
- package/dist/extensions/pi-hermes-memory/src/store/sqlite-memory-store.ts +134 -15
- package/dist/extensions/pi-hermes-memory/src/tools/memory-search-tool.ts +4 -2
- package/dist/extensions/pi-hermes-memory/src/tools/memory-tool.ts +24 -9
- package/dist/extensions/pi-hermes-memory/src/types.ts +11 -0
- package/dist/extensions/pi-hermes-memory/tests/config.test.ts +42 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/background-review.test.ts +159 -3
- package/dist/extensions/pi-hermes-memory/tests/handlers/review-memory-ops.test.ts +452 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-backfill.test.ts +39 -0
- package/dist/extensions/pi-hermes-memory/tests/integration/corruption-recovery-integration.test.ts +91 -0
- package/dist/extensions/pi-hermes-memory/tests/store/db.test.ts +29 -0
- package/dist/extensions/pi-hermes-memory/tests/store/fts-query.test.ts +116 -0
- package/dist/extensions/pi-hermes-memory/tests/store/memory-store.test.ts +163 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-indexer.test.ts +233 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-search.test.ts +12 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-memory-store.test.ts +175 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-native.test.ts +2 -2
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-search-tool.test.ts +22 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-tool.test.ts +37 -1
- package/dist/extensions/pi-intercom/CHANGELOG.md +13 -0
- package/dist/extensions/pi-intercom/README.md +16 -2
- package/dist/extensions/pi-intercom/broker/spawn.test.ts +19 -2
- package/dist/extensions/pi-intercom/broker/spawn.ts +4 -4
- package/dist/extensions/pi-intercom/index.ts +1 -1
- package/dist/extensions/pi-intercom/intercom.integration.test.ts +121 -2
- package/dist/extensions/pi-intercom/package.json +1 -1
- package/dist/extensions/pi-intercom/project-agent.test.ts +1 -1
- package/dist/extensions/pi-intercom/project-agent.ts +1 -6
- package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +7 -6
- package/dist/extensions/pi-rewind-hook/index.test.ts +7 -0
- package/dist/extensions/pi-subagents/.github/workflows/test.yml +36 -4
- package/dist/extensions/pi-subagents/CHANGELOG.md +120 -0
- package/dist/extensions/pi-subagents/README.md +3 -3
- package/dist/extensions/pi-subagents/agents/researcher.md +23 -13
- package/dist/extensions/pi-subagents/agents/reviewer.md +1 -1
- package/dist/extensions/pi-subagents/agents/scout.md +1 -1
- package/dist/extensions/pi-subagents/docs/agents.md +32 -16
- package/dist/extensions/pi-subagents/docs/configuration.md +41 -15
- package/dist/extensions/pi-subagents/docs/extension-api.md +109 -6
- package/dist/extensions/pi-subagents/docs/missions.md +2 -0
- package/dist/extensions/pi-subagents/docs/models.md +58 -1
- package/dist/extensions/pi-subagents/docs/observability.md +50 -12
- package/dist/extensions/pi-subagents/docs/tool-reference.md +17 -10
- package/dist/extensions/pi-subagents/docs/watchdog.md +1 -1
- package/dist/extensions/pi-subagents/docs/workflows.md +26 -9
- package/dist/extensions/pi-subagents/package-lock.json +747 -177
- package/dist/extensions/pi-subagents/package.json +6 -4
- package/dist/extensions/pi-subagents/runner-server-preload.mjs +13 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +2 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +21 -4
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +2 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +2 -0
- package/dist/extensions/pi-subagents/src/agents/advertised-agent-prompt.ts +63 -0
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +61 -16
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +2 -0
- package/dist/extensions/pi-subagents/src/agents/agents.ts +8 -0
- package/dist/extensions/pi-subagents/src/api/capability-ceiling.ts +0 -1
- package/dist/extensions/pi-subagents/src/api/{pi-args.ts → child-tool-plan.ts} +1 -1
- package/dist/extensions/pi-subagents/src/api/preflight.ts +7 -4
- package/dist/extensions/pi-subagents/src/api/shared-types.ts +2 -2
- package/dist/extensions/pi-subagents/src/api/workflow-resources.ts +6 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +4 -2
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +2 -10
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +9 -11
- package/dist/extensions/pi-subagents/src/extension/index.ts +99 -10
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +13 -0
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +7 -23
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +11 -8
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +25 -7
- package/dist/extensions/pi-subagents/src/integrations/pi-web-session-liveness.ts +73 -0
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +228 -136
- package/dist/extensions/pi-subagents/src/intercom/supervisor-ui.ts +244 -0
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +37 -16
- package/dist/extensions/pi-subagents/src/runs/background/active-async-capacity.ts +18 -18
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +51 -25
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +46 -3
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +14 -3
- package/dist/extensions/pi-subagents/src/runs/background/async-retention.ts +9 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-status-snapshot.ts +10 -12
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +18 -15
- package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +40 -29
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +8 -0
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +79 -247
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +88 -12
- package/dist/extensions/pi-subagents/src/runs/background/owned-process-tree.ts +6 -6
- package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +24 -24
- package/dist/extensions/pi-subagents/src/runs/background/retained-nested-route-tracker.ts +96 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-child-session.ts +642 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +75 -6
- package/dist/extensions/pi-subagents/src/runs/background/runner-aliases.ts +163 -0
- package/dist/extensions/pi-subagents/src/runs/background/runner-child-launch.ts +86 -0
- package/dist/extensions/pi-subagents/src/runs/background/runner-child-sessions.ts +31 -0
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +18 -4
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +597 -1092
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +3 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +4 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +20 -17
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +296 -394
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-control.ts +4 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/foreground/prompt-audit.ts +9 -5
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +630 -283
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +8 -5
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +78 -98
- package/dist/extensions/pi-subagents/src/runs/shared/abort-recovery.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +16 -3
- package/dist/extensions/pi-subagents/src/runs/shared/agent-contract.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/async-status-projection.ts +47 -47
- package/dist/extensions/pi-subagents/src/runs/shared/capability-ceiling.ts +1 -2
- package/dist/extensions/pi-subagents/src/runs/shared/child-hooks.ts +174 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-identity.ts +14 -3
- package/dist/extensions/pi-subagents/src/runs/shared/child-launch.ts +319 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-lifecycle.ts +25 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-runtime-config.ts +126 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-session.ts +373 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-tool-plan.ts +530 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-evidence.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +2 -1
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-preflight.ts +16 -0
- package/dist/extensions/pi-subagents/src/runs/shared/host-step-status.ts +11 -11
- package/dist/extensions/pi-subagents/src/runs/shared/llm-intent-arbiter.ts +30 -20
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +5 -4
- package/dist/extensions/pi-subagents/src/runs/shared/model-exclusions.ts +84 -15
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +88 -12
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +37 -53
- package/dist/extensions/pi-subagents/src/runs/shared/nested-path.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/orca-progress-tabs.ts +18 -7
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +57 -12
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +3 -4
- package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +0 -11
- package/dist/extensions/pi-subagents/src/runs/shared/process-signal.ts +4 -1
- package/dist/extensions/pi-subagents/src/runs/shared/readonly-drain-observation.ts +42 -0
- package/dist/extensions/pi-subagents/src/runs/shared/readonly-model-continuation.ts +69 -0
- package/dist/extensions/pi-subagents/src/runs/shared/readonly-session-evidence.ts +307 -0
- package/dist/extensions/pi-subagents/src/runs/shared/run-fanout-budget.ts +8 -21
- package/dist/extensions/pi-subagents/src/runs/shared/runtime-acknowledged-extensions.ts +3 -30
- package/dist/extensions/pi-subagents/src/runs/shared/structured-output.ts +17 -4
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-control.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +99 -386
- package/dist/extensions/pi-subagents/src/runs/shared/tool-availability.ts +18 -62
- package/dist/extensions/pi-subagents/src/runs/shared/tool-budget.ts +0 -14
- package/dist/extensions/pi-subagents/src/runs/shared/worktree-cleanup-plan.ts +31 -9
- package/dist/extensions/pi-subagents/src/runs/shared/worktree-setup-command.ts +190 -0
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +506 -226
- package/dist/extensions/pi-subagents/src/shared/child-session-name.ts +1 -1
- package/dist/extensions/pi-subagents/src/shared/jsonl-writer.ts +11 -0
- package/dist/extensions/pi-subagents/src/shared/model-response-aliases.ts +13 -0
- package/dist/extensions/pi-subagents/src/shared/thinking-ceiling.ts +0 -6
- package/dist/extensions/pi-subagents/src/shared/types.ts +145 -89
- package/dist/extensions/pi-subagents/src/shared/utils.ts +13 -6
- package/dist/extensions/pi-subagents/src/shared/watch-strategy.ts +2 -0
- package/dist/extensions/pi-subagents/src/shared/workflow-child-permit.ts +18 -13
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +0 -6
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +1 -1
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +11 -6
- package/dist/extensions/pi-subagents/src/tui/render.ts +277 -46
- package/dist/extensions/pi-subagents/src/watchdog/child-status.ts +0 -1
- package/dist/extensions/pi-subagents/src/watchdog/register-child.ts +12 -12
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +3 -3
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +116 -15
- package/dist/extensions/pi-subagents/src/workflows/workflow-checklist.ts +15 -18
- package/dist/extensions/pi-subagents/src/workflows/workflow-child-summary.ts +57 -8
- package/dist/extensions/pi-subagents/src/workflows/workflow-preflight.ts +19 -19
- package/dist/extensions/pi-subagents/src/workflows/workflow-receipt.ts +3 -3
- package/dist/extensions/pi-subagents/src/workflows/workflow-resources.ts +97 -22
- package/dist/extensions/pi-subagents/src/workflows/workflow-settlement.ts +3 -0
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +336 -21
- package/dist/extensions/pi-subagents/test/integration/async-execution.part-1.test.ts +1181 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.part-2.test.ts +2240 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.part-3.test.ts +2268 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.part-4.test.ts +1512 -0
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +231 -16
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +4 -18
- package/dist/extensions/pi-subagents/test/integration/foreign-workflow-steering.test.ts +95 -0
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +9 -15
- package/dist/extensions/pi-subagents/test/integration/in-process-child.test.ts +374 -0
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +20 -10
- package/dist/extensions/pi-subagents/test/integration/orca-progress-tabs.test.ts +18 -6
- package/dist/extensions/pi-subagents/test/integration/recovered-assistant-error.test.ts +151 -0
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +42 -1
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +150 -25
- package/dist/extensions/pi-subagents/test/integration/result-publication.test.ts +354 -0
- package/dist/extensions/pi-subagents/test/integration/shared-cwd-terminal-evidence.test.ts +117 -0
- package/dist/extensions/pi-subagents/test/integration/single-execution.part-1.test.ts +3678 -0
- package/dist/extensions/pi-subagents/test/integration/{single-execution.test.ts → single-execution.part-2.test.ts} +500 -4207
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +1 -2
- package/dist/extensions/pi-subagents/test/integration/workflow-result-publication.test.ts +127 -0
- package/dist/extensions/pi-subagents/test/integration/workflow-steer-inbox.test.ts +365 -0
- package/dist/extensions/pi-subagents/test/smoke/pi085-child.ts +31 -0
- package/dist/extensions/pi-subagents/test/smoke/pi085-clean-install.mjs +74 -0
- package/dist/extensions/pi-subagents/test/smoke/pi085-extension.ts +16 -0
- package/dist/extensions/pi-subagents/test/support/async-execution-fixture.ts +699 -0
- package/dist/extensions/pi-subagents/test/support/fake-child-session.ts +418 -0
- package/dist/extensions/pi-subagents/test/support/foreign-workflow-steer-host.mjs +13 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +30 -76
- package/dist/extensions/pi-subagents/test/support/notify-diagnostics-fixture.ts +84 -0
- package/dist/extensions/pi-subagents/test/support/result-publication-capacity-preload.mjs +70 -0
- package/dist/extensions/pi-subagents/test/support/runner-child-session-factory.ts +17 -0
- package/dist/extensions/pi-subagents/test/support/single-execution-fixture.ts +390 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance-compaction.test.ts +120 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +24 -3
- package/dist/extensions/pi-subagents/test/unit/advertised-agent-prompt.test.ts +87 -0
- package/dist/extensions/pi-subagents/test/unit/advertised-agent-refresh.test.ts +163 -0
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +70 -31
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +78 -3
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +2 -8
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +73 -66
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +51 -1
- package/dist/extensions/pi-subagents/test/unit/async-retention.test.ts +49 -1
- package/dist/extensions/pi-subagents/test/unit/async-spawn-preload.test.ts +103 -0
- package/dist/extensions/pi-subagents/test/unit/async-status-projection.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +9 -8
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling.test.ts +10 -7
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +48 -6
- package/dist/extensions/pi-subagents/test/unit/child-runtime-config.test.ts +90 -0
- package/dist/extensions/pi-subagents/test/unit/{pi-args-permission-system.test.ts → child-tool-plan-permission-system.test.ts} +48 -86
- package/dist/extensions/pi-subagents/test/unit/child-tool-plan.test.ts +33 -0
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +18 -18
- package/dist/extensions/pi-subagents/test/unit/completion-evidence.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +8 -7
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +225 -65
- package/dist/extensions/pi-subagents/test/unit/extension-bindings.test.ts +17 -22
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +11 -1
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +47 -3
- package/dist/extensions/pi-subagents/test/unit/foreign-workflow-steering.test.ts +74 -0
- package/dist/extensions/pi-subagents/test/unit/fork-cache-key.test.ts +23 -29
- package/dist/extensions/pi-subagents/test/unit/host-peer-runtime-imports.test.ts +96 -4
- package/dist/extensions/pi-subagents/test/unit/host-step-status.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +116 -55
- package/dist/extensions/pi-subagents/test/unit/index-segment.test.ts +58 -1
- package/dist/extensions/pi-subagents/test/unit/llm-intent-arbiter.test.ts +104 -3
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +10 -1
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +31 -1
- package/dist/extensions/pi-subagents/test/unit/model-exclusions.test.ts +102 -51
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +196 -6
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +181 -38
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +62 -70
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +58 -53
- package/dist/extensions/pi-subagents/test/unit/notify-diagnostics.test.ts +42 -0
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +84 -0
- package/dist/extensions/pi-subagents/test/unit/orca-progress-tabs.test.ts +13 -5
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +21 -5
- package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +5 -4
- package/dist/extensions/pi-subagents/test/unit/permissions.test.ts +2 -6
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +28 -2
- package/dist/extensions/pi-subagents/test/unit/pi-web-session-liveness.test.ts +209 -0
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +38 -1
- package/dist/extensions/pi-subagents/test/unit/prompt-audit-optional-peers.test.ts +43 -0
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +24 -2
- package/dist/extensions/pi-subagents/test/unit/readonly-drain-observation.test.ts +174 -0
- package/dist/extensions/pi-subagents/test/unit/readonly-model-continuation.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/unit/readonly-session-evidence.test.ts +1329 -0
- package/dist/extensions/pi-subagents/test/unit/recursion-guard.test.ts +29 -80
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +11 -8
- package/dist/extensions/pi-subagents/test/unit/result-files.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/retained-nested-route-tracker.test.ts +175 -0
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +38 -12
- package/dist/extensions/pi-subagents/test/unit/run-fanout-budget.test.ts +2 -5
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +89 -1
- package/dist/extensions/pi-subagents/test/unit/runtime-acknowledged-extensions.test.ts +2 -16
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +27 -3
- package/dist/extensions/pi-subagents/test/unit/scheduled-supervisor-demand.test.ts +215 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +15 -11
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +237 -1
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -5
- package/dist/extensions/pi-subagents/test/unit/streamed-progress-bounds.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-guide.test.ts +14 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +130 -739
- package/dist/extensions/pi-subagents/test/unit/supervisor-ask-registration.test.ts +682 -0
- package/dist/extensions/pi-subagents/test/unit/supervisor-ui.test.ts +137 -0
- package/dist/extensions/pi-subagents/test/unit/tool-budget.test.ts +1 -11
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +23 -3
- package/dist/extensions/pi-subagents/test/unit/wait-completions.test.ts +8 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-tool-actions.test.ts +19 -1
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +72 -4
- package/dist/extensions/pi-subagents/test/unit/workflow-checklist.test.ts +17 -3
- package/dist/extensions/pi-subagents/test/unit/workflow-child-summary.test.ts +34 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-detach-reconcile.test.ts +12 -2
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +46 -6
- package/dist/extensions/pi-subagents/test/unit/workflow-receipt.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/workflow-resources.test.ts +133 -1
- package/dist/extensions/pi-subagents/test/unit/workflow-resume-hint.test.ts +53 -2
- package/dist/extensions/pi-subagents/test/unit/worktree-cleanup-plan.test.ts +222 -14
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +526 -85
- package/dist/extensions/pi-web-agent/src/backends/config.ts +1 -0
- package/dist/extensions/pi-web-agent/src/backends/settings-reader.ts +5 -3
- package/dist/extensions/pi-web-agent/src/search/tokenin.ts +7 -3
- package/dist/extensions/pi-web-agent/src/types.ts +1 -1
- package/dist/extensions/pi-zentui/README.md +17 -0
- package/dist/extensions/pi-zentui/assets/screenshots/footer-status-hyperlink.png +0 -0
- package/dist/extensions/pi-zentui/docs/configuration.md +71 -2
- package/dist/extensions/pi-zentui/extensions/zentui/config.ts +11 -0
- package/dist/extensions/pi-zentui/extensions/zentui/editor-transfer.ts +14 -0
- package/dist/extensions/pi-zentui/extensions/zentui/extension-status.ts +29 -13
- package/dist/extensions/pi-zentui/extensions/zentui/footer-layout.ts +5 -4
- package/dist/extensions/pi-zentui/extensions/zentui/footer-text.ts +11 -0
- package/dist/extensions/pi-zentui/extensions/zentui/footer.ts +11 -10
- package/dist/extensions/pi-zentui/extensions/zentui/index.ts +77 -3
- package/dist/extensions/pi-zentui/extensions/zentui/presets.ts +77 -0
- package/dist/extensions/pi-zentui/extensions/zentui/settings-command.ts +103 -2
- package/dist/extensions/pi-zentui/extensions/zentui/working-line-extension-segments.ts +115 -0
- package/dist/extensions/pi-zentui/extensions/zentui/working-line.ts +87 -5
- package/dist/extensions/pi-zentui/package-lock.json +277 -517
- package/dist/extensions/pi-zentui/package.json +7 -4
- package/dist/extensions/pi-zentui/test/config-presets.test.ts +238 -0
- package/dist/extensions/pi-zentui/test/editor-transfer.test.ts +24 -1
- package/dist/extensions/pi-zentui/test/extension-compliance.test.ts +570 -2
- package/dist/extensions/pi-zentui/test/extension-status.test.ts +90 -0
- package/dist/extensions/pi-zentui/test/footer-hyperlink.test.ts +243 -0
- package/dist/extensions/pi-zentui/test/package-contents.mjs +1 -0
- package/dist/extensions/pi-zentui/test/presets.test.ts +121 -0
- package/dist/extensions/pi-zentui/test/settings-command.test.ts +205 -1
- package/dist/extensions/pi-zentui/test/working-line-extension-segments.test.ts +139 -0
- package/dist/extensions/pi-zentui/test/working-line-lifecycle.integration.test.ts +237 -3
- package/dist/extensions/pi-zentui/test/working-line.test.ts +94 -2
- package/dist/index.d.ts +1 -1
- package/dist/main.js +4 -1
- package/dist/modes/interactive/chat-viewport.d.ts +19 -0
- package/dist/modes/interactive/chat-viewport.js +27 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +6 -2
- package/dist/modes/interactive/components/assistant-message.js +30 -13
- package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
- package/dist/modes/interactive/components/custom-editor.js +39 -1
- package/dist/modes/interactive/components/first-time-setup.js +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +2 -0
- package/dist/modes/interactive/components/markdown-transform.js +18 -0
- package/dist/modes/interactive/components/model-selector.js +19 -17
- package/dist/modes/interactive/components/scoped-models-selector.js +21 -23
- package/dist/modes/interactive/components/settings-selector.d.ts +7 -1
- package/dist/modes/interactive/components/settings-selector.js +128 -20
- package/dist/modes/interactive/components/settings-submenu.d.ts +71 -0
- package/dist/modes/interactive/components/settings-submenu.js +164 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
- package/dist/modes/interactive/components/status-indicator.js +10 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.js +75 -18
- package/dist/modes/interactive/components/tool-execution.d.ts +21 -4
- package/dist/modes/interactive/components/tool-execution.js +35 -33
- package/dist/modes/interactive/components/trust-selector.js +2 -2
- package/dist/modes/interactive/interactive-mode.d.ts +13 -15
- package/dist/modes/interactive/interactive-mode.js +144 -80
- package/dist/modes/interactive/session-share.d.ts +15 -0
- package/dist/modes/interactive/session-share.js +183 -0
- package/dist/modes/interactive/theme/dark.json +2 -1
- package/dist/modes/interactive/theme/light.json +2 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +5 -0
- package/dist/modes/interactive/theme/theme-json.d.ts +83 -0
- package/dist/modes/interactive/theme/theme-json.js +129 -0
- package/dist/modes/interactive/theme/theme-schema.json +9 -1
- package/dist/modes/interactive/theme/theme.d.ts +14 -5
- package/dist/modes/interactive/theme/theme.js +18 -119
- package/dist/modes/interactive/tui-renderer.d.ts +20 -0
- package/dist/modes/interactive/tui-renderer.js +65 -0
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/management-http.d.ts +24 -0
- package/dist/utils/management-http.js +53 -0
- package/dist/utils/text.d.ts +7 -0
- package/dist/utils/text.js +8 -0
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.js +43 -21
- package/docs/docs.json +0 -4
- package/package.json +4 -4
- package/dist/extensions/pi-subagents/src/runs/shared/child-protocol.ts +0 -415
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +0 -1059
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-startup-retry.ts +0 -116
- package/dist/extensions/pi-subagents/src/shared/post-exit-stdio-guard.ts +0 -85
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +0 -224
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +0 -6986
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +0 -447
- package/dist/extensions/pi-subagents/test/support/real-session-child-cli.mjs +0 -185
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +0 -311
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-pi-args.test.ts +0 -84
- package/dist/extensions/pi-subagents/test/unit/child-protocol.test.ts +0 -202
- package/dist/extensions/pi-subagents/test/unit/close-grace-timer.test.ts +0 -101
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +0 -2347
- package/dist/extensions/pi-subagents/test/unit/subagent-startup-retry.test.ts +0 -104
- package/dist/extensions/pi-subagents/test/unit/windows-hide-spawn.test.ts +0 -49
- package/dist/skills/imagegen-frontend-mobile/SKILL.md +0 -1465
- package/dist/skills/imagegen-frontend-web/SKILL.md +0 -987
- package/dist/skills/implanger/SKILL.md +0 -70
- package/dist/skills/output/SKILL.md +0 -49
- package/dist/skills/planger/SKILL.md +0 -167
- package/dist/skills/workflow/SKILL.md +0 -95
- package/docs/workflows.md +0 -18
- /package/dist/bun/{register-bedrock.d.ts → runtime-setup.d.ts} +0 -0
|
@@ -9,6 +9,7 @@ import { inspectSubagentStatus } from "../../src/runs/background/run-status.ts";
|
|
|
9
9
|
import { createNestedRoute, writeNestedEvent } from "../../src/runs/shared/nested-events.ts";
|
|
10
10
|
import { claimRunFanoutBatch, createRunFanoutBudget, writeRunFanoutBudgetDescriptor } from "../../src/runs/shared/run-fanout-budget.ts";
|
|
11
11
|
import { TEMP_ROOT_DIR, type SubagentState } from "../../src/shared/types.ts";
|
|
12
|
+
import { getArtifactPaths, getArtifactsDir } from "../../src/shared/artifacts.ts";
|
|
12
13
|
|
|
13
14
|
function errno(code: string): NodeJS.ErrnoException {
|
|
14
15
|
const error = new Error(code) as NodeJS.ErrnoException;
|
|
@@ -22,6 +23,93 @@ function textContent(result: ReturnType<typeof inspectSubagentStatus>): string {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
describe("async run status inspection", () => {
|
|
26
|
+
it("inspects live foreground artifacts on demand with child selection, ownership and bounded tails", () => {
|
|
27
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-live-foreground-transcript-"));
|
|
28
|
+
try {
|
|
29
|
+
const artifactRoot = getArtifactsDir(null, root, "project");
|
|
30
|
+
fs.mkdirSync(artifactRoot, { recursive: true });
|
|
31
|
+
const control = {
|
|
32
|
+
runId: "live-foreground", sessionId: "current", mode: "parallel" as const, cwd: root, startedAt: 1, updatedAt: 1,
|
|
33
|
+
activeChildren: new Map([2, 5].map((index) => [index, { index, agent: "worker", startedAt: 1, updatedAt: 1 }])),
|
|
34
|
+
};
|
|
35
|
+
const state = {
|
|
36
|
+
baseCwd: root, currentSessionId: "current", artifactDirPreference: "project", asyncJobs: new Map(),
|
|
37
|
+
foregroundControls: new Map([[control.runId, control]]), lastForegroundControlId: control.runId,
|
|
38
|
+
} as unknown as SubagentState;
|
|
39
|
+
const deps = { state, asyncDirRoot: path.join(root, "runs"), resultsDir: path.join(root, "results") };
|
|
40
|
+
const file = getArtifactPaths(artifactRoot, control.runId, "worker", 5).transcriptPath;
|
|
41
|
+
const record = (text: string) => `${JSON.stringify({ recordType: "message", role: "assistant", text })}\n`;
|
|
42
|
+
fs.writeFileSync(file, record("first\nsecond\nthird"));
|
|
43
|
+
const inspect = (params = {}) => inspectSubagentStatus({ view: "transcript", ...params }, deps);
|
|
44
|
+
assert.match(textContent(inspect()), /requires index.*Active child indexes: 2, 5/);
|
|
45
|
+
const selected = inspect({ id: "live-fore", index: 5, lines: 2 });
|
|
46
|
+
assert.equal(selected.isError, undefined);
|
|
47
|
+
assert.match(textContent(selected), /Child: 5 \(worker\)/);
|
|
48
|
+
assert.match(textContent(selected), /tail truncated/);
|
|
49
|
+
assert.match(textContent(selected), /second\nthird$/);
|
|
50
|
+
assert.doesNotMatch(textContent(selected), /first/);
|
|
51
|
+
fs.appendFileSync(file, record("fresh activity"));
|
|
52
|
+
assert.match(textContent(inspect({ index: 5 })), /fresh activity/);
|
|
53
|
+
fs.appendFileSync(file, [
|
|
54
|
+
{ recordType: "tool_start", toolName: "bash", toolCallId: "tool-1", argsPreview: "pwd" },
|
|
55
|
+
{ recordType: "message", role: "toolResult", toolCallId: "tool-1", text: "tool output" },
|
|
56
|
+
{ recordType: "message", role: "user", text: "supervisor guidance" },
|
|
57
|
+
].map((event) => JSON.stringify(event) + "\n").join(""));
|
|
58
|
+
assert.match(textContent(inspect({ index: 5 })), /Tool: bash \(complete\)\npwd\ntool output\nSupervisor: supervisor guidance/);
|
|
59
|
+
assert.match(textContent(inspect({ index: 2 })), /Transcript unavailable/);
|
|
60
|
+
assert.doesNotMatch(textContent(inspect({ index: 2 })), /fresh activity/);
|
|
61
|
+
for (const index of [-1, 1.5, 99]) assert.equal(inspect({ index }).isError, true);
|
|
62
|
+
control.sessionId = "other";
|
|
63
|
+
assert.match(textContent(inspect({ id: control.runId, index: 5 })), /not owned by the current session/);
|
|
64
|
+
assert.doesNotMatch(textContent(inspect({ id: control.runId, index: 5 })), /fresh activity/);
|
|
65
|
+
state.currentSessionId = null;
|
|
66
|
+
assert.equal(inspect({ id: control.runId, index: 5 }).isError, true);
|
|
67
|
+
state.currentSessionId = control.sessionId = "current";
|
|
68
|
+
fs.writeFileSync(file, record("界".repeat(30_000)));
|
|
69
|
+
const bytes = textContent(inspect({ index: 5, lines: 500 }));
|
|
70
|
+
assert.match(bytes, /tail truncated/);
|
|
71
|
+
assert.ok(Buffer.byteLength(bytes.split("(tail truncated):\n")[1]!) <= 32 * 1024);
|
|
72
|
+
assert.doesNotMatch(bytes, /\uFFFD/);
|
|
73
|
+
fs.writeFileSync(file, Array.from({ length: 600 }, (_, index) => record(`record-${index}`)).join(""));
|
|
74
|
+
const records = textContent(inspect({ index: 5, lines: 100_000 }));
|
|
75
|
+
assert.match(records, /tail truncated/);
|
|
76
|
+
assert.equal(records.split("(tail truncated):\n")[1]!.split("\n").length, 240);
|
|
77
|
+
assert.doesNotMatch(records, /record-0\b/);
|
|
78
|
+
assert.match(records, /record-599/);
|
|
79
|
+
fs.writeFileSync(file, record("界\n".repeat(600)));
|
|
80
|
+
const lines = textContent(inspect({ index: 5, lines: 100_000 }));
|
|
81
|
+
assert.equal(lines.split("(tail truncated):\n")[1]!.split("\n").length, 500);
|
|
82
|
+
fs.writeFileSync(file, record("x".repeat(2 * 1024 * 1024)) + record("latest\u001b\u202e") + '{"partial":');
|
|
83
|
+
const tail = textContent(inspect({ index: 5 }));
|
|
84
|
+
assert.match(tail, /tail truncated/);
|
|
85
|
+
assert.match(tail, /latest/);
|
|
86
|
+
assert.doesNotMatch(tail, /[\u001b\u202e]/u);
|
|
87
|
+
fs.unlinkSync(file);
|
|
88
|
+
const outside = path.join(root, "outside.jsonl");
|
|
89
|
+
fs.writeFileSync(outside, record("OUTSIDE_SECRET"));
|
|
90
|
+
fs.symlinkSync(outside, file);
|
|
91
|
+
const refused = textContent(inspect({ index: 5 }));
|
|
92
|
+
assert.match(refused, /refused a symlink/);
|
|
93
|
+
assert.match(refused, /Transcript unavailable/);
|
|
94
|
+
assert.doesNotMatch(refused, /OUTSIDE_SECRET/);
|
|
95
|
+
control.activeChildren.clear();
|
|
96
|
+
assert.match(textContent(inspect()), /no active foreground child/);
|
|
97
|
+
} finally { fs.rmSync(root, { recursive: true, force: true }); }
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("projects only published receipt references from result-only status", () => {
|
|
101
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-receipt-status-"));
|
|
102
|
+
try {
|
|
103
|
+
const resultPath = path.join(root, "receipt-run.json");
|
|
104
|
+
for (const workflowReceipt of [{ path: "/opaque/published.json", receipt: {} }, undefined, { path: 42 }, []]) {
|
|
105
|
+
fs.writeFileSync(resultPath, JSON.stringify({ runId: "receipt-run", mode: "workflow", success: true, workflowReceipt }));
|
|
106
|
+
const result = inspectSubagentStatus({ id: "receipt-run" }, { asyncDirRoot: path.join(root, "absent"), resultsDir: root });
|
|
107
|
+
const expected = workflowReceipt && "path" in workflowReceipt && typeof workflowReceipt.path === "string" ? workflowReceipt.path : undefined;
|
|
108
|
+
assert.equal(result.details?.workflowReceiptPath, expected);
|
|
109
|
+
assert.equal(textContent(result).includes("Workflow receipt:"), expected !== undefined);
|
|
110
|
+
}
|
|
111
|
+
} finally { fs.rmSync(root, { recursive: true, force: true }); }
|
|
112
|
+
});
|
|
25
113
|
afterEach(() => {
|
|
26
114
|
delete (globalThis as Record<PropertyKey, unknown>)[Symbol.for(EXTERNAL_JOB_PROVIDER_REGISTRY_KEY)];
|
|
27
115
|
});
|
|
@@ -1542,4 +1630,4 @@ describe("async run status inspection", () => {
|
|
|
1542
1630
|
fs.rmSync(root, { recursive: true, force: true });
|
|
1543
1631
|
}
|
|
1544
1632
|
});
|
|
1545
|
-
});
|
|
1633
|
+
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import * as fs from "node:fs";
|
|
3
|
-
import * as os from "node:os";
|
|
4
2
|
import * as path from "node:path";
|
|
5
3
|
import { describe, it } from "node:test";
|
|
6
|
-
import {
|
|
4
|
+
import { isRuntimeAcknowledgedExtensionId, projectRuntimeAcknowledgedExtensions, sanitizeRuntimeAcknowledgedExtensions } from "../../src/runs/shared/runtime-acknowledged-extensions.ts";
|
|
7
5
|
|
|
8
6
|
describe("runtime acknowledged extension projection", () => {
|
|
9
7
|
it("validates opaque ids without path-like content", () => {
|
|
@@ -37,16 +35,4 @@ describe("runtime acknowledged extension projection", () => {
|
|
|
37
35
|
assert.equal(sanitizeRuntimeAcknowledgedExtensions({ version: 1, source: "launch-resolved", ids: ["ok"] }), undefined);
|
|
38
36
|
assert.equal(sanitizeRuntimeAcknowledgedExtensions({ version: 1, source: "child-runtime", ids: ["bad/path"] }), undefined);
|
|
39
37
|
});
|
|
40
|
-
|
|
41
|
-
it("rejects oversized capture files without reading them", (t) => {
|
|
42
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "runtime-ack-"));
|
|
43
|
-
t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
|
|
44
|
-
const filePath = path.join(dir, "ack.json");
|
|
45
|
-
|
|
46
|
-
fs.writeFileSync(filePath, "x".repeat(MAX_RUNTIME_ACKNOWLEDGED_EXTENSION_FILE_BYTES + 1));
|
|
47
|
-
assert.equal(readRuntimeAcknowledgedExtensions(filePath), undefined);
|
|
48
|
-
|
|
49
|
-
fs.writeFileSync(filePath, JSON.stringify({ version: 1, source: "child-runtime", ids: ["ok"], omitted: 0 }));
|
|
50
|
-
assert.deepEqual(readRuntimeAcknowledgedExtensions(filePath), { version: 1, source: "child-runtime", ids: ["ok"], omitted: 0 });
|
|
51
|
-
});
|
|
52
|
-
});
|
|
38
|
+
});
|
|
@@ -341,6 +341,10 @@ describe("project schedule management", () => {
|
|
|
341
341
|
{ action: "schedule.create", id: "calendar", every: "day", at: "09:00", timezone: "UTC", workflowScript: "return runs.run('main', { agent: 'worker' })" },
|
|
342
342
|
{ action: "schedule.create", id: "two-targets", every: "1h", agent: "worker", workflowScript: "return 1" },
|
|
343
343
|
{ action: "schedule.create", id: "fork", every: "1h", workflowScript: "return runs.run('main', { agent: 'worker' })", context: "fork" },
|
|
344
|
+
{ action: "schedule.create", id: "invalid-base-ref", every: "1h", workflowScript: "return runs.run('main', { agent: 'worker' })", baseRef: "unsafe..ref" },
|
|
345
|
+
{ action: "schedule.create", id: "revision-alias-base-ref", every: "1h", workflowScript: "return runs.run('main', { agent: 'worker' })", baseRef: "@" },
|
|
346
|
+
{ action: "schedule.create", id: "object-id-base-ref", every: "1h", workflowScript: "return runs.run('main', { agent: 'worker' })", baseRef: "a".repeat(40) },
|
|
347
|
+
{ action: "schedule.create", id: "sha256-object-id-base-ref", every: "1h", workflowScript: "return runs.run('main', { agent: 'worker' })", baseRef: "a".repeat(64) },
|
|
344
348
|
{ action: "schedule.create", id: "mission-id", every: "1h", workflowScript: "return runs.run('main', { agent: 'worker' })", missionId: "mission-1" },
|
|
345
349
|
{ action: "schedule.create", id: "mission-off", every: "1h", workflowScript: "return runs.run('main', { agent: 'worker' })", mission: false },
|
|
346
350
|
] as const) {
|
|
@@ -349,6 +353,26 @@ describe("project schedule management", () => {
|
|
|
349
353
|
}
|
|
350
354
|
});
|
|
351
355
|
|
|
356
|
+
it("persists and forwards a scheduled workflow baseRef", async () => {
|
|
357
|
+
const h = harness();
|
|
358
|
+
const created = await h.manager.handleToolCall({
|
|
359
|
+
action: "schedule.create",
|
|
360
|
+
id: "base-ref",
|
|
361
|
+
every: "1h",
|
|
362
|
+
baseRef: "@/foo",
|
|
363
|
+
workflowScript: "return runs.run('main', { agent: 'worker' })",
|
|
364
|
+
}, h.ctx);
|
|
365
|
+
assert.equal(created.isError, undefined);
|
|
366
|
+
assert.equal(listScheduledRunSummaries(h.ctx.cwd, path.join(h.root, "stores"))[0]?.target.baseRef, "@/foo");
|
|
367
|
+
|
|
368
|
+
const running = h.manager.handleToolCall({ action: "schedule.run", id: "base-ref" }, h.ctx);
|
|
369
|
+
await flush();
|
|
370
|
+
assert.equal(h.launches[0]?.params.baseRef, "@/foo");
|
|
371
|
+
h.launches[0]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "workflow", results: [], asyncId: "base-ref-async" } });
|
|
372
|
+
const result = await running;
|
|
373
|
+
assert.equal(result.isError, undefined);
|
|
374
|
+
});
|
|
375
|
+
|
|
352
376
|
it("pauses, resumes, lists, and deletes an inactive schedule", async () => {
|
|
353
377
|
const h = harness();
|
|
354
378
|
await h.manager.handleToolCall({ action: "schedule.create", id: "maintenance", every: "1h", workflowScript: "return runs.run('main', { agent: 'worker' })" }, h.ctx);
|
|
@@ -471,7 +495,7 @@ describe("project schedule management", () => {
|
|
|
471
495
|
assert.equal(fs.existsSync(path.join(outside, "schedules")), false);
|
|
472
496
|
});
|
|
473
497
|
|
|
474
|
-
it("allows a default project schedule root through a shared Git worktree .
|
|
498
|
+
it("allows a default project schedule root through a shared Git worktree .pi symlink", async () => {
|
|
475
499
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-schedule-worktree-link-"));
|
|
476
500
|
roots.push(root);
|
|
477
501
|
const repository = path.join(root, "repository");
|
|
@@ -499,7 +523,7 @@ describe("project schedule management", () => {
|
|
|
499
523
|
assert.equal(fs.existsSync(path.join(worktree, ".pi-subagents", "schedules", "shared", "schedule.json")), true);
|
|
500
524
|
});
|
|
501
525
|
|
|
502
|
-
it("rejects a Git worktree .
|
|
526
|
+
it("rejects a Git worktree .pi symlink outside the shared config root", () => {
|
|
503
527
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-schedule-worktree-escape-"));
|
|
504
528
|
roots.push(root);
|
|
505
529
|
const repository = path.join(root, "repository");
|
|
@@ -901,4 +925,4 @@ describe("recurring schedule execution", () => {
|
|
|
901
925
|
assert.match(text(history), /failed_run.*async async-fail/);
|
|
902
926
|
assert.match(text(history), /failed_launch/);
|
|
903
927
|
});
|
|
904
|
-
});
|
|
928
|
+
});
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import * as os from "node:os";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
|
+
import { syncBuiltinESMExports } from "node:module";
|
|
7
|
+
import { it } from "node:test";
|
|
8
|
+
import { createScheduledRunManager } from "../../src/runs/background/scheduled-runs.ts";
|
|
9
|
+
import { createSubagentExecutor } from "../../src/runs/foreground/subagent-executor.ts";
|
|
10
|
+
import { createNativeSupervisorChannel, ensureSupervisorChannelDir, resolveSupervisorChannelDir } from "../../src/intercom/native-supervisor-channel.ts";
|
|
11
|
+
import type { SubagentState } from "../../src/shared/types.ts";
|
|
12
|
+
|
|
13
|
+
function fixture() {
|
|
14
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "scheduled-supervisor-"));
|
|
15
|
+
const initialOwner = randomUUID();
|
|
16
|
+
const context = (owner = initialOwner, file: string | null = path.join(root, "parent.jsonl")) => ({
|
|
17
|
+
cwd: root, hasUI: false,
|
|
18
|
+
sessionManager: { getSessionId: () => owner, getSessionFile: () => file, getEntries: () => [] },
|
|
19
|
+
});
|
|
20
|
+
const state: SubagentState = {
|
|
21
|
+
baseCwd: root, currentSessionId: context().sessionManager.getSessionFile(), supervisorOwnerSessionId: initialOwner,
|
|
22
|
+
asyncJobs: new Map(), foregroundControls: new Map(), lastForegroundControlId: null, cleanupTimers: new Map(), lastUiContext: null,
|
|
23
|
+
poller: null, completionSeen: new Map(), watcher: null, watcherRestartTimer: null,
|
|
24
|
+
resultFileCoalescer: { schedule: () => false, clear() {} },
|
|
25
|
+
};
|
|
26
|
+
const intervals = new Map<object, () => void>();
|
|
27
|
+
const sent: string[] = [], cleanupDirs: string[] = [];
|
|
28
|
+
let starts = 0, activations = 0, terminal = () => {};
|
|
29
|
+
let done = Promise.resolve();
|
|
30
|
+
const pi = {
|
|
31
|
+
getAllTools: () => [], registerTool() {}, getSessionName: () => "parent",
|
|
32
|
+
events: { emit() {}, on() { return () => {}; } },
|
|
33
|
+
sendMessage(message: { details?: { id?: string } }) { if (message.details?.id) sent.push(message.details.id); },
|
|
34
|
+
};
|
|
35
|
+
const channel = createNativeSupervisorChannel(pi as never, state, {
|
|
36
|
+
getCurrentOwnerStates: () => executor.getCurrentSupervisorOwnerStates(),
|
|
37
|
+
platform: "darwin", watch: (() => { throw new Error("Darwin must not watch"); }) as never,
|
|
38
|
+
timers: {
|
|
39
|
+
setInterval: ((handler: () => void, delay: number) => {
|
|
40
|
+
assert.equal(delay, 250); starts++;
|
|
41
|
+
const token = { unref() {} }; intervals.set(token, handler); return token;
|
|
42
|
+
}) as typeof setInterval,
|
|
43
|
+
clearInterval: ((token: object) => { intervals.delete(token); }) as typeof clearInterval,
|
|
44
|
+
setImmediate, clearImmediate,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const config = { maxSubagentDepth: 2, control: {}, intercomBridge: {} } as never;
|
|
48
|
+
const executor = createSubagentExecutor({
|
|
49
|
+
pi: pi as never, state, config, asyncByDefault: false, tempArtifactsDir: root,
|
|
50
|
+
getSubagentSessionRoot: () => root, expandTilde: value => value, discoverAgents: () => ({ agents: [] }),
|
|
51
|
+
activateSupervisorTransport() { activations++; channel.activateTransport(); },
|
|
52
|
+
refreshResultDelivery() { terminal(); },
|
|
53
|
+
});
|
|
54
|
+
const manager = createScheduledRunManager({ config, storeRoot: path.join(root, "schedules"),
|
|
55
|
+
launch: (params, ctx, signal) => executor.executeScheduled(randomUUID(), params, signal, ctx),
|
|
56
|
+
});
|
|
57
|
+
channel.start();
|
|
58
|
+
return {
|
|
59
|
+
initialOwner, context, state, channel, executor, intervals, sent,
|
|
60
|
+
starts: () => starts, activations: () => activations,
|
|
61
|
+
tick() { for (const handler of [...intervals.values()]) handler(); },
|
|
62
|
+
async launch(ctx = context()) {
|
|
63
|
+
const id = randomUUID();
|
|
64
|
+
const created = await manager.handleToolCall({ action: "schedule.create", id, at: "+1h", workflowScript: "return [];" }, ctx as never);
|
|
65
|
+
assert.equal(created.isError, undefined, JSON.stringify(created));
|
|
66
|
+
done = new Promise<void>(resolve => { terminal = resolve; });
|
|
67
|
+
const launched = await manager.handleToolCall({ action: "schedule.run", id }, ctx as never);
|
|
68
|
+
if (launched.isError) { terminal(); return { launched }; }
|
|
69
|
+
const run = launched.details!.schedules!.runs![0]!;
|
|
70
|
+
assert.equal(run.state, "running");
|
|
71
|
+
cleanupDirs.push(run.asyncDir!);
|
|
72
|
+
assert.equal(manager.observedCompletionRunIds().has(run.asyncId!), true);
|
|
73
|
+
assert.equal(JSON.parse(fs.readFileSync(path.join(run.asyncDir!, "status.json"), "utf8")).state, "running");
|
|
74
|
+
return { launched, run };
|
|
75
|
+
},
|
|
76
|
+
ask(runId: string, owner = initialOwner) {
|
|
77
|
+
const dir = resolveSupervisorChannelDir(runId, "worker", 0);
|
|
78
|
+
cleanupDirs.push(dir); ensureSupervisorChannelDir(dir);
|
|
79
|
+
const id = randomUUID(), file = path.join(dir, "requests", `${id}.json`);
|
|
80
|
+
fs.writeFileSync(file, JSON.stringify({ type: "subagent.supervisor.request", id, createdAt: Date.now(), reason: "need_decision", message: "Delayed decision", expectsReply: true, orchestratorSessionId: owner, runId, agent: "worker", childIndex: 0 }));
|
|
81
|
+
return { id, file, dir };
|
|
82
|
+
},
|
|
83
|
+
async finish() { await done; },
|
|
84
|
+
async dispose() {
|
|
85
|
+
manager.stop(); channel.dispose(); await done;
|
|
86
|
+
for (const dir of [...cleanupDirs, root]) fs.rmSync(dir, { recursive: true, force: true });
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
it("actual scheduled workflows discover delayed Darwin asks, clear terminal asks and rearm without idle demand", async () => {
|
|
92
|
+
const f = fixture();
|
|
93
|
+
try {
|
|
94
|
+
assert.equal(f.intervals.size, 0);
|
|
95
|
+
for (let cycle = 0; cycle < 2; cycle++) {
|
|
96
|
+
const { run } = await f.launch();
|
|
97
|
+
assert.ok(run);
|
|
98
|
+
assert.equal(f.state.asyncJobs.size, 0, "scheduled registration stays isolated");
|
|
99
|
+
assert.equal(f.state.foregroundControls.size, 0);
|
|
100
|
+
const ask = f.ask(run.asyncId!);
|
|
101
|
+
const foreign = f.ask(run.asyncId!, randomUUID());
|
|
102
|
+
const target = { runId: run.asyncId!, agent: "worker", childIndex: 0 };
|
|
103
|
+
// First cycle proves discovery without any lookup; second also checks passive receipts.
|
|
104
|
+
if (cycle === 1) {
|
|
105
|
+
assert.deepEqual(f.channel.findPendingAsks(target), [ask.id]);
|
|
106
|
+
assert.equal(f.channel.pending.size, 0, "live lookup does not register or notify");
|
|
107
|
+
assert.equal(f.sent.includes(ask.id), false);
|
|
108
|
+
}
|
|
109
|
+
f.tick();
|
|
110
|
+
assert.ok(f.sent.includes(ask.id), "actual scheduled workflow must discover delayed same-owner ask without an explicit scan");
|
|
111
|
+
assert.equal(f.channel.pending.has(foreign.id), false);
|
|
112
|
+
assert.equal(f.sent.includes(foreign.id), false);
|
|
113
|
+
assert.deepEqual(fs.readdirSync(path.join(ask.dir, "replies")), []);
|
|
114
|
+
assert.equal(f.intervals.size, 1);
|
|
115
|
+
assert.equal(f.starts(), cycle + 1);
|
|
116
|
+
await f.finish();
|
|
117
|
+
assert.deepEqual(f.channel.findPendingAsks(target), [], "terminal scheduled asks are not live receipts");
|
|
118
|
+
assert.equal(fs.existsSync(ask.file), true, "terminal lookup does not clean request files");
|
|
119
|
+
f.tick();
|
|
120
|
+
assert.equal(f.channel.pending.size, 0, "existing lifecycle predicate sees retained terminal job");
|
|
121
|
+
assert.equal(fs.existsSync(ask.file), false);
|
|
122
|
+
assert.equal(fs.existsSync(foreign.file), true, "foreign requests are not cleaned or answered");
|
|
123
|
+
assert.equal(f.intervals.size, 0);
|
|
124
|
+
}
|
|
125
|
+
assert.equal(f.activations(), 2);
|
|
126
|
+
} finally { await f.dispose(); }
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("scheduled owner visibility preserves runtime UUID, same-file isolation and fileless transitions without aborting jobs", async () => {
|
|
130
|
+
const f = fixture();
|
|
131
|
+
try {
|
|
132
|
+
const { run: first } = await f.launch(f.context(f.initialOwner, null));
|
|
133
|
+
assert.ok(first);
|
|
134
|
+
const fileless = [...f.executor.getCurrentSupervisorOwnerStates()][0]!;
|
|
135
|
+
assert.equal(fileless.currentSessionId, f.initialOwner);
|
|
136
|
+
const controller = fileless.workflowControllers!.get(first.asyncId!)!;
|
|
137
|
+
const otherOwner = randomUUID();
|
|
138
|
+
for (const inactive of [null, otherOwner]) {
|
|
139
|
+
f.state.supervisorOwnerSessionId = inactive;
|
|
140
|
+
assert.deepEqual([...f.executor.getCurrentSupervisorOwnerStates()], []);
|
|
141
|
+
f.tick();
|
|
142
|
+
assert.equal(f.intervals.size, 0, "inactive owner work cannot keep active channel polling");
|
|
143
|
+
assert.equal(controller.signal.aborted, false);
|
|
144
|
+
}
|
|
145
|
+
const hiddenAsk = f.ask(first.asyncId!);
|
|
146
|
+
f.channel.activateTransport();
|
|
147
|
+
assert.equal(f.channel.pending.size, 0);
|
|
148
|
+
assert.equal(f.intervals.size, 0);
|
|
149
|
+
f.state.supervisorOwnerSessionId = f.initialOwner;
|
|
150
|
+
f.channel.activateTransport();
|
|
151
|
+
assert.equal(f.channel.pending.has(hiddenAsk.id), true);
|
|
152
|
+
assert.equal(controller.signal.aborted, false);
|
|
153
|
+
await f.finish(); f.tick();
|
|
154
|
+
assert.equal(f.intervals.size, 0);
|
|
155
|
+
|
|
156
|
+
const { run: saved } = await f.launch();
|
|
157
|
+
assert.ok(saved);
|
|
158
|
+
const ownStates = [...f.executor.getCurrentSupervisorOwnerStates()];
|
|
159
|
+
assert.equal(ownStates.length, 2, "saving a file retains distinct entries under the same runtime UUID");
|
|
160
|
+
const savedState = ownStates.find(state => state !== fileless)!;
|
|
161
|
+
assert.equal(savedState.currentSessionId, f.context().sessionManager.getSessionFile());
|
|
162
|
+
assert.ok(savedState.asyncJobs.has(saved.asyncId!));
|
|
163
|
+
await f.finish(); f.tick();
|
|
164
|
+
|
|
165
|
+
// The main owner remains unchanged during the other runtime's real scheduled launch.
|
|
166
|
+
const { run: other } = await f.launch(f.context(otherOwner));
|
|
167
|
+
assert.ok(other);
|
|
168
|
+
assert.equal(f.intervals.size, 0, "foreign scheduled registration does not supply current-owner demand");
|
|
169
|
+
assert.deepEqual([...f.executor.getCurrentSupervisorOwnerStates()], ownStates);
|
|
170
|
+
const otherAsk = f.ask(other.asyncId!, otherOwner);
|
|
171
|
+
f.channel.activateTransport();
|
|
172
|
+
assert.equal(f.channel.pending.has(otherAsk.id), false);
|
|
173
|
+
f.state.supervisorOwnerSessionId = otherOwner;
|
|
174
|
+
const otherStates = [...f.executor.getCurrentSupervisorOwnerStates()];
|
|
175
|
+
assert.equal(otherStates.length, 1);
|
|
176
|
+
assert.notEqual(otherStates[0], savedState, "same file with new UUID never reuses or retags executor state");
|
|
177
|
+
assert.ok(otherStates[0]!.asyncJobs.has(other.asyncId!));
|
|
178
|
+
assert.equal(savedState.asyncJobs.has(other.asyncId!), false);
|
|
179
|
+
f.channel.activateTransport();
|
|
180
|
+
assert.equal(f.channel.pending.has(otherAsk.id), true);
|
|
181
|
+
await f.finish(); f.tick();
|
|
182
|
+
assert.equal(f.channel.pending.size, 0);
|
|
183
|
+
assert.equal(f.intervals.size, 0);
|
|
184
|
+
} finally { await f.dispose(); }
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it("failed scheduled workflow persistence rolls back retained demand before activation", async (t) => {
|
|
188
|
+
const f = fixture();
|
|
189
|
+
const rename = fs.renameSync;
|
|
190
|
+
const failedDirs: string[] = [];
|
|
191
|
+
try {
|
|
192
|
+
t.mock.method(fs, "renameSync", (source: fs.PathLike, destination: fs.PathLike) => {
|
|
193
|
+
if (String(destination).endsWith(`${path.sep}status.json`)) {
|
|
194
|
+
failedDirs.push(path.dirname(String(destination)));
|
|
195
|
+
throw Object.assign(new Error("scheduled status persistence failure"), { code: "EACCES" });
|
|
196
|
+
}
|
|
197
|
+
return rename(source, destination);
|
|
198
|
+
});
|
|
199
|
+
syncBuiltinESMExports();
|
|
200
|
+
const { launched } = await f.launch();
|
|
201
|
+
assert.equal(launched.isError, true);
|
|
202
|
+
assert.match(JSON.stringify(launched), /Failed to create async workflow storage/);
|
|
203
|
+
assert.equal(f.activations(), 0);
|
|
204
|
+
const retained = [...f.executor.getCurrentSupervisorOwnerStates()];
|
|
205
|
+
assert.equal(retained.length, 1);
|
|
206
|
+
assert.equal(retained[0]!.asyncJobs.size, 0);
|
|
207
|
+
assert.equal(retained[0]!.workflowControllers!.size, 0);
|
|
208
|
+
f.channel.activateTransport();
|
|
209
|
+
assert.equal(f.intervals.size, 0);
|
|
210
|
+
} finally {
|
|
211
|
+
t.mock.restoreAll(); syncBuiltinESMExports();
|
|
212
|
+
await f.dispose();
|
|
213
|
+
for (const dir of failedDirs) fs.rmSync(dir, { recursive: true, force: true });
|
|
214
|
+
}
|
|
215
|
+
});
|
|
@@ -216,15 +216,9 @@ describe("SubagentParams schema", { skip: !schemasAvailable ? "typebox not avail
|
|
|
216
216
|
const workflowScript = SubagentParams?.properties?.workflowScript;
|
|
217
217
|
assert.equal(workflowScript?.type, "string");
|
|
218
218
|
assert.equal(workflowScript?.minLength, 1);
|
|
219
|
-
assert.match(String(workflowScript?.description ?? ""), /
|
|
220
|
-
assert.match(String(workflowScript?.description ?? ""), /
|
|
221
|
-
assert.match(String(workflowScript?.description ?? ""), /
|
|
222
|
-
assert.match(String(workflowScript?.description ?? ""), /Each workflow key identifies one result lane.*new stable workflow key.*retained resume pass/i);
|
|
223
|
-
assert.match(String(workflowScript?.description ?? ""), /await runs\.all\(\[\{key, agent, task\}, \.\.\.\]\)/);
|
|
224
|
-
assert.match(String(workflowScript?.description ?? ""), /do not read \.output from unawaited runs\.run launches/i);
|
|
225
|
-
assert.match(String(workflowScript?.description ?? ""), /advanced rolling fanout/);
|
|
226
|
-
assert.match(String(workflowScript?.description ?? ""), /sequential and parallel phases dynamically/i);
|
|
227
|
-
assert.match(String(workflowScript?.description ?? ""), /worktree:true/i);
|
|
219
|
+
assert.match(String(workflowScript?.description ?? ""), /Inline JavaScript statement body/);
|
|
220
|
+
assert.match(String(workflowScript?.description ?? ""), /top-level await/);
|
|
221
|
+
assert.match(String(workflowScript?.description ?? ""), /Globals: runs, emit, console/);
|
|
228
222
|
assert.match(String(workflowScript?.description ?? ""), /no filesystem, shell, Pi tools, or host globals/i);
|
|
229
223
|
const workflowScriptPath = SubagentParams?.properties?.workflowScriptPath;
|
|
230
224
|
assert.equal(workflowScriptPath?.type, "string");
|
|
@@ -541,6 +535,10 @@ describe("SubagentParams schema", { skip: !schemasAvailable ? "typebox not avail
|
|
|
541
535
|
if (!current.value || typeof current.value !== "object") continue;
|
|
542
536
|
|
|
543
537
|
const node = current.value as JsonSchemaNode;
|
|
538
|
+
// oxlint-disable-next-line anti-slop/no-runtime-typeof -- Inspecting JSON Schema enum representation is the portability contract under test.
|
|
539
|
+
if (Array.isArray(node.enum) && node.enum.some((value) => typeof value !== "string")) {
|
|
540
|
+
rejectedPaths.push(`${current.path}.enum`);
|
|
541
|
+
}
|
|
544
542
|
if (Array.isArray(node.type)) {
|
|
545
543
|
rejectedPaths.push(`${current.path}.type`);
|
|
546
544
|
}
|
|
@@ -612,6 +610,13 @@ describe("SubagentParams schema", { skip: !schemasAvailable ? "typebox not avail
|
|
|
612
610
|
assert.ok(SubagentParams, "SubagentParams schema should exist");
|
|
613
611
|
assert.ok(CompileSchema, "TypeBox compiler should exist");
|
|
614
612
|
const validator = CompileSchema(SubagentParams);
|
|
613
|
+
// Transport accepts both booleans; semantic boundaries still reject unsupported true.
|
|
614
|
+
for (const field of ["acceptance", "mission", "thinking"]) {
|
|
615
|
+
assert.deepEqual(anyOfBranches(SubagentParams.properties[field]).find((branch) => branch.type === "boolean"), { type: "boolean" });
|
|
616
|
+
assert.equal(validator.Check({ [field]: false }), true);
|
|
617
|
+
assert.equal(validator.Check({ [field]: true }), true);
|
|
618
|
+
assert.equal(validator.Check({ [field]: 123 }), false);
|
|
619
|
+
}
|
|
615
620
|
const validValues = [
|
|
616
621
|
{ skill: "review" },
|
|
617
622
|
{ workflowScript: "return await runs.run(\"one\", {agent: \"reviewer\", task: \"check\"})" },
|
|
@@ -632,7 +637,6 @@ describe("SubagentParams schema", { skip: !schemasAvailable ? "typebox not avail
|
|
|
632
637
|
{ output: 123 },
|
|
633
638
|
{ timeoutMs: 0 },
|
|
634
639
|
{ maxRuntimeMs: -1 },
|
|
635
|
-
{ agent: "worker", task: "Fix", acceptance: true },
|
|
636
640
|
{ config: [] },
|
|
637
641
|
{ config: null },
|
|
638
642
|
{ agent: "worker", task: "Fix", toolBudget: { hard: 0 } },
|
|
@@ -654,4 +658,4 @@ describe("SubagentParams schema", { skip: !schemasAvailable ? "typebox not avail
|
|
|
654
658
|
assert.equal(validator.Check(value), false, `${JSON.stringify(value)} should not validate`);
|
|
655
659
|
}
|
|
656
660
|
});
|
|
657
|
-
});
|
|
661
|
+
});
|