@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
|
@@ -0,0 +1,339 @@
|
|
|
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.connectedFolders = connectedFolders;
|
|
37
|
+
exports.currentFolder = currentFolder;
|
|
38
|
+
exports.perform = perform;
|
|
39
|
+
exports.openLine = openLine;
|
|
40
|
+
/**
|
|
41
|
+
* The line to the server: the machine helper every installed client opens
|
|
42
|
+
* while it runs (Work module build spec, section 2, "The line to the computer").
|
|
43
|
+
*
|
|
44
|
+
* The client opens one WebSocket to `/api/v1/front-door/prism_machine` with its sign
|
|
45
|
+
* in, this computer's name and its client kind. The server sends orders
|
|
46
|
+
* `{id, op, args}`; this answers `{id, ok, result}` or `{id, ok:false, error}`.
|
|
47
|
+
*
|
|
48
|
+
* It does only what it is ordered, and only inside folders the person
|
|
49
|
+
* connected. Which folders those are is the server's answer (this computer's
|
|
50
|
+
* source in `workspaces/list`), asked again for every order; nothing is
|
|
51
|
+
* kept here. It decides nothing else: no list of workspaces, no current one.
|
|
52
|
+
*
|
|
53
|
+
* Shared by the terminal and the VS Code extension, which loads the compiled
|
|
54
|
+
* copy, so there is one helper and not two.
|
|
55
|
+
*/
|
|
56
|
+
const fs = __importStar(require("node:fs"));
|
|
57
|
+
const os = __importStar(require("node:os"));
|
|
58
|
+
const path = __importStar(require("node:path"));
|
|
59
|
+
const index_1 = require("../executor/index");
|
|
60
|
+
const steps_1 = require("../terminal/steps");
|
|
61
|
+
const jobs_1 = require("../terminal/jobs");
|
|
62
|
+
function headers(opts, token) {
|
|
63
|
+
const h = {
|
|
64
|
+
'content-type': 'application/json', authorization: `Bearer ${token}`, 'X-Comprism-Client': opts.client,
|
|
65
|
+
};
|
|
66
|
+
if (opts.tenant)
|
|
67
|
+
h['X-Tenant-ID'] = opts.tenant;
|
|
68
|
+
return h;
|
|
69
|
+
}
|
|
70
|
+
/** The folders the person connected on this computer, from the server. */
|
|
71
|
+
async function connectedFolders(opts) {
|
|
72
|
+
const token = await opts.token();
|
|
73
|
+
if (!token)
|
|
74
|
+
return [];
|
|
75
|
+
const res = await fetch(`${opts.baseUrl.replace(/\/+$/, '')}/api/v1/front-door/workspaces/list`, {
|
|
76
|
+
method: 'POST', headers: headers(opts, token), body: '{}', signal: AbortSignal.timeout(15_000),
|
|
77
|
+
});
|
|
78
|
+
if (!res.ok)
|
|
79
|
+
return [];
|
|
80
|
+
const body = (await res.json());
|
|
81
|
+
const here = os.hostname();
|
|
82
|
+
const out = [];
|
|
83
|
+
for (const s of body.sources ?? []) {
|
|
84
|
+
if (s.kind !== 'computer' || (s.machine && s.machine !== here))
|
|
85
|
+
continue;
|
|
86
|
+
for (const w of s.workspaces ?? []) {
|
|
87
|
+
if (typeof w.path === 'string' && path.isAbsolute(w.path))
|
|
88
|
+
out.push(path.resolve(w.path));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
function within(folder, target) {
|
|
94
|
+
const rel = path.relative(folder, target);
|
|
95
|
+
return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));
|
|
96
|
+
}
|
|
97
|
+
/** The server's current workspace folder, when it is on this computer: the
|
|
98
|
+
* folder a coding job's file actions work in. */
|
|
99
|
+
async function currentFolder(opts) {
|
|
100
|
+
const token = await opts.token();
|
|
101
|
+
if (!token)
|
|
102
|
+
return null;
|
|
103
|
+
const res = await fetch(`${opts.baseUrl.replace(/\/+$/, '')}/api/v1/front-door/workspaces/list`, {
|
|
104
|
+
method: 'POST', headers: headers(opts, token), body: '{}', signal: AbortSignal.timeout(15_000),
|
|
105
|
+
});
|
|
106
|
+
if (!res.ok)
|
|
107
|
+
return null;
|
|
108
|
+
const c = (await res.json()).current;
|
|
109
|
+
if (!c?.path || !path.isAbsolute(c.path) || (c.machine && c.machine !== os.hostname()))
|
|
110
|
+
return null;
|
|
111
|
+
return path.resolve(c.path);
|
|
112
|
+
}
|
|
113
|
+
const REFUSED = 'Refused: that place is not inside a folder you connected on this computer.';
|
|
114
|
+
/** Carry out one order. Refused unless its place is inside a connected folder;
|
|
115
|
+
* a new workspace's folder (make_dir, ordered as the workspace is created)
|
|
116
|
+
* may also be made anywhere in the person's own home folder. */
|
|
117
|
+
async function perform(order, folders, jobRoot) {
|
|
118
|
+
const args = order.args ?? {};
|
|
119
|
+
if (order.op === 'terminal') {
|
|
120
|
+
// A step of the terminal tool's own on this computer, ordered by the
|
|
121
|
+
// server's computer service: `{step, args}`, run from the fixed list.
|
|
122
|
+
try {
|
|
123
|
+
return { id: order.id, ok: true, result: await (0, steps_1.runStep)(String(args.step ?? ''), (args.args ?? {})) };
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
return { id: order.id, ok: false, error: String(error.message ?? error) };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const abs = (v) => (typeof v === 'string' && path.isAbsolute(v) ? path.resolve(v) : null);
|
|
130
|
+
if (order.op === 'tool' && typeof args.job === 'string' && args.job) {
|
|
131
|
+
// A terminal job's action, ordered by the server for the job it opened on
|
|
132
|
+
// this computer, on that job's own executor.
|
|
133
|
+
const root = abs(args.root) ?? jobRoot ?? null;
|
|
134
|
+
if (!root)
|
|
135
|
+
return { id: order.id, ok: false, error: REFUSED };
|
|
136
|
+
try {
|
|
137
|
+
return { id: order.id, ok: true, result: await (0, jobs_1.jobAction)(args.job, root, String(args.name ?? ''), (args.input ?? {}), args.hooks) };
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
return { id: order.id, ok: true, result: { content: String(error.message ?? error), is_error: true } };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (order.op === 'tool') {
|
|
144
|
+
// A coding job's file action: `{name, input}`, run in the current
|
|
145
|
+
// workspace's folder, as the job's own executor runs it.
|
|
146
|
+
const root = abs(args.root) ?? jobRoot ?? null;
|
|
147
|
+
if (!root || !folders.some((f) => within(f, root)))
|
|
148
|
+
return { id: order.id, ok: false, error: REFUSED };
|
|
149
|
+
const engine = new index_1.NativeExecutor({ root });
|
|
150
|
+
try {
|
|
151
|
+
const done = await engine.execute(String(args.name ?? ''), (args.input ?? {}));
|
|
152
|
+
return { id: order.id, ok: true, result: { content: done.content, is_error: Boolean(done.isError),
|
|
153
|
+
summary: done.summary ?? null, facts: done.facts ?? null } };
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
return { id: order.id, ok: true, result: { content: String(error.message ?? error), is_error: true } };
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
engine.close();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const root = abs(args.root);
|
|
163
|
+
const target = abs(args.path);
|
|
164
|
+
const where = root ?? target;
|
|
165
|
+
const home = where ? folders.find((f) => within(f, where))
|
|
166
|
+
?? (order.op === 'make_dir' && within(os.homedir(), where) && where !== os.homedir() ? where : undefined) : undefined;
|
|
167
|
+
if (!where || !home)
|
|
168
|
+
return { id: order.id, ok: false, error: REFUSED };
|
|
169
|
+
try {
|
|
170
|
+
if (order.op === 'list_dir') {
|
|
171
|
+
const entries = fs.readdirSync(where, { withFileTypes: true })
|
|
172
|
+
.filter((e) => !e.name.startsWith('.'))
|
|
173
|
+
.map((e) => {
|
|
174
|
+
const folder = e.isDirectory();
|
|
175
|
+
let size;
|
|
176
|
+
if (!folder) {
|
|
177
|
+
try {
|
|
178
|
+
size = fs.statSync(path.join(where, e.name)).size;
|
|
179
|
+
}
|
|
180
|
+
catch { /* gone since listed */ }
|
|
181
|
+
}
|
|
182
|
+
return { name: e.name, kind: folder ? 'folder' : 'file', ...(size !== undefined ? { size } : {}) };
|
|
183
|
+
})
|
|
184
|
+
.sort((a, b) => (a.kind === b.kind ? a.name.localeCompare(b.name) : a.kind === 'folder' ? -1 : 1));
|
|
185
|
+
return { id: order.id, ok: true, result: { entries } };
|
|
186
|
+
}
|
|
187
|
+
if (order.op === 'make_dir') {
|
|
188
|
+
fs.mkdirSync(where, { recursive: true });
|
|
189
|
+
return { id: order.id, ok: true, result: { path: where } };
|
|
190
|
+
}
|
|
191
|
+
// A coding job's file action, rooted in the folder the server named (or
|
|
192
|
+
// the connected folder holding the path), exactly as a job runs it.
|
|
193
|
+
const { root: _root, ...rest } = args;
|
|
194
|
+
void _root;
|
|
195
|
+
if (!root && target)
|
|
196
|
+
rest.path = path.relative(home, target) || '.';
|
|
197
|
+
const engine = new index_1.NativeExecutor({ root: root ?? home });
|
|
198
|
+
try {
|
|
199
|
+
const done = await engine.execute(order.op, rest);
|
|
200
|
+
return { id: order.id, ok: !done.isError, result: done, ...(done.isError ? { error: String(done.content ?? '') } : {}) };
|
|
201
|
+
}
|
|
202
|
+
finally {
|
|
203
|
+
engine.close();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
return { id: order.id, ok: false, error: String(error.message ?? error) };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Open the line and keep it open: reconnect after a drop, with a growing
|
|
212
|
+
* pause, until `stop()`.
|
|
213
|
+
*/
|
|
214
|
+
function openLine(opts) {
|
|
215
|
+
const Ctor = globalThis.WebSocket;
|
|
216
|
+
const log = opts.log ?? (() => undefined);
|
|
217
|
+
let sock = null;
|
|
218
|
+
let stopped = false;
|
|
219
|
+
let pause = 1000;
|
|
220
|
+
let timer = null;
|
|
221
|
+
let up = false;
|
|
222
|
+
if (!Ctor) {
|
|
223
|
+
log('The line to the server could not open: this runtime has no WebSocket.');
|
|
224
|
+
return { stop: () => undefined, connected: () => false, ready: async () => false };
|
|
225
|
+
}
|
|
226
|
+
const again = () => {
|
|
227
|
+
if (stopped)
|
|
228
|
+
return;
|
|
229
|
+
timer = setTimeout(() => void connect(), pause);
|
|
230
|
+
timer.unref?.();
|
|
231
|
+
pause = Math.min(pause * 2, 30_000);
|
|
232
|
+
};
|
|
233
|
+
const connect = async () => {
|
|
234
|
+
if (stopped)
|
|
235
|
+
return;
|
|
236
|
+
let token;
|
|
237
|
+
try {
|
|
238
|
+
token = await opts.token();
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
token = null;
|
|
242
|
+
}
|
|
243
|
+
if (!token) {
|
|
244
|
+
again();
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const url = new URL(`${opts.baseUrl.replace(/\/+$/, '')}/api/v1/front-door/prism_machine`);
|
|
248
|
+
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
249
|
+
url.searchParams.set('machine', os.hostname());
|
|
250
|
+
url.searchParams.set('client', opts.client);
|
|
251
|
+
if (opts.tenant)
|
|
252
|
+
url.searchParams.set('tenant', opts.tenant);
|
|
253
|
+
let s;
|
|
254
|
+
try {
|
|
255
|
+
s = new Ctor(url.toString());
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
log(`The line to the server could not open: ${String(error.message ?? error)}`);
|
|
259
|
+
again();
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
sock = s;
|
|
263
|
+
s.onopen = () => {
|
|
264
|
+
pause = 1000;
|
|
265
|
+
// The sign in goes in this first message, never in the address, so it
|
|
266
|
+
// is not written to any log of addresses.
|
|
267
|
+
s.send(JSON.stringify({ type: 'hello', token, machine: os.hostname(), client: opts.client,
|
|
268
|
+
capabilities: new index_1.NativeExecutor({ root: os.homedir() }).capabilities }));
|
|
269
|
+
};
|
|
270
|
+
s.onmessage = (e) => void (async () => {
|
|
271
|
+
let msg;
|
|
272
|
+
try {
|
|
273
|
+
msg = JSON.parse(String(e.data));
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (msg.type === 'ping') {
|
|
279
|
+
s.send(JSON.stringify({ type: 'pong' }));
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (msg.type === 'ready') {
|
|
283
|
+
up = true;
|
|
284
|
+
log(`Line to the server open as ${os.hostname()} (${opts.client}).`);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (typeof msg.id !== 'string' || typeof msg.op !== 'string')
|
|
288
|
+
return;
|
|
289
|
+
const order = msg;
|
|
290
|
+
let answer;
|
|
291
|
+
try {
|
|
292
|
+
// A terminal step never reads the folders, and asking costs seconds on
|
|
293
|
+
// every order.
|
|
294
|
+
const forJob = order.op === 'tool' && typeof order.args?.job === 'string' && Boolean(order.args.job);
|
|
295
|
+
const folders = order.op === 'terminal' || forJob ? [] : await connectedFolders(opts);
|
|
296
|
+
// The server names the folder on every job order; ask only when it did not.
|
|
297
|
+
const named = typeof order.args?.root === 'string' && path.isAbsolute(order.args.root);
|
|
298
|
+
answer = await perform(order, folders, order.op === 'tool' && !named ? await currentFolder(opts) : null);
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
answer = { id: order.id, ok: false, error: String(error.message ?? error) };
|
|
302
|
+
}
|
|
303
|
+
log(`Order ${order.op}: ${answer.ok ? 'done' : `refused, ${answer.error}`}`);
|
|
304
|
+
if (s.readyState === 1)
|
|
305
|
+
s.send(JSON.stringify(answer));
|
|
306
|
+
})();
|
|
307
|
+
s.onerror = () => undefined;
|
|
308
|
+
s.onclose = () => {
|
|
309
|
+
if (up)
|
|
310
|
+
log('Line to the server closed; reconnecting.');
|
|
311
|
+
up = false;
|
|
312
|
+
sock = null;
|
|
313
|
+
again();
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
void connect();
|
|
317
|
+
return {
|
|
318
|
+
ready: (ms = 15_000) => new Promise((resolve) => {
|
|
319
|
+
const began = Date.now();
|
|
320
|
+
const look = () => { if (up)
|
|
321
|
+
resolve(true);
|
|
322
|
+
else if (stopped || Date.now() - began > ms)
|
|
323
|
+
resolve(false);
|
|
324
|
+
else
|
|
325
|
+
setTimeout(look, 50); };
|
|
326
|
+
look();
|
|
327
|
+
}),
|
|
328
|
+
stop: () => {
|
|
329
|
+
stopped = true;
|
|
330
|
+
if (timer)
|
|
331
|
+
clearTimeout(timer);
|
|
332
|
+
try {
|
|
333
|
+
sock?.close();
|
|
334
|
+
}
|
|
335
|
+
catch { /* already closed */ }
|
|
336
|
+
},
|
|
337
|
+
connected: () => up,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
@@ -38,6 +38,7 @@ exports.standaloneBinDir = standaloneBinDir;
|
|
|
38
38
|
exports.installMethod = installMethod;
|
|
39
39
|
exports.selfLaunch = selfLaunch;
|
|
40
40
|
exports.shippedFile = shippedFile;
|
|
41
|
+
exports.relaunchThroughProxy = relaunchThroughProxy;
|
|
41
42
|
/**
|
|
42
43
|
* How this copy of the tool was installed, and how it starts another copy of
|
|
43
44
|
* itself (manual 1.1).
|
|
@@ -122,3 +123,24 @@ function shippedFile(name, packagePath) {
|
|
|
122
123
|
}
|
|
123
124
|
return target;
|
|
124
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Behind a company proxy (manual 1.11): Node uses HTTPS_PROXY and NO_PROXY for
|
|
128
|
+
* its own requests only when NODE_USE_ENV_PROXY is set as it starts, so the
|
|
129
|
+
* tool starts itself once more with it set, before the server can be reached
|
|
130
|
+
* at all. Nothing changes without a proxy. True when it ran the second copy.
|
|
131
|
+
*/
|
|
132
|
+
function relaunchThroughProxy() {
|
|
133
|
+
const proxy = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
|
|
134
|
+
if (!proxy || process.env.NODE_USE_ENV_PROXY)
|
|
135
|
+
return false;
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
137
|
+
const { spawnSync } = require("child_process");
|
|
138
|
+
// Node 22 calls its proxy support experimental and says so on every start;
|
|
139
|
+
// that one notice is not the person's concern.
|
|
140
|
+
const [cmd, argv] = selfLaunch(process.argv.slice(2), ["--disable-warning=UNDICI-EHPA"]);
|
|
141
|
+
const r = spawnSync(cmd, argv, {
|
|
142
|
+
stdio: "inherit", env: { ...process.env, NODE_USE_ENV_PROXY: "1", ...(isStandalone() ? { NODE_NO_WARNINGS: "1" } : {}) },
|
|
143
|
+
});
|
|
144
|
+
process.exitCode = r.status ?? (r.signal === "SIGINT" ? 130 : 1);
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
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.readClipboardImage = readClipboardImage;
|
|
37
|
+
exports.discard = discard;
|
|
38
|
+
/**
|
|
39
|
+
* The picture on the clipboard, saved to a temporary file (manual 3.4).
|
|
40
|
+
*
|
|
41
|
+
* A terminal cannot hand a program a picture: Ctrl+V and Cmd+V paste text.
|
|
42
|
+
* So `paste` asks the operating system for the clipboard's picture with the
|
|
43
|
+
* tool each one already has, writes it to a file in a fresh temporary folder,
|
|
44
|
+
* and the session attaches that file like any other. The caller removes the
|
|
45
|
+
* folder straight after the upload; nothing is kept.
|
|
46
|
+
*
|
|
47
|
+
* macOS osascript, which every Mac has (pngpaste is used when present)
|
|
48
|
+
* Linux wl-paste on Wayland, xclip on X11
|
|
49
|
+
* Windows PowerShell and the .NET clipboard
|
|
50
|
+
*
|
|
51
|
+
* Every program is run with an argument list, never a shell string, so
|
|
52
|
+
* nothing in a path is ever read as a command.
|
|
53
|
+
*/
|
|
54
|
+
const node_child_process_1 = require("node:child_process");
|
|
55
|
+
const fs = __importStar(require("node:fs"));
|
|
56
|
+
const os = __importStar(require("node:os"));
|
|
57
|
+
const path = __importStar(require("node:path"));
|
|
58
|
+
const run = (file, args, out) => new Promise((resolve) => {
|
|
59
|
+
(0, node_child_process_1.execFile)(file, args, { encoding: out ? 'buffer' : 'utf8', timeout: 15_000,
|
|
60
|
+
maxBuffer: 64 * 1024 * 1024 }, (err, stdout) => {
|
|
61
|
+
const failure = err;
|
|
62
|
+
if (out && !err && Buffer.isBuffer(stdout))
|
|
63
|
+
fs.writeFileSync(out, stdout);
|
|
64
|
+
resolve({
|
|
65
|
+
code: failure ? (typeof failure.code === 'number' ? failure.code : 1) : 0,
|
|
66
|
+
stdout: Buffer.isBuffer(stdout) ? '' : String(stdout ?? ''),
|
|
67
|
+
missing: failure?.code === 'ENOENT',
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
const SAVE_INSTEAD = 'save the picture and attach its path instead.';
|
|
72
|
+
const NO_IMAGE = 'The clipboard holds no image. Nothing was attached.';
|
|
73
|
+
const TEXT_ONLY = 'The clipboard holds no image, only text. Nothing was attached.';
|
|
74
|
+
function landed(file) {
|
|
75
|
+
try {
|
|
76
|
+
return fs.statSync(file).size > 0;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function mac(file, exec) {
|
|
83
|
+
const types = await exec('osascript', ['-e', 'clipboard info']);
|
|
84
|
+
const info = types.stdout;
|
|
85
|
+
if (!/PNGf|TIFF|JPEG|GIFf|picture/i.test(info)) {
|
|
86
|
+
return /utf8|string|text/i.test(info) ? TEXT_ONLY : NO_IMAGE;
|
|
87
|
+
}
|
|
88
|
+
const quick = await exec('pngpaste', [file]);
|
|
89
|
+
if (!quick.missing && quick.code === 0 && landed(file))
|
|
90
|
+
return null;
|
|
91
|
+
// AppleScript writes the clipboard's PNG straight into the file. The path is
|
|
92
|
+
// an argument to the script, never part of its text.
|
|
93
|
+
const script = [
|
|
94
|
+
'on run argv',
|
|
95
|
+
'set f to open for access (POSIX file (item 1 of argv)) with write permission',
|
|
96
|
+
'try',
|
|
97
|
+
'write (the clipboard as «class PNGf») to f',
|
|
98
|
+
'end try',
|
|
99
|
+
'close access f',
|
|
100
|
+
'end run',
|
|
101
|
+
];
|
|
102
|
+
await exec('osascript', [...script.flatMap((l) => ['-e', l]), file]);
|
|
103
|
+
return landed(file) ? null : NO_IMAGE;
|
|
104
|
+
}
|
|
105
|
+
async function linux(file, exec) {
|
|
106
|
+
const wayland = Boolean(process.env.WAYLAND_DISPLAY);
|
|
107
|
+
const x11 = Boolean(process.env.DISPLAY);
|
|
108
|
+
if (!wayland && !x11) {
|
|
109
|
+
return `There is no desktop session here to paste from, so ${SAVE_INSTEAD}`;
|
|
110
|
+
}
|
|
111
|
+
if (wayland) {
|
|
112
|
+
const types = await exec('wl-paste', ['--list-types']);
|
|
113
|
+
if (!types.missing) {
|
|
114
|
+
if (!/image\/png/.test(types.stdout)) {
|
|
115
|
+
return /text\//.test(types.stdout) ? TEXT_ONLY : NO_IMAGE;
|
|
116
|
+
}
|
|
117
|
+
const got = await exec('wl-paste', ['--type', 'image/png'], file);
|
|
118
|
+
return got.code === 0 && landed(file) ? null : NO_IMAGE;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (x11) {
|
|
122
|
+
const targets = await exec('xclip', ['-selection', 'clipboard', '-t', 'TARGETS', '-o']);
|
|
123
|
+
if (!targets.missing) {
|
|
124
|
+
if (!/image\/png/.test(targets.stdout)) {
|
|
125
|
+
return /UTF8_STRING|STRING|text\//.test(targets.stdout) ? TEXT_ONLY : NO_IMAGE;
|
|
126
|
+
}
|
|
127
|
+
const got = await exec('xclip', ['-selection', 'clipboard', '-t', 'image/png', '-o'], file);
|
|
128
|
+
return got.code === 0 && landed(file) ? null : NO_IMAGE;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return `Pasting a picture needs ${wayland ? 'wl-paste' : 'xclip'}, which is not installed. `
|
|
132
|
+
+ `Install it, or ${SAVE_INSTEAD}`;
|
|
133
|
+
}
|
|
134
|
+
async function windows(file, exec) {
|
|
135
|
+
// The file name reaches PowerShell as an argument, never inside the script.
|
|
136
|
+
const script = [
|
|
137
|
+
'param($out)',
|
|
138
|
+
'Add-Type -AssemblyName System.Windows.Forms',
|
|
139
|
+
'Add-Type -AssemblyName System.Drawing',
|
|
140
|
+
'$img = [System.Windows.Forms.Clipboard]::GetImage()',
|
|
141
|
+
'if ($img) { $img.Save($out, [System.Drawing.Imaging.ImageFormat]::Png); "image" }',
|
|
142
|
+
'elseif ([System.Windows.Forms.Clipboard]::ContainsText()) { "text" }',
|
|
143
|
+
'else { "empty" }',
|
|
144
|
+
].join('; ');
|
|
145
|
+
const got = await exec('powershell.exe', ['-NoProfile', '-STA', '-Command', `& { ${script} }`, file]);
|
|
146
|
+
if (got.missing)
|
|
147
|
+
return `Pasting a picture needs PowerShell, which was not found, so ${SAVE_INSTEAD}`;
|
|
148
|
+
if (/image/.test(got.stdout) && landed(file))
|
|
149
|
+
return null;
|
|
150
|
+
return /text/.test(got.stdout) ? TEXT_ONLY : NO_IMAGE;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Save the clipboard's picture as `clipboard-N.png` in a new temporary folder.
|
|
154
|
+
* `n` numbers the pastes in one session, so three screenshots are three names.
|
|
155
|
+
*/
|
|
156
|
+
async function readClipboardImage(n, exec = run, platform = process.platform) {
|
|
157
|
+
const folder = fs.mkdtempSync(path.join(os.tmpdir(), 'comprism-paste-'));
|
|
158
|
+
const file = path.join(folder, `clipboard-${n}.png`);
|
|
159
|
+
let why;
|
|
160
|
+
try {
|
|
161
|
+
why = platform === 'darwin' ? await mac(file, exec)
|
|
162
|
+
: platform === 'win32' ? await windows(file, exec)
|
|
163
|
+
: await linux(file, exec);
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
why = `The clipboard could not be read (${err.message}), so ${SAVE_INSTEAD}`;
|
|
167
|
+
}
|
|
168
|
+
if (why) {
|
|
169
|
+
discard(folder);
|
|
170
|
+
return { ok: false, why };
|
|
171
|
+
}
|
|
172
|
+
return { ok: true, file, folder };
|
|
173
|
+
}
|
|
174
|
+
/** Remove a paste's temporary folder. Always called, whatever happened. */
|
|
175
|
+
function discard(folder) {
|
|
176
|
+
try {
|
|
177
|
+
fs.rmSync(folder, { recursive: true, force: true });
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
/* already gone */
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.quietOutput = quietOutput;
|
|
4
|
+
exports.jobExecutor = jobExecutor;
|
|
5
|
+
exports.jobAction = jobAction;
|
|
6
|
+
exports.jobSandbox = jobSandbox;
|
|
7
|
+
exports.jobStopForeground = jobStopForeground;
|
|
8
|
+
exports.jobClose = jobClose;
|
|
9
|
+
/**
|
|
10
|
+
* A terminal coding job's executor on this computer, kept for the whole job.
|
|
11
|
+
*
|
|
12
|
+
* The server orders each of the job's file actions and commands over the
|
|
13
|
+
* machine line (`tool`, naming the job); they run here on one executor per job,
|
|
14
|
+
* so its sandbox and the processes it started last as long as the job does.
|
|
15
|
+
* The helper runs inside the tool's own process, so a command's output is
|
|
16
|
+
* drawn straight in the person's terminal while it runs.
|
|
17
|
+
*/
|
|
18
|
+
const index_1 = require("../executor/index");
|
|
19
|
+
const sandbox_1 = require("../executor/sandbox");
|
|
20
|
+
const jobs = new Map();
|
|
21
|
+
/** Show a command's output while it runs, unless the job is headless. */
|
|
22
|
+
let stream = (chunk) => process.stdout.write(chunk);
|
|
23
|
+
function quietOutput() { stream = null; }
|
|
24
|
+
/** The executor for a job, made the first time the server names it. */
|
|
25
|
+
function jobExecutor(job, root, added = []) {
|
|
26
|
+
let found = jobs.get(job);
|
|
27
|
+
if (!found) {
|
|
28
|
+
found = new index_1.NativeExecutor({ root, added, onOutput: (chunk) => stream?.(chunk) });
|
|
29
|
+
jobs.set(job, found);
|
|
30
|
+
}
|
|
31
|
+
return found;
|
|
32
|
+
}
|
|
33
|
+
/** Run one of the job's actions. */
|
|
34
|
+
async function jobAction(job, root, name, input, hooks) {
|
|
35
|
+
const engine = jobExecutor(job, root);
|
|
36
|
+
const done = await engine.execute(name, input, hooks);
|
|
37
|
+
return { content: done.content, is_error: Boolean(done.isError), summary: done.summary ?? null,
|
|
38
|
+
facts: done.facts ?? null, tests_passed: engine.lastTestsPassed ?? null };
|
|
39
|
+
}
|
|
40
|
+
/** Turn the sandbox on for a job, with its allowed addresses. */
|
|
41
|
+
async function jobSandbox(job, root, added, allow) {
|
|
42
|
+
const system = (0, sandbox_1.availability)().system;
|
|
43
|
+
if (!system)
|
|
44
|
+
return { on: false };
|
|
45
|
+
const engine = jobExecutor(job, root, added);
|
|
46
|
+
const box = new sandbox_1.Sandbox(system, root, added);
|
|
47
|
+
box.setAllowed(allow);
|
|
48
|
+
await box.start();
|
|
49
|
+
engine.sandbox = box;
|
|
50
|
+
return { on: true };
|
|
51
|
+
}
|
|
52
|
+
/** Stop what is running in the foreground (Ctrl+C on a job). */
|
|
53
|
+
function jobStopForeground() {
|
|
54
|
+
(0, index_1.stopForeground)();
|
|
55
|
+
return { stopped: true };
|
|
56
|
+
}
|
|
57
|
+
/** End a job: close its executor, and stop its processes unless kept. */
|
|
58
|
+
function jobClose(job, keepProcesses) {
|
|
59
|
+
const engine = jobs.get(job);
|
|
60
|
+
jobs.delete(job);
|
|
61
|
+
const stopped = keepProcesses ? [] : (0, index_1.stopEverything)();
|
|
62
|
+
if (engine) {
|
|
63
|
+
engine.close();
|
|
64
|
+
engine.toolServers.stopAll();
|
|
65
|
+
}
|
|
66
|
+
return { stopped };
|
|
67
|
+
}
|