@stigmer/react 3.2.3 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/agent/steps/ReviewStep.d.ts.map +1 -1
  2. package/agent/steps/ReviewStep.js +2 -3
  3. package/agent/steps/ReviewStep.js.map +1 -1
  4. package/billing/BaselineEditor.d.ts +9 -0
  5. package/billing/BaselineEditor.d.ts.map +1 -0
  6. package/billing/BaselineEditor.js +253 -0
  7. package/billing/BaselineEditor.js.map +1 -0
  8. package/billing/ModelCatalogPanel.d.ts +28 -0
  9. package/billing/ModelCatalogPanel.d.ts.map +1 -0
  10. package/billing/ModelCatalogPanel.js +102 -0
  11. package/billing/ModelCatalogPanel.js.map +1 -0
  12. package/billing/ModelGovernanceDetail.d.ts +8 -0
  13. package/billing/ModelGovernanceDetail.d.ts.map +1 -0
  14. package/billing/ModelGovernanceDetail.js +64 -0
  15. package/billing/ModelGovernanceDetail.js.map +1 -0
  16. package/billing/OperatorAccessNotice.d.ts +12 -0
  17. package/billing/OperatorAccessNotice.d.ts.map +1 -0
  18. package/billing/OperatorAccessNotice.js +15 -0
  19. package/billing/OperatorAccessNotice.js.map +1 -0
  20. package/billing/PricingGovernanceConsole.d.ts +57 -0
  21. package/billing/PricingGovernanceConsole.d.ts.map +1 -0
  22. package/billing/PricingGovernanceConsole.js +164 -0
  23. package/billing/PricingGovernanceConsole.js.map +1 -0
  24. package/billing/PricingGovernancePanel.d.ts +26 -0
  25. package/billing/PricingGovernancePanel.d.ts.map +1 -0
  26. package/billing/PricingGovernancePanel.js +64 -0
  27. package/billing/PricingGovernancePanel.js.map +1 -0
  28. package/billing/RetireConfirm.d.ts +9 -0
  29. package/billing/RetireConfirm.d.ts.map +1 -0
  30. package/billing/RetireConfirm.js +19 -0
  31. package/billing/RetireConfirm.js.map +1 -0
  32. package/billing/form-primitives.d.ts +18 -0
  33. package/billing/form-primitives.d.ts.map +1 -0
  34. package/billing/form-primitives.js +19 -0
  35. package/billing/form-primitives.js.map +1 -0
  36. package/billing/governance-primitives.d.ts +33 -0
  37. package/billing/governance-primitives.d.ts.map +1 -0
  38. package/billing/governance-primitives.js +43 -0
  39. package/billing/governance-primitives.js.map +1 -0
  40. package/billing/index.d.ts +18 -0
  41. package/billing/index.d.ts.map +1 -1
  42. package/billing/index.js +9 -0
  43. package/billing/index.js.map +1 -1
  44. package/billing/pricing-format.d.ts +12 -0
  45. package/billing/pricing-format.d.ts.map +1 -0
  46. package/billing/pricing-format.js +50 -0
  47. package/billing/pricing-format.js.map +1 -0
  48. package/billing/useDecidePricingOverride.d.ts +46 -0
  49. package/billing/useDecidePricingOverride.d.ts.map +1 -0
  50. package/billing/useDecidePricingOverride.js +44 -0
  51. package/billing/useDecidePricingOverride.js.map +1 -0
  52. package/billing/useModelGovernanceView.d.ts +103 -0
  53. package/billing/useModelGovernanceView.d.ts.map +1 -0
  54. package/billing/useModelGovernanceView.js +144 -0
  55. package/billing/useModelGovernanceView.js.map +1 -0
  56. package/billing/useModelPricingBaselines.d.ts +40 -0
  57. package/billing/useModelPricingBaselines.d.ts.map +1 -0
  58. package/billing/useModelPricingBaselines.js +32 -0
  59. package/billing/useModelPricingBaselines.js.map +1 -0
  60. package/billing/usePricingGovernance.d.ts +39 -0
  61. package/billing/usePricingGovernance.d.ts.map +1 -0
  62. package/billing/usePricingGovernance.js +31 -0
  63. package/billing/usePricingGovernance.js.map +1 -0
  64. package/billing/useRetireModelPricingBaseline.d.ts +31 -0
  65. package/billing/useRetireModelPricingBaseline.d.ts.map +1 -0
  66. package/billing/useRetireModelPricingBaseline.js +36 -0
  67. package/billing/useRetireModelPricingBaseline.js.map +1 -0
  68. package/billing/useUpsertModelPricingBaseline.d.ts +38 -0
  69. package/billing/useUpsertModelPricingBaseline.d.ts.map +1 -0
  70. package/billing/useUpsertModelPricingBaseline.js +37 -0
  71. package/billing/useUpsertModelPricingBaseline.js.map +1 -0
  72. package/channel/AgentChannelsPanel.d.ts.map +1 -1
  73. package/channel/AgentChannelsPanel.js +11 -5
  74. package/channel/AgentChannelsPanel.js.map +1 -1
  75. package/composer/SessionComposer.d.ts +1 -1
  76. package/cursor-accounts/CursorAccountEditor.d.ts +28 -0
  77. package/cursor-accounts/CursorAccountEditor.d.ts.map +1 -0
  78. package/cursor-accounts/CursorAccountEditor.js +51 -0
  79. package/cursor-accounts/CursorAccountEditor.js.map +1 -0
  80. package/cursor-accounts/CursorAccountsAccessNotice.d.ts +11 -0
  81. package/cursor-accounts/CursorAccountsAccessNotice.d.ts.map +1 -0
  82. package/cursor-accounts/CursorAccountsAccessNotice.js +14 -0
  83. package/cursor-accounts/CursorAccountsAccessNotice.js.map +1 -0
  84. package/cursor-accounts/CursorAccountsConsole.d.ts +28 -0
  85. package/cursor-accounts/CursorAccountsConsole.d.ts.map +1 -0
  86. package/cursor-accounts/CursorAccountsConsole.js +275 -0
  87. package/cursor-accounts/CursorAccountsConsole.js.map +1 -0
  88. package/cursor-accounts/cursor-account-format.d.ts +10 -0
  89. package/cursor-accounts/cursor-account-format.d.ts.map +1 -0
  90. package/cursor-accounts/cursor-account-format.js +26 -0
  91. package/cursor-accounts/cursor-account-format.js.map +1 -0
  92. package/cursor-accounts/index.d.ts +18 -0
  93. package/cursor-accounts/index.d.ts.map +1 -0
  94. package/cursor-accounts/index.js +13 -0
  95. package/cursor-accounts/index.js.map +1 -0
  96. package/cursor-accounts/useCursorAccountView.d.ts +30 -0
  97. package/cursor-accounts/useCursorAccountView.d.ts.map +1 -0
  98. package/cursor-accounts/useCursorAccountView.js +25 -0
  99. package/cursor-accounts/useCursorAccountView.js.map +1 -0
  100. package/cursor-accounts/useCursorAccounts.d.ts +33 -0
  101. package/cursor-accounts/useCursorAccounts.d.ts.map +1 -0
  102. package/cursor-accounts/useCursorAccounts.js +25 -0
  103. package/cursor-accounts/useCursorAccounts.js.map +1 -0
  104. package/cursor-accounts/useCursorMemberKeyActions.d.ts +49 -0
  105. package/cursor-accounts/useCursorMemberKeyActions.d.ts.map +1 -0
  106. package/cursor-accounts/useCursorMemberKeyActions.js +38 -0
  107. package/cursor-accounts/useCursorMemberKeyActions.js.map +1 -0
  108. package/cursor-accounts/useDeleteCursorAccount.d.ts +30 -0
  109. package/cursor-accounts/useDeleteCursorAccount.d.ts.map +1 -0
  110. package/cursor-accounts/useDeleteCursorAccount.js +32 -0
  111. package/cursor-accounts/useDeleteCursorAccount.js.map +1 -0
  112. package/cursor-accounts/useSyncCursorAccount.d.ts +23 -0
  113. package/cursor-accounts/useSyncCursorAccount.d.ts.map +1 -0
  114. package/cursor-accounts/useSyncCursorAccount.js +31 -0
  115. package/cursor-accounts/useSyncCursorAccount.js.map +1 -0
  116. package/cursor-accounts/useUpsertCursorAccount.d.ts +26 -0
  117. package/cursor-accounts/useUpsertCursorAccount.d.ts.map +1 -0
  118. package/cursor-accounts/useUpsertCursorAccount.js +34 -0
  119. package/cursor-accounts/useUpsertCursorAccount.js.map +1 -0
  120. package/datastore/CollectionRecordsBrowser.d.ts +34 -0
  121. package/datastore/CollectionRecordsBrowser.d.ts.map +1 -0
  122. package/datastore/CollectionRecordsBrowser.js +209 -0
  123. package/datastore/CollectionRecordsBrowser.js.map +1 -0
  124. package/datastore/CollectionSchemaView.d.ts +29 -0
  125. package/datastore/CollectionSchemaView.d.ts.map +1 -0
  126. package/datastore/CollectionSchemaView.js +93 -0
  127. package/datastore/CollectionSchemaView.js.map +1 -0
  128. package/datastore/DatastoreDetailView.d.ts +44 -0
  129. package/datastore/DatastoreDetailView.d.ts.map +1 -0
  130. package/datastore/DatastoreDetailView.js +76 -0
  131. package/datastore/DatastoreDetailView.js.map +1 -0
  132. package/datastore/DatastoreSyncReport.d.ts +19 -0
  133. package/datastore/DatastoreSyncReport.d.ts.map +1 -0
  134. package/datastore/DatastoreSyncReport.js +45 -0
  135. package/datastore/DatastoreSyncReport.js.map +1 -0
  136. package/datastore/DeleteDatastoreDialog.d.ts +35 -0
  137. package/datastore/DeleteDatastoreDialog.d.ts.map +1 -0
  138. package/datastore/DeleteDatastoreDialog.js +90 -0
  139. package/datastore/DeleteDatastoreDialog.js.map +1 -0
  140. package/datastore/FieldValueControl.d.ts +55 -0
  141. package/datastore/FieldValueControl.d.ts.map +1 -0
  142. package/datastore/FieldValueControl.js +138 -0
  143. package/datastore/FieldValueControl.js.map +1 -0
  144. package/datastore/RecordFilterBuilder.d.ts +30 -0
  145. package/datastore/RecordFilterBuilder.d.ts.map +1 -0
  146. package/datastore/RecordFilterBuilder.js +122 -0
  147. package/datastore/RecordFilterBuilder.js.map +1 -0
  148. package/datastore/RecordFormPanel.d.ts +45 -0
  149. package/datastore/RecordFormPanel.d.ts.map +1 -0
  150. package/datastore/RecordFormPanel.js +215 -0
  151. package/datastore/RecordFormPanel.js.map +1 -0
  152. package/datastore/index.d.ts +43 -0
  153. package/datastore/index.d.ts.map +1 -0
  154. package/datastore/index.js +22 -0
  155. package/datastore/index.js.map +1 -0
  156. package/datastore/recordFilter.d.ts +54 -0
  157. package/datastore/recordFilter.d.ts.map +1 -0
  158. package/datastore/recordFilter.js +93 -0
  159. package/datastore/recordFilter.js.map +1 -0
  160. package/datastore/recordValues.d.ts +85 -0
  161. package/datastore/recordValues.d.ts.map +1 -0
  162. package/datastore/recordValues.js +282 -0
  163. package/datastore/recordValues.js.map +1 -0
  164. package/datastore/useDatastore.d.ts +39 -0
  165. package/datastore/useDatastore.d.ts.map +1 -0
  166. package/datastore/useDatastore.js +44 -0
  167. package/datastore/useDatastore.js.map +1 -0
  168. package/datastore/useDatastoreCount.d.ts +48 -0
  169. package/datastore/useDatastoreCount.d.ts.map +1 -0
  170. package/datastore/useDatastoreCount.js +27 -0
  171. package/datastore/useDatastoreCount.js.map +1 -0
  172. package/datastore/useDatastoreDescription.d.ts +54 -0
  173. package/datastore/useDatastoreDescription.d.ts.map +1 -0
  174. package/datastore/useDatastoreDescription.js +50 -0
  175. package/datastore/useDatastoreDescription.js.map +1 -0
  176. package/datastore/useDatastoreList.d.ts +57 -0
  177. package/datastore/useDatastoreList.d.ts.map +1 -0
  178. package/datastore/useDatastoreList.js +29 -0
  179. package/datastore/useDatastoreList.js.map +1 -0
  180. package/datastore/useDatastoreSearch.d.ts +19 -0
  181. package/datastore/useDatastoreSearch.d.ts.map +1 -0
  182. package/datastore/useDatastoreSearch.js +22 -0
  183. package/datastore/useDatastoreSearch.js.map +1 -0
  184. package/datastore/useDeleteDatastore.d.ts +53 -0
  185. package/datastore/useDeleteDatastore.d.ts.map +1 -0
  186. package/datastore/useDeleteDatastore.js +40 -0
  187. package/datastore/useDeleteDatastore.js.map +1 -0
  188. package/datastore/useDeleteRecord.d.ts +34 -0
  189. package/datastore/useDeleteRecord.d.ts.map +1 -0
  190. package/datastore/useDeleteRecord.js +43 -0
  191. package/datastore/useDeleteRecord.js.map +1 -0
  192. package/datastore/useInsertRecord.d.ts +50 -0
  193. package/datastore/useInsertRecord.d.ts.map +1 -0
  194. package/datastore/useInsertRecord.js +55 -0
  195. package/datastore/useInsertRecord.js.map +1 -0
  196. package/datastore/useRecordCollection.d.ts +104 -0
  197. package/datastore/useRecordCollection.d.ts.map +1 -0
  198. package/datastore/useRecordCollection.js +136 -0
  199. package/datastore/useRecordCollection.js.map +1 -0
  200. package/datastore/useRecordList.d.ts +66 -0
  201. package/datastore/useRecordList.d.ts.map +1 -0
  202. package/datastore/useRecordList.js +58 -0
  203. package/datastore/useRecordList.js.map +1 -0
  204. package/datastore/useUpdateRecord.d.ts +52 -0
  205. package/datastore/useUpdateRecord.d.ts.map +1 -0
  206. package/datastore/useUpdateRecord.js +55 -0
  207. package/datastore/useUpdateRecord.js.map +1 -0
  208. package/environment/EnvironmentListPanel.d.ts.map +1 -1
  209. package/environment/EnvironmentListPanel.js +12 -7
  210. package/environment/EnvironmentListPanel.js.map +1 -1
  211. package/iam-policy/index.d.ts +1 -1
  212. package/iam-policy/index.d.ts.map +1 -1
  213. package/iam-policy/index.js.map +1 -1
  214. package/iam-policy/useCheckPermission.d.ts +32 -11
  215. package/iam-policy/useCheckPermission.d.ts.map +1 -1
  216. package/iam-policy/useCheckPermission.js +24 -19
  217. package/iam-policy/useCheckPermission.js.map +1 -1
  218. package/index.d.ts +12 -6
  219. package/index.d.ts.map +1 -1
  220. package/index.js +14 -3
  221. package/index.js.map +1 -1
  222. package/library/index.d.ts +0 -7
  223. package/library/index.d.ts.map +1 -1
  224. package/library/index.js +0 -4
  225. package/library/index.js.map +1 -1
  226. package/library/useApplyResource.d.ts +12 -12
  227. package/library/useApplyResource.d.ts.map +1 -1
  228. package/library/useApplyResource.js +16 -25
  229. package/library/useApplyResource.js.map +1 -1
  230. package/library/useExportResource.d.ts +13 -9
  231. package/library/useExportResource.d.ts.map +1 -1
  232. package/library/useExportResource.js +18 -36
  233. package/library/useExportResource.js.map +1 -1
  234. package/manifest/ApplyManifestDialog.d.ts +48 -0
  235. package/manifest/ApplyManifestDialog.d.ts.map +1 -0
  236. package/manifest/ApplyManifestDialog.js +135 -0
  237. package/manifest/ApplyManifestDialog.js.map +1 -0
  238. package/manifest/EditResourceYamlDialog.d.ts +51 -0
  239. package/manifest/EditResourceYamlDialog.d.ts.map +1 -0
  240. package/manifest/EditResourceYamlDialog.js +104 -0
  241. package/manifest/EditResourceYamlDialog.js.map +1 -0
  242. package/manifest/RedactedSecretsNotice.d.ts +14 -0
  243. package/manifest/RedactedSecretsNotice.d.ts.map +1 -0
  244. package/manifest/RedactedSecretsNotice.js +14 -0
  245. package/manifest/RedactedSecretsNotice.js.map +1 -0
  246. package/manifest/YamlEditor.d.ts +44 -0
  247. package/manifest/YamlEditor.d.ts.map +1 -0
  248. package/manifest/YamlEditor.js +216 -0
  249. package/manifest/YamlEditor.js.map +1 -0
  250. package/manifest/index.d.ts +13 -0
  251. package/manifest/index.d.ts.map +1 -0
  252. package/manifest/index.js +13 -0
  253. package/manifest/index.js.map +1 -0
  254. package/manifest/useApplyManifest.d.ts +82 -0
  255. package/manifest/useApplyManifest.d.ts.map +1 -0
  256. package/manifest/useApplyManifest.js +180 -0
  257. package/manifest/useApplyManifest.js.map +1 -0
  258. package/manifest/useEditResourceYaml.d.ts +106 -0
  259. package/manifest/useEditResourceYaml.d.ts.map +1 -0
  260. package/manifest/useEditResourceYaml.js +168 -0
  261. package/manifest/useEditResourceYaml.js.map +1 -0
  262. package/mcp-server/steps/ReviewStep.d.ts.map +1 -1
  263. package/mcp-server/steps/ReviewStep.js +2 -3
  264. package/mcp-server/steps/ReviewStep.js.map +1 -1
  265. package/package.json +4 -4
  266. package/resource-creation/templates/workflow-templates.js +4 -4
  267. package/session/useEditSessionPrep.js +3 -3
  268. package/session/useEditSessionPrep.js.map +1 -1
  269. package/settings/index.d.ts +2 -1
  270. package/settings/index.d.ts.map +1 -1
  271. package/settings/index.js +2 -1
  272. package/settings/index.js.map +1 -1
  273. package/settings/settings-nav.d.ts +22 -0
  274. package/settings/settings-nav.d.ts.map +1 -1
  275. package/settings/settings-nav.js +32 -1
  276. package/settings/settings-nav.js.map +1 -1
  277. package/settings/useSettingsNavGroups.d.ts +29 -0
  278. package/settings/useSettingsNavGroups.d.ts.map +1 -0
  279. package/settings/useSettingsNavGroups.js +61 -0
  280. package/settings/useSettingsNavGroups.js.map +1 -0
  281. package/src/agent/steps/ReviewStep.tsx +2 -3
  282. package/src/billing/BaselineEditor.tsx +619 -0
  283. package/src/billing/ModelCatalogPanel.tsx +283 -0
  284. package/src/billing/ModelGovernanceDetail.tsx +289 -0
  285. package/src/billing/OperatorAccessNotice.tsx +32 -0
  286. package/src/billing/PricingGovernanceConsole.tsx +465 -0
  287. package/src/billing/PricingGovernancePanel.tsx +166 -0
  288. package/src/billing/RetireConfirm.tsx +82 -0
  289. package/src/billing/__tests__/ModelCatalogPanel.test.tsx +253 -0
  290. package/src/billing/__tests__/PricingGovernanceConsole.test.tsx +410 -0
  291. package/src/billing/__tests__/useModelGovernanceView.test.tsx +308 -0
  292. package/src/billing/form-primitives.tsx +68 -0
  293. package/src/billing/governance-primitives.tsx +133 -0
  294. package/src/billing/index.ts +37 -0
  295. package/src/billing/pricing-format.ts +53 -0
  296. package/src/billing/useDecidePricingOverride.ts +78 -0
  297. package/src/billing/useModelGovernanceView.ts +290 -0
  298. package/src/billing/useModelPricingBaselines.ts +69 -0
  299. package/src/billing/usePricingGovernance.ts +57 -0
  300. package/src/billing/useRetireModelPricingBaseline.ts +65 -0
  301. package/src/billing/useUpsertModelPricingBaseline.ts +72 -0
  302. package/src/channel/AgentChannelsPanel.tsx +27 -1
  303. package/src/composer/SessionComposer.tsx +1 -1
  304. package/src/cursor-accounts/CursorAccountEditor.tsx +181 -0
  305. package/src/cursor-accounts/CursorAccountsAccessNotice.tsx +36 -0
  306. package/src/cursor-accounts/CursorAccountsConsole.tsx +810 -0
  307. package/src/cursor-accounts/__tests__/CursorAccountsConsole.test.tsx +384 -0
  308. package/src/cursor-accounts/cursor-account-format.ts +29 -0
  309. package/src/cursor-accounts/index.ts +29 -0
  310. package/src/cursor-accounts/useCursorAccountView.ts +49 -0
  311. package/src/cursor-accounts/useCursorAccounts.ts +49 -0
  312. package/src/cursor-accounts/useCursorMemberKeyActions.ts +106 -0
  313. package/src/cursor-accounts/useDeleteCursorAccount.ts +62 -0
  314. package/src/cursor-accounts/useSyncCursorAccount.ts +54 -0
  315. package/src/cursor-accounts/useUpsertCursorAccount.ts +57 -0
  316. package/src/datastore/CollectionRecordsBrowser.tsx +544 -0
  317. package/src/datastore/CollectionSchemaView.tsx +247 -0
  318. package/src/datastore/DatastoreDetailView.tsx +201 -0
  319. package/src/datastore/DatastoreSyncReport.tsx +105 -0
  320. package/src/datastore/DeleteDatastoreDialog.tsx +202 -0
  321. package/src/datastore/FieldValueControl.tsx +289 -0
  322. package/src/datastore/RecordFilterBuilder.tsx +411 -0
  323. package/src/datastore/RecordFormPanel.tsx +432 -0
  324. package/src/datastore/__tests__/CollectionRecordsBrowser.test.tsx +207 -0
  325. package/src/datastore/__tests__/DeleteDatastoreDialog.test.tsx +133 -0
  326. package/src/datastore/__tests__/FieldValueControl.test.tsx +160 -0
  327. package/src/datastore/__tests__/RecordFilterBuilder.test.tsx +141 -0
  328. package/src/datastore/__tests__/RecordFormPanel.test.tsx +227 -0
  329. package/src/datastore/__tests__/recordFilter.test.ts +156 -0
  330. package/src/datastore/__tests__/recordMutations.test.tsx +195 -0
  331. package/src/datastore/__tests__/recordValues.test.ts +359 -0
  332. package/src/datastore/__tests__/schemaAndSyncViews.test.tsx +142 -0
  333. package/src/datastore/__tests__/useDatastoreDescription.test.tsx +143 -0
  334. package/src/datastore/__tests__/useRecordCollection.test.tsx +250 -0
  335. package/src/datastore/__tests__/useRecordList.test.tsx +85 -0
  336. package/src/datastore/index.ts +111 -0
  337. package/src/datastore/recordFilter.ts +140 -0
  338. package/src/datastore/recordValues.ts +327 -0
  339. package/src/datastore/useDatastore.ts +67 -0
  340. package/src/datastore/useDatastoreCount.ts +67 -0
  341. package/src/datastore/useDatastoreDescription.ts +90 -0
  342. package/src/datastore/useDatastoreList.ts +79 -0
  343. package/src/datastore/useDatastoreSearch.ts +39 -0
  344. package/src/datastore/useDeleteDatastore.ts +87 -0
  345. package/src/datastore/useDeleteRecord.ts +77 -0
  346. package/src/datastore/useInsertRecord.ts +92 -0
  347. package/src/datastore/useRecordCollection.ts +256 -0
  348. package/src/datastore/useRecordList.ts +131 -0
  349. package/src/datastore/useUpdateRecord.ts +95 -0
  350. package/src/environment/EnvironmentListPanel.tsx +24 -0
  351. package/src/execution/__tests__/useArtifactInspection.test.tsx +12 -2
  352. package/src/iam-policy/__tests__/useCheckPermission.test.tsx +221 -0
  353. package/src/iam-policy/index.ts +1 -0
  354. package/src/iam-policy/useCheckPermission.ts +45 -19
  355. package/src/index.ts +163 -13
  356. package/src/library/index.ts +0 -20
  357. package/src/library/useApplyResource.ts +27 -34
  358. package/src/library/useExportResource.ts +21 -40
  359. package/src/manifest/ApplyManifestDialog.tsx +315 -0
  360. package/src/manifest/EditResourceYamlDialog.tsx +265 -0
  361. package/src/manifest/RedactedSecretsNotice.tsx +30 -0
  362. package/src/manifest/YamlEditor.tsx +272 -0
  363. package/src/manifest/__tests__/EditResourceYamlDialog.test.tsx +118 -0
  364. package/src/manifest/__tests__/useApplyManifest.test.tsx +237 -0
  365. package/src/manifest/__tests__/useEditResourceYaml.test.tsx +252 -0
  366. package/src/manifest/index.ts +33 -0
  367. package/src/manifest/useApplyManifest.ts +270 -0
  368. package/src/manifest/useEditResourceYaml.ts +273 -0
  369. package/src/mcp-server/steps/ReviewStep.tsx +2 -3
  370. package/src/resource-creation/templates/workflow-templates.ts +4 -4
  371. package/src/session/useEditSessionPrep.ts +3 -3
  372. package/src/settings/__tests__/useSettingsNavGroups.test.tsx +138 -0
  373. package/src/settings/index.ts +5 -1
  374. package/src/settings/settings-nav.ts +43 -0
  375. package/src/settings/useSettingsNavGroups.ts +81 -0
  376. package/src/workflow/WorkflowYamlEditor.tsx +6 -270
  377. package/styles.css +1 -1
  378. package/workflow/CanvasTransitionEdge.d.ts +1 -1
  379. package/workflow/WorkflowYamlEditor.d.ts +2 -42
  380. package/workflow/WorkflowYamlEditor.d.ts.map +1 -1
  381. package/workflow/WorkflowYamlEditor.js +5 -214
  382. package/workflow/WorkflowYamlEditor.js.map +1 -1
  383. package/library/ImportResourceDialog.d.ts +0 -43
  384. package/library/ImportResourceDialog.d.ts.map +0 -1
  385. package/library/ImportResourceDialog.js +0 -90
  386. package/library/ImportResourceDialog.js.map +0 -1
  387. package/library/parse-resource-yaml.d.ts +0 -63
  388. package/library/parse-resource-yaml.d.ts.map +0 -1
  389. package/library/parse-resource-yaml.js +0 -407
  390. package/library/parse-resource-yaml.js.map +0 -1
  391. package/library/serialize-resource-yaml.d.ts +0 -103
  392. package/library/serialize-resource-yaml.d.ts.map +0 -1
  393. package/library/serialize-resource-yaml.js +0 -565
  394. package/library/serialize-resource-yaml.js.map +0 -1
  395. package/library/useImportResource.d.ts +0 -84
  396. package/library/useImportResource.d.ts.map +0 -1
  397. package/library/useImportResource.js +0 -188
  398. package/library/useImportResource.js.map +0 -1
  399. package/src/library/ImportResourceDialog.tsx +0 -227
  400. package/src/library/parse-resource-yaml.ts +0 -630
  401. package/src/library/serialize-resource-yaml.ts +0 -756
  402. package/src/library/useImportResource.ts +0 -253
@@ -0,0 +1,43 @@
1
+ export { useDatastore } from "./useDatastore.js";
2
+ export type { UseDatastoreReturn } from "./useDatastore.js";
3
+ export { useDatastoreList } from "./useDatastoreList.js";
4
+ export type { UseDatastoreListOptions, UseDatastoreListReturn, } from "./useDatastoreList.js";
5
+ export { useDatastoreCount } from "./useDatastoreCount.js";
6
+ export type { UseDatastoreCountOptions, UseDatastoreCountReturn, } from "./useDatastoreCount.js";
7
+ export { useDatastoreSearch } from "./useDatastoreSearch.js";
8
+ export type { UseDatastoreSearchOptions, UseDatastoreSearchReturn, } from "./useDatastoreSearch.js";
9
+ export { useDatastoreDescription, DEFAULT_PARTITION } from "./useDatastoreDescription.js";
10
+ export type { UseDatastoreDescriptionReturn } from "./useDatastoreDescription.js";
11
+ export { useRecordList } from "./useRecordList.js";
12
+ export type { RecordScope, UseRecordListParams, UseRecordListReturn, } from "./useRecordList.js";
13
+ export { useInsertRecord } from "./useInsertRecord.js";
14
+ export type { InsertRecordArgs, UseInsertRecordReturn, } from "./useInsertRecord.js";
15
+ export { useUpdateRecord } from "./useUpdateRecord.js";
16
+ export type { UpdateRecordArgs, UseUpdateRecordReturn, } from "./useUpdateRecord.js";
17
+ export { useDeleteRecord } from "./useDeleteRecord.js";
18
+ export type { DeleteRecordArgs, UseDeleteRecordReturn, } from "./useDeleteRecord.js";
19
+ export { useRecordCollection } from "./useRecordCollection.js";
20
+ export type { RecordColumnDef, UseRecordCollectionOptions, UseRecordCollectionReturn, } from "./useRecordCollection.js";
21
+ export { useDeleteDatastore } from "./useDeleteDatastore.js";
22
+ export type { DeleteDatastoreArgs, UseDeleteDatastoreReturn, } from "./useDeleteDatastore.js";
23
+ export { buildUpdateFields, coerceFieldValue, formatFieldValue, formatSystemTimestamp, isListOperator, isSortableField, isValuelessOperator, operatorsForField, OPERATOR_LABELS, RESERVED_FIELD_NAMES, SYSTEM_FIELD_OPERATORS, } from "./recordValues.js";
24
+ export type { CoerceResult } from "./recordValues.js";
25
+ export { buildRecordFilter, filterableFields, formatConditionChip, isConditionComplete, } from "./recordFilter.js";
26
+ export type { FilterableField, RecordConditionDraft } from "./recordFilter.js";
27
+ export { FieldValueControl, FIELD_INPUT_CLASSES } from "./FieldValueControl.js";
28
+ export type { FieldValueControlProps } from "./FieldValueControl.js";
29
+ export { CollectionSchemaView, formatSubject } from "./CollectionSchemaView.js";
30
+ export type { CollectionSchemaViewProps } from "./CollectionSchemaView.js";
31
+ export { DatastoreSyncReport } from "./DatastoreSyncReport.js";
32
+ export type { DatastoreSyncReportProps } from "./DatastoreSyncReport.js";
33
+ export { RecordFilterBuilder } from "./RecordFilterBuilder.js";
34
+ export type { RecordFilterBuilderProps } from "./RecordFilterBuilder.js";
35
+ export { RecordFormPanel } from "./RecordFormPanel.js";
36
+ export type { RecordFormPanelProps } from "./RecordFormPanel.js";
37
+ export { CollectionRecordsBrowser } from "./CollectionRecordsBrowser.js";
38
+ export type { CollectionRecordsBrowserProps } from "./CollectionRecordsBrowser.js";
39
+ export { DeleteDatastoreDialog } from "./DeleteDatastoreDialog.js";
40
+ export type { DeleteDatastoreDialogProps } from "./DeleteDatastoreDialog.js";
41
+ export { DatastoreDetailView, DatastoreIcon } from "./DatastoreDetailView.js";
42
+ export type { DatastoreDetailTab, DatastoreDetailViewProps, } from "./DatastoreDetailView.js";
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/datastore/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;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BAA0B,CAAC"}
@@ -0,0 +1,22 @@
1
+ export { useDatastore } from "./useDatastore.js";
2
+ export { useDatastoreList } from "./useDatastoreList.js";
3
+ export { useDatastoreCount } from "./useDatastoreCount.js";
4
+ export { useDatastoreSearch } from "./useDatastoreSearch.js";
5
+ export { useDatastoreDescription, DEFAULT_PARTITION } from "./useDatastoreDescription.js";
6
+ export { useRecordList } from "./useRecordList.js";
7
+ export { useInsertRecord } from "./useInsertRecord.js";
8
+ export { useUpdateRecord } from "./useUpdateRecord.js";
9
+ export { useDeleteRecord } from "./useDeleteRecord.js";
10
+ export { useRecordCollection } from "./useRecordCollection.js";
11
+ export { useDeleteDatastore } from "./useDeleteDatastore.js";
12
+ export { buildUpdateFields, coerceFieldValue, formatFieldValue, formatSystemTimestamp, isListOperator, isSortableField, isValuelessOperator, operatorsForField, OPERATOR_LABELS, RESERVED_FIELD_NAMES, SYSTEM_FIELD_OPERATORS, } from "./recordValues.js";
13
+ export { buildRecordFilter, filterableFields, formatConditionChip, isConditionComplete, } from "./recordFilter.js";
14
+ export { FieldValueControl, FIELD_INPUT_CLASSES } from "./FieldValueControl.js";
15
+ export { CollectionSchemaView, formatSubject } from "./CollectionSchemaView.js";
16
+ export { DatastoreSyncReport } from "./DatastoreSyncReport.js";
17
+ export { RecordFilterBuilder } from "./RecordFilterBuilder.js";
18
+ export { RecordFormPanel } from "./RecordFormPanel.js";
19
+ export { CollectionRecordsBrowser } from "./CollectionRecordsBrowser.js";
20
+ export { DeleteDatastoreDialog } from "./DeleteDatastoreDialog.js";
21
+ export { DatastoreDetailView, DatastoreIcon } from "./DatastoreDetailView.js";
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/datastore/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAMzD,OAA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"}
@@ -0,0 +1,54 @@
1
+ import { type JsonValue } from "@bufbuild/protobuf";
2
+ import { RecordConditionOp, type RecordFilter } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
3
+ import { FieldType, type CollectionDeclaration, type FieldDeclaration } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/spec_pb";
4
+ /**
5
+ * One draft condition in the filter builder — the client-side twin of
6
+ * the proto `RecordCondition`, with plain JSON values (converted to
7
+ * `google.protobuf.Value` only at request-build time).
8
+ */
9
+ export interface RecordConditionDraft {
10
+ /** Declared field name, or a filterable system field (`id`, `created_at`, `updated_at`). */
11
+ readonly field: string;
12
+ /** Comparison operator — must be admitted by the field's operator set. */
13
+ readonly op: RecordConditionOp;
14
+ /** Scalar comparison value. Absent for `is_null`/`not_null` and list operators. */
15
+ readonly value?: JsonValue;
16
+ /** Comparison values for `is_in`/`not_in`. */
17
+ readonly values?: readonly JsonValue[];
18
+ }
19
+ /**
20
+ * A field the builder can offer: a declared filterable field or a
21
+ * filterable system field, with the exact operator set the server
22
+ * admits for it.
23
+ */
24
+ export interface FilterableField {
25
+ readonly name: string;
26
+ /** The declaration, or `undefined` for system fields. */
27
+ readonly declaration?: FieldDeclaration;
28
+ /** The field type driving the value control (system fields use fixed types). */
29
+ readonly type: FieldType;
30
+ readonly operators: readonly RecordConditionOp[];
31
+ }
32
+ /**
33
+ * The fields a collection's filter builder offers: declared filterable
34
+ * fields (json is not filterable) followed by the filterable system
35
+ * fields. `id` conditions take string values; the audit timestamps take
36
+ * RFC 3339 timestamps — both ride the `timestamp`/`string` value
37
+ * controls.
38
+ */
39
+ export declare function filterableFields(collection: CollectionDeclaration): FilterableField[];
40
+ /**
41
+ * Whether a draft is complete enough to serve: value-less operators
42
+ * need nothing, list operators need at least one value, scalar
43
+ * operators need a value.
44
+ */
45
+ export declare function isConditionComplete(draft: RecordConditionDraft): boolean;
46
+ /**
47
+ * Build the proto `RecordFilter` from complete drafts. Returns
48
+ * `undefined` for an empty set (an absent filter, not an empty one, is
49
+ * the RPC's "no filter").
50
+ */
51
+ export declare function buildRecordFilter(conditions: readonly RecordConditionDraft[]): RecordFilter | undefined;
52
+ /** Chip text for an active condition, e.g. `status = confirmed` or `notes is empty`. */
53
+ export declare function formatConditionChip(draft: RecordConditionDraft): string;
54
+ //# sourceMappingURL=recordFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordFilter.d.ts","sourceRoot":"","sources":["../../src/datastore/recordFilter.ts"],"names":[],"mappings":"AAWA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EACL,iBAAiB,EAGjB,KAAK,YAAY,EAClB,MAAM,8DAA8D,CAAC;AACtE,OAAO,EACL,SAAS,EACT,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,yDAAyD,CAAC;AASjE;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;IAC/B,mFAAmF;IACnF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IACxC,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,qBAAqB,GAAG,eAAe,EAAE,CAqBrF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAKxE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,SAAS,oBAAoB,EAAE,GAC1C,YAAY,GAAG,SAAS,CAa1B;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAOvE"}
@@ -0,0 +1,93 @@
1
+ // The records-specific filter model (DD-008 SD-3) — typed 1:1 against
2
+ // `RecordConditionOp`.
3
+ //
4
+ // Deliberately NOT the workbench `FilterDef`/`FilterValue` model: its
5
+ // `string | string[]` value shape cannot carry typed values or
6
+ // value-less null operators, and its operator set includes `contains`,
7
+ // which `findRecords` cannot serve. Welding a server-grammar contract
8
+ // onto a client-filter model would couple two contracts that evolve
9
+ // independently — so this model mirrors the RPC grammar exactly and can
10
+ // express nothing the RPC cannot serve (DD-008 invariant 2).
11
+ import { create, fromJson } from "@bufbuild/protobuf";
12
+ import { ValueSchema } from "@bufbuild/protobuf/wkt";
13
+ import { RecordConditionOp, RecordConditionSchema, RecordFilterSchema, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
14
+ import { FieldType, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/spec_pb";
15
+ import { isListOperator, isValuelessOperator, OPERATOR_LABELS, SYSTEM_FIELD_OPERATORS, operatorsForField, } from "./recordValues.js";
16
+ /**
17
+ * The fields a collection's filter builder offers: declared filterable
18
+ * fields (json is not filterable) followed by the filterable system
19
+ * fields. `id` conditions take string values; the audit timestamps take
20
+ * RFC 3339 timestamps — both ride the `timestamp`/`string` value
21
+ * controls.
22
+ */
23
+ export function filterableFields(collection) {
24
+ const declared = [];
25
+ for (const field of collection.fields) {
26
+ const operators = operatorsForField(field);
27
+ if (operators.length === 0)
28
+ continue; // json — not filterable
29
+ declared.push({ name: field.name, declaration: field, type: field.type, operators });
30
+ }
31
+ return [
32
+ ...declared,
33
+ { name: "id", type: FieldType.string, operators: SYSTEM_FIELD_OPERATORS.get("id") },
34
+ {
35
+ name: "created_at",
36
+ type: FieldType.timestamp,
37
+ operators: SYSTEM_FIELD_OPERATORS.get("created_at"),
38
+ },
39
+ {
40
+ name: "updated_at",
41
+ type: FieldType.timestamp,
42
+ operators: SYSTEM_FIELD_OPERATORS.get("updated_at"),
43
+ },
44
+ ];
45
+ }
46
+ /**
47
+ * Whether a draft is complete enough to serve: value-less operators
48
+ * need nothing, list operators need at least one value, scalar
49
+ * operators need a value.
50
+ */
51
+ export function isConditionComplete(draft) {
52
+ if (draft.op === RecordConditionOp.record_condition_op_unspecified)
53
+ return false;
54
+ if (isValuelessOperator(draft.op))
55
+ return true;
56
+ if (isListOperator(draft.op))
57
+ return (draft.values?.length ?? 0) > 0;
58
+ return draft.value !== undefined;
59
+ }
60
+ /**
61
+ * Build the proto `RecordFilter` from complete drafts. Returns
62
+ * `undefined` for an empty set (an absent filter, not an empty one, is
63
+ * the RPC's "no filter").
64
+ */
65
+ export function buildRecordFilter(conditions) {
66
+ const complete = conditions.filter(isConditionComplete);
67
+ if (complete.length === 0)
68
+ return undefined;
69
+ return create(RecordFilterSchema, {
70
+ conditions: complete.map((draft) => create(RecordConditionSchema, {
71
+ field: draft.field,
72
+ op: draft.op,
73
+ value: draft.value !== undefined ? fromJson(ValueSchema, draft.value) : undefined,
74
+ values: (draft.values ?? []).map((v) => fromJson(ValueSchema, v)),
75
+ })),
76
+ });
77
+ }
78
+ /** Chip text for an active condition, e.g. `status = confirmed` or `notes is empty`. */
79
+ export function formatConditionChip(draft) {
80
+ const op = OPERATOR_LABELS.get(draft.op) ?? "?";
81
+ if (isValuelessOperator(draft.op))
82
+ return `${draft.field} ${op}`;
83
+ if (isListOperator(draft.op)) {
84
+ return `${draft.field} ${op} [${(draft.values ?? []).map(formatChipValue).join(", ")}]`;
85
+ }
86
+ return `${draft.field} ${op} ${formatChipValue(draft.value)}`;
87
+ }
88
+ function formatChipValue(value) {
89
+ if (value === undefined || value === null)
90
+ return "";
91
+ return typeof value === "string" ? value : JSON.stringify(value);
92
+ }
93
+ //# sourceMappingURL=recordFilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordFilter.js","sourceRoot":"","sources":["../../src/datastore/recordFilter.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,uBAAuB;AACvB,EAAE;AACF,sEAAsE;AACtE,+DAA+D;AAC/D,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,wEAAwE;AACxE,6DAA6D;AAE7D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GAEnB,MAAM,8DAA8D,CAAC;AACtE,OAAO,EACL,SAAS,GAGV,MAAM,yDAAyD,CAAC;AACjE,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAgC3B;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAiC;IAChE,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS,CAAC,wBAAwB;QAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,OAAO;QACL,GAAG,QAAQ;QACX,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,MAA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/spec_pb";
3
+ import { RecordConditionOp } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
4
+ /**
5
+ * Record-envelope system field names (plus the cloud tenancy column and
6
+ * the DD-010 partition label). Never declarable, never caller-writable.
7
+ */
8
+ export declare const RESERVED_FIELD_NAMES: ReadonlySet<string>;
9
+ /** Result of {@link coerceFieldValue}: a canonical value or a field-level message. */
10
+ export type CoerceResult = {
11
+ readonly ok: true;
12
+ readonly value: JsonValue | null;
13
+ } | {
14
+ readonly ok: false;
15
+ readonly error: string;
16
+ };
17
+ /**
18
+ * Validate a caller-supplied field value against its declaration and
19
+ * return the canonical JSON encoding (see module doc). `null` means
20
+ * explicit null — valid here for any field; required-ness is write-path
21
+ * policy (updates only see the supplied subset), exactly as in the
22
+ * server's CanonicalizeValue.
23
+ *
24
+ * Error messages match the server's shape (`field "x" must be …`) so a
25
+ * client-side rejection reads the same as the server rejection it
26
+ * pre-empts.
27
+ */
28
+ export declare function coerceFieldValue(field: FieldDeclaration, value: JsonValue | null): CoerceResult;
29
+ /**
30
+ * Format a canonical field value for grid-cell display. Values render
31
+ * in their DD-004 canonical encodings (honest, timezone-free); the one
32
+ * concession to readability is trimming a timestamp's zero fractional
33
+ * seconds (storage pads to nine digits for lexicographic ordering —
34
+ * "…T04:30:00.000000000Z" and "…T04:30:00Z" are the same RFC 3339 UTC
35
+ * instant).
36
+ */
37
+ export declare function formatFieldValue(type: FieldType, value: JsonValue | null | undefined): string;
38
+ /** Also used for the envelope's created_at/updated_at system columns. */
39
+ export declare function formatSystemTimestamp(value: string): string;
40
+ /**
41
+ * The per-type operator matrix (record_io.proto @internal, DD-005 SD-2)
42
+ * — a projection of the server's opsForFieldType. The filter builder
43
+ * offers exactly these, making an unservable operator structurally
44
+ * unofferable (DD-008 invariant 2):
45
+ *
46
+ * string (incl. enum): eq, neq, is_in, not_in
47
+ * bool: eq, neq
48
+ * integer, number,
49
+ * timestamp, date, time: eq, neq, gt, gte, lt, lte
50
+ * json: not filterable
51
+ * + is_null / not_null on any optional (non-required) field
52
+ */
53
+ export declare function operatorsForField(field: FieldDeclaration): RecordConditionOp[];
54
+ /**
55
+ * The filterable system fields and their operator sets (mirrors the
56
+ * server's buildSystemCondition): `id` by identity, the audit
57
+ * timestamps by range. `created_by`, `org`, and `partition` are not
58
+ * filterable — attribution is the grant system's privacy boundary and
59
+ * partition is ambient scope, never data.
60
+ */
61
+ export declare const SYSTEM_FIELD_OPERATORS: ReadonlyMap<string, readonly RecordConditionOp[]>;
62
+ /** Operators that take no value (null tests). */
63
+ export declare function isValuelessOperator(op: RecordConditionOp): boolean;
64
+ /** Operators that take a value list (`values`) rather than a scalar. */
65
+ export declare function isListOperator(op: RecordConditionOp): boolean;
66
+ /**
67
+ * Human labels for the filter builder and chips. `is_in` is displayed
68
+ * as "in" — the proto spelling exists only because `in` is reserved in
69
+ * Java/Python, a substrate detail operators never see.
70
+ */
71
+ export declare const OPERATOR_LABELS: ReadonlyMap<RecordConditionOp, string>;
72
+ /**
73
+ * Sortable fields: any declared non-json field, plus the system id and
74
+ * audit timestamps (mirrors the server's BuildOrderBy).
75
+ */
76
+ export declare function isSortableField(field: FieldDeclaration): boolean;
77
+ /**
78
+ * Build an update payload from per-field edits (DD-005 partial merge).
79
+ * The RPC's tri-state: a key present with a value replaces the field, a
80
+ * key present with `null` explicitly clears it, an absent key leaves
81
+ * the stored value untouched. Callers pass only the dirty fields —
82
+ * cleared ones as `null`.
83
+ */
84
+ export declare function buildUpdateFields(edits: ReadonlyMap<string, JsonValue | null>): JsonObject;
85
+ //# sourceMappingURL=recordValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordValues.d.ts","sourceRoot":"","sources":["../../src/datastore/recordValues.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACtB,MAAM,yDAAyD,CAAC;AACj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E,gBAAgB,GAAG,OAAO,CAEhE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC,GAC3C,UAAU,CAMZ"}
@@ -0,0 +1,282 @@
1
+ // Canonical value semantics of declared datastore fields, at the UI
2
+ // boundary.
3
+ //
4
+ // The authoritative implementation lives in the record layer (OSS
5
+ // `pkg/domain/datastore/schema` + `records/filter.go`, mirrored
6
+ // byte-identically in the cloud Java service — the DD-004 cross-edition
7
+ // contract). This module is a client-side PROJECTION of that contract:
8
+ // it lets forms fail fast with friendly messages and lets the filter
9
+ // builder offer only servable operators. The server remains the
10
+ // enforcer — a stale or buggy projection degrades to a clean server
11
+ // denial, never a false allow (DD-008 invariant 3).
12
+ //
13
+ // Canonical encodings (DD-004):
14
+ // - string: the string itself (enum_values membership checked)
15
+ // - integer: integral JSON number
16
+ // - number: JSON number
17
+ // - bool: JSON boolean
18
+ // - timestamp: RFC 3339 UTC, e.g. "2026-07-21T04:30:00Z"
19
+ // - date: "YYYY-MM-DD" (lexicographically chronological)
20
+ // - time: "HH:MM:SS" zero-padded ("HH:MM" input canonicalized)
21
+ // - json: any JSON value, stored as-is
22
+ //
23
+ // google.protobuf.Struct fields are plain `JsonObject` values in
24
+ // protobuf-es v2, so record payloads need no proto conversion — the
25
+ // entire client-side value story is validation + canonicalization of
26
+ // these JSON shapes.
27
+ import { FieldType, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/spec_pb";
28
+ import { RecordConditionOp } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
29
+ /**
30
+ * Record-envelope system field names (plus the cloud tenancy column and
31
+ * the DD-010 partition label). Never declarable, never caller-writable.
32
+ */
33
+ export const RESERVED_FIELD_NAMES = new Set([
34
+ "id",
35
+ "created_at",
36
+ "updated_at",
37
+ "created_by",
38
+ "org",
39
+ "partition",
40
+ ]);
41
+ const ok = (value) => ({ ok: true, value });
42
+ const fail = (error) => ({ ok: false, error });
43
+ // Zero-padded HH:MM or HH:MM:SS with valid ranges (mirrors the Go
44
+ // canonicalizeTime, which rejects unpadded input).
45
+ const TIME_RE = /^([01]\d|2[0-3]):([0-5]\d)(:([0-5]\d))?$/;
46
+ const DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
47
+ // RFC 3339 date-time: requires the "T" separator and an explicit UTC
48
+ // "Z" or numeric offset — the same shape Go's time.RFC3339Nano accepts.
49
+ const TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/;
50
+ /**
51
+ * Validate a caller-supplied field value against its declaration and
52
+ * return the canonical JSON encoding (see module doc). `null` means
53
+ * explicit null — valid here for any field; required-ness is write-path
54
+ * policy (updates only see the supplied subset), exactly as in the
55
+ * server's CanonicalizeValue.
56
+ *
57
+ * Error messages match the server's shape (`field "x" must be …`) so a
58
+ * client-side rejection reads the same as the server rejection it
59
+ * pre-empts.
60
+ */
61
+ export function coerceFieldValue(field, value) {
62
+ if (value === null)
63
+ return ok(null);
64
+ const name = field.name;
65
+ switch (field.type) {
66
+ case FieldType.string: {
67
+ if (typeof value !== "string")
68
+ return fail(`field "${name}" must be a string`);
69
+ const enums = field.enumValues;
70
+ if (enums.length > 0 && !enums.includes(value)) {
71
+ return fail(`field "${name}" must be one of [${enums.join(" ")}]`);
72
+ }
73
+ return ok(value);
74
+ }
75
+ case FieldType.integer: {
76
+ if (typeof value !== "number" || !Number.isInteger(value)) {
77
+ return fail(`field "${name}" must be an integer`);
78
+ }
79
+ // int64 on the server; reject values JS cannot carry exactly
80
+ // rather than silently submitting a rounded number.
81
+ if (!Number.isSafeInteger(value)) {
82
+ return fail(`field "${name}" is too large to represent exactly`);
83
+ }
84
+ return ok(value);
85
+ }
86
+ case FieldType.number: {
87
+ if (typeof value !== "number" || !Number.isFinite(value)) {
88
+ return fail(`field "${name}" must be a number`);
89
+ }
90
+ return ok(value);
91
+ }
92
+ case FieldType.bool: {
93
+ if (typeof value !== "boolean")
94
+ return fail(`field "${name}" must be a boolean`);
95
+ return ok(value);
96
+ }
97
+ case FieldType.timestamp: {
98
+ if (typeof value !== "string" || !TIMESTAMP_RE.test(value) || Number.isNaN(Date.parse(value))) {
99
+ return fail(`field "${name}" must be an RFC 3339 timestamp (e.g. 2026-07-21T04:30:00Z)`);
100
+ }
101
+ // The server canonicalizes to UTC on write; submitting the parsed
102
+ // RFC 3339 value as-is (offset included) is valid input.
103
+ return ok(value);
104
+ }
105
+ case FieldType.date: {
106
+ if (typeof value !== "string" || !isValidCalendarDate(value)) {
107
+ return fail(`field "${name}" must be a valid YYYY-MM-DD date`);
108
+ }
109
+ return ok(value);
110
+ }
111
+ case FieldType.time: {
112
+ if (typeof value !== "string") {
113
+ return fail(`field "${name}" must be an HH:MM[:SS] time string`);
114
+ }
115
+ const m = TIME_RE.exec(value);
116
+ if (!m) {
117
+ return fail(`field "${name}" must be a valid zero-padded HH:MM[:SS] time`);
118
+ }
119
+ // Canonicalize HH:MM → HH:MM:SS so values compare lexicographically.
120
+ return ok(m[3] === undefined ? `${value}:00` : value);
121
+ }
122
+ case FieldType.json:
123
+ return ok(value);
124
+ default:
125
+ return fail(`field "${name}" has an unsupported type`);
126
+ }
127
+ }
128
+ /** Whether a YYYY-MM-DD string names a real calendar date (rejects 2026-02-30). */
129
+ function isValidCalendarDate(s) {
130
+ const m = DATE_RE.exec(s);
131
+ if (!m)
132
+ return false;
133
+ const [, y, mo, d] = m;
134
+ const date = new Date(Date.UTC(Number(y), Number(mo) - 1, Number(d)));
135
+ return (date.getUTCFullYear() === Number(y) &&
136
+ date.getUTCMonth() === Number(mo) - 1 &&
137
+ date.getUTCDate() === Number(d));
138
+ }
139
+ /**
140
+ * Format a canonical field value for grid-cell display. Values render
141
+ * in their DD-004 canonical encodings (honest, timezone-free); the one
142
+ * concession to readability is trimming a timestamp's zero fractional
143
+ * seconds (storage pads to nine digits for lexicographic ordering —
144
+ * "…T04:30:00.000000000Z" and "…T04:30:00Z" are the same RFC 3339 UTC
145
+ * instant).
146
+ */
147
+ export function formatFieldValue(type, value) {
148
+ if (value === null || value === undefined)
149
+ return "";
150
+ switch (type) {
151
+ case FieldType.timestamp:
152
+ return typeof value === "string" ? trimZeroFraction(value) : String(value);
153
+ case FieldType.json:
154
+ return JSON.stringify(value);
155
+ case FieldType.bool:
156
+ return value === true ? "true" : "false";
157
+ default:
158
+ return String(value);
159
+ }
160
+ }
161
+ /** Also used for the envelope's created_at/updated_at system columns. */
162
+ export function formatSystemTimestamp(value) {
163
+ return trimZeroFraction(value);
164
+ }
165
+ function trimZeroFraction(ts) {
166
+ return ts.replace(/\.0+Z$/, "Z");
167
+ }
168
+ /**
169
+ * The per-type operator matrix (record_io.proto @internal, DD-005 SD-2)
170
+ * — a projection of the server's opsForFieldType. The filter builder
171
+ * offers exactly these, making an unservable operator structurally
172
+ * unofferable (DD-008 invariant 2):
173
+ *
174
+ * string (incl. enum): eq, neq, is_in, not_in
175
+ * bool: eq, neq
176
+ * integer, number,
177
+ * timestamp, date, time: eq, neq, gt, gte, lt, lte
178
+ * json: not filterable
179
+ * + is_null / not_null on any optional (non-required) field
180
+ */
181
+ export function operatorsForField(field) {
182
+ const base = baseOperatorsForType(field.type);
183
+ if (base.length === 0)
184
+ return [];
185
+ return field.required
186
+ ? base
187
+ : [...base, RecordConditionOp.is_null, RecordConditionOp.not_null];
188
+ }
189
+ function baseOperatorsForType(type) {
190
+ switch (type) {
191
+ case FieldType.string:
192
+ return [
193
+ RecordConditionOp.eq,
194
+ RecordConditionOp.neq,
195
+ RecordConditionOp.is_in,
196
+ RecordConditionOp.not_in,
197
+ ];
198
+ case FieldType.bool:
199
+ return [RecordConditionOp.eq, RecordConditionOp.neq];
200
+ case FieldType.integer:
201
+ case FieldType.number:
202
+ case FieldType.timestamp:
203
+ case FieldType.date:
204
+ case FieldType.time:
205
+ return [
206
+ RecordConditionOp.eq,
207
+ RecordConditionOp.neq,
208
+ RecordConditionOp.gt,
209
+ RecordConditionOp.gte,
210
+ RecordConditionOp.lt,
211
+ RecordConditionOp.lte,
212
+ ];
213
+ default:
214
+ // json (and unspecified) are not filterable.
215
+ return [];
216
+ }
217
+ }
218
+ /**
219
+ * The filterable system fields and their operator sets (mirrors the
220
+ * server's buildSystemCondition): `id` by identity, the audit
221
+ * timestamps by range. `created_by`, `org`, and `partition` are not
222
+ * filterable — attribution is the grant system's privacy boundary and
223
+ * partition is ambient scope, never data.
224
+ */
225
+ export const SYSTEM_FIELD_OPERATORS = new Map([
226
+ ["id", [RecordConditionOp.eq, RecordConditionOp.is_in]],
227
+ [
228
+ "created_at",
229
+ [RecordConditionOp.gt, RecordConditionOp.gte, RecordConditionOp.lt, RecordConditionOp.lte],
230
+ ],
231
+ [
232
+ "updated_at",
233
+ [RecordConditionOp.gt, RecordConditionOp.gte, RecordConditionOp.lt, RecordConditionOp.lte],
234
+ ],
235
+ ]);
236
+ /** Operators that take no value (null tests). */
237
+ export function isValuelessOperator(op) {
238
+ return op === RecordConditionOp.is_null || op === RecordConditionOp.not_null;
239
+ }
240
+ /** Operators that take a value list (`values`) rather than a scalar. */
241
+ export function isListOperator(op) {
242
+ return op === RecordConditionOp.is_in || op === RecordConditionOp.not_in;
243
+ }
244
+ /**
245
+ * Human labels for the filter builder and chips. `is_in` is displayed
246
+ * as "in" — the proto spelling exists only because `in` is reserved in
247
+ * Java/Python, a substrate detail operators never see.
248
+ */
249
+ export const OPERATOR_LABELS = new Map([
250
+ [RecordConditionOp.eq, "="],
251
+ [RecordConditionOp.neq, "≠"],
252
+ [RecordConditionOp.gt, ">"],
253
+ [RecordConditionOp.gte, "≥"],
254
+ [RecordConditionOp.lt, "<"],
255
+ [RecordConditionOp.lte, "≤"],
256
+ [RecordConditionOp.is_in, "in"],
257
+ [RecordConditionOp.not_in, "not in"],
258
+ [RecordConditionOp.is_null, "is empty"],
259
+ [RecordConditionOp.not_null, "is not empty"],
260
+ ]);
261
+ /**
262
+ * Sortable fields: any declared non-json field, plus the system id and
263
+ * audit timestamps (mirrors the server's BuildOrderBy).
264
+ */
265
+ export function isSortableField(field) {
266
+ return field.type !== FieldType.json && field.type !== FieldType.field_type_unspecified;
267
+ }
268
+ /**
269
+ * Build an update payload from per-field edits (DD-005 partial merge).
270
+ * The RPC's tri-state: a key present with a value replaces the field, a
271
+ * key present with `null` explicitly clears it, an absent key leaves
272
+ * the stored value untouched. Callers pass only the dirty fields —
273
+ * cleared ones as `null`.
274
+ */
275
+ export function buildUpdateFields(edits) {
276
+ const out = {};
277
+ for (const [name, value] of edits) {
278
+ out[name] = value;
279
+ }
280
+ return out;
281
+ }
282
+ //# sourceMappingURL=recordValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordValues.js","sourceRoot":"","sources":["../../src/datastore/recordValues.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,YAAY;AACZ,EAAE;AACF,kEAAkE;AAClE,gEAAgE;AAChE,wEAAwE;AACxE,uEAAuE;AACvE,qEAAqE;AACrE,gEAAgE;AAChE,oEAAoE;AACpE,oDAAoD;AACpD,EAAE;AACF,gCAAgC;AAChC,oEAAoE;AACpE,sCAAsC;AACtC,6BAA6B;AAC7B,8BAA8B;AAC9B,2DAA2D;AAC3D,gEAAgE;AAChE,sEAAsE;AACtE,8CAA8C;AAC9C,EAAE;AACF,iEAAiE;AACjE,oEAAoE;AACpE,qEAAqE;AACrE,qBAAqB;AAGrB,OAAO,EACL,SAAS,GAEV,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8DAA8D,CAAC;AAEjG;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC;IAC/D,IAAI;IACJ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,KAAK;IACL,WAAW;CACZ,CAAC,CAAC;AAOH,MAAM,EAAE,GAAG,CAAC,KAAuB,EAAgB,EA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