@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,3 @@
1
+ import { MaterializedMount, ProviderDefinition, ProviderFactory, ResourceContribution, ResourceProjector } from "./types.cjs";
2
+ import { MaterializeOptions, MaterializeOverlay, MaterializeResult, materializeProviderMount, redactError } from "./materializer.cjs";
3
+ export { type MaterializeOptions, type MaterializeOverlay, type MaterializeResult, type MaterializedMount, type ProviderDefinition, type ProviderFactory, type ResourceContribution, type ResourceProjector, materializeProviderMount, redactError };
@@ -0,0 +1,3 @@
1
+ import { MaterializedMount, ProviderDefinition, ProviderFactory, ResourceContribution, ResourceProjector } from "./types.mjs";
2
+ import { MaterializeOptions, MaterializeOverlay, MaterializeResult, materializeProviderMount, redactError } from "./materializer.mjs";
3
+ export { type MaterializeOptions, type MaterializeOverlay, type MaterializeResult, type MaterializedMount, type ProviderDefinition, type ProviderFactory, type ResourceContribution, type ResourceProjector, materializeProviderMount, redactError };
@@ -0,0 +1,3 @@
1
+ import { materializeProviderMount, redactError } from "./materializer.mjs";
2
+
3
+ export { materializeProviderMount, redactError };
@@ -0,0 +1,167 @@
1
+ let _aigne_afs = require("@aigne/afs");
2
+
3
+ //#region src/mount/materializer.ts
4
+ const log = (0, _aigne_afs.makeNsLog)("aos");
5
+ /**
6
+ * @internal
7
+ *
8
+ * Materialize a provider at `mountPath`:
9
+ * 1. ask the factory to build `{ provider, resources?, contributions? }`
10
+ * 2. mount the data provider
11
+ * 3. dispatch every projector against `resources` (projectors decide
12
+ * whether they have anything to project — AUP projector reads `/aup`)
13
+ * 4. dispatch overlays to projectors that match each overlay's `kind`
14
+ * 5. on any failure, unmount everything that was mounted in this call
15
+ *
16
+ * Contributions are validated (size cap) and recorded as warnings — they
17
+ * are NOT projected in the first stage. See planning doc Phase 6.
18
+ */
19
+ async function materializeProviderMount(options) {
20
+ validateMountPath(options.mountPath);
21
+ validateProviderDefinition(options.definition);
22
+ validateProjectionFailure(options.projectionFailure);
23
+ const projectionFailure = options.projectionFailure ?? "rollback";
24
+ const materialized = await options.factory.create(options.definition);
25
+ if (!materialized?.provider) throw new _aigne_afs.AFSValidationError(`Provider factory returned no provider for ${options.definition.uri}`);
26
+ if (options.wrapProvider) materialized.provider = options.wrapProvider(materialized.provider);
27
+ if (options.mountOptions?.replace) cascadeUnmountUnder(options.afs, options.mountPath);
28
+ const baseline = snapshotMountPaths(options.afs);
29
+ let dataMounted = false;
30
+ try {
31
+ await options.afs.mount(materialized.provider, options.mountPath, options.mountOptions);
32
+ dataMounted = true;
33
+ if (materialized.resources) for (const projector of options.projectors) {
34
+ const beforeProjection = snapshotMountPaths(options.afs);
35
+ try {
36
+ await projector.project({
37
+ afs: options.afs,
38
+ mountPath: options.mountPath,
39
+ resources: materialized.resources,
40
+ scope: options.scope
41
+ });
42
+ } catch (err) {
43
+ if (projectionFailure === "warn") {
44
+ rollbackSupplementsSince(options.afs, beforeProjection, options.mountPath);
45
+ log.warn(`[aos/mount] resources projection failed for ${options.mountPath} (projector=${projector.kind}): ${redactError(err)}`);
46
+ continue;
47
+ }
48
+ throw err;
49
+ }
50
+ }
51
+ for (const overlay of options.overlays ?? []) for (const projector of options.projectors) {
52
+ if (projector.kind !== overlay.kind) continue;
53
+ const beforeOverlayProjection = snapshotMountPaths(options.afs);
54
+ try {
55
+ await projector.project({
56
+ afs: options.afs,
57
+ mountPath: options.mountPath,
58
+ resources: overlay.resources,
59
+ scope: options.scope
60
+ });
61
+ } catch (err) {
62
+ if (projectionFailure === "warn") {
63
+ rollbackSupplementsSince(options.afs, beforeOverlayProjection, options.mountPath);
64
+ log.warn(`[aos/mount] overlay projection failed for ${options.mountPath} (projector=${projector.kind}, overlay=${overlay.kind}): ${redactError(err)}`);
65
+ continue;
66
+ }
67
+ throw err;
68
+ }
69
+ }
70
+ warnUnsupportedContributions(materialized.contributions, options.mountPath);
71
+ return {
72
+ provider: materialized.provider,
73
+ mountedResourceMounts: supplementsSince(options.afs, baseline, options.mountPath)
74
+ };
75
+ } catch (error) {
76
+ rollback(options.afs, baseline, dataMounted ? options.mountPath : null);
77
+ throw error;
78
+ }
79
+ }
80
+ function validateMountPath(mountPath) {
81
+ if (typeof mountPath !== "string" || mountPath.length === 0) throw new _aigne_afs.AFSValidationError("mountPath must be a non-empty string");
82
+ if (mountPath === "/") throw new _aigne_afs.AFSValidationError("mountPath cannot be '/' — root is reserved");
83
+ if (!mountPath.startsWith("/")) throw new _aigne_afs.AFSValidationError(`mountPath must start with '/' (got '${mountPath}')`);
84
+ if (mountPath.split("/").some((segment) => segment === "..")) throw new _aigne_afs.AFSValidationError(`mountPath cannot contain '..' segments (got '${mountPath}')`);
85
+ }
86
+ function validateProviderDefinition(definition) {
87
+ if (!definition || typeof definition !== "object") throw new _aigne_afs.AFSValidationError("definition must be an object");
88
+ if (typeof definition.uri !== "string" || definition.uri.length === 0) throw new _aigne_afs.AFSValidationError("definition.uri must be a non-empty string");
89
+ if (typeof definition.type !== "string" || definition.type.length === 0) throw new _aigne_afs.AFSValidationError("definition.type must be a non-empty string");
90
+ }
91
+ function validateProjectionFailure(value) {
92
+ if (value === void 0 || value === "rollback" || value === "warn") return;
93
+ throw new _aigne_afs.AFSValidationError(`projectionFailure must be "rollback" or "warn" (got ${JSON.stringify(value)})`);
94
+ }
95
+ function snapshotMountPaths(afs) {
96
+ const paths = /* @__PURE__ */ new Set();
97
+ for (const mount of afs.getMounts(null)) paths.add(mount.path);
98
+ return paths;
99
+ }
100
+ function supplementsSince(afs, baseline, dataPath) {
101
+ const added = [];
102
+ for (const mount of afs.getMounts(null)) if (!baseline.has(mount.path) && mount.path !== dataPath) added.push(mount.path);
103
+ return added;
104
+ }
105
+ function rollback(afs, baseline, dataPath) {
106
+ const supplements = supplementsSince(afs, baseline, dataPath);
107
+ supplements.sort((a, b) => b.length - a.length);
108
+ for (const path of supplements) safeUnmount(afs, path);
109
+ if (dataPath) safeUnmount(afs, dataPath);
110
+ }
111
+ /**
112
+ * Roll back only the supplements created since `baseline` (i.e. by the
113
+ * single failing projector). Used by `projectionFailure: "warn"` so the
114
+ * data mount and previously-succeeded projector outputs survive.
115
+ */
116
+ function rollbackSupplementsSince(afs, baseline, dataPath) {
117
+ const supplements = supplementsSince(afs, baseline, dataPath);
118
+ supplements.sort((a, b) => b.length - a.length);
119
+ for (const path of supplements) safeUnmount(afs, path);
120
+ }
121
+ /**
122
+ * Produce a short, redacted error description suitable for log lines.
123
+ * Truncates message to ~200 chars and drops stack/url so token-bearing
124
+ * URLs and full SDK stack frames cannot leak into shared logs.
125
+ */
126
+ function redactError(err) {
127
+ if (err instanceof Error) {
128
+ const msg = err.message ?? "";
129
+ const truncated = msg.length > 200 ? `${msg.slice(0, 200)}…` : msg;
130
+ return `${err.name}: ${truncated}`;
131
+ }
132
+ const s = typeof err === "string" ? err : JSON.stringify(err);
133
+ return s.length > 200 ? `${s.slice(0, 200)}…` : s;
134
+ }
135
+ /**
136
+ * Cascade-unmount every mount at or under `parentPath`. Used when a
137
+ * caller passes `mountOptions.replace: true` — without this, supplement
138
+ * mounts projected by a previous materialize call survive the exact-path
139
+ * replace inside `afs.mount` and the new mount trips the AFS parent-child
140
+ * conflict guard.
141
+ *
142
+ * Order matters: longest paths first so children unmount before parents,
143
+ * keeping each individual `afs.unmount` call within an internally
144
+ * consistent mount tree.
145
+ */
146
+ function cascadeUnmountUnder(afs, parentPath) {
147
+ const prefix = parentPath.endsWith("/") ? parentPath : `${parentPath}/`;
148
+ const descendants = [];
149
+ for (const mount of afs.getMounts(null)) if (mount.path === parentPath || mount.path.startsWith(prefix)) descendants.push(mount.path);
150
+ descendants.sort((a, b) => b.length - a.length);
151
+ for (const path of descendants) safeUnmount(afs, path);
152
+ }
153
+ function safeUnmount(afs, path) {
154
+ try {
155
+ afs.unmount(path);
156
+ } catch (error) {
157
+ log.warn(`[aos/mount] rollback unmount failed for ${path}:`, error);
158
+ }
159
+ }
160
+ function warnUnsupportedContributions(contributions, mountPath) {
161
+ if (!contributions?.length) return;
162
+ log.warn(`[aos/mount] ignoring ${contributions.length} contribution(s) declared by provider at ${mountPath} — first-stage materializer does not project contributions; see planning/afs-ui/aup-mount-materialization Phase 6`);
163
+ }
164
+
165
+ //#endregion
166
+ exports.materializeProviderMount = materializeProviderMount;
167
+ exports.redactError = redactError;
@@ -0,0 +1,97 @@
1
+ import { ProviderDefinition, ProviderFactory, ResourceProjector } from "./types.cjs";
2
+ import { AFS, AFSModule, MountOptions } from "@aigne/afs";
3
+
4
+ //#region src/mount/materializer.d.ts
5
+ /**
6
+ * @internal
7
+ * An overlay is an out-of-band resource bundle (typically blocklet-local)
8
+ * that the materializer dispatches to projectors with the matching `kind`.
9
+ */
10
+ interface MaterializeOverlay {
11
+ kind: string;
12
+ resources: AFSModule;
13
+ }
14
+ /**
15
+ * @internal
16
+ * Inputs to {@link materializeProviderMount}.
17
+ */
18
+ interface MaterializeOptions {
19
+ afs: AFS;
20
+ mountPath: string;
21
+ definition: ProviderDefinition;
22
+ factory: ProviderFactory;
23
+ projectors: ResourceProjector[];
24
+ overlays?: MaterializeOverlay[];
25
+ scope: "host" | "blocklet" | "instance";
26
+ /**
27
+ * Forwarded to `afs.mount()` for the data provider only.
28
+ *
29
+ * Phase 3 entry-point migrations pass through `replace`, `allowOverlay`,
30
+ * and `namespace` so the materializer is a drop-in replacement for the
31
+ * direct `afs.mount(...)` calls those entries use today.
32
+ *
33
+ * Supplement mounts (.aup/...) are managed by the projectors and never
34
+ * inherit these options — supplements are always hidden, namespace-less,
35
+ * non-overlapping mounts.
36
+ */
37
+ mountOptions?: MountOptions;
38
+ /**
39
+ * Optional post-factory provider transform. When supplied, the
40
+ * materializer applies it to the provider returned by
41
+ * `factory.create(definition)` before mounting. Used by callers that
42
+ * need to wrap the provider with cross-cutting concerns the factory
43
+ * itself can't observe — most notably the global-config mount loop's
44
+ * `maybeWrapWithCache` (provider manifest's cache declaration vs. the
45
+ * mount config's cache override).
46
+ *
47
+ * Returning the same provider unchanged is fine; returning a wrapping
48
+ * provider is fine; returning a completely different provider is
49
+ * fine — the materializer treats this hook as opaque.
50
+ */
51
+ wrapProvider?: (provider: AFSModule) => AFSModule;
52
+ /**
53
+ * Strategy when a projector throws:
54
+ * - "rollback" (default): unmount data + any partial supplements, rethrow.
55
+ * Owned-mount semantics — appropriate for blocklets where the mount is
56
+ * atomic with its supplements.
57
+ * - "warn": keep data mount + previously-succeeded projector supplements;
58
+ * roll back only the failing projector's partial supplements; log a
59
+ * warning; continue to the next projector. Host-scope semantics — data
60
+ * is independently usable without supplements.
61
+ */
62
+ projectionFailure?: "rollback" | "warn";
63
+ }
64
+ /**
65
+ * @internal
66
+ * Result of {@link materializeProviderMount}. Includes the mounted
67
+ * provider plus any supplement paths added by projectors so callers can
68
+ * unmount them later (e.g., during reload).
69
+ */
70
+ interface MaterializeResult {
71
+ provider: AFSModule;
72
+ mountedResourceMounts: string[];
73
+ }
74
+ /**
75
+ * @internal
76
+ *
77
+ * Materialize a provider at `mountPath`:
78
+ * 1. ask the factory to build `{ provider, resources?, contributions? }`
79
+ * 2. mount the data provider
80
+ * 3. dispatch every projector against `resources` (projectors decide
81
+ * whether they have anything to project — AUP projector reads `/aup`)
82
+ * 4. dispatch overlays to projectors that match each overlay's `kind`
83
+ * 5. on any failure, unmount everything that was mounted in this call
84
+ *
85
+ * Contributions are validated (size cap) and recorded as warnings — they
86
+ * are NOT projected in the first stage. See planning doc Phase 6.
87
+ */
88
+ declare function materializeProviderMount(options: MaterializeOptions): Promise<MaterializeResult>;
89
+ /**
90
+ * Produce a short, redacted error description suitable for log lines.
91
+ * Truncates message to ~200 chars and drops stack/url so token-bearing
92
+ * URLs and full SDK stack frames cannot leak into shared logs.
93
+ */
94
+ declare function redactError(err: unknown): string;
95
+ //#endregion
96
+ export { MaterializeOptions, MaterializeOverlay, MaterializeResult, materializeProviderMount, redactError };
97
+ //# sourceMappingURL=materializer.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materializer.d.cts","names":[],"sources":["../../src/mount/materializer.ts"],"mappings":";;;;AAqCA;;;;;AAAA,UATiB,kBAAA;EACf,IAAA;EACA,SAAA,EAAW,SAAA;AAAA;;;;;UAOI,kBAAA;EACf,GAAA,EAAK,GAAA;EACL,SAAA;EACA,UAAA,EAAY,kBAAA;EACZ,OAAA,EAAS,eAAA;EACT,UAAA,EAAY,iBAAA;EACZ,QAAA,GAAW,kBAAA;EACX,KAAA;EAFY;;;;;;;;;;;EAcZ,YAAA,GAAe,YAAA;EAyBE;AASnB;;;;;;;;;AAmBA;;;EAvCE,YAAA,IAAgB,QAAA,EAAU,SAAA,KAAc,SAAA;EAyC/B;;;;;;;;;;EA9BT,iBAAA;AAAA;;;;;;;UASe,iBAAA;EACf,QAAA,EAAU,SAAA;EACV,qBAAA;AAAA;;;;;;;;;;;;;;;iBAiBoB,wBAAA,CACpB,OAAA,EAAS,kBAAA,GACR,OAAA,CAAQ,iBAAA;;;;;;iBAkLK,WAAA,CAAY,GAAA"}
@@ -0,0 +1,97 @@
1
+ import { ProviderDefinition, ProviderFactory, ResourceProjector } from "./types.mjs";
2
+ import { AFS, AFSModule, MountOptions } from "@aigne/afs";
3
+
4
+ //#region src/mount/materializer.d.ts
5
+ /**
6
+ * @internal
7
+ * An overlay is an out-of-band resource bundle (typically blocklet-local)
8
+ * that the materializer dispatches to projectors with the matching `kind`.
9
+ */
10
+ interface MaterializeOverlay {
11
+ kind: string;
12
+ resources: AFSModule;
13
+ }
14
+ /**
15
+ * @internal
16
+ * Inputs to {@link materializeProviderMount}.
17
+ */
18
+ interface MaterializeOptions {
19
+ afs: AFS;
20
+ mountPath: string;
21
+ definition: ProviderDefinition;
22
+ factory: ProviderFactory;
23
+ projectors: ResourceProjector[];
24
+ overlays?: MaterializeOverlay[];
25
+ scope: "host" | "blocklet" | "instance";
26
+ /**
27
+ * Forwarded to `afs.mount()` for the data provider only.
28
+ *
29
+ * Phase 3 entry-point migrations pass through `replace`, `allowOverlay`,
30
+ * and `namespace` so the materializer is a drop-in replacement for the
31
+ * direct `afs.mount(...)` calls those entries use today.
32
+ *
33
+ * Supplement mounts (.aup/...) are managed by the projectors and never
34
+ * inherit these options — supplements are always hidden, namespace-less,
35
+ * non-overlapping mounts.
36
+ */
37
+ mountOptions?: MountOptions;
38
+ /**
39
+ * Optional post-factory provider transform. When supplied, the
40
+ * materializer applies it to the provider returned by
41
+ * `factory.create(definition)` before mounting. Used by callers that
42
+ * need to wrap the provider with cross-cutting concerns the factory
43
+ * itself can't observe — most notably the global-config mount loop's
44
+ * `maybeWrapWithCache` (provider manifest's cache declaration vs. the
45
+ * mount config's cache override).
46
+ *
47
+ * Returning the same provider unchanged is fine; returning a wrapping
48
+ * provider is fine; returning a completely different provider is
49
+ * fine — the materializer treats this hook as opaque.
50
+ */
51
+ wrapProvider?: (provider: AFSModule) => AFSModule;
52
+ /**
53
+ * Strategy when a projector throws:
54
+ * - "rollback" (default): unmount data + any partial supplements, rethrow.
55
+ * Owned-mount semantics — appropriate for blocklets where the mount is
56
+ * atomic with its supplements.
57
+ * - "warn": keep data mount + previously-succeeded projector supplements;
58
+ * roll back only the failing projector's partial supplements; log a
59
+ * warning; continue to the next projector. Host-scope semantics — data
60
+ * is independently usable without supplements.
61
+ */
62
+ projectionFailure?: "rollback" | "warn";
63
+ }
64
+ /**
65
+ * @internal
66
+ * Result of {@link materializeProviderMount}. Includes the mounted
67
+ * provider plus any supplement paths added by projectors so callers can
68
+ * unmount them later (e.g., during reload).
69
+ */
70
+ interface MaterializeResult {
71
+ provider: AFSModule;
72
+ mountedResourceMounts: string[];
73
+ }
74
+ /**
75
+ * @internal
76
+ *
77
+ * Materialize a provider at `mountPath`:
78
+ * 1. ask the factory to build `{ provider, resources?, contributions? }`
79
+ * 2. mount the data provider
80
+ * 3. dispatch every projector against `resources` (projectors decide
81
+ * whether they have anything to project — AUP projector reads `/aup`)
82
+ * 4. dispatch overlays to projectors that match each overlay's `kind`
83
+ * 5. on any failure, unmount everything that was mounted in this call
84
+ *
85
+ * Contributions are validated (size cap) and recorded as warnings — they
86
+ * are NOT projected in the first stage. See planning doc Phase 6.
87
+ */
88
+ declare function materializeProviderMount(options: MaterializeOptions): Promise<MaterializeResult>;
89
+ /**
90
+ * Produce a short, redacted error description suitable for log lines.
91
+ * Truncates message to ~200 chars and drops stack/url so token-bearing
92
+ * URLs and full SDK stack frames cannot leak into shared logs.
93
+ */
94
+ declare function redactError(err: unknown): string;
95
+ //#endregion
96
+ export { MaterializeOptions, MaterializeOverlay, MaterializeResult, materializeProviderMount, redactError };
97
+ //# sourceMappingURL=materializer.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materializer.d.mts","names":[],"sources":["../../src/mount/materializer.ts"],"mappings":";;;;AAqCA;;;;;AAAA,UATiB,kBAAA;EACf,IAAA;EACA,SAAA,EAAW,SAAA;AAAA;;;;;UAOI,kBAAA;EACf,GAAA,EAAK,GAAA;EACL,SAAA;EACA,UAAA,EAAY,kBAAA;EACZ,OAAA,EAAS,eAAA;EACT,UAAA,EAAY,iBAAA;EACZ,QAAA,GAAW,kBAAA;EACX,KAAA;EAFY;;;;;;;;;;;EAcZ,YAAA,GAAe,YAAA;EAyBE;AASnB;;;;;;;;;AAmBA;;;EAvCE,YAAA,IAAgB,QAAA,EAAU,SAAA,KAAc,SAAA;EAyC/B;;;;;;;;;;EA9BT,iBAAA;AAAA;;;;;;;UASe,iBAAA;EACf,QAAA,EAAU,SAAA;EACV,qBAAA;AAAA;;;;;;;;;;;;;;;iBAiBoB,wBAAA,CACpB,OAAA,EAAS,kBAAA,GACR,OAAA,CAAQ,iBAAA;;;;;;iBAkLK,WAAA,CAAY,GAAA"}
@@ -0,0 +1,167 @@
1
+ import { AFSValidationError, makeNsLog } from "@aigne/afs";
2
+
3
+ //#region src/mount/materializer.ts
4
+ const log = makeNsLog("aos");
5
+ /**
6
+ * @internal
7
+ *
8
+ * Materialize a provider at `mountPath`:
9
+ * 1. ask the factory to build `{ provider, resources?, contributions? }`
10
+ * 2. mount the data provider
11
+ * 3. dispatch every projector against `resources` (projectors decide
12
+ * whether they have anything to project — AUP projector reads `/aup`)
13
+ * 4. dispatch overlays to projectors that match each overlay's `kind`
14
+ * 5. on any failure, unmount everything that was mounted in this call
15
+ *
16
+ * Contributions are validated (size cap) and recorded as warnings — they
17
+ * are NOT projected in the first stage. See planning doc Phase 6.
18
+ */
19
+ async function materializeProviderMount(options) {
20
+ validateMountPath(options.mountPath);
21
+ validateProviderDefinition(options.definition);
22
+ validateProjectionFailure(options.projectionFailure);
23
+ const projectionFailure = options.projectionFailure ?? "rollback";
24
+ const materialized = await options.factory.create(options.definition);
25
+ if (!materialized?.provider) throw new AFSValidationError(`Provider factory returned no provider for ${options.definition.uri}`);
26
+ if (options.wrapProvider) materialized.provider = options.wrapProvider(materialized.provider);
27
+ if (options.mountOptions?.replace) cascadeUnmountUnder(options.afs, options.mountPath);
28
+ const baseline = snapshotMountPaths(options.afs);
29
+ let dataMounted = false;
30
+ try {
31
+ await options.afs.mount(materialized.provider, options.mountPath, options.mountOptions);
32
+ dataMounted = true;
33
+ if (materialized.resources) for (const projector of options.projectors) {
34
+ const beforeProjection = snapshotMountPaths(options.afs);
35
+ try {
36
+ await projector.project({
37
+ afs: options.afs,
38
+ mountPath: options.mountPath,
39
+ resources: materialized.resources,
40
+ scope: options.scope
41
+ });
42
+ } catch (err) {
43
+ if (projectionFailure === "warn") {
44
+ rollbackSupplementsSince(options.afs, beforeProjection, options.mountPath);
45
+ log.warn(`[aos/mount] resources projection failed for ${options.mountPath} (projector=${projector.kind}): ${redactError(err)}`);
46
+ continue;
47
+ }
48
+ throw err;
49
+ }
50
+ }
51
+ for (const overlay of options.overlays ?? []) for (const projector of options.projectors) {
52
+ if (projector.kind !== overlay.kind) continue;
53
+ const beforeOverlayProjection = snapshotMountPaths(options.afs);
54
+ try {
55
+ await projector.project({
56
+ afs: options.afs,
57
+ mountPath: options.mountPath,
58
+ resources: overlay.resources,
59
+ scope: options.scope
60
+ });
61
+ } catch (err) {
62
+ if (projectionFailure === "warn") {
63
+ rollbackSupplementsSince(options.afs, beforeOverlayProjection, options.mountPath);
64
+ log.warn(`[aos/mount] overlay projection failed for ${options.mountPath} (projector=${projector.kind}, overlay=${overlay.kind}): ${redactError(err)}`);
65
+ continue;
66
+ }
67
+ throw err;
68
+ }
69
+ }
70
+ warnUnsupportedContributions(materialized.contributions, options.mountPath);
71
+ return {
72
+ provider: materialized.provider,
73
+ mountedResourceMounts: supplementsSince(options.afs, baseline, options.mountPath)
74
+ };
75
+ } catch (error) {
76
+ rollback(options.afs, baseline, dataMounted ? options.mountPath : null);
77
+ throw error;
78
+ }
79
+ }
80
+ function validateMountPath(mountPath) {
81
+ if (typeof mountPath !== "string" || mountPath.length === 0) throw new AFSValidationError("mountPath must be a non-empty string");
82
+ if (mountPath === "/") throw new AFSValidationError("mountPath cannot be '/' — root is reserved");
83
+ if (!mountPath.startsWith("/")) throw new AFSValidationError(`mountPath must start with '/' (got '${mountPath}')`);
84
+ if (mountPath.split("/").some((segment) => segment === "..")) throw new AFSValidationError(`mountPath cannot contain '..' segments (got '${mountPath}')`);
85
+ }
86
+ function validateProviderDefinition(definition) {
87
+ if (!definition || typeof definition !== "object") throw new AFSValidationError("definition must be an object");
88
+ if (typeof definition.uri !== "string" || definition.uri.length === 0) throw new AFSValidationError("definition.uri must be a non-empty string");
89
+ if (typeof definition.type !== "string" || definition.type.length === 0) throw new AFSValidationError("definition.type must be a non-empty string");
90
+ }
91
+ function validateProjectionFailure(value) {
92
+ if (value === void 0 || value === "rollback" || value === "warn") return;
93
+ throw new AFSValidationError(`projectionFailure must be "rollback" or "warn" (got ${JSON.stringify(value)})`);
94
+ }
95
+ function snapshotMountPaths(afs) {
96
+ const paths = /* @__PURE__ */ new Set();
97
+ for (const mount of afs.getMounts(null)) paths.add(mount.path);
98
+ return paths;
99
+ }
100
+ function supplementsSince(afs, baseline, dataPath) {
101
+ const added = [];
102
+ for (const mount of afs.getMounts(null)) if (!baseline.has(mount.path) && mount.path !== dataPath) added.push(mount.path);
103
+ return added;
104
+ }
105
+ function rollback(afs, baseline, dataPath) {
106
+ const supplements = supplementsSince(afs, baseline, dataPath);
107
+ supplements.sort((a, b) => b.length - a.length);
108
+ for (const path of supplements) safeUnmount(afs, path);
109
+ if (dataPath) safeUnmount(afs, dataPath);
110
+ }
111
+ /**
112
+ * Roll back only the supplements created since `baseline` (i.e. by the
113
+ * single failing projector). Used by `projectionFailure: "warn"` so the
114
+ * data mount and previously-succeeded projector outputs survive.
115
+ */
116
+ function rollbackSupplementsSince(afs, baseline, dataPath) {
117
+ const supplements = supplementsSince(afs, baseline, dataPath);
118
+ supplements.sort((a, b) => b.length - a.length);
119
+ for (const path of supplements) safeUnmount(afs, path);
120
+ }
121
+ /**
122
+ * Produce a short, redacted error description suitable for log lines.
123
+ * Truncates message to ~200 chars and drops stack/url so token-bearing
124
+ * URLs and full SDK stack frames cannot leak into shared logs.
125
+ */
126
+ function redactError(err) {
127
+ if (err instanceof Error) {
128
+ const msg = err.message ?? "";
129
+ const truncated = msg.length > 200 ? `${msg.slice(0, 200)}…` : msg;
130
+ return `${err.name}: ${truncated}`;
131
+ }
132
+ const s = typeof err === "string" ? err : JSON.stringify(err);
133
+ return s.length > 200 ? `${s.slice(0, 200)}…` : s;
134
+ }
135
+ /**
136
+ * Cascade-unmount every mount at or under `parentPath`. Used when a
137
+ * caller passes `mountOptions.replace: true` — without this, supplement
138
+ * mounts projected by a previous materialize call survive the exact-path
139
+ * replace inside `afs.mount` and the new mount trips the AFS parent-child
140
+ * conflict guard.
141
+ *
142
+ * Order matters: longest paths first so children unmount before parents,
143
+ * keeping each individual `afs.unmount` call within an internally
144
+ * consistent mount tree.
145
+ */
146
+ function cascadeUnmountUnder(afs, parentPath) {
147
+ const prefix = parentPath.endsWith("/") ? parentPath : `${parentPath}/`;
148
+ const descendants = [];
149
+ for (const mount of afs.getMounts(null)) if (mount.path === parentPath || mount.path.startsWith(prefix)) descendants.push(mount.path);
150
+ descendants.sort((a, b) => b.length - a.length);
151
+ for (const path of descendants) safeUnmount(afs, path);
152
+ }
153
+ function safeUnmount(afs, path) {
154
+ try {
155
+ afs.unmount(path);
156
+ } catch (error) {
157
+ log.warn(`[aos/mount] rollback unmount failed for ${path}:`, error);
158
+ }
159
+ }
160
+ function warnUnsupportedContributions(contributions, mountPath) {
161
+ if (!contributions?.length) return;
162
+ log.warn(`[aos/mount] ignoring ${contributions.length} contribution(s) declared by provider at ${mountPath} — first-stage materializer does not project contributions; see planning/afs-ui/aup-mount-materialization Phase 6`);
163
+ }
164
+
165
+ //#endregion
166
+ export { materializeProviderMount, redactError };
167
+ //# sourceMappingURL=materializer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materializer.mjs","names":[],"sources":["../../src/mount/materializer.ts"],"sourcesContent":["/**\n * @internal\n *\n * Mount materialization entry point. Wires the data provider, owned\n * resources, and overlays through one consistent lifecycle so every\n * runtime entry that creates a provider mount produces the same\n * observable AFS shape.\n *\n * Subpath-only export: `@aigne/aos/mount`. Not part of the @aigne/aos\n * root contract.\n */\n\nimport type { AFS, AFSModule, MountOptions } from \"@aigne/afs\";\nimport { AFSValidationError, makeNsLog } from \"@aigne/afs\";\nimport type {\n ProviderDefinition,\n ProviderFactory,\n ResourceContribution,\n ResourceProjector,\n} from \"./types.js\";\n\nconst log = makeNsLog(\"aos\");\n\n/**\n * @internal\n * An overlay is an out-of-band resource bundle (typically blocklet-local)\n * that the materializer dispatches to projectors with the matching `kind`.\n */\nexport interface MaterializeOverlay {\n kind: string;\n resources: AFSModule;\n}\n\n/**\n * @internal\n * Inputs to {@link materializeProviderMount}.\n */\nexport interface MaterializeOptions {\n afs: AFS;\n mountPath: string;\n definition: ProviderDefinition;\n factory: ProviderFactory;\n projectors: ResourceProjector[];\n overlays?: MaterializeOverlay[];\n scope: \"host\" | \"blocklet\" | \"instance\";\n /**\n * Forwarded to `afs.mount()` for the data provider only.\n *\n * Phase 3 entry-point migrations pass through `replace`, `allowOverlay`,\n * and `namespace` so the materializer is a drop-in replacement for the\n * direct `afs.mount(...)` calls those entries use today.\n *\n * Supplement mounts (.aup/...) are managed by the projectors and never\n * inherit these options — supplements are always hidden, namespace-less,\n * non-overlapping mounts.\n */\n mountOptions?: MountOptions;\n /**\n * Optional post-factory provider transform. When supplied, the\n * materializer applies it to the provider returned by\n * `factory.create(definition)` before mounting. Used by callers that\n * need to wrap the provider with cross-cutting concerns the factory\n * itself can't observe — most notably the global-config mount loop's\n * `maybeWrapWithCache` (provider manifest's cache declaration vs. the\n * mount config's cache override).\n *\n * Returning the same provider unchanged is fine; returning a wrapping\n * provider is fine; returning a completely different provider is\n * fine — the materializer treats this hook as opaque.\n */\n wrapProvider?: (provider: AFSModule) => AFSModule;\n /**\n * Strategy when a projector throws:\n * - \"rollback\" (default): unmount data + any partial supplements, rethrow.\n * Owned-mount semantics — appropriate for blocklets where the mount is\n * atomic with its supplements.\n * - \"warn\": keep data mount + previously-succeeded projector supplements;\n * roll back only the failing projector's partial supplements; log a\n * warning; continue to the next projector. Host-scope semantics — data\n * is independently usable without supplements.\n */\n projectionFailure?: \"rollback\" | \"warn\";\n}\n\n/**\n * @internal\n * Result of {@link materializeProviderMount}. Includes the mounted\n * provider plus any supplement paths added by projectors so callers can\n * unmount them later (e.g., during reload).\n */\nexport interface MaterializeResult {\n provider: AFSModule;\n mountedResourceMounts: string[];\n}\n\n/**\n * @internal\n *\n * Materialize a provider at `mountPath`:\n * 1. ask the factory to build `{ provider, resources?, contributions? }`\n * 2. mount the data provider\n * 3. dispatch every projector against `resources` (projectors decide\n * whether they have anything to project — AUP projector reads `/aup`)\n * 4. dispatch overlays to projectors that match each overlay's `kind`\n * 5. on any failure, unmount everything that was mounted in this call\n *\n * Contributions are validated (size cap) and recorded as warnings — they\n * are NOT projected in the first stage. See planning doc Phase 6.\n */\nexport async function materializeProviderMount(\n options: MaterializeOptions,\n): Promise<MaterializeResult> {\n validateMountPath(options.mountPath);\n validateProviderDefinition(options.definition);\n validateProjectionFailure(options.projectionFailure);\n\n const projectionFailure = options.projectionFailure ?? \"rollback\";\n\n const materialized = await options.factory.create(options.definition);\n\n if (!materialized?.provider) {\n throw new AFSValidationError(\n `Provider factory returned no provider for ${options.definition.uri}`,\n );\n }\n\n // Apply the optional post-factory transform (e.g. cache wrapping). Mutate\n // the materialized result in place so the rest of the flow — including\n // rollback and the returned `provider` reference — sees the wrapped\n // provider as the single source of truth.\n if (options.wrapProvider) {\n materialized.provider = options.wrapProvider(materialized.provider);\n }\n\n // When the caller asks for `replace: true`, pre-cascade-unmount any\n // existing mounts under this path so the new mount doesn't trip the\n // AFS parent-child conflict guard. Without this, a re-materialize on\n // the same path with replace=true would fail because supplement mounts\n // (e.g. `/chain/.aup/default`) projected by the previous call survive\n // afs.mount's exact-path replace and look like child mounts to the\n // conflict checker.\n if (options.mountOptions?.replace) {\n cascadeUnmountUnder(options.afs, options.mountPath);\n }\n\n const baseline = snapshotMountPaths(options.afs);\n let dataMounted = false;\n\n try {\n await options.afs.mount(materialized.provider, options.mountPath, options.mountOptions);\n dataMounted = true;\n\n if (materialized.resources) {\n for (const projector of options.projectors) {\n const beforeProjection = snapshotMountPaths(options.afs);\n try {\n await projector.project({\n afs: options.afs,\n mountPath: options.mountPath,\n resources: materialized.resources,\n scope: options.scope,\n });\n } catch (err) {\n if (projectionFailure === \"warn\") {\n rollbackSupplementsSince(options.afs, beforeProjection, options.mountPath);\n log.warn(\n `[aos/mount] resources projection failed for ${options.mountPath} ` +\n `(projector=${projector.kind}): ${redactError(err)}`,\n );\n continue;\n }\n throw err;\n }\n }\n }\n\n for (const overlay of options.overlays ?? []) {\n for (const projector of options.projectors) {\n if (projector.kind !== overlay.kind) continue;\n const beforeOverlayProjection = snapshotMountPaths(options.afs);\n try {\n await projector.project({\n afs: options.afs,\n mountPath: options.mountPath,\n resources: overlay.resources,\n scope: options.scope,\n });\n } catch (err) {\n if (projectionFailure === \"warn\") {\n rollbackSupplementsSince(options.afs, beforeOverlayProjection, options.mountPath);\n log.warn(\n `[aos/mount] overlay projection failed for ${options.mountPath} ` +\n `(projector=${projector.kind}, overlay=${overlay.kind}): ${redactError(err)}`,\n );\n continue;\n }\n throw err;\n }\n }\n }\n\n warnUnsupportedContributions(materialized.contributions, options.mountPath);\n\n return {\n provider: materialized.provider,\n mountedResourceMounts: supplementsSince(options.afs, baseline, options.mountPath),\n };\n } catch (error) {\n rollback(options.afs, baseline, dataMounted ? options.mountPath : null);\n throw error;\n }\n}\n\nfunction validateMountPath(mountPath: string): void {\n if (typeof mountPath !== \"string\" || mountPath.length === 0) {\n throw new AFSValidationError(\"mountPath must be a non-empty string\");\n }\n if (mountPath === \"/\") {\n throw new AFSValidationError(\"mountPath cannot be '/' — root is reserved\");\n }\n if (!mountPath.startsWith(\"/\")) {\n throw new AFSValidationError(`mountPath must start with '/' (got '${mountPath}')`);\n }\n if (mountPath.split(\"/\").some((segment) => segment === \"..\")) {\n throw new AFSValidationError(`mountPath cannot contain '..' segments (got '${mountPath}')`);\n }\n}\n\nfunction validateProviderDefinition(definition: ProviderDefinition): void {\n if (!definition || typeof definition !== \"object\") {\n throw new AFSValidationError(\"definition must be an object\");\n }\n if (typeof definition.uri !== \"string\" || definition.uri.length === 0) {\n throw new AFSValidationError(\"definition.uri must be a non-empty string\");\n }\n if (typeof definition.type !== \"string\" || definition.type.length === 0) {\n throw new AFSValidationError(\"definition.type must be a non-empty string\");\n }\n}\n\nfunction validateProjectionFailure(value: unknown): void {\n if (value === undefined || value === \"rollback\" || value === \"warn\") return;\n throw new AFSValidationError(\n `projectionFailure must be \"rollback\" or \"warn\" (got ${JSON.stringify(value)})`,\n );\n}\n\nfunction snapshotMountPaths(afs: AFS): Set<string> {\n const paths = new Set<string>();\n for (const mount of afs.getMounts(null)) {\n paths.add(mount.path);\n }\n return paths;\n}\n\nfunction supplementsSince(afs: AFS, baseline: Set<string>, dataPath: string | null): string[] {\n const added: string[] = [];\n for (const mount of afs.getMounts(null)) {\n if (!baseline.has(mount.path) && mount.path !== dataPath) added.push(mount.path);\n }\n return added;\n}\n\nfunction rollback(afs: AFS, baseline: Set<string>, dataPath: string | null): void {\n // Unmount supplements first (deepest first to honour parent/child\n // unmount semantics), then the data provider itself. Each unmount is\n // sync and wrapped in try/catch so one failure cannot block the rest.\n const supplements = supplementsSince(afs, baseline, dataPath);\n supplements.sort((a, b) => b.length - a.length);\n for (const path of supplements) safeUnmount(afs, path);\n if (dataPath) safeUnmount(afs, dataPath);\n}\n\n/**\n * Roll back only the supplements created since `baseline` (i.e. by the\n * single failing projector). Used by `projectionFailure: \"warn\"` so the\n * data mount and previously-succeeded projector outputs survive.\n */\nfunction rollbackSupplementsSince(afs: AFS, baseline: Set<string>, dataPath: string): void {\n const supplements = supplementsSince(afs, baseline, dataPath);\n supplements.sort((a, b) => b.length - a.length);\n for (const path of supplements) safeUnmount(afs, path);\n}\n\n/**\n * Produce a short, redacted error description suitable for log lines.\n * Truncates message to ~200 chars and drops stack/url so token-bearing\n * URLs and full SDK stack frames cannot leak into shared logs.\n */\nexport function redactError(err: unknown): string {\n if (err instanceof Error) {\n const msg = err.message ?? \"\";\n const truncated = msg.length > 200 ? `${msg.slice(0, 200)}…` : msg;\n return `${err.name}: ${truncated}`;\n }\n const s = typeof err === \"string\" ? err : JSON.stringify(err);\n return s.length > 200 ? `${s.slice(0, 200)}…` : s;\n}\n\n/**\n * Cascade-unmount every mount at or under `parentPath`. Used when a\n * caller passes `mountOptions.replace: true` — without this, supplement\n * mounts projected by a previous materialize call survive the exact-path\n * replace inside `afs.mount` and the new mount trips the AFS parent-child\n * conflict guard.\n *\n * Order matters: longest paths first so children unmount before parents,\n * keeping each individual `afs.unmount` call within an internally\n * consistent mount tree.\n */\nfunction cascadeUnmountUnder(afs: AFS, parentPath: string): void {\n const prefix = parentPath.endsWith(\"/\") ? parentPath : `${parentPath}/`;\n const descendants: string[] = [];\n for (const mount of afs.getMounts(null)) {\n if (mount.path === parentPath || mount.path.startsWith(prefix)) {\n descendants.push(mount.path);\n }\n }\n // Deepest first — children before parents.\n descendants.sort((a, b) => b.length - a.length);\n for (const path of descendants) {\n safeUnmount(afs, path);\n }\n}\n\nfunction safeUnmount(afs: AFS, path: string): void {\n try {\n afs.unmount(path);\n } catch (error) {\n log.warn(`[aos/mount] rollback unmount failed for ${path}:`, error);\n }\n}\n\nfunction warnUnsupportedContributions(\n contributions: ResourceContribution[] | undefined,\n mountPath: string,\n): void {\n if (!contributions?.length) return;\n log.warn(\n `[aos/mount] ignoring ${contributions.length} contribution(s) declared by provider at ${mountPath} — first-stage materializer does not project contributions; see planning/afs-ui/aup-mount-materialization Phase 6`,\n );\n}\n"],"mappings":";;;AAqBA,MAAM,MAAM,UAAU,MAAM;;;;;;;;;;;;;;;AAwF5B,eAAsB,yBACpB,SAC4B;AAC5B,mBAAkB,QAAQ,UAAU;AACpC,4BAA2B,QAAQ,WAAW;AAC9C,2BAA0B,QAAQ,kBAAkB;CAEpD,MAAM,oBAAoB,QAAQ,qBAAqB;CAEvD,MAAM,eAAe,MAAM,QAAQ,QAAQ,OAAO,QAAQ,WAAW;AAErE,KAAI,CAAC,cAAc,SACjB,OAAM,IAAI,mBACR,6CAA6C,QAAQ,WAAW,MACjE;AAOH,KAAI,QAAQ,aACV,cAAa,WAAW,QAAQ,aAAa,aAAa,SAAS;AAUrE,KAAI,QAAQ,cAAc,QACxB,qBAAoB,QAAQ,KAAK,QAAQ,UAAU;CAGrD,MAAM,WAAW,mBAAmB,QAAQ,IAAI;CAChD,IAAI,cAAc;AAElB,KAAI;AACF,QAAM,QAAQ,IAAI,MAAM,aAAa,UAAU,QAAQ,WAAW,QAAQ,aAAa;AACvF,gBAAc;AAEd,MAAI,aAAa,UACf,MAAK,MAAM,aAAa,QAAQ,YAAY;GAC1C,MAAM,mBAAmB,mBAAmB,QAAQ,IAAI;AACxD,OAAI;AACF,UAAM,UAAU,QAAQ;KACtB,KAAK,QAAQ;KACb,WAAW,QAAQ;KACnB,WAAW,aAAa;KACxB,OAAO,QAAQ;KAChB,CAAC;YACK,KAAK;AACZ,QAAI,sBAAsB,QAAQ;AAChC,8BAAyB,QAAQ,KAAK,kBAAkB,QAAQ,UAAU;AAC1E,SAAI,KACF,+CAA+C,QAAQ,UAAU,cACjD,UAAU,KAAK,KAAK,YAAY,IAAI,GACrD;AACD;;AAEF,UAAM;;;AAKZ,OAAK,MAAM,WAAW,QAAQ,YAAY,EAAE,CAC1C,MAAK,MAAM,aAAa,QAAQ,YAAY;AAC1C,OAAI,UAAU,SAAS,QAAQ,KAAM;GACrC,MAAM,0BAA0B,mBAAmB,QAAQ,IAAI;AAC/D,OAAI;AACF,UAAM,UAAU,QAAQ;KACtB,KAAK,QAAQ;KACb,WAAW,QAAQ;KACnB,WAAW,QAAQ;KACnB,OAAO,QAAQ;KAChB,CAAC;YACK,KAAK;AACZ,QAAI,sBAAsB,QAAQ;AAChC,8BAAyB,QAAQ,KAAK,yBAAyB,QAAQ,UAAU;AACjF,SAAI,KACF,6CAA6C,QAAQ,UAAU,cAC/C,UAAU,KAAK,YAAY,QAAQ,KAAK,KAAK,YAAY,IAAI,GAC9E;AACD;;AAEF,UAAM;;;AAKZ,+BAA6B,aAAa,eAAe,QAAQ,UAAU;AAE3E,SAAO;GACL,UAAU,aAAa;GACvB,uBAAuB,iBAAiB,QAAQ,KAAK,UAAU,QAAQ,UAAU;GAClF;UACM,OAAO;AACd,WAAS,QAAQ,KAAK,UAAU,cAAc,QAAQ,YAAY,KAAK;AACvE,QAAM;;;AAIV,SAAS,kBAAkB,WAAyB;AAClD,KAAI,OAAO,cAAc,YAAY,UAAU,WAAW,EACxD,OAAM,IAAI,mBAAmB,uCAAuC;AAEtE,KAAI,cAAc,IAChB,OAAM,IAAI,mBAAmB,6CAA6C;AAE5E,KAAI,CAAC,UAAU,WAAW,IAAI,CAC5B,OAAM,IAAI,mBAAmB,uCAAuC,UAAU,IAAI;AAEpF,KAAI,UAAU,MAAM,IAAI,CAAC,MAAM,YAAY,YAAY,KAAK,CAC1D,OAAM,IAAI,mBAAmB,gDAAgD,UAAU,IAAI;;AAI/F,SAAS,2BAA2B,YAAsC;AACxE,KAAI,CAAC,cAAc,OAAO,eAAe,SACvC,OAAM,IAAI,mBAAmB,+BAA+B;AAE9D,KAAI,OAAO,WAAW,QAAQ,YAAY,WAAW,IAAI,WAAW,EAClE,OAAM,IAAI,mBAAmB,4CAA4C;AAE3E,KAAI,OAAO,WAAW,SAAS,YAAY,WAAW,KAAK,WAAW,EACpE,OAAM,IAAI,mBAAmB,6CAA6C;;AAI9E,SAAS,0BAA0B,OAAsB;AACvD,KAAI,UAAU,UAAa,UAAU,cAAc,UAAU,OAAQ;AACrE,OAAM,IAAI,mBACR,uDAAuD,KAAK,UAAU,MAAM,CAAC,GAC9E;;AAGH,SAAS,mBAAmB,KAAuB;CACjD,MAAM,wBAAQ,IAAI,KAAa;AAC/B,MAAK,MAAM,SAAS,IAAI,UAAU,KAAK,CACrC,OAAM,IAAI,MAAM,KAAK;AAEvB,QAAO;;AAGT,SAAS,iBAAiB,KAAU,UAAuB,UAAmC;CAC5F,MAAM,QAAkB,EAAE;AAC1B,MAAK,MAAM,SAAS,IAAI,UAAU,KAAK,CACrC,KAAI,CAAC,SAAS,IAAI,MAAM,KAAK,IAAI,MAAM,SAAS,SAAU,OAAM,KAAK,MAAM,KAAK;AAElF,QAAO;;AAGT,SAAS,SAAS,KAAU,UAAuB,UAA+B;CAIhF,MAAM,cAAc,iBAAiB,KAAK,UAAU,SAAS;AAC7D,aAAY,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,OAAO;AAC/C,MAAK,MAAM,QAAQ,YAAa,aAAY,KAAK,KAAK;AACtD,KAAI,SAAU,aAAY,KAAK,SAAS;;;;;;;AAQ1C,SAAS,yBAAyB,KAAU,UAAuB,UAAwB;CACzF,MAAM,cAAc,iBAAiB,KAAK,UAAU,SAAS;AAC7D,aAAY,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,OAAO;AAC/C,MAAK,MAAM,QAAQ,YAAa,aAAY,KAAK,KAAK;;;;;;;AAQxD,SAAgB,YAAY,KAAsB;AAChD,KAAI,eAAe,OAAO;EACxB,MAAM,MAAM,IAAI,WAAW;EAC3B,MAAM,YAAY,IAAI,SAAS,MAAM,GAAG,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK;AAC/D,SAAO,GAAG,IAAI,KAAK,IAAI;;CAEzB,MAAM,IAAI,OAAO,QAAQ,WAAW,MAAM,KAAK,UAAU,IAAI;AAC7D,QAAO,EAAE,SAAS,MAAM,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,KAAK;;;;;;;;;;;;;AAclD,SAAS,oBAAoB,KAAU,YAA0B;CAC/D,MAAM,SAAS,WAAW,SAAS,IAAI,GAAG,aAAa,GAAG,WAAW;CACrE,MAAM,cAAwB,EAAE;AAChC,MAAK,MAAM,SAAS,IAAI,UAAU,KAAK,CACrC,KAAI,MAAM,SAAS,cAAc,MAAM,KAAK,WAAW,OAAO,CAC5D,aAAY,KAAK,MAAM,KAAK;AAIhC,aAAY,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,OAAO;AAC/C,MAAK,MAAM,QAAQ,YACjB,aAAY,KAAK,KAAK;;AAI1B,SAAS,YAAY,KAAU,MAAoB;AACjD,KAAI;AACF,MAAI,QAAQ,KAAK;UACV,OAAO;AACd,MAAI,KAAK,2CAA2C,KAAK,IAAI,MAAM;;;AAIvE,SAAS,6BACP,eACA,WACM;AACN,KAAI,CAAC,eAAe,OAAQ;AAC5B,KAAI,KACF,wBAAwB,cAAc,OAAO,2CAA2C,UAAU,mHACnG"}