@stigmer/react 3.2.2 → 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.
- package/agent/AgentDetailView.d.ts.map +1 -1
- package/agent/AgentDetailView.js +6 -3
- package/agent/AgentDetailView.js.map +1 -1
- package/agent/steps/ReviewStep.d.ts.map +1 -1
- package/agent/steps/ReviewStep.js +2 -3
- package/agent/steps/ReviewStep.js.map +1 -1
- package/billing/BaselineEditor.d.ts +9 -0
- package/billing/BaselineEditor.d.ts.map +1 -0
- package/billing/BaselineEditor.js +253 -0
- package/billing/BaselineEditor.js.map +1 -0
- package/billing/ModelCatalogPanel.d.ts +28 -0
- package/billing/ModelCatalogPanel.d.ts.map +1 -0
- package/billing/ModelCatalogPanel.js +102 -0
- package/billing/ModelCatalogPanel.js.map +1 -0
- package/billing/ModelGovernanceDetail.d.ts +8 -0
- package/billing/ModelGovernanceDetail.d.ts.map +1 -0
- package/billing/ModelGovernanceDetail.js +64 -0
- package/billing/ModelGovernanceDetail.js.map +1 -0
- package/billing/OperatorAccessNotice.d.ts +12 -0
- package/billing/OperatorAccessNotice.d.ts.map +1 -0
- package/billing/OperatorAccessNotice.js +15 -0
- package/billing/OperatorAccessNotice.js.map +1 -0
- package/billing/PricingGovernanceConsole.d.ts +57 -0
- package/billing/PricingGovernanceConsole.d.ts.map +1 -0
- package/billing/PricingGovernanceConsole.js +164 -0
- package/billing/PricingGovernanceConsole.js.map +1 -0
- package/billing/PricingGovernancePanel.d.ts +26 -0
- package/billing/PricingGovernancePanel.d.ts.map +1 -0
- package/billing/PricingGovernancePanel.js +64 -0
- package/billing/PricingGovernancePanel.js.map +1 -0
- package/billing/RetireConfirm.d.ts +9 -0
- package/billing/RetireConfirm.d.ts.map +1 -0
- package/billing/RetireConfirm.js +19 -0
- package/billing/RetireConfirm.js.map +1 -0
- package/billing/form-primitives.d.ts +18 -0
- package/billing/form-primitives.d.ts.map +1 -0
- package/billing/form-primitives.js +19 -0
- package/billing/form-primitives.js.map +1 -0
- package/billing/governance-primitives.d.ts +33 -0
- package/billing/governance-primitives.d.ts.map +1 -0
- package/billing/governance-primitives.js +43 -0
- package/billing/governance-primitives.js.map +1 -0
- package/billing/index.d.ts +18 -0
- package/billing/index.d.ts.map +1 -1
- package/billing/index.js +9 -0
- package/billing/index.js.map +1 -1
- package/billing/pricing-format.d.ts +12 -0
- package/billing/pricing-format.d.ts.map +1 -0
- package/billing/pricing-format.js +50 -0
- package/billing/pricing-format.js.map +1 -0
- package/billing/useDecidePricingOverride.d.ts +46 -0
- package/billing/useDecidePricingOverride.d.ts.map +1 -0
- package/billing/useDecidePricingOverride.js +44 -0
- package/billing/useDecidePricingOverride.js.map +1 -0
- package/billing/useModelGovernanceView.d.ts +103 -0
- package/billing/useModelGovernanceView.d.ts.map +1 -0
- package/billing/useModelGovernanceView.js +144 -0
- package/billing/useModelGovernanceView.js.map +1 -0
- package/billing/useModelPricingBaselines.d.ts +40 -0
- package/billing/useModelPricingBaselines.d.ts.map +1 -0
- package/billing/useModelPricingBaselines.js +32 -0
- package/billing/useModelPricingBaselines.js.map +1 -0
- package/billing/usePricingGovernance.d.ts +39 -0
- package/billing/usePricingGovernance.d.ts.map +1 -0
- package/billing/usePricingGovernance.js +31 -0
- package/billing/usePricingGovernance.js.map +1 -0
- package/billing/useRetireModelPricingBaseline.d.ts +31 -0
- package/billing/useRetireModelPricingBaseline.d.ts.map +1 -0
- package/billing/useRetireModelPricingBaseline.js +36 -0
- package/billing/useRetireModelPricingBaseline.js.map +1 -0
- package/billing/useUpsertModelPricingBaseline.d.ts +38 -0
- package/billing/useUpsertModelPricingBaseline.d.ts.map +1 -0
- package/billing/useUpsertModelPricingBaseline.js +37 -0
- package/billing/useUpsertModelPricingBaseline.js.map +1 -0
- package/channel/AgentChannelsPanel.d.ts.map +1 -1
- package/channel/AgentChannelsPanel.js +11 -5
- package/channel/AgentChannelsPanel.js.map +1 -1
- package/composer/SessionComposer.d.ts +1 -1
- package/cursor-accounts/CursorAccountEditor.d.ts +28 -0
- package/cursor-accounts/CursorAccountEditor.d.ts.map +1 -0
- package/cursor-accounts/CursorAccountEditor.js +51 -0
- package/cursor-accounts/CursorAccountEditor.js.map +1 -0
- package/cursor-accounts/CursorAccountsAccessNotice.d.ts +11 -0
- package/cursor-accounts/CursorAccountsAccessNotice.d.ts.map +1 -0
- package/cursor-accounts/CursorAccountsAccessNotice.js +14 -0
- package/cursor-accounts/CursorAccountsAccessNotice.js.map +1 -0
- package/cursor-accounts/CursorAccountsConsole.d.ts +28 -0
- package/cursor-accounts/CursorAccountsConsole.d.ts.map +1 -0
- package/cursor-accounts/CursorAccountsConsole.js +275 -0
- package/cursor-accounts/CursorAccountsConsole.js.map +1 -0
- package/cursor-accounts/cursor-account-format.d.ts +10 -0
- package/cursor-accounts/cursor-account-format.d.ts.map +1 -0
- package/cursor-accounts/cursor-account-format.js +26 -0
- package/cursor-accounts/cursor-account-format.js.map +1 -0
- package/cursor-accounts/index.d.ts +18 -0
- package/cursor-accounts/index.d.ts.map +1 -0
- package/cursor-accounts/index.js +13 -0
- package/cursor-accounts/index.js.map +1 -0
- package/cursor-accounts/useCursorAccountView.d.ts +30 -0
- package/cursor-accounts/useCursorAccountView.d.ts.map +1 -0
- package/cursor-accounts/useCursorAccountView.js +25 -0
- package/cursor-accounts/useCursorAccountView.js.map +1 -0
- package/cursor-accounts/useCursorAccounts.d.ts +33 -0
- package/cursor-accounts/useCursorAccounts.d.ts.map +1 -0
- package/cursor-accounts/useCursorAccounts.js +25 -0
- package/cursor-accounts/useCursorAccounts.js.map +1 -0
- package/cursor-accounts/useCursorMemberKeyActions.d.ts +49 -0
- package/cursor-accounts/useCursorMemberKeyActions.d.ts.map +1 -0
- package/cursor-accounts/useCursorMemberKeyActions.js +38 -0
- package/cursor-accounts/useCursorMemberKeyActions.js.map +1 -0
- package/cursor-accounts/useDeleteCursorAccount.d.ts +30 -0
- package/cursor-accounts/useDeleteCursorAccount.d.ts.map +1 -0
- package/cursor-accounts/useDeleteCursorAccount.js +32 -0
- package/cursor-accounts/useDeleteCursorAccount.js.map +1 -0
- package/cursor-accounts/useSyncCursorAccount.d.ts +23 -0
- package/cursor-accounts/useSyncCursorAccount.d.ts.map +1 -0
- package/cursor-accounts/useSyncCursorAccount.js +31 -0
- package/cursor-accounts/useSyncCursorAccount.js.map +1 -0
- package/cursor-accounts/useUpsertCursorAccount.d.ts +26 -0
- package/cursor-accounts/useUpsertCursorAccount.d.ts.map +1 -0
- package/cursor-accounts/useUpsertCursorAccount.js +34 -0
- package/cursor-accounts/useUpsertCursorAccount.js.map +1 -0
- package/datastore/CollectionRecordsBrowser.d.ts +34 -0
- package/datastore/CollectionRecordsBrowser.d.ts.map +1 -0
- package/datastore/CollectionRecordsBrowser.js +209 -0
- package/datastore/CollectionRecordsBrowser.js.map +1 -0
- package/datastore/CollectionSchemaView.d.ts +29 -0
- package/datastore/CollectionSchemaView.d.ts.map +1 -0
- package/datastore/CollectionSchemaView.js +93 -0
- package/datastore/CollectionSchemaView.js.map +1 -0
- package/datastore/DatastoreDetailView.d.ts +44 -0
- package/datastore/DatastoreDetailView.d.ts.map +1 -0
- package/datastore/DatastoreDetailView.js +76 -0
- package/datastore/DatastoreDetailView.js.map +1 -0
- package/datastore/DatastoreSyncReport.d.ts +19 -0
- package/datastore/DatastoreSyncReport.d.ts.map +1 -0
- package/datastore/DatastoreSyncReport.js +45 -0
- package/datastore/DatastoreSyncReport.js.map +1 -0
- package/datastore/DeleteDatastoreDialog.d.ts +35 -0
- package/datastore/DeleteDatastoreDialog.d.ts.map +1 -0
- package/datastore/DeleteDatastoreDialog.js +90 -0
- package/datastore/DeleteDatastoreDialog.js.map +1 -0
- package/datastore/FieldValueControl.d.ts +55 -0
- package/datastore/FieldValueControl.d.ts.map +1 -0
- package/datastore/FieldValueControl.js +138 -0
- package/datastore/FieldValueControl.js.map +1 -0
- package/datastore/RecordFilterBuilder.d.ts +30 -0
- package/datastore/RecordFilterBuilder.d.ts.map +1 -0
- package/datastore/RecordFilterBuilder.js +122 -0
- package/datastore/RecordFilterBuilder.js.map +1 -0
- package/datastore/RecordFormPanel.d.ts +45 -0
- package/datastore/RecordFormPanel.d.ts.map +1 -0
- package/datastore/RecordFormPanel.js +215 -0
- package/datastore/RecordFormPanel.js.map +1 -0
- package/datastore/index.d.ts +43 -0
- package/datastore/index.d.ts.map +1 -0
- package/datastore/index.js +22 -0
- package/datastore/index.js.map +1 -0
- package/datastore/recordFilter.d.ts +54 -0
- package/datastore/recordFilter.d.ts.map +1 -0
- package/datastore/recordFilter.js +93 -0
- package/datastore/recordFilter.js.map +1 -0
- package/datastore/recordValues.d.ts +85 -0
- package/datastore/recordValues.d.ts.map +1 -0
- package/datastore/recordValues.js +282 -0
- package/datastore/recordValues.js.map +1 -0
- package/datastore/useDatastore.d.ts +39 -0
- package/datastore/useDatastore.d.ts.map +1 -0
- package/datastore/useDatastore.js +44 -0
- package/datastore/useDatastore.js.map +1 -0
- package/datastore/useDatastoreCount.d.ts +48 -0
- package/datastore/useDatastoreCount.d.ts.map +1 -0
- package/datastore/useDatastoreCount.js +27 -0
- package/datastore/useDatastoreCount.js.map +1 -0
- package/datastore/useDatastoreDescription.d.ts +54 -0
- package/datastore/useDatastoreDescription.d.ts.map +1 -0
- package/datastore/useDatastoreDescription.js +50 -0
- package/datastore/useDatastoreDescription.js.map +1 -0
- package/datastore/useDatastoreList.d.ts +57 -0
- package/datastore/useDatastoreList.d.ts.map +1 -0
- package/datastore/useDatastoreList.js +29 -0
- package/datastore/useDatastoreList.js.map +1 -0
- package/datastore/useDatastoreSearch.d.ts +19 -0
- package/datastore/useDatastoreSearch.d.ts.map +1 -0
- package/datastore/useDatastoreSearch.js +22 -0
- package/datastore/useDatastoreSearch.js.map +1 -0
- package/datastore/useDeleteDatastore.d.ts +53 -0
- package/datastore/useDeleteDatastore.d.ts.map +1 -0
- package/datastore/useDeleteDatastore.js +40 -0
- package/datastore/useDeleteDatastore.js.map +1 -0
- package/datastore/useDeleteRecord.d.ts +34 -0
- package/datastore/useDeleteRecord.d.ts.map +1 -0
- package/datastore/useDeleteRecord.js +43 -0
- package/datastore/useDeleteRecord.js.map +1 -0
- package/datastore/useInsertRecord.d.ts +50 -0
- package/datastore/useInsertRecord.d.ts.map +1 -0
- package/datastore/useInsertRecord.js +55 -0
- package/datastore/useInsertRecord.js.map +1 -0
- package/datastore/useRecordCollection.d.ts +104 -0
- package/datastore/useRecordCollection.d.ts.map +1 -0
- package/datastore/useRecordCollection.js +136 -0
- package/datastore/useRecordCollection.js.map +1 -0
- package/datastore/useRecordList.d.ts +66 -0
- package/datastore/useRecordList.d.ts.map +1 -0
- package/datastore/useRecordList.js +58 -0
- package/datastore/useRecordList.js.map +1 -0
- package/datastore/useUpdateRecord.d.ts +52 -0
- package/datastore/useUpdateRecord.d.ts.map +1 -0
- package/datastore/useUpdateRecord.js +55 -0
- package/datastore/useUpdateRecord.js.map +1 -0
- package/environment/EnvironmentListPanel.d.ts.map +1 -1
- package/environment/EnvironmentListPanel.js +12 -7
- package/environment/EnvironmentListPanel.js.map +1 -1
- package/execution/index.d.ts +1 -2
- package/execution/index.d.ts.map +1 -1
- package/execution/index.js +0 -1
- package/execution/index.js.map +1 -1
- package/execution/useLiveAgentExecution.d.ts +17 -1
- package/execution/useLiveAgentExecution.d.ts.map +1 -1
- package/execution/useLiveAgentExecution.js +19 -4
- package/execution/useLiveAgentExecution.js.map +1 -1
- package/iam-policy/index.d.ts +1 -1
- package/iam-policy/index.d.ts.map +1 -1
- package/iam-policy/index.js.map +1 -1
- package/iam-policy/useCheckPermission.d.ts +32 -11
- package/iam-policy/useCheckPermission.d.ts.map +1 -1
- package/iam-policy/useCheckPermission.js +24 -19
- package/iam-policy/useCheckPermission.js.map +1 -1
- package/index.d.ts +16 -10
- package/index.d.ts.map +1 -1
- package/index.js +16 -5
- package/index.js.map +1 -1
- package/internal/useInViewport.d.ts +24 -0
- package/internal/useInViewport.d.ts.map +1 -0
- package/internal/useInViewport.js +49 -0
- package/internal/useInViewport.js.map +1 -0
- package/library/VisibilitySelector.d.ts +22 -6
- package/library/VisibilitySelector.d.ts.map +1 -1
- package/library/VisibilitySelector.js +12 -4
- package/library/VisibilitySelector.js.map +1 -1
- package/library/index.d.ts +1 -8
- package/library/index.d.ts.map +1 -1
- package/library/index.js +0 -4
- package/library/index.js.map +1 -1
- package/library/useApplyResource.d.ts +12 -12
- package/library/useApplyResource.d.ts.map +1 -1
- package/library/useApplyResource.js +16 -25
- package/library/useApplyResource.js.map +1 -1
- package/library/useExportResource.d.ts +13 -9
- package/library/useExportResource.d.ts.map +1 -1
- package/library/useExportResource.js +18 -36
- package/library/useExportResource.js.map +1 -1
- package/manifest/ApplyManifestDialog.d.ts +48 -0
- package/manifest/ApplyManifestDialog.d.ts.map +1 -0
- package/manifest/ApplyManifestDialog.js +135 -0
- package/manifest/ApplyManifestDialog.js.map +1 -0
- package/manifest/EditResourceYamlDialog.d.ts +51 -0
- package/manifest/EditResourceYamlDialog.d.ts.map +1 -0
- package/manifest/EditResourceYamlDialog.js +104 -0
- package/manifest/EditResourceYamlDialog.js.map +1 -0
- package/manifest/RedactedSecretsNotice.d.ts +14 -0
- package/manifest/RedactedSecretsNotice.d.ts.map +1 -0
- package/manifest/RedactedSecretsNotice.js +14 -0
- package/manifest/RedactedSecretsNotice.js.map +1 -0
- package/manifest/YamlEditor.d.ts +44 -0
- package/manifest/YamlEditor.d.ts.map +1 -0
- package/manifest/YamlEditor.js +216 -0
- package/manifest/YamlEditor.js.map +1 -0
- package/manifest/index.d.ts +13 -0
- package/manifest/index.d.ts.map +1 -0
- package/manifest/index.js +13 -0
- package/manifest/index.js.map +1 -0
- package/manifest/useApplyManifest.d.ts +82 -0
- package/manifest/useApplyManifest.d.ts.map +1 -0
- package/manifest/useApplyManifest.js +180 -0
- package/manifest/useApplyManifest.js.map +1 -0
- package/manifest/useEditResourceYaml.d.ts +106 -0
- package/manifest/useEditResourceYaml.d.ts.map +1 -0
- package/manifest/useEditResourceYaml.js +168 -0
- package/manifest/useEditResourceYaml.js.map +1 -0
- package/mcp-server/McpServerDetailView.d.ts.map +1 -1
- package/mcp-server/McpServerDetailView.js +4 -3
- package/mcp-server/McpServerDetailView.js.map +1 -1
- package/mcp-server/steps/ReviewStep.d.ts.map +1 -1
- package/mcp-server/steps/ReviewStep.js +2 -3
- package/mcp-server/steps/ReviewStep.js.map +1 -1
- package/package.json +4 -4
- package/resource-creation/templates/workflow-templates.js +4 -4
- package/session/SessionViewer.js +8 -1
- package/session/SessionViewer.js.map +1 -1
- package/session/audience.d.ts +6 -1
- package/session/audience.d.ts.map +1 -1
- package/session/useEditSessionPrep.js +3 -3
- package/session/useEditSessionPrep.js.map +1 -1
- package/settings/index.d.ts +2 -1
- package/settings/index.d.ts.map +1 -1
- package/settings/index.js +2 -1
- package/settings/index.js.map +1 -1
- package/settings/settings-nav.d.ts +22 -0
- package/settings/settings-nav.d.ts.map +1 -1
- package/settings/settings-nav.js +32 -1
- package/settings/settings-nav.js.map +1 -1
- package/settings/useSettingsNavGroups.d.ts +29 -0
- package/settings/useSettingsNavGroups.d.ts.map +1 -0
- package/settings/useSettingsNavGroups.js +61 -0
- package/settings/useSettingsNavGroups.js.map +1 -0
- package/skill/SkillDetailView.d.ts.map +1 -1
- package/skill/SkillDetailView.js +4 -3
- package/skill/SkillDetailView.js.map +1 -1
- package/src/access/__tests__/useManageAccess.test.tsx +104 -0
- package/src/agent/AgentDetailView.tsx +9 -3
- package/src/agent/steps/ReviewStep.tsx +2 -3
- package/src/billing/BaselineEditor.tsx +619 -0
- package/src/billing/ModelCatalogPanel.tsx +283 -0
- package/src/billing/ModelGovernanceDetail.tsx +289 -0
- package/src/billing/OperatorAccessNotice.tsx +32 -0
- package/src/billing/PricingGovernanceConsole.tsx +465 -0
- package/src/billing/PricingGovernancePanel.tsx +166 -0
- package/src/billing/RetireConfirm.tsx +82 -0
- package/src/billing/__tests__/ModelCatalogPanel.test.tsx +253 -0
- package/src/billing/__tests__/PricingGovernanceConsole.test.tsx +410 -0
- package/src/billing/__tests__/useModelGovernanceView.test.tsx +308 -0
- package/src/billing/form-primitives.tsx +68 -0
- package/src/billing/governance-primitives.tsx +133 -0
- package/src/billing/index.ts +37 -0
- package/src/billing/pricing-format.ts +53 -0
- package/src/billing/useDecidePricingOverride.ts +78 -0
- package/src/billing/useModelGovernanceView.ts +290 -0
- package/src/billing/useModelPricingBaselines.ts +69 -0
- package/src/billing/usePricingGovernance.ts +57 -0
- package/src/billing/useRetireModelPricingBaseline.ts +65 -0
- package/src/billing/useUpsertModelPricingBaseline.ts +72 -0
- package/src/channel/AgentChannelsPanel.tsx +27 -1
- package/src/composer/SessionComposer.tsx +1 -1
- package/src/cursor-accounts/CursorAccountEditor.tsx +181 -0
- package/src/cursor-accounts/CursorAccountsAccessNotice.tsx +36 -0
- package/src/cursor-accounts/CursorAccountsConsole.tsx +810 -0
- package/src/cursor-accounts/__tests__/CursorAccountsConsole.test.tsx +384 -0
- package/src/cursor-accounts/cursor-account-format.ts +29 -0
- package/src/cursor-accounts/index.ts +29 -0
- package/src/cursor-accounts/useCursorAccountView.ts +49 -0
- package/src/cursor-accounts/useCursorAccounts.ts +49 -0
- package/src/cursor-accounts/useCursorMemberKeyActions.ts +106 -0
- package/src/cursor-accounts/useDeleteCursorAccount.ts +62 -0
- package/src/cursor-accounts/useSyncCursorAccount.ts +54 -0
- package/src/cursor-accounts/useUpsertCursorAccount.ts +57 -0
- package/src/datastore/CollectionRecordsBrowser.tsx +544 -0
- package/src/datastore/CollectionSchemaView.tsx +247 -0
- package/src/datastore/DatastoreDetailView.tsx +201 -0
- package/src/datastore/DatastoreSyncReport.tsx +105 -0
- package/src/datastore/DeleteDatastoreDialog.tsx +202 -0
- package/src/datastore/FieldValueControl.tsx +289 -0
- package/src/datastore/RecordFilterBuilder.tsx +411 -0
- package/src/datastore/RecordFormPanel.tsx +432 -0
- package/src/datastore/__tests__/CollectionRecordsBrowser.test.tsx +207 -0
- package/src/datastore/__tests__/DeleteDatastoreDialog.test.tsx +133 -0
- package/src/datastore/__tests__/FieldValueControl.test.tsx +160 -0
- package/src/datastore/__tests__/RecordFilterBuilder.test.tsx +141 -0
- package/src/datastore/__tests__/RecordFormPanel.test.tsx +227 -0
- package/src/datastore/__tests__/recordFilter.test.ts +156 -0
- package/src/datastore/__tests__/recordMutations.test.tsx +195 -0
- package/src/datastore/__tests__/recordValues.test.ts +359 -0
- package/src/datastore/__tests__/schemaAndSyncViews.test.tsx +142 -0
- package/src/datastore/__tests__/useDatastoreDescription.test.tsx +143 -0
- package/src/datastore/__tests__/useRecordCollection.test.tsx +250 -0
- package/src/datastore/__tests__/useRecordList.test.tsx +85 -0
- package/src/datastore/index.ts +111 -0
- package/src/datastore/recordFilter.ts +140 -0
- package/src/datastore/recordValues.ts +327 -0
- package/src/datastore/useDatastore.ts +67 -0
- package/src/datastore/useDatastoreCount.ts +67 -0
- package/src/datastore/useDatastoreDescription.ts +90 -0
- package/src/datastore/useDatastoreList.ts +79 -0
- package/src/datastore/useDatastoreSearch.ts +39 -0
- package/src/datastore/useDeleteDatastore.ts +87 -0
- package/src/datastore/useDeleteRecord.ts +77 -0
- package/src/datastore/useInsertRecord.ts +92 -0
- package/src/datastore/useRecordCollection.ts +256 -0
- package/src/datastore/useRecordList.ts +131 -0
- package/src/datastore/useUpdateRecord.ts +95 -0
- package/src/environment/EnvironmentListPanel.tsx +24 -0
- package/src/execution/__tests__/useArtifactInspection.test.tsx +12 -2
- package/src/execution/__tests__/useLiveAgentExecution.test.tsx +125 -0
- package/src/execution/index.ts +4 -7
- package/src/execution/useLiveAgentExecution.ts +41 -3
- package/src/iam-policy/__tests__/useCheckPermission.test.tsx +221 -0
- package/src/iam-policy/index.ts +1 -0
- package/src/iam-policy/useCheckPermission.ts +45 -19
- package/src/index.ts +167 -18
- package/src/internal/__tests__/useInViewport.test.tsx +115 -0
- package/src/internal/useInViewport.ts +63 -0
- package/src/library/VisibilitySelector.tsx +50 -9
- package/src/library/__tests__/VisibilitySelector.test.tsx +38 -0
- package/src/library/index.ts +4 -21
- package/src/library/useApplyResource.ts +27 -34
- package/src/library/useExportResource.ts +21 -40
- package/src/manifest/ApplyManifestDialog.tsx +315 -0
- package/src/manifest/EditResourceYamlDialog.tsx +265 -0
- package/src/manifest/RedactedSecretsNotice.tsx +30 -0
- package/src/manifest/YamlEditor.tsx +272 -0
- package/src/manifest/__tests__/EditResourceYamlDialog.test.tsx +118 -0
- package/src/manifest/__tests__/useApplyManifest.test.tsx +237 -0
- package/src/manifest/__tests__/useEditResourceYaml.test.tsx +252 -0
- package/src/manifest/index.ts +33 -0
- package/src/manifest/useApplyManifest.ts +270 -0
- package/src/manifest/useEditResourceYaml.ts +273 -0
- package/src/mcp-server/McpServerDetailView.tsx +7 -3
- package/src/mcp-server/steps/ReviewStep.tsx +2 -3
- package/src/resource-creation/templates/workflow-templates.ts +4 -4
- package/src/session/SessionViewer.tsx +7 -1
- package/src/session/__tests__/audienceWiring.test.tsx +31 -1
- package/src/session/audience.ts +6 -1
- package/src/session/useEditSessionPrep.ts +3 -3
- package/src/settings/__tests__/useSettingsNavGroups.test.tsx +138 -0
- package/src/settings/index.ts +5 -1
- package/src/settings/settings-nav.ts +43 -0
- package/src/settings/useSettingsNavGroups.ts +81 -0
- package/src/skill/SkillDetailView.tsx +7 -3
- package/src/workflow/WorkflowAgentCallTranscript.tsx +279 -0
- package/src/workflow/WorkflowDetailView.tsx +7 -3
- package/src/workflow/WorkflowExecutionViewer.tsx +20 -77
- package/src/workflow/WorkflowTaskApprovalSummary.tsx +45 -8
- package/src/workflow/WorkflowYamlEditor.tsx +6 -270
- package/src/workflow/__tests__/WorkflowAgentCallTranscript.liveregion.test.tsx +124 -0
- package/src/workflow/__tests__/{WorkflowAgentExecutionDocument.test.tsx → WorkflowAgentCallTranscript.test.tsx} +146 -121
- package/src/workflow/__tests__/WorkflowExecutionViewer.approvals.test.tsx +81 -220
- package/src/workflow/__tests__/WorkflowExecutionViewer.reconciliation.test.tsx +17 -16
- package/src/workflow/__tests__/WorkflowTaskApprovalSummary.test.tsx +52 -2
- package/src/workflow/__tests__/WorkflowTaskThread.test.tsx +168 -185
- package/src/workflow/__tests__/agent-call-live-experience.test.ts +4 -4
- package/src/workflow/__tests__/task-approval.test.ts +119 -0
- package/src/workflow/__tests__/task-presentation.test.ts +35 -1
- package/src/workflow/__tests__/useWorkflowExecutionPanel.test.ts +0 -57
- package/src/workflow/index.ts +6 -3
- package/src/workflow/task-detail/index.ts +3 -0
- package/src/workflow/task-detail/task-approval.ts +95 -1
- package/src/workflow/thread/WorkflowTaskThread.tsx +96 -252
- package/src/workflow/thread/task-presentation.ts +8 -2
- package/src/workflow/useWorkflowExecutionPanel.ts +0 -47
- package/styles.css +1 -1
- package/workflow/CanvasTransitionEdge.d.ts +1 -1
- package/workflow/WorkflowAgentCallTranscript.d.ts +87 -0
- package/workflow/WorkflowAgentCallTranscript.d.ts.map +1 -0
- package/workflow/WorkflowAgentCallTranscript.js +98 -0
- package/workflow/WorkflowAgentCallTranscript.js.map +1 -0
- package/workflow/WorkflowDetailView.d.ts.map +1 -1
- package/workflow/WorkflowDetailView.js +4 -3
- package/workflow/WorkflowDetailView.js.map +1 -1
- package/workflow/WorkflowExecutionViewer.d.ts.map +1 -1
- package/workflow/WorkflowExecutionViewer.js +23 -52
- package/workflow/WorkflowExecutionViewer.js.map +1 -1
- package/workflow/WorkflowTaskApprovalSummary.d.ts +1 -1
- package/workflow/WorkflowTaskApprovalSummary.d.ts.map +1 -1
- package/workflow/WorkflowTaskApprovalSummary.js +18 -1
- package/workflow/WorkflowTaskApprovalSummary.js.map +1 -1
- package/workflow/WorkflowYamlEditor.d.ts +2 -42
- package/workflow/WorkflowYamlEditor.d.ts.map +1 -1
- package/workflow/WorkflowYamlEditor.js +5 -214
- package/workflow/WorkflowYamlEditor.js.map +1 -1
- package/workflow/index.d.ts +2 -2
- package/workflow/index.d.ts.map +1 -1
- package/workflow/index.js +2 -2
- package/workflow/index.js.map +1 -1
- package/workflow/task-detail/index.d.ts +1 -1
- package/workflow/task-detail/index.d.ts.map +1 -1
- package/workflow/task-detail/index.js +1 -1
- package/workflow/task-detail/index.js.map +1 -1
- package/workflow/task-detail/task-approval.d.ts +44 -1
- package/workflow/task-detail/task-approval.d.ts.map +1 -1
- package/workflow/task-detail/task-approval.js +47 -0
- package/workflow/task-detail/task-approval.js.map +1 -1
- package/workflow/thread/WorkflowTaskThread.d.ts +17 -25
- package/workflow/thread/WorkflowTaskThread.d.ts.map +1 -1
- package/workflow/thread/WorkflowTaskThread.js +60 -105
- package/workflow/thread/WorkflowTaskThread.js.map +1 -1
- package/workflow/thread/task-presentation.d.ts.map +1 -1
- package/workflow/thread/task-presentation.js +7 -2
- package/workflow/thread/task-presentation.js.map +1 -1
- package/workflow/useWorkflowExecutionPanel.d.ts +0 -12
- package/workflow/useWorkflowExecutionPanel.d.ts.map +1 -1
- package/workflow/useWorkflowExecutionPanel.js +0 -12
- package/workflow/useWorkflowExecutionPanel.js.map +1 -1
- package/execution/agent-execution-document.d.ts +0 -31
- package/execution/agent-execution-document.d.ts.map +0 -1
- package/execution/agent-execution-document.js +0 -48
- package/execution/agent-execution-document.js.map +0 -1
- package/library/ImportResourceDialog.d.ts +0 -43
- package/library/ImportResourceDialog.d.ts.map +0 -1
- package/library/ImportResourceDialog.js +0 -90
- package/library/ImportResourceDialog.js.map +0 -1
- package/library/parse-resource-yaml.d.ts +0 -63
- package/library/parse-resource-yaml.d.ts.map +0 -1
- package/library/parse-resource-yaml.js +0 -407
- package/library/parse-resource-yaml.js.map +0 -1
- package/library/serialize-resource-yaml.d.ts +0 -103
- package/library/serialize-resource-yaml.d.ts.map +0 -1
- package/library/serialize-resource-yaml.js +0 -565
- package/library/serialize-resource-yaml.js.map +0 -1
- package/library/useImportResource.d.ts +0 -84
- package/library/useImportResource.d.ts.map +0 -1
- package/library/useImportResource.js +0 -188
- package/library/useImportResource.js.map +0 -1
- package/src/execution/__tests__/agent-execution-document.test.ts +0 -45
- package/src/execution/agent-execution-document.ts +0 -54
- package/src/library/ImportResourceDialog.tsx +0 -227
- package/src/library/parse-resource-yaml.ts +0 -630
- package/src/library/serialize-resource-yaml.ts +0 -756
- package/src/library/useImportResource.ts +0 -253
- package/src/workflow/WorkflowAgentExecutionDocument.tsx +0 -283
- package/workflow/WorkflowAgentExecutionDocument.d.ts +0 -79
- package/workflow/WorkflowAgentExecutionDocument.d.ts.map +0 -1
- package/workflow/WorkflowAgentExecutionDocument.js +0 -87
- package/workflow/WorkflowAgentExecutionDocument.js.map +0 -1
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useEffect, memo, } from "react";
|
|
4
|
+
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { EditorState, Compartment } from "@codemirror/state";
|
|
6
|
+
import { EditorView, keymap, lineNumbers, highlightActiveLine, drawSelection, highlightSpecialChars } from "@codemirror/view";
|
|
7
|
+
import { yaml } from "@codemirror/lang-yaml";
|
|
8
|
+
import { syntaxHighlighting, HighlightStyle, bracketMatching, indentOnInput, foldGutter } from "@codemirror/language";
|
|
9
|
+
import { tags } from "@lezer/highlight";
|
|
10
|
+
import { lintGutter, setDiagnostics } from "@codemirror/lint";
|
|
11
|
+
import { defaultKeymap, indentWithTab, history, historyKeymap } from "@codemirror/commands";
|
|
12
|
+
import { autocompletion } from "@codemirror/autocomplete";
|
|
13
|
+
/**
|
|
14
|
+
* YAML editor built on CodeMirror 6, shared by every YAML surface in the
|
|
15
|
+
* SDK (workflow editor tab, resource manifest dialogs).
|
|
16
|
+
*
|
|
17
|
+
* Provides syntax highlighting, line numbers, bracket matching,
|
|
18
|
+
* code folding, undo/redo, and inline diagnostic markers driven by
|
|
19
|
+
* external validation (via the `diagnostics` prop).
|
|
20
|
+
*
|
|
21
|
+
* Themed via `--stgm-*` CSS custom properties to respect the host
|
|
22
|
+
* application's design tokens.
|
|
23
|
+
*
|
|
24
|
+
* This is an optional SDK component — it requires CodeMirror peer
|
|
25
|
+
* dependencies. Consumers that render it conditionally should load it
|
|
26
|
+
* via `React.lazy` so the CodeMirror bundle stays out of paths that
|
|
27
|
+
* never open an editor (DD-013).
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <YamlEditor
|
|
32
|
+
* value={yaml}
|
|
33
|
+
* onChange={setYaml}
|
|
34
|
+
* diagnostics={diagnostics}
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export const YamlEditor = memo(function YamlEditor({ value, onChange, diagnostics, readOnly = false, className, style, }) {
|
|
39
|
+
const containerRef = useRef(null);
|
|
40
|
+
const viewRef = useRef(null);
|
|
41
|
+
const readOnlyCompartment = useRef(new Compartment());
|
|
42
|
+
const onChangeRef = useRef(onChange);
|
|
43
|
+
onChangeRef.current = onChange;
|
|
44
|
+
const isInternalUpdate = useRef(false);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!containerRef.current)
|
|
47
|
+
return;
|
|
48
|
+
const updateListener = EditorView.updateListener.of((update) => {
|
|
49
|
+
if (update.docChanged) {
|
|
50
|
+
isInternalUpdate.current = true;
|
|
51
|
+
onChangeRef.current?.(update.state.doc.toString());
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const state = EditorState.create({
|
|
55
|
+
doc: value,
|
|
56
|
+
extensions: [
|
|
57
|
+
lineNumbers(),
|
|
58
|
+
highlightActiveLine(),
|
|
59
|
+
highlightSpecialChars(),
|
|
60
|
+
drawSelection(),
|
|
61
|
+
bracketMatching(),
|
|
62
|
+
indentOnInput(),
|
|
63
|
+
foldGutter(),
|
|
64
|
+
history(),
|
|
65
|
+
yaml(),
|
|
66
|
+
syntaxHighlighting(stigmerHighlightStyle, { fallback: true }),
|
|
67
|
+
autocompletion(),
|
|
68
|
+
lintGutter(),
|
|
69
|
+
keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab]),
|
|
70
|
+
readOnlyCompartment.current.of(EditorState.readOnly.of(readOnly)),
|
|
71
|
+
stigmerTheme,
|
|
72
|
+
updateListener,
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
const view = new EditorView({
|
|
76
|
+
state,
|
|
77
|
+
parent: containerRef.current,
|
|
78
|
+
});
|
|
79
|
+
viewRef.current = view;
|
|
80
|
+
return () => {
|
|
81
|
+
view.destroy();
|
|
82
|
+
viewRef.current = null;
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
// Sync external value changes into the editor
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const view = viewRef.current;
|
|
88
|
+
if (!view)
|
|
89
|
+
return;
|
|
90
|
+
if (isInternalUpdate.current) {
|
|
91
|
+
isInternalUpdate.current = false;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const currentDoc = view.state.doc.toString();
|
|
95
|
+
if (currentDoc !== value) {
|
|
96
|
+
view.dispatch({
|
|
97
|
+
changes: {
|
|
98
|
+
from: 0,
|
|
99
|
+
to: currentDoc.length,
|
|
100
|
+
insert: value,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}, [value]);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const view = viewRef.current;
|
|
107
|
+
if (!view)
|
|
108
|
+
return;
|
|
109
|
+
view.dispatch({
|
|
110
|
+
effects: readOnlyCompartment.current.reconfigure(EditorState.readOnly.of(readOnly)),
|
|
111
|
+
});
|
|
112
|
+
}, [readOnly]);
|
|
113
|
+
// Sync diagnostics into CodeMirror's lint system
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
const view = viewRef.current;
|
|
116
|
+
if (!view)
|
|
117
|
+
return;
|
|
118
|
+
const cmDiags = diagnostics
|
|
119
|
+
? diagnostics.map((d) => ({
|
|
120
|
+
...d,
|
|
121
|
+
from: Math.min(d.from, view.state.doc.length),
|
|
122
|
+
to: Math.min(d.to, view.state.doc.length),
|
|
123
|
+
}))
|
|
124
|
+
: [];
|
|
125
|
+
view.dispatch(setDiagnostics(view.state, cmDiags));
|
|
126
|
+
}, [diagnostics]);
|
|
127
|
+
return (_jsx("div", { ref: containerRef, className: cn("stgm-yaml-editor overflow-auto rounded-md border border-border bg-background font-mono text-sm", className), style: style }));
|
|
128
|
+
});
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
// Syntax highlighting: maps lezer tags to --stgm-syntax-* CSS variables
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
const stigmerHighlightStyle = HighlightStyle.define([
|
|
133
|
+
{ tag: tags.propertyName, color: "var(--stgm-syntax-property, #0550ae)" },
|
|
134
|
+
{ tag: tags.tagName, color: "var(--stgm-syntax-tag, #cf222e)" },
|
|
135
|
+
{ tag: tags.keyword, color: "var(--stgm-syntax-keyword, #8250df)", fontWeight: "bold" },
|
|
136
|
+
{ tag: tags.string, color: "var(--stgm-syntax-string, #0a3069)" },
|
|
137
|
+
{ tag: tags.number, color: "var(--stgm-syntax-number, #953800)" },
|
|
138
|
+
{ tag: [tags.bool, tags.null], color: "var(--stgm-syntax-bool, #8250df)" },
|
|
139
|
+
{ tag: tags.atom, color: "var(--stgm-syntax-atom, #cf222e)" },
|
|
140
|
+
{ tag: tags.comment, color: "var(--stgm-syntax-comment, #6e7781)", fontStyle: "italic" },
|
|
141
|
+
{ tag: tags.meta, color: "var(--stgm-syntax-meta, #8250df)" },
|
|
142
|
+
{ tag: tags.name, color: "var(--stgm-foreground, #1a1a2e)" },
|
|
143
|
+
{ tag: tags.definition(tags.name), color: "var(--stgm-syntax-property, #0550ae)" },
|
|
144
|
+
{ tag: tags.separator, color: "var(--stgm-muted-foreground, #737373)" },
|
|
145
|
+
{ tag: tags.punctuation, color: "var(--stgm-muted-foreground, #737373)" },
|
|
146
|
+
]);
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
// CodeMirror theme bridge: maps --stgm-* tokens to editor styles
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
const stigmerTheme = EditorView.theme({
|
|
151
|
+
"&": {
|
|
152
|
+
height: "100%",
|
|
153
|
+
backgroundColor: "var(--stgm-background, #fff)",
|
|
154
|
+
color: "var(--stgm-foreground, #1a1a2e)",
|
|
155
|
+
fontSize: "13px",
|
|
156
|
+
},
|
|
157
|
+
".cm-content": {
|
|
158
|
+
caretColor: "var(--stgm-foreground, #1a1a2e)",
|
|
159
|
+
fontFamily: "var(--stgm-font-mono, ui-monospace, monospace)",
|
|
160
|
+
padding: "8px 0",
|
|
161
|
+
},
|
|
162
|
+
".cm-cursor, .cm-dropCursor": {
|
|
163
|
+
borderLeftColor: "var(--stgm-foreground, #1a1a2e)",
|
|
164
|
+
},
|
|
165
|
+
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": {
|
|
166
|
+
backgroundColor: "var(--stgm-accent, #e0e7ff)",
|
|
167
|
+
},
|
|
168
|
+
".cm-gutters": {
|
|
169
|
+
backgroundColor: "var(--stgm-muted, #f5f5f5)",
|
|
170
|
+
color: "var(--stgm-muted-foreground, #737373)",
|
|
171
|
+
border: "none",
|
|
172
|
+
borderRight: "1px solid var(--stgm-border, #e5e5e5)",
|
|
173
|
+
},
|
|
174
|
+
".cm-activeLineGutter": {
|
|
175
|
+
backgroundColor: "var(--stgm-accent, #e0e7ff)",
|
|
176
|
+
},
|
|
177
|
+
".cm-activeLine": {
|
|
178
|
+
backgroundColor: "color-mix(in srgb, var(--stgm-accent, #e0e7ff) 30%, transparent)",
|
|
179
|
+
},
|
|
180
|
+
".cm-foldPlaceholder": {
|
|
181
|
+
backgroundColor: "var(--stgm-muted, #f5f5f5)",
|
|
182
|
+
border: "1px solid var(--stgm-border, #e5e5e5)",
|
|
183
|
+
color: "var(--stgm-muted-foreground, #737373)",
|
|
184
|
+
},
|
|
185
|
+
".cm-tooltip": {
|
|
186
|
+
backgroundColor: "var(--stgm-popover, #fff)",
|
|
187
|
+
color: "var(--stgm-popover-foreground, #1a1a2e)",
|
|
188
|
+
border: "1px solid var(--stgm-border, #e5e5e5)",
|
|
189
|
+
borderRadius: "6px",
|
|
190
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.08)",
|
|
191
|
+
},
|
|
192
|
+
".cm-tooltip-autocomplete": {
|
|
193
|
+
"& > ul > li[aria-selected]": {
|
|
194
|
+
backgroundColor: "var(--stgm-accent, #e0e7ff)",
|
|
195
|
+
color: "var(--stgm-accent-foreground, #1a1a2e)",
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
".cm-diagnostic-error": {
|
|
199
|
+
borderLeft: "3px solid var(--stgm-destructive, #ef4444)",
|
|
200
|
+
},
|
|
201
|
+
".cm-diagnostic-warning": {
|
|
202
|
+
borderLeft: "3px solid var(--stgm-warning, #f59e0b)",
|
|
203
|
+
},
|
|
204
|
+
".cm-diagnostic-info": {
|
|
205
|
+
borderLeft: "3px solid var(--stgm-primary, #6366f1)",
|
|
206
|
+
},
|
|
207
|
+
".cm-lint-marker-error": {
|
|
208
|
+
content: "'●'",
|
|
209
|
+
color: "var(--stgm-destructive, #ef4444)",
|
|
210
|
+
},
|
|
211
|
+
".cm-lint-marker-warning": {
|
|
212
|
+
content: "'●'",
|
|
213
|
+
color: "var(--stgm-warning, #f59e0b)",
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
//# sourceMappingURL=YamlEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YamlEditor.js","sourceRoot":"","sources":["../../src/manifest/YamlEditor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,SAAS,EACT,IAAI,GAEL,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,UAAU,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,EAAE,KAAK;QACnB,SAAS,EAAE,4BAA4B;KACxC;IACD,0BAA0B,EAAE;QAC1B,4BAA4B,EAAE;YAC5B,eAAe,EAAE,6BAA6B;YAC9C,KAAK,EAAE,wCAAwC;SAChD;KACF;IACD,sBAAsB,EAAE;QACtB,UAAU,EAAE,4CAA4C;KACzD;IACD,wBAAwB,EAAE;QACxB,UAAU,EAAE,wCAAwC;KACrD;IACD,qBAAqB,EAAE;QACrB,UAAU,EAAE,wCAAwC;KACrD;IACD,uBAAuB,EAAE;QACvB,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,kCAAkC;KAC1C;IACD,yBAAyB,EAAE;QACzB,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,8BAA8B;KACtC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { YamlEditor } from "./YamlEditor.js";
|
|
2
|
+
export type { YamlEditorProps } from "./YamlEditor.js";
|
|
3
|
+
export { useEditResourceYaml } from "./useEditResourceYaml.js";
|
|
4
|
+
export type { EditYamlTarget, EditYamlValidation, UseEditResourceYamlOptions, UseEditResourceYamlReturn, } from "./useEditResourceYaml.js";
|
|
5
|
+
export { useApplyManifest } from "./useApplyManifest.js";
|
|
6
|
+
export type { ManifestEntryStatus, ManifestPreviewEntry, UseApplyManifestReturn, } from "./useApplyManifest.js";
|
|
7
|
+
export { EditResourceYamlDialog } from "./EditResourceYamlDialog.js";
|
|
8
|
+
export type { EditResourceYamlDialogProps } from "./EditResourceYamlDialog.js";
|
|
9
|
+
export { ApplyManifestDialog } from "./ApplyManifestDialog.js";
|
|
10
|
+
export type { ApplyManifestDialogProps } from "./ApplyManifestDialog.js";
|
|
11
|
+
export { RedactedSecretsNotice } from "./RedactedSecretsNotice.js";
|
|
12
|
+
export type { RedactedSecretsNoticeProps } from "./RedactedSecretsNotice.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Manifest domain: the console-facing YAML edit/apply experience for every
|
|
2
|
+
// registry-supported resource kind, built on the @stigmer/sdk manifest
|
|
3
|
+
// engine (parseManifest / serializeManifest / stigmer.manifest).
|
|
4
|
+
//
|
|
5
|
+
// Headless-first (DD-003): the hooks are independently importable; the
|
|
6
|
+
// dialogs compose them with the shared YamlEditor.
|
|
7
|
+
export { YamlEditor } from "./YamlEditor.js";
|
|
8
|
+
export { useEditResourceYaml } from "./useEditResourceYaml.js";
|
|
9
|
+
export { useApplyManifest } from "./useApplyManifest.js";
|
|
10
|
+
export { EditResourceYamlDialog } from "./EditResourceYamlDialog.js";
|
|
11
|
+
export { ApplyManifestDialog } from "./ApplyManifestDialog.js";
|
|
12
|
+
export { RedactedSecretsNotice } from "./RedactedSecretsNotice.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,uEAAuE;AACvE,iEAAiE;AACjE,EAAE;AACF,uEAAuE;AACvE,mDAAmD;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAQ/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type AppliedManifest, type ManifestDocument } from "@stigmer/sdk";
|
|
2
|
+
/** Per-document apply lifecycle within one manifest. */
|
|
3
|
+
export type ManifestEntryStatus = "pending" | "applying" | "applied" | "failed"
|
|
4
|
+
/** A prior document failed; this one was not attempted. */
|
|
5
|
+
| "skipped";
|
|
6
|
+
/** One document of the manifest, with its preview and apply state. */
|
|
7
|
+
export interface ManifestPreviewEntry {
|
|
8
|
+
/** The parsed document (kind handler, message, name/slug/org). */
|
|
9
|
+
readonly document: ManifestDocument;
|
|
10
|
+
/** What applying will do, resolved against live server state. */
|
|
11
|
+
readonly action: "create" | "update" | "unknown";
|
|
12
|
+
/** Apply lifecycle status. */
|
|
13
|
+
readonly status: ManifestEntryStatus;
|
|
14
|
+
/** The applied resource, present when `status` is `"applied"`. */
|
|
15
|
+
readonly result?: AppliedManifest;
|
|
16
|
+
/** User-facing failure message, present when `status` is `"failed"`. */
|
|
17
|
+
readonly errorMessage?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Return value of {@link useApplyManifest}. */
|
|
20
|
+
export interface UseApplyManifestReturn {
|
|
21
|
+
/** Current manifest text (paste target). */
|
|
22
|
+
readonly content: string;
|
|
23
|
+
/** Update the manifest text. Re-validates (debounced). */
|
|
24
|
+
readonly setContent: (value: string) => void;
|
|
25
|
+
/** Read a `.yaml`/`.yml`/`.json` file into `content`. */
|
|
26
|
+
readonly readFile: (file: File) => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Validated per-document preview in dependency apply order, or `null`
|
|
29
|
+
* while the content is empty or invalid.
|
|
30
|
+
*/
|
|
31
|
+
readonly entries: readonly ManifestPreviewEntry[] | null;
|
|
32
|
+
/** Validation error for the current content, or `null` when valid. */
|
|
33
|
+
readonly validationError: string | null;
|
|
34
|
+
/** `true` while the (debounced) validation + existence checks run. */
|
|
35
|
+
readonly isValidating: boolean;
|
|
36
|
+
/** `true` when the content contains `***REDACTED***` secret markers. */
|
|
37
|
+
readonly hasRedactedSecrets: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Apply all documents sequentially in dependency order. Entries update
|
|
40
|
+
* live. Stops at the first failure (later entries become `"skipped"`).
|
|
41
|
+
* Resolves `true` when every document applied.
|
|
42
|
+
*/
|
|
43
|
+
readonly applyAll: () => Promise<boolean>;
|
|
44
|
+
/** `true` while applies are in flight. */
|
|
45
|
+
readonly isApplying: boolean;
|
|
46
|
+
/** Clear all state (content, preview, errors). */
|
|
47
|
+
readonly reset: () => void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Headless "apply a YAML manifest" flow for any registry-supported kind —
|
|
51
|
+
* the console counterpart of `stigmer apply -f`.
|
|
52
|
+
*
|
|
53
|
+
* Orchestrates: paste or upload → strict parse against generated proto
|
|
54
|
+
* schemas ({@link parseManifest}) → per-document create-vs-update preview
|
|
55
|
+
* (server existence check) → sequential apply in dependency order with
|
|
56
|
+
* live per-document status.
|
|
57
|
+
*
|
|
58
|
+
* Accepts multi-document manifests (`---` separators) and JSON content
|
|
59
|
+
* (YAML is a superset). The target `org` is injected into documents that
|
|
60
|
+
* omit `metadata.org`; documents naming a *different* org are honored and
|
|
61
|
+
* apply there (matching `stigmer apply` semantics — the org-mismatch
|
|
62
|
+
* warning surfaces on the parsed document).
|
|
63
|
+
*
|
|
64
|
+
* @param org - Target organization slug for `metadata.org` injection.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```tsx
|
|
68
|
+
* const manifest = useApplyManifest(activeOrg);
|
|
69
|
+
*
|
|
70
|
+
* <textarea value={manifest.content}
|
|
71
|
+
* onChange={(e) => manifest.setContent(e.target.value)} />
|
|
72
|
+
* {manifest.entries?.map((e) => (
|
|
73
|
+
* <PreviewRow key={e.document.slug} entry={e} />
|
|
74
|
+
* ))}
|
|
75
|
+
* <button onClick={manifest.applyAll} disabled={!manifest.entries}>Apply</button>
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @see {@link ApplyManifestDialog} for the styled component composing this hook
|
|
79
|
+
* @see {@link useEditResourceYaml} for the edit-in-place counterpart
|
|
80
|
+
*/
|
|
81
|
+
export declare function useApplyManifest(org: string): UseApplyManifestReturn;
|
|
82
|
+
//# sourceMappingURL=useApplyManifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useApplyManifest.d.ts","sourceRoot":"","sources":["../../src/manifest/useApplyManifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAItB,wDAAwD;AACxD,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,UAAU,GACV,SAAS,GACT,QAAQ;AACV,2DAA2D;GACzD,SAAS,CAAC;AAEd,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,iEAAiE;IACjE,QAAQ,CA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ef, useState } from "react";
|
|
3
|
+
import { containsRedactedSecrets, parseManifest, } from "@stigmer/sdk";
|
|
4
|
+
import { useStigmer } from "../hooks.js";
|
|
5
|
+
import { toError } from "../internal/toError.js";
|
|
6
|
+
// Validation parses + resolves existence server-side; wait for a typing pause.
|
|
7
|
+
const VALIDATE_DEBOUNCE_MS = 500;
|
|
8
|
+
/**
|
|
9
|
+
* Headless "apply a YAML manifest" flow for any registry-supported kind —
|
|
10
|
+
* the console counterpart of `stigmer apply -f`.
|
|
11
|
+
*
|
|
12
|
+
* Orchestrates: paste or upload → strict parse against generated proto
|
|
13
|
+
* schemas ({@link parseManifest}) → per-document create-vs-update preview
|
|
14
|
+
* (server existence check) → sequential apply in dependency order with
|
|
15
|
+
* live per-document status.
|
|
16
|
+
*
|
|
17
|
+
* Accepts multi-document manifests (`---` separators) and JSON content
|
|
18
|
+
* (YAML is a superset). The target `org` is injected into documents that
|
|
19
|
+
* omit `metadata.org`; documents naming a *different* org are honored and
|
|
20
|
+
* apply there (matching `stigmer apply` semantics — the org-mismatch
|
|
21
|
+
* warning surfaces on the parsed document).
|
|
22
|
+
*
|
|
23
|
+
* @param org - Target organization slug for `metadata.org` injection.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const manifest = useApplyManifest(activeOrg);
|
|
28
|
+
*
|
|
29
|
+
* <textarea value={manifest.content}
|
|
30
|
+
* onChange={(e) => manifest.setContent(e.target.value)} />
|
|
31
|
+
* {manifest.entries?.map((e) => (
|
|
32
|
+
* <PreviewRow key={e.document.slug} entry={e} />
|
|
33
|
+
* ))}
|
|
34
|
+
* <button onClick={manifest.applyAll} disabled={!manifest.entries}>Apply</button>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @see {@link ApplyManifestDialog} for the styled component composing this hook
|
|
38
|
+
* @see {@link useEditResourceYaml} for the edit-in-place counterpart
|
|
39
|
+
*/
|
|
40
|
+
export function useApplyManifest(org) {
|
|
41
|
+
const stigmer = useStigmer();
|
|
42
|
+
const [content, setContentState] = useState("");
|
|
43
|
+
const [entries, setEntries] = useState(null);
|
|
44
|
+
const [validationError, setValidationError] = useState(null);
|
|
45
|
+
const [isValidating, setIsValidating] = useState(false);
|
|
46
|
+
const [isApplying, setIsApplying] = useState(false);
|
|
47
|
+
const orgRef = useRef(org);
|
|
48
|
+
orgRef.current = org;
|
|
49
|
+
const setContent = useCallback((value) => {
|
|
50
|
+
setContentState(value);
|
|
51
|
+
}, []);
|
|
52
|
+
const readFile = useCallback(async (file) => {
|
|
53
|
+
let text;
|
|
54
|
+
try {
|
|
55
|
+
text = await file.text();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
setContentState("");
|
|
59
|
+
setEntries(null);
|
|
60
|
+
setValidationError(`Failed to read ${file.name}.`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
setContentState(text);
|
|
64
|
+
}, []);
|
|
65
|
+
const reset = useCallback(() => {
|
|
66
|
+
setContentState("");
|
|
67
|
+
setEntries(null);
|
|
68
|
+
setValidationError(null);
|
|
69
|
+
setIsValidating(false);
|
|
70
|
+
setIsApplying(false);
|
|
71
|
+
}, []);
|
|
72
|
+
// Debounced validation + existence resolution, cancellation-safe. Applies
|
|
73
|
+
// freeze the preview: entries carry live statuses the validator must not
|
|
74
|
+
// clobber mid-run.
|
|
75
|
+
const validateSeq = useRef(0);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (isApplying)
|
|
78
|
+
return;
|
|
79
|
+
const seq = ++validateSeq.current;
|
|
80
|
+
if (!content.trim()) {
|
|
81
|
+
setEntries(null);
|
|
82
|
+
setValidationError(null);
|
|
83
|
+
setIsValidating(false);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
setIsValidating(true);
|
|
87
|
+
const timer = setTimeout(async () => {
|
|
88
|
+
let documents;
|
|
89
|
+
try {
|
|
90
|
+
documents = parseManifest(content, { org: orgRef.current });
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
if (validateSeq.current === seq) {
|
|
94
|
+
setEntries(null);
|
|
95
|
+
setValidationError(toError(err).message);
|
|
96
|
+
setIsValidating(false);
|
|
97
|
+
}
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const resolved = await Promise.all(documents.map(async (document) => {
|
|
101
|
+
let action;
|
|
102
|
+
try {
|
|
103
|
+
const existing = await stigmer.manifest.getByReference(document.handler.yamlKind, document.org, document.slug);
|
|
104
|
+
action = existing !== null ? "update" : "create";
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
action = "unknown";
|
|
108
|
+
}
|
|
109
|
+
return { document, action, status: "pending" };
|
|
110
|
+
}));
|
|
111
|
+
if (validateSeq.current === seq) {
|
|
112
|
+
setEntries(resolved);
|
|
113
|
+
setValidationError(null);
|
|
114
|
+
setIsValidating(false);
|
|
115
|
+
}
|
|
116
|
+
}, VALIDATE_DEBOUNCE_MS);
|
|
117
|
+
return () => clearTimeout(timer);
|
|
118
|
+
}, [content, stigmer, isApplying]);
|
|
119
|
+
const applyAll = useCallback(async () => {
|
|
120
|
+
if (!entries || entries.length === 0)
|
|
121
|
+
return false;
|
|
122
|
+
// Invalidate any in-flight validation so it cannot clobber apply statuses.
|
|
123
|
+
validateSeq.current++;
|
|
124
|
+
setIsApplying(true);
|
|
125
|
+
// Local working copy — React state is updated per transition so the
|
|
126
|
+
// dialog renders progress live.
|
|
127
|
+
const working = entries.map((entry) => ({ ...entry, status: "pending" }));
|
|
128
|
+
const commit = () => setEntries([...working]);
|
|
129
|
+
let allApplied = true;
|
|
130
|
+
for (let i = 0; i < working.length; i++) {
|
|
131
|
+
if (!allApplied) {
|
|
132
|
+
working[i] = { ...working[i], status: "skipped" };
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
working[i] = { ...working[i], status: "applying" };
|
|
136
|
+
commit();
|
|
137
|
+
try {
|
|
138
|
+
const result = await stigmer.manifest.apply(working[i].document);
|
|
139
|
+
working[i] = { ...working[i], status: "applied", result };
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
working[i] = {
|
|
143
|
+
...working[i],
|
|
144
|
+
status: "failed",
|
|
145
|
+
errorMessage: toError(err).message,
|
|
146
|
+
};
|
|
147
|
+
allApplied = false;
|
|
148
|
+
}
|
|
149
|
+
commit();
|
|
150
|
+
}
|
|
151
|
+
commit();
|
|
152
|
+
setIsApplying(false);
|
|
153
|
+
return allApplied;
|
|
154
|
+
}, [entries, stigmer]);
|
|
155
|
+
const hasRedactedSecrets = useMemo(() => containsRedactedSecrets(content), [content]);
|
|
156
|
+
return useMemo(() => ({
|
|
157
|
+
content,
|
|
158
|
+
setContent,
|
|
159
|
+
readFile,
|
|
160
|
+
entries,
|
|
161
|
+
validationError,
|
|
162
|
+
isValidating,
|
|
163
|
+
hasRedactedSecrets,
|
|
164
|
+
applyAll,
|
|
165
|
+
isApplying,
|
|
166
|
+
reset,
|
|
167
|
+
}), [
|
|
168
|
+
content,
|
|
169
|
+
setContent,
|
|
170
|
+
readFile,
|
|
171
|
+
entries,
|
|
172
|
+
validationError,
|
|
173
|
+
isValidating,
|
|
174
|
+
hasRedactedSecrets,
|
|
175
|
+
applyAll,
|
|
176
|
+
isApplying,
|
|
177
|
+
reset,
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=useApplyManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useApplyManifest.js","sourceRoot":"","sources":["../../src/manifest/useApplyManifest.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,uBAAuB,EACvB,aAAa,GAGd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAA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C,KAAK,CAAC,CAAC;QACrB,OAAO,UAAU,CAAC;IACpB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvB,MAAM,kBAAkB,GAAG,OAAO,CAChC,GAAG,EAAE,CAAC,uBAAuB,CAAC,OAAO,CAAC,EACtC,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,OAAO;QACP,UAAU;QACV,QAAQ;QACR,OAAO;QACP,eAAe;QACf,YAAY;QACZ,kBAAkB;QAClB,QAAQ;QACR,UAAU;QACV,KAAK;KACN,CAAC,EACF;QACE,OAAO;QACP,UAAU;QACV,QAAQ;QACR,OAAO;QACP,eAAe;QACf,YAAY;QACZ,kBAAkB;QAClB,QAAQ;QACR,UAAU;QACV,KAAK;KACN,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
2
|
+
import { type AppliedManifest, type ManifestDocument } from "@stigmer/sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Result of validating the edited YAML against the source resource.
|
|
5
|
+
*
|
|
6
|
+
* Discriminated on `status` so consumers can render exactly one of:
|
|
7
|
+
* a disabled state (`empty`), an inline error (`invalid`), or the
|
|
8
|
+
* apply affordance (`valid`).
|
|
9
|
+
*/
|
|
10
|
+
export type EditYamlValidation = {
|
|
11
|
+
readonly status: "empty";
|
|
12
|
+
} | {
|
|
13
|
+
readonly status: "invalid";
|
|
14
|
+
readonly message: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly status: "valid";
|
|
17
|
+
readonly document: ManifestDocument;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* What applying the current content will do — resolved against live
|
|
21
|
+
* server state so renames surface as "create" before the user commits.
|
|
22
|
+
*/
|
|
23
|
+
export type EditYamlTarget = {
|
|
24
|
+
readonly action: "update";
|
|
25
|
+
readonly slug: string;
|
|
26
|
+
} | {
|
|
27
|
+
readonly action: "create";
|
|
28
|
+
readonly slug: string;
|
|
29
|
+
}
|
|
30
|
+
/** Existence lookup failed (offline, permissions) — wording degrades. */
|
|
31
|
+
| {
|
|
32
|
+
readonly action: "unknown";
|
|
33
|
+
readonly slug: string;
|
|
34
|
+
};
|
|
35
|
+
/** Options for {@link useEditResourceYaml}. */
|
|
36
|
+
export interface UseEditResourceYamlOptions {
|
|
37
|
+
/**
|
|
38
|
+
* The resource to edit, as returned by the server (e.g. from `useAgent`
|
|
39
|
+
* or a list panel row). `null` while the resource is loading — the hook
|
|
40
|
+
* seeds the editor when it arrives.
|
|
41
|
+
*/
|
|
42
|
+
readonly resource: Message | null;
|
|
43
|
+
}
|
|
44
|
+
/** Return value of {@link useEditResourceYaml}. */
|
|
45
|
+
export interface UseEditResourceYamlReturn {
|
|
46
|
+
/** Current editor content. */
|
|
47
|
+
readonly yaml: string;
|
|
48
|
+
/** Update the editor content (wire to the YAML editor's `onChange`). */
|
|
49
|
+
readonly setYaml: (value: string) => void;
|
|
50
|
+
/** `true` when the content differs from the seeded serialization. */
|
|
51
|
+
readonly isDirty: boolean;
|
|
52
|
+
/** Live validation of the current content. */
|
|
53
|
+
readonly validation: EditYamlValidation;
|
|
54
|
+
/**
|
|
55
|
+
* Create-vs-update preview for the current content, or `null` while
|
|
56
|
+
* validation fails or the existence check is in flight.
|
|
57
|
+
*/
|
|
58
|
+
readonly target: EditYamlTarget | null;
|
|
59
|
+
/** `true` when the content contains `***REDACTED***` secret markers. */
|
|
60
|
+
readonly hasRedactedSecrets: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Apply the edited YAML. Resolves with the applied resource, or `null`
|
|
63
|
+
* when the content is not currently valid (check `validation`).
|
|
64
|
+
*/
|
|
65
|
+
readonly apply: () => Promise<AppliedManifest | null>;
|
|
66
|
+
/** `true` while the apply RPC is in flight. */
|
|
67
|
+
readonly isApplying: boolean;
|
|
68
|
+
/** Error from the last failed apply, or `null` when healthy. */
|
|
69
|
+
readonly error: Error | null;
|
|
70
|
+
/** Clear the apply error (e.g. when the user edits again). */
|
|
71
|
+
readonly clearError: () => void;
|
|
72
|
+
/** Discard edits and reseed from the resource. */
|
|
73
|
+
readonly reset: () => void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Behavior hook for editing an existing resource as YAML and applying the
|
|
77
|
+
* result — the console's kind-agnostic "Edit YAML" flow.
|
|
78
|
+
*
|
|
79
|
+
* Seeds the editor from {@link serializeManifest} (full fidelity minus
|
|
80
|
+
* system-managed state), validates every edit against the kind's generated
|
|
81
|
+
* proto schema via {@link parseManifest} (strict — unknown fields fail
|
|
82
|
+
* loudly), previews create-vs-update by resolving the edited document's
|
|
83
|
+
* reference against the server, and applies through
|
|
84
|
+
* `stigmer.manifest.apply()`.
|
|
85
|
+
*
|
|
86
|
+
* Guardrails beyond the raw engine:
|
|
87
|
+
* - the edited document must stay the same kind as the source resource
|
|
88
|
+
* (pasting an Environment into an Agent editor is an error, not an apply)
|
|
89
|
+
* - the edited manifest must contain exactly one document
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```tsx
|
|
93
|
+
* const edit = useEditResourceYaml({ resource: agent });
|
|
94
|
+
*
|
|
95
|
+
* <YamlEditor value={edit.yaml} onChange={edit.setYaml} />
|
|
96
|
+
* {edit.validation.status === "invalid" && <p>{edit.validation.message}</p>}
|
|
97
|
+
* <button disabled={edit.validation.status !== "valid"} onClick={edit.apply}>
|
|
98
|
+
* {edit.target?.action === "create" ? "Create" : "Apply changes"}
|
|
99
|
+
* </button>
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @see {@link EditResourceYamlDialog} for the styled component composing this hook
|
|
103
|
+
* @see {@link useApplyManifest} for the paste/upload counterpart
|
|
104
|
+
*/
|
|
105
|
+
export declare function useEditResourceYaml({ resource, }: UseEditResourceYamlOptions): UseEditResourceYamlReturn;
|
|
106
|
+
//# sourceMappingURL=useEditResourceYaml.d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