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,165 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import test, { after } from "node:test";
|
|
6
|
+
import { NativeReviewCliV216, NativeReviewIntegrationError, type ExecFileAdapter } from "../lib/native-review-cli.ts";
|
|
7
|
+
|
|
8
|
+
// odd/tasks/review-one-call.md T11 (S5), L18: contracted STATUS asks for the
|
|
9
|
+
// non-blocking findings (gentle-ai#6088) only when the caller requests them; a
|
|
10
|
+
// provider that refuses the unknown flag is asked once more without it and is
|
|
11
|
+
// not sent the flag again while it stays the same binary.
|
|
12
|
+
|
|
13
|
+
const scratch = realpathSync(mkdtempSync(join(realpathSync(tmpdir()), "native-nbf-")));
|
|
14
|
+
after(() => rmSync(scratch, { recursive: true, force: true }));
|
|
15
|
+
let binaries = 0;
|
|
16
|
+
/** A package-local executable stand-in; only its path and bytes identify it. */
|
|
17
|
+
function binary(content = `fixture-${binaries}`): string {
|
|
18
|
+
const path = join(scratch, `gentle-ai-${binaries++}`);
|
|
19
|
+
writeFileSync(path, content);
|
|
20
|
+
return path;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const statusBody = JSON.parse(readFileSync(join(process.cwd(), "tests", "fixtures", "devbinary", "status-v5.captured.json"), "utf8"));
|
|
24
|
+
const refusal = (cause: string) => ({
|
|
25
|
+
schema: "gentle-ai.review-integration.failure/v2", contract: "gentle-ai.review-integration/v2", operation: "review.status", phase: "preflight",
|
|
26
|
+
code: "invalid_request", message: "The negotiated review request is invalid.", mutation_outcome: "not_started", authority_applicability: "not_evaluated",
|
|
27
|
+
retry_safe: true, replayability: "not_replayable", required_inputs: [], next_action: "correct_request", cause,
|
|
28
|
+
});
|
|
29
|
+
const UNKNOWN_FLAG = refusal("flag provided but not defined: -non-blocking-findings");
|
|
30
|
+
type Reply = { body: unknown; exitCode?: number };
|
|
31
|
+
function adapter(replies: Reply[]): { adapter: ExecFileAdapter; calls: { file: string; arguments: readonly string[] }[] } {
|
|
32
|
+
const calls: { file: string; arguments: readonly string[] }[] = [];
|
|
33
|
+
return { calls, adapter: async (request) => {
|
|
34
|
+
calls.push({ file: request.file, arguments: request.arguments });
|
|
35
|
+
const reply = replies.shift();
|
|
36
|
+
if (reply === undefined) throw new Error("unexpected native invocation");
|
|
37
|
+
const exitCode = reply.exitCode ?? 0;
|
|
38
|
+
return { stdout: JSON.stringify(reply.body), stderr: exitCode === 0 ? "" : "Error: The negotiated review request is invalid. [invalid_request]\n", exitCode, signal: null, timedOut: false, outputLimitExceeded: false };
|
|
39
|
+
} };
|
|
40
|
+
}
|
|
41
|
+
const base = ["review", "status", "--contract", "gentle-ai.review-integration/v2", "--cwd", "/repo", "--projection", "workspace", "--lineage", "review-status-fixture", "--agent", "pi"];
|
|
42
|
+
const request = { cwd: "/repo", lineageId: "review-status-fixture", agent: "pi" as const };
|
|
43
|
+
|
|
44
|
+
test("a contracted STATUS sends --non-blocking-findings only when the caller asks for it", async () => {
|
|
45
|
+
const queue = adapter([{ body: statusBody }, { body: statusBody }]);
|
|
46
|
+
const cli = new NativeReviewCliV216(queue.adapter, binary(), 30_000, 1024 * 1024);
|
|
47
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
48
|
+
await cli.targetStatus(request);
|
|
49
|
+
assert.deepEqual(queue.calls.map((call) => call.arguments), [[...base, "--non-blocking-findings", "--next-transition"], [...base, "--next-transition"]]);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("a provider that refuses the unknown flag is asked once more without it and is not sent it again while it is the same binary", async () => {
|
|
53
|
+
const executable = binary();
|
|
54
|
+
const queue = adapter([{ body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }, { body: statusBody }]);
|
|
55
|
+
const cli = new NativeReviewCliV216(queue.adapter, () => executable, 30_000, 1024 * 1024);
|
|
56
|
+
const first = await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
57
|
+
assert.equal(first.nextTransition?.kind, "collect", "the run ends as today");
|
|
58
|
+
assert.equal(Object.hasOwn(first, "nonBlockingFindings"), false);
|
|
59
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
60
|
+
assert.deepEqual(queue.calls.map((call) => call.arguments), [
|
|
61
|
+
[...base, "--non-blocking-findings", "--next-transition"],
|
|
62
|
+
[...base, "--next-transition"],
|
|
63
|
+
[...base, "--next-transition"],
|
|
64
|
+
]);
|
|
65
|
+
// A replaced binary at the same path is a different provider: asked again.
|
|
66
|
+
writeFileSync(executable, "a newer provider");
|
|
67
|
+
const renewed = adapter([{ body: statusBody }]);
|
|
68
|
+
const replaced = new NativeReviewCliV216(renewed.adapter, () => executable, 30_000, 1024 * 1024);
|
|
69
|
+
await replaced.targetStatus({ ...request, nonBlockingFindings: true });
|
|
70
|
+
assert.deepEqual(renewed.calls[0]!.arguments, [...base, "--non-blocking-findings", "--next-transition"]);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("the refusal is remembered per binary: another binary is still sent the flag", async () => {
|
|
74
|
+
const old = binary("old provider");
|
|
75
|
+
const current = binary("current provider");
|
|
76
|
+
let path = old;
|
|
77
|
+
const queue = adapter([{ body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }, { body: statusBody }]);
|
|
78
|
+
const cli = new NativeReviewCliV216(queue.adapter, () => path, 30_000, 1024 * 1024);
|
|
79
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
80
|
+
path = current;
|
|
81
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
82
|
+
assert.deepEqual(queue.calls.map((call) => [call.file, call.arguments.includes("--non-blocking-findings")]), [[old, true], [old, false], [current, true]]);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("any other STATUS failure is not retried and keeps its error", async () => {
|
|
86
|
+
for (const body of [refusal("flag provided but not defined: -lenses"), refusal("--non-blocking-findings requires --contract gentle-ai.review-integration/v2"), { ...UNKNOWN_FLAG, code: "authority_unavailable" }]) {
|
|
87
|
+
const queue = adapter([{ body, exitCode: 1 }]);
|
|
88
|
+
const cli = new NativeReviewCliV216(queue.adapter, binary(), 30_000, 1024 * 1024);
|
|
89
|
+
await assert.rejects(cli.targetStatus({ ...request, nonBlockingFindings: true }), (error: unknown) => error instanceof NativeReviewIntegrationError && error.failureEnvelope.cause === body.cause);
|
|
90
|
+
assert.equal(queue.calls.length, 1, String(body.cause));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("the flag rides only Gentle Shell's own contracted STATUS, never a provider-issued selection submission", async () => {
|
|
95
|
+
const queue = adapter([{ body: statusBody }]);
|
|
96
|
+
const cli = new NativeReviewCliV216(queue.adapter, binary(), 30_000, 1024 * 1024);
|
|
97
|
+
await cli.targetStatus({ cwd: "/repo", nonBlockingFindings: true, intendedUntrackedSelection: {
|
|
98
|
+
argumentTokens: ["--contract=gentle-ai.review-integration/v2", "--next-transition=true", "--agent=pi", "--projection=workspace", "--intended-untracked-selection={{value}}"], value: "{}" } } as never);
|
|
99
|
+
assert.equal(queue.calls[0]!.arguments.includes("--non-blocking-findings"), false);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Verifier regressions (odd/tasks/review-one-call.md L19).
|
|
103
|
+
test("two concurrent first STATUS calls each pay the refusal once; later calls never resend the flag", async () => {
|
|
104
|
+
const executable = binary("concurrent provider");
|
|
105
|
+
const calls: boolean[] = [];
|
|
106
|
+
const adapterFn: ExecFileAdapter = async (request) => {
|
|
107
|
+
const flagged = request.arguments.includes("--non-blocking-findings");
|
|
108
|
+
calls.push(flagged);
|
|
109
|
+
await new Promise((resolve) => setTimeout(resolve, 5));
|
|
110
|
+
const refused = flagged;
|
|
111
|
+
return { stdout: JSON.stringify(refused ? UNKNOWN_FLAG : statusBody), stderr: refused ? "Error: The negotiated review request is invalid. [invalid_request]\n" : "", exitCode: refused ? 1 : 0, signal: null, timedOut: false, outputLimitExceeded: false };
|
|
112
|
+
};
|
|
113
|
+
const cli = new NativeReviewCliV216(adapterFn, () => executable, 30_000, 1024 * 1024);
|
|
114
|
+
await Promise.all([cli.targetStatus({ ...request, nonBlockingFindings: true }), cli.targetStatus({ ...request, nonBlockingFindings: true })]);
|
|
115
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
116
|
+
assert.deepEqual(calls, [true, true, false, false, false]);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test("look-alike refusals are not retried", async () => {
|
|
120
|
+
for (const body of [
|
|
121
|
+
refusal("x flag provided but not defined: -non-blocking-findings"),
|
|
122
|
+
refusal("flag provided but not defined: -non-blocking-findings-v2"),
|
|
123
|
+
{ ...UNKNOWN_FLAG, mutation_outcome: "unknown" },
|
|
124
|
+
]) {
|
|
125
|
+
const queue = adapter([{ body, exitCode: 1 }]);
|
|
126
|
+
const cli = new NativeReviewCliV216(queue.adapter, binary(), 30_000, 1024 * 1024);
|
|
127
|
+
await assert.rejects(cli.targetStatus({ ...request, nonBlockingFindings: true }));
|
|
128
|
+
assert.equal(queue.calls.length, 1, JSON.stringify(body).slice(0, 200));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test("an in-flight old refusal does not suppress the flag for a replacement executable", async () => {
|
|
133
|
+
const executable = binary("old in-flight provider");
|
|
134
|
+
let enter!: () => void;
|
|
135
|
+
let release!: () => void;
|
|
136
|
+
const entered = new Promise<void>((resolve) => { enter = resolve; });
|
|
137
|
+
const held = new Promise<void>((resolve) => { release = resolve; });
|
|
138
|
+
const queue = adapter([{ body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }, { body: statusBody }]);
|
|
139
|
+
let first = true;
|
|
140
|
+
const cli = new NativeReviewCliV216(async (call) => {
|
|
141
|
+
if (first) { first = false; enter(); await held; }
|
|
142
|
+
return queue.adapter(call);
|
|
143
|
+
}, executable, 30_000, 1024 * 1024);
|
|
144
|
+
const pending = cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
145
|
+
await entered;
|
|
146
|
+
writeFileSync(executable, "replacement supporting provider");
|
|
147
|
+
release();
|
|
148
|
+
assert.equal((await pending).nextTransition?.kind, "collect");
|
|
149
|
+
assert.equal((await cli.targetStatus({ ...request, nonBlockingFindings: true })).nextTransition?.kind, "collect");
|
|
150
|
+
assert.deepEqual(queue.calls.map((call) => call.arguments), [
|
|
151
|
+
[...base, "--non-blocking-findings", "--next-transition"],
|
|
152
|
+
[...base, "--next-transition"],
|
|
153
|
+
[...base, "--non-blocking-findings", "--next-transition"],
|
|
154
|
+
]);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("unreadable executable identity preserves STATUS refusal fallback without caching", async () => {
|
|
158
|
+
const executable = join(scratch, "absent-executable");
|
|
159
|
+
const queue = adapter([{ body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }, { body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }]);
|
|
160
|
+
const cli = new NativeReviewCliV216(queue.adapter, executable, 30_000, 1024 * 1024);
|
|
161
|
+
for (let call = 0; call < 2; call++) {
|
|
162
|
+
assert.equal((await cli.targetStatus({ ...request, nonBlockingFindings: true })).nextTransition?.kind, "collect");
|
|
163
|
+
}
|
|
164
|
+
assert.deepEqual(queue.calls.map((call) => call.arguments.includes("--non-blocking-findings")), [true, false, true, false]);
|
|
165
|
+
});
|
|
@@ -283,13 +283,21 @@ async function executeController(runtime: ParityRuntime, operation: unknown, cwd
|
|
|
283
283
|
return response.details as Record<string, unknown>;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
function consentNative(cwd: string): { native: NativeReviewCli; starts: { count: number }; answers: string[] } {
|
|
287
|
-
const
|
|
286
|
+
function consentNative(cwd: string, agent: "claude-code" | "pi" = "claude-code"): { native: NativeReviewCli; starts: { count: number }; answers: string[]; consent: ReturnType<typeof decodeReviewConsentV3> } {
|
|
287
|
+
const raw = captured("consent-v3.captured.json") as Record<string, unknown>;
|
|
288
|
+
if (agent === "pi") {
|
|
289
|
+
raw.agent = agent;
|
|
290
|
+
for (const choice of raw.choices as Array<Record<string, unknown>>) {
|
|
291
|
+
choice.invocation = String(choice.invocation).replace(" --consent ", " --agent pi --consent ");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const consent = decodeReviewConsentV3(raw, agent);
|
|
288
295
|
const starts = { count: 0 };
|
|
289
296
|
const answers: string[] = [];
|
|
290
297
|
return {
|
|
291
298
|
starts,
|
|
292
299
|
answers,
|
|
300
|
+
consent,
|
|
293
301
|
native: {
|
|
294
302
|
targetStatus: async () => startStatus(cwd),
|
|
295
303
|
start: async () => {
|
|
@@ -336,6 +344,12 @@ async function beginConsent(runtime: ParityRuntime, cwd: string, sessionId = "pa
|
|
|
336
344
|
const blocked = await executeController(runtime, { operation: "start", input: JSON.stringify({ mode: "ordinary" }) }, cwd, sessionId);
|
|
337
345
|
assert.equal(blocked.outcome, "native-review-consent-required");
|
|
338
346
|
assert.equal(typeof blocked.consent_binding, "string");
|
|
347
|
+
const consent = blocked.consent as Record<string, unknown>;
|
|
348
|
+
if (consent.schema === "gentle-ai.review-integration.consent/v3" && consent.agent === "pi") {
|
|
349
|
+
assert.equal(consent.consentBinding, blocked.consent_binding);
|
|
350
|
+
} else {
|
|
351
|
+
assert.equal(Object.hasOwn(consent, "consentBinding"), false, "other native envelopes remain exact");
|
|
352
|
+
}
|
|
339
353
|
return blocked;
|
|
340
354
|
}
|
|
341
355
|
|
|
@@ -439,7 +453,7 @@ test("public gentle:review-mode handler reports current operations, global-off w
|
|
|
439
453
|
test("public consent relay allows any active session to resolve a live binding, is one-shot, and is candidate-scoped", async (t) => {
|
|
440
454
|
const cwd = repository(t);
|
|
441
455
|
const sharedRegistry = new PendingReviewConsentRegistry();
|
|
442
|
-
const fixture = consentNative(cwd);
|
|
456
|
+
const fixture = consentNative(cwd, "pi");
|
|
443
457
|
const first = parityRuntime(fixture.native, { pendingReviewConsentRegistry: sharedRegistry });
|
|
444
458
|
const second = parityRuntime(fixture.native, { pendingReviewConsentRegistry: sharedRegistry });
|
|
445
459
|
const sameSession = await beginConsent(first, cwd, "same-session");
|
|
@@ -449,8 +463,13 @@ test("public consent relay allows any active session to resolve a live binding,
|
|
|
449
463
|
// gentle-pi#455: a binding is answerable by whichever active Pi session
|
|
450
464
|
// presents it, not only the session whose START created it.
|
|
451
465
|
const blockedA = await beginConsent(first, cwd, "session-a");
|
|
452
|
-
|
|
453
|
-
|
|
466
|
+
const { consentBinding, ...nativeEnvelope } = blockedA.consent as Record<string, unknown>;
|
|
467
|
+
assert.deepEqual(nativeEnvelope, fixture.consent.raw, "the public copy preserves every native field");
|
|
468
|
+
assert.notEqual(blockedA.consent, fixture.consent.raw, "the Pi annotation must not mutate the native object");
|
|
469
|
+
assert.equal(Object.hasOwn(fixture.consent.raw, "consentBinding"), false);
|
|
470
|
+
assert.doesNotThrow(() => decodeReviewConsentV3(fixture.consent.raw));
|
|
471
|
+
assert.throws(() => decodeReviewConsentV3(blockedA.consent), /consentBinding/, "the annotated copy is not a native envelope");
|
|
472
|
+
const declinedFromOtherSession = await answerConsent(second, cwd, consentBinding, "declined", "session-b");
|
|
454
473
|
assert.equal(declinedFromOtherSession.operation, "answer-consent");
|
|
455
474
|
assert.equal(declinedFromOtherSession.outcome, "consent-declined-this-candidate");
|
|
456
475
|
assert.deepEqual(fixture.answers, ["declined", "declined"]);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Independent T3 refusal-identity regressions (S1/S3).
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import test from "node:test";
|
|
8
|
+
|
|
9
|
+
for (const flavor of ["runtime", "typescript"]) {
|
|
10
|
+
test(`refusal identity public probes: ${flavor}`, () => {
|
|
11
|
+
const scratch = mkdtempSync(join(tmpdir(), "identity-regression-"));
|
|
12
|
+
try {
|
|
13
|
+
const run = spawnSync(process.execPath, ["--experimental-strip-types", "--test", "tests/fixtures/refusal-identity.probe.mjs"], {
|
|
14
|
+
cwd: process.cwd(), encoding: "utf8", timeout: 30_000,
|
|
15
|
+
env: { PATH: process.env.PATH, HOME: scratch, USERPROFILE: scratch,
|
|
16
|
+
TMPDIR: scratch, TMP: scratch, TEMP: scratch,
|
|
17
|
+
NODE_COMPILE_CACHE: join(scratch, "cache"), NO_UPDATE_NOTIFIER: "1",
|
|
18
|
+
PROBE_ROOT: process.cwd(), PROBE_FLAVOR: flavor },
|
|
19
|
+
});
|
|
20
|
+
assert.equal(run.status, 0, `${run.error ?? ""}\n${run.stdout}\n${run.stderr}`);
|
|
21
|
+
} finally {
|
|
22
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -33,8 +33,15 @@ test("resolved subdecisions retain the original authorized objective", () => {
|
|
|
33
33
|
assert.ok(prompt.includes("Resolving an incident or subdecision does not complete or cancel the original authorized objective; resume safe, necessary in-scope steps automatically, using judgment for proportionate recovery and respecting explicit user dispositions. Investigate pending technical uncertainty rather than treating it alone as a new human decision."));
|
|
34
34
|
assert.ok(prompt.includes("Stop for an unresolved consequential scope/product decision, required explicit consent, a denied action, or the human's explicit stop."));
|
|
35
35
|
assert.ok(prompt.includes("Unavailable required proof blocks completion and delivery; it does not alone prohibit specifically authorized in-scope implementation where actual native authority and other limits permit it."));
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
// cost-speed-painpoints S15 P4: the verifier-setup rules load with the Verification rule, not on every turn.
|
|
37
|
+
const verification = read("assets/orchestrator-verification.md");
|
|
38
|
+
for (const sentence of [
|
|
39
|
+
"After a setup prerequisite is repaired, the human may explicitly request one new bounded verification attempt.",
|
|
40
|
+
"Never bypass consent, a denial, explicit one-run or no-retry limits, terminal native outcomes, or exhausted native budgets",
|
|
41
|
+
]) {
|
|
42
|
+
assert.ok(verification.includes(sentence), `verification module keeps: ${sentence}`);
|
|
43
|
+
assert.ok(!prompt.includes(sentence), `always-on prompt no longer carries: ${sentence}`);
|
|
44
|
+
}
|
|
38
45
|
assert.ok(prompt.includes("Do not infer permission for publishing, destructive actions, unrelated scope or native consent from this continuity rule."));
|
|
39
46
|
});
|
|
40
47
|
|
|
@@ -86,7 +93,8 @@ test("T13: the Close gate requires continuing or quoting the user's explicit sto
|
|
|
86
93
|
test("T13: budgets hold and the pinned human-control line is untouched", () => {
|
|
87
94
|
const bytes = Buffer.byteLength(tracking, "utf8");
|
|
88
95
|
// S14: close the open slice before a high-risk commit; outcomes per commit (12,600 -> 12,850 B), same as MODULE_BUDGETS.
|
|
89
|
-
|
|
96
|
+
// P5b: contradictions and step 3 / Phase reporting restatements removed; 1.4.0 commit-boundary rules kept (12,850 -> 10,324 B).
|
|
97
|
+
assert.ok(bytes <= 10_324, `orchestrator-tracking.md is ${bytes} B, over its 10,324 B budget`);
|
|
90
98
|
assert.ok(core.includes("- Preserve human control: user decisions beat agent momentum."), "core human-control line must stay verbatim");
|
|
91
99
|
assert.ok(core.includes("4. **Track**") && core.includes("`orchestrator-tracking.md`"), "Track must still load the tracking module");
|
|
92
100
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import test from "node:test";
|
|
4
|
+
import { __testing } from "../extensions/gentle-ai.ts";
|
|
4
5
|
import { readDelegationDetail } from "./support/orchestrator-modules.ts";
|
|
5
6
|
|
|
6
7
|
const read = (path: string) => readFileSync(new URL(`../${path}`, import.meta.url), "utf8");
|
|
@@ -11,7 +12,10 @@ test("ODD continuity persists the task file and complete Engram mirror across re
|
|
|
11
12
|
assert.match(memory, /odd\/tasks\/<feature-name>\.md/);
|
|
12
13
|
assert.match(memory, /odd\/<feature-name>\/tasks/);
|
|
13
14
|
assert.match(memory, /Mirror the full current document and repository-relative file locator/);
|
|
14
|
-
assert.match(memory, /
|
|
15
|
+
assert.match(memory, /After a successful local update and an explicit, complete save acknowledgement/);
|
|
16
|
+
assert.match(memory, /do not routinely reread both full copies/);
|
|
17
|
+
assert.match(memory, /These writes are not atomic/);
|
|
18
|
+
assert.match(memory, /uncertain acknowledgement requires checking which writes already applied before any retry; never replay an applied write/);
|
|
15
19
|
assert.match(memory, /mirror pending/);
|
|
16
20
|
assert.match(memory, /On resume, use `mem_context`, then project\/feature-scoped `mem_search`, and `mem_get_observation`/);
|
|
17
21
|
assert.match(memory, /read the actual task file/);
|
|
@@ -19,7 +23,9 @@ test("ODD continuity persists the task file and complete Engram mirror across re
|
|
|
19
23
|
|
|
20
24
|
test("optional research stays output-only and delegates to a general worker", () => {
|
|
21
25
|
const delegation = readDelegationDetail();
|
|
22
|
-
|
|
26
|
+
// P5b: the named-uncertainty rule is stated once, in always-on step 3.
|
|
27
|
+
assert.match(__testing.buildGentlePrompt("gentleman"), /Recommend optional research only for a named uncertainty/);
|
|
28
|
+
assert.doesNotMatch(delegation, /Recommend optional research only for a named uncertainty/);
|
|
23
29
|
assert.match(delegation, /Forward these research instructions to an existing fresh general exploration\/research worker/);
|
|
24
30
|
assert.match(delegation, /Research remains read-only and requires no new persistence or readiness machinery/);
|
|
25
31
|
assert.match(delegation, /If tools are unavailable, disclose limitations without inventing access or evidence/);
|
|
@@ -32,7 +38,9 @@ test("applicability, fallback and honest evidence flow through ODD actors", () =
|
|
|
32
38
|
const worker = read("assets/agents/gentle-ai-worker.md");
|
|
33
39
|
const verifier = read("assets/agents/gentle-ai-verify.md");
|
|
34
40
|
assert.match(wrapper, /behavior changes with applicable runnable deterministic tests and a clear expected outcome/);
|
|
35
|
-
|
|
41
|
+
// P5b (C3): the applicability rule lives in the always-on principle; the lazy modules forward it.
|
|
42
|
+
assert.match(wrapper, /Test presence alone does not establish applicability/);
|
|
43
|
+
assert.match(delegation, /forward this policy, the applicable exact runner and commands/);
|
|
36
44
|
for (const [actor, text] of [["implementation support", support], ["worker", worker], ["verifier", verifier]] as const) {
|
|
37
45
|
assert.match(text, /behavior changes with applicable runnable deterministic tests and a clear expected outcome/i, `${actor} must assess behavior-level applicability`);
|
|
38
46
|
assert.match(text, /passive documentation/i, `${actor} must handle passive docs`);
|
|
@@ -82,7 +82,9 @@ test("organic progress preserves both complete feature copies and reconciles act
|
|
|
82
82
|
"preserve valid completed and unrelated work",
|
|
83
83
|
"reopen invalidated items",
|
|
84
84
|
"Check off only observed outcomes",
|
|
85
|
-
"
|
|
85
|
+
"explicit, complete save acknowledgement",
|
|
86
|
+
"inspect the changed local task/log lines as needed",
|
|
87
|
+
"do not routinely reread both full copies",
|
|
86
88
|
"not atomic",
|
|
87
89
|
"mirror pending",
|
|
88
90
|
"Preserve both versions",
|
|
@@ -98,21 +100,41 @@ test("organic progress preserves both complete feature copies and reconciles act
|
|
|
98
100
|
assert.doesNotMatch(memory, /`todo` tool is an optional session\/UI projection/);
|
|
99
101
|
});
|
|
100
102
|
|
|
103
|
+
// gentle-shell#1494 field follow-up: tracking must not grow its own reconciliation
|
|
104
|
+
// scripts, invented size gates, or repeated malformed writer launches.
|
|
105
|
+
test("tracking sync recovers from partial writes without custom reconciliation gates", () => {
|
|
106
|
+
containsAll(memory, [
|
|
107
|
+
"These writes are not atomic",
|
|
108
|
+
"never author comparison or reconciliation scripts or gates for them",
|
|
109
|
+
"A missing, partial, truncated, failed, or uncertain acknowledgement requires checking which writes already applied before any retry; never replay an applied write",
|
|
110
|
+
"If the tool reports a payload it cannot preserve, keep the file and mark its mirror pending rather than repeatedly resending the same payload",
|
|
111
|
+
"a mirror that differs from the file just written is refreshed from the file, never a blocker",
|
|
112
|
+
"Preserve both versions on irreconcilable edits",
|
|
113
|
+
]);
|
|
114
|
+
containsAll(delegation, [
|
|
115
|
+
"A user's line limit is a ceiling, never an exact-count gate; never invent acceptance gates the user did not ask for",
|
|
116
|
+
]);
|
|
117
|
+
const writerClause = "Every new writer launch carries the section (a continuation inherits it); after an admission rejection, repair what it names once, never relaunch the same prompt unchanged";
|
|
118
|
+
containsAll(delegation, [writerClause]);
|
|
119
|
+
containsAll(read("assets/orchestrator-full-delegation-card.md"), [writerClause]);
|
|
120
|
+
});
|
|
121
|
+
|
|
101
122
|
test("assumption challenge and task checks do not activate or duplicate native review", () => {
|
|
123
|
+
// P5b: the step 3 limit lives in the always-on steps; tracking keeps only what step 3 does not carry.
|
|
124
|
+
containsAll(wrapper, ["at most one scoped read-only assumption challenge for a high-consequence unproven premise"]);
|
|
102
125
|
containsAll(delegation, [
|
|
103
|
-
"
|
|
104
|
-
"high-consequence unproven premise",
|
|
126
|
+
"The step 3 assumption challenge is independent",
|
|
105
127
|
"Deterministic failures need fixes",
|
|
106
128
|
"native RDD refuter",
|
|
107
129
|
"functional checks per task",
|
|
108
130
|
"native review runs at that work-unit commit or PR slice boundary",
|
|
109
|
-
"
|
|
110
|
-
"gentle_review`
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"only
|
|
114
|
-
"
|
|
115
|
-
"
|
|
131
|
+
"Never replace assessment with model judgment, task size or defect severity",
|
|
132
|
+
"`gentle_review` `{\"operation\":\"assess\"}`",
|
|
133
|
+
// P5b (C5): the injected contract governs how a review starts, runs, and gets consent; tracking keeps the
|
|
134
|
+
// commit-boundary rules mirrored from routing/pi.md, which the rendered prompt carries nowhere else.
|
|
135
|
+
"When RDD is enabled, the injected Gentle AI contract governs native review start, execution and consent; this module adds only assessment and commit boundaries.",
|
|
136
|
+
"A not-due `passive` commit needs no review and the boundary advances; `under_budget` stays pending in the slice until a later commit reaches the budget.",
|
|
137
|
+
"lower the tier or infer low risk",
|
|
116
138
|
"When RDD is disabled, do not start or prompt for RDD",
|
|
117
139
|
]);
|
|
118
140
|
});
|
|
@@ -157,14 +179,10 @@ test("ODD commits work units in reviewable slices and reviews the commit or PR s
|
|
|
157
179
|
);
|
|
158
180
|
assert.ok(!core.includes("- Never commit unless the user explicitly asks."), "core Safety contradicts ODD step 6 work-unit commits");
|
|
159
181
|
containsAll(delegation, [
|
|
160
|
-
'
|
|
161
|
-
"
|
|
162
|
-
'start native review on it right away at that base with `gentle_review` `{"operation":"start"}`',
|
|
163
|
-
"Medium: defer to the PR slice",
|
|
164
|
-
"bounded by the delivery budget of about 400 authored changed lines",
|
|
165
|
-
"The first boundary is the branch point, and every reviewed boundary becomes the next base",
|
|
182
|
+
'After each work-unit commit, assess it with `gentle_review` `{"operation":"assess"}` and `{"baseRef":"<last reviewed boundary>","committedOnly":true}`',
|
|
183
|
+
"start at the branch point; each reviewed boundary is the next base",
|
|
166
184
|
// S14: commit per reviewable slice; one commit may hold several tasks, so outcomes are recorded per commit.
|
|
167
|
-
"Record
|
|
185
|
+
"Record each commit's assessed tier, outcome (not due, granted, declined, unavailable) and `reviewDueReason`",
|
|
168
186
|
"Delivery follows work units",
|
|
169
187
|
"forecast authored changed lines (additions plus deletions, generated files excluded) from the task list",
|
|
170
188
|
"keep a running count from work-unit commits",
|
|
@@ -253,7 +271,10 @@ test("one feature document carries intent, accepted rationale and worker context
|
|
|
253
271
|
"automatically update affected intent and TODOs",
|
|
254
272
|
"add genuinely new tasks or reopen invalidated items with a reason",
|
|
255
273
|
"Findings alone never authorize scope expansion or automatic acceptance",
|
|
256
|
-
"
|
|
274
|
+
"At initial implementation or recovery after interruption or context loss, the parent reads both the actual file and full observation",
|
|
275
|
+
"Within an intact continuation, reuse the established specs, next task, route, and applicable proof",
|
|
276
|
+
"A progress question does not restart preparation",
|
|
277
|
+
"New scope, external edits, stale proof, or missing context require inspecting the affected state before editing",
|
|
257
278
|
"passes the locator, task IDs, and linked `S#`; workers read the document until `## Log` before edits",
|
|
258
279
|
]);
|
|
259
280
|
containsAll(read("assets/agents/gentle-ai-worker.md"), [
|
|
@@ -322,19 +343,23 @@ test("ODD defaults to applicable test-first without chat or TUI activation", ()
|
|
|
322
343
|
// rendered parent prompt (harness + core) now carries that policy exactly
|
|
323
344
|
// once, from the harness, instead of the core carrying its own copy.
|
|
324
345
|
const rendered = __testing.buildGentlePrompt("gentleman");
|
|
325
|
-
|
|
346
|
+
// P5b (C3): the delegation modules forward the policy instead of restating its cycle.
|
|
347
|
+
for (const text of [rendered, worker, verify, support, skill, wrapper]) {
|
|
326
348
|
containsAll(text, ["applicable", "RED", "GREEN"]);
|
|
327
349
|
assert.doesNotMatch(text, /(?:configured TDD mode|Strict TDD Mode is enabled|explicit user choice|test presence does not enable it|tests existing does not activate it)/i);
|
|
328
350
|
}
|
|
329
351
|
assert.equal(rendered.split("use test-first by default").length - 1, 1, "the parent prompt states the test-first policy once");
|
|
330
352
|
assert.ok(!core.includes("GREEN"), "core restates the harness test-first policy");
|
|
331
|
-
|
|
353
|
+
// P5b (C3): the lazy modules no longer restate the policy; they forward it (below).
|
|
354
|
+
for (const [actor, text] of [["extension", wrapper], ["skill", skill]] as const) {
|
|
332
355
|
assert.match(text, /behavior changes with applicable runnable deterministic tests and a clear expected outcome/i, `${actor} must require applicability, not test presence`);
|
|
333
356
|
assert.match(text, /passive documentation/i, `${actor} must handle passive docs`);
|
|
334
357
|
assert.match(text, /unavailable runner/i, `${actor} must handle unavailable runners`);
|
|
335
358
|
assert.match(text, /ordinary functional or structural verification/i, `${actor} must specify fallback checks`);
|
|
336
359
|
}
|
|
337
|
-
|
|
360
|
+
// P5b (C3): the "use test-first by default" policy lives once, in the rendered always-on principle
|
|
361
|
+
// (asserted above); tracking alone forwards it to writers.
|
|
362
|
+
containsAll(read("assets/orchestrator-tracking.md"), ["Test-first is the always-on harness principle", "forward this policy"]);
|
|
338
363
|
containsAll(worker, ["before implementation", "ordinary functional or structural verification", "no meaningful RED"]);
|
|
339
364
|
containsAll(verify, ["observed RED", "observed GREEN", "exception"]);
|
|
340
365
|
assert.doesNotMatch(skill, /SDD|OpenSpec/i, "the ODD-only skill must not prime SDD");
|
|
@@ -491,15 +516,42 @@ test("ODD protocol is always-on in the rendered system prompt and runs by defaul
|
|
|
491
516
|
assert.doesNotMatch(core + delegation + memory, /SDD|sdd-|OpenSpec|openspec/i);
|
|
492
517
|
});
|
|
493
518
|
|
|
494
|
-
// S14: commit per reviewable slice
|
|
495
|
-
//
|
|
496
|
-
//
|
|
497
|
-
|
|
519
|
+
// S14: commit per reviewable slice; outcomes are recorded per commit, since one commit may hold several tasks.
|
|
520
|
+
// Mirrors gentle-ai#6110: a high-risk unit following pending `under_budget`
|
|
521
|
+
// commits assesses that slice first without forcing review. The rendered prompt carries
|
|
522
|
+
// only steps 1-7 of routing/pi.md and the injected orchestration contract has no slice rule, so tracking states it;
|
|
523
|
+
// P5b removed only the sentences that restated the injected contract (start, consent, Medium deferral).
|
|
524
|
+
test("S14: RDD tracking assesses the open slice before a high-risk commit and records outcomes per commit", () => {
|
|
498
525
|
const tracking = readFileSync(join(import.meta.dirname, "..", "assets", "orchestrator-tracking.md"), "utf8");
|
|
499
526
|
assert.ok(
|
|
500
|
-
tracking.includes("
|
|
501
|
-
"tracking must
|
|
527
|
+
tracking.includes("Before a high-risk unit, assess any pending `under_budget` slice."),
|
|
528
|
+
"tracking must assess the open slice before a high-risk commit",
|
|
529
|
+
);
|
|
530
|
+
assert.ok(
|
|
531
|
+
wrapper.includes("a unit whose Risk line names a high-risk item gets its own commit so native review can take it alone"),
|
|
532
|
+
"step 6 must keep a high-risk unit in its own commit",
|
|
502
533
|
);
|
|
503
|
-
assert.ok(tracking.includes("Record
|
|
534
|
+
assert.ok(tracking.includes("Record each commit's assessed tier, outcome"), "tracking must record outcomes per commit");
|
|
504
535
|
assert.ok(!tracking.includes("Record per task the assessed tier and outcome"), "tracking must not record outcomes per task");
|
|
505
536
|
});
|
|
537
|
+
|
|
538
|
+
test("pending slice review follows provider due or explicit request without inventing a boundary", () => {
|
|
539
|
+
const tracking = read("assets/orchestrator-tracking.md");
|
|
540
|
+
containsAll(tracking, [
|
|
541
|
+
"Before a high-risk unit, assess any pending `under_budget` slice.",
|
|
542
|
+
"Review the pending slice only when `reviewDue` is true or the user explicitly asks",
|
|
543
|
+
"otherwise preserve the pending boundary and proceed without review",
|
|
544
|
+
"A task boundary neither authorizes review nor advances a reviewed boundary.",
|
|
545
|
+
]);
|
|
546
|
+
assert.doesNotMatch(tracking, /close the open slice first, assessing and reviewing it as the slice/);
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
test("failed assessment reports missing proof without inventing due or preflight", () => {
|
|
550
|
+
const tracking = read("assets/orchestrator-tracking.md");
|
|
551
|
+
containsAll(tracking, [
|
|
552
|
+
"report missing assessment proof",
|
|
553
|
+
"never infer `reviewDue`, construct a preflight transition",
|
|
554
|
+
"lower the tier or infer low risk",
|
|
555
|
+
]);
|
|
556
|
+
assert.doesNotMatch(tracking, /treat the commit as due/);
|
|
557
|
+
});
|
|
@@ -39,7 +39,11 @@ const FIXTURE_PATH = join(import.meta.dirname, "fixtures", "orchestrator.pre-die
|
|
|
39
39
|
// Issue #2935 (user decision 2026-11-06): 9,250 -> 9,350 B so the confinement clause keeps its full wording
|
|
40
40
|
// (registered same-clone worktrees, never-blanket grants) while adding the resolved-skill-read exception; the
|
|
41
41
|
// controlled 128-char assets root needs the headroom for platform-independent rendering.
|
|
42
|
-
|
|
42
|
+
// cost-speed-painpoints S5 (T4): the duplicate `## Identity Contract` pointer left the core (the Language Boundary
|
|
43
|
+
// intro carries the same pointer); measured 9,347 -> 9,197 B at the 128-char root: 9,350 -> 9,197 B.
|
|
44
|
+
// cost-speed-painpoints S15 P5a: verdicts C7, C9, C12, X1, X3 and C8 (L41); measured 9,197 -> 9,189 B at the 128-char root.
|
|
45
|
+
// cost-speed P14 (PD-81): the Evidence-budget lookup number matches the runtime notice; measured 9,189 -> 9,177 B.
|
|
46
|
+
const BUDGET_BYTES = 9177;
|
|
43
47
|
const MIN_CONTROLLED_LONG_ASSETS_ROOT_CHARS = 93;
|
|
44
48
|
|
|
45
49
|
const LAZY_ASSET_NAMES = [
|
|
@@ -132,7 +136,7 @@ function measureOrchestratorPromptBytes(assetsDir: string): number {
|
|
|
132
136
|
// measuring a shorter render again.
|
|
133
137
|
const RDD_WORST_CASE_LINE = "Receipt-driven development: unknown (native status unavailable)";
|
|
134
138
|
|
|
135
|
-
test("getOrchestratorPrompt return value stays within the canonical 9,
|
|
139
|
+
test("getOrchestratorPrompt return value stays within the canonical 9,197 B budget at a short assets root", () => {
|
|
136
140
|
const rendered = __testing.renderOrchestratorPrompt(representativeProductionAssetsDir);
|
|
137
141
|
assert.ok(
|
|
138
142
|
rendered.includes(RDD_WORST_CASE_LINE),
|
|
@@ -203,7 +207,7 @@ const TARGET_FILE: Record<Target, string> = {
|
|
|
203
207
|
// (frozen byte-identical copy of assets/orchestrator.md at 23,047 B / 312 lines).
|
|
204
208
|
const DISPOSITION_MAP: DispositionRange[] = [
|
|
205
209
|
{ lines: [1, 4], target: "replaced", label: "Header + bind: retired phase qualification" },
|
|
206
|
-
{ lines: [5, 8], target: "
|
|
210
|
+
{ lines: [5, 8], target: "replaced", label: "Identity Contract pointer: dropped as a duplicate of the Language Boundary intro pointer (cost-speed-painpoints S5)" },
|
|
207
211
|
{ lines: [9, 13], target: "core", label: "Core Role" },
|
|
208
212
|
{ lines: [15, 15], target: "core", label: "Language Boundary heading" },
|
|
209
213
|
{ lines: [17, 17], target: "core", label: "Language Boundary LB1 pointer" },
|
|
@@ -277,7 +281,9 @@ const DISPOSITION_MAP: DispositionRange[] = [
|
|
|
277
281
|
{ lines: [232, 232], target: "core", label: "Skill Registry Protocol heading" },
|
|
278
282
|
{ lines: [234, 253], target: "replaced", label: "Skill resolution retained without phase roles" },
|
|
279
283
|
{ lines: [255, 255], target: "core", label: "Intent-Driven Skill Discovery heading" },
|
|
280
|
-
{ lines: [257,
|
|
284
|
+
{ lines: [257, 260], target: "skills", label: "Intent-Driven Skill Discovery introduction" },
|
|
285
|
+
{ lines: [261, 264], target: "replaced", label: "Disk-first discovery replaced by the S7 effective session view" },
|
|
286
|
+
{ lines: [265, 276], target: "skills", label: "Intent-Driven Skill Discovery fallback and intent hints" },
|
|
281
287
|
{ lines: [278, 283], target: "core", label: "Safety" },
|
|
282
288
|
{ lines: [285, 312], target: "obsolete", label: "Superseded pre-transaction review contract" },
|
|
283
289
|
];
|
|
@@ -336,6 +342,8 @@ for (const range of DISPOSITION_MAP) {
|
|
|
336
342
|
const trimmed = raw.trim();
|
|
337
343
|
const expected =
|
|
338
344
|
// Preserve the synthesis rule while reserving core bytes for the RDD scope condition.
|
|
345
|
+
// cost-speed-painpoints S15 P5a (verdict C7): organic is inline by default; delegation only by a Mechanism trigger.
|
|
346
|
+
ln === 11 ? "You are a COORDINATOR who executes understood work inline. Maintain one thin conversation thread, delegate only when a Mechanism trigger fires, and synthesize results for the user." :
|
|
339
347
|
ln === 13 ? "Default to concise synthesis: decision, outcome, next action. Expand on request or when detail is needed." :
|
|
340
348
|
ln === 36 ? "- Substantial authorized work: use ODD; track feature progress automatically." :
|
|
341
349
|
trimmed;
|
|
@@ -362,6 +370,22 @@ for (const range of DISPOSITION_MAP) {
|
|
|
362
370
|
);
|
|
363
371
|
}
|
|
364
372
|
|
|
373
|
+
test("lazy skill discovery selects and delegates from the effective view with a disclosed disk-only fallback", () => {
|
|
374
|
+
const skills = readRealAsset("orchestrator-skills.md");
|
|
375
|
+
for (const required of [
|
|
376
|
+
"Match task context and target files against the effective view's `Trigger / description` column.",
|
|
377
|
+
"Pass only matching exact `Path` values to subagents under `## Skills to load before work`.",
|
|
378
|
+
"Tell subagents to read those exact `SKILL.md` files before reading, writing, reviewing, testing, or creating artifacts.",
|
|
379
|
+
"The effective view is `<available_skills>` plus the on-disk rows of the `Effective session skills` system-prompt block",
|
|
380
|
+
"Consult `<available_skills>` and the `Effective session skills` block, when present, before acting or delegating.",
|
|
381
|
+
"Read the matching exact `SKILL.md` path when acting; pass it to the subagent when delegating.",
|
|
382
|
+
"If the view is unavailable, disclose the limitation; `.atl/skill-registry.md` is a disk-only fallback, not a complete Pi view.",
|
|
383
|
+
"If an expected workflow is absent, search configured skill roots only as a fallback. Prefer the most specific project skill over a global skill with the same intent.",
|
|
384
|
+
"If no matching skill exists, continue with the smallest safe fallback and say which expected skill was unavailable.",
|
|
385
|
+
]) assert.ok(skills.includes(required), `missing skill-discovery rule: ${required}`);
|
|
386
|
+
assert.doesNotMatch(skills, /1\. Read `\.atl\/skill-registry\.md` when present\./);
|
|
387
|
+
});
|
|
388
|
+
|
|
365
389
|
// ---------------------------------------------------------------------------
|
|
366
390
|
// 2.4 — Core-alone load-bearing tokens (JD-007) — assert on the raw core
|
|
367
391
|
// string alone, no lazy union.
|
|
@@ -394,7 +418,8 @@ test("lazy coordination detail retains subject guidance without inflating the co
|
|
|
394
418
|
|
|
395
419
|
test("core-alone: dynamic Gentle AI ownership replaces package lifecycle instructions", () => {
|
|
396
420
|
const core = readRealAsset("orchestrator.md");
|
|
397
|
-
|
|
421
|
+
// cost-speed-painpoints S15 P5a (verdict X1): the contract is injected only while RDD is not off.
|
|
422
|
+
assert.match(core, /While RDD is not off, this package injects the mirrored provider-bundle review execution contract;/);
|
|
398
423
|
assert.match(core, /Absent that mirrored contract, this package invents no lifecycle instructions/);
|
|
399
424
|
assert.doesNotMatch(core, /start -> finalize -> validate/i);
|
|
400
425
|
assert.doesNotMatch(core, /receipt validation/i);
|