@openagt/dashboard 0.0.0-stage → 0.9.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 (610) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -2
  3. package/dist/agent-id.d.ts +13 -0
  4. package/dist/agent-id.d.ts.map +1 -0
  5. package/dist/agent-id.js +20 -0
  6. package/dist/agent-id.js.map +1 -0
  7. package/dist/agent-locks.d.ts +3 -0
  8. package/dist/agent-locks.d.ts.map +1 -0
  9. package/dist/agent-locks.js +40 -0
  10. package/dist/agent-locks.js.map +1 -0
  11. package/dist/agent-view.d.ts +39 -0
  12. package/dist/agent-view.d.ts.map +1 -0
  13. package/dist/agent-view.js +45 -0
  14. package/dist/agent-view.js.map +1 -0
  15. package/dist/bin.d.ts +3 -0
  16. package/dist/bin.d.ts.map +1 -0
  17. package/dist/bin.js +11 -0
  18. package/dist/bin.js.map +1 -0
  19. package/dist/branch-name.d.ts +8 -0
  20. package/dist/branch-name.d.ts.map +1 -0
  21. package/dist/branch-name.js +20 -0
  22. package/dist/branch-name.js.map +1 -0
  23. package/dist/bridge-browser.d.ts +217 -0
  24. package/dist/bridge-browser.d.ts.map +1 -0
  25. package/dist/bridge-browser.js +520 -0
  26. package/dist/bridge-browser.js.map +1 -0
  27. package/dist/browser-stream.d.ts +20 -0
  28. package/dist/browser-stream.d.ts.map +1 -0
  29. package/dist/browser-stream.js +51 -0
  30. package/dist/browser-stream.js.map +1 -0
  31. package/dist/browser.d.ts +16 -0
  32. package/dist/browser.d.ts.map +1 -0
  33. package/dist/browser.js +38 -0
  34. package/dist/browser.js.map +1 -0
  35. package/dist/built-in.d.ts +38 -0
  36. package/dist/built-in.d.ts.map +1 -0
  37. package/dist/built-in.js +119 -0
  38. package/dist/built-in.js.map +1 -0
  39. package/dist/chrome-extension/background.js +532 -0
  40. package/dist/chrome-extension/content.js +1475 -0
  41. package/dist/chrome-extension/driver-plan.js +41 -0
  42. package/dist/chrome-extension/fingerprint.js +43 -0
  43. package/dist/chrome-extension/manifest.json +31 -0
  44. package/dist/chrome-extension/options.html +48 -0
  45. package/dist/chrome-extension/options.js +122 -0
  46. package/dist/cli.d.ts +43 -0
  47. package/dist/cli.d.ts.map +1 -0
  48. package/dist/cli.js +186 -0
  49. package/dist/cli.js.map +1 -0
  50. package/dist/client.d.ts +16 -0
  51. package/dist/client.d.ts.map +1 -0
  52. package/dist/client.js +30 -0
  53. package/dist/client.js.map +1 -0
  54. package/dist/cloud-run-state.d.ts +27 -0
  55. package/dist/cloud-run-state.d.ts.map +1 -0
  56. package/dist/cloud-run-state.js +36 -0
  57. package/dist/cloud-run-state.js.map +1 -0
  58. package/dist/cloud-scratch-refs.d.ts +85 -0
  59. package/dist/cloud-scratch-refs.d.ts.map +1 -0
  60. package/dist/cloud-scratch-refs.js +275 -0
  61. package/dist/cloud-scratch-refs.js.map +1 -0
  62. package/dist/cloud-work.d.ts +66 -0
  63. package/dist/cloud-work.d.ts.map +1 -0
  64. package/dist/cloud-work.js +204 -0
  65. package/dist/cloud-work.js.map +1 -0
  66. package/dist/daemon-runtime.d.ts +42 -0
  67. package/dist/daemon-runtime.d.ts.map +1 -0
  68. package/dist/daemon-runtime.js +183 -0
  69. package/dist/daemon-runtime.js.map +1 -0
  70. package/dist/daemon-services.d.ts +37 -0
  71. package/dist/daemon-services.d.ts.map +1 -0
  72. package/dist/daemon-services.js +126 -0
  73. package/dist/daemon-services.js.map +1 -0
  74. package/dist/daemon-tick.d.ts +68 -0
  75. package/dist/daemon-tick.d.ts.map +1 -0
  76. package/dist/daemon-tick.js +97 -0
  77. package/dist/daemon-tick.js.map +1 -0
  78. package/dist/daemon.d.ts +65 -0
  79. package/dist/daemon.d.ts.map +1 -0
  80. package/dist/daemon.js +202 -0
  81. package/dist/daemon.js.map +1 -0
  82. package/dist/dashboard/activity.d.ts +41 -0
  83. package/dist/dashboard/activity.d.ts.map +1 -0
  84. package/dist/dashboard/activity.js +56 -0
  85. package/dist/dashboard/activity.js.map +1 -0
  86. package/dist/dashboard/agent-handoff.d.ts +244 -0
  87. package/dist/dashboard/agent-handoff.d.ts.map +1 -0
  88. package/dist/dashboard/agent-handoff.js +310 -0
  89. package/dist/dashboard/agent-handoff.js.map +1 -0
  90. package/dist/dashboard/bridge-endpoints.d.ts +158 -0
  91. package/dist/dashboard/bridge-endpoints.d.ts.map +1 -0
  92. package/dist/dashboard/bridge-endpoints.js +382 -0
  93. package/dist/dashboard/bridge-endpoints.js.map +1 -0
  94. package/dist/dashboard/bridge-question.d.ts +33 -0
  95. package/dist/dashboard/bridge-question.d.ts.map +1 -0
  96. package/dist/dashboard/bridge-question.js +20 -0
  97. package/dist/dashboard/bridge-question.js.map +1 -0
  98. package/dist/dashboard/bridge-sessions.d.ts +25 -0
  99. package/dist/dashboard/bridge-sessions.d.ts.map +1 -0
  100. package/dist/dashboard/bridge-sessions.js +46 -0
  101. package/dist/dashboard/bridge-sessions.js.map +1 -0
  102. package/dist/dashboard/bridge-starts.d.ts +61 -0
  103. package/dist/dashboard/bridge-starts.d.ts.map +1 -0
  104. package/dist/dashboard/bridge-starts.js +94 -0
  105. package/dist/dashboard/bridge-starts.js.map +1 -0
  106. package/dist/dashboard/bridge-store.d.ts +179 -0
  107. package/dist/dashboard/bridge-store.d.ts.map +1 -0
  108. package/dist/dashboard/bridge-store.js +262 -0
  109. package/dist/dashboard/bridge-store.js.map +1 -0
  110. package/dist/dashboard/bundle.d.ts +12 -0
  111. package/dist/dashboard/bundle.d.ts.map +1 -0
  112. package/dist/dashboard/bundle.js +22 -0
  113. package/dist/dashboard/bundle.js.map +1 -0
  114. package/dist/dashboard/cache.d.ts +47 -0
  115. package/dist/dashboard/cache.d.ts.map +1 -0
  116. package/dist/dashboard/cache.js +87 -0
  117. package/dist/dashboard/cache.js.map +1 -0
  118. package/dist/dashboard/content-type.d.ts +3 -0
  119. package/dist/dashboard/content-type.d.ts.map +1 -0
  120. package/dist/dashboard/content-type.js +31 -0
  121. package/dist/dashboard/content-type.js.map +1 -0
  122. package/dist/dashboard/dashboard.d.ts +38 -0
  123. package/dist/dashboard/dashboard.d.ts.map +1 -0
  124. package/dist/dashboard/dashboard.js +42 -0
  125. package/dist/dashboard/dashboard.js.map +1 -0
  126. package/dist/dashboard/docs.d.ts +39 -0
  127. package/dist/dashboard/docs.d.ts.map +1 -0
  128. package/dist/dashboard/docs.js +59 -0
  129. package/dist/dashboard/docs.js.map +1 -0
  130. package/dist/dashboard/git-status.d.ts +44 -0
  131. package/dist/dashboard/git-status.d.ts.map +1 -0
  132. package/dist/dashboard/git-status.js +37 -0
  133. package/dist/dashboard/git-status.js.map +1 -0
  134. package/dist/dashboard/http.d.ts +29 -0
  135. package/dist/dashboard/http.d.ts.map +1 -0
  136. package/dist/dashboard/http.js +74 -0
  137. package/dist/dashboard/http.js.map +1 -0
  138. package/dist/dashboard/index.d.ts +24 -0
  139. package/dist/dashboard/index.d.ts.map +1 -0
  140. package/dist/dashboard/index.js +23 -0
  141. package/dist/dashboard/index.js.map +1 -0
  142. package/dist/dashboard/interventions.d.ts +67 -0
  143. package/dist/dashboard/interventions.d.ts.map +1 -0
  144. package/dist/dashboard/interventions.js +169 -0
  145. package/dist/dashboard/interventions.js.map +1 -0
  146. package/dist/dashboard/keyed-watcher.d.ts +29 -0
  147. package/dist/dashboard/keyed-watcher.d.ts.map +1 -0
  148. package/dist/dashboard/keyed-watcher.js +42 -0
  149. package/dist/dashboard/keyed-watcher.js.map +1 -0
  150. package/dist/dashboard/keys.d.ts +31 -0
  151. package/dist/dashboard/keys.d.ts.map +1 -0
  152. package/dist/dashboard/keys.js +37 -0
  153. package/dist/dashboard/keys.js.map +1 -0
  154. package/dist/dashboard/models.d.ts +25 -0
  155. package/dist/dashboard/models.d.ts.map +1 -0
  156. package/dist/dashboard/models.js +30 -0
  157. package/dist/dashboard/models.js.map +1 -0
  158. package/dist/dashboard/module-host.d.ts +44 -0
  159. package/dist/dashboard/module-host.d.ts.map +1 -0
  160. package/dist/dashboard/module-host.js +91 -0
  161. package/dist/dashboard/module-host.js.map +1 -0
  162. package/dist/dashboard/module-serve.d.ts +15 -0
  163. package/dist/dashboard/module-serve.d.ts.map +1 -0
  164. package/dist/dashboard/module-serve.js +45 -0
  165. package/dist/dashboard/module-serve.js.map +1 -0
  166. package/dist/dashboard/open-in-app.d.ts +43 -0
  167. package/dist/dashboard/open-in-app.d.ts.map +1 -0
  168. package/dist/dashboard/open-in-app.js +98 -0
  169. package/dist/dashboard/open-in-app.js.map +1 -0
  170. package/dist/dashboard/open-questions.d.ts +45 -0
  171. package/dist/dashboard/open-questions.d.ts.map +1 -0
  172. package/dist/dashboard/open-questions.js +62 -0
  173. package/dist/dashboard/open-questions.js.map +1 -0
  174. package/dist/dashboard/overview.d.ts +78 -0
  175. package/dist/dashboard/overview.d.ts.map +1 -0
  176. package/dist/dashboard/overview.js +87 -0
  177. package/dist/dashboard/overview.js.map +1 -0
  178. package/dist/dashboard/projects.d.ts +101 -0
  179. package/dist/dashboard/projects.d.ts.map +1 -0
  180. package/dist/dashboard/projects.js +63 -0
  181. package/dist/dashboard/projects.js.map +1 -0
  182. package/dist/dashboard/pull-requests.d.ts +127 -0
  183. package/dist/dashboard/pull-requests.d.ts.map +1 -0
  184. package/dist/dashboard/pull-requests.js +137 -0
  185. package/dist/dashboard/pull-requests.js.map +1 -0
  186. package/dist/dashboard/queue.d.ts +17 -0
  187. package/dist/dashboard/queue.d.ts.map +1 -0
  188. package/dist/dashboard/queue.js +19 -0
  189. package/dist/dashboard/queue.js.map +1 -0
  190. package/dist/dashboard/quota.d.ts +53 -0
  191. package/dist/dashboard/quota.d.ts.map +1 -0
  192. package/dist/dashboard/quota.js +42 -0
  193. package/dist/dashboard/quota.js.map +1 -0
  194. package/dist/dashboard/relay-endpoints.d.ts +32 -0
  195. package/dist/dashboard/relay-endpoints.d.ts.map +1 -0
  196. package/dist/dashboard/relay-endpoints.js +115 -0
  197. package/dist/dashboard/relay-endpoints.js.map +1 -0
  198. package/dist/dashboard/remote-run.d.ts +95 -0
  199. package/dist/dashboard/remote-run.d.ts.map +1 -0
  200. package/dist/dashboard/remote-run.js +235 -0
  201. package/dist/dashboard/remote-run.js.map +1 -0
  202. package/dist/dashboard/rpc-serve.d.ts +106 -0
  203. package/dist/dashboard/rpc-serve.d.ts.map +1 -0
  204. package/dist/dashboard/rpc-serve.js +180 -0
  205. package/dist/dashboard/rpc-serve.js.map +1 -0
  206. package/dist/dashboard/run-inbox.d.ts +31 -0
  207. package/dist/dashboard/run-inbox.d.ts.map +1 -0
  208. package/dist/dashboard/run-inbox.js +51 -0
  209. package/dist/dashboard/run-inbox.js.map +1 -0
  210. package/dist/dashboard/server.d.ts +105 -0
  211. package/dist/dashboard/server.d.ts.map +1 -0
  212. package/dist/dashboard/server.js +231 -0
  213. package/dist/dashboard/server.js.map +1 -0
  214. package/dist/dashboard/static.d.ts +9 -0
  215. package/dist/dashboard/static.d.ts.map +1 -0
  216. package/dist/dashboard/static.js +54 -0
  217. package/dist/dashboard/static.js.map +1 -0
  218. package/dist/dashboard/types.d.ts +135 -0
  219. package/dist/dashboard/types.d.ts.map +1 -0
  220. package/dist/dashboard/types.js +2 -0
  221. package/dist/dashboard/types.js.map +1 -0
  222. package/dist/dashboard/web-start-endpoints.d.ts +32 -0
  223. package/dist/dashboard/web-start-endpoints.d.ts.map +1 -0
  224. package/dist/dashboard/web-start-endpoints.js +75 -0
  225. package/dist/dashboard/web-start-endpoints.js.map +1 -0
  226. package/dist/dashboard-bundle/assets/client-CbBRB9m4.js +9 -0
  227. package/dist/dashboard-bundle/assets/jsx-runtime-By8HlURe.js +1 -0
  228. package/dist/dashboard-bundle/assets/main-B98UOA3_.js +140 -0
  229. package/dist/dashboard-bundle/assets/main-ByRjbCiA.css +2 -0
  230. package/dist/dashboard-bundle/assets/module-v213KWfH.js +21 -0
  231. package/dist/dashboard-bundle/assets/react-CZI7_Jkm.js +1 -0
  232. package/dist/dashboard-bundle/assets/react-dom-cJyBB_A4.js +1 -0
  233. package/dist/dashboard-bundle/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  234. package/dist/dashboard-bundle/host/module.js +1 -0
  235. package/dist/dashboard-bundle/host/react-dom-client.js +1 -0
  236. package/dist/dashboard-bundle/host/react-dom.js +1 -0
  237. package/dist/dashboard-bundle/host/react-jsx-runtime.js +1 -0
  238. package/dist/dashboard-bundle/host/react.js +1 -0
  239. package/dist/dashboard-bundle/index.html +42 -0
  240. package/dist/dashboard-bundle/logo-animated.svg +34 -0
  241. package/dist/dashboard-bundle/logo.svg +16 -0
  242. package/dist/dashboard-rpc/context.d.ts +56 -0
  243. package/dist/dashboard-rpc/context.d.ts.map +1 -0
  244. package/dist/dashboard-rpc/context.js +106 -0
  245. package/dist/dashboard-rpc/context.js.map +1 -0
  246. package/dist/dashboard-rpc/control.d.ts +124 -0
  247. package/dist/dashboard-rpc/control.d.ts.map +1 -0
  248. package/dist/dashboard-rpc/control.js +284 -0
  249. package/dist/dashboard-rpc/control.js.map +1 -0
  250. package/dist/dashboard-rpc/devices.d.ts +9 -0
  251. package/dist/dashboard-rpc/devices.d.ts.map +1 -0
  252. package/dist/dashboard-rpc/devices.js +12 -0
  253. package/dist/dashboard-rpc/devices.js.map +1 -0
  254. package/dist/dashboard-rpc/events-tail.d.ts +68 -0
  255. package/dist/dashboard-rpc/events-tail.d.ts.map +1 -0
  256. package/dist/dashboard-rpc/events-tail.js +257 -0
  257. package/dist/dashboard-rpc/events-tail.js.map +1 -0
  258. package/dist/dashboard-rpc/events.d.ts +39 -0
  259. package/dist/dashboard-rpc/events.d.ts.map +1 -0
  260. package/dist/dashboard-rpc/events.js +47 -0
  261. package/dist/dashboard-rpc/events.js.map +1 -0
  262. package/dist/dashboard-rpc/index.d.ts +29 -0
  263. package/dist/dashboard-rpc/index.d.ts.map +1 -0
  264. package/dist/dashboard-rpc/index.js +40 -0
  265. package/dist/dashboard-rpc/index.js.map +1 -0
  266. package/dist/dashboard-rpc/models.d.ts +4 -0
  267. package/dist/dashboard-rpc/models.d.ts.map +1 -0
  268. package/dist/dashboard-rpc/models.js +8 -0
  269. package/dist/dashboard-rpc/models.js.map +1 -0
  270. package/dist/dashboard-rpc/modules.d.ts +45 -0
  271. package/dist/dashboard-rpc/modules.d.ts.map +1 -0
  272. package/dist/dashboard-rpc/modules.js +79 -0
  273. package/dist/dashboard-rpc/modules.js.map +1 -0
  274. package/dist/dashboard-rpc/preferences.d.ts +41 -0
  275. package/dist/dashboard-rpc/preferences.d.ts.map +1 -0
  276. package/dist/dashboard-rpc/preferences.js +65 -0
  277. package/dist/dashboard-rpc/preferences.js.map +1 -0
  278. package/dist/dashboard-rpc/projects.d.ts +85 -0
  279. package/dist/dashboard-rpc/projects.d.ts.map +1 -0
  280. package/dist/dashboard-rpc/projects.js +129 -0
  281. package/dist/dashboard-rpc/projects.js.map +1 -0
  282. package/dist/dashboard-rpc/quota.d.ts +4 -0
  283. package/dist/dashboard-rpc/quota.d.ts.map +1 -0
  284. package/dist/dashboard-rpc/quota.js +15 -0
  285. package/dist/dashboard-rpc/quota.js.map +1 -0
  286. package/dist/dashboard-rpc/reads.d.ts +185 -0
  287. package/dist/dashboard-rpc/reads.d.ts.map +1 -0
  288. package/dist/dashboard-rpc/reads.js +370 -0
  289. package/dist/dashboard-rpc/reads.js.map +1 -0
  290. package/dist/dashboard-rpc/relay-agent.d.ts +9 -0
  291. package/dist/dashboard-rpc/relay-agent.d.ts.map +1 -0
  292. package/dist/dashboard-rpc/relay-agent.js +21 -0
  293. package/dist/dashboard-rpc/relay-agent.js.map +1 -0
  294. package/dist/dashboard-rpc/relay-dispatch.d.ts +9 -0
  295. package/dist/dashboard-rpc/relay-dispatch.d.ts.map +1 -0
  296. package/dist/dashboard-rpc/relay-dispatch.js +24 -0
  297. package/dist/dashboard-rpc/relay-dispatch.js.map +1 -0
  298. package/dist/dashboard-rpc/stream-forward.d.ts +17 -0
  299. package/dist/dashboard-rpc/stream-forward.d.ts.map +1 -0
  300. package/dist/dashboard-rpc/stream-forward.js +38 -0
  301. package/dist/dashboard-rpc/stream-forward.js.map +1 -0
  302. package/dist/dashboard-rpc/test-context.d.ts +23 -0
  303. package/dist/dashboard-rpc/test-context.d.ts.map +1 -0
  304. package/dist/dashboard-rpc/test-context.js +43 -0
  305. package/dist/dashboard-rpc/test-context.js.map +1 -0
  306. package/dist/driver-names.d.ts +22 -0
  307. package/dist/driver-names.d.ts.map +1 -0
  308. package/dist/driver-names.js +29 -0
  309. package/dist/driver-names.js.map +1 -0
  310. package/dist/error-message.d.ts +8 -0
  311. package/dist/error-message.d.ts.map +1 -0
  312. package/dist/error-message.js +10 -0
  313. package/dist/error-message.js.map +1 -0
  314. package/dist/event-stream.d.ts +33 -0
  315. package/dist/event-stream.d.ts.map +1 -0
  316. package/dist/event-stream.js +104 -0
  317. package/dist/event-stream.js.map +1 -0
  318. package/dist/events.d.ts +236 -0
  319. package/dist/events.d.ts.map +1 -0
  320. package/dist/events.js +5 -0
  321. package/dist/events.js.map +1 -0
  322. package/dist/format-bytes.d.ts +3 -0
  323. package/dist/format-bytes.d.ts.map +1 -0
  324. package/dist/format-bytes.js +18 -0
  325. package/dist/format-bytes.js.map +1 -0
  326. package/dist/has-remote.d.ts +8 -0
  327. package/dist/has-remote.d.ts.map +1 -0
  328. package/dist/has-remote.js +10 -0
  329. package/dist/has-remote.js.map +1 -0
  330. package/dist/index.d.ts +42 -0
  331. package/dist/index.d.ts.map +1 -0
  332. package/dist/index.js +16 -0
  333. package/dist/index.js.map +1 -0
  334. package/dist/install.d.ts +31 -0
  335. package/dist/install.d.ts.map +1 -0
  336. package/dist/install.js +54 -0
  337. package/dist/install.js.map +1 -0
  338. package/dist/jsonl-tail.d.ts +59 -0
  339. package/dist/jsonl-tail.d.ts.map +1 -0
  340. package/dist/jsonl-tail.js +152 -0
  341. package/dist/jsonl-tail.js.map +1 -0
  342. package/dist/loopback-host.d.ts +20 -0
  343. package/dist/loopback-host.d.ts.map +1 -0
  344. package/dist/loopback-host.js +31 -0
  345. package/dist/loopback-host.js.map +1 -0
  346. package/dist/module-server.d.ts +56 -0
  347. package/dist/module-types/dashboard/components/DiffStat.d.ts +6 -0
  348. package/dist/module-types/dashboard/components/DriverModelMenu.d.ts +23 -0
  349. package/dist/module-types/dashboard/components/LinkActions.d.ts +26 -0
  350. package/dist/module-types/dashboard/components/Markdown.d.ts +4 -0
  351. package/dist/module-types/dashboard/components/SettingsRows.d.ts +37 -0
  352. package/dist/module-types/dashboard/components/StartAgentButton.d.ts +39 -0
  353. package/dist/module-types/dashboard/components/ui/badge.d.ts +2 -0
  354. package/dist/module-types/dashboard/components/ui/button.d.ts +10 -0
  355. package/dist/module-types/dashboard/components/ui/card.d.ts +5 -0
  356. package/dist/module-types/dashboard/components/ui/checkbox.d.ts +7 -0
  357. package/dist/module-types/dashboard/components/ui/dropdown-menu.d.ts +16 -0
  358. package/dist/module-types/dashboard/components/ui/input.d.ts +2 -0
  359. package/dist/module-types/dashboard/components/ui/option-label.d.ts +4 -0
  360. package/dist/module-types/dashboard/components/ui/popover.d.ts +8 -0
  361. package/dist/module-types/dashboard/components/ui/scroll-area.d.ts +10 -0
  362. package/dist/module-types/dashboard/components/ui/separator.d.ts +3 -0
  363. package/dist/module-types/dashboard/components/ui/skeleton.d.ts +2 -0
  364. package/dist/module-types/dashboard/components/ui/slider.d.ts +9 -0
  365. package/dist/module-types/dashboard/components/ui/tooltip.d.ts +11 -0
  366. package/dist/module-types/dashboard/lib/agent-settings.d.ts +2 -0
  367. package/dist/module-types/dashboard/lib/draft-handoff.d.ts +15 -0
  368. package/dist/module-types/dashboard/lib/format-date.d.ts +51 -0
  369. package/dist/module-types/dashboard/lib/host-services.d.ts +12 -0
  370. package/dist/module-types/dashboard/lib/models.d.ts +24 -0
  371. package/dist/module-types/dashboard/lib/route.d.ts +38 -0
  372. package/dist/module-types/dashboard/lib/rpc.d.ts +31 -0
  373. package/dist/module-types/dashboard/lib/use-action.d.ts +25 -0
  374. package/dist/module-types/dashboard/lib/use-async.d.ts +45 -0
  375. package/dist/module-types/dashboard/lib/use-modules.d.ts +79 -0
  376. package/dist/module-types/dashboard/lib/utils.d.ts +3 -0
  377. package/dist/module-types/dashboard/module/index.d.ts +335 -0
  378. package/dist/module-types/dashboard/rpc/models.d.ts +2 -0
  379. package/dist/module-types/dashboard/rpc/modules.d.ts +5 -0
  380. package/dist/module-types/src/agent-id.d.ts +12 -0
  381. package/dist/module-types/src/agent-locks.d.ts +2 -0
  382. package/dist/module-types/src/agent-view.d.ts +38 -0
  383. package/dist/module-types/src/bridge-browser.d.ts +216 -0
  384. package/dist/module-types/src/browser-stream.d.ts +19 -0
  385. package/dist/module-types/src/browser.d.ts +15 -0
  386. package/dist/module-types/src/built-in.d.ts +37 -0
  387. package/dist/module-types/src/client.d.ts +15 -0
  388. package/dist/module-types/src/cloud-run-state.d.ts +26 -0
  389. package/dist/module-types/src/dashboard/activity.d.ts +40 -0
  390. package/dist/module-types/src/dashboard/agent-handoff.d.ts +243 -0
  391. package/dist/module-types/src/dashboard/bridge-endpoints.d.ts +157 -0
  392. package/dist/module-types/src/dashboard/bridge-question.d.ts +32 -0
  393. package/dist/module-types/src/dashboard/bridge-store.d.ts +178 -0
  394. package/dist/module-types/src/dashboard/cache.d.ts +46 -0
  395. package/dist/module-types/src/dashboard/content-type.d.ts +2 -0
  396. package/dist/module-types/src/dashboard/dashboard.d.ts +37 -0
  397. package/dist/module-types/src/dashboard/docs.d.ts +38 -0
  398. package/dist/module-types/src/dashboard/git-status.d.ts +43 -0
  399. package/dist/module-types/src/dashboard/http.d.ts +28 -0
  400. package/dist/module-types/src/dashboard/interventions.d.ts +66 -0
  401. package/dist/module-types/src/dashboard/keyed-watcher.d.ts +28 -0
  402. package/dist/module-types/src/dashboard/keys.d.ts +30 -0
  403. package/dist/module-types/src/dashboard/models.d.ts +24 -0
  404. package/dist/module-types/src/dashboard/module-host.d.ts +43 -0
  405. package/dist/module-types/src/dashboard/module-serve.d.ts +14 -0
  406. package/dist/module-types/src/dashboard/open-in-app.d.ts +42 -0
  407. package/dist/module-types/src/dashboard/open-questions.d.ts +44 -0
  408. package/dist/module-types/src/dashboard/overview.d.ts +77 -0
  409. package/dist/module-types/src/dashboard/projects.d.ts +100 -0
  410. package/dist/module-types/src/dashboard/pull-requests.d.ts +126 -0
  411. package/dist/module-types/src/dashboard/queue.d.ts +16 -0
  412. package/dist/module-types/src/dashboard/quota.d.ts +52 -0
  413. package/dist/module-types/src/dashboard/remote-run.d.ts +94 -0
  414. package/dist/module-types/src/dashboard/rpc-serve.d.ts +105 -0
  415. package/dist/module-types/src/dashboard/run-inbox.d.ts +30 -0
  416. package/dist/module-types/src/dashboard/types.d.ts +134 -0
  417. package/dist/module-types/src/dashboard-rpc/context.d.ts +55 -0
  418. package/dist/module-types/src/dashboard-rpc/control.d.ts +123 -0
  419. package/dist/module-types/src/dashboard-rpc/devices.d.ts +8 -0
  420. package/dist/module-types/src/dashboard-rpc/events-tail.d.ts +67 -0
  421. package/dist/module-types/src/dashboard-rpc/events.d.ts +38 -0
  422. package/dist/module-types/src/dashboard-rpc/index.d.ts +28 -0
  423. package/dist/module-types/src/dashboard-rpc/models.d.ts +3 -0
  424. package/dist/module-types/src/dashboard-rpc/modules.d.ts +44 -0
  425. package/dist/module-types/src/dashboard-rpc/preferences.d.ts +40 -0
  426. package/dist/module-types/src/dashboard-rpc/projects.d.ts +84 -0
  427. package/dist/module-types/src/dashboard-rpc/quota.d.ts +3 -0
  428. package/dist/module-types/src/dashboard-rpc/reads.d.ts +184 -0
  429. package/dist/module-types/src/dashboard-rpc/relay-agent.d.ts +8 -0
  430. package/dist/module-types/src/dashboard-rpc/stream-forward.d.ts +16 -0
  431. package/dist/module-types/src/driver-names.d.ts +21 -0
  432. package/dist/module-types/src/error-message.d.ts +7 -0
  433. package/dist/module-types/src/event-stream.d.ts +32 -0
  434. package/dist/module-types/src/events.d.ts +235 -0
  435. package/dist/module-types/src/format-bytes.d.ts +2 -0
  436. package/dist/module-types/src/has-remote.d.ts +7 -0
  437. package/dist/module-types/src/index.d.ts +41 -0
  438. package/dist/module-types/src/jsonl-tail.d.ts +58 -0
  439. package/dist/module-types/src/loopback-host.d.ts +19 -0
  440. package/dist/module-types/src/node-fs.d.ts +32 -0
  441. package/dist/module-types/src/open-choices.d.ts +14 -0
  442. package/dist/module-types/src/openagent-dir.d.ts +10 -0
  443. package/dist/module-types/src/openagent-gitignore.d.ts +11 -0
  444. package/dist/module-types/src/pick-directory.d.ts +29 -0
  445. package/dist/module-types/src/preference-defaults.d.ts +42 -0
  446. package/dist/module-types/src/project-commands.d.ts +23 -0
  447. package/dist/module-types/src/project-errors.d.ts +59 -0
  448. package/dist/module-types/src/project-hooks.d.ts +129 -0
  449. package/dist/module-types/src/project-modules.d.ts +49 -0
  450. package/dist/module-types/src/project-presets.d.ts +29 -0
  451. package/dist/module-types/src/project.d.ts +28 -0
  452. package/dist/module-types/src/publish-levels.d.ts +32 -0
  453. package/dist/module-types/src/quota-boundary.d.ts +64 -0
  454. package/dist/module-types/src/quota-poller.d.ts +82 -0
  455. package/dist/module-types/src/registry.d.ts +226 -0
  456. package/dist/module-types/src/store/agent-checkout.d.ts +53 -0
  457. package/dist/module-types/src/store/agent-store.d.ts +266 -0
  458. package/dist/module-types/src/store/branches.d.ts +163 -0
  459. package/dist/module-types/src/store/git-host.d.ts +113 -0
  460. package/dist/module-types/src/store/index.d.ts +9 -0
  461. package/dist/module-types/src/store/provided.d.ts +16 -0
  462. package/dist/module-types/src/store/queue.d.ts +45 -0
  463. package/dist/module-types/src/store/repository.d.ts +32 -0
  464. package/dist/module-types/src/store/run-record.d.ts +21 -0
  465. package/dist/module-types/src/store/runs.d.ts +107 -0
  466. package/dist/module-types/src/store/tickets.d.ts +72 -0
  467. package/dist/module-types/src/terminal.d.ts +3 -0
  468. package/dist/module-types/src/worktrees.d.ts +89 -0
  469. package/dist/module.css +50 -0
  470. package/dist/node-fs.d.ts +33 -0
  471. package/dist/node-fs.d.ts.map +1 -0
  472. package/dist/node-fs.js +57 -0
  473. package/dist/node-fs.js.map +1 -0
  474. package/dist/open-choices.d.ts +15 -0
  475. package/dist/open-choices.d.ts.map +1 -0
  476. package/dist/open-choices.js +31 -0
  477. package/dist/open-choices.js.map +1 -0
  478. package/dist/openagent-dir.d.ts +11 -0
  479. package/dist/openagent-dir.d.ts.map +1 -0
  480. package/dist/openagent-dir.js +11 -0
  481. package/dist/openagent-dir.js.map +1 -0
  482. package/dist/openagent-gitignore.d.ts +12 -0
  483. package/dist/openagent-gitignore.d.ts.map +1 -0
  484. package/dist/openagent-gitignore.js +19 -0
  485. package/dist/openagent-gitignore.js.map +1 -0
  486. package/dist/pick-directory.d.ts +30 -0
  487. package/dist/pick-directory.d.ts.map +1 -0
  488. package/dist/pick-directory.js +102 -0
  489. package/dist/pick-directory.js.map +1 -0
  490. package/dist/preference-defaults.d.ts +43 -0
  491. package/dist/preference-defaults.d.ts.map +1 -0
  492. package/dist/preference-defaults.js +34 -0
  493. package/dist/preference-defaults.js.map +1 -0
  494. package/dist/project-commands.d.ts +24 -0
  495. package/dist/project-commands.d.ts.map +1 -0
  496. package/dist/project-commands.js +57 -0
  497. package/dist/project-commands.js.map +1 -0
  498. package/dist/project-errors.d.ts +60 -0
  499. package/dist/project-errors.d.ts.map +1 -0
  500. package/dist/project-errors.js +51 -0
  501. package/dist/project-errors.js.map +1 -0
  502. package/dist/project-hooks.d.ts +130 -0
  503. package/dist/project-hooks.d.ts.map +1 -0
  504. package/dist/project-hooks.js +232 -0
  505. package/dist/project-hooks.js.map +1 -0
  506. package/dist/project-modules.d.ts +50 -0
  507. package/dist/project-modules.d.ts.map +1 -0
  508. package/dist/project-modules.js +110 -0
  509. package/dist/project-modules.js.map +1 -0
  510. package/dist/project-pass.d.ts +32 -0
  511. package/dist/project-pass.d.ts.map +1 -0
  512. package/dist/project-pass.js +45 -0
  513. package/dist/project-pass.js.map +1 -0
  514. package/dist/project-presets.d.ts +30 -0
  515. package/dist/project-presets.d.ts.map +1 -0
  516. package/dist/project-presets.js +74 -0
  517. package/dist/project-presets.js.map +1 -0
  518. package/dist/project.d.ts +29 -0
  519. package/dist/project.d.ts.map +1 -0
  520. package/dist/project.js +41 -0
  521. package/dist/project.js.map +1 -0
  522. package/dist/publish-levels.d.ts +33 -0
  523. package/dist/publish-levels.d.ts.map +1 -0
  524. package/dist/publish-levels.js +53 -0
  525. package/dist/publish-levels.js.map +1 -0
  526. package/dist/quota-boundary.d.ts +65 -0
  527. package/dist/quota-boundary.d.ts.map +1 -0
  528. package/dist/quota-boundary.js +135 -0
  529. package/dist/quota-boundary.js.map +1 -0
  530. package/dist/quota-poller.d.ts +83 -0
  531. package/dist/quota-poller.d.ts.map +1 -0
  532. package/dist/quota-poller.js +118 -0
  533. package/dist/quota-poller.js.map +1 -0
  534. package/dist/registry.d.ts +227 -0
  535. package/dist/registry.d.ts.map +1 -0
  536. package/dist/registry.js +364 -0
  537. package/dist/registry.js.map +1 -0
  538. package/dist/remove-files.d.ts +24 -0
  539. package/dist/remove-files.d.ts.map +1 -0
  540. package/dist/remove-files.js +98 -0
  541. package/dist/remove-files.js.map +1 -0
  542. package/dist/request-path.d.ts +10 -0
  543. package/dist/request-path.d.ts.map +1 -0
  544. package/dist/request-path.js +16 -0
  545. package/dist/request-path.js.map +1 -0
  546. package/dist/store/agent-checkout.d.ts +54 -0
  547. package/dist/store/agent-checkout.d.ts.map +1 -0
  548. package/dist/store/agent-checkout.js +61 -0
  549. package/dist/store/agent-checkout.js.map +1 -0
  550. package/dist/store/agent-store.d.ts +267 -0
  551. package/dist/store/agent-store.d.ts.map +1 -0
  552. package/dist/store/agent-store.js +190 -0
  553. package/dist/store/agent-store.js.map +1 -0
  554. package/dist/store/branches.d.ts +164 -0
  555. package/dist/store/branches.d.ts.map +1 -0
  556. package/dist/store/branches.js +187 -0
  557. package/dist/store/branches.js.map +1 -0
  558. package/dist/store/git-host.d.ts +114 -0
  559. package/dist/store/git-host.d.ts.map +1 -0
  560. package/dist/store/git-host.js +103 -0
  561. package/dist/store/git-host.js.map +1 -0
  562. package/dist/store/index.d.ts +10 -0
  563. package/dist/store/index.d.ts.map +1 -0
  564. package/dist/store/index.js +10 -0
  565. package/dist/store/index.js.map +1 -0
  566. package/dist/store/provided.d.ts +17 -0
  567. package/dist/store/provided.d.ts.map +1 -0
  568. package/dist/store/provided.js +37 -0
  569. package/dist/store/provided.js.map +1 -0
  570. package/dist/store/queue.d.ts +46 -0
  571. package/dist/store/queue.d.ts.map +1 -0
  572. package/dist/store/queue.js +61 -0
  573. package/dist/store/queue.js.map +1 -0
  574. package/dist/store/repository.d.ts +33 -0
  575. package/dist/store/repository.d.ts.map +1 -0
  576. package/dist/store/repository.js +25 -0
  577. package/dist/store/repository.js.map +1 -0
  578. package/dist/store/run-record.d.ts +22 -0
  579. package/dist/store/run-record.d.ts.map +1 -0
  580. package/dist/store/run-record.js +108 -0
  581. package/dist/store/run-record.js.map +1 -0
  582. package/dist/store/runs.d.ts +108 -0
  583. package/dist/store/runs.d.ts.map +1 -0
  584. package/dist/store/runs.js +146 -0
  585. package/dist/store/runs.js.map +1 -0
  586. package/dist/store/test-branches.d.ts +18 -0
  587. package/dist/store/test-branches.d.ts.map +1 -0
  588. package/dist/store/test-branches.js +59 -0
  589. package/dist/store/test-branches.js.map +1 -0
  590. package/dist/store/test-runs.d.ts +15 -0
  591. package/dist/store/test-runs.d.ts.map +1 -0
  592. package/dist/store/test-runs.js +37 -0
  593. package/dist/store/test-runs.js.map +1 -0
  594. package/dist/store/tickets.d.ts +73 -0
  595. package/dist/store/tickets.d.ts.map +1 -0
  596. package/dist/store/tickets.js +67 -0
  597. package/dist/store/tickets.js.map +1 -0
  598. package/dist/terminal.d.ts +4 -0
  599. package/dist/terminal.d.ts.map +1 -0
  600. package/dist/terminal.js +97 -0
  601. package/dist/terminal.js.map +1 -0
  602. package/dist/update-check.d.ts +44 -0
  603. package/dist/update-check.d.ts.map +1 -0
  604. package/dist/update-check.js +71 -0
  605. package/dist/update-check.js.map +1 -0
  606. package/dist/worktrees.d.ts +90 -0
  607. package/dist/worktrees.d.ts.map +1 -0
  608. package/dist/worktrees.js +123 -0
  609. package/dist/worktrees.js.map +1 -0
  610. package/package.json +103 -3
@@ -0,0 +1,135 @@
1
+ /**
2
+ * The quota boundary (#879): how much of the account's week OpenAgent may
3
+ * have spent by now.
4
+ *
5
+ * The whole policy is one line — the boundary is the pro-rated share of the week's allowance that
6
+ * has elapsed, rising continuously with the clock rather than once a day (#960 Edit) — and it
7
+ * replaces the configurable limits of #519. There is nothing to configure: the boundary is derived
8
+ * from the account's own week, which the agent reports.
9
+ *
10
+ * Nothing is left on the floor: the boundary rises on its own and reaches the full allowance
11
+ * exactly as the week resets, so a quiet week still gets spent rather than expiring.
12
+ *
13
+ * OpenAgent only draws it. Whether work stops at it, or how far past it, is the business of
14
+ * whatever starts unattended work, which puts its own stop line on the usage bar.
15
+ */
16
+ /** The quota week, in ms. */
17
+ export const QUOTA_WEEK_MS = 7 * 24 * 60 * 60 * 1000;
18
+ /** A day of it, in ms. */
19
+ const ONE_DAY_MS = 24 * 60 * 60 * 1000;
20
+ /** Days in the quota week, i.e. the denominator of `n/7`. */
21
+ const WEEK_DAYS = 7;
22
+ const MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
23
+ /**
24
+ * `Jul 25 at 7am (Asia/Jerusalem)`, with the minutes and the zone both optional. Newer Claude
25
+ * Code prints a comma where older versions print `at` — `Jul 25, 7am` — and both are in the wild.
26
+ */
27
+ const RESETS_AT = /^([a-z]{3})\s+(\d{1,2})(?:\s+at\s+|,\s*)(\d{1,2})(?::(\d{2}))?\s*(am|pm)\s*(?:\(([^)]+)\))?$/i;
28
+ /** How far `zone` is ahead of UTC at `at`, in ms. */
29
+ function zoneOffsetMs(at, zone) {
30
+ const parts = new Intl.DateTimeFormat('en-US', {
31
+ timeZone: zone,
32
+ hour12: false,
33
+ year: 'numeric',
34
+ month: '2-digit',
35
+ day: '2-digit',
36
+ hour: '2-digit',
37
+ minute: '2-digit',
38
+ second: '2-digit',
39
+ }).formatToParts(at);
40
+ const read = (type) => Number(parts.find(p => p.type === type)?.value);
41
+ // `hour: '2-digit'` with hour12 off prints midnight as 24 in some runtimes.
42
+ const hour = read('hour') % 24;
43
+ const asUtc = Date.UTC(read('year'), read('month') - 1, read('day'), hour, read('minute'), read('second'));
44
+ return asUtc - at;
45
+ }
46
+ /** The epoch of a wall-clock time in `zone`, resolving the offset at that instant rather than now. */
47
+ function zonedTimeToEpoch(year, month, day, hour, minute, zone) {
48
+ const wall = Date.UTC(year, month - 1, day, hour, minute);
49
+ const first = wall - zoneOffsetMs(wall, zone);
50
+ // One correction settles it: the first guess is only wrong when it landed on
51
+ // the far side of a DST change, and the second offset is the right one.
52
+ const second = wall - zoneOffsetMs(first, zone);
53
+ return second;
54
+ }
55
+ /**
56
+ * Parse the agent's reset prose into an epoch.
57
+ *
58
+ * The agent prints no year (`Jul 25 at 7am (Asia/Jerusalem)`), which is why the
59
+ * driver keeps this as text. It is recoverable here because we know something
60
+ * the driver does not: a *weekly* window resets within seven days, so of the
61
+ * candidate years exactly one lands anywhere near now.
62
+ *
63
+ * `undefined` for anything that does not parse, which the callers treat as "we
64
+ * do not know where the week is" rather than as a boundary of zero.
65
+ */
66
+ export function parseResetsAt(text, now) {
67
+ const match = RESETS_AT.exec(text.trim());
68
+ if (!match)
69
+ return undefined;
70
+ const [, monthName, dayText, hourText, minuteText, meridiem, zoneText] = match;
71
+ const month = MONTHS.indexOf((monthName ?? '').toLowerCase()) + 1;
72
+ if (month === 0)
73
+ return undefined;
74
+ const day = Number(dayText);
75
+ const hour12 = Number(hourText);
76
+ if (hour12 < 1 || hour12 > 12)
77
+ return undefined;
78
+ const hour = (hour12 % 12) + ((meridiem ?? '').toLowerCase() === 'pm' ? 12 : 0);
79
+ const minute = minuteText === undefined ? 0 : Number(minuteText);
80
+ const zone = zoneText?.trim() || Intl.DateTimeFormat().resolvedOptions().timeZone;
81
+ const nowYear = new Date(now).getUTCFullYear();
82
+ let best;
83
+ for (const year of [nowYear - 1, nowYear, nowYear + 1]) {
84
+ let at;
85
+ try {
86
+ at = zonedTimeToEpoch(year, month, day, hour, minute, zone);
87
+ }
88
+ catch {
89
+ // An unknown zone name. Nothing to fall back to that wouldn't be a guess.
90
+ return undefined;
91
+ }
92
+ // Feb 29 in a non-leap year rolls into March; that candidate isn't the date
93
+ // the agent printed.
94
+ if (new Date(at + zoneOffsetMs(at, zone)).getUTCDate() !== day)
95
+ continue;
96
+ if (best === undefined || Math.abs(at - now) < Math.abs(best - now))
97
+ best = at;
98
+ }
99
+ return best;
100
+ }
101
+ /**
102
+ * Where the boundary sits, given when the week resets.
103
+ *
104
+ * `percent` is continuous — the plain elapsed share of the week (#960 Edit) — rather than a value
105
+ * that jumps once a day, so it always names the actual instant `now` falls on, on any axis that
106
+ * measures the week the same way. A stepped version once unlocked a whole day's allowance the
107
+ * moment a new day began (including the entire week's worth on the last day), which read as
108
+ * generous on paper but let a burst of spending land the instant the clock ticked over rather than
109
+ * pacing with it; continuous keeps the line honest about what has actually elapsed at the cost of
110
+ * that burst.
111
+ *
112
+ * `day` is 1-based and still names which day of the week `now` falls on — for callers that want to
113
+ * say "day 4 of 7" rather than a percentage — and steps at the exact second the week's own day
114
+ * rolls over, independently of `percent`.
115
+ */
116
+ export function boundaryFromResetsAt(resetsAt, now) {
117
+ const startsAt = resetsAt - QUOTA_WEEK_MS;
118
+ const elapsedMs = Math.min(Math.max(now - startsAt, 0), QUOTA_WEEK_MS);
119
+ const day = Math.min(WEEK_DAYS, Math.floor(elapsedMs / ONE_DAY_MS) + 1);
120
+ return { startsAt, resetsAt, day, percent: (elapsedMs / QUOTA_WEEK_MS) * 100 };
121
+ }
122
+ /**
123
+ * Where the boundary sits for the account's own week, as the agent reported it (#879).
124
+ *
125
+ * `undefined` when there is no reading of the week, or when its reset cannot be placed. That is
126
+ * "we do not know", never a boundary of zero.
127
+ */
128
+ export function weekBoundary(windows, now) {
129
+ const week = windows.find(w => w.kind === 'week');
130
+ if (!week?.resetsAtText)
131
+ return undefined;
132
+ const resetsAt = parseResetsAt(week.resetsAtText, now);
133
+ return resetsAt === undefined ? undefined : boundaryFromResetsAt(resetsAt, now);
134
+ }
135
+ //# sourceMappingURL=quota-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-boundary.js","sourceRoot":"","sources":["../src/quota-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,6BAA6B;AAC7B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAEpD,0BAA0B;AAC1B,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAEtC,6DAA6D;AAC7D,MAAM,SAAS,GAAG,CAAC,CAAA;AAcnB,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;AAEnG;;;GAGG;AACH,MAAM,SAAS,GAAG,+FAA+F,CAAA;AAEjH,qDAAqD;AACrD,SAAS,YAAY,CAAC,EAAU,EAAE,IAAY;IAC5C,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAC7C,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IACpB,MAAM,IAAI,GAAG,CAAC,IAA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I,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;IACtD,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjF,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { type DriverQuota } from '@openagt/agent-driver';
2
+ /**
3
+ * How often to read the quota when everything is healthy. A read spawns the
4
+ * whole agent CLI (~5s), and the agent's own usage fetch is refused upstream if
5
+ * asked too often, so this is deliberately slow: the boundary moves over days,
6
+ * which a 5-minute sample rate resolves comfortably.
7
+ */
8
+ export declare const DEFAULT_POLL_MS: number;
9
+ /** Longest gap between reads once backoff has stretched it. */
10
+ export declare const MAX_POLL_MS: number;
11
+ /**
12
+ * What the poller currently believes about the account's quota.
13
+ *
14
+ * `latest` is the last attempt as it came back; `lastGood` is the last real
15
+ * reading. The two are separate so a transient blip doesn't blank a number that
16
+ * was accurate a minute ago — a bar going empty reads as "nothing used", which
17
+ * is the one thing this feature must never imply.
18
+ */
19
+ export interface QuotaEnvelope {
20
+ /** The most recent attempt, exactly as it came back. `undefined` before the first. */
21
+ latest: DriverQuota | undefined;
22
+ /** The most recent successful reading, retained across transient failures. */
23
+ lastGood: (DriverQuota & {
24
+ available: true;
25
+ }) | undefined;
26
+ /** When {@link lastGood} was read, epoch ms. */
27
+ lastGoodAt: number | undefined;
28
+ /** When the last failure happened, epoch ms. */
29
+ lastFailureAt: number | undefined;
30
+ }
31
+ /** Options for {@link QuotaPoller}. */
32
+ export interface QuotaPollerOptions {
33
+ /** Read the quota once. Normally `driver.readQuota`. */
34
+ read: () => Promise<DriverQuota>;
35
+ /** Healthy interval. Default {@link DEFAULT_POLL_MS}. */
36
+ intervalMs?: number;
37
+ /** Ceiling for the backed-off interval. Default {@link MAX_POLL_MS}. */
38
+ maxIntervalMs?: number;
39
+ /** Clock, injectable for tests. */
40
+ now?: () => number;
41
+ }
42
+ /**
43
+ * Keeps a recent quota reading on hand (#525).
44
+ *
45
+ * Polling is slow by design and backs *off* on failure rather than retrying
46
+ * into it: the agent's usage fetch is refused upstream when asked too often,
47
+ * and the penalty window is minutes long, so an eager retry loop would keep the
48
+ * number permanently unavailable — the opposite of the goal.
49
+ */
50
+ export declare class QuotaPoller {
51
+ private readonly opts;
52
+ private envelope;
53
+ private timer;
54
+ private running;
55
+ private currentIntervalMs;
56
+ private stopped;
57
+ private readonly now;
58
+ constructor(opts: QuotaPollerOptions);
59
+ /** What we currently believe. */
60
+ current(): QuotaEnvelope;
61
+ /** The gap before the next read, which grows while the fetch keeps being refused. */
62
+ get intervalMs(): number;
63
+ /** Whether the poller has given up (an authoritative failure, or {@link stop}). */
64
+ get isStopped(): boolean;
65
+ /**
66
+ * Read once, now, and fold the result in. Safe to call on demand (e.g. right
67
+ * after a turn settles) alongside the timer.
68
+ */
69
+ poll(): Promise<DriverQuota>;
70
+ /**
71
+ * Begin polling, starting with a read right now rather than one interval from
72
+ * now: a poller whose first reading lands five minutes in is no use to an agent
73
+ * that just started, and the session's own measurement needs a baseline. Not
74
+ * awaited — the read takes ~5s and nothing should wait on it. Idempotent.
75
+ */
76
+ start(): void;
77
+ /** Stop polling. Idempotent. */
78
+ stop(): void;
79
+ private onGood;
80
+ private onBad;
81
+ private schedule;
82
+ }
83
+ //# sourceMappingURL=quota-poller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-poller.d.ts","sourceRoot":"","sources":["../src/quota-poller.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,WAAW,EAAqC,MAAM,uBAAuB,CAAA;AAEnH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAgB,CAAA;AAE5C,+DAA+D;AAC/D,eAAO,MAAM,WAAW,QAAiB,CAAA;AAEzC;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,sFAAsF;IACtF,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAC/B,8EAA8E;IAC9E,QAAQ,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
+ /**
3
+ * How often to read the quota when everything is healthy. A read spawns the
4
+ * whole agent CLI (~5s), and the agent's own usage fetch is refused upstream if
5
+ * asked too often, so this is deliberately slow: the boundary moves over days,
6
+ * which a 5-minute sample rate resolves comfortably.
7
+ */
8
+ export const DEFAULT_POLL_MS = 5 * 60 * 1000;
9
+ /** Longest gap between reads once backoff has stretched it. */
10
+ export const MAX_POLL_MS = 30 * 60 * 1000;
11
+ /**
12
+ * Keeps a recent quota reading on hand (#525).
13
+ *
14
+ * Polling is slow by design and backs *off* on failure rather than retrying
15
+ * into it: the agent's usage fetch is refused upstream when asked too often,
16
+ * and the penalty window is minutes long, so an eager retry loop would keep the
17
+ * number permanently unavailable — the opposite of the goal.
18
+ */
19
+ export class QuotaPoller {
20
+ opts;
21
+ envelope = { latest: undefined, lastGood: undefined, lastGoodAt: undefined, lastFailureAt: undefined };
22
+ timer;
23
+ running = false;
24
+ currentIntervalMs;
25
+ stopped = false;
26
+ now;
27
+ constructor(opts) {
28
+ this.opts = opts;
29
+ this.currentIntervalMs = opts.intervalMs ?? DEFAULT_POLL_MS;
30
+ this.now = opts.now ?? (() => Date.now());
31
+ }
32
+ /** What we currently believe. */
33
+ current() {
34
+ return { ...this.envelope };
35
+ }
36
+ /** The gap before the next read, which grows while the fetch keeps being refused. */
37
+ get intervalMs() {
38
+ return this.currentIntervalMs;
39
+ }
40
+ /** Whether the poller has given up (an authoritative failure, or {@link stop}). */
41
+ get isStopped() {
42
+ return this.stopped;
43
+ }
44
+ /**
45
+ * Read once, now, and fold the result in. Safe to call on demand (e.g. right
46
+ * after a turn settles) alongside the timer.
47
+ */
48
+ async poll() {
49
+ let quota;
50
+ try {
51
+ quota = await this.opts.read();
52
+ }
53
+ catch {
54
+ // A driver that throws is the same story as one that reports a failed
55
+ // fetch: this attempt told us nothing, and it may work next time.
56
+ quota = { available: false, reason: 'fetch-failed' };
57
+ }
58
+ this.envelope = { ...this.envelope, latest: quota };
59
+ if (quota.available) {
60
+ this.onGood(quota);
61
+ }
62
+ else {
63
+ this.onBad(quota.reason);
64
+ }
65
+ return quota;
66
+ }
67
+ /**
68
+ * Begin polling, starting with a read right now rather than one interval from
69
+ * now: a poller whose first reading lands five minutes in is no use to an agent
70
+ * that just started, and the session's own measurement needs a baseline. Not
71
+ * awaited — the read takes ~5s and nothing should wait on it. Idempotent.
72
+ */
73
+ start() {
74
+ if (this.running || this.stopped)
75
+ return;
76
+ this.running = true;
77
+ void this.poll().finally(() => this.schedule());
78
+ }
79
+ /** Stop polling. Idempotent. */
80
+ stop() {
81
+ this.stopped = true;
82
+ this.running = false;
83
+ if (this.timer)
84
+ clearTimeout(this.timer);
85
+ this.timer = undefined;
86
+ }
87
+ onGood(quota) {
88
+ this.envelope = { ...this.envelope, lastGood: quota, lastGoodAt: this.now() };
89
+ // Reset the backoff: the fetch is working again.
90
+ this.currentIntervalMs = this.opts.intervalMs ?? DEFAULT_POLL_MS;
91
+ }
92
+ onBad(reason) {
93
+ this.envelope = { ...this.envelope, lastFailureAt: this.now() };
94
+ if (!isTransientQuotaReason(reason)) {
95
+ // Authoritative: no subscription, or no agent. Asking again changes
96
+ // nothing, and the retained reading would misrepresent the account.
97
+ this.envelope = { ...this.envelope, lastGood: undefined, lastGoodAt: undefined };
98
+ this.stop();
99
+ return;
100
+ }
101
+ // Transient, so keep lastGood and ask again later — but later than last time.
102
+ this.currentIntervalMs = Math.min(this.currentIntervalMs * 2, this.opts.maxIntervalMs ?? MAX_POLL_MS);
103
+ }
104
+ schedule() {
105
+ if (this.stopped)
106
+ return;
107
+ this.timer = setTimeout(() => {
108
+ void this.poll().finally(() => {
109
+ this.timer = undefined;
110
+ this.schedule();
111
+ });
112
+ }, this.currentIntervalMs);
113
+ // Don't hold the process open just to read a quota; the daemon's own work
114
+ // decides its lifetime. Unlike the read's timeout, nothing awaits this.
115
+ this.timer.unref?.();
116
+ }
117
+ }
118
+ //# sourceMappingURL=quota-poller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota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AK,CAAC,MAAoC;QAChD,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAA;QAC/D,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;YACpC,oEAAoE;YACpE,oEAAoE;YACpE,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAA;YAChF,IAAI,CAAC,IAAI,EAAE,CAAA;YACX,OAAM;QACR,CAAC;QACD,8EAA8E;QAC9E,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,WAAW,CAAC,CAAA;IACvG,CAAC;IAEO,QAAQ;QACd,IAAI,IAAI,CAAC,OAAO;YAAE,OAAM;QACxB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC3B,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;gBAC5B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;gBACtB,IAAI,CAAC,QAAQ,EAAE,CAAA;YACjB,CAAC,CAAC,CAAA;QACJ,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAA;QAC1B,0EAA0E;QAC1E,wEAAwE;QACxE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAA;IACtB,CAAC;CACF"}
@@ -0,0 +1,227 @@
1
+ import { type PublishPick } from './publish-levels.js';
2
+ /**
3
+ * The multi-project registry (#390): the list of projects the user has
4
+ * installed OpenAgent into, kept as a single JSON file `.bashrc`-style —
5
+ * `$HOME/.openagent.json` — so it is the user's responsibility to re-create
6
+ * per machine. The same file also holds the user's dashboard preferences (#410),
7
+ * so the daemon owns one user file and the UI never needs localStorage.
8
+ */
9
+ /** One registered project. */
10
+ export interface ProjectRecord {
11
+ /** Stable, URL-safe id derived from the path. */
12
+ id: string;
13
+ /** Absolute repo path. */
14
+ path: string;
15
+ /** ISO timestamp the project was added. */
16
+ addedAt: string;
17
+ }
18
+ /**
19
+ * The dashboard's Global options (#410), persisted next to the project list so they
20
+ * survive restarts without localStorage — the daemon reads/writes them, the SPA reads
21
+ * them over `POST /_rpc/onPreferences`. Mostly flat booleans mirroring the Start form's
22
+ * toggles; every field is optional and absent means off, except where a field documents its
23
+ * own default below.
24
+ */
25
+ /**
26
+ * A user-defined preset (#626): a named prompt the user saved to re-run their own high-signal
27
+ * prompts, listed as a saved prompt in the launcher's Commands menu beside the project's commands.
28
+ * Just data — the label is the menu item, the prompt is loaded verbatim into the editor. `id` is
29
+ * stable so edits/deletes address one.
30
+ */
31
+ export interface CustomPreset {
32
+ id: string;
33
+ label: string;
34
+ prompt: string;
35
+ }
36
+ export interface Preferences {
37
+ /** Fire a browser notification when a new item lands on the "needs you" queue (#627). Absent = on. */
38
+ notifyBrowser?: boolean;
39
+ /**
40
+ * Also notify on plain agent activity — an agent started, an agent finished (#627). The default-off
41
+ * counterpart to the always-on "needs you" notifications: it keeps you loosely informed of the
42
+ * pipeline moving even when nothing needs you. A *category* toggle: it composes with the method
43
+ * toggle {@link notifyBrowser}.
44
+ */
45
+ notifyNewActivity?: boolean;
46
+ /**
47
+ * The "needs you" category (#627): notify when an agent is awaiting your answer or a PR is ready
48
+ * to review. A *category* toggle, like {@link notifyNewActivity}, composing with the method
49
+ * toggle {@link notifyBrowser}. **Absent = on**: unlike the other
50
+ * flat opt-in booleans, human-intervention pings are the baseline OpenAgent leans on, so an
51
+ * unset preference keeps them firing; a user turns them off explicitly.
52
+ */
53
+ notifyHumanIntervention?: boolean;
54
+ /** The model to run on (#628), e.g. `opus` / `sonnet`, handed to the project's start hook. Absent = the hook's own default. */
55
+ model?: string;
56
+ /** Which coding agent a run starts on (#650): `claude-code` or `codex`, handed to the project's start hook. Absent = the hook's own default. */
57
+ driver?: string;
58
+ /** How far a run started from the dashboard publishes its work: `nothing`, or the level handed to the project's start hook, `commit`, `branch`, `pr` or `merge`. The launcher's menu shows it and writes it. Absent = none saved: the daemon decides where a Start goes. */
59
+ publish?: PublishPick;
60
+ /**
61
+ * Where an agent started from the launcher starts, per project: the projects, by id, whose
62
+ * launcher is set to "My local branch" (the branch the project's folder is on, as this machine
63
+ * has it). The launcher's "start from" chip shows it and writes it. **A project not listed
64
+ * starts from its main branch**, so the default stores nothing.
65
+ */
66
+ startFrom?: Record<string, 'local'>;
67
+ /**
68
+ * Post-merge cleanup: a run started from the launcher, in a project that has the
69
+ * `post-merge-cleanup` command, is followed by a fresh agent running it on the run's branch
70
+ * before the run's pull request merges. The default of the launcher's box, which writes it
71
+ * too. **Absent = off.**
72
+ */
73
+ postMergeCleanup?: boolean;
74
+ /** Preferred editor for "Open in editor" (#727): an editor CLI (e.g. `code`, `cursor`, `zed`).
75
+ * Absent falls back to `$OPENAGENT_EDITOR`, then `code`. */
76
+ editor?: string;
77
+ /** Dashboard color theme (#725): `system` (follow the OS, the default), `light`, or `dark`. Absent = system. */
78
+ theme?: 'system' | 'light' | 'dark';
79
+ /**
80
+ * The browser bridge (#1237): let an extension running in the user's own Claude session report
81
+ * the question a Claude web agent is parked on, so it shows in the dashboard rather than only on
82
+ * claude.ai. **Absent = off.** It opens the daemon's one route reachable from another origin,
83
+ * so it is opt-in rather than a baseline, and turning it on is what mints the bridge token.
84
+ */
85
+ bridge?: boolean;
86
+ /**
87
+ * The bridge browser (#1332): let the daemon run its own Chrome for Testing with the bridge
88
+ * extension installed, signed in once and kept minimized, so web runs stop depending on the
89
+ * user's own Chrome being open. **Absent = off**: it downloads a browser and keeps a signed-in
90
+ * claude.ai session on disk, neither of which should happen unasked. Needs {@link bridge}.
91
+ */
92
+ bridgeBrowser?: boolean;
93
+ /** User-defined presets (#626): the user's own saved prompts, shown in the Commands menu beside the project's commands. */
94
+ customPresets?: CustomPreset[];
95
+ /**
96
+ * Whether the Overview's Onboarding checklist has been dismissed (#958). Absent = show it,
97
+ * so a fresh install is walked through setup; dismissing only hides it on the Overview, and
98
+ * the same checklist stays available on the settings page.
99
+ */
100
+ onboardingDismissed?: boolean;
101
+ }
102
+ /** The persisted registry file shape (#410): the project list plus the user preferences. */
103
+ export interface Registry {
104
+ projects: ProjectRecord[];
105
+ preferences: Preferences;
106
+ /**
107
+ * The shared daemon token (#1051): generated on the first non-loopback bind and reused after.
108
+ * A top-level field, deliberately not a {@link Preferences} one, so it is never shipped to the
109
+ * browser bundle. Absent on a loopback-only machine.
110
+ */
111
+ daemonToken?: string;
112
+ }
113
+ /** A read/write handle for the user preferences, wired into the dashboard's context by the daemon. */
114
+ export interface PreferencesStore {
115
+ read(): Promise<Preferences>;
116
+ save(preferences: Preferences): Promise<void>;
117
+ /**
118
+ * Merge only the keys the caller changed (#1148) and hand back the stored result. Preferred over
119
+ * {@link save}, which replaces the whole block from a snapshot that may already be stale.
120
+ */
121
+ patch(patch: Preferences): Promise<Preferences>;
122
+ }
123
+ /** The registry file name: a single file under `$XDG_CONFIG_HOME` (dotted under `$HOME`). */
124
+ export declare const REGISTRY_FILE = "openagent.json";
125
+ /** Owner read/write only: the file holds the daemon token (#1051). */
126
+ export declare const REGISTRY_FILE_MODE = 384;
127
+ /**
128
+ * Deterministic, URL-safe id for a project path: the sanitized basename plus a
129
+ * short hash of the full path, so two repos named alike still get distinct ids.
130
+ * Pure; same path always yields the same id.
131
+ */
132
+ export declare function projectId(path: string): string;
133
+ /**
134
+ * The registry file path, resolved from `env` (injectable so tests never touch
135
+ * the real home): `$XDG_CONFIG_HOME/openagent.json` when set, else the
136
+ * dotted `$HOME/.openagent.json`. A single file, not a directory (#390).
137
+ */
138
+ export declare function registryPath(env: NodeJS.ProcessEnv): string;
139
+ /** Minimal fs seam so the registry is unit-testable without touching disk. */
140
+ export interface RegistryFs {
141
+ /** Rejects when the file is absent. */
142
+ read(path: string): Promise<string>;
143
+ write(path: string, contents: string): Promise<void>;
144
+ /** Recursive; used on the registry file's parent dir. */
145
+ mkdir(path: string): Promise<void>;
146
+ /**
147
+ * Replace `to` with `from`, atomically. Optional only so an existing implementation of this
148
+ * seam keeps compiling; without it {@link writeRegistry} falls back to the truncate-then-write
149
+ * this method exists to avoid (#991).
150
+ */
151
+ rename?(from: string, to: string): Promise<void>;
152
+ /**
153
+ * Narrow a file's permissions. Optional, and best-effort at the call site: this file holds the
154
+ * daemon token (#1051), so it is written owner-only — but a
155
+ * filesystem that cannot express that (Windows, a FAT volume) must not fail the write.
156
+ */
157
+ chmod?(path: string, mode: number): Promise<void>;
158
+ }
159
+ /** A {@link RegistryFs} backed by `node:fs/promises`. See {@link nodeFs}. */
160
+ export declare function nodeRegistryFs(): RegistryFs;
161
+ /**
162
+ * Keep only well-formed custom presets (#626): each needs a non-empty id, label, and prompt;
163
+ * label/prompt are trimmed and length-capped, the list capped at {@link CUSTOM_PRESET_LIMITS.count},
164
+ * and duplicate ids dropped. A malformed entry is skipped, not thrown — a bad registry never breaks the read.
165
+ */
166
+ export declare function sanitizeCustomPresets(value: unknown): CustomPreset[];
167
+ /**
168
+ * Read the whole registry. Forgiving: a missing / unreadable / malformed file — or one in a shape
169
+ * this no longer writes — yields an empty registry, never throws. Projects are deduped by resolved
170
+ * path and unknown preference fields are dropped.
171
+ */
172
+ export declare function readRegistry(fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<Registry>;
173
+ /**
174
+ * Read the registry's project list. Forgiving: a missing / unreadable / malformed
175
+ * file yields `[]`, never throws. Deduped by resolved path, first wins.
176
+ */
177
+ export declare function listProjects(fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<ProjectRecord[]>;
178
+ /**
179
+ * Register a project. Idempotent by resolved path: when the path is already
180
+ * registered, the existing record is returned untouched (addedAt survives);
181
+ * otherwise the new record is appended and the file written back (preferences preserved).
182
+ */
183
+ export declare function addProject(path: string, addedAt: string, fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<ProjectRecord>;
184
+ /**
185
+ * Take a project off the list, by id. Answers the record that was removed, or `undefined` when
186
+ * no project has that id. Only the list changes: nothing in the project's folder is touched, so
187
+ * a project whose folder is gone is removed like any other.
188
+ */
189
+ export declare function removeProject(id: string, fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<ProjectRecord | undefined>;
190
+ /** The user's dashboard preferences (#410), or `{}` when none are stored. */
191
+ export declare function readPreferences(fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<Preferences>;
192
+ /** Persist the dashboard preferences (#410), sanitized, preserving the project list. */
193
+ export declare function writePreferences(preferences: Preferences, fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<void>;
194
+ /**
195
+ * Merge `patch` over the stored preferences (#1148) and return the result.
196
+ *
197
+ * The counterpart to {@link writePreferences}, which replaces the whole block: a client that
198
+ * sends its entire snapshot replays every value it happens to hold, so a dashboard tab opened
199
+ * before someone else's change silently reverted it on the tab's next write, whatever key that
200
+ * write was actually about. Sending only the changed keys makes a write touch only what it names.
201
+ *
202
+ * Clearing needs no sentinel: {@link sanitizePreferences} already drops blank strings and empty
203
+ * lists, so `{ editor: '' }` merges in as blank and comes out absent, which is how the dashboard
204
+ * clears the editor today.
205
+ */
206
+ export declare function patchPreferences(patch: Preferences, fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<Preferences>;
207
+ /**
208
+ * The shared daemon token (#1051): read the persisted one, or generate + persist it now. Called
209
+ * only on a non-loopback bind, so a loopback-only machine never grows one. Serialized with the
210
+ * other mutators so two concurrent binds can't each write a different token. `base64url` of 32
211
+ * random bytes: URL-safe, so it drops straight into a `?token=` without encoding.
212
+ */
213
+ export declare function ensureDaemonToken(fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<string>;
214
+ /** The persisted daemon token (#1051), or `undefined` when none exists. A pure read, so a process
215
+ * that only prints the reachable URL never generates one. */
216
+ export declare function readDaemonToken(fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<string | undefined>;
217
+ /** A {@link PreferencesStore} bound to the real registry file, wired by the daemon so the
218
+ * dashboard's preferences RPCs read/write the user's home file.
219
+ *
220
+ * `onChange` is handed **the keys the caller wrote**, not the merged result, so a listener can
221
+ * tell "this write switched the setting on" from "it was already on and something else changed"
222
+ * (#1161). It runs after the write has landed, and its failure is swallowed: the save succeeded,
223
+ * and a listener must not be able to report otherwise: a setting saved in the browser has to
224
+ * reach the daemon's own services without a restart.
225
+ */
226
+ export declare function registryPreferencesStore(fs?: RegistryFs, env?: NodeJS.ProcessEnv, onChange?: (written: Preferences) => void): PreferencesStore;
227
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGrE;;;;;;GAMG;AAEH,8BAA8B;AAC9B,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AASD,MAAM,WAAW,WAAW;IAC1B,sGAAsG;IACtG,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,+HAA+H;IAC/H,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gJAAgJ;IAChJ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4QAA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