fnloom 0.0.1 → 0.2.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 (1520) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +174 -3
  3. package/package.json +70 -4
  4. package/packages/build/package.json +31 -0
  5. package/packages/build/src/build-system.ts +186 -0
  6. package/packages/build/src/builder.ts +225 -0
  7. package/packages/build/src/context.ts +2 -0
  8. package/packages/build/src/files.ts +73 -0
  9. package/packages/build/src/folder.ts +52 -0
  10. package/packages/build/src/index.ts +20 -0
  11. package/packages/build/src/scan.ts +82 -0
  12. package/packages/build/src/tests.ts +138 -0
  13. package/packages/build/tsconfig.json +6 -0
  14. package/packages/cli/bin/harness.mjs +17 -0
  15. package/packages/cli/package.json +27 -0
  16. package/packages/cli/src/catalog.ts +35 -0
  17. package/packages/cli/src/cli.ts +83 -0
  18. package/packages/cli/src/command.ts +112 -0
  19. package/packages/cli/src/commands/available.ts +107 -0
  20. package/packages/cli/src/commands/build.ts +57 -0
  21. package/packages/cli/src/commands/data.ts +36 -0
  22. package/packages/cli/src/commands/install.ts +167 -0
  23. package/packages/cli/src/commands/manage.ts +104 -0
  24. package/packages/cli/src/commands/mcp.ts +198 -0
  25. package/packages/cli/src/commands/new.ts +139 -0
  26. package/packages/cli/src/commands/pack.ts +37 -0
  27. package/packages/cli/src/commands/start.ts +22 -0
  28. package/packages/cli/src/commands/test.ts +57 -0
  29. package/packages/cli/src/files.ts +5 -0
  30. package/packages/cli/src/hub-client.ts +84 -0
  31. package/packages/cli/src/hub.ts +169 -0
  32. package/packages/cli/src/index.ts +13 -0
  33. package/packages/cli/src/io.ts +32 -0
  34. package/packages/cli/src/live.ts +66 -0
  35. package/packages/cli/src/local.ts +100 -0
  36. package/packages/cli/src/main.ts +6 -0
  37. package/packages/cli/src/premade.ts +80 -0
  38. package/packages/cli/src/testing.ts +216 -0
  39. package/packages/cli/tsconfig.json +6 -0
  40. package/packages/core/package.json +21 -0
  41. package/packages/core/src/access.ts +97 -0
  42. package/packages/core/src/admin.ts +90 -0
  43. package/packages/core/src/api-index.ts +26 -0
  44. package/packages/core/src/approvals.ts +229 -0
  45. package/packages/core/src/auto-pair.ts +47 -0
  46. package/packages/core/src/changes.ts +61 -0
  47. package/packages/core/src/checks.ts +93 -0
  48. package/packages/core/src/claims.ts +98 -0
  49. package/packages/core/src/compare.ts +47 -0
  50. package/packages/core/src/config-secrets.ts +28 -0
  51. package/packages/core/src/connections.ts +193 -0
  52. package/packages/core/src/context-files.ts +179 -0
  53. package/packages/core/src/context-graph.ts +270 -0
  54. package/packages/core/src/csv.ts +33 -0
  55. package/packages/core/src/data.ts +176 -0
  56. package/packages/core/src/decisions.ts +98 -0
  57. package/packages/core/src/flow.ts +225 -0
  58. package/packages/core/src/fn-block.ts +51 -0
  59. package/packages/core/src/fn-facts.ts +533 -0
  60. package/packages/core/src/fn-renames.ts +102 -0
  61. package/packages/core/src/gin-a.ts +185 -0
  62. package/packages/core/src/gin-record.ts +142 -0
  63. package/packages/core/src/gin.ts +104 -0
  64. package/packages/core/src/grants.ts +84 -0
  65. package/packages/core/src/graph-kinds.ts +44 -0
  66. package/packages/core/src/graph.ts +95 -0
  67. package/packages/core/src/https.ts +35 -0
  68. package/packages/core/src/identity.ts +38 -0
  69. package/packages/core/src/image-embeddings.ts +96 -0
  70. package/packages/core/src/index.ts +129 -0
  71. package/packages/core/src/inject.ts +104 -0
  72. package/packages/core/src/issues.ts +137 -0
  73. package/packages/core/src/labels.ts +96 -0
  74. package/packages/core/src/lifecycle.ts +237 -0
  75. package/packages/core/src/link.ts +491 -0
  76. package/packages/core/src/llm.ts +167 -0
  77. package/packages/core/src/manifest.ts +657 -0
  78. package/packages/core/src/mcp-servers.ts +134 -0
  79. package/packages/core/src/media-types.ts +145 -0
  80. package/packages/core/src/mention-search.ts +27 -0
  81. package/packages/core/src/metrics.ts +91 -0
  82. package/packages/core/src/model-calls.ts +223 -0
  83. package/packages/core/src/model-names.ts +704 -0
  84. package/packages/core/src/modes.ts +325 -0
  85. package/packages/core/src/objects.ts +15 -0
  86. package/packages/core/src/owner-runs.ts +89 -0
  87. package/packages/core/src/package.ts +195 -0
  88. package/packages/core/src/partial.ts +69 -0
  89. package/packages/core/src/people-only.ts +52 -0
  90. package/packages/core/src/pickers.ts +31 -0
  91. package/packages/core/src/ports.ts +14 -0
  92. package/packages/core/src/primitives.ts +287 -0
  93. package/packages/core/src/programs.ts +155 -0
  94. package/packages/core/src/query.ts +264 -0
  95. package/packages/core/src/records/actors.ts +188 -0
  96. package/packages/core/src/records/announced.ts +39 -0
  97. package/packages/core/src/records/chat.ts +279 -0
  98. package/packages/core/src/records/citations.ts +126 -0
  99. package/packages/core/src/records/compare.ts +97 -0
  100. package/packages/core/src/records/content.ts +196 -0
  101. package/packages/core/src/records/injections.ts +146 -0
  102. package/packages/core/src/records/mcps.ts +115 -0
  103. package/packages/core/src/records/runs.ts +280 -0
  104. package/packages/core/src/records/spend.ts +158 -0
  105. package/packages/core/src/records/systems.ts +298 -0
  106. package/packages/core/src/records/tables.ts +164 -0
  107. package/packages/core/src/registries.ts +229 -0
  108. package/packages/core/src/remote-auth.ts +111 -0
  109. package/packages/core/src/resource-forms.ts +218 -0
  110. package/packages/core/src/resources.ts +166 -0
  111. package/packages/core/src/review-summary.ts +69 -0
  112. package/packages/core/src/run.ts +312 -0
  113. package/packages/core/src/sensitivity.ts +101 -0
  114. package/packages/core/src/sso.ts +268 -0
  115. package/packages/core/src/status.ts +158 -0
  116. package/packages/core/src/suggestions.ts +228 -0
  117. package/packages/core/src/system-events.ts +47 -0
  118. package/packages/core/src/system-pages.ts +72 -0
  119. package/packages/core/src/system-parts.ts +51 -0
  120. package/packages/core/src/system-providers.ts +163 -0
  121. package/packages/core/src/urls.ts +50 -0
  122. package/packages/core/src/validation.ts +39 -0
  123. package/packages/core/src/versions.ts +52 -0
  124. package/packages/core/src/visuals.ts +478 -0
  125. package/packages/core/src/web.ts +965 -0
  126. package/packages/core/src/widgets-v1.ts +73 -0
  127. package/packages/core/src/widgets.ts +427 -0
  128. package/packages/core/tsconfig.json +5 -0
  129. package/packages/hub/context/asking.md +16 -0
  130. package/packages/hub/context/attached_files.md +27 -0
  131. package/packages/hub/context/background_runs.md +14 -0
  132. package/packages/hub/context/earlier_chats.md +16 -0
  133. package/packages/hub/context/examples.md +13 -0
  134. package/packages/hub/context/finding_fns.md +18 -0
  135. package/packages/hub/context/images.md +24 -0
  136. package/packages/hub/context/later.md +27 -0
  137. package/packages/hub/context/limits.md +13 -0
  138. package/packages/hub/context/memory.md +38 -0
  139. package/packages/hub/context/resources.md +21 -0
  140. package/packages/hub/context/saved_fns.md +28 -0
  141. package/packages/hub/context/undo.md +20 -0
  142. package/packages/hub/package.json +55 -0
  143. package/packages/hub/src/access/create.ts +29 -0
  144. package/packages/hub/src/access/hits.ts +57 -0
  145. package/packages/hub/src/access/index.ts +119 -0
  146. package/packages/hub/src/access/scope.ts +133 -0
  147. package/packages/hub/src/access/service.ts +171 -0
  148. package/packages/hub/src/api/admin-ops.ts +410 -0
  149. package/packages/hub/src/api/auth.ts +286 -0
  150. package/packages/hub/src/api/client-address.ts +55 -0
  151. package/packages/hub/src/api/connect.ts +45 -0
  152. package/packages/hub/src/api/dual.ts +103 -0
  153. package/packages/hub/src/api/events.ts +185 -0
  154. package/packages/hub/src/api/files.ts +209 -0
  155. package/packages/hub/src/api/hash.ts +23 -0
  156. package/packages/hub/src/api/http.ts +171 -0
  157. package/packages/hub/src/api/https.ts +125 -0
  158. package/packages/hub/src/api/identities.ts +246 -0
  159. package/packages/hub/src/api/index.ts +94 -0
  160. package/packages/hub/src/api/injections.ts +256 -0
  161. package/packages/hub/src/api/mime.ts +31 -0
  162. package/packages/hub/src/api/person-ops.ts +153 -0
  163. package/packages/hub/src/api/push.ts +97 -0
  164. package/packages/hub/src/api/reads.ts +145 -0
  165. package/packages/hub/src/api/secrets.ts +71 -0
  166. package/packages/hub/src/api/serve.ts +280 -0
  167. package/packages/hub/src/api/signed.ts +66 -0
  168. package/packages/hub/src/api/sso-route.ts +73 -0
  169. package/packages/hub/src/api/sso.ts +382 -0
  170. package/packages/hub/src/api/system-parts.ts +97 -0
  171. package/packages/hub/src/api/testing/issuer.ts +128 -0
  172. package/packages/hub/src/api/testing/rig.ts +272 -0
  173. package/packages/hub/src/api/tls.ts +383 -0
  174. package/packages/hub/src/api/web/access.ts +84 -0
  175. package/packages/hub/src/api/web/admin.ts +90 -0
  176. package/packages/hub/src/api/web/auth.ts +103 -0
  177. package/packages/hub/src/api/web/build3.ts +44 -0
  178. package/packages/hub/src/api/web/build4.ts +24 -0
  179. package/packages/hub/src/api/web/build5.ts +120 -0
  180. package/packages/hub/src/api/web/chat.ts +144 -0
  181. package/packages/hub/src/api/web/content.ts +42 -0
  182. package/packages/hub/src/api/web/context.ts +41 -0
  183. package/packages/hub/src/api/web/contextor.ts +37 -0
  184. package/packages/hub/src/api/web/data.ts +33 -0
  185. package/packages/hub/src/api/web/explorer.ts +22 -0
  186. package/packages/hub/src/api/web/find.ts +50 -0
  187. package/packages/hub/src/api/web/graph.ts +17 -0
  188. package/packages/hub/src/api/web/https.ts +18 -0
  189. package/packages/hub/src/api/web/identity.ts +18 -0
  190. package/packages/hub/src/api/web/images.ts +18 -0
  191. package/packages/hub/src/api/web/inbox.ts +35 -0
  192. package/packages/hub/src/api/web/index.ts +137 -0
  193. package/packages/hub/src/api/web/injections.ts +22 -0
  194. package/packages/hub/src/api/web/mcps.ts +32 -0
  195. package/packages/hub/src/api/web/metrics.ts +24 -0
  196. package/packages/hub/src/api/web/models.ts +21 -0
  197. package/packages/hub/src/api/web/outside-images.ts +32 -0
  198. package/packages/hub/src/api/web/packaging.ts +31 -0
  199. package/packages/hub/src/api/web/pages.ts +55 -0
  200. package/packages/hub/src/api/web/people.ts +92 -0
  201. package/packages/hub/src/api/web/pickers.ts +115 -0
  202. package/packages/hub/src/api/web/resources.ts +42 -0
  203. package/packages/hub/src/api/web/review.ts +119 -0
  204. package/packages/hub/src/api/web/runs.ts +94 -0
  205. package/packages/hub/src/api/web/settings.ts +35 -0
  206. package/packages/hub/src/api/web/systems.ts +83 -0
  207. package/packages/hub/src/api/web/tables.ts +31 -0
  208. package/packages/hub/src/api/web/versions.ts +17 -0
  209. package/packages/hub/src/api/web/visibility.ts +47 -0
  210. package/packages/hub/src/boot/admin-fns.ts +78 -0
  211. package/packages/hub/src/boot/admin-secrets.ts +140 -0
  212. package/packages/hub/src/boot/env.ts +170 -0
  213. package/packages/hub/src/boot/hub-context.ts +39 -0
  214. package/packages/hub/src/boot/hub-fns.ts +549 -0
  215. package/packages/hub/src/boot/hub-groups.ts +34 -0
  216. package/packages/hub/src/boot/identity.ts +66 -0
  217. package/packages/hub/src/boot/index.ts +191 -0
  218. package/packages/hub/src/boot/info.ts +22 -0
  219. package/packages/hub/src/boot/keys.ts +60 -0
  220. package/packages/hub/src/boot/log.ts +31 -0
  221. package/packages/hub/src/boot/modules.ts +277 -0
  222. package/packages/hub/src/boot/person-fns.ts +78 -0
  223. package/packages/hub/src/boot/read-fns.ts +73 -0
  224. package/packages/hub/src/boot/services.ts +156 -0
  225. package/packages/hub/src/boot/start.ts +246 -0
  226. package/packages/hub/src/bus/memory.ts +60 -0
  227. package/packages/hub/src/bus.ts +80 -0
  228. package/packages/hub/src/catalog/api-index.ts +72 -0
  229. package/packages/hub/src/catalog/availability.ts +210 -0
  230. package/packages/hub/src/catalog/catalog.ts +1062 -0
  231. package/packages/hub/src/catalog/definitions.ts +19 -0
  232. package/packages/hub/src/catalog/fixtures.ts +82 -0
  233. package/packages/hub/src/catalog/fn-names.ts +128 -0
  234. package/packages/hub/src/catalog/index.ts +126 -0
  235. package/packages/hub/src/catalog/injections.ts +90 -0
  236. package/packages/hub/src/catalog/scope.ts +86 -0
  237. package/packages/hub/src/catalog/serial.ts +10 -0
  238. package/packages/hub/src/catalog/signature.ts +69 -0
  239. package/packages/hub/src/catalog/versions.ts +110 -0
  240. package/packages/hub/src/chat/announce.ts +145 -0
  241. package/packages/hub/src/chat/cache.ts +50 -0
  242. package/packages/hub/src/chat/chat.ts +72 -0
  243. package/packages/hub/src/chat/cite-rule.ts +64 -0
  244. package/packages/hub/src/chat/cites.ts +236 -0
  245. package/packages/hub/src/chat/compare.ts +290 -0
  246. package/packages/hub/src/chat/deliveries.ts +187 -0
  247. package/packages/hub/src/chat/deps.ts +69 -0
  248. package/packages/hub/src/chat/enrich.ts +601 -0
  249. package/packages/hub/src/chat/env.ts +33 -0
  250. package/packages/hub/src/chat/errors.ts +38 -0
  251. package/packages/hub/src/chat/files.ts +72 -0
  252. package/packages/hub/src/chat/index.ts +259 -0
  253. package/packages/hub/src/chat/mention-requests.ts +49 -0
  254. package/packages/hub/src/chat/mention-search.ts +64 -0
  255. package/packages/hub/src/chat/mentions.ts +274 -0
  256. package/packages/hub/src/chat/notifications.ts +278 -0
  257. package/packages/hub/src/chat/people.ts +59 -0
  258. package/packages/hub/src/chat/presence.ts +48 -0
  259. package/packages/hub/src/chat/reply.ts +23 -0
  260. package/packages/hub/src/chat/sessions.ts +306 -0
  261. package/packages/hub/src/chat/shown.ts +158 -0
  262. package/packages/hub/src/chat/state.ts +270 -0
  263. package/packages/hub/src/chat/streams.ts +92 -0
  264. package/packages/hub/src/chat/suggestions.ts +383 -0
  265. package/packages/hub/src/chat/support.ts +144 -0
  266. package/packages/hub/src/chat/testing.ts +488 -0
  267. package/packages/hub/src/chat/turns.ts +586 -0
  268. package/packages/hub/src/chat/undo.ts +177 -0
  269. package/packages/hub/src/connections/create.ts +25 -0
  270. package/packages/hub/src/connections/env.ts +14 -0
  271. package/packages/hub/src/connections/index.ts +86 -0
  272. package/packages/hub/src/connections/service.ts +536 -0
  273. package/packages/hub/src/contextor/brought.ts +64 -0
  274. package/packages/hub/src/contextor/budget.ts +74 -0
  275. package/packages/hub/src/contextor/calibration.ts +35 -0
  276. package/packages/hub/src/contextor/choose.ts +116 -0
  277. package/packages/hub/src/contextor/contextors.ts +550 -0
  278. package/packages/hub/src/contextor/crawl.ts +252 -0
  279. package/packages/hub/src/contextor/create.ts +113 -0
  280. package/packages/hub/src/contextor/dynamic.ts +102 -0
  281. package/packages/hub/src/contextor/env.ts +83 -0
  282. package/packages/hub/src/contextor/examples.ts +204 -0
  283. package/packages/hub/src/contextor/fns.ts +147 -0
  284. package/packages/hub/src/contextor/graph.ts +137 -0
  285. package/packages/hub/src/contextor/history.ts +211 -0
  286. package/packages/hub/src/contextor/index.ts +524 -0
  287. package/packages/hub/src/contextor/injected.ts +401 -0
  288. package/packages/hub/src/contextor/limits.ts +168 -0
  289. package/packages/hub/src/contextor/links.ts +67 -0
  290. package/packages/hub/src/contextor/modes.ts +520 -0
  291. package/packages/hub/src/contextor/planner.ts +626 -0
  292. package/packages/hub/src/contextor/render.ts +531 -0
  293. package/packages/hub/src/contextor/score.ts +93 -0
  294. package/packages/hub/src/contextor/testing.ts +161 -0
  295. package/packages/hub/src/contextor/tokens.ts +102 -0
  296. package/packages/hub/src/contextor/views.ts +171 -0
  297. package/packages/hub/src/contextor/xml.ts +140 -0
  298. package/packages/hub/src/data/create.ts +45 -0
  299. package/packages/hub/src/data/env.ts +16 -0
  300. package/packages/hub/src/data/fields.ts +71 -0
  301. package/packages/hub/src/data/fns.ts +50 -0
  302. package/packages/hub/src/data/index.ts +50 -0
  303. package/packages/hub/src/data/service.ts +348 -0
  304. package/packages/hub/src/execution/agent.ts +1381 -0
  305. package/packages/hub/src/execution/ai.ts +408 -0
  306. package/packages/hub/src/execution/channel.ts +38 -0
  307. package/packages/hub/src/execution/claims.ts +103 -0
  308. package/packages/hub/src/execution/create.ts +261 -0
  309. package/packages/hub/src/execution/deadlines.ts +74 -0
  310. package/packages/hub/src/execution/deciders.ts +60 -0
  311. package/packages/hub/src/execution/env.ts +28 -0
  312. package/packages/hub/src/execution/errors.ts +103 -0
  313. package/packages/hub/src/execution/executors.ts +246 -0
  314. package/packages/hub/src/execution/gateway.ts +209 -0
  315. package/packages/hub/src/execution/handlers.ts +154 -0
  316. package/packages/hub/src/execution/hub-fns.ts +50 -0
  317. package/packages/hub/src/execution/index.ts +244 -0
  318. package/packages/hub/src/execution/interactions.ts +65 -0
  319. package/packages/hub/src/execution/ledger.ts +168 -0
  320. package/packages/hub/src/execution/limits.ts +175 -0
  321. package/packages/hub/src/execution/link-handlers.ts +142 -0
  322. package/packages/hub/src/execution/media.ts +240 -0
  323. package/packages/hub/src/execution/models.ts +42 -0
  324. package/packages/hub/src/execution/policies.ts +371 -0
  325. package/packages/hub/src/execution/ports.ts +159 -0
  326. package/packages/hub/src/execution/providers.ts +106 -0
  327. package/packages/hub/src/execution/queues.ts +161 -0
  328. package/packages/hub/src/execution/runs.ts +1237 -0
  329. package/packages/hub/src/execution/scope.ts +152 -0
  330. package/packages/hub/src/execution/spend.ts +75 -0
  331. package/packages/hub/src/execution/stream-guard.ts +138 -0
  332. package/packages/hub/src/execution/testing.ts +490 -0
  333. package/packages/hub/src/execution/time.ts +36 -0
  334. package/packages/hub/src/execution/tools.ts +84 -0
  335. package/packages/hub/src/execution/wire.ts +99 -0
  336. package/packages/hub/src/execution/wording.ts +38 -0
  337. package/packages/hub/src/fns/auto.ts +109 -0
  338. package/packages/hub/src/fns/client-logs.ts +83 -0
  339. package/packages/hub/src/fns/costs.ts +139 -0
  340. package/packages/hub/src/fns/create.ts +140 -0
  341. package/packages/hub/src/fns/decided.ts +313 -0
  342. package/packages/hub/src/fns/env.ts +23 -0
  343. package/packages/hub/src/fns/examples.ts +184 -0
  344. package/packages/hub/src/fns/facts.ts +251 -0
  345. package/packages/hub/src/fns/gate.ts +40 -0
  346. package/packages/hub/src/fns/index.ts +149 -0
  347. package/packages/hub/src/fns/search.ts +351 -0
  348. package/packages/hub/src/graph/graph.ts +667 -0
  349. package/packages/hub/src/graph/source.ts +42 -0
  350. package/packages/hub/src/index/batch.ts +96 -0
  351. package/packages/hub/src/index/context-sections.ts +51 -0
  352. package/packages/hub/src/index/embedders.ts +242 -0
  353. package/packages/hub/src/index/env.ts +25 -0
  354. package/packages/hub/src/index/image-setting.ts +55 -0
  355. package/packages/hub/src/index/images.ts +43 -0
  356. package/packages/hub/src/index/index.ts +168 -0
  357. package/packages/hub/src/index/indexer.ts +663 -0
  358. package/packages/hub/src/index/search.ts +168 -0
  359. package/packages/hub/src/index/sectioners.ts +209 -0
  360. package/packages/hub/src/index/sectioning.ts +57 -0
  361. package/packages/hub/src/index/suggester.ts +65 -0
  362. package/packages/hub/src/index/testing.ts +113 -0
  363. package/packages/hub/src/index.ts +19 -0
  364. package/packages/hub/src/link/auto-pair.ts +225 -0
  365. package/packages/hub/src/link/build.ts +216 -0
  366. package/packages/hub/src/link/config-secrets.ts +171 -0
  367. package/packages/hub/src/link/config.ts +140 -0
  368. package/packages/hub/src/link/connections.ts +139 -0
  369. package/packages/hub/src/link/describer.ts +29 -0
  370. package/packages/hub/src/link/env.ts +42 -0
  371. package/packages/hub/src/link/events.ts +123 -0
  372. package/packages/hub/src/link/gate.ts +117 -0
  373. package/packages/hub/src/link/grants.ts +346 -0
  374. package/packages/hub/src/link/handlers.ts +301 -0
  375. package/packages/hub/src/link/index.ts +232 -0
  376. package/packages/hub/src/link/install.ts +92 -0
  377. package/packages/hub/src/link/keys.ts +32 -0
  378. package/packages/hub/src/link/lifecycle.ts +520 -0
  379. package/packages/hub/src/link/migrate-api.ts +210 -0
  380. package/packages/hub/src/link/migrate.ts +44 -0
  381. package/packages/hub/src/link/output.ts +63 -0
  382. package/packages/hub/src/link/owner-runs.ts +313 -0
  383. package/packages/hub/src/link/package/data.ts +53 -0
  384. package/packages/hub/src/link/package/format.ts +126 -0
  385. package/packages/hub/src/link/package/index.ts +9 -0
  386. package/packages/hub/src/link/package/zip.ts +137 -0
  387. package/packages/hub/src/link/packages.ts +180 -0
  388. package/packages/hub/src/link/pairing.ts +503 -0
  389. package/packages/hub/src/link/process.ts +98 -0
  390. package/packages/hub/src/link/reads.ts +91 -0
  391. package/packages/hub/src/link/resources.ts +166 -0
  392. package/packages/hub/src/link/review-summary.ts +279 -0
  393. package/packages/hub/src/link/rig.ts +335 -0
  394. package/packages/hub/src/link/router.ts +118 -0
  395. package/packages/hub/src/link/services.ts +294 -0
  396. package/packages/hub/src/link/status.ts +126 -0
  397. package/packages/hub/src/link/supervisor.ts +547 -0
  398. package/packages/hub/src/link/systems.ts +101 -0
  399. package/packages/hub/src/link/tokens.ts +30 -0
  400. package/packages/hub/src/main.ts +19 -0
  401. package/packages/hub/src/mcp/calls.ts +153 -0
  402. package/packages/hub/src/mcp/create.ts +51 -0
  403. package/packages/hub/src/mcp/endpoints.ts +206 -0
  404. package/packages/hub/src/mcp/env.ts +19 -0
  405. package/packages/hub/src/mcp/fns.ts +23 -0
  406. package/packages/hub/src/mcp/index.ts +76 -0
  407. package/packages/hub/src/mcp/registry.ts +150 -0
  408. package/packages/hub/src/mcp/scopes.ts +218 -0
  409. package/packages/hub/src/mcp/sources.ts +154 -0
  410. package/packages/hub/src/mcp/tokens.ts +72 -0
  411. package/packages/hub/src/mcp/tools.ts +173 -0
  412. package/packages/hub/src/metrics/calls.ts +123 -0
  413. package/packages/hub/src/metrics/create.ts +15 -0
  414. package/packages/hub/src/metrics/fn-metrics.ts +97 -0
  415. package/packages/hub/src/metrics/index.ts +58 -0
  416. package/packages/hub/src/metrics/rollup.ts +188 -0
  417. package/packages/hub/src/models/create.ts +65 -0
  418. package/packages/hub/src/models/decide.ts +134 -0
  419. package/packages/hub/src/models/gateway.ts +102 -0
  420. package/packages/hub/src/models/index.ts +82 -0
  421. package/packages/hub/src/models/pinned.ts +10 -0
  422. package/packages/hub/src/models/remote.ts +386 -0
  423. package/packages/hub/src/models/roles.ts +160 -0
  424. package/packages/hub/src/models/structured.ts +30 -0
  425. package/packages/hub/src/query/columns.ts +55 -0
  426. package/packages/hub/src/query/contexts.ts +102 -0
  427. package/packages/hub/src/query/env.ts +17 -0
  428. package/packages/hub/src/query/evaluate.ts +181 -0
  429. package/packages/hub/src/query/index.ts +32 -0
  430. package/packages/hub/src/query/service.ts +64 -0
  431. package/packages/hub/src/query/sources.ts +344 -0
  432. package/packages/hub/src/query/sql-source.ts +93 -0
  433. package/packages/hub/src/resources/browse.ts +131 -0
  434. package/packages/hub/src/resources/content.ts +183 -0
  435. package/packages/hub/src/resources/context.ts +405 -0
  436. package/packages/hub/src/resources/converters.ts +78 -0
  437. package/packages/hub/src/resources/create.ts +88 -0
  438. package/packages/hub/src/resources/env.ts +24 -0
  439. package/packages/hub/src/resources/fetch.ts +140 -0
  440. package/packages/hub/src/resources/fns.ts +172 -0
  441. package/packages/hub/src/resources/forms.ts +285 -0
  442. package/packages/hub/src/resources/images.ts +182 -0
  443. package/packages/hub/src/resources/index.ts +186 -0
  444. package/packages/hub/src/resources/library.ts +228 -0
  445. package/packages/hub/src/resources/models.ts +116 -0
  446. package/packages/hub/src/resources/pdf-pages.ts +455 -0
  447. package/packages/hub/src/resources/raw.ts +108 -0
  448. package/packages/hub/src/resources/reader.ts +224 -0
  449. package/packages/hub/src/resources/rules.ts +110 -0
  450. package/packages/hub/src/resources/sqlite-files.ts +140 -0
  451. package/packages/hub/src/resources/storage.ts +40 -0
  452. package/packages/hub/src/resources/testing.ts +292 -0
  453. package/packages/hub/src/store/always-for.ts +46 -0
  454. package/packages/hub/src/store/auxTables.ts +97 -0
  455. package/packages/hub/src/store/codec.ts +109 -0
  456. package/packages/hub/src/store/db.ts +137 -0
  457. package/packages/hub/src/store/env.ts +13 -0
  458. package/packages/hub/src/store/errors.ts +36 -0
  459. package/packages/hub/src/store/fixtures.ts +53 -0
  460. package/packages/hub/src/store/fn-renames.ts +72 -0
  461. package/packages/hub/src/store/hybrid.ts +130 -0
  462. package/packages/hub/src/store/index.ts +231 -0
  463. package/packages/hub/src/store/lists.ts +172 -0
  464. package/packages/hub/src/store/migrate-fn-names.ts +135 -0
  465. package/packages/hub/src/store/migrate.ts +121 -0
  466. package/packages/hub/src/store/ports.ts +163 -0
  467. package/packages/hub/src/store/query.ts +166 -0
  468. package/packages/hub/src/store/records.ts +119 -0
  469. package/packages/hub/src/store/rows.ts +105 -0
  470. package/packages/hub/src/store/schema.ts +184 -0
  471. package/packages/hub/src/store/sqlite.ts +136 -0
  472. package/packages/hub/src/store/table.ts +113 -0
  473. package/packages/hub/src/store/text.ts +92 -0
  474. package/packages/hub/src/store/vectors.ts +232 -0
  475. package/packages/hub/src/tables/env.ts +15 -0
  476. package/packages/hub/src/tables/fns.ts +29 -0
  477. package/packages/hub/src/tables/index.ts +45 -0
  478. package/packages/hub/src/tables/migrate.ts +105 -0
  479. package/packages/hub/src/tables/service.ts +245 -0
  480. package/packages/hub/src/testing.ts +128 -0
  481. package/packages/hub/tsconfig.json +6 -0
  482. package/packages/sdk/AUTHORING.md +25228 -0
  483. package/packages/sdk/package.json +58 -0
  484. package/packages/sdk/src/a-gin.ts +132 -0
  485. package/packages/sdk/src/agent.ts +121 -0
  486. package/packages/sdk/src/authoring.ts +546 -0
  487. package/packages/sdk/src/build.ts +97 -0
  488. package/packages/sdk/src/chat-prompt.ts +202 -0
  489. package/packages/sdk/src/claims.ts +20 -0
  490. package/packages/sdk/src/client-runtime.ts +514 -0
  491. package/packages/sdk/src/client.ts +672 -0
  492. package/packages/sdk/src/ctx.ts +659 -0
  493. package/packages/sdk/src/declare.ts +480 -0
  494. package/packages/sdk/src/fn.ts +514 -0
  495. package/packages/sdk/src/gin.ts +245 -0
  496. package/packages/sdk/src/hub.ts +1065 -0
  497. package/packages/sdk/src/impl.ts +35 -0
  498. package/packages/sdk/src/index.ts +87 -0
  499. package/packages/sdk/src/links.ts +35 -0
  500. package/packages/sdk/src/manifest.ts +372 -0
  501. package/packages/sdk/src/page-parts.ts +153 -0
  502. package/packages/sdk/src/program/env.ts +29 -0
  503. package/packages/sdk/src/program/index.ts +13 -0
  504. package/packages/sdk/src/program/lookups.ts +82 -0
  505. package/packages/sdk/src/program/runtime.ts +576 -0
  506. package/packages/sdk/src/program/tools.ts +268 -0
  507. package/packages/sdk/src/providers.ts +77 -0
  508. package/packages/sdk/src/refs.ts +161 -0
  509. package/packages/sdk/src/relative-dates.ts +197 -0
  510. package/packages/sdk/src/remote-auth.ts +113 -0
  511. package/packages/sdk/src/resources.ts +28 -0
  512. package/packages/sdk/src/results.ts +47 -0
  513. package/packages/sdk/src/server/address.ts +167 -0
  514. package/packages/sdk/src/server/asks.ts +111 -0
  515. package/packages/sdk/src/server/assets.ts +47 -0
  516. package/packages/sdk/src/server/authored-names.ts +79 -0
  517. package/packages/sdk/src/server/calls.ts +260 -0
  518. package/packages/sdk/src/server/content.ts +124 -0
  519. package/packages/sdk/src/server/context-check.ts +214 -0
  520. package/packages/sdk/src/server/context-files.ts +244 -0
  521. package/packages/sdk/src/server/data.ts +90 -0
  522. package/packages/sdk/src/server/env.ts +144 -0
  523. package/packages/sdk/src/server/fake-hub-fns.ts +124 -0
  524. package/packages/sdk/src/server/fake-hub-widgets.ts +67 -0
  525. package/packages/sdk/src/server/fake-models.ts +89 -0
  526. package/packages/sdk/src/server/fake-records.ts +217 -0
  527. package/packages/sdk/src/server/files.ts +118 -0
  528. package/packages/sdk/src/server/host.ts +742 -0
  529. package/packages/sdk/src/server/hosted-network-guard.ts +18 -0
  530. package/packages/sdk/src/server/index.ts +220 -0
  531. package/packages/sdk/src/server/journal.ts +131 -0
  532. package/packages/sdk/src/server/js-yaml.d.ts +19 -0
  533. package/packages/sdk/src/server/keys.ts +148 -0
  534. package/packages/sdk/src/server/link.ts +93 -0
  535. package/packages/sdk/src/server/live.ts +22 -0
  536. package/packages/sdk/src/server/llm-wire.ts +647 -0
  537. package/packages/sdk/src/server/llm.ts +555 -0
  538. package/packages/sdk/src/server/log.ts +108 -0
  539. package/packages/sdk/src/server/manifest-state.ts +113 -0
  540. package/packages/sdk/src/server/mcp-caller.ts +15 -0
  541. package/packages/sdk/src/server/mcp-prompts.ts +54 -0
  542. package/packages/sdk/src/server/mcp-resources.ts +130 -0
  543. package/packages/sdk/src/server/mcp.ts +194 -0
  544. package/packages/sdk/src/server/owner-runs.ts +109 -0
  545. package/packages/sdk/src/server/package.ts +141 -0
  546. package/packages/sdk/src/server/pairing.ts +97 -0
  547. package/packages/sdk/src/server/process.ts +53 -0
  548. package/packages/sdk/src/server/providers.ts +180 -0
  549. package/packages/sdk/src/server/proxy.ts +196 -0
  550. package/packages/sdk/src/server/renderers.ts +28 -0
  551. package/packages/sdk/src/server/resources.ts +89 -0
  552. package/packages/sdk/src/server/results.ts +121 -0
  553. package/packages/sdk/src/server/run.ts +492 -0
  554. package/packages/sdk/src/server/runs.ts +103 -0
  555. package/packages/sdk/src/server/runtime.ts +597 -0
  556. package/packages/sdk/src/server/socket-guard.ts +162 -0
  557. package/packages/sdk/src/server/state.ts +112 -0
  558. package/packages/sdk/src/server/supervise.ts +257 -0
  559. package/packages/sdk/src/server/table.ts +490 -0
  560. package/packages/sdk/src/server/testing.ts +883 -0
  561. package/packages/sdk/src/server/types.ts +26 -0
  562. package/packages/sdk/src/server/wire.ts +172 -0
  563. package/packages/sdk/src/status.ts +50 -0
  564. package/packages/sdk/src/system.ts +459 -0
  565. package/packages/sdk/src/testing/context.ts +48 -0
  566. package/packages/sdk/src/testing/env.ts +28 -0
  567. package/packages/sdk/src/testing/fixtures/NoteCard.vue +17 -0
  568. package/packages/sdk/src/testing/fixtures/context/guide.md +12 -0
  569. package/packages/sdk/src/testing/hub.ts +294 -0
  570. package/packages/sdk/src/testing/index.ts +30 -0
  571. package/packages/sdk/src/testing/models.ts +192 -0
  572. package/packages/sdk/src/testing/openrouter.ts +94 -0
  573. package/packages/sdk/src/testing/preview.ts +207 -0
  574. package/packages/sdk/src/testing/scratch.ts +58 -0
  575. package/packages/sdk/src/testing/shots.ts +17 -0
  576. package/packages/sdk/src/util.ts +35 -0
  577. package/packages/sdk/src/widget-check.ts +182 -0
  578. package/packages/sdk/src/widget-schema.ts +251 -0
  579. package/packages/sdk/src/widgets.ts +386 -0
  580. package/packages/sdk/src/zod-gin.ts +213 -0
  581. package/packages/sdk/tsconfig.json +6 -0
  582. package/packages/web/dist/assets/ActorSettingsView-BuMYRDqv.js +2 -0
  583. package/packages/web/dist/assets/ActorSettingsView-GTxPZw8N.css +1 -0
  584. package/packages/web/dist/assets/AdminLayout-1hbRPV3d.css +1 -0
  585. package/packages/web/dist/assets/AdminLayout-sLjVTrmV.js +2 -0
  586. package/packages/web/dist/assets/ApiServiceForm-BrMTU-7u.js +2 -0
  587. package/packages/web/dist/assets/ApiServiceForm-BxprSaAq.css +1 -0
  588. package/packages/web/dist/assets/ApiServiceView-BMF2zD6Q.js +2 -0
  589. package/packages/web/dist/assets/ApiServiceView-BVmdRCjR.css +1 -0
  590. package/packages/web/dist/assets/ApiServicesView-BTLV6c8n.css +1 -0
  591. package/packages/web/dist/assets/ApiServicesView-bjLAWO_j.js +2 -0
  592. package/packages/web/dist/assets/AppPage-BBzZ0Pru.css +1 -0
  593. package/packages/web/dist/assets/AppPage-DSzDKCFz.js +2 -0
  594. package/packages/web/dist/assets/AutoPairPicker-ClF4nB0n.css +1 -0
  595. package/packages/web/dist/assets/AutoPairPicker-nV38ALjl.js +2 -0
  596. package/packages/web/dist/assets/BrowserFrame-Bic7U7jN.js +2 -0
  597. package/packages/web/dist/assets/BrowserFrame-BzEdhmsF.css +1 -0
  598. package/packages/web/dist/assets/ChartVisual-BnFG9aFi.css +1 -0
  599. package/packages/web/dist/assets/ChartVisual-DWw7WsfN.js +11 -0
  600. package/packages/web/dist/assets/ChatPage-7Yebk7rl.js +4 -0
  601. package/packages/web/dist/assets/ChatPage-CbsRmktV.css +1 -0
  602. package/packages/web/dist/assets/CodeViewer-D6A30AJ9.css +1 -0
  603. package/packages/web/dist/assets/CodeViewer-xHS3Xah9.js +5 -0
  604. package/packages/web/dist/assets/ConfigWithCustom-C74DTXuy.css +1 -0
  605. package/packages/web/dist/assets/ConfigWithCustom-DreTUdf0.js +3 -0
  606. package/packages/web/dist/assets/ConfirmDialog-DjQUzNqk.js +2 -0
  607. package/packages/web/dist/assets/ConfirmDialog-oABDbIMz.css +1 -0
  608. package/packages/web/dist/assets/ConnectPage-CfRDrXvJ.js +2 -0
  609. package/packages/web/dist/assets/ConnectPage-Zz1nFbcn.css +1 -0
  610. package/packages/web/dist/assets/ContextItemPage-B6rJG3OT.js +2 -0
  611. package/packages/web/dist/assets/ContextItemPage-BRsWxOmu.css +1 -0
  612. package/packages/web/dist/assets/ContextPage-CloIZ_2y.js +2 -0
  613. package/packages/web/dist/assets/ContextPage-rYKxjiVI.css +1 -0
  614. package/packages/web/dist/assets/ContextRow-Byz_7HG-.css +1 -0
  615. package/packages/web/dist/assets/ContextRow-Dvv8CTFk.js +2 -0
  616. package/packages/web/dist/assets/DataPage-CLgJtQwS.css +1 -0
  617. package/packages/web/dist/assets/DataPage-wSIoGcb5.js +2 -0
  618. package/packages/web/dist/assets/DataTypePage-Ba_zBV4b.js +4 -0
  619. package/packages/web/dist/assets/DataTypePage-Cr238Hx_.css +1 -0
  620. package/packages/web/dist/assets/DesignPage-BFC4A-wO.css +1 -0
  621. package/packages/web/dist/assets/DesignPage-DidMUX8m.js +49 -0
  622. package/packages/web/dist/assets/ExplorePage-DJmOOIhs.css +1 -0
  623. package/packages/web/dist/assets/ExplorePage-MUyVydVB.js +2 -0
  624. package/packages/web/dist/assets/FactList-CeAbKajD.js +2 -0
  625. package/packages/web/dist/assets/FactList-DuDPr7n7.css +1 -0
  626. package/packages/web/dist/assets/FnList-BCnb4kOB.css +1 -0
  627. package/packages/web/dist/assets/FnList-CjQRwYaT.js +2 -0
  628. package/packages/web/dist/assets/FnPill-BNIWrqXN.css +1 -0
  629. package/packages/web/dist/assets/FnPill-BshAvm2I.js +2 -0
  630. package/packages/web/dist/assets/FnView-B8MGAOoB.js +2 -0
  631. package/packages/web/dist/assets/FnView-BBFbPAQz.css +1 -0
  632. package/packages/web/dist/assets/FnsView-CeqIoaBT.js +2 -0
  633. package/packages/web/dist/assets/FnsView-D575syq-.css +1 -0
  634. package/packages/web/dist/assets/GinExprView-DYVUwZrd.js +4 -0
  635. package/packages/web/dist/assets/GinExprView-dqtf5BKF.css +1 -0
  636. package/packages/web/dist/assets/GinForm-CVEsGoBo.css +1 -0
  637. package/packages/web/dist/assets/GinForm-D3mwMRTQ.js +2 -0
  638. package/packages/web/dist/assets/GinTypeView-B5CGqWvh.css +1 -0
  639. package/packages/web/dist/assets/GinTypeView-C0YifSmE.js +2 -0
  640. package/packages/web/dist/assets/GinValueView-HfEPq9le.js +4 -0
  641. package/packages/web/dist/assets/GinValueView-zhWn-X48.css +1 -0
  642. package/packages/web/dist/assets/GraphPage-ySnuA4Hp.js +2 -0
  643. package/packages/web/dist/assets/GraphPanel-B9jxpJfb.css +1 -0
  644. package/packages/web/dist/assets/GraphPanel-Cy5-KGo1.js +2 -0
  645. package/packages/web/dist/assets/HubPicker-C_vA752L.js +2 -0
  646. package/packages/web/dist/assets/InboxApprovals-DcPCCmZ5.js +2 -0
  647. package/packages/web/dist/assets/InboxApprovals-DmC94LNf.css +1 -0
  648. package/packages/web/dist/assets/InboxPage-C2DT2nuF.js +2 -0
  649. package/packages/web/dist/assets/InjectedList-BgxdlaHJ.css +1 -0
  650. package/packages/web/dist/assets/InjectedList-CJsEFEbz.js +2 -0
  651. package/packages/web/dist/assets/InstallDialog-C9GDoUI2.js +2 -0
  652. package/packages/web/dist/assets/InstallDialog-yWLZK_zN.css +1 -0
  653. package/packages/web/dist/assets/InstanceTypes-D8Jcxn70.js +2 -0
  654. package/packages/web/dist/assets/InstanceTypes-DAowwLB7.css +1 -0
  655. package/packages/web/dist/assets/InstanceView-CuBD3JPU.css +1 -0
  656. package/packages/web/dist/assets/InstanceView-p7tMaylE.js +2 -0
  657. package/packages/web/dist/assets/ItemHistory-CUGa8b6s.js +2 -0
  658. package/packages/web/dist/assets/ItemHistory-Czzpyiud.css +1 -0
  659. package/packages/web/dist/assets/LimitsView-DlPW-cLw.css +1 -0
  660. package/packages/web/dist/assets/LimitsView-DsZG6u5P.js +2 -0
  661. package/packages/web/dist/assets/ListSearch-BK4p7Nxa.js +2 -0
  662. package/packages/web/dist/assets/ListSearch-CdxSo6UW.css +1 -0
  663. package/packages/web/dist/assets/LlmCallDetails-2yQftCqd.js +2 -0
  664. package/packages/web/dist/assets/LlmCallDetails-gymdroc_.css +1 -0
  665. package/packages/web/dist/assets/LlmCallsView-B1yHEIBG.css +1 -0
  666. package/packages/web/dist/assets/LlmCallsView-DOHX3r0K.js +2 -0
  667. package/packages/web/dist/assets/LoadState-C4VYnFly.css +1 -0
  668. package/packages/web/dist/assets/LoadState-DeXfLvYv.js +2 -0
  669. package/packages/web/dist/assets/McpDialog-BSCt_jWB.css +1 -0
  670. package/packages/web/dist/assets/McpDialog-CA_0WKWF.js +2 -0
  671. package/packages/web/dist/assets/McpServerForm-CAG8Wp2N.js +2 -0
  672. package/packages/web/dist/assets/McpServerForm-DsHaf5Um.css +1 -0
  673. package/packages/web/dist/assets/McpServerView-7I76EznB.css +1 -0
  674. package/packages/web/dist/assets/McpServerView-CD8qw6W_.js +2 -0
  675. package/packages/web/dist/assets/McpServersView-DNycG35u.js +2 -0
  676. package/packages/web/dist/assets/McpView-CC2oNOMa.js +2 -0
  677. package/packages/web/dist/assets/McpView-W5PhGI4_.css +1 -0
  678. package/packages/web/dist/assets/McpsView-CwJvyyxV.js +2 -0
  679. package/packages/web/dist/assets/McpsView-yH-K4ifd.css +1 -0
  680. package/packages/web/dist/assets/MemoryDialog-CpfIsygL.css +1 -0
  681. package/packages/web/dist/assets/MemoryDialog-Dbvh5uLq.js +2 -0
  682. package/packages/web/dist/assets/ModelCallsView-B__CIDge.css +1 -0
  683. package/packages/web/dist/assets/ModelCallsView-RvnW3EBP.js +2 -0
  684. package/packages/web/dist/assets/ModelPicker-5BC8W10p.css +1 -0
  685. package/packages/web/dist/assets/ModelPicker-DcjwQFHC.js +2 -0
  686. package/packages/web/dist/assets/ModelsView-C_iN19xt.js +2 -0
  687. package/packages/web/dist/assets/ModelsView-DjD8H9vc.css +1 -0
  688. package/packages/web/dist/assets/NotFoundPage-CeSwzTV-.js +2 -0
  689. package/packages/web/dist/assets/NotFoundPage-ZUNomG9O.css +1 -0
  690. package/packages/web/dist/assets/PairPage-Bs2KuRjC.css +1 -0
  691. package/packages/web/dist/assets/PairPage-TEXPpsqi.js +2 -0
  692. package/packages/web/dist/assets/PanelHost-BkrFAnPa.js +2 -0
  693. package/packages/web/dist/assets/PanelHost-_z5RyAnS.css +1 -0
  694. package/packages/web/dist/assets/PeopleView-CJ8yArTh.css +1 -0
  695. package/packages/web/dist/assets/PeopleView-D1QGPYp7.js +2 -0
  696. package/packages/web/dist/assets/PoliciesView-BU1fudNF.js +2 -0
  697. package/packages/web/dist/assets/PoliciesView-yVE8d8mj.css +1 -0
  698. package/packages/web/dist/assets/RefusalList-B3OBAsYc.css +1 -0
  699. package/packages/web/dist/assets/RefusalList-DQoyUoPG.js +2 -0
  700. package/packages/web/dist/assets/RemoteAuthFields-Dm44vz2t.css +1 -0
  701. package/packages/web/dist/assets/RemoteAuthFields-nxGWfmhf.js +2 -0
  702. package/packages/web/dist/assets/ResourceViewer-A9ZSaLUH.css +1 -0
  703. package/packages/web/dist/assets/ResourceViewer-Po24y4pj.js +2 -0
  704. package/packages/web/dist/assets/ResourcesPage-YluNBqIv.js +2 -0
  705. package/packages/web/dist/assets/ResourcesPage-mr0U0l6U.css +1 -0
  706. package/packages/web/dist/assets/ResultGrid-CuUQyTjW.css +1 -0
  707. package/packages/web/dist/assets/ResultGrid-uoq4yUYj.js +2 -0
  708. package/packages/web/dist/assets/ReviewSummaryStrip-B3ZQs5wR.css +1 -0
  709. package/packages/web/dist/assets/ReviewSummaryStrip-k3HevESg.js +2 -0
  710. package/packages/web/dist/assets/ReviewView-79Z5rU1v.js +3 -0
  711. package/packages/web/dist/assets/ReviewView-CxbVjz_R.css +1 -0
  712. package/packages/web/dist/assets/RuleRow-CG_XCvUu.css +1 -0
  713. package/packages/web/dist/assets/RuleRow-CoXDA-SH.js +2 -0
  714. package/packages/web/dist/assets/RunCard-CBSGdwdQ.js +2 -0
  715. package/packages/web/dist/assets/RunCard-CfyRaDLS.css +1 -0
  716. package/packages/web/dist/assets/RunDetails-CGhQQ6OI.js +2 -0
  717. package/packages/web/dist/assets/RunDetails-CHHCWGrP.css +1 -0
  718. package/packages/web/dist/assets/RunDot-Ch_45985.js +2 -0
  719. package/packages/web/dist/assets/RunDot-CkNUsFwg.css +1 -0
  720. package/packages/web/dist/assets/RunPage-C_t20pB7.js +2 -0
  721. package/packages/web/dist/assets/RunPage-Cq6UV6h-.css +1 -0
  722. package/packages/web/dist/assets/RunProgress-Bq2yc7Il.css +1 -0
  723. package/packages/web/dist/assets/RunProgress-VrZUHUEC.js +2 -0
  724. package/packages/web/dist/assets/RunsView-Dz9Xsvu5.js +2 -0
  725. package/packages/web/dist/assets/RunsView-fBMrETRF.css +1 -0
  726. package/packages/web/dist/assets/ServiceRows-6BU4-MeL.css +1 -0
  727. package/packages/web/dist/assets/ServiceRows-DNzDiutg.js +2 -0
  728. package/packages/web/dist/assets/SettingsPage-CykfuYj1.js +3 -0
  729. package/packages/web/dist/assets/SettingsPage-t03BqXw8.css +1 -0
  730. package/packages/web/dist/assets/SignInPage-Djx-M-0U.css +1 -0
  731. package/packages/web/dist/assets/SignInPage-DrXZ1sG2.js +2 -0
  732. package/packages/web/dist/assets/StatusBadge-Dpb9uG5e.js +2 -0
  733. package/packages/web/dist/assets/SystemConfig-72qKRkUk.js +2 -0
  734. package/packages/web/dist/assets/SystemConfig-CDtMyVWy.css +1 -0
  735. package/packages/web/dist/assets/SystemPageHost-BeZ-6N0-.css +1 -0
  736. package/packages/web/dist/assets/SystemPageHost-DLNg2FYK.js +2 -0
  737. package/packages/web/dist/assets/SystemView-C8ScHUe2.css +1 -0
  738. package/packages/web/dist/assets/SystemView-Es5wtkYU.js +2 -0
  739. package/packages/web/dist/assets/SystemsView-B6HEL9VS.css +1 -0
  740. package/packages/web/dist/assets/SystemsView-CeuSFhlF.js +2 -0
  741. package/packages/web/dist/assets/TableViewer-1Jf5BNat.css +1 -0
  742. package/packages/web/dist/assets/TableViewer-BQ7bYLOP.js +6 -0
  743. package/packages/web/dist/assets/ThemePicker-C2nJ21Vd.js +2 -0
  744. package/packages/web/dist/assets/TurnTree-CORdfTHj.js +2 -0
  745. package/packages/web/dist/assets/TurnTree-CPivE4sF.css +1 -0
  746. package/packages/web/dist/assets/UserMessage-BtECa8ka.css +1 -0
  747. package/packages/web/dist/assets/UserMessage-qyc8dG5D.js +9 -0
  748. package/packages/web/dist/assets/ValueVisual-D5Rw7PlS.css +1 -0
  749. package/packages/web/dist/assets/ValueVisual-aXEUaQ5Y.js +2 -0
  750. package/packages/web/dist/assets/WidgetView-BZyDyYRI.js +3 -0
  751. package/packages/web/dist/assets/WidgetView-DQUDeFkB.css +1 -0
  752. package/packages/web/dist/assets/_plugin-vue_export-helper-BDNMzG2s.js +1 -0
  753. package/packages/web/dist/assets/abap-CLvhMVsD.js +2 -0
  754. package/packages/web/dist/assets/abnfDiagram-S7VZAUFO-CzFPJy4G.js +2 -0
  755. package/packages/web/dist/assets/actionscript-3-Cs6JJXT5.js +2 -0
  756. package/packages/web/dist/assets/ada-X3Y2mlq2.js +2 -0
  757. package/packages/web/dist/assets/ahk-DwADkxyd.js +2 -0
  758. package/packages/web/dist/assets/ahk2-_6rzW9BS.js +2 -0
  759. package/packages/web/dist/assets/angular-html-wiqevbIE.js +2 -0
  760. package/packages/web/dist/assets/angular-ts-C32iChAu.js +2 -0
  761. package/packages/web/dist/assets/apache-U0d_L8uA.js +2 -0
  762. package/packages/web/dist/assets/apex-KFGFyKwG.js +2 -0
  763. package/packages/web/dist/assets/apl-Bl61Unn0.js +2 -0
  764. package/packages/web/dist/assets/applescript-CCn79oCD.js +2 -0
  765. package/packages/web/dist/assets/ara-4CJ0cIlV.js +2 -0
  766. package/packages/web/dist/assets/architecture-WOLXFQ4H-_l4nRfFJ.js +1 -0
  767. package/packages/web/dist/assets/architectureDiagram-YGSQEFNW-CMpVysh5.js +37 -0
  768. package/packages/web/dist/assets/asciidoc-SCjQUq34.js +2 -0
  769. package/packages/web/dist/assets/asm-Cmm7eHzH.js +2 -0
  770. package/packages/web/dist/assets/astro-CojMNcHO.js +2 -0
  771. package/packages/web/dist/assets/awk-BWXHIvNe.js +2 -0
  772. package/packages/web/dist/assets/ballerina-B7ZEbQpA.js +2 -0
  773. package/packages/web/dist/assets/bat-qdxAdBWQ.js +2 -0
  774. package/packages/web/dist/assets/beancount-C2IN4Vk8.js +2 -0
  775. package/packages/web/dist/assets/berry-DKpUyyne.js +2 -0
  776. package/packages/web/dist/assets/bibtex-Ci_nEsc7.js +2 -0
  777. package/packages/web/dist/assets/bicep-CUHmPFLl.js +2 -0
  778. package/packages/web/dist/assets/bird2-CYIUgYqB.js +2 -0
  779. package/packages/web/dist/assets/blade-CRk3fo4p.js +2 -0
  780. package/packages/web/dist/assets/blockDiagram-APKKGZFW-Jua4t10S.js +141 -0
  781. package/packages/web/dist/assets/bpmnIcons-APHXDYXF-C0jbCElo.js +2 -0
  782. package/packages/web/dist/assets/browser-BHOqNy7R.js +9 -0
  783. package/packages/web/dist/assets/browsers-BSc3bW3l.js +2 -0
  784. package/packages/web/dist/assets/bsl-_VjlB9mv.js +2 -0
  785. package/packages/web/dist/assets/c-CiNtTPN_.js +2 -0
  786. package/packages/web/dist/assets/c3-D0apG41V.js +2 -0
  787. package/packages/web/dist/assets/c4Diagram-KJ2TOQU5-08x9w6G9.js +39 -0
  788. package/packages/web/dist/assets/cadence-CQ2zXKGN.js +2 -0
  789. package/packages/web/dist/assets/cairo-DLTphjLi.js +2 -0
  790. package/packages/web/dist/assets/chapel-D5ik6Ccv.js +2 -0
  791. package/packages/web/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +2 -0
  792. package/packages/web/dist/assets/chunk-5VM5RSS4-ZNzvKenW.js +16 -0
  793. package/packages/web/dist/assets/chunk-6MUBBAK2-BHXbrulB.js +3 -0
  794. package/packages/web/dist/assets/chunk-AXFCVDMN-CI0arS1F.js +63 -0
  795. package/packages/web/dist/assets/chunk-BG4553SI-DGn4S0JL.js +130 -0
  796. package/packages/web/dist/assets/chunk-DQASFODM-ClbbgMVy.js +11 -0
  797. package/packages/web/dist/assets/chunk-DUW6YSOI-Dgx8z5s3.js +2 -0
  798. package/packages/web/dist/assets/chunk-HFQBQIA3-BNltuj9p.js +2 -0
  799. package/packages/web/dist/assets/chunk-J5ZVWO5B-oDCd-gWO.js +2 -0
  800. package/packages/web/dist/assets/chunk-JWPE2WC7-DVXcaiue.js +2 -0
  801. package/packages/web/dist/assets/chunk-KQLB2F66-DsHe5EtY.js +3 -0
  802. package/packages/web/dist/assets/chunk-KS47KZWR-BZg3mYeD.js +2 -0
  803. package/packages/web/dist/assets/chunk-LEVMRMFU-paszafIt.js +2 -0
  804. package/packages/web/dist/assets/chunk-M57EVK23-qYz6TUV4.js +2 -0
  805. package/packages/web/dist/assets/chunk-NGNAAXSQ-DI_UYJZ4.js +137 -0
  806. package/packages/web/dist/assets/chunk-OY52VR5R-Ct_YDCfL.js +89 -0
  807. package/packages/web/dist/assets/chunk-QB3YPZ4I-i7-AWGNa.js +214 -0
  808. package/packages/web/dist/assets/chunk-R3KSYZAL-DW0WB_9q.js +2 -0
  809. package/packages/web/dist/assets/chunk-STOXU5M4-D5Gd-wq9.js +73 -0
  810. package/packages/web/dist/assets/chunk-TU62E6Q5-WtwDME_1.js +2 -0
  811. package/packages/web/dist/assets/chunk-X4PVCEUW-YYhMSieL.js +2 -0
  812. package/packages/web/dist/assets/chunk-XXDRQBXY-i7MKP1NY.js +2 -0
  813. package/packages/web/dist/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +2 -0
  814. package/packages/web/dist/assets/clarity-CtfBBspg.js +2 -0
  815. package/packages/web/dist/assets/classDiagram-v2-L25IHNXF-d25-M1pJ.js +218 -0
  816. package/packages/web/dist/assets/clojure-DqKBuwfJ.js +2 -0
  817. package/packages/web/dist/assets/cmake-Bj61d0ZC.js +2 -0
  818. package/packages/web/dist/assets/cobol-BRB8FTbz.js +2 -0
  819. package/packages/web/dist/assets/codeowners-C8r90Shi.js +2 -0
  820. package/packages/web/dist/assets/codeql-oeQT6MSM.js +2 -0
  821. package/packages/web/dist/assets/coffee-B1WQFatZ.js +2 -0
  822. package/packages/web/dist/assets/common-lisp-Cv5bFMCO.js +2 -0
  823. package/packages/web/dist/assets/coq-CGaSfhwR.js +2 -0
  824. package/packages/web/dist/assets/core-DdF778CY.js +13 -0
  825. package/packages/web/dist/assets/cose-bilkent-JH36ORCC-CYLhHv3W.js +2 -0
  826. package/packages/web/dist/assets/cpp-CxyntmKf.js +2 -0
  827. package/packages/web/dist/assets/crystal-CayBj_Aw.js +2 -0
  828. package/packages/web/dist/assets/csharp-dmMxLVLW.js +2 -0
  829. package/packages/web/dist/assets/css-CB_fh0k2.js +2 -0
  830. package/packages/web/dist/assets/csv-Dx-8-gkx.js +2 -0
  831. package/packages/web/dist/assets/cue-CE9AQfxI.js +2 -0
  832. package/packages/web/dist/assets/cynefin-EF2NZ3EQ-BOE_VX_3.js +1 -0
  833. package/packages/web/dist/assets/cynefinDiagram-L36ESFBY-cDLwrPve.js +63 -0
  834. package/packages/web/dist/assets/cypher-ClKdZ_lG.js +2 -0
  835. package/packages/web/dist/assets/cytoscape.esm-DpfQbjy7.js +322 -0
  836. package/packages/web/dist/assets/d-qD-0Kul2.js +2 -0
  837. package/packages/web/dist/assets/d3-scale-CElPUUud.js +2 -0
  838. package/packages/web/dist/assets/d3-selection-COWvaQNI.js +2 -0
  839. package/packages/web/dist/assets/dagre-SPEB5RXH-ChUYszsQ.js +5 -0
  840. package/packages/web/dist/assets/dart-CHZY9Xhz.js +2 -0
  841. package/packages/web/dist/assets/dax-BkyTk9wS.js +2 -0
  842. package/packages/web/dist/assets/desktop-Dlh5hvp9.js +2 -0
  843. package/packages/web/dist/assets/diagram-3B7GL73J-C4RMi43c.js +201 -0
  844. package/packages/web/dist/assets/diagram-DNEMPZML-COQGGiEP.js +25 -0
  845. package/packages/web/dist/assets/diagram-L3MUGCDN-mowv9Itp.js +42 -0
  846. package/packages/web/dist/assets/diagram-LA4NIPWU-hNJQSGhv.js +25 -0
  847. package/packages/web/dist/assets/diagram-MHCOC4E2-Dp-COOAx.js +4 -0
  848. package/packages/web/dist/assets/diagram-XPFHEONP-D2wzCykS.js +31 -0
  849. package/packages/web/dist/assets/diff-woXpYk--.js +2 -0
  850. package/packages/web/dist/assets/dist-DdXDFcej.js +2 -0
  851. package/packages/web/dist/assets/docker-IyjqRm3v.js +2 -0
  852. package/packages/web/dist/assets/dotenv-CuH5my32.js +2 -0
  853. package/packages/web/dist/assets/dream-maker-DW3nJb8Q.js +2 -0
  854. package/packages/web/dist/assets/ebnfDiagram-UZSYDL2S-5WCudwet.js +2 -0
  855. package/packages/web/dist/assets/edge-6p6a27tD.js +2 -0
  856. package/packages/web/dist/assets/elixir-fXwtrlGU.js +2 -0
  857. package/packages/web/dist/assets/elk-XV6XMXQE-BknTcAbm.js +28 -0
  858. package/packages/web/dist/assets/elm-rUi9A3mh.js +2 -0
  859. package/packages/web/dist/assets/emacs-lisp-DR2vtWaj.js +2 -0
  860. package/packages/web/dist/assets/engine-javascript-C30F4iNc.js +142 -0
  861. package/packages/web/dist/assets/erDiagram-EYBAPDEH-UOE6iZ1t.js +100 -0
  862. package/packages/web/dist/assets/erb-BvmuIdN-.js +2 -0
  863. package/packages/web/dist/assets/erlang-Cphh6RMH.js +2 -0
  864. package/packages/web/dist/assets/eventmodeling-K75KTNOO-CIs2h_8S.js +1 -0
  865. package/packages/web/dist/assets/export-BwFkEtcm.js +15 -0
  866. package/packages/web/dist/assets/fennel-DQxkIbk2.js +2 -0
  867. package/packages/web/dist/assets/fish-BJitypiv.js +2 -0
  868. package/packages/web/dist/assets/flowDiagram-MALGAFMO-CQLEuZ0I.js +1 -0
  869. package/packages/web/dist/assets/fluent-C03EYrpw.js +2 -0
  870. package/packages/web/dist/assets/fn-modal-DqcxUhOQ.js +2 -0
  871. package/packages/web/dist/assets/fn-notices-BYaH6IoA.js +2 -0
  872. package/packages/web/dist/assets/fn-notices-Da4tVHqJ.css +1 -0
  873. package/packages/web/dist/assets/formats-DI__ADVG.js +2 -0
  874. package/packages/web/dist/assets/fortran-fixed-form-DEKoE2YW.js +2 -0
  875. package/packages/web/dist/assets/fortran-free-form-CYNrtFtB.js +2 -0
  876. package/packages/web/dist/assets/fsharp-D13ZGOAj.js +2 -0
  877. package/packages/web/dist/assets/ganttDiagram-23REXITY-KBK93CXW.js +293 -0
  878. package/packages/web/dist/assets/gdresource-xMC7jr7x.js +2 -0
  879. package/packages/web/dist/assets/gdscript-DYvRD3hg.js +2 -0
  880. package/packages/web/dist/assets/gdshader-CBce3t8t.js +2 -0
  881. package/packages/web/dist/assets/genie-CV2tkWYe.js +2 -0
  882. package/packages/web/dist/assets/gherkin-DExj1W_8.js +2 -0
  883. package/packages/web/dist/assets/git-commit-BSykSTBG.js +2 -0
  884. package/packages/web/dist/assets/git-rebase-B09wAERM.js +2 -0
  885. package/packages/web/dist/assets/gitGraph-VSP46ZUC-Dwmw1QLM.js +1 -0
  886. package/packages/web/dist/assets/gitGraphDiagram-STJD7YCW-B2T13-ZJ.js +107 -0
  887. package/packages/web/dist/assets/gleam-CSRkHgEL.js +2 -0
  888. package/packages/web/dist/assets/glimmer-js-CpWvy9gf.js +2 -0
  889. package/packages/web/dist/assets/glimmer-ts-BAH8Czr9.js +2 -0
  890. package/packages/web/dist/assets/glsl-CVY0WJyt.js +2 -0
  891. package/packages/web/dist/assets/gn-CAXYAgV-.js +2 -0
  892. package/packages/web/dist/assets/gnuplot-7GGW24-e.js +2 -0
  893. package/packages/web/dist/assets/go-rLFTqkRN.js +2 -0
  894. package/packages/web/dist/assets/graphlib-DS17s2tU.js +2 -0
  895. package/packages/web/dist/assets/graphql-CDPCtuoQ.js +2 -0
  896. package/packages/web/dist/assets/groovy-CacY0gHj.js +2 -0
  897. package/packages/web/dist/assets/hack-CLEpeEqq.js +2 -0
  898. package/packages/web/dist/assets/haml-Bvpgs3uG.js +2 -0
  899. package/packages/web/dist/assets/handlebars-vXY9zmj1.js +2 -0
  900. package/packages/web/dist/assets/haskell-D8IpX4py.js +2 -0
  901. package/packages/web/dist/assets/haxe-C8oCnwJJ.js +2 -0
  902. package/packages/web/dist/assets/hcl-Dh228itO.js +2 -0
  903. package/packages/web/dist/assets/hjson-CxZEssPk.js +2 -0
  904. package/packages/web/dist/assets/hlsl-Cvrh5tZx.js +2 -0
  905. package/packages/web/dist/assets/html-CKMeXkCW.js +2 -0
  906. package/packages/web/dist/assets/html-derivative-C8trdkzI.js +2 -0
  907. package/packages/web/dist/assets/http-UJwVfHv3.js +2 -0
  908. package/packages/web/dist/assets/hurl-7erhC4fM.js +2 -0
  909. package/packages/web/dist/assets/hxml-Dcm88srW.js +2 -0
  910. package/packages/web/dist/assets/hy-CZbG8q4J.js +2 -0
  911. package/packages/web/dist/assets/imba-DsUTQ-LC.js +2 -0
  912. package/packages/web/dist/assets/index-Bv42jNvr.js +4 -0
  913. package/packages/web/dist/assets/index-CSisx5mi.css +1 -0
  914. package/packages/web/dist/assets/info-OHQRW6UA-Ob4q-Ec6.js +1 -0
  915. package/packages/web/dist/assets/infoDiagram-KBXO4MBG-CGQ6MwL3.js +3 -0
  916. package/packages/web/dist/assets/ini-B5eOa1yu.js +2 -0
  917. package/packages/web/dist/assets/ishikawaDiagram-M35NCXHK-CuoxiCk-.js +71 -0
  918. package/packages/web/dist/assets/java-DGv6_9mf.js +2 -0
  919. package/packages/web/dist/assets/javascript-wyDA4Fnk.js +2 -0
  920. package/packages/web/dist/assets/jinja-CRKn4_DT.js +2 -0
  921. package/packages/web/dist/assets/jison-C5fjf-e-.js +2 -0
  922. package/packages/web/dist/assets/journeyDiagram-OPLOXDXO-zEDEMkq6.js +140 -0
  923. package/packages/web/dist/assets/json-B_qwZ7m_.js +2 -0
  924. package/packages/web/dist/assets/json5-BR5RXkoi.js +2 -0
  925. package/packages/web/dist/assets/jsonc-CYpm1nAK.js +2 -0
  926. package/packages/web/dist/assets/jsonl-CmCQp5Yx.js +2 -0
  927. package/packages/web/dist/assets/jsonnet-CJTPZ8u_.js +2 -0
  928. package/packages/web/dist/assets/jssm-DXw9l8Rf.js +2 -0
  929. package/packages/web/dist/assets/jsx-Ba8EQqYd.js +2 -0
  930. package/packages/web/dist/assets/julia-mJS6zhvp.js +2 -0
  931. package/packages/web/dist/assets/just-n_L73pBN.js +2 -0
  932. package/packages/web/dist/assets/kanban-definition-BZKZHSQY-q5yqVxKo.js +90 -0
  933. package/packages/web/dist/assets/katex-MEuSR36T.js +258 -0
  934. package/packages/web/dist/assets/kdl-CsD5j6eV.js +2 -0
  935. package/packages/web/dist/assets/kotlin-DhhofPvG.js +2 -0
  936. package/packages/web/dist/assets/kusto-C7mF5XQf.js +2 -0
  937. package/packages/web/dist/assets/labels-BhJpmLWA.js +2 -0
  938. package/packages/web/dist/assets/langs-CVIiVMBh.js +3 -0
  939. package/packages/web/dist/assets/latex-0iQGLWul.js +2 -0
  940. package/packages/web/dist/assets/layout-DQKldU13.js +2 -0
  941. package/packages/web/dist/assets/lean-CewbzKMR.js +2 -0
  942. package/packages/web/dist/assets/less-DVTAwKKz.js +2 -0
  943. package/packages/web/dist/assets/liquid-B8kEVR50.js +2 -0
  944. package/packages/web/dist/assets/live-kTMxmy8I.js +2 -0
  945. package/packages/web/dist/assets/llvm-DqHOMS-s.js +2 -0
  946. package/packages/web/dist/assets/log-BNLmms1o.js +2 -0
  947. package/packages/web/dist/assets/logo-Cluzi2Zq.js +2 -0
  948. package/packages/web/dist/assets/lua-BDnDZ8k4.js +2 -0
  949. package/packages/web/dist/assets/luau-VGWVLoqX.js +2 -0
  950. package/packages/web/dist/assets/made-DYU0Ohi4.js +2 -0
  951. package/packages/web/dist/assets/make-Dixweg8N.js +2 -0
  952. package/packages/web/dist/assets/markdown-BYOwaDjH.js +2 -0
  953. package/packages/web/dist/assets/marko-Bk0_iGvT.js +2 -0
  954. package/packages/web/dist/assets/matlab-D7qyCx1q.js +2 -0
  955. package/packages/web/dist/assets/mdc-DhizV3YK.js +2 -0
  956. package/packages/web/dist/assets/mdx-DQZ5AkYe.js +2 -0
  957. package/packages/web/dist/assets/mermaid-BxpfTIzt.js +2 -0
  958. package/packages/web/dist/assets/mermaid-parser.core-BGN5zmcs.js +8 -0
  959. package/packages/web/dist/assets/mermaid.core-BNF3dRf5.js +45 -0
  960. package/packages/web/dist/assets/metrics-Cio5ykX6.js +2 -0
  961. package/packages/web/dist/assets/mindmap-definition-I2QAS2VK-CoiSJ4W4.js +99 -0
  962. package/packages/web/dist/assets/mipsasm-BMqwQI7S.js +2 -0
  963. package/packages/web/dist/assets/mojo-fg40_ntQ.js +2 -0
  964. package/packages/web/dist/assets/moonbit-D9W784E_.js +2 -0
  965. package/packages/web/dist/assets/move-BYnGhZoM.js +2 -0
  966. package/packages/web/dist/assets/narrat-_X_XdTYD.js +2 -0
  967. package/packages/web/dist/assets/nextflow-CSgcYZcx.js +2 -0
  968. package/packages/web/dist/assets/nextflow-groovy-D7IRt6Pp.js +2 -0
  969. package/packages/web/dist/assets/nginx-DoalMtUh.js +2 -0
  970. package/packages/web/dist/assets/nim-DdsQnl3h.js +2 -0
  971. package/packages/web/dist/assets/nix-IvuFDN5E.js +2 -0
  972. package/packages/web/dist/assets/now-40JhSjx0.js +2 -0
  973. package/packages/web/dist/assets/nsis-CjNLYCLg.js +2 -0
  974. package/packages/web/dist/assets/nushell--0fT3PI1.js +2 -0
  975. package/packages/web/dist/assets/objective-c-D1A_Heim.js +2 -0
  976. package/packages/web/dist/assets/objective-cpp-BsSzOQcm.js +2 -0
  977. package/packages/web/dist/assets/ocaml-O90oeIOV.js +2 -0
  978. package/packages/web/dist/assets/odin-B1RWQWA5.js +2 -0
  979. package/packages/web/dist/assets/openscad-BUDT5pXO.js +2 -0
  980. package/packages/web/dist/assets/org-B2d-Pz26.js +2 -0
  981. package/packages/web/dist/assets/packet-JDAUHWVQ-kID5-AEG.js +1 -0
  982. package/packages/web/dist/assets/pascal-4ZHwLPI5.js +2 -0
  983. package/packages/web/dist/assets/pdf-YwugTw7Y.js +55 -0
  984. package/packages/web/dist/assets/pdf.worker.min-CIqJB0yW.mjs +28 -0
  985. package/packages/web/dist/assets/pdf.worker.min-UqOn5EDC.js +2 -0
  986. package/packages/web/dist/assets/pegDiagram-FD4XPPHP-DvO7r8qd.js +2 -0
  987. package/packages/web/dist/assets/perl-CpJxFnsT.js +2 -0
  988. package/packages/web/dist/assets/php-CG5ES-ob.js +2 -0
  989. package/packages/web/dist/assets/pie-XZMESJXO-By0gro0O.js +1 -0
  990. package/packages/web/dist/assets/pieDiagram-J4AKIIQI-f_Jeo_8D.js +40 -0
  991. package/packages/web/dist/assets/pkl-ot-7Btpt.js +2 -0
  992. package/packages/web/dist/assets/plsql-DGHpHOYJ.js +2 -0
  993. package/packages/web/dist/assets/po-BiJDBrnU.js +2 -0
  994. package/packages/web/dist/assets/polar-C7UOKdEL.js +2 -0
  995. package/packages/web/dist/assets/postcss-BXeXVLqQ.js +2 -0
  996. package/packages/web/dist/assets/powerquery-DNMTfnFr.js +2 -0
  997. package/packages/web/dist/assets/powershell-QtSnmXcu.js +2 -0
  998. package/packages/web/dist/assets/preload-helper-7y9sWmk5.js +1 -0
  999. package/packages/web/dist/assets/prisma-DMgNhnYS.js +2 -0
  1000. package/packages/web/dist/assets/problems-BZY0Dwif.js +2 -0
  1001. package/packages/web/dist/assets/prolog-iXnhIJG7.js +2 -0
  1002. package/packages/web/dist/assets/proto-DB4EqR-F.js +2 -0
  1003. package/packages/web/dist/assets/pug-b31sGWmp.js +2 -0
  1004. package/packages/web/dist/assets/puppet-CDv2pdJW.js +2 -0
  1005. package/packages/web/dist/assets/purescript-9MfHhQsQ.js +2 -0
  1006. package/packages/web/dist/assets/push-payload-D5efGCzd.js +402 -0
  1007. package/packages/web/dist/assets/python-gzcpVVnB.js +2 -0
  1008. package/packages/web/dist/assets/qml-Dd7VLkrA.js +2 -0
  1009. package/packages/web/dist/assets/qmldir-DCQb3MpD.js +2 -0
  1010. package/packages/web/dist/assets/qss-Fe1Jh2GI.js +2 -0
  1011. package/packages/web/dist/assets/quadrantDiagram-XTYBLID2-Cr6SWkGn.js +8 -0
  1012. package/packages/web/dist/assets/r-yyMNTq5r.js +2 -0
  1013. package/packages/web/dist/assets/racket-DcIDlBhZ.js +2 -0
  1014. package/packages/web/dist/assets/radar-ABXABTNO-yHosJs_M.js +1 -0
  1015. package/packages/web/dist/assets/railroad-I3PHUGI6-C-LR5A-v.js +1 -0
  1016. package/packages/web/dist/assets/railroad-abnf-LNEFI6M7-DjGnF9uf.js +1 -0
  1017. package/packages/web/dist/assets/railroad-ebnf-DWYD2UWJ-BgsDVMJk.js +1 -0
  1018. package/packages/web/dist/assets/railroad-peg-JR7BVNR7-DkSNpypW.js +1 -0
  1019. package/packages/web/dist/assets/railroadDiagram-MRQ6NCDL-BdGdKtFJ.js +2 -0
  1020. package/packages/web/dist/assets/raku-B3gFvitq.js +2 -0
  1021. package/packages/web/dist/assets/razor-B0rzWF9b.js +2 -0
  1022. package/packages/web/dist/assets/rbs-C0MpOrj4.js +2 -0
  1023. package/packages/web/dist/assets/record-edits-CveFEsal.js +2 -0
  1024. package/packages/web/dist/assets/reg-CRGYupPL.js +2 -0
  1025. package/packages/web/dist/assets/regexp-DYMieNym.js +2 -0
  1026. package/packages/web/dist/assets/rel-BtDbiS_P.js +2 -0
  1027. package/packages/web/dist/assets/remote-config-BkaarDf3.js +2 -0
  1028. package/packages/web/dist/assets/requirementDiagram-Y7LWUY3S-ImkACz5a.js +85 -0
  1029. package/packages/web/dist/assets/review-CGUGvRV9.js +4 -0
  1030. package/packages/web/dist/assets/riscv-Ckw8ddFX.js +2 -0
  1031. package/packages/web/dist/assets/rolldown-runtime-COiEfhsA.js +1 -0
  1032. package/packages/web/dist/assets/ron-VUp2lXgN.js +2 -0
  1033. package/packages/web/dist/assets/rosmsg-CAekHB0j.js +2 -0
  1034. package/packages/web/dist/assets/rough.esm-Dy-Kn_BL.js +2 -0
  1035. package/packages/web/dist/assets/routes-qP_j74V5.js +4 -0
  1036. package/packages/web/dist/assets/rst-BtnuOAUZ.js +2 -0
  1037. package/packages/web/dist/assets/ruby-Dx9fBFuB.js +2 -0
  1038. package/packages/web/dist/assets/runs-k76usGfd.js +2 -0
  1039. package/packages/web/dist/assets/runtime-core.esm-bundler-wlpNGAAZ.js +4 -0
  1040. package/packages/web/dist/assets/rust-DpiIf5JO.js +2 -0
  1041. package/packages/web/dist/assets/sankeyDiagram-WGJFYUXA-Crpx7BLQ.js +41 -0
  1042. package/packages/web/dist/assets/sas-CYVU3X7O.js +2 -0
  1043. package/packages/web/dist/assets/sass-DXrisJhu.js +2 -0
  1044. package/packages/web/dist/assets/scala-BiFt_7mu.js +2 -0
  1045. package/packages/web/dist/assets/scheme-DQCgrYNe.js +2 -0
  1046. package/packages/web/dist/assets/scss-BAOTDanj.js +2 -0
  1047. package/packages/web/dist/assets/sdbl-bTVj8UrX.js +2 -0
  1048. package/packages/web/dist/assets/sequenceDiagram-5NDRBG5M-Ch5L-aWg.js +170 -0
  1049. package/packages/web/dist/assets/shaderlab-TOUzSsQk.js +2 -0
  1050. package/packages/web/dist/assets/shared-DTpYDMc_.js +2 -0
  1051. package/packages/web/dist/assets/shellscript-DUxm18QR.js +2 -0
  1052. package/packages/web/dist/assets/shellsession-DphNsVk1.js +2 -0
  1053. package/packages/web/dist/assets/size-BwnshyOe.js +2 -0
  1054. package/packages/web/dist/assets/sizeCapture-INFHLROL-3uHXrFqA.js +2 -0
  1055. package/packages/web/dist/assets/smalltalk-BHpQb5nM.js +2 -0
  1056. package/packages/web/dist/assets/smithy-Dgaz7aur.js +2 -0
  1057. package/packages/web/dist/assets/solidity-Bj7E1mRn.js +2 -0
  1058. package/packages/web/dist/assets/sources-Bm-TrxhL.js +2 -0
  1059. package/packages/web/dist/assets/soy-BprueKgI.js +2 -0
  1060. package/packages/web/dist/assets/sparql-D_iOobhT.js +2 -0
  1061. package/packages/web/dist/assets/splunk-BC2Px7Mm.js +2 -0
  1062. package/packages/web/dist/assets/sql-D4n2TlMc.js +2 -0
  1063. package/packages/web/dist/assets/src-DLK1P7oz.js +43 -0
  1064. package/packages/web/dist/assets/ssh-config-BgfXC-Er.js +2 -0
  1065. package/packages/web/dist/assets/stata-D3X-un4D.js +2 -0
  1066. package/packages/web/dist/assets/state-CjE-qA2w.js +2 -0
  1067. package/packages/web/dist/assets/state-J8VdpZXA.css +1 -0
  1068. package/packages/web/dist/assets/stateDiagram-v2-FJ4FJNEA-8fpbogV7.js +292 -0
  1069. package/packages/web/dist/assets/stores-BMEvTe-I.js +2 -0
  1070. package/packages/web/dist/assets/stylus-B6D30XZt.js +2 -0
  1071. package/packages/web/dist/assets/surrealql-5--I0FKd.js +2 -0
  1072. package/packages/web/dist/assets/svelte-DlUga76i.js +2 -0
  1073. package/packages/web/dist/assets/swift-CyEgAFGc.js +2 -0
  1074. package/packages/web/dist/assets/swimlanes-UMQ2AFYF-2-xKzyRO.js +2 -0
  1075. package/packages/web/dist/assets/swimlanesDiagram-OMPLPG4O-DHJrYwQz.js +9 -0
  1076. package/packages/web/dist/assets/system-verilog-Dh5ihWbf.js +2 -0
  1077. package/packages/web/dist/assets/systemd-BxMlprV5.js +2 -0
  1078. package/packages/web/dist/assets/systems-DIp94AET.js +2 -0
  1079. package/packages/web/dist/assets/table-LcEs15kL.js +4 -0
  1080. package/packages/web/dist/assets/talonscript-CohzipZa.js +2 -0
  1081. package/packages/web/dist/assets/tasl-DMoTqEGO.js +2 -0
  1082. package/packages/web/dist/assets/tcl-CZd0xW_V.js +2 -0
  1083. package/packages/web/dist/assets/templ-SgILQMBm.js +2 -0
  1084. package/packages/web/dist/assets/terraform-DswuEJGm.js +2 -0
  1085. package/packages/web/dist/assets/tex-B_j0g-0C.js +2 -0
  1086. package/packages/web/dist/assets/timeline-definition-SEUHKTQE-Czq0i_qO.js +121 -0
  1087. package/packages/web/dist/assets/toml-CcmNWLt0.js +2 -0
  1088. package/packages/web/dist/assets/treeView-D4JQ5SDB-B3NKij_H.js +1 -0
  1089. package/packages/web/dist/assets/treemap-SAJKECNS-Dt7uNpkP.js +1 -0
  1090. package/packages/web/dist/assets/ts-tags-Bb2M6NRT.js +2 -0
  1091. package/packages/web/dist/assets/tsv-sltzmVWM.js +2 -0
  1092. package/packages/web/dist/assets/tsx-D2H2cqPj.js +2 -0
  1093. package/packages/web/dist/assets/turtle-ByJddavk.js +2 -0
  1094. package/packages/web/dist/assets/twig-DqWgw3C7.js +2 -0
  1095. package/packages/web/dist/assets/types-D1t1HqPm.js +2 -0
  1096. package/packages/web/dist/assets/typescript-DVfyLS1i.js +2 -0
  1097. package/packages/web/dist/assets/typespec-BGhR2SqG.js +2 -0
  1098. package/packages/web/dist/assets/typst-Cs7gYQVT.js +2 -0
  1099. package/packages/web/dist/assets/ui-C7ZH_6oC.css +1 -0
  1100. package/packages/web/dist/assets/ui-W12UYhVu.js +17 -0
  1101. package/packages/web/dist/assets/url-BIg5IhGs.js +2 -0
  1102. package/packages/web/dist/assets/usecaseDiagram-AFA6YXN4-D3m4xj4y.js +329 -0
  1103. package/packages/web/dist/assets/v-DBj4K9d_.js +2 -0
  1104. package/packages/web/dist/assets/vala-zf12oZj6.js +2 -0
  1105. package/packages/web/dist/assets/vb-DOwzaHZ0.js +2 -0
  1106. package/packages/web/dist/assets/vennDiagram-NNMJR3RB-DeIkukMz.js +35 -0
  1107. package/packages/web/dist/assets/verilog-B2gwz-sJ.js +2 -0
  1108. package/packages/web/dist/assets/vhdl-BroJfC0k.js +2 -0
  1109. package/packages/web/dist/assets/viml-DvXPmvsu.js +2 -0
  1110. package/packages/web/dist/assets/vue-D0OpHdq8.js +2 -0
  1111. package/packages/web/dist/assets/vue-html-DYZahZaV.js +2 -0
  1112. package/packages/web/dist/assets/vue-vine-BsFhbSla.js +2 -0
  1113. package/packages/web/dist/assets/vyper-CgoNMtux.js +2 -0
  1114. package/packages/web/dist/assets/wardley-7MLQ67FV-DSzBQKe8.js +1 -0
  1115. package/packages/web/dist/assets/wardleyDiagram-S7YFUSEH-ef9ee0JD.js +79 -0
  1116. package/packages/web/dist/assets/wasm-ByWQv1Qj.js +2 -0
  1117. package/packages/web/dist/assets/wenyan-C8pVoKbM.js +2 -0
  1118. package/packages/web/dist/assets/wgsl-BsKzXJz4.js +2 -0
  1119. package/packages/web/dist/assets/widget-host-BCf6Tlt5.js +2 -0
  1120. package/packages/web/dist/assets/widgets-CrbkovMT.js +2 -0
  1121. package/packages/web/dist/assets/wikitext-ClFFjSW2.js +2 -0
  1122. package/packages/web/dist/assets/wit-DdvCle-K.js +2 -0
  1123. package/packages/web/dist/assets/wolfram-DLL8P-h_.js +2 -0
  1124. package/packages/web/dist/assets/xml-Cz9mX3j0.js +2 -0
  1125. package/packages/web/dist/assets/xsl-fJeiXJlj.js +2 -0
  1126. package/packages/web/dist/assets/xychartDiagram-GGNKY7IX-CuWtZyN1.js +8 -0
  1127. package/packages/web/dist/assets/yaml-BtwsWWqX.js +2 -0
  1128. package/packages/web/dist/assets/zenscript-BnlCZFoB.js +2 -0
  1129. package/packages/web/dist/assets/zig-CMLA9XwU.js +2 -0
  1130. package/packages/web/dist/favicon.svg +1 -0
  1131. package/packages/web/dist/icons/apple-touch-icon.png +0 -0
  1132. package/packages/web/dist/icons/icon-192.png +0 -0
  1133. package/packages/web/dist/icons/icon-512.png +0 -0
  1134. package/packages/web/dist/icons/maskable-512.png +0 -0
  1135. package/packages/web/dist/index.html +95 -0
  1136. package/packages/web/dist/offline.html +39 -0
  1137. package/packages/web/dist/screenshots/narrow.png +0 -0
  1138. package/packages/web/dist/screenshots/wide.png +0 -0
  1139. package/packages/web/dist/sw.js +2 -0
  1140. package/packages/web/dist/zod-config.js +7 -0
  1141. package/packages/web/package.json +25 -0
  1142. package/premade/claude.zip +0 -0
  1143. package/premade/database.zip +0 -0
  1144. package/premade/web.zip +0 -0
  1145. package/scripts/dev-env.ts +30 -0
  1146. package/scripts/hub-client.ts +2 -0
  1147. package/scripts/release/link.cjs +73 -0
  1148. package/scripts/run-stack.ts +98 -0
  1149. package/scripts/stack.ts +317 -0
  1150. package/scripts/start.ts +120 -0
  1151. package/scripts/supervise.ts +98 -0
  1152. package/systems/api/package.json +20 -0
  1153. package/systems/api/server/authoring.ts +348 -0
  1154. package/systems/api/server/env.ts +16 -0
  1155. package/systems/api/server/guard.ts +44 -0
  1156. package/systems/api/server/http.ts +274 -0
  1157. package/systems/api/server/impl.ts +233 -0
  1158. package/systems/api/server/index.ts +10 -0
  1159. package/systems/api/server/main.ts +27 -0
  1160. package/systems/api/server/openapi.ts +51 -0
  1161. package/systems/api/server/program.ts +158 -0
  1162. package/systems/api/server/services.ts +121 -0
  1163. package/systems/api/shared/http.ts +61 -0
  1164. package/systems/api/shared/index.ts +244 -0
  1165. package/systems/api/system.json +9 -0
  1166. package/systems/api/tsconfig.json +6 -0
  1167. package/systems/code/package.json +20 -0
  1168. package/systems/code/server/authoring.ts +233 -0
  1169. package/systems/code/server/env.ts +13 -0
  1170. package/systems/code/server/impl.ts +128 -0
  1171. package/systems/code/server/index.ts +5 -0
  1172. package/systems/code/server/main.ts +27 -0
  1173. package/systems/code/shared/index.ts +130 -0
  1174. package/systems/code/system.json +9 -0
  1175. package/systems/code/tsconfig.json +6 -0
  1176. package/systems/embedder/package.json +19 -0
  1177. package/systems/embedder/server/env.ts +27 -0
  1178. package/systems/embedder/server/http.ts +154 -0
  1179. package/systems/embedder/server/impl.ts +104 -0
  1180. package/systems/embedder/server/index.ts +22 -0
  1181. package/systems/embedder/server/main.ts +37 -0
  1182. package/systems/embedder/server/provider.ts +60 -0
  1183. package/systems/embedder/shared/index.ts +74 -0
  1184. package/systems/embedder/system.json +9 -0
  1185. package/systems/embedder/tsconfig.json +6 -0
  1186. package/systems/fs/client/BashView.vue +165 -0
  1187. package/systems/fs/client/ChangesView.vue +132 -0
  1188. package/systems/fs/client/DiffBody.vue +95 -0
  1189. package/systems/fs/client/DiffView.vue +73 -0
  1190. package/systems/fs/client/EntryInput.vue +102 -0
  1191. package/systems/fs/client/InstallView.vue +72 -0
  1192. package/systems/fs/client/OutputBlock.vue +65 -0
  1193. package/systems/fs/client/bash.ts +40 -0
  1194. package/systems/fs/client/changes.ts +87 -0
  1195. package/systems/fs/client/diff.ts +151 -0
  1196. package/systems/fs/client/fakes.ts +58 -0
  1197. package/systems/fs/client/index.ts +19 -0
  1198. package/systems/fs/client/preview/Preview.vue +70 -0
  1199. package/systems/fs/client/preview/index.html +12 -0
  1200. package/systems/fs/client/preview/main.ts +9 -0
  1201. package/systems/fs/client/preview/shots.ts +71 -0
  1202. package/systems/fs/client/rerun.ts +36 -0
  1203. package/systems/fs/context/authoring/index.md +42 -0
  1204. package/systems/fs/context/authoring/parts/actions.md +56 -0
  1205. package/systems/fs/context/authoring/parts/actions.reference.md +90 -0
  1206. package/systems/fs/context/authoring/parts/calling.md +71 -0
  1207. package/systems/fs/context/authoring/parts/calling.reference.md +134 -0
  1208. package/systems/fs/context/authoring/parts/client.md +273 -0
  1209. package/systems/fs/context/authoring/parts/client.reference/client.md +638 -0
  1210. package/systems/fs/context/authoring/parts/client.reference/fnpillprops.md +141 -0
  1211. package/systems/fs/context/authoring/parts/client.reference/resultview.md +619 -0
  1212. package/systems/fs/context/authoring/parts/client.reference.md +24 -0
  1213. package/systems/fs/context/authoring/parts/context.md +119 -0
  1214. package/systems/fs/context/authoring/parts/context.reference.md +458 -0
  1215. package/systems/fs/context/authoring/parts/contract.md +167 -0
  1216. package/systems/fs/context/authoring/parts/contract.reference.md +286 -0
  1217. package/systems/fs/context/authoring/parts/core-types/access-ts.md +39 -0
  1218. package/systems/fs/context/authoring/parts/core-types/admin-ts.md +41 -0
  1219. package/systems/fs/context/authoring/parts/core-types/api-index-ts.md +28 -0
  1220. package/systems/fs/context/authoring/parts/core-types/approvals-ts.md +494 -0
  1221. package/systems/fs/context/authoring/parts/core-types/auto-pair-ts.md +28 -0
  1222. package/systems/fs/context/authoring/parts/core-types/checks-ts.md +42 -0
  1223. package/systems/fs/context/authoring/parts/core-types/claims-ts.md +26 -0
  1224. package/systems/fs/context/authoring/parts/core-types/config-secrets-ts.md +24 -0
  1225. package/systems/fs/context/authoring/parts/core-types/connections-ts.md +178 -0
  1226. package/systems/fs/context/authoring/parts/core-types/context-files-ts.md +103 -0
  1227. package/systems/fs/context/authoring/parts/core-types/context-graph-ts.md +22 -0
  1228. package/systems/fs/context/authoring/parts/core-types/contextdecl.md +477 -0
  1229. package/systems/fs/context/authoring/parts/core-types/data-ts.md +236 -0
  1230. package/systems/fs/context/authoring/parts/core-types/decisions-ts.md +52 -0
  1231. package/systems/fs/context/authoring/parts/core-types/fn-block-ts.md +31 -0
  1232. package/systems/fs/context/authoring/parts/core-types/fn-facts-ts.md +228 -0
  1233. package/systems/fs/context/authoring/parts/core-types/gin-ts.md +24 -0
  1234. package/systems/fs/context/authoring/parts/core-types/grants-ts.md +55 -0
  1235. package/systems/fs/context/authoring/parts/core-types/lifecycle-ts.md +658 -0
  1236. package/systems/fs/context/authoring/parts/core-types/link-ts.md +410 -0
  1237. package/systems/fs/context/authoring/parts/core-types/llm-ts.md +268 -0
  1238. package/systems/fs/context/authoring/parts/core-types/manifest.md +460 -0
  1239. package/systems/fs/context/authoring/parts/core-types/manifestpatch.md +519 -0
  1240. package/systems/fs/context/authoring/parts/core-types/mention-search-ts.md +29 -0
  1241. package/systems/fs/context/authoring/parts/core-types/model-calls-ts.md +200 -0
  1242. package/systems/fs/context/authoring/parts/core-types/model-names-ts.md +31 -0
  1243. package/systems/fs/context/authoring/parts/core-types/modes-ts.md +89 -0
  1244. package/systems/fs/context/authoring/parts/core-types/owner-runs-ts.md +47 -0
  1245. package/systems/fs/context/authoring/parts/core-types/package-ts.md +83 -0
  1246. package/systems/fs/context/authoring/parts/core-types/primitives-ts.md +170 -0
  1247. package/systems/fs/context/authoring/parts/core-types/query-ts.md +50 -0
  1248. package/systems/fs/context/authoring/parts/core-types/records-actors-ts.md +259 -0
  1249. package/systems/fs/context/authoring/parts/core-types/records-chat-ts.md +217 -0
  1250. package/systems/fs/context/authoring/parts/core-types/records-content-ts.md +24 -0
  1251. package/systems/fs/context/authoring/parts/core-types/records-runs-ts.md +24 -0
  1252. package/systems/fs/context/authoring/parts/core-types/records-systems-ts.md +69 -0
  1253. package/systems/fs/context/authoring/parts/core-types/registries-ts.md +376 -0
  1254. package/systems/fs/context/authoring/parts/core-types/remote-auth-ts.md +60 -0
  1255. package/systems/fs/context/authoring/parts/core-types/resources-ts.md +250 -0
  1256. package/systems/fs/context/authoring/parts/core-types/run-ts.md +425 -0
  1257. package/systems/fs/context/authoring/parts/core-types/sensitivity-ts.md +52 -0
  1258. package/systems/fs/context/authoring/parts/core-types/system-events-ts.md +90 -0
  1259. package/systems/fs/context/authoring/parts/core-types/system-pages-ts.md +50 -0
  1260. package/systems/fs/context/authoring/parts/core-types/system-providers-ts.md +46 -0
  1261. package/systems/fs/context/authoring/parts/core-types/validation-ts.md +45 -0
  1262. package/systems/fs/context/authoring/parts/core-types/visuals-ts.md +107 -0
  1263. package/systems/fs/context/authoring/parts/core-types/web-ts.md +22 -0
  1264. package/systems/fs/context/authoring/parts/core-types/widgets-ts.md +299 -0
  1265. package/systems/fs/context/authoring/parts/core-types.md +164 -0
  1266. package/systems/fs/context/authoring/parts/ctx.md +94 -0
  1267. package/systems/fs/context/authoring/parts/ctx.reference/fnctx.md +516 -0
  1268. package/systems/fs/context/authoring/parts/ctx.reference/hubai.md +309 -0
  1269. package/systems/fs/context/authoring/parts/ctx.reference.md +21 -0
  1270. package/systems/fs/context/authoring/parts/data.md +162 -0
  1271. package/systems/fs/context/authoring/parts/data.reference.md +119 -0
  1272. package/systems/fs/context/authoring/parts/examples/client-findview-vue.md +77 -0
  1273. package/systems/fs/context/authoring/parts/examples/client-index-ts.md +48 -0
  1274. package/systems/fs/context/authoring/parts/examples/client-notecard-vue.md +43 -0
  1275. package/systems/fs/context/authoring/parts/examples/client-noteinput-vue.md +73 -0
  1276. package/systems/fs/context/authoring/parts/examples/client-notespage-vue.md +82 -0
  1277. package/systems/fs/context/authoring/parts/examples/client-reviewform-vue.md +57 -0
  1278. package/systems/fs/context/authoring/parts/examples/client-wordcount-vue.md +58 -0
  1279. package/systems/fs/context/authoring/parts/examples/package-json.md +40 -0
  1280. package/systems/fs/context/authoring/parts/examples/server-env-ts.md +40 -0
  1281. package/systems/fs/context/authoring/parts/examples/server-impl-ts.md +323 -0
  1282. package/systems/fs/context/authoring/parts/examples/server-index-ts.md +34 -0
  1283. package/systems/fs/context/authoring/parts/examples/server-main-ts.md +57 -0
  1284. package/systems/fs/context/authoring/parts/examples/server-notes-test-ts.md +95 -0
  1285. package/systems/fs/context/authoring/parts/examples/shared-index-ts.md +310 -0
  1286. package/systems/fs/context/authoring/parts/examples/system-json.md +36 -0
  1287. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-1-189.md +214 -0
  1288. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-190-370.md +202 -0
  1289. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-371-533.md +183 -0
  1290. package/systems/fs/context/authoring/parts/examples/tsconfig-json.md +27 -0
  1291. package/systems/fs/context/authoring/parts/examples.md +76 -0
  1292. package/systems/fs/context/authoring/parts/fns.md +225 -0
  1293. package/systems/fs/context/authoring/parts/fns.reference/fillclaims.md +267 -0
  1294. package/systems/fs/context/authoring/parts/fns.reference/fn.md +530 -0
  1295. package/systems/fs/context/authoring/parts/fns.reference.md +21 -0
  1296. package/systems/fs/context/authoring/parts/folder.md +472 -0
  1297. package/systems/fs/context/authoring/parts/gin.md +122 -0
  1298. package/systems/fs/context/authoring/parts/gin.reference.md +483 -0
  1299. package/systems/fs/context/authoring/parts/handlers-progress.md +100 -0
  1300. package/systems/fs/context/authoring/parts/handlers-progress.reference.md +197 -0
  1301. package/systems/fs/context/authoring/parts/hooks.md +56 -0
  1302. package/systems/fs/context/authoring/parts/hooks.reference.md +110 -0
  1303. package/systems/fs/context/authoring/parts/hub/hub-auto-pair-revoke.md +189 -0
  1304. package/systems/fs/context/authoring/parts/hub/hub-fns-load.md +470 -0
  1305. package/systems/fs/context/authoring/parts/hub/hub-run-background.md +562 -0
  1306. package/systems/fs/context/authoring/parts/hub/kinds-of-hub.md +95 -0
  1307. package/systems/fs/context/authoring/parts/hub.md +45 -0
  1308. package/systems/fs/context/authoring/parts/hub.reference.md +476 -0
  1309. package/systems/fs/context/authoring/parts/internals/manifestof.md +721 -0
  1310. package/systems/fs/context/authoring/parts/internals/permissionargs.md +652 -0
  1311. package/systems/fs/context/authoring/parts/internals/usagefromwire.md +257 -0
  1312. package/systems/fs/context/authoring/parts/internals.md +39 -0
  1313. package/systems/fs/context/authoring/parts/kinds-agents.md +278 -0
  1314. package/systems/fs/context/authoring/parts/kinds-agents.reference/authoringsession.md +195 -0
  1315. package/systems/fs/context/authoring/parts/kinds-agents.reference/kind.md +496 -0
  1316. package/systems/fs/context/authoring/parts/kinds-agents.reference.md +21 -0
  1317. package/systems/fs/context/authoring/parts/lifecycle.md +89 -0
  1318. package/systems/fs/context/authoring/parts/lifecycle.reference.md +60 -0
  1319. package/systems/fs/context/authoring/parts/mentions.md +76 -0
  1320. package/systems/fs/context/authoring/parts/mentions.reference.md +105 -0
  1321. package/systems/fs/context/authoring/parts/mistakes.md +465 -0
  1322. package/systems/fs/context/authoring/parts/named-types.md +97 -0
  1323. package/systems/fs/context/authoring/parts/named-types.reference.md +168 -0
  1324. package/systems/fs/context/authoring/parts/outcomes.md +120 -0
  1325. package/systems/fs/context/authoring/parts/outcomes.reference.md +287 -0
  1326. package/systems/fs/context/authoring/parts/owner-runs.md +62 -0
  1327. package/systems/fs/context/authoring/parts/owner-runs.reference.md +224 -0
  1328. package/systems/fs/context/authoring/parts/packaging.md +201 -0
  1329. package/systems/fs/context/authoring/parts/packaging.reference.md +206 -0
  1330. package/systems/fs/context/authoring/parts/providers.md +63 -0
  1331. package/systems/fs/context/authoring/parts/providers.reference.md +88 -0
  1332. package/systems/fs/context/authoring/parts/remote.md +63 -0
  1333. package/systems/fs/context/authoring/parts/remote.reference.md +175 -0
  1334. package/systems/fs/context/authoring/parts/resources.md +58 -0
  1335. package/systems/fs/context/authoring/parts/resources.reference.md +130 -0
  1336. package/systems/fs/context/authoring/parts/server.md +120 -0
  1337. package/systems/fs/context/authoring/parts/server.reference.md +569 -0
  1338. package/systems/fs/context/authoring/parts/settings-attachments.md +55 -0
  1339. package/systems/fs/context/authoring/parts/settings-attachments.reference.md +100 -0
  1340. package/systems/fs/context/authoring/parts/start.md +67 -0
  1341. package/systems/fs/context/authoring/parts/state-forms.md +103 -0
  1342. package/systems/fs/context/authoring/parts/state-forms.reference.md +32 -0
  1343. package/systems/fs/context/authoring/parts/testing.md +160 -0
  1344. package/systems/fs/context/authoring/parts/testing.reference/fakehub.md +396 -0
  1345. package/systems/fs/context/authoring/parts/testing.reference/memoryjournal.md +539 -0
  1346. package/systems/fs/context/authoring/parts/testing.reference/toolcall.md +509 -0
  1347. package/systems/fs/context/authoring/parts/testing.reference.md +24 -0
  1348. package/systems/fs/context/authoring/parts/widgets.md +165 -0
  1349. package/systems/fs/context/authoring/parts/widgets.reference/hub-visuals.md +623 -0
  1350. package/systems/fs/context/authoring/parts/widgets.reference/sourcecompatible.md +150 -0
  1351. package/systems/fs/context/authoring/parts/widgets.reference.md +21 -0
  1352. package/systems/fs/context/authoring/topics/begin.md +37 -0
  1353. package/systems/fs/context/authoring/topics/client.md +25 -0
  1354. package/systems/fs/context/authoring/topics/declare.md +40 -0
  1355. package/systems/fs/context/authoring/topics/examples.md +25 -0
  1356. package/systems/fs/context/authoring/topics/fns.md +37 -0
  1357. package/systems/fs/context/authoring/topics/server.md +40 -0
  1358. package/systems/fs/context/authoring/topics/types.md +28 -0
  1359. package/systems/fs/package.json +28 -0
  1360. package/systems/fs/server/authoring.ts +103 -0
  1361. package/systems/fs/server/builds.ts +101 -0
  1362. package/systems/fs/server/changes.ts +430 -0
  1363. package/systems/fs/server/commands.ts +133 -0
  1364. package/systems/fs/server/documents.ts +96 -0
  1365. package/systems/fs/server/env.ts +123 -0
  1366. package/systems/fs/server/files.ts +218 -0
  1367. package/systems/fs/server/git.ts +99 -0
  1368. package/systems/fs/server/hosting.ts +742 -0
  1369. package/systems/fs/server/impl.ts +451 -0
  1370. package/systems/fs/server/index.ts +151 -0
  1371. package/systems/fs/server/loader.ts +47 -0
  1372. package/systems/fs/server/main.ts +143 -0
  1373. package/systems/fs/server/mentions.ts +176 -0
  1374. package/systems/fs/server/network-guard.ts +10 -0
  1375. package/systems/fs/server/paths.ts +148 -0
  1376. package/systems/fs/server/problem.ts +26 -0
  1377. package/systems/fs/server/resources.ts +236 -0
  1378. package/systems/fs/server/reveal.ts +33 -0
  1379. package/systems/fs/server/run-tests.ts +17 -0
  1380. package/systems/fs/server/runner.ts +221 -0
  1381. package/systems/fs/server/safe.ts +83 -0
  1382. package/systems/fs/server/search.ts +214 -0
  1383. package/systems/fs/server/sections.ts +17 -0
  1384. package/systems/fs/server/sensitive.ts +560 -0
  1385. package/systems/fs/server/shell.ts +255 -0
  1386. package/systems/fs/server/snapshots.ts +119 -0
  1387. package/systems/fs/server/stale.ts +92 -0
  1388. package/systems/fs/server/testing.ts +256 -0
  1389. package/systems/fs/server/tests.ts +203 -0
  1390. package/systems/fs/server/tree.ts +44 -0
  1391. package/systems/fs/server/walk.ts +82 -0
  1392. package/systems/fs/shared/format.ts +29 -0
  1393. package/systems/fs/shared/hosting.ts +65 -0
  1394. package/systems/fs/shared/index.ts +533 -0
  1395. package/systems/fs/system.json +10 -0
  1396. package/systems/fs/tsconfig.json +6 -0
  1397. package/systems/google-calendar/package.json +18 -0
  1398. package/systems/google-calendar/server/calendar.ts +164 -0
  1399. package/systems/google-calendar/server/connector.ts +73 -0
  1400. package/systems/google-calendar/server/env.ts +25 -0
  1401. package/systems/google-calendar/server/fake.ts +127 -0
  1402. package/systems/google-calendar/server/google.ts +234 -0
  1403. package/systems/google-calendar/server/impl.ts +140 -0
  1404. package/systems/google-calendar/server/index.ts +7 -0
  1405. package/systems/google-calendar/server/main.ts +29 -0
  1406. package/systems/google-calendar/shared/index.ts +198 -0
  1407. package/systems/google-calendar/system.json +9 -0
  1408. package/systems/google-calendar/tsconfig.json +6 -0
  1409. package/systems/input/client/FieldInput.vue +118 -0
  1410. package/systems/input/client/FormCard.vue +223 -0
  1411. package/systems/input/client/form.ts +152 -0
  1412. package/systems/input/client/host.ts +13 -0
  1413. package/systems/input/client/index.ts +28 -0
  1414. package/systems/input/package.json +22 -0
  1415. package/systems/input/server/authoring.ts +240 -0
  1416. package/systems/input/server/env.ts +17 -0
  1417. package/systems/input/server/impl.ts +177 -0
  1418. package/systems/input/server/index.ts +4 -0
  1419. package/systems/input/server/main.ts +31 -0
  1420. package/systems/input/shared/forms.ts +106 -0
  1421. package/systems/input/shared/index.ts +389 -0
  1422. package/systems/input/system.json +10 -0
  1423. package/systems/input/tsconfig.json +6 -0
  1424. package/systems/mcp/package.json +21 -0
  1425. package/systems/mcp/server/dial.ts +102 -0
  1426. package/systems/mcp/server/elicitation.ts +103 -0
  1427. package/systems/mcp/server/env.ts +27 -0
  1428. package/systems/mcp/server/fixtures/stdio-server.ts +8 -0
  1429. package/systems/mcp/server/impl.ts +190 -0
  1430. package/systems/mcp/server/index.ts +10 -0
  1431. package/systems/mcp/server/instance.ts +442 -0
  1432. package/systems/mcp/server/main.ts +42 -0
  1433. package/systems/mcp/server/mirror.ts +179 -0
  1434. package/systems/mcp/server/oauth.ts +163 -0
  1435. package/systems/mcp/server/schema.ts +56 -0
  1436. package/systems/mcp/server/server-link.ts +216 -0
  1437. package/systems/mcp/shared/index.ts +130 -0
  1438. package/systems/mcp/shared/shapes.ts +42 -0
  1439. package/systems/mcp/system.json +10 -0
  1440. package/systems/mcp/tsconfig.json +6 -0
  1441. package/systems/ollama/client/ServersPage.vue +242 -0
  1442. package/systems/ollama/client/index.ts +13 -0
  1443. package/systems/ollama/client/logic.ts +108 -0
  1444. package/systems/ollama/package.json +22 -0
  1445. package/systems/ollama/server/api.ts +106 -0
  1446. package/systems/ollama/server/detect.ts +59 -0
  1447. package/systems/ollama/server/env.ts +43 -0
  1448. package/systems/ollama/server/fakes.ts +212 -0
  1449. package/systems/ollama/server/impl.ts +362 -0
  1450. package/systems/ollama/server/index.ts +10 -0
  1451. package/systems/ollama/server/install.ts +348 -0
  1452. package/systems/ollama/server/main.ts +67 -0
  1453. package/systems/ollama/server/models.ts +93 -0
  1454. package/systems/ollama/server/provider.ts +42 -0
  1455. package/systems/ollama/server/serve.ts +315 -0
  1456. package/systems/ollama/shared/index.ts +178 -0
  1457. package/systems/ollama/shared/schemas.ts +258 -0
  1458. package/systems/ollama/system.json +11 -0
  1459. package/systems/ollama/tsconfig.json +6 -0
  1460. package/systems/schedule/client/AgendaList.vue +74 -0
  1461. package/systems/schedule/client/AllSchedulesPage.vue +129 -0
  1462. package/systems/schedule/client/CalendarGrid.vue +155 -0
  1463. package/systems/schedule/client/CalendarPage.vue +203 -0
  1464. package/systems/schedule/client/ChangeResult.vue +23 -0
  1465. package/systems/schedule/client/FiringResult.vue +45 -0
  1466. package/systems/schedule/client/ScheduleCard.vue +63 -0
  1467. package/systems/schedule/client/ScheduleForm.vue +227 -0
  1468. package/systems/schedule/client/ScheduleListResult.vue +36 -0
  1469. package/systems/schedule/client/SchedulePage.vue +342 -0
  1470. package/systems/schedule/client/ScheduleResult.vue +23 -0
  1471. package/systems/schedule/client/host.ts +31 -0
  1472. package/systems/schedule/client/index.ts +29 -0
  1473. package/systems/schedule/client/logic.ts +655 -0
  1474. package/systems/schedule/client/results.ts +114 -0
  1475. package/systems/schedule/client/state.ts +372 -0
  1476. package/systems/schedule/package.json +27 -0
  1477. package/systems/schedule/server/args.ts +137 -0
  1478. package/systems/schedule/server/authoring.ts +202 -0
  1479. package/systems/schedule/server/env.ts +32 -0
  1480. package/systems/schedule/server/fns.ts +791 -0
  1481. package/systems/schedule/server/impl.ts +52 -0
  1482. package/systems/schedule/server/index.ts +10 -0
  1483. package/systems/schedule/server/kind.ts +48 -0
  1484. package/systems/schedule/server/main.ts +33 -0
  1485. package/systems/schedule/server/store.ts +195 -0
  1486. package/systems/schedule/server/summary.ts +184 -0
  1487. package/systems/schedule/server/timer.ts +893 -0
  1488. package/systems/schedule/shared/index.ts +376 -0
  1489. package/systems/schedule/shared/types.ts +264 -0
  1490. package/systems/schedule/shared/when.ts +395 -0
  1491. package/systems/schedule/shared/zoned.ts +44 -0
  1492. package/systems/schedule/system.json +15 -0
  1493. package/systems/schedule/tsconfig.json +6 -0
  1494. package/systems/template/README.md +46 -0
  1495. package/systems/template/client/index.ts +16 -0
  1496. package/systems/template/client/vue-shim.d.ts +13 -0
  1497. package/systems/template/package.json +20 -0
  1498. package/systems/template/server/env.ts +19 -0
  1499. package/systems/template/server/impl.ts +58 -0
  1500. package/systems/template/server/index.ts +13 -0
  1501. package/systems/template/server/main.ts +30 -0
  1502. package/systems/template/shared/index.ts +81 -0
  1503. package/systems/template/system.json +15 -0
  1504. package/systems/template/tsconfig.json +6 -0
  1505. package/systems/widgets/client/ProposalCard.vue +83 -0
  1506. package/systems/widgets/client/SavedWidget.vue +35 -0
  1507. package/systems/widgets/client/WidgetsPage.vue +112 -0
  1508. package/systems/widgets/client/index.ts +19 -0
  1509. package/systems/widgets/client/proposal.ts +52 -0
  1510. package/systems/widgets/package.json +23 -0
  1511. package/systems/widgets/server/authoring.ts +261 -0
  1512. package/systems/widgets/server/env.ts +21 -0
  1513. package/systems/widgets/server/impl.ts +252 -0
  1514. package/systems/widgets/server/index.ts +6 -0
  1515. package/systems/widgets/server/main.ts +32 -0
  1516. package/systems/widgets/server/run.ts +104 -0
  1517. package/systems/widgets/shared/index.ts +194 -0
  1518. package/systems/widgets/system.json +10 -0
  1519. package/systems/widgets/tsconfig.json +6 -0
  1520. package/tsconfig.base.json +30 -0
@@ -0,0 +1,1237 @@
1
+ /**
2
+ * Runs: every call of a fn, from an agent's tool call, a person's `!`, or a run's child call. A run is checked (the fn
3
+ * exists, is available and is a declared dep of its caller) and recorded; when its args don't fit (or its caller found
4
+ * them unusable, as JSON that didn't parse) it settles at once as `invalid-input`, which the caller hears and may
5
+ * retry. Otherwise it is put through the policies (it may wait for approval), queued at its priority, executed by the right executor (the system that owns its kind, the
6
+ * hub's own fns, or the agent loop), and settled exactly once. Everything about it is in the store, so the fn tree of
7
+ * a turn is a query away, and every change is published on the bus as a `run.update`.
8
+ *
9
+ * A child call has a key within its parent. Calling again with a key that already has a run gets that run back, so a
10
+ * resumed fn that repeats its calls in order gets finished results instead of running them twice. Cancel, pause and
11
+ * resume go as far as the run allows (`allowed`). Undo hands the run's undo payload back to its executor.
12
+ */
13
+ import {
14
+ ARGS_CHECK_KEY_PREFIX, clip, compact, CONCISE_LIMITS, FN_MODES, type ArgRepair, type GinCheck, INVALID_INPUT_CODE, isSettled, isUnsettled, MAIN_INSTANCE, mintId, problemLine, splitName, SystemName, type ActorId, type AllowedOperations, type FnRecord, type Json, type OutcomeWire, type ProgressReport,
15
+ type ProgressWire, type ResumeWire, type Run, type RunId, type RunInfo, type RunRequest, type RunSettled, type RunStatus, type RunText, type RunUpdate,
16
+ type Turn, type UndoOutcome, type Usd, type RunControlAction, type FnError, type InputProblem, type InvalidInput, type Compact,
17
+ flagsVerdict, proposalSubjectOf, type CompareFork, type SessionId, type ApprovalPreview, type ProposalAsk, type Approver, type PreviewPart, type SensitivityFlag, type InstanceName, type ProposedRun, type ProposeRun, type UserInfo, type QualifiedName, qualify,
18
+ } from '@harness/core';
19
+ import { HUB_SYSTEM, systemAvailability } from '../catalog/availability.ts';
20
+ import { installCard } from '../link/install.ts';
21
+ import { agentNames } from '../catalog/injections.ts';
22
+ import { DeadlineTimers, deadlineError, runDeadline, type RunDeadline } from './deadlines.ts';
23
+ import { fnError, HubStopping, messageOf, notConnected, RunRefused, RunStopped, RunTimedOut } from './errors.ts';
24
+ import { rows } from '../store/rows.ts';
25
+ import { SystemGone } from './executors.ts';
26
+ import { AGENT_KIND, type Ledger, type LimitResolver, type PolicyEngine, type RunInput, type RunService } from './index.ts';
27
+ import type { ControlAnswer, ExecutionDeps, RunCosts, RunEvents, RunExecutor, RunSettler } from './ports.ts';
28
+ import type { ExecutionQueues } from './queues.ts';
29
+ import { timeInfo } from './time.ts';
30
+ import { RunWording } from './wording.ts';
31
+ import type { FnModeGate, ModeVerdict } from '../fns/index.ts';
32
+ import { fnMode } from '../link/review-summary.ts';
33
+
34
+ /**
35
+ * Whether a run is the chat's own (`RunInfo.inChat`): a chat turn's agent or a fn it called directly, on a session, not
36
+ * in the background (not a nested agent's own calls, a background run or an MCP call, which has no session). A person
37
+ * watches it when they also have the session open (`RunInfo.watched`).
38
+ */
39
+ export function chatOwn(run: Pick<Run, 'session' | 'background'>, parent: Pick<Run, 'parent'> | undefined): boolean {
40
+ return run.session !== undefined && !run.background && parent?.parent === undefined;
41
+ }
42
+
43
+ /** Why a signal aborted, as an error. */
44
+ function abortError(signal: AbortSignal): Error {
45
+ const reason: unknown = signal.reason;
46
+ return reason instanceof Error ? reason : new Error(`stopped: ${String(reason)}`);
47
+ }
48
+
49
+ /** `work`, or the stop reason as soon as `signal` aborts, whichever comes first. */
50
+ function untilAborted<T>(work: Promise<T>, signal: AbortSignal): Promise<T> {
51
+ if (signal.aborted) return Promise.reject(abortError(signal));
52
+ return new Promise<T>((resolve, reject) => {
53
+ const stop = (): void => { reject(abortError(signal)); };
54
+ signal.addEventListener('abort', stop, { once: true });
55
+ work.then(
56
+ (value) => { signal.removeEventListener('abort', stop); resolve(value); },
57
+ (error: unknown) => { signal.removeEventListener('abort', stop); reject(error instanceof Error ? error : new Error(String(error))); },
58
+ );
59
+ });
60
+ }
61
+
62
+ /**
63
+ * The problems of args that don't fit a fn's args (its signature's `check`), as refused input (`schema`), each at its
64
+ * dotted path with `@aeye/schema`'s words for it, a few at most; none when they fit.
65
+ */
66
+ export function invalidArgs(checked: GinCheck<unknown>): InvalidInput | undefined {
67
+ if (checked.ok) return undefined;
68
+ const [first, ...rest] = checked.problems.slice(0, CONCISE_LIMITS.max).map((problem): InputProblem => ({ path: problem.path, message: clip(problem.message, CONCISE_LIMITS.chars) }));
69
+ return { source: 'schema', problems: first === undefined ? [{ path: '', message: clip(checked.message, CONCISE_LIMITS.chars) }] : [first, ...rest] };
70
+ }
71
+
72
+ /**
73
+ * What a check repaired in args, found by comparing them as sent with the value it decoded: a string where the decoded
74
+ * value has an object or a list is an object or list sent as a string holding its JSON (`json-string`), at its dotted
75
+ * path. None when the args were taken as sent.
76
+ */
77
+ export function repairsOf(sent: unknown, decoded: unknown, path: readonly string[] = []): ArgRepair[] {
78
+ if (sent === decoded) return [];
79
+ if (typeof sent === 'string' && typeof decoded === 'object' && decoded !== null) return [{ path: path.join('.'), repair: 'json-string' }];
80
+ if (Array.isArray(sent) && Array.isArray(decoded)) return sent.flatMap((item: unknown, at) => repairsOf(item, decoded[at], [...path, String(at)]));
81
+ if (isRecord(sent) && isRecord(decoded)) return Object.entries(sent).flatMap(([key, value]) => (key in decoded ? repairsOf(value, decoded[key], [...path, key]) : []));
82
+ return [];
83
+ }
84
+
85
+ /** Whether a value is a JSON object (not null, not a list). */
86
+ function isRecord(value: unknown): value is Record<string, unknown> {
87
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
88
+ }
89
+
90
+ /** Repairs at the same path as one already noted are noted once. */
91
+ function mergedRepairs(...lists: ReadonlyArray<readonly ArgRepair[]>): ArgRepair[] {
92
+ const seen = new Set<string>();
93
+ return lists.flat().filter((repair) => !seen.has(repair.path) && (seen.add(repair.path), true));
94
+ }
95
+
96
+ /** Which executor runs a run. */
97
+ export type ExecutorKind = 'system' | 'hub' | 'agent';
98
+
99
+ /** A `status` update, with the run's words for its new phase when it has one. */
100
+ function statusUpdate(status: RunStatus, text: RunText | undefined): RunUpdate {
101
+ return { type: 'status', status, ...(text === undefined ? {} : { text }) };
102
+ }
103
+
104
+ /** Refused input as an error's JSON data: compacted, its block too. */
105
+ function invalidData(invalid: InvalidInput): Compact<Omit<InvalidInput, 'blocked'>> & { blocked?: Compact<NonNullable<InvalidInput['blocked']>> } {
106
+ const { blocked, ...rest } = invalid;
107
+ return { ...compact(rest), ...(blocked === undefined ? {} : { blocked: compact(blocked) }) };
108
+ }
109
+
110
+ /** How a caller hears about a settled run. */
111
+ export function settledOf(outcome: OutcomeWire | undefined, run: RunId): RunSettled {
112
+ if (outcome === undefined) return { status: 'background', run };
113
+ switch (outcome.status) {
114
+ case 'done': return { status: 'done', result: outcome.result };
115
+ // a code caller hears refused input as a caller error carrying the problems; agents read the run's own status
116
+ case 'invalid-input': return { status: 'failed', error: { class: 'caller', code: INVALID_INPUT_CODE, message: outcome.invalid.problems.map(problemLine).join('; '), data: invalidData(outcome.invalid) } };
117
+ case 'failed': return { status: 'failed', error: outcome.error };
118
+ case 'cancelled': return outcome.error === undefined ? { status: 'cancelled' } : { status: 'cancelled', error: outcome.error };
119
+ case 'paused': return { status: 'background', run };
120
+ }
121
+ }
122
+
123
+ /** The system that executes a fn: its own for native fns, else the system that defines its kind. */
124
+ export function executingSystem(fn: FnRecord): string {
125
+ return fn.decl.kind === 'native' ? fn.system : splitName(fn.decl.kind).system;
126
+ }
127
+
128
+ /** The executor kind for a fn. */
129
+ export function executorKind(fn: FnRecord): ExecutorKind {
130
+ if (fn.decl.kind === AGENT_KIND) return 'agent';
131
+ return executingSystem(fn) === HUB_SYSTEM ? 'hub' : 'system';
132
+ }
133
+
134
+ /** A run's progress after one report: a fraction replaces the last; a step's status joins the others. */
135
+ export function mergeProgress(current: ProgressWire | undefined, report: ProgressReport): ProgressWire {
136
+ if ('fraction' in report) return report.message === undefined ? { fraction: report.fraction } : { fraction: report.fraction, message: report.message };
137
+ const steps = current !== undefined && 'steps' in current ? current.steps : {};
138
+ return { steps: { ...steps, [report.step]: report.detail === undefined ? { status: report.status } : { status: report.status, detail: report.detail } } };
139
+ }
140
+
141
+ /**
142
+ * The handlers a caller can answer for a fn: all of them when a person answers (a run they started, or one an agent
143
+ * called on their behalf), else those the calling run named.
144
+ */
145
+ export function suppliedHandlers(fn: FnRecord, parent: Run | undefined, named: readonly string[]): string[] {
146
+ return parent === undefined || parent.kind === AGENT_KIND ? Object.keys(fn.decl.handlers) : named.filter((name) => name in fn.decl.handlers);
147
+ }
148
+
149
+ /** The key prefix of a run a system proposed (`propose`), apart from the keys of the calls it makes. */
150
+ export const PROPOSED_KEY = 'propose:';
151
+
152
+ /** How many runs up a call's tree a policy's `via` is looked for. */
153
+ const MAX_VIA_DEPTH = 32;
154
+
155
+ /** The error code of a call a fn's args check may not make (not a declared check dep, or not a `read` fn). */
156
+ export const CHECK_CALL_CODE = 'check-call';
157
+ /** The error code of a run a policy denied or its approver declined. */
158
+ export const DECLINED_CODE = 'denied';
159
+
160
+ /** Build 6: the hub fn whose runs hold the model calls a system makes outside its own runs (`systemWork`). */
161
+ export const SYSTEM_CALLS_FN: QualifiedName = 'hub/system_calls';
162
+
163
+ /**
164
+ * Secrets in a run's args (`boot/admin-secrets.ts`): the args of a fn that carries secret values (a system's config,
165
+ * a provider's keys) are sealed before the run is stored, so its row, its approval and anything shown from them hold
166
+ * none in plain text; the executor gets them unsealed, and they are removed once the run settles.
167
+ */
168
+ export interface RunArgSecrets {
169
+ /**
170
+ * The args to store for a new run: each secret value sealed (in a secret named for the run), anything else as given;
171
+ * `invalid` when the caller wrote a `{ $secret }` reference of its own, which is refused (never revealed).
172
+ */
173
+ seal(input: { readonly run: RunId; readonly fn: QualifiedName; readonly args: Json; readonly owner: ActorId }): Promise<{ args: Json; invalid?: InvalidInput }>;
174
+ /** A run's args as its executor gets them: the secrets sealed for this run revealed. */
175
+ unseal(run: Pick<Run, 'id' | 'fn' | 'args'>): Promise<Json>;
176
+ /** Remove the secrets sealed for a settled run. */
177
+ release(run: Pick<Run, 'id' | 'fn' | 'args'>): Promise<void>;
178
+ }
179
+
180
+ /** A promise with its resolver. */
181
+ interface Waiter {
182
+ readonly promise: Promise<RunSettled>;
183
+ readonly resolve: (settled: RunSettled) => void;
184
+ }
185
+
186
+ function waiter(): Waiter {
187
+ let resolve: (settled: RunSettled) => void = () => undefined;
188
+ const promise = new Promise<RunSettled>((r) => { resolve = r; });
189
+ return { promise, resolve };
190
+ }
191
+
192
+ /** What the run service uses besides the other modules. */
193
+ export interface RunServiceDeps extends ExecutionDeps {
194
+ readonly policies: Pick<PolicyEngine, 'decide' | 'propose'>;
195
+ readonly ledger: Pick<Ledger, 'remaining'>;
196
+ /** The limits of a turn the hub makes for a run a system proposed outside any run. */
197
+ readonly limits: Pick<LimitResolver, 'resolve'>;
198
+ readonly queues: Pick<ExecutionQueues, 'enqueueRun' | 'cancel' | 'slot'>;
199
+ }
200
+
201
+
202
+ /** The run service on the hub store and the run queue. */
203
+ export class HubRunService implements RunService, RunSettler, RunEvents, RunCosts {
204
+ readonly #deps: RunServiceDeps;
205
+ readonly #executors = new Map<ExecutorKind, RunExecutor>();
206
+ readonly #waiters = new Map<RunId, Waiter>();
207
+ readonly #jobs = new Map<RunId, string>();
208
+ readonly #running = new Map<RunId, AbortController>();
209
+ readonly #handlers = new Map<RunId, readonly string[]>();
210
+ readonly #resumes = new Map<RunId, ResumeWire['reason']>();
211
+ readonly #settling = new Set<RunId>();
212
+ /** Runs a queue job is handling now, so a second job for the same run (a resend, a redelivery) stands aside. */
213
+ readonly #executing = new Set<RunId>();
214
+ readonly #listeners = new Set<(run: Run, settled: RunSettled) => void>();
215
+ readonly #wording: RunWording;
216
+ /** A timer per started run, at its deadline (`deadlines.ts`). */
217
+ readonly #deadlines: DeadlineTimers;
218
+ /** What a chat's fn mode lets its agent run (the fns module sets it at start). */
219
+ #gate: FnModeGate | undefined;
220
+ /** Seals the secrets in the args of the fns that carry them (boot sets it with the admin fns). */
221
+ #argSecrets: RunArgSecrets | undefined;
222
+ /**
223
+ * Runs whose args their system is checking now (`check`: their calls must be the check's declared read deps), and
224
+ * the calls made under them until each settles (`under`: their calls must read). Neither ever waits for approval.
225
+ */
226
+ readonly #checking = new Map<RunId, 'check' | 'under'>();
227
+
228
+ constructor(deps: RunServiceDeps) {
229
+ this.#deps = deps;
230
+ this.#wording = new RunWording(deps.catalog);
231
+ this.#deadlines = new DeadlineTimers(deps.clock);
232
+ deps.bus.subscribe('approval', ({ approval }) => {
233
+ if (approval.status === 'pending') return;
234
+ void this.#approved(approval.run, approval.status === 'approved', approval.decisions.at(-1)).catch((error: unknown) => {
235
+ deps.log.error('run.approval-failed', { run: approval.run, error: messageOf(error) });
236
+ });
237
+ });
238
+ }
239
+
240
+ gateWith(gate: FnModeGate): void {
241
+ this.#gate = gate;
242
+ }
243
+
244
+ /** Seal the secrets in run args with this from now on, removing a run's once it settles. */
245
+ sealArgsWith(secrets: RunArgSecrets): void {
246
+ this.#argSecrets = secrets;
247
+ this.onSettled((run) => {
248
+ void secrets.release(run).catch((error: unknown) => { this.#deps.log.error('run.arg-secrets.release-failed', { run: run.id, error: messageOf(error) }); });
249
+ });
250
+ }
251
+
252
+ /** Set the executor for one kind of target. */
253
+ use(kind: ExecutorKind, executor: RunExecutor): void {
254
+ this.#executors.set(kind, executor);
255
+ }
256
+
257
+ async start(given: RunInput): Promise<{ run: RunId; settled: Promise<RunSettled> }> {
258
+ const { catalog, store, clock } = this.#deps;
259
+ let input = given;
260
+ const fn = await catalog.fn(input.fn);
261
+ if (fn === undefined) throw new RunRefused(fnError('caller', `There is no fn ${input.fn}.`, 'not-found'));
262
+ // a call its caller already refused because the fn is blocked (held, off, offline, an account to connect) is still
263
+ // kept, settled invalid-input at once and never run, so the chat sees what blocked it (`InvalidInput.blocked`)
264
+ const blockedCall = input.invalid?.blocked !== undefined;
265
+ if (fn.disabled && !blockedCall) throw new RunRefused(fnError('caller', `${input.fn} is turned off.`, 'disabled'));
266
+ // an admin's test call (and what it calls) runs on an installed system, which offers nothing else yet
267
+ const test = input.test === true || (input.parent !== undefined && (await store.table('runs').get(input.parent))?.test === true);
268
+ if (fn.available !== true && !blockedCall && !(test && await this.#testable(fn))) throw new RunRefused(fnError('retry', `${input.fn} is unavailable: ${fn.available.detail}`, 'unavailable'));
269
+ const turn = await store.table('turns').get(input.turn);
270
+ if (turn === undefined) throw new RunRefused(fnError('fatal', `There is no turn ${input.turn}.`, 'not-found'));
271
+ // a fn the turn's person may not see is as good as missing to them; a per-person fn needs a connection to act as
272
+ const access = await this.#deps.access.scope(turn.user.id);
273
+ if (!access.seesFn(fn)) throw new RunRefused(fnError('caller', `There is no fn ${input.fn}.`, 'not-found'));
274
+ // the args checked against the fn's (its signature's `check`, every caller's): an object or list sent as a string
275
+ // holding its JSON is read as that JSON, and the run says so, with what the caller repaired already (a model's call
276
+ // core decoded); input already refused is not checked (a blocked fn's signature may not even resolve, its kind gone)
277
+ const argsCheck = input.invalid === undefined ? (await catalog.signature(fn.name)).check(input.args) : undefined;
278
+ const found = argsCheck?.ok === true ? repairsOf(input.args, argsCheck.value) : [];
279
+ const repairs = mergedRepairs(input.repairs ?? [], found);
280
+ if (argsCheck?.ok === true && found.length > 0) input = { ...input, args: argsCheck.value };
281
+ if (repairs.length > 0) {
282
+ this.#deps.log.info('run.args-repaired', { fn: fn.name, turn: input.turn, repairs: repairs.map((repair) => `${repair.path || '(args)'}: ${repair.repair}`) });
283
+ }
284
+ const connection = access.connection(fn, input.args);
285
+ if (connection?.state === 'missing' && !blockedCall) throw new RunRefused(fnError('retry', `${input.fn} acts as you: connect your account on the ${connection.page} page first.`, 'unavailable'));
286
+ // a call through a key that signs in, with no connection to it, could only fail in the run: refused before any
287
+ // approval is asked for it
288
+ const unconnected = connection === undefined && !blockedCall ? await this.#deps.connections.unconnected(fn, input.args) : undefined;
289
+ if (unconnected !== undefined) throw new RunRefused(notConnected(unconnected));
290
+ const parent = input.parent === undefined ? undefined : await store.table('runs').get(input.parent);
291
+ if (input.parent !== undefined && parent === undefined) throw new RunRefused(fnError('fatal', `There is no parent run ${input.parent}.`, 'not-found'));
292
+ if (parent !== undefined) {
293
+ const existing = await this.#child(parent.id, input.key);
294
+ if (existing !== undefined) return { run: existing.id, settled: this.#waitFor(existing) };
295
+ await this.#checkDep(parent, fn);
296
+ }
297
+ // a call made while its parent's args are checked (or under such a call) only reads, and never waits for anyone
298
+ const checking = parent === undefined ? undefined : this.#checking.get(parent.id);
299
+ if (parent !== undefined && checking !== undefined) await this.#checkCall(parent, fn, checking);
300
+ // a check's call that comes once the hub stopped waiting for it (its deadline passed) is never run unchecked
301
+ if (parent !== undefined && checking === undefined && input.key.startsWith(ARGS_CHECK_KEY_PREFIX)) {
302
+ throw new RunRefused(fnError('caller', `${parent.fn}'s args check is over, so its calls are no longer taken.`, CHECK_CALL_CODE));
303
+ }
304
+ const handlers = suppliedHandlers(fn, parent, input.handlers);
305
+ const missing = Object.entries(fn.decl.handlers).filter(([name, decl]) => decl.required && !handlers.includes(name)).map(([name]) => name);
306
+ if (missing.length > 0) throw new RunRefused(fnError('fatal', `${fn.name} needs its caller to answer ${missing.join(', ')}, which this caller can't.`, 'needs-handlers'));
307
+ // input already refused is not checked again (a blocked fn's signature may not even resolve, its kind gone)
308
+ const checked = input.invalid ?? (argsCheck === undefined ? undefined : invalidArgs(argsCheck));
309
+ const system = SystemName.parse(executingSystem(fn));
310
+ // the one place a system's run is given its instance: a fleet with no clear pick is refused input the caller can fix
311
+ const routed = checked === undefined && executorKind(fn) === 'system'
312
+ ? await this.#deps.instances.route({ system, args: input.args, on: input.on, session: input.session, routing: fn.decl.routing })
313
+ : undefined;
314
+ const refused = checked ?? (routed !== undefined && 'invalid' in routed ? routed.invalid : undefined);
315
+ const instance = routed !== undefined && 'instance' in routed ? routed.instance.instance : undefined;
316
+
317
+ const id = mintId('run', this.#deps.random);
318
+ // secrets in the args never rest in plain text: the row, its approval and its views hold them sealed
319
+ const sealing = this.#argSecrets === undefined ? { args: input.args } : await this.#argSecrets.seal({ run: id, fn: fn.name, args: input.args, owner: input.actor });
320
+ const { args } = sealing;
321
+ // a hub fn's own check (a record's value against its type) runs on the args as given, before anyone is asked
322
+ const early = refused ?? sealing.invalid ?? await this.#executors.get(executorKind(fn))?.check?.({ id, fn: fn.name, args: input.args }, turn.user.id);
323
+ const { operations } = fn.decl;
324
+ const run: Run = {
325
+ id,
326
+ fn: fn.name,
327
+ fnVersion: fn.version,
328
+ kind: fn.decl.kind,
329
+ system,
330
+ ...(instance === undefined ? {} : { instance }),
331
+ root: parent?.root ?? id,
332
+ turn: input.turn,
333
+ ...(input.session === undefined ? {} : { session: input.session }),
334
+ ...(parent === undefined ? {} : { parent: parent.id }),
335
+ key: input.key,
336
+ actor: input.actor,
337
+ caller: input.caller,
338
+ ...(connection?.state === 'ready' ? { connection: connection.connection.id } : {}),
339
+ ...(input.llmCall === undefined ? {} : { llmCall: input.llmCall }),
340
+ ...(input.toolCallId === undefined ? {} : { toolCallId: input.toolCallId }),
341
+ args,
342
+ ...(repairs.length === 0 ? {} : { repairs: [...repairs] }),
343
+ ...(test ? { test: true } : {}),
344
+ status: 'queued',
345
+ allowed: { cancel: operations.cancel, pause: operations.pause, background: operations.background },
346
+ cost: 0,
347
+ totalCost: 0,
348
+ priority: input.priority,
349
+ background: false,
350
+ attempt: 1,
351
+ errors: [],
352
+ stateChanges: [],
353
+ createdAt: clock(),
354
+ };
355
+ const text = await this.#wording.text(run, { status: 'queued' }, fn);
356
+ await store.table('runs').insert(text === undefined ? run : { ...run, text });
357
+ this.#handlers.set(id, handlers);
358
+ const settled = this.#waitFor(run);
359
+ this.#publish(run, statusUpdate('queued', text));
360
+ this.#deps.log.info('run.created', { run: id, fn: fn.name, turn: input.turn, parent: input.parent ?? null, key: input.key });
361
+ // what a call under an args check calls is held to the same rules, until it settles
362
+ if (checking !== undefined) this.#underCheck(id, settled);
363
+
364
+ // a fn that checks its own args (`FnDecl.check`) does so once the run exists, before anyone is asked
365
+ const invalid = early ?? await this.#argsCheck(run, fn, turn.user);
366
+ if (invalid !== undefined) {
367
+ // refused input never reaches the policies or the fn: the caller hears the problems and may try again
368
+ this.#deps.log.info('run.invalid-input', { run: id, fn: fn.name, source: invalid.source, problems: invalid.problems.length });
369
+ await this.settle(id, { status: 'invalid-input', invalid });
370
+ return { run: id, settled };
371
+ }
372
+ // a fn that touches files says first which sensitive ones the call would touch: a refusal stops it here
373
+ const flagged = fn.decl.flags === true ? await this.#flags(run, fn, turn.user) : { flags: [] };
374
+ if ('refused' in flagged) {
375
+ await this.settle(id, flagged.refused);
376
+ return { run: id, settled };
377
+ }
378
+ const sensitive = flagsVerdict(flagged.flags);
379
+ if (sensitive.effect === 'refuse') {
380
+ this.#deps.log.info('run.flags-refused', { run: id, fn: fn.name, flags: flagged.flags.length });
381
+ await this.settle(id, { status: 'invalid-input', invalid: { source: 'validation', problems: [{ path: '', message: sensitive.reason }] } });
382
+ return { run: id, settled };
383
+ }
384
+ // a chat's fn mode stands in front of the policies for the calls its agent makes
385
+ const mode = await this.#mode(run, fn, parent, flagged.flags);
386
+ if (mode.effect === 'refuse') {
387
+ await this.settle(id, { status: 'failed', error: fnError('caller', mode.reason, 'chat-mode') });
388
+ return { run: id, settled };
389
+ }
390
+ // the preview is asked for only when an approval is made; a refusal settles the run with the system's reason
391
+ const previewed: { refused?: OutcomeWire; ask?: ProposalAsk } = {};
392
+ // the flags lead the card of a call that touches sensitive files, before what the system or auto mode says
393
+ const flagParts: PreviewPart[] = sensitive.effect === 'ask' ? [{ type: 'flags', flags: flagged.flags }] : [];
394
+ const modeParts: PreviewPart[] = mode.effect === 'ask' ? [{ type: 'text', text: mode.reason }] : [];
395
+ const asked: ApprovalPreview | undefined = flagParts.length > 0
396
+ ? { title: `${fn.name} touches sensitive files`, parts: [...flagParts, ...modeParts], irreversible: false }
397
+ : mode.effect === 'ask' ? { title: `Auto mode asks you about ${fn.name}`, parts: modeParts, irreversible: false } : undefined;
398
+ const preview = fn.decl.approval?.preview === true
399
+ ? async (): Promise<ApprovalPreview | undefined> => {
400
+ const answer = await this.#preview(run, fn, turn.user);
401
+ if ('preview' in answer) {
402
+ if (answer.ask !== undefined) previewed.ask = answer.ask;
403
+ return { ...answer.preview, parts: [...flagParts, ...modeParts, ...answer.preview.parts] };
404
+ }
405
+ previewed.refused = answer.refused;
406
+ return undefined;
407
+ }
408
+ : asked === undefined ? undefined : () => Promise.resolve(asked);
409
+ const decision = await this.#deps.policies.decide({
410
+ fn: fn.name, actor: input.actor, turnUser: turn.user.id, args, run: id, caller: input.caller, ...(input.session === undefined ? {} : { session: input.session }),
411
+ ...(preview === undefined ? {} : { preview, form: () => previewed.ask }),
412
+ ...(sensitive.effect === 'ask' ? { sensitive: true } : {}),
413
+ ...(mode.effect === 'ask' ? { ask: { by: 'turn-user' } } : {}),
414
+ ...(mode.effect === 'allow' ? { autoAllowed: true } : {}),
415
+ ...(await this.#withinParent(fn, parent) ? { withinParent: true } : {}),
416
+ // an A/B compare's variant (its session is a fork): what would change something asks in each variant
417
+ ...(await this.#variantOf(input.session)),
418
+ // the fns of the runs this call is made under, for policies that match by caller (`FnMatch.via`)
419
+ ...(parent === undefined ? {} : { via: await this.#via(parent) }),
420
+ // a per-person fn its person keeps on 'ask first' waits for the connection's owner
421
+ ...(connection?.state === 'ready' && connection.option.ask ? { ask: connection.connection.owner === turn.user.id ? { by: 'turn-user' } : { by: 'actor', actor: connection.connection.owner } } : {}),
422
+ ...(checking === undefined || parent === undefined ? {} : { noAsk: `${fn.name} would wait for approval, and a call made to check ${parent.fn}'s args can't wait for anyone.` }),
423
+ });
424
+ if (previewed.refused !== undefined) {
425
+ await this.settle(id, previewed.refused);
426
+ } else if (decision.effect === 'deny') {
427
+ await this.settle(id, { status: 'failed', error: fnError('caller', `Not allowed: ${decision.reason}`, DECLINED_CODE) });
428
+ } else if (decision.effect === 'ask') {
429
+ await this.#moveTo(run, { status: 'awaiting-approval' }, fn);
430
+ } else {
431
+ this.#enqueue(run);
432
+ }
433
+ if (input.background) await this.background(id);
434
+ return { run: id, settled };
435
+ }
436
+
437
+ /** The fns of a run and the runs above it, nearest first (what a policy's `via` is matched against). */
438
+ async #via(parent: Run): Promise<QualifiedName[]> {
439
+ const fns: QualifiedName[] = [];
440
+ let run: Run | undefined = parent;
441
+ // a tree is shallow; the bound only guards against a broken parent chain
442
+ for (let depth = 0; run !== undefined && depth < MAX_VIA_DEPTH; depth++) {
443
+ fns.push(run.fn);
444
+ run = run.parent === undefined ? undefined : await this.#deps.store.table('runs').get(run.parent);
445
+ }
446
+ return fns;
447
+ }
448
+
449
+ /** The compare variant a session is the fork of, if it is one (`Session.fork`). */
450
+ async #variantOf(session: SessionId | undefined): Promise<{ variant?: CompareFork }> {
451
+ const fork = session === undefined ? undefined : (await this.#deps.store.table('sessions').get(session))?.fork;
452
+ return fork === undefined ? {} : { variant: fork };
453
+ }
454
+
455
+ /** Whether a run of the fn's own system calls it, and that run's fn declares at least the fn's mode (`withinParent`). */
456
+ async #withinParent(fn: FnRecord, parent: Run | undefined): Promise<boolean> {
457
+ if (parent === undefined || parent.system !== fn.system || fn.system === HUB_SYSTEM) return false;
458
+ const mode = fn.decl.effects?.mode;
459
+ const parentMode = (await this.#deps.catalog.fn(parent.fn))?.decl.effects?.mode;
460
+ return mode !== undefined && parentMode !== undefined && FN_MODES.indexOf(parentMode) >= FN_MODES.indexOf(mode);
461
+ }
462
+
463
+ /** What the run's chat's fn mode says about it: only calls an agent makes in a session are checked. */
464
+ async #mode(run: Run, fn: FnRecord, parent: Run | undefined, flags: readonly SensitivityFlag[]): Promise<ModeVerdict> {
465
+ if (this.#gate === undefined || parent?.kind !== AGENT_KIND || run.session === undefined) return { effect: 'pass' };
466
+ const session = await this.#deps.store.table('sessions').get(run.session);
467
+ if (session === undefined) return { effect: 'pass' };
468
+ const verdict = await this.#gate.check({ session, fn, args: run.args, run: run.id, flags });
469
+ if (verdict.effect !== 'pass') this.#deps.log.info('run.chat-mode', { run: run.id, fn: fn.name, mode: session.fnMode ?? null, effect: verdict.effect });
470
+ return verdict;
471
+ }
472
+
473
+ /**
474
+ * A native fn's own check of a call's args (`FnDecl.check`, `checkArgs` on the system link), after they parse and
475
+ * before the policies: its problems as refused input (a few at most, each clipped), or undefined when it found none.
476
+ * A check that can't run (its system not connected, an error, `HARNESS_ARGS_CHECK_TIMEOUT` passed) is logged and
477
+ * the call goes on as if the fn had none: it is checked again by the run itself.
478
+ */
479
+ async #argsCheck(run: Run, fn: FnRecord, user: UserInfo): Promise<InvalidInput | undefined> {
480
+ if (fn.decl.check === undefined || fn.decl.kind !== 'native') return undefined;
481
+ const { log, clock } = this.#deps;
482
+ const connection = this.#deps.link.connection(run.system, run.instance);
483
+ if (connection === undefined) {
484
+ log.warn('run.args-check-skipped', { run: run.id, fn: fn.name, reason: `${run.system} is not connected` });
485
+ return undefined;
486
+ }
487
+ const timeout = this.#deps.settings.execution.HARNESS_ARGS_CHECK_TIMEOUT;
488
+ this.#checking.set(run.id, 'check');
489
+ try {
490
+ const answer = await connection.peer.call('checkArgs', {
491
+ run: run.id, fn: splitName(run.fn).local, args: run.args, user, deadline: clock() + timeout,
492
+ }, { signal: AbortSignal.any([connection.signal, AbortSignal.timeout(timeout)]) });
493
+ const [first, ...rest] = answer.problems.slice(0, CONCISE_LIMITS.max).map((problem): InputProblem => ({ path: problem.path, message: clip(problem.message, CONCISE_LIMITS.chars) }));
494
+ if (first === undefined) return undefined;
495
+ log.info('run.args-check-refused', { run: run.id, fn: fn.name, problems: answer.problems.length });
496
+ return { source: 'validation', problems: [first, ...rest] };
497
+ } catch (error) {
498
+ log.warn('run.args-check-skipped', { run: run.id, fn: fn.name, reason: messageOf(error) });
499
+ return undefined;
500
+ } finally {
501
+ this.#checking.delete(run.id);
502
+ }
503
+ }
504
+
505
+ /**
506
+ * Refuse a call an args check may not make: the checked run's calls must be the deps its check declares
507
+ * (`FnArgsCheck.deps`), and every call under a check must be of a fn whose mode is `read`.
508
+ */
509
+ async #checkCall(parent: Run, fn: FnRecord, checking: 'check' | 'under'): Promise<void> {
510
+ if (checking === 'check') {
511
+ const declared = (await this.#deps.catalog.fn(parent.fn))?.decl.check?.deps ?? [];
512
+ if (!declared.includes(fn.name)) {
513
+ throw new RunRefused(fnError('caller', `${parent.fn}'s args check may call only the deps its check declares (${declared.join(', ') || 'none'}), not ${fn.name}.`, CHECK_CALL_CODE));
514
+ }
515
+ }
516
+ const mode = fnMode(fn.decl);
517
+ if (mode !== 'read') throw new RunRefused(fnError('caller', `A call made to check ${parent.fn}'s args may only read, and ${fn.name} is a ${mode} fn.`, CHECK_CALL_CODE));
518
+ }
519
+
520
+ /** Hold a call made under an args check to the check's rules until it settles. */
521
+ #underCheck(run: RunId, settled: Promise<RunSettled>): void {
522
+ this.#checking.set(run, 'under');
523
+ void settled.finally(() => { this.#checking.delete(run); });
524
+ }
525
+
526
+ /**
527
+ * What a run of a fn that always asks would do, from its system (`preview` on the system link), before anyone is
528
+ * asked; or how the run settles instead: invalid input with the system's reason, or a retryable failure when the
529
+ * system can't be reached. An install card is checked against the hub's instances and gets its summary (`installCard`).
530
+ */
531
+ async #preview(run: Run, fn: FnRecord, user: UserInfo): Promise<{ preview: ApprovalPreview; ask?: ProposalAsk } | { refused: OutcomeWire }> {
532
+ // a kind fn's preview comes from its kind's system, which works it out from the payload
533
+ const system = executingSystem(fn);
534
+ const connection = system === run.system ? this.#deps.link.connection(run.system, run.instance) : this.#deps.link.connection(SystemName.parse(system));
535
+ const away = (why: string): { refused: OutcomeWire } => ({ refused: { status: 'failed', error: fnError('retry', `${run.fn} can't show what it would do: ${why}`, 'unavailable') } });
536
+ if (connection === undefined) return away(`${system} is not connected`);
537
+ try {
538
+ const answer = await connection.peer.call('preview', {
539
+ run: run.id, fn: splitName(run.fn).local, args: run.args, user,
540
+ ...(fn.decl.kind === 'native' ? {} : { kind: fn.decl.kind }),
541
+ ...(fn.decl.payload === undefined ? {} : { payload: fn.decl.payload }),
542
+ }, { signal: connection.signal });
543
+ // an install card is checked against the hub's own instances, which the system can't see
544
+ const checked = await installCard(answer, run.args, { instance: (ref) => this.#deps.store.table('instances').get(ref), manifest: (name) => this.#deps.catalog.manifest(name), agents: () => agentNames(this.#deps.store) });
545
+ // a choice the system offers on the card goes with its preview
546
+ if ('preview' in checked) return 'preview' in answer && answer.ask !== undefined ? { ...checked, ask: answer.ask } : checked;
547
+ return { refused: { status: 'invalid-input', invalid: { source: 'validation', problems: [{ path: '', message: checked.refused }] } } };
548
+ } catch (error) {
549
+ return away(messageOf(error));
550
+ }
551
+ }
552
+
553
+ /**
554
+ * The sensitive files a run of a fn that declares `flags` would touch, from its system (`flags` on the system link);
555
+ * or, when the system can't be reached or answers wrongly, a retryable failure: an unchecked call never goes ahead.
556
+ */
557
+ async #flags(run: Run, fn: FnRecord, user: UserInfo): Promise<{ flags: SensitivityFlag[] } | { refused: OutcomeWire }> {
558
+ const system = executingSystem(fn);
559
+ const connection = system === run.system ? this.#deps.link.connection(run.system, run.instance) : this.#deps.link.connection(SystemName.parse(system));
560
+ const away = (why: string): { refused: OutcomeWire } => ({ refused: { status: 'failed', error: fnError('retry', `${run.fn} can't check which sensitive files it would touch: ${why}`, 'unavailable') } });
561
+ if (connection === undefined) return away(`${system} is not connected`);
562
+ try {
563
+ const answer = await connection.peer.call('flags', {
564
+ run: run.id, fn: splitName(run.fn).local, args: run.args, user,
565
+ ...(fn.decl.kind === 'native' ? {} : { kind: fn.decl.kind }),
566
+ ...(fn.decl.payload === undefined ? {} : { payload: fn.decl.payload }),
567
+ }, { signal: connection.signal });
568
+ return { flags: answer.flags };
569
+ } catch (error) {
570
+ return away(messageOf(error));
571
+ }
572
+ }
573
+
574
+ async propose(input: ProposeRun & { system: SystemName; instance: InstanceName }): Promise<ProposedRun> {
575
+ const { catalog, store, clock } = this.#deps;
576
+ const name = qualify(input.system, input.fn);
577
+ const fn = await catalog.fn(name);
578
+ if (fn?.system !== input.system) throw new RunRefused(fnError('caller', `There is no fn ${name}.`, 'not-found'));
579
+ const parent = input.parent === undefined ? undefined : await store.table('runs').get(input.parent);
580
+ if (input.parent !== undefined && parent?.system !== input.system) throw new RunRefused(fnError('caller', `Run ${input.parent} is not ${input.system}'s.`, 'not-found'));
581
+ const key = `${PROPOSED_KEY}${input.key}`;
582
+ const existing = parent === undefined ? await this.#proposedBefore(name, key) : await this.#child(parent.id, key);
583
+ if (existing !== undefined) return this.#proposal(existing);
584
+ const invalid = invalidArgs((await catalog.signature(name)).check(input.args));
585
+ if (invalid !== undefined) throw new RunRefused(fnError('caller', `The args don't fit ${name}: ${invalid.problems.map(problemLine).join('; ')}`, INVALID_INPUT_CODE));
586
+ // build 9: outside a run, a proposal may wait for a person (a Claude session's owner) instead of the admins
587
+ const person = parent === undefined && input.for !== undefined ? await this.#waitsFor(input, input.for) : undefined;
588
+ const chat = person !== undefined && input.chat !== undefined && await this.#inChat(input.chat, person) ? input.chat : undefined;
589
+ const turn = parent === undefined ? await this.#systemTurn(input.system) : await this.#turn(parent);
590
+ const id = mintId('run', this.#deps.random);
591
+ const { operations } = fn.decl;
592
+ const run: Run = {
593
+ id, fn: name, fnVersion: fn.version, kind: fn.decl.kind, system: input.system, instance: input.instance, root: parent?.root ?? id, turn: turn.id,
594
+ ...(parent?.session === undefined ? {} : { session: parent.session }),
595
+ ...(chat === undefined ? {} : { session: chat }),
596
+ ...(parent === undefined ? {} : { parent: parent.id }),
597
+ key, actor: parent?.actor ?? person ?? turn.actor, caller: turn.actor, args: input.args, status: 'awaiting-approval',
598
+ allowed: { cancel: operations.cancel, pause: operations.pause, background: operations.background },
599
+ cost: 0, totalCost: 0, priority: parent?.priority ?? turn.limits.priority, background: false, attempt: 1, errors: [], stateChanges: [], createdAt: clock(),
600
+ };
601
+ const text = await this.#wording.text(run, { status: 'awaiting-approval' }, fn);
602
+ await store.table('runs').insert(text === undefined ? run : { ...run, text });
603
+ if (parent === undefined) await store.table('turns').update(turn.id, { root: id });
604
+ this.#publish(run, statusUpdate('awaiting-approval', text));
605
+ this.#deps.log.info('run.proposed', { run: id, fn: name, parent: parent?.id ?? null, approver: input.approver });
606
+ const approver: Approver = person !== undefined ? { by: 'actor', actor: person } : input.approver === 'admins' ? { by: 'admins' } : { by: 'turn-user' };
607
+ const approval = await this.#deps.policies.propose({
608
+ run: id, fn: name, approver, preview: input.preview, turnUser: turn.user.id, ...(run.session === undefined ? {} : { session: run.session }),
609
+ ...(input.ask === undefined ? {} : { ask: input.ask }),
610
+ });
611
+ return { run: id, approval: approval.id };
612
+ }
613
+
614
+ /**
615
+ * Build 9: the person a proposal outside a run waits for, when its key names (`proposalKeyFor`) a record of one of
616
+ * the system's stored types they own, or a run of the system they started. Anything else is refused and logged: a
617
+ * system can't put cards in the inbox of someone it does no work for.
618
+ */
619
+ async #waitsFor(input: ProposeRun & { system: SystemName }, person: ActorId): Promise<ActorId> {
620
+ const { store } = this.#deps;
621
+ const subject = proposalSubjectOf(input.key);
622
+ const actor = await store.table('actors').get(person);
623
+ const owns = actor?.kind !== 'user' || actor.disabled || subject === undefined ? false
624
+ : 'record' in subject
625
+ ? await store.table('records').get(subject.record).then((record) => record?.owner === person && splitName(record.type).system === input.system)
626
+ : await store.table('runs').get(subject.run).then((run) => run?.system === input.system && run.actor === person);
627
+ if (!owns) {
628
+ this.#deps.log.warn('run.propose.for-refused', { system: input.system, fn: input.fn, for: person });
629
+ throw new RunRefused(fnError('caller', `${input.system} can only ask ${person} about a session or run of theirs: the key must start with its id.`, 'not-yours'));
630
+ }
631
+ return person;
632
+ }
633
+
634
+ /** Whether a person is in a chat (a proposal's card shows there only then). */
635
+ async #inChat(chat: SessionId, person: ActorId): Promise<boolean> {
636
+ const session = await this.#deps.store.table('sessions').get(chat);
637
+ const there = session?.participants.some((participant) => participant.actor === person) === true;
638
+ if (!there) this.#deps.log.warn('run.propose.chat-skipped', { chat, for: person });
639
+ return there;
640
+ }
641
+
642
+ /**
643
+ * A run proposed outside any run under this key that is still open (waiting or running), if one is. A settled one
644
+ * (done, declined, cancelled) doesn't count: nothing replays a system's own proposal, so the same key proposes afresh
645
+ * (a rescan finding the same changes again after an admin declined them, or after they were applied).
646
+ */
647
+ async #proposedBefore(fn: Run['fn'], key: string): Promise<Run | undefined> {
648
+ // the same key may also name a child proposed under some run, so look past those
649
+ for await (const run of rows(this.#deps.store.table('runs'), { where: { fn, key } })) {
650
+ if (run.parent === undefined && isUnsettled(run.status)) { return run; }
651
+ }
652
+ return undefined;
653
+ }
654
+
655
+ /** A proposed run and its approval. */
656
+ async #proposal(run: Run): Promise<ProposedRun> {
657
+ const page = await this.#deps.store.table('approvals').find({ where: { run: run.id }, order: [['createdAt', 'desc']], limit: 1 });
658
+ const approval = page.items[0];
659
+ if (approval === undefined) throw new Error(`proposed run ${run.id} has no approval`);
660
+ return { run: run.id, approval: approval.id };
661
+ }
662
+
663
+ async systemWork(system: SystemName, instance: InstanceName): Promise<Run> {
664
+ const { store, clock, catalog } = this.#deps;
665
+ const turn = await this.#systemTurn(system);
666
+ const fn = await catalog.fn(SYSTEM_CALLS_FN);
667
+ const id = mintId('run', this.#deps.random);
668
+ const run: Run = {
669
+ id, fn: SYSTEM_CALLS_FN, fnVersion: fn?.version ?? '', kind: 'native', system, instance, root: id, turn: turn.id, key: `system-calls:${id}`,
670
+ actor: turn.actor, caller: turn.actor, args: {}, status: 'running', allowed: { cancel: false, pause: false, background: false },
671
+ cost: 0, totalCost: 0, priority: turn.limits.priority, background: false, attempt: 1, errors: [], stateChanges: [], createdAt: clock(),
672
+ };
673
+ await store.table('runs').insert(run);
674
+ await store.table('turns').update(turn.id, { root: id });
675
+ return run;
676
+ }
677
+
678
+ /** A turn of a system's own, for a run it proposed outside any run; it ends when the run settles. */
679
+ async #systemTurn(system: SystemName): Promise<Turn> {
680
+ const { store, clock } = this.#deps;
681
+ const actor = (await store.table('systems').get(system))?.actor;
682
+ if (actor === undefined) throw new RunRefused(fnError('fatal', `${system} has no actor to propose as.`, 'not-found'));
683
+ const user: UserInfo = { id: actor, name: system, email: '', role: 'member', groups: [], timeZone: 'UTC', locale: 'en' };
684
+ const limits = await this.#deps.limits.resolve({ user, requested: 'background' });
685
+ const now = clock();
686
+ return store.table('turns').insert({
687
+ id: mintId('turn', this.#deps.random), actor, user, time: timeInfo(now, user.timeZone), status: 'running', limits, cost: 0, errors: { max: 1 }, createdAt: now,
688
+ });
689
+ }
690
+
691
+ get(run: RunId): Promise<Run | undefined> {
692
+ return this.#deps.store.table('runs').get(run);
693
+ }
694
+
695
+ /** The handlers a run's caller answers. */
696
+ handlersOf(run: RunId): readonly string[] {
697
+ return this.#handlers.get(run) ?? [];
698
+ }
699
+
700
+ /** Wait for a run to settle (or go to the background). */
701
+ async wait(run: RunId): Promise<RunSettled> {
702
+ const row = await this.get(run);
703
+ if (row === undefined) return { status: 'failed', error: fnError('caller', `There is no run ${run}.`, 'not-found') };
704
+ return this.#waitFor(row);
705
+ }
706
+
707
+ onSettled(listener: (run: Run, settled: RunSettled) => void): () => void {
708
+ this.#listeners.add(listener);
709
+ return () => { this.#listeners.delete(listener); };
710
+ }
711
+
712
+ /** Run a queued run (the run queue's handler). */
713
+ async execute(job: { run: RunId }, signal: AbortSignal): Promise<void> {
714
+ if (this.#executing.has(job.run)) return;
715
+ this.#executing.add(job.run);
716
+ try {
717
+ await this.#execute(job.run, signal);
718
+ } finally {
719
+ this.#executing.delete(job.run);
720
+ }
721
+ }
722
+
723
+ async #execute(id: RunId, signal: AbortSignal): Promise<void> {
724
+ const { store, catalog, queues } = this.#deps;
725
+ const queued = await store.table('runs').get(id);
726
+ if (queued?.status !== 'queued') return;
727
+ this.#jobs.delete(queued.id);
728
+ const fn = await catalog.fn(queued.fn);
729
+ if (fn === undefined) {
730
+ await this.settle(queued.id, { status: 'failed', error: fnError('fatal', `${queued.fn} no longer exists.`, 'not-found') });
731
+ return;
732
+ }
733
+ if (fn.paused) {
734
+ this.#enqueue(queued, this.#deps.settings.execution.HARNESS_RUN_RETRY_BASE);
735
+ return;
736
+ }
737
+ await queues.slot(queued.system, queued.priority, () => this.#run(queued, fn, signal));
738
+ }
739
+
740
+ async #run(queued: Run, fn: FnRecord, signal: AbortSignal): Promise<void> {
741
+ const { clock } = this.#deps;
742
+ const executor = this.#executor(fn);
743
+ const run = await this.#moveTo(queued, { status: 'running', startedAt: queued.startedAt ?? clock() }, fn);
744
+ const controller = new AbortController();
745
+ const stop = (): void => { controller.abort(signal.reason); };
746
+ signal.addEventListener('abort', stop, { once: true });
747
+ this.#running.set(run.id, controller);
748
+ try {
749
+ const turn = await this.#turn(run);
750
+ const deadline = runDeadline(clock(), turn, fn);
751
+ if (deadline.at <= clock()) {
752
+ await this.settle(run.id, { status: 'failed', error: deadlineError(deadline, run, turn, fn) });
753
+ return;
754
+ }
755
+ this.#watch(run, turn, fn, deadline);
756
+ const request = await this.#request(run, fn, turn, deadline);
757
+ // a stop (cancel, pause, timeout, shutdown) ends the wait even when the executor ignores its signal
758
+ const outcome = await untilAborted(executor.execute({ run, fn, request }, controller.signal), controller.signal);
759
+ if (outcome !== 'detached') await this.settle(run.id, outcome);
760
+ } catch (error) {
761
+ await this.#failed(run, error, controller.signal);
762
+ } finally {
763
+ signal.removeEventListener('abort', stop);
764
+ this.#running.delete(run.id);
765
+ }
766
+ }
767
+
768
+ /** An executor threw: a stop request settles as asked, a lost system waits for it to come back, else the run fails. */
769
+ async #failed(run: Run, error: unknown, signal: AbortSignal): Promise<void> {
770
+ if (signal.aborted && signal.reason instanceof RunTimedOut) {
771
+ await this.settle(run.id, { status: 'failed', error: signal.reason.error });
772
+ return;
773
+ }
774
+ const stopped = signal.aborted && signal.reason instanceof RunStopped ? signal.reason : error instanceof RunStopped ? error : undefined;
775
+ if (stopped?.how === 'cancel') {
776
+ await this.settle(run.id, { status: 'cancelled' });
777
+ } else if (stopped?.how === 'pause') {
778
+ await this.settle(run.id, { status: 'paused', resume: run.resume ?? null });
779
+ } else if (error instanceof SystemGone || (signal.aborted && signal.reason instanceof HubStopping)) {
780
+ // The system may have started it, so it is sent again as a restart, with the child calls that finished.
781
+ this.#resumes.set(run.id, 'restart');
782
+ this.#deadlines.disarm(run.id);
783
+ await this.#moveTo(run, { status: 'queued' });
784
+ this.#deps.log.warn('run.system-gone', { run: run.id, system: run.system });
785
+ } else {
786
+ await this.settle(run.id, { status: 'failed', error: error instanceof RunRefused ? error.error : fnError('retry', messageOf(error), 'executor') });
787
+ }
788
+ }
789
+
790
+ async settle(id: RunId, outcome: OutcomeWire): Promise<void> {
791
+ if (this.#settling.has(id)) return;
792
+ this.#settling.add(id);
793
+ try {
794
+ await this.#settle(id, outcome);
795
+ } finally {
796
+ this.#settling.delete(id);
797
+ }
798
+ }
799
+
800
+ async #settle(id: RunId, outcome: OutcomeWire): Promise<void> {
801
+ const { store, clock, catalog, log } = this.#deps;
802
+ const run = await store.table('runs').get(id);
803
+ if (run === undefined || isSettled(run.status)) return;
804
+ // settled, paused or queued to retry: either way this attempt's deadline no longer applies
805
+ this.#deadlines.disarm(id);
806
+ const now = clock();
807
+ const cost = outcome.cost ?? 0;
808
+ const error = outcome.status === 'failed' || outcome.status === 'cancelled' ? outcome.error : undefined;
809
+ const errors = error === undefined ? run.errors : [...run.errors, { attempt: run.attempt, error, cost, at: now }];
810
+ if (outcome.status === 'failed' && outcome.error.class === 'retry') {
811
+ const fn = await catalog.fn(run.fn);
812
+ if (run.attempt <= (fn?.decl.limits.retries ?? 0)) {
813
+ const retried = await this.#moveTo(run, { status: 'queued', attempt: run.attempt + 1, errors, cost: run.cost + cost, totalCost: run.totalCost + cost }, fn);
814
+ if (cost > 0) await this.#addToAncestors(run, cost);
815
+ this.#enqueue(retried, this.#deps.settings.execution.HARNESS_RUN_RETRY_BASE * 2 ** (run.attempt - 1));
816
+ log.info('run.retry', { run: id, fn: run.fn, attempt: retried.attempt });
817
+ return;
818
+ }
819
+ }
820
+ const paused = outcome.status === 'paused';
821
+ const updated = await this.#moveTo(run, {
822
+ status: outcome.status,
823
+ outcome,
824
+ errors,
825
+ cost: run.cost + cost,
826
+ totalCost: run.totalCost + cost,
827
+ ...(paused ? { resume: outcome.resume } : { endedAt: now }),
828
+ ...('undo' in outcome && outcome.undo !== undefined ? { undo: outcome.undo } : {}),
829
+ });
830
+ if (cost > 0) await this.#addToAncestors(run, cost);
831
+ log.info('run.settled', { run: id, fn: run.fn, status: updated.status, cost: updated.totalCost });
832
+ if (paused) return;
833
+ const settled = settledOf(outcome, id);
834
+ this.#waiters.get(id)?.resolve(settled);
835
+ this.#waiters.delete(id);
836
+ this.#handlers.delete(id);
837
+ for (const listener of [...this.#listeners]) {
838
+ try { listener(updated, settled); } catch (error) { log.error('run.listener-failed', { run: id, error: messageOf(error) }); }
839
+ }
840
+ await this.#settleTurn(updated);
841
+ }
842
+
843
+ async cancel(id: RunId, by: ActorId): Promise<{ accepted: boolean; reason?: string }> {
844
+ return this.#stop(id, 'cancel', by);
845
+ }
846
+
847
+ async pause(id: RunId, by: ActorId): Promise<{ accepted: boolean; reason?: string }> {
848
+ return this.#stop(id, 'pause', by);
849
+ }
850
+
851
+ async #stop(id: RunId, how: RunControlAction, by: ActorId): Promise<ControlAnswer> {
852
+ const run = await this.get(id);
853
+ if (run === undefined) return { accepted: false, reason: `There is no run ${id}.` };
854
+ if (isSettled(run.status)) return { accepted: false, reason: 'The run has already finished.' };
855
+ if (how === 'cancel' ? !run.allowed.cancel : !run.allowed.pause) return { accepted: false, reason: `This run can't be ${how === 'cancel' ? 'cancelled' : 'paused'} now.` };
856
+ // Resuming re-queues a run, so pausing one that waits for approval would skip the approval.
857
+ if (how === 'pause' && run.status === 'awaiting-approval') return { accepted: false, reason: 'The run is waiting for approval; cancel it instead.' };
858
+ this.#deps.log.info(`run.${how}`, { run: id, by, status: run.status });
859
+ if (run.status === 'running' || run.status === 'waiting') {
860
+ const fn = await this.#deps.catalog.fn(run.fn);
861
+ if (fn === undefined) return { accepted: false, reason: `${run.fn} no longer exists.` };
862
+ const answer = await this.#executor(fn).control(run, how);
863
+ if (answer.accepted && executorKind(fn) === 'hub') this.#running.get(id)?.abort(new RunStopped(how));
864
+ return answer;
865
+ }
866
+ if (run.status === 'paused') {
867
+ if (how === 'pause') return { accepted: true };
868
+ await this.settle(id, { status: 'cancelled' });
869
+ return { accepted: true };
870
+ }
871
+ const job = this.#jobs.get(id);
872
+ if (job !== undefined) await this.#deps.queues.cancel(job, how);
873
+ this.#jobs.delete(id);
874
+ await this.settle(id, how === 'cancel' ? { status: 'cancelled' } : { status: 'paused', resume: run.resume ?? null });
875
+ return { accepted: true };
876
+ }
877
+
878
+ /** Stop every run in flight for a shutdown; each stays queued, to be sent again when its system is back. */
879
+ drain(): void {
880
+ this.#deadlines.clear();
881
+ for (const controller of this.#running.values()) controller.abort(new HubStopping());
882
+ }
883
+
884
+ /**
885
+ * Watch the deadline of every run that was started before the hub restarted and is still running or waiting (an
886
+ * agent waiting for its tools), timed from when it started. A run the worker starts again gets a fresh deadline.
887
+ */
888
+ async watchDeadlines(): Promise<void> {
889
+ const { store, catalog, clock } = this.#deps;
890
+ for await (const run of rows(store.table('runs'), { where: { status: { in: ['running', 'waiting'] } } })) {
891
+ if (this.#deadlines.armed(run.id)) continue;
892
+ const [turn, fn] = await Promise.all([store.table('turns').get(run.turn), catalog.fn(run.fn)]);
893
+ if (turn === undefined || fn === undefined) continue;
894
+ this.#watch(run, turn, fn, runDeadline(run.startedAt ?? clock(), turn, fn));
895
+ }
896
+ }
897
+
898
+ /** Arm a run's deadline: when it passes, the hub stops the run. */
899
+ #watch(run: Run, turn: Turn, fn: FnRecord, deadline: RunDeadline): void {
900
+ const error = deadlineError(deadline, run, turn, fn);
901
+ this.#deadlines.arm(run.id, deadline.at, () => {
902
+ void this.#timeOut(run.id, error).catch((thrown: unknown) => { this.#deps.log.error('run.timeout-failed', { run: run.id, error: messageOf(thrown) }); });
903
+ });
904
+ }
905
+
906
+ /**
907
+ * A run's deadline passed. The worker's wait on its executor is ended (the worker settles the run from there), the
908
+ * executor is told to stop the work, and a run no worker waits on (an agent between iterations) is settled here.
909
+ */
910
+ async #timeOut(id: RunId, error: FnError): Promise<void> {
911
+ const { catalog, log } = this.#deps;
912
+ const run = await this.get(id);
913
+ if (run === undefined || (run.status !== 'running' && run.status !== 'waiting')) return;
914
+ log.warn('run.timed-out', { run: id, fn: run.fn, class: error.class, error: error.message });
915
+ const worker = this.#running.get(id);
916
+ worker?.abort(new RunTimedOut(error));
917
+ const fn = await catalog.fn(run.fn);
918
+ if (fn !== undefined) {
919
+ try {
920
+ await this.#executor(fn).stop(run, error);
921
+ } catch (thrown) {
922
+ log.warn('run.stop-failed', { run: id, fn: run.fn, error: messageOf(thrown) });
923
+ }
924
+ }
925
+ if (worker === undefined) await this.settle(id, { status: 'failed', error });
926
+ }
927
+
928
+ async resume(id: RunId, by: ActorId): Promise<void> {
929
+ const run = await this.get(id);
930
+ if (run?.status !== 'paused') return;
931
+ this.#resumes.set(id, 'resumed');
932
+ const queued = await this.#moveTo(run, { status: 'queued' });
933
+ this.#deps.log.info('run.resume', { run: id, by });
934
+ this.#enqueue(queued);
935
+ }
936
+
937
+ /**
938
+ * Run a stopped run again from the loop state given (`resume`): a failed or cancelled run goes back to the queue as
939
+ * a resume, its outcome and end cleared. False when it hasn't stopped that way. The agent loop's Continue uses it.
940
+ */
941
+ async reopen(id: RunId, resume: Json, by: ActorId): Promise<boolean> {
942
+ const run = await this.get(id);
943
+ if (run === undefined || (run.status !== 'failed' && run.status !== 'cancelled')) return false;
944
+ const { outcome: _outcome, endedAt: _endedAt, ...kept } = run;
945
+ const reopened = await this.#deps.store.table('runs').put({ ...kept, resume });
946
+ this.#resumes.set(id, 'resumed');
947
+ const queued = await this.#moveTo(reopened, { status: 'queued' });
948
+ this.#deps.log.info('run.reopen', { run: id, by, was: run.status });
949
+ this.#enqueue(queued);
950
+ return true;
951
+ }
952
+
953
+ async background(id: RunId): Promise<boolean> {
954
+ const run = await this.get(id);
955
+ if (run === undefined || isSettled(run.status) || !run.allowed.background) return false;
956
+ if (!run.background) this.#publish(await this.#deps.store.table('runs').update(id, { background: true }), { type: 'background' });
957
+ this.#waiters.get(id)?.resolve({ status: 'background', run: id });
958
+ this.#waiters.delete(id);
959
+ this.#deps.log.info('run.background', { run: id, fn: run.fn });
960
+ return true;
961
+ }
962
+
963
+ async progress(id: RunId, report: ProgressReport): Promise<void> {
964
+ const run = await this.get(id);
965
+ if (run === undefined || isSettled(run.status)) return;
966
+ const progress = mergeProgress(run.progress, report);
967
+ this.#publish(await this.#deps.store.table('runs').update(id, { progress }), { type: 'progress', progress });
968
+ }
969
+
970
+ async allow(id: RunId, operations: Partial<AllowedOperations>): Promise<void> {
971
+ const run = await this.get(id);
972
+ if (run === undefined || isSettled(run.status)) return;
973
+ const allowed: AllowedOperations = {
974
+ cancel: operations.cancel ?? run.allowed.cancel,
975
+ pause: operations.pause ?? run.allowed.pause,
976
+ background: operations.background ?? run.allowed.background,
977
+ };
978
+ this.#publish(await this.#deps.store.table('runs').update(id, { allowed }), { type: 'allowed', operations: allowed });
979
+ }
980
+
981
+ async undoWith(id: RunId, undo: Json): Promise<void> {
982
+ if ((await this.get(id)) === undefined) return;
983
+ await this.#deps.store.table('runs').update(id, { undo });
984
+ }
985
+
986
+ async undo(id: RunId, by: ActorId): Promise<UndoOutcome> {
987
+ const { catalog, log } = this.#deps;
988
+ const run = await this.get(id);
989
+ if (run === undefined) return { status: 'failed', error: fnError('caller', `There is no run ${id}.`, 'not-found') };
990
+ if (run.status === 'undone' || run.undo === undefined) return { status: 'gone' };
991
+ if (!isSettled(run.status)) return { status: 'failed', error: fnError('caller', 'The run has not finished yet.', 'running') };
992
+ const fn = await catalog.fn(run.fn);
993
+ if (fn?.decl.operations.undo !== true) return { status: 'failed', error: fnError('caller', `${run.fn} can't be undone.`, 'not-undoable') };
994
+ const info = await this.#info(run);
995
+ const outcome = await this.#executor(fn).undo({ run, fn, info, payload: run.undo });
996
+ if (outcome.status === 'undone') await this.#moveTo(run, { status: 'undone' }, fn);
997
+ log.info('run.undo', { run: id, fn: run.fn, by, status: outcome.status });
998
+ return outcome;
999
+ }
1000
+
1001
+ /**
1002
+ * Agent runs are skipped: they come back through their LLM jobs (which the work queue delivers again) and
1003
+ * `HubAgentLoop.recover`, and queuing one again would run an iteration twice.
1004
+ */
1005
+ async resend(system: string): Promise<void> {
1006
+ const { store, log } = this.#deps;
1007
+ for await (const run of rows(store.table('runs'), { where: { status: { in: ['running', 'queued'] } } })) {
1008
+ if (run.system !== system || run.kind === AGENT_KIND || this.#running.has(run.id) || this.#jobs.has(run.id) || this.#executing.has(run.id)) continue;
1009
+ if (run.status === 'running') this.#resumes.set(run.id, 'restart');
1010
+ this.#enqueue(run.status === 'running' ? await store.table('runs').update(run.id, { status: 'queued' }) : run);
1011
+ log.info('run.resent', { run: run.id, system });
1012
+ }
1013
+ }
1014
+
1015
+ async addCost(id: RunId, cost: Usd): Promise<void> {
1016
+ const run = await this.get(id);
1017
+ if (run === undefined || cost === 0) return;
1018
+ const updated = await this.#deps.store.table('runs').update(id, { cost: run.cost + cost, totalCost: run.totalCost + cost });
1019
+ this.#publish(updated, { type: 'cost', cost: updated.cost, total: updated.totalCost });
1020
+ await this.#addToAncestors(run, cost);
1021
+ }
1022
+
1023
+ async addTokens(id: RunId, tokens: number): Promise<void> {
1024
+ const run = await this.get(id);
1025
+ if (run === undefined || tokens <= 0) return;
1026
+ await this.#deps.store.table('runs').update(id, { tokens: (run.tokens ?? 0) + tokens });
1027
+ }
1028
+
1029
+ /**
1030
+ * The run request an executor gets: who and when, the args, the budget left (money, and the turn's time), the
1031
+ * deadline the hub enforces, and what to resume from.
1032
+ */
1033
+ async #request(run: Run, fn: FnRecord, turn: Turn, deadline: RunDeadline): Promise<RunRequest> {
1034
+ const { ledger, config, clock } = this.#deps;
1035
+ const info = await this.#info(run, turn);
1036
+ const left = await ledger.remaining(turn.limits, { turn: turn.id, actor: run.actor });
1037
+ const now = clock();
1038
+ const turnDeadline = turn.createdAt + turn.limits.turn.time;
1039
+ const reason = this.#resumes.get(run.id);
1040
+ this.#resumes.delete(run.id);
1041
+ const resume = reason === undefined ? undefined : { state: run.resume ?? null, calls: await this.#finishedCalls(run.id), reason };
1042
+ const configured = run.system === HUB_SYSTEM ? undefined : await config.current(run.system, run.instance);
1043
+ return {
1044
+ run: info,
1045
+ fn: splitName(fn.name).local,
1046
+ kind: fn.decl.kind,
1047
+ ...(fn.decl.payload === undefined ? {} : { payload: fn.decl.payload }),
1048
+ args: this.#argSecrets === undefined ? run.args : await this.#argSecrets.unseal(run),
1049
+ budget: { cost: left.cost, time: Math.max(0, turnDeadline - now), limitedBy: left.limitedBy },
1050
+ handlers: [...(this.#handlers.get(run.id) ?? [])],
1051
+ ...(resume === undefined ? {} : { resume }),
1052
+ deadline: deadline.at,
1053
+ configVersion: configured?.version ?? 0,
1054
+ ...(await this.#connection(run, fn, turn)),
1055
+ ...(await this.#approvedOn(run, fn)),
1056
+ };
1057
+ }
1058
+
1059
+ /**
1060
+ * The approval a run of a fn with `approval` or `flags` went ahead on (`ctx.approved`): who approved it and the
1061
+ * preview they saw, so the system can check it runs what was approved (fs shows sensitive files only to a run the
1062
+ * person approved after a flags ask). Nothing for other fns or runs that weren't asked about.
1063
+ */
1064
+ async #approvedOn(run: Run, fn: FnRecord): Promise<Pick<RunRequest, 'approved'>> {
1065
+ if ((fn.decl.approval === undefined && fn.decl.flags !== true) || run.approvedAt === undefined) return {};
1066
+ const page = await this.#deps.store.table('approvals').find({ where: { run: run.id, status: 'approved' }, order: [['createdAt', 'desc']], limit: 1 });
1067
+ const approval = page.items[0];
1068
+ const by = approval?.decisions.findLast((d) => d.approve)?.by;
1069
+ return approval?.preview === undefined || by === undefined ? {} : { approved: { by, preview: approval.preview } };
1070
+ }
1071
+
1072
+ /**
1073
+ * The connection a per-person fn's run acts as, credentials revealed; nothing for any other fn. It is the one pinned
1074
+ * when the run started, so the account approved is the account used: if that one is gone, off or no longer shared,
1075
+ * the run fails rather than act as another.
1076
+ */
1077
+ async #connection(run: Run, fn: FnRecord, turn: Turn): Promise<Pick<RunRequest, 'connection'>> {
1078
+ const gate = (await this.#deps.access.scope(turn.user.id)).connection(fn, run.args);
1079
+ if (gate === undefined) return {};
1080
+ if (gate.state !== 'ready' || gate.connection.id !== run.connection) {
1081
+ throw new RunRefused(fnError('retry', `${fn.name} was started to act as an account that is no longer connected or shared with you; ask again.`, 'unavailable'));
1082
+ }
1083
+ return { connection: await this.#deps.connections.forRun(gate.connection) };
1084
+ }
1085
+
1086
+ /** Who and when a run is for, as its system reads it (`RunInfo`). */
1087
+ info(run: Run): Promise<RunInfo> {
1088
+ return this.#info(run);
1089
+ }
1090
+
1091
+ async #info(run: Run, known?: Turn): Promise<RunInfo> {
1092
+ const turn = known ?? (await this.#turn(run));
1093
+ const parent = run.parent === undefined ? undefined : await this.get(run.parent);
1094
+ const connection = this.#deps.link.connection(run.system, run.instance);
1095
+ const inChat = chatOwn(run, parent);
1096
+ const watched = inChat && run.session !== undefined && await this.#deps.presence.active(run.session);
1097
+ return {
1098
+ id: run.id,
1099
+ fn: run.fn,
1100
+ turn: run.turn,
1101
+ ...(run.parent === undefined ? {} : { parent: run.parent }),
1102
+ ...(run.session === undefined ? {} : { session: run.session }),
1103
+ user: turn.user,
1104
+ time: timeInfo(this.#deps.clock(), turn.user.timeZone),
1105
+ system: {
1106
+ name: run.system,
1107
+ instance: run.instance ?? connection?.instance ?? MAIN_INSTANCE,
1108
+ boot: connection?.boot ?? HUB_SYSTEM,
1109
+ ...(parent === undefined ? {} : { from: { system: parent.system, fn: parent.fn, run: parent.id } }),
1110
+ },
1111
+ caller: run.caller,
1112
+ attempt: run.attempt,
1113
+ priority: run.priority,
1114
+ ...(watched ? { watched } : {}),
1115
+ ...(inChat ? { inChat } : {}),
1116
+ };
1117
+ }
1118
+
1119
+ async #turn(run: Run): Promise<Turn> {
1120
+ const turn = await this.#deps.store.table('turns').get(run.turn);
1121
+ if (turn === undefined) throw new Error(`run ${run.id} names no turn ${run.turn}`);
1122
+ return turn;
1123
+ }
1124
+
1125
+ /** The child calls of a run that already finished, by key (what a resumed fn gets back instead of calling again). */
1126
+ async #finishedCalls(parent: RunId): Promise<Record<string, RunSettled>> {
1127
+ const calls: Record<string, RunSettled> = {};
1128
+ for await (const child of rows(this.#deps.store.table('runs'), { where: { parent } })) {
1129
+ if (isSettled(child.status) && child.outcome !== undefined) calls[child.key] = settledOf(child.outcome, child.id);
1130
+ }
1131
+ return calls;
1132
+ }
1133
+
1134
+ /** A parent's existing child under a key. */
1135
+ async #child(parent: RunId, key: string): Promise<Run | undefined> {
1136
+ const page = await this.#deps.store.table('runs').find({ where: { parent, key }, limit: 1 });
1137
+ return page.items[0];
1138
+ }
1139
+
1140
+ /**
1141
+ * Whether a test call (or a child of one) may run a fn that is unavailable: only when the one thing keeping it off is
1142
+ * that its executing system is installed and not live yet. A fn switched off, a system paused or away, and anything on
1143
+ * a live system (held for review, a kind switched off) stays unavailable to tests too.
1144
+ */
1145
+ async #testable(fn: FnRecord): Promise<boolean> {
1146
+ if (fn.disabled) return false;
1147
+ const system = SystemName.parse(executingSystem(fn));
1148
+ const record = await this.#deps.store.table('systems').get(system);
1149
+ return record?.stage === 'installed' && systemAvailability(system, record, { staged: false }) === true;
1150
+ }
1151
+
1152
+ /**
1153
+ * A child call must be to one of its parent's declared deps. Agents call what their tools allow (checked by the agent
1154
+ * loop), and the hub's own fns call what the hub's code does (`hub/resource_import` fetching a URL through
1155
+ * `web/fetch_raw`): no system declares those.
1156
+ */
1157
+ async #checkDep(parent: Run, fn: FnRecord): Promise<void> {
1158
+ if (parent.kind === AGENT_KIND || parent.system === HUB_SYSTEM) return;
1159
+ const parentFn = await this.#deps.catalog.fn(parent.fn);
1160
+ if (parentFn?.decl.deps.includes(fn.name) !== true) {
1161
+ throw new RunRefused(fnError('fatal', `${parent.fn} doesn't declare ${fn.name} as a dep, so it can't call it.`, 'not-a-dep'));
1162
+ }
1163
+ }
1164
+
1165
+ #waitFor(run: Run): Promise<RunSettled> {
1166
+ if (isSettled(run.status)) return Promise.resolve(settledOf(run.outcome, run.id));
1167
+ if (run.background) return Promise.resolve({ status: 'background', run: run.id });
1168
+ let entry = this.#waiters.get(run.id);
1169
+ if (entry === undefined) {
1170
+ entry = waiter();
1171
+ this.#waiters.set(run.id, entry);
1172
+ }
1173
+ return entry.promise;
1174
+ }
1175
+
1176
+ #enqueue(run: Run, delay?: number): void {
1177
+ this.#jobs.set(run.id, this.#deps.queues.enqueueRun({ run: run.id, priority: run.priority }, delay === undefined ? {} : { delay }));
1178
+ }
1179
+
1180
+ #executor(fn: FnRecord): RunExecutor {
1181
+ const kind = executorKind(fn);
1182
+ const executor = this.#executors.get(kind);
1183
+ if (executor === undefined) throw new Error(`no executor for ${kind} runs`);
1184
+ return executor;
1185
+ }
1186
+
1187
+ /** An approval was answered: queue the run, or fail it. */
1188
+ async #approved(id: RunId, approved: boolean, decided: { by: ActorId; reason?: string | undefined } | undefined): Promise<void> {
1189
+ const run = await this.get(id);
1190
+ if (run?.status !== 'awaiting-approval') return;
1191
+ if (approved) {
1192
+ this.#enqueue(await this.#moveTo(run, { status: 'queued', approvedAt: this.#deps.clock() }));
1193
+ return;
1194
+ }
1195
+ // the caller (a model, most often) hears who declined and why, so it can say so or ask differently
1196
+ const who = decided === undefined ? undefined : (await this.#deps.store.table('actors').get(decided.by))?.name;
1197
+ const reason = decided?.reason?.trim() ?? '';
1198
+ const message = `Declined by ${who ?? 'the approver'}${reason === '' ? ' (no reason given).' : `: ${reason}`}`;
1199
+ // a declined run did not fail: it is cancelled, with who declined and why in its errors and the caller's reply
1200
+ await this.settle(id, { status: 'cancelled', error: fnError('caller', message, DECLINED_CODE) });
1201
+ }
1202
+
1203
+ async #addToAncestors(run: Run, cost: Usd): Promise<void> {
1204
+ let parentId = run.parent;
1205
+ while (parentId !== undefined) {
1206
+ const parent = await this.get(parentId);
1207
+ if (parent === undefined) return;
1208
+ const updated = await this.#deps.store.table('runs').update(parent.id, { totalCost: parent.totalCost + cost });
1209
+ this.#publish(updated, { type: 'cost', cost: updated.cost, total: updated.totalCost });
1210
+ parentId = parent.parent;
1211
+ }
1212
+ }
1213
+
1214
+ /** A turn's root agent run settled: the turn has ended (chat settles the turns of fns people run themselves). */
1215
+ async #settleTurn(run: Run): Promise<void> {
1216
+ if (run.parent !== undefined) return;
1217
+ // a system's own turn, made for a run it proposed, ends with that run
1218
+ const proposed = run.key.startsWith(PROPOSED_KEY);
1219
+ if (!proposed && (run.session === undefined || run.kind !== AGENT_KIND)) return;
1220
+ const status = run.status === 'done' || run.status === 'undone' ? 'done' : run.status === 'cancelled' ? 'cancelled' : 'failed';
1221
+ await this.#deps.turns.settle(run.turn, status);
1222
+ }
1223
+
1224
+ /** Move a run to a new status (with what changes alongside), worded for its phase, stored and published. */
1225
+ async #moveTo(run: Run, patch: Partial<Run> & Pick<Run, 'status'>, fn?: FnRecord): Promise<Run> {
1226
+ // a declined run carries who declined it and why, so a system that proposed it hears the reason
1227
+ const declined = patch.outcome?.status === 'cancelled' && patch.outcome.error?.code === DECLINED_CODE ? patch.outcome.error.message : undefined;
1228
+ const text = declined === undefined ? await this.#wording.text(run, patch, fn) : { phase: 'failed' as const, one: declined, many: declined };
1229
+ const updated = await this.#deps.store.table('runs').update(run.id, text === undefined ? patch : { ...patch, text });
1230
+ this.#publish(updated, statusUpdate(updated.status, text));
1231
+ return updated;
1232
+ }
1233
+
1234
+ #publish(run: Run, update: RunUpdate): void {
1235
+ this.#deps.bus.publish('run.update', { run: run.id, fn: run.fn, update, ...(run.session === undefined ? {} : { session: run.session }) });
1236
+ }
1237
+ }