@taskforcehq/taskforce 0.3.326 → 0.3.327
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/LICENSE.md +68 -0
- package/README.md +19 -0
- package/dist/Taskforce.module.css +2173 -561
- package/dist/TaskforceCore.d.ts +1 -0
- package/dist/TaskforceCore.js +65 -22
- package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.d.ts +1 -0
- package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.js +3 -2
- package/dist/annotatedAttachments/commandService.d.ts +68 -0
- package/dist/annotatedAttachments/commandService.js +348 -0
- package/dist/annotatedAttachments/service.d.ts +2 -0
- package/dist/annotatedAttachments/service.js +13 -12
- package/dist/cli.js +158 -9
- package/dist/cliOpenPort.d.ts +1 -0
- package/dist/cliOpenPort.js +4 -0
- package/dist/compat/taskforceAgentDefinitionCompat.d.ts +12 -0
- package/dist/compat/taskforceAgentDefinitionCompat.js +25 -0
- package/dist/compat/workspaceSyncCompat.js +6 -2
- package/dist/compat/workspaceSyncV3CombinedCoverageCompat.d.ts +6 -0
- package/dist/compat/workspaceSyncV3CombinedCoverageCompat.js +22 -0
- package/dist/compat/workspaceSyncV3OperationCompat.d.ts +7 -0
- package/dist/compat/workspaceSyncV3OperationCompat.js +30 -0
- package/dist/components/activity/EntityActivityTimeline.d.ts +10 -2
- package/dist/components/activity/EntityActivityTimeline.js +73 -35
- package/dist/components/context/AttachmentPreviewHost.d.ts +6 -0
- package/dist/components/context/AttachmentPreviewHost.js +222 -0
- package/dist/components/context/ContextAttachmentManager.d.ts +4 -0
- package/dist/components/context/ContextAttachmentManager.js +418 -208
- package/dist/components/features/AiProfilesModule.d.ts +24 -0
- package/dist/components/features/AiProfilesModule.js +744 -0
- package/dist/components/features/AnnotatedAttachmentWorkspace.d.ts +4 -1
- package/dist/components/features/AnnotatedAttachmentWorkspace.js +351 -79
- package/dist/components/features/DocumentGenerateModal.js +23 -5
- package/dist/components/features/DocumentIndex.d.ts +19 -1
- package/dist/components/features/DocumentIndex.js +104 -15
- package/dist/components/features/DocumentViewer.d.ts +9 -1
- package/dist/components/features/DocumentViewer.js +721 -100
- package/dist/components/features/DocumentWorkspace.d.ts +37 -2
- package/dist/components/features/DocumentWorkspace.js +21 -6
- package/dist/components/features/TaskSettings.d.ts +6 -27
- package/dist/components/features/TaskSettings.js +232 -143
- package/dist/components/features/TaskforceAgentsModule.d.ts +36 -0
- package/dist/components/features/TaskforceAgentsModule.js +1782 -0
- package/dist/components/features/agentBehavior/AgentBehaviorManagerShared.d.ts +94 -0
- package/dist/components/features/agentBehavior/AgentBehaviorManagerShared.js +70 -0
- package/dist/components/features/agentCapabilities/AgentCapabilitiesPrototype.d.ts +65 -0
- package/dist/components/features/agentCapabilities/AgentCapabilitiesPrototype.js +115 -0
- package/dist/components/features/agentRoles/RoleManagerPanel.d.ts +4 -0
- package/dist/components/features/agentRoles/RoleManagerPanel.js +382 -0
- package/dist/components/features/agentSkills/SkillManagerPanel.d.ts +5 -0
- package/dist/components/features/agentSkills/SkillManagerPanel.js +355 -0
- package/dist/components/features/documentWorkspaceModel.d.ts +16 -4
- package/dist/components/features/documentWorkspaceModel.js +30 -5
- package/dist/components/features/planning/PlanningArchiveConfirmation.d.ts +9 -0
- package/dist/components/features/planning/PlanningArchiveConfirmation.js +19 -0
- package/dist/components/features/planning/PlanningCardIdentity.d.ts +12 -0
- package/dist/components/features/planning/PlanningCardIdentity.js +44 -0
- package/dist/components/features/planning/PlanningEntityDetails.d.ts +36 -0
- package/dist/components/features/planning/PlanningEntityDetails.js +131 -0
- package/dist/components/features/planning/PlanningEntitySummary.d.ts +44 -0
- package/dist/components/features/planning/PlanningEntitySummary.js +97 -0
- package/dist/components/features/planning/PlanningLinkPicker.d.ts +9 -0
- package/dist/components/features/planning/PlanningLinkPicker.js +26 -0
- package/dist/components/features/planning/PlanningModule.d.ts +6 -0
- package/dist/components/features/planning/PlanningModule.js +571 -0
- package/dist/components/features/planning/PlanningOwnerDropdown.d.ts +27 -0
- package/dist/components/features/planning/PlanningOwnerDropdown.js +80 -0
- package/dist/components/features/planning/PlanningTaskArrangeControl.d.ts +5 -0
- package/dist/components/features/planning/PlanningTaskArrangeControl.js +11 -0
- package/dist/components/features/planning/PlanningTaskCard.d.ts +20 -0
- package/dist/components/features/planning/PlanningTaskCard.js +26 -0
- package/dist/components/features/planning/PlanningTaskOrderList.d.ts +10 -0
- package/dist/components/features/planning/PlanningTaskOrderList.js +52 -0
- package/dist/components/features/planning/PlanningUnlinkConfirmation.d.ts +15 -0
- package/dist/components/features/planning/PlanningUnlinkConfirmation.js +7 -0
- package/dist/components/features/planning/planningCreateIntent.d.ts +10 -0
- package/dist/components/features/planning/planningCreateIntent.js +16 -0
- package/dist/components/features/planning/planningNavigator.d.ts +33 -0
- package/dist/components/features/planning/planningNavigator.js +96 -0
- package/dist/components/features/planning/planningTaskArrangement.d.ts +18 -0
- package/dist/components/features/planning/planningTaskArrangement.js +106 -0
- package/dist/components/features/planning/planningWorkspaceModel.d.ts +121 -0
- package/dist/components/features/planning/planningWorkspaceModel.js +5 -0
- package/dist/components/features/settings/CategoryManager.js +2 -2
- package/dist/components/features/settings/TaxonomyEditor.js +1 -1
- package/dist/components/features/settings/TaxonomyManager.js +1 -1
- package/dist/components/features/settings/TypeManager.js +1 -1
- package/dist/components/features/taskforceAgentAssignments/AgentBehaviorAssignments.d.ts +10 -0
- package/dist/components/features/taskforceAgentAssignments/AgentBehaviorAssignments.js +175 -0
- package/dist/components/features/taskforceAgentAssignments/agentBehaviorCatalogApi.d.ts +27 -0
- package/dist/components/features/taskforceAgentAssignments/agentBehaviorCatalogApi.js +24 -0
- package/dist/components/features/taskforceAgentEditorModel.d.ts +109 -0
- package/dist/components/features/taskforceAgentEditorModel.js +145 -0
- package/dist/components/features/useDocumentWorkspaceController.d.ts +20 -1
- package/dist/components/features/useDocumentWorkspaceController.js +106 -21
- package/dist/components/features/workflowManager/WorkflowManagerModule.d.ts +11 -0
- package/dist/components/features/workflowManager/WorkflowManagerModule.js +313 -0
- package/dist/components/features/workflowManager/WorkflowPublishDialog.d.ts +11 -0
- package/dist/components/features/workflowManager/WorkflowPublishDialog.js +8 -0
- package/dist/components/features/workflowManager/types.d.ts +74 -0
- package/dist/components/features/workflowManager/types.js +1 -0
- package/dist/components/features/workflowManager/useWorkflowManager.d.ts +30 -0
- package/dist/components/features/workflowManager/useWorkflowManager.js +213 -0
- package/dist/components/features/workflowManager/workflowManagerApi.d.ts +52 -0
- package/dist/components/features/workflowManager/workflowManagerApi.js +142 -0
- package/dist/components/task/TaskActionHeader.d.ts +6 -3
- package/dist/components/task/TaskActionHeader.js +46 -53
- package/dist/components/task/TaskCard.d.ts +10 -2
- package/dist/components/task/TaskCard.js +103 -54
- package/dist/components/task/TaskContextUpload.d.ts +1 -0
- package/dist/components/task/TaskContextUpload.js +3 -2
- package/dist/components/task/TaskForm.d.ts +12 -17
- package/dist/components/task/TaskForm.js +544 -199
- package/dist/components/task/TaskImageReviews.d.ts +8 -0
- package/dist/components/task/TaskImageReviews.js +47 -0
- package/dist/components/task/TaskKanban.d.ts +9 -10
- package/dist/components/task/TaskKanban.js +70 -18
- package/dist/components/task/TaskList.d.ts +9 -8
- package/dist/components/task/TaskList.js +46 -32
- package/dist/components/task/TaskReferenceBadge.d.ts +2 -1
- package/dist/components/task/TaskReferenceBadge.js +3 -2
- package/dist/components/task/TaskStatusActions.d.ts +3 -1
- package/dist/components/task/TaskStatusActions.js +17 -6
- package/dist/components/task/TaskWorkflowAssignmentField.d.ts +18 -0
- package/dist/components/task/TaskWorkflowAssignmentField.js +362 -0
- package/dist/components/task/TaskWorkstreamPicker.d.ts +8 -0
- package/dist/components/task/TaskWorkstreamPicker.js +24 -0
- package/dist/components/task/TrashRestoreControls.d.ts +18 -0
- package/dist/components/task/TrashRestoreControls.js +71 -0
- package/dist/components/ui/AiIdentityRosterCard.d.ts +20 -0
- package/dist/components/ui/AiIdentityRosterCard.js +5 -0
- package/dist/components/ui/AssetTraySortControl.d.ts +10 -0
- package/dist/components/ui/AssetTraySortControl.js +38 -0
- package/dist/components/ui/AssigneeIdentity.d.ts +12 -0
- package/dist/components/ui/AssigneeIdentity.js +41 -0
- package/dist/components/ui/DiscardChangesDialog.d.ts +10 -0
- package/dist/components/ui/DiscardChangesDialog.js +7 -0
- package/dist/components/ui/DisclosureSectionHeader.d.ts +4 -1
- package/dist/components/ui/DisclosureSectionHeader.js +2 -2
- package/dist/components/ui/EditableAvatarButton.d.ts +6 -1
- package/dist/components/ui/EditableAvatarButton.js +6 -5
- package/dist/components/ui/HierarchyActionBadge.d.ts +2 -1
- package/dist/components/ui/HierarchyActionBadge.js +2 -2
- package/dist/components/ui/Markdown.d.ts +13 -3
- package/dist/components/ui/Markdown.fixture.d.ts +1 -0
- package/dist/components/ui/Markdown.fixture.js +23 -0
- package/dist/components/ui/Markdown.js +158 -68
- package/dist/components/ui/Modal.d.ts +3 -1
- package/dist/components/ui/Modal.js +85 -19
- package/dist/components/ui/MultiSelectFilter.d.ts +9 -2
- package/dist/components/ui/MultiSelectFilter.js +26 -5
- package/dist/components/ui/ReferenceBadgeButton.js +2 -3
- package/dist/components/ui/TaxonomyDropdown.d.ts +10 -1
- package/dist/components/ui/TaxonomyDropdown.js +149 -58
- package/dist/components/ui/TopNoticeLayer.d.ts +2 -1
- package/dist/components/ui/TopNoticeLayer.js +5 -2
- package/dist/components/ui/useFallbackImageUrl.d.ts +4 -0
- package/dist/components/ui/useFallbackImageUrl.js +20 -0
- package/dist/components/views/AppShellHeader.js +2 -2
- package/dist/components/views/StandaloneLayout.d.ts +1 -0
- package/dist/components/views/StandaloneLayout.js +1662 -598
- package/dist/components/views/WidgetView.d.ts +1 -0
- package/dist/components/views/WidgetView.js +95 -30
- package/dist/components/views/chrome/WorkspaceChromeSections.d.ts +4 -2
- package/dist/components/views/chrome/WorkspaceChromeSections.js +3 -6
- package/dist/components/views/chrome/workspaceChrome.d.ts +5 -8
- package/dist/components/views/chrome/workspaceChrome.js +62 -27
- package/dist/components/views/panels/FilterToolbar.d.ts +4 -3
- package/dist/components/views/panels/FilterToolbar.js +8 -5
- package/dist/components/views/panels/FilterToolbarControls.d.ts +11 -2
- package/dist/components/views/panels/FilterToolbarControls.js +35 -20
- package/dist/components/views/panels/PlanningDrawer.d.ts +60 -49
- package/dist/components/views/panels/PlanningDrawer.js +978 -313
- package/dist/components/views/planningScope.js +7 -1
- package/dist/components/views/standalone/modals/AccountSettingsModal.d.ts +62 -0
- package/dist/components/views/standalone/modals/AccountSettingsModal.js +197 -0
- package/dist/components/views/standalone/modals/AvatarImageManagerModal.d.ts +7 -2
- package/dist/components/views/standalone/modals/AvatarImageManagerModal.js +56 -9
- package/dist/components/views/standalone/modals/HelpModal.d.ts +1 -2
- package/dist/components/views/standalone/modals/HelpModal.js +3 -4
- package/dist/components/views/standalone/modals/SyncStatusModal.d.ts +8 -9
- package/dist/components/views/standalone/modals/SyncStatusModal.js +85 -25
- package/dist/components/views/standalone/modals/TeamManagementModal.js +1 -1
- package/dist/config/applicationBaseUrl.d.ts +2 -0
- package/dist/config/applicationBaseUrl.js +23 -0
- package/dist/config/envSchema.d.ts +1 -1
- package/dist/config/envSchema.js +166 -5
- package/dist/core/AdminAuditRetentionService.d.ts +43 -0
- package/dist/core/AdminAuditRetentionService.js +126 -0
- package/dist/core/AiProfileService.d.ts +34 -0
- package/dist/core/AiProfileService.js +510 -251
- package/dist/core/AttachmentLinkService.d.ts +10 -2
- package/dist/core/AttachmentLinkService.js +44 -12
- package/dist/core/AuthIdentityService.d.ts +6 -0
- package/dist/core/AuthIdentityService.js +38 -0
- package/dist/core/AuthTokenService.d.ts +1 -0
- package/dist/core/AuthTokenService.js +13 -0
- package/dist/core/DeletedTaskLifecycleService.d.ts +4 -2
- package/dist/core/DeletedTaskLifecycleService.js +124 -38
- package/dist/core/GlobalSettingsService.d.ts +3 -1
- package/dist/core/GlobalSettingsService.js +30 -4
- package/dist/core/InitiativeDurableMutationService.d.ts +89 -0
- package/dist/core/InitiativeDurableMutationService.js +187 -0
- package/dist/core/McpTokenService.d.ts +1 -0
- package/dist/core/McpTokenService.js +39 -13
- package/dist/core/PlanningCommandPreparationService.d.ts +60 -0
- package/dist/core/PlanningCommandPreparationService.js +149 -0
- package/dist/core/ScheduleCommandService.d.ts +76 -0
- package/dist/core/ScheduleCommandService.js +165 -0
- package/dist/core/SyncReconciliationService.d.ts +29 -6
- package/dist/core/SyncReconciliationService.js +256 -84
- package/dist/core/TaskActivityService.d.ts +22 -2
- package/dist/core/TaskActivityService.js +177 -29
- package/dist/core/TaskAttachmentLinksDurableMutationService.d.ts +31 -0
- package/dist/core/TaskAttachmentLinksDurableMutationService.js +231 -0
- package/dist/core/TaskChecklistCommandService.d.ts +50 -0
- package/dist/core/TaskChecklistCommandService.js +111 -0
- package/dist/core/TaskDurableCreateMutationService.d.ts +38 -0
- package/dist/core/TaskDurableCreateMutationService.js +85 -0
- package/dist/core/TaskDurableDeleteMutationService.d.ts +47 -0
- package/dist/core/TaskDurableDeleteMutationService.js +54 -0
- package/dist/core/TaskDurableLifecycleMutationService.d.ts +38 -0
- package/dist/core/TaskDurableLifecycleMutationService.js +42 -0
- package/dist/core/TaskDurableRelationshipMutationService.d.ts +58 -0
- package/dist/core/TaskDurableRelationshipMutationService.js +66 -0
- package/dist/core/TaskDurableRestoreMutationService.d.ts +31 -0
- package/dist/core/TaskDurableRestoreMutationService.js +33 -0
- package/dist/core/TaskDurableStatusMutationService.d.ts +74 -0
- package/dist/core/TaskDurableStatusMutationService.js +247 -0
- package/dist/core/TaskDurableSyncMutationService.d.ts +34 -0
- package/dist/core/TaskDurableSyncMutationService.js +70 -0
- package/dist/core/TaskDurableWorkflowMutationService.d.ts +48 -0
- package/dist/core/TaskDurableWorkflowMutationService.js +59 -0
- package/dist/core/TaskLifecycleCommandService.d.ts +101 -0
- package/dist/core/TaskLifecycleCommandService.js +161 -0
- package/dist/core/TaskRootCommandPreparationService.d.ts +35 -0
- package/dist/core/TaskRootCommandPreparationService.js +103 -0
- package/dist/core/Taskforce.d.ts +479 -59
- package/dist/core/Taskforce.js +3671 -841
- package/dist/core/WorkflowAssignmentService.d.ts +40 -0
- package/dist/core/WorkflowAssignmentService.js +158 -0
- package/dist/core/WorkflowExecutionService.d.ts +69 -0
- package/dist/core/WorkflowExecutionService.js +342 -0
- package/dist/core/WorkflowTaskActivationService.d.ts +32 -0
- package/dist/core/WorkflowTaskActivationService.js +63 -0
- package/dist/core/WorkflowTemplateService.d.ts +64 -0
- package/dist/core/WorkflowTemplateService.js +223 -0
- package/dist/core/WorkspaceLifecycleService.d.ts +1 -0
- package/dist/core/WorkspaceLifecycleService.js +18 -0
- package/dist/core/WorkstreamDurableMutationService.d.ts +90 -0
- package/dist/core/WorkstreamDurableMutationService.js +184 -0
- package/dist/core/planningReferencePolicy.d.ts +14 -0
- package/dist/core/planningReferencePolicy.js +53 -0
- package/dist/core/taskReferencePolicy.js +24 -3
- package/dist/core/types.d.ts +10 -10
- package/dist/documentReviews/DocumentReviewCommentStore.d.ts +22 -2
- package/dist/documentReviews/DocumentReviewCommentStore.js +92 -8
- package/dist/documentReviews/commandService.d.ts +51 -0
- package/dist/documentReviews/commandService.js +63 -0
- package/dist/documentReviews/service.d.ts +20 -1
- package/dist/documentReviews/service.js +234 -24
- package/dist/documentReviews/types.d.ts +18 -1
- package/dist/hooks/sync/bootstrap.d.ts +3 -7
- package/dist/hooks/sync/bootstrap.js +6 -14
- package/dist/hooks/sync/browserSyncAuthority.d.ts +21 -0
- package/dist/hooks/sync/browserSyncAuthority.js +70 -0
- package/dist/hooks/sync/browserSyncRemoteServices.d.ts +29 -0
- package/dist/hooks/sync/browserSyncRemoteServices.js +58 -0
- package/dist/hooks/sync/controlPlane.d.ts +1 -37
- package/dist/hooks/sync/controlPlane.js +1 -78
- package/dist/hooks/sync/lifecyclePolicy.d.ts +1 -45
- package/dist/hooks/sync/lifecyclePolicy.js +1 -93
- package/dist/hooks/sync/orchestratorShared.d.ts +9 -3
- package/dist/hooks/sync/orchestratorShared.js +70 -96
- package/dist/hooks/sync/pullLifecycle.d.ts +1 -31
- package/dist/hooks/sync/pullLifecycle.js +1 -24
- package/dist/hooks/sync/realtime.d.ts +4 -1
- package/dist/hooks/sync/realtime.js +103 -3
- package/dist/hooks/sync/recovery.d.ts +1 -84
- package/dist/hooks/sync/recovery.js +1 -245
- package/dist/hooks/sync/transfers.d.ts +8 -129
- package/dist/hooks/sync/transfers.js +19 -581
- package/dist/hooks/sync/useDataVersionRefresh.d.ts +6 -1
- package/dist/hooks/sync/useDataVersionRefresh.js +127 -12
- package/dist/hooks/sync/useDurableLocalOutboxDrain.d.ts +14 -0
- package/dist/hooks/sync/useDurableLocalOutboxDrain.js +208 -0
- package/dist/hooks/sync/useDurableTaskCreateMutation.d.ts +15 -0
- package/dist/hooks/sync/useDurableTaskCreateMutation.js +152 -0
- package/dist/hooks/sync/useDurableTaskDeleteMutation.d.ts +11 -0
- package/dist/hooks/sync/useDurableTaskDeleteMutation.js +21 -0
- package/dist/hooks/sync/useDurableTaskLifecycleMutation.d.ts +12 -0
- package/dist/hooks/sync/useDurableTaskLifecycleMutation.js +22 -0
- package/dist/hooks/sync/useDurableTaskMetadataMutation.d.ts +14 -0
- package/dist/hooks/sync/useDurableTaskMetadataMutation.js +24 -0
- package/dist/hooks/sync/useDurableTaskRestoreMutation.d.ts +12 -0
- package/dist/hooks/sync/useDurableTaskRestoreMutation.js +24 -0
- package/dist/hooks/sync/useDurableTaskStatusMutation.d.ts +18 -0
- package/dist/hooks/sync/useDurableTaskStatusMutation.js +23 -0
- package/dist/hooks/sync/useLocalSyncCoordinatorSnapshot.d.ts +23 -0
- package/dist/hooks/sync/useLocalSyncCoordinatorSnapshot.js +414 -0
- package/dist/hooks/sync/useSyncStatusActions.d.ts +2 -1
- package/dist/hooks/sync/useSyncStatusActions.js +8 -3
- package/dist/hooks/tasks/taskHttpMutation.d.ts +25 -0
- package/dist/hooks/tasks/taskHttpMutation.js +134 -0
- package/dist/hooks/tasks/useCurrentTaskRelations.d.ts +6 -1
- package/dist/hooks/tasks/useCurrentTaskRelations.js +32 -6
- package/dist/hooks/tasks/useTaskEditorNavigation.d.ts +4 -3
- package/dist/hooks/tasks/useTaskEditorNavigation.js +9 -13
- package/dist/hooks/tasks/useTaskFormActions.d.ts +17 -2
- package/dist/hooks/tasks/useTaskFormActions.js +309 -55
- package/dist/hooks/tasks/useTaskReferenceContract.d.ts +5 -0
- package/dist/hooks/tasks/useTaskReferenceContract.js +17 -0
- package/dist/hooks/tasks/useTaskRelationships.d.ts +1 -3
- package/dist/hooks/tasks/useTaskRelationships.js +5 -25
- package/dist/hooks/tasks/useTrashSelection.d.ts +12 -0
- package/dist/hooks/tasks/useTrashSelection.js +49 -0
- package/dist/hooks/ui/useInitiativeTemplates.d.ts +24 -0
- package/dist/hooks/ui/useInitiativeTemplates.js +22 -0
- package/dist/hooks/ui/useSettingsModel.d.ts +5 -29
- package/dist/hooks/ui/useSettingsModel.js +31 -15
- package/dist/hooks/ui/useSettingsPersistence.d.ts +0 -1
- package/dist/hooks/ui/useSettingsPersistence.js +4 -8
- package/dist/hooks/ui/useSettingsTaxonomyManagement.js +31 -0
- package/dist/hooks/useFilterSort.d.ts +2 -2
- package/dist/hooks/useFilterSort.js +19 -15
- package/dist/hooks/useRealtimeSync.d.ts +10 -0
- package/dist/hooks/useRealtimeSync.js +57 -4
- package/dist/hooks/useSyncOrchestrator.d.ts +32 -1
- package/dist/hooks/useSyncOrchestrator.js +963 -287
- package/dist/hooks/useTaskData.d.ts +11 -2
- package/dist/hooks/useTaskData.js +59 -26
- package/dist/hooks/useTaskMutations.d.ts +42 -5
- package/dist/hooks/useTaskMutations.js +750 -125
- package/dist/hooks/useTaskforce.d.ts +114 -118
- package/dist/hooks/useTaskforce.js +1102 -449
- package/dist/hooks/useUiNotice.d.ts +5 -1
- package/dist/hooks/useUiNotice.js +13 -2
- package/dist/hooks/useWorkspaceSyncController.d.ts +9 -0
- package/dist/hooks/useWorkspaceSyncController.js +159 -17
- package/dist/hooks/workspace/usePersistedAppUiState.d.ts +74 -0
- package/dist/hooks/workspace/usePersistedAppUiState.js +325 -0
- package/dist/hooks/workspace/usePersistedLayoutUiState.d.ts +76 -0
- package/dist/hooks/workspace/usePersistedLayoutUiState.js +479 -0
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.d.ts +2 -7
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.js +42 -31
- package/dist/hooks/workspace/workspaceLocalState.d.ts +17 -6
- package/dist/hooks/workspace/workspaceLocalState.js +175 -5
- package/dist/hooks/workstreams/workstreamHttpMutation.d.ts +23 -0
- package/dist/hooks/workstreams/workstreamHttpMutation.js +134 -0
- package/dist/localization/locales/en-US.d.ts +3 -3
- package/dist/localization/locales/en-US.js +3 -3
- package/dist/localization/locales/es-419.js +3 -3
- package/dist/localization/locales/pt-BR.js +3 -3
- package/dist/mcp/adminWorkspaceRegistrar.js +2 -30
- package/dist/mcp/aiProfileBootstrap.d.ts +3 -0
- package/dist/mcp/aiProfileBootstrap.js +4 -0
- package/dist/mcp/canonicalAssetHelpers.d.ts +16 -4
- package/dist/mcp/canonicalAssetHelpers.js +104 -35
- package/dist/mcp/clientIntegrations.d.ts +4 -2
- package/dist/mcp/clientIntegrations.js +58 -57
- package/dist/mcp/clientRegistry.d.ts +30 -0
- package/dist/mcp/clientRegistry.js +134 -0
- package/dist/mcp/collaborationRegistrar.js +20 -6
- package/dist/mcp/documentAssetRegistrar.js +220 -52
- package/dist/mcp/documentContentCommand.d.ts +94 -0
- package/dist/mcp/documentContentCommand.js +226 -0
- package/dist/mcp/documentHelpers.d.ts +13 -65
- package/dist/mcp/documentHelpers.js +49 -62
- package/dist/mcp/durableTaskMutationRouter.d.ts +65 -0
- package/dist/mcp/durableTaskMutationRouter.js +217 -0
- package/dist/mcp/durableTaskRelationshipMutationRouter.d.ts +38 -0
- package/dist/mcp/durableTaskRelationshipMutationRouter.js +168 -0
- package/dist/mcp/durableTaskRootMutationRouter.d.ts +64 -0
- package/dist/mcp/durableTaskRootMutationRouter.js +226 -0
- package/dist/mcp/gitWorktreeRoots.d.ts +2 -0
- package/dist/mcp/gitWorktreeRoots.js +19 -0
- package/dist/mcp/legacyServer.d.ts +1 -0
- package/dist/mcp/legacyServer.js +42 -0
- package/dist/mcp/localCliHealth.d.ts +56 -0
- package/dist/mcp/localCliHealth.js +170 -0
- package/dist/mcp/localServiceProxy.d.ts +23 -0
- package/dist/mcp/localServiceProxy.js +255 -0
- package/dist/mcp/mcpInputValidator.d.ts +17 -0
- package/dist/mcp/mcpInputValidator.js +58 -0
- package/dist/mcp/planningAttachmentCommandAdapter.d.ts +127 -0
- package/dist/mcp/planningAttachmentCommandAdapter.js +188 -0
- package/dist/mcp/programScaffoldCommandAdapter.d.ts +6 -0
- package/dist/mcp/programScaffoldCommandAdapter.js +39 -0
- package/dist/mcp/proxyServer.d.ts +1 -0
- package/dist/mcp/proxyServer.js +2 -0
- package/dist/mcp/runtime.d.ts +82 -1
- package/dist/mcp/runtime.js +4285 -1925
- package/dist/mcp/server.js +29 -2
- package/dist/mcp/sharedLocalServiceGateD.d.ts +115 -0
- package/dist/mcp/sharedLocalServiceGateD.js +344 -0
- package/dist/mcp/stdioLifecycle.d.ts +22 -0
- package/dist/mcp/stdioLifecycle.js +54 -0
- package/dist/mcp/taskAttachmentCommandAdapter.d.ts +190 -0
- package/dist/mcp/taskAttachmentCommandAdapter.js +464 -0
- package/dist/mcp/taskAttachmentHelpers.d.ts +8 -6
- package/dist/mcp/taskAttachmentHelpers.js +74 -2
- package/dist/mcp/taskAttachmentTypes.d.ts +26 -5
- package/dist/mcp/taskPlanCommand.d.ts +64 -0
- package/dist/mcp/taskPlanCommand.js +98 -0
- package/dist/mcp/taskPlanningRegistrar.js +215 -27
- package/dist/mcp/toolCallCompatibility.d.ts +6 -0
- package/dist/mcp/toolCallCompatibility.js +16 -0
- package/dist/mcp/toolCatalog.d.ts +3 -1
- package/dist/mcp/toolProfiles.d.ts +12 -1
- package/dist/mcp/toolProfiles.js +43 -0
- package/dist/mcp/toolRegistry.d.ts +17 -2
- package/dist/mcp/toolRegistry.js +24 -9
- package/dist/mcp/workflowExecutionRegistrar.d.ts +2 -0
- package/dist/mcp/workflowExecutionRegistrar.js +51 -0
- package/dist/migrations/taskSchemaMigrations.d.ts +35 -0
- package/dist/migrations/taskSchemaMigrations.js +1797 -4
- package/dist/migrations/taskUpdatedAtSyncDriftMigration.d.ts +20 -0
- package/dist/migrations/taskUpdatedAtSyncDriftMigration.js +153 -0
- package/dist/migrations/taskforceAgentDefinitionMigration.d.ts +26 -0
- package/dist/migrations/taskforceAgentDefinitionMigration.js +116 -0
- package/dist/plugins/vite.js +48 -17
- package/dist/public/Taskforce_Van.webp +0 -0
- package/dist/runtime/appGateDefinitions.d.ts +16 -10
- package/dist/runtime/appGateDefinitions.js +16 -10
- package/dist/runtime/appGates.d.ts +5 -4
- package/dist/runtime/appGates.js +4 -3
- package/dist/server/aiProfileAvatarAssets.d.ts +11 -8
- package/dist/server/aiProfileAvatarAssets.js +159 -70
- package/dist/server/auth.js +15 -1
- package/dist/server/cors.d.ts +2 -1
- package/dist/server/cors.js +45 -8
- package/dist/server/email.d.ts +3 -1
- package/dist/server/email.js +46 -8
- package/dist/server/index.d.ts +24 -1
- package/dist/server/index.js +342 -46
- package/dist/server/localDataOwnerPermit.d.ts +18 -0
- package/dist/server/localDataOwnerPermit.js +58 -0
- package/dist/server/localDatabaseIdentity.d.ts +14 -0
- package/dist/server/localDatabaseIdentity.js +69 -0
- package/dist/server/localRealtimeFileInvalidation.d.ts +1 -0
- package/dist/server/localRealtimeFileInvalidation.js +7 -0
- package/dist/server/localServiceLease.d.ts +62 -0
- package/dist/server/localServiceLease.js +477 -0
- package/dist/server/localServiceOwnershipBootstrap.d.ts +19 -0
- package/dist/server/localServiceOwnershipBootstrap.js +84 -0
- package/dist/server/localServiceSessions.d.ts +87 -0
- package/dist/server/localServiceSessions.js +309 -0
- package/dist/server/localServiceWindowsAcl.d.ts +8 -0
- package/dist/server/localServiceWindowsAcl.js +60 -0
- package/dist/server/localSyncProcessLockBootstrap.d.ts +3 -0
- package/dist/server/localSyncProcessLockBootstrap.js +16 -0
- package/dist/server/localWorkspaceSyncServerComposition.d.ts +59 -0
- package/dist/server/localWorkspaceSyncServerComposition.js +91 -0
- package/dist/server/localWorkspaceSyncServerRuntime.d.ts +119 -0
- package/dist/server/localWorkspaceSyncServerRuntime.js +1163 -0
- package/dist/server/rateLimit.d.ts +1 -0
- package/dist/server/rateLimit.js +16 -0
- package/dist/server/routes/admin.d.ts +2 -4
- package/dist/server/routes/admin.js +199 -337
- package/dist/server/routes/agentRoles.d.ts +13 -0
- package/dist/server/routes/agentRoles.js +273 -0
- package/dist/server/routes/agentSkills.d.ts +16 -0
- package/dist/server/routes/agentSkills.js +291 -0
- package/dist/server/routes/agents.d.ts +49 -0
- package/dist/server/routes/agents.js +1455 -0
- package/dist/server/routes/annotatedAttachments.js +46 -9
- package/dist/server/routes/assetAccess.d.ts +36 -0
- package/dist/server/routes/assetAccess.js +93 -0
- package/dist/server/routes/auth.d.ts +4 -3
- package/dist/server/routes/auth.js +236 -21
- package/dist/server/routes/authSupport.d.ts +3 -1
- package/dist/server/routes/authSupport.js +22 -8
- package/dist/server/routes/documentReviews.d.ts +2 -0
- package/dist/server/routes/documentReviews.js +155 -15
- package/dist/server/routes/documents.d.ts +1 -0
- package/dist/server/routes/documents.js +335 -141
- package/dist/server/routes/durableTaskHttpRouters.d.ts +165 -0
- package/dist/server/routes/durableTaskHttpRouters.js +89 -0
- package/dist/server/routes/localMcpHealth.d.ts +11 -0
- package/dist/server/routes/localMcpHealth.js +29 -0
- package/dist/server/routes/localService.d.ts +13 -0
- package/dist/server/routes/localService.js +444 -0
- package/dist/server/routes/localUpdate.d.ts +11 -0
- package/dist/server/routes/localUpdate.js +154 -0
- package/dist/server/routes/primitives.d.ts +27 -0
- package/dist/server/routes/primitives.js +18 -0
- package/dist/server/routes/resources.d.ts +1 -10
- package/dist/server/routes/resources.js +1 -153
- package/dist/server/routes/shared.d.ts +31 -2
- package/dist/server/routes/shared.js +394 -0
- package/dist/server/routes/sync.d.ts +2 -0
- package/dist/server/routes/sync.js +184 -272
- package/dist/server/routes/syncAuxRoutes.d.ts +3 -1
- package/dist/server/routes/syncAuxRoutes.js +9 -4
- package/dist/server/routes/syncCoordinatorLocalRoutes.d.ts +6 -0
- package/dist/server/routes/syncCoordinatorLocalRoutes.js +867 -0
- package/dist/server/routes/syncPullApplyRoutes.d.ts +29 -1
- package/dist/server/routes/syncPullApplyRoutes.js +520 -17
- package/dist/server/routes/syncPushRoutes.d.ts +33 -4
- package/dist/server/routes/syncPushRoutes.js +251 -62
- package/dist/server/routes/syncRouteTypes.d.ts +1 -1
- package/dist/server/routes/syncSnapshotRoutes.d.ts +15 -7
- package/dist/server/routes/syncSnapshotRoutes.js +95 -17
- package/dist/server/routes/syncV3DiagnosticsRoutes.d.ts +14 -0
- package/dist/server/routes/syncV3DiagnosticsRoutes.js +72 -0
- package/dist/server/routes/syncV3FeedRoutes.d.ts +20 -0
- package/dist/server/routes/syncV3FeedRoutes.js +462 -0
- package/dist/server/routes/syncV3LocalCaptureRoutes.d.ts +37 -0
- package/dist/server/routes/syncV3LocalCaptureRoutes.js +897 -0
- package/dist/server/routes/syncV3LocalDispatchRoutes.d.ts +17 -0
- package/dist/server/routes/syncV3LocalDispatchRoutes.js +280 -0
- package/dist/server/routes/syncV3LocalFeedApplyRoutes.d.ts +17 -0
- package/dist/server/routes/syncV3LocalFeedApplyRoutes.js +493 -0
- package/dist/server/routes/syncV3LocalOwnershipRoutes.d.ts +10 -0
- package/dist/server/routes/syncV3LocalOwnershipRoutes.js +51 -0
- package/dist/server/routes/syncV3LocalRecoveryRoutes.d.ts +12 -0
- package/dist/server/routes/syncV3LocalRecoveryRoutes.js +78 -0
- package/dist/server/routes/syncV3OperationRoutes.d.ts +35 -0
- package/dist/server/routes/syncV3OperationRoutes.js +1136 -0
- package/dist/server/routes/tasks.d.ts +0 -2
- package/dist/server/routes/tasks.js +932 -195
- package/dist/server/routes/workflows.d.ts +26 -0
- package/dist/server/routes/workflows.js +500 -0
- package/dist/server/routes.d.ts +1 -6
- package/dist/server/routes.js +148 -339
- package/dist/server/smtpTransport.d.ts +11 -3
- package/dist/server/smtpTransport.js +9 -2
- package/dist/server/start.js +42 -10
- package/dist/service/localServiceCli.d.ts +33 -0
- package/dist/service/localServiceCli.js +365 -0
- package/dist/service/localServiceClientLifecycle.d.ts +25 -0
- package/dist/service/localServiceClientLifecycle.js +128 -0
- package/dist/service/localServiceOpen.d.ts +17 -0
- package/dist/service/localServiceOpen.js +27 -0
- package/dist/services/agentRoleResolver.d.ts +4 -0
- package/dist/services/agentRoleResolver.js +7 -0
- package/dist/services/aiProfileAvatarGenerationService.d.ts +41 -0
- package/dist/services/aiProfileAvatarGenerationService.js +158 -0
- package/dist/services/avatarImageProvider.d.ts +33 -0
- package/dist/services/avatarImageProvider.js +140 -0
- package/dist/services/bedrockAnthropicMessagesModelGateway.d.ts +24 -0
- package/dist/services/bedrockAnthropicMessagesModelGateway.js +95 -0
- package/dist/services/bedrockMantleModelGateway.d.ts +43 -0
- package/dist/services/bedrockMantleModelGateway.js +81 -0
- package/dist/services/bedrockModelGateway.d.ts +26 -0
- package/dist/services/bedrockModelGateway.js +94 -0
- package/dist/services/modelGateway.d.ts +82 -0
- package/dist/services/modelGateway.js +61 -0
- package/dist/services/taskforceAgentAvatarImageProvider.d.ts +8 -0
- package/dist/services/taskforceAgentAvatarImageProvider.js +24 -0
- package/dist/services/taskforceAgentMcpBridge.d.ts +77 -0
- package/dist/services/taskforceAgentMcpBridge.js +527 -0
- package/dist/shared/agentRoleDefinition.d.ts +34 -0
- package/dist/shared/agentRoleDefinition.js +207 -0
- package/dist/shared/aiProfileAvatarEligibility.d.ts +10 -0
- package/dist/shared/aiProfileAvatarEligibility.js +27 -0
- package/dist/shared/aiProfileColors.d.ts +7 -0
- package/dist/shared/aiProfileColors.js +33 -0
- package/dist/shared/colorPalette.d.ts +3 -0
- package/dist/shared/colorPalette.js +20 -0
- package/dist/shared/commentProvenance.d.ts +4 -0
- package/dist/shared/commentProvenance.js +6 -0
- package/dist/shared/deletedTaskRetention.d.ts +2 -0
- package/dist/shared/deletedTaskRetention.js +7 -0
- package/dist/shared/passwordPolicy.d.ts +2 -1
- package/dist/shared/passwordPolicy.js +9 -0
- package/dist/shared/taskDeepLinks.d.ts +28 -0
- package/dist/shared/taskDeepLinks.js +48 -0
- package/dist/shared/taskRestoreDestination.d.ts +2 -0
- package/dist/shared/taskRestoreDestination.js +5 -0
- package/dist/shared/taskforceAgentDefinition.d.ts +88 -0
- package/dist/shared/taskforceAgentDefinition.js +434 -0
- package/dist/shared/taskforceAgentExecutionSnapshot.d.ts +50 -0
- package/dist/shared/taskforceAgentExecutionSnapshot.js +68 -0
- package/dist/shared/taskforceAgentModels.d.ts +56 -0
- package/dist/shared/taskforceAgentModels.js +314 -0
- package/dist/shared/taskforceAgentRunContext.d.ts +23 -0
- package/dist/shared/taskforceAgentRunContext.js +21 -0
- package/dist/shared/taskforceAgentRuntimeResolution.d.ts +31 -0
- package/dist/shared/taskforceAgentRuntimeResolution.js +72 -0
- package/dist/shared/taskforceAgentSkill.d.ts +33 -0
- package/dist/shared/taskforceAgentSkill.js +149 -0
- package/dist/storage/agentRoleStore.d.ts +91 -0
- package/dist/storage/agentRoleStore.js +385 -0
- package/dist/storage/databaseAdapter.d.ts +1 -0
- package/dist/storage/databaseAdapter.js +7 -1
- package/dist/storage/documentIntegrity.d.ts +12 -3
- package/dist/storage/documentIntegrity.js +105 -27
- package/dist/storage/objectStorageClient.d.ts +10 -4
- package/dist/storage/objectStorageClient.js +73 -43
- package/dist/storage/postgresAdapter.d.ts +2 -1
- package/dist/storage/postgresAdapter.js +38 -6
- package/dist/storage/postgresWorker.js +65 -1
- package/dist/storage/sqliteAdapter.d.ts +1 -1
- package/dist/storage/sqliteAdapter.js +7 -1
- package/dist/storage/sqliteWalHealth.d.ts +71 -0
- package/dist/storage/sqliteWalHealth.js +176 -0
- package/dist/storage/taskDataPath.d.ts +1 -0
- package/dist/storage/taskDataPath.js +20 -0
- package/dist/storage/taskforceAgentConversationStore.d.ts +66 -0
- package/dist/storage/taskforceAgentConversationStore.js +264 -0
- package/dist/storage/taskforceAgentSkillStore.d.ts +93 -0
- package/dist/storage/taskforceAgentSkillStore.js +355 -0
- package/dist/storage/taskforceAgentStore.d.ts +105 -0
- package/dist/storage/taskforceAgentStore.js +549 -0
- package/dist/storage/workflowStore.d.ts +223 -0
- package/dist/storage/workflowStore.js +1032 -0
- package/dist/storage/workspaceAssetStore.d.ts +70 -0
- package/dist/storage/workspaceAssetStore.js +418 -25
- package/dist/sync/aiProfileAvatarSyncPaths.d.ts +14 -0
- package/dist/sync/aiProfileAvatarSyncPaths.js +56 -0
- package/dist/sync/cloudSyncApi.d.ts +329 -0
- package/dist/sync/cloudSyncApi.js +574 -1
- package/dist/sync/collaborationSyncPayload.d.ts +5 -1
- package/dist/sync/collaborationSyncPayload.js +213 -1
- package/dist/sync/collaborationSyncState.d.ts +23 -3
- package/dist/sync/collaborationSyncState.js +92 -3
- package/dist/sync/contentSyncPayload.d.ts +9 -0
- package/dist/sync/contentSyncPayload.js +29 -0
- package/dist/sync/contentSyncState.d.ts +79 -4
- package/dist/sync/contentSyncState.js +1113 -313
- package/dist/sync/coordinator/localSyncBrowserApplyPermitContext.d.ts +39 -0
- package/dist/sync/coordinator/localSyncBrowserApplyPermitContext.js +234 -0
- package/dist/sync/coordinator/localSyncBrowserAuthorityCapability.d.ts +7 -0
- package/dist/sync/coordinator/localSyncBrowserAuthorityCapability.js +10 -0
- package/dist/sync/coordinator/localSyncCommittedApplyPolicy.d.ts +7 -0
- package/dist/sync/coordinator/localSyncCommittedApplyPolicy.js +41 -0
- package/dist/sync/coordinator/localSyncCoordinatorBrowserClient.d.ts +178 -0
- package/dist/sync/coordinator/localSyncCoordinatorBrowserClient.js +131 -0
- package/dist/sync/coordinator/localSyncCoordinatorCommandLifecycle.d.ts +25 -0
- package/dist/sync/coordinator/localSyncCoordinatorCommandLifecycle.js +200 -0
- package/dist/sync/coordinator/localSyncCoordinatorHost.d.ts +84 -0
- package/dist/sync/coordinator/localSyncCoordinatorHost.js +435 -0
- package/dist/sync/coordinator/localSyncCoordinatorRouteServices.d.ts +33 -0
- package/dist/sync/coordinator/localSyncCoordinatorRouteServices.js +1 -0
- package/dist/sync/coordinator/localSyncCoordinatorStore.d.ts +122 -0
- package/dist/sync/coordinator/localSyncCoordinatorStore.js +1039 -0
- package/dist/sync/coordinator/localSyncCoordinatorTypes.d.ts +82 -0
- package/dist/sync/coordinator/localSyncCoordinatorTypes.js +9 -0
- package/dist/sync/coordinator/localSyncDispatchTracker.d.ts +15 -0
- package/dist/sync/coordinator/localSyncDispatchTracker.js +68 -0
- package/dist/sync/coordinator/localSyncExecutionPermitStore.d.ts +200 -0
- package/dist/sync/coordinator/localSyncExecutionPermitStore.js +1388 -0
- package/dist/sync/coordinator/localSyncExecutionPermitTypes.d.ts +52 -0
- package/dist/sync/coordinator/localSyncExecutionPermitTypes.js +8 -0
- package/dist/sync/coordinator/localSyncOwnershipDrainBarrier.d.ts +33 -0
- package/dist/sync/coordinator/localSyncOwnershipDrainBarrier.js +83 -0
- package/dist/sync/coordinator/localSyncPermitTransactionHooks.d.ts +9 -0
- package/dist/sync/coordinator/localSyncPermitTransactionHooks.js +27 -0
- package/dist/sync/coordinator/localSyncProcessLock.d.ts +12 -0
- package/dist/sync/coordinator/localSyncProcessLock.js +212 -0
- package/dist/sync/coordinator/localSyncV3DispatchRecoveryReconciler.d.ts +17 -0
- package/dist/sync/coordinator/localSyncV3DispatchRecoveryReconciler.js +82 -0
- package/dist/sync/coordinator/localWorkspaceSyncRunner.d.ts +134 -0
- package/dist/sync/coordinator/localWorkspaceSyncRunner.js +981 -0
- package/dist/sync/coordinator/localWorkspaceSyncRunnerState.d.ts +189 -0
- package/dist/sync/coordinator/localWorkspaceSyncRunnerState.js +961 -0
- package/dist/sync/coordinator/workspaceSyncCloudCredentialValidator.d.ts +19 -0
- package/dist/sync/coordinator/workspaceSyncCloudCredentialValidator.js +83 -0
- package/dist/sync/coordinator/workspaceSyncCredentialBroker.d.ts +117 -0
- package/dist/sync/coordinator/workspaceSyncCredentialBroker.js +323 -0
- package/dist/sync/coordinator/workspaceSyncLocalAccessBootstrap.d.ts +11 -0
- package/dist/sync/coordinator/workspaceSyncLocalAccessBootstrap.js +51 -0
- package/dist/sync/coordinator/workspaceSyncTransportGateway.d.ts +139 -0
- package/dist/sync/coordinator/workspaceSyncTransportGateway.js +738 -0
- package/dist/sync/engine/localWorkspaceContentManifestService.d.ts +21 -0
- package/dist/sync/engine/localWorkspaceContentManifestService.js +44 -0
- package/dist/sync/engine/workspaceSyncAtomicLocalPublisher.d.ts +36 -0
- package/dist/sync/engine/workspaceSyncAtomicLocalPublisher.js +203 -0
- package/dist/sync/engine/workspaceSyncContentLifecycleAdapter.d.ts +21 -0
- package/dist/sync/engine/workspaceSyncContentLifecycleAdapter.js +13 -0
- package/dist/sync/engine/workspaceSyncContentPullObligationStore.d.ts +65 -0
- package/dist/sync/engine/workspaceSyncContentPullObligationStore.js +160 -0
- package/dist/sync/engine/workspaceSyncContentVersionStore.d.ts +216 -0
- package/dist/sync/engine/workspaceSyncContentVersionStore.js +1068 -0
- package/dist/sync/engine/workspaceSyncEngineBrowserGatewayRemoteServices.d.ts +28 -0
- package/dist/sync/engine/workspaceSyncEngineBrowserGatewayRemoteServices.js +543 -0
- package/dist/sync/engine/workspaceSyncEngineContracts.d.ts +78 -0
- package/dist/sync/engine/workspaceSyncEngineContracts.js +1 -0
- package/dist/sync/engine/workspaceSyncEngineControlPlane.d.ts +37 -0
- package/dist/sync/engine/workspaceSyncEngineControlPlane.js +79 -0
- package/dist/sync/engine/workspaceSyncEngineIdentity.d.ts +1 -0
- package/dist/sync/engine/workspaceSyncEngineIdentity.js +4 -0
- package/dist/sync/engine/workspaceSyncEngineLifecyclePolicy.d.ts +68 -0
- package/dist/sync/engine/workspaceSyncEngineLifecyclePolicy.js +180 -0
- package/dist/sync/engine/workspaceSyncEngineLocalApply.d.ts +72 -0
- package/dist/sync/engine/workspaceSyncEngineLocalApply.js +132 -0
- package/dist/sync/engine/workspaceSyncEngineLocalServices.d.ts +70 -0
- package/dist/sync/engine/workspaceSyncEngineLocalServices.js +25 -0
- package/dist/sync/engine/workspaceSyncEngineParity.d.ts +8 -0
- package/dist/sync/engine/workspaceSyncEngineParity.js +7 -0
- package/dist/sync/engine/workspaceSyncEnginePullPolicy.d.ts +32 -0
- package/dist/sync/engine/workspaceSyncEnginePullPolicy.js +27 -0
- package/dist/sync/engine/workspaceSyncEnginePushCompletion.d.ts +20 -0
- package/dist/sync/engine/workspaceSyncEnginePushCompletion.js +87 -0
- package/dist/sync/engine/workspaceSyncEngineRecovery.d.ts +56 -0
- package/dist/sync/engine/workspaceSyncEngineRecovery.js +288 -0
- package/dist/sync/engine/workspaceSyncEngineRemoteServices.d.ts +104 -0
- package/dist/sync/engine/workspaceSyncEngineRemoteServices.js +21 -0
- package/dist/sync/engine/workspaceSyncEngineRuntime.d.ts +61 -0
- package/dist/sync/engine/workspaceSyncEngineRuntime.js +59 -0
- package/dist/sync/engine/workspaceSyncEngineServerApplyBoundary.d.ts +28 -0
- package/dist/sync/engine/workspaceSyncEngineServerApplyBoundary.js +86 -0
- package/dist/sync/engine/workspaceSyncEngineServerLocalServices.d.ts +73 -0
- package/dist/sync/engine/workspaceSyncEngineServerLocalServices.js +452 -0
- package/dist/sync/engine/workspaceSyncEngineServerRemoteServices.d.ts +23 -0
- package/dist/sync/engine/workspaceSyncEngineServerRemoteServices.js +451 -0
- package/dist/sync/engine/workspaceSyncEngineServerRunnerOperations.d.ts +125 -0
- package/dist/sync/engine/workspaceSyncEngineServerRunnerOperations.js +1124 -0
- package/dist/sync/engine/workspaceSyncEngineServerSnapshotReader.d.ts +63 -0
- package/dist/sync/engine/workspaceSyncEngineServerSnapshotReader.js +276 -0
- package/dist/sync/engine/workspaceSyncEngineTransferCompletion.d.ts +20 -0
- package/dist/sync/engine/workspaceSyncEngineTransferCompletion.js +37 -0
- package/dist/sync/engine/workspaceSyncEngineTransferTypes.d.ts +7 -0
- package/dist/sync/engine/workspaceSyncEngineTransferTypes.js +1 -0
- package/dist/sync/engine/workspaceSyncEngineTransfers.d.ts +240 -0
- package/dist/sync/engine/workspaceSyncEngineTransfers.js +1184 -0
- package/dist/sync/engine/workspaceSyncEngineV3LocalFeedApply.d.ts +39 -0
- package/dist/sync/engine/workspaceSyncEngineV3LocalFeedApply.js +39 -0
- package/dist/sync/engine/workspaceSyncImmutableContentGcRunner.d.ts +25 -0
- package/dist/sync/engine/workspaceSyncImmutableContentGcRunner.js +83 -0
- package/dist/sync/engine/workspaceSyncImmutableContentProvider.d.ts +71 -0
- package/dist/sync/engine/workspaceSyncImmutableContentProvider.js +209 -0
- package/dist/sync/engine/workspaceSyncImmutableContentStager.d.ts +32 -0
- package/dist/sync/engine/workspaceSyncImmutableContentStager.js +202 -0
- package/dist/sync/engine/workspaceSyncPublishedContentResolver.d.ts +43 -0
- package/dist/sync/engine/workspaceSyncPublishedContentResolver.js +142 -0
- package/dist/sync/engine/workspaceSyncServerContentRuntime.d.ts +26 -0
- package/dist/sync/engine/workspaceSyncServerContentRuntime.js +41 -0
- package/dist/sync/engine/workspaceSyncServerDataServices.d.ts +44 -0
- package/dist/sync/engine/workspaceSyncServerDataServices.js +143 -0
- package/dist/sync/engine/workspaceSyncTransferEvidence.d.ts +39 -0
- package/dist/sync/engine/workspaceSyncTransferEvidence.js +45 -0
- package/dist/sync/engine/workspaceSyncV2ChangeDispatcher.d.ts +44 -0
- package/dist/sync/engine/workspaceSyncV2ChangeDispatcher.js +990 -0
- package/dist/sync/engine/workspaceSyncV2PreparedContent.d.ts +82 -0
- package/dist/sync/engine/workspaceSyncV2PreparedContent.js +219 -0
- package/dist/sync/planningCanonicalFields.d.ts +41 -0
- package/dist/sync/planningCanonicalFields.js +211 -0
- package/dist/sync/planningSyncPayload.d.ts +5 -1
- package/dist/sync/planningSyncPayload.js +88 -4
- package/dist/sync/syncApplyHandlers.d.ts +98 -8
- package/dist/sync/syncApplyHandlers.js +816 -78
- package/dist/sync/syncResourceAdapters.d.ts +10 -0
- package/dist/sync/syncResourceAdapters.js +21 -1
- package/dist/sync/syncService.d.ts +57 -1
- package/dist/sync/syncService.js +1085 -138
- package/dist/sync/taskNestedContent.d.ts +2 -0
- package/dist/sync/taskNestedContent.js +8 -0
- package/dist/sync/taskSyncChangeKey.js +0 -1
- package/dist/sync/taskSyncPayload.d.ts +0 -1
- package/dist/sync/taskSyncPayload.js +14 -3
- package/dist/sync/v3/canonicalWorkspaceSyncJson.d.ts +2 -0
- package/dist/sync/v3/canonicalWorkspaceSyncJson.js +26 -0
- package/dist/sync/v3/combinedFeedCapability.d.ts +21 -0
- package/dist/sync/v3/combinedFeedCapability.js +80 -0
- package/dist/sync/v3/combinedFeedPrerequisites.d.ts +18 -0
- package/dist/sync/v3/combinedFeedPrerequisites.js +184 -0
- package/dist/sync/v3/durableInitiativeMutationRouter.d.ts +61 -0
- package/dist/sync/v3/durableInitiativeMutationRouter.js +287 -0
- package/dist/sync/v3/durableOperationReplay.d.ts +36 -0
- package/dist/sync/v3/durableOperationReplay.js +103 -0
- package/dist/sync/v3/durableTaskAttachmentLinksMutationRouter.d.ts +49 -0
- package/dist/sync/v3/durableTaskAttachmentLinksMutationRouter.js +198 -0
- package/dist/sync/v3/durableTaskChecklistMutationRouter.d.ts +47 -0
- package/dist/sync/v3/durableTaskChecklistMutationRouter.js +182 -0
- package/dist/sync/v3/durableTaskCommentMutationRouter.d.ts +47 -0
- package/dist/sync/v3/durableTaskCommentMutationRouter.js +191 -0
- package/dist/sync/v3/durableTaskHttpBulkMutationRouter.d.ts +60 -0
- package/dist/sync/v3/durableTaskHttpBulkMutationRouter.js +320 -0
- package/dist/sync/v3/durableTaskHttpRootMutationRouter.d.ts +40 -0
- package/dist/sync/v3/durableTaskHttpRootMutationRouter.js +518 -0
- package/dist/sync/v3/durableTaxonomyMutationRouter.d.ts +63 -0
- package/dist/sync/v3/durableTaxonomyMutationRouter.js +289 -0
- package/dist/sync/v3/durableWorkflowRuntimeMutationRouter.d.ts +77 -0
- package/dist/sync/v3/durableWorkflowRuntimeMutationRouter.js +361 -0
- package/dist/sync/v3/durableWorkstreamMutationRouter.d.ts +61 -0
- package/dist/sync/v3/durableWorkstreamMutationRouter.js +287 -0
- package/dist/sync/v3/durableWorkstreamTaskOrderMutationRouter.d.ts +42 -0
- package/dist/sync/v3/durableWorkstreamTaskOrderMutationRouter.js +122 -0
- package/dist/sync/v3/entityEventLegacyAdoptionContract.d.ts +6 -0
- package/dist/sync/v3/entityEventLegacyAdoptionContract.js +6 -0
- package/dist/sync/v3/entityEventLegacyAdoptionService.d.ts +62 -0
- package/dist/sync/v3/entityEventLegacyAdoptionService.js +180 -0
- package/dist/sync/v3/initiativeActivityAuthoritativeRevision.d.ts +11 -0
- package/dist/sync/v3/initiativeActivityAuthoritativeRevision.js +23 -0
- package/dist/sync/v3/initiativeActivityIdentity.d.ts +8 -0
- package/dist/sync/v3/initiativeActivityIdentity.js +14 -0
- package/dist/sync/v3/initiativeCoexistence.d.ts +26 -0
- package/dist/sync/v3/initiativeCoexistence.js +148 -0
- package/dist/sync/v3/initiativeFeedActivationCapability.d.ts +6 -0
- package/dist/sync/v3/initiativeFeedActivationCapability.js +16 -0
- package/dist/sync/v3/initiativeMutationPayload.d.ts +26 -0
- package/dist/sync/v3/initiativeMutationPayload.js +144 -0
- package/dist/sync/v3/initiativeMutationService.d.ts +62 -0
- package/dist/sync/v3/initiativeMutationService.js +206 -0
- package/dist/sync/v3/localEntityEventLegacyAdoption.d.ts +31 -0
- package/dist/sync/v3/localEntityEventLegacyAdoption.js +607 -0
- package/dist/sync/v3/localInitiativeOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localInitiativeOutboxHandler.js +88 -0
- package/dist/sync/v3/localInitiativeOutboxService.d.ts +50 -0
- package/dist/sync/v3/localInitiativeOutboxService.js +495 -0
- package/dist/sync/v3/localOperationIdentityStore.d.ts +81 -0
- package/dist/sync/v3/localOperationIdentityStore.js +388 -0
- package/dist/sync/v3/localOutboxDispatchCapability.d.ts +7 -0
- package/dist/sync/v3/localOutboxDispatchCapability.js +13 -0
- package/dist/sync/v3/localOutboxDispatchRuntime.d.ts +16 -0
- package/dist/sync/v3/localOutboxDispatchRuntime.js +269 -0
- package/dist/sync/v3/localOutboxDispatcher.d.ts +53 -0
- package/dist/sync/v3/localOutboxDispatcher.js +362 -0
- package/dist/sync/v3/localOutboxDrainClient.d.ts +50 -0
- package/dist/sync/v3/localOutboxDrainClient.js +250 -0
- package/dist/sync/v3/localOutboxOperationHandler.d.ts +31 -0
- package/dist/sync/v3/localOutboxOperationHandler.js +10 -0
- package/dist/sync/v3/localOutboxRecoveryClient.d.ts +14 -0
- package/dist/sync/v3/localOutboxRecoveryClient.js +45 -0
- package/dist/sync/v3/localOutboxRecoveryPreparationService.d.ts +12 -0
- package/dist/sync/v3/localOutboxRecoveryPreparationService.js +151 -0
- package/dist/sync/v3/localSyncIdentityStore.d.ts +9 -0
- package/dist/sync/v3/localSyncIdentityStore.js +43 -0
- package/dist/sync/v3/localTaskAttachmentLinksOutboxHandler.d.ts +10 -0
- package/dist/sync/v3/localTaskAttachmentLinksOutboxHandler.js +70 -0
- package/dist/sync/v3/localTaskAttachmentLinksOutboxService.d.ts +45 -0
- package/dist/sync/v3/localTaskAttachmentLinksOutboxService.js +291 -0
- package/dist/sync/v3/localTaskChecklistOutboxHandler.d.ts +10 -0
- package/dist/sync/v3/localTaskChecklistOutboxHandler.js +54 -0
- package/dist/sync/v3/localTaskChecklistOutboxService.d.ts +47 -0
- package/dist/sync/v3/localTaskChecklistOutboxService.js +221 -0
- package/dist/sync/v3/localTaskCommentOutboxHandler.d.ts +10 -0
- package/dist/sync/v3/localTaskCommentOutboxHandler.js +94 -0
- package/dist/sync/v3/localTaskCommentOutboxService.d.ts +75 -0
- package/dist/sync/v3/localTaskCommentOutboxService.js +391 -0
- package/dist/sync/v3/localTaskCreateClient.d.ts +27 -0
- package/dist/sync/v3/localTaskCreateClient.js +209 -0
- package/dist/sync/v3/localTaskCreateOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localTaskCreateOutboxHandler.js +147 -0
- package/dist/sync/v3/localTaskCreateOutboxService.d.ts +77 -0
- package/dist/sync/v3/localTaskCreateOutboxService.js +397 -0
- package/dist/sync/v3/localTaskDeleteClient.d.ts +10 -0
- package/dist/sync/v3/localTaskDeleteClient.js +23 -0
- package/dist/sync/v3/localTaskDeleteOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localTaskDeleteOutboxHandler.js +54 -0
- package/dist/sync/v3/localTaskDeleteOutboxService.d.ts +38 -0
- package/dist/sync/v3/localTaskDeleteOutboxService.js +235 -0
- package/dist/sync/v3/localTaskLegacyRootAdoption.d.ts +28 -0
- package/dist/sync/v3/localTaskLegacyRootAdoption.js +219 -0
- package/dist/sync/v3/localTaskLifecycleClient.d.ts +49 -0
- package/dist/sync/v3/localTaskLifecycleClient.js +57 -0
- package/dist/sync/v3/localTaskLifecycleOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localTaskLifecycleOutboxHandler.js +94 -0
- package/dist/sync/v3/localTaskLifecycleOutboxService.d.ts +60 -0
- package/dist/sync/v3/localTaskLifecycleOutboxService.js +304 -0
- package/dist/sync/v3/localTaskMetadataClient.d.ts +13 -0
- package/dist/sync/v3/localTaskMetadataClient.js +30 -0
- package/dist/sync/v3/localTaskMetadataOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localTaskMetadataOutboxHandler.js +70 -0
- package/dist/sync/v3/localTaskMetadataOutboxService.d.ts +48 -0
- package/dist/sync/v3/localTaskMetadataOutboxService.js +229 -0
- package/dist/sync/v3/localTaskOperationClient.d.ts +72 -0
- package/dist/sync/v3/localTaskOperationClient.js +195 -0
- package/dist/sync/v3/localTaskRelationshipOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localTaskRelationshipOutboxHandler.js +114 -0
- package/dist/sync/v3/localTaskRelationshipOutboxService.d.ts +45 -0
- package/dist/sync/v3/localTaskRelationshipOutboxService.js +192 -0
- package/dist/sync/v3/localTaskRestoreClient.d.ts +13 -0
- package/dist/sync/v3/localTaskRestoreClient.js +32 -0
- package/dist/sync/v3/localTaskRestoreOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localTaskRestoreOutboxHandler.js +41 -0
- package/dist/sync/v3/localTaskRestoreOutboxService.d.ts +56 -0
- package/dist/sync/v3/localTaskRestoreOutboxService.js +323 -0
- package/dist/sync/v3/localTaskStatusClient.d.ts +17 -0
- package/dist/sync/v3/localTaskStatusClient.js +35 -0
- package/dist/sync/v3/localTaskStatusOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localTaskStatusOutboxHandler.js +75 -0
- package/dist/sync/v3/localTaskStatusOutboxService.d.ts +53 -0
- package/dist/sync/v3/localTaskStatusOutboxService.js +422 -0
- package/dist/sync/v3/localTaxonomyCompositeOutboxService.d.ts +34 -0
- package/dist/sync/v3/localTaxonomyCompositeOutboxService.js +290 -0
- package/dist/sync/v3/localTaxonomyOutboxHandler.d.ts +9 -0
- package/dist/sync/v3/localTaxonomyOutboxHandler.js +106 -0
- package/dist/sync/v3/localTaxonomyOutboxService.d.ts +30 -0
- package/dist/sync/v3/localTaxonomyOutboxService.js +181 -0
- package/dist/sync/v3/localWorkflowRuntimeOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localWorkflowRuntimeOutboxHandler.js +113 -0
- package/dist/sync/v3/localWorkflowRuntimeOutboxService.d.ts +37 -0
- package/dist/sync/v3/localWorkflowRuntimeOutboxService.js +330 -0
- package/dist/sync/v3/localWorkspaceSyncServerOutboxDispatcher.d.ts +63 -0
- package/dist/sync/v3/localWorkspaceSyncServerOutboxDispatcher.js +264 -0
- package/dist/sync/v3/localWorkstreamOutboxHandler.d.ts +8 -0
- package/dist/sync/v3/localWorkstreamOutboxHandler.js +102 -0
- package/dist/sync/v3/localWorkstreamOutboxService.d.ts +52 -0
- package/dist/sync/v3/localWorkstreamOutboxService.js +579 -0
- package/dist/sync/v3/localWorkstreamTaskOrderOutboxHandler.d.ts +10 -0
- package/dist/sync/v3/localWorkstreamTaskOrderOutboxHandler.js +57 -0
- package/dist/sync/v3/localWorkstreamTaskOrderOutboxService.d.ts +30 -0
- package/dist/sync/v3/localWorkstreamTaskOrderOutboxService.js +128 -0
- package/dist/sync/v3/planningActivation.d.ts +13 -0
- package/dist/sync/v3/planningActivation.js +33 -0
- package/dist/sync/v3/planningAttachmentActivityValidation.d.ts +9 -0
- package/dist/sync/v3/planningAttachmentActivityValidation.js +87 -0
- package/dist/sync/v3/programScaffoldService.d.ts +143 -0
- package/dist/sync/v3/programScaffoldService.js +478 -0
- package/dist/sync/v3/syncDurabilityStore.d.ts +773 -0
- package/dist/sync/v3/syncDurabilityStore.js +4635 -0
- package/dist/sync/v3/taskActivityAuthoritativeRevision.d.ts +16 -0
- package/dist/sync/v3/taskActivityAuthoritativeRevision.js +67 -0
- package/dist/sync/v3/taskActivityJournal.d.ts +20 -0
- package/dist/sync/v3/taskActivityJournal.js +195 -0
- package/dist/sync/v3/taskAttachmentLinksActivityIdentity.d.ts +6 -0
- package/dist/sync/v3/taskAttachmentLinksActivityIdentity.js +14 -0
- package/dist/sync/v3/taskAttachmentLinksMutationService.d.ts +111 -0
- package/dist/sync/v3/taskAttachmentLinksMutationService.js +202 -0
- package/dist/sync/v3/taskChecklistActivityIdentity.d.ts +6 -0
- package/dist/sync/v3/taskChecklistActivityIdentity.js +14 -0
- package/dist/sync/v3/taskChecklistMutationService.d.ts +92 -0
- package/dist/sync/v3/taskChecklistMutationService.js +156 -0
- package/dist/sync/v3/taskCommentActivityIdentity.d.ts +7 -0
- package/dist/sync/v3/taskCommentActivityIdentity.js +15 -0
- package/dist/sync/v3/taskCommentMutationService.d.ts +150 -0
- package/dist/sync/v3/taskCommentMutationService.js +392 -0
- package/dist/sync/v3/taskCommentReconcileProvenance.d.ts +58 -0
- package/dist/sync/v3/taskCommentReconcileProvenance.js +170 -0
- package/dist/sync/v3/taskCreateActivation.d.ts +19 -0
- package/dist/sync/v3/taskCreateActivation.js +84 -0
- package/dist/sync/v3/taskCreateActivityIdentity.d.ts +7 -0
- package/dist/sync/v3/taskCreateActivityIdentity.js +18 -0
- package/dist/sync/v3/taskCreateMutationService.d.ts +103 -0
- package/dist/sync/v3/taskCreateMutationService.js +283 -0
- package/dist/sync/v3/taskDeleteActivation.d.ts +7 -0
- package/dist/sync/v3/taskDeleteActivation.js +14 -0
- package/dist/sync/v3/taskDeleteMutationService.d.ts +35 -0
- package/dist/sync/v3/taskDeleteMutationService.js +133 -0
- package/dist/sync/v3/taskLegacyRootAdoptionService.d.ts +78 -0
- package/dist/sync/v3/taskLegacyRootAdoptionService.js +175 -0
- package/dist/sync/v3/taskLifecycleActivityIdentity.d.ts +9 -0
- package/dist/sync/v3/taskLifecycleActivityIdentity.js +18 -0
- package/dist/sync/v3/taskLifecycleMutationPayload.d.ts +5 -0
- package/dist/sync/v3/taskLifecycleMutationPayload.js +28 -0
- package/dist/sync/v3/taskLifecycleMutationService.d.ts +66 -0
- package/dist/sync/v3/taskLifecycleMutationService.js +92 -0
- package/dist/sync/v3/taskMetadataActivation.d.ts +12 -0
- package/dist/sync/v3/taskMetadataActivation.js +38 -0
- package/dist/sync/v3/taskMetadataActivityIdentity.d.ts +7 -0
- package/dist/sync/v3/taskMetadataActivityIdentity.js +18 -0
- package/dist/sync/v3/taskMetadataCoexistence.d.ts +37 -0
- package/dist/sync/v3/taskMetadataCoexistence.js +134 -0
- package/dist/sync/v3/taskMetadataMutationService.d.ts +71 -0
- package/dist/sync/v3/taskMetadataMutationService.js +199 -0
- package/dist/sync/v3/taskRelationshipLegacyAdoptionService.d.ts +48 -0
- package/dist/sync/v3/taskRelationshipLegacyAdoptionService.js +164 -0
- package/dist/sync/v3/taskRelationshipMutationService.d.ts +50 -0
- package/dist/sync/v3/taskRelationshipMutationService.js +148 -0
- package/dist/sync/v3/taskRestoreMutationService.d.ts +90 -0
- package/dist/sync/v3/taskRestoreMutationService.js +179 -0
- package/dist/sync/v3/taskStatusActivation.d.ts +7 -0
- package/dist/sync/v3/taskStatusActivation.js +15 -0
- package/dist/sync/v3/taskStatusMutationService.d.ts +76 -0
- package/dist/sync/v3/taskStatusMutationService.js +308 -0
- package/dist/sync/v3/taskWorkflowMutationPayload.d.ts +4 -0
- package/dist/sync/v3/taskWorkflowMutationPayload.js +22 -0
- package/dist/sync/v3/taskWorkflowMutationService.d.ts +64 -0
- package/dist/sync/v3/taskWorkflowMutationService.js +102 -0
- package/dist/sync/v3/taxonomyCoexistence.d.ts +10 -0
- package/dist/sync/v3/taxonomyCoexistence.js +19 -0
- package/dist/sync/v3/taxonomyCompositeMutationService.d.ts +110 -0
- package/dist/sync/v3/taxonomyCompositeMutationService.js +304 -0
- package/dist/sync/v3/taxonomyMutationService.d.ts +57 -0
- package/dist/sync/v3/taxonomyMutationService.js +106 -0
- package/dist/sync/v3/taxonomyStateMutation.d.ts +22 -0
- package/dist/sync/v3/taxonomyStateMutation.js +49 -0
- package/dist/sync/v3/taxonomySyncPayload.d.ts +9 -0
- package/dist/sync/v3/taxonomySyncPayload.js +199 -0
- package/dist/sync/v3/workflowAssignmentSync.d.ts +22 -0
- package/dist/sync/v3/workflowAssignmentSync.js +213 -0
- package/dist/sync/v3/workflowRuntimeMutationService.d.ts +89 -0
- package/dist/sync/v3/workflowRuntimeMutationService.js +359 -0
- package/dist/sync/v3/workflowRuntimeOperationIdentity.d.ts +13 -0
- package/dist/sync/v3/workflowRuntimeOperationIdentity.js +35 -0
- package/dist/sync/v3/workflowRuntimeSync.d.ts +141 -0
- package/dist/sync/v3/workflowRuntimeSync.js +485 -0
- package/dist/sync/v3/workspaceSyncJournalReader.d.ts +43 -0
- package/dist/sync/v3/workspaceSyncJournalReader.js +45 -0
- package/dist/sync/v3/workspaceSyncLocalOwnershipSnapshot.d.ts +28 -0
- package/dist/sync/v3/workspaceSyncLocalOwnershipSnapshot.js +81 -0
- package/dist/sync/v3/workspaceSyncPayloadFingerprint.d.ts +1 -0
- package/dist/sync/v3/workspaceSyncPayloadFingerprint.js +5 -0
- package/dist/sync/v3/workspaceSyncV2ProjectionExclusions.d.ts +16 -0
- package/dist/sync/v3/workspaceSyncV2ProjectionExclusions.js +161 -0
- package/dist/sync/v3/workspaceSyncV3AttachmentApplyObligationStore.d.ts +83 -0
- package/dist/sync/v3/workspaceSyncV3AttachmentApplyObligationStore.js +161 -0
- package/dist/sync/v3/workspaceSyncV3AttachmentAssetHydration.d.ts +16 -0
- package/dist/sync/v3/workspaceSyncV3AttachmentAssetHydration.js +90 -0
- package/dist/sync/v3/workspaceSyncV3CloudOperationHandler.d.ts +65 -0
- package/dist/sync/v3/workspaceSyncV3CloudOperationHandler.js +356 -0
- package/dist/sync/v3/workspaceSyncV3CombinedCoverage.d.ts +51 -0
- package/dist/sync/v3/workspaceSyncV3CombinedCoverage.js +171 -0
- package/dist/sync/v3/workspaceSyncV3CombinedFeedOrchestrator.d.ts +43 -0
- package/dist/sync/v3/workspaceSyncV3CombinedFeedOrchestrator.js +535 -0
- package/dist/sync/v3/workspaceSyncV3CombinedLocalApply.d.ts +50 -0
- package/dist/sync/v3/workspaceSyncV3CombinedLocalApply.js +1149 -0
- package/dist/sync/v3/workspaceSyncV3CombinedProjectionState.d.ts +96 -0
- package/dist/sync/v3/workspaceSyncV3CombinedProjectionState.js +672 -0
- package/dist/sync/v3/workspaceSyncV3CombinedRepairBaseline.d.ts +42 -0
- package/dist/sync/v3/workspaceSyncV3CombinedRepairBaseline.js +598 -0
- package/dist/sync/v3/workspaceSyncV3CombinedRepairMaterialization.d.ts +65 -0
- package/dist/sync/v3/workspaceSyncV3CombinedRepairMaterialization.js +505 -0
- package/dist/sync/v3/workspaceSyncV3CombinedRepairSnapshot.d.ts +78 -0
- package/dist/sync/v3/workspaceSyncV3CombinedRepairSnapshot.js +511 -0
- package/dist/sync/v3/workspaceSyncV3CombinedWireContract.d.ts +45 -0
- package/dist/sync/v3/workspaceSyncV3CombinedWireContract.js +125 -0
- package/dist/sync/v3/workspaceSyncV3CoverageRegistry.d.ts +13 -0
- package/dist/sync/v3/workspaceSyncV3CoverageRegistry.js +34 -0
- package/dist/sync/v3/workspaceSyncV3CursorEncoding.d.ts +1 -0
- package/dist/sync/v3/workspaceSyncV3CursorEncoding.js +6 -0
- package/dist/sync/v3/workspaceSyncV3DomainAdmission.d.ts +43 -0
- package/dist/sync/v3/workspaceSyncV3DomainAdmission.js +118 -0
- package/dist/sync/v3/workspaceSyncV3Feed.d.ts +95 -0
- package/dist/sync/v3/workspaceSyncV3Feed.js +243 -0
- package/dist/sync/v3/workspaceSyncV3FeedApply.d.ts +13 -0
- package/dist/sync/v3/workspaceSyncV3FeedApply.js +67 -0
- package/dist/sync/v3/workspaceSyncV3FeedClientContract.d.ts +3 -0
- package/dist/sync/v3/workspaceSyncV3FeedClientContract.js +46 -0
- package/dist/sync/v3/workspaceSyncV3FeedCursorKeys.d.ts +10 -0
- package/dist/sync/v3/workspaceSyncV3FeedCursorKeys.js +58 -0
- package/dist/sync/v3/workspaceSyncV3FeedOrchestrator.d.ts +31 -0
- package/dist/sync/v3/workspaceSyncV3FeedOrchestrator.js +228 -0
- package/dist/sync/v3/workspaceSyncV3FeedProfile.d.ts +32 -0
- package/dist/sync/v3/workspaceSyncV3FeedProfile.js +21 -0
- package/dist/sync/v3/workspaceSyncV3InitiativeLocalApply.d.ts +36 -0
- package/dist/sync/v3/workspaceSyncV3InitiativeLocalApply.js +163 -0
- package/dist/sync/v3/workspaceSyncV3InitiativeRepair.d.ts +33 -0
- package/dist/sync/v3/workspaceSyncV3InitiativeRepair.js +118 -0
- package/dist/sync/v3/workspaceSyncV3LegacyBoundaryAttestation.d.ts +10 -0
- package/dist/sync/v3/workspaceSyncV3LegacyBoundaryAttestation.js +45 -0
- package/dist/sync/v3/workspaceSyncV3LocalOutboxStatus.d.ts +27 -0
- package/dist/sync/v3/workspaceSyncV3LocalOutboxStatus.js +83 -0
- package/dist/sync/v3/workspaceSyncV3NestedCoverage.d.ts +10 -0
- package/dist/sync/v3/workspaceSyncV3NestedCoverage.js +40 -0
- package/dist/sync/v3/workspaceSyncV3NestedTaskApply.d.ts +83 -0
- package/dist/sync/v3/workspaceSyncV3NestedTaskApply.js +325 -0
- package/dist/sync/v3/workspaceSyncV3NestedTaskCodecs.d.ts +59 -0
- package/dist/sync/v3/workspaceSyncV3NestedTaskCodecs.js +302 -0
- package/dist/sync/v3/workspaceSyncV3NestedTaskProjection.d.ts +47 -0
- package/dist/sync/v3/workspaceSyncV3NestedTaskProjection.js +329 -0
- package/dist/sync/v3/workspaceSyncV3NestedTaskRepairSnapshot.d.ts +19 -0
- package/dist/sync/v3/workspaceSyncV3NestedTaskRepairSnapshot.js +41 -0
- package/dist/sync/v3/workspaceSyncV3NestedWireContract.d.ts +6 -0
- package/dist/sync/v3/workspaceSyncV3NestedWireContract.js +16 -0
- package/dist/sync/v3/workspaceSyncV3OperationProjection.d.ts +8 -0
- package/dist/sync/v3/workspaceSyncV3OperationProjection.js +52 -0
- package/dist/sync/v3/workspaceSyncV3OperationProtocol.d.ts +229 -0
- package/dist/sync/v3/workspaceSyncV3OperationProtocol.js +1 -0
- package/dist/sync/v3/workspaceSyncV3OperatorDiagnostics.d.ts +165 -0
- package/dist/sync/v3/workspaceSyncV3OperatorDiagnostics.js +414 -0
- package/dist/sync/v3/workspaceSyncV3OriginActor.d.ts +36 -0
- package/dist/sync/v3/workspaceSyncV3OriginActor.js +61 -0
- package/dist/sync/v3/workspaceSyncV3OriginAssertion.d.ts +46 -0
- package/dist/sync/v3/workspaceSyncV3OriginAssertion.js +121 -0
- package/dist/sync/v3/workspaceSyncV3OriginAssertionHeader.d.ts +1 -0
- package/dist/sync/v3/workspaceSyncV3OriginAssertionHeader.js +1 -0
- package/dist/sync/v3/workspaceSyncV3PlanningOrderCoverage.d.ts +10 -0
- package/dist/sync/v3/workspaceSyncV3PlanningOrderCoverage.js +34 -0
- package/dist/sync/v3/workspaceSyncV3PlanningOrderWireContract.d.ts +6 -0
- package/dist/sync/v3/workspaceSyncV3PlanningOrderWireContract.js +10 -0
- package/dist/sync/v3/workspaceSyncV3ProjectionState.d.ts +105 -0
- package/dist/sync/v3/workspaceSyncV3ProjectionState.js +467 -0
- package/dist/sync/v3/workspaceSyncV3TaskCommentAudit.d.ts +56 -0
- package/dist/sync/v3/workspaceSyncV3TaskCommentAudit.js +250 -0
- package/dist/sync/v3/workspaceSyncV3TaskRelationshipProjection.d.ts +30 -0
- package/dist/sync/v3/workspaceSyncV3TaskRelationshipProjection.js +142 -0
- package/dist/sync/v3/workspaceSyncV3TaskRootProjection.d.ts +40 -0
- package/dist/sync/v3/workspaceSyncV3TaskRootProjection.js +246 -0
- package/dist/sync/v3/workspaceSyncV3TaxonomyFeedProjection.d.ts +39 -0
- package/dist/sync/v3/workspaceSyncV3TaxonomyFeedProjection.js +185 -0
- package/dist/sync/v3/workspaceSyncV3WorkflowCoverage.d.ts +10 -0
- package/dist/sync/v3/workspaceSyncV3WorkflowCoverage.js +36 -0
- package/dist/sync/v3/workspaceSyncV3WorkflowRuntimeApply.d.ts +17 -0
- package/dist/sync/v3/workspaceSyncV3WorkflowRuntimeApply.js +143 -0
- package/dist/sync/v3/workspaceSyncV3WorkflowRuntimeProjection.d.ts +9 -0
- package/dist/sync/v3/workspaceSyncV3WorkflowRuntimeProjection.js +195 -0
- package/dist/sync/v3/workspaceSyncV3WorkflowWireContract.d.ts +11 -0
- package/dist/sync/v3/workspaceSyncV3WorkflowWireContract.js +12 -0
- package/dist/sync/v3/workspaceSyncV3WorkstreamProjection.d.ts +4 -0
- package/dist/sync/v3/workspaceSyncV3WorkstreamProjection.js +98 -0
- package/dist/sync/v3/workspaceSyncV3WorkstreamTaskOrderProjection.d.ts +9 -0
- package/dist/sync/v3/workspaceSyncV3WorkstreamTaskOrderProjection.js +72 -0
- package/dist/sync/v3/workstreamActivityAuthoritativeRevision.d.ts +11 -0
- package/dist/sync/v3/workstreamActivityAuthoritativeRevision.js +23 -0
- package/dist/sync/v3/workstreamActivityIdentity.d.ts +8 -0
- package/dist/sync/v3/workstreamActivityIdentity.js +14 -0
- package/dist/sync/v3/workstreamCoexistence.d.ts +19 -0
- package/dist/sync/v3/workstreamCoexistence.js +64 -0
- package/dist/sync/v3/workstreamMutationPayload.d.ts +27 -0
- package/dist/sync/v3/workstreamMutationPayload.js +147 -0
- package/dist/sync/v3/workstreamMutationService.d.ts +72 -0
- package/dist/sync/v3/workstreamMutationService.js +256 -0
- package/dist/sync/v3/workstreamTaskOrderMutationService.d.ts +55 -0
- package/dist/sync/v3/workstreamTaskOrderMutationService.js +110 -0
- package/dist/sync/v3/workstreamTaskOrderSync.d.ts +14 -0
- package/dist/sync/v3/workstreamTaskOrderSync.js +25 -0
- package/dist/sync/workspaceContentManifest.d.ts +86 -0
- package/dist/sync/workspaceContentManifest.js +123 -0
- package/dist/sync/workspacePullFeed.d.ts +186 -2
- package/dist/sync/workspacePullFeed.js +513 -136
- package/dist/sync/workspacePushPreparedPlan.d.ts +21 -0
- package/dist/sync/workspacePushPreparedPlan.js +1 -0
- package/dist/sync/workspaceRepair.d.ts +17 -25
- package/dist/sync/workspaceRepair.js +348 -25
- package/dist/sync/workspaceSyncContentDecryption.d.ts +6 -0
- package/dist/sync/workspaceSyncContentDecryption.js +11 -0
- package/dist/sync/workspaceSyncModel.d.ts +216 -5
- package/dist/sync/workspaceSyncModel.js +371 -35
- package/dist/sync/workspaceSyncSnapshotProjection.d.ts +11 -0
- package/dist/sync/workspaceSyncSnapshotProjection.js +101 -0
- package/dist/sync/workspaceSyncState.d.ts +13 -0
- package/dist/sync/workspaceSyncState.js +36 -0
- package/dist/sync/workspaceSyncV2SnapshotBuilder.d.ts +106 -0
- package/dist/sync/workspaceSyncV2SnapshotBuilder.js +193 -0
- package/dist/types.d.ts +23 -15
- package/dist/types.js +1 -3
- package/dist/ui/ai-profile-clients/amazon-nova.svg +1 -0
- package/dist/ui/ai-profile-clients/antigravity.png +0 -0
- package/dist/ui/ai-profile-clients/chatgpt.svg +10 -0
- package/dist/ui/ai-profile-clients/claude-chat.svg +1 -0
- package/dist/ui/ai-profile-clients/claude-code.svg +15 -0
- package/dist/ui/ai-profile-clients/cline-app-icon-light.png +0 -0
- package/dist/ui/ai-profile-clients/cline.svg +16 -0
- package/dist/ui/ai-profile-clients/codex.svg +1 -0
- package/dist/ui/ai-profile-clients/copilot.png +0 -0
- package/dist/ui/ai-profile-clients/cursor.svg +1 -0
- package/dist/ui/ai-profile-clients/deepseek.svg +1 -0
- package/dist/ui/ai-profile-clients/gemini-cli-icon.png +0 -0
- package/dist/ui/ai-profile-clients/gemini.svg +10 -0
- package/dist/ui/ai-profile-clients/grok.svg +31 -0
- package/dist/ui/ai-profile-clients/kiro.svg +11 -0
- package/dist/ui/ai-profile-clients/llama.svg +1 -0
- package/dist/ui/ai-profile-clients/mistral.svg +1 -0
- package/dist/ui/ai-profile-clients/ms_copilot.jpeg +0 -0
- package/dist/ui/ai-profile-clients/openclaw.png +0 -0
- package/dist/ui/ai-profile-clients/perplexity.svg +1 -0
- package/dist/ui/ai-profile-clients/vscode.svg +41 -0
- package/dist/ui/ai-profile-clients/windsurf.svg +11 -0
- package/dist/ui/assets/AiIdentityRosterCard-DB1BLO_j.js +1 -0
- package/dist/ui/assets/AiProfilesModule-DPxQeF9N.js +1 -0
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-CBRZ8rca.css +1 -0
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-DHNYaNg6.js +3 -0
- package/dist/ui/assets/AssetTraySortControl-B9k5caQW.css +1 -0
- package/dist/ui/assets/AssetTraySortControl-DphbyHVc.js +1 -0
- package/dist/ui/assets/ContextAttachmentManager-CMxSzHqc.js +3 -0
- package/dist/ui/assets/DocumentWorkspace-BC7sy5TG.js +261 -0
- package/dist/ui/assets/DocumentWorkspace-BIBGBfd7.css +1 -0
- package/dist/ui/assets/EntityActivityTimeline-BfJbZRdl.css +1 -0
- package/dist/ui/assets/EntityActivityTimeline-pJ2ZjZ-k.js +1 -0
- package/dist/ui/assets/PlanningModule-CeTqXMMz.css +1 -0
- package/dist/ui/assets/PlanningModule-t5GbvVR9.js +1 -0
- package/dist/ui/assets/PlansPage-BVH_NfgT.js +1 -0
- package/dist/ui/assets/PlansPage-C2nkK2Bp.css +1 -0
- package/dist/ui/assets/TaskContextUpload-Ds4LnDzV.css +1 -0
- package/dist/ui/assets/TaskContextUpload-bl4fOOUz.js +1 -0
- package/dist/ui/assets/TaskSettings-xVsxSa0g.js +12 -0
- package/dist/ui/assets/TaskforceAgentsModule-CkAxW19K.js +21 -0
- package/dist/ui/assets/TaskforceAgentsModule-D6IC0S7Q.css +1 -0
- package/dist/ui/assets/WorkflowManagerModule-BKqIGVnF.js +1 -0
- package/dist/ui/assets/WorkflowManagerModule-DF10XENz.css +1 -0
- package/dist/ui/assets/antigravity-DRKQga2U.png +0 -0
- package/dist/ui/assets/cursor-BM_3k4Y4.svg +1 -0
- package/dist/ui/assets/gemini-cli-icon-dBAVjCcn.png +0 -0
- package/dist/ui/assets/grok-BuodbWaG.svg +31 -0
- package/dist/ui/assets/index-BzJlVnNS.css +1 -0
- package/dist/ui/assets/index-Cx7vZJHL.js +7 -0
- package/dist/ui/assets/{vendor-dnd-DRzYolkg.js → vendor-dnd-CJ-AjP-Y.js} +1 -1
- package/dist/ui/assets/{vendor-icons-CLnehDTw.js → vendor-icons-B8ZNsH1g.js} +1 -1
- package/dist/ui/assets/{vendor-markdown-BUxTU7dS.js → vendor-markdown-_lhNCyq-.js} +9 -9
- package/dist/ui/assets/vendor-router-AqJMU8Lz.js +3 -0
- package/dist/ui/assets/vscode-C_7wk1WI.svg +41 -0
- package/dist/ui/branding/logos/logo_dark_bg.png +0 -0
- package/dist/ui/branding/logos/logo_favicon_dark.png +0 -0
- package/dist/ui/branding/logos/logo_favicon_dark.svg +56 -0
- package/dist/ui/branding/logos/logo_favicon_light.png +0 -0
- package/dist/ui/branding/logos/logo_light_bg.png +0 -0
- package/dist/ui/images/Taskforce_Van.webp +0 -0
- package/dist/ui/index.html +6 -6
- package/dist/update/uiUpdateService.d.ts +43 -0
- package/dist/update/uiUpdateService.js +149 -0
- package/dist/update/updateCli.d.ts +15 -0
- package/dist/update/updateCli.js +76 -0
- package/dist/update/updateExecutor.d.ts +40 -0
- package/dist/update/updateExecutor.js +474 -0
- package/dist/update/updateStatus.d.ts +83 -0
- package/dist/update/updateStatus.js +703 -0
- package/dist/utils/aiProfileAvatarPaths.d.ts +14 -0
- package/dist/utils/aiProfileAvatarPaths.js +52 -0
- package/dist/utils/aiProfileDefaultLogo.d.ts +7 -0
- package/dist/utils/aiProfileDefaultLogo.js +84 -0
- package/dist/utils/aiProfileEvents.d.ts +9 -1
- package/dist/utils/annotatedAttachments.d.ts +8 -0
- package/dist/utils/annotatedAttachments.js +17 -1
- package/dist/utils/assetTraySorting.d.ts +25 -0
- package/dist/utils/assetTraySorting.js +83 -0
- package/dist/utils/assignees.d.ts +5 -0
- package/dist/utils/assignees.js +14 -9
- package/dist/utils/authLogin.d.ts +10 -0
- package/dist/utils/authLogin.js +8 -0
- package/dist/utils/authSessionEvents.d.ts +2 -0
- package/dist/utils/authSessionEvents.js +6 -0
- package/dist/utils/avatarUpload.js +5 -5
- package/dist/utils/canonicalReferenceAttachments.d.ts +12 -0
- package/dist/utils/canonicalReferenceAttachments.js +42 -0
- package/dist/utils/cloudAssetDisplay.d.ts +2 -0
- package/dist/utils/cloudAssetDisplay.js +8 -0
- package/dist/utils/constants.d.ts +4 -11
- package/dist/utils/constants.js +5 -64
- package/dist/utils/contextAttachmentPreview.d.ts +11 -0
- package/dist/utils/contextAttachmentPreview.js +8 -0
- package/dist/utils/contextAttachmentUpload.d.ts +8 -0
- package/dist/utils/contextAttachmentUpload.js +144 -0
- package/dist/utils/documentNames.js +6 -4
- package/dist/utils/entityReferences.d.ts +14 -0
- package/dist/utils/entityReferences.js +21 -0
- package/dist/utils/httpSetCookie.d.ts +3 -0
- package/dist/utils/httpSetCookie.js +22 -0
- package/dist/utils/imageNoteStoragePaths.d.ts +3 -0
- package/dist/utils/imageNoteStoragePaths.js +19 -0
- package/dist/utils/imageReferences.d.ts +6 -0
- package/dist/utils/imageReferences.js +1 -0
- package/dist/utils/planningArchiveOrchestrator.d.ts +23 -0
- package/dist/utils/planningArchiveOrchestrator.js +37 -0
- package/dist/utils/planningArchivePresentation.d.ts +20 -0
- package/dist/utils/planningArchivePresentation.js +23 -0
- package/dist/utils/planningArchiveReadiness.d.ts +26 -0
- package/dist/utils/planningArchiveReadiness.js +30 -0
- package/dist/utils/planningFavorites.d.ts +7 -0
- package/dist/utils/planningFavorites.js +34 -0
- package/dist/utils/syncEventPresentation.js +53 -0
- package/dist/utils/syncStatusPresentation.d.ts +25 -0
- package/dist/utils/syncStatusPresentation.js +86 -5
- package/dist/utils/taskActivity.d.ts +9 -2
- package/dist/utils/taskActivity.js +61 -0
- package/dist/utils/taskDraftDefaults.d.ts +0 -8
- package/dist/utils/taskDraftDefaults.js +0 -4
- package/dist/utils/taskEvents.d.ts +11 -0
- package/dist/utils/taskEvents.js +6 -0
- package/dist/utils/taskHeaderQuickFilter.d.ts +14 -0
- package/dist/utils/taskHeaderQuickFilter.js +32 -0
- package/dist/utils/taskInvalidation.d.ts +23 -0
- package/dist/utils/taskInvalidation.js +67 -0
- package/dist/utils/taskNormalization.d.ts +2 -1
- package/dist/utils/taskNormalization.js +44 -18
- package/dist/utils/taskReferences.d.ts +16 -0
- package/dist/utils/taskReferences.js +63 -0
- package/dist/utils/taskforceAgentEvents.d.ts +8 -0
- package/dist/utils/taskforceAgentEvents.js +6 -0
- package/dist/utils/taskforceAgentSkillEvents.d.ts +7 -0
- package/dist/utils/taskforceAgentSkillEvents.js +8 -0
- package/dist/utils/uiNotice.d.ts +3 -0
- package/dist/utils/uiNotice.js +1 -1
- package/dist/utils/workspaceResourceEvents.d.ts +7 -0
- package/dist/utils/workspaceResourceEvents.js +6 -0
- package/dist/utils/workspaceSyncPresentation.d.ts +24 -0
- package/dist/utils/workspaceSyncPresentation.js +243 -6
- package/package.json +69 -21
- package/dist/components/features/AgentsModule.d.ts +0 -18
- package/dist/components/features/AgentsModule.js +0 -479
- package/dist/components/features/InitiativesModule.d.ts +0 -22
- package/dist/components/features/InitiativesModule.js +0 -33
- package/dist/components/features/WorkflowsModule.d.ts +0 -27
- package/dist/components/features/WorkflowsModule.js +0 -21
- package/dist/components/features/settings/WorkflowEditor.d.ts +0 -15
- package/dist/components/features/settings/WorkflowEditor.js +0 -245
- package/dist/components/views/panels/DocumentFilterToolbar.d.ts +0 -10
- package/dist/components/views/panels/DocumentFilterToolbar.js +0 -7
- package/dist/components/views/standalone/modals/AccountHubModal.d.ts +0 -61
- package/dist/components/views/standalone/modals/AccountHubModal.js +0 -108
- package/dist/components/views/standalone/modals/EditProfileModal.d.ts +0 -19
- package/dist/components/views/standalone/modals/EditProfileModal.js +0 -11
- package/dist/hooks/ui/useResourceExport.d.ts +0 -21
- package/dist/hooks/ui/useResourceExport.js +0 -87
- package/dist/hooks/ui/useWorkflowTemplates.d.ts +0 -37
- package/dist/hooks/ui/useWorkflowTemplates.js +0 -116
- package/dist/mcp/clientProfileDefaults.d.ts +0 -12
- package/dist/mcp/clientProfileDefaults.js +0 -41
- package/dist/resources/templates/WORKFLOW_V2_POLICY.md +0 -55
- package/dist/resources/templates/environments/aider.yaml +0 -14
- package/dist/resources/templates/environments/antigravity.yaml +0 -10
- package/dist/resources/templates/environments/claude.yaml +0 -10
- package/dist/resources/templates/environments/cline.yaml +0 -10
- package/dist/resources/templates/environments/codex.yaml +0 -13
- package/dist/resources/templates/environments/copilot.yaml +0 -10
- package/dist/resources/templates/environments/cursor.yaml +0 -9
- package/dist/resources/templates/environments/gemini.yaml +0 -9
- package/dist/resources/templates/environments/windsurf.yaml +0 -10
- package/dist/resources/templates/workflow-sources/README.md +0 -9
- package/dist/resources/templates/workflow-sources/workflowDocs.mjs +0 -530
- package/dist/resources/templates/workflow-sources/workflowEditorOverrides.json +0 -1
- package/dist/resources/templates/workflows/collaborate.yaml +0 -109
- package/dist/resources/templates/workflows/do.yaml +0 -87
- package/dist/resources/templates/workflows/evaluate.yaml +0 -116
- package/dist/resources/templates/workflows/execute.yaml +0 -156
- package/dist/resources/templates/workflows/plan.yaml +0 -118
- package/dist/resources/templates/workflows/review.yaml +0 -114
- package/dist/services/formatTransformers.d.ts +0 -29
- package/dist/services/formatTransformers.js +0 -56
- package/dist/services/templateEngine.d.ts +0 -46
- package/dist/services/templateEngine.js +0 -148
- package/dist/shared/workflowDefaults.d.ts +0 -9
- package/dist/shared/workflowDefaults.js +0 -11
- package/dist/ui/agent-logos/Gemini CLI.jpeg +0 -0
- package/dist/ui/agent-logos/antigravity.jpeg +0 -0
- package/dist/ui/agent-logos/chatgpt.png +0 -0
- package/dist/ui/agent-logos/claude-code.jpeg +0 -0
- package/dist/ui/agent-logos/codex.jpeg +0 -0
- package/dist/ui/agent-logos/cursor.png +0 -0
- package/dist/ui/agent-logos/openclaw.jpeg +0 -0
- package/dist/ui/agent-logos/windsurf.png +0 -0
- package/dist/ui/assets/AgentsModule-C4LcqhcZ.js +0 -1
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-B-Dq22d2.js +0 -3
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-BVKew-mH.css +0 -1
- package/dist/ui/assets/ContextAttachmentManager-DsXPTvi-.js +0 -3
- package/dist/ui/assets/DocumentWorkspace-CxA1wO3U.js +0 -252
- package/dist/ui/assets/DocumentWorkspace-D4rJKXzd.css +0 -1
- package/dist/ui/assets/EntityActivityTimeline-B8nSe8l3.js +0 -1
- package/dist/ui/assets/EntityActivityTimeline-DyqvvhuF.css +0 -1
- package/dist/ui/assets/InitiativesModule-VY95v38E.js +0 -1
- package/dist/ui/assets/PlansPage-CQbKDv1a.js +0 -1
- package/dist/ui/assets/PlansPage-DeAzWYTb.css +0 -1
- package/dist/ui/assets/TaskContextUpload-DvDlNpHC.js +0 -1
- package/dist/ui/assets/TaskSettings-CUWbYYtP.js +0 -12
- package/dist/ui/assets/WorkflowsModule-CgM3Jako.js +0 -5
- package/dist/ui/assets/documentReferences-Do9YjrS3.js +0 -1
- package/dist/ui/assets/index--mh3pktj.js +0 -5
- package/dist/ui/assets/index-BawaaEXS.css +0 -1
- package/dist/ui/assets/vendor-router-BbWMxlnO.js +0 -3
- package/dist/ui/branding/logos/logo_black_01.png +0 -0
- package/dist/ui/branding/logos/logo_black_02.png +0 -0
- package/dist/ui/branding/logos/logo_white_01.png +0 -0
- package/dist/ui/branding/logos/logo_white_02.png +0 -0
- package/scripts/generate-workflow-templates.mjs +0 -134
- package/src/resources/templates/WORKFLOW_V2_POLICY.md +0 -55
- package/src/resources/templates/environments/aider.yaml +0 -14
- package/src/resources/templates/environments/antigravity.yaml +0 -10
- package/src/resources/templates/environments/claude.yaml +0 -10
- package/src/resources/templates/environments/cline.yaml +0 -10
- package/src/resources/templates/environments/codex.yaml +0 -13
- package/src/resources/templates/environments/copilot.yaml +0 -10
- package/src/resources/templates/environments/cursor.yaml +0 -9
- package/src/resources/templates/environments/gemini.yaml +0 -9
- package/src/resources/templates/environments/windsurf.yaml +0 -10
- package/src/resources/templates/workflow-sources/README.md +0 -9
- package/src/resources/templates/workflow-sources/workflowDocs.mjs +0 -530
- package/src/resources/templates/workflow-sources/workflowEditorOverrides.json +0 -1
- package/src/resources/templates/workflows/collaborate.yaml +0 -109
- package/src/resources/templates/workflows/do.yaml +0 -87
- package/src/resources/templates/workflows/evaluate.yaml +0 -116
- package/src/resources/templates/workflows/execute.yaml +0 -156
- package/src/resources/templates/workflows/plan.yaml +0 -118
- package/src/resources/templates/workflows/review.yaml +0 -114
- /package/dist/ui/branding/logos/{logo_dark.svg → logo_dark_no_bg.svg} +0 -0
- /package/dist/ui/branding/logos/{logo_favicon.svg → logo_favicon_light.svg} +0 -0
- /package/dist/ui/branding/logos/{logo_light.svg → logo_light_no_bg.svg} +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MIGRATION_COMPAT_ENABLED } from '../runtime/migrationFlags.js';
|
|
2
|
+
import { backfillLegacyTaskforceAgentDefinitions } from './taskforceAgentDefinitionMigration.js';
|
|
1
3
|
function hasTable(db, tableName) {
|
|
2
4
|
if (db.provider === 'postgres') {
|
|
3
5
|
const row = db.prepare(`
|
|
@@ -28,11 +30,11 @@ export function ensureTenantSchema(db) {
|
|
|
28
30
|
if (!hasCommentTenantColumn) {
|
|
29
31
|
db.exec(`ALTER TABLE comments ADD COLUMN tenant_id TEXT NOT NULL DEFAULT 'default'`);
|
|
30
32
|
}
|
|
31
|
-
db.exec(`
|
|
33
|
+
db.transaction(() => db.exec(`
|
|
32
34
|
CREATE INDEX IF NOT EXISTS idx_tasks_tenant ON tasks(tenant_id);
|
|
33
35
|
CREATE INDEX IF NOT EXISTS idx_tasks_tenant_archived ON tasks(tenant_id, is_archived);
|
|
34
36
|
CREATE INDEX IF NOT EXISTS idx_comments_tenant_task ON comments(tenant_id, task_id);
|
|
35
|
-
`);
|
|
37
|
+
`))();
|
|
36
38
|
}
|
|
37
39
|
export function ensureScheduleTaskSchema(db) {
|
|
38
40
|
const columns = db.prepare(`PRAGMA table_info(tasks)`).all();
|
|
@@ -58,6 +60,16 @@ export function ensureScheduleTaskSchema(db) {
|
|
|
58
60
|
CREATE INDEX IF NOT EXISTS idx_tasks_due_date ON tasks(due_date);
|
|
59
61
|
`);
|
|
60
62
|
}
|
|
63
|
+
export function ensureWorkstreamTaskOrderSchema(db) {
|
|
64
|
+
const columns = db.prepare(`PRAGMA table_info(tasks)`).all();
|
|
65
|
+
if (!columns.some((column) => column.name === 'workstream_order')) {
|
|
66
|
+
db.exec(`ALTER TABLE tasks ADD COLUMN workstream_order INTEGER`);
|
|
67
|
+
}
|
|
68
|
+
db.exec(`
|
|
69
|
+
CREATE INDEX IF NOT EXISTS idx_tasks_workstream_order
|
|
70
|
+
ON tasks(tenant_id, workspace_id, workstream_id, workstream_order)
|
|
71
|
+
`);
|
|
72
|
+
}
|
|
61
73
|
export function ensureAssigneeTaskSchema(db) {
|
|
62
74
|
const columns = db.prepare(`PRAGMA table_info(tasks)`).all();
|
|
63
75
|
const hasAssigneeColumn = columns.some((c) => c.name === 'assignee');
|
|
@@ -67,6 +79,41 @@ export function ensureAssigneeTaskSchema(db) {
|
|
|
67
79
|
}
|
|
68
80
|
db.exec(`CREATE INDEX IF NOT EXISTS idx_tasks_assignee ON tasks(assignee)`);
|
|
69
81
|
}
|
|
82
|
+
/** Permanently removes the retired task approach field from existing databases. */
|
|
83
|
+
export function ensureTaskApproachRemoved(db) {
|
|
84
|
+
const columnNames = db.provider === 'postgres'
|
|
85
|
+
? new Set(db.prepare(`
|
|
86
|
+
SELECT column_name AS name
|
|
87
|
+
FROM information_schema.columns
|
|
88
|
+
WHERE table_name = 'tasks'
|
|
89
|
+
`).all().map((column) => column.name))
|
|
90
|
+
: new Set(db.prepare(`PRAGMA table_info(tasks)`).all().map((column) => column.name));
|
|
91
|
+
if (!columnNames.has('approach'))
|
|
92
|
+
return;
|
|
93
|
+
if (columnNames.has('taxonomies')) {
|
|
94
|
+
const rows = db.prepare(`SELECT id, taxonomies FROM tasks`).all();
|
|
95
|
+
const updateTaxonomies = db.prepare(`UPDATE tasks SET taxonomies = ? WHERE id = ?`);
|
|
96
|
+
for (const row of rows) {
|
|
97
|
+
if (!row.taxonomies)
|
|
98
|
+
continue;
|
|
99
|
+
try {
|
|
100
|
+
const taxonomies = JSON.parse(row.taxonomies);
|
|
101
|
+
if (!Object.prototype.hasOwnProperty.call(taxonomies, 'approach'))
|
|
102
|
+
continue;
|
|
103
|
+
delete taxonomies.approach;
|
|
104
|
+
updateTaxonomies.run(JSON.stringify(taxonomies), row.id);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Preserve malformed legacy taxonomy payloads for separate data repair.
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (db.provider === 'postgres') {
|
|
112
|
+
db.exec(`ALTER TABLE tasks DROP COLUMN IF EXISTS approach`);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
db.exec(`ALTER TABLE tasks DROP COLUMN approach`);
|
|
116
|
+
}
|
|
70
117
|
export function ensureTaskReferenceSchema(db) {
|
|
71
118
|
const columns = db.prepare(`PRAGMA table_info(tasks)`).all();
|
|
72
119
|
const hasReferenceNumberColumn = columns.some((c) => c.name === 'reference_number');
|
|
@@ -156,6 +203,240 @@ export function ensureTaskReferenceSchema(db) {
|
|
|
156
203
|
ON tasks(tenant_id, workspace_id, local_reference_number);
|
|
157
204
|
`);
|
|
158
205
|
}
|
|
206
|
+
const PLANNING_REFERENCE_DOMAINS = [
|
|
207
|
+
{
|
|
208
|
+
domain: 'initiative',
|
|
209
|
+
tableName: 'initiatives',
|
|
210
|
+
sequenceTableName: 'workspace_initiative_reference_sequences',
|
|
211
|
+
uniqueIndexName: 'idx_initiatives_workspace_reference',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
domain: 'workstream',
|
|
215
|
+
tableName: 'workstreams',
|
|
216
|
+
sequenceTableName: 'workspace_workstream_reference_sequences',
|
|
217
|
+
uniqueIndexName: 'idx_workstreams_workspace_reference',
|
|
218
|
+
},
|
|
219
|
+
];
|
|
220
|
+
/**
|
|
221
|
+
* Establishes one canonical planning reference per workspace before adding the
|
|
222
|
+
* database uniqueness constraint used by both ordinary and durable writes.
|
|
223
|
+
*/
|
|
224
|
+
export function ensurePlanningReferenceSchema(db) {
|
|
225
|
+
const repair = db.transaction(() => {
|
|
226
|
+
const hasDurableOutbox = db.provider === 'postgres'
|
|
227
|
+
? Boolean(db.prepare(`SELECT to_regclass('workspace_sync_outbox') AS name`).get()?.name)
|
|
228
|
+
: Boolean(db.prepare(`
|
|
229
|
+
SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'workspace_sync_outbox'
|
|
230
|
+
`).get()?.name);
|
|
231
|
+
for (const domain of PLANNING_REFERENCE_DOMAINS) {
|
|
232
|
+
const workspaceRows = db.prepare(`
|
|
233
|
+
SELECT DISTINCT
|
|
234
|
+
COALESCE(tenant_id, 'default') AS tenant_id,
|
|
235
|
+
COALESCE(workspace_id, 'default') AS workspace_id
|
|
236
|
+
FROM ${domain.tableName}
|
|
237
|
+
ORDER BY tenant_id ASC, workspace_id ASC
|
|
238
|
+
`).all();
|
|
239
|
+
const selectEntities = db.prepare(`
|
|
240
|
+
SELECT id, reference_number
|
|
241
|
+
FROM ${domain.tableName}
|
|
242
|
+
WHERE tenant_id = ? AND workspace_id = ?
|
|
243
|
+
ORDER BY created_at ASC, id ASC
|
|
244
|
+
`);
|
|
245
|
+
const updateReference = db.prepare(`
|
|
246
|
+
UPDATE ${domain.tableName}
|
|
247
|
+
SET reference_number = ?
|
|
248
|
+
WHERE tenant_id = ? AND workspace_id = ? AND id = ?
|
|
249
|
+
`);
|
|
250
|
+
const upsertSequence = db.prepare(`
|
|
251
|
+
INSERT INTO ${domain.sequenceTableName} (tenant_id, workspace_id, next_reference_number)
|
|
252
|
+
VALUES (?, ?, ?)
|
|
253
|
+
ON CONFLICT (tenant_id, workspace_id) DO UPDATE SET
|
|
254
|
+
next_reference_number = CASE
|
|
255
|
+
WHEN ${domain.sequenceTableName}.next_reference_number < EXCLUDED.next_reference_number
|
|
256
|
+
THEN EXCLUDED.next_reference_number
|
|
257
|
+
ELSE ${domain.sequenceTableName}.next_reference_number
|
|
258
|
+
END
|
|
259
|
+
`);
|
|
260
|
+
for (const workspaceRow of workspaceRows) {
|
|
261
|
+
const tenantId = String(workspaceRow.tenant_id || 'default').trim() || 'default';
|
|
262
|
+
const workspaceId = String(workspaceRow.workspace_id || 'default').trim() || 'default';
|
|
263
|
+
const entities = selectEntities.all(tenantId, workspaceId);
|
|
264
|
+
let provisionalIds = new Set();
|
|
265
|
+
if (hasDurableOutbox) {
|
|
266
|
+
const rows = db.prepare(`
|
|
267
|
+
SELECT entity_id
|
|
268
|
+
FROM workspace_sync_outbox
|
|
269
|
+
WHERE tenant_id = ? AND workspace_id = ?
|
|
270
|
+
AND domain = ? AND mutation_kind = 'create'
|
|
271
|
+
AND status IN ('pending', 'in_flight', 'blocked')
|
|
272
|
+
`).all(tenantId, workspaceId, domain.domain);
|
|
273
|
+
provisionalIds = new Set(rows.map((row) => String(row.entity_id || '').trim()).filter(Boolean));
|
|
274
|
+
}
|
|
275
|
+
const seen = new Set();
|
|
276
|
+
let maxReferenceNumber = 0;
|
|
277
|
+
const needsReference = [];
|
|
278
|
+
for (const entity of entities) {
|
|
279
|
+
const id = String(entity.id || '').trim();
|
|
280
|
+
if (!id)
|
|
281
|
+
continue;
|
|
282
|
+
if (provisionalIds.has(id)) {
|
|
283
|
+
if (entity.reference_number != null) {
|
|
284
|
+
updateReference.run(null, tenantId, workspaceId, id);
|
|
285
|
+
}
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
const numericReference = Number(entity.reference_number);
|
|
289
|
+
const referenceNumber = Number.isInteger(numericReference) && numericReference > 0
|
|
290
|
+
? numericReference
|
|
291
|
+
: null;
|
|
292
|
+
if (referenceNumber && !seen.has(referenceNumber)) {
|
|
293
|
+
seen.add(referenceNumber);
|
|
294
|
+
maxReferenceNumber = Math.max(maxReferenceNumber, referenceNumber);
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
needsReference.push(id);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
for (const id of needsReference) {
|
|
301
|
+
maxReferenceNumber += 1;
|
|
302
|
+
updateReference.run(maxReferenceNumber, tenantId, workspaceId, id);
|
|
303
|
+
}
|
|
304
|
+
upsertSequence.run(tenantId, workspaceId, maxReferenceNumber);
|
|
305
|
+
}
|
|
306
|
+
db.exec(`
|
|
307
|
+
CREATE UNIQUE INDEX IF NOT EXISTS ${domain.uniqueIndexName}
|
|
308
|
+
ON ${domain.tableName}(tenant_id, workspace_id, reference_number)
|
|
309
|
+
`);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
repair();
|
|
313
|
+
}
|
|
314
|
+
const CANONICAL_DOCUMENT_CONTENT_PATH = /^\/api\/taskforce\/documents\/([^/?#]+)\/content$/;
|
|
315
|
+
function inferPlanningAttachmentAssetId(pathValue) {
|
|
316
|
+
if (typeof pathValue !== 'string')
|
|
317
|
+
return null;
|
|
318
|
+
const encodedAssetId = pathValue.trim().match(CANONICAL_DOCUMENT_CONTENT_PATH)?.[1];
|
|
319
|
+
if (!encodedAssetId)
|
|
320
|
+
return null;
|
|
321
|
+
try {
|
|
322
|
+
const assetId = decodeURIComponent(encodedAssetId);
|
|
323
|
+
return assetId && assetId === assetId.trim() ? assetId : null;
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Repairs the physical planning JSON representation after legacy v2 writers
|
|
331
|
+
* omitted assetId even though the exact document content path and canonical
|
|
332
|
+
* workspace asset link already identified the attachment. This is an
|
|
333
|
+
* idempotent invariant repair rather than a journaled product mutation: the
|
|
334
|
+
* normalized planning model already exposed the same canonical identity.
|
|
335
|
+
*/
|
|
336
|
+
export function backfillPlanningAttachmentAssetIdentities(db, tenantId = 'default') {
|
|
337
|
+
const normalizedTenantId = String(tenantId || '').trim() || 'default';
|
|
338
|
+
const result = {
|
|
339
|
+
scannedAttachments: 0,
|
|
340
|
+
backfilledAttachments: 0,
|
|
341
|
+
updatedRows: 0,
|
|
342
|
+
};
|
|
343
|
+
const hasRequiredTables = ['initiatives', 'workstreams', 'workspace_assets', 'workspace_asset_links', 'system_settings']
|
|
344
|
+
.every((tableName) => hasTable(db, tableName));
|
|
345
|
+
if (!hasRequiredTables)
|
|
346
|
+
return result;
|
|
347
|
+
const verifyIdentity = db.prepare(`
|
|
348
|
+
SELECT 1 AS found
|
|
349
|
+
FROM workspace_assets a
|
|
350
|
+
INNER JOIN workspace_asset_links l
|
|
351
|
+
ON l.tenant_id = a.tenant_id
|
|
352
|
+
AND l.workspace_id = a.workspace_id
|
|
353
|
+
AND l.asset_id = a.asset_id
|
|
354
|
+
WHERE a.tenant_id = ? AND a.workspace_id = ? AND a.asset_id = ?
|
|
355
|
+
AND a.kind = 'document' AND a.deleted_at IS NULL
|
|
356
|
+
AND l.target_type = ? AND l.task_id = ? AND l.deleted_at IS NULL
|
|
357
|
+
LIMIT 1
|
|
358
|
+
`);
|
|
359
|
+
const upsertMigrationState = db.prepare(`
|
|
360
|
+
INSERT INTO system_settings (tenant_id, settings_key, payload, updated_at)
|
|
361
|
+
VALUES (?, 'migration.planning_attachment_asset_identity.v1', ?, ?)
|
|
362
|
+
ON CONFLICT (tenant_id, settings_key) DO UPDATE SET
|
|
363
|
+
payload = EXCLUDED.payload,
|
|
364
|
+
updated_at = EXCLUDED.updated_at
|
|
365
|
+
`);
|
|
366
|
+
const existingMigrationState = db.prepare(`
|
|
367
|
+
SELECT 1 AS found
|
|
368
|
+
FROM system_settings
|
|
369
|
+
WHERE tenant_id = ? AND settings_key = 'migration.planning_attachment_asset_identity.v1'
|
|
370
|
+
LIMIT 1
|
|
371
|
+
`).get(normalizedTenantId);
|
|
372
|
+
const repair = db.transaction(() => {
|
|
373
|
+
for (const domain of PLANNING_REFERENCE_DOMAINS) {
|
|
374
|
+
const rows = db.prepare(`
|
|
375
|
+
SELECT id, workspace_id, attachments_json
|
|
376
|
+
FROM ${domain.tableName}
|
|
377
|
+
WHERE tenant_id = ? AND attachments_json IS NOT NULL
|
|
378
|
+
ORDER BY workspace_id ASC, id ASC
|
|
379
|
+
`).all(normalizedTenantId);
|
|
380
|
+
const updateRow = db.prepare(`
|
|
381
|
+
UPDATE ${domain.tableName}
|
|
382
|
+
SET attachments_json = ?
|
|
383
|
+
WHERE tenant_id = ? AND workspace_id = ? AND id = ? AND attachments_json = ?
|
|
384
|
+
`);
|
|
385
|
+
for (const row of rows) {
|
|
386
|
+
const entityId = String(row.id || '').trim();
|
|
387
|
+
const workspaceId = String(row.workspace_id || '').trim();
|
|
388
|
+
if (!entityId || !workspaceId)
|
|
389
|
+
continue;
|
|
390
|
+
const sourceAttachmentsJson = String(row.attachments_json || '[]');
|
|
391
|
+
let attachments;
|
|
392
|
+
try {
|
|
393
|
+
attachments = JSON.parse(sourceAttachmentsJson);
|
|
394
|
+
}
|
|
395
|
+
catch {
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
if (!Array.isArray(attachments))
|
|
399
|
+
continue;
|
|
400
|
+
let changed = false;
|
|
401
|
+
const repaired = attachments.map((attachment) => {
|
|
402
|
+
if (!attachment || typeof attachment !== 'object' || Array.isArray(attachment))
|
|
403
|
+
return attachment;
|
|
404
|
+
result.scannedAttachments += 1;
|
|
405
|
+
const record = attachment;
|
|
406
|
+
if (typeof record.assetId === 'string' && record.assetId.trim())
|
|
407
|
+
return attachment;
|
|
408
|
+
const assetId = inferPlanningAttachmentAssetId(record.path);
|
|
409
|
+
if (!assetId)
|
|
410
|
+
return attachment;
|
|
411
|
+
const canonicalIdentity = verifyIdentity.get(normalizedTenantId, workspaceId, assetId, domain.domain, entityId);
|
|
412
|
+
if (!canonicalIdentity?.found) {
|
|
413
|
+
throw new Error(`Cannot backfill ${domain.domain} attachment ${entityId}: canonical asset/link identity is missing for ${assetId}.`);
|
|
414
|
+
}
|
|
415
|
+
changed = true;
|
|
416
|
+
result.backfilledAttachments += 1;
|
|
417
|
+
return { ...record, assetId };
|
|
418
|
+
});
|
|
419
|
+
if (!changed)
|
|
420
|
+
continue;
|
|
421
|
+
const updateResult = updateRow.run(JSON.stringify(repaired), normalizedTenantId, workspaceId, entityId, sourceAttachmentsJson);
|
|
422
|
+
if (Number(updateResult?.changes || 0) !== 1) {
|
|
423
|
+
throw new Error(`Cannot backfill ${domain.domain} attachment ${entityId}: attachments changed during migration.`);
|
|
424
|
+
}
|
|
425
|
+
result.updatedRows += 1;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
if (result.backfilledAttachments > 0 || !existingMigrationState?.found) {
|
|
429
|
+
const now = new Date().toISOString();
|
|
430
|
+
upsertMigrationState.run(normalizedTenantId, JSON.stringify({
|
|
431
|
+
completedAt: now,
|
|
432
|
+
backfilledAttachments: result.backfilledAttachments,
|
|
433
|
+
updatedRows: result.updatedRows,
|
|
434
|
+
}), now);
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
repair();
|
|
438
|
+
return result;
|
|
439
|
+
}
|
|
159
440
|
export function ensureWorkspaceSchema(db) {
|
|
160
441
|
db.exec(`
|
|
161
442
|
CREATE TABLE IF NOT EXISTS workspaces (
|
|
@@ -877,6 +1158,8 @@ export function ensureWorkspaceAssetsSchema(db) {
|
|
|
877
1158
|
ON workspace_asset_links(tenant_id, workspace_id, task_id, deleted_at, updated_at);
|
|
878
1159
|
CREATE INDEX IF NOT EXISTS idx_workspace_asset_links_asset
|
|
879
1160
|
ON workspace_asset_links(tenant_id, workspace_id, asset_id, deleted_at, updated_at);
|
|
1161
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_asset_links_workspace_updated
|
|
1162
|
+
ON workspace_asset_links(tenant_id, workspace_id, updated_at, asset_id);
|
|
880
1163
|
`);
|
|
881
1164
|
const linkColumns = db.prepare(`PRAGMA table_info(workspace_asset_links)`).all();
|
|
882
1165
|
const hasDisplayNameColumn = linkColumns.some((c) => c.name === 'display_name');
|
|
@@ -991,11 +1274,996 @@ export function ensureSyncEventsSchema(db) {
|
|
|
991
1274
|
error_message TEXT,
|
|
992
1275
|
change_count INTEGER,
|
|
993
1276
|
request_ms INTEGER,
|
|
1277
|
+
details_json TEXT,
|
|
994
1278
|
occurred_at TEXT NOT NULL
|
|
995
1279
|
);
|
|
996
1280
|
CREATE INDEX IF NOT EXISTS idx_sync_events_workspace_occurred
|
|
997
1281
|
ON sync_events(tenant_id, workspace_id, occurred_at);
|
|
998
1282
|
`);
|
|
1283
|
+
try {
|
|
1284
|
+
db.prepare(`SELECT details_json FROM sync_events LIMIT 1`).get();
|
|
1285
|
+
}
|
|
1286
|
+
catch {
|
|
1287
|
+
db.exec(`ALTER TABLE sync_events ADD COLUMN details_json TEXT`);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Creates the durable storage contract for the next workspace sync protocol.
|
|
1292
|
+
*
|
|
1293
|
+
* This migration intentionally does not route mutations through the journal or
|
|
1294
|
+
* outbox. Keeping schema installation behavior-neutral lets both runtimes ship
|
|
1295
|
+
* and verify the persistence contract before any sync path depends on it.
|
|
1296
|
+
*/
|
|
1297
|
+
export function buildWorkspaceSyncDurabilitySchemaSql(provider) {
|
|
1298
|
+
const revisionType = provider === 'postgres' ? 'BIGINT' : 'INTEGER';
|
|
1299
|
+
return `
|
|
1300
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_installation (
|
|
1301
|
+
installation_key TEXT PRIMARY KEY,
|
|
1302
|
+
client_id TEXT NOT NULL UNIQUE,
|
|
1303
|
+
created_at TEXT NOT NULL,
|
|
1304
|
+
updated_at TEXT NOT NULL
|
|
1305
|
+
);
|
|
1306
|
+
|
|
1307
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_sequences (
|
|
1308
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1309
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1310
|
+
last_sequence ${revisionType} NOT NULL DEFAULT 0,
|
|
1311
|
+
updated_at TEXT NOT NULL,
|
|
1312
|
+
PRIMARY KEY (tenant_id, workspace_id)
|
|
1313
|
+
);
|
|
1314
|
+
|
|
1315
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_outbox_sequences (
|
|
1316
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1317
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1318
|
+
last_sequence ${revisionType} NOT NULL DEFAULT 0,
|
|
1319
|
+
updated_at TEXT NOT NULL,
|
|
1320
|
+
PRIMARY KEY (tenant_id, workspace_id)
|
|
1321
|
+
);
|
|
1322
|
+
|
|
1323
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_domain_locks (
|
|
1324
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1325
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1326
|
+
domain TEXT NOT NULL,
|
|
1327
|
+
updated_at TEXT NOT NULL,
|
|
1328
|
+
PRIMARY KEY (tenant_id, workspace_id, domain)
|
|
1329
|
+
);
|
|
1330
|
+
|
|
1331
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_task_create_guards (
|
|
1332
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1333
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1334
|
+
task_id TEXT NOT NULL,
|
|
1335
|
+
created_at TEXT NOT NULL,
|
|
1336
|
+
PRIMARY KEY (tenant_id, workspace_id, task_id)
|
|
1337
|
+
);
|
|
1338
|
+
|
|
1339
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_entity_revisions (
|
|
1340
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1341
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1342
|
+
domain TEXT NOT NULL,
|
|
1343
|
+
entity_id TEXT NOT NULL,
|
|
1344
|
+
contract_version INTEGER NOT NULL DEFAULT 3,
|
|
1345
|
+
entity_revision ${revisionType} NOT NULL DEFAULT 0,
|
|
1346
|
+
lifecycle_revision ${revisionType} NOT NULL DEFAULT 0,
|
|
1347
|
+
coexistence_owned INTEGER NOT NULL DEFAULT 1,
|
|
1348
|
+
metadata_owned INTEGER NOT NULL DEFAULT 0,
|
|
1349
|
+
reopen_assignee_owned INTEGER NOT NULL DEFAULT 0,
|
|
1350
|
+
last_sequence ${revisionType} NOT NULL,
|
|
1351
|
+
canonical_fingerprint TEXT NOT NULL,
|
|
1352
|
+
updated_at TEXT NOT NULL,
|
|
1353
|
+
PRIMARY KEY (tenant_id, workspace_id, domain, entity_id)
|
|
1354
|
+
);
|
|
1355
|
+
|
|
1356
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_journal (
|
|
1357
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1358
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1359
|
+
sequence ${revisionType} NOT NULL,
|
|
1360
|
+
contract_version INTEGER NOT NULL DEFAULT 3,
|
|
1361
|
+
operation_id TEXT NOT NULL,
|
|
1362
|
+
client_id TEXT NOT NULL,
|
|
1363
|
+
domain TEXT NOT NULL,
|
|
1364
|
+
entity_id TEXT NOT NULL,
|
|
1365
|
+
mutation_kind TEXT NOT NULL,
|
|
1366
|
+
entity_revision ${revisionType} NOT NULL,
|
|
1367
|
+
lifecycle_revision ${revisionType} NOT NULL,
|
|
1368
|
+
content_sha256 TEXT,
|
|
1369
|
+
size_bytes ${revisionType},
|
|
1370
|
+
payload_json TEXT NOT NULL,
|
|
1371
|
+
occurred_at TEXT NOT NULL,
|
|
1372
|
+
PRIMARY KEY (tenant_id, workspace_id, sequence)
|
|
1373
|
+
);
|
|
1374
|
+
|
|
1375
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_operation_results (
|
|
1376
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1377
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1378
|
+
client_id TEXT NOT NULL,
|
|
1379
|
+
operation_id TEXT NOT NULL,
|
|
1380
|
+
contract_version INTEGER NOT NULL DEFAULT 3,
|
|
1381
|
+
request_fingerprint TEXT NOT NULL,
|
|
1382
|
+
status TEXT NOT NULL DEFAULT 'processing',
|
|
1383
|
+
response_json TEXT,
|
|
1384
|
+
accepted_sequence ${revisionType},
|
|
1385
|
+
lease_owner TEXT,
|
|
1386
|
+
lease_expires_at TEXT,
|
|
1387
|
+
created_at TEXT NOT NULL,
|
|
1388
|
+
updated_at TEXT NOT NULL,
|
|
1389
|
+
expires_at TEXT,
|
|
1390
|
+
PRIMARY KEY (tenant_id, workspace_id, client_id, operation_id)
|
|
1391
|
+
);
|
|
1392
|
+
|
|
1393
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_outbox (
|
|
1394
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1395
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1396
|
+
operation_id TEXT NOT NULL,
|
|
1397
|
+
contract_version INTEGER NOT NULL DEFAULT 3,
|
|
1398
|
+
client_id TEXT NOT NULL,
|
|
1399
|
+
dispatch_class TEXT NOT NULL DEFAULT 'ordinary',
|
|
1400
|
+
domain TEXT NOT NULL,
|
|
1401
|
+
entity_id TEXT NOT NULL,
|
|
1402
|
+
mutation_kind TEXT NOT NULL,
|
|
1403
|
+
owns_task_metadata INTEGER NOT NULL DEFAULT 0,
|
|
1404
|
+
owns_task_lifecycle INTEGER NOT NULL DEFAULT 0,
|
|
1405
|
+
owns_task_assignee INTEGER NOT NULL DEFAULT 0,
|
|
1406
|
+
base_entity_revision ${revisionType} NOT NULL DEFAULT 0,
|
|
1407
|
+
base_lifecycle_revision ${revisionType} NOT NULL DEFAULT 0,
|
|
1408
|
+
payload_json TEXT NOT NULL,
|
|
1409
|
+
payload_fingerprint TEXT NOT NULL,
|
|
1410
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
1411
|
+
attempt_count INTEGER NOT NULL DEFAULT 0,
|
|
1412
|
+
initial_not_found_attempt_count INTEGER NOT NULL DEFAULT 0,
|
|
1413
|
+
enqueue_sequence ${revisionType} NOT NULL DEFAULT 0,
|
|
1414
|
+
rebase_before_first_attempt INTEGER NOT NULL DEFAULT 0,
|
|
1415
|
+
origin_assertion_recovery_count INTEGER NOT NULL DEFAULT 0,
|
|
1416
|
+
accepted_replay_recovery_count INTEGER NOT NULL DEFAULT 0,
|
|
1417
|
+
task_attachment_reference_metadata_recovery_count INTEGER NOT NULL DEFAULT 0,
|
|
1418
|
+
task_status_revision_rebase_count INTEGER NOT NULL DEFAULT 0,
|
|
1419
|
+
task_status_workflow_ack_recovery_count INTEGER NOT NULL DEFAULT 0,
|
|
1420
|
+
workstream_metadata_revision_rebase_count INTEGER NOT NULL DEFAULT 0,
|
|
1421
|
+
initiative_metadata_revision_rebase_count INTEGER NOT NULL DEFAULT 0,
|
|
1422
|
+
next_attempt_at TEXT NOT NULL,
|
|
1423
|
+
lease_owner TEXT,
|
|
1424
|
+
lease_expires_at TEXT,
|
|
1425
|
+
authoritative_response_json TEXT,
|
|
1426
|
+
accepted_sequence ${revisionType},
|
|
1427
|
+
last_error_code TEXT,
|
|
1428
|
+
last_error_message TEXT,
|
|
1429
|
+
recovery_batch_id TEXT,
|
|
1430
|
+
replay_of_client_id TEXT,
|
|
1431
|
+
replay_of_operation_id TEXT,
|
|
1432
|
+
superseded_at TEXT,
|
|
1433
|
+
created_at TEXT NOT NULL,
|
|
1434
|
+
updated_at TEXT NOT NULL,
|
|
1435
|
+
PRIMARY KEY (tenant_id, workspace_id, client_id, operation_id)
|
|
1436
|
+
);
|
|
1437
|
+
|
|
1438
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_outbox_recoveries (
|
|
1439
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1440
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1441
|
+
recovery_batch_id TEXT NOT NULL,
|
|
1442
|
+
root_client_id TEXT NOT NULL,
|
|
1443
|
+
root_operation_id TEXT NOT NULL,
|
|
1444
|
+
state TEXT NOT NULL,
|
|
1445
|
+
baseline_marker TEXT,
|
|
1446
|
+
baseline_applied_at TEXT,
|
|
1447
|
+
replay_queued_at TEXT,
|
|
1448
|
+
completed_at TEXT,
|
|
1449
|
+
created_at TEXT NOT NULL,
|
|
1450
|
+
updated_at TEXT NOT NULL,
|
|
1451
|
+
PRIMARY KEY (tenant_id, workspace_id, recovery_batch_id)
|
|
1452
|
+
);
|
|
1453
|
+
|
|
1454
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_outbox_targets (
|
|
1455
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1456
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1457
|
+
client_id TEXT NOT NULL,
|
|
1458
|
+
operation_id TEXT NOT NULL,
|
|
1459
|
+
domain TEXT NOT NULL,
|
|
1460
|
+
entity_id TEXT NOT NULL,
|
|
1461
|
+
mutation_kind TEXT NOT NULL,
|
|
1462
|
+
base_entity_revision ${revisionType} NOT NULL DEFAULT 0,
|
|
1463
|
+
base_lifecycle_revision ${revisionType} NOT NULL DEFAULT 0,
|
|
1464
|
+
owns_task_metadata INTEGER NOT NULL DEFAULT 0,
|
|
1465
|
+
owns_task_lifecycle INTEGER NOT NULL DEFAULT 0,
|
|
1466
|
+
owns_task_assignee INTEGER NOT NULL DEFAULT 0,
|
|
1467
|
+
created_at TEXT NOT NULL,
|
|
1468
|
+
PRIMARY KEY (tenant_id, workspace_id, client_id, operation_id, domain, entity_id)
|
|
1469
|
+
);
|
|
1470
|
+
|
|
1471
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_task_taxonomy_ownership (
|
|
1472
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1473
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1474
|
+
task_id TEXT NOT NULL,
|
|
1475
|
+
created_at TEXT NOT NULL,
|
|
1476
|
+
PRIMARY KEY (tenant_id, workspace_id, task_id)
|
|
1477
|
+
);
|
|
1478
|
+
|
|
1479
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_projection_state (
|
|
1480
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1481
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1482
|
+
projection_id TEXT NOT NULL,
|
|
1483
|
+
contract_version INTEGER NOT NULL DEFAULT 3,
|
|
1484
|
+
owner_mode TEXT NOT NULL DEFAULT 'v2',
|
|
1485
|
+
epoch ${revisionType} NOT NULL DEFAULT 0,
|
|
1486
|
+
coverage_profile_id TEXT,
|
|
1487
|
+
coverage_version INTEGER,
|
|
1488
|
+
coverage_digest TEXT,
|
|
1489
|
+
opaque_cursor TEXT,
|
|
1490
|
+
cycle_high_watermark ${revisionType},
|
|
1491
|
+
last_scanned_sequence ${revisionType},
|
|
1492
|
+
repair_snapshot_id TEXT,
|
|
1493
|
+
repair_expires_at TEXT,
|
|
1494
|
+
repair_snapshot_sequence ${revisionType},
|
|
1495
|
+
repair_epoch ${revisionType},
|
|
1496
|
+
repair_resume_cursor TEXT,
|
|
1497
|
+
repair_cursor TEXT,
|
|
1498
|
+
applied_snapshot_id TEXT,
|
|
1499
|
+
applied_page_digest TEXT,
|
|
1500
|
+
updated_at TEXT NOT NULL,
|
|
1501
|
+
PRIMARY KEY (tenant_id, workspace_id, projection_id)
|
|
1502
|
+
);
|
|
1503
|
+
|
|
1504
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_projection_repair_entries (
|
|
1505
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1506
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1507
|
+
projection_id TEXT NOT NULL,
|
|
1508
|
+
epoch ${revisionType} NOT NULL,
|
|
1509
|
+
entity_id TEXT NOT NULL,
|
|
1510
|
+
sequence ${revisionType} NOT NULL,
|
|
1511
|
+
mutation_kind TEXT NOT NULL,
|
|
1512
|
+
entity_revision ${revisionType} NOT NULL,
|
|
1513
|
+
lifecycle_revision ${revisionType} NOT NULL,
|
|
1514
|
+
payload_fingerprint TEXT NOT NULL,
|
|
1515
|
+
payload_json TEXT NOT NULL,
|
|
1516
|
+
occurred_at TEXT NOT NULL,
|
|
1517
|
+
PRIMARY KEY (tenant_id, workspace_id, projection_id, epoch, entity_id)
|
|
1518
|
+
);
|
|
1519
|
+
|
|
1520
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_coverage_repair_entries (
|
|
1521
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1522
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1523
|
+
coverage_id TEXT NOT NULL,
|
|
1524
|
+
epoch ${revisionType} NOT NULL,
|
|
1525
|
+
entry_index INTEGER NOT NULL,
|
|
1526
|
+
projection_id TEXT NOT NULL,
|
|
1527
|
+
domain TEXT NOT NULL,
|
|
1528
|
+
entity_id TEXT NOT NULL,
|
|
1529
|
+
sequence ${revisionType} NOT NULL,
|
|
1530
|
+
mutation_kind TEXT NOT NULL,
|
|
1531
|
+
entity_revision ${revisionType} NOT NULL,
|
|
1532
|
+
lifecycle_revision ${revisionType} NOT NULL,
|
|
1533
|
+
canonical_fingerprint TEXT,
|
|
1534
|
+
payload_fingerprint TEXT NOT NULL,
|
|
1535
|
+
payload_json TEXT NOT NULL,
|
|
1536
|
+
occurred_at TEXT NOT NULL,
|
|
1537
|
+
PRIMARY KEY (tenant_id, workspace_id, coverage_id, epoch, entry_index)
|
|
1538
|
+
);
|
|
1539
|
+
|
|
1540
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_repair_snapshots (
|
|
1541
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1542
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1543
|
+
snapshot_id TEXT NOT NULL,
|
|
1544
|
+
contract_version INTEGER NOT NULL DEFAULT 3,
|
|
1545
|
+
coverage_profile_id TEXT NOT NULL,
|
|
1546
|
+
coverage_version INTEGER NOT NULL,
|
|
1547
|
+
coverage_digest TEXT NOT NULL,
|
|
1548
|
+
snapshot_sequence ${revisionType} NOT NULL,
|
|
1549
|
+
entry_count INTEGER NOT NULL,
|
|
1550
|
+
created_at TEXT NOT NULL,
|
|
1551
|
+
expires_at TEXT NOT NULL,
|
|
1552
|
+
PRIMARY KEY (tenant_id, workspace_id, snapshot_id)
|
|
1553
|
+
);
|
|
1554
|
+
|
|
1555
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_repair_snapshot_entries (
|
|
1556
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1557
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1558
|
+
snapshot_id TEXT NOT NULL,
|
|
1559
|
+
entry_index INTEGER NOT NULL,
|
|
1560
|
+
projection_id TEXT NOT NULL,
|
|
1561
|
+
domain TEXT NOT NULL,
|
|
1562
|
+
entity_id TEXT NOT NULL,
|
|
1563
|
+
sequence ${revisionType} NOT NULL,
|
|
1564
|
+
mutation_kind TEXT NOT NULL,
|
|
1565
|
+
entity_revision ${revisionType} NOT NULL,
|
|
1566
|
+
lifecycle_revision ${revisionType} NOT NULL,
|
|
1567
|
+
canonical_fingerprint TEXT,
|
|
1568
|
+
payload_fingerprint TEXT NOT NULL,
|
|
1569
|
+
payload_json TEXT NOT NULL,
|
|
1570
|
+
occurred_at TEXT NOT NULL,
|
|
1571
|
+
PRIMARY KEY (tenant_id, workspace_id, snapshot_id, entry_index)
|
|
1572
|
+
);
|
|
1573
|
+
|
|
1574
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_content_versions (
|
|
1575
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1576
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1577
|
+
version_id TEXT NOT NULL,
|
|
1578
|
+
kind TEXT NOT NULL CHECK (kind IN ('document', 'asset')),
|
|
1579
|
+
logical_path TEXT NOT NULL,
|
|
1580
|
+
storage_provider TEXT NOT NULL CHECK (storage_provider IN ('local', 'r2')),
|
|
1581
|
+
physical_key TEXT NOT NULL,
|
|
1582
|
+
content_sha256 TEXT NOT NULL,
|
|
1583
|
+
size_bytes ${revisionType} NOT NULL,
|
|
1584
|
+
mime_type TEXT NOT NULL,
|
|
1585
|
+
state TEXT NOT NULL CHECK (state IN ('preparing', 'ready', 'published', 'retired', 'deleting', 'deleted')),
|
|
1586
|
+
created_at TEXT NOT NULL,
|
|
1587
|
+
ready_at TEXT,
|
|
1588
|
+
published_at TEXT,
|
|
1589
|
+
retired_at TEXT,
|
|
1590
|
+
gc_after TEXT,
|
|
1591
|
+
deleted_at TEXT,
|
|
1592
|
+
gc_attempt_count INTEGER NOT NULL DEFAULT 0,
|
|
1593
|
+
gc_next_attempt_at TEXT,
|
|
1594
|
+
gc_last_error TEXT,
|
|
1595
|
+
preparation_token TEXT,
|
|
1596
|
+
preparation_lease_until TEXT,
|
|
1597
|
+
storage_generation INTEGER NOT NULL DEFAULT 0,
|
|
1598
|
+
gc_claim_token TEXT,
|
|
1599
|
+
gc_claim_lease_until TEXT,
|
|
1600
|
+
gc_completed_claim_token TEXT,
|
|
1601
|
+
gc_quarantine_sweep_required INTEGER NOT NULL DEFAULT 0,
|
|
1602
|
+
gc_final_sweep_after TEXT,
|
|
1603
|
+
PRIMARY KEY (tenant_id, workspace_id, version_id)
|
|
1604
|
+
);
|
|
1605
|
+
|
|
1606
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_content_heads (
|
|
1607
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1608
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1609
|
+
kind TEXT NOT NULL CHECK (kind IN ('document', 'asset')),
|
|
1610
|
+
logical_path TEXT NOT NULL,
|
|
1611
|
+
version_id TEXT,
|
|
1612
|
+
source_updated_at TEXT NOT NULL,
|
|
1613
|
+
content_sha256 TEXT,
|
|
1614
|
+
size_bytes ${revisionType},
|
|
1615
|
+
published_at TEXT NOT NULL,
|
|
1616
|
+
deleted_at TEXT,
|
|
1617
|
+
PRIMARY KEY (tenant_id, workspace_id, kind, logical_path)
|
|
1618
|
+
);
|
|
1619
|
+
|
|
1620
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_content_preparation_attempts (
|
|
1621
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
1622
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
1623
|
+
version_id TEXT NOT NULL,
|
|
1624
|
+
preparation_token TEXT NOT NULL,
|
|
1625
|
+
storage_provider TEXT NOT NULL CHECK (storage_provider IN ('local', 'r2')),
|
|
1626
|
+
physical_key TEXT NOT NULL,
|
|
1627
|
+
storage_generation INTEGER NOT NULL,
|
|
1628
|
+
state TEXT NOT NULL CHECK (state IN ('preparing', 'current', 'cleanup_pending', 'deleting', 'deleted')),
|
|
1629
|
+
created_at TEXT NOT NULL,
|
|
1630
|
+
promoted_at TEXT,
|
|
1631
|
+
available_after TEXT NOT NULL,
|
|
1632
|
+
deleted_at TEXT,
|
|
1633
|
+
gc_attempt_count INTEGER NOT NULL DEFAULT 0,
|
|
1634
|
+
gc_next_attempt_at TEXT,
|
|
1635
|
+
gc_last_error TEXT,
|
|
1636
|
+
gc_claim_token TEXT,
|
|
1637
|
+
gc_claim_lease_until TEXT,
|
|
1638
|
+
gc_completed_claim_token TEXT,
|
|
1639
|
+
PRIMARY KEY (tenant_id, workspace_id, version_id, preparation_token)
|
|
1640
|
+
);
|
|
1641
|
+
|
|
1642
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_entity_revisions_sequence
|
|
1643
|
+
ON workspace_sync_entity_revisions(tenant_id, workspace_id, last_sequence);
|
|
1644
|
+
|
|
1645
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_journal_entity
|
|
1646
|
+
ON workspace_sync_journal(tenant_id, workspace_id, domain, entity_id, sequence);
|
|
1647
|
+
|
|
1648
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_journal_operation
|
|
1649
|
+
ON workspace_sync_journal(tenant_id, workspace_id, client_id, operation_id);
|
|
1650
|
+
|
|
1651
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_operation_results_updated
|
|
1652
|
+
ON workspace_sync_operation_results(tenant_id, workspace_id, updated_at);
|
|
1653
|
+
|
|
1654
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_outbox_dispatch
|
|
1655
|
+
ON workspace_sync_outbox(tenant_id, workspace_id, status, next_attempt_at, created_at);
|
|
1656
|
+
|
|
1657
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_outbox_entity
|
|
1658
|
+
ON workspace_sync_outbox(tenant_id, workspace_id, domain, entity_id, created_at);
|
|
1659
|
+
|
|
1660
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_outbox_targets_entity
|
|
1661
|
+
ON workspace_sync_outbox_targets(tenant_id, workspace_id, domain, entity_id);
|
|
1662
|
+
|
|
1663
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_projection_repair_page
|
|
1664
|
+
ON workspace_sync_projection_repair_entries(tenant_id, workspace_id, projection_id, epoch, entity_id);
|
|
1665
|
+
|
|
1666
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workspace_sync_coverage_repair_entity
|
|
1667
|
+
ON workspace_sync_coverage_repair_entries(
|
|
1668
|
+
tenant_id, workspace_id, coverage_id, epoch, projection_id, domain, entity_id
|
|
1669
|
+
);
|
|
1670
|
+
|
|
1671
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_repair_snapshots_expiry
|
|
1672
|
+
ON workspace_sync_repair_snapshots(tenant_id, workspace_id, expires_at);
|
|
1673
|
+
|
|
1674
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_repair_snapshots_created
|
|
1675
|
+
ON workspace_sync_repair_snapshots(tenant_id, workspace_id, created_at);
|
|
1676
|
+
|
|
1677
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_repair_snapshot_entries_entity
|
|
1678
|
+
ON workspace_sync_repair_snapshot_entries(
|
|
1679
|
+
tenant_id, workspace_id, snapshot_id, domain, entity_id
|
|
1680
|
+
);
|
|
1681
|
+
|
|
1682
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workspace_sync_content_versions_physical
|
|
1683
|
+
ON workspace_sync_content_versions(tenant_id, workspace_id, storage_provider, physical_key);
|
|
1684
|
+
|
|
1685
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_content_versions_state
|
|
1686
|
+
ON workspace_sync_content_versions(tenant_id, workspace_id, state, created_at);
|
|
1687
|
+
|
|
1688
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_content_versions_gc
|
|
1689
|
+
ON workspace_sync_content_versions(
|
|
1690
|
+
tenant_id, workspace_id, state, gc_after, gc_next_attempt_at, version_id
|
|
1691
|
+
);
|
|
1692
|
+
|
|
1693
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_content_heads_version
|
|
1694
|
+
ON workspace_sync_content_heads(tenant_id, workspace_id, version_id);
|
|
1695
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_content_heads_source_updated
|
|
1696
|
+
ON workspace_sync_content_heads(tenant_id, workspace_id, source_updated_at, logical_path);
|
|
1697
|
+
|
|
1698
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workspace_sync_content_preparation_attempts_physical
|
|
1699
|
+
ON workspace_sync_content_preparation_attempts(
|
|
1700
|
+
tenant_id, workspace_id, storage_provider, physical_key
|
|
1701
|
+
);
|
|
1702
|
+
|
|
1703
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_content_preparation_attempts_gc
|
|
1704
|
+
ON workspace_sync_content_preparation_attempts(
|
|
1705
|
+
tenant_id, workspace_id, state, available_after, gc_next_attempt_at
|
|
1706
|
+
);
|
|
1707
|
+
|
|
1708
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workspace_sync_content_preparation_attempts_current
|
|
1709
|
+
ON workspace_sync_content_preparation_attempts(tenant_id, workspace_id, version_id)
|
|
1710
|
+
WHERE state = 'current';
|
|
1711
|
+
|
|
1712
|
+
`;
|
|
1713
|
+
}
|
|
1714
|
+
export function ensureWorkspaceSyncDurabilitySchema(db) {
|
|
1715
|
+
db.exec(buildWorkspaceSyncDurabilitySchemaSql(db.provider));
|
|
1716
|
+
if (db.provider === 'sqlite' && hasTable(db, 'tasks')) {
|
|
1717
|
+
db.exec(`
|
|
1718
|
+
CREATE TRIGGER IF NOT EXISTS trg_tasks_v3_create_fence
|
|
1719
|
+
BEFORE INSERT ON tasks
|
|
1720
|
+
WHEN EXISTS (
|
|
1721
|
+
SELECT 1
|
|
1722
|
+
FROM workspace_sync_projection_state
|
|
1723
|
+
WHERE tenant_id = NEW.tenant_id
|
|
1724
|
+
AND workspace_id = NEW.workspace_id
|
|
1725
|
+
AND projection_id = 'coverage/task-planning-metadata-v1'
|
|
1726
|
+
AND owner_mode = 'v3'
|
|
1727
|
+
)
|
|
1728
|
+
AND NOT EXISTS (
|
|
1729
|
+
SELECT 1
|
|
1730
|
+
FROM workspace_sync_task_create_guards
|
|
1731
|
+
WHERE tenant_id = NEW.tenant_id
|
|
1732
|
+
AND workspace_id = NEW.workspace_id
|
|
1733
|
+
AND task_id = NEW.id
|
|
1734
|
+
)
|
|
1735
|
+
BEGIN
|
|
1736
|
+
SELECT RAISE(ABORT, 'TASK_DURABLE_SYNC_REQUIRED');
|
|
1737
|
+
END;
|
|
1738
|
+
`);
|
|
1739
|
+
}
|
|
1740
|
+
const coverageRepairColumns = db.prepare(`PRAGMA table_info(workspace_sync_coverage_repair_entries)`).all();
|
|
1741
|
+
if (!coverageRepairColumns.some((column) => column.name === 'canonical_fingerprint')) {
|
|
1742
|
+
db.exec(`ALTER TABLE workspace_sync_coverage_repair_entries ADD COLUMN canonical_fingerprint TEXT`);
|
|
1743
|
+
}
|
|
1744
|
+
const repairSnapshotEntryColumns = db.prepare(`PRAGMA table_info(workspace_sync_repair_snapshot_entries)`).all();
|
|
1745
|
+
if (!repairSnapshotEntryColumns.some((column) => column.name === 'canonical_fingerprint')) {
|
|
1746
|
+
db.exec(`ALTER TABLE workspace_sync_repair_snapshot_entries ADD COLUMN canonical_fingerprint TEXT`);
|
|
1747
|
+
}
|
|
1748
|
+
const contentVersionColumns = db.prepare(`PRAGMA table_info(workspace_sync_content_versions)`).all();
|
|
1749
|
+
if (!contentVersionColumns.some((column) => column.name === 'gc_claim_token')) {
|
|
1750
|
+
db.exec(`ALTER TABLE workspace_sync_content_versions ADD COLUMN gc_claim_token TEXT`);
|
|
1751
|
+
}
|
|
1752
|
+
if (!contentVersionColumns.some((column) => column.name === 'gc_claim_lease_until')) {
|
|
1753
|
+
db.exec(`ALTER TABLE workspace_sync_content_versions ADD COLUMN gc_claim_lease_until TEXT`);
|
|
1754
|
+
}
|
|
1755
|
+
if (!contentVersionColumns.some((column) => column.name === 'storage_generation')) {
|
|
1756
|
+
db.exec(`ALTER TABLE workspace_sync_content_versions ADD COLUMN storage_generation INTEGER NOT NULL DEFAULT 0`);
|
|
1757
|
+
}
|
|
1758
|
+
if (!contentVersionColumns.some((column) => column.name === 'gc_completed_claim_token')) {
|
|
1759
|
+
db.exec(`ALTER TABLE workspace_sync_content_versions ADD COLUMN gc_completed_claim_token TEXT`);
|
|
1760
|
+
}
|
|
1761
|
+
if (!contentVersionColumns.some((column) => column.name === 'gc_quarantine_sweep_required')) {
|
|
1762
|
+
db.exec(`ALTER TABLE workspace_sync_content_versions ADD COLUMN gc_quarantine_sweep_required INTEGER NOT NULL DEFAULT 0`);
|
|
1763
|
+
}
|
|
1764
|
+
if (!contentVersionColumns.some((column) => column.name === 'gc_final_sweep_after')) {
|
|
1765
|
+
db.exec(`ALTER TABLE workspace_sync_content_versions ADD COLUMN gc_final_sweep_after TEXT`);
|
|
1766
|
+
}
|
|
1767
|
+
const outboxColumns = db.prepare(`PRAGMA table_info(workspace_sync_outbox)`).all();
|
|
1768
|
+
if (!outboxColumns.some((column) => column.name === 'dispatch_class')) {
|
|
1769
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN dispatch_class TEXT NOT NULL DEFAULT 'ordinary'`);
|
|
1770
|
+
}
|
|
1771
|
+
db.exec(db.provider === 'postgres' ? `
|
|
1772
|
+
UPDATE workspace_sync_outbox
|
|
1773
|
+
SET dispatch_class = 'legacy-adoption'
|
|
1774
|
+
WHERE dispatch_class = 'ordinary'
|
|
1775
|
+
AND status IN ('pending', 'in_flight', 'blocked')
|
|
1776
|
+
AND (
|
|
1777
|
+
(
|
|
1778
|
+
domain = 'task'
|
|
1779
|
+
AND mutation_kind = 'create'
|
|
1780
|
+
AND jsonb_typeof(payload_json::jsonb -> 'adoptedRoot') = 'object'
|
|
1781
|
+
AND payload_json::jsonb -> 'adoptedRoot' ->> 'id' = entity_id
|
|
1782
|
+
)
|
|
1783
|
+
OR (
|
|
1784
|
+
domain = 'task-relationship'
|
|
1785
|
+
AND mutation_kind IN ('link', 'unlink')
|
|
1786
|
+
AND jsonb_typeof(payload_json::jsonb -> 'adoptedRelationship') = 'object'
|
|
1787
|
+
AND payload_json::jsonb -> 'adoptedRelationship' ->> 'id' = entity_id
|
|
1788
|
+
)
|
|
1789
|
+
)
|
|
1790
|
+
` : `
|
|
1791
|
+
UPDATE workspace_sync_outbox
|
|
1792
|
+
SET dispatch_class = 'legacy-adoption'
|
|
1793
|
+
WHERE dispatch_class = 'ordinary'
|
|
1794
|
+
AND status IN ('pending', 'in_flight', 'blocked')
|
|
1795
|
+
AND json_valid(payload_json) = 1
|
|
1796
|
+
AND (
|
|
1797
|
+
(
|
|
1798
|
+
domain = 'task'
|
|
1799
|
+
AND mutation_kind = 'create'
|
|
1800
|
+
AND json_type(payload_json, '$.adoptedRoot') = 'object'
|
|
1801
|
+
AND json_extract(payload_json, '$.adoptedRoot.id') = entity_id
|
|
1802
|
+
)
|
|
1803
|
+
OR (
|
|
1804
|
+
domain = 'task-relationship'
|
|
1805
|
+
AND mutation_kind IN ('link', 'unlink')
|
|
1806
|
+
AND json_type(payload_json, '$.adoptedRelationship') = 'object'
|
|
1807
|
+
AND json_extract(payload_json, '$.adoptedRelationship.id') = entity_id
|
|
1808
|
+
)
|
|
1809
|
+
)
|
|
1810
|
+
`);
|
|
1811
|
+
if (!outboxColumns.some((column) => column.name === 'initial_not_found_attempt_count')) {
|
|
1812
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN initial_not_found_attempt_count INTEGER NOT NULL DEFAULT 0`);
|
|
1813
|
+
}
|
|
1814
|
+
if (!outboxColumns.some((column) => column.name === 'owns_task_metadata')) {
|
|
1815
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN owns_task_metadata INTEGER NOT NULL DEFAULT 0`);
|
|
1816
|
+
}
|
|
1817
|
+
if (!outboxColumns.some((column) => column.name === 'owns_task_lifecycle')) {
|
|
1818
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN owns_task_lifecycle INTEGER NOT NULL DEFAULT 0`);
|
|
1819
|
+
}
|
|
1820
|
+
if (!outboxColumns.some((column) => column.name === 'owns_task_assignee')) {
|
|
1821
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN owns_task_assignee INTEGER NOT NULL DEFAULT 0`);
|
|
1822
|
+
}
|
|
1823
|
+
if (!outboxColumns.some((column) => column.name === 'enqueue_sequence')) {
|
|
1824
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN enqueue_sequence ${db.provider === 'postgres' ? 'BIGINT' : 'INTEGER'} NOT NULL DEFAULT 0`);
|
|
1825
|
+
}
|
|
1826
|
+
if (!outboxColumns.some((column) => column.name === 'rebase_before_first_attempt')) {
|
|
1827
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN rebase_before_first_attempt INTEGER NOT NULL DEFAULT 0`);
|
|
1828
|
+
}
|
|
1829
|
+
if (!outboxColumns.some((column) => column.name === 'origin_assertion_recovery_count')) {
|
|
1830
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN origin_assertion_recovery_count INTEGER NOT NULL DEFAULT 0`);
|
|
1831
|
+
}
|
|
1832
|
+
if (!outboxColumns.some((column) => column.name === 'accepted_replay_recovery_count')) {
|
|
1833
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN accepted_replay_recovery_count INTEGER NOT NULL DEFAULT 0`);
|
|
1834
|
+
}
|
|
1835
|
+
if (!outboxColumns.some((column) => column.name === 'task_attachment_reference_metadata_recovery_count')) {
|
|
1836
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN task_attachment_reference_metadata_recovery_count INTEGER NOT NULL DEFAULT 0`);
|
|
1837
|
+
}
|
|
1838
|
+
const needsTaskStatusRecoveryBudgetSplit = !outboxColumns.some((column) => column.name === 'task_status_revision_rebase_count') || !outboxColumns.some((column) => column.name === 'task_status_workflow_ack_recovery_count');
|
|
1839
|
+
if (!outboxColumns.some((column) => column.name === 'task_status_revision_rebase_count')) {
|
|
1840
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN task_status_revision_rebase_count INTEGER NOT NULL DEFAULT 0`);
|
|
1841
|
+
}
|
|
1842
|
+
if (!outboxColumns.some((column) => column.name === 'task_status_workflow_ack_recovery_count')) {
|
|
1843
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN task_status_workflow_ack_recovery_count INTEGER NOT NULL DEFAULT 0`);
|
|
1844
|
+
}
|
|
1845
|
+
if (needsTaskStatusRecoveryBudgetSplit) {
|
|
1846
|
+
// The former shared counter cannot reveal which recovery consumed it.
|
|
1847
|
+
// Preserve durable markers where available, then grant active task-status
|
|
1848
|
+
// rows one fresh, independently bounded accepted-replay attempt. A
|
|
1849
|
+
// partially applied migration can grant one extra replay, never a loop.
|
|
1850
|
+
db.exec(`
|
|
1851
|
+
UPDATE workspace_sync_outbox
|
|
1852
|
+
SET task_status_revision_rebase_count = CASE
|
|
1853
|
+
WHEN rebase_before_first_attempt = 1 THEN 1
|
|
1854
|
+
ELSE task_status_revision_rebase_count
|
|
1855
|
+
END,
|
|
1856
|
+
task_status_workflow_ack_recovery_count = CASE
|
|
1857
|
+
WHEN last_error_code = 'WORKSPACE_SYNC_TASK_STATUS_WORKFLOW_ACK_RECOVERY' THEN 1
|
|
1858
|
+
ELSE task_status_workflow_ack_recovery_count
|
|
1859
|
+
END,
|
|
1860
|
+
accepted_replay_recovery_count = 0
|
|
1861
|
+
WHERE domain = 'task'
|
|
1862
|
+
AND mutation_kind = 'set-status'
|
|
1863
|
+
AND status IN ('pending', 'in_flight', 'blocked')
|
|
1864
|
+
`);
|
|
1865
|
+
}
|
|
1866
|
+
if (!outboxColumns.some((column) => column.name === 'workstream_metadata_revision_rebase_count')) {
|
|
1867
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN workstream_metadata_revision_rebase_count INTEGER NOT NULL DEFAULT 0`);
|
|
1868
|
+
}
|
|
1869
|
+
if (!outboxColumns.some((column) => column.name === 'initiative_metadata_revision_rebase_count')) {
|
|
1870
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN initiative_metadata_revision_rebase_count INTEGER NOT NULL DEFAULT 0`);
|
|
1871
|
+
}
|
|
1872
|
+
if (!outboxColumns.some((column) => column.name === 'recovery_batch_id')) {
|
|
1873
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN recovery_batch_id TEXT`);
|
|
1874
|
+
}
|
|
1875
|
+
if (!outboxColumns.some((column) => column.name === 'replay_of_client_id')) {
|
|
1876
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN replay_of_client_id TEXT`);
|
|
1877
|
+
}
|
|
1878
|
+
if (!outboxColumns.some((column) => column.name === 'replay_of_operation_id')) {
|
|
1879
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN replay_of_operation_id TEXT`);
|
|
1880
|
+
}
|
|
1881
|
+
if (!outboxColumns.some((column) => column.name === 'superseded_at')) {
|
|
1882
|
+
db.exec(`ALTER TABLE workspace_sync_outbox ADD COLUMN superseded_at TEXT`);
|
|
1883
|
+
}
|
|
1884
|
+
db.exec(`
|
|
1885
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_outbox_entity_sequence
|
|
1886
|
+
ON workspace_sync_outbox(tenant_id, workspace_id, domain, entity_id, enqueue_sequence, status)
|
|
1887
|
+
`);
|
|
1888
|
+
db.exec(`
|
|
1889
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_outbox_recovery_batch
|
|
1890
|
+
ON workspace_sync_outbox(tenant_id, workspace_id, recovery_batch_id, enqueue_sequence)
|
|
1891
|
+
`);
|
|
1892
|
+
db.exec(`
|
|
1893
|
+
UPDATE workspace_sync_outbox
|
|
1894
|
+
SET owns_task_metadata = CASE
|
|
1895
|
+
WHEN domain = 'task' AND mutation_kind = 'metadata-update' THEN 1
|
|
1896
|
+
ELSE owns_task_metadata
|
|
1897
|
+
END,
|
|
1898
|
+
owns_task_lifecycle = CASE
|
|
1899
|
+
WHEN domain = 'task' AND mutation_kind IN ('archive', 'unarchive', 'complete', 'reopen') THEN 1
|
|
1900
|
+
ELSE owns_task_lifecycle
|
|
1901
|
+
END,
|
|
1902
|
+
owns_task_assignee = CASE
|
|
1903
|
+
WHEN domain = 'task' AND mutation_kind = 'reopen' THEN 1
|
|
1904
|
+
ELSE owns_task_assignee
|
|
1905
|
+
END
|
|
1906
|
+
WHERE status IN ('pending', 'in_flight', 'blocked')
|
|
1907
|
+
`);
|
|
1908
|
+
db.exec(`
|
|
1909
|
+
INSERT INTO workspace_sync_outbox_targets (
|
|
1910
|
+
tenant_id, workspace_id, client_id, operation_id, domain, entity_id,
|
|
1911
|
+
mutation_kind, base_entity_revision, base_lifecycle_revision,
|
|
1912
|
+
owns_task_metadata, owns_task_lifecycle, owns_task_assignee, created_at
|
|
1913
|
+
)
|
|
1914
|
+
SELECT tenant_id, workspace_id, client_id, operation_id, domain, entity_id,
|
|
1915
|
+
mutation_kind, base_entity_revision, base_lifecycle_revision,
|
|
1916
|
+
owns_task_metadata, owns_task_lifecycle, owns_task_assignee, created_at
|
|
1917
|
+
FROM workspace_sync_outbox
|
|
1918
|
+
WHERE 1 = 1
|
|
1919
|
+
ON CONFLICT (tenant_id, workspace_id, client_id, operation_id, domain, entity_id) DO NOTHING
|
|
1920
|
+
`);
|
|
1921
|
+
const projectionStateColumns = db.prepare(`PRAGMA table_info(workspace_sync_projection_state)`).all();
|
|
1922
|
+
if (!projectionStateColumns.some((column) => column.name === 'repair_snapshot_id')) {
|
|
1923
|
+
db.exec(`ALTER TABLE workspace_sync_projection_state ADD COLUMN repair_snapshot_id TEXT`);
|
|
1924
|
+
}
|
|
1925
|
+
if (!projectionStateColumns.some((column) => column.name === 'repair_expires_at')) {
|
|
1926
|
+
db.exec(`ALTER TABLE workspace_sync_projection_state ADD COLUMN repair_expires_at TEXT`);
|
|
1927
|
+
}
|
|
1928
|
+
if (!projectionStateColumns.some((column) => column.name === 'applied_snapshot_id')) {
|
|
1929
|
+
db.exec(`ALTER TABLE workspace_sync_projection_state ADD COLUMN applied_snapshot_id TEXT`);
|
|
1930
|
+
}
|
|
1931
|
+
if (!projectionStateColumns.some((column) => column.name === 'applied_page_digest')) {
|
|
1932
|
+
db.exec(`ALTER TABLE workspace_sync_projection_state ADD COLUMN applied_page_digest TEXT`);
|
|
1933
|
+
}
|
|
1934
|
+
const revisionColumns = db.prepare(`PRAGMA table_info(workspace_sync_entity_revisions)`).all();
|
|
1935
|
+
if (!revisionColumns.some((column) => column.name === 'coexistence_owned')) {
|
|
1936
|
+
db.exec(`ALTER TABLE workspace_sync_entity_revisions ADD COLUMN coexistence_owned INTEGER NOT NULL DEFAULT 1`);
|
|
1937
|
+
}
|
|
1938
|
+
db.exec(`
|
|
1939
|
+
UPDATE workspace_sync_entity_revisions
|
|
1940
|
+
SET coexistence_owned = 0
|
|
1941
|
+
WHERE EXISTS (
|
|
1942
|
+
SELECT 1 FROM workspace_sync_journal
|
|
1943
|
+
WHERE workspace_sync_journal.tenant_id = workspace_sync_entity_revisions.tenant_id
|
|
1944
|
+
AND workspace_sync_journal.workspace_id = workspace_sync_entity_revisions.workspace_id
|
|
1945
|
+
AND workspace_sync_journal.domain = workspace_sync_entity_revisions.domain
|
|
1946
|
+
AND workspace_sync_journal.entity_id = workspace_sync_entity_revisions.entity_id
|
|
1947
|
+
AND workspace_sync_journal.sequence = workspace_sync_entity_revisions.last_sequence
|
|
1948
|
+
AND workspace_sync_journal.client_id = 'sync-v3-repair'
|
|
1949
|
+
AND (
|
|
1950
|
+
workspace_sync_journal.operation_id LIKE 'repair-baseline-%'
|
|
1951
|
+
OR (
|
|
1952
|
+
workspace_sync_journal.domain = 'initiative'
|
|
1953
|
+
AND workspace_sync_journal.operation_id LIKE 'initiative-baseline-%'
|
|
1954
|
+
)
|
|
1955
|
+
)
|
|
1956
|
+
)
|
|
1957
|
+
`);
|
|
1958
|
+
if (!revisionColumns.some((column) => column.name === 'metadata_owned')) {
|
|
1959
|
+
db.exec(`ALTER TABLE workspace_sync_entity_revisions ADD COLUMN metadata_owned INTEGER NOT NULL DEFAULT 0`);
|
|
1960
|
+
}
|
|
1961
|
+
if (!revisionColumns.some((column) => column.name === 'reopen_assignee_owned')) {
|
|
1962
|
+
db.exec(`ALTER TABLE workspace_sync_entity_revisions ADD COLUMN reopen_assignee_owned INTEGER NOT NULL DEFAULT 0`);
|
|
1963
|
+
}
|
|
1964
|
+
db.exec(`
|
|
1965
|
+
UPDATE workspace_sync_entity_revisions
|
|
1966
|
+
SET metadata_owned = 1
|
|
1967
|
+
WHERE metadata_owned = 0
|
|
1968
|
+
AND EXISTS (
|
|
1969
|
+
SELECT 1
|
|
1970
|
+
FROM workspace_sync_journal
|
|
1971
|
+
WHERE workspace_sync_journal.tenant_id = workspace_sync_entity_revisions.tenant_id
|
|
1972
|
+
AND workspace_sync_journal.workspace_id = workspace_sync_entity_revisions.workspace_id
|
|
1973
|
+
AND workspace_sync_journal.domain = workspace_sync_entity_revisions.domain
|
|
1974
|
+
AND workspace_sync_journal.entity_id = workspace_sync_entity_revisions.entity_id
|
|
1975
|
+
AND workspace_sync_journal.mutation_kind IN ('metadata-update', 'create')
|
|
1976
|
+
)
|
|
1977
|
+
`);
|
|
1978
|
+
}
|
|
1979
|
+
export function ensureLocalSyncCoordinatorSchema(db) {
|
|
1980
|
+
db.exec(`
|
|
1981
|
+
CREATE TABLE IF NOT EXISTS local_sync_coordinator_state (
|
|
1982
|
+
coordinator_id TEXT PRIMARY KEY,
|
|
1983
|
+
active_workspace_id TEXT,
|
|
1984
|
+
coordinator_generation INTEGER NOT NULL DEFAULT 0,
|
|
1985
|
+
ownership_mode TEXT NOT NULL,
|
|
1986
|
+
desired_ownership_mode TEXT NOT NULL DEFAULT 'browser-gateway',
|
|
1987
|
+
transition_state TEXT NOT NULL,
|
|
1988
|
+
accepted_switch_command_id TEXT,
|
|
1989
|
+
target_workspace_id TEXT,
|
|
1990
|
+
requested_by_json TEXT,
|
|
1991
|
+
terminal_switch_result_json TEXT,
|
|
1992
|
+
terminal_transfer_result_json TEXT,
|
|
1993
|
+
accepted_transfer_command_id TEXT,
|
|
1994
|
+
transfer_target_mode TEXT,
|
|
1995
|
+
transfer_phase TEXT,
|
|
1996
|
+
transfer_version INTEGER,
|
|
1997
|
+
local_data_version INTEGER NOT NULL DEFAULT 0,
|
|
1998
|
+
updated_at TEXT NOT NULL
|
|
1999
|
+
);
|
|
2000
|
+
|
|
2001
|
+
CREATE TABLE IF NOT EXISTS local_sync_coordinator_commands (
|
|
2002
|
+
command_id TEXT PRIMARY KEY,
|
|
2003
|
+
workspace_id TEXT,
|
|
2004
|
+
expected_coordinator_generation INTEGER NOT NULL,
|
|
2005
|
+
command_type TEXT NOT NULL,
|
|
2006
|
+
command_version INTEGER NOT NULL,
|
|
2007
|
+
args_json TEXT NOT NULL,
|
|
2008
|
+
canonical_fingerprint TEXT NOT NULL,
|
|
2009
|
+
requested_by_json TEXT NOT NULL,
|
|
2010
|
+
requested_at TEXT NOT NULL,
|
|
2011
|
+
status TEXT NOT NULL,
|
|
2012
|
+
started_at TEXT,
|
|
2013
|
+
completed_at TEXT,
|
|
2014
|
+
result_json TEXT,
|
|
2015
|
+
error_code TEXT,
|
|
2016
|
+
error_message TEXT,
|
|
2017
|
+
updated_at TEXT NOT NULL
|
|
2018
|
+
);
|
|
2019
|
+
|
|
2020
|
+
CREATE INDEX IF NOT EXISTS idx_local_sync_coordinator_commands_status
|
|
2021
|
+
ON local_sync_coordinator_commands(status, requested_at);
|
|
2022
|
+
|
|
2023
|
+
CREATE INDEX IF NOT EXISTS idx_local_sync_coordinator_commands_workspace
|
|
2024
|
+
ON local_sync_coordinator_commands(workspace_id, requested_at);
|
|
2025
|
+
|
|
2026
|
+
CREATE INDEX IF NOT EXISTS idx_local_sync_coordinator_commands_terminal
|
|
2027
|
+
ON local_sync_coordinator_commands(status, completed_at, command_id);
|
|
2028
|
+
|
|
2029
|
+
CREATE TABLE IF NOT EXISTS local_sync_execution_permits (
|
|
2030
|
+
permit_id TEXT PRIMARY KEY,
|
|
2031
|
+
workspace_id TEXT NOT NULL,
|
|
2032
|
+
coordinator_generation INTEGER NOT NULL,
|
|
2033
|
+
server_instance_id TEXT NOT NULL,
|
|
2034
|
+
owner_mode TEXT NOT NULL DEFAULT 'browser-gateway',
|
|
2035
|
+
operation_class TEXT NOT NULL,
|
|
2036
|
+
operation_identity TEXT,
|
|
2037
|
+
last_committed_cursor_json TEXT,
|
|
2038
|
+
state TEXT NOT NULL,
|
|
2039
|
+
upstream_disposition TEXT,
|
|
2040
|
+
issued_at TEXT NOT NULL,
|
|
2041
|
+
deadline_at TEXT NOT NULL,
|
|
2042
|
+
last_transition_at TEXT NOT NULL,
|
|
2043
|
+
completed_at TEXT,
|
|
2044
|
+
error_code TEXT
|
|
2045
|
+
);
|
|
2046
|
+
|
|
2047
|
+
CREATE INDEX IF NOT EXISTS idx_local_sync_execution_permits_live
|
|
2048
|
+
ON local_sync_execution_permits(workspace_id, state, issued_at);
|
|
2049
|
+
|
|
2050
|
+
CREATE TABLE IF NOT EXISTS local_sync_recovery_obligations (
|
|
2051
|
+
obligation_id TEXT PRIMARY KEY,
|
|
2052
|
+
permit_id TEXT NOT NULL UNIQUE,
|
|
2053
|
+
workspace_id TEXT NOT NULL,
|
|
2054
|
+
operation_class TEXT NOT NULL,
|
|
2055
|
+
operation_identity TEXT,
|
|
2056
|
+
upstream_disposition TEXT NOT NULL,
|
|
2057
|
+
last_committed_cursor_json TEXT,
|
|
2058
|
+
required_action TEXT NOT NULL,
|
|
2059
|
+
created_at TEXT NOT NULL,
|
|
2060
|
+
resolved_at TEXT,
|
|
2061
|
+
resolved_boundary_json TEXT
|
|
2062
|
+
);
|
|
2063
|
+
|
|
2064
|
+
CREATE INDEX IF NOT EXISTS idx_local_sync_recovery_obligations_open
|
|
2065
|
+
ON local_sync_recovery_obligations(workspace_id, resolved_at, created_at);
|
|
2066
|
+
|
|
2067
|
+
CREATE TABLE IF NOT EXISTS local_sync_legacy_adoption_state (
|
|
2068
|
+
tenant_id TEXT NOT NULL,
|
|
2069
|
+
workspace_id TEXT NOT NULL,
|
|
2070
|
+
domain TEXT NOT NULL,
|
|
2071
|
+
projection_epoch INTEGER NOT NULL,
|
|
2072
|
+
settled_at TEXT NOT NULL,
|
|
2073
|
+
next_scan_at TEXT NOT NULL,
|
|
2074
|
+
PRIMARY KEY (tenant_id, workspace_id, domain)
|
|
2075
|
+
);
|
|
2076
|
+
|
|
2077
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_content_pull_obligations (
|
|
2078
|
+
tenant_id TEXT NOT NULL,
|
|
2079
|
+
workspace_id TEXT NOT NULL,
|
|
2080
|
+
kind TEXT NOT NULL,
|
|
2081
|
+
path TEXT NOT NULL,
|
|
2082
|
+
source_watermark TEXT NOT NULL,
|
|
2083
|
+
metadata_fingerprint TEXT NOT NULL,
|
|
2084
|
+
expected_sha256 TEXT NOT NULL,
|
|
2085
|
+
expected_size_bytes INTEGER NOT NULL,
|
|
2086
|
+
manifest_updated_at TEXT NOT NULL,
|
|
2087
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
2088
|
+
last_error TEXT,
|
|
2089
|
+
created_at TEXT NOT NULL,
|
|
2090
|
+
updated_at TEXT NOT NULL,
|
|
2091
|
+
resolved_at TEXT,
|
|
2092
|
+
PRIMARY KEY (tenant_id, workspace_id, kind, path)
|
|
2093
|
+
);
|
|
2094
|
+
|
|
2095
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_content_pull_obligations_open
|
|
2096
|
+
ON workspace_sync_content_pull_obligations(
|
|
2097
|
+
tenant_id, workspace_id, resolved_at, updated_at, kind, path
|
|
2098
|
+
);
|
|
2099
|
+
|
|
2100
|
+
CREATE TABLE IF NOT EXISTS workspace_sync_v3_attachment_apply_obligations (
|
|
2101
|
+
tenant_id TEXT NOT NULL,
|
|
2102
|
+
workspace_id TEXT NOT NULL,
|
|
2103
|
+
task_id TEXT NOT NULL,
|
|
2104
|
+
asset_ids_json TEXT NOT NULL,
|
|
2105
|
+
payload_json TEXT NOT NULL,
|
|
2106
|
+
canonical_fingerprint TEXT NOT NULL,
|
|
2107
|
+
source_sequence TEXT NOT NULL,
|
|
2108
|
+
entity_revision TEXT,
|
|
2109
|
+
lifecycle_revision TEXT,
|
|
2110
|
+
revision_fingerprint TEXT,
|
|
2111
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
2112
|
+
last_error TEXT,
|
|
2113
|
+
created_at TEXT NOT NULL,
|
|
2114
|
+
updated_at TEXT NOT NULL,
|
|
2115
|
+
next_attempt_at TEXT NOT NULL,
|
|
2116
|
+
resolved_at TEXT,
|
|
2117
|
+
PRIMARY KEY (tenant_id, workspace_id, task_id)
|
|
2118
|
+
);
|
|
2119
|
+
|
|
2120
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_sync_v3_attachment_apply_obligations_open
|
|
2121
|
+
ON workspace_sync_v3_attachment_apply_obligations(
|
|
2122
|
+
tenant_id, workspace_id, resolved_at, next_attempt_at
|
|
2123
|
+
);
|
|
2124
|
+
|
|
2125
|
+
CREATE TABLE IF NOT EXISTS local_workspace_sync_runner_state (
|
|
2126
|
+
tenant_id TEXT NOT NULL,
|
|
2127
|
+
workspace_id TEXT NOT NULL,
|
|
2128
|
+
state_version INTEGER NOT NULL,
|
|
2129
|
+
coordinator_generation INTEGER NOT NULL,
|
|
2130
|
+
checkpoint_revision INTEGER NOT NULL,
|
|
2131
|
+
checkpoint_json TEXT NOT NULL,
|
|
2132
|
+
created_at TEXT NOT NULL,
|
|
2133
|
+
updated_at TEXT NOT NULL,
|
|
2134
|
+
PRIMARY KEY (tenant_id, workspace_id)
|
|
2135
|
+
);
|
|
2136
|
+
|
|
2137
|
+
CREATE INDEX IF NOT EXISTS idx_local_workspace_sync_runner_generation
|
|
2138
|
+
ON local_workspace_sync_runner_state(coordinator_generation, updated_at);
|
|
2139
|
+
`);
|
|
2140
|
+
const attachmentApplyColumns = db.provider === 'postgres'
|
|
2141
|
+
? new Set(db.prepare(`
|
|
2142
|
+
SELECT column_name AS name
|
|
2143
|
+
FROM information_schema.columns
|
|
2144
|
+
WHERE table_schema = current_schema()
|
|
2145
|
+
AND table_name = 'workspace_sync_v3_attachment_apply_obligations'
|
|
2146
|
+
`).all().map((column) => column.name))
|
|
2147
|
+
: new Set(db.prepare(`
|
|
2148
|
+
PRAGMA table_info(workspace_sync_v3_attachment_apply_obligations)
|
|
2149
|
+
`).all().map((column) => column.name));
|
|
2150
|
+
if (!attachmentApplyColumns.has('entity_revision')) {
|
|
2151
|
+
db.exec(`ALTER TABLE workspace_sync_v3_attachment_apply_obligations ADD COLUMN entity_revision TEXT`);
|
|
2152
|
+
}
|
|
2153
|
+
if (!attachmentApplyColumns.has('lifecycle_revision')) {
|
|
2154
|
+
db.exec(`ALTER TABLE workspace_sync_v3_attachment_apply_obligations ADD COLUMN lifecycle_revision TEXT`);
|
|
2155
|
+
}
|
|
2156
|
+
if (!attachmentApplyColumns.has('revision_fingerprint')) {
|
|
2157
|
+
db.exec(`ALTER TABLE workspace_sync_v3_attachment_apply_obligations ADD COLUMN revision_fingerprint TEXT`);
|
|
2158
|
+
}
|
|
2159
|
+
const coordinatorStateColumns = db.provider === 'postgres'
|
|
2160
|
+
? new Set(db.prepare(`
|
|
2161
|
+
SELECT column_name AS name
|
|
2162
|
+
FROM information_schema.columns
|
|
2163
|
+
WHERE table_schema = current_schema()
|
|
2164
|
+
AND table_name = 'local_sync_coordinator_state'
|
|
2165
|
+
`).all().map((column) => column.name))
|
|
2166
|
+
: new Set(db.prepare(`
|
|
2167
|
+
PRAGMA table_info(local_sync_coordinator_state)
|
|
2168
|
+
`).all().map((column) => column.name));
|
|
2169
|
+
if (!coordinatorStateColumns.has('accepted_transfer_command_id')) {
|
|
2170
|
+
db.exec(`ALTER TABLE local_sync_coordinator_state ADD COLUMN accepted_transfer_command_id TEXT`);
|
|
2171
|
+
}
|
|
2172
|
+
if (!coordinatorStateColumns.has('terminal_transfer_result_json')) {
|
|
2173
|
+
db.exec(`ALTER TABLE local_sync_coordinator_state ADD COLUMN terminal_transfer_result_json TEXT`);
|
|
2174
|
+
}
|
|
2175
|
+
if (!coordinatorStateColumns.has('transfer_target_mode')) {
|
|
2176
|
+
db.exec(`ALTER TABLE local_sync_coordinator_state ADD COLUMN transfer_target_mode TEXT`);
|
|
2177
|
+
}
|
|
2178
|
+
if (!coordinatorStateColumns.has('transfer_phase')) {
|
|
2179
|
+
db.exec(`ALTER TABLE local_sync_coordinator_state ADD COLUMN transfer_phase TEXT`);
|
|
2180
|
+
}
|
|
2181
|
+
if (!coordinatorStateColumns.has('transfer_version')) {
|
|
2182
|
+
db.exec(`ALTER TABLE local_sync_coordinator_state ADD COLUMN transfer_version INTEGER`);
|
|
2183
|
+
}
|
|
2184
|
+
if (!coordinatorStateColumns.has('local_data_version')) {
|
|
2185
|
+
db.exec(`
|
|
2186
|
+
ALTER TABLE local_sync_coordinator_state
|
|
2187
|
+
ADD COLUMN local_data_version INTEGER NOT NULL DEFAULT 0
|
|
2188
|
+
`);
|
|
2189
|
+
}
|
|
2190
|
+
if (!coordinatorStateColumns.has('desired_ownership_mode')) {
|
|
2191
|
+
db.transaction(() => {
|
|
2192
|
+
db.exec(`
|
|
2193
|
+
ALTER TABLE local_sync_coordinator_state
|
|
2194
|
+
ADD COLUMN desired_ownership_mode TEXT NOT NULL DEFAULT 'browser-gateway'
|
|
2195
|
+
`);
|
|
2196
|
+
const legacyStates = db.prepare(`
|
|
2197
|
+
SELECT coordinator_id, ownership_mode, transition_state,
|
|
2198
|
+
transfer_target_mode, terminal_transfer_result_json
|
|
2199
|
+
FROM local_sync_coordinator_state
|
|
2200
|
+
`).all();
|
|
2201
|
+
const updateDesiredOwner = db.prepare(`
|
|
2202
|
+
UPDATE local_sync_coordinator_state
|
|
2203
|
+
SET desired_ownership_mode = ?
|
|
2204
|
+
WHERE coordinator_id = ?
|
|
2205
|
+
`);
|
|
2206
|
+
for (const state of legacyStates) {
|
|
2207
|
+
let desiredOwner = 'browser-gateway';
|
|
2208
|
+
if (state.ownership_mode === 'server') {
|
|
2209
|
+
desiredOwner = 'server';
|
|
2210
|
+
}
|
|
2211
|
+
else if (state.transition_state === 'transferring-ownership'
|
|
2212
|
+
&& state.transfer_target_mode === 'browser-gateway') {
|
|
2213
|
+
desiredOwner = 'server';
|
|
2214
|
+
}
|
|
2215
|
+
else if (state.ownership_mode === 'stopped'
|
|
2216
|
+
&& state.terminal_transfer_result_json) {
|
|
2217
|
+
try {
|
|
2218
|
+
const terminal = JSON.parse(state.terminal_transfer_result_json);
|
|
2219
|
+
if ((terminal.status === 'succeeded' && terminal.targetMode === 'server')
|
|
2220
|
+
|| (terminal.status === 'failed' && terminal.sourceMode === 'server')) {
|
|
2221
|
+
desiredOwner = 'server';
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
catch {
|
|
2225
|
+
// Invalid historical evidence cannot safely opt into server recovery.
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
updateDesiredOwner.run(desiredOwner, state.coordinator_id);
|
|
2229
|
+
}
|
|
2230
|
+
})();
|
|
2231
|
+
}
|
|
2232
|
+
const permitColumns = db.provider === 'postgres'
|
|
2233
|
+
? new Set(db.prepare(`
|
|
2234
|
+
SELECT column_name AS name
|
|
2235
|
+
FROM information_schema.columns
|
|
2236
|
+
WHERE table_schema = current_schema()
|
|
2237
|
+
AND table_name = 'local_sync_execution_permits'
|
|
2238
|
+
`).all().map((column) => column.name))
|
|
2239
|
+
: new Set(db.prepare(`
|
|
2240
|
+
PRAGMA table_info(local_sync_execution_permits)
|
|
2241
|
+
`).all().map((column) => column.name));
|
|
2242
|
+
if (!permitColumns.has('last_committed_cursor_json')) {
|
|
2243
|
+
db.exec(`ALTER TABLE local_sync_execution_permits ADD COLUMN last_committed_cursor_json TEXT`);
|
|
2244
|
+
}
|
|
2245
|
+
if (!permitColumns.has('owner_mode')) {
|
|
2246
|
+
db.exec(`
|
|
2247
|
+
ALTER TABLE local_sync_execution_permits
|
|
2248
|
+
ADD COLUMN owner_mode TEXT NOT NULL DEFAULT 'browser-gateway'
|
|
2249
|
+
`);
|
|
2250
|
+
}
|
|
2251
|
+
const recoveryObligationColumns = db.provider === 'postgres'
|
|
2252
|
+
? new Set(db.prepare(`
|
|
2253
|
+
SELECT column_name AS name
|
|
2254
|
+
FROM information_schema.columns
|
|
2255
|
+
WHERE table_schema = current_schema()
|
|
2256
|
+
AND table_name = 'local_sync_recovery_obligations'
|
|
2257
|
+
`).all().map((column) => column.name))
|
|
2258
|
+
: new Set(db.prepare(`
|
|
2259
|
+
PRAGMA table_info(local_sync_recovery_obligations)
|
|
2260
|
+
`).all().map((column) => column.name));
|
|
2261
|
+
if (!recoveryObligationColumns.has('resolved_boundary_json')) {
|
|
2262
|
+
db.exec(`
|
|
2263
|
+
ALTER TABLE local_sync_recovery_obligations
|
|
2264
|
+
ADD COLUMN resolved_boundary_json TEXT
|
|
2265
|
+
`);
|
|
2266
|
+
}
|
|
999
2267
|
}
|
|
1000
2268
|
export function ensureWorkspaceDocumentsSchema(db) {
|
|
1001
2269
|
db.exec(`
|
|
@@ -1035,6 +2303,465 @@ export function ensureAnnotatedAttachmentSessionsSchema(db) {
|
|
|
1035
2303
|
ON annotated_attachment_sessions(tenant_id, workspace_id, base_image_asset_id, deleted_at, updated_at);
|
|
1036
2304
|
`);
|
|
1037
2305
|
}
|
|
2306
|
+
export function ensureTaskforceAgentsSchema(db) {
|
|
2307
|
+
db.exec(`
|
|
2308
|
+
CREATE TABLE IF NOT EXISTS taskforce_agents (
|
|
2309
|
+
id TEXT PRIMARY KEY,
|
|
2310
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2311
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2312
|
+
name TEXT NOT NULL,
|
|
2313
|
+
model_provider TEXT NOT NULL DEFAULT 'taskforce_hq',
|
|
2314
|
+
provider_key TEXT NOT NULL DEFAULT 'anthropic',
|
|
2315
|
+
model_key TEXT NOT NULL DEFAULT 'anthropic.claude-sonnet-4-6',
|
|
2316
|
+
model_tier TEXT NOT NULL DEFAULT 'balanced',
|
|
2317
|
+
system_prompt TEXT NOT NULL,
|
|
2318
|
+
enabled INTEGER NOT NULL DEFAULT 1,
|
|
2319
|
+
lifecycle_status TEXT NOT NULL DEFAULT 'active',
|
|
2320
|
+
managed_profile_id TEXT,
|
|
2321
|
+
definition_json TEXT,
|
|
2322
|
+
definition_revision INTEGER NOT NULL DEFAULT 0,
|
|
2323
|
+
definition_hash TEXT,
|
|
2324
|
+
configuration_state TEXT NOT NULL DEFAULT 'needs-migration',
|
|
2325
|
+
configuration_issues_json TEXT NOT NULL DEFAULT '[]',
|
|
2326
|
+
created_by_user_id TEXT,
|
|
2327
|
+
updated_by_user_id TEXT,
|
|
2328
|
+
created_at TEXT NOT NULL,
|
|
2329
|
+
updated_at TEXT NOT NULL,
|
|
2330
|
+
deleted_at TEXT
|
|
2331
|
+
);
|
|
2332
|
+
|
|
2333
|
+
CREATE INDEX IF NOT EXISTS idx_taskforce_agents_workspace
|
|
2334
|
+
ON taskforce_agents(tenant_id, workspace_id, deleted_at, updated_at);
|
|
2335
|
+
|
|
2336
|
+
CREATE TABLE IF NOT EXISTS agent_conversations (
|
|
2337
|
+
id TEXT PRIMARY KEY,
|
|
2338
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2339
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2340
|
+
agent_id TEXT NOT NULL,
|
|
2341
|
+
task_id TEXT,
|
|
2342
|
+
title TEXT NOT NULL DEFAULT 'Agent chat',
|
|
2343
|
+
messages_json TEXT NOT NULL DEFAULT '[]',
|
|
2344
|
+
model_provider TEXT,
|
|
2345
|
+
model_id TEXT,
|
|
2346
|
+
usage_json TEXT,
|
|
2347
|
+
latency_ms INTEGER,
|
|
2348
|
+
created_by_user_id TEXT,
|
|
2349
|
+
updated_by_user_id TEXT,
|
|
2350
|
+
created_at TEXT NOT NULL,
|
|
2351
|
+
updated_at TEXT NOT NULL,
|
|
2352
|
+
deleted_at TEXT
|
|
2353
|
+
);
|
|
2354
|
+
|
|
2355
|
+
CREATE INDEX IF NOT EXISTS idx_agent_conversations_agent
|
|
2356
|
+
ON agent_conversations(tenant_id, workspace_id, agent_id, deleted_at, updated_at);
|
|
2357
|
+
`);
|
|
2358
|
+
const agentColumns = db.provider === 'postgres'
|
|
2359
|
+
? db.prepare(`
|
|
2360
|
+
SELECT column_name AS name
|
|
2361
|
+
FROM information_schema.columns
|
|
2362
|
+
WHERE table_name = 'taskforce_agents'
|
|
2363
|
+
`).all()
|
|
2364
|
+
: db.prepare(`PRAGMA table_info(taskforce_agents)`).all();
|
|
2365
|
+
const agentColumnNames = new Set(agentColumns.map((column) => column.name));
|
|
2366
|
+
const missingAgentColumns = [
|
|
2367
|
+
['provider_key', `TEXT NOT NULL DEFAULT 'anthropic'`],
|
|
2368
|
+
['model_key', `TEXT NOT NULL DEFAULT 'anthropic.claude-sonnet-4-6'`],
|
|
2369
|
+
['lifecycle_status', `TEXT NOT NULL DEFAULT 'active'`],
|
|
2370
|
+
['managed_profile_id', 'TEXT'],
|
|
2371
|
+
['definition_json', 'TEXT'],
|
|
2372
|
+
['definition_revision', 'INTEGER NOT NULL DEFAULT 0'],
|
|
2373
|
+
['definition_hash', 'TEXT'],
|
|
2374
|
+
['configuration_state', `TEXT NOT NULL DEFAULT 'needs-migration'`],
|
|
2375
|
+
['configuration_issues_json', `TEXT NOT NULL DEFAULT '[]'`],
|
|
2376
|
+
];
|
|
2377
|
+
for (const [columnName, columnDefinition] of missingAgentColumns) {
|
|
2378
|
+
if (agentColumnNames.has(columnName))
|
|
2379
|
+
continue;
|
|
2380
|
+
db.exec(db.provider === 'postgres'
|
|
2381
|
+
? `ALTER TABLE taskforce_agents ADD COLUMN IF NOT EXISTS ${columnName} ${columnDefinition}`
|
|
2382
|
+
: `ALTER TABLE taskforce_agents ADD COLUMN ${columnName} ${columnDefinition}`);
|
|
2383
|
+
}
|
|
2384
|
+
if (MIGRATION_COMPAT_ENABLED)
|
|
2385
|
+
backfillLegacyTaskforceAgentDefinitions(db);
|
|
2386
|
+
const conversationColumns = db.provider === 'postgres'
|
|
2387
|
+
? db.prepare(`
|
|
2388
|
+
SELECT column_name AS name
|
|
2389
|
+
FROM information_schema.columns
|
|
2390
|
+
WHERE table_name = 'agent_conversations'
|
|
2391
|
+
`).all()
|
|
2392
|
+
: db.prepare(`PRAGMA table_info(agent_conversations)`).all();
|
|
2393
|
+
const conversationColumnNames = new Set(conversationColumns.map((column) => column.name));
|
|
2394
|
+
if (!conversationColumnNames.has('task_id')) {
|
|
2395
|
+
db.exec(db.provider === 'postgres'
|
|
2396
|
+
? `ALTER TABLE agent_conversations ADD COLUMN IF NOT EXISTS task_id TEXT`
|
|
2397
|
+
: `ALTER TABLE agent_conversations ADD COLUMN task_id TEXT`);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
export function ensureAgentRolesSchema(db) {
|
|
2401
|
+
db.exec(`
|
|
2402
|
+
CREATE TABLE IF NOT EXISTS agent_roles (
|
|
2403
|
+
id TEXT PRIMARY KEY,
|
|
2404
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2405
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2406
|
+
lifecycle_status TEXT NOT NULL DEFAULT 'active'
|
|
2407
|
+
CHECK (lifecycle_status IN ('active', 'retired')),
|
|
2408
|
+
current_revision INTEGER NOT NULL,
|
|
2409
|
+
current_content_hash TEXT NOT NULL,
|
|
2410
|
+
created_by_actor_id TEXT,
|
|
2411
|
+
updated_by_actor_id TEXT,
|
|
2412
|
+
created_at TEXT NOT NULL,
|
|
2413
|
+
updated_at TEXT NOT NULL,
|
|
2414
|
+
retired_at TEXT,
|
|
2415
|
+
deleted_at TEXT
|
|
2416
|
+
);
|
|
2417
|
+
|
|
2418
|
+
CREATE INDEX IF NOT EXISTS idx_agent_roles_workspace
|
|
2419
|
+
ON agent_roles(tenant_id, workspace_id, deleted_at, lifecycle_status, updated_at);
|
|
2420
|
+
|
|
2421
|
+
CREATE TABLE IF NOT EXISTS agent_role_revisions (
|
|
2422
|
+
role_id TEXT NOT NULL,
|
|
2423
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2424
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2425
|
+
revision INTEGER NOT NULL,
|
|
2426
|
+
definition_json TEXT NOT NULL,
|
|
2427
|
+
content_hash TEXT NOT NULL,
|
|
2428
|
+
created_by_actor_id TEXT,
|
|
2429
|
+
created_at TEXT NOT NULL,
|
|
2430
|
+
PRIMARY KEY (role_id, revision)
|
|
2431
|
+
);
|
|
2432
|
+
|
|
2433
|
+
CREATE INDEX IF NOT EXISTS idx_agent_role_revisions_workspace
|
|
2434
|
+
ON agent_role_revisions(tenant_id, workspace_id, role_id, revision);
|
|
2435
|
+
`);
|
|
2436
|
+
}
|
|
2437
|
+
export function ensureTaskforceAgentSkillsSchema(db) {
|
|
2438
|
+
db.exec(`
|
|
2439
|
+
CREATE TABLE IF NOT EXISTS taskforce_agent_skills (
|
|
2440
|
+
id TEXT PRIMARY KEY,
|
|
2441
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2442
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2443
|
+
name TEXT NOT NULL,
|
|
2444
|
+
lifecycle_status TEXT NOT NULL DEFAULT 'active'
|
|
2445
|
+
CHECK (lifecycle_status IN ('active', 'retired')),
|
|
2446
|
+
definition_json TEXT NOT NULL,
|
|
2447
|
+
revision_number INTEGER NOT NULL CHECK (revision_number >= 1),
|
|
2448
|
+
content_hash TEXT NOT NULL,
|
|
2449
|
+
created_by_actor_id TEXT,
|
|
2450
|
+
updated_by_actor_id TEXT,
|
|
2451
|
+
created_at TEXT NOT NULL,
|
|
2452
|
+
updated_at TEXT NOT NULL,
|
|
2453
|
+
retired_at TEXT,
|
|
2454
|
+
retired_by_actor_id TEXT
|
|
2455
|
+
);
|
|
2456
|
+
|
|
2457
|
+
CREATE INDEX IF NOT EXISTS idx_taskforce_agent_skills_workspace
|
|
2458
|
+
ON taskforce_agent_skills(tenant_id, workspace_id, lifecycle_status, name);
|
|
2459
|
+
|
|
2460
|
+
CREATE TABLE IF NOT EXISTS taskforce_agent_skill_revisions (
|
|
2461
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2462
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2463
|
+
skill_id TEXT NOT NULL,
|
|
2464
|
+
revision_number INTEGER NOT NULL CHECK (revision_number >= 1),
|
|
2465
|
+
content_hash TEXT NOT NULL,
|
|
2466
|
+
definition_json TEXT NOT NULL,
|
|
2467
|
+
created_by_actor_id TEXT,
|
|
2468
|
+
created_at TEXT NOT NULL,
|
|
2469
|
+
PRIMARY KEY (tenant_id, workspace_id, skill_id, revision_number)
|
|
2470
|
+
);
|
|
2471
|
+
|
|
2472
|
+
CREATE INDEX IF NOT EXISTS idx_taskforce_agent_skill_revisions_skill
|
|
2473
|
+
ON taskforce_agent_skill_revisions(tenant_id, workspace_id, skill_id, revision_number);
|
|
2474
|
+
|
|
2475
|
+
CREATE TABLE IF NOT EXISTS taskforce_agent_skill_events (
|
|
2476
|
+
id TEXT PRIMARY KEY,
|
|
2477
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2478
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2479
|
+
skill_id TEXT NOT NULL,
|
|
2480
|
+
event_type TEXT NOT NULL,
|
|
2481
|
+
actor_id TEXT,
|
|
2482
|
+
details_json TEXT NOT NULL DEFAULT '{}',
|
|
2483
|
+
created_at TEXT NOT NULL
|
|
2484
|
+
);
|
|
2485
|
+
|
|
2486
|
+
CREATE INDEX IF NOT EXISTS idx_taskforce_agent_skill_events_skill
|
|
2487
|
+
ON taskforce_agent_skill_events(tenant_id, workspace_id, skill_id, created_at);
|
|
2488
|
+
`);
|
|
2489
|
+
}
|
|
2490
|
+
export function ensureWorkflowSchema(db) {
|
|
2491
|
+
db.exec(`
|
|
2492
|
+
CREATE TABLE IF NOT EXISTS workflow_templates (
|
|
2493
|
+
id TEXT PRIMARY KEY,
|
|
2494
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2495
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2496
|
+
name TEXT NOT NULL,
|
|
2497
|
+
description TEXT NOT NULL DEFAULT '',
|
|
2498
|
+
status TEXT NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'retired')),
|
|
2499
|
+
created_by_actor_id TEXT,
|
|
2500
|
+
updated_by_actor_id TEXT,
|
|
2501
|
+
created_at TEXT NOT NULL,
|
|
2502
|
+
updated_at TEXT NOT NULL,
|
|
2503
|
+
deleted_at TEXT
|
|
2504
|
+
);
|
|
2505
|
+
|
|
2506
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_templates_workspace
|
|
2507
|
+
ON workflow_templates(tenant_id, workspace_id, deleted_at, updated_at);
|
|
2508
|
+
|
|
2509
|
+
CREATE TABLE IF NOT EXISTS workflow_versions (
|
|
2510
|
+
id TEXT PRIMARY KEY,
|
|
2511
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2512
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2513
|
+
workflow_template_id TEXT NOT NULL,
|
|
2514
|
+
version_number INTEGER,
|
|
2515
|
+
status TEXT NOT NULL DEFAULT 'draft' CHECK (status IN ('draft', 'published')),
|
|
2516
|
+
name TEXT NOT NULL,
|
|
2517
|
+
description TEXT NOT NULL DEFAULT '',
|
|
2518
|
+
created_by_actor_id TEXT,
|
|
2519
|
+
updated_by_actor_id TEXT,
|
|
2520
|
+
published_by_actor_id TEXT,
|
|
2521
|
+
created_at TEXT NOT NULL,
|
|
2522
|
+
updated_at TEXT NOT NULL,
|
|
2523
|
+
published_at TEXT,
|
|
2524
|
+
deleted_at TEXT,
|
|
2525
|
+
UNIQUE (id, workflow_template_id),
|
|
2526
|
+
CHECK (
|
|
2527
|
+
(status = 'draft' AND version_number IS NULL AND published_at IS NULL)
|
|
2528
|
+
OR (status = 'published' AND version_number IS NOT NULL AND version_number > 0 AND published_at IS NOT NULL)
|
|
2529
|
+
),
|
|
2530
|
+
FOREIGN KEY (workflow_template_id) REFERENCES workflow_templates(id) ON DELETE RESTRICT
|
|
2531
|
+
);
|
|
2532
|
+
|
|
2533
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_versions_template
|
|
2534
|
+
ON workflow_versions(tenant_id, workspace_id, workflow_template_id, status, updated_at);
|
|
2535
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workflow_versions_published_number
|
|
2536
|
+
ON workflow_versions(tenant_id, workspace_id, workflow_template_id, version_number)
|
|
2537
|
+
WHERE status = 'published' AND deleted_at IS NULL;
|
|
2538
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workflow_versions_single_draft
|
|
2539
|
+
ON workflow_versions(tenant_id, workspace_id, workflow_template_id)
|
|
2540
|
+
WHERE status = 'draft' AND deleted_at IS NULL;
|
|
2541
|
+
|
|
2542
|
+
CREATE TABLE IF NOT EXISTS workflow_steps (
|
|
2543
|
+
id TEXT PRIMARY KEY,
|
|
2544
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2545
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2546
|
+
workflow_version_id TEXT NOT NULL,
|
|
2547
|
+
position INTEGER NOT NULL CHECK (position >= 0),
|
|
2548
|
+
name TEXT NOT NULL,
|
|
2549
|
+
instructions TEXT NOT NULL DEFAULT '',
|
|
2550
|
+
owner_type TEXT CHECK (owner_type IS NULL OR owner_type IN ('user', 'agent')),
|
|
2551
|
+
owner_id TEXT,
|
|
2552
|
+
expected_artifact TEXT,
|
|
2553
|
+
requires_comment_evidence INTEGER NOT NULL DEFAULT 0 CHECK (requires_comment_evidence IN (0, 1)),
|
|
2554
|
+
is_required INTEGER NOT NULL DEFAULT 1 CHECK (is_required IN (0, 1)),
|
|
2555
|
+
created_at TEXT NOT NULL,
|
|
2556
|
+
updated_at TEXT NOT NULL,
|
|
2557
|
+
CHECK ((owner_type IS NULL AND owner_id IS NULL) OR (owner_type IS NOT NULL AND owner_id IS NOT NULL)),
|
|
2558
|
+
FOREIGN KEY (workflow_version_id) REFERENCES workflow_versions(id) ON DELETE RESTRICT
|
|
2559
|
+
);
|
|
2560
|
+
|
|
2561
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workflow_steps_version_position
|
|
2562
|
+
ON workflow_steps(tenant_id, workspace_id, workflow_version_id, position);
|
|
2563
|
+
|
|
2564
|
+
CREATE TABLE IF NOT EXISTS workflow_executions (
|
|
2565
|
+
id TEXT PRIMARY KEY,
|
|
2566
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2567
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2568
|
+
task_id TEXT NOT NULL,
|
|
2569
|
+
workflow_template_id TEXT NOT NULL,
|
|
2570
|
+
workflow_version_id TEXT NOT NULL,
|
|
2571
|
+
status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'running', 'paused', 'completed', 'failed', 'ended')),
|
|
2572
|
+
current_step_id TEXT,
|
|
2573
|
+
created_by_actor_id TEXT,
|
|
2574
|
+
updated_by_actor_id TEXT,
|
|
2575
|
+
created_at TEXT NOT NULL,
|
|
2576
|
+
updated_at TEXT NOT NULL,
|
|
2577
|
+
started_at TEXT,
|
|
2578
|
+
completed_at TEXT,
|
|
2579
|
+
ended_at TEXT,
|
|
2580
|
+
deleted_at TEXT,
|
|
2581
|
+
FOREIGN KEY (workflow_template_id) REFERENCES workflow_templates(id) ON DELETE RESTRICT,
|
|
2582
|
+
FOREIGN KEY (workflow_version_id, workflow_template_id)
|
|
2583
|
+
REFERENCES workflow_versions(id, workflow_template_id) ON DELETE RESTRICT
|
|
2584
|
+
);
|
|
2585
|
+
|
|
2586
|
+
-- task_id intentionally remains a logical reference because Taskforce moves
|
|
2587
|
+
-- deleted tasks out of the active tasks table while retaining execution history.
|
|
2588
|
+
|
|
2589
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_executions_task
|
|
2590
|
+
ON workflow_executions(tenant_id, workspace_id, task_id, updated_at);
|
|
2591
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workflow_executions_one_active_per_task
|
|
2592
|
+
ON workflow_executions(tenant_id, workspace_id, task_id)
|
|
2593
|
+
WHERE status IN ('pending', 'running', 'paused') AND deleted_at IS NULL;
|
|
2594
|
+
|
|
2595
|
+
CREATE TABLE IF NOT EXISTS workflow_execution_events (
|
|
2596
|
+
id TEXT PRIMARY KEY,
|
|
2597
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2598
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2599
|
+
workflow_execution_id TEXT NOT NULL,
|
|
2600
|
+
sequence_number INTEGER NOT NULL CHECK (sequence_number >= 0),
|
|
2601
|
+
event_type TEXT NOT NULL CHECK (event_type IN (
|
|
2602
|
+
'execution-created', 'execution-started', 'execution-paused',
|
|
2603
|
+
'execution-resumed', 'execution-completed', 'execution-failed', 'execution-ended',
|
|
2604
|
+
'step-completed', 'step-started'
|
|
2605
|
+
)),
|
|
2606
|
+
from_status TEXT CHECK (from_status IS NULL OR from_status IN ('pending', 'running', 'paused', 'completed', 'failed', 'ended')),
|
|
2607
|
+
to_status TEXT NOT NULL CHECK (to_status IN ('pending', 'running', 'paused', 'completed', 'failed', 'ended')),
|
|
2608
|
+
step_id TEXT,
|
|
2609
|
+
actor_id TEXT NOT NULL,
|
|
2610
|
+
idempotency_key TEXT,
|
|
2611
|
+
details_json TEXT NOT NULL DEFAULT '{}',
|
|
2612
|
+
created_at TEXT NOT NULL,
|
|
2613
|
+
FOREIGN KEY (workflow_execution_id) REFERENCES workflow_executions(id) ON DELETE RESTRICT
|
|
2614
|
+
);
|
|
2615
|
+
|
|
2616
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_execution_events_execution
|
|
2617
|
+
ON workflow_execution_events(tenant_id, workspace_id, workflow_execution_id, sequence_number);
|
|
2618
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workflow_execution_events_sequence
|
|
2619
|
+
ON workflow_execution_events(tenant_id, workspace_id, workflow_execution_id, sequence_number);
|
|
2620
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workflow_execution_events_idempotency
|
|
2621
|
+
ON workflow_execution_events(tenant_id, workspace_id, workflow_execution_id, idempotency_key)
|
|
2622
|
+
WHERE idempotency_key IS NOT NULL;
|
|
2623
|
+
|
|
2624
|
+
INSERT INTO workflow_execution_events (
|
|
2625
|
+
id, tenant_id, workspace_id, workflow_execution_id, sequence_number, event_type,
|
|
2626
|
+
from_status, to_status, step_id, actor_id, idempotency_key,
|
|
2627
|
+
details_json, created_at
|
|
2628
|
+
)
|
|
2629
|
+
SELECT
|
|
2630
|
+
'workflow-execution-event-initial-' || execution.id,
|
|
2631
|
+
execution.tenant_id,
|
|
2632
|
+
execution.workspace_id,
|
|
2633
|
+
execution.id,
|
|
2634
|
+
0,
|
|
2635
|
+
'execution-created',
|
|
2636
|
+
NULL,
|
|
2637
|
+
'pending',
|
|
2638
|
+
NULL,
|
|
2639
|
+
COALESCE(execution.created_by_actor_id, 'system'),
|
|
2640
|
+
NULL,
|
|
2641
|
+
'{}',
|
|
2642
|
+
execution.created_at
|
|
2643
|
+
FROM workflow_executions execution
|
|
2644
|
+
WHERE NOT EXISTS (
|
|
2645
|
+
SELECT 1 FROM workflow_execution_events event
|
|
2646
|
+
WHERE event.tenant_id = execution.tenant_id
|
|
2647
|
+
AND event.workspace_id = execution.workspace_id
|
|
2648
|
+
AND event.workflow_execution_id = execution.id
|
|
2649
|
+
);
|
|
2650
|
+
`);
|
|
2651
|
+
ensureWorkflowStepEventTypes(db);
|
|
2652
|
+
if (db.provider !== 'postgres') {
|
|
2653
|
+
db.exec(`
|
|
2654
|
+
CREATE TRIGGER IF NOT EXISTS trg_workflow_execution_events_no_update
|
|
2655
|
+
BEFORE UPDATE ON workflow_execution_events
|
|
2656
|
+
BEGIN
|
|
2657
|
+
SELECT RAISE(ABORT, 'Workflow execution events are append-only');
|
|
2658
|
+
END;
|
|
2659
|
+
CREATE TRIGGER IF NOT EXISTS trg_workflow_execution_events_no_delete
|
|
2660
|
+
BEFORE DELETE ON workflow_execution_events
|
|
2661
|
+
BEGIN
|
|
2662
|
+
SELECT RAISE(ABORT, 'Workflow execution events are append-only');
|
|
2663
|
+
END;
|
|
2664
|
+
`);
|
|
2665
|
+
}
|
|
2666
|
+
else {
|
|
2667
|
+
db.exec(`
|
|
2668
|
+
CREATE OR REPLACE FUNCTION prevent_workflow_execution_event_mutation()
|
|
2669
|
+
RETURNS trigger AS $$
|
|
2670
|
+
BEGIN
|
|
2671
|
+
RAISE EXCEPTION 'Workflow execution events are append-only';
|
|
2672
|
+
END;
|
|
2673
|
+
$$ LANGUAGE plpgsql;
|
|
2674
|
+
DROP TRIGGER IF EXISTS trg_workflow_execution_events_no_mutation ON workflow_execution_events;
|
|
2675
|
+
CREATE TRIGGER trg_workflow_execution_events_no_mutation
|
|
2676
|
+
BEFORE UPDATE OR DELETE ON workflow_execution_events
|
|
2677
|
+
FOR EACH ROW EXECUTE FUNCTION prevent_workflow_execution_event_mutation();
|
|
2678
|
+
`);
|
|
2679
|
+
}
|
|
2680
|
+
const workflowStepColumns = db.provider === 'postgres'
|
|
2681
|
+
? new Set(db.prepare(`
|
|
2682
|
+
SELECT column_name AS name
|
|
2683
|
+
FROM information_schema.columns
|
|
2684
|
+
WHERE table_name = 'workflow_steps'
|
|
2685
|
+
`).all().map((column) => column.name))
|
|
2686
|
+
: new Set(db.prepare(`PRAGMA table_info(workflow_steps)`).all().map((column) => column.name));
|
|
2687
|
+
if (!workflowStepColumns.has('requires_comment_evidence')) {
|
|
2688
|
+
db.exec(`
|
|
2689
|
+
ALTER TABLE workflow_steps
|
|
2690
|
+
ADD COLUMN requires_comment_evidence INTEGER NOT NULL DEFAULT 0
|
|
2691
|
+
CHECK (requires_comment_evidence IN (0, 1))
|
|
2692
|
+
`);
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
function ensureWorkflowStepEventTypes(db) {
|
|
2696
|
+
if (db.provider === 'postgres') {
|
|
2697
|
+
const row = db.prepare(`
|
|
2698
|
+
SELECT pg_get_constraintdef(constraint_row.oid) AS definition
|
|
2699
|
+
FROM pg_constraint constraint_row
|
|
2700
|
+
JOIN pg_class table_row ON table_row.oid = constraint_row.conrelid
|
|
2701
|
+
WHERE table_row.relname = 'workflow_execution_events'
|
|
2702
|
+
AND constraint_row.conname = 'workflow_execution_events_event_type_check'
|
|
2703
|
+
LIMIT 1
|
|
2704
|
+
`).get();
|
|
2705
|
+
if (String(row?.definition || '').includes('step-completed'))
|
|
2706
|
+
return;
|
|
2707
|
+
db.exec(`
|
|
2708
|
+
ALTER TABLE workflow_execution_events
|
|
2709
|
+
DROP CONSTRAINT IF EXISTS workflow_execution_events_event_type_check;
|
|
2710
|
+
ALTER TABLE workflow_execution_events
|
|
2711
|
+
ADD CONSTRAINT workflow_execution_events_event_type_check CHECK (event_type IN (
|
|
2712
|
+
'execution-created', 'execution-started', 'execution-paused',
|
|
2713
|
+
'execution-resumed', 'execution-completed', 'execution-failed', 'execution-ended',
|
|
2714
|
+
'step-completed', 'step-started'
|
|
2715
|
+
));
|
|
2716
|
+
`);
|
|
2717
|
+
return;
|
|
2718
|
+
}
|
|
2719
|
+
const table = db.prepare(`
|
|
2720
|
+
SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'workflow_execution_events'
|
|
2721
|
+
`).get();
|
|
2722
|
+
if (String(table?.sql || '').includes('step-completed'))
|
|
2723
|
+
return;
|
|
2724
|
+
db.transaction(() => db.exec(`
|
|
2725
|
+
DROP TRIGGER IF EXISTS trg_workflow_execution_events_no_update;
|
|
2726
|
+
DROP TRIGGER IF EXISTS trg_workflow_execution_events_no_delete;
|
|
2727
|
+
ALTER TABLE workflow_execution_events RENAME TO workflow_execution_events_legacy;
|
|
2728
|
+
CREATE TABLE workflow_execution_events (
|
|
2729
|
+
id TEXT PRIMARY KEY,
|
|
2730
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
2731
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
2732
|
+
workflow_execution_id TEXT NOT NULL,
|
|
2733
|
+
sequence_number INTEGER NOT NULL CHECK (sequence_number >= 0),
|
|
2734
|
+
event_type TEXT NOT NULL CHECK (event_type IN (
|
|
2735
|
+
'execution-created', 'execution-started', 'execution-paused',
|
|
2736
|
+
'execution-resumed', 'execution-completed', 'execution-failed', 'execution-ended',
|
|
2737
|
+
'step-completed', 'step-started'
|
|
2738
|
+
)),
|
|
2739
|
+
from_status TEXT CHECK (from_status IS NULL OR from_status IN ('pending', 'running', 'paused', 'completed', 'failed', 'ended')),
|
|
2740
|
+
to_status TEXT NOT NULL CHECK (to_status IN ('pending', 'running', 'paused', 'completed', 'failed', 'ended')),
|
|
2741
|
+
step_id TEXT,
|
|
2742
|
+
actor_id TEXT NOT NULL,
|
|
2743
|
+
idempotency_key TEXT,
|
|
2744
|
+
details_json TEXT NOT NULL DEFAULT '{}',
|
|
2745
|
+
created_at TEXT NOT NULL,
|
|
2746
|
+
FOREIGN KEY (workflow_execution_id) REFERENCES workflow_executions(id) ON DELETE RESTRICT
|
|
2747
|
+
);
|
|
2748
|
+
INSERT INTO workflow_execution_events (
|
|
2749
|
+
id, tenant_id, workspace_id, workflow_execution_id, sequence_number, event_type,
|
|
2750
|
+
from_status, to_status, step_id, actor_id, idempotency_key, details_json, created_at
|
|
2751
|
+
) SELECT
|
|
2752
|
+
id, tenant_id, workspace_id, workflow_execution_id, sequence_number, event_type,
|
|
2753
|
+
from_status, to_status, step_id, actor_id, idempotency_key, details_json, created_at
|
|
2754
|
+
FROM workflow_execution_events_legacy;
|
|
2755
|
+
DROP TABLE workflow_execution_events_legacy;
|
|
2756
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_execution_events_execution
|
|
2757
|
+
ON workflow_execution_events(tenant_id, workspace_id, workflow_execution_id, sequence_number);
|
|
2758
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workflow_execution_events_sequence
|
|
2759
|
+
ON workflow_execution_events(tenant_id, workspace_id, workflow_execution_id, sequence_number);
|
|
2760
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_workflow_execution_events_idempotency
|
|
2761
|
+
ON workflow_execution_events(tenant_id, workspace_id, workflow_execution_id, idempotency_key)
|
|
2762
|
+
WHERE idempotency_key IS NOT NULL;
|
|
2763
|
+
`))();
|
|
2764
|
+
}
|
|
1038
2765
|
export function ensureDocumentReviewSessionsSchema(db) {
|
|
1039
2766
|
db.exec(`
|
|
1040
2767
|
CREATE TABLE IF NOT EXISTS document_review_sessions (
|
|
@@ -1067,6 +2794,13 @@ export function ensureDocumentReviewSessionsSchema(db) {
|
|
|
1067
2794
|
body TEXT NOT NULL,
|
|
1068
2795
|
anchor_json TEXT,
|
|
1069
2796
|
author_actor_id TEXT,
|
|
2797
|
+
updated_by_actor_id TEXT,
|
|
2798
|
+
deleted_by_actor_id TEXT,
|
|
2799
|
+
parent_comment_id TEXT,
|
|
2800
|
+
thread_status TEXT,
|
|
2801
|
+
thread_status_updated_at TEXT,
|
|
2802
|
+
resolved_at TEXT,
|
|
2803
|
+
resolved_by_actor_id TEXT,
|
|
1070
2804
|
order_index INTEGER NOT NULL DEFAULT 0,
|
|
1071
2805
|
created_at TEXT NOT NULL,
|
|
1072
2806
|
updated_at TEXT NOT NULL,
|
|
@@ -1078,6 +2812,56 @@ export function ensureDocumentReviewSessionsSchema(db) {
|
|
|
1078
2812
|
CREATE INDEX IF NOT EXISTS idx_document_review_comments_workspace
|
|
1079
2813
|
ON document_review_comments(tenant_id, workspace_id, updated_at, id);
|
|
1080
2814
|
`);
|
|
2815
|
+
const commentColumnNames = db.provider === 'postgres'
|
|
2816
|
+
? new Set(db.prepare(`
|
|
2817
|
+
SELECT column_name AS name
|
|
2818
|
+
FROM information_schema.columns
|
|
2819
|
+
WHERE table_schema = current_schema()
|
|
2820
|
+
AND table_name = 'document_review_comments'
|
|
2821
|
+
`).all().map((column) => column.name))
|
|
2822
|
+
: new Set(db.prepare(`PRAGMA table_info(document_review_comments)`).all().map((column) => column.name));
|
|
2823
|
+
const addCommentColumn = (name) => {
|
|
2824
|
+
const ifNotExists = db.provider === 'postgres' ? ' IF NOT EXISTS' : '';
|
|
2825
|
+
db.exec(`ALTER TABLE document_review_comments ADD COLUMN${ifNotExists} ${name} TEXT`);
|
|
2826
|
+
};
|
|
2827
|
+
if (!commentColumnNames.has('updated_by_actor_id')) {
|
|
2828
|
+
addCommentColumn('updated_by_actor_id');
|
|
2829
|
+
}
|
|
2830
|
+
if (!commentColumnNames.has('deleted_by_actor_id')) {
|
|
2831
|
+
addCommentColumn('deleted_by_actor_id');
|
|
2832
|
+
}
|
|
2833
|
+
if (!commentColumnNames.has('parent_comment_id')) {
|
|
2834
|
+
addCommentColumn('parent_comment_id');
|
|
2835
|
+
}
|
|
2836
|
+
if (!commentColumnNames.has('thread_status')) {
|
|
2837
|
+
addCommentColumn('thread_status');
|
|
2838
|
+
}
|
|
2839
|
+
if (!commentColumnNames.has('thread_status_updated_at')) {
|
|
2840
|
+
addCommentColumn('thread_status_updated_at');
|
|
2841
|
+
}
|
|
2842
|
+
if (!commentColumnNames.has('resolved_at')) {
|
|
2843
|
+
addCommentColumn('resolved_at');
|
|
2844
|
+
}
|
|
2845
|
+
if (!commentColumnNames.has('resolved_by_actor_id')) {
|
|
2846
|
+
addCommentColumn('resolved_by_actor_id');
|
|
2847
|
+
}
|
|
2848
|
+
db.exec(`
|
|
2849
|
+
UPDATE document_review_comments
|
|
2850
|
+
SET updated_by_actor_id = author_actor_id
|
|
2851
|
+
WHERE updated_by_actor_id IS NULL
|
|
2852
|
+
AND author_actor_id IS NOT NULL
|
|
2853
|
+
`);
|
|
2854
|
+
db.exec(`
|
|
2855
|
+
UPDATE document_review_comments
|
|
2856
|
+
SET thread_status = 'open',
|
|
2857
|
+
thread_status_updated_at = COALESCE(thread_status_updated_at, updated_at, created_at)
|
|
2858
|
+
WHERE parent_comment_id IS NULL
|
|
2859
|
+
AND (thread_status IS NULL OR thread_status = '')
|
|
2860
|
+
`);
|
|
2861
|
+
db.exec(`
|
|
2862
|
+
CREATE INDEX IF NOT EXISTS idx_document_review_comments_parent
|
|
2863
|
+
ON document_review_comments(tenant_id, workspace_id, session_id, parent_comment_id, deleted_at, order_index, created_at, id)
|
|
2864
|
+
`);
|
|
1081
2865
|
const sessionRows = db.prepare(`
|
|
1082
2866
|
SELECT
|
|
1083
2867
|
id,
|
|
@@ -1104,11 +2888,13 @@ export function ensureDocumentReviewSessionsSchema(db) {
|
|
|
1104
2888
|
body,
|
|
1105
2889
|
anchor_json,
|
|
1106
2890
|
author_actor_id,
|
|
2891
|
+
updated_by_actor_id,
|
|
2892
|
+
deleted_by_actor_id,
|
|
1107
2893
|
order_index,
|
|
1108
2894
|
created_at,
|
|
1109
2895
|
updated_at,
|
|
1110
2896
|
deleted_at
|
|
1111
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
2897
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
1112
2898
|
`);
|
|
1113
2899
|
for (const row of sessionRows) {
|
|
1114
2900
|
const sessionId = String(row.id || '').trim();
|
|
@@ -1137,13 +2923,20 @@ export function ensureDocumentReviewSessionsSchema(db) {
|
|
|
1137
2923
|
const anchorJson = record.anchor && typeof record.anchor === 'object' ? JSON.stringify(record.anchor) : null;
|
|
1138
2924
|
const rawOrder = Number(record.order);
|
|
1139
2925
|
const orderIndex = Number.isFinite(rawOrder) ? Math.max(0, Math.floor(rawOrder)) : index;
|
|
1140
|
-
insertComment.run(commentId, sessionId, tenantId, workspaceId, body, anchorJson, String(record.authorActorId || '').trim() || null, orderIndex, createdAt, updatedAt, String(record.deletedAt || '').trim() || null);
|
|
2926
|
+
insertComment.run(commentId, sessionId, tenantId, workspaceId, body, anchorJson, String(record.authorActorId || '').trim() || null, String(record.updatedByActorId || record.authorActorId || '').trim() || null, String(record.deletedByActorId || '').trim() || null, orderIndex, createdAt, updatedAt, String(record.deletedAt || '').trim() || null);
|
|
1141
2927
|
}
|
|
1142
2928
|
}
|
|
1143
2929
|
catch {
|
|
1144
2930
|
continue;
|
|
1145
2931
|
}
|
|
1146
2932
|
}
|
|
2933
|
+
db.exec(`
|
|
2934
|
+
UPDATE document_review_comments
|
|
2935
|
+
SET thread_status = 'open',
|
|
2936
|
+
thread_status_updated_at = COALESCE(thread_status_updated_at, updated_at, created_at)
|
|
2937
|
+
WHERE parent_comment_id IS NULL
|
|
2938
|
+
AND (thread_status IS NULL OR thread_status = '')
|
|
2939
|
+
`);
|
|
1147
2940
|
if (hasTable(db, 'workspace_memberships') && hasTable(db, 'users')) {
|
|
1148
2941
|
const anonymousComments = db.prepare(`
|
|
1149
2942
|
SELECT DISTINCT tenant_id, workspace_id
|