@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
|
@@ -0,0 +1,1120 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
3
|
+
import { act, renderHook, waitFor } from '@testing-library/react';
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import { useTaskforce } from './useTaskforce';
|
|
6
|
+
class MockWebSocket {
|
|
7
|
+
static instances = [];
|
|
8
|
+
static OPEN = 1;
|
|
9
|
+
static CLOSED = 3;
|
|
10
|
+
url;
|
|
11
|
+
readyState = 0;
|
|
12
|
+
sent = [];
|
|
13
|
+
listeners = {
|
|
14
|
+
open: [],
|
|
15
|
+
message: [],
|
|
16
|
+
close: [],
|
|
17
|
+
error: []
|
|
18
|
+
};
|
|
19
|
+
constructor(url) {
|
|
20
|
+
this.url = url;
|
|
21
|
+
MockWebSocket.instances.push(this);
|
|
22
|
+
}
|
|
23
|
+
addEventListener(type, listener) {
|
|
24
|
+
this.listeners[type] = this.listeners[type] || [];
|
|
25
|
+
this.listeners[type].push(listener);
|
|
26
|
+
}
|
|
27
|
+
close() {
|
|
28
|
+
this.readyState = MockWebSocket.CLOSED;
|
|
29
|
+
this.emit('close', {});
|
|
30
|
+
}
|
|
31
|
+
send(payload) {
|
|
32
|
+
this.sent.push(payload);
|
|
33
|
+
}
|
|
34
|
+
emit(type, event) {
|
|
35
|
+
const handlers = this.listeners[type] || [];
|
|
36
|
+
handlers.forEach((handler) => handler(event));
|
|
37
|
+
}
|
|
38
|
+
open() {
|
|
39
|
+
this.readyState = MockWebSocket.OPEN;
|
|
40
|
+
this.emit('open', {});
|
|
41
|
+
}
|
|
42
|
+
message(payload) {
|
|
43
|
+
this.emit('message', { data: JSON.stringify(payload) });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function jsonResponse(body, status = 200) {
|
|
47
|
+
return Promise.resolve({
|
|
48
|
+
ok: status >= 200 && status < 300,
|
|
49
|
+
status,
|
|
50
|
+
json: () => Promise.resolve(body)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const wrapper = ({ children }) => (_jsx(MemoryRouter, { children: children }));
|
|
54
|
+
const activeTask = {
|
|
55
|
+
id: 'task-parent',
|
|
56
|
+
title: 'Parent task',
|
|
57
|
+
description: 'Parent description',
|
|
58
|
+
category: 'general',
|
|
59
|
+
type: 'feature',
|
|
60
|
+
priority: 2,
|
|
61
|
+
complexity: 3,
|
|
62
|
+
status: 'task',
|
|
63
|
+
createdAt: '2026-03-15T10:00:00.000Z',
|
|
64
|
+
updatedAt: '2026-03-15T10:00:00.000Z'
|
|
65
|
+
};
|
|
66
|
+
const doneTask = {
|
|
67
|
+
...activeTask,
|
|
68
|
+
id: 'task-done',
|
|
69
|
+
title: 'Done task',
|
|
70
|
+
status: 'done',
|
|
71
|
+
completedAt: '2026-03-15T10:15:00.000Z',
|
|
72
|
+
updatedAt: '2026-03-15T10:15:00.000Z'
|
|
73
|
+
};
|
|
74
|
+
const archivedTaskRecord = (id, title) => ({
|
|
75
|
+
id,
|
|
76
|
+
title,
|
|
77
|
+
description: `${title} description`,
|
|
78
|
+
category: 'general',
|
|
79
|
+
type: 'feature',
|
|
80
|
+
priority: 2,
|
|
81
|
+
complexity: 3,
|
|
82
|
+
status: 'done',
|
|
83
|
+
createdAt: '2026-03-15T10:10:00.000Z',
|
|
84
|
+
updatedAt: '2026-03-15T10:10:00.000Z',
|
|
85
|
+
isArchived: true
|
|
86
|
+
});
|
|
87
|
+
describe('useTaskforce sync behavior', () => {
|
|
88
|
+
beforeEach(() => {
|
|
89
|
+
localStorage.clear();
|
|
90
|
+
});
|
|
91
|
+
afterEach(() => {
|
|
92
|
+
vi.useRealTimers();
|
|
93
|
+
vi.unstubAllGlobals();
|
|
94
|
+
vi.clearAllMocks();
|
|
95
|
+
MockWebSocket.instances = [];
|
|
96
|
+
});
|
|
97
|
+
it('merges a server-returned task into the active collection immediately', async () => {
|
|
98
|
+
vi.stubGlobal('fetch', vi.fn((url, init) => {
|
|
99
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
100
|
+
return jsonResponse({ config: { runtimeMode: 'local', workspaceMode: 'single-local', authSource: 'local' } });
|
|
101
|
+
}
|
|
102
|
+
if (url.includes('/api/taskforce/auth/session')) {
|
|
103
|
+
return jsonResponse({
|
|
104
|
+
authenticated: false,
|
|
105
|
+
authRequiredForApi: false,
|
|
106
|
+
betaAccess: true,
|
|
107
|
+
userId: 'anonymous',
|
|
108
|
+
email: '',
|
|
109
|
+
workspaceId: 'workspace-local-active'
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (url.includes('/api/taskforce/ui-state?key=app')) {
|
|
113
|
+
return jsonResponse({ success: true, state: {} });
|
|
114
|
+
}
|
|
115
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
116
|
+
return jsonResponse({
|
|
117
|
+
success: true,
|
|
118
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if (url.includes('/api/taskforce/config')) {
|
|
122
|
+
return jsonResponse({
|
|
123
|
+
projectName: 'Test Project',
|
|
124
|
+
workspaceId: 'workspace-local-active',
|
|
125
|
+
runtimeMode: 'local',
|
|
126
|
+
setupState: {
|
|
127
|
+
globalSetupState: 'complete',
|
|
128
|
+
workspaceSetupState: 'complete',
|
|
129
|
+
workspaceId: 'workspace-local-active'
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if (url.includes('/api/taskforce/global-settings')) {
|
|
134
|
+
return jsonResponse({});
|
|
135
|
+
}
|
|
136
|
+
if (url.includes('/api/taskforce/categories')) {
|
|
137
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
138
|
+
}
|
|
139
|
+
if (url.includes('/api/taskforce/types')) {
|
|
140
|
+
return jsonResponse({ types: [] });
|
|
141
|
+
}
|
|
142
|
+
if (url.includes('/api/taskforce/priorities')) {
|
|
143
|
+
return jsonResponse({ priorities: [] });
|
|
144
|
+
}
|
|
145
|
+
if (url.includes('/api/taskforce/approaches')) {
|
|
146
|
+
return jsonResponse({ approaches: [] });
|
|
147
|
+
}
|
|
148
|
+
if (url.includes('/api/taskforce/specialists')) {
|
|
149
|
+
return jsonResponse({ specialists: [] });
|
|
150
|
+
}
|
|
151
|
+
if (url.includes('/api/taskforce/tasks')) {
|
|
152
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
153
|
+
}
|
|
154
|
+
if (url.includes('/api/taskforce/archive')) {
|
|
155
|
+
return jsonResponse({ archived: [] });
|
|
156
|
+
}
|
|
157
|
+
if (url.includes('/api/taskforce/task/task-child') && String(init?.method || '').toUpperCase() === 'PATCH') {
|
|
158
|
+
return jsonResponse({
|
|
159
|
+
id: 'task-child',
|
|
160
|
+
title: 'Updated task',
|
|
161
|
+
description: 'Updated description',
|
|
162
|
+
category: 'general',
|
|
163
|
+
type: 'feature',
|
|
164
|
+
priority: 2,
|
|
165
|
+
complexity: 3,
|
|
166
|
+
status: 'in-progress',
|
|
167
|
+
createdAt: '2026-03-15T10:05:00.000Z',
|
|
168
|
+
updatedAt: '2026-03-15T10:06:00.000Z'
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
if (url.includes('/api/taskforce/data-version')) {
|
|
172
|
+
return jsonResponse({ dataVersion: 1 });
|
|
173
|
+
}
|
|
174
|
+
return jsonResponse({});
|
|
175
|
+
}));
|
|
176
|
+
const { result } = renderHook(() => useTaskforce({ config: {} }), { wrapper });
|
|
177
|
+
await waitFor(() => {
|
|
178
|
+
expect(result.current.tasks.some((task) => task.id === 'task-parent')).toBe(true);
|
|
179
|
+
});
|
|
180
|
+
await act(async () => {
|
|
181
|
+
await result.current.handleUpdateTask('task-child', { status: 'in-progress' });
|
|
182
|
+
});
|
|
183
|
+
await waitFor(() => {
|
|
184
|
+
const childTask = result.current.tasks.find((task) => task.id === 'task-child');
|
|
185
|
+
expect(childTask?.status).toBe('in-progress');
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
it('keeps the dawn theme when settings re-fetch configuration', async () => {
|
|
189
|
+
const fetchMock = vi.fn((url) => {
|
|
190
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
191
|
+
return jsonResponse({ config: { runtimeMode: 'local', workspaceMode: 'single-local', authSource: 'local' } });
|
|
192
|
+
}
|
|
193
|
+
if (url.includes('/api/taskforce/auth/session')) {
|
|
194
|
+
return jsonResponse({
|
|
195
|
+
authenticated: false,
|
|
196
|
+
authRequiredForApi: false,
|
|
197
|
+
betaAccess: true,
|
|
198
|
+
userId: 'anonymous',
|
|
199
|
+
email: '',
|
|
200
|
+
workspaceId: 'workspace-local-active'
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
if (url.includes('/api/taskforce/ui-state?key=app')) {
|
|
204
|
+
return jsonResponse({ success: true, state: {} });
|
|
205
|
+
}
|
|
206
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
207
|
+
return jsonResponse({
|
|
208
|
+
success: true,
|
|
209
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (url.includes('/api/taskforce/config')) {
|
|
213
|
+
return jsonResponse({
|
|
214
|
+
theme: 'dawn',
|
|
215
|
+
globalTheme: 'dawn',
|
|
216
|
+
themeUseGlobalDefault: true,
|
|
217
|
+
projectName: 'Test Project',
|
|
218
|
+
workspaceId: 'workspace-local-active',
|
|
219
|
+
runtimeMode: 'local',
|
|
220
|
+
setupState: {
|
|
221
|
+
globalSetupState: 'complete',
|
|
222
|
+
workspaceSetupState: 'complete',
|
|
223
|
+
workspaceId: 'workspace-local-active'
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
if (url.includes('/api/taskforce/global-settings'))
|
|
228
|
+
return jsonResponse({});
|
|
229
|
+
if (url.includes('/api/taskforce/categories'))
|
|
230
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
231
|
+
if (url.includes('/api/taskforce/types'))
|
|
232
|
+
return jsonResponse({ types: [] });
|
|
233
|
+
if (url.includes('/api/taskforce/priorities'))
|
|
234
|
+
return jsonResponse({ priorities: [] });
|
|
235
|
+
if (url.includes('/api/taskforce/approaches'))
|
|
236
|
+
return jsonResponse({ approaches: [] });
|
|
237
|
+
if (url.includes('/api/taskforce/specialists'))
|
|
238
|
+
return jsonResponse({ specialists: [] });
|
|
239
|
+
if (url.includes('/api/taskforce/tasks'))
|
|
240
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
241
|
+
if (url.includes('/api/taskforce/archive'))
|
|
242
|
+
return jsonResponse({ archived: [] });
|
|
243
|
+
if (url.includes('/api/taskforce/data-version'))
|
|
244
|
+
return jsonResponse({ dataVersion: 1 });
|
|
245
|
+
return jsonResponse({});
|
|
246
|
+
});
|
|
247
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
248
|
+
const { result } = renderHook(() => useTaskforce({ config: {} }), { wrapper });
|
|
249
|
+
await waitFor(() => {
|
|
250
|
+
expect(result.current.currentTheme).toBe('dawn');
|
|
251
|
+
});
|
|
252
|
+
await act(async () => {
|
|
253
|
+
result.current.setIsOpen(true);
|
|
254
|
+
result.current.setActiveTab('settings');
|
|
255
|
+
});
|
|
256
|
+
await waitFor(() => {
|
|
257
|
+
expect(fetchMock.mock.calls.filter(([url]) => String(url).includes('/api/taskforce/config'))).toHaveLength(2);
|
|
258
|
+
expect(result.current.currentTheme).toBe('dawn');
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
it('merges a server-returned archived task immediately instead of dropping it between collections', async () => {
|
|
262
|
+
vi.stubGlobal('fetch', vi.fn((url, init) => {
|
|
263
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
264
|
+
return jsonResponse({ config: { runtimeMode: 'local', workspaceMode: 'single-local', authSource: 'local' } });
|
|
265
|
+
}
|
|
266
|
+
if (url.includes('/api/taskforce/ui-state?key=app')) {
|
|
267
|
+
return jsonResponse({ success: true, state: {} });
|
|
268
|
+
}
|
|
269
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
270
|
+
return jsonResponse({
|
|
271
|
+
success: true,
|
|
272
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
if (url.includes('/api/taskforce/config')) {
|
|
276
|
+
return jsonResponse({
|
|
277
|
+
projectName: 'Test Project',
|
|
278
|
+
workspaceId: 'workspace-local-active',
|
|
279
|
+
runtimeMode: 'local',
|
|
280
|
+
setupState: {
|
|
281
|
+
globalSetupState: 'complete',
|
|
282
|
+
workspaceSetupState: 'complete',
|
|
283
|
+
workspaceId: 'workspace-local-active'
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
if (url.includes('/api/taskforce/global-settings')) {
|
|
288
|
+
return jsonResponse({});
|
|
289
|
+
}
|
|
290
|
+
if (url.includes('/api/taskforce/categories')) {
|
|
291
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
292
|
+
}
|
|
293
|
+
if (url.includes('/api/taskforce/types')) {
|
|
294
|
+
return jsonResponse({ types: [] });
|
|
295
|
+
}
|
|
296
|
+
if (url.includes('/api/taskforce/priorities')) {
|
|
297
|
+
return jsonResponse({ priorities: [] });
|
|
298
|
+
}
|
|
299
|
+
if (url.includes('/api/taskforce/approaches')) {
|
|
300
|
+
return jsonResponse({ approaches: [] });
|
|
301
|
+
}
|
|
302
|
+
if (url.includes('/api/taskforce/specialists')) {
|
|
303
|
+
return jsonResponse({ specialists: [] });
|
|
304
|
+
}
|
|
305
|
+
if (url.includes('/api/taskforce/tasks')) {
|
|
306
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
307
|
+
}
|
|
308
|
+
if (url.includes('/api/taskforce/archive')) {
|
|
309
|
+
return jsonResponse({ archived: [] });
|
|
310
|
+
}
|
|
311
|
+
if (url.includes('/api/taskforce/task/task-parent/complete') && String(init?.method || '').toUpperCase() === 'POST') {
|
|
312
|
+
return jsonResponse({
|
|
313
|
+
...activeTask,
|
|
314
|
+
status: 'done',
|
|
315
|
+
isArchived: true,
|
|
316
|
+
completedAt: '2026-03-15T10:20:00.000Z',
|
|
317
|
+
updatedAt: '2026-03-15T10:20:00.000Z'
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
if (url.includes('/api/taskforce/data-version')) {
|
|
321
|
+
return jsonResponse({ dataVersion: 1 });
|
|
322
|
+
}
|
|
323
|
+
return jsonResponse({});
|
|
324
|
+
}));
|
|
325
|
+
const { result } = renderHook(() => useTaskforce({ config: {} }), { wrapper });
|
|
326
|
+
await waitFor(() => {
|
|
327
|
+
expect(result.current.tasks.some((task) => task.id === 'task-parent')).toBe(true);
|
|
328
|
+
});
|
|
329
|
+
await act(async () => {
|
|
330
|
+
await result.current.handleArchiveTask(activeTask);
|
|
331
|
+
});
|
|
332
|
+
await waitFor(() => {
|
|
333
|
+
expect(result.current.tasks.some((task) => task.id === 'task-parent')).toBe(false);
|
|
334
|
+
const archived = result.current.archivedTasks.find((task) => task.id === 'task-parent');
|
|
335
|
+
expect(archived?.isArchived).toBe(true);
|
|
336
|
+
expect(archived?.status).toBe('done');
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
it('merges a server-returned completed task immediately when toggling done', async () => {
|
|
340
|
+
vi.stubGlobal('fetch', vi.fn((url, init) => {
|
|
341
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
342
|
+
return jsonResponse({ config: { runtimeMode: 'local', workspaceMode: 'single-local', authSource: 'local' } });
|
|
343
|
+
}
|
|
344
|
+
if (url.includes('/api/taskforce/ui-state?key=app')) {
|
|
345
|
+
return jsonResponse({ success: true, state: {} });
|
|
346
|
+
}
|
|
347
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
348
|
+
return jsonResponse({
|
|
349
|
+
success: true,
|
|
350
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
if (url.includes('/api/taskforce/config')) {
|
|
354
|
+
return jsonResponse({
|
|
355
|
+
projectName: 'Test Project',
|
|
356
|
+
workspaceId: 'workspace-local-active',
|
|
357
|
+
runtimeMode: 'local',
|
|
358
|
+
setupState: {
|
|
359
|
+
globalSetupState: 'complete',
|
|
360
|
+
workspaceSetupState: 'complete',
|
|
361
|
+
workspaceId: 'workspace-local-active'
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
if (url.includes('/api/taskforce/global-settings')) {
|
|
366
|
+
return jsonResponse({});
|
|
367
|
+
}
|
|
368
|
+
if (url.includes('/api/taskforce/categories')) {
|
|
369
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
370
|
+
}
|
|
371
|
+
if (url.includes('/api/taskforce/types')) {
|
|
372
|
+
return jsonResponse({ types: [] });
|
|
373
|
+
}
|
|
374
|
+
if (url.includes('/api/taskforce/priorities')) {
|
|
375
|
+
return jsonResponse({ priorities: [] });
|
|
376
|
+
}
|
|
377
|
+
if (url.includes('/api/taskforce/approaches')) {
|
|
378
|
+
return jsonResponse({ approaches: [] });
|
|
379
|
+
}
|
|
380
|
+
if (url.includes('/api/taskforce/specialists')) {
|
|
381
|
+
return jsonResponse({ specialists: [] });
|
|
382
|
+
}
|
|
383
|
+
if (url.includes('/api/taskforce/tasks')) {
|
|
384
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
385
|
+
}
|
|
386
|
+
if (url.includes('/api/taskforce/archive')) {
|
|
387
|
+
return jsonResponse({ archived: [] });
|
|
388
|
+
}
|
|
389
|
+
if (url.includes('/api/taskforce/task/task-parent') && String(init?.method || '').toUpperCase() === 'PATCH') {
|
|
390
|
+
return jsonResponse({
|
|
391
|
+
...activeTask,
|
|
392
|
+
status: 'done',
|
|
393
|
+
completedAt: '2026-03-15T10:25:00.000Z',
|
|
394
|
+
updatedAt: '2026-03-15T10:25:00.000Z'
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
if (url.includes('/api/taskforce/data-version')) {
|
|
398
|
+
return jsonResponse({ dataVersion: 1 });
|
|
399
|
+
}
|
|
400
|
+
return jsonResponse({});
|
|
401
|
+
}));
|
|
402
|
+
const { result } = renderHook(() => useTaskforce({ config: {} }), { wrapper });
|
|
403
|
+
await waitFor(() => {
|
|
404
|
+
expect(result.current.tasks.some((task) => task.id === 'task-parent')).toBe(true);
|
|
405
|
+
});
|
|
406
|
+
await act(async () => {
|
|
407
|
+
await result.current.handleToggleComplete(activeTask);
|
|
408
|
+
});
|
|
409
|
+
await waitFor(() => {
|
|
410
|
+
const completed = result.current.tasks.find((task) => task.id === 'task-parent');
|
|
411
|
+
expect(completed?.status).toBe('done');
|
|
412
|
+
expect(completed?.completedAt).toBe('2026-03-15T10:25:00.000Z');
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
it('merges bulk-archived tasks immediately instead of relying on archive refresh timing', async () => {
|
|
416
|
+
vi.stubGlobal('confirm', vi.fn(() => true));
|
|
417
|
+
vi.stubGlobal('fetch', vi.fn((url, init) => {
|
|
418
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
419
|
+
return jsonResponse({ config: { runtimeMode: 'local', workspaceMode: 'single-local', authSource: 'local' } });
|
|
420
|
+
}
|
|
421
|
+
if (url.includes('/api/taskforce/ui-state?key=app')) {
|
|
422
|
+
return jsonResponse({ success: true, state: {} });
|
|
423
|
+
}
|
|
424
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
425
|
+
return jsonResponse({
|
|
426
|
+
success: true,
|
|
427
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
if (url.includes('/api/taskforce/config')) {
|
|
431
|
+
return jsonResponse({
|
|
432
|
+
projectName: 'Test Project',
|
|
433
|
+
workspaceId: 'workspace-local-active',
|
|
434
|
+
runtimeMode: 'local',
|
|
435
|
+
setupState: {
|
|
436
|
+
globalSetupState: 'complete',
|
|
437
|
+
workspaceSetupState: 'complete',
|
|
438
|
+
workspaceId: 'workspace-local-active'
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
if (url.includes('/api/taskforce/global-settings')) {
|
|
443
|
+
return jsonResponse({});
|
|
444
|
+
}
|
|
445
|
+
if (url.includes('/api/taskforce/categories')) {
|
|
446
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
447
|
+
}
|
|
448
|
+
if (url.includes('/api/taskforce/types')) {
|
|
449
|
+
return jsonResponse({ types: [] });
|
|
450
|
+
}
|
|
451
|
+
if (url.includes('/api/taskforce/priorities')) {
|
|
452
|
+
return jsonResponse({ priorities: [] });
|
|
453
|
+
}
|
|
454
|
+
if (url.includes('/api/taskforce/approaches')) {
|
|
455
|
+
return jsonResponse({ approaches: [] });
|
|
456
|
+
}
|
|
457
|
+
if (url.includes('/api/taskforce/specialists')) {
|
|
458
|
+
return jsonResponse({ specialists: [] });
|
|
459
|
+
}
|
|
460
|
+
if (url.includes('/api/taskforce/tasks')) {
|
|
461
|
+
return jsonResponse({ tasks: [activeTask, doneTask] });
|
|
462
|
+
}
|
|
463
|
+
if (url.includes('/api/taskforce/archive')) {
|
|
464
|
+
return jsonResponse({ archived: [] });
|
|
465
|
+
}
|
|
466
|
+
if (url.includes('/api/taskforce/bulk-archive') && String(init?.method || '').toUpperCase() === 'POST') {
|
|
467
|
+
return jsonResponse({
|
|
468
|
+
success: true,
|
|
469
|
+
results: {
|
|
470
|
+
archived: [
|
|
471
|
+
{
|
|
472
|
+
...doneTask,
|
|
473
|
+
isArchived: true
|
|
474
|
+
}
|
|
475
|
+
]
|
|
476
|
+
},
|
|
477
|
+
errors: []
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
if (url.includes('/api/taskforce/data-version')) {
|
|
481
|
+
return jsonResponse({ dataVersion: 1 });
|
|
482
|
+
}
|
|
483
|
+
return jsonResponse({});
|
|
484
|
+
}));
|
|
485
|
+
const { result } = renderHook(() => useTaskforce({ config: {} }), { wrapper });
|
|
486
|
+
await waitFor(() => {
|
|
487
|
+
expect(result.current.tasks.some((task) => task.id === 'task-done')).toBe(true);
|
|
488
|
+
});
|
|
489
|
+
await act(async () => {
|
|
490
|
+
await result.current.handleBulkArchive();
|
|
491
|
+
});
|
|
492
|
+
await waitFor(() => {
|
|
493
|
+
expect(result.current.tasks.some((task) => task.id === 'task-done')).toBe(false);
|
|
494
|
+
const archived = result.current.archivedTasks.find((task) => task.id === 'task-done');
|
|
495
|
+
expect(archived?.isArchived).toBe(true);
|
|
496
|
+
expect(archived?.status).toBe('done');
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
it('preserves an explicit local api base url instead of letting runtime-config reset it to the app origin', async () => {
|
|
500
|
+
vi.stubGlobal('fetch', vi.fn((url) => {
|
|
501
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
502
|
+
return jsonResponse({
|
|
503
|
+
config: {
|
|
504
|
+
runtimeMode: 'local',
|
|
505
|
+
workspaceMode: 'single-local',
|
|
506
|
+
authSource: 'local',
|
|
507
|
+
baseUrl: 'http://localhost:5174',
|
|
508
|
+
apiBaseUrl: 'http://localhost:5174',
|
|
509
|
+
cloudAuthBaseUrl: 'http://localhost:5174'
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
if (url.includes('/api/taskforce/ui-state?key=app')) {
|
|
514
|
+
return jsonResponse({ success: true, state: {} });
|
|
515
|
+
}
|
|
516
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
517
|
+
return jsonResponse({
|
|
518
|
+
success: true,
|
|
519
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
if (url.includes('/api/taskforce/config')) {
|
|
523
|
+
return jsonResponse({
|
|
524
|
+
projectName: 'Test Project',
|
|
525
|
+
workspaceId: 'workspace-local-active',
|
|
526
|
+
runtimeMode: 'local',
|
|
527
|
+
setupState: {
|
|
528
|
+
globalSetupState: 'complete',
|
|
529
|
+
workspaceSetupState: 'complete',
|
|
530
|
+
workspaceId: 'workspace-local-active'
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
if (url.includes('/api/taskforce/global-settings')) {
|
|
535
|
+
return jsonResponse({});
|
|
536
|
+
}
|
|
537
|
+
if (url.includes('/api/taskforce/categories')) {
|
|
538
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
539
|
+
}
|
|
540
|
+
if (url.includes('/api/taskforce/types')) {
|
|
541
|
+
return jsonResponse({ types: [] });
|
|
542
|
+
}
|
|
543
|
+
if (url.includes('/api/taskforce/priorities')) {
|
|
544
|
+
return jsonResponse({ priorities: [] });
|
|
545
|
+
}
|
|
546
|
+
if (url.includes('/api/taskforce/approaches')) {
|
|
547
|
+
return jsonResponse({ approaches: [] });
|
|
548
|
+
}
|
|
549
|
+
if (url.includes('/api/taskforce/specialists')) {
|
|
550
|
+
return jsonResponse({ specialists: [] });
|
|
551
|
+
}
|
|
552
|
+
if (url.includes('/api/taskforce/tasks')) {
|
|
553
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
554
|
+
}
|
|
555
|
+
if (url.includes('/api/taskforce/archive')) {
|
|
556
|
+
return jsonResponse({ archived: [] });
|
|
557
|
+
}
|
|
558
|
+
if (url.includes('/api/taskforce/data-version')) {
|
|
559
|
+
return jsonResponse({ dataVersion: 1 });
|
|
560
|
+
}
|
|
561
|
+
return jsonResponse({});
|
|
562
|
+
}));
|
|
563
|
+
const { result } = renderHook(() => useTaskforce({ config: { apiBaseUrl: 'http://127.0.0.1:4280' } }), { wrapper });
|
|
564
|
+
await waitFor(() => {
|
|
565
|
+
expect(result.current.config.apiBaseUrl).toBe('http://127.0.0.1:4280');
|
|
566
|
+
});
|
|
567
|
+
});
|
|
568
|
+
it('opens archived tasks by id and enables archive view', async () => {
|
|
569
|
+
vi.stubGlobal('WebSocket', MockWebSocket);
|
|
570
|
+
const archivedChildren = [
|
|
571
|
+
archivedTaskRecord('task-archived-child-1', 'Archived Task 1')
|
|
572
|
+
];
|
|
573
|
+
vi.stubGlobal('fetch', vi.fn((url) => {
|
|
574
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
575
|
+
return jsonResponse({
|
|
576
|
+
config: {
|
|
577
|
+
runtimeMode: 'cloud',
|
|
578
|
+
workspaceMode: 'multi-cloud',
|
|
579
|
+
authSource: 'cloud',
|
|
580
|
+
workspaceSwitchingEnabled: true
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
if (url.includes('/api/taskforce/auth/session')) {
|
|
585
|
+
return jsonResponse({
|
|
586
|
+
authenticated: true,
|
|
587
|
+
authRequiredForApi: true,
|
|
588
|
+
betaAccess: true,
|
|
589
|
+
userId: 'user-1',
|
|
590
|
+
email: 'user@example.com',
|
|
591
|
+
workspaceId: 'workspace-cloud-1'
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
if (url.includes('/api/taskforce/ui-state?key=app')) {
|
|
595
|
+
return jsonResponse({ success: true, state: {} });
|
|
596
|
+
}
|
|
597
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
598
|
+
return jsonResponse({
|
|
599
|
+
success: true,
|
|
600
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
if (url.includes('/api/taskforce/config')) {
|
|
604
|
+
return jsonResponse({
|
|
605
|
+
projectName: 'Cloud Project',
|
|
606
|
+
workspaceId: 'workspace-cloud-1',
|
|
607
|
+
runtimeMode: 'cloud',
|
|
608
|
+
authRequiredForApi: true,
|
|
609
|
+
realtimeSyncEnabled: true,
|
|
610
|
+
userId: 'user-1',
|
|
611
|
+
setupState: {
|
|
612
|
+
globalSetupState: 'complete',
|
|
613
|
+
workspaceSetupState: 'complete',
|
|
614
|
+
workspaceId: 'workspace-cloud-1'
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
if (url.includes('/api/taskforce/global-settings'))
|
|
619
|
+
return jsonResponse({});
|
|
620
|
+
if (url.includes('/api/taskforce/categories'))
|
|
621
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
622
|
+
if (url.includes('/api/taskforce/types'))
|
|
623
|
+
return jsonResponse({ types: [] });
|
|
624
|
+
if (url.includes('/api/taskforce/priorities'))
|
|
625
|
+
return jsonResponse({ priorities: [] });
|
|
626
|
+
if (url.includes('/api/taskforce/approaches'))
|
|
627
|
+
return jsonResponse({ approaches: [] });
|
|
628
|
+
if (url.includes('/api/taskforce/specialists'))
|
|
629
|
+
return jsonResponse({ specialists: [] });
|
|
630
|
+
if (url.includes('/api/taskforce/tasks'))
|
|
631
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
632
|
+
if (url.includes('/api/taskforce/archive'))
|
|
633
|
+
return jsonResponse({ archived: archivedChildren });
|
|
634
|
+
if (url.includes('/api/taskforce/data-version'))
|
|
635
|
+
return jsonResponse({ dataVersion: 1 });
|
|
636
|
+
return jsonResponse({});
|
|
637
|
+
}));
|
|
638
|
+
const { result } = renderHook(() => useTaskforce({ config: { cloudAuthBaseUrl: 'https://cloud.example.com' } }), { wrapper });
|
|
639
|
+
await waitFor(() => {
|
|
640
|
+
expect(result.current.archivedTasks.some((task) => task.id === 'task-archived-child-1')).toBe(true);
|
|
641
|
+
}, { timeout: 2500 });
|
|
642
|
+
act(() => {
|
|
643
|
+
result.current.handleOpenTaskById('task-archived-child-1');
|
|
644
|
+
});
|
|
645
|
+
await waitFor(() => {
|
|
646
|
+
expect(result.current.showArchive).toBe(true);
|
|
647
|
+
expect(result.current.editingTaskId).toBe('task-archived-child-1');
|
|
648
|
+
expect(result.current.currentTask?.isArchived).toBe(true);
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
it('hydrates merged human members and workspace ai assignees for a signed-in local workspace', async () => {
|
|
652
|
+
vi.stubGlobal('fetch', vi.fn((url) => {
|
|
653
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
654
|
+
return jsonResponse({
|
|
655
|
+
config: {
|
|
656
|
+
runtimeMode: 'local',
|
|
657
|
+
workspaceMode: 'single-local',
|
|
658
|
+
authSource: 'cloud',
|
|
659
|
+
workspaceSwitchingEnabled: false
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
if (url.includes('/api/taskforce/auth/session')) {
|
|
664
|
+
return jsonResponse({
|
|
665
|
+
authenticated: true,
|
|
666
|
+
authRequiredForApi: true,
|
|
667
|
+
betaAccess: true,
|
|
668
|
+
userId: 'user-1',
|
|
669
|
+
email: 'user@example.com',
|
|
670
|
+
workspaceId: 'workspace-cloud-1'
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
if (url.includes('/api/taskforce/ui-state?key=app')) {
|
|
674
|
+
return jsonResponse({ success: true, state: {} });
|
|
675
|
+
}
|
|
676
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
677
|
+
return jsonResponse({
|
|
678
|
+
success: true,
|
|
679
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
if (url.includes('/api/taskforce/config')) {
|
|
683
|
+
return jsonResponse({
|
|
684
|
+
projectName: 'Cloud Project',
|
|
685
|
+
workspaceId: 'workspace-cloud-1',
|
|
686
|
+
runtimeMode: 'cloud',
|
|
687
|
+
authRequiredForApi: true,
|
|
688
|
+
userId: 'user-1',
|
|
689
|
+
setupState: {
|
|
690
|
+
globalSetupState: 'complete',
|
|
691
|
+
workspaceSetupState: 'complete',
|
|
692
|
+
workspaceId: 'workspace-cloud-1'
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
if (url.includes('/api/taskforce/global-settings'))
|
|
697
|
+
return jsonResponse({});
|
|
698
|
+
if (url.includes('/api/taskforce/auth/workspace-members')) {
|
|
699
|
+
return jsonResponse({
|
|
700
|
+
users: [
|
|
701
|
+
{
|
|
702
|
+
userId: 'user-1',
|
|
703
|
+
email: 'user@example.com',
|
|
704
|
+
displayName: 'Signed In Owner',
|
|
705
|
+
role: 'owner',
|
|
706
|
+
status: 'active',
|
|
707
|
+
disabled: false
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
userId: 'member-1',
|
|
711
|
+
email: 'member1@example.com',
|
|
712
|
+
displayName: 'Member One',
|
|
713
|
+
status: 'active',
|
|
714
|
+
disabled: false
|
|
715
|
+
}
|
|
716
|
+
]
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
if (url.includes('/api/taskforce/categories'))
|
|
720
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
721
|
+
if (url.includes('/api/taskforce/types'))
|
|
722
|
+
return jsonResponse({ types: [] });
|
|
723
|
+
if (url.includes('/api/taskforce/priorities'))
|
|
724
|
+
return jsonResponse({ priorities: [] });
|
|
725
|
+
if (url.includes('/api/taskforce/approaches'))
|
|
726
|
+
return jsonResponse({ approaches: [] });
|
|
727
|
+
if (url.includes('/api/taskforce/specialists'))
|
|
728
|
+
return jsonResponse({ specialists: [] });
|
|
729
|
+
if (url.includes('/api/taskforce/tasks'))
|
|
730
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
731
|
+
if (url.includes('/api/taskforce/archive'))
|
|
732
|
+
return jsonResponse({ archived: [] });
|
|
733
|
+
if (url.includes('/api/taskforce/workspace/assignee-options')) {
|
|
734
|
+
return jsonResponse({
|
|
735
|
+
assignees: [
|
|
736
|
+
{ value: 'ai-profile-codex', label: 'Codex', icon: 'Bot', color: '#0ea5e9', kind: 'agent' }
|
|
737
|
+
]
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
if (url.includes('/api/taskforce/data-version'))
|
|
741
|
+
return jsonResponse({ dataVersion: 1 });
|
|
742
|
+
return jsonResponse({});
|
|
743
|
+
}));
|
|
744
|
+
const { result } = renderHook(() => useTaskforce({ config: { cloudAuthBaseUrl: 'https://cloud.example.com' } }), { wrapper });
|
|
745
|
+
await waitFor(() => {
|
|
746
|
+
expect(result.current.assigneeOptions.some((option) => option.value === 'member-1' && option.label === 'Member One')).toBe(true);
|
|
747
|
+
expect(result.current.assigneeOptions.some((option) => option.value === 'ai-profile-codex' && option.label === 'Codex')).toBe(true);
|
|
748
|
+
expect(result.current.currentWorkspaceRole).toBe('owner');
|
|
749
|
+
});
|
|
750
|
+
});
|
|
751
|
+
it('keeps human assignees unavailable while signed out locally but still loads ai assignees', async () => {
|
|
752
|
+
vi.stubGlobal('fetch', vi.fn((url) => {
|
|
753
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
754
|
+
return jsonResponse({
|
|
755
|
+
config: {
|
|
756
|
+
runtimeMode: 'local',
|
|
757
|
+
workspaceMode: 'single-local',
|
|
758
|
+
authSource: 'cloud',
|
|
759
|
+
workspaceSwitchingEnabled: false
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
if (url.includes('/api/taskforce/auth/session')) {
|
|
764
|
+
return jsonResponse({
|
|
765
|
+
authenticated: false,
|
|
766
|
+
authRequiredForApi: true,
|
|
767
|
+
betaAccess: false,
|
|
768
|
+
userId: 'anonymous',
|
|
769
|
+
email: '',
|
|
770
|
+
workspaceId: 'workspace-cloud-1'
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
if (url.includes('/api/taskforce/ui-state?key=app'))
|
|
774
|
+
return jsonResponse({ success: true, state: {} });
|
|
775
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
776
|
+
return jsonResponse({
|
|
777
|
+
success: true,
|
|
778
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
if (url.includes('/api/taskforce/config')) {
|
|
782
|
+
return jsonResponse({
|
|
783
|
+
projectName: 'Local Project',
|
|
784
|
+
workspaceId: 'workspace-cloud-1',
|
|
785
|
+
runtimeMode: 'local',
|
|
786
|
+
authRequiredForApi: true,
|
|
787
|
+
setupState: {
|
|
788
|
+
globalSetupState: 'complete',
|
|
789
|
+
workspaceSetupState: 'complete',
|
|
790
|
+
workspaceId: 'workspace-cloud-1'
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
if (url.includes('/api/taskforce/global-settings'))
|
|
795
|
+
return jsonResponse({});
|
|
796
|
+
if (url.includes('/api/taskforce/categories'))
|
|
797
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
798
|
+
if (url.includes('/api/taskforce/types'))
|
|
799
|
+
return jsonResponse({ types: [] });
|
|
800
|
+
if (url.includes('/api/taskforce/priorities'))
|
|
801
|
+
return jsonResponse({ priorities: [] });
|
|
802
|
+
if (url.includes('/api/taskforce/approaches'))
|
|
803
|
+
return jsonResponse({ approaches: [] });
|
|
804
|
+
if (url.includes('/api/taskforce/specialists'))
|
|
805
|
+
return jsonResponse({ specialists: [] });
|
|
806
|
+
if (url.includes('/api/taskforce/tasks'))
|
|
807
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
808
|
+
if (url.includes('/api/taskforce/archive'))
|
|
809
|
+
return jsonResponse({ archived: [] });
|
|
810
|
+
if (url.includes('/api/taskforce/workspace/assignee-options')) {
|
|
811
|
+
return jsonResponse({
|
|
812
|
+
assignees: [
|
|
813
|
+
{ value: 'ai-profile-codex', label: 'Codex', icon: 'Bot', color: '#0ea5e9', kind: 'agent' }
|
|
814
|
+
]
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
if (url.includes('/api/taskforce/data-version'))
|
|
818
|
+
return jsonResponse({ dataVersion: 1 });
|
|
819
|
+
return jsonResponse({});
|
|
820
|
+
}));
|
|
821
|
+
const { result } = renderHook(() => useTaskforce({ config: { cloudAuthBaseUrl: 'https://cloud.example.com' } }), { wrapper });
|
|
822
|
+
await waitFor(() => {
|
|
823
|
+
expect(result.current.assigneeOptions.some((option) => option.value === 'ai-profile-codex' && option.label === 'Codex')).toBe(true);
|
|
824
|
+
expect(result.current.assigneeOptions.some((option) => option.kind === 'member')).toBe(false);
|
|
825
|
+
expect(result.current.currentWorkspaceRole).toBeNull();
|
|
826
|
+
});
|
|
827
|
+
});
|
|
828
|
+
it('keeps fallback human assignees when workspace-members only returns the signed-in user', async () => {
|
|
829
|
+
vi.stubGlobal('fetch', vi.fn((url) => {
|
|
830
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
831
|
+
return jsonResponse({
|
|
832
|
+
config: {
|
|
833
|
+
runtimeMode: 'cloud',
|
|
834
|
+
workspaceMode: 'multi-cloud',
|
|
835
|
+
authSource: 'cloud',
|
|
836
|
+
workspaceSwitchingEnabled: true
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
if (url.includes('/api/taskforce/auth/session')) {
|
|
841
|
+
return jsonResponse({
|
|
842
|
+
authenticated: true,
|
|
843
|
+
authRequiredForApi: true,
|
|
844
|
+
betaAccess: true,
|
|
845
|
+
userId: 'member-self',
|
|
846
|
+
email: 'self@example.com',
|
|
847
|
+
workspaceId: 'workspace-cloud-1'
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
if (url.includes('/api/taskforce/ui-state?key=app'))
|
|
851
|
+
return jsonResponse({ success: true, state: {} });
|
|
852
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
853
|
+
return jsonResponse({
|
|
854
|
+
success: true,
|
|
855
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
if (url.includes('/api/taskforce/config')) {
|
|
859
|
+
return jsonResponse({
|
|
860
|
+
projectName: 'Cloud Project',
|
|
861
|
+
workspaceId: 'workspace-cloud-1',
|
|
862
|
+
runtimeMode: 'cloud',
|
|
863
|
+
authRequiredForApi: true,
|
|
864
|
+
userId: 'member-self',
|
|
865
|
+
setupState: {
|
|
866
|
+
globalSetupState: 'complete',
|
|
867
|
+
workspaceSetupState: 'complete',
|
|
868
|
+
workspaceId: 'workspace-cloud-1'
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
if (url.includes('/api/taskforce/global-settings'))
|
|
873
|
+
return jsonResponse({});
|
|
874
|
+
if (url.includes('/api/taskforce/auth/workspace-members')) {
|
|
875
|
+
return jsonResponse({
|
|
876
|
+
users: [
|
|
877
|
+
{
|
|
878
|
+
userId: 'member-self',
|
|
879
|
+
email: 'self@example.com',
|
|
880
|
+
displayName: 'Self User',
|
|
881
|
+
status: 'active',
|
|
882
|
+
disabled: false
|
|
883
|
+
}
|
|
884
|
+
]
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
if (url.includes('/api/taskforce/categories'))
|
|
888
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
889
|
+
if (url.includes('/api/taskforce/types'))
|
|
890
|
+
return jsonResponse({ types: [] });
|
|
891
|
+
if (url.includes('/api/taskforce/priorities'))
|
|
892
|
+
return jsonResponse({ priorities: [] });
|
|
893
|
+
if (url.includes('/api/taskforce/approaches'))
|
|
894
|
+
return jsonResponse({ approaches: [] });
|
|
895
|
+
if (url.includes('/api/taskforce/specialists'))
|
|
896
|
+
return jsonResponse({ specialists: [] });
|
|
897
|
+
if (url.includes('/api/taskforce/tasks'))
|
|
898
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
899
|
+
if (url.includes('/api/taskforce/archive'))
|
|
900
|
+
return jsonResponse({ archived: [] });
|
|
901
|
+
if (url.includes('/api/taskforce/workspace/assignee-options')) {
|
|
902
|
+
return jsonResponse({
|
|
903
|
+
assignees: [
|
|
904
|
+
{ userId: 'member-self', email: 'self@example.com', displayName: 'Self User', status: 'active', disabled: false },
|
|
905
|
+
{ userId: 'member-2', email: 'member2@example.com', displayName: 'Member Two', status: 'active', disabled: false },
|
|
906
|
+
{ value: 'ai-profile-codex', label: 'Codex', icon: 'Bot', color: '#0ea5e9', kind: 'agent' }
|
|
907
|
+
]
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
if (url.includes('/api/taskforce/data-version'))
|
|
911
|
+
return jsonResponse({ dataVersion: 1 });
|
|
912
|
+
return jsonResponse({});
|
|
913
|
+
}));
|
|
914
|
+
const { result } = renderHook(() => useTaskforce({ config: { cloudAuthBaseUrl: 'https://cloud.example.com' } }), { wrapper });
|
|
915
|
+
await waitFor(() => {
|
|
916
|
+
expect(result.current.assigneeOptions.some((option) => option.value === 'member-self' && option.label === 'Self User')).toBe(true);
|
|
917
|
+
expect(result.current.assigneeOptions.some((option) => option.value === 'member-2' && option.label === 'Member Two')).toBe(true);
|
|
918
|
+
expect(result.current.assigneeOptions.some((option) => option.value === 'ai-profile-codex' && option.label === 'Codex')).toBe(true);
|
|
919
|
+
});
|
|
920
|
+
});
|
|
921
|
+
it('enables cloud realtime refresh for authenticated sessions and refreshes open task comments from signals', async () => {
|
|
922
|
+
vi.stubGlobal('WebSocket', MockWebSocket);
|
|
923
|
+
let invalidationTaskFetchCount = 0;
|
|
924
|
+
const fetchMock = vi.fn((url) => {
|
|
925
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
926
|
+
return jsonResponse({
|
|
927
|
+
config: {
|
|
928
|
+
runtimeMode: 'cloud',
|
|
929
|
+
workspaceMode: 'multi-cloud',
|
|
930
|
+
authSource: 'cloud',
|
|
931
|
+
workspaceSwitchingEnabled: true,
|
|
932
|
+
wsBaseUrl: 'https://cloud.example.com'
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
if (url.includes('/api/taskforce/auth/session')) {
|
|
937
|
+
return jsonResponse({
|
|
938
|
+
authenticated: true,
|
|
939
|
+
authRequiredForApi: true,
|
|
940
|
+
betaAccess: true,
|
|
941
|
+
userId: 'user-1',
|
|
942
|
+
email: 'user@example.com',
|
|
943
|
+
workspaceId: 'workspace-cloud-1'
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
if (url.includes('/api/taskforce/ui-state?key=app')) {
|
|
947
|
+
return jsonResponse({ success: true, state: {} });
|
|
948
|
+
}
|
|
949
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
950
|
+
return jsonResponse({
|
|
951
|
+
success: true,
|
|
952
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
if (url.includes('/api/taskforce/config')) {
|
|
956
|
+
return jsonResponse({
|
|
957
|
+
projectName: 'Cloud Project',
|
|
958
|
+
workspaceId: 'workspace-cloud-1',
|
|
959
|
+
runtimeMode: 'cloud',
|
|
960
|
+
authRequiredForApi: true,
|
|
961
|
+
userId: 'user-1',
|
|
962
|
+
setupState: {
|
|
963
|
+
globalSetupState: 'complete',
|
|
964
|
+
workspaceSetupState: 'complete',
|
|
965
|
+
workspaceId: 'workspace-cloud-1'
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
if (url.includes('/api/taskforce/global-settings'))
|
|
970
|
+
return jsonResponse({});
|
|
971
|
+
if (url.includes('/api/taskforce/categories'))
|
|
972
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
973
|
+
if (url.includes('/api/taskforce/types'))
|
|
974
|
+
return jsonResponse({ types: [] });
|
|
975
|
+
if (url.includes('/api/taskforce/priorities'))
|
|
976
|
+
return jsonResponse({ priorities: [] });
|
|
977
|
+
if (url.includes('/api/taskforce/approaches'))
|
|
978
|
+
return jsonResponse({ approaches: [] });
|
|
979
|
+
if (url.includes('/api/taskforce/specialists'))
|
|
980
|
+
return jsonResponse({ specialists: [] });
|
|
981
|
+
if (url.includes('/api/taskforce/tasks')) {
|
|
982
|
+
const serveUpdatedTask = invalidationTaskFetchCount >= 2;
|
|
983
|
+
if (invalidationTaskFetchCount > 0) {
|
|
984
|
+
invalidationTaskFetchCount += 1;
|
|
985
|
+
}
|
|
986
|
+
const updatedAt = serveUpdatedTask ? '2026-03-16T10:05:00.000Z' : '2026-03-16T10:00:00.000Z';
|
|
987
|
+
const comments = serveUpdatedTask
|
|
988
|
+
? [{ id: 'comment-2', author: 'user', text: 'Fresh synced comment', timestamp: '2026-03-16T10:05:00.000Z' }]
|
|
989
|
+
: [{ id: 'comment-1', author: 'user', text: 'Initial comment', timestamp: '2026-03-16T10:00:00.000Z' }];
|
|
990
|
+
return jsonResponse({
|
|
991
|
+
tasks: [{
|
|
992
|
+
...activeTask,
|
|
993
|
+
updatedAt,
|
|
994
|
+
comments
|
|
995
|
+
}]
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
if (url.includes('/api/taskforce/archive'))
|
|
999
|
+
return jsonResponse({ archived: [] });
|
|
1000
|
+
if (url.includes('/api/taskforce/data-version'))
|
|
1001
|
+
return jsonResponse({ dataVersion: 1 });
|
|
1002
|
+
return jsonResponse({});
|
|
1003
|
+
});
|
|
1004
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
1005
|
+
const { result } = renderHook(() => useTaskforce({ config: { cloudAuthBaseUrl: 'https://cloud.example.com' } }), { wrapper });
|
|
1006
|
+
await waitFor(() => {
|
|
1007
|
+
expect(result.current.tasks).toHaveLength(1);
|
|
1008
|
+
});
|
|
1009
|
+
await waitFor(() => {
|
|
1010
|
+
expect(result.current.authSessionResolved).toBe(true);
|
|
1011
|
+
expect(result.current.isAuthenticated).toBe(true);
|
|
1012
|
+
expect(result.current.currentWorkspaceId).toBe('workspace-cloud-1');
|
|
1013
|
+
expect(MockWebSocket.instances).toHaveLength(1);
|
|
1014
|
+
});
|
|
1015
|
+
const socket = MockWebSocket.instances[0];
|
|
1016
|
+
act(() => {
|
|
1017
|
+
socket.open();
|
|
1018
|
+
result.current.handleEdit(result.current.tasks[0]);
|
|
1019
|
+
});
|
|
1020
|
+
await waitFor(() => {
|
|
1021
|
+
expect(result.current.comments).toEqual([
|
|
1022
|
+
{ id: 'comment-1', author: 'user', text: 'Initial comment', timestamp: '2026-03-16T10:00:00.000Z' }
|
|
1023
|
+
]);
|
|
1024
|
+
});
|
|
1025
|
+
act(() => {
|
|
1026
|
+
result.current.setNewCommentText('Unsaved draft');
|
|
1027
|
+
invalidationTaskFetchCount = 1;
|
|
1028
|
+
socket.message({ type: 'taskforce:update', workspaceId: 'workspace-cloud-1' });
|
|
1029
|
+
});
|
|
1030
|
+
await waitFor(() => {
|
|
1031
|
+
expect(result.current.comments).toEqual([
|
|
1032
|
+
{ id: 'comment-1', author: 'user', text: 'Initial comment', timestamp: '2026-03-16T10:00:00.000Z' }
|
|
1033
|
+
]);
|
|
1034
|
+
});
|
|
1035
|
+
await act(async () => {
|
|
1036
|
+
await new Promise((resolve) => setTimeout(resolve, 350));
|
|
1037
|
+
});
|
|
1038
|
+
await waitFor(() => {
|
|
1039
|
+
expect(result.current.comments).toEqual([
|
|
1040
|
+
{ id: 'comment-2', author: 'user', text: 'Fresh synced comment', timestamp: '2026-03-16T10:05:00.000Z' }
|
|
1041
|
+
]);
|
|
1042
|
+
expect(result.current.currentTask?.updatedAt).toBe('2026-03-16T10:05:00.000Z');
|
|
1043
|
+
expect(result.current.newCommentText).toBe('Unsaved draft');
|
|
1044
|
+
});
|
|
1045
|
+
const taskFetches = fetchMock.mock.calls.filter(([url]) => String(url).includes('/api/taskforce/tasks'));
|
|
1046
|
+
expect(taskFetches.length).toBeGreaterThanOrEqual(3);
|
|
1047
|
+
});
|
|
1048
|
+
it('does not start cloud realtime before auth session resolves with a real user id', async () => {
|
|
1049
|
+
vi.stubGlobal('WebSocket', MockWebSocket);
|
|
1050
|
+
vi.stubGlobal('fetch', vi.fn((url) => {
|
|
1051
|
+
if (url.includes('/api/taskforce/auth/runtime-config')) {
|
|
1052
|
+
return jsonResponse({
|
|
1053
|
+
config: {
|
|
1054
|
+
runtimeMode: 'cloud',
|
|
1055
|
+
workspaceMode: 'multi-cloud',
|
|
1056
|
+
authSource: 'cloud',
|
|
1057
|
+
workspaceSwitchingEnabled: true,
|
|
1058
|
+
wsBaseUrl: 'https://cloud.example.com'
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
if (url.includes('/api/taskforce/auth/session')) {
|
|
1063
|
+
return jsonResponse({
|
|
1064
|
+
authenticated: false,
|
|
1065
|
+
authRequiredForApi: true,
|
|
1066
|
+
betaAccess: true,
|
|
1067
|
+
userId: 'anonymous',
|
|
1068
|
+
email: '',
|
|
1069
|
+
workspaceId: 'workspace-cloud-1'
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
if (url.includes('/api/taskforce/ui-state?key=app'))
|
|
1073
|
+
return jsonResponse({ success: true, state: {} });
|
|
1074
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
1075
|
+
return jsonResponse({
|
|
1076
|
+
success: true,
|
|
1077
|
+
state: { version: 2, enabled: false, phase: 'idle', pullCursor: null }
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
if (url.includes('/api/taskforce/config')) {
|
|
1081
|
+
return jsonResponse({
|
|
1082
|
+
projectName: 'Cloud Project',
|
|
1083
|
+
workspaceId: 'workspace-cloud-1',
|
|
1084
|
+
runtimeMode: 'cloud',
|
|
1085
|
+
authRequiredForApi: true,
|
|
1086
|
+
realtimeSyncEnabled: true,
|
|
1087
|
+
userId: 'anonymous',
|
|
1088
|
+
setupState: {
|
|
1089
|
+
globalSetupState: 'complete',
|
|
1090
|
+
workspaceSetupState: 'complete',
|
|
1091
|
+
workspaceId: 'workspace-cloud-1'
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
if (url.includes('/api/taskforce/global-settings'))
|
|
1096
|
+
return jsonResponse({});
|
|
1097
|
+
if (url.includes('/api/taskforce/categories'))
|
|
1098
|
+
return jsonResponse({ categories: [{ value: 'general', label: 'General' }] });
|
|
1099
|
+
if (url.includes('/api/taskforce/types'))
|
|
1100
|
+
return jsonResponse({ types: [] });
|
|
1101
|
+
if (url.includes('/api/taskforce/priorities'))
|
|
1102
|
+
return jsonResponse({ priorities: [] });
|
|
1103
|
+
if (url.includes('/api/taskforce/approaches'))
|
|
1104
|
+
return jsonResponse({ approaches: [] });
|
|
1105
|
+
if (url.includes('/api/taskforce/specialists'))
|
|
1106
|
+
return jsonResponse({ specialists: [] });
|
|
1107
|
+
if (url.includes('/api/taskforce/tasks'))
|
|
1108
|
+
return jsonResponse({ tasks: [activeTask] });
|
|
1109
|
+
if (url.includes('/api/taskforce/archive'))
|
|
1110
|
+
return jsonResponse({ archived: [] });
|
|
1111
|
+
if (url.includes('/api/taskforce/data-version'))
|
|
1112
|
+
return jsonResponse({ dataVersion: 1 });
|
|
1113
|
+
return jsonResponse({});
|
|
1114
|
+
}));
|
|
1115
|
+
renderHook(() => useTaskforce({ config: { cloudAuthBaseUrl: 'https://cloud.example.com' } }), { wrapper });
|
|
1116
|
+
await waitFor(() => {
|
|
1117
|
+
expect(MockWebSocket.instances).toHaveLength(0);
|
|
1118
|
+
});
|
|
1119
|
+
});
|
|
1120
|
+
});
|