primitive-admin 1.1.0-alpha.8 → 1.1.0-alpha.81

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 (531) hide show
  1. package/README.md +446 -108
  2. package/assets/skill/skills/primitive-platform/SKILL.md +811 -0
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +372 -21
  5. package/dist/bin/primitive.js.map +1 -1
  6. package/dist/src/commands/admins.d.ts +2 -0
  7. package/dist/src/commands/admins.js +128 -19
  8. package/dist/src/commands/admins.js.map +1 -1
  9. package/dist/src/commands/analytics.d.ts +2 -0
  10. package/dist/src/commands/analytics.js +700 -55
  11. package/dist/src/commands/analytics.js.map +1 -1
  12. package/dist/src/commands/apps.d.ts +2 -0
  13. package/dist/src/commands/apps.js +54 -96
  14. package/dist/src/commands/apps.js.map +1 -1
  15. package/dist/src/commands/auth.d.ts +2 -0
  16. package/dist/src/commands/auth.js +196 -105
  17. package/dist/src/commands/auth.js.map +1 -1
  18. package/dist/src/commands/blob-buckets.d.ts +2 -0
  19. package/dist/src/commands/blob-buckets.js +330 -0
  20. package/dist/src/commands/blob-buckets.js.map +1 -0
  21. package/dist/src/commands/catalog.d.ts +2 -0
  22. package/dist/src/commands/catalog.js +37 -38
  23. package/dist/src/commands/catalog.js.map +1 -1
  24. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  25. package/dist/src/commands/collection-type-configs.js +84 -0
  26. package/dist/src/commands/collection-type-configs.js.map +1 -0
  27. package/dist/src/commands/collections.d.ts +2 -0
  28. package/dist/src/commands/collections.js +565 -0
  29. package/dist/src/commands/collections.js.map +1 -0
  30. package/dist/src/commands/comparisons.d.ts +2 -0
  31. package/dist/src/commands/comparisons.js +6 -6
  32. package/dist/src/commands/comparisons.js.map +1 -1
  33. package/dist/src/commands/config.d.ts +46 -0
  34. package/dist/src/commands/config.js +465 -0
  35. package/dist/src/commands/config.js.map +1 -0
  36. package/dist/src/commands/connections.d.ts +2 -0
  37. package/dist/src/commands/connections.js +100 -0
  38. package/dist/src/commands/connections.js.map +1 -0
  39. package/dist/src/commands/cron-triggers.d.ts +2 -0
  40. package/dist/src/commands/cron-triggers.js +265 -0
  41. package/dist/src/commands/cron-triggers.js.map +1 -0
  42. package/dist/src/commands/database-type-configs.d.ts +2 -0
  43. package/dist/src/commands/database-type-configs.js +163 -0
  44. package/dist/src/commands/database-type-configs.js.map +1 -0
  45. package/dist/src/commands/database-types.d.ts +2 -0
  46. package/dist/src/commands/database-types.js +171 -0
  47. package/dist/src/commands/database-types.js.map +1 -0
  48. package/dist/src/commands/databases.d.ts +65 -0
  49. package/dist/src/commands/databases.js +1857 -238
  50. package/dist/src/commands/databases.js.map +1 -1
  51. package/dist/src/commands/documents.d.ts +2 -0
  52. package/dist/src/commands/documents.js +2062 -19
  53. package/dist/src/commands/documents.js.map +1 -1
  54. package/dist/src/commands/email-templates.d.ts +2 -0
  55. package/dist/src/commands/email-templates.js +174 -0
  56. package/dist/src/commands/email-templates.js.map +1 -0
  57. package/dist/src/commands/env.d.ts +23 -0
  58. package/dist/src/commands/env.js +385 -0
  59. package/dist/src/commands/env.js.map +1 -0
  60. package/dist/src/commands/feature-flags.d.ts +14 -0
  61. package/dist/src/commands/feature-flags.js +116 -0
  62. package/dist/src/commands/feature-flags.js.map +1 -0
  63. package/dist/src/commands/functions.d.ts +20 -0
  64. package/dist/src/commands/functions.js +765 -0
  65. package/dist/src/commands/functions.js.map +1 -0
  66. package/dist/src/commands/group-type-configs.d.ts +2 -0
  67. package/dist/src/commands/group-type-configs.js +86 -0
  68. package/dist/src/commands/group-type-configs.js.map +1 -0
  69. package/dist/src/commands/groups.d.ts +2 -0
  70. package/dist/src/commands/groups.js +39 -108
  71. package/dist/src/commands/groups.js.map +1 -1
  72. package/dist/src/commands/guides.d.ts +223 -0
  73. package/dist/src/commands/guides.js +617 -65
  74. package/dist/src/commands/guides.js.map +1 -1
  75. package/dist/src/commands/init.d.ts +37 -0
  76. package/dist/src/commands/init.js +1693 -208
  77. package/dist/src/commands/init.js.map +1 -1
  78. package/dist/src/commands/integrations.d.ts +2 -0
  79. package/dist/src/commands/integrations.js +402 -182
  80. package/dist/src/commands/integrations.js.map +1 -1
  81. package/dist/src/commands/llm.d.ts +2 -0
  82. package/dist/src/commands/llm.js +13 -8
  83. package/dist/src/commands/llm.js.map +1 -1
  84. package/dist/src/commands/locks.d.ts +8 -0
  85. package/dist/src/commands/locks.js +160 -0
  86. package/dist/src/commands/locks.js.map +1 -0
  87. package/dist/src/commands/metadata-category-configs.d.ts +12 -0
  88. package/dist/src/commands/metadata-category-configs.js +112 -0
  89. package/dist/src/commands/metadata-category-configs.js.map +1 -0
  90. package/dist/src/commands/metadata.d.ts +2 -0
  91. package/dist/src/commands/metadata.js +281 -0
  92. package/dist/src/commands/metadata.js.map +1 -0
  93. package/dist/src/commands/prompts.d.ts +2 -0
  94. package/dist/src/commands/prompts.js +275 -621
  95. package/dist/src/commands/prompts.js.map +1 -1
  96. package/dist/src/commands/rule-sets.d.ts +3 -0
  97. package/dist/src/commands/rule-sets.js +137 -147
  98. package/dist/src/commands/rule-sets.js.map +1 -1
  99. package/dist/src/commands/scripts.d.ts +30 -0
  100. package/dist/src/commands/scripts.js +679 -0
  101. package/dist/src/commands/scripts.js.map +1 -0
  102. package/dist/src/commands/secrets.d.ts +2 -0
  103. package/dist/src/commands/secrets.js +108 -0
  104. package/dist/src/commands/secrets.js.map +1 -0
  105. package/dist/src/commands/sessions.d.ts +2 -0
  106. package/dist/src/commands/sessions.js +75 -0
  107. package/dist/src/commands/sessions.js.map +1 -0
  108. package/dist/src/commands/settings.d.ts +18 -0
  109. package/dist/src/commands/settings.js +54 -0
  110. package/dist/src/commands/settings.js.map +1 -0
  111. package/dist/src/commands/skill.d.ts +2 -0
  112. package/dist/src/commands/skill.js +29 -0
  113. package/dist/src/commands/skill.js.map +1 -0
  114. package/dist/src/commands/sync-app-settings.d.ts +158 -0
  115. package/dist/src/commands/sync-app-settings.js +328 -0
  116. package/dist/src/commands/sync-app-settings.js.map +1 -0
  117. package/dist/src/commands/sync.d.ts +2514 -0
  118. package/dist/src/commands/sync.js +16085 -848
  119. package/dist/src/commands/sync.js.map +1 -1
  120. package/dist/src/commands/tokens.d.ts +2 -0
  121. package/dist/src/commands/tokens.js +130 -21
  122. package/dist/src/commands/tokens.js.map +1 -1
  123. package/dist/src/commands/users.d.ts +2 -0
  124. package/dist/src/commands/users.js +532 -23
  125. package/dist/src/commands/users.js.map +1 -1
  126. package/dist/src/commands/vars.d.ts +8 -0
  127. package/dist/src/commands/vars.js +96 -0
  128. package/dist/src/commands/vars.js.map +1 -0
  129. package/dist/src/commands/waitlist.d.ts +2 -0
  130. package/dist/src/commands/waitlist.js +10 -10
  131. package/dist/src/commands/waitlist.js.map +1 -1
  132. package/dist/src/commands/webhooks.d.ts +31 -0
  133. package/dist/src/commands/webhooks.js +626 -0
  134. package/dist/src/commands/webhooks.js.map +1 -0
  135. package/dist/src/commands/workflows.d.ts +116 -0
  136. package/dist/src/commands/workflows.js +1638 -729
  137. package/dist/src/commands/workflows.js.map +1 -1
  138. package/dist/src/lib/access-rule-display.d.ts +21 -0
  139. package/dist/src/lib/access-rule-display.js +34 -0
  140. package/dist/src/lib/access-rule-display.js.map +1 -0
  141. package/dist/src/lib/api-client.d.ts +2147 -0
  142. package/dist/src/lib/api-client.js +2042 -160
  143. package/dist/src/lib/api-client.js.map +1 -1
  144. package/dist/src/lib/app-match-guard.d.ts +44 -0
  145. package/dist/src/lib/app-match-guard.js +72 -0
  146. package/dist/src/lib/app-match-guard.js.map +1 -0
  147. package/dist/src/lib/app-settings-descriptor.d.ts +263 -0
  148. package/dist/src/lib/app-settings-descriptor.js +584 -0
  149. package/dist/src/lib/app-settings-descriptor.js.map +1 -0
  150. package/dist/src/lib/auth-flow.d.ts +8 -0
  151. package/dist/src/lib/batch.d.ts +26 -0
  152. package/dist/src/lib/batch.js +32 -0
  153. package/dist/src/lib/batch.js.map +1 -0
  154. package/dist/src/lib/block-layout.d.ts +160 -0
  155. package/dist/src/lib/block-layout.js +451 -0
  156. package/dist/src/lib/block-layout.js.map +1 -0
  157. package/dist/src/lib/block-selector.d.ts +58 -0
  158. package/dist/src/lib/block-selector.js +92 -0
  159. package/dist/src/lib/block-selector.js.map +1 -0
  160. package/dist/src/lib/canonical-json.d.ts +12 -0
  161. package/dist/src/lib/canonical-json.js +35 -0
  162. package/dist/src/lib/canonical-json.js.map +1 -0
  163. package/dist/src/lib/channel.d.ts +30 -0
  164. package/dist/src/lib/channel.js +68 -0
  165. package/dist/src/lib/channel.js.map +1 -0
  166. package/dist/src/lib/cli-manifest.d.ts +68 -0
  167. package/dist/src/lib/cli-manifest.js +71 -0
  168. package/dist/src/lib/cli-manifest.js.map +1 -0
  169. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +101 -0
  170. package/dist/src/lib/codegen-shared/generatedFiles.js +191 -0
  171. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
  172. package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
  173. package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
  174. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
  175. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +38 -0
  176. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +46 -0
  177. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
  178. package/dist/src/lib/config-json-field.d.ts +28 -0
  179. package/dist/src/lib/config-json-field.js +56 -0
  180. package/dist/src/lib/config-json-field.js.map +1 -0
  181. package/dist/src/lib/config-object-descriptor.d.ts +127 -0
  182. package/dist/src/lib/config-object-descriptor.js +696 -0
  183. package/dist/src/lib/config-object-descriptor.js.map +1 -0
  184. package/dist/src/lib/config-payload.d.ts +85 -0
  185. package/dist/src/lib/config-payload.js +116 -0
  186. package/dist/src/lib/config-payload.js.map +1 -0
  187. package/dist/src/lib/config-surface.d.ts +140 -0
  188. package/dist/src/lib/config-surface.js +317 -0
  189. package/dist/src/lib/config-surface.js.map +1 -0
  190. package/dist/src/lib/config-toml.d.ts +10 -0
  191. package/dist/src/lib/config-toml.js +42 -0
  192. package/dist/src/lib/config-toml.js.map +1 -0
  193. package/dist/src/lib/config.d.ts +71 -0
  194. package/dist/src/lib/config.js +71 -68
  195. package/dist/src/lib/config.js.map +1 -1
  196. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  197. package/dist/src/lib/confirm-prompt.js +110 -0
  198. package/dist/src/lib/confirm-prompt.js.map +1 -0
  199. package/dist/src/lib/constants.d.ts +11 -0
  200. package/dist/src/lib/constants.js +12 -0
  201. package/dist/src/lib/constants.js.map +1 -0
  202. package/dist/src/lib/crash-handlers.d.ts +20 -0
  203. package/dist/src/lib/crash-handlers.js +49 -0
  204. package/dist/src/lib/crash-handlers.js.map +1 -0
  205. package/dist/src/lib/credentials-store.d.ts +104 -0
  206. package/dist/src/lib/credentials-store.js +336 -0
  207. package/dist/src/lib/credentials-store.js.map +1 -0
  208. package/dist/src/lib/csv.d.ts +47 -0
  209. package/dist/src/lib/csv.js +172 -0
  210. package/dist/src/lib/csv.js.map +1 -0
  211. package/dist/src/lib/data-input.d.ts +23 -0
  212. package/dist/src/lib/data-input.js +50 -0
  213. package/dist/src/lib/data-input.js.map +1 -0
  214. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  215. package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
  216. package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
  217. package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
  218. package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
  219. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
  220. package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
  221. package/dist/src/lib/db-codegen/dbNaming.js +180 -0
  222. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
  223. package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
  224. package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
  225. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
  226. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
  227. package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
  228. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
  229. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
  230. package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
  231. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
  232. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
  233. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
  234. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
  235. package/dist/src/lib/document-export-permissions.d.ts +30 -0
  236. package/dist/src/lib/document-export-permissions.js +54 -0
  237. package/dist/src/lib/document-export-permissions.js.map +1 -0
  238. package/dist/src/lib/env-resolver-core.d.ts +258 -0
  239. package/dist/src/lib/env-resolver-core.js +440 -0
  240. package/dist/src/lib/env-resolver-core.js.map +1 -0
  241. package/dist/src/lib/env-resolver.d.ts +99 -0
  242. package/dist/src/lib/env-resolver.js +153 -0
  243. package/dist/src/lib/env-resolver.js.map +1 -0
  244. package/dist/src/lib/fetch.d.ts +5 -0
  245. package/dist/src/lib/function-bundle.d.ts +141 -0
  246. package/dist/src/lib/function-bundle.js +333 -0
  247. package/dist/src/lib/function-bundle.js.map +1 -0
  248. package/dist/src/lib/function-collect.d.ts +123 -0
  249. package/dist/src/lib/function-collect.js +594 -0
  250. package/dist/src/lib/function-collect.js.map +1 -0
  251. package/dist/src/lib/function-db-types.d.ts +187 -0
  252. package/dist/src/lib/function-db-types.js +782 -0
  253. package/dist/src/lib/function-db-types.js.map +1 -0
  254. package/dist/src/lib/function-document-types.d.ts +50 -0
  255. package/dist/src/lib/function-document-types.js +163 -0
  256. package/dist/src/lib/function-document-types.js.map +1 -0
  257. package/dist/src/lib/function-grants-preflight.d.ts +64 -0
  258. package/dist/src/lib/function-grants-preflight.js +100 -0
  259. package/dist/src/lib/function-grants-preflight.js.map +1 -0
  260. package/dist/src/lib/function-log-tail.d.ts +83 -0
  261. package/dist/src/lib/function-log-tail.js +115 -0
  262. package/dist/src/lib/function-log-tail.js.map +1 -0
  263. package/dist/src/lib/function-schema-codegen.d.ts +135 -0
  264. package/dist/src/lib/function-schema-codegen.js +419 -0
  265. package/dist/src/lib/function-schema-codegen.js.map +1 -0
  266. package/dist/src/lib/function-sync.d.ts +263 -0
  267. package/dist/src/lib/function-sync.js +604 -0
  268. package/dist/src/lib/function-sync.js.map +1 -0
  269. package/dist/src/lib/function-triggers.d.ts +66 -0
  270. package/dist/src/lib/function-triggers.js +285 -0
  271. package/dist/src/lib/function-triggers.js.map +1 -0
  272. package/dist/src/lib/function-typecheck.d.ts +86 -0
  273. package/dist/src/lib/function-typecheck.js +370 -0
  274. package/dist/src/lib/function-typecheck.js.map +1 -0
  275. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  276. package/dist/src/lib/generated-allowlist.js +281 -0
  277. package/dist/src/lib/generated-allowlist.js.map +1 -0
  278. package/dist/src/lib/generated-config-surfaces.d.ts +1755 -0
  279. package/dist/src/lib/generated-config-surfaces.js +6817 -0
  280. package/dist/src/lib/generated-config-surfaces.js.map +1 -0
  281. package/dist/src/lib/generated-sdk-types.d.ts +12 -0
  282. package/dist/src/lib/generated-sdk-types.js +13 -0
  283. package/dist/src/lib/generated-sdk-types.js.map +1 -0
  284. package/dist/src/lib/generated-template-lint.d.ts +212 -0
  285. package/dist/src/lib/generated-template-lint.js +624 -0
  286. package/dist/src/lib/generated-template-lint.js.map +1 -0
  287. package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
  288. package/dist/src/lib/generated-workflow-model-fields.js +53 -0
  289. package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
  290. package/dist/src/lib/google-client-secret-status.d.ts +35 -0
  291. package/dist/src/lib/google-client-secret-status.js +56 -0
  292. package/dist/src/lib/google-client-secret-status.js.map +1 -0
  293. package/dist/src/lib/init-adopt.d.ts +16 -0
  294. package/dist/src/lib/init-adopt.js +34 -0
  295. package/dist/src/lib/init-adopt.js.map +1 -0
  296. package/dist/src/lib/init-assets.d.ts +39 -0
  297. package/dist/src/lib/init-assets.js +97 -0
  298. package/dist/src/lib/init-assets.js.map +1 -0
  299. package/dist/src/lib/init-client-platforms.d.ts +14 -0
  300. package/dist/src/lib/init-client-platforms.js +71 -0
  301. package/dist/src/lib/init-client-platforms.js.map +1 -0
  302. package/dist/src/lib/init-config.d.ts +98 -0
  303. package/dist/src/lib/init-config.js +186 -0
  304. package/dist/src/lib/init-config.js.map +1 -0
  305. package/dist/src/lib/init-email-redirect-uris.d.ts +37 -0
  306. package/dist/src/lib/init-email-redirect-uris.js +46 -0
  307. package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
  308. package/dist/src/lib/init-ios-links.d.ts +91 -0
  309. package/dist/src/lib/init-ios-links.js +219 -0
  310. package/dist/src/lib/init-ios-links.js.map +1 -0
  311. package/dist/src/lib/init-plan.d.ts +80 -0
  312. package/dist/src/lib/init-plan.js +95 -0
  313. package/dist/src/lib/init-plan.js.map +1 -0
  314. package/dist/src/lib/init-production-env.d.ts +48 -0
  315. package/dist/src/lib/init-production-env.js +59 -0
  316. package/dist/src/lib/init-production-env.js.map +1 -0
  317. package/dist/src/lib/init-schema.d.ts +74 -0
  318. package/dist/src/lib/init-schema.js +358 -0
  319. package/dist/src/lib/init-schema.js.map +1 -0
  320. package/dist/src/lib/init-xcode.d.ts +34 -0
  321. package/dist/src/lib/init-xcode.js +138 -0
  322. package/dist/src/lib/init-xcode.js.map +1 -0
  323. package/dist/src/lib/integration-request-config.d.ts +30 -0
  324. package/dist/src/lib/integration-request-config.js +145 -0
  325. package/dist/src/lib/integration-request-config.js.map +1 -0
  326. package/dist/src/lib/integration-selector.d.ts +42 -0
  327. package/dist/src/lib/integration-selector.js +46 -0
  328. package/dist/src/lib/integration-selector.js.map +1 -0
  329. package/dist/src/lib/ios-app-id.d.ts +34 -0
  330. package/dist/src/lib/ios-app-id.js +69 -0
  331. package/dist/src/lib/ios-app-id.js.map +1 -0
  332. package/dist/src/lib/local-state.d.ts +55 -0
  333. package/dist/src/lib/local-state.js +167 -0
  334. package/dist/src/lib/local-state.js.map +1 -0
  335. package/dist/src/lib/local-test-cases.d.ts +63 -0
  336. package/dist/src/lib/local-test-cases.js +136 -0
  337. package/dist/src/lib/local-test-cases.js.map +1 -0
  338. package/dist/src/lib/log-inspection.d.ts +680 -0
  339. package/dist/src/lib/log-inspection.js +784 -0
  340. package/dist/src/lib/log-inspection.js.map +1 -0
  341. package/dist/src/lib/migration-nag.d.ts +49 -0
  342. package/dist/src/lib/migration-nag.js +164 -0
  343. package/dist/src/lib/migration-nag.js.map +1 -0
  344. package/dist/src/lib/object-status-filter.d.ts +22 -0
  345. package/dist/src/lib/object-status-filter.js +45 -0
  346. package/dist/src/lib/object-status-filter.js.map +1 -0
  347. package/dist/src/lib/output.d.ts +109 -0
  348. package/dist/src/lib/output.js +191 -8
  349. package/dist/src/lib/output.js.map +1 -1
  350. package/dist/src/lib/package-manager.d.ts +140 -0
  351. package/dist/src/lib/package-manager.js +305 -0
  352. package/dist/src/lib/package-manager.js.map +1 -0
  353. package/dist/src/lib/paginate.d.ts +83 -0
  354. package/dist/src/lib/paginate.js +95 -0
  355. package/dist/src/lib/paginate.js.map +1 -0
  356. package/dist/src/lib/platform-owned.d.ts +63 -0
  357. package/dist/src/lib/platform-owned.js +85 -0
  358. package/dist/src/lib/platform-owned.js.map +1 -0
  359. package/dist/src/lib/project-config.d.ts +122 -0
  360. package/dist/src/lib/project-config.js +244 -0
  361. package/dist/src/lib/project-config.js.map +1 -0
  362. package/dist/src/lib/query-operators.d.ts +43 -0
  363. package/dist/src/lib/query-operators.js +80 -0
  364. package/dist/src/lib/query-operators.js.map +1 -0
  365. package/dist/src/lib/record-filter.d.ts +18 -0
  366. package/dist/src/lib/record-filter.js +55 -0
  367. package/dist/src/lib/record-filter.js.map +1 -0
  368. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  369. package/dist/src/lib/refresh-admin-credentials.js +103 -0
  370. package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
  371. package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
  372. package/dist/src/lib/resolve-init-dev-port.js +55 -0
  373. package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
  374. package/dist/src/lib/resolve-init-server.d.ts +64 -0
  375. package/dist/src/lib/resolve-init-server.js +77 -0
  376. package/dist/src/lib/resolve-init-server.js.map +1 -0
  377. package/dist/src/lib/resolve-platform.d.ts +74 -0
  378. package/dist/src/lib/resolve-platform.js +105 -0
  379. package/dist/src/lib/resolve-platform.js.map +1 -0
  380. package/dist/src/lib/run-status.d.ts +19 -0
  381. package/dist/src/lib/run-status.generated.d.ts +39 -0
  382. package/dist/src/lib/run-status.generated.js +66 -0
  383. package/dist/src/lib/run-status.generated.js.map +1 -0
  384. package/dist/src/lib/run-status.js +19 -0
  385. package/dist/src/lib/run-status.js.map +1 -0
  386. package/dist/src/lib/server-text-normalization.d.ts +51 -0
  387. package/dist/src/lib/server-text-normalization.js +90 -0
  388. package/dist/src/lib/server-text-normalization.js.map +1 -0
  389. package/dist/src/lib/server-url.d.ts +22 -0
  390. package/dist/src/lib/server-url.js +33 -0
  391. package/dist/src/lib/server-url.js.map +1 -0
  392. package/dist/src/lib/signing-secret-status.d.ts +81 -0
  393. package/dist/src/lib/signing-secret-status.js +116 -0
  394. package/dist/src/lib/signing-secret-status.js.map +1 -0
  395. package/dist/src/lib/skill-installer.d.ts +25 -0
  396. package/dist/src/lib/skill-installer.js +266 -0
  397. package/dist/src/lib/skill-installer.js.map +1 -0
  398. package/dist/src/lib/snapshots.d.ts +98 -0
  399. package/dist/src/lib/snapshots.js +294 -0
  400. package/dist/src/lib/snapshots.js.map +1 -0
  401. package/dist/src/lib/swift-codegen/banners.d.ts +18 -0
  402. package/dist/src/lib/swift-codegen/banners.js +19 -0
  403. package/dist/src/lib/swift-codegen/banners.js.map +1 -0
  404. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +113 -0
  405. package/dist/src/lib/swift-codegen/dbGenerator.js +918 -0
  406. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
  407. package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
  408. package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
  409. package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
  410. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +119 -0
  411. package/dist/src/lib/swift-codegen/functionGenerator.js +413 -0
  412. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -0
  413. package/dist/src/lib/swift-codegen/generator.d.ts +100 -0
  414. package/dist/src/lib/swift-codegen/generator.js +451 -0
  415. package/dist/src/lib/swift-codegen/generator.js.map +1 -0
  416. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +87 -0
  417. package/dist/src/lib/swift-codegen/schemaToSwift.js +661 -0
  418. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
  419. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +94 -0
  420. package/dist/src/lib/swift-codegen/siblingSymbols.js +155 -0
  421. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
  422. package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
  423. package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
  424. package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
  425. package/dist/src/lib/sync-dir-selector.d.ts +21 -0
  426. package/dist/src/lib/sync-dir-selector.js +30 -0
  427. package/dist/src/lib/sync-dir-selector.js.map +1 -0
  428. package/dist/src/lib/sync-paths.d.ts +128 -0
  429. package/dist/src/lib/sync-paths.js +195 -0
  430. package/dist/src/lib/sync-paths.js.map +1 -0
  431. package/dist/src/lib/sync-resource-types.d.ts +563 -0
  432. package/dist/src/lib/sync-resource-types.js +1073 -0
  433. package/dist/src/lib/sync-resource-types.js.map +1 -0
  434. package/dist/src/lib/sync-selectors.d.ts +95 -0
  435. package/dist/src/lib/sync-selectors.js +228 -0
  436. package/dist/src/lib/sync-selectors.js.map +1 -0
  437. package/dist/src/lib/template.d.ts +170 -0
  438. package/dist/src/lib/template.js +484 -68
  439. package/dist/src/lib/template.js.map +1 -1
  440. package/dist/src/lib/test-case-file-names.d.ts +40 -0
  441. package/dist/src/lib/test-case-file-names.js +91 -0
  442. package/dist/src/lib/test-case-file-names.js.map +1 -0
  443. package/dist/src/lib/test-case-keys.d.ts +29 -0
  444. package/dist/src/lib/test-case-keys.js +55 -0
  445. package/dist/src/lib/test-case-keys.js.map +1 -0
  446. package/dist/src/lib/test-case-variables.d.ts +29 -0
  447. package/dist/src/lib/test-case-variables.js +71 -0
  448. package/dist/src/lib/test-case-variables.js.map +1 -0
  449. package/dist/src/lib/token-inject.d.ts +56 -0
  450. package/dist/src/lib/token-inject.js +204 -0
  451. package/dist/src/lib/token-inject.js.map +1 -0
  452. package/dist/src/lib/toml-database-config.d.ts +123 -0
  453. package/dist/src/lib/toml-database-config.js +544 -0
  454. package/dist/src/lib/toml-database-config.js.map +1 -0
  455. package/dist/src/lib/toml-metadata-config.d.ts +151 -0
  456. package/dist/src/lib/toml-metadata-config.js +476 -0
  457. package/dist/src/lib/toml-metadata-config.js.map +1 -0
  458. package/dist/src/lib/toml-native-form.d.ts +46 -0
  459. package/dist/src/lib/toml-native-form.js +78 -0
  460. package/dist/src/lib/toml-native-form.js.map +1 -0
  461. package/dist/src/lib/toml-params-validator.d.ts +129 -0
  462. package/dist/src/lib/toml-params-validator.js +298 -0
  463. package/dist/src/lib/toml-params-validator.js.map +1 -0
  464. package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
  465. package/dist/src/lib/toml-scalar-edit.js +283 -0
  466. package/dist/src/lib/toml-scalar-edit.js.map +1 -0
  467. package/dist/src/lib/user-selector.d.ts +24 -0
  468. package/dist/src/lib/user-selector.js +33 -0
  469. package/dist/src/lib/user-selector.js.map +1 -0
  470. package/dist/src/lib/version-check.d.ts +35 -0
  471. package/dist/src/lib/version-check.js +241 -0
  472. package/dist/src/lib/version-check.js.map +1 -0
  473. package/dist/src/lib/watch.d.ts +121 -0
  474. package/dist/src/lib/watch.js +169 -0
  475. package/dist/src/lib/watch.js.map +1 -0
  476. package/dist/src/lib/web-url.d.ts +40 -0
  477. package/dist/src/lib/web-url.js +76 -0
  478. package/dist/src/lib/web-url.js.map +1 -0
  479. package/dist/src/lib/webhook-deliver.d.ts +209 -0
  480. package/dist/src/lib/webhook-deliver.js +519 -0
  481. package/dist/src/lib/webhook-deliver.js.map +1 -0
  482. package/dist/src/lib/workflow-apply.d.ts +110 -0
  483. package/dist/src/lib/workflow-apply.js +164 -0
  484. package/dist/src/lib/workflow-apply.js.map +1 -0
  485. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
  486. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
  487. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
  488. package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
  489. package/dist/src/lib/workflow-codegen/generator.js +361 -0
  490. package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
  491. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +94 -0
  492. package/dist/src/lib/workflow-codegen/invokerIR.js +76 -0
  493. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
  494. package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
  495. package/dist/src/lib/workflow-codegen/naming.js +81 -0
  496. package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
  497. package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
  498. package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
  499. package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
  500. package/dist/src/lib/workflow-config-apply.d.ts +70 -0
  501. package/dist/src/lib/workflow-config-apply.js +137 -0
  502. package/dist/src/lib/workflow-config-apply.js.map +1 -0
  503. package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
  504. package/dist/src/lib/workflow-config-sidecar.js +96 -0
  505. package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
  506. package/dist/src/lib/workflow-defaults.d.ts +29 -0
  507. package/dist/src/lib/workflow-defaults.js +41 -0
  508. package/dist/src/lib/workflow-defaults.js.map +1 -0
  509. package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
  510. package/dist/src/lib/workflow-field-descriptor.js +153 -0
  511. package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
  512. package/dist/src/lib/workflow-fragments.d.ts +64 -0
  513. package/dist/src/lib/workflow-fragments.js +342 -0
  514. package/dist/src/lib/workflow-fragments.js.map +1 -0
  515. package/dist/src/lib/workflow-include-preserve.d.ts +76 -0
  516. package/dist/src/lib/workflow-include-preserve.js +286 -0
  517. package/dist/src/lib/workflow-include-preserve.js.map +1 -0
  518. package/dist/src/lib/workflow-payload.d.ts +98 -0
  519. package/dist/src/lib/workflow-payload.js +178 -0
  520. package/dist/src/lib/workflow-payload.js.map +1 -0
  521. package/dist/src/lib/workflow-toml-validator.d.ts +207 -0
  522. package/dist/src/lib/workflow-toml-validator.js +762 -0
  523. package/dist/src/lib/workflow-toml-validator.js.map +1 -0
  524. package/dist/src/lib/workflow-usage.d.ts +198 -0
  525. package/dist/src/lib/workflow-usage.js +312 -0
  526. package/dist/src/lib/workflow-usage.js.map +1 -0
  527. package/dist/src/types/index.d.ts +591 -0
  528. package/dist/src/validators.d.ts +65 -0
  529. package/dist/src/validators.js +64 -0
  530. package/dist/src/validators.js.map +1 -0
  531. package/package.json +34 -9
@@ -0,0 +1,1755 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT BY HAND.
3
+ *
4
+ * Vendored from the canonical server modules under `src/config-surface/` — the
5
+ * ONE definition per configuration object (issue #2644). The server's
6
+ * create/update handlers and this copy read the same field surface, so the CLI's
7
+ * push payloads, pull serializers and TOML key validation cannot drift from what
8
+ * the server accepts.
9
+ *
10
+ * Regenerate with:
11
+ * node cli/scripts/gen-config-surfaces.mjs (runs automatically at CLI prebuild)
12
+ *
13
+ * A freshness guard (`gen-config-surfaces.mjs --check`, asserted by
14
+ * `cli/tests/unit/config-surface-drift-guard.test.ts`) fails if this committed
15
+ * copy does not match the source.
16
+ */
17
+ /**
18
+ * The one definition per configuration object (issue #2644).
19
+ *
20
+ * A "configuration object" is anything `primitive config` round-trips as
21
+ * config-as-code: workflows, prompts, integrations, webhooks, cron triggers,
22
+ * blob buckets, database types, rule sets, email templates, and the type
23
+ * configs. Every one of them used to write its field surface out by hand in at
24
+ * least three places — the server's create/update handler, the CLI's push
25
+ * payload builder, and the CLI's pull serializer — so adding a field to one and
26
+ * not the others failed silently: the field was simply absent, `config diff` could
27
+ * not see it, and a pull → push cycle cleared it server-side (#571, #807, #1081,
28
+ * #1172, #1177, #1972, #2635).
29
+ *
30
+ * These types describe that surface ONCE. The definitions live here on the
31
+ * server; the CLI vendors them at build time into
32
+ * `cli/src/lib/generated-config-surfaces.ts`
33
+ * (`cli/scripts/gen-config-surfaces.mjs`), the same server→CLI vendoring
34
+ * `gen-operation-def-descriptor.mjs` (#1544) already uses, so the published CLI
35
+ * still imports no server code at runtime.
36
+ *
37
+ * ── Scope: declarative classification and coverage ONLY ──────────────────
38
+ * Decision of record (#1976, 2026-07-23, carried forward at #2644's design
39
+ * gate): a definition records WHICH fields exist, whether each is part of the
40
+ * TOML surface, which modes the server accepts it in, and — for a field with
41
+ * real behavior — the NAME of the handler that owns that behavior. It never
42
+ * encodes the behavior itself, and no handler source is ever regex-scanned for
43
+ * field names. `pickWritableFields` replaces the key list, not the validation.
44
+ *
45
+ * ── Purity ───────────────────────────────────────────────────────────────
46
+ * Everything under `src/config-surface/` must stay importable by a build-time
47
+ * Node script with no Workers runtime: no `getAppModels`, no `withAppContext`,
48
+ * no `src/do-routing.ts`, no `env`. `cli/tests/unit/config-surface-drift-guard.test.ts`
49
+ * asserts the directory's import graph stays empty of those modules.
50
+ */
51
+ /** Value shape of a field on the wire and in TOML. Descriptive, not a parser. */
52
+ export type FieldType = "string" | "number" | "boolean" | "string[]" | "json";
53
+ /**
54
+ * Why a persisted field is not part of the TOML surface. `note` is required —
55
+ * absence from a hand-written list is never a decision (#2644 criterion 4).
56
+ */
57
+ export type NotExposed = {
58
+ kind: "server-owned";
59
+ note: string;
60
+ } | {
61
+ kind: "structural";
62
+ note: string;
63
+ /**
64
+ * Which create/update modes carry this key IN THE REQUEST BODY — the same
65
+ * statement `ConfigField.writableOn` makes about a field, for a key that
66
+ * is not part of the TOML field surface.
67
+ *
68
+ * Omitted means both, the common case for a sub-tree the body always
69
+ * carries (`rules`, `metadataManifest`, `config`). `[]` says the key
70
+ * never travels in the body at all: it is in the URL path or comes from
71
+ * the file name, so no request schema admits it. Being structural is a
72
+ * statement about the TOML surface and does not by itself make a key
73
+ * writable — a mode whose handler never reads the key is not declared
74
+ * for it, or the schema would accept a key the handler drops, which is
75
+ * the silent 200 criterion 9 exists to end.
76
+ */
77
+ requestModes?: readonly ("create" | "update")[];
78
+ } | {
79
+ kind: "secret";
80
+ note: string;
81
+ } | {
82
+ kind: "deprecated";
83
+ note: string;
84
+ };
85
+ export interface ConfigField {
86
+ /** `models.yaml` field name === the wire key on create/update. */
87
+ field: string;
88
+ /** Key inside the TOML table (often identical to `field`). */
89
+ tomlKey: string;
90
+ type: FieldType;
91
+ /** "whenSet" omits the key on pull when the value is empty; see #1033's `emit`. */
92
+ emit: "always" | "whenSet";
93
+ /**
94
+ * Modes the SERVER accepts the field in — a statement about the handler's
95
+ * `hasOwnProperty` branches and nothing else. `["create"]` means update
96
+ * genuinely rejects/ignores it (e.g. an immutable key). It is NOT a place to
97
+ * record CLI call ordering: `syncCallable` is accepted on both create and
98
+ * update (`src/admin-api.ts` `createAppWorkflow` / `updateAppWorkflow`); the
99
+ * CLI's create-only send is a *sequencing* invariant owned by
100
+ * `applyWorkflowBody` (#807 — the deferred second PATCH is itself an update
101
+ * call, and would break if update rejected the field).
102
+ */
103
+ writableOn: readonly ("create" | "update")[];
104
+ /**
105
+ * Classification, not dispatch. "passthrough" = the accepted value is stored
106
+ * as-is. Otherwise the named handler owns validation, normalization and
107
+ * serialization for this field; the guard only asserts the export exists.
108
+ *
109
+ * A handler is named `"<repo-relative module path>#<exported name>"`, e.g.
110
+ * `"src/workflows/config/workflow-field-handlers.ts#normalizeWorkflowStatus"`.
111
+ * `cli/tests/unit/config-surface-drift-guard.test.ts` fails when the module or
112
+ * the export is missing (#2644 behavior 2b).
113
+ */
114
+ validation: "passthrough" | {
115
+ handler: string;
116
+ };
117
+ /**
118
+ * This field's declared type genuinely admits more than one TOML spelling
119
+ * (#2880 criterion 5).
120
+ *
121
+ * The declared type is the contract: a quoted number for a declared number
122
+ * is a validation error `config diff` and `config push` report identically,
123
+ * and neither coerces. A handful of fields are genuinely dual-encoded
124
+ * anyway — `temperature` and `topP` are `StringField`s the server stores as
125
+ * strings and returns parsed (#2869), so `"0.2"` and `0.2` describe one
126
+ * value — and for those the two spellings must compare EQUAL, or diff
127
+ * reports a `Modified` no push can clear.
128
+ *
129
+ * Recorded here rather than inferred from the type, so the carve-out is a
130
+ * decision with a reason attached instead of a rule that quietly widens to
131
+ * every number in the surface.
132
+ */
133
+ dualEncoded?: {
134
+ note: string;
135
+ };
136
+ /**
137
+ * The value the SERVER materializes when a create omits this key (#2880
138
+ * DSO-002).
139
+ *
140
+ * A hand-authored file that omits an optional field the server defaults —
141
+ * an integration's `timeoutMs`, a cron trigger's `timezone` — creates fine
142
+ * and then reads `Modified` forever: the server holds the default, the file
143
+ * holds nothing, and push's payload builder drops the absent key so the
144
+ * difference can never converge. Recording the default here lets the LOCAL
145
+ * side of the comparison apply the same value the server did.
146
+ *
147
+ * Only for a default the server assigns on CREATE and returns on read.
148
+ */
149
+ serverDefault?: string | number | boolean;
150
+ }
151
+ export interface ConfigTable {
152
+ /** TOML path, e.g. ["workflow"] for [workflow], ["configs"] for [[configs]]. */
153
+ tomlPath: readonly string[];
154
+ repeated: boolean;
155
+ /** The `models.yaml` model backing this table — the coverage anchor. */
156
+ model: string;
157
+ fields: readonly ConfigField[];
158
+ /** Every model field not in `fields`, with its reason. Coverage is exhaustive. */
159
+ notExposed: Readonly<Record<string, NotExposed>>;
160
+ /**
161
+ * TOML keys accepted inside this table that are NOT part of the write field
162
+ * surface — an author writes them, but some other machinery consumes them.
163
+ * Declared here so `config push`'s unrecognized-key rejection (#2644 criterion
164
+ * 6) does not reject a key the CLI itself emits, and so the reason is visible
165
+ * rather than implied.
166
+ */
167
+ tomlOnlyKeys: Readonly<Record<string, NotExposed>>;
168
+ /**
169
+ * Keys the create/update BODY carries that are not `models.yaml` fields at
170
+ * all — protocol keys such as the `expectedModifiedAt` optimistic-concurrency
171
+ * token. Declared here so phase 5's generated request schemas
172
+ * (`request-schema.ts`) accept them, with the reason visible rather than
173
+ * implied. Optional: most objects have none.
174
+ *
175
+ * `modes` records which handlers actually read the key, the same statement
176
+ * `ConfigField.writableOn` makes about a field. Omitted means both — the
177
+ * common case. A key the handler in this mode does not read is NOT declared
178
+ * for that mode: the schema would accept it and the handler would drop it,
179
+ * which is the silent 200 criterion 9 exists to end.
180
+ */
181
+ requestOnlyKeys?: Readonly<Record<string, {
182
+ note: string;
183
+ modes?: readonly ("create" | "update")[];
184
+ }>>;
185
+ /**
186
+ * Keys the server's GET response carries that are not `models.yaml` fields —
187
+ * derived flags and related payloads. Declared here so `config pull`'s
188
+ * unrecognized-key warning (#2644 criterion 6) reports genuinely unknown keys
189
+ * rather than every computed one.
190
+ */
191
+ responseOnlyKeys: Readonly<Record<string, NotExposed>>;
192
+ }
193
+ /**
194
+ * When a rule is decided (#3373, project `cli-server-rule-parity`).
195
+ *
196
+ * `preflight` = decidable from the authored files ALONE and enforced before the
197
+ * first mutating call on that surface's push path — which implies the handler's
198
+ * module lives under `src/config-surface/`, so the CLI runs the server's own
199
+ * copy through the vendored artifact rather than a second implementation.
200
+ * `apply` = it needs app state (does this secret exist, is this scheme's config
201
+ * valid under the environment's JWKS policy, per-app caps, key collisions) or
202
+ * has path semantics only the server can decide.
203
+ *
204
+ * Stage is a property of the (surface, rule) PAIR, not of the predicate: the
205
+ * same file-decidable check is `preflight` on a surface whose CLI path runs it
206
+ * and `apply` on one whose CLI path does not. Declaring `preflight` where no
207
+ * CLI call exists would make the registry promise a refusal that in fact lands
208
+ * mid-apply.
209
+ */
210
+ export type CrossFieldRuleStage = "preflight" | "apply";
211
+ /**
212
+ * One rule of a configuration object that spans more than one field — `durable
213
+ * = true` beside a webhook trigger, `runAs = "system"` beside a non-empty
214
+ * `accessRule`, an HMAC scheme with no `signingSecret`.
215
+ *
216
+ * Such a rule belongs to no single field, so `ConfigField.validation` has
217
+ * nowhere to put it; attaching it to one field arbitrarily would make the
218
+ * coverage claim a lie. Declaring it here makes the SET of a surface's rules
219
+ * enumerable, which is what lets `config push`'s two-stage contract be derived
220
+ * from the registry (`crossFieldRulesForStage`) instead of maintained by hand.
221
+ *
222
+ * Classification, not dispatch (#1976 decision of record, carried at #2644 and
223
+ * again here): the declaration names the ONE export that enforces the rule and
224
+ * says when it runs. Nothing reads it to decide what to call.
225
+ */
226
+ export interface CrossFieldRule {
227
+ /** Stable, kebab-case, unique within the surface: `^[a-z0-9][a-z0-9-]*$`. */
228
+ id: string;
229
+ /** One author-facing sentence: what the rule refuses, and why. */
230
+ description: string;
231
+ stage: CrossFieldRuleStage;
232
+ /**
233
+ * The ONE enforcement point, as `"<repo-relative module>#<export>"` — the
234
+ * same spelling `ConfigField.validation` uses, written with `enforcedBy()`.
235
+ * The module is repo-relative, starts with `src/` and ends in `.ts`; a
236
+ * `preflight` handler's module is under `src/config-surface/`.
237
+ */
238
+ handler: string;
239
+ }
240
+ /**
241
+ * ── The migrated-module convention (#3373) ────────────────────────────────
242
+ *
243
+ * Naming a handler cannot catch a NEW refusal added inside an already-claimed
244
+ * function: a ninth refusal inside an existing export changes no export, no
245
+ * type and no declaration. A rules module therefore carries an anchor, and
246
+ * `cli/tests/unit/config-surface-rules-guard-3373.test.ts` checks it:
247
+ *
248
+ * 1. The module exports exactly one `export const <NAME>_RULE_IDS = [...] as
249
+ * const;` — a literal array, because the union of its members is the whole
250
+ * point; `readonly string[]` widens it back to any string.
251
+ * 2. It derives `type <Name>RuleId = (typeof <NAME>_RULE_IDS)[number]` and
252
+ * defines ONE module-local constructor whose id parameter has that type.
253
+ * Every refusal is built through it, so a ninth refusal cannot compile
254
+ * without a ninth id, which must be in the list, which must match the
255
+ * surface declarations — checked in both directions.
256
+ * 3. No `throw` statement and no `message` object-literal key — in any of its
257
+ * three spellings, `message:`, `"message":` and the `{ ruleId, message }`
258
+ * shorthand — appears anywhere outside that constructor's body. This is
259
+ * the half the type system cannot carry: `throw new Error(...)` or
260
+ * `errors.push({ message })` bypasses the constructor while changing no
261
+ * export. Reading a refusal apart (`const { message } = refusal`) or
262
+ * passing one on (`refuse(id, message)`) is not building one, and passes.
263
+ *
264
+ * Migrating the existing rules modules to it is #3374's and later siblings'
265
+ * work; every new rules module ships with it.
266
+ */
267
+ export interface ConfigObjectSurface {
268
+ /** Matches the CLI's `SyncResourceType.label` — e.g. "workflow", "prompt". */
269
+ label: string;
270
+ tables: readonly ConfigTable[];
271
+ /**
272
+ * Top-level TOML keys the object's FILE carries besides its field tables —
273
+ * the authored sub-trees that travel on their own channel (`[[steps]]`,
274
+ * `[requestConfig]`, `[rules]`, `[models.*]`) and the declared-access
275
+ * manifest's `[metadata]` / `secrets` / `vars` fragments.
276
+ *
277
+ * `tomlOnlyKeys` says which keys are accepted INSIDE a table; this says which
278
+ * keys are accepted at the document root. Together they make `config push`'s
279
+ * rejection total (design gate, 2026-08-12: push rejects everything
280
+ * unrecognized): without it a typo'd table header — `[integraton]` — parsed
281
+ * to a root key nothing checked, so the file pushed as though the real table
282
+ * were empty and the TOML-owned fields inside it were CLEARED server-side.
283
+ *
284
+ * Every entry carries its reason, the same rule `notExposed` follows: a table
285
+ * that is simply absent from this map must not read as a decision.
286
+ */
287
+ tomlDocumentKeys: Readonly<Record<string, NotExposed>>;
288
+ /**
289
+ * Declares that this object HAS no TOML field table, with the reason —
290
+ * required when `tables` is empty and forbidden otherwise.
291
+ *
292
+ * `transform` is the case: a `.rhai` file's authored surface is the script
293
+ * body, so there is no key/value table to define. Saying so here is the same
294
+ * rule `notExposed` applies to a field, one level up: "absent from the
295
+ * registry" and "deliberately fieldless" must not look the same (#2644
296
+ * criterion 4).
297
+ */
298
+ noFieldTable?: {
299
+ note: string;
300
+ };
301
+ /**
302
+ * Every cross-field rule of this object (#3373). Non-empty when present, and
303
+ * mutually exclusive with `noCrossFieldRules`.
304
+ */
305
+ crossFieldRules?: readonly CrossFieldRule[];
306
+ /**
307
+ * Declares that this object HAS no cross-field rule, with the reason — the
308
+ * same rule `noFieldTable` applies to a field table, one level up. Absence of
309
+ * both slots means "not declared yet", which is what
310
+ * `CROSS_FIELD_RULES_UNMIGRATED` inventories; it must never read as "no
311
+ * rules".
312
+ */
313
+ noCrossFieldRules?: {
314
+ note: string;
315
+ };
316
+ }
317
+ /**
318
+ * Shared spellings used by every configuration-object definition (issue #2644).
319
+ *
320
+ * These live in one module for a mechanical reason as much as a stylistic one:
321
+ * `cli/scripts/gen-config-surfaces.mjs` concatenates the whole directory into a
322
+ * single vendored artifact, so a `const handler = …` declared per definition
323
+ * module would collide as a duplicate identifier the moment a second object was
324
+ * migrated.
325
+ *
326
+ * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
327
+ */
328
+ /** Both write modes — the common case, spelled once. */
329
+ export declare const BOTH: readonly ("create" | "update")[];
330
+ /** Create only: an immutable key or a field the update handler ignores. */
331
+ export declare const CREATE_ONLY: readonly ("create" | "update")[];
332
+ /** Update only: a field the create handler assigns itself. */
333
+ export declare const UPDATE_ONLY: readonly ("create" | "update")[];
334
+ /**
335
+ * Name the handler that owns a field's validation, normalization and
336
+ * serialization, as `"<repo-relative module>#<export>"`. Classification only —
337
+ * the definition never dispatches through it (#1976 decision of record); the
338
+ * guard asserts the export exists so a renamed handler fails the CLI unit suite
339
+ * instead of leaving a dangling reference (#2644 behavior 2b).
340
+ */
341
+ export declare function handledBy(modulePath: string, exportName: string): ConfigField["validation"];
342
+ /**
343
+ * Name the ONE export that enforces a cross-field rule, as
344
+ * `"<repo-relative module>#<export>"` — the sibling of `handledBy` for a rule
345
+ * that belongs to no single field (#3373). Classification only: the declaration
346
+ * never dispatches through it, and the guard asserts the export exists.
347
+ */
348
+ export declare function enforcedBy(modulePath: string, exportName: string): string;
349
+ /**
350
+ * The shape a migrated rules module builds its refusals in (#3373).
351
+ *
352
+ * `Id` is the union of the module's `*_RULE_IDS` list, so a new refusal branch
353
+ * cannot compile without naming an id — and a new id fails `cli-unit-tests`
354
+ * until a surface declares it. See `types.ts` §"The migrated-module convention".
355
+ */
356
+ export interface RuleRefusal<Id extends string = string> {
357
+ ruleId: Id;
358
+ message: string;
359
+ }
360
+ /**
361
+ * The declared-access manifest's top-level TOML keys (#1304, #1364).
362
+ *
363
+ * Five objects carry the same three-key fragment beside their field table —
364
+ * workflows, database types, and the group / collection / metadata-category
365
+ * configs — parsed by the one `parseDeclaredAccessManifestToml`. Spelling it
366
+ * once here keeps `config push`'s document-level rejection from disagreeing with
367
+ * itself object by object.
368
+ */
369
+ export declare const DECLARED_ACCESS_MANIFEST_KEYS: Readonly<Record<string, NotExposed>>;
370
+ /**
371
+ * The accepted-key half of a configuration object's definition (issue #2644).
372
+ *
373
+ * `pickWritableFields` answers exactly one question — "is this key writable on
374
+ * this object in this mode" — so a server handler stops naming the keys it
375
+ * accepts. What a present key MEANS stays with the per-field handler the
376
+ * definition names (spec §Contracts, decision of record #1976): the workflow
377
+ * `status` enum, the non-negative-integer coercion of the queue limits,
378
+ * `runAs`'s caller|system check, `parseWorkflowLock`, the `capabilities` array
379
+ * shape and the CEL parse of `accessRule` all stay where they are. The
380
+ * mechanical win is that a field can no longer be *absent* from the accepted
381
+ * set.
382
+ *
383
+ * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
384
+ */
385
+ export type WriteMode = "create" | "update";
386
+ /** The field names this table accepts on the wire in `mode`, in declaration order. */
387
+ export declare function writableFieldNames(table: ConfigTable, mode: WriteMode): string[];
388
+ /**
389
+ * The field names the server PERSISTS for this table in `mode`: the writable
390
+ * fields, plus the `deprecated` classifications — "still writable, superseded
391
+ * by another field" is what that kind means (`types.ts`), so a superseded key
392
+ * a handler still honors (`accessPolicy`, `passkeyRpId`) belongs in every
393
+ * accepted set, and a field that is NOT writable belongs in none of them.
394
+ *
395
+ * Stated once here because three consumers need the same answer: the generated
396
+ * request schemas, `PUT /settings`'s write allow-list, and the guards.
397
+ */
398
+ export declare function acceptedWriteFieldNames(table: ConfigTable, mode: WriteMode): string[];
399
+ /**
400
+ * Split a request body into the keys this table accepts in `mode` and the keys
401
+ * it does not.
402
+ *
403
+ * `accepted` preserves the caller's values verbatim — including an explicit
404
+ * `null` or `false`, which are meaningful (clear / opt-out) and must not be
405
+ * coalesced away. Only keys the body actually carries appear, so a handler can
406
+ * keep using presence (`hasOwnProperty`) to distinguish "leave unset" from
407
+ * "set to null".
408
+ *
409
+ * `rejected` is every other key the body carried. Today it is informational;
410
+ * #2644 phase 5 turns it into a 400 through the generated request schemas.
411
+ */
412
+ export declare function pickWritableFields(body: Record<string, unknown>, table: ConfigTable, mode: WriteMode): {
413
+ accepted: Record<string, unknown>;
414
+ rejected: string[];
415
+ };
416
+ /**
417
+ * The PASSTHROUGH half of the accepted body: the keys this table declares
418
+ * `validation: "passthrough"`, writable in `mode`, that the body actually
419
+ * carries — with their values verbatim.
420
+ *
421
+ * This is what makes criterion 1 true rather than aspirational. A handler that
422
+ * only picked its accepted set still had to name each field again when it built
423
+ * the row to persist, so a scalar field added to a definition alone was
424
+ * accepted on the wire and then dropped on the floor. Handlers spread this into
425
+ * the create/update payload FIRST, so a field with real behavior still lands
426
+ * through its named handler (whose assignment comes after and wins), and a
427
+ * plain scalar needs no handler edit at all.
428
+ *
429
+ * Values are passed through untouched — including an explicit `null` or
430
+ * `false`, which are meaningful (clear / opt-out). "Stored as-is" is exactly
431
+ * what the `passthrough` classification promises.
432
+ */
433
+ export declare function passthroughFields(body: Record<string, unknown>, table: ConfigTable, mode: WriteMode, options?: {
434
+ /**
435
+ * Fields whose PRESENCE semantics this handler owns — it decides, per
436
+ * value, whether the key is written at all (a falsy `displayName` that
437
+ * means "leave the stored name alone"). Listing one here keeps the generic
438
+ * copy from changing what it means.
439
+ *
440
+ * This is never a place to list a field the handler does not assign: a
441
+ * field named here and dropped by the handler is written nowhere, which is
442
+ * the silent loss the definition exists to prevent. A NEW field needs no
443
+ * entry — omission is what makes it flow through.
444
+ */
445
+ handledHere?: readonly string[];
446
+ }): Record<string, unknown>;
447
+ /** `true` when the body carries `field` and this table accepts it in `mode`. */
448
+ export declare function hasWritableField(accepted: Record<string, unknown>, field: string): boolean;
449
+ /**
450
+ * Coverage checks over a configuration object's definition (issue #2644,
451
+ * criteria 2 and 4).
452
+ *
453
+ * A definition claims to describe its model's WHOLE field surface. These
454
+ * functions are what make that claim mean something: every `models.yaml` field
455
+ * is either exposed in TOML or classified `notExposed` with a reason, in both
456
+ * directions — a new field nobody classified, and a classification for a field
457
+ * that no longer exists. `cli/tests/unit/config-surface-drift-guard.test.ts`
458
+ * asserts them over every registered object, so coverage follows from being a
459
+ * configuration object rather than from someone adding a per-type guard.
460
+ *
461
+ * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
462
+ */
463
+ /**
464
+ * `models.yaml` field names per model — the coverage anchor, passed in rather
465
+ * than read here so this module stays pure (the CLI's vendored artifact carries
466
+ * it as `GENERATED_CONFIG_MODEL_FIELDS`).
467
+ */
468
+ export type ModelFieldMap = Readonly<Record<string, readonly string[]>>;
469
+ /**
470
+ * Whether a value counts as unset for an `emit: "whenSet"` field, so `config pull`
471
+ * omits the key instead of writing a noisy empty one (and `config diff` does not
472
+ * report a difference that is not there).
473
+ *
474
+ * Carried over verbatim from #1033's shipped app-settings descriptor
475
+ * (`cli/src/lib/app-settings-descriptor.ts`): an empty array and an empty
476
+ * object are unset, while `false` and `0` are meaningful values and never are.
477
+ */
478
+ export declare function isEmptyForEmit(value: unknown, type: ConfigField["type"]): boolean;
479
+ /**
480
+ * A field name whose shape says it carries a credential. Such a field must be
481
+ * classified explicitly — exposed with a stated reference-only contract, or
482
+ * `notExposed: { kind: "secret" }` — because a mechanical generalization that
483
+ * merely omits it would read as "not decided" (#2254, #2256).
484
+ */
485
+ export declare const SECRETISH_FIELD: RegExp;
486
+ /** Model fields the table neither exposes nor classifies. Non-empty is a failure. */
487
+ export declare function findUnclassifiedFields(table: ConfigTable, modelFields: readonly string[]): string[];
488
+ /**
489
+ * Classifications that no longer correspond to a model field — i.e. a field
490
+ * removed from `models.yaml` while the definition still names it. Also a
491
+ * failure: a stale classification must not silently pass, or the coverage claim
492
+ * quietly stops meaning anything.
493
+ */
494
+ export declare function findStaleClassifications(table: ConfigTable, modelFields: readonly string[]): string[];
495
+ /** The models this surface's tables project, in declaration order, deduped. */
496
+ export declare function surfaceModels(surface: ConfigObjectSurface): string[];
497
+ /**
498
+ * Model fields the whole surface neither exposes nor classifies. Non-empty is
499
+ * a failure: the CLI would silently ignore them and a pull → push cycle would
500
+ * clear them (#2644 criterion 2).
501
+ */
502
+ export declare function findUnclassifiedSurfaceFields(surface: ConfigObjectSurface, modelFields: ModelFieldMap): string[];
503
+ /**
504
+ * Classifications naming a field the model no longer has — the other direction,
505
+ * and equally a failure: a stale entry quietly stops meaning anything.
506
+ */
507
+ export declare function findStaleSurfaceClassifications(surface: ConfigObjectSurface, modelFields: ModelFieldMap): string[];
508
+ /** Fields the surface both exposes and classifies `notExposed`. Ambiguous. */
509
+ export declare function findDoubleClassifiedSurfaceFields(surface: ConfigObjectSurface): string[];
510
+ /**
511
+ * Secret-adjacent model fields the surface leaves undecided — neither exposed
512
+ * with a stated contract nor classified `notExposed` (#2254, #2256).
513
+ */
514
+ export declare function findUnclassifiedSecretishSurfaceFields(surface: ConfigObjectSurface, modelFields: ModelFieldMap): string[];
515
+ /** Fields classified twice — exposed AND `notExposed`. Ambiguous, so a failure. */
516
+ export declare function findDoubleClassifiedFields(table: ConfigTable): string[];
517
+ /**
518
+ * `notExposed` / `tomlOnlyKeys` / `responseOnlyKeys` entries whose `note` is
519
+ * missing or blank. A reason is the whole point of the classification.
520
+ */
521
+ export declare function findReasonlessClassifications(table: ConfigTable): string[];
522
+ /**
523
+ * Secret-adjacent model fields with no explicit decision — neither an exposed
524
+ * entry nor a `notExposed` classification. A bare omission is the failure mode
525
+ * this catches.
526
+ */
527
+ export declare function findUnclassifiedSecretishFields(table: ConfigTable, modelFields: readonly string[]): string[];
528
+ /**
529
+ * Every distinct handler reference the table names, as
530
+ * `"<repo-relative module>#<export>"`. The guard resolves each one and fails
531
+ * when the module or the export is missing (#2644 behavior 2b).
532
+ */
533
+ export declare function handlerReferences(table: ConfigTable): string[];
534
+ /** TOML keys this table accepts: the exposed fields plus the declared extras. */
535
+ export declare function acceptedTomlKeys(table: ConfigTable): Set<string>;
536
+ /** Top-level TOML keys this object's file accepts: its tables plus the extras. */
537
+ export declare function acceptedTomlDocumentKeys(surface: ConfigObjectSurface): Set<string>;
538
+ /**
539
+ * `tomlDocumentKeys` entries with no reason, and any that merely restate a
540
+ * field table. Both are failures: a reason is the whole point of the
541
+ * classification, and a duplicate would let a table's shape check be bypassed
542
+ * by declaring it twice.
543
+ */
544
+ export declare function findBadDocumentKeyDeclarations(surface: ConfigObjectSurface): string[];
545
+ /** Root keys of `tomlData` the surface does not declare. `config push` rejects these. */
546
+ export declare function findUnknownTomlDocumentKeys(surface: ConfigObjectSurface, tomlData: unknown): string[];
547
+ export declare function findMisshapenTomlTables(surface: ConfigObjectSurface, tomlData: unknown): Array<{
548
+ key: string;
549
+ expected: "table" | "array of tables";
550
+ }>;
551
+ /**
552
+ * Server-response keys this table recognizes: every model field (exposed or
553
+ * not) plus the declared response-only keys. `config pull` warns about anything
554
+ * else instead of dropping it silently (#2644 criterion 6).
555
+ */
556
+ export declare function recognizedResponseKeys(table: ConfigTable, modelFields: readonly string[]): Set<string>;
557
+ /**
558
+ * Checks over a configuration object's CROSS-FIELD rule declarations (issue
559
+ * #3373, project `cli-server-rule-parity` phase 1).
560
+ *
561
+ * `coverage.ts` is the field-level twin: it makes "this definition describes the
562
+ * whole field surface" mean something. These functions do the same job one level
563
+ * up for rules — a declaration that is malformed, a rule id a module's
564
+ * `*_RULE_IDS` list does not carry, a list entry no surface declares, a refusal
565
+ * built outside its module's typed constructor, and a surface that has declared
566
+ * neither slot while being absent from the unmigrated inventory each return a
567
+ * failure line. `cli/tests/unit/config-surface-rules-guard-3373.test.ts` asserts
568
+ * them over the real registry and proves their teeth on synthetic inputs.
569
+ *
570
+ * Everything here is a PURE function over values and over module SOURCE TEXT
571
+ * passed in by the caller: the guard does the filesystem walk, so this module
572
+ * stays vendorable (see `types.ts` §Purity). Reading source text is the same
573
+ * kind of structural check the field guard already makes when it confirms a
574
+ * handler's export is declared — it never scans a handler for field names to
575
+ * infer behavior (#1976 decision of record).
576
+ */
577
+ /** The two stages a rule can be declared at, spelled once. */
578
+ export declare const CROSS_FIELD_RULE_STAGES: readonly CrossFieldRuleStage[];
579
+ /** A rule declaration's closed key set — it may not grow behavior knobs. */
580
+ export declare const CROSS_FIELD_RULE_KEYS: readonly string[];
581
+ /** Every rule handler lives on the server, under `src/`, in a `.ts` module. */
582
+ export declare const RULE_HANDLER_MODULE_PREFIX = "src/";
583
+ /** A `preflight` handler is vendored into the CLI, so it lives here. */
584
+ export declare const PREFLIGHT_HANDLER_MODULE_PREFIX = "src/config-surface/";
585
+ /** Rule ids are kebab-case and stable: they are cited in declarations. */
586
+ export declare const CROSS_FIELD_RULE_ID_PATTERN: RegExp;
587
+ /** The suffix that makes a module a rules module for the unclaimed-export check. */
588
+ export declare const RULES_MODULE_SUFFIX = "-rules.ts";
589
+ /**
590
+ * Is this module a rules module of THIS registry — `<name>-rules.ts` under
591
+ * `src/config-surface/`?
592
+ *
593
+ * The name is the opt-in: everything a rules module exports is a rule, so an
594
+ * export no surface declares is a rule with no declaration
595
+ * (`findUnclaimedRuleModuleExports`). Shared predicates and constants therefore
596
+ * live in a module that is not named `*-rules.ts` —
597
+ * `webhook-signing-secret.ts` exports `isWholeSecretReference` and its refusal
598
+ * codes, and must keep being able to.
599
+ *
600
+ * The directory is the other half of the key, and it is load-bearing:
601
+ * `src/services/app-secrets-rules.ts` is the app-secrets store's own key/value
602
+ * shape rules, written long before this convention and belonging to no
603
+ * configuration surface. The registry's rules modules live where the registry
604
+ * lives (project intent §Decisions, "Where does the registry live?"), which is
605
+ * also where a `preflight` handler has to be, so the name means one thing in
606
+ * one place instead of catching every module in the tree that ends in the same
607
+ * eight characters.
608
+ */
609
+ export declare function isRulesModulePath(modulePath: string): boolean;
610
+ /** One string literal of a module: where it sits, and what it says. */
611
+ export interface RuleModuleStringLiteral {
612
+ /** Index of the opening quote. */
613
+ start: number;
614
+ /** Index just past the closing quote. */
615
+ end: number;
616
+ /** The literal's raw content — escapes are left as written. */
617
+ value: string;
618
+ /** `"`, `'` or a backtick. */
619
+ quote: string;
620
+ }
621
+ /** A module's masked source plus every string literal the masker blanked. */
622
+ export interface RuleModuleLexis {
623
+ /** Comments, string contents and regex literals blanked, positions kept. */
624
+ masked: string;
625
+ /** The literals, in source order — a blanked `"message"` key is still one. */
626
+ strings: RuleModuleStringLiteral[];
627
+ }
628
+ /**
629
+ * Blank out comments, string-literal CONTENTS and regex literals, preserving
630
+ * every character position and every newline, so a regex over the result
631
+ * reports the same line numbers as the original and can never match prose, a
632
+ * quoted example, or a pattern.
633
+ *
634
+ * Regex literals are tracked because a perfectly ordinary validation pattern
635
+ * carries quotes — `/'/`, `/["']/` — and a masker that read that apostrophe as
636
+ * a string would blank the rest of the module, hiding every `throw` after it.
637
+ * That is a guard that silently stops looking, which is worse than no guard.
638
+ * A `/` that opens what turns out not to be a regex (no closing `/` before the
639
+ * line ends) is treated as division, so the masker never runs away.
640
+ *
641
+ * Template literals are scanned with their `${…}` interpolations lexed as code,
642
+ * so a nested backtick cannot end the literal early either.
643
+ */
644
+ export declare function lexRuleModuleSource(source: string): RuleModuleLexis;
645
+ /**
646
+ * The module's source with comments, string contents and regex literals blanked
647
+ * — the view every structural check reads, positions and line numbers intact.
648
+ */
649
+ export declare function maskRuleModuleSource(source: string): string;
650
+ /**
651
+ * Every fault in one surface's rule declaration, each naming the surface and
652
+ * what is wrong. `[]` means the declaration is well-formed — INCLUDING a
653
+ * surface that has declared neither slot, which is the unmigrated list's
654
+ * business (`findUnmigratedListDrift`), not a malformed declaration.
655
+ */
656
+ export declare function findMalformedRuleDeclarations(surface: ConfigObjectSurface): string[];
657
+ /**
658
+ * The same rule id declared on two surfaces with DIFFERENT handlers.
659
+ *
660
+ * One id naming one handler on two surfaces is deliberate — the signing-secret
661
+ * rule is one rule the webhook and function objects share — but one id naming
662
+ * two implementations is the drift this registry exists to end.
663
+ */
664
+ export declare function findCrossSurfaceRuleIdConflicts(surfaces: readonly ConfigObjectSurface[]): string[];
665
+ /** Declared rule ids per handler module — the declaration side of the anchor. */
666
+ export declare function declaredRuleIdsByModule(surfaces: readonly ConfigObjectSurface[]): Map<string, string[]>;
667
+ /** Every distinct `<module>#<export>` a surface's rules name, sorted. */
668
+ export declare function ruleHandlerReferences(surface: ConfigObjectSurface): string[];
669
+ /**
670
+ * Read every `export const X_RULE_IDS = [...] as const` out of module SOURCE.
671
+ *
672
+ * Static on purpose: an `apply`-stage handler lives in a server module the CLI's
673
+ * unit test must never import, and the list has to be readable anyway.
674
+ *
675
+ * The declaration is walked, not matched against one regex, for two reasons a
676
+ * guard cares about. A list is found whether or not the statement ends in a
677
+ * semicolon — under automatic semicolon insertion `…] as const` is the same
678
+ * declaration, and a module that dropped the semicolon must not drop out of
679
+ * discovery. And the ids are the module's real STRING LITERALS, so an id that
680
+ * has been commented out inside the array is not read as one: it is absent from
681
+ * the runtime list and from the union type, so a declaration still citing it
682
+ * has to fail.
683
+ */
684
+ export declare function parseRuleIdExports(source: string): {
685
+ lists: Array<{
686
+ name: string;
687
+ ids: string[];
688
+ }>;
689
+ errors: string[];
690
+ };
691
+ /**
692
+ * Refusals a migrated module builds OUTSIDE its typed constructor (DSO-001).
693
+ *
694
+ * The type-level half of the rule-id anchor — a constructor whose id parameter
695
+ * is the list's union — cannot see `throw new Error("ninth refusal")` or
696
+ * `errors.push({ message })`: both change no export and no type. This is the
697
+ * source-level half, and it applies only to a MIGRATED module (one that exports
698
+ * a `*_RULE_IDS` list), so an unmigrated module is untouched until its sibling
699
+ * issue migrates it.
700
+ *
701
+ * A refusal literal is caught in all three spellings a `message` property has —
702
+ * `message:`, `"message":` and the `{ ruleId, message }` shorthand — because a
703
+ * bypass that only had to be quoted differently would not be a guard.
704
+ */
705
+ export declare function findUnanchoredRefusals(source: string, listName?: string): string[];
706
+ /**
707
+ * Drift between the rule ids modules EXPORT and the ids surfaces DECLARE, in
708
+ * both directions. The first direction is the ninth-refusal case: a new id in a
709
+ * module's list that no surface declares fails until it is declared.
710
+ */
711
+ export declare function findRuleIdDrift(declared: ReadonlyMap<string, readonly string[]>, exported: ReadonlyMap<string, readonly string[]>): string[];
712
+ /**
713
+ * Exported rule functions in a registry rules module that no surface claims
714
+ * (intent §Success criteria 1). A rules module is where rules live; an export
715
+ * nothing declares is a rule running with no declaration. `[]` for anything
716
+ * `isRulesModulePath` does not recognize.
717
+ *
718
+ * Both spellings of an export count: `export function check()` and a later
719
+ * `export { check }` clause, alias included — how a rule reaches the module's
720
+ * surface is a style choice, and a guard that only saw one of the two would be
721
+ * satisfied by rewriting the other.
722
+ */
723
+ export declare function findUnclaimedRuleModuleExports(modulePath: string, source: string, claimedExports: readonly string[]): string[];
724
+ /**
725
+ * Drift between the shrink-only unmigrated inventory and the registry, in both
726
+ * directions: a listed label that is not a surface, a listed label that has
727
+ * already declared, a surface that has declared neither slot and is not listed,
728
+ * and a duplicate entry.
729
+ */
730
+ export declare function findUnmigratedListDrift(surfaces: readonly ConfigObjectSurface[], unmigrated: readonly string[]): string[];
731
+ /** Whether this surface has declared its cross-field rules either way. */
732
+ export declare function hasDeclaredCrossFieldRules(surface: ConfigObjectSurface): boolean;
733
+ /**
734
+ * The surface's declared rules for one stage, in declaration order — the
735
+ * derivation `config push`'s two-stage contract replaces its hand-maintained
736
+ * ordering with (#3375 is the consumer).
737
+ *
738
+ * Throws for a surface that has declared neither slot, rather than returning
739
+ * `[]`: "not declared yet" must never be read as "has no rules" (principle 6).
740
+ */
741
+ export declare function crossFieldRulesForStage(surface: ConfigObjectSurface, stage: CrossFieldRuleStage): readonly CrossFieldRule[];
742
+ /**
743
+ * Request schemas generated from the configuration-object definitions
744
+ * (issue #2644, phase 5 / criterion 9).
745
+ *
746
+ * Every create/update handler in this family used to drop, in silence, any body
747
+ * key it did not read. A client sending `timoutMs` for `timeoutMs` got a 200 and
748
+ * no timeout change. These schemas close that: one per object and mode,
749
+ * `additionalProperties: false`, properties = the keys that object accepts on
750
+ * the wire in that mode, so an unknown key is a 400 naming it.
751
+ *
752
+ * **Breaking change, named**: a client that sends a stray key and gets a 200
753
+ * today will get a 400. The CLI never hits it — `config push` already rejects
754
+ * unrecognized TOML keys locally (criterion 6).
755
+ *
756
+ * ── What the schema says, and what it deliberately does not ──────────────
757
+ * It states the KEY SET only: each property is the empty schema, so no value is
758
+ * type-checked here. That is the decision of record (#1976, carried forward at
759
+ * #2644's design gate): the definition classifies, handlers behave. The
760
+ * `status` enum, the queue limits' integer coercion, `runAs`'s caller|system
761
+ * check, the CEL parse of `accessRule` — all stay in the handlers the
762
+ * definition names, with their existing messages. Adding type gates here would
763
+ * duplicate them and start rejecting values the handlers accept.
764
+ *
765
+ * ── Which keys are in the set ────────────────────────────────────────────
766
+ * Derived, not listed:
767
+ *
768
+ * - every field the definition says is writable in this mode;
769
+ * - every field classified `structural` — the authored sub-trees that travel
770
+ * on their own channel (`rules`, `steps`, `metadataManifest`, `schema`,
771
+ * `triggers`) but are still sent in the body — in the modes that entry
772
+ * declares (`requestModes`; omitted means both, `[]` means the key travels
773
+ * in the URL path and no schema admits it);
774
+ * - every field classified `deprecated` — still writable server-side, by
775
+ * definition of that classification;
776
+ * - the table's `requestOnlyKeys`, in the modes each declares: protocol keys
777
+ * that are not model fields at all, such as the `expectedModifiedAt`
778
+ * optimistic-concurrency token or a create-only alias.
779
+ *
780
+ * `server-owned` and `secret` classifications are the two the schema excludes:
781
+ * the first is assigned by the server, the second never travels in readable
782
+ * form.
783
+ *
784
+ * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
785
+ */
786
+ /**
787
+ * A generated request schema. Shaped for the app API's `meta.request` slot and
788
+ * the runtime validator it feeds (`src/app-api/request-validation.ts`), which
789
+ * reports an unknown key as `value.<key> is not allowed`.
790
+ */
791
+ export interface ConfigRequestSchema {
792
+ type: "object";
793
+ properties: Record<string, Record<string, never>>;
794
+ additionalProperties: false;
795
+ /**
796
+ * Structural-typing escape hatch: the app API's `meta.request` slot is a
797
+ * `Record<string, unknown>` (`JsonSchema`), and an interface with no index
798
+ * signature is not assignable to one. Declaring the index here keeps the
799
+ * generated schema usable as a route schema without an `as any` at every
800
+ * call site.
801
+ */
802
+ [key: string]: unknown;
803
+ }
804
+ /**
805
+ * Protocol keys every config UPDATE accepts, whichever object it is.
806
+ *
807
+ * `expectedModifiedAt` is the optimistic-concurrency token `config push` attaches
808
+ * to an update body when it has a baseline from the last pull; a handler that
809
+ * does not implement conflict detection ignores it. It is a property of the
810
+ * sync protocol rather than of any one object, which is why it is stated once
811
+ * here instead of in thirteen definitions.
812
+ */
813
+ export declare const UPDATE_PROTOCOL_KEYS: readonly string[];
814
+ /** The body keys this table accepts in `mode`, in a stable order. */
815
+ export declare function requestSchemaKeys(table: ConfigTable, mode: "create" | "update"): string[];
816
+ /**
817
+ * The request schema for one object and mode. Generated from the definition, so
818
+ * a schema permitting a key the definition does not is unrepresentable: there
819
+ * is no place to write one.
820
+ */
821
+ export declare function configRequestSchema(table: ConfigTable, mode: "create" | "update"): ConfigRequestSchema;
822
+ /**
823
+ * The retired-key guidance for a generated schema, keyed by body key — or
824
+ * `undefined` when the schema's object has none. Consumed by the app API's
825
+ * request validator (`src/app-api/request-validation.ts`).
826
+ */
827
+ export declare function retiredRequestKeys(schema: object | undefined): Readonly<Record<string, string>> | undefined;
828
+ /**
829
+ * One schema for an endpoint whose body spans MORE than one table.
830
+ *
831
+ * `POST …/prompts` is the case: it creates the prompt AND seeds its first
832
+ * config, so the body carries `[prompt]` fields and `[[configs]]` fields
833
+ * together. Both halves still come from their definitions — this only says the
834
+ * endpoint accepts the union, in the one place that is true.
835
+ */
836
+ export declare function mergeRequestSchemas(...schemas: readonly ConfigRequestSchema[]): ConfigRequestSchema;
837
+ /**
838
+ * The body keys `table` does not accept in `mode` — the 400's subject.
839
+ *
840
+ * Used by the admin API, which has no request-schema middleware: its handlers
841
+ * call this directly so both APIs reject the same key set for the same object.
842
+ */
843
+ export declare function unknownRequestKeys(body: unknown, table: ConfigTable, mode: "create" | "update"): string[];
844
+ /** The 400 message naming the unknown key(s), shared by both APIs. */
845
+ export declare function unknownRequestKeysMessage(keys: readonly string[]): string;
846
+ /**
847
+ * Keys deliberately RETIRED from a configuration object's write surface.
848
+ *
849
+ * A retired key is not an unknown key. The generic hint for an unrecognized
850
+ * TOML key — "check the spelling, or upgrade the CLI" — is exactly backwards
851
+ * for one this CLI removed on purpose, and the generic 400 for an unaccepted
852
+ * request key says only that the key is not allowed, not where the value moved
853
+ * to. Both surfaces need the same sentence, and neither should invent it.
854
+ *
855
+ * So the guidance lives here, next to the definitions, with one entry per
856
+ * retired key: the TOML wording for `config push` (which can tell the author to
857
+ * delete a line) and the request wording for the API handlers (which cannot).
858
+ *
859
+ * Keyed by the table's TOML path prefix (`workflow`, `cronTrigger`, …), because
860
+ * that is the identifier both consumers already have in hand.
861
+ *
862
+ * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
863
+ */
864
+ export interface RetiredConfigKey {
865
+ /** What `config push` says about a file that still carries the key. */
866
+ toml: string;
867
+ /** What a create/update handler says about a body that still sends it. */
868
+ request: string;
869
+ }
870
+ export declare const RETIRED_CONFIG_KEYS: Record<string, Record<string, RetiredConfigKey>>;
871
+ /** The retired-key entry for `key` under `prefix`, or null when it is simply unknown. */
872
+ export declare function retiredConfigKey(prefix: string, key: string): RetiredConfigKey | null;
873
+ /**
874
+ * The capability grammar for server functions — #3182 phase 1, rewritten by
875
+ * #3279 (project `server-functions` phase 3).
876
+ *
877
+ * A function declares in its own TOML what it may CONFIGURE:
878
+ *
879
+ * capabilities = ["integration:stripe", "secret:STRIPE_KEY", "databases:delete"]
880
+ *
881
+ * ── Why the grammar is this small ────────────────────────────────────────
882
+ *
883
+ * The intent's decision (2026-09-09, "Authorization inside a function?"):
884
+ * function code acts as the system. The invocation gate is the authorization,
885
+ * and inside a function every platform call carries the app's own authority in
886
+ * every family. A capability is therefore never a statement about DATA — a
887
+ * model, a prompt, a channel, a member — because the function may reach all of
888
+ * it. It is declared only where it configures something:
889
+ *
890
+ * `integration:<key>` the egress allowlist — which upstream hosts the
891
+ * function's outbound calls may reach;
892
+ * `secret:<NAME>` credential least privilege — which secret VALUES may
893
+ * cross into the sandbox at all;
894
+ * the high-blast list {@link HIGH_BLAST_CAPABILITIES} — the operations
895
+ * whose blast radius the intent keeps opt-in.
896
+ *
897
+ * Every other string a function used to declare is RETIRED, and the grammar
898
+ * says so by name: an author who still writes `database:orders/Order:read`
899
+ * is told the model changed and what stays, not "unknown family", which would
900
+ * send them to check their spelling.
901
+ *
902
+ * ── Why the components have a charset ────────────────────────────────────
903
+ *
904
+ * A keyed grant's key must match `[A-Za-z0-9_-]+`, so neither `:` nor `/` can
905
+ * enter a component and the string is INJECTIVE — one string, one object. An
906
+ * integration or secret whose key carries a delimiter is simply unreachable
907
+ * from functions, with an error that says why (D3182-001's argument, kept).
908
+ *
909
+ * ── Why this module is pure ──────────────────────────────────────────────
910
+ *
911
+ * Capabilities are validated twice — by `config push`'s preflight, so an
912
+ * author sees the error against their own file, and by the server, which is
913
+ * authoritative because the raw admin API exists. Two enforcement points must
914
+ * not be two grammars, so the grammar lives here, in the dependency-free
915
+ * `src/config-surface/` tree the CLI vendors at build time
916
+ * (`cli/scripts/gen-config-surfaces.mjs`). The server imports this module; the
917
+ * CLI imports the generated copy; the drift guard fails if they differ.
918
+ */
919
+ /** Every component of a grant. Injectivity depends on this. */
920
+ export declare const GRANT_COMPONENT_PATTERN: RegExp;
921
+ /** `ServerFunctionConfig.capabilities` is a StringSet with these bounds. */
922
+ export declare const MAX_CAPABILITY_ENTRIES = 100;
923
+ export declare const MAX_CAPABILITY_ENTRY_LENGTH = 200;
924
+ /**
925
+ * The two keyed families the intent keeps: one component under
926
+ * {@link GRANT_COMPONENT_PATTERN}, naming a single object. Every key format the
927
+ * platform issues fits: an integration key is `^[a-z0-9][a-z0-9-_]{2,}$` and a
928
+ * secret name is `^[A-Z][A-Z0-9_]{0,63}$`.
929
+ */
930
+ export declare const KEYED_GRANT_FAMILIES: readonly ["integration", "secret"];
931
+ /**
932
+ * The high-blast-radius opt-ins — #3279, criterion 5 (CR3279-001, D3279-003).
933
+ *
934
+ * Since function code acts as the system, admission to a family is no longer
935
+ * an authority statement: everything the gateway lets through runs with the
936
+ * app's own authority. Most operations are fine that way — that is the whole
937
+ * decision. A short list is not, and the intent names its categories: delete a
938
+ * database, app or user; role changes; secret changes; resource provisioning.
939
+ * Those stay opt-in, so a function that can do them says so in a reviewable
940
+ * line of its TOML.
941
+ *
942
+ * The strings are EXACT and 1:1 with the operation id, so there is nothing to
943
+ * look up: `users.setRole` needs `users:setRole`. They parse with the verb as
944
+ * their KEY, because two exact capabilities in one family must not cover each
945
+ * other — `databases:create` is not permission to delete a database.
946
+ *
947
+ * The database ROLE mutations are here because they hand out persistent
948
+ * authority: a group grant assigns the manager role (D3279-003). App deletion
949
+ * and secret writes have no app-API route today; they are recorded, not gated,
950
+ * and the profile generator refuses to admit a future such route without a row
951
+ * here (`HIGH_BLAST_WATCH` in `scripts/lib/function-profile.mjs`).
952
+ */
953
+ export declare const HIGH_BLAST_CAPABILITIES: readonly ["databases:create", "databases:delete", "databases:transferOwnership", "databases:addManager", "databases:revokePermission", "databases:grantGroupPermission", "databases:revokeGroupPermission", "users:remove", "users:setRole", "blobBuckets:createBucket", "blobBuckets:deleteBucket"];
954
+ /** The exact strings, which since #3279 are exactly the high-blast list. */
955
+ export declare const EXACT_GRANT_STRINGS: readonly ["databases:create", "databases:delete", "databases:transferOwnership", "databases:addManager", "databases:revokePermission", "databases:grantGroupPermission", "databases:revokeGroupPermission", "users:remove", "users:setRole", "blobBuckets:createBucket", "blobBuckets:deleteBucket"];
956
+ export type GrantFamily = (typeof KEYED_GRANT_FAMILIES)[number] | "databases" | "users" | "blobBuckets";
957
+ /**
958
+ * The retired FAMILIES (#3279), each with the reason it is gone.
959
+ *
960
+ * The value is what the family used to authorize, phrased as what a function
961
+ * now reaches without it. A refusal names the authored string, says it is
962
+ * retired, gives this reason, tells the author to delete the entry, and lists
963
+ * what stays.
964
+ */
965
+ export declare const RETIRED_GRANT_FAMILIES: Record<string, string>;
966
+ /** The retired EXACT strings (#3279), on the same terms. */
967
+ export declare const RETIRED_GRANT_STRINGS: Record<string, string>;
968
+ /**
969
+ * The retirement sentence for one authored string, or null when the string is
970
+ * not a retired one.
971
+ *
972
+ * Exported so the enforcement-time reader (`loadConfigGrants`) can tell a
973
+ * retired string on a pre-change row — tolerated, logged — from a string that
974
+ * was never a grant at all, which still authorizes nothing.
975
+ */
976
+ export declare function retiredGrantRefusal(raw: string): string | null;
977
+ /**
978
+ * Any grant, in one flat shape.
979
+ *
980
+ * Flat rather than a discriminated union because this module is vendored into
981
+ * the CLI, which compiles with `strict: false`: a caller reads `family` and
982
+ * then `key`, and the fields another family would have used are simply absent.
983
+ */
984
+ export interface FunctionGrant {
985
+ family: GrantFamily;
986
+ /**
987
+ * The single component of a keyed family — the integration key or the
988
+ * secret name — or the VERB of a high-blast string (`delete` for
989
+ * `databases:delete`), so that no two exact capabilities in one family read
990
+ * as the same grant.
991
+ */
992
+ key: string;
993
+ /** The authored string, so an error or a log line can quote it. */
994
+ raw: string;
995
+ }
996
+ export interface ParsedFunctionGrant {
997
+ grant?: FunctionGrant;
998
+ error?: string;
999
+ }
1000
+ /**
1001
+ * A channel name's ceiling, and the reason it has one.
1002
+ *
1003
+ * The name rides in a `ConnectionMapping` row's document-id slot as
1004
+ * `ch:<appId>:<channel>` and in every grant token's claims, so an unbounded
1005
+ * name would be an unbounded key and an unbounded credential. 200 characters
1006
+ * is {@link MAX_CAPABILITY_ENTRY_LENGTH}, kept for continuity with the rows
1007
+ * #3184 already wrote.
1008
+ */
1009
+ export declare const MAX_CHANNEL_NAME_LENGTH = 200;
1010
+ export interface ParsedChannelName {
1011
+ /** The segment before the first `:`. Absent when the name is refused. */
1012
+ namespace?: string;
1013
+ error?: string;
1014
+ }
1015
+ /**
1016
+ * A channel NAME, and its namespace.
1017
+ *
1018
+ * The grammar is the grant component charset applied per segment: one or more
1019
+ * `[A-Za-z0-9_-]+` segments joined by `:`. The `channel:<namespace>` GRANT
1020
+ * that used to cover a name is retired (#3279); the name grammar stays because
1021
+ * the authorize and publish routes answer 400 about a name outside it before
1022
+ * anything else, and the connection worker keys membership by it.
1023
+ *
1024
+ * Refusals name the segment that failed, because "channel name is invalid" on
1025
+ * a name like `orders:a::b` tells an author nothing they cannot already see.
1026
+ */
1027
+ export declare function parseChannelName(value: unknown): ParsedChannelName;
1028
+ /**
1029
+ * One capability entry as a grant, or the reason it is not one.
1030
+ *
1031
+ * The single entry point the enforcement path and both preflights use: a
1032
+ * caller holds one authored string and asks what it grants, without having to
1033
+ * know which of the shapes to try. Every diagnosis is specific — a retired
1034
+ * string gets the retirement and what stays; a near miss in a kept family gets
1035
+ * the family's own strings; a keyed family gets its charset rule.
1036
+ */
1037
+ export declare function parseFunctionGrant(entry: unknown): ParsedFunctionGrant;
1038
+ /**
1039
+ * One shape rather than a discriminated union: this module is vendored into
1040
+ * the CLI, which compiles with `strict: false`, where narrowing on a boolean
1041
+ * literal discriminant does not hold. Both callers read `ok` and then the
1042
+ * field they want, and the unused half is empty rather than absent.
1043
+ */
1044
+ export interface ParsedCapabilities {
1045
+ ok: boolean;
1046
+ /** Deduped, in authored order — what the config row stores. Empty when refused. */
1047
+ capabilities: string[];
1048
+ /** Every grant, in authored order. */
1049
+ allGrants: FunctionGrant[];
1050
+ /**
1051
+ * The retired strings that were SKIPPED, in authored order — populated only
1052
+ * under `tolerateRetired` (see {@link parseCapabilities}); a strict parse
1053
+ * refuses them instead and leaves this empty.
1054
+ */
1055
+ retired: string[];
1056
+ /** Empty when accepted. */
1057
+ errors: string[];
1058
+ }
1059
+ export interface ParseCapabilitiesOptions {
1060
+ /**
1061
+ * Skip retired strings instead of refusing them — #3279 edge 25.
1062
+ *
1063
+ * The PUSH path is strict: a file that still declares a retired grant is
1064
+ * refused with the retirement, because a line that is accepted and ignored
1065
+ * is a line the author believes means something. The ENFORCEMENT path is
1066
+ * tolerant: a config version pushed before #3279 carries retired strings in
1067
+ * a row that can never be re-pushed to fix (its envelope is immutable), and
1068
+ * refusing it there would break every function pushed before the change.
1069
+ * Such a row authorizes exactly what it keeps, and the skipped strings are
1070
+ * reported in `retired` so the caller can log them.
1071
+ */
1072
+ tolerateRetired?: boolean;
1073
+ }
1074
+ /**
1075
+ * A whole `capabilities` list: shape, bounds, grammar, duplicates.
1076
+ *
1077
+ * The model's own caps are checked HERE rather than left to the StringSet
1078
+ * field, so an over-long entry is a named push error instead of a late model
1079
+ * throw after the R2 object has already been written (principle 6).
1080
+ */
1081
+ export declare function parseCapabilities(value: unknown, options?: ParseCapabilitiesOptions): ParsedCapabilities;
1082
+ /**
1083
+ * The config-tree objects an `integration:` grant may name.
1084
+ *
1085
+ * Only the one family whose target is CONFIG-TREE state. `secret:` is absent
1086
+ * on purpose (D3183-002): its values are provisioned per environment, out of
1087
+ * band, and are not part of the reviewed tree at all, so the ordinary order of
1088
+ * work is to push the function and then provision the value. Refusing an
1089
+ * unprovisioned name at push would break that; a missing value at CALL time is
1090
+ * a structured runtime error instead. The high-blast strings name no object.
1091
+ *
1092
+ * `null` means "this enforcement point could not find out". The CLI reads the
1093
+ * tree and, when it can, a live listing; when neither is available it defers
1094
+ * rather than guessing, because a preflight that refused a valid tree for
1095
+ * being offline would be worse than one that lets the server have the last
1096
+ * word. The server never passes null — it can always read its own rows.
1097
+ */
1098
+ export interface KnownGrantTargets {
1099
+ /** Non-archived integration keys, or null when unknown. */
1100
+ integrations: ReadonlySet<string> | null;
1101
+ }
1102
+ /**
1103
+ * Grants naming an integration the app does not have.
1104
+ *
1105
+ * One message per offending grant, quoting the whole authored string AND the
1106
+ * key on its own, so an operator reading the line knows both what to fix in
1107
+ * the file and what to create in the app.
1108
+ *
1109
+ * The rule is here, beside the grammar, for the reason the whole module
1110
+ * exists: `config push`'s preflight and the authoritative server check read
1111
+ * different sources for the same facts — a `.toml` in the tree versus a row
1112
+ * in DynamoDB — and it is the RULE that must not differ between them.
1113
+ */
1114
+ export declare function validateKeyedGrantsAgainstTargets(grants: readonly FunctionGrant[], known: KnownGrantTargets): string[];
1115
+ /**
1116
+ * The query manifest's grammar, and the read rule it unlocks — #3187, project
1117
+ * `server-functions` phase 5.
1118
+ *
1119
+ * A pushed config version may carry a MANIFEST: the queries and mutations the
1120
+ * tree registered at module scope, collected by the CLI (`function-collect.ts`)
1121
+ * by running the tree with `primitive-functions` aliased to a recording stub.
1122
+ *
1123
+ * ── What the manifest is for ─────────────────────────────────────────────
1124
+ *
1125
+ * Observability, and nothing else. `primitive functions get` and the admin
1126
+ * get list what a version registered, so an operator can see it without
1127
+ * reading the bundle (principle 8). The read rule it used to be decided from
1128
+ * (#3187's `$caller` relaxation of `unscopedReads`) is retired by #3279:
1129
+ * function code acts as the system, so there is no per-model grant for a
1130
+ * binding to waive. The intent says so in as many words — "the models a
1131
+ * function touches are collected at push as a reviewable manifest, not an
1132
+ * authorization".
1133
+ *
1134
+ * It is HONEST-CODE evidence and the design doc says so: a hostile bundle can
1135
+ * register whatever it likes, because the collector runs the tenant's own
1136
+ * code. Nothing security-relevant at runtime reads it — parameter injection
1137
+ * and cache verification happen in the platform-owned SDK inside the isolate,
1138
+ * and the invocation gate remains the adversarial boundary.
1139
+ *
1140
+ * ── Why the grammar is here ──────────────────────────────────────────────
1141
+ *
1142
+ * Same reason as `function-grants.ts`: the CLI validates at push preflight so
1143
+ * an author sees the error against their own tree, and the server validates
1144
+ * authoritatively because the raw admin API exists. Two enforcement points,
1145
+ * one rule, in the dependency-free tree the CLI vendors.
1146
+ */
1147
+ /**
1148
+ * The manifest encoding, versioned with the envelope that carries it.
1149
+ *
1150
+ * Version 2 (#3279 behavior 10) adds what a function TOUCHES beside what it
1151
+ * registers: the deduplicated `models` its code names and the `families` of
1152
+ * `ctx.api` and the ctx helpers it reaches, collected by a static scan of the
1153
+ * built bundle, plus a `dynamicModels` marker for a model name the scan
1154
+ * could not resolve — distinct from an empty list, which means "names none".
1155
+ * A version-1 manifest still parses: it records registrations only.
1156
+ */
1157
+ export declare const FUNCTION_MANIFEST_SCHEMA_VERSION = 2;
1158
+ export declare const FUNCTION_MANIFEST_SCHEMA_VERSIONS: readonly [1, 2];
1159
+ /** Bounds, so a manifest cannot be a way to store an unbounded blob. */
1160
+ export declare const MAX_MANIFEST_QUERIES = 200;
1161
+ export declare const MAX_MANIFEST_NAME_LENGTH = 120;
1162
+ export declare const MAX_MANIFEST_MODELS = 200;
1163
+ export declare const MAX_MANIFEST_FAMILIES = 40;
1164
+ export interface ManifestParam {
1165
+ type?: string;
1166
+ /** `type: "array"` — the element type, when declared (#3281). */
1167
+ items?: {
1168
+ type: string;
1169
+ };
1170
+ caller?: boolean;
1171
+ optional?: boolean;
1172
+ default?: unknown;
1173
+ }
1174
+ /** The scalar parameter types a registration may declare, and an array's element types. */
1175
+ export declare const QUERY_PARAM_SCALAR_TYPES: readonly ["string", "number", "boolean", "any"];
1176
+ /**
1177
+ * Coerce one value to a declared parameter type the way the SDK coerces a
1178
+ * SUPPLIED value: a digit string becomes a number, `"true"`/`"false"` a
1179
+ * boolean, an array's elements each by the `items` type. Applied to a
1180
+ * declared `default` at registration (D3281-SO-005) so what `run` receives is
1181
+ * what the declaration promises — here at push (the collect stub and this
1182
+ * grammar) and in the SDK at the first load. ONE rule, spelled in the SDK's
1183
+ * source a second time because that module is baked text; the tests hold the
1184
+ * two together.
1185
+ */
1186
+ export declare function coerceParamDefault(spec: {
1187
+ type?: string;
1188
+ items?: {
1189
+ type?: string;
1190
+ };
1191
+ }, value: unknown): {
1192
+ ok: true;
1193
+ value: unknown;
1194
+ } | {
1195
+ ok: false;
1196
+ reason: string;
1197
+ };
1198
+ export interface ManifestQuery {
1199
+ name: string;
1200
+ kind: "query" | "mutation";
1201
+ models: string[];
1202
+ params: Record<string, ManifestParam>;
1203
+ cache: {
1204
+ ttlMs: number;
1205
+ } | null;
1206
+ /** True when a `$caller` binding scopes this registration. */
1207
+ callerScoped: boolean;
1208
+ }
1209
+ export interface FunctionManifest {
1210
+ schemaVersion: number;
1211
+ queries: ManifestQuery[];
1212
+ /**
1213
+ * Every model name the bundle names, deduplicated and sorted: registration
1214
+ * declarations, literal `.model("…")` calls, and literal `modelName`/`model`
1215
+ * arguments of the direct records and documents calls (#3279). Empty for a
1216
+ * version-1 manifest, and for a function that names none.
1217
+ */
1218
+ models: string[];
1219
+ /** Every `ctx.api.<family>` and ctx-helper family the bundle reaches. */
1220
+ families: string[];
1221
+ /**
1222
+ * The scan met a model name it could not resolve — a computed
1223
+ * `modelName`, a `.model(variable)`. Says "and possibly more", which an
1224
+ * empty `models` list does not.
1225
+ */
1226
+ dynamicModels: boolean;
1227
+ }
1228
+ export interface ParsedManifest {
1229
+ ok: boolean;
1230
+ manifest: FunctionManifest | null;
1231
+ errors: string[];
1232
+ }
1233
+ /**
1234
+ * Validate a manifest's grammar and normalize it.
1235
+ *
1236
+ * Deliberately strict about SHAPE and silent about meaning: whether the models
1237
+ * exist, whether the queries are the ones the sandbox will really register,
1238
+ * and whether the author meant any of it are questions this cannot answer.
1239
+ */
1240
+ export declare function parseFunctionManifest(value: unknown): ParsedManifest;
1241
+ /**
1242
+ * The function MODE vocabulary, and the one place its two spellings meet —
1243
+ * #3281, project `server-functions` phase 4.
1244
+ *
1245
+ * `mode = "request" | "task"` is what an author writes (the intent, "Mode
1246
+ * vocabulary?", sponsor decision 2026-09-09): a request function runs inside
1247
+ * the call and returns its result; a task function returns a run id and
1248
+ * survives restarts. `durable = true | false` is the key the first releases
1249
+ * taught, and it stays ACCEPTED as an alias through the transition — a tree
1250
+ * pushed with it keeps pushing, and pulls back byte for byte — while `durable`
1251
+ * stays the adjective for the property itself.
1252
+ *
1253
+ * ── Why one module ───────────────────────────────────────────────────────
1254
+ *
1255
+ * Two spellings for one fact is a place two readers can disagree. So the
1256
+ * resolution is written once, here, in the dependency-free tree the CLI
1257
+ * vendors (`cli/scripts/gen-config-surfaces.mjs`), and every door reads it:
1258
+ * the CLI preflight and diff entity, the server's trigger derivation, the
1259
+ * admin config-version route (payload `mode` beside payload `durable`), the
1260
+ * invoke branch and the trigger fires. A file — or a payload — that carries
1261
+ * both keys has to have them AGREE, or it is refused naming both; a silent
1262
+ * winner would be the one thing worse than two spellings.
1263
+ *
1264
+ * The stored column is still `ServerFunctionConfig.durable` (no `models.yaml`
1265
+ * change before phase 7's rename sweep), which is why `configMode` exists:
1266
+ * reading the row is the other half of the same translation.
1267
+ */
1268
+ export type FunctionMode = "request" | "task";
1269
+ export declare const FUNCTION_MODES: readonly FunctionMode[];
1270
+ /** What a declaration resolved to, or why it could not. */
1271
+ export type DeclaredModeResolution = {
1272
+ ok: true;
1273
+ mode: FunctionMode;
1274
+ /**
1275
+ * Whether the declaration SAID anything — false when neither key was
1276
+ * present and the default applied. The admin route's divergence check
1277
+ * reads this: an omitted mode is no claim, so it cannot diverge.
1278
+ */
1279
+ declared: boolean;
1280
+ } | {
1281
+ ok: false;
1282
+ error: string;
1283
+ };
1284
+ /**
1285
+ * Resolve `mode` and its alias `durable` to one mode.
1286
+ *
1287
+ * Absent both → `request`. `mode` must be exactly `"request"` or `"task"`;
1288
+ * `durable` must be a boolean. Both present and disagreeing is refused naming
1289
+ * both keys, so an author who half-migrated a file hears which line to fix.
1290
+ */
1291
+ export declare function resolveDeclaredMode(input: {
1292
+ mode?: unknown;
1293
+ durable?: unknown;
1294
+ }): DeclaredModeResolution;
1295
+ /**
1296
+ * The mode a stored config-version row runs in.
1297
+ *
1298
+ * The column is `durable`; a row written before #3281 carries only that, and a
1299
+ * row written after it carries the same thing, so there is exactly one reading.
1300
+ */
1301
+ export declare function configMode(row: {
1302
+ durable?: unknown;
1303
+ } | null | undefined): FunctionMode;
1304
+ /** Is this mode the durable one? The adjective, for the paths that branch on it. */
1305
+ export declare function isDurableMode(mode: FunctionMode): boolean;
1306
+ /**
1307
+ * The trigger blocks a function declares, derived from its authored TOML
1308
+ * (#3181, project `server-functions`, criterion 4).
1309
+ *
1310
+ * ── The declaration is derived, never supplied ────────────────────────────
1311
+ *
1312
+ * A config-version push carries the authored `functions/<key>.toml` bytes
1313
+ * inside its envelope, and `envelopeHash` covers them. If the push ALSO
1314
+ * carried a parsed `triggers` payload, the two could disagree: a direct API
1315
+ * caller could ship a public webhook trigger the authored file does not
1316
+ * declare, and two pushes with identical envelopes but different trigger
1317
+ * payloads would collapse to one version. So the server parses the envelope's
1318
+ * own bytes here (D3181-005) and there is no payload field to disagree with —
1319
+ * trigger behavior is bound to the version's identity by construction.
1320
+ *
1321
+ * ── Shape only ────────────────────────────────────────────────────────────
1322
+ *
1323
+ * This module decides what the file SAYS: the accepted key set, the required
1324
+ * values, and the rules that need nothing but the document (scheme `none`,
1325
+ * a nameless or duplicated cron entry, an entry count past the per-function
1326
+ * cap, a webhook or database block on a task version). Everything that needs the
1327
+ * app's state — whether a referenced secret exists, whether the
1328
+ * scheme-specific config is valid, whether the app is at its webhook or cron
1329
+ * cap, whether a standalone webhook holds the key — belongs to the push
1330
+ * boundary, which runs the SAME validators the standalone create runs
1331
+ * (D3181-006).
1332
+ *
1333
+ * ── One implementation, two readers (#3320) ───────────────────────────────
1334
+ *
1335
+ * The CLI checks the same rules against the author's own file before a request
1336
+ * is made. It used to do that from a hand-written restatement
1337
+ * (`cli/src/lib/function-triggers.ts`), kept in step only by a paired-fixture
1338
+ * test — so a rule added here with no fixture drifted silently. The rules
1339
+ * therefore live in `src/config-surface/`, which `cli/scripts/
1340
+ * gen-config-surfaces.mjs` vendors verbatim into the committed artifact
1341
+ * `cli/src/lib/generated-config-surfaces.ts`. There is one implementation, and
1342
+ * a change here that is not regenerated fails `--check` (a build failure)
1343
+ * rather than a fixture list that happens not to cover it.
1344
+ *
1345
+ * Reading the authored BYTES is the one thing that stayed server-side:
1346
+ * `deriveTriggerDeclaration` in `src/server-functions/trigger-declaration.ts`
1347
+ * parses them and calls `normalizeTriggerDeclaration` here. This directory
1348
+ * imports nothing but itself (asserted by `config-surface-drift-guard.test.ts`),
1349
+ * and the CLI has already parsed its own file by the time it asks.
1350
+ */
1351
+ /**
1352
+ * The resolved mode the declaration is checked against (#3281).
1353
+ *
1354
+ * The rule is per KIND, and permanent (the intent, "Sync functions write a run
1355
+ * row?": *Webhook and database-change triggers require request mode; HTTP and
1356
+ * cron allow both*). A webhook delivery and a database write are both waiting
1357
+ * inside a request for the function to answer; a cron fire is waiting for
1358
+ * nothing, so it starts a task run when the version is a task (#3334).
1359
+ *
1360
+ * The caller resolves `mode`/`durable` once, through `resolveDeclaredMode`,
1361
+ * and hands the answer here — this module never reads the alias itself.
1362
+ */
1363
+ export interface TriggerModeOptions {
1364
+ mode?: FunctionMode;
1365
+ }
1366
+ /**
1367
+ * Why a webhook cannot drive a task function, and what to do instead (#3334).
1368
+ *
1369
+ * The first clause is verbatim what it has always been, so sibling pins on the
1370
+ * request-mode prefix (#3281's) keep holding; everything after the dash is the
1371
+ * half that was missing — an author who meets this at the push door could not
1372
+ * previously tell whether it was a limitation or a design, nor what to write.
1373
+ */
1374
+ export declare const WEBHOOK_ON_TASK_REFUSAL: string;
1375
+ /** A function's single webhook trigger, normalized. */
1376
+ export interface WebhookTriggerDeclaration {
1377
+ verificationScheme: string;
1378
+ signingSecret?: string;
1379
+ toleranceSeconds?: number;
1380
+ deduplicationEnabled?: boolean;
1381
+ deduplicationWindowMs?: number;
1382
+ maxBodyBytes?: number;
1383
+ secretGracePeriodMs?: number;
1384
+ /** `[function.triggers.webhook.verification]` — the row's `config`. */
1385
+ verification?: Record<string, unknown>;
1386
+ }
1387
+ /** One `[[function.triggers.cron]]` entry, normalized. */
1388
+ export interface CronTriggerDeclaration {
1389
+ name: string;
1390
+ cron: string;
1391
+ timezone?: string;
1392
+ overlapPolicy?: string;
1393
+ rootInput?: unknown;
1394
+ }
1395
+ /** One `[[function.triggers.database]]` entry, normalized (#3184). */
1396
+ export interface DatabaseTriggerDeclaration {
1397
+ /** The database type key whose writes fire this function. */
1398
+ type: string;
1399
+ }
1400
+ export interface TriggerDeclaration {
1401
+ webhook: WebhookTriggerDeclaration | null;
1402
+ cron: CronTriggerDeclaration[];
1403
+ databases: DatabaseTriggerDeclaration[];
1404
+ }
1405
+ export declare const EMPTY_TRIGGER_DECLARATION: TriggerDeclaration;
1406
+ /**
1407
+ * The most cron entries one function may declare.
1408
+ *
1409
+ * The per-app cap (50) is a resource ceiling; this is a per-OBJECT one, so a
1410
+ * single function cannot take most of an app's budget by itself. Ten is the
1411
+ * same order as the schedules a real function needs and leaves the app's
1412
+ * remaining slots for the other 40+ objects the cap is sized for.
1413
+ */
1414
+ export declare const MAX_CRON_TRIGGERS_PER_FUNCTION = 10;
1415
+ /**
1416
+ * The most database types one function may watch (#3184, D-07).
1417
+ *
1418
+ * Per-OBJECT, like the cron cap above: a function watching more than a handful
1419
+ * of types is describing a fan-in the platform cannot bound per write, and
1420
+ * every extra type is another discovery read on somebody's write path.
1421
+ */
1422
+ export declare const MAX_DATABASE_TRIGGERS_PER_FUNCTION = 5;
1423
+ export declare class TriggerDeclarationError extends Error {
1424
+ }
1425
+ /** Is anything at all declared? Used to skip work on the common case. */
1426
+ export declare function hasDeclaredTriggers(declaration: TriggerDeclaration): boolean;
1427
+ /**
1428
+ * Normalize the `triggers` table of an already-parsed `[function]` table.
1429
+ * Throws `TriggerDeclarationError` naming the rule that was broken.
1430
+ *
1431
+ * Split out from the parse (`deriveTriggerDeclaration`, which owns the bytes)
1432
+ * so the CLI's preflight can check the document it has already read, and so the
1433
+ * push boundary can normalize a declaration it read from a stored row without
1434
+ * re-parsing bytes.
1435
+ */
1436
+ export declare function normalizeTriggerDeclaration(functionTable: any, options?: TriggerModeOptions): TriggerDeclaration;
1437
+ /** The stored JSON for `ServerFunctionConfig.triggers`, or null when empty. */
1438
+ export declare function serializeTriggerDeclaration(declaration: TriggerDeclaration): string | null;
1439
+ /** Read a stored `ServerFunctionConfig.triggers` value back. */
1440
+ export declare function parseStoredTriggerDeclaration(stored: unknown): TriggerDeclaration;
1441
+ /** The `CronTrigger.triggerKey` an entry owns. */
1442
+ export declare function cronTriggerKeyFor(functionKey: string, name: string): string;
1443
+ /** The entry name a `<functionKey>:<name>` trigger key carries. */
1444
+ export declare function cronTriggerNameFrom(functionKey: string, triggerKey: string): string;
1445
+ /**
1446
+ * The `{{secrets.KEY}}` reference SHAPE, decided from the value alone.
1447
+ *
1448
+ * Split out of `src/services/secret-templates.ts` by #3320 so the one rule that
1449
+ * says whether a stored value IS a whole secret reference has one
1450
+ * implementation on both sides of a `config push`. The CLI preflight refuses a
1451
+ * webhook trigger whose `signingSecret` is a literal before anything is applied,
1452
+ * and the server refuses the same value at the write boundary, because both run
1453
+ * this code — the CLI through the artifact `cli/scripts/gen-config-surfaces.mjs`
1454
+ * renders, the server by importing this module. A shape-only restatement in the
1455
+ * CLI would have been subtly different: a reference spoiled by an invisible
1456
+ * character (#2297) survives `String.trim()` and would have passed a preflight
1457
+ * the server then failed.
1458
+ *
1459
+ * Pure by construction, which is what lets it live here: no secret store is
1460
+ * consulted, because whether a value is a REFERENCE never depends on which keys
1461
+ * exist. Whether the referenced key exists is the server's question, and stays
1462
+ * in `secret-templates.ts` beside the rest of resolution.
1463
+ *
1464
+ * `secret-templates.ts` re-exports everything here, so every existing caller
1465
+ * keeps its import and the two can never be different functions.
1466
+ */
1467
+ export declare const SECRETS_TEMPLATE_RE: RegExp;
1468
+ /** True when the value carries at least one `{{secrets.KEY}}` reference. */
1469
+ export declare function isSecretTemplate(value: string | null | undefined): boolean;
1470
+ /**
1471
+ * The value with every well-formed `{{secrets.KEY}}` reference removed — the
1472
+ * text that was NOT part of a reference the grammar accepts.
1473
+ *
1474
+ * This is the string the leftover-syntax rule below has to judge, and it is
1475
+ * always derived from the ORIGINAL stored value, never from a substituted
1476
+ * result. Resolution is a single `String.replace` pass that never re-scans
1477
+ * replacement text (`resolveMultiNamespaceTemplate`), so a brace or a
1478
+ * `secrets.` token coming out of a SECRET'S VALUE is inert — it is credential
1479
+ * material the operator stored, not config text, and testing the substituted
1480
+ * output would reject it (a Stripe key suffix stored as `}v2{` in an otherwise
1481
+ * valid `sk_live_{{secrets.SUFFIX}}` value).
1482
+ */
1483
+ export declare function withoutSecretReferences(value: string): string;
1484
+ /**
1485
+ * True when the value holds a well-formed `{{secrets.KEY}}` reference and the
1486
+ * text beside it is not credential material — a reference SPOILED by an
1487
+ * invisible character, rather than a legacy literal that happens to contain one
1488
+ * (#2297, consolidating #2386).
1489
+ *
1490
+ * Such a value is a reference spoiled by an authoring mistake — pasted out of
1491
+ * an editor or a document that carried a zero-width character along with it —
1492
+ * and it must fail closed rather than resolve. Before this rule a value spelled
1493
+ * `<U+200B>{{secrets.KEY}}` was not a whole reference (neither `\s` nor
1494
+ * `String.trim()` matches U+200B), carried no leftover reference SYNTAX once
1495
+ * the template was removed, and so classified as a working legacy literal that
1496
+ * resolved to U+200B followed by the secret: an HMAC key silently one byte
1497
+ * wrong, and a read surface pointing the operator at the wrong remediation.
1498
+ *
1499
+ * The rule judges the REMAINDER — the value with its well-formed references
1500
+ * taken out — against an allowlist, which is what makes the class closed:
1501
+ *
1502
+ * - Remainder empty, or ordinary whitespace only: the value is the reference it
1503
+ * plainly is, padding and all, and keeps resolving (#2191).
1504
+ * - Remainder carries at least one credential character: a genuine mixed
1505
+ * literal-plus-reference value (`sk_live_{{secrets.SUFFIX}}`), which predates
1506
+ * reference-only and keeps resolving as shipped (#2332) — including when the
1507
+ * operator's own bytes contain an invisible character, because that is
1508
+ * credential material rather than a spoiled pointer.
1509
+ * - Anything else: text that is present but that we cannot recognize as
1510
+ * credential material. Fail closed.
1511
+ *
1512
+ * Failing closed rather than stripping the character is the deliberate choice
1513
+ * (sponsor decision on #2297): stripping hides the mistake, where a
1514
+ * `malformed-reference` names it at the moment the value is written.
1515
+ *
1516
+ * A value with NO well-formed reference is not this rule's business, and needs
1517
+ * no separate handling: a pure literal is credential material the platform has
1518
+ * no standing to judge (`whsec_<U+200B>raw`), and a MISTYPED reference —
1519
+ * including one spoiled inside the braces, `{{secrets.<U+200B>KEY}}` — leaves
1520
+ * its syntax in the remainder and is already caught by
1521
+ * `carriesMalformedReferenceSyntax` in `secret-templates.ts`.
1522
+ *
1523
+ * Scoped to the reference-only credential boundary, not to
1524
+ * `resolveSecretTemplate`: an integration proxy header is a template by design
1525
+ * (`Authorization: Bearer {{secrets.TOKEN}}`), so it keeps resolving exactly
1526
+ * what the operator wrote.
1527
+ */
1528
+ export declare function isSpoiledSecretReference(value: string | null | undefined): boolean;
1529
+ /**
1530
+ * Matches a value that is EXACTLY one `{{secrets.KEY}}` reference and nothing
1531
+ * else. Anchored, and deliberately not global — `SECRETS_TEMPLATE_RE` carries
1532
+ * `lastIndex` state between calls.
1533
+ */
1534
+ export declare const WHOLE_SECRET_REFERENCE_RE: RegExp;
1535
+ /**
1536
+ * True when the whole (trimmed) value is a single `{{secrets.KEY}}` reference.
1537
+ *
1538
+ * The stricter sibling of `isSecretTemplate`, for the callers that use "is a
1539
+ * reference" to mean "carries no secret material of its own". `isSecretTemplate`
1540
+ * is a *contains* test, so `"sk_live_abcd{{secrets.SUFFIX}}"` satisfies it —
1541
+ * which is fine where a value is a template to be resolved (an
1542
+ * `Authorization: Bearer {{secrets.TOKEN}}` header is exactly that), and wrong
1543
+ * where the value is a credential that must live entirely in the encrypted
1544
+ * secret store. Used by the webhook `config` credential rule and by the
1545
+ * redaction that backs it: a mixed value would otherwise pass the write rule
1546
+ * AND skip redaction, storing and echoing most of a working credential in
1547
+ * cleartext.
1548
+ *
1549
+ * Trimmed, so `" {{secrets.KEY}} "` is accepted as the reference it plainly is;
1550
+ * two references, or a reference with any literal text beside it, are not.
1551
+ *
1552
+ * Invisible text beside the reference disqualifies the value before the trim
1553
+ * (#2297): U+FEFF is stripped by `String.trim()` and matched by `\s`, so
1554
+ * without the check a byte-order mark beside the braces would be silently
1555
+ * accepted while its zero-width siblings were not. Rejecting here is what makes
1556
+ * the write gates built on this predicate (`validateWholeSecretReference`, the
1557
+ * webhook `config` credential rule) refuse such a value at configuration time
1558
+ * rather than storing a row that can only fail at use time.
1559
+ */
1560
+ export declare function isWholeSecretReference(value: string | null | undefined): boolean;
1561
+ /**
1562
+ * The `signingSecret` rule a webhook's verification scheme carries, decided
1563
+ * from the declaration alone (#3320).
1564
+ *
1565
+ * `signingSecret` is reference-only (#2254): a whole `{{secrets.KEY}}`
1566
+ * reference naming an app secret, and nothing else. Which schemes need one,
1567
+ * whether one was supplied, and whether the supplied value is a reference are
1568
+ * all answerable from the file — so they belong in the `config push` preflight,
1569
+ * which aborts before anything is applied, rather than in the apply loop where
1570
+ * a refusal lands after sibling entities are already written.
1571
+ *
1572
+ * That is the whole reason this module exists here rather than beside the rest
1573
+ * of the webhook write pipeline: `src/config-surface/` is vendored verbatim
1574
+ * into `cli/src/lib/generated-config-surfaces.ts`, so the CLI runs the server's
1575
+ * rule instead of a restatement of it, and a change that is not regenerated
1576
+ * fails `gen-config-surfaces.mjs --check`.
1577
+ *
1578
+ * ── What is deliberately NOT here ─────────────────────────────────────────
1579
+ *
1580
+ * Everything that needs the app's state: whether the referenced secret exists,
1581
+ * whether the scheme's `config` is valid under this environment's JWKS policy,
1582
+ * the per-app row cap, a key a standalone webhook already holds. Those stay in
1583
+ * `src/app-api/services/webhook-settings-validation.ts`, which has `Env`. A
1584
+ * local copy of them would be a preflight that gives a false all-clear — and
1585
+ * the residue is then app-state-dependent by construction rather than by
1586
+ * accident of where a rule happened to live.
1587
+ */
1588
+ /**
1589
+ * Schemes that don't carry an HMAC `signingSecret`. These either store no key
1590
+ * material at all (`none`) or store it under `AppWebhook.config` instead:
1591
+ * `discord` puts the application public key in `config.publicKey`, `jwt` puts
1592
+ * a JWKS in `config.jwt.jwks`, and `plaid` fetches keys from Plaid using the
1593
+ * API credentials referenced in `config.plaid`.
1594
+ */
1595
+ export declare const SCHEMES_WITHOUT_SIGNING_SECRET: readonly string[];
1596
+ export declare function requiresSigningSecret(scheme: unknown): boolean;
1597
+ /** The coded refusals, so a client can branch without matching prose. */
1598
+ export declare const SIGNING_SECRET_MUST_BE_SECRET_REF = "SIGNING_SECRET_MUST_BE_SECRET_REF";
1599
+ export declare const SIGNING_SECRET_NOT_SUPPORTED_FOR_SCHEME = "SIGNING_SECRET_NOT_SUPPORTED_FOR_SCHEME";
1600
+ /**
1601
+ * A refusal from this rule. `plain` marks the ones the admin webhook create
1602
+ * answered as a bare text body rather than coded JSON — an observable
1603
+ * distinction, so it travels with the error rather than being flattened.
1604
+ */
1605
+ export interface SigningSecretRuleError {
1606
+ message: string;
1607
+ code?: string;
1608
+ plain?: boolean;
1609
+ }
1610
+ /** The reference-only message, shared by every field that carries one. */
1611
+ export declare function wholeSecretReferenceMessage(label: string): string;
1612
+ /**
1613
+ * Is this value a whole `{{secrets.KEY}}` reference? Returns the refusal a
1614
+ * caller renders, or null.
1615
+ *
1616
+ * `isWholeSecretReference`, never `isSecretTemplate`: a *contains* test admits
1617
+ * `sk_live_abcd{{secrets.SUFFIX}}`, which stores most of a working credential
1618
+ * in cleartext.
1619
+ */
1620
+ export declare function validateWholeSecretReference(label: string, value: unknown, code: string): SigningSecretRuleError | null;
1621
+ /**
1622
+ * The whole file-decidable `signingSecret` rule, in the order the standalone
1623
+ * webhook create ran it: a required secret must be present, a present one must
1624
+ * be a whole reference, and a scheme that carries no secret must not be given
1625
+ * one.
1626
+ *
1627
+ * Returns null when the declaration is acceptable — which does NOT mean the
1628
+ * write will succeed: the referenced key still has to exist, and that is the
1629
+ * server's question.
1630
+ */
1631
+ export declare function validateSigningSecretDeclaration(input: {
1632
+ verificationScheme: string;
1633
+ signingSecret?: unknown;
1634
+ }): SigningSecretRuleError | null;
1635
+ export declare const WORKFLOW_SURFACE: ConfigObjectSurface;
1636
+ export declare const PROMPT_SURFACE: ConfigObjectSurface;
1637
+ export declare const INTEGRATION_SURFACE: ConfigObjectSurface;
1638
+ export declare const WEBHOOK_SURFACE: ConfigObjectSurface;
1639
+ export declare const CRON_TRIGGER_SURFACE: ConfigObjectSurface;
1640
+ export declare const BLOB_BUCKET_SURFACE: ConfigObjectSurface;
1641
+ /**
1642
+ * The `email-template` configuration object's definition (issue #2644, phase 2).
1643
+ *
1644
+ * `email-templates/<emailType>.toml` carries a single `[template]` table. The
1645
+ * object is an OVERRIDE of a built-in template: the detail response is
1646
+ * `{ emailType, hasOverride, override: {...}, default: {...} }`, and only the
1647
+ * `override` half is a field surface — the `default` half is what the platform
1648
+ * ships. Both are declared as response-only keys so `config pull`'s
1649
+ * unrecognized-key warning reports genuinely unknown fields rather than the
1650
+ * envelope.
1651
+ *
1652
+ * There is one write endpoint (`PUT …/email-templates/{emailType}`, an upsert),
1653
+ * so every field is writable on both modes.
1654
+ */
1655
+ /**
1656
+ * Email types RETIRED by #2884, kept named rather than simply deleted.
1657
+ *
1658
+ * Email sign-in sends ONE email from the `email-sign-in` template, so
1659
+ * `magic-link` and `otp` are no longer rendered by any code path — which is
1660
+ * what makes deleting the link block from an `email-sign-in` override an
1661
+ * actual guarantee rather than a hope about which endpoint ran.
1662
+ *
1663
+ * A stored override for a retired type is NOT deleted: it stays listed and
1664
+ * readable (labelled retired, with the guidance below) so an app can find its
1665
+ * customization and migrate it, and deleting it still works. Everything that
1666
+ * would author one — the admin write/preview/test endpoints, `config create`,
1667
+ * a `config push --only` selector — refuses by name instead. Silent
1668
+ * non-rendering is the outcome all of that exists to avoid.
1669
+ *
1670
+ * It lives in the config surface, not beside the default templates, because
1671
+ * the CLI vendors this directory and needs the same sentence.
1672
+ */
1673
+ export declare const RETIRED_EMAIL_TYPES: readonly ["magic-link", "otp"];
1674
+ export type RetiredEmailType = (typeof RETIRED_EMAIL_TYPES)[number];
1675
+ /** True when `emailType` is one of the retired sign-in types. */
1676
+ export declare function isRetiredEmailType(emailType: string): emailType is RetiredEmailType;
1677
+ /** What every surface says about a retired type, in one sentence. */
1678
+ export declare function retiredEmailTypeGuidance(emailType: string): string;
1679
+ export declare const EMAIL_TEMPLATE_SURFACE: ConfigObjectSurface;
1680
+ export declare const DATABASE_TYPE_SURFACE: ConfigObjectSurface;
1681
+ export declare const RULE_SET_SURFACE: ConfigObjectSurface;
1682
+ export declare const GROUP_TYPE_CONFIG_SURFACE: ConfigObjectSurface;
1683
+ export declare const COLLECTION_TYPE_CONFIG_SURFACE: ConfigObjectSurface;
1684
+ export declare const METADATA_CATEGORY_CONFIG_SURFACE: ConfigObjectSurface;
1685
+ /**
1686
+ * The `transform` configuration object's definition (issue #2644, phase 3).
1687
+ *
1688
+ * Transforms are the one synced type with NO TOML field table: a transform is
1689
+ * `transforms/<name>.rhai`, a Rhai source file, and its whole authored surface
1690
+ * is the script body. `config pull` writes the active `ScriptConfig`'s body and
1691
+ * `config push` sends it back; there is no key/value table to define, and the
1692
+ * `Script` / `ScriptConfig` scalars around it (name, description, inputSchema,
1693
+ * limits, status) are not authorable through the sync slot today.
1694
+ *
1695
+ * The entry exists so that is a DECISION rather than an absence. Criterion 3's
1696
+ * registry guard reads `SYNC_RESOURCE_TYPES` and requires a surface per label;
1697
+ * without this module `transform` would have to sit in an exemption list, which
1698
+ * is precisely the "absent from a hand-written list" failure mode this epic
1699
+ * exists to end.
1700
+ */
1701
+ export declare const TRANSFORM_SURFACE: ConfigObjectSurface;
1702
+ export declare const SERVER_FUNCTION_SURFACE: ConfigObjectSurface;
1703
+ export declare const TEST_CASE_SURFACE: ConfigObjectSurface;
1704
+ export declare const APP_SETTINGS_SURFACE: ConfigObjectSurface;
1705
+ /**
1706
+ * The configuration-object registry (issue #2644).
1707
+ *
1708
+ * `CONFIG_SURFACES` holds one entry per synced configuration object type. The
1709
+ * registry — not a per-type test — is what makes coverage follow from existing:
1710
+ * `cli/tests/unit/config-surface-drift-guard.test.ts` reads the CLI's
1711
+ * `SYNC_RESOURCE_TYPES` labels and fails when a label has no surface here.
1712
+ *
1713
+ * `CONFIG_SURFACES` is the write authority. `SYNC_RESOURCE_TYPES` keeps its
1714
+ * documented role — directory/state/prune/diff layout metadata, explicitly "not
1715
+ * a write framework" — and gains no write-surface fields; the two are
1716
+ * cross-checked, not merged.
1717
+ */
1718
+ /**
1719
+ * Every configuration object whose field surface is defined here.
1720
+ *
1721
+ * One entry per `SYNC_RESOURCE_TYPES` label, plus the two surfaces that
1722
+ * round-trip without being a per-entity file: `app-settings` (`app.toml`) and
1723
+ * `test-case` (`<key>.tests/`). Nothing that syncs sits outside the registry —
1724
+ * `PENDING_MIGRATION`, the migration's temporary exemption list, is gone as of
1725
+ * phase 3, so a new synced type has nowhere to be parked and fails the registry
1726
+ * guard until it is defined (#2644 criterion 3).
1727
+ */
1728
+ export declare const CONFIG_SURFACES: readonly ConfigObjectSurface[];
1729
+ /**
1730
+ * The configuration surfaces that have not declared their CROSS-FIELD rules yet
1731
+ * (#3373, project `cli-server-rule-parity`).
1732
+ *
1733
+ * A surface declares either `crossFieldRules` or `noCrossFieldRules`; one that
1734
+ * declares neither is on this list, and the guard asserts the two sides agree in
1735
+ * both directions. Unlike #2644's `PENDING_MIGRATION` — deleted once the field
1736
+ * surfaces were all defined — this is not an exemption anyone may add to: it is
1737
+ * a settled inventory of work, and it only ever SHRINKS.
1738
+ *
1739
+ * The ratchet: `cli/tests/unit/config-surface-rules-guard-3373.test.ts` carries
1740
+ * its own literal copy of this list and asserts the two are equal. Every
1741
+ * migration removes its label from BOTH in the same change — that shrink is part
1742
+ * of the migrating issue's definition of done. Adding a label back here alone
1743
+ * fails the guard; adding it back to both is an edit to the guard itself, which
1744
+ * is as review-visible as weakening any other assertion.
1745
+ */
1746
+ export declare const CROSS_FIELD_RULES_UNMIGRATED: readonly string[];
1747
+ /** The surface for a `SyncResourceType.label`, or undefined when unmigrated. */
1748
+ export declare function getConfigSurface(label: string): ConfigObjectSurface | undefined;
1749
+ /** One table of one surface, addressed by its TOML path. */
1750
+ export declare function getConfigTable(label: string, tomlPath: readonly string[]): ConfigTable | undefined;
1751
+ /**
1752
+ * Every field of every `models.yaml` model a configuration-object definition
1753
+ * names, in declaration order — the coverage guard's anchor (#2644 criterion 2).
1754
+ */
1755
+ export declare const GENERATED_CONFIG_MODEL_FIELDS: Readonly<Record<string, readonly string[]>>;