@taskforcehq/taskforce 0.3.304 → 0.3.306
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 +140 -247
- package/dist/Taskforce.module.css +295 -89
- package/dist/TaskforceCore.js +378 -111
- package/dist/TaskforceCore.test.js +1221 -107
- package/dist/assets/fonts/CourierPrime-Bold.woff2 +0 -0
- package/dist/assets/fonts/CourierPrime-BoldItalic.woff2 +0 -0
- package/dist/assets/fonts/CourierPrime-Italic.woff2 +0 -0
- package/dist/assets/fonts/CourierPrime-Regular.woff2 +0 -0
- package/dist/assets/fonts/Noir_medium.woff2 +0 -0
- package/dist/assets/fonts/Noir_regular.woff2 +0 -0
- package/dist/assets/fonts/RussoOne-Regular.woff2 +0 -0
- package/dist/assets/fonts/SpecialElite-Regular.woff2 +0 -0
- package/dist/compat/workspaceSyncCompat.js +52 -2
- package/dist/compat/workspaceSyncCompat.test.js +38 -1
- package/dist/components/context/ContextAttachmentManager.d.ts +14 -0
- package/dist/components/context/ContextAttachmentManager.js +549 -0
- package/dist/components/features/AgentsModule.d.ts +10 -1
- package/dist/components/features/AgentsModule.js +260 -15
- package/dist/components/features/AgentsModule.test.js +255 -5
- package/dist/components/features/DocumentIndex.d.ts +1 -1
- package/dist/components/features/DocumentIndex.js +1 -1
- package/dist/components/features/DocumentViewer.d.ts +6 -2
- package/dist/components/features/DocumentViewer.js +90 -10
- package/dist/components/features/DocumentWorkspace.d.ts +5 -22
- package/dist/components/features/DocumentWorkspace.js +12 -155
- package/dist/components/features/DocumentWorkspace.test.js +226 -6
- package/dist/components/features/TaskSettings.js +29 -3
- package/dist/components/features/TaskSettings.test.js +42 -1
- package/dist/components/features/documentWorkspaceModel.d.ts +24 -0
- package/dist/components/features/documentWorkspaceModel.js +57 -0
- package/dist/components/features/useDocumentWorkspaceController.d.ts +34 -0
- package/dist/components/features/useDocumentWorkspaceController.js +113 -0
- package/dist/components/task/TaskCard.js +19 -28
- package/dist/components/task/TaskCard.test.js +38 -3
- package/dist/components/task/TaskContextUpload.js +4 -526
- package/dist/components/task/TaskForm.d.ts +8 -8
- package/dist/components/task/TaskForm.js +362 -230
- package/dist/components/task/TaskForm.test.js +558 -381
- package/dist/components/task/TaskKanban.d.ts +2 -1
- package/dist/components/task/TaskKanban.js +96 -14
- package/dist/components/task/TaskKanban.test.js +36 -0
- package/dist/components/ui/EditableAvatarButton.d.ts +18 -0
- package/dist/components/ui/EditableAvatarButton.js +18 -0
- package/dist/components/views/PlanComparisonPage.d.ts +9 -1
- package/dist/components/views/PlanComparisonPage.js +70 -17
- package/dist/components/views/PlanComparisonPage.test.js +289 -41
- package/dist/components/views/PlansPage.js +239 -106
- package/dist/components/views/PlansPage.test.js +593 -42
- package/dist/components/views/StandaloneLayout.js +310 -554
- package/dist/components/views/panels/FilterToolbar.test.js +6 -4
- package/dist/components/views/panels/PlanningDrawer.d.ts +8 -1
- package/dist/components/views/panels/PlanningDrawer.js +18 -11
- package/dist/components/views/panels/PlanningDrawer.test.d.ts +1 -0
- package/dist/components/views/panels/PlanningDrawer.test.js +141 -0
- package/dist/components/views/planningScope.d.ts +20 -0
- package/dist/components/views/planningScope.js +25 -0
- package/dist/components/views/planningScope.test.d.ts +1 -0
- package/dist/components/views/planningScope.test.js +60 -0
- package/dist/components/views/standalone/modals/AccountHubModal.d.ts +27 -14
- package/dist/components/views/standalone/modals/AccountHubModal.js +87 -15
- package/dist/components/views/standalone/modals/AccountHubModal.test.js +42 -2
- package/dist/components/views/standalone/modals/AvatarImageManagerModal.d.ts +20 -0
- package/dist/components/views/standalone/modals/AvatarImageManagerModal.js +127 -0
- package/dist/components/views/standalone/modals/EditProfileModal.d.ts +2 -9
- package/dist/components/views/standalone/modals/EditProfileModal.js +3 -2
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.d.ts +9 -0
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.js +6 -0
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.test.d.ts +1 -0
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.test.js +24 -0
- package/dist/components/views/standalone/modals/SyncStatusModal.d.ts +2 -1
- package/dist/components/views/standalone/modals/SyncStatusModal.js +2 -2
- package/dist/config/envSchema.js +1 -1
- package/dist/core/AiProfileService.d.ts +45 -3
- package/dist/core/AiProfileService.js +774 -63
- package/dist/core/AiProfileService.test.js +22 -2
- package/dist/core/AiProfiles.test.js +761 -2
- package/dist/core/AttachmentLinkService.js +57 -15
- package/dist/core/AuthIdentityService.d.ts +107 -0
- package/dist/core/AuthIdentityService.js +284 -0
- package/dist/core/AuthTokenService.d.ts +4 -0
- package/dist/core/AuthTokenService.js +34 -6
- package/dist/core/AuthTokenService.test.d.ts +1 -0
- package/dist/core/AuthTokenService.test.js +78 -0
- package/dist/core/EntitlementsPolicy.test.js +77 -15
- package/dist/core/GlobalSettingsService.js +115 -6
- package/dist/core/PlanEntitlementService.d.ts +30 -3
- package/dist/core/PlanEntitlementService.js +454 -93
- package/dist/core/PlanFeatureCatalog.test.d.ts +1 -0
- package/dist/core/PlanFeatureCatalog.test.js +84 -0
- package/dist/core/PlanVersionPolicy.test.js +54 -28
- package/dist/core/PlanningEntities.test.js +52 -0
- package/dist/core/SignupMonetizationSettings.test.js +241 -44
- package/dist/core/SyncReconciliationService.js +2 -65
- package/dist/core/SystemAdmin.test.js +244 -88
- package/dist/core/TaskAttachmentsCanonical.test.js +51 -1
- package/dist/core/TaskTaxonomyValidation.test.js +53 -0
- package/dist/core/Taskforce.d.ts +228 -14
- package/dist/core/Taskforce.js +814 -201
- package/dist/core/Taskforce.listTasksSlim.test.d.ts +1 -0
- package/dist/core/Taskforce.listTasksSlim.test.js +91 -0
- package/dist/core/UserProfileAvatarDrafts.test.js +30 -3
- package/dist/core/WorkspaceLifecycleService.js +0 -5
- package/dist/core/WorkspacePermissions.test.js +25 -1
- package/dist/core/WorkspacePlanMode.test.js +128 -27
- package/dist/core/shared.d.ts +3 -1
- package/dist/core/shared.js +16 -1
- package/dist/core/types.d.ts +68 -2
- package/dist/hooks/auth/useTaskforceAuthBootstrap.js +26 -1
- package/dist/hooks/sync/auth.js +3 -1
- package/dist/hooks/sync/bootstrap.js +2 -0
- package/dist/hooks/sync/controlPlane.d.ts +37 -0
- package/dist/hooks/sync/controlPlane.js +78 -0
- package/dist/hooks/sync/controlPlane.test.d.ts +1 -0
- package/dist/hooks/sync/controlPlane.test.js +121 -0
- package/dist/hooks/sync/lifecyclePolicy.d.ts +45 -0
- package/dist/hooks/sync/lifecyclePolicy.js +93 -0
- package/dist/hooks/sync/lifecyclePolicy.test.d.ts +1 -0
- package/dist/hooks/sync/lifecyclePolicy.test.js +124 -0
- package/dist/hooks/sync/orchestratorShared.d.ts +10 -1
- package/dist/hooks/sync/orchestratorShared.js +68 -47
- package/dist/hooks/sync/orchestratorShared.test.js +50 -1
- package/dist/hooks/sync/pullLifecycle.d.ts +31 -0
- package/dist/hooks/sync/pullLifecycle.js +24 -0
- package/dist/hooks/sync/pullLifecycle.test.d.ts +1 -0
- package/dist/hooks/sync/pullLifecycle.test.js +80 -0
- package/dist/hooks/sync/recovery.d.ts +16 -2
- package/dist/hooks/sync/recovery.js +171 -53
- package/dist/hooks/sync/recovery.test.d.ts +1 -0
- package/dist/hooks/sync/recovery.test.js +292 -0
- package/dist/hooks/sync/transfers.d.ts +16 -3
- package/dist/hooks/sync/transfers.js +186 -65
- package/dist/hooks/sync/transfers.test.d.ts +1 -0
- package/dist/hooks/sync/transfers.test.js +396 -0
- package/dist/hooks/sync/useRecentSyncEvents.d.ts +21 -0
- package/dist/hooks/sync/useRecentSyncEvents.js +92 -0
- package/dist/hooks/sync/useRecentSyncEvents.test.d.ts +1 -0
- package/dist/hooks/sync/useRecentSyncEvents.test.js +124 -0
- package/dist/hooks/sync/useSyncStatusActions.d.ts +30 -0
- package/dist/hooks/sync/useSyncStatusActions.js +88 -0
- package/dist/hooks/sync/useSyncStatusActions.test.d.ts +1 -0
- package/dist/hooks/sync/useSyncStatusActions.test.js +133 -0
- package/dist/hooks/sync/useSyncStatusControls.d.ts +25 -0
- package/dist/hooks/sync/useSyncStatusControls.js +60 -0
- package/dist/hooks/sync/useSyncStatusControls.test.d.ts +1 -0
- package/dist/hooks/sync/useSyncStatusControls.test.js +88 -0
- package/dist/hooks/useSyncOrchestrator.aiProfiles.test.js +12 -0
- package/dist/hooks/useSyncOrchestrator.d.ts +16 -6
- package/dist/hooks/useSyncOrchestrator.js +424 -175
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +487 -10
- package/dist/hooks/useTaskData.js +8 -3
- package/dist/hooks/useTaskData.test.js +45 -0
- package/dist/hooks/useTaskMutations.d.ts +2 -1
- package/dist/hooks/useTaskMutations.js +12 -1
- package/dist/hooks/useTaskMutations.test.js +30 -1
- package/dist/hooks/useTaskforce.d.ts +65 -4
- package/dist/hooks/useTaskforce.js +564 -243
- package/dist/hooks/useTaskforce.runtime-routing.test.d.ts +1 -0
- package/dist/hooks/useTaskforce.runtime-routing.test.js +152 -0
- package/dist/hooks/useTaskforce.sync-behavior.test.js +2454 -208
- package/dist/hooks/useWorkspaceSyncController.d.ts +4 -1
- package/dist/hooks/useWorkspaceSyncController.js +17 -2
- package/dist/hooks/useWorkspaceSyncController.test.js +1 -0
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.d.ts +16 -0
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.js +316 -35
- package/dist/localization/locales/en-US.d.ts +0 -1
- package/dist/localization/locales/en-US.js +0 -1
- package/dist/localization/locales/es-419.js +0 -1
- package/dist/localization/locales/pt-BR.js +0 -1
- package/dist/mcp/adminWorkspaceRegistrar.d.ts +2 -0
- package/dist/mcp/adminWorkspaceRegistrar.js +154 -0
- package/dist/mcp/collaborationRegistrar.d.ts +2 -0
- package/dist/mcp/collaborationRegistrar.js +71 -0
- package/dist/mcp/documentAssetRegistrar.d.ts +2 -0
- package/dist/mcp/documentAssetRegistrar.js +346 -0
- package/dist/mcp/runtime.d.ts +2 -0
- package/dist/mcp/runtime.js +2433 -3534
- package/dist/mcp/runtime.test.js +440 -2
- package/dist/mcp/taskPlanningRegistrar.d.ts +2 -0
- package/dist/mcp/taskPlanningRegistrar.js +418 -0
- package/dist/mcp/toolCatalog.d.ts +35 -0
- package/dist/mcp/toolCatalog.js +3 -0
- package/dist/migrations/taskSchemaMigrations.d.ts +1 -1
- package/dist/migrations/taskSchemaMigrations.js +171 -61
- package/dist/migrations/taskSchemaMigrations.test.js +15 -0
- package/dist/resources/templates/workflow-sources/workflowDocs.mjs +6 -6
- package/dist/resources/templates/workflows/collaborate.yaml +1 -1
- package/dist/resources/templates/workflows/evaluate.yaml +2 -2
- package/dist/resources/templates/workflows/plan.yaml +1 -1
- package/dist/resources/templates/workflows/review.yaml +2 -2
- package/dist/server/annotatedAttachmentsRoutes.test.js +3 -3
- package/dist/server/auth/providers/apple.d.ts +33 -0
- package/dist/server/auth/providers/apple.js +82 -0
- package/dist/server/auth/providers/appleClientSecret.d.ts +37 -0
- package/dist/server/auth/providers/appleClientSecret.js +65 -0
- package/dist/server/auth/providers/github.d.ts +26 -0
- package/dist/server/auth/providers/github.js +86 -0
- package/dist/server/auth/providers/google.d.ts +21 -0
- package/dist/server/auth/providers/google.js +56 -0
- package/dist/server/auth/providers/types.d.ts +21 -0
- package/dist/server/auth/providers/types.js +1 -0
- package/dist/server/auth.d.ts +2 -0
- package/dist/server/auth.js +6 -3
- package/dist/server/documentReviewRoutes.test.js +36 -3
- package/dist/server/index.cookieProxy.test.js +1 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.js +120 -9
- package/dist/server/index.rateLimit.test.js +3 -0
- package/dist/server/index.test.js +106 -3
- package/dist/server/routes/admin.d.ts +4 -5
- package/dist/server/routes/admin.js +410 -80
- package/dist/server/routes/annotatedAttachments.d.ts +1 -1
- package/dist/server/routes/annotatedAttachments.js +1 -1
- package/dist/server/routes/auth.d.ts +16 -6
- package/dist/server/routes/auth.js +1015 -118
- package/dist/server/routes/authSupport.d.ts +30 -0
- package/dist/server/routes/authSupport.js +81 -0
- package/dist/server/routes/billing.d.ts +1 -1
- package/dist/server/routes/billing.js +276 -34
- package/dist/server/routes/billing.test.js +760 -52
- package/dist/server/routes/documentReviews.d.ts +1 -1
- package/dist/server/routes/documentReviews.js +1 -1
- package/dist/server/routes/documents.d.ts +5 -2
- package/dist/server/routes/documents.js +242 -74
- package/dist/server/routes/primitives.d.ts +11 -0
- package/dist/server/routes/primitives.js +73 -0
- package/dist/server/routes/resources.d.ts +1 -1
- package/dist/server/routes/resources.js +1 -1
- package/dist/server/routes/shared.d.ts +29 -3
- package/dist/server/routes/shared.js +69 -4
- package/dist/server/routes/sync.d.ts +1 -1
- package/dist/server/routes/sync.integration.test.js +437 -39
- package/dist/server/routes/sync.js +62 -606
- package/dist/server/routes/syncAuxRoutes.d.ts +15 -0
- package/dist/server/routes/syncAuxRoutes.js +91 -0
- package/dist/server/routes/syncAuxRoutes.test.d.ts +1 -0
- package/dist/server/routes/syncAuxRoutes.test.js +158 -0
- package/dist/server/routes/syncPullApplyRoutes.d.ts +36 -0
- package/dist/server/routes/syncPullApplyRoutes.js +204 -0
- package/dist/server/routes/syncPushRoutes.d.ts +24 -0
- package/dist/server/routes/syncPushRoutes.js +212 -0
- package/dist/server/routes/syncRouteGuards.d.ts +36 -0
- package/dist/server/routes/syncRouteGuards.js +67 -0
- package/dist/server/routes/syncRouteGuards.test.d.ts +1 -0
- package/dist/server/routes/syncRouteGuards.test.js +94 -0
- package/dist/server/routes/syncRouteTypes.d.ts +13 -0
- package/dist/server/routes/syncRouteTypes.js +1 -0
- package/dist/server/routes/syncSnapshotRoutes.d.ts +66 -0
- package/dist/server/routes/syncSnapshotRoutes.js +180 -0
- package/dist/server/routes/tasks.d.ts +1 -1
- package/dist/server/routes/tasks.js +44 -2
- package/dist/server/routes/workspaces.d.ts +1 -1
- package/dist/server/routes/workspaces.js +37 -6
- package/dist/server/routes.d.ts +2 -9
- package/dist/server/routes.js +136 -165
- package/dist/server/routes.test.js +2457 -162
- package/dist/services/workflowExportSnapshots.test.js +2 -0
- package/dist/shared/aiProfileSeatScope.d.ts +5 -0
- package/dist/shared/aiProfileSeatScope.js +21 -0
- package/dist/shared/passwordPolicy.d.ts +13 -0
- package/dist/shared/passwordPolicy.js +84 -0
- package/dist/shared/passwordPolicy.test.d.ts +1 -0
- package/dist/shared/passwordPolicy.test.js +34 -0
- package/dist/storage/workspaceAssetStore.d.ts +15 -3
- package/dist/storage/workspaceAssetStore.js +132 -44
- package/dist/storage/workspaceAssetStore.test.js +93 -6
- package/dist/styles/fonts.css +70 -0
- package/dist/sync/collaborationSyncPayload.d.ts +6 -1
- package/dist/sync/collaborationSyncPayload.js +17 -11
- package/dist/sync/collaborationSyncPayload.test.js +13 -1
- package/dist/sync/contentSyncState.d.ts +4 -8
- package/dist/sync/contentSyncState.js +33 -77
- package/dist/sync/syncApplyHandlers.d.ts +7 -0
- package/dist/sync/syncApplyHandlers.js +28 -13
- package/dist/sync/syncApplyHandlers.test.js +72 -3
- package/dist/sync/syncFieldSemantics.d.ts +12 -0
- package/dist/sync/syncFieldSemantics.js +55 -0
- package/dist/sync/syncResourceAdapters.d.ts +44 -0
- package/dist/sync/syncResourceAdapters.js +77 -0
- package/dist/sync/syncService.d.ts +6 -0
- package/dist/sync/syncService.js +60 -0
- package/dist/sync/syncService.test.js +71 -3
- package/dist/sync/taskSyncChangeKey.d.ts +2 -0
- package/dist/sync/taskSyncChangeKey.js +143 -0
- package/dist/sync/taskSyncPayload.js +3 -8
- package/dist/sync/workspacePullFeed.js +4 -3
- package/dist/sync/workspacePullFeed.test.js +43 -0
- package/dist/sync/workspaceRepair.js +5 -2
- package/dist/sync/workspaceSyncModel.d.ts +48 -0
- package/dist/sync/workspaceSyncModel.js +195 -31
- package/dist/sync/workspaceSyncModel.test.js +325 -12
- package/dist/sync/workspaceSyncState.d.ts +19 -0
- package/dist/sync/workspaceSyncState.js +3 -1
- package/dist/sync/workspaceSyncSurface.js +3 -8
- package/dist/types.d.ts +17 -0
- package/dist/ui/assets/AgentsModule-DrLawwNl.js +1 -0
- package/dist/ui/assets/{AnnotatedAttachmentWorkspace-BlS-cqnl.js → AnnotatedAttachmentWorkspace-Z9_whf7F.js} +1 -1
- package/dist/ui/assets/CourierPrime-Bold-BuLj_dpw.woff2 +0 -0
- package/dist/ui/assets/CourierPrime-BoldItalic-BrK2pUkZ.woff2 +0 -0
- package/dist/ui/assets/CourierPrime-Italic-DFUZK5Ey.woff2 +0 -0
- package/dist/ui/assets/CourierPrime-Regular-BsKphzVf.woff2 +0 -0
- package/dist/ui/assets/DocumentWorkspace-B03MaSkw.js +252 -0
- package/dist/ui/assets/DocumentWorkspace-Dhdso07p.css +1 -0
- package/dist/ui/assets/{InitiativesModule-BjR6iBf9.js → InitiativesModule-9E6ParrY.js} +1 -1
- package/dist/ui/assets/Noir_medium-bxQwKGzB.woff2 +0 -0
- package/dist/ui/assets/Noir_regular-ojf2kxlG.woff2 +0 -0
- package/dist/ui/assets/PlansPage-CvfnMiWq.css +1 -0
- package/dist/ui/assets/PlansPage-DRXscYxH.js +1 -0
- package/dist/ui/assets/RussoOne-Regular-Cu_qq_qC.woff2 +0 -0
- package/dist/ui/assets/SpecialElite-Regular-Di6gSvAS.woff2 +0 -0
- package/dist/ui/assets/TaskSettings-DZX4jk7e.js +9 -0
- package/dist/ui/assets/{WorkflowsModule-DnFqdUME.js → WorkflowsModule-BA7jcEpH.js} +1 -1
- package/dist/ui/assets/index-9eT8e0Lu.css +1 -0
- package/dist/ui/assets/index-C6k75jr8.js +6 -0
- package/dist/ui/assets/{vendor-icons-I7ZwG1z_.js → vendor-icons-DuEd_65c.js} +1 -1
- package/dist/ui/fonts/CourierPrime-Bold.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-Bold.woff2 +0 -0
- package/dist/ui/fonts/CourierPrime-BoldItalic.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-BoldItalic.woff2 +0 -0
- package/dist/ui/fonts/CourierPrime-Italic.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-Italic.woff2 +0 -0
- package/dist/ui/fonts/CourierPrime-Regular.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-Regular.woff2 +0 -0
- package/dist/ui/fonts/Noir_medium.otf +0 -0
- package/dist/ui/fonts/Noir_medium.woff2 +0 -0
- package/dist/ui/fonts/Noir_regular.otf +0 -0
- package/dist/ui/fonts/Noir_regular.woff2 +0 -0
- package/dist/ui/fonts/RussoOne-Regular.woff2 +0 -0
- package/dist/ui/fonts/SpecialElite-Regular.ttf +0 -0
- package/dist/ui/fonts/SpecialElite-Regular.woff2 +0 -0
- package/dist/ui/index.html +3 -3
- package/dist/utils/accountProfileSummaryCache.d.ts +5 -0
- package/dist/utils/assignees.d.ts +2 -0
- package/dist/utils/assignees.js +2 -0
- package/dist/utils/avatarUpload.d.ts +27 -0
- package/dist/utils/avatarUpload.js +132 -0
- package/dist/utils/avatarUpload.test.d.ts +1 -0
- package/dist/utils/avatarUpload.test.js +40 -0
- package/dist/utils/bootstrapTrace.d.ts +7 -0
- package/dist/utils/bootstrapTrace.js +29 -0
- package/dist/utils/commercialLifecyclePresentation.d.ts +19 -0
- package/dist/utils/commercialLifecyclePresentation.js +199 -0
- package/dist/utils/contextAssetEvents.d.ts +2 -0
- package/dist/utils/syncEventDetails.d.ts +3 -0
- package/dist/utils/syncEventDetails.js +64 -0
- package/dist/utils/syncEventDetails.test.d.ts +1 -0
- package/dist/utils/syncEventDetails.test.js +23 -0
- package/dist/utils/syncEventPresentation.d.ts +15 -0
- package/dist/utils/syncEventPresentation.js +129 -0
- package/dist/utils/syncEventPresentation.test.d.ts +1 -0
- package/dist/utils/syncEventPresentation.test.js +64 -0
- package/dist/utils/syncStatusPresentation.d.ts +72 -0
- package/dist/utils/syncStatusPresentation.js +217 -0
- package/dist/utils/syncStatusPresentation.test.d.ts +1 -0
- package/dist/utils/syncStatusPresentation.test.js +164 -0
- package/dist/utils/taskActivity.d.ts +2 -0
- package/dist/utils/taskActivity.js +228 -22
- package/dist/utils/taskActivity.test.js +119 -8
- package/dist/utils/workspaceSyncPresentation.d.ts +4 -0
- package/dist/utils/workspaceSyncPresentation.js +68 -2
- package/dist/utils/workspaceSyncPresentation.test.js +36 -1
- package/package.json +10 -2
- package/scripts/check-cloud-mcp.mjs +83 -0
- package/scripts/export-sqlite-to-postgres.mjs +7 -9
- package/scripts/playwright-auth.sh +5 -1
- package/scripts/run-billing-performance-smoke.sh +24 -0
- package/scripts/run-e2e-realtime.sh +17 -3
- package/scripts/run-smoke.sh +17 -5
- package/scripts/run-soak.sh +17 -5
- package/src/resources/templates/workflow-sources/workflowDocs.mjs +6 -6
- package/src/resources/templates/workflows/collaborate.yaml +1 -1
- package/src/resources/templates/workflows/evaluate.yaml +2 -2
- package/src/resources/templates/workflows/plan.yaml +1 -1
- package/src/resources/templates/workflows/review.yaml +2 -2
- package/dist/ui/assets/AgentsModule-BLWVbuKP.js +0 -1
- package/dist/ui/assets/DocumentWorkspace-BH_6DF6x.js +0 -250
- package/dist/ui/assets/DocumentWorkspace-C_8T8oz-.css +0 -1
- package/dist/ui/assets/PlansPage-C2dd2n1X.css +0 -1
- package/dist/ui/assets/PlansPage-CSDQ4sLa.js +0 -1
- package/dist/ui/assets/RussoOne-Regular-C3BxZIj7.ttf +0 -0
- package/dist/ui/assets/TaskSettings-CEDy34Jo.js +0 -9
- package/dist/ui/assets/index-DXUdtH1B.js +0 -6
- package/dist/ui/assets/index-Ii0B0rTO.css +0 -1
- package/scripts/migrate-planning-model.ts +0 -233
|
@@ -0,0 +1,549 @@
|
|
|
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, Download, File, FileUp, Loader2, PencilLine, Trash2, ChevronDown, ChevronRight } from 'lucide-react';
|
|
4
|
+
import styles from '../../Taskforce.module.css';
|
|
5
|
+
import { dispatchOpenMarkdownDocument } from '../../utils/contextFiles';
|
|
6
|
+
import { canOpenAnnotatedAttachment, dispatchOpenAnnotatedAttachment } from '../../utils/annotatedAttachments';
|
|
7
|
+
import { dispatchTaskforceContextAssetsMutated } from '../../utils/contextAssetEvents';
|
|
8
|
+
import { getDocumentReferenceLabel } from '../../utils/documentReferences';
|
|
9
|
+
const ACCEPTED_CONTEXT_FILE_TYPES = [
|
|
10
|
+
'.png', '.jpg', '.jpeg', '.webp', '.gif',
|
|
11
|
+
'.pdf', '.txt', '.md', '.csv', '.json', '.doc', '.docx',
|
|
12
|
+
'.html', '.js', '.ts', '.tsx', '.css', '.py', '.java', '.go', '.rs', '.sh'
|
|
13
|
+
].join(',');
|
|
14
|
+
const SUPPORTED_CLIPBOARD_IMAGE_TYPES = new Set(['image/png', 'image/jpeg', 'image/webp']);
|
|
15
|
+
const ACCEPTED_CONTEXT_EXTENSIONS = new Set(ACCEPTED_CONTEXT_FILE_TYPES.split(',').map((ext) => ext.trim().toLowerCase()));
|
|
16
|
+
const MAX_CONTEXT_FILE_SIZE_BYTES = 10 * 1024 * 1024; // 10 MB per file
|
|
17
|
+
const CONTEXT_NOTICE_TIMEOUT_MS = 3500;
|
|
18
|
+
function getFileExtension(fileName) {
|
|
19
|
+
const trimmed = fileName.trim().toLowerCase();
|
|
20
|
+
const dotIdx = trimmed.lastIndexOf('.');
|
|
21
|
+
if (dotIdx === -1)
|
|
22
|
+
return '';
|
|
23
|
+
return trimmed.slice(dotIdx);
|
|
24
|
+
}
|
|
25
|
+
function formatFileList(fileNames) {
|
|
26
|
+
if (fileNames.length === 0)
|
|
27
|
+
return '';
|
|
28
|
+
const shown = fileNames.slice(0, 3).join(', ');
|
|
29
|
+
const extra = fileNames.length - 3;
|
|
30
|
+
return extra > 0 ? `${shown}, +${extra} more` : shown;
|
|
31
|
+
}
|
|
32
|
+
function getLocalFileFingerprint(file) {
|
|
33
|
+
return `${file.name.trim().toLowerCase()}::${file.size}::${file.lastModified}`;
|
|
34
|
+
}
|
|
35
|
+
function readFileAsDataUrl(file) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const reader = new FileReader();
|
|
38
|
+
reader.onload = () => resolve(String(reader.result || ''));
|
|
39
|
+
reader.onerror = () => reject(reader.error || new Error('Failed to read file'));
|
|
40
|
+
reader.readAsDataURL(file);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function isImagePath(path) {
|
|
44
|
+
return /\.(png|jpe?g|webp|gif)(\?|#|$)/i.test(path);
|
|
45
|
+
}
|
|
46
|
+
function getClipboardImageType(item) {
|
|
47
|
+
const rawTypes = item.types;
|
|
48
|
+
if (!rawTypes)
|
|
49
|
+
return null;
|
|
50
|
+
for (const type of Array.from(rawTypes)) {
|
|
51
|
+
const normalizedType = String(type || '').trim().toLowerCase();
|
|
52
|
+
if (SUPPORTED_CLIPBOARD_IMAGE_TYPES.has(normalizedType)) {
|
|
53
|
+
return normalizedType;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
function buildDownloadUrl(pathValue, displayName) {
|
|
59
|
+
const separator = pathValue.includes('?') ? '&' : '?';
|
|
60
|
+
return `${pathValue}${separator}download=1&filename=${encodeURIComponent(displayName)}`;
|
|
61
|
+
}
|
|
62
|
+
function getAttachmentDisplayName(item) {
|
|
63
|
+
if (typeof item === 'string')
|
|
64
|
+
return item.split('/').pop() || 'Context file';
|
|
65
|
+
return item.displayName || item.originalFilename || item.caption || item.fsPath || item.path.split('/').pop() || 'Context file';
|
|
66
|
+
}
|
|
67
|
+
function getAttachmentTypeLabel(item) {
|
|
68
|
+
const candidates = typeof item === 'string'
|
|
69
|
+
? [item]
|
|
70
|
+
: [item.originalFilename, item.displayName, item.caption, item.fsPath, item.path];
|
|
71
|
+
for (const candidate of candidates) {
|
|
72
|
+
if (!candidate)
|
|
73
|
+
continue;
|
|
74
|
+
const ext = getFileExtension(candidate);
|
|
75
|
+
if (ext)
|
|
76
|
+
return ext.replace('.', '').slice(0, 5).toUpperCase();
|
|
77
|
+
}
|
|
78
|
+
const path = typeof item === 'string' ? item : item.path;
|
|
79
|
+
return /^https?:\/\//i.test(path) ? 'LINK' : 'FILE';
|
|
80
|
+
}
|
|
81
|
+
export function ContextAttachmentManager(props) {
|
|
82
|
+
const { ownerType = 'task', ownerId, ownerReferenceLabel, workspaceId, attachments, onAddAttachment, onRemoveAttachment, onUpdateAttachmentCaption, } = props;
|
|
83
|
+
const inputRef = useRef(null);
|
|
84
|
+
const [uploading, setUploading] = useState(false);
|
|
85
|
+
const [uploadError, setUploadError] = useState(null);
|
|
86
|
+
const [linkValue, setLinkValue] = useState('');
|
|
87
|
+
const [linkError, setLinkError] = useState(null);
|
|
88
|
+
const [contextNotice, setContextNotice] = useState(null);
|
|
89
|
+
const [showContextUpload, setShowContextUpload] = useState(false);
|
|
90
|
+
const [isDropActive, setIsDropActive] = useState(false);
|
|
91
|
+
const [dragDepth, setDragDepth] = useState(0);
|
|
92
|
+
const contextKeyRef = useRef(new Set());
|
|
93
|
+
const localUploadFingerprintRef = useRef(new Set());
|
|
94
|
+
const normalizeKey = (value) => (value || '').trim();
|
|
95
|
+
const getContextKeys = (path, fsPath) => {
|
|
96
|
+
const keys = [];
|
|
97
|
+
const normalizedPath = normalizeKey(path);
|
|
98
|
+
const normalizedFsPath = normalizeKey(fsPath);
|
|
99
|
+
if (normalizedPath)
|
|
100
|
+
keys.push(`path:${normalizedPath}`);
|
|
101
|
+
if (normalizedFsPath)
|
|
102
|
+
keys.push(`fs:${normalizedFsPath}`);
|
|
103
|
+
return keys;
|
|
104
|
+
};
|
|
105
|
+
const keySetFromFiles = useMemo(() => {
|
|
106
|
+
const next = new Set();
|
|
107
|
+
attachments.forEach((item) => {
|
|
108
|
+
if (typeof item === 'string') {
|
|
109
|
+
getContextKeys(item).forEach((key) => next.add(key));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
getContextKeys(item.path, item.fsPath).forEach((key) => next.add(key));
|
|
113
|
+
});
|
|
114
|
+
return next;
|
|
115
|
+
}, [attachments]);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
contextKeyRef.current = new Set(keySetFromFiles);
|
|
118
|
+
}, [keySetFromFiles]);
|
|
119
|
+
const hasAnyKey = (set, keys) => keys.some((key) => set.has(key));
|
|
120
|
+
const addKeys = (set, keys) => keys.forEach((key) => set.add(key));
|
|
121
|
+
const trimmedWorkspaceId = String(workspaceId || '').trim();
|
|
122
|
+
const trimmedOwnerId = String(ownerId || '').trim();
|
|
123
|
+
const ownerTypeLabel = ownerType === 'initiative'
|
|
124
|
+
? 'initiative'
|
|
125
|
+
: ownerType === 'workstream'
|
|
126
|
+
? 'workstream'
|
|
127
|
+
: 'task';
|
|
128
|
+
const ownerUploadPayload = {
|
|
129
|
+
ownerType,
|
|
130
|
+
ownerId: trimmedOwnerId || null,
|
|
131
|
+
taskId: ownerType === 'task' ? (trimmedOwnerId || null) : null,
|
|
132
|
+
};
|
|
133
|
+
const buildApiHeaders = (contentType = 'application/json') => {
|
|
134
|
+
const headers = { 'Content-Type': contentType };
|
|
135
|
+
if (trimmedWorkspaceId)
|
|
136
|
+
headers['x-taskforce-workspace-id'] = trimmedWorkspaceId;
|
|
137
|
+
return headers;
|
|
138
|
+
};
|
|
139
|
+
const addLink = (rawValue, clearInput = true, contextKeySet = contextKeyRef.current) => {
|
|
140
|
+
const trimmed = rawValue.trim();
|
|
141
|
+
if (!trimmed)
|
|
142
|
+
return 'invalid';
|
|
143
|
+
const isHttp = /^https?:\/\//i.test(trimmed);
|
|
144
|
+
if (!isHttp)
|
|
145
|
+
return 'invalid';
|
|
146
|
+
const normalizedPath = trimmed;
|
|
147
|
+
const keys = getContextKeys(normalizedPath);
|
|
148
|
+
if (hasAnyKey(contextKeySet, keys))
|
|
149
|
+
return 'duplicate';
|
|
150
|
+
const nameFromPath = trimmed.split(/[\\/]/).pop() || trimmed;
|
|
151
|
+
onAddAttachment({
|
|
152
|
+
path: normalizedPath,
|
|
153
|
+
caption: nameFromPath,
|
|
154
|
+
timestamp: new Date().toISOString()
|
|
155
|
+
});
|
|
156
|
+
addKeys(contextKeySet, keys);
|
|
157
|
+
if (clearInput)
|
|
158
|
+
setLinkValue('');
|
|
159
|
+
setLinkError(null);
|
|
160
|
+
return 'added';
|
|
161
|
+
};
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (!contextNotice)
|
|
164
|
+
return;
|
|
165
|
+
const timeoutId = window.setTimeout(() => {
|
|
166
|
+
setContextNotice(null);
|
|
167
|
+
}, CONTEXT_NOTICE_TIMEOUT_MS);
|
|
168
|
+
return () => window.clearTimeout(timeoutId);
|
|
169
|
+
}, [contextNotice]);
|
|
170
|
+
const handleSelectedFiles = async (selectedFilesInput) => {
|
|
171
|
+
if (selectedFilesInput.length === 0)
|
|
172
|
+
return;
|
|
173
|
+
setUploadError(null);
|
|
174
|
+
setContextNotice(null);
|
|
175
|
+
const selectedFiles = selectedFilesInput;
|
|
176
|
+
const unsupportedFiles = [];
|
|
177
|
+
const oversizedFiles = [];
|
|
178
|
+
const localDuplicateFiles = [];
|
|
179
|
+
const uploadCandidates = [];
|
|
180
|
+
const localFingerprintSet = new Set(localUploadFingerprintRef.current);
|
|
181
|
+
selectedFiles.forEach((file) => {
|
|
182
|
+
const ext = getFileExtension(file.name);
|
|
183
|
+
if (!ACCEPTED_CONTEXT_EXTENSIONS.has(ext)) {
|
|
184
|
+
unsupportedFiles.push(file.name);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (file.size > MAX_CONTEXT_FILE_SIZE_BYTES) {
|
|
188
|
+
oversizedFiles.push(file.name);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const fingerprint = getLocalFileFingerprint(file);
|
|
192
|
+
if (localFingerprintSet.has(fingerprint)) {
|
|
193
|
+
localDuplicateFiles.push(file.name);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
localFingerprintSet.add(fingerprint);
|
|
197
|
+
uploadCandidates.push({ file, fingerprint });
|
|
198
|
+
});
|
|
199
|
+
const validationNotices = [];
|
|
200
|
+
if (unsupportedFiles.length > 0) {
|
|
201
|
+
validationNotices.push(`${unsupportedFiles.length} unsupported file${unsupportedFiles.length === 1 ? '' : 's'} skipped: ${formatFileList(unsupportedFiles)}.`);
|
|
202
|
+
}
|
|
203
|
+
if (oversizedFiles.length > 0) {
|
|
204
|
+
validationNotices.push(`${oversizedFiles.length} file${oversizedFiles.length === 1 ? '' : 's'} over 10 MB skipped: ${formatFileList(oversizedFiles)}.`);
|
|
205
|
+
}
|
|
206
|
+
if (localDuplicateFiles.length > 0) {
|
|
207
|
+
validationNotices.push(`${localDuplicateFiles.length} local duplicate file${localDuplicateFiles.length === 1 ? '' : 's'} skipped before upload: ${formatFileList(localDuplicateFiles)}.`);
|
|
208
|
+
}
|
|
209
|
+
if (uploadCandidates.length === 0) {
|
|
210
|
+
if (validationNotices.length > 0)
|
|
211
|
+
setContextNotice(validationNotices.join(' '));
|
|
212
|
+
if (inputRef.current)
|
|
213
|
+
inputRef.current.value = '';
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
setUploading(true);
|
|
217
|
+
const contextKeySet = new Set(contextKeyRef.current);
|
|
218
|
+
let duplicateCount = 0;
|
|
219
|
+
try {
|
|
220
|
+
for (const { file, fingerprint } of uploadCandidates) {
|
|
221
|
+
let data = null;
|
|
222
|
+
// Keep uploads same-origin so local runtime never routes attachments through the cloud API base.
|
|
223
|
+
const initRes = await fetch('/api/taskforce/context-upload/init', {
|
|
224
|
+
method: 'POST',
|
|
225
|
+
headers: buildApiHeaders(),
|
|
226
|
+
body: JSON.stringify({
|
|
227
|
+
originalName: file.name,
|
|
228
|
+
mimeType: file.type || 'application/octet-stream',
|
|
229
|
+
size: file.size,
|
|
230
|
+
...ownerUploadPayload,
|
|
231
|
+
workspaceId: trimmedWorkspaceId || null
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
if (initRes.ok) {
|
|
235
|
+
const initData = await initRes.json();
|
|
236
|
+
if (initData?.success && typeof initData?.uploadUrl === 'string' && typeof initData?.path === 'string') {
|
|
237
|
+
const uploadRes = await fetch(initData.uploadUrl, {
|
|
238
|
+
method: String(initData.method || 'PUT'),
|
|
239
|
+
headers: initData.headers || { 'Content-Type': file.type || 'application/octet-stream' },
|
|
240
|
+
body: file
|
|
241
|
+
});
|
|
242
|
+
if (!uploadRes.ok) {
|
|
243
|
+
throw new Error(`Upload failed for ${file.name}`);
|
|
244
|
+
}
|
|
245
|
+
const finalizeRes = await fetch('/api/taskforce/context-upload/finalize', {
|
|
246
|
+
method: 'POST',
|
|
247
|
+
headers: buildApiHeaders(),
|
|
248
|
+
body: JSON.stringify({
|
|
249
|
+
relativePath: initData.relativePath,
|
|
250
|
+
mimeType: file.type || 'application/octet-stream',
|
|
251
|
+
originalName: file.name,
|
|
252
|
+
size: file.size,
|
|
253
|
+
...ownerUploadPayload,
|
|
254
|
+
workspaceId: trimmedWorkspaceId || null
|
|
255
|
+
})
|
|
256
|
+
});
|
|
257
|
+
if (!finalizeRes.ok) {
|
|
258
|
+
const finalizeError = await finalizeRes.json().catch(() => ({}));
|
|
259
|
+
throw new Error(finalizeError?.error || `Upload failed for ${file.name}`);
|
|
260
|
+
}
|
|
261
|
+
data = await finalizeRes.json().catch(() => null);
|
|
262
|
+
}
|
|
263
|
+
else if (initData?.success && typeof initData?.path === 'string') {
|
|
264
|
+
data = initData;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (!data) {
|
|
268
|
+
const encoded = await readFileAsDataUrl(file);
|
|
269
|
+
const res = await fetch('/api/taskforce/context-upload', {
|
|
270
|
+
method: 'POST',
|
|
271
|
+
headers: buildApiHeaders(),
|
|
272
|
+
body: JSON.stringify({
|
|
273
|
+
file: encoded,
|
|
274
|
+
originalName: file.name,
|
|
275
|
+
...ownerUploadPayload,
|
|
276
|
+
workspaceId: trimmedWorkspaceId || null
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
if (!res.ok) {
|
|
280
|
+
throw new Error(`Upload failed for ${file.name}`);
|
|
281
|
+
}
|
|
282
|
+
data = await res.json();
|
|
283
|
+
}
|
|
284
|
+
if (!data?.success || !data?.path) {
|
|
285
|
+
throw new Error(`Upload failed for ${file.name}`);
|
|
286
|
+
}
|
|
287
|
+
const keys = getContextKeys(data.path, data.fsPath);
|
|
288
|
+
if (hasAnyKey(contextKeySet, keys)) {
|
|
289
|
+
duplicateCount += 1;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
onAddAttachment({
|
|
293
|
+
path: data.path,
|
|
294
|
+
fsPath: data.fsPath,
|
|
295
|
+
caption: typeof data.caption === 'string' && data.caption.trim().length > 0 ? data.caption : file.name,
|
|
296
|
+
displayName: typeof data.displayName === 'string' ? data.displayName : undefined,
|
|
297
|
+
originalFilename: typeof data.originalFilename === 'string' ? data.originalFilename : file.name,
|
|
298
|
+
assetId: typeof data.assetId === 'string' ? data.assetId : undefined,
|
|
299
|
+
referenceNumber: typeof data.referenceNumber === 'number' ? data.referenceNumber : null,
|
|
300
|
+
referenceLabel: typeof data.referenceLabel === 'string' ? data.referenceLabel : undefined,
|
|
301
|
+
taskId: ownerType === 'task' && typeof data.taskId === 'string' ? data.taskId : null,
|
|
302
|
+
timestamp: new Date().toISOString()
|
|
303
|
+
});
|
|
304
|
+
dispatchTaskforceContextAssetsMutated({
|
|
305
|
+
workspaceId: trimmedWorkspaceId || 'default',
|
|
306
|
+
ownerType,
|
|
307
|
+
ownerId: trimmedOwnerId || null,
|
|
308
|
+
taskId: ownerType === 'task' ? (trimmedOwnerId || null) : null,
|
|
309
|
+
reason: 'upload'
|
|
310
|
+
});
|
|
311
|
+
addKeys(contextKeySet, keys);
|
|
312
|
+
localUploadFingerprintRef.current.add(fingerprint);
|
|
313
|
+
}
|
|
314
|
+
const notices = [...validationNotices];
|
|
315
|
+
if (duplicateCount > 0) {
|
|
316
|
+
notices.push(`${duplicateCount} duplicate file${duplicateCount === 1 ? '' : 's'} skipped.`);
|
|
317
|
+
}
|
|
318
|
+
setContextNotice(notices.length > 0 ? notices.join(' ') : null);
|
|
319
|
+
contextKeyRef.current = contextKeySet;
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
setUploadError(error instanceof Error ? error.message : 'Failed to upload context file');
|
|
323
|
+
}
|
|
324
|
+
finally {
|
|
325
|
+
setUploading(false);
|
|
326
|
+
if (inputRef.current)
|
|
327
|
+
inputRef.current.value = '';
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
const handleFilesSelected = async (files) => {
|
|
331
|
+
if (!files || files.length === 0)
|
|
332
|
+
return;
|
|
333
|
+
await handleSelectedFiles(Array.from(files));
|
|
334
|
+
};
|
|
335
|
+
const handlePasteImage = async () => {
|
|
336
|
+
setUploadError(null);
|
|
337
|
+
setContextNotice(null);
|
|
338
|
+
if (!navigator.clipboard || typeof navigator.clipboard.read !== 'function') {
|
|
339
|
+
setUploadError('Clipboard image paste is not available in this browser.');
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
try {
|
|
343
|
+
const clipboardItems = await navigator.clipboard.read();
|
|
344
|
+
const imageFiles = [];
|
|
345
|
+
for (const item of clipboardItems) {
|
|
346
|
+
const imageType = getClipboardImageType(item);
|
|
347
|
+
if (!imageType)
|
|
348
|
+
continue;
|
|
349
|
+
const blob = await item.getType(imageType);
|
|
350
|
+
const extension = imageType.toLowerCase() === 'image/png'
|
|
351
|
+
? 'png'
|
|
352
|
+
: imageType.toLowerCase() === 'image/webp'
|
|
353
|
+
? 'webp'
|
|
354
|
+
: 'jpg';
|
|
355
|
+
imageFiles.push(new globalThis.File([blob], `pasted-image-${Date.now()}.${extension}`, { type: imageType }));
|
|
356
|
+
}
|
|
357
|
+
if (imageFiles.length === 0) {
|
|
358
|
+
setUploadError('Clipboard does not currently contain a supported image.');
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
await handleSelectedFiles(imageFiles);
|
|
362
|
+
}
|
|
363
|
+
catch (error) {
|
|
364
|
+
setUploadError(error?.message || 'Failed to read an image from the clipboard.');
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
const parseDroppedLinks = (event) => {
|
|
368
|
+
const droppedLinks = new Set();
|
|
369
|
+
const rawUriList = event.dataTransfer.getData('text/uri-list') || '';
|
|
370
|
+
const rawText = event.dataTransfer.getData('text/plain') || '';
|
|
371
|
+
const candidates = `${rawUriList}\n${rawText}`
|
|
372
|
+
.split('\n')
|
|
373
|
+
.map((line) => line.trim())
|
|
374
|
+
.filter((line) => !!line && !line.startsWith('#'));
|
|
375
|
+
for (const candidate of candidates) {
|
|
376
|
+
if (/^file:\/\//i.test(candidate)) {
|
|
377
|
+
try {
|
|
378
|
+
const fileUrl = new URL(candidate);
|
|
379
|
+
const fsPath = decodeURIComponent(fileUrl.pathname || '').trim();
|
|
380
|
+
if (fsPath)
|
|
381
|
+
droppedLinks.add(fsPath);
|
|
382
|
+
}
|
|
383
|
+
catch {
|
|
384
|
+
// Ignore malformed file URL drops
|
|
385
|
+
}
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
droppedLinks.add(candidate);
|
|
389
|
+
}
|
|
390
|
+
return Array.from(droppedLinks);
|
|
391
|
+
};
|
|
392
|
+
const handleDrop = (event) => {
|
|
393
|
+
event.preventDefault();
|
|
394
|
+
event.stopPropagation();
|
|
395
|
+
setIsDropActive(false);
|
|
396
|
+
setDragDepth(0);
|
|
397
|
+
setUploadError(null);
|
|
398
|
+
setLinkError(null);
|
|
399
|
+
setContextNotice(null);
|
|
400
|
+
if (event.dataTransfer.files && event.dataTransfer.files.length > 0) {
|
|
401
|
+
void handleFilesSelected(event.dataTransfer.files);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
const droppedLinks = parseDroppedLinks(event);
|
|
405
|
+
if (droppedLinks.length === 0) {
|
|
406
|
+
setLinkError('Drop a file or URL.');
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
const contextKeySet = new Set(contextKeyRef.current);
|
|
410
|
+
let duplicateCount = 0;
|
|
411
|
+
let addedCount = 0;
|
|
412
|
+
let invalidCount = 0;
|
|
413
|
+
droppedLinks.forEach((link) => {
|
|
414
|
+
const result = addLink(link, false, contextKeySet);
|
|
415
|
+
if (result === 'duplicate')
|
|
416
|
+
duplicateCount += 1;
|
|
417
|
+
if (result === 'added')
|
|
418
|
+
addedCount += 1;
|
|
419
|
+
if (result === 'invalid')
|
|
420
|
+
invalidCount += 1;
|
|
421
|
+
});
|
|
422
|
+
const notices = [];
|
|
423
|
+
if (duplicateCount > 0) {
|
|
424
|
+
notices.push(`${duplicateCount} duplicate link${duplicateCount === 1 ? '' : 's'} skipped.`);
|
|
425
|
+
}
|
|
426
|
+
if (invalidCount > 0) {
|
|
427
|
+
notices.push(`${invalidCount} local path${invalidCount === 1 ? '' : 's'} skipped. Upload files to attach them, or drop an http(s) URL to link.`);
|
|
428
|
+
}
|
|
429
|
+
setContextNotice(notices.length > 0 ? notices.join(' ') : (addedCount > 0 ? null : contextNotice));
|
|
430
|
+
contextKeyRef.current = contextKeySet;
|
|
431
|
+
};
|
|
432
|
+
const handleDragEnter = (event) => {
|
|
433
|
+
event.preventDefault();
|
|
434
|
+
event.stopPropagation();
|
|
435
|
+
setDragDepth((depth) => depth + 1);
|
|
436
|
+
setIsDropActive(true);
|
|
437
|
+
};
|
|
438
|
+
const handleDragLeave = (event) => {
|
|
439
|
+
event.preventDefault();
|
|
440
|
+
event.stopPropagation();
|
|
441
|
+
setDragDepth((depth) => {
|
|
442
|
+
const nextDepth = Math.max(0, depth - 1);
|
|
443
|
+
if (nextDepth === 0)
|
|
444
|
+
setIsDropActive(false);
|
|
445
|
+
return nextDepth;
|
|
446
|
+
});
|
|
447
|
+
};
|
|
448
|
+
const handleDragOver = (event) => {
|
|
449
|
+
event.preventDefault();
|
|
450
|
+
event.stopPropagation();
|
|
451
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
452
|
+
};
|
|
453
|
+
const imageFiles = attachments.filter((item) => {
|
|
454
|
+
const path = typeof item === 'string' ? item : item.path;
|
|
455
|
+
return isImagePath(path);
|
|
456
|
+
});
|
|
457
|
+
const documentFiles = attachments.filter((item) => {
|
|
458
|
+
const path = typeof item === 'string' ? item : item.path;
|
|
459
|
+
return !isImagePath(path);
|
|
460
|
+
});
|
|
461
|
+
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 ", attachments.length > 0 && `(${attachments.length})`] }), showContextUpload ? _jsx(ChevronDown, { size: 14 }) : _jsx(ChevronRight, { size: 14 })] }), showContextUpload && (_jsxs(_Fragment, { children: [_jsxs("p", { className: styles.settingsHint, children: ["Upload files into ", ownerTypeLabel, " context storage, or add an external http(s) URL."] }), _jsxs("div", { className: styles.contextUploadPanel, children: [_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'] }), _jsxs("button", { type: "button", className: styles.secondaryHeaderBtn, onClick: () => {
|
|
462
|
+
void handlePasteImage();
|
|
463
|
+
}, disabled: uploading, children: [_jsx(Copy, { size: 12 }), "Paste Image from Clipboard"] })] }), _jsx("input", { ref: inputRef, type: "file", accept: ACCEPTED_CONTEXT_FILE_TYPES, multiple: true, className: styles.hiddenInput, onChange: (e) => {
|
|
464
|
+
void handleFilesSelected(e.target.files);
|
|
465
|
+
} }), uploadError && _jsx("div", { className: styles.error, children: uploadError }), _jsxs("div", { className: styles.contextLinkRow, children: [_jsx("input", { type: "text", className: styles.input, placeholder: "Add external URL (https://...)", value: linkValue, onChange: (e) => {
|
|
466
|
+
setLinkValue(e.target.value);
|
|
467
|
+
if (linkError)
|
|
468
|
+
setLinkError(null);
|
|
469
|
+
if (contextNotice)
|
|
470
|
+
setContextNotice(null);
|
|
471
|
+
} }), _jsx("button", { type: "button", className: styles.secondaryHeaderBtn, onClick: () => {
|
|
472
|
+
if (!linkValue.trim()) {
|
|
473
|
+
setLinkError('Enter an http(s) URL to link.');
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
const result = addLink(linkValue, true);
|
|
477
|
+
if (result === 'invalid') {
|
|
478
|
+
setLinkError('Only external http(s) URLs can be linked here. Upload files to attach them.');
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
if (result === 'duplicate') {
|
|
482
|
+
setContextNotice(`Link already exists in ${ownerTypeLabel} context.`);
|
|
483
|
+
}
|
|
484
|
+
else if (result === 'added') {
|
|
485
|
+
setContextNotice(null);
|
|
486
|
+
}
|
|
487
|
+
}, children: "Add URL" })] }), _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 or URLs here" })] })] }), contextNotice && _jsx("div", { className: styles.contextNotice, children: contextNotice }), linkError && _jsx("div", { className: styles.error, children: linkError }), imageFiles.length > 0 && (_jsx("div", { className: styles.attachmentGrid, children: attachments.map((item, idx) => {
|
|
488
|
+
const path = typeof item === 'string' ? item : item.path;
|
|
489
|
+
if (!isImagePath(path))
|
|
490
|
+
return null;
|
|
491
|
+
const fsPath = typeof item === 'string' ? undefined : item.fsPath;
|
|
492
|
+
const caption = typeof item === 'string' ? '' : item.caption || '';
|
|
493
|
+
const displayName = getAttachmentDisplayName(item);
|
|
494
|
+
const isImage = isImagePath(path);
|
|
495
|
+
const isExternalUrl = /^https?:\/\//i.test(path);
|
|
496
|
+
const canAnnotate = ownerType === 'task'
|
|
497
|
+
&& canOpenAnnotatedAttachment(item, { taskId: trimmedOwnerId });
|
|
498
|
+
return (_jsxs("div", { className: styles.attachmentCard, children: [_jsxs("div", { className: styles.attachmentPreviewContainer, children: [isImage ? (_jsx("img", { src: path, alt: caption || `Context file ${idx}`, onClick: () => {
|
|
499
|
+
if (ownerType === 'task'
|
|
500
|
+
&& dispatchOpenAnnotatedAttachment(item, {
|
|
501
|
+
taskId: trimmedOwnerId,
|
|
502
|
+
taskReferenceLabel: ownerReferenceLabel,
|
|
503
|
+
}))
|
|
504
|
+
return;
|
|
505
|
+
window.open(path, '_blank');
|
|
506
|
+
}, onError: (e) => {
|
|
507
|
+
e.target.style.display = 'none';
|
|
508
|
+
e.target.parentElement.classList.add(styles.brokenImage);
|
|
509
|
+
} })) : (_jsxs("button", { type: "button", className: styles.contextFileLink, onClick: () => {
|
|
510
|
+
if (dispatchOpenMarkdownDocument(item, fsPath))
|
|
511
|
+
return;
|
|
512
|
+
window.open(path, '_blank');
|
|
513
|
+
}, 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.attachmentActions, children: [canAnnotate && (_jsx("button", { type: "button", className: styles.attachmentActionBtn, onClick: (e) => {
|
|
514
|
+
e.stopPropagation();
|
|
515
|
+
dispatchOpenAnnotatedAttachment(item, {
|
|
516
|
+
taskId: trimmedOwnerId,
|
|
517
|
+
taskReferenceLabel: ownerReferenceLabel,
|
|
518
|
+
});
|
|
519
|
+
}, title: "Annotate", children: _jsx(PencilLine, { size: 12 }) })), fsPath && (_jsx("button", { type: "button", className: styles.attachmentActionBtn, onClick: (e) => {
|
|
520
|
+
e.stopPropagation();
|
|
521
|
+
navigator.clipboard.writeText(fsPath);
|
|
522
|
+
}, title: `Copy path: ${fsPath}`, children: _jsx(Copy, { size: 12 }) })), !isExternalUrl && (_jsx("button", { type: "button", className: styles.attachmentActionBtn, onClick: (e) => {
|
|
523
|
+
e.stopPropagation();
|
|
524
|
+
window.open(buildDownloadUrl(path, caption || displayName), '_blank');
|
|
525
|
+
}, title: "Download", children: _jsx(Download, { size: 12 }) })), _jsx("button", { type: "button", className: styles.attachmentActionBtn, onClick: (e) => {
|
|
526
|
+
e.stopPropagation();
|
|
527
|
+
onRemoveAttachment(idx);
|
|
528
|
+
}, title: "Delete", children: _jsx(Trash2, { size: 12 }) })] })] }), _jsx("input", { type: "text", className: styles.attachmentCaptionInput, placeholder: "Add a label...", value: caption, onChange: (e) => onUpdateAttachmentCaption(idx, e.target.value) })] }, idx));
|
|
529
|
+
}) })), documentFiles.length > 0 && (_jsx("div", { className: styles.documentAttachmentList, children: attachments.map((item, idx) => {
|
|
530
|
+
const path = typeof item === 'string' ? item : item.path;
|
|
531
|
+
if (isImagePath(path))
|
|
532
|
+
return null;
|
|
533
|
+
const fsPath = typeof item === 'string' ? undefined : item.fsPath;
|
|
534
|
+
const caption = typeof item === 'string' ? '' : item.caption || '';
|
|
535
|
+
const displayName = getAttachmentDisplayName(item);
|
|
536
|
+
const fileType = getAttachmentTypeLabel(item);
|
|
537
|
+
const documentReferenceLabel = typeof item === 'string' ? '' : getDocumentReferenceLabel(item);
|
|
538
|
+
const isExternalUrl = /^https?:\/\//i.test(path);
|
|
539
|
+
return (_jsxs("div", { className: styles.documentAttachmentItem, children: [_jsxs("div", { className: styles.documentAttachmentRow, children: [_jsxs("button", { type: "button", className: styles.documentAttachmentLink, onClick: () => {
|
|
540
|
+
if (dispatchOpenMarkdownDocument(item, fsPath))
|
|
541
|
+
return;
|
|
542
|
+
window.open(path, '_blank');
|
|
543
|
+
}, title: displayName, children: [_jsxs("span", { className: styles.documentAttachmentMain, children: [_jsx("span", { className: styles.documentAttachmentIcon, "aria-hidden": "true", children: _jsx(File, { size: 13 }) }), _jsxs("span", { className: styles.documentAttachmentText, children: [_jsx("span", { className: styles.documentAttachmentName, children: displayName }), documentReferenceLabel && (_jsx("span", { className: styles.taskIdBadge, children: documentReferenceLabel }))] })] }), _jsx("span", { className: styles.documentAttachmentType, children: fileType })] }), _jsxs("div", { className: styles.documentAttachmentActions, children: [fsPath && (_jsx("button", { type: "button", className: styles.documentAttachmentActionBtn, onClick: () => {
|
|
544
|
+
navigator.clipboard.writeText(fsPath);
|
|
545
|
+
}, title: `Copy path: ${fsPath}`, children: _jsx(Copy, { size: 12 }) })), !isExternalUrl && (_jsx("button", { type: "button", className: styles.documentAttachmentActionBtn, onClick: () => {
|
|
546
|
+
window.open(buildDownloadUrl(path, caption || displayName), '_blank');
|
|
547
|
+
}, title: "Download", children: _jsx(Download, { size: 12 }) })), _jsx("button", { type: "button", className: styles.documentAttachmentActionBtn, onClick: () => onRemoveAttachment(idx), title: "Delete", children: _jsx(Trash2, { size: 12 }) })] })] }), _jsx("input", { type: "text", className: styles.documentAttachmentCaptionInput, placeholder: "Add a label...", value: caption, onChange: (e) => onUpdateAttachmentCaption(idx, e.target.value) })] }, idx));
|
|
548
|
+
}) }))] }))] }));
|
|
549
|
+
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
type AiProfileSeatUsage = {
|
|
2
|
+
used: number;
|
|
3
|
+
limit: number | null;
|
|
4
|
+
remaining: number | null;
|
|
5
|
+
};
|
|
1
6
|
interface AgentsModuleProps {
|
|
2
7
|
workspaceId: string;
|
|
8
|
+
cloudAuthConfigured?: boolean;
|
|
9
|
+
authSessionResolved?: boolean;
|
|
10
|
+
isAuthenticated?: boolean;
|
|
11
|
+
cloudAiProfileSeatUsage?: AiProfileSeatUsage | null;
|
|
3
12
|
}
|
|
4
|
-
export declare function AgentsModule({ workspaceId }: AgentsModuleProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function AgentsModule({ workspaceId, cloudAuthConfigured, authSessionResolved, isAuthenticated, cloudAiProfileSeatUsage, }: AgentsModuleProps): import("react/jsx-runtime").JSX.Element;
|
|
5
14
|
export {};
|