@north-light/cli 0.3.769 → 0.3.771
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/dist/api/client.d.ts +0 -2
- package/dist/api/client.js +2 -2
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/execution-start.d.ts +0 -12
- package/dist/api/routes.d.ts +0 -1
- package/dist/api/routes.js +1 -1
- package/dist/clients/attach/viewer.js +2 -2
- package/dist/core/runtime/interactive-deliver.d.ts +2 -1
- package/dist/core/runtime/interactive-deliver.js +1 -1
- package/dist/daemon/api/handlers/execution-start.js +2 -2
- package/dist/daemon/api/handlers/node-events.js +3 -3
- package/dist/daemon/api/operations.js +1 -1
- package/dist/daemon/api/review-page.js +4 -4
- package/dist/doc-editor/review.css +1 -1
- package/dist/doc-editor/review.js +49 -47
- package/package.json +3 -3
- package/packages/crouter-api/dist/api/client.js +0 -4
- package/packages/crouter-api/dist/api/contract.js +1 -1
- package/packages/crouter-api/dist/api/routes.js +0 -1
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
- package/scripts/sandbox-start.mjs +1 -184
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.771",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -157,8 +157,8 @@
|
|
|
157
157
|
},
|
|
158
158
|
"license": "UNLICENSED",
|
|
159
159
|
"dependencies": {
|
|
160
|
-
"@north-light/identity": "0.3.
|
|
161
|
-
"@north-light/plugin": "0.3.
|
|
160
|
+
"@north-light/identity": "0.3.771",
|
|
161
|
+
"@north-light/plugin": "0.3.771",
|
|
162
162
|
"@earendil-works/chord": "1.5.2",
|
|
163
163
|
"@earendil-works/pi-agent-core": "1.5.2",
|
|
164
164
|
"@earendil-works/pi-ai": "1.5.2",
|
|
@@ -406,10 +406,6 @@ export class CrtrClient {
|
|
|
406
406
|
executionStart(executionId) {
|
|
407
407
|
return this.request('GET', routes.executionStart(executionId));
|
|
408
408
|
}
|
|
409
|
-
/** The calling node's imported files are unpacked in its sandbox (sets `import_node_files.unpacked_at`). */
|
|
410
|
-
executionImportUnpacked(executionId) {
|
|
411
|
-
return this.request('POST', routes.executionImportUnpacked(executionId), {});
|
|
412
|
-
}
|
|
413
409
|
/** A GitHub token limited to the environment's recipe repositories, for the calling node's environment. */
|
|
414
410
|
gitCredential(environmentId, req) {
|
|
415
411
|
return this.request('POST', routes.environmentGitCredential(environmentId), req);
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
//
|
|
13
13
|
// PURITY (spec §3.1): Node built-ins + `src/api/*` only.
|
|
14
14
|
/** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
|
|
15
|
-
export const CONTRACT_LEVEL = '1.
|
|
15
|
+
export const CONTRACT_LEVEL = '1.84';
|
|
16
16
|
/** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
|
|
17
17
|
export const REQUIRED_CONTRACT_HEADER = 'Crouter-Required-Contract';
|
|
18
18
|
/** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
|
|
@@ -29,7 +29,6 @@ export const routes = {
|
|
|
29
29
|
node: (id) => `${V}/nodes/${id}`,
|
|
30
30
|
nodeMemoryReads: (id) => `${V}/nodes/${id}/memory-reads`,
|
|
31
31
|
executionStart: (id) => `${V}/executions/${id}/start`,
|
|
32
|
-
executionImportUnpacked: (id) => `${V}/executions/${id}/import-unpacked`,
|
|
33
32
|
environmentGitCredential: (id) => `${V}/environments/${id}/git-credential`,
|
|
34
33
|
feedback: () => `${V}/feedback`,
|
|
35
34
|
nodeOutcome: (id) => `${V}/nodes/${id}/outcome`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.771",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.771",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"postpack": "node ../../scripts/pack-minify.mjs postpack packages/crouter-plugin"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@north-light/api": "0.3.
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
30
|
+
"@north-light/api": "0.3.771",
|
|
31
|
+
"@north-light/identity": "0.3.771"
|
|
32
32
|
},
|
|
33
33
|
"license": "UNLICENSED",
|
|
34
34
|
"publishConfig": {
|
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.771",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/cli",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.771",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "UNLICENSED",
|
|
12
12
|
"workspaces": [
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@milkdown/preset-gfm": "^7.22.3",
|
|
29
29
|
"@milkdown/prose": "^7.22.3",
|
|
30
30
|
"@milkdown/utils": "^7.22.3",
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
32
|
-
"@north-light/plugin": "0.3.
|
|
31
|
+
"@north-light/identity": "0.3.771",
|
|
32
|
+
"@north-light/plugin": "0.3.771",
|
|
33
33
|
"cron-parser": "^5.6.0",
|
|
34
34
|
"esbuild": "0.28.2",
|
|
35
35
|
"jose": "^6.2.12",
|
|
@@ -11902,17 +11902,17 @@
|
|
|
11902
11902
|
},
|
|
11903
11903
|
"packages/crouter-api": {
|
|
11904
11904
|
"name": "@north-light/api",
|
|
11905
|
-
"version": "0.3.
|
|
11905
|
+
"version": "0.3.771",
|
|
11906
11906
|
"license": "UNLICENSED"
|
|
11907
11907
|
},
|
|
11908
11908
|
"packages/crouter-env-docker": {
|
|
11909
11909
|
"name": "@north-light/env-docker",
|
|
11910
|
-
"version": "0.3.
|
|
11910
|
+
"version": "0.3.771",
|
|
11911
11911
|
"license": "UNLICENSED"
|
|
11912
11912
|
},
|
|
11913
11913
|
"packages/crouter-identity": {
|
|
11914
11914
|
"name": "@north-light/identity",
|
|
11915
|
-
"version": "0.3.
|
|
11915
|
+
"version": "0.3.771",
|
|
11916
11916
|
"license": "UNLICENSED",
|
|
11917
11917
|
"dependencies": {
|
|
11918
11918
|
"jose": "^6.2.1"
|
|
@@ -11920,21 +11920,21 @@
|
|
|
11920
11920
|
},
|
|
11921
11921
|
"packages/crouter-plugin": {
|
|
11922
11922
|
"name": "@north-light/plugin",
|
|
11923
|
-
"version": "0.3.
|
|
11923
|
+
"version": "0.3.771",
|
|
11924
11924
|
"license": "UNLICENSED",
|
|
11925
11925
|
"dependencies": {
|
|
11926
|
-
"@north-light/api": "0.3.
|
|
11927
|
-
"@north-light/identity": "0.3.
|
|
11926
|
+
"@north-light/api": "0.3.771",
|
|
11927
|
+
"@north-light/identity": "0.3.771"
|
|
11928
11928
|
}
|
|
11929
11929
|
},
|
|
11930
11930
|
"packages/crouter-sdk": {
|
|
11931
11931
|
"name": "@north-light/sdk",
|
|
11932
|
-
"version": "0.3.
|
|
11932
|
+
"version": "0.3.771",
|
|
11933
11933
|
"license": "UNLICENSED",
|
|
11934
11934
|
"dependencies": {
|
|
11935
|
-
"@north-light/api": "0.3.
|
|
11936
|
-
"@north-light/identity": "0.3.
|
|
11937
|
-
"@north-light/plugin": "0.3.
|
|
11935
|
+
"@north-light/api": "0.3.771",
|
|
11936
|
+
"@north-light/identity": "0.3.771",
|
|
11937
|
+
"@north-light/plugin": "0.3.771",
|
|
11938
11938
|
"jose": "^6.2.1"
|
|
11939
11939
|
},
|
|
11940
11940
|
"bin": {
|
|
@@ -9,13 +9,10 @@
|
|
|
9
9
|
import { spawn, spawnSync } from 'node:child_process';
|
|
10
10
|
import { createServer } from 'node:http';
|
|
11
11
|
import { randomBytes } from 'node:crypto';
|
|
12
|
-
import {
|
|
12
|
+
import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
13
13
|
import { tmpdir, uptime } from 'node:os';
|
|
14
14
|
import { basename, dirname, join, resolve, sep } from 'node:path';
|
|
15
15
|
import { fileURLToPath } from 'node:url';
|
|
16
|
-
import { Readable } from 'node:stream';
|
|
17
|
-
import { pipeline } from 'node:stream/promises';
|
|
18
|
-
import { createZstdDecompress } from 'node:zlib';
|
|
19
16
|
|
|
20
17
|
export const EXIT_NO_BROKER = 3;
|
|
21
18
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
@@ -160,171 +157,6 @@ function gitAsync(cwd, args, timeoutMs, env) {
|
|
|
160
157
|
});
|
|
161
158
|
}
|
|
162
159
|
|
|
163
|
-
const archiveInvalid = (detail) => new StartFailure('import_archive_invalid', detail);
|
|
164
|
-
|
|
165
|
-
/** Create `dir` (which must lie lexically in `root`) one component at a time; no existing component may resolve outside `rootReal`. */
|
|
166
|
-
function ensureDir(root, rootReal, dir) {
|
|
167
|
-
let current = root;
|
|
168
|
-
for (const segment of dir.slice(root.length).split(sep).filter(Boolean)) {
|
|
169
|
-
current = join(current, segment);
|
|
170
|
-
if (!lstatExists(current)) mkdirSync(current);
|
|
171
|
-
if (!within(rootReal, realpathSync(current))) throw archiveInvalid(`${current} resolves outside ${root}`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/** Each entry of a tar file: `{name, type, size, mode, linkname, offset}`; `offset` is where the data starts. Handles ustar, pax (`x`) and GNU long names (`L`, `K`). */
|
|
176
|
-
export function* tarEntries(fd, fileSize) {
|
|
177
|
-
const block = Buffer.alloc(512);
|
|
178
|
-
const text = (b, from, to) => { const slice = b.subarray(from, to); const end = slice.indexOf(0); return slice.subarray(0, end < 0 ? slice.length : end).toString('utf8'); };
|
|
179
|
-
const octal = (b, from, to) => {
|
|
180
|
-
if (b[from] & 0x80) { let n = 0n; for (let i = from + 1; i < to; i++) n = (n << 8n) | BigInt(b[i]); return Number(n); }
|
|
181
|
-
const t = text(b, from, to).trim();
|
|
182
|
-
return t === '' ? 0 : parseInt(t, 8);
|
|
183
|
-
};
|
|
184
|
-
const readAt = (buffer, position) => { const n = readSync(fd, buffer, 0, buffer.length, position); if (n !== buffer.length) throw archiveInvalid('the archive is truncated'); };
|
|
185
|
-
const readText = (position, size) => { const b = Buffer.alloc(size); readAt(b, position); return b; };
|
|
186
|
-
let position = 0;
|
|
187
|
-
let overrides = {};
|
|
188
|
-
let zeroBlocks = 0;
|
|
189
|
-
while (position + 512 <= fileSize) {
|
|
190
|
-
readAt(block, position);
|
|
191
|
-
position += 512;
|
|
192
|
-
if (block.every((x) => x === 0)) { if (++zeroBlocks === 2) return; continue; }
|
|
193
|
-
zeroBlocks = 0;
|
|
194
|
-
let sum = 0;
|
|
195
|
-
for (let i = 0; i < 512; i++) sum += i >= 148 && i < 156 ? 32 : block[i];
|
|
196
|
-
if (sum !== parseInt(text(block, 148, 156).trim() || 'x', 8)) throw archiveInvalid('a tar header fails its checksum');
|
|
197
|
-
const type = String.fromCharCode(block[156] || 48);
|
|
198
|
-
const size = octal(block, 124, 136);
|
|
199
|
-
if (!Number.isSafeInteger(size) || size < 0 || position + size > fileSize) throw archiveInvalid('a tar entry runs past the end of the archive');
|
|
200
|
-
const dataAt = position;
|
|
201
|
-
position += Math.ceil(size / 512) * 512;
|
|
202
|
-
if (type === 'x') {
|
|
203
|
-
const pax = readText(dataAt, size).toString('utf8');
|
|
204
|
-
for (let i = 0; i < pax.length;) {
|
|
205
|
-
const space = pax.indexOf(' ', i);
|
|
206
|
-
const length = Number(pax.slice(i, space));
|
|
207
|
-
if (!(length > 0)) throw archiveInvalid('a pax header is malformed');
|
|
208
|
-
const [key, ...value] = Buffer.from(pax).subarray(i, i + length - 1).toString('utf8').slice(space - i + 1).split('=');
|
|
209
|
-
overrides[key] = value.join('=');
|
|
210
|
-
i += length;
|
|
211
|
-
}
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
if (type === 'g') continue;
|
|
215
|
-
if (type === 'L') { overrides.path = text(readText(dataAt, size), 0, size); continue; }
|
|
216
|
-
if (type === 'K') { overrides.linkpath = text(readText(dataAt, size), 0, size); continue; }
|
|
217
|
-
const prefix = text(block, 345, 500);
|
|
218
|
-
const ustar = text(block, 257, 262) === 'ustar';
|
|
219
|
-
const name = overrides.path ?? (ustar && prefix ? `${prefix}/${text(block, 0, 100)}` : text(block, 0, 100));
|
|
220
|
-
const linkname = overrides.linkpath ?? text(block, 157, 257);
|
|
221
|
-
overrides = {};
|
|
222
|
-
yield { name, type, size, mode: octal(block, 100, 108) & 0o7777, linkname, offset: dataAt };
|
|
223
|
-
}
|
|
224
|
-
throw archiveInvalid('the archive has no end-of-archive marker');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/** The target of an archive entry: the path map entry whose `from` (without its leading slash) is the longest leading run of the entry's segments, then
|
|
228
|
-
* the rest under that entry's `to`. Throws `import_archive_invalid` for an absolute name, a `..` segment, or a name under no prefix of the map. */
|
|
229
|
-
export function archiveTarget(pathMap, name) {
|
|
230
|
-
if (name.startsWith('/')) throw archiveInvalid(`entry ${name} has an absolute path`);
|
|
231
|
-
const segments = name.split('/').filter((x) => x !== '' && x !== '.');
|
|
232
|
-
if (segments.includes('..')) throw archiveInvalid(`entry ${name} escapes its prefix`);
|
|
233
|
-
let best = null;
|
|
234
|
-
for (const entry of pathMap) {
|
|
235
|
-
const from = entry.from.split('/').filter(Boolean);
|
|
236
|
-
if (from.length <= segments.length && from.every((x, i) => segments[i] === x) && (best === null || from.length > best.length)) best = { entry, length: from.length };
|
|
237
|
-
}
|
|
238
|
-
if (best === null) throw archiveInvalid(`entry ${name} lies under no prefix of the path map`);
|
|
239
|
-
const rest = segments.slice(best.length);
|
|
240
|
-
return { root: best.entry.to, path: join(best.entry.to, ...rest), rest };
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/** Where an archive's entries for `root` are written first, beside it (so the final move is a rename on one filesystem). */
|
|
244
|
-
const stagingOf = (root) => join(dirname(root), `.${basename(root)}.import-staging`);
|
|
245
|
-
|
|
246
|
-
/** Move what was staged for `root` into it, replacing a same-named entry a retried or interrupted earlier attempt left. */
|
|
247
|
-
function placeStaged(stage, root) {
|
|
248
|
-
mkdirSync(root, { recursive: true });
|
|
249
|
-
for (const child of readdirSync(stage)) {
|
|
250
|
-
const to = join(root, child);
|
|
251
|
-
if (lstatExists(to)) rmSync(to, { recursive: true, force: true });
|
|
252
|
-
renameSync(join(stage, child), to);
|
|
253
|
-
}
|
|
254
|
-
rmSync(stage, { recursive: true, force: true });
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/** Download the node's archive and unpack every entry under its path-map target; nothing is written outside the targets, whatever the archive names.
|
|
258
|
-
* Entries are written to a staging directory beside each target and moved in only after the whole archive has been read, so an attempt that fails
|
|
259
|
-
* partway leaves no half-unpacked target and a retry starts clean. */
|
|
260
|
-
export async function unpackImportedFiles(files, scratch) {
|
|
261
|
-
const response = await fetch(files.url, { signal: AbortSignal.timeout(600_000) });
|
|
262
|
-
if (!response.ok || response.body === null) throw new StartFailure('import_archive_unreachable', `the archive download answered ${response.status}`);
|
|
263
|
-
const tarFile = join(scratch, 'import.tar');
|
|
264
|
-
await pipeline(Readable.fromWeb(response.body), createZstdDecompress(), createWriteStream(tarFile));
|
|
265
|
-
const targets = [...new Set(files.path_map.map((m) => m.to))];
|
|
266
|
-
for (const root of targets) rmSync(stagingOf(root), { recursive: true, force: true });
|
|
267
|
-
const fd = openSync(tarFile, 'r');
|
|
268
|
-
try {
|
|
269
|
-
const size = lstatSync(tarFile).size;
|
|
270
|
-
const stages = new Map();
|
|
271
|
-
const stageOf = (root) => {
|
|
272
|
-
if (!stages.has(root)) {
|
|
273
|
-
const stage = stagingOf(root);
|
|
274
|
-
mkdirSync(stage, { recursive: true });
|
|
275
|
-
stages.set(root, { stage, real: realpathSync(stage) });
|
|
276
|
-
}
|
|
277
|
-
return stages.get(root);
|
|
278
|
-
};
|
|
279
|
-
for (const entry of tarEntries(fd, size)) {
|
|
280
|
-
const { root, rest } = archiveTarget(files.path_map, entry.name);
|
|
281
|
-
const { stage, real } = stageOf(root);
|
|
282
|
-
const path = join(stage, ...rest);
|
|
283
|
-
if (entry.type === '5') { ensureDir(stage, real, path); continue; }
|
|
284
|
-
if (rest.length === 0) throw archiveInvalid(`entry ${entry.name} is a ${entry.type === '0' ? 'file' : 'link'} where the prefix directory belongs`);
|
|
285
|
-
ensureDir(stage, real, dirname(path));
|
|
286
|
-
if (entry.type === '0') {
|
|
287
|
-
if (lstatExists(path)) unlinkSync(path);
|
|
288
|
-
const out = openSync(path, fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_NOFOLLOW, 0o600);
|
|
289
|
-
try {
|
|
290
|
-
const buffer = Buffer.alloc(Math.min(1 << 20, Math.max(entry.size, 1)));
|
|
291
|
-
for (let done = 0; done < entry.size;) {
|
|
292
|
-
const n = readSync(fd, buffer, 0, Math.min(buffer.length, entry.size - done), entry.offset + done);
|
|
293
|
-
if (n === 0) throw archiveInvalid('the archive is truncated');
|
|
294
|
-
writeSync(out, buffer, 0, n);
|
|
295
|
-
done += n;
|
|
296
|
-
}
|
|
297
|
-
} finally { closeSync(out); }
|
|
298
|
-
chmodSync(path, entry.mode & 0o777);
|
|
299
|
-
} else if (entry.type === '2') {
|
|
300
|
-
// A link is kept only when it resolves, from where it lies, inside the same target (an absolute one is checked against the final target).
|
|
301
|
-
const resolved = resolve(dirname(path), entry.linkname);
|
|
302
|
-
if (entry.linkname.startsWith('/') ? !within(root, entry.linkname) : !within(stage, resolved)) throw archiveInvalid(`symlink ${entry.name} points outside its prefix`);
|
|
303
|
-
if (lstatExists(path)) unlinkSync(path);
|
|
304
|
-
symlinkSync(entry.linkname, path);
|
|
305
|
-
} else {
|
|
306
|
-
throw archiveInvalid(`entry ${entry.name} has type ${JSON.stringify(entry.type)}, which an import archive does not hold`);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
for (const [root, { stage }] of stages) placeStaged(stage, root);
|
|
310
|
-
} finally {
|
|
311
|
-
closeSync(fd);
|
|
312
|
-
for (const root of targets) rmSync(stagingOf(root), { recursive: true, force: true });
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/** The sandbox's own record that this node's archive was unpacked here: written after a complete unpack, synced to disk, so a sandbox that stopped and
|
|
317
|
-
* woke (or a restarted start script) never unpacks over the work done since. A fresh sandbox has none. */
|
|
318
|
-
const unpackMarker = (root, nodeId) => join(root, 'import-unpacked', nodeId);
|
|
319
|
-
|
|
320
|
-
function writeUnpackMarker(path) {
|
|
321
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
322
|
-
const fd = openSync(path, 'w');
|
|
323
|
-
try { writeSync(fd, `${new Date().toISOString()}\n`); fsyncSync(fd); } finally { closeSync(fd); }
|
|
324
|
-
const dir = openSync(dirname(path), 'r');
|
|
325
|
-
try { fsyncSync(dir); } finally { closeSync(dir); }
|
|
326
|
-
}
|
|
327
|
-
|
|
328
160
|
async function start(env) {
|
|
329
161
|
const boot = bootClock(env);
|
|
330
162
|
boot.mark('start_script_up');
|
|
@@ -466,21 +298,6 @@ async function start(env) {
|
|
|
466
298
|
} finally { await relay?.close(); }
|
|
467
299
|
}
|
|
468
300
|
|
|
469
|
-
// 5.6b a hosted node's imported files (design-import, "Sandbox import step"). The control plane names the archive for as long as it exists, so a
|
|
470
|
-
// replacement sandbox gets it too; this sandbox unpacks only when it holds no marker of its own. The marker is written last: a start that fails
|
|
471
|
-
// anywhere before it (the download, a hostile entry, the report) leaves nothing half-unpacked in place and unpacks again on retry.
|
|
472
|
-
if (bundle.import_node_files) {
|
|
473
|
-
const marker = unpackMarker(root, bundle.node.id);
|
|
474
|
-
if (!existsSync(marker)) {
|
|
475
|
-
const scratch = mkdtempSync(join(tmpdir(), 'crtr-import-'));
|
|
476
|
-
try { await unpackImportedFiles(bundle.import_node_files, scratch); }
|
|
477
|
-
finally { rmSync(scratch, { recursive: true, force: true }); }
|
|
478
|
-
const reported = await api(apiUrl, token, 'POST', `/v1/executions/${executionId}/import-unpacked`, {}).catch((error) => ({ ok: false, status: String(error?.message ?? error) }));
|
|
479
|
-
if (!reported.ok) throw new StartFailure('import_report_failed', `reporting the unpack: ${reported.status}`);
|
|
480
|
-
writeUnpackMarker(marker);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
301
|
// 5.7 the managed worktree request (D102): the node's branch in the recipe repository's one clone, never a second checkout.
|
|
485
302
|
const worktree = bundle.launch.worktree;
|
|
486
303
|
if (worktree) {
|