primitive-admin 1.2.0-alpha.9 → 1.3.0-alpha.1

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 (590) hide show
  1. package/README.md +303 -186
  2. package/assets/skill/skills/primitive-platform/SKILL.md +93 -27
  3. package/dist/bin/primitive.js +15 -89
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/admins.js +80 -17
  6. package/dist/src/commands/admins.js.map +1 -1
  7. package/dist/src/commands/agent-sessions.d.ts +129 -0
  8. package/dist/src/commands/agent-sessions.js +532 -20
  9. package/dist/src/commands/agent-sessions.js.map +1 -1
  10. package/dist/src/commands/analytics.js +207 -155
  11. package/dist/src/commands/analytics.js.map +1 -1
  12. package/dist/src/commands/apps-children.js +3 -0
  13. package/dist/src/commands/apps-children.js.map +1 -1
  14. package/dist/src/commands/apps-transitions.d.ts +39 -0
  15. package/dist/src/commands/apps-transitions.js +198 -0
  16. package/dist/src/commands/apps-transitions.js.map +1 -0
  17. package/dist/src/commands/apps.d.ts +17 -0
  18. package/dist/src/commands/apps.js +108 -3
  19. package/dist/src/commands/apps.js.map +1 -1
  20. package/dist/src/commands/auth-sessions.js +2 -0
  21. package/dist/src/commands/auth-sessions.js.map +1 -1
  22. package/dist/src/commands/auth.js +170 -50
  23. package/dist/src/commands/auth.js.map +1 -1
  24. package/dist/src/commands/blob-buckets.js +2 -0
  25. package/dist/src/commands/blob-buckets.js.map +1 -1
  26. package/dist/src/commands/collections.js +318 -256
  27. package/dist/src/commands/collections.js.map +1 -1
  28. package/dist/src/commands/comparisons.js +2 -0
  29. package/dist/src/commands/comparisons.js.map +1 -1
  30. package/dist/src/commands/config.d.ts +2 -2
  31. package/dist/src/commands/config.js +59 -33
  32. package/dist/src/commands/config.js.map +1 -1
  33. package/dist/src/commands/connections.js +2 -0
  34. package/dist/src/commands/connections.js.map +1 -1
  35. package/dist/src/commands/database-type-configs.js +5 -3
  36. package/dist/src/commands/database-type-configs.js.map +1 -1
  37. package/dist/src/commands/databases.js +6 -4
  38. package/dist/src/commands/databases.js.map +1 -1
  39. package/dist/src/commands/db3-types.d.ts +42 -0
  40. package/dist/src/commands/db3-types.js +445 -0
  41. package/dist/src/commands/db3-types.js.map +1 -0
  42. package/dist/src/commands/db3.d.ts +38 -0
  43. package/dist/src/commands/db3.js +2053 -0
  44. package/dist/src/commands/db3.js.map +1 -0
  45. package/dist/src/commands/documents.d.ts +110 -10
  46. package/dist/src/commands/documents.js +1019 -748
  47. package/dist/src/commands/documents.js.map +1 -1
  48. package/dist/src/commands/email-templates.js +74 -0
  49. package/dist/src/commands/email-templates.js.map +1 -1
  50. package/dist/src/commands/env.js +8 -4
  51. package/dist/src/commands/env.js.map +1 -1
  52. package/dist/src/commands/function-trigger-commands.d.ts +28 -0
  53. package/dist/src/commands/function-trigger-commands.js +341 -0
  54. package/dist/src/commands/function-trigger-commands.js.map +1 -0
  55. package/dist/src/commands/functions.js +383 -32
  56. package/dist/src/commands/functions.js.map +1 -1
  57. package/dist/src/commands/groups.js +168 -50
  58. package/dist/src/commands/groups.js.map +1 -1
  59. package/dist/src/commands/guides.js +7 -5
  60. package/dist/src/commands/guides.js.map +1 -1
  61. package/dist/src/commands/hosting.d.ts +8 -0
  62. package/dist/src/commands/hosting.js +509 -0
  63. package/dist/src/commands/hosting.js.map +1 -0
  64. package/dist/src/commands/init.js +129 -38
  65. package/dist/src/commands/init.js.map +1 -1
  66. package/dist/src/commands/integrations.js +82 -53
  67. package/dist/src/commands/integrations.js.map +1 -1
  68. package/dist/src/commands/locks.d.ts +5 -3
  69. package/dist/src/commands/locks.js +19 -61
  70. package/dist/src/commands/locks.js.map +1 -1
  71. package/dist/src/commands/metadata-category-configs.d.ts +2 -2
  72. package/dist/src/commands/metadata-category-configs.js +4 -2
  73. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  74. package/dist/src/commands/metadata.js +55 -6
  75. package/dist/src/commands/metadata.js.map +1 -1
  76. package/dist/src/commands/prompts.js +75 -52
  77. package/dist/src/commands/prompts.js.map +1 -1
  78. package/dist/src/commands/rate-counters.d.ts +19 -0
  79. package/dist/src/commands/rate-counters.js +104 -0
  80. package/dist/src/commands/rate-counters.js.map +1 -0
  81. package/dist/src/commands/rule-sets.d.ts +1 -1
  82. package/dist/src/commands/rule-sets.js +2 -1
  83. package/dist/src/commands/rule-sets.js.map +1 -1
  84. package/dist/src/commands/schemas.d.ts +15 -0
  85. package/dist/src/commands/schemas.js +122 -0
  86. package/dist/src/commands/schemas.js.map +1 -0
  87. package/dist/src/commands/scripts.d.ts +9 -17
  88. package/dist/src/commands/scripts.js +24 -479
  89. package/dist/src/commands/scripts.js.map +1 -1
  90. package/dist/src/commands/secrets.d.ts +38 -0
  91. package/dist/src/commands/secrets.js +148 -6
  92. package/dist/src/commands/secrets.js.map +1 -1
  93. package/dist/src/commands/sessions.js +2 -0
  94. package/dist/src/commands/sessions.js.map +1 -1
  95. package/dist/src/commands/skill.js +2 -0
  96. package/dist/src/commands/skill.js.map +1 -1
  97. package/dist/src/commands/spent-tokens.d.ts +19 -0
  98. package/dist/src/commands/spent-tokens.js +79 -0
  99. package/dist/src/commands/spent-tokens.js.map +1 -0
  100. package/dist/src/commands/sync-app-settings.d.ts +58 -0
  101. package/dist/src/commands/sync-app-settings.js +119 -2
  102. package/dist/src/commands/sync-app-settings.js.map +1 -1
  103. package/dist/src/commands/sync-schemas.d.ts +202 -0
  104. package/dist/src/commands/sync-schemas.js +629 -0
  105. package/dist/src/commands/sync-schemas.js.map +1 -0
  106. package/dist/src/commands/sync-user-properties.d.ts +118 -0
  107. package/dist/src/commands/sync-user-properties.js +276 -0
  108. package/dist/src/commands/sync-user-properties.js.map +1 -0
  109. package/dist/src/commands/sync.d.ts +578 -546
  110. package/dist/src/commands/sync.js +3516 -5134
  111. package/dist/src/commands/sync.js.map +1 -1
  112. package/dist/src/commands/tokens.js +5 -3
  113. package/dist/src/commands/tokens.js.map +1 -1
  114. package/dist/src/commands/transitions.d.ts +54 -0
  115. package/dist/src/commands/transitions.js +418 -0
  116. package/dist/src/commands/transitions.js.map +1 -0
  117. package/dist/src/commands/usage.d.ts +42 -0
  118. package/dist/src/commands/usage.js +397 -0
  119. package/dist/src/commands/usage.js.map +1 -0
  120. package/dist/src/commands/user-properties.d.ts +14 -0
  121. package/dist/src/commands/user-properties.js +79 -0
  122. package/dist/src/commands/user-properties.js.map +1 -0
  123. package/dist/src/commands/users.js +951 -18
  124. package/dist/src/commands/users.js.map +1 -1
  125. package/dist/src/commands/vars.js +2 -0
  126. package/dist/src/commands/vars.js.map +1 -1
  127. package/dist/src/commands/waitlist.js +39 -4
  128. package/dist/src/commands/waitlist.js.map +1 -1
  129. package/dist/src/commands/workflows.d.ts +5 -83
  130. package/dist/src/commands/workflows.js +57 -2282
  131. package/dist/src/commands/workflows.js.map +1 -1
  132. package/dist/src/lib/analytics-query.d.ts +58 -0
  133. package/dist/src/lib/analytics-query.js +134 -0
  134. package/dist/src/lib/analytics-query.js.map +1 -0
  135. package/dist/src/lib/api-client.d.ts +1976 -431
  136. package/dist/src/lib/api-client.js +1095 -550
  137. package/dist/src/lib/api-client.js.map +1 -1
  138. package/dist/src/lib/app-settings-descriptor.d.ts +14 -2
  139. package/dist/src/lib/app-settings-descriptor.js +55 -1
  140. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  141. package/dist/src/lib/auth-fixtures.d.ts +44 -0
  142. package/dist/src/lib/auth-fixtures.js +61 -0
  143. package/dist/src/lib/auth-fixtures.js.map +1 -0
  144. package/dist/src/lib/auth-flow.d.ts +47 -1
  145. package/dist/src/lib/auth-flow.js +451 -14
  146. package/dist/src/lib/auth-flow.js.map +1 -1
  147. package/dist/src/lib/block-layout.d.ts +12 -23
  148. package/dist/src/lib/block-layout.js +26 -92
  149. package/dist/src/lib/block-layout.js.map +1 -1
  150. package/dist/src/lib/block-selector.d.ts +8 -14
  151. package/dist/src/lib/block-selector.js +8 -19
  152. package/dist/src/lib/block-selector.js.map +1 -1
  153. package/dist/src/lib/child-apps-local.d.ts +3 -1
  154. package/dist/src/lib/child-apps-local.js +9 -1
  155. package/dist/src/lib/child-apps-local.js.map +1 -1
  156. package/dist/src/lib/cli-manifest.d.ts +9 -0
  157. package/dist/src/lib/cli-manifest.js +10 -1
  158. package/dist/src/lib/cli-manifest.js.map +1 -1
  159. package/dist/src/lib/cli-version.d.ts +14 -0
  160. package/dist/src/lib/cli-version.js +38 -0
  161. package/dist/src/lib/cli-version.js.map +1 -0
  162. package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
  163. package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
  164. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
  165. package/dist/src/lib/collection-export.d.ts +76 -15
  166. package/dist/src/lib/collection-export.js +116 -23
  167. package/dist/src/lib/collection-export.js.map +1 -1
  168. package/dist/src/lib/collection-principal.d.ts +22 -0
  169. package/dist/src/lib/collection-principal.js +35 -0
  170. package/dist/src/lib/collection-principal.js.map +1 -0
  171. package/dist/src/lib/command-groups.d.ts +30 -0
  172. package/dist/src/lib/command-groups.js +111 -0
  173. package/dist/src/lib/command-groups.js.map +1 -0
  174. package/dist/src/lib/command-status.d.ts +147 -0
  175. package/dist/src/lib/command-status.js +266 -0
  176. package/dist/src/lib/command-status.js.map +1 -0
  177. package/dist/src/lib/config-object-descriptor.d.ts +9 -22
  178. package/dist/src/lib/config-object-descriptor.js +113 -277
  179. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  180. package/dist/src/lib/config-surface.d.ts +3 -7
  181. package/dist/src/lib/config-surface.js +9 -13
  182. package/dist/src/lib/config-surface.js.map +1 -1
  183. package/dist/src/lib/config-toml.d.ts +11 -2
  184. package/dist/src/lib/config-toml.js +25 -2
  185. package/dist/src/lib/config-toml.js.map +1 -1
  186. package/dist/src/lib/credentials-home.d.ts +7 -0
  187. package/dist/src/lib/credentials-home.js +45 -10
  188. package/dist/src/lib/credentials-home.js.map +1 -1
  189. package/dist/src/lib/credentials-lock.d.ts +14 -6
  190. package/dist/src/lib/credentials-lock.js +90 -10
  191. package/dist/src/lib/credentials-lock.js.map +1 -1
  192. package/dist/src/lib/credentials-store.d.ts +142 -70
  193. package/dist/src/lib/credentials-store.js +420 -111
  194. package/dist/src/lib/credentials-store.js.map +1 -1
  195. package/dist/src/lib/custodian.d.ts +8 -0
  196. package/dist/src/lib/custodian.js +18 -0
  197. package/dist/src/lib/custodian.js.map +1 -0
  198. package/dist/src/lib/data-input.d.ts +1 -1
  199. package/dist/src/lib/data-input.js +1 -1
  200. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
  201. package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
  202. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  203. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +40 -1
  204. package/dist/src/lib/db-codegen/dbTypeIR.js +32 -8
  205. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  206. package/dist/src/lib/db-type-records.d.ts +125 -0
  207. package/dist/src/lib/db-type-records.js +237 -0
  208. package/dist/src/lib/db-type-records.js.map +1 -0
  209. package/dist/src/lib/db3-export.d.ts +322 -0
  210. package/dist/src/lib/db3-export.js +767 -0
  211. package/dist/src/lib/db3-export.js.map +1 -0
  212. package/dist/src/lib/db3-index-output.d.ts +116 -0
  213. package/dist/src/lib/db3-index-output.js +223 -0
  214. package/dist/src/lib/db3-index-output.js.map +1 -0
  215. package/dist/src/lib/db3-json-fields.d.ts +49 -0
  216. package/dist/src/lib/db3-json-fields.js +195 -0
  217. package/dist/src/lib/db3-json-fields.js.map +1 -0
  218. package/dist/src/lib/db3-type-archive.d.ts +59 -0
  219. package/dist/src/lib/db3-type-archive.js +95 -0
  220. package/dist/src/lib/db3-type-archive.js.map +1 -0
  221. package/dist/src/lib/db3-type-models.d.ts +148 -0
  222. package/dist/src/lib/db3-type-models.js +583 -0
  223. package/dist/src/lib/db3-type-models.js.map +1 -0
  224. package/dist/src/lib/deprecation.d.ts +2 -2
  225. package/dist/src/lib/deprecation.js +2 -2
  226. package/dist/src/lib/document-export-record-log.d.ts +7 -0
  227. package/dist/src/lib/document-export-record-log.js +9 -0
  228. package/dist/src/lib/document-export-record-log.js.map +1 -1
  229. package/dist/src/lib/document-ingest-artifact.d.ts +19 -0
  230. package/dist/src/lib/document-ingest-artifact.js +55 -6
  231. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  232. package/dist/src/lib/document-ingest-format2.d.ts +36 -0
  233. package/dist/src/lib/document-ingest-format2.js +78 -0
  234. package/dist/src/lib/document-ingest-format2.js.map +1 -0
  235. package/dist/src/lib/document-ingest-input.d.ts +9 -0
  236. package/dist/src/lib/document-ingest-input.js +28 -1
  237. package/dist/src/lib/document-ingest-input.js.map +1 -1
  238. package/dist/src/lib/document-ingest.d.ts +11 -1
  239. package/dist/src/lib/document-ingest.js +16 -0
  240. package/dist/src/lib/document-ingest.js.map +1 -1
  241. package/dist/src/lib/document-schema-rows.d.ts +42 -0
  242. package/dist/src/lib/document-schema-rows.js +53 -0
  243. package/dist/src/lib/document-schema-rows.js.map +1 -0
  244. package/dist/src/lib/experimental-apis.d.ts +36 -0
  245. package/dist/src/lib/experimental-apis.js +46 -0
  246. package/dist/src/lib/experimental-apis.js.map +1 -0
  247. package/dist/src/lib/file-attachment.d.ts +24 -0
  248. package/dist/src/lib/file-attachment.js +31 -0
  249. package/dist/src/lib/file-attachment.js.map +1 -0
  250. package/dist/src/lib/function-authorize-check.d.ts +142 -0
  251. package/dist/src/lib/function-authorize-check.js +311 -0
  252. package/dist/src/lib/function-authorize-check.js.map +1 -0
  253. package/dist/src/lib/function-authorize-view.d.ts +36 -0
  254. package/dist/src/lib/function-authorize-view.js +110 -0
  255. package/dist/src/lib/function-authorize-view.js.map +1 -0
  256. package/dist/src/lib/function-bundle.d.ts +27 -5
  257. package/dist/src/lib/function-bundle.js +142 -7
  258. package/dist/src/lib/function-bundle.js.map +1 -1
  259. package/dist/src/lib/function-collect.d.ts +112 -12
  260. package/dist/src/lib/function-collect.js +601 -12
  261. package/dist/src/lib/function-collect.js.map +1 -1
  262. package/dist/src/lib/function-db-types.d.ts +65 -11
  263. package/dist/src/lib/function-db-types.js +326 -157
  264. package/dist/src/lib/function-db-types.js.map +1 -1
  265. package/dist/src/lib/function-document-types.d.ts +19 -7
  266. package/dist/src/lib/function-document-types.js +24 -12
  267. package/dist/src/lib/function-document-types.js.map +1 -1
  268. package/dist/src/lib/function-grants-preflight.d.ts +99 -0
  269. package/dist/src/lib/function-grants-preflight.js +154 -2
  270. package/dist/src/lib/function-grants-preflight.js.map +1 -1
  271. package/dist/src/lib/function-lint.d.ts +85 -0
  272. package/dist/src/lib/function-lint.js +442 -0
  273. package/dist/src/lib/function-lint.js.map +1 -0
  274. package/dist/src/lib/function-log-row.js +21 -2
  275. package/dist/src/lib/function-log-row.js.map +1 -1
  276. package/dist/src/lib/function-run.d.ts +13 -21
  277. package/dist/src/lib/function-run.js +14 -27
  278. package/dist/src/lib/function-run.js.map +1 -1
  279. package/dist/src/lib/function-schema-codegen.d.ts +86 -22
  280. package/dist/src/lib/function-schema-codegen.js +194 -88
  281. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  282. package/dist/src/lib/function-schema-refs.d.ts +98 -0
  283. package/dist/src/lib/function-schema-refs.js +177 -0
  284. package/dist/src/lib/function-schema-refs.js.map +1 -0
  285. package/dist/src/lib/function-sync.d.ts +120 -6
  286. package/dist/src/lib/function-sync.js +217 -26
  287. package/dist/src/lib/function-sync.js.map +1 -1
  288. package/dist/src/lib/function-trigger-listing.d.ts +11 -6
  289. package/dist/src/lib/function-trigger-listing.js +32 -11
  290. package/dist/src/lib/function-trigger-listing.js.map +1 -1
  291. package/dist/src/lib/function-typecheck.d.ts +52 -0
  292. package/dist/src/lib/function-typecheck.js +174 -54
  293. package/dist/src/lib/function-typecheck.js.map +1 -1
  294. package/dist/src/lib/function-versions.d.ts +2 -0
  295. package/dist/src/lib/function-versions.js +1 -0
  296. package/dist/src/lib/function-versions.js.map +1 -1
  297. package/dist/src/lib/generated-build-flags.d.ts +13 -0
  298. package/dist/src/lib/generated-build-flags.js +14 -0
  299. package/dist/src/lib/generated-build-flags.js.map +1 -0
  300. package/dist/src/lib/generated-command-status.d.ts +6 -0
  301. package/dist/src/lib/generated-command-status.js +502 -0
  302. package/dist/src/lib/generated-command-status.js.map +1 -0
  303. package/dist/src/lib/generated-config-surfaces.d.ts +804 -140
  304. package/dist/src/lib/generated-config-surfaces.js +2491 -1806
  305. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  306. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  307. package/dist/src/lib/generated-sdk-types.js +1 -1
  308. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  309. package/dist/src/lib/hosting-build.d.ts +97 -0
  310. package/dist/src/lib/hosting-build.js +204 -0
  311. package/dist/src/lib/hosting-build.js.map +1 -0
  312. package/dist/src/lib/hosting-client.d.ts +167 -0
  313. package/dist/src/lib/hosting-client.js +340 -0
  314. package/dist/src/lib/hosting-client.js.map +1 -0
  315. package/dist/src/lib/hosting-environments.d.ts +32 -0
  316. package/dist/src/lib/hosting-environments.js +74 -0
  317. package/dist/src/lib/hosting-environments.js.map +1 -0
  318. package/dist/src/lib/hosting-errors.d.ts +30 -0
  319. package/dist/src/lib/hosting-errors.js +43 -0
  320. package/dist/src/lib/hosting-errors.js.map +1 -0
  321. package/dist/src/lib/hosting-token.d.ts +46 -0
  322. package/dist/src/lib/hosting-token.js +60 -0
  323. package/dist/src/lib/hosting-token.js.map +1 -0
  324. package/dist/src/lib/hosting-trust-step.d.ts +67 -0
  325. package/dist/src/lib/hosting-trust-step.js +279 -0
  326. package/dist/src/lib/hosting-trust-step.js.map +1 -0
  327. package/dist/src/lib/hosting-trust.d.ts +77 -0
  328. package/dist/src/lib/hosting-trust.js +194 -0
  329. package/dist/src/lib/hosting-trust.js.map +1 -0
  330. package/dist/src/lib/hosting-wait.d.ts +42 -0
  331. package/dist/src/lib/hosting-wait.js +84 -0
  332. package/dist/src/lib/hosting-wait.js.map +1 -0
  333. package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
  334. package/dist/src/lib/hosting-wfp-upload.js +149 -0
  335. package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
  336. package/dist/src/lib/init-assets.d.ts +2 -6
  337. package/dist/src/lib/init-assets.js +11 -27
  338. package/dist/src/lib/init-assets.js.map +1 -1
  339. package/dist/src/lib/init-ios-links.d.ts +11 -7
  340. package/dist/src/lib/init-ios-links.js +28 -22
  341. package/dist/src/lib/init-ios-links.js.map +1 -1
  342. package/dist/src/lib/init-login-note.d.ts +13 -0
  343. package/dist/src/lib/init-login-note.js +22 -0
  344. package/dist/src/lib/init-login-note.js.map +1 -0
  345. package/dist/src/lib/init-schema.d.ts +15 -0
  346. package/dist/src/lib/init-schema.js +54 -0
  347. package/dist/src/lib/init-schema.js.map +1 -1
  348. package/dist/src/lib/integration-test-request.d.ts +54 -0
  349. package/dist/src/lib/integration-test-request.js +207 -0
  350. package/dist/src/lib/integration-test-request.js.map +1 -0
  351. package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
  352. package/dist/src/lib/invoker-shared-enums.js +98 -0
  353. package/dist/src/lib/invoker-shared-enums.js.map +1 -0
  354. package/dist/src/lib/json-value.d.ts +6 -0
  355. package/dist/src/lib/json-value.js +13 -0
  356. package/dist/src/lib/json-value.js.map +1 -0
  357. package/dist/src/lib/load-routes.d.ts +33 -0
  358. package/dist/src/lib/load-routes.js +35 -0
  359. package/dist/src/lib/load-routes.js.map +1 -0
  360. package/dist/src/lib/log-inspection.d.ts +23 -4
  361. package/dist/src/lib/log-inspection.js +14 -5
  362. package/dist/src/lib/log-inspection.js.map +1 -1
  363. package/dist/src/lib/login-exchange-check.d.ts +18 -0
  364. package/dist/src/lib/login-exchange-check.js +27 -0
  365. package/dist/src/lib/login-exchange-check.js.map +1 -0
  366. package/dist/src/lib/login-scope-lines.d.ts +17 -7
  367. package/dist/src/lib/login-scope-lines.js +33 -10
  368. package/dist/src/lib/login-scope-lines.js.map +1 -1
  369. package/dist/src/lib/metadata-report.d.ts +85 -0
  370. package/dist/src/lib/metadata-report.js +81 -0
  371. package/dist/src/lib/metadata-report.js.map +1 -0
  372. package/dist/src/lib/object-status-filter.d.ts +9 -1
  373. package/dist/src/lib/object-status-filter.js +9 -1
  374. package/dist/src/lib/object-status-filter.js.map +1 -1
  375. package/dist/src/lib/output.d.ts +1 -1
  376. package/dist/src/lib/output.js +3 -1
  377. package/dist/src/lib/output.js.map +1 -1
  378. package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
  379. package/dist/src/lib/pin-refusal-hint.js +35 -0
  380. package/dist/src/lib/pin-refusal-hint.js.map +1 -0
  381. package/dist/src/lib/platform-owned.js +5 -0
  382. package/dist/src/lib/platform-owned.js.map +1 -1
  383. package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
  384. package/dist/src/lib/primitive-declaration-names.js +22 -0
  385. package/dist/src/lib/primitive-declaration-names.js.map +1 -0
  386. package/dist/src/lib/primitive-declaration.d.ts +174 -0
  387. package/dist/src/lib/primitive-declaration.js +871 -0
  388. package/dist/src/lib/primitive-declaration.js.map +1 -0
  389. package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
  390. package/dist/src/lib/primitive-env-plugin.js +408 -0
  391. package/dist/src/lib/primitive-env-plugin.js.map +1 -0
  392. package/dist/src/lib/project-login-apps.d.ts +8 -0
  393. package/dist/src/lib/project-login-apps.js +27 -0
  394. package/dist/src/lib/project-login-apps.js.map +1 -0
  395. package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
  396. package/dist/src/lib/prompt-schema-codegen.js +96 -100
  397. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  398. package/dist/src/lib/prompt-schema-document.d.ts +35 -0
  399. package/dist/src/lib/prompt-schema-document.js +92 -0
  400. package/dist/src/lib/prompt-schema-document.js.map +1 -0
  401. package/dist/src/lib/prompt-schema-refs.d.ts +173 -0
  402. package/dist/src/lib/prompt-schema-refs.js +478 -0
  403. package/dist/src/lib/prompt-schema-refs.js.map +1 -0
  404. package/dist/src/lib/records-verbs.d.ts +79 -0
  405. package/dist/src/lib/records-verbs.js +45 -0
  406. package/dist/src/lib/records-verbs.js.map +1 -0
  407. package/dist/src/lib/refresh-admin-credentials.d.ts +34 -4
  408. package/dist/src/lib/refresh-admin-credentials.js +85 -29
  409. package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
  410. package/dist/src/lib/refresh-stored-login.d.ts +85 -0
  411. package/dist/src/lib/refresh-stored-login.js +233 -0
  412. package/dist/src/lib/refresh-stored-login.js.map +1 -0
  413. package/dist/src/lib/register-commands.d.ts +36 -0
  414. package/dist/src/lib/register-commands.js +37 -0
  415. package/dist/src/lib/register-commands.js.map +1 -0
  416. package/dist/src/lib/retired-imports.d.ts +53 -0
  417. package/dist/src/lib/retired-imports.js +120 -0
  418. package/dist/src/lib/retired-imports.js.map +1 -0
  419. package/dist/src/lib/row-field-rename.d.ts +18 -0
  420. package/dist/src/lib/row-field-rename.js +32 -0
  421. package/dist/src/lib/row-field-rename.js.map +1 -0
  422. package/dist/src/lib/run-status.d.ts +1 -1
  423. package/dist/src/lib/run-status.generated.d.ts +2 -2
  424. package/dist/src/lib/run-status.generated.js +3 -1
  425. package/dist/src/lib/run-status.generated.js.map +1 -1
  426. package/dist/src/lib/run-status.js +1 -1
  427. package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
  428. package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
  429. package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
  430. package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
  431. package/dist/src/lib/schema-codegen/generated-db3-bridge.js +227 -0
  432. package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
  433. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
  434. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
  435. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
  436. package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +229 -0
  437. package/dist/src/lib/schema-codegen/generated-field-grammar.js +420 -0
  438. package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
  439. package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
  440. package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
  441. package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
  442. package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
  443. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
  444. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
  445. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +258 -0
  446. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +422 -0
  447. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
  448. package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
  449. package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
  450. package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
  451. package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
  452. package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
  453. package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
  454. package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
  455. package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
  456. package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
  457. package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
  458. package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
  459. package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
  460. package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
  461. package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
  462. package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
  463. package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
  464. package/dist/src/lib/schema-codegen/naming.js +83 -0
  465. package/dist/src/lib/schema-codegen/naming.js.map +1 -0
  466. package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
  467. package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
  468. package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
  469. package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
  470. package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
  471. package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
  472. package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
  473. package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
  474. package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
  475. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +109 -0
  476. package/dist/src/lib/schema-codegen/schemaToTs.js +269 -0
  477. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
  478. package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
  479. package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
  480. package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
  481. package/dist/src/lib/schema-defs-module.d.ts +29 -0
  482. package/dist/src/lib/schema-defs-module.js +103 -0
  483. package/dist/src/lib/schema-defs-module.js.map +1 -0
  484. package/dist/src/lib/schema-family-index.d.ts +228 -0
  485. package/dist/src/lib/schema-family-index.js +813 -0
  486. package/dist/src/lib/schema-family-index.js.map +1 -0
  487. package/dist/src/lib/schema-pins.d.ts +82 -0
  488. package/dist/src/lib/schema-pins.js +198 -0
  489. package/dist/src/lib/schema-pins.js.map +1 -0
  490. package/dist/src/lib/schema-preview.d.ts +244 -0
  491. package/dist/src/lib/schema-preview.js +498 -0
  492. package/dist/src/lib/schema-preview.js.map +1 -0
  493. package/dist/src/lib/scope-request.d.ts +23 -11
  494. package/dist/src/lib/scope-request.js +69 -31
  495. package/dist/src/lib/scope-request.js.map +1 -1
  496. package/dist/src/lib/session-scope.d.ts +26 -0
  497. package/dist/src/lib/session-scope.js +58 -0
  498. package/dist/src/lib/session-scope.js.map +1 -0
  499. package/dist/src/lib/skill-installer.d.ts +2 -2
  500. package/dist/src/lib/skill-installer.js +2 -21
  501. package/dist/src/lib/skill-installer.js.map +1 -1
  502. package/dist/src/lib/step-run-table.d.ts +1 -2
  503. package/dist/src/lib/step-run-table.js +1 -2
  504. package/dist/src/lib/step-run-table.js.map +1 -1
  505. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
  506. package/dist/src/lib/swift-codegen/agentGenerator.js +25 -23
  507. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  508. package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
  509. package/dist/src/lib/swift-codegen/banners.js +12 -0
  510. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  511. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
  512. package/dist/src/lib/swift-codegen/functionGenerator.js +169 -51
  513. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  514. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +33 -9
  515. package/dist/src/lib/swift-codegen/schemaToSwift.js +215 -179
  516. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  517. package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +51 -0
  518. package/dist/src/lib/swift-codegen/sharedGenerator.js +239 -0
  519. package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
  520. package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
  521. package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
  522. package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
  523. package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
  524. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
  525. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
  526. package/dist/src/lib/sync-resource-types.d.ts +117 -31
  527. package/dist/src/lib/sync-resource-types.js +197 -189
  528. package/dist/src/lib/sync-resource-types.js.map +1 -1
  529. package/dist/src/lib/sync-selectors.d.ts +7 -0
  530. package/dist/src/lib/sync-selectors.js +22 -2
  531. package/dist/src/lib/sync-selectors.js.map +1 -1
  532. package/dist/src/lib/template.d.ts +39 -3
  533. package/dist/src/lib/template.js +103 -14
  534. package/dist/src/lib/template.js.map +1 -1
  535. package/dist/src/lib/test-case-file-names.d.ts +3 -5
  536. package/dist/src/lib/test-case-file-names.js +3 -5
  537. package/dist/src/lib/test-case-file-names.js.map +1 -1
  538. package/dist/src/lib/test-runs.d.ts +45 -0
  539. package/dist/src/lib/test-runs.js +150 -0
  540. package/dist/src/lib/test-runs.js.map +1 -0
  541. package/dist/src/lib/test-users.d.ts +25 -0
  542. package/dist/src/lib/test-users.js +36 -0
  543. package/dist/src/lib/test-users.js.map +1 -0
  544. package/dist/src/lib/toml-database-config.d.ts +4 -2
  545. package/dist/src/lib/toml-database-config.js +11 -6
  546. package/dist/src/lib/toml-database-config.js.map +1 -1
  547. package/dist/src/lib/toml-list-edit.d.ts +33 -0
  548. package/dist/src/lib/toml-list-edit.js +481 -0
  549. package/dist/src/lib/toml-list-edit.js.map +1 -0
  550. package/dist/src/lib/toml-scalar-edit.d.ts +9 -0
  551. package/dist/src/lib/toml-scalar-edit.js +73 -5
  552. package/dist/src/lib/toml-scalar-edit.js.map +1 -1
  553. package/dist/src/lib/transition-warnings.d.ts +21 -0
  554. package/dist/src/lib/transition-warnings.js +49 -0
  555. package/dist/src/lib/transition-warnings.js.map +1 -0
  556. package/dist/src/lib/usage-meters.d.ts +16 -0
  557. package/dist/src/lib/usage-meters.js +52 -0
  558. package/dist/src/lib/usage-meters.js.map +1 -0
  559. package/dist/src/lib/user-index.d.ts +80 -0
  560. package/dist/src/lib/user-index.js +166 -0
  561. package/dist/src/lib/user-index.js.map +1 -0
  562. package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
  563. package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
  564. package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
  565. package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
  566. package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
  567. package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
  568. package/dist/src/lib/user-walk.d.ts +31 -0
  569. package/dist/src/lib/user-walk.js +102 -0
  570. package/dist/src/lib/user-walk.js.map +1 -0
  571. package/dist/src/lib/webhook-capture.d.ts +43 -0
  572. package/dist/src/lib/webhook-capture.js +91 -0
  573. package/dist/src/lib/webhook-capture.js.map +1 -0
  574. package/dist/src/lib/webhook-deliver.d.ts +18 -20
  575. package/dist/src/lib/webhook-deliver.js +34 -89
  576. package/dist/src/lib/webhook-deliver.js.map +1 -1
  577. package/dist/src/lib/webhook-test-run.d.ts +32 -0
  578. package/dist/src/lib/webhook-test-run.js +108 -0
  579. package/dist/src/lib/webhook-test-run.js.map +1 -0
  580. package/dist/src/lib/worker-perf-format.d.ts +22 -0
  581. package/dist/src/lib/worker-perf-format.js +27 -0
  582. package/dist/src/lib/worker-perf-format.js.map +1 -0
  583. package/dist/src/types/index.d.ts +20 -65
  584. package/dist/src/validators.d.ts +7 -55
  585. package/dist/src/validators.js +7 -53
  586. package/dist/src/validators.js.map +1 -1
  587. package/dist/src/vite.d.ts +17 -0
  588. package/dist/src/vite.js +18 -0
  589. package/dist/src/vite.js.map +1 -0
  590. package/package.json +20 -9
@@ -0,0 +1,173 @@
1
+ /**
2
+ * A prompt file's schemas, compiled the way the server compiles them (#5534,
3
+ * project `unified-schemas` phase 3, spec DSO-5534-009).
4
+ *
5
+ * A prompt's `[prompt].inputSchema`, `[prompt].outputSchema`, every slot of
6
+ * its `[prompt.agent]` declaration and each `[[configs]]` entry's
7
+ * `outputSchema` may carry `$defs`, local refs, and refs to the tree's
8
+ * `schemas/` defs, to another prompt's schemas and to a function's. The
9
+ * server compiles each write against its stored rows and stores the compiled
10
+ * schema, so every LOCAL reader that pushes or compares a prompt file reads
11
+ * the compiled document `compilePromptToml` answers: the local side of
12
+ * `config diff` and the push gate, the semantic hash, the preflight. The push
13
+ * bodies carry the AUTHORED schemas, with the compile and its provenance
14
+ * beside them (`promptSchemaPayload`), which the server recompiles and
15
+ * compares. Codegen keeps reading the authored file.
16
+ *
17
+ * Never run it on a document built from a stored row: the stored side is
18
+ * compared exactly as stored.
19
+ */
20
+ import { type PromptSchemaCompile, type PromptSchemaField } from "./schema-codegen/generated-prompt-schemas.js";
21
+ import { type SchemaFamilyIndex } from "./schema-codegen/generated-schema-refs.js";
22
+ import { type SchemaProvenance } from "./schema-codegen/generated-schema-provenance.js";
23
+ import { type SyncSelection } from "./sync-selectors.js";
24
+ /** The index a prompt compile reads, or the loader that reads it when a schema needs it. */
25
+ export type PromptFamilySource = SchemaFamilyIndex | (() => SchemaFamilyIndex);
26
+ /** A prompt file's parsed document with its schemas compiled. */
27
+ export interface CompiledPromptToml {
28
+ /**
29
+ * The parsed document, with each schema field (and each config's
30
+ * `outputSchema`) replaced by its compiled form where the compile changed
31
+ * it; the same object as the input when nothing changed.
32
+ */
33
+ parsed: any;
34
+ /** One line per inert `$ref`: `<file>: <field> #<path>: $ref "<ref>" stays inert (<reason>)`. */
35
+ warnings: string[];
36
+ /** The compile refusal, naming the file, or null. */
37
+ refusal: string | null;
38
+ /** The compile itself, for the payload; null for a document with no `[prompt]` table. */
39
+ compile: PromptSchemaCompile | null;
40
+ }
41
+ /** The authored document a compiled one came from, or the document itself. */
42
+ export declare function authoredPromptDocument(document: any): any;
43
+ /**
44
+ * Compile the schemas of a parsed `prompts/<key>.toml` (see the module note).
45
+ * With `families`, refs resolve against the tree's index; a loader is called
46
+ * only when a schema writes a family-spelled ref. A field the compile leaves
47
+ * unchanged keeps its authored spelling.
48
+ */
49
+ export declare function compilePromptToml(file: string, parsed: any, families?: PromptFamilySource): CompiledPromptToml;
50
+ /** What a prompt create or update carries beside the authored schemas: each field's compile and provenance. */
51
+ export interface PromptSchemaPayload {
52
+ compiled: Partial<Record<PromptSchemaField, unknown>>;
53
+ provenance: Partial<Record<PromptSchemaField, SchemaProvenance>>;
54
+ }
55
+ /** What a config create or update carries beside its authored `outputSchema`. */
56
+ export interface PromptConfigSchemaPayload {
57
+ compiled: {
58
+ outputSchema: unknown;
59
+ };
60
+ provenance: {
61
+ outputSchema: SchemaProvenance;
62
+ };
63
+ }
64
+ /**
65
+ * The compiled payload for a compiled prompt file's `[prompt]` fields: each
66
+ * field the file carries, compiled, and its provenance. The compile must have
67
+ * run with a family index.
68
+ */
69
+ export declare function promptSchemaPayload(compiled: CompiledPromptToml): Promise<PromptSchemaPayload>;
70
+ /** The compiled payload for a compiled prompt file's `[[configs]]` entry at `index`, or null when it carries no `outputSchema`. */
71
+ export declare function promptConfigSchemaPayload(compiled: CompiledPromptToml, index: number): Promise<PromptConfigSchemaPayload | null>;
72
+ /**
73
+ * Attach a compiled payload to a push body: `compiled` and `provenance` for
74
+ * each schema field the body carries with a value, and neither key when it
75
+ * carries none.
76
+ */
77
+ export declare function withSchemaPayload(body: Record<string, any>, payload: {
78
+ compiled: Record<string, unknown>;
79
+ provenance: Record<string, unknown>;
80
+ } | null | undefined): Record<string, any>;
81
+ /**
82
+ * The preflight for prompt schemas: one line per selected prompt file the
83
+ * compile refuses, a cycle of prompts included, naming the file. A ref to a
84
+ * prompt, function or `schemas/` file the tree (and, once told, the server)
85
+ * lacks is such a refusal.
86
+ */
87
+ export declare function collectPromptSchemaPreflight(configDir: string, selection: SyncSelection | null): string[];
88
+ /**
89
+ * #5538 — a keyword the lossless Gemini translator or the engine would refuse
90
+ * in the prompt file at `filePath`, judged on its compiled schemas with the
91
+ * server's own rule, one `<file>: <CODE>: <line>` per keyword as a compile
92
+ * refusal prints. A refused compile is reported by its own refusal and not
93
+ * judged here. The push preflight (`promptKindFileErrors`) and `functions
94
+ * codegen` (#5894) both read this, so the two refuse with one message.
95
+ */
96
+ export declare function promptSchemaKeywordRefusals(filePath: string, compiled: CompiledPromptToml): string[];
97
+ /**
98
+ * The cycle refusal of the prompt file at `filePath`, naming the chain, when
99
+ * the file is one of a cycle of prompts in its tree; null otherwise. A cycle
100
+ * member's own compile names only the dependency it cannot read.
101
+ */
102
+ export declare function promptSchemaCycleError(filePath: string): string | null;
103
+ /** The keys a tree's prompt files ref that the tree has no file for: what the push asks the server about. */
104
+ export declare function promptRefsMissingFromTree(configDir: string): {
105
+ prompts: string[];
106
+ functions: string[];
107
+ };
108
+ /** Where `config push` must place each prompt file (DSO-5534-014). */
109
+ export interface PromptPushDependencies {
110
+ /** Each file's prompt files, among those pushed, that it refs (any spelling). */
111
+ dependsOn: ReadonlyMap<string, readonly string[]>;
112
+ /** Each file that must follow the functions leg on its own account, with why: a function this push changes, or a server tool. */
113
+ functionReasons: ReadonlyMap<string, readonly string[]>;
114
+ /** Each file's kind. */
115
+ kinds: ReadonlyMap<string, string>;
116
+ }
117
+ /** #5540 — what the db3 legs of a push apply: the types (each with its file) and the `schemas/` files deferred after them (each with those files). */
118
+ export interface PromptPushDb3 {
119
+ applied: ReadonlyMap<string, string>;
120
+ deferredSchemas: ReadonlyMap<string, readonly string[]>;
121
+ }
122
+ /**
123
+ * The dependencies among prompt `files` (names under `prompts/`) a push
124
+ * places them by: the prompt files each one refs, and whether it refs a
125
+ * function in `changedFunctions` (one this push creates or changes) or a
126
+ * server tool, which puts it after the functions leg. #5540 — so does a ref
127
+ * to a db3 type this push applies, or to a `schemas/` file deferred after the
128
+ * db3 legs (`db3`), the type's file as the reason.
129
+ */
130
+ export declare function promptPushDependencies(configDir: string, files: readonly string[], changedFunctions: ReadonlySet<string>, db3?: PromptPushDb3): PromptPushDependencies;
131
+ /**
132
+ * The preflight for the #4441 exception (DSO-5534-014): an agent file the
133
+ * function-change preflight applies before the functions leg cannot depend on
134
+ * a prompt file applied after it, or on a function this push changes.
135
+ */
136
+ export declare function promptPlacementErrors(dependencies: PromptPushDependencies, agentFilesFirst: readonly string[]): string[];
137
+ /**
138
+ * What a selection of prompt files reaches through its refs: the other
139
+ * prompt files (by key, transitively), and the functions they ref directly or
140
+ * through a server tool. With no selection, every prompt file is a start.
141
+ */
142
+ export declare function promptDependenciesOf(configDir: string, selection: SyncSelection | null): {
143
+ prompts: string[];
144
+ functions: string[];
145
+ };
146
+ /** The reads `preparePromptSchemaRefs` makes. */
147
+ export interface PromptSchemaRefsClient {
148
+ listPromptRecords(): Promise<any[]>;
149
+ getPrompt(promptId: string): Promise<any>;
150
+ listFunctions(): Promise<any[]>;
151
+ listSchemaFiles(): Promise<Array<{
152
+ file: string;
153
+ version: number;
154
+ tombstone: boolean;
155
+ }>>;
156
+ }
157
+ /**
158
+ * Before a push compiles its prompt files (#5534, DSO-5534-009): tell the
159
+ * tree's index what the server holds for every prompt, function and
160
+ * `schemas/` file a prompt refs that the tree lacks, and compile refs to a
161
+ * function this push does not select against the server's stored version. A
162
+ * `<key>.<part>` short ref first reads the server's prompt and function keys.
163
+ * Reads nothing when every ref is a long or explicit form naming a file in
164
+ * the tree and the push selects every function it names. Answers one error per function a selected prompt
165
+ * refs that the push neither selects nor finds on the server.
166
+ */
167
+ export declare function preparePromptSchemaRefs(input: {
168
+ configDir: string;
169
+ selection: SyncSelection | null;
170
+ /** The function keys this push applies. */
171
+ selectedFunctions: ReadonlySet<string>;
172
+ client: PromptSchemaRefsClient;
173
+ }): Promise<string[]>;
@@ -0,0 +1,478 @@
1
+ /**
2
+ * A prompt file's schemas, compiled the way the server compiles them (#5534,
3
+ * project `unified-schemas` phase 3, spec DSO-5534-009).
4
+ *
5
+ * A prompt's `[prompt].inputSchema`, `[prompt].outputSchema`, every slot of
6
+ * its `[prompt.agent]` declaration and each `[[configs]]` entry's
7
+ * `outputSchema` may carry `$defs`, local refs, and refs to the tree's
8
+ * `schemas/` defs, to another prompt's schemas and to a function's. The
9
+ * server compiles each write against its stored rows and stores the compiled
10
+ * schema, so every LOCAL reader that pushes or compares a prompt file reads
11
+ * the compiled document `compilePromptToml` answers: the local side of
12
+ * `config diff` and the push gate, the semantic hash, the preflight. The push
13
+ * bodies carry the AUTHORED schemas, with the compile and its provenance
14
+ * beside them (`promptSchemaPayload`), which the server recompiles and
15
+ * compares. Codegen keeps reading the authored file.
16
+ *
17
+ * Never run it on a document built from a stored row: the stored side is
18
+ * compared exactly as stored.
19
+ */
20
+ import { dirname, join, resolve as resolvePath } from "path";
21
+ import { existsSync, readdirSync } from "fs";
22
+ import { PROMPT_SCHEMA_REF_CYCLE, compilePromptSchemas, } from "./schema-codegen/generated-prompt-schemas.js";
23
+ import { schemaFamilyRefsIn } from "./schema-codegen/generated-schema-refs.js";
24
+ import { schemaProvenanceOf } from "./schema-codegen/generated-schema-provenance.js";
25
+ import { filterFilesBySelection } from "./sync-selectors.js";
26
+ import { loadPromptFamilyIndex, overrideTreeFunctions, promptToolFunctionsReffed, rememberRemoteFunctions, rememberRemotePromptKeys, rememberRemotePrompts, rememberRemoteSchemaFiles, } from "./schema-family-index.js";
27
+ import { agentServerTools, authoredSchemaValue, promptConfigName, promptFileKey, promptFileLabel, promptSchemaDocumentOf, promptSchemaLocations, } from "./prompt-schema-document.js";
28
+ import { promptKindOf, promptSchemaDeficits, promptSchemaRefusals } from "./generated-config-surfaces.js";
29
+ import { fieldTableKeyWarning } from "./function-schema-refs.js";
30
+ import { agentSchemaSlots } from "./schema-codegen/generated-prompt-schemas.js";
31
+ /**
32
+ * One warning per JSON-Schema slot of a prompt document whose root carries
33
+ * field-table keys (#5541), naming the field-table key it was probably meant
34
+ * for. Accepted as before: such keys are annotations in JSON Schema.
35
+ */
36
+ function fieldTableKeyWarnings(document) {
37
+ const out = [];
38
+ const add = (warning) => {
39
+ if (warning)
40
+ out.push(warning);
41
+ };
42
+ if (document.inputSchema !== undefined)
43
+ add(fieldTableKeyWarning("inputSchema", authoredSchemaValue(document.inputSchema), "[prompt.input]"));
44
+ if (document.outputSchema !== undefined)
45
+ add(fieldTableKeyWarning("outputSchema", authoredSchemaValue(document.outputSchema), "[prompt.output]"));
46
+ if (document.agent !== undefined) {
47
+ for (const slot of agentSchemaSlots(document.agent)) {
48
+ const [, kind, index, key] = slot.pointer.split("/");
49
+ if (kind === "tools")
50
+ add(fieldTableKeyWarning(`[prompt.agent] tools[${index}].${key}`, slot.schema, key === "inputSchema" ? "input on the tool" : "output on the tool"));
51
+ else if (kind === "events")
52
+ add(fieldTableKeyWarning(`[prompt.agent] events[${index}].schema`, slot.schema, "the event table, in place of schema"));
53
+ else
54
+ add(fieldTableKeyWarning("[prompt.agent] turnContext.schema", slot.schema, "the turnContext table, in place of schema"));
55
+ }
56
+ }
57
+ for (const config of document.configs ?? []) {
58
+ if (config.outputSchema !== undefined)
59
+ add(fieldTableKeyWarning(`[[configs]] "${config.name}" outputSchema`, authoredSchemaValue(config.outputSchema), "[configs.chat.output]"));
60
+ }
61
+ return out;
62
+ }
63
+ const PROMPT_FIELDS = ["inputSchema", "outputSchema", "agent"];
64
+ /** Results by the document they compiled (and produced), per family source. */
65
+ const compiledDocuments = new WeakMap();
66
+ /** A compiled document → the authored one it was compiled from. */
67
+ const authoredDocuments = new WeakMap();
68
+ const NO_INDEX = Symbol("no family index");
69
+ /**
70
+ * What a document that writes no family-spelled ref compiles against: empty
71
+ * slots, as the server's loader answers for it, so local refs record the same
72
+ * provenance on both sides.
73
+ */
74
+ const EMPTY_SLOTS = Object.freeze({ files: new Map(), prompts: new Map(), functions: new Map() });
75
+ function isPlainObject(value) {
76
+ return value !== null && typeof value === "object" && !Array.isArray(value);
77
+ }
78
+ /** The authored document a compiled one came from, or the document itself. */
79
+ export function authoredPromptDocument(document) {
80
+ return (isPlainObject(document) && authoredDocuments.get(document)) || document;
81
+ }
82
+ /**
83
+ * Compile the schemas of a parsed `prompts/<key>.toml` (see the module note).
84
+ * With `families`, refs resolve against the tree's index; a loader is called
85
+ * only when a schema writes a family-spelled ref. A field the compile leaves
86
+ * unchanged keeps its authored spelling.
87
+ */
88
+ export function compilePromptToml(file, parsed, families) {
89
+ if (!isPlainObject(parsed) || !isPlainObject(parsed.prompt))
90
+ return { parsed, warnings: [], refusal: null, compile: null };
91
+ const cacheKey = families ?? NO_INDEX;
92
+ const known = compiledDocuments.get(parsed)?.get(cacheKey);
93
+ if (known)
94
+ return known;
95
+ const document = promptSchemaDocumentOf(parsed);
96
+ const needed = promptSchemaLocations(document).some(({ document: schema }) => {
97
+ const scan = schemaFamilyRefsIn(schema);
98
+ return scan.edges.length > 0 || scan.prompts.length > 0 || scan.functions.length > 0 || scan.db3.length > 0 || scan.shortForms || scan.reserved;
99
+ });
100
+ const index = !families ? undefined : !needed ? EMPTY_SLOTS : typeof families === "function" ? families() : families;
101
+ const compile = compilePromptSchemas(document, { ...(index ? { families: index } : {}), selfKey: promptFileKey(file, parsed) });
102
+ let result;
103
+ if (compile.refusal) {
104
+ const where = compile.refusal.config !== undefined ? `[[configs]] "${compile.refusal.config}": ` : "";
105
+ result = { parsed, warnings: [], refusal: `${file}: ${compile.refusal.code}: ${where}${compile.refusal.message}`, compile };
106
+ }
107
+ else {
108
+ let prompt = parsed.prompt;
109
+ for (const field of PROMPT_FIELDS) {
110
+ const compiled = compile.fields[field];
111
+ if (!compiled?.changed)
112
+ continue;
113
+ if (prompt === parsed.prompt)
114
+ prompt = { ...parsed.prompt };
115
+ prompt[field] = compiled.value;
116
+ }
117
+ let configs = parsed.configs;
118
+ compile.configs.forEach((compiled, index) => {
119
+ if (!compiled.changed)
120
+ return;
121
+ if (configs === parsed.configs)
122
+ configs = [...parsed.configs];
123
+ configs[index] = { ...configs[index], chat: { ...configs[index].chat, outputSchema: compiled.value } };
124
+ });
125
+ const output = prompt === parsed.prompt && configs === parsed.configs ? parsed : { ...parsed, prompt, ...(configs !== undefined ? { configs } : {}) };
126
+ const warnings = [...fieldTableKeyWarnings(document), ...compile.warnings].map((warning) => `${file}: ${warning}`);
127
+ result = { parsed: output, warnings, refusal: null, compile };
128
+ if (output !== parsed)
129
+ authoredDocuments.set(output, parsed);
130
+ }
131
+ for (const doc of [parsed, result.parsed]) {
132
+ let byKey = compiledDocuments.get(doc);
133
+ if (!byKey) {
134
+ byKey = new Map();
135
+ compiledDocuments.set(doc, byKey);
136
+ }
137
+ byKey.set(cacheKey, result);
138
+ }
139
+ return result;
140
+ }
141
+ /** A compiled value as the payload sends it: a JSON-string spelling parsed. */
142
+ function payloadValue(value) {
143
+ return authoredSchemaValue(value);
144
+ }
145
+ /**
146
+ * The compiled payload for a compiled prompt file's `[prompt]` fields: each
147
+ * field the file carries, compiled, and its provenance. The compile must have
148
+ * run with a family index.
149
+ */
150
+ export async function promptSchemaPayload(compiled) {
151
+ const payload = { compiled: {}, provenance: {} };
152
+ if (!compiled.compile || compiled.refusal)
153
+ return payload;
154
+ for (const field of PROMPT_FIELDS) {
155
+ const fieldCompile = compiled.compile.fields[field];
156
+ if (!fieldCompile)
157
+ continue;
158
+ payload.compiled[field] = payloadValue(fieldCompile.value);
159
+ payload.provenance[field] = await schemaProvenanceOf(fieldCompile.resolved);
160
+ }
161
+ return payload;
162
+ }
163
+ /** The compiled payload for a compiled prompt file's `[[configs]]` entry at `index`, or null when it carries no `outputSchema`. */
164
+ export async function promptConfigSchemaPayload(compiled, index) {
165
+ const fieldCompile = compiled.compile?.configs[index];
166
+ if (!fieldCompile || compiled.refusal)
167
+ return null;
168
+ const value = fieldCompile.authored;
169
+ if (value === undefined || value === null || value === "")
170
+ return null;
171
+ return { compiled: { outputSchema: payloadValue(fieldCompile.value) }, provenance: { outputSchema: await schemaProvenanceOf(fieldCompile.resolved) } };
172
+ }
173
+ /**
174
+ * Attach a compiled payload to a push body: `compiled` and `provenance` for
175
+ * each schema field the body carries with a value, and neither key when it
176
+ * carries none.
177
+ */
178
+ export function withSchemaPayload(body, payload) {
179
+ if (!payload)
180
+ return body;
181
+ const fields = Object.keys(payload.compiled).filter((field) => body[field] !== undefined && body[field] !== null && body[field] !== "");
182
+ if (fields.length === 0)
183
+ return body;
184
+ return {
185
+ ...body,
186
+ compiled: Object.fromEntries(fields.map((field) => [field, payload.compiled[field]])),
187
+ provenance: Object.fromEntries(fields.map((field) => [field, payload.provenance[field] ?? {}])),
188
+ };
189
+ }
190
+ /**
191
+ * The preflight for prompt schemas: one line per selected prompt file the
192
+ * compile refuses, a cycle of prompts included, naming the file. A ref to a
193
+ * prompt, function or `schemas/` file the tree (and, once told, the server)
194
+ * lacks is such a refusal.
195
+ */
196
+ export function collectPromptSchemaPreflight(configDir, selection) {
197
+ const promptsDir = join(configDir, "prompts");
198
+ if (!existsSync(promptsDir))
199
+ return [];
200
+ const selected = new Set(filterFilesBySelection(selection, "prompt", promptsDir, readdirSync(promptsDir).filter((name) => name.endsWith(".toml"))));
201
+ return loadPromptFamilyIndex(configDir)
202
+ .promptLocals.filter((local) => local.error && selected.has(local.file))
203
+ .map((local) => ` ${local.relative}: ${local.error}`);
204
+ }
205
+ /**
206
+ * #5538 — a keyword the lossless Gemini translator or the engine would refuse
207
+ * in the prompt file at `filePath`, judged on its compiled schemas with the
208
+ * server's own rule, one `<file>: <CODE>: <line>` per keyword as a compile
209
+ * refusal prints. A refused compile is reported by its own refusal and not
210
+ * judged here. The push preflight (`promptKindFileErrors`) and `functions
211
+ * codegen` (#5894) both read this, so the two refuse with one message.
212
+ */
213
+ export function promptSchemaKeywordRefusals(filePath, compiled) {
214
+ const prompt = compiled.parsed?.prompt;
215
+ if (compiled.refusal || !prompt || typeof prompt !== "object")
216
+ return [];
217
+ const compiledEntries = Array.isArray(compiled.parsed?.configs) ? compiled.parsed.configs : [];
218
+ const deficits = promptSchemaDeficits({
219
+ inputSchema: prompt.inputSchema,
220
+ outputSchema: prompt.outputSchema,
221
+ agent: prompt.agent,
222
+ configs: compiledEntries.map((entry, index) => ({
223
+ name: promptConfigName(entry, index),
224
+ provider: String(entry?.provider ?? ""),
225
+ status: entry?.status === undefined ? undefined : String(entry.status),
226
+ outputSchema: entry?.chat && typeof entry.chat === "object" ? entry.chat.outputSchema : undefined,
227
+ })),
228
+ });
229
+ return promptSchemaRefusals(deficits).map((refusal) => `${promptFileLabel(filePath)}: ${refusal.code}: ${refusal.message}`);
230
+ }
231
+ /**
232
+ * The cycle refusal of the prompt file at `filePath`, naming the chain, when
233
+ * the file is one of a cycle of prompts in its tree; null otherwise. A cycle
234
+ * member's own compile names only the dependency it cannot read.
235
+ */
236
+ export function promptSchemaCycleError(filePath) {
237
+ const label = promptFileLabel(filePath);
238
+ const local = loadPromptFamilyIndex(resolvePath(dirname(filePath), "..")).promptLocals.find((candidate) => candidate.relative === label);
239
+ return local?.error?.startsWith(PROMPT_SCHEMA_REF_CYCLE) ? `${label}: ${local.error}` : null;
240
+ }
241
+ /** The keys a tree's prompt files ref that the tree has no file for: what the push asks the server about. */
242
+ export function promptRefsMissingFromTree(configDir) {
243
+ const index = loadPromptFamilyIndex(configDir);
244
+ const localPrompts = new Set(index.promptLocals.map((local) => local.key));
245
+ const localFunctions = new Set(index.functionLocals.map((local) => local.key));
246
+ const prompts = new Set();
247
+ const functions = new Set();
248
+ for (const local of index.promptLocals) {
249
+ for (const edge of local.promptEdges)
250
+ if (!localPrompts.has(edge.key))
251
+ prompts.add(edge.key);
252
+ for (const edge of local.functionEdges)
253
+ if (!localFunctions.has(edge.key))
254
+ functions.add(edge.key);
255
+ }
256
+ // A local agent's server tool reffed by a prompt resolves to its function, which the tree may lack.
257
+ for (const fn of promptToolFunctionsReffed(index.promptLocals))
258
+ if (!localFunctions.has(fn))
259
+ functions.add(fn);
260
+ return { prompts: [...prompts].sort(), functions: [...functions].sort() };
261
+ }
262
+ /**
263
+ * The dependencies among prompt `files` (names under `prompts/`) a push
264
+ * places them by: the prompt files each one refs, and whether it refs a
265
+ * function in `changedFunctions` (one this push creates or changes) or a
266
+ * server tool, which puts it after the functions leg. #5540 — so does a ref
267
+ * to a db3 type this push applies, or to a `schemas/` file deferred after the
268
+ * db3 legs (`db3`), the type's file as the reason.
269
+ */
270
+ export function promptPushDependencies(configDir, files, changedFunctions, db3) {
271
+ const index = loadPromptFamilyIndex(configDir);
272
+ const byFile = new Map(index.promptLocals.map((local) => [local.file, local]));
273
+ const fileOfKey = new Map(index.promptLocals.filter((local) => files.includes(local.file)).map((local) => [local.key, local.file]));
274
+ const dependsOn = new Map();
275
+ const functionReasons = new Map();
276
+ const kinds = new Map();
277
+ for (const file of files) {
278
+ const local = byFile.get(file);
279
+ kinds.set(file, promptKindOf(local?.parsed?.prompt));
280
+ if (!local)
281
+ continue;
282
+ const deps = new Set();
283
+ const reasons = new Set();
284
+ for (const edge of local.promptEdges) {
285
+ const dep = fileOfKey.get(edge.key);
286
+ if (dep && dep !== file)
287
+ deps.add(dep);
288
+ const [kind, name] = edge.target.split("/");
289
+ if (kind !== "tools")
290
+ continue;
291
+ const target = index.promptLocals.find((candidate) => candidate.key === edge.key);
292
+ const fn = agentServerTools(target?.parsed?.prompt?.agent).get(name);
293
+ if (fn)
294
+ reasons.add(`the server tool ${edge.key}.${name} (functions/${fn}.toml)`);
295
+ }
296
+ for (const edge of local.functionEdges)
297
+ if (changedFunctions.has(edge.key))
298
+ reasons.add(`functions/${edge.key}.toml`);
299
+ for (const edge of local.db3Edges) {
300
+ const file = db3?.applied.get(edge.type);
301
+ if (file)
302
+ reasons.add(file);
303
+ }
304
+ for (const edge of local.schemaEdges)
305
+ for (const file of db3?.deferredSchemas.get(edge.file) ?? [])
306
+ reasons.add(file);
307
+ dependsOn.set(file, [...deps].sort());
308
+ if (reasons.size > 0)
309
+ functionReasons.set(file, [...reasons].sort());
310
+ }
311
+ return { dependsOn, functionReasons, kinds };
312
+ }
313
+ /**
314
+ * The preflight for the #4441 exception (DSO-5534-014): an agent file the
315
+ * function-change preflight applies before the functions leg cannot depend on
316
+ * a prompt file applied after it, or on a function this push changes.
317
+ */
318
+ export function promptPlacementErrors(dependencies, agentFilesFirst) {
319
+ const errors = [];
320
+ const first = new Set(agentFilesFirst);
321
+ for (const file of agentFilesFirst) {
322
+ const seen = new Set([file]);
323
+ const queue = [file];
324
+ const blockers = [];
325
+ while (queue.length > 0) {
326
+ const at = queue.shift();
327
+ for (const reason of dependencies.functionReasons.get(at) ?? [])
328
+ blockers.push(at === file ? reason : `prompts/${at} (it refs ${reason})`);
329
+ if (at !== file && dependencies.kinds.get(at) === "agent" && !first.has(at))
330
+ blockers.push(`prompts/${at}`);
331
+ for (const dep of dependencies.dependsOn.get(at) ?? []) {
332
+ if (seen.has(dep))
333
+ continue;
334
+ seen.add(dep);
335
+ queue.push(dep);
336
+ }
337
+ }
338
+ if (blockers.length === 0)
339
+ continue;
340
+ const key = file.slice(0, -".toml".length);
341
+ errors.push(`prompts/${file} must be applied before the server-functions leg, because it releases a function this push changes, ` +
342
+ `but its schemas ref ${[...new Set(blockers)].join(", ")}, which can only be applied after that leg. ` +
343
+ `Push in two runs: first push prompts/${file} without the change that needs the other files (primitive config push --only prompt/${key}), then push again.`);
344
+ }
345
+ return errors;
346
+ }
347
+ /**
348
+ * What a selection of prompt files reaches through its refs: the other
349
+ * prompt files (by key, transitively), and the functions they ref directly or
350
+ * through a server tool. With no selection, every prompt file is a start.
351
+ */
352
+ export function promptDependenciesOf(configDir, selection) {
353
+ const index = loadPromptFamilyIndex(configDir);
354
+ const promptsDir = join(configDir, "prompts");
355
+ const selectedFiles = existsSync(promptsDir)
356
+ ? new Set(filterFilesBySelection(selection, "prompt", promptsDir, readdirSync(promptsDir).filter((name) => name.endsWith(".toml"))))
357
+ : new Set();
358
+ const byKey = new Map(index.promptLocals.map((local) => [local.key, local]));
359
+ const reached = new Set();
360
+ const functions = new Set();
361
+ const queue = index.promptLocals.filter((local) => selectedFiles.has(local.file));
362
+ for (const local of queue)
363
+ reached.add(local.key);
364
+ while (queue.length > 0) {
365
+ const local = queue.shift();
366
+ for (const edge of local.functionEdges)
367
+ functions.add(edge.key);
368
+ for (const edge of local.selfEdges) {
369
+ const [kind, name] = edge.target.split("/");
370
+ const fn = kind === "tools" ? agentServerTools(local.parsed?.prompt?.agent).get(name) : undefined;
371
+ if (fn)
372
+ functions.add(fn);
373
+ }
374
+ for (const edge of local.promptEdges) {
375
+ const target = byKey.get(edge.key);
376
+ const [kind, name] = edge.target.split("/");
377
+ if (kind === "tools") {
378
+ const fn = agentServerTools(target?.parsed?.prompt?.agent).get(name);
379
+ if (fn)
380
+ functions.add(fn);
381
+ }
382
+ if (target && !reached.has(target.key)) {
383
+ reached.add(target.key);
384
+ queue.push(target);
385
+ }
386
+ }
387
+ }
388
+ return { prompts: [...reached].sort(), functions: [...functions].sort() };
389
+ }
390
+ /**
391
+ * Before a push compiles its prompt files (#5534, DSO-5534-009): tell the
392
+ * tree's index what the server holds for every prompt, function and
393
+ * `schemas/` file a prompt refs that the tree lacks, and compile refs to a
394
+ * function this push does not select against the server's stored version. A
395
+ * `<key>.<part>` short ref first reads the server's prompt and function keys.
396
+ * Reads nothing when every ref is a long or explicit form naming a file in
397
+ * the tree and the push selects every function it names. Answers one error per function a selected prompt
398
+ * refs that the push neither selects nor finds on the server.
399
+ */
400
+ export async function preparePromptSchemaRefs(input) {
401
+ const { configDir } = input;
402
+ // Each listing is read at most once, and a failed one is null.
403
+ let promptListing;
404
+ let functionListing;
405
+ const listPrompts = async () => {
406
+ if (promptListing === undefined)
407
+ promptListing = await Promise.resolve().then(() => input.client.listPromptRecords()).catch(() => null);
408
+ return promptListing;
409
+ };
410
+ const listFunctions = async () => {
411
+ if (functionListing === undefined)
412
+ functionListing = await Promise.resolve().then(() => input.client.listFunctions()).catch(() => null);
413
+ return functionListing;
414
+ };
415
+ // A `<key>.<part>` short ref is judged against the keys of every family the
416
+ // server holds, as the server judges it: a server-only key resolves, and a
417
+ // key in two families is ambiguous. Those keys are read before the refs are.
418
+ const writesShortPairs = loadPromptFamilyIndex(configDir).promptLocals.some((local) => local.parsed
419
+ ? promptSchemaLocations(promptSchemaDocumentOf(local.parsed)).some(({ document }) => schemaFamilyRefsIn(document).shortKeys.length > 0)
420
+ : false);
421
+ if (writesShortPairs) {
422
+ const prompts = await listPrompts();
423
+ if (prompts)
424
+ rememberRemotePromptKeys(configDir, prompts.map((row) => String(row?.promptKey ?? "")));
425
+ const functions = await listFunctions();
426
+ if (functions)
427
+ rememberRemoteFunctions(configDir, functions);
428
+ }
429
+ const index = loadPromptFamilyIndex(configDir);
430
+ const missing = promptRefsMissingFromTree(configDir);
431
+ const reached = promptDependenciesOf(configDir, input.selection);
432
+ const unselected = reached.functions.filter((key) => !input.selectedFunctions.has(key));
433
+ const missingFiles = index.promptLocals.some((local) => local.parsed
434
+ ? promptSchemaLocations(promptSchemaDocumentOf(local.parsed)).some(({ document }) => schemaFamilyRefsIn(document).edges.some((edge) => !existsSync(join(configDir, "schemas", `${edge.file}.toml`))))
435
+ : false);
436
+ if (missingFiles) {
437
+ try {
438
+ rememberRemoteSchemaFiles(configDir, await input.client.listSchemaFiles());
439
+ }
440
+ catch {
441
+ // The compile reports the file as missing instead.
442
+ }
443
+ }
444
+ if (missing.prompts.length > 0) {
445
+ try {
446
+ const listed = await listPrompts();
447
+ if (!listed)
448
+ throw new Error("the prompt listing failed");
449
+ const records = [];
450
+ for (const row of listed) {
451
+ if (!missing.prompts.includes(String(row?.promptKey ?? "")))
452
+ continue;
453
+ records.push(row.status === "archived" ? { promptKey: row.promptKey, status: "archived" } : await input.client.getPrompt(row.promptId));
454
+ }
455
+ rememberRemotePrompts(configDir, records);
456
+ }
457
+ catch {
458
+ // The compile reports the prompt as missing instead.
459
+ }
460
+ }
461
+ const errors = [];
462
+ if (missing.functions.length > 0 || unselected.length > 0) {
463
+ const listed = await listFunctions();
464
+ if (listed) {
465
+ rememberRemoteFunctions(configDir, listed);
466
+ const byKey = new Map(listed.map((row) => [String(row?.functionKey ?? ""), row]));
467
+ overrideTreeFunctions(configDir, unselected.filter((key) => byKey.has(key) && index.functionLocals.some((local) => local.key === key)).map((key) => byKey.get(key)));
468
+ for (const key of unselected) {
469
+ if (byKey.has(key))
470
+ continue;
471
+ errors.push(`functions/${key}.toml: the selected prompts ref function ${key} (directly or through a server tool), which this push ` +
472
+ `does not select and the server does not have. Add function/${key} to --only, or push it first.`);
473
+ }
474
+ }
475
+ }
476
+ return errors;
477
+ }
478
+ //# sourceMappingURL=prompt-schema-refs.js.map