@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,50 @@
1
+ import { type JsonObject } from "@bufbuild/protobuf";
2
+ import { type RecordEnvelope } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
3
+ import type { RecordScope } from "./useRecordList.js";
4
+ /** Arguments for a single record insert. */
5
+ export interface InsertRecordArgs extends RecordScope {
6
+ /**
7
+ * Declared field values in their canonical encodings (DD-004). System
8
+ * field names (`id`, `created_at`, …) are rejected by the server.
9
+ */
10
+ readonly record: JsonObject;
11
+ }
12
+ /** Return value of {@link useInsertRecord}. */
13
+ export interface UseInsertRecordReturn {
14
+ /**
15
+ * Insert one record. Resolves with the server-stamped envelope (id,
16
+ * timestamps, attribution). Rejects — and sets `error` — on denial or
17
+ * constraint violation; the error's message is the server's relayable
18
+ * text, byte-for-byte (render it verbatim, DD-008 invariant 4).
19
+ */
20
+ readonly insertRecord: (args: InsertRecordArgs) => Promise<RecordEnvelope>;
21
+ /** `true` while the insert is in flight. */
22
+ readonly isInserting: boolean;
23
+ /** Error from the last failed insert, or `null` when healthy. */
24
+ readonly error: Error | null;
25
+ /** Reset `error` to `null`. */
26
+ readonly clearError: () => void;
27
+ }
28
+ /**
29
+ * Behavior hook that wraps `datastore.insertRecord()` with loading and
30
+ * error state.
31
+ *
32
+ * Constraint violations (`ALREADY_EXISTS` for uniques,
33
+ * `FAILED_PRECONDITION` for checks) carry the constraint's declared
34
+ * message plus a `google.rpc.ErrorInfo` naming the constraint — use
35
+ * `getRecordConstraint` from `@stigmer/sdk` to place the message next
36
+ * to the fields it covers.
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * const { insertRecord, isInserting, error } = useInsertRecord();
41
+ * await insertRecord({
42
+ * org: "acme",
43
+ * datastore: "clinic",
44
+ * collection: "bookings",
45
+ * record: { slot_date: "2026-07-22", slot_time: "09:30:00" },
46
+ * });
47
+ * ```
48
+ */
49
+ export declare function useInsertRecord(): UseInsertRecordReturn;
50
+ //# sourceMappingURL=useInsertRecord.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInsertRecord.d.ts","sourceRoot":"","sources":["../../src/datastore/useInsertRecord.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,8DAA8D,CAAC;AAGtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,4CAA4C;AAC5C,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3E,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,IAAI,qBAAqB,CAgCvD"}
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ import { create } from "@bufbuild/protobuf";
4
+ import { InsertRecordRequestSchema, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
5
+ import { useStigmer } from "../hooks.js";
6
+ import { toError } from "../internal/toError.js";
7
+ /**
8
+ * Behavior hook that wraps `datastore.insertRecord()` with loading and
9
+ * error state.
10
+ *
11
+ * Constraint violations (`ALREADY_EXISTS` for uniques,
12
+ * `FAILED_PRECONDITION` for checks) carry the constraint's declared
13
+ * message plus a `google.rpc.ErrorInfo` naming the constraint — use
14
+ * `getRecordConstraint` from `@stigmer/sdk` to place the message next
15
+ * to the fields it covers.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * const { insertRecord, isInserting, error } = useInsertRecord();
20
+ * await insertRecord({
21
+ * org: "acme",
22
+ * datastore: "clinic",
23
+ * collection: "bookings",
24
+ * record: { slot_date: "2026-07-22", slot_time: "09:30:00" },
25
+ * });
26
+ * ```
27
+ */
28
+ export function useInsertRecord() {
29
+ const stigmer = useStigmer();
30
+ const [isInserting, setIsInserting] = useState(false);
31
+ const [error, setError] = useState(null);
32
+ const clearError = useCallback(() => setError(null), []);
33
+ const insertRecord = useCallback(async (args) => {
34
+ setIsInserting(true);
35
+ setError(null);
36
+ try {
37
+ return await stigmer.datastore.insertRecord(create(InsertRecordRequestSchema, {
38
+ org: args.org,
39
+ datastore: args.datastore,
40
+ collection: args.collection,
41
+ partition: args.partition ?? "",
42
+ record: args.record,
43
+ }));
44
+ }
45
+ catch (err) {
46
+ setError(toError(err));
47
+ throw err;
48
+ }
49
+ finally {
50
+ setIsInserting(false);
51
+ }
52
+ }, [stigmer]);
53
+ return { insertRecord, isInserting, error, clearError };
54
+ }
55
+ //# sourceMappingURL=useInsertRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInsertRecord.js","sourceRoot":"","sources":["../../src/datastore/useInsertRecord.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAmB,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,yBAAyB,GAE1B,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,M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type RecordEnvelope, type RecordFilter } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
3
+ import type { SortValue, WorkbenchColumnDef } from "../resource-workbench/types.js";
4
+ /** Column definition for the records grid — a row is a {@link RecordEnvelope}. */
5
+ export type RecordColumnDef = WorkbenchColumnDef<RecordEnvelope>;
6
+ /** Options for {@link useRecordCollection}. */
7
+ export interface UseRecordCollectionOptions {
8
+ /** Organization slug. Pass `null` to disable fetching. */
9
+ readonly org: string | null;
10
+ /** Datastore slug. Pass `null` to disable fetching. */
11
+ readonly datastore: string | null;
12
+ /** Collection name. Pass `null` to disable fetching. */
13
+ readonly collection: string | null;
14
+ /** Data partition. Empty or omitted means `"default"` (DD-010). */
15
+ readonly partition?: string;
16
+ /**
17
+ * Typed AND-only filter in the proto shape (DD-005 grammar). The hook
18
+ * adds no grammar — anything expressible here is exactly what
19
+ * `findRecords` serves (DD-008 invariant 1).
20
+ */
21
+ readonly filter?: RecordFilter;
22
+ /** Current page number (1-indexed). @default 1 */
23
+ readonly page?: number;
24
+ /**
25
+ * Page size, 1–100 (the RPC max — one surface, one limit).
26
+ * @default 25 (the RPC default)
27
+ */
28
+ readonly pageSize?: number;
29
+ /**
30
+ * Active sort: `id` is a sortable field name (declared non-json
31
+ * field, or system `id`/`created_at`/`updated_at`). `null` keeps the
32
+ * server default (`created_at` desc, `id` tiebreak).
33
+ */
34
+ readonly sort?: SortValue | null;
35
+ /** Called when the user changes the sort via a column header click. */
36
+ readonly onSortChange?: (sort: SortValue | null) => void;
37
+ /** Column definitions for the grid, converted to TanStack columns internally. */
38
+ readonly columns?: readonly RecordColumnDef[];
39
+ }
40
+ /** Return value of {@link useRecordCollection}. */
41
+ export interface UseRecordCollectionReturn {
42
+ /** Records in the current page. */
43
+ readonly records: readonly RecordEnvelope[];
44
+ /** Total records matching the filter (across all pages). */
45
+ readonly total: number;
46
+ /** Total number of pages at the current page size. */
47
+ readonly totalPages: number;
48
+ /** The current page number (mirrors input). */
49
+ readonly currentPage: number;
50
+ /** `true` during the initial fetch (no data yet). */
51
+ readonly isLoading: boolean;
52
+ /** `true` during a background refetch while stale data is shown. */
53
+ readonly isRefetching: boolean;
54
+ /**
55
+ * Error from the last failed fetch, or `null`. A record-layer
56
+ * `PERMISSION_DENIED` lands here carrying the server's relayable
57
+ * message verbatim — render it as the denied panel, never a silently
58
+ * empty grid (DD-008 SD-3).
59
+ */
60
+ readonly error: Error | null;
61
+ /** Imperatively trigger a refetch (e.g. after a record write). */
62
+ readonly refetch: () => void;
63
+ /**
64
+ * The TanStack Table instance for `ResourceTable` (or custom
65
+ * renderers). `null` when no columns are provided.
66
+ */
67
+ readonly table: Table<RecordEnvelope> | null;
68
+ }
69
+ /**
70
+ * Headless hook that manages records-grid state: `findRecords` fetching,
71
+ * server-side sort, and RPC limit/offset pagination.
72
+ *
73
+ * The deliberate sibling of `useResourceCollection` (DD-008 SD-2):
74
+ * same headless shape — `useFetch` underneath, TanStack table with
75
+ * `manualPagination`/`manualSorting`, controlled sort via
76
+ * `sort`/`onSortChange` — but the record data contract, which the
77
+ * resource collection structurally cannot carry (its fetch path is
78
+ * hardcoded to `ListParams`/`SearchResult`). Mirrored, not retrofitted,
79
+ * so the SDK stays learnable; the produced table feeds the same
80
+ * presentational `ResourceTable`.
81
+ *
82
+ * Everything is server-side: filtering (the typed proto filter),
83
+ * sorting (single-field `order_by`), and pagination (limit/offset,
84
+ * default 25, max 100). The hook performs no client-side filtering or
85
+ * sorting — one query surface (DD-008 invariant 1).
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * const collection = useRecordCollection({
90
+ * org: "acme",
91
+ * datastore: "clinic",
92
+ * collection: "bookings",
93
+ * partition,
94
+ * filter,
95
+ * page,
96
+ * sort,
97
+ * onSortChange: setSort,
98
+ * columns: recordColumns,
99
+ * });
100
+ * return <ResourceTable table={collection.table} />;
101
+ * ```
102
+ */
103
+ export declare function useRecordCollection(options: UseRecordCollectionOptions): UseRecordCollectionReturn;
104
+ //# sourceMappingURL=useRecordCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRecordCollection.d.ts","sourceRoot":"","sources":["../../src/datastore/useRecordCollection.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,KAAK,EACX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,8DAA8D,CAAC;AAGtE,OAAO,KAAK,EAAiB,SAAS,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEnG,kFAAkF;AAClF,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAEjE,+CAA+C;AAC/C,MAAM,WAAW,0BAA0B;IACzC,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,wDAAwD;IACxD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC,uEAAuE;IACvE,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IACzD,iFAAiF;IACjF,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CAC/C;AAED,mDAAmD;AACnD,MAAM,WAAW,yBAAyB;IACxC,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,oEAAoE;IACpE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;CAC9C;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,0BAA0B,GAClC,yBAAyB,CAsH3B"}
@@ -0,0 +1,136 @@
1
+ "use client";
2
+ import { useCallback, useMemo, useRef } from "react";
3
+ import { getCoreRowModel, useReactTable, } from "@tanstack/react-table";
4
+ import { create, toJsonString } from "@bufbuild/protobuf";
5
+ import { FindRecordsRequestSchema, RecordFilterSchema, RecordOrderBySchema, RecordSortDirection, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
6
+ import { useStigmer } from "../hooks.js";
7
+ import { useFetch } from "../internal/useFetch.js";
8
+ const DEFAULT_PAGE_SIZE = 25;
9
+ const MAX_PAGE_SIZE = 100;
10
+ const INITIAL_DATA = { records: [], total: 0 };
11
+ /**
12
+ * Headless hook that manages records-grid state: `findRecords` fetching,
13
+ * server-side sort, and RPC limit/offset pagination.
14
+ *
15
+ * The deliberate sibling of `useResourceCollection` (DD-008 SD-2):
16
+ * same headless shape — `useFetch` underneath, TanStack table with
17
+ * `manualPagination`/`manualSorting`, controlled sort via
18
+ * `sort`/`onSortChange` — but the record data contract, which the
19
+ * resource collection structurally cannot carry (its fetch path is
20
+ * hardcoded to `ListParams`/`SearchResult`). Mirrored, not retrofitted,
21
+ * so the SDK stays learnable; the produced table feeds the same
22
+ * presentational `ResourceTable`.
23
+ *
24
+ * Everything is server-side: filtering (the typed proto filter),
25
+ * sorting (single-field `order_by`), and pagination (limit/offset,
26
+ * default 25, max 100). The hook performs no client-side filtering or
27
+ * sorting — one query surface (DD-008 invariant 1).
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * const collection = useRecordCollection({
32
+ * org: "acme",
33
+ * datastore: "clinic",
34
+ * collection: "bookings",
35
+ * partition,
36
+ * filter,
37
+ * page,
38
+ * sort,
39
+ * onSortChange: setSort,
40
+ * columns: recordColumns,
41
+ * });
42
+ * return <ResourceTable table={collection.table} />;
43
+ * ```
44
+ */
45
+ export function useRecordCollection(options) {
46
+ const { org, datastore, collection, partition = "", filter, page = 1, pageSize = DEFAULT_PAGE_SIZE, sort = null, onSortChange, columns = [], } = options;
47
+ const stigmer = useStigmer();
48
+ const limit = Math.min(Math.max(pageSize, 1), MAX_PAGE_SIZE);
49
+ const offset = (Math.max(page, 1) - 1) * limit;
50
+ // Proto messages are typically rebuilt each render; serialized JSON is
51
+ // the stable identity for dependency comparison.
52
+ const filterKey = filter ? toJsonString(RecordFilterSchema, filter) : "";
53
+ const orderBy = useMemo(() => {
54
+ if (!sort)
55
+ return undefined;
56
+ return create(RecordOrderBySchema, {
57
+ field: sort.id,
58
+ direction: sort.direction === "desc" ? RecordSortDirection.desc : RecordSortDirection.asc,
59
+ });
60
+ }, [sort]);
61
+ const orderByKey = orderBy ? toJsonString(RecordOrderBySchema, orderBy) : "";
62
+ // --- Data fetching via useFetch -----------------------------------------
63
+ const { data, isLoading, isRefetching, error, refetch } = useFetch(org && datastore && collection
64
+ ? async () => {
65
+ const result = await stigmer.datastore.findRecords(create(FindRecordsRequestSchema, {
66
+ org,
67
+ datastore,
68
+ collection,
69
+ partition,
70
+ filter,
71
+ orderBy,
72
+ limit,
73
+ offset,
74
+ }));
75
+ return { records: result.records, total: result.total };
76
+ }
77
+ : null, [org, datastore, collection, partition, filterKey, orderByKey, limit, offset, stigmer], INITIAL_DATA);
78
+ // --- TanStack Table sorting bridge --------------------------------------
79
+ const sortingState = useMemo(() => {
80
+ if (!sort)
81
+ return [];
82
+ return [{ id: sort.id, desc: sort.direction === "desc" }];
83
+ }, [sort]);
84
+ const onSortChangeRef = useRef(onSortChange);
85
+ onSortChangeRef.current = onSortChange;
86
+ const handleSortingChange = useCallback((updater) => {
87
+ const next = typeof updater === "function" ? updater(sortingState) : updater;
88
+ if (next.length === 0) {
89
+ onSortChangeRef.current?.(null);
90
+ }
91
+ else {
92
+ const col = next[0];
93
+ onSortChangeRef.current?.({
94
+ id: col.id,
95
+ direction: (col.desc ? "desc" : "asc"),
96
+ });
97
+ }
98
+ }, [sortingState]);
99
+ // --- TanStack Table column conversion -----------------------------------
100
+ const tanstackColumns = useMemo(() => {
101
+ return columns.map((col) => ({
102
+ id: col.id,
103
+ header: col.header,
104
+ cell: (info) => col.cell(info.row.original),
105
+ enableSorting: col.sortable ?? false,
106
+ size: col.minWidth,
107
+ minSize: col.minWidth,
108
+ }));
109
+ }, [columns]);
110
+ // --- TanStack Table instance -------------------------------------------
111
+ // No getSortedRowModel: sorting is entirely server-side (manualSorting)
112
+ // and the page arrives in server order — a client sort model would be
113
+ // dead code implying a second sorting authority.
114
+ const table = useReactTable({
115
+ data: data.records,
116
+ columns: tanstackColumns,
117
+ state: { sorting: sortingState },
118
+ onSortingChange: handleSortingChange,
119
+ getCoreRowModel: getCoreRowModel(),
120
+ getRowId: (row) => row.id,
121
+ manualPagination: true,
122
+ manualSorting: true,
123
+ });
124
+ return {
125
+ records: data.records,
126
+ total: data.total,
127
+ totalPages: Math.ceil(data.total / limit),
128
+ currentPage: page,
129
+ isLoading,
130
+ isRefetching,
131
+ error,
132
+ refetch,
133
+ table: tanstackColumns.length > 0 ? table : null,
134
+ };
135
+ }
136
+ //# sourceMappingURL=useRecordCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRecordCollection.js","sourceRoot":"","sources":["../../src/datastore/useRecordCollection.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EACL,eAAe,EACf,aAAa,GAId,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,GAGpB,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAuEnD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,aAAa,GAAG,GAAG,CAAC;AAO1B,MAAM,YAAY,GAAyB,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAmC;IAEnC,MAAM,EACJ,GAAG,EACH,SAAS,EACT,UAAU,EACV,SAAS,GAAG,EAAE,EACd,MAAM,EACN,IAAI,GAAG,CAAC,EACR,QAAQ,GAAG,iBAAiB,EAC5B,IAAI,GAAG,IAAI,EACX,YAAY,EACZ,OAAO,GAAG,EAAE,GACb,GAAG,OAAO,CAAC;IAEZ,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE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AACJ,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { type RecordEnvelope, type RecordFilter, type RecordOrderBy } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
2
+ /**
3
+ * Addressing shared by every record read/write: which datastore, which
4
+ * collection, and which data partition (DD-010 — every record operation
5
+ * is partition-scoped; empty means the `"default"` partition).
6
+ */
7
+ export interface RecordScope {
8
+ /** Organization slug. Required for cloud direct callers; OSS defaults it. */
9
+ readonly org: string;
10
+ /** Datastore slug. */
11
+ readonly datastore: string;
12
+ /** Collection name. */
13
+ readonly collection: string;
14
+ /** Data partition. Empty or omitted means `"default"`. */
15
+ readonly partition?: string;
16
+ }
17
+ /** Query parameters for {@link useRecordList}. */
18
+ export interface UseRecordListParams extends RecordScope {
19
+ /**
20
+ * Typed AND-only filter in the proto shape (DD-005 grammar). The hook
21
+ * adds no grammar of its own — anything expressible here is exactly
22
+ * what `findRecords` serves.
23
+ */
24
+ readonly filter?: RecordFilter;
25
+ /** Sort directive. Omitted keeps the default: `created_at` desc, `id` tiebreak. */
26
+ readonly orderBy?: RecordOrderBy;
27
+ /** Page size, 1–100. Zero or omitted applies the RPC default of 25. */
28
+ readonly limit?: number;
29
+ /** Row offset for pagination. */
30
+ readonly offset?: number;
31
+ }
32
+ /** Return value of {@link useRecordList}. */
33
+ export interface UseRecordListReturn {
34
+ /** Records in the current page. */
35
+ readonly records: readonly RecordEnvelope[];
36
+ /** Total records matching the filter (across all pages). */
37
+ readonly total: number;
38
+ /** `true` while the initial fetch is in flight. */
39
+ readonly isLoading: boolean;
40
+ /** `true` while a background refetch is in flight. */
41
+ readonly isRefetching: boolean;
42
+ /** Error from the last failed request, or `null` when healthy. */
43
+ readonly error: Error | null;
44
+ /** Discard cached data and re-fetch the current page from the server. */
45
+ readonly refetch: () => void;
46
+ }
47
+ /**
48
+ * Data hook that fetches a page of records via `findRecords` — the one
49
+ * query surface (DD-008 invariant 1): server-side filtering with the
50
+ * DD-005 grammar, RPC limit/offset pagination, no client-side
51
+ * filtering.
52
+ *
53
+ * A record-layer `PERMISSION_DENIED` (caller holds no read grant on the
54
+ * collection) surfaces as `error` carrying the server's relayable
55
+ * message verbatim; consumers render it as the denied panel, never a
56
+ * silently empty grid.
57
+ *
58
+ * Pass `null` to skip fetching (stable no-op) — e.g. while the
59
+ * collection is not yet selected.
60
+ *
61
+ * For the full grid experience (TanStack table, sort bridge, page
62
+ * state), use {@link useRecordCollection}, which builds on the same
63
+ * RPC.
64
+ */
65
+ export declare function useRecordList(params: UseRecordListParams | null): UseRecordListReturn;
66
+ //# sourceMappingURL=useRecordList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRecordList.d.ts","sourceRoot":"","sources":["../../src/datastore/useRecordList.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,8DAA8D,CAAC;AAItE;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uBAAuB;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,kDAAkD;AAClD,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;IACjC,uEAAuE;IACvE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AASD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,mBAAmB,GAAG,IAAI,GACjC,mBAAmB,CAyCrB"}
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { create, toJsonString } from "@bufbuild/protobuf";
3
+ import { FindRecordsRequestSchema, RecordFilterSchema, RecordOrderBySchema, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
4
+ import { useStigmer } from "../hooks.js";
5
+ import { useFetch } from "../internal/useFetch.js";
6
+ const INITIAL_DATA = { records: [], total: 0 };
7
+ /**
8
+ * Data hook that fetches a page of records via `findRecords` — the one
9
+ * query surface (DD-008 invariant 1): server-side filtering with the
10
+ * DD-005 grammar, RPC limit/offset pagination, no client-side
11
+ * filtering.
12
+ *
13
+ * A record-layer `PERMISSION_DENIED` (caller holds no read grant on the
14
+ * collection) surfaces as `error` carrying the server's relayable
15
+ * message verbatim; consumers render it as the denied panel, never a
16
+ * silently empty grid.
17
+ *
18
+ * Pass `null` to skip fetching (stable no-op) — e.g. while the
19
+ * collection is not yet selected.
20
+ *
21
+ * For the full grid experience (TanStack table, sort bridge, page
22
+ * state), use {@link useRecordCollection}, which builds on the same
23
+ * RPC.
24
+ */
25
+ export function useRecordList(params) {
26
+ const stigmer = useStigmer();
27
+ // Proto messages are typically rebuilt each render; serialized JSON is
28
+ // the stable identity for dependency comparison.
29
+ const filterKey = params?.filter ? toJsonString(RecordFilterSchema, params.filter) : "";
30
+ const orderByKey = params?.orderBy ? toJsonString(RecordOrderBySchema, params.orderBy) : "";
31
+ const { data, isLoading, isRefetching, error, refetch } = useFetch(params
32
+ ? async () => {
33
+ const result = await stigmer.datastore.findRecords(create(FindRecordsRequestSchema, {
34
+ org: params.org,
35
+ datastore: params.datastore,
36
+ collection: params.collection,
37
+ partition: params.partition ?? "",
38
+ filter: params.filter,
39
+ orderBy: params.orderBy,
40
+ limit: params.limit ?? 0,
41
+ offset: params.offset ?? 0,
42
+ }));
43
+ return { records: result.records, total: result.total };
44
+ }
45
+ : null, [
46
+ params?.org,
47
+ params?.datastore,
48
+ params?.collection,
49
+ params?.partition,
50
+ filterKey,
51
+ orderByKey,
52
+ params?.limit,
53
+ params?.offset,
54
+ stigmer,
55
+ ], INITIAL_DATA);
56
+ return { records: data.records, total: data.total, isLoading, isRefetching, error, refetch };
57
+ }
58
+ //# sourceMappingURL=useRecordList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRecordList.js","sourceRoot":"","sources":["../../src/datastore/useRecordList.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,GAIpB,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAuDnD,MAAM,YAAY,GAAmB,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAkC;IAElC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,uEAAuE;IACvE,iDAAiD;IACj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AAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC/F,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { type JsonObject } from "@bufbuild/protobuf";
2
+ import { type RecordEnvelope } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
3
+ import type { RecordScope } from "./useRecordList.js";
4
+ /** Arguments for a single record update. */
5
+ export interface UpdateRecordArgs extends RecordScope {
6
+ /** Record id (`dsr_…`). */
7
+ readonly id: string;
8
+ /**
9
+ * Partial merge (DD-005): only the supplied fields change; an
10
+ * explicit `null` clears a field; absent fields keep their stored
11
+ * values. Constraints evaluate on the merged result. Build this from
12
+ * per-field edits with `buildUpdateFields`.
13
+ */
14
+ readonly fields: JsonObject;
15
+ }
16
+ /** Return value of {@link useUpdateRecord}. */
17
+ export interface UseUpdateRecordReturn {
18
+ /**
19
+ * Update one record by id. Resolves with the merged envelope. Rejects
20
+ * — and sets `error` — on denial or constraint violation; the error's
21
+ * message is the server's relayable text, byte-for-byte.
22
+ */
23
+ readonly updateRecord: (args: UpdateRecordArgs) => Promise<RecordEnvelope>;
24
+ /** `true` while the update is in flight. */
25
+ readonly isUpdating: boolean;
26
+ /** Error from the last failed update, or `null` when healthy. */
27
+ readonly error: Error | null;
28
+ /** Reset `error` to `null`. */
29
+ readonly clearError: () => void;
30
+ }
31
+ /**
32
+ * Behavior hook that wraps `datastore.updateRecord()` with loading and
33
+ * error state.
34
+ *
35
+ * The RPC is an honest tri-state partial merge — the hook adds no
36
+ * merge semantics of its own. A record in another partition is
37
+ * NOT_FOUND (DD-010: partition scoping is structural).
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * const { updateRecord } = useUpdateRecord();
42
+ * await updateRecord({
43
+ * org: "acme",
44
+ * datastore: "clinic",
45
+ * collection: "bookings",
46
+ * id: "dsr_01j9...",
47
+ * fields: { patient_phone: "+15550100", notes: null }, // notes cleared
48
+ * });
49
+ * ```
50
+ */
51
+ export declare function useUpdateRecord(): UseUpdateRecordReturn;
52
+ //# sourceMappingURL=useUpdateRecord.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdateRecord.d.ts","sourceRoot":"","sources":["../../src/datastore/useUpdateRecord.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,8DAA8D,CAAC;AAGtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,4CAA4C;AAC5C,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3E,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,IAAI,qBAAqB,CAiCvD"}
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ import { create } from "@bufbuild/protobuf";
4
+ import { UpdateRecordRequestSchema, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
5
+ import { useStigmer } from "../hooks.js";
6
+ import { toError } from "../internal/toError.js";
7
+ /**
8
+ * Behavior hook that wraps `datastore.updateRecord()` with loading and
9
+ * error state.
10
+ *
11
+ * The RPC is an honest tri-state partial merge — the hook adds no
12
+ * merge semantics of its own. A record in another partition is
13
+ * NOT_FOUND (DD-010: partition scoping is structural).
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * const { updateRecord } = useUpdateRecord();
18
+ * await updateRecord({
19
+ * org: "acme",
20
+ * datastore: "clinic",
21
+ * collection: "bookings",
22
+ * id: "dsr_01j9...",
23
+ * fields: { patient_phone: "+15550100", notes: null }, // notes cleared
24
+ * });
25
+ * ```
26
+ */
27
+ export function useUpdateRecord() {
28
+ const stigmer = useStigmer();
29
+ const [isUpdating, setIsUpdating] = useState(false);
30
+ const [error, setError] = useState(null);
31
+ const clearError = useCallback(() => setError(null), []);
32
+ const updateRecord = useCallback(async (args) => {
33
+ setIsUpdating(true);
34
+ setError(null);
35
+ try {
36
+ return await stigmer.datastore.updateRecord(create(UpdateRecordRequestSchema, {
37
+ org: args.org,
38
+ datastore: args.datastore,
39
+ collection: args.collection,
40
+ partition: args.partition ?? "",
41
+ id: args.id,
42
+ fields: args.fields,
43
+ }));
44
+ }
45
+ catch (err) {
46
+ setError(toError(err));
47
+ throw err;
48
+ }
49
+ finally {
50
+ setIsUpdating(false);
51
+ }
52
+ }, [stigmer]);
53
+ return { updateRecord, isUpdating, error, clearError };
54
+ }
55
+ //# sourceMappingURL=useUpdateRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdateRecord.js","sourceRoot":"","sources":["../../src/datastore/useUpdateRecord.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAmB,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,yBAAyB,GAE1B,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,E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1
- {"version":3,"file":"EnvironmentListPanel.d.ts","sourceRoot":"","sources":["../../src/environment/EnvironmentListPanel.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AAW5F,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,kDAAkD;IAClD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAC3E,0DAA0D;IAC1D,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1D,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACtD,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,GAAG,EACH,MAAM,EACN,aAAa,EACb,mBAAmB,EACnB,QAAgB,EAChB,YAAY,EACZ,SAAS,GACV,EAAE,yBAAyB,2CAgG3B"}
1
+ {"version":3,"file":"EnvironmentListPanel.d.ts","sourceRoot":"","sources":["../../src/environment/EnvironmentListPanel.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AAY5F,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,k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