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,721 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { createStore } from "../assets/design-canvas/canvas-store.js";
|
|
6
|
+
import { DESIGN_CANVAS_ASSETS } from "../lib/design-canvas-assets.ts";
|
|
7
|
+
import { findAll, flush, inspectorPick, loadCanvas, read, texts, withClass, type FakeElement } from "./support/design-canvas-dom.ts";
|
|
8
|
+
|
|
9
|
+
// Partial implementations (canvas-parts.js): Implement only this in the comment popover, the
|
|
10
|
+
// "Partial implementations · N" section at the bottom of the panel (state in words, time, excerpt,
|
|
11
|
+
// the agent's note, Show) and Remove for a part the agent never took up (S2), with every reload and
|
|
12
|
+
// design-switch race the maintainer probes (S7). Every assertion compares strings, numbers or
|
|
13
|
+
// booleans, never fake elements, which node:assert would walk whole on a failure.
|
|
14
|
+
|
|
15
|
+
const PARTS_URL = "/t/api/designs/alpha/parts";
|
|
16
|
+
const BETA_PARTS_URL = "/t/api/designs/beta/parts";
|
|
17
|
+
const PART_URL = "/t/api/designs/alpha/implement-part";
|
|
18
|
+
const REMOVE_URL = "/t/api/designs/alpha/parts/remove";
|
|
19
|
+
const ONLINE = { delivery: { part: true } };
|
|
20
|
+
|
|
21
|
+
async function loadParts(replies: Record<string, unknown> = {}, config: Record<string, unknown> = ONLINE) {
|
|
22
|
+
const canvas = await loadCanvas(300, replies, config);
|
|
23
|
+
// The fake DOM starts every element visible; index.html starts these hidden.
|
|
24
|
+
for (const id of ["gd-popover", "gd-menu", "gd-device-menu"]) canvas.document.getElementById(id).hidden = true;
|
|
25
|
+
return canvas;
|
|
26
|
+
}
|
|
27
|
+
type Canvas = Awaited<ReturnType<typeof loadParts>>;
|
|
28
|
+
|
|
29
|
+
const $ = (canvas: Canvas, id: string) => canvas.document.getElementById(id);
|
|
30
|
+
const settle = async () => { for (let i = 0; i < 10; i++) await flush(); };
|
|
31
|
+
/** A reply the test answers later: the request stays in flight until then. */
|
|
32
|
+
function deferred() {
|
|
33
|
+
let answer!: (value: unknown) => void;
|
|
34
|
+
const promise = new Promise((resolve) => { answer = resolve; });
|
|
35
|
+
return { promise, answer };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function todayAt(hours: number, minutes: number) {
|
|
39
|
+
const date = new Date();
|
|
40
|
+
date.setHours(hours, minutes, 0, 0);
|
|
41
|
+
return date.toISOString();
|
|
42
|
+
}
|
|
43
|
+
function storedPart(extra: Record<string, unknown> = {}) {
|
|
44
|
+
return { id: "p1", file: "01-a.html", selector: "nav.side", excerpt: "Home Tours", status: "sent", queued: false, sentAt: todayAt(9, 30), startedAt: null, implementedAt: null, ...extra };
|
|
45
|
+
}
|
|
46
|
+
const partsDoc = (...parts: unknown[]) => ({ version: 1, parts });
|
|
47
|
+
|
|
48
|
+
const items = (canvas: Canvas) => withClass($(canvas, "gd-parts-list"), "gd-part");
|
|
49
|
+
const one = (root: FakeElement, name: string) => withClass(root, name)[0];
|
|
50
|
+
const text = (root: FakeElement, name: string) => texts(root, name)[0] ?? "";
|
|
51
|
+
const row = (item: FakeElement) => [text(item, "gd-part-title"), text(item, "gd-part-state"), text(item, "gd-part-excerpt"), text(item, "gd-part-time"), text(item, "gd-part-note")];
|
|
52
|
+
const bodiesTo = (canvas: Canvas, url: string) => canvas.posts.filter((post) => post.url === url).map((post) => post.body);
|
|
53
|
+
const fetchCount = (canvas: Canvas, url: string) => canvas.fetched.filter((fetched) => fetched === url).length;
|
|
54
|
+
|
|
55
|
+
function pick(canvas: Canvas, index: number, data: Record<string, unknown> = {}) {
|
|
56
|
+
if ($(canvas, "gd-comment").getAttribute("aria-pressed") !== "true") $(canvas, "gd-comment").dispatch("click");
|
|
57
|
+
const frame = canvas.frames()[index];
|
|
58
|
+
canvas.message(frame.contentWindow, inspectorPick(frame, { type: "gd:pick", selector: "nav.side", excerpt: "Home Tours", rect: { x: 1, y: 1, width: 10, height: 10 }, ...data }));
|
|
59
|
+
}
|
|
60
|
+
function implementOnlyThis(canvas: Canvas, index: number, data: Record<string, unknown> = {}, note = "") {
|
|
61
|
+
pick(canvas, index, data);
|
|
62
|
+
$(canvas, "gd-popover-text").value = note;
|
|
63
|
+
$(canvas, "gd-popover-part").dispatch("click");
|
|
64
|
+
}
|
|
65
|
+
/** Remove, then the confirm's Remove, on the part at `index`. */
|
|
66
|
+
function confirmRemove(canvas: Canvas, index: number) {
|
|
67
|
+
const item = items(canvas)[index];
|
|
68
|
+
one(item, "gd-part-remove").dispatch("click");
|
|
69
|
+
one(item, "gd-part-confirm-yes").dispatch("click");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ---- Implement only this (S8: parts in the popover)
|
|
73
|
+
|
|
74
|
+
test("Implement only this sits between Cancel and Send, enabled only when the page config's delivery.part is true", async () => {
|
|
75
|
+
const html = read("index.html");
|
|
76
|
+
const actions = html.slice(html.indexOf('<div class="gd-popover-actions">'), html.indexOf("</form>"));
|
|
77
|
+
assert.match(actions, /<button type="button" id="gd-popover-part" data-i18n="implementOnly" disabled>Implement only this<\/button>/);
|
|
78
|
+
assert.ok(actions.indexOf("gd-popover-cancel") < actions.indexOf("gd-popover-part") && actions.indexOf("gd-popover-part") < actions.indexOf("gd-popover-send"), "after Cancel, before Send");
|
|
79
|
+
const cases: Array<[Record<string, unknown>, boolean]> = [[ONLINE, true], [{}, false], [{ delivery: { part: false } }, false], [{ delivery: { part: "yes" } }, false]];
|
|
80
|
+
for (const [config, enabled] of cases) {
|
|
81
|
+
const canvas = await loadParts({ [PART_URL]: { ok: true, id: "p1", queued: false } }, config);
|
|
82
|
+
pick(canvas, 0);
|
|
83
|
+
assert.equal($(canvas, "gd-popover").hidden, false);
|
|
84
|
+
const button = $(canvas, "gd-popover-part");
|
|
85
|
+
assert.equal(button.disabled, !enabled, JSON.stringify(config));
|
|
86
|
+
if (enabled) {
|
|
87
|
+
assert.equal(button.title, "Build only this element in the project; the field is an optional note");
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
assert.equal(button.title, "The canvas is not connected to a Pi session; open it with /gentle:design open");
|
|
91
|
+
button.dispatch("click");
|
|
92
|
+
await settle();
|
|
93
|
+
assert.deepEqual(canvas.posts, [], "a disabled button sends nothing");
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("Implement only this posts the element with the optional note, says Sent or Queued, lists the part at once and saves no comment", async () => {
|
|
98
|
+
const canvas = await loadParts({ [PART_URL]: { ok: true, id: "p1", queued: false } });
|
|
99
|
+
assert.equal($(canvas, "gd-parts").hidden, true, "no parts, no section");
|
|
100
|
+
implementOnlyThis(canvas, 0, {}, " only the menu\r\nnot the header ");
|
|
101
|
+
await settle();
|
|
102
|
+
assert.deepEqual(bodiesTo(canvas, PART_URL), [{ file: "01-a.html", selector: "nav.side", excerpt: "Home Tours", note: "only the menu\nnot the header" }]);
|
|
103
|
+
assert.deepEqual(canvas.posts.map((post) => post.url), [PART_URL], "no comment is saved or sent");
|
|
104
|
+
const sent = "Sent: the session is building only this part of First now.";
|
|
105
|
+
assert.equal($(canvas, "gd-toast").textContent, sent);
|
|
106
|
+
assert.equal($(canvas, "gd-status").textContent, sent);
|
|
107
|
+
assert.equal($(canvas, "gd-popover-text").value, "", "the field is cleared");
|
|
108
|
+
assert.equal($(canvas, "gd-popover-message").textContent, "Sent to the session");
|
|
109
|
+
assert.equal($(canvas, "gd-popover-message").classes.has("gd-error"), false);
|
|
110
|
+
assert.equal($(canvas, "gd-popover-part").disabled, true, "sent: disabled until the popover opens again");
|
|
111
|
+
assert.deepEqual(texts(canvas.world, "gd-choice"), [], "no direction is chosen");
|
|
112
|
+
assert.equal($(canvas, "gd-parts").hidden, false, "the part shows before its parts.json change event");
|
|
113
|
+
assert.equal($(canvas, "gd-parts-title").textContent, "Partial implementations · 1");
|
|
114
|
+
assert.deepEqual(items(canvas).map((item) => row(item).slice(0, 3)), [["First", "Sent", "“Home Tours”"]]);
|
|
115
|
+
assert.match(text(items(canvas)[0], "gd-part-time"), /^Sent at \d\d:\d\d$/);
|
|
116
|
+
|
|
117
|
+
// The note is optional: the textarea's `required` never blocks it.
|
|
118
|
+
canvas.replies[PART_URL] = { ok: true, id: "p2", queued: true };
|
|
119
|
+
implementOnlyThis(canvas, 1, { selector: "footer", excerpt: "" });
|
|
120
|
+
await settle();
|
|
121
|
+
assert.deepEqual(bodiesTo(canvas, PART_URL)[1], { file: "02-b.html", selector: "footer", excerpt: "" });
|
|
122
|
+
assert.equal($(canvas, "gd-toast").textContent, "Queued: the session will build only this part of Second after its current task.");
|
|
123
|
+
assert.deepEqual(items(canvas).map((item) => row(item).slice(0, 3)), [["First", "Sent", "“Home Tours”"], ["Second", "Queued", ""]]);
|
|
124
|
+
|
|
125
|
+
// The parts.json change event that follows lists the same part once.
|
|
126
|
+
canvas.replies[PARTS_URL] = partsDoc(storedPart(), storedPart({ id: "p2", file: "02-b.html", selector: "footer", excerpt: "", queued: true }));
|
|
127
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
128
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["p1", "p2"]);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test("Implement only this refuses a long note, disables itself while in flight and explains each server error", async () => {
|
|
132
|
+
const canvas = await loadParts();
|
|
133
|
+
implementOnlyThis(canvas, 0, {}, "n".repeat(2001));
|
|
134
|
+
await settle();
|
|
135
|
+
assert.deepEqual(canvas.posts, []);
|
|
136
|
+
assert.equal($(canvas, "gd-popover-message").textContent, "The note can have at most 2000 characters.");
|
|
137
|
+
assert.equal($(canvas, "gd-popover-message").classes.has("gd-error"), true);
|
|
138
|
+
|
|
139
|
+
const cases: Array<[Record<string, unknown>, string]> = [
|
|
140
|
+
[{ __http: 500, error: "delivery-failed", slug: "alpha", file: "01-a.html", reason: "session closed" }, "Not sent: the session did not take it (session closed)."],
|
|
141
|
+
[{ __http: 501, error: "implement-part-unavailable" }, "Not sent: the canvas is not connected to a Pi session; open it with /gentle:design open."],
|
|
142
|
+
[{ __http: 409, error: "too-many-parts", reason: "at most 100" }, "Not sent: this design already has 100 parts; remove one first."],
|
|
143
|
+
[{ __http: 409, error: "parts-too-large", reason: "1 MiB" }, "Not sent: parts.json is full; remove a part first."],
|
|
144
|
+
[{ __http: 422, error: "invalid-parts", reason: "bad json" }, "Not sent: parts.json cannot be read; fix it or delete it."],
|
|
145
|
+
[{ __http: 400, error: "invalid-file", reason: "x" }, "Not sent: that artboard is no longer in the design."],
|
|
146
|
+
[{ __http: 404, error: "not-found" }, "Not sent: the design is gone."],
|
|
147
|
+
[{ __http: 418, error: "teapot" }, "Not sent: teapot"],
|
|
148
|
+
[{ __throw: "offline" }, "Not sent: offline"],
|
|
149
|
+
];
|
|
150
|
+
for (const [reply, message] of cases) {
|
|
151
|
+
const flight = deferred();
|
|
152
|
+
canvas.replies[PART_URL] = flight.promise;
|
|
153
|
+
implementOnlyThis(canvas, 0, {}, "only the menu");
|
|
154
|
+
await settle();
|
|
155
|
+
assert.equal($(canvas, "gd-popover-part").disabled, true, "disabled while in flight");
|
|
156
|
+
assert.equal($(canvas, "gd-popover-message").textContent, "Sending…");
|
|
157
|
+
flight.answer(reply);
|
|
158
|
+
await settle();
|
|
159
|
+
assert.equal($(canvas, "gd-popover-message").textContent, message, JSON.stringify(reply));
|
|
160
|
+
assert.equal($(canvas, "gd-popover-message").classes.has("gd-error"), true);
|
|
161
|
+
assert.equal($(canvas, "gd-popover-message").title, typeof reply.error === "string" ? reply.error : "", "the raw code in the tooltip");
|
|
162
|
+
assert.equal($(canvas, "gd-popover-part").disabled, false, "it can be retried");
|
|
163
|
+
assert.equal($(canvas, "gd-popover-text").value, "only the menu", "the note is kept");
|
|
164
|
+
}
|
|
165
|
+
assert.equal($(canvas, "gd-parts").hidden, true, "a refused part is never listed");
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test("an implement-part reply after a design switch leaves the new design's list alone and still says it was sent", async () => {
|
|
169
|
+
const flight = deferred();
|
|
170
|
+
const canvas = await loadParts({ [PART_URL]: flight.promise, [BETA_PARTS_URL]: partsDoc(storedPart({ id: "b1", file: "01-only.html", excerpt: "Beta part" })) });
|
|
171
|
+
implementOnlyThis(canvas, 0);
|
|
172
|
+
await settle();
|
|
173
|
+
await canvas.serverEvent("show", { slug: "beta" });
|
|
174
|
+
assert.equal($(canvas, "gd-popover").hidden, true, "the switch closed the popover");
|
|
175
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["b1"]);
|
|
176
|
+
flight.answer({ ok: true, id: "p9", queued: false });
|
|
177
|
+
await settle();
|
|
178
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["b1"], "the alpha part is not added to beta's list");
|
|
179
|
+
assert.equal($(canvas, "gd-toast").textContent, "Sent: the session is building only this part of First now.");
|
|
180
|
+
|
|
181
|
+
// A refusal after the switch reaches the status line, since its popover is gone.
|
|
182
|
+
const second = deferred();
|
|
183
|
+
const other = await loadParts({ [PART_URL]: second.promise });
|
|
184
|
+
implementOnlyThis(other, 0);
|
|
185
|
+
await settle();
|
|
186
|
+
await other.serverEvent("show", { slug: "beta" });
|
|
187
|
+
second.answer({ __http: 500, error: "delivery-failed", reason: "session closed" });
|
|
188
|
+
await settle();
|
|
189
|
+
assert.equal($(other, "gd-status").textContent, "Not sent: the session did not take it (session closed).");
|
|
190
|
+
assert.equal($(other, "gd-status").classes.has("gd-error"), true);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test("after a part is sent, Implement only this stays disabled until the popover opens again: a second click sends nothing", async () => {
|
|
194
|
+
const canvas = await loadParts({ [PART_URL]: { ok: true, id: "p1", queued: false } });
|
|
195
|
+
implementOnlyThis(canvas, 0);
|
|
196
|
+
await settle();
|
|
197
|
+
assert.equal(bodiesTo(canvas, PART_URL).length, 1);
|
|
198
|
+
assert.equal($(canvas, "gd-popover").hidden, false, "the popover is still open before it closes itself");
|
|
199
|
+
assert.equal($(canvas, "gd-popover-part").disabled, true);
|
|
200
|
+
$(canvas, "gd-popover-part").dispatch("click");
|
|
201
|
+
await settle();
|
|
202
|
+
assert.equal(bodiesTo(canvas, PART_URL).length, 1, "no duplicate part");
|
|
203
|
+
pick(canvas, 1);
|
|
204
|
+
assert.equal($(canvas, "gd-popover-part").disabled, false, "a new pick enables it again");
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
test("the popover message's tooltip (a refusal's raw code) goes when the popover opens again or the message changes", async () => {
|
|
208
|
+
const canvas = await loadParts({ [PART_URL]: { __http: 500, error: "delivery-failed", reason: "session closed" }, "/t/api/comments": { __http: 202, ok: true } });
|
|
209
|
+
implementOnlyThis(canvas, 0);
|
|
210
|
+
await settle();
|
|
211
|
+
assert.equal($(canvas, "gd-popover-message").title, "delivery-failed");
|
|
212
|
+
pick(canvas, 1);
|
|
213
|
+
assert.deepEqual([$(canvas, "gd-popover-message").textContent, $(canvas, "gd-popover-message").title], ["", ""], "a new pick starts clean");
|
|
214
|
+
implementOnlyThis(canvas, 1);
|
|
215
|
+
await settle();
|
|
216
|
+
assert.equal($(canvas, "gd-popover-message").title, "delivery-failed");
|
|
217
|
+
$(canvas, "gd-popover-text").value = "Fix the menu";
|
|
218
|
+
$(canvas, "gd-popover-form").dispatch("submit");
|
|
219
|
+
await settle();
|
|
220
|
+
assert.deepEqual([$(canvas, "gd-popover-message").textContent, $(canvas, "gd-popover-message").title], ["Sent to the session", ""], "a comment sent after it drops the code");
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
test("without a Pi session the reason Implement only this is disabled is a note under the buttons, which the button points to", async () => {
|
|
224
|
+
const offline = await loadParts({}, {});
|
|
225
|
+
pick(offline, 0);
|
|
226
|
+
const button = $(offline, "gd-popover-part");
|
|
227
|
+
assert.equal(button.disabled, true);
|
|
228
|
+
const noteId = button.getAttribute("aria-describedby");
|
|
229
|
+
assert.equal(noteId, "gd-popover-part-note");
|
|
230
|
+
const notes = findAll($(offline, "gd-popover-form"), (element) => element.id === noteId);
|
|
231
|
+
assert.equal(notes.length, 1, "the note is in the popover");
|
|
232
|
+
assert.deepEqual([notes[0].hidden, notes[0].textContent], [false, "The canvas is not connected to a Pi session; open it with /gentle:design open"]);
|
|
233
|
+
assert.equal(notes[0].classes.has("gd-popover-note"), true);
|
|
234
|
+
|
|
235
|
+
const online = await loadParts();
|
|
236
|
+
pick(online, 0);
|
|
237
|
+
assert.equal($(online, "gd-popover-part").getAttribute("aria-describedby"), null, "connected: nothing to explain");
|
|
238
|
+
assert.deepEqual(findAll($(online, "gd-popover-form"), (element) => element.id === "gd-popover-part-note").map((note) => note.hidden), [true]);
|
|
239
|
+
const css = read("canvas.css");
|
|
240
|
+
assert.match(css, /\.gd-popover-note \{[^}]*var\(--gd-muted\)/, "styled on the --gd-* tokens");
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// ---- Partial implementations (S8: at the bottom of the panel, hidden with no parts)
|
|
244
|
+
|
|
245
|
+
test("Partial implementations lists each part live from parts.json: state in words, time, excerpt, the agent's note", async () => {
|
|
246
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(
|
|
247
|
+
storedPart(),
|
|
248
|
+
storedPart({ id: "p2", file: "02-b.html", selector: "footer", excerpt: "", queued: true, sentAt: todayAt(9, 40) }),
|
|
249
|
+
storedPart({ id: "p3", file: "02-b.html", selector: "aside", excerpt: "Filters", status: "in_progress", startedAt: todayAt(9, 48), note: "Building the filters" }),
|
|
250
|
+
storedPart({ id: "p4", file: "09-gone.html", selector: "header", excerpt: "Logo", status: "implemented", startedAt: "2020-03-04T08:00:00", implementedAt: "2020-03-04T09:05:00", note: "src/Header.tsx" }),
|
|
251
|
+
) });
|
|
252
|
+
assert.equal($(canvas, "gd-parts").hidden, false);
|
|
253
|
+
assert.equal($(canvas, "gd-parts-title").textContent, "Partial implementations · 4");
|
|
254
|
+
assert.deepEqual(items(canvas).map(row), [
|
|
255
|
+
["First", "Sent", "“Home Tours”", "Sent at 09:30", ""],
|
|
256
|
+
["Second", "Queued", "", "Queued at 09:40", ""],
|
|
257
|
+
["Second", "In progress", "“Filters”", "In progress since 09:48", "“Building the filters”"],
|
|
258
|
+
["09-gone.html", "Implemented ✓", "“Logo”", "Implemented on Mar 4 2020, 09:05", "“src/Header.tsx”"],
|
|
259
|
+
]);
|
|
260
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.status), ["sent", "queued", "in_progress", "implemented"]);
|
|
261
|
+
assert.deepEqual(items(canvas).map((item) => withClass(item, "gd-part-remove").length), [1, 1, 0, 0], "Remove only while the agent has not taken it up");
|
|
262
|
+
assert.deepEqual(items(canvas).map((item) => one(item, "gd-part-show").disabled), [false, false, false, true], "no Show without its artboard");
|
|
263
|
+
assert.equal(withClass($(canvas, "gd-parts"), "gd-part-selector").length, 0, "no selector without Technical details");
|
|
264
|
+
|
|
265
|
+
const before = canvas.frames().map((frame) => frame.src);
|
|
266
|
+
const fetches = fetchCount(canvas, PARTS_URL);
|
|
267
|
+
canvas.replies[PARTS_URL] = partsDoc(storedPart({ status: "implemented", startedAt: todayAt(9, 50), implementedAt: todayAt(10, 5), note: "src/layout/Sidebar.tsx" }));
|
|
268
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
269
|
+
assert.equal(fetchCount(canvas, PARTS_URL), fetches + 1);
|
|
270
|
+
assert.deepEqual(items(canvas).map(row), [["First", "Implemented ✓", "“Home Tours”", "Implemented at 10:05", "“src/layout/Sidebar.tsx”"]]);
|
|
271
|
+
assert.deepEqual(canvas.frames().map((frame) => frame.src), before, "a parts.json change reloads no artboard");
|
|
272
|
+
await canvas.serverEvent("change", { slug: "beta", file: "parts.json" });
|
|
273
|
+
assert.equal(fetchCount(canvas, PARTS_URL), fetches + 1, "another design's parts.json is not fetched");
|
|
274
|
+
|
|
275
|
+
canvas.replies[PARTS_URL] = partsDoc(null, { id: 3, file: "01-a.html" }, storedPart({ status: "weird" }), storedPart({ selector: 4 }));
|
|
276
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
277
|
+
assert.equal($(canvas, "gd-parts").hidden, true, "malformed parts are skipped; none left, no section");
|
|
278
|
+
assert.equal($(canvas, "gd-parts-list").children.length, 0);
|
|
279
|
+
|
|
280
|
+
canvas.replies[PARTS_URL] = { __http: 422, error: "invalid-parts", reason: "parts.json is not valid JSON" };
|
|
281
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
282
|
+
assert.equal($(canvas, "gd-status").textContent, "parts.json for alpha cannot be read: parts.json is not valid JSON");
|
|
283
|
+
assert.equal($(canvas, "gd-status").classes.has("gd-error"), true);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
test("Show opens the part's artboard and highlights its element in every frame of it", async () => {
|
|
287
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart(), storedPart({ id: "p2", file: "02-b.html", selector: "footer" })) });
|
|
288
|
+
const show = one(items(canvas)[1], "gd-part-show");
|
|
289
|
+
assert.equal(show.textContent, "Show");
|
|
290
|
+
assert.equal(show.getAttribute("aria-label"), "Show part 2 in 02-b.html");
|
|
291
|
+
show.dispatch("click");
|
|
292
|
+
assert.equal(canvas.navMode.textContent, "Using: Second · Shift+Esc to exit");
|
|
293
|
+
const highlights = (frame: FakeElement) => frame.contentWindow!.posted.filter((message) => message.type === "gd:highlight");
|
|
294
|
+
assert.deepEqual(highlights(canvas.frames()[1]), [{ type: "gd:highlight", selector: "footer" }]);
|
|
295
|
+
assert.deepEqual(highlights(canvas.frames()[0]), []);
|
|
296
|
+
|
|
297
|
+
// In All sizes each size frame highlights it too.
|
|
298
|
+
$(canvas, "gd-back").dispatch("click");
|
|
299
|
+
canvas.boards[0].shield!.dispatch("keydown", { key: "Enter" });
|
|
300
|
+
$(canvas, "gd-device").dispatch("click");
|
|
301
|
+
findAll($(canvas, "gd-device-menu"), (element) => element.dataset.size === "all")[0].dispatch("click");
|
|
302
|
+
const sizeFrames = withClass(canvas.viewport, "gd-size-frame").map((section) => findAll(section, (element) => element.localName === "iframe")[0]);
|
|
303
|
+
assert.equal(sizeFrames.length, 3);
|
|
304
|
+
one(items(canvas)[0], "gd-part-show").dispatch("click");
|
|
305
|
+
assert.deepEqual([canvas.frames()[0], ...sizeFrames].map((frame) => highlights(frame).at(-1)?.selector), ["nav.side", "nav.side", "nav.side", "nav.side"]);
|
|
306
|
+
assert.equal(withClass(canvas.viewport, "gd-size-frame").length, 3, "Show keeps the size the artboard is open at");
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
test("Show looks its artboard up at click time: a board a manifest reload dropped is not opened", async () => {
|
|
310
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart({ id: "p2", file: "02-b.html", selector: "footer" })) });
|
|
311
|
+
const stale = one(items(canvas)[0], "gd-part-show");
|
|
312
|
+
assert.equal(stale.disabled, false);
|
|
313
|
+
const manifest = canvas.replies["/t/api/designs/alpha"] as { artboards: unknown[] };
|
|
314
|
+
manifest.artboards = manifest.artboards.slice(0, 1);
|
|
315
|
+
const parts = deferred();
|
|
316
|
+
canvas.replies[PARTS_URL] = parts.promise;
|
|
317
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "design.json" });
|
|
318
|
+
assert.equal(canvas.frames().length, 1);
|
|
319
|
+
stale.dispatch("click");
|
|
320
|
+
assert.equal(canvas.navMode.textContent, "Navigating", "nothing opens");
|
|
321
|
+
assert.equal($(canvas, "gd-status").textContent, "Not shown: the artboard of this part is no longer in the design.");
|
|
322
|
+
parts.answer(partsDoc(storedPart({ id: "p2", file: "02-b.html", selector: "footer" })));
|
|
323
|
+
await settle();
|
|
324
|
+
assert.equal(one(items(canvas)[0], "gd-part-show").disabled, true, "the reloaded list disables it");
|
|
325
|
+
assert.equal(text(items(canvas)[0], "gd-part-title"), "02-b.html");
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
test("a design switch drops the old parts at once and ignores a parts fetch still in flight for the old design", async () => {
|
|
329
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart()) });
|
|
330
|
+
assert.equal(items(canvas).length, 1);
|
|
331
|
+
const late = deferred();
|
|
332
|
+
canvas.replies[PARTS_URL] = late.promise;
|
|
333
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
334
|
+
const beta = deferred();
|
|
335
|
+
canvas.replies[BETA_PARTS_URL] = beta.promise;
|
|
336
|
+
await canvas.serverEvent("show", { slug: "beta" });
|
|
337
|
+
assert.equal($(canvas, "gd-parts").hidden, true, "alpha's parts go with alpha");
|
|
338
|
+
assert.equal(items(canvas).length, 0);
|
|
339
|
+
late.answer(partsDoc(storedPart({ id: "late" })));
|
|
340
|
+
await settle();
|
|
341
|
+
assert.equal(items(canvas).length, 0, "a late alpha reply is ignored");
|
|
342
|
+
beta.answer(partsDoc(storedPart({ id: "b1", file: "01-only.html", excerpt: "Beta" })));
|
|
343
|
+
await settle();
|
|
344
|
+
assert.deepEqual(items(canvas).map((item) => row(item).slice(0, 3)), [["Only", "Sent", "“Beta”"]]);
|
|
345
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["b1"]);
|
|
346
|
+
|
|
347
|
+
await canvas.serverEvent("show", { slug: null });
|
|
348
|
+
assert.equal($(canvas, "gd-parts").hidden, true, "the system-only view has no parts");
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
test("the design selector drops the old parts at once, before the new design.json answers and when it fails", async () => {
|
|
352
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart()) });
|
|
353
|
+
assert.equal(items(canvas).length, 1);
|
|
354
|
+
const held = deferred();
|
|
355
|
+
canvas.replies["/t/api/designs/beta"] = held.promise;
|
|
356
|
+
const select = $(canvas, "gd-design");
|
|
357
|
+
select.value = "beta";
|
|
358
|
+
select.dispatch("change");
|
|
359
|
+
await settle();
|
|
360
|
+
assert.equal($(canvas, "gd-parts").hidden, true, "alpha's parts go before beta's design.json answers");
|
|
361
|
+
assert.equal(items(canvas).length, 0, "no Remove of alpha's part is left");
|
|
362
|
+
held.answer({ __http: 500, error: "invalid-design", reason: "bad json" });
|
|
363
|
+
await settle();
|
|
364
|
+
assert.equal($(canvas, "gd-parts").hidden, true, "nor after beta's design.json fails");
|
|
365
|
+
assert.equal(items(canvas).length, 0);
|
|
366
|
+
assert.deepEqual(bodiesTo(canvas, REMOVE_URL), []);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
test("parts.json replies that land out of order: the newest load wins, an older one changes nothing", async () => {
|
|
370
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart()) });
|
|
371
|
+
const older = deferred();
|
|
372
|
+
canvas.replies[PARTS_URL] = older.promise;
|
|
373
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
374
|
+
const newer = deferred();
|
|
375
|
+
canvas.replies[PARTS_URL] = newer.promise;
|
|
376
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
377
|
+
newer.answer(partsDoc(storedPart({ status: "in_progress", startedAt: todayAt(9, 48) })));
|
|
378
|
+
await settle();
|
|
379
|
+
older.answer(partsDoc(storedPart({ queued: true }), storedPart({ id: "removed" })));
|
|
380
|
+
await settle();
|
|
381
|
+
assert.deepEqual(items(canvas).map((item) => [item.dataset.id, item.dataset.status]), [["p1", "in_progress"]]);
|
|
382
|
+
|
|
383
|
+
// An older load that fails after a newer one says nothing either.
|
|
384
|
+
const stale = deferred();
|
|
385
|
+
canvas.replies[PARTS_URL] = stale.promise;
|
|
386
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
387
|
+
canvas.replies[PARTS_URL] = partsDoc(storedPart({ status: "implemented", implementedAt: todayAt(10, 5) }));
|
|
388
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
389
|
+
stale.answer({ __http: 422, error: "invalid-parts", reason: "parts.json is not valid JSON" });
|
|
390
|
+
await settle();
|
|
391
|
+
assert.equal($(canvas, "gd-status").textContent.startsWith("parts.json for alpha cannot be read"), false);
|
|
392
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.status), ["implemented"]);
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
test("a parts.json reply older than a part Implement only this just listed does not drop that part", async () => {
|
|
396
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart()), [PART_URL]: { __http: 202, ok: true, id: "p2", queued: false } });
|
|
397
|
+
const held = deferred();
|
|
398
|
+
canvas.replies[PARTS_URL] = held.promise;
|
|
399
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
400
|
+
// What parts.json holds once the server accepted p2, for the fresh read that follows.
|
|
401
|
+
canvas.replies[PARTS_URL] = partsDoc(storedPart(), storedPart({ id: "p2", file: "02-b.html", selector: "footer", excerpt: "" }));
|
|
402
|
+
implementOnlyThis(canvas, 1, { selector: "footer", excerpt: "" });
|
|
403
|
+
await settle();
|
|
404
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["p1", "p2"]);
|
|
405
|
+
held.answer(partsDoc());
|
|
406
|
+
await settle();
|
|
407
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["p1", "p2"], "the older reply changes nothing");
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
test("a parts.json reply older than a succeeded Remove does not bring the removed part back", async () => {
|
|
411
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart()), [REMOVE_URL]: { ok: true, id: "p1" } });
|
|
412
|
+
const held = deferred();
|
|
413
|
+
canvas.replies[PARTS_URL] = held.promise;
|
|
414
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
415
|
+
// What parts.json holds once the server removed p1, for the fresh read that follows.
|
|
416
|
+
canvas.replies[PARTS_URL] = partsDoc();
|
|
417
|
+
confirmRemove(canvas, 0);
|
|
418
|
+
await settle();
|
|
419
|
+
assert.equal(items(canvas).length, 0);
|
|
420
|
+
held.answer(partsDoc(storedPart()));
|
|
421
|
+
await settle();
|
|
422
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), [], "the older reply changes nothing");
|
|
423
|
+
assert.equal($(canvas, "gd-parts").hidden, true);
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
test("after Implement only this lists a part, a fresh parts.json read keeps the other parts' updates an in-flight read carried", async () => {
|
|
427
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart()), [PART_URL]: { __http: 202, ok: true, id: "p2", queued: false } });
|
|
428
|
+
const held = deferred();
|
|
429
|
+
canvas.replies[PARTS_URL] = held.promise;
|
|
430
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
431
|
+
const fetches = fetchCount(canvas, PARTS_URL);
|
|
432
|
+
const implemented = storedPart({ status: "implemented", implementedAt: todayAt(10, 5) });
|
|
433
|
+
canvas.replies[PARTS_URL] = partsDoc(implemented, storedPart({ id: "p2", file: "02-b.html", selector: "footer", excerpt: "" }));
|
|
434
|
+
implementOnlyThis(canvas, 1, { selector: "footer", excerpt: "" });
|
|
435
|
+
await settle();
|
|
436
|
+
assert.equal(fetchCount(canvas, PARTS_URL), fetches + 1, "a fresh read follows the local change");
|
|
437
|
+
held.answer(partsDoc(implemented));
|
|
438
|
+
await settle();
|
|
439
|
+
assert.deepEqual(items(canvas).map((item) => [item.dataset.id, item.dataset.status]), [["p1", "implemented"], ["p2", "sent"]]);
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
test("after a succeeded Remove, a fresh parts.json read keeps the other parts' updates an in-flight read carried", async () => {
|
|
443
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart(), storedPart({ id: "p2", file: "02-b.html", selector: "footer" })), [REMOVE_URL]: { ok: true, id: "p2" } });
|
|
444
|
+
const held = deferred();
|
|
445
|
+
canvas.replies[PARTS_URL] = held.promise;
|
|
446
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
447
|
+
const fetches = fetchCount(canvas, PARTS_URL);
|
|
448
|
+
const implemented = storedPart({ status: "implemented", implementedAt: todayAt(10, 5) });
|
|
449
|
+
canvas.replies[PARTS_URL] = partsDoc(implemented);
|
|
450
|
+
confirmRemove(canvas, 1);
|
|
451
|
+
await settle();
|
|
452
|
+
assert.equal(fetchCount(canvas, PARTS_URL), fetches + 1, "a fresh read follows the local change");
|
|
453
|
+
held.answer(partsDoc(implemented, storedPart({ id: "p2", file: "02-b.html", selector: "footer" })));
|
|
454
|
+
await settle();
|
|
455
|
+
assert.deepEqual(items(canvas).map((item) => [item.dataset.id, item.dataset.status]), [["p1", "implemented"]]);
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
test("a parts.json load that fails keeps the parts shown and says why in the status line", async () => {
|
|
459
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart()) });
|
|
460
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["p1"]);
|
|
461
|
+
canvas.replies[PARTS_URL] = { __http: 500, error: "internal", reason: "disk busy" };
|
|
462
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
463
|
+
await settle();
|
|
464
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["p1"], "the shown list is kept");
|
|
465
|
+
assert.equal($(canvas, "gd-parts").hidden, false);
|
|
466
|
+
assert.equal($(canvas, "gd-parts-title").textContent, "Partial implementations · 1");
|
|
467
|
+
assert.equal($(canvas, "gd-status").textContent, "parts.json for alpha cannot be read: disk busy");
|
|
468
|
+
assert.equal($(canvas, "gd-status").classes.has("gd-error"), true);
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
test("Implement only this sends an element once while its request is in flight, even after the popover closes and the same element is picked again", async () => {
|
|
472
|
+
const flight = deferred();
|
|
473
|
+
const canvas = await loadParts({ [PART_URL]: flight.promise });
|
|
474
|
+
implementOnlyThis(canvas, 0);
|
|
475
|
+
await settle();
|
|
476
|
+
$(canvas, "gd-popover-cancel").dispatch("click");
|
|
477
|
+
assert.equal($(canvas, "gd-popover").hidden, true);
|
|
478
|
+
pick(canvas, 0);
|
|
479
|
+
assert.equal($(canvas, "gd-popover-part").disabled, true, "the same element in flight: disabled");
|
|
480
|
+
$(canvas, "gd-popover-part").dispatch("click");
|
|
481
|
+
await settle();
|
|
482
|
+
assert.equal(bodiesTo(canvas, PART_URL).length, 1, "no second request");
|
|
483
|
+
pick(canvas, 1);
|
|
484
|
+
assert.equal($(canvas, "gd-popover-part").disabled, false, "another element can be sent");
|
|
485
|
+
pick(canvas, 0);
|
|
486
|
+
assert.equal($(canvas, "gd-popover-part").disabled, true);
|
|
487
|
+
|
|
488
|
+
// The reply releases the element: a refusal lets it be sent again.
|
|
489
|
+
flight.answer({ __http: 500, error: "delivery-failed", reason: "session closed" });
|
|
490
|
+
await settle();
|
|
491
|
+
assert.equal($(canvas, "gd-popover-part").disabled, false, "released when the reply arrives");
|
|
492
|
+
canvas.replies[PART_URL] = { ok: true, id: "p1", queued: false };
|
|
493
|
+
$(canvas, "gd-popover-part").dispatch("click");
|
|
494
|
+
await settle();
|
|
495
|
+
assert.equal(bodiesTo(canvas, PART_URL).length, 2);
|
|
496
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["p1"]);
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
test("an implement-part reply that lands after its part was listed and removed does not bring the part back", async () => {
|
|
500
|
+
const flight = deferred();
|
|
501
|
+
const canvas = await loadParts({ [PART_URL]: flight.promise, [REMOVE_URL]: { ok: true, id: "p1" } });
|
|
502
|
+
implementOnlyThis(canvas, 0);
|
|
503
|
+
await settle();
|
|
504
|
+
// Delivery completed: the parts.json change event lists the part before the send's reply arrives.
|
|
505
|
+
canvas.replies[PARTS_URL] = partsDoc(storedPart());
|
|
506
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
507
|
+
await settle();
|
|
508
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["p1"]);
|
|
509
|
+
canvas.replies[PARTS_URL] = partsDoc();
|
|
510
|
+
confirmRemove(canvas, 0);
|
|
511
|
+
await settle();
|
|
512
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
513
|
+
await settle();
|
|
514
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), []);
|
|
515
|
+
|
|
516
|
+
flight.answer({ ok: true, id: "p1", queued: false });
|
|
517
|
+
await settle();
|
|
518
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), [], "the older send reply does not add the removed part again");
|
|
519
|
+
assert.equal($(canvas, "gd-parts").hidden, true);
|
|
520
|
+
assert.equal($(canvas, "gd-status").textContent, "Sent: the session is building only this part of First now.", "it still says it was sent");
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
test("Show stays disabled until the shown design's boards are installed and never opens another design's board with the same file", async () => {
|
|
524
|
+
const canvas = await loadParts();
|
|
525
|
+
const manifest = deferred();
|
|
526
|
+
canvas.replies["/t/api/designs/beta"] = manifest.promise;
|
|
527
|
+
canvas.replies[BETA_PARTS_URL] = partsDoc(storedPart({ id: "b1", selector: "main.beta", excerpt: "Beta" }));
|
|
528
|
+
const alphaFrames = canvas.frames();
|
|
529
|
+
await canvas.serverEvent("show", { slug: "beta" });
|
|
530
|
+
// Beta's parts arrive while its design.json is held: alpha's boards are still the installed ones, and alpha has 01-a.html too.
|
|
531
|
+
await canvas.serverEvent("change", { slug: "beta", file: "parts.json" });
|
|
532
|
+
await settle();
|
|
533
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["b1"]);
|
|
534
|
+
const show = one(items(canvas)[0], "gd-part-show");
|
|
535
|
+
assert.equal(show.disabled, true, "no beta board is installed yet");
|
|
536
|
+
assert.equal(text(items(canvas)[0], "gd-part-title"), "01-a.html", "alpha's board title is not borrowed");
|
|
537
|
+
show.dispatch("click");
|
|
538
|
+
assert.equal(canvas.navMode.textContent, "Navigating", "alpha's old board is not focused");
|
|
539
|
+
const highlights = (frame: FakeElement) => frame.contentWindow!.posted.filter((message) => message.type === "gd:highlight");
|
|
540
|
+
assert.deepEqual(alphaFrames.flatMap(highlights), [], "alpha's board never gets beta's selector");
|
|
541
|
+
|
|
542
|
+
manifest.answer({ slug: "beta", title: "Beta", brief: "", artboards: [{ file: "01-a.html", title: "Beta A", tradeoff: "", width: 500, height: 400 }] });
|
|
543
|
+
await settle();
|
|
544
|
+
const ready = one(items(canvas)[0], "gd-part-show");
|
|
545
|
+
assert.equal(ready.disabled, false, "enabled once beta's boards are installed");
|
|
546
|
+
assert.equal(text(items(canvas)[0], "gd-part-title"), "Beta A");
|
|
547
|
+
ready.dispatch("click");
|
|
548
|
+
assert.equal(canvas.navMode.textContent, "Using: Beta A · Shift+Esc to exit");
|
|
549
|
+
assert.deepEqual(highlights(canvas.frames()[0]), [{ type: "gd:highlight", selector: "main.beta" }]);
|
|
550
|
+
assert.deepEqual(alphaFrames.flatMap(highlights), []);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
// ---- Remove (S2: a part the agent never reports would stay sent forever)
|
|
554
|
+
|
|
555
|
+
test("Remove asks an inline confirm, then removes a sent or queued part and stays disabled while in flight", async () => {
|
|
556
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(
|
|
557
|
+
storedPart(),
|
|
558
|
+
storedPart({ id: "p2", file: "02-b.html", selector: "footer", queued: true }),
|
|
559
|
+
storedPart({ id: "p3", status: "in_progress", startedAt: todayAt(9, 48) }),
|
|
560
|
+
) });
|
|
561
|
+
const item = items(canvas)[0];
|
|
562
|
+
const remove = one(item, "gd-part-remove");
|
|
563
|
+
const confirm = one(item, "gd-part-confirm");
|
|
564
|
+
assert.equal(remove.textContent, "Remove");
|
|
565
|
+
assert.equal(remove.getAttribute("aria-label"), "Remove part 1 in 01-a.html");
|
|
566
|
+
assert.equal(confirm.hidden, true);
|
|
567
|
+
remove.dispatch("click");
|
|
568
|
+
assert.deepEqual([confirm.hidden, remove.hidden], [false, true]);
|
|
569
|
+
assert.equal(text(confirm, "gd-part-question"), "Remove this part? The agent can no longer report on it.");
|
|
570
|
+
assert.equal(confirm.getAttribute("role"), "group");
|
|
571
|
+
assert.equal(canvas.document.activeElement?.textContent, "Remove", "the keyboard moves to the confirm's Remove");
|
|
572
|
+
one(confirm, "gd-part-confirm-no").dispatch("click");
|
|
573
|
+
assert.deepEqual([confirm.hidden, remove.hidden], [true, false]);
|
|
574
|
+
assert.equal(canvas.document.activeElement?.getAttribute("aria-label"), "Remove part 1 in 01-a.html", "Cancel returns to Remove");
|
|
575
|
+
remove.dispatch("click");
|
|
576
|
+
const escape = confirm.dispatch("keydown", { key: "Escape" });
|
|
577
|
+
assert.equal(escape.defaultPrevented, true);
|
|
578
|
+
assert.deepEqual([confirm.hidden, remove.hidden], [true, false], "Esc cancels too");
|
|
579
|
+
assert.deepEqual(bodiesTo(canvas, REMOVE_URL), [], "nothing is removed without the confirm");
|
|
580
|
+
|
|
581
|
+
const flight = deferred();
|
|
582
|
+
canvas.replies[REMOVE_URL] = flight.promise;
|
|
583
|
+
confirmRemove(canvas, 0);
|
|
584
|
+
await settle();
|
|
585
|
+
assert.deepEqual(bodiesTo(canvas, REMOVE_URL), [{ id: "p1" }]);
|
|
586
|
+
assert.equal(one(items(canvas)[0], "gd-part-confirm-yes").getAttribute("aria-disabled"), "true", "marked disabled while in flight, still focusable");
|
|
587
|
+
// A parts.json change while it is in flight re-renders the list; the part stays disabled.
|
|
588
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
589
|
+
assert.equal(one(items(canvas)[0], "gd-part-confirm").hidden, false, "the open confirm survives a re-render");
|
|
590
|
+
assert.equal(one(items(canvas)[0], "gd-part-confirm-yes").getAttribute("aria-disabled"), "true");
|
|
591
|
+
one(items(canvas)[0], "gd-part-confirm-yes").dispatch("click");
|
|
592
|
+
await settle();
|
|
593
|
+
assert.equal(bodiesTo(canvas, REMOVE_URL).length, 1, "a second click while in flight posts nothing");
|
|
594
|
+
|
|
595
|
+
canvas.replies[PARTS_URL] = partsDoc(storedPart({ id: "p2", file: "02-b.html", selector: "footer", queued: true }), storedPart({ id: "p3", status: "in_progress", startedAt: todayAt(9, 48) }));
|
|
596
|
+
flight.answer({ ok: true, id: "p1" });
|
|
597
|
+
await settle();
|
|
598
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["p2", "p3"], "the part goes at once");
|
|
599
|
+
assert.equal($(canvas, "gd-status").textContent, "Part removed. The agent can no longer report on it.");
|
|
600
|
+
assert.equal($(canvas, "gd-parts-title").textContent, "Partial implementations · 2");
|
|
601
|
+
|
|
602
|
+
// The queued one goes the same way.
|
|
603
|
+
canvas.replies[REMOVE_URL] = { ok: true, id: "p2" };
|
|
604
|
+
confirmRemove(canvas, 0);
|
|
605
|
+
await settle();
|
|
606
|
+
assert.deepEqual(bodiesTo(canvas, REMOVE_URL).at(-1), { id: "p2" });
|
|
607
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["p3"]);
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
test("keyboard focus stays on the confirm's Remove while it is in flight, and Cancel and Esc wait for the reply", async () => {
|
|
611
|
+
const flight = deferred();
|
|
612
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart(), storedPart({ id: "p2", file: "02-b.html", selector: "footer" })), [REMOVE_URL]: flight.promise });
|
|
613
|
+
const active = () => canvas.document.activeElement!;
|
|
614
|
+
const focusAt = () => [active().dataset.control ?? "", active().closest(".gd-part")?.dataset.id ?? "", active().getAttribute("aria-disabled") ?? "", $(canvas, "gd-parts-list").contains(active())];
|
|
615
|
+
one(items(canvas)[0], "gd-part-remove").dispatch("click");
|
|
616
|
+
one(items(canvas)[0], "gd-part-confirm-yes").dispatch("click");
|
|
617
|
+
await settle();
|
|
618
|
+
assert.deepEqual(focusAt(), ["yes", "p1", "true", true], "the redraw keeps focus on the confirm's Remove");
|
|
619
|
+
await canvas.serverEvent("change", { slug: "alpha", file: "parts.json" });
|
|
620
|
+
assert.deepEqual(focusAt(), ["yes", "p1", "true", true], "a parts.json redraw too");
|
|
621
|
+
assert.equal(one(items(canvas)[0], "gd-part-confirm-no").disabled, true, "Cancel waits for the reply");
|
|
622
|
+
one(items(canvas)[0], "gd-part-confirm-no").dispatch("click");
|
|
623
|
+
one(items(canvas)[0], "gd-part-confirm").dispatch("keydown", { key: "Escape" });
|
|
624
|
+
assert.equal(one(items(canvas)[0], "gd-part-confirm").hidden, false, "neither closes the confirm while in flight");
|
|
625
|
+
assert.deepEqual(focusAt(), ["yes", "p1", "true", true]);
|
|
626
|
+
assert.equal(active() === canvas.document.body, false);
|
|
627
|
+
|
|
628
|
+
flight.answer({ __http: 422, error: "invalid-parts", reason: "bad" });
|
|
629
|
+
await settle();
|
|
630
|
+
assert.equal(active() === canvas.document.body, false, "focus never falls to the body");
|
|
631
|
+
assert.deepEqual([active().disabled, active().hidden, $(canvas, "gd-parts-list").contains(active())], [false, false, true]);
|
|
632
|
+
assert.equal(one(items(canvas)[0], "gd-part-confirm-no").disabled, false, "Cancel works again");
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
test("Remove that loses the race to the agent (409) or to a failed delivery (404) reloads the parts and says why", async () => {
|
|
636
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart()), [REMOVE_URL]: { __http: 409, error: "part-not-sent", reason: "p1 is in_progress" } });
|
|
637
|
+
// The agent took it up between the render and the confirm.
|
|
638
|
+
canvas.replies[PARTS_URL] = partsDoc(storedPart({ status: "in_progress", startedAt: todayAt(9, 48) }));
|
|
639
|
+
const fetches = fetchCount(canvas, PARTS_URL);
|
|
640
|
+
confirmRemove(canvas, 0);
|
|
641
|
+
await settle();
|
|
642
|
+
assert.equal($(canvas, "gd-status").textContent, "Not removed: the agent already took this part up.");
|
|
643
|
+
assert.equal($(canvas, "gd-status").classes.has("gd-error"), true);
|
|
644
|
+
assert.equal($(canvas, "gd-toast").textContent, "Not removed: the agent already took this part up.");
|
|
645
|
+
assert.equal(fetchCount(canvas, PARTS_URL), fetches + 1, "the parts are reloaded");
|
|
646
|
+
assert.deepEqual(items(canvas).map((item) => [text(item, "gd-part-state"), withClass(item, "gd-part-remove").length]), [["In progress", 0]]);
|
|
647
|
+
|
|
648
|
+
const gone = await loadParts({ [PARTS_URL]: partsDoc(storedPart()), [REMOVE_URL]: { __http: 404, error: "not-found" } });
|
|
649
|
+
gone.replies[PARTS_URL] = partsDoc();
|
|
650
|
+
confirmRemove(gone, 0);
|
|
651
|
+
await settle();
|
|
652
|
+
assert.equal($(gone, "gd-status").textContent, "Not removed: this part is gone; its delivery failed or it was removed already.");
|
|
653
|
+
assert.equal($(gone, "gd-parts").hidden, true);
|
|
654
|
+
|
|
655
|
+
const broken = await loadParts({ [PARTS_URL]: partsDoc(storedPart()), [REMOVE_URL]: { __http: 422, error: "invalid-parts", reason: "bad" } });
|
|
656
|
+
confirmRemove(broken, 0);
|
|
657
|
+
await settle();
|
|
658
|
+
assert.equal($(broken, "gd-status").textContent, "Not removed: parts.json cannot be read; fix it or delete it.");
|
|
659
|
+
assert.equal(one(items(broken)[0], "gd-part-remove").disabled, false, "it can be tried again");
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
test("a Remove reply after a design switch touches only the old design: no reload of its parts into the new list", async () => {
|
|
663
|
+
const flight = deferred();
|
|
664
|
+
const canvas = await loadParts({ [PARTS_URL]: partsDoc(storedPart()), [REMOVE_URL]: flight.promise, [BETA_PARTS_URL]: partsDoc(storedPart({ id: "b1", file: "01-only.html" })) });
|
|
665
|
+
confirmRemove(canvas, 0);
|
|
666
|
+
await settle();
|
|
667
|
+
await canvas.serverEvent("show", { slug: "beta" });
|
|
668
|
+
const fetches = fetchCount(canvas, PARTS_URL);
|
|
669
|
+
flight.answer({ __http: 409, error: "part-not-sent" });
|
|
670
|
+
await settle();
|
|
671
|
+
assert.equal(fetchCount(canvas, PARTS_URL), fetches, "alpha's parts are not fetched for beta's list");
|
|
672
|
+
assert.deepEqual(items(canvas).map((item) => item.dataset.id), ["b1"]);
|
|
673
|
+
assert.equal($(canvas, "gd-status").textContent, "Not removed: the agent already took this part up.");
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
// ---- store, registration, styles and docs (S3, S4, S6)
|
|
677
|
+
|
|
678
|
+
test("parts change only through setParts, frozen once when set", () => {
|
|
679
|
+
const store = createStore();
|
|
680
|
+
assert.deepEqual(store.state.parts, { slug: null, parts: [] });
|
|
681
|
+
assert.throws(() => { (store.state.parts.parts as unknown[]).push({}); }, TypeError, "the initial parts are protected too");
|
|
682
|
+
const parts = [{ id: "p1", status: "sent" }];
|
|
683
|
+
store.setParts({ slug: "alpha", parts });
|
|
684
|
+
assert.equal(store.state.parts.parts, parts, "the same array, frozen when it is set, not copied per read");
|
|
685
|
+
assert.throws(() => { (store.state.parts as any).slug = "beta"; }, TypeError);
|
|
686
|
+
assert.throws(() => { (store.state.parts.parts as unknown[]).push({ id: "p2" }); }, TypeError);
|
|
687
|
+
assert.throws(() => { (store.state.parts.parts[0] as any).status = "implemented"; }, TypeError);
|
|
688
|
+
assert.deepEqual(store.state.parts, { slug: "alpha", parts: [{ id: "p1", status: "sent" }] });
|
|
689
|
+
assert.ok(read("canvas-store.js").includes("setComments, setHandoffs and setParts freeze them once"));
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
test("canvas-parts.js is registered, groups its English text and styles its section on the --gd-* tokens with the state in words", () => {
|
|
693
|
+
assert.equal(DESIGN_CANVAS_ASSETS["canvas-parts.js"], "text/javascript; charset=utf-8");
|
|
694
|
+
assert.match(read("canvas-boot.js"), /^import \* as parts from "\.\/canvas-parts\.js";$/m);
|
|
695
|
+
const source = read("canvas-parts.js");
|
|
696
|
+
assert.match(source, /^const TEXT = Object\.freeze\(\{$/m, "the English text sits in one TEXT block");
|
|
697
|
+
assert.ok(!/(?:textContent|title) = ["'`]/.test(source), "every visible string comes from TEXT");
|
|
698
|
+
assert.ok(!/\bstate\.\w+\s*=[^=]/.test(source), "state changes only through the store");
|
|
699
|
+
|
|
700
|
+
const html = read("index.html");
|
|
701
|
+
const panel = html.slice(html.indexOf('<aside id="gd-panel"'), html.indexOf("</aside>"));
|
|
702
|
+
assert.match(panel, /<section id="gd-parts" class="gd-parts" aria-labelledby="gd-parts-title" hidden>\s*<h3 id="gd-parts-title" class="gd-parts-title" data-i18n="partsTitle">Partial implementations<\/h3>\s*<ol id="gd-parts-list" class="gd-parts-list"><\/ol>\s*<\/section>\s*$/, "the last thing in the panel");
|
|
703
|
+
|
|
704
|
+
const css = read("canvas.css");
|
|
705
|
+
const rules = css.split("}").filter((rule) => /(^|\n)\.gd-part/.test(rule.trim().split("{")[0]) || /^\s*\.gd-part/.test(rule));
|
|
706
|
+
assert.ok(rules.length >= 6, "the section is styled");
|
|
707
|
+
for (const rule of rules) {
|
|
708
|
+
assert.ok(!/#[0-9a-fA-F]{3,8}\b|rgba?\(|hsla?\(/.test(rule), `${rule.trim()}: tokens only`);
|
|
709
|
+
for (const name of rule.match(/var\((--[\w-]+)/g) ?? []) assert.ok(name.startsWith("var(--gd-"), `${name}: a --gd-* token`);
|
|
710
|
+
assert.ok(!/::before|::after|50%/.test(rule), `${rule.trim()}: no dot for the state (S4)`);
|
|
711
|
+
}
|
|
712
|
+
assert.match(css, /\.gd-part\[data-status="implemented"\] \.gd-part-state \{[^}]*var\(--gd-success\)/);
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
test("the docs describe Implement only this, Partial implementations and Remove", () => {
|
|
716
|
+
const docs = readFileSync(fileURLToPath(new URL("../docs/gentle-shell.md", import.meta.url)), "utf8");
|
|
717
|
+
const section = docs.slice(docs.indexOf("### Gentle Design"), docs.indexOf("### Gentle Music"));
|
|
718
|
+
for (const words of ["**Implement only this**", "**Partial implementations**", "**Show**", "**Remove**", "can no longer report", "Pi session", "does not choose a direction"]) {
|
|
719
|
+
assert.ok(section.includes(words), `the Gentle Design docs mention ${words}`);
|
|
720
|
+
}
|
|
721
|
+
});
|