@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,57 @@
1
+ import { readdir, readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { parse as parseYaml } from 'yaml';
4
+ /**
5
+ * A project's commands (#1774): the skills written to be run by a person, read off the folders
6
+ * the coding agents read them from. OpenAgent ships no prompt text; what a project can be
7
+ * asked to do is what its own command skills say. A skill that teaches the agent how to do
8
+ * something (the tickets, the queue) is not a command: typed alone it starts an agent with
9
+ * nothing to do, so the launcher does not list it.
10
+ */
11
+ /** Where coding agents read a project's skills: Claude Code's folder, and the shared one Codex reads. */
12
+ export const SKILLS_DIRS = ['.claude/skills', '.agents/skills'];
13
+ /**
14
+ * The project's commands, by name: the skills whose front matter says
15
+ * `disable-model-invocation: true`, written to be run by a person or a runner and never picked
16
+ * up by the agent on its own. A skill in both folders is listed once. A folder without a
17
+ * readable `SKILL.md` is skipped, and a project with no skills folder has no commands.
18
+ */
19
+ export async function readProjectCommands(cwd) {
20
+ const commands = new Map();
21
+ // A skill's first readable copy decides, as with the coding agent: a later folder's copy of a
22
+ // skill already read is not looked at, command or not.
23
+ const read = new Set();
24
+ for (const dir of SKILLS_DIRS) {
25
+ const entries = await readdir(join(cwd, dir), { withFileTypes: true }).catch(() => []);
26
+ for (const entry of entries) {
27
+ if (read.has(entry.name) || !/^[a-z0-9][a-z0-9-]*$/.test(entry.name))
28
+ continue;
29
+ const raw = await readFile(join(cwd, dir, entry.name, 'SKILL.md'), 'utf8').catch(() => undefined);
30
+ if (raw === undefined)
31
+ continue;
32
+ read.add(entry.name);
33
+ const front = frontMatter(raw);
34
+ if (front['disable-model-invocation'] !== true)
35
+ continue;
36
+ commands.set(entry.name, {
37
+ name: entry.name,
38
+ ...(typeof front['description'] === 'string' && front['description'].trim() ? { description: front['description'].trim() } : {}),
39
+ });
40
+ }
41
+ }
42
+ return [...commands.values()].sort((a, b) => a.name.localeCompare(b.name));
43
+ }
44
+ /** The YAML front matter of a markdown file as a map; none, or one that does not parse, is empty. */
45
+ function frontMatter(raw) {
46
+ const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(raw);
47
+ if (!match)
48
+ return {};
49
+ try {
50
+ const data = parseYaml(match[1]);
51
+ return data && typeof data === 'object' && !Array.isArray(data) ? data : {};
52
+ }
53
+ catch {
54
+ return {};
55
+ }
56
+ }
57
+ //# sourceMappingURL=project-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-commands.js","sourceRoot":"","sources":["../src/project-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAA;AAEzC;;;;;;GAMG;AAEH,yGAAyG;AACzG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAU,CAAA;AAUxE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,GAAW;IACnD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAA;IAClD,8FAA8F;IAC9F,uDAAuD;IACvD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;QACtF,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,GAAG,CAA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CAAA;IACrB,IAAI,CAAC;QACH,MAAM,IAAI,GAAY,SAAS,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAA;QAC1C,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,IAAgC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1G,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The daemon's per-project error state (#1500): a background job that finds a project in a state
3
+ * the user has to fix — and can only fix if told — records it here, and clears it the moment the
4
+ * state is good again. The dashboard renders what is recorded; nothing else reads it.
5
+ *
6
+ * The first emitter is the data-branch sync (#1599): a push origin rejects used to be a console
7
+ * line on the daemon's stdout and nothing else, which is the worst way to handle a state nobody
8
+ * can see.
9
+ *
10
+ * A project whose data stays on this machine is not an error: a folder with no origin, or one the
11
+ * person does not share, is a normal project. The sync records why as `local`, a note the
12
+ * dashboard says quietly.
13
+ *
14
+ * In memory on purpose. Every emitter re-evaluates on its own cadence — the sync every minute —
15
+ * so a restarted daemon re-learns each error within a tick, and there is no stale record to
16
+ * outlive the condition that raised it.
17
+ */
18
+ import type { BranchReach } from '@openagt/agent-data';
19
+ /**
20
+ * What went wrong, by kind: the dashboard picks its wording from this, the message carries the
21
+ * detail. `data-sync`: the data branch cannot converge with the remote. `provider`: which package
22
+ * provides a kind of the project's data is unsettled (#1820): several declare it and the project's
23
+ * package.json names none, or names one that does not.
24
+ */
25
+ export type ProjectErrorCode = 'data-sync' | 'provider';
26
+ export interface ProjectError {
27
+ code: ProjectErrorCode;
28
+ /** The detail — what the failing command said, in the words the user would see running it by hand. */
29
+ message: string;
30
+ /** ISO timestamp of when the error was first recorded; a re-report of the same code keeps it. */
31
+ since: string;
32
+ }
33
+ /** Why a project's data stays on this machine: its repository has no origin, or the person keeps it here. */
34
+ export type StaysLocal = Exclude<BranchReach, 'origin'>;
35
+ /** The daemon's write side: one slot per (project, code). */
36
+ export interface ProjectErrors {
37
+ /**
38
+ * Record the error. A second report of the same code on the same project refreshes the message
39
+ * and keeps `since`, so a banner says how long this has been going on rather than resetting
40
+ * every minute.
41
+ */
42
+ set(projectPath: string, code: ProjectErrorCode, message: string): void;
43
+ /** The condition is gone; a clear of something never set is a no-op. */
44
+ clear(projectPath: string, code: ProjectErrorCode): void;
45
+ /** The project's current errors, oldest first. */
46
+ list(projectPath: string): ProjectError[];
47
+ /** How far the project's data reaches, as the last sync found it. */
48
+ setReach(projectPath: string, reach: BranchReach): void;
49
+ /** What the dashboard shows of the project: its errors, and why its data stays local, if it does. */
50
+ read(projectPath: string): ProjectState;
51
+ }
52
+ /** What the background jobs currently know of a project: what is wrong with it, and why its data stays on this machine, if it does. */
53
+ export interface ProjectState {
54
+ errors: ProjectError[];
55
+ local?: StaysLocal;
56
+ }
57
+ /** The dashboard's read side, wired into its context. */
58
+ export type ProjectErrorsReader = ProjectErrors['read'];
59
+ export declare function projectErrorStore(now?: () => Date): ProjectErrors;
60
+ //# sourceMappingURL=project-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-errors.d.ts","sourceRoot":"","sources":["../src/project-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,CAAA;AAEvD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAA;IACtB,sGAAsG;IACtG,OAAO,EAAE,MAAM,CAAA;IACf,iGAAiG;IACjG,KAAK,EAAE,MAAM,CAAA;CACd;AAED,6GAA6G;AAC7G,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;AAEvD,6DAA6D;AAC7D,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACvE,wEAAwE;IACxE,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACxD,kDAAkD;IAClD,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,EAAE,CAAA;IACzC,qEAAqE;IACrE,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAAA;IACvD,qGAAqG;IACrG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,CAAA;CACxC;AAED,uIAAuI;AACvI,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB;AAED,yDAAyD;AACzD,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;AAEvD,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAM,IAAuB,GAAG,aAAa,CA2BnF"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The daemon's per-project error state (#1500): a background job that finds a project in a state
3
+ * the user has to fix — and can only fix if told — records it here, and clears it the moment the
4
+ * state is good again. The dashboard renders what is recorded; nothing else reads it.
5
+ *
6
+ * The first emitter is the data-branch sync (#1599): a push origin rejects used to be a console
7
+ * line on the daemon's stdout and nothing else, which is the worst way to handle a state nobody
8
+ * can see.
9
+ *
10
+ * A project whose data stays on this machine is not an error: a folder with no origin, or one the
11
+ * person does not share, is a normal project. The sync records why as `local`, a note the
12
+ * dashboard says quietly.
13
+ *
14
+ * In memory on purpose. Every emitter re-evaluates on its own cadence — the sync every minute —
15
+ * so a restarted daemon re-learns each error within a tick, and there is no stale record to
16
+ * outlive the condition that raised it.
17
+ */
18
+ export function projectErrorStore(now = () => new Date()) {
19
+ const byProject = new Map();
20
+ const local = new Map();
21
+ const list = (projectPath) => [...(byProject.get(projectPath)?.values() ?? [])].sort((a, b) => a.since.localeCompare(b.since));
22
+ return {
23
+ set(projectPath, code, message) {
24
+ let errors = byProject.get(projectPath);
25
+ if (!errors)
26
+ byProject.set(projectPath, (errors = new Map()));
27
+ const since = errors.get(code)?.since ?? now().toISOString();
28
+ errors.set(code, { code, message, since });
29
+ },
30
+ clear(projectPath, code) {
31
+ const errors = byProject.get(projectPath);
32
+ if (!errors)
33
+ return;
34
+ errors.delete(code);
35
+ if (errors.size === 0)
36
+ byProject.delete(projectPath);
37
+ },
38
+ list,
39
+ setReach(projectPath, reach) {
40
+ if (reach === 'origin')
41
+ local.delete(projectPath);
42
+ else
43
+ local.set(projectPath, reach);
44
+ },
45
+ read(projectPath) {
46
+ const why = local.get(projectPath);
47
+ return { errors: list(projectPath), ...(why ? { local: why } : {}) };
48
+ },
49
+ };
50
+ }
51
+ //# sourceMappingURL=project-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-errors.js","sourceRoot":"","sources":["../src/project-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAkDH,MAAM,UAAU,iBAAiB,CAAC,GAAG,GAAe,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;IAClE,MAAM,SAAS,GAAG,IAAI,GAAG,EAA+C,CAAA;IACxE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAA;IAC3C,MAAM,IAAI,GAAG,CAAC,WAAmB,EAAkB,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;IACtJ,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ACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * A project's hooks (#1774): the shell lines a project's own `.openagent/hooks.yml` names to
3
+ * run when the dashboard opens and when it closes, the two lines that start a run and continue
4
+ * one, and the line that says whether a run can start here at all. The daemon calls no tool by
5
+ * name: it runs whatever the file says, in the project, with the project's installed tools and
6
+ * then the built-in packages' on the PATH, so a line reaches its tool with nothing fetched from npm. Per
7
+ * user, since `.openagent/` is ignored: a hook is this machine's, and a teammate's pull
8
+ * changes nothing.
9
+ *
10
+ * Optional, best-effort and bounded: no file means nothing runs, a broken file is a warning, an
11
+ * `open` or `close` line that fails or hangs is logged and the next line still runs, and nothing
12
+ * here ever throws to the daemon.
13
+ */
14
+ /** The hooks file, under the project's ignored `.openagent/`. */
15
+ export declare const PROJECT_HOOKS_FILE = ".openagent/hooks.yml";
16
+ /** How long one line may run before it is killed and logged as timed out. */
17
+ export declare const HOOK_TIMEOUT_MS = 60000;
18
+ /** When a project's hooks run: `open` when the dashboard starts (and when the project is added while it runs), `close` when it stops. */
19
+ export type HookKind = 'open' | 'close';
20
+ /**
21
+ * The two lines a person's click runs to start or continue a run: `start` begins a run from a
22
+ * prompt, `resume` continues an ended one with a text or an answer. One line each, since each
23
+ * answers one document on stdout.
24
+ */
25
+ export type RunHookKind = 'start' | 'resume';
26
+ export interface ProjectHooks {
27
+ open: string[];
28
+ close: string[];
29
+ start?: string;
30
+ resume?: string;
31
+ check?: string;
32
+ }
33
+ /**
34
+ * Read a project's hooks. A missing file is no hooks. A file that cannot be parsed or has the
35
+ * wrong shape is reported through `onWarn`, prefixed "ignoring", and counts as no hooks.
36
+ */
37
+ export declare function readProjectHooks(cwd: string, onWarn?: (message: string) => void): Promise<ProjectHooks>;
38
+ /**
39
+ * Parse the hooks file: a YAML map whose keys are `open` and `close`, each a list of shell lines,
40
+ * and `start`, `resume` and `check`, each one shell line. An empty document is no hooks. Anything else throws, so the reader can warn: a wrong key is
41
+ * refused rather than ignored, because a misspelled `open` would otherwise be a hook that
42
+ * silently never runs.
43
+ */
44
+ export declare function parseProjectHooks(raw: string, source?: string): ProjectHooks;
45
+ export interface RunHooksOptions {
46
+ /** Where each line's outcome and the tool's stderr go; default nowhere. */
47
+ log?: (line: string) => void;
48
+ /** How long one line may run; default {@link HOOK_TIMEOUT_MS}. */
49
+ timeoutMs?: number;
50
+ /** The environment the lines run with; default the daemon's own. */
51
+ env?: NodeJS.ProcessEnv;
52
+ }
53
+ /**
54
+ * Run a project's `open` or `close` lines, in order, each through `sh -c` with the project's
55
+ * root as working directory. A line that exits non-zero, times out or cannot start is logged and
56
+ * the next line still runs; the lines' stderr is logged too, since a tool's one line for a person
57
+ * goes there. Never throws.
58
+ */
59
+ export declare function runProjectHooks(cwd: string, kind: HookKind, opts?: RunHooksOptions): Promise<void>;
60
+ /** What a `start` line is given: the prompt, the coding agent, model, publish level and branch to start from when the person picked them, and the follow-up when there is one. */
61
+ export interface StartHookInput {
62
+ prompt: string;
63
+ driver?: string;
64
+ model?: string;
65
+ /** A fresh agent's prompt once the run ends done with a pull request; the merge waits for it. */
66
+ then?: string;
67
+ /** How far the run takes its work when its agent finishes: `commit`, `branch`, `pr` or `merge`. */
68
+ publish?: string;
69
+ /** The branch the run's own branch starts from; origin's default branch when absent. */
70
+ base?: string;
71
+ }
72
+ /**
73
+ * Whether a `start` line passes the branch to start from on: it mentions `$BASE` or `${BASE`. A
74
+ * line is written once and kept, so one written before the pick existed, or a person's own, may
75
+ * not; the launcher then offers no pick, rather than one the line would drop.
76
+ */
77
+ export declare function startLineTakesBase(line: string): boolean;
78
+ /** What a `resume` line is given: the run, and the person's text or their answer to the question it ended on. */
79
+ export type ResumeHookInput = {
80
+ runId: string;
81
+ } & ({
82
+ text: string;
83
+ } | {
84
+ answer: string;
85
+ });
86
+ export type RunHookResult = {
87
+ ok: true;
88
+ id: string;
89
+ } | {
90
+ ok: false;
91
+ error: string;
92
+ };
93
+ /**
94
+ * Run the project's `start` line: the prompt in `PROMPT`, the picks in `DRIVER`, `MODEL`,
95
+ * `PUBLISH` and `BASE` when made, the follow-up in `THEN` when there is one. The line answers one JSON
96
+ * document on stdout whose `id` names the run it started.
97
+ */
98
+ export declare function runStartHook(cwd: string, input: StartHookInput, opts?: Omit<RunHooksOptions, 'log'>): Promise<RunHookResult>;
99
+ /**
100
+ * Run the project's `resume` line: the run in `RUN_ID`, and the person's words in `TEXT` or their
101
+ * answer in `ANSWER`. The line answers like a `start` line, naming the run it continued.
102
+ */
103
+ export declare function runResumeHook(cwd: string, input: ResumeHookInput, opts?: Omit<RunHooksOptions, 'log'>): Promise<RunHookResult>;
104
+ /** What stands in the way of a run: problems stop it, warnings do not. One line each, each naming its fix. */
105
+ export interface StartReadiness {
106
+ problems: string[];
107
+ warnings: string[];
108
+ }
109
+ /** How a `check` line went; `noHook` when the project's file names no such line. */
110
+ export type CheckHookResult = ({
111
+ ok: true;
112
+ } & StartReadiness) | {
113
+ ok: false;
114
+ error: string;
115
+ noHook?: true;
116
+ };
117
+ /**
118
+ * Run the project's `check` line: the coding agent the person picked in `DRIVER`, when picked.
119
+ * The line answers one JSON document on stdout with `problems` and `warnings`, lists of lines.
120
+ */
121
+ export declare function runCheckHook(cwd: string, input: {
122
+ driver?: string;
123
+ }, opts?: Omit<RunHooksOptions, 'log'>): Promise<CheckHookResult>;
124
+ /**
125
+ * The environment a line runs with: the PATH led by the project's installed tools, then the
126
+ * built-in packages' own commands, so a tool named in a line is the project's copy when it
127
+ * installed one and the dashboard's otherwise, and never a package fetched by name.
128
+ */
129
+ export declare function hookEnv(cwd: string, env: NodeJS.ProcessEnv): Promise<NodeJS.ProcessEnv>;
130
+ //# sourceMappingURL=project-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-hooks.d.ts","sourceRoot":"","sources":["../src/project-hooks.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;GAYG;AAEH,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,yBAA+B,CAAA;AAE9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BAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,GAAE,IAAI,CAAC,eAAe,EAAE,KAAK,CAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAuB7I;AAED;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAE7F"}
@@ -0,0 +1,232 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { basename, delimiter, join } from 'node:path';
4
+ import { parse as parseYaml } from 'yaml';
5
+ import { builtInBinDirs } from './built-in.js';
6
+ import { errorMessage } from './error-message.js';
7
+ import { OPENAGENT_DIR } from './openagent-dir.js';
8
+ /**
9
+ * A project's hooks (#1774): the shell lines a project's own `.openagent/hooks.yml` names to
10
+ * run when the dashboard opens and when it closes, the two lines that start a run and continue
11
+ * one, and the line that says whether a run can start here at all. The daemon calls no tool by
12
+ * name: it runs whatever the file says, in the project, with the project's installed tools and
13
+ * then the built-in packages' on the PATH, so a line reaches its tool with nothing fetched from npm. Per
14
+ * user, since `.openagent/` is ignored: a hook is this machine's, and a teammate's pull
15
+ * changes nothing.
16
+ *
17
+ * Optional, best-effort and bounded: no file means nothing runs, a broken file is a warning, an
18
+ * `open` or `close` line that fails or hangs is logged and the next line still runs, and nothing
19
+ * here ever throws to the daemon.
20
+ */
21
+ /** The hooks file, under the project's ignored `.openagent/`. */
22
+ export const PROJECT_HOOKS_FILE = `${OPENAGENT_DIR}/hooks.yml`;
23
+ /** How long one line may run before it is killed and logged as timed out. */
24
+ export const HOOK_TIMEOUT_MS = 60_000;
25
+ const HOOK_KINDS = ['open', 'close'];
26
+ const ONE_LINE_HOOK_KINDS = ['start', 'resume', 'check'];
27
+ /**
28
+ * Read a project's hooks. A missing file is no hooks. A file that cannot be parsed or has the
29
+ * wrong shape is reported through `onWarn`, prefixed "ignoring", and counts as no hooks.
30
+ */
31
+ export async function readProjectHooks(cwd, onWarn) {
32
+ let raw;
33
+ try {
34
+ raw = await readFile(join(cwd, PROJECT_HOOKS_FILE), 'utf8');
35
+ }
36
+ catch {
37
+ return { open: [], close: [] };
38
+ }
39
+ try {
40
+ return parseProjectHooks(raw);
41
+ }
42
+ catch (err) {
43
+ onWarn?.(`ignoring ${errorMessage(err)}`);
44
+ return { open: [], close: [] };
45
+ }
46
+ }
47
+ /**
48
+ * Parse the hooks file: a YAML map whose keys are `open` and `close`, each a list of shell lines,
49
+ * and `start`, `resume` and `check`, each one shell line. An empty document is no hooks. Anything else throws, so the reader can warn: a wrong key is
50
+ * refused rather than ignored, because a misspelled `open` would otherwise be a hook that
51
+ * silently never runs.
52
+ */
53
+ export function parseProjectHooks(raw, source = PROJECT_HOOKS_FILE) {
54
+ let data;
55
+ try {
56
+ data = parseYaml(raw);
57
+ }
58
+ catch (err) {
59
+ // The parser's message runs to several lines with a caret drawing; the first line says what is wrong.
60
+ throw new Error(`${source}: ${errorMessage(err).split('\n')[0]}`);
61
+ }
62
+ const hooks = { open: [], close: [] };
63
+ if (data == null)
64
+ return hooks;
65
+ if (typeof data !== 'object' || Array.isArray(data))
66
+ throw new Error(`${source} must be a YAML map; the keys are open, close, start, resume and check`);
67
+ for (const [key, value] of Object.entries(data)) {
68
+ const isOneLine = ONE_LINE_HOOK_KINDS.includes(key);
69
+ if (!isOneLine && !HOOK_KINDS.includes(key))
70
+ throw new Error(`${source}: unknown key "${key}"; the keys are open, close, start, resume and check`);
71
+ if (value == null)
72
+ continue;
73
+ if (isOneLine) {
74
+ if (typeof value !== 'string' || value.trim() === '')
75
+ throw new Error(`${source}: "${key}" must be one shell line`);
76
+ hooks[key] = value.trim();
77
+ continue;
78
+ }
79
+ if (!Array.isArray(value) || !value.every(line => typeof line === 'string' && line.trim() !== '')) {
80
+ throw new Error(`${source}: "${key}" must be a list of shell lines`);
81
+ }
82
+ hooks[key] = value.map(line => line.trim());
83
+ }
84
+ return hooks;
85
+ }
86
+ /**
87
+ * Run a project's `open` or `close` lines, in order, each through `sh -c` with the project's
88
+ * root as working directory. A line that exits non-zero, times out or cannot start is logged and
89
+ * the next line still runs; the lines' stderr is logged too, since a tool's one line for a person
90
+ * goes there. Never throws.
91
+ */
92
+ export async function runProjectHooks(cwd, kind, opts = {}) {
93
+ const log = opts.log ?? (() => { });
94
+ const hooks = await readProjectHooks(cwd, message => log(`[openagent] ${kind} hook (${basename(cwd)}): ${message}`));
95
+ for (const line of hooks[kind]) {
96
+ const outcome = await runLine(cwd, line, opts.timeoutMs ?? HOOK_TIMEOUT_MS, opts.env ?? process.env);
97
+ log(`[openagent] ${kind} hook (${basename(cwd)}): ${line}: ${outcome.summary}`);
98
+ for (const said of outcome.stderr.split('\n').map(s => s.trimEnd()).filter(Boolean))
99
+ log(`[openagent] ${said}`);
100
+ }
101
+ }
102
+ /**
103
+ * Whether a `start` line passes the branch to start from on: it mentions `$BASE` or `${BASE`. A
104
+ * line is written once and kept, so one written before the pick existed, or a person's own, may
105
+ * not; the launcher then offers no pick, rather than one the line would drop.
106
+ */
107
+ export function startLineTakesBase(line) {
108
+ return /\$\{?BASE\b/.test(line);
109
+ }
110
+ /**
111
+ * Run the project's `start` line: the prompt in `PROMPT`, the picks in `DRIVER`, `MODEL`,
112
+ * `PUBLISH` and `BASE` when made, the follow-up in `THEN` when there is one. The line answers one JSON
113
+ * document on stdout whose `id` names the run it started.
114
+ */
115
+ export function runStartHook(cwd, input, opts = {}) {
116
+ return runRunHook(cwd, 'start', {
117
+ PROMPT: input.prompt,
118
+ ...(input.driver !== undefined ? { DRIVER: input.driver } : {}),
119
+ ...(input.model !== undefined ? { MODEL: input.model } : {}),
120
+ ...(input.then !== undefined ? { THEN: input.then } : {}),
121
+ ...(input.publish !== undefined ? { PUBLISH: input.publish } : {}),
122
+ ...(input.base !== undefined ? { BASE: input.base } : {}),
123
+ }, opts);
124
+ }
125
+ /**
126
+ * Run the project's `resume` line: the run in `RUN_ID`, and the person's words in `TEXT` or their
127
+ * answer in `ANSWER`. The line answers like a `start` line, naming the run it continued.
128
+ */
129
+ export function runResumeHook(cwd, input, opts = {}) {
130
+ return runRunHook(cwd, 'resume', { RUN_ID: input.runId, ...('text' in input ? { TEXT: input.text } : { ANSWER: input.answer }) }, opts);
131
+ }
132
+ async function runRunHook(cwd, kind, vars, opts) {
133
+ let broken;
134
+ const hooks = await readProjectHooks(cwd, message => {
135
+ broken = message;
136
+ });
137
+ const line = hooks[kind];
138
+ if (line === undefined)
139
+ return { ok: false, error: broken ?? `this project has no ${kind} hook` };
140
+ const outcome = await runLine(cwd, line, opts.timeoutMs ?? HOOK_TIMEOUT_MS, { ...(opts.env ?? process.env), ...vars }, true);
141
+ let said;
142
+ try {
143
+ said = JSON.parse(outcome.stdout);
144
+ }
145
+ catch {
146
+ said = undefined;
147
+ }
148
+ const id = said && typeof said === 'object' ? said['id'] : undefined;
149
+ if (outcome.summary === 'exit 0' && typeof id === 'string' && id !== '')
150
+ return { ok: true, id };
151
+ // The tool's one line for a person is its last on stderr; without one, how the line ended.
152
+ const lastSaid = outcome.stderr.split('\n').map(s => s.trim()).filter(Boolean).at(-1);
153
+ return { ok: false, error: `the ${kind} hook: ${lastSaid ?? (outcome.summary === 'exit 0' ? 'it answered no run id' : outcome.summary)}` };
154
+ }
155
+ /**
156
+ * Run the project's `check` line: the coding agent the person picked in `DRIVER`, when picked.
157
+ * The line answers one JSON document on stdout with `problems` and `warnings`, lists of lines.
158
+ */
159
+ export async function runCheckHook(cwd, input, opts = {}) {
160
+ let broken;
161
+ const hooks = await readProjectHooks(cwd, message => {
162
+ broken = message;
163
+ });
164
+ if (hooks.check === undefined)
165
+ return broken ? { ok: false, error: broken } : { ok: false, error: 'this project has no check hook', noHook: true };
166
+ const vars = input.driver !== undefined ? { DRIVER: input.driver } : {};
167
+ const outcome = await runLine(cwd, hooks.check, opts.timeoutMs ?? HOOK_TIMEOUT_MS, { ...(opts.env ?? process.env), ...vars }, true);
168
+ let said;
169
+ try {
170
+ said = JSON.parse(outcome.stdout);
171
+ }
172
+ catch {
173
+ said = undefined;
174
+ }
175
+ const lines = (key) => {
176
+ const value = said && typeof said === 'object' ? said[key] : undefined;
177
+ return Array.isArray(value) && value.every(line => typeof line === 'string') ? value : undefined;
178
+ };
179
+ const problems = lines('problems');
180
+ const warnings = lines('warnings');
181
+ if (outcome.summary === 'exit 0' && problems && warnings)
182
+ return { ok: true, problems, warnings };
183
+ const lastSaid = outcome.stderr.split('\n').map(s => s.trim()).filter(Boolean).at(-1);
184
+ return { ok: false, error: `the check hook: ${lastSaid ?? (outcome.summary === 'exit 0' ? 'it answered no problems and warnings' : outcome.summary)}` };
185
+ }
186
+ /**
187
+ * The environment a line runs with: the PATH led by the project's installed tools, then the
188
+ * built-in packages' own commands, so a tool named in a line is the project's copy when it
189
+ * installed one and the dashboard's otherwise, and never a package fetched by name.
190
+ */
191
+ export async function hookEnv(cwd, env) {
192
+ return { ...env, PATH: [join(cwd, 'node_modules', '.bin'), ...(await builtInBinDirs()), env['PATH']].filter(Boolean).join(delimiter) };
193
+ }
194
+ /** One line through the shell: how it ended, in words, what it said on stderr, and its stdout when asked for. */
195
+ async function runLine(cwd, line, timeoutMs, baseEnv, readStdout = false) {
196
+ const env = await hookEnv(cwd, baseEnv);
197
+ return new Promise(resolve => {
198
+ let stderr = '';
199
+ let stdout = '';
200
+ let settled = false;
201
+ const done = (summary) => {
202
+ if (settled)
203
+ return;
204
+ settled = true;
205
+ clearTimeout(timer);
206
+ resolve({ summary, stderr, stdout });
207
+ };
208
+ let child;
209
+ try {
210
+ child = spawn('sh', ['-c', line], { cwd, env, stdio: ['ignore', readStdout ? 'pipe' : 'ignore', 'pipe'] });
211
+ }
212
+ catch (err) {
213
+ done(`could not start: ${errorMessage(err)}`);
214
+ return;
215
+ }
216
+ const timer = setTimeout(() => {
217
+ child.kill('SIGKILL');
218
+ done(`timed out after ${Math.round(timeoutMs / 1000)}s`);
219
+ }, timeoutMs);
220
+ child.stderr?.setEncoding('utf8');
221
+ child.stderr?.on('data', (chunk) => {
222
+ stderr += chunk;
223
+ });
224
+ child.stdout?.setEncoding('utf8');
225
+ child.stdout?.on('data', (chunk) => {
226
+ stdout += chunk;
227
+ });
228
+ child.once('error', err => done(`could not start: ${errorMessage(err)}`));
229
+ child.once('close', (code, signal) => done(signal ? `killed by ${signal}` : `exit ${code ?? 0}`));
230
+ });
231
+ }
232
+ //# sourceMappingURL=project-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-hooks.js","sourceRoot":"","sources":["../src/project-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD;;;;;;;;;;;;GAYG;AAEH,iEAAiE;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,aAAa,YAAY,CAAA;AAE9D,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAA;AAuBrC,MAAM,UAAU,GAAwB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACzD,MAAM,mBAAmB,GAA+B,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;AAEpF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAW,EAAE,MAAkC;IACpF,IAAI,G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C,CAAA;QACb,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;QACjC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACzC,MAAM,IAAI,KAAK,CAAA;QACjB,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;QACjC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACzC,MAAM,IAAI,KAAK,CAAA;QACjB,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,oBAAoB,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;QACzE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IACnG,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { type PackageCommandResult } from '@openagt/agent-data';
2
+ /**
3
+ * A package that adds to the dashboard (#1774): its browser part, named by its
4
+ * `exports["./dashboard"]`, and optionally its server part, named by `exports["./server"]`.
5
+ * OpenAgent names no package: any dependency of the project that exports `./dashboard` is a
6
+ * module, whoever wrote it, and OpenAgent's own built-in modules come the same way.
7
+ */
8
+ export interface ProjectModule {
9
+ /** The package's name, as the project's package.json lists it. */
10
+ package: string;
11
+ /** The package's version, when its package.json says one. */
12
+ version?: string;
13
+ /** The directory the module's browser part sits in, symlinks resolved: the only directory served for it. */
14
+ dir: string;
15
+ /** The module's browser part's file name inside {@link dir}. */
16
+ entry: string;
17
+ /** The package's commands, by name, as absolute paths: what the module may run in this project. */
18
+ bins: Record<string, string>;
19
+ /** The module's server part, an absolute path inside the package, when it has one. */
20
+ server?: string;
21
+ }
22
+ /**
23
+ * The modules a project has: each of its dependencies whose package.json exports `./dashboard` to
24
+ * a file that exists inside the package, plus the modules among OpenAgent's built-in packages (`built-in.ts`). A project that
25
+ * depends on a built-in module's package itself gets its own copy. Sorted by name.
26
+ */
27
+ export declare function readProjectModules(root: string): Promise<ProjectModule[]>;
28
+ /** The one module of this project that `name` names, or undefined. */
29
+ export declare function findProjectModule(root: string, name: string): Promise<ProjectModule | undefined>;
30
+ /**
31
+ * The file a module serves at `rel`, a path relative to its module's directory: its module, its
32
+ * stylesheet, a chunk. `undefined` for a path that leaves that directory (symlinks resolved) or
33
+ * names no file, so nothing else of the package, and nothing of the project, is ever served.
34
+ */
35
+ export declare function moduleFile(module: ProjectModule, rel: string): Promise<string | undefined>;
36
+ /** What a module's command answered: its JSON output, or why there is none. */
37
+ export type ModuleCommandResult = PackageCommandResult;
38
+ /**
39
+ * Run one of a module package's own commands in the project, with the given arguments, and read
40
+ * its standard output as JSON. This is how a module reads its data: the same command an agent runs
41
+ * (`npx logs`), so the module and the agent see the same thing and OpenAgent knows neither.
42
+ *
43
+ * `command` picks one of the package's commands; a package with exactly one needs none. The
44
+ * command runs with Node (a package's commands are Node scripts), in the project root, never
45
+ * through a shell, bounded in time and output. Refused: a command the package does not have, too
46
+ * many or too long arguments. A command that exits non-zero answers its last stderr line; one that
47
+ * prints no JSON says so.
48
+ */
49
+ export declare function runModuleCommand(root: string, module: ProjectModule, args: readonly string[], command?: string): Promise<ModuleCommandResult>;
50
+ //# sourceMappingURL=project-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-modules.d.ts","sourceRoot":"","sources":["../src/project-modules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiE,KAAK,oBAAoB,EAAuB,MAAM,qBAAqB,CAAA;AAGnJ;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4GAA4G;IAC5G,GAAG,EAAE,MAAM,CAAA;IACX,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAA;IACb,mGAAmG;IACnG,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AA4BD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAY/E;AAgBD,sEAAsE;AACtE,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAEtG;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAKhG;AAED,+EAA+E;AAC/E,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAA;AAMtD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CAS9B"}