primitive-admin 1.2.0-alpha.8 → 1.3.0-alpha.0

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 (563) hide show
  1. package/README.md +258 -186
  2. package/assets/skill/skills/primitive-platform/SKILL.md +103 -29
  3. package/dist/bin/primitive.js +15 -89
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/admins.js +80 -17
  6. package/dist/src/commands/admins.js.map +1 -1
  7. package/dist/src/commands/agent-sessions.d.ts +129 -0
  8. package/dist/src/commands/agent-sessions.js +532 -20
  9. package/dist/src/commands/agent-sessions.js.map +1 -1
  10. package/dist/src/commands/analytics.js +207 -155
  11. package/dist/src/commands/analytics.js.map +1 -1
  12. package/dist/src/commands/apps-children.d.ts +1 -1
  13. package/dist/src/commands/apps-children.js +56 -145
  14. package/dist/src/commands/apps-children.js.map +1 -1
  15. package/dist/src/commands/apps-transitions.d.ts +39 -0
  16. package/dist/src/commands/apps-transitions.js +198 -0
  17. package/dist/src/commands/apps-transitions.js.map +1 -0
  18. package/dist/src/commands/apps.d.ts +17 -0
  19. package/dist/src/commands/apps.js +108 -3
  20. package/dist/src/commands/apps.js.map +1 -1
  21. package/dist/src/commands/auth-sessions.js +2 -0
  22. package/dist/src/commands/auth-sessions.js.map +1 -1
  23. package/dist/src/commands/auth.js +138 -44
  24. package/dist/src/commands/auth.js.map +1 -1
  25. package/dist/src/commands/blob-buckets.js +2 -0
  26. package/dist/src/commands/blob-buckets.js.map +1 -1
  27. package/dist/src/commands/collections.js +318 -256
  28. package/dist/src/commands/collections.js.map +1 -1
  29. package/dist/src/commands/comparisons.js +2 -0
  30. package/dist/src/commands/comparisons.js.map +1 -1
  31. package/dist/src/commands/config.d.ts +2 -2
  32. package/dist/src/commands/config.js +59 -33
  33. package/dist/src/commands/config.js.map +1 -1
  34. package/dist/src/commands/connections.js +2 -0
  35. package/dist/src/commands/connections.js.map +1 -1
  36. package/dist/src/commands/database-type-configs.js +5 -3
  37. package/dist/src/commands/database-type-configs.js.map +1 -1
  38. package/dist/src/commands/database-types.js +13 -313
  39. package/dist/src/commands/database-types.js.map +1 -1
  40. package/dist/src/commands/databases.js +6 -4
  41. package/dist/src/commands/databases.js.map +1 -1
  42. package/dist/src/commands/db3-types.d.ts +15 -0
  43. package/dist/src/commands/db3-types.js +159 -0
  44. package/dist/src/commands/db3-types.js.map +1 -0
  45. package/dist/src/commands/db3.d.ts +24 -0
  46. package/dist/src/commands/db3.js +1444 -0
  47. package/dist/src/commands/db3.js.map +1 -0
  48. package/dist/src/commands/documents.d.ts +110 -10
  49. package/dist/src/commands/documents.js +1012 -748
  50. package/dist/src/commands/documents.js.map +1 -1
  51. package/dist/src/commands/email-templates.js +74 -0
  52. package/dist/src/commands/email-templates.js.map +1 -1
  53. package/dist/src/commands/env.js +8 -4
  54. package/dist/src/commands/env.js.map +1 -1
  55. package/dist/src/commands/function-trigger-commands.d.ts +28 -0
  56. package/dist/src/commands/function-trigger-commands.js +341 -0
  57. package/dist/src/commands/function-trigger-commands.js.map +1 -0
  58. package/dist/src/commands/functions.js +376 -30
  59. package/dist/src/commands/functions.js.map +1 -1
  60. package/dist/src/commands/groups.js +168 -50
  61. package/dist/src/commands/groups.js.map +1 -1
  62. package/dist/src/commands/guides.js +7 -5
  63. package/dist/src/commands/guides.js.map +1 -1
  64. package/dist/src/commands/hosting.d.ts +8 -0
  65. package/dist/src/commands/hosting.js +346 -0
  66. package/dist/src/commands/hosting.js.map +1 -0
  67. package/dist/src/commands/init.js +129 -38
  68. package/dist/src/commands/init.js.map +1 -1
  69. package/dist/src/commands/integrations.js +82 -53
  70. package/dist/src/commands/integrations.js.map +1 -1
  71. package/dist/src/commands/llm.js +9 -6
  72. package/dist/src/commands/llm.js.map +1 -1
  73. package/dist/src/commands/locks.d.ts +5 -3
  74. package/dist/src/commands/locks.js +19 -61
  75. package/dist/src/commands/locks.js.map +1 -1
  76. package/dist/src/commands/metadata-category-configs.d.ts +2 -2
  77. package/dist/src/commands/metadata-category-configs.js +4 -2
  78. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  79. package/dist/src/commands/metadata.js +41 -0
  80. package/dist/src/commands/metadata.js.map +1 -1
  81. package/dist/src/commands/prompts.js +75 -52
  82. package/dist/src/commands/prompts.js.map +1 -1
  83. package/dist/src/commands/rate-counters.d.ts +19 -0
  84. package/dist/src/commands/rate-counters.js +104 -0
  85. package/dist/src/commands/rate-counters.js.map +1 -0
  86. package/dist/src/commands/rule-sets.d.ts +1 -1
  87. package/dist/src/commands/rule-sets.js +2 -1
  88. package/dist/src/commands/rule-sets.js.map +1 -1
  89. package/dist/src/commands/schemas.d.ts +15 -0
  90. package/dist/src/commands/schemas.js +122 -0
  91. package/dist/src/commands/schemas.js.map +1 -0
  92. package/dist/src/commands/scripts.d.ts +9 -17
  93. package/dist/src/commands/scripts.js +24 -479
  94. package/dist/src/commands/scripts.js.map +1 -1
  95. package/dist/src/commands/secrets.js +47 -3
  96. package/dist/src/commands/secrets.js.map +1 -1
  97. package/dist/src/commands/sessions.js +2 -0
  98. package/dist/src/commands/sessions.js.map +1 -1
  99. package/dist/src/commands/settings.d.ts +12 -9
  100. package/dist/src/commands/settings.js +31 -79
  101. package/dist/src/commands/settings.js.map +1 -1
  102. package/dist/src/commands/skill.js +2 -0
  103. package/dist/src/commands/skill.js.map +1 -1
  104. package/dist/src/commands/sync-schemas.d.ts +202 -0
  105. package/dist/src/commands/sync-schemas.js +629 -0
  106. package/dist/src/commands/sync-schemas.js.map +1 -0
  107. package/dist/src/commands/sync-user-properties.d.ts +118 -0
  108. package/dist/src/commands/sync-user-properties.js +276 -0
  109. package/dist/src/commands/sync-user-properties.js.map +1 -0
  110. package/dist/src/commands/sync.d.ts +519 -554
  111. package/dist/src/commands/sync.js +3010 -4909
  112. package/dist/src/commands/sync.js.map +1 -1
  113. package/dist/src/commands/tokens.js +5 -3
  114. package/dist/src/commands/tokens.js.map +1 -1
  115. package/dist/src/commands/transitions.d.ts +54 -0
  116. package/dist/src/commands/transitions.js +418 -0
  117. package/dist/src/commands/transitions.js.map +1 -0
  118. package/dist/src/commands/usage.d.ts +18 -0
  119. package/dist/src/commands/usage.js +343 -0
  120. package/dist/src/commands/usage.js.map +1 -0
  121. package/dist/src/commands/user-properties.d.ts +14 -0
  122. package/dist/src/commands/user-properties.js +79 -0
  123. package/dist/src/commands/user-properties.js.map +1 -0
  124. package/dist/src/commands/users.js +911 -18
  125. package/dist/src/commands/users.js.map +1 -1
  126. package/dist/src/commands/vars.js +2 -0
  127. package/dist/src/commands/vars.js.map +1 -1
  128. package/dist/src/commands/waitlist.js +39 -4
  129. package/dist/src/commands/waitlist.js.map +1 -1
  130. package/dist/src/commands/workflows.d.ts +5 -83
  131. package/dist/src/commands/workflows.js +57 -2282
  132. package/dist/src/commands/workflows.js.map +1 -1
  133. package/dist/src/lib/analytics-query.d.ts +58 -0
  134. package/dist/src/lib/analytics-query.js +134 -0
  135. package/dist/src/lib/analytics-query.js.map +1 -0
  136. package/dist/src/lib/api-client.d.ts +1830 -429
  137. package/dist/src/lib/api-client.js +1025 -546
  138. package/dist/src/lib/api-client.js.map +1 -1
  139. package/dist/src/lib/app-settings-descriptor.d.ts +1 -1
  140. package/dist/src/lib/app-settings-descriptor.js +6 -0
  141. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  142. package/dist/src/lib/auth-fixtures.d.ts +44 -0
  143. package/dist/src/lib/auth-fixtures.js +61 -0
  144. package/dist/src/lib/auth-fixtures.js.map +1 -0
  145. package/dist/src/lib/auth-flow.d.ts +34 -1
  146. package/dist/src/lib/auth-flow.js +429 -13
  147. package/dist/src/lib/auth-flow.js.map +1 -1
  148. package/dist/src/lib/block-layout.d.ts +12 -23
  149. package/dist/src/lib/block-layout.js +26 -92
  150. package/dist/src/lib/block-layout.js.map +1 -1
  151. package/dist/src/lib/block-selector.d.ts +8 -14
  152. package/dist/src/lib/block-selector.js +8 -19
  153. package/dist/src/lib/block-selector.js.map +1 -1
  154. package/dist/src/lib/child-apps-local.d.ts +3 -47
  155. package/dist/src/lib/child-apps-local.js +11 -73
  156. package/dist/src/lib/child-apps-local.js.map +1 -1
  157. package/dist/src/lib/cli-manifest.d.ts +9 -0
  158. package/dist/src/lib/cli-manifest.js +10 -1
  159. package/dist/src/lib/cli-manifest.js.map +1 -1
  160. package/dist/src/lib/cli-version.d.ts +14 -0
  161. package/dist/src/lib/cli-version.js +38 -0
  162. package/dist/src/lib/cli-version.js.map +1 -0
  163. package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
  164. package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
  165. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
  166. package/dist/src/lib/collection-export.d.ts +76 -15
  167. package/dist/src/lib/collection-export.js +116 -23
  168. package/dist/src/lib/collection-export.js.map +1 -1
  169. package/dist/src/lib/collection-principal.d.ts +22 -0
  170. package/dist/src/lib/collection-principal.js +35 -0
  171. package/dist/src/lib/collection-principal.js.map +1 -0
  172. package/dist/src/lib/command-groups.d.ts +30 -0
  173. package/dist/src/lib/command-groups.js +109 -0
  174. package/dist/src/lib/command-groups.js.map +1 -0
  175. package/dist/src/lib/command-status.d.ts +147 -0
  176. package/dist/src/lib/command-status.js +266 -0
  177. package/dist/src/lib/command-status.js.map +1 -0
  178. package/dist/src/lib/config-object-descriptor.d.ts +9 -22
  179. package/dist/src/lib/config-object-descriptor.js +107 -276
  180. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  181. package/dist/src/lib/config-surface.d.ts +3 -7
  182. package/dist/src/lib/config-surface.js +9 -13
  183. package/dist/src/lib/config-surface.js.map +1 -1
  184. package/dist/src/lib/config-toml.d.ts +11 -2
  185. package/dist/src/lib/config-toml.js +25 -2
  186. package/dist/src/lib/config-toml.js.map +1 -1
  187. package/dist/src/lib/credentials-home.d.ts +7 -0
  188. package/dist/src/lib/credentials-home.js +45 -10
  189. package/dist/src/lib/credentials-home.js.map +1 -1
  190. package/dist/src/lib/credentials-lock.d.ts +14 -6
  191. package/dist/src/lib/credentials-lock.js +90 -10
  192. package/dist/src/lib/credentials-lock.js.map +1 -1
  193. package/dist/src/lib/credentials-store.d.ts +123 -70
  194. package/dist/src/lib/credentials-store.js +358 -113
  195. package/dist/src/lib/credentials-store.js.map +1 -1
  196. package/dist/src/lib/custodian.d.ts +8 -0
  197. package/dist/src/lib/custodian.js +18 -0
  198. package/dist/src/lib/custodian.js.map +1 -0
  199. package/dist/src/lib/data-input.d.ts +1 -1
  200. package/dist/src/lib/data-input.js +1 -1
  201. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
  202. package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
  203. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  204. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +38 -1
  205. package/dist/src/lib/db-codegen/dbTypeIR.js +29 -7
  206. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  207. package/dist/src/lib/db-type-records.d.ts +106 -0
  208. package/dist/src/lib/db-type-records.js +224 -0
  209. package/dist/src/lib/db-type-records.js.map +1 -0
  210. package/dist/src/lib/db3-export.d.ts +287 -0
  211. package/dist/src/lib/db3-export.js +647 -0
  212. package/dist/src/lib/db3-export.js.map +1 -0
  213. package/dist/src/lib/db3-index-output.d.ts +116 -0
  214. package/dist/src/lib/db3-index-output.js +223 -0
  215. package/dist/src/lib/db3-index-output.js.map +1 -0
  216. package/dist/src/lib/db3-type-models.d.ts +134 -0
  217. package/dist/src/lib/db3-type-models.js +452 -0
  218. package/dist/src/lib/db3-type-models.js.map +1 -0
  219. package/dist/src/lib/deprecation.d.ts +2 -2
  220. package/dist/src/lib/deprecation.js +2 -2
  221. package/dist/src/lib/document-ingest-artifact.d.ts +13 -0
  222. package/dist/src/lib/document-ingest-artifact.js +36 -6
  223. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  224. package/dist/src/lib/document-ingest-format2.d.ts +36 -0
  225. package/dist/src/lib/document-ingest-format2.js +78 -0
  226. package/dist/src/lib/document-ingest-format2.js.map +1 -0
  227. package/dist/src/lib/document-ingest-input.d.ts +9 -0
  228. package/dist/src/lib/document-ingest-input.js +28 -1
  229. package/dist/src/lib/document-ingest-input.js.map +1 -1
  230. package/dist/src/lib/document-ingest.d.ts +11 -1
  231. package/dist/src/lib/document-ingest.js +16 -0
  232. package/dist/src/lib/document-ingest.js.map +1 -1
  233. package/dist/src/lib/document-schema-rows.d.ts +42 -0
  234. package/dist/src/lib/document-schema-rows.js +53 -0
  235. package/dist/src/lib/document-schema-rows.js.map +1 -0
  236. package/dist/src/lib/experimental-apis.d.ts +36 -0
  237. package/dist/src/lib/experimental-apis.js +46 -0
  238. package/dist/src/lib/experimental-apis.js.map +1 -0
  239. package/dist/src/lib/file-attachment.d.ts +24 -0
  240. package/dist/src/lib/file-attachment.js +31 -0
  241. package/dist/src/lib/file-attachment.js.map +1 -0
  242. package/dist/src/lib/function-authorize-check.d.ts +142 -0
  243. package/dist/src/lib/function-authorize-check.js +311 -0
  244. package/dist/src/lib/function-authorize-check.js.map +1 -0
  245. package/dist/src/lib/function-authorize-view.d.ts +27 -0
  246. package/dist/src/lib/function-authorize-view.js +88 -0
  247. package/dist/src/lib/function-authorize-view.js.map +1 -0
  248. package/dist/src/lib/function-bundle.d.ts +27 -5
  249. package/dist/src/lib/function-bundle.js +142 -7
  250. package/dist/src/lib/function-bundle.js.map +1 -1
  251. package/dist/src/lib/function-collect.d.ts +90 -12
  252. package/dist/src/lib/function-collect.js +482 -12
  253. package/dist/src/lib/function-collect.js.map +1 -1
  254. package/dist/src/lib/function-db-types.d.ts +65 -11
  255. package/dist/src/lib/function-db-types.js +297 -157
  256. package/dist/src/lib/function-db-types.js.map +1 -1
  257. package/dist/src/lib/function-document-types.d.ts +19 -7
  258. package/dist/src/lib/function-document-types.js +24 -12
  259. package/dist/src/lib/function-document-types.js.map +1 -1
  260. package/dist/src/lib/function-lint.d.ts +57 -0
  261. package/dist/src/lib/function-lint.js +234 -0
  262. package/dist/src/lib/function-lint.js.map +1 -0
  263. package/dist/src/lib/function-log-row.js +21 -2
  264. package/dist/src/lib/function-log-row.js.map +1 -1
  265. package/dist/src/lib/function-run.d.ts +13 -21
  266. package/dist/src/lib/function-run.js +14 -27
  267. package/dist/src/lib/function-run.js.map +1 -1
  268. package/dist/src/lib/function-schema-codegen.d.ts +86 -22
  269. package/dist/src/lib/function-schema-codegen.js +194 -88
  270. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  271. package/dist/src/lib/function-schema-refs.d.ts +98 -0
  272. package/dist/src/lib/function-schema-refs.js +177 -0
  273. package/dist/src/lib/function-schema-refs.js.map +1 -0
  274. package/dist/src/lib/function-sync.d.ts +109 -6
  275. package/dist/src/lib/function-sync.js +179 -26
  276. package/dist/src/lib/function-sync.js.map +1 -1
  277. package/dist/src/lib/function-trigger-listing.d.ts +11 -6
  278. package/dist/src/lib/function-trigger-listing.js +32 -11
  279. package/dist/src/lib/function-trigger-listing.js.map +1 -1
  280. package/dist/src/lib/function-triggers.d.ts +15 -3
  281. package/dist/src/lib/function-triggers.js +72 -10
  282. package/dist/src/lib/function-triggers.js.map +1 -1
  283. package/dist/src/lib/function-typecheck.d.ts +52 -0
  284. package/dist/src/lib/function-typecheck.js +174 -54
  285. package/dist/src/lib/function-typecheck.js.map +1 -1
  286. package/dist/src/lib/function-versions.d.ts +2 -0
  287. package/dist/src/lib/function-versions.js +1 -0
  288. package/dist/src/lib/function-versions.js.map +1 -1
  289. package/dist/src/lib/generated-build-flags.d.ts +13 -0
  290. package/dist/src/lib/generated-build-flags.js +14 -0
  291. package/dist/src/lib/generated-build-flags.js.map +1 -0
  292. package/dist/src/lib/generated-command-status.d.ts +6 -0
  293. package/dist/src/lib/generated-command-status.js +469 -0
  294. package/dist/src/lib/generated-command-status.js.map +1 -0
  295. package/dist/src/lib/generated-config-surfaces.d.ts +586 -152
  296. package/dist/src/lib/generated-config-surfaces.js +1919 -1883
  297. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  298. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  299. package/dist/src/lib/generated-sdk-types.js +1 -1
  300. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  301. package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
  302. package/dist/src/lib/generated-workflow-model-fields.js +53 -0
  303. package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
  304. package/dist/src/lib/hosting-build.d.ts +97 -0
  305. package/dist/src/lib/hosting-build.js +204 -0
  306. package/dist/src/lib/hosting-build.js.map +1 -0
  307. package/dist/src/lib/hosting-client.d.ts +167 -0
  308. package/dist/src/lib/hosting-client.js +340 -0
  309. package/dist/src/lib/hosting-client.js.map +1 -0
  310. package/dist/src/lib/hosting-environments.d.ts +32 -0
  311. package/dist/src/lib/hosting-environments.js +74 -0
  312. package/dist/src/lib/hosting-environments.js.map +1 -0
  313. package/dist/src/lib/hosting-errors.d.ts +30 -0
  314. package/dist/src/lib/hosting-errors.js +43 -0
  315. package/dist/src/lib/hosting-errors.js.map +1 -0
  316. package/dist/src/lib/hosting-token.d.ts +46 -0
  317. package/dist/src/lib/hosting-token.js +60 -0
  318. package/dist/src/lib/hosting-token.js.map +1 -0
  319. package/dist/src/lib/hosting-wait.d.ts +42 -0
  320. package/dist/src/lib/hosting-wait.js +84 -0
  321. package/dist/src/lib/hosting-wait.js.map +1 -0
  322. package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
  323. package/dist/src/lib/hosting-wfp-upload.js +149 -0
  324. package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
  325. package/dist/src/lib/init-assets.d.ts +2 -6
  326. package/dist/src/lib/init-assets.js +11 -27
  327. package/dist/src/lib/init-assets.js.map +1 -1
  328. package/dist/src/lib/init-ios-links.d.ts +11 -7
  329. package/dist/src/lib/init-ios-links.js +28 -22
  330. package/dist/src/lib/init-ios-links.js.map +1 -1
  331. package/dist/src/lib/init-login-note.d.ts +13 -0
  332. package/dist/src/lib/init-login-note.js +22 -0
  333. package/dist/src/lib/init-login-note.js.map +1 -0
  334. package/dist/src/lib/init-schema.d.ts +15 -0
  335. package/dist/src/lib/init-schema.js +54 -0
  336. package/dist/src/lib/init-schema.js.map +1 -1
  337. package/dist/src/lib/integration-test-request.d.ts +54 -0
  338. package/dist/src/lib/integration-test-request.js +207 -0
  339. package/dist/src/lib/integration-test-request.js.map +1 -0
  340. package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
  341. package/dist/src/lib/invoker-shared-enums.js +98 -0
  342. package/dist/src/lib/invoker-shared-enums.js.map +1 -0
  343. package/dist/src/lib/json-value.d.ts +6 -0
  344. package/dist/src/lib/json-value.js +13 -0
  345. package/dist/src/lib/json-value.js.map +1 -0
  346. package/dist/src/lib/load-routes.d.ts +33 -0
  347. package/dist/src/lib/load-routes.js +35 -0
  348. package/dist/src/lib/load-routes.js.map +1 -0
  349. package/dist/src/lib/log-inspection.d.ts +23 -4
  350. package/dist/src/lib/log-inspection.js +14 -5
  351. package/dist/src/lib/log-inspection.js.map +1 -1
  352. package/dist/src/lib/login-exchange-check.d.ts +18 -0
  353. package/dist/src/lib/login-exchange-check.js +27 -0
  354. package/dist/src/lib/login-exchange-check.js.map +1 -0
  355. package/dist/src/lib/login-scope-lines.d.ts +17 -7
  356. package/dist/src/lib/login-scope-lines.js +33 -10
  357. package/dist/src/lib/login-scope-lines.js.map +1 -1
  358. package/dist/src/lib/metadata-report.d.ts +85 -0
  359. package/dist/src/lib/metadata-report.js +81 -0
  360. package/dist/src/lib/metadata-report.js.map +1 -0
  361. package/dist/src/lib/object-status-filter.d.ts +9 -1
  362. package/dist/src/lib/object-status-filter.js +9 -1
  363. package/dist/src/lib/object-status-filter.js.map +1 -1
  364. package/dist/src/lib/output.d.ts +1 -1
  365. package/dist/src/lib/output.js +3 -1
  366. package/dist/src/lib/output.js.map +1 -1
  367. package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
  368. package/dist/src/lib/pin-refusal-hint.js +35 -0
  369. package/dist/src/lib/pin-refusal-hint.js.map +1 -0
  370. package/dist/src/lib/platform-owned.js +5 -0
  371. package/dist/src/lib/platform-owned.js.map +1 -1
  372. package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
  373. package/dist/src/lib/primitive-declaration-names.js +22 -0
  374. package/dist/src/lib/primitive-declaration-names.js.map +1 -0
  375. package/dist/src/lib/primitive-declaration.d.ts +174 -0
  376. package/dist/src/lib/primitive-declaration.js +792 -0
  377. package/dist/src/lib/primitive-declaration.js.map +1 -0
  378. package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
  379. package/dist/src/lib/primitive-env-plugin.js +408 -0
  380. package/dist/src/lib/primitive-env-plugin.js.map +1 -0
  381. package/dist/src/lib/project-login-apps.d.ts +8 -0
  382. package/dist/src/lib/project-login-apps.js +27 -0
  383. package/dist/src/lib/project-login-apps.js.map +1 -0
  384. package/dist/src/lib/prompt-schema-codegen.d.ts +46 -15
  385. package/dist/src/lib/prompt-schema-codegen.js +142 -108
  386. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  387. package/dist/src/lib/prompt-schema-document.d.ts +35 -0
  388. package/dist/src/lib/prompt-schema-document.js +92 -0
  389. package/dist/src/lib/prompt-schema-document.js.map +1 -0
  390. package/dist/src/lib/prompt-schema-refs.d.ts +173 -0
  391. package/dist/src/lib/prompt-schema-refs.js +478 -0
  392. package/dist/src/lib/prompt-schema-refs.js.map +1 -0
  393. package/dist/src/lib/records-verbs.d.ts +79 -0
  394. package/dist/src/lib/records-verbs.js +45 -0
  395. package/dist/src/lib/records-verbs.js.map +1 -0
  396. package/dist/src/lib/register-commands.d.ts +36 -0
  397. package/dist/src/lib/register-commands.js +37 -0
  398. package/dist/src/lib/register-commands.js.map +1 -0
  399. package/dist/src/lib/retired-imports.d.ts +53 -0
  400. package/dist/src/lib/retired-imports.js +120 -0
  401. package/dist/src/lib/retired-imports.js.map +1 -0
  402. package/dist/src/lib/run-status.d.ts +1 -1
  403. package/dist/src/lib/run-status.generated.d.ts +2 -2
  404. package/dist/src/lib/run-status.generated.js +3 -1
  405. package/dist/src/lib/run-status.generated.js.map +1 -1
  406. package/dist/src/lib/run-status.js +1 -1
  407. package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
  408. package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
  409. package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
  410. package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
  411. package/dist/src/lib/schema-codegen/generated-db3-bridge.js +227 -0
  412. package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
  413. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
  414. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
  415. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
  416. package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +218 -0
  417. package/dist/src/lib/schema-codegen/generated-field-grammar.js +397 -0
  418. package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
  419. package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
  420. package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
  421. package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
  422. package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
  423. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
  424. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
  425. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +258 -0
  426. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +422 -0
  427. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
  428. package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
  429. package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
  430. package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
  431. package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
  432. package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
  433. package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
  434. package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
  435. package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
  436. package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
  437. package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
  438. package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
  439. package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
  440. package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
  441. package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
  442. package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
  443. package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
  444. package/dist/src/lib/schema-codegen/naming.js +83 -0
  445. package/dist/src/lib/schema-codegen/naming.js.map +1 -0
  446. package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
  447. package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
  448. package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
  449. package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
  450. package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
  451. package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
  452. package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
  453. package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
  454. package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
  455. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +109 -0
  456. package/dist/src/lib/schema-codegen/schemaToTs.js +269 -0
  457. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
  458. package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
  459. package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
  460. package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
  461. package/dist/src/lib/schema-family-index.d.ts +228 -0
  462. package/dist/src/lib/schema-family-index.js +813 -0
  463. package/dist/src/lib/schema-family-index.js.map +1 -0
  464. package/dist/src/lib/schema-pins.d.ts +82 -0
  465. package/dist/src/lib/schema-pins.js +198 -0
  466. package/dist/src/lib/schema-pins.js.map +1 -0
  467. package/dist/src/lib/schema-preview.d.ts +244 -0
  468. package/dist/src/lib/schema-preview.js +498 -0
  469. package/dist/src/lib/schema-preview.js.map +1 -0
  470. package/dist/src/lib/scope-request.d.ts +23 -11
  471. package/dist/src/lib/scope-request.js +69 -31
  472. package/dist/src/lib/scope-request.js.map +1 -1
  473. package/dist/src/lib/session-scope.d.ts +26 -0
  474. package/dist/src/lib/session-scope.js +58 -0
  475. package/dist/src/lib/session-scope.js.map +1 -0
  476. package/dist/src/lib/skill-installer.d.ts +2 -2
  477. package/dist/src/lib/skill-installer.js +2 -21
  478. package/dist/src/lib/skill-installer.js.map +1 -1
  479. package/dist/src/lib/step-run-table.d.ts +1 -2
  480. package/dist/src/lib/step-run-table.js +1 -2
  481. package/dist/src/lib/step-run-table.js.map +1 -1
  482. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +8 -3
  483. package/dist/src/lib/swift-codegen/agentGenerator.js +76 -22
  484. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  485. package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
  486. package/dist/src/lib/swift-codegen/banners.js +12 -0
  487. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  488. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
  489. package/dist/src/lib/swift-codegen/functionGenerator.js +169 -51
  490. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  491. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +33 -9
  492. package/dist/src/lib/swift-codegen/schemaToSwift.js +215 -179
  493. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  494. package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
  495. package/dist/src/lib/swift-codegen/sharedGenerator.js +165 -0
  496. package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
  497. package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
  498. package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
  499. package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
  500. package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
  501. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
  502. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
  503. package/dist/src/lib/sync-resource-types.d.ts +117 -31
  504. package/dist/src/lib/sync-resource-types.js +197 -189
  505. package/dist/src/lib/sync-resource-types.js.map +1 -1
  506. package/dist/src/lib/sync-selectors.d.ts +7 -0
  507. package/dist/src/lib/sync-selectors.js +22 -2
  508. package/dist/src/lib/sync-selectors.js.map +1 -1
  509. package/dist/src/lib/template.d.ts +39 -3
  510. package/dist/src/lib/template.js +103 -14
  511. package/dist/src/lib/template.js.map +1 -1
  512. package/dist/src/lib/test-case-file-names.d.ts +3 -5
  513. package/dist/src/lib/test-case-file-names.js +3 -5
  514. package/dist/src/lib/test-case-file-names.js.map +1 -1
  515. package/dist/src/lib/test-runs.d.ts +45 -0
  516. package/dist/src/lib/test-runs.js +150 -0
  517. package/dist/src/lib/test-runs.js.map +1 -0
  518. package/dist/src/lib/test-users.d.ts +25 -0
  519. package/dist/src/lib/test-users.js +36 -0
  520. package/dist/src/lib/test-users.js.map +1 -0
  521. package/dist/src/lib/toml-database-config.d.ts +4 -2
  522. package/dist/src/lib/toml-database-config.js +11 -6
  523. package/dist/src/lib/toml-database-config.js.map +1 -1
  524. package/dist/src/lib/toml-scalar-edit.js +6 -4
  525. package/dist/src/lib/toml-scalar-edit.js.map +1 -1
  526. package/dist/src/lib/transition-warnings.d.ts +21 -0
  527. package/dist/src/lib/transition-warnings.js +49 -0
  528. package/dist/src/lib/transition-warnings.js.map +1 -0
  529. package/dist/src/lib/user-index.d.ts +80 -0
  530. package/dist/src/lib/user-index.js +166 -0
  531. package/dist/src/lib/user-index.js.map +1 -0
  532. package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
  533. package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
  534. package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
  535. package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
  536. package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
  537. package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
  538. package/dist/src/lib/user-walk.d.ts +31 -0
  539. package/dist/src/lib/user-walk.js +102 -0
  540. package/dist/src/lib/user-walk.js.map +1 -0
  541. package/dist/src/lib/webhook-capture.d.ts +43 -0
  542. package/dist/src/lib/webhook-capture.js +91 -0
  543. package/dist/src/lib/webhook-capture.js.map +1 -0
  544. package/dist/src/lib/webhook-deliver.d.ts +18 -20
  545. package/dist/src/lib/webhook-deliver.js +34 -89
  546. package/dist/src/lib/webhook-deliver.js.map +1 -1
  547. package/dist/src/lib/webhook-test-run.d.ts +32 -0
  548. package/dist/src/lib/webhook-test-run.js +108 -0
  549. package/dist/src/lib/webhook-test-run.js.map +1 -0
  550. package/dist/src/lib/worker-perf-format.d.ts +22 -0
  551. package/dist/src/lib/worker-perf-format.js +27 -0
  552. package/dist/src/lib/worker-perf-format.js.map +1 -0
  553. package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
  554. package/dist/src/lib/workflow-field-descriptor.js +153 -0
  555. package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
  556. package/dist/src/types/index.d.ts +20 -65
  557. package/dist/src/validators.d.ts +7 -55
  558. package/dist/src/validators.js +7 -53
  559. package/dist/src/validators.js.map +1 -1
  560. package/dist/src/vite.d.ts +17 -0
  561. package/dist/src/vite.js +18 -0
  562. package/dist/src/vite.js.map +1 -0
  563. package/package.json +20 -9
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, unlinkSync, } from "fs";
17
17
  import { basename, dirname, join, resolve, sep } from "path";
18
- import { parseConfigToml } from "./config-toml.js";
18
+ import { parseRawToml } from "./config-toml.js";
19
19
  const tomlFile = (key) => `${key}.toml`;
20
20
  /**
21
21
  * Rule sets are keyed on disk (and in sync state) by their name with
@@ -43,24 +43,6 @@ export const SYNC_RESOURCE_TYPES = [
43
43
  // `/admin/api/apps/{id}/integrations` paginates; pull drains it with fetchAll.
44
44
  listingComplete: true,
45
45
  },
46
- {
47
- label: "webhook",
48
- dir: "webhooks",
49
- ext: ".toml",
50
- stateSlot: "webhooks",
51
- fileFromKey: tomlFile,
52
- // `/admin/api/apps/{id}/webhooks` paginates; pull drains it with fetchAll.
53
- listingComplete: true,
54
- },
55
- {
56
- label: "cron-trigger",
57
- dir: "cron-triggers",
58
- ext: ".toml",
59
- stateSlot: "cronTriggers",
60
- fileFromKey: tomlFile,
61
- // Server drains `triggersByApp` and filters archived across the full set (#1668).
62
- listingComplete: true,
63
- },
64
46
  {
65
47
  label: "blob-bucket",
66
48
  dir: "blob-buckets",
@@ -80,30 +62,6 @@ export const SYNC_RESOURCE_TYPES = [
80
62
  // `/admin/api/apps/{id}/prompts` paginates; pull drains it with fetchAll.
81
63
  listingComplete: true,
82
64
  },
83
- {
84
- label: "workflow",
85
- dir: "workflows",
86
- ext: ".toml",
87
- stateSlot: "workflows",
88
- fileFromKey: tomlFile,
89
- testBlockType: "workflow",
90
- // #2645 — named config bodies live in `workflows/<key>.configs/`.
91
- namedConfigsDirFromKey: (key) => `${key}.configs`,
92
- // `/admin/api/apps/{id}/workflows` paginates; pull drains it with fetchAll.
93
- listingComplete: true,
94
- },
95
- {
96
- // Rhai scripts: `.rhai` bodies, not TOML, with tests at
97
- // `transforms/<name>.tests/`.
98
- label: "transform",
99
- dir: "transforms",
100
- ext: ".rhai",
101
- stateSlot: "scripts",
102
- fileFromKey: (key) => `${key}.rhai`,
103
- testBlockType: "script",
104
- // Server drains `scriptsByApp` across all pages (#1668).
105
- listingComplete: true,
106
- },
107
65
  {
108
66
  // #3179 — server functions. `functions/<key>.toml` states the function and
109
67
  // names its `entry`; the TypeScript the entry reaches lives beside it in
@@ -128,6 +86,18 @@ export const SYNC_RESOURCE_TYPES = [
128
86
  // Server drains `databaseTypeConfigsForApp` across all pages (#1668).
129
87
  listingComplete: true,
130
88
  },
89
+ {
90
+ // #4802 — a db3 type: the same `DatabaseTypeConfig` row as the database
91
+ // type of its name, written by `config pull` under `db3-types/` beside
92
+ // the legacy file and applied by `config push` through `PUT db3-types`.
93
+ label: "db3-type",
94
+ dir: "db3-types",
95
+ ext: ".toml",
96
+ stateSlot: "db3Types",
97
+ fileFromKey: tomlFile,
98
+ // The same listing as the database types'.
99
+ listingComplete: true,
100
+ },
131
101
  {
132
102
  // The state key is already the sanitized filename the write loop derives
133
103
  // from the rule set's name (`name.replace(/[/\\:*?"<>|]/g, "_")`), so the
@@ -140,24 +110,6 @@ export const SYNC_RESOURCE_TYPES = [
140
110
  // Server drains `ruleSetsForApp` across all pages (#1668).
141
111
  listingComplete: true,
142
112
  },
143
- {
144
- label: "group-type-config",
145
- dir: "group-type-configs",
146
- ext: ".toml",
147
- stateSlot: "groupTypeConfigs",
148
- fileFromKey: tomlFile,
149
- // Server drains `configsForApp` across all pages (#1668).
150
- listingComplete: true,
151
- },
152
- {
153
- label: "collection-type-config",
154
- dir: "collection-type-configs",
155
- ext: ".toml",
156
- stateSlot: "collectionTypeConfigs",
157
- fileFromKey: tomlFile,
158
- // Server drains `collectionConfigsForApp` across all pages (#1668).
159
- listingComplete: true,
160
- },
161
113
  {
162
114
  // State key is the `resourceType#category` pair; the file on disk is
163
115
  // `resourceType.category.toml`.
@@ -169,6 +121,17 @@ export const SYNC_RESOURCE_TYPES = [
169
121
  // Server drains `metadataCategoriesForApp` across all pages (#1668).
170
122
  listingComplete: true,
171
123
  },
124
+ {
125
+ // #5532 — shared shapes: `schemas/<file>.toml`, one immutable `AppSchema`
126
+ // version per push. Keyed by the file's name; there is no in-file identity.
127
+ label: "schema",
128
+ dir: "schemas",
129
+ ext: ".toml",
130
+ stateSlot: "schemas",
131
+ fileFromKey: tomlFile,
132
+ // `GET …/schemas` drains the app's partition server-side.
133
+ listingComplete: true,
134
+ },
172
135
  {
173
136
  label: "email-template",
174
137
  dir: "email-templates",
@@ -504,18 +467,6 @@ export async function applyPrune(options) {
504
467
  result.removed.push(extra.relative);
505
468
  log(` Removed ${extra.relative} — ${ABSENT_FROM_EXPORT}`);
506
469
  }
507
- // #2645 — the entity's named config bodies go with it. They describe
508
- // configurations of a block the server no longer has, and leaving them
509
- // would have the next push re-create the block from its own leftovers.
510
- const configsDirName = resourceType.namedConfigsDirFromKey?.(key);
511
- if (configsDirName) {
512
- const configsDir = join(configDir, resourceType.dir, configsDirName);
513
- if (existsSync(configsDir) && isSafeSyncFilename(configsDirName)) {
514
- rmSync(configsDir, { recursive: true, force: true });
515
- result.removed.push(`${resourceType.dir}/${configsDirName}`);
516
- log(` Removed ${resourceType.dir}/${configsDirName} — ${ABSENT_FROM_EXPORT}`);
517
- }
518
- }
519
470
  if (!resourceType.testBlockType)
520
471
  continue;
521
472
  // Sidecar tests: `<key>.tests/` holds the block's test-case TOMLs and their
@@ -547,20 +498,13 @@ export const addressByKey = (key) => key || undefined;
547
498
  /**
548
499
  * Live modified timestamp used by the drift check. Most admin/app detail
549
500
  * endpoints serialize `modifiedAt` at the top level (the same field `config pull`
550
- * records into state), with `updatedAt` as a defensive fallback. Two detail
551
- * endpoints nest the entity under a wrapper key and need their own extractors
552
- * below (`workflowPruneModifiedAt`, `emailTemplatePruneModifiedAt`) so the
553
- * drift check reads the real timestamp instead of `undefined` — a top-level
501
+ * records into state), with `updatedAt` as a defensive fallback. The email
502
+ * template detail endpoint nests the entity under a wrapper key and needs its
503
+ * own extractor below (`emailTemplatePruneModifiedAt`) so the drift check
504
+ * reads the real timestamp instead of `undefined` — a top-level
554
505
  * read there always looks like drift and blocks `--prune` without `--force`.
555
506
  */
556
507
  export const pruneModifiedAt = (detail) => (detail && (detail.modifiedAt ?? detail.updatedAt)) || undefined;
557
- /**
558
- * Workflow detail-read extractor. `getWorkflow` (server `getAppWorkflow`,
559
- * src/admin-api.ts) returns `{ workflow, draft, revisions, configs }` — the
560
- * entity and its `modifiedAt` are nested under `workflow`, unlike every other
561
- * detail endpoint. Read there, not the top level.
562
- */
563
- export const workflowPruneModifiedAt = (detail) => pruneModifiedAt(detail && detail.workflow);
564
508
  /**
565
509
  * Email-template detail-read extractor. `getEmailTemplate` returns
566
510
  * `{ emailType, label, hasOverride, override, default, variables }`; the
@@ -575,15 +519,16 @@ export const emailTemplatePruneModifiedAt = (detail) => pruneModifiedAt(detail &
575
519
  * be parsed — callers fall back to the filename-derived key, matching the
576
520
  * `<field> || basename(file)` convention every `config push` parser uses.
577
521
  *
578
- * Parsed via `parseConfigToml` (not `parseTomlFile`): the identity fields
579
- * pruning reads are author-declared top-level values, unaffected by the
580
- * workflow-fragment expander, so this avoids depending on `commands/sync.ts`
581
- * (which would be a circular import) while producing the same key push does.
522
+ * Parsed via `parseRawToml` (not `parseTomlFile`) so this avoids depending
523
+ * on `commands/sync.ts` (which would be a circular import) while producing the
524
+ * same key push does. Raw, not expanding (#5541): a field table that does not
525
+ * compile must not cost the file its declared identity, or `config set` and
526
+ * `--only` would resolve a renamed file by its basename instead.
582
527
  */
583
528
  function declaredTomlKey(filePath, section, field) {
584
529
  let parsed;
585
530
  try {
586
- parsed = parseConfigToml(readFileSync(filePath, "utf-8"));
531
+ parsed = parseRawToml(readFileSync(filePath, "utf-8"));
587
532
  }
588
533
  catch {
589
534
  return undefined;
@@ -602,10 +547,9 @@ function tomlDeclaredKeyFromFile(section, field) {
602
547
  return (filePath) => declaredTomlKey(filePath, section, field) ?? basename(filePath, ".toml");
603
548
  }
604
549
  /**
605
- * `keyFromFile` for types keyed purely by filename — Rhai transforms (the
606
- * script `name` is the `.rhai` basename) and rule-sets (the state key is the
607
- * sanitized basename). These have no in-file identity, so a rename genuinely
608
- * changes the entity and the basename is the correct key.
550
+ * `keyFromFile` for types keyed purely by filename — rule-sets (the state key
551
+ * is the sanitized basename). These have no in-file identity, so a rename
552
+ * genuinely changes the entity and the basename is the correct key.
609
553
  */
610
554
  function basenameKeyFromFile(ext) {
611
555
  return (filePath) => basename(filePath, ext);
@@ -670,11 +614,20 @@ function pruneTypeFor(label) {
670
614
  throw new Error(`no sync resource type '${label}'`);
671
615
  return found;
672
616
  }
617
+ /**
618
+ * #4802 — a database type's key is present while EITHER of its two files
619
+ * declares it: the legacy `database-type-configs/<name>.toml` or the db3
620
+ * type's `db3-types/<name>.toml`. Only a type whose files are gone from both
621
+ * is a prune candidate. Also the key a `db3-types/` file declares for `--only`.
622
+ */
623
+ export function db3TypeKeyFromFile(path) {
624
+ return tomlDeclaredKeyFromFile("type", "name")(path);
625
+ }
626
+ const DB3_TYPE_TWIN = { dir: "db3-types", keyFromFile: db3TypeKeyFromFile };
673
627
  /**
674
628
  * Every resource type push-prune can retire. Id-addressed types (integrations,
675
- * webhooks, cron-triggers, blob-buckets, prompts, workflows, transforms,
676
- * rule-sets) fetch/delete by the stored id; key-addressed types (database-type-configs,
677
- * group-type-configs, collection-type-configs, email-templates) by the key.
629
+ * blob-buckets, prompts, functions, rule-sets) fetch/delete by the stored id; key-addressed types (database-type-configs,
630
+ * email-templates) by the key.
678
631
  *
679
632
  * `--force` (the CLI's existing "override baseline drift" flag) only relaxes the
680
633
  * drift check — it deliberately does NOT pass a server-side force flag on the
@@ -688,7 +641,7 @@ export const PUSH_PRUNE_SPECS = [
688
641
  addressOf: addressById,
689
642
  fetchDetail: (c, a, id) => c.getIntegration(a, id),
690
643
  modifiedAtOf: pruneModifiedAt,
691
- // Hard-delete rather than archive (#2803, following #2232's webhook
644
+ // Hard-delete rather than archive (#2803, following #2232's per-app
692
645
  // reasoning). `--prune` is the CLI's hard-delete path: the file that
693
646
  // declared this integration is gone from the config tree, and an archived
694
647
  // row keeps holding its `integrationKey` with no way to reclaim it from
@@ -696,39 +649,7 @@ export const PUSH_PRUNE_SPECS = [
696
649
  deleteEntity: async (c, a, id) => {
697
650
  await c.deleteIntegration(a, id, { hard: true });
698
651
  },
699
- },
700
- {
701
- resourceType: pruneTypeFor("webhook"),
702
- keyFromFile: tomlDeclaredKeyFromFile("webhook", "key"),
703
- addressOf: addressById,
704
- fetchDetail: (c, a, id) => c.getWebhook(a, id),
705
- modifiedAtOf: pruneModifiedAt,
706
- // Hard-delete rather than archive (#2232). Webhooks are the one pruned type with
707
- // a per-app cap that archived rows still consume, so an archiving prune
708
- // would burn a slot — and keep holding the `webhookKey` — with no way to
709
- // reclaim it from `sync`. Enough prune cycles and the app could never
710
- // create a webhook again. `--prune` is opt-in and confirmed, and the file
711
- // that declared this webhook is gone from the config dir, so a hard delete
712
- // is what "retire it" means here. Delivery rows are left behind either way.
713
- deleteEntity: async (c, a, id) => {
714
- await c.deleteWebhook(a, id, { hard: true });
715
- },
716
- },
717
- {
718
- resourceType: pruneTypeFor("cron-trigger"),
719
- keyFromFile: tomlDeclaredKeyFromFile("cronTrigger", "key"),
720
- addressOf: addressById,
721
- fetchDetail: (c, a, id) => c.getCronTrigger(a, id),
722
- modifiedAtOf: pruneModifiedAt,
723
- // Hard-delete rather than archive (#2803, following #2232's webhook
724
- // reasoning). Cron triggers have a per-app cap that archived rows still
725
- // consume, and an archived row keeps holding its `triggerKey` with no way
726
- // to reclaim it from `config`. `--prune` is opt-in and confirmed, and the
727
- // file that declared this trigger is gone from the config tree, so a hard
728
- // delete is what "retire it" means here.
729
- deleteEntity: async (c, a, id) => {
730
- await c.deleteCronTrigger(a, id, { hard: true });
731
- },
652
+ deleteNeedsAdmin: true,
732
653
  },
733
654
  {
734
655
  resourceType: pruneTypeFor("blob-bucket"),
@@ -746,7 +667,7 @@ export const PUSH_PRUNE_SPECS = [
746
667
  addressOf: addressById,
747
668
  fetchDetail: (c, a, id) => c.getPrompt(a, id),
748
669
  modifiedAtOf: pruneModifiedAt,
749
- // Hard-delete rather than archive (#2887, following #2232's webhook
670
+ // Hard-delete rather than archive (#2887, following #2232's per-app
750
671
  // reasoning). A plain DELETE archives now, and an archived prompt keeps
751
672
  // holding its `promptKey` with no way to reclaim it from `config`. This
752
673
  // had to change in the SAME commit that made the plain DELETE soft, or
@@ -754,6 +675,7 @@ export const PUSH_PRUNE_SPECS = [
754
675
  deleteEntity: async (c, a, id) => {
755
676
  await c.deletePrompt(a, id, true);
756
677
  },
678
+ deleteNeedsAdmin: true,
757
679
  },
758
680
  {
759
681
  // #3179 — server functions. Hard-delete rather than archive, following the
@@ -770,32 +692,7 @@ export const PUSH_PRUNE_SPECS = [
770
692
  deleteEntity: async (c, a, id) => {
771
693
  await c.deleteFunction(a, id, { hard: true });
772
694
  },
773
- },
774
- {
775
- resourceType: pruneTypeFor("workflow"),
776
- keyFromFile: tomlDeclaredKeyFromFile("workflow", "key"),
777
- addressOf: addressById,
778
- fetchDetail: (c, a, id) => c.getWorkflow(a, id),
779
- // `getWorkflow` nests the entity (and modifiedAt) under `workflow`.
780
- modifiedAtOf: workflowPruneModifiedAt,
781
- // Hard-delete rather than archive (#2887) — same reasoning as the prompt
782
- // spec above: the file that declared this workflow is gone from the config
783
- // tree, `--prune` is opt-in and confirmed, and an archived row would go on
784
- // holding its `workflowKey`.
785
- deleteEntity: async (c, a, id) => {
786
- await c.deleteWorkflow(a, id, { hard: true });
787
- },
788
- },
789
- {
790
- resourceType: pruneTypeFor("transform"),
791
- // Rhai scripts are keyed by the `.rhai` basename — no in-file identity.
792
- keyFromFile: basenameKeyFromFile(".rhai"),
793
- addressOf: addressById,
794
- fetchDetail: (c, a, id) => c.getScript(a, id),
795
- modifiedAtOf: pruneModifiedAt,
796
- deleteEntity: async (c, a, id) => {
797
- await c.deleteScript(a, id);
798
- },
695
+ deleteNeedsAdmin: true,
799
696
  },
800
697
  {
801
698
  resourceType: pruneTypeFor("rule-set"),
@@ -811,6 +708,7 @@ export const PUSH_PRUNE_SPECS = [
811
708
  {
812
709
  resourceType: pruneTypeFor("database-type-config"),
813
710
  keyFromFile: tomlDeclaredKeyFromFile("type", "databaseType"),
711
+ alsoDeclaredIn: [DB3_TYPE_TWIN],
814
712
  addressOf: addressByKey,
815
713
  fetchDetail: (c, a, key) => c.getDatabaseTypeConfig(a, key),
816
714
  modifiedAtOf: pruneModifiedAt,
@@ -820,24 +718,44 @@ export const PUSH_PRUNE_SPECS = [
820
718
  },
821
719
  },
822
720
  {
823
- resourceType: pruneTypeFor("group-type-config"),
824
- keyFromFile: tomlDeclaredKeyFromFile("groupTypeConfig", "groupType"),
721
+ // #4802 — a db3 type, retired through `DELETE db3-types/:name`, which
722
+ // refuses (409, reported blocked) while any db3 is of the type. Its key is
723
+ // present while either of its two files declares it, as the database
724
+ // type's is.
725
+ resourceType: pruneTypeFor("db3-type"),
726
+ keyFromFile: db3TypeKeyFromFile,
727
+ alsoDeclaredIn: [{ dir: "database-type-configs", keyFromFile: tomlDeclaredKeyFromFile("type", "databaseType") }],
825
728
  addressOf: addressByKey,
826
- fetchDetail: (c, a, key) => c.getGroupTypeConfig(a, key),
729
+ fetchDetail: (c, a, key) => c.getDb3TypeConfig(a, key),
827
730
  modifiedAtOf: pruneModifiedAt,
828
731
  deleteEntity: async (c, a, key) => {
829
- await c.deleteGroupTypeConfig(a, key);
732
+ await c.deleteDb3Type(a, key);
830
733
  },
831
734
  },
832
735
  {
833
- resourceType: pruneTypeFor("collection-type-config"),
834
- keyFromFile: tomlDeclaredKeyFromFile("collectionTypeConfig", "collectionType"),
736
+ // #5532 — a `schemas/` file is retired by a tombstone version, never a
737
+ // delete: already-pushed dependants keep the shapes they inlined. The
738
+ // tombstone is pinned to the version the plan's read confirmed (under
739
+ // `--force` too), so a version another tree pushed since is refused 409
740
+ // and stays live. A file the server already tombstoned reads as absent.
741
+ resourceType: pruneTypeFor("schema"),
742
+ keyFromFile: basenameKeyFromFile(".toml"),
835
743
  addressOf: addressByKey,
836
- fetchDetail: (c, a, key) => c.getCollectionTypeConfig(a, key),
837
- modifiedAtOf: pruneModifiedAt,
838
- deleteEntity: async (c, a, key) => {
839
- await c.deleteCollectionTypeConfig(a, key);
744
+ fetchDetail: (c, a, file) => c.getSchemaFile(a, file),
745
+ modifiedAtOf: (detail) => (detail && detail.createdAt) || undefined,
746
+ absentOf: (detail) => detail?.tombstone === true,
747
+ pinsDeleteToRead: true,
748
+ deleteEntity: async (c, a, file, detail) => {
749
+ await c.tombstoneSchemaFile(a, file, typeof detail?.version === "number" ? detail.version : undefined);
840
750
  },
751
+ blockedMessage: (err) => {
752
+ const details = err?.details;
753
+ const versions = details && typeof details.version === "number"
754
+ ? ` (expected version ${details.expectedVersion}, the server has version ${details.version})`
755
+ : "";
756
+ return `changed on the server during the push${versions}; re-run \`config push --prune\``;
757
+ },
758
+ deleteCaveat: "writes a tombstone; already-pushed dependants keep working",
841
759
  },
842
760
  {
843
761
  resourceType: pruneTypeFor("email-template"),
@@ -891,17 +809,22 @@ export const PUSH_PRUNE_SPECS = [
891
809
  */
892
810
  export function collectLocalDeclaredKeys(input) {
893
811
  const { spec, configDir } = input;
894
- const dirPath = join(configDir, spec.resourceType.dir);
895
812
  const keys = new Set();
896
- if (!existsSync(dirPath))
897
- return keys;
898
- for (const file of readdirSync(dirPath)) {
899
- if (!file.endsWith(spec.resourceType.ext))
900
- continue;
901
- const key = spec.keyFromFile(join(dirPath, file));
902
- if (key)
903
- keys.add(key);
904
- }
813
+ const scan = (dir, keyFromFile) => {
814
+ const dirPath = join(configDir, dir);
815
+ if (!existsSync(dirPath))
816
+ return;
817
+ for (const file of readdirSync(dirPath)) {
818
+ if (!file.endsWith(spec.resourceType.ext))
819
+ continue;
820
+ const key = keyFromFile(join(dirPath, file));
821
+ if (key)
822
+ keys.add(key);
823
+ }
824
+ };
825
+ scan(spec.resourceType.dir, spec.keyFromFile);
826
+ for (const twin of spec.alsoDeclaredIn ?? [])
827
+ scan(twin.dir, twin.keyFromFile);
905
828
  return keys;
906
829
  }
907
830
  /**
@@ -939,6 +862,10 @@ export function collectPushPruneCandidates(input) {
939
862
  * live `modifiedAt` matches prior state (or under `--force`). A 404 means the
940
863
  * work is already done (drop the stale state). Any other read failure, a missing
941
864
  * address, or a type without a delete surface leaves everything untouched.
865
+ *
866
+ * An archived row is still pending deletion, whatever its `modifiedAt`: it
867
+ * keeps its key, and archiving is what moved the timestamp. Status is
868
+ * server-owned and not in TOML, so the move is not drift.
942
869
  */
943
870
  export function decidePushPruneCandidate(input) {
944
871
  const { spec, address, priorModifiedAt, fetch: fetchOutcome, force } = input;
@@ -946,13 +873,21 @@ export function decidePushPruneCandidate(input) {
946
873
  return { action: "skip", reason: "no-id" };
947
874
  if (!spec.deleteEntity)
948
875
  return { action: "skip", reason: "unsupported" };
876
+ if (fetchOutcome.ok && spec.absentOf?.(fetchOutcome.detail))
877
+ return { action: "drop-state" };
949
878
  if (fetchOutcome.ok) {
950
879
  const serverModifiedAt = spec.modifiedAtOf(fetchOutcome.detail);
951
880
  const unchanged = !!priorModifiedAt &&
952
881
  !!serverModifiedAt &&
953
882
  serverModifiedAt === priorModifiedAt;
954
- if (force || unchanged) {
955
- return { action: "delete", address, serverModifiedAt };
883
+ const archived = fetchOutcome.detail?.status === "archived";
884
+ if (force || unchanged || archived) {
885
+ return {
886
+ action: "delete",
887
+ address,
888
+ serverModifiedAt,
889
+ ...(spec.pinsDeleteToRead ? { detail: fetchOutcome.detail } : {}),
890
+ };
956
891
  }
957
892
  return { action: "skip", reason: "drift", serverModifiedAt };
958
893
  }
@@ -962,6 +897,51 @@ export function decidePushPruneCandidate(input) {
962
897
  return { action: "drop-state" };
963
898
  return { action: "skip", reason: "unconfirmed" };
964
899
  }
900
+ /**
901
+ * Plan a push-prune over `specs`: every prior-state key no local file declares
902
+ * and `includes` selects, each confirmed by a point read and decided by
903
+ * {@link decidePushPruneCandidate}. Reads only.
904
+ */
905
+ export async function planPushPrune(input) {
906
+ const { configDir, entities, includes, client, appId, force } = input;
907
+ const items = [];
908
+ for (const spec of input.specs) {
909
+ const candidates = collectPushPruneCandidates({
910
+ spec,
911
+ configDir,
912
+ priorEntities: entities?.[spec.resourceType.stateSlot],
913
+ }).filter(({ key }) => includes(spec.resourceType.label, key));
914
+ for (const { key, entry } of candidates) {
915
+ const address = spec.addressOf(key, entry);
916
+ // Behavior 4: skip the point read for a candidate we could not
917
+ // delete anyway — no usable address (for metadata-category-configs
918
+ // that includes a state key that is not a `resourceType#category`
919
+ // pair, #2762), or a spec with no delete surface.
920
+ let fetchOutcome = { ok: false };
921
+ if (address && spec.deleteEntity) {
922
+ // Point read: confirm live presence + drift. Fail closed — any
923
+ // non-404 error leaves the entity and its state slot untouched.
924
+ try {
925
+ fetchOutcome = { ok: true, detail: await spec.fetchDetail(client, appId, address) };
926
+ }
927
+ catch (err) {
928
+ if (err?.statusCode === 404) {
929
+ fetchOutcome = { ok: false, status: 404 };
930
+ }
931
+ }
932
+ }
933
+ const decision = decidePushPruneCandidate({
934
+ spec,
935
+ address,
936
+ priorModifiedAt: entry?.modifiedAt,
937
+ fetch: fetchOutcome,
938
+ force,
939
+ });
940
+ items.push({ spec, key, entry, address, decision });
941
+ }
942
+ }
943
+ return items;
944
+ }
965
945
  /**
966
946
  * Classify an error thrown by a prune delete — one arm for every type.
967
947
  *
@@ -1014,6 +994,44 @@ export function formatPrunePlan(items) {
1014
994
  };
1015
995
  });
1016
996
  }
997
+ /** The step-up a prune's hard deletes need, valid for 15 minutes. */
998
+ export const PRUNE_STEP_UP_COMMAND = "primitive login --step-up --scope write,admin";
999
+ /**
1000
+ * The refusal for a prune plan that hard-deletes, from a session without the
1001
+ * `admin` scope: it names each hard delete, the missing scope and the step-up.
1002
+ * A candidate whose point read failed is named too: the plan `config push`
1003
+ * rebuilds after applying could find it and delete it. Null when the plan
1004
+ * deletes nothing that needs `admin`. `config push` checks it before applying
1005
+ * anything, so the push does not land halfway and then have its deletes
1006
+ * refused one by one.
1007
+ */
1008
+ export function pruneAdminScopeRefusal(items) {
1009
+ const needsAdmin = items.filter(({ spec }) => spec.deleteNeedsAdmin);
1010
+ const hard = needsAdmin.filter(({ decision }) => decision.action === "delete");
1011
+ const unconfirmed = needsAdmin.filter(({ decision }) => decision.action === "skip" && decision.reason === "unconfirmed");
1012
+ if (hard.length === 0 && unconfirmed.length === 0)
1013
+ return null;
1014
+ const names = (list) => list.map(({ spec, key }) => `${spec.resourceType.label} ${key}`).join(", ");
1015
+ const what = [
1016
+ ...(hard.length > 0 ? [`permanently deletes ${names(hard)}`] : []),
1017
+ ...(unconfirmed.length > 0
1018
+ ? [`may permanently delete ${names(unconfirmed)} (the read that would confirm it failed)`]
1019
+ : []),
1020
+ ].join(" and ");
1021
+ return (`The prune plan ${what}, which needs the \`admin\` scope ` +
1022
+ `this session lacks. Nothing was applied. Run \`${PRUNE_STEP_UP_COMMAND}\` ` +
1023
+ `for a 15-minute step-up, then push again.`);
1024
+ }
1025
+ /**
1026
+ * The refusal for a prune plan that hard-deletes when the session's scope
1027
+ * could not be read: the push stops rather than assume `admin` and apply
1028
+ * everything else before the deletes are refused.
1029
+ */
1030
+ export function pruneScopeUnknownRefusal(reason) {
1031
+ return (`Could not confirm this session holds the \`admin\` scope the prune plan's ` +
1032
+ `permanent deletes need: ${reason}. Nothing was applied. Push again, or run ` +
1033
+ `\`${PRUNE_STEP_UP_COMMAND}\` for a 15-minute step-up first.`);
1034
+ }
1017
1035
  /**
1018
1036
  * Remove a pruned block's sidecar `<key>.tests/` directory and its
1019
1037
  * `entities.testCases` state records. The main file is already gone (that is
@@ -1025,16 +1043,6 @@ export function removePrunedSidecar(options) {
1025
1043
  const log = logger ?? (() => { });
1026
1044
  const removed = [];
1027
1045
  const removedTestCaseKeys = [];
1028
- // #2645 — the entity's named config bodies orphan the same way its tests do.
1029
- const configsDirName = resourceType.namedConfigsDirFromKey?.(key);
1030
- if (configsDirName) {
1031
- const configsDir = join(configDir, resourceType.dir, configsDirName);
1032
- if (existsSync(configsDir) && isSafeSyncFilename(configsDirName)) {
1033
- rmSync(configsDir, { recursive: true, force: true });
1034
- removed.push(`${resourceType.dir}/${configsDirName}`);
1035
- log(` Removed orphaned ${resourceType.dir}/${configsDirName}`);
1036
- }
1037
- }
1038
1046
  if (!resourceType.testBlockType)
1039
1047
  return { removed, removedTestCaseKeys };
1040
1048
  const testsDirName = `${key}.tests`;