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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/README.md +102 -78
  2. package/assets/skill/skills/primitive-platform/SKILL.md +87 -23
  3. package/dist/bin/primitive.js +11 -82
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/admins.js +79 -17
  6. package/dist/src/commands/admins.js.map +1 -1
  7. package/dist/src/commands/agent-sessions.js +2 -0
  8. package/dist/src/commands/agent-sessions.js.map +1 -1
  9. package/dist/src/commands/analytics.js +183 -12
  10. package/dist/src/commands/analytics.js.map +1 -1
  11. package/dist/src/commands/apps-children.js +2 -0
  12. package/dist/src/commands/apps-children.js.map +1 -1
  13. package/dist/src/commands/apps.js +19 -2
  14. package/dist/src/commands/apps.js.map +1 -1
  15. package/dist/src/commands/auth.js +11 -1
  16. package/dist/src/commands/auth.js.map +1 -1
  17. package/dist/src/commands/collections.js +13 -0
  18. package/dist/src/commands/collections.js.map +1 -1
  19. package/dist/src/commands/config.d.ts +1 -1
  20. package/dist/src/commands/config.js +40 -9
  21. package/dist/src/commands/config.js.map +1 -1
  22. package/dist/src/commands/connections.js +2 -0
  23. package/dist/src/commands/connections.js.map +1 -1
  24. package/dist/src/commands/database-type-configs.js +5 -3
  25. package/dist/src/commands/database-type-configs.js.map +1 -1
  26. package/dist/src/commands/databases.js +6 -4
  27. package/dist/src/commands/databases.js.map +1 -1
  28. package/dist/src/commands/db3-types.js +2 -0
  29. package/dist/src/commands/db3-types.js.map +1 -1
  30. package/dist/src/commands/db3.d.ts +12 -0
  31. package/dist/src/commands/db3.js +343 -24
  32. package/dist/src/commands/db3.js.map +1 -1
  33. package/dist/src/commands/documents.d.ts +52 -12
  34. package/dist/src/commands/documents.js +120 -29
  35. package/dist/src/commands/documents.js.map +1 -1
  36. package/dist/src/commands/email-templates.js +72 -0
  37. package/dist/src/commands/email-templates.js.map +1 -1
  38. package/dist/src/commands/functions.js +47 -10
  39. package/dist/src/commands/functions.js.map +1 -1
  40. package/dist/src/commands/groups.js +18 -3
  41. package/dist/src/commands/groups.js.map +1 -1
  42. package/dist/src/commands/init.js +7 -1
  43. package/dist/src/commands/init.js.map +1 -1
  44. package/dist/src/commands/integrations.js +80 -47
  45. package/dist/src/commands/integrations.js.map +1 -1
  46. package/dist/src/commands/metadata-category-configs.js +2 -0
  47. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  48. package/dist/src/commands/metadata.js +41 -0
  49. package/dist/src/commands/metadata.js.map +1 -1
  50. package/dist/src/commands/prompts.js +73 -47
  51. package/dist/src/commands/prompts.js.map +1 -1
  52. package/dist/src/commands/rule-sets.js +2 -0
  53. package/dist/src/commands/rule-sets.js.map +1 -1
  54. package/dist/src/commands/schemas.d.ts +15 -0
  55. package/dist/src/commands/schemas.js +122 -0
  56. package/dist/src/commands/schemas.js.map +1 -0
  57. package/dist/src/commands/secrets.js +45 -3
  58. package/dist/src/commands/secrets.js.map +1 -1
  59. package/dist/src/commands/sessions.js +2 -0
  60. package/dist/src/commands/sessions.js.map +1 -1
  61. package/dist/src/commands/sync-schemas.d.ts +202 -0
  62. package/dist/src/commands/sync-schemas.js +629 -0
  63. package/dist/src/commands/sync-schemas.js.map +1 -0
  64. package/dist/src/commands/sync-user-properties.d.ts +118 -0
  65. package/dist/src/commands/sync-user-properties.js +276 -0
  66. package/dist/src/commands/sync-user-properties.js.map +1 -0
  67. package/dist/src/commands/sync.d.ts +243 -12
  68. package/dist/src/commands/sync.js +1474 -314
  69. package/dist/src/commands/sync.js.map +1 -1
  70. package/dist/src/commands/user-properties.d.ts +14 -0
  71. package/dist/src/commands/user-properties.js +79 -0
  72. package/dist/src/commands/user-properties.js.map +1 -0
  73. package/dist/src/commands/users.js +879 -16
  74. package/dist/src/commands/users.js.map +1 -1
  75. package/dist/src/commands/waitlist.js +39 -4
  76. package/dist/src/commands/waitlist.js.map +1 -1
  77. package/dist/src/lib/analytics-query.d.ts +58 -0
  78. package/dist/src/lib/analytics-query.js +134 -0
  79. package/dist/src/lib/analytics-query.js.map +1 -0
  80. package/dist/src/lib/api-client.d.ts +748 -95
  81. package/dist/src/lib/api-client.js +356 -158
  82. package/dist/src/lib/api-client.js.map +1 -1
  83. package/dist/src/lib/block-selector.d.ts +9 -15
  84. package/dist/src/lib/block-selector.js +9 -20
  85. package/dist/src/lib/block-selector.js.map +1 -1
  86. package/dist/src/lib/cli-manifest.d.ts +8 -0
  87. package/dist/src/lib/cli-manifest.js +10 -1
  88. package/dist/src/lib/cli-manifest.js.map +1 -1
  89. package/dist/src/lib/cli-version.d.ts +14 -0
  90. package/dist/src/lib/cli-version.js +38 -0
  91. package/dist/src/lib/cli-version.js.map +1 -0
  92. package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
  93. package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
  94. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
  95. package/dist/src/lib/command-status.d.ts +110 -0
  96. package/dist/src/lib/command-status.js +184 -0
  97. package/dist/src/lib/command-status.js.map +1 -0
  98. package/dist/src/lib/config-object-descriptor.d.ts +6 -0
  99. package/dist/src/lib/config-object-descriptor.js +71 -0
  100. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  101. package/dist/src/lib/config-toml.d.ts +11 -2
  102. package/dist/src/lib/config-toml.js +25 -2
  103. package/dist/src/lib/config-toml.js.map +1 -1
  104. package/dist/src/lib/data-input.d.ts +1 -1
  105. package/dist/src/lib/data-input.js +1 -1
  106. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
  107. package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
  108. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  109. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +11 -1
  110. package/dist/src/lib/db-codegen/dbTypeIR.js +11 -5
  111. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  112. package/dist/src/lib/db-type-records.d.ts +95 -0
  113. package/dist/src/lib/db-type-records.js +219 -0
  114. package/dist/src/lib/db-type-records.js.map +1 -0
  115. package/dist/src/lib/db3-export.d.ts +51 -14
  116. package/dist/src/lib/db3-export.js +135 -27
  117. package/dist/src/lib/db3-export.js.map +1 -1
  118. package/dist/src/lib/db3-index-output.d.ts +68 -3
  119. package/dist/src/lib/db3-index-output.js +139 -3
  120. package/dist/src/lib/db3-index-output.js.map +1 -1
  121. package/dist/src/lib/db3-type-models.d.ts +39 -7
  122. package/dist/src/lib/db3-type-models.js +138 -27
  123. package/dist/src/lib/db3-type-models.js.map +1 -1
  124. package/dist/src/lib/deprecation.d.ts +2 -2
  125. package/dist/src/lib/deprecation.js +2 -2
  126. package/dist/src/lib/experimental-apis.d.ts +36 -0
  127. package/dist/src/lib/experimental-apis.js +46 -0
  128. package/dist/src/lib/experimental-apis.js.map +1 -0
  129. package/dist/src/lib/file-attachment.d.ts +24 -0
  130. package/dist/src/lib/file-attachment.js +31 -0
  131. package/dist/src/lib/file-attachment.js.map +1 -0
  132. package/dist/src/lib/function-authorize-check.d.ts +1 -1
  133. package/dist/src/lib/function-authorize-check.js +2 -1
  134. package/dist/src/lib/function-authorize-check.js.map +1 -1
  135. package/dist/src/lib/function-authorize-view.js +4 -0
  136. package/dist/src/lib/function-authorize-view.js.map +1 -1
  137. package/dist/src/lib/function-bundle.d.ts +27 -5
  138. package/dist/src/lib/function-bundle.js +106 -7
  139. package/dist/src/lib/function-bundle.js.map +1 -1
  140. package/dist/src/lib/function-collect.d.ts +2 -0
  141. package/dist/src/lib/function-collect.js +36 -7
  142. package/dist/src/lib/function-collect.js.map +1 -1
  143. package/dist/src/lib/function-db-types.d.ts +57 -40
  144. package/dist/src/lib/function-db-types.js +246 -285
  145. package/dist/src/lib/function-db-types.js.map +1 -1
  146. package/dist/src/lib/function-document-types.d.ts +19 -7
  147. package/dist/src/lib/function-document-types.js +24 -12
  148. package/dist/src/lib/function-document-types.js.map +1 -1
  149. package/dist/src/lib/function-run.d.ts +1 -1
  150. package/dist/src/lib/function-run.js +1 -1
  151. package/dist/src/lib/function-run.js.map +1 -1
  152. package/dist/src/lib/function-schema-codegen.d.ts +58 -18
  153. package/dist/src/lib/function-schema-codegen.js +85 -74
  154. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  155. package/dist/src/lib/function-schema-refs.d.ts +98 -0
  156. package/dist/src/lib/function-schema-refs.js +177 -0
  157. package/dist/src/lib/function-schema-refs.js.map +1 -0
  158. package/dist/src/lib/function-sync.d.ts +38 -4
  159. package/dist/src/lib/function-sync.js +83 -14
  160. package/dist/src/lib/function-sync.js.map +1 -1
  161. package/dist/src/lib/function-typecheck.d.ts +52 -0
  162. package/dist/src/lib/function-typecheck.js +171 -54
  163. package/dist/src/lib/function-typecheck.js.map +1 -1
  164. package/dist/src/lib/generated-build-flags.d.ts +13 -0
  165. package/dist/src/lib/generated-build-flags.js +14 -0
  166. package/dist/src/lib/generated-build-flags.js.map +1 -0
  167. package/dist/src/lib/generated-config-surfaces.d.ts +211 -11
  168. package/dist/src/lib/generated-config-surfaces.js +579 -69
  169. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  170. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  171. package/dist/src/lib/generated-sdk-types.js +1 -1
  172. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  173. package/dist/src/lib/integration-test-request.d.ts +54 -0
  174. package/dist/src/lib/integration-test-request.js +207 -0
  175. package/dist/src/lib/integration-test-request.js.map +1 -0
  176. package/dist/src/lib/metadata-report.d.ts +85 -0
  177. package/dist/src/lib/metadata-report.js +81 -0
  178. package/dist/src/lib/metadata-report.js.map +1 -0
  179. package/dist/src/lib/output.d.ts +1 -1
  180. package/dist/src/lib/output.js +1 -1
  181. package/dist/src/lib/platform-owned.js +5 -0
  182. package/dist/src/lib/platform-owned.js.map +1 -1
  183. package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
  184. package/dist/src/lib/primitive-declaration-names.js +22 -0
  185. package/dist/src/lib/primitive-declaration-names.js.map +1 -0
  186. package/dist/src/lib/primitive-declaration.d.ts +143 -0
  187. package/dist/src/lib/primitive-declaration.js +658 -0
  188. package/dist/src/lib/primitive-declaration.js.map +1 -0
  189. package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
  190. package/dist/src/lib/prompt-schema-codegen.js +82 -98
  191. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  192. package/dist/src/lib/prompt-schema-document.d.ts +35 -0
  193. package/dist/src/lib/prompt-schema-document.js +92 -0
  194. package/dist/src/lib/prompt-schema-document.js.map +1 -0
  195. package/dist/src/lib/prompt-schema-refs.d.ts +164 -0
  196. package/dist/src/lib/prompt-schema-refs.js +452 -0
  197. package/dist/src/lib/prompt-schema-refs.js.map +1 -0
  198. package/dist/src/lib/records-verbs.d.ts +12 -2
  199. package/dist/src/lib/records-verbs.js +7 -2
  200. package/dist/src/lib/records-verbs.js.map +1 -1
  201. package/dist/src/lib/register-commands.d.ts +28 -0
  202. package/dist/src/lib/register-commands.js +101 -0
  203. package/dist/src/lib/register-commands.js.map +1 -0
  204. package/dist/src/lib/retired-imports.d.ts +53 -0
  205. package/dist/src/lib/retired-imports.js +120 -0
  206. package/dist/src/lib/retired-imports.js.map +1 -0
  207. package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
  208. package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
  209. package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
  210. package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
  211. package/dist/src/lib/schema-codegen/generated-db3-bridge.js +221 -0
  212. package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
  213. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
  214. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
  215. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
  216. package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +209 -0
  217. package/dist/src/lib/schema-codegen/generated-field-grammar.js +379 -0
  218. package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
  219. package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
  220. package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
  221. package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
  222. package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
  223. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
  224. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
  225. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
  226. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +154 -1
  227. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -1
  228. package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
  229. package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
  230. package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
  231. package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
  232. package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
  233. package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
  234. package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
  235. package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
  236. package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
  237. package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
  238. package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
  239. package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
  240. package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
  241. package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
  242. package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
  243. package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
  244. package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
  245. package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
  246. package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
  247. package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
  248. package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
  249. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +40 -13
  250. package/dist/src/lib/schema-codegen/schemaToTs.js +124 -160
  251. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
  252. package/dist/src/lib/schema-codegen/valuesLists.d.ts +35 -0
  253. package/dist/src/lib/schema-codegen/valuesLists.js +128 -0
  254. package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
  255. package/dist/src/lib/schema-family-index.d.ts +228 -0
  256. package/dist/src/lib/schema-family-index.js +813 -0
  257. package/dist/src/lib/schema-family-index.js.map +1 -0
  258. package/dist/src/lib/schema-pins.d.ts +82 -0
  259. package/dist/src/lib/schema-pins.js +198 -0
  260. package/dist/src/lib/schema-pins.js.map +1 -0
  261. package/dist/src/lib/schema-preview.d.ts +244 -0
  262. package/dist/src/lib/schema-preview.js +498 -0
  263. package/dist/src/lib/schema-preview.js.map +1 -0
  264. package/dist/src/lib/skill-installer.d.ts +2 -2
  265. package/dist/src/lib/skill-installer.js +2 -21
  266. package/dist/src/lib/skill-installer.js.map +1 -1
  267. package/dist/src/lib/step-run-table.d.ts +1 -2
  268. package/dist/src/lib/step-run-table.js +1 -2
  269. package/dist/src/lib/step-run-table.js.map +1 -1
  270. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
  271. package/dist/src/lib/swift-codegen/agentGenerator.js +24 -22
  272. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  273. package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
  274. package/dist/src/lib/swift-codegen/banners.js +12 -0
  275. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  276. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
  277. package/dist/src/lib/swift-codegen/functionGenerator.js +167 -50
  278. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  279. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +31 -7
  280. package/dist/src/lib/swift-codegen/schemaToSwift.js +213 -177
  281. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  282. package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
  283. package/dist/src/lib/swift-codegen/sharedGenerator.js +120 -0
  284. package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
  285. package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
  286. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
  287. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
  288. package/dist/src/lib/sync-resource-types.d.ts +37 -5
  289. package/dist/src/lib/sync-resource-types.js +53 -5
  290. package/dist/src/lib/sync-resource-types.js.map +1 -1
  291. package/dist/src/lib/sync-selectors.d.ts +7 -0
  292. package/dist/src/lib/sync-selectors.js +22 -2
  293. package/dist/src/lib/sync-selectors.js.map +1 -1
  294. package/dist/src/lib/test-runs.d.ts +45 -0
  295. package/dist/src/lib/test-runs.js +150 -0
  296. package/dist/src/lib/test-runs.js.map +1 -0
  297. package/dist/src/lib/toml-database-config.d.ts +2 -1
  298. package/dist/src/lib/toml-database-config.js +4 -3
  299. package/dist/src/lib/toml-database-config.js.map +1 -1
  300. package/dist/src/lib/toml-scalar-edit.js +6 -4
  301. package/dist/src/lib/toml-scalar-edit.js.map +1 -1
  302. package/dist/src/lib/user-index.d.ts +80 -0
  303. package/dist/src/lib/user-index.js +166 -0
  304. package/dist/src/lib/user-index.js.map +1 -0
  305. package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
  306. package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
  307. package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
  308. package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
  309. package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
  310. package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
  311. package/dist/src/lib/user-walk.d.ts +31 -0
  312. package/dist/src/lib/user-walk.js +102 -0
  313. package/dist/src/lib/user-walk.js.map +1 -0
  314. package/dist/src/lib/worker-perf-format.d.ts +22 -0
  315. package/dist/src/lib/worker-perf-format.js +27 -0
  316. package/dist/src/lib/worker-perf-format.js.map +1 -0
  317. package/dist/src/types/index.d.ts +13 -34
  318. package/package.json +5 -3
@@ -0,0 +1,228 @@
1
+ /**
2
+ * The tree's family index (#5533, project `unified-schemas` phase 3): what a
3
+ * function schema's refs to shared defs resolve against in `config push`,
4
+ * `config diff` and the preflight.
5
+ *
6
+ * `loadSchemaFamilyIndex(configDir)` reads every `schemas/<file>.toml`, finds
7
+ * the files each one names through `schemaFamilyRefsIn` (every ref spelling),
8
+ * refuses a cycle of files naming the chain, and compiles the files in
9
+ * dependency order with the vendored server compiler, so a file's refs to
10
+ * another file's defs resolve as the server will resolve them against the
11
+ * versions pushed first. A file that fails keeps its error, and a ref to it is
12
+ * refused naming that error. The keys of the function, prompt and db3-type
13
+ * families are collected for the short-form rules. A file the server holds
14
+ * only as a tombstone, once `rememberRemoteSchemaFiles` has been told, reads
15
+ * as deleted rather than missing.
16
+ *
17
+ * #5540 — the index has a db3 slot: every db3 type of the tree (`db3-types/`
18
+ * and the legacy `database-type-configs/`, `[type] models` resolved, named as
19
+ * the push names them) bridged into both projections of every model, from
20
+ * the `[models]` tables and timestamps the push sends, so a db3 ref compiles
21
+ * to the bytes the server compiles from the stored row. A type only the
22
+ * server holds resolves against its row once `rememberRemoteDb3Types` has
23
+ * been told, and `overrideTreeDb3Types` compiles against the server's row for
24
+ * a type a `--only` push does not select.
25
+ *
26
+ * Memoised per process by the tree's content, so the push loop, the preflight
27
+ * and the diff share one compile.
28
+ */
29
+ import { type SchemaFileCompile } from "./schema-codegen/generated-schema-file.js";
30
+ import { type SchemaFamilyDb3Edge, type SchemaFamilyDb3Type, type SchemaFamilyEdge, type SchemaFamilyFunction, type SchemaFamilyIndex, type SchemaFamilyKeys, type SchemaFamilyPrompt } from "./schema-codegen/generated-schema-refs.js";
31
+ import { type PromptSchemaCompile } from "./schema-codegen/generated-prompt-schemas.js";
32
+ /** One local `schemas/` file: its text, hashes, and what the preflight and the compile make of it. */
33
+ export interface LocalSchemaFile {
34
+ /** The stem: the file's name without `.toml`, and its key. */
35
+ file: string;
36
+ /** Tree-relative, `schemas/<file>.toml`. */
37
+ relative: string;
38
+ text: string;
39
+ /** sha256 hex of the file's bytes. */
40
+ contentHash: string;
41
+ /** sha256 hex of the source as the server hashes it (the text's UTF-8 bytes). */
42
+ sourceHash: string;
43
+ /** Why the push would refuse the file, or null. */
44
+ error: string | null;
45
+ /** The compile, when the file is one the push takes. */
46
+ compile: SchemaFileCompile | null;
47
+ /** The other files it names, any spelling (#5533). */
48
+ edges: SchemaFamilyEdge[];
49
+ /** The db3 models it names, any spelling (#5540). */
50
+ db3Edges: SchemaFamilyDb3Edge[];
51
+ }
52
+ /** The tree's index, with every local file as the preflight and the push read it. */
53
+ export interface TreeSchemaFamilyIndex extends SchemaFamilyIndex {
54
+ keys: SchemaFamilyKeys;
55
+ /** Every `schemas/*.toml`, in name order. */
56
+ locals: LocalSchemaFile[];
57
+ /** #5540 — the db3 types refs resolve against: the tree's, and the server's it was told about. */
58
+ db3: Map<string, SchemaFamilyDb3Type>;
59
+ /** #5540 — the tree's own db3 types, each bridged from its file whatever the overrides say, with the file. */
60
+ db3Locals: Array<{
61
+ name: string;
62
+ relative: string;
63
+ entry: SchemaFamilyDb3Type;
64
+ }>;
65
+ }
66
+ /** A db3 type the server holds, as `listDatabaseTypeConfigs` answers it (#5540). */
67
+ export interface RemoteDb3TypeRecord {
68
+ databaseType: string;
69
+ /** The stored `[models]` tables as TOML text, or null. */
70
+ schema?: string | null;
71
+ timestamps?: unknown;
72
+ autoPopulatedFields?: unknown;
73
+ }
74
+ /** What the server holds for a file, as the schemas listing answers it. */
75
+ export interface RemoteSchemaFile {
76
+ file: string;
77
+ version: number;
78
+ tombstone: boolean;
79
+ }
80
+ /**
81
+ * Tell the tree's index what the server holds, so a ref to a file the tree
82
+ * does not have but the server tombstoned is refused as deleted, naming the
83
+ * tombstone. Files the tree has are always read from the tree.
84
+ */
85
+ export declare function rememberRemoteSchemaFiles(configDir: string, files: readonly RemoteSchemaFile[]): void;
86
+ /**
87
+ * Tell the tree's index which db3 types the server holds (#5540), so a ref
88
+ * to a type the tree does not have resolves against the server's stored row,
89
+ * and its name counts for the short-form rules. Types the tree has are read
90
+ * from the tree.
91
+ */
92
+ export declare function rememberRemoteDb3Types(configDir: string, records: readonly RemoteDb3TypeRecord[]): void;
93
+ /** The server's db3 types this tree was told about (#5540), by name, or null when it was told nothing. */
94
+ export declare function rememberedRemoteDb3Types(configDir: string): ReadonlyMap<string, RemoteDb3TypeRecord> | null;
95
+ /**
96
+ * Compile refs to these db3 types against the server's stored rows rather
97
+ * than the tree's files (#5540): a `--only` push that does not select a type
98
+ * its files ref leaves the server's revision in place, and the server
99
+ * compiles against that one. An empty list lifts every override.
100
+ */
101
+ export declare function overrideTreeDb3Types(configDir: string, records: readonly RemoteDb3TypeRecord[]): void;
102
+ /** A server's db3 type as the db3 slot holds it: bridged from its stored row, as the server bridges it. */
103
+ export declare function remoteDb3Entry(record: RemoteDb3TypeRecord): SchemaFamilyDb3Type;
104
+ /** The index of `configDir`'s `schemas/` files, compiled; see the module note. */
105
+ export declare function loadSchemaFamilyIndex(configDir: string): TreeSchemaFamilyIndex;
106
+ /**
107
+ * The loader a function compile reads the index through: one per tree for
108
+ * the process, called only when a schema writes a family-spelled ref.
109
+ */
110
+ export declare function schemaFamilyIndexLoader(configDir: string): () => TreeSchemaFamilyIndex;
111
+ /** One local `prompts/*.toml`: its key, what it refs, and why it cannot be compiled. */
112
+ export interface LocalPromptFile {
113
+ key: string;
114
+ /** The file name, `<stem>.toml`. */
115
+ file: string;
116
+ /** Tree-relative, `prompts/<stem>.toml`. */
117
+ relative: string;
118
+ parsed: any | null;
119
+ /** Why the push would refuse the file's schemas, or null; a parse failure is the file's own collectors' to report. */
120
+ error: string | null;
121
+ compile: PromptSchemaCompile | null;
122
+ /** The other prompts it refs, each at the location the ref is written. */
123
+ promptEdges: Array<{
124
+ location: string;
125
+ key: string;
126
+ target: string;
127
+ }>;
128
+ /** The targets of its own it refs (`prompt.<own key>.…`), each at the location the ref is written. */
129
+ selfEdges: Array<{
130
+ location: string;
131
+ target: string;
132
+ }>;
133
+ /** The functions it refs directly (`fn.<key>.input|output`, any spelling). */
134
+ functionEdges: Array<{
135
+ location: string;
136
+ key: string;
137
+ part: "input" | "output";
138
+ }>;
139
+ /** #5540 — the `schemas/` files it refs, any spelling. */
140
+ schemaEdges: Array<{
141
+ location: string;
142
+ file: string;
143
+ }>;
144
+ /** #5540 — the db3 types it refs, any spelling. */
145
+ db3Edges: Array<{
146
+ location: string;
147
+ type: string;
148
+ }>;
149
+ }
150
+ /** One local function file, as the function slot reads it. */
151
+ export interface LocalFunctionFile {
152
+ key: string;
153
+ relative: string;
154
+ error: string | null;
155
+ }
156
+ /** The tree's index with its prompt and function slots. */
157
+ export interface TreePromptFamilyIndex extends TreeSchemaFamilyIndex {
158
+ prompts: Map<string, SchemaFamilyPrompt>;
159
+ functions: Map<string, SchemaFamilyFunction>;
160
+ promptLocals: LocalPromptFile[];
161
+ functionLocals: LocalFunctionFile[];
162
+ }
163
+ /** A prompt the server lists, as the index takes it: its stored compiled fields and, from the detail, their provenance. */
164
+ export interface RemotePromptRecord {
165
+ promptKey: string;
166
+ status?: string;
167
+ inputSchema?: unknown;
168
+ outputSchema?: unknown;
169
+ agent?: unknown;
170
+ provenance?: Record<string, unknown> | null;
171
+ }
172
+ /** A function the server lists: its stored compiled schemas. */
173
+ export interface RemoteFunctionRecord {
174
+ functionKey: string;
175
+ status?: string;
176
+ inputSchema?: unknown;
177
+ outputSchema?: unknown;
178
+ }
179
+ /**
180
+ * Tell the tree's index which prompts the server holds, so a ref to a prompt
181
+ * the tree does not have resolves against the server's stored schemas (and
182
+ * provenance, when the record is a detail), and one the server archived reads
183
+ * as deleted. Prompts the tree has are always read from the tree.
184
+ */
185
+ export declare function rememberRemotePrompts(configDir: string, records: readonly RemotePromptRecord[]): void;
186
+ /**
187
+ * Tell the tree's index every prompt key the server holds, archived ones
188
+ * included, as the server judges a short ref (`<key>.output`) against them:
189
+ * a server-only key then resolves to the prompt family, and a key in two
190
+ * families reads as ambiguous. A key only gives the short form its family;
191
+ * what it resolves to comes from `rememberRemotePrompts`.
192
+ */
193
+ export declare function rememberRemotePromptKeys(configDir: string, keys: readonly string[]): void;
194
+ /** As `rememberRemotePrompts`, for functions. */
195
+ export declare function rememberRemoteFunctions(configDir: string, records: readonly RemoteFunctionRecord[]): void;
196
+ /**
197
+ * Compile refs to these functions against the server's stored schemas rather
198
+ * than the tree's files: a `--only` push that does not select a function its
199
+ * prompts ref leaves the server's version in place, and the server compiles
200
+ * against that one.
201
+ */
202
+ export declare function overrideTreeFunctions(configDir: string, records: readonly RemoteFunctionRecord[]): void;
203
+ /**
204
+ * The functions behind the server tools a tree's prompt files ref, through
205
+ * another prompt's `tools.<name>` target or their own: what such a target
206
+ * resolves to.
207
+ */
208
+ export declare function promptToolFunctionsReffed(promptLocals: readonly LocalPromptFile[]): string[];
209
+ /**
210
+ * The tree's index with a prompt slot and a function slot (#5534,
211
+ * DSO-5534-009): every `functions/*.toml` compiled (the `schemas/` files
212
+ * resolved), and every `prompts/*.toml` compiled in dependency order, each
213
+ * against the prompts compiled before it, with the vendored server compiler.
214
+ * A cycle among prompts is an error on every member, naming the chain; a file
215
+ * that cannot be compiled keeps its error, and a ref to it is refused naming
216
+ * it. A prompt or function the tree lacks resolves against the server's
217
+ * records once `rememberRemotePrompts` / `rememberRemoteFunctions` have been
218
+ * told (an archived one reads as deleted), and is otherwise an error naming
219
+ * the file to pull.
220
+ *
221
+ * Memoised per process by the tree's content and what the server was said to hold.
222
+ */
223
+ export declare function loadPromptFamilyIndex(configDir: string): TreePromptFamilyIndex;
224
+ /**
225
+ * The loader a prompt compile reads the index through: one per tree for the
226
+ * process, called only when a schema writes a family-spelled ref.
227
+ */
228
+ export declare function promptFamilyIndexLoader(configDir: string): () => TreePromptFamilyIndex;