@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,160 +0,0 @@
1
- import { PathEscapeError, type DeclaredRoot, type RootRef, type Workspace } from "../../workspace/index.js";
2
- import type { ToolContext } from "../types.js";
3
- /**
4
- * Path confinement for file tools (C.26). The confinement kernel itself lives in
5
- * `src/workspace` ({@link confineToRoot}); this module is the tool-facing funnel
6
- * that every path-taking tool calls instead of touching the filesystem directly.
7
- * Keeping ONE resolver here is what makes Funnel A ("a path tool cannot reach fs
8
- * outside the selected root") a structural property rather than a per-tool habit.
9
- */
10
- export { PathEscapeError };
11
- /**
12
- * The workspace this context acts in. `ctx.workspace` is a required field (C.26
13
- * Step 6), so this is a plain accessor — there is no single-root fallback to
14
- * synthesize, because no code path can reach a path-taking tool without a
15
- * workspace (the type forbids the omission; the `no-split-brain` guard forbids a
16
- * mid-subsystem synthesis). Kept as the one named seam every funnel calls.
17
- */
18
- export declare function contextWorkspace(ctx: ToolContext): Workspace;
19
- /**
20
- * Resolve a tool-supplied path against the workspace and prove it stays inside the
21
- * one root it selects — the single funnel for every path-taking file tool.
22
- *
23
- * Single-root sessions short-circuit straight to `confineToRoot(primary, path)`,
24
- * which is exactly the legacy `resolveInRoot` behaviour (same result, same
25
- * error type + message for every case: relative, absolute-inside, absolute-outside,
26
- * outward symlink). Multi-root sessions run the two-step select-then-confine:
27
- * {@link selectRoot} commits to exactly one declared root FIRST, then
28
- * {@link confineToRoot} validates against only that root — so a `../otherRoot/x`
29
- * that lands in a sibling is refused as an ordinary `PATH_ESCAPE` (R2), never
30
- * rebound to the sibling.
31
- *
32
- * `deferNonPrimaryWrite` (set by the mutating file tools) refuses a write whose
33
- * selected root is NOT the primary in a multi-root session, with
34
- * `CRUXY_E_MULTIROOT_WRITE_DEFERRED` — UNLESS `ctx.checkpointsActive` is true.
35
- * That flag is the C.26 step-3 coupling: it is set exactly when a per-root
36
- * checkpoint gate is wired, which captures the write (snapshots its root) before
37
- * it reaches disk — so the refusal lifts precisely when the write becomes
38
- * rollback-able, never before (not step-wide, not lift-then-verify). With
39
- * checkpoints disabled the flag is false, so a non-primary write is still refused
40
- * rather than left un-restorable (⚖︎JC-γ: the opt-out covers the user's own cwd,
41
- * not every declared sibling). It is a no-op in single-root (there is only the
42
- * primary) and for reads (which never set it). The refusal is raised BEFORE any
43
- * filesystem access.
44
- *
45
- * @throws {PathEscapeError} if the path escapes the selected root.
46
- * @throws {CruxyError} CRUXY_E_ROOT_UNKNOWN / CRUXY_E_ROOT_AMBIGUOUS on bad selection,
47
- * or CRUXY_E_MULTIROOT_WRITE_DEFERRED on a non-primary write while deferred.
48
- */
49
- export declare function resolveToolPath(ctx: ToolContext, ref: RootRef, opts?: {
50
- requireExplicit?: boolean;
51
- deferNonPrimaryWrite?: boolean;
52
- }): Promise<{
53
- root: DeclaredRoot;
54
- abs: string;
55
- }>;
56
- /**
57
- * Legacy single-root entry point, retained as a thin shim over
58
- * {@link resolveToolPath} so callers that pass only a bare path (e.g. the LSP
59
- * tools) keep working and stay byte-identical. New path tools should call
60
- * {@link resolveToolPath} so they can carry an explicit root selector.
61
- *
62
- * @returns the resolved absolute path (lexical, not realpath'd).
63
- * @throws {PathEscapeError} if the path escapes the root.
64
- */
65
- export declare function resolveInRoot(ctx: ToolContext, p: string): Promise<string>;
66
- /**
67
- * True when a glob pattern could walk outside its root — an absolute pattern or one
68
- * containing a `..` segment. The ONE implementation of "does this pattern escape",
69
- * shared by `glob` and `grep_files` so the two walk-rooted tools cannot diverge
70
- * (closing G1/G2). Path *arguments* go through {@link resolveToolPath}; glob
71
- * *patterns* are not resolvable paths, so this predicate guards the walk instead.
72
- *
73
- * NB — a known internal inconsistency, documented rather than fixed: this split on
74
- * `/[/\\]/` (and the sibling `firstSegmentIsRoot` in grep_files) treats `\` as a
75
- * separator on EVERY platform, but the resolution kernel {@link confineToRoot} →
76
- * `path.resolve` does NOT on POSIX (there `\` is a legal filename character). The
77
- * two only diverge for a `..\`-style argument on POSIX, which is unreachable from
78
- * anything the tools EMIT (grep/apply_patch produce `\` only on Windows, where
79
- * `path.resolve` does treat it as a separator). It is left as-is deliberately:
80
- * "fixing" confineToRoot to fold `\`→`/` on POSIX would break access to files
81
- * whose names legitimately contain a backslash.
82
- */
83
- export declare function isEscapingPattern(pattern: string): boolean;
84
- /**
85
- * The separator between a root's name and a path within it (`‹root› ▸ rel`) — one
86
- * constant so every no-path tool that fans across roots renders the same label.
87
- */
88
- export declare const ROOT_LABEL_SEP = " \u25B8 ";
89
- /**
90
- * Rewrite the OS path separator to forward slashes for MODEL-FACING output — the
91
- * one display convention every path tool shares. The rest of the toolset already
92
- * emits POSIX paths on Windows (the indexer normalises the same way in
93
- * `indexing/walker.ts`, and git's porcelain and tinyglobby both hand back `/`);
94
- * this seam is what keeps the two `path.relative`-based stragglers, `grep_files`
95
- * and `apply_patch`, from drifting to native `src\b.ts`.
96
- *
97
- * It splits on `path.sep`, NOT a literal `\`, so it only ever rewrites the real OS
98
- * separator: on POSIX (`path.sep === "/"`) it is a no-op that PRESERVES a literal
99
- * backslash in a filename — legal on POSIX — rather than mangling it; on Windows
100
- * (`path.sep === "\\"`) it turns `path.relative`'s `src\b.ts` into `src/b.ts`.
101
- *
102
- * Purely cosmetic at the boundary — the model never needs native separators back:
103
- * a path it echoes into read_file/edit_file resolves through {@link confineToRoot}
104
- * → `path.resolve`, which accepts `/` on Windows, so the forward-slash form
105
- * round-trips as-is.
106
- */
107
- export declare function toPosix(p: string): string;
108
- /**
109
- * Prefix a root-relative path with its root name — but ONLY in a genuine
110
- * multi-root session. In single-root the label is dropped so output stays
111
- * byte-identical with the pre-C.26 tools. The `root`/`rel` pair always comes from
112
- * the same fan iteration that produced the bytes, so a rendered label can never
113
- * point at a different root than the one that was walked (the honesty pin).
114
- */
115
- export declare function labelPath(root: DeclaredRoot, rel: string, isMultiRoot: boolean): string;
116
- /** As {@link labelPath} but from a bare root name (for hits that carry only a name). */
117
- export declare function labelName(rootName: string, rel: string): string;
118
- /**
119
- * The Funnel-B selector for **no-path** tools (`glob`, `grep_files`, `list_files`,
120
- * `git_status`, `search_codebase`) — the counterpart to {@link resolveToolPath}.
121
- * A no-path tool has no path to confine; its boundary is *which root's `absPath`*
122
- * it threads as the walk-start / index-key / spawn-cwd. This returns that root
123
- * set, and the tool commits to exactly one root per read by iterating it:
124
- *
125
- * - an explicit `root` name → that one declared root (fail-loud on unknown, R1);
126
- * - single-root session → the primary root (so output is byte-identical);
127
- * - multi-root, unscoped → **fan** every declared root.
128
- *
129
- * The fan is N independent single-root reads (one `root.absPath` each), never one
130
- * walk over a union — so each read is Funnel-B-confined and the cross-root merge
131
- * only ever happens on already-attributed *results*, never on the filesystem.
132
- * Reads leave `requireExplicit` false (that gate is for mutations, ⚖︎#3).
133
- *
134
- * @throws {CruxyError} CRUXY_E_ROOT_UNKNOWN if a named root is not declared.
135
- */
136
- export declare function resolveReadRoots(ctx: ToolContext, ref?: {
137
- root?: string;
138
- }): readonly DeclaredRoot[];
139
- /**
140
- * The Funnel-B selector for a **no-path, whole-root MUTATION** — today
141
- * `create_pull_request` (and the future commit/branch/push tools). Unlike
142
- * {@link resolveReadRoots} it commits to exactly ONE root and, in a multi-root
143
- * session, refuses to default (⚖︎#11, JC-1 take B):
144
- *
145
- * - an explicit `root` name → that one declared root (fail-loud on unknown, R1);
146
- * - single-root session → the primary root (byte-identical to pre-C.26 — a
147
- * single root is unambiguous, so no `root` is required);
148
- * - multi-root, unscoped → refuse `ROOT_AMBIGUOUS` (a defaulted PR is the
149
- * "opened the wrong repo" accident; ambiguity only exists when N > 1).
150
- *
151
- * `what` names the action in the refusal message (e.g. `"a pull request"`). This
152
- * throws BEFORE the caller runs any git, so a no-root multi-root call performs
153
- * zero git spawns.
154
- *
155
- * @throws {CruxyError} CRUXY_E_ROOT_UNKNOWN (unknown name) / CRUXY_E_ROOT_AMBIGUOUS
156
- * (multi-root, no root).
157
- */
158
- export declare function resolveMutationRoot(ctx: ToolContext, ref: {
159
- root?: string;
160
- }, what: string): DeclaredRoot;
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "../types.js";
3
- /**
4
- * Read a UTF-8 text file from within the project root. Read-only — no approval.
5
- */
6
- export declare const readFileTool: Tool<z.ZodObject<{
7
- path: z.ZodString;
8
- }>>;
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "../types.js";
3
- /**
4
- * Create or overwrite a file within the project root. Gated on `ctx.approve`
5
- * before anything is written.
6
- */
7
- export declare const writeFileTool: Tool<z.ZodObject<{
8
- path: z.ZodString;
9
- content: z.ZodString;
10
- }>>;
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "./types.js";
3
- /**
4
- * Report the current git branch and working-tree status (`git status
5
- * --porcelain`) for the project root. Read-only — no approval, like read_file
6
- * and glob.
7
- *
8
- * Multi-repo (C.26, Funnel B): with more than one declared root, it fans every
9
- * root — each `getGitStatus(root.absPath)` spawns git with that root as its cwd,
10
- * so a section reports exactly the working tree its label names. A non-git root
11
- * is NAMED (not fatal), and a `root` argument scopes to one root.
12
- */
13
- export declare const gitStatusTool: Tool<z.ZodObject<{
14
- root: z.ZodOptional<z.ZodString>;
15
- }>>;
@@ -1,9 +0,0 @@
1
- export * from "./types.js";
2
- export * from "./registry.js";
3
- export * from "./list-files.js";
4
- export * from "./git-status.js";
5
- export * from "./search-codebase.js";
6
- export * from "./list-skills.js";
7
- export * from "./load-skill.js";
8
- export * from "./create-pull-request.js";
9
- export * from "./file/index.js";
@@ -1,13 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "./types.js";
3
- /**
4
- * List the entries of a workspace root, marking each as a directory or a file.
5
- *
6
- * Multi-repo (C.26, Funnel B): with more than one declared root, it fans every
7
- * root — each `fs.readdir(root.absPath)` reads exactly the root its section
8
- * header names. A per-root read error is NAMED (not fatal), and a `root` argument
9
- * scopes to one root.
10
- */
11
- export declare const listFilesTool: Tool<z.ZodObject<{
12
- root: z.ZodOptional<z.ZodString>;
13
- }>>;
@@ -1,9 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "./types.js";
3
- /**
4
- * List the available skills (name + one-line description + source). Read-only —
5
- * no approval — like the other discovery tools. This is the cheap half of
6
- * progressive disclosure: only the catalog enters context here; the agent calls
7
- * `load_skill` to pull a skill's full instructions when a task matches.
8
- */
9
- export declare const listSkillsTool: Tool<z.ZodObject<Record<string, never>>>;
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "./types.js";
3
- declare const parameters: z.ZodObject<{
4
- name: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- name: string;
7
- }, {
8
- name: string;
9
- }>;
10
- /**
11
- * Load a skill's full instructions on demand — the expensive half of
12
- * progressive disclosure. Returns the markdown body plus the absolute asset root
13
- * and the relative paths of any `scripts/` and `reference/` files, so the agent
14
- * can read or run them through the existing read_file / run_command tools.
15
- *
16
- * Read-only — no approval. Loading a skill never executes anything: scripts are
17
- * surfaced as paths only and run, if at all, through run_command (which applies
18
- * the normal approval gate).
19
- */
20
- export declare const loadSkillTool: Tool<typeof parameters>;
21
- export {};
@@ -1,23 +0,0 @@
1
- import type { ToolSpec } from "@cruxy/sdk";
2
- import type { Tool } from "./types.js";
3
- /**
4
- * In-memory catalogue of the tools available to the agent. Names are unique;
5
- * `toToolSpecs()` projects the catalogue into the `@cruxy/sdk` wire format.
6
- */
7
- export declare class ToolRegistry {
8
- private readonly tools;
9
- /** Register a tool. Throws if a tool with the same name already exists. */
10
- register(tool: Tool): void;
11
- /** Look up a tool by name, or `undefined` if not registered. */
12
- get(name: string): Tool | undefined;
13
- /** All registered tools, in registration order. */
14
- list(): Tool[];
15
- /**
16
- * Project every tool into a `ToolSpec` for the provider: name, description,
17
- * and the zod schema rendered as JSON Schema (with the `$schema` / `definitions`
18
- * cruft the wire format rejects stripped out).
19
- */
20
- toToolSpecs(): ToolSpec[];
21
- }
22
- /** Build the default registry with every built-in tool registered. */
23
- export declare function buildDefaultRegistry(): ToolRegistry;
@@ -1,35 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "./types.js";
3
- declare const parameters: z.ZodObject<{
4
- query: z.ZodString;
5
- k: z.ZodOptional<z.ZodNumber>;
6
- pathGlob: z.ZodOptional<z.ZodString>;
7
- root: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- query: string;
10
- root?: string | undefined;
11
- k?: number | undefined;
12
- pathGlob?: string | undefined;
13
- }, {
14
- query: string;
15
- root?: string | undefined;
16
- k?: number | undefined;
17
- pathGlob?: string | undefined;
18
- }>;
19
- /**
20
- * Semantic search over the project's local code index (C.17). Read-only — no
21
- * approval — like read_file and grep_files. The index is built/refreshed lazily
22
- * on first use; results are ranked by cosine similarity and token-budgeted.
23
- *
24
- * Multi-repo (C.26, Funnel B): with more than one declared root, the search fans
25
- * every root, gets each root's own index (`getIndexService(root.absPath)` — the
26
- * per-cwd cache is the per-root map), and merges into one globally-ranked list.
27
- * Each hit is labelled with its source root, `k` and the token budget are applied
28
- * AFTER the merge (global rank, ⚖︎JC-I), and any root whose index failed — or whose
29
- * matches the cap dropped — is NAMED, never silently implied to have no matches.
30
- *
31
- * Complements `grep_files`: prefer this for conceptual "where / how does X work"
32
- * questions, and grep for exact strings or symbols.
33
- */
34
- export declare const searchCodebaseTool: Tool<typeof parameters>;
35
- export {};
@@ -1,53 +0,0 @@
1
- import type { ToolContext } from "../types.js";
2
- /**
3
- * The ONE gated + sandboxed shell path (C.16 + C.19). Both `run_command` and the
4
- * C.19 hook runner funnel through {@link runGatedShell}: a command reaches
5
- * execution only after passing the SAME `ctx.requestApproval` gate and only
6
- * through the SAME `ctx.sandbox` (or host) substrate. There is deliberately no
7
- * second exec route, so a hook can never get a privileged path — proven by the
8
- * fact that both callers invoke this exact function.
9
- *
10
- * The structured {@link ShellExecResult} carries the raw exit code (which
11
- * `run_command`'s text `ToolResult` hides) so the hook runner can decide
12
- * blocking pass/fail on exit 0 vs non-zero, while `run_command` maps the same
13
- * result back to its byte-identical `ToolResult`.
14
- */
15
- /** The raw outcome of executing a shell command (gate already passed). */
16
- export interface ShellExecResult {
17
- /** The wall-clock timeout tripped and the process tree was killed. */
18
- timedOut: boolean;
19
- /** Numeric exit code, or null when killed / signalled / unknown. */
20
- exitCode: number | null;
21
- /** Terminating signal (host path only); null under the sandbox. */
22
- signal: string | null;
23
- /** Combined stdout+stderr, capped to `shell.maxOutputBytes`. */
24
- output: string;
25
- /** Output was truncated at the cap. */
26
- truncated: boolean;
27
- /** The host process failed to *start* (spawn error). Sandbox start failures
28
- * throw a coded error instead (propagated, never returned here). */
29
- spawnError?: string;
30
- }
31
- /** The result of the gate + (if allowed) execution. */
32
- export interface GatedShellOutcome {
33
- /** The U.3 gate allowed the command. When false, nothing executed. */
34
- approved: boolean;
35
- /** The rejection feedback when `approved` is false. */
36
- rejection?: string;
37
- /** The execution result — present iff `approved`. */
38
- exec?: ShellExecResult;
39
- }
40
- /**
41
- * Gate `command` through `ctx.requestApproval`, then — only if allowed — execute
42
- * it via the sandbox (when `ctx.sandbox` is set) or the bounded host spawn. A
43
- * rejection returns `{ approved: false }` and runs nothing. A non-interactive
44
- * gate throws `CRUXY_E_APPROVAL_REQUIRED` (propagated, never swallowed); a
45
- * sandbox that can't run throws its coded error (fail loud, no host fallback).
46
- */
47
- export declare function runGatedShell(command: string, ctx: ToolContext): Promise<GatedShellOutcome>;
48
- /**
49
- * Execute an already-approved command. Substrate is chosen SOLELY by
50
- * `ctx.sandbox`: present → the container (C.16), never the host; absent → the
51
- * bounded host spawn. No fallback path — a sandbox that can't run throws.
52
- */
53
- export declare function execShell(command: string, ctx: ToolContext): Promise<ShellExecResult>;
@@ -1 +0,0 @@
1
- export * from "./run-command.js";
@@ -1,81 +0,0 @@
1
- import { type ChildProcess, type SpawnOptions } from "node:child_process";
2
- /**
3
- * WHICH shell a host command runs through, and — just as important — WHICH
4
- * dialect the model must emit for it. `run_command` and `run_tests` both spawn
5
- * with the platform default shell (`{ shell: true }` → `/bin/sh` on POSIX,
6
- * `%ComSpec%`/cmd.exe on win32). The model emits bash, so on Windows a command
7
- * like `echo x; exit 1` runs as a single `echo`, exits 0, and reads as a false
8
- * success. This module makes Windows host execution first-class instead:
9
- *
10
- * Tier 0 `shell.executable` override → use it verbatim (the user owns it).
11
- * Tier 1 Git Bash (Git for Windows) → full POSIX parity, no model changes.
12
- * Tier 2 PowerShell (pwsh, else powershell.exe) → the model is told, via a
13
- * system-prompt directive keyed on {@link ShellPlan.dialect}, to emit
14
- * native PowerShell.
15
- * Tier 3 nothing usable → throw CRUXY_E_NO_SHELL. We NEVER hand bash-shaped
16
- * strings to cmd.exe silently — that is the exact false-green above.
17
- *
18
- * A non-default shell is ALWAYS invoked with explicit argv (`bash -c <cmd>`,
19
- * `powershell -NoProfile -Command <cmd>`), never Node's `shell: <path>` string
20
- * form: Node builds that command line with cmd.exe quoting rules, which mangle a
21
- * command bound for bash/PowerShell. POSIX with no override keeps `shell: true`
22
- * verbatim — a zero-change path off Windows.
23
- */
24
- export type ShellDialect = "posix" | "powershell" | "cmd";
25
- export type ShellSource = "default" | "config" | "git-bash" | "powershell";
26
- /**
27
- * The shell-selection fields the resolver reads — a structural subset of the
28
- * config's `ShellConfig` (which also carries `timeoutMs`/`maxOutputBytes`). Kept
29
- * narrow so callers and tests pass only what selection needs.
30
- */
31
- export interface ShellSelection {
32
- executable?: string;
33
- dialect?: ShellDialect;
34
- }
35
- /** How to spawn a host command, and which dialect the model should emit for it. */
36
- export type ShellPlan =
37
- /** POSIX default: `spawn(command, { shell: true })`, byte-identical to before. */
38
- {
39
- kind: "system";
40
- dialect: "posix";
41
- source: "default";
42
- }
43
- /** Explicit shell binary + fixed flags; the command is the final argv element. */
44
- | {
45
- kind: "explicit";
46
- file: string;
47
- flags: readonly string[];
48
- dialect: ShellDialect;
49
- source: ShellSource;
50
- };
51
- /** Injected so the resolver's win32 logic is unit-testable on a POSIX CI host. */
52
- export interface ShellEnv {
53
- platform: NodeJS.Platform;
54
- env: NodeJS.ProcessEnv;
55
- exists: (candidate: string) => boolean;
56
- }
57
- /**
58
- * Infer a dialect from a shell path's basename, but ONLY for the unambiguous
59
- * names — anything exotic (`nu`, `fish`, `xonsh`, …) returns undefined so the
60
- * caller demands an explicit `shell.dialect` rather than guessing wrong.
61
- */
62
- export declare function sniffDialect(executable: string): ShellDialect | undefined;
63
- /**
64
- * Resolve the shell PLAN from config + environment. Pure over its injected
65
- * {@link ShellEnv}, so the win32 tiers are exercised on any CI host. Throws
66
- * CRUXY_E_NO_SHELL (no usable shell) or CRUXY_E_CONFIG_INVALID (an override
67
- * whose dialect can't be determined) — both fail loud, never a silent fallback.
68
- */
69
- export declare function computeShellPlan(shell: ShellSelection, env?: ShellEnv): ShellPlan;
70
- /** The memoized production resolver. Throws (fail loud) exactly as compute does. */
71
- export declare function resolveShell(shell: ShellSelection): ShellPlan;
72
- /** Test hook: drop the memoized plan so the next resolve re-detects. */
73
- export declare function __resetShellResolution(): void;
74
- /**
75
- * Spawn `command` through the resolved shell as a killable process tree — the
76
- * single seam both `run_command` and `run_tests` route through. `system` keeps
77
- * the exact `{ shell: true }` spawn; every other plan invokes the shell binary
78
- * with explicit argv so the command reaches bash/PowerShell unmangled (see the
79
- * module header).
80
- */
81
- export declare function spawnShell(command: string, shell: ShellSelection, options?: SpawnOptions): ChildProcess;
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- import type { Tool } from "../types.js";
3
- /**
4
- * Run an arbitrary shell command in the project root. The highest-risk tool we
5
- * ship: it is gated on `ctx.approve` (a denial runs nothing) and bounded by a
6
- * timeout that kills the whole process tree plus a cap on captured output.
7
- *
8
- * Gate + execution live in the shared {@link runGatedShell} (also used by the
9
- * C.19 hook runner — the single, un-bypassable shell path); this tool only maps
10
- * the structured result back onto its `ToolResult` framing.
11
- */
12
- export declare const runCommandTool: Tool<z.ZodObject<{
13
- command: z.ZodString;
14
- }>>;