waterplane 0.1.6 → 0.1.11

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 (496) hide show
  1. package/CHANGELOG.md +92 -1
  2. package/README.md +1 -1
  3. package/SECURITY.md +11 -3
  4. package/deploy/node-version +1 -1
  5. package/node_modules/@waterplane/shared/dist/agentfiles.d.ts +17 -0
  6. package/node_modules/@waterplane/shared/dist/agentfiles.js +58 -4
  7. package/node_modules/@waterplane/shared/dist/agentfiles.js.map +1 -1
  8. package/node_modules/@waterplane/shared/dist/alwaysonwords.d.ts +83 -0
  9. package/node_modules/@waterplane/shared/dist/alwaysonwords.js +209 -0
  10. package/node_modules/@waterplane/shared/dist/alwaysonwords.js.map +1 -0
  11. package/node_modules/@waterplane/shared/dist/autocompact.js +1 -1
  12. package/node_modules/@waterplane/shared/dist/autocompact.js.map +1 -1
  13. package/node_modules/@waterplane/shared/dist/backendsources.d.ts +11 -1
  14. package/node_modules/@waterplane/shared/dist/backendsources.js.map +1 -1
  15. package/node_modules/@waterplane/shared/dist/branchmode.d.ts +27 -0
  16. package/node_modules/@waterplane/shared/dist/branchmode.js +80 -0
  17. package/node_modules/@waterplane/shared/dist/branchmode.js.map +1 -0
  18. package/node_modules/@waterplane/shared/dist/buildstamp.d.ts +37 -0
  19. package/node_modules/@waterplane/shared/dist/buildstamp.js +95 -0
  20. package/node_modules/@waterplane/shared/dist/buildstamp.js.map +1 -0
  21. package/node_modules/@waterplane/shared/dist/burn.d.ts +16 -1
  22. package/node_modules/@waterplane/shared/dist/burn.js +30 -0
  23. package/node_modules/@waterplane/shared/dist/burn.js.map +1 -1
  24. package/node_modules/@waterplane/shared/dist/changebrief.d.ts +61 -0
  25. package/node_modules/@waterplane/shared/dist/changebrief.js +70 -0
  26. package/node_modules/@waterplane/shared/dist/changebrief.js.map +1 -0
  27. package/node_modules/@waterplane/shared/dist/desktopfiles.d.ts +100 -0
  28. package/node_modules/@waterplane/shared/dist/desktopfiles.js +192 -0
  29. package/node_modules/@waterplane/shared/dist/desktopfiles.js.map +1 -0
  30. package/node_modules/@waterplane/shared/dist/exposure.d.ts +175 -0
  31. package/node_modules/@waterplane/shared/dist/exposure.js +357 -0
  32. package/node_modules/@waterplane/shared/dist/exposure.js.map +1 -0
  33. package/node_modules/@waterplane/shared/dist/exposurepush.d.ts +60 -0
  34. package/node_modules/@waterplane/shared/dist/exposurepush.js +103 -0
  35. package/node_modules/@waterplane/shared/dist/exposurepush.js.map +1 -0
  36. package/node_modules/@waterplane/shared/dist/healthindex/commits.d.ts +26 -0
  37. package/node_modules/@waterplane/shared/dist/healthindex/commits.js +57 -0
  38. package/node_modules/@waterplane/shared/dist/healthindex/commits.js.map +1 -0
  39. package/node_modules/@waterplane/shared/dist/healthindex/move.d.ts +25 -0
  40. package/node_modules/@waterplane/shared/dist/healthindex/move.js +79 -0
  41. package/node_modules/@waterplane/shared/dist/healthindex/move.js.map +1 -0
  42. package/node_modules/@waterplane/shared/dist/healthindex/readings.d.ts +53 -0
  43. package/node_modules/@waterplane/shared/dist/healthindex/readings.js +154 -0
  44. package/node_modules/@waterplane/shared/dist/healthindex/readings.js.map +1 -0
  45. package/node_modules/@waterplane/shared/dist/healthindex/repoindex.d.ts +41 -0
  46. package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js +19 -0
  47. package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js.map +1 -0
  48. package/node_modules/@waterplane/shared/dist/healthindex/score.d.ts +26 -0
  49. package/node_modules/@waterplane/shared/dist/healthindex/score.js +154 -0
  50. package/node_modules/@waterplane/shared/dist/healthindex/score.js.map +1 -0
  51. package/node_modules/@waterplane/shared/dist/healthindex/types.d.ts +206 -0
  52. package/node_modules/@waterplane/shared/dist/healthindex/types.js +58 -0
  53. package/node_modules/@waterplane/shared/dist/healthindex/types.js.map +1 -0
  54. package/node_modules/@waterplane/shared/dist/healthindex/vs.d.ts +26 -0
  55. package/node_modules/@waterplane/shared/dist/healthindex/vs.js +38 -0
  56. package/node_modules/@waterplane/shared/dist/healthindex/vs.js.map +1 -0
  57. package/node_modules/@waterplane/shared/dist/healthindex/words.d.ts +28 -0
  58. package/node_modules/@waterplane/shared/dist/healthindex/words.js +69 -0
  59. package/node_modules/@waterplane/shared/dist/healthindex/words.js.map +1 -0
  60. package/node_modules/@waterplane/shared/dist/healthindex.d.ts +15 -411
  61. package/node_modules/@waterplane/shared/dist/healthindex.js +8 -602
  62. package/node_modules/@waterplane/shared/dist/healthindex.js.map +1 -1
  63. package/node_modules/@waterplane/shared/dist/hints.js +5 -0
  64. package/node_modules/@waterplane/shared/dist/hints.js.map +1 -1
  65. package/node_modules/@waterplane/shared/dist/index.d.ts +29 -0
  66. package/node_modules/@waterplane/shared/dist/index.js +29 -0
  67. package/node_modules/@waterplane/shared/dist/index.js.map +1 -1
  68. package/node_modules/@waterplane/shared/dist/intent/kind.d.ts +31 -1
  69. package/node_modules/@waterplane/shared/dist/intent/kind.js +27 -3
  70. package/node_modules/@waterplane/shared/dist/intent/kind.js.map +1 -1
  71. package/node_modules/@waterplane/shared/dist/intent.d.ts +1 -1
  72. package/node_modules/@waterplane/shared/dist/intent.js +1 -1
  73. package/node_modules/@waterplane/shared/dist/intent.js.map +1 -1
  74. package/node_modules/@waterplane/shared/dist/launchmodes.d.ts +2 -0
  75. package/node_modules/@waterplane/shared/dist/launchmodes.js +12 -0
  76. package/node_modules/@waterplane/shared/dist/launchmodes.js.map +1 -1
  77. package/node_modules/@waterplane/shared/dist/ledgerspan.d.ts +59 -0
  78. package/node_modules/@waterplane/shared/dist/ledgerspan.js +99 -0
  79. package/node_modules/@waterplane/shared/dist/ledgerspan.js.map +1 -0
  80. package/node_modules/@waterplane/shared/dist/netretry.d.ts +38 -0
  81. package/node_modules/@waterplane/shared/dist/netretry.js +31 -0
  82. package/node_modules/@waterplane/shared/dist/netretry.js.map +1 -0
  83. package/node_modules/@waterplane/shared/dist/netretrycfg.d.ts +12 -0
  84. package/node_modules/@waterplane/shared/dist/netretrycfg.js +27 -0
  85. package/node_modules/@waterplane/shared/dist/netretrycfg.js.map +1 -0
  86. package/node_modules/@waterplane/shared/dist/nodemin.d.ts +6 -4
  87. package/node_modules/@waterplane/shared/dist/nodemin.js +6 -4
  88. package/node_modules/@waterplane/shared/dist/nodemin.js.map +1 -1
  89. package/node_modules/@waterplane/shared/dist/optins.d.ts +35 -1
  90. package/node_modules/@waterplane/shared/dist/optins.js +39 -1
  91. package/node_modules/@waterplane/shared/dist/optins.js.map +1 -1
  92. package/node_modules/@waterplane/shared/dist/plugin/api.d.ts +364 -0
  93. package/node_modules/@waterplane/shared/dist/plugin/api.js +2 -0
  94. package/node_modules/@waterplane/shared/dist/plugin/api.js.map +1 -0
  95. package/node_modules/@waterplane/shared/dist/plugin/backend.d.ts +197 -0
  96. package/node_modules/@waterplane/shared/dist/plugin/backend.js +9 -0
  97. package/node_modules/@waterplane/shared/dist/plugin/backend.js.map +1 -0
  98. package/node_modules/@waterplane/shared/dist/plugin/manifest.d.ts +160 -0
  99. package/node_modules/@waterplane/shared/dist/plugin/manifest.js +98 -0
  100. package/node_modules/@waterplane/shared/dist/plugin/manifest.js.map +1 -0
  101. package/node_modules/@waterplane/shared/dist/plugin/module.d.ts +98 -0
  102. package/node_modules/@waterplane/shared/dist/plugin/module.js +13 -0
  103. package/node_modules/@waterplane/shared/dist/plugin/module.js.map +1 -0
  104. package/node_modules/@waterplane/shared/dist/plugin/version.d.ts +64 -0
  105. package/node_modules/@waterplane/shared/dist/plugin/version.js +84 -0
  106. package/node_modules/@waterplane/shared/dist/plugin/version.js.map +1 -0
  107. package/node_modules/@waterplane/shared/dist/plugin.d.ts +5 -867
  108. package/node_modules/@waterplane/shared/dist/plugin.js +27 -186
  109. package/node_modules/@waterplane/shared/dist/plugin.js.map +1 -1
  110. package/node_modules/@waterplane/shared/dist/pluginlaunch.d.ts +7 -0
  111. package/node_modules/@waterplane/shared/dist/prview.d.ts +23 -0
  112. package/node_modules/@waterplane/shared/dist/prview.js +107 -0
  113. package/node_modules/@waterplane/shared/dist/prview.js.map +1 -0
  114. package/node_modules/@waterplane/shared/dist/repohealth.d.ts +4 -0
  115. package/node_modules/@waterplane/shared/dist/repohealth.js.map +1 -1
  116. package/node_modules/@waterplane/shared/dist/schedule/schedaction.d.ts +29 -0
  117. package/node_modules/@waterplane/shared/dist/schedule/schedaction.js +22 -0
  118. package/node_modules/@waterplane/shared/dist/schedule/schedaction.js.map +1 -1
  119. package/node_modules/@waterplane/shared/dist/schedule/schedclean.js +26 -0
  120. package/node_modules/@waterplane/shared/dist/schedule/schedclean.js.map +1 -1
  121. package/node_modules/@waterplane/shared/dist/schedule.d.ts +1 -1
  122. package/node_modules/@waterplane/shared/dist/schedule.js +1 -1
  123. package/node_modules/@waterplane/shared/dist/schedule.js.map +1 -1
  124. package/node_modules/@waterplane/shared/dist/sessionbudget.d.ts +20 -5
  125. package/node_modules/@waterplane/shared/dist/sessionbudget.js +42 -16
  126. package/node_modules/@waterplane/shared/dist/sessionbudget.js.map +1 -1
  127. package/node_modules/@waterplane/shared/dist/weekburn.d.ts +114 -0
  128. package/node_modules/@waterplane/shared/dist/weekburn.js +205 -0
  129. package/node_modules/@waterplane/shared/dist/weekburn.js.map +1 -0
  130. package/node_modules/@waterplane/shared/dist/wire/alwayson.d.ts +64 -0
  131. package/node_modules/@waterplane/shared/dist/wire/alwayson.js +7 -0
  132. package/node_modules/@waterplane/shared/dist/wire/alwayson.js.map +1 -0
  133. package/node_modules/@waterplane/shared/dist/wire/backend.d.ts +4 -0
  134. package/node_modules/@waterplane/shared/dist/wire/backendtokens.d.ts +6 -0
  135. package/node_modules/@waterplane/shared/dist/wire/backendtokens.js +0 -9
  136. package/node_modules/@waterplane/shared/dist/wire/backendtokens.js.map +1 -1
  137. package/node_modules/@waterplane/shared/dist/wire/costwindow.d.ts +20 -0
  138. package/node_modules/@waterplane/shared/dist/wire/messages/clienthost.d.ts +15 -1
  139. package/node_modules/@waterplane/shared/dist/wire/messages/clientsession.d.ts +10 -0
  140. package/node_modules/@waterplane/shared/dist/wire/messages/hosttools.d.ts +12 -2
  141. package/node_modules/@waterplane/shared/dist/wire/notify.d.ts +129 -1
  142. package/node_modules/@waterplane/shared/dist/wire/notify.js +79 -1
  143. package/node_modules/@waterplane/shared/dist/wire/notify.js.map +1 -1
  144. package/node_modules/@waterplane/shared/dist/wire/pullrequest.d.ts +42 -0
  145. package/node_modules/@waterplane/shared/dist/wire/pullrequest.js +2 -0
  146. package/node_modules/@waterplane/shared/dist/wire/pullrequest.js.map +1 -0
  147. package/node_modules/@waterplane/shared/dist/wire/repo.d.ts +119 -0
  148. package/node_modules/@waterplane/shared/dist/wire/repo.js +8 -3
  149. package/node_modules/@waterplane/shared/dist/wire/repo.js.map +1 -1
  150. package/node_modules/@waterplane/shared/dist/wire/sent.d.ts +3 -1
  151. package/node_modules/@waterplane/shared/dist/wire/session/contextspark.d.ts +7 -0
  152. package/node_modules/@waterplane/shared/dist/wire/session/info.d.ts +4 -1
  153. package/node_modules/@waterplane/shared/dist/wire/session/launch.d.ts +25 -0
  154. package/node_modules/@waterplane/shared/dist/wire/session.d.ts +1 -1
  155. package/node_modules/@waterplane/shared/dist/wire/telemetry.d.ts +4 -0
  156. package/node_modules/@waterplane/shared/dist/wire/work.d.ts +13 -0
  157. package/node_modules/@waterplane/shared/dist/wire/work.js.map +1 -1
  158. package/npm-shrinkwrap.json +3 -3
  159. package/package.json +2 -2
  160. package/packages/extensions/scorecard/waterplane-plugin.json +10 -0
  161. package/packages/host/dist/agentexposure.d.ts +13 -0
  162. package/packages/host/dist/agentexposure.js +90 -0
  163. package/packages/host/dist/agentexposure.js.map +1 -0
  164. package/packages/host/dist/agentintents.js +2 -2
  165. package/packages/host/dist/agentintents.js.map +1 -1
  166. package/packages/host/dist/agentwatch.d.ts +3 -7
  167. package/packages/host/dist/agentwatch.js.map +1 -1
  168. package/packages/host/dist/alwayson.d.ts +18 -0
  169. package/packages/host/dist/alwayson.js +159 -0
  170. package/packages/host/dist/alwayson.js.map +1 -0
  171. package/packages/host/dist/answergate.d.ts +3 -7
  172. package/packages/host/dist/answergate.js.map +1 -1
  173. package/packages/host/dist/attentionstore.d.ts +61 -0
  174. package/packages/host/dist/attentionstore.js +162 -0
  175. package/packages/host/dist/attentionstore.js.map +1 -0
  176. package/packages/host/dist/backends/claude.js +1 -1
  177. package/packages/host/dist/backends/claude.js.map +1 -1
  178. package/packages/host/dist/backends/derive.js +1 -0
  179. package/packages/host/dist/backends/derive.js.map +1 -1
  180. package/packages/host/dist/backends/registry.js +4 -1
  181. package/packages/host/dist/backends/registry.js.map +1 -1
  182. package/packages/host/dist/backends/types.d.ts +2 -0
  183. package/packages/host/dist/besidespend.d.ts +22 -0
  184. package/packages/host/dist/besidespend.js +65 -0
  185. package/packages/host/dist/besidespend.js.map +1 -0
  186. package/packages/host/dist/boxkit.d.ts +19 -0
  187. package/packages/host/dist/boxkit.js +38 -0
  188. package/packages/host/dist/boxkit.js.map +1 -0
  189. package/packages/host/dist/branchrules.d.ts +14 -0
  190. package/packages/host/dist/branchrules.js +47 -0
  191. package/packages/host/dist/branchrules.js.map +1 -0
  192. package/packages/host/dist/builds.d.ts +31 -1
  193. package/packages/host/dist/builds.js +55 -3
  194. package/packages/host/dist/builds.js.map +1 -1
  195. package/packages/host/dist/buildversions.d.ts +2 -0
  196. package/packages/host/dist/buildversions.js +36 -0
  197. package/packages/host/dist/buildversions.js.map +1 -0
  198. package/packages/host/dist/burnwatch.d.ts +23 -11
  199. package/packages/host/dist/burnwatch.js +51 -2
  200. package/packages/host/dist/burnwatch.js.map +1 -1
  201. package/packages/host/dist/changebrief.d.ts +37 -0
  202. package/packages/host/dist/changebrief.js +157 -0
  203. package/packages/host/dist/changebrief.js.map +1 -0
  204. package/packages/host/dist/cli/index.js +1 -1
  205. package/packages/host/dist/cli/index.js.map +1 -1
  206. package/packages/host/dist/clihealth.d.ts +2 -0
  207. package/packages/host/dist/clihealth.js +11 -2
  208. package/packages/host/dist/clihealth.js.map +1 -1
  209. package/packages/host/dist/compliance.d.ts +5 -1
  210. package/packages/host/dist/compliance.js +70 -31
  211. package/packages/host/dist/compliance.js.map +1 -1
  212. package/packages/host/dist/composer.d.ts +3 -1
  213. package/packages/host/dist/composer.js +3 -1
  214. package/packages/host/dist/composer.js.map +1 -1
  215. package/packages/host/dist/ctxlog/ctxcursor.d.ts +36 -1
  216. package/packages/host/dist/ctxlog/ctxcursor.js +96 -2
  217. package/packages/host/dist/ctxlog/ctxcursor.js.map +1 -1
  218. package/packages/host/dist/ctxlog/ctxproject.js +2 -1
  219. package/packages/host/dist/ctxlog/ctxproject.js.map +1 -1
  220. package/packages/host/dist/ctxlog/ctxupdate.js +13 -2
  221. package/packages/host/dist/ctxlog/ctxupdate.js.map +1 -1
  222. package/packages/host/dist/diskwatch.d.ts +4 -6
  223. package/packages/host/dist/diskwatch.js +3 -1
  224. package/packages/host/dist/diskwatch.js.map +1 -1
  225. package/packages/host/dist/eraseen.d.ts +6 -0
  226. package/packages/host/dist/eraseen.js +100 -0
  227. package/packages/host/dist/eraseen.js.map +1 -0
  228. package/packages/host/dist/exposure.d.ts +56 -0
  229. package/packages/host/dist/exposure.js +371 -0
  230. package/packages/host/dist/exposure.js.map +1 -0
  231. package/packages/host/dist/exposurepush.d.ts +28 -0
  232. package/packages/host/dist/exposurepush.js +136 -0
  233. package/packages/host/dist/exposurepush.js.map +1 -0
  234. package/packages/host/dist/exposurerun.d.ts +18 -0
  235. package/packages/host/dist/exposurerun.js +126 -0
  236. package/packages/host/dist/exposurerun.js.map +1 -0
  237. package/packages/host/dist/exposurewatch.d.ts +29 -0
  238. package/packages/host/dist/exposurewatch.js +127 -0
  239. package/packages/host/dist/exposurewatch.js.map +1 -0
  240. package/packages/host/dist/extensions/scorecard/host/engine.d.mts +54 -0
  241. package/packages/host/dist/extensions/scorecard/host/engine.mjs +303 -0
  242. package/packages/host/dist/extensions/scorecard/host/engine.mjs.map +1 -0
  243. package/packages/host/dist/extensions/scorecard/host/gitslug.d.mts +5 -0
  244. package/packages/host/dist/extensions/scorecard/host/gitslug.mjs +45 -0
  245. package/packages/host/dist/extensions/scorecard/host/gitslug.mjs.map +1 -0
  246. package/packages/host/dist/extensions/scorecard/host/index.d.mts +15 -0
  247. package/packages/host/dist/extensions/scorecard/host/index.mjs +47 -0
  248. package/packages/host/dist/extensions/scorecard/host/index.mjs.map +1 -0
  249. package/packages/host/dist/extensions/scorecard/host/store.d.mts +12 -0
  250. package/packages/host/dist/extensions/scorecard/host/store.mjs +91 -0
  251. package/packages/host/dist/extensions/scorecard/host/store.mjs.map +1 -0
  252. package/packages/host/dist/extensions/scorecard/shared/logic.d.mts +42 -0
  253. package/packages/host/dist/extensions/scorecard/shared/logic.mjs +170 -0
  254. package/packages/host/dist/extensions/scorecard/shared/logic.mjs.map +1 -0
  255. package/packages/host/dist/extensions/scorecard/shared/wire.d.mts +140 -0
  256. package/packages/host/dist/extensions/scorecard/shared/wire.mjs +29 -0
  257. package/packages/host/dist/extensions/scorecard/shared/wire.mjs.map +1 -0
  258. package/packages/host/dist/forge/github.d.ts +3 -0
  259. package/packages/host/dist/forge/github.js +82 -0
  260. package/packages/host/dist/forge/github.js.map +1 -0
  261. package/packages/host/dist/forge/index.d.ts +14 -0
  262. package/packages/host/dist/forge/index.js +32 -0
  263. package/packages/host/dist/forge/index.js.map +1 -0
  264. package/packages/host/dist/forge/types.d.ts +52 -0
  265. package/packages/host/dist/forge/types.js +2 -0
  266. package/packages/host/dist/forge/types.js.map +1 -0
  267. package/packages/host/dist/git.d.ts +36 -3
  268. package/packages/host/dist/git.js +119 -41
  269. package/packages/host/dist/git.js.map +1 -1
  270. package/packages/host/dist/gitnotify.d.ts +24 -0
  271. package/packages/host/dist/gitnotify.js +60 -0
  272. package/packages/host/dist/gitnotify.js.map +1 -0
  273. package/packages/host/dist/healthwatch.d.ts +2 -1
  274. package/packages/host/dist/healthwatch.js +4 -2
  275. package/packages/host/dist/healthwatch.js.map +1 -1
  276. package/packages/host/dist/intents/adapters.js +45 -14
  277. package/packages/host/dist/intents/adapters.js.map +1 -1
  278. package/packages/host/dist/intents/contract.d.ts +4 -0
  279. package/packages/host/dist/intents/contract.js.map +1 -1
  280. package/packages/host/dist/intents/fire.js +7 -1
  281. package/packages/host/dist/intents/fire.js.map +1 -1
  282. package/packages/host/dist/intents/manager.d.ts +3 -3
  283. package/packages/host/dist/intents/manager.js +2 -2
  284. package/packages/host/dist/intents/manager.js.map +1 -1
  285. package/packages/host/dist/intents/watch.d.ts +10 -2
  286. package/packages/host/dist/intents/watch.js +27 -2
  287. package/packages/host/dist/intents/watch.js.map +1 -1
  288. package/packages/host/dist/localcistatus.d.ts +22 -0
  289. package/packages/host/dist/localcistatus.js +105 -0
  290. package/packages/host/dist/localcistatus.js.map +1 -0
  291. package/packages/host/dist/main.js +40 -10
  292. package/packages/host/dist/main.js.map +1 -1
  293. package/packages/host/dist/net.d.ts +2 -0
  294. package/packages/host/dist/net.js +11 -2
  295. package/packages/host/dist/net.js.map +1 -1
  296. package/packages/host/dist/netlog.d.ts +40 -0
  297. package/packages/host/dist/netlog.js +165 -0
  298. package/packages/host/dist/netlog.js.map +1 -0
  299. package/packages/host/dist/netretrycfg.d.ts +7 -0
  300. package/packages/host/dist/netretrycfg.js +51 -0
  301. package/packages/host/dist/netretrycfg.js.map +1 -0
  302. package/packages/host/dist/notifyprefs.d.ts +6 -2
  303. package/packages/host/dist/notifyprefs.js +20 -5
  304. package/packages/host/dist/notifyprefs.js.map +1 -1
  305. package/packages/host/dist/notifytypes.d.ts +58 -0
  306. package/packages/host/dist/notifytypes.js +2 -0
  307. package/packages/host/dist/notifytypes.js.map +1 -0
  308. package/packages/host/dist/opendeliveries.js +24 -0
  309. package/packages/host/dist/opendeliveries.js.map +1 -1
  310. package/packages/host/dist/optins.d.ts +28 -1
  311. package/packages/host/dist/optins.js +96 -4
  312. package/packages/host/dist/optins.js.map +1 -1
  313. package/packages/host/dist/peers/agentpeer.js +1 -1
  314. package/packages/host/dist/peers/agentpeer.js.map +1 -1
  315. package/packages/host/dist/peers/jobs.d.ts +2 -4
  316. package/packages/host/dist/peers/jobs.js +6 -1
  317. package/packages/host/dist/peers/jobs.js.map +1 -1
  318. package/packages/host/dist/plugins/pluginapi.js +2 -0
  319. package/packages/host/dist/plugins/pluginapi.js.map +1 -1
  320. package/packages/host/dist/plugins/pluginregistry.d.ts +3 -8
  321. package/packages/host/dist/plugins/pluginregistry.js +1 -1
  322. package/packages/host/dist/plugins/pluginregistry.js.map +1 -1
  323. package/packages/host/dist/protectmain.d.ts +35 -0
  324. package/packages/host/dist/protectmain.js +73 -0
  325. package/packages/host/dist/protectmain.js.map +1 -0
  326. package/packages/host/dist/prpush.d.ts +30 -0
  327. package/packages/host/dist/prpush.js +171 -0
  328. package/packages/host/dist/prpush.js.map +1 -0
  329. package/packages/host/dist/prs.d.ts +70 -0
  330. package/packages/host/dist/prs.js +328 -0
  331. package/packages/host/dist/prs.js.map +1 -0
  332. package/packages/host/dist/push.d.ts +19 -0
  333. package/packages/host/dist/push.js.map +1 -1
  334. package/packages/host/dist/render.d.ts +57 -0
  335. package/packages/host/dist/render.js +57 -39
  336. package/packages/host/dist/render.js.map +1 -1
  337. package/packages/host/dist/repohealth.js +5 -2
  338. package/packages/host/dist/repohealth.js.map +1 -1
  339. package/packages/host/dist/repohealthapproval.d.ts +3 -0
  340. package/packages/host/dist/repohealthapproval.js +92 -2
  341. package/packages/host/dist/repohealthapproval.js.map +1 -1
  342. package/packages/host/dist/repos.js +7 -1
  343. package/packages/host/dist/repos.js.map +1 -1
  344. package/packages/host/dist/reposkill.d.ts +8 -5
  345. package/packages/host/dist/reposkill.js +16 -11
  346. package/packages/host/dist/reposkill.js.map +1 -1
  347. package/packages/host/dist/reposkilltext.d.ts +8 -1
  348. package/packages/host/dist/reposkilltext.js +72 -3
  349. package/packages/host/dist/reposkilltext.js.map +1 -1
  350. package/packages/host/dist/routes/apihost.js +26 -2
  351. package/packages/host/dist/routes/apihost.js.map +1 -1
  352. package/packages/host/dist/routes/apiprs.d.ts +2 -0
  353. package/packages/host/dist/routes/apiprs.js +45 -0
  354. package/packages/host/dist/routes/apiprs.js.map +1 -0
  355. package/packages/host/dist/routes/apirepofiles.js +12 -1
  356. package/packages/host/dist/routes/apirepofiles.js.map +1 -1
  357. package/packages/host/dist/routes/apirepowork.js +48 -24
  358. package/packages/host/dist/routes/apirepowork.js.map +1 -1
  359. package/packages/host/dist/routes/apiroutes.js +2 -1
  360. package/packages/host/dist/routes/apiroutes.js.map +1 -1
  361. package/packages/host/dist/routes/apisession.js +24 -0
  362. package/packages/host/dist/routes/apisession.js.map +1 -1
  363. package/packages/host/dist/routes/apistats.js +12 -7
  364. package/packages/host/dist/routes/apistats.js.map +1 -1
  365. package/packages/host/dist/routes/apisystem.js +23 -1
  366. package/packages/host/dist/routes/apisystem.js.map +1 -1
  367. package/packages/host/dist/routes/apitable.d.ts +10 -0
  368. package/packages/host/dist/routes/apitable.js.map +1 -1
  369. package/packages/host/dist/routes/apiweekburn.d.ts +2 -0
  370. package/packages/host/dist/routes/apiweekburn.js +30 -0
  371. package/packages/host/dist/routes/apiweekburn.js.map +1 -0
  372. package/packages/host/dist/routes/session.js +4 -0
  373. package/packages/host/dist/routes/session.js.map +1 -1
  374. package/packages/host/dist/routes/system.js +33 -6
  375. package/packages/host/dist/routes/system.js.map +1 -1
  376. package/packages/host/dist/routes/types.d.ts +29 -21
  377. package/packages/host/dist/routes/work/workbuild.js +3 -2
  378. package/packages/host/dist/routes/work/workbuild.js.map +1 -1
  379. package/packages/host/dist/routes/work/workschedule.js +33 -3
  380. package/packages/host/dist/routes/work/workschedule.js.map +1 -1
  381. package/packages/host/dist/screenlog.d.ts +20 -0
  382. package/packages/host/dist/screenlog.js +40 -0
  383. package/packages/host/dist/screenlog.js.map +1 -1
  384. package/packages/host/dist/server/clients.d.ts +14 -24
  385. package/packages/host/dist/server/clients.js +77 -11
  386. package/packages/host/dist/server/clients.js.map +1 -1
  387. package/packages/host/dist/server/ctx.d.ts +2 -0
  388. package/packages/host/dist/server/ctxseal.d.ts +1 -1
  389. package/packages/host/dist/server/ctxseal.js +6 -6
  390. package/packages/host/dist/server/ctxseal.js.map +1 -1
  391. package/packages/host/dist/server/deliveries.js +4 -2
  392. package/packages/host/dist/server/deliveries.js.map +1 -1
  393. package/packages/host/dist/server/http.js +2 -2
  394. package/packages/host/dist/server/http.js.map +1 -1
  395. package/packages/host/dist/server/intentDeps.js +4 -1
  396. package/packages/host/dist/server/intentDeps.js.map +1 -1
  397. package/packages/host/dist/server/intentEvents.js +9 -4
  398. package/packages/host/dist/server/intentEvents.js.map +1 -1
  399. package/packages/host/dist/server/scan.js +23 -1
  400. package/packages/host/dist/server/scan.js.map +1 -1
  401. package/packages/host/dist/server/sessionEvents.js +37 -10
  402. package/packages/host/dist/server/sessionEvents.js.map +1 -1
  403. package/packages/host/dist/sessions/agentpoll.d.ts +31 -0
  404. package/packages/host/dist/sessions/agentpoll.js +176 -0
  405. package/packages/host/dist/sessions/agentpoll.js.map +1 -0
  406. package/packages/host/dist/sessions/apiretry.d.ts +59 -0
  407. package/packages/host/dist/sessions/apiretry.js +240 -0
  408. package/packages/host/dist/sessions/apiretry.js.map +1 -0
  409. package/packages/host/dist/sessions/askwatch.d.ts +62 -0
  410. package/packages/host/dist/sessions/askwatch.js +169 -0
  411. package/packages/host/dist/sessions/askwatch.js.map +1 -0
  412. package/packages/host/dist/sessions/boxes.d.ts +2 -23
  413. package/packages/host/dist/sessions/boxes.js +10 -664
  414. package/packages/host/dist/sessions/boxes.js.map +1 -1
  415. package/packages/host/dist/sessions/boxread.d.ts +47 -0
  416. package/packages/host/dist/sessions/boxread.js +628 -0
  417. package/packages/host/dist/sessions/boxread.js.map +1 -0
  418. package/packages/host/dist/sessions/core.d.ts +16 -1
  419. package/packages/host/dist/sessions/ctxseries.js +3 -0
  420. package/packages/host/dist/sessions/ctxseries.js.map +1 -1
  421. package/packages/host/dist/sessions/drive.d.ts +20 -6
  422. package/packages/host/dist/sessions/drive.js +43 -8
  423. package/packages/host/dist/sessions/drive.js.map +1 -1
  424. package/packages/host/dist/sessions/knobs.d.ts +8 -0
  425. package/packages/host/dist/sessions/knobs.js +9 -0
  426. package/packages/host/dist/sessions/knobs.js.map +1 -1
  427. package/packages/host/dist/sessions/record.js +7 -2
  428. package/packages/host/dist/sessions/record.js.map +1 -1
  429. package/packages/host/dist/sessions/resume.d.ts +17 -0
  430. package/packages/host/dist/sessions/resume.js +65 -11
  431. package/packages/host/dist/sessions/resume.js.map +1 -1
  432. package/packages/host/dist/sessions/roster.js +3 -0
  433. package/packages/host/dist/sessions/roster.js.map +1 -1
  434. package/packages/host/dist/sessions/sidechannel.d.ts +1 -1
  435. package/packages/host/dist/sessions/sidechannel.js +2 -2
  436. package/packages/host/dist/sessions/turn.d.ts +15 -58
  437. package/packages/host/dist/sessions/turn.js +17 -356
  438. package/packages/host/dist/sessions/turn.js.map +1 -1
  439. package/packages/host/dist/sessions.d.ts +7 -1
  440. package/packages/host/dist/sessions.js +22 -13
  441. package/packages/host/dist/sessions.js.map +1 -1
  442. package/packages/host/dist/settle.d.ts +6 -0
  443. package/packages/host/dist/settle.js +26 -21
  444. package/packages/host/dist/settle.js.map +1 -1
  445. package/packages/host/dist/setupprefs.d.ts +26 -1
  446. package/packages/host/dist/setupprefs.js +49 -1
  447. package/packages/host/dist/setupprefs.js.map +1 -1
  448. package/packages/host/dist/sidecar/sidecarname.d.ts +2 -0
  449. package/packages/host/dist/sidecar/sidecarname.js +5 -1
  450. package/packages/host/dist/sidecar/sidecarname.js.map +1 -1
  451. package/packages/host/dist/sidecar/sidecarroute.d.ts +1 -1
  452. package/packages/host/dist/sidecar/sidecarroute.js +5 -0
  453. package/packages/host/dist/sidecar/sidecarroute.js.map +1 -1
  454. package/packages/host/dist/sidecar.d.ts +1 -1
  455. package/packages/host/dist/sidecar.js +1 -1
  456. package/packages/host/dist/sidecar.js.map +1 -1
  457. package/packages/host/dist/tokenscan.d.ts +4 -0
  458. package/packages/host/dist/tokenscan.js +6 -1
  459. package/packages/host/dist/tokenscan.js.map +1 -1
  460. package/packages/host/dist/tokenstats.js +3 -1
  461. package/packages/host/dist/tokenstats.js.map +1 -1
  462. package/packages/host/dist/transcript/transcriptparse.js +6 -1
  463. package/packages/host/dist/transcript/transcriptparse.js.map +1 -1
  464. package/packages/host/dist/transcript/transcriptturns.d.ts +29 -0
  465. package/packages/host/dist/transcript/transcriptturns.js +27 -0
  466. package/packages/host/dist/transcript/transcriptturns.js.map +1 -1
  467. package/packages/host/dist/transcript.d.ts +1 -1
  468. package/packages/host/dist/transcript.js +1 -1
  469. package/packages/host/dist/transcript.js.map +1 -1
  470. package/packages/host/dist/usagesources.d.ts +1 -1
  471. package/packages/host/dist/usagesources.js +7 -2
  472. package/packages/host/dist/usagesources.js.map +1 -1
  473. package/packages/host/dist/weekburn.d.ts +75 -0
  474. package/packages/host/dist/weekburn.js +251 -0
  475. package/packages/host/dist/weekburn.js.map +1 -0
  476. package/packages/host/dist/worktreeleftover.d.ts +9 -0
  477. package/packages/host/dist/worktreeleftover.js +17 -1
  478. package/packages/host/dist/worktreeleftover.js.map +1 -1
  479. package/packages/web/dist/assets/demo-C1GHaeTv.js +23 -0
  480. package/packages/web/dist/assets/icons-DlcvcZoo.js +1 -0
  481. package/packages/web/dist/assets/index-BBc6xwDA.css +1 -0
  482. package/packages/web/dist/assets/index-DzQKnksZ.js +169 -0
  483. package/packages/web/dist/assets/shared-Cl34umPA.js +47 -0
  484. package/packages/web/dist/assets/{sheets-Bjv2L-cG.css → sheets-DoUhPGK0.css} +1 -1
  485. package/packages/web/dist/assets/sheets-_3_SvXAx.js +220 -0
  486. package/packages/web/dist/build-id.txt +1 -1
  487. package/packages/web/dist/buildstamp.json +1 -0
  488. package/packages/web/dist/index.html +7 -7
  489. package/packages/web/dist/sw.js +14 -3
  490. package/release.json +7 -4
  491. package/packages/web/dist/assets/demo-CXlqlYE4.js +0 -23
  492. package/packages/web/dist/assets/icons-BbqDBVjw.js +0 -1
  493. package/packages/web/dist/assets/index-CgPoyb3Y.css +0 -1
  494. package/packages/web/dist/assets/index-D5JKj8DK.js +0 -169
  495. package/packages/web/dist/assets/shared-eyaskl5l.js +0 -47
  496. package/packages/web/dist/assets/sheets-BzzL2re1.js +0 -204
@@ -0,0 +1,240 @@
1
+ /**
2
+ * The retry of a turn the CLI GAVE UP on a transient API error (R-connection-024).
3
+ *
4
+ * The CLI retries a failed request on its own, but during a DNS or Wi-Fi outage
5
+ * that budget runs out and the turn ENDS on "API Error: Can't reach the API
6
+ * server (ENOTFOUND)" — and someone has to type "try again" by hand. Here the
7
+ * host does, on a widening ladder (`netlog.ts`'s `netRetryDelay`), the way the
8
+ * usage-limit wall types its `continue` (`wall.ts`'s `doLimitContinue`): text and
9
+ * Return as two writes through the facade's `write`, a history row and a
10
+ * `sent.json` row. Never `deliver.ts`, never a queue bypass of the phone's own.
11
+ *
12
+ * Read off the LOG only (`readNetLog`), on the ONE end-of-turn path
13
+ * (`turn.ts`'s `settleStop`), and only where the give-up is FRESH — stamped
14
+ * inside the turn that just ended. Called off by anything that says the person
15
+ * or the account has taken over: a keystroke or prompt (`typed`), a turn
16
+ * starting that is not ours (`turnStarted`), a wall (`limit.blocked` outranks),
17
+ * the halt latch, the session ending (`clear`). A session that is busy — a box
18
+ * up, a dialog, output still arriving — is PARKED, never typed into. Past the
19
+ * cap it stops and says so (`state: "gaveup"`); there is no loop.
20
+ *
21
+ * State is memory only: a host restart forgets a pending retry, which is the
22
+ * safe direction (it types nothing).
23
+ *
24
+ * What the turn end MEANT travels on `turnEnded` (`TurnEndNet`): deferred work
25
+ * waiting on the turn (`intents/watch.ts`) must not complete off a turn that
26
+ * did not happen. `retrying` holds it, `gaveup` fails it, and `checking` (our
27
+ * `continue`'s turn ended before its log row landed) is answered once by
28
+ * `netTurnSettled` after the re-read. A person's keystroke cancels the retry
29
+ * and the next real turn end completes the work as ever.
30
+ */
31
+ import { logTag, netGaveUpDetail, netRetryLine } from "@waterplane/shared";
32
+ import { freshGiveUp, netRetryDelay, readNetLog } from "../netlog.js";
33
+ import { transcriptPath } from "../transcript.js";
34
+ import { recordSent } from "../sentlog.js";
35
+ import { derive } from "../backends/derive.js";
36
+ import { haltRefusal as hostHalt } from "../halt.js";
37
+ import { NET_RETRY_LADDER_MS, NET_RETRY_MAX } from "./knobs.js";
38
+ import { netRetryOn } from "../netretrycfg.js";
39
+ /** How long a busy session is parked before the retry looks again. */
40
+ const PARK_MS = 30_000;
41
+ /** Output this recent means the screen is still moving — park briefly. */
42
+ const QUIET_MS = 3000;
43
+ /** A turn starting this soon after our `continue` is ours. */
44
+ const OURS_MS = 60_000;
45
+ /** The log row can land a moment after the Stop: one re-read this much later. */
46
+ const RECHECK_MS = 1500;
47
+ export class NetRetrySlice {
48
+ core;
49
+ constructor(core) {
50
+ this.core = core;
51
+ }
52
+ /**
53
+ * The turn just ended (`settleStop`). `retrying` ⇒ a retry is scheduled, and
54
+ * the turn-finished ping is held: the turn is not done, it is being tried
55
+ * again. Null ⇒ an ordinary turn end.
56
+ */
57
+ turnEnded(s) {
58
+ if (!netRetryOn() || !s.info.running || !s.hooksActive || !derive(s.backend).keepsClaudeLog || !s.info.claudeSessionId)
59
+ return null;
60
+ const v = readNetLog(transcriptPath(s.info.cwd, s.info.claudeSessionId));
61
+ if (!freshGiveUp(v, s.info.turnStartedAt)) {
62
+ // A served reply ends the outage. The row may also land just after the
63
+ // Stop: look once more, without the ping. Mid-episode (our `continue`'s
64
+ // turn) the episode is KEPT until that look — clearing it here restarted
65
+ // the ladder at 0 and the cap was never reached — and the turn end is
66
+ // `checking`, so work waiting on it waits for the answer.
67
+ const live = !!s.info.netRetry;
68
+ if (v.state !== "clear") {
69
+ this.recheckLater(s);
70
+ return live ? { net: "checking" } : null;
71
+ }
72
+ if (live)
73
+ this.set(s, null);
74
+ return null;
75
+ }
76
+ return this.schedule(s, v.at, v.error);
77
+ }
78
+ /** A turn started. Ours (just typed) keeps the ladder; anyone else's ends it. */
79
+ turnStarted(s) {
80
+ const n = s.info.netRetry;
81
+ if (!n)
82
+ return;
83
+ if (n.state === "sent" && Date.now() - (s.netSentAt ?? 0) < OURS_MS)
84
+ return;
85
+ this.cancel(s, "a turn started");
86
+ }
87
+ /** Someone typed into the session — our own `continue` excepted. */
88
+ typed(s) {
89
+ if (s.netWriting || !s.info.netRetry)
90
+ return;
91
+ this.cancel(s, "typed into the session");
92
+ }
93
+ /** The phone's Cancel (`session.netRetryCancel`). */
94
+ cancelById(id) {
95
+ const s = this.core.sessions.get(id);
96
+ if (s?.info.netRetry)
97
+ this.cancel(s, "cancelled from the phone");
98
+ }
99
+ /** The session is going (exit, detach, kill, remove): drop the timer. */
100
+ clear(s) {
101
+ if (s.netTimer) {
102
+ clearTimeout(s.netTimer);
103
+ s.netTimer = null;
104
+ }
105
+ if (s.netRecheck) {
106
+ clearTimeout(s.netRecheck);
107
+ s.netRecheck = null;
108
+ }
109
+ }
110
+ cancel(s, why) {
111
+ this.clear(s);
112
+ console.log(`${logTag} net retry off · ${s.info.title} (${s.info.id}) · ${why}`);
113
+ this.set(s, null);
114
+ }
115
+ set(s, n) {
116
+ s.info.netRetry = n;
117
+ this.core.emit("updated", s.info);
118
+ }
119
+ /** Arm the next rung (`retrying`), or stop at the cap (`gaveup`); null ⇒ a wall outranks. */
120
+ schedule(s, at, error) {
121
+ const prev = s.info.netRetry;
122
+ const attempt = prev && prev.state === "sent" ? prev.attempt : 0;
123
+ const delay = netRetryDelay(attempt, NET_RETRY_MAX, NET_RETRY_LADDER_MS);
124
+ this.clear(s);
125
+ if (s.info.limit?.blocked) {
126
+ if (prev)
127
+ this.set(s, null);
128
+ return null;
129
+ } // a wall outranks
130
+ if (delay == null) {
131
+ const why = `after ${attempt} ${attempt === 1 ? "try" : "tries"}`;
132
+ this.set(s, { state: "gaveup", attempt, max: NET_RETRY_MAX, nextAt: null, error, at, why });
133
+ console.log(`${logTag} net retry gave up · ${s.info.title} (${s.info.id}) · ${error}`);
134
+ return { net: "gaveup", detail: netGaveUpDetail(error, why) };
135
+ }
136
+ const n = { state: "waiting", attempt, max: NET_RETRY_MAX, nextAt: Date.now() + delay, error, at };
137
+ this.arm(s, delay);
138
+ this.set(s, n);
139
+ console.log(`${logTag} ${netRetryLine(n, Date.now())} · ${s.info.title} (${s.info.id}) · ${error}`);
140
+ return { net: "retrying" };
141
+ }
142
+ arm(s, ms) {
143
+ if (s.netTimer)
144
+ clearTimeout(s.netTimer);
145
+ s.netTimer = setTimeout(() => { s.netTimer = null; void this.fire(s); }, ms);
146
+ s.netTimer.unref?.();
147
+ }
148
+ recheckLater(s) {
149
+ if (s.netRecheck)
150
+ clearTimeout(s.netRecheck);
151
+ const stops = s.stopCount;
152
+ s.netRecheck = setTimeout(() => {
153
+ s.netRecheck = null;
154
+ // Only if nothing moved since: same turn end, no turn running, nothing scheduled.
155
+ if (s.stopCount !== stops || s.turnActive || s.info.netRetry?.state === "waiting")
156
+ return;
157
+ if (this.core.sessions.get(s.info.id) !== s || !s.info.running || !s.info.claudeSessionId)
158
+ return;
159
+ const v = readNetLog(transcriptPath(s.info.cwd, s.info.claudeSessionId));
160
+ let end = null;
161
+ if (freshGiveUp(v, s.info.turnStartedAt))
162
+ end = this.schedule(s, v.at, v.error);
163
+ else if (s.info.netRetry)
164
+ this.set(s, null); // the episode `turnEnded` kept: no give-up landed
165
+ // The answer to a `checking` turn end (and harmless after a plain one: the
166
+ // work waiting on it already settled, so there is nothing to apply it to).
167
+ this.core.emit("netTurnSettled", s.info.id, stops, end);
168
+ }, RECHECK_MS);
169
+ s.netRecheck.unref?.();
170
+ }
171
+ park(s, why, ms = PARK_MS) {
172
+ const n = s.info.netRetry;
173
+ this.arm(s, ms);
174
+ this.set(s, { ...n, nextAt: Date.now() + ms, why });
175
+ }
176
+ /** The rung is due: type `continue`, unless something says not to. */
177
+ async fire(s) {
178
+ const id = s.info.id;
179
+ const n = s.info.netRetry;
180
+ if (!n || n.state !== "waiting")
181
+ return;
182
+ if (this.core.sessions.get(id) !== s || !s.info.running) {
183
+ s.info.netRetry = null;
184
+ return;
185
+ }
186
+ const halted = hostHalt();
187
+ if (halted) {
188
+ this.set(s, { ...n, state: "gaveup", nextAt: null, why: "the emergency halt is on" });
189
+ // No turn end follows this one: tell the work waiting on the session now.
190
+ this.core.emit("netTurnSettled", id, s.stopCount, { net: "gaveup", detail: netGaveUpDetail(n.error, "because the emergency halt is on") });
191
+ return;
192
+ }
193
+ if (s.info.limit?.blocked) {
194
+ this.cancel(s, "a usage or spend wall is up");
195
+ return;
196
+ }
197
+ if (s.turnActive) {
198
+ this.cancel(s, "a turn is running");
199
+ return;
200
+ }
201
+ if (s.info.prompt || s.info.awaitingInput) {
202
+ this.park(s, "waiting for the open box to be answered");
203
+ return;
204
+ }
205
+ if (Date.now() - s.lastDataAt < QUIET_MS) {
206
+ this.park(s, "waiting for the screen to settle", 5000);
207
+ return;
208
+ }
209
+ const attempt = n.attempt + 1;
210
+ s.netSentAt = Date.now();
211
+ // Before the first byte: a person typing between the two writes cancels, and the Return is skipped.
212
+ this.set(s, { ...n, state: "sent", attempt, nextAt: null, why: undefined });
213
+ s.netWriting = true;
214
+ try {
215
+ this.core.write(id, "continue");
216
+ }
217
+ finally {
218
+ s.netWriting = false;
219
+ }
220
+ await new Promise((r) => setTimeout(r, 250));
221
+ if (this.core.sessions.get(id) !== s || !s.info.running || s.info.netRetry?.state !== "sent")
222
+ return;
223
+ s.netWriting = true;
224
+ try {
225
+ this.core.write(id, "\r");
226
+ }
227
+ finally {
228
+ s.netWriting = false;
229
+ }
230
+ this.core.recordPrompt(id, "continue (auto, network error)", "backlog");
231
+ // `written`, as the limit wall's: the Return is pressed blind, and the
232
+ // outcome is the next turn end's log row.
233
+ recordSent({
234
+ sessionId: id, actor: "auto", source: "netretry", kind: "prompt",
235
+ text: "continue", result: "written",
236
+ detail: `retry after a transient API error (${attempt}/${n.max}): ${n.error}`,
237
+ });
238
+ }
239
+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,MAAM;YAAE,OAAO;QACrG,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC;YAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAAC,CAAC;gBAAS,CAAC;YAAC,CAAC,CAAC,UAAU,GAAG,KAAK,CAAC;QAAC,CAAC;QACpE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,gCAAgC,EAAE,SAAS,CAAC,CAAC;QACxE,uEAAuE;QACvE,0CAA0C;QAC1C,UAAU,CAAC;YACT,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ;YAChE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS;YACnC,MAAM,EAAE,sCAAsC,OAAO,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,EAAE;SAC9E,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The prose question and the CLI's own proposal: whether a finished turn ended
3
+ * on a question to the person (`checkAsking`, `setAsking`, `ackAsking`), and
4
+ * the next prompt the CLI proposes (`checkCliSuggestion`), plus a plugin's
5
+ * suggestion (`setSuggestion`). Cut out of `turn.ts` by subject; stateless like
6
+ * it — every fact lives on the `Session`.
7
+ */
8
+ import type { SessionAsk } from "@waterplane/shared";
9
+ import type { Session, SessionCore } from "./core.js";
10
+ /**
11
+ * Did this turn end on a question to the person, asked in prose?
12
+ *
13
+ * Run on the turn-end transition, before the ping. Deliberately NOT a
14
+ * detector of "is the CLI blocked" — it is not; the composer is right there.
15
+ * It is a detector of WORK being blocked, which is the state the phone had no
16
+ * word for: a finished turn whose next step is a decision only the user can
17
+ * make. It used to be computed only when the Gemini oracle was on duty, so
18
+ * without an API key nothing ever asked the tail this question.
19
+ *
20
+ * A parsed `prompt` outranks it (that is the same question with buttons), and
21
+ * a limit-blocked session is not waiting on an answer, it is waiting on a
22
+ * clock.
23
+ */
24
+ export declare function checkAsking(core: SessionCore, s: Session): void;
25
+ /**
26
+ * Is the composer showing the CLI's own proposal for the next prompt?
27
+ * (`clisuggest.ts` holds the rule and the measurement.)
28
+ *
29
+ * Re-entered on every quiet repaint, like `checkAsking` — the proposal is a
30
+ * model call of the CLI's own and lands a moment AFTER the Stop, so one read on
31
+ * the transition would miss it. The plain grid is the cheap gate; the render
32
+ * with attributes is paid once per distinct composer text.
33
+ */
34
+ export declare function checkCliSuggestion(core: SessionCore, s: Session): void;
35
+ export declare function setCliSuggestion(core: SessionCore, s: Session, text: string | null): void;
36
+ /** Publish/retire the prose-question fact, on a CHANGE of wording only. */
37
+ export declare function setAsking(core: SessionCore, s: Session, ask: SessionAsk | null): void;
38
+ /**
39
+ * "I have dealt with that" — retire the prose-question badge without typing.
40
+ *
41
+ * The only two things that retire `asking` on their own are a turn starting
42
+ * and a keystroke, both of which mean the question was answered HERE. A
43
+ * question answered anywhere else — the change committed at the desk, the
44
+ * decision taken and no longer worth a reply — has neither, so the badge, the
45
+ * waiting count and the push stood over a decision already made.
46
+ *
47
+ * `text` is checked for the reason `expectPrompt` exists: the tap happened
48
+ * against a badge that may since have been replaced by a different question,
49
+ * and silencing THAT one is the failure this guard is here to prevent. A
50
+ * client that cannot say (absent) acknowledges whatever is standing.
51
+ *
52
+ * Types nothing, runs nothing, and is not remembered past the next turn.
53
+ */
54
+ export declare function ackAsking(core: SessionCore, id: string, text?: string): void;
55
+ /**
56
+ * Attach a plugin's suggestion to a session. A numbered-CHOICE suggestion is
57
+ * tied to a live prompt, so it's dropped if the prompt already changed (stale)
58
+ * — we never show a choice for a gone prompt. A free-text REPLY suggestion
59
+ * (choice == null) has no prompt to bind to, so it's always allowed; this is
60
+ * what surfaces the turn-end reply bar.
61
+ */
62
+ export declare function setSuggestion(core: SessionCore, id: string, s: import("@waterplane/shared").AnswerSuggestion | null): void;
@@ -0,0 +1,169 @@
1
+ import { derive } from "../backends/derive.js";
2
+ import { stripAnsi } from "../prompt.js";
3
+ import { askLine, looksLikeQuestion, sameAsk } from "../question.js";
4
+ import { cliSuggestionOf, composerPlain } from "../clisuggest.js";
5
+ import { QUESTION_TAIL_BYTES } from "./knobs.js";
6
+ /**
7
+ * Did this turn end on a question to the person, asked in prose?
8
+ *
9
+ * Run on the turn-end transition, before the ping. Deliberately NOT a
10
+ * detector of "is the CLI blocked" — it is not; the composer is right there.
11
+ * It is a detector of WORK being blocked, which is the state the phone had no
12
+ * word for: a finished turn whose next step is a decision only the user can
13
+ * make. It used to be computed only when the Gemini oracle was on duty, so
14
+ * without an API key nothing ever asked the tail this question.
15
+ *
16
+ * A parsed `prompt` outranks it (that is the same question with buttons), and
17
+ * a limit-blocked session is not waiting on an answer, it is waiting on a
18
+ * clock.
19
+ */
20
+ export function checkAsking(core, s) {
21
+ // "Did the turn end on a question with no box" is a rule about how THIS CLI
22
+ // signs off a turn. A backend it was not written against records nothing:
23
+ // `SessionInfo.asking` stays absent, and the phone's "asked you" badge can
24
+ // never be raised by a paragraph that merely ends in a question mark.
25
+ if (derive(s.backend).screen("asking") !== "question-ts") {
26
+ setAsking(core, s, null);
27
+ return;
28
+ }
29
+ if (s.info.prompt || s.info.limit?.blocked) {
30
+ setAsking(core, s, null);
31
+ return;
32
+ }
33
+ // A turn still IN FLIGHT is not a turn that ended on a question. The
34
+ // silence timer re-enters `markIdle` four seconds after any output, so on a
35
+ // hooked session a long quiet tool run would otherwise read the agent's
36
+ // mid-turn "should I also…?" as a handover and badge a working session
37
+ // "asked you" until someone typed. Only a turn that is over may raise it;
38
+ // by this point `markIdle`/the Stop hook have already cleared the flag for
39
+ // the sessions that legitimately finished.
40
+ if (s.turnActive)
41
+ return;
42
+ // The rendered grid, not the byte tail: the CLI lays words out with cursor
43
+ // moves, and the stripped bytes read "TheUIisstillwronghere" on the card.
44
+ const tail = s.screenLog?.gridText() || stripAnsi(s.scrollback.slice(-QUESTION_TAIL_BYTES));
45
+ if (!looksLikeQuestion(tail)) {
46
+ setAsking(core, s, null);
47
+ return;
48
+ }
49
+ const text = askLine(tail);
50
+ if (!text) {
51
+ setAsking(core, s, null);
52
+ return;
53
+ }
54
+ // Already dealt with — outside this session, which is the only place it
55
+ // COULD have been dealt with without a turn starting. The tail still ends
56
+ // on the question and always will, so without this the badge re-raises on
57
+ // the next repaint and the acknowledgement lasts about a second.
58
+ const d = s.askDismissed;
59
+ if (d && ((s.hooksActive && d.stop === s.stopCount) || sameAsk(text, d.text))) {
60
+ setAsking(core, s, null);
61
+ return;
62
+ }
63
+ // Keep the original `at`: idle re-enters here on every repaint, and a
64
+ // question whose clock restarted twice a second would read "asked 0s ago"
65
+ // for as long as it went unanswered.
66
+ setAsking(core, s, { text, at: s.info.asking?.at ?? Date.now() });
67
+ }
68
+ /**
69
+ * Is the composer showing the CLI's own proposal for the next prompt?
70
+ * (`clisuggest.ts` holds the rule and the measurement.)
71
+ *
72
+ * Re-entered on every quiet repaint, like `checkAsking` — the proposal is a
73
+ * model call of the CLI's own and lands a moment AFTER the Stop, so one read on
74
+ * the transition would miss it. The plain grid is the cheap gate; the render
75
+ * with attributes is paid once per distinct composer text.
76
+ */
77
+ export function checkCliSuggestion(core, s) {
78
+ // Measured on claude's TUI only (`clisuggest.ts`); another TUI's dim hint is a placeholder. The
79
+ // claude TUI is the one whose dialogs `prompt.ts` reads — so every backend that runs it.
80
+ if (derive(s.backend).screen("dialogs") !== "claude-numbered" || s.turnActive || s.info.prompt || s.info.limit?.blocked) {
81
+ s.hintRead = null;
82
+ setCliSuggestion(core, s, null);
83
+ return;
84
+ }
85
+ const grid = s.screenLog?.gridText();
86
+ if (!grid)
87
+ return;
88
+ const rows = grid.split("\n");
89
+ const plain = composerPlain(rows);
90
+ if (!plain) {
91
+ s.hintRead = null;
92
+ setCliSuggestion(core, s, null);
93
+ return;
94
+ }
95
+ if (plain === s.hintRead)
96
+ return;
97
+ s.hintRead = plain;
98
+ void core.screenCells(s.info.id, rows.length).then((cells) => {
99
+ if (s.hintRead !== plain || s.turnActive)
100
+ return; // the screen moved on while this rendered
101
+ setCliSuggestion(core, s, cliSuggestionOf(rows, cells.map((r) => r.undimmed)));
102
+ }).catch(() => { });
103
+ }
104
+ export function setCliSuggestion(core, s, text) {
105
+ if ((s.info.cliSuggestion ?? null) === text)
106
+ return;
107
+ s.info.cliSuggestion = text;
108
+ core.emit("updated", s.info);
109
+ }
110
+ /** Publish/retire the prose-question fact, on a CHANGE of wording only. */
111
+ export function setAsking(core, s, ask) {
112
+ const had = s.info.asking?.text ?? null;
113
+ if ((ask?.text ?? null) === had)
114
+ return;
115
+ s.info.asking = ask;
116
+ core.emit("updated", s.info);
117
+ }
118
+ /**
119
+ * "I have dealt with that" — retire the prose-question badge without typing.
120
+ *
121
+ * The only two things that retire `asking` on their own are a turn starting
122
+ * and a keystroke, both of which mean the question was answered HERE. A
123
+ * question answered anywhere else — the change committed at the desk, the
124
+ * decision taken and no longer worth a reply — has neither, so the badge, the
125
+ * waiting count and the push stood over a decision already made.
126
+ *
127
+ * `text` is checked for the reason `expectPrompt` exists: the tap happened
128
+ * against a badge that may since have been replaced by a different question,
129
+ * and silencing THAT one is the failure this guard is here to prevent. A
130
+ * client that cannot say (absent) acknowledges whatever is standing.
131
+ *
132
+ * Types nothing, runs nothing, and is not remembered past the next turn.
133
+ */
134
+ export function ackAsking(core, id, text) {
135
+ const s = core.sessions.get(id);
136
+ if (!s?.info.asking)
137
+ return;
138
+ const cur = s.info.asking.text;
139
+ if (text != null && !sameAsk(text, cur))
140
+ return;
141
+ s.askDismissed = { text: cur, stop: s.stopCount };
142
+ s.info.asking = null;
143
+ persistAsk(core, s);
144
+ core.emit("updated", s.info);
145
+ }
146
+ /** Rewrite the `live/` record so "handled" survives a restart — `persistLive`
147
+ * takes `askDismissed` off the live session. */
148
+ function persistAsk(core, s) {
149
+ const m = core.loadLive(s.info.id);
150
+ if (m)
151
+ core.persistLive(m);
152
+ }
153
+ /**
154
+ * Attach a plugin's suggestion to a session. A numbered-CHOICE suggestion is
155
+ * tied to a live prompt, so it's dropped if the prompt already changed (stale)
156
+ * — we never show a choice for a gone prompt. A free-text REPLY suggestion
157
+ * (choice == null) has no prompt to bind to, so it's always allowed; this is
158
+ * what surfaces the turn-end reply bar.
159
+ */
160
+ export function setSuggestion(core, id, s) {
161
+ const sess = core.sessions.get(id);
162
+ if (!sess)
163
+ return;
164
+ if (s && s.choice != null && !sess.info.prompt)
165
+ return; // stale numbered choice
166
+ sess.info.suggestion = s;
167
+ core.emit("updated", sess.info);
168
+ }
169
+ //# sourceMappingURL=askwatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askwatch.js","sourceRoot":"","sources":["../../src/sessions/askwatch.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW,CAAC,IAAiB,EAAE,CAAU;IACvD,4EAA4E;IAC5E,0EAA0E;IAC1E,2EAA2E;IAC3E,sEAAsE;IACtE,IAAI,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,aAAa,EAAE,CAAC;QAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAAC,OAAO;IAAC,CAAC;IAC/F,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;QAAC,SAAS,CAAC,IAAI,EAAE,CAAC,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,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;QAAE,OAAO;IAChD,CAAC,CAAC,YAAY,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;IAClD,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED;iDACiD;AACjD,SAAS,UAAU,CAAC,IAAiB,EAAE,CAAU;IAC/C,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnC,IAAI,CAAC;QAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAiB,EAAE,EAAU,EAAE,CAAuD;IAClH,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI;QAAE,OAAO;IAClB,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,wBAAwB;IAChF,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;IACzB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC"}
@@ -1,20 +1,4 @@
1
- /**
2
- * The choice box: when to look for one, reading it off the rendered screen
3
- * (claude's numbered box and opencode's highlighted row), publishing it, the
4
- * "unparsable dialog" fallback flag, the sign-in link that rides on the same
5
- * render, and the two answer walks that place a selection before pressing
6
- * Return. Stateless — every per-session fact lives on the `Session` record.
7
- * Reasoning: `waterplane-heuristics` (`prompt.ts`, `ocprompt.ts`, `askbox.ts`,
8
- * `login.ts`) and docs/notes/host-architecture.md.
9
- */
10
- import { type DetectedPrompt } from "@waterplane/shared";
11
- export { sourceKeysProblem } from "../sourceanswer.js";
12
- import type { Session, SessionCore } from "./core.js";
13
- export declare function scheduleChecks(core: SessionCore, s: Session): void;
14
- /** Arm the prompt check, EARLIEST-wins: a later caller may pull the check
15
- * forward but never push a pending one back (that is what made the debounce
16
- * starve under constant output). */
17
- export declare function armPromptCheck(core: SessionCore, s: Session, delayMs: number): void;
1
+ import type { SessionCore } from "./core.js";
18
2
  /**
19
3
  * Answer an unnumbered box by placing the selection on the option the user
20
4
  * named, and only then pressing Return.
@@ -39,9 +23,6 @@ export declare function choosePromptBox(core: SessionCore, id: string, choice: n
39
23
  ok: boolean;
40
24
  reason?: string;
41
25
  }>;
42
- /** Is the published box the side channel's, or is the channel reconciled and
43
- * owning every box? Either way the screen has nothing to add. */
44
- export declare function screenReaderOff(s: Session): boolean;
45
26
  /**
46
27
  * **The one answer dispatcher** — every answer to a choice box goes through
47
28
  * here: the phone's tap (`routes/session.ts`, a digit, a `promptChoice`, typed
@@ -80,9 +61,6 @@ export declare function answerBox(core: SessionCore, id: string, choice: number,
80
61
  ok: boolean;
81
62
  reason?: string;
82
63
  }>;
83
- /** Publish the "unparsable dialog on screen" fallback flag. */
84
- export declare function setAwaiting(core: SessionCore, s: Session, on: boolean, screen?: string): void;
85
- export declare function applyPrompt(core: SessionCore, s: Session, prompt: DetectedPrompt | null): void;
86
64
  /**
87
65
  * Press Return on a checkbox box's **Submit row**, walking the selection
88
66
  * cursor there first.
@@ -110,3 +88,4 @@ export declare function submitPromptBox(core: SessionCore, id: string): Promise<
110
88
  ok: boolean;
111
89
  placed: boolean;
112
90
  }>;
91
+ export { sourceKeysProblem } from "../sourceanswer.js";