gentle-pi 4.6.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -55
- package/assets/agents/gentle-ai-explore.md +4 -3
- package/assets/agents/gentle-ai-verify.md +23 -6
- package/assets/agents/gentle-ai-worker.md +9 -6
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +2 -3
- package/assets/agents/jd-judge-b.md +2 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +456 -0
- package/assets/design-canvas/canvas-boot.js +217 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +392 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +213 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +348 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +164 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +759 -16
- package/assets/design-canvas/canvas.js +2 -1497
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +6 -1
- package/assets/migrations/agent-body-history.json +40 -1
- package/assets/orchestrator-delegation-reference.md +10 -16
- package/assets/orchestrator-delegation.md +5 -5
- package/assets/orchestrator-full-delegation-card.md +64 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +5 -5
- package/assets/orchestrator-prompts.md +2 -2
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +14 -13
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +12 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +21 -25
- package/bin/gentle-shell.mjs +292 -65
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/agent-status.md +61 -0
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +20 -10
- package/docs/delegated-verification.md +46 -8
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +40 -0
- package/docs/gentle-shell.md +91 -30
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +17 -4
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +142 -45
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +53 -0
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +11 -1
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +3 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/child-safety.ts +3 -0
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +559 -66
- package/extensions/gentle-ai.ts +2001 -518
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-rpc.ts +143 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-shell.ts +398 -115
- package/extensions/gentle-todo.ts +66 -27
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +349 -167
- package/extensions/startup-banner.ts +30 -3
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +160 -2
- package/lib/agent-status.ts +105 -0
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +93 -6
- package/lib/agents-history.ts +24 -5
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +55 -7
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +272 -16
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +197 -32
- package/lib/card-content-policy.ts +8 -6
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/command-palette.ts +133 -17
- package/lib/context-backstop.ts +14 -5
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +36 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +294 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-jobs-service.ts +263 -0
- package/lib/desktop-rpc-agents.ts +294 -0
- package/lib/desktop-rpc-config.ts +731 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +181 -0
- package/lib/desktop-rpc-permissions.ts +177 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +225 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +236 -17
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +4 -2
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +204 -14
- package/lib/gentle-shell-bundled.ts +106 -28
- package/lib/gentle-shell-launcher.ts +43 -8
- package/lib/herdr-activity.ts +14 -2
- package/lib/herdr-busy.ts +45 -0
- package/lib/hidden-tools.ts +35 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +358 -144
- package/lib/jobs-view.ts +198 -11
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +31 -4
- package/lib/nan-provider.ts +42 -28
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +172 -20
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/questionnaire/questionnaire-view.ts +105 -12
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +129 -0
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +81 -44
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +116 -0
- package/lib/review-coordinator.ts +407 -0
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +63 -4
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +4 -2
- package/lib/shell-bar.ts +140 -58
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-panel.ts +17 -3
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-sidebar-layout.ts +112 -40
- package/lib/shell-sidebar.ts +7 -0
- package/lib/shell-todo.ts +10 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/verifier-admission.ts +1 -1
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/visual-customization-policy.ts +36 -16
- package/lib/visual-customize-view.ts +216 -21
- package/lib/visual-layout-preview.ts +9 -5
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +46 -16
- package/package.json +3 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +106 -28
- package/runtime/gentle-shell-launcher.mjs +42 -7
- package/runtime/native-review-cli.mjs +169 -17
- package/runtime/review-integration-v2.mjs +63 -4
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +179 -0
- package/scripts/build-runtime-modules.mjs +1 -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-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +33 -22
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +46 -16
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- 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 +40 -28
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +50 -19
- package/scripts/voice-worker.cjs +32 -6
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +16 -13
- package/skills/gentle-ai/SKILL.md +7 -7
- 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/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -11
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +10 -11
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +106 -1
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +215 -3
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +12 -1
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +99 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-stop-contract.test.ts +51 -3
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bridge-cost.test.ts +19 -4
- package/tests/bundled-install.test.ts +31 -6
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-safety.test.ts +11 -0
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codegraph-tools.test.ts +11 -5
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/command-palette.test.ts +284 -1
- package/tests/delegate-for-reason-contract.test.ts +32 -10
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -695
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +526 -0
- package/tests/design-canvas-inspector.test.ts +937 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +90 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +180 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- package/tests/desktop-rpc-agents.test.ts +893 -0
- package/tests/desktop-rpc-config.test.ts +1452 -0
- package/tests/desktop-rpc-design.test.ts +662 -0
- package/tests/desktop-rpc-jobs.test.ts +796 -0
- package/tests/desktop-rpc-permissions.test.ts +311 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-usage.test.ts +697 -0
- package/tests/desktop-rpc.test.ts +252 -0
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -31
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +53 -6
- package/tests/full-delegation-closure.test.ts +160 -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 +1403 -20
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +18 -2
- package/tests/gentle-ai-installer.test.ts +135 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +233 -43
- package/tests/gentle-design.test.ts +386 -1
- package/tests/gentle-herdr-activity.test.ts +9 -6
- package/tests/gentle-shell-bin.test.ts +123 -0
- package/tests/gentle-shell-bundled.test.ts +293 -31
- package/tests/gentle-shell-launcher.test.ts +78 -11
- package/tests/gentle-shell.test.ts +1017 -146
- package/tests/gentle-todo.test.ts +51 -11
- 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 +8 -4
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/independent-recovery-delivery.test.ts +97 -0
- package/tests/inprocess-reviewer.test.ts +249 -4
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +115 -14
- package/tests/installer-preflight.test.ts +54 -5
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +215 -13
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/jobs-view.test.ts +260 -6
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +17 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +13 -2
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +35 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +154 -0
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +13 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +4 -3
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +16 -13
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +372 -0
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-update-launcher.test.ts +25 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +5 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/provider-defect-handoff.test.ts +9 -2
- package/tests/questionnaire-view.test.ts +115 -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 +17 -12
- 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 +112 -1
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +189 -0
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +80 -2
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +66 -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 +107 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller-native-routing.test.ts +261 -5
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +98 -12
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +462 -0
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +26 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +105 -11
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +95 -32
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- 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 +39 -2
- package/tests/review-reviewer-evidence.test.ts +223 -0
- package/tests/review-risk-assessment.test.ts +126 -8
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +53 -3
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +122 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/run-test-suite.test.ts +122 -1
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +181 -5
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-binding.test.ts +19 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/session-profile-v1-compat.test.ts +35 -1
- package/tests/shell-bar.test.ts +186 -42
- package/tests/shell-panel.test.ts +50 -22
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-sidebar-fullscreen.test.ts +5 -5
- package/tests/shell-sidebar-layout.test.ts +294 -23
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-contradictions-contract.test.ts +122 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +1461 -5
- package/tests/startup-banner.test.ts +152 -1
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +264 -0
- package/tests/task-size-routing-contract.test.ts +45 -12
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +162 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +39 -6
- package/tests/visual-customize-view.test.ts +573 -9
- package/tests/visual-layout-preview.test.ts +15 -1
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +77 -6
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +276 -0
- package/tests/yolo-customize.test.ts +27 -4
- package/tests/yolo-mode.test.ts +62 -18
- package/tests/yolo-session-policy.test.ts +270 -1
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ToolCallEventResult } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
|
|
3
|
+
// gentle-shell#379: delegated work stays in the current runtime. A tool call
|
|
4
|
+
// that asks to open an external project pane is classified by its own input
|
|
5
|
+
// property, never by the tool name, and is blocked in every mode and in
|
|
6
|
+
// children. A value that is not a boolean fails closed. The reason carries
|
|
7
|
+
// fixed fields only, never input paths or content.
|
|
8
|
+
|
|
9
|
+
export const EXTERNAL_FALLBACK_PROHIBITED = "gentle-ai.execution-surface.external-fallback-prohibited";
|
|
10
|
+
|
|
11
|
+
const PANE_PROPERTY = "openProjectPaneIfMissing";
|
|
12
|
+
|
|
13
|
+
export function evaluateExecutionSurfaceTool(toolName: string, input: unknown): ToolCallEventResult | undefined {
|
|
14
|
+
if (typeof input !== "object" || input === null || !Object.hasOwn(input, PANE_PROPERTY)) return undefined;
|
|
15
|
+
if ((input as Record<string, unknown>)[PANE_PROPERTY] === false) return undefined;
|
|
16
|
+
return {
|
|
17
|
+
block: true,
|
|
18
|
+
reason: `Gentle AI blocked an execution-surface escalation. code=${EXTERNAL_FALLBACK_PROHIBITED} tool=${toolName} property=${PANE_PROPERTY} next=Run the work through subagent_* or the native Agent in the current runtime; if neither is available, stop and tell the user.`,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ToolResultEvent } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { OrchestratorMode } from "./agent-profiles.ts";
|
|
2
3
|
import { inferOddPhase } from "./odd-phase-inference.ts";
|
|
3
4
|
|
|
4
5
|
// Explicit discovery tools; existing shell inference below is advisory, never authorization.
|
|
@@ -32,7 +33,8 @@ export function createExplorationBudget() {
|
|
|
32
33
|
const request = requests.get(session);
|
|
33
34
|
if (request && !request.seen.has(id)) request.pending.set(id, { toolName, parentToolCallId });
|
|
34
35
|
},
|
|
35
|
-
|
|
36
|
+
// `mode` is a thunk: it is read only when the notice is emitted, never per tool result.
|
|
37
|
+
result(session: unknown, event: DiscoveryResult, primary = true, aborted = false, mode?: () => OrchestratorMode): string | undefined {
|
|
36
38
|
const request = requests.get(session);
|
|
37
39
|
const call = request?.pending.get(event.toolCallId);
|
|
38
40
|
if (!request || !call) return undefined;
|
|
@@ -51,7 +53,7 @@ export function createExplorationBudget() {
|
|
|
51
53
|
}
|
|
52
54
|
if (request.notified || (request.lookups <= 3 && request.bytes <= 40_000)) return undefined;
|
|
53
55
|
request.notified = true;
|
|
54
|
-
return `Exploration budget: ${request.lookups.toLocaleString("en-US")} tracked lookups and ${request.bytes.toLocaleString("en-US")} UTF-8 text bytes (an approximate evidence budget). Ongoing discovery needs one configured explorer, even if read-only or initially small. Preparation for an already-understood authorized inline write remains exempt. This is runtime context for the original task, not a new user request. This notice grants no mutation or guard bypass authority.`;
|
|
56
|
+
return `Exploration budget: ${request.lookups.toLocaleString("en-US")} tracked lookups and ${request.bytes.toLocaleString("en-US")} UTF-8 text bytes (an approximate evidence budget). Ongoing discovery needs one configured explorer, even if read-only or initially small. ${mode?.() === "full-delegation" ? "Reading that prepares a writer belongs in that writer's prompt." : "Preparation for an already-understood authorized inline write remains exempt."} This is runtime context for the original task, not a new user request. This notice grants no mutation or guard bypass authority.`;
|
|
55
57
|
},
|
|
56
58
|
facts(session: unknown): { lookups: number; textBytes: number } | undefined {
|
|
57
59
|
const request = requests.get(session);
|
package/lib/gentle-ai-binary.ts
CHANGED
|
@@ -382,7 +382,7 @@ function binaryIdentity(path: string): string {
|
|
|
382
382
|
return [details.dev, details.ino, details.size, details.mtimeNs, details.ctimeNs].join(":");
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
-
function binaryDigest(path: string, readBinary: (path: string) => Buffer): string {
|
|
385
|
+
export function binaryDigest(path: string, readBinary: (path: string) => Buffer = readFileSync): string {
|
|
386
386
|
let entries = binaryDigestCache.get(readBinary);
|
|
387
387
|
if (entries === undefined) binaryDigestCache.set(readBinary, entries = new Map());
|
|
388
388
|
const identity = binaryIdentity(path);
|
|
@@ -174,9 +174,21 @@ function summaryValue(value: unknown): string | undefined {
|
|
|
174
174
|
return clause.length > 0 && !HASH_PATTERN.test(clause) ? clause : undefined;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
// A reviewer-run forecast leads with what will run (the model-run count and
|
|
178
|
+
// the lenses or roles), so the cut at narrow widths drops the outcome first.
|
|
179
|
+
function forecastSummary(envelope: Record<string, unknown>): string | undefined {
|
|
180
|
+
if (envelope.outcome !== "reviewer-model-run-forecast" || !isJsonObject(envelope.cost_forecast)) return undefined;
|
|
181
|
+
const runs = envelope.cost_forecast.model_runs;
|
|
182
|
+
if (typeof runs !== "number" || !Number.isSafeInteger(runs) || runs < 0) return undefined;
|
|
183
|
+
const listed = [envelope.cost_forecast.lenses, envelope.cost_forecast.roles].find(Array.isArray) ?? [];
|
|
184
|
+
const names = listed.map(summaryValue).filter((name): name is string => name !== undefined);
|
|
185
|
+
return [`${runs} model ${runs === 1 ? "run" : "runs"}`, ...(names.length > 0 ? [names.join(", ")] : [])].join(SEPARATOR);
|
|
186
|
+
}
|
|
187
|
+
|
|
177
188
|
export function summarizeJsonEnvelope(envelope: Record<string, unknown>): string {
|
|
178
189
|
const scopes = isJsonObject(envelope.result) ? [envelope, envelope.result] : [envelope];
|
|
179
|
-
const
|
|
190
|
+
const forecast = forecastSummary(envelope);
|
|
191
|
+
const parts: string[] = forecast === undefined ? [] : [forecast];
|
|
180
192
|
for (const group of SUMMARY_FIELD_GROUPS) {
|
|
181
193
|
const found = scopes.flatMap((scope) => group.map((path) => summaryValue(fieldAt(scope, path)))).find((part) => part !== undefined);
|
|
182
194
|
if (found !== undefined && !parts.includes(found)) parts.push(found);
|
package/lib/gentle-design.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { designCommentBatchContent, designCommentContent, hasSystemTokens, listDesignEntries, readDesignManifest, resolveSystemBoard, startDesignCanvasServer, type DesignArtboard, type DesignCanvasServer, type DesignCanvasServerOptions, type DesignSessionContent } from "./design-canvas-server.ts";
|
|
3
|
-
import { createDesignCommentStore, DesignCommentsError, type StoredDesignComment } from "./design-comments.ts";
|
|
3
|
+
import { createDesignCommentStore, DesignCommentsError, describeViewport, noteProblem, type StoredDesignComment } from "./design-comments.ts";
|
|
4
4
|
import { createDesignHandoffStore, DesignHandoffsError, sendDesignHandoff, type DesignHandoff, type DesignHandoffDelivery, type DesignHandoffStatus } from "./design-handoffs.ts";
|
|
5
5
|
import { openInBrowser, type OpenInBrowserResult } from "./design-open-browser.ts";
|
|
6
6
|
import { detectDesignSources, staleDesignSources } from "./design-sources.ts";
|
|
7
|
+
import { createDesignPartStore, DesignPartsError, type DesignPart } from "./design-parts.ts";
|
|
7
8
|
|
|
8
9
|
// Gentle Design helpers: argument parsing, the designs already written under
|
|
9
10
|
// design/<slug>/design.json, the usage text, the per-session canvas that
|
|
10
11
|
// open/stop drive, and the comments tool. The extension stays a thin wrapper.
|
|
11
12
|
|
|
12
13
|
export const DESIGN_SKILL_NAME = "gentle-design";
|
|
14
|
+
/** Paired with every design request: gentle-design owns delivery, this skill owns UX quality. */
|
|
15
|
+
export const UI_DESIGN_SKILL_NAME = "gentle-ui-design";
|
|
13
16
|
|
|
14
17
|
export const DESIGN_SUBCOMMANDS = ["open", "stop", "sync", "implement"] as const;
|
|
15
18
|
export type DesignSubcommand = (typeof DESIGN_SUBCOMMANDS)[number];
|
|
@@ -76,7 +79,7 @@ export type DesignImplementInput = {
|
|
|
76
79
|
/** Whether design/system.md exists. */
|
|
77
80
|
systemTokens: boolean;
|
|
78
81
|
/** The open comments on this artboard. */
|
|
79
|
-
comments: ReadonlyArray<Pick<StoredDesignComment, "id" | "selector" | "excerpt" | "comment">>;
|
|
82
|
+
comments: ReadonlyArray<Pick<StoredDesignComment, "id" | "selector" | "excerpt" | "comment" | "viewport">>;
|
|
80
83
|
};
|
|
81
84
|
|
|
82
85
|
/** The handoff message for one artboard (S8); the command and the canvas button both send exactly this. */
|
|
@@ -101,12 +104,13 @@ export function designImplementMessage(input: DesignImplementInput): string {
|
|
|
101
104
|
`${index + 1}. Comment id: ${comment.id}`,
|
|
102
105
|
` Element: ${comment.selector}`,
|
|
103
106
|
` Excerpt: ${comment.excerpt ? JSON.stringify(comment.excerpt) : "(none)"}`,
|
|
107
|
+
...(comment.viewport ? [` Viewport: ${describeViewport(comment.viewport)} (edit for this width)`] : []),
|
|
104
108
|
" Comment:",
|
|
105
109
|
...comment.comment.split("\n").map((line) => ` ${line}`),
|
|
106
110
|
);
|
|
107
111
|
});
|
|
108
112
|
const ids = input.comments.map((comment) => JSON.stringify(comment.id)).join(", ");
|
|
109
|
-
lines.push(`When they are applied, resolve them with the ${DESIGN_COMMENTS_TOOL_NAME} tool (action "resolve", slug "${input.slug}", ids [${ids}]).`);
|
|
113
|
+
lines.push(`When they are applied, resolve them with the ${DESIGN_COMMENTS_TOOL_NAME} tool (action "resolve", slug "${input.slug}", ids [${ids}], note "<one line on what you changed>").`);
|
|
110
114
|
}
|
|
111
115
|
lines.push(
|
|
112
116
|
"",
|
|
@@ -119,6 +123,75 @@ export function designImplementMessage(input: DesignImplementInput): string {
|
|
|
119
123
|
return lines.join("\n");
|
|
120
124
|
}
|
|
121
125
|
|
|
126
|
+
export type DesignVariantInput = {
|
|
127
|
+
slug: string;
|
|
128
|
+
artboard: Pick<DesignArtboard, "file" | "title">;
|
|
129
|
+
/** What should change, already trimmed (1 to 2000 characters). */
|
|
130
|
+
instruction: string;
|
|
131
|
+
/** Whether design/system.md exists. */
|
|
132
|
+
systemTokens: boolean;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/** The message for "Try another direction from this…" (S3): the skill adds the next artboard based on the source file. */
|
|
136
|
+
export function designVariantMessage(input: DesignVariantInput): string {
|
|
137
|
+
const folder = `design/${input.slug}`;
|
|
138
|
+
const path = `${folder}/${input.artboard.file}`;
|
|
139
|
+
const lines = [
|
|
140
|
+
`Add another direction to the design ${folder}/, based on the artboard ${path}`,
|
|
141
|
+
"",
|
|
142
|
+
`Source artboard: ${path}`,
|
|
143
|
+
`Title: ${input.artboard.title}`,
|
|
144
|
+
"",
|
|
145
|
+
"What should change:",
|
|
146
|
+
...input.instruction.split("\n").map((line) => ` ${line}`),
|
|
147
|
+
"",
|
|
148
|
+
`Follow the ${DESIGN_SKILL_NAME} skill ("Save and try a different approach"): write the next artboard (the next NN after the existing ones, NN-<name>.html) in ${folder}/, starting from the source file, and append it to ${folder}/design.json with its title, tradeoff, width and height. Keep every existing artboard and its file as they are.`,
|
|
149
|
+
];
|
|
150
|
+
if (input.systemTokens) lines.push("Take colors, typography, spacing, radius and shadows from design/system.md, the project's token source.");
|
|
151
|
+
lines.push(`When it is written, refresh the canvas with the ${DESIGN_TOOL_NAME} tool (action "open", slug "${input.slug}").`);
|
|
152
|
+
return lines.join("\n");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type DesignImplementPartInput = {
|
|
156
|
+
slug: string;
|
|
157
|
+
artboard: Pick<DesignArtboard, "file" | "title">;
|
|
158
|
+
/** The recorded part; `instruction` is the user's note, absent or empty when none. */
|
|
159
|
+
part: Pick<DesignPart, "id" | "selector" | "excerpt" | "instruction">;
|
|
160
|
+
feature?: string;
|
|
161
|
+
/** Whether design/system.md exists. */
|
|
162
|
+
systemTokens: boolean;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The message for "Implement only this" (canvas-implement-part S5): build one element of an artboard in the real
|
|
167
|
+
* app, without choosing the direction, and report on that part with the handoff action's `part`.
|
|
168
|
+
*/
|
|
169
|
+
export function designImplementPartMessage(input: DesignImplementPartInput): string {
|
|
170
|
+
const path = `design/${input.slug}/${input.artboard.file}`;
|
|
171
|
+
const instruction = input.part.instruction ?? "";
|
|
172
|
+
const lines = [
|
|
173
|
+
`Implement only one part of the design artboard ${path}`,
|
|
174
|
+
"",
|
|
175
|
+
`Artboard: ${path}`,
|
|
176
|
+
`Title: ${input.artboard.title}`,
|
|
177
|
+
`Part id: ${input.part.id}`,
|
|
178
|
+
`Element: ${input.part.selector}`,
|
|
179
|
+
`Excerpt: ${input.part.excerpt ? JSON.stringify(input.part.excerpt) : "(none)"}`,
|
|
180
|
+
...(instruction ? ["Note:", ...instruction.split("\n")] : ["Note: (none)"]),
|
|
181
|
+
"",
|
|
182
|
+
"Build only this element in the project's real stack, as the shared piece the app would reuse (a layout or component) when it has one. Use the artboard as the visual spec for it: map it to the project's existing components and styles, and do not copy the artboard HTML verbatim. Leave the rest of the artboard unbuilt: this does not choose a direction, and the other artboards stay open.",
|
|
183
|
+
];
|
|
184
|
+
if (input.systemTokens) lines.push("Take colors, typography, spacing, radius and shadows from design/system.md, the project's token source.");
|
|
185
|
+
lines.push(
|
|
186
|
+
`Report progress with the ${DESIGN_TOOL_NAME} tool: action "handoff", target "${input.slug}/${input.artboard.file}", part "${input.part.id}", status "in_progress" when you start; status "implemented" when it is done, with a one-line note on where it lives in the project.`,
|
|
187
|
+
input.feature
|
|
188
|
+
? `This design belongs to an ODD feature: track this part in ${input.feature} (add or reopen its task there and log this handoff).`
|
|
189
|
+
: "This design is not linked to an ODD feature document: size it under the project's ODD rules as usual.",
|
|
190
|
+
"This handoff itself commits nothing.",
|
|
191
|
+
);
|
|
192
|
+
return lines.join("\n");
|
|
193
|
+
}
|
|
194
|
+
|
|
122
195
|
/** The artboard a handoff records in handoffs.json (S15). */
|
|
123
196
|
export type DesignHandoffTarget = { slug: string; file: string; feature?: string };
|
|
124
197
|
|
|
@@ -186,6 +259,32 @@ export async function planDesignImplement(cwd: string, target: string): Promise<
|
|
|
186
259
|
return { kind: "send", message: designImplementMessage({ slug, artboard, feature, systemTokens: hasSystemTokens(designRoot), comments }), warnings, handoff: { slug, file: artboard.file, feature } };
|
|
187
260
|
}
|
|
188
261
|
|
|
262
|
+
export type DesignVariantPlan = { kind: "send"; message: string } | { kind: "refuse"; notice: DesignNotice };
|
|
263
|
+
|
|
264
|
+
/** Validates `<slug>/<file>` against the design's manifest and builds the variant message; the canvas route sends exactly this. */
|
|
265
|
+
export function planDesignVariant(cwd: string, request: { slug: string; file: string; instruction: string }): DesignVariantPlan {
|
|
266
|
+
const resolved = resolveDesignTarget(cwd, `${request.slug}/${request.file}`, "add a direction to");
|
|
267
|
+
if (resolved.kind === "refuse") return resolved;
|
|
268
|
+
const { slug, artboard } = resolved;
|
|
269
|
+
return { kind: "send", message: designVariantMessage({ slug, artboard, instruction: request.instruction, systemTokens: hasSystemTokens(join(cwd, "design")) }) };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** Checks the part's artboard against the design's manifest and builds its message; the canvas route sends exactly this. */
|
|
273
|
+
export function planDesignImplementPart(cwd: string, request: { slug: string; part: DesignPart }): DesignVariantPlan {
|
|
274
|
+
const resolved = resolveDesignTarget(cwd, `${request.slug}/${request.part.file}`, "implement a part of");
|
|
275
|
+
if (resolved.kind === "refuse") return resolved;
|
|
276
|
+
const { slug, artboard, feature } = resolved;
|
|
277
|
+
return { kind: "send", message: designImplementPartMessage({ slug, artboard, part: request.part, feature, systemTokens: hasSystemTokens(join(cwd, "design")) }) };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** A parts.json problem as the reason the model reads; a broken file is never overwritten. */
|
|
281
|
+
function partsProblem(slug: string, error: unknown): Error {
|
|
282
|
+
if (error instanceof DesignPartsError && error.code === "invalid-file") {
|
|
283
|
+
return new Error(`design/${slug}/parts.json cannot be read: ${error.message}. Fix the file by hand; it is never overwritten.`);
|
|
284
|
+
}
|
|
285
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
286
|
+
}
|
|
287
|
+
|
|
189
288
|
/** A handoffs.json problem as the reason the user or the model reads; a broken file is never overwritten. */
|
|
190
289
|
function handoffsProblem(slug: string, error: unknown): Error {
|
|
191
290
|
if (error instanceof DesignHandoffsError && error.code === "invalid-file") {
|
|
@@ -217,6 +316,16 @@ export interface DesignCanvasDeps {
|
|
|
217
316
|
*/
|
|
218
317
|
export type DesignOpenNotice = DesignNotice & { url?: string; opened?: boolean; refreshed?: boolean };
|
|
219
318
|
|
|
319
|
+
/** Sanitized canvas state: whether a server runs, the slug it last showed (null: system board), and connected pages. */
|
|
320
|
+
export type DesignCanvasState = {
|
|
321
|
+
running: boolean;
|
|
322
|
+
slug: string | null;
|
|
323
|
+
connectedClients: number;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/** An actual open/refresh/stop transition with its sanitized post-transition state; never the URL. */
|
|
327
|
+
export type DesignCanvasTransition = DesignCanvasState & { transition: "open" | "refresh" | "stop" };
|
|
328
|
+
|
|
220
329
|
export interface DesignCanvas {
|
|
221
330
|
/**
|
|
222
331
|
* Shows `slug`, or the most recent design, on the session's canvas server, starting it when needed.
|
|
@@ -227,6 +336,10 @@ export interface DesignCanvas {
|
|
|
227
336
|
stop(): Promise<boolean>;
|
|
228
337
|
/** The URL the running canvas last showed; undefined when none is running. */
|
|
229
338
|
url(): string | undefined;
|
|
339
|
+
/** The running canvas's sanitized state (never the URL); stopped when none is running. */
|
|
340
|
+
state(): Promise<DesignCanvasState>;
|
|
341
|
+
/** Subscribe to actual open/refresh/stop transitions (sanitized, never the URL). */
|
|
342
|
+
observe(onTransition: (transition: DesignCanvasTransition) => void): () => void;
|
|
230
343
|
}
|
|
231
344
|
|
|
232
345
|
/** The canvas of `slug`, or the root canvas (system board only) when slug is null. */
|
|
@@ -242,15 +355,29 @@ function canvasUrl(server: DesignCanvasServer, slug: string | null): string {
|
|
|
242
355
|
export function createDesignCanvas(deliver: (message: DesignSessionContent) => DesignHandoffDelivery | Promise<DesignHandoffDelivery>, deps: DesignCanvasDeps = {}): DesignCanvas {
|
|
243
356
|
const startServer = deps.startServer ?? startDesignCanvasServer;
|
|
244
357
|
const openBrowser = deps.openBrowser ?? ((url: string) => openInBrowser(url));
|
|
245
|
-
let running: { root: string; server: Promise<DesignCanvasServer>; url?: string } | undefined;
|
|
358
|
+
let running: { root: string; server: Promise<DesignCanvasServer>; url?: string; slug: string | null } | undefined;
|
|
359
|
+
const observers = new Set<(transition: DesignCanvasTransition) => void>();
|
|
360
|
+
|
|
361
|
+
function emitTransition(transition: DesignCanvasTransition): void {
|
|
362
|
+
for (const onTransition of [...observers]) {
|
|
363
|
+
try {
|
|
364
|
+
onTransition(transition);
|
|
365
|
+
} catch {
|
|
366
|
+
/* an observer never breaks the canvas */
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
246
370
|
|
|
247
371
|
async function stop(): Promise<boolean> {
|
|
248
372
|
const current = running;
|
|
249
373
|
running = undefined;
|
|
250
374
|
if (!current) return false;
|
|
251
375
|
const server = await current.server.catch(() => undefined);
|
|
252
|
-
|
|
253
|
-
|
|
376
|
+
// A server that never started is a failed action, not a stop transition.
|
|
377
|
+
if (!server) return false;
|
|
378
|
+
await server.close();
|
|
379
|
+
emitTransition({ transition: "stop", running: false, slug: null, connectedClients: 0 });
|
|
380
|
+
return true;
|
|
254
381
|
}
|
|
255
382
|
|
|
256
383
|
async function serverFor(cwd: string): Promise<DesignCanvasServer> {
|
|
@@ -269,8 +396,20 @@ export function createDesignCanvas(deliver: (message: DesignSessionContent) => D
|
|
|
269
396
|
if (plan.kind === "refuse") throw new Error(plan.notice.message);
|
|
270
397
|
return deliver(plan.message);
|
|
271
398
|
},
|
|
399
|
+
// Not a handoff: nothing is recorded, the new artboard arrives through the manifest.
|
|
400
|
+
onVariant: (request) => {
|
|
401
|
+
const plan = planDesignVariant(cwd, request);
|
|
402
|
+
if (plan.kind === "refuse") throw new Error(plan.notice.message);
|
|
403
|
+
return deliver(plan.message);
|
|
404
|
+
},
|
|
405
|
+
// One element on its own: the server has recorded it in parts.json, never handoffs.json.
|
|
406
|
+
onImplementPart: (request) => {
|
|
407
|
+
const plan = planDesignImplementPart(cwd, request);
|
|
408
|
+
if (plan.kind === "refuse") throw new Error(plan.notice.message);
|
|
409
|
+
return deliver(plan.message);
|
|
410
|
+
},
|
|
272
411
|
});
|
|
273
|
-
running = { root, server };
|
|
412
|
+
running = { root, server, slug: null };
|
|
274
413
|
server.catch(() => { if (running?.server === server) running = undefined; });
|
|
275
414
|
}
|
|
276
415
|
return running.server;
|
|
@@ -296,22 +435,41 @@ export function createDesignCanvas(deliver: (message: DesignSessionContent) => D
|
|
|
296
435
|
return { message: `The design canvas could not start: ${error instanceof Error ? error.message : String(error)}`, level: "error" };
|
|
297
436
|
}
|
|
298
437
|
const url = canvasUrl(server, slug);
|
|
299
|
-
if (running)
|
|
438
|
+
if (running) {
|
|
439
|
+
running.url = url;
|
|
440
|
+
running.slug = slug;
|
|
441
|
+
}
|
|
300
442
|
if (reused && server.connectedClients() > 0 && server.show(slug) > 0) {
|
|
443
|
+
emitTransition({ transition: "refresh", running: true, slug, connectedClients: server.connectedClients() });
|
|
301
444
|
return { message: `Design canvas refreshed: ${url}`, level: "info", url, opened: true, refreshed: true };
|
|
302
445
|
}
|
|
303
446
|
const result = await openBrowser(url);
|
|
304
|
-
if (result.opened)
|
|
447
|
+
if (result.opened) {
|
|
448
|
+
emitTransition({ transition: "open", running: true, slug, connectedClients: server.connectedClients() });
|
|
449
|
+
return { message: `Design canvas: ${url}`, level: "info", url, opened: true };
|
|
450
|
+
}
|
|
305
451
|
const reason = result.error ? ` (${result.error})` : "";
|
|
306
452
|
return { message: `Design canvas: ${url}\nThe browser could not be opened${reason}. Open the URL manually.`, level: "warning", url, opened: false };
|
|
307
453
|
}
|
|
308
454
|
|
|
309
|
-
|
|
455
|
+
async function state(): Promise<DesignCanvasState> {
|
|
456
|
+
if (!running) return { running: false, slug: null, connectedClients: 0 };
|
|
457
|
+
const server = await running.server.catch(() => undefined);
|
|
458
|
+
if (!server) return { running: false, slug: null, connectedClients: 0 };
|
|
459
|
+
return { running: true, slug: running.slug, connectedClients: server.connectedClients() };
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function observe(onTransition: (transition: DesignCanvasTransition) => void): () => void {
|
|
463
|
+
observers.add(onTransition);
|
|
464
|
+
return () => observers.delete(onTransition);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
return { open, stop, url: () => running?.url, state, observe };
|
|
310
468
|
}
|
|
311
469
|
|
|
312
470
|
export const DESIGN_COMMENTS_TOOL_NAME = "gentle_design_comments";
|
|
313
471
|
|
|
314
|
-
export type DesignCommentsToolParams = { action: "list" | "resolve"; slug?: string; file?: string; ids?: string[] };
|
|
472
|
+
export type DesignCommentsToolParams = { action: "list" | "resolve"; slug?: string; file?: string; ids?: string[]; note?: string };
|
|
315
473
|
export type DesignCommentsToolResult = { text: string; details: { comments: Array<StoredDesignComment & { slug: string }> } | { slug: string; resolved: string[]; unknown: string[] } };
|
|
316
474
|
|
|
317
475
|
function describeComment(slug: string, comment: StoredDesignComment): string[] {
|
|
@@ -319,6 +477,7 @@ function describeComment(slug: string, comment: StoredDesignComment): string[] {
|
|
|
319
477
|
`- [${comment.id}] design/${slug}/${comment.file}`,
|
|
320
478
|
` Element: ${comment.selector}`,
|
|
321
479
|
` Excerpt: ${comment.excerpt ? JSON.stringify(comment.excerpt) : "(none)"}`,
|
|
480
|
+
...(comment.viewport ? [` Viewport: ${describeViewport(comment.viewport)} (edit for this width)`] : []),
|
|
322
481
|
` Comment: ${comment.comment.split("\n").join("\n ")}`,
|
|
323
482
|
...(comment.screenshot ? [` Screenshot: design/${slug}/${comment.screenshot} (open it with the read tool)`] : []),
|
|
324
483
|
];
|
|
@@ -334,7 +493,11 @@ export async function runDesignCommentsTool(cwd: string, params: DesignCommentsT
|
|
|
334
493
|
if (typeof params.slug !== "string" || !params.slug) throw new Error("resolve needs the design slug.");
|
|
335
494
|
const ids = params.ids ?? [];
|
|
336
495
|
if (ids.length === 0) throw new Error("resolve needs at least one comment id in ids.");
|
|
337
|
-
|
|
496
|
+
if (params.note !== undefined) {
|
|
497
|
+
const problem = noteProblem(params.note);
|
|
498
|
+
if (problem) throw new Error(problem);
|
|
499
|
+
}
|
|
500
|
+
const { updated, unknown } = await store.setStatus(params.slug, ids, "resolved", params.note === undefined ? undefined : { note: params.note }).catch((error: unknown) => { throw failure(params.slug!, error); });
|
|
338
501
|
const resolved = updated.map((comment) => comment.id);
|
|
339
502
|
const lines = [`Resolved ${resolved.length} comment${resolved.length === 1 ? "" : "s"} in design/${params.slug}${resolved.length ? `: ${resolved.join(", ")}` : ""}.`];
|
|
340
503
|
if (unknown.length) lines.push(`Unknown ids: ${unknown.join(", ")}.`);
|
|
@@ -355,7 +518,7 @@ export async function runDesignCommentsTool(cwd: string, params: DesignCommentsT
|
|
|
355
518
|
const scope = params.slug ? `design/${params.slug}${params.file ? `/${params.file}` : ""}` : "design/";
|
|
356
519
|
const lines = found.length === 0
|
|
357
520
|
? [`No open comments in ${scope}.`]
|
|
358
|
-
: [`Open design comments in ${scope} (${found.length}):`, ...found.flatMap((comment) => describeComment(comment.slug, comment)), "", `After applying a comment, resolve it with ${DESIGN_COMMENTS_TOOL_NAME} (action "resolve", slug, ids).`];
|
|
521
|
+
: [`Open design comments in ${scope} (${found.length}):`, ...found.flatMap((comment) => describeComment(comment.slug, comment)), "", `After applying a comment, resolve it with ${DESIGN_COMMENTS_TOOL_NAME} (action "resolve", slug, ids, note); the note is one line on what you changed, shown next to the comment.`];
|
|
359
522
|
if (problems.length) lines.push("", "Unreadable comment files:", ...problems.map((problem) => `- ${problem}`));
|
|
360
523
|
return { text: lines.join("\n"), details: { comments: found } };
|
|
361
524
|
}
|
|
@@ -365,6 +528,7 @@ export const DESIGN_TOOL_NAME = "gentle_design";
|
|
|
365
528
|
/** Appended to the system prompt while the gentle-design skill is available (S11). */
|
|
366
529
|
export const DESIGN_PROMPT_HINT = [
|
|
367
530
|
`Gentle Design: any request for a UI design, mockup, screen, landing page or visual directions uses the ${DESIGN_SKILL_NAME} skill by default; read the skill first when it is not loaded.`,
|
|
531
|
+
`Pair it with the ${UI_DESIGN_SKILL_NAME} skill for UX quality: read that skill and only the references relevant to the brief before choosing directions.`,
|
|
368
532
|
`Before designing, call the ${DESIGN_TOOL_NAME} tool (action "list"); when the project has design sources but no design/system.md, run the skill's design system sync first.`,
|
|
369
533
|
`After writing or changing a design, open or refresh it on the canvas with the ${DESIGN_TOOL_NAME} tool (action "open" with the slug), unless the user said not to.`,
|
|
370
534
|
"Designs stay under design/<slug>/.",
|
|
@@ -378,6 +542,8 @@ export type DesignToolParams = {
|
|
|
378
542
|
status?: string;
|
|
379
543
|
note?: string;
|
|
380
544
|
previewUrl?: string;
|
|
545
|
+
/** handoff only: a part handed off on its own ("Implement only this"); its id in parts.json. */
|
|
546
|
+
part?: string;
|
|
381
547
|
};
|
|
382
548
|
/** How many design source paths list names; `total` still counts them all. */
|
|
383
549
|
const LISTED_DESIGN_SOURCES = 20;
|
|
@@ -394,7 +560,8 @@ export type DesignToolDetails =
|
|
|
394
560
|
| { url: string; opened: boolean; refreshed?: true }
|
|
395
561
|
| { stopped: boolean }
|
|
396
562
|
| { target: string; warnings: string[] }
|
|
397
|
-
| { target: string; chosen: string | null; handoff: DesignHandoff }
|
|
563
|
+
| { target: string; chosen: string | null; handoff: DesignHandoff }
|
|
564
|
+
| { target: string; part: DesignPart };
|
|
398
565
|
/** `texts` become the tool's content parts; a refusal throws, so Pi flags the result as an error. */
|
|
399
566
|
export type DesignToolResult = { texts: string[]; details: DesignToolDetails };
|
|
400
567
|
|
|
@@ -414,11 +581,20 @@ type ListedDesign = {
|
|
|
414
581
|
chosen?: string | null;
|
|
415
582
|
handoffs?: Record<string, DesignHandoff>;
|
|
416
583
|
handoffsError?: string;
|
|
584
|
+
/** Present only when the design has parts handed off on their own (canvas-implement-part). */
|
|
585
|
+
parts?: DesignPart[];
|
|
586
|
+
partsError?: string;
|
|
417
587
|
};
|
|
418
588
|
|
|
589
|
+
function partState(part: DesignPart): string {
|
|
590
|
+
const status = part.status === "in_progress" ? "in progress" : part.status;
|
|
591
|
+
return `${part.id} ${part.file} ${part.selector} (${status}${part.status === "sent" && part.queued ? ", queued" : ""})`;
|
|
592
|
+
}
|
|
593
|
+
|
|
419
594
|
async function listDesignTool(cwd: string, canvas: DesignCanvas): Promise<DesignToolResult> {
|
|
420
595
|
const designRoot = join(cwd, "design");
|
|
421
596
|
const handoffStore = createDesignHandoffStore(designRoot);
|
|
597
|
+
const partStore = createDesignPartStore(designRoot);
|
|
422
598
|
const designs: ListedDesign[] = [];
|
|
423
599
|
for (const { slug, title } of listDesigns(cwd)) {
|
|
424
600
|
let design: ListedDesign;
|
|
@@ -437,6 +613,12 @@ async function listDesignTool(cwd: string, canvas: DesignCanvas): Promise<Design
|
|
|
437
613
|
} catch (error) {
|
|
438
614
|
design.handoffsError = error instanceof Error ? error.message : String(error);
|
|
439
615
|
}
|
|
616
|
+
try {
|
|
617
|
+
const { parts } = await partStore.read(slug);
|
|
618
|
+
if (parts.length > 0) design.parts = parts;
|
|
619
|
+
} catch (error) {
|
|
620
|
+
design.partsError = error instanceof Error ? error.message : String(error);
|
|
621
|
+
}
|
|
440
622
|
designs.push(design);
|
|
441
623
|
}
|
|
442
624
|
const systemBoard = hasSystemBoard(cwd);
|
|
@@ -450,6 +632,8 @@ async function listDesignTool(cwd: string, canvas: DesignCanvas): Promise<Design
|
|
|
450
632
|
const entry = design.handoffs && Object.hasOwn(design.handoffs, artboard.file) ? design.handoffs[artboard.file] : undefined;
|
|
451
633
|
lines.push(` - ${artboard.file}: ${artboard.title}${entry ? ` (${handoffState(entry)})` : ""}`);
|
|
452
634
|
}
|
|
635
|
+
if (design.parts) lines.push(` Parts handed off on their own (${design.parts.length}): ${design.parts.map(partState).join("; ")}`);
|
|
636
|
+
if (design.partsError) lines.push(` parts.json cannot be read: ${design.partsError}`);
|
|
453
637
|
}
|
|
454
638
|
lines.push(systemBoard ? "System board: design/system.html (shown first on the canvas)." : "No system board (design/system.html).");
|
|
455
639
|
const sources = detectDesignSources(cwd);
|
|
@@ -480,6 +664,12 @@ async function handoffTool(cwd: string, params: DesignToolParams): Promise<Desig
|
|
|
480
664
|
const resolved = resolveDesignTarget(cwd, params.target ?? "", "report on");
|
|
481
665
|
if (resolved.kind === "refuse") throw new Error(resolved.notice.message);
|
|
482
666
|
const { slug, artboard } = resolved;
|
|
667
|
+
if (params.part !== undefined) {
|
|
668
|
+
// A part on its own (canvas-implement-part S6): parts.json only, so no direction is chosen.
|
|
669
|
+
const part = await createDesignPartStore(join(cwd, "design")).setStatus(slug, artboard.file, params.part, status, { note: params.note }).catch((error: unknown) => { throw partsProblem(slug, error); });
|
|
670
|
+
const text = `Part ${part.id} of design/${slug}/${artboard.file} (${part.selector}): ${status === "in_progress" ? "in progress" : "implemented"}. No direction is chosen by it.`;
|
|
671
|
+
return { texts: [text], details: { target: `${slug}/${artboard.file}`, part } };
|
|
672
|
+
}
|
|
483
673
|
const store = createDesignHandoffStore(join(cwd, "design"));
|
|
484
674
|
const handoff = await store.setStatus(slug, artboard.file, status, { note: params.note, previewUrl: params.previewUrl }).catch((error: unknown) => { throw handoffsProblem(slug, error); });
|
|
485
675
|
const { chosen } = await store.read(slug).catch((error: unknown) => { throw handoffsProblem(slug, error); });
|