@illuminis/comprism 0.1.5 → 0.1.7

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 (107) hide show
  1. package/out/agent/command.js +4 -4
  2. package/out/agent/render.d.ts +24 -0
  3. package/out/agent/render.js +35 -3
  4. package/out/agent/session.d.ts +6 -1
  5. package/out/agent/session.js +17 -8
  6. package/out/commands/agents.js +3 -3
  7. package/out/commands/ask.js +8 -8
  8. package/out/commands/codemap.d.ts +1 -1
  9. package/out/commands/codemap.js +3 -3
  10. package/out/commands/commands-thin.js +4 -4
  11. package/out/commands/config.js +1 -1
  12. package/out/commands/cost.js +4 -4
  13. package/out/commands/decisionEngine.d.ts +1 -0
  14. package/out/commands/decisionEngine.js +66 -0
  15. package/out/commands/hooks.js +1 -1
  16. package/out/commands/install.d.ts +1 -1
  17. package/out/commands/install.js +3 -2
  18. package/out/commands/instructions.js +1 -1
  19. package/out/commands/integrations.js +4 -4
  20. package/out/commands/keys.js +6 -6
  21. package/out/commands/login.js +37 -21
  22. package/out/commands/permissions.js +2 -2
  23. package/out/commands/plugins.js +3 -3
  24. package/out/commands/privacy.js +2 -2
  25. package/out/commands/repl.js +107 -83
  26. package/out/commands/review.js +6 -6
  27. package/out/commands/settings.js +30 -123
  28. package/out/commands/skills.js +2 -2
  29. package/out/commands/unattended.js +6 -6
  30. package/out/commands/update.js +1 -1
  31. package/out/commands/welcome.js +20 -29
  32. package/out/commands/worktrees.d.ts +1 -1
  33. package/out/graph/sync.d.ts +1 -1
  34. package/out/graph/sync.js +6 -6
  35. package/out/lib/attach.js +4 -3
  36. package/out/lib/commandlist.d.ts +1 -1
  37. package/out/lib/commandlist.js +2 -2
  38. package/out/lib/config.d.ts +3 -2
  39. package/out/lib/config.js +7 -8
  40. package/out/lib/connection.js +1 -1
  41. package/out/lib/gateway.d.ts +5 -5
  42. package/out/lib/machine.js +1 -1
  43. package/out/lib/project-ops.d.ts +1 -1
  44. package/out/lib/project-ops.js +4 -4
  45. package/out/lib/queue.js +1 -1
  46. package/out/lib/readiness.d.ts +3 -30
  47. package/out/lib/readiness.js +13 -82
  48. package/out/lib/servicecommand.d.ts +14 -0
  49. package/out/lib/servicecommand.js +74 -0
  50. package/out/lib/sessions.js +3 -3
  51. package/out/lib/ui.d.ts +9 -6
  52. package/out/lib/ui.js +20 -26
  53. package/out/lib/voice.d.ts +2 -39
  54. package/out/lib/voice.js +7 -148
  55. package/out/lib/words.d.ts +20 -0
  56. package/out/lib/words.js +27 -0
  57. package/out/machine/codemap/build.d.ts +45 -0
  58. package/out/machine/codemap/build.js +91 -0
  59. package/out/machine/codemap/facts.d.ts +47 -0
  60. package/out/machine/codemap/facts.js +12 -0
  61. package/out/machine/codemap/files.d.ts +45 -0
  62. package/out/machine/codemap/files.js +207 -0
  63. package/out/machine/codemap/read-locales.d.ts +29 -0
  64. package/out/machine/codemap/read-locales.js +246 -0
  65. package/out/machine/codemap/read-python.d.ts +11 -0
  66. package/out/machine/codemap/read-python.js +116 -0
  67. package/out/machine/codemap/read-typescript.d.ts +16 -0
  68. package/out/machine/codemap/read-typescript.js +292 -0
  69. package/out/machine/executor/browser.d.ts +14 -0
  70. package/out/machine/executor/browser.js +270 -0
  71. package/out/machine/executor/diagnostics.d.ts +2 -0
  72. package/out/machine/executor/diagnostics.js +181 -0
  73. package/out/machine/executor/documents.d.ts +40 -0
  74. package/out/machine/executor/documents.js +170 -0
  75. package/out/machine/executor/files.d.ts +2 -0
  76. package/out/machine/executor/files.js +590 -0
  77. package/out/machine/executor/git.d.ts +48 -0
  78. package/out/machine/executor/git.js +145 -0
  79. package/out/machine/executor/hooks.d.ts +51 -0
  80. package/out/machine/executor/hooks.js +154 -0
  81. package/out/machine/executor/index.d.ts +45 -0
  82. package/out/machine/executor/index.js +367 -0
  83. package/out/machine/executor/notebook.d.ts +2 -0
  84. package/out/machine/executor/notebook.js +147 -0
  85. package/out/machine/executor/paths.d.ts +20 -0
  86. package/out/machine/executor/paths.js +154 -0
  87. package/out/machine/executor/sandbox.d.ts +40 -0
  88. package/out/machine/executor/sandbox.js +299 -0
  89. package/out/machine/executor/shell.d.ts +86 -0
  90. package/out/machine/executor/shell.js +582 -0
  91. package/out/machine/executor/toolservers.d.ts +20 -0
  92. package/out/machine/executor/toolservers.js +189 -0
  93. package/out/machine/executor/worktree.d.ts +9 -0
  94. package/out/machine/executor/worktree.js +119 -0
  95. package/out/machine/folder/project.d.ts +28 -0
  96. package/out/machine/folder/project.js +114 -0
  97. package/out/machine/runtime/home.d.ts +2 -0
  98. package/out/machine/runtime/home.js +48 -0
  99. package/out/machine/runtime/needs.d.ts +30 -0
  100. package/out/machine/runtime/needs.js +89 -0
  101. package/out/machine/runtime/self.d.ts +23 -0
  102. package/out/machine/runtime/self.js +124 -0
  103. package/out/machine/voice/record.d.ts +38 -0
  104. package/out/machine/voice/record.js +208 -0
  105. package/out/providers/index.js +2 -1
  106. package/out/thin.js +18 -10
  107. package/package.json +4 -4
@@ -56,11 +56,11 @@ exports.runAgent = runAgent;
56
56
  const fs = __importStar(require("fs"));
57
57
  const readline = __importStar(require("readline"));
58
58
  const connection_1 = require("../lib/connection");
59
- const project_1 = require("../lib/project");
59
+ const project_1 = require("../machine/folder/project");
60
60
  const session_1 = require("./session");
61
61
  const ui = __importStar(require("./render"));
62
62
  const output_1 = require("../lib/output");
63
- const self_1 = require("../lib/self");
63
+ const self_1 = require("../machine/runtime/self");
64
64
  /** The WebSocket the session needs is a global from Node 22.
65
65
  *
66
66
  * Checked here with a message somebody can act on. Without it the failure is
@@ -219,7 +219,7 @@ async function runAgent(args) {
219
219
  // `--sandbox` never runs without one (manual 4.12): refused before anything
220
220
  // runs or is charged.
221
221
  if (args.sandbox) {
222
- const { availability } = await Promise.resolve().then(() => __importStar(require("../executor/sandbox")));
222
+ const { availability } = await Promise.resolve().then(() => __importStar(require("../machine/executor/sandbox")));
223
223
  const found = availability();
224
224
  if (!found.system) {
225
225
  process.stderr.write(ui.red(` --sandbox cannot start: ${found.why}.`)
@@ -414,7 +414,7 @@ ${ui.bold("comprism work")} — a coding agent in your terminal
414
414
  comprism work "add a test for the parser and make it pass"
415
415
 
416
416
  ${ui.bold("What it does")}
417
- Reads your project, changes files, runs commands and runs your tests. It
417
+ Reads your workspace, changes files, runs commands and runs your tests. It
418
418
  shows you every change as it makes it, asks before deleting a file or
419
419
  running a command, and can undo the whole job. Each step is routed to whichever
420
420
  model finishes the work for least, and the receipt at the end says what it
@@ -113,6 +113,30 @@ export interface ReceiptCard {
113
113
  details?: string | null;
114
114
  badge: string | null;
115
115
  warning: string | null;
116
+ /** Where the saving came from, worded by the server for every client. */
117
+ savings?: ReceiptSavings | null;
118
+ /** The decision engine's itemized cost, named by the server (web manual 11.4). */
119
+ engine?: {
120
+ label: string;
121
+ name: string;
122
+ value: string;
123
+ line: string;
124
+ } | null;
125
+ }
126
+ /** The receipt's savings table: headings, one row per cost factor, the total. */
127
+ export interface ReceiptSavings {
128
+ columns: string[];
129
+ rows: Array<{
130
+ key: string;
131
+ label: string;
132
+ user: string;
133
+ chosen: string;
134
+ saving: string;
135
+ }>;
136
+ total: {
137
+ label: string;
138
+ value: string;
139
+ };
116
140
  }
117
141
  /**
118
142
  * The receipt under a finished job.
@@ -238,8 +238,10 @@ function ending(line, detail) {
238
238
  }
239
239
  /** How the job ended, in the words a person reads. */
240
240
  function outcome(o, detail) {
241
+ // A clean finish prints no word: the answer above says what was done.
242
+ if (o === "finished")
243
+ return detail ? `\n${(0, exports.dim)(detail)}\n` : "";
241
244
  const word = {
242
- finished: (0, exports.green)("Done"),
243
245
  cancelled: (0, exports.yellow)("Stopped"),
244
246
  step_limit: (0, exports.yellow)("Stopped after too many steps"),
245
247
  spend_limit: (0, exports.yellow)("Stopped at the spending limit"),
@@ -276,6 +278,33 @@ function savedFile(name, fullPath, bytes) {
276
278
  return `${(0, exports.green)(" saved ")}${link(name, href)}${(0, exports.dim)(` ${bytes} bytes`)}\n`
277
279
  + `${(0, exports.gray)(` ${fullPath}`)}\n`;
278
280
  }
281
+ /**
282
+ * The savings table as aligned columns: names left, money right, the saving
283
+ * column bright and the rest quiet. Every word and figure is the server's.
284
+ * Too narrow for the headings, it keeps the rows and drops the heading line
285
+ * rather than cutting a word.
286
+ */
287
+ function savingsRows(savings, room) {
288
+ if (!savings || !savings.rows.length)
289
+ return [];
290
+ const body = savings.rows.map((r) => [r.label, r.user, r.chosen, r.saving]);
291
+ const [c0 = "", c1 = "", c2 = "", c3 = ""] = savings.columns;
292
+ const heading = [c0, c1, c2, c3];
293
+ const fit = (rows) => [0, 1, 2, 3].map((i) => " ".repeat(Math.max(...rows.map((r) => r[i].length))));
294
+ let w = fit([...body, heading]).map((x) => x.length);
295
+ const head = w.reduce((a, b) => a + b, 0) + 6 <= room;
296
+ if (!head)
297
+ w = fit(body).map((x) => x.length);
298
+ const [w0 = 0, w1 = 0, w2 = 0, w3 = 0] = w;
299
+ const left = (r) => `${r[0].padEnd(w0)} ${r[1].padStart(w1)} ${r[2].padStart(w2)}`;
300
+ const out = [""];
301
+ if (head)
302
+ out.push((0, exports.dim)(`${left(heading)} ${heading[3].padStart(w3)}`));
303
+ for (const r of body)
304
+ out.push(`${(0, exports.dim)(left(r))} ${(0, exports.bold)(r[3].padStart(w3))}`);
305
+ out.push((0, exports.bold)(`${savings.total.label.padEnd(w0 + w1 + w2 + 4)} ${savings.total.value.padStart(w3)}`));
306
+ return out;
307
+ }
279
308
  /** The card's two lines, as the approved look draws them. */
280
309
  function cardRows(card) {
281
310
  const rows = [];
@@ -285,6 +314,8 @@ function cardRows(card) {
285
314
  rows.push(head);
286
315
  if (card.amount)
287
316
  rows.push(card.saved ? (0, exports.bold)((0, exports.green)(card.amount)) : (0, exports.dim)(card.amount));
317
+ if (card.engine)
318
+ rows.push((0, exports.dim)(card.engine.line));
288
319
  if (card.warning)
289
320
  rows.push((0, exports.dim)(card.warning));
290
321
  return rows;
@@ -306,7 +337,8 @@ function cardRows(card) {
306
337
  * formatting, which belongs to the client, and it is the only part that does.
307
338
  */
308
339
  function receipt(text, models = [], testsPassed, card) {
309
- const lines = card ? cardRows(card).map((r) => ` ${r}`) : [];
340
+ const lines = card
341
+ ? [...cardRows(card), ...savingsRows(card.savings, width() - 4)].map((r) => ` ${r}`) : [];
310
342
  for (const line of card ? [] : String(text || "").split("\n")) {
311
343
  if (!line.trim())
312
344
  continue;
@@ -370,7 +402,7 @@ function wrap(text, room) {
370
402
  function boxed(text, models, testsPassed, card) {
371
403
  // Room for the border, the padding and the `receipt` label on the first line.
372
404
  const inner = width() - 16;
373
- const rows = card ? cardRows(card) : [];
405
+ const rows = card ? [...cardRows(card), ...savingsRows(card.savings, inner)] : [];
374
406
  const links = [];
375
407
  for (const raw of String(text || "").split("\n")) {
376
408
  if (card) {
@@ -1,4 +1,4 @@
1
- import { type ProjectFacts } from "../lib/project";
1
+ import { type ProjectFacts } from "../machine/folder/project";
2
2
  import * as ui from "./render";
3
3
  export interface SessionOptions {
4
4
  /** Where the workspace lives, and the URL of the server that owns it. */
@@ -106,7 +106,12 @@ export interface SessionOptions {
106
106
  /** `--output stream`: handed the service's stream lines as they arrive. */
107
107
  onStream?: (items: Array<Record<string, unknown>>) => void;
108
108
  }
109
+ /** How many next steps the last job offered (web manual 13.4), so a bare number
110
+ * typed next is sent to the service to run one rather than to the agent. */
111
+ export declare let waitingNextSteps: number;
109
112
  export interface JobResult {
113
+ /** The service's lines for the next steps it offered, printed as sent. */
114
+ nextSteps?: string[];
110
115
  outcome: string;
111
116
  detail?: string | null;
112
117
  jobId?: string;
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.TerminalSession = void 0;
36
+ exports.TerminalSession = exports.waitingNextSteps = void 0;
37
37
  /**
38
38
  * A coding job, run from a terminal.
39
39
  *
@@ -63,12 +63,15 @@ const gateway_1 = require("../lib/gateway");
63
63
  const fs = __importStar(require("fs"));
64
64
  const path = __importStar(require("path"));
65
65
  const readline = __importStar(require("readline"));
66
- const executor_1 = require("../executor");
67
- const project_1 = require("../lib/project");
66
+ const executor_1 = require("../machine/executor");
67
+ const project_1 = require("../machine/folder/project");
68
68
  const ui = __importStar(require("./render"));
69
69
  const jobs_1 = require("../commands/jobs");
70
70
  /** The actions that change a file, whose change is shown as it is made. */
71
71
  const CHANGES = new Set(["edit_file", "multi_edit", "write_file"]);
72
+ /** How many next steps the last job offered (web manual 13.4), so a bare number
73
+ * typed next is sent to the service to run one rather than to the agent. */
74
+ exports.waitingNextSteps = 0;
72
75
  /** Files with changes in Git as the job starts: the person's, not the agent's. */
73
76
  function dirtyFiles(root) {
74
77
  try {
@@ -158,7 +161,7 @@ class TerminalSession {
158
161
  // A real refusal, in the service's own words: a plan that does not
159
162
  // include coding and an allowance that has been spent have different
160
163
  // fixes, and a caller told only "refused" looks in the wrong place.
161
- this.refusal = reply.message || "your workspace could not be reached";
164
+ this.refusal = reply.message || "your organization could not be reached";
162
165
  // The reason word, for the exit number (Appendix B): the service's own
163
166
  // when it answered, else what the missing answer means.
164
167
  this.refusalReason = reply.reason
@@ -313,7 +316,7 @@ class TerminalSession {
313
316
  // long pause for a feature they did not ask for, to save money on a
314
317
  // job they have not started. So the job runs now, reading files the
315
318
  // ordinary way, and the second job in this project has the map.
316
- this.out(ui.dim(" reading a map of this project in the background;"
319
+ this.out(ui.dim(" reading a map of this workspace in the background;"
317
320
  + " your next job here will use it\n"));
318
321
  void refresh(this.opts.root, this.project()).catch(() => undefined);
319
322
  }
@@ -568,7 +571,7 @@ class TerminalSession {
568
571
  if (frame.type === "event" && frame.kind === "sandbox") {
569
572
  // The service turned the sandbox on for this job: every command from
570
573
  // here runs inside it, with its allowed addresses (manual 4.12).
571
- const { Sandbox } = await Promise.resolve().then(() => __importStar(require("../executor/sandbox")));
574
+ const { Sandbox } = await Promise.resolve().then(() => __importStar(require("../machine/executor/sandbox")));
572
575
  const system = this.sandboxSystem();
573
576
  if (system) {
574
577
  const box = new Sandbox(system, this.opts.root, this.opts.project?.added ?? []);
@@ -639,6 +642,9 @@ class TerminalSession {
639
642
  // cost and saving comes from here.
640
643
  result.receipt = String(frame.receipt ?? "");
641
644
  result.card = frame.card ?? null;
645
+ result.nextSteps = Array.isArray(frame.next_steps_lines)
646
+ ? frame.next_steps_lines.map(String) : [];
647
+ exports.waitingNextSteps = Array.isArray(frame.next_steps) ? frame.next_steps.length : 0;
642
648
  result.reusedPct = ui.reusePct(0, frame.cached_tokens, Math.max(0, Number(frame.context_tokens ?? 0) - Number(frame.cached_tokens ?? 0)));
643
649
  result.text = String(frame.text ?? "");
644
650
  result.why = this.lastWhy;
@@ -696,7 +702,7 @@ class TerminalSession {
696
702
  // is the live connection that carries the work, and the wording names
697
703
  // that instead.
698
704
  if (!ready && first) {
699
- reject(new Error("The live connection to your workspace could not be opened. "
705
+ reject(new Error("The live connection to your organization could not be opened. "
700
706
  + "You are signed in; the work stream is what failed."));
701
707
  }
702
708
  };
@@ -871,7 +877,7 @@ class TerminalSession {
871
877
  sandboxSystem() {
872
878
  if (this.sandboxChecked === undefined) {
873
879
  // eslint-disable-next-line @typescript-eslint/no-var-requires
874
- const { availability } = require("../executor/sandbox");
880
+ const { availability } = require("../machine/executor/sandbox");
875
881
  this.sandboxChecked = availability().system;
876
882
  }
877
883
  return (this.sandboxChecked ?? null);
@@ -1204,6 +1210,9 @@ class TerminalSession {
1204
1210
  this.out(ui.dim(` ${line}\n`));
1205
1211
  this.out(ui.receipt(r.receipt, r.models, r.ending ? undefined : r.testsPassed, r.card));
1206
1212
  }
1213
+ // What would finish the request, worded by the service (web manual 13.4).
1214
+ for (const line of r.nextSteps ?? [])
1215
+ this.out(`${line}\n`);
1207
1216
  if (r.jobId) {
1208
1217
  // The job's own reference, so a person can quote it. The link to the
1209
1218
  // account sits in the receipt above, where the server put it.
@@ -41,8 +41,8 @@ exports.cmdAgents = cmdAgents;
41
41
  * wins a clash and what each line says; this reads the files it names, inside
42
42
  * the project and through the executor's own checks, and prints its lines.
43
43
  */
44
- const files_1 = require("../executor/files");
45
- const project_1 = require("../lib/project");
44
+ const files_1 = require("../machine/executor/files");
45
+ const project_1 = require("../machine/folder/project");
46
46
  const gateway_1 = require("../lib/gateway");
47
47
  const ui = __importStar(require("../lib/ui"));
48
48
  const ROUNDS = 6;
@@ -54,7 +54,7 @@ async function helperLines(folder) {
54
54
  const reply = await (0, gateway_1.ask)({ intent: "agents", prompt: "", agentsPayload: { round, files, listings, project: root } });
55
55
  const body = reply.agents;
56
56
  if (!reply.ok || reply.served === false || !body) {
57
- return [ui.fail(reply.message || "The helper list could not be read from your workspace.")];
57
+ return [ui.fail(reply.message || "The helper list could not be read from your organization.")];
58
58
  }
59
59
  if (!body.wants)
60
60
  return body.lines;
@@ -48,7 +48,6 @@ exports.cmdAsk = cmdAsk;
48
48
  */
49
49
  const gateway_1 = require("../lib/gateway");
50
50
  const connection_1 = require("../lib/connection");
51
- const config_1 = require("../lib/config");
52
51
  const ui = __importStar(require("../lib/ui"));
53
52
  const render_1 = require("../agent/render");
54
53
  const prompt_1 = require("../lib/prompt");
@@ -87,12 +86,13 @@ async function cmdAsk(args) {
87
86
  // remember what they set last week is asking them to take the figure on
88
87
  // trust. Shown every time, so the number that comes back is never a surprise.
89
88
  const flagged = args.indexOf('--model');
90
- const comparedTo = (flagged >= 0 ? args[flagged + 1] : undefined)
91
- || (0, config_1.loadConfig)().defaultModel
92
- || 'claude-sonnet-5';
93
- out(ui.c.dim(` comparing against ${ui.c.bold(comparedTo)}`)
94
- + ui.c.dim(' change it with `comprism model`'));
95
- out();
89
+ // Named on the line, or else the person's own comparison model, which the
90
+ // service fills in and names in its reply (service catalog 14).
91
+ const comparedTo = flagged >= 0 ? args[flagged + 1] : undefined;
92
+ if (comparedTo) {
93
+ out(ui.c.dim(` comparing against ${ui.c.bold(comparedTo)}`));
94
+ out();
95
+ }
96
96
  // Either way round: on the line for somebody who knows what they want, or
97
97
  // asked for when they simply typed the command.
98
98
  // Text piped in is read to its end first and attached as `standard input`:
@@ -202,7 +202,7 @@ async function cmdAsk(args) {
202
202
  const verb = saved !== null && saved !== undefined && saved < 0 ? 'more' : 'less';
203
203
  const amount = money(Math.abs(saved ?? 0));
204
204
  out(` ran on ${ui.c.bold(ran)} ${ours} to finish`);
205
- out(` ${ui.c.dim(`on ${callingModel} it would have been ${theirs}, so ${amount} ${verb}`)}`);
205
+ out(` ${ui.c.dim(`on ${reply.decision.would_have_used || callingModel} it would have been ${theirs}, so ${amount} ${verb}`)}`);
206
206
  }
207
207
  else {
208
208
  out(` ran on ${ui.c.bold(ran)}`);
@@ -1,2 +1,2 @@
1
- export declare const MAP_HELP = "\n comprism map what the map of this project holds\n comprism map refresh read every file again, now\n comprism map forget remove this project's map from the service\n comprism map off ask your administrator to switch it off\n\n The map is a record of what your project is made of: its functions, screens,\n endpoints and tables, and what connects to what. It is read on this machine\n and only its structure is sent. Your source code never leaves here.\n\n It is kept current by itself. Every job checks the files first and reads back\n whatever moved, so you should not normally need any of this.\n";
1
+ export declare const MAP_HELP = "\n comprism map what the map of this workspace holds\n comprism map refresh read every file again, now\n comprism map forget remove this workspace's map from the service\n comprism map off ask your administrator to switch it off\n\n The map is a record of what your workspace is made of: its functions, screens,\n endpoints and tables, and what connects to what. It is read on this machine\n and only its structure is sent. Your source code never leaves here.\n\n It is kept current by itself. Every job checks the files first and reads back\n whatever moved, so you should not normally need any of this.\n";
2
2
  export declare function cmdMap(args: string[]): Promise<number>;
@@ -55,12 +55,12 @@ const sync_1 = require("../graph/sync");
55
55
  const settings_1 = require("./settings");
56
56
  const out = (s = "") => process.stdout.write(`${s}\n`);
57
57
  exports.MAP_HELP = `
58
- comprism map what the map of this project holds
58
+ comprism map what the map of this workspace holds
59
59
  comprism map refresh read every file again, now
60
- comprism map forget remove this project's map from the service
60
+ comprism map forget remove this workspace's map from the service
61
61
  comprism map off ask your administrator to switch it off
62
62
 
63
- The map is a record of what your project is made of: its functions, screens,
63
+ The map is a record of what your workspace is made of: its functions, screens,
64
64
  endpoints and tables, and what connects to what. It is read on this machine
65
65
  and only its structure is sent. Your source code never leaves here.
66
66
 
@@ -178,14 +178,14 @@ async function cmdStatus() {
178
178
  process.exitCode = 3;
179
179
  }
180
180
  else if (reply.httpStatus) {
181
- out(ui.fail('The workspace could not confirm this account.'));
181
+ out(ui.fail('The organization could not confirm this account.'));
182
182
  out(` ${ui.c.dim(reply.message || 'the service refused the request')}`);
183
183
  process.exitCode = 1;
184
184
  }
185
185
  else {
186
186
  // Only what this machine knows, and said to be only that (manual 1.4).
187
187
  out(ui.fail(`This machine is pointed at ${ui.c.bold(c.url)}, which did not answer.`));
188
- out(` ${ui.c.dim(reply.message || 'no answer from the workspace')}`);
188
+ out(` ${ui.c.dim(reply.message || 'no answer from the organization')}`);
189
189
  out(` ${ui.c.dim('on this machine only:')} ${machineLine(c)}`);
190
190
  process.exitCode = 6;
191
191
  }
@@ -194,12 +194,12 @@ async function cmdStatus() {
194
194
  }
195
195
  if (reply.served === false) {
196
196
  out(ui.warn(`${ui.c.bold(c.url)} answered, but is running a build that cannot report a session.`));
197
- out(ui.c.dim(reply.message || 'Ask your workspace administrator to update the service.'));
197
+ out(ui.c.dim(reply.message || 'Ask your organization administrator to update the service.'));
198
198
  process.exitCode = 1;
199
199
  return;
200
200
  }
201
201
  if (reply.granted === false || !me?.signed_in) {
202
- out(ui.fail(reply.message || 'The workspace did not confirm a signed in account.'));
202
+ out(ui.fail(reply.message || 'The organization did not confirm a signed in account.'));
203
203
  out(' Run comprism login to sign in.');
204
204
  process.exitCode = 3;
205
205
  return;
@@ -67,7 +67,7 @@ async function service(op, payload) {
67
67
  const out = (s = '') => process.stdout.write(s + '\n');
68
68
  function notHere(key) {
69
69
  out(ui.fail(`\`${key}\` is not a setting for this machine, so nothing was changed.`));
70
- out(ui.c.dim(` This machine keeps: ${Object.keys(machine_1.MACHINE_KEYS).join(', ')}. Project and personal settings are kept by the service (manual 2.10).`));
70
+ out(ui.c.dim(` This machine keeps: ${Object.keys(machine_1.MACHINE_KEYS).join(', ')}. Workspace and personal settings are kept by the service (manual 2.10).`));
71
71
  out();
72
72
  return 1;
73
73
  }
@@ -87,7 +87,7 @@ async function cmdCost(args) {
87
87
  // would tell somebody their work cost nothing.
88
88
  if (reply.served === false) {
89
89
  out();
90
- out(ui.warn('This workspace is running a build that cannot answer this yet.'));
90
+ out(ui.warn('This organization is running a build that cannot answer this yet.'));
91
91
  out(` ${ui.c.dim(reply.message || '')}`);
92
92
  out();
93
93
  return 1;
@@ -95,7 +95,7 @@ async function cmdCost(args) {
95
95
  const report = reply.spend;
96
96
  if (!report || !report.session) {
97
97
  out();
98
- out(ui.info(reply.message || 'No work has been recorded in this workspace yet.'));
98
+ out(ui.info(reply.message || 'No work has been recorded in this organization yet.'));
99
99
  out();
100
100
  return 0;
101
101
  }
@@ -105,8 +105,8 @@ async function cmdCost(args) {
105
105
  const p = report.presentation;
106
106
  if (!p) {
107
107
  out();
108
- out(ui.warn('This workspace answered without the breakdown this version draws.'));
109
- out(` ${ui.c.dim('Deploy the workspace, or run `comprism status` to see which one you are on.')}`);
108
+ out(ui.warn('This organization answered without the breakdown this version draws.'));
109
+ out(` ${ui.c.dim('Deploy the organization, or run `comprism status` to see which one you are on.')}`);
110
110
  out();
111
111
  return 1;
112
112
  }
@@ -0,0 +1 @@
1
+ export declare function cmdDecisionEngine(args: string[]): Promise<number>;
@@ -0,0 +1,66 @@
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.cmdDecisionEngine = cmdDecisionEngine;
37
+ /**
38
+ * `comprism decision-engine [none | <engine>]` (web manual 11.4): whether your
39
+ * work uses the decision engine your company has turned on. With no argument it
40
+ * shows your pick; with one it changes it. The service keeps the pick and words
41
+ * every line, so this matches the drop-down in Work and in VS Code.
42
+ */
43
+ const gateway_1 = require("../lib/gateway");
44
+ const ui = __importStar(require("../lib/ui"));
45
+ const out = (s = "") => process.stdout.write(s + "\n");
46
+ async function cmdDecisionEngine(args) {
47
+ const choice = args[0];
48
+ const reply = await (0, gateway_1.ask)({
49
+ intent: "decision_engine", prompt: "",
50
+ op: choice ? "set" : "show",
51
+ ...(choice ? { payload: { engine: choice === "none" ? null : choice } } : {}),
52
+ });
53
+ if (!reply.ok || reply.served === false) {
54
+ out(ui.fail(reply.served === false
55
+ ? "Your organization is running an older build that does not answer this yet."
56
+ : `Your organization could not be reached: ${reply.message || "no answer"}`));
57
+ return 1;
58
+ }
59
+ out();
60
+ if (reply.message)
61
+ out(ui.fail(reply.message));
62
+ for (const line of reply.lines ?? [])
63
+ out(line);
64
+ out();
65
+ return reply.message ? 1 : 0;
66
+ }
@@ -43,7 +43,7 @@ exports.cmdHooks = cmdHooks;
43
43
  */
44
44
  const ui = __importStar(require("../lib/ui"));
45
45
  const project_ops_1 = require("../lib/project-ops");
46
- const hooks_1 = require("../executor/hooks");
46
+ const hooks_1 = require("../machine/executor/hooks");
47
47
  const out = (s = "") => process.stdout.write(`${s}\n`);
48
48
  async function cmdHooks(args) {
49
49
  const facts = await (0, project_ops_1.currentProject)();
@@ -1,4 +1,4 @@
1
- import { type InstallMethod } from '../lib/self';
1
+ import { type InstallMethod } from '../machine/runtime/self';
2
2
  /** The header the tenant reads to decide whether this machine may be served. */
3
3
  export declare const WORKSPACE_KEY_HEADER = "x-comprism-key";
4
4
  export declare function envScriptPath(): string;
@@ -78,7 +78,8 @@ const node_path_1 = __importDefault(require("node:path"));
78
78
  const node_child_process_1 = require("node:child_process");
79
79
  const config_1 = require("../lib/config");
80
80
  const connection_1 = require("../lib/connection");
81
- const self_1 = require("../lib/self");
81
+ const self_1 = require("../machine/runtime/self");
82
+ const words_1 = require("../lib/words");
82
83
  /** The header the tenant reads to decide whether this machine may be served. */
83
84
  exports.WORKSPACE_KEY_HEADER = 'x-comprism-key';
84
85
  const MARKER_START = '# >>> comprism >>>';
@@ -391,7 +392,7 @@ async function probeDesktopConnector(binary) {
391
392
  catch (err) {
392
393
  resolve({
393
394
  ok: false,
394
- detail: err instanceof Error ? err.message : 'the connector could not be started',
395
+ detail: err instanceof Error ? err.message : (0, words_1.word)('connectorNotStarted'),
395
396
  });
396
397
  return;
397
398
  }
@@ -80,7 +80,7 @@ async function cmdInstructions(args) {
80
80
  const facts = await (0, project_ops_1.currentProject)();
81
81
  if (args[0] === "edit") {
82
82
  if (!args.includes("--personal")) {
83
- out(ui.fail("Project instructions are files in the project; edit them there. "
83
+ out(ui.fail("Workspace instructions are files in the workspace; edit them there. "
84
84
  + "For yours: comprism instructions edit --personal"));
85
85
  return 2;
86
86
  }
@@ -41,7 +41,7 @@ exports.projectSettings = projectSettings;
41
41
  * adding one by address or by command, signing in, its tools, removing one.
42
42
  *
43
43
  * The service decides every status, tool, rule and word. This sends the
44
- * project's settings file so the project's own connections are known, writes
44
+ * project's settings file so the workspace's own connections are known, writes
45
45
  * the key the service returns for a project connection, starts an approved
46
46
  * local tool server only long enough to count its tools, opens the browser
47
47
  * for a sign in and waits for it. No token ever reaches this machine.
@@ -49,10 +49,10 @@ exports.projectSettings = projectSettings;
49
49
  const child_process_1 = require("child_process");
50
50
  const fs = __importStar(require("fs"));
51
51
  const path = __importStar(require("path"));
52
- const toolservers_1 = require("../executor/toolservers");
52
+ const toolservers_1 = require("../machine/executor/toolservers");
53
53
  const gateway_1 = require("../lib/gateway");
54
54
  const project_ops_1 = require("../lib/project-ops");
55
- const project_1 = require("../lib/project");
55
+ const project_1 = require("../machine/folder/project");
56
56
  const ui = __importStar(require("../lib/ui"));
57
57
  const SETTINGS = ".completionprism/settings.json";
58
58
  const out = (s = "") => process.stdout.write(`${s}\n`);
@@ -77,7 +77,7 @@ async function call(root, payload) {
77
77
  body = reply.integrations;
78
78
  }
79
79
  if (!reply.ok || reply.served === false || !body) {
80
- out(` ${ui.fail(reply.message || "Your connections could not be read from your workspace.")}`);
80
+ out(` ${ui.fail(reply.message || "Your connections could not be read from your organization.")}`);
81
81
  return null;
82
82
  }
83
83
  if (body.error) {
@@ -104,17 +104,17 @@ async function keyState() {
104
104
  // then this client's placeholder, and reading an empty `providers` as "no
105
105
  // keys" is precisely the fault above.
106
106
  if (!reply.ok)
107
- return { reached: false, why: reply.message || 'the workspace could not be reached' };
107
+ return { reached: false, why: reply.message || 'the organization could not be reached' };
108
108
  // An older workspace that does not serve this question has also not told us
109
109
  // there are no keys. It has told us it cannot answer.
110
110
  if (reply.served === false)
111
- return { reached: false, why: reply.message || 'this workspace is running an older build' };
111
+ return { reached: false, why: reply.message || 'this organization is running an older build' };
112
112
  // The workspace answered but could not establish part of what it answered.
113
113
  // An empty vendor list here is a list we failed to obtain, not a list of
114
114
  // nothing, and drawing it as "you have no keys" is the original fault with
115
115
  // one more layer in front of it.
116
116
  if (reply.complete === false)
117
- return { reached: false, why: reply.message || 'your workspace could not check its vendor keys' };
117
+ return { reached: false, why: reply.message || 'your organization could not check its vendor keys' };
118
118
  return { reached: true, hasKey: reply.providers.some((p) => p.has_key) };
119
119
  }
120
120
  /**
@@ -182,15 +182,15 @@ async function show() {
182
182
  if (!reply.ok || reply.served === false || reply.complete === false) {
183
183
  // NOT "you have no keys". We did not get an answer, so nothing is known
184
184
  // about this account, and saying otherwise is the 17 September fault.
185
- out(ui.fail('Your workspace could not be reached, so nothing is known about your keys.'));
186
- out(` ${ui.c.dim(reply.message || reply.decision.rationale || 'no answer from the workspace')}`);
185
+ out(ui.fail('Your organization could not be reached, so nothing is known about your keys.'));
186
+ out(` ${ui.c.dim(reply.message || reply.decision.rationale || 'no answer from the organization')}`);
187
187
  out();
188
188
  return { reached: false, stored: 0, total: 0 };
189
189
  }
190
190
  if (reply.providers.length === 0) {
191
191
  // A workspace with no vendors at all is not a workspace that told us it
192
192
  // holds no keys. Treated as unreachable so no caller offers to take one.
193
- out(ui.fail('Your workspace returned no vendors, so nothing is known about your keys.'));
193
+ out(ui.fail('Your organization returned no vendors, so nothing is known about your keys.'));
194
194
  out(` ${ui.c.dim(reply.message || 'the vendor list came back empty')}`);
195
195
  out();
196
196
  return { reached: false, stored: 0, total: 0 };