@illuminis/comprism 0.1.8 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/{graph → build/machine/codemap}/read-python.js +2 -2
- package/out/{executor → build/machine/executor}/diagnostics.js +1 -1
- package/out/{executor → build/machine/executor}/hooks.js +1 -1
- package/out/{executor → build/machine/executor}/sandbox.js +1 -1
- package/out/build/machine/line/index.js +339 -0
- package/out/{commands/privacy.js → build/machine/runtime/home.js} +10 -19
- package/out/build/machine/runtime/needs.js +89 -0
- package/out/{lib → build/machine/runtime}/self.js +25 -3
- package/out/build/machine/terminal/jobs.js +67 -0
- package/out/build/machine/terminal/sign-in.js +212 -0
- package/out/build/machine/terminal/steps.js +460 -0
- package/out/build/machine/terminal/voice.js +136 -0
- package/out/build/machine/voice/record.js +286 -0
- package/out/cli-start.js +130 -0
- package/out/machine/line/index.js +339 -0
- package/out/machine/runtime/self.js +22 -0
- package/out/machine/terminal/clipboard.js +182 -0
- package/out/machine/terminal/jobs.js +67 -0
- package/out/machine/terminal/sign-in.js +212 -0
- package/out/machine/terminal/steps.js +460 -0
- package/out/machine/terminal/voice.js +136 -0
- package/out/machine/voice/record.js +79 -1
- package/out/native/dictate +0 -0
- package/out/server.generated.js +6 -0
- package/package.json +8 -40
- package/README.md +0 -343
- package/out/agent/command.d.ts +0 -157
- package/out/agent/command.js +0 -454
- package/out/agent/render.d.ts +0 -169
- package/out/agent/render.js +0 -689
- package/out/agent/session.d.ts +0 -334
- package/out/agent/session.js +0 -1232
- package/out/commands/agents.d.ts +0 -2
- package/out/commands/agents.js +0 -79
- package/out/commands/ask.d.ts +0 -1
- package/out/commands/ask.js +0 -222
- package/out/commands/codemap.d.ts +0 -2
- package/out/commands/codemap.js +0 -151
- package/out/commands/commands-thin.d.ts +0 -39
- package/out/commands/commands-thin.js +0 -244
- package/out/commands/config.d.ts +0 -1
- package/out/commands/config.js +0 -138
- package/out/commands/cost.d.ts +0 -1
- package/out/commands/cost.js +0 -167
- package/out/commands/decisionEngine.d.ts +0 -1
- package/out/commands/decisionEngine.js +0 -66
- package/out/commands/hooks.d.ts +0 -1
- package/out/commands/hooks.js +0 -83
- package/out/commands/install.d.ts +0 -206
- package/out/commands/install.js +0 -738
- package/out/commands/instructions.d.ts +0 -1
- package/out/commands/instructions.js +0 -113
- package/out/commands/integrations.d.ts +0 -3
- package/out/commands/integrations.js +0 -215
- package/out/commands/jobs.d.ts +0 -5
- package/out/commands/jobs.js +0 -157
- package/out/commands/keys.d.ts +0 -55
- package/out/commands/keys.js +0 -344
- package/out/commands/login.d.ts +0 -9
- package/out/commands/login.js +0 -606
- package/out/commands/memory.d.ts +0 -3
- package/out/commands/memory.js +0 -113
- package/out/commands/permissions.d.ts +0 -1
- package/out/commands/permissions.js +0 -94
- package/out/commands/plugins.d.ts +0 -4
- package/out/commands/plugins.js +0 -192
- package/out/commands/privacy.d.ts +0 -1
- package/out/commands/providerKey.d.ts +0 -32
- package/out/commands/providerKey.js +0 -108
- package/out/commands/repl.d.ts +0 -12
- package/out/commands/repl.js +0 -2303
- package/out/commands/report.d.ts +0 -39
- package/out/commands/report.js +0 -115
- package/out/commands/review.d.ts +0 -5
- package/out/commands/review.js +0 -223
- package/out/commands/sessions.d.ts +0 -23
- package/out/commands/sessions.js +0 -115
- package/out/commands/settings.d.ts +0 -23
- package/out/commands/settings.js +0 -153
- package/out/commands/skills.d.ts +0 -21
- package/out/commands/skills.js +0 -207
- package/out/commands/unattended.d.ts +0 -7
- package/out/commands/unattended.js +0 -351
- package/out/commands/update.d.ts +0 -1
- package/out/commands/update.js +0 -123
- package/out/commands/welcome.d.ts +0 -25
- package/out/commands/welcome.js +0 -223
- package/out/commands/worktrees.d.ts +0 -5
- package/out/commands/worktrees.js +0 -186
- package/out/executor/browser.d.ts +0 -14
- package/out/executor/diagnostics.d.ts +0 -2
- package/out/executor/documents.d.ts +0 -40
- package/out/executor/files.d.ts +0 -2
- package/out/executor/git.d.ts +0 -48
- package/out/executor/hooks.d.ts +0 -51
- package/out/executor/index.d.ts +0 -45
- package/out/executor/notebook.d.ts +0 -2
- package/out/executor/paths.d.ts +0 -20
- package/out/executor/sandbox.d.ts +0 -40
- package/out/executor/shell.d.ts +0 -86
- package/out/executor/toolservers.d.ts +0 -20
- package/out/executor/worktree.d.ts +0 -9
- package/out/graph/build.d.ts +0 -45
- package/out/graph/facts.d.ts +0 -47
- package/out/graph/files.d.ts +0 -45
- package/out/graph/read-locales.d.ts +0 -29
- package/out/graph/read-python.d.ts +0 -11
- package/out/graph/read-typescript.d.ts +0 -16
- package/out/graph/sync.d.ts +0 -66
- package/out/graph/sync.js +0 -242
- package/out/lib/attach.d.ts +0 -106
- package/out/lib/attach.js +0 -396
- package/out/lib/clipboard.d.ts +0 -23
- package/out/lib/commandlist.d.ts +0 -20
- package/out/lib/commandlist.js +0 -58
- package/out/lib/config.d.ts +0 -94
- package/out/lib/config.js +0 -197
- package/out/lib/connection.d.ts +0 -73
- package/out/lib/connection.js +0 -188
- package/out/lib/decision.d.ts +0 -22
- package/out/lib/decision.js +0 -50
- package/out/lib/fingerprint.d.ts +0 -25
- package/out/lib/fingerprint.js +0 -58
- package/out/lib/gateway.d.ts +0 -427
- package/out/lib/gateway.js +0 -226
- package/out/lib/history.d.ts +0 -24
- package/out/lib/history.js +0 -137
- package/out/lib/ide.d.ts +0 -19
- package/out/lib/ide.js +0 -131
- package/out/lib/keyboard.d.ts +0 -98
- package/out/lib/keyboard.js +0 -390
- package/out/lib/lastlogin.d.ts +0 -14
- package/out/lib/lastlogin.js +0 -105
- package/out/lib/machine.d.ts +0 -21
- package/out/lib/machine.js +0 -91
- package/out/lib/notify.d.ts +0 -4
- package/out/lib/notify.js +0 -52
- package/out/lib/output.d.ts +0 -48
- package/out/lib/output.js +0 -108
- package/out/lib/picker.d.ts +0 -1
- package/out/lib/picker.js +0 -158
- package/out/lib/project-ops.d.ts +0 -19
- package/out/lib/project-ops.js +0 -146
- package/out/lib/project.d.ts +0 -28
- package/out/lib/prompt.d.ts +0 -37
- package/out/lib/prompt.js +0 -142
- package/out/lib/queue.d.ts +0 -13
- package/out/lib/queue.js +0 -116
- package/out/lib/readiness.d.ts +0 -22
- package/out/lib/readiness.js +0 -207
- package/out/lib/self.d.ts +0 -23
- package/out/lib/servicecommand.d.ts +0 -14
- package/out/lib/servicecommand.js +0 -74
- package/out/lib/sessions.d.ts +0 -19
- package/out/lib/sessions.js +0 -221
- package/out/lib/startcache.d.ts +0 -13
- package/out/lib/startcache.js +0 -78
- package/out/lib/stdin.d.ts +0 -32
- package/out/lib/stdin.js +0 -117
- package/out/lib/store.d.ts +0 -40
- package/out/lib/store.js +0 -138
- package/out/lib/sync.d.ts +0 -18
- package/out/lib/sync.js +0 -81
- package/out/lib/types.d.ts +0 -417
- package/out/lib/types.js +0 -21
- package/out/lib/ui.d.ts +0 -123
- package/out/lib/ui.js +0 -299
- package/out/lib/version.d.ts +0 -23
- package/out/lib/version.js +0 -46
- package/out/lib/voice.d.ts +0 -49
- package/out/lib/voice.js +0 -236
- package/out/lib/words.d.ts +0 -20
- package/out/lib/words.js +0 -27
- package/out/machine/codemap/build.d.ts +0 -45
- package/out/machine/codemap/facts.d.ts +0 -47
- package/out/machine/codemap/files.d.ts +0 -45
- package/out/machine/codemap/read-locales.d.ts +0 -29
- package/out/machine/codemap/read-python.d.ts +0 -11
- package/out/machine/codemap/read-typescript.d.ts +0 -16
- package/out/machine/executor/browser.d.ts +0 -14
- package/out/machine/executor/diagnostics.d.ts +0 -2
- package/out/machine/executor/documents.d.ts +0 -40
- package/out/machine/executor/files.d.ts +0 -2
- package/out/machine/executor/git.d.ts +0 -48
- package/out/machine/executor/hooks.d.ts +0 -51
- package/out/machine/executor/index.d.ts +0 -45
- package/out/machine/executor/notebook.d.ts +0 -2
- package/out/machine/executor/paths.d.ts +0 -20
- package/out/machine/executor/sandbox.d.ts +0 -40
- package/out/machine/executor/shell.d.ts +0 -86
- package/out/machine/executor/toolservers.d.ts +0 -20
- package/out/machine/executor/worktree.d.ts +0 -9
- package/out/machine/folder/project.d.ts +0 -28
- package/out/machine/runtime/home.d.ts +0 -2
- package/out/machine/runtime/needs.d.ts +0 -30
- package/out/machine/runtime/self.d.ts +0 -23
- package/out/machine/voice/record.d.ts +0 -38
- package/out/postinstall.d.ts +0 -2
- package/out/postinstall.js +0 -120
- package/out/providers/anthropic.d.ts +0 -22
- package/out/providers/anthropic.js +0 -80
- package/out/providers/index.d.ts +0 -8
- package/out/providers/index.js +0 -84
- package/out/providers/openai.d.ts +0 -11
- package/out/providers/openai.js +0 -57
- package/out/thin.d.ts +0 -2
- package/out/thin.js +0 -855
- package/scripts/read_python.py +0 -270
- /package/out/{graph → build/machine/codemap}/build.js +0 -0
- /package/out/{graph → build/machine/codemap}/facts.js +0 -0
- /package/out/{graph → build/machine/codemap}/files.js +0 -0
- /package/out/{graph → build/machine/codemap}/read-locales.js +0 -0
- /package/out/{graph → build/machine/codemap}/read-typescript.js +0 -0
- /package/out/{executor → build/machine/executor}/browser.js +0 -0
- /package/out/{executor → build/machine/executor}/documents.js +0 -0
- /package/out/{executor → build/machine/executor}/files.js +0 -0
- /package/out/{executor → build/machine/executor}/git.js +0 -0
- /package/out/{executor → build/machine/executor}/index.js +0 -0
- /package/out/{executor → build/machine/executor}/notebook.js +0 -0
- /package/out/{executor → build/machine/executor}/paths.js +0 -0
- /package/out/{executor → build/machine/executor}/shell.js +0 -0
- /package/out/{executor → build/machine/executor}/toolservers.js +0 -0
- /package/out/{executor → build/machine/executor}/worktree.js +0 -0
- /package/out/{lib → build/machine/folder}/project.js +0 -0
- /package/out/{lib → build/machine/terminal}/clipboard.js +0 -0
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.cmdSchedule = cmdSchedule;
|
|
37
|
-
exports.cmdTriggers = cmdTriggers;
|
|
38
|
-
exports.cmdWorker = cmdWorker;
|
|
39
|
-
exports.submitCloud = submitCloud;
|
|
40
|
-
exports.handBack = handBack;
|
|
41
|
-
/**
|
|
42
|
-
* `comprism schedule`, `comprism triggers`, `comprism worker`, `work --cloud`
|
|
43
|
-
* and bringing a cloud job back (manual 10.17 to 10.19).
|
|
44
|
-
*
|
|
45
|
-
* The service decides what runs, when, where and with which limits. This file
|
|
46
|
-
* sends what was typed, keeps a runner going, and does the physical part: a
|
|
47
|
-
* copy of the repository for a cloud job, the unattended job itself, and
|
|
48
|
-
* applying a cloud job's changes here when it is brought back.
|
|
49
|
-
*/
|
|
50
|
-
const fs = __importStar(require("fs"));
|
|
51
|
-
const os = __importStar(require("os"));
|
|
52
|
-
const path = __importStar(require("path"));
|
|
53
|
-
const child_process_1 = require("child_process");
|
|
54
|
-
const ui = __importStar(require("../lib/ui"));
|
|
55
|
-
const queue_1 = require("../lib/queue");
|
|
56
|
-
const project_1 = require("../machine/folder/project");
|
|
57
|
-
const self_1 = require("../machine/runtime/self");
|
|
58
|
-
const out = (s = "") => process.stdout.write(`${s}\n`);
|
|
59
|
-
const err = (s = "") => process.stderr.write(`${s}\n`);
|
|
60
|
-
/** Values typed after flags, so they are never read as the request. */
|
|
61
|
-
const VALUE_FLAGS = ["--mode", "--max-spend", "--max-steps", "--max-minutes", "--name"];
|
|
62
|
-
function words(args) {
|
|
63
|
-
return args.filter((a, i) => !a.startsWith("--") && !VALUE_FLAGS.includes(String(args[i - 1])));
|
|
64
|
-
}
|
|
65
|
-
function failed(reply) {
|
|
66
|
-
if (!reply.ok)
|
|
67
|
-
return reply.message || "Your organization could not be reached.";
|
|
68
|
-
if (reply.served === false)
|
|
69
|
-
return "Your organization is running an older build that does not answer this yet.";
|
|
70
|
-
if (reply.granted === false)
|
|
71
|
-
return reply.message || "Refused.";
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
function printLines(lines) {
|
|
75
|
-
for (const line of lines ?? [])
|
|
76
|
-
out(` ${line}`);
|
|
77
|
-
}
|
|
78
|
-
function startRunner() {
|
|
79
|
-
const w = (0, queue_1.ensureWorker)();
|
|
80
|
-
out(ui.c.dim(w.started
|
|
81
|
-
? ` Started this machine's runner (process ${w.pid}); its log is ${(0, queue_1.workerLog)()}.`
|
|
82
|
-
: ` This machine's runner is going (process ${w.pid}).`));
|
|
83
|
-
}
|
|
84
|
-
// ── schedule (10.17) ─────────────────────────────────────────────────────────
|
|
85
|
-
async function cmdSchedule(args) {
|
|
86
|
-
const [verb, ...rest] = args;
|
|
87
|
-
if (!verb || verb === "list") {
|
|
88
|
-
const reply = await (0, queue_1.queue)("schedule_list");
|
|
89
|
-
const why = failed(reply);
|
|
90
|
-
if (why) {
|
|
91
|
-
err(ui.fail(why));
|
|
92
|
-
return 1;
|
|
93
|
-
}
|
|
94
|
-
out();
|
|
95
|
-
printLines(reply.lines);
|
|
96
|
-
const running = (0, queue_1.workerRunning)();
|
|
97
|
-
out(ui.c.dim(running ? ` This machine's runner is going (process ${running}).`
|
|
98
|
-
: " This machine's runner is not going; schedules here wait until it is: comprism worker"));
|
|
99
|
-
out();
|
|
100
|
-
return 0;
|
|
101
|
-
}
|
|
102
|
-
if (verb === "add") {
|
|
103
|
-
const [rule, request] = words(rest);
|
|
104
|
-
if (!rule || !request) {
|
|
105
|
-
err(ui.fail("Say when and what: comprism schedule add \"every weekday 08:00\" \"summarize failing tests\""));
|
|
106
|
-
return 2;
|
|
107
|
-
}
|
|
108
|
-
const reply = await (0, queue_1.queue)("schedule_add", {
|
|
109
|
-
rule, request, project_root: (0, project_1.resolveProject)(process.cwd()).root, options: (0, queue_1.limitsFrom)(rest),
|
|
110
|
-
});
|
|
111
|
-
const why = failed(reply);
|
|
112
|
-
if (why) {
|
|
113
|
-
err(ui.fail(why));
|
|
114
|
-
return reply.granted === false ? 2 : 1;
|
|
115
|
-
}
|
|
116
|
-
out();
|
|
117
|
-
printLines(reply.lines);
|
|
118
|
-
startRunner();
|
|
119
|
-
out();
|
|
120
|
-
return 0;
|
|
121
|
-
}
|
|
122
|
-
if (verb === "remove") {
|
|
123
|
-
const reply = await (0, queue_1.queue)("schedule_remove", { key: rest[0] ?? "" });
|
|
124
|
-
const why = failed(reply);
|
|
125
|
-
if (why) {
|
|
126
|
-
err(ui.fail(why));
|
|
127
|
-
return 1;
|
|
128
|
-
}
|
|
129
|
-
printLines(reply.lines);
|
|
130
|
-
return 0;
|
|
131
|
-
}
|
|
132
|
-
err(ui.fail(`\`schedule ${verb}\` is not a command. Use schedule, schedule add or schedule remove.`));
|
|
133
|
-
return 2;
|
|
134
|
-
}
|
|
135
|
-
// ── triggers (10.19) ─────────────────────────────────────────────────────────
|
|
136
|
-
async function cmdTriggers(args) {
|
|
137
|
-
const [verb, ...rest] = args;
|
|
138
|
-
if (!verb || verb === "list") {
|
|
139
|
-
const reply = await (0, queue_1.queue)("trigger_list");
|
|
140
|
-
const why = failed(reply);
|
|
141
|
-
if (why) {
|
|
142
|
-
err(ui.fail(why));
|
|
143
|
-
return 1;
|
|
144
|
-
}
|
|
145
|
-
out();
|
|
146
|
-
printLines(reply.lines);
|
|
147
|
-
out();
|
|
148
|
-
return 0;
|
|
149
|
-
}
|
|
150
|
-
if (verb === "add") {
|
|
151
|
-
const [request] = words(rest);
|
|
152
|
-
if (!request) {
|
|
153
|
-
err(ui.fail("Say what each job should do: comprism triggers add \"investigate the failed CI run\""));
|
|
154
|
-
return 2;
|
|
155
|
-
}
|
|
156
|
-
const at = rest.indexOf("--name");
|
|
157
|
-
const reply = await (0, queue_1.queue)("trigger_add", {
|
|
158
|
-
request, target: "machine", name: at === -1 ? "" : rest[at + 1],
|
|
159
|
-
project_root: (0, project_1.resolveProject)(process.cwd()).root, options: (0, queue_1.limitsFrom)(rest),
|
|
160
|
-
});
|
|
161
|
-
const why = failed(reply);
|
|
162
|
-
if (why) {
|
|
163
|
-
err(ui.fail(why));
|
|
164
|
-
return reply.granted === false ? 2 : 1;
|
|
165
|
-
}
|
|
166
|
-
out();
|
|
167
|
-
printLines(reply.lines);
|
|
168
|
-
startRunner();
|
|
169
|
-
out();
|
|
170
|
-
return 0;
|
|
171
|
-
}
|
|
172
|
-
if (verb === "remove") {
|
|
173
|
-
const reply = await (0, queue_1.queue)("trigger_remove", { key: rest[0] ?? "" });
|
|
174
|
-
const why = failed(reply);
|
|
175
|
-
if (why) {
|
|
176
|
-
err(ui.fail(why));
|
|
177
|
-
return 1;
|
|
178
|
-
}
|
|
179
|
-
printLines(reply.lines);
|
|
180
|
-
return 0;
|
|
181
|
-
}
|
|
182
|
-
err(ui.fail(`\`triggers ${verb}\` is not a command. Use triggers, triggers add or triggers remove.`));
|
|
183
|
-
return 2;
|
|
184
|
-
}
|
|
185
|
-
function git(cwd, args, env) {
|
|
186
|
-
const r = (0, child_process_1.spawnSync)("git", args, { cwd, encoding: "utf8", env: { ...process.env, ...(env ?? {}) },
|
|
187
|
-
maxBuffer: 64 * 1024 * 1024 });
|
|
188
|
-
return { ok: r.status === 0, out: `${r.stdout ?? ""}${r.stderr ?? ""}` };
|
|
189
|
-
}
|
|
190
|
-
/** Run one claimed job as an unattended `comprism work`, in `cwd`. */
|
|
191
|
-
function runJob(job, cwd, extra = []) {
|
|
192
|
-
return new Promise((resolve) => {
|
|
193
|
-
// nosemgrep: javascript.lang.security.detect-child-process.detect-child-process -- starts this same program again, every value a separate argument, no shell
|
|
194
|
-
const child = (0, child_process_1.spawn)(...(0, self_1.selfLaunch)(["work", "--yes", "--queued", job.id,
|
|
195
|
-
"--cwd", cwd, ...extra, job.request.slice(0, 2000)]), {
|
|
196
|
-
stdio: ["ignore", "inherit", "inherit"], env: { ...process.env, NO_COLOR: "1" },
|
|
197
|
-
});
|
|
198
|
-
child.on("exit", (code) => resolve(code ?? 1));
|
|
199
|
-
child.on("error", () => resolve(1));
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
async function runCloud(job) {
|
|
203
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "comprism-cloud-"));
|
|
204
|
-
const bundle = path.join(dir, "repo.bundle");
|
|
205
|
-
const work = path.join(dir, "repo");
|
|
206
|
-
try {
|
|
207
|
-
fs.writeFileSync(bundle, Buffer.from(job.bundle ?? "", "base64"));
|
|
208
|
-
fs.mkdirSync(work);
|
|
209
|
-
const steps = [["init", "-q"], ["fetch", "-q", bundle, "refs/comprism/cloud:refs/heads/work"],
|
|
210
|
-
["checkout", "-q", "work"]];
|
|
211
|
-
for (const s of steps) {
|
|
212
|
-
const r = git(work, s);
|
|
213
|
-
if (!r.ok) {
|
|
214
|
-
await (0, queue_1.queue)("failed", { id: job.id, why: `the repository copy could not be opened: ${r.out.slice(0, 300)}` });
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
const base = git(work, ["rev-parse", "HEAD"]).out.trim();
|
|
219
|
-
const { availability } = await Promise.resolve().then(() => __importStar(require("../machine/executor/sandbox")));
|
|
220
|
-
const code = await runJob(job, work, availability().system ? ["--sandbox"] : []);
|
|
221
|
-
git(work, ["add", "-A"]);
|
|
222
|
-
const patch = git(work, ["diff", "--cached", "--binary", base]).out;
|
|
223
|
-
await (0, queue_1.queue)("result", { id: job.id, patch, result: { exit: code } });
|
|
224
|
-
out(` cloud job ${job.id.slice(0, 8)} finished with exit ${code}; ${patch ? "changes" : "no changes"} sent back`);
|
|
225
|
-
}
|
|
226
|
-
finally {
|
|
227
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
/** `comprism worker [--cloud] [--once]`: take and run what the service offers. */
|
|
231
|
-
async function cmdWorker(args) {
|
|
232
|
-
const cloud = args.includes("--cloud");
|
|
233
|
-
const once = args.includes("--once");
|
|
234
|
-
if (!cloud) {
|
|
235
|
-
const running = (0, queue_1.workerRunning)();
|
|
236
|
-
if (running && running !== process.pid) {
|
|
237
|
-
out(` This machine's runner is already going (process ${running}).`);
|
|
238
|
-
return 0;
|
|
239
|
-
}
|
|
240
|
-
(0, queue_1.notePid)();
|
|
241
|
-
}
|
|
242
|
-
out(` ${new Date().toISOString()} runner started${cloud ? " for cloud jobs" : " for this machine"}`);
|
|
243
|
-
let stop = false;
|
|
244
|
-
process.on("SIGTERM", () => { stop = true; });
|
|
245
|
-
process.on("SIGINT", () => { stop = true; });
|
|
246
|
-
while (!stop) {
|
|
247
|
-
const reply = await (0, queue_1.queue)("claim", { cloud });
|
|
248
|
-
const why = failed(reply);
|
|
249
|
-
const job = reply.data?.job ?? null;
|
|
250
|
-
if (why) {
|
|
251
|
-
out(` ${new Date().toISOString()} ${why}`);
|
|
252
|
-
}
|
|
253
|
-
else if (job) {
|
|
254
|
-
out(` ${new Date().toISOString()} running ${job.source} job ${job.id.slice(0, 8)}: ${(job.request.split("\n")[0] ?? "").slice(0, 80)}`);
|
|
255
|
-
if (cloud) {
|
|
256
|
-
await runCloud(job);
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
const folder = job.project_root && fs.existsSync(job.project_root) ? job.project_root : null;
|
|
260
|
-
if (!folder) {
|
|
261
|
-
await (0, queue_1.queue)("failed", { id: job.id, why: `the workspace folder ${job.project_root} is not on this machine` });
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
const code = await runJob(job, folder);
|
|
265
|
-
out(` ${new Date().toISOString()} job ${job.id.slice(0, 8)} ended with exit ${code}`);
|
|
266
|
-
if (code === 1 || code === 6)
|
|
267
|
-
await (0, queue_1.queue)("failed", { id: job.id, why: `ended with exit ${code}` });
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
if (once)
|
|
271
|
-
break;
|
|
272
|
-
continue;
|
|
273
|
-
}
|
|
274
|
-
if (once)
|
|
275
|
-
break;
|
|
276
|
-
await new Promise((r) => setTimeout(r, 15_000));
|
|
277
|
-
}
|
|
278
|
-
return 0;
|
|
279
|
-
}
|
|
280
|
-
// ── a cloud job (10.18) ──────────────────────────────────────────────────────
|
|
281
|
-
/** The repository as it is now, working changes and new files included. */
|
|
282
|
-
function repositoryCopy(root) {
|
|
283
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "comprism-copy-"));
|
|
284
|
-
const index = path.join(dir, "index");
|
|
285
|
-
const env = { GIT_INDEX_FILE: index };
|
|
286
|
-
const head = git(root, ["rev-parse", "HEAD"]);
|
|
287
|
-
if (!head.ok)
|
|
288
|
-
return { why: "this folder is not a Git repository with a commit, so it cannot be copied" };
|
|
289
|
-
git(root, ["read-tree", "HEAD"], env);
|
|
290
|
-
git(root, ["add", "-A"], env);
|
|
291
|
-
const tree = git(root, ["write-tree"], env);
|
|
292
|
-
const commit = git(root, ["commit-tree", tree.out.trim(), "-p", head.out.trim(), "-m", "comprism cloud copy"], { ...env, GIT_AUTHOR_NAME: "comprism", GIT_AUTHOR_EMAIL: "cloud@comprism",
|
|
293
|
-
GIT_COMMITTER_NAME: "comprism", GIT_COMMITTER_EMAIL: "cloud@comprism" });
|
|
294
|
-
if (!commit.ok)
|
|
295
|
-
return { why: `the working changes could not be copied: ${commit.out.slice(0, 200)}` };
|
|
296
|
-
const ref = "refs/comprism/cloud";
|
|
297
|
-
git(root, ["update-ref", ref, commit.out.trim()]);
|
|
298
|
-
const file = path.join(dir, "repo.bundle");
|
|
299
|
-
const made = git(root, ["bundle", "create", file, ref]);
|
|
300
|
-
git(root, ["update-ref", "-d", ref]);
|
|
301
|
-
return made.ok ? { file } : { why: `the copy could not be made: ${made.out.slice(0, 200)}` };
|
|
302
|
-
}
|
|
303
|
-
async function submitCloud(request, cwd, args) {
|
|
304
|
-
const root = (0, project_1.resolveProject)(cwd).root;
|
|
305
|
-
const copy = repositoryCopy(root);
|
|
306
|
-
if ("why" in copy) {
|
|
307
|
-
err(ui.fail(copy.why));
|
|
308
|
-
return 1;
|
|
309
|
-
}
|
|
310
|
-
const bundle = fs.readFileSync(copy.file).toString("base64");
|
|
311
|
-
fs.rmSync(path.dirname(copy.file), { recursive: true, force: true });
|
|
312
|
-
const reply = await (0, queue_1.queue)("submit_cloud", { request, bundle, options: (0, queue_1.limitsFrom)(args) });
|
|
313
|
-
const why = failed(reply);
|
|
314
|
-
if (why) {
|
|
315
|
-
err(ui.fail(why));
|
|
316
|
-
return reply.ok ? 1 : 6;
|
|
317
|
-
}
|
|
318
|
-
out();
|
|
319
|
-
printLines(reply.lines);
|
|
320
|
-
out();
|
|
321
|
-
return 0;
|
|
322
|
-
}
|
|
323
|
-
/** Before resuming a session: apply what its cloud job changed, once (10.18). */
|
|
324
|
-
async function handBack(sessionId, cwd) {
|
|
325
|
-
const reply = await (0, queue_1.queue)("handback", { session_id: sessionId });
|
|
326
|
-
const data = (reply.data ?? {});
|
|
327
|
-
if (!reply.ok || !data.cloud)
|
|
328
|
-
return;
|
|
329
|
-
if (!data.ready) {
|
|
330
|
-
printLines(reply.lines);
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
if (data.applied)
|
|
334
|
-
return;
|
|
335
|
-
const root = (0, project_1.resolveProject)(cwd).root;
|
|
336
|
-
if (!data.patch) {
|
|
337
|
-
out(ui.c.dim(" The cloud job changed no files."));
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
const file = path.join(os.tmpdir(), `comprism-handback-${Date.now()}.patch`);
|
|
341
|
-
fs.writeFileSync(file, data.patch);
|
|
342
|
-
const applied = git(root, ["apply", "--3way", "--binary", file]);
|
|
343
|
-
fs.rmSync(file, { force: true });
|
|
344
|
-
if (!applied.ok) {
|
|
345
|
-
err(ui.fail(`The cloud job's changes could not be applied here: ${applied.out.slice(0, 300)}`));
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
out(ui.ok("Applied the cloud job's changes to this folder."));
|
|
349
|
-
}
|
|
350
|
-
await (0, queue_1.queue)("handed_back", { id: data.id });
|
|
351
|
-
}
|
package/out/commands/update.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function cmdUpdate(args: string[]): Promise<number>;
|
package/out/commands/update.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.cmdUpdate = cmdUpdate;
|
|
37
|
-
/**
|
|
38
|
-
* `comprism update` and `comprism update --check` (manual 1.7).
|
|
39
|
-
*
|
|
40
|
-
* The service holds the release record; this compares it with the installed
|
|
41
|
-
* version and, only when asked, installs the newer one the same way this copy
|
|
42
|
-
* was installed (manual 1.1): npm for npm, the workspace's own install script
|
|
43
|
-
* for the install script, pip for Python. It never updates itself on its own
|
|
44
|
-
* and never moves a machine from one option to another. The sign in and
|
|
45
|
-
* settings live outside the program, so an update keeps them; a failed install
|
|
46
|
-
* leaves the old version.
|
|
47
|
-
*/
|
|
48
|
-
const child_process_1 = require("child_process");
|
|
49
|
-
const fs = __importStar(require("fs"));
|
|
50
|
-
const path = __importStar(require("path"));
|
|
51
|
-
const ui = __importStar(require("../lib/ui"));
|
|
52
|
-
const gateway_1 = require("../lib/gateway");
|
|
53
|
-
const self_1 = require("../machine/runtime/self");
|
|
54
|
-
const version_1 = require("../lib/version");
|
|
55
|
-
const install_1 = require("./install");
|
|
56
|
-
const out = (s = "") => process.stdout.write(`${s}\n`);
|
|
57
|
-
const METHOD_NAME = {
|
|
58
|
-
script: "the install script",
|
|
59
|
-
npm: "npm",
|
|
60
|
-
python: "Python (pip)",
|
|
61
|
-
};
|
|
62
|
-
/** The command that installs `version` the way this copy was installed. */
|
|
63
|
-
function updateCommand(method, version) {
|
|
64
|
-
if (method === "npm") {
|
|
65
|
-
const target = process.env.COMPRISM_UPDATE_PACKAGE || `@illuminis/comprism@${version}`;
|
|
66
|
-
return process.platform === "win32"
|
|
67
|
-
? { file: "npm.cmd", args: ["install", "-g", target], shell: true }
|
|
68
|
-
: { file: "npm", args: ["install", "-g", target] };
|
|
69
|
-
}
|
|
70
|
-
const base = (0, install_1.tenantBaseUrl)();
|
|
71
|
-
if (method === "script") {
|
|
72
|
-
if (!base)
|
|
73
|
-
return { manual: "comprism login, then comprism update" };
|
|
74
|
-
return process.platform === "win32"
|
|
75
|
-
? { file: "powershell.exe", args: ["-NoProfile", "-Command", `irm ${base}/install.ps1 | iex`] }
|
|
76
|
-
: { file: "/bin/sh", args: ["-c", `curl -fsSL ${base}/install.sh | sh`] };
|
|
77
|
-
}
|
|
78
|
-
// Python: the interpreter of the environment pip installed into, when this
|
|
79
|
-
// copy sits in one (a virtual environment or pipx's). Anywhere else is a
|
|
80
|
-
// Python this tool has no business changing, so it says what to run.
|
|
81
|
-
const pin = `comprism-cli==${version}`;
|
|
82
|
-
const index = base ? ["--extra-index-url", `${base}/pypi/simple/`] : [];
|
|
83
|
-
const here = path.dirname(fs.realpathSync(process.execPath));
|
|
84
|
-
for (const name of process.platform === "win32" ? ["python.exe"] : ["python3", "python"]) {
|
|
85
|
-
const python = path.join(here, name);
|
|
86
|
-
if (fs.existsSync(python))
|
|
87
|
-
return { file: python, args: ["-m", "pip", "install", "--upgrade", ...index, pin] };
|
|
88
|
-
}
|
|
89
|
-
return { manual: `python3 -m pip install --upgrade ${index.join(" ")} ${pin}`.replace(/ +/g, " ") };
|
|
90
|
-
}
|
|
91
|
-
async function cmdUpdate(args) {
|
|
92
|
-
const reply = await (0, gateway_1.ask)({ intent: "release", prompt: "" });
|
|
93
|
-
const data = (reply.data ?? {});
|
|
94
|
-
if (!reply.ok || !data.latest) {
|
|
95
|
-
out(ui.fail(reply.message || "The service could not say which version is newest."));
|
|
96
|
-
return reply.ok ? 1 : 6;
|
|
97
|
-
}
|
|
98
|
-
const method = (0, self_1.installMethod)();
|
|
99
|
-
out(` installed ${version_1.COMPRISM_VERSION}, with ${METHOD_NAME[method]}`);
|
|
100
|
-
out(` newest ${data.latest}`);
|
|
101
|
-
if (!data.update_available) {
|
|
102
|
-
out(ui.ok("You have the newest version."));
|
|
103
|
-
return 0;
|
|
104
|
-
}
|
|
105
|
-
if (args.includes("--check")) {
|
|
106
|
-
out(` A newer version is available. Install it with: comprism update`);
|
|
107
|
-
return 0;
|
|
108
|
-
}
|
|
109
|
-
const how = updateCommand(method, data.latest);
|
|
110
|
-
if ("manual" in how) {
|
|
111
|
-
out(ui.fail("This copy is in a Python this tool does not change. Update it with:"));
|
|
112
|
-
out(` ${how.manual}`);
|
|
113
|
-
return 1;
|
|
114
|
-
}
|
|
115
|
-
out(ui.c.dim(` updating with ${METHOD_NAME[method]} ...`));
|
|
116
|
-
const r = (0, child_process_1.spawnSync)(how.file, how.args, { stdio: "inherit", shell: how.shell ?? false });
|
|
117
|
-
if (r.status !== 0) {
|
|
118
|
-
out(ui.fail(`The update did not complete, so ${version_1.COMPRISM_VERSION} is still installed and working.`));
|
|
119
|
-
return 1;
|
|
120
|
-
}
|
|
121
|
-
out(ui.ok(`Updated to ${data.latest}. Your sign in and settings are unchanged.`));
|
|
122
|
-
return 0;
|
|
123
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { SessionOut } from '../lib/gateway';
|
|
2
|
-
/**
|
|
3
|
-
* Who this machine is signed in as, and everything else the header prints.
|
|
4
|
-
*
|
|
5
|
-
* ── One call, to the one service ──────────────────────────────────────────
|
|
6
|
-
*
|
|
7
|
-
* This used to call the platform's own `whoami` for the identity, and the
|
|
8
|
-
* header then had no way at all to say how many vendor keys the account held.
|
|
9
|
-
* Two questions, two addresses, and the header could show a person facts that
|
|
10
|
-
* disagreed with each other. On 17 September 2026 it did exactly that: "User
|
|
11
|
-
* unknown" beside a company name, and a session that then announced no provider
|
|
12
|
-
* key was stored while four were stored and active.
|
|
13
|
-
*
|
|
14
|
-
* Every line below now comes from one request to the single service, so the
|
|
15
|
-
* header either shows a consistent picture or says plainly that it could not
|
|
16
|
-
* reach the workspace. There is no third state in which half of it is true.
|
|
17
|
-
*
|
|
18
|
-
* Null rather than an error when it cannot be reached. A header is the wrong
|
|
19
|
-
* place to fail: somebody on a plane still gets the local facts, and the lines
|
|
20
|
-
* needing the server say so.
|
|
21
|
-
*/
|
|
22
|
-
export declare function session(): Promise<SessionOut | null>;
|
|
23
|
-
/** `known` is who this machine is, when the caller already has it (the last
|
|
24
|
-
* answer, drawn at once while a fresh one is asked for). */
|
|
25
|
-
export declare function showWelcome(known?: SessionOut | null, signingIn?: boolean, withMark?: boolean): Promise<void>;
|