gentle-pi 5.0.0 → 5.1.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 +1 -1
- package/assets/agents/gentle-ai-explore.md +3 -6
- package/assets/agents/gentle-ai-verify.md +1 -1
- package/assets/agents/gentle-ai-worker.md +9 -9
- package/assets/agents/jd-fix-agent.md +1 -1
- package/assets/agents/jd-judge-a.md +0 -1
- package/assets/agents/jd-judge-b.md +0 -1
- package/assets/migrations/agent-body-history.json +6 -0
- package/assets/orchestrator-full-delegation.md +1 -1
- package/assets/orchestrator-maintenance.md +11 -0
- package/assets/orchestrator-quota-recovery.md +1 -1
- package/assets/orchestrator-skills.md +10 -0
- package/assets/orchestrator-verification.md +9 -7
- package/assets/orchestrator.md +1 -1
- package/bin/gentle-shell.mjs +67 -15
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +10 -10
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/manifest.json +5 -5
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/orchestration/pi.md +5 -3
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/routing/pi.md +1 -1
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/lens.schema.json +3 -3
- package/contracts/review-provider-contract-mirror/v1.7.0/bundle/vectors/lens.json +1 -0
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-roles.baseline.json +3 -3
- package/docs/bundled-install.md +2 -2
- package/docs/delegated-verification.md +8 -4
- package/docs/desktop-feed.md +15 -6
- package/docs/desktop-rpc.md +44 -20
- package/docs/gentle-shell-desktop.md +10 -3
- package/docs/gentle-shell.md +17 -13
- package/docs/install-wizard.md +2 -2
- package/docs/odd-preparation-continuity.md +2 -2
- package/docs/permission-modes.md +10 -2
- package/docs/readme-reference.md +46 -11
- package/docs/session-profile-format.md +33 -7
- package/docs/work-continuity.md +7 -7
- package/docs/yolo-mode.md +1 -1
- package/extensions/child-context.ts +2 -11
- package/extensions/gentle-agents.ts +47 -28
- package/extensions/gentle-ai.ts +573 -353
- package/extensions/gentle-desktop-feed.ts +13 -3
- package/extensions/gentle-fast.ts +9 -2
- package/extensions/gentle-shell.ts +142 -55
- package/extensions/gentle-tps.ts +5 -0
- package/extensions/quiet-tools.ts +13 -22
- package/extensions/skill-registry.ts +9 -1
- package/herdr/mods/gentle-agents/snapshot.js +30 -23
- package/herdr/mods/gentle-chat/feed.js +6 -0
- package/herdr/mods/gentle-chat/main.js +76 -16
- package/herdr/mods/gentle-chat/session.js +13 -5
- package/herdr/mods/gentle-chat/snapshot.js +30 -23
- package/herdr/mods/gentle-chat/ui.js +7 -1
- package/herdr/mods/gentle-inspector/main.js +2 -0
- package/herdr/mods/gentle-inspector/snapshot.js +30 -23
- package/herdr/mods/gentle-palette/main.js +1 -1
- package/herdr/mods/gentle-palette/snapshot.js +30 -23
- package/herdr/mods/gentle-pane/snapshot.js +30 -23
- package/herdr/mods/gentle-sidebar/snapshot.js +30 -23
- package/herdr/mods/gentle-spaces/snapshot.js +30 -23
- package/herdr/mods/gentle-status/snapshot.js +30 -23
- package/herdr/mods/gentle-tabs/main.js +3 -2
- package/herdr/mods/gentle-tabs/new-tab.js +9 -0
- package/herdr/mods/gentle-tabs/snapshot.js +30 -23
- package/herdr/mods/gentle-tokens/snapshot.js +30 -23
- package/lib/agent-profiles.ts +50 -10
- package/lib/agents-config.ts +59 -4
- package/lib/agents-runner.ts +34 -1
- package/lib/auto-permission-runtime.ts +2 -1
- package/lib/background-jobs-tools.ts +24 -16
- package/lib/claude-bridge-config.ts +41 -0
- package/lib/desktop-agent-definitions-service.ts +10 -6
- package/lib/desktop-command-rpc.ts +71 -0
- package/lib/desktop-feed-sources.ts +44 -1
- package/lib/desktop-feed.ts +41 -29
- package/lib/desktop-rpc-agent-definitions.ts +7 -3
- package/lib/desktop-rpc-changes.ts +13 -4
- package/lib/desktop-rpc-config.ts +106 -3
- package/lib/exploration-budget.ts +3 -7
- package/lib/gentle-design.ts +23 -4
- package/lib/gentle-shell-desktop.ts +85 -0
- package/lib/gentle-shell-launcher.ts +106 -3
- package/lib/mcp-config.ts +214 -0
- package/lib/native-review-cli.ts +78 -34
- package/lib/odd-phase-inference.ts +1 -1
- package/lib/orchestrator-mode-policy.ts +25 -12
- package/lib/path-consent-fence.ts +113 -0
- package/lib/pi-settings.ts +157 -0
- package/lib/review-continuation-registry.ts +7 -20
- package/lib/review-coordinator.ts +5 -0
- package/lib/review-host-relay.ts +2 -35
- package/lib/review-integration-v2.ts +31 -12
- package/lib/sensitive-paths.ts +22 -2
- package/lib/session-profile-freeze.ts +11 -4
- package/lib/session-worktree-registry.ts +11 -5
- package/lib/shell-card.ts +27 -1
- package/lib/shell-changes-view.ts +6 -2
- package/lib/shell-changes.ts +94 -37
- package/lib/shell-git-worker.ts +158 -0
- package/lib/shell-idle-changes.ts +88 -0
- package/lib/shell-untracked-cache.ts +142 -0
- package/lib/shell-untracked-lines.ts +178 -0
- package/lib/tps-policy.ts +85 -0
- package/lib/vim-editor-adapter.ts +3 -2
- package/lib/voice-artifacts.ts +8 -1
- package/lib/voice-install.ts +7 -3
- package/lib/yolo-session-policy.ts +2 -2
- package/package.json +1 -1
- package/runtime/gentle-shell-desktop.mjs +85 -0
- package/runtime/gentle-shell-launcher.mjs +106 -3
- package/runtime/native-review-cli.mjs +77 -33
- package/runtime/review-integration-v2.mjs +31 -12
- package/runtime/sensitive-paths.mjs +22 -2
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/main-channel.mjs +27 -7
- package/scripts/verify-package-files.mjs +13 -12
- package/skills/rdd-defect-workflow/SKILL.md +2 -2
- package/tests/agent-profiles-workflow.test.ts +102 -0
- package/tests/agents-config.test.ts +1 -2
- package/tests/agents-protocol.test.ts +1 -1
- package/tests/agents-runner.test.ts +94 -2
- package/tests/append-system-prompt-route.test.ts +16 -11
- package/tests/auto-permission-runtime.test.ts +4 -4
- package/tests/bounded-stop-contract.test.ts +50 -62
- package/tests/child-context-files.test.ts +6 -6
- package/tests/child-web-package.test.ts +1 -1
- package/tests/controlled-engineering-editor.test.ts +192 -0
- package/tests/controlled-engineering-launch.test.ts +136 -0
- package/tests/controlled-engineering.test.ts +244 -0
- package/tests/delivery-b-rendered-surfaces.test.ts +1 -1
- package/tests/desktop-feed-tool-summaries.test.ts +1 -1
- package/tests/desktop-feed-transcript.test.ts +17 -0
- package/tests/desktop-feed.test.ts +141 -7
- package/tests/desktop-liveness.test.ts +125 -0
- package/tests/desktop-persona.test.ts +17 -0
- package/tests/desktop-rpc-agent-definitions.test.ts +23 -2
- package/tests/desktop-rpc-changes.test.ts +80 -3
- package/tests/desktop-rpc-config-mcp-fidelity.test.ts +106 -0
- package/tests/desktop-rpc-config-readonly-stores.test.ts +458 -0
- package/tests/desktop-rpc-config.test.ts +5 -2
- package/tests/desktop-rpc-design.test.ts +21 -0
- package/tests/desktop-rpc-session-snapshot-commands.test.ts +50 -0
- package/tests/desktop-session-switch.test.ts +237 -0
- package/tests/desktop-target-session.test.ts +104 -0
- package/tests/destructive-command-guard.test.ts +187 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +73 -9
- package/tests/exploration-budget.test.ts +2 -26
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +14 -10
- package/tests/full-delegation-closure.test.ts +19 -9
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agents.test.ts +214 -9
- package/tests/gentle-ai-exploration-budget.test.ts +3 -2
- package/tests/gentle-ai-installer.test.ts +52 -51
- package/tests/gentle-ai.test.ts +29 -5
- package/tests/gentle-chat-read-failure.test.ts +74 -0
- package/tests/gentle-chat-session-read.test.ts +127 -0
- package/tests/gentle-design.test.ts +39 -0
- package/tests/gentle-shell-desktop.test.ts +108 -0
- package/tests/gentle-shell-launcher-auto-provision.test.ts +152 -0
- package/tests/gentle-shell-launcher-machine-output.test.ts +356 -0
- package/tests/gentle-shell.test.ts +93 -12
- package/tests/gentle-tps.test.ts +57 -0
- package/tests/independent-recovery-delivery.test.ts +15 -13
- package/tests/installer-preflight.test.ts +3 -2
- package/tests/job-turn-end-texts.test.ts +57 -0
- package/tests/lazy-module-contradictions-contract.test.ts +1 -2
- package/tests/main-channel.test.ts +12 -1
- package/tests/maintainer/desktop-rpc.maintest.ts +2 -2
- package/tests/native-review-capability-contract.test.ts +7 -1
- package/tests/native-review-cli.test.ts +113 -1
- package/tests/no-self-pause-contract.test.ts +8 -7
- package/tests/odd-phase-inference.test.ts +2 -2
- package/tests/odd-routing-canonical-ratchet.test.ts +1 -1
- package/tests/odd-routing-contract.test.ts +1 -1
- package/tests/orchestrator-budget.test.ts +7 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +5 -5
- package/tests/orchestrator-skills-inline-contract.test.ts +26 -0
- package/tests/package-manifest.test.ts +11 -16
- package/tests/packaged-agent-codemode.test.ts +79 -0
- package/tests/path-consent-fence.test.ts +326 -0
- package/tests/pi-update-launcher.test.ts +1 -1
- package/tests/primary-session-prompt.test.ts +9 -7
- package/tests/profile-fast-tier.test.ts +79 -4
- package/tests/progress-rule-contract.test.ts +54 -0
- package/tests/rdd-delivery-warning.test.ts +42 -4
- package/tests/review-actor-tool-deny.test.ts +1 -2
- package/tests/review-continuation-registry.test.ts +17 -17
- package/tests/review-controller-native-recovery.test.ts +100 -0
- package/tests/review-controller-native-routing.test.ts +129 -24
- package/tests/review-coordinator.test.ts +14 -0
- package/tests/review-host-relay-restart-parity.test.ts +2 -52
- package/tests/review-host-relay-routing.test.ts +57 -297
- package/tests/review-host-relay.test.ts +0 -46
- package/tests/review-integration-v2-forward.test.ts +39 -2
- package/tests/review-json-arguments.test.ts +30 -9
- package/tests/review-one-call-findings.test.ts +1 -0
- package/tests/review-untracked-inventory-replay.test.ts +181 -0
- package/tests/runtime-harness.mjs +27 -1
- package/tests/sensitive-path-tools.test.ts +155 -4
- package/tests/session-profile-extension.test.ts +90 -11
- package/tests/session-profile-freeze.test.ts +49 -2
- package/tests/session-profile-v1-compat.test.ts +11 -3
- package/tests/session-worktree-registry.test.ts +23 -0
- package/tests/shell-changes-idle-start.test.ts +510 -0
- package/tests/shell-changes-untracked-bound.test.ts +230 -0
- package/tests/shell-changes-view.test.ts +8 -2
- package/tests/shell-changes.test.ts +134 -0
- package/tests/shell-git-runner-stall.test.ts +74 -0
- package/tests/shell-git-worker-fallback.test.ts +140 -0
- package/tests/shell-git-worker-lifetime.test.ts +91 -0
- package/tests/shell-render-cache-runtime.test.ts +256 -3
- package/tests/shell-untracked-cache.test.ts +213 -0
- package/tests/short-check-routing-contract.test.ts +11 -7
- package/tests/skill-registry.test.ts +3 -3
- package/tests/support/chat-ui.ts +39 -0
- package/tests/t7-recovery-preservation.test.ts +68 -0
- package/tests/tps-policy.test.ts +96 -0
- package/tests/turn-end-rule-contract.test.ts +155 -0
- package/tests/turn-end-scope.test.ts +39 -0
- package/tests/verification-scoped-stop-contract.test.ts +1 -1
- package/tests/verification-tiers-contract.test.ts +4 -3
- package/tests/verify-first-launch-contract.test.ts +19 -7
- package/tests/vim-editor-adapter.test.ts +4 -4
- package/tests/voice-install.test.ts +97 -11
- package/tests/windows-hidden-processes.test.ts +11 -44
- package/tests/work-continuity-contract.test.ts +48 -55
- package/tests/yolo-session-policy.test.ts +2 -0
- package/contracts/review-provider-contract-mirror/v1.6.0/bundle/vectors/lens.json +0 -1
- package/extensions/codegraph-tools.ts +0 -437
- package/tests/child-codegraph-bootstrap.test.ts +0 -74
- package/tests/codegraph-tools.test.ts +0 -554
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
import { jobNoticeText, monitorStoppedText } from "../lib/background-jobs-tools.ts";
|
|
5
|
+
import type { JobRecord } from "../lib/background-jobs.ts";
|
|
6
|
+
|
|
7
|
+
const agents = readFileSync(new URL("../extensions/gentle-agents.ts", import.meta.url), "utf8");
|
|
8
|
+
|
|
9
|
+
const job = (overrides: Partial<JobRecord>): JobRecord => ({
|
|
10
|
+
id: "job-1", kind: "command", label: "export", command: "make export", status: "exited", exitCode: 0,
|
|
11
|
+
cwd: "/tmp", ownerSessionId: "s", startedAt: 0, endedAt: 1000, tail: [], outputPath: "/tmp/job-1.log", ...overrides,
|
|
12
|
+
});
|
|
13
|
+
const lastLine = (record: JobRecord) => jobNoticeText(record).split("\n").at(-1);
|
|
14
|
+
|
|
15
|
+
// TypeScript checks the fixture's fields; this structural check guards against bypassing that check.
|
|
16
|
+
test("the notice fixture does not bypass JobRecord checking with an assertion", () => {
|
|
17
|
+
const fixture = readFileSync(import.meta.filename, "utf8").split(/^const job = |^const lastLine = /m)[1];
|
|
18
|
+
assert.ok(fixture, "the JobRecord fixture is present");
|
|
19
|
+
assert.doesNotMatch(fixture, /\bas\s+(?:unknown|JobRecord)\b/);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// turn-end-coherence S1: each job outcome is an obstacle, a limit or a plain result, never the same instruction.
|
|
23
|
+
test("a job the user stopped is reported as a limit: no restart, only independent work continues", () => {
|
|
24
|
+
const line = lastLine(job({ status: "stopped", exitCode: null }));
|
|
25
|
+
assert.equal(line, "The user stopped this job: that is an explicit limit on it. Do not restart it; continue only independent authorized work.");
|
|
26
|
+
assert.match(jobNoticeText(job({ status: "stopped", exitCode: null })), /was stopped by the user/);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("a failed job stays an obstacle and a successful one a result to continue from", () => {
|
|
30
|
+
assert.match(lastLine(job({ exitCode: 7 }))!, /^This failure is an obstacle, not the end of the task:/);
|
|
31
|
+
assert.match(lastLine(job({ status: "failed", exitCode: null, error: "spawn failed" }))!, /^This failure is an obstacle/);
|
|
32
|
+
assert.equal(lastLine(job({})), "This result does not end the task: read it and continue the authorized work that depended on this job.");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("a monitor deadline notice reports the configured limit and allows only necessary authorized watching", () => {
|
|
36
|
+
const monitor = job({ kind: "monitor", label: "checks", status: "stopped", exitCode: null, timeoutSeconds: 30, events: 3 });
|
|
37
|
+
assert.equal(monitorStoppedText(monitor, "timeout"),
|
|
38
|
+
'Monitor job-1 ("checks") reached its 30s timeout after 3 events and ended. This is the limit you set with timeout_seconds, not a failure or a user stop. Start a new monitor only if watching is still needed for authorized work and other limits allow it.\nFull output: /tmp/job-1.log');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("ordinary monitor exit and explicit user stop keep their distinct notices", () => {
|
|
42
|
+
const monitor = job({ kind: "monitor", label: "checks", timeoutSeconds: 30, events: 1 });
|
|
43
|
+
assert.match(jobNoticeText(monitor), /^Monitor job-1 \("checks"\) exited with code 0 after 1s, 1 event\./);
|
|
44
|
+
assert.equal(lastLine(monitor), "This result does not end the task: read it and continue the authorized work that depended on this job.");
|
|
45
|
+
const stopped = { ...monitor, status: "stopped" } as const;
|
|
46
|
+
assert.match(jobNoticeText(stopped), /^Monitor job-1 \("checks"\) was stopped by the user/);
|
|
47
|
+
assert.equal(lastLine(stopped), "The user stopped this job: that is an explicit limit on it. Do not restart it; continue only independent authorized work.");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// turn-end-coherence S4: a blocked standalone sleep is not an instruction to end the turn.
|
|
51
|
+
test("the standalone-sleep rejection sends the agent to independent work before waiting", () => {
|
|
52
|
+
const reason = agents.match(/Standalone sleep is blocked while background work is active[^`]*/)?.[0];
|
|
53
|
+
assert.ok(reason, "the rejection reason is present");
|
|
54
|
+
assert.ok(!reason.includes("End the turn now"), "ending the turn is not the first instruction");
|
|
55
|
+
assert.ok(reason.includes("Continue independent in-scope work; end the turn to wait only when none remains."));
|
|
56
|
+
assert.ok(reason.includes("Each completion arrives automatically as a session message and starts a new turn."));
|
|
57
|
+
});
|
|
@@ -113,14 +113,13 @@ test("Duplicates: tracking keeps no restatement of step 3 or of the Phase report
|
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
-
test("C4:
|
|
116
|
+
test("C4: web and MCP routing follows declared tools and never assigns shell work to the explorer", () => {
|
|
117
117
|
for (const text of [delegation, card]) {
|
|
118
118
|
assert.ok(!text.includes("shell, HTTP or MCP work"), "the card still forbids HTTP or MCP work to the explorer");
|
|
119
119
|
assert.ok(text.includes("never give a read-only explorer shell work"), "the shell restriction must stay");
|
|
120
120
|
assert.ok(text.includes("Check the agent's declared `tools` in `subagent_list_agents` before launching"));
|
|
121
121
|
}
|
|
122
122
|
assert.match(explorer, /^ {2}- web_search$/m, "the explorer declares web tools");
|
|
123
|
-
assert.match(explorer, /^ {2}- mcp__codegraph__codegraph_explore$/m, "the explorer declares an MCP tool");
|
|
124
123
|
assert.doesNotMatch(explorer, /^ {2}- bash$/m, "the explorer declares no shell");
|
|
125
124
|
});
|
|
126
125
|
|
|
@@ -458,12 +458,23 @@ async function upgradeWorld({ userGo = null as string | null, pinned = false, ac
|
|
|
458
458
|
if (acquireFails) throw new Error("Go verified acquisition failed; nothing was published", { cause: new Error("Conflicting Go destination: /x") });
|
|
459
459
|
return { goPath: pinnedGo, version: "1.25.14", acquired: true };
|
|
460
460
|
};
|
|
461
|
-
const upgrade = () => runUpgrade({ args: ["--channel", "main"], ctx: s.ctx, platform: "darwin", arch: "arm64", packageRoot: join(s.root, "pkg"),
|
|
461
|
+
const upgrade = (progressStream?: { write: (chunk: string) => void }) => runUpgrade({ progressStream, args: ["--channel", "main"], ctx: s.ctx, platform: "darwin", arch: "arm64", packageRoot: join(s.root, "pkg"),
|
|
462
462
|
currentVersion: "4.0.0-main.6e7e3a18f794", adapters: { fetch, run, fs: fsPromises, which, acquireGo }, out: () => {} });
|
|
463
463
|
const builtWith = () => calls.find((call) => call.argv[0] === "install")?.command;
|
|
464
464
|
return { ...s, calls, pinnedGo, upgrade, builtWith, acquired };
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
+
test("main upgrade shows active stages and clears progress before a build error", posixOnly, async () => {
|
|
468
|
+
const w = await upgradeWorld({ acquireFails: true });
|
|
469
|
+
const frames: string[] = [];
|
|
470
|
+
try {
|
|
471
|
+
await assert.rejects(w.upgrade({ write: chunk => frames.push(chunk) }), /getting the pinned Go/);
|
|
472
|
+
assert.match(frames.join(""), /Checking main revisions/);
|
|
473
|
+
assert.match(frames.join(""), /Building Gentle AI/);
|
|
474
|
+
assert.equal(frames.at(-1), "\r\x1b[2K");
|
|
475
|
+
} finally { w.cleanup(); }
|
|
476
|
+
});
|
|
477
|
+
|
|
467
478
|
test("upgrading main uses the installer's pinned Go when the user's Go is missing, older or cannot be checked, and leaves the user's Go as it is", posixOnly, async () => {
|
|
468
479
|
for (const userGo of [null, "1.24.0", "devel"]) {
|
|
469
480
|
const w = await upgradeWorld({ userGo, pinned: true });
|
|
@@ -248,10 +248,10 @@ test("installed Pi serves Desktop config reads from the existing stores", () =>
|
|
|
248
248
|
assert.deepEqual(models.data.value, { worker: { model: "openai/gpt-probe" } });
|
|
249
249
|
|
|
250
250
|
const snapshot = byRequest("config-3").data;
|
|
251
|
-
assert.equal(snapshot.state.config.stores.length,
|
|
251
|
+
assert.equal(snapshot.state.config.stores.length, 12);
|
|
252
252
|
assert.deepEqual(
|
|
253
253
|
snapshot.state.config.stores.map((entry: any) => entry.store),
|
|
254
|
-
["profiles", "models", "profile_fallbacks", "subagents", "pins", "managed_assets", "persona", "banner", "notifications"],
|
|
254
|
+
["profiles", "models", "profile_fallbacks", "subagents", "pins", "managed_assets", "persona", "banner", "notifications", "mcp", "pi_settings", "claude_bridge"],
|
|
255
255
|
);
|
|
256
256
|
assert.equal(snapshot.state.config.stores[0].status, "ok");
|
|
257
257
|
assert.equal(JSON.stringify(snapshot).includes("claude-probe"), false, "snapshots stay bounded");
|
|
@@ -422,11 +422,17 @@ test("5.0.0 retains the compact-v2 CLI contract for the runtime pin", () => {
|
|
|
422
422
|
assert.deepEqual(contract, NATIVE_CLI_CONTRACTS["4.6.0"] as Record<string, boolean>);
|
|
423
423
|
});
|
|
424
424
|
|
|
425
|
+
test("5.1.0 retains the 5.0.0 compact-v2 CLI contract for the runtime pin", () => {
|
|
426
|
+
const contract = NATIVE_CLI_CONTRACTS["5.1.0"] as Record<string, boolean>;
|
|
427
|
+
assert.ok(contract, "the published v5.1.0 runtime must have an explicit capability row");
|
|
428
|
+
assert.deepEqual(contract, NATIVE_CLI_CONTRACTS["5.0.0"] as Record<string, boolean>);
|
|
429
|
+
});
|
|
430
|
+
|
|
425
431
|
test("no shipped version key was added beyond the pin bump", () => {
|
|
426
432
|
// Rows are promises to consumers, so a new key only ever appears in a
|
|
427
433
|
// dedicated commit alongside a pin bump, never as a side effect. v2.2.4 and
|
|
428
434
|
// v2.3.0 shipped upstream while Pi stayed on 2.2.3 and were never pinned,
|
|
429
435
|
// so they get no row: a row asserts ground truth measured against a binary
|
|
430
436
|
// Pi actually ran, and the table only has to be ascending, not gapless.
|
|
431
|
-
assert.deepEqual(Object.keys(NATIVE_CLI_CONTRACTS), [...DARK_VERSIONS, "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.4.0", "2.5.0-rc.3", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.8.1", "2.8.2", "2.9.0", "2.9.1", "3.0.0", "3.0.1", "3.1.0", "3.2.1", "3.4.0", "3.5.0", "3.6.0", "3.6.1", "3.7.0", "4.0.0", "4.1.1", "4.2.0", "4.3.1", "4.4.0", "4.5.0", "4.6.0", "5.0.0"]);
|
|
437
|
+
assert.deepEqual(Object.keys(NATIVE_CLI_CONTRACTS), [...DARK_VERSIONS, "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.4.0", "2.5.0-rc.3", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.8.1", "2.8.2", "2.9.0", "2.9.1", "3.0.0", "3.0.1", "3.1.0", "3.2.1", "3.4.0", "3.5.0", "3.6.0", "3.6.1", "3.7.0", "4.0.0", "4.1.1", "4.2.0", "4.3.1", "4.4.0", "4.5.0", "4.6.0", "5.0.0", "5.1.0"]);
|
|
432
438
|
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
2
3
|
import { createHash } from "node:crypto";
|
|
3
|
-
import { mkdtempSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { existsSync, mkdtempSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
4
5
|
import { tmpdir } from "node:os";
|
|
5
6
|
import { join } from "node:path";
|
|
6
7
|
import test from "node:test";
|
|
8
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
9
|
+
import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
7
10
|
import {
|
|
8
11
|
decodeReviewConsentV3,
|
|
9
12
|
} from "../lib/review-integration-v2.ts";
|
|
@@ -1097,6 +1100,115 @@ test("node execFile adapter passes AbortSignal to child_process", async () => {
|
|
|
1097
1100
|
await assert.rejects(pending, (error: unknown) => error instanceof Error && error.name === "AbortError");
|
|
1098
1101
|
});
|
|
1099
1102
|
|
|
1103
|
+
test("POSIX review STATUS settles as timed out when the native child ignores SIGTERM", { skip: process.platform === "win32" }, async (t) => {
|
|
1104
|
+
const cwd = realpathSync(mkdtempSync(join(tmpdir(), "gentle-pi-native-status-")));
|
|
1105
|
+
const invocation = join(cwd, "invocation.json");
|
|
1106
|
+
const binary = join(cwd, "gentle-ai.cjs");
|
|
1107
|
+
t.after(() => {
|
|
1108
|
+
try { process.kill(JSON.parse(readFileSync(invocation, "utf8")).pid, "SIGKILL"); } catch { /* Not started, or already reaped. */ }
|
|
1109
|
+
rmSync(cwd, { recursive: true, force: true });
|
|
1110
|
+
});
|
|
1111
|
+
execFileSync("git", ["init", "-q"], { cwd });
|
|
1112
|
+
const status = negotiatedStartStatus(TARGET, ["--contract=gentle-ai.review-integration/v2"]);
|
|
1113
|
+
writeFileSync(binary, `#!${process.execPath}
|
|
1114
|
+
if (!process.argv.includes("--lineage")) {
|
|
1115
|
+
process.stdout.write(${JSON.stringify(JSON.stringify(status))});
|
|
1116
|
+
} else {
|
|
1117
|
+
process.on("SIGTERM", () => {});
|
|
1118
|
+
require("node:fs").writeFileSync(${JSON.stringify(invocation)}, JSON.stringify({ argv: process.argv.slice(2), pid: process.pid }));
|
|
1119
|
+
setTimeout(() => {}, 10_000);
|
|
1120
|
+
}
|
|
1121
|
+
`, { mode: 0o700 });
|
|
1122
|
+
let review: { execute(id: string, parameters: Record<string, unknown>, signal: undefined, onUpdate: undefined, context: unknown): Promise<{ details: Record<string, unknown>; content: unknown }> };
|
|
1123
|
+
createGentleAiExtension({ nativeReviewCli: new NativeReviewCliV216(createNodeExecFileAdapter(), binary, 300), candidateViews: null, processEnv: { GENTLE_AI_TELEMETRY: "0" } })(
|
|
1124
|
+
{ on() {}, registerCommand() {}, registerTool(tool: typeof review & { name: string }) { if (tool.name === "gentle_review") review = tool; } } as never);
|
|
1125
|
+
const context = { cwd, hasUI: false, sessionManager: { getSessionId: () => cwd } };
|
|
1126
|
+
const normal = await review!.execute("status-complete", { operation: "status" }, undefined, undefined, context);
|
|
1127
|
+
assert.deepEqual(normal.details, { operation: "status", status: "ready", result: status });
|
|
1128
|
+
|
|
1129
|
+
const lineageId = "stalled-native-status";
|
|
1130
|
+
const pending = review!.execute("status-timeout", { operation: "status", lineageId }, undefined, undefined, context);
|
|
1131
|
+
const result = await Promise.race([pending, delay(1_500, "still pending", { ref: false })]);
|
|
1132
|
+
const { argv, pid } = JSON.parse(readFileSync(invocation, "utf8"));
|
|
1133
|
+
assert.deepEqual(argv, ["review", "status", "--contract", "gentle-ai.review-integration/v2", "--cwd", cwd, "--projection", "workspace", "--lineage", lineageId, "--agent", "pi", "--next-transition"]);
|
|
1134
|
+
assert.notEqual(result, "still pending", "STATUS was still pending 1,500 ms after invocation (native deadline 300 ms)");
|
|
1135
|
+
if (typeof result === "string") return;
|
|
1136
|
+
assert.deepEqual(result.content, [{ type: "text", text: JSON.stringify(result.details) }]);
|
|
1137
|
+
assert.deepEqual({
|
|
1138
|
+
status: result.details.status,
|
|
1139
|
+
outcome: result.details.outcome,
|
|
1140
|
+
mutationPerformed: result.details.mutation_performed,
|
|
1141
|
+
mutationOutcome: result.details.mutation_outcome,
|
|
1142
|
+
nextAction: result.details.next_action,
|
|
1143
|
+
diagnostics: result.details.diagnostics,
|
|
1144
|
+
}, {
|
|
1145
|
+
status: "blocked", outcome: "native-status-timed-out", mutationPerformed: false, mutationOutcome: "none", nextAction: "rerun-native-status",
|
|
1146
|
+
diagnostics: { operation: "review/status", error_code: "timeout", exit_code: 1, timed_out: true, output_limit_exceeded: false },
|
|
1147
|
+
});
|
|
1148
|
+
// Settlement doesn't wait for libuv to reap the signalled child.
|
|
1149
|
+
const reapingDeadline = Date.now() + 1_000;
|
|
1150
|
+
while (Date.now() < reapingDeadline) {
|
|
1151
|
+
try { process.kill(pid, 0); } catch (error) { if ((error as NodeJS.ErrnoException).code === "ESRCH") return; throw error; }
|
|
1152
|
+
await delay(10);
|
|
1153
|
+
}
|
|
1154
|
+
assert.throws(() => process.kill(pid, 0), { code: "ESRCH" }, "timed-out child must not be left running");
|
|
1155
|
+
});
|
|
1156
|
+
|
|
1157
|
+
test("POSIX review STATUS settles as timed out after the native child exits with inherited pipes open", { skip: process.platform === "win32" }, async (t) => {
|
|
1158
|
+
const cwd = realpathSync(mkdtempSync(join(tmpdir(), "gentle-pi-native-status-pipes-")));
|
|
1159
|
+
const invocation = join(cwd, "invocation.json");
|
|
1160
|
+
const binary = join(cwd, "gentle-ai.cjs");
|
|
1161
|
+
const readInvocation = (): { pid: number; descendantPid: number; argv: string[] } => JSON.parse(readFileSync(invocation, "utf8"));
|
|
1162
|
+
t.after(() => {
|
|
1163
|
+
try { process.kill(readInvocation().descendantPid, "SIGKILL"); } catch { /* Not started, or already gone. */ }
|
|
1164
|
+
rmSync(cwd, { recursive: true, force: true });
|
|
1165
|
+
});
|
|
1166
|
+
execFileSync("git", ["init", "-q"], { cwd });
|
|
1167
|
+
writeFileSync(binary, `#!${process.execPath}
|
|
1168
|
+
const { spawn } = require("node:child_process");
|
|
1169
|
+
const { renameSync, writeFileSync } = require("node:fs");
|
|
1170
|
+
const descendant = spawn(process.execPath, ["-e", "setTimeout(() => {}, 30_000)"], { detached: true, stdio: "inherit" });
|
|
1171
|
+
const invocation = ${JSON.stringify(invocation)};
|
|
1172
|
+
writeFileSync(invocation + ".tmp", JSON.stringify({ pid: process.pid, descendantPid: descendant.pid, argv: process.argv.slice(2) }));
|
|
1173
|
+
renameSync(invocation + ".tmp", invocation);
|
|
1174
|
+
process.exit(0);
|
|
1175
|
+
`, { mode: 0o700 });
|
|
1176
|
+
let review: { execute(id: string, parameters: Record<string, unknown>, signal: undefined, onUpdate: undefined, context: unknown): Promise<{ details: Record<string, unknown> }> };
|
|
1177
|
+
createGentleAiExtension({ nativeReviewCli: new NativeReviewCliV216(createNodeExecFileAdapter(), binary, 500), candidateViews: null, processEnv: { GENTLE_AI_TELEMETRY: "0" } })(
|
|
1178
|
+
{ on() {}, registerCommand() {}, registerTool(tool: typeof review & { name: string }) { if (tool.name === "gentle_review") review = tool; } } as never);
|
|
1179
|
+
const lineageId = "exited-native-status";
|
|
1180
|
+
const pending = review!.execute("status-open-pipes", { operation: "status", lineageId }, undefined, undefined, { cwd, hasUI: false, sessionManager: { getSessionId: () => cwd } });
|
|
1181
|
+
const limit = delay(1_500, "still pending", { ref: false });
|
|
1182
|
+
const reaped = async () => {
|
|
1183
|
+
while (!existsSync(invocation)) await delay(10, undefined, { ref: false, signal: t.signal });
|
|
1184
|
+
const record = readInvocation();
|
|
1185
|
+
for (;;) {
|
|
1186
|
+
try { process.kill(record.pid, 0); } catch (error) { if ((error as NodeJS.ErrnoException).code === "ESRCH") return record; throw error; }
|
|
1187
|
+
await delay(10, undefined, { ref: false, signal: t.signal });
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
const first = await Promise.race([reaped(), pending, limit]);
|
|
1191
|
+
assert.ok(typeof first === "object" && "descendantPid" in first, "the native child must exit before STATUS settles");
|
|
1192
|
+
assert.deepEqual(first.argv, ["review", "status", "--contract", "gentle-ai.review-integration/v2", "--cwd", cwd, "--projection", "workspace", "--lineage", lineageId, "--agent", "pi", "--next-transition"]);
|
|
1193
|
+
|
|
1194
|
+
const result = await Promise.race([pending, limit]);
|
|
1195
|
+
assert.ok(typeof result !== "string", "STATUS must settle without waiting for the descendant to close the pipes");
|
|
1196
|
+
assert.equal(result.details.status, "blocked");
|
|
1197
|
+
assert.equal(result.details.outcome, "native-status-timed-out");
|
|
1198
|
+
assert.equal(result.details.mutation_performed, false);
|
|
1199
|
+
assert.equal(result.details.mutation_outcome, "none");
|
|
1200
|
+
assert.deepEqual(result.details.diagnostics, { operation: "review/status", error_code: "timeout", exit_code: 1, timed_out: true, output_limit_exceeded: false });
|
|
1201
|
+
assert.doesNotThrow(() => process.kill(first.descendantPid, 0), "the descendant is still alive when STATUS settles");
|
|
1202
|
+
});
|
|
1203
|
+
|
|
1204
|
+
test("POSIX non-STATUS adapter calls retain Node's ordinary timeout handling", { skip: process.platform === "win32" }, async () => {
|
|
1205
|
+
const result = await createNodeExecFileAdapter()({
|
|
1206
|
+
file: process.execPath, arguments: ["-e", "setTimeout(() => {}, 10_000)"],
|
|
1207
|
+
cwd: process.cwd(), maxBufferBytes: 1024, timeoutMs: 100,
|
|
1208
|
+
});
|
|
1209
|
+
assert.deepEqual(result, { stdout: "", stderr: "", exitCode: 1, signal: "SIGTERM", timedOut: true, outputLimitExceeded: false });
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1100
1212
|
// On Windows, killing gentle-ai alone leaves its git children running against
|
|
1101
1213
|
// the repository index; abort and timeout must take the whole tree down.
|
|
1102
1214
|
test("node execFile adapter kills the whole process tree on Windows abort and timeout", async () => {
|
|
@@ -8,7 +8,7 @@ import { __testing } from "../extensions/gentle-ai.ts";
|
|
|
8
8
|
// stop you between the two and pick the second part up later"; every Gentle
|
|
9
9
|
// cell delivered only the first part and paused by itself. Hedged delivery
|
|
10
10
|
// wording asks for resumable notes and separate commits, never a stop, and
|
|
11
|
-
// the
|
|
11
|
+
// the Close step must not leave runnable authorized tasks pending.
|
|
12
12
|
|
|
13
13
|
const REPO_ROOT = join(import.meta.dirname, "..");
|
|
14
14
|
const read = (relative: string): string => readFileSync(join(REPO_ROOT, relative), "utf8");
|
|
@@ -16,7 +16,7 @@ const read = (relative: string): string => readFileSync(join(REPO_ROOT, relative
|
|
|
16
16
|
const tracking = read("assets/orchestrator-tracking.md");
|
|
17
17
|
const core = read("assets/orchestrator.md");
|
|
18
18
|
|
|
19
|
-
const contextualApproval = '
|
|
19
|
+
const contextualApproval = 'Read short replies ("yes", "go ahead", "eso mismo") against the preceding proposal. Act within scope on clear, informed approval of a concrete change without asking again. Preference alone is not approval. Ask one focused question if change intent is unclear. Contextual approval never substitutes for provider-owned consent, exact-token authorization, or separate publishing and destructive-action permission.';
|
|
20
20
|
const informedClarification = 'Clarify scope, constraints, acceptance criteria, and non-goals when needed for the human to understand the action or to resolve consequential uncertainty. Reuse what is already established; after informed approval, proceed without repeating the clarification unless new consequential uncertainty appears.';
|
|
21
21
|
|
|
22
22
|
test("contextual approval continues the agreed action without weakening consent boundaries", () => {
|
|
@@ -30,10 +30,11 @@ test("clarification preserves understanding without reopening informed approval"
|
|
|
30
30
|
|
|
31
31
|
test("resolved subdecisions retain the original authorized objective", () => {
|
|
32
32
|
const prompt = __testing.buildGentlePrompt("gentleman");
|
|
33
|
-
assert.ok(prompt.includes("
|
|
33
|
+
assert.ok(prompt.includes("After resolving an incident or subdecision, automatically resume safe, necessary in-scope work on the original authorized objective. Recover proportionately and respect explicit user dispositions."));
|
|
34
34
|
assert.ok(!prompt.includes("Investigate pending technical uncertainty"), "the canonical real-human-decision boundary owns that clause");
|
|
35
|
-
assert.ok(prompt.includes("
|
|
36
|
-
assert.ok(prompt.includes("
|
|
35
|
+
assert.ok(prompt.includes("Only a real human decision, explicit user stop, denial, missing consent, exhausted limit, or failure without a permitted route stops only affected work."));
|
|
36
|
+
assert.ok(prompt.includes("Continue independent authorized work; never abandon runnable work or present an unverified outcome as final."));
|
|
37
|
+
assert.ok(prompt.includes("Missing, partial, unavailable, or declined proof bars claiming completion of affected work, not independent authorized work or required authorized checks in budget."));
|
|
37
38
|
// cost-speed-painpoints S15 P4: the verifier-setup rules load with the Verification rule, not on every turn.
|
|
38
39
|
const verification = read("assets/orchestrator-verification.md");
|
|
39
40
|
for (const sentence of [
|
|
@@ -43,7 +44,7 @@ test("resolved subdecisions retain the original authorized objective", () => {
|
|
|
43
44
|
assert.ok(verification.includes(sentence), `verification module keeps: ${sentence}`);
|
|
44
45
|
assert.ok(!prompt.includes(sentence), `always-on prompt no longer carries: ${sentence}`);
|
|
45
46
|
}
|
|
46
|
-
assert.ok(prompt.includes("Do not infer permission for publishing, destructive actions, unrelated scope or native consent
|
|
47
|
+
assert.ok(prompt.includes("Do not infer permission for publishing, destructive actions, unrelated scope or native consent."));
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
function authorizationSection(): string {
|
|
@@ -121,7 +122,7 @@ test("T13: the always-on harness narrows conditional intent and gates Close on p
|
|
|
121
122
|
"harness must say hedged delivery wording is not a stop",
|
|
122
123
|
);
|
|
123
124
|
assert.ok(
|
|
124
|
-
harness.includes("A tracked task ends the turn pending only
|
|
125
|
+
harness.includes("A tracked task ends the turn pending only for launched work still running, a real human decision, denial, missing consent, explicit stop, or exhausted limit."),
|
|
125
126
|
"harness Close step must keep a legitimate pending child or scoped human decision",
|
|
126
127
|
);
|
|
127
128
|
assert.ok(harness.includes("Hedged wording is not a stop."), "harness Close step must keep hedged wording out of stops");
|
|
@@ -6,7 +6,7 @@ import { inferOddPhase } from "../lib/odd-phase-inference.ts";
|
|
|
6
6
|
// working label. Unknown tools and ambiguous shell commands never change it.
|
|
7
7
|
|
|
8
8
|
test("read-only file tools infer exploring", () => {
|
|
9
|
-
for (const tool of ["read", "grep", "find", "ls"
|
|
9
|
+
for (const tool of ["read", "grep", "find", "ls"]) {
|
|
10
10
|
assert.equal(inferOddPhase(tool, { path: "src/index.ts" }), "exploring", tool);
|
|
11
11
|
}
|
|
12
12
|
});
|
|
@@ -110,7 +110,7 @@ test("a checking segment wins over an exploring segment in the same command", ()
|
|
|
110
110
|
// read-only inspection must still read as exploring.
|
|
111
111
|
test("real compound read-only shell commands infer exploring", () => {
|
|
112
112
|
for (const command of [
|
|
113
|
-
`cd /repo && git rev-parse --show-toplevel && ls -d
|
|
113
|
+
`cd /repo && git rev-parse --show-toplevel && ls -d lib 2>/dev/null; git log -1 --oneline; grep -rniI "bridge" --include=*.ts -l . 2>/dev/null | grep -v node_modules | head -30`,
|
|
114
114
|
`ls ~/work | grep -i -E "shell|pi"; for d in ~/work/a ~/dev/b; do [ -d $d ] && echo "== $d" && cd $d && git log -1 --oneline && grep -rniI "bridge" -l . 2>/dev/null | grep -v node_modules | head -20; done`,
|
|
115
115
|
`cd ~/w && grep -rniI "bridge" src | grep -v test | head -15; echo ===; cat ~/.config/settings.json 2>/dev/null | head -40; cd ~/repo && git branch -a --contains 6776520be 2>/dev/null | head`,
|
|
116
116
|
`f=~/.local/bin/tool; ls -la $f; file -h $f; readlink -f $f; head -c 1500 "$(readlink -f $f)" | strings | head -40`,
|
|
@@ -216,7 +216,7 @@ const ANCHORS: readonly RoutingAnchor[] = [
|
|
|
216
216
|
// wait event, not a human decision. Pi's continuity scopes an explicit stop
|
|
217
217
|
// to the work it names without restating the boundary.
|
|
218
218
|
label: "authorized work continues across a pending child",
|
|
219
|
-
canonical: "
|
|
219
|
+
canonical: "A pending child is a wait: completion resumes the turn without asking.",
|
|
220
220
|
mirrors: [
|
|
221
221
|
{ surface: EXTENSION, includes: "An explicit user stop applies only to the work it names." },
|
|
222
222
|
],
|
|
@@ -491,7 +491,7 @@ test("ODD protocol is always-on in the rendered system prompt and runs by defaul
|
|
|
491
491
|
const orderedClauses = [
|
|
492
492
|
"Default workflow: Organic Driven Development (MANDATORY)",
|
|
493
493
|
"predefined workflow of this orchestrator",
|
|
494
|
-
"
|
|
494
|
+
"Every request enters it unasked. Apply it, don't just describe it. Run these steps in this order on every request:",
|
|
495
495
|
"1. **Authorize.**",
|
|
496
496
|
"2. **Explore.**",
|
|
497
497
|
"3. **Resolve uncertainty.**",
|
|
@@ -45,7 +45,12 @@ const FIXTURE_PATH = join(import.meta.dirname, "fixtures", "orchestrator.pre-die
|
|
|
45
45
|
// cost-speed P14 (PD-81): the Evidence-budget lookup number matches the runtime notice; measured 9,189 -> 9,177 B.
|
|
46
46
|
// fix/temp-dir-exemption (user decision 2026-11-16): the confinement clause exempts the OS temp directory
|
|
47
47
|
// (read/write, deleting only what the session or its tools created); approved up to 9,352 B, measured 9,177 -> 9,347 B at the 128-char root.
|
|
48
|
-
|
|
48
|
+
// gentle-shell#348 rebase (2026-11-16): the parent-inline skill-read duty clause (+49 B over its
|
|
49
|
+
// original base) rides on the current 9,347 B baseline; measured below at the 128-char root.
|
|
50
|
+
// review follow-up (2026-11-16): 9,396 B is the new pin for this candidate — the clause was
|
|
51
|
+
// re-approved with the rebase in issues/348 (budget note, 2026-10-30); the previous 9,352 B cap
|
|
52
|
+
// recorded above predates this candidate's clause and is superseded by this pin.
|
|
53
|
+
const BUDGET_BYTES = 9396;
|
|
49
54
|
const MIN_CONTROLLED_LONG_ASSETS_ROOT_CHARS = 93;
|
|
50
55
|
|
|
51
56
|
const LAZY_ASSET_NAMES = [
|
|
@@ -138,7 +143,7 @@ function measureOrchestratorPromptBytes(assetsDir: string): number {
|
|
|
138
143
|
// measuring a shorter render again.
|
|
139
144
|
const RDD_WORST_CASE_LINE = "Receipt-driven development: unknown (native status unavailable)";
|
|
140
145
|
|
|
141
|
-
test("getOrchestratorPrompt return value stays within the canonical 9,
|
|
146
|
+
test("getOrchestratorPrompt return value stays within the canonical 9,396 B budget at a short assets root", () => {
|
|
142
147
|
const rendered = __testing.renderOrchestratorPrompt(representativeProductionAssetsDir);
|
|
143
148
|
assert.ok(
|
|
144
149
|
rendered.includes(RDD_WORST_CASE_LINE),
|
|
@@ -166,11 +166,11 @@ test("S5 change 5: gentle_odd_phase does not restate the Phase reporting cadence
|
|
|
166
166
|
// --- harness-continuity S3: the authorized-work boundary is mode- and RDD-stable ---
|
|
167
167
|
|
|
168
168
|
const CANONICAL_CLOSE = [
|
|
169
|
-
"
|
|
170
|
-
"A tracked task ends the turn pending only
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
169
|
+
"Run authorized in-scope steps. Work through failures with a permitted route. A pending child is a wait: completion resumes the turn without asking.",
|
|
170
|
+
"A tracked task ends the turn pending only for launched work still running, a real human decision, denial, missing consent, explicit stop, or exhausted limit.",
|
|
171
|
+
"Only a real human decision, explicit user stop, denial, missing consent, exhausted limit, or failure without a permitted route stops only affected work.",
|
|
172
|
+
"Continue independent authorized work; never abandon runnable work or present an unverified outcome as final.",
|
|
173
|
+
"Missing, partial, unavailable, or declined proof bars claiming completion of affected work, not independent authorized work or required authorized checks in budget.",
|
|
174
174
|
"Never turn a report into a blind self-reprompt loop.",
|
|
175
175
|
] as const;
|
|
176
176
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
|
|
6
|
+
const readAsset = (name: string) => readFileSync(join(import.meta.dirname, "..", "assets", name), "utf8");
|
|
7
|
+
const skills = readAsset("orchestrator-skills.md");
|
|
8
|
+
const parentExecution = (skills.split(/^### Parent execution\s*$/m)[1] ?? "")
|
|
9
|
+
.split(/^#{1,6} /m)[0].replace(/\s+/g, " ");
|
|
10
|
+
|
|
11
|
+
// Pin the instructions the parent receives, not the output of a scripted model.
|
|
12
|
+
test("the parent is routed to read the exact indexed skill before acting", () => {
|
|
13
|
+
assert.match(readAsset("orchestrator.md"), /inline\/fallbacks: `orchestrator-skills\.md`/);
|
|
14
|
+
assert.match(parentExecution, /read the exact indexed `SKILL\.md` in this session before acting/);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("the parent follows the skill's output contract only after reading it", () => {
|
|
18
|
+
assert.match(parentExecution, /let the skill's declared `## Output Contract` shape the result, so the reply carries the same contract markers applying the skill directly would produce/);
|
|
19
|
+
assert.match(parentExecution, /Never present contract markers without the in-session read/);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("the parent proceeds unskilled on an unreadable path and adds no attribution line", () => {
|
|
23
|
+
assert.match(parentExecution, /If the indexed path is unreadable, proceed unskilled/);
|
|
24
|
+
assert.doesNotMatch(skills, /Skill (applied|unavailable) \(parent\)/);
|
|
25
|
+
assert.doesNotMatch(parentExecution, /attribution/i);
|
|
26
|
+
});
|
|
@@ -61,7 +61,7 @@ const V014_MANAGED_ASSETS = join(
|
|
|
61
61
|
// gentle-ai-explore.md as their exemplar (packaged, absent from the v0.13
|
|
62
62
|
// manifest) after review-refuter.md was retired together with every
|
|
63
63
|
// Pi-authored adversarial review verdict.
|
|
64
|
-
const MANAGED_EXEMPLAR_TOOLS = ["read", "grep", "find", "
|
|
64
|
+
const MANAGED_EXEMPLAR_TOOLS = ["read", "grep", "find", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content", "codemode"];
|
|
65
65
|
const RETIRED_ADVERSARIAL_AGENTS = ["review-refuter.md", "review-validator.md"];
|
|
66
66
|
|
|
67
67
|
interface ManagedAssetsManifest {
|
|
@@ -431,14 +431,14 @@ 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 v5.
|
|
434
|
+
test("package verification binds the published Gentle AI v5.1.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 = "5\.
|
|
439
|
+
assert.match(installer, /INSTALLER_VERSION = "5\.1\.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:SrWjhJn\+hvtGM\+N7O3k5JM3x\+MPxOVDsH4B5QODlYjQ="/);
|
|
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/);
|
|
@@ -1583,8 +1583,8 @@ test("gentle-ai-worker packages the exact scoped writer contract", () => {
|
|
|
1583
1583
|
"edit",
|
|
1584
1584
|
"write",
|
|
1585
1585
|
"bash",
|
|
1586
|
+
"codemode",
|
|
1586
1587
|
"mem_save",
|
|
1587
|
-
"mcp__codegraph__codegraph_explore",
|
|
1588
1588
|
]);
|
|
1589
1589
|
assert.ok(
|
|
1590
1590
|
tools.every((tool) => !tool.startsWith("subagent_")),
|
|
@@ -1703,8 +1703,8 @@ test("package installation gives gentle-ai-worker a loader-compatible scoped ide
|
|
|
1703
1703
|
"edit",
|
|
1704
1704
|
"write",
|
|
1705
1705
|
"bash",
|
|
1706
|
+
"codemode",
|
|
1706
1707
|
"mem_save",
|
|
1707
|
-
"mcp__codegraph__codegraph_explore",
|
|
1708
1708
|
]);
|
|
1709
1709
|
assert.doesNotMatch(
|
|
1710
1710
|
readAgentFrontmatter(installedAgentPath),
|
|
@@ -1828,8 +1828,8 @@ test("global model routing uses PI_CODING_AGENT_DIR for package-installed agents
|
|
|
1828
1828
|
test("normal and forced installation copy generic agents with complete role contracts", () => {
|
|
1829
1829
|
const previousAgentHome = process.env.GENTLE_PI_AGENT_HOME;
|
|
1830
1830
|
const expectedTools = {
|
|
1831
|
-
"gentle-ai-explore": ["read", "grep", "find", "
|
|
1832
|
-
"gentle-ai-verify": ["read", "grep", "find", "bash", "
|
|
1831
|
+
"gentle-ai-explore": ["read", "grep", "find", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content", "codemode"],
|
|
1832
|
+
"gentle-ai-verify": ["read", "grep", "find", "bash", "codemode"],
|
|
1833
1833
|
} as const;
|
|
1834
1834
|
|
|
1835
1835
|
try {
|
|
@@ -1849,12 +1849,7 @@ test("normal and forced installation copy generic agents with complete role cont
|
|
|
1849
1849
|
assert.match(source, /generic ODD work/);
|
|
1850
1850
|
assert.match(source, /Do not (?:fix findings, delegate to child agents|delegate to child agents, commit)/);
|
|
1851
1851
|
if (name === "gentle-ai-explore") {
|
|
1852
|
-
assert.match(source, /
|
|
1853
|
-
assert.match(source, /never ask it to target another path/);
|
|
1854
|
-
assert.match(source, /sole permitted mutation/);
|
|
1855
|
-
assert.match(source, /all tracked files, source files, and other project content remain read-only/);
|
|
1856
|
-
assert.match(source, /CodeGraph reports that it is unavailable or fails/);
|
|
1857
|
-
assert.match(source, /Do not use that fallback before CodeGraph is unavailable or fails/);
|
|
1852
|
+
assert.match(source, /Read and search only\. Do not edit, write, run commands, or mutate project state\./);
|
|
1858
1853
|
}
|
|
1859
1854
|
assert.match(source, /Do not (?:edit, write|edit, write, or fix findings)/);
|
|
1860
1855
|
// Cost/speed S4: reports are compact and never restate the task.
|
|
@@ -1949,9 +1944,9 @@ test("pi-pretty wrapper uses cached ESM loading for compiled and pnpm symlink in
|
|
|
1949
1944
|
assert.match(wrapper, /quietToolsEnabled/);
|
|
1950
1945
|
});
|
|
1951
1946
|
|
|
1952
|
-
test("Gentle Shell v5.
|
|
1947
|
+
test("Gentle Shell v5.1.0 package manifest declares the release version", () => {
|
|
1953
1948
|
const packageJson = readPackageJson();
|
|
1954
|
-
assert.equal(packageJson.version, "5.
|
|
1949
|
+
assert.equal(packageJson.version, "5.1.0", "the release manifest must be explicitly pinned to v5.1.0");
|
|
1955
1950
|
assert.equal(packageJson.scripts?.test, "node scripts/run-test-suite.mjs");
|
|
1956
1951
|
assert.ok(packageJson.files?.includes("assets/"));
|
|
1957
1952
|
assert.ok(packageJson.files?.includes("contracts/"));
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
|
|
6
|
+
// `codemode` is the only route that lets a child batch independent tool calls in
|
|
7
|
+
// one model turn and filter their output before it reaches its context, so every
|
|
8
|
+
// packaged agent that discovers, verifies, or implements declares it. The
|
|
9
|
+
// read-only review actors keep their narrow, deny-all allowlist: a script there
|
|
10
|
+
// would widen the sandbox of the lane whose job is to judge, not to act.
|
|
11
|
+
const ROOT = join(import.meta.dirname, "..");
|
|
12
|
+
const AGENTS_DIR = join(ROOT, "assets", "agents");
|
|
13
|
+
|
|
14
|
+
/** Agents whose unit of work is discovery, verification, or implementation. */
|
|
15
|
+
const CODEMODE_AGENTS = [
|
|
16
|
+
"gentle-ai-explore.md",
|
|
17
|
+
"gentle-ai-verify.md",
|
|
18
|
+
"gentle-ai-worker.md",
|
|
19
|
+
"jd-fix-agent.md",
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
/** Adversarial read-only reviewers: they report findings and never act. */
|
|
23
|
+
const REVIEW_ACTOR_AGENTS = [
|
|
24
|
+
"jd-judge-a.md",
|
|
25
|
+
"jd-judge-b.md",
|
|
26
|
+
"review-risk.md",
|
|
27
|
+
"review-reliability.md",
|
|
28
|
+
"review-resilience.md",
|
|
29
|
+
"review-readability.md",
|
|
30
|
+
] as const;
|
|
31
|
+
|
|
32
|
+
const CODEMODE_TOOL = "codemode";
|
|
33
|
+
|
|
34
|
+
function readDeclaredTools(file: string): string[] {
|
|
35
|
+
const text = readFileSync(join(AGENTS_DIR, file), "utf8");
|
|
36
|
+
const frontmatter = text.match(/^---\n([\s\S]*?)\n---/)?.[1];
|
|
37
|
+
assert.ok(frontmatter, `${file} must have YAML frontmatter`);
|
|
38
|
+
const lines = frontmatter.split("\n");
|
|
39
|
+
const toolsIndex = lines.findIndex((line) => line === "tools:");
|
|
40
|
+
assert.notEqual(toolsIndex, -1, `${file} must declare tools as a YAML list`);
|
|
41
|
+
const tools: string[] = [];
|
|
42
|
+
for (const line of lines.slice(toolsIndex + 1)) {
|
|
43
|
+
if (!line.startsWith(" - ")) break;
|
|
44
|
+
tools.push(line.slice(4).trim().replace(/^['"]|['"]$/g, ""));
|
|
45
|
+
}
|
|
46
|
+
return tools;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
test("packaged discovery, verification, and implementation agents declare codemode", () => {
|
|
50
|
+
for (const file of CODEMODE_AGENTS) {
|
|
51
|
+
const tools = readDeclaredTools(file);
|
|
52
|
+
assert.ok(
|
|
53
|
+
tools.includes(CODEMODE_TOOL),
|
|
54
|
+
`${file} must declare ${CODEMODE_TOOL} so its child can batch tool calls in one turn`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("packaged read-only review actors keep a codemode-free allowlist", () => {
|
|
60
|
+
for (const file of REVIEW_ACTOR_AGENTS) {
|
|
61
|
+
const tools = readDeclaredTools(file);
|
|
62
|
+
assert.ok(
|
|
63
|
+
!tools.includes(CODEMODE_TOOL),
|
|
64
|
+
`${file} is a read-only review actor: ${CODEMODE_TOOL} must not widen its deny-all allowlist`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("every packaged agent is classified for codemode", () => {
|
|
70
|
+
const classified = new Set<string>([...CODEMODE_AGENTS, ...REVIEW_ACTOR_AGENTS]);
|
|
71
|
+
const packaged = readdirSync(AGENTS_DIR).filter((entry) => entry.endsWith(".md"));
|
|
72
|
+
assert.ok(packaged.length > 0, "gentle-pi must ship packaged agents");
|
|
73
|
+
for (const file of packaged) {
|
|
74
|
+
assert.ok(
|
|
75
|
+
classified.has(file),
|
|
76
|
+
`${file} is not classified for ${CODEMODE_TOOL}: add it to CODEMODE_AGENTS or REVIEW_ACTOR_AGENTS`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
});
|