gentle-pi 4.6.0 → 4.7.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 +10 -11
- package/assets/agents/gentle-ai-explore.md +1 -0
- package/assets/agents/gentle-ai-verify.md +5 -2
- package/assets/agents/gentle-ai-worker.md +3 -0
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +1 -0
- package/assets/agents/jd-judge-b.md +1 -0
- package/assets/design-canvas/canvas.css +13 -1
- package/assets/design-canvas/canvas.js +11 -2
- package/assets/install-wizard/wizard.js +1 -0
- package/assets/migrations/agent-body-history.json +16 -1
- package/assets/orchestrator-delegation-reference.md +4 -4
- package/assets/orchestrator-delegation.md +1 -1
- package/assets/orchestrator-full-delegation-card.md +65 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +3 -3
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-skills.md +1 -1
- package/assets/orchestrator-verification.md +7 -5
- package/assets/orchestrator.md +3 -3
- package/bin/gentle-shell.mjs +164 -56
- package/docs/agent-status.md +61 -0
- package/docs/bundled-install.md +7 -5
- package/docs/delegated-verification.md +29 -7
- package/docs/gentle-agents-activity.md +14 -0
- package/docs/gentle-shell.md +54 -16
- package/docs/install-wizard.md +1 -1
- package/docs/permission-modes.md +9 -4
- package/docs/readme-reference.md +75 -30
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +33 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/voice.md +6 -3
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +1 -0
- package/extensions/child-safety.ts +3 -0
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +326 -34
- package/extensions/gentle-ai.ts +1496 -454
- package/extensions/gentle-shell.ts +293 -63
- package/extensions/gentle-todo.ts +18 -2
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +175 -18
- package/extensions/startup-banner.ts +30 -3
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +160 -2
- package/lib/agent-status.ts +105 -0
- package/lib/agents-config.ts +46 -0
- package/lib/agents-history.ts +24 -5
- package/lib/agents-messaging.ts +47 -5
- package/lib/agents-runner.ts +183 -12
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/bounded-writer-admission.ts +13 -1
- package/lib/card-content-policy.ts +8 -6
- package/lib/command-palette.ts +133 -17
- package/lib/context-backstop.ts +14 -5
- package/lib/destructive-command-guard.ts +48 -4
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +4 -2
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-design.ts +3 -0
- package/lib/gentle-shell-bundled.ts +6 -19
- package/lib/gentle-shell-launcher.ts +43 -8
- package/lib/herdr-activity.ts +14 -2
- package/lib/herdr-busy.ts +45 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +270 -140
- package/lib/jobs-view.ts +198 -11
- package/lib/model-routing-authority.ts +22 -4
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +96 -19
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/questionnaire/questionnaire-view.ts +105 -12
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +104 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +81 -44
- package/lib/review-continuation-registry.ts +99 -0
- package/lib/review-coordinator.ts +163 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +46 -10
- package/lib/review-integration-v2.ts +7 -1
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/session-profile-freeze.ts +4 -2
- package/lib/shell-bar.ts +140 -58
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-panel.ts +17 -3
- package/lib/shell-sidebar-layout.ts +112 -40
- package/lib/shell-sidebar.ts +7 -0
- package/lib/shell-todo.ts +10 -3
- package/lib/verifier-admission.ts +1 -1
- package/lib/visual-customization-policy.ts +36 -16
- package/lib/visual-customize-view.ts +216 -21
- package/lib/visual-layout-preview.ts +9 -5
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/yolo-session-policy.ts +40 -15
- package/package.json +2 -1
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +6 -19
- package/runtime/gentle-shell-launcher.mjs +42 -7
- package/runtime/native-review-cli.mjs +93 -16
- package/runtime/review-integration-v2.mjs +7 -1
- package/scripts/build-full-delegation-card.mjs +175 -0
- package/scripts/bundled-install.mjs +38 -8
- package/scripts/download-progress.mjs +68 -0
- package/scripts/gentle-ai-installer.mjs +41 -18
- package/scripts/gentle-ai-proxy.mjs +294 -0
- package/scripts/install-gentle-ai.mjs +14 -1
- package/scripts/installer-preflight.mjs +5 -5
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +8 -7
- package/scripts/render-cache-host.mjs +72 -0
- package/scripts/render-cache-performance-worker.mjs +5 -4
- package/scripts/render-cache-performance.mjs +6 -1
- package/scripts/run-test-suite.mjs +40 -28
- package/scripts/verify-package-files.mjs +12 -2
- package/scripts/voice-worker.cjs +32 -6
- package/skills/design/SKILL.md +11 -8
- package/skills/gentle-ai/SKILL.md +2 -2
- package/skills/gentle-ui-design/SKILL.md +46 -0
- package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
- package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
- package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
- package/skills/gentle-ui-design/references/task-and-content.md +60 -0
- package/skills/skill-registry/SKILL.md +4 -2
- package/skills/work-unit-commits/SKILL.md +6 -7
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agents-config.test.ts +96 -0
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +178 -2
- package/tests/append-system-prompt-route.test.ts +4 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +97 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-stop-contract.test.ts +43 -3
- package/tests/bridge-cost.test.ts +19 -4
- package/tests/bundled-install.test.ts +30 -5
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-safety.test.ts +11 -0
- package/tests/codegraph-tools.test.ts +11 -5
- package/tests/command-palette.test.ts +284 -1
- package/tests/delegate-for-reason-contract.test.ts +3 -3
- package/tests/design-canvas-assets.test.ts +185 -2
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +9 -5
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +53 -6
- package/tests/full-delegation-closure.test.ts +131 -0
- package/tests/full-delegation-notices.test.ts +76 -0
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agent-status.test.ts +74 -0
- package/tests/gentle-agents-child-jobs.test.ts +237 -0
- package/tests/gentle-agents.test.ts +1070 -12
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +18 -2
- package/tests/gentle-ai-installer.test.ts +134 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai.test.ts +113 -38
- package/tests/gentle-design.test.ts +21 -0
- package/tests/gentle-herdr-activity.test.ts +9 -6
- package/tests/gentle-shell-bin.test.ts +123 -0
- package/tests/gentle-shell-bundled.test.ts +207 -31
- package/tests/gentle-shell-launcher.test.ts +77 -10
- package/tests/gentle-shell.test.ts +899 -59
- package/tests/gentle-todo.test.ts +19 -2
- package/tests/gentle-tps.test.ts +123 -0
- package/tests/gentle-ui-design-skill.test.ts +59 -0
- package/tests/herdr-busy.test.ts +59 -0
- package/tests/herdr-task-summary-policy.test.ts +8 -4
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/independent-recovery-delivery.test.ts +83 -0
- package/tests/inprocess-reviewer.test.ts +176 -4
- package/tests/installer-posix-bootstrap.test.ts +1 -1
- package/tests/installer-preflight.test.ts +5 -4
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +14 -11
- package/tests/jobs-view.test.ts +260 -6
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +7 -1
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/no-self-pause-contract.test.ts +4 -1
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/orchestrator-budget.test.ts +7 -2
- package/tests/orchestrator-delegation-mode.test.ts +153 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +3 -1
- package/tests/orchestrator-rdd-ownership.test.ts +2 -2
- package/tests/package-manifest.test.ts +11 -9
- package/tests/permission-allowlist.test.ts +202 -0
- package/tests/pi-update-launcher.test.ts +8 -0
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +5 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/questionnaire-view.test.ts +115 -0
- package/tests/quiet-bash-runtime.test.ts +1 -1
- package/tests/quiet-tool-rendering.test.ts +48 -0
- package/tests/rdd-aware-verification-contract.test.ts +16 -11
- package/tests/rdd-customize.test.ts +287 -0
- package/tests/rdd-mode-cache.test.ts +450 -0
- package/tests/rdd-mode-control.test.ts +407 -0
- package/tests/rdd-mode-scope-regression.test.ts +137 -0
- package/tests/rdd-off-independent-regression.test.ts +69 -0
- package/tests/rdd-status-line.test.ts +18 -0
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor.test.ts +173 -0
- package/tests/review-agent-end-preflight.test.ts +1 -1
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +1 -1
- package/tests/review-candidate-windows-boundary.test.ts +131 -0
- package/tests/review-candidate-windows-probe.test.ts +63 -0
- package/tests/review-committed-restart-ack.test.ts +129 -0
- package/tests/review-continuation-registry.test.ts +76 -0
- package/tests/review-controller-native-routing.test.ts +261 -5
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +96 -11
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +195 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +65 -10
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-loadout-rdd-off-sdk.test.ts +65 -31
- package/tests/review-owner-identity.test.ts +60 -24
- package/tests/review-relay-phase-timing.test.ts +128 -0
- package/tests/review-relay-transport-agent.test.ts +12 -2
- package/tests/review-reviewer-evidence.test.ts +183 -0
- package/tests/review-risk-assessment.test.ts +74 -3
- package/tests/review-session-standing-permission-controller.test.ts +21 -1
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +121 -0
- package/tests/run-test-suite.test.ts +122 -1
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +181 -5
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-binding.test.ts +19 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-v1-compat.test.ts +35 -1
- package/tests/shell-bar.test.ts +186 -42
- package/tests/shell-panel.test.ts +50 -22
- package/tests/shell-sidebar-fullscreen.test.ts +5 -5
- package/tests/shell-sidebar-layout.test.ts +294 -23
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/skill-registry.test.ts +838 -5
- package/tests/startup-banner.test.ts +152 -1
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/review-coordinator-runtime.ts +69 -0
- package/tests/task-size-routing-contract.test.ts +5 -3
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verify-first-launch-contract.test.ts +78 -3
- package/tests/visual-customization-policy.test.ts +39 -6
- package/tests/visual-customize-view.test.ts +573 -9
- package/tests/visual-layout-preview.test.ts +15 -1
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +28 -0
- package/tests/writer-feature-document-admission.test.ts +92 -0
- package/tests/yolo-customize.test.ts +27 -4
- package/tests/yolo-mode.test.ts +23 -18
- package/tests/yolo-session-policy.test.ts +270 -1
|
@@ -5,7 +5,7 @@ import fs from "node:fs/promises";
|
|
|
5
5
|
import { mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
7
7
|
import { join } from "node:path";
|
|
8
|
-
import startup, { isPiCliSubcommandInvocation, readBannerConfig, readGitBranch } from "../extensions/startup-banner.ts";
|
|
8
|
+
import startup, { isPiCliSubcommandInvocation, readBannerConfig, readGitBranch, rosePulseTicks } from "../extensions/startup-banner.ts";
|
|
9
9
|
import { setBundledInstallForTesting } from "../lib/gentle-shell-bundled.ts";
|
|
10
10
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
11
11
|
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
@@ -567,3 +567,154 @@ test("the banner ends with a /gentle:guide reminder on every start, only when th
|
|
|
567
567
|
assert.equal((await render([{ name: "gentle:guide" }])).filter((line) => line.includes("/gentle:guide")).length, 1, "shown again on the next start, once");
|
|
568
568
|
assert.equal((await render([])).some((line) => line.includes("/gentle:guide")), false);
|
|
569
569
|
});
|
|
570
|
+
|
|
571
|
+
// Every rose pulse step repaints every rose cell, which drives the TUI diff to
|
|
572
|
+
// redraw the whole header region and teleport the hardware cursor; on fast
|
|
573
|
+
// terminals that churn reads as flicker/ghosting (ghostty#12685). The step must
|
|
574
|
+
// come from the resolved animation policy so the cadence table in
|
|
575
|
+
// docs/readme-reference.md stays authoritative: quality paints every 25ms and
|
|
576
|
+
// needs the coarser ~100ms wave, while performance already paints every 250ms.
|
|
577
|
+
test("the rose pulse step follows the resolved animation policy", async (t) => {
|
|
578
|
+
assert.deepEqual(["quality", "performance", "potato"].map((policy) => rosePulseTicks(policy as never)), [4, 2, 2],
|
|
579
|
+
"quality quantizes the wave; performance and potato keep the merge-base step");
|
|
580
|
+
const home = mkdtempSync(join(tmpdir(), "gp-banner-pulse-"));
|
|
581
|
+
const previousHome = process.env.GENTLE_PI_CONFIG_HOME;
|
|
582
|
+
process.env.GENTLE_PI_CONFIG_HOME = home;
|
|
583
|
+
t.after(() => {
|
|
584
|
+
if (previousHome === undefined) delete process.env.GENTLE_PI_CONFIG_HOME;
|
|
585
|
+
else process.env.GENTLE_PI_CONFIG_HOME = previousHome;
|
|
586
|
+
rmSync(home, { recursive: true, force: true });
|
|
587
|
+
});
|
|
588
|
+
// Rose only: with the logo off, a rendered header varies with tick solely
|
|
589
|
+
// through the rose pulse once the fade-in and flash phases have settled.
|
|
590
|
+
t.mock.method(fs, "readFile", async () => JSON.stringify({ showRose: true, showTextLogo: false, color: "pink" }));
|
|
591
|
+
syncBuiltinESMExports();
|
|
592
|
+
t.after(() => { t.mock.restoreAll(); syncBuiltinESMExports(); });
|
|
593
|
+
const argv = process.argv;
|
|
594
|
+
process.argv = ["node"];
|
|
595
|
+
t.after(() => { process.argv = argv; });
|
|
596
|
+
for (const [key, value] of [["rows", 40], ["columns", 200]] as const) {
|
|
597
|
+
const descriptor = Object.getOwnPropertyDescriptor(process.stdout, key);
|
|
598
|
+
Object.defineProperty(process.stdout, key, { configurable: true, writable: true, value });
|
|
599
|
+
t.after(() => descriptor ? Object.defineProperty(process.stdout, key, descriptor) : Reflect.deleteProperty(process.stdout, key));
|
|
600
|
+
}
|
|
601
|
+
let boot: () => void;
|
|
602
|
+
let pulse: () => void;
|
|
603
|
+
let active = false;
|
|
604
|
+
let delay = 0;
|
|
605
|
+
let clock = 0;
|
|
606
|
+
t.mock.method(Date, "now", () => clock);
|
|
607
|
+
t.mock.method(globalThis, "setTimeout", (callback: () => void, ms: number) => {
|
|
608
|
+
if (ms === 50) boot = callback; // Never run operational stats/home reads.
|
|
609
|
+
return {};
|
|
610
|
+
});
|
|
611
|
+
t.mock.method(globalThis, "setInterval", (callback: () => void, ms: number) => {
|
|
612
|
+
pulse = callback; delay = ms; active = true; return {};
|
|
613
|
+
});
|
|
614
|
+
t.mock.method(globalThis, "clearInterval", () => { active = false; });
|
|
615
|
+
let start: (event: unknown, ctx: unknown) => Promise<void>;
|
|
616
|
+
let shutdown: () => void;
|
|
617
|
+
let header: { render(width: number): string[]; dispose(): void };
|
|
618
|
+
// Stroke warmup is module-global; a dedicated instance keeps the settle count deterministic.
|
|
619
|
+
const { default: isolatedStartup } = await import(new URL("../extensions/startup-banner.ts?pulse", import.meta.url).href) as typeof import("../extensions/startup-banner.ts");
|
|
620
|
+
isolatedStartup({ on: (name: string, fn: typeof start) => {
|
|
621
|
+
if (name === "session_start") start = fn;
|
|
622
|
+
if (name === "session_shutdown") shutdown = fn as unknown as () => void;
|
|
623
|
+
}, registerCommand() {}, getCommands: () => [], getAllTools: () => [] } as unknown as ExtensionAPI);
|
|
624
|
+
const ctx = { hasUI: true, cwd: "/fixture", ui: { setHeader(factory: (tui: unknown, theme: unknown) => typeof header) {
|
|
625
|
+
header = factory({ requestRender() {} }, { fg: (_role: string, text: string) => text });
|
|
626
|
+
} } };
|
|
627
|
+
const startBanner = async (policy: string) => {
|
|
628
|
+
writeFileSync(join(home, "animations.json"), JSON.stringify({ schema: "gentle-pi.animations/v1", policy }));
|
|
629
|
+
await start!({}, ctx); boot!();
|
|
630
|
+
for (let i = 0; i < 15; i++) await new Promise<void>((resolve) => setImmediate(resolve));
|
|
631
|
+
assert.equal(active, true, `${policy} starts its animation interval`);
|
|
632
|
+
};
|
|
633
|
+
const advance = () => { clock += delay; pulse!(); };
|
|
634
|
+
try {
|
|
635
|
+
await startBanner("quality");
|
|
636
|
+
assert.equal(delay, 25);
|
|
637
|
+
for (let i = 0; i < 32; i++) advance(); // Past the fade-in (10) and flash (22) phases.
|
|
638
|
+
const frames = [header!.render(200).join("\n")];
|
|
639
|
+
for (let i = 0; i < 4; i++) { advance(); frames.push(header!.render(200).join("\n")); }
|
|
640
|
+
const settled = frames[0];
|
|
641
|
+
assert.deepEqual(frames.slice(0, 4), [settled, settled, settled, settled],
|
|
642
|
+
"quality holds one rose pulse step across its 4-tick (~100ms) quantum");
|
|
643
|
+
assert.notEqual(frames[4], settled, "quality advances the pulse on the next quantum");
|
|
644
|
+
header!.dispose();
|
|
645
|
+
await startBanner("performance");
|
|
646
|
+
assert.equal(delay, 250);
|
|
647
|
+
for (let i = 0; i < 4; i++) advance();
|
|
648
|
+
const performanceFrame = header!.render(200).join("\n");
|
|
649
|
+
advance();
|
|
650
|
+
assert.notEqual(header!.render(200).join("\n"), performanceFrame,
|
|
651
|
+
"performance keeps painting a new pulse step on every 250ms paint");
|
|
652
|
+
} finally { header!.dispose(); shutdown!(); }
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
// docs/readme-reference.md: banner changes apply on the next session or
|
|
656
|
+
// /reload. session_start disposes the previous header before its guards, so a
|
|
657
|
+
// /reload that returned early would leave the editor without a header at all.
|
|
658
|
+
test("/reload repaints the complete static banner instead of replaying the intro", async (t) => {
|
|
659
|
+
const home = mkdtempSync(join(tmpdir(), "gp-banner-reload-"));
|
|
660
|
+
const previousHome = process.env.GENTLE_PI_CONFIG_HOME;
|
|
661
|
+
process.env.GENTLE_PI_CONFIG_HOME = home;
|
|
662
|
+
t.after(() => {
|
|
663
|
+
if (previousHome === undefined) delete process.env.GENTLE_PI_CONFIG_HOME;
|
|
664
|
+
else process.env.GENTLE_PI_CONFIG_HOME = previousHome;
|
|
665
|
+
rmSync(home, { recursive: true, force: true });
|
|
666
|
+
});
|
|
667
|
+
t.mock.method(fs, "readFile", async () => JSON.stringify({ showRose: true, showTextLogo: true, color: "pink" }));
|
|
668
|
+
syncBuiltinESMExports();
|
|
669
|
+
t.after(() => { t.mock.restoreAll(); syncBuiltinESMExports(); });
|
|
670
|
+
const argv = process.argv;
|
|
671
|
+
process.argv = ["node"];
|
|
672
|
+
t.after(() => { process.argv = argv; });
|
|
673
|
+
for (const [key, value] of [["rows", 40], ["columns", 200]] as const) {
|
|
674
|
+
const descriptor = Object.getOwnPropertyDescriptor(process.stdout, key);
|
|
675
|
+
Object.defineProperty(process.stdout, key, { configurable: true, writable: true, value });
|
|
676
|
+
t.after(() => descriptor ? Object.defineProperty(process.stdout, key, descriptor) : Reflect.deleteProperty(process.stdout, key));
|
|
677
|
+
}
|
|
678
|
+
const save = (policy: string) => writeFileSync(join(home, "animations.json"), JSON.stringify({ schema: "gentle-pi.animations/v1", policy }));
|
|
679
|
+
let boot: () => void;
|
|
680
|
+
let active = false;
|
|
681
|
+
let clock = 0;
|
|
682
|
+
t.mock.method(Date, "now", () => clock);
|
|
683
|
+
t.mock.method(globalThis, "setTimeout", (callback: () => void, ms: number) => {
|
|
684
|
+
if (ms === 50) boot = callback; // Never run operational stats/home reads.
|
|
685
|
+
return {};
|
|
686
|
+
});
|
|
687
|
+
t.mock.method(globalThis, "setInterval", () => { active = true; return {}; });
|
|
688
|
+
t.mock.method(globalThis, "clearInterval", () => { active = false; });
|
|
689
|
+
let start: (event: unknown, ctx: unknown) => Promise<void>;
|
|
690
|
+
let header: { render(width: number): string[]; dispose(): void };
|
|
691
|
+
let headers = 0;
|
|
692
|
+
const { default: isolatedStartup } = await import(new URL("../extensions/startup-banner.ts?reload", import.meta.url).href) as typeof import("../extensions/startup-banner.ts");
|
|
693
|
+
isolatedStartup({ on: (name: string, fn: typeof start) => {
|
|
694
|
+
if (name === "session_start") start = fn;
|
|
695
|
+
}, registerCommand() {}, getCommands: () => [], getAllTools: () => [] } as unknown as ExtensionAPI);
|
|
696
|
+
const ctx = { hasUI: true, cwd: "/fixture", ui: { setHeader(factory: (tui: unknown, theme: unknown) => typeof header) {
|
|
697
|
+
headers++;
|
|
698
|
+
header = factory({ requestRender() {} }, { fg: (_role: string, text: string) => text });
|
|
699
|
+
} } };
|
|
700
|
+
try {
|
|
701
|
+
// Potato renders the completed static artwork immediately: its glyphs are
|
|
702
|
+
// the reference for "complete", independent of the pulse phase.
|
|
703
|
+
save("potato");
|
|
704
|
+
await start!({}, ctx); boot!();
|
|
705
|
+
assert.equal(headers, 1);
|
|
706
|
+
assert.equal(active, false, "potato starts no animation interval");
|
|
707
|
+
const staticGlyphs = stripAnsi(header!.render(200).join("\n"));
|
|
708
|
+
header!.dispose();
|
|
709
|
+
save("quality");
|
|
710
|
+
await start!({ reason: "reload" }, ctx);
|
|
711
|
+
boot!();
|
|
712
|
+
assert.equal(headers, 2, "/reload installs a header instead of leaving the editor without one");
|
|
713
|
+
assert.equal(active, false, "/reload starts no intro animation interval");
|
|
714
|
+
const reloaded = header!.render(200).join("\n");
|
|
715
|
+
assert.equal(stripAnsi(reloaded), staticGlyphs,
|
|
716
|
+
"/reload repaints the complete artwork instead of replaying the letter-writing intro");
|
|
717
|
+
assert.match(reloaded, /\x1b\[38;2;255;140;210m/, "/reload paints the settled logo palette");
|
|
718
|
+
assert.match(reloaded, /\x1b\[38;2;95;30;60m▒/, "/reload paints the settled rose shadow");
|
|
719
|
+
} finally { header!.dispose(); }
|
|
720
|
+
});
|
|
@@ -189,6 +189,7 @@ test("a session keeps its first RDD status line until the off state changes", as
|
|
|
189
189
|
return /Receipt-driven development: [^;\n]*/.exec(event.systemPromptOptions.appendSystemPrompt)?.[0];
|
|
190
190
|
};
|
|
191
191
|
await handlers.get("session_shutdown")!({}, ctx);
|
|
192
|
+
await handlers.get("session_start")!({}, ctx);
|
|
192
193
|
assert.equal(await line(), "Receipt-driven development: unknown (native status unavailable)");
|
|
193
194
|
status = { effective: "on", source: "clone_local" };
|
|
194
195
|
assert.equal(await line(), "Receipt-driven development: unknown (native status unavailable)", "unknown to on keeps the prompt prefix");
|
|
@@ -200,5 +201,6 @@ test("a session keeps its first RDD status line until the off state changes", as
|
|
|
200
201
|
assert.equal(await line(), "Receipt-driven development: on (decided by global)", "turning RDD back on re-renders");
|
|
201
202
|
await handlers.get("session_shutdown")!({}, ctx);
|
|
202
203
|
status = { effective: "on", source: "clone_local" };
|
|
204
|
+
await handlers.get("session_start")!({}, ctx);
|
|
203
205
|
assert.equal(await line(), "Receipt-driven development: on (decided by clone_local)", "a new session renders the current line");
|
|
204
206
|
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Actual registered facade executors over an in-memory native authority fixture.
|
|
2
|
+
// No real approval, native CLI, reviewer network call or candidate freeze occurs.
|
|
3
|
+
import assert from "node:assert/strict";
|
|
4
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
5
|
+
import { createGentleAiExtension, __testing } from "../../extensions/gentle-ai.ts";
|
|
6
|
+
import { decodeReviewStatusV3 } from "../../lib/review-integration-v2.ts";
|
|
7
|
+
import type { NativeReviewCli } from "../../lib/native-review-cli.ts";
|
|
8
|
+
|
|
9
|
+
type Body = Record<string, any>;
|
|
10
|
+
export function createCoordinatorRuntime(cwd: string, variant: "baseline" | "coordinator") {
|
|
11
|
+
cwd = realpathSync(cwd);
|
|
12
|
+
const raw = JSON.parse(readFileSync(new URL("../fixtures/devbinary/status-v5-capture-result-submission.captured.json", import.meta.url), "utf8"));
|
|
13
|
+
raw.action = "stop";
|
|
14
|
+
const reviewing = decodeReviewStatusV3(raw);
|
|
15
|
+
const lineage = reviewing.authority!.lineageId!;
|
|
16
|
+
const target = reviewing.targetIdentity;
|
|
17
|
+
const revision = reviewing.authority!.revision;
|
|
18
|
+
const arguments_ = [["cwd", cwd], ["lineage", lineage], ["target", target], ["expected-revision", revision], ["token", "fixture-only"]].map(([name, value]) => ({ name, value, token: `--${name}=${value}` }));
|
|
19
|
+
const execute = { operation: "review.acknowledge-approved", command: "gentle-ai review acknowledge-approved --fixture-only", arguments: arguments_, preconditions: [{ name: "state", value: "approved" }], binding: { lineageId: lineage, targetIdentity: target, revision } };
|
|
20
|
+
const approved = { ...reviewing, authority: { ...reviewing.authority!, state: "approved" }, nextTransition: { kind: "execute", reasonCode: "approved_acknowledgement_required", execute }, raw: { ...raw, authority: { ...raw.authority, state: "approved" }, next_transition: { kind: "execute", reason_code: "approved_acknowledgement_required", execute } } };
|
|
21
|
+
let state = "reviewing";
|
|
22
|
+
const nativeCalls: string[] = [];
|
|
23
|
+
let modeReads = 0;
|
|
24
|
+
let candidateReads = 0;
|
|
25
|
+
const tools = new Map<string, any>();
|
|
26
|
+
const native = {
|
|
27
|
+
reviewMode: async () => { modeReads++; return { operation: "status", scope: "clone", status: { global: "on", cloneLocal: "", effective: "on", source: "global" } }; },
|
|
28
|
+
targetStatus: async () => {
|
|
29
|
+
assert.notEqual(state, "burned", "no STATUS after burn");
|
|
30
|
+
nativeCalls.push(`status:${state}`);
|
|
31
|
+
return state === "approved" ? approved : reviewing;
|
|
32
|
+
},
|
|
33
|
+
acknowledgeApproved: async () => {
|
|
34
|
+
assert.equal(state, "approved");
|
|
35
|
+
nativeCalls.push("acknowledge"); state = "burned";
|
|
36
|
+
return { schema: "gentle-ai.review-acknowledged/v1", lineageId: lineage, targetIdentity: target, consumedRevision: revision };
|
|
37
|
+
},
|
|
38
|
+
assess: async () => {
|
|
39
|
+
candidateReads++;
|
|
40
|
+
return { schema: "gentle-ai.review-assessment/v1", risk: "passive", reasons: [], changedPaths: 1, changedLines: 1,
|
|
41
|
+
candidate: { kind: "current-changes", consumed: state === "burned" } };
|
|
42
|
+
},
|
|
43
|
+
} as unknown as NativeReviewCli;
|
|
44
|
+
__testing.setReviewHostRelayRunnerForTesting(async () => {
|
|
45
|
+
assert.equal(state, "reviewing");
|
|
46
|
+
nativeCalls.push("capture:recorded-output"); state = "approved";
|
|
47
|
+
const submission = JSON.stringify({ schema: "gentle-ai.review-last-event-closure/v1", operation: "review/capture-result", lineage_id: lineage, state: "approved", action: "fixture approval; not real authority", store_revision: revision });
|
|
48
|
+
return { submission, promptByteLength: 0, resultByteLength: Buffer.byteLength(submission) };
|
|
49
|
+
});
|
|
50
|
+
createGentleAiExtension({ nativeReviewCli: native, candidateViews: null,
|
|
51
|
+
processEnv: { GENTLE_PI_EXPERIMENTAL_REVIEW_COORDINATOR: variant === "coordinator" ? "1" : "0", GENTLE_AI_TELEMETRY: "0" },
|
|
52
|
+
})({ on() {}, registerCommand() {}, registerTool: (tool: any) => tools.set(tool.name, tool) } as never);
|
|
53
|
+
const forecasts: Body[] = [];
|
|
54
|
+
const context = { cwd, hasUI: true, sessionManager: { getSessionId: () => "fixture-live-driver", getBranch: () => [], getSessionFile: () => undefined }, modelRegistry: undefined };
|
|
55
|
+
const facadeCalls: { name: string; parameters: Body; elapsed_ms: number }[] = [];
|
|
56
|
+
return { tools, lineage, target, nativeCalls, facadeCalls, forecasts,
|
|
57
|
+
async invoke(name: string, parameters: Body) {
|
|
58
|
+
const tool = tools.get(name); assert.ok(tool, `registered tool ${name}`);
|
|
59
|
+
const began = performance.now();
|
|
60
|
+
const result = await tool.execute("fixture-call", parameters, undefined, (update: any) => forecasts.push(update.details), context);
|
|
61
|
+
facadeCalls.push({ name, parameters, elapsed_ms: performance.now() - began });
|
|
62
|
+
return result.details as Body;
|
|
63
|
+
},
|
|
64
|
+
closed: () => state === "burned",
|
|
65
|
+
modeReads: () => modeReads,
|
|
66
|
+
candidateReads: () => candidateReads,
|
|
67
|
+
close: () => __testing.setReviewHostRelayRunnerForTesting(),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -92,7 +92,7 @@ test("AC4: each mechanism turns on only by its own trigger and size is re-evalua
|
|
|
92
92
|
"7. **Context backstop**",
|
|
93
93
|
"open product or design decision",
|
|
94
94
|
// Verification by named risk: rule 3 names the escalated high-risk item.
|
|
95
|
-
"named high-risk item (assess `escalate`)",
|
|
95
|
+
"named high-risk item (assess `escalate` when RDD is on or unknown)",
|
|
96
96
|
"never by file count",
|
|
97
97
|
// gentle-shell#1731: the writer fires on reasons, not on size alone.
|
|
98
98
|
"never by file count or a large task alone",
|
|
@@ -144,7 +144,8 @@ const MODULE_BUDGETS: Record<string, number> = {
|
|
|
144
144
|
// Pain-point iteration S13 (C10): the Preparation trigger tells the parent not to read what the worker will
|
|
145
145
|
// read and to pass paths, not content (7,000 -> 7,100 B; every other card sentence is pinned by a contract).
|
|
146
146
|
// S15: units of about 100 changed lines or less always run inline (7,100 -> 7,300 B).
|
|
147
|
-
|
|
147
|
+
// RDD-off verification keeps the named-risk rule while conditioning assess on mode (7,300 -> 7,350 B).
|
|
148
|
+
"orchestrator-delegation.md": 7_350,
|
|
148
149
|
"orchestrator-delegation-reference.md": 14_800,
|
|
149
150
|
// gentle-shell#1731 T23: Close gate accepts one Needs your decision result as a stop (12,500 -> 12,600 B).
|
|
150
151
|
// S14: close the open slice before a high-risk commit; outcomes per commit (12,600 -> 12,850 B).
|
|
@@ -154,7 +155,8 @@ const MODULE_BUDGETS: Record<string, number> = {
|
|
|
154
155
|
// gentle-shell#1731 T15: one end-of-feature verify for same-model inline deliveries (6,400 -> 6,500 B).
|
|
155
156
|
// gentle-shell#1731 T23: bounded self-review and partial/blocked writer -> Needs your decision (7,000 -> 7,300 B).
|
|
156
157
|
// Verification by named risk: escalate-only tier table and the concrete-occasions rule (7,300 -> 7,500 B).
|
|
157
|
-
|
|
158
|
+
// The validated-off exception and its read-only fallback need 365 additional bytes (7,500 -> 7,900 B).
|
|
159
|
+
"orchestrator-verification.md": 7_900,
|
|
158
160
|
// Writer-rule fix (size threshold, one behavior per unit) and C3 (writer prompts name the helpers and
|
|
159
161
|
// invariants to reuse): 4,500 -> 5,300 B.
|
|
160
162
|
// Pain-point iteration S10 (C7): writer handoffs keep test scratch outside the worktree (5,300 -> 5,500 B).
|
|
@@ -23,6 +23,24 @@ function workspace(withDocument: boolean): string {
|
|
|
23
23
|
return root;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// gentle-shell#2478: the rejection must name the accepted declaration placement, so a caller whose risk sentence
|
|
27
|
+
// follows a separator like `; ` (the Andiveli report) learns the conforming form instead of guessing.
|
|
28
|
+
test("S5: the rejection names the accepted declaration placement", (t) => {
|
|
29
|
+
const root = workspace(false);
|
|
30
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
31
|
+
// The reported nonconforming envelope: the declaration follows `; `, which the grammar does not accept.
|
|
32
|
+
const denied = rejectUnriskedVerifierLaunch(
|
|
33
|
+
{ agent: "gentle-ai-verify", task: "Independent verification, read-only repository; Risk: item 2 (authorization tokens). Spec: odd/tasks/example.md, T2, S1-S3." },
|
|
34
|
+
{ root, contextUsage: quiet },
|
|
35
|
+
);
|
|
36
|
+
assert.ok(denied?.block, "the `; `-separated declaration is not recognized");
|
|
37
|
+
assert.match(denied.reason, /A supported `Risk: item N` declaration starts a line/);
|
|
38
|
+
assert.match(denied.reason, /or a sentence \(after `\.`, `!` or `\?` and a space\)/);
|
|
39
|
+
assert.match(denied.reason, /for example `Risk: item 2 \(authorization tokens\)`/);
|
|
40
|
+
assert.match(denied.reason, /after another separator such as `; ` or `,` is not recognized/);
|
|
41
|
+
assert.doesNotMatch(denied.reason, /claude|gpt|openai|anthropic|gemini|sonnet|opus/i, "the message stays generic");
|
|
42
|
+
});
|
|
43
|
+
|
|
26
44
|
test("S3/S4: a verifier launch without a high-risk line is rejected with an inline instruction", (t) => {
|
|
27
45
|
const root = workspace(false);
|
|
28
46
|
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
@@ -152,3 +170,34 @@ test("S6: the Verification rule and the reference docs point at the runtime admi
|
|
|
152
170
|
assert.ok(writer >= 0 && verifier > writer, "the verifier admission is documented right after the writer admission");
|
|
153
171
|
assert.match(docs.slice(verifier, docs.indexOf("\n\n", verifier)), /`gentle-ai-verify` launch is admitted only when[^]*`Risk: item N`[^]*context backstop/);
|
|
154
172
|
});
|
|
173
|
+
|
|
174
|
+
// gentle-shell#2478: the strict placement grammar is unchanged by the diagnostics wording — a declaration after
|
|
175
|
+
// `; ` or `,` blocks, a line-start and a sentence-start declaration admit. Covers S2, S5.
|
|
176
|
+
test("S2/S5: placement grammar admits line/sentence starts and blocks other separators", (t) => {
|
|
177
|
+
const root = workspace(false);
|
|
178
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
179
|
+
const verdict = (task: string) => rejectUnriskedVerifierLaunch({ agent: "gentle-ai-verify", task }, { root, contextUsage: quiet })?.block === true;
|
|
180
|
+
assert.equal(verdict("Independent verification, read-only repository; Risk: item 2 (authorization tokens)."), true, "`; ` is not a declaration start");
|
|
181
|
+
assert.equal(verdict("Verification of the parser, Risk: item 2 (reason)."), true, "`,` is not a declaration start");
|
|
182
|
+
assert.equal(verdict("Risk: item 2 (authorization tokens)\nVerify."), false, "line start admits");
|
|
183
|
+
assert.equal(verdict("- Risk: item 2\nVerify."), false, "list marker admits");
|
|
184
|
+
assert.equal(verdict("Deployed on top of ebf3f35. Risk: item 1 (migration)"), false, "sentence start admits");
|
|
185
|
+
assert.equal(verdict("Risk: none\nVerify."), true, "`Risk: none` blocks");
|
|
186
|
+
assert.equal(verdict("Spec: odd/tasks/missing.md"), true, "a missing feature document does not admit");
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// gentle-shell#2478 S2-S4: the docs section states the strict grammar, the assessment≠admission split, and that the
|
|
190
|
+
// post-denial disposition is launch-scoped with no gate-level retry. Covers S2, S3, S4.
|
|
191
|
+
test("S2/S3/S4: delegated-verification documents placement, assessment≠admission and post-denial disposition", () => {
|
|
192
|
+
const docs = readFileSync(new URL("../docs/delegated-verification.md", import.meta.url), "utf8");
|
|
193
|
+
const section = docs.split("## Verifier launch admission and post-denial disposition")[1]?.split("\n## ")[0] ?? "";
|
|
194
|
+
assert.match(section, /The declaration grammar is strict: `Risk: item N \(reason\)` must start a line/);
|
|
195
|
+
assert.match(section, /after another separator such as `; ` or `,` inside a sentence is not recognized/);
|
|
196
|
+
assert.match(section, /Keep the risk evidence tied to the actual change; never add a Risk line only to gain admission\./);
|
|
197
|
+
assert.match(section, /Assessment and admission are separate gates/);
|
|
198
|
+
assert.match(section, /does not receive the assessment result/);
|
|
199
|
+
assert.match(section, /no gate-level disposition exists for the same launch: do not retry it/);
|
|
200
|
+
assert.match(section, /The rejection is launch-scoped, not feature-scoped/);
|
|
201
|
+
assert.match(section, /requires the user's explicit decision in a new prompt/);
|
|
202
|
+
assert.match(section, /Inline tests, the writer's self-verification, and a user's visual approval never replace the missing independent verification/);
|
|
203
|
+
});
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import {
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readlinkSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
3
5
|
import { join } from "node:path";
|
|
4
|
-
import test from "node:test";
|
|
6
|
+
import test, { after, before } from "node:test";
|
|
7
|
+
import { blockChildDestructiveCommand } from "../extensions/child-safety.ts";
|
|
5
8
|
import { __testing } from "../extensions/gentle-ai.ts";
|
|
9
|
+
import { recognizeDestructiveCommands } from "../lib/destructive-command-guard.ts";
|
|
6
10
|
|
|
7
11
|
// gentle-shell#1731 T16 (S5; L33-L34): in the after3 bench (B x4/x5) the first
|
|
8
12
|
// verify launch ran no probes because the handoff said only "read-only" and
|
|
@@ -18,6 +22,18 @@ import { __testing } from "../extensions/gentle-ai.ts";
|
|
|
18
22
|
const read = (relative: string): string => readFileSync(join(import.meta.dirname, "..", relative), "utf8");
|
|
19
23
|
const verify = read("assets/agents/gentle-ai-verify.md");
|
|
20
24
|
const verification = read("assets/orchestrator-verification.md");
|
|
25
|
+
let scratch: string;
|
|
26
|
+
let previousConfigHome: string | undefined;
|
|
27
|
+
before(() => {
|
|
28
|
+
scratch = mkdtempSync(join(tmpdir(), "gentle-verify-first-"));
|
|
29
|
+
previousConfigHome = process.env.GENTLE_PI_CONFIG_HOME;
|
|
30
|
+
process.env.GENTLE_PI_CONFIG_HOME = join(scratch, "config");
|
|
31
|
+
});
|
|
32
|
+
after(() => {
|
|
33
|
+
if (previousConfigHome === undefined) delete process.env.GENTLE_PI_CONFIG_HOME;
|
|
34
|
+
else process.env.GENTLE_PI_CONFIG_HOME = previousConfigHome;
|
|
35
|
+
if (scratch) rmSync(scratch, { recursive: true, force: true });
|
|
36
|
+
});
|
|
21
37
|
|
|
22
38
|
function containsAll(text: string, clauses: readonly string[], label: string): void {
|
|
23
39
|
for (const clause of clauses) assert.ok(text.includes(clause), `${label} is missing: ${clause}`);
|
|
@@ -50,6 +66,25 @@ test("S3: setup failures do not trigger repair loops or automatic relaunch", ()
|
|
|
50
66
|
], "parent setup");
|
|
51
67
|
});
|
|
52
68
|
|
|
69
|
+
test("S2-S3: setup recovery references the always-on bounded policy", () => {
|
|
70
|
+
containsAll(verification, [
|
|
71
|
+
"Follow **Authorized work continuity** for setup and worker recovery; scratch: `gentle-ai-verify`.",
|
|
72
|
+
"Do not automatically relaunch the verifier for the same missing prerequisite",
|
|
73
|
+
], "parent setup recovery");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("S3: scratch preparation establishes capacity and a complete payload before copying", () => {
|
|
77
|
+
containsAll(verify, [
|
|
78
|
+
"Before isolated setup, establish the required payload, available dependencies, and scratch capacity, including space and inodes when relevant.",
|
|
79
|
+
"A smaller copy is permitted only when it includes all source, test/build files, baseline material, and dependencies needed for every authorized probe.",
|
|
80
|
+
"If a prerequisite cannot be established, report it as missing instead of blindly copying or omitting required inputs",
|
|
81
|
+
"If setup fails before probes, preserve the failed attempt and report zero tests run",
|
|
82
|
+
"never `git worktree`, `git stash`, or a symlink into the workspace",
|
|
83
|
+
"No network, no installs, no writes outside the scratch directory",
|
|
84
|
+
"under the system temp directory, never inside the workspace",
|
|
85
|
+
], "scratch isolation remains required");
|
|
86
|
+
});
|
|
87
|
+
|
|
53
88
|
test("S5: documentation identifies the instruction as policy rather than runtime enforcement", () => {
|
|
54
89
|
const docs = read("docs/delegated-verification.md");
|
|
55
90
|
containsAll(docs, [
|
|
@@ -102,6 +137,46 @@ test("T16/W1: the scratch copy method cannot write outside the scratch directory
|
|
|
102
137
|
], "scratch copy method");
|
|
103
138
|
});
|
|
104
139
|
|
|
140
|
+
// gentle-shell#2818: the prompt asked for a copy without `.git` but named only
|
|
141
|
+
// `cp -a --reflink=auto`, which cannot exclude anything. Verifiers then ran
|
|
142
|
+
// `rm -rf "$s/work/.git"` (blocked by child safety) or `cp --exclude` (no such
|
|
143
|
+
// option), so no probe ran. The prompt names one exact guard-compatible form.
|
|
144
|
+
const SCRATCH_COPY = /`(mkdir -p "\$s\/work" && tar --exclude=\.\/\.git [^`]+)`/;
|
|
145
|
+
|
|
146
|
+
test("#2818: the scratch copy names one exact command the child guard allows", () => {
|
|
147
|
+
const command = verify.match(SCRATCH_COPY)?.[1];
|
|
148
|
+
assert.ok(command, "verify must name the exact tar scratch copy command");
|
|
149
|
+
assert.deepEqual(recognizeDestructiveCommands(command), []);
|
|
150
|
+
assert.equal(blockChildDestructiveCommand(command), undefined);
|
|
151
|
+
assert.ok(!verify.includes("for example `cp -a --reflink=auto`"), "the cp example cannot exclude `.git`");
|
|
152
|
+
containsAll(verify, [
|
|
153
|
+
"never copy `.git` and delete it afterwards",
|
|
154
|
+
"`cp` has no `--exclude` option",
|
|
155
|
+
], "scratch copy method");
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("#2818: the named scratch copy omits top-level .git and keeps dotfiles, dependencies and symlinks", () => {
|
|
159
|
+
const command = verify.match(SCRATCH_COPY)?.[1];
|
|
160
|
+
assert.ok(command);
|
|
161
|
+
const workspace = join(scratch, "workspace");
|
|
162
|
+
mkdirSync(join(workspace, ".git", "objects"), { recursive: true });
|
|
163
|
+
writeFileSync(join(workspace, ".git", "HEAD"), "ref: refs/heads/main\n");
|
|
164
|
+
writeFileSync(join(workspace, ".env.example"), "KEY=\n");
|
|
165
|
+
mkdirSync(join(workspace, "node_modules", "dep"), { recursive: true });
|
|
166
|
+
writeFileSync(join(workspace, "node_modules", "dep", "index.js"), "module.exports = 1;\n");
|
|
167
|
+
mkdirSync(join(workspace, "node_modules", ".bin"));
|
|
168
|
+
symlinkSync("../dep/index.js", join(workspace, "node_modules", ".bin", "dep"));
|
|
169
|
+
const s = mkdtempSync(join(scratch, "probe-"));
|
|
170
|
+
const result = spawnSync("bash", ["-c", command], { cwd: workspace, env: { ...process.env, s }, encoding: "utf8" });
|
|
171
|
+
assert.equal(result.status, 0, result.stderr);
|
|
172
|
+
const work = join(s, "work");
|
|
173
|
+
assert.equal(existsSync(join(work, ".git")), false);
|
|
174
|
+
assert.equal(readFileSync(join(work, ".env.example"), "utf8"), "KEY=\n");
|
|
175
|
+
assert.equal(readFileSync(join(work, "node_modules", "dep", "index.js"), "utf8"), "module.exports = 1;\n");
|
|
176
|
+
assert.equal(readlinkSync(join(work, "node_modules", ".bin", "dep")), "../dep/index.js");
|
|
177
|
+
assert.equal(existsSync(join(workspace, ".git", "HEAD")), true);
|
|
178
|
+
});
|
|
179
|
+
|
|
105
180
|
// T21 (L44): in after4, verify reported a behavior already present at the
|
|
106
181
|
// baseline (B x5, unchecked import amounts the request kept "as they do today")
|
|
107
182
|
// and a value far outside the realistic domain (B x4, sums near 9e15) as
|
|
@@ -179,7 +254,7 @@ test("T17b: inline-write preparation is distinct from discovery", () => {
|
|
|
179
254
|
|
|
180
255
|
test("T17: the always-on Explore step delegates exploration only for a map the parent needs", () => {
|
|
181
256
|
for (const persona of ["gentleman", "neutral"] as const) {
|
|
182
|
-
const prompt = __testing.buildGentlePrompt(persona);
|
|
257
|
+
const prompt = __testing.buildGentlePrompt(persona, scratch, ["read"]);
|
|
183
258
|
const step = prompt.split("\n").find((line) => line.startsWith("2. **Explore.**"));
|
|
184
259
|
assert.ok(step, "ODD step 2 Explore is missing");
|
|
185
260
|
containsAll(step, [
|
|
@@ -3,7 +3,7 @@ import { mkdtempSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, wr
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { test } from "node:test";
|
|
6
|
-
import { applyVisualPreset, DEFAULT_VISUAL_SETTINGS, DENSITY, HEADER_PLACEMENT, isVisualSettings, parseVisualSettingsFile, resolveVisualSettings, STATUS_PLACEMENT, VISUAL_PRESET, VISUAL_SECTION_KEYS, visualPresetOf, writeVisualSettings, VISUAL_SCHEMA } from "../lib/visual-customization-policy.ts";
|
|
6
|
+
import { applyVisualPreset, CHROME_SURFACE, DEFAULT_VISUAL_SETTINGS, DENSITY, HEADER_PLACEMENT, isVisualSettings, parseVisualSettingsFile, resolveVisualSettings, STATUS_PLACEMENT, VISUAL_PRESET, VISUAL_SECTION_KEYS, visualPresetOf, writeVisualSettings, VISUAL_SCHEMA } from "../lib/visual-customization-policy.ts";
|
|
7
7
|
|
|
8
8
|
test("missing settings use responsive defaults and return independent copies", () => {
|
|
9
9
|
const home = mkdtempSync(join(tmpdir(), "visual-policy-"));
|
|
@@ -127,7 +127,8 @@ test("atomic write round trips and invalid existing files fall back without over
|
|
|
127
127
|
assert.equal(path, join(home, "visual-customization.json"));
|
|
128
128
|
if (process.platform !== "win32") assert.equal(statSync(path).mode & 0o777, 0o600);
|
|
129
129
|
assert.deepEqual(resolveVisualSettings({ gentlePiConfigHome: home }).settings, settings);
|
|
130
|
-
|
|
130
|
+
const { surface: _surface, ...stored } = settings;
|
|
131
|
+
assert.deepEqual(JSON.parse(readFileSync(path, "utf8")), { schema: VISUAL_SCHEMA, ...stored }, "the tinted default is not stored");
|
|
131
132
|
const validFile = readFileSync(path, "utf8");
|
|
132
133
|
assert.throws(() => writeVisualSettings({ ...settings, density: "bad" as typeof settings.density }, { gentlePiConfigHome: home }));
|
|
133
134
|
assert.equal(readFileSync(path, "utf8"), validFile);
|
|
@@ -138,8 +139,9 @@ test("atomic write round trips and invalid existing files fall back without over
|
|
|
138
139
|
} finally { rmSync(home, { recursive: true, force: true }); }
|
|
139
140
|
});
|
|
140
141
|
|
|
141
|
-
// Presets (/gentle:customize → Layout → Preset) bundle the
|
|
142
|
-
//
|
|
142
|
+
// Presets (/gentle:customize → Layout → Preset) bundle the visibility switches
|
|
143
|
+
// (and Light's bottom Status); density is its own axis, like the header and the
|
|
144
|
+
// surface. They never add a key, so every binary keeps reading the file.
|
|
143
145
|
test("presets are valid settings that keep the file format and the header placement; Light drops the rail", () => {
|
|
144
146
|
assert.deepEqual(Object.values(VISUAL_PRESET), ["light", "neutral", "power-user"]);
|
|
145
147
|
const custom = { ...DEFAULT_VISUAL_SETTINGS, statusPlacement: STATUS_PLACEMENT.RIGHT, headerPlacement: HEADER_PLACEMENT.BELOW_INPUT };
|
|
@@ -156,10 +158,10 @@ test("presets are valid settings that keep the file format and the header placem
|
|
|
156
158
|
assert.equal(visualPresetOf({ ...applyVisualPreset(DEFAULT_VISUAL_SETTINGS, VISUAL_PRESET.LIGHT), statusPlacement: STATUS_PLACEMENT.AUTO }), undefined, "Light switches with a rail are a custom mix");
|
|
157
159
|
assert.deepEqual(applyVisualPreset(DEFAULT_VISUAL_SETTINGS, VISUAL_PRESET.NEUTRAL), DEFAULT_VISUAL_SETTINGS, "Neutral is today's default");
|
|
158
160
|
const light = applyVisualPreset(DEFAULT_VISUAL_SETTINGS, VISUAL_PRESET.LIGHT);
|
|
159
|
-
assert.equal(light.density,
|
|
161
|
+
assert.equal(light.density, DEFAULT_VISUAL_SETTINGS.density, "a preset never changes the density");
|
|
160
162
|
assert.deepEqual({ changes: light.visibility.changes, todo: light.visibility.todo, agents: light.visibility.agents, modelDetails: light.visibility.modelDetails, usageCost: light.visibility.usageCost }, { changes: false, todo: false, agents: true, modelDetails: true, usageCost: true }, "Light keeps priority 1: model, context, agent questions");
|
|
161
163
|
const power = applyVisualPreset(DEFAULT_VISUAL_SETTINGS, VISUAL_PRESET.POWER_USER);
|
|
162
|
-
assert.equal(power.density, DENSITY.COMFORTABLE, "Power user keeps
|
|
164
|
+
assert.equal(power.density, DENSITY.COMFORTABLE, "Power user keeps the density");
|
|
163
165
|
assert.ok(Object.values(power.visibility).every(Boolean), "Power user shows everything");
|
|
164
166
|
assert.equal(visualPresetOf({ ...DEFAULT_VISUAL_SETTINGS, visibility: { ...DEFAULT_VISUAL_SETTINGS.visibility, rdd: false } }), undefined, "a hand-tuned mix is custom");
|
|
165
167
|
const home = mkdtempSync(join(tmpdir(), "visual-preset-"));
|
|
@@ -191,3 +193,34 @@ test("Power user keeps Neutral's spacing and adds Stats; Neutral and Light leave
|
|
|
191
193
|
assert.equal(applyVisualPreset(power, VISUAL_PRESET.NEUTRAL).visibility.stats, false);
|
|
192
194
|
assert.equal(applyVisualPreset(power, VISUAL_PRESET.LIGHT).visibility.stats, false);
|
|
193
195
|
});
|
|
196
|
+
|
|
197
|
+
test("the chrome surface defaults to transparent, is stored only when tinted, and files without it read as transparent", () => {
|
|
198
|
+
assert.equal(DEFAULT_VISUAL_SETTINGS.surface, CHROME_SURFACE.TRANSPARENT);
|
|
199
|
+
const home = mkdtempSync(join(tmpdir(), "visual-surface-"));
|
|
200
|
+
try {
|
|
201
|
+
const file = join(home, "visual-customization.json");
|
|
202
|
+
writeVisualSettings(DEFAULT_VISUAL_SETTINGS, { gentlePiConfigHome: home });
|
|
203
|
+
assert.equal(Object.hasOwn(JSON.parse(readFileSync(file, "utf8")), "surface"), false, "the default keeps the file readable by older versions");
|
|
204
|
+
assert.deepEqual(resolveVisualSettings({ gentlePiConfigHome: home }).settings, DEFAULT_VISUAL_SETTINGS);
|
|
205
|
+
const tinted = { ...DEFAULT_VISUAL_SETTINGS, surface: CHROME_SURFACE.TINTED };
|
|
206
|
+
writeVisualSettings(tinted, { gentlePiConfigHome: home });
|
|
207
|
+
assert.equal(JSON.parse(readFileSync(file, "utf8")).surface, "tinted");
|
|
208
|
+
assert.deepEqual(resolveVisualSettings({ gentlePiConfigHome: home }).settings, tinted);
|
|
209
|
+
assert.equal(visualPresetOf(tinted), VISUAL_PRESET.NEUTRAL, "presets ignore the surface");
|
|
210
|
+
assert.equal(applyVisualPreset(tinted, VISUAL_PRESET.POWER_USER).surface, CHROME_SURFACE.TINTED, "a preset keeps the surface");
|
|
211
|
+
const { surface: _surface, ...legacy } = DEFAULT_VISUAL_SETTINGS;
|
|
212
|
+
assert.deepEqual(parseVisualSettingsFile(JSON.stringify({ schema: VISUAL_SCHEMA, ...legacy })), DEFAULT_VISUAL_SETTINGS, "a file without the surface reads as the transparent default");
|
|
213
|
+
assert.equal(parseVisualSettingsFile(JSON.stringify({ schema: VISUAL_SCHEMA, ...DEFAULT_VISUAL_SETTINGS, surface: "glass" })), undefined);
|
|
214
|
+
assert.equal(isVisualSettings({ ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "split" }), true);
|
|
215
|
+
} finally { rmSync(home, { recursive: true, force: true }); }
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test("density is independent of the presets: changing it keeps the preset, and applying a preset keeps it", () => {
|
|
219
|
+
for (const preset of Object.values(VISUAL_PRESET)) {
|
|
220
|
+
for (const density of Object.values(DENSITY)) {
|
|
221
|
+
const applied = { ...applyVisualPreset(DEFAULT_VISUAL_SETTINGS, preset), density };
|
|
222
|
+
assert.equal(visualPresetOf(applied), preset, `${preset}/${density}: the preset stays selected`);
|
|
223
|
+
for (const next of Object.values(VISUAL_PRESET)) assert.equal(applyVisualPreset(applied, next).density, density, `${preset}→${next}: the chosen density stays`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|