@taskforcehq/taskforce 0.3.304 → 0.3.306
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/README.md +140 -247
- package/dist/Taskforce.module.css +295 -89
- package/dist/TaskforceCore.js +378 -111
- package/dist/TaskforceCore.test.js +1221 -107
- package/dist/assets/fonts/CourierPrime-Bold.woff2 +0 -0
- package/dist/assets/fonts/CourierPrime-BoldItalic.woff2 +0 -0
- package/dist/assets/fonts/CourierPrime-Italic.woff2 +0 -0
- package/dist/assets/fonts/CourierPrime-Regular.woff2 +0 -0
- package/dist/assets/fonts/Noir_medium.woff2 +0 -0
- package/dist/assets/fonts/Noir_regular.woff2 +0 -0
- package/dist/assets/fonts/RussoOne-Regular.woff2 +0 -0
- package/dist/assets/fonts/SpecialElite-Regular.woff2 +0 -0
- package/dist/compat/workspaceSyncCompat.js +52 -2
- package/dist/compat/workspaceSyncCompat.test.js +38 -1
- package/dist/components/context/ContextAttachmentManager.d.ts +14 -0
- package/dist/components/context/ContextAttachmentManager.js +549 -0
- package/dist/components/features/AgentsModule.d.ts +10 -1
- package/dist/components/features/AgentsModule.js +260 -15
- package/dist/components/features/AgentsModule.test.js +255 -5
- package/dist/components/features/DocumentIndex.d.ts +1 -1
- package/dist/components/features/DocumentIndex.js +1 -1
- package/dist/components/features/DocumentViewer.d.ts +6 -2
- package/dist/components/features/DocumentViewer.js +90 -10
- package/dist/components/features/DocumentWorkspace.d.ts +5 -22
- package/dist/components/features/DocumentWorkspace.js +12 -155
- package/dist/components/features/DocumentWorkspace.test.js +226 -6
- package/dist/components/features/TaskSettings.js +29 -3
- package/dist/components/features/TaskSettings.test.js +42 -1
- package/dist/components/features/documentWorkspaceModel.d.ts +24 -0
- package/dist/components/features/documentWorkspaceModel.js +57 -0
- package/dist/components/features/useDocumentWorkspaceController.d.ts +34 -0
- package/dist/components/features/useDocumentWorkspaceController.js +113 -0
- package/dist/components/task/TaskCard.js +19 -28
- package/dist/components/task/TaskCard.test.js +38 -3
- package/dist/components/task/TaskContextUpload.js +4 -526
- package/dist/components/task/TaskForm.d.ts +8 -8
- package/dist/components/task/TaskForm.js +362 -230
- package/dist/components/task/TaskForm.test.js +558 -381
- package/dist/components/task/TaskKanban.d.ts +2 -1
- package/dist/components/task/TaskKanban.js +96 -14
- package/dist/components/task/TaskKanban.test.js +36 -0
- package/dist/components/ui/EditableAvatarButton.d.ts +18 -0
- package/dist/components/ui/EditableAvatarButton.js +18 -0
- package/dist/components/views/PlanComparisonPage.d.ts +9 -1
- package/dist/components/views/PlanComparisonPage.js +70 -17
- package/dist/components/views/PlanComparisonPage.test.js +289 -41
- package/dist/components/views/PlansPage.js +239 -106
- package/dist/components/views/PlansPage.test.js +593 -42
- package/dist/components/views/StandaloneLayout.js +310 -554
- package/dist/components/views/panels/FilterToolbar.test.js +6 -4
- package/dist/components/views/panels/PlanningDrawer.d.ts +8 -1
- package/dist/components/views/panels/PlanningDrawer.js +18 -11
- package/dist/components/views/panels/PlanningDrawer.test.d.ts +1 -0
- package/dist/components/views/panels/PlanningDrawer.test.js +141 -0
- package/dist/components/views/planningScope.d.ts +20 -0
- package/dist/components/views/planningScope.js +25 -0
- package/dist/components/views/planningScope.test.d.ts +1 -0
- package/dist/components/views/planningScope.test.js +60 -0
- package/dist/components/views/standalone/modals/AccountHubModal.d.ts +27 -14
- package/dist/components/views/standalone/modals/AccountHubModal.js +87 -15
- package/dist/components/views/standalone/modals/AccountHubModal.test.js +42 -2
- package/dist/components/views/standalone/modals/AvatarImageManagerModal.d.ts +20 -0
- package/dist/components/views/standalone/modals/AvatarImageManagerModal.js +127 -0
- package/dist/components/views/standalone/modals/EditProfileModal.d.ts +2 -9
- package/dist/components/views/standalone/modals/EditProfileModal.js +3 -2
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.d.ts +9 -0
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.js +6 -0
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.test.d.ts +1 -0
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.test.js +24 -0
- package/dist/components/views/standalone/modals/SyncStatusModal.d.ts +2 -1
- package/dist/components/views/standalone/modals/SyncStatusModal.js +2 -2
- package/dist/config/envSchema.js +1 -1
- package/dist/core/AiProfileService.d.ts +45 -3
- package/dist/core/AiProfileService.js +774 -63
- package/dist/core/AiProfileService.test.js +22 -2
- package/dist/core/AiProfiles.test.js +761 -2
- package/dist/core/AttachmentLinkService.js +57 -15
- package/dist/core/AuthIdentityService.d.ts +107 -0
- package/dist/core/AuthIdentityService.js +284 -0
- package/dist/core/AuthTokenService.d.ts +4 -0
- package/dist/core/AuthTokenService.js +34 -6
- package/dist/core/AuthTokenService.test.d.ts +1 -0
- package/dist/core/AuthTokenService.test.js +78 -0
- package/dist/core/EntitlementsPolicy.test.js +77 -15
- package/dist/core/GlobalSettingsService.js +115 -6
- package/dist/core/PlanEntitlementService.d.ts +30 -3
- package/dist/core/PlanEntitlementService.js +454 -93
- package/dist/core/PlanFeatureCatalog.test.d.ts +1 -0
- package/dist/core/PlanFeatureCatalog.test.js +84 -0
- package/dist/core/PlanVersionPolicy.test.js +54 -28
- package/dist/core/PlanningEntities.test.js +52 -0
- package/dist/core/SignupMonetizationSettings.test.js +241 -44
- package/dist/core/SyncReconciliationService.js +2 -65
- package/dist/core/SystemAdmin.test.js +244 -88
- package/dist/core/TaskAttachmentsCanonical.test.js +51 -1
- package/dist/core/TaskTaxonomyValidation.test.js +53 -0
- package/dist/core/Taskforce.d.ts +228 -14
- package/dist/core/Taskforce.js +814 -201
- package/dist/core/Taskforce.listTasksSlim.test.d.ts +1 -0
- package/dist/core/Taskforce.listTasksSlim.test.js +91 -0
- package/dist/core/UserProfileAvatarDrafts.test.js +30 -3
- package/dist/core/WorkspaceLifecycleService.js +0 -5
- package/dist/core/WorkspacePermissions.test.js +25 -1
- package/dist/core/WorkspacePlanMode.test.js +128 -27
- package/dist/core/shared.d.ts +3 -1
- package/dist/core/shared.js +16 -1
- package/dist/core/types.d.ts +68 -2
- package/dist/hooks/auth/useTaskforceAuthBootstrap.js +26 -1
- package/dist/hooks/sync/auth.js +3 -1
- package/dist/hooks/sync/bootstrap.js +2 -0
- package/dist/hooks/sync/controlPlane.d.ts +37 -0
- package/dist/hooks/sync/controlPlane.js +78 -0
- package/dist/hooks/sync/controlPlane.test.d.ts +1 -0
- package/dist/hooks/sync/controlPlane.test.js +121 -0
- package/dist/hooks/sync/lifecyclePolicy.d.ts +45 -0
- package/dist/hooks/sync/lifecyclePolicy.js +93 -0
- package/dist/hooks/sync/lifecyclePolicy.test.d.ts +1 -0
- package/dist/hooks/sync/lifecyclePolicy.test.js +124 -0
- package/dist/hooks/sync/orchestratorShared.d.ts +10 -1
- package/dist/hooks/sync/orchestratorShared.js +68 -47
- package/dist/hooks/sync/orchestratorShared.test.js +50 -1
- package/dist/hooks/sync/pullLifecycle.d.ts +31 -0
- package/dist/hooks/sync/pullLifecycle.js +24 -0
- package/dist/hooks/sync/pullLifecycle.test.d.ts +1 -0
- package/dist/hooks/sync/pullLifecycle.test.js +80 -0
- package/dist/hooks/sync/recovery.d.ts +16 -2
- package/dist/hooks/sync/recovery.js +171 -53
- package/dist/hooks/sync/recovery.test.d.ts +1 -0
- package/dist/hooks/sync/recovery.test.js +292 -0
- package/dist/hooks/sync/transfers.d.ts +16 -3
- package/dist/hooks/sync/transfers.js +186 -65
- package/dist/hooks/sync/transfers.test.d.ts +1 -0
- package/dist/hooks/sync/transfers.test.js +396 -0
- package/dist/hooks/sync/useRecentSyncEvents.d.ts +21 -0
- package/dist/hooks/sync/useRecentSyncEvents.js +92 -0
- package/dist/hooks/sync/useRecentSyncEvents.test.d.ts +1 -0
- package/dist/hooks/sync/useRecentSyncEvents.test.js +124 -0
- package/dist/hooks/sync/useSyncStatusActions.d.ts +30 -0
- package/dist/hooks/sync/useSyncStatusActions.js +88 -0
- package/dist/hooks/sync/useSyncStatusActions.test.d.ts +1 -0
- package/dist/hooks/sync/useSyncStatusActions.test.js +133 -0
- package/dist/hooks/sync/useSyncStatusControls.d.ts +25 -0
- package/dist/hooks/sync/useSyncStatusControls.js +60 -0
- package/dist/hooks/sync/useSyncStatusControls.test.d.ts +1 -0
- package/dist/hooks/sync/useSyncStatusControls.test.js +88 -0
- package/dist/hooks/useSyncOrchestrator.aiProfiles.test.js +12 -0
- package/dist/hooks/useSyncOrchestrator.d.ts +16 -6
- package/dist/hooks/useSyncOrchestrator.js +424 -175
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +487 -10
- package/dist/hooks/useTaskData.js +8 -3
- package/dist/hooks/useTaskData.test.js +45 -0
- package/dist/hooks/useTaskMutations.d.ts +2 -1
- package/dist/hooks/useTaskMutations.js +12 -1
- package/dist/hooks/useTaskMutations.test.js +30 -1
- package/dist/hooks/useTaskforce.d.ts +65 -4
- package/dist/hooks/useTaskforce.js +564 -243
- package/dist/hooks/useTaskforce.runtime-routing.test.d.ts +1 -0
- package/dist/hooks/useTaskforce.runtime-routing.test.js +152 -0
- package/dist/hooks/useTaskforce.sync-behavior.test.js +2454 -208
- package/dist/hooks/useWorkspaceSyncController.d.ts +4 -1
- package/dist/hooks/useWorkspaceSyncController.js +17 -2
- package/dist/hooks/useWorkspaceSyncController.test.js +1 -0
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.d.ts +16 -0
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.js +316 -35
- package/dist/localization/locales/en-US.d.ts +0 -1
- package/dist/localization/locales/en-US.js +0 -1
- package/dist/localization/locales/es-419.js +0 -1
- package/dist/localization/locales/pt-BR.js +0 -1
- package/dist/mcp/adminWorkspaceRegistrar.d.ts +2 -0
- package/dist/mcp/adminWorkspaceRegistrar.js +154 -0
- package/dist/mcp/collaborationRegistrar.d.ts +2 -0
- package/dist/mcp/collaborationRegistrar.js +71 -0
- package/dist/mcp/documentAssetRegistrar.d.ts +2 -0
- package/dist/mcp/documentAssetRegistrar.js +346 -0
- package/dist/mcp/runtime.d.ts +2 -0
- package/dist/mcp/runtime.js +2433 -3534
- package/dist/mcp/runtime.test.js +440 -2
- package/dist/mcp/taskPlanningRegistrar.d.ts +2 -0
- package/dist/mcp/taskPlanningRegistrar.js +418 -0
- package/dist/mcp/toolCatalog.d.ts +35 -0
- package/dist/mcp/toolCatalog.js +3 -0
- package/dist/migrations/taskSchemaMigrations.d.ts +1 -1
- package/dist/migrations/taskSchemaMigrations.js +171 -61
- package/dist/migrations/taskSchemaMigrations.test.js +15 -0
- package/dist/resources/templates/workflow-sources/workflowDocs.mjs +6 -6
- package/dist/resources/templates/workflows/collaborate.yaml +1 -1
- package/dist/resources/templates/workflows/evaluate.yaml +2 -2
- package/dist/resources/templates/workflows/plan.yaml +1 -1
- package/dist/resources/templates/workflows/review.yaml +2 -2
- package/dist/server/annotatedAttachmentsRoutes.test.js +3 -3
- package/dist/server/auth/providers/apple.d.ts +33 -0
- package/dist/server/auth/providers/apple.js +82 -0
- package/dist/server/auth/providers/appleClientSecret.d.ts +37 -0
- package/dist/server/auth/providers/appleClientSecret.js +65 -0
- package/dist/server/auth/providers/github.d.ts +26 -0
- package/dist/server/auth/providers/github.js +86 -0
- package/dist/server/auth/providers/google.d.ts +21 -0
- package/dist/server/auth/providers/google.js +56 -0
- package/dist/server/auth/providers/types.d.ts +21 -0
- package/dist/server/auth/providers/types.js +1 -0
- package/dist/server/auth.d.ts +2 -0
- package/dist/server/auth.js +6 -3
- package/dist/server/documentReviewRoutes.test.js +36 -3
- package/dist/server/index.cookieProxy.test.js +1 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.js +120 -9
- package/dist/server/index.rateLimit.test.js +3 -0
- package/dist/server/index.test.js +106 -3
- package/dist/server/routes/admin.d.ts +4 -5
- package/dist/server/routes/admin.js +410 -80
- package/dist/server/routes/annotatedAttachments.d.ts +1 -1
- package/dist/server/routes/annotatedAttachments.js +1 -1
- package/dist/server/routes/auth.d.ts +16 -6
- package/dist/server/routes/auth.js +1015 -118
- package/dist/server/routes/authSupport.d.ts +30 -0
- package/dist/server/routes/authSupport.js +81 -0
- package/dist/server/routes/billing.d.ts +1 -1
- package/dist/server/routes/billing.js +276 -34
- package/dist/server/routes/billing.test.js +760 -52
- package/dist/server/routes/documentReviews.d.ts +1 -1
- package/dist/server/routes/documentReviews.js +1 -1
- package/dist/server/routes/documents.d.ts +5 -2
- package/dist/server/routes/documents.js +242 -74
- package/dist/server/routes/primitives.d.ts +11 -0
- package/dist/server/routes/primitives.js +73 -0
- package/dist/server/routes/resources.d.ts +1 -1
- package/dist/server/routes/resources.js +1 -1
- package/dist/server/routes/shared.d.ts +29 -3
- package/dist/server/routes/shared.js +69 -4
- package/dist/server/routes/sync.d.ts +1 -1
- package/dist/server/routes/sync.integration.test.js +437 -39
- package/dist/server/routes/sync.js +62 -606
- package/dist/server/routes/syncAuxRoutes.d.ts +15 -0
- package/dist/server/routes/syncAuxRoutes.js +91 -0
- package/dist/server/routes/syncAuxRoutes.test.d.ts +1 -0
- package/dist/server/routes/syncAuxRoutes.test.js +158 -0
- package/dist/server/routes/syncPullApplyRoutes.d.ts +36 -0
- package/dist/server/routes/syncPullApplyRoutes.js +204 -0
- package/dist/server/routes/syncPushRoutes.d.ts +24 -0
- package/dist/server/routes/syncPushRoutes.js +212 -0
- package/dist/server/routes/syncRouteGuards.d.ts +36 -0
- package/dist/server/routes/syncRouteGuards.js +67 -0
- package/dist/server/routes/syncRouteGuards.test.d.ts +1 -0
- package/dist/server/routes/syncRouteGuards.test.js +94 -0
- package/dist/server/routes/syncRouteTypes.d.ts +13 -0
- package/dist/server/routes/syncRouteTypes.js +1 -0
- package/dist/server/routes/syncSnapshotRoutes.d.ts +66 -0
- package/dist/server/routes/syncSnapshotRoutes.js +180 -0
- package/dist/server/routes/tasks.d.ts +1 -1
- package/dist/server/routes/tasks.js +44 -2
- package/dist/server/routes/workspaces.d.ts +1 -1
- package/dist/server/routes/workspaces.js +37 -6
- package/dist/server/routes.d.ts +2 -9
- package/dist/server/routes.js +136 -165
- package/dist/server/routes.test.js +2457 -162
- package/dist/services/workflowExportSnapshots.test.js +2 -0
- package/dist/shared/aiProfileSeatScope.d.ts +5 -0
- package/dist/shared/aiProfileSeatScope.js +21 -0
- package/dist/shared/passwordPolicy.d.ts +13 -0
- package/dist/shared/passwordPolicy.js +84 -0
- package/dist/shared/passwordPolicy.test.d.ts +1 -0
- package/dist/shared/passwordPolicy.test.js +34 -0
- package/dist/storage/workspaceAssetStore.d.ts +15 -3
- package/dist/storage/workspaceAssetStore.js +132 -44
- package/dist/storage/workspaceAssetStore.test.js +93 -6
- package/dist/styles/fonts.css +70 -0
- package/dist/sync/collaborationSyncPayload.d.ts +6 -1
- package/dist/sync/collaborationSyncPayload.js +17 -11
- package/dist/sync/collaborationSyncPayload.test.js +13 -1
- package/dist/sync/contentSyncState.d.ts +4 -8
- package/dist/sync/contentSyncState.js +33 -77
- package/dist/sync/syncApplyHandlers.d.ts +7 -0
- package/dist/sync/syncApplyHandlers.js +28 -13
- package/dist/sync/syncApplyHandlers.test.js +72 -3
- package/dist/sync/syncFieldSemantics.d.ts +12 -0
- package/dist/sync/syncFieldSemantics.js +55 -0
- package/dist/sync/syncResourceAdapters.d.ts +44 -0
- package/dist/sync/syncResourceAdapters.js +77 -0
- package/dist/sync/syncService.d.ts +6 -0
- package/dist/sync/syncService.js +60 -0
- package/dist/sync/syncService.test.js +71 -3
- package/dist/sync/taskSyncChangeKey.d.ts +2 -0
- package/dist/sync/taskSyncChangeKey.js +143 -0
- package/dist/sync/taskSyncPayload.js +3 -8
- package/dist/sync/workspacePullFeed.js +4 -3
- package/dist/sync/workspacePullFeed.test.js +43 -0
- package/dist/sync/workspaceRepair.js +5 -2
- package/dist/sync/workspaceSyncModel.d.ts +48 -0
- package/dist/sync/workspaceSyncModel.js +195 -31
- package/dist/sync/workspaceSyncModel.test.js +325 -12
- package/dist/sync/workspaceSyncState.d.ts +19 -0
- package/dist/sync/workspaceSyncState.js +3 -1
- package/dist/sync/workspaceSyncSurface.js +3 -8
- package/dist/types.d.ts +17 -0
- package/dist/ui/assets/AgentsModule-DrLawwNl.js +1 -0
- package/dist/ui/assets/{AnnotatedAttachmentWorkspace-BlS-cqnl.js → AnnotatedAttachmentWorkspace-Z9_whf7F.js} +1 -1
- package/dist/ui/assets/CourierPrime-Bold-BuLj_dpw.woff2 +0 -0
- package/dist/ui/assets/CourierPrime-BoldItalic-BrK2pUkZ.woff2 +0 -0
- package/dist/ui/assets/CourierPrime-Italic-DFUZK5Ey.woff2 +0 -0
- package/dist/ui/assets/CourierPrime-Regular-BsKphzVf.woff2 +0 -0
- package/dist/ui/assets/DocumentWorkspace-B03MaSkw.js +252 -0
- package/dist/ui/assets/DocumentWorkspace-Dhdso07p.css +1 -0
- package/dist/ui/assets/{InitiativesModule-BjR6iBf9.js → InitiativesModule-9E6ParrY.js} +1 -1
- package/dist/ui/assets/Noir_medium-bxQwKGzB.woff2 +0 -0
- package/dist/ui/assets/Noir_regular-ojf2kxlG.woff2 +0 -0
- package/dist/ui/assets/PlansPage-CvfnMiWq.css +1 -0
- package/dist/ui/assets/PlansPage-DRXscYxH.js +1 -0
- package/dist/ui/assets/RussoOne-Regular-Cu_qq_qC.woff2 +0 -0
- package/dist/ui/assets/SpecialElite-Regular-Di6gSvAS.woff2 +0 -0
- package/dist/ui/assets/TaskSettings-DZX4jk7e.js +9 -0
- package/dist/ui/assets/{WorkflowsModule-DnFqdUME.js → WorkflowsModule-BA7jcEpH.js} +1 -1
- package/dist/ui/assets/index-9eT8e0Lu.css +1 -0
- package/dist/ui/assets/index-C6k75jr8.js +6 -0
- package/dist/ui/assets/{vendor-icons-I7ZwG1z_.js → vendor-icons-DuEd_65c.js} +1 -1
- package/dist/ui/fonts/CourierPrime-Bold.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-Bold.woff2 +0 -0
- package/dist/ui/fonts/CourierPrime-BoldItalic.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-BoldItalic.woff2 +0 -0
- package/dist/ui/fonts/CourierPrime-Italic.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-Italic.woff2 +0 -0
- package/dist/ui/fonts/CourierPrime-Regular.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-Regular.woff2 +0 -0
- package/dist/ui/fonts/Noir_medium.otf +0 -0
- package/dist/ui/fonts/Noir_medium.woff2 +0 -0
- package/dist/ui/fonts/Noir_regular.otf +0 -0
- package/dist/ui/fonts/Noir_regular.woff2 +0 -0
- package/dist/ui/fonts/RussoOne-Regular.woff2 +0 -0
- package/dist/ui/fonts/SpecialElite-Regular.ttf +0 -0
- package/dist/ui/fonts/SpecialElite-Regular.woff2 +0 -0
- package/dist/ui/index.html +3 -3
- package/dist/utils/accountProfileSummaryCache.d.ts +5 -0
- package/dist/utils/assignees.d.ts +2 -0
- package/dist/utils/assignees.js +2 -0
- package/dist/utils/avatarUpload.d.ts +27 -0
- package/dist/utils/avatarUpload.js +132 -0
- package/dist/utils/avatarUpload.test.d.ts +1 -0
- package/dist/utils/avatarUpload.test.js +40 -0
- package/dist/utils/bootstrapTrace.d.ts +7 -0
- package/dist/utils/bootstrapTrace.js +29 -0
- package/dist/utils/commercialLifecyclePresentation.d.ts +19 -0
- package/dist/utils/commercialLifecyclePresentation.js +199 -0
- package/dist/utils/contextAssetEvents.d.ts +2 -0
- package/dist/utils/syncEventDetails.d.ts +3 -0
- package/dist/utils/syncEventDetails.js +64 -0
- package/dist/utils/syncEventDetails.test.d.ts +1 -0
- package/dist/utils/syncEventDetails.test.js +23 -0
- package/dist/utils/syncEventPresentation.d.ts +15 -0
- package/dist/utils/syncEventPresentation.js +129 -0
- package/dist/utils/syncEventPresentation.test.d.ts +1 -0
- package/dist/utils/syncEventPresentation.test.js +64 -0
- package/dist/utils/syncStatusPresentation.d.ts +72 -0
- package/dist/utils/syncStatusPresentation.js +217 -0
- package/dist/utils/syncStatusPresentation.test.d.ts +1 -0
- package/dist/utils/syncStatusPresentation.test.js +164 -0
- package/dist/utils/taskActivity.d.ts +2 -0
- package/dist/utils/taskActivity.js +228 -22
- package/dist/utils/taskActivity.test.js +119 -8
- package/dist/utils/workspaceSyncPresentation.d.ts +4 -0
- package/dist/utils/workspaceSyncPresentation.js +68 -2
- package/dist/utils/workspaceSyncPresentation.test.js +36 -1
- package/package.json +10 -2
- package/scripts/check-cloud-mcp.mjs +83 -0
- package/scripts/export-sqlite-to-postgres.mjs +7 -9
- package/scripts/playwright-auth.sh +5 -1
- package/scripts/run-billing-performance-smoke.sh +24 -0
- package/scripts/run-e2e-realtime.sh +17 -3
- package/scripts/run-smoke.sh +17 -5
- package/scripts/run-soak.sh +17 -5
- package/src/resources/templates/workflow-sources/workflowDocs.mjs +6 -6
- package/src/resources/templates/workflows/collaborate.yaml +1 -1
- package/src/resources/templates/workflows/evaluate.yaml +2 -2
- package/src/resources/templates/workflows/plan.yaml +1 -1
- package/src/resources/templates/workflows/review.yaml +2 -2
- package/dist/ui/assets/AgentsModule-BLWVbuKP.js +0 -1
- package/dist/ui/assets/DocumentWorkspace-BH_6DF6x.js +0 -250
- package/dist/ui/assets/DocumentWorkspace-C_8T8oz-.css +0 -1
- package/dist/ui/assets/PlansPage-C2dd2n1X.css +0 -1
- package/dist/ui/assets/PlansPage-CSDQ4sLa.js +0 -1
- package/dist/ui/assets/RussoOne-Regular-C3BxZIj7.ttf +0 -0
- package/dist/ui/assets/TaskSettings-CEDy34Jo.js +0 -9
- package/dist/ui/assets/index-DXUdtH1B.js +0 -6
- package/dist/ui/assets/index-Ii0B0rTO.css +0 -1
- package/scripts/migrate-planning-model.ts +0 -233
|
@@ -1,14 +1,81 @@
|
|
|
1
1
|
import { resolveRepairPhase } from './bootstrap';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { resolveRetrySyncReadiness } from './controlPlane';
|
|
3
|
+
function resetWorkspaceSyncStatePushBaselines(args) {
|
|
4
|
+
args.workspaceLastPushedWatermarksRef.current = new Map();
|
|
5
|
+
args.workspaceLastPushedTaskChangeKeysRef.current = new Map();
|
|
6
|
+
args.workspaceLastPushedInitiativeIdsRef.current = new Set();
|
|
7
|
+
args.workspaceLastPushedInitiativeWatermarksRef.current = new Map();
|
|
8
|
+
args.workspaceLastPushedWorkstreamIdsRef.current = new Set();
|
|
9
|
+
args.workspaceLastPushedWorkstreamWatermarksRef.current = new Map();
|
|
10
|
+
args.workspaceLastPushedAiProfileIdsRef.current = new Set();
|
|
11
|
+
args.workspaceLastPushedAiProfileWatermarksRef.current = new Map();
|
|
12
|
+
args.workspaceLastPushedAiProfileChangeKeysRef.current = new Map();
|
|
13
|
+
args.workspaceBaselineResetReasonRef.current = 'repair-reset';
|
|
14
|
+
}
|
|
15
|
+
function resetAllWorkspacePushBaselines(args) {
|
|
16
|
+
resetWorkspaceSyncStatePushBaselines(args);
|
|
17
|
+
args.workspaceLastPushedDocumentPathsRef.current = new Set();
|
|
18
|
+
args.workspaceLastPushedDocumentWatermarksRef.current = new Map();
|
|
19
|
+
args.workspaceLastPushedAssetPathsRef.current = new Set();
|
|
20
|
+
args.workspaceLastPushedAssetWatermarksRef.current = new Map();
|
|
21
|
+
args.workspaceLastPushedDocumentReviewSessionIdsRef.current = new Set();
|
|
22
|
+
args.workspaceLastPushedDocumentReviewSessionWatermarksRef.current = new Map();
|
|
23
|
+
args.workspaceLastPushedDocumentReviewCommentIdsRef.current = new Set();
|
|
24
|
+
args.workspaceLastPushedDocumentReviewCommentWatermarksRef.current = new Map();
|
|
25
|
+
args.workspaceLastPushedAnnotatedAttachmentSessionIdsRef.current = new Set();
|
|
26
|
+
args.workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef.current = new Map();
|
|
27
|
+
args.workspaceLastPushedTaskEventWatermarksRef.current = new Map();
|
|
28
|
+
}
|
|
29
|
+
export function createSyncRecoveryCoordinator({ currentWorkspaceId, workspaceCloudSyncEnabled, workspaceSyncPhase, workspaceLastPullAt, lastBootstrapPhaseRef, workspaceRepairModeRef, workspaceForceFullAiProfilePushRef, workspaceStartupRepairRanRef, workspaceStartupFullReconcileRanRef, workspaceFullReconcileInFlightRef, workspacePullCursorRef, workspaceAttachBootstrapBaselineSignatureRef, workspaceCaptureAttachBootstrapBaselineRef, workspacePendingSignatureRef, workspaceLastPushedSignatureRef, workspaceLastPushedWatermarksRef, workspaceLastPushedTaskChangeKeysRef, workspaceLastPushedInitiativeIdsRef, workspaceLastPushedInitiativeWatermarksRef, workspaceLastPushedWorkstreamIdsRef, workspaceLastPushedWorkstreamWatermarksRef, workspaceLastPushedAiProfileIdsRef, workspaceLastPushedAiProfileWatermarksRef, workspaceLastPushedAiProfileChangeKeysRef, workspaceLastPushedDocumentPathsRef, workspaceLastPushedDocumentWatermarksRef, workspaceLastPushedAssetPathsRef, workspaceLastPushedAssetWatermarksRef, workspaceLastPushedDocumentReviewSessionIdsRef, workspaceLastPushedDocumentReviewSessionWatermarksRef, workspaceLastPushedDocumentReviewCommentIdsRef, workspaceLastPushedDocumentReviewCommentWatermarksRef, workspaceLastPushedAnnotatedAttachmentSessionIdsRef, workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef, workspaceLastPushedTaskEventWatermarksRef, workspaceBaselineResetReasonRef, bootstrapPhaseStartedAtRef, bootstrapLastProgressAtRef, acquireWorkspaceSyncLease, releaseWorkspaceSyncLease, forceClearWorkspaceSyncLease, clearWorkspaceRetry, clearWorkspaceIssue, reportWorkspaceWindowContention, reportSyncEvent, persistWorkspaceSyncPatch, persistWorkspaceSyncWatermarksSnapshotBestEffort, buildWorkspaceSyncSignature, pullWorkspaceChangesFromCloud, pushWorkspaceChangesToCloud, cloudAuthConfigured, runtimeMode, isAuthenticated, checkAuthSession }) {
|
|
30
|
+
const retryEventType = workspaceSyncPhase === 'provision-local'
|
|
31
|
+
? 'push'
|
|
32
|
+
: workspaceSyncPhase === 'attach-cloud'
|
|
33
|
+
? 'bootstrap'
|
|
34
|
+
: 'pull';
|
|
4
35
|
const retryWorkspaceCloudSync = async () => {
|
|
5
36
|
clearWorkspaceRetry();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
37
|
+
let retryReadiness = resolveRetrySyncReadiness({
|
|
38
|
+
cloudAuthConfigured,
|
|
39
|
+
runtimeMode,
|
|
40
|
+
workspaceCloudSyncEnabled,
|
|
41
|
+
currentWorkspaceId,
|
|
42
|
+
isAuthenticated
|
|
43
|
+
});
|
|
44
|
+
if (!retryReadiness.allowed && retryReadiness.reason === 'auth-required') {
|
|
9
45
|
const authed = await checkAuthSession();
|
|
10
|
-
if (!authed)
|
|
46
|
+
if (!authed) {
|
|
47
|
+
reportSyncEvent(currentWorkspaceId, {
|
|
48
|
+
eventType: retryEventType,
|
|
49
|
+
status: 'error',
|
|
50
|
+
errorMessage: 'Manual sync retry blocked: sign in is required.',
|
|
51
|
+
details: {
|
|
52
|
+
source: 'retry.blocked',
|
|
53
|
+
reason: 'auth-required',
|
|
54
|
+
phase: workspaceSyncPhase
|
|
55
|
+
}
|
|
56
|
+
});
|
|
11
57
|
return false;
|
|
58
|
+
}
|
|
59
|
+
retryReadiness = resolveRetrySyncReadiness({
|
|
60
|
+
cloudAuthConfigured,
|
|
61
|
+
runtimeMode,
|
|
62
|
+
workspaceCloudSyncEnabled,
|
|
63
|
+
currentWorkspaceId,
|
|
64
|
+
isAuthenticated: true
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (!retryReadiness.allowed) {
|
|
68
|
+
reportSyncEvent(currentWorkspaceId, {
|
|
69
|
+
eventType: retryEventType,
|
|
70
|
+
status: 'error',
|
|
71
|
+
errorMessage: `Manual sync retry blocked: ${retryReadiness.reason}.`,
|
|
72
|
+
details: {
|
|
73
|
+
source: 'retry.blocked',
|
|
74
|
+
reason: retryReadiness.reason,
|
|
75
|
+
phase: workspaceSyncPhase
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return false;
|
|
12
79
|
}
|
|
13
80
|
workspaceForceFullAiProfilePushRef.current = true;
|
|
14
81
|
if (workspaceSyncPhase === 'provision-local') {
|
|
@@ -37,60 +104,104 @@ export function createSyncRecoveryCoordinator({ currentWorkspaceId, taxonomyStat
|
|
|
37
104
|
const reclaimed = await acquireWorkspaceSyncLease(currentWorkspaceId, 'repair');
|
|
38
105
|
if (!reclaimed) {
|
|
39
106
|
reportWorkspaceWindowContention('repair');
|
|
107
|
+
reportSyncEvent(currentWorkspaceId, {
|
|
108
|
+
eventType: 'bootstrap',
|
|
109
|
+
status: 'error',
|
|
110
|
+
errorMessage: 'Manual sync repair blocked because another window is already syncing this workspace.',
|
|
111
|
+
details: {
|
|
112
|
+
source: 'repair.blocked',
|
|
113
|
+
reason: 'lease-held',
|
|
114
|
+
phase: workspaceSyncPhase
|
|
115
|
+
}
|
|
116
|
+
});
|
|
40
117
|
return;
|
|
41
118
|
}
|
|
42
119
|
}
|
|
120
|
+
const repairPhase = resolveRepairPhase({
|
|
121
|
+
workspaceSyncPhase,
|
|
122
|
+
lastBootstrapPhase: lastBootstrapPhaseRef.current,
|
|
123
|
+
workspaceLastPullAt
|
|
124
|
+
});
|
|
125
|
+
const shouldResetAllPushBaselines = repairPhase === 'provision-local';
|
|
126
|
+
const shouldResetSyncStatePushBaselines = repairPhase === 'active';
|
|
43
127
|
clearWorkspaceRetry();
|
|
44
128
|
clearWorkspaceIssue();
|
|
45
|
-
bootstrapPhaseStartedAtRef.current = null;
|
|
46
|
-
bootstrapLastProgressAtRef.current = null;
|
|
47
|
-
workspacePullCursorRef.current = null;
|
|
48
|
-
workspaceAttachBootstrapBaselineSignatureRef.current = '';
|
|
49
|
-
workspaceCaptureAttachBootstrapBaselineRef.current = false;
|
|
50
|
-
workspacePendingSignatureRef.current = '';
|
|
51
|
-
workspaceLastPushedSignatureRef.current = '';
|
|
52
|
-
workspaceLastPushedWatermarksRef.current = new Map();
|
|
53
|
-
workspaceLastPushedInitiativeIdsRef.current = new Set();
|
|
54
|
-
workspaceLastPushedInitiativeWatermarksRef.current = new Map();
|
|
55
|
-
workspaceLastPushedWorkstreamIdsRef.current = new Set();
|
|
56
|
-
workspaceLastPushedWorkstreamWatermarksRef.current = new Map();
|
|
57
|
-
workspaceLastPushedAiProfileIdsRef.current = new Set();
|
|
58
|
-
workspaceLastPushedAiProfileWatermarksRef.current = new Map();
|
|
59
|
-
workspaceLastPushedDocumentPathsRef.current = new Set();
|
|
60
|
-
workspaceLastPushedDocumentWatermarksRef.current = new Map();
|
|
61
|
-
workspaceLastPushedAssetPathsRef.current = new Set();
|
|
62
|
-
workspaceLastPushedAssetWatermarksRef.current = new Map();
|
|
63
|
-
workspaceLastPushedDocumentReviewSessionIdsRef.current = new Set();
|
|
64
|
-
workspaceLastPushedDocumentReviewSessionWatermarksRef.current = new Map();
|
|
65
|
-
workspaceLastPushedDocumentReviewCommentIdsRef.current = new Set();
|
|
66
|
-
workspaceLastPushedDocumentReviewCommentWatermarksRef.current = new Map();
|
|
67
|
-
workspaceLastPushedAnnotatedAttachmentSessionIdsRef.current = new Set();
|
|
68
|
-
workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef.current = new Map();
|
|
69
|
-
workspaceLastPushedTaskEventWatermarksRef.current = new Map();
|
|
70
|
-
workspaceForceFullAiProfilePushRef.current = false;
|
|
71
|
-
workspaceStartupRepairRanRef.current = false;
|
|
72
|
-
workspaceStartupFullReconcileRanRef.current = false;
|
|
73
|
-
workspaceFullReconcileInFlightRef.current = false;
|
|
74
|
-
savePersistedSyncWatermarks(currentWorkspaceId, {
|
|
75
|
-
taskWatermarks: new Map(),
|
|
76
|
-
initiativeWatermarks: new Map(),
|
|
77
|
-
workstreamWatermarks: new Map(),
|
|
78
|
-
documentWatermarks: new Map(),
|
|
79
|
-
assetWatermarks: new Map(),
|
|
80
|
-
documentReviewSessionWatermarks: new Map(),
|
|
81
|
-
documentReviewCommentWatermarks: new Map(),
|
|
82
|
-
annotatedAttachmentSessionWatermarks: new Map(),
|
|
83
|
-
taskEventWatermarks: new Map(),
|
|
84
|
-
taxonomyStateFingerprint
|
|
85
|
-
});
|
|
86
129
|
try {
|
|
87
|
-
if (!workspaceCloudSyncEnabled)
|
|
130
|
+
if (!workspaceCloudSyncEnabled) {
|
|
131
|
+
reportSyncEvent(currentWorkspaceId, {
|
|
132
|
+
eventType: 'bootstrap',
|
|
133
|
+
status: 'error',
|
|
134
|
+
errorMessage: 'Manual sync repair blocked because workspace sync is turned off.',
|
|
135
|
+
details: {
|
|
136
|
+
source: 'repair.blocked',
|
|
137
|
+
reason: 'sync-disabled',
|
|
138
|
+
phase: workspaceSyncPhase
|
|
139
|
+
}
|
|
140
|
+
});
|
|
88
141
|
return;
|
|
142
|
+
}
|
|
143
|
+
bootstrapPhaseStartedAtRef.current = null;
|
|
144
|
+
bootstrapLastProgressAtRef.current = null;
|
|
145
|
+
workspacePullCursorRef.current = null;
|
|
146
|
+
workspaceAttachBootstrapBaselineSignatureRef.current = '';
|
|
147
|
+
workspaceCaptureAttachBootstrapBaselineRef.current = false;
|
|
148
|
+
workspacePendingSignatureRef.current = '';
|
|
149
|
+
workspaceLastPushedSignatureRef.current = '';
|
|
150
|
+
workspaceForceFullAiProfilePushRef.current = false;
|
|
151
|
+
workspaceStartupRepairRanRef.current = false;
|
|
152
|
+
workspaceStartupFullReconcileRanRef.current = false;
|
|
153
|
+
workspaceFullReconcileInFlightRef.current = false;
|
|
154
|
+
if (shouldResetAllPushBaselines) {
|
|
155
|
+
resetAllWorkspacePushBaselines({
|
|
156
|
+
workspaceLastPushedWatermarksRef,
|
|
157
|
+
workspaceLastPushedTaskChangeKeysRef,
|
|
158
|
+
workspaceLastPushedInitiativeIdsRef,
|
|
159
|
+
workspaceLastPushedInitiativeWatermarksRef,
|
|
160
|
+
workspaceLastPushedWorkstreamIdsRef,
|
|
161
|
+
workspaceLastPushedWorkstreamWatermarksRef,
|
|
162
|
+
workspaceLastPushedAiProfileIdsRef,
|
|
163
|
+
workspaceLastPushedAiProfileWatermarksRef,
|
|
164
|
+
workspaceLastPushedAiProfileChangeKeysRef,
|
|
165
|
+
workspaceLastPushedDocumentPathsRef,
|
|
166
|
+
workspaceLastPushedDocumentWatermarksRef,
|
|
167
|
+
workspaceLastPushedAssetPathsRef,
|
|
168
|
+
workspaceLastPushedAssetWatermarksRef,
|
|
169
|
+
workspaceLastPushedDocumentReviewSessionIdsRef,
|
|
170
|
+
workspaceLastPushedDocumentReviewSessionWatermarksRef,
|
|
171
|
+
workspaceLastPushedDocumentReviewCommentIdsRef,
|
|
172
|
+
workspaceLastPushedDocumentReviewCommentWatermarksRef,
|
|
173
|
+
workspaceLastPushedAnnotatedAttachmentSessionIdsRef,
|
|
174
|
+
workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef,
|
|
175
|
+
workspaceLastPushedTaskEventWatermarksRef,
|
|
176
|
+
workspaceBaselineResetReasonRef,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
else if (shouldResetSyncStatePushBaselines) {
|
|
180
|
+
resetWorkspaceSyncStatePushBaselines({
|
|
181
|
+
workspaceLastPushedWatermarksRef,
|
|
182
|
+
workspaceLastPushedTaskChangeKeysRef,
|
|
183
|
+
workspaceLastPushedInitiativeIdsRef,
|
|
184
|
+
workspaceLastPushedInitiativeWatermarksRef,
|
|
185
|
+
workspaceLastPushedWorkstreamIdsRef,
|
|
186
|
+
workspaceLastPushedWorkstreamWatermarksRef,
|
|
187
|
+
workspaceLastPushedAiProfileIdsRef,
|
|
188
|
+
workspaceLastPushedAiProfileWatermarksRef,
|
|
189
|
+
workspaceLastPushedAiProfileChangeKeysRef,
|
|
190
|
+
workspaceBaselineResetReasonRef,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
void persistWorkspaceSyncWatermarksSnapshotBestEffort();
|
|
89
194
|
workspaceRepairModeRef.current = true;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
195
|
+
reportSyncEvent(currentWorkspaceId, {
|
|
196
|
+
eventType: 'bootstrap',
|
|
197
|
+
status: 'success',
|
|
198
|
+
errorMessage: 'Manual sync repair started.',
|
|
199
|
+
details: {
|
|
200
|
+
source: 'repair.started',
|
|
201
|
+
phase: workspaceSyncPhase,
|
|
202
|
+
repairPhase,
|
|
203
|
+
lastBootstrapPhase: lastBootstrapPhaseRef.current
|
|
204
|
+
}
|
|
94
205
|
});
|
|
95
206
|
await persistWorkspaceSyncPatch({
|
|
96
207
|
phase: repairPhase,
|
|
@@ -104,7 +215,14 @@ export function createSyncRecoveryCoordinator({ currentWorkspaceId, taxonomyStat
|
|
|
104
215
|
await pushWorkspaceChangesToCloud(signature, { forceAllAiProfiles: true, repairMode: true });
|
|
105
216
|
return;
|
|
106
217
|
}
|
|
107
|
-
await pullWorkspaceChangesFromCloud({ repairMode: true });
|
|
218
|
+
const pulled = await pullWorkspaceChangesFromCloud({ repairMode: true });
|
|
219
|
+
if (repairPhase !== 'active' || !pulled)
|
|
220
|
+
return;
|
|
221
|
+
const signature = buildWorkspaceSyncSignature();
|
|
222
|
+
if (!signature)
|
|
223
|
+
return;
|
|
224
|
+
workspacePendingSignatureRef.current = signature;
|
|
225
|
+
await pushWorkspaceChangesToCloud(signature, { forceAllAiProfiles: true, repairMode: true });
|
|
108
226
|
}
|
|
109
227
|
finally {
|
|
110
228
|
workspaceRepairModeRef.current = false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { createSyncRecoveryCoordinator } from './recovery';
|
|
3
|
+
import { readPersistedSyncWatermarks, savePersistedSyncWatermarks } from './orchestratorShared';
|
|
4
|
+
function createRef(initial) {
|
|
5
|
+
return { current: initial };
|
|
6
|
+
}
|
|
7
|
+
function createCoordinator(overrides) {
|
|
8
|
+
const pullWorkspaceChangesFromCloud = vi.fn(async () => true);
|
|
9
|
+
const pushWorkspaceChangesToCloud = vi.fn(async () => true);
|
|
10
|
+
const checkAuthSession = vi.fn(async () => true);
|
|
11
|
+
const reportSyncEvent = vi.fn();
|
|
12
|
+
const args = {
|
|
13
|
+
currentWorkspaceId: 'workspace-local-active',
|
|
14
|
+
workspaceCloudSyncEnabled: true,
|
|
15
|
+
workspaceSyncPhase: 'active',
|
|
16
|
+
workspaceLastPullAt: '2026-03-15T18:00:00.000Z',
|
|
17
|
+
lastBootstrapPhaseRef: createRef('active'),
|
|
18
|
+
workspaceRepairModeRef: createRef(false),
|
|
19
|
+
workspaceForceFullAiProfilePushRef: createRef(false),
|
|
20
|
+
workspaceStartupRepairRanRef: createRef(true),
|
|
21
|
+
workspaceStartupFullReconcileRanRef: createRef(true),
|
|
22
|
+
workspaceFullReconcileInFlightRef: createRef(false),
|
|
23
|
+
workspacePullCursorRef: createRef('cursor-1'),
|
|
24
|
+
workspaceAttachBootstrapBaselineSignatureRef: createRef(''),
|
|
25
|
+
workspaceCaptureAttachBootstrapBaselineRef: createRef(false),
|
|
26
|
+
workspacePendingSignatureRef: createRef(''),
|
|
27
|
+
workspaceLastPushedSignatureRef: createRef(''),
|
|
28
|
+
workspaceLastPushedWatermarksRef: createRef(new Map()),
|
|
29
|
+
workspaceLastPushedTaskChangeKeysRef: createRef(new Map()),
|
|
30
|
+
workspaceLastPushedInitiativeIdsRef: createRef(new Set()),
|
|
31
|
+
workspaceLastPushedInitiativeWatermarksRef: createRef(new Map()),
|
|
32
|
+
workspaceLastPushedWorkstreamIdsRef: createRef(new Set()),
|
|
33
|
+
workspaceLastPushedWorkstreamWatermarksRef: createRef(new Map()),
|
|
34
|
+
workspaceLastPushedAiProfileIdsRef: createRef(new Set()),
|
|
35
|
+
workspaceLastPushedAiProfileWatermarksRef: createRef(new Map()),
|
|
36
|
+
workspaceLastPushedAiProfileChangeKeysRef: createRef(new Map()),
|
|
37
|
+
workspaceLastPushedDocumentPathsRef: createRef(new Set()),
|
|
38
|
+
workspaceLastPushedDocumentWatermarksRef: createRef(new Map()),
|
|
39
|
+
workspaceLastPushedAssetPathsRef: createRef(new Set()),
|
|
40
|
+
workspaceLastPushedAssetWatermarksRef: createRef(new Map()),
|
|
41
|
+
workspaceLastPushedDocumentReviewSessionIdsRef: createRef(new Set()),
|
|
42
|
+
workspaceLastPushedDocumentReviewSessionWatermarksRef: createRef(new Map()),
|
|
43
|
+
workspaceLastPushedDocumentReviewCommentIdsRef: createRef(new Set()),
|
|
44
|
+
workspaceLastPushedDocumentReviewCommentWatermarksRef: createRef(new Map()),
|
|
45
|
+
workspaceLastPushedAnnotatedAttachmentSessionIdsRef: createRef(new Set()),
|
|
46
|
+
workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef: createRef(new Map()),
|
|
47
|
+
workspaceLastPushedTaskEventWatermarksRef: createRef(new Map()),
|
|
48
|
+
workspaceBaselineResetReasonRef: createRef(null),
|
|
49
|
+
bootstrapPhaseStartedAtRef: createRef(null),
|
|
50
|
+
bootstrapLastProgressAtRef: createRef(null),
|
|
51
|
+
acquireWorkspaceSyncLease: vi.fn(async () => true),
|
|
52
|
+
releaseWorkspaceSyncLease: vi.fn(),
|
|
53
|
+
forceClearWorkspaceSyncLease: vi.fn(),
|
|
54
|
+
clearWorkspaceRetry: vi.fn(),
|
|
55
|
+
clearWorkspaceIssue: vi.fn(),
|
|
56
|
+
reportWorkspaceWindowContention: vi.fn(),
|
|
57
|
+
reportSyncEvent,
|
|
58
|
+
persistWorkspaceSyncPatch: vi.fn(async () => undefined),
|
|
59
|
+
persistWorkspaceSyncWatermarksSnapshotBestEffort: vi.fn(() => true),
|
|
60
|
+
buildWorkspaceSyncSignature: vi.fn(() => 'signature-1'),
|
|
61
|
+
pullWorkspaceChangesFromCloud,
|
|
62
|
+
pushWorkspaceChangesToCloud,
|
|
63
|
+
cloudAuthConfigured: true,
|
|
64
|
+
runtimeMode: 'local',
|
|
65
|
+
isAuthenticated: true,
|
|
66
|
+
checkAuthSession,
|
|
67
|
+
...overrides
|
|
68
|
+
};
|
|
69
|
+
const persistWorkspaceSyncWatermarksSnapshotBestEffort = vi.fn(() => savePersistedSyncWatermarks(args.currentWorkspaceId, {
|
|
70
|
+
taskIds: new Set(args.workspaceLastPushedWatermarksRef.current.keys()),
|
|
71
|
+
taskWatermarks: args.workspaceLastPushedWatermarksRef.current,
|
|
72
|
+
taskChangeKeys: args.workspaceLastPushedTaskChangeKeysRef.current,
|
|
73
|
+
initiativeWatermarks: args.workspaceLastPushedInitiativeWatermarksRef.current,
|
|
74
|
+
workstreamWatermarks: args.workspaceLastPushedWorkstreamWatermarksRef.current,
|
|
75
|
+
aiProfileWatermarks: args.workspaceLastPushedAiProfileWatermarksRef.current,
|
|
76
|
+
aiProfileChangeKeys: args.workspaceLastPushedAiProfileChangeKeysRef.current,
|
|
77
|
+
documentWatermarks: args.workspaceLastPushedDocumentWatermarksRef.current,
|
|
78
|
+
assetWatermarks: args.workspaceLastPushedAssetWatermarksRef.current,
|
|
79
|
+
documentReviewSessionWatermarks: args.workspaceLastPushedDocumentReviewSessionWatermarksRef.current,
|
|
80
|
+
documentReviewCommentWatermarks: args.workspaceLastPushedDocumentReviewCommentWatermarksRef.current,
|
|
81
|
+
annotatedAttachmentSessionWatermarks: args.workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef.current,
|
|
82
|
+
taskEventWatermarks: args.workspaceLastPushedTaskEventWatermarksRef.current,
|
|
83
|
+
taxonomyStateFingerprint: 'taxonomy-fingerprint-1'
|
|
84
|
+
}));
|
|
85
|
+
args.persistWorkspaceSyncWatermarksSnapshotBestEffort = persistWorkspaceSyncWatermarksSnapshotBestEffort;
|
|
86
|
+
return {
|
|
87
|
+
coordinator: createSyncRecoveryCoordinator(args),
|
|
88
|
+
args,
|
|
89
|
+
pullWorkspaceChangesFromCloud,
|
|
90
|
+
pushWorkspaceChangesToCloud,
|
|
91
|
+
checkAuthSession,
|
|
92
|
+
reportSyncEvent,
|
|
93
|
+
persistWorkspaceSyncWatermarksSnapshotBestEffort
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
describe('createSyncRecoveryCoordinator', () => {
|
|
97
|
+
beforeEach(() => {
|
|
98
|
+
localStorage.clear();
|
|
99
|
+
});
|
|
100
|
+
it('retries provision-local by pushing only with a forced AI profile sync', async () => {
|
|
101
|
+
const { coordinator, pullWorkspaceChangesFromCloud, pushWorkspaceChangesToCloud } = createCoordinator({
|
|
102
|
+
workspaceSyncPhase: 'provision-local'
|
|
103
|
+
});
|
|
104
|
+
const result = await coordinator.retryWorkspaceCloudSync();
|
|
105
|
+
expect(result).toBe(true);
|
|
106
|
+
expect(pullWorkspaceChangesFromCloud).not.toHaveBeenCalled();
|
|
107
|
+
expect(pushWorkspaceChangesToCloud).toHaveBeenCalledWith('signature-1', { forceAllAiProfiles: true });
|
|
108
|
+
});
|
|
109
|
+
it('retries attach-cloud by pulling only without pushing local state', async () => {
|
|
110
|
+
const { coordinator, pullWorkspaceChangesFromCloud, pushWorkspaceChangesToCloud } = createCoordinator({
|
|
111
|
+
workspaceSyncPhase: 'attach-cloud'
|
|
112
|
+
});
|
|
113
|
+
const result = await coordinator.retryWorkspaceCloudSync();
|
|
114
|
+
expect(result).toBe(true);
|
|
115
|
+
expect(pullWorkspaceChangesFromCloud).toHaveBeenCalledTimes(1);
|
|
116
|
+
expect(pushWorkspaceChangesToCloud).not.toHaveBeenCalled();
|
|
117
|
+
});
|
|
118
|
+
it('retries active sync by pulling first and then pushing the latest signature', async () => {
|
|
119
|
+
const { coordinator, pullWorkspaceChangesFromCloud, pushWorkspaceChangesToCloud, args, reportSyncEvent } = createCoordinator({
|
|
120
|
+
workspaceSyncPhase: 'active'
|
|
121
|
+
});
|
|
122
|
+
const result = await coordinator.retryWorkspaceCloudSync();
|
|
123
|
+
expect(result).toBe(true);
|
|
124
|
+
expect(pullWorkspaceChangesFromCloud).toHaveBeenCalledTimes(1);
|
|
125
|
+
expect(pushWorkspaceChangesToCloud).toHaveBeenCalledWith('signature-1', { forceAllAiProfiles: true });
|
|
126
|
+
expect(args.workspacePendingSignatureRef.current).toBe('signature-1');
|
|
127
|
+
expect(reportSyncEvent).not.toHaveBeenCalled();
|
|
128
|
+
});
|
|
129
|
+
it('reports blocked manual retry reasons when auth cannot be refreshed', async () => {
|
|
130
|
+
const { coordinator, checkAuthSession, reportSyncEvent, pullWorkspaceChangesFromCloud, pushWorkspaceChangesToCloud } = createCoordinator({
|
|
131
|
+
workspaceSyncPhase: 'active',
|
|
132
|
+
isAuthenticated: false
|
|
133
|
+
});
|
|
134
|
+
checkAuthSession.mockResolvedValue(false);
|
|
135
|
+
const result = await coordinator.retryWorkspaceCloudSync();
|
|
136
|
+
expect(result).toBe(false);
|
|
137
|
+
expect(pullWorkspaceChangesFromCloud).not.toHaveBeenCalled();
|
|
138
|
+
expect(pushWorkspaceChangesToCloud).not.toHaveBeenCalled();
|
|
139
|
+
expect(reportSyncEvent).toHaveBeenCalledWith('workspace-local-active', expect.objectContaining({
|
|
140
|
+
eventType: 'pull',
|
|
141
|
+
status: 'error',
|
|
142
|
+
errorMessage: 'Manual sync retry blocked: sign in is required.',
|
|
143
|
+
details: expect.objectContaining({
|
|
144
|
+
source: 'retry.blocked',
|
|
145
|
+
reason: 'auth-required',
|
|
146
|
+
phase: 'active'
|
|
147
|
+
})
|
|
148
|
+
}));
|
|
149
|
+
});
|
|
150
|
+
it('reports repair start metadata before entering recovery mode', async () => {
|
|
151
|
+
const { coordinator, reportSyncEvent, args } = createCoordinator({
|
|
152
|
+
workspaceSyncPhase: 'error',
|
|
153
|
+
lastBootstrapPhaseRef: createRef('attach-cloud'),
|
|
154
|
+
workspaceLastPullAt: null
|
|
155
|
+
});
|
|
156
|
+
await coordinator.resetWorkspaceSyncCursorAndPull();
|
|
157
|
+
expect(reportSyncEvent).toHaveBeenCalledWith('workspace-local-active', expect.objectContaining({
|
|
158
|
+
eventType: 'bootstrap',
|
|
159
|
+
status: 'success',
|
|
160
|
+
errorMessage: 'Manual sync repair started.',
|
|
161
|
+
details: expect.objectContaining({
|
|
162
|
+
source: 'repair.started',
|
|
163
|
+
phase: 'error',
|
|
164
|
+
repairPhase: 'attach-cloud',
|
|
165
|
+
lastBootstrapPhase: 'attach-cloud'
|
|
166
|
+
})
|
|
167
|
+
}));
|
|
168
|
+
expect(args.workspaceBaselineResetReasonRef.current).toBeNull();
|
|
169
|
+
expect(args.workspaceRepairModeRef.current).toBe(false);
|
|
170
|
+
});
|
|
171
|
+
it('resets sync-state push baselines during active repair and preserves content baselines', async () => {
|
|
172
|
+
const taskWatermarks = new Map([['task-1', '2026-03-15T17:00:00.000Z']]);
|
|
173
|
+
const taskChangeKeys = new Map([['task-1', 'task-change-key-1']]);
|
|
174
|
+
const initiativeWatermarks = new Map([['initiative-1', '2026-03-15T17:00:00.000Z']]);
|
|
175
|
+
const workstreamWatermarks = new Map([['workstream-1', '2026-03-15T17:00:00.000Z']]);
|
|
176
|
+
const aiProfileWatermarks = new Map([['profile-1', '2026-03-15T17:00:00.000Z']]);
|
|
177
|
+
const aiProfileChangeKeys = new Map([['profile-1', 'ai-profile-change-key-1']]);
|
|
178
|
+
const documentWatermarks = new Map([['docs/spec.md', '2026-03-15T17:00:00.000Z']]);
|
|
179
|
+
const assetWatermarks = new Map([['assets/image.png', '2026-03-15T17:00:00.000Z']]);
|
|
180
|
+
const reviewSessionWatermarks = new Map([['review-1', '2026-03-15T17:00:00.000Z']]);
|
|
181
|
+
const reviewCommentWatermarks = new Map([['comment-1', '2026-03-15T17:00:00.000Z']]);
|
|
182
|
+
const annotatedWatermarks = new Map([['annotated-1', '2026-03-15T17:00:00.000Z']]);
|
|
183
|
+
const taskEventWatermarks = new Map([['event-1', '2026-03-15T17:00:00.000Z']]);
|
|
184
|
+
const { coordinator, args, pullWorkspaceChangesFromCloud, pushWorkspaceChangesToCloud } = createCoordinator({
|
|
185
|
+
workspaceSyncPhase: 'active',
|
|
186
|
+
workspaceLastPullAt: '2026-03-15T18:00:00.000Z',
|
|
187
|
+
workspaceLastPushedWatermarksRef: createRef(taskWatermarks),
|
|
188
|
+
workspaceLastPushedTaskChangeKeysRef: createRef(taskChangeKeys),
|
|
189
|
+
workspaceLastPushedInitiativeIdsRef: createRef(new Set(['initiative-1'])),
|
|
190
|
+
workspaceLastPushedInitiativeWatermarksRef: createRef(initiativeWatermarks),
|
|
191
|
+
workspaceLastPushedWorkstreamIdsRef: createRef(new Set(['workstream-1'])),
|
|
192
|
+
workspaceLastPushedWorkstreamWatermarksRef: createRef(workstreamWatermarks),
|
|
193
|
+
workspaceLastPushedAiProfileIdsRef: createRef(new Set(['profile-1'])),
|
|
194
|
+
workspaceLastPushedAiProfileWatermarksRef: createRef(aiProfileWatermarks),
|
|
195
|
+
workspaceLastPushedAiProfileChangeKeysRef: createRef(aiProfileChangeKeys),
|
|
196
|
+
workspaceLastPushedDocumentPathsRef: createRef(new Set(['docs/spec.md'])),
|
|
197
|
+
workspaceLastPushedDocumentWatermarksRef: createRef(documentWatermarks),
|
|
198
|
+
workspaceLastPushedAssetPathsRef: createRef(new Set(['assets/image.png'])),
|
|
199
|
+
workspaceLastPushedAssetWatermarksRef: createRef(assetWatermarks),
|
|
200
|
+
workspaceLastPushedDocumentReviewSessionIdsRef: createRef(new Set(['review-1'])),
|
|
201
|
+
workspaceLastPushedDocumentReviewSessionWatermarksRef: createRef(reviewSessionWatermarks),
|
|
202
|
+
workspaceLastPushedDocumentReviewCommentIdsRef: createRef(new Set(['comment-1'])),
|
|
203
|
+
workspaceLastPushedDocumentReviewCommentWatermarksRef: createRef(reviewCommentWatermarks),
|
|
204
|
+
workspaceLastPushedAnnotatedAttachmentSessionIdsRef: createRef(new Set(['annotated-1'])),
|
|
205
|
+
workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef: createRef(annotatedWatermarks),
|
|
206
|
+
workspaceLastPushedTaskEventWatermarksRef: createRef(taskEventWatermarks),
|
|
207
|
+
});
|
|
208
|
+
await coordinator.resetWorkspaceSyncCursorAndPull();
|
|
209
|
+
expect(args.workspaceBaselineResetReasonRef.current).toBe('repair-reset');
|
|
210
|
+
expect(args.workspaceLastPushedWatermarksRef.current.size).toBe(0);
|
|
211
|
+
expect(args.workspaceLastPushedTaskChangeKeysRef.current.size).toBe(0);
|
|
212
|
+
expect(args.workspaceLastPushedInitiativeWatermarksRef.current.size).toBe(0);
|
|
213
|
+
expect(args.workspaceLastPushedWorkstreamWatermarksRef.current.size).toBe(0);
|
|
214
|
+
expect(args.workspaceLastPushedAiProfileWatermarksRef.current.size).toBe(0);
|
|
215
|
+
expect(args.workspaceLastPushedAiProfileChangeKeysRef.current.size).toBe(0);
|
|
216
|
+
expect(args.workspaceLastPushedDocumentWatermarksRef.current).toBe(documentWatermarks);
|
|
217
|
+
expect(args.workspaceLastPushedAssetWatermarksRef.current).toBe(assetWatermarks);
|
|
218
|
+
expect(pullWorkspaceChangesFromCloud).toHaveBeenCalledWith({ repairMode: true });
|
|
219
|
+
expect(pushWorkspaceChangesToCloud).toHaveBeenCalledWith('signature-1', {
|
|
220
|
+
forceAllAiProfiles: true,
|
|
221
|
+
repairMode: true
|
|
222
|
+
});
|
|
223
|
+
const persisted = readPersistedSyncWatermarks('workspace-local-active', 'taxonomy-fingerprint-1');
|
|
224
|
+
expect(persisted?.taskWatermarks.size).toBe(0);
|
|
225
|
+
expect(persisted?.taskChangeKeys?.size).toBe(0);
|
|
226
|
+
expect(persisted?.initiativeWatermarks.size).toBe(0);
|
|
227
|
+
expect(persisted?.workstreamWatermarks.size).toBe(0);
|
|
228
|
+
expect(persisted?.aiProfileWatermarks.size).toBe(0);
|
|
229
|
+
expect(persisted?.aiProfileChangeKeys?.size).toBe(0);
|
|
230
|
+
expect(persisted?.documentWatermarks.get('docs/spec.md')).toBe('2026-03-15T17:00:00.000Z');
|
|
231
|
+
expect(persisted?.assetWatermarks.get('assets/image.png')).toBe('2026-03-15T17:00:00.000Z');
|
|
232
|
+
expect(persisted?.taskEventWatermarks.get('event-1')).toBe('2026-03-15T17:00:00.000Z');
|
|
233
|
+
});
|
|
234
|
+
it('does not push during attach-cloud repair', async () => {
|
|
235
|
+
const { coordinator, pullWorkspaceChangesFromCloud, pushWorkspaceChangesToCloud } = createCoordinator({
|
|
236
|
+
workspaceSyncPhase: 'attach-cloud',
|
|
237
|
+
workspaceLastPullAt: null
|
|
238
|
+
});
|
|
239
|
+
await coordinator.resetWorkspaceSyncCursorAndPull();
|
|
240
|
+
expect(pullWorkspaceChangesFromCloud).toHaveBeenCalledWith({ repairMode: true });
|
|
241
|
+
expect(pushWorkspaceChangesToCloud).not.toHaveBeenCalled();
|
|
242
|
+
});
|
|
243
|
+
it('fully resets push baselines for provision-local repair', async () => {
|
|
244
|
+
const { coordinator, args } = createCoordinator({
|
|
245
|
+
workspaceSyncPhase: 'error',
|
|
246
|
+
workspaceLastPullAt: null,
|
|
247
|
+
lastBootstrapPhaseRef: createRef('provision-local'),
|
|
248
|
+
workspaceLastPushedWatermarksRef: createRef(new Map([['task-1', '2026-03-15T17:00:00.000Z']])),
|
|
249
|
+
workspaceLastPushedInitiativeIdsRef: createRef(new Set(['initiative-1'])),
|
|
250
|
+
workspaceLastPushedInitiativeWatermarksRef: createRef(new Map([['initiative-1', '2026-03-15T17:00:00.000Z']])),
|
|
251
|
+
workspaceLastPushedWorkstreamIdsRef: createRef(new Set(['workstream-1'])),
|
|
252
|
+
workspaceLastPushedWorkstreamWatermarksRef: createRef(new Map([['workstream-1', '2026-03-15T17:00:00.000Z']])),
|
|
253
|
+
workspaceLastPushedAiProfileIdsRef: createRef(new Set(['profile-1'])),
|
|
254
|
+
workspaceLastPushedAiProfileWatermarksRef: createRef(new Map([['profile-1', '2026-03-15T17:00:00.000Z']])),
|
|
255
|
+
workspaceLastPushedDocumentPathsRef: createRef(new Set(['docs/spec.md'])),
|
|
256
|
+
workspaceLastPushedDocumentWatermarksRef: createRef(new Map([['docs/spec.md', '2026-03-15T17:00:00.000Z']])),
|
|
257
|
+
workspaceLastPushedAssetPathsRef: createRef(new Set(['assets/image.png'])),
|
|
258
|
+
workspaceLastPushedAssetWatermarksRef: createRef(new Map([['assets/image.png', '2026-03-15T17:00:00.000Z']])),
|
|
259
|
+
workspaceLastPushedDocumentReviewSessionIdsRef: createRef(new Set(['review-1'])),
|
|
260
|
+
workspaceLastPushedDocumentReviewSessionWatermarksRef: createRef(new Map([['review-1', '2026-03-15T17:00:00.000Z']])),
|
|
261
|
+
workspaceLastPushedDocumentReviewCommentIdsRef: createRef(new Set(['comment-1'])),
|
|
262
|
+
workspaceLastPushedDocumentReviewCommentWatermarksRef: createRef(new Map([['comment-1', '2026-03-15T17:00:00.000Z']])),
|
|
263
|
+
workspaceLastPushedAnnotatedAttachmentSessionIdsRef: createRef(new Set(['annotated-1'])),
|
|
264
|
+
workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef: createRef(new Map([['annotated-1', '2026-03-15T17:00:00.000Z']])),
|
|
265
|
+
workspaceLastPushedTaskEventWatermarksRef: createRef(new Map([['event-1', '2026-03-15T17:00:00.000Z']])),
|
|
266
|
+
});
|
|
267
|
+
await coordinator.resetWorkspaceSyncCursorAndPull();
|
|
268
|
+
expect(args.workspaceBaselineResetReasonRef.current).toBe('repair-reset');
|
|
269
|
+
expect(args.workspaceLastPushedWatermarksRef.current.size).toBe(0);
|
|
270
|
+
expect(args.workspaceLastPushedDocumentWatermarksRef.current.size).toBe(0);
|
|
271
|
+
expect(args.workspaceLastPushedAssetWatermarksRef.current.size).toBe(0);
|
|
272
|
+
const persisted = readPersistedSyncWatermarks('workspace-local-active', 'taxonomy-fingerprint-1');
|
|
273
|
+
expect(persisted?.taskWatermarks.size).toBe(0);
|
|
274
|
+
expect(persisted?.documentWatermarks.size).toBe(0);
|
|
275
|
+
expect(persisted?.assetWatermarks.size).toBe(0);
|
|
276
|
+
});
|
|
277
|
+
it('does not clear push baselines when repair is blocked because sync is disabled', async () => {
|
|
278
|
+
const taskWatermarks = new Map([['task-1', '2026-03-15T17:00:00.000Z']]);
|
|
279
|
+
const { coordinator, args, reportSyncEvent } = createCoordinator({
|
|
280
|
+
workspaceCloudSyncEnabled: false,
|
|
281
|
+
workspaceLastPushedWatermarksRef: createRef(taskWatermarks)
|
|
282
|
+
});
|
|
283
|
+
await coordinator.resetWorkspaceSyncCursorAndPull();
|
|
284
|
+
expect(args.workspaceLastPushedWatermarksRef.current).toBe(taskWatermarks);
|
|
285
|
+
expect(readPersistedSyncWatermarks('workspace-local-active', 'taxonomy-fingerprint-1')).toBeNull();
|
|
286
|
+
expect(reportSyncEvent).toHaveBeenCalledWith('workspace-local-active', expect.objectContaining({
|
|
287
|
+
eventType: 'bootstrap',
|
|
288
|
+
status: 'error',
|
|
289
|
+
errorMessage: 'Manual sync repair blocked because workspace sync is turned off.'
|
|
290
|
+
}));
|
|
291
|
+
});
|
|
292
|
+
});
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import type { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
2
2
|
import { type EnsureWorkspaceReadyResult } from '../../sync/syncService';
|
|
3
|
-
import type { WorkspaceSyncPayload } from '../../sync/workspaceSyncModel';
|
|
3
|
+
import type { WorkspaceSyncBaselineResetReason, WorkspaceSyncPayload } from '../../sync/workspaceSyncModel';
|
|
4
4
|
import type { WorkspaceSyncPhase } from '../../sync/workspaceSyncState';
|
|
5
|
+
export interface PendingWorkspacePushReplay {
|
|
6
|
+
signature: string;
|
|
7
|
+
payload: WorkspaceSyncPayload;
|
|
8
|
+
forceAllAiProfiles: boolean;
|
|
9
|
+
repairMode: boolean;
|
|
10
|
+
}
|
|
5
11
|
interface CreateWorkspaceTransferCoordinatorArgs {
|
|
6
12
|
cloudAuthConfigured: boolean;
|
|
7
13
|
runtimeMode: 'local' | 'cloud';
|
|
8
14
|
workspaceCloudSyncEnabled: boolean;
|
|
9
15
|
currentWorkspaceId: string;
|
|
10
16
|
workspaceSyncPhase: WorkspaceSyncPhase;
|
|
11
|
-
taxonomyStateFingerprint: string;
|
|
12
17
|
isAuthenticated: boolean;
|
|
13
18
|
checkAuthSession: () => Promise<boolean>;
|
|
14
19
|
resolveCloudAuthUrl: (path: string) => string;
|
|
@@ -29,6 +34,8 @@ interface CreateWorkspaceTransferCoordinatorArgs {
|
|
|
29
34
|
lastSyncedAt: string;
|
|
30
35
|
pullCursor?: string | null;
|
|
31
36
|
lastErrorMessage: null;
|
|
37
|
+
} | {
|
|
38
|
+
pullCursor: null;
|
|
32
39
|
}) => void;
|
|
33
40
|
persistWorkspaceSyncPatchBestEffort: (patch: {
|
|
34
41
|
phase: 'active';
|
|
@@ -37,6 +44,7 @@ interface CreateWorkspaceTransferCoordinatorArgs {
|
|
|
37
44
|
lastSyncedAt: string;
|
|
38
45
|
lastErrorMessage: null;
|
|
39
46
|
}) => Promise<unknown>;
|
|
47
|
+
persistWorkspaceSyncWatermarksSnapshotBestEffort: () => boolean;
|
|
40
48
|
reportSyncEvent: (workspaceId: string, event: {
|
|
41
49
|
eventType: 'pull' | 'handshake' | 'bootstrap' | 'apply' | 'push';
|
|
42
50
|
status: 'success' | 'error';
|
|
@@ -70,18 +78,22 @@ interface CreateWorkspaceTransferCoordinatorArgs {
|
|
|
70
78
|
workspaceForceFullAiProfilePushRef: MutableRefObject<boolean>;
|
|
71
79
|
workspacePushInFlightRef: MutableRefObject<boolean>;
|
|
72
80
|
workspacePullInFlightRef: MutableRefObject<boolean>;
|
|
81
|
+
workspacePendingPushReplayRef: MutableRefObject<PendingWorkspacePushReplay | null>;
|
|
73
82
|
workspaceLastPushedSignatureRef: MutableRefObject<string>;
|
|
74
83
|
workspacePendingSignatureRef: MutableRefObject<string>;
|
|
75
84
|
workspaceLastPushedTaskIdsRef: MutableRefObject<Set<string>>;
|
|
76
85
|
workspaceDeletedTaskIdsRef: MutableRefObject<Set<string>>;
|
|
86
|
+
workspaceDeletedTaskWatermarksRef: MutableRefObject<Map<string, string>>;
|
|
77
87
|
workspacePullCursorRef: MutableRefObject<string | null>;
|
|
78
88
|
workspaceLastPushedWatermarksRef: MutableRefObject<Map<string, string>>;
|
|
89
|
+
workspaceLastPushedTaskChangeKeysRef: MutableRefObject<Map<string, string>>;
|
|
79
90
|
workspaceLastPushedInitiativeIdsRef: MutableRefObject<Set<string>>;
|
|
80
91
|
workspaceLastPushedInitiativeWatermarksRef: MutableRefObject<Map<string, string>>;
|
|
81
92
|
workspaceLastPushedWorkstreamIdsRef: MutableRefObject<Set<string>>;
|
|
82
93
|
workspaceLastPushedWorkstreamWatermarksRef: MutableRefObject<Map<string, string>>;
|
|
83
94
|
workspaceLastPushedAiProfileIdsRef: MutableRefObject<Set<string>>;
|
|
84
95
|
workspaceLastPushedAiProfileWatermarksRef: MutableRefObject<Map<string, string>>;
|
|
96
|
+
workspaceLastPushedAiProfileChangeKeysRef: MutableRefObject<Map<string, string>>;
|
|
85
97
|
workspaceLastPushedDocumentPathsRef: MutableRefObject<Set<string>>;
|
|
86
98
|
workspaceLastPushedDocumentWatermarksRef: MutableRefObject<Map<string, string>>;
|
|
87
99
|
workspaceLastPushedAssetPathsRef: MutableRefObject<Set<string>>;
|
|
@@ -93,6 +105,7 @@ interface CreateWorkspaceTransferCoordinatorArgs {
|
|
|
93
105
|
workspaceLastPushedAnnotatedAttachmentSessionIdsRef: MutableRefObject<Set<string>>;
|
|
94
106
|
workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef: MutableRefObject<Map<string, string>>;
|
|
95
107
|
workspaceLastPushedTaskEventWatermarksRef: MutableRefObject<Map<string, string>>;
|
|
108
|
+
workspaceBaselineResetReasonRef: MutableRefObject<WorkspaceSyncBaselineResetReason | null>;
|
|
96
109
|
workspaceCaptureAttachBootstrapBaselineRef: MutableRefObject<boolean>;
|
|
97
110
|
workspaceStartupFullReconcileRanRef: MutableRefObject<boolean>;
|
|
98
111
|
workspaceFullReconcileInFlightRef: MutableRefObject<boolean>;
|
|
@@ -109,7 +122,7 @@ interface CreateWorkspaceTransferCoordinatorArgs {
|
|
|
109
122
|
setTasks: Dispatch<SetStateAction<any[]>>;
|
|
110
123
|
setArchivedTasks: Dispatch<SetStateAction<any[]>>;
|
|
111
124
|
}
|
|
112
|
-
export declare function createWorkspaceTransferCoordinator({ cloudAuthConfigured, runtimeMode, workspaceCloudSyncEnabled, currentWorkspaceId, workspaceSyncPhase,
|
|
125
|
+
export declare function createWorkspaceTransferCoordinator({ cloudAuthConfigured, runtimeMode, workspaceCloudSyncEnabled, currentWorkspaceId, workspaceSyncPhase, isAuthenticated, checkAuthSession, resolveCloudAuthUrl, ensureCloudWorkspaceReadyForSync, ensureWorkspaceSyncReady, handleSyncAuthFailure, clearWorkspaceRetry, clearWorkspaceIssue, isWorkspaceRetryPending, scheduleWorkspaceSyncRetry, persistWorkspaceSyncPatchSafely, persistWorkspaceSyncPatchBestEffort, persistWorkspaceSyncWatermarksSnapshotBestEffort, reportSyncEvent, acquireWorkspaceSyncLease, releaseWorkspaceSyncLease, reportWorkspaceWindowContention, refreshWorkspaceSyncMarkdownDocumentsSnapshot, refreshWorkspaceSyncAiProfilesSnapshot, refreshWorkspaceSyncAssetsSnapshot, refreshWorkspaceSyncDocumentReviewSessionsSnapshot, refreshWorkspaceSyncAnnotatedAttachmentSessionsSnapshot, refreshLocalWorkspaceTaskCollections, buildWorkspaceSyncPayload, buildWorkspaceSyncSignature, seedWorkspaceSnapshotPushBaseline, shouldSuppressAttachBootstrapPush, recordSuppressedEventIds, workspaceRepairModeRef, workspaceForceFullAiProfilePushRef, workspacePushInFlightRef, workspacePullInFlightRef, workspacePendingPushReplayRef, workspaceLastPushedSignatureRef, workspacePendingSignatureRef, workspaceLastPushedTaskIdsRef, workspaceDeletedTaskIdsRef, workspaceDeletedTaskWatermarksRef, workspacePullCursorRef, workspaceLastPushedWatermarksRef, workspaceLastPushedTaskChangeKeysRef, workspaceLastPushedInitiativeIdsRef, workspaceLastPushedInitiativeWatermarksRef, workspaceLastPushedWorkstreamIdsRef, workspaceLastPushedWorkstreamWatermarksRef, workspaceLastPushedAiProfileIdsRef, workspaceLastPushedAiProfileWatermarksRef, workspaceLastPushedAiProfileChangeKeysRef, workspaceLastPushedDocumentPathsRef, workspaceLastPushedDocumentWatermarksRef, workspaceLastPushedAssetPathsRef, workspaceLastPushedAssetWatermarksRef, workspaceLastPushedDocumentReviewSessionIdsRef, workspaceLastPushedDocumentReviewSessionWatermarksRef, workspaceLastPushedDocumentReviewCommentIdsRef, workspaceLastPushedDocumentReviewCommentWatermarksRef, workspaceLastPushedAnnotatedAttachmentSessionIdsRef, workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef, workspaceLastPushedTaskEventWatermarksRef, workspaceBaselineResetReasonRef, workspaceCaptureAttachBootstrapBaselineRef, workspaceStartupFullReconcileRanRef, workspaceFullReconcileInFlightRef, bootstrapLastProgressAtRef, realtimeSuppressedEventQueueRef, setWorkspaceSyncBusy, setUserGlobalSyncStatus, setUserGlobalSyncError, setWorkspaceLastErrorMessage, setWorkspaceLastErrorAt, setWorkspaceLastPullAt, setWorkspaceLastPushAt, setWorkspaceSyncPendingChanges, setTasks, setArchivedTasks }: CreateWorkspaceTransferCoordinatorArgs): {
|
|
113
126
|
pushWorkspaceChangesToCloud: (signature: string, options?: {
|
|
114
127
|
forceAllAiProfiles?: boolean;
|
|
115
128
|
repairMode?: boolean;
|