gentle-pi 4.5.1 → 4.7.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/README.md +17 -15
- package/assets/agents/gentle-ai-explore.md +1 -0
- package/assets/agents/gentle-ai-verify.md +8 -1
- package/assets/agents/gentle-ai-worker.md +4 -0
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +1 -0
- package/assets/agents/jd-judge-b.md +1 -0
- package/assets/design-canvas/canvas.css +13 -1
- package/assets/design-canvas/canvas.js +11 -2
- package/assets/install-wizard/wizard.js +1 -0
- package/assets/migrations/agent-body-history.json +162 -0
- package/assets/orchestrator-delegation-reference.md +7 -7
- package/assets/orchestrator-delegation.md +3 -3
- package/assets/orchestrator-full-delegation-card.md +65 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +3 -3
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-skills.md +1 -1
- package/assets/orchestrator-verification.md +14 -8
- package/assets/orchestrator.md +11 -11
- package/bin/gentle-shell.mjs +225 -82
- package/docs/agent-status.md +61 -0
- package/docs/bundled-install.md +7 -5
- package/docs/ci-performance.md +11 -0
- package/docs/delegated-verification.md +35 -7
- package/docs/fast-mode.md +15 -0
- package/docs/gentle-agents-activity.md +22 -0
- package/docs/gentle-shell.md +113 -25
- package/docs/install-wizard.md +2 -2
- package/docs/mcp-status.md +52 -0
- package/docs/permission-modes.md +9 -4
- package/docs/prompt-budget.md +28 -0
- package/docs/readme-reference.md +154 -50
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +33 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/session-profile-format.md +20 -5
- package/docs/sound-notifications.md +1 -1
- package/docs/star-prompt.md +32 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +46 -0
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +2 -0
- package/extensions/child-safety.ts +3 -0
- package/extensions/codegraph-tools.ts +38 -4
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +803 -84
- package/extensions/gentle-ai.ts +2491 -596
- package/extensions/gentle-fast.ts +61 -0
- package/extensions/gentle-guide.ts +174 -0
- package/extensions/gentle-herdr-activity.ts +21 -1
- package/extensions/gentle-herdr-agent.ts +144 -0
- package/extensions/gentle-program-identity.ts +61 -0
- package/extensions/gentle-shell.ts +895 -120
- package/extensions/gentle-star-prompt.ts +334 -0
- package/extensions/gentle-stats.ts +5 -5
- package/extensions/gentle-todo.ts +59 -23
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/history/store.ts +18 -12
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +210 -21
- package/extensions/startup-banner.ts +69 -10
- package/lib/agent-assets.ts +74 -17
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +161 -3
- package/lib/agent-status.ts +105 -0
- package/lib/agents-config.ts +58 -3
- package/lib/agents-history.ts +24 -5
- package/lib/agents-keys.ts +8 -16
- package/lib/agents-messaging.ts +47 -5
- package/lib/agents-protocol.ts +80 -4
- package/lib/agents-runner.ts +287 -15
- package/lib/agents-view.ts +6 -1
- package/lib/agents-widget.ts +132 -9
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/bounded-writer-admission.ts +13 -1
- package/lib/bridge-cost.ts +28 -0
- package/lib/card-content-policy.ts +8 -6
- package/lib/codemode-renderer.ts +16 -0
- package/lib/command-palette-catalog.ts +1 -0
- package/lib/command-palette.ts +154 -25
- package/lib/context-backstop.ts +14 -5
- package/lib/destructive-command-guard.ts +48 -4
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +64 -0
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-design.ts +3 -0
- package/lib/gentle-guide.ts +201 -0
- package/lib/gentle-shell-bundled.ts +6 -19
- package/lib/gentle-shell-launcher.ts +47 -8
- package/lib/herdr-activity.ts +23 -5
- package/lib/herdr-busy.ts +45 -0
- package/lib/herdr-task-summary-policy.ts +85 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +282 -132
- package/lib/jobs-sidebar-state.ts +5 -6
- package/lib/jobs-view.ts +198 -11
- package/lib/jobs-widget.ts +16 -52
- package/lib/keymaps-customize.ts +81 -0
- package/lib/keymaps.ts +291 -0
- package/lib/model-fallback-notice.ts +61 -0
- package/lib/model-fallback-policy.ts +141 -0
- package/lib/model-fallback-store.ts +143 -0
- package/lib/model-routing-authority.ts +32 -6
- package/lib/nan-provider.ts +3 -2
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +103 -21
- package/lib/notification-customize.ts +48 -51
- package/lib/openai-fast-tier.ts +22 -0
- package/lib/orchestrator-discovery.ts +5 -1
- package/lib/orchestrator-fallback.ts +75 -0
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/pasted-image-paths.ts +113 -0
- package/lib/questionnaire/questionnaire-view.ts +225 -18
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +104 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +85 -44
- package/lib/review-candidate-view.ts +10 -7
- package/lib/review-continuation-registry.ts +99 -0
- package/lib/review-coordinator.ts +163 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +29 -8
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-repository.ts +5 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/session-profile-append-controller.ts +21 -6
- package/lib/session-profile-authority.ts +119 -0
- package/lib/session-profile-binding.ts +54 -5
- package/lib/session-profile-freeze.ts +107 -9
- package/lib/session-profile-integration.ts +313 -0
- package/lib/session-profile-persistence.ts +63 -9
- package/lib/shell-bar.ts +269 -72
- package/lib/shell-card.ts +26 -6
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-page.ts +120 -0
- package/lib/shell-panel.ts +163 -0
- package/lib/shell-prompt.ts +53 -1
- package/lib/shell-sidebar-layout.ts +198 -53
- package/lib/shell-sidebar.ts +61 -1
- package/lib/shell-stats.ts +123 -0
- package/lib/shell-todo.ts +79 -1
- package/lib/shell-usage.ts +12 -2
- package/lib/star-prompt.ts +197 -0
- package/lib/verifier-admission.ts +18 -8
- package/lib/verifier-settle-reminder.ts +64 -0
- package/lib/vim-editor-adapter.ts +6 -1
- package/lib/visual-customization-policy.ts +67 -12
- package/lib/visual-customize-view.ts +373 -40
- package/lib/visual-layout-preview.ts +47 -0
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/yolo-session-policy.ts +68 -16
- package/package.json +2 -1
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +6 -19
- package/runtime/gentle-shell-launcher.mjs +46 -7
- package/runtime/native-review-cli.mjs +100 -18
- package/runtime/review-integration-v2.mjs +29 -8
- package/runtime/windows-session-transport.ps1 +60 -3
- package/scripts/bootstrap.sh +4 -1
- package/scripts/build-full-delegation-card.mjs +175 -0
- package/scripts/bundled-install.mjs +38 -8
- package/scripts/download-progress.mjs +68 -0
- package/scripts/gentle-ai-installer.mjs +41 -18
- package/scripts/gentle-ai-proxy.mjs +294 -0
- package/scripts/install-gentle-ai.mjs +14 -1
- package/scripts/installer-preflight.mjs +6 -6
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +8 -7
- package/scripts/pi-update.mjs +113 -3
- package/scripts/render-cache-host.mjs +72 -0
- package/scripts/render-cache-performance-worker.mjs +5 -4
- package/scripts/render-cache-performance.mjs +6 -1
- package/scripts/run-test-suite.mjs +41 -13
- package/scripts/shell-snapshot.mjs +340 -0
- package/scripts/test-packed-runner.mjs +1 -1
- package/scripts/update-agent-body-history.mjs +41 -0
- package/scripts/verify-installer-tap.mjs +45 -0
- package/scripts/verify-package-files.mjs +14 -2
- package/scripts/voice-worker.cjs +32 -6
- package/skills/design/SKILL.md +11 -8
- package/skills/gentle-ai/SKILL.md +4 -4
- package/skills/gentle-ui-design/SKILL.md +46 -0
- package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
- package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
- package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
- package/skills/gentle-ui-design/references/task-and-content.md +60 -0
- package/skills/skill-registry/SKILL.md +4 -2
- package/skills/tui-design/NOTICE.md +5 -0
- package/skills/tui-design/SKILL.md +56 -0
- package/skills/tui-design/references/commands.md +75 -0
- package/skills/tui-design/references/critique.md +48 -0
- package/skills/tui-design/references/design-doc.md +44 -0
- package/skills/tui-design/references/terminal-craft.md +64 -0
- package/skills/tui-design/references/visual-loop.md +32 -0
- package/skills/work-unit-commits/SKILL.md +6 -7
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agents-config.test.ts +96 -0
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-protocol.test.ts +53 -1
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +345 -4
- package/tests/agents-view.test.ts +27 -0
- package/tests/agents-widget.test.ts +312 -10
- package/tests/append-system-prompt-route.test.ts +4 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +97 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-scan-contract.test.ts +39 -0
- package/tests/bounded-stop-contract.test.ts +43 -3
- package/tests/bridge-cost.test.ts +47 -0
- package/tests/bundled-install.test.ts +36 -9
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-safety.test.ts +11 -0
- package/tests/ci-concurrency.test.ts +11 -0
- package/tests/ci-merge-base-identity.test.ts +114 -0
- package/tests/codegraph-tools.test.ts +80 -5
- package/tests/codemode-rendering.test.ts +22 -2
- package/tests/command-palette.test.ts +300 -3
- package/tests/commit-slice-signal.test.ts +11 -9
- package/tests/delegate-for-reason-contract.test.ts +8 -7
- package/tests/design-canvas-assets.test.ts +185 -2
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/exploration-budget.test.ts +128 -0
- package/tests/fixtures/agent-assets/gentle-ai-worker.strict-tdd-era.md +122 -0
- package/tests/fixtures/measure-orchestrator-prompt.mjs +2 -1
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -14
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +172 -0
- package/tests/fixtures/session-profile-v1/session-profile-authority.ts +113 -0
- package/tests/fixtures/session-profile-v1/session-profile-binding.ts +83 -0
- package/tests/fixtures/session-profile-v1/session-profile-disk-reader.ts +182 -0
- package/tests/fixtures/session-profile-v1/session-profile-freeze.ts +290 -0
- package/tests/fixtures/session-profile-v1/session-profile-persistence.ts +195 -0
- package/tests/fixtures/session-profile-v1/v1-inputs.ts +16 -0
- package/tests/fixtures/windows-pipe-availability.ps1 +26 -0
- package/tests/fixtures/windows-session-bootstrap.ps1 +6 -2
- package/tests/full-delegation-closure.test.ts +131 -0
- package/tests/full-delegation-notices.test.ts +76 -0
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agent-status.test.ts +74 -0
- package/tests/gentle-agents-child-jobs.test.ts +237 -0
- package/tests/gentle-agents.test.ts +1491 -38
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +151 -0
- package/tests/gentle-ai-installer.test.ts +134 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai.test.ts +1101 -52
- package/tests/gentle-design.test.ts +21 -0
- package/tests/gentle-fast.test.ts +73 -0
- package/tests/gentle-guide.test.ts +208 -0
- package/tests/gentle-herdr-activity.test.ts +80 -3
- package/tests/gentle-herdr-agent.test.ts +111 -0
- package/tests/gentle-program-identity.test.ts +197 -0
- package/tests/gentle-shell-bin.test.ts +172 -26
- package/tests/gentle-shell-bundled.test.ts +207 -31
- package/tests/gentle-shell-launcher.test.ts +93 -10
- package/tests/gentle-shell.test.ts +1937 -66
- package/tests/gentle-stats.test.ts +15 -2
- package/tests/gentle-todo.test.ts +67 -4
- package/tests/gentle-tps.test.ts +123 -0
- package/tests/gentle-ui-design-skill.test.ts +59 -0
- package/tests/herdr-busy.test.ts +59 -0
- package/tests/herdr-task-summary-policy.test.ts +132 -0
- package/tests/history-store-private-mode.test.ts +40 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/image-paste-chips.test.ts +42 -0
- package/tests/independent-recovery-delivery.test.ts +83 -0
- package/tests/inprocess-reviewer.test.ts +298 -4
- package/tests/installer-posix-bootstrap.test.ts +68 -6
- package/tests/installer-preflight.test.ts +5 -4
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +14 -11
- package/tests/installer-windows-diagnostics.test.ts +4 -5
- package/tests/isolated-config-home.ts +28 -0
- package/tests/jobs-view.test.ts +260 -6
- package/tests/jobs-widget.test.ts +25 -37
- package/tests/keymaps-customize.test.ts +114 -0
- package/tests/keymaps.test.ts +103 -0
- package/tests/maintainer/mcp-status.maintest.ts +88 -0
- package/tests/maintainer/pi-update-source.maintest.ts +116 -0
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-notice.test.ts +45 -0
- package/tests/model-fallback-policy.test.ts +83 -0
- package/tests/model-fallback-store.test.ts +111 -0
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider.test.ts +4 -4
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +7 -1
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/no-self-pause-contract.test.ts +22 -0
- package/tests/notification-customize.test.ts +58 -34
- package/tests/odd-routing-canonical-ratchet.test.ts +6 -6
- package/tests/odd-routing-contract.test.ts +1 -1
- package/tests/orchestrator-budget.test.ts +7 -2
- package/tests/orchestrator-delegation-mode.test.ts +153 -0
- package/tests/orchestrator-fallback.test.ts +82 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +133 -0
- package/tests/orchestrator-rdd-ownership.test.ts +2 -2
- package/tests/package-manifest.test.ts +169 -14
- package/tests/pasted-image-paths.test.ts +118 -0
- package/tests/permission-allowlist.test.ts +202 -0
- package/tests/persona-reply-language.test.ts +20 -1
- package/tests/pi-update-launcher.test.ts +40 -8
- package/tests/pi-update-source.test.ts +162 -0
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-fast-tier.test.ts +311 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +84 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/questionnaire-view.test.ts +265 -0
- package/tests/quiet-bash-runtime.test.ts +1 -1
- package/tests/quiet-tool-rendering.test.ts +48 -0
- package/tests/rdd-aware-verification-contract.test.ts +16 -11
- package/tests/rdd-customize.test.ts +287 -0
- package/tests/rdd-mode-cache.test.ts +450 -0
- package/tests/rdd-mode-control.test.ts +407 -0
- package/tests/rdd-mode-scope-regression.test.ts +137 -0
- package/tests/rdd-off-independent-regression.test.ts +69 -0
- package/tests/rdd-status-line.test.ts +18 -0
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor.test.ts +173 -0
- package/tests/review-agent-end-preflight.test.ts +1 -1
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-owner-sweep.test.ts +93 -0
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +52 -1
- package/tests/review-candidate-windows-boundary.test.ts +131 -0
- package/tests/review-candidate-windows-probe.test.ts +63 -0
- package/tests/review-committed-restart-ack.test.ts +129 -0
- package/tests/review-continuation-registry.test.ts +76 -0
- package/tests/review-controller-native-routing.test.ts +381 -11
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +96 -11
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +195 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-gate.test.ts +24 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-inspect-preflight.test.ts +197 -0
- package/tests/review-integration-v2-forward.test.ts +59 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +65 -10
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-loadout-rdd-off-sdk.test.ts +65 -31
- package/tests/review-owner-identity.test.ts +60 -24
- package/tests/review-relay-phase-timing.test.ts +128 -0
- package/tests/review-relay-transport-agent.test.ts +12 -2
- package/tests/review-repository.test.ts +52 -1
- package/tests/review-reviewer-evidence.test.ts +183 -0
- package/tests/review-risk-assessment.test.ts +74 -3
- package/tests/review-session-standing-permission-controller.test.ts +21 -1
- package/tests/review-sidebar-state.test.ts +5 -5
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +121 -0
- package/tests/run-test-suite.test.ts +183 -6
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +250 -0
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-append-controller.test.ts +63 -0
- package/tests/session-profile-authority.test.ts +259 -0
- package/tests/session-profile-binding.test.ts +34 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +615 -0
- package/tests/session-profile-freeze.test.ts +110 -2
- package/tests/session-profile-integration.test.ts +857 -0
- package/tests/session-profile-persistence.test.ts +57 -0
- package/tests/session-profile-v1-compat.test.ts +255 -0
- package/tests/shell-bar.test.ts +274 -72
- package/tests/shell-card.test.ts +13 -1
- package/tests/shell-page.test.ts +108 -0
- package/tests/shell-panel.test.ts +360 -0
- package/tests/shell-prompt.test.ts +54 -0
- package/tests/shell-render-cache.test.ts +5 -0
- package/tests/shell-sidebar-fullscreen.test.ts +13 -1
- package/tests/shell-sidebar-layout.test.ts +447 -44
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-stats.test.ts +90 -0
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/shell-usage.test.ts +14 -0
- package/tests/skill-registry.test.ts +902 -2
- package/tests/star-prompt.test.ts +470 -0
- package/tests/startup-banner.test.ts +209 -2
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/review-coordinator-runtime.ts +69 -0
- package/tests/task-size-routing-contract.test.ts +50 -4
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verifier-settle-reminder.test.ts +281 -0
- package/tests/verify-first-launch-contract.test.ts +134 -8
- package/tests/verify-installer-tap.test.ts +57 -0
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +95 -8
- package/tests/visual-customize-view.test.ts +818 -9
- package/tests/visual-layout-preview.test.ts +42 -0
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-bootstrap.test.ts +105 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +114 -0
- package/tests/writer-feature-document-admission.test.ts +92 -0
- package/tests/writer-surfaces.test.ts +12 -10
- package/tests/yolo-customize.test.ts +57 -15
- package/tests/yolo-mode-runtime.test.ts +4 -2
- package/tests/yolo-mode.test.ts +39 -20
- package/tests/yolo-session-policy.test.ts +270 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test, { after, before, type TestContext } from "node:test";
|
|
3
3
|
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
4
|
-
import { TASK_STATUS, type TaskRecord } from "../lib/agents-protocol.ts";
|
|
5
|
-
import
|
|
4
|
+
import { TASK_STATUS, TaskStore, type TaskRecord } from "../lib/agents-protocol.ts";
|
|
5
|
+
import installGentleAgents from "../extensions/gentle-agents.ts";
|
|
6
|
+
import { PresencePublisher } from "../lib/orchestrator-presence.ts";
|
|
7
|
+
import { sidebarState } from "../lib/shell-sidebar.ts";
|
|
8
|
+
import { installSidebar } from "../lib/shell-sidebar-layout.ts";
|
|
9
|
+
import { TuiAltScreen, VStack, type Component, type Terminal, type TUI, type TuiMouseEvent } from "@earendil-works/pi-tui";
|
|
10
|
+
import { agentsSpend, agentsSummary, formatElapsed, renderAgentsAlert, renderAgentsCard, renderAgentsSection, widgetExpiryMs, widgetRows, widgetTasks } from "../lib/agents-widget.ts";
|
|
11
|
+
import { formatTokens } from "../lib/shell-bar.ts";
|
|
6
12
|
import { CARD_STYLE, cardStyle, setCardStyle, type CardStyle } from "../lib/shell-card.ts";
|
|
7
13
|
import { stripAnsi } from "../lib/terminal-theme.ts";
|
|
8
14
|
|
|
@@ -102,6 +108,51 @@ test("renderAgentsCard draws columns for agent, task, and model · tokens · cos
|
|
|
102
108
|
assert.deepEqual(renderAgentsCard([], plainTheme, 60, 0, { collapsed: false }), []);
|
|
103
109
|
});
|
|
104
110
|
|
|
111
|
+
test("sidebar activity appears below each agent without changing the capped above-editor view", () => {
|
|
112
|
+
const tasks = [
|
|
113
|
+
task({ id: "a", agent: "explore", label: "Investigando estado de subagentes" }),
|
|
114
|
+
task({ id: "b", agent: "writer", label: "Preparando pruebas", createdAt: 2000, startedAt: 2000 }),
|
|
115
|
+
];
|
|
116
|
+
const sidebar = renderAgentsCard(tasks, plainTheme, 44, 5_000, { collapsed: false }).map(stripAnsi);
|
|
117
|
+
assert.match(sidebar[1]!, /explore.*34k · \$0\.270 · 4s/);
|
|
118
|
+
assert.equal(bodyText(sidebar[2]!), "Investigando estado de subagentes");
|
|
119
|
+
assert.match(sidebar[3]!, /writer.*34k · \$0\.270 · 3s/);
|
|
120
|
+
assert.equal(bodyText(sidebar[4]!), "Preparando pruebas");
|
|
121
|
+
for (const line of sidebar) assert.equal(visibleWidth(line), 44);
|
|
122
|
+
|
|
123
|
+
const above = renderAgentsCard(tasks, plainTheme, 44, 5_000, { collapsed: false, maxRows: 8 }).map(stripAnsi);
|
|
124
|
+
assert.equal(above.length, 4);
|
|
125
|
+
assert.match(above[1]!, /explore.*34k · \$0\.270 · 4s/);
|
|
126
|
+
assert.match(above[2]!, /writer.*34k · \$0\.270 · 3s/);
|
|
127
|
+
assert.doesNotMatch(above.join("\n"), /Investigando|Preparando/);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("sidebar activity uses waiting and error text, clips to width, and preserves fallback metadata", () => {
|
|
131
|
+
const tasks = [
|
|
132
|
+
task({ id: "a", agent: "explore", status: TASK_STATUS.WAITING, lastStep: "asked: ¿Continuar?", label: "not waiting text", model: "long-model-name", thinking: "high" }),
|
|
133
|
+
task({ id: "b", agent: "writer", status: TASK_STATUS.FAILED, endedAt: 4_000, error: "falló la ejecución", label: "not error text", model: "long-model-name", thinking: "high", createdAt: 2000, startedAt: 2000 }),
|
|
134
|
+
];
|
|
135
|
+
const sidebar = renderAgentsCard(tasks, plainTheme, 16, 5_000, { collapsed: false }).map(stripAnsi);
|
|
136
|
+
assert.ok(sidebar.some((line) => bodyText(line) === "asked: ¿Con…"));
|
|
137
|
+
assert.ok(sidebar.some((line) => bodyText(line) === "falló la ej…"));
|
|
138
|
+
assert.equal(sidebar.filter((line) => line.includes(" · high")).length, 2, "fallback execution metadata survives on its own row");
|
|
139
|
+
assert.doesNotMatch(sidebar.join("\n"), /not waiting|not error/);
|
|
140
|
+
for (const line of sidebar) assert.equal(visibleWidth(line), 16);
|
|
141
|
+
for (const width of [0, 1, 2, 3, 4, 8, 16, 24, 28, 44]) {
|
|
142
|
+
for (const line of renderAgentsCard(tasks, plainTheme, width, 5_000, { collapsed: false })) assert.equal(visibleWidth(line), width);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("sidebar activity is not duplicated when inline and includes queued tasks", () => {
|
|
147
|
+
const queued = task({ id: "q", agent: "writer", status: TASK_STATUS.QUEUED, startedAt: null, label: "Preparando pruebas" });
|
|
148
|
+
const narrow = renderAgentsCard([queued], plainTheme, 28, 5_000, { collapsed: false }).map(stripAnsi);
|
|
149
|
+
assert.match(narrow[1]!, /writer.*queued/);
|
|
150
|
+
assert.equal(bodyText(narrow[2]!), "Preparando pruebas");
|
|
151
|
+
const wide = renderAgentsCard([queued], plainTheme, 100, 5_000, { collapsed: false }).map(stripAnsi);
|
|
152
|
+
assert.equal(wide.length, 3);
|
|
153
|
+
assert.match(wide[1]!, /writer\s+Preparando pruebas/);
|
|
154
|
+
});
|
|
155
|
+
|
|
105
156
|
test("renderAgentsCard right-aligns model·effort, tokens, cost, and elapsed in fixed columns that line up across rows", () => {
|
|
106
157
|
const tasks = [
|
|
107
158
|
task({ id: "a", agent: "a", model: "claude-sonnet-5", thinking: "medium", startedAt: 1000, endedAt: 26_000, tokens: 34_000, cost: 0.27 }),
|
|
@@ -159,7 +210,7 @@ test("renderAgentsCard keeps every task on one line, clipping long labels, and d
|
|
|
159
210
|
// Narrow cards degrade per column: task text first, then the model name,
|
|
160
211
|
// then tokens and cost. Elapsed is the one value the reader cannot rebuild
|
|
161
212
|
// from anything else on screen, so it is the last to go.
|
|
162
|
-
const narrow = renderAgentsCard(tasks, plainTheme, 44, 5_000, { collapsed: false }).map(stripAnsi);
|
|
213
|
+
const narrow = renderAgentsCard(tasks, plainTheme, 44, 5_000, { collapsed: false, maxRows: 8 }).map(stripAnsi);
|
|
163
214
|
assert.equal(narrow.length, 3);
|
|
164
215
|
assert.match(narrow[1], /^│ ◐ sdd-explore +34k · \$0\.270 · 4s │$/, "the model name goes before tokens, cost and elapsed");
|
|
165
216
|
});
|
|
@@ -168,12 +219,12 @@ test("renderAgentsCard keeps every task on one line, clipping long labels, and d
|
|
|
168
219
|
// model-only fallback, silently dropping tokens, cost and the running time.
|
|
169
220
|
test("renderAgentsCard keeps tokens, cost and elapsed when a long model name no longer fits", () => {
|
|
170
221
|
const tasks = [task({ id: "a", model: "anthropic/claude-sonnet-4-5-20250929", tokens: 12_345, cost: 0.42, startedAt: 5_000 - 184_000 })];
|
|
171
|
-
const lines = renderAgentsCard(tasks, plainTheme, 46, 5_000, { collapsed: false }).map(stripAnsi);
|
|
222
|
+
const lines = renderAgentsCard(tasks, plainTheme, 46, 5_000, { collapsed: false, maxRows: 8 }).map(stripAnsi);
|
|
172
223
|
assert.equal(lines.length, 3);
|
|
173
224
|
assert.match(lines[1], /^│ ◐ sdd-explore +12k · \$0\.420 · 3m04s │$/, "tokens, cost and elapsed survive; the model name is what gives way");
|
|
174
|
-
const tighter = renderAgentsCard(tasks, plainTheme, 34, 5_000, { collapsed: false }).map(stripAnsi);
|
|
225
|
+
const tighter = renderAgentsCard(tasks, plainTheme, 34, 5_000, { collapsed: false, maxRows: 8 }).map(stripAnsi);
|
|
175
226
|
assert.match(tighter[1], /^│ ◐ sdd-explore +\$0\.420 · 3m04s │$/, "then tokens go, then cost, elapsed last");
|
|
176
|
-
const tightest = renderAgentsCard(tasks, plainTheme, 28, 5_000, { collapsed: false }).map(stripAnsi);
|
|
227
|
+
const tightest = renderAgentsCard(tasks, plainTheme, 28, 5_000, { collapsed: false, maxRows: 8 }).map(stripAnsi);
|
|
177
228
|
assert.match(tightest[1], /^│ ◐ sdd-explore +3m04s │$/, "elapsed is the last column standing");
|
|
178
229
|
});
|
|
179
230
|
|
|
@@ -182,7 +233,7 @@ test("renderAgentsCard degrades every row of a mixed card together so columns st
|
|
|
182
233
|
task({ id: "a", model: "anthropic/claude-sonnet-4-5-20250929", tokens: 12_345, cost: 0.42 }),
|
|
183
234
|
task({ id: "b", agent: "writer", model: "openai/gpt-5", tokens: 900, cost: 0.01 }),
|
|
184
235
|
];
|
|
185
|
-
const lines = renderAgentsCard(tasks, plainTheme, 46, 5_000, { collapsed: false }).map(stripAnsi);
|
|
236
|
+
const lines = renderAgentsCard(tasks, plainTheme, 46, 5_000, { collapsed: false, maxRows: 8 }).map(stripAnsi);
|
|
186
237
|
assert.match(lines[1], /12k · \$0\.420 · 4s │$/);
|
|
187
238
|
assert.match(lines[2], /900 · \$0\.010 · 4s │$/);
|
|
188
239
|
assert.equal(lines[1].indexOf("· 4s"), lines[2].indexOf("· 4s"), "elapsed stays in one column across rows");
|
|
@@ -215,14 +266,14 @@ test("renderAgentsCard shows questions and failures in place of the task, and co
|
|
|
215
266
|
// the label is the one value the user already chose and can look up.
|
|
216
267
|
test("usage outranks the model label at narrow widths without inventing unknown values", () => {
|
|
217
268
|
for (const width of [60, 100]) {
|
|
218
|
-
const lines = renderAgentsCard([task({ agent: "worker", model: "openai/gpt-5", thinking: "high" })], plainTheme, width, 5000, { collapsed: false });
|
|
269
|
+
const lines = renderAgentsCard([task({ agent: "worker", model: "openai/gpt-5", thinking: "high" })], plainTheme, width, 5000, { collapsed: false, maxRows: 8 });
|
|
219
270
|
assert.equal(lines.length, 3);
|
|
220
271
|
assert.match(lines[1], /worker/);
|
|
221
272
|
assert.match(lines[1], /gpt-5 · high · 34k · \$0\.270 · 4s/, "wide enough for every column");
|
|
222
273
|
for (const line of lines) assert.equal(visibleWidth(line), width);
|
|
223
274
|
}
|
|
224
275
|
for (const width of [32, 44]) {
|
|
225
|
-
const lines = renderAgentsCard([task({ agent: "worker", model: "openai/gpt-5", thinking: "high" })], plainTheme, width, 5000, { collapsed: false });
|
|
276
|
+
const lines = renderAgentsCard([task({ agent: "worker", model: "openai/gpt-5", thinking: "high" })], plainTheme, width, 5000, { collapsed: false, maxRows: 8 });
|
|
226
277
|
assert.equal(lines.length, 3);
|
|
227
278
|
assert.match(lines[1], /worker/);
|
|
228
279
|
assert.doesNotMatch(lines[1], /gpt-5/, "the model label is the first column to go");
|
|
@@ -230,7 +281,7 @@ test("usage outranks the model label at narrow widths without inventing unknown
|
|
|
230
281
|
for (const line of lines) assert.equal(visibleWidth(line), width);
|
|
231
282
|
}
|
|
232
283
|
for (const width of [0, 1, 2, 3, 4, 8, 16, 24]) {
|
|
233
|
-
const lines = renderAgentsCard([task({ agent: "界worker", thinking: "xhigh" })], plainTheme, width, 5000, { collapsed: false });
|
|
284
|
+
const lines = renderAgentsCard([task({ agent: "界worker", thinking: "xhigh" })], plainTheme, width, 5000, { collapsed: false, maxRows: 8 });
|
|
234
285
|
assert.ok(lines.length <= 4, "narrow metadata gets at most one dedicated row");
|
|
235
286
|
for (const line of lines) assert.equal(visibleWidth(line), width);
|
|
236
287
|
}
|
|
@@ -366,3 +417,254 @@ test("renderAgentsCard in the float style is a float panel two rows taller than
|
|
|
366
417
|
const [, header] = renderAgentsCard([task({ status: TASK_STATUS.WAITING })], tagged, 120, 5000, { collapsed: true, collapseKey: "ctrl+a" });
|
|
367
418
|
assert.match(stripAnsi(header!), /^ <warning>▎<\/warning> <warning>❀ Agents<\/warning> <muted>1 waiting<\/muted> +<muted>ctrl\+a expand<\/muted> {3}$/);
|
|
368
419
|
});
|
|
420
|
+
|
|
421
|
+
// The fullscreen rail draws Agents as a panel section (design/shell-rework/06-many-agents.html):
|
|
422
|
+
// one row per agent, the task first, then the agent kind and its tokens and
|
|
423
|
+
// time, ordered by what needs you; finished work folds into one row.
|
|
424
|
+
|
|
425
|
+
test("the Agents section orders rows by what needs you and aligns kind and time columns", () => {
|
|
426
|
+
const now = 400_000;
|
|
427
|
+
const tasks = [
|
|
428
|
+
task({ id: "done", agent: "gentle-ai-verify", label: "verify T1 title row", status: TASK_STATUS.COMPLETED, startedAt: 0, endedAt: 380_000 }),
|
|
429
|
+
task({ id: "worker", agent: "gentle-ai-worker", label: "T3 rail panel sections", startedAt: 28_000, tokens: 2_100_000 }),
|
|
430
|
+
task({ id: "asks", agent: "gentle-ai-explore", label: "map sidebar render paths", lastStep: "Which base branch should the chain use?", status: TASK_STATUS.WAITING, startedAt: 10_000 }),
|
|
431
|
+
task({ id: "queued", agent: "gentle-ai-worker", label: "T5 mobile work row", status: TASK_STATUS.QUEUED, startedAt: null, createdAt: 50_000, tokens: 0 }),
|
|
432
|
+
task({ id: "failed", agent: "gentle-ai-worker", label: "T6 customize presets", status: TASK_STATUS.FAILED, error: "T6 customize presets", startedAt: 300_000, endedAt: 370_000 }),
|
|
433
|
+
task({ id: "verify", agent: "gentle-ai-verify", label: "verify T2 editor rule", startedAt: 277_000, tokens: 800_000 }),
|
|
434
|
+
];
|
|
435
|
+
const lines = renderAgentsSection(tasks, plainTheme, 50, now, { collapsed: false });
|
|
436
|
+
for (const line of lines) assert.equal(visibleWidth(line), 50, `row fills the section: ${line}`);
|
|
437
|
+
const rows = lines.map((line) => line.trimEnd());
|
|
438
|
+
assert.match(rows[0]!, /^▾ AGENTS +2 running · 1 waiting$/);
|
|
439
|
+
const worker = `${formatTokens(2_100_000)} ${formatElapsed(372_000)}`;
|
|
440
|
+
const verify = `${formatTokens(800_000)} ${formatElapsed(123_000)}`;
|
|
441
|
+
assert.deepEqual(rows.slice(1).map((row) => row.replace(/\s{2,}/g, " | ")), [
|
|
442
|
+
" | ? Which base branch should… explore | asks you",
|
|
443
|
+
` | ◐ T3 rail panel sections | worker | ${worker}`,
|
|
444
|
+
` | ◐ verify T2 editor rule | verify | ${verify}`,
|
|
445
|
+
" | ○ T5 mobile work row | worker | queued",
|
|
446
|
+
` | ✗ T6 customize presets | worker | failed ${formatElapsed(70_000)}`,
|
|
447
|
+
" | ✓ 1 done · /gentle:agents",
|
|
448
|
+
]);
|
|
449
|
+
const kindColumn = rows.slice(1, 6).map((row) => [...row.matchAll(/(explore|worker|verify)(?= )/g)].at(-1)!.index);
|
|
450
|
+
assert.equal(new Set(kindColumn).size, 1, `agent kinds line up in one column: ${kindColumn}`);
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
test("agent row hover paints only the pointed task text in the shared warning role", () => {
|
|
454
|
+
const roles: Record<string, number> = { warning: 208, accent: 30, text: 250, muted: 245, dim: 240, error: 160, border: 238 };
|
|
455
|
+
const theme = { fg: (role: string, text: string) => `\x1b[38;5;${roles[role] ?? 255}m${text}\x1b[39m` };
|
|
456
|
+
const tasks = [task({ id: "a", agent: "scout", label: "map files" }), task({ id: "b", agent: "writer", label: "write tests", status: TASK_STATUS.FAILED, endedAt: 4_000 })];
|
|
457
|
+
const warning = "\x1b[38;5;208m";
|
|
458
|
+
const error = "\x1b[38;5;160m✗";
|
|
459
|
+
for (const render of [
|
|
460
|
+
(hoveredRow?: number) => renderAgentsCard(tasks, theme, 80, 5_000, { collapsed: false, hoveredRow }),
|
|
461
|
+
(hoveredRow?: number) => renderAgentsSection(tasks, theme, 80, 5_000, { collapsed: false, hoveredRow }),
|
|
462
|
+
]) {
|
|
463
|
+
const idle = render();
|
|
464
|
+
const hovered = render(2);
|
|
465
|
+
assert.equal(hovered[1], idle[1], "the neighboring task is not highlighted");
|
|
466
|
+
assert.match(hovered[2]!, new RegExp(`${warning.replaceAll("[", "\\[")}[^\\x1b]*write tests`));
|
|
467
|
+
assert.ok(hovered[2]!.includes(error), "the failed status glyph keeps its error role");
|
|
468
|
+
assert.deepEqual(render(), idle, "leaving restores every original role");
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
test("agent hover geometry excludes float padding, overflow and idle rows", (t) => {
|
|
473
|
+
useCardStyle(t, CARD_STYLE.FLOAT);
|
|
474
|
+
const theme = withBackground({ fg: (role: string, text: string) => `\x1b[38;5;${role === "warning" ? 208 : 250}m${text}\x1b[39m` });
|
|
475
|
+
const tasks = Array.from({ length: 4 }, (_, index) => task({ id: String(index), agent: `worker-${index}`, label: `task-${index}` }));
|
|
476
|
+
const agentRows: number[] = [];
|
|
477
|
+
const idle = renderAgentsCard(tasks, theme, 80, 5_000, { collapsed: false, maxRows: 4, onAgentRow: (row) => agentRows.push(row) });
|
|
478
|
+
assert.deepEqual(agentRows, [3]);
|
|
479
|
+
assert.match(stripAnsi(idle[4]!), /… 3 more/);
|
|
480
|
+
const hovered = renderAgentsCard(tasks, theme, 80, 5_000, { collapsed: false, maxRows: 4, hoveredRow: 3 });
|
|
481
|
+
assert.ok(hovered[3]!.includes("\x1b[38;5;208m"));
|
|
482
|
+
assert.equal(hovered[2], idle[2], "float separator stays unpainted");
|
|
483
|
+
assert.equal(hovered[4], idle[4], "overflow stays unpainted");
|
|
484
|
+
const idleRows: number[] = [];
|
|
485
|
+
renderAgentsSection([], theme, 50, 5_000, { collapsed: false, onAgentRow: (row) => idleRows.push(row) });
|
|
486
|
+
assert.deepEqual(idleRows, []);
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
test("agent widget routes row hover, reset, collapse and clicks through its public component", async (t) => {
|
|
490
|
+
const tasks = [task({ id: "a", agent: "scout", label: "map files" }), task({ id: "b", agent: "writer", label: "write tests" })];
|
|
491
|
+
t.mock.method(TaskStore.prototype, "list", () => tasks);
|
|
492
|
+
t.mock.method(PresencePublisher, "start", () => { throw new Error("presence disabled in this test"); });
|
|
493
|
+
const handlers = new Map<string, Array<(event: { reason: string }, ctx: unknown) => unknown>>();
|
|
494
|
+
const pi = {
|
|
495
|
+
on(name: string, handler: (event: { reason: string }, ctx: unknown) => unknown) { handlers.set(name, [...(handlers.get(name) ?? []), handler]); },
|
|
496
|
+
events: { on: () => () => {}, emit() {} },
|
|
497
|
+
registerTool() {}, registerCommand() {}, registerShortcut() {}, registerMarkdownTransformer() {}, registerMessageRenderer() {}, registerEntryRenderer() {},
|
|
498
|
+
};
|
|
499
|
+
installGentleAgents(pi as never, { GENTLE_PI_CONFIG_HOME: "/dev/null" }, {
|
|
500
|
+
home: "/dev/null", agentHome: "/dev/null", env: { GENTLE_PI_CONFIG_HOME: "/dev/null" },
|
|
501
|
+
now: () => 5_000, schedule: () => () => {}, resolveWorktree: () => undefined,
|
|
502
|
+
});
|
|
503
|
+
let factory: ((tui: unknown, theme: unknown) => Component) | undefined;
|
|
504
|
+
let opens = 0;
|
|
505
|
+
const ctx = {
|
|
506
|
+
hasUI: true, mode: "tui", cwd: "/repo", modelRegistry: {},
|
|
507
|
+
sessionManager: { getSessionId: () => "bad id", getCwd: () => "/repo", getEntries: () => [], getBranch: () => [] },
|
|
508
|
+
ui: { setWidget: (_key: string, value: typeof factory) => { factory = value; }, custom: async () => { opens++; return null; }, notify() {} },
|
|
509
|
+
};
|
|
510
|
+
await handlers.get("session_start")!.at(-1)!({ reason: "new" }, ctx);
|
|
511
|
+
const tui = { terminal: { columns: 160, rows: 40 }, requestRender() {} };
|
|
512
|
+
const theme = { fg: (role: string, text: string) => `\x1b[38;5;${role === "warning" ? 208 : 250}m${text}\x1b[39m` };
|
|
513
|
+
const component = factory!(tui, theme);
|
|
514
|
+
const rows = component.render(80);
|
|
515
|
+
const event = (type: TuiMouseEvent["type"], button: TuiMouseEvent["button"], y: number): TuiMouseEvent => ({ type, button, x: 5, y, screenX: 15, screenY: 20 + y, width: 80, height: rows.length, shift: false, alt: false, ctrl: false });
|
|
516
|
+
const rail = sidebarState(tui as unknown as TUI).parts.get("agents")!;
|
|
517
|
+
const before = rail.digest!();
|
|
518
|
+
component.handleMouse?.(event("move", "none", 1));
|
|
519
|
+
assert.ok(component.render(80)[1]!.includes("\x1b[38;5;208m"), "the pointed agent row uses the hover role");
|
|
520
|
+
component.handleMouse?.(event("move", "none", 2));
|
|
521
|
+
assert.ok(component.render(80)[2]!.includes("\x1b[38;5;208m"), "moving selects the other row");
|
|
522
|
+
component.handleMouse?.(event("move", "none", rows.length - 1));
|
|
523
|
+
assert.ok(!component.render(80)[2]!.includes("\x1b[38;5;208m"), "moving to the spacer clears row hover");
|
|
524
|
+
assert.equal(rail.digest!(), before, "hover is cleared from the cache digest");
|
|
525
|
+
const railRows = rail.render(46);
|
|
526
|
+
const railEvent = (type: TuiMouseEvent["type"], button: TuiMouseEvent["button"], y: number): TuiMouseEvent => ({ type, button, x: 5, y, screenX: 105, screenY: 5 + y, width: 46, height: railRows.length, shift: false, alt: false, ctrl: false });
|
|
527
|
+
rail.handleMouse?.(railEvent("move", "none", 1));
|
|
528
|
+
assert.notEqual(rail.digest!(), before, "rail hover invalidates the section digest");
|
|
529
|
+
assert.ok(rail.render(46)[1]!.includes("\x1b[38;5;208m"));
|
|
530
|
+
rail.invalidate();
|
|
531
|
+
assert.equal(rail.digest!(), before);
|
|
532
|
+
component.handleMouse?.(event("move", "none", rows.length - 1));
|
|
533
|
+
assert.ok(!component.render(80).at(-1)!.includes("\x1b[38;5;208m"), "spacer and border never light up");
|
|
534
|
+
component.handleMouse?.(event("click", "right", 1));
|
|
535
|
+
assert.equal(opens, 0);
|
|
536
|
+
component.handleMouse?.(event("click", "left", 1));
|
|
537
|
+
assert.equal(opens, 1, "an agent row still opens the agents view");
|
|
538
|
+
component.handleMouse?.(event("click", "left", 0));
|
|
539
|
+
assert.match(stripAnsi(component.render(80)[0]!), /Expand/, "the header still collapses");
|
|
540
|
+
assert.equal(opens, 1);
|
|
541
|
+
await t.test("native fullscreen motion into a sibling clears agent hover", () => {
|
|
542
|
+
let input: ((data: string) => void) | undefined;
|
|
543
|
+
const terminal: Terminal = {
|
|
544
|
+
start(onInput) { input = onInput; }, stop() {}, async drainInput() {}, write() {}, columns: 80, rows: 24, kittyProtocolActive: false,
|
|
545
|
+
moveBy() {}, hideCursor() {}, showCursor() {}, clearLine() {}, clearFromCursor() {}, clearScreen() {}, setTitle() {}, setProgress() {}, setProgramStatus() {},
|
|
546
|
+
};
|
|
547
|
+
const nativeTui = new TuiAltScreen(terminal, false, undefined, { mouse: true });
|
|
548
|
+
const nativeCard = factory!(nativeTui, theme);
|
|
549
|
+
const outside = { render: () => ["outside"], invalidate() {} };
|
|
550
|
+
nativeTui.setLayoutRoot(new VStack([nativeCard, outside]));
|
|
551
|
+
const uninstall = installSidebar(nativeTui, { fg: theme.fg, bold: (text) => text });
|
|
552
|
+
nativeTui.start();
|
|
553
|
+
try {
|
|
554
|
+
nativeTui.renderNow(true);
|
|
555
|
+
const rendered = nativeCard.render(80);
|
|
556
|
+
input?.("\x1b[<35;6;2M");
|
|
557
|
+
assert.ok(nativeCard.render(80)[1]!.includes("\x1b[38;5;208m"), "native motion enters an agent row");
|
|
558
|
+
input?.(`\x1b[<35;1;${rendered.length + 1}M`);
|
|
559
|
+
assert.ok(!nativeCard.render(80)[1]!.includes("\x1b[38;5;208m"), "native motion into a sibling clears hover");
|
|
560
|
+
} finally {
|
|
561
|
+
uninstall();
|
|
562
|
+
(nativeCard as Component & { dispose?(): void }).dispose?.();
|
|
563
|
+
nativeTui.stop();
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
tasks.length = 0;
|
|
567
|
+
const idle = rail.render(46);
|
|
568
|
+
rail.handleMouse?.(railEvent("move", "none", 1));
|
|
569
|
+
assert.equal(rail.render(46)[1], idle[1], "the idle row is not an agent hover target");
|
|
570
|
+
(component as Component & { dispose?(): void }).dispose?.();
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
test("an idle Agents section keeps one muted row pointing at /gentle:agents", () => {
|
|
574
|
+
const lines = renderAgentsSection([], plainTheme, 50, 0, { collapsed: false }).map((line) => line.trimEnd());
|
|
575
|
+
assert.deepEqual(lines.map((row) => row.replace(/\s{2,}/g, " | ")), ["▾ AGENTS | idle", " | none running · /gentle:agents"]);
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
test("a collapsed Agents section keeps the row that needs you most", () => {
|
|
579
|
+
const tasks = [task({ id: "run", label: "running one" }), task({ id: "ask", label: "asking", lastStep: "Pick one?", status: TASK_STATUS.WAITING })];
|
|
580
|
+
const lines = renderAgentsSection(tasks, plainTheme, 50, 10_000, { collapsed: true }).map((line) => line.trimEnd());
|
|
581
|
+
assert.equal(lines.length, 2);
|
|
582
|
+
assert.match(lines[0]!, /^▸ AGENTS/);
|
|
583
|
+
assert.match(lines[1]!, /^ {2}\? Pick one\?/);
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
test("more agents than the section's rows keep waiting and running rows and count the rest", () => {
|
|
587
|
+
const tasks = Array.from({ length: 12 }, (_, index) => task({ id: `q${index}`, label: `queued ${index}`, status: TASK_STATUS.QUEUED, startedAt: null, createdAt: index }))
|
|
588
|
+
.concat(task({ id: "run", label: "the running one", createdAt: 100 }), task({ id: "ask", label: "asking", lastStep: "Need you?", status: TASK_STATUS.WAITING, createdAt: 101 }));
|
|
589
|
+
const rows = renderAgentsSection(tasks, plainTheme, 50, 10_000, { collapsed: false }).map((line) => line.trim());
|
|
590
|
+
assert.match(rows[1]!, /^\? Need you\?/);
|
|
591
|
+
assert.match(rows[2]!, /^◐ the running one/);
|
|
592
|
+
assert.equal(rows.length, 1 + 8, "eight rows, the last one counting the rest");
|
|
593
|
+
assert.match(rows.at(-1)!, /^… 7 more · \/gentle:agents$/);
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
test("the agents alert names the agent asking the user and its question, above the editor", () => {
|
|
597
|
+
const painted = { fg: (_color: string, text: string) => text, bg: (_color: string, text: string) => `\x1b[48;5;52m${text}\x1b[49m` };
|
|
598
|
+
const waiting = [
|
|
599
|
+
task({ id: "a", agent: "gentle-ai-explore", status: TASK_STATUS.WAITING, lastStep: "asked: Which base branch should the chain use?", createdAt: 1 }),
|
|
600
|
+
task({ id: "b", agent: "gentle-ai-worker", status: TASK_STATUS.WAITING, lastStep: "asked: Overwrite the fixture?", createdAt: 2 }),
|
|
601
|
+
task({ id: "c", label: "running" }),
|
|
602
|
+
];
|
|
603
|
+
const lines = renderAgentsAlert(waiting, painted, 110);
|
|
604
|
+
assert.equal(lines.length, 1);
|
|
605
|
+
assert.ok(lines[0]!.startsWith("\x1b[48;5;52m"), "the alert sits on the selection surface");
|
|
606
|
+
const row = stripAnsi(lines[0]!);
|
|
607
|
+
assert.equal(visibleWidth(row), 110);
|
|
608
|
+
assert.match(stripAnsi(renderAgentsAlert(waiting, painted, 60)[0]!), /…\s+\+1 more · \/gentle:agents $/, "a narrow row clips the question, never the way to the agents view");
|
|
609
|
+
assert.match(row, /^ \? explore asked: Which base branch should the chain use\? +\+1 more · \/gentle:agents $/);
|
|
610
|
+
assert.deepEqual(renderAgentsAlert([task({ id: "c" })], painted, 80), [], "nothing waits, nothing paints");
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
test("the agents summary counts running, waiting and failed agents for the mobile work row", () => {
|
|
614
|
+
const tasks = [task({ id: "a" }), task({ id: "b" }), task({ id: "c", status: TASK_STATUS.WAITING, lastStep: "asked: x" }), task({ id: "d", status: TASK_STATUS.FAILED, endedAt: 9_000 })];
|
|
615
|
+
assert.deepEqual(agentsSummary(tasks, plainTheme, 10_000), { left: "◐ 3 agents · ? 1 waiting · ✗ 1", priority: 1 });
|
|
616
|
+
assert.equal(agentsSummary([task({ id: "e", status: TASK_STATUS.COMPLETED, endedAt: 9_000 })], plainTheme, 10_000), undefined, "finished work alone is not live work");
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
test("agentsSpend totals every started subagent's tokens and cost for the Stats section", () => {
|
|
620
|
+
assert.equal(agentsSpend([]), undefined);
|
|
621
|
+
assert.equal(agentsSpend([task({ id: "q", status: TASK_STATUS.QUEUED, tokens: 0, cost: 0 })]), undefined, "queued tasks have not spent anything");
|
|
622
|
+
const spend = agentsSpend([
|
|
623
|
+
task({ id: "a", status: TASK_STATUS.COMPLETED, tokens: 1200, cost: 0.12 }),
|
|
624
|
+
task({ id: "b", status: TASK_STATUS.RUNNING, tokens: 2300, cost: 0.08 }),
|
|
625
|
+
task({ id: "c", status: TASK_STATUS.FAILED, tokens: 0, cost: 0 }),
|
|
626
|
+
task({ id: "q", status: TASK_STATUS.QUEUED, tokens: 0, cost: 0 }),
|
|
627
|
+
])!;
|
|
628
|
+
assert.equal(spend.runs, 3);
|
|
629
|
+
assert.equal(spend.tokens, 3500);
|
|
630
|
+
assert.equal(Math.round(spend.cost * 100), 20);
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
test("an agent that fell back to another model says so on its row", () => {
|
|
634
|
+
const theme = { fg: (_role: string, text: string) => text };
|
|
635
|
+
const now = 10_000;
|
|
636
|
+
const moved = task({ id: "m", status: TASK_STATUS.RUNNING, startedAt: 1_000, model: "openai/gpt-5.5", fallbackFrom: "anthropic/claude-opus-5-5", tokens: 1200 });
|
|
637
|
+
const stayed = task({ id: "s", status: TASK_STATUS.RUNNING, startedAt: 2_000, model: "anthropic/claude-opus-5-5", tokens: 800 });
|
|
638
|
+
const rows = renderAgentsSection([moved, stayed], theme as never, 60, now, { collapsed: false }).map((row) => row.trimEnd());
|
|
639
|
+
assert.ok(rows.some((row) => /↪ .+ · gpt-5\.5/.test(row)), rows.join("\n"));
|
|
640
|
+
assert.equal(rows.filter((row) => row.includes("↪")).length, 1, "only the agent that moved");
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
test("a moved agent's ↪ mark never changes the other rows, at any rail width", () => {
|
|
644
|
+
const theme = { fg: (_role: string, text: string) => text };
|
|
645
|
+
const now = 70_000;
|
|
646
|
+
const others = [
|
|
647
|
+
task({ id: "w", status: TASK_STATUS.WAITING, startedAt: 1_000, prompt: "grep the repo", agent: "sdd-explore" }),
|
|
648
|
+
task({ id: "f", status: TASK_STATUS.FAILED, startedAt: 2_000, endedAt: 59_000, prompt: "verify the change", agent: "gentle-ai-verify" }),
|
|
649
|
+
];
|
|
650
|
+
const running = task({ id: "r", status: TASK_STATUS.RUNNING, startedAt: 3_000, prompt: "write the parser", agent: "gentle-ai-worker", tokens: 34_000, model: "anthropic/claude-opus-5-5" });
|
|
651
|
+
for (const width of [46, 30, 20]) {
|
|
652
|
+
const plain = renderAgentsSection([...others, running], theme as never, width, now, { collapsed: false });
|
|
653
|
+
const moved = renderAgentsSection([...others, { ...running, model: "openai/gpt-5.5", fallbackFrom: "anthropic/claude-opus-5-5" }], theme as never, width, now, { collapsed: false });
|
|
654
|
+
const movedRow = moved.findIndex((row) => /34k/.test(row));
|
|
655
|
+
moved.forEach((row, index) => {
|
|
656
|
+
if (index !== movedRow) assert.equal(row, plain[index], `row ${index} is untouched at ${width}`);
|
|
657
|
+
assert.ok(visibleWidth(row) <= width);
|
|
658
|
+
});
|
|
659
|
+
if (width >= 30) assert.match(moved[movedRow]!, /↪/, `the mark shows at ${width}`);
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
test("a moved agent's row keeps its task readable and adds the model when there is room", () => {
|
|
664
|
+
const theme = { fg: (_role: string, text: string) => text };
|
|
665
|
+
const running = task({ id: "r", status: TASK_STATUS.RUNNING, startedAt: 3_000, prompt: "write the parser", label: "write the parser", agent: "gentle-ai-worker", tokens: 34_000, model: "anthropic/claude-opus-5-5", fallbackFrom: "openai/gpt-5.5" });
|
|
666
|
+
const at46 = renderAgentsSection([running], theme as never, 46, 70_000, { collapsed: false }).join("\n");
|
|
667
|
+
assert.match(at46, /↪ write the/, "the task comes first after the mark");
|
|
668
|
+
const at90 = renderAgentsSection([running], theme as never, 90, 70_000, { collapsed: false }).join("\n");
|
|
669
|
+
assert.match(at90, /↪ write the parser · claude-opus-5-5/);
|
|
670
|
+
});
|
|
@@ -124,7 +124,10 @@ test("both extensions land their block in appendSystemPrompt on one shared optio
|
|
|
124
124
|
for (const clause of [
|
|
125
125
|
"necessary in-scope implementation, documentation and verification steps",
|
|
126
126
|
"Never end a turn merely announcing an immediately executable authorized next step; execute it instead",
|
|
127
|
-
"required explicit consent, a denied action,
|
|
127
|
+
"required explicit consent, a denied action, or the human's explicit stop",
|
|
128
|
+
"Unavailable required proof blocks completion and delivery; it does not alone prohibit specifically authorized in-scope implementation where actual native authority and other limits permit it.",
|
|
129
|
+
"After a setup prerequisite is repaired, the human may explicitly request one new bounded verification attempt.",
|
|
130
|
+
"Never bypass consent, a denial, explicit one-run or no-retry limits, terminal native outcomes, or exhausted native budgets.",
|
|
128
131
|
"Do not infer permission for publishing, destructive actions, unrelated scope or native consent",
|
|
129
132
|
"Report a concrete blocker and the exact decision needed",
|
|
130
133
|
"launch the bounded action and end the turn when no independent in-scope work remains",
|
|
@@ -234,7 +234,7 @@ test("ask_user_choice hover preserves the keyboard-selected opaque value", async
|
|
|
234
234
|
ui: { custom: async (factory: ChoiceCustomFactory) => {
|
|
235
235
|
let completed: unknown;
|
|
236
236
|
const component = factory({ requestRender() {} }, {
|
|
237
|
-
fg: (
|
|
237
|
+
fg: (color, text) => color === "warning" ? `\u001b[33m${text}\u001b[39m` : `\u001b[38;5;39m${text}\u001b[39m`,
|
|
238
238
|
bg: (_color, text) => `\u001b[48;5;236m${text}\u001b[49m`, bold: (text) => text,
|
|
239
239
|
}, {}, (value) => { completionCalls++; completed = value; });
|
|
240
240
|
const lines = component.render(80);
|
|
@@ -249,9 +249,10 @@ test("ask_user_choice hover preserves the keyboard-selected opaque value", async
|
|
|
249
249
|
assert.equal(component.handleMouse?.(hover)?.render, true);
|
|
250
250
|
assert.equal(completed, undefined, "hover never submits");
|
|
251
251
|
const hovered = component.render(80);
|
|
252
|
-
assert.ok(hovered[second]?.includes("\u001b[
|
|
252
|
+
assert.ok(hovered[second]?.includes("\u001b[33m"), "the second option uses the shared warning foreground");
|
|
253
|
+
assert.ok(!hovered[second]?.includes("\u001b[48;5;236m"), "hover does not use toolPendingBg");
|
|
253
254
|
assert.ok(
|
|
254
|
-
hovered[first]?.includes("\u001b[38;5;39m") && !hovered[first]?.includes("\u001b[
|
|
255
|
+
hovered[first]?.includes("\u001b[38;5;39m") && !hovered[first]?.includes("\u001b[33m"),
|
|
255
256
|
"hover does not change keyboard selection",
|
|
256
257
|
);
|
|
257
258
|
component.handleInput("\r");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test from "node:test";
|
|
3
|
+
import { Container, stripTerminalSequences, Text, TuiAltScreen, visibleWidth, type Component, type Terminal } from "@earendil-works/pi-tui";
|
|
4
|
+
import { createChatViewport } from "../node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/chat-viewport.js";
|
|
3
5
|
import askUserQuestion, { askMultiSelect } from "../extensions/ask-user-question.ts";
|
|
4
6
|
import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
5
7
|
|
|
@@ -464,6 +466,101 @@ test("ask_user_question mounts through ctx.ui.custom without an overlay option",
|
|
|
464
466
|
assert.equal(customArgCount, 1, "a dock swap passes the factory only; no overlay options");
|
|
465
467
|
});
|
|
466
468
|
|
|
469
|
+
for (const multiSelect of [false, true]) {
|
|
470
|
+
test(`ask_user_question dock clears hover on its border and preserves native ${multiSelect ? "multi" : "single"}-select`, async () => {
|
|
471
|
+
let input: ((data: string) => void) | undefined;
|
|
472
|
+
const terminal: Terminal = {
|
|
473
|
+
start(onInput) { input = onInput; }, stop() {}, async drainInput() {}, write() {},
|
|
474
|
+
get columns() { return 100; }, get rows() { return 30; }, get kittyProtocolActive() { return false; },
|
|
475
|
+
moveBy() {}, hideCursor() {}, showCursor() {}, clearLine() {}, clearFromCursor() {}, clearScreen() {},
|
|
476
|
+
setTitle() {}, setProgress() {}, setProgramStatus() {},
|
|
477
|
+
};
|
|
478
|
+
const tui = new TuiAltScreen(terminal, false, undefined, { mouse: true });
|
|
479
|
+
const editor = new Container();
|
|
480
|
+
const viewport = createChatViewport({
|
|
481
|
+
document: new Text("Visible transcript", 0, 0),
|
|
482
|
+
pendingMessages: new Container(), status: new Container(), editor,
|
|
483
|
+
footer: new Text("Footer", 0, 0), scrollbar: "hidden",
|
|
484
|
+
});
|
|
485
|
+
tui.setLayoutRoot(viewport.root);
|
|
486
|
+
const hoverTheme: Theme = {
|
|
487
|
+
fg: (role, text) => role === "warning" ? `\x1b[33m${text}\x1b[39m` : text,
|
|
488
|
+
bold: (text) => text,
|
|
489
|
+
};
|
|
490
|
+
const label = "Beta: envelope/Ω";
|
|
491
|
+
const questions = [{
|
|
492
|
+
question: "Pick?", header: "Pick", options: [option("Alpha"), option(label)],
|
|
493
|
+
...(multiSelect ? { multiSelect: true } : {}),
|
|
494
|
+
}];
|
|
495
|
+
const { tool, emitted } = registerQuestionTool();
|
|
496
|
+
const completions: unknown[] = [];
|
|
497
|
+
const pending = run(tool, { questions }, {
|
|
498
|
+
mode: "tui",
|
|
499
|
+
ui: { custom: (factory: CustomFactory) => new Promise((resolve) => {
|
|
500
|
+
const component = factory(tui, hoverTheme, {}, (value) => {
|
|
501
|
+
completions.push(value);
|
|
502
|
+
resolve(value);
|
|
503
|
+
}) as Component;
|
|
504
|
+
editor.addChild(component);
|
|
505
|
+
tui.setFocus(component);
|
|
506
|
+
}) },
|
|
507
|
+
});
|
|
508
|
+
tui.start();
|
|
509
|
+
tui.renderNow(true);
|
|
510
|
+
try {
|
|
511
|
+
assert.ok(input, "the fullscreen terminal receives native SGR input");
|
|
512
|
+
let screen = tui.getScreenLines();
|
|
513
|
+
const targetRow = screen.findIndex((line) => stripTerminalSequences(line).includes(label));
|
|
514
|
+
const tabsRow = screen.findIndex((line) => stripTerminalSequences(line).includes("[1/1]"));
|
|
515
|
+
const borderRow = tabsRow - 1;
|
|
516
|
+
assert.ok(targetRow >= 0 && borderRow >= 0, "both the option and its preceding dock border are rendered");
|
|
517
|
+
assert.match(stripTerminalSequences(screen[borderRow]!).trim(), /^─+$/);
|
|
518
|
+
const targetLine = stripTerminalSequences(screen[targetRow]!);
|
|
519
|
+
const targetX = visibleWidth(targetLine.slice(0, targetLine.indexOf(label))) + 1;
|
|
520
|
+
const expectedInitial = multiSelect ? /❯ \[ \] Alpha/ : /❯ Alpha/;
|
|
521
|
+
assert.match(screen.map(stripTerminalSequences).join("\n"), expectedInitial);
|
|
522
|
+
|
|
523
|
+
input(`\x1b[<35;${targetX};${targetRow + 1}M`);
|
|
524
|
+
tui.renderNow();
|
|
525
|
+
screen = tui.getScreenLines();
|
|
526
|
+
assert.ok(screen[targetRow]!.includes(`\x1b[33m${label}\x1b[39m`), "the option uses the warning role");
|
|
527
|
+
assert.match(screen.map(stripTerminalSequences).join("\n"), expectedInitial, "hover leaves keyboard selection unchanged");
|
|
528
|
+
if (multiSelect) assert.match(stripTerminalSequences(screen[targetRow]!), /\[ \] Beta/);
|
|
529
|
+
assert.deepEqual(completions, [], "hover does not answer or toggle");
|
|
530
|
+
|
|
531
|
+
input(`\x1b[<35;1;${borderRow + 1}M`);
|
|
532
|
+
tui.renderNow();
|
|
533
|
+
screen = tui.getScreenLines();
|
|
534
|
+
assert.ok(!screen[targetRow]!.includes("\x1b[33m"), "moving onto the non-view dock border clears hover");
|
|
535
|
+
assert.match(screen.map(stripTerminalSequences).join("\n"), expectedInitial);
|
|
536
|
+
if (multiSelect) assert.match(stripTerminalSequences(screen[targetRow]!), /\[ \] Beta/);
|
|
537
|
+
assert.deepEqual(completions, []);
|
|
538
|
+
|
|
539
|
+
input(`\x1b[<0;${targetX};${targetRow + 1}M`);
|
|
540
|
+
assert.deepEqual(completions, [], "press alone does not answer");
|
|
541
|
+
input(`\x1b[<0;${targetX};${targetRow + 1}m`);
|
|
542
|
+
if (multiSelect) {
|
|
543
|
+
assert.deepEqual(completions, [], "a multi-select click toggles without answering");
|
|
544
|
+
tui.renderNow();
|
|
545
|
+
screen = tui.getScreenLines();
|
|
546
|
+
assert.match(stripTerminalSequences(screen[targetRow]!), /\[x\] Beta/);
|
|
547
|
+
input("\r");
|
|
548
|
+
}
|
|
549
|
+
const result = await pending;
|
|
550
|
+
const answer = multiSelect
|
|
551
|
+
? { questionIndex: 0, question: "Pick?", kind: "multi", answer: null, selected: [label] }
|
|
552
|
+
: { questionIndex: 0, question: "Pick?", kind: "option", answer: label };
|
|
553
|
+
assert.equal(completions.length, 1);
|
|
554
|
+
assert.deepEqual(result.details.answers, [answer]);
|
|
555
|
+
assert.equal(result.content[0]?.text, multiSelect ? `1. Pick? — selected: ${label}` : `1. Pick? — ${label}`);
|
|
556
|
+
assert.deepEqual(emitted, [
|
|
557
|
+
{ channel: "gentle-pi:ask-user-question:blocked", data: { active: true } },
|
|
558
|
+
{ channel: "gentle-pi:ask-user-question:blocked", data: { active: false } },
|
|
559
|
+
]);
|
|
560
|
+
} finally { tui.stop(); }
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
|
|
467
564
|
test("ask_user_question mounts exactly one active question and switches with Tab", async () => {
|
|
468
565
|
const { tool } = registerQuestionTool();
|
|
469
566
|
const questions = [
|
|
@@ -250,7 +250,7 @@ test("Auto fails closed on missing verdict, throws, changed arguments, mode revo
|
|
|
250
250
|
});
|
|
251
251
|
|
|
252
252
|
test("Native consent, human questions and delegation remain with their original executors", async t=>{
|
|
253
|
-
const f=fixture(t);for(const name of ["ask_user_choice","ask_user_question","gentle_review","gentle_review_capture","subagent_run","subagent_reply"]){
|
|
253
|
+
const f=fixture(t);for(const name of ["ask_user_choice","ask_user_question","gentle_review","gentle_review_capture","gentle_review_capture_group","gentle_review_run","subagent_run","subagent_reply"]){
|
|
254
254
|
assert.equal((await f.execute(name,{})).executions,1);
|
|
255
255
|
}
|
|
256
256
|
assert.equal(f.requests.length,0);
|