@taskforcehq/taskforce 0.3.169 → 0.3.300
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 +52 -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 +2212 -1194
- 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 +66 -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 +46 -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 +239 -0
- package/dist/hooks/useTaskData.test.d.ts +1 -0
- package/dist/hooks/useTaskData.test.js +119 -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 +3293 -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-TVmCgizS.js +1 -0
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-BaS2VwIr.css +1 -0
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-CAyhnPeR.js +3 -0
- package/dist/ui/assets/DocumentWorkspace-BOCw5e4D.js +250 -0
- package/dist/ui/assets/DocumentWorkspace-C_8T8oz-.css +1 -0
- package/dist/ui/assets/InitiativesModule-CN0r02Oi.js +1 -0
- package/dist/ui/assets/PlansPage-BlVC_lRq.css +1 -0
- package/dist/ui/assets/PlansPage-FcQSNLZd.js +1 -0
- package/dist/ui/assets/TaskSettings-BwB9NtmJ.css +1 -0
- package/dist/ui/assets/TaskSettings-Cw5zYD1L.js +8 -0
- package/dist/ui/assets/WorkflowsModule-CY9R2zPB.js +5 -0
- package/dist/ui/assets/index-Bzqy5QGm.js +6 -0
- package/dist/ui/assets/index-DxRiI3tY.css +1 -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 +28 -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/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 +20 -3
- 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,449 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import Database from 'better-sqlite3';
|
|
5
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
6
|
+
import { TaskforceCore } from './Taskforce';
|
|
7
|
+
function createProjectRoot(prefix = 'taskforce-ai-profiles-') {
|
|
8
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
|
|
9
|
+
fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({ name: 'ai-profiles-test' }), 'utf-8');
|
|
10
|
+
return root;
|
|
11
|
+
}
|
|
12
|
+
const createdRoots = [];
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
while (createdRoots.length > 0) {
|
|
15
|
+
const root = createdRoots.pop();
|
|
16
|
+
if (root && fs.existsSync(root)) {
|
|
17
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
describe('TaskforceCore ai profiles', () => {
|
|
22
|
+
it('creates workspace-scoped ai profiles and resolves them into task actor surfaces', () => {
|
|
23
|
+
const projectRoot = createProjectRoot();
|
|
24
|
+
createdRoots.push(projectRoot);
|
|
25
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
26
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
27
|
+
const resolved = core.resolveAiProfile({
|
|
28
|
+
workspaceId: 'workspace-1',
|
|
29
|
+
name: 'Codex',
|
|
30
|
+
icon: 'Bot',
|
|
31
|
+
color: '#ef6c00'
|
|
32
|
+
});
|
|
33
|
+
expect(resolved.created).toBe(true);
|
|
34
|
+
const actors = core.listAssignableActors('workspace-1');
|
|
35
|
+
expect(actors.some((actor) => actor.id === resolved.profile.id && actor.label === 'Codex' && actor.kind === 'ai')).toBe(true);
|
|
36
|
+
const task = core.createTask({
|
|
37
|
+
title: 'Assigned to named AI',
|
|
38
|
+
assignee: resolved.profile.id,
|
|
39
|
+
createdBy: resolved.profile.id,
|
|
40
|
+
comments: [
|
|
41
|
+
{
|
|
42
|
+
id: 'comment-1',
|
|
43
|
+
author: resolved.profile.id,
|
|
44
|
+
text: 'Hello from Codex',
|
|
45
|
+
timestamp: '2026-03-22T10:00:00.000Z'
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}, { workspaceId: 'workspace-1' });
|
|
49
|
+
const fetched = core.getTask(task.id, 'workspace-1');
|
|
50
|
+
expect(fetched?.assignee).toBe(resolved.profile.id);
|
|
51
|
+
expect(fetched?.assigneeActor?.label).toBe('Codex');
|
|
52
|
+
expect(fetched?.createdByActor?.label).toBe('Codex');
|
|
53
|
+
expect(fetched?.comments?.[0]?.actor?.label).toBe('Codex');
|
|
54
|
+
});
|
|
55
|
+
it('updates existing ai profile presentation fields when profileToken is presented again', () => {
|
|
56
|
+
const projectRoot = createProjectRoot();
|
|
57
|
+
createdRoots.push(projectRoot);
|
|
58
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
59
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
60
|
+
const first = core.resolveAiProfile({
|
|
61
|
+
workspaceId: 'workspace-1',
|
|
62
|
+
name: 'Claude',
|
|
63
|
+
color: '#f59e0b'
|
|
64
|
+
});
|
|
65
|
+
const second = core.resolveAiProfile({
|
|
66
|
+
workspaceId: 'workspace-1',
|
|
67
|
+
name: 'Claude 2',
|
|
68
|
+
icon: 'Sparkles',
|
|
69
|
+
color: '#0ea5e9',
|
|
70
|
+
profileToken: first.profile.profileToken
|
|
71
|
+
});
|
|
72
|
+
expect(second.created).toBe(false);
|
|
73
|
+
expect(second.profile.id).toBe(first.profile.id);
|
|
74
|
+
expect(second.profile.name).toBe('Claude 2');
|
|
75
|
+
expect(second.profile.username).toBe('claude-2');
|
|
76
|
+
expect(second.profile.icon).toBe('Sparkles');
|
|
77
|
+
expect(second.profile.color).toBe('#0ea5e9');
|
|
78
|
+
});
|
|
79
|
+
it('stores expanded ai profile fields and preserves them when omitted on re-resolve', () => {
|
|
80
|
+
const projectRoot = createProjectRoot();
|
|
81
|
+
createdRoots.push(projectRoot);
|
|
82
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
83
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
84
|
+
const first = core.resolveAiProfile({
|
|
85
|
+
workspaceId: 'workspace-1',
|
|
86
|
+
name: 'Codex',
|
|
87
|
+
description: 'Builds and repairs product code',
|
|
88
|
+
role: 'Implementer',
|
|
89
|
+
provider: 'OpenAI',
|
|
90
|
+
model: 'gpt-5.4',
|
|
91
|
+
surfaceType: 'coding_tool'
|
|
92
|
+
});
|
|
93
|
+
const second = core.resolveAiProfile({
|
|
94
|
+
workspaceId: 'workspace-1',
|
|
95
|
+
name: 'Codex',
|
|
96
|
+
color: '#0ea5e9',
|
|
97
|
+
profileToken: first.profile.profileToken
|
|
98
|
+
});
|
|
99
|
+
expect(second.profile.description).toBe('Builds and repairs product code');
|
|
100
|
+
expect(second.profile.role).toBe('Implementer');
|
|
101
|
+
expect(second.profile.provider).toBe('OpenAI');
|
|
102
|
+
expect(second.profile.model).toBe('gpt-5.4');
|
|
103
|
+
expect(second.profile.surfaceType).toBe('coding_tool');
|
|
104
|
+
expect(second.profile.color).toBe('#0ea5e9');
|
|
105
|
+
});
|
|
106
|
+
it('ignores empty-string optional ai profile updates instead of clearing stored values', () => {
|
|
107
|
+
const projectRoot = createProjectRoot();
|
|
108
|
+
createdRoots.push(projectRoot);
|
|
109
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
110
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
111
|
+
const first = core.resolveAiProfile({
|
|
112
|
+
workspaceId: 'workspace-1',
|
|
113
|
+
name: 'Reviewer',
|
|
114
|
+
description: 'Reviews implementation plans',
|
|
115
|
+
role: 'Reviewer',
|
|
116
|
+
provider: 'Anthropic',
|
|
117
|
+
model: 'claude-sonnet'
|
|
118
|
+
});
|
|
119
|
+
const second = core.resolveAiProfile({
|
|
120
|
+
workspaceId: 'workspace-1',
|
|
121
|
+
name: 'Reviewer',
|
|
122
|
+
description: ' ',
|
|
123
|
+
role: '',
|
|
124
|
+
provider: ' ',
|
|
125
|
+
model: '',
|
|
126
|
+
profileToken: first.profile.profileToken
|
|
127
|
+
});
|
|
128
|
+
expect(second.profile.description).toBe('Reviews implementation plans');
|
|
129
|
+
expect(second.profile.role).toBe('Reviewer');
|
|
130
|
+
expect(second.profile.provider).toBe('Anthropic');
|
|
131
|
+
expect(second.profile.model).toBe('claude-sonnet');
|
|
132
|
+
});
|
|
133
|
+
it('clears ai profile surfaceType when re-resolved with null or an empty string', () => {
|
|
134
|
+
const projectRoot = createProjectRoot();
|
|
135
|
+
createdRoots.push(projectRoot);
|
|
136
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
137
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
138
|
+
const first = core.resolveAiProfile({
|
|
139
|
+
workspaceId: 'workspace-1',
|
|
140
|
+
name: 'ChatGPT',
|
|
141
|
+
surfaceType: 'chat_app'
|
|
142
|
+
});
|
|
143
|
+
const clearedWithNull = core.resolveAiProfile({
|
|
144
|
+
workspaceId: 'workspace-1',
|
|
145
|
+
name: 'ChatGPT',
|
|
146
|
+
surfaceType: null,
|
|
147
|
+
profileToken: first.profile.profileToken
|
|
148
|
+
});
|
|
149
|
+
expect(clearedWithNull.profile.surfaceType).toBeNull();
|
|
150
|
+
const reset = core.resolveAiProfile({
|
|
151
|
+
workspaceId: 'workspace-1',
|
|
152
|
+
name: 'ChatGPT',
|
|
153
|
+
surfaceType: 'chat_app',
|
|
154
|
+
profileToken: first.profile.profileToken
|
|
155
|
+
});
|
|
156
|
+
expect(reset.profile.surfaceType).toBe('chat_app');
|
|
157
|
+
const clearedWithEmptyString = core.resolveAiProfile({
|
|
158
|
+
workspaceId: 'workspace-1',
|
|
159
|
+
name: 'ChatGPT',
|
|
160
|
+
surfaceType: '',
|
|
161
|
+
profileToken: first.profile.profileToken
|
|
162
|
+
});
|
|
163
|
+
expect(clearedWithEmptyString.profile.surfaceType).toBeNull();
|
|
164
|
+
});
|
|
165
|
+
it('preserves ai profile surfaceType when re-resolved without the field', () => {
|
|
166
|
+
const projectRoot = createProjectRoot();
|
|
167
|
+
createdRoots.push(projectRoot);
|
|
168
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
169
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
170
|
+
const first = core.resolveAiProfile({
|
|
171
|
+
workspaceId: 'workspace-1',
|
|
172
|
+
name: 'Codex',
|
|
173
|
+
surfaceType: 'coding_tool'
|
|
174
|
+
});
|
|
175
|
+
const second = core.resolveAiProfile({
|
|
176
|
+
workspaceId: 'workspace-1',
|
|
177
|
+
name: 'Codex',
|
|
178
|
+
profileToken: first.profile.profileToken
|
|
179
|
+
});
|
|
180
|
+
expect(second.profile.surfaceType).toBe('coding_tool');
|
|
181
|
+
});
|
|
182
|
+
it('rejects invalid ai profile surfaceType values', () => {
|
|
183
|
+
const projectRoot = createProjectRoot();
|
|
184
|
+
createdRoots.push(projectRoot);
|
|
185
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
186
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
187
|
+
expect(() => core.resolveAiProfile({
|
|
188
|
+
workspaceId: 'workspace-1',
|
|
189
|
+
name: 'Codex',
|
|
190
|
+
surfaceType: 'desktop_app'
|
|
191
|
+
})).toThrow(/surfaceType/i);
|
|
192
|
+
});
|
|
193
|
+
it('repairs legacy ai_profiles tables that are missing newer columns', () => {
|
|
194
|
+
const projectRoot = createProjectRoot();
|
|
195
|
+
createdRoots.push(projectRoot);
|
|
196
|
+
const storageDir = path.join(projectRoot, '.taskforce');
|
|
197
|
+
fs.mkdirSync(storageDir, { recursive: true });
|
|
198
|
+
const dbPath = path.join(storageDir, 'taskforce.db');
|
|
199
|
+
const db = new Database(dbPath);
|
|
200
|
+
db.exec(`
|
|
201
|
+
CREATE TABLE ai_profiles (
|
|
202
|
+
id TEXT PRIMARY KEY,
|
|
203
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
204
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
205
|
+
profile_token TEXT NOT NULL,
|
|
206
|
+
name TEXT NOT NULL,
|
|
207
|
+
username TEXT NOT NULL,
|
|
208
|
+
icon TEXT NOT NULL,
|
|
209
|
+
color TEXT NOT NULL,
|
|
210
|
+
created_at TEXT NOT NULL,
|
|
211
|
+
updated_at TEXT NOT NULL
|
|
212
|
+
);
|
|
213
|
+
`);
|
|
214
|
+
db.prepare(`
|
|
215
|
+
INSERT INTO ai_profiles (
|
|
216
|
+
id, tenant_id, workspace_id, profile_token, name, username, icon, color, created_at, updated_at
|
|
217
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
218
|
+
`).run('ai-profile-legacy-codex', 'default', 'workspace-1', 'tfp_legacy_codex', 'Codex', 'codex', 'Bot', '#0ea5e9', '2026-03-22T10:00:00.000Z', '2026-03-22T10:05:00.000Z');
|
|
219
|
+
db.close();
|
|
220
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
221
|
+
const profiles = core.listAiProfiles('workspace-1');
|
|
222
|
+
expect(profiles).toEqual([
|
|
223
|
+
expect.objectContaining({
|
|
224
|
+
id: 'ai-profile-legacy-codex',
|
|
225
|
+
name: 'Codex',
|
|
226
|
+
username: 'codex',
|
|
227
|
+
description: null,
|
|
228
|
+
role: null,
|
|
229
|
+
provider: null,
|
|
230
|
+
model: null,
|
|
231
|
+
surfaceType: null,
|
|
232
|
+
lastActiveAt: null
|
|
233
|
+
})
|
|
234
|
+
]);
|
|
235
|
+
});
|
|
236
|
+
it('orders ai profiles case-insensitively without sqlite-specific collation syntax', () => {
|
|
237
|
+
const projectRoot = createProjectRoot();
|
|
238
|
+
createdRoots.push(projectRoot);
|
|
239
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
240
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
241
|
+
const sameTimestamp = '2026-03-22T12:00:00.000Z';
|
|
242
|
+
const db = core.db;
|
|
243
|
+
db.prepare(`
|
|
244
|
+
INSERT INTO ai_profiles (
|
|
245
|
+
id, tenant_id, workspace_id, profile_token, name, username, icon, color,
|
|
246
|
+
provider_metadata_json, created_at, updated_at, last_active_at
|
|
247
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
248
|
+
`).run('ai-profile-zebra', 'default', 'workspace-1', 'tfp_zebra', 'zebra', 'zebra', 'Bot', '#111111', null, sameTimestamp, sameTimestamp, null);
|
|
249
|
+
db.prepare(`
|
|
250
|
+
INSERT INTO ai_profiles (
|
|
251
|
+
id, tenant_id, workspace_id, profile_token, name, username, icon, color,
|
|
252
|
+
provider_metadata_json, created_at, updated_at, last_active_at
|
|
253
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
254
|
+
`).run('ai-profile-alpha', 'default', 'workspace-1', 'tfp_alpha', 'Alpha', 'alpha', 'Bot', '#222222', null, sameTimestamp, sameTimestamp, null);
|
|
255
|
+
db.prepare(`
|
|
256
|
+
INSERT INTO ai_profiles (
|
|
257
|
+
id, tenant_id, workspace_id, profile_token, name, username, icon, color,
|
|
258
|
+
provider_metadata_json, created_at, updated_at, last_active_at
|
|
259
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
260
|
+
`).run('ai-profile-bravo', 'default', 'workspace-1', 'tfp_bravo', 'bravo', 'bravo', 'Bot', '#333333', null, sameTimestamp, sameTimestamp, null);
|
|
261
|
+
expect(core.listAiProfiles('workspace-1').map((profile) => profile.name)).toEqual([
|
|
262
|
+
'Alpha',
|
|
263
|
+
'bravo',
|
|
264
|
+
'zebra'
|
|
265
|
+
]);
|
|
266
|
+
});
|
|
267
|
+
it('uses a postgres-safe ordering expression for ai profiles', () => {
|
|
268
|
+
const projectRoot = createProjectRoot();
|
|
269
|
+
createdRoots.push(projectRoot);
|
|
270
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
271
|
+
let capturedSql = '';
|
|
272
|
+
core.db = {
|
|
273
|
+
provider: 'postgres',
|
|
274
|
+
prepare(sql) {
|
|
275
|
+
capturedSql = sql;
|
|
276
|
+
return {
|
|
277
|
+
all() {
|
|
278
|
+
return [];
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
expect(core.listAiProfiles('workspace-1')).toEqual([]);
|
|
284
|
+
expect(capturedSql).toContain('LOWER(name) ASC');
|
|
285
|
+
expect(capturedSql).not.toContain('COLLATE NOCASE');
|
|
286
|
+
});
|
|
287
|
+
it('resolves actor by display name when comment author is a name rather than profile ID', () => {
|
|
288
|
+
const projectRoot = createProjectRoot();
|
|
289
|
+
createdRoots.push(projectRoot);
|
|
290
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
291
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
292
|
+
const { profile } = core.resolveAiProfile({
|
|
293
|
+
workspaceId: 'workspace-1',
|
|
294
|
+
name: 'Claude',
|
|
295
|
+
color: '#f59e0b'
|
|
296
|
+
});
|
|
297
|
+
// Resolve by name (e.g. agent passed "Claude" as author instead of profile ID)
|
|
298
|
+
const actorByName = core.resolveWorkspaceActor('workspace-1', 'Claude');
|
|
299
|
+
expect(actorByName).not.toBeNull();
|
|
300
|
+
expect(actorByName?.id).toBe(profile.id);
|
|
301
|
+
expect(actorByName?.kind).toBe('ai');
|
|
302
|
+
expect(actorByName?.label).toBe('Claude');
|
|
303
|
+
// Case-insensitive
|
|
304
|
+
const actorLower = core.resolveWorkspaceActor('workspace-1', 'claude');
|
|
305
|
+
expect(actorLower?.id).toBe(profile.id);
|
|
306
|
+
});
|
|
307
|
+
it('classifies well-known AI model names as ai-kind even without a registered profile', () => {
|
|
308
|
+
const projectRoot = createProjectRoot();
|
|
309
|
+
createdRoots.push(projectRoot);
|
|
310
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
311
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
312
|
+
// No profile registered, but name is a known AI model
|
|
313
|
+
const actor = core.resolveWorkspaceActor('workspace-1', 'chatgpt');
|
|
314
|
+
expect(actor?.kind).toBe('ai');
|
|
315
|
+
const actorCodex = core.resolveWorkspaceActor('workspace-1', 'codex');
|
|
316
|
+
expect(actorCodex?.kind).toBe('ai');
|
|
317
|
+
// Unknown string should default to human
|
|
318
|
+
const actorUnknown = core.resolveWorkspaceActor('workspace-1', 'randomstring123');
|
|
319
|
+
expect(actorUnknown?.kind).toBe('human');
|
|
320
|
+
});
|
|
321
|
+
it('reuses the existing profile when re-registering the same AI by exact name', () => {
|
|
322
|
+
const projectRoot = createProjectRoot();
|
|
323
|
+
createdRoots.push(projectRoot);
|
|
324
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
325
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
326
|
+
const first = core.resolveAiProfile({ workspaceId: 'workspace-1', name: 'Antigravity' });
|
|
327
|
+
expect(first.created).toBe(true);
|
|
328
|
+
expect(first.duplicateWarning).toBeUndefined();
|
|
329
|
+
// Second creation without a token should reuse instead of minting a duplicate.
|
|
330
|
+
const second = core.resolveAiProfile({ workspaceId: 'workspace-1', name: 'Antigravity' });
|
|
331
|
+
expect(second.created).toBe(false);
|
|
332
|
+
expect(second.profile.id).toBe(first.profile.id);
|
|
333
|
+
expect(core.listAiProfiles('workspace-1')).toHaveLength(1);
|
|
334
|
+
});
|
|
335
|
+
it('reuses Codex by exact name without leaking across workspaces', () => {
|
|
336
|
+
const projectRoot = createProjectRoot();
|
|
337
|
+
createdRoots.push(projectRoot);
|
|
338
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
339
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
340
|
+
core.createWorkspace({ workspaceId: 'workspace-2', name: 'Workspace 2' });
|
|
341
|
+
const first = core.resolveAiProfile({ workspaceId: 'workspace-1', name: 'Codex' });
|
|
342
|
+
const second = core.resolveAiProfile({ workspaceId: 'workspace-1', name: 'Codex' });
|
|
343
|
+
const otherWorkspace = core.resolveAiProfile({ workspaceId: 'workspace-2', name: 'Codex' });
|
|
344
|
+
expect(first.created).toBe(true);
|
|
345
|
+
expect(second.created).toBe(false);
|
|
346
|
+
expect(second.profile.id).toBe(first.profile.id);
|
|
347
|
+
expect(otherWorkspace.created).toBe(true);
|
|
348
|
+
expect(otherWorkspace.profile.id).not.toBe(first.profile.id);
|
|
349
|
+
expect(core.listAiProfiles('workspace-1')).toHaveLength(1);
|
|
350
|
+
expect(core.listAiProfiles('workspace-2')).toHaveLength(1);
|
|
351
|
+
});
|
|
352
|
+
it('merges two duplicate profiles, reassigning task assignees and comment authors', () => {
|
|
353
|
+
const projectRoot = createProjectRoot();
|
|
354
|
+
createdRoots.push(projectRoot);
|
|
355
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
356
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
357
|
+
const first = core.resolveAiProfile({ workspaceId: 'workspace-1', name: 'Antigravity' });
|
|
358
|
+
const second = core.resolveAiProfile({ workspaceId: 'workspace-1', name: 'Antigravity Clone' });
|
|
359
|
+
// Create a task assigned to the duplicate and a comment authored by it
|
|
360
|
+
const task = core.createTask({
|
|
361
|
+
title: 'Task with duplicate assignee',
|
|
362
|
+
assignee: second.profile.id,
|
|
363
|
+
comments: [{
|
|
364
|
+
id: 'c1',
|
|
365
|
+
author: second.profile.id,
|
|
366
|
+
text: 'Comment from duplicate',
|
|
367
|
+
timestamp: '2026-03-22T10:00:00.000Z'
|
|
368
|
+
}]
|
|
369
|
+
}, { workspaceId: 'workspace-1' });
|
|
370
|
+
// Merge the duplicate into the original
|
|
371
|
+
const merged = core.mergeAiProfiles({
|
|
372
|
+
workspaceId: 'workspace-1',
|
|
373
|
+
keepId: first.profile.id,
|
|
374
|
+
mergeId: second.profile.id
|
|
375
|
+
});
|
|
376
|
+
expect(merged.id).toBe(first.profile.id);
|
|
377
|
+
// Duplicate profile should be gone
|
|
378
|
+
const profiles = core.listAiProfiles('workspace-1');
|
|
379
|
+
expect(profiles.some((p) => p.id === second.profile.id)).toBe(false);
|
|
380
|
+
expect(profiles.some((p) => p.id === first.profile.id)).toBe(true);
|
|
381
|
+
// Task assignee should point to the kept profile
|
|
382
|
+
const updatedTask = core.getTask(task.id, 'workspace-1');
|
|
383
|
+
expect(updatedTask?.assignee).toBe(first.profile.id);
|
|
384
|
+
// Comment author should point to the kept profile
|
|
385
|
+
expect(updatedTask?.comments?.[0]?.author).toBe(first.profile.id);
|
|
386
|
+
});
|
|
387
|
+
it('canonicalizes AI names to profile ids when creating tasks and comments', () => {
|
|
388
|
+
const projectRoot = createProjectRoot();
|
|
389
|
+
createdRoots.push(projectRoot);
|
|
390
|
+
const core = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
391
|
+
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
392
|
+
const resolved = core.resolveAiProfile({ workspaceId: 'workspace-1', name: 'ChatGPT', color: '#10a37f' });
|
|
393
|
+
const task = core.createTask({
|
|
394
|
+
title: 'Canonicalize actor refs',
|
|
395
|
+
createdBy: 'chatgpt',
|
|
396
|
+
assignee: 'ChatGPT',
|
|
397
|
+
comments: [{
|
|
398
|
+
id: 'c1',
|
|
399
|
+
author: 'chatgpt',
|
|
400
|
+
text: 'Stored as canonical profile id',
|
|
401
|
+
timestamp: '2026-03-22T10:00:00.000Z'
|
|
402
|
+
}]
|
|
403
|
+
}, { workspaceId: 'workspace-1' });
|
|
404
|
+
const fetched = core.getTask(task.id, 'workspace-1');
|
|
405
|
+
expect(fetched?.createdBy).toBe(resolved.profile.id);
|
|
406
|
+
expect(fetched?.assignee).toBe(resolved.profile.id);
|
|
407
|
+
expect(fetched?.comments?.[0]?.author).toBe(resolved.profile.id);
|
|
408
|
+
expect(fetched?.comments?.[0]?.submittedAuthor).toBe('chatgpt');
|
|
409
|
+
expect(fetched?.assigneeActor?.label).toBe('ChatGPT');
|
|
410
|
+
expect(fetched?.comments?.[0]?.actor?.label).toBe('ChatGPT');
|
|
411
|
+
});
|
|
412
|
+
it('repairs legacy actor refs and merges duplicate ai profiles on startup', () => {
|
|
413
|
+
const projectRoot = createProjectRoot();
|
|
414
|
+
createdRoots.push(projectRoot);
|
|
415
|
+
const firstCore = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
416
|
+
firstCore.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
417
|
+
const firstDb = firstCore.db;
|
|
418
|
+
const first = firstCore.resolveAiProfile({ workspaceId: 'workspace-1', name: 'Antigravity' });
|
|
419
|
+
const second = firstCore.resolveAiProfile({ workspaceId: 'workspace-1', name: 'Antigravity Clone' });
|
|
420
|
+
firstDb.prepare(`UPDATE ai_profiles SET name = 'Antigravity', username = 'antigravity' WHERE tenant_id = ? AND id = ?`)
|
|
421
|
+
.run('default', second.profile.id);
|
|
422
|
+
firstDb.prepare(`DELETE FROM system_settings WHERE tenant_id = ? AND settings_key IN (?, ?)`)
|
|
423
|
+
.run('default', 'migration.ai_profiles.dedupe.v1', 'migration.actor_refs.canonicalize.v1');
|
|
424
|
+
const task = firstCore.createTask({
|
|
425
|
+
title: 'Legacy actor refs',
|
|
426
|
+
createdBy: 'claude',
|
|
427
|
+
assignee: 'antigravity',
|
|
428
|
+
comments: [
|
|
429
|
+
{
|
|
430
|
+
id: 'legacy-comment',
|
|
431
|
+
author: 'claude',
|
|
432
|
+
text: 'Legacy claude alias',
|
|
433
|
+
timestamp: '2026-03-22T10:00:00.000Z'
|
|
434
|
+
}
|
|
435
|
+
]
|
|
436
|
+
}, { workspaceId: 'workspace-1' });
|
|
437
|
+
const claude = firstCore.resolveAiProfile({ workspaceId: 'workspace-1', name: 'Claude' });
|
|
438
|
+
expect(task.comments?.[0]?.author).toBe('claude');
|
|
439
|
+
const reloadedCore = new TaskforceCore({ projectRoot, storagePath: '.taskforce' });
|
|
440
|
+
const reloaded = reloadedCore.getTask(task.id, 'workspace-1');
|
|
441
|
+
const profiles = reloadedCore.listAiProfiles('workspace-1');
|
|
442
|
+
expect(profiles.map((profile) => profile.name)).toEqual(['Claude', 'Antigravity']);
|
|
443
|
+
const survivingAntigravityId = profiles.find((profile) => profile.name === 'Antigravity')?.id;
|
|
444
|
+
expect(reloaded?.createdBy).toBe(claude.profile.id);
|
|
445
|
+
expect(reloaded?.assignee).toBe(survivingAntigravityId);
|
|
446
|
+
expect(reloaded?.comments?.[0]?.author).toBe(claude.profile.id);
|
|
447
|
+
expect(reloaded?.comments?.[0]?.actor?.label).toBe('Claude');
|
|
448
|
+
});
|
|
449
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DatabaseAdapter } from '../storage/databaseAdapter.js';
|
|
2
|
+
export type AttachmentLinkInput = string | {
|
|
3
|
+
path: string;
|
|
4
|
+
fsPath?: string;
|
|
5
|
+
caption?: string;
|
|
6
|
+
displayName?: string;
|
|
7
|
+
originalFilename?: string;
|
|
8
|
+
timestamp?: string;
|
|
9
|
+
};
|
|
10
|
+
export interface AttachmentLinkServiceDeps {
|
|
11
|
+
db: DatabaseAdapter;
|
|
12
|
+
tenantId: string;
|
|
13
|
+
normalizeWorkspaceId: (workspaceId: string) => string;
|
|
14
|
+
}
|
|
15
|
+
export declare function syncCanonicalTaskAttachmentLinksService(deps: AttachmentLinkServiceDeps, taskId: string, workspaceId: string, attachments: AttachmentLinkInput[]): void;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { createHash } from 'crypto';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
function buildAttachmentDisplayName(attachment, fallbackNameRaw) {
|
|
4
|
+
const caption = typeof attachment === 'string' ? '' : String(attachment.caption || '').trim();
|
|
5
|
+
if (caption)
|
|
6
|
+
return caption;
|
|
7
|
+
const displayName = typeof attachment === 'string' ? '' : String(attachment.displayName || '').trim();
|
|
8
|
+
if (displayName)
|
|
9
|
+
return displayName;
|
|
10
|
+
const originalFilename = typeof attachment === 'string' ? '' : String(attachment.originalFilename || '').trim();
|
|
11
|
+
if (originalFilename)
|
|
12
|
+
return originalFilename;
|
|
13
|
+
const fallbackName = String(fallbackNameRaw || '').trim();
|
|
14
|
+
if (fallbackName)
|
|
15
|
+
return fallbackName;
|
|
16
|
+
const pathValue = typeof attachment === 'string'
|
|
17
|
+
? attachment
|
|
18
|
+
: String(attachment.fsPath || attachment.path || '').trim();
|
|
19
|
+
const withoutQuery = pathValue.split('?')[0].split('#')[0];
|
|
20
|
+
return withoutQuery.split(/[\\/]/).pop() || 'Context file';
|
|
21
|
+
}
|
|
22
|
+
function normalizeAttachmentStorageKey(pathValue, fsPathValue) {
|
|
23
|
+
const fsPathRaw = String(fsPathValue || '').trim().replace(/\\/g, '/');
|
|
24
|
+
if (fsPathRaw) {
|
|
25
|
+
return fsPathRaw.replace(/^\.taskforce\//, '').trim() || null;
|
|
26
|
+
}
|
|
27
|
+
const routePathRaw = String(pathValue || '').trim();
|
|
28
|
+
if (/^https?:\/\//i.test(routePathRaw)) {
|
|
29
|
+
return routePathRaw;
|
|
30
|
+
}
|
|
31
|
+
if (routePathRaw.startsWith('/api/taskforce/context/')) {
|
|
32
|
+
return decodeURIComponent(routePathRaw.slice('/api/taskforce/context/'.length));
|
|
33
|
+
}
|
|
34
|
+
if (routePathRaw.startsWith('/api/taskforce/context-link?path=')) {
|
|
35
|
+
try {
|
|
36
|
+
const parsed = new URL(routePathRaw, 'http://localhost');
|
|
37
|
+
const linkedPath = String(parsed.searchParams.get('path') || '').trim();
|
|
38
|
+
return linkedPath ? linkedPath.replace(/\\/g, '/') : null;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
function ensureExternalReferenceAsset(deps, storageKeyRaw, workspaceId, attachment) {
|
|
47
|
+
const storageKey = String(storageKeyRaw || '').trim();
|
|
48
|
+
const normalizedWorkspaceId = deps.normalizeWorkspaceId(workspaceId);
|
|
49
|
+
const timestamp = typeof attachment === 'string'
|
|
50
|
+
? new Date().toISOString()
|
|
51
|
+
: String(attachment.timestamp || '').trim() || new Date().toISOString();
|
|
52
|
+
const urlHash = createHash('sha256').update(storageKey).digest('hex');
|
|
53
|
+
const assetId = `asset-${urlHash.slice(0, 32)}`;
|
|
54
|
+
let fallbackName = 'External Link';
|
|
55
|
+
let mimeType = 'text/uri-list';
|
|
56
|
+
try {
|
|
57
|
+
const parsed = new URL(storageKey);
|
|
58
|
+
const lastSegment = parsed.pathname.split('/').filter(Boolean).pop() || '';
|
|
59
|
+
fallbackName = lastSegment || parsed.hostname || fallbackName;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
const normalizedPath = storageKey.replace(/\\/g, '/');
|
|
63
|
+
const lastSegment = normalizedPath.split('/').filter(Boolean).pop() || '';
|
|
64
|
+
fallbackName = lastSegment || fallbackName;
|
|
65
|
+
mimeType = 'application/octet-stream';
|
|
66
|
+
}
|
|
67
|
+
const logicalName = buildAttachmentDisplayName(attachment, fallbackName);
|
|
68
|
+
deps.db.prepare(`
|
|
69
|
+
INSERT INTO workspace_assets (
|
|
70
|
+
asset_id,
|
|
71
|
+
tenant_id,
|
|
72
|
+
workspace_id,
|
|
73
|
+
kind,
|
|
74
|
+
logical_name,
|
|
75
|
+
original_filename,
|
|
76
|
+
mime_type,
|
|
77
|
+
storage_provider,
|
|
78
|
+
storage_key,
|
|
79
|
+
content_sha256,
|
|
80
|
+
size_bytes,
|
|
81
|
+
document_id,
|
|
82
|
+
version,
|
|
83
|
+
is_latest,
|
|
84
|
+
scan_status,
|
|
85
|
+
scan_engine,
|
|
86
|
+
scan_details,
|
|
87
|
+
created_by_user_id,
|
|
88
|
+
created_at,
|
|
89
|
+
updated_at,
|
|
90
|
+
deleted_at,
|
|
91
|
+
purge_after
|
|
92
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL)
|
|
93
|
+
ON CONFLICT(asset_id) DO UPDATE SET
|
|
94
|
+
logical_name = excluded.logical_name,
|
|
95
|
+
original_filename = excluded.original_filename,
|
|
96
|
+
mime_type = excluded.mime_type,
|
|
97
|
+
storage_provider = excluded.storage_provider,
|
|
98
|
+
storage_key = excluded.storage_key,
|
|
99
|
+
content_sha256 = excluded.content_sha256,
|
|
100
|
+
size_bytes = excluded.size_bytes,
|
|
101
|
+
updated_at = excluded.updated_at,
|
|
102
|
+
deleted_at = NULL,
|
|
103
|
+
purge_after = NULL
|
|
104
|
+
`).run(assetId, deps.tenantId, normalizedWorkspaceId, 'file', logicalName, logicalName, mimeType, 'external', storageKey, urlHash, Buffer.byteLength(storageKey, 'utf8'), null, null, 1, 'clean', null, null, null, timestamp, timestamp);
|
|
105
|
+
return assetId;
|
|
106
|
+
}
|
|
107
|
+
export function syncCanonicalTaskAttachmentLinksService(deps, taskId, workspaceId, attachments) {
|
|
108
|
+
const normalizedTaskId = String(taskId || '').trim();
|
|
109
|
+
const normalizedWorkspaceId = deps.normalizeWorkspaceId(workspaceId);
|
|
110
|
+
if (!normalizedTaskId)
|
|
111
|
+
return;
|
|
112
|
+
deps.db.prepare(`
|
|
113
|
+
UPDATE workspace_asset_links
|
|
114
|
+
SET deleted_at = ?, updated_at = ?
|
|
115
|
+
WHERE tenant_id = ? AND workspace_id = ? AND task_id = ? AND deleted_at IS NULL
|
|
116
|
+
`).run(new Date().toISOString(), new Date().toISOString(), deps.tenantId, normalizedWorkspaceId, normalizedTaskId);
|
|
117
|
+
const selectAsset = deps.db.prepare(`
|
|
118
|
+
SELECT asset_id, kind
|
|
119
|
+
FROM workspace_assets
|
|
120
|
+
WHERE tenant_id = ? AND workspace_id = ? AND storage_key = ? AND deleted_at IS NULL
|
|
121
|
+
LIMIT 1
|
|
122
|
+
`);
|
|
123
|
+
const upsertLink = deps.db.prepare(`
|
|
124
|
+
INSERT INTO workspace_asset_links (
|
|
125
|
+
tenant_id, workspace_id, asset_id, task_id, role, display_name, sort_order, created_at, updated_at, deleted_at
|
|
126
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL)
|
|
127
|
+
ON CONFLICT (tenant_id, workspace_id, asset_id, task_id, role) DO UPDATE SET
|
|
128
|
+
display_name = excluded.display_name,
|
|
129
|
+
sort_order = excluded.sort_order,
|
|
130
|
+
updated_at = excluded.updated_at,
|
|
131
|
+
deleted_at = NULL
|
|
132
|
+
`);
|
|
133
|
+
attachments.forEach((attachment, index) => {
|
|
134
|
+
const storageKey = normalizeAttachmentStorageKey(typeof attachment === 'string' ? attachment : attachment.path, typeof attachment === 'string' ? null : attachment.fsPath);
|
|
135
|
+
if (!storageKey)
|
|
136
|
+
return;
|
|
137
|
+
const row = selectAsset.get(deps.tenantId, normalizedWorkspaceId, storageKey);
|
|
138
|
+
const assetId = String(row?.asset_id || '').trim()
|
|
139
|
+
|| ((/^https?:\/\//i.test(storageKey) || (typeof attachment !== 'string' && typeof attachment.fsPath === 'string' && attachment.fsPath.trim().length > 0))
|
|
140
|
+
? ensureExternalReferenceAsset(deps, storageKey, normalizedWorkspaceId, attachment)
|
|
141
|
+
: '');
|
|
142
|
+
if (!assetId)
|
|
143
|
+
return;
|
|
144
|
+
const role = /^https?:\/\//i.test(storageKey)
|
|
145
|
+
? 'reference'
|
|
146
|
+
: String(row?.kind || '').trim() === 'image'
|
|
147
|
+
? 'image'
|
|
148
|
+
: 'attachment';
|
|
149
|
+
const displayName = String(row?.kind || '').trim() === 'document'
|
|
150
|
+
? null
|
|
151
|
+
: (typeof attachment === 'string'
|
|
152
|
+
? null
|
|
153
|
+
: buildAttachmentDisplayName(attachment, /^https?:\/\//i.test(storageKey) ? null : path.basename(storageKey)));
|
|
154
|
+
const timestamp = typeof attachment === 'string' ? new Date().toISOString() : (attachment.timestamp || new Date().toISOString());
|
|
155
|
+
upsertLink.run(deps.tenantId, normalizedWorkspaceId, assetId, normalizedTaskId, role, displayName, index, timestamp, timestamp);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DatabaseAdapter } from '../storage/databaseAdapter.js';
|
|
2
|
+
import type { AuthTokenPurpose, AuthTokenInspection } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Handles one-time auth token lifecycle (email verification, password reset, invite acceptance)
|
|
5
|
+
* and the thin read/write helpers for email-verification and password state.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AuthTokenService {
|
|
8
|
+
private readonly db;
|
|
9
|
+
private readonly tenantId;
|
|
10
|
+
constructor(db: DatabaseAdapter, tenantId: string);
|
|
11
|
+
private generateEntityId;
|
|
12
|
+
createOneTimeAuthToken(userId: string, purpose: AuthTokenPurpose, ttlSeconds: number, workspaceId?: string | null): string;
|
|
13
|
+
consumeOneTimeAuthToken(token: string, purpose: AuthTokenPurpose): {
|
|
14
|
+
userId: string;
|
|
15
|
+
workspaceId?: string;
|
|
16
|
+
} | null;
|
|
17
|
+
inspectOneTimeAuthToken(token: string, purpose: AuthTokenPurpose): AuthTokenInspection;
|
|
18
|
+
isEmailVerified(email: string): boolean;
|
|
19
|
+
markEmailVerified(email: string): boolean;
|
|
20
|
+
requestEmailVerification(input: {
|
|
21
|
+
email: string;
|
|
22
|
+
ttlSeconds?: number;
|
|
23
|
+
}): {
|
|
24
|
+
token?: string;
|
|
25
|
+
};
|
|
26
|
+
verifyEmailWithToken(token: string): boolean;
|
|
27
|
+
requestPasswordReset(input: {
|
|
28
|
+
email: string;
|
|
29
|
+
ttlSeconds?: number;
|
|
30
|
+
}): {
|
|
31
|
+
token?: string;
|
|
32
|
+
};
|
|
33
|
+
requestInviteAcceptance(input: {
|
|
34
|
+
userId: string;
|
|
35
|
+
workspaceId: string;
|
|
36
|
+
ttlSeconds?: number;
|
|
37
|
+
}): {
|
|
38
|
+
token?: string;
|
|
39
|
+
};
|
|
40
|
+
resetPasswordWithToken(input: {
|
|
41
|
+
token: string;
|
|
42
|
+
password: string;
|
|
43
|
+
}): boolean;
|
|
44
|
+
}
|