@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,283 +0,0 @@
1
- import { z } from "zod";
2
- import { MODEL_TIERS } from "../brand/voice.js";
3
- /**
4
- * Usage telemetry + cost tracking (C.22): types for LOCAL, honest usage
5
- * accounting. Every number here is a real figure the provider reported — a token
6
- * count is present only when the provider returned usage for that request, and
7
- * `undefined` (never `0`) when it did not. Nothing in this module is ever
8
- * transmitted anywhere (see the module barrel's no-phone-home note).
9
- */
10
- /** Bump when the on-disk usage file shape changes (enables future migration). */
11
- export declare const USAGE_FILE_VERSION: 1;
12
- /**
13
- * One model request's usage. A request that reported no usage keeps
14
- * `inputTokens`/`outputTokens` as `undefined` — the honest "unknown", never
15
- * zero-filled or re-tokenized. A provider-reported `0` is stored as `0` (a real
16
- * count), so the two cases stay distinguishable downstream.
17
- */
18
- export declare const UsageEntrySchema: z.ZodObject<{
19
- /** The routing tier (C.30) this request ran on; absent when routing is inert. */
20
- tier: z.ZodOptional<z.ZodString>;
21
- /** Provider-reported prompt tokens; `undefined` ⇔ no usage was reported. */
22
- inputTokens: z.ZodOptional<z.ZodNumber>;
23
- /** Provider-reported completion tokens; `undefined` ⇔ no usage was reported. */
24
- outputTokens: z.ZodOptional<z.ZodNumber>;
25
- /**
26
- * Prompt-cache tokens READ from a warm cache (phase-A caching, Anthropic dev
27
- * path). `undefined` ⇔ the provider doesn't cache / reported nothing (the
28
- * cruxy gateway today) — never zero-filled. Optional, so older on-disk
29
- * entries without the field still parse.
30
- */
31
- cacheReadTokens: z.ZodOptional<z.ZodNumber>;
32
- /** Prompt-cache tokens WRITTEN this request (the ~1.25× write premium); same `undefined`-≠-0 rule. */
33
- cacheCreationTokens: z.ZodOptional<z.ZodNumber>;
34
- /** ISO-8601 timestamp the request completed. */
35
- at: z.ZodString;
36
- }, "strict", z.ZodTypeAny, {
37
- at: string;
38
- tier?: string | undefined;
39
- inputTokens?: number | undefined;
40
- outputTokens?: number | undefined;
41
- cacheReadTokens?: number | undefined;
42
- cacheCreationTokens?: number | undefined;
43
- }, {
44
- at: string;
45
- tier?: string | undefined;
46
- inputTokens?: number | undefined;
47
- outputTokens?: number | undefined;
48
- cacheReadTokens?: number | undefined;
49
- cacheCreationTokens?: number | undefined;
50
- }>;
51
- export type UsageEntry = z.infer<typeof UsageEntrySchema>;
52
- /** One run's usage: an ordered list of per-request entries. */
53
- export declare const UsageRecordSchema: z.ZodObject<{
54
- /** Unique id for this run (one `session.send`). */
55
- runId: z.ZodString;
56
- /** Groups runs of one interactive session, so `--session` aggregates them. */
57
- sessionId: z.ZodOptional<z.ZodString>;
58
- /** ISO-8601 timestamp the run started. */
59
- startedAt: z.ZodString;
60
- entries: z.ZodArray<z.ZodObject<{
61
- /** The routing tier (C.30) this request ran on; absent when routing is inert. */
62
- tier: z.ZodOptional<z.ZodString>;
63
- /** Provider-reported prompt tokens; `undefined` ⇔ no usage was reported. */
64
- inputTokens: z.ZodOptional<z.ZodNumber>;
65
- /** Provider-reported completion tokens; `undefined` ⇔ no usage was reported. */
66
- outputTokens: z.ZodOptional<z.ZodNumber>;
67
- /**
68
- * Prompt-cache tokens READ from a warm cache (phase-A caching, Anthropic dev
69
- * path). `undefined` ⇔ the provider doesn't cache / reported nothing (the
70
- * cruxy gateway today) — never zero-filled. Optional, so older on-disk
71
- * entries without the field still parse.
72
- */
73
- cacheReadTokens: z.ZodOptional<z.ZodNumber>;
74
- /** Prompt-cache tokens WRITTEN this request (the ~1.25× write premium); same `undefined`-≠-0 rule. */
75
- cacheCreationTokens: z.ZodOptional<z.ZodNumber>;
76
- /** ISO-8601 timestamp the request completed. */
77
- at: z.ZodString;
78
- }, "strict", z.ZodTypeAny, {
79
- at: string;
80
- tier?: string | undefined;
81
- inputTokens?: number | undefined;
82
- outputTokens?: number | undefined;
83
- cacheReadTokens?: number | undefined;
84
- cacheCreationTokens?: number | undefined;
85
- }, {
86
- at: string;
87
- tier?: string | undefined;
88
- inputTokens?: number | undefined;
89
- outputTokens?: number | undefined;
90
- cacheReadTokens?: number | undefined;
91
- cacheCreationTokens?: number | undefined;
92
- }>, "many">;
93
- }, "strict", z.ZodTypeAny, {
94
- entries: {
95
- at: string;
96
- tier?: string | undefined;
97
- inputTokens?: number | undefined;
98
- outputTokens?: number | undefined;
99
- cacheReadTokens?: number | undefined;
100
- cacheCreationTokens?: number | undefined;
101
- }[];
102
- runId: string;
103
- startedAt: string;
104
- sessionId?: string | undefined;
105
- }, {
106
- entries: {
107
- at: string;
108
- tier?: string | undefined;
109
- inputTokens?: number | undefined;
110
- outputTokens?: number | undefined;
111
- cacheReadTokens?: number | undefined;
112
- cacheCreationTokens?: number | undefined;
113
- }[];
114
- runId: string;
115
- startedAt: string;
116
- sessionId?: string | undefined;
117
- }>;
118
- export type UsageRecord = z.infer<typeof UsageRecordSchema>;
119
- /** The persisted store: a bounded, newest-last list of run records. */
120
- export declare const UsageFileSchema: z.ZodObject<{
121
- version: z.ZodLiteral<1>;
122
- runs: z.ZodArray<z.ZodObject<{
123
- /** Unique id for this run (one `session.send`). */
124
- runId: z.ZodString;
125
- /** Groups runs of one interactive session, so `--session` aggregates them. */
126
- sessionId: z.ZodOptional<z.ZodString>;
127
- /** ISO-8601 timestamp the run started. */
128
- startedAt: z.ZodString;
129
- entries: z.ZodArray<z.ZodObject<{
130
- /** The routing tier (C.30) this request ran on; absent when routing is inert. */
131
- tier: z.ZodOptional<z.ZodString>;
132
- /** Provider-reported prompt tokens; `undefined` ⇔ no usage was reported. */
133
- inputTokens: z.ZodOptional<z.ZodNumber>;
134
- /** Provider-reported completion tokens; `undefined` ⇔ no usage was reported. */
135
- outputTokens: z.ZodOptional<z.ZodNumber>;
136
- /**
137
- * Prompt-cache tokens READ from a warm cache (phase-A caching, Anthropic dev
138
- * path). `undefined` ⇔ the provider doesn't cache / reported nothing (the
139
- * cruxy gateway today) — never zero-filled. Optional, so older on-disk
140
- * entries without the field still parse.
141
- */
142
- cacheReadTokens: z.ZodOptional<z.ZodNumber>;
143
- /** Prompt-cache tokens WRITTEN this request (the ~1.25× write premium); same `undefined`-≠-0 rule. */
144
- cacheCreationTokens: z.ZodOptional<z.ZodNumber>;
145
- /** ISO-8601 timestamp the request completed. */
146
- at: z.ZodString;
147
- }, "strict", z.ZodTypeAny, {
148
- at: string;
149
- tier?: string | undefined;
150
- inputTokens?: number | undefined;
151
- outputTokens?: number | undefined;
152
- cacheReadTokens?: number | undefined;
153
- cacheCreationTokens?: number | undefined;
154
- }, {
155
- at: string;
156
- tier?: string | undefined;
157
- inputTokens?: number | undefined;
158
- outputTokens?: number | undefined;
159
- cacheReadTokens?: number | undefined;
160
- cacheCreationTokens?: number | undefined;
161
- }>, "many">;
162
- }, "strict", z.ZodTypeAny, {
163
- entries: {
164
- at: string;
165
- tier?: string | undefined;
166
- inputTokens?: number | undefined;
167
- outputTokens?: number | undefined;
168
- cacheReadTokens?: number | undefined;
169
- cacheCreationTokens?: number | undefined;
170
- }[];
171
- runId: string;
172
- startedAt: string;
173
- sessionId?: string | undefined;
174
- }, {
175
- entries: {
176
- at: string;
177
- tier?: string | undefined;
178
- inputTokens?: number | undefined;
179
- outputTokens?: number | undefined;
180
- cacheReadTokens?: number | undefined;
181
- cacheCreationTokens?: number | undefined;
182
- }[];
183
- runId: string;
184
- startedAt: string;
185
- sessionId?: string | undefined;
186
- }>, "many">;
187
- }, "strict", z.ZodTypeAny, {
188
- version: 1;
189
- runs: {
190
- entries: {
191
- at: string;
192
- tier?: string | undefined;
193
- inputTokens?: number | undefined;
194
- outputTokens?: number | undefined;
195
- cacheReadTokens?: number | undefined;
196
- cacheCreationTokens?: number | undefined;
197
- }[];
198
- runId: string;
199
- startedAt: string;
200
- sessionId?: string | undefined;
201
- }[];
202
- }, {
203
- version: 1;
204
- runs: {
205
- entries: {
206
- at: string;
207
- tier?: string | undefined;
208
- inputTokens?: number | undefined;
209
- outputTokens?: number | undefined;
210
- cacheReadTokens?: number | undefined;
211
- cacheCreationTokens?: number | undefined;
212
- }[];
213
- runId: string;
214
- startedAt: string;
215
- sessionId?: string | undefined;
216
- }[];
217
- }>;
218
- export type UsageFile = z.infer<typeof UsageFileSchema>;
219
- /**
220
- * A per-tier price, in the user's own currency, PER MILLION TOKENS. Chosen over
221
- * per-token so prices read the way LLM pricing is quoted and don't lose
222
- * precision to tiny floats. Configured by the user under `usage.prices.<tier>`;
223
- * cruxy ships NO prices (a bundled table would imply upstream identities and go
224
- * stale) — with none configured, cost is omitted entirely.
225
- */
226
- export interface TierPrice {
227
- /** Price per 1,000,000 input tokens. */
228
- input: number;
229
- /** Price per 1,000,000 output tokens. */
230
- output: number;
231
- }
232
- /**
233
- * Prices keyed by TIER ONLY (kavi/vaani/mira) — the type literally cannot name
234
- * an upstream model, so the U.8 gag holds by construction. Partial: any tier may
235
- * be unpriced (its cost is then omitted, tokens still shown).
236
- */
237
- export type PriceTable = Partial<Record<(typeof MODEL_TIERS)[number], TierPrice>>;
238
- /** Aggregated usage for one tier across the summarized runs. */
239
- export interface TierUsage {
240
- tier: string;
241
- /** Sum of KNOWN input tokens; `undefined` if no request on this tier reported usage. */
242
- inputTokens?: number;
243
- /** Sum of KNOWN output tokens; `undefined` if none reported. */
244
- outputTokens?: number;
245
- /** Sum of KNOWN cache-read tokens on this tier; `undefined` if none reported. */
246
- cacheReadTokens?: number;
247
- /** Sum of KNOWN cache-creation tokens on this tier; `undefined` if none reported. */
248
- cacheCreationTokens?: number;
249
- /** Requests attributed to this tier. */
250
- requests: number;
251
- /** How many of those reported no usage (surfaced, never silently dropped). */
252
- requestsWithoutUsage: number;
253
- /** Cost, ONLY when this tier is priced AND has known tokens; else omitted. */
254
- cost?: number;
255
- }
256
- /** The aggregate over one or more runs — what the summary renderer consumes. */
257
- export interface UsageSummary {
258
- perTier: TierUsage[];
259
- /** Sum of KNOWN input tokens across all runs; `undefined` if none known. */
260
- totalInputTokens?: number;
261
- /** Sum of KNOWN output tokens across all runs; `undefined` if none known. */
262
- totalOutputTokens?: number;
263
- /**
264
- * Sum of KNOWN cache-read tokens across all runs; `undefined` if none known
265
- * (i.e. every request ran on a non-caching provider). Drives the `cached ↻N`
266
- * figure, which is the observable proof that phase-A caching is working.
267
- */
268
- totalCacheReadTokens?: number;
269
- /** Sum of KNOWN cache-creation tokens across all runs; `undefined` if none known. */
270
- totalCacheCreationTokens?: number;
271
- /** Sum of per-tier costs; `undefined` unless ≥1 tier was priced. */
272
- totalCost?: number;
273
- /** True iff at least one tier had a configured price (cost is shown). */
274
- priced: boolean;
275
- /** Currency label to prefix costs with; "" when the user configured none. */
276
- currency: string;
277
- /** Total requests across all runs that reported no usage (rendered visibly). */
278
- requestsWithoutUsage: number;
279
- /** Total requests across all runs. */
280
- requests: number;
281
- /** How many runs were aggregated. */
282
- runCount: number;
283
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * The process-EXIT backstop for long-lived child trees (C.12 LSP servers, C.27
3
- * MCP servers). The platform-aware spawn/kill primitives themselves now live in
4
- * {@link ./process-tree.js} — {@link killTree} is re-exported here unchanged so
5
- * existing LSP/MCP importers keep their import path, and so this backstop and
6
- * those transports reap trees the SAME way on every platform (negative-PID
7
- * `SIGKILL` on POSIX, `taskkill /T /F` on win32 — no more orphaned grandchildren
8
- * on Windows).
9
- *
10
- * A per-session graceful shutdown covers the normal path, but a hard exit
11
- * (Ctrl-C, an uncaught throw) would otherwise orphan these trees. So every live
12
- * child's pid is tracked in one process-wide set and force-killed on teardown.
13
- * Handlers are installed ONCE, lazily, on the first registration — so unit tests
14
- * that never spawn a real process never install them.
15
- *
16
- * This module is deliberately transport-agnostic: LSP (Content-Length framing)
17
- * and MCP (newline-delimited JSON) share the SAME backstop, so `killTrackedTrees`
18
- * on exit reaps both and there is a single source of truth for "no orphans".
19
- */
20
- import { killTree } from "./process-tree.js";
21
- export { killTree };
22
- /**
23
- * Force-kill the process group of every tracked-but-not-yet-shut-down child,
24
- * then forget them. This is exactly what the `exit`/`SIGINT`/`SIGTERM`/`SIGHUP`
25
- * handlers run — the last line against orphaned server trees on a hard exit.
26
- * Exported so it is directly testable without raising real process signals.
27
- * Idempotent: a second call is a no-op.
28
- */
29
- export declare function killTrackedTrees(): void;
30
- /** Number of child trees currently tracked by the exit backstop (for tests). */
31
- export declare function trackedTreeCount(): number;
32
- /** Track a live child for the exit backstop; returns a deregister callback. */
33
- export declare function registerForCleanup(pid: number | undefined): () => void;
@@ -1,17 +0,0 @@
1
- /**
2
- * Branch name plus the raw `git status --porcelain` text for `cwd`, or `null`
3
- * when it isn't a git repository (or git is unavailable). Backs the `git_status`
4
- * tool, which surfaces the porcelain output to the model.
5
- */
6
- export declare function getGitStatus(cwd: string): {
7
- branch: string;
8
- status: string;
9
- } | null;
10
- /**
11
- * Compact git context for the system prompt: current branch and whether the
12
- * working tree has uncommitted changes. `null` when not a repo / git missing.
13
- */
14
- export declare function getGitInfo(cwd: string): {
15
- branch: string;
16
- dirty: boolean;
17
- } | null;
@@ -1,18 +0,0 @@
1
- export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error", "silent"];
2
- export type LogLevel = (typeof LOG_LEVELS)[number];
3
- declare class Logger {
4
- private level;
5
- /** Diagnostics go to stderr, so the theme resolves against stderr's color. */
6
- private readonly theme;
7
- setLevel(level: LogLevel): void;
8
- getLevel(): LogLevel;
9
- private enabled;
10
- debug(...args: unknown[]): void;
11
- info(...args: unknown[]): void;
12
- warn(...args: unknown[]): void;
13
- error(...args: unknown[]): void;
14
- /** Primary user-facing output — always written to stdout. */
15
- print(...args: unknown[]): void;
16
- }
17
- export declare const logger: Logger;
18
- export {};
@@ -1,16 +0,0 @@
1
- import { type ChildProcess, type SpawnOptions } from "node:child_process";
2
- /**
3
- * Spawn a child as the head of a killable process tree, applying the
4
- * platform-correct grouping options on top of the caller's own (`shell`, `cwd`,
5
- * `stdio`, `env`, …). Any `detached`/`windowsHide` the caller passes is
6
- * overridden — grouping is this module's responsibility, not the call site's.
7
- */
8
- export declare function spawnTree(command: string, args?: readonly string[], options?: SpawnOptions): ChildProcess;
9
- /**
10
- * Kill a child's ENTIRE process tree — the child and every descendant it
11
- * spawned. POSIX: negative-PID `SIGKILL` targets the process group created by
12
- * {@link spawnTree}'s `detached`. win32: `taskkill /PID <pid> /T /F` walks the
13
- * OS tree (`/T`) and force-terminates it (`/F`). Fire-and-forget and
14
- * error-swallowing on both paths — the tree may already be gone.
15
- */
16
- export declare function killTree(pid: number | undefined): void;
@@ -1,22 +0,0 @@
1
- /**
2
- * Resolve a forge token (C.15). The chain is, in order:
3
- * 1. `GITHUB_TOKEN`
4
- * 2. `GH_TOKEN`
5
- * 3. `gh auth token` (if the GitHub CLI is installed and logged in)
6
- * 4. fail loud — {@link forgeAuth} (`CRUXY_E_FORGE_AUTH`)
7
- *
8
- * We **never** prompt for, store, or persist a token: it's read from the
9
- * environment / `gh` on every run, exactly like provider API keys.
10
- */
11
- /** Injection seams so the chain is testable without real env / a real `gh`. */
12
- export interface ForgeAuthDeps {
13
- /** Environment to read tokens from (defaults to `process.env`). */
14
- env?: NodeJS.ProcessEnv;
15
- /** Run `gh auth token`, returning the token or `null`. Defaults to the CLI. */
16
- ghToken?: () => string | null;
17
- }
18
- /**
19
- * Resolve a forge token or throw {@link forgeAuth}. `host` is only used to make
20
- * the error message specific.
21
- */
22
- export declare function resolveForgeToken(deps?: ForgeAuthDeps, host?: string): string;
@@ -1,74 +0,0 @@
1
- import type { Provider } from "@cruxy/sdk";
2
- import type { GeneratedContent } from "./types.js";
3
- /**
4
- * Turn a diff + session context into the PR publish content (C.15): a
5
- * conventional-commit subject, a structured body, a branch name, and the PR
6
- * title/body. The repo's commit rules (the C.18 git-commit skill + the
7
- * commitlint scope list) are honored two ways: they're handed to the LLM in the
8
- * prompt, **and** every field is run through deterministic normalizers so the
9
- * lowercase-subject rule (and scope allow-list) hold even if the model slips.
10
- *
11
- * Secrets never leave: the diff is redacted before the LLM sees it, and the
12
- * generated bodies are redacted again (defense-in-depth).
13
- */
14
- /** Conventional-commit types accepted by `@commitlint/config-conventional`. */
15
- export declare const CONVENTIONAL_TYPES: readonly ["feat", "fix", "chore", "docs", "refactor", "test", "perf", "build", "ci", "style", "revert"];
16
- export interface GenerateInput {
17
- /** The change set to summarize (already from `diffAgainst`). */
18
- diff: string;
19
- /** The PR base branch. */
20
- base: string;
21
- /** The branch the change is on, if already a feature branch. */
22
- currentBranch?: string;
23
- /** A short summary of what the agent did this session, if available. */
24
- sessionSummary?: string;
25
- /** commitlint scope allow-list; empty ⇒ no scope constraint. */
26
- scopes: string[];
27
- /** The git-commit SKILL.md body, embedded into the LLM prompt verbatim. */
28
- skillBody?: string;
29
- /** Caller-supplied title (e.g. the agent's), normalized rather than generated. */
30
- title?: string;
31
- /** Caller-supplied body. */
32
- body?: string;
33
- }
34
- /** Strip anything that looks like a credential from `text`. */
35
- export declare function redactSecrets(text: string): string;
36
- /**
37
- * Force `raw` into a valid conventional-commit subject: a known `type`, an
38
- * allow-listed scope (dropped if it isn't), a **lowercase** first word, no
39
- * trailing period, clamped to 72 chars. This is the deterministic guarantee that
40
- * the commitlint `subject-case` + `scope-enum` rules pass.
41
- */
42
- export declare function normalizeSubject(raw: string, scopes?: string[]): string;
43
- /** A safe branch name `type/slug` derived from a conventional subject. */
44
- export declare function slugifyBranch(subject: string): string;
45
- /** Assemble a structured PR body: what changed · why · verification. */
46
- export declare function assembleBody(parts: {
47
- what: string;
48
- why?: string;
49
- verification?: string;
50
- }): string;
51
- /**
52
- * Build the publish content deterministically (used by the `create_pull_request`
53
- * tool, where the agent itself authored the title/body). Missing fields are
54
- * derived; every field is still normalized + redacted.
55
- */
56
- export declare function fillContent(input: GenerateInput): GeneratedContent;
57
- /**
58
- * Generate publish content from the diff with the model, honoring the commit
59
- * rules, then normalize + redact. Resilient: if the model's reply isn't the
60
- * expected JSON, the first line becomes the subject and the rest the body.
61
- */
62
- export declare function generateWithLlm(provider: Provider, input: GenerateInput, opts?: {
63
- model?: string;
64
- }): Promise<GeneratedContent>;
65
- interface ParsedGenerated {
66
- branchName?: string;
67
- commitSubject?: string;
68
- commitBody?: string;
69
- prTitle?: string;
70
- prBody?: string;
71
- }
72
- /** Parse the model reply: a JSON object if present, else first-line/rest. */
73
- export declare function parseGenerated(text: string): ParsedGenerated;
74
- export {};
package/dist/vcs/git.d.ts DELETED
@@ -1,60 +0,0 @@
1
- export interface GitResult {
2
- readonly ok: boolean;
3
- readonly stdout: string;
4
- readonly stderr: string;
5
- readonly code: number | null;
6
- }
7
- /** Run `git <args>` in `cwd`, capturing stdout/stderr/exit. Never throws. */
8
- export declare function runGitCapture(args: string[], cwd: string): GitResult;
9
- /**
10
- * The absolute path of the git working tree that contains `cwd` (its
11
- * `--show-toplevel`), or `null` when `cwd` is not inside a git repository. Git
12
- * returns a canonical (symlink-resolved) path. Used by the C.26 cross-root guard
13
- * to detect two declared roots that share one repository (a commit for one would
14
- * `git add -A` the other's changes too).
15
- */
16
- export declare function gitToplevel(cwd: string): string | null;
17
- /** The current branch name, or `null` when detached / not a repo. */
18
- export declare function currentBranch(cwd: string): string | null;
19
- /** The default set of branch names cruxy will never write to directly. */
20
- export declare const DEFAULT_PROTECTED_BRANCHES: readonly ["main", "master"];
21
- /**
22
- * Is `branch` protected? The built-in `main`/`master` plus any names from config.
23
- * Case-insensitive so `Main`/`MASTER` are caught too.
24
- */
25
- export declare function isProtectedBranch(branch: string, extra?: readonly string[]): boolean;
26
- export interface EnsureBranchResult {
27
- /** The branch we ended up on (always a non-protected branch). */
28
- readonly branch: string;
29
- /** Whether we created/switched (true) or were already on a feature branch. */
30
- readonly switched: boolean;
31
- }
32
- /**
33
- * Guarantee we're on a non-protected feature branch before any commit/push. If
34
- * already on a feature branch, stay there. If on a protected branch, switch to
35
- * `desired` (creating it if needed). Throws if `desired` is itself protected.
36
- */
37
- export declare function ensureFeatureBranch(cwd: string, desired: string, protectedExtra?: readonly string[]): EnsureBranchResult;
38
- /** Stage every change in the working tree (`git add -A`). */
39
- export declare function stageAll(cwd: string): void;
40
- /** Whether the working tree (staged or not) has any changes to commit. */
41
- export declare function hasChanges(cwd: string): boolean;
42
- /**
43
- * Commit the staged changes with a conventional message. Refuses on a protected
44
- * branch (last-line guard) and **never** passes `--no-verify`, so the commitlint
45
- * `commit-msg` hook runs. Subject and body go as separate `-m` flags.
46
- */
47
- export declare function commit(cwd: string, subject: string, body: string, protectedExtra?: readonly string[]): void;
48
- /**
49
- * Push `branch` to `origin`, setting upstream. **Never** `--force`, **never**
50
- * `--no-verify` — the pre-push hook (build · typecheck · lint · test + main
51
- * guard) runs and a failure is surfaced verbatim. Refuses on a protected branch.
52
- */
53
- export declare function push(cwd: string, branch: string, protectedExtra?: readonly string[]): void;
54
- /**
55
- * The change set for content generation: the working-tree diff relative to
56
- * `base` (covers committed-on-branch *and* uncommitted edits), plus the names of
57
- * untracked files (which a plain `git diff` omits). Falls back to the diff vs
58
- * `HEAD` when `base` isn't reachable (shallow clone / brand-new repo).
59
- */
60
- export declare function diffAgainst(cwd: string, base: string): string;
@@ -1,50 +0,0 @@
1
- import type { ForgeProvider, PullRequestResult, PullRequestSpec, RepoIdentity, RepoInfo } from "./types.js";
2
- /**
3
- * GitHub implementation of {@link ForgeProvider} (C.15) — the only forge that
4
- * ships today. It talks to the REST API directly (no octokit dependency) and
5
- * keeps `fetch` injectable for tests. Everything GitHub-specific lives here;
6
- * nothing above {@link ForgeProvider} knows it's GitHub.
7
- */
8
- export interface GitHubProviderOptions {
9
- /** The resolved forge token (see `auth.ts`). */
10
- token: string;
11
- /** Injected fetch (tests / advanced); defaults to global `fetch`. */
12
- fetchImpl?: typeof fetch;
13
- }
14
- export declare class GitHubProvider implements ForgeProvider {
15
- readonly id = "github";
16
- private readonly token;
17
- private readonly fetchImpl;
18
- constructor(opts: GitHubProviderOptions);
19
- /**
20
- * The LOCAL half of {@link getRepoInfo}: read `origin` and parse it, no network.
21
- * Shared by the full lookup and by the Step-4 wrong-repo re-check so both derive
22
- * the target from the exact same rule.
23
- */
24
- resolveRepoIdentity(cwd: string): RepoIdentity;
25
- getRepoInfo(cwd: string): Promise<RepoInfo>;
26
- createPullRequest(repo: RepoInfo, spec: PullRequestSpec): Promise<PullRequestResult>;
27
- /** Look up an open PR for `owner:head`, or `null` if there isn't one. */
28
- private findOpenPr;
29
- private fetchDefaultBranch;
30
- /** Issue an authenticated REST call, resolving the API base from the host. */
31
- private api;
32
- }
33
- /**
34
- * Parse a git remote URL into `{ host, owner, repo }`, supporting the https,
35
- * `scp`-style ssh, and `ssh://` forms. Returns `null` for anything we can't
36
- * confidently parse as `host/owner/repo`.
37
- */
38
- export declare function parseRemote(url: string): {
39
- host: string;
40
- owner: string;
41
- repo: string;
42
- } | null;
43
- /**
44
- * Construct the forge provider for a token. GitHub today; the GitLab/Bitbucket
45
- * branch slots in here later (e.g. switch on a configured provider id) without
46
- * touching the orchestrator.
47
- */
48
- export declare function createForgeProvider(token: string, opts?: {
49
- fetchImpl?: typeof fetch;
50
- }): ForgeProvider;
@@ -1,20 +0,0 @@
1
- /**
2
- * The repo's commit conventions, gathered best-effort so PR generation honors
3
- * them automatically (C.15): the C.18 git-commit skill body and the commitlint
4
- * scope allow-list. Both are optional — a repo may have neither — so every lookup
5
- * degrades to a sensible empty default rather than failing the PR flow.
6
- */
7
- export interface CommitGuidance {
8
- /** The git-commit SKILL.md body, embedded verbatim into the LLM prompt. */
9
- skillBody?: string;
10
- /** commitlint `scope-enum` values; empty ⇒ no scope constraint. */
11
- scopes: string[];
12
- }
13
- /** Load the git-commit skill body + commitlint scopes for `cwd`. Never throws. */
14
- export declare function loadCommitGuidance(cwd: string): Promise<CommitGuidance>;
15
- /**
16
- * Extract the `scope-enum` allow-list from a repo's commitlint config. Supports
17
- * the JS/CJS module forms (imported) and JSON. Any failure ⇒ `[]` (no
18
- * constraint), so a malformed or absent config never blocks a PR.
19
- */
20
- export declare function loadCommitlintScopes(cwd: string): Promise<string[]>;
@@ -1,7 +0,0 @@
1
- export * from "./types.js";
2
- export * from "./git.js";
3
- export * from "./github.js";
4
- export * from "./auth.js";
5
- export * from "./generate.js";
6
- export * from "./guidance.js";
7
- export * from "./service.js";
@@ -1,61 +0,0 @@
1
- import type { ApprovalDecision } from "../approval/types.js";
2
- import type { CruxyConfig } from "../config/index.js";
3
- import type { ApproveAction } from "../tools/types.js";
4
- import type { ForgeProvider, GeneratedContent } from "./types.js";
5
- /**
6
- * The PR-publish orchestrator (C.15): ensure a feature branch → commit → push →
7
- * open PR, with the **entire** plan gated by one U.3 approval. Nothing mutates
8
- * before the user approves; a rejection aborts cleanly with no commit or push.
9
- *
10
- * The forge and the content generator are injected, so both call sites — the
11
- * `create_pull_request` tool (deterministic fill) and the `cruxy pr` command
12
- * (LLM generation) — share this exact flow.
13
- */
14
- /** Produce the publish content for a change set (LLM or deterministic). */
15
- export type GenerateContent = (input: {
16
- diff: string;
17
- base: string;
18
- currentBranch?: string;
19
- title?: string;
20
- body?: string;
21
- }) => Promise<GeneratedContent>;
22
- export interface PrServiceDeps {
23
- cwd: string;
24
- /**
25
- * The name of the declared workspace root this PR acts in (C.26 Step 4). It is
26
- * the exact root the caller selected — the U.3 attribution and the wrong-repo
27
- * error name it verbatim, rather than re-deriving a basename from `cwd`. Defaults
28
- * to `basename(cwd)` for callers that don't select a root (the single-root `cruxy
29
- * pr` command), which is byte-identical to the pre-Step-4 attribution.
30
- */
31
- rootName?: string;
32
- config: CruxyConfig;
33
- forge: ForgeProvider;
34
- generate: GenerateContent;
35
- /** The U.3 gate (the same capability tools receive as `ctx.requestApproval`). */
36
- requestApproval: (action: ApproveAction) => Promise<ApprovalDecision>;
37
- }
38
- export interface OpenPrOptions {
39
- /** Override the base branch (else config.git.defaultBase → repo default → main). */
40
- base?: string;
41
- /** Caller-supplied PR title (normalized, not generated). */
42
- title?: string;
43
- /** Caller-supplied PR body. */
44
- body?: string;
45
- draft?: boolean;
46
- }
47
- export type OpenPrOutcome = {
48
- approved: false;
49
- feedback?: string;
50
- } | {
51
- approved: true;
52
- url: string;
53
- number: number;
54
- branch: string;
55
- base: string;
56
- alreadyExists: boolean;
57
- };
58
- /** Build a PR service from its dependencies. */
59
- export declare function createPrService(deps: PrServiceDeps): {
60
- openPullRequest: (opts?: OpenPrOptions) => Promise<OpenPrOutcome>;
61
- };