@illuminis/comprism 0.1.8 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/out/{graph → build/machine/codemap}/read-python.js +2 -2
  2. package/out/{executor → build/machine/executor}/diagnostics.js +1 -1
  3. package/out/{executor → build/machine/executor}/hooks.js +1 -1
  4. package/out/{executor → build/machine/executor}/sandbox.js +1 -1
  5. package/out/build/machine/line/index.js +339 -0
  6. package/out/{commands/privacy.js → build/machine/runtime/home.js} +10 -19
  7. package/out/build/machine/runtime/needs.js +89 -0
  8. package/out/{lib → build/machine/runtime}/self.js +25 -3
  9. package/out/build/machine/terminal/jobs.js +67 -0
  10. package/out/build/machine/terminal/sign-in.js +212 -0
  11. package/out/build/machine/terminal/steps.js +460 -0
  12. package/out/build/machine/terminal/voice.js +136 -0
  13. package/out/build/machine/voice/record.js +286 -0
  14. package/out/cli-start.js +128 -0
  15. package/out/machine/line/index.js +339 -0
  16. package/out/machine/runtime/self.js +22 -0
  17. package/out/machine/terminal/clipboard.js +182 -0
  18. package/out/machine/terminal/jobs.js +67 -0
  19. package/out/machine/terminal/sign-in.js +212 -0
  20. package/out/machine/terminal/steps.js +460 -0
  21. package/out/machine/terminal/voice.js +136 -0
  22. package/out/machine/voice/record.js +79 -1
  23. package/out/native/dictate +0 -0
  24. package/out/server.generated.js +6 -0
  25. package/package.json +8 -40
  26. package/README.md +0 -343
  27. package/out/agent/command.d.ts +0 -157
  28. package/out/agent/command.js +0 -454
  29. package/out/agent/render.d.ts +0 -169
  30. package/out/agent/render.js +0 -689
  31. package/out/agent/session.d.ts +0 -334
  32. package/out/agent/session.js +0 -1232
  33. package/out/commands/agents.d.ts +0 -2
  34. package/out/commands/agents.js +0 -79
  35. package/out/commands/ask.d.ts +0 -1
  36. package/out/commands/ask.js +0 -222
  37. package/out/commands/codemap.d.ts +0 -2
  38. package/out/commands/codemap.js +0 -151
  39. package/out/commands/commands-thin.d.ts +0 -39
  40. package/out/commands/commands-thin.js +0 -244
  41. package/out/commands/config.d.ts +0 -1
  42. package/out/commands/config.js +0 -138
  43. package/out/commands/cost.d.ts +0 -1
  44. package/out/commands/cost.js +0 -167
  45. package/out/commands/decisionEngine.d.ts +0 -1
  46. package/out/commands/decisionEngine.js +0 -66
  47. package/out/commands/hooks.d.ts +0 -1
  48. package/out/commands/hooks.js +0 -83
  49. package/out/commands/install.d.ts +0 -206
  50. package/out/commands/install.js +0 -738
  51. package/out/commands/instructions.d.ts +0 -1
  52. package/out/commands/instructions.js +0 -113
  53. package/out/commands/integrations.d.ts +0 -3
  54. package/out/commands/integrations.js +0 -215
  55. package/out/commands/jobs.d.ts +0 -5
  56. package/out/commands/jobs.js +0 -157
  57. package/out/commands/keys.d.ts +0 -55
  58. package/out/commands/keys.js +0 -344
  59. package/out/commands/login.d.ts +0 -9
  60. package/out/commands/login.js +0 -606
  61. package/out/commands/memory.d.ts +0 -3
  62. package/out/commands/memory.js +0 -113
  63. package/out/commands/permissions.d.ts +0 -1
  64. package/out/commands/permissions.js +0 -94
  65. package/out/commands/plugins.d.ts +0 -4
  66. package/out/commands/plugins.js +0 -192
  67. package/out/commands/privacy.d.ts +0 -1
  68. package/out/commands/providerKey.d.ts +0 -32
  69. package/out/commands/providerKey.js +0 -108
  70. package/out/commands/repl.d.ts +0 -12
  71. package/out/commands/repl.js +0 -2303
  72. package/out/commands/report.d.ts +0 -39
  73. package/out/commands/report.js +0 -115
  74. package/out/commands/review.d.ts +0 -5
  75. package/out/commands/review.js +0 -223
  76. package/out/commands/sessions.d.ts +0 -23
  77. package/out/commands/sessions.js +0 -115
  78. package/out/commands/settings.d.ts +0 -23
  79. package/out/commands/settings.js +0 -153
  80. package/out/commands/skills.d.ts +0 -21
  81. package/out/commands/skills.js +0 -207
  82. package/out/commands/unattended.d.ts +0 -7
  83. package/out/commands/unattended.js +0 -351
  84. package/out/commands/update.d.ts +0 -1
  85. package/out/commands/update.js +0 -123
  86. package/out/commands/welcome.d.ts +0 -25
  87. package/out/commands/welcome.js +0 -223
  88. package/out/commands/worktrees.d.ts +0 -5
  89. package/out/commands/worktrees.js +0 -186
  90. package/out/executor/browser.d.ts +0 -14
  91. package/out/executor/diagnostics.d.ts +0 -2
  92. package/out/executor/documents.d.ts +0 -40
  93. package/out/executor/files.d.ts +0 -2
  94. package/out/executor/git.d.ts +0 -48
  95. package/out/executor/hooks.d.ts +0 -51
  96. package/out/executor/index.d.ts +0 -45
  97. package/out/executor/notebook.d.ts +0 -2
  98. package/out/executor/paths.d.ts +0 -20
  99. package/out/executor/sandbox.d.ts +0 -40
  100. package/out/executor/shell.d.ts +0 -86
  101. package/out/executor/toolservers.d.ts +0 -20
  102. package/out/executor/worktree.d.ts +0 -9
  103. package/out/graph/build.d.ts +0 -45
  104. package/out/graph/facts.d.ts +0 -47
  105. package/out/graph/files.d.ts +0 -45
  106. package/out/graph/read-locales.d.ts +0 -29
  107. package/out/graph/read-python.d.ts +0 -11
  108. package/out/graph/read-typescript.d.ts +0 -16
  109. package/out/graph/sync.d.ts +0 -66
  110. package/out/graph/sync.js +0 -242
  111. package/out/lib/attach.d.ts +0 -106
  112. package/out/lib/attach.js +0 -396
  113. package/out/lib/clipboard.d.ts +0 -23
  114. package/out/lib/commandlist.d.ts +0 -20
  115. package/out/lib/commandlist.js +0 -58
  116. package/out/lib/config.d.ts +0 -94
  117. package/out/lib/config.js +0 -197
  118. package/out/lib/connection.d.ts +0 -73
  119. package/out/lib/connection.js +0 -188
  120. package/out/lib/decision.d.ts +0 -22
  121. package/out/lib/decision.js +0 -50
  122. package/out/lib/fingerprint.d.ts +0 -25
  123. package/out/lib/fingerprint.js +0 -58
  124. package/out/lib/gateway.d.ts +0 -427
  125. package/out/lib/gateway.js +0 -226
  126. package/out/lib/history.d.ts +0 -24
  127. package/out/lib/history.js +0 -137
  128. package/out/lib/ide.d.ts +0 -19
  129. package/out/lib/ide.js +0 -131
  130. package/out/lib/keyboard.d.ts +0 -98
  131. package/out/lib/keyboard.js +0 -390
  132. package/out/lib/lastlogin.d.ts +0 -14
  133. package/out/lib/lastlogin.js +0 -105
  134. package/out/lib/machine.d.ts +0 -21
  135. package/out/lib/machine.js +0 -91
  136. package/out/lib/notify.d.ts +0 -4
  137. package/out/lib/notify.js +0 -52
  138. package/out/lib/output.d.ts +0 -48
  139. package/out/lib/output.js +0 -108
  140. package/out/lib/picker.d.ts +0 -1
  141. package/out/lib/picker.js +0 -158
  142. package/out/lib/project-ops.d.ts +0 -19
  143. package/out/lib/project-ops.js +0 -146
  144. package/out/lib/project.d.ts +0 -28
  145. package/out/lib/prompt.d.ts +0 -37
  146. package/out/lib/prompt.js +0 -142
  147. package/out/lib/queue.d.ts +0 -13
  148. package/out/lib/queue.js +0 -116
  149. package/out/lib/readiness.d.ts +0 -22
  150. package/out/lib/readiness.js +0 -207
  151. package/out/lib/self.d.ts +0 -23
  152. package/out/lib/servicecommand.d.ts +0 -14
  153. package/out/lib/servicecommand.js +0 -74
  154. package/out/lib/sessions.d.ts +0 -19
  155. package/out/lib/sessions.js +0 -221
  156. package/out/lib/startcache.d.ts +0 -13
  157. package/out/lib/startcache.js +0 -78
  158. package/out/lib/stdin.d.ts +0 -32
  159. package/out/lib/stdin.js +0 -117
  160. package/out/lib/store.d.ts +0 -40
  161. package/out/lib/store.js +0 -138
  162. package/out/lib/sync.d.ts +0 -18
  163. package/out/lib/sync.js +0 -81
  164. package/out/lib/types.d.ts +0 -417
  165. package/out/lib/types.js +0 -21
  166. package/out/lib/ui.d.ts +0 -123
  167. package/out/lib/ui.js +0 -299
  168. package/out/lib/version.d.ts +0 -23
  169. package/out/lib/version.js +0 -46
  170. package/out/lib/voice.d.ts +0 -49
  171. package/out/lib/voice.js +0 -236
  172. package/out/lib/words.d.ts +0 -20
  173. package/out/lib/words.js +0 -27
  174. package/out/machine/codemap/build.d.ts +0 -45
  175. package/out/machine/codemap/facts.d.ts +0 -47
  176. package/out/machine/codemap/files.d.ts +0 -45
  177. package/out/machine/codemap/read-locales.d.ts +0 -29
  178. package/out/machine/codemap/read-python.d.ts +0 -11
  179. package/out/machine/codemap/read-typescript.d.ts +0 -16
  180. package/out/machine/executor/browser.d.ts +0 -14
  181. package/out/machine/executor/diagnostics.d.ts +0 -2
  182. package/out/machine/executor/documents.d.ts +0 -40
  183. package/out/machine/executor/files.d.ts +0 -2
  184. package/out/machine/executor/git.d.ts +0 -48
  185. package/out/machine/executor/hooks.d.ts +0 -51
  186. package/out/machine/executor/index.d.ts +0 -45
  187. package/out/machine/executor/notebook.d.ts +0 -2
  188. package/out/machine/executor/paths.d.ts +0 -20
  189. package/out/machine/executor/sandbox.d.ts +0 -40
  190. package/out/machine/executor/shell.d.ts +0 -86
  191. package/out/machine/executor/toolservers.d.ts +0 -20
  192. package/out/machine/executor/worktree.d.ts +0 -9
  193. package/out/machine/folder/project.d.ts +0 -28
  194. package/out/machine/runtime/home.d.ts +0 -2
  195. package/out/machine/runtime/needs.d.ts +0 -30
  196. package/out/machine/runtime/self.d.ts +0 -23
  197. package/out/machine/voice/record.d.ts +0 -38
  198. package/out/postinstall.d.ts +0 -2
  199. package/out/postinstall.js +0 -120
  200. package/out/providers/anthropic.d.ts +0 -22
  201. package/out/providers/anthropic.js +0 -80
  202. package/out/providers/index.d.ts +0 -8
  203. package/out/providers/index.js +0 -84
  204. package/out/providers/openai.d.ts +0 -11
  205. package/out/providers/openai.js +0 -57
  206. package/out/thin.d.ts +0 -2
  207. package/out/thin.js +0 -855
  208. package/scripts/read_python.py +0 -270
  209. /package/out/{graph → build/machine/codemap}/build.js +0 -0
  210. /package/out/{graph → build/machine/codemap}/facts.js +0 -0
  211. /package/out/{graph → build/machine/codemap}/files.js +0 -0
  212. /package/out/{graph → build/machine/codemap}/read-locales.js +0 -0
  213. /package/out/{graph → build/machine/codemap}/read-typescript.js +0 -0
  214. /package/out/{executor → build/machine/executor}/browser.js +0 -0
  215. /package/out/{executor → build/machine/executor}/documents.js +0 -0
  216. /package/out/{executor → build/machine/executor}/files.js +0 -0
  217. /package/out/{executor → build/machine/executor}/git.js +0 -0
  218. /package/out/{executor → build/machine/executor}/index.js +0 -0
  219. /package/out/{executor → build/machine/executor}/notebook.js +0 -0
  220. /package/out/{executor → build/machine/executor}/paths.js +0 -0
  221. /package/out/{executor → build/machine/executor}/shell.js +0 -0
  222. /package/out/{executor → build/machine/executor}/toolservers.js +0 -0
  223. /package/out/{executor → build/machine/executor}/worktree.js +0 -0
  224. /package/out/{lib → build/machine/folder}/project.js +0 -0
  225. /package/out/{lib → build/machine/terminal}/clipboard.js +0 -0
@@ -1,223 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.session = session;
37
- exports.showWelcome = showWelcome;
38
- /**
39
- * The first thing anybody sees.
40
- *
41
- * ── Why a banner is not decoration ────────────────────────────────────────
42
- *
43
- * Typing the bare command used to print a list of other commands. That tells a
44
- * person what they COULD do and nothing about where they are. In a product
45
- * whose whole claim is a number, four facts make the number mean anything: who
46
- * you are signed in as, whose workspace you are in, which model your savings
47
- * are measured against, and which folder you are working in.
48
- *
49
- * A person who does not know the comparison model cannot read a saving, and a
50
- * person who has to run three commands to find it will not.
51
- *
52
- * The prism spectrum is the brand: white light in, a spectrum out. It is drawn
53
- * from the same eight colors as every other illuminis screen, through the same
54
- * helper, so a terminal and the portal read as one product.
55
- *
56
- * Everything here is either already on this machine or comes back in ONE call.
57
- * A welcome screen costing three round trips is one people learn to skip.
58
- */
59
- const connection_1 = require("../lib/connection");
60
- const gateway_1 = require("../lib/gateway");
61
- const config_1 = require("../lib/config");
62
- const settings_1 = require("./settings");
63
- const version_1 = require("../lib/version");
64
- const ui = __importStar(require("../lib/ui"));
65
- const out = (s = '') => process.stdout.write(s + '\n');
66
- /**
67
- * Who this machine is signed in as, and everything else the header prints.
68
- *
69
- * ── One call, to the one service ──────────────────────────────────────────
70
- *
71
- * This used to call the platform's own `whoami` for the identity, and the
72
- * header then had no way at all to say how many vendor keys the account held.
73
- * Two questions, two addresses, and the header could show a person facts that
74
- * disagreed with each other. On 17 September 2026 it did exactly that: "User
75
- * unknown" beside a company name, and a session that then announced no provider
76
- * key was stored while four were stored and active.
77
- *
78
- * Every line below now comes from one request to the single service, so the
79
- * header either shows a consistent picture or says plainly that it could not
80
- * reach the workspace. There is no third state in which half of it is true.
81
- *
82
- * Null rather than an error when it cannot be reached. A header is the wrong
83
- * place to fail: somebody on a plane still gets the local facts, and the lines
84
- * needing the server say so.
85
- */
86
- async function session() {
87
- const conn = (0, connection_1.readConnection)();
88
- if (!conn?.url || !conn.workspaceKey)
89
- return null;
90
- const reply = await (0, gateway_1.ask)({ intent: 'session', prompt: '' });
91
- // `ok` false means nobody answered. `served` false means the workspace is
92
- // running a build without this question. Neither is an answer about the
93
- // account, and neither may be drawn as one.
94
- if (!reply.ok || reply.served === false || !reply.session)
95
- return null;
96
- return reply.session;
97
- }
98
- /**
99
- * The mark: a six layer prism, each layer two cells wider than the one above,
100
- * colored bottom to top in the illuminis gradient: light purple at the base,
101
- * then light blue, light green, light gold, light orange and light red at the
102
- * top, so the cool colors carry the weight of the wide layers. The purple,
103
- * green and gold are pale shades of the illuminis logo's own
104
- * (platform/branding/assets).
105
- *
106
- * No ring and no beams: at terminal size both read as rough, and straight
107
- * layers stay clean in any terminal (owner, 28 September 2026). Solid colored
108
- * cells only: a terminal paints a cell's background edge to edge in any font.
109
- * One pixel to a character, six lines tall.
110
- *
111
- * Without color the picture cannot be drawn, so the four row block pyramid
112
- * stands in: full blocks only, which render the same in every font.
113
- */
114
- const ICON = [
115
- '..............................f69f97f69f97..............................',
116
- '........................ffbd8affbd8affbd8affbd8a........................',
117
- '..................ffdf7fffdf7fffdf7fffdf7fffdf7fffdf7f..................',
118
- '............a1d38ca1d38ca1d38ca1d38ca1d38ca1d38ca1d38ca1d38c............',
119
- '......95d2f095d2f095d2f095d2f095d2f095d2f095d2f095d2f095d2f095d2f0......',
120
- 'bba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1dd',
121
- ];
122
- function mark() {
123
- const picture = ui.cellArt(ICON);
124
- if (picture.length)
125
- return picture;
126
- const rows = [];
127
- for (let r = 1; r <= 4; r++) {
128
- const left = 4 - r;
129
- rows.push(' '.repeat(left) + '\u2588'.repeat(r * 2) + ' '.repeat(left));
130
- }
131
- return rows;
132
- }
133
- /** A label and its value, aligned so the values form one column. */
134
- function row(label, value) {
135
- return ` ${ui.c.dim(label.padEnd(11))}${value}`;
136
- }
137
- /** "base-tenant" is a machine name. A person reads "Base Tenant". */
138
- function readable(name) {
139
- return name.replace(/[-_]/g, ' ').replace(/\b\w/g, (m) => m.toUpperCase());
140
- }
141
- /** `known` is who this machine is, when the caller already has it (the last
142
- * answer, drawn at once while a fresh one is asked for). */
143
- async function showWelcome(known, signingIn = false, withMark = true) {
144
- const conn = (0, connection_1.readConnection)();
145
- const cfg = (0, config_1.loadConfig)();
146
- const folder = (0, settings_1.currentWorkspace)();
147
- const me = known !== undefined ? known : await session();
148
- // The mark once per start. Signing in first draws it; the session that
149
- // follows draws only the account, so nobody sees the same screen twice.
150
- if (withMark) {
151
- const art = mark();
152
- // The name and the line under it sit beside the middle of the mark.
153
- const at = Math.max(0, Math.floor(art.length / 2) - 1);
154
- const beside = {
155
- [at]: `${ui.c.bold('CompletionPrism')} ${ui.c.dim(`v${version_1.COMPRISM_VERSION}`)}`,
156
- [at + 1]: ui.c.muted('Optimize AI completion economics by optimizing work.'),
157
- };
158
- out();
159
- art.forEach((line, i) => out(beside[i] ? ` ${line} ${beside[i]}` : ` ${line}`));
160
- out(ui.prismRule());
161
- out();
162
- }
163
- // Signing in comes next and says everything else itself.
164
- if (signingIn && !conn?.url)
165
- return;
166
- if (!conn?.url) {
167
- // Nothing else here is knowable yet, and the one useful thing to say is the
168
- // single command that changes that.
169
- out(row('Signed in', ui.c.amber('not yet')));
170
- out(row('Workspace', `${folder.path} ${ui.c.dim('(where you are)')}`));
171
- out();
172
- // Not said when signing in follows at once: naming a command to type, just
173
- // above the sign in it would start, reads as a second step.
174
- if (!signingIn) {
175
- out(` ${ui.c.dim('start with')} ${ui.c.bold('comprism login')}`);
176
- out();
177
- }
178
- return;
179
- }
180
- const company = me?.company || readable(conn.tenant || 'unknown');
181
- const who = me?.user_email || ui.c.dim('unknown');
182
- const plan = me?.plan || '';
183
- const allowance = me?.requests_per_month || 0;
184
- // The address the SERVER says it answers on, in preference to the one this
185
- // machine happens to hold. A client that can only echo its own stored address
186
- // can never tell a person that the address is the thing that is wrong, which
187
- // is exactly what happened when a machine sat pointed at a dead laptop port.
188
- // Except on this laptop: there the server names its public address, which is
189
- // not where this machine is talking, and "you are on production" is the
190
- // single most confusing thing a developer testing locally can be told.
191
- const local = (0, connection_1.isLocalAddress)(conn.url);
192
- const address = local
193
- ? `${conn.url.replace(/^https?:\/\//, '')} ${ui.c.dim('(this laptop)')}`
194
- : (me?.workspace_url || conn.url).replace(/^https?:\/\//, '');
195
- out(row('User', who));
196
- out(row('Company', company));
197
- out(row('Server', local ? address : ui.c.dim(address)));
198
- // The service's own record of the person's choice (service catalog 14).
199
- out(row('Comparing', `${me?.comparing || ui.c.amber('not set')} ${ui.c.dim('change with `comprism model`')}`));
200
- out(row('Workspace', `${folder.path} ${ui.c.dim(folder.source === 'cwd' ? '(where you are)' : '(saved)')}`));
201
- if (plan) {
202
- out(row('Plan', allowance
203
- ? `${plan} ${ui.c.dim(`${allowance.toLocaleString()} requests a month`)}`
204
- : plan));
205
- }
206
- if (!me) {
207
- out();
208
- out(` ${ui.c.amber('your organization could not be reached, so only local settings are shown')}`);
209
- out(` ${ui.c.dim('nothing here is known about your account, including your provider keys')}`);
210
- }
211
- else if (me.vendors_known === false) {
212
- // It answered, but could not establish this one line. Said plainly, because
213
- // an unchecked vendor list shown as a number is the fault this whole change
214
- // exists to end.
215
- out();
216
- out(` ${ui.c.amber('your vendor keys could not be checked, so that is unknown rather than none')}`);
217
- }
218
- out();
219
- out(` ${ui.c.dim('ask a question')} ${ui.c.bold('comprism ask')}`);
220
- out(` ${ui.c.dim('have work done')} ${ui.c.bold('comprism work')}`);
221
- out(` ${ui.c.dim('every command')} ${ui.c.bold('comprism help')}`);
222
- out();
223
- }
@@ -1,5 +0,0 @@
1
- import type { ProjectFacts } from "../machine/folder/project";
2
- /** The folder a `--worktree` job runs in, creating the worktree the first time.
3
- * Null after saying why, when it cannot be made. */
4
- export declare function ensureWorktree(facts: ProjectFacts, name: string, session: string): Promise<string | null>;
5
- export declare function cmdWorktrees(args: string[]): Promise<number>;
@@ -1,186 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ensureWorktree = ensureWorktree;
37
- exports.cmdWorktrees = cmdWorktrees;
38
- /**
39
- * Separate copies of the repository (manual 2.11): `comprism work --worktree`,
40
- * `comprism worktrees`, `open` and `remove`.
41
- *
42
- * This machine runs Git, because the repository is here. The service records
43
- * each worktree the tool creates, decides what may be removed, and writes what
44
- * a person reads. This file refuses on its own as well, immediately before
45
- * removing anything, so losing work needs both to agree.
46
- */
47
- const node_child_process_1 = require("node:child_process");
48
- const fs = __importStar(require("node:fs"));
49
- const path = __importStar(require("node:path"));
50
- const project_ops_1 = require("../lib/project-ops");
51
- const ui = __importStar(require("../lib/ui"));
52
- const out = (s = "") => process.stdout.write(s + "\n");
53
- /** Git with an argument list, never a shell string. Throws on failure. */
54
- function git(args, cwd) {
55
- return (0, node_child_process_1.execFileSync)("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
56
- }
57
- function hasBranch(root, branch) {
58
- try {
59
- git(["rev-parse", "--verify", "--quiet", `refs/heads/${branch}`], root);
60
- return true;
61
- }
62
- catch {
63
- return false;
64
- }
65
- }
66
- /** The worktree folder goes in the repository's own ignore list, once. */
67
- function exclude(root, line) {
68
- const common = git(["rev-parse", "--git-common-dir"], root).trim();
69
- const file = path.join(path.resolve(root, common), "info", "exclude");
70
- fs.mkdirSync(path.dirname(file), { recursive: true });
71
- const now = fs.existsSync(file) ? fs.readFileSync(file, "utf8") : "";
72
- if (!now.split(/\r?\n/).includes(line)) {
73
- fs.appendFileSync(file, `${now && !now.endsWith("\n") ? "\n" : ""}${line}\n`);
74
- }
75
- }
76
- /** The folder a `--worktree` job runs in, creating the worktree the first time.
77
- * Null after saying why, when it cannot be made. */
78
- async function ensureWorktree(facts, name, session) {
79
- try {
80
- git(["rev-parse", "--git-dir"], facts.root);
81
- }
82
- catch {
83
- out(ui.fail("A worktree needs a Git repository. This folder is not one."));
84
- return null;
85
- }
86
- const plan = await (0, project_ops_1.call)("worktrees", "plan", { name }, facts, true);
87
- if (!plan)
88
- return null;
89
- const { branch, path: where, exclude: line, exists } = plan.data;
90
- const local = path.resolve(where);
91
- if (exists && fs.existsSync(local)) {
92
- out(ui.c.dim(` using worktree ${name} at ${local}`));
93
- return local;
94
- }
95
- try {
96
- exclude(facts.root, line);
97
- git(["worktree", "add", ...(hasBranch(facts.root, branch) ? [local, branch] : ["-b", branch, local])], facts.root);
98
- }
99
- catch (err) {
100
- out(ui.fail(`Git could not create the worktree: ${String(err.stderr || err).trim()}`));
101
- return null;
102
- }
103
- const recorded = await (0, project_ops_1.call)("worktrees", "record", { name, branch, path: local, session }, facts);
104
- return recorded ? local : null;
105
- }
106
- async function remove(facts, name, discard) {
107
- const listed = await (0, project_ops_1.call)("worktrees", "open", { name }, facts, true);
108
- if (!listed)
109
- return 1;
110
- const where = String(listed.data?.path ?? "");
111
- const branch = `comprism/${name}`;
112
- let dirty = [];
113
- let onlyHere = 0;
114
- if (fs.existsSync(where)) {
115
- dirty = git(["status", "--porcelain"], where).split(/\r?\n/).filter(Boolean).map((l) => l.slice(3));
116
- }
117
- if (hasBranch(facts.root, branch)) {
118
- // Commits on this branch and on no other. The other branches are named one
119
- // by one: `--exclude` with `--not --branches` silently counts nothing.
120
- const others = git(["for-each-ref", "--format=%(refname)", "refs/heads"], facts.root)
121
- .split(/\r?\n/).filter((r) => r && r !== `refs/heads/${branch}`);
122
- const commits = git(["rev-list", `refs/heads/${branch}`, "--not", ...others], facts.root);
123
- onlyHere = commits.split(/\r?\n/).filter(Boolean).length;
124
- }
125
- let confirmed = false;
126
- if (discard) {
127
- if (!process.stdin.isTTY) {
128
- out(ui.fail(`--discard needs you to type the worktree's name, ${name}, at a terminal.`));
129
- return 1;
130
- }
131
- const { ask, closePrompt } = await Promise.resolve().then(() => __importStar(require("../lib/prompt")));
132
- confirmed = (await ask(` type ${name} to discard it and anything only it holds: `)).trim() === name;
133
- closePrompt();
134
- }
135
- const verdict = await (0, project_ops_1.call)("worktrees", "check_remove", { name, dirty, only_here: onlyHere, discard, confirmed }, facts, true);
136
- if (!verdict)
137
- return 1;
138
- // This machine's own check, immediately before acting: never lose work that
139
- // was not explicitly discarded by name.
140
- if (dirty.length && !(discard && confirmed)) {
141
- out(ui.fail(`${name} has uncommitted changes, so it was not removed.`));
142
- return 1;
143
- }
144
- const d = verdict.data;
145
- try {
146
- if (fs.existsSync(d.remove))
147
- git(["worktree", "remove", ...(d.force ? ["--force"] : []), d.remove], facts.root);
148
- else
149
- git(["worktree", "prune"], facts.root);
150
- if (d.delete_branch && hasBranch(facts.root, d.branch))
151
- git(["branch", "-D", d.branch], facts.root);
152
- }
153
- catch (err) {
154
- out(ui.fail(`Git could not remove it: ${String(err.stderr || err).trim()}`));
155
- return 1;
156
- }
157
- await (0, project_ops_1.call)("worktrees", "forget", { name }, facts, true);
158
- for (const line of verdict.lines ?? [])
159
- out(line);
160
- return 0;
161
- }
162
- async function cmdWorktrees(args) {
163
- const facts = await (0, project_ops_1.currentProject)();
164
- const [verb, name] = args.filter((a) => !a.startsWith("--"));
165
- if (!verb) {
166
- const all = await (0, project_ops_1.call)("worktrees", "list", {}, facts, true);
167
- if (!all)
168
- return 1;
169
- const rows = all.data?.worktrees ?? [];
170
- const present = rows.filter((r) => fs.existsSync(r.path)).map((r) => r.name);
171
- out();
172
- await (0, project_ops_1.call)("worktrees", "list", { present }, facts);
173
- out();
174
- return 0;
175
- }
176
- if ((verb === "open" || verb === "remove") && !name) {
177
- out(ui.fail(`Say which worktree: comprism worktrees ${verb} <name>`));
178
- return 2;
179
- }
180
- if (verb === "open")
181
- return (await (0, project_ops_1.call)("worktrees", "open", { name }, facts)) ? 0 : 1;
182
- if (verb === "remove")
183
- return remove(facts, name, args.includes("--discard"));
184
- out(ui.fail(`\`worktrees ${verb}\` is not a command. Use open or remove.`));
185
- return 2;
186
- }
@@ -1,14 +0,0 @@
1
- import type { RunResult } from "./shell";
2
- /** The browser program on this machine, or null. `COMPRISM_BROWSER` wins. */
3
- export declare function findBrowser(): string | null;
4
- /** The actions this machine can offer, only when a browser is installed. */
5
- export declare const BROWSER_ACTIONS: string[];
6
- /** The browser for one job, started on first use and closed with the job. */
7
- export declare class Browser {
8
- private readonly root;
9
- private session;
10
- constructor(root: string);
11
- private page;
12
- perform(name: string, a: Record<string, unknown>): Promise<RunResult>;
13
- close(): void;
14
- }
@@ -1,2 +0,0 @@
1
- import { RunResult, ShellOptions } from "./shell";
2
- export declare function readDiagnostics(root: string, rel: string | undefined, severity: string | undefined, opts: ShellOptions): Promise<RunResult>;
@@ -1,40 +0,0 @@
1
- /**
2
- * Applying a patch, and reading a PDF.
3
- *
4
- * Specification: docs/modules/CODING_AGENT_BUILD_SPECIFICATION.md, register
5
- * items D15 (apply a patch) and D3 (read a PDF).
6
- *
7
- * Both exist for the same reason: the thing the agent needs is already in a
8
- * format somebody else chose. A patch arrives from a review or a bug report, and
9
- * a specification arrives as a PDF because that is how standards bodies publish.
10
- * Neither is worth re-typing into a form we prefer.
11
- */
12
- import { RunResult, ShellOptions } from "./shell";
13
- /**
14
- * Apply a unified diff.
15
- *
16
- * Through `git apply` rather than a parser of our own. Patch formats have
17
- * decades of edge cases in them - renames, mode changes, binary hunks, fuzzy
18
- * context - and a hand-rolled applier gets the common case right and the
19
- * interesting ones wrong, silently, in somebody's repository.
20
- *
21
- * **Checked before it is applied.** `--check` runs the whole thing and changes
22
- * nothing, so a patch that does not fit is refused whole rather than leaving
23
- * half of itself behind. That is the same property `edit_file` has and for the
24
- * same reason: a file left half changed is worse than one not changed, because
25
- * the model believes the whole change landed.
26
- */
27
- export declare function applyPatch(patch: string, opts: ShellOptions): Promise<RunResult>;
28
- /**
29
- * Read a PDF as text.
30
- *
31
- * Through whichever extractor the machine has, in order of how good the output
32
- * is: `pdftotext` keeps the layout, `mutool` is close, and Python's pypdf is
33
- * usually present on a machine that has Python at all. If none of them is
34
- * there, it says so and names one to install rather than returning nothing.
35
- *
36
- * A PDF full of scanned images produces no text, and that is reported as what it
37
- * is. Silently returning an empty document would have the model conclude the
38
- * specification is blank.
39
- */
40
- export declare function readPdf(root: string, rel: string, pages: string | undefined, opts: ShellOptions): Promise<RunResult>;
@@ -1,2 +0,0 @@
1
- import { RunResult } from "./shell";
2
- export declare function performFileAction(root: string, name: string, a: Record<string, unknown>): RunResult;
@@ -1,48 +0,0 @@
1
- /**
2
- * Reading the repository, and recording work in it.
3
- *
4
- * Specification: docs/modules/CODING_AGENT_BUILD_SPECIFICATION.md, register
5
- * items D23 to D27.
6
- *
7
- * **Pushing is the only thing here that sends anything anywhere**, and it is
8
- * the only one the server has to have allowed first. Pull requests, reviews,
9
- * checks and releases are not git operations at all: they go through GitHub's
10
- * own API, on the server, because they need the tenant's credential and that
11
- * must never be sent to a client.
12
- *
13
- * So the split is by what each thing needs. A push needs the repository, which
14
- * is here. A pull request needs the credential, which is there.
15
- *
16
- * Every command goes through `runCommand`, so the folder boundary, the trimmed
17
- * environment, the timeout and the output cap all apply here too rather than
18
- * being reimplemented for git.
19
- */
20
- import { RunResult, ShellOptions } from "./shell";
21
- export declare function gitStatus(opts: ShellOptions): Promise<RunResult>;
22
- export declare function gitDiff(opts: ShellOptions & {
23
- path?: string;
24
- staged?: boolean;
25
- }): Promise<RunResult>;
26
- export declare function gitLog(opts: ShellOptions & {
27
- path?: string;
28
- limit?: number;
29
- }): Promise<RunResult>;
30
- export declare function gitBranch(name: string, opts: ShellOptions): Promise<RunResult>;
31
- export declare function gitCommit(message: string, opts: ShellOptions & {
32
- paths?: string[];
33
- }): Promise<RunResult>;
34
- /** Send commits to the remote.
35
- *
36
- * Reached only after the server has allowed it: the branch is one the person
37
- * named for this repository, it is not a branch the project is built from, and
38
- * they have just confirmed it. This function does not re-decide any of that,
39
- * and it must not: a client that could decide whether it may publish is a
40
- * client that could grant itself permission.
41
- *
42
- * **There is no force push and there is no upstream rewrite.** Not as an
43
- * option, not behind a flag. Everything on the remote stays recoverable by
44
- * whoever is working from it.
45
- */
46
- export declare function gitPush(branch: string, opts: ShellOptions & {
47
- createRemote?: boolean;
48
- }): Promise<RunResult>;
@@ -1,51 +0,0 @@
1
- /** The settings files that can hold hooks, sent as read for `comprism hooks`. */
2
- export declare const FILES: string[];
3
- /** One hook as the service hands it over. */
4
- export interface PlannedHook {
5
- when: string;
6
- on?: string;
7
- command: string;
8
- what?: string | null;
9
- timeout_s?: number;
10
- source?: string;
11
- }
12
- /** The hooks to run around one action, in order. */
13
- export interface HookPlan {
14
- before?: PlannedHook[];
15
- after?: PlannedHook[];
16
- }
17
- /** Set inside a hook's own commands, so nothing they do runs hooks again. */
18
- export declare const IN_HOOK = "COMPRISM_IN_HOOK";
19
- export declare function insideHook(): boolean;
20
- /** The settings files present in this project, as text, for the service. */
21
- export declare function hookFiles(root: string): Record<string, string>;
22
- export interface HookContext {
23
- when: string;
24
- action?: string;
25
- args?: Record<string, unknown>;
26
- facts?: Record<string, unknown>;
27
- }
28
- export interface HookRun {
29
- hook: PlannedHook;
30
- ok: boolean;
31
- timedOut: boolean;
32
- output: string;
33
- }
34
- export interface HooksOutcome {
35
- runs: HookRun[];
36
- /** Set when a `before` hook refused the action. */
37
- refusedBy?: string;
38
- detail?: string;
39
- /** `after`, `job_start`, `job_end` and `waiting` hooks that failed. */
40
- failed: string[];
41
- }
42
- /**
43
- * Run the hooks the service named, one after another, in its order.
44
- *
45
- * Details go in as `COMPRISM_` variables and as one JSON object on standard
46
- * input. Each hook has its own time limit (30 seconds unless the service said
47
- * otherwise) and is stopped and reported when it runs over.
48
- */
49
- export declare function runHooks(root: string, hooks: PlannedHook[], ctx: HookContext): Promise<HooksOutcome>;
50
- /** One line per hook that ran, for the full view and `hooks test` (10.10). */
51
- export declare function reportLines(outcome: HooksOutcome): string[];
@@ -1,45 +0,0 @@
1
- import * as hooks from "./hooks";
2
- import { ToolServers } from "./toolservers";
3
- import { RunResult, guessTestCommand, stopEverything, stopForeground } from "./shell";
4
- export { stopEverything, stopForeground, guessTestCommand };
5
- export type { RunResult };
6
- /** Everything a machine with a shell can do. Sent to the server on hello, and
7
- * the catalog offered to the model is narrowed to it, so a client is never
8
- * told about an action it cannot perform. */
9
- export declare const NATIVE_CAPABILITIES: string[];
10
- export interface ExecutorOptions {
11
- root: string;
12
- /** Folders the person added for this job (manual 2.3). */
13
- added?: string[];
14
- /** Called with each chunk of a running command's output, so a terminal can
15
- * show it as it happens rather than in one block at the end. */
16
- onOutput?: (chunk: string) => void;
17
- }
18
- export declare class NativeExecutor {
19
- /** What this machine can do. The browser actions only where a browser is
20
- * installed (manual 10.16); the service offers them only when switched on. */
21
- readonly capabilities: string[];
22
- /** The job's browser, started on first use (10.16). */
23
- private browser?;
24
- /** Close what this job opened on the machine: its browser. */
25
- close(): void;
26
- readonly root: string;
27
- private readonly onOutput?;
28
- /** The test command, once it has been worked out or supplied. Remembered so a
29
- * job that had to be told does not have to be told again. */
30
- private testCommand?;
31
- /** Whether the last test run passed. The grading signal the whole product
32
- * rests on, kept so a session can report it when the job ends. */
33
- lastTestsPassed?: boolean;
34
- /** The operating system's sandbox, set when the service turns it on for a
35
- * job (manual 4.12). Absent, commands run with the person's own access. */
36
- sandbox?: import("./sandbox").Sandbox;
37
- constructor(opts: ExecutorOptions);
38
- /** One executor per helper copy, rooted there and nowhere else. */
39
- private readonly inCopies;
40
- /** Tool servers this job started (manual 9.10), stopped when it ends. */
41
- readonly toolServers: ToolServers;
42
- execute(name: string, a: Record<string, unknown>, plan?: hooks.HookPlan): Promise<RunResult>;
43
- private browse;
44
- private perform;
45
- }
@@ -1,2 +0,0 @@
1
- import { RunResult } from "./shell";
2
- export declare function readNotebook(root: string, path: string, includeOutput?: boolean): RunResult;
@@ -1,20 +0,0 @@
1
- export declare class OutsideWorkspace extends Error {
2
- readonly attempted: string;
3
- /** `real` is where the path actually leads, when that differs from what was
4
- * asked for: a link is refused by naming its real location (manual 2.4). */
5
- constructor(attempted: string, real?: string);
6
- }
7
- export declare function allowFolders(root: string, added: string[]): void;
8
- /** Every folder a job in `root` may touch, the project first. */
9
- export declare function allowedFolders(root: string): string[];
10
- export declare function isSecret(p: string): boolean;
11
- /**
12
- * An absolute path inside the workspace, or a refusal.
13
- *
14
- * `mustExist` is false when the caller is about to CREATE the thing. A file that
15
- * does not exist yet cannot be resolved, so the check is applied to the deepest
16
- * parent that does exist: creating `src/new/deep/file.ts` is inside the project
17
- * exactly when `src` is, and demanding the leaf exist first would make it
18
- * impossible to write a new file at all.
19
- */
20
- export declare function resolveInside(root: string, rel: string, mustExist?: boolean): string;