@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
@@ -96,40 +96,31 @@ async function session() {
96
96
  return reply.session;
97
97
  }
98
98
  /**
99
- * The mark: the app icon as a terminal can draw it cleanly. A five layer prism,
100
- * each layer two blocks wider than the one above and a shade deeper, with
101
- * three beams leaving its right side (up, level and down) and a ring of the
102
- * icon's cyan to purple around it (owner, 28 September 2026).
99
+ * The mark: a six layer prism, each layer two cells wider than the one above,
100
+ * colored bottom to top in the illuminis gradient: light purple at the base,
101
+ * then light blue, light green, light gold, light orange and light red at the
102
+ * top, so the cool colors carry the weight of the wide layers. The purple,
103
+ * green and gold are pale shades of the illuminis logo's own
104
+ * (platform/branding/assets).
103
105
  *
104
- * Solid blocks only, no blended edges and no white, because a terminal draws a
105
- * solid block sharply in any font and a white one vanishes on a white screen.
106
- * Drawn two pixels to a character, so it is nine lines tall.
106
+ * No ring and no beams: at terminal size both read as rough, and straight
107
+ * layers stay clean in any terminal (owner, 28 September 2026). Solid colored
108
+ * cells only: a terminal paints a cell's background edge to edge in any font.
109
+ * One pixel to a character, six lines tall.
107
110
  *
108
111
  * Without color the picture cannot be drawn, so the four row block pyramid
109
112
  * stands in: full blocks only, which render the same in every font.
110
113
  */
111
114
  const ICON = [
112
- '..........................................53a6ed51a1ed509cee4f98ee4d93ee4c8eee4a89ee..................................................................',
113
- '..............................54abed53a6ed51a1ed..............................4984ef477fef467bef......................................................',
114
- '........................54abed53a6ed......................................................4476ef4371ef................................................',
115
- '..................54abed53a6ed..................................................................426cf04067f0..........................................',
116
- '..................53a6ed....................................a8d8f7a8d8f7..............................3f62f0..........................................',
117
- '............53a6ed51a1ed....................................a8d8f7a8d8f7..............................3f5ff0425ef0..................4292f23f8af43b82f6',
118
- '............51a1ed....................................74aef074aef074aef074aef0..............................455cf0......49a2ee469af0..................',
119
- '............509cee....................................74aef074aef074aef074aef0........................54bbe851b3ea4daaec..............................',
120
- '............4f98ee..............................4f86e64f86e64f86e64f86e64f86e64f86e6......5bcbe458c3e6......4b59f1....................................',
121
- '............4d93ee..............................4f86e64f86e64f86e64f86e64f86e64f86e6f07a36f0e35befe25aeee259ece158eae057e9df56e8de55e6de54e4dd53e3dc52',
122
- '............4c8eee........................3e60d83e60d83e60d83e60d83e60d83e60d83e60d83e60d8ed7435ea6e34......5056f1....................................',
123
- '............4a89ee........................3e60d83e60d83e60d83e60d83e60d83e60d83e60d83e60d8............e76932e46331e15d30..............................',
124
- '............4984ef477fef............2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a......5355f15653f2......de572fdb512e..................',
125
- '..................467bef............2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a2e3a9a......5653f2........................d84c2cd5462bd2402a',
126
- '..................4476ef4371ef..................................................................5653f25952f2..........................................',
127
- '........................426cf04067f0......................................................5653f25952f2................................................',
128
- '..............................3f62f03f5ff0425ef0..............................5355f15653f25952f2......................................................',
129
- '..........................................455cf0485bf14b59f14e58f15056f15355f15653f2..................................................................',
115
+ '..............................f69f97f69f97..............................',
116
+ '........................ffbd8affbd8affbd8affbd8a........................',
117
+ '..................ffdf7fffdf7fffdf7fffdf7fffdf7fffdf7f..................',
118
+ '............a1d38ca1d38ca1d38ca1d38ca1d38ca1d38ca1d38ca1d38c............',
119
+ '......95d2f095d2f095d2f095d2f095d2f095d2f095d2f095d2f095d2f095d2f0......',
120
+ 'bba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1ddbba1dd',
130
121
  ];
131
122
  function mark() {
132
- const picture = ui.pixelArt(ICON);
123
+ const picture = ui.cellArt(ICON);
133
124
  if (picture.length)
134
125
  return picture;
135
126
  const rows = [];
@@ -176,7 +167,6 @@ async function showWelcome(known, signingIn = false, withMark = true) {
176
167
  // Nothing else here is knowable yet, and the one useful thing to say is the
177
168
  // single command that changes that.
178
169
  out(row('Signed in', ui.c.amber('not yet')));
179
- out(row('Comparing', cfg.defaultModel || 'not set'));
180
170
  out(row('Workspace', `${folder.path} ${ui.c.dim('(where you are)')}`));
181
171
  out();
182
172
  // Not said when signing in follows at once: naming a command to type, just
@@ -205,7 +195,8 @@ async function showWelcome(known, signingIn = false, withMark = true) {
205
195
  out(row('User', who));
206
196
  out(row('Company', company));
207
197
  out(row('Server', local ? address : ui.c.dim(address)));
208
- out(row('Comparing', `${cfg.defaultModel || ui.c.amber('not set')} ${ui.c.dim('change with `comprism model`')}`));
198
+ // The service's own record of the person's choice (service catalog 14).
199
+ out(row('Comparing', `${me?.comparing || ui.c.amber('not set')} ${ui.c.dim('change with `comprism model`')}`));
209
200
  out(row('Workspace', `${folder.path} ${ui.c.dim(folder.source === 'cwd' ? '(where you are)' : '(saved)')}`));
210
201
  if (plan) {
211
202
  out(row('Plan', allowance
@@ -214,7 +205,7 @@ async function showWelcome(known, signingIn = false, withMark = true) {
214
205
  }
215
206
  if (!me) {
216
207
  out();
217
- out(` ${ui.c.amber('your workspace could not be reached, so only local settings are shown')}`);
208
+ out(` ${ui.c.amber('your organization could not be reached, so only local settings are shown')}`);
218
209
  out(` ${ui.c.dim('nothing here is known about your account, including your provider keys')}`);
219
210
  }
220
211
  else if (me.vendors_known === false) {
@@ -1,4 +1,4 @@
1
- import type { ProjectFacts } from "../lib/project";
1
+ import type { ProjectFacts } from "../machine/folder/project";
2
2
  /** The folder a `--worktree` job runs in, creating the worktree the first time.
3
3
  * Null after saying why, when it cannot be made. */
4
4
  export declare function ensureWorktree(facts: ProjectFacts, name: string, session: string): Promise<string | null>;
@@ -57,7 +57,7 @@ export declare function readerReport(): string;
57
57
  * behind, and the agent is told the thing it just created does not exist.
58
58
  *
59
59
  * So this is awaited before the write's result goes back. One round trip: the
60
- * file's facts and the project's new fingerprint travel together, and the
60
+ * file's facts and the workspace's new fingerprint travel together, and the
61
61
  * service stores, stamps and rejoins in that single call.
62
62
  *
63
63
  * Failure is silent on purpose. A map that could not be updated must never turn
package/out/graph/sync.js CHANGED
@@ -22,9 +22,9 @@ exports.pushFile = pushFile;
22
22
  * says what it needs; the machine reads exactly that and sends structure back.
23
23
  */
24
24
  const gateway_1 = require("../lib/gateway");
25
- const build_1 = require("./build");
26
- const read_python_1 = require("./read-python");
27
- const read_typescript_1 = require("./read-typescript");
25
+ const build_1 = require("../machine/codemap/build");
26
+ const read_python_1 = require("../machine/codemap/read-python");
27
+ const read_typescript_1 = require("../machine/codemap/read-typescript");
28
28
  /** How many files' facts go in one call.
29
29
  *
30
30
  * A whole project in one request is several megabytes and fails in the least
@@ -83,7 +83,7 @@ async function refresh(root, workspace, opts = {}) {
83
83
  return { ...blank, current: false, message: "The service could not be reached, so the map was left as it is. Work carries on without it." };
84
84
  }
85
85
  if (now.fresh && !opts.force) {
86
- return { ...blank, current: true, message: `The map already matches all ${state.files.length} files in this project.` };
86
+ return { ...blank, current: true, message: `The map already matches all ${state.files.length} files in this workspace.` };
87
87
  }
88
88
  // What the service already holds, so only what moved is read. It came back
89
89
  // with the status above when there was a map to describe, which is one round
@@ -165,7 +165,7 @@ function coverageSentence(unread, total) {
165
165
  gaps.push(`${unread.typescript} TypeScript files could not be read because this installation has no TypeScript compiler`);
166
166
  }
167
167
  if (!gaps.length)
168
- return `It covers all ${total} code files in this project.`;
168
+ return `It covers all ${total} code files in this workspace.`;
169
169
  return `It covers ${total - unread.python - unread.typescript} of ${total} code files: ${gaps.join("; ")}.`;
170
170
  }
171
171
  /** What this machine can read at all. Asked before anything else, so a person
@@ -193,7 +193,7 @@ function readerReport() {
193
193
  * behind, and the agent is told the thing it just created does not exist.
194
194
  *
195
195
  * So this is awaited before the write's result goes back. One round trip: the
196
- * file's facts and the project's new fingerprint travel together, and the
196
+ * file's facts and the workspace's new fingerprint travel together, and the
197
197
  * service stores, stamps and rejoins in that single call.
198
198
  *
199
199
  * Failure is silent on purpose. A map that could not be updated must never turn
package/out/lib/attach.js CHANGED
@@ -83,6 +83,7 @@ const fs = __importStar(require("node:fs"));
83
83
  const os = __importStar(require("node:os"));
84
84
  const path = __importStar(require("node:path"));
85
85
  const gateway_1 = require("./gateway");
86
+ const words_1 = require("./words");
86
87
  /**
87
88
  * Take the shell's escaping back off a path.
88
89
  *
@@ -136,7 +137,7 @@ function localProblem(file, shown) {
136
137
  link = fs.lstatSync(file);
137
138
  }
138
139
  catch {
139
- return { code: 'not_found', message: `not found: ${shown}` };
140
+ return { code: 'not_found', message: (0, words_1.word)('fileNotFound', { file: shown }) };
140
141
  }
141
142
  let stat;
142
143
  try {
@@ -145,7 +146,7 @@ function localProblem(file, shown) {
145
146
  catch {
146
147
  return link.isSymbolicLink()
147
148
  ? { code: 'broken_link', message: `${shown} points to a file that does not exist` }
148
- : { code: 'unreadable', message: `cannot read ${shown}: permission denied` };
149
+ : { code: 'unreadable', message: (0, words_1.word)('fileNoPermission', { file: shown }) };
149
150
  }
150
151
  if (stat.isDirectory()) {
151
152
  return {
@@ -157,7 +158,7 @@ function localProblem(file, shown) {
157
158
  fs.closeSync(fs.openSync(file, 'r'));
158
159
  }
159
160
  catch {
160
- return { code: 'unreadable', message: `cannot read ${shown}: permission denied` };
161
+ return { code: 'unreadable', message: (0, words_1.word)('fileNoPermission', { file: shown }) };
161
162
  }
162
163
  return undefined;
163
164
  }
@@ -1,7 +1,7 @@
1
1
  export interface Listed {
2
2
  name: string;
3
3
  description: string;
4
- /** `session`, `project skill`, `company skill`, `project command`, ... */
4
+ /** `session`, `workspace skill`, `company skill`, `workspace command`, ... */
5
5
  source: string;
6
6
  }
7
7
  export interface CommandList {
@@ -13,7 +13,7 @@ exports.fetchCommandList = fetchCommandList;
13
13
  * what counts as a skill, what it is called and what its line says is made on
14
14
  * the service.
15
15
  */
16
- const files_1 = require("../executor/files");
16
+ const files_1 = require("../machine/executor/files");
17
17
  const gateway_1 = require("./gateway");
18
18
  const ROUNDS = 6;
19
19
  const MAX_CHARS = 8000;
@@ -35,7 +35,7 @@ async function fetchCommandList(root, words) {
35
35
  for (let round = 0; round < ROUNDS; round += 1) {
36
36
  const reply = await (0, gateway_1.ask)({
37
37
  intent: 'commands', prompt: '',
38
- commandsPayload: { words, round, files, listings, project: root },
38
+ commandsPayload: { words, round, files, listings, project: root, forwards: true },
39
39
  });
40
40
  const body = reply.commands;
41
41
  if (!reply.ok || reply.served === false || !body) {
@@ -1,5 +1,7 @@
1
1
  import type { ExecutionMode, FooterConfig, Provider } from './types';
2
- export declare const HOME_DIR_NAME = ".comprism";
2
+ export { HOME_DIR_NAME } from '../machine/runtime/home';
3
+ import { homeDir } from '../machine/runtime/home';
4
+ export { homeDir };
3
5
  export interface ContentPolicy {
4
6
  /**
5
7
  * Store request and response text alongside the records. Default false, and
@@ -68,7 +70,6 @@ export interface Config {
68
70
  updated: string;
69
71
  }
70
72
  export type Keys = Partial<Record<Provider, string>>;
71
- export declare function homeDir(): string;
72
73
  /**
73
74
  * Create the home directory at mode 700 if it is not there.
74
75
  *
package/out/lib/config.js CHANGED
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HOME_DIR_NAME = void 0;
7
- exports.homeDir = homeDir;
6
+ exports.homeDir = exports.HOME_DIR_NAME = void 0;
8
7
  exports.ensureHome = ensureHome;
9
8
  exports.configPath = configPath;
10
9
  exports.defaultConfig = defaultConfig;
@@ -41,10 +40,10 @@ exports.envVarName = envVarName;
41
40
  const node_fs_1 = __importDefault(require("node:fs"));
42
41
  const node_os_1 = __importDefault(require("node:os"));
43
42
  const node_path_1 = __importDefault(require("node:path"));
44
- exports.HOME_DIR_NAME = '.comprism';
45
- function homeDir() {
46
- return process.env.COMPRISM_HOME || node_path_1.default.join(node_os_1.default.homedir(), exports.HOME_DIR_NAME);
47
- }
43
+ var home_1 = require("../machine/runtime/home");
44
+ Object.defineProperty(exports, "HOME_DIR_NAME", { enumerable: true, get: function () { return home_1.HOME_DIR_NAME; } });
45
+ const home_2 = require("../machine/runtime/home");
46
+ Object.defineProperty(exports, "homeDir", { enumerable: true, get: function () { return home_2.homeDir; } });
48
47
  /**
49
48
  * Create the home directory at mode 700 if it is not there.
50
49
  *
@@ -53,7 +52,7 @@ function homeDir() {
53
52
  * never noticed afterwards.
54
53
  */
55
54
  function ensureHome() {
56
- const dir = homeDir();
55
+ const dir = (0, home_2.homeDir)();
57
56
  node_fs_1.default.mkdirSync(dir, { recursive: true, mode: 0o700 });
58
57
  try {
59
58
  node_fs_1.default.chmodSync(dir, 0o700);
@@ -64,7 +63,7 @@ function ensureHome() {
64
63
  return dir;
65
64
  }
66
65
  function configPath() {
67
- return node_path_1.default.join(homeDir(), 'config.json');
66
+ return node_path_1.default.join((0, home_2.homeDir)(), 'config.json');
68
67
  }
69
68
  function defaultConfig() {
70
69
  const now = new Date().toISOString();
@@ -141,7 +141,7 @@ function isLocalAddress(url) {
141
141
  function writeConnection(connection, typed = false) {
142
142
  if (!typed && isLocalAddress(connection.url)) {
143
143
  throw new Error(`refusing to point this machine at ${connection.url}, which is this computer `
144
- + 'rather than a workspace. Pass it with --workspace if that is genuinely what you want.');
144
+ + 'rather than an organization. Pass it with --workspace if that is genuinely what you want.');
145
145
  }
146
146
  (0, config_1.ensureHome)();
147
147
  node_fs_1.default.writeFileSync(connectionPath(), `${JSON.stringify(connection, null, 2)}\n`, { mode: 0o600 });
@@ -62,7 +62,7 @@ export interface SpendReport {
62
62
  export interface GatewayReply {
63
63
  /** Local transport metadata, not an authentication decision. */
64
64
  httpStatus?: number;
65
- intent: 'decide' | 'answer' | 'catalog' | 'store_key' | 'session' | 'job_start' | 'resolve_workspace' | 'sign_in' | 'sign_out' | 'attach' | 'transcribe' | 'graph' | 'spend' | 'project' | 'commands' | 'transcript' | 'context' | 'compact' | 'sessions' | 'permissions' | 'jobs' | 'agents' | 'integrations' | 'skills' | 'plugins' | 'schema' | 'usage' | 'instructions' | 'config' | 'memory' | 'worktrees' | 'privacy' | 'hooks' | 'queue' | 'review' | 'release';
65
+ intent: 'decide' | 'answer' | 'catalog' | 'store_key' | 'session' | 'job_start' | 'resolve_workspace' | 'sign_in' | 'sign_out' | 'attach' | 'transcribe' | 'graph' | 'spend' | 'project' | 'commands' | 'transcript' | 'context' | 'compact' | 'sessions' | 'permissions' | 'jobs' | 'agents' | 'integrations' | 'skills' | 'plugins' | 'schema' | 'usage' | 'instructions' | 'config' | 'memory' | 'worktrees' | 'privacy' | 'hooks' | 'queue' | 'review' | 'release' | 'command';
66
66
  client: string;
67
67
  decision: Decision;
68
68
  answer: string | null;
@@ -94,7 +94,7 @@ export interface GatewayReply {
94
94
  /**
95
95
  * Did this workspace's build serve the intent that was asked for.
96
96
  *
97
- * False is a COMPLETE answer meaning "your workspace is behind", never an
97
+ * False is a COMPLETE answer meaning "your organization is behind", never an
98
98
  * error and never an absence. A caller that reads it as an absence repeats
99
99
  * the 17 September fault: a tool asked a workspace for its vendor list, the
100
100
  * build did not carry that question, and the refusal was reported to the
@@ -246,8 +246,8 @@ export interface GatewayReply {
246
246
  *
247
247
  * False means we never heard from it, so EVERY other field here is this
248
248
  * client's own placeholder rather than anything the workspace said. Without
249
- * this a caller could not tell "the workspace says you have no provider key"
250
- * from "the workspace did not answer", and it read the second as the first:
249
+ * this a caller could not tell "the organization says you have no provider key"
250
+ * from "the organization did not answer", and it read the second as the first:
251
251
  * somebody whose keys were all present and correct was told none was stored
252
252
  * and walked into a form asking them to paste one.
253
253
  */
@@ -342,7 +342,7 @@ export interface SessionOut {
342
342
  can_write: boolean;
343
343
  }
344
344
  export interface Ask {
345
- intent: 'decide' | 'answer' | 'catalog' | 'store_key' | 'session' | 'job_start' | 'resolve_workspace' | 'sign_in' | 'sign_out' | 'attach' | 'transcribe' | 'graph' | 'spend' | 'project' | 'commands' | 'transcript' | 'context' | 'compact' | 'sessions' | 'permissions' | 'jobs' | 'agents' | 'integrations' | 'skills' | 'plugins' | 'schema' | 'usage' | 'instructions' | 'config' | 'memory' | 'worktrees' | 'privacy' | 'hooks' | 'queue' | 'review' | 'release';
345
+ intent: 'decide' | 'answer' | 'catalog' | 'store_key' | 'session' | 'job_start' | 'resolve_workspace' | 'sign_in' | 'sign_out' | 'attach' | 'transcribe' | 'graph' | 'spend' | 'project' | 'commands' | 'transcript' | 'context' | 'compact' | 'sessions' | 'permissions' | 'jobs' | 'agents' | 'integrations' | 'skills' | 'plugins' | 'schema' | 'usage' | 'instructions' | 'config' | 'memory' | 'worktrees' | 'privacy' | 'hooks' | 'queue' | 'review' | 'release' | 'command';
346
346
  prompt: string;
347
347
  callingModel?: string;
348
348
  contextTokens?: number;
@@ -15,7 +15,7 @@ exports.isPlain = isPlain;
15
15
  * Kept in the tool's own `config.json`, never on the service, because none of
16
16
  * them changes what the agent does: two people sharing a project can each have
17
17
  * their own theme. Settings that do change what the agent does are the
18
- * service's and the project's (manual 2.10), and are not written here.
18
+ * service's and the workspace's (manual 2.10), and are not written here.
19
19
  */
20
20
  const config_1 = require("./config");
21
21
  /** Every machine setting, its allowed values, and its default. `editor` takes
@@ -1,5 +1,5 @@
1
1
  import { type GatewayReply } from "./gateway";
2
- import { type ProjectFacts } from "./project";
2
+ import { type ProjectFacts } from "../machine/folder/project";
3
3
  export type Intent = "instructions" | "config" | "memory" | "worktrees" | "hooks";
4
4
  export declare function useSessionFolder(folder: string | null): void;
5
5
  /** The project for this command: the session's folder, the saved default, or
@@ -50,8 +50,8 @@ exports.openEditor = openEditor;
50
50
  const fs = __importStar(require("node:fs"));
51
51
  const path = __importStar(require("node:path"));
52
52
  const gateway_1 = require("./gateway");
53
- const project_1 = require("./project");
54
- const paths_1 = require("../executor/paths");
53
+ const project_1 = require("../machine/folder/project");
54
+ const paths_1 = require("../machine/executor/paths");
55
55
  const ui = __importStar(require("./ui"));
56
56
  const out = (s = "") => process.stdout.write(s + "\n");
57
57
  /** The largest file sent. An instruction or settings file is a page, not a book. */
@@ -104,8 +104,8 @@ async function call(intent, op, payload, facts, quiet = false) {
104
104
  });
105
105
  if (!reply.ok || reply.served === false) {
106
106
  out(ui.fail(reply.served === false
107
- ? "Your workspace is running an older build that does not answer this yet."
108
- : `Your workspace could not be reached: ${reply.message || "no answer"}`));
107
+ ? "Your organization is running an older build that does not answer this yet."
108
+ : `Your organization could not be reached: ${reply.message || "no answer"}`));
109
109
  return null;
110
110
  }
111
111
  if (reply.granted === false) {
package/out/lib/queue.js CHANGED
@@ -51,7 +51,7 @@ const path = __importStar(require("path"));
51
51
  const child_process_1 = require("child_process");
52
52
  const gateway_1 = require("./gateway");
53
53
  const config_1 = require("./config");
54
- const self_1 = require("./self");
54
+ const self_1 = require("../machine/runtime/self");
55
55
  async function queue(op, payload = {}) {
56
56
  return (0, gateway_1.ask)({
57
57
  intent: "queue", prompt: "", op,
@@ -1,33 +1,6 @@
1
- export interface Requirement {
2
- /** What it is for, said as the work it makes possible. */
3
- purpose: string;
4
- /** Any one of these being present is enough. */
5
- anyOf: string[];
6
- /** Work that cannot be done without it, for the message. */
7
- without: string;
8
- /** True when the tool cannot function at all without this. */
9
- essential: boolean;
10
- }
11
- export declare const REQUIREMENTS: Requirement[];
12
- /** Is this program on the machine, by name, without running anything of theirs. */
13
- export declare function present(program: string): boolean;
14
- /**
15
- * The one command that installs what is missing, for the machine it is on.
16
- *
17
- * Named per platform rather than guessed: telling somebody on Ubuntu to run a
18
- * Homebrew command is worse than saying nothing, because they now have to work
19
- * out that the instruction was wrong before they can work out what is right.
20
- */
21
- export declare function howToInstall(missing: string[]): string;
22
- export interface Readiness {
23
- ready: boolean;
24
- /** One line per requirement, ready to print. */
25
- lines: string[];
26
- /** The command to run, empty when nothing is missing. */
27
- fix: string;
28
- }
29
- /** What this machine can and cannot do, and how to close the gap. */
30
- export declare function check(): Readiness;
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 };
31
4
  /** One checked item: its line, whether it is required, and the fix. */
32
5
  export interface Finding {
33
6
  ok: boolean;
@@ -36,10 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.REQUIREMENTS = void 0;
40
- exports.present = present;
41
- exports.howToInstall = howToInstall;
42
- exports.check = check;
39
+ exports.present = exports.howToInstall = exports.check = exports.REQUIREMENTS = void 0;
43
40
  exports.systemName = systemName;
44
41
  exports.diagnose = diagnose;
45
42
  /**
@@ -72,82 +69,16 @@ exports.diagnose = diagnose;
72
69
  * is not friction worth trading a customer's trust for.
73
70
  */
74
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; } });
75
77
  const node_os_1 = __importDefault(require("node:os"));
76
78
  const install_1 = require("../commands/install");
77
79
  const connection_1 = require("./connection");
78
80
  const gateway_1 = require("./gateway");
79
81
  const node_fs_1 = __importDefault(require("node:fs"));
80
- exports.REQUIREMENTS = [
81
- {
82
- purpose: 'working with a repository',
83
- anyOf: ['git'],
84
- without: 'reading, branching and committing a project',
85
- essential: false,
86
- },
87
- {
88
- purpose: 'reading a PDF you already have',
89
- // Three ways to do the same job. The first keeps the layout, the second is
90
- // close, the third is usually there on any machine with Python at all.
91
- anyOf: ['pdftotext', 'mutool', 'python3'],
92
- without: 'reading a specification or a contract that arrived as a PDF',
93
- essential: false,
94
- },
95
- ];
96
- /** Is this program on the machine, by name, without running anything of theirs. */
97
- function present(program) {
98
- try {
99
- // Windows has no /usr/bin/env, so every program read as missing there.
100
- if (node_os_1.default.platform() === 'win32')
101
- (0, node_child_process_1.execFileSync)('where', [program], { stdio: 'ignore' });
102
- else
103
- (0, node_child_process_1.execFileSync)('/usr/bin/env', ['which', program], { stdio: 'ignore' });
104
- return true;
105
- }
106
- catch {
107
- return false;
108
- }
109
- }
110
- /**
111
- * The one command that installs what is missing, for the machine it is on.
112
- *
113
- * Named per platform rather than guessed: telling somebody on Ubuntu to run a
114
- * Homebrew command is worse than saying nothing, because they now have to work
115
- * out that the instruction was wrong before they can work out what is right.
116
- */
117
- function howToInstall(missing) {
118
- if (missing.length === 0)
119
- return '';
120
- const platform = node_os_1.default.platform();
121
- const parts = missing.map((m) => (m === 'pdftotext' ? 'poppler' : m));
122
- if (platform === 'darwin')
123
- return `brew install ${parts.join(' ')}`;
124
- if (platform === 'linux') {
125
- const apt = missing.map((m) => (m === 'pdftotext' ? 'poppler-utils' : m));
126
- return `sudo apt-get install -y ${apt.join(' ')}`;
127
- }
128
- if (platform === 'win32')
129
- return `winget install ${parts.join(' ')}`;
130
- return `install: ${parts.join(', ')}`;
131
- }
132
- /** What this machine can and cannot do, and how to close the gap. */
133
- function check() {
134
- const lines = [];
135
- const missing = [];
136
- for (const req of exports.REQUIREMENTS) {
137
- const found = req.anyOf.find(present);
138
- if (found) {
139
- lines.push(` ready ${req.purpose}`);
140
- }
141
- else {
142
- // The FIRST of the alternatives is the one named, because a list of three
143
- // equivalent programs is a decision nobody wants to make about a thing
144
- // they did not know they needed.
145
- missing.push(req.anyOf[0]);
146
- lines.push(` missing ${req.purpose}, so ${req.without} will not work`);
147
- }
148
- }
149
- return { ready: missing.length === 0, lines, fix: howToInstall(missing) };
150
- }
151
82
  /** The system this is, in the words its owner would use. */
152
83
  function systemName() {
153
84
  try {
@@ -205,7 +136,7 @@ async function diagnose() {
205
136
  const major = Number(node.split('.')[0]);
206
137
  // The install script and Python installs carry their own Node (manual 1.1),
207
138
  // so the line says so rather than asking for a Node nobody installed.
208
- const { installMethod, isStandalone } = await Promise.resolve().then(() => __importStar(require('./self')));
139
+ const { installMethod, isStandalone } = await Promise.resolve().then(() => __importStar(require('../machine/runtime/self')));
209
140
  if (isStandalone()) {
210
141
  const how = installMethod() === 'script' ? 'the install script' : 'Python (pip)';
211
142
  found.push({ ok: true, required: true, line: `installed with ${how}; Node ${node} is built in, nothing else needed` });
@@ -260,17 +191,17 @@ async function diagnose() {
260
191
  const git = version('git', ['--version']);
261
192
  found.push(git !== null
262
193
  ? { ok: true, required: false, line: `git ${git}` }
263
- : { ok: false, required: false, line: 'git not found: reading, branching and committing a project will not work',
264
- fix: howToInstall(['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']) });
265
196
  const rg = version('rg', ['--version']);
266
197
  found.push(rg !== null
267
198
  ? { ok: true, required: false, line: `ripgrep ${rg}` }
268
199
  : { ok: false, required: false, line: 'ripgrep not found: searches will be slower',
269
- fix: howToInstall(['ripgrep']) });
270
- const pdf = exports.REQUIREMENTS[1];
271
- found.push(pdf.anyOf.some(present)
200
+ fix: (0, needs_1.howToInstall)(['ripgrep']) });
201
+ const pdf = needs_1.REQUIREMENTS[1];
202
+ found.push(pdf.anyOf.some(needs_1.present)
272
203
  ? { ok: true, required: false, line: 'a PDF reader' }
273
204
  : { ok: false, required: false, line: `no PDF reader: ${pdf.without} will not work`,
274
- fix: howToInstall(['pdftotext']) });
205
+ fix: (0, needs_1.howToInstall)(['pdftotext']) });
275
206
  return found;
276
207
  }
@@ -0,0 +1,14 @@
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>;
@@ -0,0 +1,74 @@
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
+ }