@taskforcehq/taskforce 0.3.170 → 0.3.301
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 +71 -21
- package/dist/Taskforce.module.css +3394 -5981
- package/dist/TaskforceCore.CategoryFallback.test.js +5 -2
- package/dist/TaskforceCore.filter-persistence.test.js +402 -0
- package/dist/TaskforceCore.js +388 -71
- package/dist/TaskforceCore.routing.test.js +311 -0
- package/dist/TaskforceCore.test.js +3344 -615
- package/dist/TaskforceWidget.js +3 -2
- package/dist/__tests__/localizationCatalogs.test.js +48 -31
- package/dist/__tests__/workflowSimulation.test.js +2 -2
- package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.d.ts +60 -0
- package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.js +324 -0
- package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.test.js +278 -0
- package/dist/annotatedAttachments/payload.d.ts +2 -0
- package/dist/annotatedAttachments/payload.js +54 -0
- package/dist/annotatedAttachments/payload.test.js +67 -0
- package/dist/annotatedAttachments/service.d.ts +49 -0
- package/dist/annotatedAttachments/service.js +121 -0
- package/dist/annotatedAttachments/types.d.ts +86 -0
- package/dist/cli.js +74 -25
- package/dist/compat/deploymentCompat.d.ts +12 -0
- package/dist/compat/deploymentCompat.js +43 -0
- package/dist/compat/workspaceSyncCompat.d.ts +6 -0
- package/dist/compat/workspaceSyncCompat.js +79 -0
- package/dist/compat/workspaceSyncCompat.test.js +87 -0
- package/dist/components/features/AgentsModule.d.ts +5 -0
- package/dist/components/features/AgentsModule.js +131 -0
- package/dist/components/features/AgentsModule.test.js +102 -0
- package/dist/components/features/AnnotatedAttachmentWorkspace.d.ts +24 -0
- package/dist/components/features/AnnotatedAttachmentWorkspace.js +1942 -0
- package/dist/components/features/AnnotatedAttachmentWorkspace.test.js +2831 -0
- package/dist/components/features/DocumentGenerateModal.js +8 -16
- package/dist/components/features/DocumentIndex.d.ts +3 -4
- package/dist/components/features/DocumentIndex.js +22 -10
- package/dist/components/features/DocumentViewer.d.ts +6 -2
- package/dist/components/features/DocumentViewer.js +1000 -18
- package/dist/components/features/DocumentWorkspace.d.ts +40 -2
- package/dist/components/features/DocumentWorkspace.js +96 -16
- package/dist/components/features/DocumentWorkspace.test.js +1202 -0
- package/dist/components/features/InitiativesModule.d.ts +22 -0
- package/dist/components/features/InitiativesModule.js +33 -0
- package/dist/components/features/TaskSettings.d.ts +41 -32
- package/dist/components/features/TaskSettings.js +798 -313
- package/dist/components/features/TaskSettings.test.js +1221 -47
- package/dist/components/features/WorkflowsModule.d.ts +27 -0
- package/dist/components/features/WorkflowsModule.js +21 -0
- package/dist/components/features/documentWorkspaceFilters.d.ts +10 -0
- package/dist/components/features/documentWorkspaceFilters.js +11 -0
- package/dist/components/features/settings/CategoryManager.d.ts +2 -0
- package/dist/components/features/settings/CategoryManager.js +15 -8
- package/dist/components/features/settings/PriorityManager.d.ts +18 -0
- package/dist/components/features/settings/PriorityManager.js +51 -0
- package/dist/components/features/settings/TaxonomyEditor.d.ts +2 -1
- package/dist/components/features/settings/TaxonomyEditor.js +41 -18
- package/dist/components/features/settings/TaxonomyLibraryManager.d.ts +26 -0
- package/dist/components/features/settings/TaxonomyLibraryManager.js +301 -0
- package/dist/components/features/settings/TaxonomyLibraryManager.test.js +141 -0
- package/dist/components/features/settings/TaxonomyManager.d.ts +35 -12
- package/dist/components/features/settings/TaxonomyManager.js +59 -27
- package/dist/components/features/settings/TypeManager.d.ts +11 -0
- package/dist/components/features/settings/TypeManager.js +48 -11
- package/dist/components/features/settings/{WorkflowEditorPrototype.d.ts → WorkflowEditor.d.ts} +2 -2
- package/dist/components/features/settings/{WorkflowEditorPrototype.js → WorkflowEditor.js} +3 -3
- package/dist/components/task/TaskActionHeader.d.ts +12 -2
- package/dist/components/task/TaskActionHeader.js +64 -8
- package/dist/components/task/TaskActionHeader.test.js +73 -0
- package/dist/components/task/TaskCard.d.ts +14 -16
- package/dist/components/task/TaskCard.js +144 -174
- package/dist/components/task/TaskCard.test.js +416 -64
- package/dist/components/task/TaskContextUpload.d.ts +6 -5
- package/dist/components/task/TaskContextUpload.js +199 -64
- package/dist/components/task/TaskContextUpload.test.js +331 -14
- package/dist/components/task/TaskForm.d.ts +23 -29
- package/dist/components/task/TaskForm.js +348 -169
- package/dist/components/task/TaskForm.test.js +419 -23
- package/dist/components/task/TaskKanban.d.ts +20 -21
- package/dist/components/task/TaskKanban.js +176 -316
- package/dist/components/task/TaskKanban.planning-drop.test.js +93 -0
- package/dist/components/task/TaskList.d.ts +22 -11
- package/dist/components/task/TaskList.js +98 -12
- package/dist/components/task/TaskList.test.js +206 -7
- package/dist/components/task/TaskReferenceBadge.d.ts +12 -0
- package/dist/components/task/TaskReferenceBadge.js +5 -0
- package/dist/components/task/TaskStatusActions.d.ts +12 -0
- package/dist/components/task/TaskStatusActions.js +18 -0
- package/dist/components/task/TaskStatusActions.test.js +45 -0
- package/dist/components/ui/ImageReferenceBadge.d.ts +12 -0
- package/dist/components/ui/ImageReferenceBadge.js +5 -0
- package/dist/components/ui/LevelSelector.d.ts +2 -1
- package/dist/components/ui/LevelSelector.js +2 -2
- package/dist/components/ui/Markdown.d.ts +1 -2
- package/dist/components/ui/Markdown.js +2 -13
- package/dist/components/ui/Modal.d.ts +3 -2
- package/dist/components/ui/Modal.js +4 -3
- package/dist/components/ui/MultiSelectFilter.d.ts +3 -1
- package/dist/components/ui/MultiSelectFilter.js +2 -2
- package/dist/components/ui/ReferenceBadgeButton.d.ts +13 -0
- package/dist/components/ui/ReferenceBadgeButton.js +6 -0
- package/dist/components/ui/TaxonomyDropdown.d.ts +7 -1
- package/dist/components/ui/TaxonomyDropdown.js +58 -23
- package/dist/components/ui/TopNoticeLayer.d.ts +7 -0
- package/dist/components/ui/TopNoticeLayer.js +14 -0
- package/dist/components/ui/TopNoticeLayer.test.js +25 -0
- package/dist/components/views/AppShellHeader.d.ts +13 -0
- package/dist/components/views/AppShellHeader.js +19 -0
- package/dist/components/views/AppShellHeader.test.js +21 -0
- package/dist/components/views/PlanComparisonPage.d.ts +73 -0
- package/dist/components/views/PlanComparisonPage.js +196 -0
- package/dist/components/views/PlanComparisonPage.test.js +251 -0
- package/dist/components/views/PlansPage.d.ts +14 -0
- package/dist/components/views/PlansPage.js +355 -0
- package/dist/components/views/StandaloneLayout.d.ts +2 -2
- package/dist/components/views/StandaloneLayout.js +2227 -1188
- package/dist/components/views/WidgetView.d.ts +2 -2
- package/dist/components/views/WidgetView.js +149 -43
- package/dist/components/views/chrome/WorkspaceChromeSections.d.ts +57 -0
- package/dist/components/views/chrome/WorkspaceChromeSections.js +38 -0
- package/dist/components/views/chrome/WorkspaceChromeSections.test.js +54 -0
- package/dist/components/views/chrome/workspaceChrome.d.ts +31 -0
- package/dist/components/views/chrome/workspaceChrome.js +108 -0
- package/dist/components/views/chrome/workspaceChrome.test.js +52 -0
- package/dist/components/views/panels/DocumentFilterToolbar.d.ts +10 -0
- package/dist/components/views/panels/DocumentFilterToolbar.js +7 -0
- package/dist/components/views/panels/DocumentFilterToolbar.test.js +19 -0
- package/dist/components/views/panels/FilterToolbar.d.ts +68 -0
- package/dist/components/views/panels/FilterToolbar.js +21 -0
- package/dist/components/views/panels/FilterToolbar.test.d.ts +1 -0
- package/dist/components/views/panels/FilterToolbar.test.js +45 -0
- package/dist/components/views/panels/FilterToolbarControls.d.ts +47 -0
- package/dist/components/views/panels/FilterToolbarControls.js +61 -0
- package/dist/components/views/panels/PlanningDrawer.d.ts +115 -0
- package/dist/components/views/panels/PlanningDrawer.js +220 -0
- package/dist/components/views/panels/ScheduleSidebar.d.ts +52 -0
- package/dist/components/views/panels/ScheduleSidebar.js +127 -0
- package/dist/components/views/panels/scheduleUtils.d.ts +14 -0
- package/dist/components/views/panels/scheduleUtils.js +79 -0
- package/dist/components/views/teamManagementAccess.d.ts +6 -0
- package/dist/components/views/teamManagementAccess.js +18 -0
- package/dist/components/views/teamManagementAccess.test.d.ts +1 -0
- package/dist/components/views/teamManagementAccess.test.js +44 -0
- package/dist/config/clientDeployment.d.ts +2 -0
- package/dist/config/clientDeployment.js +13 -0
- package/dist/config/cloudEnvironment.d.ts +15 -0
- package/dist/config/cloudEnvironment.js +60 -0
- package/dist/config/deployment.d.ts +20 -0
- package/dist/config/deployment.js +67 -0
- package/dist/config/deployment.test.d.ts +1 -0
- package/dist/config/deployment.test.js +88 -0
- package/dist/config/envSchema.js +36 -8
- package/dist/config/envSchema.test.js +28 -0
- package/dist/core/AiProfileService.d.ts +66 -0
- package/dist/core/AiProfileService.js +320 -0
- package/dist/core/AiProfileService.test.d.ts +1 -0
- package/dist/core/AiProfileService.test.js +164 -0
- package/dist/core/AiProfiles.test.d.ts +1 -0
- package/dist/core/AiProfiles.test.js +449 -0
- package/dist/core/AttachmentLinkService.d.ts +15 -0
- package/dist/core/AttachmentLinkService.js +157 -0
- package/dist/core/AuthTokenService.d.ts +44 -0
- package/dist/core/AuthTokenService.js +207 -0
- package/dist/core/CreatedBy.test.js +134 -6
- package/dist/core/DeletedTaskLifecycleService.d.ts +33 -0
- package/dist/core/DeletedTaskLifecycleService.js +158 -0
- package/dist/core/DeletedTaskTrash.test.d.ts +1 -0
- package/dist/core/DeletedTaskTrash.test.js +104 -0
- package/dist/core/EntitlementsPolicy.test.js +78 -5
- package/dist/core/GlobalSettingsService.d.ts +16 -0
- package/dist/core/GlobalSettingsService.js +370 -0
- package/dist/core/JsonBackupRuntime.test.d.ts +1 -0
- package/dist/core/JsonBackupRuntime.test.js +155 -0
- package/dist/core/McpTokenService.d.ts +118 -0
- package/dist/core/McpTokenService.js +921 -0
- package/dist/core/PlanEntitlementService.d.ts +201 -0
- package/dist/core/PlanEntitlementService.js +1442 -0
- package/dist/core/PlanVersionPolicy.test.d.ts +1 -0
- package/dist/core/PlanVersionPolicy.test.js +178 -0
- package/dist/core/PlanningEntities.test.d.ts +1 -0
- package/dist/core/PlanningEntities.test.js +95 -0
- package/dist/core/ScheduleFields.test.js +15 -19
- package/dist/core/SignupMonetizationSettings.test.d.ts +1 -0
- package/dist/core/SignupMonetizationSettings.test.js +159 -0
- package/dist/core/Stats.test.d.ts +1 -0
- package/dist/core/Stats.test.js +36 -0
- package/dist/core/SyncReconciliationService.d.ts +93 -0
- package/dist/core/SyncReconciliationService.js +406 -0
- package/dist/core/SystemAdmin.test.js +578 -13
- package/dist/core/TaskActivityService.d.ts +21 -0
- package/dist/core/TaskActivityService.js +130 -0
- package/dist/core/TaskAttachmentsCanonical.test.d.ts +1 -0
- package/dist/core/TaskAttachmentsCanonical.test.js +306 -0
- package/dist/core/TaskAuditTimeline.test.d.ts +1 -0
- package/dist/core/TaskAuditTimeline.test.js +132 -0
- package/dist/core/TaskTaxonomyValidation.test.js +338 -15
- package/dist/core/Taskforce.d.ts +930 -183
- package/dist/core/Taskforce.ids.test.js +252 -0
- package/dist/core/Taskforce.js +3848 -2532
- package/dist/core/Taskforce.mcpAuth.test.d.ts +1 -0
- package/dist/core/Taskforce.mcpAuth.test.js +343 -0
- package/dist/core/Taskforce.realtimeMutation.test.js +57 -2
- package/dist/core/TaxonomySettingsService.d.ts +18 -0
- package/dist/core/TaxonomySettingsService.js +162 -0
- package/dist/core/WorkspaceDelete.test.js +32 -13
- package/dist/core/WorkspaceLifecycleService.d.ts +11 -0
- package/dist/core/WorkspaceLifecycleService.js +88 -0
- package/dist/core/WorkspacePermissions.test.js +95 -0
- package/dist/core/WorkspacePlanMode.test.js +114 -1
- package/dist/core/WorkspacePreferenceService.d.ts +41 -0
- package/dist/core/WorkspacePreferenceService.js +246 -0
- package/dist/core/WorkspaceSyncSettings.test.d.ts +1 -0
- package/dist/core/WorkspaceSyncSettings.test.js +65 -0
- package/dist/core/__tests__/TaskAttachmentsCanonical.test.d.ts +1 -0
- package/dist/core/__tests__/TaskAttachmentsCanonical.test.js +212 -0
- package/dist/core/shared.d.ts +36 -0
- package/dist/core/shared.js +128 -0
- package/dist/core/types.d.ts +614 -0
- package/dist/core/types.js +27 -0
- package/dist/documentReviews/DocumentReviewCommentStore.d.ts +56 -0
- package/dist/documentReviews/DocumentReviewCommentStore.js +230 -0
- package/dist/documentReviews/DocumentReviewSessionStore.d.ts +52 -0
- package/dist/documentReviews/DocumentReviewSessionStore.js +193 -0
- package/dist/documentReviews/DocumentReviewSessionStore.test.d.ts +1 -0
- package/dist/documentReviews/DocumentReviewSessionStore.test.js +127 -0
- package/dist/documentReviews/service.d.ts +68 -0
- package/dist/documentReviews/service.js +210 -0
- package/dist/documentReviews/types.d.ts +58 -0
- package/dist/documentReviews/types.js +1 -0
- package/dist/hooks/auth/useAuthGuardPolicy.d.ts +2 -0
- package/dist/hooks/auth/useAuthGuardPolicy.js +1 -0
- package/dist/hooks/tasks/useCurrentTaskRelations.d.ts +15 -0
- package/dist/hooks/tasks/useCurrentTaskRelations.js +37 -0
- package/dist/hooks/tasks/useTaskActions.d.ts +3 -0
- package/dist/hooks/tasks/useTaskActions.js +2 -0
- package/dist/hooks/tasks/useTaskEditorNavigation.d.ts +65 -0
- package/dist/hooks/tasks/useTaskEditorNavigation.js +235 -0
- package/dist/hooks/tasks/useTaskFilters.d.ts +2 -0
- package/dist/hooks/tasks/useTaskFilters.js +2 -0
- package/dist/hooks/tasks/useTaskFormActions.d.ts +58 -0
- package/dist/hooks/tasks/useTaskFormActions.js +365 -0
- package/dist/hooks/tasks/useTaskRelationships.d.ts +16 -0
- package/dist/hooks/tasks/useTaskRelationships.js +64 -0
- package/dist/hooks/ui/useResourceExport.d.ts +19 -0
- package/dist/hooks/ui/useResourceExport.js +84 -0
- package/dist/hooks/ui/useSettingsModel.d.ts +203 -0
- package/dist/hooks/ui/useSettingsModel.js +125 -0
- package/dist/hooks/ui/useSettingsPersistence.d.ts +36 -0
- package/dist/hooks/ui/useSettingsPersistence.js +254 -0
- package/dist/hooks/ui/useSettingsTaxonomyManagement.d.ts +119 -0
- package/dist/hooks/ui/useSettingsTaxonomyManagement.js +536 -0
- package/dist/hooks/ui/useUiNotice.d.ts +1 -0
- package/dist/hooks/ui/useUiNotice.js +1 -0
- package/dist/hooks/ui/useWorkflowTemplates.d.ts +37 -0
- package/dist/hooks/ui/useWorkflowTemplates.js +111 -0
- package/dist/hooks/ui/useZenMode.d.ts +5 -0
- package/dist/hooks/ui/useZenMode.js +32 -0
- package/dist/hooks/useFilterSort.d.ts +60 -0
- package/dist/hooks/useFilterSort.js +362 -0
- package/dist/hooks/useFilterSort.test.d.ts +1 -0
- package/dist/hooks/useFilterSort.test.js +333 -0
- package/dist/hooks/useRealtimeSync.d.ts +1 -0
- package/dist/hooks/useRealtimeSync.js +24 -9
- package/dist/hooks/useRealtimeSync.test.js +28 -1
- package/dist/hooks/useSyncOrchestrator.aiProfiles.test.d.ts +1 -0
- package/dist/hooks/useSyncOrchestrator.aiProfiles.test.js +34 -0
- package/dist/hooks/useSyncOrchestrator.d.ts +65 -103
- package/dist/hooks/useSyncOrchestrator.js +1538 -670
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +700 -174
- package/dist/hooks/useTaskData.d.ts +35 -0
- package/dist/hooks/useTaskData.js +243 -0
- package/dist/hooks/useTaskData.test.d.ts +1 -0
- package/dist/hooks/useTaskData.test.js +180 -0
- package/dist/hooks/useTaskMutations.d.ts +46 -0
- package/dist/hooks/useTaskMutations.js +472 -0
- package/dist/hooks/useTaskMutations.test.d.ts +1 -0
- package/dist/hooks/useTaskMutations.test.js +80 -0
- package/dist/hooks/useTaskforce.contract.test.d.ts +1 -0
- package/dist/hooks/useTaskforce.contract.test.js +7 -0
- package/dist/hooks/useTaskforce.d.ts +260 -295
- package/dist/hooks/useTaskforce.js +1954 -2623
- package/dist/hooks/useTaskforce.priority-filters.test.js +6 -11
- package/dist/hooks/useTaskforce.sync-behavior.test.d.ts +1 -0
- package/dist/hooks/useTaskforce.sync-behavior.test.js +1120 -0
- package/dist/hooks/useUiNotice.d.ts +16 -0
- package/dist/hooks/useUiNotice.js +49 -0
- package/dist/hooks/useWorkspaceSyncController.d.ts +23 -46
- package/dist/hooks/useWorkspaceSyncController.js +280 -461
- package/dist/hooks/useWorkspaceSyncController.test.js +106 -199
- package/dist/hooks/workspace/useTaskforceApiRouting.d.ts +8 -0
- package/dist/hooks/workspace/useTaskforceApiRouting.js +91 -0
- package/dist/hooks/workspace/useTaskforceApiRouting.test.d.ts +1 -0
- package/dist/hooks/workspace/useTaskforceApiRouting.test.js +60 -0
- package/dist/hooks/workspace/useWorkspaceSyncController.d.ts +1 -0
- package/dist/hooks/workspace/useWorkspaceSyncController.js +1 -0
- package/dist/hooks/workspace/workspaceLocalState.d.ts +30 -0
- package/dist/hooks/workspace/workspaceLocalState.js +101 -0
- package/dist/localization/locales/en-US.d.ts +1 -8
- package/dist/localization/locales/en-US.js +4 -11
- package/dist/localization/locales/es-419.js +2 -9
- package/dist/localization/locales/pt-BR.js +2 -9
- package/dist/localization/localizationCatalogs.test.d.ts +1 -0
- package/dist/localization/localizationCatalogs.test.js +37 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +9 -15
- package/dist/mcp/clientIntegrations.d.ts +33 -0
- package/dist/mcp/clientIntegrations.js +199 -0
- package/dist/mcp/clientIntegrations.test.d.ts +1 -0
- package/dist/mcp/clientIntegrations.test.js +110 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/optionResolution.test.js +6 -2
- package/dist/mcp/runtime.d.ts +120 -0
- package/dist/mcp/runtime.js +5668 -0
- package/dist/mcp/runtime.test.d.ts +1 -0
- package/dist/mcp/runtime.test.js +3299 -0
- package/dist/mcp/server.js +2 -1793
- package/dist/mcp/structuredCommentValidation.test.d.ts +1 -0
- package/dist/{__tests__ → mcp}/structuredCommentValidation.test.js +1 -1
- package/dist/mcp/structuredDocValidation.js +1 -2
- package/dist/mcp/structuredDocValidation.test.d.ts +1 -0
- package/dist/{__tests__ → mcp}/structuredDocValidation.test.js +9 -4
- package/dist/mcp/toolRegistry.d.ts +570 -0
- package/dist/mcp/toolRegistry.js +90 -0
- package/dist/mcp/toolRegistry.test.d.ts +1 -0
- package/dist/mcp/toolRegistry.test.js +30 -0
- package/dist/migrations/billingSchemaParity.test.js +111 -0
- package/dist/migrations/taskSchemaMigrations.d.ts +5 -0
- package/dist/migrations/taskSchemaMigrations.js +681 -39
- package/dist/migrations/taskSchemaMigrations.test.d.ts +1 -0
- package/dist/migrations/taskSchemaMigrations.test.js +210 -0
- package/dist/plugins/vite.js +13 -7
- package/dist/public/apple-touch-icon.png +0 -0
- package/dist/public/archive/phoenix/apple-touch-icon.png +0 -0
- package/dist/public/archive/phoenix/favicon.ico +0 -0
- package/dist/public/archive/phoenix/site.webmanifest +1 -0
- package/dist/public/favicon-96x96.png +0 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/favicon.svg +17 -0
- package/dist/public/site.webmanifest +21 -1
- package/dist/public/web-app-manifest-192x192.png +0 -0
- package/dist/public/web-app-manifest-512x512.png +0 -0
- package/dist/releaseVersion.test.d.ts +1 -0
- package/dist/{__tests__/releaseVersion.test.js → releaseVersion.test.js} +1 -1
- package/dist/resources/templates/WORKFLOW_V2_POLICY.md +1 -1
- package/dist/resources/templates/workflow-sources/workflowDocs.mjs +62 -52
- package/dist/resources/templates/workflows/collaborate.yaml +11 -5
- package/dist/resources/templates/workflows/do.yaml +8 -2
- package/dist/resources/templates/workflows/evaluate.yaml +13 -7
- package/dist/resources/templates/workflows/execute.yaml +40 -23
- package/dist/resources/templates/workflows/plan.yaml +15 -8
- package/dist/resources/templates/workflows/review.yaml +14 -8
- package/dist/runtime/appGateDefinitions.d.ts +32 -0
- package/dist/runtime/appGateDefinitions.js +32 -0
- package/dist/runtime/appGates.d.ts +29 -0
- package/dist/runtime/appGates.js +53 -0
- package/dist/runtime/appGates.test.d.ts +1 -0
- package/dist/runtime/appGates.test.js +42 -0
- package/dist/runtime/migrationFlags.d.ts +1 -0
- package/dist/runtime/migrationFlags.js +1 -0
- package/dist/server/annotatedAttachmentsRoutes.test.d.ts +1 -0
- package/dist/server/annotatedAttachmentsRoutes.test.js +473 -0
- package/dist/server/auth.js +14 -2
- package/dist/server/auth.test.js +21 -1
- package/dist/server/cors.js +11 -5
- package/dist/server/cors.test.js +6 -0
- package/dist/server/documentReviewRoutes.test.d.ts +1 -0
- package/dist/server/documentReviewRoutes.test.js +157 -0
- package/dist/server/index.cookieProxy.test.js +46 -1
- package/dist/server/index.d.ts +20 -0
- package/dist/server/index.js +168 -41
- package/dist/server/index.rateLimit.test.js +6 -0
- package/dist/server/index.test.js +133 -2
- package/dist/server/mockStripe.d.ts +72 -0
- package/dist/server/mockStripe.js +357 -0
- package/dist/server/realtimeSyncWs.js +4 -0
- package/dist/server/routes/admin.d.ts +114 -0
- package/dist/server/routes/admin.js +2226 -0
- package/dist/server/routes/annotatedAttachments.d.ts +24 -0
- package/dist/server/routes/annotatedAttachments.js +235 -0
- package/dist/server/routes/auth.d.ts +61 -0
- package/dist/server/routes/auth.js +1296 -0
- package/dist/server/{routes.billing.d.ts → routes/billing.d.ts} +3 -2
- package/dist/server/routes/billing.js +2001 -0
- package/dist/server/routes/billing.test.d.ts +1 -0
- package/dist/server/routes/billing.test.js +1631 -0
- package/dist/server/routes/documentReviews.d.ts +11 -0
- package/dist/server/routes/documentReviews.js +191 -0
- package/dist/server/routes/documents.d.ts +118 -0
- package/dist/server/routes/documents.js +1113 -0
- package/dist/server/routes/resources.d.ts +25 -0
- package/dist/server/routes/resources.js +225 -0
- package/dist/server/routes/shared.d.ts +35 -0
- package/dist/server/routes/shared.js +305 -0
- package/dist/server/routes/shared.test.d.ts +1 -0
- package/dist/server/routes/shared.test.js +32 -0
- package/dist/server/{routes.sync.d.ts → routes/sync.d.ts} +5 -5
- package/dist/server/routes/sync.integration.test.d.ts +1 -0
- package/dist/server/routes/sync.integration.test.js +2003 -0
- package/dist/server/routes/sync.js +3143 -0
- package/dist/server/routes/tasks.d.ts +72 -0
- package/dist/server/routes/tasks.js +1252 -0
- package/dist/server/routes/workspaces.d.ts +32 -0
- package/dist/server/routes/workspaces.js +307 -0
- package/dist/server/routes.d.ts +8 -9
- package/dist/server/routes.js +968 -4092
- package/dist/server/routes.test.js +9043 -2415
- package/dist/server/runtimeMode.d.ts +1 -1
- package/dist/server/runtimeMode.js +3 -18
- package/dist/server/runtimeMode.test.js +3 -3
- package/dist/server/securityHeaders.d.ts +1 -1
- package/dist/server/securityHeaders.js +65 -6
- package/dist/server/securityHeaders.test.js +40 -2
- package/dist/services/templateEngine.test.d.ts +1 -0
- package/dist/{__tests__ → services}/templateEngine.test.js +1 -1
- package/dist/services/templates.test.d.ts +1 -0
- package/dist/{__tests__ → services}/templates.test.js +1 -1
- package/dist/services/workflowDocumentFixtures.test.d.ts +1 -0
- package/dist/{__tests__ → services}/workflowDocumentFixtures.test.js +4 -4
- package/dist/services/workflowExportMatrix.test.d.ts +1 -0
- package/dist/{__tests__ → services}/workflowExportMatrix.test.js +1 -1
- package/dist/services/workflowExportSnapshots.test.d.ts +1 -0
- package/dist/services/workflowGeneration.test.d.ts +1 -0
- package/dist/services/workflowSimulation.test.d.ts +1 -0
- package/dist/services/workflowSimulation.test.js +113 -0
- package/dist/services/workflowV2Policy.test.d.ts +1 -0
- package/dist/{__tests__ → services}/workflowV2Policy.test.js +2 -2
- package/dist/shared/aiProfileSurfaceType.d.ts +9 -0
- package/dist/shared/aiProfileSurfaceType.js +49 -0
- package/dist/shared/customTaxonomyLibrary.d.ts +11 -0
- package/dist/shared/customTaxonomyLibrary.js +276 -0
- package/dist/shared/customTaxonomyLibrary.test.d.ts +1 -0
- package/dist/shared/customTaxonomyLibrary.test.js +20 -0
- package/dist/shared/taxonomyCatalog.d.ts +19 -0
- package/dist/shared/taxonomyCatalog.js +36 -0
- package/dist/shared/taxonomyDefaults.d.ts +29 -0
- package/dist/shared/taxonomyDefaults.js +26 -0
- package/dist/shared/taxonomyLibrary.d.ts +15 -0
- package/dist/shared/taxonomyLibrary.js +98 -0
- package/dist/shared/taxonomyLibrary.test.d.ts +1 -0
- package/dist/shared/taxonomyLibrary.test.js +26 -0
- package/dist/shared/taxonomyState.d.ts +36 -0
- package/dist/shared/taxonomyState.js +73 -0
- package/dist/shared/taxonomyState.test.d.ts +1 -0
- package/dist/shared/taxonomyState.test.js +71 -0
- package/dist/shared/workflowDefaults.d.ts +9 -0
- package/dist/shared/workflowDefaults.js +11 -0
- package/dist/storage/documentIntegrity.d.ts +2 -0
- package/dist/storage/documentIntegrity.js +34 -17
- package/dist/storage/documentPurge.d.ts +2 -1
- package/dist/storage/documentPurge.js +35 -8
- package/dist/storage/index.d.ts +4 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/objectStorage.d.ts +1 -1
- package/dist/storage/objectStorageClient.d.ts +6 -4
- package/dist/storage/objectStorageClient.js +77 -29
- package/dist/storage/objectStorageClient.test.d.ts +1 -0
- package/dist/storage/objectStorageClient.test.js +57 -0
- package/dist/storage/objectStorageConfig.js +3 -1
- package/dist/storage/objectStorageConfig.test.d.ts +1 -0
- package/dist/storage/objectStorageConfig.test.js +38 -0
- package/dist/storage/postgresAdapter.d.ts +5 -0
- package/dist/storage/postgresAdapter.js +2 -2
- package/dist/storage/postgresAdapter.test.d.ts +1 -0
- package/dist/storage/postgresAdapter.test.js +29 -0
- package/dist/storage/taskAssetStore.d.ts +7 -4
- package/dist/storage/taskAssetStore.js +65 -60
- package/dist/storage/workspaceAssetStore.d.ts +122 -0
- package/dist/storage/workspaceAssetStore.js +496 -0
- package/dist/storage/workspaceAssetStore.test.d.ts +1 -0
- package/dist/storage/workspaceAssetStore.test.js +501 -0
- package/dist/sync/cloudSyncApi.d.ts +33 -2
- package/dist/sync/cloudSyncApi.js +37 -15
- package/dist/sync/cloudSyncApi.test.js +60 -3
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +3 -0
- package/dist/sync/syncService.d.ts +25 -0
- package/dist/sync/syncService.js +184 -16
- package/dist/sync/syncService.test.js +289 -25
- package/dist/sync/workspaceRepair.d.ts +114 -0
- package/dist/sync/workspaceRepair.js +566 -0
- package/dist/sync/workspaceSyncModel.d.ts +230 -2
- package/dist/sync/workspaceSyncModel.js +456 -17
- package/dist/sync/workspaceSyncModel.test.js +642 -0
- package/dist/sync/workspaceSyncState.d.ts +12 -0
- package/dist/sync/workspaceSyncState.js +12 -0
- package/dist/sync/workspaceSyncSurface.d.ts +33 -0
- package/dist/sync/workspaceSyncSurface.js +74 -0
- package/dist/types.d.ts +143 -18
- package/dist/types.js +9 -24
- package/dist/ui/assets/AgentsModule-Bdq3T1Ts.js +1 -0
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-BaS2VwIr.css +1 -0
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-jKUVo-PJ.js +3 -0
- package/dist/ui/assets/DocumentWorkspace-C_8T8oz-.css +1 -0
- package/dist/ui/assets/DocumentWorkspace-DuQa-uIC.js +250 -0
- package/dist/ui/assets/InitiativesModule-C8Pi2VTk.js +1 -0
- package/dist/ui/assets/PlansPage-B6BDECSi.js +1 -0
- package/dist/ui/assets/PlansPage-BlVC_lRq.css +1 -0
- package/dist/ui/assets/TaskSettings-BwB9NtmJ.css +1 -0
- package/dist/ui/assets/TaskSettings-DUJgRTPU.js +8 -0
- package/dist/ui/assets/WorkflowsModule-b6TLuHwJ.js +5 -0
- package/dist/ui/assets/index-BiiF1cLQ.css +1 -0
- package/dist/ui/assets/index-xBWLPOEb.js +6 -0
- package/dist/ui/assets/vendor-dnd-DRzYolkg.js +5 -0
- package/dist/ui/assets/{vendor-icons-ZFG3SGwo.js → vendor-icons-QZyhEwgT.js} +1 -1
- package/dist/ui/assets/{vendor-markdown-CKYkQHfj.js → vendor-markdown-BUxTU7dS.js} +1 -1
- package/dist/ui/assets/vendor-react-CKJs5o3c.js +61 -0
- package/dist/ui/assets/vendor-router-BbWMxlnO.js +3 -0
- package/dist/ui/branding/logos/logo.png +0 -0
- package/dist/ui/branding/logos/logo_dark.svg +27 -0
- package/dist/ui/branding/logos/logo_favicon.svg +35 -0
- package/dist/ui/branding/logos/logo_light.svg +27 -0
- package/dist/ui/favicon/apple-touch-icon.png +0 -0
- package/dist/ui/favicon/archive/phoenix/apple-touch-icon.png +0 -0
- package/dist/ui/favicon/archive/phoenix/favicon.ico +0 -0
- package/dist/ui/favicon/archive/phoenix/site.webmanifest +1 -0
- package/dist/ui/favicon/favicon-96x96.png +0 -0
- package/dist/ui/favicon/favicon.ico +0 -0
- package/dist/ui/favicon/favicon.svg +17 -0
- package/dist/ui/favicon/site.webmanifest +21 -1
- package/dist/ui/favicon/web-app-manifest-192x192.png +0 -0
- package/dist/ui/favicon/web-app-manifest-512x512.png +0 -0
- package/dist/ui/index.html +10 -7
- package/dist/ui/product/screen_01.png +0 -0
- package/dist/ui/product/screen_02.png +0 -0
- package/dist/ui/product/screen_03.png +0 -0
- package/dist/utils/annotatedAttachments.d.ts +20 -0
- package/dist/utils/annotatedAttachments.js +74 -0
- package/dist/utils/annotatedAttachments.test.d.ts +1 -0
- package/dist/utils/annotatedAttachments.test.js +108 -0
- package/dist/utils/assignees.d.ts +26 -0
- package/dist/utils/assignees.js +132 -0
- package/dist/utils/canonicalAssetKind.d.ts +16 -0
- package/dist/utils/canonicalAssetKind.js +39 -0
- package/dist/utils/canonicalAssetKind.test.d.ts +1 -0
- package/dist/utils/canonicalAssetKind.test.js +24 -0
- package/dist/utils/coalescedRefresh.d.ts +5 -0
- package/dist/utils/coalescedRefresh.js +16 -0
- package/dist/utils/coalescedRefresh.test.d.ts +1 -0
- package/dist/utils/coalescedRefresh.test.js +30 -0
- package/dist/utils/constants.d.ts +16 -3
- package/dist/utils/constants.icons.test.js +2 -1
- package/dist/utils/constants.js +70 -13
- package/dist/utils/contextAssetEvents.d.ts +7 -0
- package/dist/utils/contextAssetEvents.js +6 -0
- package/dist/utils/contextFiles.d.ts +14 -3
- package/dist/utils/contextFiles.js +40 -8
- package/dist/utils/documentManagerApi.d.ts +6 -0
- package/dist/utils/documentManagerApi.js +19 -0
- package/dist/utils/documentNames.d.ts +24 -0
- package/dist/utils/documentNames.js +91 -0
- package/dist/utils/documentReferences.d.ts +9 -0
- package/dist/utils/documentReferences.js +11 -0
- package/dist/utils/entityReferences.d.ts +9 -0
- package/dist/utils/entityReferences.js +32 -0
- package/dist/utils/imageReferences.d.ts +9 -0
- package/dist/utils/imageReferences.js +11 -0
- package/dist/utils/planParser.d.ts +2 -2
- package/dist/utils/planParser.js +11 -11
- package/dist/utils/planParser.test.d.ts +1 -0
- package/dist/{__tests__ → utils}/planParser.test.js +22 -22
- package/dist/utils/planningReferences.d.ts +17 -0
- package/dist/utils/planningReferences.js +30 -0
- package/dist/utils/planningReferences.test.d.ts +1 -0
- package/dist/utils/planningReferences.test.js +17 -0
- package/dist/utils/taskActivity.d.ts +9 -0
- package/dist/utils/taskActivity.js +147 -0
- package/dist/utils/taskActivity.test.d.ts +1 -0
- package/dist/utils/taskActivity.test.js +34 -0
- package/dist/utils/taskDraftDefaults.d.ts +21 -0
- package/dist/utils/taskDraftDefaults.js +40 -0
- package/dist/utils/taskDraftDefaults.test.d.ts +1 -0
- package/dist/utils/taskDraftDefaults.test.js +34 -0
- package/dist/utils/taskNormalization.d.ts +25 -0
- package/dist/utils/taskNormalization.js +161 -0
- package/dist/utils/taskNormalization.test.d.ts +1 -0
- package/dist/utils/taskNormalization.test.js +158 -0
- package/dist/utils/taskReferences.d.ts +5 -0
- package/dist/utils/taskReferences.js +11 -0
- package/dist/utils/taskforceApiClient.d.ts +2 -0
- package/dist/utils/taskforceApiClient.js +101 -3
- package/dist/utils/taskforceApiClient.test.d.ts +1 -0
- package/dist/utils/taskforceApiClient.test.js +44 -0
- package/dist/utils/taxonomyFilterOptions.d.ts +2 -0
- package/dist/utils/taxonomyFilterOptions.js +17 -0
- package/dist/utils/taxonomyFormDefaults.d.ts +3 -0
- package/dist/utils/taxonomyFormDefaults.js +28 -0
- package/dist/utils/taxonomyFormDefaults.test.d.ts +1 -0
- package/dist/utils/taxonomyFormDefaults.test.js +63 -0
- package/dist/utils/taxonomyLifecycle.d.ts +3 -0
- package/dist/utils/taxonomyLifecycle.js +17 -0
- package/dist/utils/taxonomySorting.d.ts +7 -0
- package/dist/utils/taxonomySorting.js +74 -0
- package/dist/utils/theme.d.ts +15 -0
- package/dist/utils/theme.js +23 -0
- package/dist/utils/uiNotice.d.ts +7 -0
- package/dist/utils/uiNotice.js +6 -0
- package/dist/utils/uiNotice.test.d.ts +1 -0
- package/dist/utils/uiNotice.test.js +18 -0
- package/dist/utils/workspaceIdentity.d.ts +14 -0
- package/dist/utils/workspaceIdentity.js +21 -0
- package/dist/utils/workspaceIdentity.test.js +30 -1
- package/dist/utils/workspaceSyncPresentation.d.ts +20 -0
- package/dist/utils/workspaceSyncPresentation.js +21 -0
- package/dist/utils/workspaceSyncPresentation.test.d.ts +1 -0
- package/dist/utils/workspaceSyncPresentation.test.js +36 -0
- package/package.json +30 -23
- package/scripts/bootstrap-playwright-auth.mjs +155 -0
- package/scripts/check-compat-boundaries.mjs +41 -0
- package/scripts/check-env.ts +9 -2
- package/scripts/debug-login.mjs +32 -0
- package/scripts/deploy-prod.sh +41 -0
- package/scripts/deploy-staging.sh +23 -0
- package/scripts/migrate-planning-model.ts +233 -0
- package/scripts/migrate-task-data-assets.mjs +408 -0
- package/scripts/playwright-auth.sh +11 -0
- package/scripts/run-dev-proxy.sh +2 -0
- package/scripts/update-homebrew-formula.sh +2 -2
- package/scripts/with-esbuild.sh +11 -0
- package/src/resources/templates/WORKFLOW_V2_POLICY.md +1 -1
- package/src/resources/templates/workflow-sources/workflowDocs.mjs +62 -52
- package/src/resources/templates/workflows/collaborate.yaml +11 -5
- package/src/resources/templates/workflows/do.yaml +8 -2
- package/src/resources/templates/workflows/evaluate.yaml +13 -7
- package/src/resources/templates/workflows/execute.yaml +40 -23
- package/src/resources/templates/workflows/plan.yaml +15 -8
- package/src/resources/templates/workflows/review.yaml +14 -8
- package/dist/TaskforceScreenshot.d.ts +0 -11
- package/dist/TaskforceScreenshot.js +0 -113
- package/dist/compat/priorityCompat.d.ts +0 -2
- package/dist/compat/priorityCompat.js +0 -24
- package/dist/components/features/settings/TaxonomyManager 2.d.ts +0 -52
- package/dist/components/features/settings/TaxonomyManager 2.js +0 -75
- package/dist/components/task/TaskKanban 2.d.ts +0 -76
- package/dist/components/task/TaskKanban 2.js +0 -1004
- package/dist/components/task/TaskScreenshotSection.d.ts +0 -15
- package/dist/components/task/TaskScreenshotSection.js +0 -22
- package/dist/components/views/StandaloneLayout 2.d.ts +0 -8
- package/dist/components/views/StandaloneLayout 2.js +0 -1660
- package/dist/core/InitiativeTemplates.test.js +0 -50
- package/dist/core/ParentLifecycle.test.js +0 -98
- package/dist/migrations/clientMigrations.d.ts +0 -9
- package/dist/migrations/clientMigrations.js +0 -74
- package/dist/migrations/flags.d.ts +0 -6
- package/dist/migrations/flags.js +0 -8
- package/dist/migrations/taskMigrations.d.ts +0 -71
- package/dist/migrations/taskMigrations.js +0 -236
- package/dist/migrations/taskMigrations.test.js +0 -34
- package/dist/server/routes.billing.js +0 -991
- package/dist/server/routes.billing.test.js +0 -387
- package/dist/server/routes.sync.integration.test.js +0 -470
- package/dist/server/routes.sync.js +0 -1141
- package/dist/soak/syncSoakHarness.d.ts +0 -6
- package/dist/soak/syncSoakHarness.js +0 -10
- package/dist/ui/assets/index-0W5vyCpn.css +0 -1
- package/dist/ui/assets/index-MCZuNNfn.js +0 -23
- package/dist/ui/assets/logo_white_01-0Vx-iIIv.png +0 -0
- package/dist/ui/assets/vendor-dnd-BI1K77C1.js +0 -5
- package/dist/ui/assets/vendor-react-DdIDsh7f.js +0 -9
- package/dist/ui/assets/vendor-router-BtiNU7Dl.js +0 -3
- package/dist/utils/taskHierarchy.d.ts +0 -4
- package/dist/utils/taskHierarchy.js +0 -69
- package/dist/utils/taskHierarchy.test.js +0 -38
- package/dist/utils/taskParenting.d.ts +0 -3
- package/dist/utils/taskParenting.js +0 -24
- package/dist/utils/taskParenting.test.js +0 -21
- package/dist/utils/taskRelations.d.ts +0 -6
- package/dist/utils/taskRelations.js +0 -24
- package/dist/utils/taskRelations.test.js +0 -34
- package/scripts/check-compat-boundaries.js +0 -48
- /package/dist/{__tests__/planParser.test.d.ts → TaskforceCore.filter-persistence.test.d.ts} +0 -0
- /package/dist/{__tests__/releaseVersion.test.d.ts → TaskforceCore.routing.test.d.ts} +0 -0
- /package/dist/{__tests__/structuredCommentValidation.test.d.ts → annotatedAttachments/AnnotatedAttachmentSessionStore.test.d.ts} +0 -0
- /package/dist/{__tests__/structuredDocValidation.test.d.ts → annotatedAttachments/payload.test.d.ts} +0 -0
- /package/dist/{__tests__/templateEngine.test.d.ts → annotatedAttachments/types.js} +0 -0
- /package/dist/{__tests__/templates.test.d.ts → compat/workspaceSyncCompat.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowDocumentFixtures.test.d.ts → components/features/AgentsModule.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowExportMatrix.test.d.ts → components/features/AnnotatedAttachmentWorkspace.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowExportSnapshots.test.d.ts → components/features/DocumentWorkspace.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowGeneration.test.d.ts → components/features/settings/TaxonomyLibraryManager.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowV2Policy.test.d.ts → components/task/TaskActionHeader.test.d.ts} +0 -0
- /package/dist/{core/InitiativeTemplates.test.d.ts → components/task/TaskKanban.planning-drop.test.d.ts} +0 -0
- /package/dist/{core/ParentLifecycle.test.d.ts → components/task/TaskStatusActions.test.d.ts} +0 -0
- /package/dist/{migrations/taskMigrations.test.d.ts → components/ui/TopNoticeLayer.test.d.ts} +0 -0
- /package/dist/{server/routes.billing.test.d.ts → components/views/AppShellHeader.test.d.ts} +0 -0
- /package/dist/{server/routes.sync.integration.test.d.ts → components/views/PlanComparisonPage.test.d.ts} +0 -0
- /package/dist/{utils/taskHierarchy.test.d.ts → components/views/chrome/WorkspaceChromeSections.test.d.ts} +0 -0
- /package/dist/{utils/taskParenting.test.d.ts → components/views/chrome/workspaceChrome.test.d.ts} +0 -0
- /package/dist/{utils/taskRelations.test.d.ts → components/views/panels/DocumentFilterToolbar.test.d.ts} +0 -0
- /package/dist/public/{android-chrome-192x192.png → archive/phoenix/android-chrome-192x192.png} +0 -0
- /package/dist/public/{android-chrome-512x512.png → archive/phoenix/android-chrome-512x512.png} +0 -0
- /package/dist/public/{favicon-16x16.png → archive/phoenix/favicon-16x16.png} +0 -0
- /package/dist/public/{favicon-32x32.png → archive/phoenix/favicon-32x32.png} +0 -0
- /package/dist/public/{favicon.png → archive/phoenix/favicon.png} +0 -0
- /package/dist/{__tests__ → services}/workflowExportSnapshots.test.js +0 -0
- /package/dist/{__tests__ → services}/workflowGeneration.test.js +0 -0
- /package/dist/ui/favicon/{android-chrome-192x192.png → archive/phoenix/android-chrome-192x192.png} +0 -0
- /package/dist/ui/favicon/{android-chrome-512x512.png → archive/phoenix/android-chrome-512x512.png} +0 -0
- /package/dist/ui/favicon/{favicon-16x16.png → archive/phoenix/favicon-16x16.png} +0 -0
- /package/dist/ui/favicon/{favicon-32x32.png → archive/phoenix/favicon-32x32.png} +0 -0
- /package/dist/ui/favicon/{favicon.png → archive/phoenix/favicon.png} +0 -0
|
@@ -18,7 +18,7 @@ describe('cloudSyncApi.applyLocalWorkspaceChanges', () => {
|
|
|
18
18
|
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
19
19
|
expect(fetchMock).toHaveBeenCalledWith('/api/taskforce/sync/workspace/apply-local', expect.any(Object));
|
|
20
20
|
});
|
|
21
|
-
it('
|
|
21
|
+
it('keeps the canonical local apply endpoint when running under /taskforce path', async () => {
|
|
22
22
|
window.history.replaceState({}, '', '/taskforce');
|
|
23
23
|
const fetchMock = vi.fn().mockResolvedValue({
|
|
24
24
|
ok: true,
|
|
@@ -29,13 +29,70 @@ describe('cloudSyncApi.applyLocalWorkspaceChanges', () => {
|
|
|
29
29
|
const result = await applyLocalWorkspaceChanges('ws-2', [{ op: 'delete', taskId: 't-2' }]);
|
|
30
30
|
expect(result.ok).toBe(true);
|
|
31
31
|
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
32
|
-
expect(fetchMock).toHaveBeenCalledWith('/
|
|
32
|
+
expect(fetchMock).toHaveBeenCalledWith('/api/taskforce/sync/workspace/apply-local', expect.any(Object));
|
|
33
|
+
});
|
|
34
|
+
it('includes bootstrap snapshot reconciliation metadata when provided', async () => {
|
|
35
|
+
const fetchMock = vi.fn().mockResolvedValue({
|
|
36
|
+
ok: true,
|
|
37
|
+
status: 200,
|
|
38
|
+
json: () => Promise.resolve({ success: true })
|
|
39
|
+
});
|
|
40
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
41
|
+
const result = await applyLocalWorkspaceChanges('ws-bootstrap', [], {
|
|
42
|
+
bootstrapSnapshot: {
|
|
43
|
+
currentAnnotatedAttachmentSessionIds: ['session-1', 'session-2']
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
expect(result.ok).toBe(true);
|
|
47
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
48
|
+
const [, requestInit] = fetchMock.mock.calls[0] || [];
|
|
49
|
+
expect(typeof requestInit?.body).toBe('string');
|
|
50
|
+
expect(JSON.parse(String(requestInit?.body))).toMatchObject({
|
|
51
|
+
workspaceId: 'ws-bootstrap',
|
|
52
|
+
bootstrapSnapshot: {
|
|
53
|
+
currentAnnotatedAttachmentSessionIds: ['session-1', 'session-2']
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
it('includes workspace members when provided', async () => {
|
|
58
|
+
const fetchMock = vi.fn().mockResolvedValue({
|
|
59
|
+
ok: true,
|
|
60
|
+
status: 200,
|
|
61
|
+
json: () => Promise.resolve({ success: true })
|
|
62
|
+
});
|
|
63
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
64
|
+
const result = await applyLocalWorkspaceChanges('ws-members', [], {
|
|
65
|
+
workspaceMembers: [
|
|
66
|
+
{
|
|
67
|
+
userId: 'user-1',
|
|
68
|
+
workspaceId: 'ws-members',
|
|
69
|
+
email: 'member@example.com',
|
|
70
|
+
displayName: 'Member One',
|
|
71
|
+
role: 'member',
|
|
72
|
+
permissionMode: 'read-write',
|
|
73
|
+
betaAccess: true,
|
|
74
|
+
status: 'active',
|
|
75
|
+
disabled: false
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
expect(result.ok).toBe(true);
|
|
80
|
+
const [, requestInit] = fetchMock.mock.calls[0] || [];
|
|
81
|
+
expect(JSON.parse(String(requestInit?.body))).toMatchObject({
|
|
82
|
+
workspaceId: 'ws-members',
|
|
83
|
+
workspaceMembers: [
|
|
84
|
+
expect.objectContaining({
|
|
85
|
+
userId: 'user-1',
|
|
86
|
+
email: 'member@example.com'
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
});
|
|
33
90
|
});
|
|
34
91
|
it('returns single-endpoint status diagnostics on non-ok response', async () => {
|
|
35
92
|
const fetchMock = vi.fn().mockResolvedValue({
|
|
36
93
|
ok: false,
|
|
37
94
|
status: 503,
|
|
38
|
-
|
|
95
|
+
text: () => Promise.resolve(JSON.stringify({ error: 'unavailable' }))
|
|
39
96
|
});
|
|
40
97
|
vi.stubGlobal('fetch', fetchMock);
|
|
41
98
|
const result = await applyLocalWorkspaceChanges('ws-3', [{ op: 'upsert', archived: false, task: { id: 't-3' } }]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WorkspaceSyncPayload } from './workspaceSyncModel';
|
|
2
|
+
export declare function isTransientWorkspaceSyncStatus(status: number | null | undefined): boolean;
|
|
2
3
|
export interface EnsureWorkspaceReadyInput {
|
|
3
4
|
cloudAuthConfigured: boolean;
|
|
4
5
|
runtimeMode: 'local' | 'cloud';
|
|
@@ -15,6 +16,7 @@ export interface EnsureWorkspaceReadyResult {
|
|
|
15
16
|
statusCode?: number;
|
|
16
17
|
/** Milliseconds to wait before retrying, forwarded from a 429 Retry-After header. */
|
|
17
18
|
retryAfterMs?: number;
|
|
19
|
+
transient?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export declare function ensureCloudWorkspaceReadyForSyncService(input: EnsureWorkspaceReadyInput): Promise<EnsureWorkspaceReadyResult>;
|
|
20
22
|
export interface UserSettingsSyncInput {
|
|
@@ -39,6 +41,7 @@ export interface WorkspacePushSyncInput {
|
|
|
39
41
|
workspaceId: string;
|
|
40
42
|
payload: WorkspaceSyncPayload;
|
|
41
43
|
ensureCloudWorkspaceReadyForSync: () => Promise<EnsureWorkspaceReadyResult>;
|
|
44
|
+
repairMode?: boolean;
|
|
42
45
|
}
|
|
43
46
|
export interface WorkspacePushSyncResult {
|
|
44
47
|
success: boolean;
|
|
@@ -46,15 +49,34 @@ export interface WorkspacePushSyncResult {
|
|
|
46
49
|
error?: string;
|
|
47
50
|
code?: string;
|
|
48
51
|
retryAfterMs?: number;
|
|
52
|
+
transient?: boolean;
|
|
49
53
|
syncedAt?: string;
|
|
50
54
|
requestMs: number;
|
|
51
55
|
changeCount: number;
|
|
52
56
|
deleteCount: number;
|
|
53
57
|
currentTaskIds: Set<string>;
|
|
54
58
|
deleteTaskIds: Set<string>;
|
|
59
|
+
currentInitiativeIds: Set<string>;
|
|
60
|
+
currentInitiativeWatermarks: Map<string, string>;
|
|
61
|
+
currentWorkstreamIds: Set<string>;
|
|
62
|
+
currentWorkstreamWatermarks: Map<string, string>;
|
|
63
|
+
currentAiProfileIds: Set<string>;
|
|
64
|
+
currentAiProfileWatermarks: Map<string, string>;
|
|
55
65
|
currentDocumentPaths: Set<string>;
|
|
56
66
|
deleteDocumentPaths: Set<string>;
|
|
57
67
|
currentDocumentWatermarks: Map<string, string>;
|
|
68
|
+
currentAssetPaths: Set<string>;
|
|
69
|
+
deleteAssetPaths: Set<string>;
|
|
70
|
+
currentAssetWatermarks: Map<string, string>;
|
|
71
|
+
currentDocumentReviewSessionIds: Set<string>;
|
|
72
|
+
deleteDocumentReviewSessionIds: Set<string>;
|
|
73
|
+
currentDocumentReviewSessionWatermarks: Map<string, string>;
|
|
74
|
+
currentDocumentReviewCommentIds: Set<string>;
|
|
75
|
+
deleteDocumentReviewCommentIds: Set<string>;
|
|
76
|
+
currentDocumentReviewCommentWatermarks: Map<string, string>;
|
|
77
|
+
currentAnnotatedAttachmentSessionIds: Set<string>;
|
|
78
|
+
deleteAnnotatedAttachmentSessionIds: Set<string>;
|
|
79
|
+
currentAnnotatedAttachmentSessionWatermarks: Map<string, string>;
|
|
58
80
|
/** Watermarks for every task upsert that was successfully pushed. */
|
|
59
81
|
pushedWatermarks: Map<string, string>;
|
|
60
82
|
/** Server-emitted realtime mutation event ids for this push apply. */
|
|
@@ -71,12 +93,14 @@ export interface WorkspacePullSyncInput {
|
|
|
71
93
|
maxPages?: number;
|
|
72
94
|
onPagePulled?: () => void;
|
|
73
95
|
onChangesApplied?: (count: number) => void;
|
|
96
|
+
repairMode?: boolean;
|
|
74
97
|
}
|
|
75
98
|
export interface WorkspacePullSyncResult {
|
|
76
99
|
success: boolean;
|
|
77
100
|
kind?: WorkspacePullFailureKind;
|
|
78
101
|
status?: number;
|
|
79
102
|
retryAfterMs?: number;
|
|
103
|
+
transient?: boolean;
|
|
80
104
|
failures?: string[];
|
|
81
105
|
hasTransientApplyFailure?: boolean;
|
|
82
106
|
error?: string;
|
|
@@ -90,6 +114,7 @@ export interface WorkspacePullSyncResult {
|
|
|
90
114
|
pulledActiveUpserts: boolean;
|
|
91
115
|
pulledArchivedUpserts: boolean;
|
|
92
116
|
documentDecryptFailures?: string[];
|
|
117
|
+
emittedEventIds?: string[];
|
|
93
118
|
}
|
|
94
119
|
export declare function runWorkspacePullSyncService(input: WorkspacePullSyncInput): Promise<WorkspacePullSyncResult>;
|
|
95
120
|
export declare function syncUserGlobalSettingsService(input: UserSettingsSyncInput): Promise<UserSettingsSyncResult>;
|
package/dist/sync/syncService.js
CHANGED
|
@@ -3,6 +3,18 @@ import { encryptDocument, decryptDocument } from './encryptionService';
|
|
|
3
3
|
function asObjectRecord(value) {
|
|
4
4
|
return value && typeof value === 'object' ? value : {};
|
|
5
5
|
}
|
|
6
|
+
export function isTransientWorkspaceSyncStatus(status) {
|
|
7
|
+
const normalized = Number(status || 0);
|
|
8
|
+
return normalized === 0 || normalized === 429 || normalized >= 500;
|
|
9
|
+
}
|
|
10
|
+
function resolveWorkspaceAccessConflictMessage(data, fallbackStatus) {
|
|
11
|
+
const code = String(data.code || '').trim().toUpperCase();
|
|
12
|
+
const rawError = String(data.error || '').trim();
|
|
13
|
+
if (code === 'WORKSPACE_ID_ALREADY_EXISTS' || rawError.toLowerCase() === 'workspace id already exists') {
|
|
14
|
+
return 'This workspace is already linked to another cloud account. Sign in with the original account, ask the workspace owner to grant you access, or keep this workspace local-only.';
|
|
15
|
+
}
|
|
16
|
+
return rawError || `Workspace provisioning failed (${fallbackStatus})`;
|
|
17
|
+
}
|
|
6
18
|
export async function ensureCloudWorkspaceReadyForSyncService(input) {
|
|
7
19
|
if (!input.cloudAuthConfigured)
|
|
8
20
|
return { success: false, error: 'Cloud auth endpoint is not configured.' };
|
|
@@ -19,6 +31,7 @@ export async function ensureCloudWorkspaceReadyForSyncService(input) {
|
|
|
19
31
|
return {
|
|
20
32
|
success: false,
|
|
21
33
|
statusCode: 401,
|
|
34
|
+
transient: false,
|
|
22
35
|
error: String(data.error || 'Authentication required for workspace sync.')
|
|
23
36
|
};
|
|
24
37
|
}
|
|
@@ -27,6 +40,7 @@ export async function ensureCloudWorkspaceReadyForSyncService(input) {
|
|
|
27
40
|
success: false,
|
|
28
41
|
statusCode: 429,
|
|
29
42
|
retryAfterMs: handshakeResult.retryAfterMs,
|
|
43
|
+
transient: true,
|
|
30
44
|
error: String(data.error || 'Workspace sync rate limited. Please retry later.')
|
|
31
45
|
};
|
|
32
46
|
}
|
|
@@ -40,21 +54,22 @@ export async function ensureCloudWorkspaceReadyForSyncService(input) {
|
|
|
40
54
|
return {
|
|
41
55
|
success: false,
|
|
42
56
|
statusCode: provisionResult.status,
|
|
43
|
-
error:
|
|
57
|
+
error: resolveWorkspaceAccessConflictMessage(provisionError, provisionResult.status)
|
|
44
58
|
};
|
|
45
59
|
}
|
|
46
60
|
handshakeResult = await handshakeWorkspace(input.resolveCloudAuthUrl, input.workspaceId);
|
|
47
61
|
if (!handshakeResult.ok) {
|
|
48
62
|
const retryData = asObjectRecord(handshakeResult.data);
|
|
49
63
|
if (handshakeResult.status === 401) {
|
|
50
|
-
return { success: false, statusCode: 401, error: String(retryData.error || 'Authentication required for workspace sync.') };
|
|
64
|
+
return { success: false, statusCode: 401, transient: false, error: String(retryData.error || 'Authentication required for workspace sync.') };
|
|
51
65
|
}
|
|
52
66
|
if (handshakeResult.status === 429) {
|
|
53
|
-
return { success: false, statusCode: 429, retryAfterMs: handshakeResult.retryAfterMs, error: String(retryData.error || 'Workspace sync rate limited. Please retry later.') };
|
|
67
|
+
return { success: false, statusCode: 429, retryAfterMs: handshakeResult.retryAfterMs, transient: true, error: String(retryData.error || 'Workspace sync rate limited. Please retry later.') };
|
|
54
68
|
}
|
|
55
69
|
return {
|
|
56
70
|
success: false,
|
|
57
71
|
statusCode: handshakeResult.status,
|
|
72
|
+
transient: isTransientWorkspaceSyncStatus(handshakeResult.status),
|
|
58
73
|
error: String(retryData.error || `Workspace sync handshake failed (${handshakeResult.status})`)
|
|
59
74
|
};
|
|
60
75
|
}
|
|
@@ -63,11 +78,12 @@ export async function ensureCloudWorkspaceReadyForSyncService(input) {
|
|
|
63
78
|
return {
|
|
64
79
|
success: false,
|
|
65
80
|
statusCode: handshakeResult.status,
|
|
81
|
+
transient: isTransientWorkspaceSyncStatus(handshakeResult.status),
|
|
66
82
|
error: String(data.error || `Workspace sync handshake failed (${handshakeResult.status})`)
|
|
67
83
|
};
|
|
68
84
|
}
|
|
69
85
|
catch {
|
|
70
|
-
return { success: false, error: 'Failed to validate workspace sync access.' };
|
|
86
|
+
return { success: false, statusCode: 0, transient: true, error: 'Failed to validate workspace sync access.' };
|
|
71
87
|
}
|
|
72
88
|
}
|
|
73
89
|
async function computeIdempotencyKey(workspaceId, changes) {
|
|
@@ -106,6 +122,12 @@ export async function runWorkspacePushSyncService(input) {
|
|
|
106
122
|
content: await encryptDocument(change.content, syncKey)
|
|
107
123
|
});
|
|
108
124
|
}
|
|
125
|
+
else if (change.op === 'asset-upsert' && typeof change.contentBase64 === 'string' && change.contentBase64.length > 0) {
|
|
126
|
+
encryptedChanges.push({
|
|
127
|
+
...change,
|
|
128
|
+
contentBase64: await encryptDocument(change.contentBase64, syncKey)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
109
131
|
else {
|
|
110
132
|
encryptedChanges.push(change);
|
|
111
133
|
}
|
|
@@ -117,7 +139,8 @@ export async function runWorkspacePushSyncService(input) {
|
|
|
117
139
|
const result = await pushWorkspaceChanges(input.resolveCloudAuthUrl, {
|
|
118
140
|
workspaceId: input.workspaceId,
|
|
119
141
|
idempotencyKey,
|
|
120
|
-
changes: safeChanges
|
|
142
|
+
changes: safeChanges,
|
|
143
|
+
repairMode: input.repairMode === true
|
|
121
144
|
});
|
|
122
145
|
requestMs += (Date.now() - requestStartedAtMs);
|
|
123
146
|
return result;
|
|
@@ -137,14 +160,33 @@ export async function runWorkspacePushSyncService(input) {
|
|
|
137
160
|
error: typeof data.error === 'string' ? data.error : undefined,
|
|
138
161
|
code: typeof data.code === 'string' ? data.code : undefined,
|
|
139
162
|
retryAfterMs: pushResult.retryAfterMs,
|
|
163
|
+
transient: isTransientWorkspaceSyncStatus(pushResult.status),
|
|
140
164
|
requestMs,
|
|
141
165
|
changeCount,
|
|
142
166
|
deleteCount,
|
|
143
167
|
currentTaskIds: input.payload.currentTaskIds,
|
|
144
168
|
deleteTaskIds: input.payload.deleteTaskIds,
|
|
169
|
+
currentInitiativeIds: input.payload.currentInitiativeIds,
|
|
170
|
+
currentInitiativeWatermarks: input.payload.currentInitiativeWatermarks,
|
|
171
|
+
currentWorkstreamIds: input.payload.currentWorkstreamIds,
|
|
172
|
+
currentWorkstreamWatermarks: input.payload.currentWorkstreamWatermarks,
|
|
173
|
+
currentAiProfileIds: input.payload.currentAiProfileIds,
|
|
174
|
+
currentAiProfileWatermarks: input.payload.currentAiProfileWatermarks,
|
|
145
175
|
currentDocumentPaths: input.payload.currentDocumentPaths,
|
|
146
176
|
deleteDocumentPaths: input.payload.deleteDocumentPaths,
|
|
147
177
|
currentDocumentWatermarks: input.payload.currentDocumentWatermarks,
|
|
178
|
+
currentAssetPaths: input.payload.currentAssetPaths,
|
|
179
|
+
deleteAssetPaths: input.payload.deleteAssetPaths,
|
|
180
|
+
currentAssetWatermarks: input.payload.currentAssetWatermarks,
|
|
181
|
+
currentDocumentReviewSessionIds: input.payload.currentDocumentReviewSessionIds,
|
|
182
|
+
deleteDocumentReviewSessionIds: input.payload.deleteDocumentReviewSessionIds,
|
|
183
|
+
currentDocumentReviewSessionWatermarks: input.payload.currentDocumentReviewSessionWatermarks,
|
|
184
|
+
currentDocumentReviewCommentIds: input.payload.currentDocumentReviewCommentIds,
|
|
185
|
+
deleteDocumentReviewCommentIds: input.payload.deleteDocumentReviewCommentIds,
|
|
186
|
+
currentDocumentReviewCommentWatermarks: input.payload.currentDocumentReviewCommentWatermarks,
|
|
187
|
+
currentAnnotatedAttachmentSessionIds: input.payload.currentAnnotatedAttachmentSessionIds,
|
|
188
|
+
deleteAnnotatedAttachmentSessionIds: input.payload.deleteAnnotatedAttachmentSessionIds,
|
|
189
|
+
currentAnnotatedAttachmentSessionWatermarks: input.payload.currentAnnotatedAttachmentSessionWatermarks,
|
|
148
190
|
pushedWatermarks: new Map(),
|
|
149
191
|
emittedEventIds: []
|
|
150
192
|
};
|
|
@@ -163,9 +205,27 @@ export async function runWorkspacePushSyncService(input) {
|
|
|
163
205
|
deleteCount,
|
|
164
206
|
currentTaskIds: input.payload.currentTaskIds,
|
|
165
207
|
deleteTaskIds: input.payload.deleteTaskIds,
|
|
208
|
+
currentInitiativeIds: input.payload.currentInitiativeIds,
|
|
209
|
+
currentInitiativeWatermarks: input.payload.currentInitiativeWatermarks,
|
|
210
|
+
currentWorkstreamIds: input.payload.currentWorkstreamIds,
|
|
211
|
+
currentWorkstreamWatermarks: input.payload.currentWorkstreamWatermarks,
|
|
212
|
+
currentAiProfileIds: input.payload.currentAiProfileIds,
|
|
213
|
+
currentAiProfileWatermarks: input.payload.currentAiProfileWatermarks,
|
|
166
214
|
currentDocumentPaths: input.payload.currentDocumentPaths,
|
|
167
215
|
deleteDocumentPaths: input.payload.deleteDocumentPaths,
|
|
168
216
|
currentDocumentWatermarks: input.payload.currentDocumentWatermarks,
|
|
217
|
+
currentAssetPaths: input.payload.currentAssetPaths,
|
|
218
|
+
deleteAssetPaths: input.payload.deleteAssetPaths,
|
|
219
|
+
currentAssetWatermarks: input.payload.currentAssetWatermarks,
|
|
220
|
+
currentDocumentReviewSessionIds: input.payload.currentDocumentReviewSessionIds,
|
|
221
|
+
deleteDocumentReviewSessionIds: input.payload.deleteDocumentReviewSessionIds,
|
|
222
|
+
currentDocumentReviewSessionWatermarks: input.payload.currentDocumentReviewSessionWatermarks,
|
|
223
|
+
currentDocumentReviewCommentIds: input.payload.currentDocumentReviewCommentIds,
|
|
224
|
+
deleteDocumentReviewCommentIds: input.payload.deleteDocumentReviewCommentIds,
|
|
225
|
+
currentDocumentReviewCommentWatermarks: input.payload.currentDocumentReviewCommentWatermarks,
|
|
226
|
+
currentAnnotatedAttachmentSessionIds: input.payload.currentAnnotatedAttachmentSessionIds,
|
|
227
|
+
deleteAnnotatedAttachmentSessionIds: input.payload.deleteAnnotatedAttachmentSessionIds,
|
|
228
|
+
currentAnnotatedAttachmentSessionWatermarks: input.payload.currentAnnotatedAttachmentSessionWatermarks,
|
|
169
229
|
pushedWatermarks: input.payload.pushedWatermarks,
|
|
170
230
|
emittedEventIds
|
|
171
231
|
};
|
|
@@ -181,6 +241,8 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
181
241
|
let pulledActiveUpserts = false;
|
|
182
242
|
let pulledArchivedUpserts = false;
|
|
183
243
|
const documentDecryptFailures = new Set();
|
|
244
|
+
const emittedEventIds = new Set();
|
|
245
|
+
const pulledAnnotatedAttachmentSessionIds = new Set();
|
|
184
246
|
const maxPages = Number.isFinite(Number(input.maxPages)) ? Math.max(1, Math.floor(Number(input.maxPages))) : 20;
|
|
185
247
|
try {
|
|
186
248
|
while (hasMore && pages < maxPages) {
|
|
@@ -189,7 +251,8 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
189
251
|
const result = await pullWorkspaceChanges(input.resolveCloudAuthUrl, {
|
|
190
252
|
workspaceId: input.workspaceId,
|
|
191
253
|
cursor,
|
|
192
|
-
limit: input.bootstrap ? 500 : 200
|
|
254
|
+
limit: input.bootstrap ? 500 : 200,
|
|
255
|
+
repairMode: input.repairMode === true
|
|
193
256
|
});
|
|
194
257
|
pullRequestMs += (Date.now() - pullRequestStartedAtMs);
|
|
195
258
|
return result;
|
|
@@ -207,6 +270,7 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
207
270
|
kind: 'pull_http',
|
|
208
271
|
status: pullRes.status,
|
|
209
272
|
retryAfterMs: pullRes.retryAfterMs,
|
|
273
|
+
transient: isTransientWorkspaceSyncStatus(pullRes.status),
|
|
210
274
|
cursor,
|
|
211
275
|
pages,
|
|
212
276
|
appliedChanges,
|
|
@@ -220,6 +284,10 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
220
284
|
}
|
|
221
285
|
const pullData = pullRes.data || {};
|
|
222
286
|
const changes = Array.isArray(pullData?.changes) ? pullData.changes : [];
|
|
287
|
+
const hasWorkspaceMembersSnapshot = Array.isArray(pullData?.workspaceMembers);
|
|
288
|
+
const workspaceMembers = hasWorkspaceMembersSnapshot
|
|
289
|
+
? pullData.workspaceMembers
|
|
290
|
+
: undefined;
|
|
223
291
|
for (const change of changes) {
|
|
224
292
|
if (change.op === 'upsert') {
|
|
225
293
|
const isArchivedUpsert = change?.archived === true || change?.task?.isArchived === true;
|
|
@@ -229,6 +297,12 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
229
297
|
pulledActiveUpserts = true;
|
|
230
298
|
continue;
|
|
231
299
|
}
|
|
300
|
+
if (change.op === 'annotated-attachment-session-upsert') {
|
|
301
|
+
const sessionId = String(change?.session?.id || '').trim();
|
|
302
|
+
if (sessionId)
|
|
303
|
+
pulledAnnotatedAttachmentSessionIds.add(sessionId);
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
232
306
|
if (change.op === 'document-upsert') {
|
|
233
307
|
if (typeof change.content === 'string' && typeof process !== 'undefined' && process.env?.TASKFORCE_SYNC_KEY) {
|
|
234
308
|
try {
|
|
@@ -243,6 +317,20 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
243
317
|
}
|
|
244
318
|
continue;
|
|
245
319
|
}
|
|
320
|
+
if (change.op === 'asset-upsert') {
|
|
321
|
+
if (typeof change.contentBase64 === 'string' && typeof process !== 'undefined' && process.env?.TASKFORCE_SYNC_KEY) {
|
|
322
|
+
try {
|
|
323
|
+
change.contentBase64 = await decryptDocument(change.contentBase64, process.env.TASKFORCE_SYNC_KEY);
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
// Leave as-is on decrypt failure so the asset entry is not silently dropped.
|
|
327
|
+
const path = String(change.path || '').trim();
|
|
328
|
+
if (path)
|
|
329
|
+
documentDecryptFailures.add(path);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
246
334
|
if (change.op !== 'delete')
|
|
247
335
|
continue;
|
|
248
336
|
const deleteTaskId = String(change.taskId || '').trim();
|
|
@@ -251,18 +339,23 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
251
339
|
}
|
|
252
340
|
if (input.onPagePulled)
|
|
253
341
|
input.onPagePulled();
|
|
254
|
-
if (changes.length > 0) {
|
|
342
|
+
if (changes.length > 0 || hasWorkspaceMembersSnapshot) {
|
|
255
343
|
const applyStartedAtMs = Date.now();
|
|
256
|
-
const applyResult = await applyLocalWorkspaceChanges(input.workspaceId, changes
|
|
344
|
+
const applyResult = await applyLocalWorkspaceChanges(input.workspaceId, changes, {
|
|
345
|
+
...(hasWorkspaceMembersSnapshot ? { workspaceMembers } : {}),
|
|
346
|
+
repairMode: input.repairMode === true
|
|
347
|
+
});
|
|
257
348
|
const applyFailures = applyResult.failures;
|
|
258
349
|
if (!applyResult.ok) {
|
|
259
350
|
applyMs += (Date.now() - applyStartedAtMs);
|
|
351
|
+
const applyPayloadData = asObjectRecord(applyResult.data);
|
|
260
352
|
const hasAuthFailure = applyFailures.some((entry) => entry.endsWith(':401'));
|
|
261
353
|
if (hasAuthFailure) {
|
|
262
354
|
return {
|
|
263
355
|
success: false,
|
|
264
356
|
kind: 'apply_auth',
|
|
265
357
|
status: 401,
|
|
358
|
+
transient: false,
|
|
266
359
|
failures: applyFailures,
|
|
267
360
|
cursor,
|
|
268
361
|
pages,
|
|
@@ -285,6 +378,9 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
285
378
|
return {
|
|
286
379
|
success: false,
|
|
287
380
|
kind: 'apply_all_candidates',
|
|
381
|
+
status: applyResult.status || undefined,
|
|
382
|
+
transient: hasTransientApplyFailure,
|
|
383
|
+
error: String(applyPayloadData.error || '').trim() || undefined,
|
|
288
384
|
failures: applyFailures,
|
|
289
385
|
hasTransientApplyFailure,
|
|
290
386
|
cursor,
|
|
@@ -295,7 +391,8 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
295
391
|
pulledDeleteTaskIds,
|
|
296
392
|
pulledActiveUpserts,
|
|
297
393
|
pulledArchivedUpserts,
|
|
298
|
-
documentDecryptFailures: Array.from(documentDecryptFailures)
|
|
394
|
+
documentDecryptFailures: Array.from(documentDecryptFailures),
|
|
395
|
+
emittedEventIds: Array.from(emittedEventIds)
|
|
299
396
|
};
|
|
300
397
|
}
|
|
301
398
|
const applyPayloadData = asObjectRecord(applyResult.data);
|
|
@@ -304,6 +401,7 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
304
401
|
return {
|
|
305
402
|
success: false,
|
|
306
403
|
kind: 'apply_payload',
|
|
404
|
+
transient: false,
|
|
307
405
|
error: String(applyPayloadData.error || 'Workspace sync apply failed.'),
|
|
308
406
|
cursor,
|
|
309
407
|
pages,
|
|
@@ -313,11 +411,17 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
313
411
|
pulledDeleteTaskIds,
|
|
314
412
|
pulledActiveUpserts,
|
|
315
413
|
pulledArchivedUpserts,
|
|
316
|
-
documentDecryptFailures: Array.from(documentDecryptFailures)
|
|
414
|
+
documentDecryptFailures: Array.from(documentDecryptFailures),
|
|
415
|
+
emittedEventIds: Array.from(emittedEventIds)
|
|
317
416
|
};
|
|
318
417
|
}
|
|
319
418
|
applyMs += (Date.now() - applyStartedAtMs);
|
|
320
419
|
appliedChanges += changes.length;
|
|
420
|
+
if (Array.isArray(applyPayloadData.emittedEventIds)) {
|
|
421
|
+
for (const eventId of applyPayloadData.emittedEventIds) {
|
|
422
|
+
emittedEventIds.add(String(eventId));
|
|
423
|
+
}
|
|
424
|
+
}
|
|
321
425
|
if (input.onChangesApplied)
|
|
322
426
|
input.onChangesApplied(changes.length);
|
|
323
427
|
}
|
|
@@ -329,6 +433,66 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
329
433
|
hasMore = Boolean(pullData?.hasMore);
|
|
330
434
|
pages += 1;
|
|
331
435
|
}
|
|
436
|
+
if (input.bootstrap) {
|
|
437
|
+
const bootstrapApplyStartedAtMs = Date.now();
|
|
438
|
+
const bootstrapApplyResult = await applyLocalWorkspaceChanges(input.workspaceId, [], {
|
|
439
|
+
bootstrapSnapshot: {
|
|
440
|
+
currentAnnotatedAttachmentSessionIds: Array.from(pulledAnnotatedAttachmentSessionIds),
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
const bootstrapApplyFailures = bootstrapApplyResult.failures;
|
|
444
|
+
if (!bootstrapApplyResult.ok) {
|
|
445
|
+
applyMs += (Date.now() - bootstrapApplyStartedAtMs);
|
|
446
|
+
const applyPayloadData = asObjectRecord(bootstrapApplyResult.data);
|
|
447
|
+
const hasAuthFailure = bootstrapApplyFailures.some((entry) => entry.endsWith(':401'));
|
|
448
|
+
if (hasAuthFailure) {
|
|
449
|
+
return {
|
|
450
|
+
success: false,
|
|
451
|
+
kind: 'apply_auth',
|
|
452
|
+
status: 401,
|
|
453
|
+
transient: false,
|
|
454
|
+
failures: bootstrapApplyFailures,
|
|
455
|
+
cursor,
|
|
456
|
+
pages,
|
|
457
|
+
appliedChanges,
|
|
458
|
+
pullRequestMs,
|
|
459
|
+
applyMs,
|
|
460
|
+
pulledDeleteTaskIds,
|
|
461
|
+
pulledActiveUpserts,
|
|
462
|
+
pulledArchivedUpserts,
|
|
463
|
+
documentDecryptFailures: Array.from(documentDecryptFailures),
|
|
464
|
+
emittedEventIds: Array.from(emittedEventIds)
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
const hasTransientApplyFailure = bootstrapApplyFailures.some((entry) => {
|
|
468
|
+
if (entry.endsWith(':network'))
|
|
469
|
+
return true;
|
|
470
|
+
const statusText = entry.split(':').pop() || '';
|
|
471
|
+
const status = Number.parseInt(statusText, 10);
|
|
472
|
+
return Number.isFinite(status) && (status === 429 || status >= 500);
|
|
473
|
+
});
|
|
474
|
+
return {
|
|
475
|
+
success: false,
|
|
476
|
+
kind: 'apply_all_candidates',
|
|
477
|
+
status: bootstrapApplyResult.status || undefined,
|
|
478
|
+
transient: hasTransientApplyFailure,
|
|
479
|
+
error: String(applyPayloadData.error || '').trim() || undefined,
|
|
480
|
+
failures: bootstrapApplyFailures,
|
|
481
|
+
hasTransientApplyFailure,
|
|
482
|
+
cursor,
|
|
483
|
+
pages,
|
|
484
|
+
appliedChanges,
|
|
485
|
+
pullRequestMs,
|
|
486
|
+
applyMs,
|
|
487
|
+
pulledDeleteTaskIds,
|
|
488
|
+
pulledActiveUpserts,
|
|
489
|
+
pulledArchivedUpserts,
|
|
490
|
+
documentDecryptFailures: Array.from(documentDecryptFailures),
|
|
491
|
+
emittedEventIds: Array.from(emittedEventIds)
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
applyMs += (Date.now() - bootstrapApplyStartedAtMs);
|
|
495
|
+
}
|
|
332
496
|
return {
|
|
333
497
|
success: true,
|
|
334
498
|
syncedAt: new Date().toISOString(),
|
|
@@ -340,13 +504,17 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
340
504
|
pulledDeleteTaskIds,
|
|
341
505
|
pulledActiveUpserts,
|
|
342
506
|
pulledArchivedUpserts,
|
|
343
|
-
documentDecryptFailures: Array.from(documentDecryptFailures)
|
|
507
|
+
documentDecryptFailures: Array.from(documentDecryptFailures),
|
|
508
|
+
emittedEventIds: Array.from(emittedEventIds)
|
|
344
509
|
};
|
|
345
510
|
}
|
|
346
|
-
catch {
|
|
511
|
+
catch (error) {
|
|
347
512
|
return {
|
|
348
513
|
success: false,
|
|
349
514
|
kind: 'exception',
|
|
515
|
+
status: 0,
|
|
516
|
+
transient: true,
|
|
517
|
+
error: String(error?.message || error || 'Workspace sync pull failed unexpectedly.'),
|
|
350
518
|
cursor: cursor || null,
|
|
351
519
|
pages,
|
|
352
520
|
appliedChanges,
|
|
@@ -355,12 +523,12 @@ export async function runWorkspacePullSyncService(input) {
|
|
|
355
523
|
pulledDeleteTaskIds,
|
|
356
524
|
pulledActiveUpserts,
|
|
357
525
|
pulledArchivedUpserts,
|
|
358
|
-
documentDecryptFailures: Array.from(documentDecryptFailures)
|
|
526
|
+
documentDecryptFailures: Array.from(documentDecryptFailures),
|
|
527
|
+
emittedEventIds: Array.from(emittedEventIds)
|
|
359
528
|
};
|
|
360
529
|
}
|
|
361
530
|
}
|
|
362
531
|
export async function syncUserGlobalSettingsService(input) {
|
|
363
|
-
const isTransientStatus = (status) => status === 0 || status === 429 || status >= 500;
|
|
364
532
|
const pullResult = await pullUserSettings(input.resolveCloudAuthUrl);
|
|
365
533
|
if (!pullResult.ok) {
|
|
366
534
|
const status = Number(pullResult.status || 0);
|
|
@@ -369,7 +537,7 @@ export async function syncUserGlobalSettingsService(input) {
|
|
|
369
537
|
error: `Sync pull failed (${pullResult.status})`,
|
|
370
538
|
statusCode: pullResult.status,
|
|
371
539
|
retryAfterMs: pullResult.retryAfterMs,
|
|
372
|
-
transient:
|
|
540
|
+
transient: isTransientWorkspaceSyncStatus(status)
|
|
373
541
|
};
|
|
374
542
|
}
|
|
375
543
|
const pullData = asObjectRecord(pullResult.data);
|
|
@@ -402,7 +570,7 @@ export async function syncUserGlobalSettingsService(input) {
|
|
|
402
570
|
error: `Sync push failed (${pushResult.status})`,
|
|
403
571
|
statusCode: pushResult.status,
|
|
404
572
|
retryAfterMs: pushResult.retryAfterMs,
|
|
405
|
-
transient:
|
|
573
|
+
transient: isTransientWorkspaceSyncStatus(status)
|
|
406
574
|
};
|
|
407
575
|
}
|
|
408
576
|
const pushData = asObjectRecord(pushResult.data);
|