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
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launches the real Gentle Shell TUI in a headless terminal on a FORK of an
|
|
3
|
+
// existing session and saves PNG screenshots, so an agent can look at what the
|
|
4
|
+
// shell actually renders.
|
|
5
|
+
//
|
|
6
|
+
// node scripts/shell-snapshot.mjs --session <session.jsonl> [--cols 180] [--rows 50]
|
|
7
|
+
// [--out <dir>] [--wait <seconds>] [--cwd <dir>]
|
|
8
|
+
// node scripts/shell-snapshot.mjs --latest-rich [--from <project-dir>] [...same options]
|
|
9
|
+
//
|
|
10
|
+
// --latest-rich picks the newest session of <project-dir> (default: --cwd) that
|
|
11
|
+
// has both todo and subagent_run calls, from ~/.gentle-shell/agent/sessions.
|
|
12
|
+
//
|
|
13
|
+
// The terminal is ttyd (xterm.js) rendered by headless Chrome, driven over the
|
|
14
|
+
// DevTools protocol with Node's built-in WebSocket. vhs uses the same stack but
|
|
15
|
+
// vhs 0.12.0 silently skips rendering (no PNG, no GIF) on this setup, so the
|
|
16
|
+
// script drives ttyd and Chrome itself. Requires `ttyd` and Google Chrome
|
|
17
|
+
// (override with CHROME_BIN).
|
|
18
|
+
//
|
|
19
|
+
// The source session is never resumed or written: the shell is started with
|
|
20
|
+
// `--fork <session> --session-dir <scratch>/sessions`, so the fork lands in a
|
|
21
|
+
// fresh /tmp/gentle-eyes.* scratch directory.
|
|
22
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
23
|
+
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
24
|
+
import { createServer } from "node:net";
|
|
25
|
+
import { homedir } from "node:os";
|
|
26
|
+
import { dirname, join, resolve } from "node:path";
|
|
27
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
28
|
+
import { fileURLToPath } from "node:url";
|
|
29
|
+
|
|
30
|
+
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
31
|
+
const launcher = join(repoRoot, "bin", "gentle-shell.mjs");
|
|
32
|
+
// Pi stores a project's sessions under `--<absolute path with / as ->--`.
|
|
33
|
+
const sessionsDirFor = (projectDir) => join(homedir(), ".gentle-shell", "agent", "sessions", `--${resolve(projectDir).replace(/^\//, "").replaceAll("/", "-")}--`);
|
|
34
|
+
const chromeCandidates = [
|
|
35
|
+
process.env.CHROME_BIN,
|
|
36
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
|
37
|
+
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
|
38
|
+
"/usr/bin/google-chrome",
|
|
39
|
+
"/usr/bin/chromium",
|
|
40
|
+
].filter(Boolean);
|
|
41
|
+
|
|
42
|
+
const FONT_SIZE = 15;
|
|
43
|
+
// Menlo first, then fonts that carry the Braille logo and Nerd Font icons.
|
|
44
|
+
const FONT_FAMILY = "Menlo, 'Apple Braille', 'Apple Symbols', 'IosevkaTerm Nerd Font', monospace";
|
|
45
|
+
// Dark palette close to the Gentleman terminal theme (xterm.js ITheme keys).
|
|
46
|
+
const THEME = {
|
|
47
|
+
background: "#06080f",
|
|
48
|
+
foreground: "#f3f6f9",
|
|
49
|
+
cursor: "#e0c15a",
|
|
50
|
+
selectionBackground: "#263356",
|
|
51
|
+
black: "#06080f",
|
|
52
|
+
red: "#cb7c94",
|
|
53
|
+
green: "#b7cc85",
|
|
54
|
+
yellow: "#ffe066",
|
|
55
|
+
blue: "#7fb4ca",
|
|
56
|
+
magenta: "#ff8dd7",
|
|
57
|
+
cyan: "#7aa89f",
|
|
58
|
+
white: "#f3f6f9",
|
|
59
|
+
brightBlack: "#8a8fa3",
|
|
60
|
+
brightRed: "#de8fa8",
|
|
61
|
+
brightGreen: "#d1e8a9",
|
|
62
|
+
brightYellow: "#fff7b1",
|
|
63
|
+
brightBlue: "#a3d4d5",
|
|
64
|
+
brightMagenta: "#ffaeeb",
|
|
65
|
+
brightCyan: "#a3d4d5",
|
|
66
|
+
brightWhite: "#ffffff",
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
function usage(message) {
|
|
70
|
+
if (message) console.error(`error: ${message}`);
|
|
71
|
+
console.error("usage: node scripts/shell-snapshot.mjs (--session <file.jsonl> | --latest-rich [--from <project-dir>]) [--cols 180] [--rows 50] [--out <dir>] [--wait <seconds>] [--cwd <dir>]");
|
|
72
|
+
process.exit(2);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function parseArgs(argv) {
|
|
76
|
+
const options = { session: undefined, latestRich: false, from: undefined, cols: 180, rows: 50, out: undefined, wait: 12, cwd: repoRoot };
|
|
77
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
78
|
+
const arg = argv[i];
|
|
79
|
+
const value = () => {
|
|
80
|
+
const next = argv[i + 1];
|
|
81
|
+
if (next === undefined) usage(`${arg} requires a value`);
|
|
82
|
+
i += 1;
|
|
83
|
+
return next;
|
|
84
|
+
};
|
|
85
|
+
const number = () => {
|
|
86
|
+
const parsed = Number(value());
|
|
87
|
+
if (!Number.isFinite(parsed) || parsed <= 0) usage(`${arg} requires a positive number`);
|
|
88
|
+
return parsed;
|
|
89
|
+
};
|
|
90
|
+
if (arg === "--session") options.session = resolve(value());
|
|
91
|
+
else if (arg === "--latest-rich") options.latestRich = true;
|
|
92
|
+
else if (arg === "--from") options.from = resolve(value());
|
|
93
|
+
else if (arg === "--cols") options.cols = Math.floor(number());
|
|
94
|
+
else if (arg === "--rows") options.rows = Math.floor(number());
|
|
95
|
+
else if (arg === "--out") options.out = resolve(value());
|
|
96
|
+
else if (arg === "--wait") options.wait = number();
|
|
97
|
+
else if (arg === "--cwd") options.cwd = resolve(value());
|
|
98
|
+
else if (arg === "--help" || arg === "-h") usage();
|
|
99
|
+
else usage(`unknown argument ${arg}`);
|
|
100
|
+
}
|
|
101
|
+
if (options.session && options.latestRich) usage("use either --session or --latest-rich, not both");
|
|
102
|
+
if (!options.session && !options.latestRich) usage("--session or --latest-rich is required");
|
|
103
|
+
if (options.from && !options.latestRich) usage("--from only applies to --latest-rich");
|
|
104
|
+
return options;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Most recently modified session that has both todo and subagent_run tool calls.
|
|
108
|
+
function findLatestRichSession(projectDir) {
|
|
109
|
+
const richSessionsDir = sessionsDirFor(projectDir);
|
|
110
|
+
if (!existsSync(richSessionsDir)) usage(`sessions directory not found: ${richSessionsDir}`);
|
|
111
|
+
const candidates = readdirSync(richSessionsDir)
|
|
112
|
+
.filter((name) => name.endsWith(".jsonl"))
|
|
113
|
+
.map((name) => join(richSessionsDir, name))
|
|
114
|
+
.map((path) => ({ path, mtime: statSync(path).mtimeMs }))
|
|
115
|
+
.sort((a, b) => b.mtime - a.mtime);
|
|
116
|
+
for (const { path } of candidates) {
|
|
117
|
+
const text = readFileSync(path, "utf8");
|
|
118
|
+
if (text.includes('"name":"todo"') && text.includes('"name":"subagent_run"')) return path;
|
|
119
|
+
}
|
|
120
|
+
usage(`no session with both todo and subagent_run calls under ${richSessionsDir}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const shellQuote = (value) => `'${value.replaceAll("'", `'\\''`)}'`;
|
|
124
|
+
|
|
125
|
+
// When this runs inside a Pi/Gentle Shell session (e.g. from an agent), the
|
|
126
|
+
// inherited PI_*, GENTLE_*, and HERDR_* variables would make the snapshot shell
|
|
127
|
+
// act as a subagent child (no sidebar rail) and report into the caller's pane.
|
|
128
|
+
// Start it like a fresh user terminal instead.
|
|
129
|
+
const INHERITED_SESSION_ENV = /^(PI_|GENTLE_PI_|GENTLE_SHELL_|HERDR_|TERM_PROGRAM|CLAUDE_AGENT_SDK|AI_AGENT$)/;
|
|
130
|
+
const cleanEnv = () => Object.fromEntries(Object.entries(process.env).filter(([key]) => !INHERITED_SESSION_ENV.test(key)));
|
|
131
|
+
|
|
132
|
+
function freePort() {
|
|
133
|
+
return new Promise((resolvePort, reject) => {
|
|
134
|
+
const server = createServer();
|
|
135
|
+
server.once("error", reject);
|
|
136
|
+
server.listen(0, "127.0.0.1", () => {
|
|
137
|
+
const { port } = server.address();
|
|
138
|
+
server.close(() => resolvePort(port));
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async function waitFor(check, timeoutMs, label) {
|
|
144
|
+
const deadline = Date.now() + timeoutMs;
|
|
145
|
+
while (Date.now() < deadline) {
|
|
146
|
+
const result = await check();
|
|
147
|
+
if (result) return result;
|
|
148
|
+
await sleep(200);
|
|
149
|
+
}
|
|
150
|
+
throw new Error(`timed out waiting for ${label}`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function runningPids(marker) {
|
|
154
|
+
const result = spawnSync("pgrep", ["-f", marker], { encoding: "utf8" });
|
|
155
|
+
return result.stdout.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Minimal DevTools protocol client over one browser-level WebSocket.
|
|
159
|
+
async function connectCdp(url) {
|
|
160
|
+
const socket = new WebSocket(url);
|
|
161
|
+
await new Promise((resolveOpen, reject) => {
|
|
162
|
+
socket.addEventListener("open", resolveOpen, { once: true });
|
|
163
|
+
socket.addEventListener("error", () => reject(new Error(`cannot connect to ${url}`)), { once: true });
|
|
164
|
+
});
|
|
165
|
+
let nextId = 0;
|
|
166
|
+
const pending = new Map();
|
|
167
|
+
socket.addEventListener("message", (event) => {
|
|
168
|
+
const message = JSON.parse(event.data);
|
|
169
|
+
const waiter = message.id === undefined ? undefined : pending.get(message.id);
|
|
170
|
+
if (!waiter) return;
|
|
171
|
+
pending.delete(message.id);
|
|
172
|
+
if (message.error) waiter.reject(new Error(`${waiter.method}: ${message.error.message}`));
|
|
173
|
+
else waiter.resolve(message.result);
|
|
174
|
+
});
|
|
175
|
+
const send = (method, params = {}, sessionId) => new Promise((resolveSend, reject) => {
|
|
176
|
+
nextId += 1;
|
|
177
|
+
pending.set(nextId, { resolve: resolveSend, reject, method });
|
|
178
|
+
socket.send(JSON.stringify({ id: nextId, method, params, ...(sessionId ? { sessionId } : {}) }));
|
|
179
|
+
});
|
|
180
|
+
return { send, close: () => socket.close() };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const options = parseArgs(process.argv.slice(2));
|
|
184
|
+
const session = options.session ?? findLatestRichSession(options.from ?? options.cwd);
|
|
185
|
+
if (!existsSync(session)) usage(`session not found: ${session}`);
|
|
186
|
+
if (!existsSync(options.cwd)) usage(`cwd not found: ${options.cwd}`);
|
|
187
|
+
const chrome = chromeCandidates.find((path) => existsSync(path));
|
|
188
|
+
if (!chrome) usage("Google Chrome not found; set CHROME_BIN");
|
|
189
|
+
if (spawnSync("ttyd", ["--version"], { encoding: "utf8" }).status !== 0) usage("ttyd is not installed or not on PATH");
|
|
190
|
+
|
|
191
|
+
const scratch = mkdtempSync("/tmp/gentle-eyes.");
|
|
192
|
+
const sessionDir = join(scratch, "sessions");
|
|
193
|
+
const outDir = options.out ?? join(scratch, "shots");
|
|
194
|
+
const chromeProfile = join(scratch, "chrome-profile");
|
|
195
|
+
for (const dir of [sessionDir, outDir, chromeProfile]) mkdirSync(dir, { recursive: true });
|
|
196
|
+
const sourceBefore = statSync(session);
|
|
197
|
+
|
|
198
|
+
// run.sh waits for the browser to size the terminal before starting the shell,
|
|
199
|
+
// so the TUI starts at the final size instead of reflowing after a resize.
|
|
200
|
+
const runScript = join(scratch, "run.sh");
|
|
201
|
+
const goFile = join(scratch, "go");
|
|
202
|
+
const sizeFile = join(scratch, "size.txt");
|
|
203
|
+
writeFileSync(runScript, [
|
|
204
|
+
"#!/usr/bin/env bash",
|
|
205
|
+
`for _ in $(seq 1 600); do [ -f ${shellQuote(goFile)} ] && break; sleep 0.1; done`,
|
|
206
|
+
`cd ${shellQuote(options.cwd)} || exit 1`,
|
|
207
|
+
`stty size > ${shellQuote(sizeFile)}`,
|
|
208
|
+
"export COLORTERM=truecolor",
|
|
209
|
+
`exec node ${shellQuote(launcher)} --tui-mode fullscreen --fork ${shellQuote(session)} --session-dir ${shellQuote(sessionDir)}`,
|
|
210
|
+
"",
|
|
211
|
+
].join("\n"));
|
|
212
|
+
|
|
213
|
+
const shots = {
|
|
214
|
+
loaded: join(outDir, "01-loaded.png"),
|
|
215
|
+
sidebar: join(outDir, "02-sidebar.png"),
|
|
216
|
+
exited: join(outDir, "03-exited.png"),
|
|
217
|
+
};
|
|
218
|
+
const written = [];
|
|
219
|
+
const notes = [];
|
|
220
|
+
let ttyd;
|
|
221
|
+
let browser;
|
|
222
|
+
let cdp;
|
|
223
|
+
let exitCode = 0;
|
|
224
|
+
|
|
225
|
+
try {
|
|
226
|
+
const ttydPort = await freePort();
|
|
227
|
+
ttyd = spawn("ttyd", [
|
|
228
|
+
"--port", String(ttydPort), "--interface", "127.0.0.1", "--writable", "--once",
|
|
229
|
+
"-t", "rendererType=canvas", "-t", "disableLeaveAlert=true", "-t", "disableResizeOverlay=true",
|
|
230
|
+
"-t", `fontSize=${FONT_SIZE}`, "-t", `fontFamily=${FONT_FAMILY}`, "-t", `theme=${JSON.stringify(THEME)}`,
|
|
231
|
+
"bash", runScript,
|
|
232
|
+
], { stdio: "ignore", env: cleanEnv() });
|
|
233
|
+
|
|
234
|
+
browser = spawn(chrome, [
|
|
235
|
+
"--headless=new", "--remote-debugging-port=0", `--user-data-dir=${chromeProfile}`,
|
|
236
|
+
"--no-first-run", "--no-default-browser-check", "--disable-extensions", "--hide-scrollbars", "about:blank",
|
|
237
|
+
], { stdio: "ignore" });
|
|
238
|
+
const activePort = join(chromeProfile, "DevToolsActivePort");
|
|
239
|
+
const [debugPort, browserPath] = await waitFor(() => existsSync(activePort) && readFileSync(activePort, "utf8").trim().split("\n").length >= 2 && readFileSync(activePort, "utf8").trim().split("\n"), 20_000, "Chrome DevTools");
|
|
240
|
+
cdp = await connectCdp(`ws://127.0.0.1:${debugPort}${browserPath}`);
|
|
241
|
+
const { targetId } = await cdp.send("Target.createTarget", { url: "about:blank" });
|
|
242
|
+
const { sessionId } = await cdp.send("Target.attachToTarget", { targetId, flatten: true });
|
|
243
|
+
const page = (method, params) => cdp.send(method, params, sessionId);
|
|
244
|
+
const evaluate = async (expression) => (await page("Runtime.evaluate", { expression, returnByValue: true })).result.value;
|
|
245
|
+
const setViewport = (width, height) => page("Emulation.setDeviceMetricsOverride", { width, height, deviceScaleFactor: 1, mobile: false });
|
|
246
|
+
const screenshot = async (path) => {
|
|
247
|
+
const { data } = await page("Page.captureScreenshot", { format: "png" });
|
|
248
|
+
writeFileSync(path, Buffer.from(data, "base64"));
|
|
249
|
+
written.push(path);
|
|
250
|
+
};
|
|
251
|
+
const pressCtrl = async (key) => {
|
|
252
|
+
await evaluate("window.term && window.term.focus()");
|
|
253
|
+
const code = `Key${key.toUpperCase()}`;
|
|
254
|
+
const keyCode = key.toUpperCase().charCodeAt(0);
|
|
255
|
+
for (const type of ["rawKeyDown", "keyUp"]) {
|
|
256
|
+
await page("Input.dispatchKeyEvent", { type, modifiers: 2, key, code, windowsVirtualKeyCode: keyCode, nativeVirtualKeyCode: keyCode });
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
await setViewport(1600, 900);
|
|
261
|
+
await waitFor(async () => {
|
|
262
|
+
try {
|
|
263
|
+
await page("Page.navigate", { url: `http://127.0.0.1:${ttydPort}/` });
|
|
264
|
+
return true;
|
|
265
|
+
} catch {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
}, 10_000, "ttyd page");
|
|
269
|
+
await waitFor(() => evaluate("Boolean(window.term && window.term.cols > 0)"), 15_000, "xterm.js terminal");
|
|
270
|
+
|
|
271
|
+
// Fit the viewport so xterm.js ends up exactly cols x rows; ttyd's fit addon
|
|
272
|
+
// resizes the pty on every viewport change.
|
|
273
|
+
let size = await evaluate("({ cols: term.cols, rows: term.rows, width: innerWidth, height: innerHeight })");
|
|
274
|
+
for (let attempt = 0; attempt < 8 && (size.cols !== options.cols || size.rows !== options.rows); attempt += 1) {
|
|
275
|
+
const width = Math.round(size.width + (options.cols - size.cols) * (size.width / size.cols)) + (size.cols > options.cols ? 0 : 1);
|
|
276
|
+
const height = Math.round(size.height + (options.rows - size.rows) * (size.height / size.rows)) + (size.rows > options.rows ? 0 : 1);
|
|
277
|
+
await setViewport(width, height);
|
|
278
|
+
await sleep(400);
|
|
279
|
+
size = await evaluate("({ cols: term.cols, rows: term.rows, width: innerWidth, height: innerHeight })");
|
|
280
|
+
}
|
|
281
|
+
if (size.cols !== options.cols || size.rows !== options.rows) notes.push(`terminal is ${size.cols}x${size.rows}, wanted ${options.cols}x${options.rows}`);
|
|
282
|
+
writeFileSync(goFile, "");
|
|
283
|
+
|
|
284
|
+
// tuiMode defaults to "fullscreen" in Pi, and the sidebar rail paints in
|
|
285
|
+
// fullscreen at >= 140 columns, so no key is needed to enter it.
|
|
286
|
+
await sleep(options.wait * 1000);
|
|
287
|
+
await screenshot(shots.loaded);
|
|
288
|
+
await sleep(3000);
|
|
289
|
+
await screenshot(shots.sidebar);
|
|
290
|
+
// Fullscreen mode runs on the alternate screen; "normal" means regular mode.
|
|
291
|
+
console.log(`screen buffer: ${await evaluate("term.buffer.active.type")}`);
|
|
292
|
+
|
|
293
|
+
// Ctrl+D quits on an empty editor; Ctrl+C twice is the fallback.
|
|
294
|
+
await pressCtrl("d");
|
|
295
|
+
const exited = async (ms) => {
|
|
296
|
+
try {
|
|
297
|
+
await waitFor(() => runningPids(sessionDir).length === 0, ms, "shell exit");
|
|
298
|
+
return true;
|
|
299
|
+
} catch {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
if (!(await exited(5000))) {
|
|
304
|
+
await pressCtrl("c");
|
|
305
|
+
await sleep(500);
|
|
306
|
+
await pressCtrl("c");
|
|
307
|
+
if (!(await exited(5000))) notes.push("shell did not exit on Ctrl+D / Ctrl+C");
|
|
308
|
+
}
|
|
309
|
+
await sleep(500);
|
|
310
|
+
await screenshot(shots.exited);
|
|
311
|
+
await cdp.send("Browser.close").catch(() => {});
|
|
312
|
+
} catch (error) {
|
|
313
|
+
exitCode = 1;
|
|
314
|
+
console.error(`error: ${error instanceof Error ? error.message : String(error)}`);
|
|
315
|
+
} finally {
|
|
316
|
+
cdp?.close();
|
|
317
|
+
for (const child of [browser, ttyd]) if (child && child.exitCode === null) child.kill("SIGTERM");
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Anything still running from this run carries the unique scratch path in argv.
|
|
321
|
+
let leftovers = runningPids(sessionDir);
|
|
322
|
+
if (leftovers.length > 0) {
|
|
323
|
+
for (const pid of leftovers) spawnSync("kill", ["-TERM", pid]);
|
|
324
|
+
await sleep(1000);
|
|
325
|
+
leftovers = runningPids(sessionDir);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const sourceAfter = statSync(session);
|
|
329
|
+
const forks = readdirSync(sessionDir).filter((name) => name.endsWith(".jsonl"));
|
|
330
|
+
console.log(`session: ${session}`);
|
|
331
|
+
console.log(`fork: ${forks.length > 0 ? join(sessionDir, forks[0]) : "(none created)"}`);
|
|
332
|
+
console.log(`scratch: ${scratch}`);
|
|
333
|
+
console.log(`pty size at launch (rows cols): ${existsSync(sizeFile) ? readFileSync(sizeFile, "utf8").trim() : "unknown"}`);
|
|
334
|
+
if (sourceAfter.size !== sourceBefore.size || sourceAfter.mtimeMs !== sourceBefore.mtimeMs) {
|
|
335
|
+
notes.push("the source session changed during the run (another live writer?); this script only reads it");
|
|
336
|
+
}
|
|
337
|
+
if (leftovers.length > 0) notes.push(`gentle-shell processes still running: ${leftovers.join(", ")}`);
|
|
338
|
+
for (const note of notes) console.log(`note: ${note}`);
|
|
339
|
+
for (const path of written) console.log(`png: ${path}`);
|
|
340
|
+
process.exit(written.length > 0 ? exitCode : 1);
|
|
@@ -347,7 +347,7 @@ function windowsNpmInvocation() {
|
|
|
347
347
|
throw new Error("could not resolve npm-cli.js without a command shell");
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
function runNpmWithEnv(arguments_, env, options) {
|
|
350
|
+
export function runNpmWithEnv(arguments_, env, options) {
|
|
351
351
|
const invocation = process.platform === "win32" ? windowsNpmInvocation() : { file: "npm", prefix: [] };
|
|
352
352
|
return execFileSync(invocation.file, [...invocation.prefix, ...arguments_], { ...options, env });
|
|
353
353
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Regenerates assets/migrations/agent-body-history.json: the sha256 of every
|
|
3
|
+
// body (text after the frontmatter) each packaged agent has had in git
|
|
4
|
+
// history. Installation uses it to keep refreshing package agents whose
|
|
5
|
+
// frontmatter was edited locally. Run after changing any assets/agents file.
|
|
6
|
+
import { execFileSync } from "node:child_process";
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import { readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
|
|
12
|
+
const root = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
13
|
+
const agentsDir = join(root, "assets", "agents");
|
|
14
|
+
const output = join(root, "assets", "migrations", "agent-body-history.json");
|
|
15
|
+
|
|
16
|
+
// Mirrors agentBody() in lib/agent-assets.ts.
|
|
17
|
+
function agentBody(content) {
|
|
18
|
+
if (!content.startsWith("---\n")) return content;
|
|
19
|
+
const endIndex = content.indexOf("\n---", 4);
|
|
20
|
+
return endIndex === -1 ? content : content.slice(endIndex);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const hash = (content) => createHash("sha256").update(agentBody(content)).digest("hex");
|
|
24
|
+
const git = (...args) => execFileSync("git", args, { cwd: root, encoding: "utf8", maxBuffer: 64 * 1024 * 1024 });
|
|
25
|
+
|
|
26
|
+
const bodies = {};
|
|
27
|
+
for (const file of readdirSync(agentsDir).filter((name) => name.endsWith(".md")).sort()) {
|
|
28
|
+
const path = `assets/agents/${file}`;
|
|
29
|
+
const hashes = new Set([hash(readFileSync(join(agentsDir, file), "utf8"))]);
|
|
30
|
+
for (const commit of git("log", "--format=%H", "--", path).split("\n").filter(Boolean)) {
|
|
31
|
+
// A commit that deleted or renamed the file has no body to record. Any
|
|
32
|
+
// other git failure (missing objects in a partial clone) must fail loudly
|
|
33
|
+
// instead of writing a truncated history.
|
|
34
|
+
if (git("ls-tree", commit, "--", path).trim() === "") continue;
|
|
35
|
+
hashes.add(hash(git("show", `${commit}:${path}`)));
|
|
36
|
+
}
|
|
37
|
+
bodies[`agents/${file}`] = [...hashes].sort();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
writeFileSync(output, `${JSON.stringify({ schemaVersion: 1, bodies }, null, 2)}\n`);
|
|
41
|
+
console.log(`agent body history: ${Object.values(bodies).flat().length} hashes for ${Object.keys(bodies).length} agents`);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
function fail(message) { throw new Error(message); }
|
|
4
|
+
|
|
5
|
+
try {
|
|
6
|
+
// Keep the inventory tied to the actual top-level declarations and parameter modes.
|
|
7
|
+
const source = readFileSync(new URL("../tests/installer-windows-bootstrap.test.ts", import.meta.url), "utf8");
|
|
8
|
+
const names = [...source.matchAll(/^test\(("native Windows(?:[^"\\]|\\.)*")\s*,/gm)].map((match) => JSON.parse(match[1]));
|
|
9
|
+
const modesSource = /^const probeModes = \[([^\]]*)\] as const;$/m.exec(source);
|
|
10
|
+
if (!modesSource || !/^for \(const mode of probeModes\) \{\n\ttest\(`native Windows: pre-Node production process primitive \$\{mode\}`/m.test(source)) fail("native mode declarations changed");
|
|
11
|
+
const modes = JSON.parse(`[${modesSource[1]}]`);
|
|
12
|
+
if (!Array.isArray(modes) || modes.some((mode) => typeof mode !== "string")) fail("invalid native modes");
|
|
13
|
+
names.push(...modes.map((mode) => `native Windows: pre-Node production process primitive ${mode}`));
|
|
14
|
+
if (names.length !== 38 || new Set(names).size !== 38) fail("expected 38 unique native declarations");
|
|
15
|
+
|
|
16
|
+
const text = readFileSync(0, "utf8").replaceAll("\r\n", "\n");
|
|
17
|
+
if (!text.startsWith("TAP version 13\n") || !text.endsWith("\n") || [...text.matchAll(/^TAP version 13$/gm)].length !== 1) fail("missing or duplicate TAP header, or missing final newline");
|
|
18
|
+
const plans = [...text.matchAll(/^1\.\.(\d+)$/gm)];
|
|
19
|
+
const summaries = [...text.matchAll(/^# tests (\d+)\n# suites (\d+)\n# pass (\d+)\n# fail (\d+)\n# cancelled (\d+)\n# skipped (\d+)\n# todo (\d+)\n# duration_ms ([\d.]+)\n/gm)];
|
|
20
|
+
if (plans.length !== 1 || summaries.length !== 1 || summaries[0].index <= plans[0].index || summaries[0].index + summaries[0][0].length !== text.length) fail("missing, duplicate or incomplete plan/summary");
|
|
21
|
+
for (const field of ["tests", "suites", "pass", "fail", "cancelled", "skipped", "todo", "duration_ms"]) {
|
|
22
|
+
if ([...text.matchAll(new RegExp(`^# ${field} `, "gm"))].length !== 1) fail(`duplicate or missing summary field: ${field}`);
|
|
23
|
+
}
|
|
24
|
+
const results = [...text.matchAll(/^(ok|not ok) (\d+) - (.+)$/gm)];
|
|
25
|
+
const [tests, suites, pass, failed, cancelled, skipped, todo] = summaries[0].slice(1, 8).map(Number);
|
|
26
|
+
const topLevelSkips = results.filter((result) => /\s+# SKIP\b/i.test(result[3])).length;
|
|
27
|
+
if (failed || cancelled || todo || pass < 38 || tests !== pass + skipped || results.length !== Number(plans[0][1]) || results.length > tests + suites || topLevelSkips > skipped || results.length - topLevelSkips > pass + suites) fail("inconsistent TAP accounting");
|
|
28
|
+
if (results.some((result, index) => Number(result[2]) !== index + 1 || result.index >= plans[0].index || result[1] !== "ok")) fail("invalid TAP results");
|
|
29
|
+
// Node's TAP reporter escapes backslashes in names before printing them.
|
|
30
|
+
const seen = new Map(names.map((name) => [name.replaceAll("\\", "\\\\"), 0]));
|
|
31
|
+
for (const result of results) {
|
|
32
|
+
const name = result[3];
|
|
33
|
+
if (seen.has(name)) seen.set(name, seen.get(name) + 1);
|
|
34
|
+
else if (name.startsWith("native Windows")) fail(`unexpected or non-passing native result: ${name}`);
|
|
35
|
+
}
|
|
36
|
+
for (const [name, count] of seen) if (count !== 1) fail(`expected one native PASS: ${name} (found ${count})`);
|
|
37
|
+
// Top-level output consists of results, plan, header and comments. Nested TAP is indented.
|
|
38
|
+
for (const line of text.split("\n")) {
|
|
39
|
+
if (line && !line.startsWith(" ") && line !== "TAP version 13" && !line.startsWith("#") && !/^(?:ok|not ok) \d+ - .+$/.test(line) && !/^1\.\.\d+$/.test(line)) fail(`malformed top-level line: ${line}`);
|
|
40
|
+
}
|
|
41
|
+
console.log("installer TAP: 38 native passes, zero native skips");
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error(`installer TAP: ${error.message}`);
|
|
44
|
+
process.exitCode = 1;
|
|
45
|
+
}
|
|
@@ -31,6 +31,7 @@ export const requiredPaths = [
|
|
|
31
31
|
"bin/gentle-shell.mjs",
|
|
32
32
|
...installerPaths,
|
|
33
33
|
"extensions/gentle-notifications.ts",
|
|
34
|
+
"extensions/gentle-star-prompt.ts",
|
|
34
35
|
"lib/notification-audio.ts",
|
|
35
36
|
"lib/notification-audio-native.ts",
|
|
36
37
|
"lib/notification-audio-windows.ts",
|
|
@@ -41,6 +42,7 @@ export const requiredPaths = [
|
|
|
41
42
|
"lib/notification-customize.ts",
|
|
42
43
|
"lib/notification-events.ts",
|
|
43
44
|
"lib/notification-policy.ts",
|
|
45
|
+
"lib/star-prompt.ts",
|
|
44
46
|
"lib/notification-scheduler.ts",
|
|
45
47
|
"lib/notification-service.ts",
|
|
46
48
|
"lib/notification-ui.ts",
|
|
@@ -76,6 +78,8 @@ export const requiredPaths = [
|
|
|
76
78
|
"scripts/npm-pack-result.mjs",
|
|
77
79
|
"assets/orchestrator.md",
|
|
78
80
|
"assets/orchestrator-delegation.md",
|
|
81
|
+
"assets/orchestrator-full-delegation.md",
|
|
82
|
+
"assets/orchestrator-full-delegation-card.md",
|
|
79
83
|
"assets/orchestrator-delegation-reference.md",
|
|
80
84
|
"assets/orchestrator-tracking.md",
|
|
81
85
|
"assets/orchestrator-verification.md",
|
|
@@ -117,6 +121,8 @@ export const requiredPaths = [
|
|
|
117
121
|
"lib/gentle-shell-resume-hint.ts",
|
|
118
122
|
"lib/gentle-shell-import-pi.ts",
|
|
119
123
|
"lib/native-review-cli.ts",
|
|
124
|
+
"lib/review-coordinator.ts",
|
|
125
|
+
"lib/review-candidate-symlink-scan.ts",
|
|
120
126
|
"lib/status-timing-diagnostics.ts",
|
|
121
127
|
"lib/provider-contract-bundle.ts",
|
|
122
128
|
"lib/review-host-relay.ts",
|
|
@@ -142,6 +148,7 @@ export const requiredPaths = [
|
|
|
142
148
|
"runtime/review-relay-contract.mjs",
|
|
143
149
|
"runtime/telemetry-trigger.mjs",
|
|
144
150
|
"scripts/check-provider-contract.mjs",
|
|
151
|
+
"scripts/download-progress.mjs",
|
|
145
152
|
"scripts/gentle-ai-installer.mjs",
|
|
146
153
|
"scripts/install-gentle-ai.mjs",
|
|
147
154
|
"scripts/install-tui-mode-setting.mjs",
|
|
@@ -178,6 +185,11 @@ export const requiredPaths = [
|
|
|
178
185
|
"skills/cognitive-doc-design/SKILL.md",
|
|
179
186
|
"skills/comment-writer/SKILL.md",
|
|
180
187
|
"skills/design/SKILL.md",
|
|
188
|
+
"skills/gentle-ui-design/SKILL.md",
|
|
189
|
+
"skills/gentle-ui-design/references/task-and-content.md",
|
|
190
|
+
"skills/gentle-ui-design/references/browse-and-compare.md",
|
|
191
|
+
"skills/gentle-ui-design/references/composition-and-feedback.md",
|
|
192
|
+
"skills/gentle-ui-design/references/adaptive-interfaces.md",
|
|
181
193
|
"skills/gentle-ai/SKILL.md",
|
|
182
194
|
"skills/issue-creation/SKILL.md",
|
|
183
195
|
"skills/judgment-day/SKILL.md",
|
|
@@ -425,7 +437,7 @@ async function main() {
|
|
|
425
437
|
});
|
|
426
438
|
|
|
427
439
|
if (driftedContracts.length > 0) {
|
|
428
|
-
console.error("gentle-pi packaged review-integration/v1 and review-integration/v2 contract bytes drifted from the pinned v4.
|
|
440
|
+
console.error("gentle-pi packaged review-integration/v1 and review-integration/v2 contract bytes drifted from the pinned v4.4.0 runtime's vendored Gentle AI contract artifacts:");
|
|
429
441
|
for (const drift of driftedContracts) console.error(`- ${drift.relativePath}: expected ${drift.expected}, got ${drift.actual}`);
|
|
430
442
|
process.exit(1);
|
|
431
443
|
}
|
|
@@ -470,7 +482,7 @@ async function main() {
|
|
|
470
482
|
process.exit(1);
|
|
471
483
|
}
|
|
472
484
|
|
|
473
|
-
console.log(`gentle-pi package resource check passed (${requiredPaths.length} files; ${Object.keys(contractHashes).length} exact byte-pinned contract artifacts for the v4.
|
|
485
|
+
console.log(`gentle-pi package resource check passed (${requiredPaths.length} files; ${Object.keys(contractHashes).length} exact byte-pinned contract artifacts for the v4.4.0 runtime).`);
|
|
474
486
|
}
|
|
475
487
|
|
|
476
488
|
const isMainModule = process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href;
|
package/scripts/voice-worker.cjs
CHANGED
|
@@ -23,14 +23,20 @@ const { createHash } = require("node:crypto");
|
|
|
23
23
|
const { createReadStream } = require("node:fs");
|
|
24
24
|
const { lstat, readdir } = require("node:fs/promises");
|
|
25
25
|
const path = require("node:path");
|
|
26
|
+
const { release } = require("node:os");
|
|
26
27
|
const { addAbortSignal } = require("node:stream");
|
|
27
28
|
|
|
28
29
|
const SCHEMA = "gentle.voice/v1";
|
|
29
30
|
const TARGETS = ["darwin-x64", "darwin-arm64", "linux-x64", "linux-arm64", "win32-x64"];
|
|
30
31
|
const MODEL_ROLES = ["encoder", "decoder", "joiner", "tokens"];
|
|
31
|
-
// The only runtime files ever loaded;
|
|
32
|
+
// The only runtime files ever loaded; sherpa-onnx and the default capture
|
|
33
|
+
// facade must be listed as required files, the PulseAudio facade is required
|
|
34
|
+
// only where it is selected.
|
|
32
35
|
const SHERPA_ENTRY = "node_modules/sherpa-onnx-node/non-streaming-asr.js";
|
|
33
36
|
const CPAL_ENTRY = "node_modules/node-cpal/index.js";
|
|
37
|
+
// The PulseAudio facade loads its own native file: bin/backend-pulseaudio/<target>/index.node.
|
|
38
|
+
const PULSE_ENTRY = "node_modules/node-cpal/backend-pulseaudio.js";
|
|
39
|
+
const pulseNative = (target) => `node_modules/node-cpal/bin/backend-pulseaudio/${target}/index.node`;
|
|
34
40
|
const MAX_INPUT_LINE = 64 * 1024;
|
|
35
41
|
const MAX_TREE_ENTRIES = 256;
|
|
36
42
|
const MAX_TEXT = 16 * 1024;
|
|
@@ -127,9 +133,13 @@ function sha256(openRead, file, signal) {
|
|
|
127
133
|
});
|
|
128
134
|
}
|
|
129
135
|
|
|
130
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Fails with `runtime-invalid` unless every file the request names, plus the
|
|
138
|
+
* `extraFiles` a selected backend needs, exists in the validated runtime tree.
|
|
139
|
+
*/
|
|
140
|
+
async function validateRuntime(runtime, uid, extraFiles = []) {
|
|
131
141
|
const files = await readTree(runtime.root, uid, "runtime-invalid");
|
|
132
|
-
for (const required of runtime.files) if (!files.has(required)) fail("runtime-invalid");
|
|
142
|
+
for (const required of [...runtime.files, ...extraFiles]) if (!files.has(required)) fail("runtime-invalid");
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
async function validateModel(model, uid, openRead, signal) {
|
|
@@ -267,17 +277,27 @@ class WorkerSession {
|
|
|
267
277
|
fail("invalid-request");
|
|
268
278
|
}
|
|
269
279
|
|
|
280
|
+
/**
|
|
281
|
+
* Validates the runtime, picks the capture backend for this kernel and opens
|
|
282
|
+
* the microphone; the model is verified later, while recording.
|
|
283
|
+
*/
|
|
270
284
|
async begin(request) {
|
|
271
285
|
this.state = "loading";
|
|
272
286
|
const { io } = this;
|
|
273
287
|
if (request.target !== `${io.platform}-${io.arch}`) fail("runtime-invalid");
|
|
288
|
+
// WSLg exposes audio through a PulseAudio server, not an ALSA device, so a
|
|
289
|
+
// Microsoft kernel selects node-cpal's PulseAudio facade. That facade falls
|
|
290
|
+
// back to the default binary when its own native file is missing, so the
|
|
291
|
+
// facade and its native file are validated before anything is loaded.
|
|
292
|
+
const usePulse = io.platform === "linux" && /microsoft/i.test(io.kernelRelease ?? "");
|
|
293
|
+
const captureEntry = usePulse ? PULSE_ENTRY : CPAL_ENTRY;
|
|
274
294
|
// A cancel can arrive during any await; each step re-checks before going on.
|
|
275
|
-
await validateRuntime(request.runtime, io.uid);
|
|
295
|
+
await validateRuntime(request.runtime, io.uid, usePulse ? [PULSE_ENTRY, pulseNative(request.target)] : []);
|
|
276
296
|
if (this.state !== "loading") return;
|
|
277
297
|
this.request = request;
|
|
278
298
|
let cpal;
|
|
279
299
|
try {
|
|
280
|
-
cpal = io.loadModule(this.fromRuntime(
|
|
300
|
+
cpal = io.loadModule(this.fromRuntime(captureEntry));
|
|
281
301
|
} catch {
|
|
282
302
|
fail("runtime-load");
|
|
283
303
|
}
|
|
@@ -347,7 +367,12 @@ class WorkerSession {
|
|
|
347
367
|
deviceId: device.deviceId,
|
|
348
368
|
config,
|
|
349
369
|
onData: (data) => this.onData(data),
|
|
350
|
-
|
|
370
|
+
// A buffer underrun or overrun drops some audio but the stream keeps
|
|
371
|
+
// running; WASAPI reports one at start on some devices.
|
|
372
|
+
onError: (error) => {
|
|
373
|
+
if (isRecord(error) && error.code === "XRUN") return;
|
|
374
|
+
void this.fail(new WorkerFailure("capture"));
|
|
375
|
+
},
|
|
351
376
|
autoStart: true,
|
|
352
377
|
queueCapacityBuffers: 64,
|
|
353
378
|
});
|
|
@@ -464,6 +489,7 @@ if (require.main === module) {
|
|
|
464
489
|
exit: (code) => process.stdout.write("", () => process.exit(code)),
|
|
465
490
|
loadModule: (file) => require(file),
|
|
466
491
|
platform: process.platform,
|
|
492
|
+
kernelRelease: release(),
|
|
467
493
|
arch: process.arch,
|
|
468
494
|
nodeVersion: process.versions.node,
|
|
469
495
|
uid: typeof process.getuid === "function" ? process.getuid() : undefined,
|
package/skills/design/SKILL.md
CHANGED
|
@@ -48,10 +48,11 @@ Run this gate before every new brief: call the `gentle_design` tool with `action
|
|
|
48
48
|
## Execution Steps
|
|
49
49
|
|
|
50
50
|
1. Take the brief: goal, layout, content, audience.
|
|
51
|
-
2.
|
|
52
|
-
3.
|
|
53
|
-
4.
|
|
54
|
-
5. Write `design/<slug>/
|
|
51
|
+
2. Load `gentle-ui-design`: read its `SKILL.md` and only the references that match the brief's audience, primary job, and success condition. This skill owns delivery; that one owns UX quality.
|
|
52
|
+
3. Choose a kebab-case slug from the brief.
|
|
53
|
+
4. Make the directions differ in structure or visual strategy, not only in color. Label each with the tradeoff it makes.
|
|
54
|
+
5. Write `design/<slug>/NN-<name>.html` per artboard (`01-…`, `02-…`; kebab-case name).
|
|
55
|
+
6. Write `design/<slug>/design.json`:
|
|
55
56
|
|
|
56
57
|
```json
|
|
57
58
|
{
|
|
@@ -65,9 +66,10 @@ Run this gate before every new brief: call the `gentle_design` tool with `action
|
|
|
65
66
|
}
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
7. Set `width`/`height` to the artboard's intended viewport in CSS pixels; keep the manifest in sync with the files on every change. Fields: `title`, `brief`, optional `feature`, and `artboards[]` with `file`, `title`, `tradeoff`, `width`, `height`.
|
|
70
|
+
8. ODD link: when the design comes from a tracked ODD feature (an existing `odd/tasks/<feature>.md` for the current work), set `feature` to that path and append one entry to that document's `## Log` naming `design/<slug>/` and its artboards. When an artboard of that design is handed off to implement, the Log entry also names the chosen artboard (the one handed off; `list` reports it as `Chosen`) and that the others are alternatives. For small untracked work, omit `feature` and leave the design standalone; never create a feature document just to link it.
|
|
71
|
+
9. UX self-check, for every artboard you finish: pass it against the `gentle-ui-design` composition-and-feedback (hierarchy, density, feedback) and adaptive-interfaces (narrow screens, input access, states) guidance, and fix every gap before you report.
|
|
72
|
+
10. After writing or changing artboards, call the `gentle_design` tool with `action: "open"` and the slug, unless the user said not to. When a canvas tab is already open it refreshes that tab instead of opening a new one, so call it after every change. Report the URL it returns.
|
|
71
73
|
|
|
72
74
|
## Design system sync
|
|
73
75
|
|
|
@@ -103,8 +105,9 @@ Never delete or reorder entries, and keep the file valid JSON: the canvas refuse
|
|
|
103
105
|
|
|
104
106
|
## Output Contract
|
|
105
107
|
|
|
106
|
-
Return: the slug, each artboard file with its title and tradeoff, which files changed in this turn, the comment ids resolved in this turn, and any open question. Give the canvas URL from step
|
|
108
|
+
Return: the slug, each artboard file with its title and tradeoff, which files changed in this turn, the comment ids resolved in this turn, and any open question. Give the canvas URL from step 10, or mention that `/gentle:design open <slug>` shows the canvas when you did not open it. For a sync, return the source paths read, the token counts per group, and whether the system is a proposed starter; after an automatic sync from "Before designing", say it ran and report it the same way.
|
|
107
109
|
|
|
108
110
|
## References
|
|
109
111
|
|
|
110
112
|
- `design/system.md` in the project, when present — the design tokens to follow.
|
|
113
|
+
- `gentle-ui-design` skill — UX quality guidance paired with every artboard.
|