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
|
@@ -13,9 +13,16 @@ export const THINKING_LEVELS = [
|
|
|
13
13
|
|
|
14
14
|
export type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
15
15
|
|
|
16
|
+
export type ServiceTier = "standard" | "fast";
|
|
17
|
+
|
|
18
|
+
export function isServiceTier(value: unknown): value is ServiceTier {
|
|
19
|
+
return value === "standard" || value === "fast";
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
export interface AgentRoutingEntry {
|
|
17
23
|
model?: string;
|
|
18
24
|
thinking?: ThinkingLevel;
|
|
25
|
+
tier?: ServiceTier;
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
export type AgentModelConfig = Record<string, AgentRoutingEntry>;
|
|
@@ -73,10 +80,11 @@ export function normalizeRoutingEntry(value: unknown): AgentRoutingEntry | undef
|
|
|
73
80
|
: isThinkingLevel(value.effort)
|
|
74
81
|
? value.effort
|
|
75
82
|
: undefined;
|
|
76
|
-
|
|
83
|
+
const tier = isServiceTier(value.tier) ? value.tier : undefined;
|
|
84
|
+
if (!model && !thinking && !tier) {
|
|
77
85
|
return Object.keys(value).length === 0 ? {} : undefined;
|
|
78
86
|
}
|
|
79
|
-
return { model, thinking };
|
|
87
|
+
return { model, thinking, ...(tier === undefined ? {} : { tier }) };
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
export function normalizeModelConfig(value: unknown): AgentModelConfig | undefined {
|
|
@@ -123,13 +131,31 @@ export async function readModelConfigFileAsync(
|
|
|
123
131
|
}
|
|
124
132
|
}
|
|
125
133
|
|
|
134
|
+
// A present global config must merge with, not fully shadow, the legacy project
|
|
135
|
+
// config: project-only entries still apply, same-name entries prefer global.
|
|
136
|
+
function mergeSavedModelConfig(
|
|
137
|
+
globalResult: ModelConfigFileResult,
|
|
138
|
+
projectResult: ModelConfigFileResult,
|
|
139
|
+
): ModelConfigFileResult {
|
|
140
|
+
if (globalResult.status === "invalid") return globalResult;
|
|
141
|
+
if (projectResult.status === "invalid") return projectResult;
|
|
142
|
+
if (globalResult.status === "missing" && projectResult.status === "missing") return { status: "missing" };
|
|
143
|
+
return {
|
|
144
|
+
status: "valid",
|
|
145
|
+
config: {
|
|
146
|
+
...(projectResult.status === "valid" ? projectResult.config : {}),
|
|
147
|
+
...(globalResult.status === "valid" ? globalResult.config : {}),
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
126
152
|
export function readSavedModelConfig(
|
|
127
153
|
globalPath: string,
|
|
128
154
|
projectPath: string,
|
|
129
155
|
): ModelConfigFileResult {
|
|
130
156
|
const globalResult = readModelConfigFile(globalPath);
|
|
131
|
-
if (globalResult.status
|
|
132
|
-
return readModelConfigFile(projectPath);
|
|
157
|
+
if (globalResult.status === "invalid") return globalResult;
|
|
158
|
+
return mergeSavedModelConfig(globalResult, readModelConfigFile(projectPath));
|
|
133
159
|
}
|
|
134
160
|
|
|
135
161
|
export async function readSavedModelConfigAsync(
|
|
@@ -137,6 +163,6 @@ export async function readSavedModelConfigAsync(
|
|
|
137
163
|
projectPath: string,
|
|
138
164
|
): Promise<ModelConfigFileResult> {
|
|
139
165
|
const globalResult = await readModelConfigFileAsync(globalPath);
|
|
140
|
-
if (globalResult.status
|
|
141
|
-
return readModelConfigFileAsync(projectPath);
|
|
166
|
+
if (globalResult.status === "invalid") return globalResult;
|
|
167
|
+
return mergeSavedModelConfig(globalResult, await readModelConfigFileAsync(projectPath));
|
|
142
168
|
}
|
package/lib/nan-provider.ts
CHANGED
|
@@ -20,7 +20,8 @@ const ZERO_COST = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
|
20
20
|
// Decimal bounds conservatively interpret the documented 1M/262K/131K labels.
|
|
21
21
|
// Pi models text/image inputs only; documented audio/video inputs are not advertised.
|
|
22
22
|
// Reasoning shares max_tokens with the answer: 65,536 leaves answer room after a
|
|
23
|
-
// 32,768 reasoning budget; DeepSeek
|
|
23
|
+
// 32,768 reasoning budget; DeepSeek gets a generous 131,072 output budget: NaN counts reasoning
|
|
24
|
+
// against max_tokens and dense review prompts exceed 16K reasoning tokens (gentle-shell#2840). Qwen 3.8 retains its
|
|
24
25
|
// published 131K output maximum. The remaining 32,768 caps are configured, not NaN-published limits.
|
|
25
26
|
// Pi requires explicit max mappings to offer that level; a null hides a level Pi would otherwise
|
|
26
27
|
// offer, and missing ordinary levels pass through. Each map exposes exactly the efforts NaN's
|
|
@@ -56,7 +57,7 @@ const CHAT_MODELS: NanChatModelConfig[] = ([
|
|
|
56
57
|
},
|
|
57
58
|
{
|
|
58
59
|
id: "deepseek-v4-flash", name: "DeepSeek V4 Flash", input: ["text", "image"], contextWindow: 1_000_000,
|
|
59
|
-
thinkingLevelMap: EXTENDED_THINKING_LEVEL_MAP, maxTokens:
|
|
60
|
+
thinkingLevelMap: EXTENDED_THINKING_LEVEL_MAP, maxTokens: 131_072,
|
|
60
61
|
// NaN's DeepSeek route enforces this field, not max_completion_tokens.
|
|
61
62
|
compat: { maxTokensField: "max_tokens" },
|
|
62
63
|
},
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
type TuiMouseEventResult,
|
|
10
10
|
} from "@earendil-works/pi-tui";
|
|
11
11
|
import { NativePointerScope } from "./native-pointer-region.ts";
|
|
12
|
+
import { paintHoverable } from "./shell-hover.ts";
|
|
12
13
|
|
|
13
14
|
export interface NativeChoiceItem {
|
|
14
15
|
id: string;
|
|
@@ -20,6 +21,8 @@ export interface NativeChoiceListTheme {
|
|
|
20
21
|
selectedPrefix(text: string): string;
|
|
21
22
|
selectedText(text: string): string;
|
|
22
23
|
description(text: string): string;
|
|
24
|
+
/** Semantic foreground from the host theme; older callers may still supply a background. */
|
|
25
|
+
fg?(role: string, text: string): string;
|
|
23
26
|
hoverBackground(text: string): string;
|
|
24
27
|
}
|
|
25
28
|
|
|
@@ -64,6 +67,7 @@ export class NativeChoiceList<T extends NativeChoiceItem> extends Container {
|
|
|
64
67
|
|
|
65
68
|
/** Refresh rendered rows after callers update the existing item records. */
|
|
66
69
|
refreshItems(): void {
|
|
70
|
+
this.invalidate();
|
|
67
71
|
this.refreshRows();
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -85,6 +89,9 @@ export class NativeChoiceList<T extends NativeChoiceItem> extends Container {
|
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
override handleMouse(event: TuiMouseEvent) {
|
|
92
|
+
if (this.disabled || this.renderedWidth !== event.width ||
|
|
93
|
+
!Number.isFinite(event.x) || !Number.isFinite(event.y) ||
|
|
94
|
+
event.x < 0 || event.x >= event.width || event.y < 0 || event.y >= event.height) return undefined;
|
|
88
95
|
const result = super.handleMouse(event);
|
|
89
96
|
if (result || this.disabled || event.type !== "wheel" || !event.wheelDelta) return result;
|
|
90
97
|
const before = this.selected;
|
|
@@ -114,6 +121,7 @@ export class NativeChoiceList<T extends NativeChoiceItem> extends Container {
|
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
override render(width: number): string[] {
|
|
124
|
+
if (!Number.isFinite(width)) return [];
|
|
117
125
|
if (this.renderedWidth !== width) {
|
|
118
126
|
this.renderedWidth = width;
|
|
119
127
|
this.pointerScope.invalidate();
|
|
@@ -127,9 +135,17 @@ export class NativeChoiceList<T extends NativeChoiceItem> extends Container {
|
|
|
127
135
|
super.invalidate();
|
|
128
136
|
}
|
|
129
137
|
|
|
138
|
+
dispose(): void {
|
|
139
|
+
this.setDisabled(true);
|
|
140
|
+
this.pointerScope.dispose();
|
|
141
|
+
this.invalidate();
|
|
142
|
+
}
|
|
143
|
+
|
|
130
144
|
private addRow(item: T): void {
|
|
131
145
|
const text = new Text("", 1, 0);
|
|
132
|
-
const box = new Box(0, 0, (value) =>
|
|
146
|
+
const box = new Box(0, 0, (value) =>
|
|
147
|
+
!this.theme.fg && this.hovered === item.id ? this.theme.hoverBackground(value) : value,
|
|
148
|
+
);
|
|
133
149
|
box.addChild(text);
|
|
134
150
|
this.rows.push({ item, text, box });
|
|
135
151
|
this.addChild(this.pointerScope.wrap(box, {
|
|
@@ -188,7 +204,9 @@ export class NativeChoiceList<T extends NativeChoiceItem> extends Container {
|
|
|
188
204
|
private refreshRows(): void {
|
|
189
205
|
for (const [index, row] of this.rows.entries()) {
|
|
190
206
|
const prefix = index === this.selected ? this.theme.selectedPrefix("→ ") : " ";
|
|
191
|
-
const label =
|
|
207
|
+
const label = this.theme.fg && this.hovered === row.item.id
|
|
208
|
+
? paintHoverable({ fg: this.theme.fg }, row.item.label, true)
|
|
209
|
+
: index === this.selected ? this.theme.selectedText(row.item.label) : row.item.label;
|
|
192
210
|
const text = row.item.description
|
|
193
211
|
? `${prefix}${label}\n ${this.theme.description(row.item.description)}`
|
|
194
212
|
: `${prefix}${label}`;
|
package/lib/native-review-cli.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { chmod, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { dirname, isAbsolute, join, posix, win32 } from "node:path";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
|
-
import { gentleAiIsolationEnv, PackageLocalGentleAiBinaryMissingError, resolveGentleAiBinary } from "./gentle-ai-binary.ts";
|
|
6
|
+
import { binaryDigest, gentleAiIsolationEnv, PackageLocalGentleAiBinaryMissingError, resolveGentleAiBinary } from "./gentle-ai-binary.ts";
|
|
7
7
|
import { GENTLE_PI_REVIEW_RELAY_CONTRACT, GENTLE_PI_REVIEW_RELAY_CONTRACT_ENV } from "./review-relay-contract.ts";
|
|
8
8
|
import { decodeReviewAssessmentV1, type ReviewAssessmentV1 } from "./review-risk-assessment.ts";
|
|
9
9
|
import {
|
|
10
10
|
REVIEW_INTEGRATION_CONTRACT,
|
|
11
11
|
decodeReviewAcknowledgedV1,
|
|
12
|
+
decodeReviewCapabilitiesV2,
|
|
12
13
|
decodeReviewConsentV2,
|
|
13
14
|
decodeReviewConsentV3,
|
|
14
15
|
decodeReviewFailureV2,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
decodeReviewStartV3,
|
|
19
20
|
decodeReviewStartV4,
|
|
20
21
|
decodeReviewStatusV3,
|
|
22
|
+
intendedUntrackedSubmissionCarriesTarget,
|
|
21
23
|
type ReviewAcknowledgedExpectationV1,
|
|
22
24
|
type ReviewAcknowledgedV1,
|
|
23
25
|
type ReviewConsentEnvelope,
|
|
@@ -157,10 +159,13 @@ export const NATIVE_REVIEW_MODE_SCOPE = {
|
|
|
157
159
|
BOTH: "both",
|
|
158
160
|
} as const;
|
|
159
161
|
export type NativeReviewModeScope = (typeof NATIVE_REVIEW_MODE_SCOPE)[keyof typeof NATIVE_REVIEW_MODE_SCOPE];
|
|
162
|
+
export type NativeReviewModeMutationScope = typeof NATIVE_REVIEW_MODE_SCOPE.CLONE | typeof NATIVE_REVIEW_MODE_SCOPE.GLOBAL;
|
|
160
163
|
|
|
161
164
|
export interface NativeReviewModeRequest {
|
|
162
165
|
cwd: string;
|
|
163
166
|
operation: NativeReviewModeOperation;
|
|
167
|
+
/** Mutation scope is explicit when global; omitted mutations remain clone-local. Status takes no scope. */
|
|
168
|
+
scope?: NativeReviewModeMutationScope;
|
|
164
169
|
signal?: AbortSignal;
|
|
165
170
|
}
|
|
166
171
|
|
|
@@ -537,7 +542,20 @@ export interface NativeLensSelectionRequest {
|
|
|
537
542
|
lensesReason?: string;
|
|
538
543
|
}
|
|
539
544
|
|
|
540
|
-
|
|
545
|
+
/** Explicit request file; native owns reading, freezing, sizing and identity. */
|
|
546
|
+
interface NativeRequestContextSelection {
|
|
547
|
+
requestContextPath?: string;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
export const NATIVE_REQUEST_CONTEXT_UNSUPPORTED_MESSAGE = "provider does not support request context";
|
|
551
|
+
|
|
552
|
+
function nativeRequestContextArguments(request: NativeRequestContextSelection): readonly string[] {
|
|
553
|
+
if (request.requestContextPath === undefined) return [];
|
|
554
|
+
if (!isCanonicalProcessString(request.requestContextPath)) throw new TypeError("Native requestContextPath must be a non-empty, trimmed, NUL-free string");
|
|
555
|
+
return ["--request-context", request.requestContextPath];
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export interface NativeStartRequest extends NativeUntrackedSelectionRequest, NativeLensSelectionRequest, NativeRequestContextSelection {
|
|
541
559
|
cwd: string;
|
|
542
560
|
baseRef?: string;
|
|
543
561
|
committedOnly?: boolean;
|
|
@@ -550,7 +568,7 @@ export interface NativeStartRequest extends NativeUntrackedSelectionRequest, Nat
|
|
|
550
568
|
}
|
|
551
569
|
export const NATIVE_REVIEW_CONSENT_ANSWER = { GRANTED: "granted", DECLINED: "declined" } as const;
|
|
552
570
|
export type NativeReviewConsentAnswer = (typeof NATIVE_REVIEW_CONSENT_ANSWER)[keyof typeof NATIVE_REVIEW_CONSENT_ANSWER];
|
|
553
|
-
export interface NativeReviewConsentAnswerRequest { cwd: string; consent: ReviewConsentEnvelope; answer: NativeReviewConsentAnswer; signal?: AbortSignal; }
|
|
571
|
+
export interface NativeReviewConsentAnswerRequest extends NativeRequestContextSelection { cwd: string; consent: ReviewConsentEnvelope; answer: NativeReviewConsentAnswer; signal?: AbortSignal; }
|
|
554
572
|
export interface NativeReviewConsentDeclinedResult {
|
|
555
573
|
kind: "declined";
|
|
556
574
|
targetIdentity: string;
|
|
@@ -564,7 +582,7 @@ export interface NativeReviewConsentDeclinedResult {
|
|
|
564
582
|
export interface NativeReviewConsentStartedResult { kind: "started"; start: NativeStartResult; }
|
|
565
583
|
export type NativeReviewConsentAnswerResult = NativeReviewConsentStartedResult | NativeReviewConsentDeclinedResult;
|
|
566
584
|
export interface NativeReviewStatusRequest { cwd: string; signal?: AbortSignal; }
|
|
567
|
-
export interface NativeTargetStatusRequest extends NativeUntrackedSelectionRequest, NativeLensSelectionRequest {
|
|
585
|
+
export interface NativeTargetStatusRequest extends NativeUntrackedSelectionRequest, NativeLensSelectionRequest, NativeRequestContextSelection {
|
|
568
586
|
cwd: string;
|
|
569
587
|
lineageId?: string;
|
|
570
588
|
baseRef?: string;
|
|
@@ -1097,6 +1115,13 @@ export const NATIVE_CLI_CONTRACTS = Object.freeze({
|
|
|
1097
1115
|
// The v4.3.0 tag has no release and is never pinned.
|
|
1098
1116
|
// No new negotiated capability identity is asserted.
|
|
1099
1117
|
"4.3.1": Object.freeze({ start: true, finalize: true, validate: true, bindSdd: true, status: true, inventory: true, reclaim: true, recover: true, abandon: true, quarantineLegacy: true, reconcileAuthority: true, repairLegacyAlias: true, mode: true, riskEvidence: false, hint: false, delivery: true }),
|
|
1118
|
+
// v4.4.0 repeats 4.3.1: the published binary still advertises
|
|
1119
|
+
// capabilities/v2.6 under review-integration/v2 with the same capabilities
|
|
1120
|
+
// payload apart from build identity, and the provider contract stays at
|
|
1121
|
+
// 1.4.0, with published tarball SHA-256
|
|
1122
|
+
// 58450471280aeb357443d6a28c819132d8c8eb78dd25b12bac64296b2f8c27c2.
|
|
1123
|
+
// No new negotiated capability identity is asserted.
|
|
1124
|
+
"4.4.0": Object.freeze({ start: true, finalize: true, validate: true, bindSdd: true, status: true, inventory: true, reclaim: true, recover: true, abandon: true, quarantineLegacy: true, reconcileAuthority: true, repairLegacyAlias: true, mode: true, riskEvidence: false, hint: false, delivery: true }),
|
|
1100
1125
|
});
|
|
1101
1126
|
|
|
1102
1127
|
export interface NativeReviewProcessDiagnostics {
|
|
@@ -1475,6 +1500,16 @@ function decodeNativeReviewStatus(value: unknown): NativeReviewStatusResult {
|
|
|
1475
1500
|
raw: body,
|
|
1476
1501
|
};
|
|
1477
1502
|
}
|
|
1503
|
+
function nativeReviewModeScopeArguments(operation: NativeReviewModeOperation, scope: NativeReviewModeMutationScope | undefined): string[] {
|
|
1504
|
+
if (scope !== undefined && scope !== NATIVE_REVIEW_MODE_SCOPE.CLONE && scope !== NATIVE_REVIEW_MODE_SCOPE.GLOBAL) {
|
|
1505
|
+
throw new TypeError("Native review mode scope must be clone or global");
|
|
1506
|
+
}
|
|
1507
|
+
if (scope !== undefined && operation !== NATIVE_REVIEW_MODE_OPERATION.ENABLE && operation !== NATIVE_REVIEW_MODE_OPERATION.DISABLE) {
|
|
1508
|
+
throw new TypeError("Native review mode scope is only valid for enable or disable");
|
|
1509
|
+
}
|
|
1510
|
+
return operation === NATIVE_REVIEW_MODE_OPERATION.STATUS ? [] : ["--scope", scope ?? NATIVE_REVIEW_MODE_SCOPE.CLONE];
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1478
1513
|
function isWindowsRepositoryPath(value: string): boolean { return /^[A-Za-z]:[\\/]/.test(value) || /^\\\\/.test(value); }
|
|
1479
1514
|
export function normalizeNativeReviewCwd(value: string, platform: NodeJS.Platform = process.platform): string {
|
|
1480
1515
|
if (platform !== "win32") return value;
|
|
@@ -1666,22 +1701,21 @@ class NativeReviewPlainCli {
|
|
|
1666
1701
|
return status;
|
|
1667
1702
|
}
|
|
1668
1703
|
|
|
1669
|
-
//
|
|
1670
|
-
//
|
|
1671
|
-
// exact fixed argv per the design's data flow); `enable`/`disable` mutate
|
|
1672
|
-
// and always pass `--scope clone` so Pi's own kill-switch command surface
|
|
1673
|
-
// never mutates the operator's global gentle-ai state across other clones.
|
|
1704
|
+
// Status stays read-only; mutation defaults to clone unless the caller
|
|
1705
|
+
// explicitly supplies global. Validate scope before cwd or process access.
|
|
1674
1706
|
async reviewMode(request: NativeReviewModeRequest): Promise<NativeReviewModeResult> {
|
|
1707
|
+
const operation = request.operation;
|
|
1708
|
+
const scopeArguments = nativeReviewModeScopeArguments(operation, request.scope);
|
|
1675
1709
|
const cwd = await canonicalNativeReviewCwd(request.cwd);
|
|
1676
|
-
const mutating =
|
|
1710
|
+
const mutating = operation !== NATIVE_REVIEW_MODE_OPERATION.STATUS;
|
|
1677
1711
|
const { body } = await this.execute(
|
|
1678
1712
|
NATIVE_REVIEW_OPERATION.MODE,
|
|
1679
1713
|
cwd,
|
|
1680
|
-
["review", "mode",
|
|
1714
|
+
["review", "mode", operation, "--cwd", cwd, ...scopeArguments, "--json"],
|
|
1681
1715
|
mutating,
|
|
1682
1716
|
request.signal,
|
|
1683
1717
|
);
|
|
1684
|
-
return decode(NATIVE_REVIEW_OPERATION.MODE, mutating, () => decodeNativeReviewMode(body,
|
|
1718
|
+
return decode(NATIVE_REVIEW_OPERATION.MODE, mutating, () => decodeNativeReviewMode(body, operation));
|
|
1685
1719
|
}
|
|
1686
1720
|
|
|
1687
1721
|
async reclaim(request: NativeReviewReclaimRequest): Promise<NativeReviewRecoveryResult> {
|
|
@@ -1927,12 +1961,14 @@ export class NativeReviewIntegrationError extends Error {
|
|
|
1927
1961
|
// answer only through one of the exact invocations carried by the envelope.
|
|
1928
1962
|
export class NativeReviewConsentRequiredError extends Error {
|
|
1929
1963
|
readonly consent: ReviewConsentEnvelope;
|
|
1964
|
+
readonly requestContextPath?: string;
|
|
1930
1965
|
readonly launchAttempted = true;
|
|
1931
1966
|
readonly mutationOutcome = "none";
|
|
1932
|
-
constructor(consent: ReviewConsentEnvelope) {
|
|
1967
|
+
constructor(consent: ReviewConsentEnvelope, requestContextPath?: string) {
|
|
1933
1968
|
super(consent.headline);
|
|
1934
1969
|
this.name = "NativeReviewConsentRequiredError";
|
|
1935
1970
|
this.consent = consent;
|
|
1971
|
+
this.requestContextPath = requestContextPath;
|
|
1936
1972
|
}
|
|
1937
1973
|
}
|
|
1938
1974
|
|
|
@@ -2063,6 +2099,10 @@ function consentInvocationArguments(request: NativeReviewConsentAnswerRequest):
|
|
|
2063
2099
|
const words = splitNativeConsentInvocation(choice.invocation);
|
|
2064
2100
|
if (words[0] !== "gentle-ai" || words[1] !== "review" || words[2] !== "start") throw new NativeReviewConsentBindingError("consent-invocation-not-start", "Native consent invocation is not a provider review START");
|
|
2065
2101
|
const arguments_ = words.slice(1);
|
|
2102
|
+
if (request.requestContextPath !== undefined) {
|
|
2103
|
+
const values = arguments_.flatMap((token, index) => token === "--request-context" ? [arguments_[index + 1]] : token.startsWith("--request-context=") ? [token.slice("--request-context=".length)] : []);
|
|
2104
|
+
if (values.length !== 1 || values[0] !== request.requestContextPath) throw new NativeReviewConsentBindingError("consent-invocation-request-context-changed", "Native consent invocation did not retain the requested context file");
|
|
2105
|
+
}
|
|
2066
2106
|
if (exactConsentOption(arguments_, "--contract") !== REVIEW_INTEGRATION_CONTRACT) throw new NativeReviewConsentBindingError("consent-invocation-contract-changed", "Native consent invocation contract changed");
|
|
2067
2107
|
const providerCwd = exactConsentOption(arguments_, "--cwd");
|
|
2068
2108
|
const requestedCwd = normalizeNativeReviewCwd(request.cwd);
|
|
@@ -2164,6 +2204,8 @@ function decodeNativeUnachievableLensCaptureArtifact(value: unknown): NativeRevi
|
|
|
2164
2204
|
}
|
|
2165
2205
|
|
|
2166
2206
|
export class NativeReviewCliV216 implements NativeReviewCli {
|
|
2207
|
+
// Only executable capabilities are reusable. STATUS and authority remain fresh.
|
|
2208
|
+
private contextCapabilities?: { executable: string; digest: string; value: ReturnType<typeof decodeReviewCapabilitiesV2> };
|
|
2167
2209
|
private readonly plain: NativeReviewPlainCli;
|
|
2168
2210
|
private readonly adapter: ExecFileAdapter;
|
|
2169
2211
|
private readonly executable: string | (() => string);
|
|
@@ -2266,6 +2308,7 @@ export class NativeReviewCliV216 implements NativeReviewCli {
|
|
|
2266
2308
|
const selection = nativeUntrackedSelection(request);
|
|
2267
2309
|
const statusRequest: NativeTargetStatusRequest = {
|
|
2268
2310
|
cwd: request.cwd,
|
|
2311
|
+
...(request.requestContextPath === undefined ? {} : { requestContextPath: request.requestContextPath }),
|
|
2269
2312
|
projection,
|
|
2270
2313
|
...(request.baseRef === undefined ? {} : { baseRef: request.baseRef, committedOnly: true }),
|
|
2271
2314
|
...(request.lineageId === undefined ? {} : { lineageId: request.lineageId }),
|
|
@@ -2299,6 +2342,10 @@ export class NativeReviewCliV216 implements NativeReviewCli {
|
|
|
2299
2342
|
return argument.token;
|
|
2300
2343
|
});
|
|
2301
2344
|
const targetIdentity = status.targetIdentity;
|
|
2345
|
+
if (request.requestContextPath !== undefined) {
|
|
2346
|
+
const values = transitionTokens.flatMap((token, index) => token === "--request-context" ? [transitionTokens[index + 1]] : token.startsWith("--request-context=") ? [token.slice("--request-context=".length)] : []);
|
|
2347
|
+
if (values.length !== 1 || values[0] !== request.requestContextPath) throw nativeError(NATIVE_REVIEW_ERROR_CODE.IDENTITY_MISMATCH, NATIVE_REVIEW_OPERATION.START, false, "native START transition did not retain the requested context file", undefined, false);
|
|
2348
|
+
}
|
|
2302
2349
|
const execution = await this.negotiated(NATIVE_REVIEW_OPERATION.START, request.cwd, ["review", "start", ...transitionTokens], true, request.signal);
|
|
2303
2350
|
// A negotiated v2 START may answer a consent question (action:
|
|
2304
2351
|
// "consent_required") instead of `start/v3` when the provider needs an
|
|
@@ -2316,7 +2363,10 @@ export class NativeReviewCliV216 implements NativeReviewCli {
|
|
|
2316
2363
|
return decoded;
|
|
2317
2364
|
});
|
|
2318
2365
|
if (consent.targetIdentity !== targetIdentity || consent.projection !== projection) throw nativeError(NATIVE_REVIEW_ERROR_CODE.IDENTITY_MISMATCH, NATIVE_REVIEW_OPERATION.START, true, "native consent target binding mismatch");
|
|
2319
|
-
|
|
2366
|
+
if (request.requestContextPath !== undefined) {
|
|
2367
|
+
for (const choice of consent.choices) consentInvocationArguments({ cwd: request.cwd, consent, answer: choice.answer, requestContextPath: request.requestContextPath });
|
|
2368
|
+
}
|
|
2369
|
+
throw new NativeReviewConsentRequiredError(consent, request.requestContextPath);
|
|
2320
2370
|
}
|
|
2321
2371
|
const result = decode(NATIVE_REVIEW_OPERATION.START, true, () => decodeReviewStartResponse(execution.body));
|
|
2322
2372
|
if (request.lineageId !== undefined && result.lineageId !== request.lineageId) throw nativeError(NATIVE_REVIEW_ERROR_CODE.IDENTITY_MISMATCH, NATIVE_REVIEW_OPERATION.START, true, "native start lineage mismatch");
|
|
@@ -2386,6 +2436,9 @@ export class NativeReviewCliV216 implements NativeReviewCli {
|
|
|
2386
2436
|
}
|
|
2387
2437
|
|
|
2388
2438
|
private async observedTargetStatus(request: NativeTargetStatusRequest): Promise<ReviewStatusV3> {
|
|
2439
|
+
// Validate locally before discovery; never probe support by sending an
|
|
2440
|
+
// unknown flag or retrying the review without its requested intent.
|
|
2441
|
+
const requestContextArguments = nativeRequestContextArguments(request);
|
|
2389
2442
|
if (request.baseRef !== undefined && !isCanonicalProcessString(request.baseRef)) throw new TypeError("Native STATUS baseRef must be a non-empty, trimmed, NUL-free string");
|
|
2390
2443
|
if (request.baseRef !== undefined && request.committedOnly !== true) throw new TypeError("Native STATUS baseRef requires explicit committedOnly acknowledgement");
|
|
2391
2444
|
if (request.baseRef === undefined && request.committedOnly !== undefined) throw new TypeError("Native STATUS committedOnly requires an explicit baseRef");
|
|
@@ -2399,7 +2452,11 @@ export class NativeReviewCliV216 implements NativeReviewCli {
|
|
|
2399
2452
|
// value for the same flag. providerFlagValue also fails closed on a
|
|
2400
2453
|
// dangling `--flag` (last token, no value) or an empty `--flag=`.
|
|
2401
2454
|
const submittedBaseRefValue = submittedTokens === undefined ? undefined : providerFlagValue(submittedTokens, "base-ref");
|
|
2402
|
-
|
|
2455
|
+
// A provider-issued base-diff selector (base tree plus scope) already binds
|
|
2456
|
+
// the target the request named; the tree is not textually comparable to
|
|
2457
|
+
// the request's ref, so it runs as issued and nothing is re-forwarded.
|
|
2458
|
+
const providerOwnsTarget = submitted !== undefined && intendedUntrackedSubmissionCarriesTarget(submitted.argumentTokens);
|
|
2459
|
+
if (!providerOwnsTarget && request.baseRef !== undefined && submittedBaseRefValue !== undefined && submittedBaseRefValue !== request.baseRef) throw new TypeError("Native intended-untracked selection already carries a conflicting base-ref");
|
|
2403
2460
|
const submittedLineageValue = submittedTokens === undefined ? undefined : providerFlagValue(submittedTokens, "lineage");
|
|
2404
2461
|
if (request.lineageId !== undefined && submittedLineageValue !== undefined && submittedLineageValue !== request.lineageId) throw new TypeError("Native intended-untracked selection already carries a conflicting lineage");
|
|
2405
2462
|
let submittedHasCommittedOnly = false;
|
|
@@ -2412,11 +2469,31 @@ export class NativeReviewCliV216 implements NativeReviewCli {
|
|
|
2412
2469
|
// Append only the half of the base-ref/committed-only pair the provider
|
|
2413
2470
|
// did not already carry (a present base-ref already equals
|
|
2414
2471
|
// request.baseRef; the throw above ruled out the conflicting case).
|
|
2415
|
-
const forwardedBaseRef = request.baseRef === undefined ? [] : [
|
|
2472
|
+
const forwardedBaseRef = request.baseRef === undefined || providerOwnsTarget ? [] : [
|
|
2416
2473
|
...(submittedBaseRefValue === undefined ? ["--base-ref", request.baseRef] : []),
|
|
2417
2474
|
...(submittedHasCommittedOnly ? [] : ["--committed-only"]),
|
|
2418
2475
|
];
|
|
2419
2476
|
const forwardedLineage = request.lineageId === undefined || submittedLineageValue !== undefined ? [] : ["--lineage", request.lineageId];
|
|
2477
|
+
let contextExecutable: string | undefined;
|
|
2478
|
+
if (requestContextArguments.length > 0) {
|
|
2479
|
+
contextExecutable = this.executablePath(NATIVE_REVIEW_OPERATION.STATUS, false);
|
|
2480
|
+
const digest = binaryDigest(contextExecutable);
|
|
2481
|
+
let capabilities = this.contextCapabilities?.executable === contextExecutable && this.contextCapabilities.digest === digest
|
|
2482
|
+
? this.contextCapabilities.value : undefined;
|
|
2483
|
+
if (capabilities === undefined) {
|
|
2484
|
+
this.contextCapabilities = undefined;
|
|
2485
|
+
const discovery = await this.invoke(NATIVE_REVIEW_OPERATION.STATUS, request.cwd,
|
|
2486
|
+
["review", "capabilities", "--contract", REVIEW_INTEGRATION_CONTRACT], false, request.signal, contextExecutable);
|
|
2487
|
+
capabilities = decode(NATIVE_REVIEW_OPERATION.STATUS, false, () => decodeReviewCapabilitiesV2(discovery.body, digest));
|
|
2488
|
+
if (binaryDigest(contextExecutable) !== digest) throw nativeError(NATIVE_REVIEW_ERROR_CODE.IDENTITY_MISMATCH,
|
|
2489
|
+
NATIVE_REVIEW_OPERATION.STATUS, false, "native executable changed during capability discovery", undefined, false);
|
|
2490
|
+
this.contextCapabilities = { executable: contextExecutable, digest, value: capabilities };
|
|
2491
|
+
}
|
|
2492
|
+
if (!["start_request_context", "start_options_preflight"].every(feature => capabilities.optionalFeatures.has(feature))) {
|
|
2493
|
+
throw nativeError(NATIVE_REVIEW_ERROR_CODE.VERSION_INCOMPATIBLE, NATIVE_REVIEW_OPERATION.STATUS, false,
|
|
2494
|
+
NATIVE_REQUEST_CONTEXT_UNSUPPORTED_MESSAGE, undefined, false);
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2420
2497
|
const statusArguments = submittedTokens === undefined ? [
|
|
2421
2498
|
"review", "status", "--contract", REVIEW_INTEGRATION_CONTRACT, "--cwd", request.cwd,
|
|
2422
2499
|
"--projection", request.projection ?? "workspace",
|
|
@@ -2425,9 +2502,12 @@ export class NativeReviewCliV216 implements NativeReviewCli {
|
|
|
2425
2502
|
...(request.lineageId === undefined ? [] : ["--lineage", request.lineageId]),
|
|
2426
2503
|
...(request.agent === undefined ? [] : ["--agent", request.agent]),
|
|
2427
2504
|
...nativeLensSelectionArguments(request),
|
|
2505
|
+
...requestContextArguments,
|
|
2428
2506
|
"--next-transition",
|
|
2429
|
-
] : ["review", "status", "--cwd", request.cwd, ...submittedTokens, ...forwardedBaseRef, ...forwardedLineage, ...nativeLensSelectionArguments(request)];
|
|
2430
|
-
const execution =
|
|
2507
|
+
] : ["review", "status", "--cwd", request.cwd, ...submittedTokens, ...forwardedBaseRef, ...forwardedLineage, ...nativeLensSelectionArguments(request), ...requestContextArguments];
|
|
2508
|
+
const execution = contextExecutable === undefined
|
|
2509
|
+
? await this.negotiated(NATIVE_REVIEW_OPERATION.STATUS, request.cwd, statusArguments, false, request.signal)
|
|
2510
|
+
: await this.invoke(NATIVE_REVIEW_OPERATION.STATUS, request.cwd, statusArguments, false, request.signal, contextExecutable);
|
|
2431
2511
|
measureStatusSync("decode", () => assertSupportedNextTransitionOperation(execution.body));
|
|
2432
2512
|
return decode(NATIVE_REVIEW_OPERATION.STATUS, false, () => decodeReviewStatusV3(execution.body));
|
|
2433
2513
|
}
|
|
@@ -2635,17 +2715,19 @@ export class NativeReviewCliV216 implements NativeReviewCli {
|
|
|
2635
2715
|
}
|
|
2636
2716
|
|
|
2637
2717
|
async reviewMode(request: NativeReviewModeRequest): Promise<NativeReviewModeResult> {
|
|
2718
|
+
const operation = request.operation;
|
|
2719
|
+
const scopeArguments = nativeReviewModeScopeArguments(operation, request.scope);
|
|
2638
2720
|
const cwd = await canonicalNativeReviewCwd(request.cwd);
|
|
2639
|
-
const mutating =
|
|
2721
|
+
const mutating = operation !== NATIVE_REVIEW_MODE_OPERATION.STATUS;
|
|
2640
2722
|
const execution = await this.invoke(
|
|
2641
2723
|
NATIVE_REVIEW_OPERATION.MODE,
|
|
2642
2724
|
cwd,
|
|
2643
|
-
["review", "mode",
|
|
2725
|
+
["review", "mode", operation, "--cwd", cwd, ...scopeArguments, "--json"],
|
|
2644
2726
|
mutating,
|
|
2645
2727
|
request.signal,
|
|
2646
2728
|
this.executablePath(NATIVE_REVIEW_OPERATION.MODE, mutating),
|
|
2647
2729
|
);
|
|
2648
|
-
return decode(NATIVE_REVIEW_OPERATION.MODE, mutating, () => decodeNativeReviewMode(execution.body,
|
|
2730
|
+
return decode(NATIVE_REVIEW_OPERATION.MODE, mutating, () => decodeNativeReviewMode(execution.body, operation));
|
|
2649
2731
|
}
|
|
2650
2732
|
|
|
2651
2733
|
// Read-only risk assessment (gentle-ai#4295, gentle-pi#662). Never mutates;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { getNotificationService, type NotificationService } from "./notification-service.ts";
|
|
8
8
|
import type { CustomizeInline, CustomizeRow } from "./visual-customize-view.ts";
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/** Inline sound options: silence, builtins, then custom. Priority belongs to the event. */
|
|
11
11
|
const SOUND_CYCLE: readonly NotificationSound[] = [null, ...BUILTIN_NOTIFICATION_IDS.map(id => `builtin:${id}` as const)];
|
|
12
12
|
/** Human labels for the builtin tones; the basic card never prints a `builtin:` id. */
|
|
13
13
|
const HUMAN_TONES: Readonly<Record<string, string>> = Object.freeze({
|
|
@@ -15,19 +15,19 @@ const HUMAN_TONES: Readonly<Record<string, string>> = Object.freeze({
|
|
|
15
15
|
"builtin:error": "error tone",
|
|
16
16
|
"builtin:attention": "attention tone",
|
|
17
17
|
});
|
|
18
|
+
const CUSTOM_SOUND = "custom";
|
|
18
19
|
/** Footer hint shared by every row that can assign its own sound (basic groups and per-event exceptions). */
|
|
19
|
-
const SOUND_ROW_HINT = "
|
|
20
|
+
const SOUND_ROW_HINT = "←/→ choose · Enter apply · f sound · p test · Esc close";
|
|
20
21
|
|
|
21
22
|
interface GroupPlan {
|
|
22
23
|
name: string;
|
|
23
|
-
recommended: `builtin:${typeof BUILTIN_NOTIFICATION_IDS[number]}`;
|
|
24
24
|
targets: readonly NotificationEvent[];
|
|
25
25
|
}
|
|
26
26
|
/** Fixed, verified targets per basic type. Attention never intersects `subagent.waiting`. */
|
|
27
27
|
const GROUP_PLANS: readonly GroupPlan[] = [
|
|
28
|
-
{ name: "Success",
|
|
29
|
-
{ name: "Error",
|
|
30
|
-
{ name: "Attention",
|
|
28
|
+
{ name: "Success", targets: ["agent.completed", "subagent.completed"] },
|
|
29
|
+
{ name: "Error", targets: ["agent.failed", "subagent.failed", "subagent.timed_out"] },
|
|
30
|
+
{ name: "Attention", targets: ["agent.attention"] },
|
|
31
31
|
];
|
|
32
32
|
|
|
33
33
|
/** Human basename for a local audio reference; never leaks the absolute path or the `file:` prefix. */
|
|
@@ -135,7 +135,20 @@ export function buildNotificationRows(ctx: ExtensionContext): CustomizeRow[] {
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
const rows: CustomizeRow[] = [];
|
|
138
|
-
|
|
138
|
+
const choices = <T>(row: Omit<CustomizeRow, "action" | "choice">, setting: string,
|
|
139
|
+
options: readonly { value: T; label: string }[], read: () => T | undefined,
|
|
140
|
+
apply: (value: T, inline: CustomizeInline) => unknown): void => {
|
|
141
|
+
for (const option of options) rows.push({ ...row,
|
|
142
|
+
choice: { setting, value: option.label, current: () => read() === option.value, applyOnMove: false },
|
|
143
|
+
action: async inline => { await apply(option.value, inline); },
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
const onOff = [{ value: false, label: "off" }, { value: true, label: "on" }];
|
|
147
|
+
const sounds: { value: NotificationSound | typeof CUSTOM_SOUND; label: string }[] = [
|
|
148
|
+
...SOUND_CYCLE.map(value => ({ value, label: selectionLabel(value) })), { value: CUSTOM_SOUND, label: "custom" },
|
|
149
|
+
];
|
|
150
|
+
const soundValue = (sound: NotificationSound): NotificationSound | typeof CUSTOM_SOUND => sound?.startsWith("file:") ? CUSTOM_SOUND : sound;
|
|
151
|
+
choices({
|
|
139
152
|
category,
|
|
140
153
|
label: () => { const current = state(); return `Audio notifications: ${current ? (current.settings.enabled ? "on" : "off") : "unavailable"}`; },
|
|
141
154
|
preview: () => {
|
|
@@ -143,25 +156,18 @@ export function buildNotificationRows(ctx: ExtensionContext): CustomizeRow[] {
|
|
|
143
156
|
return { title: "Audio notifications · global switch",
|
|
144
157
|
sample: current ? `opt-in audio · ${current.settings.enabled ? "enabled" : "disabled"} · mute: ${current.muted ? "on" : "off"} · separate from visual settings` : "Unavailable in this session" };
|
|
145
158
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const enabled = !service.getState().settings.enabled;
|
|
150
|
-
await mutate(inline, settings => { settings.enabled = enabled; });
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
rows.push({
|
|
159
|
+
}, "Enabled", onOff, () => state()?.settings.enabled,
|
|
160
|
+
(enabled, inline) => mutate(inline, settings => { settings.enabled = enabled; }));
|
|
161
|
+
choices({
|
|
154
162
|
category,
|
|
155
163
|
label: () => { const current = state(); return `Audio: ${current ? (current.muted ? "muted" : "unmuted") : "unavailable"}`; },
|
|
156
164
|
preview: () => ({ title: "Audio · process mute", sample: "mute survives reload and session replacement; restarting Pi clears it; muted or disabled events are never replayed" }),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (!service.setMuted(ctx, !service.getState().muted)) notify("Audio mute could not be changed.", true);
|
|
161
|
-
},
|
|
165
|
+
}, "Mute", onOff, () => state()?.muted, muted => {
|
|
166
|
+
const service = serviceOrNotify();
|
|
167
|
+
if (service && !service.setMuted(ctx, muted)) notify("Audio mute could not be changed.", true);
|
|
162
168
|
});
|
|
163
169
|
for (const group of GROUP_PLANS) {
|
|
164
|
-
|
|
170
|
+
choices({
|
|
165
171
|
category,
|
|
166
172
|
keyhint: SOUND_ROW_HINT,
|
|
167
173
|
label: () => { const current = state(); return current ? `${group.name}: ${groupSelectionLabel(current.settings, group)}` : `${group.name}: unavailable`; },
|
|
@@ -170,18 +176,10 @@ export function buildNotificationRows(ctx: ExtensionContext): CustomizeRow[] {
|
|
|
170
176
|
if (!current) return { title: `${group.name} sounds`, sample: "Unavailable in this session" };
|
|
171
177
|
const selection = groupSelection(current.settings, group);
|
|
172
178
|
const detail = selection.kind === "mixed" ? `mixes several sounds across ${group.targets.length} events · expand Advanced for per-event exceptions`
|
|
173
|
-
: selection.sound === null ? "silence ·
|
|
179
|
+
: selection.sound === null ? "silence · choose a tone or assign your own sound with f"
|
|
174
180
|
: selection.sound.startsWith("builtin:") ? `${selectionLabel(selection.sound)} · builtin tone · f assigns your own sound`
|
|
175
181
|
: `${selectionLabel(selection.sound)} (own group file) · f replaces it`;
|
|
176
|
-
return { title: `${group.name} sounds · applies to ${group.targets.length} event${group.targets.length === 1 ? "" : "s"}`, sample: `${detail} · p tests the
|
|
177
|
-
},
|
|
178
|
-
action: async inline => {
|
|
179
|
-
const service = serviceOrNotify();
|
|
180
|
-
if (!service) return;
|
|
181
|
-
const selection = groupSelection(service.getState().settings, group);
|
|
182
|
-
const next = selection.kind === "mixed" ? group.recommended
|
|
183
|
-
: SOUND_CYCLE[(SOUND_CYCLE.indexOf(selection.sound) + 1) % SOUND_CYCLE.length]!;
|
|
184
|
-
await setTargets(inline, group.targets, next);
|
|
182
|
+
return { title: `${group.name} sounds · applies to ${group.targets.length} event${group.targets.length === 1 ? "" : "s"}`, sample: `${group.name}: ${groupSelectionLabel(current.settings, group)} · ${detail} · p tests the configured sound` };
|
|
185
183
|
},
|
|
186
184
|
key: (data, inline) => {
|
|
187
185
|
if (matchesKey(data, "p")) {
|
|
@@ -193,49 +191,48 @@ export function buildNotificationRows(ctx: ExtensionContext): CustomizeRow[] {
|
|
|
193
191
|
return true;
|
|
194
192
|
}
|
|
195
193
|
if (matchesKey(data, "f")) {
|
|
196
|
-
const
|
|
197
|
-
const selection =
|
|
198
|
-
|
|
199
|
-
? selection.sound.slice(5) : "";
|
|
200
|
-
return chooseFileFor(inline, group.targets, prefill);
|
|
194
|
+
const current = state();
|
|
195
|
+
const selection = current ? groupSelection(current.settings, group) : undefined;
|
|
196
|
+
return chooseFileFor(inline, group.targets, selection?.kind === "uniform" && selection.sound?.startsWith("file:") ? selection.sound.slice(5) : "");
|
|
201
197
|
}
|
|
202
198
|
return false;
|
|
203
199
|
},
|
|
200
|
+
}, group.name, sounds, () => {
|
|
201
|
+
const current = state();
|
|
202
|
+
if (!current) return undefined;
|
|
203
|
+
const selection = groupSelection(current.settings, group);
|
|
204
|
+
return selection.kind === "mixed" ? CUSTOM_SOUND : soundValue(selection.sound);
|
|
205
|
+
}, (sound, inline) => {
|
|
206
|
+
if (sound !== CUSTOM_SOUND) return setTargets(inline, group.targets, sound);
|
|
207
|
+
const current = state();
|
|
208
|
+
const selection = current ? groupSelection(current.settings, group) : undefined;
|
|
209
|
+
return chooseFileFor(inline, group.targets, selection?.kind === "uniform" && selection.sound?.startsWith("file:") ? selection.sound.slice(5) : "");
|
|
204
210
|
});
|
|
205
211
|
}
|
|
206
|
-
|
|
212
|
+
choices({
|
|
207
213
|
category,
|
|
208
214
|
label: () => `Advanced: ${advanced ? "hide" : "show"} per-event exceptions`,
|
|
209
215
|
preview: () => ({ title: "Advanced · per-event exceptions", sample: advanced ? "hiding folds the per-event rows again; the basic type choices are unaffected" : "reveals one-off per-event overrides; the basic type choices stay independent" }),
|
|
210
|
-
|
|
211
|
-
});
|
|
216
|
+
}, "Advanced", [{ value: false, label: "hidden" }, { value: true, label: "shown" }], () => advanced, value => { advanced = value; });
|
|
212
217
|
const events = getNotificationService()?.getState().supportedEvents
|
|
213
218
|
?? NOTIFICATION_EVENTS.filter(event => event !== "session.shutdown");
|
|
214
219
|
for (const event of events) {
|
|
215
|
-
|
|
220
|
+
choices({
|
|
216
221
|
category,
|
|
217
222
|
visible: () => advanced,
|
|
218
223
|
keyhint: SOUND_ROW_HINT,
|
|
219
224
|
label: () => { const current = state(); const sound = current?.settings.audio.events[event] ?? null; return `${event}: ${sound === null ? "silence" : sound}`; },
|
|
220
225
|
preview: () => {
|
|
221
226
|
const sound = state()?.settings.audio.events[event] ?? null;
|
|
222
|
-
return { title: `${event} · audio event`, sample:
|
|
223
|
-
},
|
|
224
|
-
action: async inline => {
|
|
225
|
-
const service = serviceOrNotify();
|
|
226
|
-
if (!service) return;
|
|
227
|
-
const current = service.getState().settings.audio.events[event] ?? null;
|
|
228
|
-
const index = SOUND_CYCLE.findIndex(candidate => candidate === current);
|
|
229
|
-
const next = SOUND_CYCLE[(index + 1) % SOUND_CYCLE.length]!;
|
|
230
|
-
await mutate(inline, settings => { settings.audio.events[event] = next; });
|
|
227
|
+
return { title: `${event} · audio event`, sample: `${event}: ${sound === null ? "silence" : sound} · ${soundDescription(sound)} · Enter applies the chosen option · f local sound · p test sound` };
|
|
231
228
|
},
|
|
232
229
|
key: (data, inline) => {
|
|
233
230
|
if (matchesKey(data, "p")) { previewSound(getNotificationService()?.getState().settings.audio.events[event] ?? null); return true; }
|
|
234
|
-
// Return the field/validation promise so the view keeps the card busy until it settles.
|
|
235
231
|
if (matchesKey(data, "f")) return chooseFileFor(inline, [event], "");
|
|
236
232
|
return false;
|
|
237
233
|
},
|
|
238
|
-
});
|
|
234
|
+
}, event, sounds, () => { const current = state(); return current ? soundValue(current.settings.audio.events[event] ?? null) : undefined; },
|
|
235
|
+
(sound, inline) => sound === CUSTOM_SOUND ? chooseFileFor(inline, [event], "") : setTargets(inline, [event], sound));
|
|
239
236
|
}
|
|
240
237
|
return rows;
|
|
241
238
|
}
|