@outerlayer/cli 0.35.0-next.20261030133755 → 0.35.0-next.20261030155846

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 (119) hide show
  1. package/dist/{agent-setup-G445QZEM.js → agent-setup-346QMQY6.js} +5 -5
  2. package/dist/{build-LWGTJ6K3.js → build-HHBTSTE4.js} +6 -6
  3. package/dist/{build-disk-TA5NS2BN.js → build-disk-R6OH6JL5.js} +5 -5
  4. package/dist/build-info.json +1 -1
  5. package/dist/{builder-L6N32DCZ.js → builder-DL6NSVAU.js} +4 -4
  6. package/dist/{caller-QHP5BZOI.js → caller-Q44OIVRR.js} +7 -7
  7. package/dist/{check-ULHNX42A.js → check-W4LSRCMV.js} +35 -34
  8. package/dist/{chunk-PPZ47OB6.js → chunk-3L7OHRDV.js} +1 -1
  9. package/dist/{chunk-XU5BNWX7.js → chunk-4DJZSNVT.js} +1 -1
  10. package/dist/{chunk-XKTZBFAR.js → chunk-4PW2DKHE.js} +315 -27
  11. package/dist/{chunk-VNHBDHX7.js → chunk-7J7HRYZ3.js} +1 -1
  12. package/dist/{chunk-LCR2GOVD.js → chunk-7KAWBQ7V.js} +3 -3
  13. package/dist/{chunk-PILW3YP4.js → chunk-7TTYUY2V.js} +1 -1
  14. package/dist/{chunk-ZI7JENTB.js → chunk-7Y5VW4JG.js} +1 -1
  15. package/dist/{chunk-IALIYKEB.js → chunk-ABGJ67PH.js} +10 -6
  16. package/dist/{chunk-7R655ODT.js → chunk-AF6DQJ5W.js} +1 -1
  17. package/dist/{chunk-SQGD4LYW.js → chunk-ALEUIS35.js} +1 -1
  18. package/dist/{chunk-ECKZ7ZMW.js → chunk-AZJCSBRV.js} +87 -28
  19. package/dist/{chunk-M355QZ4O.js → chunk-BNFFQC3M.js} +7 -7
  20. package/dist/{chunk-MULCOUAU.js → chunk-CPIYKBQ2.js} +4 -4
  21. package/dist/{chunk-ZC6BJ6XE.js → chunk-DH6BDQM4.js} +46 -19
  22. package/dist/{chunk-NOSVP4DO.js → chunk-DOYLWBJJ.js} +3 -3
  23. package/dist/{chunk-Z5Z5NWYF.js → chunk-EK2FNOCD.js} +2 -2
  24. package/dist/{chunk-SHPCVBT3.js → chunk-EZRAR5YG.js} +1 -1
  25. package/dist/{chunk-7YCHMJ7K.js → chunk-FKLGX72N.js} +6 -6
  26. package/dist/{chunk-22TSOZFT.js → chunk-FW3ZQKPY.js} +4 -4
  27. package/dist/{chunk-B2O6FJX7.js → chunk-G2HRULTO.js} +2 -2
  28. package/dist/{chunk-B2IVZ2VJ.js → chunk-GGI3J7WS.js} +103 -22
  29. package/dist/{chunk-54BABLHB.js → chunk-HTQBIXE7.js} +2 -2
  30. package/dist/{chunk-WVWWUVHW.js → chunk-K3Z4Y6VU.js} +3 -3
  31. package/dist/{chunk-J5MONLV2.js → chunk-K5EOLRGJ.js} +3 -3
  32. package/dist/{chunk-LW2A24IA.js → chunk-LGV5N5DG.js} +1 -1
  33. package/dist/{chunk-THF4YBBI.js → chunk-LXAYOMSX.js} +6 -6
  34. package/dist/{chunk-TN4OV3H7.js → chunk-MCMDEEXB.js} +3 -3
  35. package/dist/{receive-files-T2BIUBQL.js → chunk-NN33FYXG.js} +0 -1
  36. package/dist/{chunk-XQXQA446.js → chunk-ODX2XCL3.js} +3 -3
  37. package/dist/{chunk-7SUCHVM6.js → chunk-OS73XDJ7.js} +5 -5
  38. package/dist/{chunk-2RBIAXER.js → chunk-P24VR4H3.js} +2 -2
  39. package/dist/{chunk-NEG4C24O.js → chunk-P4PVRDVY.js} +3 -3
  40. package/dist/{chunk-NZF7CALU.js → chunk-P5CXB7ZT.js} +3 -3
  41. package/dist/{chunk-2F43WNKI.js → chunk-RIHB3HA2.js} +3 -3
  42. package/dist/{chunk-37NRGUIQ.js → chunk-RKDOKIIK.js} +2 -2
  43. package/dist/{chunk-GVYHRPJC.js → chunk-RLFVKOEI.js} +3 -3
  44. package/dist/{chunk-TMIJHMEN.js → chunk-RS2RFWIK.js} +1 -1
  45. package/dist/{chunk-ADWYXR2P.js → chunk-SEY2HTZO.js} +7 -7
  46. package/dist/{chunk-GCSVZGKI.js → chunk-SUVWQPOG.js} +3 -3
  47. package/dist/{chunk-POZ65DAI.js → chunk-USR45QSV.js} +1 -1
  48. package/dist/{chunk-CIPWXGGF.js → chunk-UVQ5C3UP.js} +1 -1
  49. package/dist/{chunk-USQ2ZUSN.js → chunk-VQCUADLI.js} +3 -3
  50. package/dist/{chunk-Y5N7IS4F.js → chunk-VRNAM7WM.js} +10 -10
  51. package/dist/{chunk-AUVJMR3P.js → chunk-WAZJPDR2.js} +1 -1
  52. package/dist/{chunk-YQHUCOUL.js → chunk-WT7J2627.js} +4 -1
  53. package/dist/{chunk-EK7MQ56V.js → chunk-WYGAQVBU.js} +1 -1
  54. package/dist/{chunk-RLAS77FI.js → chunk-WYJUQGCB.js} +3 -3
  55. package/dist/{chunk-GBMTKV5B.js → chunk-YQHEJ5SV.js} +1 -1
  56. package/dist/{claude-launcher-VA3OAA5V.js → claude-launcher-HREPADCN.js} +97 -9
  57. package/dist/{cli-STPFQSGI.js → cli-KQUVZRRG.js} +110 -110
  58. package/dist/{command-UZTCQJAQ.js → command-OHJUJ2WX.js} +24 -23
  59. package/dist/{config-GCPH6DGZ.js → config-EYFLM4WT.js} +6 -6
  60. package/dist/{connect-cmd-Q7GRZKSD.js → connect-cmd-REJ5FEC6.js} +5 -5
  61. package/dist/{container-start-JURQ4GR2.js → container-start-KG3ZLJWU.js} +27 -26
  62. package/dist/{context-show-cmd-44HVXXZJ.js → context-show-cmd-XT3QP5OR.js} +6 -6
  63. package/dist/{control-plane-launch-X2QXGPFW.js → control-plane-launch-PCGH76P5.js} +4 -4
  64. package/dist/{demo-voice-cmd-HA73DEBA.js → demo-voice-cmd-2QE7SQRC.js} +11 -11
  65. package/dist/{dist-YUHKBUBD.js → dist-BARPQSHD.js} +1 -1
  66. package/dist/{docker-7XBRCORA.js → docker-3UKTW4GR.js} +4 -4
  67. package/dist/{doctor-VNTOVFF6.js → doctor-5HY3JA5Y.js} +24 -23
  68. package/dist/{emit-artifact-cmd-OLWISCTW.js → emit-artifact-cmd-26PJDTFU.js} +10 -10
  69. package/dist/{emit-criteria-cmd-HXXNZP55.js → emit-criteria-cmd-6YTFXO3L.js} +7 -7
  70. package/dist/{emit-demo-cmd-WCGUGLWU.js → emit-demo-cmd-OQ7UDDRG.js} +11 -11
  71. package/dist/{emit-finding-cmd-EAASHBSF.js → emit-finding-cmd-NO3FSRHT.js} +7 -7
  72. package/dist/{emit-result-cmd-JB3YNG5V.js → emit-result-cmd-7MSUTXG6.js} +9 -9
  73. package/dist/{emit-step-cmd-LVOXE2LI.js → emit-step-cmd-7PFO7XVA.js} +7 -7
  74. package/dist/{find-unit-TP4HYWZM.js → find-unit-3MED6CPQ.js} +8 -8
  75. package/dist/{findings-cmd-NPRBGBWC.js → findings-cmd-SWAPQUFT.js} +7 -7
  76. package/dist/{fleet-readiness-ZQOFJZ5B.js → fleet-readiness-5RMWZH4V.js} +4 -4
  77. package/dist/{governing-source-D65HNFFP.js → governing-source-INXQEK24.js} +9 -9
  78. package/dist/{hook-fast-OPHM3MRK.js → hook-fast-2KVZZRJN.js} +1 -1
  79. package/dist/{host-checks-JHCU7PBL.js → host-checks-RCWXCCW2.js} +25 -24
  80. package/dist/{pending-2VIIFAP4.js → host-key-O4DFMOSV.js} +2 -2
  81. package/dist/{image-tag-JWATDMIZ.js → image-tag-WBD57QBN.js} +2 -2
  82. package/dist/index.js +4 -4
  83. package/dist/{init-SSTC6YY4.js → init-52F2M54W.js} +20 -19
  84. package/dist/{init-UYPFZV3A.js → init-U5XUDKE7.js} +20 -19
  85. package/dist/{init-cmd-YLS73UEJ.js → init-cmd-WYLANAD5.js} +10 -10
  86. package/dist/{init-update-J7AL65L3.js → init-update-Z2T5J3Z2.js} +9 -9
  87. package/dist/{install-cmd-ZEFBJH24.js → install-cmd-JKPXIOEY.js} +4 -4
  88. package/dist/{logs-3YRC7HRA.js → logs-FEITSC2V.js} +1 -1
  89. package/dist/{loop-XQJY3ZTX.js → loop-WJBFH6XU.js} +34 -33
  90. package/dist/{machine-FLZ6ZM7O.js → machine-KUUTBDAT.js} +20 -19
  91. package/dist/{mcp-serve-cmd-PKXIHUOX.js → mcp-serve-cmd-ZINYSLY6.js} +3 -3
  92. package/dist/{paths-7PC3K7C3.js → paths-XEYE7OZ2.js} +1 -1
  93. package/dist/{host-key-Q5DEAP3Q.js → pending-D2NNV54J.js} +2 -2
  94. package/dist/{pidfile-KQ2EJABZ.js → pidfile-FLFVRKVW.js} +2 -2
  95. package/dist/receive-files-5MBUXAE5.js +6 -0
  96. package/dist/{record-IHEF6C33.js → record-JMZOXD4R.js} +2 -2
  97. package/dist/{runner-env-2FM6I4OS.js → runner-env-2NVOHTRC.js} +8 -8
  98. package/dist/{runner-identity-QTGQJBBB.js → runner-identity-T6YPTHOH.js} +4 -4
  99. package/dist/{runner-key-6XPOLXFF.js → runner-key-WPQGF2L7.js} +20 -19
  100. package/dist/{session-sender-4KJOPWXH.js → session-sender-ADHV7WZ6.js} +10 -10
  101. package/dist/{spec-cmd-NKLZGF34.js → spec-cmd-OUEKA6X3.js} +8 -8
  102. package/dist/{state-FJPSFOID.js → state-UWIM42JH.js} +2 -2
  103. package/dist/{status-M2XPA33H.js → status-2JRATV66.js} +25 -24
  104. package/dist/{sync-cmd-QVHWU4VF.js → sync-cmd-IEPWMYWY.js} +9 -9
  105. package/dist/{update-steps-2ZLRFCHB.js → update-steps-3SRL32IV.js} +26 -25
  106. package/dist/{watch-J6PJHOWO.js → watch-3K3IB443.js} +9 -9
  107. package/dist/{work-claim-cmd-EP74CEYP.js → work-claim-cmd-5ACB2ZWP.js} +13 -13
  108. package/dist/{work-cmd-A3O2XIVJ.js → work-cmd-B6HZW26B.js} +7 -7
  109. package/dist/{work-comment-cmd-AP2ENAHC.js → work-comment-cmd-MBGBBR7V.js} +8 -8
  110. package/dist/{work-demo-cmd-PNZU3OOM.js → work-demo-cmd-RLOS55MP.js} +7 -7
  111. package/dist/{work-logs-cmd-DNOMJ6HT.js → work-logs-cmd-VUICWCEO.js} +7 -7
  112. package/dist/{work-open-pr-cmd-M5ON2YNB.js → work-open-pr-cmd-CYXICEJE.js} +8 -8
  113. package/dist/{work-pr-cmd-34FS6U3C.js → work-pr-cmd-3HSFJO65.js} +7 -7
  114. package/dist/{work-proofs-cmd-UFAIGZZH.js → work-proofs-cmd-NJ4YYQ2V.js} +8 -8
  115. package/dist/{work-proofs-record-QFK57MWS.js → work-proofs-record-NN7XB2QC.js} +14 -14
  116. package/dist/{work-stop-cmd-JSKWIULW.js → work-stop-cmd-QXZSZLEY.js} +7 -7
  117. package/package.json +1 -1
  118. package/skill-pack/maintained/outerlayer-amend/SKILL.md +9 -7
  119. package/skill-pack/maintained/outerlayer-amend/references/earlier-run.md +18 -0
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { checkStarterFiles, contextIsGoverned } from './chunk-Q7ZHL6FY.js';
4
- import { resolveCredentials, getJson, WorkCommandError } from './chunk-7YCHMJ7K.js';
5
- import { isLinkedRepository } from './chunk-54BABLHB.js';
4
+ import { resolveCredentials, getJson, WorkCommandError } from './chunk-FKLGX72N.js';
5
+ import { isLinkedRepository } from './chunk-HTQBIXE7.js';
6
6
  import { C } from './chunk-2AM6Z5BP.js';
7
- import { fleetCheck, checkBuildSkill, checkMachineSkills, checkCommittedMaintainedSkills, checkMaintainedReferences, checkIgnoredSkillFolders } from './chunk-POZ65DAI.js';
7
+ import { fleetCheck, checkBuildSkill, checkMachineSkills, checkCommittedMaintainedSkills, checkMaintainedReferences, checkIgnoredSkillFolders } from './chunk-USR45QSV.js';
8
8
  import { sanitizeTerminal } from './chunk-XSX42Q2H.js';
9
9
  import { checkFormerSkillNames } from './chunk-AWNONB6E.js';
10
- import { resolveGatewayCredentials, defaultFetch } from './chunk-GBMTKV5B.js';
11
- import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-PPZ47OB6.js';
10
+ import { resolveGatewayCredentials, defaultFetch } from './chunk-YQHEJ5SV.js';
11
+ import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-3L7OHRDV.js';
12
12
  import { readStatuslineState, STATE_FRESH_MS } from './chunk-YBAVN6WS.js';
13
13
  import { hookCommandEscapesControlPlane, CONTROL_PLANE_DIR_VARIABLE } from './chunk-HCVLP7XA.js';
14
14
  import { findGitDirs } from './chunk-BJ3KTMDH.js';
15
- import { resolveRepoIdentity, compareVersions, SUPPORTED_VERSIONS } from './chunk-ZC6BJ6XE.js';
15
+ import { resolveRepoIdentity, compareVersions, SUPPORTED_VERSIONS } from './chunk-DH6BDQM4.js';
16
16
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
17
17
  import { readSettings, settingsPath, isOurStatuslineSlot, statuslineWrappedOriginal, REGISTERED_EVENTS, isOurHookCommand, ourCommandBins, cliBinResolvable, ourDirectScriptBins, wrappedOriginalCommand } from './chunk-KYDEBGJG.js';
18
18
  import { readDeliveryRecord, readDegraded, readSourceCache } from './chunk-YQR6E6OV.js';
@@ -1195,8 +1195,8 @@ function doctorExitCode(checks) {
1195
1195
 
1196
1196
  // src/doctor-report.ts
1197
1197
  async function gatherDoctorChecks() {
1198
- const { DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK } = await import('./build-disk-TA5NS2BN.js');
1199
- const { defaultRunnerConfigPath, hasRunnerBlock, keyRunnerFactory, loadRunnerConfig, runnerVmOf } = await import('./config-GCPH6DGZ.js');
1198
+ const { DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK } = await import('./build-disk-R6OH6JL5.js');
1199
+ const { defaultRunnerConfigPath, hasRunnerBlock, keyRunnerFactory, loadRunnerConfig, runnerVmOf } = await import('./config-EYFLM4WT.js');
1200
1200
  const configPath = defaultRunnerConfigPath();
1201
1201
  const runnerHost = hasRunnerBlock(configPath);
1202
1202
  const hooks = (() => {
@@ -1224,7 +1224,7 @@ async function gatherDoctorChecks() {
1224
1224
  const { runnerVmCheck } = await import('./doctor-53F2PYY7.js');
1225
1225
  checks.push(runnerVmCheck(configPath, { lima: realLima(), home: homeFromEnv(), instance: runnerVm.instance }));
1226
1226
  } else if (hasRunnerBlock(configPath)) {
1227
- const { runnerHostChecks } = await import('./doctor-VNTOVFF6.js');
1227
+ const { runnerHostChecks } = await import('./doctor-5HY3JA5Y.js');
1228
1228
  const gateway = (() => {
1229
1229
  try {
1230
1230
  const loaded = loadRunnerConfig(configPath);
@@ -1252,7 +1252,7 @@ async function gatherDoctorChecks() {
1252
1252
  const service = await (async () => {
1253
1253
  const { existsSync: existsSync3 } = await import('fs');
1254
1254
  if (process.platform !== "linux" || !existsSync3("/run/systemd/system")) return void 0;
1255
- const { inspectRunnerService } = await import('./find-unit-TP4HYWZM.js');
1255
+ const { inspectRunnerService } = await import('./find-unit-3MED6CPQ.js');
1256
1256
  return inspectRunnerService(configPath);
1257
1257
  })();
1258
1258
  checks.push(...await runnerHostChecks({ configPath, hooks, gateway, repos, runner, service }));
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { isSameProcess } from './chunk-JBJTC3UU.js';
4
- import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-YQHUCOUL.js';
4
+ import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-WT7J2627.js';
5
5
  import { existsSync, readFileSync, mkdirSync, writeFileSync, rmSync } from 'fs';
6
6
  import { dirname } from 'path';
7
7
 
@@ -47,6 +47,9 @@ function storeScopes(configPath) {
47
47
  }
48
48
  return [void 0, ...organizations.sort()];
49
49
  }
50
+ function sessionsDir(configPath, organizationId) {
51
+ return join(orgStore(configPath, organizationId), "sessions");
52
+ }
50
53
  function imagesDir(configPath, organizationId) {
51
54
  return join(orgStore(configPath, organizationId), "images");
52
55
  }
@@ -121,4 +124,4 @@ function imageBuildLogsDir(configPath, owner, name, organizationId) {
121
124
  return join(imagesDir(configPath, organizationId), owner, name, "builds");
122
125
  }
123
126
 
124
- export { RUNNER_DIR_MODE, RUNNER_FILE_MODE, SHIM_DIR, attemptStamp, buildDir, builderCacheDiskPath, builderConsolePath, buildsDir, contextHomeDir, deliveryDir, diskTemplatesDir, ghConfigDir, hostKeyPath, imageBuildLogsDir, imagesDir, jobConsolePath, jobDir, jobsDir, keptContextDir, mirrorDir, orgHomeDir, orgStore, orgStoreIn, pidFilePath, repoCacheDir, rootfsDir, rootfsPathFor, runnerDir, runnerDirOfBuild, spoolDir, stagedContextDir, storeScopes, vmAssetsDir, vsockPath };
127
+ export { RUNNER_DIR_MODE, RUNNER_FILE_MODE, SHIM_DIR, attemptStamp, buildDir, builderCacheDiskPath, builderConsolePath, buildsDir, contextHomeDir, deliveryDir, diskTemplatesDir, ghConfigDir, hostKeyPath, imageBuildLogsDir, imagesDir, jobConsolePath, jobDir, jobsDir, keptContextDir, mirrorDir, orgHomeDir, orgStore, orgStoreIn, pidFilePath, repoCacheDir, rootfsDir, rootfsPathFor, runnerDir, runnerDirOfBuild, sessionsDir, spoolDir, stagedContextDir, storeScopes, vmAssetsDir, vsockPath };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { removeRetiredSkills } from './chunk-AWNONB6E.js';
4
- import { defaultFetch, resolveGatewayCredentials } from './chunk-GBMTKV5B.js';
4
+ import { defaultFetch, resolveGatewayCredentials } from './chunk-YQHEJ5SV.js';
5
5
  import { appendContextProvenance } from './chunk-545P7JY7.js';
6
6
  import { loadMaintainedFiles, writeMaintainedFiles } from './chunk-MGF4254K.js';
7
7
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
@@ -2,10 +2,10 @@
2
2
  import { createRequire } from 'node:module';
3
3
  import { launchRefusalForSession } from './chunk-AAGU5FJF.js';
4
4
  import { detectActiveSession } from './chunk-IP7BIBXJ.js';
5
- import { autoConnect } from './chunk-NZF7CALU.js';
5
+ import { autoConnect } from './chunk-P5CXB7ZT.js';
6
6
  import { C } from './chunk-2AM6Z5BP.js';
7
- import { resolveGatewayCredentials, defaultFetch, unauthorizedMessage } from './chunk-GBMTKV5B.js';
8
- import { resolveRepoIdentity } from './chunk-ZC6BJ6XE.js';
7
+ import { resolveGatewayCredentials, defaultFetch, unauthorizedMessage } from './chunk-YQHEJ5SV.js';
8
+ import { resolveRepoIdentity } from './chunk-DH6BDQM4.js';
9
9
  import { launchedItemForSession } from './chunk-5WYT3PPE.js';
10
10
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
11
11
  import { CriteriaListSchema } from './chunk-N2XW4NYY.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-HWVMRETT.js';
4
- import { signRunnerRequest, signerFor } from './chunk-XU5BNWX7.js';
4
+ import { signRunnerRequest, signerFor } from './chunk-4DJZSNVT.js';
5
5
  import { readRepoConnection, findGitDirs } from './chunk-BJ3KTMDH.js';
6
6
  import { PLAIN_VERSION, recordCliVersion, removeRecordedVersion } from './chunk-OLM2TIOW.js';
7
7
  import { resolvePackageVersion } from './chunk-RA3O54FC.js';
@@ -12,9 +12,9 @@ import './chunk-2PMJ7TQR.js';
12
12
  import './chunk-N2XW4NYY.js';
13
13
  import { homeFromEnv } from './chunk-352DHUTP.js';
14
14
  import './chunk-Z5GEFMRW.js';
15
- import { spawnSync, execFileSync, spawn } from 'child_process';
16
- import { existsSync, accessSync, constants, statSync, readFileSync, readdirSync, lstatSync, rmSync, mkdirSync, realpathSync, symlinkSync, renameSync, readlinkSync, writeFileSync } from 'fs';
17
- import { join, delimiter, isAbsolute, resolve } from 'path';
15
+ import { spawn, execFileSync, spawnSync } from 'child_process';
16
+ import { readdirSync, existsSync, readFileSync, accessSync, constants, statSync, lstatSync, writeFileSync, rmSync, mkdirSync, realpathSync, symlinkSync, renameSync, readlinkSync } from 'fs';
17
+ import { join, delimiter, isAbsolute, resolve, dirname, basename } from 'path';
18
18
  import { createHash, randomBytes } from 'crypto';
19
19
 
20
20
  createRequire(import.meta.url);
@@ -219,10 +219,96 @@ function ownSkillsDirFor(cwd, home, shared, stderr) {
219
219
  return void 0;
220
220
  }
221
221
  }
222
+ var SESSION_ID_VARIABLE = "OUTERLAYER_SESSION_ID";
223
+ var RESUME_SESSION_VARIABLE = "OUTERLAYER_RESUME_SESSION";
224
+ var OWN_SESSION_FLAGS = /* @__PURE__ */ new Set(["--resume", "-r", "--continue", "-c", "--session-id", "--fork-session"]);
225
+ function sessionArgs(env, callerArgs = []) {
226
+ const { [SESSION_ID_VARIABLE]: sessionId, [RESUME_SESSION_VARIABLE]: resume, ...rest } = env;
227
+ const named = sessionId !== void 0 && sessionId !== "";
228
+ const resumes = resume !== void 0 && resume !== "";
229
+ if (callerArgs.some((arg) => OWN_SESSION_FLAGS.has(arg)) || !named && !resumes) return { args: [], env: rest };
230
+ return { args: [...resumes ? ["--resume", resume, "--fork-session"] : [], ...named ? ["--session-id", sessionId] : []], env: rest };
231
+ }
232
+ var SIGNAL_EXIT = 128;
233
+ async function runWithResumeFallback(input) {
234
+ const code = await input.run(input.resumeArgs);
235
+ if (!input.resumeArgs.includes("--resume") || code === 0 || code >= SIGNAL_EXIT || input.hasReply()) return code;
236
+ input.removeTranscript();
237
+ input.writeMarker();
238
+ return input.run(input.freshArgs);
239
+ }
240
+ function findTranscript(configDir, id) {
241
+ const root = join(configDir, "projects");
242
+ let projects;
243
+ try {
244
+ projects = readdirSync(root);
245
+ } catch {
246
+ return void 0;
247
+ }
248
+ for (const project of projects) {
249
+ const candidate = join(root, project, `${id}.jsonl`);
250
+ if (existsSync(candidate)) return candidate;
251
+ }
252
+ return void 0;
253
+ }
254
+ function hasReplySince(path, sinceMs) {
255
+ if (path === void 0) return false;
256
+ try {
257
+ for (const line of readFileSync(path, "utf8").split("\n")) {
258
+ if (!line.includes('"assistant"')) continue;
259
+ const entry = JSON.parse(line);
260
+ if (entry.type === "assistant" && typeof entry.timestamp === "string" && Date.parse(entry.timestamp) >= sinceMs) return true;
261
+ }
262
+ } catch {
263
+ }
264
+ return false;
265
+ }
266
+ async function launch(runProgram, claude, front, args, env, cwd, stderr) {
267
+ const session = sessionArgs(env, args);
268
+ const idAt = session.args.indexOf("--session-id");
269
+ const sessionId = idAt === -1 ? void 0 : session.args[idAt + 1];
270
+ const configDir = session.env.CLAUDE_CONFIG_DIR ?? join(homeFromEnv(session.env), ".claude");
271
+ if (sessionId !== void 0 && findTranscript(configDir, sessionId) !== void 0) return runProgram(claude, [...front, ...args], session.env, cwd, stderr);
272
+ const resumeAt = session.args.indexOf("--resume");
273
+ if (resumeAt === -1) return runProgram(claude, [...front, ...session.args, ...args], session.env, cwd, stderr);
274
+ const resumePath = session.args[resumeAt + 1];
275
+ const resumeDir = dirname(resumePath);
276
+ const launchedAt = Date.now();
277
+ try {
278
+ writeFileSync(join(resumeDir, "launch.json"), JSON.stringify({ sessionId, resumedFrom: basename(resumePath, ".jsonl"), launchedAt: new Date(launchedAt).toISOString() }));
279
+ } catch (err) {
280
+ stderr(`outerlayer claude: could not record the resume: ${err instanceof Error ? err.message : String(err)}
281
+ `);
282
+ }
283
+ const transcript = () => sessionId === void 0 ? void 0 : findTranscript(configDir, sessionId);
284
+ return runWithResumeFallback({
285
+ run: (flags) => runProgram(claude, [...front, ...flags, ...args], session.env, cwd, stderr),
286
+ resumeArgs: session.args,
287
+ freshArgs: sessionId === void 0 ? [] : ["--session-id", sessionId],
288
+ hasReply: () => hasReplySince(transcript(), launchedAt),
289
+ removeTranscript: () => {
290
+ const path = transcript();
291
+ if (path !== void 0) rmSync(path, { force: true });
292
+ },
293
+ writeMarker: () => {
294
+ stderr("outerlayer claude: the resume failed, so this run starts a fresh session\n");
295
+ try {
296
+ writeFileSync(join(resumeDir, "failed"), "");
297
+ } catch (err) {
298
+ stderr(`outerlayer claude: could not record the fresh start: ${err instanceof Error ? err.message : String(err)}
299
+ `);
300
+ }
301
+ }
302
+ });
303
+ }
304
+ function claudeVersion(claude, env) {
305
+ return spawnSync(claude, ["--version"], { env, encoding: "utf8", timeout: 15e3, stdio: ["ignore", "pipe", "ignore"] }).stdout ?? "";
306
+ }
222
307
  async function runClaudeLauncher(args, deps = {}) {
223
308
  const cwd = deps.cwd ?? process.cwd();
224
309
  const env = deps.env ?? process.env;
225
310
  const stderr = deps.stderr ?? ((text) => void process.stderr.write(text));
311
+ const runProgram = deps.runProgram ?? run;
226
312
  const home = homeFromEnv(env);
227
313
  const installed = setupMachineSkills(home);
228
314
  for (const failure of installed.failures) stderr(`outerlayer claude: could not write a maintained skill: ${failure}
@@ -252,11 +338,11 @@ async function runClaudeLauncher(args, deps = {}) {
252
338
  return 1;
253
339
  }
254
340
  } else {
255
- const { resolveLaunchPlane } = await import('./control-plane-launch-X2QXGPFW.js');
341
+ const { resolveLaunchPlane } = await import('./control-plane-launch-PCGH76P5.js');
256
342
  const plane = env[GOVERNANCE_VARIABLE] === "self" ? { kind: "none" } : await resolveLaunchPlane({ cwd, env, home, fetchImpl: deps.fetchImpl, stderr });
257
343
  if (plane.kind === "none") {
258
344
  const own2 = ownSkillsDirFor(cwd, home, [], stderr);
259
- return run(claude, own2 === void 0 ? args : ["--add-dir", own2, ...args], env, cwd, stderr);
345
+ return launch(runProgram, claude, own2 === void 0 ? [] : ["--add-dir", own2], args, env, cwd, stderr);
260
346
  }
261
347
  if (plane.kind === "refused") {
262
348
  stderr(plane.message);
@@ -264,20 +350,22 @@ async function runClaudeLauncher(args, deps = {}) {
264
350
  }
265
351
  dir = plane.dir;
266
352
  }
267
- const reported = spawnSync(claude, ["--version"], { env, encoding: "utf8", timeout: 15e3, stdio: ["ignore", "pipe", "ignore"] }).stdout ?? "";
353
+ const reported = (deps.claudeVersion ?? claudeVersion)(claude, env);
268
354
  if (/\d+\.\d+\.\d+/.test(reported) && !versionAtLeast(reported)) {
269
355
  stderr(`outerlayer claude: Claude Code ${reported.trim().split(/\s+/)[0]} is older than ${MINIMUM_CLAUDE_VERSION}, the oldest version known to load a control plane's instructions for subagents; the minimum version is ${MINIMUM_CLAUDE_VERSION}
270
356
  `);
271
357
  return 1;
272
358
  }
273
359
  const own = ownSkillsDirFor(cwd, home, sharedSkillNames(dir), stderr);
274
- return run(
360
+ return launch(
361
+ runProgram,
275
362
  claude,
276
- ["--add-dir", dir, ...own === void 0 ? [] : ["--add-dir", own], "--settings", join(dir, "settings.json"), ...args],
363
+ ["--add-dir", dir, ...own === void 0 ? [] : ["--add-dir", own], "--settings", join(dir, "settings.json")],
364
+ args,
277
365
  { ...env, CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD: "1", [CONTROL_PLANE_DIR_VARIABLE]: dir },
278
366
  cwd,
279
367
  stderr
280
368
  );
281
369
  }
282
370
 
283
- export { runClaudeLauncher };
371
+ export { findTranscript, hasReplySince, runClaudeLauncher, runWithResumeFallback, sessionArgs };