@taskforcehq/taskforce 0.3.324 → 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 +2191 -540
- 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 +257 -151
- 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 +11 -12
- 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 +1684 -620
- 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 +62 -51
- package/dist/components/views/panels/PlanningDrawer.js +993 -314
- package/dist/components/views/planningScope.d.ts +4 -0
- package/dist/components/views/planningScope.js +12 -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 +516 -252
- 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 +1106 -396
- 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 +42 -6
- package/dist/hooks/workspace/workspaceLocalState.js +213 -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 -40
- 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 +104 -53
- package/dist/mcp/clientRegistry.d.ts +30 -0
- package/dist/mcp/clientRegistry.js +134 -0
- package/dist/mcp/collaborationRegistrar.js +21 -7
- package/dist/mcp/documentAssetRegistrar.js +227 -107
- package/dist/mcp/documentContentCommand.d.ts +94 -0
- package/dist/mcp/documentContentCommand.js +226 -0
- package/dist/mcp/documentHelpers.d.ts +14 -59
- package/dist/mcp/documentHelpers.js +52 -61
- 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 +86 -1
- package/dist/mcp/runtime.js +4562 -2270
- 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 +253 -101
- 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 +18 -0
- package/dist/mcp/toolProfiles.js +79 -0
- package/dist/mcp/toolRegistry.d.ts +102 -609
- package/dist/mcp/toolRegistry.js +108 -88
- 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/shared/taxonomyLibrary.js +1 -1
- 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 +596 -4
- 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 +2 -4
- 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/theme.js +1 -1
- 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 -37
- 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 -110
- package/dist/resources/templates/workflows/do.yaml +0 -88
- package/dist/resources/templates/workflows/evaluate.yaml +0 -117
- package/dist/resources/templates/workflows/execute.yaml +0 -159
- package/dist/resources/templates/workflows/plan.yaml +0 -119
- package/dist/resources/templates/workflows/review.yaml +0 -115
- 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-DvkbUHi0.js +0 -1
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-BVKew-mH.css +0 -1
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-jhOhxqHT.js +0 -3
- package/dist/ui/assets/ContextAttachmentManager-BAmEyLHL.js +0 -3
- package/dist/ui/assets/DocumentWorkspace-D4rJKXzd.css +0 -1
- package/dist/ui/assets/DocumentWorkspace-X-CpD5OO.js +0 -252
- package/dist/ui/assets/EntityActivityTimeline-DD33onAC.js +0 -1
- package/dist/ui/assets/EntityActivityTimeline-DyqvvhuF.css +0 -1
- package/dist/ui/assets/InitiativesModule-5nDXtIjf.js +0 -1
- package/dist/ui/assets/PlansPage-B8nDR1hQ.js +0 -1
- package/dist/ui/assets/PlansPage-DeAzWYTb.css +0 -1
- package/dist/ui/assets/TaskContextUpload-DrGrXJHm.js +0 -1
- package/dist/ui/assets/TaskSettings-BXVvZZwH.js +0 -9
- package/dist/ui/assets/WorkflowsModule-DWCGhEWT.js +0 -5
- package/dist/ui/assets/documentReferences-Crup321p.js +0 -1
- package/dist/ui/assets/index-B9k24Aym.js +0 -5
- package/dist/ui/assets/index-DNeR5dYW.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 -110
- package/src/resources/templates/workflows/do.yaml +0 -88
- package/src/resources/templates/workflows/evaluate.yaml +0 -117
- package/src/resources/templates/workflows/execute.yaml +0 -159
- package/src/resources/templates/workflows/plan.yaml +0 -119
- package/src/resources/templates/workflows/review.yaml +0 -115
- /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,72 +1,389 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { createHash, randomUUID } from 'crypto';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { listReferencedAiProfileAvatarAssetPaths } from './aiProfileAvatarSyncPaths.js';
|
|
5
|
+
import { normalizeCanonicalAssetKind } from '../utils/canonicalAssetKind.js';
|
|
6
|
+
import { WorkspaceSyncContentVersionStore } from './engine/workspaceSyncContentVersionStore.js';
|
|
7
|
+
import { WorkspaceSyncPublishedContentResolver, verifyWorkspaceSyncPublishedContentBody, } from './engine/workspaceSyncPublishedContentResolver.js';
|
|
8
|
+
import { compareWorkspaceMutationOrdering } from './workspaceSyncSurface.js';
|
|
9
|
+
import { publishWorkspaceSyncLocalFileAtomically, WorkspaceSyncAtomicLocalPublicationError, } from './engine/workspaceSyncAtomicLocalPublisher.js';
|
|
10
|
+
const referencedAvatarFingerprintCache = new Map();
|
|
11
|
+
const publishedContentResolverCache = new WeakMap();
|
|
12
|
+
const localFileFingerprintCache = new Map();
|
|
13
|
+
function fingerprintLocalFile(absolutePath) {
|
|
14
|
+
if (!fs.existsSync(absolutePath))
|
|
7
15
|
return null;
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
16
|
+
const stat = fs.statSync(absolutePath);
|
|
17
|
+
if (!stat.isFile())
|
|
10
18
|
return null;
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
const cached = localFileFingerprintCache.get(absolutePath);
|
|
20
|
+
if (cached && cached.sizeBytes === stat.size && cached.mtimeMs === stat.mtimeMs && cached.ctimeMs === stat.ctimeMs) {
|
|
21
|
+
return { contentSha256: cached.contentSha256, sizeBytes: cached.sizeBytes };
|
|
13
22
|
}
|
|
14
|
-
|
|
23
|
+
const content = fs.readFileSync(absolutePath);
|
|
24
|
+
const fingerprint = {
|
|
25
|
+
contentSha256: createHash('sha256').update(content).digest('hex'),
|
|
26
|
+
sizeBytes: content.length,
|
|
27
|
+
mtimeMs: stat.mtimeMs,
|
|
28
|
+
ctimeMs: stat.ctimeMs,
|
|
29
|
+
};
|
|
30
|
+
localFileFingerprintCache.set(absolutePath, fingerprint);
|
|
31
|
+
return { contentSha256: fingerprint.contentSha256, sizeBytes: fingerprint.sizeBytes };
|
|
32
|
+
}
|
|
33
|
+
function getPublishedContentResolver(deps) {
|
|
34
|
+
if (deps.publishedContentResolver)
|
|
35
|
+
return deps.publishedContentResolver;
|
|
36
|
+
const core = deps.core;
|
|
37
|
+
const cacheKey = core;
|
|
38
|
+
const cached = publishedContentResolverCache.get(cacheKey);
|
|
39
|
+
if (cached)
|
|
40
|
+
return cached;
|
|
41
|
+
const resolver = new WorkspaceSyncPublishedContentResolver(new WorkspaceSyncContentVersionStore(core.getDatabaseAdapter()));
|
|
42
|
+
publishedContentResolverCache.set(cacheKey, resolver);
|
|
43
|
+
return resolver;
|
|
44
|
+
}
|
|
45
|
+
function resolvePublishedContent(deps, input) {
|
|
46
|
+
return getPublishedContentResolver(deps).resolve({
|
|
47
|
+
tenantId: deps.core.getTenantId(),
|
|
48
|
+
...input,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function publishedContentIdentity(content) {
|
|
52
|
+
return content.source === 'versioned'
|
|
53
|
+
? `version:${content.versionId}`
|
|
54
|
+
: `legacy:${content.storageProvider}:${content.physicalKey}`;
|
|
55
|
+
}
|
|
56
|
+
async function readPublishedContentBuffer(deps, basePath, content, label) {
|
|
57
|
+
let buffer = null;
|
|
58
|
+
let stat = null;
|
|
59
|
+
if (content.storageProvider === 'r2') {
|
|
60
|
+
const objectStorageClient = deps.getObjectStorageClient();
|
|
61
|
+
if (!objectStorageClient)
|
|
62
|
+
return null;
|
|
63
|
+
buffer = (await objectStorageClient.getObject(content.physicalKey))?.body || null;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const root = path.resolve(basePath);
|
|
67
|
+
const absolutePath = path.resolve(root, content.physicalKey);
|
|
68
|
+
if (absolutePath === root || !absolutePath.startsWith(`${root}${path.sep}`))
|
|
69
|
+
return null;
|
|
70
|
+
if (!fs.existsSync(absolutePath))
|
|
71
|
+
return null;
|
|
72
|
+
stat = fs.statSync(absolutePath);
|
|
73
|
+
if (!stat.isFile())
|
|
74
|
+
return null;
|
|
75
|
+
buffer = fs.readFileSync(absolutePath);
|
|
76
|
+
}
|
|
77
|
+
if (!buffer)
|
|
15
78
|
return null;
|
|
79
|
+
if (content.source === 'versioned') {
|
|
80
|
+
verifyWorkspaceSyncPublishedContentBody(buffer, content, label);
|
|
16
81
|
}
|
|
82
|
+
return { buffer, stat };
|
|
17
83
|
}
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
84
|
+
async function readReferencedAvatarBuffer(deps, basePath, content, label) {
|
|
85
|
+
const primary = await readPublishedContentBuffer(deps, basePath, content, label);
|
|
86
|
+
if (primary?.buffer)
|
|
87
|
+
return primary.buffer;
|
|
88
|
+
if (content.source !== 'legacy' || content.storageProvider !== 'r2')
|
|
89
|
+
return null;
|
|
90
|
+
return (await readPublishedContentBuffer(deps, basePath, {
|
|
91
|
+
...content,
|
|
92
|
+
storageProvider: 'local',
|
|
93
|
+
}, label))?.buffer || null;
|
|
22
94
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
95
|
+
function publishedContentAvailable(basePath, content) {
|
|
96
|
+
if (content.storageProvider === 'r2') {
|
|
97
|
+
return {
|
|
98
|
+
contentSha256: content.source === 'versioned' ? content.contentSha256 : '',
|
|
99
|
+
sizeBytes: content.source === 'versioned' ? content.sizeBytes : 0,
|
|
100
|
+
contentAvailable: content.source === 'versioned',
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const root = path.resolve(basePath);
|
|
104
|
+
const absolutePath = path.resolve(root, content.physicalKey);
|
|
105
|
+
if (absolutePath === root || !absolutePath.startsWith(`${root}${path.sep}`)) {
|
|
106
|
+
return { contentSha256: '', sizeBytes: 0, contentAvailable: false };
|
|
107
|
+
}
|
|
108
|
+
if (content.source === 'versioned') {
|
|
109
|
+
if (!fs.existsSync(absolutePath)) {
|
|
110
|
+
return { contentSha256: '', sizeBytes: 0, contentAvailable: false };
|
|
111
|
+
}
|
|
112
|
+
const stat = fs.statSync(absolutePath);
|
|
113
|
+
return stat.isFile() && stat.size === content.sizeBytes
|
|
114
|
+
? {
|
|
115
|
+
contentSha256: content.contentSha256,
|
|
116
|
+
sizeBytes: content.sizeBytes,
|
|
117
|
+
contentAvailable: true,
|
|
118
|
+
}
|
|
119
|
+
: { contentSha256: '', sizeBytes: 0, contentAvailable: false };
|
|
120
|
+
}
|
|
121
|
+
const fingerprint = fingerprintLocalFile(absolutePath);
|
|
122
|
+
if (!fingerprint)
|
|
123
|
+
return { contentSha256: '', sizeBytes: 0, contentAvailable: false };
|
|
124
|
+
return {
|
|
125
|
+
contentSha256: fingerprint.contentSha256,
|
|
126
|
+
sizeBytes: fingerprint.sizeBytes,
|
|
127
|
+
contentAvailable: true,
|
|
128
|
+
};
|
|
34
129
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
130
|
+
function compareWorkspaceSyncContentCursor(left, right) {
|
|
131
|
+
if (left.u !== right.u)
|
|
132
|
+
return left.u < right.u ? -1 : 1;
|
|
133
|
+
return Buffer.compare(Buffer.from(left.id, 'utf8'), Buffer.from(right.id, 'utf8'));
|
|
38
134
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
135
|
+
export function readWorkspaceSyncContentFrontier(deps, workspaceId = 'default') {
|
|
136
|
+
if (!deps.workspaceAssetStore) {
|
|
137
|
+
const avatars = listReferencedAiProfileAvatarAssets(deps, workspaceId);
|
|
138
|
+
let avatarFrontier = null;
|
|
139
|
+
for (const [assetPath, metadata] of avatars) {
|
|
140
|
+
const candidate = { u: metadata.updatedAt, id: `asset:${assetPath}` };
|
|
141
|
+
if (Number.isFinite(Date.parse(candidate.u))
|
|
142
|
+
&& (!avatarFrontier || compareWorkspaceSyncContentCursor(candidate, avatarFrontier) > 0))
|
|
143
|
+
avatarFrontier = candidate;
|
|
144
|
+
}
|
|
145
|
+
return avatarFrontier;
|
|
146
|
+
}
|
|
147
|
+
const assets = deps.workspaceAssetStore.listAllNormalizedByWorkspace(workspaceId, {
|
|
148
|
+
includeDeleted: true,
|
|
149
|
+
});
|
|
150
|
+
const linksByAssetId = groupWorkspaceAssetLinksByAssetId(deps.workspaceAssetStore, workspaceId);
|
|
151
|
+
const referencedAvatarAssets = listReferencedAiProfileAvatarAssets(deps, workspaceId);
|
|
152
|
+
const activeBinaryAssetPaths = new Set();
|
|
153
|
+
let frontier = null;
|
|
154
|
+
const include = (candidate) => {
|
|
155
|
+
if (Number.isFinite(Date.parse(candidate.u))
|
|
156
|
+
&& candidate.id.length > 0
|
|
157
|
+
&& (!frontier || compareWorkspaceSyncContentCursor(candidate, frontier) > 0))
|
|
158
|
+
frontier = candidate;
|
|
159
|
+
};
|
|
160
|
+
for (const asset of assets) {
|
|
161
|
+
const rawPath = String(asset.storageKey || '').trim();
|
|
162
|
+
const isDocument = asset.kind === 'document';
|
|
163
|
+
const normalizedPath = isDocument
|
|
164
|
+
? deps.normalizeWorkspaceSyncDocumentPath(rawPath)
|
|
165
|
+
: deps.normalizeTaskDataRelativePath(rawPath);
|
|
166
|
+
if (!normalizedPath)
|
|
167
|
+
continue;
|
|
168
|
+
const isReplicatedBinaryAsset = (asset.kind === 'image' || asset.kind === 'file')
|
|
169
|
+
&& asset.storageProvider !== 'external';
|
|
170
|
+
if (!isDocument && !isReplicatedBinaryAsset)
|
|
171
|
+
continue;
|
|
172
|
+
if (asset.deletedAt) {
|
|
173
|
+
if (!isDocument && referencedAvatarAssets.has(normalizedPath))
|
|
51
174
|
continue;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
originalFilename: path.basename(assetPath),
|
|
56
|
-
mimeType: inferBinaryAssetMimeType(assetPath)
|
|
175
|
+
include({
|
|
176
|
+
u: String(asset.deletedAt).trim(),
|
|
177
|
+
id: `${isDocument ? 'doc-delete' : 'asset-delete'}:${normalizedPath}:${String(asset.assetId || '').trim()}`,
|
|
57
178
|
});
|
|
179
|
+
continue;
|
|
58
180
|
}
|
|
181
|
+
const { effectiveUpdatedAt } = resolveCanonicalAssetSyncLinkStateFromLinks(asset, linksByAssetId.get(asset.assetId) || []);
|
|
182
|
+
include({
|
|
183
|
+
u: effectiveUpdatedAt,
|
|
184
|
+
id: `${isDocument ? 'doc' : 'asset'}:${isDocument ? normalizedPath : rawPath}`,
|
|
185
|
+
});
|
|
186
|
+
if (!isDocument)
|
|
187
|
+
activeBinaryAssetPaths.add(rawPath);
|
|
59
188
|
}
|
|
60
|
-
|
|
189
|
+
for (const [assetPath, metadata] of referencedAvatarAssets) {
|
|
190
|
+
if (activeBinaryAssetPaths.has(assetPath))
|
|
191
|
+
continue;
|
|
192
|
+
include({ u: metadata.updatedAt, id: `asset:${assetPath}` });
|
|
193
|
+
}
|
|
194
|
+
return frontier;
|
|
195
|
+
}
|
|
196
|
+
export function hasWorkspaceSyncContentAfter(deps, workspaceId, cursor) {
|
|
197
|
+
if (!cursor)
|
|
198
|
+
return true;
|
|
199
|
+
const db = deps.core.getDatabaseAdapter();
|
|
200
|
+
const tenantId = deps.core.getTenantId();
|
|
201
|
+
const threshold = cursor.u;
|
|
202
|
+
const rows = db.prepare(`
|
|
203
|
+
SELECT
|
|
204
|
+
asset.asset_id,
|
|
205
|
+
asset.kind,
|
|
206
|
+
asset.storage_provider,
|
|
207
|
+
asset.storage_key,
|
|
208
|
+
asset.original_filename,
|
|
209
|
+
asset.mime_type,
|
|
210
|
+
asset.deleted_at,
|
|
211
|
+
CASE
|
|
212
|
+
WHEN asset.deleted_at IS NOT NULL THEN asset.deleted_at
|
|
213
|
+
WHEN COALESCE((
|
|
214
|
+
SELECT MAX(CASE
|
|
215
|
+
WHEN link.updated_at > link.created_at THEN link.updated_at
|
|
216
|
+
ELSE link.created_at
|
|
217
|
+
END)
|
|
218
|
+
FROM workspace_asset_links link
|
|
219
|
+
WHERE link.tenant_id = asset.tenant_id
|
|
220
|
+
AND link.workspace_id = asset.workspace_id
|
|
221
|
+
AND link.asset_id = asset.asset_id
|
|
222
|
+
), '') > COALESCE(asset.updated_at, asset.created_at, '')
|
|
223
|
+
THEN (
|
|
224
|
+
SELECT MAX(CASE
|
|
225
|
+
WHEN link.updated_at > link.created_at THEN link.updated_at
|
|
226
|
+
ELSE link.created_at
|
|
227
|
+
END)
|
|
228
|
+
FROM workspace_asset_links link
|
|
229
|
+
WHERE link.tenant_id = asset.tenant_id
|
|
230
|
+
AND link.workspace_id = asset.workspace_id
|
|
231
|
+
AND link.asset_id = asset.asset_id
|
|
232
|
+
)
|
|
233
|
+
ELSE COALESCE(asset.updated_at, asset.created_at, '')
|
|
234
|
+
END AS effective_updated_at
|
|
235
|
+
FROM workspace_assets asset
|
|
236
|
+
WHERE asset.tenant_id = ?
|
|
237
|
+
AND asset.workspace_id = ?
|
|
238
|
+
AND (
|
|
239
|
+
asset.kind = 'document'
|
|
240
|
+
OR (
|
|
241
|
+
asset.kind IN ('image', 'file')
|
|
242
|
+
AND asset.storage_provider <> 'external'
|
|
243
|
+
)
|
|
244
|
+
)
|
|
245
|
+
AND (
|
|
246
|
+
COALESCE(asset.deleted_at, asset.updated_at, asset.created_at, '') >= ?
|
|
247
|
+
OR EXISTS (
|
|
248
|
+
SELECT 1
|
|
249
|
+
FROM workspace_asset_links changed_link
|
|
250
|
+
WHERE changed_link.tenant_id = asset.tenant_id
|
|
251
|
+
AND changed_link.workspace_id = asset.workspace_id
|
|
252
|
+
AND changed_link.asset_id = asset.asset_id
|
|
253
|
+
AND (
|
|
254
|
+
changed_link.updated_at >= ?
|
|
255
|
+
OR changed_link.created_at >= ?
|
|
256
|
+
)
|
|
257
|
+
)
|
|
258
|
+
)
|
|
259
|
+
`).all(tenantId, workspaceId, threshold, threshold, threshold);
|
|
260
|
+
const referencedAvatarAssets = listReferencedAiProfileAvatarAssets(deps, workspaceId);
|
|
261
|
+
const isAfter = (candidate) => (Number.isFinite(Date.parse(candidate.u))
|
|
262
|
+
&& compareWorkspaceSyncContentCursor(candidate, cursor) > 0);
|
|
263
|
+
for (const row of rows) {
|
|
264
|
+
const kind = normalizeCanonicalAssetKind({
|
|
265
|
+
kind: String(row.kind || 'file'),
|
|
266
|
+
storageKey: String(row.storage_key || ''),
|
|
267
|
+
originalFilename: String(row.original_filename || ''),
|
|
268
|
+
mimeType: String(row.mime_type || ''),
|
|
269
|
+
});
|
|
270
|
+
const isDocument = kind === 'document';
|
|
271
|
+
const normalizedPath = isDocument
|
|
272
|
+
? deps.normalizeWorkspaceSyncDocumentPath(row.storage_key)
|
|
273
|
+
: deps.normalizeTaskDataRelativePath(String(row.storage_key || ''));
|
|
274
|
+
if (!normalizedPath)
|
|
275
|
+
continue;
|
|
276
|
+
const rawPath = String(row.storage_key || '').trim();
|
|
277
|
+
const deletedAt = String(row.deleted_at || '').trim();
|
|
278
|
+
if (deletedAt && !isDocument && referencedAvatarAssets.has(normalizedPath))
|
|
279
|
+
continue;
|
|
280
|
+
if (isAfter({
|
|
281
|
+
u: deletedAt || String(row.effective_updated_at || '').trim(),
|
|
282
|
+
id: deletedAt
|
|
283
|
+
? `${isDocument ? 'doc-delete' : 'asset-delete'}:${normalizedPath}:${String(row.asset_id || '').trim()}`
|
|
284
|
+
: `${isDocument ? 'doc' : 'asset'}:${isDocument ? normalizedPath : rawPath}`,
|
|
285
|
+
}))
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
const headRows = db.prepare(`
|
|
289
|
+
SELECT
|
|
290
|
+
head.kind,
|
|
291
|
+
head.logical_path,
|
|
292
|
+
head.source_updated_at,
|
|
293
|
+
asset.kind AS asset_kind,
|
|
294
|
+
asset.storage_provider,
|
|
295
|
+
asset.original_filename,
|
|
296
|
+
asset.mime_type
|
|
297
|
+
FROM workspace_sync_content_heads head
|
|
298
|
+
INNER JOIN workspace_assets asset
|
|
299
|
+
ON asset.tenant_id = head.tenant_id
|
|
300
|
+
AND asset.workspace_id = head.workspace_id
|
|
301
|
+
AND asset.storage_key = head.logical_path
|
|
302
|
+
WHERE head.tenant_id = ?
|
|
303
|
+
AND head.workspace_id = ?
|
|
304
|
+
AND head.deleted_at IS NULL
|
|
305
|
+
AND asset.deleted_at IS NULL
|
|
306
|
+
AND head.source_updated_at >= ?
|
|
307
|
+
`).all(tenantId, workspaceId, threshold);
|
|
308
|
+
for (const row of headRows) {
|
|
309
|
+
const normalizedKind = normalizeCanonicalAssetKind({
|
|
310
|
+
kind: String(row.asset_kind || 'file'),
|
|
311
|
+
storageKey: String(row.logical_path || ''),
|
|
312
|
+
originalFilename: String(row.original_filename || ''),
|
|
313
|
+
mimeType: String(row.mime_type || ''),
|
|
314
|
+
});
|
|
315
|
+
const isDocument = normalizedKind === 'document';
|
|
316
|
+
if (String(row.kind || '') !== (isDocument ? 'document' : 'asset')
|
|
317
|
+
|| (!isDocument && String(row.storage_provider || '') === 'external'))
|
|
318
|
+
continue;
|
|
319
|
+
const normalizedPath = isDocument
|
|
320
|
+
? deps.normalizeWorkspaceSyncDocumentPath(row.logical_path)
|
|
321
|
+
: deps.normalizeTaskDataRelativePath(String(row.logical_path || ''));
|
|
322
|
+
if (normalizedPath && isAfter({
|
|
323
|
+
u: String(row.source_updated_at || '').trim(),
|
|
324
|
+
id: `${isDocument ? 'doc' : 'asset'}:${isDocument ? normalizedPath : String(row.logical_path || '').trim()}`,
|
|
325
|
+
}))
|
|
326
|
+
return true;
|
|
327
|
+
}
|
|
328
|
+
for (const [assetPath, metadata] of referencedAvatarAssets) {
|
|
329
|
+
const canonicalAsset = deps.workspaceAssetStore?.getByStorageKey(assetPath, workspaceId);
|
|
330
|
+
if (canonicalAsset
|
|
331
|
+
&& !canonicalAsset.deletedAt
|
|
332
|
+
&& (canonicalAsset.kind === 'image' || canonicalAsset.kind === 'file')
|
|
333
|
+
&& canonicalAsset.storageProvider !== 'external')
|
|
334
|
+
continue;
|
|
335
|
+
if (isAfter({ u: metadata.updatedAt, id: `asset:${assetPath}` }))
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
function runWorkspaceSyncContentMetadataMutation(deps, input, apply) {
|
|
341
|
+
return deps.core.getDatabaseAdapter().transaction(() => {
|
|
342
|
+
new WorkspaceSyncContentVersionStore(deps.core.getDatabaseAdapter()).lockLogicalHead({
|
|
343
|
+
tenantId: deps.core.getTenantId(),
|
|
344
|
+
workspaceId: input.workspaceId,
|
|
345
|
+
kind: input.kind,
|
|
346
|
+
logicalPath: input.logicalPath,
|
|
347
|
+
}, input.updatedAt);
|
|
348
|
+
return apply();
|
|
349
|
+
})();
|
|
350
|
+
}
|
|
351
|
+
function newestDocumentMetadata(watermark, asset) {
|
|
352
|
+
if (!watermark) {
|
|
353
|
+
return asset
|
|
354
|
+
? { updatedAt: asset.updatedAt, contentHash: asset.contentSha256 }
|
|
355
|
+
: null;
|
|
356
|
+
}
|
|
357
|
+
if (!asset)
|
|
358
|
+
return watermark;
|
|
359
|
+
return compareWorkspaceMutationOrdering(asset.updatedAt, watermark.updatedAt, asset.contentSha256, watermark.contentHash) >= 0
|
|
360
|
+
? { updatedAt: asset.updatedAt, contentHash: asset.contentSha256 }
|
|
361
|
+
: watermark;
|
|
362
|
+
}
|
|
363
|
+
function hasPublishedWorkspaceSyncContentHead(deps, input) {
|
|
364
|
+
return Boolean(new WorkspaceSyncContentVersionStore(deps.core.getDatabaseAdapter()).getHead({
|
|
365
|
+
tenantId: deps.core.getTenantId(),
|
|
366
|
+
...input,
|
|
367
|
+
}));
|
|
368
|
+
}
|
|
369
|
+
function listReferencedAiProfileAvatarAssets(deps, workspaceId) {
|
|
370
|
+
const profiles = typeof deps.core.listAiProfiles === 'function'
|
|
371
|
+
? deps.core.listAiProfiles(workspaceId, { includeArchived: true })
|
|
372
|
+
: [];
|
|
373
|
+
return listReferencedAiProfileAvatarAssetPaths(profiles, workspaceId, deps.normalizeTaskDataRelativePath);
|
|
61
374
|
}
|
|
62
375
|
export function resolveCanonicalAssetSyncLinkState(deps, asset, workspaceId) {
|
|
63
376
|
if (!deps.workspaceAssetStore) {
|
|
64
377
|
return {
|
|
65
378
|
primaryLink: null,
|
|
379
|
+
activeLinks: [],
|
|
66
380
|
effectiveUpdatedAt: String(asset.updatedAt || asset.createdAt || '').trim() || new Date().toISOString()
|
|
67
381
|
};
|
|
68
382
|
}
|
|
69
383
|
const links = deps.workspaceAssetStore.listLinksForAsset(asset.assetId, workspaceId, { includeDeleted: true });
|
|
384
|
+
return resolveCanonicalAssetSyncLinkStateFromLinks(asset, links);
|
|
385
|
+
}
|
|
386
|
+
function resolveCanonicalAssetSyncLinkStateFromLinks(asset, links) {
|
|
70
387
|
const activeLinks = links.filter((entry) => !entry.deletedAt);
|
|
71
388
|
const primaryLink = activeLinks[0] || null;
|
|
72
389
|
let effectiveUpdatedAt = String(asset.updatedAt || asset.createdAt || '').trim() || new Date().toISOString();
|
|
@@ -75,7 +392,25 @@ export function resolveCanonicalAssetSyncLinkState(deps, asset, workspaceId) {
|
|
|
75
392
|
if (linkUpdatedAt && linkUpdatedAt > effectiveUpdatedAt)
|
|
76
393
|
effectiveUpdatedAt = linkUpdatedAt;
|
|
77
394
|
}
|
|
78
|
-
return { primaryLink, effectiveUpdatedAt };
|
|
395
|
+
return { primaryLink, activeLinks, effectiveUpdatedAt };
|
|
396
|
+
}
|
|
397
|
+
function groupWorkspaceAssetLinksByAssetId(store, workspaceId) {
|
|
398
|
+
const grouped = new Map();
|
|
399
|
+
for (const link of store.listLinksForWorkspace(workspaceId, { includeDeleted: true })) {
|
|
400
|
+
const current = grouped.get(link.assetId) || [];
|
|
401
|
+
current.push(link);
|
|
402
|
+
grouped.set(link.assetId, current);
|
|
403
|
+
}
|
|
404
|
+
return grouped;
|
|
405
|
+
}
|
|
406
|
+
function toSyncLinkPayloads(links) {
|
|
407
|
+
return links.map((link) => ({
|
|
408
|
+
targetType: link.targetType,
|
|
409
|
+
targetId: link.targetId,
|
|
410
|
+
role: link.role,
|
|
411
|
+
displayName: link.displayName,
|
|
412
|
+
updatedAt: link.updatedAt,
|
|
413
|
+
}));
|
|
79
414
|
}
|
|
80
415
|
function resolveSyncLinkTarget(primaryLink) {
|
|
81
416
|
if (!primaryLink)
|
|
@@ -105,7 +440,10 @@ export function getCanonicalSyncDocumentMetadata(deps, relativePath, workspaceId
|
|
|
105
440
|
const asset = deps.workspaceAssetStore.getByStorageKey(relativePath, workspaceId);
|
|
106
441
|
if (!asset || asset.kind !== 'document')
|
|
107
442
|
return {};
|
|
108
|
-
const { primaryLink } = resolveCanonicalAssetSyncLinkState(deps, asset, workspaceId);
|
|
443
|
+
const { primaryLink, activeLinks } = resolveCanonicalAssetSyncLinkState(deps, asset, workspaceId);
|
|
444
|
+
return getCanonicalSyncDocumentMetadataFromState(asset, primaryLink, activeLinks, relativePath);
|
|
445
|
+
}
|
|
446
|
+
function getCanonicalSyncDocumentMetadataFromState(asset, primaryLink, activeLinks, relativePath) {
|
|
109
447
|
const linkTarget = resolveSyncLinkTarget(primaryLink);
|
|
110
448
|
return {
|
|
111
449
|
assetId: asset.assetId,
|
|
@@ -118,15 +456,19 @@ export function getCanonicalSyncDocumentMetadata(deps, relativePath, workspaceId
|
|
|
118
456
|
logicalName: asset.logicalName || null,
|
|
119
457
|
caption: primaryLink?.displayName || null,
|
|
120
458
|
originalFilename: asset.originalFilename || path.basename(relativePath),
|
|
121
|
-
linkRole: primaryLink?.role === 'reference' ? 'reference' : 'attachment'
|
|
459
|
+
linkRole: primaryLink?.role === 'reference' ? 'reference' : 'attachment',
|
|
460
|
+
links: toSyncLinkPayloads(activeLinks),
|
|
122
461
|
};
|
|
123
462
|
}
|
|
124
463
|
export function hasDocumentSyncMetadataDrift(deps, workspaceId, doc) {
|
|
125
464
|
if (!deps.workspaceAssetStore)
|
|
126
465
|
return false;
|
|
127
466
|
const existingAsset = deps.workspaceAssetStore.getByStorageKey(doc.path, workspaceId);
|
|
467
|
+
const incomingAssetId = typeof doc.assetId === 'string' ? doc.assetId.trim() : '';
|
|
128
468
|
if (!existingAsset || existingAsset.kind !== 'document')
|
|
129
|
-
return
|
|
469
|
+
return Boolean(incomingAssetId);
|
|
470
|
+
if (incomingAssetId && existingAsset.assetId !== incomingAssetId)
|
|
471
|
+
return true;
|
|
130
472
|
const { primaryLink } = resolveCanonicalAssetSyncLinkState(deps, existingAsset, workspaceId);
|
|
131
473
|
const normalizedIncomingReference = Number.isFinite(Number(doc.referenceNumber))
|
|
132
474
|
? Math.max(1, Math.floor(Number(doc.referenceNumber)))
|
|
@@ -166,8 +508,11 @@ export function hasBinaryAssetSyncMetadataDrift(deps, workspaceId, asset) {
|
|
|
166
508
|
if (!deps.workspaceAssetStore)
|
|
167
509
|
return false;
|
|
168
510
|
const existingAsset = deps.workspaceAssetStore.getByStorageKey(asset.path, workspaceId);
|
|
511
|
+
const incomingAssetId = typeof asset.assetId === 'string' ? asset.assetId.trim() : '';
|
|
169
512
|
if (!existingAsset || (existingAsset.kind !== 'image' && existingAsset.kind !== 'file'))
|
|
170
|
-
return
|
|
513
|
+
return Boolean(incomingAssetId);
|
|
514
|
+
if (incomingAssetId && existingAsset.assetId !== incomingAssetId)
|
|
515
|
+
return true;
|
|
171
516
|
const { primaryLink } = resolveCanonicalAssetSyncLinkState(deps, existingAsset, workspaceId);
|
|
172
517
|
const normalizedIncomingReference = Number.isFinite(Number(asset.referenceNumber))
|
|
173
518
|
? Math.max(1, Math.floor(Number(asset.referenceNumber)))
|
|
@@ -218,8 +563,43 @@ export function reconcileWorkspaceSyncLinks(deps, input) {
|
|
|
218
563
|
: 'attachment';
|
|
219
564
|
const linkUpdatedAt = String(input.updatedAt || '').trim() || new Date().toISOString();
|
|
220
565
|
const existingLinks = deps.workspaceAssetStore.listLinksForAsset(assetId, workspaceId, { includeDeleted: true });
|
|
566
|
+
if (Array.isArray(input.links)) {
|
|
567
|
+
const desiredLinkKeys = new Set();
|
|
568
|
+
for (const link of input.links) {
|
|
569
|
+
const targetId = String(link.targetId || '').trim();
|
|
570
|
+
if (!targetId)
|
|
571
|
+
continue;
|
|
572
|
+
const key = `${link.targetType}:${targetId}:${link.role}`;
|
|
573
|
+
desiredLinkKeys.add(key);
|
|
574
|
+
deps.workspaceAssetStore.upsertLegacySyncLink({
|
|
575
|
+
workspaceId,
|
|
576
|
+
assetId,
|
|
577
|
+
targetType: link.targetType,
|
|
578
|
+
targetId,
|
|
579
|
+
role: link.role,
|
|
580
|
+
displayName: typeof link.displayName === 'string' && link.displayName.trim() ? link.displayName.trim() : null,
|
|
581
|
+
updatedAt: String(link.updatedAt || '').trim() || linkUpdatedAt,
|
|
582
|
+
deletedAt: null,
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
for (const link of existingLinks) {
|
|
586
|
+
if (link.deletedAt)
|
|
587
|
+
continue;
|
|
588
|
+
const key = `${link.targetType}:${link.targetId}:${link.role}`;
|
|
589
|
+
if (desiredLinkKeys.has(key))
|
|
590
|
+
continue;
|
|
591
|
+
deps.workspaceAssetStore.deleteLegacySyncLink({
|
|
592
|
+
workspaceId,
|
|
593
|
+
assetId,
|
|
594
|
+
targetType: link.targetType,
|
|
595
|
+
targetId: link.targetId,
|
|
596
|
+
role: link.role,
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
221
601
|
if (desiredLinkTarget) {
|
|
222
|
-
deps.workspaceAssetStore.
|
|
602
|
+
deps.workspaceAssetStore.upsertLegacySyncLink({
|
|
223
603
|
workspaceId,
|
|
224
604
|
assetId,
|
|
225
605
|
targetType: desiredLinkTarget.targetType,
|
|
@@ -239,7 +619,7 @@ export function reconcileWorkspaceSyncLinks(deps, input) {
|
|
|
239
619
|
}
|
|
240
620
|
if (link.deletedAt)
|
|
241
621
|
continue;
|
|
242
|
-
deps.workspaceAssetStore.
|
|
622
|
+
deps.workspaceAssetStore.deleteLegacySyncLink({
|
|
243
623
|
workspaceId,
|
|
244
624
|
assetId,
|
|
245
625
|
targetType: link.targetType,
|
|
@@ -298,25 +678,23 @@ export async function listWorkspaceSyncDocumentsSnapshot(deps, basePath, workspa
|
|
|
298
678
|
let stat = null;
|
|
299
679
|
let content = null;
|
|
300
680
|
let updatedAt = '';
|
|
681
|
+
let contentIdentity = `legacy:local:${relativePath}`;
|
|
301
682
|
if (canonicalAsset?.kind === 'document') {
|
|
302
683
|
updatedAt = resolveCanonicalAssetSyncLinkState(deps, canonicalAsset, workspaceId).effectiveUpdatedAt;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
continue;
|
|
318
|
-
content = fs.readFileSync(absPath, 'utf8');
|
|
319
|
-
}
|
|
684
|
+
const published = resolvePublishedContent(deps, {
|
|
685
|
+
workspaceId,
|
|
686
|
+
kind: 'document',
|
|
687
|
+
logicalPath: relativePath,
|
|
688
|
+
legacyProvider: canonicalAsset.storageProvider === 'r2' ? 'r2' : 'local',
|
|
689
|
+
});
|
|
690
|
+
if (published.source === 'deleted')
|
|
691
|
+
continue;
|
|
692
|
+
contentIdentity = publishedContentIdentity(published);
|
|
693
|
+
const read = await readPublishedContentBuffer(deps, root, published, `Workspace sync document ${relativePath}`);
|
|
694
|
+
if (!read)
|
|
695
|
+
continue;
|
|
696
|
+
stat = read.stat;
|
|
697
|
+
content = read.buffer.toString('utf8');
|
|
320
698
|
}
|
|
321
699
|
else {
|
|
322
700
|
const absPath = path.resolve(path.join(basePath, relativePath));
|
|
@@ -332,6 +710,7 @@ export async function listWorkspaceSyncDocumentsSnapshot(deps, basePath, workspa
|
|
|
332
710
|
continue;
|
|
333
711
|
const cached = workspaceCache.get(relativePath);
|
|
334
712
|
if (cached
|
|
713
|
+
&& cached.contentIdentity === contentIdentity
|
|
335
714
|
&& cached.size === Buffer.byteLength(content, 'utf8')
|
|
336
715
|
&& (canonicalAsset
|
|
337
716
|
? cached.updatedAt === updatedAt
|
|
@@ -374,6 +753,7 @@ export async function listWorkspaceSyncDocumentsSnapshot(deps, basePath, workspa
|
|
|
374
753
|
});
|
|
375
754
|
workspaceCache.set(relativePath, {
|
|
376
755
|
path: relativePath,
|
|
756
|
+
contentIdentity,
|
|
377
757
|
mtimeMs: stat?.mtimeMs ?? 0,
|
|
378
758
|
ctimeMs: stat?.ctimeMs ?? 0,
|
|
379
759
|
size: Buffer.byteLength(content, 'utf8'),
|
|
@@ -396,15 +776,22 @@ export async function listWorkspaceSyncDocumentsSnapshot(deps, basePath, workspa
|
|
|
396
776
|
return docs;
|
|
397
777
|
}
|
|
398
778
|
export async function listWorkspaceSyncDocumentIndex(deps, basePath, workspaceId = 'default') {
|
|
779
|
+
const canonicalAssetByRawPath = new Map();
|
|
399
780
|
const candidatePaths = new Set();
|
|
781
|
+
const linksByAssetId = deps.workspaceAssetStore
|
|
782
|
+
? groupWorkspaceAssetLinksByAssetId(deps.workspaceAssetStore, workspaceId)
|
|
783
|
+
: new Map();
|
|
400
784
|
// Keep the document index aligned with the snapshot invariant above: only
|
|
401
785
|
// canonical workspace document assets may participate in shared document sync.
|
|
402
786
|
if (deps.workspaceAssetStore) {
|
|
403
|
-
const canonicalAssets = deps.workspaceAssetStore.
|
|
787
|
+
const canonicalAssets = deps.workspaceAssetStore.listAllNormalizedByWorkspace(workspaceId, {
|
|
404
788
|
includeDeleted: false,
|
|
405
789
|
kind: 'document'
|
|
406
790
|
});
|
|
407
791
|
for (const asset of canonicalAssets) {
|
|
792
|
+
if (!canonicalAssetByRawPath.has(asset.storageKey)) {
|
|
793
|
+
canonicalAssetByRawPath.set(asset.storageKey, asset);
|
|
794
|
+
}
|
|
408
795
|
const normalized = deps.normalizeWorkspaceSyncDocumentPath(asset.storageKey);
|
|
409
796
|
if (normalized)
|
|
410
797
|
candidatePaths.add(normalized);
|
|
@@ -413,10 +800,34 @@ export async function listWorkspaceSyncDocumentIndex(deps, basePath, workspaceId
|
|
|
413
800
|
const docs = [];
|
|
414
801
|
for (const relativePath of Array.from(candidatePaths).sort((a, b) => a.localeCompare(b))) {
|
|
415
802
|
try {
|
|
416
|
-
const canonicalAsset =
|
|
803
|
+
const canonicalAsset = canonicalAssetByRawPath.get(relativePath);
|
|
417
804
|
let updatedAt = '';
|
|
805
|
+
let contentSha256 = '';
|
|
806
|
+
let sizeBytes = 0;
|
|
807
|
+
let contentAvailable = false;
|
|
808
|
+
const linkState = canonicalAsset?.kind === 'document'
|
|
809
|
+
? resolveCanonicalAssetSyncLinkStateFromLinks(canonicalAsset, linksByAssetId.get(canonicalAsset.assetId) || [])
|
|
810
|
+
: null;
|
|
418
811
|
if (canonicalAsset?.kind === 'document') {
|
|
419
|
-
updatedAt =
|
|
812
|
+
updatedAt = linkState.effectiveUpdatedAt;
|
|
813
|
+
const published = resolvePublishedContent(deps, {
|
|
814
|
+
workspaceId,
|
|
815
|
+
kind: 'document',
|
|
816
|
+
logicalPath: relativePath,
|
|
817
|
+
legacyProvider: canonicalAsset.storageProvider === 'r2' ? 'r2' : 'local',
|
|
818
|
+
});
|
|
819
|
+
if (published.source === 'deleted')
|
|
820
|
+
continue;
|
|
821
|
+
const availability = publishedContentAvailable(basePath, published);
|
|
822
|
+
contentSha256 = availability.contentSha256
|
|
823
|
+
|| String(canonicalAsset.contentSha256 || '').trim().toLowerCase();
|
|
824
|
+
sizeBytes = availability.contentAvailable
|
|
825
|
+
? availability.sizeBytes
|
|
826
|
+
: Math.max(0, Math.floor(Number(canonicalAsset.sizeBytes || 0)));
|
|
827
|
+
contentAvailable = availability.contentAvailable
|
|
828
|
+
|| (published.source === 'legacy'
|
|
829
|
+
&& published.storageProvider === 'r2'
|
|
830
|
+
&& contentSha256.length === 64);
|
|
420
831
|
}
|
|
421
832
|
else {
|
|
422
833
|
const absPath = path.resolve(path.join(basePath, relativePath));
|
|
@@ -431,13 +842,21 @@ export async function listWorkspaceSyncDocumentIndex(deps, basePath, workspaceId
|
|
|
431
842
|
const existing = deps.core.getDocumentWatermark(workspaceId, relativePath);
|
|
432
843
|
updatedAt = existing?.updatedAt
|
|
433
844
|
|| (Number.isFinite(stat.mtimeMs) ? new Date(stat.mtimeMs).toISOString() : new Date().toISOString());
|
|
845
|
+
contentSha256 = String(existing?.contentHash || '').trim().toLowerCase();
|
|
846
|
+
sizeBytes = stat.size;
|
|
847
|
+
contentAvailable = true;
|
|
434
848
|
}
|
|
435
849
|
if (!Number.isFinite(Date.parse(String(updatedAt || '').trim())))
|
|
436
850
|
continue;
|
|
437
851
|
docs.push({
|
|
438
852
|
path: relativePath,
|
|
439
853
|
updatedAt: String(updatedAt || '').trim(),
|
|
440
|
-
|
|
854
|
+
contentSha256,
|
|
855
|
+
sizeBytes,
|
|
856
|
+
contentAvailable,
|
|
857
|
+
...(canonicalAsset?.kind === 'document' && linkState
|
|
858
|
+
? getCanonicalSyncDocumentMetadataFromState(canonicalAsset, linkState.primaryLink, linkState.activeLinks, relativePath)
|
|
859
|
+
: {})
|
|
441
860
|
});
|
|
442
861
|
}
|
|
443
862
|
catch (error) {
|
|
@@ -470,35 +889,26 @@ export async function listWorkspaceSyncBinaryAssetsSnapshot(deps, basePath, work
|
|
|
470
889
|
continue;
|
|
471
890
|
emittedPaths.add(storageKey);
|
|
472
891
|
try {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
deps.recordSyncDiagnostic(workspaceId, 'push', 'Asset registered in DB but file missing from disk — skipped from sync payload.', {
|
|
484
|
-
source: 'assets.snapshot.missingFile',
|
|
485
|
-
assetId: asset.assetId,
|
|
486
|
-
path: storageKey
|
|
487
|
-
});
|
|
488
|
-
continue;
|
|
489
|
-
}
|
|
490
|
-
buffer = fs.readFileSync(absolutePath);
|
|
491
|
-
}
|
|
892
|
+
const published = resolvePublishedContent(deps, {
|
|
893
|
+
workspaceId,
|
|
894
|
+
kind: 'asset',
|
|
895
|
+
logicalPath: storageKey,
|
|
896
|
+
legacyProvider: asset.storageProvider === 'r2' ? 'r2' : 'local',
|
|
897
|
+
});
|
|
898
|
+
if (published.source === 'deleted')
|
|
899
|
+
continue;
|
|
900
|
+
const read = await readPublishedContentBuffer(deps, root, published, `Workspace sync binary asset ${storageKey}`);
|
|
901
|
+
const buffer = read?.buffer || null;
|
|
492
902
|
if (!buffer) {
|
|
493
903
|
deps.recordSyncDiagnostic(workspaceId, 'push', 'Asset registered in DB but content could not be read — skipped from sync payload.', {
|
|
494
904
|
source: 'assets.snapshot.emptyBuffer',
|
|
495
905
|
assetId: asset.assetId,
|
|
496
906
|
path: storageKey,
|
|
497
|
-
storageProvider:
|
|
907
|
+
storageProvider: published.storageProvider
|
|
498
908
|
});
|
|
499
909
|
continue;
|
|
500
910
|
}
|
|
501
|
-
const { primaryLink, effectiveUpdatedAt } = resolveCanonicalAssetSyncLinkState(deps, asset, workspaceId);
|
|
911
|
+
const { primaryLink, activeLinks, effectiveUpdatedAt } = resolveCanonicalAssetSyncLinkState(deps, asset, workspaceId);
|
|
502
912
|
const linkTarget = resolveSyncLinkTarget(primaryLink);
|
|
503
913
|
snapshots.push({
|
|
504
914
|
path: storageKey,
|
|
@@ -514,7 +924,8 @@ export async function listWorkspaceSyncBinaryAssetsSnapshot(deps, basePath, work
|
|
|
514
924
|
logicalName: asset.logicalName || null,
|
|
515
925
|
caption: primaryLink?.displayName || null,
|
|
516
926
|
originalFilename: asset.originalFilename || path.basename(storageKey),
|
|
517
|
-
linkRole: primaryLink?.role || (asset.kind === 'image' ? 'image' : 'attachment')
|
|
927
|
+
linkRole: primaryLink?.role || (asset.kind === 'image' ? 'image' : 'attachment'),
|
|
928
|
+
links: toSyncLinkPayloads(activeLinks),
|
|
518
929
|
});
|
|
519
930
|
}
|
|
520
931
|
catch (error) {
|
|
@@ -525,7 +936,7 @@ export async function listWorkspaceSyncBinaryAssetsSnapshot(deps, basePath, work
|
|
|
525
936
|
});
|
|
526
937
|
}
|
|
527
938
|
}
|
|
528
|
-
const referencedAiAvatarAssets =
|
|
939
|
+
const referencedAiAvatarAssets = listReferencedAiProfileAvatarAssets(deps, workspaceId);
|
|
529
940
|
for (const [assetPath, metadata] of referencedAiAvatarAssets.entries()) {
|
|
530
941
|
if (emittedPaths.has(assetPath))
|
|
531
942
|
continue;
|
|
@@ -533,14 +944,15 @@ export async function listWorkspaceSyncBinaryAssetsSnapshot(deps, basePath, work
|
|
|
533
944
|
if (absolutePath === root || !absolutePath.startsWith(`${root}${path.sep}`))
|
|
534
945
|
continue;
|
|
535
946
|
try {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
947
|
+
const published = resolvePublishedContent(deps, {
|
|
948
|
+
workspaceId,
|
|
949
|
+
kind: 'asset',
|
|
950
|
+
logicalPath: assetPath,
|
|
951
|
+
legacyProvider: objectStorageClient ? 'r2' : 'local',
|
|
952
|
+
});
|
|
953
|
+
if (published.source === 'deleted')
|
|
954
|
+
continue;
|
|
955
|
+
const buffer = await readReferencedAvatarBuffer(deps, root, published, `Workspace sync AI profile avatar ${assetPath}`);
|
|
544
956
|
if (!buffer)
|
|
545
957
|
continue;
|
|
546
958
|
snapshots.push({
|
|
@@ -571,10 +983,13 @@ export async function listWorkspaceSyncBinaryAssetsSnapshot(deps, basePath, work
|
|
|
571
983
|
return snapshots;
|
|
572
984
|
}
|
|
573
985
|
export async function listWorkspaceSyncBinaryAssetIndex(deps, workspaceId = 'default') {
|
|
574
|
-
const assets = deps.workspaceAssetStore?.
|
|
986
|
+
const assets = deps.workspaceAssetStore?.listAllNormalizedByWorkspace(workspaceId, {
|
|
575
987
|
includeDeleted: false
|
|
576
988
|
}) || [];
|
|
577
|
-
const
|
|
989
|
+
const linksByAssetId = deps.workspaceAssetStore
|
|
990
|
+
? groupWorkspaceAssetLinksByAssetId(deps.workspaceAssetStore, workspaceId)
|
|
991
|
+
: new Map();
|
|
992
|
+
const indexCandidates = assets
|
|
578
993
|
.filter((asset) => asset.kind === 'image' || asset.kind === 'file')
|
|
579
994
|
.filter((asset) => asset.storageProvider !== 'external')
|
|
580
995
|
.filter((asset) => {
|
|
@@ -583,10 +998,11 @@ export async function listWorkspaceSyncBinaryAssetIndex(deps, workspaceId = 'def
|
|
|
583
998
|
})
|
|
584
999
|
.map((asset) => {
|
|
585
1000
|
const storageKey = String(asset.storageKey || '').trim();
|
|
586
|
-
const { primaryLink, effectiveUpdatedAt } =
|
|
1001
|
+
const { primaryLink, activeLinks, effectiveUpdatedAt } = resolveCanonicalAssetSyncLinkStateFromLinks(asset, linksByAssetId.get(asset.assetId) || []);
|
|
587
1002
|
const linkTarget = resolveSyncLinkTarget(primaryLink);
|
|
588
1003
|
const assetKind = asset.kind === 'image' ? 'image' : 'file';
|
|
589
1004
|
return {
|
|
1005
|
+
asset,
|
|
590
1006
|
path: storageKey,
|
|
591
1007
|
updatedAt: effectiveUpdatedAt,
|
|
592
1008
|
assetId: asset.assetId,
|
|
@@ -599,16 +1015,114 @@ export async function listWorkspaceSyncBinaryAssetIndex(deps, workspaceId = 'def
|
|
|
599
1015
|
logicalName: asset.logicalName || null,
|
|
600
1016
|
caption: primaryLink?.displayName || null,
|
|
601
1017
|
originalFilename: asset.originalFilename || path.basename(storageKey),
|
|
602
|
-
linkRole: primaryLink?.role || (asset.kind === 'image' ? 'image' : 'attachment')
|
|
1018
|
+
linkRole: primaryLink?.role || (asset.kind === 'image' ? 'image' : 'attachment'),
|
|
1019
|
+
links: toSyncLinkPayloads(activeLinks),
|
|
603
1020
|
};
|
|
604
1021
|
})
|
|
605
1022
|
.filter((entry) => Number.isFinite(Date.parse(entry.updatedAt)) && entry.path.length > 0);
|
|
1023
|
+
const indexed = [];
|
|
1024
|
+
for (const candidate of indexCandidates) {
|
|
1025
|
+
try {
|
|
1026
|
+
const published = resolvePublishedContent(deps, {
|
|
1027
|
+
workspaceId,
|
|
1028
|
+
kind: 'asset',
|
|
1029
|
+
logicalPath: candidate.path,
|
|
1030
|
+
legacyProvider: candidate.asset.storageProvider === 'r2' ? 'r2' : 'local',
|
|
1031
|
+
});
|
|
1032
|
+
if (published.source === 'deleted')
|
|
1033
|
+
continue;
|
|
1034
|
+
const availability = publishedContentAvailable(deps.core.getPaths().basePath, published);
|
|
1035
|
+
const { asset: _asset, ...entry } = candidate;
|
|
1036
|
+
indexed.push({
|
|
1037
|
+
...entry,
|
|
1038
|
+
contentSha256: availability.contentSha256
|
|
1039
|
+
|| String(candidate.asset.contentSha256 || '').trim().toLowerCase(),
|
|
1040
|
+
sizeBytes: availability.contentAvailable
|
|
1041
|
+
? availability.sizeBytes
|
|
1042
|
+
: Math.max(0, Math.floor(Number(candidate.asset.sizeBytes || 0))),
|
|
1043
|
+
contentAvailable: availability.contentAvailable
|
|
1044
|
+
|| (published.source === 'legacy'
|
|
1045
|
+
&& published.storageProvider === 'r2'
|
|
1046
|
+
&& String(candidate.asset.contentSha256 || '').trim().length === 64),
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
catch (error) {
|
|
1050
|
+
deps.recordSyncDiagnostic(workspaceId, 'pull', 'Failed to index binary asset snapshot entry.', {
|
|
1051
|
+
source: 'assets.snapshot.indexEntry',
|
|
1052
|
+
path: candidate.path,
|
|
1053
|
+
assetId: candidate.asset.assetId,
|
|
1054
|
+
error: String(error?.message || error || '')
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
606
1058
|
const indexedPaths = new Set(indexed.map((entry) => entry.path));
|
|
607
|
-
for (const [assetPath, metadata] of
|
|
1059
|
+
for (const [assetPath, metadata] of listReferencedAiProfileAvatarAssets(deps, workspaceId).entries()) {
|
|
608
1060
|
if (indexedPaths.has(assetPath))
|
|
609
1061
|
continue;
|
|
610
1062
|
if (!Number.isFinite(Date.parse(metadata.updatedAt)))
|
|
611
1063
|
continue;
|
|
1064
|
+
const fingerprintCacheKey = `${workspaceId}:${assetPath}`;
|
|
1065
|
+
let published;
|
|
1066
|
+
try {
|
|
1067
|
+
published = resolvePublishedContent(deps, {
|
|
1068
|
+
workspaceId,
|
|
1069
|
+
kind: 'asset',
|
|
1070
|
+
logicalPath: assetPath,
|
|
1071
|
+
legacyProvider: deps.getObjectStorageClient() ? 'r2' : 'local',
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
catch (error) {
|
|
1075
|
+
deps.recordSyncDiagnostic(workspaceId, 'pull', 'Failed to resolve referenced AI profile avatar.', {
|
|
1076
|
+
source: 'assets.index.aiProfileAvatar.resolve',
|
|
1077
|
+
path: assetPath,
|
|
1078
|
+
error: String(error?.message || error || '')
|
|
1079
|
+
});
|
|
1080
|
+
continue;
|
|
1081
|
+
}
|
|
1082
|
+
if (published.source === 'deleted')
|
|
1083
|
+
continue;
|
|
1084
|
+
const contentIdentity = publishedContentIdentity(published);
|
|
1085
|
+
let fingerprint = referencedAvatarFingerprintCache.get(fingerprintCacheKey);
|
|
1086
|
+
if (!fingerprint
|
|
1087
|
+
|| fingerprint.updatedAt !== metadata.updatedAt
|
|
1088
|
+
|| fingerprint.contentIdentity !== contentIdentity) {
|
|
1089
|
+
if (published.source === 'versioned') {
|
|
1090
|
+
const availability = publishedContentAvailable(deps.core.getPaths().basePath, published);
|
|
1091
|
+
fingerprint = availability.contentAvailable
|
|
1092
|
+
? {
|
|
1093
|
+
updatedAt: metadata.updatedAt,
|
|
1094
|
+
contentIdentity,
|
|
1095
|
+
contentSha256: availability.contentSha256,
|
|
1096
|
+
sizeBytes: availability.sizeBytes,
|
|
1097
|
+
}
|
|
1098
|
+
: undefined;
|
|
1099
|
+
}
|
|
1100
|
+
else {
|
|
1101
|
+
let content = null;
|
|
1102
|
+
try {
|
|
1103
|
+
content = await readReferencedAvatarBuffer(deps, deps.core.getPaths().basePath, published, `Workspace sync AI profile avatar index ${assetPath}`);
|
|
1104
|
+
}
|
|
1105
|
+
catch (error) {
|
|
1106
|
+
deps.recordSyncDiagnostic(workspaceId, 'pull', 'Failed to fingerprint referenced AI profile avatar.', {
|
|
1107
|
+
source: 'assets.index.aiProfileAvatar',
|
|
1108
|
+
path: assetPath,
|
|
1109
|
+
error: String(error?.message || error || '')
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
fingerprint = content
|
|
1113
|
+
? {
|
|
1114
|
+
updatedAt: metadata.updatedAt,
|
|
1115
|
+
contentIdentity,
|
|
1116
|
+
contentSha256: createHash('sha256').update(content).digest('hex'),
|
|
1117
|
+
sizeBytes: content.length,
|
|
1118
|
+
}
|
|
1119
|
+
: undefined;
|
|
1120
|
+
}
|
|
1121
|
+
if (fingerprint)
|
|
1122
|
+
referencedAvatarFingerprintCache.set(fingerprintCacheKey, fingerprint);
|
|
1123
|
+
else
|
|
1124
|
+
referencedAvatarFingerprintCache.delete(fingerprintCacheKey);
|
|
1125
|
+
}
|
|
612
1126
|
indexed.push({
|
|
613
1127
|
path: assetPath,
|
|
614
1128
|
updatedAt: metadata.updatedAt,
|
|
@@ -622,7 +1136,10 @@ export async function listWorkspaceSyncBinaryAssetIndex(deps, workspaceId = 'def
|
|
|
622
1136
|
logicalName: null,
|
|
623
1137
|
caption: null,
|
|
624
1138
|
originalFilename: metadata.originalFilename,
|
|
625
|
-
linkRole: 'image'
|
|
1139
|
+
linkRole: 'image',
|
|
1140
|
+
contentSha256: fingerprint?.contentSha256 || '',
|
|
1141
|
+
sizeBytes: fingerprint?.sizeBytes || 0,
|
|
1142
|
+
contentAvailable: Boolean(fingerprint)
|
|
626
1143
|
});
|
|
627
1144
|
}
|
|
628
1145
|
return indexed;
|
|
@@ -635,16 +1152,26 @@ export async function loadWorkspaceSyncDocumentPayload(deps, basePath, workspace
|
|
|
635
1152
|
const absolutePath = path.resolve(path.join(root, normalizedPath));
|
|
636
1153
|
if (absolutePath !== root && !absolutePath.startsWith(`${root}${path.sep}`))
|
|
637
1154
|
return null;
|
|
638
|
-
const objectStorageClient = deps.getObjectStorageClient();
|
|
639
1155
|
const canonicalAsset = deps.workspaceAssetStore?.getByStorageKey(normalizedPath, workspaceId);
|
|
640
1156
|
let content = '';
|
|
641
1157
|
let stat = null;
|
|
1158
|
+
let contentIdentity = `legacy:local:${normalizedPath}`;
|
|
642
1159
|
try {
|
|
643
|
-
if (canonicalAsset?.kind === 'document'
|
|
644
|
-
const
|
|
645
|
-
|
|
1160
|
+
if (canonicalAsset?.kind === 'document') {
|
|
1161
|
+
const published = resolvePublishedContent(deps, {
|
|
1162
|
+
workspaceId,
|
|
1163
|
+
kind: 'document',
|
|
1164
|
+
logicalPath: normalizedPath,
|
|
1165
|
+
legacyProvider: canonicalAsset.storageProvider === 'r2' ? 'r2' : 'local',
|
|
1166
|
+
});
|
|
1167
|
+
if (published.source === 'deleted')
|
|
1168
|
+
return null;
|
|
1169
|
+
contentIdentity = publishedContentIdentity(published);
|
|
1170
|
+
const read = await readPublishedContentBuffer(deps, root, published, `Targeted workspace sync document ${normalizedPath}`);
|
|
1171
|
+
if (!read)
|
|
646
1172
|
return null;
|
|
647
|
-
content =
|
|
1173
|
+
content = read.buffer.toString('utf8');
|
|
1174
|
+
stat = read.stat;
|
|
648
1175
|
}
|
|
649
1176
|
else {
|
|
650
1177
|
if (!fs.existsSync(absolutePath))
|
|
@@ -697,11 +1224,11 @@ export async function loadWorkspaceSyncDocumentPayload(deps, basePath, workspace
|
|
|
697
1224
|
}
|
|
698
1225
|
}
|
|
699
1226
|
if (cached
|
|
700
|
-
&&
|
|
1227
|
+
&& cached.contentIdentity === contentIdentity
|
|
701
1228
|
&& cached.size === Buffer.byteLength(content, 'utf8')
|
|
702
1229
|
&& (canonicalAsset
|
|
703
1230
|
? cached.updatedAt === updatedAt
|
|
704
|
-
: cached.mtimeMs === stat.mtimeMs && cached.ctimeMs === stat.ctimeMs)) {
|
|
1231
|
+
: stat != null && cached.mtimeMs === stat.mtimeMs && cached.ctimeMs === stat.ctimeMs)) {
|
|
705
1232
|
return {
|
|
706
1233
|
path: normalizedPath,
|
|
707
1234
|
updatedAt: cached.updatedAt,
|
|
@@ -711,6 +1238,7 @@ export async function loadWorkspaceSyncDocumentPayload(deps, basePath, workspace
|
|
|
711
1238
|
}
|
|
712
1239
|
workspaceCache.set(normalizedPath, {
|
|
713
1240
|
path: normalizedPath,
|
|
1241
|
+
contentIdentity,
|
|
714
1242
|
mtimeMs: stat?.mtimeMs ?? 0,
|
|
715
1243
|
ctimeMs: stat?.ctimeMs ?? 0,
|
|
716
1244
|
size: Buffer.byteLength(content, 'utf8'),
|
|
@@ -730,7 +1258,7 @@ export async function loadWorkspaceSyncBinaryAssetPayload(deps, basePath, worksp
|
|
|
730
1258
|
return null;
|
|
731
1259
|
const asset = deps.workspaceAssetStore?.getByStorageKey(normalizedPath, workspaceId) || null;
|
|
732
1260
|
const referencedAiAvatar = !asset
|
|
733
|
-
?
|
|
1261
|
+
? listReferencedAiProfileAvatarAssets(deps, workspaceId).get(normalizedPath) || null
|
|
734
1262
|
: null;
|
|
735
1263
|
if (!referencedAiAvatar
|
|
736
1264
|
&& (!asset || (asset.kind !== 'image' && asset.kind !== 'file') || asset.storageProvider === 'external')) {
|
|
@@ -739,26 +1267,19 @@ export async function loadWorkspaceSyncBinaryAssetPayload(deps, basePath, worksp
|
|
|
739
1267
|
const objectStorageClient = deps.getObjectStorageClient();
|
|
740
1268
|
let buffer = null;
|
|
741
1269
|
try {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
if (!buffer && referencedAiAvatar && objectStorageClient) {
|
|
756
|
-
const root = path.resolve(basePath);
|
|
757
|
-
const absolutePath = path.resolve(root, normalizedPath);
|
|
758
|
-
if (absolutePath !== root && absolutePath.startsWith(`${root}${path.sep}`) && fs.existsSync(absolutePath)) {
|
|
759
|
-
buffer = fs.readFileSync(absolutePath);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
1270
|
+
const published = resolvePublishedContent(deps, {
|
|
1271
|
+
workspaceId,
|
|
1272
|
+
kind: 'asset',
|
|
1273
|
+
logicalPath: normalizedPath,
|
|
1274
|
+
legacyProvider: asset
|
|
1275
|
+
? (asset.storageProvider === 'r2' ? 'r2' : 'local')
|
|
1276
|
+
: (objectStorageClient ? 'r2' : 'local'),
|
|
1277
|
+
});
|
|
1278
|
+
if (published.source === 'deleted')
|
|
1279
|
+
return null;
|
|
1280
|
+
buffer = referencedAiAvatar && !asset
|
|
1281
|
+
? await readReferencedAvatarBuffer(deps, basePath, published, `Targeted workspace sync binary asset ${normalizedPath}`)
|
|
1282
|
+
: (await readPublishedContentBuffer(deps, basePath, published, `Targeted workspace sync binary asset ${normalizedPath}`))?.buffer || null;
|
|
762
1283
|
}
|
|
763
1284
|
catch (error) {
|
|
764
1285
|
deps.recordSyncDiagnostic(workspaceId, 'pull', 'Failed to load targeted binary asset payload.', {
|
|
@@ -791,7 +1312,7 @@ export async function loadWorkspaceSyncBinaryAssetPayload(deps, basePath, worksp
|
|
|
791
1312
|
}
|
|
792
1313
|
if (!asset)
|
|
793
1314
|
return null;
|
|
794
|
-
const { primaryLink, effectiveUpdatedAt } = resolveCanonicalAssetSyncLinkState(deps, asset, workspaceId);
|
|
1315
|
+
const { primaryLink, activeLinks, effectiveUpdatedAt } = resolveCanonicalAssetSyncLinkState(deps, asset, workspaceId);
|
|
795
1316
|
const linkTarget = resolveSyncLinkTarget(primaryLink);
|
|
796
1317
|
const assetKind = asset.kind === 'image' ? 'image' : 'file';
|
|
797
1318
|
return {
|
|
@@ -808,12 +1329,14 @@ export async function loadWorkspaceSyncBinaryAssetPayload(deps, basePath, worksp
|
|
|
808
1329
|
logicalName: asset.logicalName || null,
|
|
809
1330
|
caption: primaryLink?.displayName || null,
|
|
810
1331
|
originalFilename: asset.originalFilename || path.basename(normalizedPath),
|
|
811
|
-
linkRole: primaryLink?.role || (asset.kind === 'image' ? 'image' : 'attachment')
|
|
1332
|
+
linkRole: primaryLink?.role || (asset.kind === 'image' ? 'image' : 'attachment'),
|
|
1333
|
+
links: toSyncLinkPayloads(activeLinks),
|
|
812
1334
|
};
|
|
813
1335
|
}
|
|
814
1336
|
export function listWorkspaceSyncBinaryAssetDeletesSnapshot(deps, workspaceId = 'default') {
|
|
815
1337
|
if (!deps.workspaceAssetStore)
|
|
816
1338
|
return [];
|
|
1339
|
+
const referencedAiAvatarAssets = listReferencedAiProfileAvatarAssets(deps, workspaceId);
|
|
817
1340
|
const entries = deps.workspaceAssetStore.listAllByWorkspace(workspaceId, {
|
|
818
1341
|
includeDeleted: true
|
|
819
1342
|
})
|
|
@@ -825,6 +1348,8 @@ export function listWorkspaceSyncBinaryAssetDeletesSnapshot(deps, workspaceId =
|
|
|
825
1348
|
const normalizedPath = deps.normalizeTaskDataRelativePath(asset.storageKey);
|
|
826
1349
|
if (!normalizedPath)
|
|
827
1350
|
return null;
|
|
1351
|
+
if (referencedAiAvatarAssets.has(normalizedPath))
|
|
1352
|
+
return null;
|
|
828
1353
|
return {
|
|
829
1354
|
path: normalizedPath,
|
|
830
1355
|
deletedAt: String(asset.deletedAt || '').trim(),
|
|
@@ -833,71 +1358,159 @@ export function listWorkspaceSyncBinaryAssetDeletesSnapshot(deps, workspaceId =
|
|
|
833
1358
|
});
|
|
834
1359
|
return entries.filter((entry) => Boolean(entry && entry.path && entry.deletedAt));
|
|
835
1360
|
}
|
|
836
|
-
export
|
|
837
|
-
const normalizedPath =
|
|
838
|
-
if (!normalizedPath)
|
|
839
|
-
return;
|
|
840
|
-
const root = path.resolve(basePath);
|
|
841
|
-
const targetPath = path.resolve(root, normalizedPath);
|
|
842
|
-
if (targetPath !== root && !targetPath.startsWith(`${root}${path.sep}`))
|
|
843
|
-
return;
|
|
844
|
-
const objectStorageClient = deps.getObjectStorageClient();
|
|
845
|
-
const content = String(doc.content || '');
|
|
846
|
-
if (objectStorageClient) {
|
|
847
|
-
try {
|
|
848
|
-
await objectStorageClient.putObject(normalizedPath, Buffer.from(content, 'utf8'), 'text/markdown');
|
|
849
|
-
}
|
|
850
|
-
catch (error) {
|
|
851
|
-
deps.recordSyncDiagnostic(workspaceId, 'apply', 'Failed to write document to object storage.', {
|
|
852
|
-
source: 'documents.write.putObject',
|
|
853
|
-
path: normalizedPath,
|
|
854
|
-
error: String(error?.message || error || '')
|
|
855
|
-
});
|
|
856
|
-
return;
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
else {
|
|
860
|
-
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
861
|
-
fs.writeFileSync(targetPath, content, 'utf8');
|
|
862
|
-
}
|
|
1361
|
+
export function persistWorkspaceSyncDocumentMetadata(deps, input) {
|
|
1362
|
+
const { document: doc, normalizedPath, contentSha256, sizeBytes, storageProvider, workspaceId = 'default', options, } = input;
|
|
863
1363
|
const updatedAt = String(doc.updatedAt || '').trim();
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1364
|
+
const mutationUpdatedAt = updatedAt || new Date().toISOString();
|
|
1365
|
+
try {
|
|
1366
|
+
runWorkspaceSyncContentMetadataMutation(deps, {
|
|
1367
|
+
workspaceId,
|
|
1368
|
+
kind: 'document',
|
|
1369
|
+
logicalPath: normalizedPath,
|
|
1370
|
+
updatedAt: mutationUpdatedAt,
|
|
1371
|
+
}, () => {
|
|
1372
|
+
const current = newestDocumentMetadata(deps.core.getDocumentWatermark(workspaceId, normalizedPath), deps.workspaceAssetStore?.getByStorageKey(normalizedPath, workspaceId) || null);
|
|
1373
|
+
if ((options?.strictOrdering === true
|
|
1374
|
+
|| hasPublishedWorkspaceSyncContentHead(deps, {
|
|
1375
|
+
workspaceId,
|
|
1376
|
+
kind: 'document',
|
|
1377
|
+
logicalPath: normalizedPath,
|
|
1378
|
+
}))
|
|
1379
|
+
&&
|
|
1380
|
+
current
|
|
1381
|
+
&& compareWorkspaceMutationOrdering(mutationUpdatedAt, current.updatedAt, contentSha256, current.contentHash) < 0)
|
|
1382
|
+
return;
|
|
1383
|
+
const persistWatermark = options?.strictWatermark === true
|
|
1384
|
+
? deps.core.upsertDocumentWatermarkStrict.bind(deps.core)
|
|
1385
|
+
: deps.core.upsertDocumentWatermark.bind(deps.core);
|
|
1386
|
+
persistWatermark(workspaceId, normalizedPath, contentSha256, mutationUpdatedAt);
|
|
1387
|
+
if (deps.workspaceAssetStore) {
|
|
1388
|
+
const existing = deps.workspaceAssetStore.getByStorageKey(normalizedPath, workspaceId);
|
|
1389
|
+
const effectiveUpdatedAt = mutationUpdatedAt;
|
|
1390
|
+
const incomingReferenceNumber = Number.isFinite(Number(doc.referenceNumber))
|
|
1391
|
+
? Math.max(1, Math.floor(Number(doc.referenceNumber)))
|
|
1392
|
+
: null;
|
|
1393
|
+
const allowReferenceNumberReassignment = options?.allowReferenceNumberReassignment === true;
|
|
1394
|
+
const nextReferenceNumber = allowReferenceNumberReassignment
|
|
1395
|
+
? (incomingReferenceNumber ?? existing?.referenceNumber ?? null)
|
|
1396
|
+
: (existing?.referenceNumber ?? incomingReferenceNumber ?? null);
|
|
1397
|
+
const originalFilename = String(doc.originalFilename
|
|
1398
|
+
|| existing?.originalFilename
|
|
1399
|
+
|| path.basename(normalizedPath)
|
|
1400
|
+
|| 'document.md').trim() || 'document.md';
|
|
1401
|
+
const upsertedAsset = deps.workspaceAssetStore.upsertAsset({
|
|
1402
|
+
assetId: String(doc.assetId || existing?.assetId || `asset-${randomUUID().replace(/-/g, '')}`),
|
|
1403
|
+
workspaceId,
|
|
1404
|
+
kind: 'document',
|
|
1405
|
+
logicalName: typeof doc.logicalName === 'string' && doc.logicalName.trim().length > 0
|
|
1406
|
+
? doc.logicalName.trim()
|
|
1407
|
+
: existing?.logicalName || null,
|
|
1408
|
+
originalFilename,
|
|
1409
|
+
mimeType: existing?.mimeType || 'text/markdown',
|
|
1410
|
+
storageProvider,
|
|
1411
|
+
storageKey: normalizedPath,
|
|
1412
|
+
contentSha256,
|
|
1413
|
+
sizeBytes,
|
|
1414
|
+
documentId: String(doc.documentId || existing?.documentId || `doc-${randomUUID().replace(/-/g, '')}`),
|
|
1415
|
+
referenceNumber: nextReferenceNumber,
|
|
1416
|
+
version: Number.isFinite(Number(doc.version))
|
|
1417
|
+
? Math.max(1, Math.floor(Number(doc.version)))
|
|
1418
|
+
: Math.max(1, Number(existing?.version || 0) + 1),
|
|
1419
|
+
isLatest: true,
|
|
1420
|
+
scanStatus: existing?.scanStatus || 'clean',
|
|
1421
|
+
scanEngine: existing?.scanEngine || null,
|
|
1422
|
+
scanDetails: existing?.scanDetails || null,
|
|
1423
|
+
createdByUserId: existing?.createdByUserId || null,
|
|
1424
|
+
createdAt: existing?.createdAt || effectiveUpdatedAt,
|
|
1425
|
+
updatedAt: effectiveUpdatedAt,
|
|
1426
|
+
deletedAt: null,
|
|
1427
|
+
purgeAfter: null,
|
|
1428
|
+
allowReferenceNumberReassignment
|
|
1429
|
+
});
|
|
1430
|
+
const asset = allowReferenceNumberReassignment && incomingReferenceNumber
|
|
1431
|
+
? deps.workspaceAssetStore.adoptReadableReferenceNumber(workspaceId, upsertedAsset.assetId, incomingReferenceNumber)
|
|
1432
|
+
: upsertedAsset;
|
|
1433
|
+
const linkTarget = resolveIncomingSyncLinkTarget(doc);
|
|
1434
|
+
reconcileWorkspaceSyncLinks(deps, {
|
|
1435
|
+
workspaceId,
|
|
1436
|
+
assetId: asset.assetId,
|
|
1437
|
+
taskId: linkTarget?.targetType === 'task' ? linkTarget.targetId : null,
|
|
1438
|
+
linkTargetType: linkTarget?.targetType || null,
|
|
1439
|
+
linkTargetId: linkTarget?.targetId || null,
|
|
1440
|
+
displayName: typeof doc.caption === 'string' && doc.caption.trim().length > 0
|
|
1441
|
+
? doc.caption.trim()
|
|
1442
|
+
: null,
|
|
1443
|
+
role: doc.linkRole === 'reference' ? 'reference' : 'attachment',
|
|
1444
|
+
updatedAt: effectiveUpdatedAt,
|
|
1445
|
+
links: doc.links,
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
catch (error) {
|
|
1451
|
+
deps.recordSyncDiagnostic(workspaceId, 'apply', 'Failed to persist document watermark after write.', {
|
|
1452
|
+
source: 'documents.write.upsertWatermark',
|
|
1453
|
+
path: normalizedPath,
|
|
1454
|
+
error: String(error?.message || error || '')
|
|
1455
|
+
});
|
|
1456
|
+
throw error;
|
|
868
1457
|
}
|
|
1458
|
+
deps.workspaceDocumentSnapshotCache.get(workspaceId)?.delete(normalizedPath);
|
|
1459
|
+
}
|
|
1460
|
+
export function persistWorkspaceSyncBinaryAssetMetadata(deps, input) {
|
|
1461
|
+
if (!deps.workspaceAssetStore)
|
|
1462
|
+
return;
|
|
1463
|
+
const workspaceAssetStore = deps.workspaceAssetStore;
|
|
1464
|
+
const { asset, normalizedPath, contentSha256, sizeBytes, storageProvider, workspaceId = 'default', options, } = input;
|
|
1465
|
+
const updatedAt = String(asset.updatedAt || '').trim();
|
|
1466
|
+
const mutationUpdatedAt = updatedAt || new Date().toISOString();
|
|
869
1467
|
try {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
1468
|
+
runWorkspaceSyncContentMetadataMutation(deps, {
|
|
1469
|
+
workspaceId,
|
|
1470
|
+
kind: 'asset',
|
|
1471
|
+
logicalPath: normalizedPath,
|
|
1472
|
+
updatedAt: mutationUpdatedAt,
|
|
1473
|
+
}, () => {
|
|
1474
|
+
const existing = workspaceAssetStore.getByStorageKey(normalizedPath, workspaceId);
|
|
1475
|
+
if ((options?.strictOrdering === true
|
|
1476
|
+
|| hasPublishedWorkspaceSyncContentHead(deps, {
|
|
1477
|
+
workspaceId,
|
|
1478
|
+
kind: 'asset',
|
|
1479
|
+
logicalPath: normalizedPath,
|
|
1480
|
+
}))
|
|
1481
|
+
&&
|
|
1482
|
+
existing
|
|
1483
|
+
&& compareWorkspaceMutationOrdering(mutationUpdatedAt, existing.updatedAt, contentSha256, existing.contentSha256) < 0)
|
|
1484
|
+
return;
|
|
1485
|
+
const effectiveUpdatedAt = mutationUpdatedAt;
|
|
1486
|
+
const incomingReferenceNumber = Number.isFinite(Number(asset.referenceNumber))
|
|
1487
|
+
? Math.max(1, Math.floor(Number(asset.referenceNumber)))
|
|
877
1488
|
: null;
|
|
878
1489
|
const allowReferenceNumberReassignment = options?.allowReferenceNumberReassignment === true;
|
|
879
1490
|
const nextReferenceNumber = allowReferenceNumberReassignment
|
|
880
1491
|
? (incomingReferenceNumber ?? existing?.referenceNumber ?? null)
|
|
881
1492
|
: (existing?.referenceNumber ?? incomingReferenceNumber ?? null);
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
assetId: String(doc.assetId || existing?.assetId || `asset-${randomUUID().replace(/-/g, '')}`),
|
|
1493
|
+
const upsertedAssetRecord = workspaceAssetStore.upsertAsset({
|
|
1494
|
+
assetId: String(asset.assetId || existing?.assetId || `asset-${randomUUID().replace(/-/g, '')}`),
|
|
885
1495
|
workspaceId,
|
|
886
|
-
kind: '
|
|
887
|
-
logicalName: typeof
|
|
888
|
-
?
|
|
1496
|
+
kind: asset.kind === 'image' ? 'image' : 'file',
|
|
1497
|
+
logicalName: typeof asset.logicalName === 'string' && asset.logicalName.trim().length > 0
|
|
1498
|
+
? asset.logicalName.trim()
|
|
889
1499
|
: existing?.logicalName || null,
|
|
890
|
-
originalFilename
|
|
891
|
-
|
|
892
|
-
|
|
1500
|
+
originalFilename: String(asset.originalFilename
|
|
1501
|
+
|| existing?.originalFilename
|
|
1502
|
+
|| path.basename(normalizedPath)
|
|
1503
|
+
|| 'asset').trim() || 'asset',
|
|
1504
|
+
mimeType: String(asset.mimeType
|
|
1505
|
+
|| existing?.mimeType
|
|
1506
|
+
|| 'application/octet-stream').trim() || 'application/octet-stream',
|
|
1507
|
+
storageProvider,
|
|
893
1508
|
storageKey: normalizedPath,
|
|
894
|
-
contentSha256
|
|
895
|
-
sizeBytes
|
|
896
|
-
documentId:
|
|
1509
|
+
contentSha256,
|
|
1510
|
+
sizeBytes,
|
|
1511
|
+
documentId: null,
|
|
897
1512
|
referenceNumber: nextReferenceNumber,
|
|
898
|
-
version:
|
|
899
|
-
? Math.max(1, Math.floor(Number(doc.version)))
|
|
900
|
-
: Math.max(1, Number(existing?.version || 0) + 1),
|
|
1513
|
+
version: null,
|
|
901
1514
|
isLatest: true,
|
|
902
1515
|
scanStatus: existing?.scanStatus || 'clean',
|
|
903
1516
|
scanEngine: existing?.scanEngine || null,
|
|
@@ -909,27 +1522,106 @@ export async function writeWorkspaceSyncDocument(deps, basePath, doc, workspaceI
|
|
|
909
1522
|
purgeAfter: null,
|
|
910
1523
|
allowReferenceNumberReassignment
|
|
911
1524
|
});
|
|
912
|
-
const
|
|
1525
|
+
const assetRecord = allowReferenceNumberReassignment && incomingReferenceNumber
|
|
1526
|
+
? workspaceAssetStore.adoptReadableReferenceNumber(workspaceId, upsertedAssetRecord.assetId, incomingReferenceNumber)
|
|
1527
|
+
: upsertedAssetRecord;
|
|
1528
|
+
const linkTarget = resolveIncomingSyncLinkTarget(asset);
|
|
913
1529
|
reconcileWorkspaceSyncLinks(deps, {
|
|
914
1530
|
workspaceId,
|
|
915
|
-
assetId:
|
|
1531
|
+
assetId: assetRecord.assetId,
|
|
916
1532
|
taskId: linkTarget?.targetType === 'task' ? linkTarget.targetId : null,
|
|
917
1533
|
linkTargetType: linkTarget?.targetType || null,
|
|
918
1534
|
linkTargetId: linkTarget?.targetId || null,
|
|
919
|
-
displayName: typeof
|
|
920
|
-
|
|
921
|
-
|
|
1535
|
+
displayName: typeof asset.caption === 'string' && asset.caption.trim().length > 0
|
|
1536
|
+
? asset.caption.trim()
|
|
1537
|
+
: null,
|
|
1538
|
+
role: asset.linkRole === 'reference'
|
|
1539
|
+
? 'reference'
|
|
1540
|
+
: asset.kind === 'image'
|
|
1541
|
+
? 'image'
|
|
1542
|
+
: 'attachment',
|
|
1543
|
+
updatedAt: effectiveUpdatedAt,
|
|
1544
|
+
links: asset.links,
|
|
922
1545
|
});
|
|
923
|
-
}
|
|
1546
|
+
});
|
|
924
1547
|
}
|
|
925
1548
|
catch (error) {
|
|
926
|
-
deps.recordSyncDiagnostic(workspaceId, 'apply', 'Failed to persist
|
|
927
|
-
source: '
|
|
1549
|
+
deps.recordSyncDiagnostic(workspaceId, 'apply', 'Failed to persist binary asset metadata after write.', {
|
|
1550
|
+
source: 'assets.write.upsertAsset',
|
|
928
1551
|
path: normalizedPath,
|
|
1552
|
+
assetId: typeof asset.assetId === 'string' ? asset.assetId : null,
|
|
1553
|
+
kind: asset.kind,
|
|
929
1554
|
error: String(error?.message || error || '')
|
|
930
1555
|
});
|
|
1556
|
+
throw error;
|
|
931
1557
|
}
|
|
932
|
-
|
|
1558
|
+
}
|
|
1559
|
+
export async function writeWorkspaceSyncDocument(deps, basePath, doc, workspaceId = 'default', options) {
|
|
1560
|
+
const normalizedPath = deps.normalizeWorkspaceSyncDocumentPath(doc.path);
|
|
1561
|
+
if (!normalizedPath)
|
|
1562
|
+
return;
|
|
1563
|
+
const root = path.resolve(basePath);
|
|
1564
|
+
const targetPath = path.resolve(root, normalizedPath);
|
|
1565
|
+
if (targetPath !== root && !targetPath.startsWith(`${root}${path.sep}`))
|
|
1566
|
+
return;
|
|
1567
|
+
const objectStorageClient = deps.getObjectStorageClient();
|
|
1568
|
+
const content = String(doc.content || '');
|
|
1569
|
+
const contentBuffer = Buffer.from(content, 'utf8');
|
|
1570
|
+
const contentSha256 = createHash('sha256').update(contentBuffer).digest('hex');
|
|
1571
|
+
const sizeBytes = contentBuffer.byteLength;
|
|
1572
|
+
const updatedAt = String(doc.updatedAt || '').trim();
|
|
1573
|
+
const watermarkMs = Date.parse(updatedAt);
|
|
1574
|
+
if (objectStorageClient) {
|
|
1575
|
+
try {
|
|
1576
|
+
await objectStorageClient.putObject(normalizedPath, contentBuffer, 'text/markdown');
|
|
1577
|
+
}
|
|
1578
|
+
catch (error) {
|
|
1579
|
+
deps.recordSyncDiagnostic(workspaceId, 'apply', 'Failed to write document to object storage.', {
|
|
1580
|
+
source: 'documents.write.putObject',
|
|
1581
|
+
path: normalizedPath,
|
|
1582
|
+
error: String(error?.message || error || '')
|
|
1583
|
+
});
|
|
1584
|
+
throw error;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
else {
|
|
1588
|
+
try {
|
|
1589
|
+
publishWorkspaceSyncLocalFileAtomically({
|
|
1590
|
+
targetPath,
|
|
1591
|
+
body: contentBuffer,
|
|
1592
|
+
expectedSha256: contentSha256,
|
|
1593
|
+
expectedSizeBytes: sizeBytes,
|
|
1594
|
+
sourceUpdatedAt: Number.isFinite(watermarkMs) && watermarkMs > 0
|
|
1595
|
+
? new Date(watermarkMs)
|
|
1596
|
+
: null,
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
catch (error) {
|
|
1600
|
+
deps.recordSyncDiagnostic(workspaceId, 'apply', 'Failed to publish document atomically.', {
|
|
1601
|
+
source: 'documents.write.atomicLocal',
|
|
1602
|
+
path: normalizedPath,
|
|
1603
|
+
error: String(error?.message || error || ''),
|
|
1604
|
+
...(error instanceof WorkspaceSyncAtomicLocalPublicationError
|
|
1605
|
+
? {
|
|
1606
|
+
code: error.code,
|
|
1607
|
+
boundary: error.boundary,
|
|
1608
|
+
published: error.published,
|
|
1609
|
+
}
|
|
1610
|
+
: {}),
|
|
1611
|
+
});
|
|
1612
|
+
throw error;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
const { content: _content, ...document } = doc;
|
|
1616
|
+
persistWorkspaceSyncDocumentMetadata(deps, {
|
|
1617
|
+
document,
|
|
1618
|
+
normalizedPath,
|
|
1619
|
+
contentSha256,
|
|
1620
|
+
sizeBytes,
|
|
1621
|
+
storageProvider: objectStorageClient ? 'r2' : 'local',
|
|
1622
|
+
workspaceId,
|
|
1623
|
+
options,
|
|
1624
|
+
});
|
|
933
1625
|
}
|
|
934
1626
|
export async function writeWorkspaceSyncBinaryAsset(deps, basePath, asset, workspaceId = 'default', options) {
|
|
935
1627
|
const normalizedPath = deps.normalizeTaskDataRelativePath(asset.path);
|
|
@@ -941,6 +1633,10 @@ export async function writeWorkspaceSyncBinaryAsset(deps, basePath, asset, works
|
|
|
941
1633
|
return;
|
|
942
1634
|
const objectStorageClient = deps.getObjectStorageClient();
|
|
943
1635
|
const buffer = Buffer.from(String(asset.contentBase64 || ''), 'base64');
|
|
1636
|
+
const contentSha256 = createHash('sha256').update(buffer).digest('hex');
|
|
1637
|
+
const sizeBytes = buffer.byteLength;
|
|
1638
|
+
const updatedAt = String(asset.updatedAt || '').trim();
|
|
1639
|
+
const watermarkMs = Date.parse(updatedAt);
|
|
944
1640
|
if (objectStorageClient) {
|
|
945
1641
|
try {
|
|
946
1642
|
await objectStorageClient.putObject(normalizedPath, buffer, String(asset.mimeType || 'application/octet-stream').trim() || 'application/octet-stream');
|
|
@@ -951,84 +1647,121 @@ export async function writeWorkspaceSyncBinaryAsset(deps, basePath, asset, works
|
|
|
951
1647
|
path: normalizedPath,
|
|
952
1648
|
error: String(error?.message || error || '')
|
|
953
1649
|
});
|
|
954
|
-
|
|
1650
|
+
throw error;
|
|
955
1651
|
}
|
|
956
1652
|
}
|
|
957
1653
|
else {
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1654
|
+
try {
|
|
1655
|
+
publishWorkspaceSyncLocalFileAtomically({
|
|
1656
|
+
targetPath,
|
|
1657
|
+
body: buffer,
|
|
1658
|
+
expectedSha256: contentSha256,
|
|
1659
|
+
expectedSizeBytes: sizeBytes,
|
|
1660
|
+
sourceUpdatedAt: Number.isFinite(watermarkMs) && watermarkMs > 0
|
|
1661
|
+
? new Date(watermarkMs)
|
|
1662
|
+
: null,
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
catch (error) {
|
|
1666
|
+
deps.recordSyncDiagnostic(workspaceId, 'apply', 'Failed to publish binary asset atomically.', {
|
|
1667
|
+
source: 'assets.write.atomicLocal',
|
|
1668
|
+
path: normalizedPath,
|
|
1669
|
+
error: String(error?.message || error || ''),
|
|
1670
|
+
...(error instanceof WorkspaceSyncAtomicLocalPublicationError
|
|
1671
|
+
? {
|
|
1672
|
+
code: error.code,
|
|
1673
|
+
boundary: error.boundary,
|
|
1674
|
+
published: error.published,
|
|
1675
|
+
}
|
|
1676
|
+
: {}),
|
|
1677
|
+
});
|
|
1678
|
+
throw error;
|
|
1679
|
+
}
|
|
966
1680
|
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
? asset.logicalName.trim()
|
|
985
|
-
: existing?.logicalName || null,
|
|
986
|
-
originalFilename: String(asset.originalFilename || existing?.originalFilename || path.basename(normalizedPath) || 'asset').trim() || 'asset',
|
|
987
|
-
mimeType: String(asset.mimeType || existing?.mimeType || 'application/octet-stream').trim() || 'application/octet-stream',
|
|
988
|
-
storageProvider: objectStorageClient ? 'r2' : 'local',
|
|
989
|
-
storageKey: normalizedPath,
|
|
990
|
-
contentSha256: createHash('sha256').update(buffer).digest('hex'),
|
|
991
|
-
sizeBytes: buffer.length,
|
|
992
|
-
documentId: null,
|
|
993
|
-
referenceNumber: nextReferenceNumber,
|
|
994
|
-
version: null,
|
|
995
|
-
isLatest: true,
|
|
996
|
-
scanStatus: existing?.scanStatus || 'clean',
|
|
997
|
-
scanEngine: existing?.scanEngine || null,
|
|
998
|
-
scanDetails: existing?.scanDetails || null,
|
|
999
|
-
createdByUserId: existing?.createdByUserId || null,
|
|
1000
|
-
createdAt: existing?.createdAt || effectiveUpdatedAt,
|
|
1001
|
-
updatedAt: effectiveUpdatedAt,
|
|
1002
|
-
deletedAt: null,
|
|
1003
|
-
purgeAfter: null,
|
|
1004
|
-
allowReferenceNumberReassignment
|
|
1005
|
-
});
|
|
1006
|
-
const linkTarget = resolveIncomingSyncLinkTarget(asset);
|
|
1007
|
-
reconcileWorkspaceSyncLinks(deps, {
|
|
1008
|
-
workspaceId,
|
|
1009
|
-
assetId: assetRecord.assetId,
|
|
1010
|
-
taskId: linkTarget?.targetType === 'task' ? linkTarget.targetId : null,
|
|
1011
|
-
linkTargetType: linkTarget?.targetType || null,
|
|
1012
|
-
linkTargetId: linkTarget?.targetId || null,
|
|
1013
|
-
displayName: typeof asset.caption === 'string' && asset.caption.trim().length > 0 ? asset.caption.trim() : null,
|
|
1014
|
-
role: asset.linkRole === 'reference' ? 'reference' : asset.kind === 'image' ? 'image' : 'attachment',
|
|
1015
|
-
updatedAt: effectiveUpdatedAt
|
|
1681
|
+
const { contentBase64: _contentBase64, ...bodylessAsset } = asset;
|
|
1682
|
+
persistWorkspaceSyncBinaryAssetMetadata(deps, {
|
|
1683
|
+
asset: bodylessAsset,
|
|
1684
|
+
normalizedPath,
|
|
1685
|
+
contentSha256,
|
|
1686
|
+
sizeBytes,
|
|
1687
|
+
storageProvider: objectStorageClient ? 'r2' : 'local',
|
|
1688
|
+
workspaceId,
|
|
1689
|
+
options,
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
function beginWorkspaceSyncBinaryAssetMetadataDeletion(deps, input) {
|
|
1693
|
+
const { normalizedPath, deletedAt, workspaceId = 'default', } = input;
|
|
1694
|
+
if (!canDeleteWorkspaceSyncBinaryAssetMetadata(deps, normalizedPath, workspaceId)) {
|
|
1695
|
+
deps.recordSyncDiagnostic(workspaceId, 'apply', 'Skipped deleting a referenced AI profile avatar asset.', {
|
|
1696
|
+
source: 'assets.delete.aiProfileAvatarReference',
|
|
1697
|
+
path: normalizedPath
|
|
1016
1698
|
});
|
|
1699
|
+
return null;
|
|
1017
1700
|
}
|
|
1018
|
-
|
|
1019
|
-
deps
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1701
|
+
return () => {
|
|
1702
|
+
runWorkspaceSyncContentMetadataMutation(deps, {
|
|
1703
|
+
workspaceId,
|
|
1704
|
+
kind: 'asset',
|
|
1705
|
+
logicalPath: normalizedPath,
|
|
1706
|
+
updatedAt: deletedAt,
|
|
1707
|
+
}, () => {
|
|
1708
|
+
if (!canDeleteWorkspaceSyncBinaryAssetMetadata(deps, normalizedPath, workspaceId))
|
|
1709
|
+
return;
|
|
1710
|
+
const existingCanonicalAsset = deps.workspaceAssetStore?.getByStorageKey(normalizedPath, workspaceId) || null;
|
|
1711
|
+
if (!deps.workspaceAssetStore || !existingCanonicalAsset)
|
|
1712
|
+
return;
|
|
1713
|
+
if ((input.strictOrdering === true
|
|
1714
|
+
|| hasPublishedWorkspaceSyncContentHead(deps, {
|
|
1715
|
+
workspaceId,
|
|
1716
|
+
kind: 'asset',
|
|
1717
|
+
logicalPath: normalizedPath,
|
|
1718
|
+
}))
|
|
1719
|
+
&&
|
|
1720
|
+
compareWorkspaceMutationOrdering(deletedAt, existingCanonicalAsset.updatedAt, `delete:${normalizedPath}`, existingCanonicalAsset.contentSha256) < 0)
|
|
1721
|
+
return;
|
|
1722
|
+
deps.workspaceAssetStore.markDeleted(existingCanonicalAsset.assetId, workspaceId, deletedAt);
|
|
1723
|
+
if (existingCanonicalAsset.kind === 'image') {
|
|
1724
|
+
deps.core.deleteAnnotatedAttachmentSessionsForImage({
|
|
1725
|
+
workspaceId,
|
|
1726
|
+
imageAssetId: existingCanonicalAsset.assetId,
|
|
1727
|
+
deletedAt,
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
const links = deps.workspaceAssetStore.listLinksForAsset(existingCanonicalAsset.assetId, workspaceId, { includeDeleted: true });
|
|
1731
|
+
for (const link of links) {
|
|
1732
|
+
deps.workspaceAssetStore.deleteLink({
|
|
1733
|
+
workspaceId,
|
|
1734
|
+
assetId: existingCanonicalAsset.assetId,
|
|
1735
|
+
targetType: link.targetType,
|
|
1736
|
+
targetId: link.targetId,
|
|
1737
|
+
role: link.role
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1025
1740
|
});
|
|
1026
|
-
}
|
|
1741
|
+
};
|
|
1742
|
+
}
|
|
1743
|
+
export function canDeleteWorkspaceSyncBinaryAssetMetadata(deps, normalizedPath, workspaceId = 'default') {
|
|
1744
|
+
return !listReferencedAiProfileAvatarAssets(deps, workspaceId).has(normalizedPath);
|
|
1745
|
+
}
|
|
1746
|
+
export function deleteWorkspaceSyncBinaryAssetMetadata(deps, input) {
|
|
1747
|
+
const complete = beginWorkspaceSyncBinaryAssetMetadataDeletion(deps, input);
|
|
1748
|
+
if (!complete)
|
|
1749
|
+
return false;
|
|
1750
|
+
complete();
|
|
1751
|
+
return true;
|
|
1027
1752
|
}
|
|
1028
1753
|
export function deleteWorkspaceSyncBinaryAsset(deps, basePath, assetPath, workspaceId = 'default') {
|
|
1029
1754
|
const normalizedPath = deps.normalizeTaskDataRelativePath(assetPath);
|
|
1030
1755
|
if (!normalizedPath)
|
|
1031
1756
|
return;
|
|
1757
|
+
const deletedAt = new Date().toISOString();
|
|
1758
|
+
const completeMetadataDeletion = beginWorkspaceSyncBinaryAssetMetadataDeletion(deps, {
|
|
1759
|
+
normalizedPath,
|
|
1760
|
+
deletedAt,
|
|
1761
|
+
workspaceId,
|
|
1762
|
+
});
|
|
1763
|
+
if (!completeMetadataDeletion)
|
|
1764
|
+
return;
|
|
1032
1765
|
const root = path.resolve(basePath);
|
|
1033
1766
|
const targetPath = path.resolve(root, normalizedPath);
|
|
1034
1767
|
const objectStorageClient = deps.getObjectStorageClient();
|
|
@@ -1048,29 +1781,72 @@ export function deleteWorkspaceSyncBinaryAsset(deps, basePath, assetPath, worksp
|
|
|
1048
1781
|
error: String(error?.message || error || '')
|
|
1049
1782
|
});
|
|
1050
1783
|
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1784
|
+
completeMetadataDeletion();
|
|
1785
|
+
}
|
|
1786
|
+
function beginWorkspaceSyncDocumentMetadataDeletion(deps, input) {
|
|
1787
|
+
const { normalizedPath, deletedAt, workspaceId = 'default', } = input;
|
|
1788
|
+
return () => {
|
|
1789
|
+
runWorkspaceSyncContentMetadataMutation(deps, {
|
|
1790
|
+
workspaceId,
|
|
1791
|
+
kind: 'document',
|
|
1792
|
+
logicalPath: normalizedPath,
|
|
1793
|
+
updatedAt: deletedAt,
|
|
1794
|
+
}, () => {
|
|
1795
|
+
const existingCanonicalAsset = deps.workspaceAssetStore?.getByStorageKey(normalizedPath, workspaceId) || null;
|
|
1796
|
+
const current = newestDocumentMetadata(deps.core.getDocumentWatermark(workspaceId, normalizedPath), existingCanonicalAsset);
|
|
1797
|
+
if ((input.strictOrdering === true
|
|
1798
|
+
|| hasPublishedWorkspaceSyncContentHead(deps, {
|
|
1058
1799
|
workspaceId,
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
})
|
|
1800
|
+
kind: 'document',
|
|
1801
|
+
logicalPath: normalizedPath,
|
|
1802
|
+
}))
|
|
1803
|
+
&&
|
|
1804
|
+
current
|
|
1805
|
+
&& compareWorkspaceMutationOrdering(deletedAt, current.updatedAt, `delete:${normalizedPath}`, current.contentHash) < 0)
|
|
1806
|
+
return;
|
|
1807
|
+
if (existingCanonicalAsset)
|
|
1808
|
+
deps.workspaceAssetStore.markDeleted(existingCanonicalAsset.assetId, workspaceId, deletedAt);
|
|
1809
|
+
if (input.strictWatermark === true) {
|
|
1810
|
+
deps.core.deleteDocumentWatermarkStrict(workspaceId, normalizedPath);
|
|
1062
1811
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
deps.workspaceAssetStore.deleteLink({
|
|
1066
|
-
workspaceId,
|
|
1067
|
-
assetId: existing.assetId,
|
|
1068
|
-
targetType: link.targetType,
|
|
1069
|
-
targetId: link.targetId,
|
|
1070
|
-
role: link.role
|
|
1071
|
-
});
|
|
1812
|
+
else {
|
|
1813
|
+
deps.core.deleteDocumentWatermark(workspaceId, normalizedPath);
|
|
1072
1814
|
}
|
|
1073
|
-
|
|
1815
|
+
if (deps.workspaceAssetStore && existingCanonicalAsset) {
|
|
1816
|
+
if (existingCanonicalAsset.kind === 'image') {
|
|
1817
|
+
deps.core.deleteAnnotatedAttachmentSessionsForImage({
|
|
1818
|
+
workspaceId,
|
|
1819
|
+
imageAssetId: existingCanonicalAsset.assetId,
|
|
1820
|
+
deletedAt,
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
const links = deps.workspaceAssetStore.listLinksForAsset(existingCanonicalAsset.assetId, workspaceId, { includeDeleted: true });
|
|
1824
|
+
for (const link of links) {
|
|
1825
|
+
deps.workspaceAssetStore.deleteLink({
|
|
1826
|
+
workspaceId,
|
|
1827
|
+
assetId: existingCanonicalAsset.assetId,
|
|
1828
|
+
targetType: link.targetType,
|
|
1829
|
+
targetId: link.targetId,
|
|
1830
|
+
role: link.role
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
});
|
|
1835
|
+
deps.workspaceDocumentSnapshotCache.get(workspaceId)?.delete(normalizedPath);
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
export function deleteWorkspaceSyncDocumentMetadata(deps, input) {
|
|
1839
|
+
const complete = beginWorkspaceSyncDocumentMetadataDeletion(deps, input);
|
|
1840
|
+
try {
|
|
1841
|
+
complete();
|
|
1842
|
+
}
|
|
1843
|
+
catch (error) {
|
|
1844
|
+
deps.recordSyncDiagnostic(input.workspaceId || 'default', 'apply', 'Failed to delete document watermark.', {
|
|
1845
|
+
source: 'documents.delete.watermark',
|
|
1846
|
+
path: input.normalizedPath,
|
|
1847
|
+
error: String(error?.message || error || '')
|
|
1848
|
+
});
|
|
1849
|
+
throw error;
|
|
1074
1850
|
}
|
|
1075
1851
|
}
|
|
1076
1852
|
export function deleteWorkspaceSyncDocument(deps, basePath, docPath, workspaceId = 'default') {
|
|
@@ -1081,6 +1857,12 @@ export function deleteWorkspaceSyncDocument(deps, basePath, docPath, workspaceId
|
|
|
1081
1857
|
const targetPath = path.resolve(root, normalizedPath);
|
|
1082
1858
|
if (targetPath !== root && !targetPath.startsWith(`${root}${path.sep}`))
|
|
1083
1859
|
return;
|
|
1860
|
+
const deletedAt = new Date().toISOString();
|
|
1861
|
+
const completeMetadataDeletion = beginWorkspaceSyncDocumentMetadataDeletion(deps, {
|
|
1862
|
+
normalizedPath,
|
|
1863
|
+
deletedAt,
|
|
1864
|
+
workspaceId,
|
|
1865
|
+
});
|
|
1084
1866
|
const objectStorageClient = deps.getObjectStorageClient();
|
|
1085
1867
|
try {
|
|
1086
1868
|
if (objectStorageClient) {
|
|
@@ -1098,31 +1880,7 @@ export function deleteWorkspaceSyncDocument(deps, basePath, docPath, workspaceId
|
|
|
1098
1880
|
});
|
|
1099
1881
|
}
|
|
1100
1882
|
try {
|
|
1101
|
-
|
|
1102
|
-
if (deps.workspaceAssetStore) {
|
|
1103
|
-
const existing = deps.workspaceAssetStore.getByStorageKey(normalizedPath, workspaceId);
|
|
1104
|
-
if (existing) {
|
|
1105
|
-
const deletedAt = new Date().toISOString();
|
|
1106
|
-
deps.workspaceAssetStore.markDeleted(existing.assetId, workspaceId, deletedAt);
|
|
1107
|
-
if (existing.kind === 'image') {
|
|
1108
|
-
deps.core.deleteAnnotatedAttachmentSessionsForImage({
|
|
1109
|
-
workspaceId,
|
|
1110
|
-
imageAssetId: existing.assetId,
|
|
1111
|
-
deletedAt,
|
|
1112
|
-
});
|
|
1113
|
-
}
|
|
1114
|
-
const links = deps.workspaceAssetStore.listLinksForAsset(existing.assetId, workspaceId, { includeDeleted: true });
|
|
1115
|
-
for (const link of links) {
|
|
1116
|
-
deps.workspaceAssetStore.deleteLink({
|
|
1117
|
-
workspaceId,
|
|
1118
|
-
assetId: existing.assetId,
|
|
1119
|
-
targetType: link.targetType,
|
|
1120
|
-
targetId: link.targetId,
|
|
1121
|
-
role: link.role
|
|
1122
|
-
});
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1883
|
+
completeMetadataDeletion();
|
|
1126
1884
|
}
|
|
1127
1885
|
catch (error) {
|
|
1128
1886
|
deps.recordSyncDiagnostic(workspaceId, 'apply', 'Failed to delete document watermark.', {
|
|
@@ -1130,11 +1888,13 @@ export function deleteWorkspaceSyncDocument(deps, basePath, docPath, workspaceId
|
|
|
1130
1888
|
path: normalizedPath,
|
|
1131
1889
|
error: String(error?.message || error || '')
|
|
1132
1890
|
});
|
|
1891
|
+
deps.workspaceDocumentSnapshotCache.get(workspaceId)?.delete(normalizedPath);
|
|
1133
1892
|
}
|
|
1134
|
-
deps.workspaceDocumentSnapshotCache.get(workspaceId)?.delete(normalizedPath);
|
|
1135
1893
|
}
|
|
1136
1894
|
export function createContentSyncState(deps) {
|
|
1137
1895
|
return {
|
|
1896
|
+
readWorkspaceSyncContentFrontier: (workspaceId = 'default') => readWorkspaceSyncContentFrontier(deps, workspaceId),
|
|
1897
|
+
hasWorkspaceSyncContentAfter: (workspaceId, cursor) => hasWorkspaceSyncContentAfter(deps, workspaceId, cursor),
|
|
1138
1898
|
resolveCanonicalAssetSyncLinkState: (asset, workspaceId) => resolveCanonicalAssetSyncLinkState(deps, asset, workspaceId),
|
|
1139
1899
|
getCanonicalSyncDocumentMetadata: (relativePath, workspaceId) => getCanonicalSyncDocumentMetadata(deps, relativePath, workspaceId),
|
|
1140
1900
|
hasDocumentSyncMetadataDrift: (workspaceId, doc, _options) => hasDocumentSyncMetadataDrift(deps, workspaceId, doc),
|
|
@@ -1150,6 +1910,46 @@ export function createContentSyncState(deps) {
|
|
|
1150
1910
|
listWorkspaceSyncBinaryAssetDeletesSnapshot: (workspaceId = 'default') => listWorkspaceSyncBinaryAssetDeletesSnapshot(deps, workspaceId),
|
|
1151
1911
|
writeWorkspaceSyncDocument: (basePath, doc, workspaceId = 'default', options) => writeWorkspaceSyncDocument(deps, basePath, doc, workspaceId, options),
|
|
1152
1912
|
writeWorkspaceSyncBinaryAsset: (basePath, asset, workspaceId = 'default', options) => writeWorkspaceSyncBinaryAsset(deps, basePath, asset, workspaceId, options),
|
|
1913
|
+
persistWorkspaceSyncDocumentMetadata: (document, workspaceId, metadata) => persistWorkspaceSyncDocumentMetadata(deps, {
|
|
1914
|
+
document,
|
|
1915
|
+
normalizedPath: document.path,
|
|
1916
|
+
contentSha256: metadata.contentSha256,
|
|
1917
|
+
sizeBytes: metadata.sizeBytes,
|
|
1918
|
+
storageProvider: metadata.storageProvider,
|
|
1919
|
+
workspaceId,
|
|
1920
|
+
options: {
|
|
1921
|
+
allowReferenceNumberReassignment: metadata.allowReferenceNumberReassignment,
|
|
1922
|
+
strictWatermark: metadata.strictWatermark,
|
|
1923
|
+
strictOrdering: metadata.strictOrdering,
|
|
1924
|
+
},
|
|
1925
|
+
}),
|
|
1926
|
+
persistWorkspaceSyncBinaryAssetMetadata: (asset, workspaceId, metadata) => persistWorkspaceSyncBinaryAssetMetadata(deps, {
|
|
1927
|
+
asset,
|
|
1928
|
+
normalizedPath: asset.path,
|
|
1929
|
+
contentSha256: metadata.contentSha256,
|
|
1930
|
+
sizeBytes: metadata.sizeBytes,
|
|
1931
|
+
storageProvider: metadata.storageProvider,
|
|
1932
|
+
workspaceId,
|
|
1933
|
+
options: {
|
|
1934
|
+
allowReferenceNumberReassignment: metadata.allowReferenceNumberReassignment,
|
|
1935
|
+
strictWatermark: metadata.strictWatermark,
|
|
1936
|
+
strictOrdering: metadata.strictOrdering,
|
|
1937
|
+
},
|
|
1938
|
+
}),
|
|
1939
|
+
deleteWorkspaceSyncBinaryAssetMetadata: (normalizedPath, workspaceId, deletedAt) => deleteWorkspaceSyncBinaryAssetMetadata(deps, {
|
|
1940
|
+
normalizedPath,
|
|
1941
|
+
workspaceId,
|
|
1942
|
+
deletedAt,
|
|
1943
|
+
strictOrdering: true,
|
|
1944
|
+
}),
|
|
1945
|
+
canDeleteWorkspaceSyncBinaryAssetMetadata: (normalizedPath, workspaceId) => canDeleteWorkspaceSyncBinaryAssetMetadata(deps, normalizedPath, workspaceId),
|
|
1946
|
+
deleteWorkspaceSyncDocumentMetadata: (normalizedPath, workspaceId, deletedAt) => deleteWorkspaceSyncDocumentMetadata(deps, {
|
|
1947
|
+
normalizedPath,
|
|
1948
|
+
workspaceId,
|
|
1949
|
+
deletedAt,
|
|
1950
|
+
strictWatermark: true,
|
|
1951
|
+
strictOrdering: true,
|
|
1952
|
+
}),
|
|
1153
1953
|
deleteWorkspaceSyncBinaryAsset: (basePath, assetPath, workspaceId = 'default') => deleteWorkspaceSyncBinaryAsset(deps, basePath, assetPath, workspaceId),
|
|
1154
1954
|
deleteWorkspaceSyncDocument: (basePath, docPath, workspaceId = 'default') => deleteWorkspaceSyncDocument(deps, basePath, docPath, workspaceId),
|
|
1155
1955
|
};
|