@selesai/code 0.6.3 → 0.8.0
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 +22 -1
- package/README.md +5 -3
- package/dist/bun/cli.d.ts +0 -1
- package/dist/bun/cli.js +0 -1
- package/dist/bun/register-bedrock.d.ts +0 -1
- package/dist/bun/register-bedrock.js +0 -1
- package/dist/bun/restore-sandbox-env.d.ts +0 -1
- package/dist/bun/restore-sandbox-env.js +0 -1
- package/dist/cli/args.d.ts +0 -1
- package/dist/cli/args.js +0 -1
- package/dist/cli/config-selector.d.ts +0 -1
- package/dist/cli/config-selector.js +0 -1
- package/dist/cli/credential-print.d.ts +0 -1
- package/dist/cli/credential-print.js +0 -1
- package/dist/cli/file-processor.d.ts +0 -1
- package/dist/cli/file-processor.js +0 -1
- package/dist/cli/initial-message.d.ts +0 -1
- package/dist/cli/initial-message.js +0 -1
- package/dist/cli/list-models.d.ts +0 -1
- package/dist/cli/list-models.js +0 -1
- package/dist/cli/project-trust.d.ts +0 -1
- package/dist/cli/project-trust.js +0 -1
- package/dist/cli/session-picker.d.ts +0 -1
- package/dist/cli/session-picker.js +0 -1
- package/dist/cli/startup-ui.d.ts +0 -1
- package/dist/cli/startup-ui.js +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/config.js +0 -1
- package/dist/core/agent-session-auto-handoff.test.d.ts +0 -1
- package/dist/core/agent-session-auto-handoff.test.js +0 -1
- package/dist/core/agent-session-runtime.d.ts +0 -1
- package/dist/core/agent-session-runtime.js +0 -1
- package/dist/core/agent-session-services.d.ts +0 -1
- package/dist/core/agent-session-services.js +0 -1
- package/dist/core/agent-session-skill-block.test.d.ts +0 -1
- package/dist/core/agent-session-skill-block.test.js +0 -1
- package/dist/core/agent-session.d.ts +0 -1
- package/dist/core/agent-session.js +0 -1
- package/dist/core/agents.d.ts +0 -1
- package/dist/core/agents.js +0 -1
- package/dist/core/auth-guidance.d.ts +0 -1
- package/dist/core/auth-guidance.js +0 -1
- package/dist/core/auth-storage.d.ts +0 -1
- package/dist/core/auth-storage.js +0 -1
- package/dist/core/bash-executor.d.ts +0 -1
- package/dist/core/bash-executor.js +0 -1
- package/dist/core/built-in-extensions.d.ts +0 -1
- package/dist/core/built-in-extensions.js +0 -1
- package/dist/core/cache-stats.d.ts +0 -1
- package/dist/core/cache-stats.js +0 -1
- package/dist/core/compaction/branch-summarization.d.ts +0 -1
- package/dist/core/compaction/branch-summarization.js +0 -1
- package/dist/core/compaction/compaction.d.ts +0 -1
- package/dist/core/compaction/compaction.js +0 -1
- package/dist/core/compaction/index.d.ts +0 -1
- package/dist/core/compaction/index.js +0 -1
- package/dist/core/compaction/utils.d.ts +0 -1
- package/dist/core/compaction/utils.js +0 -1
- package/dist/core/defaults.d.ts +0 -1
- package/dist/core/defaults.js +0 -1
- package/dist/core/diagnostics.d.ts +0 -1
- package/dist/core/diagnostics.js +0 -1
- package/dist/core/event-bus.d.ts +0 -1
- package/dist/core/event-bus.js +0 -1
- package/dist/core/exec.d.ts +0 -1
- package/dist/core/exec.js +0 -1
- package/dist/core/experimental.d.ts +0 -1
- package/dist/core/experimental.js +0 -1
- package/dist/core/export-html/ansi-to-html.d.ts +0 -1
- package/dist/core/export-html/ansi-to-html.js +0 -1
- package/dist/core/export-html/index.d.ts +0 -1
- package/dist/core/export-html/index.js +0 -1
- package/dist/core/export-html/tool-renderer.d.ts +0 -1
- package/dist/core/export-html/tool-renderer.js +0 -1
- package/dist/core/extensions/index.d.ts +0 -1
- package/dist/core/extensions/index.js +0 -1
- package/dist/core/extensions/loader.d.ts +0 -1
- package/dist/core/extensions/loader.js +0 -1
- package/dist/core/extensions/runner.d.ts +0 -1
- package/dist/core/extensions/runner.js +0 -1
- package/dist/core/extensions/types.d.ts +0 -1
- package/dist/core/extensions/types.js +0 -1
- package/dist/core/extensions/wrapper.d.ts +0 -1
- package/dist/core/extensions/wrapper.js +0 -1
- package/dist/core/footer-data-provider.d.ts +0 -1
- package/dist/core/footer-data-provider.js +0 -1
- package/dist/core/git-command.d.ts +0 -1
- package/dist/core/git-command.js +0 -1
- package/dist/core/http-dispatcher.d.ts +0 -1
- package/dist/core/http-dispatcher.js +0 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -1
- package/dist/core/keybindings.d.ts +0 -1
- package/dist/core/keybindings.js +0 -1
- package/dist/core/llama/client.d.ts +0 -1
- package/dist/core/llama/client.js +0 -1
- package/dist/core/llama/huggingface.d.ts +0 -1
- package/dist/core/llama/huggingface.js +0 -1
- package/dist/core/llama/index.d.ts +0 -1
- package/dist/core/llama/index.js +0 -1
- package/dist/core/llama/provider.d.ts +0 -1
- package/dist/core/llama/provider.js +0 -1
- package/dist/core/llama/ui.d.ts +0 -1
- package/dist/core/llama/ui.js +0 -1
- package/dist/core/messages.d.ts +0 -1
- package/dist/core/messages.js +0 -1
- package/dist/core/model-config.d.ts +0 -1
- package/dist/core/model-config.js +0 -1
- package/dist/core/model-registry.d.ts +0 -1
- package/dist/core/model-registry.js +0 -1
- package/dist/core/model-resolver.d.ts +0 -1
- package/dist/core/model-resolver.js +0 -1
- package/dist/core/model-runtime.d.ts +0 -1
- package/dist/core/model-runtime.js +0 -1
- package/dist/core/models-store.d.ts +0 -1
- package/dist/core/models-store.js +0 -1
- package/dist/core/output-guard.d.ts +0 -1
- package/dist/core/output-guard.js +0 -1
- package/dist/core/package-manager.d.ts +0 -1
- package/dist/core/package-manager.js +0 -1
- package/dist/core/package-manager.test.d.ts +0 -1
- package/dist/core/package-manager.test.js +0 -1
- package/dist/core/project-trust.d.ts +0 -1
- package/dist/core/project-trust.js +0 -1
- package/dist/core/prompt-templates.d.ts +0 -1
- package/dist/core/prompt-templates.js +0 -1
- package/dist/core/provider-attribution.d.ts +0 -1
- package/dist/core/provider-attribution.js +0 -1
- package/dist/core/provider-composer.d.ts +0 -1
- package/dist/core/provider-composer.js +0 -1
- package/dist/core/radius.d.ts +0 -1
- package/dist/core/radius.js +0 -1
- package/dist/core/remote-catalog-provider.d.ts +0 -1
- package/dist/core/remote-catalog-provider.js +0 -1
- package/dist/core/resolve-config-value.d.ts +0 -1
- package/dist/core/resolve-config-value.js +0 -1
- package/dist/core/resource-loader.d.ts +0 -1
- package/dist/core/resource-loader.js +0 -1
- package/dist/core/runtime-credentials.d.ts +0 -1
- package/dist/core/runtime-credentials.js +0 -1
- package/dist/core/sdk.d.ts +0 -1
- package/dist/core/sdk.js +0 -1
- package/dist/core/session-cwd.d.ts +0 -1
- package/dist/core/session-cwd.js +0 -1
- package/dist/core/session-manager.d.ts +0 -1
- package/dist/core/session-manager.js +0 -1
- package/dist/core/settings-manager-auto-handoff.test.d.ts +0 -1
- package/dist/core/settings-manager-auto-handoff.test.js +0 -1
- package/dist/core/settings-manager.d.ts +0 -4
- package/dist/core/settings-manager.js +0 -12
- package/dist/core/skills.d.ts +0 -1
- package/dist/core/skills.js +0 -1
- package/dist/core/slash-commands.d.ts +0 -1
- package/dist/core/slash-commands.js +0 -1
- package/dist/core/source-info.d.ts +0 -1
- package/dist/core/source-info.js +0 -1
- package/dist/core/system-prompt.d.ts +0 -1
- package/dist/core/system-prompt.js +0 -1
- package/dist/core/system-prompt.test.d.ts +0 -1
- package/dist/core/system-prompt.test.js +0 -1
- package/dist/core/telemetry.d.ts +0 -1
- package/dist/core/telemetry.js +0 -1
- package/dist/core/timings.d.ts +0 -1
- package/dist/core/timings.js +0 -1
- package/dist/core/tools/bash.d.ts +0 -1
- package/dist/core/tools/bash.js +0 -1
- package/dist/core/tools/edit-diff.d.ts +0 -1
- package/dist/core/tools/edit-diff.js +0 -1
- package/dist/core/tools/edit.d.ts +0 -1
- package/dist/core/tools/edit.js +0 -1
- package/dist/core/tools/file-mutation-queue.d.ts +0 -1
- package/dist/core/tools/file-mutation-queue.js +0 -1
- package/dist/core/tools/find.d.ts +0 -1
- package/dist/core/tools/find.js +0 -1
- package/dist/core/tools/grep.d.ts +0 -1
- package/dist/core/tools/grep.js +0 -1
- package/dist/core/tools/index.d.ts +0 -1
- package/dist/core/tools/index.js +0 -1
- package/dist/core/tools/ls.d.ts +0 -1
- package/dist/core/tools/ls.js +0 -1
- package/dist/core/tools/output-accumulator.d.ts +0 -1
- package/dist/core/tools/output-accumulator.js +0 -1
- package/dist/core/tools/path-utils.d.ts +0 -1
- package/dist/core/tools/path-utils.js +0 -1
- package/dist/core/tools/read.d.ts +0 -1
- package/dist/core/tools/read.js +0 -1
- package/dist/core/tools/render-utils.d.ts +0 -1
- package/dist/core/tools/render-utils.js +0 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +0 -1
- package/dist/core/tools/tool-definition-wrapper.js +0 -1
- package/dist/core/tools/truncate.d.ts +0 -1
- package/dist/core/tools/truncate.js +0 -1
- package/dist/core/tools/write.d.ts +0 -1
- package/dist/core/tools/write.js +0 -1
- package/dist/core/trust-manager.d.ts +0 -1
- package/dist/core/trust-manager.js +0 -1
- package/dist/core/usage-totals.d.ts +0 -1
- package/dist/core/usage-totals.js +0 -1
- package/dist/defaults/models.json +8 -0
- package/dist/defaults/settings.json +6 -7
- package/dist/extensions/agent-browser.test.ts +195 -0
- package/dist/extensions/agent-browser.ts +158 -0
- package/dist/extensions/inline-skills.test.ts +27 -13
- package/dist/extensions/inline-skills.ts +18 -11
- package/dist/extensions/package.json +2 -1
- package/dist/extensions/pi-powerline-footer/.github/workflows/test.yml +27 -0
- package/dist/extensions/pi-powerline-footer/CHANGELOG.md +153 -0
- package/dist/extensions/pi-powerline-footer/CONTRIBUTING.md +16 -0
- package/dist/extensions/pi-powerline-footer/README.md +192 -44
- package/dist/extensions/pi-powerline-footer/bash-mode/completion.ts +19 -4
- package/dist/extensions/pi-powerline-footer/bash-mode/editor.ts +80 -25
- package/dist/extensions/pi-powerline-footer/bash-mode/history.ts +81 -29
- package/dist/extensions/pi-powerline-footer/bash-mode/types.ts +1 -1
- package/dist/extensions/pi-powerline-footer/cd-command.ts +190 -0
- package/dist/extensions/pi-powerline-footer/colors.ts +2 -1
- package/dist/extensions/pi-powerline-footer/context-usage.ts +121 -6
- package/dist/extensions/pi-powerline-footer/currency-rates.ts +142 -0
- package/dist/extensions/pi-powerline-footer/editor-composition.ts +32 -0
- package/dist/extensions/pi-powerline-footer/git-status.ts +108 -6
- package/dist/extensions/pi-powerline-footer/icons.ts +11 -2
- package/dist/extensions/pi-powerline-footer/index.ts +1056 -324
- package/dist/extensions/pi-powerline-footer/lifecycle.ts +10 -0
- package/dist/extensions/pi-powerline-footer/package.json +10 -6
- package/dist/extensions/pi-powerline-footer/paths.ts +22 -0
- package/dist/extensions/pi-powerline-footer/powerline-config.ts +297 -15
- package/dist/extensions/pi-powerline-footer/presets.ts +6 -25
- package/dist/extensions/pi-powerline-footer/queue/store.ts +361 -0
- package/dist/extensions/pi-powerline-footer/queue/types.ts +54 -0
- package/dist/extensions/pi-powerline-footer/render-scheduler.ts +12 -7
- package/dist/extensions/pi-powerline-footer/segments.ts +114 -107
- package/dist/extensions/pi-powerline-footer/session-usage.ts +1 -1
- package/dist/extensions/pi-powerline-footer/shortcuts.ts +17 -3
- package/dist/extensions/pi-powerline-footer/tests/bash-mode.test.ts +189 -17
- package/dist/extensions/pi-powerline-footer/tests/cd-command.test.ts +144 -0
- package/dist/extensions/pi-powerline-footer/tests/context-usage.test.ts +120 -2
- package/dist/extensions/pi-powerline-footer/tests/custom-items.test.ts +245 -22
- package/dist/extensions/pi-powerline-footer/tests/editor-composition.test.ts +48 -0
- package/dist/extensions/pi-powerline-footer/tests/editor-responsiveness.test.ts +34 -0
- package/dist/extensions/pi-powerline-footer/tests/fixed-editor-border.test.ts +39 -0
- package/dist/extensions/pi-powerline-footer/tests/git-status.test.ts +92 -0
- package/dist/extensions/pi-powerline-footer/tests/guide.test.ts +4 -1
- package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +33 -197
- package/dist/extensions/pi-powerline-footer/tests/mode-aware-trigger.test.ts +79 -0
- package/dist/extensions/pi-powerline-footer/tests/paths.test.ts +63 -0
- package/dist/extensions/pi-powerline-footer/tests/queue-store.test.ts +195 -0
- package/dist/extensions/pi-powerline-footer/tests/quit-cursor.test.ts +14 -0
- package/dist/extensions/pi-powerline-footer/tests/remaining-regressions.test.ts +167 -0
- package/dist/extensions/pi-powerline-footer/tests/stash-shortcut.test.ts +23 -18
- package/dist/extensions/pi-powerline-footer/tests/thinking-segment.test.ts +16 -1
- package/dist/extensions/pi-powerline-footer/tests/token-stats.test.ts +249 -0
- package/dist/extensions/pi-powerline-footer/tests/usage-display.test.ts +237 -0
- package/dist/extensions/pi-powerline-footer/tests/welcome.test.ts +199 -0
- package/dist/extensions/pi-powerline-footer/tests/working-vibes.test.ts +191 -100
- package/dist/extensions/pi-powerline-footer/theme.ts +32 -18
- package/dist/extensions/pi-powerline-footer/token-stats.ts +304 -0
- package/dist/extensions/pi-powerline-footer/tsconfig.json +13 -0
- package/dist/extensions/pi-powerline-footer/types.ts +74 -29
- package/dist/extensions/pi-powerline-footer/welcome-dismiss.ts +34 -0
- package/dist/extensions/pi-powerline-footer/welcome.ts +65 -10
- package/dist/extensions/pi-powerline-footer/working-vibes.ts +44 -11
- package/dist/extensions/pi-subagents/CHANGELOG.md +89 -12
- package/dist/extensions/pi-subagents/README.md +339 -604
- package/dist/extensions/pi-subagents/package-lock.json +190 -2079
- package/dist/extensions/pi-subagents/package.json +13 -5
- package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +1 -1
- package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/extensions/pi-subagents/prompts/review-loop.md +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +10 -10
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +32 -43
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +106 -105
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +3 -3
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +28 -35
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +167 -124
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +19 -0
- package/dist/extensions/pi-subagents/src/agents/agents.ts +163 -75
- package/dist/extensions/pi-subagents/src/agents/chain-serializer.ts +10 -7
- package/dist/extensions/pi-subagents/src/agents/frontmatter.ts +5 -3
- package/dist/extensions/pi-subagents/src/agents/identity.ts +1 -1
- package/dist/extensions/pi-subagents/src/agents/proactive-skills.ts +14 -11
- package/dist/extensions/pi-subagents/src/agents/skills.ts +23 -6
- package/dist/extensions/pi-subagents/src/agents/task-aware-routing.ts +8 -1
- package/dist/extensions/pi-subagents/src/api/control-channel.ts +4 -0
- package/dist/extensions/pi-subagents/src/api/delegation.ts +26 -194
- package/dist/extensions/pi-subagents/src/api/external-runs.ts +129 -0
- package/dist/extensions/pi-subagents/src/api/intercom-bridge.ts +3 -0
- package/dist/extensions/pi-subagents/src/api/pi-args.ts +5 -0
- package/dist/extensions/pi-subagents/src/api/preflight.ts +4 -4
- package/dist/extensions/pi-subagents/src/api/shared-types.ts +19 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +10 -0
- package/dist/extensions/pi-subagents/src/extension/control-notices.ts +5 -39
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +10 -9
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +7 -4
- package/dist/extensions/pi-subagents/src/extension/index.ts +243 -77
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +18 -6
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +50 -39
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +36 -103
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +229 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/client.ts +130 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +141 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +154 -0
- package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +330 -0
- package/dist/extensions/pi-subagents/src/intercom/intercom-bridge.ts +3 -2
- package/dist/extensions/pi-subagents/src/intercom/result-intercom.ts +5 -1
- package/dist/extensions/pi-subagents/src/missions/actions.ts +372 -0
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +314 -0
- package/dist/extensions/pi-subagents/src/missions/store.ts +442 -0
- package/dist/extensions/pi-subagents/src/missions/types.ts +135 -0
- package/dist/extensions/pi-subagents/src/policy/authority.ts +46 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +32 -6
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +103 -72
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +10 -2
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +6 -6
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +29 -1
- package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +3 -2
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +9 -7
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +3 -4
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +3 -28
- package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +5 -5
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +18 -68
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +35 -8
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +602 -375
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +612 -464
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +50 -9
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +253 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +12 -4
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +8 -4
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +74 -102
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +21 -22
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1050 -396
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +44 -18
- package/dist/extensions/pi-subagents/src/runs/shared/capability-ceiling.ts +0 -1
- package/dist/extensions/pi-subagents/src/runs/shared/child-protocol.ts +302 -22
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +130 -0
- package/dist/extensions/pi-subagents/src/runs/shared/long-running-guard.ts +42 -1
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +59 -5
- package/dist/extensions/pi-subagents/src/runs/shared/nested-render.ts +9 -4
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +86 -2
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +11 -2
- package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +95 -0
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +11 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +15 -6
- package/dist/extensions/pi-subagents/src/runs/shared/run-history.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +9 -63
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +37 -6
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-startup-retry.ts +5 -2
- package/dist/extensions/pi-subagents/src/runs/shared/task-intent.ts +2 -23
- package/dist/extensions/pi-subagents/src/runs/shared/turn-budget.ts +6 -6
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +124 -13
- package/dist/extensions/pi-subagents/src/shared/accessible-dir.ts +29 -7
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +18 -1
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +3 -2
- package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +1 -0
- package/dist/extensions/pi-subagents/src/shared/settings.ts +10 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +158 -55
- package/dist/extensions/pi-subagents/src/shared/utils.ts +16 -66
- package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +33 -199
- package/dist/extensions/pi-subagents/src/slash/delegation-request.ts +43 -126
- package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +136 -0
- package/dist/extensions/pi-subagents/src/slash/prompt-template-bridge.ts +158 -205
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +22 -58
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +14 -0
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +44 -642
- package/dist/extensions/pi-subagents/src/slash/subagents-admin.ts +18 -14
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +156 -21
- package/dist/extensions/pi-subagents/src/tui/fleet-transcript.ts +110 -5
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +60 -24
- package/dist/extensions/pi-subagents/src/tui/render.ts +296 -140
- package/dist/extensions/pi-subagents/src/types/pi-runtime-compat.d.ts +14 -0
- package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +13 -7
- package/dist/extensions/pi-subagents/src/watchdog/model-selection.ts +2 -2
- package/dist/extensions/pi-subagents/src/watchdog/permission-arbiter.ts +145 -0
- package/dist/extensions/pi-subagents/src/watchdog/register-child.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/review.ts +4 -1
- package/dist/extensions/pi-subagents/src/watchdog/runtime.ts +3 -2
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +140 -0
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +415 -0
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +41 -144
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +16 -16
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +415 -298
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +149 -82
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +40 -40
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +15 -15
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +193 -133
- package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +1 -49
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +56 -58
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +81 -68
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +20 -25
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +425 -317
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +73 -73
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +123 -98
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +653 -240
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +20 -1661
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +8 -5
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +6 -6
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +4 -20
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +25 -4
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +280 -295
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +47 -207
- package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +26 -26
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +89 -89
- package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +10 -0
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +33 -9
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +24 -2
- package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +11 -9
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +40 -40
- package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +5 -39
- package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +19 -19
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +20 -20
- package/dist/extensions/pi-subagents/test/unit/child-protocol.test.ts +99 -0
- package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +41 -0
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +35 -5
- package/dist/extensions/pi-subagents/test/unit/config-dir-runtime.test.ts +7 -0
- package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +16 -82
- package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +162 -620
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +25 -25
- package/dist/extensions/pi-subagents/test/unit/ensure-accessible-dir.test.ts +125 -0
- package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/unit/external-runs.test.ts +66 -0
- package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +242 -52
- package/dist/extensions/pi-subagents/test/unit/fleet-transcript.test.ts +127 -0
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +197 -36
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +245 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +494 -0
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +261 -31
- package/dist/extensions/pi-subagents/test/unit/inline-subagents.test.ts +127 -0
- package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +6 -6
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +217 -0
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +182 -0
- package/dist/extensions/pi-subagents/test/unit/mock-pi.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +20 -12
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +47 -5
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +49 -55
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +20 -3
- package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +37 -7
- package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/permissions.test.ts +46 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +31 -10
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +40 -16
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +42 -44
- package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/process-terminal.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +75 -9
- package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +20 -84
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +15 -16
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +28 -28
- package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +19 -12
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +37 -21
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +50 -50
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +396 -433
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +76 -153
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +411 -0
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +1 -91
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +139 -0
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +29 -0
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +35 -35
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +53 -18
- package/dist/extensions/pi-subagents/test/unit/subagent-startup-retry.test.ts +13 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +44 -11
- package/dist/extensions/pi-subagents/test/unit/task-intent.test.ts +2 -26
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +24 -148
- package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +11 -9
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +351 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-child-status.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/watchdog-lsp-diagnostics.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-permission-arbiter.test.ts +79 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-runtime.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-settings.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +45 -9
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +197 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +142 -12
- package/dist/extensions/pi-subagents/tsconfig.json +15 -0
- package/dist/extensions/ponytail/index.js +1 -31
- package/dist/extensions/ponytail/test/extension.test.js +5 -22
- package/dist/extensions/rtk.test.ts +141 -0
- package/dist/extensions/rtk.ts +78 -36
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -1
- package/dist/migrations.d.ts +0 -1
- package/dist/migrations.js +0 -1
- package/dist/modes/index.d.ts +0 -1
- package/dist/modes/index.js +0 -1
- package/dist/modes/interactive/components/armin.d.ts +0 -1
- package/dist/modes/interactive/components/armin.js +0 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +0 -1
- package/dist/modes/interactive/components/assistant-message.js +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
- package/dist/modes/interactive/components/bash-execution.js +0 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +0 -1
- package/dist/modes/interactive/components/bordered-loader.js +0 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -1
- package/dist/modes/interactive/components/branch-summary-message.js +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +0 -1
- package/dist/modes/interactive/components/config-selector.d.ts +0 -1
- package/dist/modes/interactive/components/config-selector.js +0 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +0 -1
- package/dist/modes/interactive/components/countdown-timer.js +0 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +0 -1
- package/dist/modes/interactive/components/custom-editor.js +0 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +0 -1
- package/dist/modes/interactive/components/custom-entry.js +0 -1
- package/dist/modes/interactive/components/custom-message.d.ts +0 -1
- package/dist/modes/interactive/components/custom-message.js +0 -1
- package/dist/modes/interactive/components/daxnuts.d.ts +0 -1
- package/dist/modes/interactive/components/daxnuts.js +0 -1
- package/dist/modes/interactive/components/diff.d.ts +0 -1
- package/dist/modes/interactive/components/diff.js +0 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +0 -1
- package/dist/modes/interactive/components/dynamic-border.js +0 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -1
- package/dist/modes/interactive/components/earendil-announcement.js +0 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +0 -1
- package/dist/modes/interactive/components/extension-editor.js +0 -1
- package/dist/modes/interactive/components/extension-input.d.ts +0 -1
- package/dist/modes/interactive/components/extension-input.js +0 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +0 -1
- package/dist/modes/interactive/components/extension-selector.js +0 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +0 -1
- package/dist/modes/interactive/components/first-time-setup.js +0 -1
- package/dist/modes/interactive/components/footer.d.ts +0 -1
- package/dist/modes/interactive/components/footer.js +0 -1
- package/dist/modes/interactive/components/index.d.ts +0 -1
- package/dist/modes/interactive/components/index.js +0 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -1
- package/dist/modes/interactive/components/keybinding-hints.js +0 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +0 -1
- package/dist/modes/interactive/components/login-dialog.js +0 -1
- package/dist/modes/interactive/components/model-selector.d.ts +0 -1
- package/dist/modes/interactive/components/model-selector.js +0 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +0 -1
- package/dist/modes/interactive/components/oauth-selector.js +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +0 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +0 -1
- package/dist/modes/interactive/components/session-selector-search.js +0 -1
- package/dist/modes/interactive/components/session-selector.d.ts +0 -1
- package/dist/modes/interactive/components/session-selector.js +0 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +0 -3
- package/dist/modes/interactive/components/settings-selector.js +1 -14
- package/dist/modes/interactive/components/show-images-selector.d.ts +0 -1
- package/dist/modes/interactive/components/show-images-selector.js +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +0 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +0 -1
- package/dist/modes/interactive/components/status-indicator.js +0 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +0 -1
- package/dist/modes/interactive/components/theme-selector.js +0 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +0 -1
- package/dist/modes/interactive/components/thinking-selector.js +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
- package/dist/modes/interactive/components/tool-execution.js +0 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +0 -1
- package/dist/modes/interactive/components/tree-selector.js +0 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +0 -1
- package/dist/modes/interactive/components/trust-selector.js +0 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +0 -1
- package/dist/modes/interactive/components/user-message-selector.js +0 -1
- package/dist/modes/interactive/components/user-message.d.ts +0 -1
- package/dist/modes/interactive/components/user-message.js +0 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +0 -1
- package/dist/modes/interactive/components/visual-truncate.js +0 -1
- package/dist/modes/interactive/external-editor.d.ts +0 -1
- package/dist/modes/interactive/external-editor.js +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts +0 -2
- package/dist/modes/interactive/interactive-mode.js +1 -22
- package/dist/modes/interactive/model-search.d.ts +0 -1
- package/dist/modes/interactive/model-search.js +0 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +0 -1
- package/dist/modes/interactive/theme/theme-controller.js +0 -1
- package/dist/modes/interactive/theme/theme.d.ts +0 -1
- package/dist/modes/interactive/theme/theme.js +0 -1
- package/dist/modes/print-mode.d.ts +0 -1
- package/dist/modes/print-mode.js +0 -1
- package/dist/modes/rpc/jsonl.d.ts +0 -1
- package/dist/modes/rpc/jsonl.js +0 -1
- package/dist/modes/rpc/rpc-client.d.ts +1 -2
- package/dist/modes/rpc/rpc-client.js +1 -2
- package/dist/modes/rpc/rpc-mode.d.ts +0 -1
- package/dist/modes/rpc/rpc-mode.js +0 -9
- package/dist/modes/rpc/rpc-types.d.ts +0 -1
- package/dist/modes/rpc/rpc-types.js +0 -1
- package/dist/package-manager-cli.d.ts +0 -1
- package/dist/package-manager-cli.js +0 -1
- package/dist/rpc-entry.d.ts +0 -1
- package/dist/rpc-entry.js +0 -1
- package/dist/utils/ansi.d.ts +0 -1
- package/dist/utils/ansi.js +0 -1
- package/dist/utils/changelog.d.ts +0 -1
- package/dist/utils/changelog.js +0 -1
- package/dist/utils/child-process.d.ts +0 -1
- package/dist/utils/child-process.js +0 -1
- package/dist/utils/clipboard-image.d.ts +0 -1
- package/dist/utils/clipboard-image.js +0 -1
- package/dist/utils/clipboard-native.d.ts +0 -1
- package/dist/utils/clipboard-native.js +0 -1
- package/dist/utils/clipboard.d.ts +0 -1
- package/dist/utils/clipboard.js +0 -1
- package/dist/utils/deprecation.d.ts +0 -1
- package/dist/utils/deprecation.js +0 -1
- package/dist/utils/exif-orientation.d.ts +0 -1
- package/dist/utils/exif-orientation.js +0 -1
- package/dist/utils/frontmatter.d.ts +0 -1
- package/dist/utils/frontmatter.js +0 -1
- package/dist/utils/fs-watch.d.ts +0 -1
- package/dist/utils/fs-watch.js +0 -1
- package/dist/utils/git.d.ts +0 -1
- package/dist/utils/git.js +0 -1
- package/dist/utils/html.d.ts +0 -1
- package/dist/utils/html.js +0 -1
- package/dist/utils/image-convert.d.ts +0 -1
- package/dist/utils/image-convert.js +0 -1
- package/dist/utils/image-process.d.ts +0 -1
- package/dist/utils/image-process.js +0 -1
- package/dist/utils/image-resize-core.d.ts +0 -1
- package/dist/utils/image-resize-core.js +0 -1
- package/dist/utils/image-resize-worker.d.ts +0 -1
- package/dist/utils/image-resize-worker.js +0 -1
- package/dist/utils/image-resize.d.ts +0 -1
- package/dist/utils/image-resize.js +0 -1
- package/dist/utils/json.d.ts +0 -1
- package/dist/utils/json.js +0 -1
- package/dist/utils/mime.d.ts +0 -1
- package/dist/utils/mime.js +0 -1
- package/dist/utils/open-browser.d.ts +0 -1
- package/dist/utils/open-browser.js +0 -1
- package/dist/utils/paths.d.ts +0 -1
- package/dist/utils/paths.js +0 -1
- package/dist/utils/photon.d.ts +0 -1
- package/dist/utils/photon.js +0 -1
- package/dist/utils/pi-user-agent.d.ts +0 -1
- package/dist/utils/pi-user-agent.js +0 -1
- package/dist/utils/shell.d.ts +0 -1
- package/dist/utils/shell.js +0 -1
- package/dist/utils/sleep.d.ts +0 -1
- package/dist/utils/sleep.js +0 -1
- package/dist/utils/syntax-highlight.d.ts +0 -1
- package/dist/utils/syntax-highlight.js +0 -1
- package/dist/utils/thinking-tags.d.ts +0 -1
- package/dist/utils/thinking-tags.js +0 -1
- package/dist/utils/tools-manager.d.ts +3 -3
- package/dist/utils/tools-manager.js +125 -42
- package/dist/utils/version-check.d.ts +0 -1
- package/dist/utils/version-check.js +0 -1
- package/dist/utils/windows-self-update.d.ts +0 -1
- package/dist/utils/windows-self-update.js +0 -1
- package/docs/rpc.md +1 -2
- package/docs/settings.md +0 -1
- package/docs/skills.md +10 -18
- package/package.json +3 -2
- package/dist/bun/cli.d.ts.map +0 -1
- package/dist/bun/cli.js.map +0 -1
- package/dist/bun/register-bedrock.d.ts.map +0 -1
- package/dist/bun/register-bedrock.js.map +0 -1
- package/dist/bun/restore-sandbox-env.d.ts.map +0 -1
- package/dist/bun/restore-sandbox-env.js.map +0 -1
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/config-selector.d.ts.map +0 -1
- package/dist/cli/config-selector.js.map +0 -1
- package/dist/cli/credential-print.d.ts.map +0 -1
- package/dist/cli/credential-print.js.map +0 -1
- package/dist/cli/file-processor.d.ts.map +0 -1
- package/dist/cli/file-processor.js.map +0 -1
- package/dist/cli/initial-message.d.ts.map +0 -1
- package/dist/cli/initial-message.js.map +0 -1
- package/dist/cli/list-models.d.ts.map +0 -1
- package/dist/cli/list-models.js.map +0 -1
- package/dist/cli/project-trust.d.ts.map +0 -1
- package/dist/cli/project-trust.js.map +0 -1
- package/dist/cli/session-picker.d.ts.map +0 -1
- package/dist/cli/session-picker.js.map +0 -1
- package/dist/cli/startup-ui.d.ts.map +0 -1
- package/dist/cli/startup-ui.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/core/agent-session-auto-handoff.test.d.ts.map +0 -1
- package/dist/core/agent-session-auto-handoff.test.js.map +0 -1
- package/dist/core/agent-session-runtime.d.ts.map +0 -1
- package/dist/core/agent-session-runtime.js.map +0 -1
- package/dist/core/agent-session-services.d.ts.map +0 -1
- package/dist/core/agent-session-services.js.map +0 -1
- package/dist/core/agent-session-skill-block.test.d.ts.map +0 -1
- package/dist/core/agent-session-skill-block.test.js.map +0 -1
- package/dist/core/agent-session.d.ts.map +0 -1
- package/dist/core/agent-session.js.map +0 -1
- package/dist/core/agents.d.ts.map +0 -1
- package/dist/core/agents.js.map +0 -1
- package/dist/core/auth-guidance.d.ts.map +0 -1
- package/dist/core/auth-guidance.js.map +0 -1
- package/dist/core/auth-storage.d.ts.map +0 -1
- package/dist/core/auth-storage.js.map +0 -1
- package/dist/core/bash-executor.d.ts.map +0 -1
- package/dist/core/bash-executor.js.map +0 -1
- package/dist/core/built-in-extensions.d.ts.map +0 -1
- package/dist/core/built-in-extensions.js.map +0 -1
- package/dist/core/cache-stats.d.ts.map +0 -1
- package/dist/core/cache-stats.js.map +0 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
- package/dist/core/compaction/branch-summarization.js.map +0 -1
- package/dist/core/compaction/compaction.d.ts.map +0 -1
- package/dist/core/compaction/compaction.js.map +0 -1
- package/dist/core/compaction/index.d.ts.map +0 -1
- package/dist/core/compaction/index.js.map +0 -1
- package/dist/core/compaction/utils.d.ts.map +0 -1
- package/dist/core/compaction/utils.js.map +0 -1
- package/dist/core/defaults.d.ts.map +0 -1
- package/dist/core/defaults.js.map +0 -1
- package/dist/core/diagnostics.d.ts.map +0 -1
- package/dist/core/diagnostics.js.map +0 -1
- package/dist/core/event-bus.d.ts.map +0 -1
- package/dist/core/event-bus.js.map +0 -1
- package/dist/core/exec.d.ts.map +0 -1
- package/dist/core/exec.js.map +0 -1
- package/dist/core/experimental.d.ts.map +0 -1
- package/dist/core/experimental.js.map +0 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
- package/dist/core/export-html/ansi-to-html.js.map +0 -1
- package/dist/core/export-html/index.d.ts.map +0 -1
- package/dist/core/export-html/index.js.map +0 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
- package/dist/core/export-html/tool-renderer.js.map +0 -1
- package/dist/core/extensions/index.d.ts.map +0 -1
- package/dist/core/extensions/index.js.map +0 -1
- package/dist/core/extensions/loader.d.ts.map +0 -1
- package/dist/core/extensions/loader.js.map +0 -1
- package/dist/core/extensions/runner.d.ts.map +0 -1
- package/dist/core/extensions/runner.js.map +0 -1
- package/dist/core/extensions/types.d.ts.map +0 -1
- package/dist/core/extensions/types.js.map +0 -1
- package/dist/core/extensions/wrapper.d.ts.map +0 -1
- package/dist/core/extensions/wrapper.js.map +0 -1
- package/dist/core/footer-data-provider.d.ts.map +0 -1
- package/dist/core/footer-data-provider.js.map +0 -1
- package/dist/core/git-command.d.ts.map +0 -1
- package/dist/core/git-command.js.map +0 -1
- package/dist/core/http-dispatcher.d.ts.map +0 -1
- package/dist/core/http-dispatcher.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/keybindings.d.ts.map +0 -1
- package/dist/core/keybindings.js.map +0 -1
- package/dist/core/llama/client.d.ts.map +0 -1
- package/dist/core/llama/client.js.map +0 -1
- package/dist/core/llama/huggingface.d.ts.map +0 -1
- package/dist/core/llama/huggingface.js.map +0 -1
- package/dist/core/llama/index.d.ts.map +0 -1
- package/dist/core/llama/index.js.map +0 -1
- package/dist/core/llama/provider.d.ts.map +0 -1
- package/dist/core/llama/provider.js.map +0 -1
- package/dist/core/llama/ui.d.ts.map +0 -1
- package/dist/core/llama/ui.js.map +0 -1
- package/dist/core/messages.d.ts.map +0 -1
- package/dist/core/messages.js.map +0 -1
- package/dist/core/model-config.d.ts.map +0 -1
- package/dist/core/model-config.js.map +0 -1
- package/dist/core/model-registry.d.ts.map +0 -1
- package/dist/core/model-registry.js.map +0 -1
- package/dist/core/model-resolver.d.ts.map +0 -1
- package/dist/core/model-resolver.js.map +0 -1
- package/dist/core/model-runtime.d.ts.map +0 -1
- package/dist/core/model-runtime.js.map +0 -1
- package/dist/core/models-store.d.ts.map +0 -1
- package/dist/core/models-store.js.map +0 -1
- package/dist/core/output-guard.d.ts.map +0 -1
- package/dist/core/output-guard.js.map +0 -1
- package/dist/core/package-manager.d.ts.map +0 -1
- package/dist/core/package-manager.js.map +0 -1
- package/dist/core/package-manager.test.d.ts.map +0 -1
- package/dist/core/package-manager.test.js.map +0 -1
- package/dist/core/project-trust.d.ts.map +0 -1
- package/dist/core/project-trust.js.map +0 -1
- package/dist/core/prompt-templates.d.ts.map +0 -1
- package/dist/core/prompt-templates.js.map +0 -1
- package/dist/core/provider-attribution.d.ts.map +0 -1
- package/dist/core/provider-attribution.js.map +0 -1
- package/dist/core/provider-composer.d.ts.map +0 -1
- package/dist/core/provider-composer.js.map +0 -1
- package/dist/core/radius.d.ts.map +0 -1
- package/dist/core/radius.js.map +0 -1
- package/dist/core/remote-catalog-provider.d.ts.map +0 -1
- package/dist/core/remote-catalog-provider.js.map +0 -1
- package/dist/core/resolve-config-value.d.ts.map +0 -1
- package/dist/core/resolve-config-value.js.map +0 -1
- package/dist/core/resource-loader.d.ts.map +0 -1
- package/dist/core/resource-loader.js.map +0 -1
- package/dist/core/runtime-credentials.d.ts.map +0 -1
- package/dist/core/runtime-credentials.js.map +0 -1
- package/dist/core/sdk.d.ts.map +0 -1
- package/dist/core/sdk.js.map +0 -1
- package/dist/core/session-cwd.d.ts.map +0 -1
- package/dist/core/session-cwd.js.map +0 -1
- package/dist/core/session-manager.d.ts.map +0 -1
- package/dist/core/session-manager.js.map +0 -1
- package/dist/core/settings-manager-auto-handoff.test.d.ts.map +0 -1
- package/dist/core/settings-manager-auto-handoff.test.js.map +0 -1
- package/dist/core/settings-manager.d.ts.map +0 -1
- package/dist/core/settings-manager.js.map +0 -1
- package/dist/core/skills.d.ts.map +0 -1
- package/dist/core/skills.js.map +0 -1
- package/dist/core/slash-commands.d.ts.map +0 -1
- package/dist/core/slash-commands.js.map +0 -1
- package/dist/core/source-info.d.ts.map +0 -1
- package/dist/core/source-info.js.map +0 -1
- package/dist/core/system-prompt.d.ts.map +0 -1
- package/dist/core/system-prompt.js.map +0 -1
- package/dist/core/system-prompt.test.d.ts.map +0 -1
- package/dist/core/system-prompt.test.js.map +0 -1
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js.map +0 -1
- package/dist/core/timings.d.ts.map +0 -1
- package/dist/core/timings.js.map +0 -1
- package/dist/core/tools/bash.d.ts.map +0 -1
- package/dist/core/tools/bash.js.map +0 -1
- package/dist/core/tools/edit-diff.d.ts.map +0 -1
- package/dist/core/tools/edit-diff.js.map +0 -1
- package/dist/core/tools/edit.d.ts.map +0 -1
- package/dist/core/tools/edit.js.map +0 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
- package/dist/core/tools/file-mutation-queue.js.map +0 -1
- package/dist/core/tools/find.d.ts.map +0 -1
- package/dist/core/tools/find.js.map +0 -1
- package/dist/core/tools/grep.d.ts.map +0 -1
- package/dist/core/tools/grep.js.map +0 -1
- package/dist/core/tools/index.d.ts.map +0 -1
- package/dist/core/tools/index.js.map +0 -1
- package/dist/core/tools/ls.d.ts.map +0 -1
- package/dist/core/tools/ls.js.map +0 -1
- package/dist/core/tools/output-accumulator.d.ts.map +0 -1
- package/dist/core/tools/output-accumulator.js.map +0 -1
- package/dist/core/tools/path-utils.d.ts.map +0 -1
- package/dist/core/tools/path-utils.js.map +0 -1
- package/dist/core/tools/read.d.ts.map +0 -1
- package/dist/core/tools/read.js.map +0 -1
- package/dist/core/tools/render-utils.d.ts.map +0 -1
- package/dist/core/tools/render-utils.js.map +0 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
- package/dist/core/tools/truncate.d.ts.map +0 -1
- package/dist/core/tools/truncate.js.map +0 -1
- package/dist/core/tools/write.d.ts.map +0 -1
- package/dist/core/tools/write.js.map +0 -1
- package/dist/core/trust-manager.d.ts.map +0 -1
- package/dist/core/trust-manager.js.map +0 -1
- package/dist/core/usage-totals.d.ts.map +0 -1
- package/dist/core/usage-totals.js.map +0 -1
- package/dist/extensions/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/dist/extensions/pi-subagents/test/unit/slash-chain-groups.test.ts +0 -464
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js.map +0 -1
- package/dist/migrations.d.ts.map +0 -1
- package/dist/migrations.js.map +0 -1
- package/dist/modes/index.d.ts.map +0 -1
- package/dist/modes/index.js.map +0 -1
- package/dist/modes/interactive/components/armin.d.ts.map +0 -1
- package/dist/modes/interactive/components/armin.js.map +0 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/assistant-message.js.map +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/bash-execution.js.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/config-selector.js.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-editor.js.map +0 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-entry.js.map +0 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-message.js.map +0 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
- package/dist/modes/interactive/components/daxnuts.js.map +0 -1
- package/dist/modes/interactive/components/diff.d.ts.map +0 -1
- package/dist/modes/interactive/components/diff.js.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-editor.js.map +0 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-input.js.map +0 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-selector.js.map +0 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
- package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
- package/dist/modes/interactive/components/footer.d.ts.map +0 -1
- package/dist/modes/interactive/components/footer.js.map +0 -1
- package/dist/modes/interactive/components/index.d.ts.map +0 -1
- package/dist/modes/interactive/components/index.js.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
- package/dist/modes/interactive/components/login-dialog.js.map +0 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/model-selector.js.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector.js.map +0 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/settings-selector.js.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
- package/dist/modes/interactive/components/status-indicator.js.map +0 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/theme-selector.js.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/tool-execution.js.map +0 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/tree-selector.js.map +0 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/trust-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message.js.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
- package/dist/modes/interactive/external-editor.d.ts.map +0 -1
- package/dist/modes/interactive/external-editor.js.map +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
- package/dist/modes/interactive/interactive-mode.js.map +0 -1
- package/dist/modes/interactive/model-search.d.ts.map +0 -1
- package/dist/modes/interactive/model-search.js.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme.js.map +0 -1
- package/dist/modes/print-mode.d.ts.map +0 -1
- package/dist/modes/print-mode.js.map +0 -1
- package/dist/modes/rpc/jsonl.d.ts.map +0 -1
- package/dist/modes/rpc/jsonl.js.map +0 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-client.js.map +0 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-mode.js.map +0 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-types.js.map +0 -1
- package/dist/package-manager-cli.d.ts.map +0 -1
- package/dist/package-manager-cli.js.map +0 -1
- package/dist/rpc-entry.d.ts.map +0 -1
- package/dist/rpc-entry.js.map +0 -1
- package/dist/utils/ansi.d.ts.map +0 -1
- package/dist/utils/ansi.js.map +0 -1
- package/dist/utils/changelog.d.ts.map +0 -1
- package/dist/utils/changelog.js.map +0 -1
- package/dist/utils/child-process.d.ts.map +0 -1
- package/dist/utils/child-process.js.map +0 -1
- package/dist/utils/clipboard-image.d.ts.map +0 -1
- package/dist/utils/clipboard-image.js.map +0 -1
- package/dist/utils/clipboard-native.d.ts.map +0 -1
- package/dist/utils/clipboard-native.js.map +0 -1
- package/dist/utils/clipboard.d.ts.map +0 -1
- package/dist/utils/clipboard.js.map +0 -1
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js.map +0 -1
- package/dist/utils/exif-orientation.d.ts.map +0 -1
- package/dist/utils/exif-orientation.js.map +0 -1
- package/dist/utils/frontmatter.d.ts.map +0 -1
- package/dist/utils/frontmatter.js.map +0 -1
- package/dist/utils/fs-watch.d.ts.map +0 -1
- package/dist/utils/fs-watch.js.map +0 -1
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/html.d.ts.map +0 -1
- package/dist/utils/html.js.map +0 -1
- package/dist/utils/image-convert.d.ts.map +0 -1
- package/dist/utils/image-convert.js.map +0 -1
- package/dist/utils/image-process.d.ts.map +0 -1
- package/dist/utils/image-process.js.map +0 -1
- package/dist/utils/image-resize-core.d.ts.map +0 -1
- package/dist/utils/image-resize-core.js.map +0 -1
- package/dist/utils/image-resize-worker.d.ts.map +0 -1
- package/dist/utils/image-resize-worker.js.map +0 -1
- package/dist/utils/image-resize.d.ts.map +0 -1
- package/dist/utils/image-resize.js.map +0 -1
- package/dist/utils/json.d.ts.map +0 -1
- package/dist/utils/json.js.map +0 -1
- package/dist/utils/mime.d.ts.map +0 -1
- package/dist/utils/mime.js.map +0 -1
- package/dist/utils/open-browser.d.ts.map +0 -1
- package/dist/utils/open-browser.js.map +0 -1
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/photon.d.ts.map +0 -1
- package/dist/utils/photon.js.map +0 -1
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js.map +0 -1
- package/dist/utils/shell.d.ts.map +0 -1
- package/dist/utils/shell.js.map +0 -1
- package/dist/utils/sleep.d.ts.map +0 -1
- package/dist/utils/sleep.js.map +0 -1
- package/dist/utils/syntax-highlight.d.ts.map +0 -1
- package/dist/utils/syntax-highlight.js.map +0 -1
- package/dist/utils/thinking-tags.d.ts.map +0 -1
- package/dist/utils/thinking-tags.js.map +0 -1
- package/dist/utils/tools-manager.d.ts.map +0 -1
- package/dist/utils/tools-manager.js.map +0 -1
- package/dist/utils/version-check.d.ts.map +0 -1
- package/dist/utils/version-check.js.map +0 -1
- package/dist/utils/windows-self-update.d.ts.map +0 -1
- package/dist/utils/windows-self-update.js.map +0 -1
|
@@ -1,525 +1,488 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { randomUUID } from "node:crypto";
|
|
3
2
|
import * as fs from "node:fs";
|
|
4
3
|
import * as os from "node:os";
|
|
5
4
|
import * as path from "node:path";
|
|
6
|
-
import {
|
|
5
|
+
import { afterEach, describe, it } from "node:test";
|
|
6
|
+
import type { ExtensionContext } from "@selesai/code";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
ScheduledRunManager,
|
|
8
|
+
SCHEDULED_RUN_ACTIONS,
|
|
10
9
|
createScheduledRunManager,
|
|
11
10
|
isScheduledRunAction,
|
|
11
|
+
listScheduledRunSummaries,
|
|
12
|
+
parseScheduleInterval,
|
|
12
13
|
parseScheduledRunTime,
|
|
13
14
|
scheduledRunStorePath,
|
|
14
15
|
scheduledRunsEnabled,
|
|
16
|
+
type ScheduledRunManager,
|
|
15
17
|
} from "../../src/runs/background/scheduled-runs.ts";
|
|
16
18
|
import type { ExtensionConfig } from "../../src/shared/types.ts";
|
|
17
|
-
import { encodeSubagentCapabilityCeiling, resolveCurrentSubagentCapabilityCeiling } from "../../src/api/capability-ceiling.ts";
|
|
18
|
-
import type { ExtensionContext } from "@selesai/code";
|
|
19
|
-
|
|
20
|
-
type TimerHandle = number;
|
|
21
19
|
|
|
20
|
+
type Timer = { callback: () => void; delay: number };
|
|
22
21
|
class FakeTimers {
|
|
23
|
-
readonly
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return handle;
|
|
22
|
+
readonly values = new Map<number, Timer>();
|
|
23
|
+
private id = 0;
|
|
24
|
+
setTimeout = (callback: () => void, delay: number) => {
|
|
25
|
+
const id = ++this.id;
|
|
26
|
+
this.values.set(id, { callback, delay });
|
|
27
|
+
return id as unknown as ReturnType<typeof setTimeout>;
|
|
30
28
|
};
|
|
31
|
-
|
|
32
|
-
clearTimeout = (handle: TimerHandle): void => {
|
|
33
|
-
this.scheduled.delete(handle);
|
|
34
|
-
};
|
|
35
|
-
|
|
29
|
+
clearTimeout = (id: ReturnType<typeof setTimeout>) => void this.values.delete(id as unknown as number);
|
|
36
30
|
fireAll(): void {
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
pendingCount(): number {
|
|
43
|
-
return this.scheduled.size;
|
|
31
|
+
const pending = [...this.values.entries()];
|
|
32
|
+
for (const [id, timer] of pending) {
|
|
33
|
+
this.values.delete(id);
|
|
34
|
+
timer.callback();
|
|
35
|
+
}
|
|
44
36
|
}
|
|
45
37
|
}
|
|
46
38
|
|
|
47
|
-
type
|
|
39
|
+
type Launch = {
|
|
48
40
|
params: Record<string, unknown>;
|
|
49
41
|
ctx: ExtensionContext;
|
|
50
|
-
|
|
51
|
-
resolve: (result: { content: Array<{ type: "text"; text: string }>; details: Record<string, unknown>; isError?: boolean }) => void;
|
|
52
|
-
promise: Promise<{ content: Array<{ type: "text"; text: string }>; details: Record<string, unknown>; isError?: boolean }>;
|
|
42
|
+
resolve(result: { content: Array<{ type: "text"; text: string }>; details: Record<string, unknown>; isError?: boolean }): void;
|
|
53
43
|
};
|
|
54
44
|
|
|
55
|
-
type
|
|
45
|
+
type Harness = {
|
|
56
46
|
manager: ScheduledRunManager;
|
|
57
|
-
timers: FakeTimers;
|
|
58
|
-
launches: LaunchRecord[];
|
|
59
|
-
clock: { now: number };
|
|
60
|
-
storeRoot: string;
|
|
61
47
|
ctx: ExtensionContext;
|
|
48
|
+
clock: { now: number };
|
|
49
|
+
timers: FakeTimers;
|
|
50
|
+
launches: Launch[];
|
|
51
|
+
root: string;
|
|
62
52
|
};
|
|
63
53
|
|
|
64
|
-
|
|
54
|
+
const roots: string[] = [];
|
|
55
|
+
afterEach(() => {
|
|
56
|
+
for (const root of roots.splice(0)) fs.rmSync(root, { recursive: true, force: true });
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
function context(cwd: string, sessionId = "session-a"): ExtensionContext {
|
|
65
60
|
return {
|
|
66
61
|
cwd,
|
|
67
62
|
sessionManager: {
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
getSessionId: () => sessionId,
|
|
64
|
+
getSessionFile: () => path.join(cwd, `${sessionId}.jsonl`),
|
|
70
65
|
},
|
|
71
66
|
} as unknown as ExtensionContext;
|
|
72
67
|
}
|
|
73
68
|
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function createHarness(options: { config?: ExtensionConfig; storeRoot?: string; now?: number; resolveCapabilityCeiling?: (sessionId: string) => { version: 1; allowedTools?: string[]; denyExtensions: boolean; sources: string[] } | undefined } = {}): TestHarness {
|
|
69
|
+
function harness(options: { cwd?: string; sessionId?: string; now?: number; config?: ExtensionConfig } = {}): Harness {
|
|
70
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-schedule-test-"));
|
|
71
|
+
roots.push(root);
|
|
72
|
+
const project = options.cwd ?? path.join(root, "project");
|
|
73
|
+
fs.mkdirSync(project, { recursive: true });
|
|
74
|
+
const ctx = context(project, options.sessionId);
|
|
75
|
+
const clock = { now: options.now ?? Date.parse("2030-01-01T00:00:00Z") };
|
|
83
76
|
const timers = new FakeTimers();
|
|
84
|
-
const launches:
|
|
85
|
-
|
|
86
|
-
const storeRoot = options.storeRoot ?? fs.mkdtempSync(path.join(os.tmpdir(), "sched-test-"));
|
|
77
|
+
const launches: Launch[] = [];
|
|
78
|
+
let id = 0;
|
|
87
79
|
const manager = createScheduledRunManager({
|
|
88
|
-
config: options.config ??
|
|
89
|
-
storeRoot,
|
|
80
|
+
config: options.config ?? { scheduledRuns: { enabled: true } },
|
|
81
|
+
storeRoot: path.join(root, "stores"),
|
|
90
82
|
now: () => clock.now,
|
|
91
|
-
randomId: () =>
|
|
83
|
+
randomId: () => `id-${++id}`,
|
|
92
84
|
timers,
|
|
93
|
-
|
|
94
|
-
launch: (params, ctx, signal) => {
|
|
95
|
-
let resolve!: LaunchRecord["resolve"];
|
|
96
|
-
const promise = new Promise<{ content: Array<{ type: "text"; text: string }>; details: Record<string, unknown>; isError?: boolean }>((res) => {
|
|
97
|
-
resolve = res;
|
|
98
|
-
});
|
|
99
|
-
launches.push({ params: params as unknown as Record<string, unknown>, ctx, signal, resolve, promise });
|
|
100
|
-
return promise as ReturnType<TestHarness["manager"]["handleToolCall"]>;
|
|
101
|
-
},
|
|
85
|
+
launch: (params, launchCtx) => new Promise((resolve) => launches.push({ params: params as Record<string, unknown>, ctx: launchCtx, resolve: resolve as Launch["resolve"] })) as never,
|
|
102
86
|
});
|
|
103
|
-
|
|
104
|
-
return { manager,
|
|
87
|
+
manager.bindSession(ctx);
|
|
88
|
+
return { manager, ctx, clock, timers, launches, root };
|
|
105
89
|
}
|
|
106
90
|
|
|
107
|
-
function
|
|
108
|
-
|
|
109
|
-
const match = text.match(/Scheduled subagent run (id-[a-z0-9]+)/);
|
|
110
|
-
assert.ok(match, `expected scheduled run id in: ${text}`);
|
|
111
|
-
return match[1]!;
|
|
91
|
+
function text(result: Awaited<ReturnType<ScheduledRunManager["handleToolCall"]>>): string {
|
|
92
|
+
return result.content[0]?.type === "text" ? result.content[0].text : "";
|
|
112
93
|
}
|
|
113
94
|
|
|
114
|
-
function
|
|
115
|
-
|
|
95
|
+
async function flush(): Promise<void> {
|
|
96
|
+
for (let i = 0; i < 8; i++) await Promise.resolve();
|
|
116
97
|
}
|
|
117
98
|
|
|
118
|
-
describe("
|
|
119
|
-
it("
|
|
120
|
-
assert.
|
|
121
|
-
assert.equal(isScheduledRunAction("schedule
|
|
122
|
-
assert.equal(isScheduledRunAction("
|
|
123
|
-
assert.equal(isScheduledRunAction(undefined), false);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it("scheduledRunsEnabled is true only when explicitly enabled", () => {
|
|
127
|
-
assert.equal(scheduledRunsEnabled({}), false);
|
|
128
|
-
assert.equal(scheduledRunsEnabled({ scheduledRuns: {} }), false);
|
|
129
|
-
assert.equal(scheduledRunsEnabled({ scheduledRuns: { enabled: false } }), false);
|
|
130
|
-
assert.equal(scheduledRunsEnabled({ scheduledRuns: { enabled: true } }), true);
|
|
99
|
+
describe("schedule helpers", () => {
|
|
100
|
+
it("recognizes only the dot-action schedule API", () => {
|
|
101
|
+
assert.deepEqual(SCHEDULED_RUN_ACTIONS, ["schedule.create", "schedule.list", "schedule.show", "schedule.history", "schedule.pause", "schedule.resume", "schedule.run", "schedule.run-due", "schedule.delete"]);
|
|
102
|
+
assert.equal(isScheduledRunAction("schedule.create"), true);
|
|
103
|
+
assert.equal(isScheduledRunAction("schedule"), false);
|
|
131
104
|
});
|
|
132
105
|
|
|
133
|
-
it("
|
|
134
|
-
const root = path.join("tmp", "
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const aAgain = scheduledRunStorePath(project, "sess1", root);
|
|
139
|
-
const b = scheduledRunStorePath(project, "sess2", root);
|
|
140
|
-
const c = scheduledRunStorePath(other, "sess1", root);
|
|
141
|
-
assert.equal(a, aAgain);
|
|
142
|
-
assert.notEqual(a, b);
|
|
143
|
-
assert.notEqual(a, c);
|
|
144
|
-
assert.ok(a.startsWith(root));
|
|
145
|
-
assert.ok(a.endsWith(".json"));
|
|
106
|
+
it("uses a stable project store independent of session id", () => {
|
|
107
|
+
const root = path.join("tmp", "schedules");
|
|
108
|
+
assert.equal(scheduledRunStorePath("project", "a", root), scheduledRunStorePath("project", "b", root));
|
|
109
|
+
assert.notEqual(scheduledRunStorePath("project", "a", root), scheduledRunStorePath("other", "a", root));
|
|
110
|
+
assert.equal(scheduledRunStorePath("/project"), path.join(path.resolve("/project"), ".pi-subagents", "schedules"));
|
|
146
111
|
});
|
|
147
112
|
|
|
148
|
-
it("
|
|
149
|
-
const
|
|
150
|
-
assert.equal(parseScheduledRunTime("+10m",
|
|
151
|
-
assert.equal(parseScheduledRunTime("
|
|
152
|
-
assert.equal(parseScheduledRunTime("+
|
|
153
|
-
assert.equal(
|
|
154
|
-
assert.equal(
|
|
155
|
-
assert.
|
|
113
|
+
it("parses one-shot and fixed interval forms strictly", () => {
|
|
114
|
+
const now = Date.parse("2030-01-01T00:00:00Z");
|
|
115
|
+
assert.equal(parseScheduledRunTime("+10m", now), now + 600_000);
|
|
116
|
+
assert.equal(parseScheduledRunTime("2030-01-02T00:00:00Z", now), now + 86_400_000);
|
|
117
|
+
assert.equal(parseScheduledRunTime("2030-01-02T09:00:00+05:30", now), Date.parse("2030-01-02T09:00:00+05:30"));
|
|
118
|
+
assert.equal(parseScheduleInterval("30m"), 1_800_000);
|
|
119
|
+
assert.equal(parseScheduleInterval("2w"), 1_209_600_000);
|
|
120
|
+
assert.throws(() => parseScheduleInterval("day"), /fixed intervals/);
|
|
121
|
+
assert.throws(() => parseScheduledRunTime("2030-01-01T00:00:00", now), /timezone/);
|
|
156
122
|
});
|
|
157
123
|
|
|
158
|
-
it("
|
|
159
|
-
assert.
|
|
160
|
-
assert.
|
|
161
|
-
assert.throws(() => parseScheduledRunTime("2020-01-01T00:00:00Z", Date.now() + 60_000), /in the past/);
|
|
162
|
-
assert.throws(() => parseScheduledRunTime("2030-01-01T00:00:00", 1_000_000), /must include a timezone/);
|
|
163
|
-
assert.throws(() => parseScheduledRunTime("2030-02-30T00:00:00Z", 1_000_000), /valid future ISO/);
|
|
164
|
-
assert.throws(() => parseScheduledRunTime("next tuesday", 1_000_000), /Invalid schedule/);
|
|
165
|
-
assert.throws(() => parseScheduledRunTime("+5w", 1_000_000), /Invalid schedule/);
|
|
124
|
+
it("honors the explicit feature opt-out", () => {
|
|
125
|
+
assert.equal(scheduledRunsEnabled({}), true);
|
|
126
|
+
assert.equal(scheduledRunsEnabled({ scheduledRuns: { enabled: false } }), false);
|
|
166
127
|
});
|
|
167
128
|
});
|
|
168
129
|
|
|
169
|
-
describe("
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
assert.equal(
|
|
191
|
-
|
|
192
|
-
assert.
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it("rejects capability-ceiling-restricted schedules instead of persisting policy-less jobs", async () => {
|
|
196
|
-
const harness = createHarness({ resolveCapabilityCeiling: () => ({ version: 1, allowedTools: ["read"], denyExtensions: true, sources: ["plan"] }) });
|
|
197
|
-
const result = await harness.manager.handleToolCall({ action: "schedule", agent: "worker", task: "review", schedule: "+10m" }, harness.ctx);
|
|
198
|
-
assert.equal(isError(result), true);
|
|
199
|
-
assert.match(result.content[0]!.text, /does not yet persist ceilings/);
|
|
200
|
-
assert.equal(harness.launches.length, 0);
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
it("rejects schedules restricted only by inherited process policy", async () => {
|
|
205
|
-
const previous = process.env.SELESAI_SUBAGENT_CAPABILITY_CEILING_V1;
|
|
206
|
-
try {
|
|
207
|
-
process.env.SELESAI_SUBAGENT_CAPABILITY_CEILING_V1 = encodeSubagentCapabilityCeiling({ version: 1, allowedTools: ["read"], denyExtensions: true, sources: ["ancestor"] });
|
|
208
|
-
const harness = createHarness({ resolveCapabilityCeiling: resolveCurrentSubagentCapabilityCeiling });
|
|
209
|
-
const result = await harness.manager.handleToolCall({ action: "schedule", agent: "worker", task: "review", schedule: "+10m" }, harness.ctx);
|
|
210
|
-
assert.equal(isError(result), true);
|
|
211
|
-
assert.match(result.content[0]!.text, /does not yet persist ceilings/);
|
|
212
|
-
assert.equal(harness.launches.length, 0);
|
|
213
|
-
} finally {
|
|
214
|
-
if (previous === undefined) delete process.env.SELESAI_SUBAGENT_CAPABILITY_CEILING_V1;
|
|
215
|
-
else process.env.SELESAI_SUBAGENT_CAPABILITY_CEILING_V1 = previous;
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it("creates a scheduled job and arms a timer", async () => {
|
|
220
|
-
const harness = freshHarness();
|
|
221
|
-
const result = await harness.manager.handleToolCall({ action: "schedule", agent: "scout", task: "review later", schedule: "+10m", scheduleName: "nightly review" }, harness.ctx);
|
|
222
|
-
assert.equal(isError(result), false);
|
|
223
|
-
assert.match(result.content[0]!.text, /Scheduled subagent run id-/);
|
|
224
|
-
assert.match(result.content[0]!.text, /nightly review/);
|
|
225
|
-
assert.equal(harness.timers.pendingCount(), 1);
|
|
226
|
-
const list = await harness.manager.handleToolCall({ action: "schedule-list" }, harness.ctx);
|
|
227
|
-
assert.match(list.content[0]!.text, /nightly review/);
|
|
130
|
+
describe("project schedule management", () => {
|
|
131
|
+
it("creates a project one-shot schedule and restores it in another session", async () => {
|
|
132
|
+
const first = harness();
|
|
133
|
+
const result = await first.manager.handleToolCall({ action: "schedule.create", id: "night-review", name: "Night review", at: "+10m", agent: "commentator", task: "Review the diff" }, first.ctx);
|
|
134
|
+
assert.equal(result.isError, undefined);
|
|
135
|
+
assert.match(text(result), /Created schedule night-review/);
|
|
136
|
+
assert.equal(first.timers.values.size, 1);
|
|
137
|
+
const records = listScheduledRunSummaries(first.ctx.cwd, path.join(first.root, "stores"));
|
|
138
|
+
assert.equal(records[0]?.name, "Night review");
|
|
139
|
+
assert.equal(records[0]?.cwd, first.ctx.cwd);
|
|
140
|
+
|
|
141
|
+
first.manager.stop();
|
|
142
|
+
const secondTimers = new FakeTimers();
|
|
143
|
+
const second = createScheduledRunManager({
|
|
144
|
+
config: { scheduledRuns: { enabled: true } },
|
|
145
|
+
storeRoot: path.join(first.root, "stores"),
|
|
146
|
+
now: () => first.clock.now,
|
|
147
|
+
timers: secondTimers,
|
|
148
|
+
launch: async () => ({ content: [{ type: "text", text: "unused" }], details: { mode: "management", results: [] } }),
|
|
149
|
+
});
|
|
150
|
+
second.bindSession(context(first.ctx.cwd, "session-b"));
|
|
151
|
+
assert.equal(secondTimers.values.size, 1, "a different session restores the project schedule");
|
|
152
|
+
const shown = await second.handleToolCall({ action: "schedule.show", id: "night-review" }, context(first.ctx.cwd, "session-b"));
|
|
153
|
+
assert.match(text(shown), /Night review/);
|
|
228
154
|
});
|
|
229
155
|
|
|
230
|
-
it("
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
assert.
|
|
156
|
+
it("stores explicit cwd schedules in the target project", async () => {
|
|
157
|
+
const h = harness();
|
|
158
|
+
const target = path.join(h.root, "other-project");
|
|
159
|
+
fs.mkdirSync(target);
|
|
160
|
+
h.manager.bindSession(context(target, "target-session"));
|
|
161
|
+
h.manager.bindSession(h.ctx);
|
|
162
|
+
await h.manager.handleToolCall({ action: "schedule.create", id: "other", cwd: target, every: "1h", agent: "builder" }, h.ctx);
|
|
163
|
+
assert.equal(listScheduledRunSummaries(h.ctx.cwd, path.join(h.root, "stores")).length, 0);
|
|
164
|
+
assert.equal(listScheduledRunSummaries(target, path.join(h.root, "stores"))[0]?.cwd, target);
|
|
165
|
+
const listed = await h.manager.handleToolCall({ action: "schedule.list", cwd: target }, h.ctx);
|
|
166
|
+
assert.match(text(listed), /other/);
|
|
238
167
|
});
|
|
239
168
|
|
|
240
|
-
it("
|
|
241
|
-
const
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
{
|
|
247
|
-
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
assert.equal(isError
|
|
256
|
-
assert.match(result.content[0]!.text, /achieved status.*omit acceptance.*acceptance\.review\.required/i);
|
|
169
|
+
it("supports workflowScript targets and rejects unsafe or deferred shapes", async () => {
|
|
170
|
+
const h = harness();
|
|
171
|
+
const workflow = await h.manager.handleToolCall({ action: "schedule.create", id: "workflow", every: "6h", workflowScript: "return await runs.run('review', {agent:'commentator'})" }, h.ctx);
|
|
172
|
+
assert.equal(workflow.isError, undefined);
|
|
173
|
+
assert.match(text(workflow), /workflowScript/);
|
|
174
|
+
for (const params of [
|
|
175
|
+
{ action: "schedule.create", id: "../escape", every: "1h", agent: "builder" },
|
|
176
|
+
{ action: "schedule.create", id: "both", at: "+1h", every: "1h", agent: "builder" },
|
|
177
|
+
{ action: "schedule.create", id: "calendar", every: "day", at: "09:00", timezone: "UTC", agent: "builder" },
|
|
178
|
+
{ action: "schedule.create", id: "two-targets", every: "1h", agent: "builder", workflowScript: "return 1" },
|
|
179
|
+
{ action: "schedule.create", id: "fork", every: "1h", agent: "builder", context: "fork" },
|
|
180
|
+
{ action: "schedule.create", id: "mission-id", every: "1h", agent: "builder", missionId: "mission-1" },
|
|
181
|
+
{ action: "schedule.create", id: "mission-off", every: "1h", agent: "builder", mission: false },
|
|
182
|
+
] as const) {
|
|
183
|
+
const result = await h.manager.handleToolCall(params, h.ctx);
|
|
184
|
+
assert.equal(result.isError, true, JSON.stringify(params));
|
|
257
185
|
}
|
|
258
|
-
assert.equal(harness.timers.pendingCount(), 0);
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
it("requires a schedule and rejects fork/async-false/clarify-true", async () => {
|
|
262
|
-
const harness = freshHarness();
|
|
263
|
-
const noSchedule = await harness.manager.handleToolCall({ action: "schedule", agent: "scout", task: "x" }, harness.ctx);
|
|
264
|
-
assert.match(noSchedule.content[0]!.text, /requires schedule/);
|
|
265
|
-
const fork = await harness.manager.handleToolCall({ action: "schedule", agent: "scout", task: "x", schedule: "+10m", context: "fork" }, harness.ctx);
|
|
266
|
-
assert.match(fork.content[0]!.text, /fresh context/);
|
|
267
|
-
const sync = await harness.manager.handleToolCall({ action: "schedule", agent: "scout", task: "x", schedule: "+10m", async: false }, harness.ctx);
|
|
268
|
-
assert.match(sync.content[0]!.text, /always async/);
|
|
269
|
-
const clarify = await harness.manager.handleToolCall({ action: "schedule", agent: "scout", task: "x", schedule: "+10m", clarify: true }, harness.ctx);
|
|
270
|
-
assert.match(clarify.content[0]!.text, /clarify/);
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
it("rejects a past schedule time", async () => {
|
|
274
|
-
const harness = freshHarness({ now: Date.now() + 60_000 });
|
|
275
|
-
const result = await harness.manager.handleToolCall({ action: "schedule", agent: "scout", task: "x", schedule: "2020-01-01T00:00:00Z" }, harness.ctx);
|
|
276
|
-
assert.match(result.content[0]!.text, /in the past/);
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
it("enforces maxPending", async () => {
|
|
280
|
-
const harness = freshHarness({ config: makeConfig({ maxPending: 1 }) });
|
|
281
|
-
const first = await harness.manager.handleToolCall({ action: "schedule", agent: "scout", task: "x", schedule: "+10m" }, harness.ctx);
|
|
282
|
-
assert.equal(isError(first), false);
|
|
283
|
-
const second = await harness.manager.handleToolCall({ action: "schedule", agent: "scout", task: "y", schedule: "+20m" }, harness.ctx);
|
|
284
|
-
assert.match(second.content[0]!.text, /limit reached/);
|
|
285
186
|
});
|
|
286
187
|
|
|
287
|
-
it("
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
assert.
|
|
293
|
-
assert.match(
|
|
294
|
-
|
|
295
|
-
assert.match(
|
|
296
|
-
|
|
297
|
-
assert.match(missing.content[0]!.text, /not found/);
|
|
298
|
-
const noId = await harness.manager.handleToolCall({ action: "schedule-status" }, harness.ctx);
|
|
299
|
-
assert.match(noId.content[0]!.text, /requires id/);
|
|
188
|
+
it("pauses, resumes, lists, and deletes an inactive schedule", async () => {
|
|
189
|
+
const h = harness();
|
|
190
|
+
await h.manager.handleToolCall({ action: "schedule.create", id: "maintenance", every: "1h", agent: "builder" }, h.ctx);
|
|
191
|
+
assert.match(text(await h.manager.handleToolCall({ action: "schedule.list" }, h.ctx)), /maintenance/);
|
|
192
|
+
assert.match(text(await h.manager.handleToolCall({ action: "schedule.pause", id: "maintenance" }, h.ctx)), /Paused/);
|
|
193
|
+
assert.equal(h.timers.values.size, 0);
|
|
194
|
+
assert.match(text(await h.manager.handleToolCall({ action: "schedule.resume", id: "maintenance" }, h.ctx)), /Resumed/);
|
|
195
|
+
assert.equal(h.timers.values.size, 1);
|
|
196
|
+
assert.match(text(await h.manager.handleToolCall({ action: "schedule.delete", id: "maintenance" }, h.ctx)), /Deleted/);
|
|
197
|
+
assert.match(text(await h.manager.handleToolCall({ action: "schedule.list" }, h.ctx)), /No project schedules/);
|
|
300
198
|
});
|
|
301
199
|
|
|
302
|
-
it("
|
|
303
|
-
const
|
|
304
|
-
const
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
assert.equal(
|
|
310
|
-
|
|
311
|
-
assert.match(status.content[0]!.text, /State: canceled/);
|
|
200
|
+
it("reports corrupt project schedule records instead of dropping them", async () => {
|
|
201
|
+
const h = harness();
|
|
202
|
+
const root = scheduledRunStorePath(h.ctx.cwd, undefined, path.join(h.root, "stores"));
|
|
203
|
+
const dir = path.join(root, "broken");
|
|
204
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
205
|
+
fs.writeFileSync(path.join(dir, "schedule.json"), "{ bad", "utf-8");
|
|
206
|
+
const result = await h.manager.handleToolCall({ action: "schedule.list" }, h.ctx);
|
|
207
|
+
assert.equal(result.isError, true);
|
|
208
|
+
assert.match(text(result), /Failed to read schedule record/);
|
|
312
209
|
});
|
|
313
210
|
|
|
314
|
-
it("
|
|
315
|
-
const
|
|
316
|
-
const
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
211
|
+
it("rejects schedule directories that escape through a symlink", async () => {
|
|
212
|
+
const h = harness();
|
|
213
|
+
const root = scheduledRunStorePath(h.ctx.cwd, undefined, path.join(h.root, "stores"));
|
|
214
|
+
const outside = path.join(h.root, "outside");
|
|
215
|
+
fs.mkdirSync(root, { recursive: true });
|
|
216
|
+
fs.mkdirSync(outside);
|
|
217
|
+
fs.symlinkSync(outside, path.join(root, "escaped"), process.platform === "win32" ? "junction" : "dir");
|
|
218
|
+
const result = await h.manager.handleToolCall({ action: "schedule.create", id: "escaped", every: "1h", agent: "builder" }, h.ctx);
|
|
219
|
+
assert.equal(result.isError, true);
|
|
220
|
+
assert.match(text(result), /must be a real directory/);
|
|
221
|
+
assert.equal(fs.existsSync(path.join(outside, "schedule.json")), false);
|
|
321
222
|
});
|
|
322
223
|
|
|
323
|
-
it("
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
fs.
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
224
|
+
it("rejects a default project schedule root that escapes through .pi-subagents", async () => {
|
|
225
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-schedule-root-link-"));
|
|
226
|
+
roots.push(root);
|
|
227
|
+
const project = path.join(root, "project");
|
|
228
|
+
const outside = path.join(root, "outside");
|
|
229
|
+
fs.mkdirSync(project);
|
|
230
|
+
fs.mkdirSync(outside);
|
|
231
|
+
const ctx = context(project);
|
|
232
|
+
const manager = createScheduledRunManager({
|
|
233
|
+
config: { scheduledRuns: { enabled: true } },
|
|
234
|
+
launch: async () => ({ content: [{ type: "text", text: "unused" }], details: { mode: "management", results: [] } }),
|
|
235
|
+
});
|
|
236
|
+
manager.bindSession(ctx);
|
|
237
|
+
fs.symlinkSync(outside, path.join(project, ".pi-subagents"), process.platform === "win32" ? "junction" : "dir");
|
|
333
238
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
fs.mkdirSync(path.dirname(storePath), { recursive: true });
|
|
339
|
-
fs.writeFileSync(storePath, "{ not-json", "utf-8");
|
|
340
|
-
const result = await harness.manager.handleToolCall({ action: "schedule-list" }, harness.ctx);
|
|
341
|
-
assert.equal(isError(result), true);
|
|
342
|
-
assert.match(result.content[0]!.text, /Failed to parse scheduled subagent store/);
|
|
343
|
-
assert.match(result.content[0]!.text, /JSON/);
|
|
239
|
+
const result = await manager.handleToolCall({ action: "schedule.create", id: "escaped-root", every: "1h", agent: "builder" }, ctx);
|
|
240
|
+
assert.equal(result.isError, true);
|
|
241
|
+
assert.match(text(result), /resolves outside the real project/);
|
|
242
|
+
assert.equal(fs.existsSync(path.join(outside, "schedules")), false);
|
|
344
243
|
});
|
|
345
244
|
});
|
|
346
245
|
|
|
347
|
-
describe("
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
246
|
+
describe("recurring schedule execution", () => {
|
|
247
|
+
it("launches a fixed interval from its planned time and records durable history/events", async () => {
|
|
248
|
+
const h = harness();
|
|
249
|
+
await h.manager.handleToolCall({ action: "schedule.create", id: "hourly", every: "1h", agent: "builder", task: "Maintain backlog" }, h.ctx);
|
|
250
|
+
h.clock.now += 3_600_000;
|
|
251
|
+
h.timers.fireAll();
|
|
252
|
+
assert.equal(h.launches.length, 1);
|
|
253
|
+
assert.deepEqual(h.launches[0]?.params, { agent: "builder", task: "Maintain backlog", async: true, clarify: false, context: "fresh", cwd: h.ctx.cwd, mission: false });
|
|
254
|
+
h.launches[0]!.resolve({ content: [{ type: "text", text: "Async builder" }], details: { mode: "single", results: [], asyncId: "async-1", asyncDir: "/tmp/async-1" } });
|
|
255
|
+
await flush();
|
|
256
|
+
|
|
257
|
+
let history = await h.manager.handleToolCall({ action: "schedule.history", id: "hourly" }, h.ctx);
|
|
258
|
+
assert.match(text(history), /running.*async async-1/);
|
|
259
|
+
const scheduleRoot = scheduledRunStorePath(h.ctx.cwd, undefined, path.join(h.root, "stores"));
|
|
260
|
+
const dir = path.join(scheduleRoot, "hourly");
|
|
261
|
+
assert.equal(fs.existsSync(path.join(dir, "history.json")), true);
|
|
262
|
+
assert.equal(fs.existsSync(path.join(dir, "events.jsonl")), true);
|
|
263
|
+
assert.equal(fs.readdirSync(path.join(dir, "runs")).length, 1);
|
|
264
|
+
|
|
265
|
+
h.manager.handleAsyncCompletion({ runId: "async-1", success: true, summary: "Done" });
|
|
266
|
+
history = await h.manager.handleToolCall({ action: "schedule.history", id: "hourly" }, h.ctx);
|
|
267
|
+
assert.match(text(history), /completed.*async async-1/);
|
|
268
|
+
assert.equal(fs.existsSync(path.join(dir, "active.lock")), false);
|
|
269
|
+
const shown = await h.manager.handleToolCall({ action: "schedule.show", id: "hourly" }, h.ctx);
|
|
270
|
+
assert.match(text(shown), /2030-01-01T02:00:00.000Z/, "next occurrence advances from the planned time without completion drift");
|
|
357
271
|
});
|
|
358
272
|
|
|
359
|
-
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
assert.
|
|
378
|
-
assert.equal(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
launch.resolve({
|
|
382
|
-
content: [{ type: "text", text: "Async: scout [run-xyz]" }],
|
|
383
|
-
details: { mode: "single", runId: "run-xyz", asyncId: "run-xyz", asyncDir: "/tmp/async-xyz", results: [] },
|
|
384
|
-
});
|
|
385
|
-
await flushMicrotasks();
|
|
273
|
+
it("run-due launches the latest missed occurrence while catchUp none records a miss", async () => {
|
|
274
|
+
const latest = harness();
|
|
275
|
+
await latest.manager.handleToolCall({ action: "schedule.create", id: "latest", every: "1h", catchUp: "latest", agent: "builder" }, latest.ctx);
|
|
276
|
+
latest.manager.stop();
|
|
277
|
+
latest.clock.now += 3 * 3_600_000;
|
|
278
|
+
latest.manager.bindSession(latest.ctx);
|
|
279
|
+
const duePromise = latest.manager.handleToolCall({ action: "schedule.run-due" }, latest.ctx);
|
|
280
|
+
await flush();
|
|
281
|
+
assert.equal(latest.launches.length, 1);
|
|
282
|
+
latest.launches[0]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "single", results: [], asyncId: "late-1" } });
|
|
283
|
+
assert.match(text(await duePromise), /Processed 1 due schedule/);
|
|
284
|
+
assert.match(text(await latest.manager.handleToolCall({ action: "schedule.history", id: "latest" }, latest.ctx)), /2030-01-01T03:00:00.000Z/, "latest catch-up selects the latest missed slot");
|
|
285
|
+
|
|
286
|
+
const none = harness();
|
|
287
|
+
await none.manager.handleToolCall({ action: "schedule.create", id: "none", every: "1h", catchUp: "none", agent: "builder" }, none.ctx);
|
|
288
|
+
none.manager.stop();
|
|
289
|
+
none.clock.now += 3 * 3_600_000;
|
|
290
|
+
none.manager.bindSession(none.ctx);
|
|
291
|
+
assert.match(text(await none.manager.handleToolCall({ action: "schedule.history", id: "none" }, none.ctx)), /missed/);
|
|
292
|
+
assert.equal(none.launches.length, 0);
|
|
293
|
+
});
|
|
386
294
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
295
|
+
it("keeps project timers, contexts, and completion ownership across session_start bindings", async () => {
|
|
296
|
+
const h = harness();
|
|
297
|
+
await h.manager.handleToolCall({ action: "schedule.create", id: "project-a", every: "1h", agent: "builder" }, h.ctx);
|
|
298
|
+
|
|
299
|
+
const projectB = path.join(h.root, "project-b");
|
|
300
|
+
fs.mkdirSync(projectB);
|
|
301
|
+
const projectBCtx = context(projectB, "session-b");
|
|
302
|
+
const sourceSessionManager = h.ctx.sessionManager as { getSessionId(): string | null; getSessionFile(): string | null };
|
|
303
|
+
const getSourceSessionId = sourceSessionManager.getSessionId;
|
|
304
|
+
const getSourceSessionFile = sourceSessionManager.getSessionFile;
|
|
305
|
+
sourceSessionManager.getSessionId = () => "session-b";
|
|
306
|
+
sourceSessionManager.getSessionFile = () => path.join(projectB, "session-b.jsonl");
|
|
307
|
+
h.manager.bindSession(projectBCtx);
|
|
308
|
+
await h.manager.handleToolCall({ action: "schedule.create", id: "project-b", every: "1h", agent: "builder" }, projectBCtx);
|
|
309
|
+
assert.equal(h.timers.values.size, 2, "both project timers remain armed after session_start binds project B");
|
|
310
|
+
|
|
311
|
+
h.clock.now += 3_600_000;
|
|
312
|
+
h.timers.fireAll();
|
|
313
|
+
await flush();
|
|
314
|
+
assert.equal(h.launches.length, 2);
|
|
315
|
+
assert.equal(h.launches[0]!.ctx.cwd, h.ctx.cwd);
|
|
316
|
+
assert.equal(h.launches[0]!.ctx.sessionManager.getSessionId(), "session-a");
|
|
317
|
+
assert.equal(h.launches[0]!.ctx.sessionManager.getSessionFile(), path.join(h.ctx.cwd, "session-a.jsonl"));
|
|
318
|
+
assert.equal(h.launches[1]!.ctx.cwd, projectB);
|
|
319
|
+
assert.equal(h.launches[1]!.ctx.sessionManager.getSessionId(), "session-b");
|
|
320
|
+
assert.equal(h.launches[1]!.ctx.sessionManager.getSessionFile(), path.join(projectB, "session-b.jsonl"));
|
|
321
|
+
sourceSessionManager.getSessionId = getSourceSessionId;
|
|
322
|
+
sourceSessionManager.getSessionFile = getSourceSessionFile;
|
|
323
|
+
h.launches[0]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "single", results: [], asyncId: "async-a" } });
|
|
324
|
+
h.launches[1]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "single", results: [], asyncId: "async-b" } });
|
|
325
|
+
await flush();
|
|
326
|
+
|
|
327
|
+
h.manager.handleAsyncCompletion({ runId: "async-a", success: true });
|
|
328
|
+
const history = await h.manager.handleToolCall({ action: "schedule.history", id: "project-a" }, h.ctx);
|
|
329
|
+
assert.match(text(history), /completed.*async async-a/);
|
|
330
|
+
const projectARoot = scheduledRunStorePath(h.ctx.cwd, undefined, path.join(h.root, "stores"));
|
|
331
|
+
assert.equal(fs.existsSync(path.join(projectARoot, "project-a", "active.lock")), false);
|
|
391
332
|
});
|
|
392
333
|
|
|
393
|
-
it("
|
|
394
|
-
const
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
assert.
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
assert.
|
|
334
|
+
it("uses only a bound target session for an explicit cross-project cwd", async () => {
|
|
335
|
+
const h = harness();
|
|
336
|
+
const target = path.join(h.root, "explicit-target");
|
|
337
|
+
fs.mkdirSync(target);
|
|
338
|
+
const unbound = await h.manager.handleToolCall({ action: "schedule.create", id: "targeted", cwd: target, every: "1h", agent: "builder" }, h.ctx);
|
|
339
|
+
assert.equal(unbound.isError, true);
|
|
340
|
+
assert.match(text(unbound), /until that project has been opened/);
|
|
341
|
+
|
|
342
|
+
const targetCtx = context(target, "target-session");
|
|
343
|
+
h.manager.bindSession(targetCtx);
|
|
344
|
+
h.manager.bindSession(h.ctx);
|
|
345
|
+
await h.manager.handleToolCall({ action: "schedule.create", id: "targeted", cwd: target, every: "1h", agent: "builder" }, h.ctx);
|
|
346
|
+
h.clock.now += 3_600_000;
|
|
347
|
+
h.timers.fireAll();
|
|
348
|
+
await flush();
|
|
349
|
+
assert.equal(h.launches.length, 1);
|
|
350
|
+
assert.equal(h.launches[0]!.ctx.cwd, target);
|
|
351
|
+
assert.equal(h.launches[0]!.ctx.sessionManager.getSessionId(), "target-session");
|
|
352
|
+
assert.equal(h.launches[0]!.ctx.sessionManager.getSessionFile(), path.join(target, "target-session.jsonl"));
|
|
353
|
+
assert.equal(h.launches[0]!.params.cwd, target);
|
|
354
|
+
h.launches[0]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "single", results: [], asyncId: "target-async" } });
|
|
355
|
+
await flush();
|
|
409
356
|
});
|
|
410
357
|
|
|
411
|
-
it("
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
|
|
358
|
+
it("reconciles owner completion after an unrelated store becomes malformed", async () => {
|
|
359
|
+
const h = harness();
|
|
360
|
+
const badProject = path.join(h.root, "bad-project");
|
|
361
|
+
fs.mkdirSync(badProject);
|
|
362
|
+
const badCtx = context(badProject, "bad-session");
|
|
363
|
+
const ownerCtx = context(h.ctx.cwd, "owner-session");
|
|
415
364
|
const timers = new FakeTimers();
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
365
|
+
const launches: Launch[] = [];
|
|
366
|
+
let id = 0;
|
|
367
|
+
const manager = createScheduledRunManager({
|
|
368
|
+
config: { scheduledRuns: { enabled: true } },
|
|
369
|
+
storeRoot: path.join(h.root, "isolated-stores"),
|
|
370
|
+
now: () => h.clock.now,
|
|
371
|
+
randomId: () => `isolated-${++id}`,
|
|
422
372
|
timers,
|
|
423
|
-
launch: () => Promise.
|
|
373
|
+
launch: (params, launchCtx) => new Promise((resolve) => launches.push({ params: params as Record<string, unknown>, ctx: launchCtx, resolve: resolve as Launch["resolve"] })) as never,
|
|
424
374
|
});
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
375
|
+
manager.bindSession(badCtx);
|
|
376
|
+
manager.bindSession(ownerCtx);
|
|
377
|
+
await manager.handleToolCall({ action: "schedule.create", id: "owner", every: "1h", agent: "builder" }, ownerCtx);
|
|
378
|
+
const manual = manager.handleToolCall({ action: "schedule.run", id: "owner" }, ownerCtx);
|
|
379
|
+
await flush();
|
|
380
|
+
launches[0]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "single", results: [], asyncId: "owner-async" } });
|
|
381
|
+
await manual;
|
|
382
|
+
|
|
383
|
+
const badDir = path.join(scheduledRunStorePath(badProject, undefined, path.join(h.root, "isolated-stores")), "broken");
|
|
384
|
+
fs.mkdirSync(badDir, { recursive: true });
|
|
385
|
+
fs.writeFileSync(path.join(badDir, "schedule.json"), "{ bad", "utf-8");
|
|
386
|
+
const ownerRoot = scheduledRunStorePath(ownerCtx.cwd, undefined, path.join(h.root, "isolated-stores"));
|
|
387
|
+
const badSiblingDir = path.join(ownerRoot, "broken-sibling");
|
|
388
|
+
fs.mkdirSync(badSiblingDir, { recursive: true });
|
|
389
|
+
fs.writeFileSync(path.join(badSiblingDir, "schedule.json"), "{ bad", "utf-8");
|
|
390
|
+
const originalError = console.error;
|
|
391
|
+
console.error = () => {};
|
|
392
|
+
try {
|
|
393
|
+
manager.handleAsyncCompletion({ runId: "owner-async", success: true });
|
|
394
|
+
} finally {
|
|
395
|
+
console.error = originalError;
|
|
396
|
+
}
|
|
397
|
+
const history = await manager.handleToolCall({ action: "schedule.history", id: "owner" }, ownerCtx);
|
|
398
|
+
assert.match(text(history), /completed.*async owner-async/);
|
|
399
|
+
assert.equal(fs.existsSync(path.join(ownerRoot, "owner", "active.lock")), false);
|
|
434
400
|
});
|
|
435
401
|
|
|
436
|
-
it("
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
402
|
+
it("reconciles a terminal async status after a new session binds", async () => {
|
|
403
|
+
const h = harness();
|
|
404
|
+
await h.manager.handleToolCall({ action: "schedule.create", id: "restart", every: "1h", agent: "builder" }, h.ctx);
|
|
405
|
+
h.clock.now += 3_600_000;
|
|
406
|
+
h.timers.fireAll();
|
|
407
|
+
const asyncDir = path.join(h.root, "async-restart");
|
|
408
|
+
fs.mkdirSync(asyncDir);
|
|
409
|
+
h.launches[0]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "single", results: [], asyncId: "async-restart", asyncDir } });
|
|
410
|
+
await flush();
|
|
411
|
+
h.manager.stop();
|
|
412
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify({ runId: "async-restart", mode: "single", state: "complete", startedAt: h.clock.now, endedAt: h.clock.now }), "utf-8");
|
|
413
|
+
|
|
414
|
+
const next = createScheduledRunManager({
|
|
415
|
+
config: { scheduledRuns: { enabled: true } },
|
|
416
|
+
storeRoot: path.join(h.root, "stores"),
|
|
417
|
+
now: () => h.clock.now,
|
|
418
|
+
randomId: () => "reconciled-id",
|
|
419
|
+
timers: new FakeTimers(),
|
|
420
|
+
launch: async () => ({ content: [{ type: "text", text: "unused" }], details: { mode: "management", results: [] } }),
|
|
451
421
|
});
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
it("cancel before fire prevents the launch", async () => {
|
|
458
|
-
const harness = freshHarness();
|
|
459
|
-
const created = await harness.manager.handleToolCall({ action: "schedule", agent: "scout", task: "x", schedule: "+10m" }, harness.ctx);
|
|
460
|
-
const id = extractId(created);
|
|
461
|
-
await harness.manager.handleToolCall({ action: "schedule-cancel", id }, harness.ctx);
|
|
462
|
-
harness.timers.fireAll();
|
|
463
|
-
assert.equal(harness.launches.length, 0, "a canceled job must not launch");
|
|
422
|
+
const nextCtx = context(h.ctx.cwd, "session-b");
|
|
423
|
+
next.bindSession(nextCtx);
|
|
424
|
+
const history = await next.handleToolCall({ action: "schedule.history", id: "restart" }, nextCtx);
|
|
425
|
+
assert.match(text(history), /completed.*async async-restart/);
|
|
464
426
|
});
|
|
465
|
-
});
|
|
466
427
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
428
|
+
it("records elapsed overlap and catch-up-none slots without an immediate rerun", async () => {
|
|
429
|
+
const latest = harness();
|
|
430
|
+
await latest.manager.handleToolCall({ action: "schedule.create", id: "overlap", every: "1h", catchUp: "latest", agent: "builder" }, latest.ctx);
|
|
431
|
+
latest.clock.now += 3_600_000;
|
|
432
|
+
latest.timers.fireAll();
|
|
433
|
+
latest.launches[0]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "single", results: [], asyncId: "long-run" } });
|
|
434
|
+
await flush();
|
|
435
|
+
latest.clock.now += 3 * 3_600_000;
|
|
436
|
+
latest.timers.fireAll();
|
|
437
|
+
assert.equal(latest.launches.length, 1, "an overlapping occurrence is skipped instead of queued");
|
|
438
|
+
latest.manager.handleAsyncCompletion({ runId: "long-run", success: true });
|
|
439
|
+
const latestHistory = await latest.manager.handleToolCall({ action: "schedule.history", id: "overlap" }, latest.ctx);
|
|
440
|
+
assert.match(text(latestHistory), /skipped/);
|
|
441
|
+
assert.match(text(latestHistory), /completed.*async long-run/);
|
|
442
|
+
assert.match(text(await latest.manager.handleToolCall({ action: "schedule.show", id: "overlap" }, latest.ctx)), /2030-01-01T05:00:00.000Z/);
|
|
443
|
+
|
|
444
|
+
const none = harness();
|
|
445
|
+
await none.manager.handleToolCall({ action: "schedule.create", id: "none-overlap", every: "1h", catchUp: "none", agent: "builder" }, none.ctx);
|
|
446
|
+
none.clock.now += 3_600_000;
|
|
447
|
+
none.timers.fireAll();
|
|
448
|
+
none.launches[0]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "single", results: [], asyncId: "none-long-run" } });
|
|
449
|
+
await flush();
|
|
450
|
+
none.clock.now += 3 * 3_600_000;
|
|
451
|
+
none.timers.fireAll();
|
|
452
|
+
assert.equal(none.launches.length, 1);
|
|
453
|
+
none.manager.handleAsyncCompletion({ runId: "none-long-run", success: true });
|
|
454
|
+
assert.match(text(await none.manager.handleToolCall({ action: "schedule.history", id: "none-overlap" }, none.ctx)), /skipped/);
|
|
455
|
+
assert.match(text(await none.manager.handleToolCall({ action: "schedule.show", id: "none-overlap" }, none.ctx)), /2030-01-01T05:00:00.000Z/);
|
|
477
456
|
});
|
|
478
457
|
|
|
479
|
-
it("
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
timers: timersA,
|
|
491
|
-
launch: () => Promise.resolve({ content: [{ type: "text", text: "ok" }], details: { mode: "single", results: [] } }),
|
|
492
|
-
});
|
|
493
|
-
managerA.bindSession(ctx);
|
|
494
|
-
const soon = await managerA.handleToolCall({ action: "schedule", agent: "scout", task: "soon", schedule: "+10m" }, ctx);
|
|
495
|
-
const later = await managerA.handleToolCall({ action: "schedule", agent: "scout", task: "later", schedule: "+1h" }, ctx);
|
|
496
|
-
const soonId = extractId(soon);
|
|
497
|
-
const laterId = extractId(later);
|
|
498
|
-
assert.equal(timersA.pendingCount(), 2);
|
|
499
|
-
managerA.stop();
|
|
500
|
-
|
|
501
|
-
// Simulate Pi being offline past the first job's window but before the second fires.
|
|
502
|
-
clock.now = 1_000_000 + 20 * 60_000; // +20m: soon is 10m overdue (> maxLateness 1m), later is still 40m out.
|
|
503
|
-
const timersB = new FakeTimers();
|
|
504
|
-
const managerB = createScheduledRunManager({
|
|
505
|
-
config: makeConfig({ maxLatenessMs: 60_000 }),
|
|
506
|
-
storeRoot,
|
|
507
|
-
now: () => clock.now,
|
|
508
|
-
randomId: () => "id-" + randomUUID().slice(0, 4),
|
|
509
|
-
timers: timersB,
|
|
510
|
-
launch: () => Promise.resolve({ content: [{ type: "text", text: "ok" }], details: { mode: "single", results: [] } }),
|
|
511
|
-
});
|
|
512
|
-
managerB.bindSession(ctx);
|
|
513
|
-
const soonStatus = await managerB.handleToolCall({ action: "schedule-status", id: soonId }, ctx);
|
|
514
|
-
assert.match(soonStatus.content[0]!.text, /State: missed/);
|
|
515
|
-
const laterStatus = await managerB.handleToolCall({ action: "schedule-status", id: laterId }, ctx);
|
|
516
|
-
assert.match(laterStatus.content[0]!.text, /State: scheduled/);
|
|
517
|
-
assert.equal(timersB.pendingCount(), 1, "only the still-future job should be re-armed");
|
|
518
|
-
managerB.stop();
|
|
458
|
+
it("manual run uses the normal async target and overlap skip prevents a second launch", async () => {
|
|
459
|
+
const h = harness();
|
|
460
|
+
await h.manager.handleToolCall({ action: "schedule.create", id: "manual", every: "1h", workflowScript: "return 1" }, h.ctx);
|
|
461
|
+
const firstPromise = h.manager.handleToolCall({ action: "schedule.run", id: "manual" }, h.ctx);
|
|
462
|
+
await flush();
|
|
463
|
+
assert.equal(h.launches.length, 1);
|
|
464
|
+
h.launches[0]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "workflow", results: [], asyncId: "workflow-1" } });
|
|
465
|
+
assert.match(text(await firstPromise), /async workflow-1/);
|
|
466
|
+
const second = await h.manager.handleToolCall({ action: "schedule.run", id: "manual" }, h.ctx);
|
|
467
|
+
assert.match(text(second), /skipped/);
|
|
468
|
+
assert.equal(h.launches.length, 1);
|
|
519
469
|
});
|
|
520
470
|
|
|
521
|
-
it("
|
|
522
|
-
const
|
|
523
|
-
|
|
471
|
+
it("distinguishes failed launch from failed async completion", async () => {
|
|
472
|
+
const h = harness();
|
|
473
|
+
await h.manager.handleToolCall({ action: "schedule.create", id: "failures", every: "1h", agent: "builder" }, h.ctx);
|
|
474
|
+
const first = h.manager.handleToolCall({ action: "schedule.run", id: "failures" }, h.ctx);
|
|
475
|
+
await flush();
|
|
476
|
+
h.launches[0]!.resolve({ content: [{ type: "text", text: "spawn failed" }], details: { mode: "management", results: [] }, isError: true });
|
|
477
|
+
assert.match(text(await first), /failed_launch/);
|
|
478
|
+
|
|
479
|
+
const second = h.manager.handleToolCall({ action: "schedule.run", id: "failures" }, h.ctx);
|
|
480
|
+
await flush();
|
|
481
|
+
h.launches[1]!.resolve({ content: [{ type: "text", text: "Async" }], details: { mode: "single", results: [], asyncId: "async-fail" } });
|
|
482
|
+
await second;
|
|
483
|
+
h.manager.handleAsyncCompletion({ id: "async-fail", success: false, summary: "child failed" });
|
|
484
|
+
const history = await h.manager.handleToolCall({ action: "schedule.history", id: "failures" }, h.ctx);
|
|
485
|
+
assert.match(text(history), /failed_run.*async async-fail/);
|
|
486
|
+
assert.match(text(history), /failed_launch/);
|
|
524
487
|
});
|
|
525
488
|
});
|