@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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { shouldApplyAuthRateLimitForPath } from './index';
|
|
3
|
+
describe('shouldApplyAuthRateLimitForPath', () => {
|
|
4
|
+
it('applies auth rate limit to invite accept endpoint', () => {
|
|
5
|
+
expect(shouldApplyAuthRateLimitForPath('/api/taskforce/auth/invite/accept')).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
it('excludes auth session endpoint', () => {
|
|
8
|
+
expect(shouldApplyAuthRateLimitForPath('/api/taskforce/auth/session')).toBe(false);
|
|
9
|
+
});
|
|
10
|
+
it('does not apply to non-auth routes', () => {
|
|
11
|
+
expect(shouldApplyAuthRateLimitForPath('/api/taskforce/tasks')).toBe(false);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { ensureBillingWebhookAuthExclusion, isBillingWebhookPath, shouldApplyAuthRateLimitForPath } from './index.js';
|
|
3
|
+
describe('server index helper policies', () => {
|
|
4
|
+
it('adds webhook path to auth exclusions without duplicates', () => {
|
|
5
|
+
const base = ['/api/taskforce/health', '/api/taskforce/auth'];
|
|
6
|
+
const next = ensureBillingWebhookAuthExclusion(base);
|
|
7
|
+
expect(next).toContain('/api/taskforce/billing/webhook');
|
|
8
|
+
expect(next.filter((entry) => entry === '/api/taskforce/billing/webhook')).toHaveLength(1);
|
|
9
|
+
});
|
|
10
|
+
it('identifies billing webhook path exactly', () => {
|
|
11
|
+
expect(isBillingWebhookPath('/api/taskforce/billing/webhook')).toBe(true);
|
|
12
|
+
expect(isBillingWebhookPath('/api/taskforce/billing/webhook/v2')).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
it('applies auth limiter only to auth routes except session', () => {
|
|
15
|
+
expect(shouldApplyAuthRateLimitForPath('/api/taskforce/auth/login')).toBe(true);
|
|
16
|
+
expect(shouldApplyAuthRateLimitForPath('/api/taskforce/auth/session')).toBe(false);
|
|
17
|
+
expect(shouldApplyAuthRateLimitForPath('/api/taskforce/billing/webhook')).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IncomingMessage } from 'http';
|
|
2
|
+
import type { ServerResponse } from 'http';
|
|
3
|
+
export interface RateLimitResult {
|
|
4
|
+
allowed: boolean;
|
|
5
|
+
limit: number;
|
|
6
|
+
remaining: number;
|
|
7
|
+
resetAt: number;
|
|
8
|
+
retryAfterSeconds: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class InMemoryRateLimiter {
|
|
11
|
+
private readonly limit;
|
|
12
|
+
private readonly windowMs;
|
|
13
|
+
private readonly buckets;
|
|
14
|
+
private checksSinceCleanup;
|
|
15
|
+
constructor(limit: number, windowMs: number);
|
|
16
|
+
check(key: string, now?: number): RateLimitResult;
|
|
17
|
+
private pruneExpired;
|
|
18
|
+
}
|
|
19
|
+
export declare function resolveClientIp(req: IncomingMessage): string;
|
|
20
|
+
export declare function resolveRateLimitKey(params: {
|
|
21
|
+
req: IncomingMessage;
|
|
22
|
+
pathname: string;
|
|
23
|
+
method?: string;
|
|
24
|
+
authenticated?: boolean;
|
|
25
|
+
sessionId?: string | null;
|
|
26
|
+
userId?: string | null;
|
|
27
|
+
}): string;
|
|
28
|
+
export declare function applyRateLimitHeaders(res: ServerResponse, result: RateLimitResult): void;
|
|
29
|
+
export declare function applyPrefixedRateLimitHeaders(res: ServerResponse, result: RateLimitResult, prefix: string): void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export class InMemoryRateLimiter {
|
|
2
|
+
limit;
|
|
3
|
+
windowMs;
|
|
4
|
+
buckets = new Map();
|
|
5
|
+
checksSinceCleanup = 0;
|
|
6
|
+
constructor(limit, windowMs) {
|
|
7
|
+
this.limit = Math.max(1, Math.floor(limit));
|
|
8
|
+
this.windowMs = Math.max(1000, Math.floor(windowMs));
|
|
9
|
+
}
|
|
10
|
+
check(key, now = Date.now()) {
|
|
11
|
+
this.checksSinceCleanup += 1;
|
|
12
|
+
if (this.checksSinceCleanup >= 500) {
|
|
13
|
+
this.pruneExpired(now);
|
|
14
|
+
this.checksSinceCleanup = 0;
|
|
15
|
+
}
|
|
16
|
+
const safeKey = key || 'unknown';
|
|
17
|
+
const existing = this.buckets.get(safeKey);
|
|
18
|
+
if (!existing || now >= existing.resetAt) {
|
|
19
|
+
const resetAt = now + this.windowMs;
|
|
20
|
+
this.buckets.set(safeKey, { count: 1, resetAt });
|
|
21
|
+
return {
|
|
22
|
+
allowed: true,
|
|
23
|
+
limit: this.limit,
|
|
24
|
+
remaining: Math.max(0, this.limit - 1),
|
|
25
|
+
resetAt,
|
|
26
|
+
retryAfterSeconds: Math.max(1, Math.ceil(this.windowMs / 1000))
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
existing.count += 1;
|
|
30
|
+
this.buckets.set(safeKey, existing);
|
|
31
|
+
const retryAfterSeconds = Math.max(1, Math.ceil((existing.resetAt - now) / 1000));
|
|
32
|
+
const remaining = Math.max(0, this.limit - existing.count);
|
|
33
|
+
if (existing.count > this.limit) {
|
|
34
|
+
return {
|
|
35
|
+
allowed: false,
|
|
36
|
+
limit: this.limit,
|
|
37
|
+
remaining: 0,
|
|
38
|
+
resetAt: existing.resetAt,
|
|
39
|
+
retryAfterSeconds
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
allowed: true,
|
|
44
|
+
limit: this.limit,
|
|
45
|
+
remaining,
|
|
46
|
+
resetAt: existing.resetAt,
|
|
47
|
+
retryAfterSeconds
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
pruneExpired(now) {
|
|
51
|
+
for (const [bucketKey, bucket] of this.buckets.entries()) {
|
|
52
|
+
if (now >= bucket.resetAt) {
|
|
53
|
+
this.buckets.delete(bucketKey);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export function resolveClientIp(req) {
|
|
59
|
+
const forwardedFor = req.headers['x-forwarded-for'];
|
|
60
|
+
if (typeof forwardedFor === 'string' && forwardedFor.trim()) {
|
|
61
|
+
return forwardedFor.split(',')[0].trim();
|
|
62
|
+
}
|
|
63
|
+
if (Array.isArray(forwardedFor) && forwardedFor.length > 0) {
|
|
64
|
+
return forwardedFor[0].split(',')[0].trim();
|
|
65
|
+
}
|
|
66
|
+
return req.socket?.remoteAddress || 'unknown';
|
|
67
|
+
}
|
|
68
|
+
export function resolveRateLimitKey(params) {
|
|
69
|
+
const { req, pathname } = params;
|
|
70
|
+
const method = String(params.method || req.method || 'GET').trim().toUpperCase() || 'GET';
|
|
71
|
+
const userId = String(params.userId || '').trim();
|
|
72
|
+
const sessionId = String(params.sessionId || '').trim();
|
|
73
|
+
const authenticated = params.authenticated === true;
|
|
74
|
+
const ip = resolveClientIp(req) || 'unknown';
|
|
75
|
+
const route = String(pathname || '/').trim() || '/';
|
|
76
|
+
if (authenticated && userId && userId !== 'anonymous') {
|
|
77
|
+
return `user:${userId}:${method}:${route}`;
|
|
78
|
+
}
|
|
79
|
+
if (authenticated && sessionId) {
|
|
80
|
+
return `session:${sessionId}:${method}:${route}`;
|
|
81
|
+
}
|
|
82
|
+
return `ip:${ip}:${method}:${route}`;
|
|
83
|
+
}
|
|
84
|
+
export function applyRateLimitHeaders(res, result) {
|
|
85
|
+
res.setHeader('X-RateLimit-Limit', String(result.limit));
|
|
86
|
+
res.setHeader('X-RateLimit-Remaining', String(result.remaining));
|
|
87
|
+
res.setHeader('X-RateLimit-Reset', String(Math.ceil(result.resetAt / 1000)));
|
|
88
|
+
if (!result.allowed) {
|
|
89
|
+
res.setHeader('Retry-After', String(result.retryAfterSeconds));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export function applyPrefixedRateLimitHeaders(res, result, prefix) {
|
|
93
|
+
res.setHeader(`${prefix}-Limit`, String(result.limit));
|
|
94
|
+
res.setHeader(`${prefix}-Remaining`, String(result.remaining));
|
|
95
|
+
res.setHeader(`${prefix}-Reset`, String(Math.ceil(result.resetAt / 1000)));
|
|
96
|
+
if (!result.allowed) {
|
|
97
|
+
res.setHeader(`${prefix}-Retry-After`, String(result.retryAfterSeconds));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { applyPrefixedRateLimitHeaders, InMemoryRateLimiter, resolveClientIp, resolveRateLimitKey } from './rateLimit';
|
|
3
|
+
describe('InMemoryRateLimiter', () => {
|
|
4
|
+
it('allows requests within limit and blocks over limit', () => {
|
|
5
|
+
const limiter = new InMemoryRateLimiter(2, 60_000);
|
|
6
|
+
const now = 1_000;
|
|
7
|
+
const first = limiter.check('ip:1', now);
|
|
8
|
+
const second = limiter.check('ip:1', now + 1);
|
|
9
|
+
const third = limiter.check('ip:1', now + 2);
|
|
10
|
+
expect(first.allowed).toBe(true);
|
|
11
|
+
expect(first.remaining).toBe(1);
|
|
12
|
+
expect(second.allowed).toBe(true);
|
|
13
|
+
expect(second.remaining).toBe(0);
|
|
14
|
+
expect(third.allowed).toBe(false);
|
|
15
|
+
expect(third.retryAfterSeconds).toBeGreaterThan(0);
|
|
16
|
+
});
|
|
17
|
+
it('resets bucket after window', () => {
|
|
18
|
+
const limiter = new InMemoryRateLimiter(1, 1_000);
|
|
19
|
+
const first = limiter.check('ip:2', 1_000);
|
|
20
|
+
const blocked = limiter.check('ip:2', 1_500);
|
|
21
|
+
const reset = limiter.check('ip:2', 2_001);
|
|
22
|
+
expect(first.allowed).toBe(true);
|
|
23
|
+
expect(blocked.allowed).toBe(false);
|
|
24
|
+
expect(reset.allowed).toBe(true);
|
|
25
|
+
expect(reset.remaining).toBe(0);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('resolveClientIp', () => {
|
|
29
|
+
it('uses x-forwarded-for when present', () => {
|
|
30
|
+
const req = {
|
|
31
|
+
headers: { 'x-forwarded-for': '203.0.113.5, 10.0.0.1' },
|
|
32
|
+
socket: { remoteAddress: '127.0.0.1' }
|
|
33
|
+
};
|
|
34
|
+
expect(resolveClientIp(req)).toBe('203.0.113.5');
|
|
35
|
+
});
|
|
36
|
+
it('falls back to remoteAddress', () => {
|
|
37
|
+
const req = {
|
|
38
|
+
headers: {},
|
|
39
|
+
socket: { remoteAddress: '127.0.0.2' }
|
|
40
|
+
};
|
|
41
|
+
expect(resolveClientIp(req)).toBe('127.0.0.2');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('applyPrefixedRateLimitHeaders', () => {
|
|
45
|
+
it('applies prefixed headers without default header names', () => {
|
|
46
|
+
const headers = new Map();
|
|
47
|
+
const res = {
|
|
48
|
+
setHeader: (name, value) => headers.set(name, value)
|
|
49
|
+
};
|
|
50
|
+
applyPrefixedRateLimitHeaders(res, {
|
|
51
|
+
allowed: true,
|
|
52
|
+
limit: 10,
|
|
53
|
+
remaining: 8,
|
|
54
|
+
resetAt: 1_700_000_000_000,
|
|
55
|
+
retryAfterSeconds: 30
|
|
56
|
+
}, 'X-Auth-RateLimit');
|
|
57
|
+
expect(headers.get('X-Auth-RateLimit-Limit')).toBe('10');
|
|
58
|
+
expect(headers.get('X-Auth-RateLimit-Remaining')).toBe('8');
|
|
59
|
+
expect(headers.get('X-Auth-RateLimit-Reset')).toBe(String(Math.ceil(1_700_000_000_000 / 1000)));
|
|
60
|
+
expect(headers.has('X-RateLimit-Limit')).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe('resolveRateLimitKey', () => {
|
|
64
|
+
it('uses authenticated user identity when available', () => {
|
|
65
|
+
const req = {
|
|
66
|
+
method: 'GET',
|
|
67
|
+
headers: { 'x-forwarded-for': '203.0.113.10' },
|
|
68
|
+
socket: { remoteAddress: '127.0.0.1' }
|
|
69
|
+
};
|
|
70
|
+
const key = resolveRateLimitKey({
|
|
71
|
+
req,
|
|
72
|
+
pathname: '/api/taskforce/tasks',
|
|
73
|
+
authenticated: true,
|
|
74
|
+
userId: 'user-123',
|
|
75
|
+
sessionId: 'session-abc'
|
|
76
|
+
});
|
|
77
|
+
expect(key).toBe('user:user-123:GET:/api/taskforce/tasks');
|
|
78
|
+
});
|
|
79
|
+
it('falls back to session identity for authenticated anonymous users', () => {
|
|
80
|
+
const req = {
|
|
81
|
+
method: 'patch',
|
|
82
|
+
headers: {},
|
|
83
|
+
socket: { remoteAddress: '127.0.0.5' }
|
|
84
|
+
};
|
|
85
|
+
const key = resolveRateLimitKey({
|
|
86
|
+
req,
|
|
87
|
+
pathname: '/api/taskforce/task/1',
|
|
88
|
+
authenticated: true,
|
|
89
|
+
userId: 'anonymous',
|
|
90
|
+
sessionId: 'session-123'
|
|
91
|
+
});
|
|
92
|
+
expect(key).toBe('session:session-123:PATCH:/api/taskforce/task/1');
|
|
93
|
+
});
|
|
94
|
+
it('falls back to IP identity for unauthenticated requests', () => {
|
|
95
|
+
const req = {
|
|
96
|
+
method: 'post',
|
|
97
|
+
headers: { 'x-forwarded-for': '198.51.100.11, 10.0.0.1' },
|
|
98
|
+
socket: { remoteAddress: '127.0.0.1' }
|
|
99
|
+
};
|
|
100
|
+
const key = resolveRateLimitKey({
|
|
101
|
+
req,
|
|
102
|
+
pathname: '/api/taskforce/config',
|
|
103
|
+
authenticated: false
|
|
104
|
+
});
|
|
105
|
+
expect(key).toBe('ip:198.51.100.11:POST:/api/taskforce/config');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { createRealtimeSyncWsManager } from './realtimeSyncWs';
|
|
4
|
+
import { createSessionTokenCookie, resolveAuthConfigFromEnv } from './auth';
|
|
5
|
+
class MockWs extends EventEmitter {
|
|
6
|
+
readyState = 1;
|
|
7
|
+
sent = [];
|
|
8
|
+
closeCode;
|
|
9
|
+
closeReason;
|
|
10
|
+
send(data) {
|
|
11
|
+
this.sent.push(data);
|
|
12
|
+
}
|
|
13
|
+
close(code, reason) {
|
|
14
|
+
this.closeCode = code;
|
|
15
|
+
this.closeReason = reason;
|
|
16
|
+
this.readyState = 3;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function makeReq(cookie) {
|
|
20
|
+
return {
|
|
21
|
+
headers: cookie ? { cookie } : {}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
describe('server/realtimeSyncWs auth', () => {
|
|
25
|
+
it('rejects unauthenticated websocket connections when auth is required', () => {
|
|
26
|
+
const authConfig = resolveAuthConfigFromEnv('cloud', {
|
|
27
|
+
TASKFORCE_AUTH_ENABLED: 'true',
|
|
28
|
+
TASKFORCE_AUTH_REQUIRED_FOR_API: 'true',
|
|
29
|
+
TASKFORCE_AUTH_SESSION_SECRET: 'test-secret',
|
|
30
|
+
TASKFORCE_AUTH_SESSION_COOKIE: 'taskforce_session'
|
|
31
|
+
});
|
|
32
|
+
const manager = createRealtimeSyncWsManager({ resolveUserAccess: vi.fn(() => null) }, authConfig, { log: vi.fn(), warn: vi.fn() });
|
|
33
|
+
const ws = new MockWs();
|
|
34
|
+
manager.handleConnection(ws, makeReq());
|
|
35
|
+
expect(ws.closeCode).toBe(1008);
|
|
36
|
+
expect(ws.closeReason).toBe('unauthorized');
|
|
37
|
+
});
|
|
38
|
+
it('accepts authenticated websocket connections', () => {
|
|
39
|
+
const authConfig = resolveAuthConfigFromEnv('cloud', {
|
|
40
|
+
TASKFORCE_AUTH_ENABLED: 'true',
|
|
41
|
+
TASKFORCE_AUTH_REQUIRED_FOR_API: 'true',
|
|
42
|
+
TASKFORCE_AUTH_SESSION_SECRET: 'test-secret',
|
|
43
|
+
TASKFORCE_AUTH_SESSION_COOKIE: 'taskforce_session'
|
|
44
|
+
});
|
|
45
|
+
const sessionCookie = createSessionTokenCookie('session-1', authConfig, {
|
|
46
|
+
role: 'member',
|
|
47
|
+
workspaceId: 'workspace-a',
|
|
48
|
+
userId: 'user-a'
|
|
49
|
+
});
|
|
50
|
+
const cookieHeader = sessionCookie.split(';')[0];
|
|
51
|
+
const manager = createRealtimeSyncWsManager({
|
|
52
|
+
resolveUserAccess: vi.fn((userId, workspaceId) => (userId === 'user-a' && workspaceId === 'workspace-a'
|
|
53
|
+
? { workspaceId }
|
|
54
|
+
: null))
|
|
55
|
+
}, authConfig, { log: vi.fn(), warn: vi.fn() });
|
|
56
|
+
const ws = new MockWs();
|
|
57
|
+
manager.handleConnection(ws, makeReq(cookieHeader));
|
|
58
|
+
expect(ws.closeCode).toBeUndefined();
|
|
59
|
+
manager.broadcastTaskforceUpdate('workspace-a');
|
|
60
|
+
expect(ws.sent).toContain(JSON.stringify({ type: 'taskforce:update', workspaceId: 'workspace-a' }));
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { createRealtimeSyncWsManager } from './realtimeSyncWs';
|
|
4
|
+
import { createSessionTokenCookie, resolveAuthConfigFromEnv } from './auth';
|
|
5
|
+
class MockWs extends EventEmitter {
|
|
6
|
+
readyState = 1;
|
|
7
|
+
bufferedAmount = 0;
|
|
8
|
+
sent = [];
|
|
9
|
+
closeCode;
|
|
10
|
+
closeReason;
|
|
11
|
+
send(data) {
|
|
12
|
+
this.sent.push(data);
|
|
13
|
+
}
|
|
14
|
+
close(code, reason) {
|
|
15
|
+
this.closeCode = code;
|
|
16
|
+
this.closeReason = reason;
|
|
17
|
+
this.readyState = 3;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function makeReq(cookie) {
|
|
21
|
+
return {
|
|
22
|
+
headers: cookie ? { cookie } : {}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function parseMessages(ws) {
|
|
26
|
+
return ws.sent.map((entry) => JSON.parse(entry));
|
|
27
|
+
}
|
|
28
|
+
function makeEvent(seq, workspaceId = 'workspace-a', serverEpoch = 'epoch-1') {
|
|
29
|
+
return {
|
|
30
|
+
eventId: `${serverEpoch}:${seq}`,
|
|
31
|
+
workspaceId,
|
|
32
|
+
cursor: `${serverEpoch}:${seq}`,
|
|
33
|
+
serverEpoch,
|
|
34
|
+
seq,
|
|
35
|
+
entityType: 'task',
|
|
36
|
+
changeType: 'upsert',
|
|
37
|
+
entityIds: [`task-${seq}`],
|
|
38
|
+
dataVersion: seq,
|
|
39
|
+
serverTs: new Date().toISOString()
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
describe('server/realtimeSyncWs replay + backpressure', () => {
|
|
43
|
+
it('replays events after a cursor for subscribed workspace', () => {
|
|
44
|
+
const authConfig = resolveAuthConfigFromEnv('cloud', {
|
|
45
|
+
TASKFORCE_AUTH_ENABLED: 'true',
|
|
46
|
+
TASKFORCE_AUTH_REQUIRED_FOR_API: 'true',
|
|
47
|
+
TASKFORCE_AUTH_SESSION_SECRET: 'test-secret',
|
|
48
|
+
TASKFORCE_AUTH_SESSION_COOKIE: 'taskforce_session'
|
|
49
|
+
});
|
|
50
|
+
const manager = createRealtimeSyncWsManager({
|
|
51
|
+
resolveUserAccess: vi.fn((userId, workspaceId) => (userId === 'user-a' && workspaceId === 'workspace-a' ? { workspaceId } : null))
|
|
52
|
+
}, authConfig, { log: vi.fn(), warn: vi.fn() });
|
|
53
|
+
const ws = new MockWs();
|
|
54
|
+
const cookie = createSessionTokenCookie('session-a', authConfig, {
|
|
55
|
+
role: 'member',
|
|
56
|
+
workspaceId: 'workspace-a',
|
|
57
|
+
userId: 'user-a'
|
|
58
|
+
}).split(';')[0];
|
|
59
|
+
manager.handleConnection(ws, makeReq(cookie));
|
|
60
|
+
manager.broadcastMutation(makeEvent(1));
|
|
61
|
+
manager.broadcastMutation(makeEvent(2));
|
|
62
|
+
manager.broadcastMutation(makeEvent(3));
|
|
63
|
+
ws.emit('message', JSON.stringify({
|
|
64
|
+
type: 'taskforce:replay',
|
|
65
|
+
workspaceId: 'workspace-a',
|
|
66
|
+
cursor: 'epoch-1:1'
|
|
67
|
+
}));
|
|
68
|
+
const replayMsg = parseMessages(ws).find((msg) => msg.type === 'taskforce:replay');
|
|
69
|
+
expect(replayMsg).toBeTruthy();
|
|
70
|
+
expect(Array.isArray(replayMsg?.events)).toBe(true);
|
|
71
|
+
const events = (replayMsg?.events || []);
|
|
72
|
+
expect(events.map((event) => event.seq)).toEqual([2, 3]);
|
|
73
|
+
});
|
|
74
|
+
it('returns deterministic replay-reset on server-epoch mismatch', () => {
|
|
75
|
+
const authConfig = resolveAuthConfigFromEnv('cloud', {
|
|
76
|
+
TASKFORCE_AUTH_ENABLED: 'true',
|
|
77
|
+
TASKFORCE_AUTH_REQUIRED_FOR_API: 'true',
|
|
78
|
+
TASKFORCE_AUTH_SESSION_SECRET: 'test-secret',
|
|
79
|
+
TASKFORCE_AUTH_SESSION_COOKIE: 'taskforce_session'
|
|
80
|
+
});
|
|
81
|
+
const manager = createRealtimeSyncWsManager({
|
|
82
|
+
resolveUserAccess: vi.fn((userId, workspaceId) => (userId === 'user-a' && workspaceId === 'workspace-a' ? { workspaceId } : null))
|
|
83
|
+
}, authConfig, { log: vi.fn(), warn: vi.fn() });
|
|
84
|
+
const ws = new MockWs();
|
|
85
|
+
const cookie = createSessionTokenCookie('session-a', authConfig, {
|
|
86
|
+
role: 'member',
|
|
87
|
+
workspaceId: 'workspace-a',
|
|
88
|
+
userId: 'user-a'
|
|
89
|
+
}).split(';')[0];
|
|
90
|
+
manager.handleConnection(ws, makeReq(cookie));
|
|
91
|
+
manager.broadcastMutation(makeEvent(1, 'workspace-a', 'epoch-2'));
|
|
92
|
+
ws.emit('message', JSON.stringify({
|
|
93
|
+
type: 'taskforce:replay',
|
|
94
|
+
workspaceId: 'workspace-a',
|
|
95
|
+
cursor: 'epoch-1:1'
|
|
96
|
+
}));
|
|
97
|
+
const reset = parseMessages(ws).find((msg) => msg.type === 'taskforce:replay-reset');
|
|
98
|
+
expect(reset).toBeTruthy();
|
|
99
|
+
expect(reset?.reason).toBe('server-epoch-mismatch');
|
|
100
|
+
expect(reset?.serverEpoch).toBe('epoch-2');
|
|
101
|
+
});
|
|
102
|
+
it('returns replay-gap when cursor has been evicted from buffer window', () => {
|
|
103
|
+
const authConfig = resolveAuthConfigFromEnv('cloud', {
|
|
104
|
+
TASKFORCE_AUTH_ENABLED: 'true',
|
|
105
|
+
TASKFORCE_AUTH_REQUIRED_FOR_API: 'true',
|
|
106
|
+
TASKFORCE_AUTH_SESSION_SECRET: 'test-secret',
|
|
107
|
+
TASKFORCE_AUTH_SESSION_COOKIE: 'taskforce_session'
|
|
108
|
+
});
|
|
109
|
+
const manager = createRealtimeSyncWsManager({
|
|
110
|
+
resolveUserAccess: vi.fn((userId, workspaceId) => (userId === 'user-a' && workspaceId === 'workspace-a' ? { workspaceId } : null))
|
|
111
|
+
}, authConfig, { log: vi.fn(), warn: vi.fn() }, { replayMaxEvents: 2, replayTtlMs: 60_000 });
|
|
112
|
+
const ws = new MockWs();
|
|
113
|
+
const cookie = createSessionTokenCookie('session-a', authConfig, {
|
|
114
|
+
role: 'member',
|
|
115
|
+
workspaceId: 'workspace-a',
|
|
116
|
+
userId: 'user-a'
|
|
117
|
+
}).split(';')[0];
|
|
118
|
+
manager.handleConnection(ws, makeReq(cookie));
|
|
119
|
+
manager.broadcastMutation(makeEvent(1));
|
|
120
|
+
manager.broadcastMutation(makeEvent(2));
|
|
121
|
+
manager.broadcastMutation(makeEvent(3));
|
|
122
|
+
ws.emit('message', JSON.stringify({
|
|
123
|
+
type: 'taskforce:replay',
|
|
124
|
+
workspaceId: 'workspace-a',
|
|
125
|
+
cursor: 'epoch-1:0'
|
|
126
|
+
}));
|
|
127
|
+
const gap = parseMessages(ws).find((msg) => msg.type === 'taskforce:replay-gap');
|
|
128
|
+
expect(gap).toBeTruthy();
|
|
129
|
+
expect(gap?.reason).toBe('cursor-evicted');
|
|
130
|
+
expect(gap?.earliestSeq).toBe(2);
|
|
131
|
+
expect(gap?.cursorSeq).toBe(0);
|
|
132
|
+
});
|
|
133
|
+
it('drops slow consumers instead of blocking broadcast loop', () => {
|
|
134
|
+
const authConfig = resolveAuthConfigFromEnv('cloud', {
|
|
135
|
+
TASKFORCE_AUTH_ENABLED: 'true',
|
|
136
|
+
TASKFORCE_AUTH_REQUIRED_FOR_API: 'true',
|
|
137
|
+
TASKFORCE_AUTH_SESSION_SECRET: 'test-secret',
|
|
138
|
+
TASKFORCE_AUTH_SESSION_COOKIE: 'taskforce_session'
|
|
139
|
+
});
|
|
140
|
+
const manager = createRealtimeSyncWsManager({
|
|
141
|
+
resolveUserAccess: vi.fn((userId, workspaceId) => (userId === 'user-a' && workspaceId === 'workspace-a' ? { workspaceId } : null))
|
|
142
|
+
}, authConfig, { log: vi.fn(), warn: vi.fn() }, { maxBufferedBytes: 10 });
|
|
143
|
+
const ws = new MockWs();
|
|
144
|
+
ws.bufferedAmount = 9999;
|
|
145
|
+
const cookie = createSessionTokenCookie('session-a', authConfig, {
|
|
146
|
+
role: 'member',
|
|
147
|
+
workspaceId: 'workspace-a',
|
|
148
|
+
userId: 'user-a'
|
|
149
|
+
}).split(';')[0];
|
|
150
|
+
manager.handleConnection(ws, makeReq(cookie));
|
|
151
|
+
manager.broadcastMutation(makeEvent(1));
|
|
152
|
+
expect(ws.closeCode).toBe(1013);
|
|
153
|
+
expect(ws.closeReason).toBe('slow-consumer');
|
|
154
|
+
});
|
|
155
|
+
it('returns stable replay batches across repeated requests with same cursor', () => {
|
|
156
|
+
const authConfig = resolveAuthConfigFromEnv('cloud', {
|
|
157
|
+
TASKFORCE_AUTH_ENABLED: 'true',
|
|
158
|
+
TASKFORCE_AUTH_REQUIRED_FOR_API: 'true',
|
|
159
|
+
TASKFORCE_AUTH_SESSION_SECRET: 'test-secret',
|
|
160
|
+
TASKFORCE_AUTH_SESSION_COOKIE: 'taskforce_session'
|
|
161
|
+
});
|
|
162
|
+
const manager = createRealtimeSyncWsManager({
|
|
163
|
+
resolveUserAccess: vi.fn((userId, workspaceId) => (userId === 'user-a' && workspaceId === 'workspace-a' ? { workspaceId } : null))
|
|
164
|
+
}, authConfig, { log: vi.fn(), warn: vi.fn() });
|
|
165
|
+
const ws = new MockWs();
|
|
166
|
+
const cookie = createSessionTokenCookie('session-a', authConfig, {
|
|
167
|
+
role: 'member',
|
|
168
|
+
workspaceId: 'workspace-a',
|
|
169
|
+
userId: 'user-a'
|
|
170
|
+
}).split(';')[0];
|
|
171
|
+
manager.handleConnection(ws, makeReq(cookie));
|
|
172
|
+
manager.broadcastMutation(makeEvent(1));
|
|
173
|
+
manager.broadcastMutation(makeEvent(2));
|
|
174
|
+
manager.broadcastMutation(makeEvent(3));
|
|
175
|
+
ws.emit('message', JSON.stringify({
|
|
176
|
+
type: 'taskforce:replay',
|
|
177
|
+
workspaceId: 'workspace-a',
|
|
178
|
+
cursor: 'epoch-1:1'
|
|
179
|
+
}));
|
|
180
|
+
ws.emit('message', JSON.stringify({
|
|
181
|
+
type: 'taskforce:replay',
|
|
182
|
+
workspaceId: 'workspace-a',
|
|
183
|
+
cursor: 'epoch-1:1'
|
|
184
|
+
}));
|
|
185
|
+
const replays = parseMessages(ws).filter((msg) => msg.type === 'taskforce:replay');
|
|
186
|
+
expect(replays.length).toBeGreaterThanOrEqual(2);
|
|
187
|
+
const firstEvents = (replays[0]?.events || []).map((event) => event.eventId);
|
|
188
|
+
const secondEvents = (replays[1]?.events || []).map((event) => event.eventId);
|
|
189
|
+
expect(firstEvents).toEqual(['epoch-1:2', 'epoch-1:3']);
|
|
190
|
+
expect(secondEvents).toEqual(firstEvents);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { createRealtimeSyncWsManager } from './realtimeSyncWs';
|
|
4
|
+
import { createSessionTokenCookie, resolveAuthConfigFromEnv } from './auth';
|
|
5
|
+
class MockWs extends EventEmitter {
|
|
6
|
+
readyState = 1;
|
|
7
|
+
sent = [];
|
|
8
|
+
closeCode;
|
|
9
|
+
send(data) {
|
|
10
|
+
this.sent.push(data);
|
|
11
|
+
}
|
|
12
|
+
close(code) {
|
|
13
|
+
this.closeCode = code;
|
|
14
|
+
this.readyState = 3;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function makeReq(cookie) {
|
|
18
|
+
return {
|
|
19
|
+
headers: cookie ? { cookie } : {}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function parseMessages(ws) {
|
|
23
|
+
return ws.sent.map((entry) => JSON.parse(entry));
|
|
24
|
+
}
|
|
25
|
+
describe('server/realtimeSyncWs workspace isolation', () => {
|
|
26
|
+
it('delivers workspace updates only to subscribers of that workspace', () => {
|
|
27
|
+
const authConfig = resolveAuthConfigFromEnv('cloud', {
|
|
28
|
+
TASKFORCE_AUTH_ENABLED: 'true',
|
|
29
|
+
TASKFORCE_AUTH_REQUIRED_FOR_API: 'true',
|
|
30
|
+
TASKFORCE_AUTH_SESSION_SECRET: 'test-secret',
|
|
31
|
+
TASKFORCE_AUTH_SESSION_COOKIE: 'taskforce_session'
|
|
32
|
+
});
|
|
33
|
+
const manager = createRealtimeSyncWsManager({
|
|
34
|
+
resolveUserAccess: vi.fn((userId, workspaceId) => {
|
|
35
|
+
if (userId === 'user-a' && workspaceId === 'workspace-a')
|
|
36
|
+
return { workspaceId };
|
|
37
|
+
if (userId === 'user-b' && workspaceId === 'workspace-b')
|
|
38
|
+
return { workspaceId };
|
|
39
|
+
return null;
|
|
40
|
+
})
|
|
41
|
+
}, authConfig, { log: vi.fn(), warn: vi.fn() });
|
|
42
|
+
const wsA = new MockWs();
|
|
43
|
+
const wsB = new MockWs();
|
|
44
|
+
const cookieA = createSessionTokenCookie('session-a', authConfig, {
|
|
45
|
+
role: 'member',
|
|
46
|
+
workspaceId: 'workspace-a',
|
|
47
|
+
userId: 'user-a'
|
|
48
|
+
}).split(';')[0];
|
|
49
|
+
const cookieB = createSessionTokenCookie('session-b', authConfig, {
|
|
50
|
+
role: 'member',
|
|
51
|
+
workspaceId: 'workspace-b',
|
|
52
|
+
userId: 'user-b'
|
|
53
|
+
}).split(';')[0];
|
|
54
|
+
manager.handleConnection(wsA, makeReq(cookieA));
|
|
55
|
+
manager.handleConnection(wsB, makeReq(cookieB));
|
|
56
|
+
manager.broadcastTaskforceUpdate('workspace-a');
|
|
57
|
+
manager.broadcastMutation({
|
|
58
|
+
eventId: 'epoch-1:1',
|
|
59
|
+
workspaceId: 'workspace-a',
|
|
60
|
+
cursor: 'epoch-1:1',
|
|
61
|
+
serverEpoch: 'epoch-1',
|
|
62
|
+
seq: 1,
|
|
63
|
+
entityType: 'task',
|
|
64
|
+
changeType: 'upsert',
|
|
65
|
+
entityIds: ['task-1'],
|
|
66
|
+
dataVersion: 1,
|
|
67
|
+
serverTs: new Date().toISOString()
|
|
68
|
+
});
|
|
69
|
+
expect(parseMessages(wsA).some((m) => m.type === 'taskforce:update' && m.workspaceId === 'workspace-a')).toBe(true);
|
|
70
|
+
expect(parseMessages(wsA).some((m) => m.type === 'taskforce:mutation' && m.workspaceId === 'workspace-a')).toBe(true);
|
|
71
|
+
expect(parseMessages(wsB).some((m) => m.type === 'taskforce:update' && m.workspaceId === 'workspace-a')).toBe(false);
|
|
72
|
+
expect(parseMessages(wsB).some((m) => m.type === 'taskforce:mutation' && m.workspaceId === 'workspace-a')).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
it('rejects cross-workspace subscribe attempts', () => {
|
|
75
|
+
const authConfig = resolveAuthConfigFromEnv('cloud', {
|
|
76
|
+
TASKFORCE_AUTH_ENABLED: 'true',
|
|
77
|
+
TASKFORCE_AUTH_REQUIRED_FOR_API: 'true',
|
|
78
|
+
TASKFORCE_AUTH_SESSION_SECRET: 'test-secret',
|
|
79
|
+
TASKFORCE_AUTH_SESSION_COOKIE: 'taskforce_session'
|
|
80
|
+
});
|
|
81
|
+
const manager = createRealtimeSyncWsManager({
|
|
82
|
+
resolveUserAccess: vi.fn((userId, workspaceId) => {
|
|
83
|
+
if (userId === 'user-a' && workspaceId === 'workspace-a')
|
|
84
|
+
return { workspaceId };
|
|
85
|
+
return null;
|
|
86
|
+
})
|
|
87
|
+
}, authConfig, { log: vi.fn(), warn: vi.fn() });
|
|
88
|
+
const wsA = new MockWs();
|
|
89
|
+
const cookieA = createSessionTokenCookie('session-a', authConfig, {
|
|
90
|
+
role: 'member',
|
|
91
|
+
workspaceId: 'workspace-a',
|
|
92
|
+
userId: 'user-a'
|
|
93
|
+
}).split(';')[0];
|
|
94
|
+
manager.handleConnection(wsA, makeReq(cookieA));
|
|
95
|
+
wsA.emit('message', JSON.stringify({ type: 'taskforce:subscribe', workspaceId: 'workspace-b' }));
|
|
96
|
+
manager.broadcastTaskforceUpdate('workspace-b');
|
|
97
|
+
const messages = parseMessages(wsA);
|
|
98
|
+
expect(messages.some((m) => m.type === 'taskforce:subscription-error' && m.workspaceId === 'workspace-b')).toBe(true);
|
|
99
|
+
expect(messages.some((m) => m.type === 'taskforce:update' && m.workspaceId === 'workspace-b')).toBe(false);
|
|
100
|
+
});
|
|
101
|
+
});
|