gentle-pi 4.7.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 +55 -44
- package/assets/agents/gentle-ai-explore.md +3 -3
- package/assets/agents/gentle-ai-verify.md +20 -6
- package/assets/agents/gentle-ai-worker.md +6 -6
- package/assets/agents/jd-judge-a.md +1 -3
- package/assets/agents/jd-judge-b.md +1 -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 +746 -15
- package/assets/design-canvas/canvas.js +2 -1506
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +5 -1
- package/assets/migrations/agent-body-history.json +24 -0
- package/assets/orchestrator-delegation-reference.md +8 -14
- package/assets/orchestrator-delegation.md +4 -4
- package/assets/orchestrator-full-delegation-card.md +4 -5
- package/assets/orchestrator-full-delegation.md +8 -8
- package/assets/orchestrator-memory.md +2 -2
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +13 -12
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +10 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +18 -22
- package/bin/gentle-shell.mjs +128 -9
- 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/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +14 -6
- package/docs/delegated-verification.md +18 -2
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +26 -0
- package/docs/gentle-shell.md +39 -16
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +9 -1
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +76 -24
- package/docs/review-coordinator.md +29 -9
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/work-continuity.md +11 -1
- package/extensions/ask-user-question.ts +2 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/gentle-agents.ts +234 -33
- package/extensions/gentle-ai.ts +576 -135
- 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 +105 -52
- package/extensions/gentle-todo.ts +48 -25
- package/extensions/skill-registry.ts +248 -223
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +47 -6
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +8 -2
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +91 -6
- package/lib/agents-session-transport.ts +17 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +184 -31
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- 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 +188 -13
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +201 -14
- package/lib/gentle-shell-bundled.ts +100 -9
- package/lib/hidden-tools.ts +35 -0
- package/lib/inprocess-reviewer.ts +96 -12
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +9 -0
- package/lib/nan-provider.ts +42 -28
- package/lib/native-review-cli.ts +79 -4
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/reply-language-anchor.ts +27 -2
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +17 -0
- package/lib/review-coordinator.ts +252 -8
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-host-relay.ts +5 -1
- package/lib/review-integration-v2.ts +56 -3
- package/lib/reviewer-stream.ts +87 -0
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +6 -1
- package/package.json +2 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-shell-bundled.mjs +100 -9
- package/runtime/native-review-cli.mjs +79 -4
- package/runtime/review-integration-v2.mjs +56 -3
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +4 -0
- package/scripts/build-runtime-modules.mjs +1 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/gentle-ai-proxy.mjs +1 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +28 -17
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-server.mjs +38 -9
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +40 -19
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +6 -6
- package/skills/gentle-ai/SKILL.md +5 -5
- 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 -13
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +5 -5
- package/tests/agent-prompt-diet-contract.test.ts +101 -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 +10 -1
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner.test.ts +37 -1
- 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 +10 -2
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-question.test.ts +2 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/bounded-stop-contract.test.ts +9 -1
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bundled-install.test.ts +1 -1
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/delegate-for-reason-contract.test.ts +30 -8
- 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 -878
- 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/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/engram-safety.test.ts +111 -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 +20 -29
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/full-delegation-closure.test.ts +29 -0
- package/tests/gentle-agents.test.ts +329 -4
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-installer.test.ts +52 -51
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +121 -6
- package/tests/gentle-design.test.ts +365 -1
- package/tests/gentle-shell-bundled.test.ts +91 -5
- package/tests/gentle-shell-launcher.test.ts +1 -1
- package/tests/gentle-shell.test.ts +118 -87
- package/tests/gentle-todo.test.ts +32 -9
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/independent-recovery-delivery.test.ts +19 -5
- package/tests/inprocess-reviewer.test.ts +73 -0
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +114 -13
- package/tests/installer-preflight.test.ts +49 -1
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-server.test.ts +203 -4
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- 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/model-fallback-policy.test.ts +26 -7
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-review-capability-contract.test.ts +11 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- 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 +11 -3
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +30 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +2 -1
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-prompt-budget.test.ts +11 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +2 -1
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +11 -10
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +200 -30
- 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 +17 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- 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/provider-defect-handoff.test.ts +9 -2
- package/tests/rdd-aware-verification-contract.test.ts +1 -1
- package/tests/rdd-status-line.test.ts +94 -1
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +17 -1
- 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 +79 -1
- package/tests/review-candidate-view.test.ts +65 -0
- package/tests/review-continuation-registry.test.ts +31 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller.test.ts +2 -1
- 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.test.ts +271 -4
- 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-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-json-arguments.test.ts +41 -2
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +30 -1
- 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-relay-transport-agent.test.ts +28 -1
- package/tests/review-reviewer-evidence.test.ts +41 -1
- package/tests/review-risk-assessment.test.ts +52 -5
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +32 -2
- package/tests/review-tool-prose-budget.test.ts +1 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/shell-prompt.test.ts +17 -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 +929 -306
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +212 -17
- package/tests/task-size-routing-contract.test.ts +42 -11
- 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-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +87 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +54 -11
- 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 +184 -0
- package/tests/yolo-mode.test.ts +39 -0
- 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,87 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import type { AssistantMessage, AssistantMessageEvent } from "@earendil-works/pi-ai";
|
|
3
|
+
|
|
4
|
+
export interface ReviewerStream {
|
|
5
|
+
result(): Promise<AssistantMessage>;
|
|
6
|
+
[Symbol.asyncIterator]?(): AsyncIterator<AssistantMessageEvent>;
|
|
7
|
+
}
|
|
8
|
+
export interface ReviewerProgress {
|
|
9
|
+
readonly routingKey: string;
|
|
10
|
+
readonly phase: "waiting-for-output" | "streaming" | "completion-unobserved";
|
|
11
|
+
readonly elapsedMs: number;
|
|
12
|
+
}
|
|
13
|
+
export type ReviewerProgressObserver = (progress: ReviewerProgress) => void | Promise<void>;
|
|
14
|
+
const observers = new AsyncLocalStorage<ReviewerProgressObserver>();
|
|
15
|
+
export function withReviewerProgress<T>(observer: ReviewerProgressObserver, run: () => T): T { return observers.run(observer, run); }
|
|
16
|
+
export function publishReviewerProgress(progress: ReviewerProgress): void { notify(observers.getStore(), progress); }
|
|
17
|
+
function notify(observer: ReviewerProgressObserver | undefined, progress: ReviewerProgress): void {
|
|
18
|
+
try { void Promise.resolve(observer?.(progress)).catch(() => {}); } catch { /* Progress never changes a review outcome. */ }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function reviewerStreamLimits(environment: NodeJS.ProcessEnv): { firstOutputTimeoutMs: number; idleTimeoutMs: number } {
|
|
22
|
+
const bound = (name: string) => {
|
|
23
|
+
const value = environment[name];
|
|
24
|
+
const number = value !== undefined && /^[1-9]\d*$/.test(value) ? Number(value) : NaN;
|
|
25
|
+
return Number.isSafeInteger(number) && number <= 2_147_483_647 ? number : 120_000;
|
|
26
|
+
};
|
|
27
|
+
return { firstOutputTimeoutMs: bound("GENTLE_PI_REVIEW_RELAY_FIRST_OUTPUT_TIMEOUT_MS"), idleTimeoutMs: bound("GENTLE_PI_REVIEW_RELAY_IDLE_TIMEOUT_MS") };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Observe content activity without retaining provider text or changing the completion. */
|
|
31
|
+
export async function readReviewerStream(stream: ReviewerStream, options: {
|
|
32
|
+
routingKey: string; firstOutputTimeoutMs?: number; idleTimeoutMs?: number;
|
|
33
|
+
wait<T>(start: () => Promise<T>): Promise<T>;
|
|
34
|
+
timeout(phase: "first-output" | "stream-idle", limitMs: number): void;
|
|
35
|
+
onProgress?: ReviewerProgressObserver;
|
|
36
|
+
}): Promise<AssistantMessage> {
|
|
37
|
+
const began = performance.now();
|
|
38
|
+
const iterator = stream[Symbol.asyncIterator]?.();
|
|
39
|
+
let active = false, disposed = false;
|
|
40
|
+
let endsAt = Infinity, limitMs = 120_000;
|
|
41
|
+
let timeoutPhase: "first-output" | "stream-idle" = "first-output";
|
|
42
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
43
|
+
const report = () => notify(options.onProgress, { routingKey: options.routingKey,
|
|
44
|
+
phase: iterator === undefined ? "completion-unobserved" : active ? "streaming" : "waiting-for-output", elapsedMs: Math.max(0, performance.now() - began) });
|
|
45
|
+
const expired = () => {
|
|
46
|
+
if (performance.now() < endsAt) return false;
|
|
47
|
+
options.timeout(timeoutPhase, limitMs); return true;
|
|
48
|
+
};
|
|
49
|
+
const check = () => {
|
|
50
|
+
if (!expired()) timer = setTimeout(check, Math.max(1, Math.ceil(endsAt - performance.now())));
|
|
51
|
+
};
|
|
52
|
+
const arm = () => {
|
|
53
|
+
clearTimeout(timer);
|
|
54
|
+
timeoutPhase = active ? "stream-idle" : "first-output";
|
|
55
|
+
const limit = (active ? options.idleTimeoutMs : options.firstOutputTimeoutMs) ?? 120_000;
|
|
56
|
+
if (!Number.isSafeInteger(limit) || limit <= 0 || limit > 2_147_483_647) throw new RangeError("Reviewer stream limits must be positive timer-safe integers.");
|
|
57
|
+
limitMs = limit; endsAt = performance.now() + limit;
|
|
58
|
+
timer = setTimeout(check, limit);
|
|
59
|
+
};
|
|
60
|
+
const drain = async () => {
|
|
61
|
+
if (iterator === undefined) return;
|
|
62
|
+
arm();
|
|
63
|
+
while (!disposed) {
|
|
64
|
+
const next = await options.wait(() => Promise.resolve(iterator.next()));
|
|
65
|
+
if (expired()) return;
|
|
66
|
+
if (next.done || disposed) return;
|
|
67
|
+
const event = next.value;
|
|
68
|
+
if ((event.type === "text_delta" || event.type === "thinking_delta" || event.type === "toolcall_delta") && event.delta.length > 0) {
|
|
69
|
+
const first = !active; active = true; arm(); if (first) report();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const heartbeat = setInterval(report, 5_000);
|
|
74
|
+
try {
|
|
75
|
+
const observed = drain();
|
|
76
|
+
report();
|
|
77
|
+
const [message] = await Promise.all([options.wait(() => stream.result()), observed]);
|
|
78
|
+
expired(); // Provider microtasks may resolve before an overdue timer is dispatched.
|
|
79
|
+
return message;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
expired(); // A provider rejection must retain the same deadline precedence.
|
|
82
|
+
throw error;
|
|
83
|
+
} finally {
|
|
84
|
+
disposed = true; clearTimeout(timer); clearInterval(heartbeat);
|
|
85
|
+
try { void Promise.resolve(iterator?.return?.()).catch(() => {}); } catch { /* Never wait for provider cleanup. */ }
|
|
86
|
+
}
|
|
87
|
+
}
|
package/lib/shell-prompt.ts
CHANGED
|
@@ -24,13 +24,26 @@ const PETAL_TONE = {
|
|
|
24
24
|
|
|
25
25
|
export type PetalTone = (typeof PETAL_TONE)[keyof typeof PETAL_TONE];
|
|
26
26
|
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
27
|
+
// Working-animation cadence: the scanner phase derives from elapsed time
|
|
28
|
+
// (workingTick), not render count — streaming repaints arrive in bursts and
|
|
29
|
+
// silent tool runs barely repaint, so a render-driven wave strobes or freezes.
|
|
30
|
+
// The pulse timer only keeps repaints flowing: SHELL_PULSE_MS under quality,
|
|
31
|
+
// the coarse watchdog window under potato (no timer; repaints that happen
|
|
32
|
+
// anyway still show the current coarse frame).
|
|
30
33
|
export const SHELL_PULSE_WATCHDOG_MS = 1000;
|
|
34
|
+
export const SHELL_PULSE_MS = 80;
|
|
31
35
|
export const SHELL_SCANNER_STEPS = 15;
|
|
32
36
|
const SCANNER_ENTRY_OFFSET = 3;
|
|
33
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Animation phase after `now` milliseconds of working time: one wave step per
|
|
40
|
+
* `unitMs` pulse window, so two repaints inside one window paint the identical
|
|
41
|
+
* frame and each window advances the wave exactly one step.
|
|
42
|
+
*/
|
|
43
|
+
export function workingTick(now: number, unitMs = SHELL_PULSE_MS): number {
|
|
44
|
+
return Math.floor(now / Math.max(1, unitMs));
|
|
45
|
+
}
|
|
46
|
+
|
|
34
47
|
/** Banner-style reflected-light wave across text; foreground only. */
|
|
35
48
|
export function scanWorkingText(text: string, tick: number, fg: (role: string, text: string) => string): string {
|
|
36
49
|
const phase = ((Math.floor(tick) % SHELL_SCANNER_STEPS) + SHELL_SCANNER_STEPS) % SHELL_SCANNER_STEPS;
|
package/lib/shell-usage.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
2
2
|
import { parseModelRef } from "./agents-config.ts";
|
|
3
|
+
import { NAN_CHAT_MODEL_IDS } from "./nan-provider.ts";
|
|
3
4
|
import { paintGauge, type GaugePaint } from "./shell-gauge.ts";
|
|
4
5
|
|
|
5
6
|
// Gentle Shell subscription usage: the rate-limit windows each connected
|
|
@@ -132,6 +133,9 @@ const ACTIVE_MARK = "✿";
|
|
|
132
133
|
// and answered nothing. Generic on purpose: it names no endpoint, key, or
|
|
133
134
|
// account detail, exactly like the other notes here.
|
|
134
135
|
export const USAGE_FETCH_FAILED_NOTE = "fetch failed · r to retry";
|
|
136
|
+
// NaN bills from a shared credit pool its API keys cannot read; the quota
|
|
137
|
+
// endpoint only reports legacy per-model token caps, so the panel says so.
|
|
138
|
+
export const NAN_QUOTA_NOTE = "per-model token quota · not your credit balance";
|
|
135
139
|
|
|
136
140
|
export interface ActiveProvider {
|
|
137
141
|
provider: string;
|
|
@@ -388,6 +392,8 @@ export function parseNanQuota(payload: unknown, now: number): ProviderUsage {
|
|
|
388
392
|
if (!entry || typeof entry !== "object") continue;
|
|
389
393
|
const model = entry as RawNanModel;
|
|
390
394
|
if (typeof model.model !== "string" || model.model.length === 0) continue;
|
|
395
|
+
// The payload still lists retired models; only the maintained catalog is shown.
|
|
396
|
+
if (!NAN_CHAT_MODEL_IDS.has(model.model)) continue;
|
|
391
397
|
const allowance = nanEffectiveAllowance(model);
|
|
392
398
|
// A model that reports no allowance is not drift — the dashboard draws
|
|
393
399
|
// nothing for it either, and the live payload carries such entries. A metered
|
|
@@ -484,6 +490,8 @@ export function groupUsageLimits(limits: readonly UsageLimit[]): UsageLimit[] {
|
|
|
484
490
|
// The bar follows the model the session is using: exact allowance, then its
|
|
485
491
|
// family, then the account total, then the first limit (which is what every
|
|
486
492
|
// provider without raw numbers keeps using, and what a missing model keeps).
|
|
493
|
+
// NaN stops after the family: its caps are per-model token quota, and a sum of
|
|
494
|
+
// them would read as an account balance it is not.
|
|
487
495
|
export function selectUsageLimit(usage: ProviderUsage, activeModelId?: string): UsageLimit | undefined {
|
|
488
496
|
if (!activeModelId) return usage.limits[0];
|
|
489
497
|
const exact = usage.limits.find((limit) => limit.name === activeModelId);
|
|
@@ -498,6 +506,7 @@ export function selectUsageLimit(usage: ProviderUsage, activeModelId?: string):
|
|
|
498
506
|
const total = allowanceTotal(`${family}${GROUP_SUFFIX}`, members);
|
|
499
507
|
if (total) return total;
|
|
500
508
|
}
|
|
509
|
+
if (usage.provider === NAN_PROVIDER) return undefined;
|
|
501
510
|
const account = allowanceTotal(`${usage.provider}${GROUP_SUFFIX}`, usage.limits);
|
|
502
511
|
if (account) return account;
|
|
503
512
|
}
|
|
@@ -611,6 +620,7 @@ export function renderUsagePanel(usages: ProviderUsage[], theme: UsageTheme, wid
|
|
|
611
620
|
const tail = reset.length > 0 ? ` ${theme.fg(ROLE.SEPARATOR, "·")} ${theme.fg(ROLE.RESET, reset)}` : "";
|
|
612
621
|
lines.push(` ${theme.fg(ROLE.LABEL, row.name.padEnd(nameWidth))} ${paintMeter(row.window.usedPercent, PANEL_METER_CELLS, theme, paint)} ${theme.fg(ROLE.PERCENT, percent)}${tail}`);
|
|
613
622
|
}
|
|
623
|
+
if (usage.provider === NAN_PROVIDER) lines.push(` ${theme.fg(ROLE.RESET, NAN_QUOTA_NOTE)}`);
|
|
614
624
|
// A failure after a good snapshot never hides either fact: the last good
|
|
615
625
|
// snapshot stays on its rows and the failed refresh says so beside it.
|
|
616
626
|
if (scope?.failed.has(row.provider)) lines.push(` ${theme.fg(ROLE.RESET, USAGE_FETCH_FAILED_NOTE)}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CURSOR_MARKER, Editor, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
|
|
4
|
-
// Private shape audited against @earendil-works/pi-tui 0.99.1, 0.99.2, 1.0.0, 1.1.0, 1.2.0, 1.3.0 and 1.
|
|
4
|
+
// Private shape audited against @earendil-works/pi-tui 0.99.1, 0.99.2, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.5.1 and 1.5.2:
|
|
5
5
|
// editor.js state/pastes/history, sticky cursor reset, layoutText/render geometry,
|
|
6
6
|
// autocomplete cancellation and { state, pastes, pasteCounter } undo restoration;
|
|
7
7
|
// undo-stack.js clone-on-push/pop snapshots. The two 0.99 releases ship identical
|
|
@@ -23,6 +23,13 @@ import { createRequire } from "node:module";
|
|
|
23
23
|
// matches tui.select.pageUp/pageDown in the autocomplete menu, and keys.js adds Kitty
|
|
24
24
|
// F1-F12 functional-key mappings plus the Kitty functional PUA range filter. State,
|
|
25
25
|
// undo, paste, layout and autocomplete contracts remain unchanged.
|
|
26
|
+
// 1.5.1 keeps undo-stack.js, keys.js, editor-component.js and coding-agent's
|
|
27
|
+
// custom-editor.js byte-identical to 1.5.0; editor.js changes one line (a removed
|
|
28
|
+
// paste marker's renumbered neighbors no longer gain an "undefined" suffix when they
|
|
29
|
+
// have no size suffix); tui.js strips every cursor marker from terminal output, not
|
|
30
|
+
// only the first; utils.js stops carrying APC cursor markers into a column slice.
|
|
31
|
+
// 1.5.2 ships the same dist as 1.5.1 (only package.json differs). State, undo,
|
|
32
|
+
// paste registry, layout, render and autocomplete contracts remain unchanged.
|
|
26
33
|
// Never silently adapt another build: undo also owns the paste registry.
|
|
27
34
|
interface Position { line: number; col: number }
|
|
28
35
|
interface State { lines: string[]; cursorLine: number; cursorCol: number }
|
|
@@ -63,7 +70,7 @@ interface PrivateEditor {
|
|
|
63
70
|
|
|
64
71
|
// The single audited-release source for the adapter and Gentle Shell's runtime
|
|
65
72
|
// identity gates. Add a release only after re-auditing the files named above.
|
|
66
|
-
export const AUDITED_PI_EDITOR_VERSIONS = Object.freeze(["0.99.1", "0.99.2", "1.0.0", "1.1.0", "1.2.0", "1.3.0", "1.4.0", "1.5.0"] as const);
|
|
73
|
+
export const AUDITED_PI_EDITOR_VERSIONS = Object.freeze(["0.99.1", "0.99.2", "1.0.0", "1.1.0", "1.2.0", "1.3.0", "1.4.0", "1.5.0", "1.5.1", "1.5.2"] as const);
|
|
67
74
|
export type AuditedPiEditorVersion = (typeof AUDITED_PI_EDITOR_VERSIONS)[number];
|
|
68
75
|
|
|
69
76
|
export function isAuditedPiEditorVersion(version: unknown): version is AuditedPiEditorVersion {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// cost-speed P6 (R1): the tool calls of the assistant message that issued one tool call, so writer admission can
|
|
2
|
+
// see the launches made together with it. Pi persists an assistant message on `message_end`, before it prepares
|
|
3
|
+
// any of its tool calls (pi-agent-core agent-loop: `message_end` is awaited, then `executeToolCalls`; the parallel
|
|
4
|
+
// path runs every call's `tool_call` hook before executing any, and appends tool results only after all of them
|
|
5
|
+
// finish). At `tool_call` the message is therefore the nearest assistant entry of the session branch.
|
|
6
|
+
|
|
7
|
+
export interface MessageToolCall {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly arguments: unknown;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface BranchEntry {
|
|
13
|
+
readonly type?: unknown;
|
|
14
|
+
readonly parentId?: unknown;
|
|
15
|
+
readonly message?: { readonly role?: unknown; readonly content?: unknown; readonly toolCallId?: unknown };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SessionBranchReader {
|
|
19
|
+
getLeafEntry(): BranchEntry | undefined;
|
|
20
|
+
getEntry(id: string): BranchEntry | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Tool results and extension entries of the same turn may follow the message; nothing else lies between.
|
|
24
|
+
const MAX_ENTRIES_BACK = 64;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The tool calls of the nearest assistant message on the branch, when that message issued `toolCallId`; otherwise
|
|
28
|
+
* undefined. A call nested inside another tool (codemode, `parentToolCallId`) is not in the message, so it never
|
|
29
|
+
* gets a batch. Providers may repeat call ids across messages, so a message whose call with this id already has its
|
|
30
|
+
* tool result behind it on the branch is an earlier message, never the one executing: no batch (fail closed). Only
|
|
31
|
+
* this id is checked: in Pi's sequential path earlier calls of the same message already have their results.
|
|
32
|
+
*/
|
|
33
|
+
export function sameMessageToolCalls(session: SessionBranchReader | undefined, toolCallId: unknown): MessageToolCall[] | undefined {
|
|
34
|
+
if (!session || typeof toolCallId !== "string" || !toolCallId) return undefined;
|
|
35
|
+
try {
|
|
36
|
+
let entry = session.getLeafEntry();
|
|
37
|
+
let answered = false;
|
|
38
|
+
for (let steps = 0; entry && steps < MAX_ENTRIES_BACK; steps++) {
|
|
39
|
+
// Pi persists a result as a `message` entry with `role: "toolResult"` and the call's `toolCallId`
|
|
40
|
+
// (pi-agent-core agent-loop `createToolResultMessage`).
|
|
41
|
+
if (entry.type === "message" && entry.message?.role === "toolResult" && entry.message.toolCallId === toolCallId) answered = true;
|
|
42
|
+
if (entry.type === "message" && entry.message?.role === "assistant") {
|
|
43
|
+
if (answered) return undefined;
|
|
44
|
+
const content = Array.isArray(entry.message.content) ? entry.message.content : [];
|
|
45
|
+
const calls = content.filter((part): part is { type: "toolCall"; id: unknown; name: unknown; arguments: unknown } => !!part && typeof part === "object" && (part as { type?: unknown }).type === "toolCall");
|
|
46
|
+
if (!calls.some(call => call.id === toolCallId)) return undefined;
|
|
47
|
+
return calls.map(call => ({ name: String(call.name), arguments: call.arguments }));
|
|
48
|
+
}
|
|
49
|
+
entry = typeof entry.parentId === "string" ? session.getEntry(entry.parentId) : undefined;
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
// A session that cannot be read gives no batch: the lone-writer rule applies.
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
@@ -5,6 +5,7 @@ import { appendSystemPromptOnce, type AppendableSystemPromptOptions } from "./ap
|
|
|
5
5
|
import { sameReviewSessionIdentity, resolveCanonicalGitRepositoryIdentity, type ReviewSessionIdentity } from "./review-session-standing-permission.ts";
|
|
6
6
|
import { realpath } from "node:fs/promises";
|
|
7
7
|
import { gentlePiConfigHome } from "./agent-home.ts";
|
|
8
|
+
import { isInteractiveMode } from "./rpc-host.ts";
|
|
8
9
|
import { isPermissionMode, resolvePermissionModePolicy, writePermissionModePolicy, type PermissionMode } from "./permission-mode-policy.ts";
|
|
9
10
|
export type { PermissionMode } from "./permission-mode-policy.ts";
|
|
10
11
|
export const MODE_STATUS_KEY = "gentle:mode";
|
|
@@ -163,10 +164,14 @@ export function registerYoloSessionPolicy(pi: ExtensionAPI, env: NodeJS.ProcessE
|
|
|
163
164
|
// Rendered strings last published for each context; identical repaints are skipped.
|
|
164
165
|
const published = new WeakMap<ExtensionContext, { yolo: string | undefined; modeText: string }>();
|
|
165
166
|
const primary = () => env.GENTLE_PI_AGENTS_CHILD !== "1";
|
|
167
|
+
// The TUI stays the standard interactive host. The Desktop app's own RPC
|
|
168
|
+
// process is the other one, and only when it sets the interactive-host marker:
|
|
169
|
+
// headless RPC children keep the marker stripped, so they stay closed exactly
|
|
170
|
+
// as before. This is the single host admission every mutation below reuses.
|
|
166
171
|
const interactive = (ctx: ExtensionContext): boolean => {
|
|
167
172
|
if (!primary() || !ctx.hasUI) return false;
|
|
168
173
|
const mode = (ctx as ExtensionContext & { mode?: string }).mode;
|
|
169
|
-
if (mode !== undefined) return mode
|
|
174
|
+
if (mode !== undefined) return isInteractiveMode(mode, env);
|
|
170
175
|
try { return (ctx.ui.getAllThemes?.().length ?? 0) > 0; } catch { return false; }
|
|
171
176
|
};
|
|
172
177
|
const session = (ctx: ExtensionContext): { manager: ModeIdentity["manager"]; id: string } | undefined => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gentle-pi",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "Turn Pi into el Gentleman: an ODD development harness with focused subagents, configured TDD evidence, native review, and skill discovery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"typescript": "^5.9.3"
|
|
100
100
|
},
|
|
101
101
|
"engines": {
|
|
102
|
-
"node": "
|
|
102
|
+
"node": "^22.19.0 || >=23.6.0"
|
|
103
103
|
},
|
|
104
104
|
"packageManager": "pnpm@11.1.1"
|
|
105
105
|
}
|
|
@@ -4,16 +4,7 @@ argument-hint: "<skill idea or name>"
|
|
|
4
4
|
---
|
|
5
5
|
Create or update an LLM-first skill for: $ARGUMENTS
|
|
6
6
|
|
|
7
|
-
Use the `gentle-ai-skill-creator` skill if it is available. If the skill is not auto-loaded, read `skills/skill-creator/SKILL.md` and `docs/skill-style-guide.md` when present before editing.
|
|
8
|
-
|
|
9
|
-
## Process
|
|
10
|
-
|
|
11
|
-
1. Clarify the reusable behavior, target runtime, trigger phrases, and non-goals if they are not obvious.
|
|
12
|
-
2. Inspect existing skills first; update an existing skill instead of creating a duplicate.
|
|
13
|
-
3. Create or update `skills/{kebab-name}/SKILL.md` with valid one-line frontmatter description and concise runtime instructions.
|
|
14
|
-
4. Put templates, schemas, or examples under `assets/`; put longer supporting docs under `references/`.
|
|
15
|
-
5. If the skill is part of `gentle-pi`, update `scripts/verify-package-files.mjs`.
|
|
16
|
-
6. Refresh the registry with `/skill-registry:refresh` when available, or tell the user to refresh/reload.
|
|
7
|
+
Use the `gentle-ai-skill-creator` skill if it is available. If the skill is not auto-loaded, read `skills/skill-creator/SKILL.md` and `docs/skill-style-guide.md` when present before editing. If neither the skill nor that `SKILL.md` is available, say so and stop. Clarify the reusable behavior, target runtime, trigger phrases, and non-goals if they are not obvious, then follow the skill's Execution Steps.
|
|
17
8
|
|
|
18
9
|
## Report
|
|
19
10
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Generated by scripts/build-runtime-modules.mjs. Do not edit.
|
|
2
|
+
// The files the design canvas serves from assets/design-canvas/ under
|
|
3
|
+
// `assets/<name>`, and the package check requires in the tarball. The list is
|
|
4
|
+
// explicit on purpose: it is a security boundary, and inspector.js is also
|
|
5
|
+
// loaded inside the artboard sandbox. index.html is the page template, read by
|
|
6
|
+
// the server and never served as an asset.
|
|
7
|
+
|
|
8
|
+
/** Canvas asset file name to the Content-Type it is served with. */
|
|
9
|
+
export const DESIGN_CANVAS_ASSETS = Object.freeze({
|
|
10
|
+
"canvas.js": "text/javascript; charset=utf-8",
|
|
11
|
+
"canvas-boot.js": "text/javascript; charset=utf-8",
|
|
12
|
+
"canvas-store.js": "text/javascript; charset=utf-8",
|
|
13
|
+
"canvas-api.js": "text/javascript; charset=utf-8",
|
|
14
|
+
"canvas-ui.js": "text/javascript; charset=utf-8",
|
|
15
|
+
"canvas-view.js": "text/javascript; charset=utf-8",
|
|
16
|
+
"canvas-focus.js": "text/javascript; charset=utf-8",
|
|
17
|
+
"canvas-boards.js": "text/javascript; charset=utf-8",
|
|
18
|
+
"canvas-handoffs.js": "text/javascript; charset=utf-8",
|
|
19
|
+
"canvas-compare.js": "text/javascript; charset=utf-8",
|
|
20
|
+
"canvas-events.js": "text/javascript; charset=utf-8",
|
|
21
|
+
"canvas-comments.js": "text/javascript; charset=utf-8",
|
|
22
|
+
"canvas-popover.js": "text/javascript; charset=utf-8",
|
|
23
|
+
"canvas-messages.js": "text/javascript; charset=utf-8",
|
|
24
|
+
"canvas-menu.js": "text/javascript; charset=utf-8",
|
|
25
|
+
"canvas-rail.js": "text/javascript; charset=utf-8",
|
|
26
|
+
"canvas-sizes.js": "text/javascript; charset=utf-8",
|
|
27
|
+
"canvas-layout.js": "text/javascript; charset=utf-8",
|
|
28
|
+
"canvas-minimap.js": "text/javascript; charset=utf-8",
|
|
29
|
+
"canvas-export.js": "text/javascript; charset=utf-8",
|
|
30
|
+
"canvas-parts.js": "text/javascript; charset=utf-8",
|
|
31
|
+
"canvas-tokens.js": "text/javascript; charset=utf-8",
|
|
32
|
+
"canvas-checks.js": "text/javascript; charset=utf-8",
|
|
33
|
+
"canvas-i18n.js": "text/javascript; charset=utf-8",
|
|
34
|
+
"canvas-i18n-es.js": "text/javascript; charset=utf-8",
|
|
35
|
+
"canvas.css": "text/css; charset=utf-8",
|
|
36
|
+
"inspector.js": "text/javascript; charset=utf-8",
|
|
37
|
+
});
|
|
@@ -287,16 +287,50 @@ export const ENGRAM_COMPATIBILITY_MIN_VERSION = "3.4.0";
|
|
|
287
287
|
export function engramOutdatedServerNotice(version ) {
|
|
288
288
|
return `Engram memory disabled: the running Engram server reports version ${version}, which cannot prove store compatibility. Back up your Engram data, update that server to ${ENGRAM_COMPATIBILITY_MIN_VERSION} or later with the method you installed it with, and restart it; updating Shell alone does not replace a running server. Shell rechecks on every launch and remains usable without memory.`;
|
|
289
289
|
}
|
|
290
|
+
// A canonical numeric x.y.z (optionally v-prefixed, no leading zeros), split
|
|
291
|
+
// into numeric parts; undefined otherwise. The version comes from the server,
|
|
292
|
+
// so anything else is never echoed to the user.
|
|
293
|
+
function canonicalVersion(version ) {
|
|
294
|
+
const match = /^v?(0|[1-9]\d{0,3})\.(0|[1-9]\d{0,3})\.(0|[1-9]\d{0,3})$/.exec(version ?? "");
|
|
295
|
+
return match === null ? undefined : match.slice(1).map(Number);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// "older" or "same-or-newer" over canonical numeric parts, or undefined when
|
|
299
|
+
// the version itself is not canonical.
|
|
300
|
+
function compareVersion(version , minimum ) {
|
|
301
|
+
const parts = canonicalVersion(version);
|
|
302
|
+
if (parts === undefined) return undefined;
|
|
303
|
+
const base = canonicalVersion(minimum);
|
|
304
|
+
if (base === undefined) return undefined;
|
|
305
|
+
for (let i = 0; i < parts.length; i += 1) {
|
|
306
|
+
if (parts[i] !== base[i]) return parts[i] < base[i] ? "older" : "same-or-newer";
|
|
307
|
+
}
|
|
308
|
+
return "same-or-newer";
|
|
309
|
+
}
|
|
310
|
+
|
|
290
311
|
// A canonical numeric x.y.z (optionally v-prefixed, no leading zeros) older than
|
|
291
312
|
// the minimum. The version comes from the server, so anything else is never
|
|
292
313
|
// echoed to the user.
|
|
293
314
|
function outdatedServerVersion(version ) {
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
315
|
+
const parts = canonicalVersion(version);
|
|
316
|
+
if (parts === undefined) return undefined;
|
|
317
|
+
return compareVersion(version, ENGRAM_COMPATIBILITY_MIN_VERSION) === "older" ? parts.join(".") : undefined;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// The first release whose CLI runs the shared server's whole lifecycle as a
|
|
321
|
+
// pidfile-tracked daemon (`engram run -d` plus the `ps`, `stop`, `logs`,
|
|
322
|
+
// `restart` verbs; engram issues #2228 and #2346): a core older than this
|
|
323
|
+
// knows only `serve`, which no daemon verb can adopt.
|
|
324
|
+
export const ENGRAM_DAEMON_LIFECYCLE_MIN_VERSION = "3.7.0";
|
|
325
|
+
export function engramSupportsDaemonLifecycle(version ) {
|
|
326
|
+
return compareVersion(version, ENGRAM_DAEMON_LIFECYCLE_MIN_VERSION) === "same-or-newer";
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// The command line Shell starts the shared server with: daemon-lifecycle cores
|
|
330
|
+
// register with `run -d` so the standard verbs manage the server; older cores
|
|
331
|
+
// spawn only the legacy detached `serve`.
|
|
332
|
+
export function engramSpawnArgs(version ) {
|
|
333
|
+
return engramSupportsDaemonLifecycle(version) ? ["run", "-d"] : ["serve"];
|
|
300
334
|
}
|
|
301
335
|
// The default endpoint gentle-engram uses without ENGRAM_URL or ENGRAM_PORT.
|
|
302
336
|
export const ENGRAM_DEFAULT_PORT = 7437;
|
|
@@ -411,14 +445,71 @@ export function parseEngramProvenance(text )
|
|
|
411
445
|
}
|
|
412
446
|
|
|
413
447
|
// The bundled core's own schema (SQLite user_version), verified from the
|
|
414
|
-
// tagged sources v3.3.2, v3.4.0
|
|
415
|
-
//
|
|
416
|
-
|
|
448
|
+
// tagged sources v3.3.2, v3.4.0, v3.5.2 and the v3.7.0 and v3.7.2 trees:
|
|
449
|
+
// internal/store/store.go `const schemaVersion = 1`, and the released 3.7.2
|
|
450
|
+
// linux/darwin binaries stamp user_version 1 in an isolated store. A pin
|
|
451
|
+
// without a verified entry leaves the header check unavailable.
|
|
452
|
+
const BUNDLED_ENGRAM_SCHEMA = { "3.3.2": 1, "3.4.0": 1, "3.5.2": 1, "3.7.0": 1, "3.7.2": 1 };
|
|
417
453
|
|
|
418
454
|
export function bundledEngramSchema(coreVersion ) {
|
|
419
455
|
return Object.hasOwn(BUNDLED_ENGRAM_SCHEMA, coreVersion) ? BUNDLED_ENGRAM_SCHEMA[coreVersion] : undefined;
|
|
420
456
|
}
|
|
421
457
|
|
|
458
|
+
// Companion-vs-core contract gate (gentle-shell#3015): the runtime-contract
|
|
459
|
+
// digest each pinned core answers on GET /runtime-contract, read from the real
|
|
460
|
+
// release binaries during development; the 3.5.2 windows archive sha256 matched
|
|
461
|
+
// the retired 3.5.2 pin exactly. gentle-engram 0.8.0 requires the 3.7.2 digest:
|
|
462
|
+
// the released 3.7.2 binary and the published 0.8.0 companion both report
|
|
463
|
+
// contract_id engram.pi-http-runtime/v1, revision 1, with the same digest, and
|
|
464
|
+
// only that digest differs from 3.5.2. A pin without a verified entry leaves
|
|
465
|
+
// the gate unavailable, and the gate only ever warns (S3: "Instalar y avisar
|
|
466
|
+
// fuerte"), never blocks.
|
|
467
|
+
const BUNDLED_ENGRAM_CONTRACT = {
|
|
468
|
+
"3.5.2": "4bf32703e111162b24073d090bec1c15c9120708587000bf595a07264e768672",
|
|
469
|
+
"3.7.0": "0af9af176928e98562ab1396d3196efe582dd5d1c5d2c5f8f546ab4ed609810f",
|
|
470
|
+
"3.7.2": "0af9af176928e98562ab1396d3196efe582dd5d1c5d2c5f8f546ab4ed609810f",
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
export function bundledEngramContract(coreVersion ) {
|
|
474
|
+
return Object.hasOwn(BUNDLED_ENGRAM_CONTRACT, coreVersion) ? BUNDLED_ENGRAM_CONTRACT[coreVersion] : undefined;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// The runtime contract a gentle-engram companion ships (runtime-contract.json)
|
|
478
|
+
// and the running core answers on GET /runtime-contract. Only the exact
|
|
479
|
+
// contract id, an integer revision and a lowercase 64-hex digest count as
|
|
480
|
+
// evidence; anything else is no signal, never an error.
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
export function parseEngramRuntimeContract(payload ) {
|
|
484
|
+
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) return undefined;
|
|
485
|
+
const record = payload ;
|
|
486
|
+
const revision = record.revision;
|
|
487
|
+
if (record.contract_id !== "engram.pi-http-runtime/v1" || typeof revision !== "number" || !Number.isInteger(revision)) return undefined;
|
|
488
|
+
if (typeof record.digest !== "string" || !/^[0-9a-f]{64}$/.test(record.digest)) return undefined;
|
|
489
|
+
return { contract_id: "engram.pi-http-runtime/v1", revision, digest: record.digest };
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// The loud, warn-only mismatch notice (S3): Shell still installs and runs the
|
|
493
|
+
// pair, and the human decides whether to update the core or the companion.
|
|
494
|
+
// Silent when the digests are equal or either side is unknown — never a false
|
|
495
|
+
// alarm. `coreDigest` lets the launch path pass the digest the running server
|
|
496
|
+
// actually answered; the default is the pinned core's verified table entry.
|
|
497
|
+
// `coreLabel` names whoever answered, so a reused older server is never
|
|
498
|
+
// misattributed to the pinned version.
|
|
499
|
+
export function engramContractMismatchNotice(companionDigest , coreVersion , coreDigest = bundledEngramContract(coreVersion), coreLabel = `the Engram core ${coreVersion}`) {
|
|
500
|
+
if (companionDigest === undefined || coreDigest === undefined || !/^[0-9a-f]{64}$/.test(companionDigest) || companionDigest === coreDigest) return undefined;
|
|
501
|
+
return `Engram contract mismatch: the gentle-engram companion declares runtime-contract digest ${companionDigest}, while ${coreLabel} answers ${coreDigest}; memory may be unavailable until the pair matches. Update the core with a new Gentle Shell release, or update the companion.`;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// One bounded read-only GET /runtime-contract on the shared server (the same
|
|
505
|
+
// loopback rules as probeEngramEndpoint): the parsed digest, or undefined when
|
|
506
|
+
// the server does not answer with a well-formed contract.
|
|
507
|
+
export async function probeEngramRuntimeContract(input = {}) {
|
|
508
|
+
const answer = await localGet(input.port ?? ENGRAM_DEFAULT_PORT, "/runtime-contract", input.timeoutMs ?? 1000);
|
|
509
|
+
if (answer.kind !== "response" || answer.status !== 200) return undefined;
|
|
510
|
+
return parseEngramRuntimeContract(parseJson(answer.body))?.digest;
|
|
511
|
+
}
|
|
512
|
+
|
|
422
513
|
// SQLite's user_version from the raw database header (bytes 60-63), or
|
|
423
514
|
// undefined for anything that is not a well-formed rollback or WAL database.
|
|
424
515
|
export function sqliteHeaderUserVersion(header , size ) {
|
|
@@ -493,6 +493,45 @@ const NATIVE_REVIEW_UNKNOWN_UNACHIEVABLE_VERB_REFUSAL = /unknown review command
|
|
|
493
493
|
// flags with this exact typed preflight cause, before reading the repository.
|
|
494
494
|
const NATIVE_REVIEW_UNKNOWN_LENS_FLAG_CAUSE = /^flag provided but not defined: -lenses(?:-reason)?$/;
|
|
495
495
|
|
|
496
|
+
// A provider older than gentle-ai#6088 refuses the STATUS opt-in with this
|
|
497
|
+
// exact typed preflight cause, before reading the repository.
|
|
498
|
+
const NATIVE_REVIEW_UNKNOWN_NON_BLOCKING_FLAG_CAUSE = /^flag provided but not defined: -non-blocking-findings$/;
|
|
499
|
+
|
|
500
|
+
/** Reports a not-started STATUS refusal caused only by an unknown --non-blocking-findings flag. */
|
|
501
|
+
function isNativeReviewNonBlockingFindingsUnsupported(error ) {
|
|
502
|
+
if (!(error instanceof NativeReviewIntegrationError)) return false;
|
|
503
|
+
const failure = error.failureEnvelope;
|
|
504
|
+
return failure.code === "invalid_request" && failure.mutationOutcome === "not_started" &&
|
|
505
|
+
typeof failure.cause === "string" && NATIVE_REVIEW_UNKNOWN_NON_BLOCKING_FLAG_CAUSE.test(failure.cause);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// Provider binaries (executable path to its sha256) that refused
|
|
509
|
+
// --non-blocking-findings in this process. A replaced binary at the same path
|
|
510
|
+
// has another digest and is asked again. Never a capability claim.
|
|
511
|
+
const nonBlockingFindingsRefusals = new Map ();
|
|
512
|
+
|
|
513
|
+
function nonBlockingFindingsRefused(executable ) {
|
|
514
|
+
const digest = nonBlockingFindingsRefusals.get(executable);
|
|
515
|
+
if (digest === undefined) return false;
|
|
516
|
+
try {
|
|
517
|
+
return binaryDigest(executable) === digest;
|
|
518
|
+
} catch {
|
|
519
|
+
return false;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function nonBlockingExecutableDigest(executable ) {
|
|
524
|
+
try { return binaryDigest(executable); } catch { return undefined; }
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function rememberNonBlockingFindingsRefusal(executable , digest ) {
|
|
528
|
+
// An old in-flight refusal must neither label a replacement unsupported
|
|
529
|
+
// nor erase a newer request's cache entry when identity cannot be read.
|
|
530
|
+
if (digest !== undefined && nonBlockingExecutableDigest(executable) === digest) {
|
|
531
|
+
nonBlockingFindingsRefusals.set(executable, digest);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
496
535
|
/** Reports a not-started STATUS refusal caused only by an unknown --lenses flag. */
|
|
497
536
|
export function isNativeReviewLensSelectionUnsupported(error ) {
|
|
498
537
|
if (!(error instanceof NativeReviewIntegrationError)) return false;
|
|
@@ -592,6 +631,14 @@ export const NATIVE_REVIEW_CONSENT_ANSWER = { GRANTED: "granted", DECLINED: "dec
|
|
|
592
631
|
|
|
593
632
|
|
|
594
633
|
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
595
642
|
|
|
596
643
|
|
|
597
644
|
|
|
@@ -1123,6 +1170,16 @@ export const NATIVE_CLI_CONTRACTS = Object.freeze({
|
|
|
1123
1170
|
// 58450471280aeb357443d6a28c819132d8c8eb78dd25b12bac64296b2f8c27c2.
|
|
1124
1171
|
// No new negotiated capability identity is asserted.
|
|
1125
1172
|
"4.4.0": Object.freeze({ start: true, finalize: true, validate: true, bindSdd: true, status: true, inventory: true, reclaim: true, recover: true, abandon: true, quarantineLegacy: true, reconcileAuthority: true, repairLegacyAlias: true, mode: true, riskEvidence: false, hint: false, delivery: true }),
|
|
1173
|
+
// v4.5.0 repeats 4.4.0: the published binary still advertises
|
|
1174
|
+
// capabilities/v2.6 (protocol minor 6) under review-integration/v2, and the
|
|
1175
|
+
// provider contract moved from 1.4.0 to 1.5.0 additively (one stop reason,
|
|
1176
|
+
// no negotiated START/STATUS field), with published provider-contract tarball
|
|
1177
|
+
// SHA-256 08fdb65329b47a2cd2563edfa62b5781fd5ec7b0d1e8812e8e29a01a486da838.
|
|
1178
|
+
// Ground truth: `review capabilities --contract gentle-ai.review-integration/v2`
|
|
1179
|
+
// on the released darwin/arm64 v4.5.0 binary reports schema
|
|
1180
|
+
// gentle-ai.review-integration.capabilities/v2.6 with protocol minor 6.
|
|
1181
|
+
// No new negotiated capability identity is asserted.
|
|
1182
|
+
"4.5.0": Object.freeze({ start: true, finalize: true, validate: true, bindSdd: true, status: true, inventory: true, reclaim: true, recover: true, abandon: true, quarantineLegacy: true, reconcileAuthority: true, repairLegacyAlias: true, mode: true, riskEvidence: false, hint: false, delivery: true }),
|
|
1126
1183
|
});
|
|
1127
1184
|
|
|
1128
1185
|
|
|
@@ -2495,7 +2552,12 @@ export class NativeReviewCliV216 {
|
|
|
2495
2552
|
NATIVE_REQUEST_CONTEXT_UNSUPPORTED_MESSAGE, undefined, false);
|
|
2496
2553
|
}
|
|
2497
2554
|
}
|
|
2498
|
-
|
|
2555
|
+
// The opt-in rides only this client's own contracted STATUS, never a
|
|
2556
|
+
// provider-issued selection submission.
|
|
2557
|
+
const nonBlockingExecutable = request.nonBlockingFindings === true && submittedTokens === undefined
|
|
2558
|
+
? contextExecutable ?? measureStatusSync("resolution", () => this.executablePath(NATIVE_REVIEW_OPERATION.STATUS, false))
|
|
2559
|
+
: undefined;
|
|
2560
|
+
const statusArguments = (nonBlockingFindings ) => submittedTokens === undefined ? [
|
|
2499
2561
|
"review", "status", "--contract", REVIEW_INTEGRATION_CONTRACT, "--cwd", request.cwd,
|
|
2500
2562
|
"--projection", request.projection ?? "workspace",
|
|
2501
2563
|
...nativeUntrackedSelectionArguments(selection),
|
|
@@ -2504,11 +2566,24 @@ export class NativeReviewCliV216 {
|
|
|
2504
2566
|
...(request.agent === undefined ? [] : ["--agent", request.agent]),
|
|
2505
2567
|
...nativeLensSelectionArguments(request),
|
|
2506
2568
|
...requestContextArguments,
|
|
2569
|
+
...(nonBlockingFindings ? ["--non-blocking-findings"] : []),
|
|
2507
2570
|
"--next-transition",
|
|
2508
2571
|
] : ["review", "status", "--cwd", request.cwd, ...submittedTokens, ...forwardedBaseRef, ...forwardedLineage, ...nativeLensSelectionArguments(request), ...requestContextArguments];
|
|
2509
|
-
const
|
|
2510
|
-
|
|
2511
|
-
|
|
2572
|
+
const executable = nonBlockingExecutable ?? contextExecutable;
|
|
2573
|
+
const run = (nonBlockingFindings ) => executable === undefined
|
|
2574
|
+
? this.negotiated(NATIVE_REVIEW_OPERATION.STATUS, request.cwd, statusArguments(nonBlockingFindings), false, request.signal)
|
|
2575
|
+
: this.invoke(NATIVE_REVIEW_OPERATION.STATUS, request.cwd, statusArguments(nonBlockingFindings), false, request.signal, executable);
|
|
2576
|
+
const sendNonBlocking = nonBlockingExecutable !== undefined && !nonBlockingFindingsRefused(nonBlockingExecutable);
|
|
2577
|
+
const nonBlockingDigest = sendNonBlocking ? nonBlockingExecutableDigest(nonBlockingExecutable ) : undefined;
|
|
2578
|
+
let execution ;
|
|
2579
|
+
try {
|
|
2580
|
+
execution = await run(sendNonBlocking);
|
|
2581
|
+
} catch (error) {
|
|
2582
|
+
// Only the unknown-flag refusal falls back, once; every other failure is the caller's.
|
|
2583
|
+
if (!sendNonBlocking || !isNativeReviewNonBlockingFindingsUnsupported(error)) throw error;
|
|
2584
|
+
rememberNonBlockingFindingsRefusal(nonBlockingExecutable , nonBlockingDigest);
|
|
2585
|
+
execution = await run(false);
|
|
2586
|
+
}
|
|
2512
2587
|
measureStatusSync("decode", () => assertSupportedNextTransitionOperation(execution.body));
|
|
2513
2588
|
return decode(NATIVE_REVIEW_OPERATION.STATUS, false, () => decodeReviewStatusV3(execution.body));
|
|
2514
2589
|
}
|