@outerlayer/cli 0.27.1 → 0.28.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/CHANGELOG.md +32 -0
- package/README.md +6 -0
- package/dist/{agent-setup-UW36TAQM.js → agent-setup-YVR5RO56.js} +17 -14
- package/dist/{bridge-B5VJVECY.js → bridge-WW2V7DTB.js} +3 -2
- package/dist/build-5FRC3RKM.js +13 -0
- package/dist/build-info.json +1 -1
- package/dist/{builder-6Y6ZWGNH.js → builder-4F2XNSFC.js} +7 -6
- package/dist/{check-YTXFVWK7.js → check-NDDOASVO.js} +70 -61
- package/dist/{chunk-VS27BP3E.js → chunk-2YSCKEL2.js} +7 -7
- package/dist/{chunk-BPKO76QR.js → chunk-4XN5FRRJ.js} +4 -4
- package/dist/{chunk-EPPIISRD.js → chunk-55XLX5PA.js} +1 -1
- package/dist/{chunk-LOKSLO25.js → chunk-5B7BEQPR.js} +1 -1
- package/dist/chunk-5BHIBJDA.js +93 -0
- package/dist/{chunk-RHAGBUL5.js → chunk-5K3KB4YR.js} +1 -1
- package/dist/{chunk-ABXQBEYK.js → chunk-66T6XJAB.js} +1 -1
- package/dist/{chunk-LPFOWUHG.js → chunk-6BWJQGTV.js} +20 -13
- package/dist/{chunk-BWH36FOC.js → chunk-7CK2TJFB.js} +20 -4
- package/dist/{chunk-5VMDGJGH.js → chunk-7UGFIWIW.js} +37 -23
- package/dist/{chunk-QKIQ2R7F.js → chunk-ATJOFXTE.js} +3 -3
- package/dist/chunk-CDDED64E.js +13 -0
- package/dist/{chunk-QHH4OSD4.js → chunk-CTYSTE5C.js} +1 -1
- package/dist/{chunk-DJHNEGNM.js → chunk-DKWQMPSL.js} +18 -2
- package/dist/{chunk-IMOB4IOI.js → chunk-DQYMQ47E.js} +3 -2
- package/dist/{chunk-YETTWTAY.js → chunk-E7R2GIAW.js} +4 -4
- package/dist/{chunk-GFUE5TKO.js → chunk-F4FA3ZUT.js} +24 -14
- package/dist/{chunk-6TRNCUM4.js → chunk-FGF52V4V.js} +1 -1
- package/dist/{chunk-MATUHHN4.js → chunk-GUXWQIEY.js} +1 -1
- package/dist/{chunk-2I3LIRZP.js → chunk-HXAEQPZR.js} +101 -10
- package/dist/{chunk-R7SGBXUD.js → chunk-IKXY47R5.js} +107 -56
- package/dist/{chunk-P33PZIWS.js → chunk-ITAIEJ2T.js} +7 -142
- package/dist/{chunk-RHGF73IU.js → chunk-IVX3U7KV.js} +1 -1
- package/dist/{chunk-7OUOLGUV.js → chunk-JGML2VUN.js} +3 -7
- package/dist/{chunk-6VFH52MP.js → chunk-KVDVNOUK.js} +24 -22
- package/dist/{chunk-2F762IXY.js → chunk-LNIFYSNK.js} +3 -3
- package/dist/{chunk-XBPUTQ7E.js → chunk-MHAR6S7B.js} +1 -1
- package/dist/{chunk-7AQ5AM7U.js → chunk-MQHTM4YJ.js} +177 -21
- package/dist/{chunk-6KKM7VGZ.js → chunk-N7WAEEIU.js} +3 -3
- package/dist/{chunk-D7ECMB7B.js → chunk-NUHZV3A4.js} +1 -1
- package/dist/{chunk-MHX7YX7Y.js → chunk-P2RWZCV7.js} +1 -1
- package/dist/chunk-QBQHQEUG.js +300 -0
- package/dist/{chunk-FP23SVDD.js → chunk-QJFDAKRF.js} +5 -5
- package/dist/{chunk-WUL2OP5A.js → chunk-QKXF7CLR.js} +3 -3
- package/dist/{chunk-Y7ZCHBYB.js → chunk-QWAYRAUX.js} +3 -3
- package/dist/{chunk-64GMBWAK.js → chunk-R7SS5RLJ.js} +6 -6
- package/dist/{chunk-XZ6Q6ZNR.js → chunk-SATUCMAJ.js} +3 -2
- package/dist/{chunk-2BTFKNTR.js → chunk-SJZL5F3F.js} +2 -2
- package/dist/{chunk-HWDYLXHH.js → chunk-T2QSWFSU.js} +4 -4
- package/dist/{chunk-B7DJVG25.js → chunk-T57XUI6N.js} +3 -3
- package/dist/{chunk-E5IJ5533.js → chunk-TF7G2PR6.js} +3 -3
- package/dist/{chunk-O2IJTY7L.js → chunk-TVZAC2NP.js} +3 -3
- package/dist/{chunk-QE3UQAHK.js → chunk-UHU7H57K.js} +26 -7
- package/dist/{chunk-WSYXLLA5.js → chunk-USJZ2LDK.js} +6 -6
- package/dist/{chunk-EX5MQYEF.js → chunk-VC5J7QPV.js} +5 -5
- package/dist/{chunk-N4D5TMVU.js → chunk-VU7ZJPIR.js} +5 -5
- package/dist/{chunk-ZFBJUOYT.js → chunk-W3FSGH2M.js} +10 -10
- package/dist/{chunk-GLUKDQS4.js → chunk-WWQVKFN6.js} +1 -1
- package/dist/{chunk-55GNQPO6.js → chunk-X52PMPOM.js} +7 -7
- package/dist/{chunk-YB3CSYXX.js → chunk-XD4ZCMA4.js} +81 -2
- package/dist/{chunk-Y4OKEFAX.js → chunk-YL2VDSNF.js} +1 -1
- package/dist/{chunk-M3MHHIUW.js → chunk-Z3ASAXVU.js} +1 -1
- package/dist/{chunk-XS3FDWSZ.js → chunk-ZTY7HHYB.js} +1 -1
- package/dist/{claude-launcher-NQSZBTQ5.js → claude-launcher-7RGVOYCD.js} +6 -5
- package/dist/{cli-GHEOBXC7.js → cli-QC6ZKHPK.js} +149 -128
- package/dist/cli-update-notice-4DLZ3655.js +9 -0
- package/dist/{command-V7B7GTPZ.js → command-3F6GY4CK.js} +53 -37
- package/dist/{config-TWS5VZEN.js → config-5QYIKYUP.js} +3 -2
- package/dist/{connect-cmd-HGS7YPA2.js → connect-cmd-5TYAOK5M.js} +14 -11
- package/dist/{container-start-FHB2VDC4.js → container-start-P7O5XGOB.js} +37 -36
- package/dist/{control-plane-launch-DBQA3KLJ.js → control-plane-launch-FZMD4MXX.js} +13 -10
- package/dist/{dist-QPHZE47F.js → dist-JFVKLUHL.js} +1 -1
- package/dist/{docker-YT6Z3LXI.js → docker-ZTC4EIU4.js} +7 -6
- package/dist/{doctor-Y4NCNSJM.js → doctor-QPQDF7FB.js} +159 -41
- package/dist/{emit-artifact-cmd-ALDK55Y2.js → emit-artifact-cmd-O3IBUMUY.js} +19 -16
- package/dist/{emit-cmd-VAQHRWJR.js → emit-cmd-QUABLVO6.js} +6 -5
- package/dist/{emit-criteria-cmd-Q7SM6VP2.js → emit-criteria-cmd-JDO2VUG5.js} +15 -12
- package/dist/{emit-finding-cmd-2NBAPDSV.js → emit-finding-cmd-VCQPCLI2.js} +16 -13
- package/dist/{emit-result-cmd-KUSL56RI.js → emit-result-cmd-BNS57DD3.js} +19 -16
- package/dist/{emit-step-cmd-KD4AKEAT.js → emit-step-cmd-XN44BXYU.js} +16 -13
- package/dist/{exec-client-6WVS7DRZ.js → exec-client-VKT2XNB3.js} +4 -3
- package/dist/fleet-readiness-G5X3MKP2.js +29 -0
- package/dist/{governing-source-VVUA5TKB.js → governing-source-B3M2U4BC.js} +21 -18
- package/dist/{guest-init-H5K2RW3P.js → guest-init-QW2DPX7H.js} +5 -4
- package/dist/{hook-fast-3SUJM765.js → hook-fast-EFC44SXV.js} +4 -1
- package/dist/{host-key-XNKZCWTS.js → host-key-AC6LTZDS.js} +4 -3
- package/dist/{image-tag-R34J4O3F.js → image-tag-SS7YKJHN.js} +4 -3
- package/dist/index.js +4 -4
- package/dist/{init-3DAGX7UY.js → init-36XMFFRQ.js} +38 -37
- package/dist/init-HHEAJDPN.js +56 -0
- package/dist/{init-cmd-RIDBVSE4.js → init-cmd-K2IKTSXJ.js} +25 -21
- package/dist/{init-update-ECWNG47R.js → init-update-RWTQSTPE.js} +51 -35
- package/dist/{inspect-IPFA7AAT.js → inspect-L7JIBK3Y.js} +1 -1
- package/dist/{install-6OIY3KHZ.js → install-35SAMY75.js} +5 -5
- package/dist/{install-cmd-JMT67P35.js → install-cmd-GFY4QF72.js} +6 -5
- package/dist/{layout-XNFDTOET.js → layout-BBTQPS6V.js} +4 -3
- package/dist/{login-browser-EWXSGHM7.js → login-browser-WSOSQH2T.js} +2 -2
- package/dist/{logs-XHAS6LMZ.js → logs-X2IRDP5T.js} +3 -2
- package/dist/loop-F5ASKFRJ.js +80 -0
- package/dist/{machine-OOQ2NXC3.js → machine-6STGIRJJ.js} +32 -30
- package/dist/{machine-skills-FLIRJYP7.js → machine-skills-O7W6NMWB.js} +4 -3
- package/dist/{mcp-serve-cmd-LY5A3CE7.js → mcp-serve-cmd-IITCPAAR.js} +9 -6
- package/dist/{paths-LHSPNORF.js → paths-32DWGK35.js} +3 -2
- package/dist/pending-CSIY4Y2I.js +10 -0
- package/dist/{pidfile-DKMYYXLH.js → pidfile-CYCTH6NQ.js} +4 -3
- package/dist/{real-deps-KNNBQC75.js → real-deps-QX5YH7FG.js} +1 -1
- package/dist/{record-3LPTY3G5.js → record-N4WPZCGK.js} +4 -3
- package/dist/{runner-env-YRRNRKF4.js → runner-env-EIB6WFPG.js} +6 -7
- package/dist/{runner-identity-YS2BZXZV.js → runner-identity-S3V6I4I3.js} +7 -6
- package/dist/{runner-key-EFNTZWNX.js → runner-key-Y76QXVNV.js} +36 -35
- package/dist/{session-sender-SC5PSU2G.js → session-sender-LFYMN6TT.js} +20 -17
- package/dist/{spec-cmd-JGYHHJ4P.js → spec-cmd-Z6MGATWC.js} +16 -13
- package/dist/{starter-pack-GPU4X6B7.js → starter-pack-5SOT5V4I.js} +4 -3
- package/dist/{status-7WM7S7JX.js → status-OANG2EM3.js} +39 -37
- package/dist/{sync-cmd-ATXJVS7S.js → sync-cmd-TNOOUPY2.js} +19 -16
- package/dist/{watch-M7NR3DOW.js → watch-HBNNYATF.js} +19 -16
- package/dist/{work-claim-cmd-DNUDZKJA.js → work-claim-cmd-CXALMILD.js} +21 -18
- package/dist/{work-cmd-VECTYST6.js → work-cmd-COESFSHE.js} +16 -13
- package/dist/{work-comment-cmd-F3NRWKPZ.js → work-comment-cmd-A4ZUVCSA.js} +16 -13
- package/dist/{work-logs-cmd-QF6P32FE.js → work-logs-cmd-CTF43MBE.js} +16 -13
- package/dist/{work-open-pr-cmd-XE23JA3R.js → work-open-pr-cmd-EMGYJXVD.js} +17 -14
- package/dist/{work-pr-cmd-BH56GUKN.js → work-pr-cmd-FEXMS6RH.js} +16 -13
- package/dist/{work-stop-cmd-C3F5HNUO.js → work-stop-cmd-NIHAN45R.js} +16 -13
- package/package.json +1 -1
- package/dist/build-HRLACBOZ.js +0 -12
- package/dist/chunk-STSLH5EJ.js +0 -71
- package/dist/init-SWKYV6CL.js +0 -55
- package/dist/loop-AIJZVUNA.js +0 -79
- package/dist/pending-3YZCSKON.js +0 -9
- package/dist/{chunk-6BLXUD56.js → chunk-HOU33DW5.js} +1 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, hostCommandEnvironment, execArgv, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-
|
|
4
|
-
import { writePendingUpdate } from './chunk-RHGF73IU.js';
|
|
5
|
-
import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57WI6.js';
|
|
6
|
-
import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-ABXQBEYK.js';
|
|
3
|
+
import { releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, hostCommandEnvironment, execArgv, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-KVDVNOUK.js';
|
|
7
4
|
import { decideInstalledSwitch } from './chunk-3JVYMD4G.js';
|
|
8
|
-
import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-
|
|
5
|
+
import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
|
|
9
6
|
import { RUNNER_PROTOCOL } from './chunk-TPKYTORP.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { writePendingUpdate } from './chunk-IVX3U7KV.js';
|
|
8
|
+
import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57WI6.js';
|
|
9
|
+
import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-66T6XJAB.js';
|
|
10
|
+
import { currentSkillCommand, formerSkillProblem, placeholderQueues, placeholderProblem } from './chunk-W3FSGH2M.js';
|
|
12
11
|
import { freeBytes, formatBytes } from './chunk-YYYRBYWG.js';
|
|
12
|
+
import { writeMarker, readMarker, currentVersion, removeMarker, entryIn, versionDir, startedThroughCurrent, switchCurrent, isInLayout, cleanVersions, stagingDir } from './chunk-GUXWQIEY.js';
|
|
13
13
|
import { RepoFilter } from './chunk-TBT347UY.js';
|
|
14
|
-
import { leaseTimeLeftMs, LEASE_SECONDS, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, lifecycleSteps, lifecycleFailureReason, prepareBranch, containerCommandExec, setUpRunnerCgroup, createContainerRuntime, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, gitRemoteFor, startServicesFor, createLeaseChannel } from './chunk-
|
|
15
|
-
import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-
|
|
16
|
-
import { tagToPull, pullInstruction, imageTag, writeUpdateStatus } from './chunk-
|
|
14
|
+
import { leaseTimeLeftMs, LEASE_SECONDS, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, lifecycleSteps, lifecycleFailureReason, prepareBranch, containerCommandExec, setUpRunnerCgroup, createContainerRuntime, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, gitRemoteFor, startServicesFor, createLeaseChannel } from './chunk-IKXY47R5.js';
|
|
15
|
+
import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-USJZ2LDK.js';
|
|
16
|
+
import { tagToPull, pullInstruction, imageTag, writeUpdateStatus } from './chunk-Z3ASAXVU.js';
|
|
17
17
|
import { isVersion, compareVersions, satisfiesRange } from './chunk-TQMI335S.js';
|
|
18
|
-
import { checkFit } from './chunk-
|
|
19
|
-
import {
|
|
20
|
-
import { claimPidFile, writePidFile, readPidFile, releasePidFile } from './chunk-
|
|
18
|
+
import { checkFit } from './chunk-MQHTM4YJ.js';
|
|
19
|
+
import { isBuiltinContainer, isBuiltinVm, isBuiltinProcess, loadRunnerConfig, checkHooks, builtinKind, DEFAULT_UPDATE_MAX_WAIT_HOURS } from './chunk-55XLX5PA.js';
|
|
20
|
+
import { claimPidFile, writePidFile, readPidFile, releasePidFile } from './chunk-NUHZV3A4.js';
|
|
21
21
|
import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
|
|
22
|
-
import { writeJobFile, ensureRunnerIdentity, readJobFile, builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, BUILD_LABEL, RUNNER_LABEL, readJobFileChecked } from './chunk-
|
|
23
|
-
import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-55GNQPO6.js';
|
|
24
|
-
import { isBuiltinContainer, isBuiltinVm, isBuiltinProcess, loadRunnerConfig, checkHooks, builtinKind, DEFAULT_UPDATE_MAX_WAIT_HOURS } from './chunk-EPPIISRD.js';
|
|
22
|
+
import { writeJobFile, ensureRunnerIdentity, readJobFile, builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, BUILD_LABEL, RUNNER_LABEL, readJobFileChecked } from './chunk-VC5J7QPV.js';
|
|
25
23
|
import { exceedsDisk } from './chunk-YJLHUKYS.js';
|
|
24
|
+
import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-X52PMPOM.js';
|
|
25
|
+
import { loadHostKey, ensureHostKey, signerFor } from './chunk-YL2VDSNF.js';
|
|
26
|
+
import { RUNNER_DIR_MODE, runnerDir, buildDir, attemptStamp, jobDir, RUNNER_FILE_MODE, jobsDir, pidFilePath, spoolDir, rootfsDir } from './chunk-5K3KB4YR.js';
|
|
27
|
+
import { parseClaimIdentity, parseClaimedRepositories, parseUnreachable, repositoriesOf, primaryOf, sharedUserEnvironment, JOB_MOUNT, takeClaudeCredential, heldClaudeCredential, claudeCredential, currentClaudeCredential } from './chunk-HXAEQPZR.js';
|
|
26
28
|
import { resolveVersion } from './chunk-RA3O54FC.js';
|
|
27
|
-
import {
|
|
28
|
-
import { RUNNER_DIR_MODE, runnerDir, buildDir, attemptStamp, jobDir, RUNNER_FILE_MODE, jobsDir, pidFilePath, spoolDir, rootfsDir } from './chunk-RHAGBUL5.js';
|
|
29
|
-
import { parseClaimIdentity, parseClaimedRepositories, parseUnreachable, repositoriesOf, primaryOf, sharedUserEnvironment, JOB_MOUNT, claudeCredential } from './chunk-2I3LIRZP.js';
|
|
29
|
+
import { fdName } from './chunk-XD4ZCMA4.js';
|
|
30
30
|
import { COMMAND_LOST_REASON, CONTAINER_STOPPED_REASON } from './chunk-JGD5TWQ2.js';
|
|
31
31
|
import { randomBytes } from 'crypto';
|
|
32
32
|
import { mkdirSync, existsSync, chmodSync, writeFileSync, renameSync, statSync, readdirSync, readFileSync, closeSync, rmSync, openSync, constants, lstatSync } from 'fs';
|
|
@@ -76,7 +76,7 @@ function checkBlocked(config, probes) {
|
|
|
76
76
|
}
|
|
77
77
|
if (kind !== "own" && claudeCredential(probes.env) === void 0) {
|
|
78
78
|
return {
|
|
79
|
-
reason: "there is no Claude credential in the runner's environment.
|
|
79
|
+
reason: "there is no Claude credential in the runner's environment. Store CLAUDE_CODE_OAUTH_TOKEN (from `claude setup-token`) or ANTHROPIC_API_KEY with `outerlayer runner init --agent claude`, which writes the claude.env beside the config, then restart the service"
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
return void 0;
|
|
@@ -482,7 +482,9 @@ async function prepareUpdate(args) {
|
|
|
482
482
|
return finish(args, retryFailure(version, err));
|
|
483
483
|
}
|
|
484
484
|
if (!verified.ok) return finish(args, { outcome: verified.outcome, reason: verified.reason });
|
|
485
|
-
const
|
|
485
|
+
const held = currentClaudeCredential(process.env);
|
|
486
|
+
const stagedEnv = held === void 0 ? void 0 : { ...process.env, [held.variable]: held.value };
|
|
487
|
+
const staged = await deps.runNode([entryIn(verified.dir), "runner", "check", "--config", configPath], verified.dir, stagedEnv);
|
|
486
488
|
if (staged.status !== 0) {
|
|
487
489
|
removeStaging(verified.dir);
|
|
488
490
|
return finish(args, {
|
|
@@ -1777,7 +1779,7 @@ var CLAIM_REFUSAL_CODES = new Set(
|
|
|
1777
1779
|
"pull_request_from_fork pull_request_on_default_branch pull_request_ambiguous pull_request_repository_not_connected repository_not_reachable branch_claimed_elsewhere".split(" ")
|
|
1778
1780
|
);
|
|
1779
1781
|
async function tryClaimAndStart(state, item, queue) {
|
|
1780
|
-
const { postJson: postJson2 } = await import('./work-cmd-
|
|
1782
|
+
const { postJson: postJson2 } = await import('./work-cmd-COESFSHE.js');
|
|
1781
1783
|
const log = logOf(state);
|
|
1782
1784
|
const hostKey = await loadHostKey(state.config.configPath);
|
|
1783
1785
|
const claim = await retrySend(
|
|
@@ -2935,14 +2937,26 @@ async function logUnusableHelper(config, runtime, log) {
|
|
|
2935
2937
|
if (helper.reason === "unsupported") log.line(helper.detail);
|
|
2936
2938
|
else if (helper.unreachable === true) log.line(`${helper.detail}, so microVM builds run without the jailer`);
|
|
2937
2939
|
}
|
|
2940
|
+
function hooksOf(configPath) {
|
|
2941
|
+
try {
|
|
2942
|
+
return loadRunnerConfig(configPath).hooks;
|
|
2943
|
+
} catch {
|
|
2944
|
+
return { provision: "builtin:container" };
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2938
2947
|
async function start(configPath, deps = { fetchImpl: fetch }) {
|
|
2939
2948
|
const log = deps.log ??= createRunnerLog(deps.now ?? (() => /* @__PURE__ */ new Date()));
|
|
2949
|
+
takeClaudeCredential(process.env, hooksOf(configPath));
|
|
2940
2950
|
const update = deps.update;
|
|
2941
2951
|
if (update !== void 0) {
|
|
2942
2952
|
const outcome = await onStartUnderMarker({
|
|
2943
2953
|
configPath,
|
|
2944
2954
|
own: ownVersionOf(deps),
|
|
2945
|
-
check: update.check ? () => update.check(configPath) : async () =>
|
|
2955
|
+
check: update.check ? () => update.check(configPath) : async () => {
|
|
2956
|
+
const held = heldClaudeCredential();
|
|
2957
|
+
const env = held === void 0 ? process.env : { ...process.env, [held.variable]: held.value };
|
|
2958
|
+
return (await import('./check-NDDOASVO.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
|
|
2959
|
+
},
|
|
2946
2960
|
now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
|
|
2947
2961
|
log
|
|
2948
2962
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { launcherPath, writeLauncher, LauncherWriteError, pathNotes } from './chunk-
|
|
4
|
-
import { currentVersion, currentLink, isInLayout, packageRootIn, versionDir, switchCurrent, execStartLine } from './chunk-
|
|
3
|
+
import { launcherPath, writeLauncher, LauncherWriteError, pathNotes } from './chunk-CTYSTE5C.js';
|
|
4
|
+
import { currentVersion, currentLink, isInLayout, packageRootIn, versionDir, switchCurrent, execStartLine } from './chunk-GUXWQIEY.js';
|
|
5
5
|
import { compareVersions } from './chunk-TQMI335S.js';
|
|
6
|
-
import { RUNNER_DIR_MODE } from './chunk-
|
|
6
|
+
import { RUNNER_DIR_MODE } from './chunk-5K3KB4YR.js';
|
|
7
7
|
import { realpathSync, readFileSync, mkdirSync, rmSync, cpSync, existsSync } from 'fs';
|
|
8
8
|
import { dirname, sep, join } from 'path';
|
|
9
9
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
|
|
4
|
+
createRequire(import.meta.url);
|
|
5
|
+
|
|
6
|
+
// src/maintained-line.ts
|
|
7
|
+
var MAINTAINED_SKILLS = ["outerlayer-evidence", "outerlayer-amend", "outerlayer-findings", "outerlayer-cli", "outerlayer-build"];
|
|
8
|
+
var MAINTAINED_LINE_VERSION = /^<!-- maintained by OuterLayer (\S+?)\. /m;
|
|
9
|
+
function maintainedLineVersion(text) {
|
|
10
|
+
return MAINTAINED_LINE_VERSION.exec(text)?.[1];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { MAINTAINED_SKILLS, maintainedLineVersion };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { currentLink } from './chunk-
|
|
3
|
+
import { currentLink } from './chunk-GUXWQIEY.js';
|
|
4
4
|
import { readFileSync, statSync, chmodSync, mkdirSync, writeFileSync, renameSync, rmSync, existsSync, lstatSync, accessSync, constants, realpathSync } from 'fs';
|
|
5
5
|
import { randomBytes } from 'crypto';
|
|
6
6
|
import { join, dirname, delimiter, resolve } from 'path';
|
|
@@ -3,6 +3,8 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import { appendContextProvenance } from './chunk-ZJSNLVCE.js';
|
|
4
4
|
import { CONTROL_PLANE_DIR_VARIABLE } from './chunk-HCVLP7XA.js';
|
|
5
5
|
import { readRepoConnection, findGitDirs } from './chunk-BJ3KTMDH.js';
|
|
6
|
+
import { updateNoticeContext, staleMachineCopiesContext } from './chunk-5BHIBJDA.js';
|
|
7
|
+
import { resolvePackageVersion } from './chunk-RA3O54FC.js';
|
|
6
8
|
import { cliInvocation } from './chunk-CRB3POP4.js';
|
|
7
9
|
import { deadHooksState, huskyPrepareScript, preparePackageManagerCommand } from './chunk-TUSYOL2O.js';
|
|
8
10
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
@@ -682,7 +684,7 @@ async function missingControlPlane(cwd, sessionId, home, env) {
|
|
|
682
684
|
cleanupEarlierCopies(dirs);
|
|
683
685
|
}
|
|
684
686
|
if (!contextPossiblyGoverned(cwd, home)) return void 0;
|
|
685
|
-
const { governanceOf } = await import('./control-plane-launch-
|
|
687
|
+
const { governanceOf } = await import('./control-plane-launch-FZMD4MXX.js');
|
|
686
688
|
if (await governanceOf({ cwd, env, home }) !== "governed") return void 0;
|
|
687
689
|
recordMissingContext(dirs, sessionId, home);
|
|
688
690
|
const launcher = `${cliInvocation()} claude`;
|
|
@@ -754,6 +756,8 @@ async function runHookFast(event, home = homeFromEnv(), read = readStdin, env =
|
|
|
754
756
|
let hookErrorsMessage;
|
|
755
757
|
let renewalHookMessage;
|
|
756
758
|
let machineSkillsMessage;
|
|
759
|
+
let updateNoticeMessage;
|
|
760
|
+
let staleCopiesMessage;
|
|
757
761
|
if (resolvedEvent === "SessionStart") {
|
|
758
762
|
const hookErrorsBytes = fileSizeBytes(join(dir, "hook-errors.log"));
|
|
759
763
|
const hookErrorsSeen = hookErrorsSeenBytes(home);
|
|
@@ -776,6 +780,18 @@ async function runHookFast(event, home = homeFromEnv(), read = readStdin, env =
|
|
|
776
780
|
} catch (err) {
|
|
777
781
|
logHookError(home, err);
|
|
778
782
|
}
|
|
783
|
+
try {
|
|
784
|
+
updateNoticeMessage = updateNoticeContext(home, resolvePackageVersion(), env) ?? void 0;
|
|
785
|
+
} catch (err) {
|
|
786
|
+
logHookError(home, err);
|
|
787
|
+
}
|
|
788
|
+
if (machineSkillsMessage === void 0) {
|
|
789
|
+
try {
|
|
790
|
+
staleCopiesMessage = staleMachineCopiesContext(home, resolvePackageVersion()) ?? void 0;
|
|
791
|
+
} catch (err) {
|
|
792
|
+
logHookError(home, err);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
779
795
|
try {
|
|
780
796
|
deadHooksMessage = deadHooksAutoHealContext(sessionCwd, home) ?? void 0;
|
|
781
797
|
} catch (err) {
|
|
@@ -800,7 +816,7 @@ async function runHookFast(event, home = homeFromEnv(), read = readStdin, env =
|
|
|
800
816
|
sessionCwd,
|
|
801
817
|
(out) => process.stdout.write(out),
|
|
802
818
|
missingPlane?.person,
|
|
803
|
-
[missingPlane?.agent, machineSkillsMessage, deadHooksMessage, workLaunchMessage, hookErrorsMessage, renewalHookMessage].filter(
|
|
819
|
+
[missingPlane?.agent, machineSkillsMessage, staleCopiesMessage, updateNoticeMessage, deadHooksMessage, workLaunchMessage, hookErrorsMessage, renewalHookMessage].filter(
|
|
804
820
|
(s) => s !== void 0
|
|
805
821
|
)
|
|
806
822
|
);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { loadMachineSkillFiles, resolvePackRoot } from './chunk-JGML2VUN.js';
|
|
4
|
+
import { MAINTAINED_SKILLS, maintainedLineVersion } from './chunk-CDDED64E.js';
|
|
5
5
|
import { resolvePackageVersion } from './chunk-RA3O54FC.js';
|
|
6
|
+
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
6
7
|
import { randomBytes } from 'crypto';
|
|
7
8
|
import { existsSync, symlinkSync, realpathSync, lstatSync, readFileSync, mkdirSync, rmSync, renameSync, writeFileSync, cpSync } from 'fs';
|
|
8
9
|
import { join, resolve, dirname, relative } from 'path';
|
|
@@ -48,10 +48,10 @@ async function fetchProvenance(version, fetchImpl) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// src/runner/update/npm.ts
|
|
51
|
-
function run(file, args, cwd) {
|
|
51
|
+
function run(file, args, cwd, env) {
|
|
52
52
|
const COMMAND_TIMEOUT_MS = 10 * 6e4;
|
|
53
53
|
return new Promise((resolve) => {
|
|
54
|
-
const child = spawn(file, args, { cwd, stdio: ["ignore", "pipe", "pipe"], timeout: COMMAND_TIMEOUT_MS });
|
|
54
|
+
const child = spawn(file, args, { cwd, ...env === void 0 ? {} : { env }, stdio: ["ignore", "pipe", "pipe"], timeout: COMMAND_TIMEOUT_MS });
|
|
55
55
|
let stdout = "";
|
|
56
56
|
let stderr = "";
|
|
57
57
|
child.stdout.on("data", (chunk) => stdout += chunk.toString());
|
|
@@ -66,10 +66,10 @@ function npmExecutable(nodePath) {
|
|
|
66
66
|
}
|
|
67
67
|
function realRunNpm(nodePath) {
|
|
68
68
|
const npm = npmExecutable(nodePath);
|
|
69
|
-
return (args, cwd) => run(npm, args, cwd);
|
|
69
|
+
return (args, cwd, env) => run(npm, args, cwd, env);
|
|
70
70
|
}
|
|
71
71
|
function realRunNode(nodePath) {
|
|
72
|
-
return (args, cwd) => run(nodePath, args, cwd);
|
|
72
|
+
return (args, cwd, env) => run(nodePath, args, cwd, env);
|
|
73
73
|
}
|
|
74
74
|
function npmSupportsProvenance(version) {
|
|
75
75
|
const match = /^(\d+)\.(\d+)/.exec(version.trim());
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { DEFAULT_UNIT_NAME } from './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { DEFAULT_UNIT_NAME } from './chunk-MQHTM4YJ.js';
|
|
4
|
+
import { RUNNER_FILE_MODE } from './chunk-5K3KB4YR.js';
|
|
5
|
+
import { claudeEnvPath, withoutCredentialLines } from './chunk-HXAEQPZR.js';
|
|
6
|
+
import { parseRunnerEnv } from './chunk-XD4ZCMA4.js';
|
|
6
7
|
import { existsSync, readFileSync, writeFileSync, renameSync, rmSync } from 'fs';
|
|
7
8
|
import { join, dirname } from 'path';
|
|
8
9
|
|
|
@@ -20,7 +21,6 @@ var CLAUDE_CREDENTIAL_NAMES = ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"];
|
|
|
20
21
|
var RunnerEnvError = class extends Error {
|
|
21
22
|
};
|
|
22
23
|
var CREDENTIAL_SHAPE = /^sk-ant-(oat|api)[0-9]*-[A-Za-z0-9_-]+$/;
|
|
23
|
-
var SETS = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=/;
|
|
24
24
|
function runnerEnvPath(configPath) {
|
|
25
25
|
return join(dirname(configPath), "runner.env");
|
|
26
26
|
}
|
|
@@ -35,18 +35,15 @@ function credentialFromStdin(text) {
|
|
|
35
35
|
}
|
|
36
36
|
return { variable: kind === "oat" ? "CLAUDE_CODE_OAUTH_TOKEN" : "ANTHROPIC_API_KEY", value };
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
const path = runnerEnvPath(configPath);
|
|
38
|
+
function setsCredential(path) {
|
|
40
39
|
if (!existsSync(path)) return false;
|
|
41
40
|
const env = parseRunnerEnv(readFileSync(path, "utf8"));
|
|
42
41
|
return CLAUDE_CREDENTIAL_NAMES.some((name) => env[name]);
|
|
43
42
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const text = `${[...kept, `${credential.variable}=${credential.value}`].join("\n")}
|
|
49
|
-
`;
|
|
43
|
+
function hasStoredCredential(configPath) {
|
|
44
|
+
return setsCredential(claudeEnvPath(configPath)) || setsCredential(runnerEnvPath(configPath));
|
|
45
|
+
}
|
|
46
|
+
function replaceFile(path, text) {
|
|
50
47
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
51
48
|
try {
|
|
52
49
|
writeFileSync(temporary, text, { mode: RUNNER_FILE_MODE, flag: "wx" });
|
|
@@ -55,11 +52,24 @@ function storeClaudeCredential(configPath, credential) {
|
|
|
55
52
|
rmSync(temporary, { force: true });
|
|
56
53
|
throw err;
|
|
57
54
|
}
|
|
55
|
+
}
|
|
56
|
+
function storeClaudeCredential(configPath, credential) {
|
|
57
|
+
const path = claudeEnvPath(configPath);
|
|
58
|
+
replaceFile(path, `${credential.variable}=${credential.value}
|
|
59
|
+
`);
|
|
60
|
+
const runnerPath = runnerEnvPath(configPath);
|
|
61
|
+
if (existsSync(runnerPath)) {
|
|
62
|
+
const dropped = withoutCredentialLines(readFileSync(runnerPath, "utf8"));
|
|
63
|
+
if (dropped !== void 0) replaceFile(runnerPath, dropped);
|
|
64
|
+
}
|
|
58
65
|
return path;
|
|
59
66
|
}
|
|
60
67
|
function restartForCredential(state, unitName = DEFAULT_UNIT_NAME) {
|
|
61
|
-
if (state
|
|
62
|
-
|
|
68
|
+
if (state === "differs") {
|
|
69
|
+
return `The service ${unitName} was not written by runner init, so it may not load claude.env, the one file that now holds the credential. Add EnvironmentFile=-<config directory>/claude.env to it, or run runner install --service --replace. Then restart it: sudo systemctl restart ${unitName}`;
|
|
70
|
+
}
|
|
71
|
+
if (state !== "pending-restart") return void 0;
|
|
72
|
+
return `The service ${unitName} loads claude.env only when it starts. Restart it so it uses the stored credential: sudo systemctl restart ${unitName}`;
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
export { AGENT_COMMANDS, RunnerEnvError, credentialFromStdin, hasStoredCredential, isAgentName, restartForCredential, storeClaudeCredential };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { rewriteControlPlanePaths, rewriteAgentsFilePaths, SUPPORTED_CONTROL_PLANE_LAYOUT, rewriteHookCommand } from './chunk-HCVLP7XA.js';
|
|
4
|
-
import { MAINTAINED_SKILLS } from './chunk-
|
|
4
|
+
import { MAINTAINED_SKILLS } from './chunk-CDDED64E.js';
|
|
5
5
|
import { existsSync, mkdirSync, copyFileSync, lstatSync, readdirSync, writeFileSync, readFileSync } from 'fs';
|
|
6
6
|
import { join, dirname } from 'path';
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-
|
|
3
|
+
import { runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-5K3KB4YR.js';
|
|
4
4
|
import { readlinkSync, realpathSync, mkdirSync, unlinkSync, symlinkSync, renameSync, readFileSync, writeFileSync, rmSync, existsSync, readdirSync } from 'fs';
|
|
5
5
|
import { join, basename, sep, resolve } from 'path';
|
|
6
6
|
|
|
@@ -1,13 +1,93 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
+
import { parseRunnerEnv } from './chunk-XD4ZCMA4.js';
|
|
3
4
|
import { TARGET_TUNNEL, TARGET_LEASE, destinationTarget } from './chunk-JGD5TWQ2.js';
|
|
4
|
-
import { existsSync, unlinkSync, chmodSync } from 'fs';
|
|
5
|
+
import { readFileSync, existsSync, unlinkSync, chmodSync } from 'fs';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
5
7
|
import { request as request$1, createServer } from 'http';
|
|
6
8
|
import { request } from 'https';
|
|
7
9
|
import { createServer as createServer$1 } from 'net';
|
|
8
|
-
import { join } from 'path';
|
|
9
10
|
|
|
10
11
|
createRequire(import.meta.url);
|
|
12
|
+
var CLAUDE_CREDENTIAL_ID = "claude";
|
|
13
|
+
var CLAUDE_ENV_FILE = "claude.env";
|
|
14
|
+
function claudeEnvPath(configPath) {
|
|
15
|
+
return join(dirname(configPath), CLAUDE_ENV_FILE);
|
|
16
|
+
}
|
|
17
|
+
var CLAUDE_CREDENTIAL_VARIABLES = ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
18
|
+
var FORWARDED = ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"];
|
|
19
|
+
function firstOf(values, source) {
|
|
20
|
+
for (const variable of FORWARDED) {
|
|
21
|
+
const value = values[variable];
|
|
22
|
+
if (value !== void 0 && value !== "") return { variable, value, source };
|
|
23
|
+
}
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
function readClaudeCredential(env) {
|
|
27
|
+
const fromEnvironment = firstOf(env, "environment");
|
|
28
|
+
if (fromEnvironment !== void 0) return fromEnvironment;
|
|
29
|
+
const directory = env.CREDENTIALS_DIRECTORY;
|
|
30
|
+
if (directory === void 0 || directory === "") return void 0;
|
|
31
|
+
const path = join(directory, CLAUDE_CREDENTIAL_ID);
|
|
32
|
+
try {
|
|
33
|
+
const text = readFileSync(path, "utf8");
|
|
34
|
+
const found = firstOf(parseRunnerEnv(text), "credentials-directory");
|
|
35
|
+
if (found === void 0 && text.trim() !== "") complain(path, "it sets neither CLAUDE_CODE_OAUTH_TOKEN nor ANTHROPIC_API_KEY, each as NAME=value");
|
|
36
|
+
return found;
|
|
37
|
+
} catch (err) {
|
|
38
|
+
if (err.code !== "ENOENT") complain(path, `it could not be read (${err instanceof Error ? err.message : String(err)})`);
|
|
39
|
+
return void 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var complained = /* @__PURE__ */ new Set();
|
|
43
|
+
function complain(path, reason) {
|
|
44
|
+
if (complained.has(path)) return;
|
|
45
|
+
complained.add(path);
|
|
46
|
+
process.stderr.write(`the Claude credential file ${path} holds no usable credential: ${reason}
|
|
47
|
+
`);
|
|
48
|
+
}
|
|
49
|
+
var held;
|
|
50
|
+
var removedValues = /* @__PURE__ */ new Set();
|
|
51
|
+
function holdClaudeCredential(env = process.env) {
|
|
52
|
+
held ??= readClaudeCredential(env);
|
|
53
|
+
for (const name of CLAUDE_CREDENTIAL_VARIABLES) {
|
|
54
|
+
const value = env[name];
|
|
55
|
+
if (value !== void 0 && value !== "") removedValues.add(value);
|
|
56
|
+
delete env[name];
|
|
57
|
+
}
|
|
58
|
+
return held;
|
|
59
|
+
}
|
|
60
|
+
function takeClaudeCredential(env, hooks) {
|
|
61
|
+
return /^builtin:(container|process|vm)$/.test(hooks.provision) ? holdClaudeCredential(env) : void 0;
|
|
62
|
+
}
|
|
63
|
+
function removedClaudeCredentialValues() {
|
|
64
|
+
return [...removedValues];
|
|
65
|
+
}
|
|
66
|
+
function heldClaudeCredential() {
|
|
67
|
+
return held;
|
|
68
|
+
}
|
|
69
|
+
function currentClaudeCredential(env) {
|
|
70
|
+
return held ?? readClaudeCredential(env);
|
|
71
|
+
}
|
|
72
|
+
var SETS = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=/;
|
|
73
|
+
function credentialLineIn(text) {
|
|
74
|
+
const set = parseRunnerEnv(text);
|
|
75
|
+
const lines = text.split("\n");
|
|
76
|
+
for (const variable of FORWARDED) {
|
|
77
|
+
if ((set[variable] ?? "") === "") continue;
|
|
78
|
+
const line = lines.find((candidate) => (parseRunnerEnv(candidate)[variable] ?? "") !== "");
|
|
79
|
+
return line.replace(/^\s*(?:export\s+)?/, "").trimEnd();
|
|
80
|
+
}
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
function withoutCredentialLines(text) {
|
|
84
|
+
const lines = text.split("\n");
|
|
85
|
+
const kept = lines.filter((line) => !CLAUDE_CREDENTIAL_VARIABLES.includes(SETS.exec(line)?.[1] ?? ""));
|
|
86
|
+
if (kept.length === lines.length) return void 0;
|
|
87
|
+
while (kept[kept.length - 1] === "") kept.pop();
|
|
88
|
+
return kept.length === 0 ? "" : `${kept.join("\n")}
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
11
91
|
|
|
12
92
|
// src/runner/builtin-destinations.ts
|
|
13
93
|
var GATEWAY_DESTINATION = "gateway";
|
|
@@ -23,16 +103,27 @@ var OAUTH_PLACEHOLDER = "sk-ant-oat01-placeholder-not-a-real-token";
|
|
|
23
103
|
var API_KEY_PLACEHOLDER = "sk-ant-api03-placeholder-not-a-real-key";
|
|
24
104
|
var ITEM_KEY_PLACEHOLDER = "olitem_placeholder-not-a-real-key";
|
|
25
105
|
var ITEM_KEY_VARIABLE = "OUTERLAYER_ITEM_KEY";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (held("ANTHROPIC_API_KEY")) return { variable: "ANTHROPIC_API_KEY", placeholder: API_KEY_PLACEHOLDER };
|
|
31
|
-
return void 0;
|
|
106
|
+
function claudeCredential(hostEnv, options = {}) {
|
|
107
|
+
const credential = options.ignoreHeld === true ? readClaudeCredential(hostEnv) : currentClaudeCredential(hostEnv);
|
|
108
|
+
if (credential === void 0) return void 0;
|
|
109
|
+
return { variable: credential.variable, placeholder: credential.variable === "CLAUDE_CODE_OAUTH_TOKEN" ? OAUTH_PLACEHOLDER : API_KEY_PLACEHOLDER };
|
|
32
110
|
}
|
|
33
111
|
function gatewayUpstream(gatewayUrl) {
|
|
34
112
|
return `${new URL(gatewayUrl).origin}/`;
|
|
35
113
|
}
|
|
114
|
+
function forwardedEnvironment(hostEnv) {
|
|
115
|
+
const env = {};
|
|
116
|
+
for (const name of ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"]) {
|
|
117
|
+
Object.defineProperty(env, name, {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: () => {
|
|
120
|
+
const current = currentClaudeCredential(hostEnv);
|
|
121
|
+
return current !== void 0 && current.variable === name ? current.value : hostEnv[name];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return env;
|
|
126
|
+
}
|
|
36
127
|
function builtInDestinations(input) {
|
|
37
128
|
const credential = claudeCredential(input.hostEnv);
|
|
38
129
|
const apiKeyMode = credential?.variable === "ANTHROPIC_API_KEY";
|
|
@@ -55,7 +146,7 @@ function builtInDestinations(input) {
|
|
|
55
146
|
header: apiKeyMode ? { name: "x-api-key", value: "${ANTHROPIC_API_KEY}", variables: ["ANTHROPIC_API_KEY"] } : { name: "Authorization", value: "Bearer ${CLAUDE_CODE_OAUTH_TOKEN}", variables: ["CLAUDE_CODE_OAUTH_TOKEN"] },
|
|
56
147
|
env: {}
|
|
57
148
|
},
|
|
58
|
-
hostEnv: input.hostEnv,
|
|
149
|
+
hostEnv: forwardedEnvironment(input.hostEnv),
|
|
59
150
|
// A build's own key in either header would sit beside the runner's, and the upstream takes one of them.
|
|
60
151
|
drop: ["x-api-key", "authorization"],
|
|
61
152
|
socket: CLAUDE_SOCKET
|
|
@@ -661,4 +752,4 @@ function withTunnelRecord(environment, record, onlyWhenUsed = false) {
|
|
|
661
752
|
};
|
|
662
753
|
}
|
|
663
754
|
|
|
664
|
-
export { AGENT_CREDENTIAL_MISSING, BUILD_HOME, BUILT_IN_NAMES, CHECKOUT_DIR, CLAUDE_CREDENTIAL_VARIABLES, CLAUDE_PORT, CLAUDE_SOCKET, DESTINATION_BASE_PORT, EVAL_INPUT_DIR, GATEWAY_PORT, GATEWAY_SOCKET, JOB_MOUNT, PROXY_WARNING_FLAG, RELAY_PORT, authorEnvironment, buildEnvironment, builtInEnvironment, checkEnvironment, checkoutPath, claudeCredential, commitIdentityRecord, containerLocalAddress, destinationEnvironment, headerVariables, isRefusedInConfig, isReservedVariable, lifecycleWorkdir, parseClaimIdentity, parseClaimedRepositories, parseIsolation, parseUnreachable, primaryOf, proxyEnvironment, repositoriesOf, repositoryPath, resolveDestinations, sharedUserEnvironment, startBuildServices, tokenHeader, withGitConfig, withHooksPath, withProxyWarningHidden, withTokenHeader, withTunnelRecord };
|
|
755
|
+
export { AGENT_CREDENTIAL_MISSING, BUILD_HOME, BUILT_IN_NAMES, CHECKOUT_DIR, CLAUDE_CREDENTIAL_ID, CLAUDE_CREDENTIAL_VARIABLES, CLAUDE_ENV_FILE, CLAUDE_PORT, CLAUDE_SOCKET, DESTINATION_BASE_PORT, EVAL_INPUT_DIR, GATEWAY_PORT, GATEWAY_SOCKET, JOB_MOUNT, PROXY_WARNING_FLAG, RELAY_PORT, authorEnvironment, buildEnvironment, builtInEnvironment, checkEnvironment, checkoutPath, claudeCredential, claudeEnvPath, commitIdentityRecord, containerLocalAddress, credentialLineIn, currentClaudeCredential, destinationEnvironment, headerVariables, heldClaudeCredential, isRefusedInConfig, isReservedVariable, lifecycleWorkdir, parseClaimIdentity, parseClaimedRepositories, parseIsolation, parseUnreachable, primaryOf, proxyEnvironment, readClaudeCredential, removedClaudeCredentialValues, repositoriesOf, repositoryPath, resolveDestinations, sharedUserEnvironment, startBuildServices, takeClaudeCredential, tokenHeader, withGitConfig, withHooksPath, withProxyWarningHidden, withTokenHeader, withTunnelRecord, withoutCredentialLines };
|