@cruxy/cli 1.0.3 → 1.0.5

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.
Files changed (238) hide show
  1. package/package.json +2 -2
  2. package/dist/agent/budget.d.ts +0 -52
  3. package/dist/agent/index.d.ts +0 -3
  4. package/dist/agent/loop.d.ts +0 -159
  5. package/dist/agent/prompts.d.ts +0 -69
  6. package/dist/agent/session.d.ts +0 -212
  7. package/dist/approval/classify.d.ts +0 -18
  8. package/dist/approval/index.d.ts +0 -6
  9. package/dist/approval/mutex.d.ts +0 -45
  10. package/dist/approval/policy.d.ts +0 -43
  11. package/dist/approval/prompt.d.ts +0 -48
  12. package/dist/approval/service.d.ts +0 -36
  13. package/dist/approval/types.d.ts +0 -82
  14. package/dist/brand/index.d.ts +0 -1
  15. package/dist/brand/voice.d.ts +0 -94
  16. package/dist/checkpoint/capture.d.ts +0 -17
  17. package/dist/checkpoint/gate-hook.d.ts +0 -28
  18. package/dist/checkpoint/gate.d.ts +0 -71
  19. package/dist/checkpoint/git-store.d.ts +0 -61
  20. package/dist/checkpoint/index.d.ts +0 -10
  21. package/dist/checkpoint/restore.d.ts +0 -23
  22. package/dist/checkpoint/service.d.ts +0 -89
  23. package/dist/checkpoint/set-rollback.d.ts +0 -51
  24. package/dist/checkpoint/set.d.ts +0 -44
  25. package/dist/checkpoint/shadow-store.d.ts +0 -23
  26. package/dist/checkpoint/types.d.ts +0 -164
  27. package/dist/cli/commands/checkpoint.d.ts +0 -7
  28. package/dist/cli/commands/config.d.ts +0 -2
  29. package/dist/cli/commands/hooks.d.ts +0 -8
  30. package/dist/cli/commands/index.d.ts +0 -7
  31. package/dist/cli/commands/init.d.ts +0 -7
  32. package/dist/cli/commands/login.d.ts +0 -8
  33. package/dist/cli/commands/mcp.d.ts +0 -9
  34. package/dist/cli/commands/memory.d.ts +0 -8
  35. package/dist/cli/commands/pr.d.ts +0 -8
  36. package/dist/cli/commands/rollback.d.ts +0 -18
  37. package/dist/cli/commands/run.d.ts +0 -2
  38. package/dist/cli/commands/skills.d.ts +0 -8
  39. package/dist/cli/commands/test.d.ts +0 -9
  40. package/dist/cli/commands/usage.d.ts +0 -9
  41. package/dist/cli/onboard.d.ts +0 -25
  42. package/dist/cli/program.d.ts +0 -2
  43. package/dist/cli/repl.d.ts +0 -27
  44. package/dist/cli/session-factory.d.ts +0 -42
  45. package/dist/cli/stream-print.d.ts +0 -14
  46. package/dist/components/autocomplete.d.ts +0 -32
  47. package/dist/components/frame.d.ts +0 -28
  48. package/dist/components/fuzzy.d.ts +0 -61
  49. package/dist/components/index.d.ts +0 -6
  50. package/dist/components/input.d.ts +0 -78
  51. package/dist/components/keys.d.ts +0 -48
  52. package/dist/components/select.d.ts +0 -28
  53. package/dist/config/credentials.d.ts +0 -18
  54. package/dist/config/index.d.ts +0 -5
  55. package/dist/config/manager.d.ts +0 -39
  56. package/dist/config/owner-only.d.ts +0 -19
  57. package/dist/config/paths.d.ts +0 -9
  58. package/dist/config/project.d.ts +0 -10
  59. package/dist/config/schema.d.ts +0 -2143
  60. package/dist/constants.d.ts +0 -65
  61. package/dist/errors/boundary.d.ts +0 -43
  62. package/dist/errors/constructors.d.ts +0 -411
  63. package/dist/errors/format.d.ts +0 -31
  64. package/dist/errors/index.d.ts +0 -4
  65. package/dist/errors/types.d.ts +0 -270
  66. package/dist/hooks/config.d.ts +0 -21
  67. package/dist/hooks/index.d.ts +0 -7
  68. package/dist/hooks/router.d.ts +0 -58
  69. package/dist/hooks/runner.d.ts +0 -88
  70. package/dist/hooks/service.d.ts +0 -38
  71. package/dist/hooks/slash.d.ts +0 -48
  72. package/dist/hooks/trust.d.ts +0 -46
  73. package/dist/hooks/types.d.ts +0 -147
  74. package/dist/index.d.ts +0 -2
  75. package/dist/indexing/chunker.d.ts +0 -28
  76. package/dist/indexing/embedder.d.ts +0 -98
  77. package/dist/indexing/index.d.ts +0 -9
  78. package/dist/indexing/indexer.d.ts +0 -45
  79. package/dist/indexing/retriever.d.ts +0 -61
  80. package/dist/indexing/service.d.ts +0 -49
  81. package/dist/indexing/store.d.ts +0 -103
  82. package/dist/indexing/types.d.ts +0 -78
  83. package/dist/indexing/util.d.ts +0 -34
  84. package/dist/indexing/walker.d.ts +0 -53
  85. package/dist/jobs/approval-queue.d.ts +0 -85
  86. package/dist/jobs/dispatch-tool.d.ts +0 -34
  87. package/dist/jobs/index.d.ts +0 -6
  88. package/dist/jobs/log-buffer.d.ts +0 -31
  89. package/dist/jobs/log-renderer.d.ts +0 -32
  90. package/dist/jobs/manager.d.ts +0 -139
  91. package/dist/jobs/types.d.ts +0 -81
  92. package/dist/lsp/client.d.ts +0 -25
  93. package/dist/lsp/index.d.ts +0 -8
  94. package/dist/lsp/pool.d.ts +0 -48
  95. package/dist/lsp/registry.d.ts +0 -38
  96. package/dist/lsp/server.d.ts +0 -48
  97. package/dist/lsp/service.d.ts +0 -44
  98. package/dist/lsp/tools/common.d.ts +0 -50
  99. package/dist/lsp/tools/find-definition.d.ts +0 -23
  100. package/dist/lsp/tools/find-references.d.ts +0 -23
  101. package/dist/lsp/tools/get-diagnostics.d.ts +0 -17
  102. package/dist/lsp/tools/hover.d.ts +0 -23
  103. package/dist/lsp/tools/index.d.ts +0 -4
  104. package/dist/lsp/transport.d.ts +0 -39
  105. package/dist/lsp/types.d.ts +0 -107
  106. package/dist/mcp/adapter.d.ts +0 -44
  107. package/dist/mcp/bounds.d.ts +0 -35
  108. package/dist/mcp/client.d.ts +0 -19
  109. package/dist/mcp/demarcate.d.ts +0 -12
  110. package/dist/mcp/http-transport.d.ts +0 -89
  111. package/dist/mcp/index.d.ts +0 -12
  112. package/dist/mcp/service.d.ts +0 -71
  113. package/dist/mcp/sibling-banner.d.ts +0 -25
  114. package/dist/mcp/transport.d.ts +0 -30
  115. package/dist/mcp/trust-gate.d.ts +0 -59
  116. package/dist/mcp/trust.d.ts +0 -62
  117. package/dist/mcp/types.d.ts +0 -62
  118. package/dist/mcp/url-guard.d.ts +0 -48
  119. package/dist/memory/index.d.ts +0 -7
  120. package/dist/memory/recall.d.ts +0 -56
  121. package/dist/memory/remember-tool.d.ts +0 -28
  122. package/dist/memory/secrets.d.ts +0 -29
  123. package/dist/memory/service.d.ts +0 -92
  124. package/dist/memory/store.d.ts +0 -32
  125. package/dist/memory/trust.d.ts +0 -52
  126. package/dist/memory/types.d.ts +0 -101
  127. package/dist/net/ip-guard.d.ts +0 -55
  128. package/dist/onboarding/detect.d.ts +0 -26
  129. package/dist/onboarding/flow.d.ts +0 -28
  130. package/dist/onboarding/index.d.ts +0 -5
  131. package/dist/onboarding/io.d.ts +0 -9
  132. package/dist/onboarding/steps.d.ts +0 -17
  133. package/dist/onboarding/types.d.ts +0 -81
  134. package/dist/plan/approve.d.ts +0 -16
  135. package/dist/plan/execute.d.ts +0 -28
  136. package/dist/plan/index.d.ts +0 -7
  137. package/dist/plan/policy.d.ts +0 -26
  138. package/dist/plan/render.d.ts +0 -5
  139. package/dist/plan/service.d.ts +0 -58
  140. package/dist/plan/submit-plan.d.ts +0 -33
  141. package/dist/plan/types.d.ts +0 -60
  142. package/dist/render/capabilities.d.ts +0 -31
  143. package/dist/render/diff.d.ts +0 -18
  144. package/dist/render/highlight.d.ts +0 -47
  145. package/dist/render/index.d.ts +0 -22
  146. package/dist/render/layout.d.ts +0 -59
  147. package/dist/render/motion.d.ts +0 -76
  148. package/dist/render/plain-renderer.d.ts +0 -39
  149. package/dist/render/resize.d.ts +0 -36
  150. package/dist/render/screen-reader-renderer.d.ts +0 -45
  151. package/dist/render/state.d.ts +0 -49
  152. package/dist/render/tty-renderer.d.ts +0 -106
  153. package/dist/render/types.d.ts +0 -201
  154. package/dist/routing/index.d.ts +0 -2
  155. package/dist/routing/resolve.d.ts +0 -17
  156. package/dist/routing/router.d.ts +0 -47
  157. package/dist/routing/types.d.ts +0 -42
  158. package/dist/sandbox/detect.d.ts +0 -22
  159. package/dist/sandbox/docker-runtime.d.ts +0 -32
  160. package/dist/sandbox/index.d.ts +0 -7
  161. package/dist/sandbox/policy.d.ts +0 -26
  162. package/dist/sandbox/service.d.ts +0 -64
  163. package/dist/sandbox/types.d.ts +0 -123
  164. package/dist/skills/index.d.ts +0 -4
  165. package/dist/skills/loader.d.ts +0 -43
  166. package/dist/skills/parser.d.ts +0 -31
  167. package/dist/skills/service.d.ts +0 -41
  168. package/dist/skills/types.d.ts +0 -94
  169. package/dist/subagent/index.d.ts +0 -5
  170. package/dist/subagent/orchestrator.d.ts +0 -169
  171. package/dist/subagent/registry-scope.d.ts +0 -41
  172. package/dist/subagent/semaphore.d.ts +0 -56
  173. package/dist/subagent/spawn-tool.d.ts +0 -86
  174. package/dist/subagent/types.d.ts +0 -65
  175. package/dist/testing/detect.d.ts +0 -3
  176. package/dist/testing/index.d.ts +0 -5
  177. package/dist/testing/parse.d.ts +0 -33
  178. package/dist/testing/run-tests-tool.d.ts +0 -64
  179. package/dist/testing/runner.d.ts +0 -26
  180. package/dist/testing/sandbox-runner.d.ts +0 -16
  181. package/dist/testing/types.d.ts +0 -66
  182. package/dist/theme/index.d.ts +0 -2
  183. package/dist/theme/resolve.d.ts +0 -43
  184. package/dist/theme/tokens.d.ts +0 -125
  185. package/dist/tools/create-pull-request.d.ts +0 -27
  186. package/dist/tools/file/apply-patch.d.ts +0 -94
  187. package/dist/tools/file/edit-file.d.ts +0 -12
  188. package/dist/tools/file/glob.d.ts +0 -17
  189. package/dist/tools/file/grep-files.d.ts +0 -43
  190. package/dist/tools/file/index.d.ts +0 -7
  191. package/dist/tools/file/match.d.ts +0 -43
  192. package/dist/tools/file/paths.d.ts +0 -160
  193. package/dist/tools/file/read-file.d.ts +0 -8
  194. package/dist/tools/file/write-file.d.ts +0 -10
  195. package/dist/tools/git-status.d.ts +0 -15
  196. package/dist/tools/index.d.ts +0 -9
  197. package/dist/tools/list-files.d.ts +0 -13
  198. package/dist/tools/list-skills.d.ts +0 -9
  199. package/dist/tools/load-skill.d.ts +0 -21
  200. package/dist/tools/registry.d.ts +0 -23
  201. package/dist/tools/search-codebase.d.ts +0 -35
  202. package/dist/tools/shell/exec.d.ts +0 -53
  203. package/dist/tools/shell/index.d.ts +0 -1
  204. package/dist/tools/shell/resolve-shell.d.ts +0 -81
  205. package/dist/tools/shell/run-command.d.ts +0 -14
  206. package/dist/tools/types.d.ts +0 -257
  207. package/dist/usage/collect.d.ts +0 -53
  208. package/dist/usage/cost.d.ts +0 -19
  209. package/dist/usage/index.d.ts +0 -15
  210. package/dist/usage/store.d.ts +0 -37
  211. package/dist/usage/summary.d.ts +0 -32
  212. package/dist/usage/types.d.ts +0 -283
  213. package/dist/utils/child-tree.d.ts +0 -33
  214. package/dist/utils/git.d.ts +0 -17
  215. package/dist/utils/logger.d.ts +0 -18
  216. package/dist/utils/process-tree.d.ts +0 -16
  217. package/dist/vcs/auth.d.ts +0 -22
  218. package/dist/vcs/generate.d.ts +0 -74
  219. package/dist/vcs/git.d.ts +0 -60
  220. package/dist/vcs/github.d.ts +0 -50
  221. package/dist/vcs/guidance.d.ts +0 -20
  222. package/dist/vcs/index.d.ts +0 -7
  223. package/dist/vcs/service.d.ts +0 -61
  224. package/dist/vcs/types.d.ts +0 -73
  225. package/dist/web/demarcate.d.ts +0 -13
  226. package/dist/web/fetch.d.ts +0 -11
  227. package/dist/web/index.d.ts +0 -7
  228. package/dist/web/provider.d.ts +0 -29
  229. package/dist/web/search.d.ts +0 -17
  230. package/dist/web/ssrf.d.ts +0 -41
  231. package/dist/web/tools.d.ts +0 -20
  232. package/dist/web/types.d.ts +0 -64
  233. package/dist/workspace/add-root.d.ts +0 -27
  234. package/dist/workspace/index.d.ts +0 -6
  235. package/dist/workspace/resolve.d.ts +0 -54
  236. package/dist/workspace/select.d.ts +0 -41
  237. package/dist/workspace/types.d.ts +0 -30
  238. package/dist/workspace/workspace.d.ts +0 -61
@@ -1,64 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool, ToolContext } from "../tools/types.js";
3
- import type { TestCommand, TestRunner } from "./types.js";
4
- /**
5
- * The `run_tests` tool (C.13): execute the project's test suite and return a
6
- * structured result the model can iterate on (edit → re-run → repeat). The
7
- * iteration loop itself is the ordinary agent loop; this module contributes
8
- * the two guarantees that make it trustworthy — honest green (exit-code-only)
9
- * and a hard cap on consecutive failing runs.
10
- */
11
- /**
12
- * Counts consecutive FAILING test executions; a green run resets it. When the
13
- * count reaches the cap, `trip` LATCHES: every further attempt is refused with
14
- * the coded CRUXY_E_TEST_ITERATION_LIMIT result (nothing executes) for the rest
15
- * of the episode. Because a refused attempt never runs, {@link record} is never
16
- * reached and the counter stays pinned at the cap — the breaker cannot re-arm
17
- * itself mid-episode. (This replaces a bug where `trip` zeroed the counter as it
18
- * tripped, so the very next call ran again and the "cap" was a speed bump, not a
19
- * stop: the model could burn the whole turn re-running a failing suite.)
20
- *
21
- * The latch is cleared by {@link reset}, called at the top of each user turn
22
- * (see `Session.send`) — so a fresh instruction starts with the full budget,
23
- * but the model cannot bypass the cap by simply calling the tool again within
24
- * one episode. A green run mid-streak still re-arms the budget via {@link record}.
25
- * Per-turn work stays bounded regardless via `agent.maxIterations`.
26
- */
27
- export declare class TestIterationBudget {
28
- private failedRuns;
29
- /** Runs already spent in the current failing streak. */
30
- get spent(): number;
31
- /**
32
- * True when the next run must be refused. Latches at the cap: once the streak
33
- * reaches `maxIterations` this keeps returning true (the refused call never
34
- * executes, so {@link record} never runs and the counter stays pinned) until
35
- * {@link reset} clears it at the next user turn.
36
- */
37
- trip(maxIterations: number): boolean;
38
- record(passed: boolean): void;
39
- /**
40
- * Clear the failing streak, re-arming the breaker. Called at the start of each
41
- * user turn so a new instruction starts fresh; within one turn the latch holds.
42
- */
43
- reset(): void;
44
- }
45
- declare const parameters: z.ZodObject<{
46
- command: z.ZodOptional<z.ZodString>;
47
- }, "strip", z.ZodTypeAny, {
48
- command?: string | undefined;
49
- }, {
50
- command?: string | undefined;
51
- }>;
52
- export interface RunTestsToolDeps {
53
- /**
54
- * Execution seam (tests inject a fake). When unset, the runner is chosen per
55
- * run from `ctx.sandbox`: present → {@link SandboxTestRunner} (run in the box,
56
- * C.16), absent → host {@link CommandTestRunner} — unchanged.
57
- */
58
- runner?: TestRunner;
59
- /** Detection seam (defaults to config + package.json detection). */
60
- detect?: (ctx: ToolContext) => TestCommand | null;
61
- }
62
- /** Build the `run_tests` tool. One instance = one session's iteration budget. */
63
- export declare function makeRunTestsTool(deps?: RunTestsToolDeps): Tool<typeof parameters>;
64
- export {};
@@ -1,26 +0,0 @@
1
- import type { TestRunner, TestRunOptions, TestRunResult } from "./types.js";
2
- /**
3
- * The shipped {@link TestRunner}: spawn the command via the system shell (the
4
- * same detached-group + kill-tree discipline as `run_command`), capture a
5
- * TAIL-biased, byte-capped transcript (failures live at the end of test
6
- * output), and derive `passed` from the exit code — the only source of truth.
7
- * A timeout, a signal kill, or a spawn error is a *failed result*, never a
8
- * thrown exception and never a fabricated success.
9
- */
10
- export declare class CommandTestRunner implements TestRunner {
11
- run(command: string, opts: TestRunOptions): Promise<TestRunResult>;
12
- }
13
- /**
14
- * A rolling, tail-biased capture: whole chunks are dropped from the FRONT
15
- * once the byte cap is exceeded, so the end of the output — where test
16
- * runners print their failure summaries — always survives.
17
- */
18
- export declare class TailCapture {
19
- private readonly cap;
20
- private chunks;
21
- private bytes;
22
- truncated: boolean;
23
- constructor(cap: number);
24
- push(buf: Buffer): void;
25
- text(): string;
26
- }
@@ -1,16 +0,0 @@
1
- import type { SandboxService } from "../sandbox/index.js";
2
- import type { TestRunner, TestRunOptions, TestRunResult } from "./types.js";
3
- /**
4
- * A {@link TestRunner} that runs the suite inside the C.16 sandbox instead of
5
- * on the host. It maps the neutral sandbox {@link ExecResult} onto the exact
6
- * same {@link TestRunResult} the host {@link CommandTestRunner} produces — so
7
- * honest-green (`passed = exitCode === 0`), tail-biased capture, and the
8
- * timeout note all hold identically inside the box. A container-start failure
9
- * is NOT swallowed into a result: `sandbox.exec` throws a coded error that
10
- * propagates (fail loud), never a fabricated pass.
11
- */
12
- export declare class SandboxTestRunner implements TestRunner {
13
- private readonly sandbox;
14
- constructor(sandbox: SandboxService);
15
- run(command: string, opts: TestRunOptions): Promise<TestRunResult>;
16
- }
@@ -1,66 +0,0 @@
1
- /**
2
- * Types for the test-execution loop (C.13): run the project's test suite,
3
- * parse what's honestly parseable, and let the agent iterate on failures
4
- * under a hard cap. The cardinal rule lives in `runner.ts`: **passed is
5
- * derived from the exit code and nothing else.**
6
- */
7
- import type { ShellSelection } from "../tools/shell/resolve-shell.js";
8
- /** A resolved test command and where it came from — shown, never guessed. */
9
- export interface TestCommand {
10
- command: string;
11
- source: "config" | "package-json";
12
- }
13
- /** One extracted failure. Every field beyond `name`/`message` is best-effort. */
14
- export interface TestFailure {
15
- name: string;
16
- message: string;
17
- file?: string;
18
- line?: number;
19
- }
20
- /** The structured outcome of one test-suite execution. */
21
- export interface TestRunResult {
22
- /** `exitCode === 0`, full stop — never inferred from output text. */
23
- passed: boolean;
24
- /** The command's exit code; `null` when killed by signal or never spawned. */
25
- exitCode: number | null;
26
- /** Measured wall time of the execution. */
27
- durationMs: number;
28
- /** Total tests, only when a parser confidently extracted it. */
29
- total?: number;
30
- /** Best-effort extracted failures; may be empty even when `passed` is false. */
31
- failures: TestFailure[];
32
- /** Tail-biased captured stdout+stderr, capped at `test.captureBytes`. */
33
- output: string;
34
- /** Whether the head of the output was dropped to honor the byte cap. */
35
- outputTruncated: boolean;
36
- }
37
- /** Execution bounds handed to a runner per run. */
38
- export interface TestRunOptions {
39
- cwd: string;
40
- /** Kill the run (and its process tree) after this many ms. */
41
- timeoutMs: number;
42
- /** Cap on captured output bytes (tail-biased). */
43
- captureBytes: number;
44
- /** Shell selection, so the host runner routes through the resolved shell (Git
45
- * Bash / PowerShell on Windows) — the same seam as run_command. The sandbox
46
- * runner ignores it (the container has its own shell). */
47
- shell: ShellSelection;
48
- }
49
- /**
50
- * The swappable execution seam (same discipline as VectorStore/ForgeProvider):
51
- * the shipped {@link CommandTestRunner} spawns the command via the resolved
52
- * shell; tests inject fakes, and a future framework-native runner (e.g. a
53
- * vitest API runner) slots in without touching the tool.
54
- */
55
- export interface TestRunner {
56
- run(command: string, opts: TestRunOptions): Promise<TestRunResult>;
57
- }
58
- /**
59
- * A pluggable best-effort failure extractor: given the captured output,
60
- * return whatever structure it can positively recognize — and nothing it
61
- * can't. Parsers never touch `passed` and never fabricate counts.
62
- */
63
- export type FailureParser = (output: string) => {
64
- failures: TestFailure[];
65
- total?: number;
66
- };
@@ -1,2 +0,0 @@
1
- export * from "./tokens.js";
2
- export * from "./resolve.js";
@@ -1,43 +0,0 @@
1
- import { type Theme, type ThemeCapabilities } from "./tokens.js";
2
- /**
3
- * Theme resolution (U.1/U.11) — the ONE place picocolors is used. The axes are
4
- * fully independent by construction:
5
- *
6
- * - `color` drives the stylers only. `pc.createColors(false)` is the identity,
7
- * so NO_COLOR yields zero ANSI bytes (dim/bold vanish too) — asserted in the
8
- * tests.
9
- * - the glyph table is chosen by `screenReader` (words) → else `unicode`
10
- * (✓/✗) → else ASCII (`[ok]`/`[x]`). Never touches color: a NO_COLOR unicode
11
- * terminal still prints ✓/✗ (glyphs aren't ANSI), a colored CRUXY_ASCII
12
- * terminal prints a colored `[ok]`, and a screen reader gets colorless words.
13
- */
14
- export declare function resolveTheme(caps: ThemeCapabilities): Theme;
15
- /**
16
- * Whether the terminal can render unicode glyphs. `TERM=dumb` and an explicit
17
- * `CRUXY_ASCII` opt-in fall back to the ASCII table; everything else (real
18
- * terminals AND pipes) keeps unicode — piping ✓/✗ to a file is fine, and this
19
- * preserves pre-U.1 behavior for non-TTY output.
20
- *
21
- * The single source of the rule: `render/capabilities.ts` calls this to fill
22
- * `RenderCapabilities.unicode`, and the boolean-seam surfaces (errors,
23
- * approval, plan, onboarding, CLI commands) call it to build a theme without a
24
- * signature change.
25
- */
26
- export declare function detectUnicode(env?: NodeJS.ProcessEnv): boolean;
27
- /**
28
- * Whether the user asked for screen-reader mode (U.11) — opt-in via
29
- * `CRUXY_SCREEN_READER` or the ecosystem `ACCESSIBLE` flag (set-and-non-empty).
30
- * Deliberately NOT inferred from a pipe: auto-wording every non-TTY stream would
31
- * change existing CI/plain output. The single source of the rule, called by
32
- * `render/capabilities.ts` (to fill `RenderCapabilities.screenReader`) and by
33
- * the boolean-seam {@link themeForColor} surfaces (approval, plan, onboarding).
34
- */
35
- export declare function detectScreenReader(env?: NodeJS.ProcessEnv): boolean;
36
- /**
37
- * Build a theme for a surface that only knows a `color` boolean (the U.3
38
- * PromptIO, error formatting, plan/onboarding/CLI copy). Unicode and
39
- * screen-reader mode are detected from the environment so these surfaces still
40
- * degrade on dumb terminals and speak words to a screen reader, with no change
41
- * to their public boolean signatures.
42
- */
43
- export declare function themeForColor(color: boolean, env?: NodeJS.ProcessEnv): Theme;
@@ -1,125 +0,0 @@
1
- /**
2
- * The terminal design system (U.1): one typed {@link Theme} of semantic tokens
3
- * — color *roles* (never raw hues at call sites), a glyph set with ASCII
4
- * fallbacks, and structure primitives. Every rendered surface resolves ONE
5
- * theme (from {@link RenderCapabilities}) and references roles like
6
- * `theme.danger(x)` / `theme.glyph.success`, so the CLI reads as one product
7
- * and NO_COLOR / dumb-terminal degradation is handled in exactly one place.
8
- *
9
- * Picocolors is imported only by `resolve.ts`; this file is pure types + the
10
- * two glyph tables.
11
- */
12
- /** A text styler: wraps a string in ANSI, or the identity under NO_COLOR. */
13
- export type Styler = (text: string) => string;
14
- /**
15
- * Language-token colors for the streaming syntax highlighter. A distinct
16
- * sub-palette (not status semantics), centralized here so every color choice
17
- * lives in the theme.
18
- */
19
- export interface ThemeSyntax {
20
- keyword: Styler;
21
- string: Styler;
22
- number: Styler;
23
- comment: Styler;
24
- }
25
- /**
26
- * The glyph vocabulary. Concrete strings (resolved to the unicode or ASCII
27
- * table), so a call site writes `theme.glyph.success`, never a literal "✓".
28
- */
29
- export interface ThemeGlyphs {
30
- /** Success / done. */
31
- success: string;
32
- /** Failure / error. */
33
- failure: string;
34
- /** Not-yet-started (plan step). */
35
- pending: string;
36
- /** In-progress marker (static, non-animated). */
37
- running: string;
38
- /** Selected-row pointer in pickers. */
39
- pointer: string;
40
- /** Input caret (REPL prompt, fuzzy query). */
41
- caret: string;
42
- /** Next-step / relation arrow. */
43
- arrow: string;
44
- caretUp: string;
45
- caretDown: string;
46
- /**
47
- * Cache-hit marker for the usage line (`cached ↻N`). Decorative — the word
48
- * "cached" carries the meaning, so it degrades to empty on ASCII / screen
49
- * reader rather than a cryptic symbol.
50
- */
51
- cached: string;
52
- /** Text-cursor bar in the fuzzy query line. */
53
- cursorBar: string;
54
- bullet: string;
55
- /** Inline separator (the ` · ` joiner uses this). */
56
- sep: string;
57
- /** Truncation marker. */
58
- ellipsis: string;
59
- /** Subagent activity marker. */
60
- play: string;
61
- /** Animated spinner frames (used only where cursor control exists). */
62
- spinnerFrames: readonly string[];
63
- /** Non-animated spinner glyph (no-cursor terminals). */
64
- spinnerStatic: string;
65
- }
66
- /**
67
- * The resolved design system handed to a surface. Color roles are stylers
68
- * (identity under NO_COLOR); `glyph`/`sep` are concrete strings; the structure
69
- * helpers give consistent indentation, headings, and key/value alignment.
70
- */
71
- export interface Theme {
72
- /** Errors, destructive risk, failure. (red) */
73
- danger: Styler;
74
- /** Reversible-mutation risk, warnings. (yellow) */
75
- warning: Styler;
76
- /** Done / ok. (green) */
77
- success: Styler;
78
- /** Brand / interactive / links / pointers. (cyan) */
79
- accent: Styler;
80
- /** Secondary text: hints, causes, codes, rationale. (dim) */
81
- muted: Styler;
82
- /** Emphasis / headings — a weight, hue-independent; composes with a color. (bold) */
83
- strong: Styler;
84
- /** Syntax-highlighting sub-palette. */
85
- syntax: ThemeSyntax;
86
- /** Glyph vocabulary (unicode or ASCII per capabilities). */
87
- glyph: ThemeGlyphs;
88
- /** Bold heading (alias of {@link strong}, named for intent). */
89
- heading: Styler;
90
- /** Prefix every line with `2 * level` spaces. */
91
- indent(text: string, level?: number): string;
92
- /** Aligned `key value` with a bold key (optionally padded to `keyWidth`). */
93
- kv(key: string, value: string, keyWidth?: number): string;
94
- /** The inline joiner, e.g. ` · ` (unicode) / ` - ` (ascii). */
95
- sep: string;
96
- readonly color: boolean;
97
- readonly unicode: boolean;
98
- }
99
- /** The axes a theme is resolved from — a structural subset of RenderCapabilities. */
100
- export interface ThemeCapabilities {
101
- color: boolean;
102
- unicode: boolean;
103
- /**
104
- * Screen-reader mode (U.11): status glyphs render as words. Optional so every
105
- * existing `{color, unicode}` caller is unchanged (defaults to off). When set
106
- * it takes precedence over `unicode` for the glyph table.
107
- */
108
- screenReader?: boolean;
109
- }
110
- /** The unicode glyph table (real terminals). */
111
- export declare const UNICODE_GLYPHS: ThemeGlyphs;
112
- /**
113
- * The ASCII glyph table (TERM=dumb / CRUXY_ASCII). Readable, single-byte, no
114
- * mojibake — the intentional U.1 degradation for unicode-unsafe terminals.
115
- */
116
- export declare const ASCII_GLYPHS: ThemeGlyphs;
117
- /**
118
- * The screen-reader glyph table (U.11): the status glyphs a screen reader would
119
- * otherwise announce as bare punctuation are spelled as words — `done`,
120
- * `failed`, `working`, `pending` — so `✓ read_file` becomes `done read_file`.
121
- * Structural glyphs stay ASCII-legible (a pointer/caret has no useful word).
122
- * This is the entire "worded status" of screen-reader mode: swap the table,
123
- * reuse every existing renderer/theme code path unchanged.
124
- */
125
- export declare const SCREEN_READER_GLYPHS: ThemeGlyphs;
@@ -1,27 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "./types.js";
3
- /**
4
- * Open a pull request from the agent's work (C.15): branch → conventional commit
5
- * → push → open PR, all behind the one U.3 approval. The model authors `title`
6
- * and `body`; anything omitted is filled deterministically (no second LLM call —
7
- * the agent IS the LLM). The token is resolved from the environment / `gh`; it is
8
- * never prompted for or stored.
9
- */
10
- declare const parameters: z.ZodObject<{
11
- root: z.ZodOptional<z.ZodString>;
12
- title: z.ZodOptional<z.ZodString>;
13
- body: z.ZodOptional<z.ZodString>;
14
- base: z.ZodOptional<z.ZodString>;
15
- }, "strip", z.ZodTypeAny, {
16
- root?: string | undefined;
17
- body?: string | undefined;
18
- base?: string | undefined;
19
- title?: string | undefined;
20
- }, {
21
- root?: string | undefined;
22
- body?: string | undefined;
23
- base?: string | undefined;
24
- title?: string | undefined;
25
- }>;
26
- export declare const createPullRequestTool: Tool<typeof parameters>;
27
- export {};
@@ -1,94 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "../types.js";
3
- declare const parameters: z.ZodObject<{
4
- operations: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
5
- type: z.ZodLiteral<"update">;
6
- path: z.ZodString;
7
- hunks: z.ZodArray<z.ZodObject<{
8
- oldStr: z.ZodString;
9
- newStr: z.ZodString;
10
- }, "strip", z.ZodTypeAny, {
11
- oldStr: string;
12
- newStr: string;
13
- }, {
14
- oldStr: string;
15
- newStr: string;
16
- }>, "many">;
17
- }, "strip", z.ZodTypeAny, {
18
- path: string;
19
- type: "update";
20
- hunks: {
21
- oldStr: string;
22
- newStr: string;
23
- }[];
24
- }, {
25
- path: string;
26
- type: "update";
27
- hunks: {
28
- oldStr: string;
29
- newStr: string;
30
- }[];
31
- }>, z.ZodObject<{
32
- type: z.ZodLiteral<"create">;
33
- path: z.ZodString;
34
- content: z.ZodString;
35
- }, "strip", z.ZodTypeAny, {
36
- path: string;
37
- type: "create";
38
- content: string;
39
- }, {
40
- path: string;
41
- type: "create";
42
- content: string;
43
- }>, z.ZodObject<{
44
- type: z.ZodLiteral<"delete">;
45
- path: z.ZodString;
46
- }, "strip", z.ZodTypeAny, {
47
- path: string;
48
- type: "delete";
49
- }, {
50
- path: string;
51
- type: "delete";
52
- }>]>, "many">;
53
- }, "strip", z.ZodTypeAny, {
54
- operations: ({
55
- path: string;
56
- type: "update";
57
- hunks: {
58
- oldStr: string;
59
- newStr: string;
60
- }[];
61
- } | {
62
- path: string;
63
- type: "create";
64
- content: string;
65
- } | {
66
- path: string;
67
- type: "delete";
68
- })[];
69
- }, {
70
- operations: ({
71
- path: string;
72
- type: "update";
73
- hunks: {
74
- oldStr: string;
75
- newStr: string;
76
- }[];
77
- } | {
78
- path: string;
79
- type: "create";
80
- content: string;
81
- } | {
82
- path: string;
83
- type: "delete";
84
- })[];
85
- }>;
86
- /**
87
- * Apply a set of file edits across one or more files in a single, atomic,
88
- * reviewed operation. The entire patch is validated up front — every path
89
- * resolved inside the project, every `update` hunk confirmed to match exactly
90
- * once, every `create` confirmed absent and `delete` confirmed present — and if
91
- * anything fails, nothing is written. A single approval covers the whole patch.
92
- */
93
- export declare const applyPatchTool: Tool<typeof parameters>;
94
- export {};
@@ -1,12 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "../types.js";
3
- /**
4
- * Replace one exact, unique occurrence of `old_str` with `new_str` in a file.
5
- * The uniqueness requirement is checked before approval so the model can fix an
6
- * ambiguous match without burning a prompt; gated on `ctx.approve` before writing.
7
- */
8
- export declare const editFileTool: Tool<z.ZodObject<{
9
- path: z.ZodString;
10
- old_str: z.ZodString;
11
- new_str: z.ZodString;
12
- }>>;
@@ -1,17 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "../types.js";
3
- /**
4
- * Find files by glob pattern within the workspace. Read-only — no approval.
5
- * The pattern is constrained to a root (no absolute or `..` patterns) so glob
6
- * can't reach outside, consistent with the other file tools.
7
- *
8
- * Multi-repo (C.26, Funnel B): with more than one declared root, glob fans every
9
- * root — an independent walk rooted at each root's own `absPath` — and labels each
10
- * match `‹root› ▸ path`. There is no path to confine here; the boundary is which
11
- * root's `absPath` each walk starts from, so a match can only ever come from the
12
- * root its label names. A `root` argument scopes the walk to that one root.
13
- */
14
- export declare const globTool: Tool<z.ZodObject<{
15
- pattern: z.ZodString;
16
- root: z.ZodOptional<z.ZodString>;
17
- }>>;
@@ -1,43 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "../types.js";
3
- declare const parameters: z.ZodObject<{
4
- pattern: z.ZodString;
5
- path: z.ZodOptional<z.ZodString>;
6
- glob: z.ZodOptional<z.ZodString>;
7
- ignoreCase: z.ZodOptional<z.ZodBoolean>;
8
- maxResults: z.ZodOptional<z.ZodNumber>;
9
- root: z.ZodOptional<z.ZodString>;
10
- }, "strip", z.ZodTypeAny, {
11
- pattern: string;
12
- path?: string | undefined;
13
- root?: string | undefined;
14
- maxResults?: number | undefined;
15
- glob?: string | undefined;
16
- ignoreCase?: boolean | undefined;
17
- }, {
18
- pattern: string;
19
- path?: string | undefined;
20
- root?: string | undefined;
21
- maxResults?: number | undefined;
22
- glob?: string | undefined;
23
- ignoreCase?: boolean | undefined;
24
- }>;
25
- /**
26
- * Search file *contents* for a regex within the workspace. Read-only — no
27
- * approval — so the model should prefer this over shelling out to grep/rg via
28
- * run_command (which is platform-dependent and routes through the approval gate).
29
- *
30
- * Files are enumerated with the same glob mechanism as the `glob` tool (so
31
- * node_modules, .git, and build-output dirs are always ignored), binary files
32
- * are skipped, and the
33
- * search is bounded by the same root boundary as every file tool.
34
- *
35
- * Multi-repo (C.26, Funnel B): with more than one declared root and no root-
36
- * selecting argument, the search FANS every root — a bare relative `path` is
37
- * applied under each root (⚖︎JC-6) — and labels each match `‹root› ▸ path`. A
38
- * `root` argument, or an absolute / `‹root›/…`-prefixed `path`, scopes it to that
39
- * one root. Each walk starts at exactly one confined root directory, so a match
40
- * can only come from the root its label names.
41
- */
42
- export declare const grepFilesTool: Tool<typeof parameters>;
43
- export {};
@@ -1,7 +0,0 @@
1
- export * from "./paths.js";
2
- export * from "./read-file.js";
3
- export * from "./write-file.js";
4
- export * from "./edit-file.js";
5
- export * from "./apply-patch.js";
6
- export * from "./glob.js";
7
- export * from "./grep-files.js";
@@ -1,43 +0,0 @@
1
- /**
2
- * Locating `old_str` inside a file for edit_file / apply_patch.
3
- *
4
- * Models emit `\n` line endings, but a file on disk may be `\r\n` (Windows
5
- * checkouts/editors) — a byte-exact `indexOf` then never matches and the model
6
- * can't replace existing code. We match in ordered tiers, tightest first, and
7
- * stop at the first tier that finds anything:
8
- *
9
- * 0. exact — raw bytes; every currently-working edit takes this path
10
- * 1. eol — CRLF and lone CR treated as LF (comparison only)
11
- * 2. eol+trailws — tier 1, plus trailing whitespace ignored per line
12
- *
13
- * Looser tiers compare against a normalized copy but return offsets into the
14
- * ORIGINAL string, so the splice preserves every unmatched byte verbatim (the
15
- * file is never wholesale re-encoded). Ambiguity is never resolved by guessing:
16
- * more than one match at a tier is a hard error, and we do not fall through to a
17
- * looser tier (looser can only be more ambiguous, never less).
18
- */
19
- export type Tier = "exact" | "eol" | "eol+trailws";
20
- export type MatchResult = {
21
- kind: "found";
22
- start: number;
23
- end: number;
24
- } | {
25
- kind: "ambiguous";
26
- count: number;
27
- tier: Tier;
28
- } | {
29
- kind: "none";
30
- };
31
- /**
32
- * Find the single occurrence of `oldStr` in `content`, tolerating line-ending
33
- * and trailing-whitespace differences. Returns original-string byte offsets on
34
- * a unique match, `ambiguous` if the tightest matching tier had >1 hit, or
35
- * `none` if no tier matched.
36
- */
37
- export declare function findMatch(content: string, oldStr: string): MatchResult;
38
- /** The file's line ending: CRLF if the first newline is `\r\n`, else LF. */
39
- export declare function detectEol(content: string): "\r\n" | "\n";
40
- /** Re-encode `text`'s line endings to `eol` so an edit matches the file. */
41
- export declare function applyEol(text: string, eol: "\r\n" | "\n"): string;
42
- /** Human phrase for the tier named in an ambiguity error. */
43
- export declare function tierLabel(tier: Tier): string;