@outerlayer/cli 0.33.0-next.20261021171323 → 0.33.0-next.20261021194303
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/README.md +5 -1
- package/dist/{agent-setup-NSUX64RU.js → agent-setup-P5PWEGZM.js} +5 -5
- package/dist/{build-HU24C46Z.js → build-SK5BYBER.js} +4 -4
- package/dist/build-info.json +1 -1
- package/dist/{builder-VFREWHZA.js → builder-X4PIGYS6.js} +5 -5
- package/dist/{check-3TQJDGKM.js → check-DPVNDAQQ.js} +32 -32
- package/dist/chunk-2PGI6RDE.js +90 -0
- package/dist/{chunk-ZZSQYOY5.js → chunk-3VGDZ23W.js} +1 -1
- package/dist/{chunk-7LP3F2QH.js → chunk-4OKOLFPH.js} +3 -3
- package/dist/{chunk-NJS7JJYN.js → chunk-52C3SSNF.js} +2 -2
- package/dist/{chunk-IWYS4ERC.js → chunk-533QGXGZ.js} +1 -1
- package/dist/{chunk-54GBOMDW.js → chunk-543ZX5TM.js} +3 -3
- package/dist/{chunk-OX7CHZTJ.js → chunk-5ZUT3IK3.js} +1 -1
- package/dist/{chunk-ZBN4JGTJ.js → chunk-A3H27SYX.js} +1 -1
- package/dist/{chunk-P7BEZAEU.js → chunk-ALSE7YKX.js} +11 -3
- package/dist/{chunk-G7QBSH3X.js → chunk-BBK62GXM.js} +1256 -589
- package/dist/{chunk-NYKZC6HU.js → chunk-C4N5QRQJ.js} +3 -3
- package/dist/{chunk-CI6PRMWZ.js → chunk-CG5TWQ23.js} +5 -5
- package/dist/{chunk-TZQIEUDE.js → chunk-CNRMP6EN.js} +1 -1
- package/dist/{chunk-LAS3DOTW.js → chunk-ENV3AIWQ.js} +42 -18
- package/dist/{chunk-KP6R7CV3.js → chunk-ESP5VZBD.js} +4 -1
- package/dist/{chunk-RQGHHEM7.js → chunk-HBBCQ5NE.js} +2 -2
- package/dist/{chunk-T5TBGOT6.js → chunk-IPJ6HR7E.js} +1 -1
- package/dist/{chunk-APSYTJ6I.js → chunk-JT3YO5MH.js} +1 -1
- package/dist/{chunk-ZZWWKBLL.js → chunk-KUOY5UIR.js} +4 -4
- package/dist/{chunk-X7UUIHGH.js → chunk-LH3KULPL.js} +1 -1
- package/dist/{chunk-LK2S5XZH.js → chunk-LHYO4RDP.js} +9 -1
- package/dist/{chunk-LSMF3EET.js → chunk-LPIUIRHA.js} +10 -10
- package/dist/{chunk-BXA6JLHQ.js → chunk-LTZVMKQS.js} +5 -5
- package/dist/{chunk-WHSYPR3U.js → chunk-M5ZXOQYS.js} +1 -1
- package/dist/{chunk-VXYPD33W.js → chunk-NNNUME4Y.js} +5 -5
- package/dist/{chunk-KQON2T4A.js → chunk-OVSUSOHL.js} +23 -7
- package/dist/{chunk-NHXJU7CM.js → chunk-OXSFOLWE.js} +1 -1
- package/dist/{chunk-77F7NGAZ.js → chunk-TA6TFYAN.js} +3 -3
- package/dist/{chunk-EKMMX5A5.js → chunk-TAZJDD2U.js} +4 -4
- package/dist/{chunk-TI5Y242B.js → chunk-TGXYNEI7.js} +57 -89
- package/dist/{chunk-BSHUTMXV.js → chunk-TPGHCH2H.js} +45 -19
- package/dist/{chunk-AR6UB2BP.js → chunk-UVZ43SW3.js} +3 -3
- package/dist/{chunk-HPOW2VCB.js → chunk-VFW6I4GG.js} +2 -2
- package/dist/{chunk-F3EF56LQ.js → chunk-VQ2JGZSC.js} +1 -1
- package/dist/{chunk-D73OLAYE.js → chunk-WRX2MCDV.js} +1 -1
- package/dist/{chunk-LQFDTQC2.js → chunk-XQTT3222.js} +3 -3
- package/dist/{chunk-SOTJ2V3A.js → chunk-XRZGT54P.js} +6 -6
- package/dist/{chunk-GKNF4D62.js → chunk-XT5SOJRC.js} +48 -25
- package/dist/{chunk-H6Y5D6J7.js → chunk-YZIC5JXC.js} +1 -1
- package/dist/{chunk-JKXTG3BV.js → chunk-ZPW6PUNK.js} +3 -3
- package/dist/{claude-launcher-RNMUZZ3Y.js → claude-launcher-Q7YAPLY2.js} +1 -1
- package/dist/{cli-YQ64SSV3.js → cli-OGX6JNIN.js} +98 -98
- package/dist/{command-RFVCDSJV.js → command-UIAQUHHU.js} +22 -21
- package/dist/{config-3JRFDYZL.js → config-CUJ3Q4L2.js} +1 -1
- package/dist/{connect-cmd-HVHPNVAJ.js → connect-cmd-OLESV5O3.js} +5 -5
- package/dist/{container-start-DP3N72CK.js → container-start-MGY5VFHW.js} +22 -21
- package/dist/{control-plane-launch-DHMD5WBU.js → control-plane-launch-7PXJSMVM.js} +4 -4
- package/dist/{dist-MKY2BSYN.js → dist-DY2ZNEBS.js} +1 -1
- package/dist/{docker-6G6IF4YO.js → docker-XRUAUQIG.js} +5 -5
- package/dist/{doctor-ZE4LA7EZ.js → doctor-ZMKO3F7I.js} +31 -28
- package/dist/{emit-artifact-cmd-YRRXCZAI.js → emit-artifact-cmd-RI7HA37S.js} +10 -10
- package/dist/{emit-criteria-cmd-PSQORVHS.js → emit-criteria-cmd-T5HZZ7XJ.js} +6 -6
- package/dist/{emit-demo-cmd-RJPSISCC.js → emit-demo-cmd-MWRFZHSX.js} +13 -93
- package/dist/{emit-finding-cmd-6FVW3GGK.js → emit-finding-cmd-RN7LSGJ7.js} +7 -7
- package/dist/{emit-result-cmd-PFQ6HSVN.js → emit-result-cmd-72STGWMP.js} +9 -9
- package/dist/{emit-step-cmd-U32Y4PZJ.js → emit-step-cmd-POFAEM7G.js} +7 -7
- package/dist/{findings-cmd-AMYNXO3S.js → findings-cmd-TMURLT3A.js} +7 -7
- package/dist/{fleet-readiness-7ROJ54ZF.js → fleet-readiness-N6Y3F7R6.js} +4 -4
- package/dist/{governing-source-DYJQCHKU.js → governing-source-2R7IS7LZ.js} +9 -9
- package/dist/{hook-fast-WQQYEXO5.js → hook-fast-GO7UTNN5.js} +1 -1
- package/dist/{host-key-KAYMYRO3.js → host-key-UEWE4PXB.js} +2 -2
- package/dist/{image-tag-NM2YT2J2.js → image-tag-V2LXTKK7.js} +2 -2
- package/dist/index.js +4 -4
- package/dist/{init-QDUIHSTK.js → init-E3VWTJFQ.js} +21 -20
- package/dist/{init-CHWFDK23.js → init-YMU4QFRV.js} +21 -20
- package/dist/{init-cmd-STCU6RGY.js → init-cmd-WBPE3X7T.js} +10 -10
- package/dist/{init-update-OIFOUIAN.js → init-update-MONZSG7L.js} +8 -8
- package/dist/{install-OIRIEOS7.js → install-3DBYJITP.js} +3 -3
- package/dist/{install-cmd-IYWVR6WX.js → install-cmd-EELSKBSZ.js} +4 -4
- package/dist/{logs-C3RJ3ZTC.js → logs-ET75ZUCN.js} +1 -1
- package/dist/{loop-NUW7SSZY.js → loop-N3IUN4F3.js} +32 -32
- package/dist/{machine-BJ7TT3B7.js → machine-J7QFINBX.js} +17 -16
- package/dist/{mcp-serve-cmd-PB4UOTGL.js → mcp-serve-cmd-WYUP263T.js} +3 -3
- package/dist/paths-BN7X2YPM.js +9 -0
- package/dist/{pending-RKVRYOTF.js → pending-ROAIK5WO.js} +2 -2
- package/dist/{pidfile-BMFAUQAI.js → pidfile-52TGLGQH.js} +2 -2
- package/dist/{record-26AH6WDB.js → record-BSY4BKJ5.js} +2 -2
- package/dist/{runner-env-66RAFIDJ.js → runner-env-H6XLACTG.js} +4 -4
- package/dist/{runner-identity-FL67WQIA.js → runner-identity-MSMI2PD4.js} +5 -5
- package/dist/{runner-key-YHAJFEGN.js → runner-key-QTNYQ2I7.js} +21 -20
- package/dist/{session-sender-PHQ6PJVD.js → session-sender-USH6NOZL.js} +10 -10
- package/dist/{spec-cmd-SAMHN5FU.js → spec-cmd-ABGR2ZDH.js} +7 -7
- package/dist/{status-QWLX2CCV.js → status-FHEVPRWN.js} +22 -22
- package/dist/{sync-cmd-O6UIF4QJ.js → sync-cmd-GC2TBSUO.js} +9 -9
- package/dist/{watch-5HMOSQ4Z.js → watch-F3LCBTNO.js} +9 -9
- package/dist/{work-claim-cmd-6W7BW4O6.js → work-claim-cmd-X7KNYGU7.js} +10 -10
- package/dist/{work-cmd-3G26E3NL.js → work-cmd-AI3ZPCP7.js} +7 -7
- package/dist/{work-comment-cmd-S6EGHGHL.js → work-comment-cmd-6UXS342S.js} +7 -7
- package/dist/{work-logs-cmd-RQILRNHS.js → work-logs-cmd-TVKWMDOW.js} +7 -7
- package/dist/{work-open-pr-cmd-5CDP6KOF.js → work-open-pr-cmd-WZ7W2HZ7.js} +8 -8
- package/dist/{work-pr-cmd-D3PJJQOX.js → work-pr-cmd-KTNNR46X.js} +7 -7
- package/dist/{work-stop-cmd-AGZWXGRP.js → work-stop-cmd-2BUDSXUU.js} +7 -7
- package/package.json +1 -1
- package/dist/chunk-YYYRBYWG.js +0 -32
- package/dist/paths-OK2EZS7W.js +0 -9
|
@@ -3,25 +3,25 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-ZVB57WI6.js';
|
|
4
4
|
import { DOCKERD_LOG, HELPER_PATH, HELPER_RECORD } from './chunk-RJYKTWUP.js';
|
|
5
5
|
import { zodProblem } from './chunk-I3LTIAOR.js';
|
|
6
|
-
import { senderPidfile } from './chunk-
|
|
7
|
-
import { installScrubContext } from './chunk-
|
|
6
|
+
import { senderPidfile } from './chunk-UVZ43SW3.js';
|
|
7
|
+
import { installScrubContext } from './chunk-NNNUME4Y.js';
|
|
8
8
|
import { writeDockerClientConfig } from './chunk-XTNMIV77.js';
|
|
9
|
-
import { ADDED_USER, shellQuote, GH_CONFIG_YML, ghHostsYml, AssetError, obtainImage, ensureRootfs, gitRemoteFor, startServicesFor, createLeaseChannel, createBuildDisk, machineConfig, resolveAgentUser, AgentUserError, runBuildSteps, LEASE_SECONDS, createContainerRuntime, stopContainer, cleanupContainer, outOfMemoryReason, containerSenderCommand, signalInContainer, syncInContainer, copyTranscriptsFromContainer, senderAliveScript, helperFirecrackerNote,
|
|
9
|
+
import { ADDED_USER, shellQuote, GH_CONFIG_YML, ghHostsYml, AssetError, obtainImage, ensureRootfs, makeBuildsDirPrivate, gitRemoteFor, startServicesFor, createLeaseChannel, createBuildDisk, machineConfig, startJailedInto, resolveAgentUser, AgentUserError, runBuildSteps, LEASE_SECONDS, createContainerRuntime, stopContainer, cleanupContainer, outOfMemoryReason, containerSenderCommand, signalInContainer, syncInContainer, copyTranscriptsFromContainer, MANAGED_UNJAILED_REASON, senderAliveScript, helperFirecrackerNote, isLiteralAddress, stopJailed, deleteBuildDisk, startCheckContainer, lifecycleSteps, lifecycleFailureReason, writeEvalInput, DeliveryFailure, EVAL_INPUT_NAME, copyTranscripts, senderSignalScript, containerJudgeEnvironment, ROOT_DISK_ID_PREFIX, copyJudgeTree } from './chunk-BBK62GXM.js';
|
|
10
10
|
import { waitForAgent, vmExecArgs } from './chunk-QQGZ5THT.js';
|
|
11
11
|
import { socketPathProblem, vsockLinks, LEASE_LINK, linkVsockSockets } from './chunk-HIGJTX5U.js';
|
|
12
|
-
import { describeCallFailure, resolveGoverningSource, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, removeKeptContext, formatDuration, retrySend, formatClock, WORKFLOW_PERMISSION_REASON, keptContextTree } from './chunk-
|
|
13
|
-
import { isBuiltinContainer, isBuiltinProcess, isBuiltinVm, DEFAULT_CHECK_TIME_LIMIT_MINUTES } from './chunk-
|
|
14
|
-
import { readBranchHead, fetchCommit, diffBetween } from './chunk-
|
|
12
|
+
import { describeCallFailure, resolveGoverningSource, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, removeKeptContext, formatDuration, retrySend, formatClock, WORKFLOW_PERMISSION_REASON, keptContextTree } from './chunk-LTZVMKQS.js';
|
|
13
|
+
import { imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, DEFAULT_CHECK_TIME_LIMIT_MINUTES } from './chunk-ALSE7YKX.js';
|
|
14
|
+
import { readBranchHead, fetchCommit, diffBetween } from './chunk-TPGHCH2H.js';
|
|
15
15
|
import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
|
|
16
|
-
import { HASH_ARGV, parseProgramHash, JUDGE_PROGRAM, writeJobFile, readJobFile, childEnvironment, withAnswerProtocol, judgeCommand, MAX_REPORT_BYTES, JUDGE_MAX_TURNS, JUDGE_DIR, COMMAND_DIR, MAX_ITEMS_BYTES } from './chunk-
|
|
16
|
+
import { HASH_ARGV, parseProgramHash, JUDGE_PROGRAM, writeJobFile, readJobFile, childEnvironment, withAnswerProtocol, judgeCommand, MAX_REPORT_BYTES, JUDGE_MAX_TURNS, JUDGE_DIR, COMMAND_DIR, MAX_ITEMS_BYTES } from './chunk-KUOY5UIR.js';
|
|
17
17
|
import { parseSize } from './chunk-YJLHUKYS.js';
|
|
18
|
-
import { CLAUDE_CODE_VERSION, FIRECRACKER_VERSION } from './chunk-
|
|
19
|
-
import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-
|
|
18
|
+
import { CLAUDE_CODE_VERSION, FIRECRACKER_VERSION } from './chunk-LHYO4RDP.js';
|
|
19
|
+
import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-XRZGT54P.js';
|
|
20
20
|
import { planArtifactUpload } from './chunk-3H7NZPYG.js';
|
|
21
|
-
import { scrubText } from './chunk-
|
|
21
|
+
import { scrubText } from './chunk-XT5SOJRC.js';
|
|
22
22
|
import { readCloudConfig } from './chunk-PJDQPF5N.js';
|
|
23
|
-
import { signerFor } from './chunk-
|
|
24
|
-
import { RUNNER_FILE_MODE, runnerDir, buildDir, vsockPath } from './chunk-
|
|
23
|
+
import { signerFor } from './chunk-JT3YO5MH.js';
|
|
24
|
+
import { RUNNER_FILE_MODE, runnerDir, buildDir, vsockPath } from './chunk-ESP5VZBD.js';
|
|
25
25
|
import { JOB_MOUNT, claudeCredential, repositoriesOf, primaryOf, buildEnvironment, CHECKOUT_DIR, parseIsolation, proxyEnvironment, withProxyWarningHidden, containerLocalAddress, destinationEnvironment, CLAUDE_CREDENTIAL_VARIABLES, builtInEnvironment, withHooksPath, startBuildServices, BUILT_IN_NAMES, AGENT_CREDENTIAL_MISSING, sharedUserEnvironment, headerVariables, authorEnvironment, withTunnelRecord, commitIdentityRecord, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, currentClaudeCredential, removedClaudeCredentialValues, checkEnvironment, EVAL_INPUT_DIR } from './chunk-HDSDUTX4.js';
|
|
26
26
|
import { resolvePackRoot } from './chunk-YW4PEGLN.js';
|
|
27
27
|
import { MAINTAINED_SKILLS } from './chunk-CDDED64E.js';
|
|
@@ -31,7 +31,7 @@ import { CheckItemsSchema, CHECK_ITEM_REASON_MAX_LENGTH } from './chunk-3WW2TL7V
|
|
|
31
31
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
32
32
|
import { fdName } from './chunk-XD4ZCMA4.js';
|
|
33
33
|
import { RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON } from './chunk-MESOOLF4.js';
|
|
34
|
-
import { existsSync, statSync, appendFileSync, rmSync, mkdirSync, chmodSync, writeFileSync, accessSync, constants, openSync, readFileSync, closeSync, readdirSync,
|
|
34
|
+
import { existsSync, statSync, appendFileSync, rmSync, mkdirSync, chmodSync, writeFileSync, accessSync, constants, openSync, readFileSync, closeSync, readdirSync, lstatSync, fstatSync, readSync, realpathSync } from 'fs';
|
|
35
35
|
import { join, isAbsolute, dirname, delimiter, sep } from 'path';
|
|
36
36
|
import { once } from 'events';
|
|
37
37
|
import { createServer } from 'net';
|
|
@@ -175,61 +175,7 @@ async function stopMicroVmCommand(runtime, state) {
|
|
|
175
175
|
(signal) => runtime.vm.exec(state.vsockPath, { argv: ["/bin/sh", "-c", STOP_COMMAND_SCRIPT], user: "root", cwd: "/", env: { PATH: GUEST_PATH } }, { signal })
|
|
176
176
|
);
|
|
177
177
|
}
|
|
178
|
-
|
|
179
|
-
return `outerlayer-build-${buildId}`;
|
|
180
|
-
}
|
|
181
|
-
function linkIn(buildDir2, name, source) {
|
|
182
|
-
const target = join(buildDir2, name);
|
|
183
|
-
rmSync(target, { force: true });
|
|
184
|
-
try {
|
|
185
|
-
linkSync(source, target);
|
|
186
|
-
} catch (err) {
|
|
187
|
-
if (err.code === "EXDEV") {
|
|
188
|
-
throw new Error(`${source} and ${buildDir2} are on different file systems, so the build's files cannot be linked into its jail`);
|
|
189
|
-
}
|
|
190
|
-
throw err;
|
|
191
|
-
}
|
|
192
|
-
chmodSync(source, 292);
|
|
193
|
-
}
|
|
194
|
-
async function startJailed(input) {
|
|
195
|
-
linkIn(input.buildDir, "kernel", input.kernel);
|
|
196
|
-
linkIn(input.buildDir, "rootfs.ext4", input.rootfs);
|
|
197
|
-
for (const name of input.sockets) {
|
|
198
|
-
try {
|
|
199
|
-
chmodSync(join(input.buildDir, name), 438);
|
|
200
|
-
} catch (err) {
|
|
201
|
-
if (err.code !== "ENOENT") throw err;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return input.client.start({ build: input.buildId, kind: input.kind, ...input.timeLimitMinutes === void 0 ? {} : { timeLimitMinutes: input.timeLimitMinutes } });
|
|
205
|
-
}
|
|
206
|
-
async function startJailedInto(state, input, save) {
|
|
207
|
-
state.jailed = { unit: unitNameFor(state.buildId), chroot: "" };
|
|
208
|
-
save();
|
|
209
|
-
try {
|
|
210
|
-
const started = await startJailed({ ...input, buildId: state.buildId, buildDir: state.buildDir });
|
|
211
|
-
state.jailed = { unit: started.unit, chroot: started.chroot };
|
|
212
|
-
state.vsockPath = started.vsock;
|
|
213
|
-
} catch (err) {
|
|
214
|
-
if (err instanceof HelperRefusal) {
|
|
215
|
-
delete state.jailed;
|
|
216
|
-
save();
|
|
217
|
-
}
|
|
218
|
-
throw err;
|
|
219
|
-
}
|
|
220
|
-
save();
|
|
221
|
-
}
|
|
222
|
-
async function stopJailed(helper, state) {
|
|
223
|
-
const probe = await helper.probe();
|
|
224
|
-
if (!probe.ok) throw new Error(`the build's unit ${state.jailed?.unit ?? unitNameFor(state.buildId)} could not be stopped, because there is no helper to ask: ${probe.detail}`);
|
|
225
|
-
try {
|
|
226
|
-
await probe.client.stop(state.buildId);
|
|
227
|
-
} catch (err) {
|
|
228
|
-
throw new Error(`the build's unit ${state.jailed?.unit ?? unitNameFor(state.buildId)} was not stopped: ${describeCallFailure(err)}`);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// src/runner/microvm/hooks.ts
|
|
178
|
+
var MANAGED_NO_BUILDER_DISK_REASON = "this release of the CLI pins no builder root disk, and a managed runner builds its images in a builder microVM, never on the host. The build did not start; update the CLI";
|
|
233
179
|
var DEFAULT_MEMORY = "8g";
|
|
234
180
|
var DEFAULT_DISK = "40g";
|
|
235
181
|
var DEFAULT_CPUS = 4;
|
|
@@ -287,12 +233,6 @@ function vmAlive(runtime, state) {
|
|
|
287
233
|
if (state.jailed !== void 0) return runtime.vm.helper.alive(state.jailed.unit);
|
|
288
234
|
return state.firecracker !== void 0 && runtime.vm.firecracker.alive(state.firecracker);
|
|
289
235
|
}
|
|
290
|
-
function makeBuildsDirPrivate(buildDir2) {
|
|
291
|
-
const builds = dirname(buildDir2);
|
|
292
|
-
const stat = statSync(builds);
|
|
293
|
-
if (stat.uid === process.getuid?.() && (stat.mode & 18) !== 0) chmodSync(builds, 448);
|
|
294
|
-
}
|
|
295
|
-
var MANAGED_UNJAILED_REASON = "the root helper does not answer, and a managed runner starts no build without the jailer. The build did not start; restore the helper with `outerlayer runner install --service --replace`";
|
|
296
236
|
async function helperFor(runtime, log, managed) {
|
|
297
237
|
const probe = await runtime.vm.helper.probe();
|
|
298
238
|
if (probe.ok) {
|
|
@@ -368,6 +308,17 @@ async function provisionMicroVm(input) {
|
|
|
368
308
|
const governing = await resolveGoverningSource({ config, repository, fetchImpl: input.fetchImpl });
|
|
369
309
|
if (!governing.ok) return fail(governing.reason);
|
|
370
310
|
const governingSource = governing.source;
|
|
311
|
+
const limits = {
|
|
312
|
+
cpus: config.build?.cpus ?? DEFAULT_CPUS,
|
|
313
|
+
memoryBytes: buildMemoryBytes(config),
|
|
314
|
+
diskBytes: parseSize(config.build?.disk ?? DEFAULT_DISK) ?? parseSize(DEFAULT_DISK)
|
|
315
|
+
};
|
|
316
|
+
let buildsInBuilder = imageBuildOf(config) === "vm";
|
|
317
|
+
if (buildsInBuilder && !vm.builderDiskPinned()) {
|
|
318
|
+
if (config.managed === true) return fail(MANAGED_NO_BUILDER_DISK_REASON);
|
|
319
|
+
log.line(`${tag} this release of the CLI pins no builder root disk, so the image builds on the host, as it does with runner.build.imageBuild set to host`);
|
|
320
|
+
buildsInBuilder = false;
|
|
321
|
+
}
|
|
371
322
|
const obtained = await obtainImage({
|
|
372
323
|
config,
|
|
373
324
|
runtime,
|
|
@@ -380,10 +331,22 @@ async function provisionMicroVm(input) {
|
|
|
380
331
|
aborted: input.aborted,
|
|
381
332
|
deadlineMs: input.deadlineMs,
|
|
382
333
|
now: input.now,
|
|
383
|
-
guestHelper: { path: assets.helper, sha256: assets.helperSha256 }
|
|
334
|
+
guestHelper: { path: assets.helper, sha256: assets.helperSha256 },
|
|
335
|
+
...buildsInBuilder ? {
|
|
336
|
+
inBuilder: {
|
|
337
|
+
kernel: assets.kernel,
|
|
338
|
+
firecracker: assets.firecracker,
|
|
339
|
+
limits,
|
|
340
|
+
memory: config.build?.memory,
|
|
341
|
+
allowHosts: config.build?.allowHosts,
|
|
342
|
+
managed: config.managed === true,
|
|
343
|
+
timeLimitMinutes: config.timeLimitMinutes
|
|
344
|
+
}
|
|
345
|
+
} : {}
|
|
384
346
|
});
|
|
385
347
|
if (!obtained.ok) return obtained.aborted === true ? { ok: false, reason: obtained.reason, aborted: true } : fail(obtained.reason);
|
|
386
348
|
const { report } = obtained.built;
|
|
349
|
+
const madeInBuilder = "rootfs" in obtained.built ? obtained.built.rootfs : void 0;
|
|
387
350
|
const buildId = randomBytes(6).toString("hex");
|
|
388
351
|
const buildDir2 = buildDir(config.configPath, buildId);
|
|
389
352
|
const state = {
|
|
@@ -438,11 +401,16 @@ async function provisionMicroVm(input) {
|
|
|
438
401
|
};
|
|
439
402
|
if (input.aborted()) return bail("", true);
|
|
440
403
|
let imageConfig;
|
|
441
|
-
|
|
442
|
-
state.rootfs =
|
|
443
|
-
imageConfig =
|
|
444
|
-
}
|
|
445
|
-
|
|
404
|
+
if (madeInBuilder !== void 0) {
|
|
405
|
+
state.rootfs = madeInBuilder.path;
|
|
406
|
+
imageConfig = { env: madeInBuilder.env, user: madeInBuilder.user };
|
|
407
|
+
} else {
|
|
408
|
+
try {
|
|
409
|
+
state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: runnerDirPath, imageId: report.imageId, memoryBytes: buildMemoryBytes(config) });
|
|
410
|
+
imageConfig = await vm.rootfs.imageConfig(report.imageId);
|
|
411
|
+
} catch (err) {
|
|
412
|
+
return bail(`the image could not be converted to a root disk: ${describeCallFailure(err)}`);
|
|
413
|
+
}
|
|
446
414
|
}
|
|
447
415
|
state.imageEnv = imageConfig.env;
|
|
448
416
|
state.buildDisk = join(buildDir2, "build.ext4");
|
|
@@ -460,11 +428,6 @@ async function provisionMicroVm(input) {
|
|
|
460
428
|
} catch (err) {
|
|
461
429
|
return bail(`the tunnel could not start: ${describeCallFailure(err)}`);
|
|
462
430
|
}
|
|
463
|
-
const limits = {
|
|
464
|
-
cpus: config.build?.cpus ?? DEFAULT_CPUS,
|
|
465
|
-
memoryBytes: buildMemoryBytes(config),
|
|
466
|
-
diskBytes: parseSize(config.build?.disk ?? DEFAULT_DISK) ?? parseSize(DEFAULT_DISK)
|
|
467
|
-
};
|
|
468
431
|
const links = vsockLinks({ destinations: config.build?.destinations?.length ?? 0, builtIns: true });
|
|
469
432
|
const served = input.leaseTimeLeftMs === void 0 ? links : [...links, LEASE_LINK];
|
|
470
433
|
let leaseServer;
|
|
@@ -928,10 +891,15 @@ async function startCheckMicroVm(input) {
|
|
|
928
891
|
return fail(err instanceof AssetError ? err.message : `the microVM's assets could not be had: ${describeCallFailure(err)}`);
|
|
929
892
|
}
|
|
930
893
|
if (abandoned()) return fail(ABANDONED);
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
894
|
+
if (built.imageId.startsWith(ROOT_DISK_ID_PREFIX)) {
|
|
895
|
+
if (built.rootfs === void 0 || !existsSync(built.rootfs)) return fail("the build's root disk is no longer stored, so the check environment cannot start from it");
|
|
896
|
+
state.rootfs = built.rootfs;
|
|
897
|
+
} else {
|
|
898
|
+
try {
|
|
899
|
+
state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: runnerDirPath, imageId: built.imageId, memoryBytes: buildMemoryBytes(config) });
|
|
900
|
+
} catch (err) {
|
|
901
|
+
return fail(`the image could not be converted to a root disk: ${describeCallFailure(err)}`);
|
|
902
|
+
}
|
|
935
903
|
}
|
|
936
904
|
if (abandoned()) return fail(ABANDONED);
|
|
937
905
|
state.buildDisk = join(buildDir2, "build.ext4");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { claimPidFile, RunnerAlreadyRunningError, releasePidFile } from './chunk-
|
|
3
|
+
import { claimPidFile, RunnerAlreadyRunningError, releasePidFile } from './chunk-IPJ6HR7E.js';
|
|
4
4
|
import { startTimeOf } from './chunk-JBJTC3UU.js';
|
|
5
5
|
import { RecipeError, locateRecipe, readRecipe, assertBuildable, writeSanitizedRecipe, classifyProperties, SANITIZED_NAME } from './chunk-3Z3MPR55.js';
|
|
6
|
-
import {
|
|
7
|
-
import { RUNNER_DIR_MODE, repoCacheDir, imagesDir, attemptStamp, runnerDir, rootfsPathFor
|
|
8
|
-
import { withGitConfig, tokenHeader
|
|
6
|
+
import { GH_VERSION, VOICE_PACK_FILES, VOICE_PACK_VERSION, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, TINI_SHA256, TINI_VERSION, CLAUDE_CODE_VERSION, NODE_IMAGE, DEFAULT_BASE_IMAGE, MEDIA_PINS } from './chunk-LHYO4RDP.js';
|
|
7
|
+
import { RUNNER_DIR_MODE, RUNNER_FILE_MODE, repoCacheDir, imagesDir, attemptStamp, runnerDir, rootfsPathFor } from './chunk-ESP5VZBD.js';
|
|
8
|
+
import { PROXY_WARNING_FLAG, withGitConfig, tokenHeader } from './chunk-HDSDUTX4.js';
|
|
9
9
|
import { RELAY_ID, RELAY_USER } from './chunk-MESOOLF4.js';
|
|
10
|
-
import { mkdirSync, rmSync, existsSync, mkdtempSync, cpSync, readFileSync,
|
|
10
|
+
import { mkdirSync, rmSync, writeFileSync, existsSync, mkdtempSync, cpSync, readFileSync, readdirSync, lstatSync, readlinkSync } from 'fs';
|
|
11
11
|
import { tmpdir } from 'os';
|
|
12
12
|
import { dirname, join } from 'path';
|
|
13
13
|
import { execFile } from 'child_process';
|
|
@@ -147,6 +147,11 @@ async function cloneRepository(remote, dest, timeoutMs = CLONE_TIMEOUT_MS) {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
// src/runner/image/dockerfiles.ts
|
|
150
|
+
var FETCHED_DIR = "fetched";
|
|
151
|
+
var FETCHED_VOICE_DIR = "voice";
|
|
152
|
+
var FETCHED_FFMPEG = "ffmpeg.tar.xz";
|
|
153
|
+
var FETCHED_GH = "gh.tgz";
|
|
154
|
+
var FETCHED_TINI = "tini";
|
|
150
155
|
function plain(name, value, allowed) {
|
|
151
156
|
if (!allowed.test(value)) throw new Error(`${name} holds a character a Dockerfile line cannot carry safely: ${JSON.stringify(value)}`);
|
|
152
157
|
return value;
|
|
@@ -185,26 +190,31 @@ function toolsDockerfile(parts) {
|
|
|
185
190
|
const stream = `NODE_USE_ENV_PROXY=1 node ${PROXY_WARNING_FLAG} -e 'const{pipeline}=require("stream/promises"),{Readable}=require("stream"),fs=require("fs");fetch(process.argv[1]).then((r)=>{if(!r.ok)throw new Error(process.argv[1]+" "+r.status);return pipeline(Readable.fromWeb(r.body),fs.createWriteStream(process.argv[2]))})'`;
|
|
186
191
|
const voiceDir = `/out/opt/outerlayer/voice/${VOICE_PACK_VERSION}`;
|
|
187
192
|
const checks = VOICE_PACK_FILES.map((file) => `echo "${file.sha256} ${voiceDir}/${file.name}" | sha256sum -c -`);
|
|
188
|
-
|
|
193
|
+
const fetched = parts.fetched === true;
|
|
194
|
+
const voice = fetched ? [`FROM ${nodeImage} AS voice`, `COPY ${FETCHED_DIR}/${FETCHED_VOICE_DIR}/ ${voiceDir}/`, `RUN ${checks.join(" \\\n && ")} \\`, " && chmod -R a+rX /out"] : [
|
|
189
195
|
// The voice pack streams to disk, one pinned file at a time, because a 300 MB model must not sit in a build's memory. Its own stage keeps it cached when the CLI changes.
|
|
190
196
|
`FROM ${nodeImage} AS voice`,
|
|
191
197
|
`RUN mkdir -p ${voiceDir} \\`,
|
|
192
198
|
...VOICE_PACK_FILES.map((file) => ` && ${stream} ${file.url} ${voiceDir}/${file.name} \\`),
|
|
193
199
|
...checks.map((check) => ` && ${check} \\`),
|
|
194
|
-
" && chmod -R a+rX /out"
|
|
200
|
+
" && chmod -R a+rX /out"
|
|
201
|
+
];
|
|
202
|
+
return [
|
|
203
|
+
...voice,
|
|
195
204
|
// ffmpeg and ffprobe are static LGPL builds. espeak-ng comes from the stage image's own package, with the libraries and loader it needs, and runs as a separate program.
|
|
196
205
|
`FROM ${nodeImage} AS media`,
|
|
197
206
|
"ARG TARGETARCH",
|
|
198
207
|
"RUN apt-get update \\",
|
|
199
208
|
" && apt-get install -y --no-install-recommends ca-certificates espeak-ng xz-utils \\",
|
|
200
209
|
" && rm -rf /var/lib/apt/lists/*",
|
|
210
|
+
...fetched ? [`COPY ${FETCHED_DIR}/${FETCHED_FFMPEG} /tmp/ffmpeg.tar.xz`] : [],
|
|
201
211
|
"RUN set -eu \\",
|
|
202
212
|
` && case "$TARGETARCH" in \\`,
|
|
203
213
|
` amd64) ffmpeg_file=${FFMPEG_STATIC.amd64.file}; ffmpeg_sha=${FFMPEG_STATIC.amd64.sha256} ;; \\`,
|
|
204
214
|
` arm64) ffmpeg_file=${FFMPEG_STATIC.arm64.file}; ffmpeg_sha=${FFMPEG_STATIC.arm64.sha256} ;; \\`,
|
|
205
215
|
` *) echo "no pinned ffmpeg for $TARGETARCH" >&2; exit 1 ;; \\`,
|
|
206
216
|
" esac \\",
|
|
207
|
-
` && ${download} https://github.com/BtbN/FFmpeg-Builds/releases/download/${FFMPEG_BUILD_TAG}/$ffmpeg_file /tmp/ffmpeg.tar.xz
|
|
217
|
+
...fetched ? [] : [` && ${download} https://github.com/BtbN/FFmpeg-Builds/releases/download/${FFMPEG_BUILD_TAG}/$ffmpeg_file /tmp/ffmpeg.tar.xz \\`],
|
|
208
218
|
' && echo "$ffmpeg_sha /tmp/ffmpeg.tar.xz" | sha256sum -c - \\',
|
|
209
219
|
" && tar -xJf /tmp/ffmpeg.tar.xz -C /tmp \\",
|
|
210
220
|
" && mkdir -p /out/usr/local/bin /out/opt/outerlayer/media/lib \\",
|
|
@@ -239,16 +249,17 @@ function toolsDockerfile(parts) {
|
|
|
239
249
|
"RUN chmod 0755 /out/opt/outerlayer/bin/outerlayer-guest \\",
|
|
240
250
|
" && mkdir -p /out/outerlayer/job /out/outerlayer/judge /out/run /out/proc /out/sys /out/dev"
|
|
241
251
|
] : [],
|
|
252
|
+
...fetched ? [`COPY ${FETCHED_DIR}/${FETCHED_TINI} /tmp/tini`, `COPY ${FETCHED_DIR}/${FETCHED_GH} /tmp/gh.tgz`] : [],
|
|
242
253
|
`RUN set -eu \\`,
|
|
243
254
|
` && case "$TARGETARCH" in \\`,
|
|
244
255
|
` amd64) gh_sha=${GH_SHA256.amd64}; tini_sha=${TINI_SHA256.amd64} ;; \\`,
|
|
245
256
|
` arm64) gh_sha=${GH_SHA256.arm64}; tini_sha=${TINI_SHA256.arm64} ;; \\`,
|
|
246
257
|
` *) echo "no pinned gh and tini for $TARGETARCH" >&2; exit 1 ;; \\`,
|
|
247
258
|
" esac \\",
|
|
248
|
-
` && ${download} https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-$TARGETARCH /tmp/tini
|
|
259
|
+
...fetched ? [] : [` && ${download} https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-$TARGETARCH /tmp/tini \\`],
|
|
249
260
|
' && echo "$tini_sha /tmp/tini" | sha256sum -c - \\',
|
|
250
261
|
" && install -m 0755 /tmp/tini /out/opt/outerlayer/bin/tini \\",
|
|
251
|
-
` && ${download} https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_$TARGETARCH.tar.gz /tmp/gh.tgz
|
|
262
|
+
...fetched ? [] : [` && ${download} https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_$TARGETARCH.tar.gz /tmp/gh.tgz \\`],
|
|
252
263
|
' && echo "$gh_sha /tmp/gh.tgz" | sha256sum -c - \\',
|
|
253
264
|
" && tar -xzf /tmp/gh.tgz -C /tmp \\",
|
|
254
265
|
` && install -m 0755 /tmp/gh_${GH_VERSION}_linux_$TARGETARCH/bin/gh /out/usr/local/bin/gh`,
|
|
@@ -362,15 +373,18 @@ async function fetchPinnedCommit(opts) {
|
|
|
362
373
|
if (!fetched.ok) throw new RecipeError("repository_unreadable", `cannot read ${opts.repository}: ${fetched.reason}`);
|
|
363
374
|
return { dir: opts.dir, defaultBranch: opts.ref, commit: opts.commit };
|
|
364
375
|
}
|
|
365
|
-
function
|
|
376
|
+
function metadataFromLabels(labels) {
|
|
366
377
|
try {
|
|
367
|
-
const parsed = JSON.parse(
|
|
378
|
+
const parsed = JSON.parse(labels["devcontainer.metadata"] ?? "[]");
|
|
368
379
|
const entries = Array.isArray(parsed) ? parsed : [parsed];
|
|
369
380
|
return entries.filter((e) => typeof e === "object" && e !== null && !Array.isArray(e));
|
|
370
381
|
} catch {
|
|
371
382
|
return [];
|
|
372
383
|
}
|
|
373
384
|
}
|
|
385
|
+
function metadataOf(image) {
|
|
386
|
+
return metadataFromLabels(image.labels);
|
|
387
|
+
}
|
|
374
388
|
function readReport(recordDir) {
|
|
375
389
|
try {
|
|
376
390
|
return JSON.parse(readFileSync(join(recordDir, "recipe.json"), "utf8"));
|
|
@@ -386,8 +400,7 @@ function writeRecord(recordDir, report, builtAt) {
|
|
|
386
400
|
writeFileSync(join(recordDir, "recipe.json"), `${JSON.stringify(report, null, 2)}
|
|
387
401
|
`, { mode: RUNNER_FILE_MODE });
|
|
388
402
|
}
|
|
389
|
-
async function
|
|
390
|
-
const { host } = ports;
|
|
403
|
+
async function prepareImageBuild(opts) {
|
|
391
404
|
const { full: repository, owner, name } = splitRepository(opts.repository);
|
|
392
405
|
if (!existsSync(join(opts.cli.distDir, "index.js"))) {
|
|
393
406
|
throw new Error(`${opts.cli.distDir} holds no index.js: the tools layer copies the built CLI, so run this from a build (yarn workspace @outerlayer/cli build)`);
|
|
@@ -396,7 +409,6 @@ async function buildRepositoryImage(opts, ports) {
|
|
|
396
409
|
const claudeCodeVersion = opts.claudeCodeVersion ?? CLAUDE_CODE_VERSION;
|
|
397
410
|
const nodeImage = opts.nodeImage ?? NODE_IMAGE;
|
|
398
411
|
const baseImage = opts.defaultBaseImage ?? DEFAULT_BASE_IMAGE;
|
|
399
|
-
const scratchRoot = opts.tmpDir ?? tmpdir();
|
|
400
412
|
const cacheDir = repoCacheDir(opts.configPath, owner, name);
|
|
401
413
|
const repoRecords = join(imagesDir(opts.configPath), owner, name);
|
|
402
414
|
const logPath = join(repoRecords, "builds", `${attemptStamp(now())}.log`);
|
|
@@ -411,6 +423,7 @@ async function buildRepositoryImage(opts, ports) {
|
|
|
411
423
|
}
|
|
412
424
|
throw err;
|
|
413
425
|
}
|
|
426
|
+
const release = () => releasePidFile(lockPath, self);
|
|
414
427
|
try {
|
|
415
428
|
const remote = opts.remote ?? `https://github.com/${owner}/${name}.git`;
|
|
416
429
|
const checkout = opts.pinned === void 0 ? await fetchDefaultBranch({ remote, dir: cacheDir, token: opts.readToken, repository }) : await fetchPinnedCommit({ remote, dir: cacheDir, token: opts.readToken, repository, ...opts.pinned });
|
|
@@ -421,8 +434,21 @@ async function buildRepositoryImage(opts, ports) {
|
|
|
421
434
|
const rKey = recipeKey(checkout.dir, location, defaultText);
|
|
422
435
|
const tKey = toolsKey({ buildId: opts.cli.buildId, claudeCodeVersion, nodeImage, ghVersion: GH_VERSION, tiniVersion: TINI_VERSION, guestHelperSha256: opts.guestHelper?.sha256, mediaPins: MEDIA_PINS });
|
|
423
436
|
const recordDir = join(repoRecords, `${rKey.slice(0, KEY_PREFIX)}-${tKey.slice(0, KEY_PREFIX)}`);
|
|
424
|
-
|
|
425
|
-
|
|
437
|
+
return { repository, owner, name, repoRecords, recordDir, checkout, location, recipe, recipeKey: rKey, toolsKey: tKey, defaultText, claudeCodeVersion, nodeImage, logPath, release };
|
|
438
|
+
} catch (err) {
|
|
439
|
+
release();
|
|
440
|
+
throw err;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
async function buildRepositoryImage(opts, ports) {
|
|
444
|
+
const { host } = ports;
|
|
445
|
+
const now = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
446
|
+
const scratchRoot = opts.tmpDir ?? tmpdir();
|
|
447
|
+
const prepared = await prepareImageBuild(opts);
|
|
448
|
+
const { repository, repoRecords, checkout, location, recipe, recipeKey: rKey, toolsKey: tKey, defaultText, claudeCodeVersion, nodeImage, recordDir, logPath } = prepared;
|
|
449
|
+
const buildTag = `${TAG_HOST}/build/${repository}:${rKey.slice(0, KEY_PREFIX)}-${tKey.slice(0, KEY_PREFIX)}`;
|
|
450
|
+
const recipeTag = `${TAG_HOST}/recipe/${repository}:${rKey.slice(0, KEY_PREFIX)}`;
|
|
451
|
+
try {
|
|
426
452
|
const existing = await host.list(repository);
|
|
427
453
|
const labelled = existing.find((i) => i.labels[KIND2] === "recipe" && i.labels[RECIPE_KEY2] === rKey);
|
|
428
454
|
const recipeImageBefore = labelled !== void 0 && (await host.inspect(recipeTag))?.id === labelled.id ? labelled : void 0;
|
|
@@ -538,7 +564,7 @@ async function buildRepositoryImage(opts, ports) {
|
|
|
538
564
|
removed
|
|
539
565
|
};
|
|
540
566
|
} finally {
|
|
541
|
-
|
|
567
|
+
prepared.release();
|
|
542
568
|
}
|
|
543
569
|
}
|
|
544
570
|
async function prune(host, repository, repoRecords, keep, runnerDirPath) {
|
|
@@ -564,4 +590,4 @@ async function prune(host, repository, repoRecords, keep, runnerDirPath) {
|
|
|
564
590
|
return removed;
|
|
565
591
|
}
|
|
566
592
|
|
|
567
|
-
export { buildRepositoryImage, cloneRepository, diffBetween, fetchCommit, readBranchHead, readDefaultBranchHead };
|
|
593
|
+
export { FETCHED_DIR, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_VOICE_DIR, KEY_PREFIX, TAG_HOST, buildRepositoryImage, cloneRepository, diffBetween, fetchCommit, metadataFromLabels, prepareImageBuild, readBranchHead, readDefaultBranchHead, toolsDockerfile, writeRecord };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { LiveUploader } from './chunk-
|
|
4
|
-
import { CaptureDaemon } from './chunk-
|
|
5
|
-
import { spoolDir } from './chunk-
|
|
3
|
+
import { LiveUploader } from './chunk-NNNUME4Y.js';
|
|
4
|
+
import { CaptureDaemon } from './chunk-XT5SOJRC.js';
|
|
5
|
+
import { spoolDir } from './chunk-OXSFOLWE.js';
|
|
6
6
|
import { parseWorkItemEnv } from './chunk-T2Q7ISPE.js';
|
|
7
7
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
8
8
|
import { mkdirSync, writeFileSync, rmSync } from 'fs';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { sanitizeTerminal } from './chunk-3H7NZPYG.js';
|
|
4
|
-
import { remoteLookupFailed } from './chunk-
|
|
4
|
+
import { remoteLookupFailed } from './chunk-XT5SOJRC.js';
|
|
5
5
|
import { isAgentsMdLayout } from './chunk-ZAJKEHIE.js';
|
|
6
6
|
import { DEFAULT_DASHBOARD } from './chunk-6C3ZVE62.js';
|
|
7
|
-
import { cliFetch, resolveGatewayCredentials } from './chunk-
|
|
7
|
+
import { cliFetch, resolveGatewayCredentials } from './chunk-VQ2JGZSC.js';
|
|
8
8
|
import { readCloudConfig } from './chunk-PJDQPF5N.js';
|
|
9
9
|
import { findGitDirs, writeRepoConnection, readRepoConnection } from './chunk-BJ3KTMDH.js';
|
|
10
10
|
import { cliInvocation } from './chunk-CRB3POP4.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { readCloudConfigStrict, readCloudConfig, cloudConfigPath } from './chunk-PJDQPF5N.js';
|
|
4
|
-
import { signRunnerRequest, signerFor } from './chunk-
|
|
4
|
+
import { signRunnerRequest, signerFor } from './chunk-JT3YO5MH.js';
|
|
5
5
|
import { readRepoConnection, findGitDirs } from './chunk-BJ3KTMDH.js';
|
|
6
6
|
import { PLAIN_VERSION, recordCliVersion, removeRecordedVersion } from './chunk-5BHIBJDA.js';
|
|
7
7
|
import { resolvePackageVersion } from './chunk-RA3O54FC.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { removeRetiredSkills } from './chunk-FE3RTGJN.js';
|
|
4
|
-
import { defaultFetch, resolveGatewayCredentials } from './chunk-
|
|
4
|
+
import { defaultFetch, resolveGatewayCredentials } from './chunk-VQ2JGZSC.js';
|
|
5
5
|
import { withTokenHeader } from './chunk-HDSDUTX4.js';
|
|
6
6
|
import { appendContextProvenance } from './chunk-ZJSNLVCE.js';
|
|
7
7
|
import { loadMaintainedFiles, writeMaintainedFiles } from './chunk-YW4PEGLN.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { MIN_ENGINE_MAJOR } from './chunk-
|
|
4
|
-
import { runnerImageVersion } from './chunk-
|
|
5
|
-
import { firecrackerArch, MICROVM_ARCHES, guestAssetsPinned } from './chunk-
|
|
3
|
+
import { MIN_ENGINE_MAJOR } from './chunk-BBK62GXM.js';
|
|
4
|
+
import { runnerImageVersion } from './chunk-533QGXGZ.js';
|
|
5
|
+
import { firecrackerArch, MICROVM_ARCHES, guestAssetsPinned } from './chunk-LHYO4RDP.js';
|
|
6
6
|
import { spawnSync } from 'child_process';
|
|
7
7
|
import { existsSync, accessSync, constants, statSync, readFileSync } from 'fs';
|
|
8
8
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { detectActiveSession, autoConnect } from './chunk-
|
|
4
|
-
import { workPageUrl } from './chunk-
|
|
3
|
+
import { detectActiveSession, autoConnect } from './chunk-ZPW6PUNK.js';
|
|
4
|
+
import { workPageUrl } from './chunk-VFW6I4GG.js';
|
|
5
5
|
import { sanitizeTerminal } from './chunk-3H7NZPYG.js';
|
|
6
|
-
import { resolveRepoIdentity } from './chunk-
|
|
6
|
+
import { resolveRepoIdentity } from './chunk-XT5SOJRC.js';
|
|
7
7
|
import { C } from './chunk-ANPNT6PM.js';
|
|
8
|
-
import { resolveGatewayCredentials, unauthorizedMessage, defaultFetch } from './chunk-
|
|
9
|
-
import { signRunnerRequest } from './chunk-
|
|
8
|
+
import { resolveGatewayCredentials, unauthorizedMessage, defaultFetch } from './chunk-VQ2JGZSC.js';
|
|
9
|
+
import { signRunnerRequest } from './chunk-JT3YO5MH.js';
|
|
10
10
|
import { readRepoConnection } from './chunk-BJ3KTMDH.js';
|
|
11
11
|
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
12
12
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
@@ -441,7 +441,7 @@ async function runWorkLinkSession(opts) {
|
|
|
441
441
|
return await linkSession(opts);
|
|
442
442
|
} catch (err) {
|
|
443
443
|
if (opts.logFailures) {
|
|
444
|
-
const { logHookError } = await import('./hook-fast-
|
|
444
|
+
const { logHookError } = await import('./hook-fast-GO7UTNN5.js');
|
|
445
445
|
const reason = err instanceof Error ? err.message : String(err);
|
|
446
446
|
logHookError(opts.home ?? homeFromEnv(opts.env ?? process.env), new Error(`work link-session #${opts.number} failed: ${reason}`));
|
|
447
447
|
}
|
|
@@ -68435,18 +68435,38 @@ function parseTranscript(content, opts = {}) {
|
|
|
68435
68435
|
const unknownModels = /* @__PURE__ */ new Set();
|
|
68436
68436
|
const blobs = /* @__PURE__ */ new Map();
|
|
68437
68437
|
let open22 = null;
|
|
68438
|
+
const usageTurnByMessageId = /* @__PURE__ */ new Map();
|
|
68439
|
+
const addToTotals = (usage, sign) => {
|
|
68440
|
+
totals.in += sign * usage.in;
|
|
68441
|
+
totals.out += sign * usage.out;
|
|
68442
|
+
totals.cacheRead += sign * usage.cacheRead;
|
|
68443
|
+
totals.cacheCreate += sign * usage.cacheCreate;
|
|
68444
|
+
};
|
|
68445
|
+
const addCost = (costUsd, sign) => {
|
|
68446
|
+
if (typeof costUsd !== "number") return;
|
|
68447
|
+
totalCost += sign * costUsd;
|
|
68448
|
+
anyCostKnown = true;
|
|
68449
|
+
};
|
|
68438
68450
|
const flushOpen = () => {
|
|
68439
68451
|
if (!open22) return;
|
|
68440
68452
|
const turn = finalizeAssistant(open22, turnIndex, toolCallsById, models, unknownModels);
|
|
68441
|
-
|
|
68442
|
-
|
|
68443
|
-
|
|
68444
|
-
|
|
68445
|
-
|
|
68446
|
-
|
|
68447
|
-
|
|
68448
|
-
|
|
68449
|
-
|
|
68453
|
+
const usageTurn = turn.messageId ? usageTurnByMessageId.get(turn.messageId) : void 0;
|
|
68454
|
+
if ((usageTurn == null ? void 0 : usageTurn.usage) && turn.usage) {
|
|
68455
|
+
const merged = maxUsage(usageTurn.usage, turn.usage);
|
|
68456
|
+
addToTotals(usageTurn.usage, -1);
|
|
68457
|
+
addToTotals(merged, 1);
|
|
68458
|
+
usageTurn.usage = merged;
|
|
68459
|
+
if (usageTurn.model) {
|
|
68460
|
+
addCost(usageTurn.costUsd, -1);
|
|
68461
|
+
usageTurn.costUsd = costOfUsage(usageTurn.model, merged);
|
|
68462
|
+
addCost(usageTurn.costUsd, 1);
|
|
68463
|
+
}
|
|
68464
|
+
turn.usage = { in: 0, out: 0, cacheRead: 0, cacheCreate: 0, ...merged.speed ? { speed: merged.speed } : {} };
|
|
68465
|
+
turn.costUsd = turn.model ? costOfUsage(turn.model, turn.usage) : null;
|
|
68466
|
+
} else if (turn.usage) {
|
|
68467
|
+
if (turn.messageId) usageTurnByMessageId.set(turn.messageId, turn);
|
|
68468
|
+
addToTotals(turn.usage, 1);
|
|
68469
|
+
addCost(turn.costUsd, 1);
|
|
68450
68470
|
}
|
|
68451
68471
|
turns.push(turn);
|
|
68452
68472
|
turnIndex += 1;
|
|
@@ -68766,27 +68786,30 @@ function extractInlineImages(value, blobs, images) {
|
|
|
68766
68786
|
}
|
|
68767
68787
|
return changed ? out : obj;
|
|
68768
68788
|
}
|
|
68789
|
+
function maxUsage(a, b) {
|
|
68790
|
+
var _a5, _b, _c, _d, _e;
|
|
68791
|
+
const merged = {
|
|
68792
|
+
in: Math.max(a.in, b.in),
|
|
68793
|
+
out: Math.max(a.out, b.out),
|
|
68794
|
+
cacheRead: Math.max(a.cacheRead, b.cacheRead),
|
|
68795
|
+
cacheCreate: Math.max(a.cacheCreate, b.cacheCreate),
|
|
68796
|
+
// Same max-merge as the total it is a share of. Left unset when neither
|
|
68797
|
+
// reading carried the split, so the request still prices as all-5-minute
|
|
68798
|
+
// rather than as a zero-length 1-hour write.
|
|
68799
|
+
...a.cacheCreate1h !== void 0 || b.cacheCreate1h !== void 0 ? { cacheCreate1h: Math.max((_a5 = a.cacheCreate1h) != null ? _a5 : 0, (_b = b.cacheCreate1h) != null ? _b : 0) } : {},
|
|
68800
|
+
...((_c = a.speed) != null ? _c : b.speed) !== void 0 ? { speed: (_d = a.speed) != null ? _d : b.speed } : {}
|
|
68801
|
+
};
|
|
68802
|
+
merged.cacheCreate5m = merged.cacheCreate - Math.min((_e = merged.cacheCreate1h) != null ? _e : 0, merged.cacheCreate);
|
|
68803
|
+
return merged;
|
|
68804
|
+
}
|
|
68769
68805
|
function mergeAssistantLine(open22, line, tsIso) {
|
|
68770
|
-
var _a5
|
|
68806
|
+
var _a5;
|
|
68771
68807
|
if (!open22.ts && tsIso) open22.ts = tsIso;
|
|
68772
68808
|
const message = line.message;
|
|
68773
68809
|
const isSyntheticStub = line.isApiErrorMessage === true || (message == null ? void 0 : message.model) === "<synthetic>";
|
|
68774
68810
|
if (!isSyntheticStub && typeof (message == null ? void 0 : message.model) === "string" && !open22.model) open22.model = message.model;
|
|
68775
68811
|
const usage = readUsage(message == null ? void 0 : message.usage);
|
|
68776
|
-
if (usage)
|
|
68777
|
-
open22.usage = open22.usage ? {
|
|
68778
|
-
in: Math.max(open22.usage.in, usage.in),
|
|
68779
|
-
out: Math.max(open22.usage.out, usage.out),
|
|
68780
|
-
cacheRead: Math.max(open22.usage.cacheRead, usage.cacheRead),
|
|
68781
|
-
cacheCreate: Math.max(open22.usage.cacheCreate, usage.cacheCreate),
|
|
68782
|
-
// Same max-merge as the total it is a share of. Left unset when
|
|
68783
|
-
// neither line carried the split, so the turn still prices as
|
|
68784
|
-
// all-5-minute rather than as a zero-length 1-hour write.
|
|
68785
|
-
...open22.usage.cacheCreate1h !== void 0 || usage.cacheCreate1h !== void 0 ? { cacheCreate1h: Math.max((_a5 = open22.usage.cacheCreate1h) != null ? _a5 : 0, (_b = usage.cacheCreate1h) != null ? _b : 0) } : {},
|
|
68786
|
-
...((_c = open22.usage.speed) != null ? _c : usage.speed) !== void 0 ? { speed: (_d = open22.usage.speed) != null ? _d : usage.speed } : {}
|
|
68787
|
-
} : usage;
|
|
68788
|
-
open22.usage.cacheCreate5m = open22.usage.cacheCreate - Math.min((_e = open22.usage.cacheCreate1h) != null ? _e : 0, open22.usage.cacheCreate);
|
|
68789
|
-
}
|
|
68812
|
+
if (usage) open22.usage = open22.usage ? maxUsage(open22.usage, usage) : usage;
|
|
68790
68813
|
const content = message == null ? void 0 : message.content;
|
|
68791
68814
|
if (typeof content === "string") {
|
|
68792
68815
|
if (content && !open22.texts.includes(content)) open22.texts.push(content);
|
|
@@ -68825,7 +68848,7 @@ function mergeAssistantLine(open22, line, tsIso) {
|
|
|
68825
68848
|
open22.toolOrder.push(b.id);
|
|
68826
68849
|
}
|
|
68827
68850
|
} else {
|
|
68828
|
-
((
|
|
68851
|
+
((_a5 = open22.anonCalls) != null ? _a5 : open22.anonCalls = []).push(call);
|
|
68829
68852
|
}
|
|
68830
68853
|
break;
|
|
68831
68854
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { sanitizeTerminal } from './chunk-3H7NZPYG.js';
|
|
4
4
|
import { isAgentsMdLayout } from './chunk-ZAJKEHIE.js';
|
|
5
|
-
import { resolveGatewayCredentials, defaultFetch } from './chunk-
|
|
5
|
+
import { resolveGatewayCredentials, defaultFetch } from './chunk-VQ2JGZSC.js';
|
|
6
6
|
import { versionAtLeast } from './chunk-HCVLP7XA.js';
|
|
7
7
|
import { findGitDirs } from './chunk-BJ3KTMDH.js';
|
|
8
8
|
import { machineSkillsState, staleClaudeSkills } from './chunk-XRQ7DABQ.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { fetchFactories, selectFactory, saveFactoryConnection, autoConnectedLine } from './chunk-
|
|
4
|
-
import { resolveRepoIdentity } from './chunk-
|
|
5
|
-
import { resolveGatewayCredentials } from './chunk-
|
|
3
|
+
import { fetchFactories, selectFactory, saveFactoryConnection, autoConnectedLine } from './chunk-VFW6I4GG.js';
|
|
4
|
+
import { resolveRepoIdentity } from './chunk-XT5SOJRC.js';
|
|
5
|
+
import { resolveGatewayCredentials } from './chunk-VQ2JGZSC.js';
|
|
6
6
|
import { findGitDirs, readRepoConnection } from './chunk-BJ3KTMDH.js';
|
|
7
7
|
import { cliInvocation } from './chunk-CRB3POP4.js';
|
|
8
8
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
@@ -241,7 +241,7 @@ async function runClaudeLauncher(args, deps = {}) {
|
|
|
241
241
|
return 1;
|
|
242
242
|
}
|
|
243
243
|
} else {
|
|
244
|
-
const { resolveLaunchPlane } = await import('./control-plane-launch-
|
|
244
|
+
const { resolveLaunchPlane } = await import('./control-plane-launch-7PXJSMVM.js');
|
|
245
245
|
const plane = env[GOVERNANCE_VARIABLE] === "self" ? { kind: "none" } : await resolveLaunchPlane({ cwd, env, home, fetchImpl: deps.fetchImpl, stderr });
|
|
246
246
|
if (plane.kind === "none") {
|
|
247
247
|
const own2 = ownSkillsDirFor(cwd, home, [], stderr);
|