@taskforcehq/taskforce 0.3.305 → 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/dist/Taskforce.module.css +295 -89
- package/dist/TaskforceCore.js +215 -43
- package/dist/TaskforceCore.test.js +433 -28
- 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 +46 -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/DocumentViewer.d.ts +5 -1
- package/dist/components/features/DocumentViewer.js +60 -3
- package/dist/components/features/DocumentWorkspace.js +1 -1
- package/dist/components/features/DocumentWorkspace.test.js +33 -0
- package/dist/components/features/documentWorkspaceModel.d.ts +1 -1
- 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.js +85 -90
- package/dist/components/task/TaskForm.test.js +110 -8
- package/dist/components/task/TaskKanban.d.ts +2 -1
- package/dist/components/task/TaskKanban.js +94 -13
- 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 -14
- package/dist/components/views/PlanComparisonPage.test.js +238 -0
- package/dist/components/views/PlansPage.js +127 -36
- package/dist/components/views/PlansPage.test.js +294 -12
- package/dist/components/views/StandaloneLayout.js +283 -533
- 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 +26 -1
- package/dist/components/views/standalone/modals/AccountHubModal.js +76 -2
- package/dist/components/views/standalone/modals/AccountHubModal.test.js +20 -3
- 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/core/AiProfileService.d.ts +39 -2
- package/dist/core/AiProfileService.js +639 -73
- package/dist/core/AiProfileService.test.js +19 -1
- package/dist/core/AiProfiles.test.js +566 -7
- 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.js +3 -3
- package/dist/core/EntitlementsPolicy.test.js +2 -2
- package/dist/core/GlobalSettingsService.js +115 -6
- package/dist/core/PlanEntitlementService.d.ts +23 -2
- package/dist/core/PlanEntitlementService.js +343 -57
- package/dist/core/PlanFeatureCatalog.test.d.ts +1 -0
- package/dist/core/PlanFeatureCatalog.test.js +84 -0
- package/dist/core/PlanVersionPolicy.test.js +35 -2
- package/dist/core/PlanningEntities.test.js +52 -0
- package/dist/core/SignupMonetizationSettings.test.js +199 -27
- package/dist/core/SyncReconciliationService.js +2 -65
- package/dist/core/SystemAdmin.test.js +42 -42
- package/dist/core/TaskAttachmentsCanonical.test.js +51 -1
- package/dist/core/Taskforce.d.ts +225 -14
- package/dist/core/Taskforce.js +765 -192
- 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 +117 -16
- package/dist/core/shared.d.ts +1 -1
- package/dist/core/shared.js +5 -1
- package/dist/core/types.d.ts +68 -2
- package/dist/hooks/auth/useTaskforceAuthBootstrap.js +26 -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 +15 -3
- package/dist/hooks/sync/transfers.js +179 -62
- 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 +9 -2
- package/dist/hooks/useSyncOrchestrator.js +359 -178
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +407 -0
- package/dist/hooks/useTaskData.js +8 -3
- package/dist/hooks/useTaskData.test.js +45 -0
- package/dist/hooks/useTaskforce.d.ts +60 -2
- package/dist/hooks/useTaskforce.js +549 -240
- 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 +2380 -212
- package/dist/hooks/useWorkspaceSyncController.d.ts +1 -0
- package/dist/hooks/useWorkspaceSyncController.js +6 -1
- 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/documentAssetRegistrar.js +3 -3
- package/dist/mcp/runtime.d.ts +2 -0
- package/dist/mcp/runtime.js +131 -64
- package/dist/mcp/runtime.test.js +291 -12
- 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 +3 -0
- package/dist/server/routes/admin.js +272 -19
- package/dist/server/routes/auth.d.ts +15 -2
- package/dist/server/routes/auth.js +994 -57
- package/dist/server/routes/authSupport.d.ts +1 -1
- package/dist/server/routes/authSupport.js +1 -1
- package/dist/server/routes/billing.js +361 -35
- package/dist/server/routes/billing.test.js +592 -12
- package/dist/server/routes/documents.d.ts +1 -0
- package/dist/server/routes/documents.js +172 -70
- package/dist/server/routes/shared.d.ts +28 -2
- package/dist/server/routes/shared.js +69 -4
- package/dist/server/routes/sync.integration.test.js +437 -39
- package/dist/server/routes/sync.js +61 -605
- 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.js +43 -1
- package/dist/server/routes/workspaces.js +36 -5
- package/dist/server/routes.js +60 -3
- package/dist/server/routes.test.js +1824 -171
- 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 +17 -70
- package/dist/sync/syncApplyHandlers.d.ts +7 -0
- package/dist/sync/syncApplyHandlers.js +28 -13
- package/dist/sync/syncApplyHandlers.test.js +70 -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 +5 -0
- package/dist/sync/syncService.js +52 -0
- package/dist/sync/syncService.test.js +57 -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 +45 -0
- package/dist/sync/workspaceSyncModel.js +183 -28
- package/dist/sync/workspaceSyncModel.test.js +291 -12
- package/dist/sync/workspaceSyncState.d.ts +17 -0
- package/dist/sync/workspaceSyncState.js +2 -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-BG6P_GVW.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-Dhm7M8e7.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-ln0aF7xc.js → TaskSettings-DZX4jk7e.js} +1 -1
- package/dist/ui/assets/{WorkflowsModule-BcS4afRn.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-BSUaRwF8.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.js +3 -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 +3 -2
- package/scripts/export-sqlite-to-postgres.mjs +7 -9
- 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-N2MnQBZk.js +0 -1
- package/dist/ui/assets/DocumentWorkspace-B3nV_Gc5.css +0 -1
- package/dist/ui/assets/DocumentWorkspace-DRbDMwh8.js +0 -252
- package/dist/ui/assets/PlansPage-C2dd2n1X.css +0 -1
- package/dist/ui/assets/PlansPage-Cq0zXj3I.js +0 -1
- package/dist/ui/assets/RussoOne-Regular-C3BxZIj7.ttf +0 -0
- package/dist/ui/assets/index-C2-OXZV7.css +0 -1
- package/dist/ui/assets/index-DcSI5F86.js +0 -6
- package/scripts/migrate-planning-model.ts +0 -233
|
@@ -338,8 +338,9 @@ export function scanWorkspaceRepair(input) {
|
|
|
338
338
|
for (const asset of assets) {
|
|
339
339
|
const links = input.workspaceAssetStore.listLinksForAsset(asset.assetId, snapshot.workspaceId, { includeDeleted: false });
|
|
340
340
|
for (const link of links) {
|
|
341
|
-
if (activeTaskIds.has(link.taskId))
|
|
341
|
+
if (link.targetType === 'task' && link.taskId && activeTaskIds.has(link.taskId))
|
|
342
342
|
continue;
|
|
343
|
+
const linkedTargetId = link.targetId;
|
|
343
344
|
issues.push({
|
|
344
345
|
code: 'stale_asset_link',
|
|
345
346
|
entityKind: 'link',
|
|
@@ -349,7 +350,9 @@ export function scanWorkspaceRepair(input) {
|
|
|
349
350
|
role: link.role,
|
|
350
351
|
repairable: true,
|
|
351
352
|
recommendedAction: 'delete-link',
|
|
352
|
-
detail:
|
|
353
|
+
detail: link.targetType === 'task'
|
|
354
|
+
? 'Canonical asset link points to a task that no longer exists in this workspace.'
|
|
355
|
+
: `Canonical asset link points to a missing ${link.targetType} target (${linkedTargetId}).`
|
|
353
356
|
});
|
|
354
357
|
}
|
|
355
358
|
}
|
|
@@ -3,6 +3,7 @@ import type { DocumentReviewCommentRecord, DocumentReviewSessionStatus } from '.
|
|
|
3
3
|
import type { AnnotatedAttachmentAnnotation } from '../annotatedAttachments/types.js';
|
|
4
4
|
import type { WorkspaceTaxonomyState } from '../shared/taxonomyState.js';
|
|
5
5
|
import { type AiProfileSurfaceType } from '../shared/aiProfileSurfaceType.js';
|
|
6
|
+
import { type AiProfileSeatScope } from '../shared/aiProfileSeatScope.js';
|
|
6
7
|
import { type TaskSyncPayload } from './taskSyncPayload.js';
|
|
7
8
|
export type WorkspaceSyncTaskSnapshot = TaskSyncPayload;
|
|
8
9
|
export interface WorkspaceSyncTaskEventSnapshot {
|
|
@@ -23,12 +24,20 @@ export interface WorkspaceSyncAiProfileSnapshot {
|
|
|
23
24
|
username: string;
|
|
24
25
|
icon: string;
|
|
25
26
|
color: string;
|
|
27
|
+
avatarUrl?: string | null;
|
|
28
|
+
avatarSourceUrl?: string | null;
|
|
26
29
|
description?: string | null;
|
|
27
30
|
role?: string | null;
|
|
28
31
|
provider?: string | null;
|
|
29
32
|
model?: string | null;
|
|
30
33
|
surfaceType?: AiProfileSurfaceType | null;
|
|
34
|
+
seatScope?: AiProfileSeatScope | null;
|
|
31
35
|
providerMetadata?: Record<string, unknown> | null;
|
|
36
|
+
archivedAt?: string | null;
|
|
37
|
+
archivedBy?: string | null;
|
|
38
|
+
archivedReason?: string | null;
|
|
39
|
+
mergedIntoProfileId?: string | null;
|
|
40
|
+
rosterStateUpdatedAt?: string | null;
|
|
32
41
|
createdAt: string;
|
|
33
42
|
updatedAt: string;
|
|
34
43
|
lastActiveAt?: string | null;
|
|
@@ -200,6 +209,8 @@ export type WorkspaceSyncChange = {
|
|
|
200
209
|
export interface WorkspaceSyncPayload {
|
|
201
210
|
changes: WorkspaceSyncChange[];
|
|
202
211
|
currentTaskIds: Set<string>;
|
|
212
|
+
currentTaskWatermarks?: Map<string, string>;
|
|
213
|
+
currentTaskChangeKeys?: Map<string, string>;
|
|
203
214
|
deleteTaskIds: Set<string>;
|
|
204
215
|
currentInitiativeIds: Set<string>;
|
|
205
216
|
currentInitiativeWatermarks: Map<string, string>;
|
|
@@ -207,6 +218,7 @@ export interface WorkspaceSyncPayload {
|
|
|
207
218
|
currentWorkstreamWatermarks: Map<string, string>;
|
|
208
219
|
currentAiProfileIds: Set<string>;
|
|
209
220
|
currentAiProfileWatermarks: Map<string, string>;
|
|
221
|
+
currentAiProfileChangeKeys?: Map<string, string>;
|
|
210
222
|
currentDocumentPaths: Set<string>;
|
|
211
223
|
deleteDocumentPaths: Set<string>;
|
|
212
224
|
currentDocumentWatermarks: Map<string, string>;
|
|
@@ -225,6 +237,34 @@ export interface WorkspaceSyncPayload {
|
|
|
225
237
|
currentTaskEventWatermarks: Map<string, string>;
|
|
226
238
|
/** Watermarks for every task upsert included in this payload (id → updatedAt|createdAt). */
|
|
227
239
|
pushedWatermarks: Map<string, string>;
|
|
240
|
+
pushedTaskChangeKeys?: Map<string, string>;
|
|
241
|
+
deltaDiagnostics?: WorkspaceSyncDeltaDiagnostics;
|
|
242
|
+
}
|
|
243
|
+
export type WorkspaceSyncBaselineResetReason = 'missing-baseline' | 'repair-reset' | 'storage-write-failed';
|
|
244
|
+
export interface WorkspaceSyncDomainDeltaDiagnostics {
|
|
245
|
+
mode: 'none' | 'delta' | 'send-all';
|
|
246
|
+
reason: WorkspaceSyncBaselineResetReason | 'full-state-domain' | null;
|
|
247
|
+
currentCount: number;
|
|
248
|
+
baselineCount: number;
|
|
249
|
+
changeCount: number;
|
|
250
|
+
}
|
|
251
|
+
export interface WorkspaceSyncDeltaDiagnostics {
|
|
252
|
+
totalChanges: number;
|
|
253
|
+
byOp: Record<string, number>;
|
|
254
|
+
baselineResetReason: WorkspaceSyncBaselineResetReason | null;
|
|
255
|
+
domains: {
|
|
256
|
+
tasks: WorkspaceSyncDomainDeltaDiagnostics;
|
|
257
|
+
initiatives: WorkspaceSyncDomainDeltaDiagnostics;
|
|
258
|
+
workstreams: WorkspaceSyncDomainDeltaDiagnostics;
|
|
259
|
+
aiProfiles: WorkspaceSyncDomainDeltaDiagnostics;
|
|
260
|
+
documents: WorkspaceSyncDomainDeltaDiagnostics;
|
|
261
|
+
assets: WorkspaceSyncDomainDeltaDiagnostics;
|
|
262
|
+
documentReviewSessions: WorkspaceSyncDomainDeltaDiagnostics;
|
|
263
|
+
documentReviewComments: WorkspaceSyncDomainDeltaDiagnostics;
|
|
264
|
+
annotatedAttachmentSessions: WorkspaceSyncDomainDeltaDiagnostics;
|
|
265
|
+
taskEvents: WorkspaceSyncDomainDeltaDiagnostics;
|
|
266
|
+
taxonomy: WorkspaceSyncDomainDeltaDiagnostics;
|
|
267
|
+
};
|
|
228
268
|
}
|
|
229
269
|
export declare function toWorkspaceSyncTaskSnapshot(task: TaskItem): WorkspaceSyncTaskSnapshot;
|
|
230
270
|
export interface WorkspaceSyncDocumentSnapshot {
|
|
@@ -268,6 +308,8 @@ export declare function buildWorkspaceSyncPayloadModel(input: {
|
|
|
268
308
|
aiProfiles?: WorkspaceSyncAiProfileSnapshot[];
|
|
269
309
|
documents?: WorkspaceSyncDocumentSnapshot[];
|
|
270
310
|
assets?: WorkspaceSyncAssetSnapshot[];
|
|
311
|
+
currentDocumentPaths?: Iterable<string>;
|
|
312
|
+
currentAssetPaths?: Iterable<string>;
|
|
271
313
|
documentReviewSessions?: WorkspaceSyncDocumentReviewSessionSnapshot[];
|
|
272
314
|
documentReviewComments?: WorkspaceSyncDocumentReviewCommentSnapshot[];
|
|
273
315
|
annotatedAttachmentSessions?: WorkspaceSyncAnnotatedAttachmentSessionSnapshot[];
|
|
@@ -289,6 +331,7 @@ export declare function buildWorkspaceSyncPayloadModel(input: {
|
|
|
289
331
|
lastPushedAnnotatedAttachmentSessionIds?: Set<string>;
|
|
290
332
|
lastPushedAnnotatedAttachmentSessionWatermarks?: Map<string, string>;
|
|
291
333
|
lastPushedTaskEventWatermarks?: Map<string, string>;
|
|
334
|
+
baselineResetReason?: WorkspaceSyncBaselineResetReason | null;
|
|
292
335
|
/**
|
|
293
336
|
* Watermark (updatedAt|createdAt) of each task as of its last successful push.
|
|
294
337
|
* When provided, only tasks whose watermark differs from this map are included
|
|
@@ -296,6 +339,8 @@ export declare function buildWorkspaceSyncPayloadModel(input: {
|
|
|
296
339
|
* Absent or empty map = include all tasks (first-push / full-sync behaviour).
|
|
297
340
|
*/
|
|
298
341
|
lastPushedWatermarks?: Map<string, string>;
|
|
342
|
+
lastPushedTaskChangeKeys?: Map<string, string>;
|
|
343
|
+
lastPushedAiProfileChangeKeys?: Map<string, string>;
|
|
299
344
|
}): WorkspaceSyncPayload;
|
|
300
345
|
export declare function buildWorkspaceSyncSignatureModel(input: {
|
|
301
346
|
workspaceId: string;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { parseAiProfileSurfaceType } from '../shared/aiProfileSurfaceType.js';
|
|
2
|
+
import { parseAiProfileSeatScope } from '../shared/aiProfileSeatScope.js';
|
|
2
3
|
import { serializeTaskForSync } from './taskSyncPayload.js';
|
|
4
|
+
import { aiProfileSyncResourceAdapter, taskSyncResourceAdapter, shouldSyncResource, } from './syncResourceAdapters.js';
|
|
5
|
+
import { normalizeSyncSameOriginAssetUrl } from './syncFieldSemantics.js';
|
|
3
6
|
export function toWorkspaceSyncTaskSnapshot(task) {
|
|
4
7
|
return serializeTaskForSync(task);
|
|
5
8
|
}
|
|
9
|
+
function normalizeWorkspaceSyncPathSet(value, fallback) {
|
|
10
|
+
const source = value ?? fallback;
|
|
11
|
+
return new Set(Array.from(source)
|
|
12
|
+
.map((entry) => String(entry || '').trim())
|
|
13
|
+
.filter((entry) => entry.length > 0));
|
|
14
|
+
}
|
|
6
15
|
function sortTaskEventsForSync(taskEvents) {
|
|
7
16
|
return [...taskEvents].sort((left, right) => {
|
|
8
17
|
const leftCreatedAt = String(left?.createdAt || '').trim();
|
|
@@ -29,49 +38,62 @@ export function buildWorkspaceSyncPayloadModel(input) {
|
|
|
29
38
|
.map(([taskId, deletedAt]) => [String(taskId || '').trim(), String(deletedAt || '').trim()])
|
|
30
39
|
.filter(([taskId, deletedAt]) => taskId.length > 0 && Number.isFinite(Date.parse(deletedAt))));
|
|
31
40
|
const lastWatermarks = input.lastPushedWatermarks;
|
|
32
|
-
const
|
|
41
|
+
const lastTaskChangeKeys = input.lastPushedTaskChangeKeys;
|
|
42
|
+
const isDirty = (task, archived) => {
|
|
33
43
|
if ((task?.referenceNumber === undefined || task?.referenceNumber === null) && Number.isFinite(Number(task?.localReferenceNumber))) {
|
|
34
44
|
return true;
|
|
35
45
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return false;
|
|
41
|
-
const currentWatermark = String(task?.updatedAt || task?.createdAt || '').trim();
|
|
42
|
-
return lastWatermarks.get(taskId) !== currentWatermark;
|
|
46
|
+
return shouldSyncResource(taskSyncResourceAdapter, { ...task, isArchived: archived }, {
|
|
47
|
+
watermarks: lastWatermarks,
|
|
48
|
+
changeKeys: lastTaskChangeKeys,
|
|
49
|
+
});
|
|
43
50
|
};
|
|
44
51
|
const activeTasksOrdered = sortTasksForSync(input.tasks || []);
|
|
45
52
|
const archivedTasksOrdered = sortTasksForSync(input.archivedTasks || []);
|
|
53
|
+
const currentTaskWatermarks = new Map();
|
|
54
|
+
const currentTaskChangeKeys = new Map();
|
|
46
55
|
const pushedWatermarks = new Map();
|
|
56
|
+
const pushedTaskChangeKeys = new Map();
|
|
47
57
|
const activeChanges = activeTasksOrdered
|
|
48
|
-
.filter((task) => !pendingDeleteIds.has(String(task?.id || '').trim()) && isDirty(task))
|
|
58
|
+
.filter((task) => !pendingDeleteIds.has(String(task?.id || '').trim()) && isDirty(task, false))
|
|
49
59
|
.map((task) => {
|
|
50
60
|
const taskId = String(task?.id || '').trim();
|
|
51
|
-
const wm =
|
|
52
|
-
|
|
61
|
+
const wm = taskSyncResourceAdapter.getWatermark(task);
|
|
62
|
+
const changeKey = taskSyncResourceAdapter.getChangeKey({ ...task, isArchived: false });
|
|
63
|
+
if (taskId) {
|
|
53
64
|
pushedWatermarks.set(taskId, wm);
|
|
65
|
+
pushedTaskChangeKeys.set(taskId, changeKey);
|
|
66
|
+
}
|
|
54
67
|
return { op: 'upsert', archived: false, task: toWorkspaceSyncTaskSnapshot(task) };
|
|
55
68
|
});
|
|
56
69
|
const archivedChanges = archivedTasksOrdered
|
|
57
|
-
.filter((task) => !pendingDeleteIds.has(String(task?.id || '').trim()) && isDirty(task))
|
|
70
|
+
.filter((task) => !pendingDeleteIds.has(String(task?.id || '').trim()) && isDirty(task, true))
|
|
58
71
|
.map((task) => {
|
|
59
72
|
const taskId = String(task?.id || '').trim();
|
|
60
|
-
const wm =
|
|
61
|
-
|
|
73
|
+
const wm = taskSyncResourceAdapter.getWatermark(task);
|
|
74
|
+
const changeKey = taskSyncResourceAdapter.getChangeKey({ ...task, isArchived: true });
|
|
75
|
+
if (taskId) {
|
|
62
76
|
pushedWatermarks.set(taskId, wm);
|
|
77
|
+
pushedTaskChangeKeys.set(taskId, changeKey);
|
|
78
|
+
}
|
|
63
79
|
return { op: 'upsert', archived: true, task: toWorkspaceSyncTaskSnapshot(task) };
|
|
64
80
|
});
|
|
65
81
|
const currentTaskIds = new Set();
|
|
66
82
|
for (const task of input.tasks || []) {
|
|
67
83
|
const taskId = String(task?.id || '').trim();
|
|
68
|
-
if (taskId)
|
|
69
|
-
|
|
84
|
+
if (!taskId)
|
|
85
|
+
continue;
|
|
86
|
+
currentTaskIds.add(taskId);
|
|
87
|
+
currentTaskWatermarks.set(taskId, taskSyncResourceAdapter.getWatermark(task));
|
|
88
|
+
currentTaskChangeKeys.set(taskId, taskSyncResourceAdapter.getChangeKey({ ...task, isArchived: false }));
|
|
70
89
|
}
|
|
71
90
|
for (const task of input.archivedTasks || []) {
|
|
72
91
|
const taskId = String(task?.id || '').trim();
|
|
73
|
-
if (taskId)
|
|
74
|
-
|
|
92
|
+
if (!taskId)
|
|
93
|
+
continue;
|
|
94
|
+
currentTaskIds.add(taskId);
|
|
95
|
+
currentTaskWatermarks.set(taskId, taskSyncResourceAdapter.getWatermark(task));
|
|
96
|
+
currentTaskChangeKeys.set(taskId, taskSyncResourceAdapter.getChangeKey({ ...task, isArchived: true }));
|
|
75
97
|
}
|
|
76
98
|
const deleteChanges = Array.from(input.lastPushedTaskIds)
|
|
77
99
|
.filter((taskId) => !currentTaskIds.has(taskId))
|
|
@@ -175,9 +197,13 @@ export function buildWorkspaceSyncPayloadModel(input) {
|
|
|
175
197
|
.map((profile) => String(profile?.id || '').trim())
|
|
176
198
|
.filter((profileId) => profileId.length > 0));
|
|
177
199
|
const currentAiProfileWatermarks = new Map((Array.isArray(input.aiProfiles) ? input.aiProfiles : [])
|
|
178
|
-
.map((profile) => [String(profile?.id || '').trim(),
|
|
200
|
+
.map((profile) => [String(profile?.id || '').trim(), aiProfileSyncResourceAdapter.getWatermark(profile)])
|
|
201
|
+
.filter(([profileId]) => profileId.length > 0));
|
|
202
|
+
const currentAiProfileChangeKeys = new Map((Array.isArray(input.aiProfiles) ? input.aiProfiles : [])
|
|
203
|
+
.map((profile) => [String(profile?.id || '').trim(), aiProfileSyncResourceAdapter.getChangeKey(profile)])
|
|
179
204
|
.filter(([profileId]) => profileId.length > 0));
|
|
180
205
|
const previousAiProfileWatermarks = input.lastPushedAiProfileWatermarks;
|
|
206
|
+
const previousAiProfileChangeKeys = input.lastPushedAiProfileChangeKeys;
|
|
181
207
|
const shouldSendAllAiProfiles = !previousAiProfileWatermarks || previousAiProfileWatermarks.size === 0;
|
|
182
208
|
const aiProfileUpsertChanges = (Array.isArray(input.aiProfiles) ? input.aiProfiles : [])
|
|
183
209
|
.map((profile) => ({
|
|
@@ -190,14 +216,30 @@ export function buildWorkspaceSyncPayloadModel(input) {
|
|
|
190
216
|
username: String(profile.username || '').trim(),
|
|
191
217
|
icon: String(profile.icon || 'Bot').trim() || 'Bot',
|
|
192
218
|
color: String(profile.color || '#8b5cf6').trim() || '#8b5cf6',
|
|
219
|
+
avatarUrl: normalizeSyncSameOriginAssetUrl(profile.avatarUrl),
|
|
220
|
+
avatarSourceUrl: normalizeSyncSameOriginAssetUrl(profile.avatarSourceUrl),
|
|
193
221
|
description: typeof profile.description === 'string' ? profile.description.trim() || null : null,
|
|
194
222
|
role: typeof profile.role === 'string' ? profile.role.trim() || null : null,
|
|
195
223
|
provider: typeof profile.provider === 'string' ? profile.provider.trim() || null : null,
|
|
196
224
|
model: typeof profile.model === 'string' ? profile.model.trim() || null : null,
|
|
197
225
|
surfaceType: parseAiProfileSurfaceType(profile.surfaceType),
|
|
226
|
+
seatScope: parseAiProfileSeatScope(profile.seatScope),
|
|
198
227
|
providerMetadata: profile.providerMetadata && typeof profile.providerMetadata === 'object' && !Array.isArray(profile.providerMetadata)
|
|
199
228
|
? profile.providerMetadata
|
|
200
229
|
: null,
|
|
230
|
+
archivedAt: typeof profile.archivedAt === 'string' && profile.archivedAt.trim().length > 0
|
|
231
|
+
? profile.archivedAt.trim()
|
|
232
|
+
: null,
|
|
233
|
+
archivedBy: typeof profile.archivedBy === 'string' && profile.archivedBy.trim().length > 0
|
|
234
|
+
? profile.archivedBy.trim()
|
|
235
|
+
: null,
|
|
236
|
+
archivedReason: typeof profile.archivedReason === 'string' ? profile.archivedReason.trim() || null : null,
|
|
237
|
+
mergedIntoProfileId: typeof profile.mergedIntoProfileId === 'string' && profile.mergedIntoProfileId.trim().length > 0
|
|
238
|
+
? profile.mergedIntoProfileId.trim()
|
|
239
|
+
: null,
|
|
240
|
+
rosterStateUpdatedAt: typeof profile.rosterStateUpdatedAt === 'string' && profile.rosterStateUpdatedAt.trim().length > 0
|
|
241
|
+
? profile.rosterStateUpdatedAt.trim()
|
|
242
|
+
: null,
|
|
201
243
|
createdAt: String(profile.createdAt || '').trim(),
|
|
202
244
|
updatedAt: String(profile.updatedAt || profile.createdAt || '').trim(),
|
|
203
245
|
lastActiveAt: typeof profile.lastActiveAt === 'string' && profile.lastActiveAt.trim().length > 0
|
|
@@ -209,11 +251,13 @@ export function buildWorkspaceSyncPayloadModel(input) {
|
|
|
209
251
|
.filter((change) => {
|
|
210
252
|
if (shouldSendAllAiProfiles)
|
|
211
253
|
return true;
|
|
212
|
-
return
|
|
254
|
+
return shouldSyncResource(aiProfileSyncResourceAdapter, change.profile, {
|
|
255
|
+
watermarks: previousAiProfileWatermarks,
|
|
256
|
+
changeKeys: previousAiProfileChangeKeys,
|
|
257
|
+
});
|
|
213
258
|
});
|
|
214
|
-
const currentDocumentPaths =
|
|
215
|
-
.map((doc) => String(doc?.path || '').trim())
|
|
216
|
-
.filter((docPath) => docPath.length > 0));
|
|
259
|
+
const currentDocumentPaths = normalizeWorkspaceSyncPathSet(input.currentDocumentPaths, (Array.isArray(input.documents) ? input.documents : [])
|
|
260
|
+
.map((doc) => String(doc?.path || '').trim()));
|
|
217
261
|
const deleteDocumentPaths = new Set(Array.from(input.lastPushedDocumentPaths || new Set())
|
|
218
262
|
.map((docPath) => String(docPath || '').trim())
|
|
219
263
|
.filter((docPath) => docPath.length > 0 && !currentDocumentPaths.has(docPath)));
|
|
@@ -244,9 +288,8 @@ export function buildWorkspaceSyncPayloadModel(input) {
|
|
|
244
288
|
return true;
|
|
245
289
|
return previousDocumentWatermarks.get(doc.path) !== doc.updatedAt;
|
|
246
290
|
});
|
|
247
|
-
const currentAssetPaths =
|
|
248
|
-
.map((asset) => String(asset?.path || '').trim())
|
|
249
|
-
.filter((assetPath) => assetPath.length > 0));
|
|
291
|
+
const currentAssetPaths = normalizeWorkspaceSyncPathSet(input.currentAssetPaths, (Array.isArray(input.assets) ? input.assets : [])
|
|
292
|
+
.map((asset) => String(asset?.path || '').trim()));
|
|
250
293
|
const deleteAssetPaths = new Set(Array.from(input.lastPushedAssetPaths || new Set())
|
|
251
294
|
.map((assetPath) => String(assetPath || '').trim())
|
|
252
295
|
.filter((assetPath) => assetPath.length > 0 && !currentAssetPaths.has(assetPath)));
|
|
@@ -500,9 +543,46 @@ export function buildWorkspaceSyncPayloadModel(input) {
|
|
|
500
543
|
deletedAt: pendingDeleteWatermarks.get(taskId) || payloadBuiltAt
|
|
501
544
|
}))
|
|
502
545
|
];
|
|
546
|
+
const baselineResetReason = input.baselineResetReason ?? null;
|
|
547
|
+
const resolveDomainDeltaDiagnostics = (args) => {
|
|
548
|
+
const changeCount = args.upsertCount + (args.deleteCount || 0);
|
|
549
|
+
if (args.currentCount === 0 && changeCount === 0) {
|
|
550
|
+
return {
|
|
551
|
+
mode: 'none',
|
|
552
|
+
reason: null,
|
|
553
|
+
currentCount: 0,
|
|
554
|
+
baselineCount: args.baselineCount,
|
|
555
|
+
changeCount
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
if (args.alwaysFull) {
|
|
559
|
+
return {
|
|
560
|
+
mode: changeCount > 0 ? 'send-all' : 'none',
|
|
561
|
+
reason: changeCount > 0 ? 'full-state-domain' : null,
|
|
562
|
+
currentCount: args.currentCount,
|
|
563
|
+
baselineCount: args.baselineCount,
|
|
564
|
+
changeCount
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
const shouldSendAll = args.baselineCount === 0 && args.currentCount > 0 && args.upsertCount >= args.currentCount;
|
|
568
|
+
return {
|
|
569
|
+
mode: shouldSendAll ? 'send-all' : 'delta',
|
|
570
|
+
reason: shouldSendAll ? (baselineResetReason || 'missing-baseline') : null,
|
|
571
|
+
currentCount: args.currentCount,
|
|
572
|
+
baselineCount: args.baselineCount,
|
|
573
|
+
changeCount
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
const byOp = changes.reduce((acc, change) => {
|
|
577
|
+
const op = String(change.op || '').trim();
|
|
578
|
+
acc[op] = (acc[op] || 0) + 1;
|
|
579
|
+
return acc;
|
|
580
|
+
}, {});
|
|
503
581
|
return {
|
|
504
582
|
changes,
|
|
505
583
|
currentTaskIds: new Set(Array.from(currentTaskIds).filter((taskId) => !pendingDeleteIds.has(taskId))),
|
|
584
|
+
currentTaskWatermarks: new Map(Array.from(currentTaskWatermarks.entries()).filter(([taskId]) => !pendingDeleteIds.has(taskId))),
|
|
585
|
+
currentTaskChangeKeys: new Map(Array.from(currentTaskChangeKeys.entries()).filter(([taskId]) => !pendingDeleteIds.has(taskId))),
|
|
506
586
|
deleteTaskIds,
|
|
507
587
|
currentInitiativeIds,
|
|
508
588
|
currentInitiativeWatermarks,
|
|
@@ -510,6 +590,7 @@ export function buildWorkspaceSyncPayloadModel(input) {
|
|
|
510
590
|
currentWorkstreamWatermarks,
|
|
511
591
|
currentAiProfileIds,
|
|
512
592
|
currentAiProfileWatermarks,
|
|
593
|
+
currentAiProfileChangeKeys,
|
|
513
594
|
currentDocumentPaths,
|
|
514
595
|
deleteDocumentPaths,
|
|
515
596
|
currentDocumentWatermarks,
|
|
@@ -526,7 +607,77 @@ export function buildWorkspaceSyncPayloadModel(input) {
|
|
|
526
607
|
deleteAnnotatedAttachmentSessionIds,
|
|
527
608
|
currentAnnotatedAttachmentSessionWatermarks,
|
|
528
609
|
currentTaskEventWatermarks,
|
|
529
|
-
pushedWatermarks
|
|
610
|
+
pushedWatermarks,
|
|
611
|
+
pushedTaskChangeKeys,
|
|
612
|
+
deltaDiagnostics: {
|
|
613
|
+
totalChanges: changes.length,
|
|
614
|
+
byOp,
|
|
615
|
+
baselineResetReason,
|
|
616
|
+
domains: {
|
|
617
|
+
tasks: resolveDomainDeltaDiagnostics({
|
|
618
|
+
currentCount: currentTaskIds.size,
|
|
619
|
+
baselineCount: lastWatermarks?.size || 0,
|
|
620
|
+
upsertCount: activeChanges.length + archivedChanges.length,
|
|
621
|
+
deleteCount: deleteTaskIds.size
|
|
622
|
+
}),
|
|
623
|
+
initiatives: resolveDomainDeltaDiagnostics({
|
|
624
|
+
currentCount: currentInitiativeIds.size,
|
|
625
|
+
baselineCount: previousInitiativeWatermarks?.size || 0,
|
|
626
|
+
upsertCount: initiativeUpsertChanges.length
|
|
627
|
+
}),
|
|
628
|
+
workstreams: resolveDomainDeltaDiagnostics({
|
|
629
|
+
currentCount: currentWorkstreamIds.size,
|
|
630
|
+
baselineCount: previousWorkstreamWatermarks?.size || 0,
|
|
631
|
+
upsertCount: workstreamUpsertChanges.length
|
|
632
|
+
}),
|
|
633
|
+
aiProfiles: resolveDomainDeltaDiagnostics({
|
|
634
|
+
currentCount: currentAiProfileIds.size,
|
|
635
|
+
baselineCount: previousAiProfileWatermarks?.size || 0,
|
|
636
|
+
upsertCount: aiProfileUpsertChanges.length
|
|
637
|
+
}),
|
|
638
|
+
documents: resolveDomainDeltaDiagnostics({
|
|
639
|
+
currentCount: currentDocumentPaths.size,
|
|
640
|
+
baselineCount: previousDocumentWatermarks?.size || 0,
|
|
641
|
+
upsertCount: documentUpsertChanges.length,
|
|
642
|
+
deleteCount: deleteDocumentPaths.size
|
|
643
|
+
}),
|
|
644
|
+
assets: resolveDomainDeltaDiagnostics({
|
|
645
|
+
currentCount: currentAssetPaths.size,
|
|
646
|
+
baselineCount: previousAssetWatermarks?.size || 0,
|
|
647
|
+
upsertCount: assetUpsertChanges.length,
|
|
648
|
+
deleteCount: deleteAssetPaths.size
|
|
649
|
+
}),
|
|
650
|
+
documentReviewSessions: resolveDomainDeltaDiagnostics({
|
|
651
|
+
currentCount: currentDocumentReviewSessionIds.size,
|
|
652
|
+
baselineCount: previousDocumentReviewSessionWatermarks?.size || 0,
|
|
653
|
+
upsertCount: documentReviewSessionUpsertChanges.length,
|
|
654
|
+
deleteCount: deleteDocumentReviewSessionIds.size
|
|
655
|
+
}),
|
|
656
|
+
documentReviewComments: resolveDomainDeltaDiagnostics({
|
|
657
|
+
currentCount: currentDocumentReviewCommentIds.size,
|
|
658
|
+
baselineCount: previousDocumentReviewCommentWatermarks?.size || 0,
|
|
659
|
+
upsertCount: documentReviewCommentUpsertChanges.length,
|
|
660
|
+
deleteCount: deleteDocumentReviewCommentIds.size
|
|
661
|
+
}),
|
|
662
|
+
annotatedAttachmentSessions: resolveDomainDeltaDiagnostics({
|
|
663
|
+
currentCount: currentAnnotatedAttachmentSessionIds.size,
|
|
664
|
+
baselineCount: previousAnnotatedAttachmentSessionWatermarks?.size || 0,
|
|
665
|
+
upsertCount: annotatedAttachmentSessionUpsertChanges.length,
|
|
666
|
+
deleteCount: deleteAnnotatedAttachmentSessionIds.size
|
|
667
|
+
}),
|
|
668
|
+
taskEvents: resolveDomainDeltaDiagnostics({
|
|
669
|
+
currentCount: currentTaskEventWatermarks.size,
|
|
670
|
+
baselineCount: previousTaskEventWatermarks?.size || 0,
|
|
671
|
+
upsertCount: taskEventUpsertChanges.length
|
|
672
|
+
}),
|
|
673
|
+
taxonomy: resolveDomainDeltaDiagnostics({
|
|
674
|
+
currentCount: (input.taxonomyState && typeof input.taxonomyState === 'object') || Array.isArray(input.taxonomies) ? 1 : 0,
|
|
675
|
+
baselineCount: 0,
|
|
676
|
+
upsertCount: byOp['taxonomy-upsert'] || 0,
|
|
677
|
+
alwaysFull: true
|
|
678
|
+
})
|
|
679
|
+
}
|
|
680
|
+
}
|
|
530
681
|
};
|
|
531
682
|
}
|
|
532
683
|
export function buildWorkspaceSyncSignatureModel(input) {
|
|
@@ -570,7 +721,11 @@ export function buildWorkspaceSyncSignatureModel(input) {
|
|
|
570
721
|
id: String(profile.id || '').trim(),
|
|
571
722
|
updatedAt: String(profile.updatedAt || profile.createdAt || '').trim(),
|
|
572
723
|
name: String(profile.name || '').trim(),
|
|
573
|
-
username: String(profile.username || '').trim()
|
|
724
|
+
username: String(profile.username || '').trim(),
|
|
725
|
+
archivedAt: String(profile.archivedAt || '').trim(),
|
|
726
|
+
archivedReason: String(profile.archivedReason || '').trim(),
|
|
727
|
+
mergedIntoProfileId: String(profile.mergedIntoProfileId || '').trim(),
|
|
728
|
+
rosterStateUpdatedAt: String(profile.rosterStateUpdatedAt || '').trim()
|
|
574
729
|
}))
|
|
575
730
|
.filter((profile) => profile.id.length > 0)
|
|
576
731
|
.sort((a, b) => a.id.localeCompare(b.id))
|