primitive-admin 1.2.0-alpha.1 → 1.2.0-alpha.11

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 (410) hide show
  1. package/README.md +105 -134
  2. package/assets/skill/skills/primitive-platform/SKILL.md +37 -4
  3. package/dist/bin/primitive.js +30 -35
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/agent-sessions.d.ts +133 -0
  6. package/dist/src/commands/agent-sessions.js +792 -0
  7. package/dist/src/commands/agent-sessions.js.map +1 -0
  8. package/dist/src/commands/analytics.js +0 -148
  9. package/dist/src/commands/analytics.js.map +1 -1
  10. package/dist/src/commands/apps-children.d.ts +54 -0
  11. package/dist/src/commands/apps-children.js +631 -0
  12. package/dist/src/commands/apps-children.js.map +1 -0
  13. package/dist/src/commands/apps.d.ts +6 -0
  14. package/dist/src/commands/apps.js +131 -9
  15. package/dist/src/commands/apps.js.map +1 -1
  16. package/dist/src/commands/auth-sessions.d.ts +3 -3
  17. package/dist/src/commands/auth-sessions.js +117 -23
  18. package/dist/src/commands/auth-sessions.js.map +1 -1
  19. package/dist/src/commands/auth.js +460 -36
  20. package/dist/src/commands/auth.js.map +1 -1
  21. package/dist/src/commands/collections.js +316 -256
  22. package/dist/src/commands/collections.js.map +1 -1
  23. package/dist/src/commands/config.d.ts +1 -1
  24. package/dist/src/commands/config.js +60 -28
  25. package/dist/src/commands/config.js.map +1 -1
  26. package/dist/src/commands/connections.js +11 -12
  27. package/dist/src/commands/connections.js.map +1 -1
  28. package/dist/src/commands/database-type-configs.js +2 -76
  29. package/dist/src/commands/database-type-configs.js.map +1 -1
  30. package/dist/src/commands/databases.d.ts +9 -0
  31. package/dist/src/commands/databases.js +221 -457
  32. package/dist/src/commands/databases.js.map +1 -1
  33. package/dist/src/commands/db3-types.d.ts +15 -0
  34. package/dist/src/commands/db3-types.js +157 -0
  35. package/dist/src/commands/db3-types.js.map +1 -0
  36. package/dist/src/commands/db3.d.ts +12 -0
  37. package/dist/src/commands/db3.js +1052 -0
  38. package/dist/src/commands/db3.js.map +1 -0
  39. package/dist/src/commands/documents.d.ts +121 -2
  40. package/dist/src/commands/documents.js +1601 -1251
  41. package/dist/src/commands/documents.js.map +1 -1
  42. package/dist/src/commands/env.d.ts +9 -1
  43. package/dist/src/commands/env.js +164 -49
  44. package/dist/src/commands/env.js.map +1 -1
  45. package/dist/src/commands/function-trigger-commands.d.ts +28 -0
  46. package/dist/src/commands/function-trigger-commands.js +341 -0
  47. package/dist/src/commands/function-trigger-commands.js.map +1 -0
  48. package/dist/src/commands/functions.js +297 -24
  49. package/dist/src/commands/functions.js.map +1 -1
  50. package/dist/src/commands/groups.js +150 -49
  51. package/dist/src/commands/groups.js.map +1 -1
  52. package/dist/src/commands/guides.js +5 -5
  53. package/dist/src/commands/init.d.ts +7 -0
  54. package/dist/src/commands/init.js +23 -5
  55. package/dist/src/commands/init.js.map +1 -1
  56. package/dist/src/commands/integrations.js +14 -8
  57. package/dist/src/commands/integrations.js.map +1 -1
  58. package/dist/src/commands/metadata-category-configs.d.ts +2 -2
  59. package/dist/src/commands/metadata-category-configs.js +2 -2
  60. package/dist/src/commands/prompts.d.ts +7 -0
  61. package/dist/src/commands/prompts.js +48 -5
  62. package/dist/src/commands/prompts.js.map +1 -1
  63. package/dist/src/commands/scripts.d.ts +9 -17
  64. package/dist/src/commands/scripts.js +24 -479
  65. package/dist/src/commands/scripts.js.map +1 -1
  66. package/dist/src/commands/sync-app-settings.d.ts +36 -8
  67. package/dist/src/commands/sync-app-settings.js +109 -23
  68. package/dist/src/commands/sync-app-settings.js.map +1 -1
  69. package/dist/src/commands/sync.d.ts +360 -610
  70. package/dist/src/commands/sync.js +3151 -6697
  71. package/dist/src/commands/sync.js.map +1 -1
  72. package/dist/src/commands/tokens.js +3 -3
  73. package/dist/src/commands/tokens.js.map +1 -1
  74. package/dist/src/commands/users.js +77 -2
  75. package/dist/src/commands/users.js.map +1 -1
  76. package/dist/src/commands/workflows.d.ts +5 -83
  77. package/dist/src/commands/workflows.js +57 -2282
  78. package/dist/src/commands/workflows.js.map +1 -1
  79. package/dist/src/lib/aggregate-output.d.ts +25 -0
  80. package/dist/src/lib/aggregate-output.js +53 -0
  81. package/dist/src/lib/aggregate-output.js.map +1 -0
  82. package/dist/src/lib/api-client.d.ts +681 -551
  83. package/dist/src/lib/api-client.js +880 -814
  84. package/dist/src/lib/api-client.js.map +1 -1
  85. package/dist/src/lib/app-settings-descriptor.d.ts +47 -1
  86. package/dist/src/lib/app-settings-descriptor.js +114 -10
  87. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  88. package/dist/src/lib/auth-fixtures.d.ts +44 -0
  89. package/dist/src/lib/auth-fixtures.js +61 -0
  90. package/dist/src/lib/auth-fixtures.js.map +1 -0
  91. package/dist/src/lib/auth-flow.d.ts +41 -1
  92. package/dist/src/lib/auth-flow.js +70 -16
  93. package/dist/src/lib/auth-flow.js.map +1 -1
  94. package/dist/src/lib/block-layout.d.ts +12 -23
  95. package/dist/src/lib/block-layout.js +26 -92
  96. package/dist/src/lib/block-layout.js.map +1 -1
  97. package/dist/src/lib/block-selector.d.ts +2 -2
  98. package/dist/src/lib/block-selector.js +2 -2
  99. package/dist/src/lib/child-apps-local.d.ts +164 -0
  100. package/dist/src/lib/child-apps-local.js +258 -0
  101. package/dist/src/lib/child-apps-local.js.map +1 -0
  102. package/dist/src/lib/ci-session-request.d.ts +22 -0
  103. package/dist/src/lib/ci-session-request.js +51 -0
  104. package/dist/src/lib/ci-session-request.js.map +1 -0
  105. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +10 -8
  106. package/dist/src/lib/codegen-shared/generatedFiles.js +21 -15
  107. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
  108. package/dist/src/lib/codegen-shared/prettierStable.d.ts +1 -1
  109. package/dist/src/lib/codegen-shared/prettierStable.js +1 -1
  110. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +2 -2
  111. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +2 -2
  112. package/dist/src/lib/collection-export.d.ts +76 -15
  113. package/dist/src/lib/collection-export.js +116 -23
  114. package/dist/src/lib/collection-export.js.map +1 -1
  115. package/dist/src/lib/collection-principal.d.ts +22 -0
  116. package/dist/src/lib/collection-principal.js +35 -0
  117. package/dist/src/lib/collection-principal.js.map +1 -0
  118. package/dist/src/lib/config-object-descriptor.d.ts +3 -22
  119. package/dist/src/lib/config-object-descriptor.js +56 -290
  120. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  121. package/dist/src/lib/config-payload.js +2 -3
  122. package/dist/src/lib/config-payload.js.map +1 -1
  123. package/dist/src/lib/config-surface.d.ts +5 -7
  124. package/dist/src/lib/config-surface.js +18 -40
  125. package/dist/src/lib/config-surface.js.map +1 -1
  126. package/dist/src/lib/connections-list.d.ts +10 -0
  127. package/dist/src/lib/connections-list.js +18 -0
  128. package/dist/src/lib/connections-list.js.map +1 -0
  129. package/dist/src/lib/credentials-home.d.ts +58 -0
  130. package/dist/src/lib/credentials-home.js +204 -0
  131. package/dist/src/lib/credentials-home.js.map +1 -0
  132. package/dist/src/lib/credentials-lock.d.ts +88 -0
  133. package/dist/src/lib/credentials-lock.js +302 -0
  134. package/dist/src/lib/credentials-lock.js.map +1 -0
  135. package/dist/src/lib/credentials-store.d.ts +179 -24
  136. package/dist/src/lib/credentials-store.js +712 -77
  137. package/dist/src/lib/credentials-store.js.map +1 -1
  138. package/dist/src/lib/csv.d.ts +8 -9
  139. package/dist/src/lib/csv.js +3 -4
  140. package/dist/src/lib/csv.js.map +1 -1
  141. package/dist/src/lib/custodian.d.ts +8 -0
  142. package/dist/src/lib/custodian.js +18 -0
  143. package/dist/src/lib/custodian.js.map +1 -0
  144. package/dist/src/lib/db-codegen/dbGenerator.js +5 -16
  145. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
  146. package/dist/src/lib/db-codegen/dbNaming.d.ts +5 -13
  147. package/dist/src/lib/db-codegen/dbNaming.js +5 -17
  148. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
  149. package/dist/src/lib/db-codegen/dbTemplates.d.ts +7 -56
  150. package/dist/src/lib/db-codegen/dbTemplates.js +25 -125
  151. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  152. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +2 -2
  153. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  154. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +67 -2
  155. package/dist/src/lib/db-codegen/dbTypeIR.js +13 -2
  156. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  157. package/dist/src/lib/db3-export.d.ts +231 -0
  158. package/dist/src/lib/db3-export.js +510 -0
  159. package/dist/src/lib/db3-export.js.map +1 -0
  160. package/dist/src/lib/db3-index-output.d.ts +27 -0
  161. package/dist/src/lib/db3-index-output.js +49 -0
  162. package/dist/src/lib/db3-index-output.js.map +1 -0
  163. package/dist/src/lib/document-export-lookups.d.ts +31 -0
  164. package/dist/src/lib/document-export-lookups.js +53 -0
  165. package/dist/src/lib/document-export-lookups.js.map +1 -0
  166. package/dist/src/lib/document-export-permissions.d.ts +7 -5
  167. package/dist/src/lib/document-export-permissions.js +7 -5
  168. package/dist/src/lib/document-export-permissions.js.map +1 -1
  169. package/dist/src/lib/document-export-record-log.d.ts +57 -0
  170. package/dist/src/lib/document-export-record-log.js +215 -0
  171. package/dist/src/lib/document-export-record-log.js.map +1 -0
  172. package/dist/src/lib/document-ingest-artifact.d.ts +26 -2
  173. package/dist/src/lib/document-ingest-artifact.js +42 -8
  174. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  175. package/dist/src/lib/document-ingest-format2.d.ts +36 -0
  176. package/dist/src/lib/document-ingest-format2.js +78 -0
  177. package/dist/src/lib/document-ingest-format2.js.map +1 -0
  178. package/dist/src/lib/document-ingest-input.d.ts +9 -0
  179. package/dist/src/lib/document-ingest-input.js +28 -1
  180. package/dist/src/lib/document-ingest-input.js.map +1 -1
  181. package/dist/src/lib/document-ingest-rows.d.ts +16 -0
  182. package/dist/src/lib/document-ingest-rows.js +17 -0
  183. package/dist/src/lib/document-ingest-rows.js.map +1 -1
  184. package/dist/src/lib/document-ingest.d.ts +33 -1
  185. package/dist/src/lib/document-ingest.js +49 -0
  186. package/dist/src/lib/document-ingest.js.map +1 -1
  187. package/dist/src/lib/document-schema-rows.d.ts +42 -0
  188. package/dist/src/lib/document-schema-rows.js +53 -0
  189. package/dist/src/lib/document-schema-rows.js.map +1 -0
  190. package/dist/src/lib/env-resolver-core.d.ts +70 -2
  191. package/dist/src/lib/env-resolver-core.js +137 -20
  192. package/dist/src/lib/env-resolver-core.js.map +1 -1
  193. package/dist/src/lib/env-resolver.d.ts +14 -2
  194. package/dist/src/lib/env-resolver.js +32 -10
  195. package/dist/src/lib/env-resolver.js.map +1 -1
  196. package/dist/src/lib/function-authorize-check.d.ts +142 -0
  197. package/dist/src/lib/function-authorize-check.js +310 -0
  198. package/dist/src/lib/function-authorize-check.js.map +1 -0
  199. package/dist/src/lib/function-authorize-view.d.ts +15 -0
  200. package/dist/src/lib/function-authorize-view.js +50 -0
  201. package/dist/src/lib/function-authorize-view.js.map +1 -0
  202. package/dist/src/lib/function-bundle.d.ts +38 -18
  203. package/dist/src/lib/function-bundle.js +96 -35
  204. package/dist/src/lib/function-bundle.js.map +1 -1
  205. package/dist/src/lib/function-collect.d.ts +75 -12
  206. package/dist/src/lib/function-collect.js +427 -12
  207. package/dist/src/lib/function-collect.js.map +1 -1
  208. package/dist/src/lib/function-db-types.d.ts +29 -0
  209. package/dist/src/lib/function-db-types.js +117 -7
  210. package/dist/src/lib/function-db-types.js.map +1 -1
  211. package/dist/src/lib/function-document-types.d.ts +5 -3
  212. package/dist/src/lib/function-document-types.js +10 -14
  213. package/dist/src/lib/function-document-types.js.map +1 -1
  214. package/dist/src/lib/function-lint.d.ts +34 -0
  215. package/dist/src/lib/function-lint.js +112 -0
  216. package/dist/src/lib/function-lint.js.map +1 -0
  217. package/dist/src/lib/function-log-row.js +21 -2
  218. package/dist/src/lib/function-log-row.js.map +1 -1
  219. package/dist/src/lib/function-run.d.ts +16 -21
  220. package/dist/src/lib/function-run.js +37 -30
  221. package/dist/src/lib/function-run.js.map +1 -1
  222. package/dist/src/lib/function-schema-codegen.d.ts +1 -1
  223. package/dist/src/lib/function-schema-codegen.js +5 -5
  224. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  225. package/dist/src/lib/function-source-roots.d.ts +67 -0
  226. package/dist/src/lib/function-source-roots.js +148 -0
  227. package/dist/src/lib/function-source-roots.js.map +1 -0
  228. package/dist/src/lib/function-sync.d.ts +108 -22
  229. package/dist/src/lib/function-sync.js +127 -39
  230. package/dist/src/lib/function-sync.js.map +1 -1
  231. package/dist/src/lib/function-trigger-listing.d.ts +11 -6
  232. package/dist/src/lib/function-trigger-listing.js +32 -11
  233. package/dist/src/lib/function-trigger-listing.js.map +1 -1
  234. package/dist/src/lib/function-typecheck.d.ts +37 -2
  235. package/dist/src/lib/function-typecheck.js +210 -28
  236. package/dist/src/lib/function-typecheck.js.map +1 -1
  237. package/dist/src/lib/function-versions.d.ts +2 -0
  238. package/dist/src/lib/function-versions.js +1 -0
  239. package/dist/src/lib/function-versions.js.map +1 -1
  240. package/dist/src/lib/generated-allowlist.js +0 -20
  241. package/dist/src/lib/generated-allowlist.js.map +1 -1
  242. package/dist/src/lib/generated-config-surfaces.d.ts +703 -203
  243. package/dist/src/lib/generated-config-surfaces.js +2270 -2014
  244. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  245. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  246. package/dist/src/lib/generated-sdk-types.js +1 -1
  247. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  248. package/dist/src/lib/init-adopt.js +12 -3
  249. package/dist/src/lib/init-adopt.js.map +1 -1
  250. package/dist/src/lib/init-login-note.d.ts +13 -0
  251. package/dist/src/lib/init-login-note.js +22 -0
  252. package/dist/src/lib/init-login-note.js.map +1 -0
  253. package/dist/src/lib/json-value.d.ts +6 -0
  254. package/dist/src/lib/json-value.js +13 -0
  255. package/dist/src/lib/json-value.js.map +1 -0
  256. package/dist/src/lib/load-routes.d.ts +33 -0
  257. package/dist/src/lib/load-routes.js +35 -0
  258. package/dist/src/lib/load-routes.js.map +1 -0
  259. package/dist/src/lib/local-state.d.ts +38 -7
  260. package/dist/src/lib/local-state.js +172 -49
  261. package/dist/src/lib/local-state.js.map +1 -1
  262. package/dist/src/lib/local-test-cases.d.ts +5 -2
  263. package/dist/src/lib/local-test-cases.js +7 -4
  264. package/dist/src/lib/local-test-cases.js.map +1 -1
  265. package/dist/src/lib/log-inspection.d.ts +42 -4
  266. package/dist/src/lib/log-inspection.js +37 -5
  267. package/dist/src/lib/log-inspection.js.map +1 -1
  268. package/dist/src/lib/login-exchange-check.d.ts +18 -0
  269. package/dist/src/lib/login-exchange-check.js +27 -0
  270. package/dist/src/lib/login-exchange-check.js.map +1 -0
  271. package/dist/src/lib/login-scope-lines.d.ts +25 -0
  272. package/dist/src/lib/login-scope-lines.js +45 -0
  273. package/dist/src/lib/login-scope-lines.js.map +1 -0
  274. package/dist/src/lib/logout-admin-session.d.ts +2 -1
  275. package/dist/src/lib/logout-admin-session.js +7 -1
  276. package/dist/src/lib/logout-admin-session.js.map +1 -1
  277. package/dist/src/lib/object-status-filter.d.ts +9 -1
  278. package/dist/src/lib/object-status-filter.js +9 -1
  279. package/dist/src/lib/object-status-filter.js.map +1 -1
  280. package/dist/src/lib/output.js +2 -0
  281. package/dist/src/lib/output.js.map +1 -1
  282. package/dist/src/lib/paginate.d.ts +0 -5
  283. package/dist/src/lib/paginate.js +0 -5
  284. package/dist/src/lib/paginate.js.map +1 -1
  285. package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
  286. package/dist/src/lib/pin-refusal-hint.js +35 -0
  287. package/dist/src/lib/pin-refusal-hint.js.map +1 -0
  288. package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
  289. package/dist/src/lib/primitive-env-plugin.js +408 -0
  290. package/dist/src/lib/primitive-env-plugin.js.map +1 -0
  291. package/dist/src/lib/project-config.d.ts +7 -0
  292. package/dist/src/lib/project-config.js +22 -1
  293. package/dist/src/lib/project-config.js.map +1 -1
  294. package/dist/src/lib/project-login-apps.d.ts +8 -0
  295. package/dist/src/lib/project-login-apps.js +27 -0
  296. package/dist/src/lib/project-login-apps.js.map +1 -0
  297. package/dist/src/lib/prompt-schema-codegen.d.ts +10 -3
  298. package/dist/src/lib/prompt-schema-codegen.js +52 -11
  299. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  300. package/dist/src/lib/pull-write.d.ts +31 -0
  301. package/dist/src/lib/pull-write.js +49 -0
  302. package/dist/src/lib/pull-write.js.map +1 -0
  303. package/dist/src/lib/push-failure-report.d.ts +45 -0
  304. package/dist/src/lib/push-failure-report.js +57 -0
  305. package/dist/src/lib/push-failure-report.js.map +1 -0
  306. package/dist/src/lib/records-verbs.d.ts +69 -0
  307. package/dist/src/lib/records-verbs.js +40 -0
  308. package/dist/src/lib/records-verbs.js.map +1 -0
  309. package/dist/src/lib/refresh-admin-credentials.d.ts +7 -0
  310. package/dist/src/lib/refresh-admin-credentials.js +16 -4
  311. package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
  312. package/dist/src/lib/root-import-decision.d.ts +65 -0
  313. package/dist/src/lib/root-import-decision.js +109 -0
  314. package/dist/src/lib/root-import-decision.js.map +1 -0
  315. package/dist/src/lib/run-status.d.ts +1 -1
  316. package/dist/src/lib/run-status.generated.d.ts +2 -2
  317. package/dist/src/lib/run-status.generated.js +3 -1
  318. package/dist/src/lib/run-status.generated.js.map +1 -1
  319. package/dist/src/lib/run-status.js +1 -1
  320. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
  321. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +269 -0
  322. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
  323. package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
  324. package/dist/src/lib/schema-codegen/naming.js +83 -0
  325. package/dist/src/lib/schema-codegen/naming.js.map +1 -0
  326. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +82 -0
  327. package/dist/src/lib/schema-codegen/schemaToTs.js +305 -0
  328. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
  329. package/dist/src/lib/scope-request.d.ts +84 -0
  330. package/dist/src/lib/scope-request.js +235 -0
  331. package/dist/src/lib/scope-request.js.map +1 -0
  332. package/dist/src/lib/session-id.d.ts +9 -0
  333. package/dist/src/lib/session-id.js +28 -0
  334. package/dist/src/lib/session-id.js.map +1 -0
  335. package/dist/src/lib/snapshot-build-rows.d.ts +21 -0
  336. package/dist/src/lib/snapshot-build-rows.js +22 -0
  337. package/dist/src/lib/snapshot-build-rows.js.map +1 -1
  338. package/dist/src/lib/snapshot-build.js +8 -3
  339. package/dist/src/lib/snapshot-build.js.map +1 -1
  340. package/dist/src/lib/snapshots.d.ts +17 -1
  341. package/dist/src/lib/snapshots.js +50 -2
  342. package/dist/src/lib/snapshots.js.map +1 -1
  343. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +6 -2
  344. package/dist/src/lib/swift-codegen/agentGenerator.js +57 -5
  345. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  346. package/dist/src/lib/swift-codegen/banners.d.ts +34 -7
  347. package/dist/src/lib/swift-codegen/banners.js +37 -7
  348. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  349. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +4 -3
  350. package/dist/src/lib/swift-codegen/dbGenerator.js +14 -117
  351. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
  352. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +3 -3
  353. package/dist/src/lib/swift-codegen/functionGenerator.js +23 -18
  354. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  355. package/dist/src/lib/swift-codegen/generator.d.ts +5 -5
  356. package/dist/src/lib/swift-codegen/generator.js +35 -40
  357. package/dist/src/lib/swift-codegen/generator.js.map +1 -1
  358. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +3 -3
  359. package/dist/src/lib/swift-codegen/schemaToSwift.js +4 -4
  360. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  361. package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
  362. package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
  363. package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
  364. package/dist/src/lib/sync-paths.d.ts +35 -0
  365. package/dist/src/lib/sync-paths.js +57 -5
  366. package/dist/src/lib/sync-paths.js.map +1 -1
  367. package/dist/src/lib/sync-resource-types.d.ts +26 -26
  368. package/dist/src/lib/sync-resource-types.js +61 -189
  369. package/dist/src/lib/sync-resource-types.js.map +1 -1
  370. package/dist/src/lib/sync-selectors.d.ts +5 -1
  371. package/dist/src/lib/sync-selectors.js +23 -13
  372. package/dist/src/lib/sync-selectors.js.map +1 -1
  373. package/dist/src/lib/test-case-file-names.d.ts +3 -5
  374. package/dist/src/lib/test-case-file-names.js +3 -5
  375. package/dist/src/lib/test-case-file-names.js.map +1 -1
  376. package/dist/src/lib/toml-database-config.d.ts +15 -75
  377. package/dist/src/lib/toml-database-config.js +17 -306
  378. package/dist/src/lib/toml-database-config.js.map +1 -1
  379. package/dist/src/lib/transient-retry.d.ts +43 -0
  380. package/dist/src/lib/transient-retry.js +94 -0
  381. package/dist/src/lib/transient-retry.js.map +1 -0
  382. package/dist/src/lib/vars-override.d.ts +105 -0
  383. package/dist/src/lib/vars-override.js +143 -0
  384. package/dist/src/lib/vars-override.js.map +1 -0
  385. package/dist/src/lib/webhook-capture.d.ts +43 -0
  386. package/dist/src/lib/webhook-capture.js +91 -0
  387. package/dist/src/lib/webhook-capture.js.map +1 -0
  388. package/dist/src/lib/webhook-deliver.d.ts +18 -20
  389. package/dist/src/lib/webhook-deliver.js +34 -89
  390. package/dist/src/lib/webhook-deliver.js.map +1 -1
  391. package/dist/src/lib/webhook-test-run.d.ts +32 -0
  392. package/dist/src/lib/webhook-test-run.js +108 -0
  393. package/dist/src/lib/webhook-test-run.js.map +1 -0
  394. package/dist/src/lib/workflow-codegen/generator.d.ts +7 -7
  395. package/dist/src/lib/workflow-codegen/generator.js +16 -23
  396. package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
  397. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +6 -12
  398. package/dist/src/lib/workflow-codegen/invokerIR.js +4 -5
  399. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
  400. package/dist/src/lib/workflow-toml-validator.d.ts +2 -0
  401. package/dist/src/lib/workflow-toml-validator.js +28 -1
  402. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  403. package/dist/src/types/index.d.ts +30 -37
  404. package/dist/src/validators.d.ts +7 -55
  405. package/dist/src/validators.js +7 -53
  406. package/dist/src/validators.js.map +1 -1
  407. package/dist/src/vite.d.ts +17 -0
  408. package/dist/src/vite.js +18 -0
  409. package/dist/src/vite.js.map +1 -0
  410. package/package.json +20 -12
@@ -31,7 +31,7 @@
31
31
  * server; the CLI vendors them at build time into
32
32
  * `cli/src/lib/generated-config-surfaces.ts`
33
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
34
+ * `gen-workflow-schema-descriptor.mjs` (#1442) already uses, so the published CLI
35
35
  * still imports no server code at runtime.
36
36
  *
37
37
  * ── Scope: declarative classification and coverage ONLY ──────────────────
@@ -283,8 +283,7 @@ export type RuleStage = "preflight" | "apply";
283
283
  export type CrossFieldRuleStage = RuleStage;
284
284
  /**
285
285
  * One rule of a configuration object that spans more than one field — `durable
286
- * = true` beside a webhook trigger, `runAs = "system"` beside a non-empty
287
- * `accessRule`, an HMAC scheme with no `signingSecret`.
286
+ * = true` beside a webhook trigger, an HMAC scheme with no `signingSecret`.
288
287
  *
289
288
  * Such a rule belongs to no single field, so `ConfigField.validation` has
290
289
  * nowhere to put it; attaching it to one field arbitrarily would make the
@@ -362,8 +361,9 @@ export interface ConfigObjectSurface {
362
361
  * Declares that this object HAS no TOML field table, with the reason —
363
362
  * required when `tables` is empty and forbidden otherwise.
364
363
  *
365
- * `transform` is the case: a `.rhai` file's authored surface is the script
366
- * body, so there is no key/value table to define. Saying so here is the same
364
+ * `transform` was the case until it retired with the Rhai runtime (#3190): a
365
+ * `.rhai` file's authored surface was the script body, so there was no
366
+ * key/value table to define. Saying so here is the same
367
367
  * rule `notExposed` applies to a field, one level up: "absent from the
368
368
  * registry" and "deliberately fieldless" must not look the same (#2644
369
369
  * criterion 4).
@@ -455,8 +455,8 @@ export declare const DECLARED_ACCESS_MANIFEST_KEYS: Readonly<Record<string, NotE
455
455
  * accepts. What a present key MEANS stays with the per-field handler the
456
456
  * definition names (spec §Contracts, decision of record #1976): the workflow
457
457
  * `status` enum, the non-negative-integer coercion of the queue limits,
458
- * `runAs`'s caller|system check, `parseWorkflowLock`, the `capabilities` array
459
- * shape and the CEL parse of `accessRule` all stay where they are. The
458
+ * `runAs`'s caller|system check, `parseWorkflowLock` and the `capabilities`
459
+ * array shape all stay where they are. The
460
460
  * mechanical win is that a field can no longer be *absent* from the accepted
461
461
  * set.
462
462
  *
@@ -466,12 +466,12 @@ export type WriteMode = "create" | "update";
466
466
  /** The field names this table accepts on the wire in `mode`, in declaration order. */
467
467
  export declare function writableFieldNames(table: ConfigTable, mode: WriteMode): string[];
468
468
  /**
469
- * The field names the server PERSISTS for this table in `mode`: the writable
470
- * fields, plus the `deprecated` classifications — "still writable, superseded
471
- * by another field" is what that kind means (`types.ts`), so a superseded key
472
- * a handler still honors (`passkeyRpId`, or a flat chat key such as
473
- * `systemPrompt` under `[[configs]]`, #3626) belongs in every
474
- * accepted set, and a field that is NOT writable belongs in none of them.
469
+ * The field names the server ACCEPTS for this table in `mode`: the writable
470
+ * fields, plus the `deprecated` classifications — "still accepted, superseded
471
+ * or scheduled for removal" is what that kind means (`types.ts`), so a
472
+ * superseded key a handler still honors (`protected`) and a retired one it
473
+ * accepts and ignores (`accessRule`, #4872) belong in every accepted set, and a
474
+ * field that is NOT writable belongs in none of them.
475
475
  *
476
476
  * Stated once here because three consumers need the same answer: the generated
477
477
  * request schemas, `PUT /settings`'s write allow-list, and the guards.
@@ -630,8 +630,9 @@ export declare function acceptedGroupTomlKeys(table: ConfigTable, group: string)
630
630
  * is therefore an unknown key rather than one the payload builder silently
631
631
  * ignores (SO3626-013) — the builder reads a grouped field only from
632
632
  * `source[group][tomlKey]`, so accepting it here would drop the author's value
633
- * without a word. The nine deprecated flat chat keys stay accepted through
634
- * their `tomlOnlyKeys` declarations, which is what keeps old files pushing.
633
+ * without a word. A key whose root spelling was retired while it moved into a
634
+ * group (the flat chat keys, #3642) is refused the same way, with the guidance
635
+ * `RETIRED_TOML_SPELLINGS` states.
635
636
  */
636
637
  export declare function acceptedTomlKeys(table: ConfigTable): Set<string>;
637
638
  /**
@@ -980,11 +981,11 @@ export declare function findUnreachedPreflightRules(surface: ConfigObjectSurface
980
981
  *
981
982
  * ── What the schema says, and what it deliberately does not ──────────────
982
983
  * It states the KEY SET only: each property is the empty schema (or carries
983
- * only the `deprecated` annotation, #1815), so no value is type-checked here. That is the decision of record (#1976, carried forward at
984
- * #2644's design gate): the definition classifies, handlers behave. The
985
- * `status` enum, the queue limits' integer coercion, `runAs`'s caller|system
986
- * check, the CEL parse of `accessRule` — all stay in the handlers the
987
- * definition names, with their existing messages. Adding type gates here would
984
+ * only the `deprecated` annotation, #1815), so no value is type-checked here.
985
+ * That is the decision of record (#1976, carried forward at #2644's design
986
+ * gate): the definition classifies, handlers behave. The `status` enum, the
987
+ * queue limits' integer coercion, the CEL parse of a rule set's expressions —
988
+ * all stay in the handlers the definition names, with their existing messages. Adding type gates here would
988
989
  * duplicate them and start rejecting values the handlers accept.
989
990
  *
990
991
  * ── Which keys are in the set ────────────────────────────────────────────
@@ -1017,7 +1018,8 @@ export interface ConfigRequestSchema {
1017
1018
  type: "object";
1018
1019
  /**
1019
1020
  * Each property is the empty schema, or `{ deprecated: true }` for a field
1020
- * the definition marks `deprecated` (#1815). `deprecated` is an OpenAPI
1021
+ * the definition marks `deprecated` (#1815) or a key `notExposed` classifies
1022
+ * `deprecated` (#4872). `deprecated` is an OpenAPI
1021
1023
  * annotation: it constrains no value, so the schema still states the key set
1022
1024
  * and nothing more.
1023
1025
  */
@@ -1089,7 +1091,7 @@ export declare function unknownRequestKeysMessage(keys: readonly string[]): stri
1089
1091
  * retired key: the TOML wording for `config push` (which can tell the author to
1090
1092
  * delete a line) and the request wording for the API handlers (which cannot).
1091
1093
  *
1092
- * Keyed by the table's TOML path prefix (`workflow`, `cronTrigger`, …), because
1094
+ * Keyed by the table's TOML path prefix (`integration`, `prompt`, …), because
1093
1095
  * that is the identifier both consumers already have in hand.
1094
1096
  *
1095
1097
  * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
@@ -1101,8 +1103,85 @@ export interface RetiredConfigKey {
1101
1103
  request: string;
1102
1104
  }
1103
1105
  export declare const RETIRED_CONFIG_KEYS: Record<string, Record<string, RetiredConfigKey>>;
1106
+ /**
1107
+ * Keys DEPRECATED on a configuration object's write surface: still accepted
1108
+ * in TOML and on the wire, ignored, and scheduled for removal.
1109
+ *
1110
+ * A deprecated key sits between a live field and a retired one. The table
1111
+ * classifies it `deprecated` in both `notExposed` (so a body that still sends
1112
+ * it is accepted) and `tomlOnlyKeys` (so a file that still carries it
1113
+ * validates); this registry holds the one sentence `config push` prints for a
1114
+ * file that carries it, and is what `config pull` keys its forced rewrite on,
1115
+ * so the pull the sentence names removes the line.
1116
+ *
1117
+ * Keyed by the table's TOML path prefix, like `RETIRED_CONFIG_KEYS`. The
1118
+ * scheduled break moves an entry from here to that map.
1119
+ */
1120
+ export interface DeprecatedConfigKey {
1121
+ /** What `config push` says, once per file, about a file that carries the key. */
1122
+ toml: string;
1123
+ }
1124
+ export declare const DEPRECATED_CONFIG_KEYS: Record<string, Record<string, DeprecatedConfigKey>>;
1125
+ /** The deprecated-key entry for `key` under `prefix`, or null when it is not deprecated. */
1126
+ export declare function deprecatedConfigKey(prefix: string, key: string): DeprecatedConfigKey | null;
1127
+ /**
1128
+ * Config-tree directories whose object type retired — #3190, server-functions
1129
+ * phase 7. The DSL engine, the Rhai runtime and the standalone webhook and
1130
+ * cron objects are gone, so `config push` refuses a tree that still holds one
1131
+ * of these directories, by name and before it writes anything, rather than
1132
+ * ignoring files an author still expects to take effect.
1133
+ *
1134
+ * Each entry is one sentence: what retired, what replaces it, and the docs page
1135
+ * that shows the replacement.
1136
+ */
1137
+ export declare const RETIRED_CONFIG_DIRECTORIES: Record<string, string>;
1138
+ /**
1139
+ * The type-config directories a config tree no longer has (#4731, project
1140
+ * `role-based-groups-collections`). Groups and collections have fixed roles,
1141
+ * so their per-type configuration retired with its routes; `config push`
1142
+ * refuses a tree that still holds a file in either, naming each file, rather
1143
+ * than ignoring files an author still expects to take effect. The rows the
1144
+ * server already stored are not touched.
1145
+ *
1146
+ * Each entry is one sentence: what retired, and what replaces it.
1147
+ */
1148
+ export declare const RETIRED_TYPE_CONFIG_DIRECTORIES: Record<string, string>;
1149
+ /** The retirement sentence for a config-tree directory, or null when it is live. */
1150
+ export declare function retiredConfigDirectory(dir: string): string | null;
1151
+ /**
1152
+ * Top-level TOML tables a configuration object's FILE retired — keyed by the
1153
+ * surface's label, then by the table key. Only the TOML half exists: these were
1154
+ * sub-trees applied through their own endpoints, never request keys of the
1155
+ * object itself, so no request body can carry one.
1156
+ *
1157
+ * Without an entry here a retired table would be answered as an unrecognized
1158
+ * one ("check the spelling, or upgrade the CLI"), which is backwards for a
1159
+ * table removed on purpose.
1160
+ */
1161
+ export declare const RETIRED_DOCUMENT_KEYS: Record<string, Record<string, RetiredTomlSpelling>>;
1162
+ /** The retired-table guidance for `key` on the surface labelled `label`, or null. */
1163
+ export declare function retiredDocumentKey(label: string, key: string): RetiredTomlSpelling | null;
1104
1164
  /** The retired-key entry for `key` under `prefix`, or null when it is simply unknown. */
1105
1165
  export declare function retiredConfigKey(prefix: string, key: string): RetiredConfigKey | null;
1166
+ /**
1167
+ * A spelling retired from the TOML surface only: the request body still
1168
+ * carries the key, so there is no request sentence to give.
1169
+ */
1170
+ export interface RetiredTomlSpelling {
1171
+ /** What `config push` says about a file that still writes the key this way. */
1172
+ toml: string;
1173
+ }
1174
+ /**
1175
+ * Spellings retired from TOML while the key itself stays live on the wire,
1176
+ * keyed like `RETIRED_CONFIG_KEYS`. The request side never reads this map: a
1177
+ * body that sends one of these keys is a body the schema accepts.
1178
+ */
1179
+ export declare const RETIRED_TOML_SPELLINGS: Record<string, Record<string, RetiredTomlSpelling>>;
1180
+ /**
1181
+ * The TOML guidance for `key` under `prefix`: a fully retired key's, else a
1182
+ * retired spelling's, else null when the key is simply unknown.
1183
+ */
1184
+ export declare function retiredTomlKey(prefix: string, key: string): RetiredTomlSpelling | null;
1106
1185
  /**
1107
1186
  * The capability grammar for server functions — #3182 phase 1, rewritten by
1108
1187
  * #3279 (project `server-functions` phase 3).
@@ -1125,7 +1204,10 @@ export declare function retiredConfigKey(prefix: string, key: string): RetiredCo
1125
1204
  * `secret:<NAME>` credential least privilege — which secret VALUES may
1126
1205
  * cross into the sandbox at all;
1127
1206
  * the high-blast list {@link HIGH_BLAST_CAPABILITIES} — the operations
1128
- * whose blast radius the intent keeps opt-in.
1207
+ * whose blast radius the intent keeps opt-in;
1208
+ * the subject grants {@link SUBJECT_GRANT_CAPABILITIES} — naming another
1209
+ * member on a call about one user, in a run a plain
1210
+ * member invoked.
1129
1211
  *
1130
1212
  * Every other string a function used to declare is RETIRED, and the grammar
1131
1213
  * says so by name: an author who still writes `database:orders/Order:read`
@@ -1178,15 +1260,44 @@ export declare const KEYED_GRANT_FAMILIES: readonly ["integration", "secret"];
1178
1260
  * other — `databases:create` is not permission to delete a database.
1179
1261
  *
1180
1262
  * The database ROLE mutations are here because they hand out persistent
1181
- * authority: a group grant assigns the manager role (D3279-003). App deletion
1263
+ * authority: a group grant assigns the manager role (D3279-003). A db3's sync
1264
+ * switch (`db3:setSync`, the intent's `db3-sync` grant) is here because
1265
+ * turning sync off suspends every grant on the db3 (#4799); a db3's transfer
1266
+ * and its owner-row change (`db3:transfer`, `db3:setOwnerRow`, the intent's
1267
+ * `db3-grant` grant) because they move who holds the db3 and its owner row
1268
+ * (#4800); its app access (`db3:setAppAccess`, the same grant's third string)
1269
+ * because it grants the db3 to every user of the app (#4801). App deletion
1182
1270
  * and secret writes have no app-API route today; they are recorded, not gated,
1183
1271
  * and the profile generator refuses to admit a future such route without a row
1184
1272
  * here (`HIGH_BLAST_WATCH` in `scripts/lib/function-profile.mjs`).
1185
1273
  */
1186
- 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"];
1187
- /** The exact strings, which since #3279 are exactly the high-blast list. */
1188
- 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"];
1189
- export type GrantFamily = (typeof KEYED_GRANT_FAMILIES)[number] | "databases" | "users" | "blobBuckets";
1274
+ 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", "db3:setSync", "db3:transfer", "db3:setOwnerRow", "db3:setAppAccess"];
1275
+ /**
1276
+ * The subject grants — #4909.
1277
+ *
1278
+ * A run a plain member invoked may name nobody but its caller on a call that
1279
+ * is about one user (#4142's subject rule): `SUBJECT_USER_FORBIDDEN`. A
1280
+ * function whose own code chooses that user — a class's teacher removing a
1281
+ * student and reading where else the student is enrolled — declares it here,
1282
+ * in a line a reviewer can find:
1283
+ *
1284
+ * `users:readAny` the user-subject READS may name another member
1285
+ * (memberships, a member's collections and documents,
1286
+ * their root document, inbox, devices, agent sessions);
1287
+ * `users:actAsAny` the calls that ACT as a member may name another member
1288
+ * (marking their notifications read, their devices, an
1289
+ * agent session as them, `ctx.db3` `asUser`, their
1290
+ * aliases).
1291
+ *
1292
+ * Each admits only its own kind. Neither changes a run with no caller, an
1293
+ * owner- or admin-invoked run, or a run an agent drives (refused either way),
1294
+ * and a nested child reads its own version's. They are not high-blast rows:
1295
+ * those are 1:1 with an operation id, and these name a rule, not an operation.
1296
+ */
1297
+ export declare const SUBJECT_GRANT_CAPABILITIES: readonly ["users:readAny", "users:actAsAny"];
1298
+ /** The exact strings: the high-blast list and the subject grants. */
1299
+ export declare const EXACT_GRANT_STRINGS: readonly string[];
1300
+ export type GrantFamily = (typeof KEYED_GRANT_FAMILIES)[number] | "databases" | "users" | "blobBuckets" | "db3";
1190
1301
  /**
1191
1302
  * The retired FAMILIES (#3279), each with the reason it is gone.
1192
1303
  *
@@ -1388,7 +1499,21 @@ export declare function validateKeyedGrantsAgainstTargets(grants: readonly Funct
1388
1499
  * A version-1 manifest still parses: it records registrations only.
1389
1500
  */
1390
1501
  export declare const FUNCTION_MANIFEST_SCHEMA_VERSION = 2;
1391
- export declare const FUNCTION_MANIFEST_SCHEMA_VERSIONS: readonly [1, 2];
1502
+ export declare const FUNCTION_MANIFEST_SCHEMA_VERSIONS: readonly [1, 2, 3];
1503
+ /**
1504
+ * Version 3 (#4730) adds what a version's `authorize` admits: the
1505
+ * `authorize` block and the `writeFamilies` its handler reaches. Only a
1506
+ * FLAGGED build emits it — the manifest is inside the envelope hash, so a
1507
+ * universal bump would make every untouched bare-handler tree a new version
1508
+ * on its next push. A bare-handler tree keeps emitting version 2.
1509
+ */
1510
+ export declare const FUNCTION_MANIFEST_AUTHORIZE_SCHEMA_VERSION = 3;
1511
+ /** The `auth.*` families an `authorize` can read, as the manifest names them. */
1512
+ export declare const AUTH_FAMILIES: readonly ["auth.user", "auth.trigger", "auth.memberships", "auth.collections", "auth.doc", "auth.db", "auth.configVar"];
1513
+ /** The SDK helpers that build an `authorize`, as the manifest names them. */
1514
+ export declare const AUTHORIZE_HELPERS: readonly ["allowAnyone", "allowCallers", "requireSignedIn", "requireRole", "requireMember", "requireCollectionRole", "requireDocumentOwner"];
1515
+ /** How many function keys an `allowCallers` block may list. */
1516
+ export declare const MAX_MANIFEST_CALLER_FUNCTIONS = 200;
1392
1517
  /** Bounds, so a manifest cannot be a way to store an unbounded blob. */
1393
1518
  export declare const MAX_MANIFEST_QUERIES = 200;
1394
1519
  export declare const MAX_MANIFEST_NAME_LENGTH = 120;
@@ -1439,6 +1564,35 @@ export interface ManifestQuery {
1439
1564
  /** True when a `$caller` binding scopes this registration. */
1440
1565
  callerScoped: boolean;
1441
1566
  }
1567
+ /** The doors an `allowCallers` admits, as collected (#4730). */
1568
+ export interface ManifestAuthorizeCallers {
1569
+ webhook: boolean;
1570
+ cron: boolean;
1571
+ manual: boolean;
1572
+ /** The parent function keys the `functions` arm names. */
1573
+ functions: string[];
1574
+ /** `true`, `false`, or `"rule"` when the arm is an authorize function. */
1575
+ agents: boolean | "rule";
1576
+ /** `"rule"` when a `users` arm is present, else false. */
1577
+ users: false | "rule";
1578
+ /**
1579
+ * #4803 — the db3 flush door. Optional: a manifest collected before the door
1580
+ * existed carries no key, and absent reads as closed.
1581
+ */
1582
+ db3?: boolean;
1583
+ }
1584
+ /** What a version's `authorize` admits, as collected (#4730). */
1585
+ export interface ManifestAuthorize {
1586
+ present: true;
1587
+ /** `allowAnyone()`, or an `allowCallers` whose users or agents rule is one. */
1588
+ public: boolean;
1589
+ /** The SDK helper that built the exported `authorize`, or null when hand-written. */
1590
+ helper: string | null;
1591
+ /** The doors, when the helper is `allowCallers`; else null. */
1592
+ callers: ManifestAuthorizeCallers | null;
1593
+ /** The `auth.*` families the authorize code reaches, sorted. */
1594
+ families: string[];
1595
+ }
1442
1596
  export interface FunctionManifest {
1443
1597
  schemaVersion: number;
1444
1598
  queries: ManifestQuery[];
@@ -1457,6 +1611,13 @@ export interface FunctionManifest {
1457
1611
  * empty `models` list does not.
1458
1612
  */
1459
1613
  dynamicModels: boolean;
1614
+ /**
1615
+ * Version 3 only: the families on which the scan met a write or send verb.
1616
+ * Absent on versions 1 and 2, which readers treat as `[]`.
1617
+ */
1618
+ writeFamilies?: string[];
1619
+ /** Version 3 only: the `authorize` block. Absent on 1 and 2 (read as null). */
1620
+ authorize?: ManifestAuthorize;
1460
1621
  }
1461
1622
  export interface ParsedManifest {
1462
1623
  ok: boolean;
@@ -1471,9 +1632,68 @@ export interface ParsedManifest {
1471
1632
  * and whether the author meant any of it are questions this cannot answer.
1472
1633
  */
1473
1634
  export declare function parseFunctionManifest(value: unknown): ParsedManifest;
1635
+ /**
1636
+ * Whether a top-level input schema is one the closed-schema default leaves
1637
+ * OPEN under its union exemption — #4730, criterion 9.
1638
+ *
1639
+ * The validator closes an object against the root's OWN `properties` only,
1640
+ * so a root whose `anyOf` or `oneOf` members declare `properties` of their
1641
+ * own would, closed, refuse the very keys its members declare. Such a root is
1642
+ * left open, and `config push` warns its author to say `additionalProperties`
1643
+ * explicitly. Shared by the server (`closedInputSchemaFor`) and the CLI's
1644
+ * push warning, so both sides read one rule.
1645
+ */
1646
+ export declare function inputSchemaRootLeftOpen(schema: unknown): boolean;
1647
+ /**
1648
+ * The schema a flagged version validates against — #4730, criterion 9.
1649
+ *
1650
+ * A top-level object schema that sets no `additionalProperties` reads as
1651
+ * closed: a shallow copy with `additionalProperties: false`. Every other
1652
+ * schema is answered as it is — an explicit `additionalProperties`, a
1653
+ * non-object root, an empty `{}`, and a root left open under
1654
+ * {@link inputSchemaRootLeftOpen}. Nested objects are not touched. Applied at
1655
+ * run time and never written to the header.
1656
+ */
1657
+ export declare function closedObjectSchema(schema: Record<string, unknown>): Record<string, unknown>;
1658
+ /**
1659
+ * `[function] public`, read from the authored TOML's `[function]` table —
1660
+ * #4730, criterion 13. Absent reads as false; anything but a boolean is
1661
+ * refused. Read by the CLI's preflight and by the server from the envelope's
1662
+ * TOML, never stored.
1663
+ */
1664
+ export declare function declaredPublicOf(functionTable: unknown): {
1665
+ ok: true;
1666
+ value: boolean;
1667
+ } | {
1668
+ ok: false;
1669
+ error: string;
1670
+ };
1671
+ /**
1672
+ * What makes a version write-capable for the public-writer lint — #4730: a
1673
+ * mutation registration, a family the manifest records a write or send verb
1674
+ * on, or a declared `integration:<key>`, high-blast or subject-grant
1675
+ * capability (#4909: a function anyone may invoke that names any member is
1676
+ * the same hazard). One phrase per reason, for the refusal to quote.
1677
+ */
1678
+ export declare function writeCapableReasons(manifest: FunctionManifest | null, capabilities: readonly string[]): string[];
1679
+ /**
1680
+ * The public-writer refusal — #4730, criterion 13: a version whose manifest
1681
+ * records `authorize.public` (an `allowAnyone()`, or an `allowCallers` arm
1682
+ * that is one) and that is write-capable needs `public = true` under
1683
+ * `[function]`. The sentence names the function, what makes it write-capable
1684
+ * and the fix; null when the push is fine. The CLI refuses at preflight and
1685
+ * the server at push, from this one rule.
1686
+ */
1687
+ export declare function publicWriterRefusal(input: {
1688
+ functionKey: string;
1689
+ manifest: FunctionManifest | null;
1690
+ capabilities: readonly string[];
1691
+ declaredPublic: boolean;
1692
+ }): string | null;
1474
1693
  /**
1475
1694
  * The runtime keys a `functions/<key>.toml` no longer decides anything with —
1476
- * #3482, project `server-functions` phase 4.
1695
+ * #3482 retired them, and #3188 (project `server-functions` phase 5) refuses
1696
+ * them.
1477
1697
  *
1478
1698
  * The sponsor settled it on 2026-09-15 (the intent, "Mode vocabulary?",
1479
1699
  * amended again): the config says NOTHING about how a function runs. A
@@ -1482,58 +1702,70 @@ export declare function parseFunctionManifest(value: unknown): ParsedManifest;
1482
1702
  * and a function that must not run under one runtime tests for it in code with
1483
1703
  * `assertRuntime`.
1484
1704
  *
1485
- * ── Why these keys are accepted, not refused ──────────────────────────────
1705
+ * ── Accepted through phase 4, refused from phase 5 ────────────────────────
1486
1706
  *
1487
- * Every tree pushed since #3454 that declares a cron trigger carries
1488
- * `mode = …` ON THE ENTRY, because `cron-trigger-mode-required` demanded it;
1489
- * plenty carry a top-level `mode` or the older `durable`. Removing the keys
1490
- * from the accepted set outright would refuse those trees with an unknown-key
1491
- * error one day after the platform insisted on them, which is the opposite of
1492
- * principle 5 inside a non-breaking phase.
1707
+ * Every tree pushed since #3454 that declares a cron trigger carried
1708
+ * `mode = …` ON THE ENTRY, because `cron-trigger-mode-required` demanded it,
1709
+ * so #3482 accepted the keys and warned rather than refusing them one day
1710
+ * after the platform insisted on them. Phase 5 is the declared breaking phase
1711
+ * that ends the grace: `mode`, `durable` and a cron entry's `mode` are refused
1712
+ * with one sentence per key, naming the key, saying the caller picks the
1713
+ * runtime, and saying to delete the line. `config pull` still strips them
1714
+ * (`stripRetiredFunctionKeys` in the CLI reads this scanner), so a tree pulled
1715
+ * from a version pushed before the retirement pushes again unchanged.
1493
1716
  *
1494
- * So through phase 4 they are ACCEPTED and IGNORED, with one warning per key
1495
- * naming it and the line to delete; from phase 5 (#3188) they are refused with
1496
- * the rest of the retirement matrix. The value is not validated — there is
1497
- * nothing left to validate it against, and refusing a bad value for a key
1498
- * nobody reads would be a refusal about spelling alone.
1717
+ * One rule id, one handler: `refusedFunctionKeys` is declared `preflight` on
1718
+ * the `function` surface and the CLI's push preflight runs it before the first
1719
+ * request. The value is not validated — the key's PRESENCE is the refusal.
1499
1720
  *
1500
- * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity). Both
1501
- * the CLI preflight (vendored by `cli/scripts/gen-config-surfaces.mjs`) and the
1502
- * admin config-version route read this one scanner, so the warning an author
1503
- * sees from `config push` is the sentence the API answers with.
1721
+ * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity). The
1722
+ * CLI preflight reaches this module through the vendored copy
1723
+ * (`cli/scripts/gen-config-surfaces.mjs`), so the sentence an author reads from
1724
+ * `config push` is the one this module writes.
1504
1725
  */
1505
1726
  /** The two `[function]` keys that no longer say anything (#3482). */
1506
1727
  export declare const RETIRED_FUNCTION_RUNTIME_KEYS: readonly ["mode", "durable"];
1507
1728
  export type RetiredFunctionRuntimeKey = (typeof RETIRED_FUNCTION_RUNTIME_KEYS)[number];
1508
- /** One ignored key met in a `[function]` table. */
1509
- export interface IgnoredFunctionKey {
1729
+ /**
1730
+ * The rule ids this module owns, declared on the `function` surface (#3374's
1731
+ * anchor). One id covers the three spellings: they are one rule — the config
1732
+ * does not choose the runtime — met in three places.
1733
+ */
1734
+ export declare const RETIRED_RUNTIME_KEY_RULE_IDS: readonly ["retired-runtime-key"];
1735
+ type RetiredRuntimeKeyRuleId = (typeof RETIRED_RUNTIME_KEY_RULE_IDS)[number];
1736
+ /** One retired key met in a `[function]` table. */
1737
+ export interface RetiredFunctionKey extends RuleRefusal<RetiredRuntimeKeyRuleId> {
1510
1738
  /**
1511
1739
  * Where it was: `mode`, `durable`, or `triggers.cron.<name>.mode`. Never
1512
1740
  * rendered on its own — a reader that wants to branch reads this, and every
1513
1741
  * printer reads `message`.
1514
1742
  */
1515
1743
  path: string;
1516
- /** The sentence the author is owed, with no file prefix (the caller adds it). */
1517
- message: string;
1518
1744
  }
1519
1745
  /**
1520
- * Every retired runtime key a `[function]` table still carries.
1521
- *
1522
- * Reads the table the way the author wrote it: the two top-level keys, and a
1523
- * `mode` on each `[[function.triggers.cron]]` entry. A cron entry's sentence
1524
- * says the extra thing its author needs to hear — that the schedule no longer
1525
- * chooses, because every fire starts a task run (#3334's runner branch is
1526
- * gone).
1746
+ * The pre-phase-5 name of a met key, kept for the CLI's pull strip, which only
1747
+ * needs `path`. Every key met is refused now.
1748
+ */
1749
+ export type IgnoredFunctionKey = RetiredFunctionKey;
1750
+ /**
1751
+ * Every retired runtime key the table carries, each as the refusal the author
1752
+ * reads. A cron entry's sentence says the extra thing its author needs to hear
1753
+ * — that the schedule no longer chooses, because every fire starts a task run.
1754
+ */
1755
+ export declare function refusedFunctionKeys(functionTable: unknown): RetiredFunctionKey[];
1756
+ /**
1757
+ * The same refusals, rendered for one file — the shape `config push` and
1758
+ * `config diff` print.
1527
1759
  *
1528
- * Order is the order an author reads their file in: the top-level keys first,
1529
- * then the cron entries in declaration order.
1760
+ * `label` is what the reader can act on: `functions/<key>.toml` from the CLI,
1761
+ * and the function's key from the API, which has no file to name.
1530
1762
  */
1531
- export declare function ignoredFunctionKeys(functionTable: unknown): IgnoredFunctionKey[];
1763
+ export declare function refusedFunctionKeyMessages(label: string, functionTable: unknown): string[];
1532
1764
  /**
1533
1765
  * The database types a `[function]` table's retired trigger block names —
1534
1766
  * #3483.
1535
1767
  *
1536
- * Beside `ignoredFunctionKeys` because it answers the same question about the
1768
+ * Beside `refusedFunctionKeys` because it answers the same question about the
1537
1769
  * same table, for the same reader: `config pull` writes a version's AUTHORED
1538
1770
  * bytes, and a version pushed before the removal carries the block. Without
1539
1771
  * this the pulled tree would be refused on its next push — a tree an author
@@ -1565,14 +1797,6 @@ export declare function retiredDatabaseTriggerTypes(functionTable: unknown): str
1565
1797
  * of them would call a block and the other would not cannot exist.
1566
1798
  */
1567
1799
  export declare function hasRetiredDatabaseTriggerBlock(functionTable: unknown): boolean;
1568
- /**
1569
- * The same scan, rendered for one file — the shape `config push` and
1570
- * `config diff` print and the admin route answers with.
1571
- *
1572
- * `label` is what the reader can act on: `functions/<key>.toml` from the CLI,
1573
- * and the function's key from the API, which has no file to name.
1574
- */
1575
- export declare function ignoredFunctionKeyWarnings(label: string, functionTable: unknown): string[];
1576
1800
  /**
1577
1801
  * The trigger blocks a function declares, derived from its authored TOML
1578
1802
  * (#3181, project `server-functions`, criterion 4).
@@ -1634,6 +1858,12 @@ export declare function ignoredFunctionKeyWarnings(label: string, functionTable:
1634
1858
  * as ignored by `ignoredFunctionKeys` in `function-retired-keys.ts`.
1635
1859
  */
1636
1860
  /** A function's single webhook trigger, normalized. */
1861
+ /**
1862
+ * The db3 type-name prefix the platform reserves for its own types (#4882,
1863
+ * project `agent-sessions-db3`): no app pushes, attaches or watches a type
1864
+ * whose name starts with it.
1865
+ */
1866
+ export declare const RESERVED_DB3_TYPE_PREFIX = "primitive:";
1637
1867
  export interface WebhookTriggerDeclaration {
1638
1868
  verificationScheme: string;
1639
1869
  signingSecret?: string;
@@ -1644,7 +1874,28 @@ export interface WebhookTriggerDeclaration {
1644
1874
  secretGracePeriodMs?: number;
1645
1875
  /** `[function.triggers.webhook.verification]` — the row's `config`. */
1646
1876
  verification?: Record<string, unknown>;
1877
+ /**
1878
+ * `[[function.triggers.webhook.handshakeRules]]` — a provider's setup
1879
+ * handshake (Slack `url_verification`, Discord PING, Microsoft Graph
1880
+ * `validationToken`, Meta `hub.challenge`), answered by the receiver after
1881
+ * verification and before the function runs (#3190).
1882
+ */
1883
+ handshakeRules?: WebhookHandshakeRuleDeclaration[];
1884
+ /** `allowedIpCidrs` — the sender addresses a delivery may come from (#3190). */
1885
+ allowedIpCidrs?: string[];
1647
1886
  }
1887
+ /** One handshake rule: a CEL `when` and the response it answers with. */
1888
+ export interface WebhookHandshakeRuleDeclaration {
1889
+ when: string;
1890
+ response: {
1891
+ status?: number;
1892
+ contentType?: string;
1893
+ body?: string;
1894
+ };
1895
+ }
1896
+ /** The most handshake rules and allowlist entries one webhook block may carry. */
1897
+ export declare const MAX_WEBHOOK_HANDSHAKE_RULES = 10;
1898
+ export declare const MAX_WEBHOOK_IP_CIDRS = 50;
1648
1899
  /** One `[[function.triggers.cron]]` entry, normalized. */
1649
1900
  export interface CronTriggerDeclaration {
1650
1901
  name: string;
@@ -1653,9 +1904,20 @@ export interface CronTriggerDeclaration {
1653
1904
  overlapPolicy?: string;
1654
1905
  rootInput?: unknown;
1655
1906
  }
1907
+ /** One `[[function.triggers.db3]]` entry, normalized (#4803). */
1908
+ export interface Db3TriggerDeclaration {
1909
+ /** The db3 type whose flushes start the function. */
1910
+ type: string;
1911
+ }
1656
1912
  export interface TriggerDeclaration {
1657
1913
  webhook: WebhookTriggerDeclaration | null;
1658
1914
  cron: CronTriggerDeclaration[];
1915
+ /**
1916
+ * `[[function.triggers.db3]]` — present only when the file declares at least
1917
+ * one entry, so a file written before the kind existed stores exactly the
1918
+ * JSON it stored before (#4803).
1919
+ */
1920
+ db3?: Db3TriggerDeclaration[];
1659
1921
  }
1660
1922
  export declare const EMPTY_TRIGGER_DECLARATION: TriggerDeclaration;
1661
1923
  /**
@@ -1667,13 +1929,19 @@ export declare const EMPTY_TRIGGER_DECLARATION: TriggerDeclaration;
1667
1929
  * remaining slots for the other 40+ objects the cap is sized for.
1668
1930
  */
1669
1931
  export declare const MAX_CRON_TRIGGERS_PER_FUNCTION = 10;
1932
+ /**
1933
+ * The most db3 types one function may watch — the cron cap's per-object
1934
+ * reasoning (#4803). The per-app ceiling is `MAX_DB3_TRIGGERS_PER_APP`, checked
1935
+ * at the push boundary.
1936
+ */
1937
+ export declare const MAX_DB3_TRIGGERS_PER_FUNCTION = 10;
1670
1938
  /**
1671
1939
  * The rule ids this module owns — one per refusal, declared on the `function`
1672
1940
  * surface (#3374). The union below closes `refuseTrigger`'s id parameter, so a
1673
1941
  * twenty-seventh refusal cannot compile without a twenty-seventh id, and that
1674
1942
  * id fails `cli-unit-tests` until the surface declares it (#3373's anchor).
1675
1943
  */
1676
- export declare const TRIGGER_RULE_IDS: readonly ["triggers-table", "trigger-kind", "database-trigger-removed", "webhook-trigger-single", "webhook-trigger-table", "webhook-trigger-keys", "webhook-trigger-scheme-required", "webhook-trigger-scheme-none", "webhook-trigger-number", "webhook-trigger-dedup-boolean", "webhook-trigger-verification-table", "cron-trigger-cap", "cron-trigger-entry", "cron-trigger-keys", "cron-trigger-name-required", "cron-trigger-name-charset", "cron-trigger-duplicate", "cron-trigger-expression-required", "cron-trigger-overlap-policy"];
1944
+ export declare const TRIGGER_RULE_IDS: readonly ["triggers-table", "trigger-kind", "database-trigger-removed", "webhook-trigger-single", "webhook-trigger-table", "webhook-trigger-keys", "webhook-trigger-scheme-required", "webhook-trigger-scheme-none", "webhook-trigger-number", "webhook-trigger-dedup-boolean", "webhook-trigger-verification-table", "webhook-trigger-handshake-rules", "webhook-trigger-ip-allowlist", "cron-trigger-cap", "cron-trigger-entry", "cron-trigger-keys", "cron-trigger-name-required", "cron-trigger-name-charset", "cron-trigger-duplicate", "cron-trigger-expression-required", "cron-trigger-overlap-policy", "db3-trigger-cap", "db3-trigger-entry", "db3-trigger-keys", "db3-trigger-type-required", "db3-trigger-type-reserved", "db3-trigger-duplicate"];
1677
1945
  export type TriggerRuleId = (typeof TRIGGER_RULE_IDS)[number];
1678
1946
  /**
1679
1947
  * A broken trigger rule. `ruleId` names which one, for a reader that wants to
@@ -1714,6 +1982,18 @@ export declare function storedDatabaseTriggerTypes(stored: unknown): string[];
1714
1982
  export declare function cronTriggerKeyFor(functionKey: string, name: string): string;
1715
1983
  /** The entry name a `<functionKey>:<name>` trigger key carries. */
1716
1984
  export declare function cronTriggerNameFrom(functionKey: string, triggerKey: string): string;
1985
+ /**
1986
+ * The `ServerFunctionTrigger.triggerKey` a db3 entry owns (#4803):
1987
+ * `<functionKey>:db3:<type>`. A cron name cannot hold `:`, so the key never
1988
+ * collides with a cron entry's `<functionKey>:<name>`.
1989
+ */
1990
+ export declare function db3TriggerKeyFor(functionKey: string, type: string): string;
1991
+ /**
1992
+ * The type a db3 trigger key carries, or null when the key is not this
1993
+ * function's db3 key. Read by stripping the prefix, never by splitting: a type
1994
+ * name may hold `:` and `/`.
1995
+ */
1996
+ export declare function db3TriggerTypeFrom(functionKey: string, triggerKey: string): string | null;
1717
1997
  /**
1718
1998
  * The `{{secrets.KEY}}` reference SHAPE, decided from the value alone.
1719
1999
  *
@@ -1916,53 +2196,6 @@ export declare function validateSigningSecretDeclaration(input: {
1916
2196
  verificationScheme: string;
1917
2197
  signingSecret?: unknown;
1918
2198
  }): SigningSecretRuleError | null;
1919
- /**
1920
- * The workflow rules two runners share (#3374, project `cli-server-rule-parity`
1921
- * phase 2; intent §Success criteria 3).
1922
- *
1923
- * ── One predicate, two messages ──────────────────────────────────────────
1924
- *
1925
- * `runAs = "system"` beside a non-empty `accessRule` is dead config: a system
1926
- * run can only be started by the system and never evaluates its access rule
1927
- * (#1258, broadening #1172). The server refused it at save time
1928
- * (`validateWorkflowIdentityConfig`) and the CLI refused it in the push
1929
- * preflight (`validateWorkflowIdentity`), and the two carried the conjunction
1930
- * byte-for-byte as separate copies kept in step by a comment. This module is
1931
- * the one copy: it decides, and returns a STRUCTURED violation — the rule id
1932
- * and the server's sentence — that each site renders in its own words. The
1933
- * server pushes the sentence into its `string[]`; the CLI keeps its own hint,
1934
- * which names the preflight remedy. Neither message changed.
1935
- *
1936
- * ── Why a `*-rules.ts` module ────────────────────────────────────────────
1937
- *
1938
- * The registry's unclaimed-export check (`findUnclaimedRuleModuleExports`)
1939
- * keys on this name under `src/config-surface/`: every exported function here
1940
- * is a rule, so one no surface declares fails `cli-unit-tests`. Shared
1941
- * predicates that are not rules live elsewhere (`webhook-signing-secret.ts`).
1942
- * The module is vendored into the CLI artifact like the rest of the
1943
- * directory, which is what lets `workflow`'s declaration call the rule
1944
- * `preflight`.
1945
- */
1946
- /** The rule ids this module owns — the union type below anchors them (#3373). */
1947
- export declare const WORKFLOW_RULE_IDS: readonly ["system-access-rule"];
1948
- type WorkflowRuleId = (typeof WORKFLOW_RULE_IDS)[number];
1949
- /** A violation of one of this module's rules, for a site to render. */
1950
- export interface WorkflowRuleViolation extends RuleRefusal<WorkflowRuleId> {
1951
- }
1952
- /**
1953
- * `runAs = "system"` with a non-empty string `accessRule`, or null.
1954
- *
1955
- * Exactly the conjunction both sites carried: a default, unset, empty or
1956
- * whitespace-only rule is no rule, and a non-string one (`accessRule = false`)
1957
- * is malformed input for another check to name, not dead config. The message
1958
- * is the server's save-time sentence; the CLI renders its own hint from the
1959
- * same answer.
1960
- */
1961
- export declare function checkWorkflowSystemAccessRule(input: {
1962
- runAs?: unknown;
1963
- accessRule?: unknown;
1964
- }): WorkflowRuleViolation | null;
1965
- export declare const WORKFLOW_SURFACE: ConfigObjectSurface;
1966
2199
  /**
1967
2200
  * Cron-expression and timezone VALIDITY — the half of `src/cron-parser.ts`
1968
2201
  * both runners need (#3376, project `cli-server-rule-parity` phase 4).
@@ -2074,15 +2307,6 @@ export declare function isValidTimezone(name: unknown): boolean;
2074
2307
  * pins. So the grammar and the `Intl` probe live next door in
2075
2308
  * `cron-expression.ts`, which is a shared-predicate module rather than a rules
2076
2309
  * module, and this one only decides and renders.
2077
- *
2078
- * ── What is NOT shared ───────────────────────────────────────────────────
2079
- *
2080
- * The standalone cron routes ask the same two predicates and render their own
2081
- * `Invalid cron expression: …` / `Invalid timezone: …`, with their own
2082
- * defaulting (create reads an absent timezone as UTC, update does not). That
2083
- * is intent assumption 2 in the form its own fallback describes, and the shape
2084
- * `workflow-rules.ts` set in phase 2: one predicate, each site's message and
2085
- * defaulting preserved. No refusal message changed anywhere.
2086
2310
  */
2087
2311
  /** The rule ids this module owns — the union type below anchors them (#3373). */
2088
2312
  export declare const CRON_TRIGGER_RULE_IDS: readonly ["cron-trigger-expression", "cron-trigger-timezone"];
@@ -2120,7 +2344,12 @@ export declare function checkCronTriggerEntry(entry: {
2120
2344
  * all read this one copy, so a refusal at push and a refusal at execution
2121
2345
  * cannot disagree.
2122
2346
  *
2123
- * Provider facts this encodes:
2347
+ * What this encodes is each provider's SPELLING, per model family — never
2348
+ * which values a particular model accepts (#4147). A value the spelling can
2349
+ * carry is sent, and a model that does not support it is refused by the
2350
+ * provider, whose answer the run reports. A per-model table of accepted levels
2351
+ * and floors went stale with each model release and refused or admitted the
2352
+ * wrong values.
2124
2353
  *
2125
2354
  * - OpenRouter takes a unified `reasoning` block: `{ effort }`,
2126
2355
  * `{ max_tokens }`, or `{ enabled: false }` to decline it. `max_tokens` is an
@@ -2133,20 +2362,18 @@ export declare function checkCronTriggerEntry(entry: {
2133
2362
  * is refused by OpenRouter and surfaces as a failed execution rather than a
2134
2363
  * silent drop.
2135
2364
  * - Gemini 3.x expresses thinking as a LEVEL
2136
- * (`thinkingConfig.thinkingLevel`) and cannot turn it off; `thinkingBudget`
2137
- * is accepted there only for backward compatibility and is translated to a
2138
- * level rather than honored as a bound, so a numeric budget is refused with
2139
- * a pointer at `reasoningEffort`.
2365
+ * (`thinkingConfig.thinkingLevel`), and the level spelling has no "off"
2366
+ * value, so `none` has nothing to translate to. `thinkingBudget` is accepted
2367
+ * there only for backward compatibility and is translated to a level rather
2368
+ * than honored as a bound, so a numeric budget is refused with a pointer at
2369
+ * `reasoningEffort`.
2140
2370
  * - Gemini 2.5 expresses it as a numeric BUDGET
2141
- * (`thinkingConfig.thinkingBudget`); `0` turns thinking off on Flash and
2142
- * Flash-Lite, while Pro has a floor of 128 and answers 400 for less.
2371
+ * (`thinkingConfig.thinkingBudget`); `none` is a budget of `0`.
2143
2372
  * - Gemini 2.0 and earlier have no thinking control at all.
2144
2373
  */
2145
2374
  /** The provider-neutral effort levels a config may state. */
2146
2375
  export declare const REASONING_EFFORTS: readonly ["none", "minimal", "low", "medium", "high"];
2147
2376
  export type ReasoningEffort = (typeof REASONING_EFFORTS)[number];
2148
- /** The smallest budget Gemini 2.5 Pro accepts; it cannot stop thinking. */
2149
- export declare const GEMINI_PRO_MIN_THINKING_BUDGET = 128;
2150
2377
  export interface PromptReasoningInput {
2151
2378
  provider?: string | null;
2152
2379
  model?: string | null;
@@ -2178,14 +2405,12 @@ export type PromptReasoningResolution = {
2178
2405
  /**
2179
2406
  * How a Gemini model spells its thinking control.
2180
2407
  *
2181
- * `level` — Gemini 3.x, `thinkingLevel`, cannot be turned off.
2408
+ * `level` — Gemini 3.x, `thinkingLevel`, which has no "off" value.
2182
2409
  * `budget` — Gemini 2.5, `thinkingBudget` in tokens.
2183
2410
  * `none` — Gemini 2.0 and earlier, no control at all.
2184
2411
  */
2185
2412
  export type GeminiReasoningFamily = "level" | "budget" | "none";
2186
2413
  export declare function geminiReasoningFamily(model: string): GeminiReasoningFamily;
2187
- /** Gemini Pro: the tier that cannot stop thinking in either family. */
2188
- export declare function isGeminiProModel(model: string): boolean;
2189
2414
  /** Is EITHER reasoning key stated on this config? */
2190
2415
  export declare function hasPromptReasoning(input: PromptReasoningInput): boolean;
2191
2416
  /**
@@ -2228,17 +2453,11 @@ export declare function resolvePromptReasoning(input: PromptReasoningInput): Pro
2228
2453
  */
2229
2454
  export declare const PROMPT_KINDS: readonly ["chat", "decisions", "agent"];
2230
2455
  export type PromptKind = (typeof PROMPT_KINDS)[number];
2231
- /**
2232
- * The nine chat settings that existed before `[configs.chat]` did. Only these
2233
- * keep the deprecated FLAT spelling (#3642): a key added to the block later was
2234
- * never written flat by any file, so it has none (the `questions` posture,
2235
- * SO3626-013).
2236
- */
2237
- export declare const LEGACY_FLAT_CHAT_KEYS: readonly ["systemPrompt", "userPromptTemplate", "temperature", "topP", "maxTokens", "outputFormat", "outputSchema", "reasoningEffort", "reasoningBudget"];
2238
2456
  /**
2239
2457
  * The settings that describe a CHAT COMPLETION and nothing else. They are
2240
- * authored under `[configs.chat]`; the flat spelling of the nine legacy keys
2241
- * is deprecated (#3642).
2458
+ * authored under `[configs.chat]` and only there: the pre-#3626 flat spelling
2459
+ * of the first nine is retired and refused at push (#3642,
2460
+ * `RETIRED_TOML_SPELLINGS`).
2242
2461
  *
2243
2462
  * #3801 — `strictOutput`, the opt-in that sends `[prompt].outputSchema` as a
2244
2463
  * strict `json_schema` on OpenRouter (`prompt-strict-output.ts`). Not an agent
@@ -2368,29 +2587,6 @@ export type DecisionsRunQuestionsResolution = {
2368
2587
  * Pure: the stored questions object is never mutated.
2369
2588
  */
2370
2589
  export declare function resolveDecisionsRunQuestions(questions: Record<string, unknown>, runCriteria: unknown): DecisionsRunQuestionsResolution;
2371
- /** What the hoist did to one `[[configs]]` entry. */
2372
- export interface DeprecatedChatKeyHoist {
2373
- /** A COPY of the entry with the flat chat keys moved under `chat`. */
2374
- entry: Record<string, unknown>;
2375
- /** The flat keys that were moved, sorted — what the warning names. */
2376
- moved: string[];
2377
- /** Keys set BOTH flat and under `[configs.chat]`; the caller refuses these. */
2378
- conflicts: string[];
2379
- }
2380
- /**
2381
- * Move the deprecated flat chat keys of one `[[configs]]` entry under `chat`
2382
- * — #3626 §4, the deprecated-TOML-key pattern blob buckets used until #3996
2383
- * retired theirs, made reusable.
2384
- *
2385
- * Push keeps accepting the nine keys flat so no existing file breaks, and pull
2386
- * rewrites them, so one pull-then-push migrates a file. A key present in BOTH
2387
- * spellings is not merged: the grouped value is left standing and the key is
2388
- * reported in `conflicts`, which the caller turns into a refusal naming the
2389
- * entry. Nothing else in the entry is touched — `providerConfig` is
2390
- * provider-keyed rather than chat-keyed (D3626-002) and `questions` has no flat
2391
- * spelling at all (SO3626-013).
2392
- */
2393
- export declare function hoistDeprecatedChatKeys(entry: unknown): DeprecatedChatKeyHoist;
2394
2590
  /**
2395
2591
  * Strict output for a chat config — issue #3801 (project `agents`, §D6).
2396
2592
  *
@@ -2504,7 +2700,7 @@ export declare function resolvePromptStrictOutput(input: PromptStrictOutputInput
2504
2700
  * Pure and dependency-free, like every module under `src/config-surface/`.
2505
2701
  */
2506
2702
  /** The stable codes every agent agentRefusal this project adds carries. */
2507
- export declare const AGENT_ERROR_CODES: readonly ["AGENT_DECLARATION_INVALID", "AGENT_TOOL_FUNCTION_MISSING", "AGENT_TOOL_FUNCTION_SCHEMA_MISSING", "AGENT_OUTPUT_SCHEMA_NOT_ALLOWED", "AGENT_CONFIG_KEY_NOT_ALLOWED", "AGENT_NOT_RUNNABLE", "AGENT_TEST_CASE_NOT_SUPPORTED", "AGENT_SCHEMA_NOT_TRANSLATABLE", "AGENT_MODEL_UNKNOWN", "AGENT_MODEL_CAPABILITY_MISSING", "AGENT_MODEL_CAPABILITIES_UNAVAILABLE", "AGENT_ROUND_NOT_AGENT", "AGENT_ROUND_INPUT_INVALID", "AGENT_TOOL_UNKNOWN", "AGENT_TOOL_ARGUMENTS_INVALID", "AGENT_ROUND_TRUNCATED", "AGENT_ROUND_EMPTY"];
2703
+ export declare const AGENT_ERROR_CODES: readonly ["AGENT_DECLARATION_INVALID", "AGENT_TOOL_FUNCTION_MISSING", "AGENT_TOOL_FUNCTION_SCHEMA_MISSING", "AGENT_OUTPUT_SCHEMA_NOT_ALLOWED", "AGENT_CONFIG_KEY_NOT_ALLOWED", "AGENT_NOT_RUNNABLE", "AGENT_TEST_CASE_NOT_SUPPORTED", "AGENT_SCHEMA_NOT_TRANSLATABLE", "AGENT_MODEL_UNKNOWN", "AGENT_MODEL_CAPABILITY_MISSING", "AGENT_MODEL_CAPABILITIES_UNAVAILABLE", "AGENT_ROUND_NOT_AGENT", "AGENT_ROUND_INPUT_INVALID", "AGENT_TOOL_UNKNOWN", "AGENT_TOOL_ARGUMENTS_INVALID", "AGENT_ROUND_TRUNCATED", "AGENT_ROUND_EMPTY", "AGENT_TEST_CASE_INVALID", "AGENT_PRESENTATION_REFERENCE_INVALID"];
2508
2704
  export type AgentErrorCode = (typeof AGENT_ERROR_CODES)[number];
2509
2705
  /** One agentRefusal: the code a client branches on, and the sentence a person reads. */
2510
2706
  export interface AgentRefusal {
@@ -2512,16 +2708,20 @@ export interface AgentRefusal {
2512
2708
  message: string;
2513
2709
  }
2514
2710
  /**
2515
- * The platform maximums. An agent may lower `maxSteps` and `waitLimitSeconds`,
2516
- * never raise them; the tool and event counts bound what one declaration can
2517
- * make every turn carry (principle 2).
2711
+ * The platform maximums. An agent may lower `maxSteps`, `waitLimitSeconds`
2712
+ * and `maxRowBytes`, never raise them; the tool and event counts bound what
2713
+ * one declaration can make every turn carry (principle 2).
2518
2714
  */
2519
2715
  export declare const AGENT_LIMITS: {
2520
2716
  readonly maxSteps: 25;
2521
2717
  readonly waitLimitSeconds: 604800;
2718
+ /** The JSON bytes of one session-document row a turn writes from model or tool output. */
2719
+ readonly maxRowBytes: 262144;
2522
2720
  readonly tools: 64;
2523
2721
  readonly events: 64;
2524
2722
  };
2723
+ /** The smallest row ceiling an agent may declare: room for a call's own columns. */
2724
+ export declare const AGENT_ROW_BYTES_FLOOR = 1024;
2525
2725
  /**
2526
2726
  * A tool or event name: the intersection of OpenRouter's and Gemini's
2527
2727
  * function-name rules, so one declaration maps onto either provider.
@@ -2530,9 +2730,16 @@ export declare const AGENT_NAME: RegExp;
2530
2730
  export declare const AGENT_ANSWERED_BY: readonly ["initiator", "participants"];
2531
2731
  export declare const AGENT_TOOL_INVOKE: readonly ["request", "task"];
2532
2732
  export declare const AGENT_TOOL_HISTORY_SCOPES: readonly ["session", "turn"];
2733
+ /**
2734
+ * Where a tool without a `function` runs: `client` is answered by a member's
2735
+ * client; `presentation` is data the model hands the client with its final
2736
+ * answer, which no client executes (#4549).
2737
+ */
2738
+ export declare const AGENT_TOOL_RUNS: readonly ["client", "presentation"];
2533
2739
  export type AgentAnsweredBy = (typeof AGENT_ANSWERED_BY)[number];
2534
2740
  export type AgentToolInvoke = (typeof AGENT_TOOL_INVOKE)[number];
2535
2741
  export type AgentToolHistoryScope = (typeof AGENT_TOOL_HISTORY_SCOPES)[number];
2742
+ export type AgentToolRuns = (typeof AGENT_TOOL_RUNS)[number];
2536
2743
  /** A JSON Schema object, as the declaration holds one. */
2537
2744
  export type AgentSchema = Record<string, unknown>;
2538
2745
  /** One `[[prompt.agent.tools]]` entry, as authored. */
@@ -2542,13 +2749,28 @@ export interface AgentToolDeclaration {
2542
2749
  /** A server tool: the function whose schemas are the tool's. */
2543
2750
  function?: string;
2544
2751
  invoke?: AgentToolInvoke;
2545
- /** A client tool: answered by a member's client, schemas in the TOML. */
2546
- runs?: "client";
2752
+ /**
2753
+ * `client`: answered by a member's client, schemas in the TOML.
2754
+ * `presentation`: data the model hands the client with its final answer;
2755
+ * its call ends the turn and is never answered.
2756
+ */
2757
+ runs?: AgentToolRuns;
2758
+ /**
2759
+ * A presentation's input properties whose integers name earlier calls of
2760
+ * the turn by the number the platform gave them (`callNumber`).
2761
+ */
2762
+ references?: string[];
2547
2763
  inputSchema?: AgentSchema;
2548
2764
  outputSchema?: AgentSchema;
2549
2765
  approval?: boolean;
2550
2766
  statusText?: string;
2551
2767
  historyScope?: AgentToolHistoryScope;
2768
+ /**
2769
+ * A call to this server tool ends the turn: once every call of its response
2770
+ * is final, the turn settles with no further model round. A presentation
2771
+ * always does.
2772
+ */
2773
+ endsTurn?: boolean;
2552
2774
  }
2553
2775
  /** One `[[prompt.agent.events]]` entry. */
2554
2776
  export interface AgentEventDeclaration {
@@ -2560,6 +2782,7 @@ export interface AgentDeclaration {
2560
2782
  answeredBy?: AgentAnsweredBy;
2561
2783
  maxSteps?: number;
2562
2784
  waitLimitSeconds?: number;
2785
+ maxRowBytes?: number;
2563
2786
  turnContext?: {
2564
2787
  schema: AgentSchema;
2565
2788
  function?: string;
@@ -2575,12 +2798,24 @@ export interface AgentDeclaration {
2575
2798
  export type NormalizedAgentTool = AgentToolDeclaration & {
2576
2799
  approval: boolean;
2577
2800
  historyScope: AgentToolHistoryScope;
2801
+ endsTurn: boolean;
2578
2802
  };
2803
+ /**
2804
+ * The result the platform records for a presentation call: the call is final
2805
+ * when its response is committed, and later rounds read this as its tool
2806
+ * result.
2807
+ */
2808
+ export declare const AGENT_TERMINAL_CALL_OUTPUT: {
2809
+ delivered: true;
2810
+ };
2811
+ /** The schema of `AGENT_TERMINAL_CALL_OUTPUT`, the result a presentation call is recorded with. */
2812
+ export declare const AGENT_TERMINAL_CALL_OUTPUT_SCHEMA: AgentSchema;
2579
2813
  /** The declaration with every default applied — what readers consume. */
2580
2814
  export interface NormalizedAgentDeclaration {
2581
2815
  answeredBy: AgentAnsweredBy;
2582
2816
  maxSteps: number;
2583
2817
  waitLimitSeconds: number;
2818
+ maxRowBytes: number;
2584
2819
  turnContext: {
2585
2820
  schema: AgentSchema;
2586
2821
  function?: string;
@@ -2638,6 +2873,18 @@ export type AgentDeclarationResolution = {
2638
2873
  * the block the author wrote.
2639
2874
  */
2640
2875
  export declare const AGENT_BLOCK_LABEL = "[prompt.agent]";
2876
+ /**
2877
+ * One place a declaration names a server function: the key, the tool's name
2878
+ * for a tool, the path that makes the reference, and whether the reference
2879
+ * needs the function's schemas (a tool's are its function's; a turn-context or
2880
+ * history hook only needs the function to exist).
2881
+ */
2882
+ export interface AgentFunctionReference {
2883
+ key: string;
2884
+ tool?: string;
2885
+ path: string;
2886
+ needsSchemas: boolean;
2887
+ }
2641
2888
  /**
2642
2889
  * The function keys a declaration references (tools, turn context, history),
2643
2890
  * each once, in declaration order. What a caller resolves into the
@@ -2655,6 +2902,39 @@ export declare const AGENT_BLOCK_LABEL = "[prompt.agent]";
2655
2902
  */
2656
2903
  export declare function parseAgentDeclarationBlock(agent: unknown): Record<string, unknown> | undefined;
2657
2904
  export declare function agentDeclarationFunctionKeys(agent: unknown): string[];
2905
+ /**
2906
+ * Every function reference of a declaration (tools, turn context, history), in
2907
+ * declaration order, with the path that makes it. `[]` for a block that is
2908
+ * absent or does not parse. A declaration written as one JSON string is read
2909
+ * as the object it encodes.
2910
+ */
2911
+ export declare function agentDeclarationFunctionReferences(agent: unknown): AgentFunctionReference[];
2912
+ /**
2913
+ * What a reference lacks: the function itself, or one of a tool's two schemas.
2914
+ * One deficit per (reference, kind), so a comparison of two states can tell a
2915
+ * schema restored from a schema removed without reading message text.
2916
+ */
2917
+ export type AgentFunctionDeficitKind = "absent" | "inputSchemaMissing" | "outputSchemaMissing";
2918
+ /** One thing a function reference of a declaration lacks. */
2919
+ export interface AgentFunctionDeficit {
2920
+ path: string;
2921
+ tool?: string;
2922
+ key: string;
2923
+ kind: AgentFunctionDeficitKind;
2924
+ }
2925
+ /**
2926
+ * Every deficit of a declaration's function references against `functions`:
2927
+ * an absent function (`null`, or missing from the map), and for a tool a
2928
+ * missing `inputSchema` and a missing `outputSchema`, each on its own. `[]` for
2929
+ * a block that is absent or does not parse.
2930
+ */
2931
+ export declare function agentFunctionDeficits(agent: unknown, functions: AgentFunctionFacts): AgentFunctionDeficit[];
2932
+ /**
2933
+ * The refusals for a list of deficits: one `AGENT_TOOL_FUNCTION_MISSING` per
2934
+ * absent reference, and one `AGENT_TOOL_FUNCTION_SCHEMA_MISSING` per tool
2935
+ * reference naming every schema it lacks.
2936
+ */
2937
+ export declare function agentFunctionDeficitRefusals(deficits: readonly AgentFunctionDeficit[]): AgentRefusal[];
2658
2938
  /**
2659
2939
  * The one rule: is this `[prompt.agent]` declaration (with the prompt's kind
2660
2940
  * and `outputSchema`) something the platform can run?
@@ -2678,16 +2958,37 @@ export declare function agentNotRunnableRefusal(promptKey?: string): AgentRefusa
2678
2958
  */
2679
2959
  export declare function agentRoundNotAgentRefusal(promptKey: string): AgentRefusal;
2680
2960
  /**
2681
- * The refusal of a prompt test case that involves an agent (§D1: prompt test
2682
- * cases are refused for the kind in v1; multi-turn tests are deferred).
2683
- * `subject` is a case written ON the agent, `evaluator` a case that names the
2684
- * agent as its judge.
2961
+ * The refusal of a prompt test case that names an agent as its judge (§D1: an
2962
+ * evaluator runs single-shot, which an agent never does). A case written ON an
2963
+ * agent is a single-round test since #4262 (`agent-test-case.ts`), so
2964
+ * `evaluator` is the one role left.
2965
+ */
2966
+ export declare function agentTestCaseRefusal(promptKey: string, _role?: "evaluator"): AgentRefusal;
2967
+ /** An earlier call of the turn, as a presentation's references are checked against it. */
2968
+ export interface AgentReferencedCall {
2969
+ /** The number the platform gave the call in its turn (1 for the turn's first). */
2970
+ callNumber: number;
2971
+ toolName: string;
2972
+ /** The call's row state; only `output-available` may be referenced. */
2973
+ state: string;
2974
+ }
2975
+ /**
2976
+ * The refusal of a presentation call whose `references` name a number that
2977
+ * is not an earlier call of the turn with a result — a refused call, a number
2978
+ * the turn never gave, or a call of the same response — or `null`. `earlier`
2979
+ * is the turn's calls committed before this call's response. The message
2980
+ * lists the offending values by property and the numbers that may be
2981
+ * referenced, with their tools, so the model can correct itself next round.
2685
2982
  */
2686
- export declare function agentTestCaseRefusal(promptKey: string, role: "subject" | "evaluator"): AgentRefusal;
2983
+ export declare function presentationReferenceRefusal(tool: {
2984
+ name: string;
2985
+ references?: readonly string[];
2986
+ }, args: unknown, earlier: readonly AgentReferencedCall[]): AgentRefusal | null;
2687
2987
  /**
2688
2988
  * The declaration with every default applied: `answeredBy = "initiator"`, the
2689
2989
  * platform maximums for the limits, and per tool `invoke = "request"` (server
2690
- * tools), `approval = false` and `historyScope = "session"`.
2990
+ * tools), `approval = false`, `historyScope = "session"` and `endsTurn = false`
2991
+ * — `endsTurn = true` for a presentation, whose call always ends the turn.
2691
2992
  *
2692
2993
  * The ONLY accessor for defaults — the stored value never carries them
2693
2994
  * (DSO-3798-001). Takes a value `resolveAgentDeclaration` accepted (or `null`)
@@ -2723,7 +3024,7 @@ export declare function normalizeAgentDeclaration(declaration: AgentDeclaration
2723
3024
  * the structured error the model sees, and a model following `properties` is
2724
3025
  * never told it may add keys. Refusing it instead would put the platform's own
2725
3026
  * closed-object marker — `additionalProperties: false` is how
2726
- * `src/workflows/schema-descriptor.ts` spells a closed object — outside
3027
+ * `src/function-runs/schema-descriptor.ts` spells a closed object — outside
2727
3028
  * Gemini's reach.
2728
3029
  *
2729
3030
  * The TRANSLATED schema is what the provider is sent; the ORIGINAL is what the
@@ -2815,10 +3116,214 @@ export interface AgentSchemaTranslationInput {
2815
3116
  * A declaration with no tools and no events reads no function schema at all.
2816
3117
  */
2817
3118
  export declare function agentSchemaTranslationRefusals(input: AgentSchemaTranslationInput): AgentRefusal[];
3119
+ /**
3120
+ * One schema an agent's model reads that a provider of a non-archived config
3121
+ * cannot carry — or, for a server tool, a function schema that does not parse.
3122
+ * The structured half of `agentSchemaTranslationRefusals`: its identity is
3123
+ * (`subject`, `which`, `provider`, `schemaPath`, `keyword`), or (`subject`,
3124
+ * `which`, `unparsable`), so two states can be compared without reading
3125
+ * message text.
3126
+ */
3127
+ export type AgentSchemaDeficit = {
3128
+ /** `tool "propose"`, `tool "lookup" (function "ledger")` or `event "applied"`. */
3129
+ subject: string;
3130
+ /** `inputSchema`, `outputSchema` or `schema`. */
3131
+ which: string;
3132
+ provider: string;
3133
+ /** The non-archived configs on `provider`. */
3134
+ configNames: string[];
3135
+ /** The dotted path from the schema root; `""` is the root. */
3136
+ schemaPath: string;
3137
+ keyword: string;
3138
+ reason: string;
3139
+ } | {
3140
+ subject: string;
3141
+ which: string;
3142
+ /** The function whose stored schema does not parse. */
3143
+ unparsable: string;
3144
+ };
3145
+ /**
3146
+ * Every deficit `agentSchemaTranslationRefusals` reports, in the same order,
3147
+ * before it is rendered. One per (schema, path, keyword, provider), and one
3148
+ * per server-tool schema that does not parse.
3149
+ */
3150
+ export declare function agentSchemaTranslationDeficits(input: AgentSchemaTranslationInput): AgentSchemaDeficit[];
3151
+ /** The `AGENT_SCHEMA_NOT_TRANSLATABLE` refusal one deficit renders as. */
3152
+ export declare function agentSchemaDeficitRefusal(deficit: AgentSchemaDeficit): AgentRefusal;
3153
+ /**
3154
+ * A change to a server function that an agent uses — issue #4441.
3155
+ *
3156
+ * An agent names server functions as its tools, its turn-context hook and its
3157
+ * history hook. The agent's own writes are checked against those functions
3158
+ * (`resolveAgentDeclaration`, `agentSchemaTranslationRefusals`), but a change
3159
+ * to the FUNCTION — archiving it, deleting it, changing its schemas — used to
3160
+ * be accepted and fail at the agent's next turn. This module is the rule for
3161
+ * that change: given one agent's declaration and configs, and the functions it
3162
+ * names before and after the change, which refusals does the change introduce?
3163
+ *
3164
+ * The admin function routes refuse such a change with `FUNCTION_USED_BY_AGENT`,
3165
+ * and `config push`'s preflight runs the same rule through the vendored
3166
+ * artifact, so the two cannot disagree.
3167
+ *
3168
+ * ONLY WHAT THE CHANGE INTRODUCES. Both states are reduced to structured
3169
+ * deficits (`agentFunctionDeficits`, `agentSchemaTranslationDeficits`) and the
3170
+ * ones already present before the change are dropped. An agent that is broken
3171
+ * for another reason does not block an unrelated change, and a partial repair
3172
+ * — restoring one of two missing schemas, removing one of two `$ref`s — is
3173
+ * accepted. Messages are rendered only afterwards, by the sibling rules' own
3174
+ * builders, so they read exactly as an agent write's refusals do.
3175
+ *
3176
+ * Pure and dependency-free, like every module under `src/config-surface/`.
3177
+ */
3178
+ /** The code a function route answers when an agent cannot take the change. */
3179
+ export declare const FUNCTION_USED_BY_AGENT = "FUNCTION_USED_BY_AGENT";
3180
+ /** One agent, and the functions it names before and after a change to them. */
3181
+ export interface AgentFunctionChangeInput {
3182
+ /** `[prompt.agent]` as stored: a table, or one JSON string encoding one. */
3183
+ declaration: unknown;
3184
+ /** Every config of the agent's prompt. Archived ones are skipped. */
3185
+ configs: ReadonlyArray<AgentSchemaConfigFact>;
3186
+ /** What the app holds for each function the declaration names, now. */
3187
+ before: AgentFunctionFacts;
3188
+ /** The same, as the change would leave it. */
3189
+ after: AgentFunctionFacts;
3190
+ }
3191
+ /**
3192
+ * Every refusal the change introduces for this agent: a reference whose
3193
+ * function goes away (`AGENT_TOOL_FUNCTION_MISSING`), a tool schema that goes
3194
+ * away (`AGENT_TOOL_FUNCTION_SCHEMA_MISSING`), and a schema a non-archived
3195
+ * config's provider cannot carry where the previous one could
3196
+ * (`AGENT_SCHEMA_NOT_TRANSLATABLE`). `[]` when the agent can take the change,
3197
+ * and for a declaration that does not parse (it names nothing).
3198
+ */
3199
+ export declare function agentFunctionChangeRefusals(input: AgentFunctionChangeInput): AgentRefusal[];
3200
+ /**
3201
+ * How an agent uses one function: each tool's name (or its path when the tool
3202
+ * has none), and `turnContext.function` / `history.function` for a hook, in
3203
+ * declaration order. `[]` when the declaration does not name the function.
3204
+ */
3205
+ export declare function agentFunctionUses(declaration: unknown, functionKey: string): string[];
3206
+ /** What a function route was asked to do. */
3207
+ export type FunctionChangeKind = "archive" | "delete" | "schema";
3208
+ /** One agent a function change would break. */
3209
+ export interface FunctionUsedByAgent {
3210
+ promptKey: string;
3211
+ /** `agentFunctionUses` of the changed function. */
3212
+ tools: string[];
3213
+ /** The refusals the change introduces for this agent. */
3214
+ refusals: ReadonlyArray<AgentRefusal>;
3215
+ }
3216
+ /**
3217
+ * The sentence a function route refuses with: the function, then one sentence
3218
+ * per agent naming its key and each use, then the remedy. A schema change also
3219
+ * carries each agent's refusals, since the remedy depends on which schema broke.
3220
+ */
3221
+ export declare function functionUsedByAgentMessage(functionKey: string, change: FunctionChangeKind, agents: ReadonlyArray<FunctionUsedByAgent>): string;
3222
+ /**
3223
+ * What an agent test case may say — issue #4262 (single-round prompt tests
3224
+ * from a seeded history; design-docs/agents.md §D1).
3225
+ *
3226
+ * A test case on an agent prompt carries one `[test.agent]` block: a seeded
3227
+ * `history` (JSON text), the round's turn `context`, `timezone` and `locale`,
3228
+ * and two assertions on the round's calls (`expectedToolCall`,
3229
+ * `expectedNoToolCall`). On the wire and in storage those are six flat
3230
+ * `BlockTestCase` fields, `agentHistory` … `agentExpectedNoToolCall`.
3231
+ *
3232
+ * This module is the whole FILE-DECIDABLE rule for them: the history's shape,
3233
+ * its turns, its call and result pairing, where its events sit, the
3234
+ * assertions' shapes, and — when the caller passes the agent's declaration —
3235
+ * that the event kinds and the asserted tool are declared. The admin test-case
3236
+ * routes call it, and so does the CLI's push preflight through the vendored
3237
+ * artifact, so a refusal at push and a refusal at the route cannot disagree.
3238
+ * What needs app state or a schema validator (the input, context and event
3239
+ * schemas, the send route's zone and tag rules) is `agent-test-round.ts`'s.
3240
+ *
3241
+ * Every refusal carries `AGENT_TEST_CASE_INVALID` and the caller gets every
3242
+ * offending item at once, as the declaration resolver does.
3243
+ *
3244
+ * Pure and dependency-free apart from the agent declaration's types, like
3245
+ * every module under `src/config-surface/`.
3246
+ */
3247
+ /** The six wire and stored fields, in the order the surface declares them. */
3248
+ export declare const AGENT_TEST_CASE_FIELDS: readonly ["agentHistory", "agentContext", "agentTimezone", "agentLocale", "agentExpectedToolCall", "agentExpectedNoToolCall"];
3249
+ export type AgentTestCaseField = (typeof AGENT_TEST_CASE_FIELDS)[number];
3250
+ /** One call of a seeded assistant entry. */
3251
+ export interface AgentTestCall {
3252
+ callId: string;
3253
+ name: string;
3254
+ arguments: unknown;
3255
+ }
3256
+ /** One entry of a seeded history, oldest first. */
3257
+ export type AgentTestHistoryEntry = {
3258
+ role: "user";
3259
+ text: string;
3260
+ } | {
3261
+ role: "assistant";
3262
+ text?: string;
3263
+ reasoning?: string;
3264
+ calls?: AgentTestCall[];
3265
+ } | {
3266
+ role: "tool";
3267
+ callId: string;
3268
+ output: unknown;
3269
+ } | {
3270
+ role: "tool";
3271
+ callId: string;
3272
+ error: {
3273
+ code: string;
3274
+ message: string;
3275
+ };
3276
+ } | {
3277
+ role: "event";
3278
+ kind: string;
3279
+ refersTo?: string;
3280
+ data: unknown;
3281
+ };
3282
+ /** The `[test.agent]` block, read. */
3283
+ export interface AgentTestCase {
3284
+ history: AgentTestHistoryEntry[];
3285
+ context: Record<string, unknown> | null;
3286
+ timezone: string | null;
3287
+ locale: string | null;
3288
+ expectedToolCall: {
3289
+ name: string;
3290
+ arguments?: unknown;
3291
+ } | null;
3292
+ /** `false` when unset: no assertion. */
3293
+ expectedNoToolCall: boolean;
3294
+ }
3295
+ export interface AgentTestCaseInput {
3296
+ /**
3297
+ * The prompt's kind; unset means `chat`. The admin routes pass a block type
3298
+ * (`workflow`, `script`, `integration`) for a case that is not a prompt's.
3299
+ */
3300
+ kind?: unknown;
3301
+ /**
3302
+ * The agent's `[prompt.agent]` (a table, one JSON string, or `null` for an
3303
+ * agent that declares none). Omitted means "not known here": the declared
3304
+ * names are not checked (the CLI preflight reads the sidecar alone).
3305
+ */
3306
+ declaration?: unknown;
3307
+ /** The case's fields, in wire spelling (`agentHistory`, …, `expectedJsonSubset`). */
3308
+ fields: Record<string, unknown>;
3309
+ }
3310
+ export type AgentTestCaseResolution = {
3311
+ ok: true;
3312
+ testCase: AgentTestCase | null;
3313
+ } | {
3314
+ ok: false;
3315
+ refusals: AgentRefusal[];
3316
+ };
3317
+ /**
3318
+ * The one rule: is this case's agent block something a round can be built
3319
+ * from? `{ ok: true, testCase }` carries it read (`null` on a case whose
3320
+ * prompt is not an agent). On a chat or decisions case, every agent key
3321
+ * holding a non-null value is refused by name; an explicit `null` is unset on
3322
+ * any case, which is how a full-state update clears one.
3323
+ */
3324
+ export declare function resolveAgentTestCase(input: AgentTestCaseInput): AgentTestCaseResolution;
2818
3325
  export declare const PROMPT_SURFACE: ConfigObjectSurface;
2819
3326
  export declare const INTEGRATION_SURFACE: ConfigObjectSurface;
2820
- export declare const WEBHOOK_SURFACE: ConfigObjectSurface;
2821
- export declare const CRON_TRIGGER_SURFACE: ConfigObjectSurface;
2822
3327
  export declare const BLOB_BUCKET_SURFACE: ConfigObjectSurface;
2823
3328
  /**
2824
3329
  * The `email-template` configuration object's definition (issue #2644, phase 2).
@@ -2860,28 +3365,23 @@ export declare function isRetiredEmailType(emailType: string): emailType is Reti
2860
3365
  export declare function retiredEmailTypeGuidance(emailType: string): string;
2861
3366
  export declare const EMAIL_TEMPLATE_SURFACE: ConfigObjectSurface;
2862
3367
  export declare const DATABASE_TYPE_SURFACE: ConfigObjectSurface;
3368
+ export declare const DB3_TYPE_SURFACE: ConfigObjectSurface;
2863
3369
  export declare const RULE_SET_SURFACE: ConfigObjectSurface;
2864
- export declare const GROUP_TYPE_CONFIG_SURFACE: ConfigObjectSurface;
2865
- export declare const COLLECTION_TYPE_CONFIG_SURFACE: ConfigObjectSurface;
2866
3370
  export declare const METADATA_CATEGORY_CONFIG_SURFACE: ConfigObjectSurface;
3371
+ export declare const SERVER_FUNCTION_SURFACE: ConfigObjectSurface;
2867
3372
  /**
2868
- * The `transform` configuration object's definition (issue #2644, phase 3).
2869
- *
2870
- * Transforms are the one synced type with NO TOML field table: a transform is
2871
- * `transforms/<name>.rhai`, a Rhai source file, and its whole authored surface
2872
- * is the script body. `config pull` writes the active `ScriptConfig`'s body and
2873
- * `config push` sends it back; there is no key/value table to define, and the
2874
- * `Script` / `ScriptConfig` scalars around it (name, description, inputSchema,
2875
- * limits, status) are not authorable through the sync slot today.
2876
- *
2877
- * The entry exists so that is a DECISION rather than an absence. Criterion 3's
2878
- * registry guard reads `SYNC_RESOURCE_TYPES` and requires a surface per label;
2879
- * without this module `transform` would have to sit in an exemption list, which
2880
- * is precisely the "absent from a hand-written list" failure mode this epic
2881
- * exists to end.
3373
+ * The refusal of a new version whose default export has no `authorize`: it
3374
+ * names the function and shows the object form with the function's key. A
3375
+ * `file` prefixes the sentence the way the CLI reports a file it refuses.
2882
3376
  */
2883
- export declare const TRANSFORM_SURFACE: ConfigObjectSurface;
2884
- export declare const SERVER_FUNCTION_SURFACE: ConfigObjectSurface;
3377
+ export declare function authorizeRequiredMessage(functionKey: string, file?: string): string;
3378
+ /**
3379
+ * The refusal of a new version that defines `authorize` while its TOML still
3380
+ * carries `access`.
3381
+ */
3382
+ export declare function accessAmbiguousMessage(functionKey: string): string;
3383
+ /** The refusal of a create or update body that carries `access`. */
3384
+ export declare const FUNCTION_ACCESS_FROZEN_REQUEST: string;
2885
3385
  export declare const TEST_CASE_SURFACE: ConfigObjectSurface;
2886
3386
  export declare const APP_SETTINGS_SURFACE: ConfigObjectSurface;
2887
3387
  /**