primitive-admin 1.2.0-alpha.13 → 1.2.0-alpha.15

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 (324) hide show
  1. package/README.md +102 -78
  2. package/assets/skill/skills/primitive-platform/SKILL.md +87 -23
  3. package/dist/bin/primitive.js +11 -82
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/admins.js +79 -17
  6. package/dist/src/commands/admins.js.map +1 -1
  7. package/dist/src/commands/agent-sessions.js +2 -0
  8. package/dist/src/commands/agent-sessions.js.map +1 -1
  9. package/dist/src/commands/analytics.js +220 -18
  10. package/dist/src/commands/analytics.js.map +1 -1
  11. package/dist/src/commands/apps-children.js +2 -0
  12. package/dist/src/commands/apps-children.js.map +1 -1
  13. package/dist/src/commands/apps.js +19 -2
  14. package/dist/src/commands/apps.js.map +1 -1
  15. package/dist/src/commands/auth.js +11 -1
  16. package/dist/src/commands/auth.js.map +1 -1
  17. package/dist/src/commands/collections.js +13 -0
  18. package/dist/src/commands/collections.js.map +1 -1
  19. package/dist/src/commands/config.d.ts +1 -1
  20. package/dist/src/commands/config.js +40 -9
  21. package/dist/src/commands/config.js.map +1 -1
  22. package/dist/src/commands/connections.js +2 -0
  23. package/dist/src/commands/connections.js.map +1 -1
  24. package/dist/src/commands/database-type-configs.js +5 -3
  25. package/dist/src/commands/database-type-configs.js.map +1 -1
  26. package/dist/src/commands/databases.js +6 -4
  27. package/dist/src/commands/databases.js.map +1 -1
  28. package/dist/src/commands/db3-types.js +2 -0
  29. package/dist/src/commands/db3-types.js.map +1 -1
  30. package/dist/src/commands/db3.d.ts +12 -0
  31. package/dist/src/commands/db3.js +345 -11
  32. package/dist/src/commands/db3.js.map +1 -1
  33. package/dist/src/commands/documents.d.ts +52 -12
  34. package/dist/src/commands/documents.js +120 -29
  35. package/dist/src/commands/documents.js.map +1 -1
  36. package/dist/src/commands/email-templates.js +72 -0
  37. package/dist/src/commands/email-templates.js.map +1 -1
  38. package/dist/src/commands/functions.js +47 -10
  39. package/dist/src/commands/functions.js.map +1 -1
  40. package/dist/src/commands/groups.js +18 -3
  41. package/dist/src/commands/groups.js.map +1 -1
  42. package/dist/src/commands/init.js +7 -1
  43. package/dist/src/commands/init.js.map +1 -1
  44. package/dist/src/commands/integrations.js +80 -47
  45. package/dist/src/commands/integrations.js.map +1 -1
  46. package/dist/src/commands/metadata-category-configs.js +2 -0
  47. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  48. package/dist/src/commands/metadata.js +41 -0
  49. package/dist/src/commands/metadata.js.map +1 -1
  50. package/dist/src/commands/prompts.js +73 -47
  51. package/dist/src/commands/prompts.js.map +1 -1
  52. package/dist/src/commands/rule-sets.js +2 -0
  53. package/dist/src/commands/rule-sets.js.map +1 -1
  54. package/dist/src/commands/schemas.d.ts +15 -0
  55. package/dist/src/commands/schemas.js +122 -0
  56. package/dist/src/commands/schemas.js.map +1 -0
  57. package/dist/src/commands/secrets.js +45 -3
  58. package/dist/src/commands/secrets.js.map +1 -1
  59. package/dist/src/commands/sessions.js +2 -0
  60. package/dist/src/commands/sessions.js.map +1 -1
  61. package/dist/src/commands/sync-schemas.d.ts +202 -0
  62. package/dist/src/commands/sync-schemas.js +629 -0
  63. package/dist/src/commands/sync-schemas.js.map +1 -0
  64. package/dist/src/commands/sync-user-properties.d.ts +118 -0
  65. package/dist/src/commands/sync-user-properties.js +276 -0
  66. package/dist/src/commands/sync-user-properties.js.map +1 -0
  67. package/dist/src/commands/sync.d.ts +243 -12
  68. package/dist/src/commands/sync.js +1474 -314
  69. package/dist/src/commands/sync.js.map +1 -1
  70. package/dist/src/commands/user-properties.d.ts +14 -0
  71. package/dist/src/commands/user-properties.js +79 -0
  72. package/dist/src/commands/user-properties.js.map +1 -0
  73. package/dist/src/commands/users.js +912 -18
  74. package/dist/src/commands/users.js.map +1 -1
  75. package/dist/src/commands/waitlist.js +39 -4
  76. package/dist/src/commands/waitlist.js.map +1 -1
  77. package/dist/src/lib/analytics-query.d.ts +58 -0
  78. package/dist/src/lib/analytics-query.js +134 -0
  79. package/dist/src/lib/analytics-query.js.map +1 -0
  80. package/dist/src/lib/api-client.d.ts +779 -95
  81. package/dist/src/lib/api-client.js +369 -166
  82. package/dist/src/lib/api-client.js.map +1 -1
  83. package/dist/src/lib/block-selector.d.ts +9 -15
  84. package/dist/src/lib/block-selector.js +9 -20
  85. package/dist/src/lib/block-selector.js.map +1 -1
  86. package/dist/src/lib/cli-manifest.d.ts +8 -0
  87. package/dist/src/lib/cli-manifest.js +10 -1
  88. package/dist/src/lib/cli-manifest.js.map +1 -1
  89. package/dist/src/lib/cli-version.d.ts +14 -0
  90. package/dist/src/lib/cli-version.js +38 -0
  91. package/dist/src/lib/cli-version.js.map +1 -0
  92. package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
  93. package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
  94. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
  95. package/dist/src/lib/command-status.d.ts +110 -0
  96. package/dist/src/lib/command-status.js +184 -0
  97. package/dist/src/lib/command-status.js.map +1 -0
  98. package/dist/src/lib/config-object-descriptor.d.ts +6 -0
  99. package/dist/src/lib/config-object-descriptor.js +71 -0
  100. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  101. package/dist/src/lib/config-toml.d.ts +11 -2
  102. package/dist/src/lib/config-toml.js +25 -2
  103. package/dist/src/lib/config-toml.js.map +1 -1
  104. package/dist/src/lib/data-input.d.ts +1 -1
  105. package/dist/src/lib/data-input.js +1 -1
  106. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
  107. package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
  108. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  109. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +11 -1
  110. package/dist/src/lib/db-codegen/dbTypeIR.js +11 -5
  111. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  112. package/dist/src/lib/db-type-records.d.ts +95 -0
  113. package/dist/src/lib/db-type-records.js +219 -0
  114. package/dist/src/lib/db-type-records.js.map +1 -0
  115. package/dist/src/lib/db3-export.d.ts +65 -9
  116. package/dist/src/lib/db3-export.js +159 -22
  117. package/dist/src/lib/db3-export.js.map +1 -1
  118. package/dist/src/lib/db3-index-output.d.ts +69 -3
  119. package/dist/src/lib/db3-index-output.js +142 -4
  120. package/dist/src/lib/db3-index-output.js.map +1 -1
  121. package/dist/src/lib/db3-type-models.d.ts +39 -7
  122. package/dist/src/lib/db3-type-models.js +138 -27
  123. package/dist/src/lib/db3-type-models.js.map +1 -1
  124. package/dist/src/lib/deprecation.d.ts +2 -2
  125. package/dist/src/lib/deprecation.js +2 -2
  126. package/dist/src/lib/experimental-apis.d.ts +36 -0
  127. package/dist/src/lib/experimental-apis.js +46 -0
  128. package/dist/src/lib/experimental-apis.js.map +1 -0
  129. package/dist/src/lib/file-attachment.d.ts +24 -0
  130. package/dist/src/lib/file-attachment.js +31 -0
  131. package/dist/src/lib/file-attachment.js.map +1 -0
  132. package/dist/src/lib/function-authorize-check.d.ts +1 -1
  133. package/dist/src/lib/function-authorize-check.js +2 -1
  134. package/dist/src/lib/function-authorize-check.js.map +1 -1
  135. package/dist/src/lib/function-authorize-view.js +4 -0
  136. package/dist/src/lib/function-authorize-view.js.map +1 -1
  137. package/dist/src/lib/function-bundle.d.ts +27 -5
  138. package/dist/src/lib/function-bundle.js +106 -7
  139. package/dist/src/lib/function-bundle.js.map +1 -1
  140. package/dist/src/lib/function-collect.d.ts +2 -0
  141. package/dist/src/lib/function-collect.js +36 -7
  142. package/dist/src/lib/function-collect.js.map +1 -1
  143. package/dist/src/lib/function-db-types.d.ts +57 -40
  144. package/dist/src/lib/function-db-types.js +246 -285
  145. package/dist/src/lib/function-db-types.js.map +1 -1
  146. package/dist/src/lib/function-document-types.d.ts +19 -7
  147. package/dist/src/lib/function-document-types.js +24 -12
  148. package/dist/src/lib/function-document-types.js.map +1 -1
  149. package/dist/src/lib/function-run.d.ts +1 -1
  150. package/dist/src/lib/function-run.js +1 -1
  151. package/dist/src/lib/function-run.js.map +1 -1
  152. package/dist/src/lib/function-schema-codegen.d.ts +58 -18
  153. package/dist/src/lib/function-schema-codegen.js +85 -74
  154. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  155. package/dist/src/lib/function-schema-refs.d.ts +98 -0
  156. package/dist/src/lib/function-schema-refs.js +177 -0
  157. package/dist/src/lib/function-schema-refs.js.map +1 -0
  158. package/dist/src/lib/function-sync.d.ts +38 -4
  159. package/dist/src/lib/function-sync.js +83 -14
  160. package/dist/src/lib/function-sync.js.map +1 -1
  161. package/dist/src/lib/function-typecheck.d.ts +52 -0
  162. package/dist/src/lib/function-typecheck.js +171 -54
  163. package/dist/src/lib/function-typecheck.js.map +1 -1
  164. package/dist/src/lib/generated-build-flags.d.ts +13 -0
  165. package/dist/src/lib/generated-build-flags.js +14 -0
  166. package/dist/src/lib/generated-build-flags.js.map +1 -0
  167. package/dist/src/lib/generated-config-surfaces.d.ts +211 -11
  168. package/dist/src/lib/generated-config-surfaces.js +579 -69
  169. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  170. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  171. package/dist/src/lib/generated-sdk-types.js +1 -1
  172. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  173. package/dist/src/lib/integration-test-request.d.ts +54 -0
  174. package/dist/src/lib/integration-test-request.js +207 -0
  175. package/dist/src/lib/integration-test-request.js.map +1 -0
  176. package/dist/src/lib/log-inspection.d.ts +3 -0
  177. package/dist/src/lib/log-inspection.js +1 -0
  178. package/dist/src/lib/log-inspection.js.map +1 -1
  179. package/dist/src/lib/metadata-report.d.ts +85 -0
  180. package/dist/src/lib/metadata-report.js +81 -0
  181. package/dist/src/lib/metadata-report.js.map +1 -0
  182. package/dist/src/lib/output.d.ts +1 -1
  183. package/dist/src/lib/output.js +1 -1
  184. package/dist/src/lib/platform-owned.js +5 -0
  185. package/dist/src/lib/platform-owned.js.map +1 -1
  186. package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
  187. package/dist/src/lib/primitive-declaration-names.js +22 -0
  188. package/dist/src/lib/primitive-declaration-names.js.map +1 -0
  189. package/dist/src/lib/primitive-declaration.d.ts +143 -0
  190. package/dist/src/lib/primitive-declaration.js +658 -0
  191. package/dist/src/lib/primitive-declaration.js.map +1 -0
  192. package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
  193. package/dist/src/lib/prompt-schema-codegen.js +82 -98
  194. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  195. package/dist/src/lib/prompt-schema-document.d.ts +35 -0
  196. package/dist/src/lib/prompt-schema-document.js +92 -0
  197. package/dist/src/lib/prompt-schema-document.js.map +1 -0
  198. package/dist/src/lib/prompt-schema-refs.d.ts +164 -0
  199. package/dist/src/lib/prompt-schema-refs.js +452 -0
  200. package/dist/src/lib/prompt-schema-refs.js.map +1 -0
  201. package/dist/src/lib/records-verbs.d.ts +12 -2
  202. package/dist/src/lib/records-verbs.js +7 -2
  203. package/dist/src/lib/records-verbs.js.map +1 -1
  204. package/dist/src/lib/register-commands.d.ts +28 -0
  205. package/dist/src/lib/register-commands.js +101 -0
  206. package/dist/src/lib/register-commands.js.map +1 -0
  207. package/dist/src/lib/retired-imports.d.ts +53 -0
  208. package/dist/src/lib/retired-imports.js +120 -0
  209. package/dist/src/lib/retired-imports.js.map +1 -0
  210. package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
  211. package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
  212. package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
  213. package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
  214. package/dist/src/lib/schema-codegen/generated-db3-bridge.js +221 -0
  215. package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
  216. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
  217. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
  218. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
  219. package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +209 -0
  220. package/dist/src/lib/schema-codegen/generated-field-grammar.js +379 -0
  221. package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
  222. package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
  223. package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
  224. package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
  225. package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
  226. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
  227. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
  228. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
  229. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +154 -1
  230. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -1
  231. package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
  232. package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
  233. package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
  234. package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
  235. package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
  236. package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
  237. package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
  238. package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
  239. package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
  240. package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
  241. package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
  242. package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
  243. package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
  244. package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
  245. package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
  246. package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
  247. package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
  248. package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
  249. package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
  250. package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
  251. package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
  252. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +40 -13
  253. package/dist/src/lib/schema-codegen/schemaToTs.js +124 -160
  254. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
  255. package/dist/src/lib/schema-codegen/valuesLists.d.ts +35 -0
  256. package/dist/src/lib/schema-codegen/valuesLists.js +128 -0
  257. package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
  258. package/dist/src/lib/schema-family-index.d.ts +228 -0
  259. package/dist/src/lib/schema-family-index.js +813 -0
  260. package/dist/src/lib/schema-family-index.js.map +1 -0
  261. package/dist/src/lib/schema-pins.d.ts +82 -0
  262. package/dist/src/lib/schema-pins.js +198 -0
  263. package/dist/src/lib/schema-pins.js.map +1 -0
  264. package/dist/src/lib/schema-preview.d.ts +244 -0
  265. package/dist/src/lib/schema-preview.js +498 -0
  266. package/dist/src/lib/schema-preview.js.map +1 -0
  267. package/dist/src/lib/skill-installer.d.ts +2 -2
  268. package/dist/src/lib/skill-installer.js +2 -21
  269. package/dist/src/lib/skill-installer.js.map +1 -1
  270. package/dist/src/lib/step-run-table.d.ts +1 -2
  271. package/dist/src/lib/step-run-table.js +1 -2
  272. package/dist/src/lib/step-run-table.js.map +1 -1
  273. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
  274. package/dist/src/lib/swift-codegen/agentGenerator.js +24 -22
  275. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  276. package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
  277. package/dist/src/lib/swift-codegen/banners.js +12 -0
  278. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  279. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
  280. package/dist/src/lib/swift-codegen/functionGenerator.js +167 -50
  281. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  282. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +31 -7
  283. package/dist/src/lib/swift-codegen/schemaToSwift.js +213 -177
  284. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  285. package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
  286. package/dist/src/lib/swift-codegen/sharedGenerator.js +120 -0
  287. package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
  288. package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
  289. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
  290. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
  291. package/dist/src/lib/sync-resource-types.d.ts +37 -5
  292. package/dist/src/lib/sync-resource-types.js +53 -5
  293. package/dist/src/lib/sync-resource-types.js.map +1 -1
  294. package/dist/src/lib/sync-selectors.d.ts +7 -0
  295. package/dist/src/lib/sync-selectors.js +22 -2
  296. package/dist/src/lib/sync-selectors.js.map +1 -1
  297. package/dist/src/lib/test-runs.d.ts +45 -0
  298. package/dist/src/lib/test-runs.js +150 -0
  299. package/dist/src/lib/test-runs.js.map +1 -0
  300. package/dist/src/lib/test-users.d.ts +25 -0
  301. package/dist/src/lib/test-users.js +36 -0
  302. package/dist/src/lib/test-users.js.map +1 -0
  303. package/dist/src/lib/toml-database-config.d.ts +2 -1
  304. package/dist/src/lib/toml-database-config.js +4 -3
  305. package/dist/src/lib/toml-database-config.js.map +1 -1
  306. package/dist/src/lib/toml-scalar-edit.js +6 -4
  307. package/dist/src/lib/toml-scalar-edit.js.map +1 -1
  308. package/dist/src/lib/user-index.d.ts +80 -0
  309. package/dist/src/lib/user-index.js +166 -0
  310. package/dist/src/lib/user-index.js.map +1 -0
  311. package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
  312. package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
  313. package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
  314. package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
  315. package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
  316. package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
  317. package/dist/src/lib/user-walk.d.ts +31 -0
  318. package/dist/src/lib/user-walk.js +102 -0
  319. package/dist/src/lib/user-walk.js.map +1 -0
  320. package/dist/src/lib/worker-perf-format.d.ts +22 -0
  321. package/dist/src/lib/worker-perf-format.js +27 -0
  322. package/dist/src/lib/worker-perf-format.js.map +1 -0
  323. package/dist/src/types/index.d.ts +13 -34
  324. package/package.json +5 -3
@@ -14,6 +14,7 @@
14
14
  * `cli/tests/unit/config-surface-drift-guard.test.ts`) fails if this committed
15
15
  * copy does not match the source.
16
16
  */
17
+ import { ONEOF_SIBLING_CONSTRAINT_KEYS, SCHEMA_KEYWORDS, refusedSchemaKeywords, } from "./schema-codegen/generated-schema-descriptor.js";
17
18
  // ── src/config-surface/helpers.ts ────────────────────────────────────────
18
19
  /**
19
20
  * Shared spellings used by every configuration-object definition (issue #2644).
@@ -3606,6 +3607,20 @@ function parseManifestCallers(raw, errors) {
3606
3607
  if (raw.db3 !== undefined && typeof raw.db3 !== "boolean") {
3607
3608
  errors.push("the manifest's `authorize.callers.db3` must be a boolean when present.");
3608
3609
  }
3610
+ const usersBatch = raw.usersBatch;
3611
+ if (usersBatch !== undefined && typeof usersBatch !== "boolean") {
3612
+ if (!Array.isArray(usersBatch) || usersBatch.some((k) => typeof k !== "string")) {
3613
+ errors.push("the manifest's `authorize.callers.usersBatch` must be a boolean or an array of function keys when present.");
3614
+ }
3615
+ else if (usersBatch.length > MAX_MANIFEST_CALLER_FUNCTIONS) {
3616
+ errors.push(`the manifest's \`authorize.callers.usersBatch\` lists ${usersBatch.length} keys, over the ` +
3617
+ `${MAX_MANIFEST_CALLER_FUNCTIONS} limit.`);
3618
+ }
3619
+ else if (usersBatch.some((k) => k === "" || k.length > MAX_MANIFEST_NAME_LENGTH)) {
3620
+ errors.push("the manifest's `authorize.callers.usersBatch` carries a key that is empty or over " +
3621
+ `${MAX_MANIFEST_NAME_LENGTH} characters.`);
3622
+ }
3623
+ }
3609
3624
  if (errors.length > before)
3610
3625
  return null;
3611
3626
  return {
@@ -3616,6 +3631,9 @@ function parseManifestCallers(raw, errors) {
3616
3631
  agents: raw.agents,
3617
3632
  users: raw.users,
3618
3633
  ...(raw.db3 !== undefined ? { db3: raw.db3 } : {}),
3634
+ ...(usersBatch !== undefined
3635
+ ? { usersBatch: Array.isArray(usersBatch) ? [...new Set(usersBatch)].sort() : usersBatch }
3636
+ : {}),
3619
3637
  };
3620
3638
  }
3621
3639
  /**
@@ -6653,33 +6671,23 @@ const GEMINI_TYPES = [
6653
6671
  "array",
6654
6672
  ];
6655
6673
  /**
6656
- * Keywords Gemini spells the same way, with the same meaning. `required` is
6657
- * here rather than under the structural keywords because Gemini reads it
6658
- * verbatim.
6674
+ * What Gemini's function `Schema` does with one keyword, from the keyword
6675
+ * table: `pass` (spelled the same way, with the same meaning — `required`
6676
+ * among them, and Gemini's own `nullable`, `propertyOrdering` and `example`),
6677
+ * `drop` (an annotation with no value meaning, dropped in silence, spec §3),
6678
+ * `rule` (handled by its own rule below) or `refuse`. A key the table does not
6679
+ * name is refused: a keyword nobody classified could mean anything.
6659
6680
  */
6660
- const GEMINI_PASS_KEYWORDS = [
6661
- "description",
6662
- "title",
6663
- "default",
6664
- "minimum",
6665
- "maximum",
6666
- "minLength",
6667
- "maxLength",
6668
- "pattern",
6669
- "minItems",
6670
- "maxItems",
6671
- "minProperties",
6672
- "maxProperties",
6673
- "required",
6674
- // Gemini's own spellings, accepted as authored.
6675
- "nullable",
6676
- "propertyOrdering",
6677
- "example",
6678
- ];
6679
- /** Annotations with no value meaning: dropped in silence (spec §3). */
6680
- const GEMINI_DROPPED_KEYWORDS = ["$schema", "$id", "$comment"];
6681
- /** Keywords handled by their own rule below, not by the tables. */
6682
- const GEMINI_STRUCTURAL_KEYWORDS = [
6681
+ export function geminiKeywordVerdict(keyword) {
6682
+ return Object.prototype.hasOwnProperty.call(SCHEMA_KEYWORDS, keyword)
6683
+ ? SCHEMA_KEYWORDS[keyword].gemini
6684
+ : "refuse";
6685
+ }
6686
+ /**
6687
+ * Keywords handled by their own rule below: exactly the table's `rule` rows,
6688
+ * which the keyword-table conformance test holds it to.
6689
+ */
6690
+ export const GEMINI_STRUCTURAL_KEYWORDS = [
6683
6691
  "type",
6684
6692
  "enum",
6685
6693
  "const",
@@ -6700,10 +6708,12 @@ const GEMINI_FORMATS = [
6700
6708
  "double",
6701
6709
  ];
6702
6710
  /**
6703
- * Keywords Gemini's function `Schema` has no spelling for. Each is refused
6704
- * rather than dropped: dropping any of them widens what the model may produce.
6711
+ * Why Gemini's function `Schema` cannot carry a refused keyword, for the ones
6712
+ * with a reason of their own. Each is refused rather than dropped: dropping any
6713
+ * of them widens what the model may produce. A refused keyword with no entry
6714
+ * here gets the generic reason.
6705
6715
  */
6706
- const GEMINI_REFUSED_KEYWORDS = {
6716
+ export const GEMINI_REFUSAL_REASONS = {
6707
6717
  $ref: "Gemini's function Schema has no $ref — inline the referenced schema",
6708
6718
  $defs: "Gemini's function Schema has no $defs — inline each definition where it is used",
6709
6719
  definitions: "Gemini's function Schema has no definitions — inline each definition where it is used",
@@ -6730,21 +6740,10 @@ const GEMINI_REFUSED_KEYWORDS = {
6730
6740
  writeOnly: "Gemini's function Schema has no writeOnly — drop it, or say so in description",
6731
6741
  deprecated: "Gemini's function Schema has no deprecated — say so in description",
6732
6742
  };
6733
- /**
6734
- * Sibling keywords that make a `oneOf` node a MIXED schema rather than a clean
6735
- * tagged union. Exactly `describeSchema`'s list
6736
- * (`src/function-runs/schema-descriptor.ts`) — the platform's own rule for what a
6737
- * discriminated union is, restated here because that module is vendored
6738
- * separately and cannot be imported from `src/config-surface/`.
6739
- */
6740
- const ONEOF_SIBLING_KEYWORDS = [
6741
- "type",
6742
- "properties",
6743
- "required",
6744
- "additionalProperties",
6745
- "items",
6746
- "enum",
6747
- ];
6743
+ /** The reason a key the table does not classify, or classifies without one, is refused. */
6744
+ const GEMINI_UNCLASSIFIED_REASON = "is not a keyword Gemini's function Schema carries, and dropping a " +
6745
+ "keyword whose meaning the platform does not know could widen what the " +
6746
+ "model may produce";
6748
6747
  function isPlainSchemaObject(value) {
6749
6748
  return typeof value === "object" && value !== null && !Array.isArray(value);
6750
6749
  }
@@ -6811,7 +6810,10 @@ function discriminatedOneOf(node, members) {
6811
6810
  'members, every one of them type = "object"',
6812
6811
  };
6813
6812
  }
6814
- const sibling = ONEOF_SIBLING_KEYWORDS.filter((key) => Object.prototype.hasOwnProperty.call(node, key));
6813
+ // Sibling keywords that make a `oneOf` node a MIXED schema rather than a
6814
+ // clean tagged union: `describeSchema`'s own list, the platform's rule for
6815
+ // what a discriminated union is.
6816
+ const sibling = ONEOF_SIBLING_CONSTRAINT_KEYS.filter((key) => Object.prototype.hasOwnProperty.call(node, key));
6815
6817
  if (sibling.length > 0) {
6816
6818
  return {
6817
6819
  ok: false,
@@ -6893,7 +6895,8 @@ function translateGeminiNode(node, path, out) {
6893
6895
  // ── Pass one: the tables, in the author's own key order ────────────────
6894
6896
  const deferred = new Set();
6895
6897
  for (const key of Object.keys(node)) {
6896
- if (GEMINI_DROPPED_KEYWORDS.includes(key))
6898
+ const verdict = geminiKeywordVerdict(key);
6899
+ if (verdict === "drop")
6897
6900
  continue;
6898
6901
  if (key === "additionalProperties") {
6899
6902
  // Dropped for `false` and `true` alike: Gemini has no closed-object
@@ -6908,22 +6911,19 @@ function translateGeminiNode(node, path, out) {
6908
6911
  "but the platform validates the original schema)");
6909
6912
  continue;
6910
6913
  }
6911
- if (Object.prototype.hasOwnProperty.call(GEMINI_REFUSED_KEYWORDS, key)) {
6912
- refuse(key, GEMINI_REFUSED_KEYWORDS[key]);
6913
- continue;
6914
- }
6915
- if (GEMINI_PASS_KEYWORDS.includes(key)) {
6914
+ if (verdict === "pass") {
6916
6915
  result[key] = schemaCopy(node[key]);
6917
6916
  continue;
6918
6917
  }
6919
- if (GEMINI_STRUCTURAL_KEYWORDS.includes(key)) {
6918
+ if (verdict === "rule" && GEMINI_STRUCTURAL_KEYWORDS.includes(key)) {
6920
6919
  deferred.add(key);
6921
6920
  continue;
6922
6921
  }
6923
- // Fail closed: a keyword nobody classified could mean anything.
6924
- refuse(key, "is not a keyword Gemini's function Schema carries, and dropping a " +
6925
- "keyword whose meaning the platform does not know could widen what the " +
6926
- "model may produce");
6922
+ // Fail closed: a refused keyword, or one nobody classified, could mean
6923
+ // anything to the model.
6924
+ refuse(key, Object.prototype.hasOwnProperty.call(GEMINI_REFUSAL_REASONS, key)
6925
+ ? GEMINI_REFUSAL_REASONS[key]
6926
+ : GEMINI_UNCLASSIFIED_REASON);
6927
6927
  }
6928
6928
  // ── Pass two: the structural keywords, in a fixed order ────────────────
6929
6929
  if (deferred.has("enum")) {
@@ -7368,6 +7368,324 @@ export function agentSchemaDeficitRefusal(deficit) {
7368
7368
  `rewrite the schema, or archive every ${provider} config of this prompt`,
7369
7369
  };
7370
7370
  }
7371
+ // ── src/config-surface/prompt-schema-refusals.ts ─────────────────────────
7372
+ /**
7373
+ * What a prompt push refuses — #5536 (project `unified-schemas` phase 5)
7374
+ * reported it, #5538 (phase 6, intent criterion 8) refuses it.
7375
+ *
7376
+ * Two checks judge a prompt's schemas: the lossless Gemini translator
7377
+ * (`translateSchemaForProvider`) on the output schemas a Gemini config sends,
7378
+ * and the engine (the function push's rules) on every schema. A write
7379
+ * carrying a keyword either would refuse is refused, each keyword named with
7380
+ * its fix and a code: `PROMPT_SCHEMA_NOT_TRANSLATABLE` for the translator,
7381
+ * `PROMPT_SCHEMA_UNSUPPORTED_KEYWORD` for the engine. The admin prompt routes,
7382
+ * the CLI preflight (through the vendored copy), the Gemini call path and the
7383
+ * audit (`scripts/lib/schema-audit-core.ts`) all read this module, so they
7384
+ * cannot disagree about which schemas are refused.
7385
+ *
7386
+ * An agent's translator refusals are not here: they are already the push
7387
+ * error `AGENT_SCHEMA_NOT_TRANSLATABLE` (DSO-5536-002).
7388
+ */
7389
+ /**
7390
+ * The code a prompt write is refused with for a keyword the lossless Gemini
7391
+ * translator cannot carry, and the code a run of a stored prompt whose output
7392
+ * schema it cannot carry fails with.
7393
+ */
7394
+ export const PROMPT_SCHEMA_NOT_TRANSLATABLE = "PROMPT_SCHEMA_NOT_TRANSLATABLE";
7395
+ /** The code a prompt write is refused with for a keyword or a shape the schema check would not enforce. */
7396
+ export const PROMPT_SCHEMA_UNSUPPORTED_KEYWORD = "PROMPT_SCHEMA_UNSUPPORTED_KEYWORD";
7397
+ /**
7398
+ * The fix for each keyword the engine refuses: one entry per refused row of
7399
+ * the keyword table, and no other key.
7400
+ */
7401
+ export const ENGINE_REFUSAL_FIXES = {
7402
+ $dynamicRef: "Write a local $ref to #/$defs/<Name> instead",
7403
+ $recursiveRef: "Write a local $ref to #/$defs/<Name> instead",
7404
+ allOf: "Merge the members into one schema",
7405
+ not: "State what is allowed instead",
7406
+ if: "Declare a discriminated oneOf instead",
7407
+ then: "Declare a discriminated oneOf instead",
7408
+ else: "Declare a discriminated oneOf instead",
7409
+ patternProperties: "Name the properties",
7410
+ propertyNames: "Name the properties",
7411
+ dependencies: "Declare a discriminated oneOf instead",
7412
+ dependentRequired: "Declare a discriminated oneOf instead",
7413
+ dependentSchemas: "Declare a discriminated oneOf instead",
7414
+ unevaluatedProperties: "Use additionalProperties: false instead",
7415
+ contains: "Declare items, and bound the count with minItems/maxItems",
7416
+ minContains: "Declare items, and bound the count with minItems/maxItems",
7417
+ maxContains: "Declare items, and bound the count with minItems/maxItems",
7418
+ prefixItems: "Declare one items schema",
7419
+ additionalItems: "Declare one items schema",
7420
+ unevaluatedItems: "Declare one items schema",
7421
+ };
7422
+ /**
7423
+ * The fix for a translator refusal whose reason states only what would be
7424
+ * lost, appended to the refusal line (DSO-5536-008: the translator's own
7425
+ * texts are refusal texts elsewhere and stay as they are). `"*"` is the fix
7426
+ * for a keyword the translator has no reason of its own for.
7427
+ */
7428
+ export const TRANSLATOR_REFUSAL_FIXES = {
7429
+ exclusiveMinimum: "for an integer, write minimum one above the bound; otherwise drop it and check the bound in the code that reads the answer, or run the prompt on a non-Gemini config",
7430
+ exclusiveMaximum: "for an integer, write maximum one below the bound; otherwise drop it and check the bound in the code that reads the answer, or run the prompt on a non-Gemini config",
7431
+ multipleOf: "drop it and check the value in the code that reads the answer, or run the prompt on a non-Gemini config",
7432
+ uniqueItems: "drop it and de-duplicate in the code that reads the answer, or run the prompt on a non-Gemini config",
7433
+ "*": "remove the keyword, or run the prompt on a non-Gemini config",
7434
+ };
7435
+ /** The type names the engine reads. */
7436
+ const ENGINE_SCHEMA_TYPES = ["object", "array", "string", "number", "integer", "boolean", "null"];
7437
+ function isJudgedSchemaObject(value) {
7438
+ return value !== null && typeof value === "object" && !Array.isArray(value);
7439
+ }
7440
+ function judgedPath(path, segment) {
7441
+ if (segment.startsWith("["))
7442
+ return `${path}${segment}`;
7443
+ return path ? `${path}.${segment}` : segment;
7444
+ }
7445
+ /**
7446
+ * Every keyword of `schema` the function push's rules refuse, over the nodes
7447
+ * they check (the root, `properties`, `items`, `anyOf`, `oneOf`; never
7448
+ * `$defs`): the keyword table's refused class, each reason ending with its
7449
+ * fix, and the shape rules. An enforced constraint (`uniqueItems`,
7450
+ * `multipleOf`, …) is never one: only the translator refuses those.
7451
+ *
7452
+ * The walk keeps its own work stack rather than recursing: the compiler
7453
+ * accepts a schema nested deeper than the call stack, and every refusal must
7454
+ * still be named for it.
7455
+ */
7456
+ export function engineSchemaRefusals(schema, path = "") {
7457
+ const out = [];
7458
+ const work = [{ node: schema, path }];
7459
+ while (work.length > 0) {
7460
+ const step = work.pop();
7461
+ if ("refusal" in step) {
7462
+ out.push(step.refusal);
7463
+ continue;
7464
+ }
7465
+ // A node's steps in report order, pushed reversed so they pop in order.
7466
+ const steps = [];
7467
+ const fault = (keyword, reason) => steps.push({ refusal: { path: step.path, keyword, reason } });
7468
+ const node = step.node;
7469
+ if (!isJudgedSchemaObject(node)) {
7470
+ fault("(schema)", "must be a JSON Schema object");
7471
+ }
7472
+ else {
7473
+ for (const keyword of refusedSchemaKeywords()) {
7474
+ if (Object.prototype.hasOwnProperty.call(node, keyword)) {
7475
+ fault(keyword, `${keyword} is not supported: the schema check would not enforce it. ${ENGINE_REFUSAL_FIXES[keyword]}`);
7476
+ }
7477
+ }
7478
+ if (node.additionalProperties !== undefined && typeof node.additionalProperties !== "boolean") {
7479
+ fault("additionalProperties", "must be true or false; a schema for the extra properties is not supported");
7480
+ }
7481
+ if (node.type !== undefined) {
7482
+ const types = Array.isArray(node.type) ? node.type : [node.type];
7483
+ if (types.length === 0)
7484
+ fault("type", "must name at least one JSON Schema type");
7485
+ const unknown = types.find((type) => !ENGINE_SCHEMA_TYPES.includes(type));
7486
+ if (unknown !== undefined)
7487
+ fault("type", `must be one of ${ENGINE_SCHEMA_TYPES.join(", ")}, not ${JSON.stringify(unknown)}`);
7488
+ }
7489
+ if (node.enum !== undefined && !Array.isArray(node.enum))
7490
+ fault("enum", "must be an array of allowed values");
7491
+ if (node.required !== undefined && (!Array.isArray(node.required) || node.required.some((name) => typeof name !== "string"))) {
7492
+ fault("required", "must be an array of property names");
7493
+ }
7494
+ if (node.properties !== undefined) {
7495
+ if (!isJudgedSchemaObject(node.properties)) {
7496
+ fault("properties", "must be an object of property schemas");
7497
+ }
7498
+ else {
7499
+ for (const [name, child] of Object.entries(node.properties)) {
7500
+ steps.push({ node: child, path: judgedPath(judgedPath(step.path, "properties"), name) });
7501
+ }
7502
+ }
7503
+ }
7504
+ if (node.items !== undefined) {
7505
+ if (Array.isArray(node.items))
7506
+ fault("items", "must be one schema for every item; a list of item schemas is not supported");
7507
+ else
7508
+ steps.push({ node: node.items, path: judgedPath(step.path, "items") });
7509
+ }
7510
+ for (const keyword of ["anyOf", "oneOf"]) {
7511
+ const value = node[keyword];
7512
+ if (value === undefined)
7513
+ continue;
7514
+ if (!Array.isArray(value)) {
7515
+ fault(keyword, "must be an array of schemas");
7516
+ continue;
7517
+ }
7518
+ value.forEach((child, index) => steps.push({ node: child, path: judgedPath(judgedPath(step.path, keyword), `[${index}]`) }));
7519
+ }
7520
+ }
7521
+ for (let i = steps.length - 1; i >= 0; i--)
7522
+ work.push(steps[i]);
7523
+ }
7524
+ return out;
7525
+ }
7526
+ /**
7527
+ * The schemas an agent's model reads from its declaration (a table or one
7528
+ * JSON string): each client tool's `inputSchema` and `outputSchema`, each
7529
+ * event's `schema` and the turn context's. Never a server tool's: those are
7530
+ * its function's, judged at the function push.
7531
+ */
7532
+ export function agentDeclarationSchemas(agent) {
7533
+ const declaration = parseAgentDeclarationBlock(agent);
7534
+ if (!declaration)
7535
+ return [];
7536
+ const out = [];
7537
+ for (const tool of Array.isArray(declaration.tools) ? declaration.tools : []) {
7538
+ if (!isJudgedSchemaObject(tool) || (typeof tool.function === "string" && tool.function.trim() !== ""))
7539
+ continue;
7540
+ for (const which of ["inputSchema", "outputSchema"]) {
7541
+ if (tool[which] !== undefined)
7542
+ out.push({ subject: `agent tool "${String(tool.name)}" ${which}`, schema: tool[which] });
7543
+ }
7544
+ }
7545
+ for (const event of Array.isArray(declaration.events) ? declaration.events : []) {
7546
+ if (isJudgedSchemaObject(event) && event.schema !== undefined)
7547
+ out.push({ subject: `agent event "${String(event.name)}" schema`, schema: event.schema });
7548
+ }
7549
+ const turnContext = declaration.turnContext;
7550
+ if (isJudgedSchemaObject(turnContext) && turnContext.schema !== undefined)
7551
+ out.push({ subject: "agent turnContext.schema", schema: turnContext.schema });
7552
+ return out;
7553
+ }
7554
+ /**
7555
+ * A schema field's value as judged: `undefined` for an absent or cleared one
7556
+ * (`null`, `""`), a JSON-string spelling parsed, a string that does not parse
7557
+ * kept as it is (the engine reports it as no schema object).
7558
+ */
7559
+ function judgedSchemaValue(value) {
7560
+ if (value === undefined || value === null || value === "")
7561
+ return undefined;
7562
+ if (typeof value !== "string")
7563
+ return value;
7564
+ try {
7565
+ return JSON.parse(value);
7566
+ }
7567
+ catch {
7568
+ return value;
7569
+ }
7570
+ }
7571
+ /** A config the server would store as non-archived on Gemini: status and provider read as the write normalizes them. */
7572
+ function isLiveGemini(config) {
7573
+ return (String(config.status ?? "active").trim().toLowerCase() !== "archived" &&
7574
+ String(config.provider).trim().toLowerCase() === "gemini");
7575
+ }
7576
+ /** The reason a schema nested deeper than the translator's walk is refused with. */
7577
+ const TRANSLATOR_OVERFLOW_REASON = "is nested deeper than the translator walks; flatten the schema";
7578
+ /**
7579
+ * `translateSchemaForProvider(schema, "gemini")`, failing closed. The
7580
+ * translator recurses, so a schema nested deeper than the call stack cannot be
7581
+ * translated: it is one refusal about the whole document (`(schema)`, the
7582
+ * engine's spelling), so a schema Gemini would never be sent is refused at
7583
+ * push and at call time rather than accepted unread. Any other error is a
7584
+ * fault and propagates.
7585
+ */
7586
+ export function translateSchemaForGemini(schema) {
7587
+ try {
7588
+ return translateSchemaForProvider(schema, "gemini");
7589
+ }
7590
+ catch (error) {
7591
+ if (error instanceof RangeError) {
7592
+ return { ok: false, refusals: [{ path: "", keyword: "(schema)", reason: TRANSLATOR_OVERFLOW_REASON }] };
7593
+ }
7594
+ throw error;
7595
+ }
7596
+ }
7597
+ /** The translator's refusals for one schema: `translateSchemaForGemini`'s, or none. */
7598
+ export function translatorRefusals(schema) {
7599
+ const translated = translateSchemaForGemini(schema);
7600
+ return translated.ok === false ? translated.refusals : [];
7601
+ }
7602
+ /**
7603
+ * Every keyword of a prompt's schemas the translator or the engine would
7604
+ * refuse. The translator judges `outputSchema` when a non-archived config
7605
+ * names Gemini (case-insensitive), and each Gemini config's own
7606
+ * `outputSchema` unless that config is archived; `inputSchema` is never
7607
+ * translated, and an agent's schemas are judged by the engine only. Order:
7608
+ * `inputSchema`, `outputSchema`, the agent's schemas, then each config; per
7609
+ * schema the translator first. A top-level value that is no schema object
7610
+ * is reported once, by the engine.
7611
+ */
7612
+ export function promptSchemaDeficits(input) {
7613
+ const configs = input.configs ?? [];
7614
+ const out = [];
7615
+ const judge = (subject, field, value, translate, config) => {
7616
+ const schema = judgedSchemaValue(value);
7617
+ if (schema === undefined)
7618
+ return;
7619
+ const where = config === undefined ? { subject, field } : { subject, field, config };
7620
+ if (translate && isJudgedSchemaObject(schema)) {
7621
+ for (const refusal of translatorRefusals(schema))
7622
+ out.push({ ...where, check: "translator", provider: "gemini", ...refusal });
7623
+ }
7624
+ for (const refusal of engineSchemaRefusals(schema))
7625
+ out.push({ ...where, check: "engine", ...refusal });
7626
+ };
7627
+ judge("inputSchema", "inputSchema", input.inputSchema, false);
7628
+ judge("outputSchema", "outputSchema", input.outputSchema, configs.some(isLiveGemini));
7629
+ if (judgedSchemaValue(input.agent) !== undefined) {
7630
+ for (const { subject, schema } of agentDeclarationSchemas(input.agent)) {
7631
+ for (const refusal of engineSchemaRefusals(schema))
7632
+ out.push({ subject, field: "agent", check: "engine", ...refusal });
7633
+ }
7634
+ }
7635
+ for (const config of configs) {
7636
+ judge(`config "${config.name}" outputSchema`, "outputSchema", config.outputSchema, isLiveGemini(config), config.name);
7637
+ }
7638
+ return out;
7639
+ }
7640
+ /**
7641
+ * The fix a translator line appends: the table's for a lossy constraint, the
7642
+ * default for a keyword the translator has no reason of its own for, and none
7643
+ * where the reason already says what to write (a keyword with a reason of its
7644
+ * own, or one the translator handles by its own rule).
7645
+ */
7646
+ function translatorFix(keyword) {
7647
+ if (Object.prototype.hasOwnProperty.call(TRANSLATOR_REFUSAL_FIXES, keyword))
7648
+ return TRANSLATOR_REFUSAL_FIXES[keyword];
7649
+ if (Object.prototype.hasOwnProperty.call(GEMINI_REFUSAL_REASONS, keyword))
7650
+ return null;
7651
+ if (keyword === "(schema)" || GEMINI_STRUCTURAL_KEYWORDS.includes(keyword))
7652
+ return null;
7653
+ return TRANSLATOR_REFUSAL_FIXES["*"];
7654
+ }
7655
+ /**
7656
+ * The refusal line for one deficit: the subject, the path, the keyword, why,
7657
+ * and the fix. A translator reason with no fix of its own names what Gemini
7658
+ * needs instead (`properties`, `type`, the overflow's "flatten the schema").
7659
+ */
7660
+ export function promptSchemaRefusalLine(deficit) {
7661
+ const at = `${deficit.subject} at ${schemaPathLabel(deficit.path)}`;
7662
+ if (deficit.check === "translator") {
7663
+ const fix = translatorFix(deficit.keyword);
7664
+ return `${at}: ${deficit.keyword} cannot be translated for gemini without losing meaning — ${deficit.reason}${fix ? `. Fix: ${fix}` : ""}`;
7665
+ }
7666
+ const named = deficit.keyword === "(schema)"
7667
+ ? `the schema ${deficit.reason}`
7668
+ : deficit.reason.startsWith(`${deficit.keyword} `)
7669
+ ? deficit.reason
7670
+ : `${deficit.keyword} ${deficit.reason}`;
7671
+ return `${at}: ${named}`;
7672
+ }
7673
+ /** The code a write is refused with for one deficit. */
7674
+ export function promptSchemaDeficitCode(deficit) {
7675
+ return deficit.check === "translator" ? PROMPT_SCHEMA_NOT_TRANSLATABLE : PROMPT_SCHEMA_UNSUPPORTED_KEYWORD;
7676
+ }
7677
+ /** A refused write's `details.refusals`: one entry per deficit, in `promptSchemaDeficits` order. */
7678
+ export function promptSchemaRefusals(deficits) {
7679
+ return deficits.map((deficit) => ({
7680
+ code: promptSchemaDeficitCode(deficit),
7681
+ message: promptSchemaRefusalLine(deficit),
7682
+ subject: deficit.subject,
7683
+ field: deficit.field,
7684
+ ...(deficit.config !== undefined ? { config: deficit.config } : {}),
7685
+ path: deficit.path,
7686
+ keyword: deficit.keyword,
7687
+ }));
7688
+ }
7371
7689
  // ── src/config-surface/agent-function-change.ts ──────────────────────────
7372
7690
  /**
7373
7691
  * A change to a server function that an agent uses — issue #4441.
@@ -7947,6 +8265,26 @@ export const PROMPT_SURFACE = {
7947
8265
  writableOn: BOTH,
7948
8266
  validation: handledBy("src/config-surface/agent-declaration.ts", "resolveAgentDeclaration", "apply"),
7949
8267
  },
8268
+ // #5249 — the prompt that judges this prompt's test cases by default,
8269
+ // authored as its KEY and resolved to the stored id at push, as #3998
8270
+ // did for a test case's `evaluatorPromptKey`. The id has no TOML
8271
+ // spelling. Present-only (intent decision): an absent key leaves the
8272
+ // stored link alone, so a tree written before this keeps every link
8273
+ // made in the web admin, and `""` clears it.
8274
+ //
8275
+ // UPDATE_ONLY because push links through the update route, after this
8276
+ // push's creates, so a prompt can name an evaluator created in the same
8277
+ // push. The create route is unchanged: it accepts the key and ignores
8278
+ // it (`requestOnlyKeys` below). The resolver needs the app's prompt
8279
+ // listing, so it is not decidable from the file alone.
8280
+ {
8281
+ field: "defaultEvaluatorPromptId",
8282
+ tomlKey: "defaultEvaluatorPromptKey",
8283
+ type: "string",
8284
+ emit: "whenSet",
8285
+ writableOn: UPDATE_ONLY,
8286
+ validation: handledBy("cli/src/commands/sync.ts", "resolvePromptEvaluatorLinks", "apply"),
8287
+ },
7950
8288
  ],
7951
8289
  notExposed: {
7952
8290
  promptId: {
@@ -7993,16 +8331,32 @@ export const PROMPT_SURFACE = {
7993
8331
  kind: "server-owned",
7994
8332
  note: "Provenance stamp written when a prompt is copied from the catalog.",
7995
8333
  },
8334
+ // #5534 — the authored schemas and their provenance, kept beside the
8335
+ // compiled ones in the fields above. Written by the server's compile;
8336
+ // read back as the detail's `source` and `provenance`.
8337
+ schemaSource: {
8338
+ kind: "server-owned",
8339
+ note: "The authored inputSchema, outputSchema and agent of a write whose " +
8340
+ "compile inlined a ref, as one JSON object; returned as `source`.",
8341
+ },
8342
+ schemaSourceR2Key: {
8343
+ kind: "server-owned",
8344
+ note: "Where an oversized schemaSource was offloaded, under a per-write key.",
8345
+ },
8346
+ schemaProvenance: {
8347
+ kind: "server-owned",
8348
+ note: "Each schema field's pointer → ref chain map, with the h1: hash of " +
8349
+ "each inlined definition; returned as `provenance`.",
8350
+ },
8351
+ schemaProvenanceR2Key: {
8352
+ kind: "server-owned",
8353
+ note: "Where an oversized schemaProvenance was offloaded, under a per-write key.",
8354
+ },
7996
8355
  activeConfigId: {
7997
8356
  kind: "server-owned",
7998
8357
  note: "Pointer to the active AppPromptConfig. Activation is its own " +
7999
8358
  "endpoint (activatePromptConfig), not a [prompt] key.",
8000
8359
  },
8001
- defaultEvaluatorPromptId: {
8002
- kind: "server-owned",
8003
- note: "Link to the evaluator prompt, written when an evaluator is created " +
8004
- "against this prompt. Managed through the prompts API, not TOML.",
8005
- },
8006
8360
  createdBy: {
8007
8361
  kind: "server-owned",
8008
8362
  note: "Admin who created the prompt; assigned server-side.",
@@ -8017,11 +8371,25 @@ export const PROMPT_SURFACE = {
8017
8371
  },
8018
8372
  },
8019
8373
  requestOnlyKeys: {
8374
+ // #5534 — the CLI's compile of the schemas the body carries, which the
8375
+ // server recompiles and compares; never stored as sent.
8376
+ compiled: {
8377
+ note: "The compiled form of each schema field the body carries " +
8378
+ "({ inputSchema?, outputSchema?, agent? }), sent by `config push`. " +
8379
+ "The server recompiles and refuses PROMPT_SCHEMA_COMPILED_MISMATCH " +
8380
+ "when they differ.",
8381
+ },
8382
+ provenance: {
8383
+ note: "The provenance of each field in `compiled`, which the server " +
8384
+ "compares with its own; required with `compiled`.",
8385
+ },
8020
8386
  defaultEvaluatorPromptId: {
8021
- note: "Writable through the prompts API (the console links an evaluator " +
8022
- "prompt) but never through TOML, which is why it is classified " +
8023
- "`server-owned` for the sync surface and named here for the request " +
8024
- "surface. Sending it is accepted; sync never does.",
8387
+ // #5249 — the field above is update-only; the create route has always
8388
+ // accepted this key and ignored it, and still does.
8389
+ modes: ["create"],
8390
+ note: "Accepted and ignored by the create route: a create links an " +
8391
+ "evaluator only through `sourcePromptId`. `config push` links " +
8392
+ "through the update route after its creates.",
8025
8393
  },
8026
8394
  },
8027
8395
  tomlOnlyKeys: {
@@ -8045,6 +8413,17 @@ export const PROMPT_SURFACE = {
8045
8413
  },
8046
8414
  },
8047
8415
  responseOnlyKeys: {
8416
+ // #5534 — the authored schemas and their provenance, on the detail
8417
+ // and the write responses (not the list).
8418
+ source: {
8419
+ kind: "server-owned",
8420
+ note: "The authored schema of each field whose compile inlined a ref " +
8421
+ "(null when none did); `config pull` writes it back.",
8422
+ },
8423
+ provenance: {
8424
+ kind: "server-owned",
8425
+ note: "Each such field's pointer → ref chain map; read by `config diff` for pins.",
8426
+ },
8048
8427
  configs: {
8049
8428
  kind: "structural",
8050
8429
  note: "The prompt's AppPromptConfig rows, returned inline on the detail " +
@@ -8328,6 +8707,27 @@ export const PROMPT_SURFACE = {
8328
8707
  note: "Where an oversized userPromptTemplate was offloaded. Assigned by " +
8329
8708
  "storeField; the value round-trips through `userPromptTemplate`.",
8330
8709
  },
8710
+ // #5534 — the authored schemas and their provenance, kept beside the
8711
+ // compiled ones in the fields above. Written by the server's compile;
8712
+ // read back as the detail's `source` and `provenance`.
8713
+ schemaSource: {
8714
+ kind: "server-owned",
8715
+ note: "The authored outputSchema of a write whose compile inlined a ref, " +
8716
+ "as one JSON object; returned as `source`.",
8717
+ },
8718
+ schemaSourceR2Key: {
8719
+ kind: "server-owned",
8720
+ note: "Where an oversized schemaSource was offloaded, under a per-write key.",
8721
+ },
8722
+ schemaProvenance: {
8723
+ kind: "server-owned",
8724
+ note: "The outputSchema's pointer → ref chain map, with the h1: hash of " +
8725
+ "each inlined definition; returned as `provenance`.",
8726
+ },
8727
+ schemaProvenanceR2Key: {
8728
+ kind: "server-owned",
8729
+ note: "Where an oversized schemaProvenance was offloaded, under a per-write key.",
8730
+ },
8331
8731
  createdBy: {
8332
8732
  kind: "server-owned",
8333
8733
  note: "Admin who created the config; assigned server-side.",
@@ -8354,7 +8754,33 @@ export const PROMPT_SURFACE = {
8354
8754
  "(activatePromptConfig), never as a config-body key.",
8355
8755
  },
8356
8756
  },
8357
- responseOnlyKeys: {},
8757
+ requestOnlyKeys: {
8758
+ // #5534 — the CLI's compile of the schemas the body carries, which the
8759
+ // server recompiles and compares; never stored as sent.
8760
+ compiled: {
8761
+ note: "The compiled form of each schema field the body carries " +
8762
+ "({ outputSchema? }), sent by `config push`. " +
8763
+ "The server recompiles and refuses PROMPT_SCHEMA_COMPILED_MISMATCH " +
8764
+ "when they differ.",
8765
+ },
8766
+ provenance: {
8767
+ note: "The provenance of each field in `compiled`, which the server " +
8768
+ "compares with its own; required with `compiled`.",
8769
+ },
8770
+ },
8771
+ responseOnlyKeys: {
8772
+ // #5534 — the authored schemas and their provenance, on every config
8773
+ // response.
8774
+ source: {
8775
+ kind: "server-owned",
8776
+ note: "The authored schema of each field whose compile inlined a ref " +
8777
+ "(null when none did); `config pull` writes it back.",
8778
+ },
8779
+ provenance: {
8780
+ kind: "server-owned",
8781
+ note: "Each such field's pointer → ref chain map; read by `config diff` for pins.",
8782
+ },
8783
+ },
8358
8784
  },
8359
8785
  ],
8360
8786
  // Both of a prompt file's tables ARE field tables (`[prompt]` and the
@@ -10612,6 +11038,79 @@ export const APP_SETTINGS_SURFACE = {
10612
11038
  // top-level key. (App config VARS live in their own `vars.toml`.)
10613
11039
  tomlDocumentKeys: {},
10614
11040
  };
11041
+ // ── src/config-surface/user-properties.ts ────────────────────────────────
11042
+ /**
11043
+ * The `user-properties` configuration object's definition (#5385, project
11044
+ * `user-index-properties` phase 2).
11045
+ *
11046
+ * `user-properties.toml` is a root singleton beside `app.toml`, so — like
11047
+ * `app-settings` and `test-case` — it is named explicitly rather than reached
11048
+ * through `SYNC_RESOURCE_TYPES`. Its keys are the app's own: each
11049
+ * `[fields.<name>]` table declares a property in the db3 field grammar plus
11050
+ * `client`, and each `[[unique_constraints]]` entry names two or more of them.
11051
+ * There is no fixed key/value table to define, so the surface declares
11052
+ * `noFieldTable`; the file is parsed, normalized and judged by one module,
11053
+ * `src/user-index/properties-schema.ts`, which the CLI vendors byte for byte
11054
+ * (`cli/src/lib/user-properties/generated-properties-schema.ts`) and which
11055
+ * `config push`'s preflight runs before anything is applied. The pushed
11056
+ * schema is stored on the app's `UserPropertiesConfig` row.
11057
+ */
11058
+ export const USER_PROPERTIES_SURFACE = {
11059
+ label: "user-properties",
11060
+ tables: [],
11061
+ noFieldTable: {
11062
+ note: "Every key under [fields] is a property name the app declares; the field grammar, the client values and the " +
11063
+ "constraint rules are the schema module's (src/user-index/properties-schema.ts), run by config push's preflight " +
11064
+ "through its vendored copy and again by the push route",
11065
+ },
11066
+ tomlDocumentKeys: {
11067
+ fields: {
11068
+ kind: "structural",
11069
+ note: "[fields.<name>] tables: one property each, parsed whole by parseUserPropertiesToml and sent as the file's text",
11070
+ },
11071
+ unique_constraints: {
11072
+ kind: "structural",
11073
+ note: "[[unique_constraints]] entries { name, fields }, parsed whole by parseUserPropertiesToml with the fields",
11074
+ },
11075
+ },
11076
+ noCrossFieldRules: {
11077
+ note: "The file's rules span fields and constraints but are not field-table rules: parseUserPropertiesToml " +
11078
+ "(src/user-index/properties-schema.ts) decides every one, from the file alone, at config push's preflight",
11079
+ },
11080
+ };
11081
+ // ── src/config-surface/schema-file.ts ────────────────────────────────────
11082
+ /**
11083
+ * The `schema` configuration object's definition (#5532, project
11084
+ * `unified-schemas` phase 3).
11085
+ *
11086
+ * `schemas/<file>.toml` holds shared shapes: each `[defs.<Name>]` table is
11087
+ * one JSON Schema document, named by the file's stem and the def's name
11088
+ * (`schemas:<file>#/$defs/<Name>`). There is no fixed key/value table to
11089
+ * define, so the surface declares `noFieldTable`; the file is checked and
11090
+ * compiled by one module, `src/function-runs/schema-file.ts`, which the CLI
11091
+ * vendors (`cli/src/lib/schema-codegen/generated-schema-file.ts`), runs in
11092
+ * `config push`'s preflight and sends compiled with the source, and which the
11093
+ * push route runs again.
11094
+ */
11095
+ export const SCHEMA_FILE_SURFACE = {
11096
+ label: "schema",
11097
+ tables: [],
11098
+ noFieldTable: {
11099
+ note: "Every key under [defs] is a def name the file declares, and each def is a JSON Schema document; the shape, " +
11100
+ "keyword and compile rules are the schemas/ file module's (src/function-runs/schema-file.ts), run by config " +
11101
+ "push's preflight through its vendored copy and again by the push route",
11102
+ },
11103
+ tomlDocumentKeys: {
11104
+ defs: {
11105
+ kind: "structural",
11106
+ note: "[defs.<Name>] tables: one shared shape each, compiled whole by compileSchemaFile and sent as the file's text",
11107
+ },
11108
+ },
11109
+ noCrossFieldRules: {
11110
+ note: "The file's rules span defs but are not field-table rules: compileSchemaFile (src/function-runs/schema-file.ts) " +
11111
+ "decides every one, from the file alone, at config push's preflight",
11112
+ },
11113
+ };
10615
11114
  // ── src/config-surface/index.ts ──────────────────────────────────────────
10616
11115
  /**
10617
11116
  * The configuration-object registry (issue #2644).
@@ -10629,9 +11128,10 @@ export const APP_SETTINGS_SURFACE = {
10629
11128
  /**
10630
11129
  * Every configuration object whose field surface is defined here.
10631
11130
  *
10632
- * One entry per `SYNC_RESOURCE_TYPES` label, plus the two surfaces that
10633
- * round-trip without being a per-entity file: `app-settings` (`app.toml`) and
10634
- * `test-case` (`<key>.tests/`). Nothing that syncs sits outside the registry —
11131
+ * One entry per `SYNC_RESOURCE_TYPES` label, plus the three surfaces that
11132
+ * round-trip without being a per-entity file: `app-settings` (`app.toml`),
11133
+ * `user-properties` (`user-properties.toml`, #5385) and `test-case`
11134
+ * (`<key>.tests/`). Nothing that syncs sits outside the registry —
10635
11135
  * `PENDING_MIGRATION`, the migration's temporary exemption list, is gone as of
10636
11136
  * phase 3, so a new synced type has nowhere to be parked and fails the registry
10637
11137
  * guard until it is defined (#2644 criterion 3).
@@ -10648,6 +11148,8 @@ export const CONFIG_SURFACES = [
10648
11148
  SERVER_FUNCTION_SURFACE,
10649
11149
  TEST_CASE_SURFACE,
10650
11150
  APP_SETTINGS_SURFACE,
11151
+ USER_PROPERTIES_SURFACE,
11152
+ SCHEMA_FILE_SURFACE,
10651
11153
  ];
10652
11154
  /**
10653
11155
  * The configuration surfaces that have not declared their CROSS-FIELD rules yet
@@ -10790,6 +11292,10 @@ export const GENERATED_CONFIG_MODEL_FIELDS = {
10790
11292
  "copiedFromCatalogId",
10791
11293
  "inputSchema",
10792
11294
  "outputSchema",
11295
+ "schemaSource",
11296
+ "schemaSourceR2Key",
11297
+ "schemaProvenance",
11298
+ "schemaProvenanceR2Key",
10793
11299
  "activeConfigId",
10794
11300
  "defaultEvaluatorPromptId",
10795
11301
  "status",
@@ -10816,6 +11322,10 @@ export const GENERATED_CONFIG_MODEL_FIELDS = {
10816
11322
  "maxTokens",
10817
11323
  "outputFormat",
10818
11324
  "outputSchema",
11325
+ "schemaSource",
11326
+ "schemaSourceR2Key",
11327
+ "schemaProvenance",
11328
+ "schemaProvenanceR2Key",
10819
11329
  "providerConfig",
10820
11330
  "questions",
10821
11331
  "reasoningEffort",