@taskforcehq/taskforce 0.3.168
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 +241 -0
- package/dist/Taskforce.d.ts +3 -0
- package/dist/Taskforce.js +3 -0
- package/dist/Taskforce.module.css +7587 -0
- package/dist/TaskforceCore.CategoryFallback.test.d.ts +1 -0
- package/dist/TaskforceCore.CategoryFallback.test.js +98 -0
- package/dist/TaskforceCore.d.ts +12 -0
- package/dist/TaskforceCore.js +729 -0
- package/dist/TaskforceCore.test.d.ts +1 -0
- package/dist/TaskforceCore.test.js +2132 -0
- package/dist/TaskforceScreenshot.d.ts +11 -0
- package/dist/TaskforceScreenshot.js +113 -0
- package/dist/TaskforceWidget.d.ts +6 -0
- package/dist/TaskforceWidget.js +101 -0
- package/dist/TaskforceWidget.test.d.ts +1 -0
- package/dist/TaskforceWidget.test.js +92 -0
- package/dist/UnsavedChangesRelaxed.test.d.ts +1 -0
- package/dist/UnsavedChangesRelaxed.test.js +16 -0
- package/dist/__tests__/localizationCatalogs.test.d.ts +1 -0
- package/dist/__tests__/localizationCatalogs.test.js +37 -0
- package/dist/__tests__/planParser.test.d.ts +1 -0
- package/dist/__tests__/planParser.test.js +183 -0
- package/dist/__tests__/releaseVersion.test.d.ts +1 -0
- package/dist/__tests__/releaseVersion.test.js +32 -0
- package/dist/__tests__/structuredCommentValidation.test.d.ts +1 -0
- package/dist/__tests__/structuredCommentValidation.test.js +31 -0
- package/dist/__tests__/structuredDocValidation.test.d.ts +1 -0
- package/dist/__tests__/structuredDocValidation.test.js +30 -0
- package/dist/__tests__/templateEngine.test.d.ts +1 -0
- package/dist/__tests__/templateEngine.test.js +150 -0
- package/dist/__tests__/templates.test.d.ts +1 -0
- package/dist/__tests__/templates.test.js +45 -0
- package/dist/__tests__/workflowDocumentFixtures.test.d.ts +1 -0
- package/dist/__tests__/workflowDocumentFixtures.test.js +78 -0
- package/dist/__tests__/workflowExportMatrix.test.d.ts +1 -0
- package/dist/__tests__/workflowExportMatrix.test.js +113 -0
- package/dist/__tests__/workflowExportSnapshots.test.d.ts +1 -0
- package/dist/__tests__/workflowExportSnapshots.test.js +28 -0
- package/dist/__tests__/workflowGeneration.test.d.ts +1 -0
- package/dist/__tests__/workflowGeneration.test.js +12 -0
- package/dist/__tests__/workflowSimulation.test.d.ts +1 -0
- package/dist/__tests__/workflowSimulation.test.js +113 -0
- package/dist/__tests__/workflowV2Policy.test.d.ts +1 -0
- package/dist/__tests__/workflowV2Policy.test.js +80 -0
- package/dist/api.d.ts +30 -0
- package/dist/api.js +85 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +217 -0
- package/dist/compat/priorityCompat.d.ts +2 -0
- package/dist/compat/priorityCompat.js +24 -0
- package/dist/components/features/DocumentGenerateModal.d.ts +9 -0
- package/dist/components/features/DocumentGenerateModal.js +114 -0
- package/dist/components/features/DocumentIndex.d.ts +19 -0
- package/dist/components/features/DocumentIndex.js +51 -0
- package/dist/components/features/DocumentViewer.d.ts +9 -0
- package/dist/components/features/DocumentViewer.js +253 -0
- package/dist/components/features/DocumentWorkspace.d.ts +21 -0
- package/dist/components/features/DocumentWorkspace.js +88 -0
- package/dist/components/features/TaskSettings.d.ts +209 -0
- package/dist/components/features/TaskSettings.js +500 -0
- package/dist/components/features/TaskSettings.test.d.ts +1 -0
- package/dist/components/features/TaskSettings.test.js +308 -0
- package/dist/components/features/settings/CategoryManager.d.ts +19 -0
- package/dist/components/features/settings/CategoryManager.js +113 -0
- package/dist/components/features/settings/TaxonomyEditor.d.ts +8 -0
- package/dist/components/features/settings/TaxonomyEditor.js +98 -0
- package/dist/components/features/settings/TaxonomyManager 2.d.ts +52 -0
- package/dist/components/features/settings/TaxonomyManager 2.js +75 -0
- package/dist/components/features/settings/TaxonomyManager.d.ts +54 -0
- package/dist/components/features/settings/TaxonomyManager.js +77 -0
- package/dist/components/features/settings/TypeManager.d.ts +10 -0
- package/dist/components/features/settings/TypeManager.js +50 -0
- package/dist/components/features/settings/WorkflowEditorPrototype.d.ts +15 -0
- package/dist/components/features/settings/WorkflowEditorPrototype.js +245 -0
- package/dist/components/task/TaskActionHeader.d.ts +20 -0
- package/dist/components/task/TaskActionHeader.js +13 -0
- package/dist/components/task/TaskCard.d.ts +47 -0
- package/dist/components/task/TaskCard.js +326 -0
- package/dist/components/task/TaskCard.test.d.ts +1 -0
- package/dist/components/task/TaskCard.test.js +95 -0
- package/dist/components/task/TaskContextUpload.d.ts +12 -0
- package/dist/components/task/TaskContextUpload.js +393 -0
- package/dist/components/task/TaskContextUpload.test.d.ts +1 -0
- package/dist/components/task/TaskContextUpload.test.js +189 -0
- package/dist/components/task/TaskForm.d.ts +105 -0
- package/dist/components/task/TaskForm.js +241 -0
- package/dist/components/task/TaskForm.test.d.ts +1 -0
- package/dist/components/task/TaskForm.test.js +288 -0
- package/dist/components/task/TaskKanban 2.d.ts +76 -0
- package/dist/components/task/TaskKanban 2.js +1004 -0
- package/dist/components/task/TaskKanban.d.ts +76 -0
- package/dist/components/task/TaskKanban.empty-column-drop.test.d.ts +1 -0
- package/dist/components/task/TaskKanban.empty-column-drop.test.js +66 -0
- package/dist/components/task/TaskKanban.js +1026 -0
- package/dist/components/task/TaskKanban.test.d.ts +1 -0
- package/dist/components/task/TaskKanban.test.js +46 -0
- package/dist/components/task/TaskList.d.ts +74 -0
- package/dist/components/task/TaskList.js +38 -0
- package/dist/components/task/TaskList.test.d.ts +1 -0
- package/dist/components/task/TaskList.test.js +270 -0
- package/dist/components/task/TaskScreenshotSection.d.ts +15 -0
- package/dist/components/task/TaskScreenshotSection.js +22 -0
- package/dist/components/ui/LevelSelector.d.ts +13 -0
- package/dist/components/ui/LevelSelector.js +25 -0
- package/dist/components/ui/LevelSelector.test.d.ts +1 -0
- package/dist/components/ui/LevelSelector.test.js +55 -0
- package/dist/components/ui/Markdown.d.ts +6 -0
- package/dist/components/ui/Markdown.js +94 -0
- package/dist/components/ui/Markdown.test.d.ts +1 -0
- package/dist/components/ui/Markdown.test.js +38 -0
- package/dist/components/ui/Modal.d.ts +16 -0
- package/dist/components/ui/Modal.js +49 -0
- package/dist/components/ui/MultiSelectFilter.d.ts +10 -0
- package/dist/components/ui/MultiSelectFilter.js +71 -0
- package/dist/components/ui/MultiSelectFilter.test.d.ts +1 -0
- package/dist/components/ui/MultiSelectFilter.test.js +74 -0
- package/dist/components/ui/TaxonomyDropdown.d.ts +17 -0
- package/dist/components/ui/TaxonomyDropdown.js +145 -0
- package/dist/components/ui/TaxonomyDropdown.test.d.ts +1 -0
- package/dist/components/ui/TaxonomyDropdown.test.js +130 -0
- package/dist/components/views/StandaloneLayout 2.d.ts +8 -0
- package/dist/components/views/StandaloneLayout 2.js +1660 -0
- package/dist/components/views/StandaloneLayout.d.ts +8 -0
- package/dist/components/views/StandaloneLayout.js +2117 -0
- package/dist/components/views/WidgetView.d.ts +8 -0
- package/dist/components/views/WidgetView.js +221 -0
- package/dist/config/envSchema.d.ts +28 -0
- package/dist/config/envSchema.js +374 -0
- package/dist/config/envSchema.test.d.ts +1 -0
- package/dist/config/envSchema.test.js +97 -0
- package/dist/config/surfaceBase.d.ts +2 -0
- package/dist/config/surfaceBase.js +8 -0
- package/dist/core/BulkUpdateFieldsPreview.test.d.ts +1 -0
- package/dist/core/BulkUpdateFieldsPreview.test.js +62 -0
- package/dist/core/CompletedAt.test.d.ts +1 -0
- package/dist/core/CompletedAt.test.js +44 -0
- package/dist/core/CreatedBy.test.d.ts +1 -0
- package/dist/core/CreatedBy.test.js +60 -0
- package/dist/core/EntitlementsPolicy.test.d.ts +1 -0
- package/dist/core/EntitlementsPolicy.test.js +145 -0
- package/dist/core/InitiativeTemplates.test.d.ts +1 -0
- package/dist/core/InitiativeTemplates.test.js +50 -0
- package/dist/core/ParentLifecycle.test.d.ts +1 -0
- package/dist/core/ParentLifecycle.test.js +98 -0
- package/dist/core/ScheduleFields.test.d.ts +1 -0
- package/dist/core/ScheduleFields.test.js +197 -0
- package/dist/core/SetupState.test.d.ts +1 -0
- package/dist/core/SetupState.test.js +113 -0
- package/dist/core/SystemAdmin.test.d.ts +1 -0
- package/dist/core/SystemAdmin.test.js +295 -0
- package/dist/core/TaskTaxonomyValidation.test.d.ts +1 -0
- package/dist/core/TaskTaxonomyValidation.test.js +64 -0
- package/dist/core/Taskforce.d.ts +1063 -0
- package/dist/core/Taskforce.ids.test.d.ts +1 -0
- package/dist/core/Taskforce.ids.test.js +168 -0
- package/dist/core/Taskforce.js +5981 -0
- package/dist/core/Taskforce.realtimeMutation.test.d.ts +1 -0
- package/dist/core/Taskforce.realtimeMutation.test.js +76 -0
- package/dist/core/WorkspaceDelete.test.d.ts +1 -0
- package/dist/core/WorkspaceDelete.test.js +140 -0
- package/dist/core/WorkspacePermissions.test.d.ts +1 -0
- package/dist/core/WorkspacePermissions.test.js +151 -0
- package/dist/core/WorkspacePlanMode.test.d.ts +1 -0
- package/dist/core/WorkspacePlanMode.test.js +104 -0
- package/dist/hooks/authGuardPolicy.d.ts +26 -0
- package/dist/hooks/authGuardPolicy.js +32 -0
- package/dist/hooks/authGuardPolicy.test.d.ts +1 -0
- package/dist/hooks/authGuardPolicy.test.js +76 -0
- package/dist/hooks/useDraggable.d.ts +12 -0
- package/dist/hooks/useDraggable.js +65 -0
- package/dist/hooks/useRealtimeSync.d.ts +24 -0
- package/dist/hooks/useRealtimeSync.js +275 -0
- package/dist/hooks/useRealtimeSync.test.d.ts +1 -0
- package/dist/hooks/useRealtimeSync.test.js +284 -0
- package/dist/hooks/useSyncOrchestrator.d.ts +164 -0
- package/dist/hooks/useSyncOrchestrator.js +1427 -0
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.d.ts +1 -0
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +367 -0
- package/dist/hooks/useTaskforce.d.ts +727 -0
- package/dist/hooks/useTaskforce.js +4396 -0
- package/dist/hooks/useTaskforce.priority-filters.test.d.ts +1 -0
- package/dist/hooks/useTaskforce.priority-filters.test.js +33 -0
- package/dist/hooks/useWorkspaceSyncController.d.ts +80 -0
- package/dist/hooks/useWorkspaceSyncController.js +598 -0
- package/dist/hooks/useWorkspaceSyncController.test.d.ts +1 -0
- package/dist/hooks/useWorkspaceSyncController.test.js +236 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +11 -0
- package/dist/localization/index.d.ts +8 -0
- package/dist/localization/index.js +81 -0
- package/dist/localization/locales/en-US.d.ts +151 -0
- package/dist/localization/locales/en-US.js +150 -0
- package/dist/localization/locales/es-419.d.ts +2 -0
- package/dist/localization/locales/es-419.js +150 -0
- package/dist/localization/locales/pt-BR.d.ts +2 -0
- package/dist/localization/locales/pt-BR.js +150 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +33 -0
- package/dist/mcp/optionResolution.d.ts +14 -0
- package/dist/mcp/optionResolution.js +126 -0
- package/dist/mcp/optionResolution.test.d.ts +1 -0
- package/dist/mcp/optionResolution.test.js +39 -0
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +1793 -0
- package/dist/mcp/structuredCommentValidation.d.ts +6 -0
- package/dist/mcp/structuredCommentValidation.js +56 -0
- package/dist/mcp/structuredDocValidation.d.ts +6 -0
- package/dist/mcp/structuredDocValidation.js +75 -0
- package/dist/migrations/billingSchemaParity.test.d.ts +1 -0
- package/dist/migrations/billingSchemaParity.test.js +46 -0
- package/dist/migrations/clientMigrations.d.ts +9 -0
- package/dist/migrations/clientMigrations.js +74 -0
- package/dist/migrations/flags.d.ts +6 -0
- package/dist/migrations/flags.js +8 -0
- package/dist/migrations/taskMigrations.d.ts +71 -0
- package/dist/migrations/taskMigrations.js +236 -0
- package/dist/migrations/taskMigrations.test.d.ts +1 -0
- package/dist/migrations/taskMigrations.test.js +34 -0
- package/dist/migrations/taskSchemaMigrations.d.ts +11 -0
- package/dist/migrations/taskSchemaMigrations.js +453 -0
- package/dist/plugins/index.d.ts +10 -0
- package/dist/plugins/index.js +10 -0
- package/dist/plugins/vite.d.ts +19 -0
- package/dist/plugins/vite.js +271 -0
- package/dist/public/android-chrome-192x192.png +0 -0
- package/dist/public/android-chrome-512x512.png +0 -0
- package/dist/public/apple-touch-icon.png +0 -0
- package/dist/public/favicon-16x16.png +0 -0
- package/dist/public/favicon-32x32.png +0 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/favicon.png +0 -0
- package/dist/public/site.webmanifest +1 -0
- package/dist/public/taskforce.png +0 -0
- package/dist/resources/templates/WORKFLOW_V2_POLICY.md +55 -0
- package/dist/resources/templates/environments/aider.yaml +14 -0
- package/dist/resources/templates/environments/antigravity.yaml +10 -0
- package/dist/resources/templates/environments/claude.yaml +10 -0
- package/dist/resources/templates/environments/cline.yaml +10 -0
- package/dist/resources/templates/environments/codex.yaml +13 -0
- package/dist/resources/templates/environments/copilot.yaml +10 -0
- package/dist/resources/templates/environments/cursor.yaml +9 -0
- package/dist/resources/templates/environments/gemini.yaml +9 -0
- package/dist/resources/templates/environments/windsurf.yaml +10 -0
- package/dist/resources/templates/workflow-sources/README.md +9 -0
- package/dist/resources/templates/workflow-sources/workflowDocs.mjs +520 -0
- package/dist/resources/templates/workflow-sources/workflowEditorOverrides.json +1 -0
- package/dist/resources/templates/workflows/collaborate.yaml +104 -0
- package/dist/resources/templates/workflows/do.yaml +82 -0
- package/dist/resources/templates/workflows/evaluate.yaml +111 -0
- package/dist/resources/templates/workflows/execute.yaml +142 -0
- package/dist/resources/templates/workflows/plan.yaml +112 -0
- package/dist/resources/templates/workflows/review.yaml +109 -0
- package/dist/runtime/capabilities.d.ts +8 -0
- package/dist/runtime/capabilities.js +16 -0
- package/dist/security/virusScan.d.ts +16 -0
- package/dist/security/virusScan.js +83 -0
- package/dist/server/auth.d.ts +51 -0
- package/dist/server/auth.js +266 -0
- package/dist/server/auth.test.d.ts +1 -0
- package/dist/server/auth.test.js +111 -0
- package/dist/server/buildInfo.d.ts +7 -0
- package/dist/server/buildInfo.js +100 -0
- package/dist/server/buildInfo.test.d.ts +1 -0
- package/dist/server/buildInfo.test.js +29 -0
- package/dist/server/cors.d.ts +7 -0
- package/dist/server/cors.js +76 -0
- package/dist/server/cors.test.d.ts +1 -0
- package/dist/server/cors.test.js +71 -0
- package/dist/server/email.d.ts +28 -0
- package/dist/server/email.js +138 -0
- package/dist/server/email.test.d.ts +1 -0
- package/dist/server/email.test.js +113 -0
- package/dist/server/index.cookieProxy.test.d.ts +1 -0
- package/dist/server/index.cookieProxy.test.js +19 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.js +757 -0
- package/dist/server/index.rateLimit.test.d.ts +1 -0
- package/dist/server/index.rateLimit.test.js +13 -0
- package/dist/server/index.test.d.ts +1 -0
- package/dist/server/index.test.js +19 -0
- package/dist/server/rateLimit.d.ts +29 -0
- package/dist/server/rateLimit.js +99 -0
- package/dist/server/rateLimit.test.d.ts +1 -0
- package/dist/server/rateLimit.test.js +107 -0
- package/dist/server/realtimeSync.auth.test.d.ts +1 -0
- package/dist/server/realtimeSync.auth.test.js +62 -0
- package/dist/server/realtimeSync.replay.test.d.ts +1 -0
- package/dist/server/realtimeSync.replay.test.js +192 -0
- package/dist/server/realtimeSync.workspaceIsolation.test.d.ts +1 -0
- package/dist/server/realtimeSync.workspaceIsolation.test.js +101 -0
- package/dist/server/realtimeSyncWs.d.ts +30 -0
- package/dist/server/realtimeSyncWs.js +257 -0
- package/dist/server/routes.billing.d.ts +15 -0
- package/dist/server/routes.billing.js +991 -0
- package/dist/server/routes.billing.test.d.ts +1 -0
- package/dist/server/routes.billing.test.js +387 -0
- package/dist/server/routes.d.ts +72 -0
- package/dist/server/routes.js +4820 -0
- package/dist/server/routes.sync.d.ts +17 -0
- package/dist/server/routes.sync.integration.test.d.ts +1 -0
- package/dist/server/routes.sync.integration.test.js +470 -0
- package/dist/server/routes.sync.js +1141 -0
- package/dist/server/routes.test.d.ts +1 -0
- package/dist/server/routes.test.js +4945 -0
- package/dist/server/runtimeMode.d.ts +4 -0
- package/dist/server/runtimeMode.js +25 -0
- package/dist/server/runtimeMode.test.d.ts +1 -0
- package/dist/server/runtimeMode.test.js +26 -0
- package/dist/server/securityHeaders.d.ts +3 -0
- package/dist/server/securityHeaders.js +25 -0
- package/dist/server/securityHeaders.test.d.ts +1 -0
- package/dist/server/securityHeaders.test.js +32 -0
- package/dist/server/smtpTransport.d.ts +21 -0
- package/dist/server/smtpTransport.js +11 -0
- package/dist/server/start.d.ts +1 -0
- package/dist/server/start.js +17 -0
- package/dist/services/formatTransformers.d.ts +29 -0
- package/dist/services/formatTransformers.js +56 -0
- package/dist/services/templateEngine.d.ts +46 -0
- package/dist/services/templateEngine.js +148 -0
- package/dist/shared/runtimeContract.d.ts +12 -0
- package/dist/shared/runtimeContract.js +23 -0
- package/dist/shared/runtimeContract.test.d.ts +1 -0
- package/dist/shared/runtimeContract.test.js +23 -0
- package/dist/soak/preflight.cli.d.ts +1 -0
- package/dist/soak/preflight.cli.js +28 -0
- package/dist/soak/preflight.d.ts +26 -0
- package/dist/soak/preflight.js +113 -0
- package/dist/soak/preflight.test.d.ts +1 -0
- package/dist/soak/preflight.test.js +39 -0
- package/dist/soak/syncSoakHarness.d.ts +6 -0
- package/dist/soak/syncSoakHarness.js +10 -0
- package/dist/storage/createDatabaseAdapter.d.ts +2 -0
- package/dist/storage/createDatabaseAdapter.js +9 -0
- package/dist/storage/databaseAdapter.d.ts +22 -0
- package/dist/storage/databaseAdapter.js +1 -0
- package/dist/storage/documentIntegrity.d.ts +28 -0
- package/dist/storage/documentIntegrity.js +103 -0
- package/dist/storage/documentPurge.d.ts +14 -0
- package/dist/storage/documentPurge.js +46 -0
- package/dist/storage/documentRegistry.d.ts +39 -0
- package/dist/storage/documentRegistry.js +115 -0
- package/dist/storage/integritySchedule.d.ts +17 -0
- package/dist/storage/integritySchedule.js +62 -0
- package/dist/storage/objectStorage.d.ts +20 -0
- package/dist/storage/objectStorage.js +15 -0
- package/dist/storage/objectStorageClient.d.ts +18 -0
- package/dist/storage/objectStorageClient.js +301 -0
- package/dist/storage/objectStorageConfig.d.ts +2 -0
- package/dist/storage/objectStorageConfig.js +45 -0
- package/dist/storage/postgresAdapter.d.ts +20 -0
- package/dist/storage/postgresAdapter.js +204 -0
- package/dist/storage/postgresWorker.d.ts +1 -0
- package/dist/storage/postgresWorker.js +110 -0
- package/dist/storage/providerConfig.d.ts +6 -0
- package/dist/storage/providerConfig.js +11 -0
- package/dist/storage/sqliteAdapter.d.ts +14 -0
- package/dist/storage/sqliteAdapter.js +28 -0
- package/dist/storage/taskAssetStore.d.ts +56 -0
- package/dist/storage/taskAssetStore.js +297 -0
- package/dist/sync/cloudSyncApi.d.ts +47 -0
- package/dist/sync/cloudSyncApi.js +138 -0
- package/dist/sync/cloudSyncApi.test.d.ts +1 -0
- package/dist/sync/cloudSyncApi.test.js +54 -0
- package/dist/sync/encryptionService.d.ts +11 -0
- package/dist/sync/encryptionService.js +61 -0
- package/dist/sync/encryptionService.test.d.ts +1 -0
- package/dist/sync/encryptionService.test.js +52 -0
- package/dist/sync/realtimeFeature.d.ts +6 -0
- package/dist/sync/realtimeFeature.js +20 -0
- package/dist/sync/realtimeFeature.test.d.ts +1 -0
- package/dist/sync/realtimeFeature.test.js +30 -0
- package/dist/sync/realtimeReconcile.d.ts +30 -0
- package/dist/sync/realtimeReconcile.js +90 -0
- package/dist/sync/realtimeReconcile.test.d.ts +1 -0
- package/dist/sync/realtimeReconcile.test.js +43 -0
- package/dist/sync/syncService.d.ts +96 -0
- package/dist/sync/syncService.js +423 -0
- package/dist/sync/syncService.test.d.ts +1 -0
- package/dist/sync/syncService.test.js +484 -0
- package/dist/sync/workspaceSyncModel.d.ts +61 -0
- package/dist/sync/workspaceSyncModel.js +136 -0
- package/dist/sync/workspaceSyncModel.test.d.ts +1 -0
- package/dist/sync/workspaceSyncModel.test.js +73 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.js +15 -0
- package/dist/types.d.ts +157 -0
- package/dist/types.js +41 -0
- package/dist/ui/assets/RussoOne-Regular-C3BxZIj7.ttf +0 -0
- package/dist/ui/assets/index-0W5vyCpn.css +1 -0
- package/dist/ui/assets/index-MCZuNNfn.js +23 -0
- package/dist/ui/assets/logo_white_01-0Vx-iIIv.png +0 -0
- package/dist/ui/assets/taskforce-BxLPokNB.png +0 -0
- package/dist/ui/assets/vendor-dnd-BI1K77C1.js +5 -0
- package/dist/ui/assets/vendor-icons-ZFG3SGwo.js +1 -0
- package/dist/ui/assets/vendor-markdown-CKYkQHfj.js +29 -0
- package/dist/ui/assets/vendor-react-DdIDsh7f.js +9 -0
- package/dist/ui/assets/vendor-router-BtiNU7Dl.js +3 -0
- package/dist/ui/branding/logos/logo_black_01.png +0 -0
- package/dist/ui/branding/logos/logo_black_02.png +0 -0
- package/dist/ui/branding/logos/logo_white_01.png +0 -0
- package/dist/ui/branding/logos/logo_white_02.png +0 -0
- package/dist/ui/favicon/android-chrome-192x192.png +0 -0
- package/dist/ui/favicon/android-chrome-512x512.png +0 -0
- package/dist/ui/favicon/apple-touch-icon.png +0 -0
- package/dist/ui/favicon/favicon-16x16.png +0 -0
- package/dist/ui/favicon/favicon-32x32.png +0 -0
- package/dist/ui/favicon/favicon.ico +0 -0
- package/dist/ui/favicon/favicon.png +0 -0
- package/dist/ui/favicon/site.webmanifest +1 -0
- package/dist/ui/fonts/RussoOne-Regular.ttf +0 -0
- package/dist/ui/images/taskforce.png +0 -0
- package/dist/ui/index.html +19 -0
- package/dist/utils/checklistMarkdown.d.ts +9 -0
- package/dist/utils/checklistMarkdown.js +46 -0
- package/dist/utils/constants.d.ts +21 -0
- package/dist/utils/constants.icons.test.d.ts +1 -0
- package/dist/utils/constants.icons.test.js +40 -0
- package/dist/utils/constants.js +100 -0
- package/dist/utils/contextFiles.d.ts +8 -0
- package/dist/utils/contextFiles.js +54 -0
- package/dist/utils/formatting.d.ts +5 -0
- package/dist/utils/formatting.js +30 -0
- package/dist/utils/planParser.d.ts +22 -0
- package/dist/utils/planParser.js +151 -0
- package/dist/utils/taskDragZones.d.ts +8 -0
- package/dist/utils/taskDragZones.js +14 -0
- package/dist/utils/taskDragZones.test.d.ts +1 -0
- package/dist/utils/taskDragZones.test.js +14 -0
- package/dist/utils/taskHierarchy.d.ts +4 -0
- package/dist/utils/taskHierarchy.js +69 -0
- package/dist/utils/taskHierarchy.test.d.ts +1 -0
- package/dist/utils/taskHierarchy.test.js +38 -0
- package/dist/utils/taskParenting.d.ts +3 -0
- package/dist/utils/taskParenting.js +24 -0
- package/dist/utils/taskParenting.test.d.ts +1 -0
- package/dist/utils/taskParenting.test.js +21 -0
- package/dist/utils/taskRelations.d.ts +6 -0
- package/dist/utils/taskRelations.js +24 -0
- package/dist/utils/taskRelations.test.d.ts +1 -0
- package/dist/utils/taskRelations.test.js +34 -0
- package/dist/utils/taskUtils.d.ts +2 -0
- package/dist/utils/taskUtils.js +20 -0
- package/dist/utils/taskforceApiClient.d.ts +7 -0
- package/dist/utils/taskforceApiClient.js +42 -0
- package/dist/utils/workspaceIdentity.d.ts +8 -0
- package/dist/utils/workspaceIdentity.js +47 -0
- package/dist/utils/workspaceIdentity.test.d.ts +1 -0
- package/dist/utils/workspaceIdentity.test.js +32 -0
- package/dist/utils/workspaceLifecycle.d.ts +26 -0
- package/dist/utils/workspaceLifecycle.js +69 -0
- package/dist/utils/workspaceLifecycle.test.d.ts +1 -0
- package/dist/utils/workspaceLifecycle.test.js +64 -0
- package/package.json +133 -0
- package/scripts/check-compat-boundaries.js +48 -0
- package/scripts/check-env.ts +24 -0
- package/scripts/check-localization-strings.mjs +49 -0
- package/scripts/check-runtime-boundaries.mjs +44 -0
- package/scripts/debug-global.mjs +34 -0
- package/scripts/debug-server.mjs +36 -0
- package/scripts/export-sqlite-to-postgres.mjs +125 -0
- package/scripts/generate-env-example.ts +8 -0
- package/scripts/generate-workflow-templates.mjs +134 -0
- package/scripts/mcp-stdio-adapter.mjs +160 -0
- package/scripts/postinstall.js +60 -0
- package/scripts/release-version-lib.mjs +88 -0
- package/scripts/release-version.mjs +72 -0
- package/scripts/run-dev-proxy.sh +49 -0
- package/scripts/run-e2e-realtime.sh +16 -0
- package/scripts/run-smoke.sh +23 -0
- package/scripts/run-soak.sh +29 -0
- package/scripts/test-global.js +143 -0
- package/scripts/update-homebrew-formula.sh +38 -0
- package/src/resources/templates/WORKFLOW_V2_POLICY.md +55 -0
- package/src/resources/templates/environments/aider.yaml +14 -0
- package/src/resources/templates/environments/antigravity.yaml +10 -0
- package/src/resources/templates/environments/claude.yaml +10 -0
- package/src/resources/templates/environments/cline.yaml +10 -0
- package/src/resources/templates/environments/codex.yaml +13 -0
- package/src/resources/templates/environments/copilot.yaml +10 -0
- package/src/resources/templates/environments/cursor.yaml +9 -0
- package/src/resources/templates/environments/gemini.yaml +9 -0
- package/src/resources/templates/environments/windsurf.yaml +10 -0
- package/src/resources/templates/workflow-sources/README.md +9 -0
- package/src/resources/templates/workflow-sources/workflowDocs.mjs +520 -0
- package/src/resources/templates/workflow-sources/workflowEditorOverrides.json +1 -0
- package/src/resources/templates/workflows/collaborate.yaml +104 -0
- package/src/resources/templates/workflows/do.yaml +82 -0
- package/src/resources/templates/workflows/evaluate.yaml +111 -0
- package/src/resources/templates/workflows/execute.yaml +142 -0
- package/src/resources/templates/workflows/plan.yaml +112 -0
- package/src/resources/templates/workflows/review.yaml +109 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { AlertTriangle, Copy, FileUp, Loader2, Trash2, ChevronDown, ChevronRight } from 'lucide-react';
|
|
4
|
+
import styles from '../../Taskforce.module.css';
|
|
5
|
+
import { dispatchOpenMarkdownDocument } from '../../utils/contextFiles';
|
|
6
|
+
const ACCEPTED_CONTEXT_FILE_TYPES = [
|
|
7
|
+
'.png', '.jpg', '.jpeg', '.webp', '.gif',
|
|
8
|
+
'.pdf', '.txt', '.md', '.csv', '.json', '.doc', '.docx',
|
|
9
|
+
'.html', '.js', '.ts', '.tsx', '.css', '.py', '.java', '.go', '.rs', '.sh'
|
|
10
|
+
].join(',');
|
|
11
|
+
const ACCEPTED_CONTEXT_EXTENSIONS = new Set(ACCEPTED_CONTEXT_FILE_TYPES.split(',').map((ext) => ext.trim().toLowerCase()));
|
|
12
|
+
const MAX_CONTEXT_FILE_SIZE_BYTES = 10 * 1024 * 1024; // 10 MB per file
|
|
13
|
+
const CONTEXT_NOTICE_TIMEOUT_MS = 3500;
|
|
14
|
+
function getFileExtension(fileName) {
|
|
15
|
+
const trimmed = fileName.trim().toLowerCase();
|
|
16
|
+
const dotIdx = trimmed.lastIndexOf('.');
|
|
17
|
+
if (dotIdx === -1)
|
|
18
|
+
return '';
|
|
19
|
+
return trimmed.slice(dotIdx);
|
|
20
|
+
}
|
|
21
|
+
function formatFileList(fileNames) {
|
|
22
|
+
if (fileNames.length === 0)
|
|
23
|
+
return '';
|
|
24
|
+
const shown = fileNames.slice(0, 3).join(', ');
|
|
25
|
+
const extra = fileNames.length - 3;
|
|
26
|
+
return extra > 0 ? `${shown}, +${extra} more` : shown;
|
|
27
|
+
}
|
|
28
|
+
function getLocalFileFingerprint(file) {
|
|
29
|
+
return `${file.name.trim().toLowerCase()}::${file.size}::${file.lastModified}`;
|
|
30
|
+
}
|
|
31
|
+
function readFileAsDataUrl(file) {
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
const reader = new FileReader();
|
|
34
|
+
reader.onload = () => resolve(String(reader.result || ''));
|
|
35
|
+
reader.onerror = () => reject(reader.error || new Error('Failed to read file'));
|
|
36
|
+
reader.readAsDataURL(file);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function isImagePath(path) {
|
|
40
|
+
return /\.(png|jpe?g|webp|gif)(\?|#|$)/i.test(path);
|
|
41
|
+
}
|
|
42
|
+
export function TaskContextUpload(props) {
|
|
43
|
+
const { taskId, contextFiles, browsedPath, onBrowseLinkPath, onAddContextFile, onRemoveContextFile, onUpdateContextCaption } = props;
|
|
44
|
+
const inputRef = useRef(null);
|
|
45
|
+
const [uploading, setUploading] = useState(false);
|
|
46
|
+
const [uploadError, setUploadError] = useState(null);
|
|
47
|
+
const [linkValue, setLinkValue] = useState('');
|
|
48
|
+
const [linkError, setLinkError] = useState(null);
|
|
49
|
+
const [contextNotice, setContextNotice] = useState(null);
|
|
50
|
+
const [showContextUpload, setShowContextUpload] = useState(false);
|
|
51
|
+
const [isDropActive, setIsDropActive] = useState(false);
|
|
52
|
+
const [dragDepth, setDragDepth] = useState(0);
|
|
53
|
+
const contextKeyRef = useRef(new Set());
|
|
54
|
+
const localUploadFingerprintRef = useRef(new Set());
|
|
55
|
+
const normalizeKey = (value) => (value || '').trim();
|
|
56
|
+
const getContextKeys = (path, fsPath) => {
|
|
57
|
+
const keys = [];
|
|
58
|
+
const normalizedPath = normalizeKey(path);
|
|
59
|
+
const normalizedFsPath = normalizeKey(fsPath);
|
|
60
|
+
if (normalizedPath)
|
|
61
|
+
keys.push(`path:${normalizedPath}`);
|
|
62
|
+
if (normalizedFsPath)
|
|
63
|
+
keys.push(`fs:${normalizedFsPath}`);
|
|
64
|
+
return keys;
|
|
65
|
+
};
|
|
66
|
+
const keySetFromFiles = useMemo(() => {
|
|
67
|
+
const next = new Set();
|
|
68
|
+
contextFiles.forEach((item) => {
|
|
69
|
+
if (typeof item === 'string') {
|
|
70
|
+
getContextKeys(item).forEach((key) => next.add(key));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
getContextKeys(item.path, item.fsPath).forEach((key) => next.add(key));
|
|
74
|
+
});
|
|
75
|
+
return next;
|
|
76
|
+
}, [contextFiles]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
contextKeyRef.current = new Set(keySetFromFiles);
|
|
79
|
+
}, [keySetFromFiles]);
|
|
80
|
+
const hasAnyKey = (set, keys) => keys.some((key) => set.has(key));
|
|
81
|
+
const addKeys = (set, keys) => keys.forEach((key) => set.add(key));
|
|
82
|
+
const addLink = (rawValue, clearInput = true, contextKeySet = contextKeyRef.current) => {
|
|
83
|
+
const trimmed = rawValue.trim();
|
|
84
|
+
if (!trimmed)
|
|
85
|
+
return 'invalid';
|
|
86
|
+
const isHttp = /^https?:\/\//i.test(trimmed);
|
|
87
|
+
const normalizedPath = isHttp
|
|
88
|
+
? trimmed
|
|
89
|
+
: `/api/taskforce/context-link?path=${encodeURIComponent(trimmed)}`;
|
|
90
|
+
const fsPath = isHttp ? undefined : trimmed;
|
|
91
|
+
const keys = getContextKeys(normalizedPath, fsPath);
|
|
92
|
+
if (hasAnyKey(contextKeySet, keys))
|
|
93
|
+
return 'duplicate';
|
|
94
|
+
const nameFromPath = trimmed.split(/[\\/]/).pop() || trimmed;
|
|
95
|
+
onAddContextFile({
|
|
96
|
+
path: normalizedPath,
|
|
97
|
+
fsPath,
|
|
98
|
+
caption: nameFromPath,
|
|
99
|
+
timestamp: new Date().toISOString()
|
|
100
|
+
});
|
|
101
|
+
addKeys(contextKeySet, keys);
|
|
102
|
+
if (clearInput)
|
|
103
|
+
setLinkValue('');
|
|
104
|
+
setLinkError(null);
|
|
105
|
+
return 'added';
|
|
106
|
+
};
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (!browsedPath)
|
|
109
|
+
return;
|
|
110
|
+
const result = addLink(browsedPath, true);
|
|
111
|
+
if (result === 'duplicate') {
|
|
112
|
+
setContextNotice('Link already exists in task context.');
|
|
113
|
+
}
|
|
114
|
+
else if (result === 'added') {
|
|
115
|
+
setContextNotice(null);
|
|
116
|
+
}
|
|
117
|
+
}, [browsedPath]);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (!contextNotice)
|
|
120
|
+
return;
|
|
121
|
+
const timeoutId = window.setTimeout(() => {
|
|
122
|
+
setContextNotice(null);
|
|
123
|
+
}, CONTEXT_NOTICE_TIMEOUT_MS);
|
|
124
|
+
return () => window.clearTimeout(timeoutId);
|
|
125
|
+
}, [contextNotice]);
|
|
126
|
+
const handleFilesSelected = async (files) => {
|
|
127
|
+
if (!files || files.length === 0)
|
|
128
|
+
return;
|
|
129
|
+
setUploadError(null);
|
|
130
|
+
setContextNotice(null);
|
|
131
|
+
const selectedFiles = Array.from(files);
|
|
132
|
+
const unsupportedFiles = [];
|
|
133
|
+
const oversizedFiles = [];
|
|
134
|
+
const localDuplicateFiles = [];
|
|
135
|
+
const uploadCandidates = [];
|
|
136
|
+
const localFingerprintSet = new Set(localUploadFingerprintRef.current);
|
|
137
|
+
selectedFiles.forEach((file) => {
|
|
138
|
+
const ext = getFileExtension(file.name);
|
|
139
|
+
if (!ACCEPTED_CONTEXT_EXTENSIONS.has(ext)) {
|
|
140
|
+
unsupportedFiles.push(file.name);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (file.size > MAX_CONTEXT_FILE_SIZE_BYTES) {
|
|
144
|
+
oversizedFiles.push(file.name);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const fingerprint = getLocalFileFingerprint(file);
|
|
148
|
+
if (localFingerprintSet.has(fingerprint)) {
|
|
149
|
+
localDuplicateFiles.push(file.name);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
localFingerprintSet.add(fingerprint);
|
|
153
|
+
uploadCandidates.push({ file, fingerprint });
|
|
154
|
+
});
|
|
155
|
+
const validationNotices = [];
|
|
156
|
+
if (unsupportedFiles.length > 0) {
|
|
157
|
+
validationNotices.push(`${unsupportedFiles.length} unsupported file${unsupportedFiles.length === 1 ? '' : 's'} skipped: ${formatFileList(unsupportedFiles)}.`);
|
|
158
|
+
}
|
|
159
|
+
if (oversizedFiles.length > 0) {
|
|
160
|
+
validationNotices.push(`${oversizedFiles.length} file${oversizedFiles.length === 1 ? '' : 's'} over 10 MB skipped: ${formatFileList(oversizedFiles)}.`);
|
|
161
|
+
}
|
|
162
|
+
if (localDuplicateFiles.length > 0) {
|
|
163
|
+
validationNotices.push(`${localDuplicateFiles.length} local duplicate file${localDuplicateFiles.length === 1 ? '' : 's'} skipped before upload: ${formatFileList(localDuplicateFiles)}.`);
|
|
164
|
+
}
|
|
165
|
+
if (uploadCandidates.length === 0) {
|
|
166
|
+
if (validationNotices.length > 0)
|
|
167
|
+
setContextNotice(validationNotices.join(' '));
|
|
168
|
+
if (inputRef.current)
|
|
169
|
+
inputRef.current.value = '';
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
setUploading(true);
|
|
173
|
+
const contextKeySet = new Set(contextKeyRef.current);
|
|
174
|
+
let duplicateCount = 0;
|
|
175
|
+
try {
|
|
176
|
+
for (const { file, fingerprint } of uploadCandidates) {
|
|
177
|
+
let data = null;
|
|
178
|
+
const initRes = await fetch('/api/taskforce/context-upload/init', {
|
|
179
|
+
method: 'POST',
|
|
180
|
+
headers: { 'Content-Type': 'application/json' },
|
|
181
|
+
body: JSON.stringify({
|
|
182
|
+
originalName: file.name,
|
|
183
|
+
mimeType: file.type || 'application/octet-stream',
|
|
184
|
+
size: file.size,
|
|
185
|
+
taskId: taskId || null
|
|
186
|
+
})
|
|
187
|
+
});
|
|
188
|
+
if (initRes.ok) {
|
|
189
|
+
const initData = await initRes.json();
|
|
190
|
+
if (initData?.success && typeof initData?.uploadUrl === 'string' && typeof initData?.path === 'string') {
|
|
191
|
+
const uploadRes = await fetch(initData.uploadUrl, {
|
|
192
|
+
method: String(initData.method || 'PUT'),
|
|
193
|
+
headers: initData.headers || { 'Content-Type': file.type || 'application/octet-stream' },
|
|
194
|
+
body: file
|
|
195
|
+
});
|
|
196
|
+
if (!uploadRes.ok) {
|
|
197
|
+
throw new Error(`Upload failed for ${file.name}`);
|
|
198
|
+
}
|
|
199
|
+
const finalizeRes = await fetch('/api/taskforce/context-upload/finalize', {
|
|
200
|
+
method: 'POST',
|
|
201
|
+
headers: { 'Content-Type': 'application/json' },
|
|
202
|
+
body: JSON.stringify({
|
|
203
|
+
relativePath: initData.relativePath,
|
|
204
|
+
mimeType: file.type || 'application/octet-stream',
|
|
205
|
+
originalName: file.name,
|
|
206
|
+
size: file.size
|
|
207
|
+
})
|
|
208
|
+
});
|
|
209
|
+
if (!finalizeRes.ok) {
|
|
210
|
+
const finalizeError = await finalizeRes.json().catch(() => ({}));
|
|
211
|
+
throw new Error(finalizeError?.error || `Upload failed for ${file.name}`);
|
|
212
|
+
}
|
|
213
|
+
data = {
|
|
214
|
+
success: true,
|
|
215
|
+
path: initData.path,
|
|
216
|
+
fsPath: initData.fsPath
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
else if (initData?.success && typeof initData?.path === 'string') {
|
|
220
|
+
data = initData;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (!data) {
|
|
224
|
+
const encoded = await readFileAsDataUrl(file);
|
|
225
|
+
const res = await fetch('/api/taskforce/context-upload', {
|
|
226
|
+
method: 'POST',
|
|
227
|
+
headers: { 'Content-Type': 'application/json' },
|
|
228
|
+
body: JSON.stringify({
|
|
229
|
+
file: encoded,
|
|
230
|
+
originalName: file.name,
|
|
231
|
+
taskId: taskId || null
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
if (!res.ok) {
|
|
235
|
+
throw new Error(`Upload failed for ${file.name}`);
|
|
236
|
+
}
|
|
237
|
+
data = await res.json();
|
|
238
|
+
}
|
|
239
|
+
if (!data?.success || !data?.path) {
|
|
240
|
+
throw new Error(`Upload failed for ${file.name}`);
|
|
241
|
+
}
|
|
242
|
+
const keys = getContextKeys(data.path, data.fsPath);
|
|
243
|
+
if (hasAnyKey(contextKeySet, keys)) {
|
|
244
|
+
duplicateCount += 1;
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
onAddContextFile({
|
|
248
|
+
path: data.path,
|
|
249
|
+
fsPath: data.fsPath,
|
|
250
|
+
caption: file.name,
|
|
251
|
+
timestamp: new Date().toISOString()
|
|
252
|
+
});
|
|
253
|
+
addKeys(contextKeySet, keys);
|
|
254
|
+
localUploadFingerprintRef.current.add(fingerprint);
|
|
255
|
+
}
|
|
256
|
+
const notices = [...validationNotices];
|
|
257
|
+
if (duplicateCount > 0) {
|
|
258
|
+
notices.push(`${duplicateCount} duplicate file${duplicateCount === 1 ? '' : 's'} skipped.`);
|
|
259
|
+
}
|
|
260
|
+
setContextNotice(notices.length > 0 ? notices.join(' ') : null);
|
|
261
|
+
contextKeyRef.current = contextKeySet;
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
setUploadError(error instanceof Error ? error.message : 'Failed to upload context file');
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
setUploading(false);
|
|
268
|
+
if (inputRef.current)
|
|
269
|
+
inputRef.current.value = '';
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
const parseDroppedLinks = (event) => {
|
|
273
|
+
const droppedLinks = new Set();
|
|
274
|
+
const rawUriList = event.dataTransfer.getData('text/uri-list') || '';
|
|
275
|
+
const rawText = event.dataTransfer.getData('text/plain') || '';
|
|
276
|
+
const candidates = `${rawUriList}\n${rawText}`
|
|
277
|
+
.split('\n')
|
|
278
|
+
.map((line) => line.trim())
|
|
279
|
+
.filter((line) => !!line && !line.startsWith('#'));
|
|
280
|
+
for (const candidate of candidates) {
|
|
281
|
+
if (/^file:\/\//i.test(candidate)) {
|
|
282
|
+
try {
|
|
283
|
+
const fileUrl = new URL(candidate);
|
|
284
|
+
const fsPath = decodeURIComponent(fileUrl.pathname || '').trim();
|
|
285
|
+
if (fsPath)
|
|
286
|
+
droppedLinks.add(fsPath);
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
// Ignore malformed file URL drops
|
|
290
|
+
}
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
droppedLinks.add(candidate);
|
|
294
|
+
}
|
|
295
|
+
return Array.from(droppedLinks);
|
|
296
|
+
};
|
|
297
|
+
const handleDrop = (event) => {
|
|
298
|
+
event.preventDefault();
|
|
299
|
+
event.stopPropagation();
|
|
300
|
+
setIsDropActive(false);
|
|
301
|
+
setDragDepth(0);
|
|
302
|
+
setUploadError(null);
|
|
303
|
+
setLinkError(null);
|
|
304
|
+
setContextNotice(null);
|
|
305
|
+
if (event.dataTransfer.files && event.dataTransfer.files.length > 0) {
|
|
306
|
+
void handleFilesSelected(event.dataTransfer.files);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const droppedLinks = parseDroppedLinks(event);
|
|
310
|
+
if (droppedLinks.length === 0) {
|
|
311
|
+
setLinkError('Drop a file, URL, or file path.');
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const contextKeySet = new Set(contextKeyRef.current);
|
|
315
|
+
let duplicateCount = 0;
|
|
316
|
+
let addedCount = 0;
|
|
317
|
+
droppedLinks.forEach((link) => {
|
|
318
|
+
const result = addLink(link, false, contextKeySet);
|
|
319
|
+
if (result === 'duplicate')
|
|
320
|
+
duplicateCount += 1;
|
|
321
|
+
if (result === 'added')
|
|
322
|
+
addedCount += 1;
|
|
323
|
+
});
|
|
324
|
+
if (duplicateCount > 0) {
|
|
325
|
+
setContextNotice(`${duplicateCount} duplicate link${duplicateCount === 1 ? '' : 's'} skipped.`);
|
|
326
|
+
}
|
|
327
|
+
else if (addedCount > 0) {
|
|
328
|
+
setContextNotice(null);
|
|
329
|
+
}
|
|
330
|
+
contextKeyRef.current = contextKeySet;
|
|
331
|
+
};
|
|
332
|
+
const handleDragEnter = (event) => {
|
|
333
|
+
event.preventDefault();
|
|
334
|
+
event.stopPropagation();
|
|
335
|
+
setDragDepth((depth) => depth + 1);
|
|
336
|
+
setIsDropActive(true);
|
|
337
|
+
};
|
|
338
|
+
const handleDragLeave = (event) => {
|
|
339
|
+
event.preventDefault();
|
|
340
|
+
event.stopPropagation();
|
|
341
|
+
setDragDepth((depth) => {
|
|
342
|
+
const nextDepth = Math.max(0, depth - 1);
|
|
343
|
+
if (nextDepth === 0)
|
|
344
|
+
setIsDropActive(false);
|
|
345
|
+
return nextDepth;
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
const handleDragOver = (event) => {
|
|
349
|
+
event.preventDefault();
|
|
350
|
+
event.stopPropagation();
|
|
351
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
352
|
+
};
|
|
353
|
+
return (_jsxs("div", { className: styles.specialistSection, children: [_jsxs("div", { className: styles.toggleHeading, onClick: () => setShowContextUpload(!showContextUpload), title: showContextUpload ? 'Hide context documents' : 'Show context documents', children: [_jsxs("label", { className: styles.label, children: ["Context Documents ", contextFiles.length > 0 && `(${contextFiles.length})`] }), showContextUpload ? _jsx(ChevronDown, { size: 14 }) : _jsx(ChevronRight, { size: 14 })] }), showContextUpload && (_jsxs(_Fragment, { children: [_jsx("p", { className: styles.settingsHint, children: "Upload copies into context storage, or link to existing files/URLs without copying." }), _jsxs("div", { className: styles.contextUploadActions, children: [_jsxs("button", { type: "button", className: styles.secondaryHeaderBtn, onClick: () => inputRef.current?.click(), disabled: uploading, children: [uploading ? _jsx(Loader2, { size: 12, className: styles.spinner }) : _jsx(FileUp, { size: 12 }), uploading ? 'Uploading...' : 'Upload File'] }), _jsx("button", { type: "button", className: styles.secondaryHeaderBtn, onClick: () => onBrowseLinkPath?.(), children: "Browse Link" })] }), _jsx("input", { ref: inputRef, type: "file", accept: ACCEPTED_CONTEXT_FILE_TYPES, multiple: true, className: styles.hiddenInput, onChange: (e) => {
|
|
354
|
+
void handleFilesSelected(e.target.files);
|
|
355
|
+
} }), uploadError && _jsx("div", { className: styles.error, children: uploadError }), _jsxs("div", { className: styles.contextLinkRow, children: [_jsx("input", { type: "text", className: styles.input, placeholder: "Link file path (e.g. docs/spec.pdf) or URL (https://...)", value: linkValue, onChange: (e) => {
|
|
356
|
+
setLinkValue(e.target.value);
|
|
357
|
+
if (linkError)
|
|
358
|
+
setLinkError(null);
|
|
359
|
+
if (contextNotice)
|
|
360
|
+
setContextNotice(null);
|
|
361
|
+
} }), _jsx("button", { type: "button", className: styles.secondaryHeaderBtn, onClick: () => {
|
|
362
|
+
if (!linkValue.trim()) {
|
|
363
|
+
setLinkError('Enter a file path or URL to link.');
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const result = addLink(linkValue, true);
|
|
367
|
+
if (result === 'duplicate') {
|
|
368
|
+
setContextNotice('Link already exists in task context.');
|
|
369
|
+
}
|
|
370
|
+
else if (result === 'added') {
|
|
371
|
+
setContextNotice(null);
|
|
372
|
+
}
|
|
373
|
+
}, children: "Save Link" })] }), _jsxs("div", { className: `${styles.contextDropzone} ${isDropActive ? styles.contextDropzoneActive : ''}`, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, children: [_jsx(FileUp, { size: 14 }), _jsx("span", { children: "Drop files, URLs, or file paths here" })] }), contextNotice && _jsx("div", { className: styles.contextNotice, children: contextNotice }), linkError && _jsx("div", { className: styles.error, children: linkError }), contextFiles.length > 0 && (_jsx("div", { className: styles.screenshotGrid, children: contextFiles.map((item, idx) => {
|
|
374
|
+
const path = typeof item === 'string' ? item : item.path;
|
|
375
|
+
const fsPath = typeof item === 'string' ? undefined : item.fsPath;
|
|
376
|
+
const caption = typeof item === 'string' ? '' : item.caption || '';
|
|
377
|
+
const isImage = isImagePath(path);
|
|
378
|
+
return (_jsxs("div", { className: styles.screenshotCard, children: [_jsxs("div", { className: styles.screenshotImageContainer, children: [isImage ? (_jsx("img", { src: path, alt: caption || `Context file ${idx}`, onClick: () => window.open(path, '_blank'), onError: (e) => {
|
|
379
|
+
e.target.style.display = 'none';
|
|
380
|
+
e.target.parentElement.classList.add(styles.brokenImage);
|
|
381
|
+
} })) : (_jsxs("button", { type: "button", className: styles.contextFileLink, onClick: () => {
|
|
382
|
+
if (dispatchOpenMarkdownDocument(path, fsPath))
|
|
383
|
+
return;
|
|
384
|
+
window.open(path, '_blank');
|
|
385
|
+
}, title: "Open file", children: [_jsx(FileUp, { size: 16 }), _jsx("span", { children: caption || fsPath || path.split('/').pop() || 'Context file' })] })), _jsxs("div", { className: styles.brokenImagePlaceholder, children: [_jsx(AlertTriangle, { size: 16 }), _jsx("span", { children: "Preview unavailable" })] }), _jsxs("div", { className: styles.screenshotActions, children: [fsPath && (_jsx("button", { type: "button", className: styles.screenshotActionBtn, onClick: (e) => {
|
|
386
|
+
e.stopPropagation();
|
|
387
|
+
navigator.clipboard.writeText(fsPath);
|
|
388
|
+
}, title: `Copy path: ${fsPath}`, children: _jsx(Copy, { size: 12 }) })), _jsx("button", { type: "button", className: styles.screenshotActionBtn, onClick: (e) => {
|
|
389
|
+
e.stopPropagation();
|
|
390
|
+
onRemoveContextFile(idx);
|
|
391
|
+
}, title: "Delete", children: _jsx(Trash2, { size: 12 }) })] })] }), _jsx("input", { type: "text", className: styles.screenshotCaptionInput, placeholder: "Add a label...", value: caption, onChange: (e) => onUpdateContextCaption(idx, e.target.value) })] }, idx));
|
|
392
|
+
}) }))] }))] }));
|
|
393
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
5
|
+
import { TaskContextUpload } from './TaskContextUpload';
|
|
6
|
+
class MockFileReader {
|
|
7
|
+
result = null;
|
|
8
|
+
error = null;
|
|
9
|
+
onload = null;
|
|
10
|
+
onerror = null;
|
|
11
|
+
readAsDataURL(_file) {
|
|
12
|
+
this.result = 'data:application/octet-stream;base64,ZmFrZQ==';
|
|
13
|
+
this.onload?.call(this, new ProgressEvent('load'));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const createFileList = (files) => {
|
|
17
|
+
const list = {
|
|
18
|
+
length: files.length,
|
|
19
|
+
item: (index) => files[index] || null
|
|
20
|
+
};
|
|
21
|
+
files.forEach((file, index) => {
|
|
22
|
+
list[index] = file;
|
|
23
|
+
});
|
|
24
|
+
list[Symbol.iterator] = () => files.values();
|
|
25
|
+
return list;
|
|
26
|
+
};
|
|
27
|
+
describe('TaskContextUpload drag and drop', () => {
|
|
28
|
+
const CONTEXT_UPLOAD_OPEN_STORAGE_KEY = 'taskforce-show-context-upload';
|
|
29
|
+
const onAddContextFile = vi.fn();
|
|
30
|
+
const onRemoveContextFile = vi.fn();
|
|
31
|
+
const onUpdateContextCaption = vi.fn();
|
|
32
|
+
const onBrowseLinkPath = vi.fn();
|
|
33
|
+
const renderUpload = (contextFiles = []) => render(_jsx(TaskContextUpload, { contextFiles: contextFiles, onBrowseLinkPath: onBrowseLinkPath, onAddContextFile: onAddContextFile, onRemoveContextFile: onRemoveContextFile, onUpdateContextCaption: onUpdateContextCaption }));
|
|
34
|
+
const openSection = async () => {
|
|
35
|
+
const user = userEvent.setup();
|
|
36
|
+
const showToggle = screen.queryByTitle('Show context documents');
|
|
37
|
+
if (showToggle) {
|
|
38
|
+
await user.click(showToggle);
|
|
39
|
+
}
|
|
40
|
+
return screen.getByText('Drop files, URLs, or file paths here');
|
|
41
|
+
};
|
|
42
|
+
beforeEach(() => {
|
|
43
|
+
vi.clearAllMocks();
|
|
44
|
+
vi.stubGlobal('FileReader', MockFileReader);
|
|
45
|
+
window.localStorage.removeItem(CONTEXT_UPLOAD_OPEN_STORAGE_KEY);
|
|
46
|
+
});
|
|
47
|
+
afterEach(() => {
|
|
48
|
+
vi.unstubAllGlobals();
|
|
49
|
+
});
|
|
50
|
+
it('adds dropped URL links', async () => {
|
|
51
|
+
renderUpload();
|
|
52
|
+
const dropzone = await openSection();
|
|
53
|
+
fireEvent.drop(dropzone, {
|
|
54
|
+
dataTransfer: {
|
|
55
|
+
files: createFileList([]),
|
|
56
|
+
getData: (type) => (type === 'text/plain' ? 'https://example.com/spec' : '')
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
expect(onAddContextFile).toHaveBeenCalledTimes(1);
|
|
60
|
+
expect(onAddContextFile).toHaveBeenCalledWith(expect.objectContaining({
|
|
61
|
+
path: 'https://example.com/spec',
|
|
62
|
+
caption: 'spec'
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
it('converts dropped file:// URLs to linked filesystem paths', async () => {
|
|
66
|
+
renderUpload();
|
|
67
|
+
const dropzone = await openSection();
|
|
68
|
+
fireEvent.drop(dropzone, {
|
|
69
|
+
dataTransfer: {
|
|
70
|
+
files: createFileList([]),
|
|
71
|
+
getData: (type) => type === 'text/uri-list' ? 'file:///Users/rossburke/Documents/spec.pdf' : ''
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
expect(onAddContextFile).toHaveBeenCalledTimes(1);
|
|
75
|
+
expect(onAddContextFile).toHaveBeenCalledWith(expect.objectContaining({
|
|
76
|
+
path: '/api/taskforce/context-link?path=%2FUsers%2Frossburke%2FDocuments%2Fspec.pdf',
|
|
77
|
+
fsPath: '/Users/rossburke/Documents/spec.pdf',
|
|
78
|
+
caption: 'spec.pdf'
|
|
79
|
+
}));
|
|
80
|
+
});
|
|
81
|
+
it('shows an error for empty drops', async () => {
|
|
82
|
+
renderUpload();
|
|
83
|
+
const dropzone = await openSection();
|
|
84
|
+
fireEvent.drop(dropzone, {
|
|
85
|
+
dataTransfer: {
|
|
86
|
+
files: createFileList([]),
|
|
87
|
+
getData: () => ''
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
expect(screen.getByText('Drop a file, URL, or file path.')).toBeInTheDocument();
|
|
91
|
+
});
|
|
92
|
+
it('skips duplicate dropped links and shows notice', async () => {
|
|
93
|
+
renderUpload();
|
|
94
|
+
const dropzone = await openSection();
|
|
95
|
+
const dataTransfer = {
|
|
96
|
+
files: createFileList([]),
|
|
97
|
+
getData: (type) => (type === 'text/plain' ? 'https://example.com/spec' : '')
|
|
98
|
+
};
|
|
99
|
+
fireEvent.drop(dropzone, { dataTransfer });
|
|
100
|
+
fireEvent.drop(dropzone, { dataTransfer });
|
|
101
|
+
expect(onAddContextFile).toHaveBeenCalledTimes(1);
|
|
102
|
+
expect(screen.getByText('1 duplicate link skipped.')).toBeInTheDocument();
|
|
103
|
+
});
|
|
104
|
+
it('skips duplicate uploaded files and shows notice', async () => {
|
|
105
|
+
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({
|
|
106
|
+
ok: true,
|
|
107
|
+
json: async () => ({
|
|
108
|
+
success: true,
|
|
109
|
+
path: '/api/taskforce/context/shared.pdf',
|
|
110
|
+
fsPath: 'context-files/shared.pdf'
|
|
111
|
+
})
|
|
112
|
+
}));
|
|
113
|
+
renderUpload();
|
|
114
|
+
const dropzone = await openSection();
|
|
115
|
+
const fileA = new File(['a'], 'one.pdf', { type: 'application/pdf' });
|
|
116
|
+
const fileB = new File(['b'], 'two.pdf', { type: 'application/pdf' });
|
|
117
|
+
fireEvent.drop(dropzone, {
|
|
118
|
+
dataTransfer: {
|
|
119
|
+
files: createFileList([fileA, fileB]),
|
|
120
|
+
getData: () => ''
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
await waitFor(() => {
|
|
124
|
+
expect(onAddContextFile).toHaveBeenCalledTimes(1);
|
|
125
|
+
});
|
|
126
|
+
expect(screen.getByText('1 duplicate file skipped.')).toBeInTheDocument();
|
|
127
|
+
});
|
|
128
|
+
it('validates unsupported file types before upload', async () => {
|
|
129
|
+
const fetchMock = vi.fn();
|
|
130
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
131
|
+
renderUpload();
|
|
132
|
+
const dropzone = await openSection();
|
|
133
|
+
const file = new File(['bad'], 'script.exe', { type: 'application/octet-stream' });
|
|
134
|
+
fireEvent.drop(dropzone, {
|
|
135
|
+
dataTransfer: {
|
|
136
|
+
files: createFileList([file]),
|
|
137
|
+
getData: () => ''
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
expect(onAddContextFile).not.toHaveBeenCalled();
|
|
141
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
142
|
+
expect(screen.getByText(/unsupported file/i)).toBeInTheDocument();
|
|
143
|
+
expect(screen.getByText(/script\.exe/i)).toBeInTheDocument();
|
|
144
|
+
});
|
|
145
|
+
it('validates oversized files before upload', async () => {
|
|
146
|
+
const fetchMock = vi.fn();
|
|
147
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
148
|
+
renderUpload();
|
|
149
|
+
const dropzone = await openSection();
|
|
150
|
+
const largePayload = new Uint8Array(10 * 1024 * 1024 + 1);
|
|
151
|
+
const file = new File([largePayload], 'huge.pdf', { type: 'application/pdf' });
|
|
152
|
+
fireEvent.drop(dropzone, {
|
|
153
|
+
dataTransfer: {
|
|
154
|
+
files: createFileList([file]),
|
|
155
|
+
getData: () => ''
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
expect(onAddContextFile).not.toHaveBeenCalled();
|
|
159
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
160
|
+
expect(screen.getByText(/over 10 mb/i)).toBeInTheDocument();
|
|
161
|
+
expect(screen.getByText(/huge\.pdf/i)).toBeInTheDocument();
|
|
162
|
+
});
|
|
163
|
+
it('skips local duplicate files before upload network calls', async () => {
|
|
164
|
+
const fetchMock = vi.fn().mockResolvedValue({
|
|
165
|
+
ok: true,
|
|
166
|
+
json: async () => ({
|
|
167
|
+
success: true,
|
|
168
|
+
path: '/api/taskforce/context/dup.pdf',
|
|
169
|
+
fsPath: 'context-files/dup.pdf'
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
173
|
+
renderUpload();
|
|
174
|
+
const dropzone = await openSection();
|
|
175
|
+
const duplicateA = new File(['same-data'], 'dup.pdf', { type: 'application/pdf', lastModified: 1739366400000 });
|
|
176
|
+
const duplicateB = new File(['same-data'], 'dup.pdf', { type: 'application/pdf', lastModified: 1739366400000 });
|
|
177
|
+
fireEvent.drop(dropzone, {
|
|
178
|
+
dataTransfer: {
|
|
179
|
+
files: createFileList([duplicateA, duplicateB]),
|
|
180
|
+
getData: () => ''
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
await waitFor(() => {
|
|
184
|
+
expect(onAddContextFile).toHaveBeenCalledTimes(1);
|
|
185
|
+
});
|
|
186
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
187
|
+
expect(screen.getByText(/local duplicate file/i)).toBeInTheDocument();
|
|
188
|
+
});
|
|
189
|
+
});
|