@illuminis/comprism 0.1.8 → 2.4.1

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 +130 -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
package/out/lib/prompt.js DELETED
@@ -1,142 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.closePrompt = closePrompt;
7
- exports.ask = ask;
8
- exports.askOrCancel = askOrCancel;
9
- exports.askHidden = askHidden;
10
- exports.freeText = freeText;
11
- exports.subject = subject;
12
- /**
13
- * Asking a person for something, in a terminal.
14
- *
15
- * One reader, opened on demand and closed at the end of the command. Readline
16
- * reads ahead, so a fresh reader per question throws away whatever was already
17
- * typed, which silently lost the second answer of two.
18
- */
19
- const node_readline_1 = __importDefault(require("node:readline"));
20
- let reader = null;
21
- function open() {
22
- if (!reader) {
23
- reader = node_readline_1.default.createInterface({
24
- input: process.stdin,
25
- output: process.stdout,
26
- terminal: process.stdin.isTTY === true,
27
- });
28
- // Ctrl+C closes it. The next question then opens a new one instead of
29
- // asking a closed reader, which threw and ended the whole program.
30
- const mine = reader;
31
- mine.once('close', () => { if (reader === mine)
32
- reader = null; });
33
- }
34
- return reader;
35
- }
36
- /** Close it on every path, or the command holds the terminal and looks hung. */
37
- function closePrompt() {
38
- reader?.close();
39
- reader = null;
40
- }
41
- /** Ask a question and wait for the answer. */
42
- function ask(prompt) {
43
- return new Promise((resolve) => {
44
- const r = open();
45
- // Standard input closed before a line arrived: nothing was said. Without
46
- // this the process simply ran out of work and exited 0, so a script that
47
- // piped in nothing was told it had succeeded (manual Appendix B).
48
- // Input that had already ended before this reader opened never says so
49
- // again, so the last chance is the moment nothing else is left to wait on.
50
- const closed = () => resolve('');
51
- r.once('close', closed);
52
- process.once('beforeExit', closed);
53
- r.question(prompt, (answer) => {
54
- r.off('close', closed);
55
- process.off('beforeExit', closed);
56
- resolve(answer.trim());
57
- });
58
- });
59
- }
60
- /** Ask, telling a cancel (Ctrl+C, input closed) apart from an empty answer:
61
- * null is "never mind", "" is Enter. */
62
- function askOrCancel(prompt) {
63
- return new Promise((resolve) => {
64
- const r = open();
65
- const closed = () => resolve(null);
66
- r.once('close', closed);
67
- r.question(prompt, (answer) => {
68
- r.off('close', closed);
69
- resolve(answer.trim());
70
- });
71
- });
72
- }
73
- /**
74
- * Ask for a secret, and do not put it on the screen.
75
- *
76
- * ── Why the first two attempts failed, and what is different ──────────────
77
- *
78
- * Both earlier tries SUPPRESSED what readline wanted to print. Readline does
79
- * not print characters one at a time; on every keystroke it redraws the whole
80
- * line, prompt included. Swallowing that output therefore swallowed the
81
- * question and the cursor with it, and left a person on a blank line unable to
82
- * tell whether the program was even listening.
83
- *
84
- * So this does not suppress the redraw, it PERFORMS it: the prompt is written
85
- * back out followed by one dot per character actually held in the line. Paste
86
- * and backspace come out right for free, because the dots are counted from the
87
- * line itself rather than tallied from keystrokes.
88
- *
89
- * With no terminal attached there is nothing to redraw and nothing to hide
90
- * from, so the plain question is used. That is the piped case, where the only
91
- * reader is a script.
92
- */
93
- function askHidden(prompt) {
94
- const reader = open();
95
- if (process.stdin.isTTY !== true)
96
- return ask(prompt);
97
- const inner = reader;
98
- const asItWas = inner._writeToOutput.bind(reader);
99
- inner._writeToOutput = (chunk) => {
100
- // A newline is the answer being accepted, and it still has to happen.
101
- if (chunk.includes("\n") || chunk.includes("\r")) {
102
- asItWas(chunk);
103
- return;
104
- }
105
- process.stdout.write(`\r${prompt}${"\u2022".repeat(inner.line.length)}`);
106
- };
107
- return new Promise((resolve) => {
108
- // Ctrl+C at the password is "never mind", answered as nothing, never a crash.
109
- reader.once('close', () => { inner._writeToOutput = asItWas; resolve(''); });
110
- reader.question(prompt, (answer) => {
111
- // Put readline back the way it was, whatever happened, or every later
112
- // question on this reader would come out as dots.
113
- inner._writeToOutput = asItWas;
114
- process.stdout.write("\n");
115
- resolve(answer);
116
- });
117
- });
118
- }
119
- /**
120
- * Everything on the line that is not a flag or a flag's value.
121
- *
122
- * A person types `comprism ask fix the failing test`, not
123
- * `comprism ask --request "fix the failing test"`.
124
- */
125
- function freeText(args, flagsTakingValue) {
126
- return args
127
- .filter((a, i) => {
128
- if (a.startsWith('--'))
129
- return false;
130
- const prev = args[i - 1];
131
- return !(prev && flagsTakingValue.includes(prev));
132
- })
133
- .join(' ')
134
- .trim();
135
- }
136
- /** The subject of a command: taken from the line, or asked for. */
137
- async function subject(args, prompt, flagsTakingValue = []) {
138
- const onTheLine = freeText(args, flagsTakingValue);
139
- if (onTheLine)
140
- return onTheLine;
141
- return ask(prompt);
142
- }
@@ -1,13 +0,0 @@
1
- import { type GatewayReply } from "./gateway";
2
- export declare function queue(op: string, payload?: Record<string, unknown>): Promise<GatewayReply>;
3
- /** The limits and mode typed on the line, for the service to hold (10.17). */
4
- export declare function limitsFrom(args: string[]): Record<string, unknown>;
5
- export declare const workerLog: () => string;
6
- /** Whether this machine's runner is going, and its process number. */
7
- export declare function workerRunning(): number | null;
8
- export declare function notePid(): void;
9
- /** Start the runner in the background when it is not running. */
10
- export declare function ensureWorker(): {
11
- pid: number;
12
- started: boolean;
13
- };
package/out/lib/queue.js DELETED
@@ -1,116 +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.workerLog = void 0;
37
- exports.queue = queue;
38
- exports.limitsFrom = limitsFrom;
39
- exports.workerRunning = workerRunning;
40
- exports.notePid = notePid;
41
- exports.ensureWorker = ensureWorker;
42
- /**
43
- * Jobs nobody is sitting at, from this side (manual 10.17 to 10.19).
44
- *
45
- * The service holds the schedules, the triggers and the queue, and decides what
46
- * is due and what may run where. This file asks it, and keeps one runner going
47
- * on this machine to take what the service offers.
48
- */
49
- const fs = __importStar(require("fs"));
50
- const path = __importStar(require("path"));
51
- const child_process_1 = require("child_process");
52
- const gateway_1 = require("./gateway");
53
- const config_1 = require("./config");
54
- const self_1 = require("../machine/runtime/self");
55
- async function queue(op, payload = {}) {
56
- return (0, gateway_1.ask)({
57
- intent: "queue", prompt: "", op,
58
- payload: { tz_minutes: -new Date().getTimezoneOffset(), ...payload },
59
- });
60
- }
61
- /** The limits and mode typed on the line, for the service to hold (10.17). */
62
- function limitsFrom(args) {
63
- const value = (name) => {
64
- const at = args.indexOf(name);
65
- return at === -1 ? undefined : args[at + 1];
66
- };
67
- const out = {};
68
- if (value("--mode"))
69
- out.mode = value("--mode");
70
- if (value("--max-spend"))
71
- out.max_spend = Number(value("--max-spend"));
72
- if (value("--max-steps"))
73
- out.max_steps = Number(value("--max-steps"));
74
- if (value("--max-minutes"))
75
- out.max_minutes = Number(value("--max-minutes"));
76
- return out;
77
- }
78
- const pidFile = () => path.join((0, config_1.homeDir)(), "worker.pid");
79
- const workerLog = () => path.join((0, config_1.homeDir)(), "worker.log");
80
- exports.workerLog = workerLog;
81
- function alive(pid) {
82
- try {
83
- process.kill(pid, 0);
84
- return true;
85
- }
86
- catch {
87
- return false;
88
- }
89
- }
90
- /** Whether this machine's runner is going, and its process number. */
91
- function workerRunning() {
92
- try {
93
- const pid = Number(fs.readFileSync(pidFile(), "utf8").trim());
94
- return pid && alive(pid) ? pid : null;
95
- }
96
- catch {
97
- return null;
98
- }
99
- }
100
- function notePid() {
101
- fs.mkdirSync((0, config_1.homeDir)(), { recursive: true });
102
- fs.writeFileSync(pidFile(), String(process.pid));
103
- }
104
- /** Start the runner in the background when it is not running. */
105
- function ensureWorker() {
106
- const running = workerRunning();
107
- if (running)
108
- return { pid: running, started: false };
109
- fs.mkdirSync((0, config_1.homeDir)(), { recursive: true });
110
- const log = fs.openSync((0, exports.workerLog)(), "a");
111
- const child = (0, child_process_1.spawn)(...(0, self_1.selfLaunch)(["worker"]), {
112
- detached: true, stdio: ["ignore", log, log], env: { ...process.env, NO_COLOR: "1" },
113
- });
114
- child.unref();
115
- return { pid: child.pid ?? 0, started: true };
116
- }
@@ -1,22 +0,0 @@
1
- import { REQUIREMENTS, check, howToInstall, present } from '../machine/runtime/needs';
2
- export type { Readiness, Requirement } from '../machine/runtime/needs';
3
- export { REQUIREMENTS, check, howToInstall, present };
4
- /** One checked item: its line, whether it is required, and the fix. */
5
- export interface Finding {
6
- ok: boolean;
7
- required: boolean;
8
- line: string;
9
- fix?: string;
10
- }
11
- /** The system this is, in the words its owner would use. */
12
- export declare function systemName(): string;
13
- /**
14
- * Everything `comprism check` reports (manual 1.6).
15
- *
16
- * Required: Node 22 or newer (built in for the install script and Python
17
- * installs), a sign in, and a service that answers. Anything
18
- * else is optional and never makes the check fail. Whether the service still
19
- * accepts this machine is asked of the service itself, on the same session
20
- * operation `status` uses, so the two can never disagree.
21
- */
22
- export declare function diagnose(): Promise<Finding[]>;
@@ -1,207 +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
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.present = exports.howToInstall = exports.check = exports.REQUIREMENTS = void 0;
40
- exports.systemName = systemName;
41
- exports.diagnose = diagnose;
42
- /**
43
- * What this machine needs before the work can be done on it, and what to type
44
- * when something is missing.
45
- *
46
- * ── Why this is short, and why that is the right answer ───────────────────
47
- *
48
- * Almost everything people expect to need here is not needed at all, because it
49
- * happens on our servers. A Word document, a slide deck and a PDF are BUILT
50
- * there and arrive as bytes; the tool only writes them to disk. Nothing on a
51
- * customer's machine has to know what a .docx is.
52
- *
53
- * What genuinely has to be local is the work that touches their own files:
54
- *
55
- * - `git`, so a repository can be read, branched and committed.
56
- * - A PDF reader, so a specification they already have can be read back.
57
- *
58
- * That is the whole list, and it stays that way deliberately. Every program
59
- * added here is one more thing that can be absent, the wrong version, or
60
- * refused by somebody's security team.
61
- *
62
- * ── Why the install does not simply install them ──────────────────────────
63
- *
64
- * It would have to install system software, unasked, from a package manager, as
65
- * a side effect of `npm install`. Any security team that found that would ban
66
- * the product, and rightly: a tool that quietly runs a system installer on a
67
- * laptop is indistinguishable from one that does something worse. So this
68
- * reports and gives the exact command, and the person runs it. One line to copy
69
- * is not friction worth trading a customer's trust for.
70
- */
71
- const node_child_process_1 = require("node:child_process");
72
- const needs_1 = require("../machine/runtime/needs");
73
- Object.defineProperty(exports, "REQUIREMENTS", { enumerable: true, get: function () { return needs_1.REQUIREMENTS; } });
74
- Object.defineProperty(exports, "check", { enumerable: true, get: function () { return needs_1.check; } });
75
- Object.defineProperty(exports, "howToInstall", { enumerable: true, get: function () { return needs_1.howToInstall; } });
76
- Object.defineProperty(exports, "present", { enumerable: true, get: function () { return needs_1.present; } });
77
- const node_os_1 = __importDefault(require("node:os"));
78
- const install_1 = require("../commands/install");
79
- const connection_1 = require("./connection");
80
- const gateway_1 = require("./gateway");
81
- const node_fs_1 = __importDefault(require("node:fs"));
82
- /** The system this is, in the words its owner would use. */
83
- function systemName() {
84
- try {
85
- if (node_os_1.default.platform() === 'darwin') {
86
- const v = (0, node_child_process_1.execFileSync)('sw_vers', ['-productVersion'], { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
87
- return `macOS ${v} ${node_os_1.default.arch()}`;
88
- }
89
- if (node_os_1.default.platform() === 'linux') {
90
- const release = node_fs_1.default.readFileSync('/etc/os-release', 'utf8').match(/^PRETTY_NAME="?([^"\n]+)"?/m);
91
- return `${release ? release[1] : 'Linux'} ${node_os_1.default.arch()}`;
92
- }
93
- if (node_os_1.default.platform() === 'win32')
94
- return `${node_os_1.default.version()} ${node_os_1.default.arch()}`;
95
- }
96
- catch { /* fall through to the plain name */ }
97
- return `${node_os_1.default.type()} ${node_os_1.default.release()} ${node_os_1.default.arch()}`;
98
- }
99
- function version(program, args) {
100
- try {
101
- const text = (0, node_child_process_1.execFileSync)(program, args, { stdio: ['ignore', 'pipe', 'ignore'] }).toString();
102
- return text.match(/\d+\.\d+(\.\d+)?/)?.[0] ?? '';
103
- }
104
- catch {
105
- return null;
106
- }
107
- }
108
- /**
109
- * Everything `comprism check` reports (manual 1.6).
110
- *
111
- * Required: Node 22 or newer (built in for the install script and Python
112
- * installs), a sign in, and a service that answers. Anything
113
- * else is optional and never makes the check fail. Whether the service still
114
- * accepts this machine is asked of the service itself, on the same session
115
- * operation `status` uses, so the two can never disagree.
116
- */
117
- async function diagnose() {
118
- const found = [];
119
- found.push({ ok: true, required: false, line: systemName() });
120
- // Which proxy and certificate file are in use (manual 1.11).
121
- const proxy = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
122
- if (proxy) {
123
- const bypass = process.env.NO_PROXY || process.env.no_proxy;
124
- found.push({ ok: true, required: false, line: `proxy ${proxy.replace(/\/\/[^@/]*@/, '//***@')}`
125
- + (bypass ? `, not used for ${bypass}` : '') });
126
- }
127
- const caFile = process.env.NODE_EXTRA_CA_CERTS;
128
- if (caFile) {
129
- const fs = await Promise.resolve().then(() => __importStar(require('fs')));
130
- found.push(fs.existsSync(caFile)
131
- ? { ok: true, required: false, line: `extra certificate authorities from ${caFile}` }
132
- : { ok: false, required: true, line: `NODE_EXTRA_CA_CERTS names ${caFile}, which does not exist`,
133
- fix: 'point NODE_EXTRA_CA_CERTS at your company certificate authority file' });
134
- }
135
- const node = process.versions.node;
136
- const major = Number(node.split('.')[0]);
137
- // The install script and Python installs carry their own Node (manual 1.1),
138
- // so the line says so rather than asking for a Node nobody installed.
139
- const { installMethod, isStandalone } = await Promise.resolve().then(() => __importStar(require('../machine/runtime/self')));
140
- if (isStandalone()) {
141
- const how = installMethod() === 'script' ? 'the install script' : 'Python (pip)';
142
- found.push({ ok: true, required: true, line: `installed with ${how}; Node ${node} is built in, nothing else needed` });
143
- }
144
- else
145
- found.push(major >= 22
146
- ? { ok: true, required: true, line: `Node ${node} (22 or newer needed)` }
147
- : { ok: false, required: true, line: `Node ${node} is too old: 22 or newer needed`,
148
- fix: 'install Node 22 or newer from https://nodejs.org' });
149
- const connection = (0, connection_1.readConnection)();
150
- if (!connection?.url || !connection.workspaceKey) {
151
- found.push({ ok: false, required: true, line: 'not signed in', fix: 'comprism login' });
152
- }
153
- else {
154
- const started = Date.now();
155
- const reply = await (0, gateway_1.ask)({ intent: 'session', prompt: '' });
156
- const ms = Date.now() - started;
157
- if (!reply.ok && !reply.httpStatus && /certificate problem/.test(reply.message || '')) {
158
- found.push({ ok: false, required: true, line: `service at ${connection.url}: ${reply.message}`,
159
- fix: 'set NODE_EXTRA_CA_CERTS to your company certificate authority file' });
160
- }
161
- else if (!reply.ok && !reply.httpStatus) {
162
- found.push({ ok: false, required: true, line: `service at ${connection.url} did not answer`,
163
- fix: 'check your network, then comprism status' });
164
- }
165
- else if (reply.httpStatus === 401 || (reply.ok && reply.session && !reply.session.signed_in)) {
166
- found.push({ ok: false, required: true, line: "signed out: this machine's key was revoked or has expired",
167
- fix: 'comprism login' });
168
- found.push({ ok: true, required: true, line: `service reachable in ${ms} ms` });
169
- }
170
- else {
171
- found.push({ ok: true, required: true,
172
- line: `signed in to ${reply.session?.company || connection.url}` });
173
- found.push({ ok: true, required: true, line: `service reachable in ${ms} ms` });
174
- }
175
- }
176
- const { powershellProfiles } = await Promise.resolve().then(() => __importStar(require('../commands/install')));
177
- const profile = [...powershellProfiles(), ...(0, install_1.shellProfiles)()].find(install_1.profileHasSetup);
178
- const home = node_os_1.default.homedir();
179
- if (profile) {
180
- found.push({ ok: true, required: false,
181
- line: `shell profile line present in ${profile.startsWith(home) ? `~${profile.slice(home.length)}` : profile}` });
182
- }
183
- else if (node_os_1.default.platform() === 'win32') {
184
- found.push({ ok: false, required: false,
185
- line: 'no PowerShell profile line, so other AI tools here are not measured', fix: 'comprism install' });
186
- }
187
- else {
188
- found.push({ ok: false, required: false, line: 'no shell profile line, so other AI tools here are not measured',
189
- fix: 'comprism install' });
190
- }
191
- const git = version('git', ['--version']);
192
- found.push(git !== null
193
- ? { ok: true, required: false, line: `git ${git}` }
194
- : { ok: false, required: false, line: 'git not found: reading, branching and committing a workspace will not work',
195
- fix: (0, needs_1.howToInstall)(['git']) });
196
- const rg = version('rg', ['--version']);
197
- found.push(rg !== null
198
- ? { ok: true, required: false, line: `ripgrep ${rg}` }
199
- : { ok: false, required: false, line: 'ripgrep not found: searches will be slower',
200
- fix: (0, needs_1.howToInstall)(['ripgrep']) });
201
- const pdf = needs_1.REQUIREMENTS[1];
202
- found.push(pdf.anyOf.some(needs_1.present)
203
- ? { ok: true, required: false, line: 'a PDF reader' }
204
- : { ok: false, required: false, line: `no PDF reader: ${pdf.without} will not work`,
205
- fix: (0, needs_1.howToInstall)(['pdftotext']) });
206
- return found;
207
- }
package/out/lib/self.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /** True when running as the ready to run program rather than under Node. */
2
- export declare function isStandalone(): boolean;
3
- /** Where the install script keeps the program: `~/.comprism/bin`. */
4
- export declare function standaloneBinDir(): string;
5
- export type InstallMethod = "script" | "npm" | "python";
6
- /**
7
- * Which of the three install options put this copy here.
8
- *
9
- * The program is only ever distributed two ways, so where it sits decides it:
10
- * in `~/.comprism/bin` it came from the install script, anywhere else pip put
11
- * it. Under Node it came from npm.
12
- */
13
- export declare function installMethod(): InstallMethod;
14
- /** The command and arguments that start another copy of this tool. */
15
- export declare function selfLaunch(args: string[], nodeFlags?: string[]): [string, string[]];
16
- /**
17
- * A file shipped beside the code, as a path on disk.
18
- *
19
- * Under npm it sits in the package. Inside the program it is carried as an
20
- * asset and written once to `~/.comprism/assets`, because the programs it is
21
- * handed to (Python, for the reader script) need a real file.
22
- */
23
- export declare function shippedFile(name: string, packagePath: string): string;
@@ -1,14 +0,0 @@
1
- export interface ServiceAnswer {
2
- /** False when nobody answered; `lines` then holds nothing. */
3
- reached: boolean;
4
- /** Whether the service did what was asked. */
5
- ok: boolean;
6
- lines: string[];
7
- /** The one change to this client's own state the service asked for. */
8
- action: Record<string, string> | null;
9
- message?: string;
10
- }
11
- export declare function runServiceCommand(words: string, facts: {
12
- cwd: string;
13
- current?: string;
14
- }): Promise<ServiceAnswer>;
@@ -1,74 +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.runServiceCommand = runServiceCommand;
37
- /**
38
- * Ask the service to run a command it owns (web manual 13.2 to 13.5): what was
39
- * typed goes up, the service decides what it means and writes every line, and
40
- * this answers its one question only this computer can, whether a folder exists.
41
- *
42
- * Shared by the session and by the commands typed straight at the shell, so a
43
- * service command behaves the same wherever it is typed.
44
- */
45
- const fs = __importStar(require("node:fs"));
46
- const os = __importStar(require("node:os"));
47
- const gateway_1 = require("./gateway");
48
- async function runServiceCommand(words, facts) {
49
- const exists = {};
50
- for (let round = 0; round < 4; round += 1) {
51
- const reply = await (0, gateway_1.ask)({
52
- intent: 'command', prompt: '',
53
- payload: { words, cwd: facts.cwd, home: os.homedir(), current: facts.current ?? '', exists },
54
- });
55
- if (!reply.lines?.length && !reply.data) {
56
- return { reached: false, ok: false, lines: [], action: null, message: reply.message ?? undefined };
57
- }
58
- const data = (reply.data ?? {});
59
- const wanted = data.wants?.exists ?? [];
60
- if (wanted.length) {
61
- for (const p of wanted) {
62
- try {
63
- exists[p] = fs.statSync(p).isDirectory();
64
- }
65
- catch {
66
- exists[p] = false;
67
- }
68
- }
69
- continue;
70
- }
71
- return { reached: true, ok: reply.granted !== false, lines: reply.lines ?? [], action: data.action ?? null };
72
- }
73
- return { reached: false, ok: false, lines: [], action: null };
74
- }
@@ -1,19 +0,0 @@
1
- import type { GatewayReply } from './gateway';
2
- /** Ask the service one sessions question, with where this machine is. */
3
- export declare function sessions(op: 'list' | 'resume' | 'latest' | 'opened' | 'rename' | 'branch' | 'export' | 'by_pr' | 'remote_on' | 'remote_poll' | 'remote_off' | 'lease' | 'read' | 'steering' | 'steer', extra?: Record<string, unknown>, folder?: string): Promise<GatewayReply>;
4
- /** Why a sessions question got no answer, in the service's words when it has them. */
5
- export declare function failure(reply: GatewayReply): string;
6
- /** The exit number for a sessions question that got no answer (Appendix B). */
7
- export declare function exitFor(reply: GatewayReply): number;
8
- /**
9
- * Choose one line with the arrow keys; Enter picks, Esc or Ctrl+C leaves.
10
- * Resolves with the index chosen, or null. Without a terminal it asks for a
11
- * number instead, so a script is never left waiting on keys it cannot send.
12
- */
13
- export declare function pick(lines: string[]): Promise<number | null>;
14
- /**
15
- * `comprism sessions` and its words (manual 8.5 to 8.7, 8.10). Every answer,
16
- * every line and every refusal is the service's; the export is written to
17
- * standard output exactly as it came, so `> session.md` holds the file.
18
- */
19
- export declare function cmdSessions(args: string[]): Promise<number>;