@aigne/aos 0.2.0-beta

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 (533) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/LICENSE.md +26 -0
  3. package/dist/agent-dsl.cjs +116 -0
  4. package/dist/agent-dsl.d.cts +31 -0
  5. package/dist/agent-dsl.d.cts.map +1 -0
  6. package/dist/agent-dsl.d.mts +31 -0
  7. package/dist/agent-dsl.d.mts.map +1 -0
  8. package/dist/agent-dsl.mjs +115 -0
  9. package/dist/agent-dsl.mjs.map +1 -0
  10. package/dist/arc-compat.cjs +125 -0
  11. package/dist/arc-compat.d.cts +17 -0
  12. package/dist/arc-compat.d.cts.map +1 -0
  13. package/dist/arc-compat.d.mts +17 -0
  14. package/dist/arc-compat.d.mts.map +1 -0
  15. package/dist/arc-compat.mjs +123 -0
  16. package/dist/arc-compat.mjs.map +1 -0
  17. package/dist/auto-surface/compiler.cjs +36 -0
  18. package/dist/auto-surface/compiler.d.cts +7 -0
  19. package/dist/auto-surface/compiler.d.cts.map +1 -0
  20. package/dist/auto-surface/compiler.d.mts +7 -0
  21. package/dist/auto-surface/compiler.d.mts.map +1 -0
  22. package/dist/auto-surface/compiler.mjs +37 -0
  23. package/dist/auto-surface/compiler.mjs.map +1 -0
  24. package/dist/auto-surface/definition-dsl.cjs +333 -0
  25. package/dist/auto-surface/definition-dsl.d.cts +41 -0
  26. package/dist/auto-surface/definition-dsl.d.cts.map +1 -0
  27. package/dist/auto-surface/definition-dsl.d.mts +41 -0
  28. package/dist/auto-surface/definition-dsl.d.mts.map +1 -0
  29. package/dist/auto-surface/definition-dsl.mjs +332 -0
  30. package/dist/auto-surface/definition-dsl.mjs.map +1 -0
  31. package/dist/auto-surface/fragments.cjs +177 -0
  32. package/dist/auto-surface/fragments.d.cts +23 -0
  33. package/dist/auto-surface/fragments.d.cts.map +1 -0
  34. package/dist/auto-surface/fragments.d.mts +23 -0
  35. package/dist/auto-surface/fragments.d.mts.map +1 -0
  36. package/dist/auto-surface/fragments.mjs +175 -0
  37. package/dist/auto-surface/fragments.mjs.map +1 -0
  38. package/dist/auto-surface/index.d.mts +9 -0
  39. package/dist/auto-surface/layering.cjs +43 -0
  40. package/dist/auto-surface/layering.d.cts +7 -0
  41. package/dist/auto-surface/layering.d.cts.map +1 -0
  42. package/dist/auto-surface/layering.d.mts +7 -0
  43. package/dist/auto-surface/layering.d.mts.map +1 -0
  44. package/dist/auto-surface/layering.mjs +43 -0
  45. package/dist/auto-surface/layering.mjs.map +1 -0
  46. package/dist/auto-surface/projection.cjs +11 -0
  47. package/dist/auto-surface/projection.d.cts +11 -0
  48. package/dist/auto-surface/projection.d.cts.map +1 -0
  49. package/dist/auto-surface/projection.d.mts +11 -0
  50. package/dist/auto-surface/projection.d.mts.map +1 -0
  51. package/dist/auto-surface/projection.mjs +12 -0
  52. package/dist/auto-surface/projection.mjs.map +1 -0
  53. package/dist/auto-surface/projectors/settings-shell.cjs +114 -0
  54. package/dist/auto-surface/projectors/settings-shell.d.cts +10 -0
  55. package/dist/auto-surface/projectors/settings-shell.d.cts.map +1 -0
  56. package/dist/auto-surface/projectors/settings-shell.d.mts +10 -0
  57. package/dist/auto-surface/projectors/settings-shell.d.mts.map +1 -0
  58. package/dist/auto-surface/projectors/settings-shell.mjs +114 -0
  59. package/dist/auto-surface/projectors/settings-shell.mjs.map +1 -0
  60. package/dist/auto-surface/scenario.cjs +38 -0
  61. package/dist/auto-surface/scenario.d.cts +31 -0
  62. package/dist/auto-surface/scenario.d.cts.map +1 -0
  63. package/dist/auto-surface/scenario.d.mts +31 -0
  64. package/dist/auto-surface/scenario.d.mts.map +1 -0
  65. package/dist/auto-surface/scenario.mjs +37 -0
  66. package/dist/auto-surface/scenario.mjs.map +1 -0
  67. package/dist/auto-surface/types.cjs +9 -0
  68. package/dist/auto-surface/types.d.cts +153 -0
  69. package/dist/auto-surface/types.d.cts.map +1 -0
  70. package/dist/auto-surface/types.d.mts +153 -0
  71. package/dist/auto-surface/types.d.mts.map +1 -0
  72. package/dist/auto-surface/types.mjs +9 -0
  73. package/dist/auto-surface/types.mjs.map +1 -0
  74. package/dist/auto-surface/value-dsl.cjs +80 -0
  75. package/dist/auto-surface/value-dsl.d.cts +24 -0
  76. package/dist/auto-surface/value-dsl.d.cts.map +1 -0
  77. package/dist/auto-surface/value-dsl.d.mts +24 -0
  78. package/dist/auto-surface/value-dsl.d.mts.map +1 -0
  79. package/dist/auto-surface/value-dsl.mjs +79 -0
  80. package/dist/auto-surface/value-dsl.mjs.map +1 -0
  81. package/dist/blocklet/activation.cjs +94 -0
  82. package/dist/blocklet/activation.d.cts +30 -0
  83. package/dist/blocklet/activation.d.cts.map +1 -0
  84. package/dist/blocklet/activation.d.mts +30 -0
  85. package/dist/blocklet/activation.d.mts.map +1 -0
  86. package/dist/blocklet/activation.mjs +94 -0
  87. package/dist/blocklet/activation.mjs.map +1 -0
  88. package/dist/blocklet/did-space-registry.cjs +282 -0
  89. package/dist/blocklet/did-space-registry.d.cts +82 -0
  90. package/dist/blocklet/did-space-registry.d.cts.map +1 -0
  91. package/dist/blocklet/did-space-registry.d.mts +82 -0
  92. package/dist/blocklet/did-space-registry.d.mts.map +1 -0
  93. package/dist/blocklet/did-space-registry.mjs +281 -0
  94. package/dist/blocklet/did-space-registry.mjs.map +1 -0
  95. package/dist/blocklet/handlers.cjs +66 -0
  96. package/dist/blocklet/handlers.d.cts +16 -0
  97. package/dist/blocklet/handlers.d.cts.map +1 -0
  98. package/dist/blocklet/handlers.d.mts +16 -0
  99. package/dist/blocklet/handlers.d.mts.map +1 -0
  100. package/dist/blocklet/handlers.mjs +65 -0
  101. package/dist/blocklet/handlers.mjs.map +1 -0
  102. package/dist/blocklet/index.d.mts +7 -0
  103. package/dist/blocklet/manifest.d.cts +2 -0
  104. package/dist/blocklet/manifest.d.mts +2 -0
  105. package/dist/blocklet/manifest.mjs +3 -0
  106. package/dist/blocklet/registry.cjs +447 -0
  107. package/dist/blocklet/registry.d.cts +197 -0
  108. package/dist/blocklet/registry.d.cts.map +1 -0
  109. package/dist/blocklet/registry.d.mts +197 -0
  110. package/dist/blocklet/registry.d.mts.map +1 -0
  111. package/dist/blocklet/registry.mjs +441 -0
  112. package/dist/blocklet/registry.mjs.map +1 -0
  113. package/dist/blocklet/static-render.cjs +183 -0
  114. package/dist/blocklet/static-render.d.cts +55 -0
  115. package/dist/blocklet/static-render.d.cts.map +1 -0
  116. package/dist/blocklet/static-render.d.mts +55 -0
  117. package/dist/blocklet/static-render.d.mts.map +1 -0
  118. package/dist/blocklet/static-render.mjs +181 -0
  119. package/dist/blocklet/static-render.mjs.map +1 -0
  120. package/dist/blocklet/types.d.cts +70 -0
  121. package/dist/blocklet/types.d.cts.map +1 -0
  122. package/dist/blocklet/types.d.mts +70 -0
  123. package/dist/blocklet/types.d.mts.map +1 -0
  124. package/dist/devices/chain.cjs +127 -0
  125. package/dist/devices/chain.d.cts +48 -0
  126. package/dist/devices/chain.d.cts.map +1 -0
  127. package/dist/devices/chain.d.mts +48 -0
  128. package/dist/devices/chain.d.mts.map +1 -0
  129. package/dist/devices/chain.mjs +125 -0
  130. package/dist/devices/chain.mjs.map +1 -0
  131. package/dist/dsl-shared.cjs +290 -0
  132. package/dist/dsl-shared.d.cts +54 -0
  133. package/dist/dsl-shared.d.cts.map +1 -0
  134. package/dist/dsl-shared.d.mts +54 -0
  135. package/dist/dsl-shared.d.mts.map +1 -0
  136. package/dist/dsl-shared.mjs +287 -0
  137. package/dist/dsl-shared.mjs.map +1 -0
  138. package/dist/http/afs-mcp.cjs +85 -0
  139. package/dist/http/afs-mcp.d.cts +14 -0
  140. package/dist/http/afs-mcp.d.cts.map +1 -0
  141. package/dist/http/afs-mcp.d.mts +14 -0
  142. package/dist/http/afs-mcp.d.mts.map +1 -0
  143. package/dist/http/afs-mcp.mjs +86 -0
  144. package/dist/http/afs-mcp.mjs.map +1 -0
  145. package/dist/http/afs-raw.cjs +264 -0
  146. package/dist/http/afs-raw.d.cts +31 -0
  147. package/dist/http/afs-raw.d.cts.map +1 -0
  148. package/dist/http/afs-raw.d.mts +31 -0
  149. package/dist/http/afs-raw.d.mts.map +1 -0
  150. package/dist/http/afs-raw.mjs +264 -0
  151. package/dist/http/afs-raw.mjs.map +1 -0
  152. package/dist/http/afs-rest.cjs +30 -0
  153. package/dist/http/afs-rest.d.cts +21 -0
  154. package/dist/http/afs-rest.d.cts.map +1 -0
  155. package/dist/http/afs-rest.d.mts +21 -0
  156. package/dist/http/afs-rest.d.mts.map +1 -0
  157. package/dist/http/afs-rest.mjs +31 -0
  158. package/dist/http/afs-rest.mjs.map +1 -0
  159. package/dist/http/afs-rpc-wire.cjs +271 -0
  160. package/dist/http/afs-rpc-wire.d.cts +195 -0
  161. package/dist/http/afs-rpc-wire.d.cts.map +1 -0
  162. package/dist/http/afs-rpc-wire.d.mts +195 -0
  163. package/dist/http/afs-rpc-wire.d.mts.map +1 -0
  164. package/dist/http/afs-rpc-wire.mjs +262 -0
  165. package/dist/http/afs-rpc-wire.mjs.map +1 -0
  166. package/dist/http/afs-rpc.cjs +729 -0
  167. package/dist/http/afs-rpc.d.cts +103 -0
  168. package/dist/http/afs-rpc.d.cts.map +1 -0
  169. package/dist/http/afs-rpc.d.mts +103 -0
  170. package/dist/http/afs-rpc.d.mts.map +1 -0
  171. package/dist/http/afs-rpc.mjs +729 -0
  172. package/dist/http/afs-rpc.mjs.map +1 -0
  173. package/dist/http/afs-upload.cjs +116 -0
  174. package/dist/http/afs-upload.d.cts +40 -0
  175. package/dist/http/afs-upload.d.cts.map +1 -0
  176. package/dist/http/afs-upload.d.mts +40 -0
  177. package/dist/http/afs-upload.d.mts.map +1 -0
  178. package/dist/http/afs-upload.mjs +116 -0
  179. package/dist/http/afs-upload.mjs.map +1 -0
  180. package/dist/http/aup-client.cjs +60 -0
  181. package/dist/http/aup-client.d.cts +22 -0
  182. package/dist/http/aup-client.d.cts.map +1 -0
  183. package/dist/http/aup-client.d.mts +22 -0
  184. package/dist/http/aup-client.d.mts.map +1 -0
  185. package/dist/http/aup-client.mjs +59 -0
  186. package/dist/http/aup-client.mjs.map +1 -0
  187. package/dist/http/aup-event.cjs +100 -0
  188. package/dist/http/aup-event.d.cts +38 -0
  189. package/dist/http/aup-event.d.cts.map +1 -0
  190. package/dist/http/aup-event.d.mts +38 -0
  191. package/dist/http/aup-event.d.mts.map +1 -0
  192. package/dist/http/aup-event.mjs +101 -0
  193. package/dist/http/aup-event.mjs.map +1 -0
  194. package/dist/http/auth-context.cjs +66 -0
  195. package/dist/http/auth-context.d.cts +64 -0
  196. package/dist/http/auth-context.d.cts.map +1 -0
  197. package/dist/http/auth-context.d.mts +64 -0
  198. package/dist/http/auth-context.d.mts.map +1 -0
  199. package/dist/http/auth-context.mjs +66 -0
  200. package/dist/http/auth-context.mjs.map +1 -0
  201. package/dist/http/csrf.cjs +50 -0
  202. package/dist/http/csrf.d.cts +8 -0
  203. package/dist/http/csrf.d.cts.map +1 -0
  204. package/dist/http/csrf.d.mts +8 -0
  205. package/dist/http/csrf.d.mts.map +1 -0
  206. package/dist/http/csrf.mjs +49 -0
  207. package/dist/http/csrf.mjs.map +1 -0
  208. package/dist/http/handlers.cjs +106 -0
  209. package/dist/http/handlers.d.cts +39 -0
  210. package/dist/http/handlers.d.cts.map +1 -0
  211. package/dist/http/handlers.d.mts +39 -0
  212. package/dist/http/handlers.d.mts.map +1 -0
  213. package/dist/http/handlers.mjs +104 -0
  214. package/dist/http/handlers.mjs.map +1 -0
  215. package/dist/http/index.d.mts +1 -0
  216. package/dist/http/ingest-facade.cjs +315 -0
  217. package/dist/http/ingest-facade.mjs +314 -0
  218. package/dist/http/ingest-facade.mjs.map +1 -0
  219. package/dist/http/raw-url.cjs +136 -0
  220. package/dist/http/raw-url.d.cts +54 -0
  221. package/dist/http/raw-url.d.cts.map +1 -0
  222. package/dist/http/raw-url.d.mts +54 -0
  223. package/dist/http/raw-url.d.mts.map +1 -0
  224. package/dist/http/raw-url.mjs +136 -0
  225. package/dist/http/raw-url.mjs.map +1 -0
  226. package/dist/http/request-context.cjs +178 -0
  227. package/dist/http/request-context.d.cts +76 -0
  228. package/dist/http/request-context.d.cts.map +1 -0
  229. package/dist/http/request-context.d.mts +76 -0
  230. package/dist/http/request-context.d.mts.map +1 -0
  231. package/dist/http/request-context.mjs +179 -0
  232. package/dist/http/request-context.mjs.map +1 -0
  233. package/dist/index.cjs +197 -0
  234. package/dist/index.d.cts +63 -0
  235. package/dist/index.d.mts +68 -0
  236. package/dist/index.mjs +61 -0
  237. package/dist/mcp/index.cjs +9 -0
  238. package/dist/mcp/index.d.cts +5 -0
  239. package/dist/mcp/index.d.mts +5 -0
  240. package/dist/mcp/index.mjs +6 -0
  241. package/dist/mcp/prompts.cjs +17 -0
  242. package/dist/mcp/prompts.d.cts +8 -0
  243. package/dist/mcp/prompts.d.cts.map +1 -0
  244. package/dist/mcp/prompts.d.mts +8 -0
  245. package/dist/mcp/prompts.d.mts.map +1 -0
  246. package/dist/mcp/prompts.mjs +17 -0
  247. package/dist/mcp/prompts.mjs.map +1 -0
  248. package/dist/mcp/resources.cjs +22 -0
  249. package/dist/mcp/resources.d.cts +8 -0
  250. package/dist/mcp/resources.d.cts.map +1 -0
  251. package/dist/mcp/resources.d.mts +8 -0
  252. package/dist/mcp/resources.d.mts.map +1 -0
  253. package/dist/mcp/resources.mjs +22 -0
  254. package/dist/mcp/resources.mjs.map +1 -0
  255. package/dist/mcp/server.cjs +51 -0
  256. package/dist/mcp/server.d.cts +20 -0
  257. package/dist/mcp/server.d.cts.map +1 -0
  258. package/dist/mcp/server.d.mts +20 -0
  259. package/dist/mcp/server.d.mts.map +1 -0
  260. package/dist/mcp/server.mjs +52 -0
  261. package/dist/mcp/server.mjs.map +1 -0
  262. package/dist/mcp/tools.cjs +218 -0
  263. package/dist/mcp/tools.d.cts +8 -0
  264. package/dist/mcp/tools.d.cts.map +1 -0
  265. package/dist/mcp/tools.d.mts +8 -0
  266. package/dist/mcp/tools.d.mts.map +1 -0
  267. package/dist/mcp/tools.mjs +219 -0
  268. package/dist/mcp/tools.mjs.map +1 -0
  269. package/dist/mcp/utils.cjs +75 -0
  270. package/dist/mcp/utils.mjs +69 -0
  271. package/dist/mcp/utils.mjs.map +1 -0
  272. package/dist/mount/index.cjs +4 -0
  273. package/dist/mount/index.d.cts +3 -0
  274. package/dist/mount/index.d.mts +3 -0
  275. package/dist/mount/index.mjs +3 -0
  276. package/dist/mount/materializer.cjs +167 -0
  277. package/dist/mount/materializer.d.cts +97 -0
  278. package/dist/mount/materializer.d.cts.map +1 -0
  279. package/dist/mount/materializer.d.mts +97 -0
  280. package/dist/mount/materializer.d.mts.map +1 -0
  281. package/dist/mount/materializer.mjs +167 -0
  282. package/dist/mount/materializer.mjs.map +1 -0
  283. package/dist/mount/types.d.cts +90 -0
  284. package/dist/mount/types.d.cts.map +1 -0
  285. package/dist/mount/types.d.mts +90 -0
  286. package/dist/mount/types.d.mts.map +1 -0
  287. package/dist/mount-config.cjs +61 -0
  288. package/dist/mount-config.d.cts +19 -0
  289. package/dist/mount-config.d.cts.map +1 -0
  290. package/dist/mount-config.d.mts +19 -0
  291. package/dist/mount-config.d.mts.map +1 -0
  292. package/dist/mount-config.mjs +61 -0
  293. package/dist/mount-config.mjs.map +1 -0
  294. package/dist/projectors/aup-projector.cjs +190 -0
  295. package/dist/projectors/aup-projector.d.cts +59 -0
  296. package/dist/projectors/aup-projector.d.cts.map +1 -0
  297. package/dist/projectors/aup-projector.d.mts +59 -0
  298. package/dist/projectors/aup-projector.d.mts.map +1 -0
  299. package/dist/projectors/aup-projector.mjs +188 -0
  300. package/dist/projectors/aup-projector.mjs.map +1 -0
  301. package/dist/projectors/index.cjs +6 -0
  302. package/dist/projectors/index.d.cts +2 -0
  303. package/dist/projectors/index.d.mts +2 -0
  304. package/dist/projectors/index.mjs +3 -0
  305. package/dist/scaffold/afs.cjs +195 -0
  306. package/dist/scaffold/afs.d.cts +16 -0
  307. package/dist/scaffold/afs.d.cts.map +1 -0
  308. package/dist/scaffold/afs.d.mts +16 -0
  309. package/dist/scaffold/afs.d.mts.map +1 -0
  310. package/dist/scaffold/afs.mjs +195 -0
  311. package/dist/scaffold/afs.mjs.map +1 -0
  312. package/dist/scaffold/composition.cjs +92 -0
  313. package/dist/scaffold/composition.d.cts +10 -0
  314. package/dist/scaffold/composition.d.cts.map +1 -0
  315. package/dist/scaffold/composition.d.mts +10 -0
  316. package/dist/scaffold/composition.d.mts.map +1 -0
  317. package/dist/scaffold/composition.mjs +92 -0
  318. package/dist/scaffold/composition.mjs.map +1 -0
  319. package/dist/scaffold/dsl-error.cjs +21 -0
  320. package/dist/scaffold/dsl-error.d.cts +11 -0
  321. package/dist/scaffold/dsl-error.d.cts.map +1 -0
  322. package/dist/scaffold/dsl-error.d.mts +11 -0
  323. package/dist/scaffold/dsl-error.d.mts.map +1 -0
  324. package/dist/scaffold/dsl-error.mjs +20 -0
  325. package/dist/scaffold/dsl-error.mjs.map +1 -0
  326. package/dist/scaffold/index.d.mts +12 -0
  327. package/dist/scaffold/manifest-dsl.cjs +188 -0
  328. package/dist/scaffold/manifest-dsl.d.cts +8 -0
  329. package/dist/scaffold/manifest-dsl.d.cts.map +1 -0
  330. package/dist/scaffold/manifest-dsl.d.mts +8 -0
  331. package/dist/scaffold/manifest-dsl.d.mts.map +1 -0
  332. package/dist/scaffold/manifest-dsl.mjs +188 -0
  333. package/dist/scaffold/manifest-dsl.mjs.map +1 -0
  334. package/dist/scaffold/module-dsl.cjs +284 -0
  335. package/dist/scaffold/module-dsl.d.cts +8 -0
  336. package/dist/scaffold/module-dsl.d.cts.map +1 -0
  337. package/dist/scaffold/module-dsl.d.mts +8 -0
  338. package/dist/scaffold/module-dsl.d.mts.map +1 -0
  339. package/dist/scaffold/module-dsl.mjs +284 -0
  340. package/dist/scaffold/module-dsl.mjs.map +1 -0
  341. package/dist/scaffold/resolver.cjs +156 -0
  342. package/dist/scaffold/resolver.d.cts +7 -0
  343. package/dist/scaffold/resolver.d.cts.map +1 -0
  344. package/dist/scaffold/resolver.d.mts +7 -0
  345. package/dist/scaffold/resolver.d.mts.map +1 -0
  346. package/dist/scaffold/resolver.mjs +156 -0
  347. package/dist/scaffold/resolver.mjs.map +1 -0
  348. package/dist/scaffold/runtime.cjs +24 -0
  349. package/dist/scaffold/runtime.d.cts +19 -0
  350. package/dist/scaffold/runtime.d.cts.map +1 -0
  351. package/dist/scaffold/runtime.d.mts +19 -0
  352. package/dist/scaffold/runtime.d.mts.map +1 -0
  353. package/dist/scaffold/runtime.mjs +25 -0
  354. package/dist/scaffold/runtime.mjs.map +1 -0
  355. package/dist/scaffold/shell-dsl.cjs +279 -0
  356. package/dist/scaffold/shell-dsl.d.cts +8 -0
  357. package/dist/scaffold/shell-dsl.d.cts.map +1 -0
  358. package/dist/scaffold/shell-dsl.d.mts +8 -0
  359. package/dist/scaffold/shell-dsl.d.mts.map +1 -0
  360. package/dist/scaffold/shell-dsl.mjs +279 -0
  361. package/dist/scaffold/shell-dsl.mjs.map +1 -0
  362. package/dist/scaffold/surface-dsl.cjs +182 -0
  363. package/dist/scaffold/surface-dsl.d.cts +8 -0
  364. package/dist/scaffold/surface-dsl.d.cts.map +1 -0
  365. package/dist/scaffold/surface-dsl.d.mts +8 -0
  366. package/dist/scaffold/surface-dsl.d.mts.map +1 -0
  367. package/dist/scaffold/surface-dsl.mjs +182 -0
  368. package/dist/scaffold/surface-dsl.mjs.map +1 -0
  369. package/dist/scaffold/surfaces.cjs +84 -0
  370. package/dist/scaffold/surfaces.d.cts +23 -0
  371. package/dist/scaffold/surfaces.d.cts.map +1 -0
  372. package/dist/scaffold/surfaces.d.mts +24 -0
  373. package/dist/scaffold/surfaces.d.mts.map +1 -0
  374. package/dist/scaffold/surfaces.mjs +84 -0
  375. package/dist/scaffold/surfaces.mjs.map +1 -0
  376. package/dist/scaffold/types.d.cts +264 -0
  377. package/dist/scaffold/types.d.cts.map +1 -0
  378. package/dist/scaffold/types.d.mts +265 -0
  379. package/dist/scaffold/types.d.mts.map +1 -0
  380. package/dist/scaffold/workspace-dsl.cjs +339 -0
  381. package/dist/scaffold/workspace-dsl.d.cts +49 -0
  382. package/dist/scaffold/workspace-dsl.d.cts.map +1 -0
  383. package/dist/scaffold/workspace-dsl.d.mts +49 -0
  384. package/dist/scaffold/workspace-dsl.d.mts.map +1 -0
  385. package/dist/scaffold/workspace-dsl.mjs +337 -0
  386. package/dist/scaffold/workspace-dsl.mjs.map +1 -0
  387. package/dist/scope/index.d.mts +3 -0
  388. package/dist/scope/read-blocklet-scope.cjs +29 -0
  389. package/dist/scope/read-blocklet-scope.d.cts +8 -0
  390. package/dist/scope/read-blocklet-scope.d.cts.map +1 -0
  391. package/dist/scope/read-blocklet-scope.d.mts +8 -0
  392. package/dist/scope/read-blocklet-scope.d.mts.map +1 -0
  393. package/dist/scope/read-blocklet-scope.mjs +30 -0
  394. package/dist/scope/read-blocklet-scope.mjs.map +1 -0
  395. package/dist/scope/resolve-scoped-afs.cjs +87 -0
  396. package/dist/scope/resolve-scoped-afs.d.cts +7 -0
  397. package/dist/scope/resolve-scoped-afs.d.cts.map +1 -0
  398. package/dist/scope/resolve-scoped-afs.d.mts +7 -0
  399. package/dist/scope/resolve-scoped-afs.d.mts.map +1 -0
  400. package/dist/scope/resolve-scoped-afs.mjs +88 -0
  401. package/dist/scope/resolve-scoped-afs.mjs.map +1 -0
  402. package/dist/scope/types.d.cts +25 -0
  403. package/dist/scope/types.d.cts.map +1 -0
  404. package/dist/scope/types.d.mts +25 -0
  405. package/dist/scope/types.d.mts.map +1 -0
  406. package/dist/session/backends.cjs +90 -0
  407. package/dist/session/backends.d.cts +35 -0
  408. package/dist/session/backends.d.cts.map +1 -0
  409. package/dist/session/backends.d.mts +35 -0
  410. package/dist/session/backends.d.mts.map +1 -0
  411. package/dist/session/backends.mjs +89 -0
  412. package/dist/session/backends.mjs.map +1 -0
  413. package/dist/session/replication-resolver.cjs +323 -0
  414. package/dist/session/replication-resolver.d.cts +71 -0
  415. package/dist/session/replication-resolver.d.cts.map +1 -0
  416. package/dist/session/replication-resolver.d.mts +71 -0
  417. package/dist/session/replication-resolver.d.mts.map +1 -0
  418. package/dist/session/replication-resolver.mjs +323 -0
  419. package/dist/session/replication-resolver.mjs.map +1 -0
  420. package/dist/session/role-level.cjs +36 -0
  421. package/dist/session/role-level.d.cts +24 -0
  422. package/dist/session/role-level.d.cts.map +1 -0
  423. package/dist/session/role-level.d.mts +24 -0
  424. package/dist/session/role-level.d.mts.map +1 -0
  425. package/dist/session/role-level.mjs +35 -0
  426. package/dist/session/role-level.mjs.map +1 -0
  427. package/dist/session/session-dir-providers.cjs +254 -0
  428. package/dist/session/session-dir-providers.d.cts +32 -0
  429. package/dist/session/session-dir-providers.d.cts.map +1 -0
  430. package/dist/session/session-dir-providers.d.mts +32 -0
  431. package/dist/session/session-dir-providers.d.mts.map +1 -0
  432. package/dist/session/session-dir-providers.mjs +252 -0
  433. package/dist/session/session-dir-providers.mjs.map +1 -0
  434. package/dist/session/session-id.cjs +20 -0
  435. package/dist/session/session-id.d.cts +15 -0
  436. package/dist/session/session-id.d.cts.map +1 -0
  437. package/dist/session/session-id.d.mts +15 -0
  438. package/dist/session/session-id.d.mts.map +1 -0
  439. package/dist/session/session-id.mjs +20 -0
  440. package/dist/session/session-id.mjs.map +1 -0
  441. package/dist/session/session-user-afs.cjs +899 -0
  442. package/dist/session/session-user-afs.d.cts +296 -0
  443. package/dist/session/session-user-afs.d.cts.map +1 -0
  444. package/dist/session/session-user-afs.d.mts +296 -0
  445. package/dist/session/session-user-afs.d.mts.map +1 -0
  446. package/dist/session/session-user-afs.mjs +896 -0
  447. package/dist/session/session-user-afs.mjs.map +1 -0
  448. package/dist/session/settings-cascade.cjs +69 -0
  449. package/dist/session/settings-cascade.d.cts +81 -0
  450. package/dist/session/settings-cascade.d.cts.map +1 -0
  451. package/dist/session/settings-cascade.d.mts +81 -0
  452. package/dist/session/settings-cascade.d.mts.map +1 -0
  453. package/dist/session/settings-cascade.mjs +69 -0
  454. package/dist/session/settings-cascade.mjs.map +1 -0
  455. package/dist/session/settings-resolver.cjs +770 -0
  456. package/dist/session/settings-resolver.d.cts +177 -0
  457. package/dist/session/settings-resolver.d.cts.map +1 -0
  458. package/dist/session/settings-resolver.d.mts +177 -0
  459. package/dist/session/settings-resolver.d.mts.map +1 -0
  460. package/dist/session/settings-resolver.mjs +771 -0
  461. package/dist/session/settings-resolver.mjs.map +1 -0
  462. package/dist/session/settings-schema-store.cjs +0 -0
  463. package/dist/session/settings-schema-store.d.cts +72 -0
  464. package/dist/session/settings-schema-store.d.cts.map +1 -0
  465. package/dist/session/settings-schema-store.d.mts +72 -0
  466. package/dist/session/settings-schema-store.d.mts.map +1 -0
  467. package/dist/session/settings-schema-store.mjs +0 -0
  468. package/dist/session/settings-schema-store.mjs.map +1 -0
  469. package/dist/system-mounts/index.cjs +14 -0
  470. package/dist/system-mounts/index.d.cts +6 -0
  471. package/dist/system-mounts/index.d.mts +6 -0
  472. package/dist/system-mounts/index.mjs +6 -0
  473. package/dist/system-mounts/install.cjs +101 -0
  474. package/dist/system-mounts/install.d.cts +36 -0
  475. package/dist/system-mounts/install.d.cts.map +1 -0
  476. package/dist/system-mounts/install.d.mts +37 -0
  477. package/dist/system-mounts/install.d.mts.map +1 -0
  478. package/dist/system-mounts/install.mjs +102 -0
  479. package/dist/system-mounts/install.mjs.map +1 -0
  480. package/dist/system-mounts/installers.cjs +247 -0
  481. package/dist/system-mounts/installers.d.cts +13 -0
  482. package/dist/system-mounts/installers.d.cts.map +1 -0
  483. package/dist/system-mounts/installers.d.mts +14 -0
  484. package/dist/system-mounts/installers.d.mts.map +1 -0
  485. package/dist/system-mounts/installers.mjs +244 -0
  486. package/dist/system-mounts/installers.mjs.map +1 -0
  487. package/dist/system-mounts/lists.cjs +122 -0
  488. package/dist/system-mounts/lists.d.cts +34 -0
  489. package/dist/system-mounts/lists.d.cts.map +1 -0
  490. package/dist/system-mounts/lists.d.mts +34 -0
  491. package/dist/system-mounts/lists.d.mts.map +1 -0
  492. package/dist/system-mounts/lists.mjs +122 -0
  493. package/dist/system-mounts/lists.mjs.map +1 -0
  494. package/dist/system-mounts/types.d.cts +124 -0
  495. package/dist/system-mounts/types.d.cts.map +1 -0
  496. package/dist/system-mounts/types.d.mts +125 -0
  497. package/dist/system-mounts/types.d.mts.map +1 -0
  498. package/dist/system-mounts/validate.cjs +56 -0
  499. package/dist/system-mounts/validate.d.cts +34 -0
  500. package/dist/system-mounts/validate.d.cts.map +1 -0
  501. package/dist/system-mounts/validate.d.mts +34 -0
  502. package/dist/system-mounts/validate.d.mts.map +1 -0
  503. package/dist/system-mounts/validate.mjs +56 -0
  504. package/dist/system-mounts/validate.mjs.map +1 -0
  505. package/dist/terminal-llm.cjs +90 -0
  506. package/dist/terminal-llm.d.cts +50 -0
  507. package/dist/terminal-llm.d.cts.map +1 -0
  508. package/dist/terminal-llm.d.mts +50 -0
  509. package/dist/terminal-llm.d.mts.map +1 -0
  510. package/dist/terminal-llm.mjs +90 -0
  511. package/dist/terminal-llm.mjs.map +1 -0
  512. package/dist/terminal-repl.cjs +371 -0
  513. package/dist/terminal-repl.d.cts +69 -0
  514. package/dist/terminal-repl.d.cts.map +1 -0
  515. package/dist/terminal-repl.d.mts +69 -0
  516. package/dist/terminal-repl.d.mts.map +1 -0
  517. package/dist/terminal-repl.mjs +370 -0
  518. package/dist/terminal-repl.mjs.map +1 -0
  519. package/dist/transport/idle-timer.cjs +136 -0
  520. package/dist/transport/idle-timer.d.cts +92 -0
  521. package/dist/transport/idle-timer.d.cts.map +1 -0
  522. package/dist/transport/idle-timer.d.mts +92 -0
  523. package/dist/transport/idle-timer.d.mts.map +1 -0
  524. package/dist/transport/idle-timer.mjs +132 -0
  525. package/dist/transport/idle-timer.mjs.map +1 -0
  526. package/dist/web-component-dsl.cjs +153 -0
  527. package/dist/web-component-dsl.d.cts +27 -0
  528. package/dist/web-component-dsl.d.cts.map +1 -0
  529. package/dist/web-component-dsl.d.mts +27 -0
  530. package/dist/web-component-dsl.d.mts.map +1 -0
  531. package/dist/web-component-dsl.mjs +152 -0
  532. package/dist/web-component-dsl.mjs.map +1 -0
  533. package/package.json +81 -0
@@ -0,0 +1,102 @@
1
+ import { materializeProviderMount, redactError } from "../mount/materializer.mjs";
2
+ import { aupResourceProjector } from "../projectors/aup-projector.mjs";
3
+ import { SYSTEM_MOUNTS } from "./lists.mjs";
4
+ import { validateDescriptor } from "./validate.mjs";
5
+ import { time } from "@aigne/afs-timing";
6
+
7
+ //#region src/system-mounts/install.ts
8
+ function hasMount(afs, path) {
9
+ const getMounts = afs.getMounts;
10
+ if (typeof getMounts !== "function") return false;
11
+ return getMounts.call(afs).some((m) => m.path === path);
12
+ }
13
+ /**
14
+ * Per-descriptor Server-Timing key so cold-start cost is attributable to a
15
+ * single system device (`mnt.dev.chain`, `mnt.dev.ai`, …) instead of hiding
16
+ * inside the aggregate `op.prov`. Slashes → dots to keep the metric name a
17
+ * valid Server-Timing token. Diagnostic only — `time()` is a no-op when no
18
+ * TimingCollector is active on the ALS.
19
+ */
20
+ const mntKey = (path) => `mnt${path.replace(/\//g, ".")}`;
21
+ /**
22
+ * Install the system mounts described by `descriptors` (defaults to the
23
+ * shared {@link SYSTEM_MOUNTS}) onto `afs`.
24
+ *
25
+ * Per descriptor, in `order`:
26
+ * 1. {@link validateDescriptor} — invalid → skip + warning (path/`..`/proto
27
+ * pollution caught here, reusing the Phase 0 guard).
28
+ * 2. `conditional(ctx) === false` → skip.
29
+ * 3. `install` present → call it (composite hatch owns its own mounts +
30
+ * idempotency + degradation). A throw propagates — chain config errors
31
+ * stay fatal, matching the legacy daemon. Other hatches catch internally.
32
+ * 4. else `registry[providerKey]` absent → skip (this is how CF gets a
33
+ * subset without a control-flow fork).
34
+ * 5. else already mounted → skip (idempotent).
35
+ * 6. else `materializeProviderMount` with the AUP projector. A materialize
36
+ * failure degrades to a warning (matches legacy ash/agent/index, which
37
+ * were individually non-fatal).
38
+ */
39
+ async function installSystemMounts(afs, registry, ctx, descriptors = SYSTEM_MOUNTS) {
40
+ const mounted = [];
41
+ const skipped = [];
42
+ const warnings = [];
43
+ const ordered = [...descriptors].sort((a, b) => a.order - b.order);
44
+ for (const descriptor of ordered) {
45
+ const validation = validateDescriptor(descriptor);
46
+ if (!validation.ok) {
47
+ const label = descriptor?.path ?? "<unknown>";
48
+ warnings.push(`${label}: invalid descriptor — ${validation.errors.join("; ")}`);
49
+ skipped.push(String(label));
50
+ continue;
51
+ }
52
+ if (descriptor.install) {
53
+ const outcome = await time(mntKey(descriptor.path), () => descriptor.install(afs, ctx, registry));
54
+ mounted.push(...outcome.mounted);
55
+ warnings.push(...outcome.warnings);
56
+ continue;
57
+ }
58
+ const factory = registry[descriptor.providerKey];
59
+ if (!factory) {
60
+ skipped.push(descriptor.path);
61
+ continue;
62
+ }
63
+ if (descriptor.conditional && !descriptor.conditional(ctx)) {
64
+ skipped.push(descriptor.path);
65
+ continue;
66
+ }
67
+ if (hasMount(afs, descriptor.path)) {
68
+ skipped.push(descriptor.path);
69
+ continue;
70
+ }
71
+ const options = typeof descriptor.options === "function" ? descriptor.options(ctx) : descriptor.options;
72
+ try {
73
+ await time(mntKey(descriptor.path), () => materializeProviderMount({
74
+ afs,
75
+ mountPath: descriptor.path,
76
+ definition: {
77
+ uri: `${descriptor.providerKey}://system${descriptor.path}`,
78
+ type: descriptor.providerKey,
79
+ ...options !== void 0 ? { options } : {}
80
+ },
81
+ factory,
82
+ projectors: [aupResourceProjector],
83
+ scope: "host",
84
+ ...descriptor.mountOptions ? { mountOptions: descriptor.mountOptions } : {},
85
+ projectionFailure: descriptor.projectionFailure ?? "warn"
86
+ }));
87
+ mounted.push(descriptor.path);
88
+ } catch (err) {
89
+ warnings.push(`${descriptor.path}: mount failed — ${redactError(err)}`);
90
+ skipped.push(descriptor.path);
91
+ }
92
+ }
93
+ return {
94
+ mounted,
95
+ skipped,
96
+ warnings
97
+ };
98
+ }
99
+
100
+ //#endregion
101
+ export { installSystemMounts };
102
+ //# sourceMappingURL=install.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.mjs","names":[],"sources":["../../src/system-mounts/install.ts"],"sourcesContent":["/**\n * `installSystemMounts` — the single shared driver every runtime calls to\n * install its host system mounts (axis A). Replaces the per-runtime\n * hand-written orchestration (Node's 7 `setupSystem*` functions, CF's inline\n * `if` blocks) with one ordered pass over {@link SYSTEM_MOUNTS}.\n *\n * Divergence between runtimes is expressed purely as data: a runtime passes\n * a `registry` (providerKey → factory) containing only the keys it can\n * build/run. A descriptor whose `providerKey` is absent (or whose `install`\n * hatch needs an absent key) is skipped — no control-flow fork.\n *\n * See `planning/system-mount-runtime-parity/design.md` §4 / §4.1.\n */\n\nimport type { AFS, AFSRoot } from \"@aigne/afs\";\nimport { time } from \"@aigne/afs-timing\";\nimport { materializeProviderMount, type ProviderFactory, redactError } from \"../mount/index.js\";\nimport { aupResourceProjector } from \"../projectors/index.js\";\nimport { SYSTEM_MOUNTS } from \"./lists.js\";\nimport type { SystemMountContext, SystemMountDescriptor } from \"./types.js\";\nimport { validateDescriptor } from \"./validate.js\";\n\n/** Aggregate result of an {@link installSystemMounts} run. */\nexport interface InstallSystemMountsResult {\n /** Every path actually mounted (across default + install-hatch entries). */\n mounted: string[];\n /** Descriptor paths that were intentionally skipped (missing key, conditional, invalid). */\n skipped: string[];\n /** Non-fatal failures, prefixed with the offending path. */\n warnings: string[];\n}\n\nfunction hasMount(afs: AFSRoot, path: string): boolean {\n const getMounts = (afs as unknown as AFS).getMounts;\n if (typeof getMounts !== \"function\") return false;\n return getMounts.call(afs).some((m: { path: string }) => m.path === path);\n}\n\n/**\n * Per-descriptor Server-Timing key so cold-start cost is attributable to a\n * single system device (`mnt.dev.chain`, `mnt.dev.ai`, …) instead of hiding\n * inside the aggregate `op.prov`. Slashes → dots to keep the metric name a\n * valid Server-Timing token. Diagnostic only — `time()` is a no-op when no\n * TimingCollector is active on the ALS.\n */\nconst mntKey = (path: string): string => `mnt${path.replace(/\\//g, \".\")}`;\n\n/**\n * Install the system mounts described by `descriptors` (defaults to the\n * shared {@link SYSTEM_MOUNTS}) onto `afs`.\n *\n * Per descriptor, in `order`:\n * 1. {@link validateDescriptor} — invalid → skip + warning (path/`..`/proto\n * pollution caught here, reusing the Phase 0 guard).\n * 2. `conditional(ctx) === false` → skip.\n * 3. `install` present → call it (composite hatch owns its own mounts +\n * idempotency + degradation). A throw propagates — chain config errors\n * stay fatal, matching the legacy daemon. Other hatches catch internally.\n * 4. else `registry[providerKey]` absent → skip (this is how CF gets a\n * subset without a control-flow fork).\n * 5. else already mounted → skip (idempotent).\n * 6. else `materializeProviderMount` with the AUP projector. A materialize\n * failure degrades to a warning (matches legacy ash/agent/index, which\n * were individually non-fatal).\n */\nexport async function installSystemMounts(\n afs: AFSRoot,\n registry: Record<string, ProviderFactory>,\n ctx: SystemMountContext,\n descriptors: readonly SystemMountDescriptor[] = SYSTEM_MOUNTS,\n): Promise<InstallSystemMountsResult> {\n const mounted: string[] = [];\n const skipped: string[] = [];\n const warnings: string[] = [];\n\n // Copy before sort — never mutate the frozen shared list.\n const ordered = [...descriptors].sort((a, b) => a.order - b.order);\n\n for (const descriptor of ordered) {\n const validation = validateDescriptor(descriptor);\n if (!validation.ok) {\n const label = (descriptor as Partial<SystemMountDescriptor>)?.path ?? \"<unknown>\";\n warnings.push(`${label}: invalid descriptor — ${validation.errors.join(\"; \")}`);\n skipped.push(String(label));\n continue;\n }\n\n // Decision order mirrors design.md §4: install hatch → registry-miss →\n // conditional → materialize. `install` takes precedence (composite hatch\n // owns its own construction + idempotency + degradation); a throw is fatal\n // by design (chain config validation), so we do NOT swallow it.\n if (descriptor.install) {\n const outcome = await time(mntKey(descriptor.path), () =>\n descriptor.install!(afs, ctx, registry),\n );\n mounted.push(...outcome.mounted);\n warnings.push(...outcome.warnings);\n continue;\n }\n\n const factory = registry[descriptor.providerKey as string];\n if (!factory) {\n // Subset semantics: the runtime can't build this provider. Not an error.\n skipped.push(descriptor.path);\n continue;\n }\n\n if (descriptor.conditional && !descriptor.conditional(ctx)) {\n skipped.push(descriptor.path);\n continue;\n }\n\n if (hasMount(afs, descriptor.path)) {\n skipped.push(descriptor.path);\n continue;\n }\n\n const options =\n typeof descriptor.options === \"function\" ? descriptor.options(ctx) : descriptor.options;\n\n try {\n await time(mntKey(descriptor.path), () =>\n materializeProviderMount({\n afs: afs as unknown as AFS,\n mountPath: descriptor.path,\n definition: {\n // URI is informational (error messages); the factory constructs\n // the provider from `options`.\n uri: `${descriptor.providerKey}://system${descriptor.path}`,\n type: descriptor.providerKey as string,\n ...(options !== undefined ? { options } : {}),\n },\n factory,\n projectors: [aupResourceProjector],\n scope: \"host\",\n ...(descriptor.mountOptions ? { mountOptions: descriptor.mountOptions } : {}),\n projectionFailure: descriptor.projectionFailure ?? \"warn\",\n }),\n );\n mounted.push(descriptor.path);\n } catch (err) {\n warnings.push(`${descriptor.path}: mount failed — ${redactError(err)}`);\n skipped.push(descriptor.path);\n }\n }\n\n return { mounted, skipped, warnings };\n}\n"],"mappings":";;;;;;;AAgCA,SAAS,SAAS,KAAc,MAAuB;CACrD,MAAM,YAAa,IAAuB;AAC1C,KAAI,OAAO,cAAc,WAAY,QAAO;AAC5C,QAAO,UAAU,KAAK,IAAI,CAAC,MAAM,MAAwB,EAAE,SAAS,KAAK;;;;;;;;;AAU3E,MAAM,UAAU,SAAyB,MAAM,KAAK,QAAQ,OAAO,IAAI;;;;;;;;;;;;;;;;;;;AAoBvE,eAAsB,oBACpB,KACA,UACA,KACA,cAAgD,eACZ;CACpC,MAAM,UAAoB,EAAE;CAC5B,MAAM,UAAoB,EAAE;CAC5B,MAAM,WAAqB,EAAE;CAG7B,MAAM,UAAU,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM;AAElE,MAAK,MAAM,cAAc,SAAS;EAChC,MAAM,aAAa,mBAAmB,WAAW;AACjD,MAAI,CAAC,WAAW,IAAI;GAClB,MAAM,QAAS,YAA+C,QAAQ;AACtE,YAAS,KAAK,GAAG,MAAM,yBAAyB,WAAW,OAAO,KAAK,KAAK,GAAG;AAC/E,WAAQ,KAAK,OAAO,MAAM,CAAC;AAC3B;;AAOF,MAAI,WAAW,SAAS;GACtB,MAAM,UAAU,MAAM,KAAK,OAAO,WAAW,KAAK,QAChD,WAAW,QAAS,KAAK,KAAK,SAAS,CACxC;AACD,WAAQ,KAAK,GAAG,QAAQ,QAAQ;AAChC,YAAS,KAAK,GAAG,QAAQ,SAAS;AAClC;;EAGF,MAAM,UAAU,SAAS,WAAW;AACpC,MAAI,CAAC,SAAS;AAEZ,WAAQ,KAAK,WAAW,KAAK;AAC7B;;AAGF,MAAI,WAAW,eAAe,CAAC,WAAW,YAAY,IAAI,EAAE;AAC1D,WAAQ,KAAK,WAAW,KAAK;AAC7B;;AAGF,MAAI,SAAS,KAAK,WAAW,KAAK,EAAE;AAClC,WAAQ,KAAK,WAAW,KAAK;AAC7B;;EAGF,MAAM,UACJ,OAAO,WAAW,YAAY,aAAa,WAAW,QAAQ,IAAI,GAAG,WAAW;AAElF,MAAI;AACF,SAAM,KAAK,OAAO,WAAW,KAAK,QAChC,yBAAyB;IAClB;IACL,WAAW,WAAW;IACtB,YAAY;KAGV,KAAK,GAAG,WAAW,YAAY,WAAW,WAAW;KACrD,MAAM,WAAW;KACjB,GAAI,YAAY,SAAY,EAAE,SAAS,GAAG,EAAE;KAC7C;IACD;IACA,YAAY,CAAC,qBAAqB;IAClC,OAAO;IACP,GAAI,WAAW,eAAe,EAAE,cAAc,WAAW,cAAc,GAAG,EAAE;IAC5E,mBAAmB,WAAW,qBAAqB;IACpD,CAAC,CACH;AACD,WAAQ,KAAK,WAAW,KAAK;WACtB,KAAK;AACZ,YAAS,KAAK,GAAG,WAAW,KAAK,mBAAmB,YAAY,IAAI,GAAG;AACvE,WAAQ,KAAK,WAAW,KAAK;;;AAIjC,QAAO;EAAE;EAAS;EAAS;EAAU"}
@@ -0,0 +1,247 @@
1
+ const require_chain = require('../devices/chain.cjs');
2
+ const require_materializer = require('../mount/materializer.cjs');
3
+ const require_aup_projector = require('../projectors/aup-projector.cjs');
4
+ let ufo = require("ufo");
5
+ let _aigne_afs = require("@aigne/afs");
6
+ let _aigne_afs_timing = require("@aigne/afs-timing");
7
+
8
+ //#region src/system-mounts/installers.ts
9
+ /**
10
+ * Runtime-neutral `install` escape-hatch implementations for the composite
11
+ * entries in {@link SYSTEM_MOUNTS} (design.md §4.1). These orchestrate
12
+ * multi-step mounts that a single `path`+`providerKey` can't express:
13
+ *
14
+ * - {@link aiInstall} — `/dev/ai` device + legacy/compat projections
15
+ * - {@link chainInstall} — `/dev/chain/<network>` per builtin/config network + AUP
16
+ * - {@link deviceInstall} — `/dev/ui`, `/dev/web` projections (conditional on source)
17
+ * - {@link observabilityInstall} — `/dev/observability` (+ optional host-inbox)
18
+ * - {@link messagingInstall} — `/proc/messaging/agents` + `/proc/messaging/tools`
19
+ *
20
+ * Crucial invariant: NONE of these import a runtime-specific module. All
21
+ * provider *construction* is delegated to the `registry` factories the
22
+ * runtime supplies (Node builds disk-backed providers + loads AUP from the
23
+ * package dir; CF builds bundled providers + loads AUP over HTTP). Projection
24
+ * uses `ProjectionProvider` from `@aigne/afs` (runtime-neutral) and AUP
25
+ * companion resources flow through the factory's `resources` field + the
26
+ * materializer's `aupResourceProjector`. So these hatches bundle cleanly into
27
+ * the Cloudflare Worker even when CF's registry omits the keys (the hatch
28
+ * skips that sub-mount).
29
+ */
30
+ const PROJECTION_OVERLAY = { allowOverlay: true };
31
+ function getMounts(afs) {
32
+ const fn = afs.getMounts;
33
+ return typeof fn === "function" ? fn.call(afs) : [];
34
+ }
35
+ function hasMount(afs, path) {
36
+ return getMounts(afs).some((m) => m.path === path);
37
+ }
38
+ /** Mount a `ProjectionProvider` alias `target → source`, idempotent + tolerant. */
39
+ async function mountProjection(afs, target, source, name, out) {
40
+ if (hasMount(afs, target)) return;
41
+ try {
42
+ await afs.mount(new _aigne_afs.ProjectionProvider({
43
+ name,
44
+ globalAFS: afs,
45
+ sourcePath: source
46
+ }), target, PROJECTION_OVERLAY);
47
+ out.mounted.push(target);
48
+ } catch (err) {
49
+ out.warnings.push(`${target}: projection failed — ${require_materializer.redactError(err)}`);
50
+ }
51
+ }
52
+ const AI_DEVICE = "/dev/ai";
53
+ const AI_HUBS_AIGNEHUB = "/dev/ai/hubs/aignehub";
54
+ const AI_LOCAL_EMBEDDING = "/dev/ai/local/embedding";
55
+ const LEGACY_AIGNEHUB = "/modules/aignehub";
56
+ const LEGACY_EMBEDDING = "/modules/embedding";
57
+ const COMPAT_HUB = "/dev/ai/hub";
58
+ const COMPAT_DEFAULTS = "/dev/ai/defaults";
59
+ const COMPAT_EMBEDDING = "/dev/ai/embedding";
60
+ async function aiInstall(afs, _ctx, registry) {
61
+ const out = {
62
+ mounted: [],
63
+ warnings: []
64
+ };
65
+ if (!hasMount(afs, AI_HUBS_AIGNEHUB)) {
66
+ const legacy = hasMount(afs, LEGACY_AIGNEHUB) ? LEGACY_AIGNEHUB : hasMount(afs, COMPAT_HUB) ? COMPAT_HUB : null;
67
+ if (legacy) await mountProjection(afs, AI_HUBS_AIGNEHUB, legacy, "dev-ai-hubs-aignehub", out);
68
+ }
69
+ if (!hasMount(afs, AI_LOCAL_EMBEDDING) && hasMount(afs, LEGACY_EMBEDDING)) await mountProjection(afs, AI_LOCAL_EMBEDDING, LEGACY_EMBEDDING, "dev-ai-local-embedding", out);
70
+ if (hasMount(afs, AI_HUBS_AIGNEHUB)) {
71
+ await mountProjection(afs, COMPAT_HUB, AI_HUBS_AIGNEHUB, "dev-ai-hub-compat", out);
72
+ await mountProjection(afs, COMPAT_DEFAULTS, (0, ufo.joinURL)(AI_HUBS_AIGNEHUB, "defaults"), "dev-ai-defaults-compat", out);
73
+ }
74
+ if (hasMount(afs, AI_LOCAL_EMBEDDING)) await mountProjection(afs, COMPAT_EMBEDDING, AI_LOCAL_EMBEDDING, "dev-ai-embedding-compat", out);
75
+ if (!hasMount(afs, AI_DEVICE)) {
76
+ const factory = registry["ai-device"];
77
+ if (factory) try {
78
+ const options = { globalAFS: afs };
79
+ if (hasMount(afs, "/user")) options.userSpaceRoot = "/user";
80
+ const { provider } = await factory.create({
81
+ uri: `ai-device://system${AI_DEVICE}`,
82
+ type: "ai-device",
83
+ options
84
+ });
85
+ await afs.mount(provider, AI_DEVICE, PROJECTION_OVERLAY);
86
+ out.mounted.push(AI_DEVICE);
87
+ } catch (err) {
88
+ out.warnings.push(`${AI_DEVICE}: mount failed — ${require_materializer.redactError(err)}`);
89
+ }
90
+ }
91
+ return out;
92
+ }
93
+ async function chainInstall(afs, ctx, registry) {
94
+ const out = {
95
+ mounted: [],
96
+ warnings: []
97
+ };
98
+ const configs = ctx.chainConfigs;
99
+ const cfgs = [...configs && configs.length > 0 ? configs : require_chain.BUILTIN_CHAIN_NETWORKS];
100
+ require_chain.validateChainNetworks(cfgs);
101
+ const factory = registry["ocap"];
102
+ if (!factory) return out;
103
+ for (const cfg of cfgs) {
104
+ const path = require_chain.chainNetworkToMountEntry(cfg).path;
105
+ if (hasMount(afs, path)) continue;
106
+ try {
107
+ await (0, _aigne_afs_timing.time)(`mnt.dev.chain.${cfg.network}`, () => require_materializer.materializeProviderMount({
108
+ afs,
109
+ mountPath: path,
110
+ definition: {
111
+ uri: `ocap://system${path}`,
112
+ type: "ocap",
113
+ options: {
114
+ endpoint: cfg.endpoint,
115
+ description: `Chain network ${cfg.network} via ${safeEndpointLabel(cfg.endpoint)}`
116
+ }
117
+ },
118
+ factory,
119
+ projectors: [require_aup_projector.aupResourceProjector],
120
+ scope: "host",
121
+ mountOptions: PROJECTION_OVERLAY,
122
+ projectionFailure: "warn"
123
+ }));
124
+ out.mounted.push(path);
125
+ } catch (err) {
126
+ out.warnings.push(`${path}: mount failed — ${require_materializer.redactError(err)}`);
127
+ }
128
+ }
129
+ return out;
130
+ }
131
+ function safeEndpointLabel(endpoint) {
132
+ try {
133
+ const url = new URL(endpoint);
134
+ return `${url.protocol}//${url.host}`;
135
+ } catch {
136
+ return "<endpoint>";
137
+ }
138
+ }
139
+ async function deviceInstall(afs) {
140
+ const out = {
141
+ mounted: [],
142
+ warnings: []
143
+ };
144
+ for (const [target, source, name] of [[
145
+ "/dev/ui",
146
+ "/ui",
147
+ "dev-ui"
148
+ ], [
149
+ "/dev/web",
150
+ "/web",
151
+ "dev-web"
152
+ ]]) {
153
+ if (hasMount(afs, target)) continue;
154
+ if (!hasMount(afs, source)) continue;
155
+ await mountProjection(afs, target, source, name, out);
156
+ }
157
+ return out;
158
+ }
159
+ const OBS_PATH = "/dev/observability";
160
+ const OBS_HOST_INBOX = "/dev/observability/.host-inbox";
161
+ async function observabilityInstall(afs, _ctx, registry) {
162
+ const out = {
163
+ mounted: [],
164
+ warnings: []
165
+ };
166
+ if (hasMount(afs, OBS_PATH)) {
167
+ out.warnings.push(`${OBS_PATH}: already mounted — skipped`);
168
+ return out;
169
+ }
170
+ let hostInboxMounted = false;
171
+ const hostInboxFactory = registry["observability-host-inbox"];
172
+ if (hostInboxFactory) try {
173
+ const { provider } = await hostInboxFactory.create({
174
+ uri: `fs://system${OBS_HOST_INBOX}`,
175
+ type: "fs"
176
+ });
177
+ await afs.mount(provider, OBS_HOST_INBOX, { hidden: true });
178
+ hostInboxMounted = true;
179
+ out.mounted.push(OBS_HOST_INBOX);
180
+ } catch (err) {
181
+ out.warnings.push(`${OBS_HOST_INBOX}: mount failed — ${require_materializer.redactError(err)}`);
182
+ }
183
+ const factory = registry["observability"];
184
+ if (!factory) return out;
185
+ try {
186
+ await require_materializer.materializeProviderMount({
187
+ afs,
188
+ mountPath: OBS_PATH,
189
+ definition: {
190
+ uri: `observability://system${OBS_PATH}`,
191
+ type: "observability",
192
+ options: {
193
+ upstream: afs,
194
+ description: "AI agent observability — jsonl event log viewer",
195
+ ...hostInboxMounted ? { hostInboxPath: OBS_HOST_INBOX } : {}
196
+ }
197
+ },
198
+ factory,
199
+ projectors: [require_aup_projector.aupResourceProjector],
200
+ scope: "host",
201
+ mountOptions: PROJECTION_OVERLAY,
202
+ projectionFailure: "warn"
203
+ });
204
+ out.mounted.push(OBS_PATH);
205
+ } catch (err) {
206
+ out.warnings.push(`${OBS_PATH}: mount failed — ${require_materializer.redactError(err)}`);
207
+ }
208
+ return out;
209
+ }
210
+ const MSG_AGENTS = "/proc/messaging/agents";
211
+ const MSG_TOOLS = "/proc/messaging/tools";
212
+ async function messagingInstall(afs, _ctx, registry) {
213
+ const out = {
214
+ mounted: [],
215
+ warnings: []
216
+ };
217
+ const agentsFactory = registry["messaging-agents"];
218
+ if (agentsFactory && !hasMount(afs, MSG_AGENTS)) try {
219
+ const { provider } = await agentsFactory.create({
220
+ uri: `fs://system${MSG_AGENTS}`,
221
+ type: "fs"
222
+ });
223
+ await afs.mount(provider, MSG_AGENTS, PROJECTION_OVERLAY);
224
+ out.mounted.push(MSG_AGENTS);
225
+ } catch (err) {
226
+ out.warnings.push(`${MSG_AGENTS}: mount failed — ${require_materializer.redactError(err)}`);
227
+ }
228
+ const toolsFactory = registry["messaging-tools"];
229
+ if (toolsFactory && !hasMount(afs, MSG_TOOLS)) try {
230
+ const { provider } = await toolsFactory.create({
231
+ uri: `messaging-tools://system${MSG_TOOLS}`,
232
+ type: "messaging-tools"
233
+ });
234
+ await afs.mount(provider, MSG_TOOLS, PROJECTION_OVERLAY);
235
+ out.mounted.push(MSG_TOOLS);
236
+ } catch (err) {
237
+ out.warnings.push(`${MSG_TOOLS}: mount failed — ${require_materializer.redactError(err)}`);
238
+ }
239
+ return out;
240
+ }
241
+
242
+ //#endregion
243
+ exports.aiInstall = aiInstall;
244
+ exports.chainInstall = chainInstall;
245
+ exports.deviceInstall = deviceInstall;
246
+ exports.messagingInstall = messagingInstall;
247
+ exports.observabilityInstall = observabilityInstall;
@@ -0,0 +1,13 @@
1
+ import { ProviderFactory } from "../mount/types.cjs";
2
+ import { InstallOutcome, SystemMountContext } from "./types.cjs";
3
+ import { AFSRoot } from "@aigne/afs";
4
+
5
+ //#region src/system-mounts/installers.d.ts
6
+ declare function aiInstall(afs: AFSRoot, _ctx: SystemMountContext, registry: Record<string, ProviderFactory>): Promise<InstallOutcome>;
7
+ declare function chainInstall(afs: AFSRoot, ctx: SystemMountContext, registry: Record<string, ProviderFactory>): Promise<InstallOutcome>;
8
+ declare function deviceInstall(afs: AFSRoot): Promise<InstallOutcome>;
9
+ declare function observabilityInstall(afs: AFSRoot, _ctx: SystemMountContext, registry: Record<string, ProviderFactory>): Promise<InstallOutcome>;
10
+ declare function messagingInstall(afs: AFSRoot, _ctx: SystemMountContext, registry: Record<string, ProviderFactory>): Promise<InstallOutcome>;
11
+ //#endregion
12
+ export { aiInstall, chainInstall, deviceInstall, messagingInstall, observabilityInstall };
13
+ //# sourceMappingURL=installers.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installers.d.cts","names":[],"sources":["../../src/system-mounts/installers.ts"],"mappings":";;;;;iBAgFsB,SAAA,CACpB,GAAA,EAAK,OAAA,EACL,IAAA,EAAM,kBAAA,EACN,QAAA,EAAU,MAAA,SAAe,eAAA,IACxB,OAAA,CAAQ,cAAA;AAAA,iBAuEW,YAAA,CACpB,GAAA,EAAK,OAAA,EACL,GAAA,EAAK,kBAAA,EACL,QAAA,EAAU,MAAA,SAAe,eAAA,IACxB,OAAA,CAAQ,cAAA;AAAA,iBAiEW,aAAA,CAAc,GAAA,EAAK,OAAA,GAAU,OAAA,CAAQ,cAAA;AAAA,iBAuBrC,oBAAA,CACpB,GAAA,EAAK,OAAA,EACL,IAAA,EAAM,kBAAA,EACN,QAAA,EAAU,MAAA,SAAe,eAAA,IACxB,OAAA,CAAQ,cAAA;AAAA,iBAmEW,gBAAA,CACpB,GAAA,EAAK,OAAA,EACL,IAAA,EAAM,kBAAA,EACN,QAAA,EAAU,MAAA,SAAe,eAAA,IACxB,OAAA,CAAQ,cAAA"}
@@ -0,0 +1,14 @@
1
+ import { ProviderFactory } from "../mount/types.mjs";
2
+ import "../mount/index.mjs";
3
+ import { InstallOutcome, SystemMountContext } from "./types.mjs";
4
+ import { AFSRoot } from "@aigne/afs";
5
+
6
+ //#region src/system-mounts/installers.d.ts
7
+ declare function aiInstall(afs: AFSRoot, _ctx: SystemMountContext, registry: Record<string, ProviderFactory>): Promise<InstallOutcome>;
8
+ declare function chainInstall(afs: AFSRoot, ctx: SystemMountContext, registry: Record<string, ProviderFactory>): Promise<InstallOutcome>;
9
+ declare function deviceInstall(afs: AFSRoot): Promise<InstallOutcome>;
10
+ declare function observabilityInstall(afs: AFSRoot, _ctx: SystemMountContext, registry: Record<string, ProviderFactory>): Promise<InstallOutcome>;
11
+ declare function messagingInstall(afs: AFSRoot, _ctx: SystemMountContext, registry: Record<string, ProviderFactory>): Promise<InstallOutcome>;
12
+ //#endregion
13
+ export { aiInstall, chainInstall, deviceInstall, messagingInstall, observabilityInstall };
14
+ //# sourceMappingURL=installers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installers.d.mts","names":[],"sources":["../../src/system-mounts/installers.ts"],"mappings":";;;;;;iBAgFsB,SAAA,CACpB,GAAA,EAAK,OAAA,EACL,IAAA,EAAM,kBAAA,EACN,QAAA,EAAU,MAAA,SAAe,eAAA,IACxB,OAAA,CAAQ,cAAA;AAAA,iBAuEW,YAAA,CACpB,GAAA,EAAK,OAAA,EACL,GAAA,EAAK,kBAAA,EACL,QAAA,EAAU,MAAA,SAAe,eAAA,IACxB,OAAA,CAAQ,cAAA;AAAA,iBAiEW,aAAA,CAAc,GAAA,EAAK,OAAA,GAAU,OAAA,CAAQ,cAAA;AAAA,iBAuBrC,oBAAA,CACpB,GAAA,EAAK,OAAA,EACL,IAAA,EAAM,kBAAA,EACN,QAAA,EAAU,MAAA,SAAe,eAAA,IACxB,OAAA,CAAQ,cAAA;AAAA,iBAmEW,gBAAA,CACpB,GAAA,EAAK,OAAA,EACL,IAAA,EAAM,kBAAA,EACN,QAAA,EAAU,MAAA,SAAe,eAAA,IACxB,OAAA,CAAQ,cAAA"}
@@ -0,0 +1,244 @@
1
+ import { BUILTIN_CHAIN_NETWORKS, chainNetworkToMountEntry, validateChainNetworks } from "../devices/chain.mjs";
2
+ import { materializeProviderMount, redactError } from "../mount/materializer.mjs";
3
+ import { aupResourceProjector } from "../projectors/aup-projector.mjs";
4
+ import { joinURL } from "ufo";
5
+ import { ProjectionProvider } from "@aigne/afs";
6
+ import { time } from "@aigne/afs-timing";
7
+
8
+ //#region src/system-mounts/installers.ts
9
+ /**
10
+ * Runtime-neutral `install` escape-hatch implementations for the composite
11
+ * entries in {@link SYSTEM_MOUNTS} (design.md §4.1). These orchestrate
12
+ * multi-step mounts that a single `path`+`providerKey` can't express:
13
+ *
14
+ * - {@link aiInstall} — `/dev/ai` device + legacy/compat projections
15
+ * - {@link chainInstall} — `/dev/chain/<network>` per builtin/config network + AUP
16
+ * - {@link deviceInstall} — `/dev/ui`, `/dev/web` projections (conditional on source)
17
+ * - {@link observabilityInstall} — `/dev/observability` (+ optional host-inbox)
18
+ * - {@link messagingInstall} — `/proc/messaging/agents` + `/proc/messaging/tools`
19
+ *
20
+ * Crucial invariant: NONE of these import a runtime-specific module. All
21
+ * provider *construction* is delegated to the `registry` factories the
22
+ * runtime supplies (Node builds disk-backed providers + loads AUP from the
23
+ * package dir; CF builds bundled providers + loads AUP over HTTP). Projection
24
+ * uses `ProjectionProvider` from `@aigne/afs` (runtime-neutral) and AUP
25
+ * companion resources flow through the factory's `resources` field + the
26
+ * materializer's `aupResourceProjector`. So these hatches bundle cleanly into
27
+ * the Cloudflare Worker even when CF's registry omits the keys (the hatch
28
+ * skips that sub-mount).
29
+ */
30
+ const PROJECTION_OVERLAY = { allowOverlay: true };
31
+ function getMounts(afs) {
32
+ const fn = afs.getMounts;
33
+ return typeof fn === "function" ? fn.call(afs) : [];
34
+ }
35
+ function hasMount(afs, path) {
36
+ return getMounts(afs).some((m) => m.path === path);
37
+ }
38
+ /** Mount a `ProjectionProvider` alias `target → source`, idempotent + tolerant. */
39
+ async function mountProjection(afs, target, source, name, out) {
40
+ if (hasMount(afs, target)) return;
41
+ try {
42
+ await afs.mount(new ProjectionProvider({
43
+ name,
44
+ globalAFS: afs,
45
+ sourcePath: source
46
+ }), target, PROJECTION_OVERLAY);
47
+ out.mounted.push(target);
48
+ } catch (err) {
49
+ out.warnings.push(`${target}: projection failed — ${redactError(err)}`);
50
+ }
51
+ }
52
+ const AI_DEVICE = "/dev/ai";
53
+ const AI_HUBS_AIGNEHUB = "/dev/ai/hubs/aignehub";
54
+ const AI_LOCAL_EMBEDDING = "/dev/ai/local/embedding";
55
+ const LEGACY_AIGNEHUB = "/modules/aignehub";
56
+ const LEGACY_EMBEDDING = "/modules/embedding";
57
+ const COMPAT_HUB = "/dev/ai/hub";
58
+ const COMPAT_DEFAULTS = "/dev/ai/defaults";
59
+ const COMPAT_EMBEDDING = "/dev/ai/embedding";
60
+ async function aiInstall(afs, _ctx, registry) {
61
+ const out = {
62
+ mounted: [],
63
+ warnings: []
64
+ };
65
+ if (!hasMount(afs, AI_HUBS_AIGNEHUB)) {
66
+ const legacy = hasMount(afs, LEGACY_AIGNEHUB) ? LEGACY_AIGNEHUB : hasMount(afs, COMPAT_HUB) ? COMPAT_HUB : null;
67
+ if (legacy) await mountProjection(afs, AI_HUBS_AIGNEHUB, legacy, "dev-ai-hubs-aignehub", out);
68
+ }
69
+ if (!hasMount(afs, AI_LOCAL_EMBEDDING) && hasMount(afs, LEGACY_EMBEDDING)) await mountProjection(afs, AI_LOCAL_EMBEDDING, LEGACY_EMBEDDING, "dev-ai-local-embedding", out);
70
+ if (hasMount(afs, AI_HUBS_AIGNEHUB)) {
71
+ await mountProjection(afs, COMPAT_HUB, AI_HUBS_AIGNEHUB, "dev-ai-hub-compat", out);
72
+ await mountProjection(afs, COMPAT_DEFAULTS, joinURL(AI_HUBS_AIGNEHUB, "defaults"), "dev-ai-defaults-compat", out);
73
+ }
74
+ if (hasMount(afs, AI_LOCAL_EMBEDDING)) await mountProjection(afs, COMPAT_EMBEDDING, AI_LOCAL_EMBEDDING, "dev-ai-embedding-compat", out);
75
+ if (!hasMount(afs, AI_DEVICE)) {
76
+ const factory = registry["ai-device"];
77
+ if (factory) try {
78
+ const options = { globalAFS: afs };
79
+ if (hasMount(afs, "/user")) options.userSpaceRoot = "/user";
80
+ const { provider } = await factory.create({
81
+ uri: `ai-device://system${AI_DEVICE}`,
82
+ type: "ai-device",
83
+ options
84
+ });
85
+ await afs.mount(provider, AI_DEVICE, PROJECTION_OVERLAY);
86
+ out.mounted.push(AI_DEVICE);
87
+ } catch (err) {
88
+ out.warnings.push(`${AI_DEVICE}: mount failed — ${redactError(err)}`);
89
+ }
90
+ }
91
+ return out;
92
+ }
93
+ async function chainInstall(afs, ctx, registry) {
94
+ const out = {
95
+ mounted: [],
96
+ warnings: []
97
+ };
98
+ const configs = ctx.chainConfigs;
99
+ const cfgs = [...configs && configs.length > 0 ? configs : BUILTIN_CHAIN_NETWORKS];
100
+ validateChainNetworks(cfgs);
101
+ const factory = registry["ocap"];
102
+ if (!factory) return out;
103
+ for (const cfg of cfgs) {
104
+ const path = chainNetworkToMountEntry(cfg).path;
105
+ if (hasMount(afs, path)) continue;
106
+ try {
107
+ await time(`mnt.dev.chain.${cfg.network}`, () => materializeProviderMount({
108
+ afs,
109
+ mountPath: path,
110
+ definition: {
111
+ uri: `ocap://system${path}`,
112
+ type: "ocap",
113
+ options: {
114
+ endpoint: cfg.endpoint,
115
+ description: `Chain network ${cfg.network} via ${safeEndpointLabel(cfg.endpoint)}`
116
+ }
117
+ },
118
+ factory,
119
+ projectors: [aupResourceProjector],
120
+ scope: "host",
121
+ mountOptions: PROJECTION_OVERLAY,
122
+ projectionFailure: "warn"
123
+ }));
124
+ out.mounted.push(path);
125
+ } catch (err) {
126
+ out.warnings.push(`${path}: mount failed — ${redactError(err)}`);
127
+ }
128
+ }
129
+ return out;
130
+ }
131
+ function safeEndpointLabel(endpoint) {
132
+ try {
133
+ const url = new URL(endpoint);
134
+ return `${url.protocol}//${url.host}`;
135
+ } catch {
136
+ return "<endpoint>";
137
+ }
138
+ }
139
+ async function deviceInstall(afs) {
140
+ const out = {
141
+ mounted: [],
142
+ warnings: []
143
+ };
144
+ for (const [target, source, name] of [[
145
+ "/dev/ui",
146
+ "/ui",
147
+ "dev-ui"
148
+ ], [
149
+ "/dev/web",
150
+ "/web",
151
+ "dev-web"
152
+ ]]) {
153
+ if (hasMount(afs, target)) continue;
154
+ if (!hasMount(afs, source)) continue;
155
+ await mountProjection(afs, target, source, name, out);
156
+ }
157
+ return out;
158
+ }
159
+ const OBS_PATH = "/dev/observability";
160
+ const OBS_HOST_INBOX = "/dev/observability/.host-inbox";
161
+ async function observabilityInstall(afs, _ctx, registry) {
162
+ const out = {
163
+ mounted: [],
164
+ warnings: []
165
+ };
166
+ if (hasMount(afs, OBS_PATH)) {
167
+ out.warnings.push(`${OBS_PATH}: already mounted — skipped`);
168
+ return out;
169
+ }
170
+ let hostInboxMounted = false;
171
+ const hostInboxFactory = registry["observability-host-inbox"];
172
+ if (hostInboxFactory) try {
173
+ const { provider } = await hostInboxFactory.create({
174
+ uri: `fs://system${OBS_HOST_INBOX}`,
175
+ type: "fs"
176
+ });
177
+ await afs.mount(provider, OBS_HOST_INBOX, { hidden: true });
178
+ hostInboxMounted = true;
179
+ out.mounted.push(OBS_HOST_INBOX);
180
+ } catch (err) {
181
+ out.warnings.push(`${OBS_HOST_INBOX}: mount failed — ${redactError(err)}`);
182
+ }
183
+ const factory = registry["observability"];
184
+ if (!factory) return out;
185
+ try {
186
+ await materializeProviderMount({
187
+ afs,
188
+ mountPath: OBS_PATH,
189
+ definition: {
190
+ uri: `observability://system${OBS_PATH}`,
191
+ type: "observability",
192
+ options: {
193
+ upstream: afs,
194
+ description: "AI agent observability — jsonl event log viewer",
195
+ ...hostInboxMounted ? { hostInboxPath: OBS_HOST_INBOX } : {}
196
+ }
197
+ },
198
+ factory,
199
+ projectors: [aupResourceProjector],
200
+ scope: "host",
201
+ mountOptions: PROJECTION_OVERLAY,
202
+ projectionFailure: "warn"
203
+ });
204
+ out.mounted.push(OBS_PATH);
205
+ } catch (err) {
206
+ out.warnings.push(`${OBS_PATH}: mount failed — ${redactError(err)}`);
207
+ }
208
+ return out;
209
+ }
210
+ const MSG_AGENTS = "/proc/messaging/agents";
211
+ const MSG_TOOLS = "/proc/messaging/tools";
212
+ async function messagingInstall(afs, _ctx, registry) {
213
+ const out = {
214
+ mounted: [],
215
+ warnings: []
216
+ };
217
+ const agentsFactory = registry["messaging-agents"];
218
+ if (agentsFactory && !hasMount(afs, MSG_AGENTS)) try {
219
+ const { provider } = await agentsFactory.create({
220
+ uri: `fs://system${MSG_AGENTS}`,
221
+ type: "fs"
222
+ });
223
+ await afs.mount(provider, MSG_AGENTS, PROJECTION_OVERLAY);
224
+ out.mounted.push(MSG_AGENTS);
225
+ } catch (err) {
226
+ out.warnings.push(`${MSG_AGENTS}: mount failed — ${redactError(err)}`);
227
+ }
228
+ const toolsFactory = registry["messaging-tools"];
229
+ if (toolsFactory && !hasMount(afs, MSG_TOOLS)) try {
230
+ const { provider } = await toolsFactory.create({
231
+ uri: `messaging-tools://system${MSG_TOOLS}`,
232
+ type: "messaging-tools"
233
+ });
234
+ await afs.mount(provider, MSG_TOOLS, PROJECTION_OVERLAY);
235
+ out.mounted.push(MSG_TOOLS);
236
+ } catch (err) {
237
+ out.warnings.push(`${MSG_TOOLS}: mount failed — ${redactError(err)}`);
238
+ }
239
+ return out;
240
+ }
241
+
242
+ //#endregion
243
+ export { aiInstall, chainInstall, deviceInstall, messagingInstall, observabilityInstall };
244
+ //# sourceMappingURL=installers.mjs.map