gentle-pi 4.5.0 → 4.6.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 +9 -6
- package/assets/agents/gentle-ai-verify.md +4 -0
- package/assets/agents/gentle-ai-worker.md +1 -0
- package/assets/migrations/agent-body-history.json +147 -0
- package/assets/orchestrator-delegation-reference.md +3 -3
- package/assets/orchestrator-delegation.md +2 -2
- package/assets/orchestrator-verification.md +10 -6
- package/assets/orchestrator.md +8 -8
- package/bin/gentle-shell.mjs +61 -26
- package/docs/ci-performance.md +11 -0
- package/docs/delegated-verification.md +6 -0
- package/docs/fast-mode.md +15 -0
- package/docs/gentle-agents-activity.md +8 -0
- package/docs/gentle-music.md +6 -3
- package/docs/gentle-shell.md +70 -20
- package/docs/install-wizard.md +1 -1
- package/docs/mcp-status.md +52 -0
- package/docs/prompt-budget.md +28 -0
- package/docs/readme-reference.md +82 -21
- package/docs/session-profile-format.md +20 -5
- package/docs/sound-notifications.md +1 -1
- package/docs/star-prompt.md +32 -0
- package/docs/work-continuity.md +46 -0
- package/extensions/ask-user-question.ts +1 -0
- package/extensions/codegraph-tools.ts +38 -4
- package/extensions/gentle-agents.ts +477 -50
- package/extensions/gentle-ai.ts +1046 -191
- package/extensions/gentle-fast.ts +61 -0
- package/extensions/gentle-guide.ts +174 -0
- package/extensions/gentle-herdr-activity.ts +21 -1
- package/extensions/gentle-herdr-agent.ts +144 -0
- package/extensions/gentle-music.ts +10 -0
- package/extensions/gentle-program-identity.ts +61 -0
- package/extensions/gentle-shell.ts +642 -97
- package/extensions/gentle-star-prompt.ts +334 -0
- package/extensions/gentle-stats.ts +5 -5
- package/extensions/gentle-todo.ts +42 -22
- package/extensions/history/store.ts +18 -12
- package/extensions/skill-registry.ts +35 -3
- package/extensions/startup-banner.ts +39 -7
- package/lib/agent-assets.ts +74 -17
- package/lib/agent-profiles.ts +1 -1
- package/lib/agents-config.ts +12 -3
- package/lib/agents-keys.ts +8 -16
- package/lib/agents-protocol.ts +80 -4
- package/lib/agents-runner.ts +105 -4
- package/lib/agents-view.ts +6 -1
- package/lib/agents-widget.ts +132 -9
- package/lib/bridge-cost.ts +28 -0
- package/lib/codemode-renderer.ts +16 -0
- package/lib/command-palette-catalog.ts +1 -0
- package/lib/command-palette.ts +21 -8
- package/lib/exploration-budget.ts +62 -0
- package/lib/gentle-guide.ts +201 -0
- package/lib/gentle-shell-launcher.ts +4 -0
- package/lib/herdr-activity.ts +9 -3
- package/lib/herdr-task-summary-policy.ts +85 -0
- package/lib/inprocess-reviewer.ts +33 -13
- package/lib/jobs-sidebar-state.ts +5 -6
- package/lib/jobs-widget.ts +16 -52
- package/lib/keymaps-customize.ts +81 -0
- package/lib/keymaps.ts +291 -0
- package/lib/model-fallback-notice.ts +61 -0
- package/lib/model-fallback-policy.ts +141 -0
- package/lib/model-fallback-store.ts +143 -0
- package/lib/model-routing-authority.ts +10 -2
- package/lib/nan-provider.ts +3 -2
- package/lib/native-review-cli.ts +7 -2
- package/lib/notification-customize.ts +48 -51
- package/lib/openai-fast-tier.ts +22 -0
- package/lib/orchestrator-discovery.ts +5 -1
- package/lib/orchestrator-fallback.ts +75 -0
- package/lib/pasted-image-paths.ts +113 -0
- package/lib/questionnaire/questionnaire-view.ts +121 -7
- package/lib/review-candidate-view-owner.ts +4 -0
- package/lib/review-candidate-view.ts +10 -7
- package/lib/review-host-relay.ts +5 -1
- package/lib/review-integration-v2.ts +22 -7
- package/lib/review-repository.ts +5 -0
- package/lib/session-profile-append-controller.ts +21 -6
- package/lib/session-profile-authority.ts +119 -0
- package/lib/session-profile-binding.ts +54 -5
- package/lib/session-profile-freeze.ts +105 -9
- package/lib/session-profile-integration.ts +313 -0
- package/lib/session-profile-persistence.ts +63 -9
- package/lib/shell-bar.ts +171 -56
- package/lib/shell-card.ts +26 -6
- package/lib/shell-page.ts +120 -0
- package/lib/shell-panel.ts +149 -0
- package/lib/shell-prompt.ts +53 -1
- package/lib/shell-sidebar-layout.ts +98 -25
- package/lib/shell-sidebar.ts +54 -1
- package/lib/shell-stats.ts +123 -0
- package/lib/shell-todo.ts +71 -0
- package/lib/shell-usage.ts +12 -2
- package/lib/star-prompt.ts +197 -0
- package/lib/verifier-admission.ts +18 -8
- package/lib/verifier-settle-reminder.ts +64 -0
- package/lib/vim-editor-adapter.ts +6 -1
- package/lib/visual-customization-policy.ts +41 -6
- package/lib/visual-customize-view.ts +164 -26
- package/lib/visual-layout-preview.ts +43 -0
- package/lib/yolo-session-policy.ts +28 -1
- package/package.json +1 -1
- package/runtime/gentle-shell-launcher.mjs +4 -0
- package/runtime/native-review-cli.mjs +7 -2
- package/runtime/review-integration-v2.mjs +22 -7
- package/runtime/windows-session-transport.ps1 +60 -3
- package/scripts/bootstrap.sh +4 -1
- package/scripts/installer-preflight.mjs +1 -1
- package/scripts/pi-update.mjs +113 -3
- package/scripts/run-test-suite.mjs +17 -1
- package/scripts/shell-snapshot.mjs +340 -0
- package/scripts/test-packed-runner.mjs +1 -1
- package/scripts/update-agent-body-history.mjs +41 -0
- package/scripts/verify-installer-tap.mjs +45 -0
- package/scripts/verify-package-files.mjs +2 -0
- package/skills/gentle-ai/SKILL.md +2 -2
- package/skills/tui-design/NOTICE.md +5 -0
- package/skills/tui-design/SKILL.md +56 -0
- package/skills/tui-design/references/commands.md +75 -0
- package/skills/tui-design/references/critique.md +48 -0
- package/skills/tui-design/references/design-doc.md +44 -0
- package/skills/tui-design/references/terminal-craft.md +64 -0
- package/skills/tui-design/references/visual-loop.md +32 -0
- package/tests/agents-protocol.test.ts +53 -1
- package/tests/agents-runner.test.ts +168 -3
- package/tests/agents-view.test.ts +27 -0
- package/tests/agents-widget.test.ts +312 -10
- package/tests/bounded-scan-contract.test.ts +39 -0
- package/tests/bridge-cost.test.ts +32 -0
- package/tests/bundled-install.test.ts +6 -4
- package/tests/ci-concurrency.test.ts +11 -0
- package/tests/ci-merge-base-identity.test.ts +114 -0
- package/tests/codegraph-tools.test.ts +69 -0
- package/tests/codemode-rendering.test.ts +22 -2
- package/tests/command-palette.test.ts +16 -2
- package/tests/commit-slice-signal.test.ts +11 -9
- package/tests/delegate-for-reason-contract.test.ts +5 -4
- package/tests/design-canvas-server.test.ts +6 -2
- package/tests/exploration-budget.test.ts +128 -0
- package/tests/fixtures/agent-assets/gentle-ai-worker.strict-tdd-era.md +122 -0
- package/tests/fixtures/measure-orchestrator-prompt.mjs +2 -1
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +18 -10
- package/tests/fixtures/session-profile-v1/replay.ts +125 -0
- package/tests/fixtures/session-profile-v1/session-profile-authority.ts +113 -0
- package/tests/fixtures/session-profile-v1/session-profile-binding.ts +83 -0
- package/tests/fixtures/session-profile-v1/session-profile-disk-reader.ts +182 -0
- package/tests/fixtures/session-profile-v1/session-profile-freeze.ts +290 -0
- package/tests/fixtures/session-profile-v1/session-profile-persistence.ts +195 -0
- package/tests/fixtures/session-profile-v1/v1-inputs.ts +16 -0
- package/tests/fixtures/windows-pipe-availability.ps1 +26 -0
- package/tests/fixtures/windows-session-bootstrap.ps1 +6 -2
- package/tests/gentle-agents.test.ts +416 -21
- package/tests/gentle-ai-exploration-budget.test.ts +135 -0
- package/tests/gentle-ai.test.ts +1011 -37
- package/tests/gentle-fast.test.ts +73 -0
- package/tests/gentle-guide.test.ts +208 -0
- package/tests/gentle-herdr-activity.test.ts +76 -2
- package/tests/gentle-herdr-agent.test.ts +111 -0
- package/tests/gentle-music.test.ts +36 -1
- package/tests/gentle-program-identity.test.ts +197 -0
- package/tests/gentle-shell-bin.test.ts +49 -26
- package/tests/gentle-shell-launcher.test.ts +18 -2
- package/tests/gentle-shell.test.ts +1068 -37
- package/tests/gentle-stats.test.ts +15 -2
- package/tests/gentle-todo.test.ts +50 -4
- package/tests/herdr-task-summary-policy.test.ts +128 -0
- package/tests/history-store-private-mode.test.ts +40 -0
- package/tests/image-paste-chips.test.ts +42 -0
- package/tests/inprocess-reviewer.test.ts +122 -0
- package/tests/installer-posix-bootstrap.test.ts +67 -5
- package/tests/installer-server.test.ts +2 -2
- package/tests/installer-windows-diagnostics.test.ts +4 -5
- package/tests/isolated-config-home.ts +28 -0
- package/tests/jobs-widget.test.ts +25 -37
- package/tests/keymaps-customize.test.ts +114 -0
- package/tests/keymaps.test.ts +103 -0
- package/tests/maintainer/mcp-status.maintest.ts +88 -0
- package/tests/maintainer/pi-update-source.maintest.ts +116 -0
- package/tests/model-fallback-notice.test.ts +45 -0
- package/tests/model-fallback-policy.test.ts +83 -0
- package/tests/model-fallback-store.test.ts +111 -0
- package/tests/nan-provider.test.ts +4 -4
- package/tests/no-self-pause-contract.test.ts +19 -0
- package/tests/notification-customize.test.ts +58 -34
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/odd-routing-contract.test.ts +1 -1
- package/tests/orchestrator-fallback.test.ts +82 -0
- package/tests/orchestrator-prompt-budget.test.ts +131 -0
- package/tests/package-manifest.test.ts +160 -7
- package/tests/pasted-image-paths.test.ts +118 -0
- package/tests/persona-reply-language.test.ts +61 -0
- package/tests/pi-update-launcher.test.ts +32 -8
- package/tests/pi-update-source.test.ts +162 -0
- package/tests/profile-fast-tier.test.ts +311 -0
- package/tests/profile-tier-footer.test.ts +79 -0
- package/tests/questionnaire-view.test.ts +150 -0
- package/tests/review-candidate-owner-sweep.test.ts +93 -0
- package/tests/review-candidate-view.test.ts +51 -0
- package/tests/review-controller-native-routing.test.ts +120 -6
- package/tests/review-gate.test.ts +24 -0
- package/tests/review-inspect-preflight.test.ts +197 -0
- package/tests/review-integration-v2-forward.test.ts +59 -0
- package/tests/review-repository.test.ts +52 -1
- package/tests/review-sidebar-state.test.ts +5 -5
- package/tests/run-test-suite.test.ts +61 -5
- package/tests/sensitive-path-tools.test.ts +74 -0
- package/tests/session-profile-append-controller.test.ts +63 -0
- package/tests/session-profile-authority.test.ts +259 -0
- package/tests/session-profile-binding.test.ts +15 -0
- package/tests/session-profile-extension.test.ts +615 -0
- package/tests/session-profile-freeze.test.ts +110 -2
- package/tests/session-profile-integration.test.ts +857 -0
- package/tests/session-profile-persistence.test.ts +57 -0
- package/tests/session-profile-v1-compat.test.ts +221 -0
- package/tests/shell-bar.test.ts +113 -55
- package/tests/shell-card.test.ts +13 -1
- package/tests/shell-page.test.ts +108 -0
- package/tests/shell-panel.test.ts +332 -0
- package/tests/shell-prompt.test.ts +54 -0
- package/tests/shell-render-cache.test.ts +5 -0
- package/tests/shell-sidebar-fullscreen.test.ts +12 -0
- package/tests/shell-sidebar-layout.test.ts +159 -27
- package/tests/shell-stats.test.ts +90 -0
- package/tests/shell-usage.test.ts +14 -0
- package/tests/skill-registry.test.ts +68 -1
- package/tests/star-prompt.test.ts +470 -0
- package/tests/startup-banner.test.ts +57 -1
- package/tests/task-size-routing-contract.test.ts +45 -1
- package/tests/verifier-settle-reminder.test.ts +281 -0
- package/tests/verify-first-launch-contract.test.ts +56 -5
- package/tests/verify-installer-tap.test.ts +57 -0
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +61 -7
- package/tests/visual-customize-view.test.ts +253 -8
- package/tests/visual-layout-preview.test.ts +28 -0
- package/tests/windows-session-bootstrap.test.ts +105 -2
- package/tests/work-continuity-contract.test.ts +86 -0
- package/tests/writer-surfaces.test.ts +12 -10
- package/tests/yolo-customize.test.ts +30 -11
- package/tests/yolo-mode-runtime.test.ts +4 -2
- package/tests/yolo-mode.test.ts +16 -2
|
@@ -347,7 +347,7 @@ function windowsNpmInvocation() {
|
|
|
347
347
|
throw new Error("could not resolve npm-cli.js without a command shell");
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
function runNpmWithEnv(arguments_, env, options) {
|
|
350
|
+
export function runNpmWithEnv(arguments_, env, options) {
|
|
351
351
|
const invocation = process.platform === "win32" ? windowsNpmInvocation() : { file: "npm", prefix: [] };
|
|
352
352
|
return execFileSync(invocation.file, [...invocation.prefix, ...arguments_], { ...options, env });
|
|
353
353
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Regenerates assets/migrations/agent-body-history.json: the sha256 of every
|
|
3
|
+
// body (text after the frontmatter) each packaged agent has had in git
|
|
4
|
+
// history. Installation uses it to keep refreshing package agents whose
|
|
5
|
+
// frontmatter was edited locally. Run after changing any assets/agents file.
|
|
6
|
+
import { execFileSync } from "node:child_process";
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import { readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
|
|
12
|
+
const root = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
13
|
+
const agentsDir = join(root, "assets", "agents");
|
|
14
|
+
const output = join(root, "assets", "migrations", "agent-body-history.json");
|
|
15
|
+
|
|
16
|
+
// Mirrors agentBody() in lib/agent-assets.ts.
|
|
17
|
+
function agentBody(content) {
|
|
18
|
+
if (!content.startsWith("---\n")) return content;
|
|
19
|
+
const endIndex = content.indexOf("\n---", 4);
|
|
20
|
+
return endIndex === -1 ? content : content.slice(endIndex);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const hash = (content) => createHash("sha256").update(agentBody(content)).digest("hex");
|
|
24
|
+
const git = (...args) => execFileSync("git", args, { cwd: root, encoding: "utf8", maxBuffer: 64 * 1024 * 1024 });
|
|
25
|
+
|
|
26
|
+
const bodies = {};
|
|
27
|
+
for (const file of readdirSync(agentsDir).filter((name) => name.endsWith(".md")).sort()) {
|
|
28
|
+
const path = `assets/agents/${file}`;
|
|
29
|
+
const hashes = new Set([hash(readFileSync(join(agentsDir, file), "utf8"))]);
|
|
30
|
+
for (const commit of git("log", "--format=%H", "--", path).split("\n").filter(Boolean)) {
|
|
31
|
+
// A commit that deleted or renamed the file has no body to record. Any
|
|
32
|
+
// other git failure (missing objects in a partial clone) must fail loudly
|
|
33
|
+
// instead of writing a truncated history.
|
|
34
|
+
if (git("ls-tree", commit, "--", path).trim() === "") continue;
|
|
35
|
+
hashes.add(hash(git("show", `${commit}:${path}`)));
|
|
36
|
+
}
|
|
37
|
+
bodies[`agents/${file}`] = [...hashes].sort();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
writeFileSync(output, `${JSON.stringify({ schemaVersion: 1, bodies }, null, 2)}\n`);
|
|
41
|
+
console.log(`agent body history: ${Object.values(bodies).flat().length} hashes for ${Object.keys(bodies).length} agents`);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
function fail(message) { throw new Error(message); }
|
|
4
|
+
|
|
5
|
+
try {
|
|
6
|
+
// Keep the inventory tied to the actual top-level declarations and parameter modes.
|
|
7
|
+
const source = readFileSync(new URL("../tests/installer-windows-bootstrap.test.ts", import.meta.url), "utf8");
|
|
8
|
+
const names = [...source.matchAll(/^test\(("native Windows(?:[^"\\]|\\.)*")\s*,/gm)].map((match) => JSON.parse(match[1]));
|
|
9
|
+
const modesSource = /^const probeModes = \[([^\]]*)\] as const;$/m.exec(source);
|
|
10
|
+
if (!modesSource || !/^for \(const mode of probeModes\) \{\n\ttest\(`native Windows: pre-Node production process primitive \$\{mode\}`/m.test(source)) fail("native mode declarations changed");
|
|
11
|
+
const modes = JSON.parse(`[${modesSource[1]}]`);
|
|
12
|
+
if (!Array.isArray(modes) || modes.some((mode) => typeof mode !== "string")) fail("invalid native modes");
|
|
13
|
+
names.push(...modes.map((mode) => `native Windows: pre-Node production process primitive ${mode}`));
|
|
14
|
+
if (names.length !== 38 || new Set(names).size !== 38) fail("expected 38 unique native declarations");
|
|
15
|
+
|
|
16
|
+
const text = readFileSync(0, "utf8").replaceAll("\r\n", "\n");
|
|
17
|
+
if (!text.startsWith("TAP version 13\n") || !text.endsWith("\n") || [...text.matchAll(/^TAP version 13$/gm)].length !== 1) fail("missing or duplicate TAP header, or missing final newline");
|
|
18
|
+
const plans = [...text.matchAll(/^1\.\.(\d+)$/gm)];
|
|
19
|
+
const summaries = [...text.matchAll(/^# tests (\d+)\n# suites (\d+)\n# pass (\d+)\n# fail (\d+)\n# cancelled (\d+)\n# skipped (\d+)\n# todo (\d+)\n# duration_ms ([\d.]+)\n/gm)];
|
|
20
|
+
if (plans.length !== 1 || summaries.length !== 1 || summaries[0].index <= plans[0].index || summaries[0].index + summaries[0][0].length !== text.length) fail("missing, duplicate or incomplete plan/summary");
|
|
21
|
+
for (const field of ["tests", "suites", "pass", "fail", "cancelled", "skipped", "todo", "duration_ms"]) {
|
|
22
|
+
if ([...text.matchAll(new RegExp(`^# ${field} `, "gm"))].length !== 1) fail(`duplicate or missing summary field: ${field}`);
|
|
23
|
+
}
|
|
24
|
+
const results = [...text.matchAll(/^(ok|not ok) (\d+) - (.+)$/gm)];
|
|
25
|
+
const [tests, suites, pass, failed, cancelled, skipped, todo] = summaries[0].slice(1, 8).map(Number);
|
|
26
|
+
const topLevelSkips = results.filter((result) => /\s+# SKIP\b/i.test(result[3])).length;
|
|
27
|
+
if (failed || cancelled || todo || pass < 38 || tests !== pass + skipped || results.length !== Number(plans[0][1]) || results.length > tests + suites || topLevelSkips > skipped || results.length - topLevelSkips > pass + suites) fail("inconsistent TAP accounting");
|
|
28
|
+
if (results.some((result, index) => Number(result[2]) !== index + 1 || result.index >= plans[0].index || result[1] !== "ok")) fail("invalid TAP results");
|
|
29
|
+
// Node's TAP reporter escapes backslashes in names before printing them.
|
|
30
|
+
const seen = new Map(names.map((name) => [name.replaceAll("\\", "\\\\"), 0]));
|
|
31
|
+
for (const result of results) {
|
|
32
|
+
const name = result[3];
|
|
33
|
+
if (seen.has(name)) seen.set(name, seen.get(name) + 1);
|
|
34
|
+
else if (name.startsWith("native Windows")) fail(`unexpected or non-passing native result: ${name}`);
|
|
35
|
+
}
|
|
36
|
+
for (const [name, count] of seen) if (count !== 1) fail(`expected one native PASS: ${name} (found ${count})`);
|
|
37
|
+
// Top-level output consists of results, plan, header and comments. Nested TAP is indented.
|
|
38
|
+
for (const line of text.split("\n")) {
|
|
39
|
+
if (line && !line.startsWith(" ") && line !== "TAP version 13" && !line.startsWith("#") && !/^(?:ok|not ok) \d+ - .+$/.test(line) && !/^1\.\.\d+$/.test(line)) fail(`malformed top-level line: ${line}`);
|
|
40
|
+
}
|
|
41
|
+
console.log("installer TAP: 38 native passes, zero native skips");
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error(`installer TAP: ${error.message}`);
|
|
44
|
+
process.exitCode = 1;
|
|
45
|
+
}
|
|
@@ -31,6 +31,7 @@ export const requiredPaths = [
|
|
|
31
31
|
"bin/gentle-shell.mjs",
|
|
32
32
|
...installerPaths,
|
|
33
33
|
"extensions/gentle-notifications.ts",
|
|
34
|
+
"extensions/gentle-star-prompt.ts",
|
|
34
35
|
"lib/notification-audio.ts",
|
|
35
36
|
"lib/notification-audio-native.ts",
|
|
36
37
|
"lib/notification-audio-windows.ts",
|
|
@@ -41,6 +42,7 @@ export const requiredPaths = [
|
|
|
41
42
|
"lib/notification-customize.ts",
|
|
42
43
|
"lib/notification-events.ts",
|
|
43
44
|
"lib/notification-policy.ts",
|
|
45
|
+
"lib/star-prompt.ts",
|
|
44
46
|
"lib/notification-scheduler.ts",
|
|
45
47
|
"lib/notification-service.ts",
|
|
46
48
|
"lib/notification-ui.ts",
|
|
@@ -13,7 +13,7 @@ When asked who or what you are, answer as el Gentleman: a Pi-specific coding-age
|
|
|
13
13
|
|
|
14
14
|
## Compact Rules
|
|
15
15
|
|
|
16
|
-
- Clarify scope, constraints, acceptance criteria, and non-goals
|
|
16
|
+
- 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.
|
|
17
17
|
- Size every task by the orchestrator's Task Size section: understood, contained risk, and resumable from the original request plus `git diff`. Counts of files, commands, tests, or fixes never decide it. Track only large work in its task document and mirror.
|
|
18
18
|
- For behavior changes with applicable runnable deterministic tests and a clear expected outcome, use test-first by default: observe RED, GREEN, relevant alternate cases, then REFACTOR and record evidence. Test presence alone does not establish applicability. For passive documentation, non-testable changes, an unavailable runner, or no meaningful RED, state why and run proportionate ordinary functional or structural verification. Never invent RED/GREEN, skip checks, or require a chat/TUI toggle.
|
|
19
19
|
- Keep one parent session responsible for orchestration; child subagents should receive concrete phase work and must not spawn more subagents.
|
|
@@ -43,7 +43,7 @@ clarify → scout/context-builder when context-heavy → inline, or a writer onl
|
|
|
43
43
|
|
|
44
44
|
Hard delegation triggers:
|
|
45
45
|
|
|
46
|
-
- **Evidence-budget rule**: read inline only when the evidence fits one parallel batch of at most 3 calls, ~10k tokens (grep and line ranges, never whole large files). When understanding needs more reading or more than ~5 sequential lookups, delegate one explorer that returns a handoff of at most ~2k tokens with `path:line` evidence.
|
|
46
|
+
- **Evidence-budget rule**: read inline only when the evidence fits one parallel batch of at most 3 calls, ~10k tokens (grep and line ranges, never whole large files). Reassess cumulative discovery after each batch; do not reset the budget. When understanding needs more reading or more than ~5 sequential lookups, delegate one explorer that returns a handoff of at most ~2k tokens with `path:line` evidence. A fired trigger overrides initial task size; read-only restricts mutation, not exploration. Preparation for an already understood inline write stays inline, not further discovery. A known small targeted question within budget stays inline; do not re-read what the handoff covered beyond one spot check.
|
|
47
47
|
- **Writer rule**: a writer only for a reason (parallel units launched together, or context); size and file count never fire it.
|
|
48
48
|
- **Verification rule**: a change that touches a named high-risk item gets an independent verifier (assess `escalate`); otherwise the change's own focused test and suite run inline.
|
|
49
49
|
- **Incident rule**: after wrong cwd, accidental worktree/repo mutation, merge recovery, confusing test command, or environment workaround, diagnose separately.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Notice
|
|
2
|
+
|
|
3
|
+
This skill is original text. Its methodology (named design commands, scored critique with P0-P3 severities, operate-mode guidance, product and design context files, anti-pattern catalog) is inspired by impeccable by Paul Bakaus, licensed under Apache-2.0: https://github.com/pbakaus/impeccable
|
|
4
|
+
|
|
5
|
+
No impeccable files are redistributed here, and the impeccable name is used only for attribution.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gentle-ai-tui-design
|
|
3
|
+
description: "Trigger: terminal UI design, TUI redesign, Gentle Shell look, IDE in a terminal, sidebar/status bar polish, critique TUI. Design, critique and refine terminal UIs with visual proof."
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
author: gentleman-programming
|
|
7
|
+
version: "1.0"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Activation Contract
|
|
11
|
+
|
|
12
|
+
Use for designing, reviewing or refining a terminal interface (panels, rails, status bars, cards, prompts), especially Gentle Shell. The target feel is an IDE inside a terminal: dense, calm, developer-first, never a costume of retro TUI chrome. Not for web pages (use `gentle-design`).
|
|
13
|
+
|
|
14
|
+
## Hard Rules
|
|
15
|
+
|
|
16
|
+
- Never judge a terminal UI from code or memory: capture it (`references/visual-loop.md`) and look at the PNG before and after every change.
|
|
17
|
+
- Read `references/terminal-craft.md` before any UI edit; it is the floor, not a suggestion.
|
|
18
|
+
- Operate mode: familiarity beats expression. Use IDE vocabulary (panes, tree, tabs, status bar, command palette); the brand lives in palette, density and one signature move.
|
|
19
|
+
- Every row costs. Hierarchy comes from color role, weight and alignment, never from blank rows or nested boxes.
|
|
20
|
+
- Say each fact once per screen. Data shown in the header never repeats in a panel.
|
|
21
|
+
- One command, one target. Refinement preserves the system; redesign replaces it. Never polish a look being thrown away.
|
|
22
|
+
- Rendering stays cheap: no I/O or recomputation in render paths, cache keyed on everything that changes output (style, width, theme).
|
|
23
|
+
- Mockups (via `gentle-design`) must be terminal-expressible: monospace cell grid in `ch` units, only fg/bg colors, bold/dim/italic/underline/strikethrough, box-drawing and glyphs.
|
|
24
|
+
|
|
25
|
+
## Decision Gates
|
|
26
|
+
|
|
27
|
+
| Ask | Command | Load |
|
|
28
|
+
|-----|---------|------|
|
|
29
|
+
| No product/design context yet | `document` | `references/design-doc.md` |
|
|
30
|
+
| New surface or redesign | `shape`, then mockups, then implement | `references/commands.md` |
|
|
31
|
+
| "How does it look / what is wrong" | `critique` | `references/critique.md` |
|
|
32
|
+
| Too busy, wasted space, redundant | `distill` / `layout` / `quieter` | `references/commands.md` |
|
|
33
|
+
| Flat, no hierarchy, unreadable | `typeset` / `colorize` / `bolder` | `references/commands.md` |
|
|
34
|
+
| Edge cases, narrow terminals, long text | `harden` / `adapt` | `references/commands.md` |
|
|
35
|
+
| Final pass before commit | `polish` | `references/commands.md` |
|
|
36
|
+
|
|
37
|
+
## Execution Steps
|
|
38
|
+
|
|
39
|
+
1. Load `DESIGN.md` context if the project has one; otherwise propose `document` first.
|
|
40
|
+
2. Capture the current state with the visual loop at the shipped sizes (wide 180x50, breakpoint 140, narrow 80x24).
|
|
41
|
+
3. Run the chosen command against one named target; write findings before changing code.
|
|
42
|
+
4. Change, re-capture, compare against the previous PNG and the brief; iterate at most 3 rounds, then report.
|
|
43
|
+
5. End every refine command with `polish` checks and the repository's focused tests (render counts, overflow).
|
|
44
|
+
|
|
45
|
+
## Output Contract
|
|
46
|
+
|
|
47
|
+
Return: target, command run, before/after PNG paths, findings fixed with P0-P3 tags, findings left open, and checks run.
|
|
48
|
+
|
|
49
|
+
## References
|
|
50
|
+
|
|
51
|
+
- `references/terminal-craft.md`: floor rules and terminal anti-patterns.
|
|
52
|
+
- `references/commands.md`: command playbooks adapted to terminals.
|
|
53
|
+
- `references/critique.md`: scored critique and severity rubric.
|
|
54
|
+
- `references/design-doc.md`: DESIGN.md shape for a terminal product.
|
|
55
|
+
- `references/visual-loop.md`: screenshot harness and comparison loop.
|
|
56
|
+
- `NOTICE.md`: attribution.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Command Playbooks (terminal)
|
|
2
|
+
|
|
3
|
+
Each command takes one named target (a panel, a bar, a card type). Every refine command finishes with `polish`.
|
|
4
|
+
|
|
5
|
+
## shape (plan before code)
|
|
6
|
+
|
|
7
|
+
- Ask 2-3 questions per round: purpose, who uses it and how often, what success looks like; then content ranges, states and width limits.
|
|
8
|
+
- Output a brief: goal, users and frequency, content inventory with ranges, states, layout at each width, keyboard/mouse model, open questions. No code.
|
|
9
|
+
|
|
10
|
+
## distill (remove what does not earn its rows)
|
|
11
|
+
|
|
12
|
+
- One primary goal per panel; say each fact once per screen.
|
|
13
|
+
- Flatten nesting; delete group titles that only restate the content.
|
|
14
|
+
- Collapse finished or idle content to a summary row.
|
|
15
|
+
- Keep the fixed rail; distill its contents, not its existence.
|
|
16
|
+
|
|
17
|
+
## layout (spacing and rhythm)
|
|
18
|
+
|
|
19
|
+
- Squint test first; fix order before decoration.
|
|
20
|
+
- Group by proximity, then separators, boxes last.
|
|
21
|
+
- Tight inside groups, one consistent gap between groups.
|
|
22
|
+
- Align values in a column; use tabular alignment for numbers and durations.
|
|
23
|
+
- Predictable structure is the affordance: same section shape everywhere.
|
|
24
|
+
|
|
25
|
+
## typeset (hierarchy without font sizes)
|
|
26
|
+
|
|
27
|
+
- Define 3-4 roles: title (bold or accent), value (normal), label (dim), meta (dim italic or muted).
|
|
28
|
+
- Apply each role identically everywhere it repeats.
|
|
29
|
+
- Prose wraps at 60-80 columns; chrome truncates.
|
|
30
|
+
|
|
31
|
+
## quieter (tone down)
|
|
32
|
+
|
|
33
|
+
- Fewer background tints, flatter surfaces, fewer accent uses, no decorative motion.
|
|
34
|
+
- Keep a few anchors (the accent on the active item) so it still has a point of view.
|
|
35
|
+
|
|
36
|
+
## bolder (amplify one thing)
|
|
37
|
+
|
|
38
|
+
- Touch only the named target; amplify what the system already owns.
|
|
39
|
+
- Commit to one move and quiet everything around it.
|
|
40
|
+
- Skeleton test: the structure must read with placeholder text.
|
|
41
|
+
|
|
42
|
+
## colorize (roles, not swatches)
|
|
43
|
+
|
|
44
|
+
- Map every color to a role from the theme; accents only for action, selection and state.
|
|
45
|
+
- Add a second neutral for side panels and bars; check contrast on it.
|
|
46
|
+
- Pair every state color with a glyph or word.
|
|
47
|
+
|
|
48
|
+
## clarify (copy)
|
|
49
|
+
|
|
50
|
+
- Controls name their action; errors say what failed, why, and how to recover.
|
|
51
|
+
- Empty states distinguish first use, nothing yet and failure.
|
|
52
|
+
- Loading names the real operation; never fake progress.
|
|
53
|
+
- One term per concept across the whole shell.
|
|
54
|
+
|
|
55
|
+
## harden (edge cases)
|
|
56
|
+
|
|
57
|
+
- Long paths and branch names, emoji and CJK widths, 0/1/1000 items, very long tasks.
|
|
58
|
+
- Missing data, failed commands, permission errors: one failing part never blanks the whole surface.
|
|
59
|
+
- Resize during render; collapsed and expanded transitions.
|
|
60
|
+
|
|
61
|
+
## adapt (other sizes)
|
|
62
|
+
|
|
63
|
+
- Rethink per width, do not scale: wide (rail visible), breakpoint (exactly at and below it), narrow 80x24.
|
|
64
|
+
- Decide what moves to the status bar or a key when the rail disappears.
|
|
65
|
+
|
|
66
|
+
## polish (final pass)
|
|
67
|
+
|
|
68
|
+
- Classify each drift: missing token, one-off value, concept mismatch, local defect.
|
|
69
|
+
- Triage: broken task, missing states, flow drift, visual, cleanup.
|
|
70
|
+
- One glyph family; every control has all its states; no stray colors.
|
|
71
|
+
- Re-capture and compare with the brief and the previous PNG.
|
|
72
|
+
|
|
73
|
+
## document (context)
|
|
74
|
+
|
|
75
|
+
- Write or update `DESIGN.md` per `design-doc.md`; never overwrite an existing one silently.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Critique (scored)
|
|
2
|
+
|
|
3
|
+
Judge from a screenshot, not from code. Write the design assessment first, then check measurable evidence (overflow, contrast, render counts) so the evidence does not anchor the judgment.
|
|
4
|
+
|
|
5
|
+
## Health score
|
|
6
|
+
|
|
7
|
+
Score each heuristic 0-4 (0 broken, 2 workable, 4 excellent); mark `n/a` and renormalize to /40 when one does not apply.
|
|
8
|
+
|
|
9
|
+
1. Visibility of system status (live work, progress, mode, permissions).
|
|
10
|
+
2. Match with developer expectations (IDE and terminal conventions).
|
|
11
|
+
3. User control (collapse, scroll, escape, undo of view changes).
|
|
12
|
+
4. Consistency (glyphs, roles, section shapes, terms).
|
|
13
|
+
5. Error prevention (dangerous modes visible, confirmations where needed).
|
|
14
|
+
6. Recognition over recall (hints where the action is, palette discoverability).
|
|
15
|
+
7. Efficiency for experts (keyboard paths, density, no wasted rows).
|
|
16
|
+
8. Minimalist design (each fact once, no decoration).
|
|
17
|
+
9. Error recovery (messages with cause and next step).
|
|
18
|
+
10. Help and documentation (discoverable keys and commands).
|
|
19
|
+
|
|
20
|
+
Bands: 36-40 excellent, 28-35 good, 20-27 acceptable, 12-19 poor, under 12 critical.
|
|
21
|
+
|
|
22
|
+
## Cognitive load check
|
|
23
|
+
|
|
24
|
+
Single focus, chunks of 4 or fewer, clear grouping, visible hierarchy, one decision at a time, 4 or fewer options per decision, no need to remember across screens, progressive disclosure. 0-1 failures is low load; 4 or more is critical.
|
|
25
|
+
|
|
26
|
+
## Personas
|
|
27
|
+
|
|
28
|
+
- Power user: lives on the keyboard, wants density and zero repetition.
|
|
29
|
+
- Keyboard/accessibility: contrast, focus visibility, no color-only state.
|
|
30
|
+
- Stress tester: long sessions, 50 agents, 200 todos, narrow terminal.
|
|
31
|
+
|
|
32
|
+
## Severity
|
|
33
|
+
|
|
34
|
+
- P0 blocking: the task cannot be done or the UI breaks (rail disappears, content unreadable).
|
|
35
|
+
- P1 major: significant difficulty or contrast failure. Tie-breaker: would a user report it? Then at least P1.
|
|
36
|
+
- P2 minor: a workaround exists.
|
|
37
|
+
- P3 polish.
|
|
38
|
+
|
|
39
|
+
## Report shape
|
|
40
|
+
|
|
41
|
+
1. Target, sizes captured, PNG paths.
|
|
42
|
+
2. Health score table and total.
|
|
43
|
+
3. Specificity verdict: could any other TUI ship this unchanged?
|
|
44
|
+
4. What works (2-3).
|
|
45
|
+
5. Priority issues (3-5): `[P?] what / why it matters / fix / command`.
|
|
46
|
+
6. Persona red flags.
|
|
47
|
+
7. Minor observations.
|
|
48
|
+
8. 2-4 questions with concrete options, last.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# DESIGN.md for a terminal product
|
|
2
|
+
|
|
3
|
+
Keep it at the project root or `design/DESIGN.md`. Describe first, then give the exact value in parentheses, and say where and why each token is used. Add 1-3 named rules per section (`**The One Fact Rule.** ...`). Never overwrite an existing file silently; propose a diff.
|
|
4
|
+
|
|
5
|
+
## Frontmatter tokens
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
colors: # roles mapped to theme color keys, not hex literals
|
|
9
|
+
canvas: ...
|
|
10
|
+
rail: ...
|
|
11
|
+
text: { primary: ..., secondary: ..., muted: ... }
|
|
12
|
+
accent: ...
|
|
13
|
+
state: { success: ..., warning: ..., error: ..., info: ... }
|
|
14
|
+
border: ...
|
|
15
|
+
roles: # type roles as attribute combinations
|
|
16
|
+
title: bold + accent
|
|
17
|
+
value: normal
|
|
18
|
+
label: dim
|
|
19
|
+
meta: dim italic
|
|
20
|
+
glyphs: # one family, by meaning
|
|
21
|
+
done: ✓
|
|
22
|
+
running: ●
|
|
23
|
+
pending: ○
|
|
24
|
+
expanded: ▾
|
|
25
|
+
collapsed: ▸
|
|
26
|
+
spacing: # in cells and rows
|
|
27
|
+
inset: 1 col
|
|
28
|
+
group-gap: 1 row
|
|
29
|
+
section-gap: 1 row
|
|
30
|
+
widths:
|
|
31
|
+
rail: 50
|
|
32
|
+
breakpoint: 140
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Sections (fixed order)
|
|
36
|
+
|
|
37
|
+
1. Overview: product, users, and a one-line north star metaphor (for example "an IDE inside a terminal").
|
|
38
|
+
2. Colors: roles and where each appears.
|
|
39
|
+
3. Type roles: hierarchy and where each role applies.
|
|
40
|
+
4. Layout: panes, rail, status bar, widths and breakpoints.
|
|
41
|
+
5. Surfaces: canvas vs rail vs elevated; how regions separate.
|
|
42
|
+
6. Glyphs: the family and meaning table.
|
|
43
|
+
7. Components: each panel/bar/card with its states.
|
|
44
|
+
8. Do's and Don'ts: named rules and refusals specific to this product.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Terminal Craft Floor
|
|
2
|
+
|
|
3
|
+
Read before any terminal UI edit. Every item is checkable in a screenshot.
|
|
4
|
+
|
|
5
|
+
## The medium
|
|
6
|
+
|
|
7
|
+
- The grid is the cell. Spacing is measured in columns and rows; a blank row is the most expensive spacing unit, a single space column the cheapest.
|
|
8
|
+
- Type roles come from bold, dim, italic, case and color role, not size. Keep roles few (3-4) and identical wherever they repeat.
|
|
9
|
+
- Glyphs are the icon system. Pick one family (for example geometric: `●○◐✓✗▸▾`) and use it everywhere; never mix flower, emoji and geometric glyphs for the same role.
|
|
10
|
+
- Double-width cells (emoji, CJK) break alignment and width budgets; avoid emoji in chrome, measure with `visibleWidth`.
|
|
11
|
+
|
|
12
|
+
## Hierarchy
|
|
13
|
+
|
|
14
|
+
- One primary element per panel, 2-3 secondary, everything else muted.
|
|
15
|
+
- Labels dim, values normal, the one thing that matters bright or accented.
|
|
16
|
+
- Align key/value pairs in a column (`label value`), not label-above-value stacks.
|
|
17
|
+
- Group by proximity first; add a separator only when proximity fails; add a box only when the region is interactive or scrolls independently.
|
|
18
|
+
- Squint test: in a blurred screenshot the order primary > secondary > groups must still read.
|
|
19
|
+
|
|
20
|
+
## Space and density
|
|
21
|
+
|
|
22
|
+
- Density matches frequency of use: always-visible chrome is dense (one row per fact), rarely used detail goes behind a key or expands.
|
|
23
|
+
- Rhythm comes from contrast: tight inside a group, one gap between groups, never the same gap everywhere.
|
|
24
|
+
- Panel chrome budget: header row plus content. Padding rows above, below and between header and body must earn their place.
|
|
25
|
+
- Truncate with `…` rather than wrap in fixed-width rails; wrap only prose.
|
|
26
|
+
- Finished items (done todos, completed agents) collapse to a summary row.
|
|
27
|
+
|
|
28
|
+
## Color roles
|
|
29
|
+
|
|
30
|
+
- Build roles, not swatches: canvas, elevated surface, rail surface (a second neutral, slightly tinted), text primary/secondary/muted, accent (action, selection, focus), success/warning/error/info, border.
|
|
31
|
+
- Accent only for action, selection and live state; one accent hue.
|
|
32
|
+
- Never gray text on a colored background; use a darker shade of the background hue.
|
|
33
|
+
- Never encode state by color alone; pair it with a glyph or word.
|
|
34
|
+
- Dark is designed, not inverted; check contrast of dim text on tinted surfaces.
|
|
35
|
+
|
|
36
|
+
## IDE vocabulary (Operate mode)
|
|
37
|
+
|
|
38
|
+
- Status bar: one row, fixed position, segments separated by thin dividers, most volatile data on the right.
|
|
39
|
+
- Side panel: sections with a one-row header (`▾ NAME count`), collapsible, dense lists below.
|
|
40
|
+
- Panes are separated by a single thin rule or a surface tint, not by framed boxes with gaps.
|
|
41
|
+
- Keyboard hints live in the status bar or appear on focus/hover, not repeated in every header.
|
|
42
|
+
- Command palette and slash commands are the navigation model; do not invent new affordances.
|
|
43
|
+
|
|
44
|
+
## Refuse (terminal anti-patterns)
|
|
45
|
+
|
|
46
|
+
- Boxes inside boxes, or a card per tiny fact.
|
|
47
|
+
- A colored side bar (`▌`/`┃`) on every item as decoration.
|
|
48
|
+
- Blank rows as the main hierarchy tool; monotonous spacing.
|
|
49
|
+
- Text flush against a colored band with no inset cell.
|
|
50
|
+
- The same fact shown twice on one screen (header and panel).
|
|
51
|
+
- Redundant labels repeated 3+ times in one panel; words like "Collapse" where a glyph says it.
|
|
52
|
+
- Letter-spaced or ALL CAPS body text.
|
|
53
|
+
- Decorative animation; spinners or pulses only for genuinely live work.
|
|
54
|
+
- Retro costume: fake function-key bars, ASCII art banners, neon-on-black palettes chosen for vibe.
|
|
55
|
+
- Colors outside the theme tokens.
|
|
56
|
+
- Copy tells: em-dash chains, marketing words, aphorisms in status text.
|
|
57
|
+
|
|
58
|
+
## Verify
|
|
59
|
+
|
|
60
|
+
- Contrast of dim and muted text on every surface it appears on.
|
|
61
|
+
- Every interactive row has default, hover, focus, selected, disabled and loading looks.
|
|
62
|
+
- Long values (paths, branch names), empty states, 0 and 1000 items, narrow widths.
|
|
63
|
+
- No line exceeds its column budget (an overflowing rail line can disable the whole rail in Gentle Shell).
|
|
64
|
+
- Render cost: unchanged frames re-render nothing; style and width changes invalidate caches.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Visual Loop (eyes)
|
|
2
|
+
|
|
3
|
+
## Gentle Shell harness
|
|
4
|
+
|
|
5
|
+
From a Gentle Shell checkout that has `scripts/shell-snapshot.mjs`:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
node scripts/shell-snapshot.mjs --latest-rich # newest session with todos and subagents
|
|
9
|
+
node scripts/shell-snapshot.mjs --session <file.jsonl> --cols 180 --rows 50
|
|
10
|
+
node scripts/shell-snapshot.mjs --latest-rich --cols 139 --rows 40 # just below the rail breakpoint
|
|
11
|
+
node scripts/shell-snapshot.mjs --latest-rich --cols 80 --rows 24 # narrow
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- It forks the session into a `/tmp/gentle-eyes.*` scratch dir (`--fork --session-dir`), so the source session is never written.
|
|
15
|
+
- It launches the checkout's own `bin/gentle-shell.mjs` in fullscreen under ttyd and headless Chrome, and prints PNG paths; read them with the image-capable read tool.
|
|
16
|
+
- It strips inherited agent variables (`PI_*`, `GENTLE_PI_*`, `GENTLE_SHELL_*`, `HERDR_*`); without that a shell launched from an agent acts as a child and never mounts the rail.
|
|
17
|
+
- Never type prompts into the captured shell: it inherits the user's permission mode.
|
|
18
|
+
- Remove the scratch dirs it reports when done.
|
|
19
|
+
|
|
20
|
+
vhs 0.12.0 produced no output on this machine; prefer the harness.
|
|
21
|
+
|
|
22
|
+
## Loop
|
|
23
|
+
|
|
24
|
+
1. Capture "before" at the sizes that matter; name files by size and step.
|
|
25
|
+
2. Write the critique or brief before editing.
|
|
26
|
+
3. Edit, re-capture, read both PNGs, and compare against the brief point by point.
|
|
27
|
+
4. Stop after 3 rounds or when no P0-P2 remains; report what is left.
|
|
28
|
+
5. Pair visual checks with the repo's focused render tests (render counts, overflow, breakpoints).
|
|
29
|
+
|
|
30
|
+
## Mockups first
|
|
31
|
+
|
|
32
|
+
For redesigns, draw directions with `gentle-design` before code. Constrain artboards to the terminal: a fixed monospace grid in `ch` units at the real column count, theme colors only, no font sizes or radii, glyphs from the DESIGN.md family. Then match the implementation screenshot to the chosen artboard.
|
|
@@ -16,6 +16,58 @@ import {
|
|
|
16
16
|
type TaskRecord,
|
|
17
17
|
} from "../lib/agents-protocol.ts";
|
|
18
18
|
|
|
19
|
+
function terminalError(message: Record<string, unknown>) {
|
|
20
|
+
const [event] = normalizeRpcEvent({ type: "agent_end", messages: [{ role: "assistant", content: [], stopReason: "error", ...message }] });
|
|
21
|
+
assert.equal(event?.type, TASK_EVENT.AGENT_END);
|
|
22
|
+
return event as Extract<typeof event, { type: typeof TASK_EVENT.AGENT_END }>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
test("terminal assistant errors expose one closed category, never provider text (#2322)", () => {
|
|
26
|
+
const cases: Array<[string, Record<string, unknown>, string]> = [
|
|
27
|
+
["rate limit error type", { errorMessage: "429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\"}}" }, "rate_limit"],
|
|
28
|
+
["too many requests", { errorMessage: "Too Many Requests" }, "rate_limit"],
|
|
29
|
+
["bare 429 status", { errorMessage: "429: {}" }, "rate_limit"],
|
|
30
|
+
["quota on a 429", { errorMessage: "429 You exceeded your current quota (insufficient_quota)" }, "quota"],
|
|
31
|
+
["invalid key", { errorMessage: "401 invalid x-api-key" }, "auth"],
|
|
32
|
+
["forbidden status", { errorMessage: "Provider (403): {}" }, "auth"],
|
|
33
|
+
["prompt too long", { errorMessage: "400 prompt is too long: 210000 tokens > 200000 maximum" }, "context_length"],
|
|
34
|
+
["context window raw stop reason", { rawStopReason: "model_context_window_exceeded" }, "context_length"],
|
|
35
|
+
["timed out", { errorMessage: "Request timed out." }, "timeout"],
|
|
36
|
+
["diagnostic timeout code", { diagnostics: [{ type: "stream", timestamp: 1, error: { message: "x", code: "ETIMEDOUT" } }] }, "timeout"],
|
|
37
|
+
["fetch failed", { errorMessage: "fetch failed" }, "network"],
|
|
38
|
+
["connection reset", { errorMessage: "read ECONNRESET" }, "network"],
|
|
39
|
+
["overloaded", { errorMessage: "529 {\"type\":\"overloaded_error\"}" }, "provider_unavailable"],
|
|
40
|
+
["bad gateway status", { errorMessage: "502: <html>" }, "provider_unavailable"],
|
|
41
|
+
["invalid request", { errorMessage: "400 invalid_request_error: messages.0 is malformed" }, "invalid_request"],
|
|
42
|
+
["unmatched provider text", { errorMessage: "Provider finish_reason: content_filter" }, "unavailable"],
|
|
43
|
+
["token count is not a status", { errorMessage: "stopped after 500 tokens" }, "unavailable"],
|
|
44
|
+
["no error message", {}, "unavailable"],
|
|
45
|
+
["non-string error message", { errorMessage: { status: 429 } }, "unavailable"],
|
|
46
|
+
["raw stop reason that is not an identifier", { rawStopReason: "rate limit <script>" }, "unavailable"],
|
|
47
|
+
["signal beyond the scan bound", { errorMessage: `${"x".repeat(5000)} rate limit` }, "unavailable"],
|
|
48
|
+
];
|
|
49
|
+
for (const [name, message, category] of cases) {
|
|
50
|
+
assert.deepEqual(terminalError(message), { type: TASK_EVENT.AGENT_END, text: "", outcome: "error", diagnostic: `assistant reported an error (${category})`, errorCategory: category }, name);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("terminal error categories never carry provider payload into the event or the task (#2322)", () => {
|
|
55
|
+
const secret = "sk-live-never-copy-7f3a";
|
|
56
|
+
const event = terminalError({ errorMessage: `429 rate limit for key ${secret} at https://private.example/v1`, rawStopReason: "error", diagnostics: [{ type: "stream", timestamp: 1, error: { message: secret, code: secret } }] });
|
|
57
|
+
assert.equal(event.errorCategory, "rate_limit");
|
|
58
|
+
assert.equal(JSON.stringify(event).includes("never-copy"), false);
|
|
59
|
+
assert.equal(JSON.stringify(event).includes("private.example"), false);
|
|
60
|
+
const store = new TaskStore();
|
|
61
|
+
store.add(record({ status: TASK_STATUS.RUNNING }));
|
|
62
|
+
store.apply("t1", event, 2);
|
|
63
|
+
const task = store.get("t1");
|
|
64
|
+
assert.equal(task?.error, "assistant reported an error (rate_limit)");
|
|
65
|
+
assert.equal(task?.lastStep, "assistant reported an error (rate_limit)");
|
|
66
|
+
assert.equal(task?.result, null);
|
|
67
|
+
assert.equal(JSON.stringify(task).includes("never-copy"), false);
|
|
68
|
+
assert.equal(JSON.stringify(store.thread("t1")).includes("never-copy"), false);
|
|
69
|
+
});
|
|
70
|
+
|
|
19
71
|
test("status observers see only live transitions, remain isolated and cannot fail mutations", () => {
|
|
20
72
|
const store = new TaskStore();
|
|
21
73
|
const changes: Array<{ status: string; sequence: number; parentSessionId: string; producerId: string; runId: string }> = [];
|
|
@@ -101,7 +153,7 @@ test("normalizeRpcEvent maps pi RPC events to task deltas and ignores the rest",
|
|
|
101
153
|
assert.deepEqual(normalizeRpcEvent({ type: "tool_execution_end", toolCallId: "c1", toolName: "bash", isError: true, result: { content: [{ type: "text", text: "boom" }] } }), [{ type: TASK_EVENT.TOOL_END, callId: "c1", output: "boom", isError: true }]);
|
|
102
154
|
assert.deepEqual(normalizeRpcEvent({ type: "turn_end" }), [{ type: TASK_EVENT.TURN_END }]);
|
|
103
155
|
assert.deepEqual(normalizeRpcEvent({ type: "agent_end", messages: [{ role: "assistant", content: [{ type: "text", text: "done." }], stopReason: "stop" }] }), [{ type: TASK_EVENT.AGENT_END, text: "done.", outcome: "success" }]);
|
|
104
|
-
assert.deepEqual(normalizeRpcEvent({ type: "agent_end", messages: [{ role: "assistant", content: [], stopReason: "error", errorMessage: "WebSocket error with untrusted provider payload" }] }), [{ type: TASK_EVENT.AGENT_END, text: "", outcome: "error", diagnostic: "assistant reported an error" }]);
|
|
156
|
+
assert.deepEqual(normalizeRpcEvent({ type: "agent_end", messages: [{ role: "assistant", content: [], stopReason: "error", errorMessage: "WebSocket error with untrusted provider payload" }] }), [{ type: TASK_EVENT.AGENT_END, text: "", outcome: "error", diagnostic: "assistant reported an error (network)", errorCategory: "network" }]);
|
|
105
157
|
assert.deepEqual(normalizeRpcEvent({ type: "agent_end", messages: [{ role: "assistant", content: [], stopReason: "aborted" }] }), [{ type: TASK_EVENT.AGENT_END, text: "", outcome: "aborted", diagnostic: "assistant aborted" }]);
|
|
106
158
|
assert.deepEqual(normalizeRpcEvent({ type: "agent_end", messages: [{ role: "assistant", content: [], stopReason: "stop" }] }), [{ type: TASK_EVENT.AGENT_END, text: "", outcome: "empty", diagnostic: "assistant returned no final report" }]);
|
|
107
159
|
assert.deepEqual(normalizeRpcEvent({ type: "agent_settled" }), [{ type: TASK_EVENT.AGENT_SETTLED }]);
|