@aotter/mantle 0.2.0-alpha.6 → 0.2.0-alpha.7

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 (942) hide show
  1. package/README.md +152 -45
  2. package/dist/auth/adapter.d.ts +32 -0
  3. package/dist/auth/adapter.js +285 -0
  4. package/dist/auth/admin.d.ts +3 -0
  5. package/dist/auth/admin.js +21 -0
  6. package/dist/auth/caller.d.ts +86 -0
  7. package/dist/auth/caller.js +154 -0
  8. package/dist/auth/hardening.d.ts +24 -0
  9. package/dist/auth/hardening.js +40 -0
  10. package/dist/auth/identity.d.ts +121 -0
  11. package/dist/auth/identity.js +203 -0
  12. package/dist/auth/oauth.d.ts +31 -0
  13. package/dist/auth/oauth.js +124 -0
  14. package/dist/auth/resource-seeds.js +10 -0
  15. package/dist/auth/routes.d.ts +32 -0
  16. package/dist/auth/{createAuthRoutes.js → routes.js} +130 -35
  17. package/dist/build/compiler.d.ts +790 -0
  18. package/dist/build/compiler.js +6971 -0
  19. package/dist/{spec → build/spec}/domain/model/ManifestGrammar.d.ts +24 -42
  20. package/dist/{spec → build/spec}/domain/model/RuntimePlan.d.ts +77 -3
  21. package/dist/{spec → build/spec}/domain/model/SqlIr.d.ts +35 -6
  22. package/dist/build/spec/domain/model/UserFields.d.ts +20 -0
  23. package/dist/{spec → build/spec}/domain/service/PlanFingerprint.d.ts +2 -1
  24. package/dist/{spec → build/spec}/kernel/diagnostic.d.ts +1 -30
  25. package/dist/bun/assets.d.ts +2 -0
  26. package/dist/bun/assets.js +24 -0
  27. package/dist/domain/adminOrder.js +24 -0
  28. package/dist/domain/columns.js +55 -0
  29. package/dist/domain/describe/chunk-ZIQVLA7X.js +363 -0
  30. package/dist/domain/describe/index.d.ts +58 -0
  31. package/dist/domain/describe/index.js +115 -0
  32. package/dist/domain/describe/target-hash.d.ts +8 -0
  33. package/dist/domain/describe/target-hash.js +12 -0
  34. package/dist/domain/describe/targets.d.ts +40 -0
  35. package/dist/domain/entry.js +33 -0
  36. package/dist/domain/generated-tools.js +17 -0
  37. package/dist/domain/generation.d.ts +16 -0
  38. package/dist/domain/generation.js +1 -0
  39. package/dist/domain/input.js +17 -0
  40. package/dist/domain/model.js +1 -0
  41. package/dist/domain/paging.js +204 -0
  42. package/dist/domain/recipes.js +19 -0
  43. package/dist/domain/userReferences.js +5 -0
  44. package/dist/domain/wireScalars.js +47 -0
  45. package/dist/infrastructure/adminEntries.js +153 -0
  46. package/dist/infrastructure/adminPaging.js +72 -0
  47. package/dist/infrastructure/artifacts.js +71 -0
  48. package/dist/infrastructure/authSchema.js +83 -0
  49. package/dist/infrastructure/bundle.js +84 -0
  50. package/dist/infrastructure/cli.js +101 -0
  51. package/dist/infrastructure/generate.d.ts +14 -0
  52. package/dist/infrastructure/generate.js +174 -0
  53. package/dist/infrastructure/generateAuth.d.ts +8 -0
  54. package/dist/infrastructure/generateAuth.js +17 -0
  55. package/dist/infrastructure/inputs.js +36 -0
  56. package/dist/infrastructure/wrangler.js +71 -0
  57. package/dist/kernel/authorization.d.ts +4 -0
  58. package/dist/kernel/authorization.js +16 -0
  59. package/dist/kernel/binds.d.ts +51 -0
  60. package/dist/kernel/binds.js +45 -0
  61. package/dist/kernel/caller-identity.d.ts +24 -0
  62. package/dist/kernel/caller-identity.js +22 -0
  63. package/dist/kernel/contract-error.d.ts +12 -0
  64. package/dist/kernel/contract-error.js +14 -0
  65. package/dist/kernel/contracts.d.ts +139 -0
  66. package/dist/kernel/contracts.js +92 -0
  67. package/dist/{spec/domain/service/CloudflareCron.d.ts → kernel/cron.d.ts} +0 -1
  68. package/dist/{spec/domain/service/CloudflareCron.js → kernel/cron.js} +1 -6
  69. package/dist/kernel/dialect/common.d.ts +39 -0
  70. package/dist/kernel/dialect/common.js +6 -0
  71. package/dist/kernel/dialect/postgres.d.ts +16 -0
  72. package/dist/kernel/dialect/postgres.js +18 -0
  73. package/dist/kernel/dialect/sqlite.d.ts +20 -0
  74. package/dist/kernel/dialect/sqlite.js +34 -0
  75. package/dist/kernel/driver/bun-sqlite.d.ts +19 -0
  76. package/dist/kernel/driver/bun-sqlite.js +77 -0
  77. package/dist/kernel/driver/d1.d.ts +24 -0
  78. package/dist/kernel/driver/d1.js +22 -0
  79. package/dist/kernel/driver/postgres.d.ts +25 -0
  80. package/dist/kernel/driver/postgres.js +95 -0
  81. package/dist/kernel/driver/transaction-context.d.ts +10 -0
  82. package/dist/kernel/driver/transaction-context.js +29 -0
  83. package/dist/kernel/email.d.ts +28 -0
  84. package/dist/{auth/emailTemplates.js → kernel/email.js} +13 -2
  85. package/dist/kernel/host-access.d.ts +10 -0
  86. package/dist/kernel/host-access.js +65 -0
  87. package/dist/kernel/host-caller.d.ts +38 -0
  88. package/dist/kernel/host-caller.js +55 -0
  89. package/dist/kernel/json-body.d.ts +4 -0
  90. package/dist/kernel/json-body.js +44 -0
  91. package/dist/kernel/mcp-apps.d.ts +49 -0
  92. package/dist/kernel/mcp-apps.js +40 -0
  93. package/dist/kernel/mcp-call.d.ts +5 -0
  94. package/dist/kernel/mcp-call.js +25 -0
  95. package/dist/kernel/mcp-handler.js +288 -0
  96. package/dist/kernel/mcp.d.ts +101 -0
  97. package/dist/kernel/mcp.js +25 -0
  98. package/dist/kernel/media.d.ts +27 -0
  99. package/dist/kernel/media.js +216 -0
  100. package/dist/kernel/paging.d.ts +55 -0
  101. package/dist/kernel/paging.js +95 -0
  102. package/dist/kernel/publishing.d.ts +4 -0
  103. package/dist/kernel/publishing.js +16 -0
  104. package/dist/{cloudflare/r2Media.d.ts → kernel/r2-media.d.ts} +4 -5
  105. package/dist/kernel/r2-media.js +78 -0
  106. package/dist/kernel/rest-dispatch.js +38 -0
  107. package/dist/kernel/rest-router.js +63 -0
  108. package/dist/kernel/rest.d.ts +58 -0
  109. package/dist/kernel/rest.js +41 -0
  110. package/dist/kernel/scalars.d.ts +6 -0
  111. package/dist/kernel/scalars.js +43 -0
  112. package/dist/kernel/search.js +5 -0
  113. package/dist/{core/site.d.ts → kernel/site-types.d.ts} +38 -9
  114. package/dist/kernel/site-types.js +1 -0
  115. package/dist/kernel/site.d.ts +41 -0
  116. package/dist/kernel/site.js +32 -0
  117. package/dist/kernel/store.d.ts +165 -0
  118. package/dist/kernel/store.js +257 -0
  119. package/dist/kernel/surface.d.ts +10 -0
  120. package/dist/kernel/surface.js +19 -0
  121. package/dist/kernel/sweep.d.ts +17 -0
  122. package/dist/kernel/sweep.js +27 -0
  123. package/dist/kernel/translations.d.ts +1 -0
  124. package/dist/kernel/translations.js +13 -0
  125. package/dist/kernel/user-caller.d.ts +31 -0
  126. package/dist/kernel/user-caller.js +67 -0
  127. package/dist/kernel/user-field-name.js +3 -0
  128. package/dist/kernel/user-fields.d.ts +34 -0
  129. package/dist/kernel/user-fields.js +71 -0
  130. package/dist/kernel/validation.d.ts +15 -0
  131. package/dist/kernel/validation.js +54 -0
  132. package/dist/kernel/web-gateway.js +68 -0
  133. package/dist/kernel/web-head.js +15 -0
  134. package/dist/kernel/web-response.js +8 -0
  135. package/dist/kernel/web.d.ts +75 -0
  136. package/dist/kernel/web.js +155 -0
  137. package/dist/kernel/where.js +27 -0
  138. package/dist/testing/index.d.ts +1 -37
  139. package/dist/testing/index.js +1 -43
  140. package/dist/usecase/adminBindings.js +142 -0
  141. package/dist/usecase/adminDescriptors.js +153 -0
  142. package/dist/usecase/generate.js +164 -0
  143. package/dist/usecase/handlers.js +21 -0
  144. package/dist/usecase/mcp-media.js +17 -0
  145. package/dist/usecase/mcp.js +96 -0
  146. package/dist/usecase/paging.js +72 -0
  147. package/dist/usecase/publishing.js +63 -0
  148. package/dist/usecase/refusals.js +27 -0
  149. package/dist/usecase/rest.js +54 -0
  150. package/dist/usecase/search.js +7 -0
  151. package/dist/usecase/site.js +40 -0
  152. package/dist/usecase/stores.js +62 -0
  153. package/dist/usecase/translations.js +78 -0
  154. package/dist/usecase/ttl.js +20 -0
  155. package/dist/usecase/validation.js +132 -0
  156. package/dist/usecase/web.js +22 -0
  157. package/docs/examples/README.md +31 -16
  158. package/docs/examples/app-shell/README.md +48 -0
  159. package/docs/examples/app-shell/package.json +34 -0
  160. package/docs/examples/app-shell/pnpm-workspace.yaml +8 -0
  161. package/docs/examples/app-shell/smoke-kit.mjs +100 -0
  162. package/docs/examples/app-shell/src/admin.ts +10 -0
  163. package/docs/examples/app-shell/src/auth.ts +55 -0
  164. package/docs/examples/app-shell/src/handlers.ts +5 -0
  165. package/docs/examples/app-shell/src/index.ts +4 -0
  166. package/docs/examples/app-shell/src/routes.ts +13 -0
  167. package/docs/examples/app-shell/src/schedule.ts +8 -0
  168. package/docs/examples/app-shell/src/service.ts +70 -0
  169. package/docs/examples/app-shell/src/sign-in.ts +41 -0
  170. package/docs/examples/app-shell/src/signup.ts +8 -0
  171. package/docs/examples/{reference-service → app-shell}/tsconfig.json +2 -1
  172. package/docs/examples/app-shell/worker-configuration.d.ts +22 -0
  173. package/docs/examples/app-shell/wrangler.jsonc +61 -0
  174. package/docs/examples/club-events/README.md +60 -0
  175. package/docs/examples/club-events/manifests/club-events.yaml +225 -0
  176. package/docs/examples/club-events/smoke.mjs +121 -0
  177. package/docs/examples/club-events/src/handlers.ts +25 -0
  178. package/docs/examples/club-events/src/signup.ts +9 -0
  179. package/docs/examples/generated-web/README.md +74 -0
  180. package/docs/examples/generated-web/posts.yaml +38 -0
  181. package/docs/examples/generated-web/seed.sql +6 -0
  182. package/docs/examples/generated-web/src/worker.ts +43 -0
  183. package/docs/examples/generated-web/tsconfig.json +8 -0
  184. package/docs/examples/generated-web/wrangler.jsonc +7 -0
  185. package/docs/examples/purchasing/.dev.vars.example +6 -0
  186. package/docs/examples/purchasing/README.md +90 -0
  187. package/docs/examples/purchasing/manifests/purchasing.yaml +341 -0
  188. package/docs/examples/purchasing/seed.sql +4 -0
  189. package/docs/examples/purchasing/smoke.mjs +171 -0
  190. package/docs/examples/purchasing/src/admin.ts +12 -0
  191. package/docs/examples/purchasing/src/handlers.ts +33 -0
  192. package/docs/examples/purchasing/src/notify.ts +29 -0
  193. package/docs/examples/purchasing/src/requests-page.ts +57 -0
  194. package/docs/examples/purchasing/src/routes.ts +53 -0
  195. package/docs/examples/purchasing/src/schedule.ts +31 -0
  196. package/docs/examples/purchasing/src/signup.ts +5 -0
  197. package/docs/examples/purchasing/src/supplier.ts +32 -0
  198. package/docs/examples/purchasing/wrangler.jsonc +68 -0
  199. package/docs/examples/recipes/README.md +58 -0
  200. package/docs/examples/recipes/manifests/recipes.yaml +75 -0
  201. package/docs/examples/recipes/smoke.mjs +102 -0
  202. package/docs/examples/recipes/src/media.ts +13 -0
  203. package/docs/examples/recipes/src/pages.ts +99 -0
  204. package/docs/examples/recipes/src/routes.ts +71 -0
  205. package/docs/examples/recipes/src/site-config.ts +12 -0
  206. package/docs/examples/recipes/wrangler.jsonc +73 -0
  207. package/docs/handbook/cloudflare/authentication.md +142 -212
  208. package/docs/handbook/cloudflare/chatgpt-sites.md +4 -113
  209. package/docs/handbook/cloudflare/deploy-and-operate.md +20 -106
  210. package/docs/handbook/cloudflare/media-r2.md +62 -133
  211. package/docs/handbook/cloudflare/service-entry.md +180 -116
  212. package/docs/handbook/concepts/authorization.md +10 -123
  213. package/docs/handbook/concepts/four-atoms.md +9 -92
  214. package/docs/handbook/concepts/lifecycle-and-locales.md +9 -80
  215. package/docs/handbook/concepts/mcp-and-agents.md +10 -141
  216. package/docs/handbook/concepts/procedures-and-triggers.md +5 -162
  217. package/docs/handbook/concepts/runtime-and-adapters.md +15 -224
  218. package/docs/handbook/concepts/views.md +10 -109
  219. package/docs/handbook/examples/hub.md +2 -18
  220. package/docs/handbook/guides/adapter-guide.md +11 -0
  221. package/docs/handbook/guides/admin-extensions.md +12 -183
  222. package/docs/handbook/guides/admin-ui.md +5 -164
  223. package/docs/handbook/guides/agent-setup.md +5 -18
  224. package/docs/handbook/guides/email.md +86 -0
  225. package/docs/handbook/guides/mcp-apps.md +44 -0
  226. package/docs/handbook/guides/native-admin.md +298 -0
  227. package/docs/handbook/guides/native-execution.md +132 -0
  228. package/docs/handbook/guides/oauth.md +105 -0
  229. package/docs/handbook/guides/postgres-adapters.md +56 -0
  230. package/docs/handbook/guides/public-pages.md +53 -0
  231. package/docs/handbook/guides/size-and-startup.md +9 -0
  232. package/docs/handbook/guides/typed-queries.md +39 -102
  233. package/docs/handbook/navigation.json +164 -31
  234. package/docs/handbook/reference/admin-descriptors.md +88 -0
  235. package/docs/handbook/reference/authorization.md +44 -52
  236. package/docs/handbook/reference/describe.md +56 -0
  237. package/docs/handbook/reference/diagnostics.md +15 -79
  238. package/docs/handbook/reference/features.md +45 -53
  239. package/docs/handbook/reference/manifest.md +6 -69
  240. package/docs/handbook/reference/procedure.md +9 -118
  241. package/docs/handbook/reference/schema.md +75 -185
  242. package/docs/handbook/reference/site-config.md +5 -65
  243. package/docs/handbook/reference/surface.md +279 -97
  244. package/docs/handbook/reference/trigger.md +24 -93
  245. package/docs/handbook/reference/view.md +32 -160
  246. package/docs/handbook/releases/index.md +48 -13
  247. package/docs/handbook/start/overview.md +9 -56
  248. package/docs/handbook/start/project-and-cli.md +40 -149
  249. package/docs/handbook/start/quickstart-worker.md +38 -116
  250. package/docs/skills/develop/SKILL.md +34 -123
  251. package/docs/skills/develop/mcp-app.md +37 -77
  252. package/docs/skills/integrate/SKILL.md +42 -84
  253. package/docs/skills/media-gc/SKILL.md +14 -3
  254. package/docs/skills/provision/SKILL.md +25 -91
  255. package/docs/skills/update/SKILL.md +19 -43
  256. package/docs/source/scripts/postgres-adapter.ts +101 -0
  257. package/docs/upgrade-0.1-to-0.2.md +25 -9
  258. package/package.json +96 -112
  259. package/skills/.keep +0 -0
  260. package/skills/README.md +72 -0
  261. package/skills/mantle/SKILL.md +135 -0
  262. package/skills/mantle/references/local-testing.md +11 -0
  263. package/skills/mantle/references/web.md +41 -0
  264. package/skills/mantle/references/website.md +47 -0
  265. package/dist/admin/consent.d.ts +0 -17
  266. package/dist/admin/consent.d.ts.map +0 -1
  267. package/dist/admin/consent.js +0 -17
  268. package/dist/admin/consent.js.map +0 -1
  269. package/dist/admin/createAdminSurface.d.ts +0 -25
  270. package/dist/admin/createAdminSurface.d.ts.map +0 -1
  271. package/dist/admin/createAdminSurface.js +0 -635
  272. package/dist/admin/createAdminSurface.js.map +0 -1
  273. package/dist/admin/design.d.ts +0 -7
  274. package/dist/admin/design.d.ts.map +0 -1
  275. package/dist/admin/design.js +0 -18
  276. package/dist/admin/design.js.map +0 -1
  277. package/dist/admin/developerConsole.d.ts +0 -267
  278. package/dist/admin/developerConsole.d.ts.map +0 -1
  279. package/dist/admin/developerConsole.js +0 -136
  280. package/dist/admin/developerConsole.js.map +0 -1
  281. package/dist/admin/extensions.d.ts +0 -290
  282. package/dist/admin/extensions.d.ts.map +0 -1
  283. package/dist/admin/extensions.js +0 -532
  284. package/dist/admin/extensions.js.map +0 -1
  285. package/dist/admin/identity.d.ts +0 -62
  286. package/dist/admin/identity.d.ts.map +0 -1
  287. package/dist/admin/identity.js +0 -7
  288. package/dist/admin/identity.js.map +0 -1
  289. package/dist/admin/index.d.ts +0 -7
  290. package/dist/admin/index.d.ts.map +0 -1
  291. package/dist/admin/index.js +0 -7
  292. package/dist/admin/index.js.map +0 -1
  293. package/dist/admin/procedureFlow.d.ts +0 -38
  294. package/dist/admin/procedureFlow.d.ts.map +0 -1
  295. package/dist/admin/procedureFlow.js +0 -188
  296. package/dist/admin/procedureFlow.js.map +0 -1
  297. package/dist/auth/ConsoleEmailSender.d.ts +0 -15
  298. package/dist/auth/ConsoleEmailSender.d.ts.map +0 -1
  299. package/dist/auth/ConsoleEmailSender.js +0 -19
  300. package/dist/auth/ConsoleEmailSender.js.map +0 -1
  301. package/dist/auth/appleClientSecret.d.ts +0 -75
  302. package/dist/auth/appleClientSecret.d.ts.map +0 -1
  303. package/dist/auth/appleClientSecret.js +0 -116
  304. package/dist/auth/appleClientSecret.js.map +0 -1
  305. package/dist/auth/buildAuth.d.ts +0 -4568
  306. package/dist/auth/buildAuth.d.ts.map +0 -1
  307. package/dist/auth/buildAuth.js +0 -312
  308. package/dist/auth/buildAuth.js.map +0 -1
  309. package/dist/auth/callerResolver.d.ts +0 -52
  310. package/dist/auth/callerResolver.d.ts.map +0 -1
  311. package/dist/auth/callerResolver.js +0 -52
  312. package/dist/auth/callerResolver.js.map +0 -1
  313. package/dist/auth/createAuthRoutes.d.ts +0 -22
  314. package/dist/auth/createAuthRoutes.d.ts.map +0 -1
  315. package/dist/auth/createAuthRoutes.js.map +0 -1
  316. package/dist/auth/createMantleAuth.d.ts +0 -3
  317. package/dist/auth/createMantleAuth.d.ts.map +0 -1
  318. package/dist/auth/createMantleAuth.js +0 -504
  319. package/dist/auth/createMantleAuth.js.map +0 -1
  320. package/dist/auth/db.d.ts +0 -18
  321. package/dist/auth/db.d.ts.map +0 -1
  322. package/dist/auth/db.js +0 -27
  323. package/dist/auth/db.js.map +0 -1
  324. package/dist/auth/emailTemplates.d.ts +0 -7
  325. package/dist/auth/emailTemplates.d.ts.map +0 -1
  326. package/dist/auth/emailTemplates.js.map +0 -1
  327. package/dist/auth/index.d.ts +0 -9
  328. package/dist/auth/index.d.ts.map +0 -1
  329. package/dist/auth/index.js +0 -7
  330. package/dist/auth/index.js.map +0 -1
  331. package/dist/auth/methods.d.ts +0 -717
  332. package/dist/auth/methods.d.ts.map +0 -1
  333. package/dist/auth/methods.js +0 -321
  334. package/dist/auth/methods.js.map +0 -1
  335. package/dist/auth/oauthTokens.d.ts +0 -24
  336. package/dist/auth/oauthTokens.d.ts.map +0 -1
  337. package/dist/auth/oauthTokens.js +0 -146
  338. package/dist/auth/oauthTokens.js.map +0 -1
  339. package/dist/auth/setupIncomplete.d.ts +0 -16
  340. package/dist/auth/setupIncomplete.d.ts.map +0 -1
  341. package/dist/auth/setupIncomplete.js +0 -50
  342. package/dist/auth/setupIncomplete.js.map +0 -1
  343. package/dist/auth/types.d.ts +0 -440
  344. package/dist/auth/types.d.ts.map +0 -1
  345. package/dist/auth/types.js +0 -10
  346. package/dist/auth/types.js.map +0 -1
  347. package/dist/bun/index.d.ts +0 -21
  348. package/dist/bun/index.d.ts.map +0 -1
  349. package/dist/bun/index.js +0 -46
  350. package/dist/bun/index.js.map +0 -1
  351. package/dist/cli/emitModule.d.ts +0 -7
  352. package/dist/cli/emitModule.d.ts.map +0 -1
  353. package/dist/cli/emitModule.js +0 -127
  354. package/dist/cli/emitModule.js.map +0 -1
  355. package/dist/cli/generate.d.ts +0 -8
  356. package/dist/cli/generate.d.ts.map +0 -1
  357. package/dist/cli/generate.js +0 -391
  358. package/dist/cli/generate.js.map +0 -1
  359. package/dist/cli/main.d.ts +0 -3
  360. package/dist/cli/main.d.ts.map +0 -1
  361. package/dist/cli/main.js +0 -21
  362. package/dist/cli/main.js.map +0 -1
  363. package/dist/cli/preset.d.ts +0 -18
  364. package/dist/cli/preset.d.ts.map +0 -1
  365. package/dist/cli/preset.js +0 -405
  366. package/dist/cli/preset.js.map +0 -1
  367. package/dist/cloudflare/index.d.ts +0 -25
  368. package/dist/cloudflare/index.d.ts.map +0 -1
  369. package/dist/cloudflare/index.js +0 -16
  370. package/dist/cloudflare/index.js.map +0 -1
  371. package/dist/cloudflare/r2Media.d.ts.map +0 -1
  372. package/dist/cloudflare/r2Media.js +0 -69
  373. package/dist/cloudflare/r2Media.js.map +0 -1
  374. package/dist/core/caller.d.ts +0 -35
  375. package/dist/core/caller.d.ts.map +0 -1
  376. package/dist/core/caller.js +0 -3
  377. package/dist/core/caller.js.map +0 -1
  378. package/dist/core/createMantle.d.ts +0 -22
  379. package/dist/core/createMantle.d.ts.map +0 -1
  380. package/dist/core/createMantle.js +0 -117
  381. package/dist/core/createMantle.js.map +0 -1
  382. package/dist/core/dialect.d.ts +0 -53
  383. package/dist/core/dialect.d.ts.map +0 -1
  384. package/dist/core/dialect.js +0 -7
  385. package/dist/core/dialect.js.map +0 -1
  386. package/dist/core/driver.d.ts +0 -24
  387. package/dist/core/driver.d.ts.map +0 -1
  388. package/dist/core/driver.js +0 -2
  389. package/dist/core/driver.js.map +0 -1
  390. package/dist/core/email.d.ts +0 -17
  391. package/dist/core/email.d.ts.map +0 -1
  392. package/dist/core/email.js +0 -2
  393. package/dist/core/email.js.map +0 -1
  394. package/dist/core/index.d.ts +0 -16
  395. package/dist/core/index.d.ts.map +0 -1
  396. package/dist/core/index.js +0 -16
  397. package/dist/core/index.js.map +0 -1
  398. package/dist/core/invocation.d.ts +0 -66
  399. package/dist/core/invocation.d.ts.map +0 -1
  400. package/dist/core/invocation.js +0 -3
  401. package/dist/core/invocation.js.map +0 -1
  402. package/dist/core/observation.d.ts +0 -3
  403. package/dist/core/observation.d.ts.map +0 -1
  404. package/dist/core/observation.js +0 -10
  405. package/dist/core/observation.js.map +0 -1
  406. package/dist/core/runtime/auth.d.ts +0 -9
  407. package/dist/core/runtime/auth.d.ts.map +0 -1
  408. package/dist/core/runtime/auth.js +0 -39
  409. package/dist/core/runtime/auth.js.map +0 -1
  410. package/dist/core/runtime/createRuntime.d.ts +0 -23
  411. package/dist/core/runtime/createRuntime.d.ts.map +0 -1
  412. package/dist/core/runtime/createRuntime.js +0 -214
  413. package/dist/core/runtime/createRuntime.js.map +0 -1
  414. package/dist/core/runtime/verifyPlan.d.ts +0 -34
  415. package/dist/core/runtime/verifyPlan.d.ts.map +0 -1
  416. package/dist/core/runtime/verifyPlan.js +0 -301
  417. package/dist/core/runtime/verifyPlan.js.map +0 -1
  418. package/dist/core/service.d.ts +0 -45
  419. package/dist/core/service.d.ts.map +0 -1
  420. package/dist/core/service.js +0 -2
  421. package/dist/core/service.js.map +0 -1
  422. package/dist/core/sessionUser.d.ts +0 -14
  423. package/dist/core/sessionUser.d.ts.map +0 -1
  424. package/dist/core/sessionUser.js +0 -4
  425. package/dist/core/sessionUser.js.map +0 -1
  426. package/dist/core/site.d.ts.map +0 -1
  427. package/dist/core/site.js +0 -2
  428. package/dist/core/site.js.map +0 -1
  429. package/dist/core/siteConfig.d.ts +0 -5
  430. package/dist/core/siteConfig.d.ts.map +0 -1
  431. package/dist/core/siteConfig.js +0 -24
  432. package/dist/core/siteConfig.js.map +0 -1
  433. package/dist/core/sql/allowlist.d.ts +0 -67
  434. package/dist/core/sql/allowlist.d.ts.map +0 -1
  435. package/dist/core/sql/allowlist.js +0 -737
  436. package/dist/core/sql/allowlist.js.map +0 -1
  437. package/dist/core/sql/ast.d.ts +0 -24
  438. package/dist/core/sql/ast.d.ts.map +0 -1
  439. package/dist/core/sql/ast.js +0 -32
  440. package/dist/core/sql/ast.js.map +0 -1
  441. package/dist/core/sql/compile.d.ts +0 -50
  442. package/dist/core/sql/compile.d.ts.map +0 -1
  443. package/dist/core/sql/compile.js +0 -48
  444. package/dist/core/sql/compile.js.map +0 -1
  445. package/dist/core/sql/policy.d.ts +0 -123
  446. package/dist/core/sql/policy.d.ts.map +0 -1
  447. package/dist/core/sql/policy.js +0 -398
  448. package/dist/core/sql/policy.js.map +0 -1
  449. package/dist/core/sql/positions.d.ts +0 -30
  450. package/dist/core/sql/positions.d.ts.map +0 -1
  451. package/dist/core/sql/positions.js +0 -22
  452. package/dist/core/sql/positions.js.map +0 -1
  453. package/dist/core/sql/run.d.ts +0 -68
  454. package/dist/core/sql/run.d.ts.map +0 -1
  455. package/dist/core/sql/run.js +0 -384
  456. package/dist/core/sql/run.js.map +0 -1
  457. package/dist/core/store/createStore.d.ts +0 -49
  458. package/dist/core/store/createStore.d.ts.map +0 -1
  459. package/dist/core/store/createStore.js +0 -227
  460. package/dist/core/store/createStore.js.map +0 -1
  461. package/dist/core/store/cursor.d.ts +0 -4
  462. package/dist/core/store/cursor.d.ts.map +0 -1
  463. package/dist/core/store/cursor.js +0 -22
  464. package/dist/core/store/cursor.js.map +0 -1
  465. package/dist/core/store/json.d.ts +0 -80
  466. package/dist/core/store/json.d.ts.map +0 -1
  467. package/dist/core/store/json.js +0 -342
  468. package/dist/core/store/json.js.map +0 -1
  469. package/dist/core/store.d.ts +0 -160
  470. package/dist/core/store.d.ts.map +0 -1
  471. package/dist/core/store.js +0 -2
  472. package/dist/core/store.js.map +0 -1
  473. package/dist/core/wire.d.ts +0 -20
  474. package/dist/core/wire.d.ts.map +0 -1
  475. package/dist/core/wire.js +0 -84
  476. package/dist/core/wire.js.map +0 -1
  477. package/dist/core/withCaller.d.ts +0 -24
  478. package/dist/core/withCaller.d.ts.map +0 -1
  479. package/dist/core/withCaller.js +0 -35
  480. package/dist/core/withCaller.js.map +0 -1
  481. package/dist/d1/adapter.d.ts +0 -12
  482. package/dist/d1/adapter.d.ts.map +0 -1
  483. package/dist/d1/adapter.js +0 -23
  484. package/dist/d1/adapter.js.map +0 -1
  485. package/dist/d1/codec.d.ts +0 -14
  486. package/dist/d1/codec.d.ts.map +0 -1
  487. package/dist/d1/codec.js +0 -136
  488. package/dist/d1/codec.js.map +0 -1
  489. package/dist/d1/compile/index.d.ts +0 -9
  490. package/dist/d1/compile/index.d.ts.map +0 -1
  491. package/dist/d1/compile/index.js +0 -9
  492. package/dist/d1/compile/index.js.map +0 -1
  493. package/dist/d1/dialect.d.ts +0 -4
  494. package/dist/d1/dialect.d.ts.map +0 -1
  495. package/dist/d1/dialect.js +0 -13
  496. package/dist/d1/dialect.js.map +0 -1
  497. package/dist/d1/executor.d.ts +0 -15
  498. package/dist/d1/executor.d.ts.map +0 -1
  499. package/dist/d1/executor.js +0 -96
  500. package/dist/d1/executor.js.map +0 -1
  501. package/dist/d1/index.d.ts +0 -6
  502. package/dist/d1/index.d.ts.map +0 -1
  503. package/dist/d1/index.js +0 -6
  504. package/dist/d1/index.js.map +0 -1
  505. package/dist/d1/lower.d.ts +0 -8
  506. package/dist/d1/lower.d.ts.map +0 -1
  507. package/dist/d1/lower.js +0 -167
  508. package/dist/d1/lower.js.map +0 -1
  509. package/dist/d1/media.d.ts +0 -5
  510. package/dist/d1/media.d.ts.map +0 -1
  511. package/dist/d1/media.js +0 -157
  512. package/dist/d1/media.js.map +0 -1
  513. package/dist/d1/migrations.d.ts +0 -12
  514. package/dist/d1/migrations.d.ts.map +0 -1
  515. package/dist/d1/migrations.js +0 -111
  516. package/dist/d1/migrations.js.map +0 -1
  517. package/dist/d1/print.d.ts +0 -28
  518. package/dist/d1/print.d.ts.map +0 -1
  519. package/dist/d1/print.js +0 -54
  520. package/dist/d1/print.js.map +0 -1
  521. package/dist/d1/site.d.ts +0 -17
  522. package/dist/d1/site.d.ts.map +0 -1
  523. package/dist/d1/site.js +0 -63
  524. package/dist/d1/site.js.map +0 -1
  525. package/dist/d1/storage.d.ts +0 -34
  526. package/dist/d1/storage.d.ts.map +0 -1
  527. package/dist/d1/storage.js +0 -288
  528. package/dist/d1/storage.js.map +0 -1
  529. package/dist/d1/tz.d.ts +0 -21
  530. package/dist/d1/tz.d.ts.map +0 -1
  531. package/dist/d1/tz.js +0 -54
  532. package/dist/d1/tz.js.map +0 -1
  533. package/dist/d1/validator.d.ts +0 -10
  534. package/dist/d1/validator.d.ts.map +0 -1
  535. package/dist/d1/validator.js +0 -33
  536. package/dist/d1/validator.js.map +0 -1
  537. package/dist/mcp/apps.d.ts +0 -43
  538. package/dist/mcp/apps.d.ts.map +0 -1
  539. package/dist/mcp/apps.js +0 -57
  540. package/dist/mcp/apps.js.map +0 -1
  541. package/dist/mcp/catalog.d.ts +0 -55
  542. package/dist/mcp/catalog.d.ts.map +0 -1
  543. package/dist/mcp/catalog.js +0 -81
  544. package/dist/mcp/catalog.js.map +0 -1
  545. package/dist/mcp/createMcpSurface.d.ts +0 -60
  546. package/dist/mcp/createMcpSurface.d.ts.map +0 -1
  547. package/dist/mcp/createMcpSurface.js +0 -182
  548. package/dist/mcp/createMcpSurface.js.map +0 -1
  549. package/dist/mcp/index.d.ts +0 -4
  550. package/dist/mcp/index.d.ts.map +0 -1
  551. package/dist/mcp/index.js +0 -4
  552. package/dist/mcp/index.js.map +0 -1
  553. package/dist/mcp/media.d.ts +0 -9
  554. package/dist/mcp/media.d.ts.map +0 -1
  555. package/dist/mcp/media.js +0 -33
  556. package/dist/mcp/media.js.map +0 -1
  557. package/dist/postgres/adapter.d.ts +0 -23
  558. package/dist/postgres/adapter.d.ts.map +0 -1
  559. package/dist/postgres/adapter.js +0 -50
  560. package/dist/postgres/adapter.js.map +0 -1
  561. package/dist/postgres/codec.d.ts +0 -13
  562. package/dist/postgres/codec.d.ts.map +0 -1
  563. package/dist/postgres/codec.js +0 -110
  564. package/dist/postgres/codec.js.map +0 -1
  565. package/dist/postgres/compile/index.d.ts +0 -9
  566. package/dist/postgres/compile/index.d.ts.map +0 -1
  567. package/dist/postgres/compile/index.js +0 -9
  568. package/dist/postgres/compile/index.js.map +0 -1
  569. package/dist/postgres/driver.d.ts +0 -109
  570. package/dist/postgres/driver.d.ts.map +0 -1
  571. package/dist/postgres/driver.js +0 -186
  572. package/dist/postgres/driver.js.map +0 -1
  573. package/dist/postgres/executor.d.ts +0 -28
  574. package/dist/postgres/executor.d.ts.map +0 -1
  575. package/dist/postgres/executor.js +0 -96
  576. package/dist/postgres/executor.js.map +0 -1
  577. package/dist/postgres/index.d.ts +0 -8
  578. package/dist/postgres/index.d.ts.map +0 -1
  579. package/dist/postgres/index.js +0 -8
  580. package/dist/postgres/index.js.map +0 -1
  581. package/dist/postgres/lower.d.ts +0 -6
  582. package/dist/postgres/lower.d.ts.map +0 -1
  583. package/dist/postgres/lower.js +0 -152
  584. package/dist/postgres/lower.js.map +0 -1
  585. package/dist/postgres/print.d.ts +0 -11
  586. package/dist/postgres/print.d.ts.map +0 -1
  587. package/dist/postgres/print.js +0 -108
  588. package/dist/postgres/print.js.map +0 -1
  589. package/dist/postgres/session.d.ts +0 -9
  590. package/dist/postgres/session.d.ts.map +0 -1
  591. package/dist/postgres/session.js +0 -111
  592. package/dist/postgres/session.js.map +0 -1
  593. package/dist/postgres/storage.d.ts +0 -32
  594. package/dist/postgres/storage.d.ts.map +0 -1
  595. package/dist/postgres/storage.js +0 -283
  596. package/dist/postgres/storage.js.map +0 -1
  597. package/dist/postgres/validator.d.ts +0 -13
  598. package/dist/postgres/validator.d.ts.map +0 -1
  599. package/dist/postgres/validator.js +0 -53
  600. package/dist/postgres/validator.js.map +0 -1
  601. package/dist/spec/domain/index.d.ts +0 -3
  602. package/dist/spec/domain/index.d.ts.map +0 -1
  603. package/dist/spec/domain/index.js +0 -3
  604. package/dist/spec/domain/index.js.map +0 -1
  605. package/dist/spec/domain/model/ContentState.d.ts +0 -8
  606. package/dist/spec/domain/model/ContentState.d.ts.map +0 -1
  607. package/dist/spec/domain/model/ContentState.js +0 -7
  608. package/dist/spec/domain/model/ContentState.js.map +0 -1
  609. package/dist/spec/domain/model/Entry.d.ts +0 -29
  610. package/dist/spec/domain/model/Entry.d.ts.map +0 -1
  611. package/dist/spec/domain/model/Entry.js +0 -16
  612. package/dist/spec/domain/model/Entry.js.map +0 -1
  613. package/dist/spec/domain/model/Locale.d.ts +0 -30
  614. package/dist/spec/domain/model/Locale.d.ts.map +0 -1
  615. package/dist/spec/domain/model/Locale.js +0 -33
  616. package/dist/spec/domain/model/Locale.js.map +0 -1
  617. package/dist/spec/domain/model/ManifestGrammar.d.ts.map +0 -1
  618. package/dist/spec/domain/model/ManifestGrammar.js +0 -153
  619. package/dist/spec/domain/model/ManifestGrammar.js.map +0 -1
  620. package/dist/spec/domain/model/MediaMimeAccept.d.ts +0 -55
  621. package/dist/spec/domain/model/MediaMimeAccept.d.ts.map +0 -1
  622. package/dist/spec/domain/model/MediaMimeAccept.js +0 -90
  623. package/dist/spec/domain/model/MediaMimeAccept.js.map +0 -1
  624. package/dist/spec/domain/model/RuntimePlan.d.ts.map +0 -1
  625. package/dist/spec/domain/model/RuntimePlan.js +0 -4
  626. package/dist/spec/domain/model/RuntimePlan.js.map +0 -1
  627. package/dist/spec/domain/model/SiteConfig.d.ts +0 -173
  628. package/dist/spec/domain/model/SiteConfig.d.ts.map +0 -1
  629. package/dist/spec/domain/model/SiteConfig.js +0 -13
  630. package/dist/spec/domain/model/SiteConfig.js.map +0 -1
  631. package/dist/spec/domain/model/SqlIr.d.ts.map +0 -1
  632. package/dist/spec/domain/model/SqlIr.js +0 -95
  633. package/dist/spec/domain/model/SqlIr.js.map +0 -1
  634. package/dist/spec/domain/model/index.d.ts +0 -14
  635. package/dist/spec/domain/model/index.d.ts.map +0 -1
  636. package/dist/spec/domain/model/index.js +0 -14
  637. package/dist/spec/domain/model/index.js.map +0 -1
  638. package/dist/spec/domain/service/CloudflareCron.d.ts.map +0 -1
  639. package/dist/spec/domain/service/CloudflareCron.js.map +0 -1
  640. package/dist/spec/domain/service/CrossSchemaChecker.d.ts +0 -34
  641. package/dist/spec/domain/service/CrossSchemaChecker.d.ts.map +0 -1
  642. package/dist/spec/domain/service/CrossSchemaChecker.js +0 -114
  643. package/dist/spec/domain/service/CrossSchemaChecker.js.map +0 -1
  644. package/dist/spec/domain/service/EntryDataValidator.d.ts +0 -56
  645. package/dist/spec/domain/service/EntryDataValidator.d.ts.map +0 -1
  646. package/dist/spec/domain/service/EntryDataValidator.js +0 -88
  647. package/dist/spec/domain/service/EntryDataValidator.js.map +0 -1
  648. package/dist/spec/domain/service/JsonSchemaToZod.d.ts +0 -29
  649. package/dist/spec/domain/service/JsonSchemaToZod.d.ts.map +0 -1
  650. package/dist/spec/domain/service/JsonSchemaToZod.js +0 -156
  651. package/dist/spec/domain/service/JsonSchemaToZod.js.map +0 -1
  652. package/dist/spec/domain/service/LifecycleStateMachine.d.ts +0 -75
  653. package/dist/spec/domain/service/LifecycleStateMachine.d.ts.map +0 -1
  654. package/dist/spec/domain/service/LifecycleStateMachine.js +0 -76
  655. package/dist/spec/domain/service/LifecycleStateMachine.js.map +0 -1
  656. package/dist/spec/domain/service/LocaleCanonicalizer.d.ts +0 -29
  657. package/dist/spec/domain/service/LocaleCanonicalizer.d.ts.map +0 -1
  658. package/dist/spec/domain/service/LocaleCanonicalizer.js +0 -96
  659. package/dist/spec/domain/service/LocaleCanonicalizer.js.map +0 -1
  660. package/dist/spec/domain/service/ManifestFieldChecks.d.ts +0 -60
  661. package/dist/spec/domain/service/ManifestFieldChecks.d.ts.map +0 -1
  662. package/dist/spec/domain/service/ManifestFieldChecks.js +0 -116
  663. package/dist/spec/domain/service/ManifestFieldChecks.js.map +0 -1
  664. package/dist/spec/domain/service/ManifestGraphValidator.d.ts +0 -15
  665. package/dist/spec/domain/service/ManifestGraphValidator.d.ts.map +0 -1
  666. package/dist/spec/domain/service/ManifestGraphValidator.js +0 -225
  667. package/dist/spec/domain/service/ManifestGraphValidator.js.map +0 -1
  668. package/dist/spec/domain/service/ManifestLinker.d.ts +0 -45
  669. package/dist/spec/domain/service/ManifestLinker.d.ts.map +0 -1
  670. package/dist/spec/domain/service/ManifestLinker.js +0 -92
  671. package/dist/spec/domain/service/ManifestLinker.js.map +0 -1
  672. package/dist/spec/domain/service/ManifestLocaleTrimmer.d.ts +0 -16
  673. package/dist/spec/domain/service/ManifestLocaleTrimmer.d.ts.map +0 -1
  674. package/dist/spec/domain/service/ManifestLocaleTrimmer.js +0 -76
  675. package/dist/spec/domain/service/ManifestLocaleTrimmer.js.map +0 -1
  676. package/dist/spec/domain/service/ManifestParser.d.ts +0 -49
  677. package/dist/spec/domain/service/ManifestParser.d.ts.map +0 -1
  678. package/dist/spec/domain/service/ManifestParser.js +0 -203
  679. package/dist/spec/domain/service/ManifestParser.js.map +0 -1
  680. package/dist/spec/domain/service/ManifestPartition.d.ts +0 -9
  681. package/dist/spec/domain/service/ManifestPartition.d.ts.map +0 -1
  682. package/dist/spec/domain/service/ManifestPartition.js +0 -19
  683. package/dist/spec/domain/service/ManifestPartition.js.map +0 -1
  684. package/dist/spec/domain/service/ManifestPathDiagnoser.d.ts +0 -33
  685. package/dist/spec/domain/service/ManifestPathDiagnoser.d.ts.map +0 -1
  686. package/dist/spec/domain/service/ManifestPathDiagnoser.js +0 -43
  687. package/dist/spec/domain/service/ManifestPathDiagnoser.js.map +0 -1
  688. package/dist/spec/domain/service/ManifestSourceSpans.d.ts +0 -10
  689. package/dist/spec/domain/service/ManifestSourceSpans.d.ts.map +0 -1
  690. package/dist/spec/domain/service/ManifestSourceSpans.js +0 -76
  691. package/dist/spec/domain/service/ManifestSourceSpans.js.map +0 -1
  692. package/dist/spec/domain/service/McpToolNaming.d.ts +0 -25
  693. package/dist/spec/domain/service/McpToolNaming.d.ts.map +0 -1
  694. package/dist/spec/domain/service/McpToolNaming.js +0 -50
  695. package/dist/spec/domain/service/McpToolNaming.js.map +0 -1
  696. package/dist/spec/domain/service/PlanFingerprint.d.ts.map +0 -1
  697. package/dist/spec/domain/service/PlanFingerprint.js +0 -14
  698. package/dist/spec/domain/service/PlanFingerprint.js.map +0 -1
  699. package/dist/spec/domain/service/ProcedureViewSpecChecks.d.ts +0 -4
  700. package/dist/spec/domain/service/ProcedureViewSpecChecks.d.ts.map +0 -1
  701. package/dist/spec/domain/service/ProcedureViewSpecChecks.js +0 -211
  702. package/dist/spec/domain/service/ProcedureViewSpecChecks.js.map +0 -1
  703. package/dist/spec/domain/service/SchemaAdminUiChecker.d.ts +0 -44
  704. package/dist/spec/domain/service/SchemaAdminUiChecker.d.ts.map +0 -1
  705. package/dist/spec/domain/service/SchemaAdminUiChecker.js +0 -333
  706. package/dist/spec/domain/service/SchemaAdminUiChecker.js.map +0 -1
  707. package/dist/spec/domain/service/SchemaIndexChecker.d.ts +0 -33
  708. package/dist/spec/domain/service/SchemaIndexChecker.d.ts.map +0 -1
  709. package/dist/spec/domain/service/SchemaIndexChecker.js +0 -256
  710. package/dist/spec/domain/service/SchemaIndexChecker.js.map +0 -1
  711. package/dist/spec/domain/service/SchemaSearchChecker.d.ts +0 -11
  712. package/dist/spec/domain/service/SchemaSearchChecker.d.ts.map +0 -1
  713. package/dist/spec/domain/service/SchemaSearchChecker.js +0 -78
  714. package/dist/spec/domain/service/SchemaSearchChecker.js.map +0 -1
  715. package/dist/spec/domain/service/SchemaSpecChecks.d.ts +0 -31
  716. package/dist/spec/domain/service/SchemaSpecChecks.d.ts.map +0 -1
  717. package/dist/spec/domain/service/SchemaSpecChecks.js +0 -445
  718. package/dist/spec/domain/service/SchemaSpecChecks.js.map +0 -1
  719. package/dist/spec/domain/service/SiteDefaultsValidator.d.ts +0 -39
  720. package/dist/spec/domain/service/SiteDefaultsValidator.d.ts.map +0 -1
  721. package/dist/spec/domain/service/SiteDefaultsValidator.js +0 -194
  722. package/dist/spec/domain/service/SiteDefaultsValidator.js.map +0 -1
  723. package/dist/spec/domain/service/SqlClassify.d.ts +0 -19
  724. package/dist/spec/domain/service/SqlClassify.d.ts.map +0 -1
  725. package/dist/spec/domain/service/SqlClassify.js +0 -42
  726. package/dist/spec/domain/service/SqlClassify.js.map +0 -1
  727. package/dist/spec/domain/service/SqlRefusal.d.ts +0 -16
  728. package/dist/spec/domain/service/SqlRefusal.d.ts.map +0 -1
  729. package/dist/spec/domain/service/SqlRefusal.js +0 -20
  730. package/dist/spec/domain/service/SqlRefusal.js.map +0 -1
  731. package/dist/spec/domain/service/SqlTypes.d.ts +0 -40
  732. package/dist/spec/domain/service/SqlTypes.d.ts.map +0 -1
  733. package/dist/spec/domain/service/SqlTypes.js +0 -110
  734. package/dist/spec/domain/service/SqlTypes.js.map +0 -1
  735. package/dist/spec/domain/service/StaffRoleHierarchy.d.ts +0 -3
  736. package/dist/spec/domain/service/StaffRoleHierarchy.d.ts.map +0 -1
  737. package/dist/spec/domain/service/StaffRoleHierarchy.js +0 -19
  738. package/dist/spec/domain/service/StaffRoleHierarchy.js.map +0 -1
  739. package/dist/spec/domain/service/TriggerGraphChecks.d.ts +0 -16
  740. package/dist/spec/domain/service/TriggerGraphChecks.d.ts.map +0 -1
  741. package/dist/spec/domain/service/TriggerGraphChecks.js +0 -337
  742. package/dist/spec/domain/service/TriggerGraphChecks.js.map +0 -1
  743. package/dist/spec/domain/service/TriggerSpecChecks.d.ts +0 -4
  744. package/dist/spec/domain/service/TriggerSpecChecks.d.ts.map +0 -1
  745. package/dist/spec/domain/service/TriggerSpecChecks.js +0 -89
  746. package/dist/spec/domain/service/TriggerSpecChecks.js.map +0 -1
  747. package/dist/spec/domain/service/ValidatedAdminUiProjection.d.ts +0 -11
  748. package/dist/spec/domain/service/ValidatedAdminUiProjection.d.ts.map +0 -1
  749. package/dist/spec/domain/service/ValidatedAdminUiProjection.js +0 -26
  750. package/dist/spec/domain/service/ValidatedAdminUiProjection.js.map +0 -1
  751. package/dist/spec/domain/service/ViewAdminUiChecker.d.ts +0 -14
  752. package/dist/spec/domain/service/ViewAdminUiChecker.d.ts.map +0 -1
  753. package/dist/spec/domain/service/ViewAdminUiChecker.js +0 -58
  754. package/dist/spec/domain/service/ViewAdminUiChecker.js.map +0 -1
  755. package/dist/spec/domain/service/index.d.ts +0 -24
  756. package/dist/spec/domain/service/index.d.ts.map +0 -1
  757. package/dist/spec/domain/service/index.js +0 -24
  758. package/dist/spec/domain/service/index.js.map +0 -1
  759. package/dist/spec/index.d.ts +0 -10
  760. package/dist/spec/index.d.ts.map +0 -1
  761. package/dist/spec/index.js +0 -12
  762. package/dist/spec/index.js.map +0 -1
  763. package/dist/spec/infrastructure/cli/parseArgsError.d.ts +0 -16
  764. package/dist/spec/infrastructure/cli/parseArgsError.d.ts.map +0 -1
  765. package/dist/spec/infrastructure/cli/parseArgsError.js +0 -34
  766. package/dist/spec/infrastructure/cli/parseArgsError.js.map +0 -1
  767. package/dist/spec/infrastructure/index.d.ts +0 -2
  768. package/dist/spec/infrastructure/index.d.ts.map +0 -1
  769. package/dist/spec/infrastructure/index.js +0 -2
  770. package/dist/spec/infrastructure/index.js.map +0 -1
  771. package/dist/spec/infrastructure/sql/PgQueryParser.d.ts +0 -18
  772. package/dist/spec/infrastructure/sql/PgQueryParser.d.ts.map +0 -1
  773. package/dist/spec/infrastructure/sql/PgQueryParser.js +0 -17
  774. package/dist/spec/infrastructure/sql/PgQueryParser.js.map +0 -1
  775. package/dist/spec/infrastructure/sql/compilePlan.d.ts +0 -37
  776. package/dist/spec/infrastructure/sql/compilePlan.d.ts.map +0 -1
  777. package/dist/spec/infrastructure/sql/compilePlan.js +0 -287
  778. package/dist/spec/infrastructure/sql/compilePlan.js.map +0 -1
  779. package/dist/spec/infrastructure/sql/compileSql.d.ts +0 -35
  780. package/dist/spec/infrastructure/sql/compileSql.d.ts.map +0 -1
  781. package/dist/spec/infrastructure/sql/compileSql.js +0 -92
  782. package/dist/spec/infrastructure/sql/compileSql.js.map +0 -1
  783. package/dist/spec/infrastructure/sql/frontEnd.d.ts +0 -8
  784. package/dist/spec/infrastructure/sql/frontEnd.d.ts.map +0 -1
  785. package/dist/spec/infrastructure/sql/frontEnd.js +0 -100
  786. package/dist/spec/infrastructure/sql/frontEnd.js.map +0 -1
  787. package/dist/spec/infrastructure/sql/index.d.ts +0 -4
  788. package/dist/spec/infrastructure/sql/index.d.ts.map +0 -1
  789. package/dist/spec/infrastructure/sql/index.js +0 -4
  790. package/dist/spec/infrastructure/sql/index.js.map +0 -1
  791. package/dist/spec/kernel/diagnostic.d.ts.map +0 -1
  792. package/dist/spec/kernel/diagnostic.js +0 -301
  793. package/dist/spec/kernel/diagnostic.js.map +0 -1
  794. package/dist/spec/kernel/index.d.ts +0 -8
  795. package/dist/spec/kernel/index.d.ts.map +0 -1
  796. package/dist/spec/kernel/index.js +0 -8
  797. package/dist/spec/kernel/index.js.map +0 -1
  798. package/dist/spec/usecase/EmitTypes.d.ts +0 -22
  799. package/dist/spec/usecase/EmitTypes.d.ts.map +0 -1
  800. package/dist/spec/usecase/EmitTypes.js +0 -182
  801. package/dist/spec/usecase/EmitTypes.js.map +0 -1
  802. package/dist/spec/usecase/ValidateManifestsUseCase.d.ts +0 -8
  803. package/dist/spec/usecase/ValidateManifestsUseCase.d.ts.map +0 -1
  804. package/dist/spec/usecase/ValidateManifestsUseCase.js +0 -101
  805. package/dist/spec/usecase/ValidateManifestsUseCase.js.map +0 -1
  806. package/dist/spec/usecase/dto/ValidateManifestsRequest.d.ts +0 -27
  807. package/dist/spec/usecase/dto/ValidateManifestsRequest.d.ts.map +0 -1
  808. package/dist/spec/usecase/dto/ValidateManifestsRequest.js +0 -2
  809. package/dist/spec/usecase/dto/ValidateManifestsRequest.js.map +0 -1
  810. package/dist/spec/usecase/dto/ValidateManifestsResponse.d.ts +0 -14
  811. package/dist/spec/usecase/dto/ValidateManifestsResponse.d.ts.map +0 -1
  812. package/dist/spec/usecase/dto/ValidateManifestsResponse.js +0 -2
  813. package/dist/spec/usecase/dto/ValidateManifestsResponse.js.map +0 -1
  814. package/dist/spec/usecase/dto/index.d.ts +0 -3
  815. package/dist/spec/usecase/dto/index.d.ts.map +0 -1
  816. package/dist/spec/usecase/dto/index.js +0 -3
  817. package/dist/spec/usecase/dto/index.js.map +0 -1
  818. package/dist/spec/usecase/index.d.ts +0 -10
  819. package/dist/spec/usecase/index.d.ts.map +0 -1
  820. package/dist/spec/usecase/index.js +0 -10
  821. package/dist/spec/usecase/index.js.map +0 -1
  822. package/dist/testing/cases/before-hook.d.ts +0 -4
  823. package/dist/testing/cases/before-hook.d.ts.map +0 -1
  824. package/dist/testing/cases/before-hook.js +0 -71
  825. package/dist/testing/cases/before-hook.js.map +0 -1
  826. package/dist/testing/cases/corpus.d.ts +0 -14
  827. package/dist/testing/cases/corpus.d.ts.map +0 -1
  828. package/dist/testing/cases/corpus.js +0 -93
  829. package/dist/testing/cases/corpus.js.map +0 -1
  830. package/dist/testing/cases/policy.d.ts +0 -87
  831. package/dist/testing/cases/policy.d.ts.map +0 -1
  832. package/dist/testing/cases/policy.js +0 -143
  833. package/dist/testing/cases/policy.js.map +0 -1
  834. package/dist/testing/cases/printer.d.ts +0 -4
  835. package/dist/testing/cases/printer.d.ts.map +0 -1
  836. package/dist/testing/cases/printer.js +0 -34
  837. package/dist/testing/cases/printer.js.map +0 -1
  838. package/dist/testing/cases/report-view.d.ts +0 -5
  839. package/dist/testing/cases/report-view.d.ts.map +0 -1
  840. package/dist/testing/cases/report-view.js +0 -51
  841. package/dist/testing/cases/report-view.js.map +0 -1
  842. package/dist/testing/cases/requisition.d.ts +0 -4
  843. package/dist/testing/cases/requisition.d.ts.map +0 -1
  844. package/dist/testing/cases/requisition.js +0 -38
  845. package/dist/testing/cases/requisition.js.map +0 -1
  846. package/dist/testing/cases/search-places.d.ts +0 -4
  847. package/dist/testing/cases/search-places.d.ts.map +0 -1
  848. package/dist/testing/cases/search-places.js +0 -60
  849. package/dist/testing/cases/search-places.js.map +0 -1
  850. package/dist/testing/cases/stock.d.ts +0 -4
  851. package/dist/testing/cases/stock.d.ts.map +0 -1
  852. package/dist/testing/cases/stock.js +0 -35
  853. package/dist/testing/cases/stock.js.map +0 -1
  854. package/dist/testing/cases/store.d.ts +0 -4
  855. package/dist/testing/cases/store.d.ts.map +0 -1
  856. package/dist/testing/cases/store.js +0 -100
  857. package/dist/testing/cases/store.js.map +0 -1
  858. package/dist/testing/harness.d.ts +0 -94
  859. package/dist/testing/harness.d.ts.map +0 -1
  860. package/dist/testing/harness.js +0 -168
  861. package/dist/testing/harness.js.map +0 -1
  862. package/dist/testing/index.d.ts.map +0 -1
  863. package/dist/testing/index.js.map +0 -1
  864. package/dist/testing/report.d.ts +0 -15
  865. package/dist/testing/report.d.ts.map +0 -1
  866. package/dist/testing/report.js +0 -22
  867. package/dist/testing/report.js.map +0 -1
  868. package/dist/web/createRestSurface.d.ts +0 -7
  869. package/dist/web/createRestSurface.d.ts.map +0 -1
  870. package/dist/web/createRestSurface.js +0 -41
  871. package/dist/web/createRestSurface.js.map +0 -1
  872. package/dist/web/index.d.ts +0 -2
  873. package/dist/web/index.d.ts.map +0 -1
  874. package/dist/web/index.js +0 -2
  875. package/dist/web/index.js.map +0 -1
  876. package/docs/adr/0001-four-atom-manifest-model.md +0 -440
  877. package/docs/adr/0002-closed-enums-for-bindings.md +0 -253
  878. package/docs/adr/0007-ai-as-primary-author.md +0 -473
  879. package/docs/adr/0008-structured-diagnostic-shape.md +0 -338
  880. package/docs/adr/0009-consumer-supplied-manifests.md +0 -149
  881. package/docs/adr/0010-locale-and-translates.md +0 -453
  882. package/docs/adr/0011-adapter-port-spec.md +0 -281
  883. package/docs/adr/0012-views-as-public-rest.md +0 -161
  884. package/docs/adr/0013-agent-provisioned-consumer-projects.md +0 -154
  885. package/docs/adr/0014-auth-better-auth-and-multi-tenant-mcp.md +0 -939
  886. package/docs/adr/0016-site-semantic-layer.md +0 -70
  887. package/docs/adr/0017-media-multi-variant-agent-side-optimization.md +0 -181
  888. package/docs/adr/0018-core-starters-repository-boundary.md +0 -179
  889. package/docs/adr/0019-sealed-manifest-runtime-pipeline.md +0 -244
  890. package/docs/adr/0020-builtin-handler-contracts-and-matched-upsert.md +0 -199
  891. package/docs/adr/0021-retire-starter-scaffolding.md +0 -30
  892. package/docs/adr/0022-caller-observed-version-occ.md +0 -212
  893. package/docs/adr/0023-port-failure-contract.md +0 -69
  894. package/docs/adr/0024-manifest-native-schema-tables.md +0 -264
  895. package/docs/adr/0025-reserved-native-columns-and-published-only-public-views.md +0 -105
  896. package/docs/adr/0026-progressive-generate.md +0 -36
  897. package/docs/adr/0027-scheduled-procedure-triggers.md +0 -31
  898. package/docs/adr/0028-schema-ttl-expiry.md +0 -33
  899. package/docs/adr/0029-mcp-apps-interaction-contracts.md +0 -324
  900. package/docs/adr/0030-store.md +0 -40
  901. package/docs/adr/0031-host-cloud-core-contract.md +0 -102
  902. package/docs/adr/0032-store-centric-core-and-service-contract.md +0 -384
  903. package/docs/adr/0033-storage-converges-to-the-plan.md +0 -92
  904. package/docs/adr/0034-store-is-authored-as-sql.md +0 -192
  905. package/docs/adr/0035-sql-dialects.md +0 -154
  906. package/docs/adr/0036-host-and-dialect.md +0 -65
  907. package/docs/adr/0037-postgresql-is-the-reference-dialect.md +0 -125
  908. package/docs/adr/0038-bun-native-host.md +0 -63
  909. package/docs/adr/0039-postgresql-is-native.md +0 -130
  910. package/docs/adr/README.md +0 -98
  911. package/docs/adr/adr-lite-1376-admin-extensions.md +0 -330
  912. package/docs/adr/adr-lite-803-request-diagnostics.md +0 -38
  913. package/docs/adr/adr-lite-808-route-readiness.md +0 -47
  914. package/docs/adr/adr-lite-809-bounded-public-content.md +0 -71
  915. package/docs/adr/adr-lite-812-native-parity.md +0 -150
  916. package/docs/adr/adr-lite-823-home-statistics.md +0 -64
  917. package/docs/adr/adr-lite-842-mcp-authoring.md +0 -30
  918. package/docs/adr/adr-lite-845-frontend-client.md +0 -38
  919. package/docs/adr/adr-lite-861-admin-webmcp.md +0 -48
  920. package/docs/adr/adr-lite-909-admin-ui-kit.md +0 -37
  921. package/docs/examples/commerce-inventory.md +0 -498
  922. package/docs/examples/commerce.md +0 -254
  923. package/docs/examples/guarded-api.md +0 -238
  924. package/docs/examples/intake-hooks.md +0 -237
  925. package/docs/examples/intake.md +0 -127
  926. package/docs/examples/legal-documents.md +0 -218
  927. package/docs/examples/procurement.md +0 -226
  928. package/docs/examples/publication.md +0 -211
  929. package/docs/examples/reference-service/.mantle/generated/mantle.ts +0 -174
  930. package/docs/examples/reference-service/.mantle/generated/plan.json +0 -1936
  931. package/docs/examples/reference-service/README.md +0 -33
  932. package/docs/examples/reference-service/manifests/catalog.yaml +0 -103
  933. package/docs/examples/reference-service/manifests/orders.yaml +0 -120
  934. package/docs/examples/reference-service/mantle.config.json +0 -1
  935. package/docs/examples/reference-service/package.json +0 -27
  936. package/docs/examples/reference-service/smoke.mjs +0 -160
  937. package/docs/examples/reference-service/src/handlers.ts +0 -36
  938. package/docs/examples/reference-service/src/index.ts +0 -33
  939. package/docs/examples/reference-service/src/service.ts +0 -78
  940. package/docs/examples/reference-service/wrangler.jsonc +0 -26
  941. package/docs/examples/reservation.md +0 -142
  942. /package/docs/examples/{reference-service → app-shell}/.dev.vars.example +0 -0
@@ -1,63 +0,0 @@
1
- # ADR-0038: Bun is a native host
2
-
3
- **Status:** Accepted for 0.2.0. Amends ADR-0036's reserved Bun host.
4
-
5
- ## Decision
6
-
7
- `@aotter/mantle/bun` owns native drivers and Admin files. Core remains host-neutral;
8
- PostgreSQL retains policy, convergence, SQL printing, SERIALIZABLE retries, timeout
9
- and error mapping. `host: bun` defaults to `dialect: postgres` on first selection.
10
- The CLI writes an application-owned Bun.serve entry and service once. Both native
11
- PostgreSQL and bun:sqlite presets exist; neither imports Cloudflare or pg.
12
-
13
- The PostgreSQL host takes a Bun.SQL pool configured with `prepare: false`.
14
- Bun's prepared JSON parameter encoding serializes an already encoded JSON string
15
- again. Refuse another configuration rather than silently changing stored values.
16
- Pool reserve/release binds every operation to one connection. The host closes
17
- its pool after the server and retained background work stop.
18
-
19
- Bun exposes raw results without OIDs/typmods. Obtain exact result metadata from
20
- `CREATE TEMP TABLE ... AS <query> WITH NO DATA`, read pg_attribute and drop the
21
- temporary table, then execute the original statement once with raw text results.
22
- A DML description is a data-modifying CTE under WITH NO DATA, which does not
23
- execute its body. PostgreSQL owns all type inference, including numeric scale,
24
- CASE, COALESCE and CTEs. Each descriptor runs in the statement's existing pinned
25
- transaction. Views use a regular transaction because temporary DDL is forbidden
26
- in READ ONLY: a read describes first, then runs `SET TRANSACTION READ ONLY` before
27
- the statement, so the engine still refuses a write as it does on every other
28
- PostgreSQL host. Creating the temporary table needs the TEMPORARY privilege on the
29
- database (`GRANT TEMPORARY ON DATABASE ... TO <role>`); without it every read fails
30
- with 42501 naming this requirement, and a read replica cannot serve this host.
31
- Every transaction appends `pg_temp` to its search_path, on every PostgreSQL host,
32
- so a temporary table on a pooled session never stands in for a Schema table (unless
33
- the role's own search_path already names pg_temp earlier, which it should not).
34
- A connection whose ROLLBACK failed is closed, never released to the pool.
35
- This costs three metadata round trips per result. Replace it only when Bun
36
- provides public RowDescription metadata; do not approximate money or time values.
37
-
38
- The entry overwrites the trusted IP header from the socket; behind a reverse proxy
39
- listed in TRUSTED_PROXIES, the client is the address that proxy appended last to
40
- X-Forwarded-For (one trusted hop; an IPv4-mapped socket address is matched as
41
- IPv4), so each client keeps its own sign-in rate limit. Bun.serve runs
42
- with `development: false` and an error handler that answers Core's 500 envelope: Bun's
43
- development page would show the exception, stack and paths. Admin assets reject
44
- traversal, control characters and symlinks outside the installed bundle.
45
- bun:sqlite runs with foreign keys on, as D1 does, and a Mantle batch waits for a
46
- Better Auth transaction open on the same handle instead of becoming its savepoint.
47
- Local OTP requires an explicit loopback PUBLIC_ORIGIN, a secret and bootstrap
48
- email, as Cloudflare does.
49
-
50
- Bun has no built-in cron scheduler in this preset. Enabled schedule Triggers are
51
- refused before files are written; an application that supplies a scheduler uses
52
- host none and invokes Mantle's schedule ingress explicitly. No polling scheduler,
53
- workflow engine or new manifest grammar is introduced.
54
-
55
- ## Verification
56
-
57
- Native PostgreSQL and SQLite run the same storage conformance suite. Native
58
- regressions cover result names, JSON scalar/array values, exact numeric typmods,
59
- microsecond timestamps, CTE/comment queries, star targets, connection
60
- reservation, read-only reads, statement_timeout, pg_temp ordering, foreign keys,
61
- transactions on a shared bun:sqlite handle and actual Better Auth
62
- OTP/bootstrap-owner login on both engines. Both generated presets typecheck
63
- against bun-types. CI installs pinned Bun and runs these on every PR.
@@ -1,130 +0,0 @@
1
- # ADR-0039: PostgreSQL is native, and node-postgres is its only driver
2
-
3
- **Status:** Accepted (2026-10-08).
4
-
5
- **Date:** 2026-10-08.
6
-
7
- **Supersedes:**
8
- - ADR-0035: the cross-dialect parity clauses (one shared subset, identical results on every dialect).
9
- - ADR-0037: "moving from D1 to PostgreSQL still needs no rewrite", and the SQLite emulation it implies.
10
- - ADR-0038: the Bun.SQL PostgreSQL host and its temporary-table result description. Bun's SQLite preset is unchanged.
11
-
12
- ## Context
13
-
14
- Mantle has run PostgreSQL as an emulation of D1/SQLite, so that one manifest returns identical results on both engines.
15
-
16
- ### What the emulation costs
17
-
18
- The PostgreSQL audit on the procurement fixture (S, M and L tiers, Bun and Workers hosts) measured three costs.
19
-
20
- **1. No declared index can serve a paged sort.**
21
- - Paging forces SQLite's NULL order: `ASC NULLS FIRST`, `DESC NULLS LAST` (`core/sql/run.ts:257,297`). The tiebreak is `id COLLATE "C"`.
22
- - PostgreSQL btree indexes have the opposite default order (`postgres/storage.ts:88-93`).
23
- - As a result, every Admin list and every View with an ORDER BY does a full scan plus a sort, even with an index:
24
-
25
- | Measurement | Today | With an order-matching index |
26
- |---|---|---|
27
- | Admin list, L tier, c=8 | 3 rps | 139 rps |
28
- | procurement report | 47 ms | 0.26 ms |
29
-
30
- - Matching the indexes to the emulated order would mean a `NULLS FIRST` index migration, permanently.
31
-
32
- **2. Translation shims in SQL that authors never see.**
33
- - `_mantle_jget` reproduces SQLite's `->>` and `$` paths.
34
- - `_mantle_bool` reproduces SQLite's integer truthiness.
35
- - `_mantle_json_each` reproduces SQLite's json_each columns.
36
- - `||` is cast to text, and pinned `DateStyle`/`IntervalStyle`/`extra_float_digits` settings exist only so that text decodes the way D1's does.
37
-
38
- **3. A second driver on Bun that exists only to recover type metadata.**
39
- - Bun.SQL exposes no column OIDs or typmods: verified on Bun 1.4.2, and its docs list column type transforms as unfinished.
40
- - Mantle therefore describes every result through `CREATE TEMP TABLE … WITH NO DATA` plus `pg_attribute`.
41
- - A View read costs 12 statements and 10 round trips on Bun.SQL, against 4 and 4 on node-postgres.
42
- - Every Bun role also needs `TEMPORARY`.
43
-
44
- ### Who actually needs D1/PostgreSQL parity
45
-
46
- No caller needs one manifest to switch engines without changes:
47
- - **Cloud tenants** are moving to PostgreSQL.
48
- - **On-premises single-organization deployments** run PostgreSQL on Bun.
49
- - **D1 services** stay on D1.
50
-
51
- What callers do need is that one PostgreSQL plan behaves the same on Bun and on Workers. The same app runs in Cloud and on-premises, and handler code and output schemas see the values directly.
52
-
53
- ## Decision
54
-
55
- ### 1. Each dialect is its own target
56
-
57
- - A manifest targets one dialect.
58
- - Mantle does not promise that a PostgreSQL manifest compiles for D1, or that a D1 manifest compiles for PostgreSQL.
59
- - Mantle does not promise that the two dialects return equal values.
60
- - The compliance suite checks each dialect against its own semantics, not against the other dialect.
61
- - The closed allowlist stays: base for D1, reference for PostgreSQL (ADR-0037 decision 1).
62
-
63
- ### 2. PostgreSQL semantics are PostgreSQL's
64
-
65
- **Ordering.** Paging uses PostgreSQL's own NULL order (`ASC NULLS LAST`, `DESC NULLS FIRST`), and the cursor follows it. The tiebreak uses the column's own collation, so declared indexes serve ORDER BY … LIMIT. An index matches a sort only when every key in it runs in the same direction; that remains an authoring rule for indexes.
66
-
67
- **The SQLite shims go.** `_mantle_jget`, `_mantle_bool`, `_mantle_json_each`, the `||` text cast and the `$`-path lowering are removed. PostgreSQL manifests use PostgreSQL's jsonb operators, booleans and `jsonb_array_elements`. A manifest that relied on a SQLite-ism fails validation with a position and the PostgreSQL spelling.
68
-
69
- **What stays.** Mantle's own functions that are not emulation stay:
70
- - `_mantle_expect` (#1379);
71
- - the policy rewrite;
72
- - convergence;
73
- - the boot-time settings check, reduced to what the remaining decoding needs.
74
-
75
- ### 3. node-postgres is the only PostgreSQL driver
76
-
77
- - **Every host uses node-postgres (`pg` 8.23 or later):** the Bun preset (a `pg.Pool`), the Workers/Hyperdrive preset (a client per request), and any host composed by hand.
78
- - **Request scoping and pipelining are the same everywhere:** `requestScoped` and the pipelined write path from #1379 run identically on every host.
79
- - **The Bun.SQL host is removed**, along with its result description and the `TEMPORARY` grant.
80
- - **Values come out of one decoder** (`decodeField` over RowDescription OIDs and typmods). Bun and Workers therefore return the same values for the same plan, with no separate value contract to maintain.
81
-
82
- ## Consequences
83
-
84
- - **Indexes work on PostgreSQL**, with no `NULLS FIRST` migration. The keyset cursor (row comparison, #1391 follow-up) becomes the next step for deep pages.
85
- - **There is one PostgreSQL code path** to test, profile and secure, and no `TEMPORARY` privilege.
86
- - **This is breaking for existing PostgreSQL services:**
87
- - NULL position in sorted results changes.
88
- - Manifests that use SQLite JSON paths or integer truthiness on PostgreSQL must be rewritten.
89
- - The Bun PostgreSQL preset's entry changes.
90
- - Release notes give the rewrites.
91
- - **D1 → PostgreSQL is a migration, not a switch:**
92
- - Export, rewrite the manifest's SQL, import.
93
- - aotter/mantle#1298 (portable dump) is re-scoped to data only.
94
- - aotter/mantle-home#251 (tenant upgrade from D1) becomes an explicit migration.
95
- - **Bun gives up Bun.SQL's native client.** The audit measured no gain from it where Mantle's wrapper was absent: the session check ran 390 rps on Bun.SQL and 388 rps on node-postgres. If Bun later exposes column metadata and a measured gain appears, a Bun.SQL driver can return as a second implementation of the same contract.
96
-
97
- ## Alternatives
98
-
99
- - **Keep parity and build `NULLS FIRST` indexes.** Rejected. It keeps every shim, needs an index migration on every existing database, and buys a guarantee no caller uses.
100
- - **Keep Bun.SQL with a cached result description.** Rejected. It makes the wrapper cheaper but keeps it, keeps the `TEMPORARY` grant, and keeps two drivers to maintain.
101
- - **Keep Bun.SQL, with a value contract both drivers normalise to.** Rejected. Two drivers plus a normalisation layer cost more than one driver, and the contract would need maintaining.
102
-
103
- ## How to apply
104
-
105
- Each step is its own PR. Each is breaking where noted.
106
-
107
- 1. **Bun preset on node-postgres.**
108
- - `cli/preset.ts`/`generate.ts` write a `pg.Pool` entry with `requestScoped`.
109
- - Remove `bunPgConnect`, `bunPostgresStorage` and the result-description path from `src/bun`, and the `TEMPORARY` note from the handbook.
110
- - `test/bun/native.ts` runs the PostgreSQL conformance on node-postgres under Bun.
111
- 2. **Native ordering.**
112
- - `run.ts` stops emitting NULLS clauses on PostgreSQL. The dialect supplies its default NULL order, and the cursor predicate follows it.
113
- - The tiebreak drops `COLLATE "C"` on PostgreSQL.
114
- - Add EXPLAIN-based tests showing a declared index serves each paged sort.
115
- 3. **Remove the SQLite shims** from `postgres/lower.ts`, `print.ts` and `storage.ts` `FUNCTIONS`.
116
- - Add validation diagnostics that name the PostgreSQL spelling.
117
- - Rewrite the PostgreSQL compliance fixtures and the reference suite in PostgreSQL's own semantics.
118
- 4. **Docs and skills.**
119
- - The handbook's dialect pages and the consumer skills say that each dialect is its own target.
120
- - Add release notes with the rewrites.
121
- 5. **Follow-ups from the audit** (#1391 and the audit report), in this order:
122
- - keyset cursor;
123
- - auth: drop the discarded JWT header, plain reads;
124
- - SQL compile cache;
125
- - boot trim;
126
- - convergence safety (CHECK diffing, re-reading the fingerprint under the lock).
127
-
128
- ## Implementation status
129
-
130
- Accepted. Implementation follows in the stacked PRs listed under How to apply.
@@ -1,98 +0,0 @@
1
- # Architecture Decision Records
2
-
3
- Records of *why* mantle ended up shaped this way. The numbering preserves POC ADR numbers where carried over (so cross-references in code comments and external docs stay valid); new ADRs continue from the highest used number.
4
-
5
- ## ADRs
6
-
7
- | # | Title | Status |
8
- |---|---|---|
9
- | [0001](0001-four-atom-manifest-model.md) | Four-atom manifest model (Schema / View / Procedure / Trigger). Folds POC ADR-0005 (grammar discipline) and POC ADR-0006 (multi-doc YAML). | Accepted; fixed-file contract superseded |
10
- | [0002](0002-closed-enums-for-bindings.md) | Closed enums for `x-mantle-bind` and `ctx.*` predicates. | Accepted (refreshed) |
11
- | [0007](0007-ai-as-primary-author.md) | AI is the primary author of consumer projects; SDK contract is three pre-serve feedback loops, runtime diagnostics, and coder/operator role surfaces. | Accepted + amended |
12
- | [0008](0008-structured-diagnostic-shape.md) | Diagnostic shape for validate/boot/runtime failures, with a reserved consumer-test phase; measured harnesses keep purpose-shaped reports. | Accepted + amended |
13
- | [0009](0009-consumer-supplied-manifests.md) | Historical generated-array workflow; consumer source ownership continues in ADR-0019. | Superseded by 0019 |
14
- | [0010](0010-locale-and-translates.md) | Locale 3-layer (manifest / D1 site_config / data field) + translates pattern. Boot decoupled from `site_config` (issue #60 fix). | Accepted (refreshed) |
15
- | [0011](0011-adapter-port-spec.md) | Adapter port spec. Required runtime ports plus optional feature ports. | Superseded by 0019 (Core storage, Admin composition) and 0024 (SQLite/D1 storage); retained as the alpha.7 Cloudflare adapter record |
16
- | [0012](0012-views-as-public-rest.md) | Views auto-expose matching REST and `query_view_*` MCP reads on their declared `public` or `staff` surface. Schemas never get a public REST endpoint. | Accepted + amended |
17
- | [0013](0013-agent-provisioned-consumer-projects.md) | Historical agent-provisioned consumer projects path. | Superseded by 0021 |
18
- | [0014](0014-auth-better-auth-and-multi-tenant-mcp.md) | The Cloudflare adapter owns one Better Auth 1.7 identity/OAuth/MCP authority with native method options and CIMD discovery. Verified callers are normalized into runtime context; mutable staff role and target authorization are re-evaluated per call. | Accepted + amended; auth ownership amended by 0032 |
19
- | [0016](0016-site-semantic-layer.md) | Historical Starter/Landing `AGENTS.md` and launch-state contract. | Superseded by 0021 |
20
- | [0017](0017-media-multi-variant-agent-side-optimization.md) | Multi-variant media assets with agent-side optimization and asset-id entry references. | Accepted |
21
- | [0018](0018-core-starters-repository-boundary.md) | Core produces published SDK artifacts; the separate starters repository validates them as an external consumer. Revisit after release-contract simplification. | Superseded by 0021 |
22
- | [0019](0019-sealed-manifest-runtime-pipeline.md) | One sealed source-to-runtime pipeline, semantic storage seam, and optional Web/Admin/platform dependency direction. | Accepted; optional boundaries become subpaths of two packages per 0032 |
23
- | [0020](0020-builtin-handler-contracts-and-matched-upsert.md) | Static builtin handler contracts and natural-key matched upsert (`handler.match`). | Accepted + amended by 0022 |
24
- | [0021](0021-retire-starter-scaffolding.md) | Direct authoring; retire Starter scaffolding. | Accepted; no-initialization clause superseded by 0026 |
25
- | [0022](0022-caller-observed-version-occ.md) | Caller-observed `expectedVersion` for Admin bind and builtin upsert OCC. | Accepted; Admin binding rules superseded by 0029 |
26
- | [0023](0023-port-failure-contract.md) | Storage and service failure contracts: resource, rate, outcome-unknown, partial-failure and precondition diagnostics with safe `failure` facts. | Accepted for alpha.17 (#857); amends 0008 |
27
- | [0024](0024-manifest-native-schema-tables.md) | Materialize each Schema as a native storage table and deploy reviewed migration artifacts. | Accepted; authored-native-name clauses superseded by 0025; migration workflow superseded by 0033 |
28
- | [0025](0025-reserved-native-columns-and-published-only-public-views.md) | Reserve the six native column names, let `indexes` reference them, and compile public publishing Views published-only. | Accepted |
29
- | [0026](0026-progressive-generate.md) | Progressive `mantle generate` with a full default, positive features, saved host selection, and user-owned source. | Accepted; supersedes part of 0021; dependency closure, identity and `--host` amended by 0032 |
30
- | [0027](0027-scheduled-procedure-triggers.md) | Schedule Triggers in the sealed plan with Cloudflare-hosted invocation and system identity. | Accepted for 0.1.5; cron dialect and host requirement amended by 0032 |
31
- | [0028](0028-schema-ttl-expiry.md) | Logical TTL on Schema reads with preview-first, explicit bounded cleanup. | Accepted for 0.1.5 |
32
- | [0029](0029-mcp-apps-interaction-contracts.md) | Official MCP SDK for all MCP wire handling; transport-neutral capability catalog with validate-once invocation; `@aotter/mantle-mcp` and `@aotter/mantle-ui`; Manifest-declared interaction contracts and MCP Apps (#1110). | Accepted; amends ADR-lite 909 |
33
- | [0030](0030-store.md) | Store: one persistence object (`ctx.store` / `runtime.store`) over one relational JSON query AST compiled by each adapter; first slice `select`, `view`, `id`, then `write`, then manifest grammar (#1151). | Accepted; completed for 0.2.0 by 0032; authoring amended by 0034 |
34
- | [0031](0031-host-cloud-core-contract.md) | Cloud supplies the Core pin before host artifact hashing; protocol 2 checks the pin through grants/kit; protocol 4 requires a verified source receipt before save. | Accepted |
35
- | [0032](0032-store-centric-core-and-service-contract.md) | 0.2.0: Store is the only entry persistence path; an application-owned service behind one host-neutral `createMantle`; one `Caller` identity and no Core-owned user or auth; `_mantle_` marks system tables only; two npm packages and one plugin. | Accepted for 0.2.0; decisions 1–5, 10 and 13 amended by 0034; decisions 6 and 12 by 0035 |
36
- | [0033](0033-storage-converges-to-the-plan.md) | Schema storage converges to the plan by introspection: Mantle applies safe additions, blocks the rest, and verifies author-made changes; no Mantle-written migration files. | Accepted for 0.2.0; amended by 0034 and 0035 |
37
- | [0034](0034-store-is-authored-as-sql.md) | Store is authored as SQL in the D1 dialect and compiled to IR by the CLI with `libpg-query`; no Worker parses SQL. The IR is the parser's AST under an exact allowlist, printed by `pgsql-deparser`; a chosen SQL subset with policy wrapped around every Schema reference; FTS5 search and R*Tree places; after hooks take row arrays; one SQLite executor; exact encodings for time and decimals. | Accepted for 0.2.0 (spike #1203); amended by 0035 and 0037 |
38
- | [0035](0035-sql-dialects.md) | Mantle SQL is PostgreSQL syntax and meaning; a dialect module runs it on one engine. D1 and PostgreSQL ship built in, and both pass the compliance suite. | Accepted for 0.2.0; amended by the PostgreSQL dialect (#1293), 0036 and 0037 |
39
- | [0036](0036-host-and-dialect.md) | A project picks a host (`cloudflare`, `none`) and a dialect (`sqlite`, `postgres`, a package) once; `mantle generate` writes the pair's preset; the host never enters the plan. | Accepted for 0.2.0; reserved Bun host amended by 0038 |
40
- | [0037](0037-postgresql-is-the-reference-dialect.md) | PostgreSQL is the reference dialect: one closed allowlist in Core (base and reference profiles), D1 runs the base subset; a View reads an internal View; `restrict` narrows at runtime; a statement timeout on PostgreSQL; Cloud's PostgreSQL connection stays with the platform. | Accepted for 0.2.0 |
41
- | [0038](0038-bun-native-host.md) | Bun is a native host: `@aotter/mantle/bun` owns the native SQLite and PostgreSQL drivers and Admin files; `host: bun` defaults to `dialect: postgres`; the CLI writes a `Bun.serve` entry once. | Accepted for 0.2.0 |
42
- | [0039](0039-postgresql-is-native.md) | PostgreSQL is native, not a D1 emulation: each dialect is its own target, PostgreSQL ordering and SQL are PostgreSQL's, and node-postgres is the only PostgreSQL driver on every host. | Accepted; supersedes parts of 0035, 0037 and 0038 |
43
-
44
- ## Reading order
45
-
46
- If you're new to the codebase:
47
-
48
- 1. **0001** — what the 4 atoms are.
49
- 2. **0019** — the sealed source-to-runtime pipeline and optional product boundaries.
50
- 3. **0009** — historical context for consumer-owned manifests.
51
- 4. **0007** — what running the SDK feels like as an AI author (and as the operator agent).
52
- 5. **0011** — the boundary between the runtime and the adapter.
53
- 6. **0010** — how locale flows through the system.
54
- 7. **0026** — current progressive generation boundary; **0021** retains the direct-authoring history and **0013** is historical install-session context.
55
- 8. **0002, 0008** — the two ADRs that touch every diagnostic and every binding.
56
-
57
- ## What's NOT here (and why)
58
-
59
- POC had 16 ADRs. The rebuild ports the durable ones, writes fresh ADRs
60
- for new v0.1.0 boundaries, and folds / drops the rest:
61
-
62
- - **POC ADR-0003** OpenAPI emission → folded into `mantle-spec` README (the *what* is implementation; the *why* was already captured by ADR-0001's grammar lock).
63
- - **POC ADR-0004** D1 today, Hyperdrive PG tomorrow → folded into `mantle-cloudflare` README (now a v0.2 roadmap item, not an architectural decision).
64
- - **POC ADR-0005** v0.1 minimum grammar → folded into ADR-0001's fail-closed grammar policy.
65
- - **POC ADR-0006** multi-doc YAML → folded into ADR-0001 §"Authoring shape: multi-doc YAML."
66
- - **POC ADR-0011** lifecycle binary opt-in → distilled to a §"Lifecycle" subsection in `docs/design-atoms.md`. v0.1.0 ships `publishing` and `operational`.
67
- - **POC ADR-0012** strategic posture vs adjacent CMS designs → strategic / marketing material, lives in `README.md` if anywhere.
68
- - **POC ADR-0013** role-split surfaces (coder agent vs operator agent) → folded into ADR-0007 (Part B).
69
- - **POC ADR-0014** builtin handlers and lifecycle Triggers → promoted to v0.1.0 and implemented in the rebuild via `LifecycleHookingEntryRepository` and `InvokeBuiltinUseCase`. Full shape spec lives in `docs/design-atoms.md`.
70
- - **POC ADR-0015** cms-astro internal seam discipline → POC-specific to a package that no longer exists; replaced by ADR-0011 (adapter port spec).
71
- - **POC ADR-0029** drop Astro from cms-cloudflare → POC-specific historical record; the rebuild starts post-Astro.
72
-
73
- The rebuild's ADR-0011 (new) is the most load-bearing addition — the POC accumulated multiple *aspirational* boundaries (POC ADR-0015 was one; references in CLAUDE.md were another) without a single normative spec. ADR-0011 makes the boundary explicit and reviewable. ADR-0012 and ADR-0013 capture newer v0.1.0 product/runtime seams that were not present in the POC.
74
-
75
- ## Contributing a new ADR
76
-
77
- 1. Pick the next unused number after the highest existing ADR.
78
- 2. File: `docs/adr/<NNNN>-<kebab-title>.md`.
79
- 3. Sections: Status, Date, Context, Decision, Consequences, Alternatives, How to apply, Implementation status.
80
- 4. Link from this README's table.
81
- 5. Land it in a PR alongside (or before) the implementation it documents — ADR-as-design-artifact, not ADR-as-archaeology.
82
-
83
- ## ADR-lite records
84
-
85
- These retain their issue-based filenames and original decision status.
86
-
87
- | Record | Status |
88
- |---|---|
89
- | [#803 Request diagnostics](adr-lite-803-request-diagnostics.md) | Implemented |
90
- | [#808 Route readiness](adr-lite-808-route-readiness.md) | Accepted |
91
- | [#809 Bounded public content](adr-lite-809-bounded-public-content.md) | Implemented |
92
- | [#812 Native parity](adr-lite-812-native-parity.md) | Implemented; deployment evidence linked in record |
93
- | [#823 Home statistics](adr-lite-823-home-statistics.md) | Proposed; unmerged demo |
94
- | [#842 MCP authoring](adr-lite-842-mcp-authoring.md) | Accepted |
95
- | [#845 Frontend client](adr-lite-845-frontend-client.md) | Accepted |
96
- | [#861 Admin WebMCP](adr-lite-861-admin-webmcp.md) | Accepted |
97
- | [909 Admin UI kit](adr-lite-909-admin-ui-kit.md) | Accepted; amended by 0029 |
98
- | [#1376 Admin extensions](adr-lite-1376-admin-extensions.md) | Accepted |
@@ -1,330 +0,0 @@
1
- # ADR-lite 1376: Admin extensions
2
-
3
- **Status:** Accepted (revision 3: the full contract, for hosts and for
4
- projects; replaces the pages-only draft)
5
-
6
- ## Context
7
-
8
- A project or the host that mounts Admin sometimes needs its own UI next to the generated
9
- collections, Views and operations. Examples are an operator's
10
- access-management screen, a record action that calls a host service, or a
11
- field widget for a host-specific format. Today the Admin SPA has no way to add
12
- any of these:
13
-
14
- - Its routes and navigation are fixed.
15
- - `createAdminSurface` has no host routes.
16
- - The UI kit (ADR-lite 909) deliberately does not export the application
17
- shell.
18
-
19
- Hosts are left with forking the SPA or patching its private DOM.
20
-
21
- The first draft of this record added whole pages only. A survey of how other
22
- products open their admin turns up the same set of extension points in
23
- almost all of them. The CMS products were Strapi, Directus, Payload, Sanity,
24
- Contentful, Keystone, Decap, Tina and WordPress. The platforms were Shopify
25
- Admin UI extensions, VS Code, Grafana, Backstage, Atlassian Forge, Figma and
26
- the Keycloak admin console. The recurring points are:
27
-
28
- - pages with a navigation entry
29
- - record and list actions
30
- - record side panels
31
- - field widgets
32
- - dashboard widgets
33
- - settings pages
34
- - server endpoints
35
-
36
- The survey also turns up five lessons that bear on this design:
37
-
38
- 1. **Only a narrow, typed surface survives major versions.** Every product
39
- that exposed its internal context or helper packages broke all its plugins
40
- at the next major: Strapi's helper-plugin, Sanity's Parts, Payload 2→3,
41
- Decap's React pin. Contentful's location-scoped SDK and Backstage's typed
42
- data refs aged well.
43
- 2. **Declare in data, run in code.** The extension says *what* attaches
44
- *where* as data. Code supplies only the behavior. Grafana had to retrofit a
45
- static mirror of its imperative `addLink` calls before it could index,
46
- validate or lazy-load extensions. Declarations can also be validated and
47
- diffed before anything runs. That matters here because agents author and
48
- deploy Mantle projects.
49
- 3. **Typed contribution points beat free-form injection zones.** Strapi 5 and
50
- Sanity steer integrators to typed actions with a position and a dialog
51
- kind. Strapi now marks its free zones internal.
52
- 4. **Navigation visibility is not authorization.** Strapi, Payload and
53
- Directus all warn about this. Every extension route has to check the
54
- caller on the server.
55
- 5. **Same-origin code has no security boundary.** That is acceptable for code
56
- the host installs and trusts. Untrusted third-party code needs an iframe
57
- (Contentful, Forge Custom UI) or remote rendering (Shopify). The contract
58
- should allow such an isolation tier later without changing.
59
-
60
- ## Decision
61
-
62
- ### 1. One declaration per extension, from the project or the host
63
-
64
- `createAdminSurface` accepts `extensions: AdminExtension[]`. Each extension
65
- pairs a declaration, which is plain data, with server handlers, which are
66
- code:
67
-
68
- ```ts
69
- {
70
- apiVersion: 1,
71
- id: 'access', // kebab-case, unique, immutable once deployed
72
- title: { en: 'Access', 'zh-TW': '存取權限' },
73
- source: ACCESS_MODULE, // the module's code; Admin serves it at {basePath}/extensions/access.js
74
- // or, served by the host instead: module: '/assets/access/admin.js', integrity?: 'sha384-…'
75
- contributes: {
76
- pages: [{ id, title, role, nav: { group: 'more' | 'settings', order? } }],
77
- settings: [{ id, title, role, schema }], // JSON Schema form, no client code
78
- actions: [{ id, title, role, target, presentation, destructive?, when? }],
79
- panels: [{ id, title, role, target, when? }],
80
- fields: [{ id, target, when?, optionsSchema? }],
81
- },
82
- handlers: {
83
- api?(request, { caller, extension, path }): Promise<Response | null>,
84
- settings?: { [id]: { load(caller), save(caller, value) } },
85
- actions?: { [id]: { run(caller, { record?, selection?, schema? }) } },
86
- },
87
- }
88
- ```
89
-
90
- ### 1a. Projects author extensions; hosts may add their own
91
-
92
- Extensions are not a host-only feature. An agent customizing a project's Admin
93
- is the main author:
94
-
95
- - A project exports `adminExtensions: AdminExtension[]`. For a new project the
96
- generated preset writes `src/admin-extensions.ts` and passes it to
97
- `createAdminSurface`; the preset is written once, so an existing
98
- `src/service.ts` wires it by hand. A host that builds Admin itself (for example a hosted
99
- platform) reads the same export and appends its own extensions.
100
- - Extension ids are one namespace per Admin. A host extension whose id
101
- collides with a project extension fails construction, so a project can
102
- never shadow a host page, and the reverse.
103
- - A module needs no build step: Admin's import map provides React, the kit and
104
- the extension helper (§4), so plain ESM works. `source` lets Admin serve the
105
- module itself, so a project needs no static-file setup; Admin computes its
106
- integrity. The same project shows the same extensions locally and when
107
- deployed; a host only adds.
108
-
109
- **Trust.** A project extension's module runs in Admin's origin with the
110
- viewer's session. That gives it no more power than the project already has:
111
- whoever can deploy the project already controls its server code, its
112
- handlers and its storage. Two rules keep that equivalence true:
113
-
114
- - Host extension routes reachable from a project's Admin origin must act only
115
- on that project. Anything wider (an organization console, other projects)
116
- lives on a different origin, so a project module never holds its session.
117
- - A host that restricts what some staff may do inside a project (fine-grained
118
- policies) must treat the right to deploy as full trust in that project, and
119
- govern deployment separately.
120
-
121
- Contributions and their targets (§1b covers how manifests use them):
122
-
123
- | Contribution | Targets (`/v1`) | Client code |
124
- | --- | --- | --- |
125
- | page | its own route `/admin/x/{extension}/{page}`; in navigation when it declares `nav` | a renderer |
126
- | settings | its own route `/admin/x/{extension}/{id}`, always in navigation | none. Admin renders `schema` (the form subset) with its form; `load` and `save` run on the server |
127
- | action | `record/v1` (record header), `list.selection/v1` (bulk), `list.toolbar/v1` | `presentation: 'run' \| 'confirm'` needs none (the server `run` is called). `'dialog'` mounts client code in an Admin dialog |
128
- | panel | `record.sidebar/v1`, `home/v1` | a renderer |
129
- | field | `field.input/v1`, `field.cell/v1` | a renderer |
130
-
131
- `when` is a closed predicate over names only: `{ schema?: string[], field?:
132
- string[], format?: string[] }`. It contains no expressions and no record
133
- values, so the server can evaluate it.
134
-
135
- `role` is the minimum staff role, the same vocabulary as `requires.auth`. It is
136
- required except on `fields`, where it defaults to `contributor`.
137
-
138
- ### 1b. Manifests pick contributions through `uiSchema`
139
-
140
- There are two ways to attach a contribution. Both stay:
141
-
142
- - **From the manifest.** `uiSchema` already chooses Admin presentation
143
- (`fields.<name>.widget: textarea`, `list.columns`, `collectionAction`).
144
- It may also name a contribution as `<extension>/<contribution>`:
145
-
146
- ```yaml
147
- # Schema products
148
- uiSchema:
149
- fields:
150
- color: { widget: brand-kit/color, options: { palette: brand } }
151
- notes: { widget: textarea }
152
- list:
153
- cells: { color: brand-kit/swatch } # field.cell/v1
154
- panels: [brand-kit/usage] # record.sidebar/v1
155
- # Procedure reassign-order (uiSchema.fields.<name>.widget works the same)
156
- # View sales-by-region
157
- uiSchema:
158
- list: { cells: { region: maps/region-badge } }
159
- ```
160
-
161
- - The binding sits next to the field it changes. An agent writes both in
162
- one change, and a manifest review shows it.
163
- - `options` is passed to the renderer as `ctx.options`. A contribution may
164
- declare `optionsSchema` (the settings form subset). `options` is checked
165
- against it, and a contribution without one refuses `options`.
166
- - The target kind must match the key: `fields.*.widget` names a
167
- `field.input/v1` contribution, `list.cells.*` a `field.cell/v1`
168
- contribution, and `panels` a `record.sidebar/v1` contribution.
169
- - **From the extension.** `when: { schema, field, format }` attaches a
170
- contribution everywhere it matches without touching manifests, for example
171
- every field with `x-mcp-hint: money-minor`. This suits host extensions and
172
- cross-cutting widgets.
173
-
174
- When both apply to one place, the manifest wins.
175
-
176
- **Validation.**
177
- - The manifest grammar checks the shape: `<extension>/<contribution>` with
178
- kebab-case parts. `textarea` stays the one built-in widget.
179
- - Whether the named contribution exists, has the right target and accepts the
180
- `options` is checked where the plan and the extensions meet:
181
- - `createAdminSurface` fails construction with `UI_EXTENSION_UNKNOWN`,
182
- `UI_EXTENSION_TARGET` or `UI_EXTENSION_OPTIONS`.
183
- - `checkPlanUiExtensions(plan, extensions)` is exported, so a deploy step or
184
- a test can run the same check before the service starts.
185
-
186
- **Who may be named.** A manifest should name only the project's own
187
- extensions, so the project renders the same locally and when deployed; a host
188
- attaches its contributions with `when` instead. Core cannot enforce this: the
189
- extensions reach `createAdminSurface` as one list with no provenance, so it
190
- checks existence, target and options, not ownership. A host that must keep
191
- manifests from naming its contributions checks the plan's names
192
- (`planUiExtensionRefs`) against its own ids before it starts Admin.
193
-
194
- **A named widget is a decision.** When `uiSchema.fields.<name>.widget` names
195
- any widget, `textarea` included, a matching `when` does not replace it; a
196
- contribution the viewer's role does not reach falls back to Admin's own
197
- control, not to `when`.
198
-
199
- **Effect.** `uiSchema` stays presentation only. It never changes validation,
200
- MCP schemas or authorization. The field's JSON Schema still validates what a
201
- widget sends.
202
-
203
- ### 2. The server decides what a caller sees, and checks again on use
204
-
205
- - `GET /admin/api/site` (and bootstrap's `site`) returns the contributions
206
- the caller's role reaches, with their declarations only. Handlers and
207
- `integrity` are not sent.
208
- - Every extension route checks a signed-in staff session and the
209
- contribution's role before it calls the host:
210
- - `{basePath}/api/x/{extension}/settings/{id}`: `GET` → `load`, `PATCH { value }` → `save`
211
- - `{basePath}/api/x/{extension}/actions/{id}`: `POST` → `run`, with `{ record }`, `{ selection }` or `{ schema }` for the action's target; `when.schema` is enforced here too
212
- - `{basePath}/api/x/{extension}/api/{path}` → `api`, for the extension's lowest contribution role
213
- - `GET {basePath}/extensions/{id}.js` → a `source` extension's module, for the same role
214
- - `save` input is validated against `schema` before the host sees it (400 with
215
- `error.fields` otherwise).
216
- - `null` answers 404. Answers are `no-store` unless the host sets
217
- `cache-control`. Cross-site mutation protection is the `withCaller`
218
- wrapper's, as for every Admin route.
219
- - The checks above are the minimum. Finer authorization is the host's, inside
220
- its handlers.
221
-
222
- ### 3. Client modules supply renderers keyed by contribution id
223
-
224
- ```ts
225
- import { defineAdminExtension } from '@aotter/mantle-ui/extension'
226
-
227
- export default defineAdminExtension({
228
- pages: { overview: (element, ctx) => cleanup },
229
- actions: { 'reassign': (element, ctx) => cleanup }, // dialog presentation only
230
- panels: { 'history': (element, ctx) => cleanup },
231
- fields: { 'color': (element, ctx) => ({ update(next) {}, unmount() {} }) },
232
- })
233
- ```
234
-
235
- A renderer returns nothing, a cleanup, or `{ update, unmount }`. With `update`,
236
- Admin passes later contexts (a new value, a new language) in place instead of
237
- mounting again; a field value the renderer reported itself never remounts it.
238
-
239
- - Admin imports `module` once, when a contribution that needs it is first
240
- shown, and calls the renderer for that contribution.
241
- - A renderer for an undeclared contribution is ignored. A declared
242
- contribution without a renderer shows an error in its place.
243
- - The context is serializable and typed per target. It holds `{ extension,
244
- contribution, apiBase, language, theme, caller: { role } }` plus:
245
- - `record: { schema, id, version }` for record targets
246
- - `selection: { schema, ids }` for list targets
247
- - `field: { schema, name, value, readOnly, property }` for field targets,
248
- and `options` from `uiSchema`; `field.input/v1` also gets `onChange(value)`
249
- - A small `host` object offers `navigate(path)`, `notify(message)` and
250
- `close()` for dialogs.
251
- - Admin offers no other SPA API. This is a supported surface, not a sandbox:
252
- the module is trusted same-origin code (§5).
253
- - Each mount gets a fresh element. A renderer that resolves after its mount was
254
- replaced writes into a detached node, never over the current one.
255
-
256
- ### 4. Shared dependencies come from Admin
257
-
258
- - Admin's HTML declares an import map for `react`, `react/jsx-runtime`,
259
- `react-dom`, `react-dom/client`, `@aotter/mantle-ui/kit` and
260
- `@aotter/mantle-ui/extension`, served beside the shell. The React entries
261
- re-export Admin's own instance; the kit and the helper are real modules
262
- that import React through the same map, and the kit's stylesheet loads with
263
- the first extension.
264
- - Extension modules use these specifiers directly (or mark them external when
265
- bundling). They share Admin's single React and keep its look, theme and
266
- accessibility.
267
- - The kit and the extension helper are the whole public UI surface. The shell
268
- stays private (ADR-lite 909).
269
-
270
- ### 5. Trust tier
271
-
272
- - Extensions are trusted host code. They run in Admin's origin with Admin's
273
- privileges, and Core does not sandbox them.
274
- - `module` must be a same-origin path, so Admin keeps its existing CSP and
275
- framing policy.
276
- - `integrity` (given for `module`, computed for `source`) goes into the
277
- shell's import map, so the browser enforces it on import.
278
- - An isolated tier for untrusted extensions is reserved and is not part of
279
- this decision. Because contexts are serializable and the UI surface is the
280
- kit, an iframe or remote-rendering tier can reuse this declaration format
281
- unchanged.
282
-
283
- ### 6. Stability and tooling
284
-
285
- - `apiVersion` and the `/v1` target names version the contract. Within a
286
- version, changes are additive only. A breaking change adds `/v2`, and both
287
- run side by side through a deprecation window.
288
- - Construction validates every declaration and fails on:
289
- - a bad or duplicate id
290
- - an unknown target or `apiVersion`
291
- - a non-same-origin `module`, or both `module` and `source`
292
- - a contribution that needs code when there is neither
293
- - a settings `schema` outside the form subset
294
- - Core exports the declaration's JSON Schema, so tooling and agents can check
295
- a declaration without running it.
296
- - Core also exports `diffAdminExtensions(previous, next)`. It reports added
297
- and removed contributions, role changes and module changes, for review
298
- screens.
299
-
300
- ## Non-goals
301
-
302
- - Replacing the shell, navigation component or layout.
303
- - Free-form injection into arbitrary DOM.
304
- - A marketplace or untrusted third-party extensions (reserved tier, above).
305
- - Server-side sandboxing of handlers. They are host code in the host's
306
- process.
307
- - Declaring extensions in the YAML manifest. They live in the project's
308
- service module (TypeScript), so the four-atom grammar does not change.
309
-
310
- ## Consequences
311
-
312
- - Projects and hosts add pages, settings, actions, panels and field widgets
313
- without forking the SPA, and the SPA stays one build. Without
314
- `extensions`, nothing changes.
315
- - An agent can customize a project's Admin with a small module and a
316
- declaration that tooling validates and diffs before deploy. A `uiSchema`
317
- line in the manifest binds it to a field, a list cell or a record panel.
318
- - The `uiSchema` vocabulary widens: `fields.<name>.widget` accepts
319
- `<extension>/<contribution>` beside `textarea`, with `options`; Schemas gain
320
- `list.cells` and `panels`; staff Views gain `list.cells`. This record is the
321
- grammar decision CONTRIBUTING requires for new keys: the name's shape is
322
- closed and checked at generate time (`SCHEMA_UI_INVALID`,
323
- `VIEW_UI_INVALID`), and its existence at construction
324
- (`UI_EXTENSION_UNKNOWN`, `UI_EXTENSION_TARGET`, `UI_EXTENSION_OPTIONS`).
325
- - Settings pages need no client code at all. This covers most host
326
- configuration screens and is the easiest kind for an agent to author and
327
- review.
328
- - Admin takes on an import map and the `@aotter/mantle-ui/extension` entry.
329
- - The first draft's `extensions: { pages, api }` is replaced before any
330
- release; it was never published.