@illuminis/comprism 0.1.5 → 0.1.6

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 (100) hide show
  1. package/out/agent/command.js +4 -4
  2. package/out/agent/session.d.ts +6 -1
  3. package/out/agent/session.js +17 -8
  4. package/out/commands/agents.js +3 -3
  5. package/out/commands/ask.js +8 -8
  6. package/out/commands/codemap.d.ts +1 -1
  7. package/out/commands/codemap.js +3 -3
  8. package/out/commands/commands-thin.js +4 -4
  9. package/out/commands/config.js +1 -1
  10. package/out/commands/cost.js +4 -4
  11. package/out/commands/hooks.js +1 -1
  12. package/out/commands/install.d.ts +1 -1
  13. package/out/commands/install.js +3 -2
  14. package/out/commands/instructions.js +1 -1
  15. package/out/commands/integrations.js +4 -4
  16. package/out/commands/keys.js +6 -6
  17. package/out/commands/login.js +37 -21
  18. package/out/commands/permissions.js +2 -2
  19. package/out/commands/plugins.js +3 -3
  20. package/out/commands/privacy.js +2 -2
  21. package/out/commands/repl.js +107 -83
  22. package/out/commands/review.js +6 -6
  23. package/out/commands/settings.js +30 -123
  24. package/out/commands/skills.js +2 -2
  25. package/out/commands/unattended.js +6 -6
  26. package/out/commands/update.js +1 -1
  27. package/out/commands/welcome.js +20 -29
  28. package/out/commands/worktrees.d.ts +1 -1
  29. package/out/graph/sync.d.ts +1 -1
  30. package/out/graph/sync.js +6 -6
  31. package/out/lib/attach.js +4 -3
  32. package/out/lib/commandlist.d.ts +1 -1
  33. package/out/lib/commandlist.js +2 -2
  34. package/out/lib/config.d.ts +3 -2
  35. package/out/lib/config.js +7 -8
  36. package/out/lib/connection.js +1 -1
  37. package/out/lib/gateway.d.ts +5 -5
  38. package/out/lib/machine.js +1 -1
  39. package/out/lib/project-ops.d.ts +1 -1
  40. package/out/lib/project-ops.js +4 -4
  41. package/out/lib/queue.js +1 -1
  42. package/out/lib/readiness.d.ts +3 -30
  43. package/out/lib/readiness.js +13 -82
  44. package/out/lib/servicecommand.d.ts +14 -0
  45. package/out/lib/servicecommand.js +74 -0
  46. package/out/lib/sessions.js +3 -3
  47. package/out/lib/ui.d.ts +9 -6
  48. package/out/lib/ui.js +20 -26
  49. package/out/lib/voice.js +1 -1
  50. package/out/lib/words.d.ts +20 -0
  51. package/out/lib/words.js +27 -0
  52. package/out/machine/codemap/build.d.ts +45 -0
  53. package/out/machine/codemap/build.js +91 -0
  54. package/out/machine/codemap/facts.d.ts +47 -0
  55. package/out/machine/codemap/facts.js +12 -0
  56. package/out/machine/codemap/files.d.ts +45 -0
  57. package/out/machine/codemap/files.js +207 -0
  58. package/out/machine/codemap/read-locales.d.ts +29 -0
  59. package/out/machine/codemap/read-locales.js +246 -0
  60. package/out/machine/codemap/read-python.d.ts +11 -0
  61. package/out/machine/codemap/read-python.js +116 -0
  62. package/out/machine/codemap/read-typescript.d.ts +16 -0
  63. package/out/machine/codemap/read-typescript.js +292 -0
  64. package/out/machine/executor/browser.d.ts +14 -0
  65. package/out/machine/executor/browser.js +270 -0
  66. package/out/machine/executor/diagnostics.d.ts +2 -0
  67. package/out/machine/executor/diagnostics.js +181 -0
  68. package/out/machine/executor/documents.d.ts +40 -0
  69. package/out/machine/executor/documents.js +170 -0
  70. package/out/machine/executor/files.d.ts +2 -0
  71. package/out/machine/executor/files.js +590 -0
  72. package/out/machine/executor/git.d.ts +48 -0
  73. package/out/machine/executor/git.js +145 -0
  74. package/out/machine/executor/hooks.d.ts +51 -0
  75. package/out/machine/executor/hooks.js +154 -0
  76. package/out/machine/executor/index.d.ts +45 -0
  77. package/out/machine/executor/index.js +367 -0
  78. package/out/machine/executor/notebook.d.ts +2 -0
  79. package/out/machine/executor/notebook.js +147 -0
  80. package/out/machine/executor/paths.d.ts +20 -0
  81. package/out/machine/executor/paths.js +154 -0
  82. package/out/machine/executor/sandbox.d.ts +40 -0
  83. package/out/machine/executor/sandbox.js +299 -0
  84. package/out/machine/executor/shell.d.ts +86 -0
  85. package/out/machine/executor/shell.js +582 -0
  86. package/out/machine/executor/toolservers.d.ts +20 -0
  87. package/out/machine/executor/toolservers.js +189 -0
  88. package/out/machine/executor/worktree.d.ts +9 -0
  89. package/out/machine/executor/worktree.js +119 -0
  90. package/out/machine/folder/project.d.ts +28 -0
  91. package/out/machine/folder/project.js +114 -0
  92. package/out/machine/runtime/home.d.ts +2 -0
  93. package/out/machine/runtime/home.js +48 -0
  94. package/out/machine/runtime/needs.d.ts +30 -0
  95. package/out/machine/runtime/needs.js +89 -0
  96. package/out/machine/runtime/self.d.ts +23 -0
  97. package/out/machine/runtime/self.js +124 -0
  98. package/out/providers/index.js +2 -1
  99. package/out/thin.js +11 -10
  100. package/package.json +4 -4
@@ -0,0 +1,124 @@
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.isStandalone = isStandalone;
37
+ exports.standaloneBinDir = standaloneBinDir;
38
+ exports.installMethod = installMethod;
39
+ exports.selfLaunch = selfLaunch;
40
+ exports.shippedFile = shippedFile;
41
+ /**
42
+ * How this copy of the tool was installed, and how it starts another copy of
43
+ * itself (manual 1.1).
44
+ *
45
+ * The same code ships two ways. Through npm it is a script that Node runs, so
46
+ * `process.argv[1]` is the script and a second copy is `node <script> <args>`.
47
+ * Through the install script and the Python package it is one ready to run
48
+ * program with Node built in, where `process.argv[1]` is the program again and
49
+ * a second copy is just `<program> <args>`. Passing the program's own path as
50
+ * the first argument there would read as a command called "/Users/me/...", so
51
+ * every place that starts a copy of the tool asks here instead of guessing.
52
+ */
53
+ const fs = __importStar(require("fs"));
54
+ const path = __importStar(require("path"));
55
+ const home_1 = require("./home");
56
+ let sea;
57
+ /** True when running as the ready to run program rather than under Node. */
58
+ function isStandalone() {
59
+ if (sea === undefined) {
60
+ try {
61
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
62
+ sea = Boolean(require("node:sea").isSea());
63
+ }
64
+ catch {
65
+ sea = false;
66
+ }
67
+ }
68
+ return sea;
69
+ }
70
+ /** Where the install script keeps the program: `~/.comprism/bin`. */
71
+ function standaloneBinDir() {
72
+ return path.join((0, home_1.homeDir)(), "bin");
73
+ }
74
+ /**
75
+ * Which of the three install options put this copy here.
76
+ *
77
+ * The program is only ever distributed two ways, so where it sits decides it:
78
+ * in `~/.comprism/bin` it came from the install script, anywhere else pip put
79
+ * it. Under Node it came from npm.
80
+ */
81
+ function installMethod() {
82
+ if (!isStandalone())
83
+ return "npm";
84
+ try {
85
+ const here = fs.realpathSync(process.execPath);
86
+ const bin = fs.realpathSync(standaloneBinDir());
87
+ if (path.dirname(here) === bin)
88
+ return "script";
89
+ }
90
+ catch {
91
+ // No `~/.comprism/bin`: not an install script install.
92
+ }
93
+ return "python";
94
+ }
95
+ /** The command and arguments that start another copy of this tool. */
96
+ function selfLaunch(args, nodeFlags = []) {
97
+ if (isStandalone())
98
+ return [process.execPath, args];
99
+ return [process.execPath, [...nodeFlags, process.argv[1] ?? "", ...args]];
100
+ }
101
+ /**
102
+ * A file shipped beside the code, as a path on disk.
103
+ *
104
+ * Under npm it sits in the package. Inside the program it is carried as an
105
+ * asset and written once to `~/.comprism/assets`, because the programs it is
106
+ * handed to (Python, for the reader script) need a real file.
107
+ */
108
+ function shippedFile(name, packagePath) {
109
+ if (!isStandalone())
110
+ return packagePath;
111
+ const target = path.join((0, home_1.homeDir)(), "assets", name);
112
+ try {
113
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
114
+ const text = require("node:sea").getAsset(name, "utf8");
115
+ if (!fs.existsSync(target) || fs.readFileSync(target, "utf8") !== text) {
116
+ fs.mkdirSync(path.dirname(target), { recursive: true });
117
+ fs.writeFileSync(target, text);
118
+ }
119
+ }
120
+ catch {
121
+ // An asset that cannot be written leaves the caller's own fallback in charge.
122
+ }
123
+ return target;
124
+ }
@@ -19,6 +19,7 @@ exports.callModel = callModel;
19
19
  const catalog_1 = require("../internal/catalog");
20
20
  const anthropic_1 = require("./anthropic");
21
21
  const openai_1 = require("./openai");
22
+ const words_1 = require("../lib/words");
22
23
  var anthropic_2 = require("./anthropic");
23
24
  Object.defineProperty(exports, "ProviderHttpError", { enumerable: true, get: function () { return anthropic_2.ProviderHttpError; } });
24
25
  const DEFAULT_MAX_TOKENS = 4096;
@@ -62,7 +63,7 @@ async function callModel(call, keys) {
62
63
  continue;
63
64
  }
64
65
  const latency = err instanceof anthropic_1.ProviderHttpError ? err.latencyMs : 0;
65
- return errorResult(err instanceof Error ? err.message : 'provider call failed', latency);
66
+ return errorResult(err instanceof Error ? err.message : (0, words_1.word)('providerCallFailed'), latency);
66
67
  }
67
68
  }
68
69
  return errorResult('provider call failed', 0);
package/out/thin.js CHANGED
@@ -56,7 +56,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
56
56
  */
57
57
  const ui = __importStar(require("./lib/ui"));
58
58
  const version_1 = require("./lib/version");
59
- const self_1 = require("./lib/self");
59
+ const self_1 = require("./machine/runtime/self");
60
+ const words_1 = require("./lib/words");
60
61
  const out = (s = '') => process.stdout.write(s + '\n');
61
62
  /** A refusal a script reads: always on standard error (Appendix B). */
62
63
  const err = (s = '') => process.stderr.write(s + '\n');
@@ -115,19 +116,19 @@ function usage() {
115
116
  out();
116
117
  out(ui.table(['COMMAND', 'WHAT IT DOES'], [
117
118
  ['comprism ask "<your question>"', 'one prompt, one answer, and what it cost'],
118
- ['comprism work', 'have it do the work: reads your project, edits, runs your tests'],
119
+ ['comprism work', 'have it do the work: reads your workspace, edits, runs your tests'],
119
120
  ['comprism login', 'sign in with your email and password'],
120
121
  ['comprism', 'start a session and just type your questions'],
121
- ['comprism --continue', 'carry on the most recent session in this project'],
122
+ ['comprism --continue', 'carry on the most recent session in this workspace'],
122
123
  ['comprism --resume [number]', 'carry on a session; with no number, choose from a list'],
123
124
  ['comprism sessions', 'your recent sessions, newest first; --search to find one'],
124
125
  ['comprism keys', 'add a provider key, or point at a file of them'],
125
126
  ['comprism model', 'the model your savings are measured against'],
126
127
  ['comprism providers', 'every AI vendor and model, and what you can reach'],
127
- ['comprism project', 'the folder to work in, default is where you are'],
128
+ ['comprism workspace', 'the folder to work in, default is where you are'],
128
129
  ['comprism config', 'settings in force and where each came from'],
129
130
  ['comprism instructions', 'the instructions the next job receives'],
130
- ['comprism memory', 'this project\'s notes'],
131
+ ['comprism memory', 'this workspace\'s notes'],
131
132
  ['comprism skills', 'the skills here and where each came from; /name runs one'],
132
133
  ['comprism integrations', 'outside tools the agent can call, and their sign in'],
133
134
  ['comprism plugins', 'packs of skills, helpers, hooks and connections'],
@@ -378,7 +379,7 @@ async function main() {
378
379
  const reply = await askGateway({ intent: 'usage', prompt: '', tzMinutes: -new Date().getTimezoneOffset() });
379
380
  const found = reply.usage;
380
381
  if (!reply.ok || reply.served === false || !found?.lines) {
381
- err(ui.fail(reply.message || 'Usage could not be read from your workspace.'));
382
+ err(ui.fail(reply.message || 'Usage could not be read from your organization.'));
382
383
  process.exitCode = exitFor(reply.httpStatus === 401 ? 'signed_out'
383
384
  : reply.ok || reply.httpStatus ? 'incomplete' : 'unreachable');
384
385
  return;
@@ -400,7 +401,7 @@ async function main() {
400
401
  const reply = await askGateway({ intent: 'schema', prompt: '' });
401
402
  const doc = reply.schema_doc;
402
403
  if (!reply.ok || reply.served === false || !doc?.output) {
403
- err(ui.fail(reply.message || 'The schema could not be read from your workspace.'));
404
+ err(ui.fail(reply.message || 'The schema could not be read from your organization.'));
404
405
  const { exitFor } = await Promise.resolve().then(() => __importStar(require('./lib/output')));
405
406
  process.exitCode = exitFor(reply.httpStatus === 401 ? 'signed_out'
406
407
  : reply.ok || reply.httpStatus ? 'incomplete' : 'unreachable');
@@ -512,7 +513,7 @@ async function main() {
512
513
  const slashWord = /^\/([a-z][a-z0-9-]*)(?:\s|$)/i.exec(request.trim());
513
514
  if (slashWord && !(await Promise.resolve().then(() => __importStar(require('./lib/attach')))).startsWithPath(request.trim())) {
514
515
  const { fetchCommandList } = await Promise.resolve().then(() => __importStar(require('./lib/commandlist')));
515
- const { resolveProject } = await Promise.resolve().then(() => __importStar(require('./lib/project')));
516
+ const { resolveProject } = await Promise.resolve().then(() => __importStar(require('./machine/folder/project')));
516
517
  const where = flag(args, '--cwd') ?? (await Promise.resolve().then(() => __importStar(require('./commands/settings')))).currentWorkspace().path;
517
518
  const list = await fetchCommandList(resolveProject(where).root, []);
518
519
  const name = slashWord[1].toLowerCase();
@@ -562,7 +563,7 @@ async function main() {
562
563
  ?? (await Promise.resolve().then(() => __importStar(require('./commands/settings')))).currentWorkspace().path;
563
564
  const worktree = flag(args, '--worktree');
564
565
  if (worktree) {
565
- const { checkFolder, resolveProject } = await Promise.resolve().then(() => __importStar(require('./lib/project')));
566
+ const { checkFolder, resolveProject } = await Promise.resolve().then(() => __importStar(require('./machine/folder/project')));
566
567
  const start = checkFolder(workFolder);
567
568
  if (!start.ok) {
568
569
  out(ui.fail(start.why));
@@ -842,6 +843,6 @@ async function main() {
842
843
  }
843
844
  }
844
845
  main().catch((err) => {
845
- process.stderr.write(ui.fail(err instanceof Error ? err.message : 'something went wrong') + '\n');
846
+ process.stderr.write(ui.fail(err instanceof Error ? err.message : (0, words_1.word)('somethingWrong')) + '\n');
846
847
  process.exitCode = 1;
847
848
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@illuminis/comprism",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "CompletionPrism Companion. Records what finishing a piece of work actually costs - every attempt, and the human time spent noticing and repairing the ones that failed.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -23,8 +23,8 @@
23
23
  "node": ">=22"
24
24
  },
25
25
  "scripts": {
26
- "build": "tsc -p ./ && node scripts/build-native.mjs",
27
- "dev": "tsc -w -p ./",
26
+ "build": "node scripts/sync-machine-services.mjs && tsc -p ./ && node scripts/build-native.mjs",
27
+ "dev": "node scripts/sync-machine-services.mjs && tsc -w -p ./",
28
28
  "test": "npm run build && node --test out/**/*.test.js",
29
29
  "gate": "npm run build && npm test && npm run shipcheck",
30
30
  "prepublishOnly": "npm run build",
@@ -44,7 +44,7 @@
44
44
  "repository": {
45
45
  "type": "git",
46
46
  "url": "git+https://github.com/Illuminis-ai/completionprism.git",
47
- "directory": "app/cli"
47
+ "directory": "app/frontend/terminal"
48
48
  },
49
49
  "keywords": [
50
50
  "ai",