@outerlayer/cli 0.33.0-next.20261022194605 → 0.33.0-next.20261022195547

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.
Files changed (49) hide show
  1. package/dist/{agent-setup-32F2JJIL.js → agent-setup-RJOVRRHK.js} +2 -2
  2. package/dist/build-info.json +1 -1
  3. package/dist/{check-KD5PLAVL.js → check-64UX323V.js} +12 -12
  4. package/dist/{chunk-4XQ6F3HD.js → chunk-35IY5HQY.js} +1 -1
  5. package/dist/{chunk-A33USDCE.js → chunk-3MXPS7ED.js} +1 -1
  6. package/dist/{chunk-6YHUMNUB.js → chunk-77B36F5K.js} +1 -1
  7. package/dist/{chunk-TDVG6MCO.js → chunk-CMKY36NV.js} +1 -1
  8. package/dist/{chunk-SVXFSQRD.js → chunk-D3HRAPNF.js} +16 -3
  9. package/dist/{chunk-WB7LPDXR.js → chunk-DJWKUQLO.js} +1 -1
  10. package/dist/{chunk-V3MMJT4T.js → chunk-DNKUSXQU.js} +3 -3
  11. package/dist/{chunk-RXUZD7DC.js → chunk-H7A3IQH5.js} +7 -7
  12. package/dist/{chunk-FMH6LSUE.js → chunk-I5LGKZ4M.js} +1 -1
  13. package/dist/{chunk-IYH4R4EZ.js → chunk-L6JFFP3Q.js} +19 -6
  14. package/dist/{chunk-JR4TZLG6.js → chunk-QDMMW5PC.js} +2 -2
  15. package/dist/{chunk-RAHE2AYU.js → chunk-RBJG5MM4.js} +46 -16
  16. package/dist/{chunk-JMZZLICN.js → chunk-WBZJWVT2.js} +2 -2
  17. package/dist/{chunk-EYW2ZRDL.js → chunk-WCELNMXT.js} +51 -19
  18. package/dist/{chunk-ESEUG62R.js → chunk-ZXBQ6E72.js} +3 -3
  19. package/dist/{claude-launcher-B4L7ELIF.js → claude-launcher-66GKNIRZ.js} +1 -1
  20. package/dist/{cli-3ZPYMRUZ.js → cli-WICFAKFW.js} +49 -49
  21. package/dist/{command-YLXBWLAR.js → command-VGR24IPI.js} +5 -5
  22. package/dist/{container-start-G363VW47.js → container-start-QX53HKXW.js} +6 -6
  23. package/dist/{control-plane-launch-PSFYCKYH.js → control-plane-launch-SMHL6MWW.js} +1 -1
  24. package/dist/{doctor-N36BHNH3.js → doctor-N3CDJ66I.js} +7 -7
  25. package/dist/{emit-artifact-cmd-DX6RNKGK.js → emit-artifact-cmd-73OWUBH6.js} +3 -3
  26. package/dist/{emit-demo-cmd-KSIAJ25G.js → emit-demo-cmd-4AV74GMZ.js} +3 -3
  27. package/dist/{emit-result-cmd-TSUOZSYJ.js → emit-result-cmd-N52IABK6.js} +2 -2
  28. package/dist/{governing-source-G2I3ZT6M.js → governing-source-M7ZRJCGY.js} +3 -3
  29. package/dist/{hook-fast-6GE5LEJI.js → hook-fast-WNKICZ6E.js} +1 -1
  30. package/dist/index.js +4 -4
  31. package/dist/{init-COSYLOVV.js → init-VCWDBOT4.js} +6 -6
  32. package/dist/{init-YMXM4D7K.js → init-XG4NRZX4.js} +6 -6
  33. package/dist/{init-cmd-SWFTXZC7.js → init-cmd-2CAMWMRP.js} +3 -3
  34. package/dist/{init-update-DWZMXIBG.js → init-update-NCM4GA3S.js} +2 -2
  35. package/dist/{loop-KNITSCYU.js → loop-PXALY3VY.js} +12 -12
  36. package/dist/{machine-3YU7HXUQ.js → machine-AZRL432D.js} +5 -5
  37. package/dist/{runner-key-2QWPUKQM.js → runner-key-6BIULOR4.js} +6 -6
  38. package/dist/{session-sender-CMDAHNLE.js → session-sender-MSHKJSBG.js} +3 -3
  39. package/dist/{spec-cmd-WFS64ZCI.js → spec-cmd-AWIMO32E.js} +1 -1
  40. package/dist/{status-X3RGH6MZ.js → status-BILERIXB.js} +8 -8
  41. package/dist/{sync-cmd-XCGNHOGU.js → sync-cmd-BSUZ65CU.js} +2 -2
  42. package/dist/{watch-6O6LTIBM.js → watch-UF6XCGSI.js} +2 -2
  43. package/dist/{work-claim-cmd-ABYB5RGL.js → work-claim-cmd-4FXVAZWF.js} +3 -3
  44. package/dist/{work-cmd-H7LLCT2W.js → work-cmd-NCP4637R.js} +1 -1
  45. package/dist/{work-comment-cmd-QW745J2A.js → work-comment-cmd-YNQYVHYS.js} +1 -1
  46. package/dist/{work-logs-cmd-GMPGBFLO.js → work-logs-cmd-HHWVYQBG.js} +1 -1
  47. package/dist/{work-open-pr-cmd-75XO4DL2.js → work-open-pr-cmd-ALVD7KLY.js} +1 -1
  48. package/dist/{work-stop-cmd-C65WG6NY.js → work-stop-cmd-DBWNHZJO.js} +1 -1
  49. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { keepHandWritten, runAgentSetup } from './chunk-4XQ6F3HD.js';
3
+ export { keepHandWritten, runAgentSetup } from './chunk-35IY5HQY.js';
4
4
  import './chunk-JHTJPQSL.js';
5
5
  import './chunk-KT4CN6OU.js';
6
6
  import './chunk-DY7Y7UT4.js';
7
7
  import './chunk-HJYBWJAS.js';
8
8
  import './chunk-ANPNT6PM.js';
9
- import './chunk-EYW2ZRDL.js';
9
+ import './chunk-WCELNMXT.js';
10
10
  import './chunk-UIUGTW5C.js';
11
11
  import './chunk-WPGBDY73.js';
12
12
  import './chunk-PJDQPF5N.js';
@@ -1 +1 @@
1
- {"id":"2026-10-22T19:47:58.976Z+3d54e29","root":"/home/runner/_work/outerlayer/outerlayer","pkg":"outerlayer"}
1
+ {"id":"2026-10-22T19:57:46.463Z+671ceda","root":"/home/runner/_work/outerlayer/outerlayer","pkg":"outerlayer"}
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { probeCredentials } from './chunk-RXUZD7DC.js';
4
- import './chunk-IYH4R4EZ.js';
3
+ import { probeCredentials } from './chunk-H7A3IQH5.js';
4
+ import './chunk-L6JFFP3Q.js';
5
5
  import './chunk-ZVB57WI6.js';
6
6
  import './chunk-UOFBHIOZ.js';
7
7
  import './chunk-3JVYMD4G.js';
@@ -12,17 +12,17 @@ import './chunk-JEKENLLA.js';
12
12
  import './chunk-W5DOK7BL.js';
13
13
  import './chunk-QL3LPZ67.js';
14
14
  import './chunk-I3LTIAOR.js';
15
- import './chunk-JR4TZLG6.js';
16
- import './chunk-A33USDCE.js';
15
+ import './chunk-QDMMW5PC.js';
16
+ import './chunk-3MXPS7ED.js';
17
17
  import './chunk-DETKDTNL.js';
18
18
  import './chunk-ESVW4MJY.js';
19
- import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, managedProblems, managedFactsOf, needsClaudeCredential, claudeCredentialCheck, claimPermissionProblem, formerSkillQueues, formerSkillProblem } from './chunk-V3MMJT4T.js';
19
+ import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, managedProblems, managedFactsOf, needsClaudeCredential, claudeCredentialCheck, claimPermissionProblem, formerSkillQueues, formerSkillProblem } from './chunk-DNKUSXQU.js';
20
20
  import './chunk-OWDSO3PE.js';
21
21
  import './chunk-TBT347UY.js';
22
- import './chunk-JMZZLICN.js';
22
+ import './chunk-WBZJWVT2.js';
23
23
  import './chunk-CUBIZBMF.js';
24
- import './chunk-FMH6LSUE.js';
25
- import { probeHelper, HELPER_ENV, helperSocketPath } from './chunk-SVXFSQRD.js';
24
+ import './chunk-I5LGKZ4M.js';
25
+ import { probeHelper, HELPER_ENV, helperSocketPath } from './chunk-D3HRAPNF.js';
26
26
  import './chunk-2PGI6RDE.js';
27
27
  import './chunk-KLXWS5Z7.js';
28
28
  import './chunk-DDS2ISML.js';
@@ -30,7 +30,7 @@ import './chunk-JBJTC3UU.js';
30
30
  import './chunk-OGFGZQA3.js';
31
31
  import './chunk-6NWS455T.js';
32
32
  import './chunk-LWTBE5J6.js';
33
- import './chunk-RAHE2AYU.js';
33
+ import './chunk-RBJG5MM4.js';
34
34
  import './chunk-SK4TWCN3.js';
35
35
  import './chunk-TQMI335S.js';
36
36
  import { DEFAULT_UNIT_NAME } from './chunk-ZRRUWNJS.js';
@@ -42,7 +42,7 @@ import './chunk-TGHBOXKJ.js';
42
42
  import { loadRunnerConfig, RunnerConfigError, checkHooks } from './chunk-5BNWAIHN.js';
43
43
  import './chunk-UXYLWVTQ.js';
44
44
  import './chunk-YJLHUKYS.js';
45
- import './chunk-TDVG6MCO.js';
45
+ import './chunk-CMKY36NV.js';
46
46
  import './chunk-2QT4JUW3.js';
47
47
  import './chunk-ZQOSIMKU.js';
48
48
  import './chunk-EWVYQLD3.js';
@@ -51,14 +51,14 @@ import './chunk-HJYBWJAS.js';
51
51
  import './chunk-NSPRS7WK.js';
52
52
  import './chunk-G2JWZDFA.js';
53
53
  import './chunk-ANPNT6PM.js';
54
- import './chunk-EYW2ZRDL.js';
54
+ import './chunk-WCELNMXT.js';
55
55
  import './chunk-UIUGTW5C.js';
56
56
  import './chunk-WPGBDY73.js';
57
57
  import './chunk-PJDQPF5N.js';
58
58
  import './chunk-AA6LYZC4.js';
59
59
  import './chunk-AGZNCIIJ.js';
60
60
  import { claudeEnvPath } from './chunk-BCCI32ME.js';
61
- import './chunk-WB7LPDXR.js';
61
+ import './chunk-DJWKUQLO.js';
62
62
  import './chunk-ZJSNLVCE.js';
63
63
  import './chunk-2O5KA67H.js';
64
64
  import './chunk-BKO6JEZI.js';
@@ -5,7 +5,7 @@ import { addStdioMcpEntryIfAbsent, addDocsMcpEntryIfAbsent, DOCS_MCP_SERVER_NAME
5
5
  import { installStarterPack } from './chunk-DY7Y7UT4.js';
6
6
  import { AGENTS_MD_LAYOUT, declareAgentsMdLayout, linkClaudeSkills, SKILLS_LINK_PATH, describeSkillsLink, isAgentsMdLayout, holdsTodaysLayoutSources, discoverOuterlayerPaths } from './chunk-HJYBWJAS.js';
7
7
  import { C } from './chunk-ANPNT6PM.js';
8
- import { resolveGitCommonDir, defaultGitRunner } from './chunk-EYW2ZRDL.js';
8
+ import { resolveGitCommonDir, defaultGitRunner } from './chunk-WCELNMXT.js';
9
9
  import { loadTemplateFiles, loadMaintainedFiles, skillDir, AGENTS_SKILLS_BASE } from './chunk-G63KT5I5.js';
10
10
  import { cliInvocation } from './chunk-CRB3POP4.js';
11
11
  import { linkedAgentsPath } from './chunk-AVTI3FL5.js';
@@ -9,7 +9,7 @@ import { C } from './chunk-ANPNT6PM.js';
9
9
  import { cliFetch, resolveGatewayCredentials, defaultFetch, unauthorizedMessage } from './chunk-WPGBDY73.js';
10
10
  import { readCloudConfig, cloudConfigPath, writeCloudConfig } from './chunk-PJDQPF5N.js';
11
11
  import { signerFor, signRunnerRequest } from './chunk-AA6LYZC4.js';
12
- import { writeSyncStatus, spoolDir } from './chunk-WB7LPDXR.js';
12
+ import { writeSyncStatus, spoolDir } from './chunk-DJWKUQLO.js';
13
13
  import { readLatestProvenanceForSession, readContextProvenance } from './chunk-ZJSNLVCE.js';
14
14
  import { hookExecSpoolPath } from './chunk-2O5KA67H.js';
15
15
  import { applyReportedCost } from './chunk-BKO6JEZI.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { staleBuildRefusal, staleBuildWarning, detectCi } from './chunk-A33USDCE.js';
3
+ import { staleBuildRefusal, staleBuildWarning, detectCi } from './chunk-3MXPS7ED.js';
4
4
  import { launchRefusalForSession } from './chunk-ESVW4MJY.js';
5
5
  import { detectActiveSession, autoConnect } from './chunk-2QT4JUW3.js';
6
6
  import { readEffectiveArtifactSpoolState, localArtifactIds, isArtifactTombstoned, artifactBlobsDir, appendArtifactRecord, artifactsSpoolPath, findPendingArtifactRecord, sanitizeTerminal, appendArtifactTombstone } from './chunk-EWVYQLD3.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-6GE5LEJI.js');
444
+ const { logHookError } = await import('./hook-fast-WNKICZ6E.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
  }
@@ -6,7 +6,7 @@ import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
6
6
  import { currentCliBuild } from './chunk-OGFGZQA3.js';
7
7
  import { runExec, execCapture, waitForAgent } from './chunk-6NWS455T.js';
8
8
  import { GUEST_CID, linkVsockSockets } from './chunk-LWTBE5J6.js';
9
- import { describeCallFailure, keepStagedContext, controlPlaneTokenFailure, refusalCode, resolveGoverningSource, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, shimScript, WORKFLOW_PERMISSION_REASON } from './chunk-RAHE2AYU.js';
9
+ import { describeCallFailure, keepStagedContext, controlPlaneTokenFailure, refusalCode, resolveGoverningSource, prefetchGovernedContext, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, shimScript, WORKFLOW_PERMISSION_REASON } from './chunk-RBJG5MM4.js';
10
10
  import { runnerImageVersion } from './chunk-SK4TWCN3.js';
11
11
  import { formatBytes } from './chunk-YYYRBYWG.js';
12
12
  import { createDockerHost, builderSpec, runnerLabelValue, RUNNER_LABEL, BUILD_LABEL, prepareRunArgs, containerRunArgs, HASH_ARGV, parseProgramHash, JUDGE_PROGRAM, containerExecArgs, childEnvironment, JUDGE_DIR, MAX_ITEMS_BYTES, JUDGE_ITEMS, MAX_REPORT_BYTES, JUDGE_REPORT, spawnRun } from './chunk-43PV5KDB.js';
@@ -14,7 +14,7 @@ import { RecipeError, DOCKER_FEATURE, writeSanitizedRecipe, classifyProperties }
14
14
  import { FIRECRACKER_VERSION, hostHelperPinned, firecrackerArch, MICROVM_ARCHES, CLAUDE_CODE_VERSION, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, JAILER_BINARY_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, GUEST_ASSETS_VERSION, BUILDER_DISK_VERSION, builderDiskPinned, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, GH_VERSION, TINI_SHA256, TINI_VERSION, VOICE_PACK_FILES, BUILDER_DISK_SHA256, BUILDER_DISK_BASE_URL, DEFAULT_BASE_IMAGE } from './chunk-TGHBOXKJ.js';
15
15
  import { hostAllowed } from './chunk-UXYLWVTQ.js';
16
16
  import { readDu } from './chunk-YJLHUKYS.js';
17
- import { WorkCommandError } from './chunk-TDVG6MCO.js';
17
+ import { WorkCommandError } from './chunk-CMKY36NV.js';
18
18
  import { setCustomScrubbers, setLocalIdentity, setRepoRoot, parseTranscript, scrubDeep, scrubText } from './chunk-5DNCFOXA.js';
19
19
  import { rootfsPathFor, diskTemplatesDir, RUNNER_FILE_MODE, buildsDir, buildDir, vmAssetsDir, RUNNER_DIR_MODE, deliveryDir, ghConfigDir, runnerDirOfBuild, spoolDir, mirrorDir, SHIM_DIR, runnerDir, vsockPath, builderCacheDiskPath, builderConsolePath } from './chunk-AGZNCIIJ.js';
20
20
  import { repositoriesOf, primaryOf, RELAY_PORT, repositoryPath, CHECKOUT_DIR, lifecycleWorkdir, claudeCredential, buildEnvironment, writeBuildMavenSettings, startBuildServices, checkEnvironment, AGENT_CREDENTIAL_MISSING, checkoutPath, JOB_MOUNT } from './chunk-BCCI32ME.js';
@@ -3581,6 +3581,19 @@ async function provisionContainer(input) {
3581
3581
  const governing = await resolveGoverningSource({ config, repository, fetchImpl: input.fetchImpl });
3582
3582
  if (!governing.ok) return fail(governing.reason);
3583
3583
  const governingSource = governing.source;
3584
+ const controlPlaneUrl = (controlPlane) => runtime.remoteFor?.(controlPlane) ?? `${runtime.github.gitUrl}/${controlPlane}.git`;
3585
+ if (governingSource.kind === "governed") {
3586
+ const unfetched = await prefetchGovernedContext({
3587
+ configPath: config.configPath,
3588
+ repository,
3589
+ source: governingSource,
3590
+ controlPlaneUrl,
3591
+ controlPlaneToken: () => tokens.controlPlane(),
3592
+ log,
3593
+ tag
3594
+ });
3595
+ if (unfetched !== void 0) return fail(unfetched);
3596
+ }
3584
3597
  const imageRepository = governingSource.kind === "governed" ? governingSource.repository : repository;
3585
3598
  const obtained = await obtainImage({
3586
3599
  config,
@@ -3771,7 +3784,7 @@ async function provisionContainer(input) {
3771
3784
  buildId,
3772
3785
  buildDir: buildDir2,
3773
3786
  fetchImpl: input.fetchImpl,
3774
- controlPlaneUrl: (controlPlane) => runtime.remoteFor?.(controlPlane) ?? `${runtime.github.gitUrl}/${controlPlane}.git`,
3787
+ controlPlaneUrl,
3775
3788
  controlPlaneToken: () => tokens.controlPlane(),
3776
3789
  log,
3777
3790
  tag
@@ -684,7 +684,7 @@ async function missingControlPlane(cwd, sessionId, home, env) {
684
684
  cleanupEarlierCopies(dirs);
685
685
  }
686
686
  if (!contextPossiblyGoverned(cwd, home)) return void 0;
687
- const { governanceOf } = await import('./control-plane-launch-PSFYCKYH.js');
687
+ const { governanceOf } = await import('./control-plane-launch-SMHL6MWW.js');
688
688
  if (await governanceOf({ cwd, env, home }) !== "governed") return void 0;
689
689
  recordMissingContext(dirs, sessionId, home);
690
690
  const launcher = `${cliInvocation()} claude`;
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { isPlaceholderCommand } from './chunk-JMZZLICN.js';
4
- import { describeCallFailure } from './chunk-RAHE2AYU.js';
3
+ import { isPlaceholderCommand } from './chunk-WBZJWVT2.js';
4
+ import { describeCallFailure } from './chunk-RBJG5MM4.js';
5
5
  import { checkFit } from './chunk-ZRRUWNJS.js';
6
6
  import { realBuildDiskProbe, checkDiskFit, DEFAULT_BUILD_DISK } from './chunk-P5FC7VUO.js';
7
7
  import { builderDiskPinned } from './chunk-TGHBOXKJ.js';
8
8
  import { builtinKind, imageBuildOf } from './chunk-5BNWAIHN.js';
9
- import { WorkCommandError, getJson } from './chunk-TDVG6MCO.js';
9
+ import { WorkCommandError, getJson } from './chunk-CMKY36NV.js';
10
10
  import { sanitizeTerminal } from './chunk-EWVYQLD3.js';
11
11
  import { signerFor } from './chunk-AA6LYZC4.js';
12
12
  import { CLAUDE_CREDENTIAL_VARIABLES, claudeCredential, claudeCredentialVariablesSet } from './chunk-BCCI32ME.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { releaseLease, isUnfinished, attemptNote, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, execArgv, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-IYH4R4EZ.js';
3
+ import { releaseLease, isUnfinished, attemptNote, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, execArgv, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-L6JFFP3Q.js';
4
4
  import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57WI6.js';
5
5
  import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-UOFBHIOZ.js';
6
6
  import { decideInstalledSwitch } from './chunk-3JVYMD4G.js';
@@ -8,20 +8,20 @@ import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest
8
8
  import { fitImageBuildMemory } from './chunk-6C2YWM6N.js';
9
9
  import { RUNNER_PROTOCOL } from './chunk-YKYCE4HY.js';
10
10
  import { writePendingUpdate } from './chunk-JEKENLLA.js';
11
- import { currentSkillCommand, formerSkillProblem, realBlockedProbes, checkBlocked } from './chunk-V3MMJT4T.js';
11
+ import { currentSkillCommand, formerSkillProblem, realBlockedProbes, checkBlocked } from './chunk-DNKUSXQU.js';
12
12
  import { writeMarker, readMarker, currentVersion, removeMarker, entryIn, versionDir, startedThroughCurrent, switchCurrent, isInLayout, cleanVersions, stagingDir } from './chunk-OWDSO3PE.js';
13
13
  import { RepoFilter } from './chunk-TBT347UY.js';
14
- import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, lifecycleSteps, lifecycleFailureReason, prepareBranch, containerCommandExec, setUpRunnerCgroup, sweepImageBuilders, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, gitRemoteFor, startServicesFor, createLeaseChannel } from './chunk-SVXFSQRD.js';
14
+ import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, lifecycleSteps, lifecycleFailureReason, prepareBranch, containerCommandExec, setUpRunnerCgroup, sweepImageBuilders, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, gitRemoteFor, startServicesFor, createLeaseChannel } from './chunk-D3HRAPNF.js';
15
15
  import { claimPidFile, writePidFile, readPidFile, releasePidFile } from './chunk-DDS2ISML.js';
16
16
  import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
17
- import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-RAHE2AYU.js';
17
+ import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-RBJG5MM4.js';
18
18
  import { tagToPull, pullInstruction, imageTag, writeUpdateStatus } from './chunk-SK4TWCN3.js';
19
19
  import { isVersion, compareVersions, satisfiesRange } from './chunk-TQMI335S.js';
20
20
  import { freeBytes, formatBytes } from './chunk-YYYRBYWG.js';
21
21
  import { writeJobFile, ensureRunnerIdentity, readJobFile, builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, BUILD_LABEL, RUNNER_LABEL, readJobFileChecked } from './chunk-43PV5KDB.js';
22
22
  import { isBuiltinContainer, isBuiltinVm, isBuiltinProcess, loadRunnerConfig, checkHooks, builtinKind, DEFAULT_UPDATE_MAX_WAIT_HOURS } from './chunk-5BNWAIHN.js';
23
23
  import { exceedsDisk } from './chunk-YJLHUKYS.js';
24
- import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-TDVG6MCO.js';
24
+ import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-CMKY36NV.js';
25
25
  import { loadHostKey, ensureHostKey, signerFor } from './chunk-AA6LYZC4.js';
26
26
  import { RUNNER_DIR_MODE, runnerDir, buildDir, attemptStamp, jobDir, RUNNER_FILE_MODE, jobsDir, pidFilePath, spoolDir, imagesDir, rootfsDir, builderCacheDiskPath } from './chunk-AGZNCIIJ.js';
27
27
  import { parseClaimIdentity, parseClaimedRepositories, parseUnreachable, repositoriesOf, primaryOf, sharedUserEnvironment, JOB_MOUNT, takeClaudeCredential, heldClaudeCredential, currentClaudeCredential } from './chunk-BCCI32ME.js';
@@ -1837,7 +1837,7 @@ var CLAIM_REFUSAL_CODES = new Set(
1837
1837
  "pull_request_from_fork pull_request_on_default_branch pull_request_ambiguous pull_request_repository_not_connected repository_not_reachable branch_claimed_elsewhere".split(" ")
1838
1838
  );
1839
1839
  async function tryClaimAndStart(state, item, queue) {
1840
- const { postJson: postJson2 } = await import('./work-cmd-H7LLCT2W.js');
1840
+ const { postJson: postJson2 } = await import('./work-cmd-NCP4637R.js');
1841
1841
  const log = logOf(state);
1842
1842
  const hostKey = await loadHostKey(state.config.configPath);
1843
1843
  const claim = await retrySend(
@@ -3037,7 +3037,7 @@ async function start(configPath, deps = { fetchImpl: fetch }) {
3037
3037
  check: update.check ? () => update.check(configPath) : async () => {
3038
3038
  const held = heldClaudeCredential();
3039
3039
  const env = held === void 0 ? process.env : { ...process.env, [held.variable]: held.value };
3040
- return (await import('./check-KD5PLAVL.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3040
+ return (await import('./check-64UX323V.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3041
3041
  },
3042
3042
  now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
3043
3043
  log
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { MIN_ENGINE_MAJOR } from './chunk-SVXFSQRD.js';
3
+ import { MIN_ENGINE_MAJOR } from './chunk-D3HRAPNF.js';
4
4
  import { runnerImageVersion } from './chunk-SK4TWCN3.js';
5
5
  import { firecrackerArch, MICROVM_ARCHES, guestAssetsPinned } from './chunk-TGHBOXKJ.js';
6
6
  import { spawnSync } from 'child_process';
@@ -4,19 +4,19 @@ import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk
4
4
  import { DOCKERD_LOG, HELPER_PATH, HELPER_RECORD } from './chunk-W5DOK7BL.js';
5
5
  import { writeDockerClientConfig } from './chunk-QL3LPZ67.js';
6
6
  import { zodProblem } from './chunk-I3LTIAOR.js';
7
- import { senderPidfile } from './chunk-JR4TZLG6.js';
8
- import { installScrubContext } from './chunk-A33USDCE.js';
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-SVXFSQRD.js';
7
+ import { senderPidfile } from './chunk-QDMMW5PC.js';
8
+ import { installScrubContext } from './chunk-3MXPS7ED.js';
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-D3HRAPNF.js';
10
10
  import { readBranchHead, fetchCommit, diffBetween } from './chunk-KLXWS5Z7.js';
11
11
  import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
12
12
  import { waitForAgent, vmExecArgs } from './chunk-6NWS455T.js';
13
13
  import { socketPathProblem, vsockLinks, LEASE_LINK, linkVsockSockets } from './chunk-LWTBE5J6.js';
14
- import { describeCallFailure, resolveGoverningSource, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, removeKeptContext, formatDuration, retrySend, formatClock, WORKFLOW_PERMISSION_REASON, keptContextTree } from './chunk-RAHE2AYU.js';
14
+ import { describeCallFailure, resolveGoverningSource, prefetchGovernedContext, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, removeKeptContext, formatDuration, retrySend, formatClock, WORKFLOW_PERMISSION_REASON, keptContextTree } from './chunk-RBJG5MM4.js';
15
15
  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-43PV5KDB.js';
16
16
  import { CLAUDE_CODE_VERSION, FIRECRACKER_VERSION } from './chunk-TGHBOXKJ.js';
17
17
  import { imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, DEFAULT_CHECK_TIME_LIMIT_MINUTES } from './chunk-5BNWAIHN.js';
18
18
  import { parseSize } from './chunk-YJLHUKYS.js';
19
- import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-TDVG6MCO.js';
19
+ import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-CMKY36NV.js';
20
20
  import { planArtifactUpload } from './chunk-EWVYQLD3.js';
21
21
  import { scrubText } from './chunk-5DNCFOXA.js';
22
22
  import { readCloudConfig } from './chunk-PJDQPF5N.js';
@@ -314,6 +314,19 @@ async function provisionMicroVm(input) {
314
314
  const governing = await resolveGoverningSource({ config, repository, fetchImpl: input.fetchImpl });
315
315
  if (!governing.ok) return fail(governing.reason);
316
316
  const governingSource = governing.source;
317
+ const controlPlaneUrl = (controlPlane) => runtime.remoteFor?.(controlPlane) ?? `${runtime.github.gitUrl}/${controlPlane}.git`;
318
+ if (governingSource.kind === "governed") {
319
+ const unfetched = await prefetchGovernedContext({
320
+ configPath: config.configPath,
321
+ repository,
322
+ source: governingSource,
323
+ controlPlaneUrl,
324
+ controlPlaneToken: () => tokens.controlPlane(),
325
+ log,
326
+ tag
327
+ });
328
+ if (unfetched !== void 0) return fail(unfetched);
329
+ }
317
330
  const limits = {
318
331
  cpus: config.build?.cpus ?? DEFAULT_CPUS,
319
332
  memoryBytes: buildMemoryBytes(config),
@@ -599,7 +612,7 @@ async function provisionMicroVm(input) {
599
612
  buildId,
600
613
  buildDir: buildDir2,
601
614
  fetchImpl: input.fetchImpl,
602
- controlPlaneUrl: (controlPlane) => runtime.remoteFor?.(controlPlane) ?? `${runtime.github.gitUrl}/${controlPlane}.git`,
615
+ controlPlaneUrl,
603
616
  controlPlaneToken: () => tokens.controlPlane(),
604
617
  log,
605
618
  tag
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { LiveUploader } from './chunk-A33USDCE.js';
3
+ import { LiveUploader } from './chunk-3MXPS7ED.js';
4
4
  import { CaptureDaemon } from './chunk-5DNCFOXA.js';
5
- import { spoolDir } from './chunk-WB7LPDXR.js';
5
+ import { spoolDir } from './chunk-DJWKUQLO.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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { WorkCommandError, postJson } from './chunk-TDVG6MCO.js';
4
- import { defaultGitRunner, materializeContext, isStagingWriteFault, lookupGoverningSource } from './chunk-EYW2ZRDL.js';
3
+ import { WorkCommandError, postJson } from './chunk-CMKY36NV.js';
4
+ import { defaultGitRunner, materializeContext, fetchControlPlaneCommit, lookupGoverningSource } from './chunk-WCELNMXT.js';
5
5
  import { signingFetchFor } from './chunk-WPGBDY73.js';
6
6
  import { signerFor } from './chunk-AA6LYZC4.js';
7
7
  import { SHIM_DIR, stagedContextDir, contextHomeDir, deliveryDir, keptContextDir } from './chunk-AGZNCIIJ.js';
@@ -328,7 +328,19 @@ var NoControlPlane = class extends Error {
328
328
  var GatewayConflict = class extends Error {
329
329
  };
330
330
  var unavailable = (why) => ({ kind: "refused", reason: `context_unavailable: ${why}` });
331
+ function tokenRefusedReason(err, repository) {
332
+ return err.detail === void 0 ? `context_unavailable: the gateway refused a token for the control plane named for ${repository} (${err.code})` : `context_unavailable: the token request for the control plane named for ${repository} failed: ${err.detail}`;
333
+ }
331
334
  var DESIGNATION_LOOKUP = { timeoutMs: 1e4, attempts: 2 };
335
+ function buildFetch(reuseCached) {
336
+ return { timeoutMs: 3e4, attempts: 2, reuseCached };
337
+ }
338
+ function credentialName(tokenRepository) {
339
+ return tokenRepository === void 0 ? "the host's git login" : "the token the gateway issued";
340
+ }
341
+ function fetchFailureReason(failure, credential, plane, sha, repository) {
342
+ return failure.kind === "no-access" ? `context_unavailable: ${credential} cannot read ${plane}, the control plane named for ${repository}` : `context_unavailable: commit ${sha.slice(0, 7)} of ${plane}, the control plane named for ${repository}, could not be fetched: ${failure.detail}`;
343
+ }
332
344
  function lookupFailureReason(failure, repository) {
333
345
  switch (failure?.kind) {
334
346
  case "timeout":
@@ -382,6 +394,7 @@ async function stageGovernedContext(input) {
382
394
  cloud: { url, apiKey, appId },
383
395
  fetchImpl: signingFetchFor(input.fetchImpl, configPath, apiKey),
384
396
  designationLookup: DESIGNATION_LOOKUP,
397
+ controlPlaneFetch: buildFetch(true),
385
398
  ...input.source === void 0 ? {} : { pinnedSource: input.source },
386
399
  git,
387
400
  now: input.now,
@@ -417,28 +430,19 @@ async function stageGovernedContext(input) {
417
430
  }
418
431
  if (result.message !== void 0) return finish(unavailable(result.message));
419
432
  return finish(unavailable(lookupFailureReason(result.lookupFailure, input.repository)));
420
- case "unreachable":
421
433
  case "no-access": {
422
- const plane = isStagingWriteFault(result.message) ? void 0 : readDegraded(join(tree, ".git"))?.repository;
423
- if (plane !== void 0) {
424
- const credential = tokenRepository !== void 0 && tokenRepository.toLowerCase() === plane.toLowerCase() ? "the token the gateway issued" : "the host's git login";
425
- return finish(unavailable(`${credential} cannot read ${plane}, the control plane named for ${input.repository}`));
426
- }
434
+ const plane = readDegraded(join(tree, ".git"))?.repository;
435
+ if (plane !== void 0) return finish(unavailable(`${credentialName(tokenRepository)} cannot read ${plane}, the control plane named for ${input.repository}`));
427
436
  return finish(unavailable(result.message ?? `the context of ${input.repository} could not be materialized (${result.status})`));
428
437
  }
438
+ // An unreachable result is a timeout, a network failure, or a failure to write the fetched files. Its message says which.
429
439
  default:
430
440
  return finish(unavailable(result.message ?? `the context of ${input.repository} could not be materialized (${result.status})`));
431
441
  }
432
442
  } catch (err) {
433
443
  if (err instanceof NoControlPlane) return finish({ kind: "none" });
434
444
  if (err instanceof GatewayConflict) return finish({ kind: "refused", reason: `context_conflict: ${err.message}` });
435
- if (err instanceof TokenRefused) {
436
- return finish(
437
- unavailable(
438
- err.detail === void 0 ? `the gateway refused a token for the control plane named for ${input.repository} (${err.code})` : `the token request for the control plane named for ${input.repository} failed: ${err.detail}`
439
- )
440
- );
441
- }
445
+ if (err instanceof TokenRefused) return finish({ kind: "refused", reason: tokenRefusedReason(err, input.repository) });
442
446
  return finish(unavailable(`the context of ${input.repository} could not be staged: ${err instanceof Error ? err.message : String(err)}`));
443
447
  }
444
448
  }
@@ -462,6 +466,32 @@ async function controlPlaneAccess(ask, candidates, repository, log, tag) {
462
466
  }
463
467
  return answer;
464
468
  }
469
+ async function prefetchGovernedContext(input) {
470
+ const { repository, source } = input;
471
+ let tokenRepository;
472
+ try {
473
+ const fetched = await fetchControlPlaneCommit({
474
+ git: input.git ?? defaultGitRunner,
475
+ home: contextHomeDir(input.configPath),
476
+ repository: source.repository,
477
+ sha: source.sha,
478
+ remoteUrl: input.controlPlaneUrl(source.repository),
479
+ token: async () => {
480
+ if (input.controlPlaneToken === void 0) return void 0;
481
+ const access = await controlPlaneAccess(input.controlPlaneToken, [{ repository: source.repository }], repository, input.log, input.tag);
482
+ tokenRepository = access?.repository;
483
+ return access?.token;
484
+ },
485
+ policy: buildFetch(false)
486
+ });
487
+ if (fetched.ok) return void 0;
488
+ return fetchFailureReason(fetched, credentialName(tokenRepository), source.repository, source.sha, repository);
489
+ } catch (err) {
490
+ if (err instanceof NoControlPlane || err instanceof GatewayConflict) return void 0;
491
+ if (err instanceof TokenRefused) return tokenRefusedReason(err, repository);
492
+ return `context_unavailable: the control plane named for ${repository} could not be fetched: ${err instanceof Error ? err.message : String(err)}`;
493
+ }
494
+ }
465
495
  function removeStagedContext(buildDir) {
466
496
  rmSync(stagedContextDir(buildDir), { recursive: true, force: true });
467
497
  }
@@ -516,4 +546,4 @@ async function imageTargetFor(input) {
516
546
  return { ok: true, repository: resolved.source.repository, pinned: { commit: resolved.source.sha, ref: resolved.source.ref } };
517
547
  }
518
548
 
519
- export { BuildTokens, WORKFLOW_PERMISSION_REASON, classifyRefusal, commandWithShim, controlPlaneTokenFailure, createRunnerLog, describeCallFailure, formatClock, formatDuration, imageTargetFor, keepStagedContext, keptContextTree, logStamp, pinnedSourceOf, refusalCode, relativeToRunner, removeKeptContext, removeStagedContext, resolveGoverningSource, retrySend, shimScript, shortClaim, stageGovernedContext };
549
+ export { BuildTokens, WORKFLOW_PERMISSION_REASON, classifyRefusal, commandWithShim, controlPlaneTokenFailure, createRunnerLog, describeCallFailure, formatClock, formatDuration, imageTargetFor, keepStagedContext, keptContextTree, logStamp, pinnedSourceOf, prefetchGovernedContext, refusalCode, relativeToRunner, removeKeptContext, removeStagedContext, resolveGoverningSource, retrySend, shimScript, shortClaim, stageGovernedContext };
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { hasStoredCredential, AGENT_COMMANDS, storeClaudeCredential, credentialFromStdin, isAgentName } from './chunk-CUBIZBMF.js';
4
- import { detectMachine, supportsContainerBuilds, reachDockerStep, describeMachineDocker, supportsMicroVmBuilds } from './chunk-FMH6LSUE.js';
5
- import { MIN_ENGINE_MAJOR } from './chunk-SVXFSQRD.js';
4
+ import { detectMachine, supportsContainerBuilds, reachDockerStep, describeMachineDocker, supportsMicroVmBuilds } from './chunk-I5LGKZ4M.js';
5
+ import { MIN_ENGINE_MAJOR } from './chunk-D3HRAPNF.js';
6
6
  import { runnerCredentialProblem } from './chunk-5BNWAIHN.js';
7
7
  import { runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-AGZNCIIJ.js';
8
8
  import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
@@ -79,10 +79,12 @@ var defaultGitRunner = (args, opts) => {
79
79
  return { ok: true, stdout: Buffer.isBuffer(stdout) ? stdout : Buffer.from(stdout), stderr: "" };
80
80
  } catch (err) {
81
81
  const e = err;
82
+ const stderr = e.stderr ? Buffer.from(e.stderr).toString("utf8") : "";
82
83
  return {
83
84
  ok: false,
84
85
  stdout: e.stdout ? Buffer.from(e.stdout) : Buffer.alloc(0),
85
- stderr: e.stderr ? Buffer.from(e.stderr).toString("utf8") : e.message ?? String(err)
86
+ stderr: stderr === "" ? e.message ?? String(err) : stderr,
87
+ ...e.code === "ETIMEDOUT" ? { timedOut: true } : {}
86
88
  };
87
89
  }
88
90
  };
@@ -90,6 +92,36 @@ function gitText(git, cwd, args, timeoutMs) {
90
92
  const result = git(args, { cwd, timeoutMs });
91
93
  return result.ok ? result.stdout.toString("utf8").trim() : void 0;
92
94
  }
95
+ function fetchFailureDetail(result, timeoutMs) {
96
+ if (result.timedOut === true) return `git fetch did not finish within ${timeoutMs / 1e3} seconds`;
97
+ const lines = result.stderr.split("\n").map((line2) => line2.trim()).filter((line2) => line2 !== "");
98
+ const line = lines.find((candidate) => /^(fatal|error):/.test(candidate)) ?? lines.at(-1) ?? "git fetch failed";
99
+ return line.replace(/(\w+:\/\/)[^/@\s]+@/g, "$1").slice(0, 300);
100
+ }
101
+ async function fetchControlPlaneCommit(input) {
102
+ const { git, home, repository, sha, remoteUrl, policy } = input;
103
+ const cacheHost = parseRemoteHost(remoteUrl).host || "unknown-host";
104
+ const cacheRepoDir = ensureBareCache(git, home, repository, cacheHost);
105
+ const localRef = `refs/outerlayer/sha-${sanitizeRefName(sha)}`;
106
+ if (policy.reuseCached && gitText(git, cacheRepoDir, ["rev-parse", "--verify", "--quiet", localRef], 2e3) === sha) {
107
+ return { ok: true, cacheRepoDir, localRef, fetched: false };
108
+ }
109
+ const token = await input.token();
110
+ const attempts = Math.max(1, policy.attempts);
111
+ for (let attempt = 1; ; attempt++) {
112
+ const result = git(["fetch", "--depth", "1", remoteUrl, `+${sha}:${localRef}`], {
113
+ cwd: cacheRepoDir,
114
+ timeoutMs: policy.timeoutMs,
115
+ ...token === void 0 ? {} : { env: (base) => withTokenHeader(base, remoteUrl, token) }
116
+ });
117
+ if (result.ok) return { ok: true, cacheRepoDir, localRef, fetched: true };
118
+ const kind = result.timedOut === true ? "unreachable" : classifyGitFailure(result.stderr);
119
+ if (kind === "no-access" || attempt >= attempts) {
120
+ const detail = fetchFailureDetail(result, policy.timeoutMs);
121
+ return { ok: false, kind, detail: attempt > 1 ? `${detail} (${attempt} attempts)` : detail };
122
+ }
123
+ }
124
+ }
93
125
  var GATEWAY_TOO_OLD_MESSAGE = "the OuterLayer this machine talks to is too old to name the control plane \u2014 ask whoever runs it to upgrade; context written earlier is kept";
94
126
  var CANNOT_IDENTIFY_MESSAGE = "this repository is governed, but the control plane cannot be identified \u2014 check OuterLayer connectivity/config";
95
127
  function designationAuthRejectedMessage(credential) {
@@ -97,9 +129,6 @@ function designationAuthRejectedMessage(credential) {
97
129
  }
98
130
  var PARTIAL_WRITE_MESSAGE = "control-plane content could not be fully written";
99
131
  var OVERLAY_FAILED_MESSAGE = "control-plane content was written but the maintained skills could not be refreshed";
100
- function isStagingWriteFault(message) {
101
- return message === PARTIAL_WRITE_MESSAGE || message === OVERLAY_FAILED_MESSAGE;
102
- }
103
132
  function hasSymlinkComponent(root, relPath) {
104
133
  let current = root;
105
134
  for (const segment of relPath.split("/")) {
@@ -121,7 +150,7 @@ function noAccessMessage() {
121
150
  return "you do not have access to the control plane \u2014 check your git credentials (SSH key or token) and org/SSO access, then retry";
122
151
  }
123
152
  function classifyGitFailure(stderr) {
124
- if (/authentication failed|permission denied \(publickey\)|\b403\b|saml sso|access denied/i.test(stderr)) {
153
+ if (/authentication failed|permission denied \(publickey\)|\b403\b|saml sso|access denied|could not read (username|password)|repository .*not found/i.test(stderr)) {
125
154
  return "no-access";
126
155
  }
127
156
  return "unreachable";
@@ -216,25 +245,28 @@ async function materializeContext(deps) {
216
245
  }
217
246
  };
218
247
  const remoteUrl = deps.resolveControlPlaneUrl ? deps.resolveControlPlaneUrl(repository, ref, repoRoot) : buildControlPlaneUrl(git, repoRoot, repository);
219
- const cacheHost = parseRemoteHost(remoteUrl).host || "unknown-host";
220
- const cacheRepoDir = ensureBareCache(git, home, repository, cacheHost);
221
- const localRef = `refs/outerlayer/sha-${sanitizeRefName(storedSha)}`;
222
- const wanted = `+${storedSha}:${localRef}`;
223
- const access = await deps.controlPlaneAccess?.([{ repository, ref }]);
224
- const token = access !== void 0 && normalizeRepoName(access.repository) === normalizeRepoName(repository) ? access.token : void 0;
225
- const fetchResult = git(["fetch", "--depth", "1", remoteUrl, wanted], {
226
- cwd: cacheRepoDir,
227
- timeoutMs: 1e4,
228
- ...token === void 0 ? {} : { env: (base) => withTokenHeader(base, remoteUrl, token) }
248
+ const fetched = await fetchControlPlaneCommit({
249
+ git,
250
+ home,
251
+ repository,
252
+ sha: storedSha,
253
+ remoteUrl,
254
+ // A runner reads the control plane with a token for it, not the host's git login.
255
+ token: async () => {
256
+ const access = await deps.controlPlaneAccess?.([{ repository, ref }]);
257
+ return access !== void 0 && normalizeRepoName(access.repository) === normalizeRepoName(repository) ? access.token : void 0;
258
+ },
259
+ policy: deps.controlPlaneFetch ?? { timeoutMs: 1e4, attempts: 1, reuseCached: false }
229
260
  });
230
261
  const commitNote = (message) => `could not fetch commit \`${storedSha.slice(0, 7)}\` of ${repository}; ${message}`;
231
- if (!fetchResult.ok) {
232
- const kind = classifyGitFailure(fetchResult.stderr);
233
- const doctorMessage = commitNote(kind === "no-access" ? noAccessMessage() : unreachableMessage());
262
+ if (!fetched.ok) {
263
+ const { kind } = fetched;
264
+ const doctorMessage = commitNote(kind === "no-access" ? noAccessMessage() : `${unreachableMessage()}: ${fetched.detail}`);
234
265
  writeDegraded(gitCommonDir, { at: new Date(now()).toISOString(), kind, message: doctorMessage, repository, ref });
235
266
  record(null, "none", repository, ref);
236
267
  return { status: kind, message: doctorMessage, sha: null, verification: "none" };
237
268
  }
269
+ const { cacheRepoDir, localRef } = fetched;
238
270
  const fetchedSha = gitText(git, cacheRepoDir, ["rev-parse", localRef], 2e3);
239
271
  if (fetchedSha !== storedSha) {
240
272
  const doctorMessage = commitNote(unreachableMessage());
@@ -498,4 +530,4 @@ function writeFilesVerbatim(git, cacheRepoDir, files, workpieceRoot) {
498
530
  return { writtenPaths, ok: !anySkipped };
499
531
  }
500
532
 
501
- export { defaultGitRunner, isStagingWriteFault, lookupGoverningSource, materializeContext, parseOwnerRepo, resolveGitCommonDir };
533
+ export { defaultGitRunner, fetchControlPlaneCommit, lookupGoverningSource, materializeContext, parseOwnerRepo, resolveGitCommonDir };
@@ -2,14 +2,14 @@
2
2
  import { createRequire } from 'node:module';
3
3
  import { checkStarterFiles, contextIsGoverned } from './chunk-BJQ25STI.js';
4
4
  import { fleetCheck, checkBuildSkill, checkMachineSkills, checkCommittedMaintainedSkills, checkMaintainedReferences } from './chunk-6IKSUAIA.js';
5
- import { resolveCredentials, getJson, WorkCommandError } from './chunk-TDVG6MCO.js';
5
+ import { resolveCredentials, getJson, WorkCommandError } from './chunk-CMKY36NV.js';
6
6
  import { isLinkedRepository } from './chunk-ZQOSIMKU.js';
7
7
  import { sanitizeTerminal } from './chunk-EWVYQLD3.js';
8
8
  import { resolveRepoIdentity, compareVersions, SUPPORTED_VERSIONS } from './chunk-5DNCFOXA.js';
9
9
  import { C } from './chunk-ANPNT6PM.js';
10
10
  import { checkFormerSkillNames } from './chunk-UIUGTW5C.js';
11
11
  import { resolveGatewayCredentials, defaultFetch } from './chunk-WPGBDY73.js';
12
- import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-WB7LPDXR.js';
12
+ import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-DJWKUQLO.js';
13
13
  import { readStatuslineState, STATE_FRESH_MS } from './chunk-I7RZHMXW.js';
14
14
  import { hookCommandEscapesControlPlane, CONTROL_PLANE_DIR_VARIABLE } from './chunk-HCVLP7XA.js';
15
15
  import { findGitDirs } from './chunk-BJ3KTMDH.js';
@@ -1212,7 +1212,7 @@ async function gatherDoctorChecks() {
1212
1212
  const { runnerVmCheck } = await import('./doctor-53F2PYY7.js');
1213
1213
  checks.push(runnerVmCheck(configPath, { lima: realLima(), home: homeFromEnv(), instance: runnerVm.instance }));
1214
1214
  } else if (hasRunnerBlock(configPath)) {
1215
- const { runnerHostChecks } = await import('./doctor-N36BHNH3.js');
1215
+ const { runnerHostChecks } = await import('./doctor-N3CDJ66I.js');
1216
1216
  const gateway = (() => {
1217
1217
  try {
1218
1218
  const { url, apiKey, appId } = loadRunnerConfig(configPath);
@@ -252,7 +252,7 @@ async function runClaudeLauncher(args, deps = {}) {
252
252
  return 1;
253
253
  }
254
254
  } else {
255
- const { resolveLaunchPlane } = await import('./control-plane-launch-PSFYCKYH.js');
255
+ const { resolveLaunchPlane } = await import('./control-plane-launch-SMHL6MWW.js');
256
256
  const plane = env[GOVERNANCE_VARIABLE] === "self" ? { kind: "none" } : await resolveLaunchPlane({ cwd, env, home, fetchImpl: deps.fetchImpl, stderr });
257
257
  if (plane.kind === "none") {
258
258
  const own2 = ownSkillsDirFor(cwd, home, [], stderr);