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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/README.md +105 -134
  2. package/assets/skill/skills/primitive-platform/SKILL.md +37 -4
  3. package/dist/bin/primitive.js +30 -35
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/agent-sessions.d.ts +133 -0
  6. package/dist/src/commands/agent-sessions.js +792 -0
  7. package/dist/src/commands/agent-sessions.js.map +1 -0
  8. package/dist/src/commands/analytics.js +0 -148
  9. package/dist/src/commands/analytics.js.map +1 -1
  10. package/dist/src/commands/apps-children.d.ts +54 -0
  11. package/dist/src/commands/apps-children.js +631 -0
  12. package/dist/src/commands/apps-children.js.map +1 -0
  13. package/dist/src/commands/apps.d.ts +6 -0
  14. package/dist/src/commands/apps.js +131 -9
  15. package/dist/src/commands/apps.js.map +1 -1
  16. package/dist/src/commands/auth-sessions.d.ts +3 -3
  17. package/dist/src/commands/auth-sessions.js +117 -23
  18. package/dist/src/commands/auth-sessions.js.map +1 -1
  19. package/dist/src/commands/auth.js +460 -36
  20. package/dist/src/commands/auth.js.map +1 -1
  21. package/dist/src/commands/collections.js +316 -256
  22. package/dist/src/commands/collections.js.map +1 -1
  23. package/dist/src/commands/config.d.ts +1 -1
  24. package/dist/src/commands/config.js +60 -28
  25. package/dist/src/commands/config.js.map +1 -1
  26. package/dist/src/commands/connections.js +11 -12
  27. package/dist/src/commands/connections.js.map +1 -1
  28. package/dist/src/commands/database-type-configs.js +2 -76
  29. package/dist/src/commands/database-type-configs.js.map +1 -1
  30. package/dist/src/commands/databases.d.ts +9 -0
  31. package/dist/src/commands/databases.js +221 -457
  32. package/dist/src/commands/databases.js.map +1 -1
  33. package/dist/src/commands/db3-types.d.ts +15 -0
  34. package/dist/src/commands/db3-types.js +157 -0
  35. package/dist/src/commands/db3-types.js.map +1 -0
  36. package/dist/src/commands/db3.d.ts +12 -0
  37. package/dist/src/commands/db3.js +1052 -0
  38. package/dist/src/commands/db3.js.map +1 -0
  39. package/dist/src/commands/documents.d.ts +121 -2
  40. package/dist/src/commands/documents.js +1601 -1251
  41. package/dist/src/commands/documents.js.map +1 -1
  42. package/dist/src/commands/env.d.ts +9 -1
  43. package/dist/src/commands/env.js +164 -49
  44. package/dist/src/commands/env.js.map +1 -1
  45. package/dist/src/commands/function-trigger-commands.d.ts +28 -0
  46. package/dist/src/commands/function-trigger-commands.js +341 -0
  47. package/dist/src/commands/function-trigger-commands.js.map +1 -0
  48. package/dist/src/commands/functions.js +297 -24
  49. package/dist/src/commands/functions.js.map +1 -1
  50. package/dist/src/commands/groups.js +150 -49
  51. package/dist/src/commands/groups.js.map +1 -1
  52. package/dist/src/commands/guides.js +5 -5
  53. package/dist/src/commands/init.d.ts +7 -0
  54. package/dist/src/commands/init.js +23 -5
  55. package/dist/src/commands/init.js.map +1 -1
  56. package/dist/src/commands/integrations.js +14 -8
  57. package/dist/src/commands/integrations.js.map +1 -1
  58. package/dist/src/commands/metadata-category-configs.d.ts +2 -2
  59. package/dist/src/commands/metadata-category-configs.js +2 -2
  60. package/dist/src/commands/prompts.d.ts +7 -0
  61. package/dist/src/commands/prompts.js +48 -5
  62. package/dist/src/commands/prompts.js.map +1 -1
  63. package/dist/src/commands/scripts.d.ts +9 -17
  64. package/dist/src/commands/scripts.js +24 -479
  65. package/dist/src/commands/scripts.js.map +1 -1
  66. package/dist/src/commands/sync-app-settings.d.ts +36 -8
  67. package/dist/src/commands/sync-app-settings.js +109 -23
  68. package/dist/src/commands/sync-app-settings.js.map +1 -1
  69. package/dist/src/commands/sync.d.ts +360 -610
  70. package/dist/src/commands/sync.js +3151 -6697
  71. package/dist/src/commands/sync.js.map +1 -1
  72. package/dist/src/commands/tokens.js +3 -3
  73. package/dist/src/commands/tokens.js.map +1 -1
  74. package/dist/src/commands/users.js +77 -2
  75. package/dist/src/commands/users.js.map +1 -1
  76. package/dist/src/commands/workflows.d.ts +5 -83
  77. package/dist/src/commands/workflows.js +57 -2282
  78. package/dist/src/commands/workflows.js.map +1 -1
  79. package/dist/src/lib/aggregate-output.d.ts +25 -0
  80. package/dist/src/lib/aggregate-output.js +53 -0
  81. package/dist/src/lib/aggregate-output.js.map +1 -0
  82. package/dist/src/lib/api-client.d.ts +681 -551
  83. package/dist/src/lib/api-client.js +880 -814
  84. package/dist/src/lib/api-client.js.map +1 -1
  85. package/dist/src/lib/app-settings-descriptor.d.ts +47 -1
  86. package/dist/src/lib/app-settings-descriptor.js +114 -10
  87. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  88. package/dist/src/lib/auth-fixtures.d.ts +44 -0
  89. package/dist/src/lib/auth-fixtures.js +61 -0
  90. package/dist/src/lib/auth-fixtures.js.map +1 -0
  91. package/dist/src/lib/auth-flow.d.ts +41 -1
  92. package/dist/src/lib/auth-flow.js +70 -16
  93. package/dist/src/lib/auth-flow.js.map +1 -1
  94. package/dist/src/lib/block-layout.d.ts +12 -23
  95. package/dist/src/lib/block-layout.js +26 -92
  96. package/dist/src/lib/block-layout.js.map +1 -1
  97. package/dist/src/lib/block-selector.d.ts +2 -2
  98. package/dist/src/lib/block-selector.js +2 -2
  99. package/dist/src/lib/child-apps-local.d.ts +164 -0
  100. package/dist/src/lib/child-apps-local.js +258 -0
  101. package/dist/src/lib/child-apps-local.js.map +1 -0
  102. package/dist/src/lib/ci-session-request.d.ts +22 -0
  103. package/dist/src/lib/ci-session-request.js +51 -0
  104. package/dist/src/lib/ci-session-request.js.map +1 -0
  105. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +10 -8
  106. package/dist/src/lib/codegen-shared/generatedFiles.js +21 -15
  107. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
  108. package/dist/src/lib/codegen-shared/prettierStable.d.ts +1 -1
  109. package/dist/src/lib/codegen-shared/prettierStable.js +1 -1
  110. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +2 -2
  111. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +2 -2
  112. package/dist/src/lib/collection-export.d.ts +76 -15
  113. package/dist/src/lib/collection-export.js +116 -23
  114. package/dist/src/lib/collection-export.js.map +1 -1
  115. package/dist/src/lib/collection-principal.d.ts +22 -0
  116. package/dist/src/lib/collection-principal.js +35 -0
  117. package/dist/src/lib/collection-principal.js.map +1 -0
  118. package/dist/src/lib/config-object-descriptor.d.ts +3 -22
  119. package/dist/src/lib/config-object-descriptor.js +56 -290
  120. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  121. package/dist/src/lib/config-payload.js +2 -3
  122. package/dist/src/lib/config-payload.js.map +1 -1
  123. package/dist/src/lib/config-surface.d.ts +5 -7
  124. package/dist/src/lib/config-surface.js +18 -40
  125. package/dist/src/lib/config-surface.js.map +1 -1
  126. package/dist/src/lib/connections-list.d.ts +10 -0
  127. package/dist/src/lib/connections-list.js +18 -0
  128. package/dist/src/lib/connections-list.js.map +1 -0
  129. package/dist/src/lib/credentials-home.d.ts +58 -0
  130. package/dist/src/lib/credentials-home.js +204 -0
  131. package/dist/src/lib/credentials-home.js.map +1 -0
  132. package/dist/src/lib/credentials-lock.d.ts +88 -0
  133. package/dist/src/lib/credentials-lock.js +302 -0
  134. package/dist/src/lib/credentials-lock.js.map +1 -0
  135. package/dist/src/lib/credentials-store.d.ts +179 -24
  136. package/dist/src/lib/credentials-store.js +712 -77
  137. package/dist/src/lib/credentials-store.js.map +1 -1
  138. package/dist/src/lib/csv.d.ts +8 -9
  139. package/dist/src/lib/csv.js +3 -4
  140. package/dist/src/lib/csv.js.map +1 -1
  141. package/dist/src/lib/custodian.d.ts +8 -0
  142. package/dist/src/lib/custodian.js +18 -0
  143. package/dist/src/lib/custodian.js.map +1 -0
  144. package/dist/src/lib/db-codegen/dbGenerator.js +5 -16
  145. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
  146. package/dist/src/lib/db-codegen/dbNaming.d.ts +5 -13
  147. package/dist/src/lib/db-codegen/dbNaming.js +5 -17
  148. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
  149. package/dist/src/lib/db-codegen/dbTemplates.d.ts +7 -56
  150. package/dist/src/lib/db-codegen/dbTemplates.js +25 -125
  151. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  152. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +2 -2
  153. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  154. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +67 -2
  155. package/dist/src/lib/db-codegen/dbTypeIR.js +13 -2
  156. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  157. package/dist/src/lib/db3-export.d.ts +231 -0
  158. package/dist/src/lib/db3-export.js +510 -0
  159. package/dist/src/lib/db3-export.js.map +1 -0
  160. package/dist/src/lib/db3-index-output.d.ts +27 -0
  161. package/dist/src/lib/db3-index-output.js +49 -0
  162. package/dist/src/lib/db3-index-output.js.map +1 -0
  163. package/dist/src/lib/document-export-lookups.d.ts +31 -0
  164. package/dist/src/lib/document-export-lookups.js +53 -0
  165. package/dist/src/lib/document-export-lookups.js.map +1 -0
  166. package/dist/src/lib/document-export-permissions.d.ts +7 -5
  167. package/dist/src/lib/document-export-permissions.js +7 -5
  168. package/dist/src/lib/document-export-permissions.js.map +1 -1
  169. package/dist/src/lib/document-export-record-log.d.ts +57 -0
  170. package/dist/src/lib/document-export-record-log.js +215 -0
  171. package/dist/src/lib/document-export-record-log.js.map +1 -0
  172. package/dist/src/lib/document-ingest-artifact.d.ts +26 -2
  173. package/dist/src/lib/document-ingest-artifact.js +42 -8
  174. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  175. package/dist/src/lib/document-ingest-format2.d.ts +36 -0
  176. package/dist/src/lib/document-ingest-format2.js +78 -0
  177. package/dist/src/lib/document-ingest-format2.js.map +1 -0
  178. package/dist/src/lib/document-ingest-input.d.ts +9 -0
  179. package/dist/src/lib/document-ingest-input.js +28 -1
  180. package/dist/src/lib/document-ingest-input.js.map +1 -1
  181. package/dist/src/lib/document-ingest-rows.d.ts +16 -0
  182. package/dist/src/lib/document-ingest-rows.js +17 -0
  183. package/dist/src/lib/document-ingest-rows.js.map +1 -1
  184. package/dist/src/lib/document-ingest.d.ts +33 -1
  185. package/dist/src/lib/document-ingest.js +49 -0
  186. package/dist/src/lib/document-ingest.js.map +1 -1
  187. package/dist/src/lib/document-schema-rows.d.ts +42 -0
  188. package/dist/src/lib/document-schema-rows.js +53 -0
  189. package/dist/src/lib/document-schema-rows.js.map +1 -0
  190. package/dist/src/lib/env-resolver-core.d.ts +70 -2
  191. package/dist/src/lib/env-resolver-core.js +137 -20
  192. package/dist/src/lib/env-resolver-core.js.map +1 -1
  193. package/dist/src/lib/env-resolver.d.ts +14 -2
  194. package/dist/src/lib/env-resolver.js +32 -10
  195. package/dist/src/lib/env-resolver.js.map +1 -1
  196. package/dist/src/lib/function-authorize-check.d.ts +142 -0
  197. package/dist/src/lib/function-authorize-check.js +310 -0
  198. package/dist/src/lib/function-authorize-check.js.map +1 -0
  199. package/dist/src/lib/function-authorize-view.d.ts +15 -0
  200. package/dist/src/lib/function-authorize-view.js +50 -0
  201. package/dist/src/lib/function-authorize-view.js.map +1 -0
  202. package/dist/src/lib/function-bundle.d.ts +38 -18
  203. package/dist/src/lib/function-bundle.js +96 -35
  204. package/dist/src/lib/function-bundle.js.map +1 -1
  205. package/dist/src/lib/function-collect.d.ts +75 -12
  206. package/dist/src/lib/function-collect.js +427 -12
  207. package/dist/src/lib/function-collect.js.map +1 -1
  208. package/dist/src/lib/function-db-types.d.ts +29 -0
  209. package/dist/src/lib/function-db-types.js +117 -7
  210. package/dist/src/lib/function-db-types.js.map +1 -1
  211. package/dist/src/lib/function-document-types.d.ts +5 -3
  212. package/dist/src/lib/function-document-types.js +10 -14
  213. package/dist/src/lib/function-document-types.js.map +1 -1
  214. package/dist/src/lib/function-lint.d.ts +34 -0
  215. package/dist/src/lib/function-lint.js +112 -0
  216. package/dist/src/lib/function-lint.js.map +1 -0
  217. package/dist/src/lib/function-log-row.js +21 -2
  218. package/dist/src/lib/function-log-row.js.map +1 -1
  219. package/dist/src/lib/function-run.d.ts +16 -21
  220. package/dist/src/lib/function-run.js +37 -30
  221. package/dist/src/lib/function-run.js.map +1 -1
  222. package/dist/src/lib/function-schema-codegen.d.ts +1 -1
  223. package/dist/src/lib/function-schema-codegen.js +5 -5
  224. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  225. package/dist/src/lib/function-source-roots.d.ts +67 -0
  226. package/dist/src/lib/function-source-roots.js +148 -0
  227. package/dist/src/lib/function-source-roots.js.map +1 -0
  228. package/dist/src/lib/function-sync.d.ts +108 -22
  229. package/dist/src/lib/function-sync.js +127 -39
  230. package/dist/src/lib/function-sync.js.map +1 -1
  231. package/dist/src/lib/function-trigger-listing.d.ts +11 -6
  232. package/dist/src/lib/function-trigger-listing.js +32 -11
  233. package/dist/src/lib/function-trigger-listing.js.map +1 -1
  234. package/dist/src/lib/function-typecheck.d.ts +37 -2
  235. package/dist/src/lib/function-typecheck.js +210 -28
  236. package/dist/src/lib/function-typecheck.js.map +1 -1
  237. package/dist/src/lib/function-versions.d.ts +2 -0
  238. package/dist/src/lib/function-versions.js +1 -0
  239. package/dist/src/lib/function-versions.js.map +1 -1
  240. package/dist/src/lib/generated-allowlist.js +0 -20
  241. package/dist/src/lib/generated-allowlist.js.map +1 -1
  242. package/dist/src/lib/generated-config-surfaces.d.ts +703 -203
  243. package/dist/src/lib/generated-config-surfaces.js +2270 -2014
  244. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  245. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  246. package/dist/src/lib/generated-sdk-types.js +1 -1
  247. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  248. package/dist/src/lib/init-adopt.js +12 -3
  249. package/dist/src/lib/init-adopt.js.map +1 -1
  250. package/dist/src/lib/init-login-note.d.ts +13 -0
  251. package/dist/src/lib/init-login-note.js +22 -0
  252. package/dist/src/lib/init-login-note.js.map +1 -0
  253. package/dist/src/lib/json-value.d.ts +6 -0
  254. package/dist/src/lib/json-value.js +13 -0
  255. package/dist/src/lib/json-value.js.map +1 -0
  256. package/dist/src/lib/load-routes.d.ts +33 -0
  257. package/dist/src/lib/load-routes.js +35 -0
  258. package/dist/src/lib/load-routes.js.map +1 -0
  259. package/dist/src/lib/local-state.d.ts +38 -7
  260. package/dist/src/lib/local-state.js +172 -49
  261. package/dist/src/lib/local-state.js.map +1 -1
  262. package/dist/src/lib/local-test-cases.d.ts +5 -2
  263. package/dist/src/lib/local-test-cases.js +7 -4
  264. package/dist/src/lib/local-test-cases.js.map +1 -1
  265. package/dist/src/lib/log-inspection.d.ts +42 -4
  266. package/dist/src/lib/log-inspection.js +37 -5
  267. package/dist/src/lib/log-inspection.js.map +1 -1
  268. package/dist/src/lib/login-exchange-check.d.ts +18 -0
  269. package/dist/src/lib/login-exchange-check.js +27 -0
  270. package/dist/src/lib/login-exchange-check.js.map +1 -0
  271. package/dist/src/lib/login-scope-lines.d.ts +25 -0
  272. package/dist/src/lib/login-scope-lines.js +45 -0
  273. package/dist/src/lib/login-scope-lines.js.map +1 -0
  274. package/dist/src/lib/logout-admin-session.d.ts +2 -1
  275. package/dist/src/lib/logout-admin-session.js +7 -1
  276. package/dist/src/lib/logout-admin-session.js.map +1 -1
  277. package/dist/src/lib/object-status-filter.d.ts +9 -1
  278. package/dist/src/lib/object-status-filter.js +9 -1
  279. package/dist/src/lib/object-status-filter.js.map +1 -1
  280. package/dist/src/lib/output.js +2 -0
  281. package/dist/src/lib/output.js.map +1 -1
  282. package/dist/src/lib/paginate.d.ts +0 -5
  283. package/dist/src/lib/paginate.js +0 -5
  284. package/dist/src/lib/paginate.js.map +1 -1
  285. package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
  286. package/dist/src/lib/pin-refusal-hint.js +35 -0
  287. package/dist/src/lib/pin-refusal-hint.js.map +1 -0
  288. package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
  289. package/dist/src/lib/primitive-env-plugin.js +408 -0
  290. package/dist/src/lib/primitive-env-plugin.js.map +1 -0
  291. package/dist/src/lib/project-config.d.ts +7 -0
  292. package/dist/src/lib/project-config.js +22 -1
  293. package/dist/src/lib/project-config.js.map +1 -1
  294. package/dist/src/lib/project-login-apps.d.ts +8 -0
  295. package/dist/src/lib/project-login-apps.js +27 -0
  296. package/dist/src/lib/project-login-apps.js.map +1 -0
  297. package/dist/src/lib/prompt-schema-codegen.d.ts +10 -3
  298. package/dist/src/lib/prompt-schema-codegen.js +52 -11
  299. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  300. package/dist/src/lib/pull-write.d.ts +31 -0
  301. package/dist/src/lib/pull-write.js +49 -0
  302. package/dist/src/lib/pull-write.js.map +1 -0
  303. package/dist/src/lib/push-failure-report.d.ts +45 -0
  304. package/dist/src/lib/push-failure-report.js +57 -0
  305. package/dist/src/lib/push-failure-report.js.map +1 -0
  306. package/dist/src/lib/records-verbs.d.ts +69 -0
  307. package/dist/src/lib/records-verbs.js +40 -0
  308. package/dist/src/lib/records-verbs.js.map +1 -0
  309. package/dist/src/lib/refresh-admin-credentials.d.ts +7 -0
  310. package/dist/src/lib/refresh-admin-credentials.js +16 -4
  311. package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
  312. package/dist/src/lib/root-import-decision.d.ts +65 -0
  313. package/dist/src/lib/root-import-decision.js +109 -0
  314. package/dist/src/lib/root-import-decision.js.map +1 -0
  315. package/dist/src/lib/run-status.d.ts +1 -1
  316. package/dist/src/lib/run-status.generated.d.ts +2 -2
  317. package/dist/src/lib/run-status.generated.js +3 -1
  318. package/dist/src/lib/run-status.generated.js.map +1 -1
  319. package/dist/src/lib/run-status.js +1 -1
  320. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
  321. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +269 -0
  322. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
  323. package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
  324. package/dist/src/lib/schema-codegen/naming.js +83 -0
  325. package/dist/src/lib/schema-codegen/naming.js.map +1 -0
  326. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +82 -0
  327. package/dist/src/lib/schema-codegen/schemaToTs.js +305 -0
  328. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
  329. package/dist/src/lib/scope-request.d.ts +84 -0
  330. package/dist/src/lib/scope-request.js +235 -0
  331. package/dist/src/lib/scope-request.js.map +1 -0
  332. package/dist/src/lib/session-id.d.ts +9 -0
  333. package/dist/src/lib/session-id.js +28 -0
  334. package/dist/src/lib/session-id.js.map +1 -0
  335. package/dist/src/lib/snapshot-build-rows.d.ts +21 -0
  336. package/dist/src/lib/snapshot-build-rows.js +22 -0
  337. package/dist/src/lib/snapshot-build-rows.js.map +1 -1
  338. package/dist/src/lib/snapshot-build.js +8 -3
  339. package/dist/src/lib/snapshot-build.js.map +1 -1
  340. package/dist/src/lib/snapshots.d.ts +17 -1
  341. package/dist/src/lib/snapshots.js +50 -2
  342. package/dist/src/lib/snapshots.js.map +1 -1
  343. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +6 -2
  344. package/dist/src/lib/swift-codegen/agentGenerator.js +57 -5
  345. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  346. package/dist/src/lib/swift-codegen/banners.d.ts +34 -7
  347. package/dist/src/lib/swift-codegen/banners.js +37 -7
  348. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  349. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +4 -3
  350. package/dist/src/lib/swift-codegen/dbGenerator.js +14 -117
  351. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
  352. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +3 -3
  353. package/dist/src/lib/swift-codegen/functionGenerator.js +23 -18
  354. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  355. package/dist/src/lib/swift-codegen/generator.d.ts +5 -5
  356. package/dist/src/lib/swift-codegen/generator.js +35 -40
  357. package/dist/src/lib/swift-codegen/generator.js.map +1 -1
  358. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +3 -3
  359. package/dist/src/lib/swift-codegen/schemaToSwift.js +4 -4
  360. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  361. package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
  362. package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
  363. package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
  364. package/dist/src/lib/sync-paths.d.ts +35 -0
  365. package/dist/src/lib/sync-paths.js +57 -5
  366. package/dist/src/lib/sync-paths.js.map +1 -1
  367. package/dist/src/lib/sync-resource-types.d.ts +26 -26
  368. package/dist/src/lib/sync-resource-types.js +61 -189
  369. package/dist/src/lib/sync-resource-types.js.map +1 -1
  370. package/dist/src/lib/sync-selectors.d.ts +5 -1
  371. package/dist/src/lib/sync-selectors.js +23 -13
  372. package/dist/src/lib/sync-selectors.js.map +1 -1
  373. package/dist/src/lib/test-case-file-names.d.ts +3 -5
  374. package/dist/src/lib/test-case-file-names.js +3 -5
  375. package/dist/src/lib/test-case-file-names.js.map +1 -1
  376. package/dist/src/lib/toml-database-config.d.ts +15 -75
  377. package/dist/src/lib/toml-database-config.js +17 -306
  378. package/dist/src/lib/toml-database-config.js.map +1 -1
  379. package/dist/src/lib/transient-retry.d.ts +43 -0
  380. package/dist/src/lib/transient-retry.js +94 -0
  381. package/dist/src/lib/transient-retry.js.map +1 -0
  382. package/dist/src/lib/vars-override.d.ts +105 -0
  383. package/dist/src/lib/vars-override.js +143 -0
  384. package/dist/src/lib/vars-override.js.map +1 -0
  385. package/dist/src/lib/webhook-capture.d.ts +43 -0
  386. package/dist/src/lib/webhook-capture.js +91 -0
  387. package/dist/src/lib/webhook-capture.js.map +1 -0
  388. package/dist/src/lib/webhook-deliver.d.ts +18 -20
  389. package/dist/src/lib/webhook-deliver.js +34 -89
  390. package/dist/src/lib/webhook-deliver.js.map +1 -1
  391. package/dist/src/lib/webhook-test-run.d.ts +32 -0
  392. package/dist/src/lib/webhook-test-run.js +108 -0
  393. package/dist/src/lib/webhook-test-run.js.map +1 -0
  394. package/dist/src/lib/workflow-codegen/generator.d.ts +7 -7
  395. package/dist/src/lib/workflow-codegen/generator.js +16 -23
  396. package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
  397. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +6 -12
  398. package/dist/src/lib/workflow-codegen/invokerIR.js +4 -5
  399. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
  400. package/dist/src/lib/workflow-toml-validator.d.ts +2 -0
  401. package/dist/src/lib/workflow-toml-validator.js +28 -1
  402. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  403. package/dist/src/types/index.d.ts +30 -37
  404. package/dist/src/validators.d.ts +7 -55
  405. package/dist/src/validators.js +7 -53
  406. package/dist/src/validators.js.map +1 -1
  407. package/dist/src/vite.d.ts +17 -0
  408. package/dist/src/vite.js +18 -0
  409. package/dist/src/vite.js.map +1 -0
  410. package/package.json +20 -12
@@ -1,5 +1,16 @@
1
1
  import { type ListEnvelope } from "./paginate.js";
2
- import { type GlobalAppRef, type WorkflowUsageReport } from "./workflow-usage.js";
2
+ /**
3
+ * #4262 — an agent prompt's test case: its `[test.agent]` block on the wire.
4
+ * `agentHistory` is JSON text; context and the expected call are parsed.
5
+ */
6
+ export interface AgentTestCaseWireFields {
7
+ agentHistory?: string | null;
8
+ agentContext?: Record<string, any> | null;
9
+ agentTimezone?: string | null;
10
+ agentLocale?: string | null;
11
+ agentExpectedToolCall?: Record<string, any> | null;
12
+ agentExpectedNoToolCall?: boolean | null;
13
+ }
3
14
  /**
4
15
  * Metadata for a single bucket blob, as returned by the metadata endpoint
5
16
  * `GET blob-buckets/:bucketId/blobs/:blobId/metadata`. Mirrors the published
@@ -17,6 +28,49 @@ export interface BlobInfo {
17
28
  uploaded?: string | null;
18
29
  etag?: string | null;
19
30
  }
31
+ /**
32
+ * One child app as `GET /admin/api/apps/{appId}/children` lists it. Dates
33
+ * are ISO-8601 strings.
34
+ */
35
+ export interface AppChildSummary {
36
+ appId: string;
37
+ name: string;
38
+ childSlug: string;
39
+ parentAppId: string;
40
+ ownerAdminId: string | null;
41
+ owner: {
42
+ adminId: string;
43
+ email: string;
44
+ name: string | null;
45
+ } | null;
46
+ branch: string | null;
47
+ idleDays: number | null;
48
+ createdAt: string;
49
+ lastActivityAt: string | null;
50
+ expiresAt: string | null;
51
+ /** Exact origins the child's CORS and email-redirect checks accept beside its authored lists. */
52
+ previewOrigins?: string[];
53
+ /** The child's protection level: always `internal` (#4564); absent from an older server. */
54
+ protection?: string;
55
+ }
56
+ /** A child's preview origins after a write to them. */
57
+ export interface ChildPreviewOrigins {
58
+ appId: string;
59
+ parentAppId: string;
60
+ childSlug: string;
61
+ previewOrigins: string[];
62
+ }
63
+ /** One row of a db3's index registry, as `db3/:id/indexes` answers it. */
64
+ export interface Db3IndexRow {
65
+ name: string;
66
+ model: string;
67
+ fields: string[];
68
+ unique: boolean;
69
+ origins: Array<{
70
+ kind: "declaration" | "named";
71
+ unique: boolean;
72
+ }>;
73
+ }
20
74
  export declare class ApiError extends Error {
21
75
  statusCode: number;
22
76
  code?: string;
@@ -64,9 +118,11 @@ export declare function blobFailure(response: Response, prefix: string): Promise
64
118
  * integrations proxy) use `message`. This helper reads both fields so all CLI
65
119
  * call sites surface the real server message instead of `HTTP <status>`.
66
120
  *
67
- * `htmlNotFound` is set when the body looks like an HTML 404 page (typically
68
- * served when an API path is wrong); callers can use it to throw a clearer
69
- * "API endpoint not found" message regardless of the original status code.
121
+ * `htmlNotFound` is set when the body is an HTML 404 page (typically served
122
+ * when an API path is wrong); callers can use it to throw a clearer
123
+ * "API endpoint not found" message. An HTML page with any other status — a
124
+ * gateway's 502, a rate limiter's 429, a firewall's 403 — keeps its status, so
125
+ * a retry and an absence check read it as what it is (#4148).
70
126
  *
71
127
  * `details` can be either an array (legacy validation-issue list) or a
72
128
  * structured record (issue #666 schema gate); the schema-feature errors
@@ -90,51 +146,11 @@ export interface ParsedErrorResponse {
90
146
  export declare function parseErrorResponse(response: {
91
147
  status: number;
92
148
  }, text: string, path?: string): ParsedErrorResponse;
93
- /**
94
- * Typed exception classes for the database-schema feature (issue #666).
95
- * Each maps 1:1 to a server `code` value emitted from the op-edit or
96
- * schema-edit gate. They all extend ApiError so existing catch-all paths
97
- * continue to work; specialized catch blocks can branch on `instanceof`.
98
- *
99
- * Per round-2 addendum A1, `details` is always preserved so callers can
100
- * extract structured offender lists (refs[], operations[], etc.).
101
- */
102
- export declare class SchemaRequiredError extends ApiError {
103
- constructor(message: string, details?: Record<string, any>);
104
- }
105
- export declare class OperationRefError extends ApiError {
106
- constructor(message: string, details?: Record<string, any>);
107
- get refs(): Array<{
108
- ref: string;
109
- location: string;
110
- }>;
111
- }
112
- export declare class SchemaBreaksOpsError extends ApiError {
113
- constructor(message: string, details?: Record<string, any>);
114
- get operations(): Array<{
115
- operation: string;
116
- refs: Array<{
117
- ref: string;
118
- location: string;
119
- }>;
120
- }>;
121
- }
122
- export declare class SchemaHasUncheckableOpsError extends ApiError {
123
- constructor(message: string, details?: Record<string, any>);
124
- get operations(): Array<{
125
- operation: string;
126
- locations: string[];
127
- }>;
128
- }
129
149
  export declare class TomlParseError extends ApiError {
130
150
  constructor(message: string, details?: Record<string, any>);
131
151
  get line(): number | undefined;
132
152
  get column(): number | undefined;
133
153
  }
134
- export declare class OpsExistError extends ApiError {
135
- constructor(message: string, details?: Record<string, any>);
136
- get opCount(): number;
137
- }
138
154
  interface EmailTemplateSummary {
139
155
  emailType: string;
140
156
  label: string;
@@ -368,13 +384,7 @@ export interface ArchiveEnvelope {
368
384
  archived?: boolean;
369
385
  [key: string]: unknown;
370
386
  }
371
- /**
372
- * Body accepted by integration create and update (#2631).
373
- *
374
- * `accessRule` is the CEL expression gating who may invoke the integration
375
- * through the proxy. The server REQUIRES it on create; on update, `null` or
376
- * `""` clears it, and a cleared rule denies every non-admin call.
377
- */
387
+ /** Body accepted by integration create and update (#2631). */
378
388
  export interface IntegrationWritePayload {
379
389
  integrationKey?: string;
380
390
  displayName?: string;
@@ -382,11 +392,10 @@ export interface IntegrationWritePayload {
382
392
  requestConfig?: any;
383
393
  timeoutMs?: number;
384
394
  status?: string;
385
- accessRule?: string | null;
386
395
  }
387
396
  /**
388
- * Integration detail response. `accessRule` is only on the detail — the list
389
- * summary does not carry it (#2631).
397
+ * Integration detail response. `requestConfig` is only on the detail — the
398
+ * list summary does not carry it.
390
399
  */
391
400
  export interface IntegrationDetail {
392
401
  integrationId: string;
@@ -396,7 +405,6 @@ export interface IntegrationDetail {
396
405
  status?: string;
397
406
  timeoutMs?: number;
398
407
  requestConfig?: any;
399
- accessRule?: string | null;
400
408
  modifiedAt?: string;
401
409
  [key: string]: any;
402
410
  }
@@ -412,20 +420,6 @@ interface AnalyticsIntegrationMetricsResponse {
412
420
  integrations: AnalyticsIntegrationMetric[];
413
421
  _timing: AnalyticsTiming;
414
422
  }
415
- interface WorkflowAnalyticsSummary {
416
- workflowKey: string;
417
- runs: number;
418
- successRate: number;
419
- medianDurationMs: number;
420
- p95: number;
421
- totalTokens: number;
422
- }
423
- interface TopWorkflowsResponse {
424
- windowDays: number;
425
- limit: number;
426
- workflows: WorkflowAnalyticsSummary[];
427
- _timing: AnalyticsTiming;
428
- }
429
423
  interface PromptAnalyticsSummary {
430
424
  promptKey: string;
431
425
  executions: number;
@@ -471,35 +465,6 @@ export interface DatabaseBatchOperation {
471
465
  */
472
466
  condition?: Record<string, any>;
473
467
  }
474
- /**
475
- * Normalize a `databases operations execute` result to the CLI's one list
476
- * envelope — but only when the result is a Durable Object query page
477
- * (issue #2440).
478
- *
479
- * A registered operation is a list only sometimes. Of the shapes the server's
480
- * operation dispatch can return, exactly two carry a top-level `data` array: a
481
- * bare `query` and a `pipeline` whose `returnField` names a query step. A
482
- * `count` (`{ count }`), an `aggregate` (`{ result }`), a mutation
483
- * (`{ results }`), an `applyToQuery` (`{ matched, affected, failed, … }`) and a
484
- * `returnField: "all"` pipeline (`{ steps: { … } }`) do not, so blanket
485
- * normalization would corrupt them. This helper therefore tests the shape
486
- * first and passes everything else through byte-for-byte — including the
487
- * nested steps of a `returnField: "all"` pipeline, which are operation-defined
488
- * objects the CLI must not reach into.
489
- *
490
- * Deliberately narrow, not a general-purpose predicate: the contract is
491
- * specifically "an operations-execute result may be a DO query page".
492
- * `executeDatabaseOperation()` is the only caller.
493
- *
494
- * The conversion itself is delegated to `normalizeCliListEnvelope()` so cursor
495
- * handling, `prevCursor` dropping and `hasMore` derivation have exactly one
496
- * implementation. That helper throws on an unrecognized shape — correct when
497
- * the payload is supposed to be a list, wrong here, where the payload is the
498
- * caller's own result — which is why the shape test has to run first. `_timing`
499
- * (`--timing`) is re-attached afterwards, since it rides alongside the envelope
500
- * rather than inside it.
501
- */
502
- export declare function normalizeDatabaseOperationResult(raw: unknown): unknown;
503
468
  export declare class ApiClient {
504
469
  /**
505
470
  * Loaded on first use (`ensureAuthenticated`), never in a constructor.
@@ -522,6 +487,40 @@ export declare class ApiClient {
522
487
  private ensureAuthenticated;
523
488
  private refreshToken;
524
489
  request<T = any>(path: string, options?: RequestInit): Promise<T>;
490
+ /**
491
+ * Whether a 403 should be retried with the stored step-up: it names
492
+ * `admin` among the missing scopes, or it is a protected app's refusal of
493
+ * a token that is no step-up, and an unexpired step-up is stored.
494
+ */
495
+ private stepUpApplies;
496
+ /**
497
+ * #4564 — a request outside `request` (an upload, a function invocation)
498
+ * sent with the CLI's own credentials, retried once with the stored step-up
499
+ * exactly as `request` retries. `init` builds the request for a bearer. The
500
+ * answer is the retry's, unless the retry was refused 401: the step-up is
501
+ * dropped and the original refusal comes back, still readable.
502
+ */
503
+ private fetchWithStepUp;
504
+ /** Forget a step-up the server no longer accepts. */
505
+ private dropStepUp;
506
+ /** The typed error a failed response throws. */
507
+ private responseError;
508
+ /**
509
+ * `POST /admin/api/auth/token` — derive a token no wider than the stored
510
+ * one (`primitive token --scope`, #3889). A wider request is refused with
511
+ * `TOKEN_WIDER_THAN_PRESENTED`.
512
+ */
513
+ exchangeToken(body: {
514
+ scope: string[];
515
+ apps?: string[];
516
+ ttl?: string;
517
+ }): Promise<{
518
+ accessToken: string;
519
+ expiresAt: string;
520
+ sessionId: string;
521
+ scope: string[];
522
+ apps: string[];
523
+ }>;
525
524
  get<T = any>(path: string, params?: Record<string, any>): Promise<T>;
526
525
  post<T = any>(path: string, body?: any): Promise<T>;
527
526
  put<T = any>(path: string, body?: any): Promise<T>;
@@ -540,11 +539,14 @@ export declare class ApiClient {
540
539
  listAppsPage(params?: {
541
540
  limit?: number;
542
541
  cursor?: string;
542
+ kind?: "parent" | "child";
543
543
  }): Promise<{
544
544
  items: Array<{
545
545
  id: string;
546
546
  name: string;
547
547
  role?: string;
548
+ parentAppId?: string | null;
549
+ childSlug?: string | null;
548
550
  }>;
549
551
  hasMore?: boolean;
550
552
  nextCursor?: string | null;
@@ -563,25 +565,44 @@ export declare class ApiClient {
563
565
  }>;
564
566
  }>;
565
567
  /**
566
- * Every app on the server, not just the caller's own.
567
- *
568
- * Deliberately separate from `listApps()`, whose contract is "apps assigned
569
- * to me" (`GET /admin/api/admins/me/apps`, backed by `admin.queryApps()`) —
570
- * the contract every other command depends on. `analytics workflow-usage
571
- * --all-apps` has to reach apps nobody is assigned to, which is the global
572
- * route `GET /admin/api/apps` (`App.iterateAll()`), and that route
573
- * identifies an app as `appId` rather than `id` (D3130-001).
574
- *
575
- * One drain of that route is lossy — its cursor re-scans `App.iterateAll()`
576
- * from the start of each page, so a list that changes under it both repeats
577
- * and drops rows — so the walk is the union of repeated drains
578
- * (`drainAppsUntilConverged`, which carries the measurement).
568
+ * Create an app. An ordinary app takes `name` (and, for a super-admin,
569
+ * `initialAdminEmail`). A child app takes `parentAppId` and `childSlug`
570
+ * instead, plus the optional `branch`, `idleDays` (7-30, default 30) and
571
+ * `copySecrets` (default true); the server names it `<parent name> /
572
+ * <slug>` and copies the parent's settings.
579
573
  */
580
- listAllAppsGlobal(): Promise<GlobalAppRef[]>;
581
574
  createApp(data: {
582
- name: string;
575
+ name?: string;
583
576
  initialAdminEmail?: string;
577
+ parentAppId?: string;
578
+ childSlug?: string;
579
+ branch?: string;
580
+ idleDays?: number;
581
+ copySecrets?: boolean;
584
582
  }): Promise<any>;
583
+ /**
584
+ * One page of an app's child apps, in creation order
585
+ * (`GET /admin/api/apps/{appId}/children`).
586
+ */
587
+ listAppChildren(parentAppId: string, params?: {
588
+ limit?: number;
589
+ cursor?: string;
590
+ }): Promise<{
591
+ items: AppChildSummary[];
592
+ hasMore: boolean;
593
+ nextCursor: string | null;
594
+ }>;
595
+ /**
596
+ * Add one origin to a child's preview origins
597
+ * (`POST /admin/api/apps/{parentAppId}/children/{slug}/preview-origins`).
598
+ */
599
+ addChildPreviewOrigin(parentAppId: string, slug: string, origin: string): Promise<ChildPreviewOrigins>;
600
+ /**
601
+ * Remove one origin from a child's preview origins
602
+ * (`DELETE /admin/api/apps/{parentAppId}/children/{slug}/preview-origins`).
603
+ */
604
+ removeChildPreviewOrigin(parentAppId: string, slug: string, origin: string): Promise<ChildPreviewOrigins>;
605
+ private childPreviewOriginsPath;
585
606
  getApp(appId: string): Promise<{
586
607
  id: string;
587
608
  name: string;
@@ -592,7 +613,23 @@ export declare class ApiClient {
592
613
  addUserByEmail(appId: string, data: {
593
614
  email: string;
594
615
  role?: string;
616
+ name?: string;
617
+ avatarUrl?: string | null;
595
618
  }): Promise<any>;
619
+ /**
620
+ * Set a member's display name and/or avatar URL
621
+ * (`PATCH /admin/api/apps/:appId/users/:userId/profile`). An omitted field
622
+ * is left alone; `avatarUrl: null` or `""` clears the avatar.
623
+ */
624
+ setUserProfile(appId: string, userId: string, data: {
625
+ name?: string;
626
+ avatarUrl?: string | null;
627
+ }): Promise<{
628
+ userId: string;
629
+ email: string;
630
+ name: string | null;
631
+ avatarUrl: string | null;
632
+ }>;
596
633
  mintTestJwt(appId: string, userId: string, role?: string): Promise<any>;
597
634
  rebuildUserSearchText(appId: string): Promise<{
598
635
  count: number;
@@ -696,7 +733,7 @@ export declare class ApiClient {
696
733
  hasMore?: boolean;
697
734
  nextCursor?: string | null;
698
735
  }>;
699
- /** Integration detail (#2631: `accessRule` is on the detail, not the list summary). */
736
+ /** Integration detail (`requestConfig` is on the detail, not the list summary). */
700
737
  getIntegration(appId: string, integrationId: string): Promise<IntegrationDetail>;
701
738
  /**
702
739
  * An integration's named configs. Test cases pin a config by NAME so the
@@ -726,9 +763,8 @@ export declare class ApiClient {
726
763
  source?: "user" | "admin" | "test" | "workflow" | "function";
727
764
  /** #3691 — only the calls this run made, workflow run or function run. */
728
765
  runId?: string;
729
- }): Promise<any[]>;
730
- listWorkflowRunIntegrationLogs(appId: string, runId: string, params?: {
731
- limit?: number;
766
+ /** #3781 — only the calls this step made: a workflow step id or a function step name. */
767
+ stepId?: string;
732
768
  }): Promise<any[]>;
733
769
  listAppSecrets(appId: string): Promise<any[]>;
734
770
  createAppSecret(appId: string, payload: {
@@ -753,33 +789,6 @@ export declare class ApiClient {
753
789
  expectNotExists?: boolean;
754
790
  }): Promise<any>;
755
791
  deleteAppConfigVar(appId: string, key: string, expectedModifiedAt?: string): Promise<any>;
756
- listWebhooks(appId: string, params?: {
757
- status?: string;
758
- cursor?: string;
759
- limit?: number;
760
- }): Promise<{
761
- items: any[];
762
- hasMore?: boolean;
763
- nextCursor?: string | null;
764
- }>;
765
- getWebhook(appId: string, webhookId: string): Promise<any>;
766
- createWebhook(appId: string, payload: any): Promise<any>;
767
- updateWebhook(appId: string, webhookId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
768
- /**
769
- * Delete a webhook. Archives it by default; `hard` hard-deletes the row
770
- * instead (#2232), which is what frees a slot under the per-app webhook cap
771
- * and releases the webhook key for reuse. Same `?hard=true` verb the admin
772
- * integrations delete uses.
773
- */
774
- deleteWebhook(appId: string, webhookId: string, options?: {
775
- hard?: boolean;
776
- }): Promise<ArchiveEnvelope>;
777
- /**
778
- * #2803 — the operational verb pair for a webhook. It posts to the
779
- * enable/disable route rather than PATCHing `status`, which is server-owned
780
- * and refused on every configuration write path.
781
- */
782
- setWebhookAvailability(appId: string, webhookId: string, action: "enable" | "disable"): Promise<any>;
783
792
  listFunctions(appId: string): Promise<{
784
793
  items: any[];
785
794
  }>;
@@ -811,6 +820,30 @@ export declare class ApiClient {
811
820
  items: any[];
812
821
  nextCursor?: string | null;
813
822
  }>;
823
+ private functionTriggersPath;
824
+ /** The function's webhook delivery log, newest first. */
825
+ listFunctionWebhookEvents(appId: string, functionId: string, params?: {
826
+ limit?: number;
827
+ cursor?: string;
828
+ }): Promise<{
829
+ items: any[];
830
+ hasMore?: boolean;
831
+ nextCursor?: string | null;
832
+ }>;
833
+ /** Sign a preview delivery for the function's webhook trigger. */
834
+ testFunctionWebhook(appId: string, functionId: string, payload?: any): Promise<any>;
835
+ /** Check captured headers and a captured body against the trigger's verifier. */
836
+ verifyFunctionWebhook(appId: string, functionId: string, payload: {
837
+ headers: Array<[string, string]>;
838
+ rawBody?: string;
839
+ bodyBase64?: string;
840
+ }): Promise<any>;
841
+ /** Point the trigger's `signingSecret` at a new `{{secrets.KEY}}` reference. */
842
+ rotateFunctionWebhookSecret(appId: string, functionId: string, payload: {
843
+ signingSecret: string;
844
+ }): Promise<any>;
845
+ /** One cron entry verb: `fire`, `fire-scheduled`, `enable` or `disable`. */
846
+ functionCronEntryAction(appId: string, functionId: string, name: string, action: "fire" | "fire-scheduled" | "enable" | "disable"): Promise<any>;
814
847
  /**
815
848
  * A function run's step trace — #3348.
816
849
  *
@@ -823,6 +856,17 @@ export declare class ApiClient {
823
856
  getFunctionStepRuns(appId: string, functionId: string, runId: string): Promise<{
824
857
  items: any[];
825
858
  }>;
859
+ /**
860
+ * The integration calls one function run made — #3190.
861
+ *
862
+ * The run → integration-logs pivot, addressed by the function that owns the
863
+ * run (it was `workflows/runs/{runId}/integration-logs`).
864
+ */
865
+ listFunctionRunIntegrationLogs(appId: string, functionId: string, runId: string, options?: {
866
+ limit?: number;
867
+ }): Promise<{
868
+ items: any[];
869
+ }>;
826
870
  /**
827
871
  * End a function run that will not settle — #3348.
828
872
  *
@@ -910,9 +954,8 @@ export declare class ApiClient {
910
954
  /**
911
955
  * Which runtime this call means — #3482. The ROUTE is the selector:
912
956
  * `POST functions/{key}` runs the function inside the request and
913
- * `POST functions/{key}/start` runs it as a task. The admin-only system
914
- * door is ONE route for both, so `--as system` keeps naming its runtime
915
- * in the body (F-3482-007); phase 7's rename may fold it.
957
+ * `POST functions/{key}/start` runs it as a task; the admin-only system
958
+ * door has `invoke-as-system` and `start-as-system` (#3190).
916
959
  */
917
960
  runtime?: "request" | "task";
918
961
  }): Promise<{
@@ -920,6 +963,18 @@ export declare class ApiClient {
920
963
  retryAfterSeconds: number | null;
921
964
  body: any;
922
965
  }>;
966
+ /**
967
+ * Run only a function's `authorize` and hand back the ANSWER, whatever its
968
+ * HTTP status — #4732. Like `invokeFunction`, it returns a refusal rather
969
+ * than throwing it, so `functions authorize` renders the server's own
970
+ * answer (and a case run records it as a failed row); it throws only when
971
+ * the request did not complete. The CLI's own credentials, with the
972
+ * step-up retry a protected app's refusal asks for.
973
+ */
974
+ authorizeFunction(appId: string, functionId: string, body: Record<string, unknown>): Promise<{
975
+ httpStatus: number;
976
+ body: any;
977
+ }>;
923
978
  /**
924
979
  * A function's versions, newest first (#3462).
925
980
  *
@@ -954,28 +1009,15 @@ export declare class ApiClient {
954
1009
  setPromptAvailability(appId: string, promptId: string, action: "enable" | "disable"): Promise<any>;
955
1010
  /** #2803 — the operational verb pair for an integration (admin API). */
956
1011
  setIntegrationAvailability(appId: string, integrationId: string, action: "enable" | "disable"): Promise<any>;
957
- rotateWebhookSecret(appId: string, webhookId: string, payload: {
958
- signingSecret: string;
959
- }): Promise<any>;
960
- listWebhookEvents(appId: string, webhookId: string, params?: {
961
- limit?: number;
962
- cursor?: string;
963
- }): Promise<{
964
- items: any[];
965
- hasMore?: boolean;
966
- nextCursor?: string | null;
967
- }>;
968
1012
  /**
969
1013
  * List the live connections the server believes exist for exactly one of a
970
- * document, user, or database. Read-only inspection over admin-api. Rows are
1014
+ * document or user. Read-only inspection over admin-api. Rows are
971
1015
  * per-connection-×-subscription bindings, so `connectionId` is not unique
972
- * across rows. `params` on a database-subscription row is caller-defined
973
- * bound CEL input — typed `unknown`.
1016
+ * across rows.
974
1017
  */
975
1018
  listConnections(appId: string, selector: {
976
1019
  documentId?: string;
977
1020
  userId?: string;
978
- databaseId?: string;
979
1021
  }, params?: {
980
1022
  limit?: number;
981
1023
  cursor?: string;
@@ -984,6 +1026,28 @@ export declare class ApiClient {
984
1026
  hasMore?: boolean;
985
1027
  nextCursor?: string | null;
986
1028
  }>;
1029
+ /**
1030
+ * One page of one user's agent sessions (#3809): the app API's sessions
1031
+ * list, which an app owner or admin may read for any user.
1032
+ */
1033
+ listAgentSessions(appId: string, params: {
1034
+ userId: string;
1035
+ agent?: string;
1036
+ scope?: string;
1037
+ limit?: number;
1038
+ cursor?: string;
1039
+ }): Promise<{
1040
+ items: unknown[];
1041
+ hasMore?: boolean;
1042
+ nextCursor?: string | null;
1043
+ }>;
1044
+ /**
1045
+ * One agent session (#3809): its binding, status, members and active turn,
1046
+ * and for an app owner or admin the session object's state. Never its rows.
1047
+ */
1048
+ getAgentSession(appId: string, sessionId: string): Promise<any>;
1049
+ /** Delete an agent session and its document (#3809); a repeat succeeds again. */
1050
+ deleteAgentSession(appId: string, sessionId: string): Promise<any>;
987
1051
  listSessions(appId: string, userId: string, params?: {
988
1052
  limit?: number;
989
1053
  cursor?: string;
@@ -1010,20 +1074,6 @@ export declare class ApiClient {
1010
1074
  sessionId: string;
1011
1075
  revokedAt: string;
1012
1076
  }>;
1013
- testWebhook(appId: string, webhookId: string, payload?: any): Promise<any>;
1014
- /**
1015
- * Run a webhook's configured verifier over headers and a body captured from
1016
- * a real delivery, and report whether that signature checks out (#2445).
1017
- *
1018
- * `headers` is sent as ordered `[name, value]` pairs so a capture carrying a
1019
- * field name on more than one line survives the round trip. Nothing is
1020
- * delivered: no delivery record, no workflow run.
1021
- */
1022
- verifyWebhook(appId: string, webhookId: string, payload: {
1023
- headers: Array<[string, string]>;
1024
- rawBody?: string;
1025
- bodyBase64?: string;
1026
- }): Promise<any>;
1027
1077
  listLocks(appId: string): Promise<{
1028
1078
  locks: any[];
1029
1079
  }>;
@@ -1034,29 +1084,6 @@ export declare class ApiClient {
1034
1084
  */
1035
1085
  acquireLock(appId: string, key: string, ttlMs: number, owner?: string): Promise<any>;
1036
1086
  releaseLock(appId: string, key: string, handleId: string): Promise<any>;
1037
- listCronTriggers(appId: string): Promise<{
1038
- items: any[];
1039
- }>;
1040
- getCronTrigger(appId: string, triggerId: string): Promise<any>;
1041
- createCronTrigger(appId: string, payload: any): Promise<any>;
1042
- updateCronTrigger(appId: string, triggerId: string, payload: any): Promise<any>;
1043
- /**
1044
- * Retire a cron trigger. The default soft-deletes (writes the `archived`
1045
- * tombstone); `{ hard: true }` destroys the row, which is what
1046
- * `config push --prune` passes (#2803) so a pruned trigger stops consuming
1047
- * the per-app cap and holding its key.
1048
- */
1049
- deleteCronTrigger(appId: string, triggerId: string, options?: {
1050
- hard?: boolean;
1051
- }): Promise<ArchiveEnvelope>;
1052
- disableCronTrigger(appId: string, triggerId: string): Promise<any>;
1053
- enableCronTrigger(appId: string, triggerId: string): Promise<any>;
1054
- testCronTrigger(appId: string, triggerId: string): Promise<any>;
1055
- listIterations(appId: string): Promise<{
1056
- items: any[];
1057
- }>;
1058
- getIteration(appId: string, iterationName: string): Promise<any>;
1059
- resetIteration(appId: string, iterationName: string): Promise<any>;
1060
1087
  readResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string): Promise<any>;
1061
1088
  writeResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string, data: Record<string, any>): Promise<any>;
1062
1089
  batchReadResourceMetadata(appId: string, requests: Array<{
@@ -1149,44 +1176,16 @@ export declare class ApiClient {
1149
1176
  * is a distinct block version: `configId` is the stable version selector,
1150
1177
  * `contentHash` is its content identity, and `status` reports whether it is
1151
1178
  * `active`/`draft`/`archived`. The script header's `activeConfigId` names
1152
- * the live version. Used by `scripts configs list` and by the script test
1153
- * commands to run against a specific pinned version.
1179
+ * the version that was live. Used by `scripts configs list`.
1154
1180
  */
1155
1181
  listScriptConfigs(appId: string, scriptId: string): Promise<{
1156
1182
  items: any[];
1157
1183
  }>;
1158
- createScript(appId: string, payload: {
1159
- name: string;
1160
- body: string;
1161
- description?: string;
1162
- }): Promise<any>;
1163
- /**
1164
- * Push a new body for an existing script by creating a new `ScriptConfig`
1165
- * and activating it (the prompt-model "edit → activate" flow). Referencing
1166
- * workflows pick up the new body on their next run with no fan-out. The
1167
- * config name is unique per script, so we mint a timestamped name.
1168
- */
1169
- pushScriptBody(appId: string, scriptId: string, body: string,
1170
1184
  /**
1171
- * The active state the caller believes holds right now (#2731 B10).
1172
- * Creating an inactive config races nothing, so the guard sits on the
1173
- * ACTIVATION step: if the active config has moved since the caller read it,
1174
- * the server rejects with a 409 instead of overwriting a concurrent script
1175
- * change. It takes BOTH halves of "what is active", because a config's body
1176
- * can be edited in place without the active id changing — the id alone
1177
- * would let such an edit through. Omitted (e.g. `--force`) means activate
1178
- * unconditionally.
1185
+ * One version of a script, body included. A body the server cannot load
1186
+ * answers a 404 naming the version rather than an empty body.
1179
1187
  */
1180
- expectedActive?: {
1181
- configId?: string;
1182
- modifiedAt?: string;
1183
- }): Promise<any>;
1184
- /**
1185
- * Delete a script header (cascades its configs). `force` overrides the
1186
- * server's guard against deleting a script that an active workflow still
1187
- * references by name — without it the server answers 409.
1188
- */
1189
- deleteScript(appId: string, scriptId: string, force?: boolean): Promise<void>;
1188
+ getScriptConfig(appId: string, scriptId: string, configId: string): Promise<any>;
1190
1189
  getPromptSchema(appId: string, promptId: string): Promise<{
1191
1190
  promptId: string;
1192
1191
  promptKey: string;
@@ -1202,7 +1201,7 @@ export declare class ApiClient {
1202
1201
  * 100) and reports `nextCursor`; callers that reconcile the sync tree must
1203
1202
  * drain every page before deleting or classifying anything (#2769).
1204
1203
  */
1205
- listTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, params?: {
1204
+ listTestCases(appId: string, blockType: "prompt" | "integration", blockId: string, params?: {
1206
1205
  limit?: number;
1207
1206
  cursor?: string;
1208
1207
  }): Promise<{
@@ -1210,8 +1209,8 @@ export declare class ApiClient {
1210
1209
  hasMore?: boolean;
1211
1210
  nextCursor?: string;
1212
1211
  }>;
1213
- getTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<any>;
1214
- createTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
1212
+ getTestCase(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string): Promise<any>;
1213
+ createTestCase(appId: string, blockType: "prompt" | "integration", blockId: string, payload: {
1215
1214
  name: string;
1216
1215
  description?: string | null;
1217
1216
  inputVariables: Record<string, any>;
@@ -1223,8 +1222,8 @@ export declare class ApiClient {
1223
1222
  evaluatorConfigId?: string;
1224
1223
  /** The sidecar's file name — the case's identity (#2896). */
1225
1224
  key?: string;
1226
- }): Promise<any>;
1227
- updateTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, payload: {
1225
+ } & AgentTestCaseWireFields): Promise<any>;
1226
+ updateTestCase(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string, payload: {
1228
1227
  name?: string;
1229
1228
  description?: string | null;
1230
1229
  inputVariables?: Record<string, any>;
@@ -1236,9 +1235,9 @@ export declare class ApiClient {
1236
1235
  evaluatorConfigId?: string | null;
1237
1236
  /** The sidecar's file name, on a create-or-rename backfill (#2896). */
1238
1237
  key?: string;
1239
- }): Promise<any>;
1240
- deleteTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<void>;
1241
- listTestCaseAttachments(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<{
1238
+ } & AgentTestCaseWireFields): Promise<any>;
1239
+ deleteTestCase(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string): Promise<void>;
1240
+ listTestCaseAttachments(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string): Promise<{
1242
1241
  attachments: Array<{
1243
1242
  filename: string;
1244
1243
  contentType: string;
@@ -1246,7 +1245,7 @@ export declare class ApiClient {
1246
1245
  r2Key: string;
1247
1246
  }>;
1248
1247
  }>;
1249
- uploadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string, data: Buffer, contentType: string): Promise<{
1248
+ uploadTestCaseAttachment(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string, filename: string, data: Buffer, contentType: string): Promise<{
1250
1249
  success: boolean;
1251
1250
  attachment: {
1252
1251
  filename: string;
@@ -1255,26 +1254,26 @@ export declare class ApiClient {
1255
1254
  r2Key: string;
1256
1255
  };
1257
1256
  }>;
1258
- downloadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
1257
+ downloadTestCaseAttachment(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string, filename: string): Promise<{
1259
1258
  data: Buffer;
1260
1259
  contentType: string;
1261
1260
  }>;
1262
- deleteTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
1261
+ deleteTestCaseAttachment(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string, filename: string): Promise<{
1263
1262
  success: boolean;
1264
1263
  deleted: boolean;
1265
1264
  }>;
1266
- executeBlockTest(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
1265
+ executeBlockTest(appId: string, blockType: "prompt" | "integration", blockId: string, payload: {
1267
1266
  variables?: Record<string, any>;
1268
1267
  testCaseId?: string;
1269
1268
  configId?: string;
1270
1269
  comparisonGroup?: string;
1271
1270
  }): Promise<any>;
1272
- runAllTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
1271
+ runAllTestCases(appId: string, blockType: "prompt" | "integration", blockId: string, payload?: {
1273
1272
  overrideConfigId?: string;
1274
1273
  comparisonGroup?: string;
1275
1274
  testCaseIds?: string[];
1276
1275
  }): Promise<any>;
1277
- listTestRuns(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, params?: {
1276
+ listTestRuns(appId: string, blockType: "prompt" | "integration", blockId: string, params?: {
1278
1277
  limit?: number;
1279
1278
  comparisonGroup?: string;
1280
1279
  }): Promise<{
@@ -1290,121 +1289,10 @@ export declare class ApiClient {
1290
1289
  nextCursor?: string | null;
1291
1290
  }>;
1292
1291
  getWorkflow(appId: string, workflowId: string): Promise<any>;
1293
- /**
1294
- * One app's workflow step usage report (#3132).
1295
- *
1296
- * `windowDays` is omitted from the query when the caller did not ask for a
1297
- * window, so the server applies its own default rather than the CLI
1298
- * restating it on the wire.
1299
- */
1300
- getWorkflowUsage(appId: string, params?: {
1301
- windowDays?: number;
1302
- }): Promise<WorkflowUsageReport>;
1303
- createWorkflow(appId: string, payload: any): Promise<any>;
1304
- updateWorkflow(appId: string, workflowId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
1305
- /**
1306
- * Retire a workflow, or destroy it (#2887).
1307
- *
1308
- * The plain call ARCHIVES: the definition row stays, so its runs, revisions
1309
- * and test cases keep resolving. `{ hard: true }` performs the full cascade
1310
- * and is what releases the `workflowKey` — the flag `config push --prune`
1311
- * sends, for the same reason it sends it for webhooks and integrations.
1312
- */
1313
- deleteWorkflow(appId: string, workflowId: string, options?: {
1314
- hard?: boolean;
1315
- }): Promise<ArchiveEnvelope>;
1316
- /**
1317
- * #2645 criterion 9 — the operational toggle. Deliberately NOT the config
1318
- * PATCH: `config push` owns every configuration field, and taking a workflow
1319
- * out of service must not touch one, or an operator's action would show up as
1320
- * drift against the repo. Same route shape as `cron-triggers pause|resume`.
1321
- */
1322
- disableWorkflow(appId: string, workflowId: string): Promise<any>;
1323
- enableWorkflow(appId: string, workflowId: string): Promise<any>;
1324
- updateWorkflowDraft(appId: string, workflowId: string, payload: any): Promise<any>;
1325
- previewWorkflow(appId: string, workflowId: string, payload: {
1326
- rootInput?: object;
1327
- meta?: object;
1328
- configId?: string;
1329
- useDraft?: boolean;
1330
- preferActive?: boolean;
1331
- }): Promise<{
1332
- instanceId: string;
1333
- usingDraft?: boolean;
1334
- source?: "config" | "active" | "draft" | null;
1335
- configName?: string | null;
1336
- configId?: string | null;
1337
- warning?: string;
1338
- }>;
1339
- getPreviewStatus(appId: string, workflowId: string, instanceId: string): Promise<any>;
1340
- listWorkflowRuns(appId: string, workflowId: string, params?: {
1341
- status?: string;
1342
- limit?: number;
1343
- cursor?: string;
1344
- forward?: boolean;
1345
- follow?: boolean;
1346
- after?: string;
1347
- }): Promise<{
1348
- items: any[];
1349
- hasMore?: boolean;
1350
- nextCursor?: string | null;
1351
- /** #1969 — opaque follow checkpoint; present on `follow=true` responses. */
1352
- resumeAfter?: string;
1353
- /**
1354
- * #2237 — index rows the server examined for this request. Filtered reads
1355
- * only, and only on a server new enough to report it; `undefined`
1356
- * otherwise, which callers must treat as "unknown", not zero.
1357
- */
1358
- scanned?: number;
1359
- }>;
1360
- /**
1361
- * Workflow runs started by one app user, across every workflow (#1967).
1362
- * Backed by `GET /admin/api/apps/{appId}/users/{userId}/workflow-runs`,
1363
- * which resolves the app user before querying the `runsByUser` index.
1364
- */
1365
- listUserWorkflowRuns(appId: string, userId: string, params?: {
1366
- status?: string;
1367
- limit?: number;
1368
- cursor?: string;
1369
- forward?: boolean;
1370
- workflowId?: string;
1371
- }): Promise<{
1372
- items: any[];
1373
- hasMore?: boolean;
1374
- nextCursor?: string | null;
1375
- /** #2237 — index rows examined; filtered reads only, `undefined` if unknown. */
1376
- scanned?: number;
1377
- }>;
1378
- getWorkflowRunStatus(appId: string, workflowId: string, runId: string): Promise<any>;
1379
- getWorkflowStepRuns(appId: string, workflowId: string, runId: string): Promise<{
1380
- items: any[];
1381
- }>;
1382
1292
  listWorkflowConfigs(appId: string, workflowId: string): Promise<{
1383
1293
  items: any[];
1384
1294
  }>;
1385
1295
  getWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
1386
- createWorkflowConfig(appId: string, workflowId: string, payload: {
1387
- configName: string;
1388
- description?: string;
1389
- steps: any[];
1390
- expressions?: {
1391
- cel?: Record<string, string>;
1392
- };
1393
- }): Promise<any>;
1394
- updateWorkflowConfig(appId: string, workflowId: string, configId: string, payload: {
1395
- configName?: string;
1396
- description?: string;
1397
- steps?: any[];
1398
- status?: string;
1399
- expressions?: {
1400
- cel?: Record<string, string>;
1401
- };
1402
- }): Promise<any>;
1403
- archiveWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
1404
- activateWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
1405
- duplicateWorkflowConfig(appId: string, workflowId: string, configId: string, payload?: {
1406
- configName?: string;
1407
- }): Promise<any>;
1408
1296
  getAnalyticsTopUsers(appId: string, params?: {
1409
1297
  windowDays?: number;
1410
1298
  limit?: number;
@@ -1453,10 +1341,6 @@ export declare class ApiClient {
1453
1341
  limit?: number;
1454
1342
  [key: string]: any;
1455
1343
  }): Promise<AnalyticsErrorsGroupsResponse>;
1456
- getAnalyticsTopWorkflows(appId: string, params?: {
1457
- windowDays?: number;
1458
- limit?: number;
1459
- }): Promise<TopWorkflowsResponse>;
1460
1344
  getAnalyticsTopPrompts(appId: string, params?: {
1461
1345
  windowDays?: number;
1462
1346
  limit?: number;
@@ -1516,7 +1400,7 @@ export declare class ApiClient {
1516
1400
  createIntegrationCatalogItem(payload: any): Promise<any>;
1517
1401
  updateIntegrationCatalogItem(catalogId: string, payload: any): Promise<any>;
1518
1402
  deleteIntegrationCatalogItem(catalogId: string): Promise<void>;
1519
- startBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
1403
+ startBatchTests(appId: string, blockType: "prompt" | "integration", blockId: string, payload?: {
1520
1404
  comparisonGroup?: string;
1521
1405
  overrideConfigId?: string;
1522
1406
  testCaseIds?: string[];
@@ -1526,7 +1410,7 @@ export declare class ApiClient {
1526
1410
  instanceIds: string[];
1527
1411
  errors?: any[];
1528
1412
  }>;
1529
- getBatchTestStatus(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string): Promise<{
1413
+ getBatchTestStatus(appId: string, blockType: "prompt" | "integration", blockId: string, batchId: string): Promise<{
1530
1414
  status: string;
1531
1415
  batchId: string;
1532
1416
  completed: number;
@@ -1543,7 +1427,7 @@ export declare class ApiClient {
1543
1427
  endedAt?: string;
1544
1428
  }>;
1545
1429
  }>;
1546
- cancelBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string, instanceIds: string[]): Promise<{
1430
+ cancelBatchTests(appId: string, blockType: "prompt" | "integration", blockId: string, batchId: string, instanceIds: string[]): Promise<{
1547
1431
  batchId: string;
1548
1432
  terminated: string[];
1549
1433
  errors?: any[];
@@ -1713,44 +1597,6 @@ export declare class ApiClient {
1713
1597
  * `{ success, id, appliedFields }`.
1714
1598
  */
1715
1599
  patchDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string, data: any): Promise<any>;
1716
- listDatabaseOperations(appId: string, databaseId: string): Promise<any[]>;
1717
- /**
1718
- * Execute a registered operation and, when the result is a query page,
1719
- * normalize it to the CLI's one list envelope (issue #2440).
1720
- *
1721
- * The registered operation decides the response shape, so the normalization
1722
- * is conditional — see {@link normalizeDatabaseOperationResult}. Everything
1723
- * else (a `count`, an `aggregate`, a mutation, a `returnField: "all"`
1724
- * pipeline) is returned exactly as the server sent it.
1725
- */
1726
- executeDatabaseOperation(appId: string, databaseId: string, operationName: string, data?: {
1727
- params?: Record<string, any>;
1728
- limit?: number;
1729
- cursor?: string;
1730
- direction?: number;
1731
- }, token?: string, options?: {
1732
- timing?: boolean;
1733
- }): Promise<any>;
1734
- /**
1735
- * Execute a registered batch (bulk) database operation. Posts a chunk of
1736
- * items to the canonical `operations/:name/batch` endpoint (the same one the
1737
- * client library's `executeBatch` uses — NOT the deprecated `import-bulk`
1738
- * alias). Used by `databases import-csv`.
1739
- *
1740
- * @returns `{ imported, failed }` — DO-level write outcome counts. Per-item
1741
- * validation/access failures abort the whole chunk with a 4xx (thrown).
1742
- */
1743
- executeBatch(appId: string, databaseId: string, operationName: string, batch: Array<{
1744
- params: Record<string, any>;
1745
- }>): Promise<{
1746
- imported: number;
1747
- failed: number;
1748
- }>;
1749
- /**
1750
- * Make a request using a specific JWT token instead of the CLI's credentials.
1751
- * Used for executing operations as a different user.
1752
- */
1753
- requestWithToken<T = any>(path: string, token: string, options?: RequestInit): Promise<T>;
1754
1600
  listDatabaseIndexes(appId: string, databaseId: string, modelName?: string): Promise<any>;
1755
1601
  registerDatabaseIndex(appId: string, databaseId: string, data: {
1756
1602
  modelName: string;
@@ -1780,12 +1626,6 @@ export declare class ApiClient {
1780
1626
  databaseType: string;
1781
1627
  ruleSetId?: string | null;
1782
1628
  triggers?: Record<string, any> | null;
1783
- /**
1784
- * @deprecated The TOML `type.celContextAccess` expression. Use resource
1785
- * metadata categories instead (#1420, #1815).
1786
- */
1787
- metadataAccess?: string | null;
1788
- defaultAccess?: string | null;
1789
1629
  autoPopulatedFields?: Record<string, any> | null;
1790
1630
  timestamps?: Record<string, any> | null;
1791
1631
  schema?: string | null;
@@ -1796,24 +1636,10 @@ export declare class ApiClient {
1796
1636
  updateDatabaseTypeConfig(appId: string, databaseType: string, data: {
1797
1637
  ruleSetId?: string | null;
1798
1638
  triggers?: Record<string, any> | null;
1799
- /**
1800
- * @deprecated The TOML `type.celContextAccess` expression. Use resource
1801
- * metadata categories instead (#1420, #1815).
1802
- */
1803
- metadataAccess?: string | null;
1804
- defaultAccess?: string | null;
1805
1639
  autoPopulatedFields?: Record<string, any> | null;
1806
1640
  timestamps?: Record<string, any> | null;
1807
1641
  schema?: string | null;
1808
- pendingOpDeletes?: string[];
1809
- finalOpNames?: string[];
1810
1642
  metadataManifest?: any;
1811
- pendingOpUpdates?: Array<{
1812
- name: string;
1813
- access?: string | null;
1814
- params?: Record<string, any> | null;
1815
- }>;
1816
- pendingOpUpserts?: Array<Record<string, any>>;
1817
1643
  }, expectedModifiedAt?: string, options?: {
1818
1644
  dryRun?: boolean;
1819
1645
  acceptWarnings?: boolean;
@@ -1822,51 +1648,14 @@ export declare class ApiClient {
1822
1648
  force?: boolean;
1823
1649
  }): Promise<any>;
1824
1650
  /**
1825
- * Issue #666 Phase 3: ask the server to scaffold a TOML schema from
1826
- * existing ops + DO field introspection. Read-only — does NOT persist.
1651
+ * Issue #666 Phase 3: ask the server to scaffold a TOML schema from the
1652
+ * type's databases (the models each holds, and their fields). Read-only —
1653
+ * does NOT persist.
1827
1654
  */
1828
1655
  scaffoldDatabaseTypeSchema(appId: string, databaseType: string): Promise<{
1829
1656
  schema: string;
1830
1657
  }>;
1831
- listDatabaseTypeOperations(appId: string, databaseType: string): Promise<any[]>;
1832
- getDatabaseTypeOperation(appId: string, databaseType: string, name: string): Promise<any>;
1833
- createDatabaseTypeOperation(appId: string, databaseType: string, data: {
1834
- name: string;
1835
- type: string;
1836
- modelName: string;
1837
- access?: string | null;
1838
- definition: Record<string, any>;
1839
- params?: Record<string, any> | null;
1840
- }, options?: {
1841
- dryRun?: boolean;
1842
- schemaOverride?: string | null;
1843
- defaultAccess?: string | null;
1844
- metadataManifestOverride?: Record<string, any> | null;
1845
- }): Promise<any>;
1846
- updateDatabaseTypeOperation(appId: string, databaseType: string, name: string, data: Record<string, any>, expectedModifiedAt?: string, options?: {
1847
- dryRun?: boolean;
1848
- schemaOverride?: string | null;
1849
- metadataManifestOverride?: Record<string, any> | null;
1850
- }): Promise<any>;
1851
- deleteDatabaseTypeOperation(appId: string, databaseType: string, name: string): Promise<any>;
1852
- listDatabaseTypeSubscriptions(appId: string, databaseType: string): Promise<any[]>;
1853
- getDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string): Promise<any>;
1854
- createDatabaseTypeSubscription(appId: string, databaseType: string, data: {
1855
- subscriptionKey: string;
1856
- displayName: string;
1857
- modelName: string;
1858
- filter: string;
1859
- access: string;
1860
- description?: string | null;
1861
- select?: string[] | null;
1862
- emit?: string[] | null;
1863
- params?: Record<string, any> | null;
1864
- status?: string;
1865
- }): Promise<any>;
1866
- updateDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string, data: Record<string, any>, expectedModifiedAt?: string): Promise<any>;
1867
- deleteDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string): Promise<any>;
1868
1658
  listGroups(appId: string, params?: {
1869
- type?: string;
1870
1659
  limit?: number;
1871
1660
  cursor?: string;
1872
1661
  }): Promise<{
@@ -1874,28 +1663,56 @@ export declare class ApiClient {
1874
1663
  nextCursor?: string;
1875
1664
  hasMore?: boolean;
1876
1665
  }>;
1666
+ /** One page of one custodian's groups (`app` or `user:<userId>`), through the admin API. */
1667
+ listGroupsByCustodian(appId: string, custodian: string, params?: {
1668
+ limit?: number;
1669
+ cursor?: string;
1670
+ }): Promise<{
1671
+ items: any[];
1672
+ nextCursor?: string;
1673
+ hasMore?: boolean;
1674
+ }>;
1675
+ /** Transfer a group to `to` (`app` or `user:<userId>`) through the admin API. */
1676
+ transferGroup(appId: string, groupId: string, to: string): Promise<any>;
1677
+ /**
1678
+ * Create a group through the admin API; `custodian` is `app` or
1679
+ * `user:<userId>`. The server mints the group's id and answers it as
1680
+ * `groupId`.
1681
+ */
1877
1682
  createGroup(appId: string, data: {
1878
- groupType: string;
1879
- groupId?: string;
1880
1683
  name: string;
1881
1684
  description?: string;
1685
+ custodian: string;
1686
+ settings?: {
1687
+ memberList?: "members" | "managers";
1688
+ };
1882
1689
  initialMetadata?: Record<string, Record<string, unknown>>;
1883
1690
  }): Promise<any>;
1884
- getGroup(appId: string, groupType: string, groupId: string): Promise<any>;
1885
- updateGroup(appId: string, groupType: string, groupId: string, data: {
1691
+ /**
1692
+ * A group by id. `groupType` looks a group written before groups were
1693
+ * addressed by id up by its type first (the routes' deprecated
1694
+ * `?groupType=`), as an exported collection's grants still name them.
1695
+ */
1696
+ getGroup(appId: string, groupId: string, options?: {
1697
+ groupType?: string;
1698
+ }): Promise<any>;
1699
+ updateGroup(appId: string, groupId: string, data: {
1886
1700
  name?: string;
1887
1701
  description?: string;
1702
+ settings?: {
1703
+ memberList?: "members" | "managers";
1704
+ };
1888
1705
  }): Promise<any>;
1889
- deleteGroup(appId: string, groupType: string, groupId: string): Promise<any>;
1706
+ deleteGroup(appId: string, groupId: string): Promise<any>;
1890
1707
  /**
1891
- * One page of a group's members.
1708
+ * One page of a group's members, with their roles.
1892
1709
  *
1893
1710
  * The route paginates cursor-style (no default limit, cap 200) and reports
1894
1711
  * the boundary, so `groups members list` carries `--limit`/`--cursor` and
1895
1712
  * forwards them (#3646) rather than printing a first page that claims to be
1896
1713
  * the whole membership.
1897
1714
  */
1898
- listGroupMembers(appId: string, groupType: string, groupId: string, options?: {
1715
+ listGroupMembers(appId: string, groupId: string, options?: {
1899
1716
  include?: "profiles";
1900
1717
  limit?: number;
1901
1718
  cursor?: string;
@@ -1904,11 +1721,16 @@ export declare class ApiClient {
1904
1721
  nextCursor?: string;
1905
1722
  hasMore?: boolean;
1906
1723
  }>;
1907
- addGroupMember(appId: string, groupType: string, groupId: string, data: {
1724
+ /** Add a member through the admin API; `role: "owner"` restores the custodian's owner row. */
1725
+ addGroupMember(appId: string, groupId: string, data: {
1908
1726
  userId: string;
1727
+ role?: string;
1909
1728
  }): Promise<any>;
1910
- removeGroupMember(appId: string, groupType: string, groupId: string, userId: string): Promise<any>;
1911
- listGroupDocuments(appId: string, groupType: string, groupId: string): Promise<any[]>;
1729
+ /** Change a member's role through the admin API, the owner row's included. */
1730
+ setGroupMemberRole(appId: string, groupId: string, userId: string, role: string): Promise<any>;
1731
+ /** Remove a member through the admin API, the owner row included. */
1732
+ removeGroupMember(appId: string, groupId: string, userId: string): Promise<any>;
1733
+ listGroupDocuments(appId: string, groupId: string): Promise<any[]>;
1912
1734
  listUserMemberships(appId: string, userId: string): Promise<any[]>;
1913
1735
  listDocumentGroupPermissions(appId: string, documentId: string): Promise<any[]>;
1914
1736
  grantDocumentGroupPermission(appId: string, documentId: string, data: {
@@ -1942,12 +1764,40 @@ export declare class ApiClient {
1942
1764
  */
1943
1765
  collectionType?: string;
1944
1766
  initialMetadata?: Record<string, Record<string, unknown>>;
1767
+ }): Promise<any>;
1768
+ /** One page of one custodian's collections (`app` or `user:<userId>`), through the admin API. */
1769
+ listCollectionsByCustodian(appId: string, custodian: string, params?: {
1770
+ limit?: number;
1771
+ cursor?: string;
1772
+ }): Promise<{
1773
+ items: any[];
1774
+ nextCursor?: string;
1775
+ hasMore?: boolean;
1776
+ }>;
1777
+ /** Transfer a collection to `to` (`app` or `user:<userId>`) through the admin API. */
1778
+ transferCollection(appId: string, collectionId: string, to: string): Promise<any>;
1779
+ /**
1780
+ * Create a collection through the admin API, for `custodian` (`app` or
1781
+ * `user:<userId>`; a user custodian holds the owner row). Spends no
1782
+ * create budget.
1783
+ */
1784
+ createCollectionAsAdmin(appId: string, data: {
1785
+ name: string;
1786
+ description?: string;
1945
1787
  /**
1946
- * The app user to create the collection FOR (#3641). Honored only for
1947
- * admin-token callers; an app-user token has it ignored and creates as
1948
- * itself, exactly as `createDocument`'s does.
1788
+ * Deprecated: the server still records it while enforcement reads rule
1789
+ * sets, so a migration carries it across.
1949
1790
  */
1950
- createdBy?: string;
1791
+ collectionType?: string;
1792
+ custodian: string;
1793
+ settings?: {
1794
+ memberList?: "members" | "managers";
1795
+ } | Record<string, unknown>;
1796
+ initialMembers?: Array<{
1797
+ userId: string;
1798
+ role: string;
1799
+ }>;
1800
+ initialMetadata?: Record<string, Record<string, unknown>>;
1951
1801
  }): Promise<any>;
1952
1802
  getCollection(appId: string, collectionId: string): Promise<any>;
1953
1803
  updateCollection(appId: string, collectionId: string, data: {
@@ -1974,30 +1824,30 @@ export declare class ApiClient {
1974
1824
  items: any[];
1975
1825
  nextCursor?: string | null;
1976
1826
  }>;
1977
- getCollectionAccess(appId: string, collectionId: string): Promise<any>;
1978
- grantCollectionGroupPermission(appId: string, collectionId: string, data: {
1979
- groupType: string;
1980
- groupId: string;
1981
- permission: string;
1982
- }): Promise<any>;
1983
- revokeCollectionGroupPermission(appId: string, collectionId: string, groupType: string, groupId: string): Promise<any>;
1984
- addCollectionMember(appId: string, collectionId: string, data: {
1827
+ /**
1828
+ * Every member of a collection, users and groups as principals with their
1829
+ * roles, in one answer.
1830
+ */
1831
+ listCollectionMembers(appId: string, collectionId: string): Promise<{
1832
+ items: any[];
1833
+ hasMore: boolean;
1834
+ }>;
1835
+ /**
1836
+ * Add a user or a group to a collection through the admin API, with a role;
1837
+ * `role: "owner"` restores the custodian's owner row.
1838
+ */
1839
+ addCollectionMember(appId: string, collectionId: string, data: ({
1985
1840
  userId: string;
1986
- permission: string;
1987
- }): Promise<any>;
1988
- removeCollectionMember(appId: string, collectionId: string, userId: string): Promise<any>;
1989
- listCollectionTypeConfigs(appId: string): Promise<any[]>;
1990
- getCollectionTypeConfig(appId: string, collectionType: string): Promise<any>;
1991
- createCollectionTypeConfig(appId: string, data: {
1992
- collectionType: string;
1993
- ruleSetId?: string;
1994
- metadataManifest?: any;
1841
+ } | {
1842
+ groupId: string;
1843
+ groupType?: string;
1844
+ }) & {
1845
+ role: string;
1995
1846
  }): Promise<any>;
1996
- updateCollectionTypeConfig(appId: string, collectionType: string, data: {
1997
- ruleSetId?: string | null;
1998
- metadataManifest?: any;
1999
- }, expectedModifiedAt?: string): Promise<any>;
2000
- deleteCollectionTypeConfig(appId: string, collectionType: string): Promise<any>;
1847
+ /** Change a member's role through the admin API, the owner row's included. */
1848
+ setCollectionMemberRole(appId: string, collectionId: string, principal: string, role: string): Promise<any>;
1849
+ /** Remove a user or `group:<groupId>` through the admin API, the owner row included. */
1850
+ removeCollectionMember(appId: string, collectionId: string, principal: string): Promise<any>;
2001
1851
  /**
2002
1852
  * List all metadata category configs for an app. The route returns
2003
1853
  * `{ configs: [...] }`; unwrap to a bare array to match the other
@@ -2055,20 +1905,6 @@ export declare class ApiClient {
2055
1905
  }>;
2056
1906
  testRuleSet(appId: string, ruleSetId: string, data: any): Promise<any>;
2057
1907
  debugRuleSet(appId: string, data: any): Promise<any>;
2058
- listGroupTypeConfigs(appId: string): Promise<any[]>;
2059
- getGroupTypeConfig(appId: string, groupType: string): Promise<any>;
2060
- createGroupTypeConfig(appId: string, data: {
2061
- groupType: string;
2062
- ruleSetId?: string;
2063
- autoAddCreator?: boolean;
2064
- metadataManifest?: any;
2065
- }): Promise<any>;
2066
- updateGroupTypeConfig(appId: string, groupType: string, data: {
2067
- ruleSetId?: string | null;
2068
- autoAddCreator?: boolean;
2069
- metadataManifest?: any;
2070
- }, expectedModifiedAt?: string): Promise<any>;
2071
- deleteGroupTypeConfig(appId: string, groupType: string): Promise<any>;
2072
1908
  exportDocumentState(appId: string, documentId: string): Promise<{
2073
1909
  state: string;
2074
1910
  byteLength: number;
@@ -2091,28 +1927,6 @@ export declare class ApiClient {
2091
1927
  */
2092
1928
  downloadDocumentArtifact(_appId: string, grantedPath: string): Promise<Buffer>;
2093
1929
  importDocumentState(appId: string, documentId: string, stateBase64: string): Promise<any>;
2094
- /**
2095
- * Upload one artifact of a large document's import chain (#2816,
2096
- * behavior 20).
2097
- *
2098
- * The bytes travel raw and unmodified: the manifest's digest is over the
2099
- * STORED bytes, so re-encoding a chunk here would fail its own verification
2100
- * on install. The query says which artifact it is — the server derives the
2101
- * key from the document it belongs to, so nothing here composes one.
2102
- */
2103
- uploadDocumentChainArtifact(appId: string, documentId: string, query: Record<string, string | number>, body: Buffer): Promise<any>;
2104
- /** Start installing an uploaded chain (#2816, behavior 20). */
2105
- installDocumentChain(appId: string, documentId: string, plan: {
2106
- installId?: string;
2107
- base: {
2108
- epoch: number;
2109
- buildId: string;
2110
- } | null;
2111
- overlays: number[];
2112
- currentEpoch: number;
2113
- }): Promise<any>;
2114
- /** How far a document's chain install has got (#2816, behavior 20). */
2115
- getDocumentChainInstall(appId: string, documentId: string): Promise<any>;
2116
1930
  getDocument(appId: string, documentId: string): Promise<any>;
2117
1931
  /**
2118
1932
  * Delete a document and everything hanging off it (#2756). The server route
@@ -2144,42 +1958,64 @@ export declare class ApiClient {
2144
1958
  * through the caller's document permission (reader+) or the app-admin arm.
2145
1959
  * Returns the unified `{ items, hasMore, nextCursor? }` envelope. The cursor
2146
1960
  * is an opaque token — feed `nextCursor` back as `cursor` for the next page.
1961
+ * `limit` is 100 records when omitted and at most 10000; it is forwarded
1962
+ * unparsed (a string from the command line) so the server validates it.
2147
1963
  */
2148
1964
  queryDocumentRecords(appId: string, documentId: string, modelName: string, queryOptions?: {
2149
1965
  filter?: Record<string, any>;
2150
- limit?: number;
1966
+ /** `{ field: 1 | -1 }`, key order as precedence; the route validates it. */
1967
+ sort?: unknown;
1968
+ limit?: number | string;
2151
1969
  cursor?: string;
2152
1970
  /** #3764 — the format the caller believes this document has. */
2153
- documentFormat?: 1 | 2;
1971
+ documentFormat?: 1 | 3;
1972
+ /** #4692 — include specs, answered on a db3 as `_related`; the route validates them. */
1973
+ include?: unknown;
2154
1974
  }): Promise<ListEnvelope>;
2155
1975
  /**
2156
1976
  * Count records in a document model (issue #1964 Phase 3). Returns `{ count }`.
2157
1977
  */
2158
1978
  countDocumentRecords(appId: string, documentId: string, modelName: string, queryOptions?: {
2159
1979
  filter?: Record<string, any>;
2160
- documentFormat?: 1 | 2;
1980
+ documentFormat?: 1 | 3;
2161
1981
  }): Promise<{
2162
1982
  count: number;
2163
1983
  }>;
2164
1984
  /**
2165
1985
  * Aggregate records in a document model (issue #2437) — the documents twin
2166
1986
  * of {@link aggregateDatabaseRecords}. `POST documents/:id/records/:model/aggregate`
2167
- * with `{ options: { operations, groupBy?, filter? } }`, answering `{ result }`
2168
- * in the same shape as the database endpoint.
1987
+ * with `{ options: { operations, groupBy?, filter?, sort?, limit? } }`,
1988
+ * answering `{ result }` in the same shape as the database endpoint.
2169
1989
  *
2170
- * `groupBy` takes plain field names only: StringSet facet grouping and
2171
- * `{ field, contains }` membership grouping are database-only, which is why
2172
- * this signature is narrower than the databases one.
1990
+ * `groupBy` takes plain field names and period levels `{ field, period }`
1991
+ * (keyed `<field>_<period>` in a row's `group`). On a db3 (a format-3
1992
+ * document) a StringSet field name is a facet, `{ field, contains }` a
1993
+ * membership, and `sort` and `limit` order and bound the groups; a format-1
1994
+ * document refuses those four with a 400.
2173
1995
  */
2174
1996
  aggregateDocumentRecords(appId: string, documentId: string, modelName: string, options: {
2175
1997
  operations: {
2176
1998
  type: string;
2177
1999
  field?: string;
2178
2000
  }[];
2179
- groupBy?: string[];
2001
+ /** On a db3, a StringSet field name is a facet and `{ field, contains }` a membership. */
2002
+ groupBy?: Array<string | {
2003
+ field: string;
2004
+ period: "month" | "quarter" | "year";
2005
+ } | {
2006
+ field: string;
2007
+ contains: string;
2008
+ }>;
2180
2009
  filter?: Record<string, any>;
2010
+ /** The groups' order; a db3 only. */
2011
+ sort?: {
2012
+ field: string;
2013
+ direction: 1 | -1;
2014
+ };
2015
+ /** The most groups answered, 1 to 10,000; a db3 only. */
2016
+ limit?: number;
2181
2017
  }, extra?: {
2182
- documentFormat?: 1 | 2;
2018
+ documentFormat?: 1 | 3;
2183
2019
  }): Promise<{
2184
2020
  result: unknown;
2185
2021
  }>;
@@ -2188,6 +2024,17 @@ export declare class ApiClient {
2188
2024
  * record/model/blob counts, approximate size, and last-modified timestamp.
2189
2025
  */
2190
2026
  getDocumentStats(appId: string, documentId: string): Promise<any>;
2027
+ /**
2028
+ * A record-log document's room (#4306): `GET documents/:id/room` →
2029
+ * `{ ok, appId, documentId, documentFormat, room }`, `room` null for a
2030
+ * format that has no record room. With `refused` (#4310), the answer also
2031
+ * carries a page of that bulk load's refused rows. App admins only.
2032
+ */
2033
+ getDocumentRoom(appId: string, documentId: string, query?: {
2034
+ refused?: string;
2035
+ limit?: number;
2036
+ cursor?: string;
2037
+ }): Promise<any>;
2191
2038
  /**
2192
2039
  * A large document's snapshot builds, newest first, one page (#3432).
2193
2040
  * `GET documents/:id/snapshots` → `{ items, hasMore, nextCursor? }`.
@@ -2217,8 +2064,16 @@ export declare class ApiClient {
2217
2064
  }>;
2218
2065
  /** One bulk-load session's status (#3434). */
2219
2066
  getDocumentIngest(appId: string, documentId: string, sessionId: string): Promise<any>;
2220
- /** Open a bulk-load session on a large document (#3435, criterion 9). */
2221
- createDocumentIngest(appId: string, documentId: string): Promise<any>;
2067
+ /**
2068
+ * Open a bulk-load session on a large document (#3435, criterion 9). A
2069
+ * record-log (format 3) document's load takes `reserveEpoch`, `mode` and a
2070
+ * refresh's `models` (#4310); `{}` keeps every format's defaults.
2071
+ */
2072
+ createDocumentIngest(appId: string, documentId: string, options?: {
2073
+ reserveEpoch?: "open" | "commit";
2074
+ mode?: "merge" | "refresh";
2075
+ models?: string[];
2076
+ }): Promise<any>;
2222
2077
  /**
2223
2078
  * Upload one chunk of a bulk-load session's artifact (#3435).
2224
2079
  *
@@ -2238,6 +2093,8 @@ export declare class ApiClient {
2238
2093
  lastId: string;
2239
2094
  body: Buffer;
2240
2095
  }): Promise<any>;
2096
+ /** A chunk upload to `<base>/ingest/<session>/chunks`: the documents route or its db3 mount. */
2097
+ private uploadIngestChunkAt;
2241
2098
  /** Freeze a session's manifest and hand it to the pipeline (#3435). */
2242
2099
  commitDocumentIngest(appId: string, documentId: string, sessionId: string): Promise<any>;
2243
2100
  /** Give a session up; allowed until the swap (#3435). */
@@ -2264,7 +2121,7 @@ export declare class ApiClient {
2264
2121
  data: Record<string, unknown>;
2265
2122
  options?: Record<string, unknown>;
2266
2123
  }, extra?: {
2267
- documentFormat?: 1 | 2;
2124
+ documentFormat?: 1 | 3;
2268
2125
  }): Promise<{
2269
2126
  record: unknown;
2270
2127
  }>;
@@ -2277,7 +2134,7 @@ export declare class ApiClient {
2277
2134
  data: Record<string, unknown>;
2278
2135
  options?: Record<string, unknown>;
2279
2136
  }, extra?: {
2280
- documentFormat?: 1 | 2;
2137
+ documentFormat?: 1 | 3;
2281
2138
  }): Promise<{
2282
2139
  record: unknown;
2283
2140
  }>;
@@ -2287,7 +2144,7 @@ export declare class ApiClient {
2287
2144
  * a silent no-op per the facade contract. Returns `{ deleted: true }`.
2288
2145
  */
2289
2146
  deleteDocumentRecord(appId: string, documentId: string, modelName: string, recordId: string, extra?: {
2290
- documentFormat?: 1 | 2;
2147
+ documentFormat?: 1 | 3;
2291
2148
  }): Promise<{
2292
2149
  deleted: boolean;
2293
2150
  }>;
@@ -2298,7 +2155,7 @@ export declare class ApiClient {
2298
2155
  * `{ applied, added, updated, deleted }`.
2299
2156
  */
2300
2157
  bulkDocumentRecords(appId: string, documentId: string, operations: Array<Record<string, unknown>>, extra?: {
2301
- documentFormat?: 1 | 2;
2158
+ documentFormat?: 1 | 3;
2302
2159
  }): Promise<{
2303
2160
  applied: number;
2304
2161
  added: Array<{
@@ -2310,13 +2167,246 @@ export declare class ApiClient {
2310
2167
  id: string;
2311
2168
  }>;
2312
2169
  deleted: number;
2170
+ upserted: Array<{
2171
+ index: number;
2172
+ model: string;
2173
+ id: string;
2174
+ created: boolean;
2175
+ }>;
2176
+ }>;
2177
+ /** `/app/<app>/api/db3/<id>`, the id encoded: every `db3.*` route's prefix. */
2178
+ private db3Path;
2179
+ /** `GET db3/:id/indexes` → `{ indexes }`, sorted by name. */
2180
+ listDb3Indexes(appId: string, db3Id: string): Promise<{
2181
+ indexes: Db3IndexRow[];
2182
+ }>;
2183
+ /**
2184
+ * `POST db3/:id/indexes` with `{ model, field | fields, unique?, name? }` →
2185
+ * `{ index }`. The route applies the registration rules.
2186
+ */
2187
+ registerDb3Index(appId: string, db3Id: string, body: {
2188
+ model: string;
2189
+ field?: string;
2190
+ fields?: string[];
2191
+ unique?: boolean;
2192
+ name?: string;
2193
+ }): Promise<{
2194
+ index: Db3IndexRow;
2195
+ }>;
2196
+ /** `DELETE db3/:id/indexes/:name` → `{ ok, name }`. */
2197
+ dropDb3Index(appId: string, db3Id: string, name: string): Promise<{
2198
+ ok: boolean;
2199
+ name: string;
2200
+ }>;
2201
+ /** The db3 mount of {@link queryDocumentRecords}: `GET db3/:id/records/:model`. */
2202
+ queryDb3Records(appId: string, db3Id: string, modelName: string, queryOptions?: {
2203
+ filter?: Record<string, any>;
2204
+ sort?: unknown;
2205
+ limit?: number | string;
2206
+ cursor?: string;
2207
+ include?: unknown;
2208
+ }): Promise<ListEnvelope>;
2209
+ /** The db3 mount of {@link countDocumentRecords}: `GET db3/:id/records/:model/count`. */
2210
+ countDb3Records(appId: string, db3Id: string, modelName: string, queryOptions?: {
2211
+ filter?: Record<string, any>;
2212
+ }): Promise<{
2213
+ count: number;
2214
+ }>;
2215
+ /** The db3 mount of {@link aggregateDocumentRecords}: `POST db3/:id/records/:model/aggregate`. */
2216
+ aggregateDb3Records(appId: string, db3Id: string, modelName: string, options: Parameters<ApiClient["aggregateDocumentRecords"]>[3]): Promise<{
2217
+ result: unknown;
2313
2218
  }>;
2219
+ /** The db3 mount of {@link saveDocumentRecord}: `POST db3/:id/records/:model`. */
2220
+ saveDb3Record(appId: string, db3Id: string, modelName: string, body: {
2221
+ id: string;
2222
+ data: Record<string, unknown>;
2223
+ options?: Record<string, unknown>;
2224
+ }): Promise<{
2225
+ record: unknown;
2226
+ }>;
2227
+ /** The db3 mount of {@link patchDocumentRecord}: `PATCH db3/:id/records/:model/:recordId`. */
2228
+ patchDb3Record(appId: string, db3Id: string, modelName: string, recordId: string, body: {
2229
+ data: Record<string, unknown>;
2230
+ options?: Record<string, unknown>;
2231
+ }): Promise<{
2232
+ record: unknown;
2233
+ }>;
2234
+ /** The db3 mount of {@link deleteDocumentRecord}: `DELETE db3/:id/records/:model/:recordId`. */
2235
+ deleteDb3Record(appId: string, db3Id: string, modelName: string, recordId: string): Promise<{
2236
+ deleted: boolean;
2237
+ }>;
2238
+ /** The db3 mount of {@link bulkDocumentRecords}: `POST db3/:id/records/bulk`. */
2239
+ bulkDb3Records(appId: string, db3Id: string, operations: Array<Record<string, unknown>>): ReturnType<ApiClient["bulkDocumentRecords"]>;
2240
+ /** The db3 mount of {@link getDocumentSchema}: `GET db3/:id/schema`. */
2241
+ getDb3Schema(appId: string, db3Id: string): Promise<any>;
2242
+ /** `?limit=&cursor=` for a listing. */
2243
+ private pageQuery;
2244
+ /** `GET db3/:id/ingest` (#4889): a db3's bulk-load sessions, newest first. */
2245
+ listDb3Ingests(appId: string, db3Id: string, options?: {
2246
+ limit?: number;
2247
+ cursor?: string;
2248
+ }): Promise<{
2249
+ items: any[];
2250
+ hasMore: boolean;
2251
+ nextCursor?: string;
2252
+ }>;
2253
+ /** `GET db3/:id/ingest/:sessionId` (#4889). */
2254
+ getDb3Ingest(appId: string, db3Id: string, sessionId: string): Promise<any>;
2255
+ /** `POST db3/:id/ingest` (#4889): open a bulk-load session; `{}` keeps the defaults. */
2256
+ createDb3Ingest(appId: string, db3Id: string, options?: {
2257
+ reserveEpoch?: "open" | "commit";
2258
+ mode?: "merge" | "refresh";
2259
+ models?: string[];
2260
+ }): Promise<any>;
2261
+ /** `POST db3/:id/ingest/:sessionId/chunks` (#4889): one chunk, multipart, as the documents upload sends it. */
2262
+ uploadDb3IngestChunk(appId: string, db3Id: string, sessionId: string, chunk: Parameters<ApiClient["uploadDocumentIngestChunk"]>[3]): Promise<any>;
2263
+ /** `POST db3/:id/ingest/:sessionId/commit` (#4889). */
2264
+ commitDb3Ingest(appId: string, db3Id: string, sessionId: string): Promise<any>;
2265
+ /** `POST db3/:id/ingest/:sessionId/abort` (#4889). */
2266
+ abortDb3Ingest(appId: string, db3Id: string, sessionId: string): Promise<any>;
2267
+ /** `GET db3/:id/snapshots` (#4889): a db3's segment exports, newest first. */
2268
+ listDb3Snapshots(appId: string, db3Id: string, options?: {
2269
+ limit?: number;
2270
+ cursor?: string;
2271
+ }): Promise<{
2272
+ items: any[];
2273
+ hasMore: boolean;
2274
+ nextCursor?: string;
2275
+ }>;
2276
+ /** `GET db3/:id/snapshots/:segmentId` (#4889). */
2277
+ getDb3Snapshot(appId: string, db3Id: string, segmentId: string): Promise<any>;
2278
+ /** `POST db3/:id/snapshots` (#4889): start a segment export. */
2279
+ requestDb3Snapshot(appId: string, db3Id: string): Promise<any>;
2280
+ /** `GET db3/:id/export/chain` (#4889): the current segment, signed for download. */
2281
+ exportDb3Chain(appId: string, db3Id: string): Promise<any>;
2282
+ /** `GET db3/:id/blobs` (#4889): one page of a db3's blobs. */
2283
+ listDb3Blobs(appId: string, db3Id: string, params?: {
2284
+ cursor?: string;
2285
+ limit?: number;
2286
+ }): Promise<any>;
2287
+ /** `GET db3/:id/blobs/:blobId/download` (#4889): a blob's bytes. */
2288
+ downloadDb3Blob(appId: string, db3Id: string, blobId: string): Promise<Buffer>;
2289
+ /** `PUT db3/:id/blobs/:blobId` (#4889): a blob under its own id, as the documents upload sends it. */
2290
+ uploadDb3Blob(appId: string, db3Id: string, blobId: string, data: Buffer, meta: {
2291
+ filename: string;
2292
+ contentType: string;
2293
+ sha256: string;
2294
+ }): Promise<any>;
2295
+ /** The db3 mount of {@link getDocumentRoom}: `GET db3/:id/room`. App admins only. */
2296
+ getDb3Room(appId: string, db3Id: string, query?: {
2297
+ refused?: string;
2298
+ limit?: number;
2299
+ cursor?: string;
2300
+ }): Promise<any>;
2301
+ /**
2302
+ * `POST db3` (#4804): create a db3 and answer it, `{ id, title, createdBy,
2303
+ * createdAt, modifiedAt, custodian, sync, type, tags }`. Without `custodian`
2304
+ * an admin token's create is held by the app. `id` keeps a caller-chosen id
2305
+ * (#4921), refused `DB3_ID_EXISTS` when the app holds it.
2306
+ */
2307
+ createDb3(appId: string, body: {
2308
+ title: string;
2309
+ type?: string;
2310
+ sync?: boolean;
2311
+ custodian?: string;
2312
+ tags?: string[];
2313
+ id?: string;
2314
+ }): Promise<any>;
2315
+ /** `GET db3/:id` (#4804): the db3, with the caller's grant when it reads it through one. */
2316
+ getDb3(appId: string, db3Id: string): Promise<any>;
2317
+ /** `DELETE db3/:id` (#4804): the documents delete for a db3. */
2318
+ deleteDb3(appId: string, db3Id: string): Promise<any>;
2319
+ /** The db3 mount of {@link getDocumentStats}: `GET db3/:id/stats`. */
2320
+ getDb3Stats(appId: string, db3Id: string): Promise<any>;
2321
+ /**
2322
+ * `POST db3/:id/records/:model/:recordId/increment` (#4797): add each of
2323
+ * `fields` to the record's field, answering `{ record, values }`.
2324
+ */
2325
+ incrementDb3Record(appId: string, db3Id: string, modelName: string, recordId: string, body: {
2326
+ fields: Record<string, number>;
2327
+ }): Promise<{
2328
+ record: unknown;
2329
+ values: Record<string, number>;
2330
+ }>;
2331
+ /** `GET db3/:id/sync` (#4799): `{ id, sync }`. */
2332
+ getDb3Sync(appId: string, db3Id: string): Promise<{
2333
+ id: string;
2334
+ sync: boolean;
2335
+ }>;
2336
+ /** `PUT db3/:id/sync` (#4799): `{ id, sync, changed }`. */
2337
+ setDb3Sync(appId: string, db3Id: string, sync: boolean): Promise<{
2338
+ id: string;
2339
+ sync: boolean;
2340
+ changed: boolean;
2341
+ }>;
2342
+ /** `GET db3/:id/app-access` (#4801): `{ id, level }`, the level every user of the app holds, or null. */
2343
+ getDb3AppAccess(appId: string, db3Id: string): Promise<{
2344
+ id: string;
2345
+ level: string | null;
2346
+ }>;
2347
+ /** `PUT db3/:id/app-access` (#4801): grant the db3 to every user of the app, or remove the grant with null. */
2348
+ setDb3AppAccess(appId: string, db3Id: string, level: "reader" | "read-write" | null): Promise<{
2349
+ id: string;
2350
+ level: string | null;
2351
+ changed: boolean;
2352
+ }>;
2353
+ /** One custodian's db3s through the admin API (#4800): `custodian` is `app` or `user:<userId>`. */
2354
+ listDb3ByCustodian(appId: string, custodian: string, params?: {
2355
+ limit?: number;
2356
+ cursor?: string;
2357
+ }): Promise<{
2358
+ items: any[];
2359
+ nextCursor?: string;
2360
+ hasMore?: boolean;
2361
+ }>;
2362
+ /** Transfer a db3 to `to` (`app` or `user:<userId>`) through the admin API (#4804). */
2363
+ transferDb3(appId: string, db3Id: string, to: string): Promise<any>;
2364
+ /** Remove or restore a db3's owner row through the admin API (#4804): `{ id, custodian, ownerRow, changed }`. */
2365
+ setDb3OwnerRow(appId: string, db3Id: string, present: boolean): Promise<{
2366
+ id: string;
2367
+ custodian: string;
2368
+ ownerRow: boolean;
2369
+ changed: boolean;
2370
+ }>;
2371
+ /** `GET db3/:id/type` (#4802): the type the db3's row names, its revision, and what its room holds. */
2372
+ getDb3Type(appId: string, db3Id: string): Promise<any>;
2373
+ /** `PUT db3/:id/type` (#4802): attach a type, installing its current revision whole or refusing it whole. */
2374
+ attachDb3Type(appId: string, db3Id: string, type: string): Promise<any>;
2375
+ /** `/app/<app>/api/db3-types/<name>`, the name encoded (#4802). */
2376
+ private db3TypePath;
2377
+ /** `GET db3-types` (#4802): the app's db3 types, each with its revision. */
2378
+ listDb3Types(appId: string): Promise<{
2379
+ types: any[];
2380
+ }>;
2381
+ /** `GET db3-types/:name` (#4802). */
2382
+ getDb3TypeConfig(appId: string, name: string): Promise<any>;
2383
+ /**
2384
+ * `PUT db3-types/:name` (#4802): create or update the type, and push its new
2385
+ * revision to every db3 of it. `dryRun` judges the body and persists nothing.
2386
+ */
2387
+ pushDb3Type(appId: string, name: string, data: {
2388
+ ruleSetId?: string | null;
2389
+ triggers?: Record<string, any> | null;
2390
+ autoPopulatedFields?: Record<string, any> | null;
2391
+ timestamps?: Record<string, any> | null;
2392
+ schema?: string | null;
2393
+ metadataManifest?: any;
2394
+ expectedModifiedAt?: string;
2395
+ }, options?: {
2396
+ dryRun?: boolean;
2397
+ }): Promise<any>;
2398
+ /** `DELETE db3-types/:name` (#4802): refused while a db3 is of the type. */
2399
+ deleteDb3Type(appId: string, name: string): Promise<any>;
2400
+ /** `GET db3-types/:name/push-status` (#4802): a push's outcome per db3; the latest without `runId`. */
2401
+ getDb3TypePushStatus(appId: string, name: string, runId?: string): Promise<any>;
2402
+ /** `POST db3-types/:name/push?runId=` (#4802): push the current revision again to a run's refused and failed db3s. */
2403
+ retryDb3TypePush(appId: string, name: string, runId: string): Promise<any>;
2314
2404
  createDocument(appId: string, data: {
2315
2405
  title: string;
2316
2406
  documentId?: string;
2317
2407
  tags?: string[];
2318
2408
  createdBy?: string;
2319
- documentFormat?: 1 | 2;
2409
+ documentFormat?: 1 | 3;
2320
2410
  }): Promise<any>;
2321
2411
  listDocumentPermissions(appId: string, documentId: string): Promise<any[]>;
2322
2412
  grantDocumentPermission(appId: string, documentId: string, permissions: Array<{
@@ -2354,14 +2444,52 @@ export declare class ApiClient {
2354
2444
  * grants whose app invitation is still outstanding.
2355
2445
  */
2356
2446
  listDocumentPendingInvitations(appId: string, documentId: string): Promise<any>;
2357
- listDocumentBlobs(appId: string, documentId: string): Promise<any[]>;
2447
+ /**
2448
+ * One page of a document's uploaded blobs (the `{ items, hasMore,
2449
+ * nextCursor? }` envelope); pass the previous page's `nextCursor` for the
2450
+ * next.
2451
+ */
2452
+ listDocumentBlobs(appId: string, documentId: string, params?: {
2453
+ cursor?: string;
2454
+ limit?: number;
2455
+ }): Promise<any>;
2358
2456
  downloadBlob(appId: string, documentId: string, blobId: string): Promise<Buffer>;
2457
+ /** A blob's bytes from `<base>/blobs/<id>/download`: the documents route or its db3 mount. */
2458
+ private downloadBlobAt;
2359
2459
  uploadBlob(appId: string, documentId: string, blobId: string, data: Buffer, meta: {
2360
2460
  filename: string;
2361
2461
  contentType: string;
2362
2462
  sha256: string;
2363
2463
  }): Promise<any>;
2464
+ /** A blob PUT to `<base>/blobs/<id>`: the documents route or its db3 mount. */
2465
+ private uploadBlobAt;
2466
+ /**
2467
+ * Upload a file to an agent session by `sessionId` (#4585): the document
2468
+ * blob upload's headers and body, on the session's attachment route.
2469
+ */
2470
+ uploadAgentSessionAttachment(appId: string, sessionId: string, blobId: string, data: Buffer, meta: {
2471
+ filename: string;
2472
+ contentType: string;
2473
+ sha256: string;
2474
+ }): Promise<any>;
2475
+ /** Download an agent session's file by `sessionId` (#4585). */
2476
+ downloadAgentSessionAttachment(appId: string, sessionId: string, blobId: string): Promise<Buffer>;
2477
+ /**
2478
+ * An agent session file's download headers (lower-cased names) by
2479
+ * `sessionId` (#4585). A refusal has no body, so it fails with the status
2480
+ * alone and no code.
2481
+ */
2482
+ headAgentSessionAttachment(appId: string, sessionId: string, blobId: string): Promise<{
2483
+ status: number;
2484
+ headers: Record<string, string>;
2485
+ }>;
2486
+ private agentSessionAttachmentRead;
2364
2487
  listDocumentAliases(appId: string, documentId: string): Promise<any[]>;
2488
+ /**
2489
+ * The document a user's alias points at, or null when the user holds no
2490
+ * alias under that key (#4148).
2491
+ */
2492
+ getDocumentAlias(appId: string, aliasScope: string, aliasKey: string, userId: string): Promise<any | null>;
2365
2493
  setDocumentAlias(appId: string, aliasScope: string, aliasKey: string, documentId: string, ownerUserId?: string, mustNotExist?: boolean): Promise<any>;
2366
2494
  /**
2367
2495
  * Resolve an app user by exact email — the single email → userId lookup in
@@ -2416,6 +2544,7 @@ export declare class ApiClient {
2416
2544
  */
2417
2545
  getUserRootDocument(appId: string, userId: string): Promise<{
2418
2546
  rootDocId: string | null;
2547
+ documentFormat?: number;
2419
2548
  }>;
2420
2549
  /**
2421
2550
  * Get or create the user's root document (#3135).
@@ -2428,6 +2557,7 @@ export declare class ApiClient {
2428
2557
  ensureUserRootDocument(appId: string, userId: string): Promise<{
2429
2558
  rootDocId: string;
2430
2559
  created: boolean;
2560
+ documentFormat?: number;
2431
2561
  }>;
2432
2562
  /**
2433
2563
  * Apply an ordered batch of record operations via `records/batch`.