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
package/bin/gentle-shell.mjs
CHANGED
|
@@ -26,9 +26,9 @@ import {
|
|
|
26
26
|
writeFileSync,
|
|
27
27
|
} from "node:fs";
|
|
28
28
|
import { constants as osConstants, homedir, tmpdir } from "node:os";
|
|
29
|
-
import { delimiter, dirname, join, resolve as resolvePath } from "node:path";
|
|
29
|
+
import { delimiter, dirname, isAbsolute, join, relative, resolve as resolvePath } from "node:path";
|
|
30
30
|
import { spawn, spawnSync } from "node:child_process";
|
|
31
|
-
import { fileURLToPath } from "node:url";
|
|
31
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
32
32
|
import {
|
|
33
33
|
buildPiInvocation,
|
|
34
34
|
checkPiVersion,
|
|
@@ -73,7 +73,9 @@ import {
|
|
|
73
73
|
ENGRAM_RECOVERY_NOTICE,
|
|
74
74
|
ENGRAM_START_FAILED_NOTICE,
|
|
75
75
|
GENTLE_SHELL_CONFIG_HOME_ENV,
|
|
76
|
+
engramContractMismatchNotice,
|
|
76
77
|
engramProbeAllowed,
|
|
78
|
+
engramSupportsDaemonLifecycle,
|
|
77
79
|
sharedEngramEnv,
|
|
78
80
|
piVersionOrHelpRequested,
|
|
79
81
|
probeEngramEndpoint,
|
|
@@ -83,10 +85,11 @@ import {
|
|
|
83
85
|
bundledPi,
|
|
84
86
|
bundledSetupEnv,
|
|
85
87
|
bundledUpdateNext,
|
|
86
|
-
bundledUpdateNotice,
|
|
87
88
|
bundledUpdatePlan,
|
|
88
89
|
nodeBundledFs,
|
|
89
90
|
parseBundledUpgradeArgs,
|
|
91
|
+
parseEngramRuntimeContract,
|
|
92
|
+
probeEngramRuntimeContract,
|
|
90
93
|
resolveBundledInstall,
|
|
91
94
|
withBundledNpmCommand,
|
|
92
95
|
withoutMissingBundledNpmCommand,
|
|
@@ -138,14 +141,14 @@ function resolveBundledCli() {
|
|
|
138
141
|
const expectedEntry = join(root, "dist", "index.js");
|
|
139
142
|
const metadata = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
140
143
|
if (entry !== expectedEntry || metadata.name !== "@earendil-works/pi-coding-agent" ||
|
|
141
|
-
metadata.bin?.pi !== "dist/bundle/cli.js") {
|
|
144
|
+
metadata.bin?.pi !== "dist/bundle/cli.js" || typeof metadata.version !== "string") {
|
|
142
145
|
throw new Error("Unsupported adjacent Pi package entry/name/bin metadata");
|
|
143
146
|
}
|
|
144
147
|
const cliPath = join(root, metadata.bin.pi);
|
|
145
148
|
if (realpathSync(cliPath) !== cliPath || !statSync(cliPath).isFile()) {
|
|
146
149
|
throw new Error("Unsupported adjacent Pi CLI path");
|
|
147
150
|
}
|
|
148
|
-
return cliPath;
|
|
151
|
+
return { path: cliPath, version: metadata.version };
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
function findOnPath(name) {
|
|
@@ -231,23 +234,37 @@ async function classifyBundledMemory() {
|
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
// Like other agents' hooks, Shell starts the shared server when nothing
|
|
234
|
-
// listens
|
|
235
|
-
//
|
|
236
|
-
//
|
|
237
|
-
//
|
|
238
|
-
//
|
|
239
|
-
//
|
|
237
|
+
// listens. Cores with the daemon lifecycle (>= 3.7.0) become a first-class
|
|
238
|
+
// daemon through `engram run -d`, so the standard engram verbs manage them;
|
|
239
|
+
// anything else (older cores, a failed daemon handoff) keeps the legacy
|
|
240
|
+
// detached plain `serve` on Engram's own default port and data directory, so it
|
|
241
|
+
// outlives Pi. Both paths' environment drops the user's Engram settings and
|
|
242
|
+
// GitHub tokens and skips the update check. Ready means the same
|
|
243
|
+
// /compatibility contract any reused server must answer, and a concurrent
|
|
244
|
+
// launch that wins the bind converges through it within the overall bounds.
|
|
240
245
|
const ENGRAM_START_TIMEOUT_MS = 10000;
|
|
241
246
|
const ENGRAM_START_EXIT_GRACE_MS = 2000;
|
|
247
|
+
// `engram run -d` itself waits up to 15 s for its daemon's readiness before the
|
|
248
|
+
// wrapper exits (engram cmd/engram/run.go), so the daemon wrapper await can run
|
|
249
|
+
// slightly longer than the serve-only start budget.
|
|
250
|
+
const ENGRAM_DAEMON_START_TIMEOUT_MS = 16000;
|
|
242
251
|
|
|
243
252
|
async function startSharedEngram() {
|
|
244
253
|
const failed = { policy: "disabled", notice: ENGRAM_START_FAILED_NOTICE };
|
|
245
254
|
const core = verifiedBundledCore();
|
|
246
255
|
if (core === undefined) return failed;
|
|
256
|
+
const env = sharedEngramEnv(process.env);
|
|
257
|
+
// Cores with the daemon lifecycle (>= 3.7.0) start through `engram run -d`:
|
|
258
|
+
// the pidfile it keeps is what `engram ps/stop/logs/restart` manage, so the
|
|
259
|
+
// shared server becomes a first-class daemon (engram#2346). Anything short of
|
|
260
|
+
// a compatible running server falls back to the legacy detached serve below,
|
|
261
|
+
// which is the only option an older core would have had anyway.
|
|
262
|
+
if (engramSupportsDaemonLifecycle(engramPinVersion) && (await startEngramDaemon(core, env))) {
|
|
263
|
+
return { policy: "allow", url: ENGRAM_DEFAULT_URL };
|
|
264
|
+
}
|
|
247
265
|
let deadline = Date.now() + ENGRAM_START_TIMEOUT_MS;
|
|
248
266
|
const exited = () => { deadline = Math.min(deadline, Date.now() + ENGRAM_START_EXIT_GRACE_MS); };
|
|
249
267
|
try {
|
|
250
|
-
const env = sharedEngramEnv(process.env);
|
|
251
268
|
const child = spawn(core, ["serve"], { cwd: homedir(), env, detached: true, stdio: "ignore", windowsHide: true });
|
|
252
269
|
child.once("error", exited);
|
|
253
270
|
child.once("exit", exited);
|
|
@@ -263,9 +280,145 @@ async function startSharedEngram() {
|
|
|
263
280
|
return failed;
|
|
264
281
|
}
|
|
265
282
|
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
|
|
283
|
+
// Runs `engram run -d` to completion and reports whether a compatible server is
|
|
284
|
+
// listening: the wrapper exits 0 after the daemon reported readiness and exits
|
|
285
|
+
// non-zero on failure; a concurrent launch that wins the bind converges through
|
|
286
|
+
// the same probed contract as serve. Spawn errors and a wrapper that never ends
|
|
287
|
+
// are cut off at the start budget. Bounded either way.
|
|
288
|
+
async function startEngramDaemon(core, env) {
|
|
289
|
+
try {
|
|
290
|
+
const child = spawn(core, ["run", "-d"], { cwd: homedir(), env, stdio: "ignore", windowsHide: true });
|
|
291
|
+
await Promise.race([
|
|
292
|
+
new Promise((resolve, reject) => {
|
|
293
|
+
child.once("error", reject);
|
|
294
|
+
child.once("exit", (status) => resolve(typeof status === "number" ? status : -1));
|
|
295
|
+
}),
|
|
296
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("engram run -d start budget exceeded")), ENGRAM_DAEMON_START_TIMEOUT_MS)),
|
|
297
|
+
]);
|
|
298
|
+
const deadline = Date.now() + ENGRAM_START_EXIT_GRACE_MS;
|
|
299
|
+
while (Date.now() < deadline) {
|
|
300
|
+
const endpoint = await probeEngramEndpoint({ timeoutMs: 500 });
|
|
301
|
+
if (endpoint.kind === "listening" && endpoint.compatible) return true;
|
|
302
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
303
|
+
}
|
|
304
|
+
} catch {
|
|
305
|
+
// Spawn error or the wrapper outlived the start budget: fall back to the
|
|
306
|
+
// legacy detached serve.
|
|
307
|
+
}
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const LEGACY_ENGRAM_COMPANION_SOURCE = "npm:gentle-engram@0.4.2";
|
|
312
|
+
const companionSource = (entry) => typeof entry === "string" ? entry : entry?.source;
|
|
313
|
+
|
|
314
|
+
function ownsCompanionHome(home, homeHadContentBeforeBootstrap) {
|
|
315
|
+
if (home.mode === "link") return false;
|
|
316
|
+
const previous = provisionedEntry(readRawConfig(resolveConfigPath()), safeRealpath(home.dir));
|
|
317
|
+
return !homeIsForeign(home, previous, homeHadContentBeforeBootstrap);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// The old launcher itself registered this exact pin. In a Shell-owned home,
|
|
321
|
+
// migrate only that legacy selection, using the selected Pi's own package
|
|
322
|
+
// manager to keep source identity, filters, ordering and settings locking. This
|
|
323
|
+
// changes configuration only: Pi's normal startup notice and explicit update
|
|
324
|
+
// command remain responsible for discovering and installing newer packages.
|
|
325
|
+
async function migrateManagedEngramCompanion(home, homeHadContentBeforeBootstrap) {
|
|
326
|
+
if (!ownsCompanionHome(home, homeHadContentBeforeBootstrap)) return { ok: true };
|
|
327
|
+
try {
|
|
328
|
+
const settingsPath = join(home.dir, "settings.json");
|
|
329
|
+
const packages = JSON.parse(readJsonIfExists(settingsPath) ?? "{}").packages ?? [];
|
|
330
|
+
if (!Array.isArray(packages)) return { ok: true };
|
|
331
|
+
const npmSources = packages.map(companionSource).filter((source) => typeof source === "string" && /^npm:gentle-engram(?:@|$)/.test(source));
|
|
332
|
+
if (npmSources.length !== 1 || npmSources[0] !== LEGACY_ENGRAM_COMPANION_SOURCE) return { ok: true };
|
|
333
|
+
// Do not take over an explicitly selected local companion, or infer
|
|
334
|
+
// ownership from a missing/unverified npm installation.
|
|
335
|
+
if (packages.some((entry) => {
|
|
336
|
+
const source = companionSource(entry);
|
|
337
|
+
return typeof source === "string" && !source.startsWith("npm:") && readPackageName(resolvePath(home.dir, source)) === "gentle-engram";
|
|
338
|
+
})) return { ok: true };
|
|
339
|
+
const metadata = join(home.dir, "npm", "node_modules", "gentle-engram", "package.json");
|
|
340
|
+
const metadataText = readJsonIfExists(metadata);
|
|
341
|
+
if (!supportsEngramStartupPolicy(metadataText) || JSON.parse(metadataText).version !== "0.4.2") throw new Error("the legacy companion installation could not be verified");
|
|
342
|
+
const piRoot = dirname(dirname(dirname(bundledCli)));
|
|
343
|
+
const main = JSON.parse(readJsonIfExists(join(piRoot, "package.json")) ?? "{}").main;
|
|
344
|
+
if (typeof main !== "string" || !main) throw new Error("the selected Pi does not expose its package manager");
|
|
345
|
+
const sdkPath = resolvePath(piRoot, main);
|
|
346
|
+
const sdkRelative = relative(piRoot, sdkPath);
|
|
347
|
+
if (!sdkRelative || sdkRelative === ".." || sdkRelative.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || isAbsolute(sdkRelative)) throw new Error("the selected Pi package manager is outside its package");
|
|
348
|
+
const { DefaultPackageManager, SettingsManager } = await import(pathToFileURL(sdkPath).href);
|
|
349
|
+
const settings = SettingsManager.create(process.cwd(), home.dir, { projectTrusted: false });
|
|
350
|
+
const loadErrors = settings.drainErrors();
|
|
351
|
+
if (loadErrors.length) throw loadErrors[0].error;
|
|
352
|
+
const selected = settings.getGlobalSettings().packages ?? [];
|
|
353
|
+
const currentNpmSources = selected.map(companionSource).filter((source) => typeof source === "string" && /^npm:gentle-engram(?:@|$)/.test(source));
|
|
354
|
+
const localSelected = selected.some((entry) => {
|
|
355
|
+
const source = companionSource(entry);
|
|
356
|
+
return typeof source === "string" && !source.startsWith("npm:") && readPackageName(resolvePath(home.dir, source)) === "gentle-engram";
|
|
357
|
+
});
|
|
358
|
+
if (localSelected || currentNpmSources.length !== 1 || currentNpmSources[0] !== LEGACY_ENGRAM_COMPANION_SOURCE) throw new Error("companion selection changed");
|
|
359
|
+
const manager = new DefaultPackageManager({ cwd: process.cwd(), agentDir: home.dir, settingsManager: settings });
|
|
360
|
+
manager.addSourceToSettings(ENGRAM_COMPANION_SOURCE);
|
|
361
|
+
await settings.flush();
|
|
362
|
+
const errors = settings.drainErrors();
|
|
363
|
+
if (errors.length) throw errors[0].error;
|
|
364
|
+
const persisted = JSON.parse(readJsonIfExists(settingsPath) ?? "{}").packages;
|
|
365
|
+
if (!Array.isArray(persisted) || !persisted.some((entry) => companionSource(entry) === ENGRAM_COMPANION_SOURCE)) throw new Error("companion selection was not saved");
|
|
366
|
+
return { ok: true };
|
|
367
|
+
} catch (error) {
|
|
368
|
+
return { ok: false, exitCode: 1, message: `gentle-shell: could not prepare the managed gentle-engram package for updates (${error.message}); review its selection before retrying` };
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// A stderr write that resolves once the bytes are handed to the stream. When
|
|
373
|
+
// stderr is a pipe (a parent process, a test harness) Node writes
|
|
374
|
+
// asynchronously, so an immediate process.exit() truncates the message. Anything
|
|
375
|
+
// written right before the process exits must go through this.
|
|
376
|
+
function writeStderrAndFlush(text) {
|
|
377
|
+
return new Promise((resolve) => { process.stderr.write(text, () => resolve()); });
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// Companion-vs-core contract gate (S1, S3, S4), warn only: a companion whose
|
|
381
|
+
// runtime contract differs from the bundled core's is still installed and run,
|
|
382
|
+
// and the mismatch is only announced loudly — never a failure, never an exit
|
|
383
|
+
// code change, never a rewritten selection. A missing or malformed contract
|
|
384
|
+
// file is not an error: without a parsed digest there is nothing to compare.
|
|
385
|
+
function warnEngramContractMismatch(home) {
|
|
386
|
+
try {
|
|
387
|
+
const contract = parseEngramRuntimeContract(JSON.parse(readJsonIfExists(join(home.dir, "npm", "node_modules", "gentle-engram", "runtime-contract.json")) ?? "null"));
|
|
388
|
+
const notice = engramContractMismatchNotice(contract?.digest, engramPinVersion);
|
|
389
|
+
if (notice) process.stderr.write(`gentle-shell: ${notice}\n`);
|
|
390
|
+
} catch {
|
|
391
|
+
// Warn only: an unreadable contract file never blocks anything.
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// At launch, after the shared server is ready: compare the digest the running
|
|
396
|
+
// server answers on GET /runtime-contract with the companion's own contract
|
|
397
|
+
// file, and warn loudly on a mismatch. Warn only: a probe failure, an
|
|
398
|
+
// unparseable answer or a missing file never disables memory or changes the
|
|
399
|
+
// exit code, and the selection is never rewritten.
|
|
400
|
+
async function warnLiveEngramContractMismatch(home) {
|
|
401
|
+
try {
|
|
402
|
+
const companion = parseEngramRuntimeContract(JSON.parse(readJsonIfExists(join(home.dir, "npm", "node_modules", "gentle-engram", "runtime-contract.json")) ?? "null"));
|
|
403
|
+
if (companion === undefined) return;
|
|
404
|
+
const live = await probeEngramRuntimeContract();
|
|
405
|
+
// Without a well-formed live answer the core side is unknown: the gate is
|
|
406
|
+
// silent here, and the companion-vs-pinned check already warned above.
|
|
407
|
+
if (live === undefined) return;
|
|
408
|
+
const notice = engramContractMismatchNotice(companion.digest, engramPinVersion, live, "the running Engram server");
|
|
409
|
+
if (notice) process.stderr.write(`gentle-shell: ${notice}\n`);
|
|
410
|
+
} catch {
|
|
411
|
+
// Warn only: an unreadable contract file never blocks anything.
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// Use Pi's install command, never an alternate extension loader. A user's
|
|
416
|
+
// selected companion stays selected; missing or unverified capability is only
|
|
417
|
+
// warned about, while the guard continues to protect unverified stores.
|
|
418
|
+
async function ensureEngramCompanion(home, runtime, stdio, timeoutMs, homeHadContentBeforeBootstrap) {
|
|
419
|
+
// S1/S3/S4: warn on a companion whose contract does not match the bundled
|
|
420
|
+
// core, but never fail, never change the exit code, never rewrite the selection.
|
|
421
|
+
warnEngramContractMismatch(home);
|
|
269
422
|
const metadata = join(home.dir, "npm", "node_modules", "gentle-engram", "package.json");
|
|
270
423
|
let packages;
|
|
271
424
|
try {
|
|
@@ -274,15 +427,12 @@ async function ensureEngramCompanion(home, runtime, stdio, timeoutMs) {
|
|
|
274
427
|
return { ok: false, exitCode: 1, message: "gentle-shell: cannot verify Engram startupPolicy from malformed settings; repair settings and recheck" };
|
|
275
428
|
}
|
|
276
429
|
if (!Array.isArray(packages)) return { ok: false, exitCode: 1, message: "gentle-shell: cannot verify Engram startupPolicy from non-array packages" };
|
|
277
|
-
let pinned = false;
|
|
278
430
|
let local = false;
|
|
279
|
-
|
|
431
|
+
const npmSelections = [];
|
|
280
432
|
for (const entry of packages) {
|
|
281
|
-
const source =
|
|
282
|
-
if (source ===
|
|
283
|
-
if (typeof source === "string" && /^npm:gentle-engram(?:@|$)/.test(source)) npmSelected = true;
|
|
433
|
+
const source = companionSource(entry);
|
|
434
|
+
if (typeof source === "string" && /^npm:gentle-engram(?:@|$)/.test(source)) npmSelections.push(source);
|
|
284
435
|
if (typeof source !== "string" || source.startsWith("npm:")) continue;
|
|
285
|
-
// Preserve an explicit local companion selection rather than overwrite it.
|
|
286
436
|
const selected = resolvePath(home.dir, source);
|
|
287
437
|
if (readPackageName(selected) !== "gentle-engram") continue;
|
|
288
438
|
if (!supportsEngramStartupPolicy(readJsonIfExists(join(selected, "package.json")))) {
|
|
@@ -290,14 +440,25 @@ async function ensureEngramCompanion(home, runtime, stdio, timeoutMs) {
|
|
|
290
440
|
}
|
|
291
441
|
local = true;
|
|
292
442
|
}
|
|
293
|
-
if (
|
|
294
|
-
|
|
443
|
+
if (npmSelections.length) {
|
|
444
|
+
const metadataText = readJsonIfExists(metadata);
|
|
445
|
+
if (supportsEngramStartupPolicy(metadataText)) {
|
|
446
|
+
const installedVersion = JSON.parse(metadataText).version;
|
|
447
|
+
const mismatch = npmSelections.some((source) => {
|
|
448
|
+
const exact = /^npm:gentle-engram@v?((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)$/.exec(source);
|
|
449
|
+
return exact && exact[1] !== installedVersion;
|
|
450
|
+
});
|
|
451
|
+
if (!mismatch) return { ok: true };
|
|
452
|
+
return { ok: false, exitCode: 1, message: "gentle-shell: selected gentle-engram does not match its installed version; recheck its startupPolicy (selection preserved)" };
|
|
453
|
+
}
|
|
454
|
+
return { ok: false, exitCode: 1, message: "gentle-shell: selected gentle-engram lacks engram.startupPolicy=1; update it and recheck (selection preserved)" };
|
|
455
|
+
}
|
|
456
|
+
if (local || !ownsCompanionHome(home, homeHadContentBeforeBootstrap)) return { ok: true };
|
|
295
457
|
process.stderr.write(`gentle-shell: installing policy-capable companion ${ENGRAM_COMPANION_SOURCE} through Pi\n`);
|
|
296
458
|
const result = await spawnAndWait(runtime.command, [...runtime.args, "install", ENGRAM_COMPANION_SOURCE], buildSetupEnv(home, runtime), stdio, timeoutMs);
|
|
297
459
|
let declared = false;
|
|
298
460
|
try {
|
|
299
|
-
declared = JSON.parse(readJsonIfExists(join(home.dir, "settings.json")) ?? "{}").packages?.some((entry) =>
|
|
300
|
-
(typeof entry === "string" ? entry : entry?.source) === ENGRAM_COMPANION_SOURCE) === true;
|
|
461
|
+
declared = JSON.parse(readJsonIfExists(join(home.dir, "settings.json")) ?? "{}").packages?.some((entry) => companionSource(entry) === ENGRAM_COMPANION_SOURCE) === true;
|
|
301
462
|
} catch { /* Missing or malformed readback cannot establish enforcement. */ }
|
|
302
463
|
if (!result.ok || result.timedOut || !declared || !supportsEngramStartupPolicy(readJsonIfExists(metadata))) {
|
|
303
464
|
return { ok: false, exitCode: 1, message: "gentle-shell: companion installation did not establish engram.startupPolicy=1; the Engram guard still keeps unverified stores closed. Repair gentle-engram, then restart Shell." };
|
|
@@ -318,6 +479,22 @@ function ownPackageVersion() {
|
|
|
318
479
|
return packageJson.version;
|
|
319
480
|
}
|
|
320
481
|
|
|
482
|
+
// The real spawn, only ever needed for a runtime with no in-memory version
|
|
483
|
+
// (env override, PATH pi): kind "bundled" always has runtime.version set and
|
|
484
|
+
// skips this entirely (#2096).
|
|
485
|
+
function probePiVersion(runtime) {
|
|
486
|
+
const versionProbePlan = planSpawn({ command: runtime.command, args: [...runtime.args, "--version"], platform: process.platform });
|
|
487
|
+
const versionProbe = spawnSync(versionProbePlan.command, versionProbePlan.args, {
|
|
488
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
489
|
+
timeout: 15000,
|
|
490
|
+
encoding: "utf8",
|
|
491
|
+
shell: versionProbePlan.shell,
|
|
492
|
+
env: bundledEnv ?? process.env,
|
|
493
|
+
});
|
|
494
|
+
if (versionProbe.error) fail(`Could not run the pi runtime at "${runtime.command}": ${versionProbe.error.message}`, 1);
|
|
495
|
+
return checkPiVersion(versionProbe.stdout ?? "");
|
|
496
|
+
}
|
|
497
|
+
|
|
321
498
|
function emptyArgs() {
|
|
322
499
|
return {
|
|
323
500
|
link: false,
|
|
@@ -1133,7 +1310,7 @@ function ensureBuiltinCodemodeExcluded(settingsPath) {
|
|
|
1133
1310
|
// rpc`/`-p` consumers. `timeoutMs` is threaded into every child this flow
|
|
1134
1311
|
// spawns (see spawnAndWait's own doc comment) — manual `setup` never passes
|
|
1135
1312
|
// it, so it never times out; the automatic flow does (S9).
|
|
1136
|
-
async function runSetupFlow(home, runtime, { dryRun, stdio, timeoutMs }) {
|
|
1313
|
+
async function runSetupFlow(home, runtime, { dryRun, stdio, timeoutMs, homeHadContentBeforeBootstrap }) {
|
|
1137
1314
|
const pinnedVersion = resolveSetupGentleAiPin();
|
|
1138
1315
|
if (!isSetupCapablePin(pinnedVersion)) {
|
|
1139
1316
|
return {
|
|
@@ -1203,19 +1380,43 @@ async function runSetupFlow(home, runtime, { dryRun, stdio, timeoutMs }) {
|
|
|
1203
1380
|
process.stderr.write(`gentle-shell: kept your Pi theme unchanged (gentle-ai rewrote ${settingsPath}; tracked upstream)\n`);
|
|
1204
1381
|
}
|
|
1205
1382
|
}
|
|
1206
|
-
if (installResult.timedOut) {
|
|
1207
|
-
return { ok: false, exitCode: 1, message: `gentle-shell: gentle-ai install timed out after ${formatTimeoutCeiling(timeoutMs)}` };
|
|
1208
|
-
}
|
|
1209
1383
|
if (installResult.error) {
|
|
1210
1384
|
return { ok: false, exitCode: 1, message: `Could not start the gentle-ai binary: ${installResult.error.message}` };
|
|
1211
1385
|
}
|
|
1212
|
-
if (!installResult.ok
|
|
1386
|
+
if (!installResult.ok || installResult.timedOut) {
|
|
1387
|
+
// Run post-install cleanup even on failure or timeout so a failed setup
|
|
1388
|
+
// does not leave npm:gentle-pi declared in settings.json, which would make
|
|
1389
|
+
// subsequent launches silently run the published npm package instead of
|
|
1390
|
+
// the launcher's own package (#1647).
|
|
1391
|
+
if (!dryRun && !installResult.interrupted) {
|
|
1392
|
+
// A cleanup that throws (e.g. an unreadable settings.json) must not
|
|
1393
|
+
// replace the install's own failure; it only adds a diagnostic.
|
|
1394
|
+
let cleanupResult;
|
|
1395
|
+
try {
|
|
1396
|
+
cleanupResult = await runPostInstallCleanup(home, runtime, false, stdio, timeoutMs);
|
|
1397
|
+
} catch (error) {
|
|
1398
|
+
cleanupResult = { ok: false, exitCode: 1, message: `gentle-shell: post-install cleanup failed: ${error.message}` };
|
|
1399
|
+
}
|
|
1400
|
+
if (cleanupResult.interrupted) return cleanupResult;
|
|
1401
|
+
if (!cleanupResult.ok && cleanupResult.message !== undefined) {
|
|
1402
|
+
const baseMessage = installResult.timedOut
|
|
1403
|
+
? `gentle-shell: gentle-ai install timed out after ${formatTimeoutCeiling(timeoutMs)}`
|
|
1404
|
+
: installResult.message;
|
|
1405
|
+
const message = baseMessage ? `${baseMessage}\n${cleanupResult.message}` : cleanupResult.message;
|
|
1406
|
+
return { ok: false, exitCode: installResult.exitCode, message };
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
if (installResult.timedOut) {
|
|
1410
|
+
return { ok: false, exitCode: 1, message: `gentle-shell: gentle-ai install timed out after ${formatTimeoutCeiling(timeoutMs)}` };
|
|
1411
|
+
}
|
|
1412
|
+
return installResult;
|
|
1413
|
+
}
|
|
1213
1414
|
|
|
1214
1415
|
const cleanupResult = await runPostInstallCleanup(home, runtime, dryRun, stdio, timeoutMs);
|
|
1215
1416
|
if (cleanupResult.ok && !dryRun) {
|
|
1216
1417
|
warnDisabledMCP(home);
|
|
1217
1418
|
// The guard and policy protect memory, so the companion check only warns.
|
|
1218
|
-
const companion = bundledInstall ? await ensureEngramCompanion(home, runtime, stdio, timeoutMs) : { ok: true };
|
|
1419
|
+
const companion = bundledInstall ? await ensureEngramCompanion(home, runtime, stdio, timeoutMs, homeHadContentBeforeBootstrap) : { ok: true };
|
|
1219
1420
|
if (!companion.ok) process.stderr.write(`${companion.message}\n`);
|
|
1220
1421
|
}
|
|
1221
1422
|
return cleanupResult;
|
|
@@ -1361,7 +1562,7 @@ async function handleSetupCommand(commandArgs, home, runtime, { homeHadContentBe
|
|
|
1361
1562
|
fail(`Unrecognized argument for 'gentle-shell setup': ${arg}\nRun 'gentle-shell --help' for usage.`, 2);
|
|
1362
1563
|
}
|
|
1363
1564
|
|
|
1364
|
-
const result = await runSetupFlow(home, runtime, { dryRun, stdio: "inherit" });
|
|
1565
|
+
const result = await runSetupFlow(home, runtime, { dryRun, stdio: "inherit", homeHadContentBeforeBootstrap });
|
|
1365
1566
|
if (!result.ok && result.message !== undefined) process.stderr.write(`${result.message}\n`);
|
|
1366
1567
|
if (result.ok && !dryRun && (home.mode === "isolated" || home.mode === "path")) {
|
|
1367
1568
|
const configPath = resolveConfigPath();
|
|
@@ -1599,7 +1800,7 @@ async function maybeAutoProvisionHome(home, runtime, { homeHadContentBeforeBoots
|
|
|
1599
1800
|
}
|
|
1600
1801
|
}
|
|
1601
1802
|
|
|
1602
|
-
const result = await runSetupFlow(home, runtime, { dryRun: false, stdio: ["ignore", 2, 2], timeoutMs: resolveAutoSetupTimeoutMs() });
|
|
1803
|
+
const result = await runSetupFlow(home, runtime, { dryRun: false, stdio: ["ignore", 2, 2], timeoutMs: resolveAutoSetupTimeoutMs(), homeHadContentBeforeBootstrap });
|
|
1603
1804
|
// Abort the whole launch only for a launcher-forwarded interrupt
|
|
1604
1805
|
// (R3-002); a child that exited via signal on its own (crash, OOM kill,
|
|
1605
1806
|
// external kill) falls through to the ordinary-failure branch below,
|
|
@@ -1712,7 +1913,7 @@ async function handleBundledUpgrade(bundled, commandArgs) {
|
|
|
1712
1913
|
}
|
|
1713
1914
|
}
|
|
1714
1915
|
|
|
1715
|
-
// `gentle-shell update
|
|
1916
|
+
// `gentle-shell update` in a bundled install: the newest published
|
|
1716
1917
|
// Pi installed with this Gentle Shell beside the active version, without the
|
|
1717
1918
|
// release's verified lockfile (after a warning), verified, then `current`
|
|
1718
1919
|
// switched. Returns the exit code like handleBundledUpgrade; a failure leaves
|
|
@@ -1893,7 +2094,7 @@ async function main() {
|
|
|
1893
2094
|
const args = parseLauncherArgs(process.argv.slice(2));
|
|
1894
2095
|
if (args.error !== undefined) fail(`${args.error}\nRun 'gentle-shell --help' for usage.`, 2);
|
|
1895
2096
|
if (args.help) {
|
|
1896
|
-
process.stdout.write("Pi updates: update
|
|
2097
|
+
process.stdout.write("Pi updates: update resolves the newest published stable Pi and updates its verified supplier\n(a global Pi, or its Shell package at the same Shell version), then reads the Pi version back.\npnpm temporarily exempts only Pi and the @earendil-works packages it pins exactly (transitively) from\nminimumReleaseAge, merged into their existing exclusions; other exclusions and policy stay in force.\nA linked source Shell updates local Pi with its project manager and one matching lockfile;\npnpm may be newer than the declared minimum; npm must match its pin. No manager is downloaded;\nGit roots only, no lifecycle scripts or manifest range changes. Root-only pnpm configuration is preserved;\nmulti-project/ancestor workspaces and conflicting lockfiles refuse before installation. Unknown ownership refuses; update --extensions-only stays Pi-only.\nPrefix-bundled update also selects the latest stable Pi; upgrade updates Shell.\n");
|
|
1897
2098
|
process.stdout.write(`${helpText()}\nBundled Engram memory: Shell shares the global Engram server on 127.0.0.1:7437, like other agents' hooks.\nA running server is reused only with verified /compatibility evidence; when nothing listens, Shell starts the\nbundled core's engram serve (default ~/.engram) and waits for that evidence. Otherwise ENGRAM_BIN is Shell's\nguard and memory stays off for that launch. Matching versions or updating alone do not prove compatibility.\nBack up existing data before manual changes; do not delete it or bypass the safety check.\nShell rechecks on every launch and remains usable without memory.\nAn explicit ENGRAM_BIN or ENGRAM_URL is kept and bypasses the guard.\n`);
|
|
1898
2099
|
process.exit(0);
|
|
1899
2100
|
}
|
|
@@ -1948,7 +2149,7 @@ async function main() {
|
|
|
1948
2149
|
// S8: only the version's own Pi, never GENTLE_SHELL_PI, an adjacent fallback or PATH.
|
|
1949
2150
|
const pi = bundledPi(bundled, { platform: process.platform, fs: bundledFs });
|
|
1950
2151
|
if (!pi.ok) fail(pi.message, 1);
|
|
1951
|
-
runtime = { kind: "bundled", command: process.execPath, args: [pi.cli] };
|
|
2152
|
+
runtime = { kind: "bundled", command: process.execPath, args: [pi.cli], version: pi.version };
|
|
1952
2153
|
bundledInstall = bundled;
|
|
1953
2154
|
bundledCli = pi.cli;
|
|
1954
2155
|
bundledMemory = engramQuiet ? { policy: "disabled", notice: ENGRAM_RECOVERY_NOTICE } : await classifyBundledMemory();
|
|
@@ -1964,16 +2165,11 @@ async function main() {
|
|
|
1964
2165
|
if (runtime === undefined) fail(missingPiMessage(), 1);
|
|
1965
2166
|
}
|
|
1966
2167
|
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
shell: versionProbePlan.shell,
|
|
1973
|
-
env: bundledEnv ?? process.env,
|
|
1974
|
-
});
|
|
1975
|
-
if (versionProbe.error) fail(`Could not run the pi runtime at "${runtime.command}": ${versionProbe.error.message}`, 1);
|
|
1976
|
-
const versionCheck = checkPiVersion(versionProbe.stdout ?? "");
|
|
2168
|
+
// Bundled runtimes already carry their version in memory (package.json /
|
|
2169
|
+
// the pinned dependency): spawning a whole process just to print it back
|
|
2170
|
+
// is the redundant cost issue #2096 reports, so only env/path runtimes
|
|
2171
|
+
// (which have no such in-memory source) still pay for a real probe.
|
|
2172
|
+
const versionCheck = runtime.version !== undefined ? checkPiVersion(runtime.version) : probePiVersion(runtime);
|
|
1977
2173
|
// A managed self update is how an old Pi gets replaced, so the minimum-version
|
|
1978
2174
|
// gate must not block it; everything else still requires the minimum.
|
|
1979
2175
|
const managedSelfUpdate = !bundled && args.piSubcommand === "update" && versionCheck.version !== undefined
|
|
@@ -1985,24 +2181,16 @@ async function main() {
|
|
|
1985
2181
|
process.exit(0);
|
|
1986
2182
|
}
|
|
1987
2183
|
|
|
1988
|
-
//
|
|
1989
|
-
//
|
|
1990
|
-
// otherwise), or with `--latest` the newest published Pi without the
|
|
1991
|
-
// release's lockfile (run even when not interactive: it was asked for);
|
|
1992
|
-
// package updates still reach Pi.
|
|
2184
|
+
// Self updates select the latest published Pi in a bundled prefix; package
|
|
2185
|
+
// updates still go to Pi. A self failure must survive a successful child.
|
|
1993
2186
|
let passthrough = args.passthrough;
|
|
2187
|
+
let updateExitCode = 0;
|
|
1994
2188
|
if (bundled && args.piSubcommand === "update") {
|
|
1995
2189
|
const plan = bundledUpdatePlan(args.passthrough);
|
|
1996
2190
|
if (plan.self) {
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
} else {
|
|
2001
|
-
const interactive = process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
2002
|
-
for (const line of bundledUpdateNotice({ piVersion: versionCheck.version, interactive })) process.stdout.write(`${line}\n`);
|
|
2003
|
-
code = interactive ? await handleBundledUpgrade(bundled, []) : undefined;
|
|
2004
|
-
}
|
|
2005
|
-
const next = bundledUpdateNext(plan, code);
|
|
2191
|
+
if (args.passthrough.includes("--force")) fail("gentle-shell update: --force is not supported for managed Pi updates.", 2);
|
|
2192
|
+
updateExitCode = await handleBundledPiLatest(bundled);
|
|
2193
|
+
const next = bundledUpdateNext(plan, updateExitCode);
|
|
2006
2194
|
if ("exitCode" in next) process.exit(next.exitCode);
|
|
2007
2195
|
if (next.note) process.stderr.write(`${next.note}\n`);
|
|
2008
2196
|
}
|
|
@@ -2011,9 +2199,10 @@ async function main() {
|
|
|
2011
2199
|
const { managedUpdatePlan, updateSelectedPi } = await import("../scripts/pi-update.mjs");
|
|
2012
2200
|
const plan = managedUpdatePlan(args.passthrough);
|
|
2013
2201
|
if (plan.self) {
|
|
2014
|
-
|
|
2202
|
+
if (args.passthrough.includes("--force")) fail("gentle-shell update: --force is not supported for managed Pi updates.", 2);
|
|
2203
|
+
updateExitCode = await updateSelectedPi({ runtime, packageRoot, platform: process.platform, currentVersion: versionCheck.version, cwd: tmpdir(), env: process.env, home: homedir(),
|
|
2015
2204
|
adapters: await packageManagerAdapters(), out: (line) => process.stdout.write(`${line}\n`) });
|
|
2016
|
-
if (plan.piArgs === undefined) return;
|
|
2205
|
+
if (plan.piArgs === undefined) { process.exitCode = updateExitCode; return; }
|
|
2017
2206
|
}
|
|
2018
2207
|
passthrough = plan.piArgs;
|
|
2019
2208
|
}
|
|
@@ -2067,6 +2256,15 @@ async function main() {
|
|
|
2067
2256
|
}
|
|
2068
2257
|
}
|
|
2069
2258
|
|
|
2259
|
+
// Only a valid extension-only update gets the configuration migration. All
|
|
2260
|
+
// rejected forms must reach Pi without changing a package selection.
|
|
2261
|
+
const extensionUpdate = args.piSubcommand === "update" && passthrough?.[0] === "update" && passthrough.includes("--extensions")
|
|
2262
|
+
&& passthrough.slice(1).every((arg) => ["--extensions", "--approve", "-a", "--no-approve", "-na", "--force"].includes(arg));
|
|
2263
|
+
if (bundled && extensionUpdate) {
|
|
2264
|
+
const migrated = await migrateManagedEngramCompanion(home, homeHadContentBeforeBootstrap);
|
|
2265
|
+
if (!migrated.ok) fail(migrated.message, migrated.exitCode);
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2070
2268
|
if (args.command === "setup") {
|
|
2071
2269
|
await handleSetupCommand(args.commandArgs, home, runtime, { homeHadContentBeforeBootstrap });
|
|
2072
2270
|
return;
|
|
@@ -2204,11 +2402,16 @@ async function main() {
|
|
|
2204
2402
|
bundledEnv = bundledProcessEnv();
|
|
2205
2403
|
// The guard protects memory whatever provider loads, so a companion that
|
|
2206
2404
|
// could not be verified is reported, never a reason to stop Shell.
|
|
2207
|
-
const
|
|
2405
|
+
const migrated = await migrateManagedEngramCompanion(home, homeHadContentBeforeBootstrap);
|
|
2406
|
+
if (!migrated.ok) process.stderr.write(`${migrated.message}\n`);
|
|
2407
|
+
const companion = await ensureEngramCompanion(home, runtime, ["ignore", 2, 2], 10000, homeHadContentBeforeBootstrap);
|
|
2208
2408
|
if (!companion.ok) process.stderr.write(`${companion.message}\n`);
|
|
2209
2409
|
// Only this final decision starts the shared server, and Pi gets its
|
|
2210
2410
|
// URL only once the server verified.
|
|
2211
2411
|
if (bundledMemory.spawn) bundledMemory = await startSharedEngram();
|
|
2412
|
+
// S1/S4: with the shared server ready, the live GET /runtime-contract is
|
|
2413
|
+
// compared with the companion's file. Warn only.
|
|
2414
|
+
if (bundledMemory.policy === "allow") await warnLiveEngramContractMismatch(home);
|
|
2212
2415
|
if (bundledMemory.notice) process.stderr.write(`gentle-shell: ${bundledMemory.notice}\n`);
|
|
2213
2416
|
}
|
|
2214
2417
|
bundledEnv = bundledProcessEnv();
|
|
@@ -2263,8 +2466,8 @@ async function main() {
|
|
|
2263
2466
|
resumeHandoff?.dispose();
|
|
2264
2467
|
fail(`Could not start pi: ${error.message}`, 1);
|
|
2265
2468
|
});
|
|
2266
|
-
child.on("exit", (code, signal) => {
|
|
2267
|
-
const exitCode = signal ? signalExitCode(signal) : (code ?? 1);
|
|
2469
|
+
child.on("exit", async (code, signal) => {
|
|
2470
|
+
const exitCode = signal ? signalExitCode(signal) : ((code ?? 1) || updateExitCode);
|
|
2268
2471
|
if (resumeHandoff) {
|
|
2269
2472
|
const hint = planResumeHint({
|
|
2270
2473
|
handoff: resumeHandoff.read(),
|
|
@@ -2285,6 +2488,30 @@ async function main() {
|
|
|
2285
2488
|
return;
|
|
2286
2489
|
}
|
|
2287
2490
|
}
|
|
2491
|
+
// T4 (S2, S5): after the `pi update --extensions` child completes for a
|
|
2492
|
+
// bundled, Shell-owned home, run the same companion verification that setup
|
|
2493
|
+
// and launch run, instead of skipping it because a piSubcommand is set: the
|
|
2494
|
+
// migration above un-pins the source, Pi replaces it with @latest, and
|
|
2495
|
+
// nothing else re-verifies the replaced companion. Warn only: a successful
|
|
2496
|
+
// update is never reported as failed because of this, the user's package
|
|
2497
|
+
// selection is never rewritten or deleted, and the version found after the
|
|
2498
|
+
// update is reported. A signal-killed child did not complete; the next
|
|
2499
|
+
// launch re-verifies as always.
|
|
2500
|
+
// `signal` is null, not undefined, on a normal exit; keep the truthiness the
|
|
2501
|
+
// exit code above already relies on.
|
|
2502
|
+
if (bundled && extensionUpdate && !signal && ownsCompanionHome(home, homeHadContentBeforeBootstrap)) {
|
|
2503
|
+
try {
|
|
2504
|
+
const companion = await ensureEngramCompanion(home, runtime, ["ignore", 2, 2], 10000, homeHadContentBeforeBootstrap);
|
|
2505
|
+
if (companion.ok) {
|
|
2506
|
+
const version = JSON.parse(readJsonIfExists(join(home.dir, "npm", "node_modules", "gentle-engram", "package.json")) ?? "null")?.version;
|
|
2507
|
+
if (typeof version === "string") await writeStderrAndFlush(`gentle-shell: gentle-engram ${version} verified after the extensions update\n`);
|
|
2508
|
+
} else {
|
|
2509
|
+
await writeStderrAndFlush(`${companion.message}\n`);
|
|
2510
|
+
}
|
|
2511
|
+
} catch (error) {
|
|
2512
|
+
await writeStderrAndFlush(`gentle-shell: could not verify the gentle-engram companion after the extensions update (${error.message}); continuing\n`);
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2288
2515
|
process.exit(exitCode);
|
|
2289
2516
|
});
|
|
2290
2517
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "gentle-pi.review-provider-contract-mirror-lock/v1",
|
|
3
3
|
"acquisition": "field-test-local",
|
|
4
|
-
"contract_semver": "1.
|
|
4
|
+
"contract_semver": "1.5.0",
|
|
5
5
|
"source": {
|
|
6
|
-
"kind": "
|
|
7
|
-
"archive_sha256": "9d2927a84ba9a596f69029e3f854b16f86ca4c8b32cc5d63683764ccf2fb394b"
|
|
6
|
+
"kind": "tree"
|
|
8
7
|
},
|
|
9
|
-
"tree_sha256": "
|
|
8
|
+
"tree_sha256": "9e887fbded4a216aa89e8ec8818a6f4789d2b09cfff7fbd165fc1518a4d3d312",
|
|
10
9
|
"entries": {
|
|
11
10
|
"README.md": "3a655c2f19aee02636da062f0cae7a189b7e5f691c8ba8010f2ed50e5d8e8d70",
|
|
12
|
-
"manifest.json": "
|
|
13
|
-
"orchestration/pi.md": "
|
|
14
|
-
"routing/pi.md": "
|
|
11
|
+
"manifest.json": "cd8f2379a27b66877a77d7cf57ad21d4a19244baaa9929117183b0f6e5ae6d6d",
|
|
12
|
+
"orchestration/pi.md": "c0e7c4c2ab07a695ecf108b476bee81e6d9ca553b7a3860299fe2870b68d8bfc",
|
|
13
|
+
"routing/pi.md": "f34508b060197339fc73dd885565a24d037366c02b3f91b4db15431b42a5c573",
|
|
15
14
|
"schemas/lens.schema.json": "9b8a2354a570888486015434501b66b51441a3baf5bf858635e4fff56b2e8298",
|
|
16
15
|
"schemas/refuter.schema.json": "36f8267c6c3f04600b8f1cb77df70d90858611af822cc81922efd6b3502fb646",
|
|
17
16
|
"schemas/targeted-validator.schema.json": "40e397195bdfbc6782fc3090f20c5be082e4d14d2855314f99ecb8506133eddc",
|
|
@@ -20,8 +19,8 @@
|
|
|
20
19
|
"vectors/targeted-validator.json": "7b5a5165e3a913863fb98d2ba5387811860c21333b5c37e6ed3b4e0d121cf2fa"
|
|
21
20
|
},
|
|
22
21
|
"generated": {
|
|
23
|
-
"generated/provider-capabilities.baseline.json": "
|
|
24
|
-
"generated/provider-roles.baseline.json": "
|
|
22
|
+
"generated/provider-capabilities.baseline.json": "f9b2e0f3600683e81d7e381ee24aa251e781a11e8cfc7fe12e476861354102ff",
|
|
23
|
+
"generated/provider-roles.baseline.json": "f6a9c8b071d01266a7ba2a3c74ab54833cfd5b240abfe435ae931086e5397a8b"
|
|
25
24
|
},
|
|
26
25
|
"runtimes": [
|
|
27
26
|
"claude-code",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "gentle-ai.review-provider-contract-bundle/v1",
|
|
3
|
-
"contract_semver": "1.
|
|
3
|
+
"contract_semver": "1.5.0",
|
|
4
4
|
"transport_capability": "gentle-ai.provider-transport/v1",
|
|
5
5
|
"runtimes": [
|
|
6
6
|
"claude-code",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"runtime": "pi",
|
|
68
68
|
"file": {
|
|
69
69
|
"path": "orchestration/pi.md",
|
|
70
|
-
"sha256": "
|
|
70
|
+
"sha256": "c0e7c4c2ab07a695ecf108b476bee81e6d9ca553b7a3860299fe2870b68d8bfc"
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
],
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"runtime": "pi",
|
|
77
77
|
"file": {
|
|
78
78
|
"path": "routing/pi.md",
|
|
79
|
-
"sha256": "
|
|
79
|
+
"sha256": "f34508b060197339fc73dd885565a24d037366c02b3f91b4db15431b42a5c573"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
]
|
package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md
RENAMED
|
@@ -52,6 +52,7 @@ A `stop` ends its transition, never approves delivery. `D` means the human disab
|
|
|
52
52
|
| Reason codes | Continuation |
|
|
53
53
|
| --- | --- |
|
|
54
54
|
| `captured_artifacts_unverifiable`, `captured_result_selection_unavailable`, `captured_verification_evidence_invalid`, `final_verification_retry_unavailable`, `missing_authority_binding`, `corrupted_or_unverifiable_authority`, `manual_intervention_required`, `native_stop_required` | Terminal: the maintainer inspects authority/lineage, or `D`. |
|
|
55
|
+
| `correction_request_unavailable` | Valid authority cannot build a correction request (invalid frozen budget or non-actionable finding). If eligible, the stop's `continuation` names the manual release command; obtain its binding template and explicit maintainer authorization, never invent authorization or abandon automatically. Release neither corrects nor approves the lineage; its forecast remains terminal. Without a continuation, stop and report the defect with the lineage. |
|
|
55
56
|
| `empty_base_diff_bootstrap_required` | Terminal: authorized empty-root bootstrap for a new target, or `D`. |
|
|
56
57
|
| `lens_context_budget_exceeded` | Terminal: reduce the candidate scope and start a new transaction, or `D`. |
|
|
57
58
|
| `correction_context_budget_exceeded` | Terminal: this authority has to be released rather than left in place, and invalidation refuses here. The maintainer runs the release command the stop's `continuation` names, exactly as printed; it is the preparatory step its `detail` describes, and its refusal prints the binding the full release needs. A stop with no `continuation` means the authority is not releasable in its current state: the maintainer inspects it, or `D`. Then review as smaller candidates, or `D`. |
|