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,315 @@
|
|
|
1
|
+
// Comments persisted in design/<slug>/comments.json: pins on the artboards, the
|
|
2
|
+
// list and its filter, the send mode, Send all, the panel and Comment mode.
|
|
3
|
+
|
|
4
|
+
// Every string the comments show, in English; canvas-i18n-es.js has the Spanish. The comments themselves and file names stay as written.
|
|
5
|
+
const TEXT = Object.freeze({
|
|
6
|
+
open: (count) => `Open (${count})`,
|
|
7
|
+
resolved: (count) => `Resolved (${count})`,
|
|
8
|
+
sendAll: (count) => `Send all (${count})`,
|
|
9
|
+
empty: "No comments yet. Turn on Comment mode and click an element.",
|
|
10
|
+
emptyOpen: "No open comments.",
|
|
11
|
+
emptyResolved: "No resolved comments.",
|
|
12
|
+
pin: (number, status, text) => `Comment ${number} (${status}): ${text}`,
|
|
13
|
+
statuses: { open: "open", resolved: "resolved" },
|
|
14
|
+
showLabel: (number, file) => `Show comment ${number} on ${file}`,
|
|
15
|
+
sent: "Sent",
|
|
16
|
+
notSent: "Not sent",
|
|
17
|
+
detached: "Detached",
|
|
18
|
+
shot: (number) => `Screenshot of comment ${number}`,
|
|
19
|
+
resolve: "Resolve",
|
|
20
|
+
reopen: "Reopen",
|
|
21
|
+
resolveLabel: (number) => `Resolve comment ${number}`,
|
|
22
|
+
reopenLabel: (number) => `Reopen comment ${number}`,
|
|
23
|
+
unreadable: (slug, reason) => `comments.json for ${slug} cannot be read: ${reason}`,
|
|
24
|
+
notUpdated: (reason) => `Comment not updated: ${reason}`,
|
|
25
|
+
resolvedDone: "Comment resolved",
|
|
26
|
+
reopenedDone: "Comment reopened",
|
|
27
|
+
notSentAll: (reason) => `Comments not sent: ${reason}`,
|
|
28
|
+
sentAll: (count) => `Sent ${count} comment${count === 1 ? "" : "s"} to the session`,
|
|
29
|
+
noneUnsent: "No unsent comments",
|
|
30
|
+
error: "error",
|
|
31
|
+
save: "Save",
|
|
32
|
+
send: "Send",
|
|
33
|
+
commentMode: "Comment mode: click an element in an artboard",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const LIMITS = { pins: 500 };
|
|
37
|
+
const MODE_KEY = "gentle-design:send-mode";
|
|
38
|
+
|
|
39
|
+
export function init(ctx) {
|
|
40
|
+
const { win, doc, els, store, api, ui, actions } = ctx;
|
|
41
|
+
const { state } = store;
|
|
42
|
+
const { base, getJson, postJson, isFiniteNumber } = api;
|
|
43
|
+
const { setStatus } = ui;
|
|
44
|
+
const T = ctx.i18n.text("comments", TEXT);
|
|
45
|
+
|
|
46
|
+
function storedMode() {
|
|
47
|
+
try {
|
|
48
|
+
return win.localStorage.getItem(MODE_KEY) === "collect" ? "collect" : "send";
|
|
49
|
+
} catch {
|
|
50
|
+
return "send";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function commentsForBoard(board) {
|
|
55
|
+
return state.comments.filter((comment) => comment.file === board.artboard.file);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A board's frame or one of its size frames (canvas-sizes.js) locates its artboard's comments and reports where they are. */
|
|
59
|
+
function sendPins(surface) {
|
|
60
|
+
const pins = commentsForBoard(actions.ownerOf(surface)).slice(0, LIMITS.pins).map((comment) => ({ id: comment.id, selector: comment.selector }));
|
|
61
|
+
surface.frame.contentWindow?.postMessage({ type: "gd:pins", pins }, "*");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Every frame of every design board: its own and, in All sizes, its size frames. */
|
|
65
|
+
function eachSurface(callback) {
|
|
66
|
+
for (const board of state.boards) actions.surfacesOf(board).forEach(callback);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Detached: the artboard is gone, or its own frame reported that the selector matches nothing. */
|
|
70
|
+
function isDetached(comment) {
|
|
71
|
+
const board = state.boards.find((candidate) => candidate.artboard.file === comment.file);
|
|
72
|
+
if (!board) return true;
|
|
73
|
+
return Boolean(board.rects && board.rects.has(comment.id) && board.rects.get(comment.id) === null);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function detachedKey() {
|
|
77
|
+
return state.comments.filter(isDetached).map((comment) => comment.id).join(",");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function commentNumber(comment) {
|
|
81
|
+
return state.comments.indexOf(comment) + 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** The pins of one frame, at their element's position in that frame; a size frame has its own set. */
|
|
85
|
+
function renderPins(surface) {
|
|
86
|
+
const pins = [];
|
|
87
|
+
for (const comment of commentsForBoard(actions.ownerOf(surface))) {
|
|
88
|
+
const rect = surface.rects?.get(comment.id);
|
|
89
|
+
// A 0x0 rect is an element that is hidden or not rendered: no pin at the artboard's corner.
|
|
90
|
+
if (!rect || (rect.width === 0 && rect.height === 0)) continue;
|
|
91
|
+
if (rect.x + rect.width < 0 || rect.y + rect.height < 0 || rect.x > surface.viewWidth || rect.y > surface.viewHeight) continue;
|
|
92
|
+
const pin = doc.createElement("button");
|
|
93
|
+
pin.type = "button";
|
|
94
|
+
pin.className = "gd-pin";
|
|
95
|
+
pin.dataset.id = comment.id;
|
|
96
|
+
pin.dataset.status = comment.status;
|
|
97
|
+
pin.classList.toggle("gd-pin-active", comment.id === state.activeId);
|
|
98
|
+
pin.textContent = String(commentNumber(comment));
|
|
99
|
+
pin.setAttribute("aria-label", T.pin(commentNumber(comment), T.statuses[comment.status] ?? comment.status, comment.comment));
|
|
100
|
+
pin.style.left = `${Math.max(0, rect.x)}px`;
|
|
101
|
+
pin.style.top = `${Math.max(0, rect.y)}px`;
|
|
102
|
+
pin.addEventListener("click", (event) => {
|
|
103
|
+
event.stopPropagation();
|
|
104
|
+
selectComment(comment.id, { scroll: false, focusList: true });
|
|
105
|
+
});
|
|
106
|
+
pins.push(pin);
|
|
107
|
+
}
|
|
108
|
+
const focused = surface.pins.contains(doc.activeElement) ? doc.activeElement.dataset.id : null;
|
|
109
|
+
surface.pins.replaceChildren(...pins);
|
|
110
|
+
if (focused) pins.find((pin) => pin.dataset.id === focused)?.focus();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function renderList() {
|
|
114
|
+
const open = state.comments.filter((comment) => comment.status === "open");
|
|
115
|
+
const resolved = state.comments.filter((comment) => comment.status === "resolved");
|
|
116
|
+
els.filterOpen.textContent = T.open(open.length);
|
|
117
|
+
els.filterResolved.textContent = T.resolved(resolved.length);
|
|
118
|
+
els.filterOpen.setAttribute("aria-pressed", String(state.filter === "open"));
|
|
119
|
+
els.filterResolved.setAttribute("aria-pressed", String(state.filter === "resolved"));
|
|
120
|
+
els.countComments.textContent = String(open.length);
|
|
121
|
+
const unsent = open.filter((comment) => comment.sentAt === null).length;
|
|
122
|
+
els.sendAll.textContent = T.sendAll(unsent);
|
|
123
|
+
els.sendAll.disabled = unsent === 0 || sendingAll;
|
|
124
|
+
const shown = state.filter === "open" ? open : resolved;
|
|
125
|
+
els.panelEmpty.hidden = shown.length > 0;
|
|
126
|
+
els.panelEmpty.textContent = state.comments.length === 0 ? T.empty : state.filter === "open" ? T.emptyOpen : T.emptyResolved;
|
|
127
|
+
els.list.replaceChildren(...shown.map((comment) => {
|
|
128
|
+
const item = doc.createElement("li");
|
|
129
|
+
item.className = "gd-comment-item";
|
|
130
|
+
item.dataset.id = comment.id;
|
|
131
|
+
item.classList.toggle("gd-active", comment.id === state.activeId);
|
|
132
|
+
const show = doc.createElement("button");
|
|
133
|
+
show.type = "button";
|
|
134
|
+
show.className = "gd-comment-show";
|
|
135
|
+
show.setAttribute("aria-label", T.showLabel(commentNumber(comment), comment.file));
|
|
136
|
+
const meta = doc.createElement("span");
|
|
137
|
+
meta.className = "gd-comment-meta";
|
|
138
|
+
const number = doc.createElement("span");
|
|
139
|
+
number.className = "gd-comment-number";
|
|
140
|
+
number.textContent = `#${commentNumber(comment)}`;
|
|
141
|
+
const file = doc.createElement("span");
|
|
142
|
+
file.textContent = comment.file;
|
|
143
|
+
meta.append(number, file);
|
|
144
|
+
const badge = (text, kind) => {
|
|
145
|
+
const element = doc.createElement("span");
|
|
146
|
+
element.className = `gd-badge gd-badge-${kind}`;
|
|
147
|
+
element.textContent = text;
|
|
148
|
+
meta.append(element);
|
|
149
|
+
};
|
|
150
|
+
badge(comment.sentAt ? T.sent : T.notSent, comment.sentAt ? "sent" : "unsent");
|
|
151
|
+
if (isDetached(comment)) badge(T.detached, "detached");
|
|
152
|
+
const text = doc.createElement("span");
|
|
153
|
+
text.className = "gd-comment-text";
|
|
154
|
+
text.style.display = "block";
|
|
155
|
+
text.textContent = comment.comment;
|
|
156
|
+
show.append(meta, text);
|
|
157
|
+
// The size it was made at, when not at the artboard's own size (canvas-sizes.js).
|
|
158
|
+
const made = actions.viewportChip(comment.viewport);
|
|
159
|
+
if (made) show.append(made);
|
|
160
|
+
if (comment.screenshot) {
|
|
161
|
+
const shot = doc.createElement("img");
|
|
162
|
+
shot.className = "gd-comment-shot";
|
|
163
|
+
shot.alt = T.shot(commentNumber(comment));
|
|
164
|
+
shot.loading = "lazy";
|
|
165
|
+
shot.src = `${base}api/designs/${encodeURIComponent(state.slug)}/comments/${encodeURIComponent(comment.id)}/screenshot`;
|
|
166
|
+
show.append(shot);
|
|
167
|
+
}
|
|
168
|
+
show.addEventListener("click", () => selectComment(comment.id, { scroll: true, focusList: false }));
|
|
169
|
+
const controls = doc.createElement("div");
|
|
170
|
+
controls.className = "gd-comment-actions";
|
|
171
|
+
const toggle = doc.createElement("button");
|
|
172
|
+
toggle.type = "button";
|
|
173
|
+
const next = comment.status === "open" ? "resolved" : "open";
|
|
174
|
+
toggle.textContent = next === "resolved" ? T.resolve : T.reopen;
|
|
175
|
+
toggle.setAttribute("aria-label", (next === "resolved" ? T.resolveLabel : T.reopenLabel)(commentNumber(comment)));
|
|
176
|
+
toggle.addEventListener("click", () => setCommentStatus(comment.id, next));
|
|
177
|
+
controls.append(toggle);
|
|
178
|
+
item.append(show, controls);
|
|
179
|
+
return item;
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function renderComments() {
|
|
184
|
+
renderList();
|
|
185
|
+
eachSurface(renderPins);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async function loadComments() {
|
|
189
|
+
const slug = state.slug;
|
|
190
|
+
if (!slug) return;
|
|
191
|
+
let comments = [];
|
|
192
|
+
try {
|
|
193
|
+
comments = (await getJson(`api/designs/${encodeURIComponent(slug)}/comments`)).comments;
|
|
194
|
+
} catch (error) {
|
|
195
|
+
setStatus(T.unreadable(slug, error.message), true);
|
|
196
|
+
}
|
|
197
|
+
if (slug !== state.slug || !Array.isArray(comments)) return;
|
|
198
|
+
store.setComments({ comments });
|
|
199
|
+
if (state.activeId && !comments.some((comment) => comment.id === state.activeId)) store.setComments({ activeId: null });
|
|
200
|
+
eachSurface(sendPins);
|
|
201
|
+
renderComments();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function selectComment(id, options) {
|
|
205
|
+
store.setComments({ activeId: id });
|
|
206
|
+
renderComments();
|
|
207
|
+
const comment = state.comments.find((candidate) => candidate.id === id);
|
|
208
|
+
if (!comment) return;
|
|
209
|
+
if (comment.status !== state.filter && options.focusList) {
|
|
210
|
+
store.setComments({ filter: comment.status });
|
|
211
|
+
renderList();
|
|
212
|
+
}
|
|
213
|
+
const board = state.boards.find((candidate) => candidate.artboard.file === comment.file);
|
|
214
|
+
if (board) for (const surface of actions.surfacesOf(board)) surface.frame.contentWindow?.postMessage({ type: "gd:highlight", id }, "*");
|
|
215
|
+
// A pin clicked while Quality shows brings the list back, so focus can land in it.
|
|
216
|
+
if (options.focusList && state.tab !== "comments") actions.setTab("comments");
|
|
217
|
+
if (options.focusList) els.list.querySelector(`[data-id="${win.CSS.escape(id)}"] .gd-comment-show`)?.focus();
|
|
218
|
+
if (!options.scroll) return;
|
|
219
|
+
// The focused artboard is already at 1:1; another board's comment leaves focus mode first.
|
|
220
|
+
if (state.focus) {
|
|
221
|
+
if (state.focus === board) return;
|
|
222
|
+
actions.exitFocus();
|
|
223
|
+
}
|
|
224
|
+
const pin = board?.pins.querySelector(`[data-id="${win.CSS.escape(id)}"]`);
|
|
225
|
+
const target = pin ?? board?.frame;
|
|
226
|
+
if (!target) return;
|
|
227
|
+
const viewport = els.viewport.getBoundingClientRect();
|
|
228
|
+
const rect = target.getBoundingClientRect();
|
|
229
|
+
actions.panBy(viewport.left + viewport.width / 2 - (rect.left + rect.width / 2), viewport.top + viewport.height / 2 - (rect.top + rect.height / 2));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
async function setCommentStatus(id, status) {
|
|
233
|
+
const slug = state.slug;
|
|
234
|
+
const reply = await postJson(`api/designs/${encodeURIComponent(slug)}/comments/${encodeURIComponent(id)}/status`, { status }).catch((error) => ({ ok: false, body: { error: error.message } }));
|
|
235
|
+
if (!reply.ok) setStatus(T.notUpdated(reply.body.reason || reply.body.error || T.error), true);
|
|
236
|
+
else setStatus(status === "resolved" ? T.resolvedDone : T.reopenedDone, false);
|
|
237
|
+
await loadComments();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Send all is in flight: any re-render (a filter, a language switch) keeps the button disabled until the reply.
|
|
241
|
+
let sendingAll = false;
|
|
242
|
+
els.sendAll.addEventListener("click", async () => {
|
|
243
|
+
const slug = state.slug;
|
|
244
|
+
if (!slug) return;
|
|
245
|
+
sendingAll = true;
|
|
246
|
+
els.sendAll.disabled = true;
|
|
247
|
+
const reply = await postJson(`api/designs/${encodeURIComponent(slug)}/comments/send-all`, {}).catch((error) => ({ ok: false, body: { error: error.message } }));
|
|
248
|
+
sendingAll = false;
|
|
249
|
+
if (!reply.ok) setStatus(T.notSentAll(reply.body.reason || reply.body.error || T.error), true);
|
|
250
|
+
else setStatus(reply.body.sent ? T.sentAll(reply.body.sent) : T.noneUnsent, false);
|
|
251
|
+
await loadComments();
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
function setMode(mode) {
|
|
255
|
+
store.setMode(mode === "collect" ? "collect" : "send");
|
|
256
|
+
els.modeSend.checked = state.mode === "send";
|
|
257
|
+
els.modeCollect.checked = state.mode === "collect";
|
|
258
|
+
labelSend();
|
|
259
|
+
try { win.localStorage.setItem(MODE_KEY, state.mode); } catch { /* storage may be unavailable */ }
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** The comment box's submit button: Save in Collect, Send in Send now. */
|
|
263
|
+
function labelSend() {
|
|
264
|
+
els.send.textContent = state.mode === "collect" ? T.save : T.send;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** A new language: the panel, the pins and the submit button, in place (no frame reloads). */
|
|
268
|
+
function relabel() {
|
|
269
|
+
renderComments();
|
|
270
|
+
labelSend();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
els.modeSend.addEventListener("change", () => setMode("send"));
|
|
274
|
+
els.modeCollect.addEventListener("change", () => setMode("collect"));
|
|
275
|
+
els.filterOpen.addEventListener("click", () => { store.setComments({ filter: "open" }); renderList(); });
|
|
276
|
+
els.filterResolved.addEventListener("click", () => { store.setComments({ filter: "resolved" }); renderList(); });
|
|
277
|
+
function setPanel(show) {
|
|
278
|
+
els.panel.hidden = !show;
|
|
279
|
+
els.panelToggle.setAttribute("aria-pressed", String(show));
|
|
280
|
+
// The viewport changes size with the panel; without ResizeObserver nothing else reports it.
|
|
281
|
+
if (typeof win.ResizeObserver !== "function") actions.viewportResized();
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
els.panelToggle.addEventListener("click", () => setPanel(els.panel.hidden));
|
|
285
|
+
|
|
286
|
+
function readRects(data) {
|
|
287
|
+
if (!Array.isArray(data.rects) || data.rects.length > LIMITS.pins) return null;
|
|
288
|
+
const rects = new Map();
|
|
289
|
+
for (const entry of data.rects) {
|
|
290
|
+
if (!entry || typeof entry.id !== "string" || entry.id.length > 32) return null;
|
|
291
|
+
const rect = entry.rect;
|
|
292
|
+
if (rect === null) rects.set(entry.id, null);
|
|
293
|
+
else if (rect && ["x", "y", "width", "height"].every((key) => isFiniteNumber(rect[key]))) rects.set(entry.id, { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
|
|
294
|
+
else return null;
|
|
295
|
+
}
|
|
296
|
+
return rects;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function setCommenting(enabled) {
|
|
300
|
+
store.setCommenting(enabled);
|
|
301
|
+
actions.renderTools();
|
|
302
|
+
els.world.classList.toggle("gd-commenting", enabled);
|
|
303
|
+
state.boards.forEach((board) => board.sizesView?.classList.toggle("gd-commenting", enabled));
|
|
304
|
+
eachSurface(actions.sendMode);
|
|
305
|
+
setStatus(enabled ? T.commentMode : "", false);
|
|
306
|
+
if (!enabled) {
|
|
307
|
+
actions.setHoverBoard(null);
|
|
308
|
+
actions.closePopover();
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
els.comment.addEventListener("click", () => setCommenting(!state.commenting));
|
|
313
|
+
|
|
314
|
+
return { relabel, storedMode, sendPins, detachedKey, renderPins, renderList, renderComments, loadComments, setMode, setPanel, readRects, setCommenting };
|
|
315
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// Compare: an implemented artboard next to the running app at its loopback
|
|
2
|
+
// previewUrl, both at the artboard's size, over the canvas and the panel.
|
|
3
|
+
|
|
4
|
+
// The running app is another loopback origin (previewTarget refuses this server's own
|
|
5
|
+
// port), so the same-origin flag below gives the app its own origin, never the canvas's: it cannot
|
|
6
|
+
// reach this page, its token or its API, and its scripts, storage and forms work as in
|
|
7
|
+
// production. No top-navigation flag is granted, so it can never navigate the canvas away.
|
|
8
|
+
const PREVIEW_SANDBOX = "allow-scripts allow-same-origin allow-forms allow-popups";
|
|
9
|
+
const PREVIEW_TIMEOUT_MS = 6000;
|
|
10
|
+
const COMPARE_GAP = 24;
|
|
11
|
+
const COMPARE_PADDING = 24;
|
|
12
|
+
|
|
13
|
+
// Every string Compare shows, in English; canvas-i18n-es.js has the Spanish. Titles, file names and URLs stay as written.
|
|
14
|
+
const TEXT = Object.freeze({
|
|
15
|
+
hint: "If the app refuses to be framed, use Open in new tab.",
|
|
16
|
+
// CSP host sources have no IPv6 literal form, so Chromium drops the [::1] source from frame-src.
|
|
17
|
+
ipv6: "Browsers do not frame [::1] under the canvas policy (CSP has no IPv6 sources): use Open in new tab, or report the preview on localhost.",
|
|
18
|
+
title: (title) => `Compare: ${title}`,
|
|
19
|
+
artboardFrame: (title) => `${title} artboard`,
|
|
20
|
+
appFrame: (preview) => `Running app at ${preview}`,
|
|
21
|
+
designCaption: (file) => `Design: ${file}`,
|
|
22
|
+
appCaption: (preview) => `Implementation: ${preview}`,
|
|
23
|
+
loadError: (preview) => `The app at ${preview} could not be loaded in the frame. Use Open in new tab.`,
|
|
24
|
+
timeout: (preview) => `The app at ${preview} has not loaded; it may be down or refuse to be framed. Use Open in new tab.`,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export function init(ctx) {
|
|
28
|
+
const { win, doc, els, store, actions } = ctx;
|
|
29
|
+
const { state } = store;
|
|
30
|
+
const T = ctx.i18n.text("compare", TEXT);
|
|
31
|
+
|
|
32
|
+
function comparePane(frame) {
|
|
33
|
+
const figure = doc.createElement("figure");
|
|
34
|
+
figure.className = "gd-compare-pane";
|
|
35
|
+
const label = doc.createElement("figcaption");
|
|
36
|
+
label.className = "gd-compare-caption";
|
|
37
|
+
figure.append(label, frame);
|
|
38
|
+
return figure;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function compareFrame(width, height) {
|
|
42
|
+
const frame = doc.createElement("iframe");
|
|
43
|
+
frame.className = "gd-compare-frame";
|
|
44
|
+
frame.setAttribute("referrerpolicy", "no-referrer");
|
|
45
|
+
frame.style.width = `${width}px`;
|
|
46
|
+
frame.style.height = `${height}px`;
|
|
47
|
+
return frame;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** text: the message, as a function so a new language writes it again (relabel). */
|
|
51
|
+
function setCompareMessage(compare, text, isError) {
|
|
52
|
+
compare.message = { text, isError };
|
|
53
|
+
els.compareMessage.textContent = text();
|
|
54
|
+
els.compareMessage.classList.toggle("gd-error", Boolean(isError));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Compare's own text, in the current language: its title, the captions and names of both frames, and its message. */
|
|
58
|
+
function labelCompare() {
|
|
59
|
+
const compare = state.compare;
|
|
60
|
+
if (!compare) return;
|
|
61
|
+
const { board, preview, artboardFrame, app, panes } = compare;
|
|
62
|
+
els.compareTitle.textContent = T.title(board.artboard.title);
|
|
63
|
+
artboardFrame.title = T.artboardFrame(board.artboard.title);
|
|
64
|
+
app.title = T.appFrame(preview);
|
|
65
|
+
panes[0].children[0].textContent = T.designCaption(board.artboard.file);
|
|
66
|
+
panes[1].children[0].textContent = T.appCaption(preview);
|
|
67
|
+
setCompareMessage(compare, compare.message.text, compare.message.isError);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** 100% by default; past the window width, "Scale to fit" shrinks the pair to fit. */
|
|
71
|
+
function layoutCompare() {
|
|
72
|
+
const compare = state.compare;
|
|
73
|
+
if (!compare) return;
|
|
74
|
+
const { width } = compare.board.artboard;
|
|
75
|
+
const needed = width * 2 + COMPARE_GAP;
|
|
76
|
+
const available = els.compareStage.getBoundingClientRect().width - COMPARE_PADDING * 2;
|
|
77
|
+
const wide = needed > available;
|
|
78
|
+
els.compareFitField.hidden = !wide;
|
|
79
|
+
const scale = wide && els.compareFit.checked ? Math.max(0.05, available / needed) : 1;
|
|
80
|
+
els.comparePanes.style.transform = scale === 1 ? "none" : `scale(${scale.toFixed(3)})`;
|
|
81
|
+
// The sizer keeps the scroll area at the scaled size.
|
|
82
|
+
els.compareSizer.style.width = scale === 1 ? "" : `${Math.ceil(needed * scale)}px`;
|
|
83
|
+
els.compareSizer.style.height = scale === 1 ? "" : `${Math.ceil(els.comparePanes.offsetHeight * scale)}px`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** The artboard (sandboxed as on the canvas) next to the running app, both at the artboard's size. */
|
|
87
|
+
function enterCompare(board, preview) {
|
|
88
|
+
exitCompare(false);
|
|
89
|
+
actions.exitFocus();
|
|
90
|
+
actions.closePopover();
|
|
91
|
+
actions.setHoverBoard(null);
|
|
92
|
+
const { width, height } = board.artboard;
|
|
93
|
+
const artboardFrame = compareFrame(width, height);
|
|
94
|
+
artboardFrame.setAttribute("sandbox", "allow-scripts");
|
|
95
|
+
// Like focus mode: the artboard owns its scroll, and Shift+Esc inside it asks to leave.
|
|
96
|
+
artboardFrame.addEventListener("load", () => artboardFrame.contentWindow?.postMessage({ type: "gd:focus", enabled: true }, "*"));
|
|
97
|
+
artboardFrame.src = actions.boardUrl(board);
|
|
98
|
+
const app = compareFrame(width, height);
|
|
99
|
+
app.setAttribute("sandbox", PREVIEW_SANDBOX);
|
|
100
|
+
const panes = [comparePane(artboardFrame), comparePane(app)];
|
|
101
|
+
// This module's own object: the load and timeout below update it in place, and so does a new language (labelCompare).
|
|
102
|
+
const compare = { board, preview, artboardFrame, app, panes, timer: 0, loaded: false, message: null };
|
|
103
|
+
const failed = (text) => {
|
|
104
|
+
if (state.compare === compare) setCompareMessage(compare, text, true);
|
|
105
|
+
};
|
|
106
|
+
// A frame refused by X-Frame-Options or frame-ancestors may still fire load, so the
|
|
107
|
+
// Open in new tab fallback is always shown; a missing load also says so.
|
|
108
|
+
app.addEventListener("load", () => { compare.loaded = true; });
|
|
109
|
+
app.addEventListener("error", () => failed(() => T.loadError(preview)));
|
|
110
|
+
compare.timer = win.setTimeout(() => {
|
|
111
|
+
if (!compare.loaded) failed(() => T.timeout(preview));
|
|
112
|
+
}, PREVIEW_TIMEOUT_MS);
|
|
113
|
+
app.src = preview;
|
|
114
|
+
store.setCompare(compare);
|
|
115
|
+
// A new tab with no opener and no Referer: the canvas URL carries the server token.
|
|
116
|
+
els.compareOpen.setAttribute("target", "_blank");
|
|
117
|
+
els.compareOpen.setAttribute("rel", "noopener noreferrer");
|
|
118
|
+
els.compareOpen.href = preview;
|
|
119
|
+
const ipv6 = new win.URL(preview).hostname === "[::1]";
|
|
120
|
+
compare.message = { text: () => (ipv6 ? T.ipv6 : T.hint), isError: false };
|
|
121
|
+
els.comparePanes.replaceChildren(...panes);
|
|
122
|
+
labelCompare();
|
|
123
|
+
els.compareFit.checked = false;
|
|
124
|
+
els.compare.hidden = false;
|
|
125
|
+
// Compare covers the rail too: inert, its controls leave the keyboard and the pointer.
|
|
126
|
+
els.viewport.inert = true;
|
|
127
|
+
els.panel.inert = true;
|
|
128
|
+
els.rail.inert = true;
|
|
129
|
+
for (const control of [els.zoomOut, els.zoomIn, els.fit, els.railFit, els.design]) control.disabled = true;
|
|
130
|
+
// Compare covers the canvas: nothing to arrange, and no minimap.
|
|
131
|
+
actions.renderArrange();
|
|
132
|
+
actions.renderMinimap();
|
|
133
|
+
layoutCompare();
|
|
134
|
+
els.compareBack.focus();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function exitCompare(restoreFocus) {
|
|
138
|
+
const compare = state.compare;
|
|
139
|
+
if (!compare) return;
|
|
140
|
+
win.clearTimeout(compare.timer);
|
|
141
|
+
store.setCompare(null);
|
|
142
|
+
els.comparePanes.replaceChildren();
|
|
143
|
+
els.compareOpen.removeAttribute("href");
|
|
144
|
+
els.compare.hidden = true;
|
|
145
|
+
els.viewport.inert = false;
|
|
146
|
+
els.panel.inert = false;
|
|
147
|
+
els.rail.inert = false;
|
|
148
|
+
actions.applyFocusState();
|
|
149
|
+
if (!restoreFocus) return;
|
|
150
|
+
const board = state.boards.find((candidate) => candidate.artboard.file === compare.board.artboard.file);
|
|
151
|
+
const button = board ? Array.from(board.handoff.children).find((child) => child.classList.contains("gd-compare-start")) : null;
|
|
152
|
+
(button ?? els.viewport).focus();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
els.compareBack.addEventListener("click", () => exitCompare(true));
|
|
156
|
+
els.compareFit.addEventListener("change", layoutCompare);
|
|
157
|
+
|
|
158
|
+
return { layoutCompare, enterCompare, exitCompare, relabel: labelCompare };
|
|
159
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Live reload: the server's event stream (show and change events).
|
|
2
|
+
|
|
3
|
+
// In English; canvas-i18n-es.js has the Spanish.
|
|
4
|
+
const TEXT = Object.freeze({
|
|
5
|
+
disconnected: "Live reload disconnected, retrying…",
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export function init(ctx) {
|
|
9
|
+
const { win, els, store, api, ui, actions } = ctx;
|
|
10
|
+
const { state } = store;
|
|
11
|
+
const T = ctx.i18n.text("events", TEXT);
|
|
12
|
+
const { base } = api;
|
|
13
|
+
const { setStatus } = ui;
|
|
14
|
+
|
|
15
|
+
function connectEvents() {
|
|
16
|
+
const source = new win.EventSource(`${base}events`);
|
|
17
|
+
source.addEventListener("open", () => {
|
|
18
|
+
if (els.status.classList.contains("gd-error")) setStatus("", false);
|
|
19
|
+
});
|
|
20
|
+
source.addEventListener("error", () => setStatus(T.disconnected, true));
|
|
21
|
+
source.addEventListener("show", (event) => {
|
|
22
|
+
let request;
|
|
23
|
+
try { request = JSON.parse(event.data); } catch { return; }
|
|
24
|
+
if (!request || typeof request !== "object") return;
|
|
25
|
+
if (request.slug !== null && !(typeof request.slug === "string" && /^[a-z0-9][a-z0-9-]*$/.test(request.slug))) return;
|
|
26
|
+
actions.showDesign(request.slug).catch(() => {});
|
|
27
|
+
});
|
|
28
|
+
source.addEventListener("change", (event) => {
|
|
29
|
+
let change;
|
|
30
|
+
try { change = JSON.parse(event.data); } catch { return; }
|
|
31
|
+
if (!change || typeof change.file !== "string") return;
|
|
32
|
+
if (change.slug === null) {
|
|
33
|
+
if (change.file === "system.html") actions.onSystemChange().catch(() => {});
|
|
34
|
+
// The design tokens: nothing reloads, the token inspector compares with the new ones.
|
|
35
|
+
else if (change.file === "system.md") actions.loadTokens().catch(() => {});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (typeof change.slug !== "string") return;
|
|
39
|
+
if (change.file === "design.json") {
|
|
40
|
+
actions.refreshDesigns().then(() => {
|
|
41
|
+
if (change.slug === state.slug) return actions.loadManifest(state.slug, true);
|
|
42
|
+
if (!state.manifest && state.slug) return actions.loadManifest(state.slug, false);
|
|
43
|
+
return undefined;
|
|
44
|
+
}).catch(() => {});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (change.slug !== state.slug) return;
|
|
48
|
+
if (change.file === "comments.json") {
|
|
49
|
+
actions.loadComments();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (change.file === "handoffs.json") {
|
|
53
|
+
actions.loadHandoffs();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// Not a shared asset: a part's progress reloads no artboard.
|
|
57
|
+
if (change.file === "parts.json") {
|
|
58
|
+
actions.loadParts();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// Nor is where the boards sit: they move, nothing reloads.
|
|
62
|
+
if (change.file === "layout.json") {
|
|
63
|
+
actions.onLayoutChange().catch(() => {});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (state.compare && state.compare.board.artboard.file === change.file) state.compare.artboardFrame.src = `${actions.boardUrl(state.compare.board)}?v=${Date.now()}`;
|
|
67
|
+
const matching = state.boards.filter((board) => board.artboard.file === change.file);
|
|
68
|
+
// A shared asset (CSS, image, font) can affect every artboard of the design.
|
|
69
|
+
const targets = matching.length > 0 ? matching : change.file.endsWith(".html") ? [] : state.boards;
|
|
70
|
+
targets.forEach(actions.reloadBoard);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return { connectEvents };
|
|
75
|
+
}
|