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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
3
|
import { execFileSync } from "node:child_process";
|
|
3
4
|
import { chmodSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
5
|
import { createHash } from "node:crypto";
|
|
@@ -52,7 +53,7 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
52
53
|
const ai = await import("@earendil-works/pi-ai");
|
|
53
54
|
const { default: gentleAgents } = await import("../extensions/gentle-agents.ts");
|
|
54
55
|
const { default: gentleShell } = await import("../extensions/gentle-shell.ts");
|
|
55
|
-
const { resolveSessionWorktreeWithGit } = await import("../lib/session-worktree-registry.ts");
|
|
56
|
+
const { resolveSessionWorktreeWithGit, SESSION_WORKTREE_CHANGED } = await import("../lib/session-worktree-registry.ts");
|
|
56
57
|
const { ORCHESTRATOR_STATE_ENTRY } = await import("../lib/orchestrator-state.ts");
|
|
57
58
|
assert.equal(sdk.getAgentDir(), profile);
|
|
58
59
|
const gitEnv = { PATH: process.env.PATH, HOME: root, GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: join(root, "gitconfig") };
|
|
@@ -71,16 +72,18 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
71
72
|
const roots = Array.from({ length: 10 }, (_, i) => join(root, `wt${i}`));
|
|
72
73
|
for (const cwd of roots) git(clone, "worktree", "add", "--detach", cwd, "HEAD");
|
|
73
74
|
const gitProbes = new Map<string, number>();
|
|
74
|
-
const
|
|
75
|
+
const metadataQuery = new AsyncLocalStorage<string>();
|
|
76
|
+
const gitProbeOrigins: Array<{ cwd: string; caller?: string; operation: string; origin: string[] }> = [];
|
|
75
77
|
const runGit = new Proxy(execFileSync, { apply(target, _this, [command, args, options]) {
|
|
76
78
|
assert.equal(command, "git");
|
|
77
79
|
assert.ok(String(args[args.indexOf("-C") + 1]).startsWith(root + "/"));
|
|
78
80
|
const cwd = String(args[args.indexOf("-C") + 1]);
|
|
79
|
-
|
|
81
|
+
const caller = metadataQuery.getStore();
|
|
82
|
+
gitProbeOrigins.push({ cwd, caller, operation: String(args.at(-1)), origin: (new Error().stack ?? "").split("\n").flatMap(line => {
|
|
80
83
|
const name = line.match(/\bat (?:async )?([A-Za-z_][\w.$]*)\s*\(/)?.[1];
|
|
81
84
|
return name ? [name] : [];
|
|
82
85
|
}).slice(0, 8) });
|
|
83
|
-
gitProbes.set(
|
|
86
|
+
if (caller !== undefined) gitProbes.set(caller, (gitProbes.get(caller) ?? 0) + 1);
|
|
84
87
|
return Reflect.apply(target, undefined, [command, args, { ...options, env: gitEnv }]);
|
|
85
88
|
} });
|
|
86
89
|
const resolver = (path: string, cwd: string) => resolveSessionWorktreeWithGit(path, cwd, runGit);
|
|
@@ -124,13 +127,24 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
124
127
|
let ctx: ExtensionContext | undefined;
|
|
125
128
|
const shutdown: Array<() => Promise<void>> = [];
|
|
126
129
|
const errors: string[] = [];
|
|
130
|
+
let publishScopeChange = () => {};
|
|
127
131
|
const loader = new sdk.DefaultResourceLoader({ cwd, agentDir: profile, settingsManager: settings,
|
|
128
132
|
noExtensions: true, noSkills: true, noPromptTemplates: true, noThemes: true, noContextFiles: true,
|
|
129
133
|
systemPrompt: "PRIVATE_PARENT_INSTRUCTIONS_SENTINEL. Local acceptance fixture. Only execute the requested tools.", appendSystemPrompt: [],
|
|
130
134
|
extensionFactories: [pi => {
|
|
135
|
+
publishScopeChange = () => pi.events.emit(SESSION_WORKTREE_CHANGED, { sessionId: manager.getSessionId() });
|
|
131
136
|
// Capture ONLY public shutdown registrations for cleanup. Business
|
|
132
137
|
// tools/events receive actual SDK contexts, never fabricated contexts.
|
|
133
138
|
const captured = new Proxy(pi, { get(target, key) {
|
|
139
|
+
// Attribute async query work, not unrelated event-time publications
|
|
140
|
+
// that happen to run between SDK tool start/end notifications.
|
|
141
|
+
if (key === "registerTool") {
|
|
142
|
+
const register: ExtensionAPI["registerTool"] = definition => {
|
|
143
|
+
if (!["orchestrator_consult", "orchestrator_list"].includes(definition.name)) return target.registerTool(definition);
|
|
144
|
+
return target.registerTool({ ...definition, execute: (...args) => metadataQuery.run(cwd, () => definition.execute(...args)) });
|
|
145
|
+
};
|
|
146
|
+
return register;
|
|
147
|
+
}
|
|
134
148
|
if (key !== "on") return Reflect.get(target, key);
|
|
135
149
|
const on: ExtensionAPI["on"] = (event, handler) => {
|
|
136
150
|
if (event === "session_shutdown") shutdown.push(async () => { assert.ok(ctx); await handler({ type: "session_shutdown" }, ctx); });
|
|
@@ -227,7 +241,7 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
227
241
|
await session.bindExtensions({ mode: simulatedUI ? "rpc" : "json", uiContext: simulatedUI ? ui : undefined,
|
|
228
242
|
onError: error => { errors.push(error.error); } });
|
|
229
243
|
assert.ok(ctx); assert.equal(ctx.mode, simulatedUI ? "rpc" : "json"); assert.equal(ctx.hasUI, simulatedUI);
|
|
230
|
-
async function tool(name: string, args: ToolCall["arguments"] = {}) {
|
|
244
|
+
async function tool(name: string, args: ToolCall["arguments"] = {}, interleavePublication = false) {
|
|
231
245
|
request = { name, arguments: args };
|
|
232
246
|
let result: { content: Array<{ type: string; text?: string }>; details?: any } | undefined;
|
|
233
247
|
const before = calls;
|
|
@@ -238,11 +252,12 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
238
252
|
if (event.type === "tool_execution_start" && event.toolName === name) {
|
|
239
253
|
toolProbes = gitProbes.get(cwd) ?? 0;
|
|
240
254
|
toolProbeStart = gitProbeOrigins.length;
|
|
255
|
+
if (interleavePublication) queueMicrotask(publishScopeChange);
|
|
241
256
|
}
|
|
242
257
|
if (event.type === "tool_execution_end" && event.toolName === name) {
|
|
243
258
|
result = event.result; failed = event.isError;
|
|
244
259
|
if (name === "orchestrator_consult" || name === "orchestrator_list") {
|
|
245
|
-
const added = gitProbeOrigins.slice(toolProbeStart).filter(probe => probe.
|
|
260
|
+
const added = gitProbeOrigins.slice(toolProbeStart).filter(probe => probe.caller === cwd).slice(0, 2)
|
|
246
261
|
.map(({ operation, origin }) => ({ operation, origin }));
|
|
247
262
|
assert.equal(gitProbes.get(cwd) ?? 0, toolProbes, `metadata query adds no caller Git probes; origins=${JSON.stringify(added)}`);
|
|
248
263
|
}
|
|
@@ -339,8 +354,19 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
339
354
|
assert.doesNotMatch(JSON.stringify(receipt), /PRIVATE_OWNER_HISTORY_SENTINEL|endpoint|consent|activation/);
|
|
340
355
|
return receipt;
|
|
341
356
|
};
|
|
357
|
+
// Negative control: a Git lookup started by an async query is counted,
|
|
358
|
+
// including after an await. The real metadata operations must add none.
|
|
359
|
+
const beforeControl = gitProbes.get(roots[1]) ?? 0;
|
|
360
|
+
await metadataQuery.run(roots[1], async () => {
|
|
361
|
+
await new Promise<void>(resolve => setImmediate(resolve));
|
|
362
|
+
resolver(roots[1], roots[1]);
|
|
363
|
+
});
|
|
364
|
+
assert.equal(gitProbes.get(roots[1]), beforeControl + 2, "query-origin Git probes must remain detectable");
|
|
342
365
|
const first = await consult();
|
|
343
366
|
assert.equal(first.status, "available");
|
|
367
|
+
// A discrete publication can race an unrelated query in the real SDK.
|
|
368
|
+
const coincident = await caller.tool("orchestrator_consult", { recipient_session_id: sid }, true);
|
|
369
|
+
assert.equal(coincident.details.gentleAgents.receipt.status, "available");
|
|
344
370
|
// Hold A's actual SDK main lane busy. B must read the published snapshot
|
|
345
371
|
// before releasing A, without messaging or a helper/receiver model call.
|
|
346
372
|
const busy = owner.deferMain();
|
|
@@ -16,7 +16,8 @@ import test, { after } from "node:test";
|
|
|
16
16
|
const REPO_ROOT = join(import.meta.dirname, "..");
|
|
17
17
|
const REAL_ASSETS_DIR = join(REPO_ROOT, "assets");
|
|
18
18
|
const VARIANT_FILE = "orchestrator-full-delegation.md";
|
|
19
|
-
|
|
19
|
+
// cost-speed-painpoints S15 P5a (verdict C7): the anchor changes together with DELEGATION_MODE_REGION_START.
|
|
20
|
+
const ORGANIC_START = "You are a COORDINATOR who executes understood work inline.";
|
|
20
21
|
const ORGANIC_END = "{{GENTLE_PI_BACKGROUND_POLICY}}";
|
|
21
22
|
|
|
22
23
|
const { __testing } = await import("../extensions/gentle-ai.ts");
|
|
@@ -268,3 +268,31 @@ test("duplicate display names do not become routing identities", (t) => {
|
|
|
268
268
|
assert.deepEqual(candidates.map(c => c.workspace), ["/repo0", "/repo1"]);
|
|
269
269
|
} finally { publishers.forEach(publisher => publisher.dispose()); }
|
|
270
270
|
});
|
|
271
|
+
|
|
272
|
+
test("busy directories paginate so peers beyond the first 128 entries keep their label and curated state (#3185)", (t) => {
|
|
273
|
+
const profile = fixture(t);
|
|
274
|
+
// 130 live peers produce 390 presence files (header + activity + discovery each),
|
|
275
|
+
// far beyond the 128-entry first page. Before #3185 every peer beyond that page
|
|
276
|
+
// resolved to a bare unknown because discovery only ever read the first page.
|
|
277
|
+
const peers = Array.from({ length: 130 }, (_, i) => ({ ...peer, sessionId: `peer-${i}` }));
|
|
278
|
+
const publishers = peers.map((p, i) => PresencePublisher.start({ profile, sessionId: p.sessionId, label: `Peer ${i}`, activity: [] }));
|
|
279
|
+
try {
|
|
280
|
+
for (let i = 0; i < peers.length; i++) {
|
|
281
|
+
publishers[i].updateDiscovery(peers[i], { workspace: `/repo-${i}`, tasks: [], state: {
|
|
282
|
+
schema: 2, sessionId: peers[i].sessionId, cwd: "/repo", recordedAt: 1, source: "owner-curated",
|
|
283
|
+
ownerReply: false, authority: "none", state: { objective: "Ship review", work: { area: "Auth" } },
|
|
284
|
+
} });
|
|
285
|
+
}
|
|
286
|
+
assert.equal(listPresence(profile).overflow, true, "fixture must exceed the 128-entry first page");
|
|
287
|
+
const candidates = discoverOrchestrators(profile, peers);
|
|
288
|
+
assert.equal(candidates.length, peers.length);
|
|
289
|
+
for (const [i, candidate] of candidates.entries()) {
|
|
290
|
+
assert.equal(candidate.label, `Peer ${i}`, `peer-${i} label must survive pagination`);
|
|
291
|
+
assert.equal(candidate.workspace, `/repo-${i}`, `peer-${i} workspace must survive pagination`);
|
|
292
|
+
}
|
|
293
|
+
const stateOnly = discoverOrchestrators(profile, peers, Date.now(), { stateOnly: true });
|
|
294
|
+
for (const [i, candidate] of stateOnly.entries()) {
|
|
295
|
+
assert.equal(candidate.statePublished, true, `peer-${i} curated state must survive pagination`);
|
|
296
|
+
}
|
|
297
|
+
} finally { publishers.forEach(publisher => publisher.dispose()); }
|
|
298
|
+
});
|
|
@@ -54,7 +54,14 @@ test("rendered orchestrator core and selected declarations fit the byte budget",
|
|
|
54
54
|
t.diagnostic(`rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
|
|
55
55
|
// Issue #2935 (user decision): 16,600 -> 16,700 B with the canonical core budget raise to 9,350 B,
|
|
56
56
|
// so the resolved-skill-read exception keeps the full confinement wording.
|
|
57
|
-
|
|
57
|
+
// cost-speed-painpoints S5 (T4): subagent_run states what admission rejects and the core dropped its duplicate
|
|
58
|
+
// Identity Contract pointer; measured 16,674 -> 16,694 B: 16,700 -> 16,694 B.
|
|
59
|
+
// cost-speed-painpoints S15 P7 (S7): the classified-work sentence of orchestrator_session_id became conditional; 16,694 -> 16,691 B.
|
|
60
|
+
// cost-speed-painpoints S15 P5a: always-on verdicts C7, C9, C12, X1, X3 and C8; 16,691 -> 16,683 B.
|
|
61
|
+
// cost-speed P14 (PD-81): the core's Evidence-budget lookup number matches the runtime; 16,683 -> 16,671 B.
|
|
62
|
+
// #3188: orchestrator_session_id state also accepts a JSON string (same validation), +18 B structural anyOf
|
|
63
|
+
// variant with no added description text; 16,671 -> 16,689 B.
|
|
64
|
+
assert.ok(total <= 16689, `rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
|
|
58
65
|
});
|
|
59
66
|
|
|
60
67
|
// Pi 1.4 does not export its pure system assembler from the package root.
|
|
@@ -121,7 +128,9 @@ test("fixed harness is independent of ambient background policy", () => {
|
|
|
121
128
|
});
|
|
122
129
|
|
|
123
130
|
const schemaDigests: Record<string, string> = {
|
|
124
|
-
|
|
131
|
+
// #3188: intentional structural change — state also accepts a JSON string
|
|
132
|
+
// (parsed and validated with the same rules as the object form).
|
|
133
|
+
orchestrator_session_id: "fdd8a6164daeab8625e2569345af0a8fe35a3407c9911823bca44333160e9c9d",
|
|
125
134
|
orchestrator_list: "fe50d306a023bfaf20fddeb8696a3e62b84534b02efb6d699f9991b129a709fa",
|
|
126
135
|
subagent_run: "02e15acc80fde692b0e7ceab434c248b733f33783b176606119969952cd16036",
|
|
127
136
|
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import test, { after, before } from "node:test";
|
|
6
|
+
import gentleAgents from "../extensions/gentle-agents.ts";
|
|
7
|
+
import { __testing, createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
8
|
+
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// cost-speed-painpoints S5 (T4): orchestrator prompt diet.
|
|
11
|
+
//
|
|
12
|
+
// The always-on primary prompt is paid on every parent turn, and in full
|
|
13
|
+
// delegation the parent carries it for most of the session's cost. These
|
|
14
|
+
// contracts pin the five changes through the rendered primary prompt for both
|
|
15
|
+
// workflow modes and both personas, plus the lazy assets and tool declarations
|
|
16
|
+
// they touch, and the lowered byte budgets that keep the diet from regrowing.
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
const REPO_ROOT = join(import.meta.dirname, "..");
|
|
20
|
+
const ASSETS = join(REPO_ROOT, "assets");
|
|
21
|
+
const MODES = ["organic", "full-delegation"] as const;
|
|
22
|
+
const PERSONAS = ["gentleman", "neutral"] as const;
|
|
23
|
+
const ACTIVE_TOOLS = ["read", "bash", "edit", "write", "subagent_run"] as const;
|
|
24
|
+
|
|
25
|
+
let scratch: string;
|
|
26
|
+
const previousConfigHome = process.env.GENTLE_PI_CONFIG_HOME;
|
|
27
|
+
before(() => {
|
|
28
|
+
scratch = mkdtempSync(join(tmpdir(), "t4-diet-"));
|
|
29
|
+
process.env.GENTLE_PI_CONFIG_HOME = join(scratch, "config");
|
|
30
|
+
});
|
|
31
|
+
after(() => {
|
|
32
|
+
if (previousConfigHome === undefined) delete process.env.GENTLE_PI_CONFIG_HOME;
|
|
33
|
+
else process.env.GENTLE_PI_CONFIG_HOME = previousConfigHome;
|
|
34
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
function render(persona: (typeof PERSONAS)[number], mode: (typeof MODES)[number]): string {
|
|
38
|
+
return __testing.buildGentlePrompt(persona, join(scratch, "project"), ACTIVE_TOOLS, undefined, undefined, mode).replaceAll(ASSETS, "/a");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function read(name: string): string {
|
|
42
|
+
return readFileSync(join(ASSETS, name), "utf8");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type Declaration = { name: string; description: string; promptSnippet?: string; promptGuidelines?: string[] };
|
|
46
|
+
function registeredTools(): Map<string, Declaration> {
|
|
47
|
+
const tools = new Map<string, Declaration>();
|
|
48
|
+
const pi = {
|
|
49
|
+
on() {}, registerCommand() {}, registerShortcut() {}, registerMessageRenderer() {}, registerEntryRenderer() {},
|
|
50
|
+
events: { on() {}, emit() {} },
|
|
51
|
+
registerTool(tool: Declaration) { tools.set(tool.name, tool); },
|
|
52
|
+
};
|
|
53
|
+
gentleAgents(pi as never, { GENTLE_PI_CONFIG_HOME: scratch }, { home: scratch, agentHome: scratch });
|
|
54
|
+
createGentleAiExtension({ nativeReviewCli: null })(pi as never);
|
|
55
|
+
return tools;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// --- Change 1: the Language Boundary reaches both modes -------------------
|
|
59
|
+
|
|
60
|
+
const ARTIFACTS_IN_ENGLISH = "(code, code comments, UI copy, identifiers, commit messages, filenames, PR descriptions, tests, fixtures, delegated outputs, and repository-facing documentation) default to English, regardless of the user's conversation language or active persona. Override only when the user explicitly requests another language for that artifact, or when extending a project whose existing convention is non-English.";
|
|
61
|
+
const PUBLIC_COMMENTS = "Public/contextual comments and replies are different from technical artifacts.";
|
|
62
|
+
|
|
63
|
+
test("S5 change 1: the full delegation primary carries the Language Boundary (technical artifacts default to English)", () => {
|
|
64
|
+
for (const persona of PERSONAS) {
|
|
65
|
+
const prompt = render(persona, "full-delegation");
|
|
66
|
+
assert.match(prompt, /^## Language Boundary$/m, `[${persona}] full delegation lost the Language Boundary heading`);
|
|
67
|
+
assert.ok(prompt.includes(`Generated technical artifacts — whether by the parent or by subagents — ${ARTIFACTS_IN_ENGLISH}`), `[${persona}] full delegation lost the English-artifacts rule`);
|
|
68
|
+
assert.ok(prompt.includes(PUBLIC_COMMENTS), `[${persona}] full delegation lost the public-comment language rule`);
|
|
69
|
+
assert.ok(prompt.includes("Subagent-facing English delegation and quote/UI exceptions: `orchestrator-full-delegation-card.md`."), `[${persona}] the pointer must name the card that carries those exceptions`);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("S5 change 1 (preserve): organic keeps the Language Boundary byte for byte", () => {
|
|
74
|
+
const raw = read("orchestrator.md");
|
|
75
|
+
const section = raw.slice(raw.indexOf("## Language Boundary"), raw.indexOf("\n## ", raw.indexOf("## Language Boundary") + 1));
|
|
76
|
+
assert.ok(section.includes(`Generated technical artifacts — whether by the parent inline or by subagents — ${ARTIFACTS_IN_ENGLISH}`));
|
|
77
|
+
for (const persona of PERSONAS) assert.ok(render(persona, "organic").includes(section.trim()), `[${persona}] organic must render the asset's Language Boundary verbatim`);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// --- Change 2: writer-only test-first detail leaves the full delegation parent --
|
|
81
|
+
|
|
82
|
+
const ORGANIC_TEST_FIRST_OPENING = "- For behavior changes with applicable runnable deterministic tests and a clear expected outcome, use test-first by default";
|
|
83
|
+
const FULL_DELEGATION_TEST_FIRST = "- Writers apply test-first (RED, GREEN, PRESERVE with its differential check) from their own contract; forward it in every writer handoff and require their observed RED/GREEN evidence or stated exception. Never invent lifecycle evidence or skip checks.";
|
|
84
|
+
|
|
85
|
+
test("S5 change 2: the full delegation parent carries one short test-first forwarding rule, not the writer procedure", () => {
|
|
86
|
+
for (const persona of PERSONAS) {
|
|
87
|
+
const prompt = render(persona, "full-delegation");
|
|
88
|
+
assert.ok(prompt.includes(FULL_DELEGATION_TEST_FIRST), `[${persona}] full delegation must forward test-first to writers and require their evidence`);
|
|
89
|
+
assert.ok(!prompt.includes(ORGANIC_TEST_FIRST_OPENING), `[${persona}] full delegation must not carry the writer-applied test-first bullet`);
|
|
90
|
+
assert.ok(!prompt.includes("Write one RED test per requested rule."), `[${persona}] writer procedure leaked into the full delegation parent`);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("S5 change 2 (preserve): organic keeps the full test-first bullet, and the worker still carries the procedure", () => {
|
|
95
|
+
for (const persona of PERSONAS) {
|
|
96
|
+
const bullet = render(persona, "organic").split("\n").find((line) => line.startsWith(ORGANIC_TEST_FIRST_OPENING));
|
|
97
|
+
assert.ok(bullet, `[${persona}] organic lost the test-first bullet`);
|
|
98
|
+
for (const clause of ["Write one RED test per requested rule.", "run one differential check before finishing", "Never invent lifecycle evidence or skip checks.", "Follow orchestrator-delegation.md for ODD forwarding and evidence."]) {
|
|
99
|
+
assert.ok(bullet.includes(clause), `[${persona}] organic test-first bullet lost: ${clause}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const worker = read("agents/gentle-ai-worker.md");
|
|
103
|
+
for (const clause of ["RED", "GREEN", "PRESERVE", "run one differential check before finishing", "no meaningful RED"]) assert.ok(worker.includes(clause), `worker lost ${clause}`);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// --- Change 3: the Engram mirror is written at task transitions ------------
|
|
107
|
+
|
|
108
|
+
const MIRROR_CADENCE = "Refresh the Engram mirror once per task transition (a task starts, finishes, is blocked, reopened, or dropped) or material plan change, and at close; `## Log` entries and evidence added between those points go to the file only and reach the mirror at the next one.";
|
|
109
|
+
|
|
110
|
+
test("S5 change 3: the mirror cadence is per task transition, with log entries reaching it at the next transition", () => {
|
|
111
|
+
const memory = read("orchestrator-memory.md");
|
|
112
|
+
assert.ok(memory.includes(MIRROR_CADENCE), "orchestrator-memory.md must state the per-transition mirror cadence");
|
|
113
|
+
// The file stays the source and the PR #3083 wording stays: no custom reconciliation gates.
|
|
114
|
+
assert.ok(memory.includes("The file is the source: a mirror that differs from the file just written is refreshed from the file, never a blocker."));
|
|
115
|
+
assert.ok(memory.includes("never author comparison or reconciliation scripts or gates for them"));
|
|
116
|
+
assert.ok(memory.includes("On resume, use `mem_context`"), "resume guarantees must stay");
|
|
117
|
+
assert.doesNotMatch(read("orchestrator-tracking.md"), /mirror[^.]*(?:after every (?:edit|log entry|write)|on every (?:edit|log entry|write))/i, "tracking must not contradict the cadence");
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// --- Change 4: admission requirements are stated where the launch is composed --
|
|
121
|
+
|
|
122
|
+
const ADMISSION = "Admission rejects writers without repository-relative `## Allowed edit surfaces`; below the context backstop, organic writers without `Spec: odd/tasks/<existing>.md, T<n>` (2+ disjoint writers alone in one message pass) and `gentle-ai-verify` without that or `Risk: item N`.";
|
|
123
|
+
|
|
124
|
+
test("S5 change 4: the subagent_run description names what admission rejects", () => {
|
|
125
|
+
const run = registeredTools().get("subagent_run");
|
|
126
|
+
assert.ok(run, "subagent_run must be registered");
|
|
127
|
+
assert.ok(run.description.startsWith("Delegate a task to a named subagent."), "the original description stays first");
|
|
128
|
+
assert.ok(run.description.includes(ADMISSION), "the admission sentence must be stated exactly");
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// --- Change 5: literal duplicates leave the always-on prompt ----------------
|
|
132
|
+
|
|
133
|
+
test("S5 change 5: the persistent-memory rule is stated once (Identity), not again in Harness principles", () => {
|
|
134
|
+
for (const mode of MODES) for (const persona of PERSONAS) {
|
|
135
|
+
const prompt = render(persona, mode);
|
|
136
|
+
assert.equal(prompt.split("never invent persistent memory").length - 1, 1, `[${mode}/${persona}] Identity memory rule must stay once`);
|
|
137
|
+
assert.ok(!prompt.includes("Never claim persistent memory is available because of this package."), `[${mode}/${persona}] harness duplicate must go`);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("S5 change 5: the neutral persona states its Spanish register once (persona bullets), with no second Language line", () => {
|
|
142
|
+
for (const mode of MODES) {
|
|
143
|
+
const prompt = render("neutral", mode);
|
|
144
|
+
assert.ok(!prompt.includes("Language: neutral/professional Spanish when the user writes Spanish."), `[${mode}] neutral duplicate Language line must go`);
|
|
145
|
+
assert.ok(prompt.includes("- When the user writes Spanish, use neutral/professional Spanish. Do NOT use voseo or any regional conjugations"), `[${mode}] neutral register rule must stay`);
|
|
146
|
+
assert.ok(prompt.includes("- Do not use slang or regional expressions."), `[${mode}] regional-expressions rule must stay`);
|
|
147
|
+
// P14 (PD-57): the gentleman persona also states its register once, in its persona bullet.
|
|
148
|
+
const gentleman = render("gentleman", mode);
|
|
149
|
+
assert.ok(!gentleman.includes("Language: natural Rioplatense Spanish with voseo when the user writes Spanish."), `[${mode}] gentleman duplicate Language line must go`);
|
|
150
|
+
assert.ok(gentleman.includes("- When the user writes Spanish, answer in natural Rioplatense Spanish with voseo."), `[${mode}] gentleman register rule must stay`);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("S5 change 5: gentle_odd_phase does not restate the Phase reporting cadence, but keeps its own rules", () => {
|
|
155
|
+
const phase = registeredTools().get("gentle_odd_phase");
|
|
156
|
+
assert.ok(phase, "gentle_odd_phase must be registered");
|
|
157
|
+
const prose = [phase.promptSnippet ?? "", ...(phase.promptGuidelines ?? [])].join("\n");
|
|
158
|
+
assert.ok(!/never per tool call|never poll or report per tool call/.test(prose), "the cadence lives once, in the always-on Phase reporting line");
|
|
159
|
+
assert.ok(prose.includes("Pass phase exactly as its schema enum"), "schema rule must stay");
|
|
160
|
+
assert.ok(prose.includes("Never call this from a subagent or background/child task"), "child rule must stay: children do not receive Phase reporting");
|
|
161
|
+
for (const mode of MODES) {
|
|
162
|
+
assert.ok(render("gentleman", mode).includes("call `gentle_odd_phase` only when the primary session's ODD phase actually changes, never per tool call or on a fixed cadence, and never from a subagent"), `[${mode}] Phase reporting keeps the cadence`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// --- Net bytes: both modes shrink, and the pins follow ----------------------
|
|
167
|
+
|
|
168
|
+
// Measured at /a (normalized assets root), ACTIVE_TOOLS, default RDD line. Base c09189269 rendered
|
|
169
|
+
// organic 25,482/25,778 B and full delegation 23,309/23,605 B (gentleman/neutral); the diet pins the new sizes.
|
|
170
|
+
// cost-speed-painpoints S15 P5a: the verifier-setup paragraph moved to orchestrator-verification.md and the
|
|
171
|
+
// always-on verdicts landed; measured organic 24,256/24,428 B and full delegation 22,161/22,333 B (default RDD line).
|
|
172
|
+
// Verifier B1: the full-delegation Verify mechanism routes a verifier setup failure to that module (+92 B).
|
|
173
|
+
// cost-speed P14: the duplicate gentleman Language line (-80 B, PD-57) and the core's evidence-budget number aligned
|
|
174
|
+
// to the runtime (-12 B in both modes, PD-81); measured organic 24,164/24,416 B and full delegation 22,131/22,383 B.
|
|
175
|
+
const PRIMARY_PROMPT_BUDGETS: Record<(typeof MODES)[number], Record<(typeof PERSONAS)[number], number>> = {
|
|
176
|
+
organic: { gentleman: 24_164, neutral: 24_416 },
|
|
177
|
+
// cost-speed P6 (X9): launch form, continue-one-worker rule and the tracking pointer, paid by the motivation
|
|
178
|
+
// sentence and a duplicate of step 6's verbatim-request rule (22,253/22,425 -> 22,223/22,395 B).
|
|
179
|
+
// cost-speed P6b: the launch sentence names the same assistant message, the `codemode` route and the sequential
|
|
180
|
+
// tools (+126 B), paid by tightening five sentences of the same asset (22,131/22,383 -> 22,128/22,380 B).
|
|
181
|
+
"full-delegation": { gentleman: 22_128, neutral: 22_380 },
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
test("S5: the rendered primary prompt fits the lowered per-mode budgets", (t) => {
|
|
185
|
+
for (const mode of MODES) for (const persona of PERSONAS) {
|
|
186
|
+
const bytes = Buffer.byteLength(render(persona, mode), "utf8");
|
|
187
|
+
t.diagnostic(`${mode}/${persona}: ${bytes} B (budget ${PRIMARY_PROMPT_BUDGETS[mode][persona]} B)`);
|
|
188
|
+
assert.ok(bytes <= PRIMARY_PROMPT_BUDGETS[mode][persona], `${mode}/${persona} primary prompt is ${bytes} B, over ${PRIMARY_PROMPT_BUDGETS[mode][persona]} B`);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// --- Verifier follow-up A1: the differential-check pointer is true in both modes --
|
|
193
|
+
|
|
194
|
+
test("S5 A1: the card and its source forward the differential check without naming the harness policy", () => {
|
|
195
|
+
for (const name of ["orchestrator-delegation.md", "orchestrator-full-delegation-card.md"]) {
|
|
196
|
+
const text = read(name);
|
|
197
|
+
assert.ok(!text.includes("the harness test-first policy's differential check"), `${name} must not point at a harness bullet full delegation no longer carries`);
|
|
198
|
+
const line = text.split("\n").find((candidate) => candidate.startsWith("**Differential check (PRESERVE):**"));
|
|
199
|
+
assert.ok(line?.includes("forward the test-first differential check to writers"), `${name} must still forward the differential check to writers`);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// --- Change 4 behavior: the admission sentence matches the admission code ---
|
|
204
|
+
|
|
205
|
+
test("S5 change 4: admission behaves as the subagent_run sentence states", async () => {
|
|
206
|
+
const { rejectUndocumentedWriterLaunch } = await import("../lib/bounded-writer-admission.ts");
|
|
207
|
+
const { rejectUnriskedVerifierLaunch } = await import("../lib/verifier-admission.ts");
|
|
208
|
+
const root = mkdtempSync(join(scratch, "admission-"));
|
|
209
|
+
const belowBackstop = { tokens: 1_000, contextWindow: 1_000_000 };
|
|
210
|
+
const env = {};
|
|
211
|
+
const writer = { agent: "gentle-ai-worker", task: "Change one file.\n\n## Allowed edit surfaces\nsrc/a.ts" };
|
|
212
|
+
assert.ok(rejectUndocumentedWriterLaunch(writer, { root, contextUsage: belowBackstop, env, orchestratorMode: "organic" })?.block, "organic writer without Spec: is rejected below the backstop");
|
|
213
|
+
assert.equal(rejectUndocumentedWriterLaunch(writer, { root, contextUsage: belowBackstop, env, orchestratorMode: "full-delegation" }), undefined, "full delegation never rejects a writer for a missing Spec:");
|
|
214
|
+
const sibling = { agent: "gentle-ai-worker", task: "Change another file.\n\n## Allowed edit surfaces\nsrc/b.ts" };
|
|
215
|
+
const batch = [writer, sibling].map(input => ({ name: "subagent_run", arguments: input }));
|
|
216
|
+
assert.equal(rejectUndocumentedWriterLaunch(writer, { root, contextUsage: belowBackstop, env, orchestratorMode: "organic", sameMessageCalls: batch }), undefined, "2+ disjoint writers alone in one message pass");
|
|
217
|
+
assert.ok(rejectUndocumentedWriterLaunch(writer, { root, contextUsage: belowBackstop, env, orchestratorMode: "organic", sameMessageCalls: [...batch, { name: "read", arguments: { path: "a" } }] })?.block, "not with another call beside them");
|
|
218
|
+
const verifier = { agent: "gentle-ai-verify", task: "Verify the change." };
|
|
219
|
+
assert.ok(rejectUnriskedVerifierLaunch(verifier, { root, contextUsage: belowBackstop, env })?.block, "verifier without Risk: item N or Spec: is rejected (admission takes no mode, so full delegation too)");
|
|
220
|
+
assert.equal(rejectUnriskedVerifierLaunch({ ...verifier, task: "Verify the change.\nRisk: item 3 (shared parser)" }, { root, contextUsage: belowBackstop, env }), undefined, "a declared Risk: item 3 is admitted");
|
|
221
|
+
});
|
|
@@ -6,8 +6,9 @@ import { readDelegationDetail } from "./support/orchestrator-modules.ts";
|
|
|
6
6
|
|
|
7
7
|
const ROOT = join(import.meta.dirname, "..");
|
|
8
8
|
const ASSETS = join(ROOT, "assets");
|
|
9
|
+
// cost-speed-painpoints S15 P5a (verdict X1): the contract is injected only while RDD is not off.
|
|
9
10
|
const BOUNDARY =
|
|
10
|
-
"
|
|
11
|
+
"While RDD is not off, this package injects the mirrored provider-bundle review execution contract; Gentle AI writes nothing into this prompt. Absent that mirrored contract, this package invents no lifecycle instructions.";
|
|
11
12
|
|
|
12
13
|
function read(relativePath: string): string {
|
|
13
14
|
return readFileSync(join(ROOT, relativePath), "utf8");
|
|
@@ -174,8 +174,10 @@ test("64 unique-peer cap is deterministic; whole-row byte omissions account for
|
|
|
174
174
|
const ambiguous = searchPublishedWork(profile, [...peers, { ...peers[65], endpoint: "/duplicate" }], relatedFilter);
|
|
175
175
|
assert.equal(ambiguous.source?.status, "unavailable");
|
|
176
176
|
assert.equal(ambiguous.matches.length, 0);
|
|
177
|
-
// Directory entries, not admitted headers, bound the presence scan
|
|
178
|
-
|
|
177
|
+
// Directory entries, not admitted headers, bound the presence scan: only the
|
|
178
|
+
// TOTAL 4096-entry budget fails closed now — a busy directory past the first
|
|
179
|
+
// 128-entry page no longer blinds peers (#3185).
|
|
180
|
+
for (let i = 0; i < 4096; i++) writeFileSync(join(profile, "gentle-agents", "presence", `overflow-${i}`), "");
|
|
179
181
|
assert.equal(searchPublishedWork(profile, peers).coverage.unknownContext, 64);
|
|
180
182
|
const rejected = searchPublishedWork(profile, peers, relatedFilter);
|
|
181
183
|
assert.equal(rejected.source?.reason, "source-context-unavailable");
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test from "node:test";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import {
|
|
5
|
+
import { DESIGN_CANVAS_ASSETS } from "../lib/design-canvas-assets.ts";
|
|
6
|
+
import { designCanvasAssetPaths, missingRequiredPaths, requiredPaths } from "../scripts/verify-package-files.mjs";
|
|
5
7
|
|
|
6
8
|
// The voice worker is spawned by path and never imported, so only the package
|
|
7
9
|
// check keeps it in the published tarball next to the modules that launch it.
|
|
8
10
|
|
|
9
11
|
const root = fileURLToPath(new URL("..", import.meta.url));
|
|
10
12
|
|
|
13
|
+
// prepack and prepublishOnly run the check with plain `node`, and Node 23.0-23.5
|
|
14
|
+
// (inside engines >=22.19.0) cannot load TypeScript without a flag.
|
|
15
|
+
test("the package check runs on a Node without TypeScript type stripping", async () => {
|
|
16
|
+
const result = spawnSync(process.execPath, ["--no-experimental-strip-types", "scripts/verify-package-files.mjs"], { cwd: root, encoding: "utf8" });
|
|
17
|
+
assert.equal(result.stderr, "");
|
|
18
|
+
assert.equal(result.status, 0);
|
|
19
|
+
assert.match(result.stdout, /^gentle-pi package resource check passed/);
|
|
20
|
+
const runtime = await import("../runtime/design-canvas-assets.mjs");
|
|
21
|
+
assert.deepEqual(runtime.DESIGN_CANVAS_ASSETS, DESIGN_CANVAS_ASSETS, "the generated module lists the same assets");
|
|
22
|
+
assert.ok(requiredPaths.includes("runtime/design-canvas-assets.mjs"));
|
|
23
|
+
});
|
|
24
|
+
|
|
11
25
|
test("the package check requires the voice command, its modules and the worker script", () => {
|
|
12
26
|
const voice = ["extensions/gentle-voice.ts", "lib/voice-command.ts", "lib/voice-session.ts", "lib/voice-ui.ts", "scripts/voice-worker.cjs", "docs/voice.md"];
|
|
13
27
|
for (const path of voice) assert.ok(requiredPaths.includes(path), `${path} is required`);
|
|
@@ -17,9 +31,11 @@ test("the package check requires the voice command, its modules and the worker s
|
|
|
17
31
|
// The canvas server reads its page and scripts from assets/ by path, never by import.
|
|
18
32
|
const designCanvas = [
|
|
19
33
|
"lib/design-canvas-server.ts",
|
|
34
|
+
"lib/design-canvas-assets.ts",
|
|
20
35
|
"lib/design-open-browser.ts",
|
|
21
36
|
"lib/design-comments.ts",
|
|
22
37
|
"lib/design-handoffs.ts",
|
|
38
|
+
"lib/design-system-tokens.ts",
|
|
23
39
|
"assets/design-canvas/index.html",
|
|
24
40
|
"assets/design-canvas/canvas.js",
|
|
25
41
|
"assets/design-canvas/canvas.css",
|
|
@@ -32,3 +48,11 @@ test("the package check requires the design command, its helpers and its skill",
|
|
|
32
48
|
for (const path of design) assert.ok(requiredPaths.includes(path), `${path} is required`);
|
|
33
49
|
assert.deepEqual(missingRequiredPaths(root, design), []);
|
|
34
50
|
});
|
|
51
|
+
|
|
52
|
+
// The server's asset allowlist is the package's list of canvas files (S2).
|
|
53
|
+
test("the package check requires every canvas asset the server serves", () => {
|
|
54
|
+
const assets = Object.keys(DESIGN_CANVAS_ASSETS).map((name) => `assets/design-canvas/${name}`);
|
|
55
|
+
assert.deepEqual([...designCanvasAssetPaths], assets);
|
|
56
|
+
for (const path of assets) assert.ok(requiredPaths.includes(path), `${path} is required`);
|
|
57
|
+
assert.deepEqual(missingRequiredPaths(root, assets), []);
|
|
58
|
+
});
|
|
@@ -136,7 +136,7 @@ test("technical reference declares the tested Pi minimum required for agent_sett
|
|
|
136
136
|
assert.equal(manifest.peerDependencies?.["@earendil-works/pi-coding-agent"], ">=1.2.0");
|
|
137
137
|
assert.equal(manifest.devDependencies?.["@earendil-works/pi-coding-agent"], ">=1.2.0");
|
|
138
138
|
assert.equal(manifest.peerDependenciesMeta?.["@earendil-works/pi-coding-agent"]?.optional, true);
|
|
139
|
-
assert.equal(manifest.engines?.node, "
|
|
139
|
+
assert.equal(manifest.engines?.node, "^22.19.0 || >=23.6.0");
|
|
140
140
|
for (const path of ["docs/readme-reference.md", "docs/gentle-shell.md"]) {
|
|
141
141
|
const source = readFileSync(join(PACKAGE_ROOT, path), "utf8");
|
|
142
142
|
assert.match(source, /Pi 1\.2\.0 or newer/, path);
|
|
@@ -431,20 +431,20 @@ test("package manifest installs pi-pretty through a wrapper without bundling nat
|
|
|
431
431
|
);
|
|
432
432
|
});
|
|
433
433
|
|
|
434
|
-
test("package verification binds the published Gentle AI v4.
|
|
434
|
+
test("package verification binds the published Gentle AI v4.5.0 runtime pin", () => {
|
|
435
435
|
const installer = readFileSync(join(PACKAGE_ROOT, "scripts", "gentle-ai-installer.mjs"), "utf8");
|
|
436
436
|
const binary = readFileSync(join(PACKAGE_ROOT, "lib", "gentle-ai-binary.ts"), "utf8");
|
|
437
437
|
const verifier = readFileSync(join(PACKAGE_ROOT, "scripts", "verify-package-files.mjs"), "utf8");
|
|
438
438
|
|
|
439
|
-
assert.match(installer, /INSTALLER_VERSION = "4\.
|
|
439
|
+
assert.match(installer, /INSTALLER_VERSION = "4\.5\.0"/);
|
|
440
440
|
assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_PACKAGE.*GENTLE_AI_WINDOWS_SOURCE_MODULE/);
|
|
441
|
-
assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:
|
|
441
|
+
assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:81Hsy\+cboAbUse1ORVJuwji6V9sRIGlFwC73EtMdw0c="/);
|
|
442
442
|
assert.match(installer, /GOTOOLCHAIN: "local"/);
|
|
443
443
|
assert.match(installer, /GOSUMDB: "sum\.golang\.org"/);
|
|
444
444
|
assert.match(binary, /GENTLE_AI_VERSION = INSTALLER_VERSION/);
|
|
445
445
|
assert.match(binary, /GO_SUMDB_SOURCE_BUILD/);
|
|
446
446
|
assert.match(binary, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM/);
|
|
447
|
-
assert.match(verifier, /v4\.
|
|
447
|
+
assert.match(verifier, /v4\.5\.0/);
|
|
448
448
|
});
|
|
449
449
|
|
|
450
450
|
|
|
@@ -1857,7 +1857,8 @@ test("normal and forced installation copy generic agents with complete role cont
|
|
|
1857
1857
|
assert.match(source, /Do not use that fallback before CodeGraph is unavailable or fails/);
|
|
1858
1858
|
}
|
|
1859
1859
|
assert.match(source, /Do not (?:edit, write|edit, write, or fix findings)/);
|
|
1860
|
-
|
|
1860
|
+
// Cost/speed S4: reports are compact and never restate the task.
|
|
1861
|
+
assert.match(source, /compact (?:handoff|evidence handoff)/);
|
|
1861
1862
|
assert.match(source, /Do not use review lenses\. RDD review remains independent and parent-owned\./);
|
|
1862
1863
|
if (name === "gentle-ai-verify") {
|
|
1863
1864
|
assert.match(source, /exact test, build, lint, or spec example commands explicitly authorized by the parent/);
|
|
@@ -1948,9 +1949,9 @@ test("pi-pretty wrapper uses cached ESM loading for compiled and pnpm symlink in
|
|
|
1948
1949
|
assert.match(wrapper, /quietToolsEnabled/);
|
|
1949
1950
|
});
|
|
1950
1951
|
|
|
1951
|
-
test("Gentle Shell v4.
|
|
1952
|
+
test("Gentle Shell v4.8.0 package manifest declares the release version", () => {
|
|
1952
1953
|
const packageJson = readPackageJson();
|
|
1953
|
-
assert.equal(packageJson.version, "4.
|
|
1954
|
+
assert.equal(packageJson.version, "4.8.0", "the release manifest must be explicitly pinned to v4.8.0");
|
|
1954
1955
|
assert.equal(packageJson.scripts?.test, "node scripts/run-test-suite.mjs");
|
|
1955
1956
|
assert.ok(packageJson.files?.includes("assets/"));
|
|
1956
1957
|
assert.ok(packageJson.files?.includes("contracts/"));
|
|
@@ -1968,12 +1969,12 @@ test("Gentle Shell v4.7.0 package manifest declares the release version", () =>
|
|
|
1968
1969
|
assert.doesNotMatch(runtime, /execFileSync\("(?:npm|pnpm)", \["publish"/);
|
|
1969
1970
|
});
|
|
1970
1971
|
|
|
1971
|
-
test("bounded review keeps the Judgment Day skill contract at canon metadata version 1.
|
|
1972
|
+
test("bounded review keeps the Judgment Day skill contract at canon metadata version 1.8", () => {
|
|
1972
1973
|
const frontmatter = readAgentFrontmatter(
|
|
1973
1974
|
join(PACKAGE_ROOT, "skills", "judgment-day", "SKILL.md"),
|
|
1974
1975
|
);
|
|
1975
1976
|
|
|
1976
|
-
assert.match(frontmatter, /^ version: "1\.
|
|
1977
|
+
assert.match(frontmatter, /^ version: "1\.8"$/m);
|
|
1977
1978
|
assert.doesNotMatch(frontmatter, /^ version: "1\.4"$/m);
|
|
1978
1979
|
});
|
|
1979
1980
|
|
|
@@ -11,11 +11,14 @@ import test from "node:test";
|
|
|
11
11
|
// the core rule fires, so the condition must live in the core Writer rule.
|
|
12
12
|
const core = readFileSync(join(import.meta.dirname, "..", "assets/orchestrator.md"), "utf8");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// cost-speed-painpoints S15 P5a (verdict C8, user decision L41): the reason is launching the units together in
|
|
15
|
+
// one turn; background is how they run when background mode is on, never a condition of the reason.
|
|
16
|
+
test("T29: the core parallelism reason requires launching the units together in one turn", () => {
|
|
15
17
|
const rule = core.split("\n").find((line) => line.includes("5. **Writer rule**"));
|
|
16
18
|
assert.ok(rule, "core Writer rule is missing");
|
|
17
19
|
assert.ok(
|
|
18
|
-
rule.includes("launched together in background, else inline"),
|
|
19
|
-
"parallelism must require
|
|
20
|
+
rule.includes("launched together in one turn (in background when background mode is on), else inline"),
|
|
21
|
+
"parallelism must require launches together in the same turn, else inline",
|
|
20
22
|
);
|
|
23
|
+
assert.ok(!rule.includes("launched together in background, else inline"), "background must not be the condition");
|
|
21
24
|
});
|