@outerlayer/cli 0.35.0-next.20261030155846 → 0.36.0-next.20261030181337

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 (120) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +10 -1
  3. package/dist/{agent-setup-346QMQY6.js → agent-setup-RZE6O737.js} +10 -10
  4. package/dist/{artifact-link-cmd-H3KVDGP3.js → artifact-link-cmd-DLKYKNWF.js} +2 -2
  5. package/dist/{build-HHBTSTE4.js → build-GVNOXEDV.js} +4 -4
  6. package/dist/{build-disk-R6OH6JL5.js → build-disk-H5VDB4G2.js} +4 -4
  7. package/dist/build-info.json +1 -1
  8. package/dist/{builder-DL6NSVAU.js → builder-QW6N3XBA.js} +3 -3
  9. package/dist/{caller-Q44OIVRR.js → caller-TUO3VAKG.js} +6 -6
  10. package/dist/{check-W4LSRCMV.js → check-BG6MXUPH.js} +36 -36
  11. package/dist/{chunk-RS2RFWIK.js → chunk-3LCXSD26.js} +1 -1
  12. package/dist/{chunk-FW3ZQKPY.js → chunk-3XIAGOPV.js} +4 -4
  13. package/dist/{chunk-VQCUADLI.js → chunk-4A7GNO4U.js} +1 -1
  14. package/dist/{chunk-YC5KTX7D.js → chunk-5TJQBHKO.js} +4 -4
  15. package/dist/{chunk-GGI3J7WS.js → chunk-5YH25STT.js} +17 -17
  16. package/dist/{chunk-WYJUQGCB.js → chunk-6KLNELLP.js} +3 -3
  17. package/dist/{chunk-K3Z4Y6VU.js → chunk-7ABJKQAQ.js} +2 -2
  18. package/dist/{chunk-MGF4254K.js → chunk-7GX4X25F.js} +1 -1
  19. package/dist/{chunk-DH6BDQM4.js → chunk-7K7TGHDF.js} +1 -1
  20. package/dist/{chunk-USR45QSV.js → chunk-A2QQGMQ7.js} +6 -6
  21. package/dist/{chunk-2PMJ7TQR.js → chunk-AILO7SNG.js} +1 -1
  22. package/dist/{chunk-SUVWQPOG.js → chunk-BBUIVGIR.js} +3 -3
  23. package/dist/{chunk-SUVS7A7X.js → chunk-BIAXDR3K.js} +4 -4
  24. package/dist/{chunk-ODX2XCL3.js → chunk-BR2WJ6BX.js} +2 -2
  25. package/dist/{chunk-AWNONB6E.js → chunk-D3H37WUD.js} +2 -2
  26. package/dist/{chunk-6YK3SXCW.js → chunk-D4BIUQPA.js} +1 -1
  27. package/dist/{chunk-AZJCSBRV.js → chunk-DQSCVQIO.js} +121 -18
  28. package/dist/{chunk-BNFFQC3M.js → chunk-DU6UKYXJ.js} +4 -4
  29. package/dist/{chunk-AW4MYEIW.js → chunk-EA57H6AT.js} +1 -1
  30. package/dist/{chunk-HTQBIXE7.js → chunk-FCJWPFDS.js} +4 -4
  31. package/dist/{chunk-WYGAQVBU.js → chunk-GGNG6CVE.js} +3 -3
  32. package/dist/{chunk-RKDOKIIK.js → chunk-HSSECQOA.js} +7 -2
  33. package/dist/{chunk-LXAYOMSX.js → chunk-HXOMZZC3.js} +8 -8
  34. package/dist/{chunk-7KAWBQ7V.js → chunk-IZVBCDSH.js} +16 -4
  35. package/dist/{chunk-P4PVRDVY.js → chunk-JII4O3EZ.js} +3 -3
  36. package/dist/{chunk-OS73XDJ7.js → chunk-KSMN2FUF.js} +2 -2
  37. package/dist/{chunk-SEY2HTZO.js → chunk-LOI3ESFV.js} +6 -6
  38. package/dist/{chunk-MCMDEEXB.js → chunk-MJEUD4PD.js} +4 -4
  39. package/dist/{chunk-3L7OHRDV.js → chunk-O3OREOCP.js} +132 -3
  40. package/dist/{chunk-VRNAM7WM.js → chunk-O6V6T6HD.js} +12 -12
  41. package/dist/{chunk-K5EOLRGJ.js → chunk-OFOEDDN6.js} +2 -2
  42. package/dist/{chunk-GWXHRG2N.js → chunk-OJ2KWQPQ.js} +1 -1
  43. package/dist/{chunk-4PW2DKHE.js → chunk-OSQEG4HG.js} +15 -14
  44. package/dist/{chunk-VQCAJUDV.js → chunk-OUMMLC45.js} +2 -2
  45. package/dist/{chunk-DOYLWBJJ.js → chunk-QH6RZLDV.js} +1 -1
  46. package/dist/{chunk-G2HRULTO.js → chunk-QLWEXEEA.js} +1 -1
  47. package/dist/{chunk-N2XW4NYY.js → chunk-QZSA5R3L.js} +3 -1
  48. package/dist/{chunk-P24VR4H3.js → chunk-RUML4JVG.js} +1 -1
  49. package/dist/{chunk-EK2FNOCD.js → chunk-TGVIFTKI.js} +1 -1
  50. package/dist/{chunk-FKLGX72N.js → chunk-UCRCIRQQ.js} +5 -5
  51. package/dist/{chunk-Q7ZHL6FY.js → chunk-UHD5ZR46.js} +4 -4
  52. package/dist/{chunk-UVQ5C3UP.js → chunk-VOURWC2H.js} +1 -1
  53. package/dist/{chunk-TMFKZBOW.js → chunk-WNM5GXJ3.js} +2 -2
  54. package/dist/{chunk-ABGJ67PH.js → chunk-WXR6AVZ7.js} +5 -5
  55. package/dist/{chunk-CPIYKBQ2.js → chunk-XHDJ75TC.js} +5 -5
  56. package/dist/{chunk-XSX42Q2H.js → chunk-YQDXFFOK.js} +1 -1
  57. package/dist/{chunk-7TTYUY2V.js → chunk-YTNZ237E.js} +7 -7
  58. package/dist/{chunk-P5CXB7ZT.js → chunk-YZXI37NW.js} +2 -2
  59. package/dist/{chunk-RLFVKOEI.js → chunk-Z25Y26JP.js} +2 -2
  60. package/dist/{claude-launcher-HREPADCN.js → claude-launcher-FK5ZQWXC.js} +5 -5
  61. package/dist/{cli-KQUVZRRG.js → cli-J2G5CEGC.js} +125 -111
  62. package/dist/{command-OHJUJ2WX.js → command-AYXNOGIU.js} +22 -22
  63. package/dist/{config-EYFLM4WT.js → config-NVGVPL3L.js} +5 -5
  64. package/dist/{connect-cmd-REJ5FEC6.js → connect-cmd-KO2TIY6J.js} +8 -8
  65. package/dist/{container-start-KG3ZLJWU.js → container-start-S6XLY7QF.js} +32 -32
  66. package/dist/{context-cleanup-KIWINRKM.js → context-cleanup-2MTGLUYS.js} +3 -3
  67. package/dist/{context-show-cmd-XT3QP5OR.js → context-show-cmd-XLER7QAI.js} +9 -9
  68. package/dist/{control-plane-launch-PCGH76P5.js → control-plane-launch-RUJOCYEI.js} +6 -6
  69. package/dist/{demo-voice-cmd-2QE7SQRC.js → demo-voice-cmd-GLN5QZJP.js} +14 -14
  70. package/dist/{dist-BARPQSHD.js → dist-4Q4Y6YJL.js} +2 -2
  71. package/dist/{docker-3UKTW4GR.js → docker-3AZ3ZFLA.js} +3 -3
  72. package/dist/{doctor-5HY3JA5Y.js → doctor-TLIRZM2C.js} +23 -23
  73. package/dist/{emit-artifact-cmd-26PJDTFU.js → emit-artifact-cmd-CNC5CPKI.js} +13 -13
  74. package/dist/{emit-cmd-ZHYBT2F6.js → emit-cmd-6NZOT5DS.js} +6 -6
  75. package/dist/{emit-criteria-cmd-6YTFXO3L.js → emit-criteria-cmd-BNXWF46E.js} +10 -10
  76. package/dist/{emit-demo-cmd-OQ7UDDRG.js → emit-demo-cmd-UXTH6XBO.js} +14 -14
  77. package/dist/{emit-finding-cmd-NO3FSRHT.js → emit-finding-cmd-5HZE7W6C.js} +10 -10
  78. package/dist/{emit-result-cmd-7MSUTXG6.js → emit-result-cmd-KAEWXQIH.js} +12 -12
  79. package/dist/{emit-step-cmd-7PFO7XVA.js → emit-step-cmd-HSKB3SNR.js} +10 -10
  80. package/dist/{find-unit-3MED6CPQ.js → find-unit-CNYGB5AN.js} +7 -7
  81. package/dist/{findings-cmd-SWAPQUFT.js → findings-cmd-2OQMIVHA.js} +10 -10
  82. package/dist/{fleet-readiness-5RMWZH4V.js → fleet-readiness-PCQSCHQ5.js} +8 -8
  83. package/dist/{governing-source-INXQEK24.js → governing-source-7XCL3AYM.js} +13 -13
  84. package/dist/{hook-fast-2KVZZRJN.js → hook-fast-EMZVAUJ5.js} +1 -1
  85. package/dist/{host-checks-RCWXCCW2.js → host-checks-GYAJF5C5.js} +30 -30
  86. package/dist/index.js +4 -4
  87. package/dist/{init-52F2M54W.js → init-HEZDVJPU.js} +21 -21
  88. package/dist/{init-U5XUDKE7.js → init-OOYCYL2C.js} +21 -21
  89. package/dist/{init-cmd-WYLANAD5.js → init-cmd-4PVOILZD.js} +18 -18
  90. package/dist/{init-update-Z2T5J3Z2.js → init-update-QMSQEZQU.js} +17 -17
  91. package/dist/{layout-2YSKJHPC.js → layout-YJ2RD5H2.js} +4 -4
  92. package/dist/{login-browser-S6PLZCKK.js → login-browser-TWUHD2DS.js} +2 -2
  93. package/dist/{loop-WJBFH6XU.js → loop-4LW6GUXH.js} +35 -35
  94. package/dist/{machine-KUUTBDAT.js → machine-23Y2EHH7.js} +21 -21
  95. package/dist/{machine-skills-YXN3TMJ5.js → machine-skills-FWIZV5HO.js} +4 -4
  96. package/dist/{runner-env-2NVOHTRC.js → runner-env-IDGTVTYW.js} +7 -7
  97. package/dist/{runner-identity-T6YPTHOH.js → runner-identity-RJYVFQ5K.js} +3 -3
  98. package/dist/{runner-key-WPQGF2L7.js → runner-key-BKMFJ7RA.js} +21 -21
  99. package/dist/{session-sender-ADHV7WZ6.js → session-sender-QDZWNAY7.js} +13 -13
  100. package/dist/{spec-cmd-OUEKA6X3.js → spec-cmd-OYQEUAMI.js} +11 -11
  101. package/dist/{starter-pack-3ERHTBBJ.js → starter-pack-6FOYP6DY.js} +5 -5
  102. package/dist/{status-2JRATV66.js → status-WSQEUBOE.js} +30 -30
  103. package/dist/{sync-cmd-IEPWMYWY.js → sync-cmd-MNXFOIHW.js} +12 -12
  104. package/dist/{update-steps-3SRL32IV.js → update-steps-RHCWDCGL.js} +31 -31
  105. package/dist/{watch-3K3IB443.js → watch-E7RGSZF6.js} +12 -12
  106. package/dist/{work-claim-cmd-5ACB2ZWP.js → work-claim-cmd-HX7DGFY3.js} +16 -16
  107. package/dist/{work-cmd-B6HZW26B.js → work-cmd-IEC6XKC6.js} +10 -10
  108. package/dist/work-comment-cmd-X65LS27O.js +36 -0
  109. package/dist/{work-demo-cmd-RLOS55MP.js → work-demo-cmd-D7WGXJOC.js} +10 -10
  110. package/dist/{work-logs-cmd-VUICWCEO.js → work-logs-cmd-FQH2UVMI.js} +10 -10
  111. package/dist/{work-open-pr-cmd-CYXICEJE.js → work-open-pr-cmd-EFAFERSF.js} +11 -11
  112. package/dist/{work-pr-cmd-3HSFJO65.js → work-pr-cmd-E55GPZKO.js} +10 -10
  113. package/dist/{work-proofs-cmd-NJ4YYQ2V.js → work-proofs-cmd-RKUGC2ML.js} +12 -12
  114. package/dist/{work-proofs-record-NN7XB2QC.js → work-proofs-record-VGCV4TWY.js} +18 -18
  115. package/dist/{work-stop-cmd-QXZSZLEY.js → work-stop-cmd-ANPTSTYS.js} +10 -10
  116. package/package.json +1 -1
  117. package/skill-pack/maintained/outerlayer-amend/SKILL.md +5 -4
  118. package/skill-pack/maintained/outerlayer-amend/references/threads.md +14 -1
  119. package/skill-pack/maintained/outerlayer-build/SKILL.md +4 -0
  120. package/dist/work-comment-cmd-MBGBBR7V.js +0 -32
@@ -3,28 +3,28 @@ import { createRequire } from 'node:module';
3
3
  import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-7Y5VW4JG.js';
4
4
  import { decideInstalledSwitch } from './chunk-3JVYMD4G.js';
5
5
  import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
6
- import { reportFailedStart, fitImageBuildMemory } from './chunk-BNFFQC3M.js';
7
- import { renderUpdateSteps } from './chunk-RLFVKOEI.js';
8
- import { releaseLease, isUnfinished, restoreSessionIntoMicroVm, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, readProvisionOut, workdirProblem, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, startSender, 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-GGI3J7WS.js';
9
- import { RUNNER_PROTOCOL } from './chunk-RS2RFWIK.js';
6
+ import { reportFailedStart, fitImageBuildMemory } from './chunk-DU6UKYXJ.js';
7
+ import { renderUpdateSteps } from './chunk-Z25Y26JP.js';
8
+ import { releaseLease, isUnfinished, restoreSessionIntoMicroVm, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, readProvisionOut, workdirProblem, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, startSender, 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-5YH25STT.js';
9
+ import { RUNNER_PROTOCOL } from './chunk-3LCXSD26.js';
10
10
  import { writeFleetState } from './chunk-LGV5N5DG.js';
11
11
  import { writePendingUpdate } from './chunk-EZRAR5YG.js';
12
12
  import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57WI6.js';
13
- import { fleetConfigProblem, realBlockedProbes, sliceMemoryOf, checkBlockedWithSlots, largeBuildMemoryBytes, LARGE_BUILD_DISK_BYTES, checkManagedRoom, createHousekeepingDocker, housekeepingDockerIfReachable, KIND_LABEL, RECIPE_KEY_LABEL, askFleetMachine } from './chunk-SEY2HTZO.js';
13
+ import { fleetConfigProblem, realBlockedProbes, sliceMemoryOf, checkBlockedWithSlots, largeBuildMemoryBytes, LARGE_BUILD_DISK_BYTES, checkManagedRoom, createHousekeepingDocker, housekeepingDockerIfReachable, KIND_LABEL, RECIPE_KEY_LABEL, askFleetMachine } from './chunk-LOI3ESFV.js';
14
14
  import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-AF6DQJ5W.js';
15
15
  import { RepoFilter } from './chunk-TBT347UY.js';
16
- import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, itemTag, prepareResume, restoreSessionIntoContainer, itemScope, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, needsBuildSkill, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, provisionEnvironment, resolveHostBuild, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, currentSkillCommand, formerSkillProblem, containerCommandExec, execCommandLine, startHostServices, HELPER_ENV, setUpRunnerCgroup, sweepImageBuilders, usableCpus, stoppedHelperReason, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, savedStatesDir, readRecords, removeOldestUntil, ensureNetworkReady, managedBuildSettingsFor, ADOPTED_FETCH_RETRY_WINDOW_MS, gitRemoteFor, startServicesFor, createLeaseChannel, selectStaleIncomplete, selectExpired, selectToFit, removeSavedState } from './chunk-4PW2DKHE.js';
17
- import { RUNNER_RESERVE_BYTES } from './chunk-ODX2XCL3.js';
16
+ import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, itemTag, prepareResume, restoreSessionIntoContainer, itemScope, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, needsBuildSkill, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, provisionEnvironment, resolveHostBuild, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, currentSkillCommand, formerSkillProblem, containerCommandExec, execCommandLine, startHostServices, HELPER_ENV, setUpRunnerCgroup, sweepImageBuilders, usableCpus, stoppedHelperReason, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, savedStatesDir, readRecords, removeOldestUntil, ensureNetworkReady, managedBuildSettingsFor, ADOPTED_FETCH_RETRY_WINDOW_MS, gitRemoteFor, startServicesFor, createLeaseChannel, selectStaleIncomplete, selectExpired, selectToFit, removeSavedState, shellQuote, deliverJobFiles } from './chunk-OSQEG4HG.js';
17
+ import { RUNNER_RESERVE_BYTES } from './chunk-BR2WJ6BX.js';
18
18
  import { claimPidFile, releasePidFile, writePidFile, readPidFile } from './chunk-WAZJPDR2.js';
19
19
  import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
20
- import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, resolveGoverningSource, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-OS73XDJ7.js';
20
+ import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, resolveGoverningSource, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-KSMN2FUF.js';
21
21
  import { imageTag, writeUpdateStatus, pullInstruction, tagToPull } from './chunk-ALEUIS35.js';
22
22
  import { isVersion, compareVersions, satisfiesRange } from './chunk-TQMI335S.js';
23
- import { claimCalls, claimItem, spoolHomeFor, leftByRunnerKey, runnerCalls } from './chunk-P24VR4H3.js';
24
- import { keyRunnerFactory, isBuiltinContainer, isBuiltinVm, isBuiltinProcess, loadRunnerConfig, checkHooks, builtinKind, keepsHostBuilder, DEFAULT_SAVED_STATE_MAX_BYTES, DEFAULT_UPDATE_MAX_WAIT_HOURS } from './chunk-RKDOKIIK.js';
25
- import { allocatedBytes, freeBytes, formatBytes } from './chunk-EK2FNOCD.js';
26
- import { writeJobFile, ensureRunnerIdentity, identityDockerFor, readJobFile, exceedsDisk, builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, readJobFileChecked } from './chunk-DOYLWBJJ.js';
27
- import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-FKLGX72N.js';
23
+ import { claimCalls, claimItem, spoolHomeFor, leftByRunnerKey, runnerCalls } from './chunk-RUML4JVG.js';
24
+ import { keyRunnerFactory, isBuiltinContainer, isBuiltinVm, isBuiltinProcess, loadRunnerConfig, checkHooks, builtinKind, keepsHostBuilder, DEFAULT_SAVED_STATE_MAX_BYTES, DEFAULT_UPDATE_MAX_WAIT_HOURS } from './chunk-HSSECQOA.js';
25
+ import { allocatedBytes, freeBytes, formatBytes } from './chunk-TGVIFTKI.js';
26
+ import { writeJobFile, ensureRunnerIdentity, identityDockerFor, readJobFile, exceedsDisk, builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, readJobFileChecked } from './chunk-QH6RZLDV.js';
27
+ import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-UCRCIRQQ.js';
28
28
  import { loadHostKey, ensureHostKey, signerFor } from './chunk-4DJZSNVT.js';
29
29
  import { resolveVersion } from './chunk-RA3O54FC.js';
30
30
  import { RUNNER_DIR_MODE, runnerDir, buildDir, attemptStamp, jobDir, RUNNER_FILE_MODE, jobsDir, pidFilePath, storeScopes, imagesDir, spoolDir, orgStoreIn, builderCacheDiskPath, sessionsDir, rootfsDir } from './chunk-WT7J2627.js';
@@ -380,6 +380,20 @@ function stopsOf(data) {
380
380
  }
381
381
  return stops;
382
382
  }
383
+ function commentsOf(data) {
384
+ const raw = data?.comments;
385
+ if (!Array.isArray(raw)) return [];
386
+ const comments = [];
387
+ for (const entry of raw) {
388
+ const comment = entry;
389
+ if (comment === null || typeof comment !== "object") continue;
390
+ const { claimId, workItemId, commentId, thread, authorName, text, summary, at } = comment;
391
+ if (typeof claimId !== "string" || typeof workItemId !== "string" || typeof commentId !== "string" || commentId === "") continue;
392
+ if (typeof thread !== "string" || typeof authorName !== "string" || typeof text !== "string" || typeof at !== "string") continue;
393
+ comments.push({ claimId, workItemId, commentId, thread, authorName, text, summary: typeof summary === "string" ? summary : null, at });
394
+ }
395
+ return comments;
396
+ }
383
397
  function takesBody(takes) {
384
398
  let truncated = false;
385
399
  const list = (patterns) => {
@@ -433,11 +447,72 @@ async function sendHeartbeat(args, fetchImpl) {
433
447
  );
434
448
  const runnerVersion = response.data?.runnerVersion;
435
449
  const stops = stopsOf(response.data);
436
- return typeof runnerVersion === "string" ? { ok: true, runnerVersion, stops } : { ok: true, stops };
450
+ const comments = commentsOf(response.data);
451
+ return typeof runnerVersion === "string" ? { ok: true, runnerVersion, stops, comments } : { ok: true, stops, comments };
437
452
  } catch (err) {
438
453
  return { ok: false, reason: describeCallFailure(err) };
439
454
  }
440
455
  }
456
+ async function deliverInboxFile(runtime, state, file, secrets) {
457
+ const folder = join(state.buildDir, INBOX_FOLDER);
458
+ try {
459
+ mkdirSync(folder, { recursive: true, mode: 493 });
460
+ writeFileSync(join(folder, `${file.id}.json`), JSON.stringify(file), { mode: 420 });
461
+ } catch (err) {
462
+ return { ok: false, reason: `the comments for the agent could not be written on the host: ${err instanceof Error ? err.message : String(err)}` };
463
+ }
464
+ return deliverJobFiles(runtime, state, ["inbox"], secrets);
465
+ }
466
+
467
+ // src/runner/microvm/inbox.ts
468
+ var ROOT_PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
469
+ async function writeGuestInboxFile(runtime, state, file) {
470
+ const folder = `${JOB_MOUNT}/${INBOX_FOLDER}`;
471
+ const partial = shellQuote(`${folder}/.${file.id}.partial`);
472
+ const script2 = [
473
+ "set -e",
474
+ "umask 022",
475
+ `mkdir -p ${shellQuote(folder)}`,
476
+ `cat > ${partial}`,
477
+ `chmod 0644 ${partial}`,
478
+ `mv ${partial} ${shellQuote(`${folder}/${file.id}.json`)}`
479
+ ].join("\n");
480
+ const result = await runtime.vm.exec(state.vsockPath, { argv: ["/bin/sh", "-c", script2], user: "root", cwd: "/", env: { PATH: ROOT_PATH } }, { stdin: JSON.stringify(file) });
481
+ if (result.status !== 0) {
482
+ const line = result.stderr.trim().split("\n")[0] ?? "";
483
+ throw new Error(`writing a comment into the guest's inbox failed (exit ${result.status})${line === "" ? "" : `: ${line}`}`);
484
+ }
485
+ }
486
+
487
+ // src/runner/inbox.ts
488
+ var INBOX_FOLDER = "inbox";
489
+ var FILE_ID = /^[A-Za-z0-9_-]{1,100}$/;
490
+ function inboxFileOf(comment, job) {
491
+ if (!FILE_ID.test(comment.commentId)) return void 0;
492
+ return {
493
+ id: comment.commentId,
494
+ item: job.item,
495
+ workItemId: comment.workItemId,
496
+ thread: comment.thread,
497
+ authorName: comment.authorName,
498
+ text: comment.text,
499
+ summary: comment.summary,
500
+ at: comment.at
501
+ };
502
+ }
503
+ async function deliverComment(runtime, job, file, secrets) {
504
+ if (job.microvm !== void 0) {
505
+ if (!vmAlive(runtime, job.microvm)) return { ok: false, reason: "the build's microVM is not running" };
506
+ try {
507
+ await writeGuestInboxFile(runtime, job.microvm, file);
508
+ return { ok: true };
509
+ } catch (err) {
510
+ return { ok: false, reason: err instanceof Error ? err.message : String(err) };
511
+ }
512
+ }
513
+ if (job.container !== void 0 && filesAreCopied(job.container)) return deliverInboxFile(runtime, job.container, file, secrets);
514
+ return { ok: true, skipped: true };
515
+ }
441
516
 
442
517
  // src/runner/host-state.ts
443
518
  function hostState(flags) {
@@ -1595,9 +1670,10 @@ function slotsTotalOf(state) {
1595
1670
  const slots = state.blocked === void 0 ? state.buildSlots ?? state.config.concurrency : state.config.concurrency;
1596
1671
  return Math.max(slots, state.jobs.size, 1);
1597
1672
  }
1598
- async function sendTickHeartbeat(state, workRequest) {
1673
+ async function sendTickHeartbeat(state, workRequest, wake2 = false) {
1599
1674
  if (state.heartbeating) {
1600
1675
  if (workRequest !== void 0) state.queuedWorkRequest = workRequest;
1676
+ if (wake2) state.heartbeatAgain = true;
1601
1677
  reportRepeating(state, "the heartbeat's previous call", "heartbeat held: the previous heartbeat is still in flight", "line");
1602
1678
  return;
1603
1679
  }
@@ -1641,10 +1717,13 @@ async function sendTickHeartbeat(state, workRequest) {
1641
1717
  if (result.ok) {
1642
1718
  considerNamedVersion(state, result.runnerVersion);
1643
1719
  applyStops(state, result.stops);
1720
+ applyComments(state, result.comments);
1644
1721
  }
1645
1722
  next = state.queuedWorkRequest;
1646
1723
  state.queuedWorkRequest = void 0;
1647
- if (next === void 0) break;
1724
+ const again = state.heartbeatAgain === true;
1725
+ state.heartbeatAgain = false;
1726
+ if (next === void 0 && !again) break;
1648
1727
  }
1649
1728
  } finally {
1650
1729
  state.heartbeating = false;
@@ -1671,6 +1750,29 @@ function applyStops(state, stops) {
1671
1750
  });
1672
1751
  }
1673
1752
  }
1753
+ function applyComments(state, comments) {
1754
+ if (state.config.deliverComments === false) return;
1755
+ for (const comment of comments) {
1756
+ const active = [...state.jobs.values()].find((entry) => entry.job.claimId === comment.claimId);
1757
+ if (active === void 0 || active.ending) continue;
1758
+ if (active.job.microvm === void 0 && active.job.container === void 0) continue;
1759
+ const delivered = active.deliveredComments ??= /* @__PURE__ */ new Set();
1760
+ const delivering = active.deliveringComments ??= /* @__PURE__ */ new Set();
1761
+ if (delivered.has(comment.commentId) || delivering.has(comment.commentId)) continue;
1762
+ const file = inboxFileOf(comment, active.job);
1763
+ if (file === void 0) {
1764
+ reportRepeating(state, `comment ${comment.commentId}`, `${itemTag(active.job)} ignoring a comment with an id the inbox cannot hold`, "line");
1765
+ continue;
1766
+ }
1767
+ delivering.add(comment.commentId);
1768
+ const key = `comment ${comment.commentId} for the agent`;
1769
+ const runtime = runtimeOf(state);
1770
+ void deliverComment(runtime, active.job, file, () => runtime.credentials.get(active.dirPath)?.issuedTokens() ?? []).then((result) => {
1771
+ if (result.ok) delivered.add(comment.commentId);
1772
+ reportRepeating(state, key, result.ok ? void 0 : `${itemTag(active.job)} the ${key} could not be written into the build: ${result.reason}`);
1773
+ }).catch((err) => reportRepeating(state, key, `${itemTag(active.job)} the ${key} could not be written into the build: ${describeCallFailure(err)}`)).finally(() => delivering.delete(comment.commentId));
1774
+ }
1775
+ }
1674
1776
  function ownVersionOf(deps) {
1675
1777
  return (deps.cliVersion ?? resolveVersion()).split(" ")[0] ?? "";
1676
1778
  }
@@ -2140,6 +2242,7 @@ async function tick(state) {
2140
2242
  }
2141
2243
  function wake(state) {
2142
2244
  if (state.intakeClosed === true) return;
2245
+ void sendTickHeartbeat(state, void 0, true);
2143
2246
  if (state.ticking === true) {
2144
2247
  state.wakeAgain = true;
2145
2248
  return;
@@ -2442,7 +2545,7 @@ var CLAIM_REFUSAL_CODES = new Set(
2442
2545
  "pull_request_from_fork pull_request_on_default_branch pull_request_ambiguous pull_request_repository_not_connected repository_not_reachable branch_claimed_elsewhere".split(" ")
2443
2546
  );
2444
2547
  async function tryClaimAndStart(state, item, queue) {
2445
- const { postJson: postJson2 } = await import('./work-cmd-B6HZW26B.js');
2548
+ const { postJson: postJson2 } = await import('./work-cmd-IEC6XKC6.js');
2446
2549
  const log = logOf(state);
2447
2550
  const hostKey = await loadHostKey(state.config.configPath);
2448
2551
  const claim = await retrySend(
@@ -3813,7 +3916,7 @@ async function startRunner(configPath, deps, startup) {
3813
3916
  check: update.check ? () => update.check(configPath) : async () => {
3814
3917
  const held = heldClaudeCredential();
3815
3918
  const env = held === void 0 ? process.env : { ...process.env, [held.variable]: held.value };
3816
- return (await import('./check-W4LSRCMV.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3919
+ return (await import('./check-BG6MXUPH.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3817
3920
  },
3818
3921
  now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
3819
3922
  log
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { scrubReason, stripTerminalControls } from './chunk-GGI3J7WS.js';
4
- import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-ODX2XCL3.js';
3
+ import { scrubReason, stripTerminalControls } from './chunk-5YH25STT.js';
4
+ import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-BR2WJ6BX.js';
5
5
  import { RunnerAlreadyRunningError, readPidFile } from './chunk-WAZJPDR2.js';
6
6
  import { isSameProcess } from './chunk-JBJTC3UU.js';
7
- import { keyRunnerFactory } from './chunk-RKDOKIIK.js';
8
- import { isSignatureRefusal, postJson } from './chunk-FKLGX72N.js';
7
+ import { keyRunnerFactory } from './chunk-HSSECQOA.js';
8
+ import { isSignatureRefusal, postJson } from './chunk-UCRCIRQQ.js';
9
9
  import { signerFor } from './chunk-4DJZSNVT.js';
10
10
  import { pidFilePath } from './chunk-WT7J2627.js';
11
11
  import { readFileSync } from 'fs';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { loadMachineSkillFiles, resolvePackRoot } from './chunk-MGF4254K.js';
3
+ import { loadMachineSkillFiles, resolvePackRoot } from './chunk-7GX4X25F.js';
4
4
  import { MAINTAINED_SKILLS, maintainedLineVersion } from './chunk-CDDED64E.js';
5
5
  import { resolvePackageVersion } from './chunk-RA3O54FC.js';
6
6
  import { homeFromEnv } from './chunk-352DHUTP.js';
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { DEFAULT_DASHBOARD } from './chunk-6YK3SXCW.js';
4
- import { sanitizeTerminal } from './chunk-XSX42Q2H.js';
5
- import { isAgentsMdLayout } from './chunk-TMFKZBOW.js';
3
+ import { DEFAULT_DASHBOARD } from './chunk-D4BIUQPA.js';
4
+ import { sanitizeTerminal } from './chunk-YQDXFFOK.js';
5
+ import { isAgentsMdLayout } from './chunk-WNM5GXJ3.js';
6
6
  import { cliFetch, resolveGatewayCredentials } from './chunk-YQHEJ5SV.js';
7
7
  import { readCloudConfig } from './chunk-HWVMRETT.js';
8
8
  import { findGitDirs, writeRepoConnection, readRepoConnection } from './chunk-BJ3KTMDH.js';
9
- import { remoteLookupFailed } from './chunk-DH6BDQM4.js';
9
+ import { remoteLookupFailed } from './chunk-7K7TGHDF.js';
10
10
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
11
11
  import { execFileSync } from 'child_process';
12
12
  import { lstatSync } from 'fs';
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { removeRetiredSkills } from './chunk-AWNONB6E.js';
3
+ import { removeRetiredSkills } from './chunk-D3H37WUD.js';
4
4
  import { defaultFetch, resolveGatewayCredentials } from './chunk-YQHEJ5SV.js';
5
5
  import { appendContextProvenance } from './chunk-545P7JY7.js';
6
- import { loadMaintainedFiles, writeMaintainedFiles } from './chunk-MGF4254K.js';
6
+ import { loadMaintainedFiles, writeMaintainedFiles } from './chunk-7GX4X25F.js';
7
7
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
8
8
  import { writeDegraded, writeSourceCache, SOURCE_CACHE_TTL_RETRY_MS, writeContextManifest, SOURCE_CACHE_TTL_SUCCESS_MS, readSourceCache, isSourceCacheFresh, clearDegraded } from './chunk-YQR6E6OV.js';
9
- import { normalizeRepoName, parseOuterlayerConfig, classifyTree, emitTree } from './chunk-2PMJ7TQR.js';
9
+ import { normalizeRepoName, parseOuterlayerConfig, classifyTree, emitTree } from './chunk-AILO7SNG.js';
10
10
  import { homeFromEnv } from './chunk-352DHUTP.js';
11
11
  import { withTokenHeader } from './chunk-GANAOCHR.js';
12
12
  import { execFileSync } from 'child_process';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-EK2FNOCD.js';
4
- import { parseSize } from './chunk-DOYLWBJJ.js';
3
+ import { DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-TGVIFTKI.js';
4
+ import { parseSize } from './chunk-QH6RZLDV.js';
5
5
  import { builderDiskPinned } from './chunk-7SO2VHTQ.js';
6
6
  import { homeFromEnv } from './chunk-352DHUTP.js';
7
7
  import { isRefusedInConfig, resolveDestinations, isReservedVariable } from './chunk-GANAOCHR.js';
@@ -211,6 +211,7 @@ var RUNNER_KEYS = [
211
211
  "checks",
212
212
  "autoUpdate",
213
213
  "wait",
214
+ "deliverComments",
214
215
  "managed",
215
216
  "fleet",
216
217
  "update"
@@ -331,6 +332,9 @@ function loadRunnerConfig(configPath) {
331
332
  if (runner.wait !== void 0 && typeof runner.wait !== "boolean") {
332
333
  fail(configPath, "runner.wait", "must be true or false");
333
334
  }
335
+ if (runner.deliverComments !== void 0 && typeof runner.deliverComments !== "boolean") {
336
+ fail(configPath, "runner.deliverComments", "must be true or false");
337
+ }
334
338
  if (runner.managed !== void 0 && typeof runner.managed !== "boolean") {
335
339
  fail(configPath, "runner.managed", "must be true or false");
336
340
  }
@@ -401,6 +405,7 @@ function loadRunnerConfig(configPath) {
401
405
  // provision alone tells which.
402
406
  autoUpdate: runner.autoUpdate ?? builtinKind(runner.hooks.provision) !== "own",
403
407
  wait: runner.wait ?? true,
408
+ deliverComments: runner.deliverComments ?? true,
404
409
  // A fleet runner is a managed runner: its builds run under the jailer with the managed checks.
405
410
  ...fleet ? { managed: true } : runner.managed === void 0 ? {} : { managed: runner.managed }
406
411
  };
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { criteriaOf, loadCitationFinder, hostItemsOf, criterionInputs, NO_CITING_TEST_REASON, NO_TEST_FILES_REASON, NO_VERDICT_REASON, isFoundInReason, uncitedIds, planCriteria, pickSearchable, IdScan, testFileMatcher, foundInReason, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, groupBySize } from './chunk-YC5KTX7D.js';
4
- import { WorkCommandError, resolveCredentials, getJson } from './chunk-FKLGX72N.js';
3
+ import { criteriaOf, loadCitationFinder, hostItemsOf, criterionInputs, NO_CITING_TEST_REASON, NO_TEST_FILES_REASON, NO_VERDICT_REASON, isFoundInReason, uncitedIds, planCriteria, pickSearchable, IdScan, testFileMatcher, foundInReason, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, groupBySize } from './chunk-5TJQBHKO.js';
4
+ import { WorkCommandError, resolveCredentials, getJson } from './chunk-UCRCIRQQ.js';
5
5
  import { C } from './chunk-2AM6Z5BP.js';
6
- import { sanitizeTerminal } from './chunk-XSX42Q2H.js';
6
+ import { sanitizeTerminal } from './chunk-YQDXFFOK.js';
7
7
  import { defaultFetch } from './chunk-YQHEJ5SV.js';
8
- import { resolveRepoIdentity } from './chunk-DH6BDQM4.js';
8
+ import { resolveRepoIdentity } from './chunk-7K7TGHDF.js';
9
9
  import { parseWorkItemEnv } from './chunk-5WYT3PPE.js';
10
10
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
11
11
  import { readDeliveryRecord } from './chunk-YQR6E6OV.js';
12
- import { inferArtifactKind, mediaTypeForArtifactPath, WORK_ITEM_COMMENT_MAX_BODY_LENGTH } from './chunk-N2XW4NYY.js';
12
+ import { inferArtifactKind, mediaTypeForArtifactPath, WORK_ITEM_COMMENT_MAX_BODY_LENGTH } from './chunk-QZSA5R3L.js';
13
13
  import { createHash } from 'crypto';
14
14
  import { spawnSync } from 'child_process';
15
15
  import { existsSync, statSync, readFileSync } from 'fs';
@@ -217,14 +217,14 @@ function governingDir(cwd) {
217
217
  async function testProofMode(cwd) {
218
218
  const dir = governingDir(cwd);
219
219
  if (dir === void 0) return "any";
220
- const { testProofIn } = await import('./host-checks-RCWXCCW2.js');
220
+ const { testProofIn } = await import('./host-checks-GYAJF5C5.js');
221
221
  return testProofIn(dir);
222
222
  }
223
223
  async function judgeCheckName(cwd) {
224
224
  const dir = governingDir(cwd);
225
225
  if (dir === void 0) return {};
226
226
  if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
227
- const { checksIn, isJudgeCheck } = await import('./host-checks-RCWXCCW2.js');
227
+ const { checksIn, isJudgeCheck } = await import('./host-checks-GYAJF5C5.js');
228
228
  const quiet = { line: () => void 0, error: () => void 0 };
229
229
  const check = checksIn(dir, quiet, "").checks.find((c) => isJudgeCheck(c) && c.judge.subjects === "criteria");
230
230
  return check === void 0 ? {} : { name: check.name };
@@ -369,7 +369,7 @@ async function runWorkProofs(opts) {
369
369
  async function runWorkProofsCommand(opts) {
370
370
  try {
371
371
  if (opts.record) {
372
- const { runWorkProofsRecord } = await import('./work-proofs-record-NN7XB2QC.js');
372
+ const { runWorkProofsRecord } = await import('./work-proofs-record-VGCV4TWY.js');
373
373
  const result2 = await runWorkProofsRecord(opts);
374
374
  process.exitCode = result2.exitCode;
375
375
  return;
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { resolveCredentials, postJson, getJson } from './chunk-FKLGX72N.js';
3
+ import { resolveCredentials, postJson, getJson } from './chunk-UCRCIRQQ.js';
4
4
  import { detectActiveSession } from './chunk-IP7BIBXJ.js';
5
5
  import { C } from './chunk-2AM6Z5BP.js';
6
- import { sanitizeTerminal } from './chunk-XSX42Q2H.js';
6
+ import { sanitizeTerminal } from './chunk-YQDXFFOK.js';
7
7
  import { defaultFetch } from './chunk-YQHEJ5SV.js';
8
- import { resolveRepoIdentity } from './chunk-DH6BDQM4.js';
8
+ import { logHookError } from './chunk-O3OREOCP.js';
9
+ import { resolveRepoIdentity } from './chunk-7K7TGHDF.js';
9
10
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
10
11
  import { homeFromEnv } from './chunk-352DHUTP.js';
11
12
  import { randomUUID } from 'crypto';
@@ -112,5 +113,16 @@ function renderThread(label, thread) {
112
113
  );
113
114
  return [header, ...checks, ...comments].join("\n");
114
115
  }
116
+ async function runWorkCommentsRead(opts) {
117
+ const home = opts.home ?? homeFromEnv();
118
+ try {
119
+ const itemNumber = parseTrackerNumber(opts.item);
120
+ if (itemNumber === void 0) throw new WorkCommentCommandError(trackerNumberError("--item", opts.item ?? ""));
121
+ const creds = resolveCredentials({ ...opts, cwd: opts.cwd ?? process.cwd(), home, env: opts.env ?? process.env });
122
+ await postJson(creds.url, `/v1/work-items/${itemNumber}/comments/read`, creds.apiKey, creds.appId, { commentIds: opts.commentIds }, opts.fetchImpl ?? defaultFetch);
123
+ } catch (err) {
124
+ logHookError(home, new Error(`work comments-read for item ${opts.item ?? ""} failed: ${err instanceof Error ? err.message : String(err)}`));
125
+ }
126
+ }
115
127
 
116
- export { WorkCommentCommandError, runWorkComment, runWorkThreads };
128
+ export { WorkCommentCommandError, runWorkComment, runWorkCommentsRead, runWorkThreads };
@@ -2,15 +2,15 @@
2
2
  import { createRequire } from 'node:module';
3
3
  import { launchRefusalForSession } from './chunk-AAGU5FJF.js';
4
4
  import { detectActiveSession, transcriptPathForSession } from './chunk-IP7BIBXJ.js';
5
- import { autoConnect } from './chunk-P5CXB7ZT.js';
5
+ import { autoConnect } from './chunk-YZXI37NW.js';
6
6
  import { C } from './chunk-2AM6Z5BP.js';
7
7
  import { resolveGatewayCredentials, defaultFetch, unauthorizedMessage } from './chunk-YQHEJ5SV.js';
8
8
  import { readLatestProvenanceForSession } from './chunk-545P7JY7.js';
9
- import { resolveRepoIdentity, defaultProjectsDir, findTranscripts, sessionIdFromPath, scrubText } from './chunk-DH6BDQM4.js';
9
+ import { resolveRepoIdentity, defaultProjectsDir, findTranscripts, sessionIdFromPath, scrubText } from './chunk-7K7TGHDF.js';
10
10
  import { launchedItemForSession } from './chunk-5WYT3PPE.js';
11
11
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
12
12
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
13
- import { FindingBatchSchema, FindingsResponseSchema, SAME_PROBLEM_RULES } from './chunk-N2XW4NYY.js';
13
+ import { FindingBatchSchema, FindingsResponseSchema, SAME_PROBLEM_RULES } from './chunk-QZSA5R3L.js';
14
14
  import { homeFromEnv } from './chunk-352DHUTP.js';
15
15
  import { readFileSync, existsSync } from 'fs';
16
16
  import { join, dirname, basename } from 'path';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { WorkCommandError, postJson } from './chunk-FKLGX72N.js';
4
- import { defaultGitRunner, materializeContext, fetchControlPlaneCommit, lookupGoverningSource } from './chunk-WYGAQVBU.js';
3
+ import { WorkCommandError, postJson } from './chunk-UCRCIRQQ.js';
4
+ import { defaultGitRunner, materializeContext, fetchControlPlaneCommit, lookupGoverningSource } from './chunk-GGNG6CVE.js';
5
5
  import { signingFetchFor } from './chunk-YQHEJ5SV.js';
6
6
  import { signerFor } from './chunk-4DJZSNVT.js';
7
7
  import { unsupportedLayout, layoutRefusalReason, composeDelivery } from './chunk-FGF52V4V.js';
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { placeholderQueues, placeholderProblem } from './chunk-4PW2DKHE.js';
4
- import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-ODX2XCL3.js';
5
- import { isBuiltinVm, builtinKind, EGRESS_SWITCHABLE_KEYS, imageBuildOf, keepsHostBuilder } from './chunk-RKDOKIIK.js';
6
- import { realBuildDiskProbe, checkDiskFit, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK, volumeBytes } from './chunk-EK2FNOCD.js';
7
- import { spawnRun, RUNNER_LABEL, BUILD_LABEL } from './chunk-DOYLWBJJ.js';
3
+ import { placeholderQueues, placeholderProblem } from './chunk-OSQEG4HG.js';
4
+ import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-BR2WJ6BX.js';
5
+ import { isBuiltinVm, builtinKind, EGRESS_SWITCHABLE_KEYS, imageBuildOf, keepsHostBuilder } from './chunk-HSSECQOA.js';
6
+ import { realBuildDiskProbe, checkDiskFit, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK, volumeBytes } from './chunk-TGVIFTKI.js';
7
+ import { spawnRun, RUNNER_LABEL, BUILD_LABEL } from './chunk-QH6RZLDV.js';
8
8
  import { builderDiskPinned } from './chunk-7SO2VHTQ.js';
9
- import { getJson, WorkCommandError } from './chunk-FKLGX72N.js';
9
+ import { getJson, WorkCommandError } from './chunk-UCRCIRQQ.js';
10
10
  import { ensureHostKey } from './chunk-4DJZSNVT.js';
11
11
  import { BUILD_SLICE_MEMORY_ENV, FORWARDED_CLAUDE_CREDENTIAL_VARIABLES, claudeCredentialVariablesSet, claudeCredential, claudeEnvPath, parseRunnerEnv } from './chunk-GANAOCHR.js';
12
12
  import { closeSync, openSync, constants, readFileSync } from 'fs';
@@ -2,14 +2,14 @@
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-P5CXB7ZT.js';
5
+ import { autoConnect } from './chunk-YZXI37NW.js';
6
6
  import { C } from './chunk-2AM6Z5BP.js';
7
- import { acquireSpoolLockAt } from './chunk-XSX42Q2H.js';
7
+ import { acquireSpoolLockAt } from './chunk-YQDXFFOK.js';
8
8
  import { resolveGatewayCredentials, defaultFetch, unauthorizedMessage } from './chunk-YQHEJ5SV.js';
9
- import { resolveRepoIdentity } from './chunk-DH6BDQM4.js';
9
+ import { resolveRepoIdentity } from './chunk-7K7TGHDF.js';
10
10
  import { launchedItemForSession } from './chunk-5WYT3PPE.js';
11
11
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
12
- import { StepNameSchema, StepBodySchema } from './chunk-N2XW4NYY.js';
12
+ import { StepNameSchema, StepBodySchema } from './chunk-QZSA5R3L.js';
13
13
  import { homeFromEnv } from './chunk-352DHUTP.js';
14
14
  import { randomUUID } from 'crypto';
15
15
  import { readFileSync, existsSync, mkdirSync, writeFileSync, renameSync, appendFileSync } from 'fs';
@@ -14,6 +14,134 @@ import { createHash } from 'crypto';
14
14
  import { join, dirname, resolve } from 'path';
15
15
 
16
16
  createRequire(import.meta.url);
17
+ var DELIVERY_CAP = 8e3;
18
+ var MAX_IDS_PER_CALL = 50;
19
+ var INTRO = "A member handed work to you while you build. Read each comment below. Change the work to meet it in this run, then answer on the comment's thread with the command shown, before you finish.";
20
+ function plain(value, max) {
21
+ return value.replace(/[^\p{L}\p{N} _.@'-]/gu, "").slice(0, max);
22
+ }
23
+ function readComment(path) {
24
+ try {
25
+ const raw = JSON.parse(readFileSync(path, "utf8"));
26
+ const { id, item, thread, authorName, text, summary, at } = raw;
27
+ if (typeof id !== "string" || id === "" || typeof text !== "string" || typeof at !== "string") return void 0;
28
+ if (typeof item !== "string" && typeof item !== "number") return void 0;
29
+ return {
30
+ id,
31
+ item: String(item).replace(/[^A-Za-z0-9_.-]/g, ""),
32
+ thread: typeof thread === "string" && thread !== "" ? thread.replace(/[^A-Za-z0-9_.-]/g, "") : "general",
33
+ authorName: typeof authorName === "string" ? plain(authorName, 100) : "",
34
+ text,
35
+ summary: typeof summary === "string" && summary.trim() !== "" ? summary : null,
36
+ at,
37
+ path
38
+ };
39
+ } catch {
40
+ return void 0;
41
+ }
42
+ }
43
+ function listInbox(jobDir) {
44
+ const folder = join(jobDir, "inbox");
45
+ let names;
46
+ try {
47
+ names = readdirSync(folder);
48
+ } catch {
49
+ return [];
50
+ }
51
+ const comments = [];
52
+ for (const name of names) {
53
+ if (name.startsWith(".") || !name.endsWith(".json")) continue;
54
+ const comment = readComment(join(folder, name));
55
+ if (comment !== void 0) comments.push(comment);
56
+ }
57
+ return comments.sort((a, b) => a.at === b.at ? a.id < b.id ? -1 : 1 : a.at < b.at ? -1 : 1);
58
+ }
59
+ var readListPath = (home) => join(home, ".outerlayer", "inbox-read");
60
+ function readDelivered(home) {
61
+ try {
62
+ return new Set(readFileSync(readListPath(home), "utf8").split("\n").filter((line) => line !== ""));
63
+ } catch {
64
+ return /* @__PURE__ */ new Set();
65
+ }
66
+ }
67
+ function markDelivered(home, ids) {
68
+ mkdirSync(join(home, ".outerlayer"), { recursive: true });
69
+ appendFileSync(readListPath(home), ids.map((id) => `${id}
70
+ `).join(""));
71
+ }
72
+ function answerCommand(comment) {
73
+ const thread = comment.thread === "general" ? "" : ` --thread ${comment.thread}`;
74
+ return `outerlayer work comment --item ${comment.item}${thread} --body "<your answer>"`;
75
+ }
76
+ function formatComment(comment, text, note) {
77
+ const where = comment.thread === "general" ? "the general thread" : `thread ${comment.thread}`;
78
+ return [
79
+ `--- ${comment.authorName === "" ? "A member" : comment.authorName} wrote on ${where} ---`,
80
+ text + note,
81
+ ...comment.summary === null ? [] : ["", `Review summary: ${comment.summary}`],
82
+ "",
83
+ `To answer, run: ${answerCommand(comment)}`
84
+ ].join("\n");
85
+ }
86
+ function selectForDelivery(comments, cap = DELIVERY_CAP) {
87
+ const room = cap - INTRO.length - 2;
88
+ const blocks = [];
89
+ const ids = [];
90
+ let used = 0;
91
+ for (const comment of comments) {
92
+ if (ids.length >= MAX_IDS_PER_CALL) break;
93
+ const whole = formatComment(comment, comment.text, "");
94
+ const cost = whole.length + (blocks.length === 0 ? 0 : 2);
95
+ if (used + cost <= room) {
96
+ blocks.push(whole);
97
+ ids.push(comment.id);
98
+ used += cost;
99
+ continue;
100
+ }
101
+ if (blocks.length === 0) {
102
+ const note = `
103
+ [The comment is cut. All of it is in ${comment.path}]`;
104
+ const fixed = formatComment(comment, "", note).length;
105
+ const keep = Math.max(0, room - fixed);
106
+ blocks.push(formatComment(comment, comment.text.slice(0, keep), note));
107
+ ids.push(comment.id);
108
+ }
109
+ break;
110
+ }
111
+ if (blocks.length === 0) return void 0;
112
+ return { text: [INTRO, ...blocks].join("\n\n"), ids, item: comments[0].item };
113
+ }
114
+ function logFailure(home, err) {
115
+ try {
116
+ const dir = join(home, ".outerlayer", "spool");
117
+ mkdirSync(dir, { recursive: true });
118
+ appendFileSync(join(dir, "hook-errors.log"), `${(/* @__PURE__ */ new Date()).toISOString()} inbox hand-off failed: ${err instanceof Error ? err.message : String(err)}
119
+ `);
120
+ } catch {
121
+ }
122
+ }
123
+ function deliverInbox(event, payload, home, env, spawnImpl, write) {
124
+ try {
125
+ if (event !== "PostToolUse" && event !== "Stop") return;
126
+ const jobDir = env.OUTERLAYER_JOB_DIR;
127
+ if (jobDir === void 0 || jobDir === "") return;
128
+ if (event === "PostToolUse" && payload.agent_id !== void 0) return;
129
+ const inbox = listInbox(jobDir);
130
+ if (inbox.length === 0) return;
131
+ const delivered = readDelivered(home);
132
+ const chosen = selectForDelivery(inbox.filter((comment) => !delivered.has(comment.id)));
133
+ if (chosen === void 0) return;
134
+ write(
135
+ JSON.stringify(
136
+ event === "Stop" ? { decision: "block", reason: chosen.text } : { hookSpecificOutput: { hookEventName: "PostToolUse", additionalContext: chosen.text } }
137
+ )
138
+ );
139
+ markDelivered(home, chosen.ids);
140
+ spawnImpl(process.execPath, [process.argv[1], "work", "comments-read", "--item", chosen.item, ...chosen.ids]);
141
+ } catch (err) {
142
+ logFailure(home, err);
143
+ }
144
+ }
17
145
  var SYNC_STALE_AFTER_MS = 6 * 60 * 60 * 1e3;
18
146
  function syncStatusPath(home = homeFromEnv()) {
19
147
  return join(home, ".outerlayer", "last-sync.json");
@@ -680,11 +808,11 @@ async function missingControlPlane(cwd, sessionId, home, env) {
680
808
  const dirs = findGitDirs(cwd);
681
809
  if (dirs === void 0) return void 0;
682
810
  if (existsSync(join(dirs.gitCommonDir, "outerlayer", "materialized.json")) || hasExcludeBlock(dirs.gitCommonDir)) {
683
- const { cleanupEarlierCopies } = await import('./context-cleanup-KIWINRKM.js');
811
+ const { cleanupEarlierCopies } = await import('./context-cleanup-2MTGLUYS.js');
684
812
  cleanupEarlierCopies(dirs);
685
813
  }
686
814
  if (!contextPossiblyGoverned(cwd, home)) return void 0;
687
- const { governanceOf } = await import('./control-plane-launch-PCGH76P5.js');
815
+ const { governanceOf } = await import('./control-plane-launch-RUJOCYEI.js');
688
816
  if (await governanceOf({ cwd, env, home }) !== "governed") return void 0;
689
817
  recordMissingContext(dirs, sessionId, home);
690
818
  const launcher = `${cliInvocation()} claude`;
@@ -720,7 +848,7 @@ function hasExcludeBlock(gitCommonDir) {
720
848
  return false;
721
849
  }
722
850
  }
723
- async function runHookFast(event, home = homeFromEnv(), read = readStdin, env = process.env, spawnImpl = spawnDetached) {
851
+ async function runHookFast(event, home = homeFromEnv(), read = readStdin, env = process.env, spawnImpl = spawnDetached, write = (out) => void process.stdout.write(out)) {
724
852
  try {
725
853
  const stdin = read();
726
854
  let payload = {};
@@ -730,6 +858,7 @@ async function runHookFast(event, home = homeFromEnv(), read = readStdin, env =
730
858
  payload = {};
731
859
  }
732
860
  const resolvedEvent = String(event ?? payload.hook_event_name ?? "unknown");
861
+ deliverInbox(resolvedEvent, payload, home, env, spawnImpl, write);
733
862
  if (resolvedEvent === "PostToolUse" && (env.OUTERLAYER_WORK === void 0 || env.OUTERLAYER_JOB_DIR !== void 0)) {
734
863
  return;
735
864
  }