primitive-admin 1.1.0-alpha.6 → 1.1.0-alpha.61

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 (387) hide show
  1. package/README.md +389 -71
  2. package/assets/skill/skills/primitive-platform/SKILL.md +670 -0
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +287 -17
  5. package/dist/bin/primitive.js.map +1 -1
  6. package/dist/src/commands/admins.d.ts +2 -0
  7. package/dist/src/commands/admins.js +138 -19
  8. package/dist/src/commands/admins.js.map +1 -1
  9. package/dist/src/commands/analytics.d.ts +2 -0
  10. package/dist/src/commands/analytics.js +554 -55
  11. package/dist/src/commands/analytics.js.map +1 -1
  12. package/dist/src/commands/apps.d.ts +2 -0
  13. package/dist/src/commands/apps.js +27 -80
  14. package/dist/src/commands/apps.js.map +1 -1
  15. package/dist/src/commands/auth.d.ts +2 -0
  16. package/dist/src/commands/auth.js +177 -7
  17. package/dist/src/commands/auth.js.map +1 -1
  18. package/dist/src/commands/blob-buckets.d.ts +2 -0
  19. package/dist/src/commands/blob-buckets.js +330 -0
  20. package/dist/src/commands/blob-buckets.js.map +1 -0
  21. package/dist/src/commands/catalog.d.ts +2 -0
  22. package/dist/src/commands/catalog.js +37 -38
  23. package/dist/src/commands/catalog.js.map +1 -1
  24. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  25. package/dist/src/commands/collection-type-configs.js +92 -0
  26. package/dist/src/commands/collection-type-configs.js.map +1 -0
  27. package/dist/src/commands/collections.d.ts +2 -0
  28. package/dist/src/commands/collections.js +526 -0
  29. package/dist/src/commands/collections.js.map +1 -0
  30. package/dist/src/commands/comparisons.d.ts +2 -0
  31. package/dist/src/commands/comparisons.js +6 -6
  32. package/dist/src/commands/comparisons.js.map +1 -1
  33. package/dist/src/commands/config.d.ts +35 -0
  34. package/dist/src/commands/config.js +437 -0
  35. package/dist/src/commands/config.js.map +1 -0
  36. package/dist/src/commands/connections.d.ts +2 -0
  37. package/dist/src/commands/connections.js +100 -0
  38. package/dist/src/commands/connections.js.map +1 -0
  39. package/dist/src/commands/cron-triggers.d.ts +2 -0
  40. package/dist/src/commands/cron-triggers.js +204 -0
  41. package/dist/src/commands/cron-triggers.js.map +1 -0
  42. package/dist/src/commands/database-types.d.ts +2 -0
  43. package/dist/src/commands/database-types.js +171 -0
  44. package/dist/src/commands/database-types.js.map +1 -0
  45. package/dist/src/commands/databases.d.ts +65 -0
  46. package/dist/src/commands/databases.js +2153 -96
  47. package/dist/src/commands/databases.js.map +1 -1
  48. package/dist/src/commands/documents.d.ts +2 -0
  49. package/dist/src/commands/documents.js +1230 -19
  50. package/dist/src/commands/documents.js.map +1 -1
  51. package/dist/src/commands/email-templates.d.ts +2 -0
  52. package/dist/src/commands/email-templates.js +174 -0
  53. package/dist/src/commands/email-templates.js.map +1 -0
  54. package/dist/src/commands/env.d.ts +12 -0
  55. package/dist/src/commands/env.js +260 -0
  56. package/dist/src/commands/env.js.map +1 -0
  57. package/dist/src/commands/group-type-configs.d.ts +2 -0
  58. package/dist/src/commands/group-type-configs.js +86 -0
  59. package/dist/src/commands/group-type-configs.js.map +1 -0
  60. package/dist/src/commands/groups.d.ts +2 -0
  61. package/dist/src/commands/groups.js +38 -99
  62. package/dist/src/commands/groups.js.map +1 -1
  63. package/dist/src/commands/guides.d.ts +223 -0
  64. package/dist/src/commands/guides.js +617 -65
  65. package/dist/src/commands/guides.js.map +1 -1
  66. package/dist/src/commands/init.d.ts +17 -0
  67. package/dist/src/commands/init.js +964 -202
  68. package/dist/src/commands/init.js.map +1 -1
  69. package/dist/src/commands/integrations.d.ts +2 -0
  70. package/dist/src/commands/integrations.js +484 -205
  71. package/dist/src/commands/integrations.js.map +1 -1
  72. package/dist/src/commands/llm.d.ts +2 -0
  73. package/dist/src/commands/llm.js +13 -8
  74. package/dist/src/commands/llm.js.map +1 -1
  75. package/dist/src/commands/locks.d.ts +8 -0
  76. package/dist/src/commands/locks.js +160 -0
  77. package/dist/src/commands/locks.js.map +1 -0
  78. package/dist/src/commands/metadata.d.ts +2 -0
  79. package/dist/src/commands/metadata.js +406 -0
  80. package/dist/src/commands/metadata.js.map +1 -0
  81. package/dist/src/commands/prompts.d.ts +2 -0
  82. package/dist/src/commands/prompts.js +135 -355
  83. package/dist/src/commands/prompts.js.map +1 -1
  84. package/dist/src/commands/rule-sets.d.ts +3 -0
  85. package/dist/src/commands/rule-sets.js +271 -0
  86. package/dist/src/commands/rule-sets.js.map +1 -0
  87. package/dist/src/commands/scripts.d.ts +20 -0
  88. package/dist/src/commands/scripts.js +739 -0
  89. package/dist/src/commands/scripts.js.map +1 -0
  90. package/dist/src/commands/secrets.d.ts +2 -0
  91. package/dist/src/commands/secrets.js +108 -0
  92. package/dist/src/commands/secrets.js.map +1 -0
  93. package/dist/src/commands/sessions.d.ts +2 -0
  94. package/dist/src/commands/sessions.js +75 -0
  95. package/dist/src/commands/sessions.js.map +1 -0
  96. package/dist/src/commands/settings.d.ts +18 -0
  97. package/dist/src/commands/settings.js +54 -0
  98. package/dist/src/commands/settings.js.map +1 -0
  99. package/dist/src/commands/skill.d.ts +2 -0
  100. package/dist/src/commands/skill.js +29 -0
  101. package/dist/src/commands/skill.js.map +1 -0
  102. package/dist/src/commands/sync-app-settings.d.ts +125 -0
  103. package/dist/src/commands/sync-app-settings.js +380 -0
  104. package/dist/src/commands/sync-app-settings.js.map +1 -0
  105. package/dist/src/commands/sync.d.ts +958 -0
  106. package/dist/src/commands/sync.js +8954 -812
  107. package/dist/src/commands/sync.js.map +1 -1
  108. package/dist/src/commands/tokens.d.ts +2 -0
  109. package/dist/src/commands/tokens.js +130 -21
  110. package/dist/src/commands/tokens.js.map +1 -1
  111. package/dist/src/commands/users.d.ts +2 -0
  112. package/dist/src/commands/users.js +440 -22
  113. package/dist/src/commands/users.js.map +1 -1
  114. package/dist/src/commands/vars.d.ts +8 -0
  115. package/dist/src/commands/vars.js +96 -0
  116. package/dist/src/commands/vars.js.map +1 -0
  117. package/dist/src/commands/waitlist.d.ts +2 -0
  118. package/dist/src/commands/waitlist.js +10 -10
  119. package/dist/src/commands/waitlist.js.map +1 -1
  120. package/dist/src/commands/webhooks.d.ts +2 -0
  121. package/dist/src/commands/webhooks.js +442 -0
  122. package/dist/src/commands/webhooks.js.map +1 -0
  123. package/dist/src/commands/workflows.d.ts +94 -0
  124. package/dist/src/commands/workflows.js +1581 -448
  125. package/dist/src/commands/workflows.js.map +1 -1
  126. package/dist/src/lib/api-client.d.ts +1814 -0
  127. package/dist/src/lib/api-client.js +1655 -103
  128. package/dist/src/lib/api-client.js.map +1 -1
  129. package/dist/src/lib/app-settings-descriptor.d.ts +130 -0
  130. package/dist/src/lib/app-settings-descriptor.js +262 -0
  131. package/dist/src/lib/app-settings-descriptor.js.map +1 -0
  132. package/dist/src/lib/auth-flow.d.ts +8 -0
  133. package/dist/src/lib/batch.d.ts +26 -0
  134. package/dist/src/lib/batch.js +32 -0
  135. package/dist/src/lib/batch.js.map +1 -0
  136. package/dist/src/lib/block-layout.d.ts +160 -0
  137. package/dist/src/lib/block-layout.js +451 -0
  138. package/dist/src/lib/block-layout.js.map +1 -0
  139. package/dist/src/lib/canonical-json.d.ts +12 -0
  140. package/dist/src/lib/canonical-json.js +35 -0
  141. package/dist/src/lib/canonical-json.js.map +1 -0
  142. package/dist/src/lib/channel.d.ts +30 -0
  143. package/dist/src/lib/channel.js +68 -0
  144. package/dist/src/lib/channel.js.map +1 -0
  145. package/dist/src/lib/cli-manifest.d.ts +68 -0
  146. package/dist/src/lib/cli-manifest.js +71 -0
  147. package/dist/src/lib/cli-manifest.js.map +1 -0
  148. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +97 -0
  149. package/dist/src/lib/codegen-shared/generatedFiles.js +184 -0
  150. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
  151. package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
  152. package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
  153. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
  154. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
  155. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
  156. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
  157. package/dist/src/lib/config-object-descriptor.d.ts +108 -0
  158. package/dist/src/lib/config-object-descriptor.js +607 -0
  159. package/dist/src/lib/config-object-descriptor.js.map +1 -0
  160. package/dist/src/lib/config-payload.d.ts +85 -0
  161. package/dist/src/lib/config-payload.js +105 -0
  162. package/dist/src/lib/config-payload.js.map +1 -0
  163. package/dist/src/lib/config-surface.d.ts +93 -0
  164. package/dist/src/lib/config-surface.js +178 -0
  165. package/dist/src/lib/config-surface.js.map +1 -0
  166. package/dist/src/lib/config-toml.d.ts +10 -0
  167. package/dist/src/lib/config-toml.js +42 -0
  168. package/dist/src/lib/config-toml.js.map +1 -0
  169. package/dist/src/lib/config.d.ts +53 -0
  170. package/dist/src/lib/config.js +92 -53
  171. package/dist/src/lib/config.js.map +1 -1
  172. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  173. package/dist/src/lib/confirm-prompt.js +110 -0
  174. package/dist/src/lib/confirm-prompt.js.map +1 -0
  175. package/dist/src/lib/constants.d.ts +11 -0
  176. package/dist/src/lib/constants.js +12 -0
  177. package/dist/src/lib/constants.js.map +1 -0
  178. package/dist/src/lib/crash-handlers.d.ts +20 -0
  179. package/dist/src/lib/crash-handlers.js +49 -0
  180. package/dist/src/lib/crash-handlers.js.map +1 -0
  181. package/dist/src/lib/credentials-store.d.ts +89 -0
  182. package/dist/src/lib/credentials-store.js +330 -0
  183. package/dist/src/lib/credentials-store.js.map +1 -0
  184. package/dist/src/lib/csv.d.ts +47 -0
  185. package/dist/src/lib/csv.js +172 -0
  186. package/dist/src/lib/csv.js.map +1 -0
  187. package/dist/src/lib/data-input.d.ts +23 -0
  188. package/dist/src/lib/data-input.js +50 -0
  189. package/dist/src/lib/data-input.js.map +1 -0
  190. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  191. package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
  192. package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
  193. package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
  194. package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
  195. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
  196. package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
  197. package/dist/src/lib/db-codegen/dbNaming.js +180 -0
  198. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
  199. package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
  200. package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
  201. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
  202. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
  203. package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
  204. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
  205. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
  206. package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
  207. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
  208. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
  209. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
  210. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
  211. package/dist/src/lib/env-resolver.d.ts +62 -0
  212. package/dist/src/lib/env-resolver.js +121 -0
  213. package/dist/src/lib/env-resolver.js.map +1 -0
  214. package/dist/src/lib/fetch.d.ts +5 -0
  215. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  216. package/dist/src/lib/generated-allowlist.js +266 -0
  217. package/dist/src/lib/generated-allowlist.js.map +1 -0
  218. package/dist/src/lib/generated-config-surfaces.d.ts +578 -0
  219. package/dist/src/lib/generated-config-surfaces.js +3630 -0
  220. package/dist/src/lib/generated-config-surfaces.js.map +1 -0
  221. package/dist/src/lib/generated-template-lint.d.ts +206 -0
  222. package/dist/src/lib/generated-template-lint.js +589 -0
  223. package/dist/src/lib/generated-template-lint.js.map +1 -0
  224. package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
  225. package/dist/src/lib/generated-workflow-model-fields.js +53 -0
  226. package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
  227. package/dist/src/lib/google-client-secret-status.d.ts +35 -0
  228. package/dist/src/lib/google-client-secret-status.js +56 -0
  229. package/dist/src/lib/google-client-secret-status.js.map +1 -0
  230. package/dist/src/lib/init-config.d.ts +81 -0
  231. package/dist/src/lib/init-config.js +149 -0
  232. package/dist/src/lib/init-config.js.map +1 -0
  233. package/dist/src/lib/log-inspection.d.ts +568 -0
  234. package/dist/src/lib/log-inspection.js +639 -0
  235. package/dist/src/lib/log-inspection.js.map +1 -0
  236. package/dist/src/lib/migration-nag.d.ts +49 -0
  237. package/dist/src/lib/migration-nag.js +163 -0
  238. package/dist/src/lib/migration-nag.js.map +1 -0
  239. package/dist/src/lib/output.d.ts +109 -0
  240. package/dist/src/lib/output.js +191 -8
  241. package/dist/src/lib/output.js.map +1 -1
  242. package/dist/src/lib/package-manager.d.ts +140 -0
  243. package/dist/src/lib/package-manager.js +305 -0
  244. package/dist/src/lib/package-manager.js.map +1 -0
  245. package/dist/src/lib/paginate.d.ts +83 -0
  246. package/dist/src/lib/paginate.js +95 -0
  247. package/dist/src/lib/paginate.js.map +1 -0
  248. package/dist/src/lib/platform-owned.d.ts +51 -0
  249. package/dist/src/lib/platform-owned.js +64 -0
  250. package/dist/src/lib/platform-owned.js.map +1 -0
  251. package/dist/src/lib/project-config.d.ts +97 -0
  252. package/dist/src/lib/project-config.js +219 -0
  253. package/dist/src/lib/project-config.js.map +1 -0
  254. package/dist/src/lib/query-operators.d.ts +43 -0
  255. package/dist/src/lib/query-operators.js +80 -0
  256. package/dist/src/lib/query-operators.js.map +1 -0
  257. package/dist/src/lib/record-filter.d.ts +18 -0
  258. package/dist/src/lib/record-filter.js +55 -0
  259. package/dist/src/lib/record-filter.js.map +1 -0
  260. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  261. package/dist/src/lib/refresh-admin-credentials.js +103 -0
  262. package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
  263. package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
  264. package/dist/src/lib/resolve-init-dev-port.js +55 -0
  265. package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
  266. package/dist/src/lib/resolve-init-server.d.ts +71 -0
  267. package/dist/src/lib/resolve-init-server.js +94 -0
  268. package/dist/src/lib/resolve-init-server.js.map +1 -0
  269. package/dist/src/lib/resolve-platform.d.ts +45 -0
  270. package/dist/src/lib/resolve-platform.js +43 -0
  271. package/dist/src/lib/resolve-platform.js.map +1 -0
  272. package/dist/src/lib/run-status.d.ts +19 -0
  273. package/dist/src/lib/run-status.generated.d.ts +39 -0
  274. package/dist/src/lib/run-status.generated.js +66 -0
  275. package/dist/src/lib/run-status.generated.js.map +1 -0
  276. package/dist/src/lib/run-status.js +19 -0
  277. package/dist/src/lib/run-status.js.map +1 -0
  278. package/dist/src/lib/signing-secret-status.d.ts +81 -0
  279. package/dist/src/lib/signing-secret-status.js +116 -0
  280. package/dist/src/lib/signing-secret-status.js.map +1 -0
  281. package/dist/src/lib/skill-installer.d.ts +25 -0
  282. package/dist/src/lib/skill-installer.js +266 -0
  283. package/dist/src/lib/skill-installer.js.map +1 -0
  284. package/dist/src/lib/snapshots.d.ts +99 -0
  285. package/dist/src/lib/snapshots.js +357 -0
  286. package/dist/src/lib/snapshots.js.map +1 -0
  287. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +100 -0
  288. package/dist/src/lib/swift-codegen/dbGenerator.js +682 -0
  289. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
  290. package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
  291. package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
  292. package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
  293. package/dist/src/lib/swift-codegen/generator.d.ts +85 -0
  294. package/dist/src/lib/swift-codegen/generator.js +266 -0
  295. package/dist/src/lib/swift-codegen/generator.js.map +1 -0
  296. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
  297. package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
  298. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
  299. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +90 -0
  300. package/dist/src/lib/swift-codegen/siblingSymbols.js +152 -0
  301. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
  302. package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
  303. package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
  304. package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
  305. package/dist/src/lib/sync-paths.d.ts +72 -0
  306. package/dist/src/lib/sync-paths.js +130 -0
  307. package/dist/src/lib/sync-paths.js.map +1 -0
  308. package/dist/src/lib/sync-resource-types.d.ts +445 -0
  309. package/dist/src/lib/sync-resource-types.js +812 -0
  310. package/dist/src/lib/sync-resource-types.js.map +1 -0
  311. package/dist/src/lib/sync-selectors.d.ts +95 -0
  312. package/dist/src/lib/sync-selectors.js +228 -0
  313. package/dist/src/lib/sync-selectors.js.map +1 -0
  314. package/dist/src/lib/template.d.ts +121 -0
  315. package/dist/src/lib/template.js +447 -67
  316. package/dist/src/lib/template.js.map +1 -1
  317. package/dist/src/lib/token-inject.d.ts +56 -0
  318. package/dist/src/lib/token-inject.js +204 -0
  319. package/dist/src/lib/token-inject.js.map +1 -0
  320. package/dist/src/lib/toml-database-config.d.ts +123 -0
  321. package/dist/src/lib/toml-database-config.js +527 -0
  322. package/dist/src/lib/toml-database-config.js.map +1 -0
  323. package/dist/src/lib/toml-metadata-config.d.ts +151 -0
  324. package/dist/src/lib/toml-metadata-config.js +476 -0
  325. package/dist/src/lib/toml-metadata-config.js.map +1 -0
  326. package/dist/src/lib/toml-native-form.d.ts +46 -0
  327. package/dist/src/lib/toml-native-form.js +78 -0
  328. package/dist/src/lib/toml-native-form.js.map +1 -0
  329. package/dist/src/lib/toml-params-validator.d.ts +129 -0
  330. package/dist/src/lib/toml-params-validator.js +298 -0
  331. package/dist/src/lib/toml-params-validator.js.map +1 -0
  332. package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
  333. package/dist/src/lib/toml-scalar-edit.js +283 -0
  334. package/dist/src/lib/toml-scalar-edit.js.map +1 -0
  335. package/dist/src/lib/user-selector.d.ts +24 -0
  336. package/dist/src/lib/user-selector.js +33 -0
  337. package/dist/src/lib/user-selector.js.map +1 -0
  338. package/dist/src/lib/version-check.d.ts +35 -0
  339. package/dist/src/lib/version-check.js +241 -0
  340. package/dist/src/lib/version-check.js.map +1 -0
  341. package/dist/src/lib/watch.d.ts +121 -0
  342. package/dist/src/lib/watch.js +169 -0
  343. package/dist/src/lib/watch.js.map +1 -0
  344. package/dist/src/lib/workflow-apply.d.ts +51 -0
  345. package/dist/src/lib/workflow-apply.js +89 -0
  346. package/dist/src/lib/workflow-apply.js.map +1 -0
  347. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
  348. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
  349. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
  350. package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
  351. package/dist/src/lib/workflow-codegen/generator.js +361 -0
  352. package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
  353. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +83 -0
  354. package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
  355. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
  356. package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
  357. package/dist/src/lib/workflow-codegen/naming.js +81 -0
  358. package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
  359. package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
  360. package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
  361. package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
  362. package/dist/src/lib/workflow-config-apply.d.ts +70 -0
  363. package/dist/src/lib/workflow-config-apply.js +137 -0
  364. package/dist/src/lib/workflow-config-apply.js.map +1 -0
  365. package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
  366. package/dist/src/lib/workflow-config-sidecar.js +96 -0
  367. package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
  368. package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
  369. package/dist/src/lib/workflow-field-descriptor.js +153 -0
  370. package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
  371. package/dist/src/lib/workflow-fragments.d.ts +64 -0
  372. package/dist/src/lib/workflow-fragments.js +342 -0
  373. package/dist/src/lib/workflow-fragments.js.map +1 -0
  374. package/dist/src/lib/workflow-include-preserve.d.ts +71 -0
  375. package/dist/src/lib/workflow-include-preserve.js +153 -0
  376. package/dist/src/lib/workflow-include-preserve.js.map +1 -0
  377. package/dist/src/lib/workflow-payload.d.ts +86 -0
  378. package/dist/src/lib/workflow-payload.js +168 -0
  379. package/dist/src/lib/workflow-payload.js.map +1 -0
  380. package/dist/src/lib/workflow-toml-validator.d.ts +199 -0
  381. package/dist/src/lib/workflow-toml-validator.js +754 -0
  382. package/dist/src/lib/workflow-toml-validator.js.map +1 -0
  383. package/dist/src/types/index.d.ts +533 -0
  384. package/dist/src/validators.d.ts +65 -0
  385. package/dist/src/validators.js +64 -0
  386. package/dist/src/validators.js.map +1 -0
  387. package/package.json +32 -6
@@ -0,0 +1,958 @@
1
+ import { Command } from "commander";
2
+ import { ApiClient } from "../lib/api-client.js";
3
+ import { type OperationFormHints } from "../lib/toml-database-config.js";
4
+ import { type FieldForm } from "../lib/toml-native-form.js";
5
+ import { type PushMode } from "../lib/config-payload.js";
6
+ import { type ConfigObjectSurface, type ConfigTable } from "../lib/generated-config-surfaces.js";
7
+ import { type PresenceOutcome } from "../lib/sync-resource-types.js";
8
+ /**
9
+ * Wrap a server-side error so the printed message identifies which entity
10
+ * was in flight. Used by every entity create/update/delete call site in the
11
+ * push loops (issue #684).
12
+ *
13
+ * Format: `Failed to ${action} ${kind} ${key}: ${serverMessage}`
14
+ *
15
+ * - `ConflictError` is rethrown unchanged so the existing
16
+ * `ConflictError → conflicts[]` accumulator in each loop still fires.
17
+ * - Other errors are rewrapped as a new `ApiError` carrying the wrapped
18
+ * message + the original `details[]` and `statusCode`.
19
+ */
20
+ export declare function wrapEntityError(err: unknown, action: "create" | "update" | "delete", kind: string, key: string): Error;
21
+ export declare function computeFileHash(filePath: string): string;
22
+ export declare function shouldPushFile(filePath: string, storedHash: string | undefined): boolean;
23
+ /**
24
+ * Hash the *expanded* (post-fragment-splice) content of a workflow TOML.
25
+ *
26
+ * The raw-file hash (`computeFileHash`) misses fragment-only edits: if a
27
+ * workflow uses `include = ["x"]` and only `workflow-fragments/x.toml`
28
+ * changes, the workflow file is byte-identical and shouldPushFile would
29
+ * skip the push, leaving the server with stale expanded steps.
30
+ *
31
+ * This helper hashes the parsed-and-expanded data instead, so fragment
32
+ * edits change the hash and force a re-push. Pass the already-parsed
33
+ * `tomlData` (from `parseTomlFile`) — that function runs the expander,
34
+ * so `tomlData` is the canonical expanded shape the server will see.
35
+ */
36
+ export declare function computeExpandedContentHash(parsed: any): string;
37
+ /**
38
+ * Variant of `shouldPushFile` for workflow files: compares the stored hash
39
+ * against the hash of the *expanded* content rather than the raw file
40
+ * bytes. Required so that edits to included fragments invalidate the
41
+ * push-skip cache for any workflow that references them.
42
+ */
43
+ export declare function shouldPushExpandedFile(parsed: any, storedHash: string | undefined): boolean;
44
+ /**
45
+ * Normalize a parsed workflow TOML object so that any of the
46
+ * serializer-emitted default fields the *local* file omits are filled in with
47
+ * the model default. Used by `diff` so a hand-authored workflow that omits e.g.
48
+ * `perUserMaxRunning` compares equal to a server that defaulted it to 4
49
+ * (the #1175 false-positive guard) — while a server value that was
50
+ * *explicitly set* to a non-default (e.g. 8) still shows as Modified.
51
+ *
52
+ * Returns a shallow clone with a normalized `workflow` table; the input is
53
+ * not mutated. Non-workflow TOML (no `workflow` table) is returned unchanged.
54
+ */
55
+ export declare function normalizeWorkflowTomlDefaults(parsed: any): any;
56
+ /**
57
+ * Canonical content hash of a workflow TOML for `diff`'s content comparison.
58
+ * Applies `normalizeWorkflowTomlDefaults` first so omitted-vs-defaulted fields
59
+ * don't spuriously diff, then runs the same `computeExpandedContentHash` that
60
+ * pull stores and push compares. Both the local file and the
61
+ * `serializeWorkflow`-produced remote form flow through this single function,
62
+ * so the two sides are normalized identically by construction.
63
+ */
64
+ export declare function hashWorkflowTomlForDiff(parsed: any): string;
65
+ /**
66
+ * Build the canonical content hash for a *server* workflow (as returned by
67
+ * `getWorkflow` + active `getWorkflowConfig`), mirroring exactly what a fresh
68
+ * `sync pull` would write to disk. Serializes via `serializeWorkflow`, parses
69
+ * the resulting TOML (remote serialized TOML never carries `include`s, so a
70
+ * plain `parseConfigToml` is sufficient — no fragment path needed), then hashes
71
+ * through `hashWorkflowTomlForDiff` so it lines up with the local-file hash.
72
+ *
73
+ * `logger` is optional but `sync diff` passes it: the serializer's
74
+ * unrecognized-server-key warning (#2644) is the only signal that this CLI
75
+ * version cannot represent a field the server holds, and a diff that swallowed
76
+ * it would report the workflow as in sync with no hint that anything is
77
+ * missing.
78
+ */
79
+ export declare function hashRemoteWorkflowForDiff(workflow: any, draft: any, configs: any[], logger?: (message: string) => void): string;
80
+ export interface ParsedAuthSettings {
81
+ settings: Record<string, any>;
82
+ warnings: string[];
83
+ }
84
+ /**
85
+ * Build the [auth] block of app.toml from server settings (pull direction).
86
+ *
87
+ * Thin wrapper over the shared field descriptor
88
+ * (`cli/src/lib/app-settings-descriptor.ts`), which now owns the [auth] field
89
+ * set that `AUTH_BOOLEAN_KEYS`/`RECOGNIZED_AUTH_KEYS` used to hard-code. The
90
+ * descriptor drives all four sections in one place, so pull, push, and the
91
+ * unrecognized-key warning can never drift apart.
92
+ */
93
+ export declare function serializeAuthBlock(settings: any): Record<string, any>;
94
+ /**
95
+ * Translate the [auth] block of app.toml into app-settings fields (push
96
+ * direction). Kept as a focused helper over the shared descriptor; the full
97
+ * push path uses `parseTomlToAppSettings` for every section. Only keys present
98
+ * in the TOML are forwarded, so an omitted key never overwrites server state.
99
+ * Descriptor errors (a type mismatch) are surfaced alongside the
100
+ * unrecognized-key warnings.
101
+ */
102
+ export declare function parseAppAuthSettings(auth: Record<string, any>): ParsedAuthSettings;
103
+ type VarEntity = {
104
+ modifiedAt: string;
105
+ contentHash?: string;
106
+ };
107
+ /**
108
+ * Decide whether `sync pull` should (over)write `vars.toml`, given the outcome
109
+ * of fetching the app's config vars.
110
+ *
111
+ * The distinction that matters (issue #1423 review): a SUCCESSFUL fetch that
112
+ * returns zero vars is safe to write — the comment-only file is the intended
113
+ * empty state. A FAILED fetch (transient 401/500/network) must NOT write,
114
+ * because `serializeVars([])` would clobber a good local `vars.toml` with a
115
+ * comment-only file while the pull otherwise reports success. On failure we
116
+ * keep the prior manifest entries so the untouched file and the sync state stay
117
+ * consistent.
118
+ *
119
+ * Pure and side-effect-free (the caller owns the actual `writeFileSync`) so the
120
+ * clobber guard is unit-testable without a live server.
121
+ */
122
+ export declare function planVarsPull(outcome: {
123
+ ok: true;
124
+ vars: any[];
125
+ } | {
126
+ ok: false;
127
+ }, priorVars?: Record<string, VarEntity>): {
128
+ write: boolean;
129
+ content: string | null;
130
+ varEntities: Record<string, VarEntity>;
131
+ };
132
+ /**
133
+ * `sync pull --only var/<KEY>` — the same plan, narrowed to the named keys
134
+ * (issue #2645).
135
+ *
136
+ * `vars.toml` is one file for the whole var surface, so a scoped pull cannot
137
+ * just re-emit what the server returned: that would drop every var the
138
+ * operator did not name, including local edits they have not pushed yet. The
139
+ * merge is therefore local-file-first — the file's current keys are kept as
140
+ * they are, and only the SELECTED keys are taken from the server (or removed,
141
+ * when the server no longer has them).
142
+ *
143
+ * Pure like `planVarsPull`, for the same reason: this is the one place a pull
144
+ * can silently discard an author's work, so it has to be testable without a
145
+ * live server.
146
+ */
147
+ export declare function planScopedVarsPull(serverVars: Array<{
148
+ key: string;
149
+ value?: string;
150
+ updatedAt?: string;
151
+ modifiedAt?: string;
152
+ }>, selectedKeys: ReadonlySet<string>, localVars: Record<string, string>, priorVars?: Record<string, VarEntity>): {
153
+ content: string;
154
+ varEntities: Record<string, VarEntity>;
155
+ };
156
+ /**
157
+ * Validate a `sync push`'s webhook writes against the server's per-app cap.
158
+ * Returns a list of human-readable errors (empty when the push may proceed).
159
+ *
160
+ * Run in `sync push`'s up-front preflight (the `planVarsPush` cap pattern) so a
161
+ * push that would run past the cap aborts BEFORE any mutation. Without it the
162
+ * push creates webhooks one at a time until the server rejects one at the cap,
163
+ * leaving a partial push.
164
+ *
165
+ * **Only creates are capped.** The server grandfathers apps that already hold
166
+ * more webhooks than the cap: it refuses new creates and nothing else. A plain
167
+ * file count would break that — `sync pull` writes one toml per webhook, so a
168
+ * grandfathered app pulls more files than the cap and could then never push
169
+ * again, its workflows, databases and vars included. So the check compares the
170
+ * local keys against the keys already on the server: a push that creates
171
+ * nothing new is always allowed, however far over the cap the app is, and a
172
+ * push that does create is rejected only when the resulting row count would
173
+ * exceed the cap.
174
+ *
175
+ * The remote key list this runs against comes from `GET
176
+ * /admin/api/apps/{appId}/webhooks`, which applies no default status filter, so
177
+ * archived rows are in `remoteKeys` exactly as they are in the server's count.
178
+ * The two therefore agree on what is already on the server.
179
+ *
180
+ * Still advisory rather than authoritative: this counts creates the way the
181
+ * *config dir* implies, while the apply loop decides create-vs-update from
182
+ * local sync state, so a checkout with missing sync state issues creates this
183
+ * check did not predict. Those creates name keys the server already holds, and
184
+ * the server does not cap a create that adds no row — it answers 409
185
+ * `WEBHOOK_KEY_EXISTS`, which `adoptByKeyOnCreate409` converges on. A push
186
+ * allowed here can still be rejected server-side (concurrent writes, a stale
187
+ * list); that rejection carries `WEBHOOK_LIMIT_REACHED` and names the limit.
188
+ *
189
+ * Planned prunes are deliberately NOT netted out of the count: `--prune` runs
190
+ * after the webhook create loop, so a push that only fits once its prunes land
191
+ * would still fail mid-apply. Prune first, then push the additions.
192
+ */
193
+ export declare function validateWebhookCapForPush(localKeys: string[], remoteKeys: string[]): string[];
194
+ /**
195
+ * Validate a parsed `vars.toml` table against the same key/value constraints
196
+ * the server enforces (key format, string type, non-empty, size cap) plus the
197
+ * aggregate per-app var-count cap. Returns a list of human-readable errors
198
+ * (empty when valid).
199
+ *
200
+ * Run in `sync push`'s up-front preflight pass (issue #1423 review) so an
201
+ * invalid entry — or a file that would exceed the server's `MAX_VARS_PER_APP`
202
+ * cap — aborts BEFORE any mutation is applied. Validating only individual
203
+ * entries let a 101-entry file create/update many vars before the server
204
+ * rejected a later create at the cap, leaving a partial push (issue #1423
205
+ * review pass 3). Pure and side-effect-free so it's unit-testable without a
206
+ * live server.
207
+ *
208
+ * `onlyKeys` narrows the check to the keys a `sync push --only var/<key>` will
209
+ * actually write (issue #2645). A single-object push must not be aborted by an
210
+ * entry it is not going to touch, so the per-entry checks run over the selected
211
+ * keys and the file-wide count cap — a property of the whole file, not of these
212
+ * entries — is left to the plan-level check the caller makes against the final
213
+ * server count.
214
+ */
215
+ export declare function validateVarsFile(parsedVars: Record<string, unknown>, options?: {
216
+ onlyKeys?: ReadonlySet<string>;
217
+ }): string[];
218
+ /**
219
+ * Plan the config-var writes a `sync push` should make, detecting concurrent
220
+ * remote edits before overwriting them (issue #1423 review).
221
+ *
222
+ * This is the client-side half of a two-layer concurrency guard. The vars
223
+ * PUT/DELETE endpoints now honor an `expectedModifiedAt` precondition (issue
224
+ * #1423 review r-2 P1) and raise a `ConflictError` when the server row changed
225
+ * since the caller's snapshot — the atomic, server-side check every other
226
+ * synced entity relies on. This function is the fast fail-before-mutate layer:
227
+ * it compares the recorded baseline against the current remote snapshot and, for
228
+ * a var whose remote value has drifted from what we last synced, reports a
229
+ * conflict (fed into the same `conflicts[]` accumulator the other entities use)
230
+ * before any write is attempted. A var tracked at the baseline but absent from
231
+ * the remote snapshot (deleted remotely while edited locally) is remote drift
232
+ * too, and also reported as a conflict rather than silently recreated.
233
+ * Conversely, a var removed locally that is already absent remotely is NOT
234
+ * planned for deletion — its desired (absent) state is already met, so a DELETE
235
+ * would 404 and fail the push. The same drift check guards deletions: a var
236
+ * removed locally whose remote value no longer matches the baseline was edited
237
+ * remotely since the last sync, and deleting it would silently discard that
238
+ * edit — reported as a conflict instead. `force` skips the conflict guard,
239
+ * matching `sync push --force` for every other entity.
240
+ *
241
+ * Pure and side-effect-free (the caller owns the API calls and sync-state
242
+ * updates) so the guard is unit-testable without a live server. Assumes
243
+ * `parsedVars` has already passed `validateVarsFile` (values are strings). The
244
+ * caller normally fails the push closed when the remote snapshot can't be
245
+ * fetched, but under `--force` it falls back to an empty snapshot and sets
246
+ * `snapshotUnavailable` — which keeps removed-key deletions in the plan (they'd
247
+ * otherwise be mistaken for already-deleted and dropped) and leans on the apply
248
+ * loop's idempotent 404 handling (issue #1423 review r-2 P2).
249
+ */
250
+ export declare function planVarsPush(parsedVars: Record<string, string>, baseline: Record<string, VarEntity> | undefined, remoteVars: Array<{
251
+ key: string;
252
+ value?: string;
253
+ updatedAt?: string;
254
+ }>, options?: {
255
+ force?: boolean;
256
+ snapshotUnavailable?: boolean;
257
+ }): {
258
+ upserts: Array<{
259
+ action: "create" | "update";
260
+ key: string;
261
+ value: string;
262
+ valueHash: string;
263
+ }>;
264
+ deletions: string[];
265
+ conflicts: Array<{
266
+ key: string;
267
+ serverModifiedAt: string;
268
+ localModifiedAt: string;
269
+ }>;
270
+ skippedCount: number;
271
+ };
272
+ /**
273
+ * Compute the number of config vars the server would hold after a push plan
274
+ * is applied (issue #1423 review pass 5). Validating only the local file's
275
+ * entry count misses remote-only vars: 95 local entries plus 10 vars that
276
+ * exist only on the server passes a local-count check, and the creates then
277
+ * exceed the server's cap mid-push, after earlier writes were already
278
+ * applied. Counted from the fetched remote snapshot: planned deletions remove
279
+ * keys that exist remotely (the plan already omits deletes for absent keys),
280
+ * and only upserts whose key is NOT already on the server add to the total.
281
+ * Conflicted keys are not mutated, so they contribute nothing beyond their
282
+ * current remote presence. Pure and side-effect-free so it's unit-testable
283
+ * without a live server.
284
+ */
285
+ export declare function countVarsAfterPush(remoteVars: Array<{
286
+ key: string;
287
+ }>, plan: {
288
+ upserts: Array<{
289
+ key: string;
290
+ }>;
291
+ deletions: string[];
292
+ }): number;
293
+ /**
294
+ * Compute the `sync diff` rows for config vars (issue #1423 review). Before
295
+ * this, `sync diff` ignored vars entirely, so an add/remove/value-drift between
296
+ * the local `vars.toml` and the server read as no difference. Value-aware: a
297
+ * var present on both sides whose value differs is reported as `modified`
298
+ * (framed like the other content-aware entities — `sync pull` would rewrite the
299
+ * local value). Pure and side-effect-free so it's unit-testable without a live
300
+ * server.
301
+ */
302
+ export declare function diffVars(localVars: Map<string, string>, remoteVars: Map<string, string>): Array<{
303
+ type: "var";
304
+ key: string;
305
+ status: string;
306
+ hint?: string;
307
+ }>;
308
+ /**
309
+ * Which of a workflow's configs `sync pull` writes as sidecar files
310
+ * (issue #2645, spec §Contracts/Named configs).
311
+ *
312
+ * Every config EXCEPT the active one. The active config's body is already the
313
+ * `steps` at the top of `workflows/<key>.toml` — that is where authors edit it
314
+ * and where `applyWorkflowBody` writes it — so emitting it again as a sidecar
315
+ * would put the same body in two files and create a mismatch to adjudicate on
316
+ * the next push. Two declarations of one piece of state is the shape of problem
317
+ * this whole issue removes; it would be perverse to introduce one here.
318
+ *
319
+ * A config whose steps were not fetched is SKIPPED rather than written empty.
320
+ * A sidecar is a claim about the server, and `steps = []` is a claim that would
321
+ * tell the next push to blank a live configuration.
322
+ *
323
+ * Pure, so the selection is unit-testable without a live server.
324
+ */
325
+ export declare function workflowConfigSidecarsToWrite(workflow: any, configs: any[]): Array<{
326
+ name: string;
327
+ content: string;
328
+ }>;
329
+ /**
330
+ * The names a workflow's configs occupy on the server, whatever their body.
331
+ *
332
+ * `workflowConfigSidecarsToWrite` deliberately skips a config whose steps were
333
+ * not fetched, so it cannot answer "which sidecar files are stale". This can:
334
+ * a local file whose name is absent HERE names a config the server no longer
335
+ * has, which is the only safe basis for deleting it (issue #2645, review
336
+ * follow-up).
337
+ */
338
+ export declare function workflowConfigNamesOnServer(workflow: any, configs: any[]): Set<string>;
339
+ /**
340
+ * Delete the sidecars naming a config the server no longer has (#2645).
341
+ *
342
+ * Pull is what makes the repo describe the server, and a sidecar left behind
343
+ * after its config was archived — or after that config became the active one,
344
+ * whose body is the workflow file's `steps` — is a file that would RE-CREATE it
345
+ * on the next push. The repo would then be silently undoing the archive.
346
+ *
347
+ * Returns the file names removed, so pull can say what it did.
348
+ */
349
+ export declare function removeStaleWorkflowConfigSidecars(configDir: string, key: string, namesOnServer: Set<string>): string[];
350
+ /**
351
+ * The content hash `sync push` skips a workflow on — sidecars included.
352
+ *
353
+ * The stored hash used to cover `workflows/<key>.toml` alone, so editing or
354
+ * adding a named config sidecar without touching the workflow file left the
355
+ * hash unchanged: push reported success and made no call at all, which is
356
+ * worse than failing (issue #2645, review follow-up). The named configs are
357
+ * part of what push applies, so they are part of what push compares.
358
+ *
359
+ * A workflow with no sidecars hashes exactly as before, so the common case
360
+ * does not re-push once on upgrade. An unreadable sidecar hashes to a distinct
361
+ * value rather than throwing: a hash is a comparison, and the parse error
362
+ * belongs to the apply path, which raises it with the file name attached.
363
+ */
364
+ export declare function workflowHashInput(configDir: string, key: string, parsedWorkflowToml: any): any;
365
+ /** See `workflowHashInput`. */
366
+ export declare function computeWorkflowContentHash(configDir: string, key: string, parsedWorkflowToml: any): string;
367
+ /**
368
+ * Canonical hash of a named config sidecar, for `sync diff` (#2645).
369
+ *
370
+ * Hashes the parsed body rather than the bytes so comment and key-order
371
+ * differences do not read as drift — the same semantic comparison `sync diff`
372
+ * makes everywhere else (spec criterion 3).
373
+ */
374
+ export declare function hashWorkflowConfigSidecar(parsed: any): string;
375
+ /**
376
+ * The `sync diff` annotation for an object an operator took out of service
377
+ * (issue #2645, criterion 9).
378
+ *
379
+ * `operationallyDisabled` is deliberately not a TOML key, so a disabled object
380
+ * is NOT drift — the committed configuration still describes it exactly. Saying
381
+ * so out loud is the point: the reason the toggle exists is that an out-of-band
382
+ * write used to make `sync diff` report a difference nobody intentionally
383
+ * created (#1976). Reporting it as a hint on an otherwise-`Synced` row is what
384
+ * keeps that promise visible instead of merely true.
385
+ *
386
+ * When the row already carries a hint — a real content difference — the toggle
387
+ * is APPENDED rather than substituted: the drift is the part that needs acting
388
+ * on, and dropping it to announce the pause would hide the more urgent fact.
389
+ *
390
+ * Pure, so it is unit-testable without a live server.
391
+ */
392
+ export declare function operationalDisableHint(remote: any, existingHint?: string): string | undefined;
393
+ /**
394
+ * Serialize an integration DETAIL response to its `integrations/<key>.toml`.
395
+ *
396
+ * #2631: `accessRule` is the CEL expression gating who may call the
397
+ * integration. It comes back on the detail only (not the list summary), and it
398
+ * is written to TOML so `sync pull` → `sync push` round-trips the rule instead
399
+ * of clearing it. A null/empty rule has no TOML representation and is simply
400
+ * omitted; the push path sends `null` for an omitted rule, which matches the
401
+ * server state it came from.
402
+ */
403
+ export declare function serializeIntegration(integration: any, logger?: (message: string) => void): string;
404
+ /**
405
+ * Build the `sync push` body for one integration TOML.
406
+ *
407
+ * `accessRule` follows the #1567 TOML-owned rule: send value-or-`null` so
408
+ * removing the line from the file clears the rule server-side rather than
409
+ * leaving a stale one live. There is deliberately NO local "rule is required"
410
+ * check here — a remote integration missing from local sync state is pushed as
411
+ * a create, expected to 409, and adopted by key (#1006); a local check would
412
+ * strand that path. The server decides (#2631).
413
+ */
414
+ export declare function buildIntegrationPushPayload(key: string, tomlData: any, { mode }?: {
415
+ mode?: PushMode;
416
+ }): Record<string, any>;
417
+ export declare function webhookConfigToTomlTable(scheme: string, config: any): Record<string, any> | undefined;
418
+ export declare function tomlTableToWebhookConfig(scheme: string, table: any): Record<string, any> | undefined;
419
+ export declare function serializeWebhook(webhook: any, logger?: (message: string) => void): string;
420
+ /**
421
+ * Build the `sync push` body for one webhook TOML.
422
+ *
423
+ * The `[webhook]`-derived half comes from the vendored definition; the four
424
+ * structural tables the file also carries (`[allowedIps]`, `[inputMapping]`,
425
+ * `[metadata]`, `[verification.<scheme>]`) keep their own conversion, which is
426
+ * why the definition declares them `structural` rather than as fields.
427
+ */
428
+ export declare function buildWebhookPushPayload(key: string, tomlData: any, { mode }?: {
429
+ mode?: PushMode;
430
+ }): Record<string, any>;
431
+ export declare function serializeCronTrigger(trigger: any, logger?: (message: string) => void): string;
432
+ /**
433
+ * Build the `sync push` body for one cron-trigger TOML.
434
+ *
435
+ * `state` is absent from the create body because the definition says the create
436
+ * handler assigns it (`writableOn: ["update"]`) — the CLI used to send it and
437
+ * the server used to drop it silently.
438
+ */
439
+ export declare function buildCronTriggerPushPayload(key: string, tomlData: any, { mode }?: {
440
+ mode?: PushMode;
441
+ }): Record<string, any>;
442
+ export declare function serializeBlobBucket(bucket: any, logger?: (message: string) => void): string;
443
+ /**
444
+ * Build the PATCH payload for a blob-bucket update from local TOML.
445
+ *
446
+ * EXACT extraction of the inline builder shared by the existing-update and
447
+ * 409-adopt branches — do NOT "clean up" the truthiness checks on the access
448
+ * model. The server treats `preset` and `accessPolicy` as mutually exclusive,
449
+ * only clears `ruleSetId` when a preset/accessPolicy is also present, and
450
+ * refuses to leave a bucket with no access model or a blank name — so those
451
+ * fields are not clearable. `bucketKey` and `ttlTier` are immutable and never
452
+ * sent. Both call sites must go through this helper so their field sets never
453
+ * drift.
454
+ */
455
+ export declare function buildBlobBucketUpdatePayload(bucket: any): any;
456
+ /**
457
+ * Which `[[configs]]` entry a prompt file marks as live (issue #2645).
458
+ *
459
+ * Exactly one entry may carry `active = true`. Two is an error rather than a
460
+ * first-wins rule: making the file's meaning depend on entry order is the kind
461
+ * of implicit behavior this issue exists to remove, and silently picking one
462
+ * would let the repo claim something the server does not do.
463
+ *
464
+ * `isActive` is accepted as a legacy spelling — the create leg read it before
465
+ * pull ever wrote a marker, so a hand-authored file carrying it keeps working.
466
+ */
467
+ export declare function promptActiveConfigName(configs: any[]): string | undefined;
468
+ /**
469
+ * The push payload for one `[[configs]]` entry of a prompt (issue #2645).
470
+ *
471
+ * One builder for both directions so create and update cannot drift: a field
472
+ * the file owns has to reach the server whether the config is new or already
473
+ * there, which is what "removing a flag removes no capability" means in
474
+ * practice.
475
+ *
476
+ * `description` is sent as `?? null` on update and omitted on create (#1567):
477
+ * dropping the key from a `[[configs]]` block must CLEAR it on an existing
478
+ * config, and the PATCH nulls on an explicit `null` while preserving on omit.
479
+ * `status` is the opposite — omitted means "unchanged", because the server
480
+ * defaults a new config to active and an existing one keeps what it has.
481
+ */
482
+ export declare function promptConfigPayload(tomlConfig: any, options?: {
483
+ create?: boolean;
484
+ }): Record<string, any>;
485
+ /**
486
+ * Build the POST body for a blob-bucket create from local TOML.
487
+ *
488
+ * `ttlTier` is here and absent from the update body because the definition says
489
+ * so (`writableOn: ["create"]`) — the retention tier is fixed at creation.
490
+ */
491
+ export declare function buildBlobBucketCreatePayload(key: string, bucket: any): Record<string, any>;
492
+ export declare function serializePrompt(prompt: any, logger?: (message: string) => void): string;
493
+ /**
494
+ * Build the `sync push` body for one prompt TOML's `[prompt]` table.
495
+ *
496
+ * The prompt's own fields only — its `[[configs]]` entries are separate
497
+ * requests, built by `buildPromptConfigPayload`.
498
+ */
499
+ export declare function buildPromptPushPayload(key: string, tomlData: any, { mode }?: {
500
+ mode?: PushMode;
501
+ }): Record<string, any>;
502
+ /**
503
+ * Build the POST body for a prompt create.
504
+ *
505
+ * `POST /prompts` is the one endpoint that writes BOTH models: the prompt, and
506
+ * the "default" `AppPromptConfig` it seeds from the same body. So this body is
507
+ * the `[prompt]` table's create half plus the FIRST `[[configs]]` entry's LLM
508
+ * settings — minus the three keys the prompt half owns or the handler assigns
509
+ * itself:
510
+ *
511
+ * - `configName` — the seeded config is always named "default".
512
+ * - `description` — the body's slot belongs to the PROMPT, and the handler
513
+ * hard-codes the seeded config's to "Default configuration". An authored
514
+ * `[[configs]]` description therefore has nowhere to go in this body, so
515
+ * push applies it right after the create rather than losing it.
516
+ * - `outputSchema` — same shape: the body's slot is the prompt's, so the
517
+ * seeded config's own value is applied by the follow-up PATCH
518
+ * (`seededOnlyPromptConfigFields`) instead of being dropped.
519
+ *
520
+ * Every other config field rides along from the definition, so a new LLM
521
+ * setting reaches a brand-new prompt without an edit at this call site.
522
+ */
523
+ export declare function buildPromptCreatePayload(key: string, tomlData: any): Record<string, any>;
524
+ /**
525
+ * The PATCH body reconciling the seeded "default" config with the first
526
+ * `[[configs]]` entry, or `null` when the entry declares none of it.
527
+ */
528
+ export declare function seededOnlyPromptConfigFields(firstConfig: any): Record<string, any> | null;
529
+ /**
530
+ * Build the create/update body for ONE `[[configs]]` entry.
531
+ *
532
+ * `create` carries the provider/model defaults a brand-new config needs; on
533
+ * update those defaults must NOT be applied, or editing an unrelated key would
534
+ * silently re-point a config at the default model.
535
+ */
536
+ export declare function buildPromptConfigPayload(tomlConfig: any, { mode }?: {
537
+ mode?: PushMode;
538
+ }): Record<string, any>;
539
+ /**
540
+ * Rewrite a workflow TOML file's string-form `inputSchema` / `outputSchema` to
541
+ * native object form for `sync migrate-toml` (issue #1446).
542
+ *
543
+ * Purely local, no server fetch. Parses the raw source WITHOUT expanding
544
+ * fragment `include`s (so those directives survive the rewrite), swaps a
545
+ * JSON-string schema for its parsed object when it round-trips faithfully
546
+ * (`canEmitNative === null`), and re-serializes via `stringifyConfigToml`.
547
+ *
548
+ * Only rewrites when a field is actually converted: a file whose schemas are
549
+ * already native, absent, or un-representable (a `null` default) is returned
550
+ * with `changed: false` and its original bytes untouched — so migrate is
551
+ * idempotent and never reports a spurious migration or reformats a file it
552
+ * didn't need to touch.
553
+ */
554
+ export declare function rewriteWorkflowSchemasToNative(rawToml: string, workflowKey?: string, log?: (message: string) => void): {
555
+ content: string;
556
+ changed: boolean;
557
+ };
558
+ export declare function configUnknownKeyError(filePath: string, tomlData: any, table: ConfigTable): string | null;
559
+ /**
560
+ * #2644 — the document-level half of the same rejection: a top-level table the
561
+ * object's definition does not declare, or a field table written with the wrong
562
+ * array markers. Returns one message per problem, or `[]` when the file's shape
563
+ * is recognized.
564
+ *
565
+ * Unrecognized keys INSIDE a table were already rejected; a mistyped table
566
+ * HEADER was not, and it is the more destructive of the two — `[integraton]`
567
+ * leaves `[integration]` absent, so the push builder reads an empty table and
568
+ * sends `description: null` / `accessRule: null`, CLEARING them server-side.
569
+ * The design gate settled the posture (2026-08-12): push rejects everything
570
+ * unknown, tables included.
571
+ */
572
+ export declare function configDocumentShapeErrors(filePath: string, tomlData: any, surface: ConfigObjectSurface): string[];
573
+ /**
574
+ * Which directories `sync push` checks for unrecognized keys, and against which
575
+ * tables.
576
+ *
577
+ * Derived from the registry crossed with `SYNC_RESOURCE_TYPES`, so a type
578
+ * gains the check by being defined — nobody has to remember to list it here.
579
+ *
580
+ * Workflows carry an EMPTY `tables` list: `validateWorkflowToml` already
581
+ * reports their `[workflow]` keys alongside the #685 misnest check, in one
582
+ * message per file, but nothing checked a workflow file's top-level tables —
583
+ * so the surface is listed here for the document-level check and skipped for
584
+ * the per-table one.
585
+ */
586
+ export declare function unknownKeyPreflightTargets(): Array<{
587
+ dir: string;
588
+ surface: ConfigObjectSurface;
589
+ tables: ConfigTable[];
590
+ }>;
591
+ /**
592
+ * Every `<key>.tests/*.toml` sidecar under a config directory.
593
+ *
594
+ * Test cases are a registered surface (#2644 phase 3) but they are not a
595
+ * `SYNC_RESOURCE_TYPES` directory — they live beside the block they test, in
596
+ * `prompts/<key>.tests/`, `workflows/<key>.tests/` and
597
+ * `transforms/<name>.tests/` — so `unknownKeyPreflightTargets`, which crosses
598
+ * the registry with that table, never reaches them. Listing them here gives the
599
+ * sidecars the same unrecognized-key rejection every per-entity file has
600
+ * (criterion 6): a mistyped `[test]` key fails the push instead of being
601
+ * dropped on the way to the server.
602
+ */
603
+ export declare function testCaseTomlFiles(configDir: string): string[];
604
+ /** The `[workflow]` case of `configUnknownKeyError` (#2644 phase 1). */
605
+ export declare function workflowUnknownKeyError(filePath: string, tomlData: any): string | null;
606
+ export declare function serializeWorkflow(workflow: any, draft: any, configs: any[], logger?: (message: string) => void): string;
607
+ export declare function serializeDatabaseType(typeConfig: any, operations: any[], ruleSetIdToName: Map<string, string>, options?: {
608
+ /** Per-op form hints derived from the existing file. */
609
+ hints?: OperationFormHints;
610
+ /** Default form for ops with no hint. New files → "native". */
611
+ defaultForm?: FieldForm;
612
+ /** Sink for human-readable fallback messages (logged via `info`). */
613
+ logger?: (message: string) => void;
614
+ /** Server subscription rows to emit as `[[subscriptions]]` (issue #803). */
615
+ subscriptions?: any[];
616
+ }): string;
617
+ /**
618
+ * Flatten an email-template detail response onto its field surface.
619
+ *
620
+ * The API returns `{ emailType, hasOverride, override: {…}, default: {…} }` —
621
+ * only the `override` half is the field surface (the `default` half is what the
622
+ * platform ships), which is why both envelope keys are declared
623
+ * `responseOnlyKeys` in the definition.
624
+ */
625
+ export declare function emailTemplateOverrideRecord(template: any): Record<string, any>;
626
+ export declare function serializeEmailTemplate(template: any, logger?: (message: string) => void): string;
627
+ /**
628
+ * Build the upsert body for one email-template TOML.
629
+ *
630
+ * `emailType` is deliberately absent: it identifies WHICH built-in template the
631
+ * override replaces and travels in the URL path, which is what the definition's
632
+ * `notExposed`/`tomlOnlyKeys` pair records.
633
+ */
634
+ export declare function buildEmailTemplatePushPayload(tomlData: any): {
635
+ subject: string;
636
+ htmlBody: string;
637
+ textBody: string;
638
+ };
639
+ export declare function serializeRuleSet(ruleSet: any, logger?: (message: string) => void): string;
640
+ /**
641
+ * The create/update body for one rule-set TOML (#2644).
642
+ *
643
+ * The field half comes from the definition — which is what keeps
644
+ * `resourceType` off the update body, since the update handler never reads it —
645
+ * and the structural `[rules]` tree is attached beside it.
646
+ */
647
+ export declare function buildRuleSetPushPayload(tomlData: any, mode: PushMode): Record<string, any>;
648
+ export declare function serializeGroupTypeConfig(config: any, ruleSetIdToName: Map<string, string>, logger?: (message: string) => void): string;
649
+ /**
650
+ * The create/update body for one group-type config (#2644).
651
+ *
652
+ * Takes the entity `parseGroupTypeConfigToml` produced, AFTER the rule-set
653
+ * name → id resolution: the definition says which fields the server accepts in
654
+ * each mode, so `groupType` rides the create body and the URL on update.
655
+ */
656
+ export declare function buildGroupTypeConfigPayload(configData: any, mode: PushMode): Record<string, any>;
657
+ export declare function serializeCollectionTypeConfig(config: any, ruleSetIdToName: Map<string, string>, logger?: (message: string) => void): string;
658
+ /** The create/update body for one collection-type config (#2644). */
659
+ export declare function buildCollectionTypeConfigPayload(configData: any, mode: PushMode): Record<string, any>;
660
+ /**
661
+ * The upsert body for one metadata-category config (#2644).
662
+ *
663
+ * One endpoint serves create and update, so every field is writable in both
664
+ * modes and the body carries the whole definition-declared surface. The
665
+ * identity pair rides the URL too (`PUT …/{resourceType}/{category}`); sending
666
+ * it in the body as well is what the POST form has always taken.
667
+ */
668
+ export declare function buildMetadataCategoryPayload(configData: any): Record<string, any>;
669
+ /**
670
+ * Issue #1567 — the TOML-owned fields of a database-type config, derived from
671
+ * the definition (#2644 phase 3).
672
+ *
673
+ * These are fields the `database-types/*.toml` file OWNS: the local file is the
674
+ * source of truth, so removing one from the TOML must clear it server-side
675
+ * (config-as-code), not silently preserve the stale value.
676
+ *
677
+ * The list used to be written out here, a second statement of the `[type]`
678
+ * field surface that a new field would have had to be added to by hand. It is
679
+ * now every exposed `[type]` scalar except the immutable identity, plus the two
680
+ * sub-trees the definition classifies `structural` and the file nonetheless
681
+ * owns whole (`triggers`, `metadataManifest`). `schema` is deliberately NOT
682
+ * owned this way — it keeps its own `hasSchema` prior-state discriminator,
683
+ * since a schema is a large sub-tree whose absence is ambiguous.
684
+ */
685
+ export declare function dbTypeOwnedScalars(table?: ConfigTable): string[];
686
+ export declare const DB_TYPE_OWNED_SCALARS: readonly string[];
687
+ /** The user-facing TOML key for a wire field (for push output). */
688
+ export declare function dbTypeFieldLabel(key: string): string;
689
+ /**
690
+ * True when a value carries real content. null/undefined, blank/whitespace
691
+ * strings, and empty objects/arrays all count as "no value" — the same
692
+ * normalization the server applies (`value || null`) when it decides whether a
693
+ * field is set.
694
+ */
695
+ export declare function hasMeaningfulValue(v: any): boolean;
696
+ /**
697
+ * Issue #1567 — always-send owned db-type scalars as value-or-`null`.
698
+ *
699
+ * The server PATCH endpoint distinguishes an omitted key (preserve) from an
700
+ * explicit `null` (clear), so sending every owned scalar as `value ?? null`
701
+ * converges the server to the local TOML: a field removed from the file lands
702
+ * as `null` and is cleared. Matches the always-send pattern the sibling
703
+ * `collection-type-config` push already uses.
704
+ */
705
+ export declare function buildOwnedScalarUpdate(typeConfig: any): Record<string, any>;
706
+ /**
707
+ * Issue #1567 — the owned scalars this push genuinely clears: the outgoing
708
+ * value is empty but the server currently holds a real value (a non-null →
709
+ * null transition). Used for the "Cleared <field>" report so removing an
710
+ * access gate is never silent, and to decide whether an otherwise
711
+ * type-field-less push still needs a type-config PATCH. Returns wire field
712
+ * names (map with `dbTypeFieldLabel` for output). `serverConfig` is the live
713
+ * GET; without it (fresh type or a failed fetch) nothing is reported cleared.
714
+ */
715
+ export declare function ownedScalarsBeingCleared(updateData: Record<string, any>, serverConfig: any): string[];
716
+ export declare function parseDatabaseTypeToml(tomlData: any): {
717
+ typeConfig: any;
718
+ operations: any[];
719
+ subscriptions: any[];
720
+ };
721
+ /**
722
+ * The parsed shape of a rule-set TOML: the definition's fields plus the
723
+ * structural `[rules]` tree. Identical to the create body, which is what
724
+ * `sync diff` hashes both sides through.
725
+ */
726
+ export declare function parseRuleSetToml(tomlData: any): any;
727
+ export declare function parseGroupTypeConfigToml(tomlData: any): any;
728
+ export declare function parseCollectionTypeConfigToml(tomlData: any): any;
729
+ /**
730
+ * `sync diff`'s hash for one configuration object, over the field set its
731
+ * DEFINITION declares (#2644 criterion 8).
732
+ *
733
+ * Both sides — the local file and the server entity — run through this one
734
+ * function, so a field is visible to `sync diff` exactly when the definition
735
+ * exposes it. Each type used to carry a hand-written
736
+ * `hashLocal*ForDiff` / `hashRemote*ForDiff` pair naming its own fields: a
737
+ * third copy of the field surface, with the same failure mode as the other two
738
+ * (a field pushed and pulled but missing from the hash is invisible to diff, so
739
+ * an edit reads as "nothing differs" until push applies it).
740
+ *
741
+ * `extras` carries the values that are NOT definition fields and must still be
742
+ * compared: the authored sub-trees the definition classifies `structural`
743
+ * (`[rules]`, `[[operations]]`, the `[metadata]` manifest) and the
744
+ * `_unresolvedRuleSetName` marker below. `undefined` entries are dropped so an
745
+ * absent extra and an omitted one hash the same.
746
+ */
747
+ export declare function hashConfigForDiff(table: ConfigTable, entity: any, extras?: Record<string, any>): string;
748
+ /** The rule-set name/id maps `sync diff` resolves references through. */
749
+ export interface ConfigDiffMaps {
750
+ ruleSetIdToName: Map<string, string>;
751
+ ruleSetNameToId: Map<string, string>;
752
+ }
753
+ /**
754
+ * How one configuration type is hashed for `sync diff`: its definition, the
755
+ * definition-driven parse both sides go through, the pull serializer that turns
756
+ * a server entity into the file pull would have written, and the structural
757
+ * values hashed alongside the definition's fields.
758
+ */
759
+ export interface ConfigDiffSpec {
760
+ label: string;
761
+ table: ConfigTable;
762
+ /** TOML doc -> the wire-shaped entity (the same parse `sync push` uses). */
763
+ parse(doc: any): any;
764
+ /** Server entity -> the TOML `sync pull` would write. */
765
+ serialize(record: any, maps: ConfigDiffMaps, extra?: any): string;
766
+ /** Structural values to hash beside the definition's fields. */
767
+ extras?(entity: any, doc: any): Record<string, any>;
768
+ /** Whether the entity carries a rule-set reference needing resolution. */
769
+ ruleSetRef?: boolean;
770
+ /** How the type names itself in the rule-set resolution message. */
771
+ describe(entity: any): string;
772
+ }
773
+ /** The diff spec for a configuration type. Throws rather than skipping a check. */
774
+ export declare function configDiffSpec(label: string): ConfigDiffSpec;
775
+ /** Hash a LOCAL config file's definition-projected field set (#2644). */
776
+ export declare function hashLocalConfigForDiff(spec: ConfigDiffSpec, parsedToml: any, maps: ConfigDiffMaps): string;
777
+ /**
778
+ * Hash a SERVER entity the same way, by serializing it into the file `sync
779
+ * pull` would write and hashing that — so the two sides are normalized
780
+ * identically by construction, and a legacy encoding on disk (a JSON-string
781
+ * operation, an id-based rule-set reference) is not a false `Modified`.
782
+ *
783
+ * `extra` carries the sibling rows a type's file also holds: a database type's
784
+ * operations and subscriptions, which the list response does not include.
785
+ */
786
+ export declare function hashRemoteConfigForDiff(spec: ConfigDiffSpec, record: any, maps: ConfigDiffMaps, extra?: any): string;
787
+ export declare function parseTomlFile(filePath: string): any;
788
+ /**
789
+ * Paginate through a list endpoint, collecting all items.
790
+ */
791
+ export declare function fetchAll<T>(listFn: (params: {
792
+ limit: number;
793
+ cursor?: string;
794
+ }) => Promise<{
795
+ items: T[];
796
+ nextCursor?: string | null;
797
+ }>, pageSize?: number, maxPages?: number): Promise<T[]>;
798
+ /**
799
+ * Issue #976 / #1006: shared 409 → adopt-by-key recovery for `sync push`
800
+ * create paths. When a CREATE hits a per-app unique-key constraint, the resource
801
+ * is already on the server but missing from local sync state: orphaned by a
802
+ * prior push that aborted before recording it, a mid-apply crash, or an
803
+ * out-of-band create with the same key. Rather than hard-fail forever, this
804
+ * helper looks the resource up by its unique key and hands the matched item
805
+ * back so the caller can re-issue the create as an UPDATE and converge.
806
+ *
807
+ * The conflict surfaces inconsistently across create routes, so detection is
808
+ * deliberately broad (see `isConflict` below):
809
+ * - a 409 status (webhooks, cron triggers, the standard case);
810
+ * - an "already exists" message — some routes surface the 409 as HTTP 400,
811
+ * e.g. workflows;
812
+ * - a "must be unique" message — routes with no explicit conflict catch let
813
+ * dynamo-bao's per-app unique-constraint error propagate verbatim (e.g. rule
814
+ * sets, whose create route has no 409 translation). This matches the
815
+ * server's own admin-api convention (`src/admin-api.ts`), which treats
816
+ * "must be unique" as a duplicate-key conflict.
817
+ * Any other error is NOT a conflict and re-throws unchanged (see below).
818
+ *
819
+ * Safety (load-bearing): exact-key match only. The `lookup` is app-scoped, so a
820
+ * key match is also an ownership match — an unrelated resource is never
821
+ * overwritten. The three non-adopt outcomes each surface a clear error and do
822
+ * NOT touch the server:
823
+ * - a non-409 create error is re-wrapped via `wrapEntityError` and re-thrown
824
+ * (no lookup is attempted);
825
+ * - a lookup failure throws a clear "already exists but could not be adopted
826
+ * (lookup failed: …)";
827
+ * - a 409 with no matching key re-throws the ORIGINAL create error rather
828
+ * than silently proceeding.
829
+ *
830
+ * Pagination is the caller's concern: `lookup` must return the COMPLETE
831
+ * candidate set. For cursor-based lists (webhooks, integrations, prompts,
832
+ * workflows) wrap the list call in `fetchAll`; the cron-triggers route already
833
+ * drains every page server-side (#1668) so its flat `{ items }` is complete.
834
+ * The UPDATE re-issue and sync-state stamping stay with the caller because they
835
+ * differ per entity.
836
+ *
837
+ * @returns the matched existing item (guaranteed non-null on return).
838
+ */
839
+ export declare function adoptByKeyOnCreate409<T>(opts: {
840
+ err: unknown;
841
+ kind: string;
842
+ key: string;
843
+ lookup: () => Promise<T[]>;
844
+ matchKey: (item: T) => boolean;
845
+ }): Promise<T>;
846
+ /**
847
+ * Resolve a key-based rule set name reference to an ID.
848
+ * Throws if the name cannot be resolved and throwOnMissing is true.
849
+ */
850
+ export declare function resolveRuleSetReference(entityConfig: any, ruleSetNameToId: Map<string, string>, entityLabel: string, options?: {
851
+ throwOnMissing?: boolean;
852
+ hint?: string;
853
+ }): void;
854
+ /**
855
+ * Rule-set name→ID for the rule sets a scoped push is NOT applying
856
+ * (issue #2645, review follow-up).
857
+ *
858
+ * Database, group and collection type configs name their rule set by NAME and
859
+ * resolve it through the map the rule-set apply loop fills in as it goes. Under
860
+ * `--only` that loop iterates the selected files alone, so `sync push --only
861
+ * database-type/orders` threw "Rule set … not found" for a type whose rule set
862
+ * the operator had no reason to select — the single-object apply path refusing
863
+ * an ordinary object, which is the opposite of what `--only` is for.
864
+ *
865
+ * A rule set the sync state already carries an id for is resolvable without
866
+ * being applied, which is exactly what a reference needs. One that has never
867
+ * been pushed still cannot resolve: there is no id to point at, and inventing
868
+ * one would silently create the reference against nothing. That case keeps
869
+ * throwing, with the hint to widen the selection.
870
+ *
871
+ * Pure, so the seeding is unit-testable without a server or a filesystem.
872
+ */
873
+ export declare function unselectedRuleSetIds(params: {
874
+ /** Every rule-set file in the slot. */
875
+ files: string[];
876
+ /** The subset this push is applying — seeded entries never shadow these. */
877
+ selected: string[];
878
+ /** The id sync state holds for a rule-set file's key, if it has one. */
879
+ idForFileKey: (fileKey: string) => string | undefined;
880
+ /** The `ruleSet.name` a file declares — the name references use. */
881
+ nameForFile: (file: string) => string | undefined;
882
+ }): Map<string, string>;
883
+ export declare function slugifyTestCaseName(name: string): string;
884
+ export declare function resolveSlugCollisions(slug: string, usedSlugs: Set<string>): string;
885
+ export interface TestCaseLookupMaps {
886
+ configIdToName: Map<string, string>;
887
+ promptIdToKey: Map<string, string>;
888
+ }
889
+ export declare function serializeTestCase(testCase: any, lookupMaps?: TestCaseLookupMaps, options?: {
890
+ /** The sidecar path the warning names, e.g. `prompts/greet.tests/a.toml`. */
891
+ file?: string;
892
+ logger?: (message: string) => void;
893
+ }): string;
894
+ export declare function parseTestCaseToml(tomlData: any): any;
895
+ /**
896
+ * Pull server-side `Script` rows into `transforms/*.rhai` and record
897
+ * each in the returned sync-state map. Issue #892 slice 7 + codex
898
+ * follow-up on PR #893; body materialization fixed in issue #1196.
899
+ * Exported so the unit test can drive it against stubbed
900
+ * `client.listScripts` / `client.getScript`.
901
+ *
902
+ * Two-call contract: `listScripts` returns the `Script` HEADER only
903
+ * (no `body` — see `serializeScript` in `src/admin-api.ts`). The Rhai
904
+ * source lives on a versioned `ScriptConfig`. So for each listed
905
+ * script we fetch the full record with `getScript`, which returns the
906
+ * header plus serialized `configs` (each carrying its `body`), and
907
+ * write the ACTIVE config's body. Reading the body off the list shape
908
+ * (the old behavior) always produced 0-byte files.
909
+ *
910
+ * Idempotency: every call writes the active-config body the server
911
+ * returned, so re-running `sync pull` on an unchanged server overwrites
912
+ * with the same bytes and produces the same `contentHash`. The result
913
+ * map always reflects the current server state for the writes performed.
914
+ *
915
+ * `count` is the number of files actually written, not the number of
916
+ * scripts listed: scripts with no active config and scripts whose
917
+ * config fetch fails are skipped (we never clobber a `.rhai` with an
918
+ * empty file).
919
+ *
920
+ * Older-server graceful path: if `listScripts` rejects (e.g. older
921
+ * server without the route), the caller catches and treats it as
922
+ * "no scripts to pull", leaving the directory empty. A per-script
923
+ * `getScript` failure is caught and that one script is skipped without
924
+ * aborting the rest of the pull.
925
+ */
926
+ export declare function pullScripts(client: ApiClient, appId: string, configDir: string, logger?: (msg: string) => void,
927
+ /**
928
+ * `sync pull --only` (issue #2645): which transform names this pull may
929
+ * write. Defaults to every one the server lists.
930
+ */
931
+ selects?: (name: string) => boolean): Promise<{
932
+ scriptEntities: Record<string, {
933
+ id: string;
934
+ modifiedAt: string;
935
+ contentHash?: string;
936
+ }>;
937
+ count: number;
938
+ /**
939
+ * Which scripts the server listed, for the #1659 prune pass. `ok: false` when
940
+ * the listing failed (an older server without the route, or a transient
941
+ * error) or when any per-script fetch failed — in either case this pull's
942
+ * picture of the type is incomplete and must not drive deletions. Scripts
943
+ * skipped for having no active config are still *present*, so their keys stay
944
+ * in the set and their local `.rhai` survives.
945
+ */
946
+ presence: PresenceOutcome;
947
+ /**
948
+ * Whether the script LISTING succeeded. Distinct from `presence`: a failed
949
+ * per-script fetch blocks pruning but still leaves the other scripts written,
950
+ * so their fresh state entries must be kept. Only a failed listing means
951
+ * nothing was written and the prior state slot should be preserved whole.
952
+ */
953
+ listOk: boolean;
954
+ /** Names the server listed, empty when the listing failed. */
955
+ serverKeys: string[];
956
+ }>;
957
+ export declare function registerSyncCommands(program: Command): void;
958
+ export {};