charness 3.11.0 → 3.13.0

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 (537) hide show
  1. package/.env.example +5 -0
  2. package/CHANGELOG.md +169 -0
  3. package/DEVELOPMENT.md +81 -18
  4. package/README.md +3 -2
  5. package/SETUP.md +71 -25
  6. package/agent-plugin/README.md +15 -6
  7. package/agent-plugin/skills/charness-delegate-claude/SKILL.md +37 -18
  8. package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +10 -6
  9. package/agent-plugin/skills/charness-delivery-loop/SKILL.md +92 -0
  10. package/agent-plugin/skills/charness-orchestration/SKILL.md +116 -0
  11. package/dist/accessControl.d.ts +43 -0
  12. package/dist/accessControl.d.ts.map +1 -1
  13. package/dist/accessControl.js +50 -1
  14. package/dist/accessControl.js.map +1 -1
  15. package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
  16. package/dist/adapters/claudeCliAdapter.js +9 -4
  17. package/dist/adapters/claudeCliAdapter.js.map +1 -1
  18. package/dist/adapters/claudeJsonStreamAdapter.js +1 -1
  19. package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
  20. package/dist/adapters/claudePlatformFlags.d.ts +4 -3
  21. package/dist/adapters/claudePlatformFlags.d.ts.map +1 -1
  22. package/dist/adapters/claudePlatformFlags.js +4 -3
  23. package/dist/adapters/claudePlatformFlags.js.map +1 -1
  24. package/dist/adapters/openCodeAdapter.d.ts +52 -13
  25. package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
  26. package/dist/adapters/openCodeAdapter.js +121 -45
  27. package/dist/adapters/openCodeAdapter.js.map +1 -1
  28. package/dist/adapters/terminalAdapter.d.ts.map +1 -1
  29. package/dist/adapters/terminalAdapter.js +5 -3
  30. package/dist/adapters/terminalAdapter.js.map +1 -1
  31. package/dist/agentLogin/agentLogin.d.ts +11 -0
  32. package/dist/agentLogin/agentLogin.d.ts.map +1 -1
  33. package/dist/agentLogin/agentLogin.js +20 -20
  34. package/dist/agentLogin/agentLogin.js.map +1 -1
  35. package/dist/apiErrorRetry.d.ts +5 -0
  36. package/dist/apiErrorRetry.d.ts.map +1 -1
  37. package/dist/apiErrorRetry.js +3 -3
  38. package/dist/apiErrorRetry.js.map +1 -1
  39. package/dist/bot.d.ts +12 -3
  40. package/dist/bot.d.ts.map +1 -1
  41. package/dist/bot.js +634 -153
  42. package/dist/bot.js.map +1 -1
  43. package/dist/cli/claudeProfiles.d.ts +5 -2
  44. package/dist/cli/claudeProfiles.d.ts.map +1 -1
  45. package/dist/cli/claudeProfiles.js +45 -22
  46. package/dist/cli/claudeProfiles.js.map +1 -1
  47. package/dist/cli/claudeProfilesCredit.d.ts +49 -0
  48. package/dist/cli/claudeProfilesCredit.d.ts.map +1 -0
  49. package/dist/cli/claudeProfilesCredit.js +160 -0
  50. package/dist/cli/claudeProfilesCredit.js.map +1 -0
  51. package/dist/cli/flagValue.d.ts +10 -0
  52. package/dist/cli/flagValue.d.ts.map +1 -0
  53. package/dist/cli/flagValue.js +17 -0
  54. package/dist/cli/flagValue.js.map +1 -0
  55. package/dist/connectors/jira/client.js +1 -1
  56. package/dist/connectors/jira/client.js.map +1 -1
  57. package/dist/connectors/jira/config.d.ts +7 -0
  58. package/dist/connectors/jira/config.d.ts.map +1 -1
  59. package/dist/connectors/jira/config.js +12 -1
  60. package/dist/connectors/jira/config.js.map +1 -1
  61. package/dist/connectors/jira/connector.d.ts +7 -0
  62. package/dist/connectors/jira/connector.d.ts.map +1 -1
  63. package/dist/connectors/jira/connector.js +20 -3
  64. package/dist/connectors/jira/connector.js.map +1 -1
  65. package/dist/connectors/jira/inbound.d.ts.map +1 -1
  66. package/dist/connectors/jira/inbound.js +4 -3
  67. package/dist/connectors/jira/inbound.js.map +1 -1
  68. package/dist/connectors/jira/issueBlocks.d.ts +1 -1
  69. package/dist/connectors/jira/trustedGroup.d.ts +21 -6
  70. package/dist/connectors/jira/trustedGroup.d.ts.map +1 -1
  71. package/dist/connectors/jira/trustedGroup.js +46 -6
  72. package/dist/connectors/jira/trustedGroup.js.map +1 -1
  73. package/dist/connectors/telegram/commands/botCore.d.ts +19 -2
  74. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  75. package/dist/connectors/telegram/commands/botSkills.js +1 -1
  76. package/dist/connectors/telegram/commands/claudeAccounts.d.ts +6 -1
  77. package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
  78. package/dist/connectors/telegram/commands/claudeAccounts.js +9 -6
  79. package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
  80. package/dist/connectors/telegram/commands/compaction.d.ts +16 -3
  81. package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
  82. package/dist/connectors/telegram/commands/compaction.js +216 -27
  83. package/dist/connectors/telegram/commands/compaction.js.map +1 -1
  84. package/dist/connectors/telegram/commands/runners.d.ts +5 -1
  85. package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
  86. package/dist/connectors/telegram/commands/runners.js +146 -31
  87. package/dist/connectors/telegram/commands/runners.js.map +1 -1
  88. package/dist/connectors/telegram/commands/todo.d.ts.map +1 -1
  89. package/dist/connectors/telegram/commands/todo.js +2 -2
  90. package/dist/connectors/telegram/commands/todo.js.map +1 -1
  91. package/dist/connectors/telegram/commands/topicAccess.d.ts +30 -0
  92. package/dist/connectors/telegram/commands/topicAccess.d.ts.map +1 -0
  93. package/dist/connectors/telegram/commands/topicAccess.js +399 -0
  94. package/dist/connectors/telegram/commands/topicAccess.js.map +1 -0
  95. package/dist/connectors/telegram/inbound.d.ts +44 -7
  96. package/dist/connectors/telegram/inbound.d.ts.map +1 -1
  97. package/dist/connectors/telegram/inbound.js +142 -24
  98. package/dist/connectors/telegram/inbound.js.map +1 -1
  99. package/dist/connectors/telegram/runnerPairingMessages.d.ts +2 -7
  100. package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
  101. package/dist/connectors/telegram/runnerPairingMessages.js +5 -19
  102. package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
  103. package/dist/i18n/de.d.ts.map +1 -1
  104. package/dist/i18n/de.js +120 -8
  105. package/dist/i18n/de.js.map +1 -1
  106. package/dist/i18n/en.d.ts.map +1 -1
  107. package/dist/i18n/en.js +120 -8
  108. package/dist/i18n/en.js.map +1 -1
  109. package/dist/i18n/es.d.ts.map +1 -1
  110. package/dist/i18n/es.js +120 -8
  111. package/dist/i18n/es.js.map +1 -1
  112. package/dist/i18n/fr.d.ts.map +1 -1
  113. package/dist/i18n/fr.js +120 -8
  114. package/dist/i18n/fr.js.map +1 -1
  115. package/dist/i18n/hi.d.ts.map +1 -1
  116. package/dist/i18n/hi.js +120 -8
  117. package/dist/i18n/hi.js.map +1 -1
  118. package/dist/i18n/ja.d.ts.map +1 -1
  119. package/dist/i18n/ja.js +120 -8
  120. package/dist/i18n/ja.js.map +1 -1
  121. package/dist/i18n/ka.d.ts.map +1 -1
  122. package/dist/i18n/ka.js +120 -8
  123. package/dist/i18n/ka.js.map +1 -1
  124. package/dist/i18n/pt.d.ts.map +1 -1
  125. package/dist/i18n/pt.js +120 -8
  126. package/dist/i18n/pt.js.map +1 -1
  127. package/dist/i18n/ru.d.ts.map +1 -1
  128. package/dist/i18n/ru.js +120 -8
  129. package/dist/i18n/ru.js.map +1 -1
  130. package/dist/i18n/uk.d.ts.map +1 -1
  131. package/dist/i18n/uk.js +120 -8
  132. package/dist/i18n/uk.js.map +1 -1
  133. package/dist/i18n/uz.d.ts.map +1 -1
  134. package/dist/i18n/uz.js +120 -8
  135. package/dist/i18n/uz.js.map +1 -1
  136. package/dist/i18n/zh.d.ts.map +1 -1
  137. package/dist/i18n/zh.js +120 -8
  138. package/dist/i18n/zh.js.map +1 -1
  139. package/dist/installManager.d.ts +37 -1
  140. package/dist/installManager.d.ts.map +1 -1
  141. package/dist/installManager.js +208 -14
  142. package/dist/installManager.js.map +1 -1
  143. package/dist/instanceLock.d.ts.map +1 -1
  144. package/dist/instanceLock.js +2 -1
  145. package/dist/instanceLock.js.map +1 -1
  146. package/dist/platform/commandRouter.d.ts +13 -1
  147. package/dist/platform/commandRouter.d.ts.map +1 -1
  148. package/dist/platform/commandRouter.js +14 -2
  149. package/dist/platform/commandRouter.js.map +1 -1
  150. package/dist/platform/inbound.d.ts +2 -0
  151. package/dist/platform/inbound.d.ts.map +1 -1
  152. package/dist/platform/outbound.d.ts +14 -1
  153. package/dist/platform/outbound.d.ts.map +1 -1
  154. package/dist/platform/outbound.js.map +1 -1
  155. package/dist/remoteRun/cleanReport.d.ts +45 -0
  156. package/dist/remoteRun/cleanReport.d.ts.map +1 -0
  157. package/dist/remoteRun/cleanReport.js +84 -0
  158. package/dist/remoteRun/cleanReport.js.map +1 -0
  159. package/dist/remoteRun/cliArgs.d.ts +18 -0
  160. package/dist/remoteRun/cliArgs.d.ts.map +1 -1
  161. package/dist/remoteRun/cliArgs.js +100 -4
  162. package/dist/remoteRun/cliArgs.js.map +1 -1
  163. package/dist/remoteRun/commands.d.ts +30 -1
  164. package/dist/remoteRun/commands.d.ts.map +1 -1
  165. package/dist/remoteRun/commands.js +84 -9
  166. package/dist/remoteRun/commands.js.map +1 -1
  167. package/dist/remoteRun/exitCodes.d.ts +5 -0
  168. package/dist/remoteRun/exitCodes.d.ts.map +1 -1
  169. package/dist/remoteRun/exitCodes.js +6 -1
  170. package/dist/remoteRun/exitCodes.js.map +1 -1
  171. package/dist/remoteRun/foreground.d.ts +6 -0
  172. package/dist/remoteRun/foreground.d.ts.map +1 -1
  173. package/dist/remoteRun/foreground.js +13 -1
  174. package/dist/remoteRun/foreground.js.map +1 -1
  175. package/dist/remoteRun/interrupts.d.ts.map +1 -1
  176. package/dist/remoteRun/interrupts.js +2 -2
  177. package/dist/remoteRun/interrupts.js.map +1 -1
  178. package/dist/remoteRun/jobFiles.d.ts +6 -1
  179. package/dist/remoteRun/jobFiles.d.ts.map +1 -1
  180. package/dist/remoteRun/jobFiles.js +14 -0
  181. package/dist/remoteRun/jobFiles.js.map +1 -1
  182. package/dist/remoteRun/jobId.d.ts +5 -0
  183. package/dist/remoteRun/jobId.d.ts.map +1 -1
  184. package/dist/remoteRun/jobId.js +10 -0
  185. package/dist/remoteRun/jobId.js.map +1 -1
  186. package/dist/remoteRun/jobState.d.ts.map +1 -1
  187. package/dist/remoteRun/jobState.js +3 -2
  188. package/dist/remoteRun/jobState.js.map +1 -1
  189. package/dist/remoteRun/pairedRunners.d.ts +1 -1
  190. package/dist/remoteRun/pairedRunners.d.ts.map +1 -1
  191. package/dist/remoteRun/pairedRunners.js +4 -0
  192. package/dist/remoteRun/pairedRunners.js.map +1 -1
  193. package/dist/remoteRun/pathPatterns.d.ts +1 -1
  194. package/dist/remoteRun/pathPatterns.js +1 -1
  195. package/dist/remoteRun/probe.d.ts +58 -5
  196. package/dist/remoteRun/probe.d.ts.map +1 -1
  197. package/dist/remoteRun/probe.js +107 -11
  198. package/dist/remoteRun/probe.js.map +1 -1
  199. package/dist/remoteRun/probeTiming.d.ts +15 -0
  200. package/dist/remoteRun/probeTiming.d.ts.map +1 -0
  201. package/dist/remoteRun/probeTiming.js +23 -0
  202. package/dist/remoteRun/probeTiming.js.map +1 -0
  203. package/dist/remoteRun/project.d.ts +5 -0
  204. package/dist/remoteRun/project.d.ts.map +1 -1
  205. package/dist/remoteRun/project.js +10 -0
  206. package/dist/remoteRun/project.js.map +1 -1
  207. package/dist/remoteRun/projectConfig.d.ts +8 -1
  208. package/dist/remoteRun/projectConfig.d.ts.map +1 -1
  209. package/dist/remoteRun/projectConfig.js +18 -5
  210. package/dist/remoteRun/projectConfig.js.map +1 -1
  211. package/dist/remoteRun/pruneReport.d.ts +48 -0
  212. package/dist/remoteRun/pruneReport.d.ts.map +1 -0
  213. package/dist/remoteRun/pruneReport.js +80 -0
  214. package/dist/remoteRun/pruneReport.js.map +1 -0
  215. package/dist/remoteRun/remoteRunCli.d.ts +1 -1
  216. package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
  217. package/dist/remoteRun/remoteRunCli.js +20 -0
  218. package/dist/remoteRun/remoteRunCli.js.map +1 -1
  219. package/dist/remoteRun/runnerClient.d.ts +10 -0
  220. package/dist/remoteRun/runnerClient.d.ts.map +1 -1
  221. package/dist/remoteRun/runnerClient.js +19 -5
  222. package/dist/remoteRun/runnerClient.js.map +1 -1
  223. package/dist/remoteRun/runnerWait.d.ts.map +1 -1
  224. package/dist/remoteRun/runnerWait.js +2 -1
  225. package/dist/remoteRun/runnerWait.js.map +1 -1
  226. package/dist/remoteRun/runners.d.ts +48 -7
  227. package/dist/remoteRun/runners.d.ts.map +1 -1
  228. package/dist/remoteRun/runners.js +105 -40
  229. package/dist/remoteRun/runners.js.map +1 -1
  230. package/dist/remoteRun/runnersConfig.d.ts +24 -0
  231. package/dist/remoteRun/runnersConfig.d.ts.map +1 -1
  232. package/dist/remoteRun/runnersConfig.js +29 -2
  233. package/dist/remoteRun/runnersConfig.js.map +1 -1
  234. package/dist/remoteRun/ssh.d.ts +3 -3
  235. package/dist/remoteRun/ssh.d.ts.map +1 -1
  236. package/dist/remoteRun/ssh.js +19 -5
  237. package/dist/remoteRun/ssh.js.map +1 -1
  238. package/dist/remoteRun/submit.d.ts +1 -1
  239. package/dist/remoteRun/submit.d.ts.map +1 -1
  240. package/dist/remoteRun/submit.js +30 -2
  241. package/dist/remoteRun/submit.js.map +1 -1
  242. package/dist/runnerUtility/adminService.d.ts.map +1 -1
  243. package/dist/runnerUtility/adminService.js +5 -5
  244. package/dist/runnerUtility/adminService.js.map +1 -1
  245. package/dist/runnerUtility/appInstall.d.ts +9 -0
  246. package/dist/runnerUtility/appInstall.d.ts.map +1 -1
  247. package/dist/runnerUtility/appInstall.js +12 -2
  248. package/dist/runnerUtility/appInstall.js.map +1 -1
  249. package/dist/runnerUtility/execEnv.d.ts +1 -1
  250. package/dist/runnerUtility/execEnv.d.ts.map +1 -1
  251. package/dist/runnerUtility/execEnv.js +23 -5
  252. package/dist/runnerUtility/execEnv.js.map +1 -1
  253. package/dist/runnerUtility/guiAgentHeal.d.ts +3 -3
  254. package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -1
  255. package/dist/runnerUtility/guiAgentHeal.js +4 -2
  256. package/dist/runnerUtility/guiAgentHeal.js.map +1 -1
  257. package/dist/runnerUtility/homeFolders.d.ts +1 -0
  258. package/dist/runnerUtility/homeFolders.d.ts.map +1 -1
  259. package/dist/runnerUtility/homeFolders.js +2 -1
  260. package/dist/runnerUtility/homeFolders.js.map +1 -1
  261. package/dist/runnerUtility/iosCheck.d.ts +2 -0
  262. package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
  263. package/dist/runnerUtility/iosCheck.js +12 -3
  264. package/dist/runnerUtility/iosCheck.js.map +1 -1
  265. package/dist/runnerUtility/keepAwake.d.ts +47 -10
  266. package/dist/runnerUtility/keepAwake.d.ts.map +1 -1
  267. package/dist/runnerUtility/keepAwake.js +108 -31
  268. package/dist/runnerUtility/keepAwake.js.map +1 -1
  269. package/dist/runnerUtility/launcher.d.ts +4 -0
  270. package/dist/runnerUtility/launcher.d.ts.map +1 -1
  271. package/dist/runnerUtility/launcher.js +31 -13
  272. package/dist/runnerUtility/launcher.js.map +1 -1
  273. package/dist/runnerUtility/linkLoop.d.ts +4 -0
  274. package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
  275. package/dist/runnerUtility/linkLoop.js +15 -6
  276. package/dist/runnerUtility/linkLoop.js.map +1 -1
  277. package/dist/runnerUtility/managedNode.d.ts +84 -0
  278. package/dist/runnerUtility/managedNode.d.ts.map +1 -0
  279. package/dist/runnerUtility/managedNode.js +165 -0
  280. package/dist/runnerUtility/managedNode.js.map +1 -0
  281. package/dist/runnerUtility/nodeOnPath.d.ts +10 -0
  282. package/dist/runnerUtility/nodeOnPath.d.ts.map +1 -0
  283. package/dist/runnerUtility/nodeOnPath.js +49 -0
  284. package/dist/runnerUtility/nodeOnPath.js.map +1 -0
  285. package/dist/runnerUtility/nodeUpkeep.d.ts +140 -0
  286. package/dist/runnerUtility/nodeUpkeep.d.ts.map +1 -0
  287. package/dist/runnerUtility/nodeUpkeep.js +348 -0
  288. package/dist/runnerUtility/nodeUpkeep.js.map +1 -0
  289. package/dist/runnerUtility/nodeUpkeepTiming.d.ts +14 -0
  290. package/dist/runnerUtility/nodeUpkeepTiming.d.ts.map +1 -0
  291. package/dist/runnerUtility/nodeUpkeepTiming.js +21 -0
  292. package/dist/runnerUtility/nodeUpkeepTiming.js.map +1 -0
  293. package/dist/runnerUtility/packageManagerShims.d.ts +10 -0
  294. package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -1
  295. package/dist/runnerUtility/packageManagerShims.js +67 -3
  296. package/dist/runnerUtility/packageManagerShims.js.map +1 -1
  297. package/dist/runnerUtility/pueueDaemon.d.ts +73 -8
  298. package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
  299. package/dist/runnerUtility/pueueDaemon.js +90 -15
  300. package/dist/runnerUtility/pueueDaemon.js.map +1 -1
  301. package/dist/runnerUtility/runnerCommands.d.ts +7 -1
  302. package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
  303. package/dist/runnerUtility/runnerCommands.js +119 -16
  304. package/dist/runnerUtility/runnerCommands.js.map +1 -1
  305. package/dist/runnerUtility/runnerHome.d.ts +34 -0
  306. package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
  307. package/dist/runnerUtility/runnerHome.js +17 -3
  308. package/dist/runnerUtility/runnerHome.js.map +1 -1
  309. package/dist/runnerUtility/serviceCommon.d.ts +2 -0
  310. package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
  311. package/dist/runnerUtility/serviceCommon.js +3 -1
  312. package/dist/runnerUtility/serviceCommon.js.map +1 -1
  313. package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
  314. package/dist/runnerUtility/serviceManager.js +7 -2
  315. package/dist/runnerUtility/serviceManager.js.map +1 -1
  316. package/dist/runnerUtility/simctlGuard.d.ts +38 -0
  317. package/dist/runnerUtility/simctlGuard.d.ts.map +1 -0
  318. package/dist/runnerUtility/simctlGuard.js +166 -0
  319. package/dist/runnerUtility/simctlGuard.js.map +1 -0
  320. package/dist/runners/bootstrapLine.d.ts +3 -4
  321. package/dist/runners/bootstrapLine.d.ts.map +1 -1
  322. package/dist/runners/bootstrapLine.js +108 -83
  323. package/dist/runners/bootstrapLine.js.map +1 -1
  324. package/dist/runners/hubPackage.d.ts +1 -1
  325. package/dist/runners/hubPackage.d.ts.map +1 -1
  326. package/dist/runners/hubPackage.js +5 -6
  327. package/dist/runners/hubPackage.js.map +1 -1
  328. package/dist/runners/hubPairing.d.ts +19 -0
  329. package/dist/runners/hubPairing.d.ts.map +1 -1
  330. package/dist/runners/hubPairing.js +38 -0
  331. package/dist/runners/hubPairing.js.map +1 -1
  332. package/dist/runners/hubRegistry.d.ts +8 -0
  333. package/dist/runners/hubRegistry.d.ts.map +1 -1
  334. package/dist/runners/hubRegistry.js +6 -0
  335. package/dist/runners/hubRegistry.js.map +1 -1
  336. package/dist/runners/pairCode.d.ts +34 -3
  337. package/dist/runners/pairCode.d.ts.map +1 -1
  338. package/dist/runners/pairCode.js +65 -13
  339. package/dist/runners/pairCode.js.map +1 -1
  340. package/dist/runners/runnerGroups.d.ts +22 -0
  341. package/dist/runners/runnerGroups.d.ts.map +1 -0
  342. package/dist/runners/runnerGroups.js +41 -0
  343. package/dist/runners/runnerGroups.js.map +1 -0
  344. package/dist/runners/runnerLock.d.ts +36 -1
  345. package/dist/runners/runnerLock.d.ts.map +1 -1
  346. package/dist/runners/runnerLock.js +94 -30
  347. package/dist/runners/runnerLock.js.map +1 -1
  348. package/dist/runners/runnersCli.d.ts +5 -2
  349. package/dist/runners/runnersCli.d.ts.map +1 -1
  350. package/dist/runners/runnersCli.js +59 -9
  351. package/dist/runners/runnersCli.js.map +1 -1
  352. package/dist/runners/runnersList.d.ts +1 -1
  353. package/dist/runners/runnersList.d.ts.map +1 -1
  354. package/dist/runners/runnersList.js +3 -1
  355. package/dist/runners/runnersList.js.map +1 -1
  356. package/dist/runners/runnersOverview.d.ts.map +1 -1
  357. package/dist/runners/runnersOverview.js +8 -4
  358. package/dist/runners/runnersOverview.js.map +1 -1
  359. package/dist/scheduler/checkRun.d.ts +0 -2
  360. package/dist/scheduler/checkRun.d.ts.map +1 -1
  361. package/dist/scheduler/checkRun.js +0 -10
  362. package/dist/scheduler/checkRun.js.map +1 -1
  363. package/dist/scheduler/checkStatus.d.ts +2 -0
  364. package/dist/scheduler/checkStatus.d.ts.map +1 -1
  365. package/dist/scheduler/checkStatus.js +5 -4
  366. package/dist/scheduler/checkStatus.js.map +1 -1
  367. package/dist/scheduler/delivery.d.ts +2 -1
  368. package/dist/scheduler/delivery.d.ts.map +1 -1
  369. package/dist/scheduler/delivery.js +5 -1
  370. package/dist/scheduler/delivery.js.map +1 -1
  371. package/dist/scheduler/mcpSurface.d.ts +7 -3
  372. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  373. package/dist/scheduler/mcpSurface.js +48 -22
  374. package/dist/scheduler/mcpSurface.js.map +1 -1
  375. package/dist/scheduler/workerWatch.d.ts +33 -10
  376. package/dist/scheduler/workerWatch.d.ts.map +1 -1
  377. package/dist/scheduler/workerWatch.js +37 -11
  378. package/dist/scheduler/workerWatch.js.map +1 -1
  379. package/dist/selfUpdate/bootRollback.d.ts.map +1 -1
  380. package/dist/selfUpdate/bootRollback.js +3 -2
  381. package/dist/selfUpdate/bootRollback.js.map +1 -1
  382. package/dist/selfUpdate/updateRuntime.d.ts.map +1 -1
  383. package/dist/selfUpdate/updateRuntime.js +6 -3
  384. package/dist/selfUpdate/updateRuntime.js.map +1 -1
  385. package/dist/state.d.ts +144 -2
  386. package/dist/state.d.ts.map +1 -1
  387. package/dist/state.js +257 -7
  388. package/dist/state.js.map +1 -1
  389. package/dist/testTimings.d.ts +6 -2
  390. package/dist/testTimings.d.ts.map +1 -1
  391. package/dist/testTimings.js +12 -1
  392. package/dist/testTimings.js.map +1 -1
  393. package/dist/threadContextPreamble.d.ts +15 -1
  394. package/dist/threadContextPreamble.d.ts.map +1 -1
  395. package/dist/threadContextPreamble.js +15 -3
  396. package/dist/threadContextPreamble.js.map +1 -1
  397. package/dist/threadRouting.d.ts +47 -4
  398. package/dist/threadRouting.d.ts.map +1 -1
  399. package/dist/threadRouting.js +31 -4
  400. package/dist/threadRouting.js.map +1 -1
  401. package/dist/todos/projects.d.ts +1 -1
  402. package/dist/todos/projects.d.ts.map +1 -1
  403. package/dist/todos/projects.js +3 -14
  404. package/dist/todos/projects.js.map +1 -1
  405. package/dist/topicTalkerMemory.d.ts +37 -0
  406. package/dist/topicTalkerMemory.d.ts.map +1 -0
  407. package/dist/topicTalkerMemory.js +61 -0
  408. package/dist/topicTalkerMemory.js.map +1 -0
  409. package/dist/topicTalkers.d.ts +123 -0
  410. package/dist/topicTalkers.d.ts.map +1 -0
  411. package/dist/topicTalkers.js +276 -0
  412. package/dist/topicTalkers.js.map +1 -0
  413. package/dist/types.d.ts +7 -5
  414. package/dist/types.d.ts.map +1 -1
  415. package/dist/utils/agentEnvironment.d.ts +23 -0
  416. package/dist/utils/agentEnvironment.d.ts.map +1 -1
  417. package/dist/utils/agentEnvironment.js +33 -1
  418. package/dist/utils/agentEnvironment.js.map +1 -1
  419. package/dist/utils/agentPlugin.d.ts +9 -3
  420. package/dist/utils/agentPlugin.d.ts.map +1 -1
  421. package/dist/utils/agentPlugin.js +13 -6
  422. package/dist/utils/agentPlugin.js.map +1 -1
  423. package/dist/utils/authorMark.d.ts +59 -0
  424. package/dist/utils/authorMark.d.ts.map +1 -0
  425. package/dist/utils/authorMark.js +86 -0
  426. package/dist/utils/authorMark.js.map +1 -0
  427. package/dist/utils/botSkills.d.ts +1 -1
  428. package/dist/utils/claudeApiAgentStop.d.ts +64 -0
  429. package/dist/utils/claudeApiAgentStop.d.ts.map +1 -0
  430. package/dist/utils/claudeApiAgentStop.js +85 -0
  431. package/dist/utils/claudeApiAgentStop.js.map +1 -0
  432. package/dist/utils/claudeApiCredit.d.ts +168 -0
  433. package/dist/utils/claudeApiCredit.d.ts.map +1 -0
  434. package/dist/utils/claudeApiCredit.js +260 -0
  435. package/dist/utils/claudeApiCredit.js.map +1 -0
  436. package/dist/utils/claudeApiCreditRecheck.d.ts +120 -0
  437. package/dist/utils/claudeApiCreditRecheck.d.ts.map +1 -0
  438. package/dist/utils/claudeApiCreditRecheck.js +173 -0
  439. package/dist/utils/claudeApiCreditRecheck.js.map +1 -0
  440. package/dist/utils/claudeCompactHook.d.ts +18 -10
  441. package/dist/utils/claudeCompactHook.d.ts.map +1 -1
  442. package/dist/utils/claudeCompactHook.js +35 -14
  443. package/dist/utils/claudeCompactHook.js.map +1 -1
  444. package/dist/utils/claudeLimitSwitch.d.ts +5 -1
  445. package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
  446. package/dist/utils/claudeLimitSwitch.js +6 -2
  447. package/dist/utils/claudeLimitSwitch.js.map +1 -1
  448. package/dist/utils/claudeProfileUsageLines.d.ts +14 -2
  449. package/dist/utils/claudeProfileUsageLines.d.ts.map +1 -1
  450. package/dist/utils/claudeProfileUsageLines.js +78 -7
  451. package/dist/utils/claudeProfileUsageLines.js.map +1 -1
  452. package/dist/utils/claudeProfileUsageViews.d.ts +46 -0
  453. package/dist/utils/claudeProfileUsageViews.d.ts.map +1 -0
  454. package/dist/utils/claudeProfileUsageViews.js +114 -0
  455. package/dist/utils/claudeProfileUsageViews.js.map +1 -0
  456. package/dist/utils/claudeProfiles.d.ts +22 -0
  457. package/dist/utils/claudeProfiles.d.ts.map +1 -1
  458. package/dist/utils/claudeProfiles.js +69 -0
  459. package/dist/utils/claudeProfiles.js.map +1 -1
  460. package/dist/utils/claudeUsage.d.ts +145 -51
  461. package/dist/utils/claudeUsage.d.ts.map +1 -1
  462. package/dist/utils/claudeUsage.js +211 -94
  463. package/dist/utils/claudeUsage.js.map +1 -1
  464. package/dist/utils/compactOnIdle.d.ts +140 -15
  465. package/dist/utils/compactOnIdle.d.ts.map +1 -1
  466. package/dist/utils/compactOnIdle.js +209 -23
  467. package/dist/utils/compactOnIdle.js.map +1 -1
  468. package/dist/utils/compactSelfReviewFlags.d.ts +50 -0
  469. package/dist/utils/compactSelfReviewFlags.d.ts.map +1 -0
  470. package/dist/utils/compactSelfReviewFlags.js +120 -0
  471. package/dist/utils/compactSelfReviewFlags.js.map +1 -0
  472. package/dist/utils/fallbackChain.d.ts +18 -7
  473. package/dist/utils/fallbackChain.d.ts.map +1 -1
  474. package/dist/utils/fallbackChain.js +36 -16
  475. package/dist/utils/fallbackChain.js.map +1 -1
  476. package/dist/utils/folderGit.d.ts +9 -0
  477. package/dist/utils/folderGit.d.ts.map +1 -0
  478. package/dist/utils/folderGit.js +33 -0
  479. package/dist/utils/folderGit.js.map +1 -0
  480. package/dist/utils/forwardedMark.d.ts +8 -0
  481. package/dist/utils/forwardedMark.d.ts.map +1 -1
  482. package/dist/utils/forwardedMark.js +2 -0
  483. package/dist/utils/forwardedMark.js.map +1 -1
  484. package/dist/utils/jsonStreamHost.d.ts +2 -1
  485. package/dist/utils/jsonStreamHost.d.ts.map +1 -1
  486. package/dist/utils/jsonStreamHost.js +4 -2
  487. package/dist/utils/jsonStreamHost.js.map +1 -1
  488. package/dist/utils/messageContext.d.ts +22 -7
  489. package/dist/utils/messageContext.d.ts.map +1 -1
  490. package/dist/utils/messageContext.js +19 -5
  491. package/dist/utils/messageContext.js.map +1 -1
  492. package/dist/utils/openCodeCompactPlugin.d.ts +28 -7
  493. package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
  494. package/dist/utils/openCodeCompactPlugin.js +80 -15
  495. package/dist/utils/openCodeCompactPlugin.js.map +1 -1
  496. package/dist/utils/personLabel.d.ts +13 -0
  497. package/dist/utils/personLabel.d.ts.map +1 -0
  498. package/dist/utils/personLabel.js +15 -0
  499. package/dist/utils/personLabel.js.map +1 -0
  500. package/dist/utils/replyQuote.d.ts +17 -3
  501. package/dist/utils/replyQuote.d.ts.map +1 -1
  502. package/dist/utils/replyQuote.js +25 -2
  503. package/dist/utils/replyQuote.js.map +1 -1
  504. package/dist/utils/runnersScreenPlan.d.ts +51 -20
  505. package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
  506. package/dist/utils/runnersScreenPlan.js +143 -28
  507. package/dist/utils/runnersScreenPlan.js.map +1 -1
  508. package/dist/utils/streamedCompactionSummary.d.ts +65 -0
  509. package/dist/utils/streamedCompactionSummary.d.ts.map +1 -0
  510. package/dist/utils/streamedCompactionSummary.js +108 -0
  511. package/dist/utils/streamedCompactionSummary.js.map +1 -0
  512. package/dist/utils/talkerAccess.d.ts +9 -0
  513. package/dist/utils/talkerAccess.d.ts.map +1 -0
  514. package/dist/utils/talkerAccess.js +20 -0
  515. package/dist/utils/talkerAccess.js.map +1 -0
  516. package/dist/utils/tmuxExec.d.ts +20 -8
  517. package/dist/utils/tmuxExec.d.ts.map +1 -1
  518. package/dist/utils/tmuxExec.js +27 -7
  519. package/dist/utils/tmuxExec.js.map +1 -1
  520. package/dist/utils/topicAccessScreenPlan.d.ts +253 -0
  521. package/dist/utils/topicAccessScreenPlan.d.ts.map +1 -0
  522. package/dist/utils/topicAccessScreenPlan.js +287 -0
  523. package/dist/utils/topicAccessScreenPlan.js.map +1 -0
  524. package/dist/utils/topicLabel.d.ts +12 -0
  525. package/dist/utils/topicLabel.d.ts.map +1 -0
  526. package/dist/utils/topicLabel.js +12 -0
  527. package/dist/utils/topicLabel.js.map +1 -0
  528. package/dist/utils/topicRequest.d.ts +8 -5
  529. package/dist/utils/topicRequest.d.ts.map +1 -1
  530. package/dist/utils/topicRequest.js +9 -7
  531. package/dist/utils/topicRequest.js.map +1 -1
  532. package/npm-shrinkwrap.json +1003 -0
  533. package/package.json +5 -3
  534. package/remoteRun/ensureNode.sh +288 -0
  535. package/remoteRun/runner.sh +2252 -115
  536. package/agent-plugin/skills/charness-manager/SKILL.md +0 -157
  537. package/remoteRun/pickNode.sh +0 -65
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.OpenCodeAdapter = exports.openCodeServerRestartRetryBudgetMs = exports.openCodeServerRestartRetryDelaysMs = exports.schedulerMcpRetryDelaysMs = exports.openCodeErrorMessageMaxLength = exports.providerRetryReplacementStartTimeoutMs = exports.criticalSseEventTypes = exports.openCodeRuntimeContextHydrationConcurrency = void 0;
36
+ exports.OpenCodeAdapter = exports.mislaunchedServerRecheckDelayMs = exports.openCodeServerRestartRetryBudgetMs = exports.openCodeServerRestartRetryDelaysMs = exports.schedulerMcpRetryDelaysMs = exports.openCodeErrorMessageMaxLength = exports.providerRetryReplacementStartTimeoutMs = exports.criticalSseEventTypes = exports.openCodeRuntimeContextHydrationConcurrency = void 0;
37
37
  exports.listSavedOpenCodeModelLabels = listSavedOpenCodeModelLabels;
38
38
  exports.normaliseOpenCodeSseEvent = normaliseOpenCodeSseEvent;
39
39
  exports.buildDirectoryScopedPath = buildDirectoryScopedPath;
@@ -1010,6 +1010,12 @@ exports.openCodeServerRestartRetryDelaysMs = [2_000, 5_000, 10_000, 15_000, 20_0
1010
1010
  * a hopeless start from holding the topics for minutes.
1011
1011
  */
1012
1012
  exports.openCodeServerRestartRetryBudgetMs = 60_000;
1013
+ /**
1014
+ * How long {@link OpenCodeAdapter.replaceMislaunchedServer} waits before it looks again at a server it must replace while a
1015
+ * session works in it: a plain instance boots rarely, so "the next boot" alone could leave a server without a password open
1016
+ * for days.
1017
+ */
1018
+ exports.mislaunchedServerRecheckDelayMs = 10 * 60_000;
1013
1019
  /**
1014
1020
  * @description The pause before retry number `retryIndex` (0-based), or
1015
1021
  * `null` once the pauses are used up or the retry would start past `budgetMs`
@@ -1028,6 +1034,7 @@ const defaultOpenCodeServerRestartOps = {
1028
1034
  ensureServer: installManager_1.ensureOpenCodeServer,
1029
1035
  restartServer: installManager_1.restartOpenCodeServer,
1030
1036
  readServerLaunch: installManager_1.readOpenCodeServerLaunch,
1037
+ readServerExposure: installManager_1.readOpenCodeServerExposure,
1031
1038
  };
1032
1039
  function buildProviderApiAuthPayload(apiKey) {
1033
1040
  return { type: 'api', key: apiKey };
@@ -1235,7 +1242,6 @@ class OpenCodeAdapter extends events_1.EventEmitter {
1235
1242
  */
1236
1243
  sseDropLogThrottle = new Map();
1237
1244
  baseUrl;
1238
- authHeader;
1239
1245
  /**
1240
1246
  * Grace period (ms) the fallback rename waits for opencode's native
1241
1247
  * auto-title before stepping in. Instance field (initialised from
@@ -1268,8 +1274,12 @@ class OpenCodeAdapter extends events_1.EventEmitter {
1268
1274
  * tests can fail attempts and shrink the pauses — production never changes them.
1269
1275
  */
1270
1276
  serverRestartOps = defaultOpenCodeServerRestartOps;
1271
- /** The skills boot step said once why it leaves the running server alone (`activateAgentSkillsForServer`). */
1272
- isAgentSkillsSkipAnnounced = false;
1277
+ /** The boot step said once why it leaves the running server alone (`replaceMislaunchedServer`). */
1278
+ isMislaunchedServerSkipAnnounced = false;
1279
+ /** The pending look again of {@link replaceMislaunchedServer} at a server a working session kept it from replacing. */
1280
+ mislaunchedServerRecheckTimer = null;
1281
+ /** Instance field only so a test can shorten it; production keeps {@link mislaunchedServerRecheckDelayMs}. */
1282
+ mislaunchedServerRecheckDelayMs = exports.mislaunchedServerRecheckDelayMs;
1273
1283
  serverRestartRetryDelaysMs = exports.openCodeServerRestartRetryDelaysMs;
1274
1284
  serverRestartRetryBudgetMs = exports.openCodeServerRestartRetryBudgetMs;
1275
1285
  /**
@@ -1335,14 +1345,6 @@ class OpenCodeAdapter extends events_1.EventEmitter {
1335
1345
  super();
1336
1346
  // Audit S7 / #34: SSRF guard on OPENCODE_URL before any fetch runs.
1337
1347
  this.baseUrl = validateOpenCodeUrl(process.env.OPENCODE_URL || installManager_1.defaultOpenCodeUrl);
1338
- const password = process.env.OPENCODE_PASSWORD;
1339
- if (password) {
1340
- const username = process.env.OPENCODE_USERNAME || 'opencode';
1341
- this.authHeader = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');
1342
- }
1343
- else {
1344
- this.authHeader = null;
1345
- }
1346
1348
  // Listen for unexpected server crashes (OOM kill, segfault, etc.)
1347
1349
  (0, installManager_1.onOpenCodeServerExit)((code, signal) => {
1348
1350
  console.error(`[OpenCode] Server crashed unexpectedly: code=${code}, signal=${signal}`);
@@ -1535,15 +1537,13 @@ class OpenCodeAdapter extends events_1.EventEmitter {
1535
1537
  async reloadProviderAuth() {
1536
1538
  return this.restartServer(true);
1537
1539
  }
1540
+ /** @description Read per request: every server generation the bot starts has a password of its own. */
1538
1541
  getHeaders() {
1539
- const headers = {
1542
+ return {
1540
1543
  'Content-Type': 'application/json',
1541
1544
  'Accept': 'application/json',
1545
+ ...(0, installManager_1.getOpenCodeServerAuthHeaders)(),
1542
1546
  };
1543
- if (this.authHeader) {
1544
- headers['Authorization'] = this.authHeader;
1545
- }
1546
- return headers;
1547
1547
  }
1548
1548
  async apiRequest(method, urlPath, body, options) {
1549
1549
  const url = `${this.baseUrl}${urlPath}`;
@@ -1665,6 +1665,9 @@ class OpenCodeAdapter extends events_1.EventEmitter {
1665
1665
  lastEmittedLength: 0,
1666
1666
  outputTimer: null,
1667
1667
  compactionSummaryMessageId: null,
1668
+ isBotCompactionInFlight: false,
1669
+ botCompactionSummaryMessageId: null,
1670
+ responseMessageId: null,
1668
1671
  isResponseCompactionSummary: false,
1669
1672
  childResponseText: '',
1670
1673
  childLastEmittedLength: 0,
@@ -1894,6 +1897,7 @@ class OpenCodeAdapter extends events_1.EventEmitter {
1894
1897
  // Reset accumulated response text for new message
1895
1898
  session.currentResponseText = '';
1896
1899
  session.lastEmittedLength = 0;
1900
+ session.responseMessageId = null;
1897
1901
  session.isResponseCompactionSummary = false;
1898
1902
  // The child (sub-agent) accumulator resets with the parent's — a new turn
1899
1903
  // starts clean (a stale debounce firing later emits nothing: empty tail).
@@ -2633,6 +2637,9 @@ class OpenCodeAdapter extends events_1.EventEmitter {
2633
2637
  // compaction prompt (F2/S6) — only send it when non-empty so an ordinary
2634
2638
  // `/compact` stays byte-identical to before.
2635
2639
  const trimmedInstruction = instruction?.trim();
2640
+ // While the call is open the summary message the server announces is this call's (see `handleMessageUpdate`): the bot
2641
+ // reads its section itself after the call, so its streamed tails are marked as the bot's.
2642
+ session.isBotCompactionInFlight = true;
2636
2643
  try {
2637
2644
  await this.apiRequest('POST', buildDirectoryScopedPath(`/session/${session.sessionId}/summarize`, session.workDir), {
2638
2645
  providerID: modelRef.providerID,
@@ -2649,6 +2656,9 @@ class OpenCodeAdapter extends events_1.EventEmitter {
2649
2656
  console.warn(`[OpenCode] context compaction failed:`, reason);
2650
2657
  return { ok: false, error: (0, i18n_1.t)('compact.failed', { reason }) };
2651
2658
  }
2659
+ finally {
2660
+ session.isBotCompactionInFlight = false;
2661
+ }
2652
2662
  }
2653
2663
  /**
2654
2664
  * @description Whether this thread's directory instance loaded the bot's
@@ -2862,6 +2872,9 @@ class OpenCodeAdapter extends events_1.EventEmitter {
2862
2872
  lastEmittedLength: 0,
2863
2873
  outputTimer: null,
2864
2874
  compactionSummaryMessageId: null,
2875
+ isBotCompactionInFlight: false,
2876
+ botCompactionSummaryMessageId: null,
2877
+ responseMessageId: null,
2865
2878
  isResponseCompactionSummary: false,
2866
2879
  childResponseText: '',
2867
2880
  childLastEmittedLength: 0,
@@ -3068,41 +3081,75 @@ class OpenCodeAdapter extends events_1.EventEmitter {
3068
3081
  await Promise.allSettled(Array.from(directories, (directory) => this.reconcileSchedulerMcpForDirectory(directory)));
3069
3082
  }
3070
3083
  /**
3071
- * @description Boot step for the skills the bot gives its agents (`utils/agentPlugin.ts`). OpenCode reads its
3072
- * `OPENCODE_CONFIG_DIR` once, at start, so a server started the other way than the instance's «Bot skills» switch says —
3073
- * without the bot's folder while the switch is ON (an older bot, adopted ever since; the switch turned on since), with it
3074
- * while the switch is OFF — keeps offering the wrong thing. Such a server is replaced through the controlled restart that
3075
- * restores the sessions, but only when the bot owns it (its process record) AND `/proc` shows it is an `opencode … serve`
3076
- * (a server the bot does not own, or a listener it cannot identify, is left as is — one log line per process), the folder
3077
- * it would get is ready, and no session is working: a busy directory, or a status it cannot read, leaves it for the next
3078
- * boot. Only the INSTANCE value counts: one server serves every topic. Best-effort, never rejects.
3084
+ * @description Boot step that replaces a server started the wrong way, which a running server never corrects by itself:
3085
+ * - the skills the bot gives its agents (`utils/agentPlugin.ts`): OpenCode reads its `OPENCODE_CONFIG_DIR` once, at start,
3086
+ * so a server started the other way than the instance's «Bot skills» switch says — without the bot's folder while the
3087
+ * switch is ON (an older bot, adopted ever since; the switch turned on since), with it while the switch is OFF — keeps
3088
+ * offering the wrong thing; only the INSTANCE value counts: one server serves every topic. Replaced only when the bot
3089
+ * owns it (its process record) AND `/proc` shows it is an `opencode … serve`, and the folder it would get is ready;
3090
+ * - its password: a server that answers a request without one lets every local account drive its agents. Read the way such
3091
+ * an account would, on every platform ({@link OpenCodeServerExposure}), and replaced whether the bot owns it or not — like a
3092
+ * stale version — as long as it is an `opencode … serve` the bot may stop: one a bot from before passwords left running,
3093
+ * and also one the operator runs on the bot's port (the idle check sees only the bot's sessions, so a turn of the
3094
+ * operator's own in it ends; the docs tell them to start such a server with `OPENCODE_SERVER_PASSWORD`). A test's
3095
+ * stand-in or another account's process never is.
3096
+ * The replacement is the controlled restart that restores the sessions, and only when no session is working: a busy
3097
+ * directory, or a status it cannot read, makes it look again after {@link mislaunchedServerRecheckDelayMs} (and at the
3098
+ * next boot). A server it leaves for another reason gets one log line per process. Best-effort, never rejects.
3079
3099
  */
3080
- async activateAgentSkillsForServer() {
3100
+ async replaceMislaunchedServer() {
3081
3101
  try {
3082
3102
  const expectation = (0, agentPlugin_1.getOpenCodeAgentSkillsExpectation)(process.env, (0, state_1.resolveDataDir)(), (0, botSkills_1.checkIsBotSkillsEnabled)(null));
3083
- const action = (0, agentPlugin_1.getOpenCodeAgentSkillsServerAction)(await this.serverRestartOps.readServerLaunch(), expectation);
3084
- if (action === 'skipNotOwned' || action === 'skipUnidentified') {
3085
- if (!this.isAgentSkillsSkipAnnounced) {
3086
- this.isAgentSkillsSkipAnnounced = true;
3087
- const reason = action === 'skipNotOwned' ? 'is not owned by the bot' : 'cannot be identified as `opencode serve`';
3088
- console.log(`[OpenCode] the server ${reason}; it is left as is, and offers the bot's skills only if it was started with them`);
3089
- }
3090
- return;
3103
+ const skillsAction = (0, agentPlugin_1.getOpenCodeAgentSkillsServerAction)(await this.serverRestartOps.readServerLaunch(), expectation);
3104
+ const exposure = await this.serverRestartOps.readServerExposure();
3105
+ const faults = [];
3106
+ if (skillsAction === 'replace') {
3107
+ faults.push(expectation.kind === 'offered' ? `without the bot's skills` : `with the bot's skills, which the instance switched off`);
3091
3108
  }
3092
- if (action === 'none')
3109
+ if (exposure === 'openStoppable')
3110
+ faults.push('without a password (every local account can drive its agents)');
3111
+ if (faults.length === 0) {
3112
+ const reasonsLeft = [];
3113
+ if (skillsAction === 'skipNotOwned')
3114
+ reasonsLeft.push(`is not owned by the bot, and offers the bot's skills only if it was started with them`);
3115
+ if (skillsAction === 'skipUnidentified')
3116
+ reasonsLeft.push(`cannot be identified as \`opencode serve\`, and offers the bot's skills only if it was started with them`);
3117
+ if (exposure === 'openUnstoppable')
3118
+ reasonsLeft.push('answers without a password, and is not an `opencode serve` of the bot\'s user it may stop');
3119
+ if (reasonsLeft.length > 0)
3120
+ this.announceMislaunchedServerSkipOnce(`the server ${reasonsLeft.join('; it ')}; it is left as is`);
3093
3121
  return;
3094
- const startedWith = expectation.kind === 'offered' ? `without the bot's skills` : `with the bot's skills, which the instance switched off`;
3122
+ }
3123
+ const startedWith = faults.join(' and ');
3095
3124
  if (!(await this.checkIsEveryActiveSessionIdle())) {
3096
- console.log(`[OpenCode] the server was started ${startedWith}; a session is working, the next boot retries`);
3125
+ console.log(`[OpenCode] the server was started ${startedWith}; a session is working, looking again in ${Math.round(this.mislaunchedServerRecheckDelayMs / 60_000)} min`);
3126
+ this.scheduleMislaunchedServerRecheck();
3097
3127
  return;
3098
3128
  }
3099
3129
  console.log(`[OpenCode] the server was started ${startedWith}; replacing it`);
3100
3130
  await this.restartServer(true);
3101
3131
  }
3102
3132
  catch (e) {
3103
- console.warn(`[OpenCode] could not check the server for the bot's skills:`, e instanceof Error ? e.message : e);
3133
+ console.warn(`[OpenCode] could not check how the server was started:`, e instanceof Error ? e.message : e);
3104
3134
  }
3105
3135
  }
3136
+ /** @description Look again at the server once the delay is over; one pending look at a time, never holding the process open. */
3137
+ scheduleMislaunchedServerRecheck() {
3138
+ if (this.mislaunchedServerRecheckTimer)
3139
+ return;
3140
+ this.mislaunchedServerRecheckTimer = setTimeout(() => {
3141
+ this.mislaunchedServerRecheckTimer = null;
3142
+ void this.replaceMislaunchedServer();
3143
+ }, this.mislaunchedServerRecheckDelayMs);
3144
+ this.mislaunchedServerRecheckTimer.unref();
3145
+ }
3146
+ /** @description Say once per process why {@link replaceMislaunchedServer} leaves the running server alone. */
3147
+ announceMislaunchedServerSkipOnce(line) {
3148
+ if (this.isMislaunchedServerSkipAnnounced)
3149
+ return;
3150
+ this.isMislaunchedServerSkipAnnounced = true;
3151
+ console.log(`[OpenCode] ${line}`);
3152
+ }
3106
3153
  /**
3107
3154
  * @description Whether no active session is working — by the adapter's own view and by each directory's status.
3108
3155
  *
@@ -3456,10 +3503,8 @@ class OpenCodeAdapter extends events_1.EventEmitter {
3456
3503
  const streamLabel = stream.directory;
3457
3504
  const headers = {
3458
3505
  'Accept': 'text/event-stream',
3506
+ ...(0, installManager_1.getOpenCodeServerAuthHeaders)(),
3459
3507
  };
3460
- if (this.authHeader) {
3461
- headers['Authorization'] = this.authHeader;
3462
- }
3463
3508
  // Audit S7 / #12: SSE was previously read with no abort path —
3464
3509
  // `await reader.read()` blocks until bytes arrive, so a teardown during a
3465
3510
  // silent server couldn't actually free the connection. The stream-scoped
@@ -4038,8 +4083,8 @@ class OpenCodeAdapter extends events_1.EventEmitter {
4038
4083
  const text = delta || '';
4039
4084
  if (!text)
4040
4085
  return;
4041
- if (messageId !== undefined && messageId === session.compactionSummaryMessageId)
4042
- session.isResponseCompactionSummary = true;
4086
+ if (messageId !== undefined)
4087
+ this.followResponseMessage(key, session, messageId);
4043
4088
  session.currentResponseText += text;
4044
4089
  // Debounce: batch rapid SSE deltas before emitting
4045
4090
  if (session.outputTimer) {
@@ -4050,6 +4095,29 @@ class OpenCodeAdapter extends events_1.EventEmitter {
4050
4095
  this.emitResponseTail(key, session);
4051
4096
  }, sseOutputBatchMs);
4052
4097
  }
4098
+ /**
4099
+ * @description Keep the buffer's text and its tails to ONE message at the edge of a compaction summary. The buffer holds
4100
+ * whatever arrives until a turn flush, so without this a tail could carry the agent's words and the first words of a
4101
+ * summary (tagged as the summary, and dropped with it when the summary is hidden), and the agent's answer after a summary
4102
+ * in the same turn would be tagged as the summary too. When the deltas move from one message to another and either of the
4103
+ * two is a summary, the pending tail is sent as it is and the buffer starts afresh: the next tail is the first of a message
4104
+ * of its own, not a continuation of the one before. Messages that are no summary share the buffer as they always did.
4105
+ */
4106
+ followResponseMessage(key, session, messageId) {
4107
+ const isSummaryMessage = messageId === session.compactionSummaryMessageId;
4108
+ const isNewMessage = session.responseMessageId !== null && messageId !== session.responseMessageId;
4109
+ if (isNewMessage && (isSummaryMessage || session.isResponseCompactionSummary)) {
4110
+ if (session.outputTimer) {
4111
+ clearTimeout(session.outputTimer);
4112
+ session.outputTimer = null;
4113
+ }
4114
+ this.emitResponseTail(key, session);
4115
+ session.currentResponseText = '';
4116
+ session.lastEmittedLength = 0;
4117
+ }
4118
+ session.responseMessageId = messageId;
4119
+ session.isResponseCompactionSummary = isSummaryMessage;
4120
+ }
4053
4121
  /**
4054
4122
  * @description Emit only the part of `currentResponseText` not yet sent as
4055
4123
  * an `output` event, then advance `lastEmittedLength`. The bot does not
@@ -4073,8 +4141,11 @@ class OpenCodeAdapter extends events_1.EventEmitter {
4073
4141
  // `isFinal` rides only the idle-triggered flush so the bot can skip the
4074
4142
  // possibly-429-stretched debounce for the turn's last frame.
4075
4143
  const meta = { isContinuation, isFinal };
4076
- if (session.isResponseCompactionSummary)
4144
+ if (session.isResponseCompactionSummary && session.responseMessageId !== null) {
4077
4145
  meta.isCompactionSummary = true;
4146
+ meta.compactionSummaryMessageId = session.responseMessageId;
4147
+ meta.isBotIssuedCompaction = session.responseMessageId === session.botCompactionSummaryMessageId;
4148
+ }
4078
4149
  this.emit('output', key, tail, meta);
4079
4150
  session.lastEmittedLength = session.currentResponseText.length;
4080
4151
  }
@@ -4413,8 +4484,12 @@ class OpenCodeAdapter extends events_1.EventEmitter {
4413
4484
  if (info.role === 'assistant')
4414
4485
  session.sawTurnActivity = true;
4415
4486
  // The summary message is stored (and announced here) before its text streams.
4416
- if (isParentAssistantMessage && info.summary === true && info.id)
4487
+ if (isParentAssistantMessage && info.summary === true && info.id) {
4417
4488
  session.compactionSummaryMessageId = info.id;
4489
+ // A summary announced while the bot's own compaction call is open is that call's: it, not the server, started it.
4490
+ if (session.isBotCompactionInFlight)
4491
+ session.botCompactionSummaryMessageId = info.id;
4492
+ }
4418
4493
  if (info.role === 'user' && (!info.sessionID || info.sessionID === session.sessionId)) {
4419
4494
  this.noteUserMessageSeen(session, info.id);
4420
4495
  }
@@ -4986,6 +5061,7 @@ class OpenCodeAdapter extends events_1.EventEmitter {
4986
5061
  this.emitResponseTail(key, session, isFinal);
4987
5062
  session.currentResponseText = '';
4988
5063
  session.lastEmittedLength = 0;
5064
+ session.responseMessageId = null;
4989
5065
  session.isResponseCompactionSummary = false;
4990
5066
  session.childResponseText = '';
4991
5067
  session.childLastEmittedLength = 0;