@taskforcehq/taskforce 0.3.303 → 0.3.305
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 +102 -5
- package/dist/TaskforceCore.js +635 -238
- package/dist/TaskforceCore.test.js +2243 -495
- package/dist/annotatedAttachments/service.d.ts +1 -1
- package/dist/annotatedAttachments/types.d.ts +1 -1
- package/dist/compat/workspaceSyncCompat.js +6 -0
- package/dist/components/features/AgentsModule.js +1 -1
- package/dist/components/features/AgentsModule.test.js +1 -1
- package/dist/components/features/DocumentIndex.d.ts +1 -1
- package/dist/components/features/DocumentIndex.js +1 -1
- package/dist/components/features/DocumentViewer.d.ts +1 -1
- package/dist/components/features/DocumentViewer.js +32 -9
- package/dist/components/features/DocumentWorkspace.d.ts +5 -22
- package/dist/components/features/DocumentWorkspace.js +12 -155
- package/dist/components/features/DocumentWorkspace.test.js +193 -6
- package/dist/components/features/TaskSettings.js +87 -41
- package/dist/components/features/TaskSettings.test.js +180 -40
- 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/TaskActionHeader.d.ts +2 -1
- package/dist/components/task/TaskActionHeader.js +3 -3
- package/dist/components/task/TaskActionHeader.test.js +8 -0
- package/dist/components/task/TaskCard.js +16 -1
- package/dist/components/task/TaskCard.test.js +31 -0
- package/dist/components/task/TaskForm.d.ts +9 -8
- package/dist/components/task/TaskForm.js +374 -219
- package/dist/components/task/TaskForm.test.js +482 -361
- package/dist/components/task/TaskKanban.d.ts +1 -1
- package/dist/components/task/TaskKanban.js +33 -161
- package/dist/components/task/TaskStatusActions.d.ts +6 -1
- package/dist/components/task/TaskStatusActions.js +8 -3
- package/dist/components/task/TaskStatusActions.test.js +9 -0
- package/dist/components/task/taskKanbanDropRules.d.ts +58 -0
- package/dist/components/task/taskKanbanDropRules.js +187 -0
- package/dist/components/task/taskKanbanDropRules.test.d.ts +1 -0
- package/dist/components/task/taskKanbanDropRules.test.js +114 -0
- package/dist/components/ui/Modal.d.ts +1 -1
- package/dist/components/ui/Modal.js +1 -0
- package/dist/components/views/AppShellHeader.js +5 -1
- package/dist/components/views/AppShellHeader.test.js +4 -0
- package/dist/components/views/PlanComparisonPage.d.ts +3 -2
- package/dist/components/views/PlanComparisonPage.js +9 -10
- package/dist/components/views/PlanComparisonPage.test.js +55 -41
- package/dist/components/views/PlansPage.d.ts +5 -1
- package/dist/components/views/PlansPage.js +150 -81
- package/dist/components/views/PlansPage.test.js +367 -41
- package/dist/components/views/StandaloneLayout.js +135 -54
- package/dist/components/views/WidgetView.js +11 -2
- package/dist/components/views/panels/FilterToolbar.test.js +6 -4
- package/dist/components/views/standalone/modals/AccountHubModal.d.ts +2 -14
- package/dist/components/views/standalone/modals/AccountHubModal.js +12 -14
- package/dist/components/views/standalone/modals/AccountHubModal.test.js +24 -1
- package/dist/components/views/standalone/modals/SyncStatusModal.js +1 -1
- package/dist/config/envSchema.js +1 -1
- package/dist/core/AiProfileService.d.ts +6 -1
- package/dist/core/AiProfileService.js +161 -16
- package/dist/core/AiProfileService.test.js +3 -1
- package/dist/core/AiProfiles.test.js +200 -0
- package/dist/core/AuthTokenService.test.d.ts +1 -0
- package/dist/core/AuthTokenService.test.js +78 -0
- package/dist/core/DeletedTaskLifecycleService.d.ts +2 -1
- package/dist/core/EntitlementsPolicy.test.js +75 -13
- package/dist/core/PlanEntitlementService.d.ts +9 -1
- package/dist/core/PlanEntitlementService.js +144 -19
- package/dist/core/PlanVersionPolicy.test.js +19 -26
- package/dist/core/SignupMonetizationSettings.test.js +75 -15
- package/dist/core/SystemAdmin.test.js +212 -56
- package/dist/core/TaskActivityService.d.ts +4 -1
- package/dist/core/TaskActivityService.js +45 -0
- package/dist/core/TaskAuditTimeline.test.js +52 -1
- package/dist/core/TaskTaxonomyValidation.test.js +53 -0
- package/dist/core/Taskforce.d.ts +18 -11
- package/dist/core/Taskforce.js +93 -12
- package/dist/core/WorkspacePlanMode.test.js +73 -8
- package/dist/core/shared.d.ts +2 -0
- package/dist/core/shared.js +11 -0
- package/dist/documentReviews/service.d.ts +1 -1
- package/dist/documentReviews/types.d.ts +1 -1
- package/dist/hooks/auth/useTaskforceAuthBootstrap.d.ts +48 -0
- package/dist/hooks/auth/useTaskforceAuthBootstrap.js +219 -0
- package/dist/hooks/sync/auth.d.ts +37 -0
- package/dist/hooks/sync/auth.js +63 -0
- package/dist/hooks/sync/bootstrap.d.ts +34 -0
- package/dist/hooks/sync/bootstrap.js +52 -0
- package/dist/hooks/sync/orchestratorShared.d.ts +36 -0
- package/dist/hooks/sync/orchestratorShared.js +209 -0
- package/dist/hooks/sync/orchestratorShared.test.d.ts +1 -0
- package/dist/hooks/sync/orchestratorShared.test.js +49 -0
- package/dist/hooks/sync/realtime.d.ts +25 -0
- package/dist/hooks/sync/realtime.js +60 -0
- package/dist/hooks/sync/recovery.d.ts +69 -0
- package/dist/hooks/sync/recovery.js +118 -0
- package/dist/hooks/sync/transfers.d.ts +123 -0
- package/dist/hooks/sync/transfers.js +435 -0
- package/dist/hooks/sync/useDataVersionRefresh.d.ts +16 -0
- package/dist/hooks/sync/useDataVersionRefresh.js +73 -0
- package/dist/hooks/ui/useResourceExport.d.ts +3 -1
- package/dist/hooks/ui/useResourceExport.js +5 -2
- package/dist/hooks/ui/useWorkflowTemplates.js +11 -6
- package/dist/hooks/useRealtimeSync.js +2 -1
- package/dist/hooks/useSyncOrchestrator.aiProfiles.test.js +8 -0
- package/dist/hooks/useSyncOrchestrator.context-assets.test.d.ts +1 -0
- package/dist/hooks/useSyncOrchestrator.context-assets.test.js +228 -0
- package/dist/hooks/useSyncOrchestrator.d.ts +12 -8
- package/dist/hooks/useSyncOrchestrator.js +388 -879
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +641 -6
- package/dist/hooks/useTaskMutations.d.ts +2 -1
- package/dist/hooks/useTaskMutations.js +57 -7
- package/dist/hooks/useTaskMutations.test.js +176 -0
- package/dist/hooks/useTaskforce.d.ts +13 -4
- package/dist/hooks/useTaskforce.js +302 -817
- package/dist/hooks/useTaskforce.sync-behavior.test.js +78 -0
- package/dist/hooks/useWorkspaceSyncController.d.ts +4 -1
- package/dist/hooks/useWorkspaceSyncController.js +33 -11
- package/dist/hooks/useWorkspaceSyncController.test.js +1 -0
- package/dist/hooks/workspace/useTaskforceApiRouting.test.js +17 -0
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.d.ts +166 -0
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.js +434 -0
- package/dist/hooks/workspace/workspaceLocalState.d.ts +19 -0
- package/dist/hooks/workspace/workspaceLocalState.js +100 -0
- package/dist/hooks/workspace/workspaceLocalState.test.d.ts +1 -0
- package/dist/hooks/workspace/workspaceLocalState.test.js +59 -0
- package/dist/localization/locales/en-US.js +2 -2
- package/dist/mcp/adminWorkspaceRegistrar.d.ts +2 -0
- package/dist/mcp/adminWorkspaceRegistrar.js +154 -0
- package/dist/mcp/canonicalAssetHelpers.d.ts +70 -0
- package/dist/mcp/canonicalAssetHelpers.js +259 -0
- package/dist/mcp/clientIntegrations.d.ts +12 -1
- package/dist/mcp/clientIntegrations.js +161 -6
- package/dist/mcp/clientIntegrations.test.js +76 -4
- 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/documentHelpers.d.ts +100 -0
- package/dist/mcp/documentHelpers.js +161 -0
- package/dist/mcp/runtime.js +2455 -3925
- package/dist/mcp/runtime.test.js +240 -8
- package/dist/mcp/taskAttachmentHelpers.d.ts +41 -0
- package/dist/mcp/taskAttachmentHelpers.js +60 -0
- package/dist/mcp/taskAttachmentTypes.d.ts +37 -0
- package/dist/mcp/taskAttachmentTypes.js +1 -0
- 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/plugins/vite.js +1 -1
- package/dist/runtime/appGateDefinitions.d.ts +1 -1
- package/dist/runtime/appGateDefinitions.js +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +46 -3
- package/dist/server/index.test.js +12 -1
- package/dist/server/routes/admin.d.ts +1 -5
- package/dist/server/routes/admin.js +151 -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 +1 -4
- package/dist/server/routes/auth.js +59 -64
- 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 +122 -255
- package/dist/server/routes/billing.test.js +257 -86
- package/dist/server/routes/documentReviews.d.ts +1 -1
- package/dist/server/routes/documentReviews.js +1 -1
- package/dist/server/routes/documents.d.ts +4 -2
- package/dist/server/routes/documents.js +73 -7
- 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 +31 -1
- package/dist/server/routes/shared.js +26 -0
- package/dist/server/routes/sync.d.ts +1 -1
- package/dist/server/routes/sync.integration.test.js +20 -0
- package/dist/server/routes/sync.js +111 -238
- package/dist/server/routes/tasks.d.ts +1 -1
- package/dist/server/routes/tasks.js +50 -8
- package/dist/server/routes/workspaces.d.ts +1 -1
- package/dist/server/routes/workspaces.js +1 -1
- package/dist/server/routes.d.ts +2 -9
- package/dist/server/routes.js +84 -181
- package/dist/server/routes.test.js +912 -32
- package/dist/shared/taskActor.d.ts +10 -0
- package/dist/shared/taskActor.js +1 -0
- package/dist/sync/collaborationSyncPayload.js +4 -0
- package/dist/sync/collaborationSyncPayload.test.js +8 -0
- package/dist/sync/collaborationSyncState.d.ts +3 -1
- package/dist/sync/collaborationSyncState.js +19 -0
- package/dist/sync/contentSyncState.js +28 -17
- package/dist/sync/syncApplyHandlers.d.ts +87 -1
- package/dist/sync/syncApplyHandlers.js +370 -8
- package/dist/sync/syncApplyHandlers.test.d.ts +1 -0
- package/dist/sync/syncApplyHandlers.test.js +379 -0
- package/dist/sync/syncService.d.ts +9 -1
- package/dist/sync/syncService.js +44 -2
- package/dist/sync/syncService.test.js +62 -0
- package/dist/sync/workspacePullFeed.d.ts +1 -0
- package/dist/sync/workspacePullFeed.js +66 -59
- package/dist/sync/workspacePullFeed.test.js +72 -4
- package/dist/sync/workspaceSyncModel.d.ts +25 -1
- package/dist/sync/workspaceSyncModel.js +77 -3
- package/dist/sync/workspaceSyncModel.test.js +153 -0
- package/dist/sync/workspaceSyncState.d.ts +2 -0
- package/dist/sync/workspaceSyncState.js +1 -0
- package/dist/types.d.ts +2 -10
- package/dist/ui/assets/AgentsModule-N2MnQBZk.js +1 -0
- package/dist/ui/assets/{AnnotatedAttachmentWorkspace-C_TmXZwA.js → AnnotatedAttachmentWorkspace-BG6P_GVW.js} +1 -1
- package/dist/ui/assets/DocumentWorkspace-B3nV_Gc5.css +1 -0
- package/dist/ui/assets/DocumentWorkspace-DRbDMwh8.js +252 -0
- package/dist/ui/assets/{InitiativesModule-4-Rh2K2n.js → InitiativesModule-Dhm7M8e7.js} +1 -1
- package/dist/ui/assets/{PlansPage-BlVC_lRq.css → PlansPage-C2dd2n1X.css} +1 -1
- package/dist/ui/assets/PlansPage-Cq0zXj3I.js +1 -0
- package/dist/ui/assets/TaskSettings-ln0aF7xc.js +9 -0
- package/dist/ui/assets/{WorkflowsModule-CGk9s3NJ.js → WorkflowsModule-BcS4afRn.js} +1 -1
- package/dist/ui/assets/index-C2-OXZV7.css +1 -0
- package/dist/ui/assets/index-DcSI5F86.js +6 -0
- package/dist/ui/assets/{vendor-icons-pWocEipT.js → vendor-icons-BSUaRwF8.js} +1 -1
- package/dist/ui/index.html +4 -4
- package/dist/utils/commercialLifecyclePresentation.d.ts +19 -0
- package/dist/utils/commercialLifecyclePresentation.js +196 -0
- package/dist/utils/taskActivity.js +4 -0
- package/dist/utils/taskActivity.test.js +25 -1
- package/package.json +10 -1
- package/scripts/check-cloud-mcp.mjs +83 -0
- package/scripts/playwright-auth.sh +9 -1
- package/scripts/run-billing-performance-smoke.sh +24 -0
- package/dist/ui/assets/AgentsModule-CpsTmrIW.js +0 -1
- package/dist/ui/assets/DocumentWorkspace-C3GyzrWm.js +0 -250
- package/dist/ui/assets/DocumentWorkspace-C_8T8oz-.css +0 -1
- package/dist/ui/assets/PlansPage-BP7AYOqr.js +0 -1
- package/dist/ui/assets/TaskSettings-BOC5F6Ag.js +0 -8
- package/dist/ui/assets/index-CLIMgR6g.js +0 -6
- package/dist/ui/assets/index-DneETxcu.css +0 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { act, renderHook, waitFor } from '@testing-library/react';
|
|
3
|
+
import { useSyncOrchestrator } from './useSyncOrchestrator';
|
|
4
|
+
const { ensureCloudWorkspaceReadyForSyncServiceMock, runWorkspacePullSyncServiceMock, runWorkspacePushSyncServiceMock, syncUserGlobalSettingsServiceMock } = vi.hoisted(() => ({
|
|
5
|
+
ensureCloudWorkspaceReadyForSyncServiceMock: vi.fn(),
|
|
6
|
+
runWorkspacePullSyncServiceMock: vi.fn(),
|
|
7
|
+
runWorkspacePushSyncServiceMock: vi.fn(),
|
|
8
|
+
syncUserGlobalSettingsServiceMock: vi.fn()
|
|
9
|
+
}));
|
|
10
|
+
vi.mock('../sync/syncService', async () => {
|
|
11
|
+
const actual = await vi.importActual('../sync/syncService');
|
|
12
|
+
return {
|
|
13
|
+
...actual,
|
|
14
|
+
calculateWorkspaceRetryDelayMs: vi.fn(() => 100),
|
|
15
|
+
ensureCloudWorkspaceReadyForSyncService: ensureCloudWorkspaceReadyForSyncServiceMock,
|
|
16
|
+
runWorkspacePullSyncService: runWorkspacePullSyncServiceMock,
|
|
17
|
+
runWorkspacePushSyncService: runWorkspacePushSyncServiceMock,
|
|
18
|
+
syncUserGlobalSettingsService: syncUserGlobalSettingsServiceMock
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
function buildInput(overrides) {
|
|
22
|
+
return {
|
|
23
|
+
currentWorkspaceId: 'workspace-local-active',
|
|
24
|
+
cloudAuthConfigured: true,
|
|
25
|
+
runtimeMode: 'local',
|
|
26
|
+
authSessionResolved: true,
|
|
27
|
+
isAuthenticated: true,
|
|
28
|
+
authUserId: 'user-1',
|
|
29
|
+
projectName: 'Test Project',
|
|
30
|
+
resolveCloudAuthUrl: (path) => `https://cloud.example.com${path}`,
|
|
31
|
+
resolveWebSocketUrl: (path) => `wss://api.example.com${path}`,
|
|
32
|
+
realtimeSyncEnabled: false,
|
|
33
|
+
tasks: [],
|
|
34
|
+
archivedTasks: [],
|
|
35
|
+
initiatives: [],
|
|
36
|
+
workstreams: [],
|
|
37
|
+
taxonomies: [],
|
|
38
|
+
setupState: null,
|
|
39
|
+
globalTheme: 'dark',
|
|
40
|
+
locale: 'en-US',
|
|
41
|
+
globalWeekStartsOn: 'monday',
|
|
42
|
+
themeUseGlobalDefault: true,
|
|
43
|
+
setTasks: vi.fn(),
|
|
44
|
+
setArchivedTasks: vi.fn(),
|
|
45
|
+
setAuthBlocked: vi.fn(),
|
|
46
|
+
setIsAuthenticated: vi.fn(),
|
|
47
|
+
checkAuthSession: vi.fn(async () => true),
|
|
48
|
+
setGlobalTheme: vi.fn(),
|
|
49
|
+
setCurrentTheme: vi.fn(),
|
|
50
|
+
setSetupState: vi.fn(),
|
|
51
|
+
setLocale: vi.fn(),
|
|
52
|
+
setGlobalWeekStartsOn: vi.fn(),
|
|
53
|
+
fetchPlanningEntities: vi.fn(async () => { }),
|
|
54
|
+
...overrides
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
describe('useSyncOrchestrator context asset refreshes', () => {
|
|
58
|
+
beforeEach(() => {
|
|
59
|
+
ensureCloudWorkspaceReadyForSyncServiceMock.mockReset();
|
|
60
|
+
runWorkspacePullSyncServiceMock.mockReset();
|
|
61
|
+
runWorkspacePushSyncServiceMock.mockReset();
|
|
62
|
+
syncUserGlobalSettingsServiceMock.mockReset();
|
|
63
|
+
ensureCloudWorkspaceReadyForSyncServiceMock.mockResolvedValue({ success: true });
|
|
64
|
+
runWorkspacePullSyncServiceMock.mockResolvedValue({
|
|
65
|
+
success: true,
|
|
66
|
+
syncedAt: '2026-03-15T18:00:00.000Z',
|
|
67
|
+
cursor: null,
|
|
68
|
+
pages: 0,
|
|
69
|
+
appliedChanges: 0,
|
|
70
|
+
pullRequestMs: 1,
|
|
71
|
+
applyMs: 0,
|
|
72
|
+
pulledDeleteTaskIds: new Set(),
|
|
73
|
+
pulledActiveUpserts: false,
|
|
74
|
+
pulledArchivedUpserts: false,
|
|
75
|
+
documentDecryptFailures: []
|
|
76
|
+
});
|
|
77
|
+
runWorkspacePushSyncServiceMock.mockResolvedValue({
|
|
78
|
+
success: true,
|
|
79
|
+
syncedAt: '2026-03-15T18:00:00.000Z',
|
|
80
|
+
requestMs: 1,
|
|
81
|
+
changeCount: 0,
|
|
82
|
+
deleteCount: 0,
|
|
83
|
+
currentTaskIds: new Set(),
|
|
84
|
+
currentInitiativeIds: new Set(),
|
|
85
|
+
currentInitiativeWatermarks: new Map(),
|
|
86
|
+
currentWorkstreamIds: new Set(),
|
|
87
|
+
currentWorkstreamWatermarks: new Map(),
|
|
88
|
+
currentAiProfileIds: new Set(),
|
|
89
|
+
currentAiProfileWatermarks: new Map(),
|
|
90
|
+
currentDocumentPaths: new Set(),
|
|
91
|
+
currentDocumentWatermarks: new Map(),
|
|
92
|
+
currentAssetPaths: new Set(),
|
|
93
|
+
currentAssetWatermarks: new Map(),
|
|
94
|
+
currentDocumentReviewSessionIds: new Set(),
|
|
95
|
+
currentDocumentReviewSessionWatermarks: new Map(),
|
|
96
|
+
currentDocumentReviewCommentIds: new Set(),
|
|
97
|
+
currentDocumentReviewCommentWatermarks: new Map(),
|
|
98
|
+
currentAnnotatedAttachmentSessionIds: new Set(),
|
|
99
|
+
currentAnnotatedAttachmentSessionWatermarks: new Map(),
|
|
100
|
+
currentTaskEventWatermarks: new Map(),
|
|
101
|
+
deleteTaskIds: new Set(),
|
|
102
|
+
pushedWatermarks: new Map(),
|
|
103
|
+
emittedEventIds: []
|
|
104
|
+
});
|
|
105
|
+
syncUserGlobalSettingsServiceMock.mockResolvedValue({
|
|
106
|
+
success: true,
|
|
107
|
+
mode: 'pulled',
|
|
108
|
+
updatedAt: new Date().toISOString()
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
afterEach(() => {
|
|
112
|
+
vi.unstubAllGlobals();
|
|
113
|
+
vi.clearAllMocks();
|
|
114
|
+
});
|
|
115
|
+
it('refreshes only document and asset snapshots when task attachments change', async () => {
|
|
116
|
+
const fetchCounts = {
|
|
117
|
+
documents: 0,
|
|
118
|
+
assets: 0,
|
|
119
|
+
aiProfiles: 0,
|
|
120
|
+
documentReviews: 0,
|
|
121
|
+
annotatedAttachments: 0
|
|
122
|
+
};
|
|
123
|
+
vi.stubGlobal('fetch', vi.fn((url, init) => {
|
|
124
|
+
if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
|
|
125
|
+
return Promise.resolve({
|
|
126
|
+
ok: true,
|
|
127
|
+
json: () => Promise.resolve({
|
|
128
|
+
success: true,
|
|
129
|
+
state: {
|
|
130
|
+
version: 2,
|
|
131
|
+
enabled: true,
|
|
132
|
+
phase: 'active',
|
|
133
|
+
pullCursor: null,
|
|
134
|
+
lastPullAt: null,
|
|
135
|
+
lastPushAt: null,
|
|
136
|
+
lastSyncedAt: null
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (url.includes('/api/taskforce/ui-state') && String(init?.method || '').toUpperCase() === 'POST') {
|
|
142
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
|
|
143
|
+
}
|
|
144
|
+
if (url.includes('/api/taskforce/sync/workspace/documents')) {
|
|
145
|
+
fetchCounts.documents += 1;
|
|
146
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ documents: [] }) });
|
|
147
|
+
}
|
|
148
|
+
if (url.includes('/api/taskforce/sync/workspace/assets')) {
|
|
149
|
+
fetchCounts.assets += 1;
|
|
150
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ assets: [] }) });
|
|
151
|
+
}
|
|
152
|
+
if (url.includes('/api/taskforce/sync/workspace/ai-profiles')) {
|
|
153
|
+
fetchCounts.aiProfiles += 1;
|
|
154
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ aiProfiles: [] }) });
|
|
155
|
+
}
|
|
156
|
+
if (url.includes('/api/taskforce/sync/workspace/document-reviews')) {
|
|
157
|
+
fetchCounts.documentReviews += 1;
|
|
158
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ sessions: [], comments: [] }) });
|
|
159
|
+
}
|
|
160
|
+
if (url.includes('/api/taskforce/sync/workspace/annotated-attachments')) {
|
|
161
|
+
fetchCounts.annotatedAttachments += 1;
|
|
162
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ sessions: [] }) });
|
|
163
|
+
}
|
|
164
|
+
if (url.includes('/api/taskforce/sync/events')) {
|
|
165
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
|
|
166
|
+
}
|
|
167
|
+
if (url.includes('/api/taskforce/tasks')) {
|
|
168
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ tasks: [] }) });
|
|
169
|
+
}
|
|
170
|
+
if (url.includes('/api/taskforce/archive')) {
|
|
171
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ archived: [] }) });
|
|
172
|
+
}
|
|
173
|
+
return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
|
|
174
|
+
}));
|
|
175
|
+
const baseTask = {
|
|
176
|
+
id: 'task-with-attachments',
|
|
177
|
+
title: 'Task with attachment refreshes',
|
|
178
|
+
description: '',
|
|
179
|
+
category: 'general',
|
|
180
|
+
type: 'task',
|
|
181
|
+
priority: 2,
|
|
182
|
+
complexity: 3,
|
|
183
|
+
status: 'task',
|
|
184
|
+
createdAt: '2026-03-15T12:00:00.000Z',
|
|
185
|
+
updatedAt: '2026-03-15T12:00:00.000Z',
|
|
186
|
+
attachments: [],
|
|
187
|
+
taskEvents: []
|
|
188
|
+
};
|
|
189
|
+
const initialInput = buildInput({
|
|
190
|
+
tasks: [baseTask]
|
|
191
|
+
});
|
|
192
|
+
const { result, rerender, unmount } = renderHook((props) => useSyncOrchestrator(props), {
|
|
193
|
+
initialProps: initialInput
|
|
194
|
+
});
|
|
195
|
+
act(() => {
|
|
196
|
+
result.current.applyWorkspaceSyncStateSnapshot({
|
|
197
|
+
enabled: true,
|
|
198
|
+
phase: 'active',
|
|
199
|
+
pullCursor: null
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
await waitFor(() => {
|
|
203
|
+
expect(fetchCounts.documents).toBeGreaterThan(0);
|
|
204
|
+
expect(fetchCounts.assets).toBeGreaterThan(0);
|
|
205
|
+
expect(fetchCounts.aiProfiles).toBeGreaterThan(0);
|
|
206
|
+
expect(fetchCounts.documentReviews).toBeGreaterThan(0);
|
|
207
|
+
});
|
|
208
|
+
const baselineCounts = { ...fetchCounts };
|
|
209
|
+
rerender({
|
|
210
|
+
...initialInput,
|
|
211
|
+
tasks: [{
|
|
212
|
+
...baseTask,
|
|
213
|
+
attachments: [{
|
|
214
|
+
id: 'asset-1',
|
|
215
|
+
path: 'workspaces/workspace-local-active/assets/file.txt'
|
|
216
|
+
}]
|
|
217
|
+
}]
|
|
218
|
+
});
|
|
219
|
+
await waitFor(() => {
|
|
220
|
+
expect(fetchCounts.documents).toBeGreaterThan(baselineCounts.documents);
|
|
221
|
+
expect(fetchCounts.assets).toBeGreaterThan(baselineCounts.assets);
|
|
222
|
+
});
|
|
223
|
+
expect(fetchCounts.aiProfiles).toBe(baselineCounts.aiProfiles);
|
|
224
|
+
expect(fetchCounts.documentReviews).toBe(baselineCounts.documentReviews);
|
|
225
|
+
expect(fetchCounts.annotatedAttachments).toBe(baselineCounts.annotatedAttachments);
|
|
226
|
+
unmount();
|
|
227
|
+
});
|
|
228
|
+
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { InitiativeItem, TaskItem, TaskforceTheme, WorkstreamItem } from '../types';
|
|
2
|
-
import { type WorkspaceSyncPhase } from '../sync/workspaceSyncState';
|
|
3
|
-
import { type WorkspaceSyncAiProfileSnapshot } from '../sync/workspaceSyncModel';
|
|
1
|
+
import type { DeletedTaskRecord, InitiativeItem, TaskItem, TaskforceTheme, WorkstreamItem } from '../types';
|
|
2
|
+
import { type WorkspaceSyncPhase, type WorkspaceSyncSetupIntent } from '../sync/workspaceSyncState';
|
|
4
3
|
import type { WorkspaceTaxonomyState } from '../shared/taxonomyState.js';
|
|
5
4
|
import type { SupportedLocale } from '../localization';
|
|
6
|
-
|
|
5
|
+
import { normalizeWorkspaceSyncAiProfileSnapshotEntry } from './sync/orchestratorShared';
|
|
7
6
|
export interface UseSyncOrchestratorInput {
|
|
8
7
|
currentWorkspaceId: string;
|
|
9
8
|
cloudAuthConfigured: boolean;
|
|
@@ -17,6 +16,7 @@ export interface UseSyncOrchestratorInput {
|
|
|
17
16
|
realtimeSyncEnabled: boolean;
|
|
18
17
|
tasks: TaskItem[];
|
|
19
18
|
archivedTasks: TaskItem[];
|
|
19
|
+
deletedTasks?: DeletedTaskRecord[];
|
|
20
20
|
initiatives: InitiativeItem[];
|
|
21
21
|
workstreams: WorkstreamItem[];
|
|
22
22
|
taxonomies: unknown[];
|
|
@@ -41,9 +41,10 @@ export interface UseSyncOrchestratorInput {
|
|
|
41
41
|
fetchPlanningEntities: () => Promise<void>;
|
|
42
42
|
}
|
|
43
43
|
export type WorkspaceSyncStatus = 'off' | 'syncing' | 'attention' | 'healthy';
|
|
44
|
+
export { normalizeWorkspaceSyncAiProfileSnapshotEntry };
|
|
44
45
|
export declare function useSyncOrchestrator(input: UseSyncOrchestratorInput): {
|
|
45
|
-
userGlobalSyncStatus: "error" | "idle" | "
|
|
46
|
-
setUserGlobalSyncStatus: import("react").Dispatch<import("react").SetStateAction<"error" | "idle" | "
|
|
46
|
+
userGlobalSyncStatus: "error" | "idle" | "disconnected" | "syncing";
|
|
47
|
+
setUserGlobalSyncStatus: import("react").Dispatch<import("react").SetStateAction<"error" | "idle" | "disconnected" | "syncing">>;
|
|
47
48
|
userGlobalSyncError: string | null;
|
|
48
49
|
setUserGlobalSyncError: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
49
50
|
workspaceLastPullAt: string | null;
|
|
@@ -53,6 +54,7 @@ export declare function useSyncOrchestrator(input: UseSyncOrchestratorInput): {
|
|
|
53
54
|
workspaceLastSuccessfulSyncAt: string | null;
|
|
54
55
|
workspaceCloudSyncEnabled: boolean;
|
|
55
56
|
workspaceSyncPhase: WorkspaceSyncPhase;
|
|
57
|
+
workspaceSyncSetupIntent: WorkspaceSyncSetupIntent;
|
|
56
58
|
workspaceSyncStatus: WorkspaceSyncStatus;
|
|
57
59
|
workspaceSyncSummary: string;
|
|
58
60
|
workspaceSyncRecommendedAction: string;
|
|
@@ -67,14 +69,15 @@ export declare function useSyncOrchestrator(input: UseSyncOrchestratorInput): {
|
|
|
67
69
|
workspacePendingSignatureRef: import("react").RefObject<string>;
|
|
68
70
|
workspaceLastPushedTaskIdsRef: import("react").RefObject<Set<string>>;
|
|
69
71
|
workspaceDeletedTaskIdsRef: import("react").RefObject<Set<string>>;
|
|
72
|
+
workspaceDeletedTaskWatermarksRef: import("react").RefObject<Map<string, string>>;
|
|
70
73
|
workspacePullCursorRef: import("react").RefObject<string | null>;
|
|
71
74
|
clearWorkspaceRetry: () => void;
|
|
72
75
|
persistWorkspaceSyncPatch: (patch: Partial<import("../sync/workspaceSyncState").WorkspaceSyncStateV2>) => Promise<import("../sync/workspaceSyncState").WorkspaceSyncStateV2>;
|
|
73
76
|
loadWorkspaceSyncState: () => Promise<void>;
|
|
74
|
-
applyWorkspaceSyncStateSnapshot: (nextState: Partial<import("../sync/workspaceSyncState").WorkspaceSyncStateV2> & {
|
|
77
|
+
applyWorkspaceSyncStateSnapshot: (nextState: Parameters<(nextState: Partial<import("../sync/workspaceSyncState").WorkspaceSyncStateV2> & {
|
|
75
78
|
enabled: boolean;
|
|
76
79
|
phase?: WorkspaceSyncPhase | null;
|
|
77
|
-
}) => void;
|
|
80
|
+
}) => void>[0]) => void;
|
|
78
81
|
syncUserGlobalSettings: (options?: {
|
|
79
82
|
preferCloudOnFirstSync?: boolean;
|
|
80
83
|
}) => Promise<void>;
|
|
@@ -85,6 +88,7 @@ export declare function useSyncOrchestrator(input: UseSyncOrchestratorInput): {
|
|
|
85
88
|
}) => Promise<boolean>;
|
|
86
89
|
pullWorkspaceChangesFromCloud: (options?: {
|
|
87
90
|
repairMode?: boolean;
|
|
91
|
+
forceCursorNull?: boolean;
|
|
88
92
|
}) => Promise<boolean>;
|
|
89
93
|
saveWorkspaceCloudSyncSettings: (settings: {
|
|
90
94
|
enabled: boolean;
|