@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,175 @@
1
+ import { joinURL } from "ufo";
2
+
3
+ //#region src/auto-surface/fragments.ts
4
+ const DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT = "/.surface/definitions";
5
+ const DEFAULT_AUTO_SURFACE_VALUES_ROOT = "/.surface/overrides";
6
+ async function loadAutoSurfaceFragment(reader, options) {
7
+ const root = options.root ?? DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT;
8
+ const resources = [];
9
+ if (!await hasDirectory(reader, root)) return {
10
+ source: options.source,
11
+ owner: options.owner,
12
+ resources
13
+ };
14
+ await walkDefinitionDirectory(reader, root, [], {}, resources);
15
+ return {
16
+ source: options.source,
17
+ owner: options.owner,
18
+ resources
19
+ };
20
+ }
21
+ async function loadAutoSurfaceValueLayer(reader, options = {}) {
22
+ const root = options.root ?? DEFAULT_AUTO_SURFACE_VALUES_ROOT;
23
+ const values = {};
24
+ if (!await hasDirectory(reader, root)) return values;
25
+ await walkValueDirectory(reader, root, [], values);
26
+ return values;
27
+ }
28
+ async function walkDefinitionDirectory(reader, currentPath, relativeSegments, inheritedContext, resources) {
29
+ const entries = await listVisible(reader, currentPath);
30
+ const dirs = entries.filter(isDirectoryEntry);
31
+ const files = entries.filter((entry) => !isDirectoryEntry(entry));
32
+ const context = deriveDefinitionContext(relativeSegments, inheritedContext, await readDirectoryMeta(reader, files, currentPath));
33
+ for (const file of files) {
34
+ if (!file.id.endsWith(".field.json")) continue;
35
+ const field = await readJSON(reader, entryPath(currentPath, file));
36
+ const resourceId = typeof field.id === "string" && field.id.trim().length > 0 ? field.id : buildResourceId(relativeSegments, stripSuffix(file.id, ".field.json"));
37
+ resources.push({
38
+ ...field,
39
+ id: resourceId,
40
+ presentations: mergePresentations(field.presentations, inferSettingsShellPresentation(relativeSegments, context))
41
+ });
42
+ }
43
+ for (const dir of dirs) await walkDefinitionDirectory(reader, entryPath(currentPath, dir), [...relativeSegments, dir.id], context, resources);
44
+ }
45
+ async function walkValueDirectory(reader, currentPath, relativeSegments, values) {
46
+ const entries = await listVisible(reader, currentPath);
47
+ const dirs = entries.filter(isDirectoryEntry);
48
+ const files = entries.filter((entry) => !isDirectoryEntry(entry));
49
+ for (const file of files) {
50
+ if (!file.id.endsWith(".value.json")) continue;
51
+ const parsed = await readJSON(reader, entryPath(currentPath, file), { allowScalar: true });
52
+ const valueId = resolveValueId(parsed, relativeSegments, file.id);
53
+ values[valueId] = resolveValue(parsed);
54
+ }
55
+ for (const dir of dirs) await walkValueDirectory(reader, entryPath(currentPath, dir), [...relativeSegments, dir.id], values);
56
+ }
57
+ async function readDirectoryMeta(reader, files, currentPath) {
58
+ const result = {};
59
+ for (const file of files) {
60
+ if (![
61
+ "group.json",
62
+ "page.json",
63
+ "section.json"
64
+ ].includes(file.id)) continue;
65
+ const path = entryPath(currentPath, file);
66
+ result[file.id] = await readJSON(reader, path);
67
+ }
68
+ return result;
69
+ }
70
+ function deriveDefinitionContext(relativeSegments, inheritedContext, localMeta) {
71
+ const context = { ...inheritedContext };
72
+ if (relativeSegments.length >= 1) {
73
+ const groupId = relativeSegments[0];
74
+ context.group = {
75
+ title: localMeta["group.json"]?.title ?? inheritedContext.group?.title ?? labelize(groupId),
76
+ description: localMeta["group.json"]?.description ?? inheritedContext.group?.description,
77
+ order: localMeta["group.json"]?.order ?? inheritedContext.group?.order
78
+ };
79
+ }
80
+ if (relativeSegments.length >= 2) {
81
+ const pageId = relativeSegments[1];
82
+ context.page = {
83
+ title: localMeta["page.json"]?.title ?? inheritedContext.page?.title ?? labelize(pageId),
84
+ description: localMeta["page.json"]?.description ?? inheritedContext.page?.description,
85
+ order: localMeta["page.json"]?.order ?? inheritedContext.page?.order
86
+ };
87
+ }
88
+ if (relativeSegments.length >= 3) {
89
+ const sectionId = relativeSegments.slice(2).join("/");
90
+ context.section = {
91
+ title: localMeta["section.json"]?.title ?? inheritedContext.section?.title ?? labelize(relativeSegments[relativeSegments.length - 1]),
92
+ description: localMeta["section.json"]?.description ?? inheritedContext.section?.description,
93
+ order: localMeta["section.json"]?.order ?? inheritedContext.section?.order
94
+ };
95
+ if (!context.section.title) context.section.title = labelize(sectionId);
96
+ }
97
+ return context;
98
+ }
99
+ function inferSettingsShellPresentation(relativeSegments, context) {
100
+ return {
101
+ group: context.group?.title ?? labelize(relativeSegments[0] ?? "general"),
102
+ page: context.page?.title ?? "General",
103
+ section: context.section?.title ?? "General",
104
+ ...context.group?.order !== void 0 ? { groupOrder: context.group.order } : {},
105
+ ...context.page?.order !== void 0 ? { pageOrder: context.page.order } : {},
106
+ ...context.section?.order !== void 0 ? { sectionOrder: context.section.order } : {}
107
+ };
108
+ }
109
+ function mergePresentations(existing, inferred) {
110
+ return {
111
+ ...existing ?? {},
112
+ "settings-shell": {
113
+ ...inferred,
114
+ ...existing?.["settings-shell"] ?? {}
115
+ }
116
+ };
117
+ }
118
+ function buildResourceId(relativeSegments, basename) {
119
+ return [...relativeSegments, basename].filter(Boolean).join(".");
120
+ }
121
+ function resolveValueId(parsed, relativeSegments, fileName) {
122
+ if (isPlainObject(parsed) && typeof parsed.id === "string" && parsed.id.trim().length > 0) return parsed.id;
123
+ return buildResourceId(relativeSegments, stripSuffix(fileName, ".value.json"));
124
+ }
125
+ function resolveValue(parsed) {
126
+ if (isPlainObject(parsed) && Object.hasOwn(parsed, "value")) return parsed.value;
127
+ return parsed;
128
+ }
129
+ async function hasDirectory(reader, path) {
130
+ try {
131
+ const entries = await reader.list(path);
132
+ return Array.isArray(entries.data);
133
+ } catch {
134
+ return false;
135
+ }
136
+ }
137
+ async function listVisible(reader, path) {
138
+ return ((await reader.list(path)).data ?? []).filter((entry) => entry?.id && !entry.id.startsWith("."));
139
+ }
140
+ async function readJSON(reader, path, options = {}) {
141
+ const content = extractContent(await reader.read(path));
142
+ if (typeof content === "string") try {
143
+ return JSON.parse(content);
144
+ } catch (error) {
145
+ throw new Error(`Invalid JSON in "${path}": ${error instanceof Error ? error.message : String(error)}`);
146
+ }
147
+ if (content && typeof content === "object") return content;
148
+ if (options.allowScalar) return content;
149
+ throw new Error(`Expected JSON object in "${path}"`);
150
+ }
151
+ function extractContent(result) {
152
+ const data = result.data;
153
+ if (data && typeof data === "object" && "content" in data) return data.content;
154
+ return data;
155
+ }
156
+ function isDirectoryEntry(entry) {
157
+ const meta = entry.meta ?? {};
158
+ return meta.kind === "fs:directory" || meta.kind === "directory" || Array.isArray(meta.kinds) && meta.kinds.includes("fs:directory") || typeof meta.childrenCount === "number";
159
+ }
160
+ function entryPath(parentPath, entry) {
161
+ return entry.path || joinURL(parentPath, entry.id);
162
+ }
163
+ function stripSuffix(value, suffix) {
164
+ return value.endsWith(suffix) ? value.slice(0, -suffix.length) : value;
165
+ }
166
+ function labelize(value) {
167
+ return value.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (char) => char.toUpperCase());
168
+ }
169
+ function isPlainObject(value) {
170
+ return Object.prototype.toString.call(value) === "[object Object]";
171
+ }
172
+
173
+ //#endregion
174
+ export { DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT, DEFAULT_AUTO_SURFACE_VALUES_ROOT, loadAutoSurfaceFragment, loadAutoSurfaceValueLayer };
175
+ //# sourceMappingURL=fragments.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragments.mjs","names":[],"sources":["../../src/auto-surface/fragments.ts"],"sourcesContent":["import type { AFSEntry, AFSListResult, AFSReadResult } from \"@aigne/afs\";\nimport { joinURL } from \"ufo\";\nimport type {\n AutoSurfaceDefinitionOwner,\n AutoSurfaceFragment,\n AutoSurfacePresentations,\n AutoSurfaceResourceDefinition,\n AutoSurfaceSettingsShellPresentation,\n} from \"./types.js\";\n\nexport const DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT = \"/.surface/definitions\";\nexport const DEFAULT_AUTO_SURFACE_VALUES_ROOT = \"/.surface/overrides\";\n\nexport interface AutoSurfaceFragmentReader {\n list(path: string): Promise<AFSListResult>;\n read(path: string): Promise<AFSReadResult>;\n}\n\nexport interface LoadAutoSurfaceFragmentOptions {\n source: string;\n owner: AutoSurfaceDefinitionOwner;\n root?: string;\n}\n\nexport interface LoadAutoSurfaceValueLayerOptions {\n root?: string;\n}\n\ninterface AutoSurfaceDirectoryMeta {\n title?: string;\n description?: string;\n order?: number;\n}\n\ninterface AutoSurfaceFieldFile extends Omit<AutoSurfaceResourceDefinition, \"id\"> {\n id?: string;\n}\n\ninterface DefinitionContext {\n group?: AutoSurfaceDirectoryMeta;\n page?: AutoSurfaceDirectoryMeta;\n section?: AutoSurfaceDirectoryMeta;\n}\n\nexport async function loadAutoSurfaceFragment(\n reader: AutoSurfaceFragmentReader,\n options: LoadAutoSurfaceFragmentOptions,\n): Promise<AutoSurfaceFragment> {\n const root = options.root ?? DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT;\n const resources: AutoSurfaceResourceDefinition[] = [];\n\n if (!(await hasDirectory(reader, root))) {\n return { source: options.source, owner: options.owner, resources };\n }\n\n await walkDefinitionDirectory(reader, root, [], {}, resources);\n return {\n source: options.source,\n owner: options.owner,\n resources,\n };\n}\n\nexport async function loadAutoSurfaceValueLayer(\n reader: AutoSurfaceFragmentReader,\n options: LoadAutoSurfaceValueLayerOptions = {},\n): Promise<Record<string, unknown>> {\n const root = options.root ?? DEFAULT_AUTO_SURFACE_VALUES_ROOT;\n const values: Record<string, unknown> = {};\n\n if (!(await hasDirectory(reader, root))) return values;\n\n await walkValueDirectory(reader, root, [], values);\n return values;\n}\n\nasync function walkDefinitionDirectory(\n reader: AutoSurfaceFragmentReader,\n currentPath: string,\n relativeSegments: string[],\n inheritedContext: DefinitionContext,\n resources: AutoSurfaceResourceDefinition[],\n): Promise<void> {\n const entries = await listVisible(reader, currentPath);\n const dirs = entries.filter(isDirectoryEntry);\n const files = entries.filter((entry) => !isDirectoryEntry(entry));\n const localMeta = await readDirectoryMeta(reader, files, currentPath);\n const context = deriveDefinitionContext(relativeSegments, inheritedContext, localMeta);\n\n for (const file of files) {\n if (!file.id.endsWith(\".field.json\")) continue;\n const path = entryPath(currentPath, file);\n const parsed = await readJSON(reader, path);\n const field = parsed as AutoSurfaceFieldFile;\n const resourceId =\n typeof field.id === \"string\" && field.id.trim().length > 0\n ? field.id\n : buildResourceId(relativeSegments, stripSuffix(file.id, \".field.json\"));\n resources.push({\n ...field,\n id: resourceId,\n presentations: mergePresentations(\n field.presentations,\n inferSettingsShellPresentation(relativeSegments, context),\n ),\n });\n }\n\n for (const dir of dirs) {\n await walkDefinitionDirectory(\n reader,\n entryPath(currentPath, dir),\n [...relativeSegments, dir.id],\n context,\n resources,\n );\n }\n}\n\nasync function walkValueDirectory(\n reader: AutoSurfaceFragmentReader,\n currentPath: string,\n relativeSegments: string[],\n values: Record<string, unknown>,\n): Promise<void> {\n const entries = await listVisible(reader, currentPath);\n const dirs = entries.filter(isDirectoryEntry);\n const files = entries.filter((entry) => !isDirectoryEntry(entry));\n\n for (const file of files) {\n if (!file.id.endsWith(\".value.json\")) continue;\n const path = entryPath(currentPath, file);\n const parsed = await readJSON(reader, path, { allowScalar: true });\n const valueId = resolveValueId(parsed, relativeSegments, file.id);\n values[valueId] = resolveValue(parsed);\n }\n\n for (const dir of dirs) {\n await walkValueDirectory(\n reader,\n entryPath(currentPath, dir),\n [...relativeSegments, dir.id],\n values,\n );\n }\n}\n\nasync function readDirectoryMeta(\n reader: AutoSurfaceFragmentReader,\n files: AFSEntry[],\n currentPath: string,\n): Promise<Record<string, AutoSurfaceDirectoryMeta>> {\n const result: Record<string, AutoSurfaceDirectoryMeta> = {};\n\n for (const file of files) {\n if (![\"group.json\", \"page.json\", \"section.json\"].includes(file.id)) continue;\n const path = entryPath(currentPath, file);\n result[file.id] = (await readJSON(reader, path)) as AutoSurfaceDirectoryMeta;\n }\n\n return result;\n}\n\nfunction deriveDefinitionContext(\n relativeSegments: string[],\n inheritedContext: DefinitionContext,\n localMeta: Record<string, AutoSurfaceDirectoryMeta>,\n): DefinitionContext {\n const context: DefinitionContext = { ...inheritedContext };\n\n if (relativeSegments.length >= 1) {\n const groupId = relativeSegments[0]!;\n context.group = {\n title: localMeta[\"group.json\"]?.title ?? inheritedContext.group?.title ?? labelize(groupId),\n description: localMeta[\"group.json\"]?.description ?? inheritedContext.group?.description,\n order: localMeta[\"group.json\"]?.order ?? inheritedContext.group?.order,\n };\n }\n\n if (relativeSegments.length >= 2) {\n const pageId = relativeSegments[1]!;\n context.page = {\n title: localMeta[\"page.json\"]?.title ?? inheritedContext.page?.title ?? labelize(pageId),\n description: localMeta[\"page.json\"]?.description ?? inheritedContext.page?.description,\n order: localMeta[\"page.json\"]?.order ?? inheritedContext.page?.order,\n };\n }\n\n if (relativeSegments.length >= 3) {\n const sectionId = relativeSegments.slice(2).join(\"/\");\n context.section = {\n title:\n localMeta[\"section.json\"]?.title ??\n inheritedContext.section?.title ??\n labelize(relativeSegments[relativeSegments.length - 1]!),\n description: localMeta[\"section.json\"]?.description ?? inheritedContext.section?.description,\n order: localMeta[\"section.json\"]?.order ?? inheritedContext.section?.order,\n };\n if (!context.section.title) context.section.title = labelize(sectionId);\n }\n\n return context;\n}\n\nfunction inferSettingsShellPresentation(\n relativeSegments: string[],\n context: DefinitionContext,\n): AutoSurfaceSettingsShellPresentation {\n return {\n group: context.group?.title ?? labelize(relativeSegments[0] ?? \"general\"),\n page: context.page?.title ?? \"General\",\n section: context.section?.title ?? \"General\",\n ...(context.group?.order !== undefined ? { groupOrder: context.group.order } : {}),\n ...(context.page?.order !== undefined ? { pageOrder: context.page.order } : {}),\n ...(context.section?.order !== undefined ? { sectionOrder: context.section.order } : {}),\n };\n}\n\nfunction mergePresentations(\n existing: AutoSurfacePresentations | undefined,\n inferred: AutoSurfaceSettingsShellPresentation,\n): AutoSurfacePresentations {\n return {\n ...(existing ?? {}),\n \"settings-shell\": {\n ...inferred,\n ...(existing?.[\"settings-shell\"] ?? {}),\n },\n };\n}\n\nfunction buildResourceId(relativeSegments: string[], basename: string): string {\n return [...relativeSegments, basename].filter(Boolean).join(\".\");\n}\n\nfunction resolveValueId(parsed: unknown, relativeSegments: string[], fileName: string): string {\n if (isPlainObject(parsed) && typeof parsed.id === \"string\" && parsed.id.trim().length > 0) {\n return parsed.id;\n }\n return buildResourceId(relativeSegments, stripSuffix(fileName, \".value.json\"));\n}\n\nfunction resolveValue(parsed: unknown): unknown {\n if (isPlainObject(parsed) && Object.hasOwn(parsed, \"value\")) {\n return parsed.value;\n }\n return parsed;\n}\n\nasync function hasDirectory(reader: AutoSurfaceFragmentReader, path: string): Promise<boolean> {\n try {\n const entries = await reader.list(path);\n return Array.isArray(entries.data);\n } catch {\n return false;\n }\n}\n\nasync function listVisible(reader: AutoSurfaceFragmentReader, path: string): Promise<AFSEntry[]> {\n const result = await reader.list(path);\n return (result.data ?? []).filter((entry) => entry?.id && !entry.id.startsWith(\".\"));\n}\n\nasync function readJSON(\n reader: AutoSurfaceFragmentReader,\n path: string,\n options: { allowScalar?: boolean } = {},\n): Promise<unknown> {\n const result = await reader.read(path);\n const content = extractContent(result);\n if (typeof content === \"string\") {\n try {\n return JSON.parse(content);\n } catch (error) {\n throw new Error(\n `Invalid JSON in \"${path}\": ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n if (content && typeof content === \"object\") return content;\n if (options.allowScalar) return content;\n throw new Error(`Expected JSON object in \"${path}\"`);\n}\n\nfunction extractContent(result: AFSReadResult): unknown {\n const data = result.data;\n if (data && typeof data === \"object\" && \"content\" in data) {\n return (data as { content?: unknown }).content;\n }\n return data;\n}\n\nfunction isDirectoryEntry(entry: AFSEntry): boolean {\n const meta = entry.meta ?? {};\n return (\n meta.kind === \"fs:directory\" ||\n meta.kind === \"directory\" ||\n (Array.isArray(meta.kinds) && meta.kinds.includes(\"fs:directory\")) ||\n typeof meta.childrenCount === \"number\"\n );\n}\n\nfunction entryPath(parentPath: string, entry: AFSEntry): string {\n return entry.path || joinURL(parentPath, entry.id);\n}\n\nfunction stripSuffix(value: string, suffix: string): string {\n return value.endsWith(suffix) ? value.slice(0, -suffix.length) : value;\n}\n\nfunction labelize(value: string): string {\n return value\n .replace(/[_-]+/g, \" \")\n .replace(/([a-z])([A-Z])/g, \"$1 $2\")\n .replace(/\\b\\w/g, (char) => char.toUpperCase());\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return Object.prototype.toString.call(value) === \"[object Object]\";\n}\n"],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ import { AutoSurfaceBindingMap, AutoSurfaceCompileResult, AutoSurfaceDefinitionOwner, AutoSurfaceDiagnostic, AutoSurfaceFragment, AutoSurfaceLayer, AutoSurfaceLoadedRegistry, AutoSurfaceOption, AutoSurfacePolicy, AutoSurfacePresentations, AutoSurfaceProjectedField, AutoSurfaceProjectedGroup, AutoSurfaceProjectedPage, AutoSurfaceProjectedSection, AutoSurfaceProjection, AutoSurfaceProjectorName, AutoSurfaceRegistry, AutoSurfaceRegistryEntry, AutoSurfaceResolvedRegistry, AutoSurfaceResolvedResource, AutoSurfaceResolvedScenario, AutoSurfaceResourceDefinition, AutoSurfaceSettingsShellPresentation, AutoSurfaceSettingsShellProjection, AutoSurfaceValidationRule, AutoSurfaceValueLayers, AutoSurfaceValueSource, AutoSurfaceValueType, normalizeAutoSurfaceScopes } from "./types.mjs";
2
+ import { compileAutoSurfaceRegistry } from "./compiler.mjs";
3
+ import { AutoSurfaceDefinitionDslCompileError, AutoSurfaceDefinitionDslCompileResult, AutoSurfaceDefinitionDslField, AutoSurfaceDefinitionDslGroup, AutoSurfaceDefinitionDslPage, AutoSurfaceDefinitionDslSection, compileAutoSurfaceDefinitionDsl, formatAutoSurfaceDefinitionDsl } from "./definition-dsl.mjs";
4
+ import { AutoSurfaceFragmentReader, DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT, DEFAULT_AUTO_SURFACE_VALUES_ROOT, LoadAutoSurfaceFragmentOptions, LoadAutoSurfaceValueLayerOptions, loadAutoSurfaceFragment, loadAutoSurfaceValueLayer } from "./fragments.mjs";
5
+ import { resolveAutoSurfaceValues } from "./layering.mjs";
6
+ import { ProjectAutoSurfaceOptions, projectAutoSurface } from "./projection.mjs";
7
+ import { ProjectSettingsShellOptions, projectSettingsShell } from "./projectors/settings-shell.mjs";
8
+ import { AutoSurfaceDefinitionSource, AutoSurfaceValueLayerSource, LoadAutoSurfaceRegistryOptions, LoadAutoSurfaceValueLayersOptions, ResolveAutoSurfaceScenarioOptions, loadAutoSurfaceRegistry, loadAutoSurfaceValueLayers, resolveAutoSurfaceScenario } from "./scenario.mjs";
9
+ import { AutoSurfaceValueDslCompileError, AutoSurfaceValueDslCompileResult, AutoSurfaceValueDslEntry, compileAutoSurfaceValueDsl, formatAutoSurfaceValueDsl } from "./value-dsl.mjs";
@@ -0,0 +1,43 @@
1
+
2
+ //#region src/auto-surface/layering.ts
3
+ const LAYER_ORDER = [
4
+ "system",
5
+ "package",
6
+ "instance",
7
+ "user"
8
+ ];
9
+ function resolveAutoSurfaceValues(registry, layers) {
10
+ const resources = {};
11
+ for (const [resourceId, entry] of Object.entries(registry.resources)) {
12
+ const scopes = entry.definition.scopes ?? ["instance"];
13
+ let value = entry.definition.defaultValue;
14
+ let source = entry.definition.defaultValue === void 0 ? "unset" : "default";
15
+ for (const layer of LAYER_ORDER) {
16
+ if (!scopes.includes(layer)) continue;
17
+ if (!canApplyLayer(layer, entry.definition.policy)) continue;
18
+ const candidate = layers[layer]?.[resourceId];
19
+ if (candidate === void 0) continue;
20
+ value = candidate;
21
+ source = layer;
22
+ }
23
+ resources[resourceId] = {
24
+ id: resourceId,
25
+ definition: entry.definition,
26
+ owner: entry.owner,
27
+ value,
28
+ source,
29
+ availableScopes: scopes,
30
+ bindings: entry.definition.bindings ?? {},
31
+ sourceDefinition: entry.source
32
+ };
33
+ }
34
+ return { resources };
35
+ }
36
+ function canApplyLayer(layer, policy) {
37
+ if (layer === "instance" && policy?.allowInstanceOverride === false) return false;
38
+ if (layer === "user" && policy?.allowUserOverride === false) return false;
39
+ return true;
40
+ }
41
+
42
+ //#endregion
43
+ exports.resolveAutoSurfaceValues = resolveAutoSurfaceValues;
@@ -0,0 +1,7 @@
1
+ import { AutoSurfaceRegistry, AutoSurfaceResolvedRegistry, AutoSurfaceValueLayers } from "./types.cjs";
2
+
3
+ //#region src/auto-surface/layering.d.ts
4
+ declare function resolveAutoSurfaceValues(registry: AutoSurfaceRegistry, layers: AutoSurfaceValueLayers): AutoSurfaceResolvedRegistry;
5
+ //#endregion
6
+ export { resolveAutoSurfaceValues };
7
+ //# sourceMappingURL=layering.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layering.d.cts","names":[],"sources":["../../src/auto-surface/layering.ts"],"mappings":";;;iBAWgB,wBAAA,CACd,QAAA,EAAU,mBAAA,EACV,MAAA,EAAQ,sBAAA,GACP,2BAAA"}
@@ -0,0 +1,7 @@
1
+ import { AutoSurfaceRegistry, AutoSurfaceResolvedRegistry, AutoSurfaceValueLayers } from "./types.mjs";
2
+
3
+ //#region src/auto-surface/layering.d.ts
4
+ declare function resolveAutoSurfaceValues(registry: AutoSurfaceRegistry, layers: AutoSurfaceValueLayers): AutoSurfaceResolvedRegistry;
5
+ //#endregion
6
+ export { resolveAutoSurfaceValues };
7
+ //# sourceMappingURL=layering.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layering.d.mts","names":[],"sources":["../../src/auto-surface/layering.ts"],"mappings":";;;iBAWgB,wBAAA,CACd,QAAA,EAAU,mBAAA,EACV,MAAA,EAAQ,sBAAA,GACP,2BAAA"}
@@ -0,0 +1,43 @@
1
+ //#region src/auto-surface/layering.ts
2
+ const LAYER_ORDER = [
3
+ "system",
4
+ "package",
5
+ "instance",
6
+ "user"
7
+ ];
8
+ function resolveAutoSurfaceValues(registry, layers) {
9
+ const resources = {};
10
+ for (const [resourceId, entry] of Object.entries(registry.resources)) {
11
+ const scopes = entry.definition.scopes ?? ["instance"];
12
+ let value = entry.definition.defaultValue;
13
+ let source = entry.definition.defaultValue === void 0 ? "unset" : "default";
14
+ for (const layer of LAYER_ORDER) {
15
+ if (!scopes.includes(layer)) continue;
16
+ if (!canApplyLayer(layer, entry.definition.policy)) continue;
17
+ const candidate = layers[layer]?.[resourceId];
18
+ if (candidate === void 0) continue;
19
+ value = candidate;
20
+ source = layer;
21
+ }
22
+ resources[resourceId] = {
23
+ id: resourceId,
24
+ definition: entry.definition,
25
+ owner: entry.owner,
26
+ value,
27
+ source,
28
+ availableScopes: scopes,
29
+ bindings: entry.definition.bindings ?? {},
30
+ sourceDefinition: entry.source
31
+ };
32
+ }
33
+ return { resources };
34
+ }
35
+ function canApplyLayer(layer, policy) {
36
+ if (layer === "instance" && policy?.allowInstanceOverride === false) return false;
37
+ if (layer === "user" && policy?.allowUserOverride === false) return false;
38
+ return true;
39
+ }
40
+
41
+ //#endregion
42
+ export { resolveAutoSurfaceValues };
43
+ //# sourceMappingURL=layering.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layering.mjs","names":[],"sources":["../../src/auto-surface/layering.ts"],"sourcesContent":["import type {\n AutoSurfaceLayer,\n AutoSurfaceRegistry,\n AutoSurfaceResolvedRegistry,\n AutoSurfaceResolvedResource,\n AutoSurfaceValueLayers,\n AutoSurfaceValueSource,\n} from \"./types.js\";\n\nconst LAYER_ORDER: AutoSurfaceLayer[] = [\"system\", \"package\", \"instance\", \"user\"];\n\nexport function resolveAutoSurfaceValues(\n registry: AutoSurfaceRegistry,\n layers: AutoSurfaceValueLayers,\n): AutoSurfaceResolvedRegistry {\n const resources: Record<string, AutoSurfaceResolvedResource> = {};\n\n for (const [resourceId, entry] of Object.entries(registry.resources)) {\n const scopes = entry.definition.scopes ?? [\"instance\"];\n let value = entry.definition.defaultValue;\n let source: AutoSurfaceValueSource =\n entry.definition.defaultValue === undefined ? \"unset\" : \"default\";\n\n for (const layer of LAYER_ORDER) {\n if (!scopes.includes(layer)) continue;\n if (!canApplyLayer(layer, entry.definition.policy)) continue;\n const candidate = layers[layer]?.[resourceId];\n if (candidate === undefined) continue;\n value = candidate;\n source = layer;\n }\n\n resources[resourceId] = {\n id: resourceId,\n definition: entry.definition,\n owner: entry.owner,\n value,\n source,\n availableScopes: scopes,\n bindings: entry.definition.bindings ?? {},\n sourceDefinition: entry.source,\n };\n }\n\n return { resources };\n}\n\nfunction canApplyLayer(\n layer: AutoSurfaceLayer,\n policy: AutoSurfaceResolvedResource[\"definition\"][\"policy\"] | undefined,\n): boolean {\n if (layer === \"instance\" && policy?.allowInstanceOverride === false) return false;\n if (layer === \"user\" && policy?.allowUserOverride === false) return false;\n return true;\n}\n"],"mappings":";AASA,MAAM,cAAkC;CAAC;CAAU;CAAW;CAAY;CAAO;AAEjF,SAAgB,yBACd,UACA,QAC6B;CAC7B,MAAM,YAAyD,EAAE;AAEjE,MAAK,MAAM,CAAC,YAAY,UAAU,OAAO,QAAQ,SAAS,UAAU,EAAE;EACpE,MAAM,SAAS,MAAM,WAAW,UAAU,CAAC,WAAW;EACtD,IAAI,QAAQ,MAAM,WAAW;EAC7B,IAAI,SACF,MAAM,WAAW,iBAAiB,SAAY,UAAU;AAE1D,OAAK,MAAM,SAAS,aAAa;AAC/B,OAAI,CAAC,OAAO,SAAS,MAAM,CAAE;AAC7B,OAAI,CAAC,cAAc,OAAO,MAAM,WAAW,OAAO,CAAE;GACpD,MAAM,YAAY,OAAO,SAAS;AAClC,OAAI,cAAc,OAAW;AAC7B,WAAQ;AACR,YAAS;;AAGX,YAAU,cAAc;GACtB,IAAI;GACJ,YAAY,MAAM;GAClB,OAAO,MAAM;GACb;GACA;GACA,iBAAiB;GACjB,UAAU,MAAM,WAAW,YAAY,EAAE;GACzC,kBAAkB,MAAM;GACzB;;AAGH,QAAO,EAAE,WAAW;;AAGtB,SAAS,cACP,OACA,QACS;AACT,KAAI,UAAU,cAAc,QAAQ,0BAA0B,MAAO,QAAO;AAC5E,KAAI,UAAU,UAAU,QAAQ,sBAAsB,MAAO,QAAO;AACpE,QAAO"}
@@ -0,0 +1,11 @@
1
+ const require_settings_shell = require('./projectors/settings-shell.cjs');
2
+
3
+ //#region src/auto-surface/projection.ts
4
+ function projectAutoSurface(resolved, options = {}) {
5
+ switch (options.projector ?? "settings-shell") {
6
+ case "settings-shell": return require_settings_shell.projectSettingsShell(resolved, { scope: options.scope });
7
+ }
8
+ }
9
+
10
+ //#endregion
11
+ exports.projectAutoSurface = projectAutoSurface;
@@ -0,0 +1,11 @@
1
+ import { AutoSurfaceLayer, AutoSurfaceProjection, AutoSurfaceProjectorName, AutoSurfaceResolvedRegistry } from "./types.cjs";
2
+
3
+ //#region src/auto-surface/projection.d.ts
4
+ interface ProjectAutoSurfaceOptions {
5
+ projector?: AutoSurfaceProjectorName;
6
+ scope?: AutoSurfaceLayer | "all";
7
+ }
8
+ declare function projectAutoSurface(resolved: AutoSurfaceResolvedRegistry, options?: ProjectAutoSurfaceOptions): AutoSurfaceProjection;
9
+ //#endregion
10
+ export { ProjectAutoSurfaceOptions, projectAutoSurface };
11
+ //# sourceMappingURL=projection.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.cts","names":[],"sources":["../../src/auto-surface/projection.ts"],"mappings":";;;UAQiB,yBAAA;EACf,SAAA,GAAY,wBAAA;EACZ,KAAA,GAAQ,gBAAA;AAAA;AAAA,iBAGM,kBAAA,CACd,QAAA,EAAU,2BAAA,EACV,OAAA,GAAS,yBAAA,GACR,qBAAA"}
@@ -0,0 +1,11 @@
1
+ import { AutoSurfaceLayer, AutoSurfaceProjection, AutoSurfaceProjectorName, AutoSurfaceResolvedRegistry } from "./types.mjs";
2
+
3
+ //#region src/auto-surface/projection.d.ts
4
+ interface ProjectAutoSurfaceOptions {
5
+ projector?: AutoSurfaceProjectorName;
6
+ scope?: AutoSurfaceLayer | "all";
7
+ }
8
+ declare function projectAutoSurface(resolved: AutoSurfaceResolvedRegistry, options?: ProjectAutoSurfaceOptions): AutoSurfaceProjection;
9
+ //#endregion
10
+ export { ProjectAutoSurfaceOptions, projectAutoSurface };
11
+ //# sourceMappingURL=projection.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.mts","names":[],"sources":["../../src/auto-surface/projection.ts"],"mappings":";;;UAQiB,yBAAA;EACf,SAAA,GAAY,wBAAA;EACZ,KAAA,GAAQ,gBAAA;AAAA;AAAA,iBAGM,kBAAA,CACd,QAAA,EAAU,2BAAA,EACV,OAAA,GAAS,yBAAA,GACR,qBAAA"}
@@ -0,0 +1,12 @@
1
+ import { projectSettingsShell } from "./projectors/settings-shell.mjs";
2
+
3
+ //#region src/auto-surface/projection.ts
4
+ function projectAutoSurface(resolved, options = {}) {
5
+ switch (options.projector ?? "settings-shell") {
6
+ case "settings-shell": return projectSettingsShell(resolved, { scope: options.scope });
7
+ }
8
+ }
9
+
10
+ //#endregion
11
+ export { projectAutoSurface };
12
+ //# sourceMappingURL=projection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.mjs","names":[],"sources":["../../src/auto-surface/projection.ts"],"sourcesContent":["import { projectSettingsShell } from \"./projectors/settings-shell.js\";\nimport type {\n AutoSurfaceLayer,\n AutoSurfaceProjection,\n AutoSurfaceProjectorName,\n AutoSurfaceResolvedRegistry,\n} from \"./types.js\";\n\nexport interface ProjectAutoSurfaceOptions {\n projector?: AutoSurfaceProjectorName;\n scope?: AutoSurfaceLayer | \"all\";\n}\n\nexport function projectAutoSurface(\n resolved: AutoSurfaceResolvedRegistry,\n options: ProjectAutoSurfaceOptions = {},\n): AutoSurfaceProjection {\n const projector = options.projector ?? \"settings-shell\";\n\n switch (projector) {\n case \"settings-shell\":\n return projectSettingsShell(resolved, { scope: options.scope });\n }\n}\n"],"mappings":";;;AAaA,SAAgB,mBACd,UACA,UAAqC,EAAE,EAChB;AAGvB,SAFkB,QAAQ,aAAa,kBAEvC;EACE,KAAK,iBACH,QAAO,qBAAqB,UAAU,EAAE,OAAO,QAAQ,OAAO,CAAC"}
@@ -0,0 +1,114 @@
1
+
2
+ //#region src/auto-surface/projectors/settings-shell.ts
3
+ function projectSettingsShell(resolved, options = {}) {
4
+ const scope = options.scope ?? "all";
5
+ const groups = /* @__PURE__ */ new Map();
6
+ for (const resource of Object.values(resolved.resources)) {
7
+ if (scope !== "all" && !resource.availableScopes.includes(scope)) continue;
8
+ const presentation = resource.definition.presentations?.["settings-shell"];
9
+ const groupTitle = presentation?.group ?? "General";
10
+ const pageTitle = presentation?.page ?? "General";
11
+ const sectionTitle = presentation?.section ?? "General";
12
+ ensureSection(ensurePage(ensureGroup(groups, groupTitle, presentation).pages, pageTitle, presentation).sections, sectionTitle, presentation).node.fields.push(projectField(resource, presentation));
13
+ }
14
+ return {
15
+ projector: "settings-shell",
16
+ scope,
17
+ groups: sortGroups(groups)
18
+ };
19
+ }
20
+ function ensureGroup(groups, title, presentation) {
21
+ const id = slugify(title);
22
+ let group = groups.get(id);
23
+ if (!group) {
24
+ group = {
25
+ order: presentation?.groupOrder ?? 0,
26
+ pages: /* @__PURE__ */ new Map(),
27
+ node: {
28
+ kind: "group",
29
+ id,
30
+ title,
31
+ pages: []
32
+ }
33
+ };
34
+ groups.set(id, group);
35
+ }
36
+ return group;
37
+ }
38
+ function ensurePage(pages, title, presentation) {
39
+ const id = slugify(title);
40
+ let page = pages.get(id);
41
+ if (!page) {
42
+ page = {
43
+ order: presentation?.pageOrder ?? 0,
44
+ sections: /* @__PURE__ */ new Map(),
45
+ node: {
46
+ kind: "page",
47
+ id,
48
+ title,
49
+ sections: []
50
+ }
51
+ };
52
+ pages.set(id, page);
53
+ }
54
+ return page;
55
+ }
56
+ function ensureSection(sections, title, presentation) {
57
+ const id = slugify(title);
58
+ let section = sections.get(id);
59
+ if (!section) {
60
+ section = {
61
+ order: presentation?.sectionOrder ?? 0,
62
+ node: {
63
+ kind: "section",
64
+ id,
65
+ title,
66
+ fields: []
67
+ }
68
+ };
69
+ sections.set(id, section);
70
+ }
71
+ return section;
72
+ }
73
+ function projectField(resource, presentation) {
74
+ return {
75
+ kind: "field",
76
+ id: resource.id,
77
+ title: presentation?.title ?? resource.definition.title ?? labelize(resource.id),
78
+ description: presentation?.description ?? resource.definition.description,
79
+ type: resource.definition.type,
80
+ value: resource.value,
81
+ source: resource.source,
82
+ options: resource.definition.options,
83
+ validation: resource.definition.validation,
84
+ policy: resource.definition.policy,
85
+ bindings: resource.definition.bindings
86
+ };
87
+ }
88
+ function sortGroups(groups) {
89
+ return [...groups.values()].sort(compareByOrderThenTitle).map((group) => ({
90
+ ...group.node,
91
+ pages: [...group.pages.values()].sort(compareByOrderThenTitle).map((page) => ({
92
+ ...page.node,
93
+ sections: [...page.sections.values()].sort(compareByOrderThenTitle).map((section) => ({
94
+ ...section.node,
95
+ fields: section.node.fields.sort(compareFields)
96
+ }))
97
+ }))
98
+ }));
99
+ }
100
+ function compareByOrderThenTitle(left, right) {
101
+ return left.order - right.order || left.node.title.localeCompare(right.node.title);
102
+ }
103
+ function compareFields(left, right) {
104
+ return left.title.localeCompare(right.title);
105
+ }
106
+ function labelize(value) {
107
+ return (value.split(".").pop() ?? value).replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (char) => char.toUpperCase());
108
+ }
109
+ function slugify(value) {
110
+ return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "general";
111
+ }
112
+
113
+ //#endregion
114
+ exports.projectSettingsShell = projectSettingsShell;
@@ -0,0 +1,10 @@
1
+ import { AutoSurfaceLayer, AutoSurfaceResolvedRegistry, AutoSurfaceSettingsShellProjection } from "../types.cjs";
2
+
3
+ //#region src/auto-surface/projectors/settings-shell.d.ts
4
+ interface ProjectSettingsShellOptions {
5
+ scope?: AutoSurfaceLayer | "all";
6
+ }
7
+ declare function projectSettingsShell(resolved: AutoSurfaceResolvedRegistry, options?: ProjectSettingsShellOptions): AutoSurfaceSettingsShellProjection;
8
+ //#endregion
9
+ export { ProjectSettingsShellOptions, projectSettingsShell };
10
+ //# sourceMappingURL=settings-shell.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-shell.d.cts","names":[],"sources":["../../../src/auto-surface/projectors/settings-shell.ts"],"mappings":";;;UAYiB,2BAAA;EACf,KAAA,GAAQ,gBAAA;AAAA;AAAA,iBAoBM,oBAAA,CACd,QAAA,EAAU,2BAAA,EACV,OAAA,GAAS,2BAAA,GACR,kCAAA"}
@@ -0,0 +1,10 @@
1
+ import { AutoSurfaceLayer, AutoSurfaceResolvedRegistry, AutoSurfaceSettingsShellProjection } from "../types.mjs";
2
+
3
+ //#region src/auto-surface/projectors/settings-shell.d.ts
4
+ interface ProjectSettingsShellOptions {
5
+ scope?: AutoSurfaceLayer | "all";
6
+ }
7
+ declare function projectSettingsShell(resolved: AutoSurfaceResolvedRegistry, options?: ProjectSettingsShellOptions): AutoSurfaceSettingsShellProjection;
8
+ //#endregion
9
+ export { ProjectSettingsShellOptions, projectSettingsShell };
10
+ //# sourceMappingURL=settings-shell.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-shell.d.mts","names":[],"sources":["../../../src/auto-surface/projectors/settings-shell.ts"],"mappings":";;;UAYiB,2BAAA;EACf,KAAA,GAAQ,gBAAA;AAAA;AAAA,iBAoBM,oBAAA,CACd,QAAA,EAAU,2BAAA,EACV,OAAA,GAAS,2BAAA,GACR,kCAAA"}