@taskforcehq/taskforce 0.3.170 → 0.3.300

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (696) hide show
  1. package/README.md +52 -21
  2. package/dist/Taskforce.module.css +3394 -5981
  3. package/dist/TaskforceCore.CategoryFallback.test.js +5 -2
  4. package/dist/TaskforceCore.filter-persistence.test.js +402 -0
  5. package/dist/TaskforceCore.js +388 -71
  6. package/dist/TaskforceCore.routing.test.js +311 -0
  7. package/dist/TaskforceCore.test.js +3344 -615
  8. package/dist/TaskforceWidget.js +3 -2
  9. package/dist/__tests__/localizationCatalogs.test.js +48 -31
  10. package/dist/__tests__/workflowSimulation.test.js +2 -2
  11. package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.d.ts +60 -0
  12. package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.js +324 -0
  13. package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.test.js +278 -0
  14. package/dist/annotatedAttachments/payload.d.ts +2 -0
  15. package/dist/annotatedAttachments/payload.js +54 -0
  16. package/dist/annotatedAttachments/payload.test.js +67 -0
  17. package/dist/annotatedAttachments/service.d.ts +49 -0
  18. package/dist/annotatedAttachments/service.js +121 -0
  19. package/dist/annotatedAttachments/types.d.ts +86 -0
  20. package/dist/cli.js +74 -25
  21. package/dist/compat/deploymentCompat.d.ts +12 -0
  22. package/dist/compat/deploymentCompat.js +43 -0
  23. package/dist/compat/workspaceSyncCompat.d.ts +6 -0
  24. package/dist/compat/workspaceSyncCompat.js +79 -0
  25. package/dist/compat/workspaceSyncCompat.test.js +87 -0
  26. package/dist/components/features/AgentsModule.d.ts +5 -0
  27. package/dist/components/features/AgentsModule.js +131 -0
  28. package/dist/components/features/AgentsModule.test.js +102 -0
  29. package/dist/components/features/AnnotatedAttachmentWorkspace.d.ts +24 -0
  30. package/dist/components/features/AnnotatedAttachmentWorkspace.js +1942 -0
  31. package/dist/components/features/AnnotatedAttachmentWorkspace.test.js +2831 -0
  32. package/dist/components/features/DocumentGenerateModal.js +8 -16
  33. package/dist/components/features/DocumentIndex.d.ts +3 -4
  34. package/dist/components/features/DocumentIndex.js +22 -10
  35. package/dist/components/features/DocumentViewer.d.ts +6 -2
  36. package/dist/components/features/DocumentViewer.js +1000 -18
  37. package/dist/components/features/DocumentWorkspace.d.ts +40 -2
  38. package/dist/components/features/DocumentWorkspace.js +96 -16
  39. package/dist/components/features/DocumentWorkspace.test.js +1202 -0
  40. package/dist/components/features/InitiativesModule.d.ts +22 -0
  41. package/dist/components/features/InitiativesModule.js +33 -0
  42. package/dist/components/features/TaskSettings.d.ts +41 -32
  43. package/dist/components/features/TaskSettings.js +798 -313
  44. package/dist/components/features/TaskSettings.test.js +1221 -47
  45. package/dist/components/features/WorkflowsModule.d.ts +27 -0
  46. package/dist/components/features/WorkflowsModule.js +21 -0
  47. package/dist/components/features/documentWorkspaceFilters.d.ts +10 -0
  48. package/dist/components/features/documentWorkspaceFilters.js +11 -0
  49. package/dist/components/features/settings/CategoryManager.d.ts +2 -0
  50. package/dist/components/features/settings/CategoryManager.js +15 -8
  51. package/dist/components/features/settings/PriorityManager.d.ts +18 -0
  52. package/dist/components/features/settings/PriorityManager.js +51 -0
  53. package/dist/components/features/settings/TaxonomyEditor.d.ts +2 -1
  54. package/dist/components/features/settings/TaxonomyEditor.js +41 -18
  55. package/dist/components/features/settings/TaxonomyLibraryManager.d.ts +26 -0
  56. package/dist/components/features/settings/TaxonomyLibraryManager.js +301 -0
  57. package/dist/components/features/settings/TaxonomyLibraryManager.test.js +141 -0
  58. package/dist/components/features/settings/TaxonomyManager.d.ts +35 -12
  59. package/dist/components/features/settings/TaxonomyManager.js +59 -27
  60. package/dist/components/features/settings/TypeManager.d.ts +11 -0
  61. package/dist/components/features/settings/TypeManager.js +48 -11
  62. package/dist/components/features/settings/{WorkflowEditorPrototype.d.ts → WorkflowEditor.d.ts} +2 -2
  63. package/dist/components/features/settings/{WorkflowEditorPrototype.js → WorkflowEditor.js} +3 -3
  64. package/dist/components/task/TaskActionHeader.d.ts +12 -2
  65. package/dist/components/task/TaskActionHeader.js +64 -8
  66. package/dist/components/task/TaskActionHeader.test.js +73 -0
  67. package/dist/components/task/TaskCard.d.ts +14 -16
  68. package/dist/components/task/TaskCard.js +144 -174
  69. package/dist/components/task/TaskCard.test.js +416 -64
  70. package/dist/components/task/TaskContextUpload.d.ts +6 -5
  71. package/dist/components/task/TaskContextUpload.js +199 -64
  72. package/dist/components/task/TaskContextUpload.test.js +331 -14
  73. package/dist/components/task/TaskForm.d.ts +23 -29
  74. package/dist/components/task/TaskForm.js +348 -169
  75. package/dist/components/task/TaskForm.test.js +419 -23
  76. package/dist/components/task/TaskKanban.d.ts +20 -21
  77. package/dist/components/task/TaskKanban.js +176 -316
  78. package/dist/components/task/TaskKanban.planning-drop.test.js +93 -0
  79. package/dist/components/task/TaskList.d.ts +22 -11
  80. package/dist/components/task/TaskList.js +98 -12
  81. package/dist/components/task/TaskList.test.js +206 -7
  82. package/dist/components/task/TaskReferenceBadge.d.ts +12 -0
  83. package/dist/components/task/TaskReferenceBadge.js +5 -0
  84. package/dist/components/task/TaskStatusActions.d.ts +12 -0
  85. package/dist/components/task/TaskStatusActions.js +18 -0
  86. package/dist/components/task/TaskStatusActions.test.js +45 -0
  87. package/dist/components/ui/ImageReferenceBadge.d.ts +12 -0
  88. package/dist/components/ui/ImageReferenceBadge.js +5 -0
  89. package/dist/components/ui/LevelSelector.d.ts +2 -1
  90. package/dist/components/ui/LevelSelector.js +2 -2
  91. package/dist/components/ui/Markdown.d.ts +1 -2
  92. package/dist/components/ui/Markdown.js +2 -13
  93. package/dist/components/ui/Modal.d.ts +3 -2
  94. package/dist/components/ui/Modal.js +4 -3
  95. package/dist/components/ui/MultiSelectFilter.d.ts +3 -1
  96. package/dist/components/ui/MultiSelectFilter.js +2 -2
  97. package/dist/components/ui/ReferenceBadgeButton.d.ts +13 -0
  98. package/dist/components/ui/ReferenceBadgeButton.js +6 -0
  99. package/dist/components/ui/TaxonomyDropdown.d.ts +7 -1
  100. package/dist/components/ui/TaxonomyDropdown.js +58 -23
  101. package/dist/components/ui/TopNoticeLayer.d.ts +7 -0
  102. package/dist/components/ui/TopNoticeLayer.js +14 -0
  103. package/dist/components/ui/TopNoticeLayer.test.js +25 -0
  104. package/dist/components/views/AppShellHeader.d.ts +13 -0
  105. package/dist/components/views/AppShellHeader.js +19 -0
  106. package/dist/components/views/AppShellHeader.test.js +21 -0
  107. package/dist/components/views/PlanComparisonPage.d.ts +73 -0
  108. package/dist/components/views/PlanComparisonPage.js +196 -0
  109. package/dist/components/views/PlanComparisonPage.test.js +251 -0
  110. package/dist/components/views/PlansPage.d.ts +14 -0
  111. package/dist/components/views/PlansPage.js +355 -0
  112. package/dist/components/views/StandaloneLayout.d.ts +2 -2
  113. package/dist/components/views/StandaloneLayout.js +2212 -1194
  114. package/dist/components/views/WidgetView.d.ts +2 -2
  115. package/dist/components/views/WidgetView.js +149 -43
  116. package/dist/components/views/chrome/WorkspaceChromeSections.d.ts +57 -0
  117. package/dist/components/views/chrome/WorkspaceChromeSections.js +38 -0
  118. package/dist/components/views/chrome/WorkspaceChromeSections.test.js +54 -0
  119. package/dist/components/views/chrome/workspaceChrome.d.ts +31 -0
  120. package/dist/components/views/chrome/workspaceChrome.js +108 -0
  121. package/dist/components/views/chrome/workspaceChrome.test.js +52 -0
  122. package/dist/components/views/panels/DocumentFilterToolbar.d.ts +10 -0
  123. package/dist/components/views/panels/DocumentFilterToolbar.js +7 -0
  124. package/dist/components/views/panels/DocumentFilterToolbar.test.js +19 -0
  125. package/dist/components/views/panels/FilterToolbar.d.ts +66 -0
  126. package/dist/components/views/panels/FilterToolbar.js +21 -0
  127. package/dist/components/views/panels/FilterToolbar.test.d.ts +1 -0
  128. package/dist/components/views/panels/FilterToolbar.test.js +45 -0
  129. package/dist/components/views/panels/FilterToolbarControls.d.ts +46 -0
  130. package/dist/components/views/panels/FilterToolbarControls.js +61 -0
  131. package/dist/components/views/panels/PlanningDrawer.d.ts +115 -0
  132. package/dist/components/views/panels/PlanningDrawer.js +220 -0
  133. package/dist/components/views/panels/ScheduleSidebar.d.ts +52 -0
  134. package/dist/components/views/panels/ScheduleSidebar.js +127 -0
  135. package/dist/components/views/panels/scheduleUtils.d.ts +14 -0
  136. package/dist/components/views/panels/scheduleUtils.js +79 -0
  137. package/dist/components/views/teamManagementAccess.d.ts +6 -0
  138. package/dist/components/views/teamManagementAccess.js +18 -0
  139. package/dist/components/views/teamManagementAccess.test.d.ts +1 -0
  140. package/dist/components/views/teamManagementAccess.test.js +44 -0
  141. package/dist/config/clientDeployment.d.ts +2 -0
  142. package/dist/config/clientDeployment.js +13 -0
  143. package/dist/config/cloudEnvironment.d.ts +15 -0
  144. package/dist/config/cloudEnvironment.js +60 -0
  145. package/dist/config/deployment.d.ts +20 -0
  146. package/dist/config/deployment.js +67 -0
  147. package/dist/config/deployment.test.d.ts +1 -0
  148. package/dist/config/deployment.test.js +88 -0
  149. package/dist/config/envSchema.js +36 -8
  150. package/dist/config/envSchema.test.js +28 -0
  151. package/dist/core/AiProfileService.d.ts +66 -0
  152. package/dist/core/AiProfileService.js +320 -0
  153. package/dist/core/AiProfileService.test.d.ts +1 -0
  154. package/dist/core/AiProfileService.test.js +164 -0
  155. package/dist/core/AiProfiles.test.d.ts +1 -0
  156. package/dist/core/AiProfiles.test.js +449 -0
  157. package/dist/core/AttachmentLinkService.d.ts +15 -0
  158. package/dist/core/AttachmentLinkService.js +157 -0
  159. package/dist/core/AuthTokenService.d.ts +44 -0
  160. package/dist/core/AuthTokenService.js +207 -0
  161. package/dist/core/CreatedBy.test.js +134 -6
  162. package/dist/core/DeletedTaskLifecycleService.d.ts +33 -0
  163. package/dist/core/DeletedTaskLifecycleService.js +158 -0
  164. package/dist/core/DeletedTaskTrash.test.d.ts +1 -0
  165. package/dist/core/DeletedTaskTrash.test.js +104 -0
  166. package/dist/core/EntitlementsPolicy.test.js +78 -5
  167. package/dist/core/GlobalSettingsService.d.ts +16 -0
  168. package/dist/core/GlobalSettingsService.js +370 -0
  169. package/dist/core/JsonBackupRuntime.test.d.ts +1 -0
  170. package/dist/core/JsonBackupRuntime.test.js +155 -0
  171. package/dist/core/McpTokenService.d.ts +118 -0
  172. package/dist/core/McpTokenService.js +921 -0
  173. package/dist/core/PlanEntitlementService.d.ts +201 -0
  174. package/dist/core/PlanEntitlementService.js +1442 -0
  175. package/dist/core/PlanVersionPolicy.test.d.ts +1 -0
  176. package/dist/core/PlanVersionPolicy.test.js +178 -0
  177. package/dist/core/PlanningEntities.test.d.ts +1 -0
  178. package/dist/core/PlanningEntities.test.js +95 -0
  179. package/dist/core/ScheduleFields.test.js +15 -19
  180. package/dist/core/SignupMonetizationSettings.test.d.ts +1 -0
  181. package/dist/core/SignupMonetizationSettings.test.js +159 -0
  182. package/dist/core/Stats.test.d.ts +1 -0
  183. package/dist/core/Stats.test.js +36 -0
  184. package/dist/core/SyncReconciliationService.d.ts +93 -0
  185. package/dist/core/SyncReconciliationService.js +406 -0
  186. package/dist/core/SystemAdmin.test.js +578 -13
  187. package/dist/core/TaskActivityService.d.ts +21 -0
  188. package/dist/core/TaskActivityService.js +130 -0
  189. package/dist/core/TaskAttachmentsCanonical.test.d.ts +1 -0
  190. package/dist/core/TaskAttachmentsCanonical.test.js +306 -0
  191. package/dist/core/TaskAuditTimeline.test.d.ts +1 -0
  192. package/dist/core/TaskAuditTimeline.test.js +132 -0
  193. package/dist/core/TaskTaxonomyValidation.test.js +338 -15
  194. package/dist/core/Taskforce.d.ts +930 -183
  195. package/dist/core/Taskforce.ids.test.js +252 -0
  196. package/dist/core/Taskforce.js +3848 -2532
  197. package/dist/core/Taskforce.mcpAuth.test.d.ts +1 -0
  198. package/dist/core/Taskforce.mcpAuth.test.js +343 -0
  199. package/dist/core/Taskforce.realtimeMutation.test.js +57 -2
  200. package/dist/core/TaxonomySettingsService.d.ts +18 -0
  201. package/dist/core/TaxonomySettingsService.js +162 -0
  202. package/dist/core/WorkspaceDelete.test.js +32 -13
  203. package/dist/core/WorkspaceLifecycleService.d.ts +11 -0
  204. package/dist/core/WorkspaceLifecycleService.js +88 -0
  205. package/dist/core/WorkspacePermissions.test.js +95 -0
  206. package/dist/core/WorkspacePlanMode.test.js +114 -1
  207. package/dist/core/WorkspacePreferenceService.d.ts +41 -0
  208. package/dist/core/WorkspacePreferenceService.js +246 -0
  209. package/dist/core/WorkspaceSyncSettings.test.d.ts +1 -0
  210. package/dist/core/WorkspaceSyncSettings.test.js +65 -0
  211. package/dist/core/__tests__/TaskAttachmentsCanonical.test.d.ts +1 -0
  212. package/dist/core/__tests__/TaskAttachmentsCanonical.test.js +212 -0
  213. package/dist/core/shared.d.ts +36 -0
  214. package/dist/core/shared.js +128 -0
  215. package/dist/core/types.d.ts +614 -0
  216. package/dist/core/types.js +27 -0
  217. package/dist/documentReviews/DocumentReviewCommentStore.d.ts +56 -0
  218. package/dist/documentReviews/DocumentReviewCommentStore.js +230 -0
  219. package/dist/documentReviews/DocumentReviewSessionStore.d.ts +52 -0
  220. package/dist/documentReviews/DocumentReviewSessionStore.js +193 -0
  221. package/dist/documentReviews/DocumentReviewSessionStore.test.d.ts +1 -0
  222. package/dist/documentReviews/DocumentReviewSessionStore.test.js +127 -0
  223. package/dist/documentReviews/service.d.ts +68 -0
  224. package/dist/documentReviews/service.js +210 -0
  225. package/dist/documentReviews/types.d.ts +58 -0
  226. package/dist/documentReviews/types.js +1 -0
  227. package/dist/hooks/auth/useAuthGuardPolicy.d.ts +2 -0
  228. package/dist/hooks/auth/useAuthGuardPolicy.js +1 -0
  229. package/dist/hooks/tasks/useCurrentTaskRelations.d.ts +15 -0
  230. package/dist/hooks/tasks/useCurrentTaskRelations.js +37 -0
  231. package/dist/hooks/tasks/useTaskActions.d.ts +3 -0
  232. package/dist/hooks/tasks/useTaskActions.js +2 -0
  233. package/dist/hooks/tasks/useTaskEditorNavigation.d.ts +65 -0
  234. package/dist/hooks/tasks/useTaskEditorNavigation.js +235 -0
  235. package/dist/hooks/tasks/useTaskFilters.d.ts +2 -0
  236. package/dist/hooks/tasks/useTaskFilters.js +2 -0
  237. package/dist/hooks/tasks/useTaskFormActions.d.ts +58 -0
  238. package/dist/hooks/tasks/useTaskFormActions.js +365 -0
  239. package/dist/hooks/tasks/useTaskRelationships.d.ts +16 -0
  240. package/dist/hooks/tasks/useTaskRelationships.js +64 -0
  241. package/dist/hooks/ui/useResourceExport.d.ts +19 -0
  242. package/dist/hooks/ui/useResourceExport.js +84 -0
  243. package/dist/hooks/ui/useSettingsModel.d.ts +203 -0
  244. package/dist/hooks/ui/useSettingsModel.js +125 -0
  245. package/dist/hooks/ui/useSettingsPersistence.d.ts +36 -0
  246. package/dist/hooks/ui/useSettingsPersistence.js +254 -0
  247. package/dist/hooks/ui/useSettingsTaxonomyManagement.d.ts +119 -0
  248. package/dist/hooks/ui/useSettingsTaxonomyManagement.js +536 -0
  249. package/dist/hooks/ui/useUiNotice.d.ts +1 -0
  250. package/dist/hooks/ui/useUiNotice.js +1 -0
  251. package/dist/hooks/ui/useWorkflowTemplates.d.ts +37 -0
  252. package/dist/hooks/ui/useWorkflowTemplates.js +111 -0
  253. package/dist/hooks/ui/useZenMode.d.ts +5 -0
  254. package/dist/hooks/ui/useZenMode.js +32 -0
  255. package/dist/hooks/useFilterSort.d.ts +60 -0
  256. package/dist/hooks/useFilterSort.js +362 -0
  257. package/dist/hooks/useFilterSort.test.d.ts +1 -0
  258. package/dist/hooks/useFilterSort.test.js +333 -0
  259. package/dist/hooks/useRealtimeSync.d.ts +1 -0
  260. package/dist/hooks/useRealtimeSync.js +24 -9
  261. package/dist/hooks/useRealtimeSync.test.js +28 -1
  262. package/dist/hooks/useSyncOrchestrator.aiProfiles.test.d.ts +1 -0
  263. package/dist/hooks/useSyncOrchestrator.aiProfiles.test.js +34 -0
  264. package/dist/hooks/useSyncOrchestrator.d.ts +65 -103
  265. package/dist/hooks/useSyncOrchestrator.js +1538 -670
  266. package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +700 -174
  267. package/dist/hooks/useTaskData.d.ts +35 -0
  268. package/dist/hooks/useTaskData.js +239 -0
  269. package/dist/hooks/useTaskData.test.d.ts +1 -0
  270. package/dist/hooks/useTaskData.test.js +119 -0
  271. package/dist/hooks/useTaskMutations.d.ts +46 -0
  272. package/dist/hooks/useTaskMutations.js +472 -0
  273. package/dist/hooks/useTaskMutations.test.d.ts +1 -0
  274. package/dist/hooks/useTaskMutations.test.js +80 -0
  275. package/dist/hooks/useTaskforce.contract.test.d.ts +1 -0
  276. package/dist/hooks/useTaskforce.contract.test.js +7 -0
  277. package/dist/hooks/useTaskforce.d.ts +260 -295
  278. package/dist/hooks/useTaskforce.js +1954 -2623
  279. package/dist/hooks/useTaskforce.priority-filters.test.js +6 -11
  280. package/dist/hooks/useTaskforce.sync-behavior.test.d.ts +1 -0
  281. package/dist/hooks/useTaskforce.sync-behavior.test.js +1120 -0
  282. package/dist/hooks/useUiNotice.d.ts +16 -0
  283. package/dist/hooks/useUiNotice.js +49 -0
  284. package/dist/hooks/useWorkspaceSyncController.d.ts +23 -46
  285. package/dist/hooks/useWorkspaceSyncController.js +280 -461
  286. package/dist/hooks/useWorkspaceSyncController.test.js +106 -199
  287. package/dist/hooks/workspace/useTaskforceApiRouting.d.ts +8 -0
  288. package/dist/hooks/workspace/useTaskforceApiRouting.js +91 -0
  289. package/dist/hooks/workspace/useTaskforceApiRouting.test.d.ts +1 -0
  290. package/dist/hooks/workspace/useTaskforceApiRouting.test.js +60 -0
  291. package/dist/hooks/workspace/useWorkspaceSyncController.d.ts +1 -0
  292. package/dist/hooks/workspace/useWorkspaceSyncController.js +1 -0
  293. package/dist/hooks/workspace/workspaceLocalState.d.ts +30 -0
  294. package/dist/hooks/workspace/workspaceLocalState.js +101 -0
  295. package/dist/localization/locales/en-US.d.ts +1 -8
  296. package/dist/localization/locales/en-US.js +4 -11
  297. package/dist/localization/locales/es-419.js +2 -9
  298. package/dist/localization/locales/pt-BR.js +2 -9
  299. package/dist/localization/localizationCatalogs.test.d.ts +1 -0
  300. package/dist/localization/localizationCatalogs.test.js +37 -0
  301. package/dist/main.d.ts +1 -0
  302. package/dist/main.js +9 -15
  303. package/dist/mcp/clientIntegrations.d.ts +33 -0
  304. package/dist/mcp/clientIntegrations.js +199 -0
  305. package/dist/mcp/clientIntegrations.test.d.ts +1 -0
  306. package/dist/mcp/clientIntegrations.test.js +110 -0
  307. package/dist/mcp/index.d.ts +2 -0
  308. package/dist/mcp/index.js +2 -0
  309. package/dist/mcp/optionResolution.test.js +6 -2
  310. package/dist/mcp/runtime.d.ts +120 -0
  311. package/dist/mcp/runtime.js +5668 -0
  312. package/dist/mcp/runtime.test.d.ts +1 -0
  313. package/dist/mcp/runtime.test.js +3293 -0
  314. package/dist/mcp/server.js +2 -1793
  315. package/dist/mcp/structuredCommentValidation.test.d.ts +1 -0
  316. package/dist/{__tests__ → mcp}/structuredCommentValidation.test.js +1 -1
  317. package/dist/mcp/structuredDocValidation.js +1 -2
  318. package/dist/mcp/structuredDocValidation.test.d.ts +1 -0
  319. package/dist/{__tests__ → mcp}/structuredDocValidation.test.js +9 -4
  320. package/dist/mcp/toolRegistry.d.ts +570 -0
  321. package/dist/mcp/toolRegistry.js +90 -0
  322. package/dist/mcp/toolRegistry.test.d.ts +1 -0
  323. package/dist/mcp/toolRegistry.test.js +30 -0
  324. package/dist/migrations/billingSchemaParity.test.js +111 -0
  325. package/dist/migrations/taskSchemaMigrations.d.ts +5 -0
  326. package/dist/migrations/taskSchemaMigrations.js +681 -39
  327. package/dist/migrations/taskSchemaMigrations.test.d.ts +1 -0
  328. package/dist/migrations/taskSchemaMigrations.test.js +210 -0
  329. package/dist/plugins/vite.js +13 -7
  330. package/dist/public/apple-touch-icon.png +0 -0
  331. package/dist/public/archive/phoenix/apple-touch-icon.png +0 -0
  332. package/dist/public/archive/phoenix/favicon.ico +0 -0
  333. package/dist/public/archive/phoenix/site.webmanifest +1 -0
  334. package/dist/public/favicon-96x96.png +0 -0
  335. package/dist/public/favicon.ico +0 -0
  336. package/dist/public/favicon.svg +17 -0
  337. package/dist/public/site.webmanifest +21 -1
  338. package/dist/public/web-app-manifest-192x192.png +0 -0
  339. package/dist/public/web-app-manifest-512x512.png +0 -0
  340. package/dist/releaseVersion.test.d.ts +1 -0
  341. package/dist/{__tests__/releaseVersion.test.js → releaseVersion.test.js} +1 -1
  342. package/dist/resources/templates/WORKFLOW_V2_POLICY.md +1 -1
  343. package/dist/resources/templates/workflow-sources/workflowDocs.mjs +62 -52
  344. package/dist/resources/templates/workflows/collaborate.yaml +11 -5
  345. package/dist/resources/templates/workflows/do.yaml +8 -2
  346. package/dist/resources/templates/workflows/evaluate.yaml +13 -7
  347. package/dist/resources/templates/workflows/execute.yaml +40 -23
  348. package/dist/resources/templates/workflows/plan.yaml +15 -8
  349. package/dist/resources/templates/workflows/review.yaml +14 -8
  350. package/dist/runtime/appGateDefinitions.d.ts +32 -0
  351. package/dist/runtime/appGateDefinitions.js +32 -0
  352. package/dist/runtime/appGates.d.ts +29 -0
  353. package/dist/runtime/appGates.js +53 -0
  354. package/dist/runtime/appGates.test.d.ts +1 -0
  355. package/dist/runtime/appGates.test.js +42 -0
  356. package/dist/runtime/migrationFlags.d.ts +1 -0
  357. package/dist/runtime/migrationFlags.js +1 -0
  358. package/dist/server/annotatedAttachmentsRoutes.test.d.ts +1 -0
  359. package/dist/server/annotatedAttachmentsRoutes.test.js +473 -0
  360. package/dist/server/auth.js +14 -2
  361. package/dist/server/auth.test.js +21 -1
  362. package/dist/server/cors.js +11 -5
  363. package/dist/server/cors.test.js +6 -0
  364. package/dist/server/documentReviewRoutes.test.d.ts +1 -0
  365. package/dist/server/documentReviewRoutes.test.js +157 -0
  366. package/dist/server/index.cookieProxy.test.js +46 -1
  367. package/dist/server/index.d.ts +20 -0
  368. package/dist/server/index.js +168 -41
  369. package/dist/server/index.rateLimit.test.js +6 -0
  370. package/dist/server/index.test.js +133 -2
  371. package/dist/server/mockStripe.d.ts +72 -0
  372. package/dist/server/mockStripe.js +357 -0
  373. package/dist/server/realtimeSyncWs.js +4 -0
  374. package/dist/server/routes/admin.d.ts +114 -0
  375. package/dist/server/routes/admin.js +2226 -0
  376. package/dist/server/routes/annotatedAttachments.d.ts +24 -0
  377. package/dist/server/routes/annotatedAttachments.js +235 -0
  378. package/dist/server/routes/auth.d.ts +61 -0
  379. package/dist/server/routes/auth.js +1296 -0
  380. package/dist/server/{routes.billing.d.ts → routes/billing.d.ts} +3 -2
  381. package/dist/server/routes/billing.js +2001 -0
  382. package/dist/server/routes/billing.test.d.ts +1 -0
  383. package/dist/server/routes/billing.test.js +1631 -0
  384. package/dist/server/routes/documentReviews.d.ts +11 -0
  385. package/dist/server/routes/documentReviews.js +191 -0
  386. package/dist/server/routes/documents.d.ts +118 -0
  387. package/dist/server/routes/documents.js +1113 -0
  388. package/dist/server/routes/resources.d.ts +25 -0
  389. package/dist/server/routes/resources.js +225 -0
  390. package/dist/server/routes/shared.d.ts +35 -0
  391. package/dist/server/routes/shared.js +305 -0
  392. package/dist/server/routes/shared.test.d.ts +1 -0
  393. package/dist/server/routes/shared.test.js +32 -0
  394. package/dist/server/{routes.sync.d.ts → routes/sync.d.ts} +5 -5
  395. package/dist/server/routes/sync.integration.test.d.ts +1 -0
  396. package/dist/server/routes/sync.integration.test.js +2003 -0
  397. package/dist/server/routes/sync.js +3143 -0
  398. package/dist/server/routes/tasks.d.ts +72 -0
  399. package/dist/server/routes/tasks.js +1252 -0
  400. package/dist/server/routes/workspaces.d.ts +32 -0
  401. package/dist/server/routes/workspaces.js +307 -0
  402. package/dist/server/routes.d.ts +8 -9
  403. package/dist/server/routes.js +968 -4092
  404. package/dist/server/routes.test.js +9043 -2415
  405. package/dist/server/runtimeMode.d.ts +1 -1
  406. package/dist/server/runtimeMode.js +3 -18
  407. package/dist/server/runtimeMode.test.js +3 -3
  408. package/dist/server/securityHeaders.d.ts +1 -1
  409. package/dist/server/securityHeaders.js +65 -6
  410. package/dist/server/securityHeaders.test.js +40 -2
  411. package/dist/services/templateEngine.test.d.ts +1 -0
  412. package/dist/{__tests__ → services}/templateEngine.test.js +1 -1
  413. package/dist/services/templates.test.d.ts +1 -0
  414. package/dist/{__tests__ → services}/templates.test.js +1 -1
  415. package/dist/services/workflowDocumentFixtures.test.d.ts +1 -0
  416. package/dist/{__tests__ → services}/workflowDocumentFixtures.test.js +4 -4
  417. package/dist/services/workflowExportMatrix.test.d.ts +1 -0
  418. package/dist/{__tests__ → services}/workflowExportMatrix.test.js +1 -1
  419. package/dist/services/workflowExportSnapshots.test.d.ts +1 -0
  420. package/dist/services/workflowGeneration.test.d.ts +1 -0
  421. package/dist/services/workflowSimulation.test.d.ts +1 -0
  422. package/dist/services/workflowSimulation.test.js +113 -0
  423. package/dist/services/workflowV2Policy.test.d.ts +1 -0
  424. package/dist/{__tests__ → services}/workflowV2Policy.test.js +2 -2
  425. package/dist/shared/aiProfileSurfaceType.d.ts +9 -0
  426. package/dist/shared/aiProfileSurfaceType.js +49 -0
  427. package/dist/shared/customTaxonomyLibrary.d.ts +11 -0
  428. package/dist/shared/customTaxonomyLibrary.js +276 -0
  429. package/dist/shared/customTaxonomyLibrary.test.d.ts +1 -0
  430. package/dist/shared/customTaxonomyLibrary.test.js +20 -0
  431. package/dist/shared/taxonomyCatalog.d.ts +19 -0
  432. package/dist/shared/taxonomyCatalog.js +36 -0
  433. package/dist/shared/taxonomyDefaults.d.ts +29 -0
  434. package/dist/shared/taxonomyDefaults.js +26 -0
  435. package/dist/shared/taxonomyLibrary.d.ts +15 -0
  436. package/dist/shared/taxonomyLibrary.js +98 -0
  437. package/dist/shared/taxonomyLibrary.test.d.ts +1 -0
  438. package/dist/shared/taxonomyLibrary.test.js +26 -0
  439. package/dist/shared/taxonomyState.d.ts +36 -0
  440. package/dist/shared/taxonomyState.js +73 -0
  441. package/dist/shared/taxonomyState.test.d.ts +1 -0
  442. package/dist/shared/taxonomyState.test.js +71 -0
  443. package/dist/shared/workflowDefaults.d.ts +9 -0
  444. package/dist/shared/workflowDefaults.js +11 -0
  445. package/dist/storage/documentIntegrity.d.ts +2 -0
  446. package/dist/storage/documentIntegrity.js +34 -17
  447. package/dist/storage/documentPurge.d.ts +2 -1
  448. package/dist/storage/documentPurge.js +35 -8
  449. package/dist/storage/index.d.ts +4 -0
  450. package/dist/storage/index.js +2 -0
  451. package/dist/storage/objectStorage.d.ts +1 -1
  452. package/dist/storage/objectStorageClient.d.ts +6 -4
  453. package/dist/storage/objectStorageClient.js +77 -29
  454. package/dist/storage/objectStorageClient.test.d.ts +1 -0
  455. package/dist/storage/objectStorageClient.test.js +57 -0
  456. package/dist/storage/objectStorageConfig.js +3 -1
  457. package/dist/storage/objectStorageConfig.test.d.ts +1 -0
  458. package/dist/storage/objectStorageConfig.test.js +38 -0
  459. package/dist/storage/postgresAdapter.d.ts +5 -0
  460. package/dist/storage/postgresAdapter.js +2 -2
  461. package/dist/storage/postgresAdapter.test.d.ts +1 -0
  462. package/dist/storage/postgresAdapter.test.js +29 -0
  463. package/dist/storage/taskAssetStore.d.ts +7 -4
  464. package/dist/storage/taskAssetStore.js +65 -60
  465. package/dist/storage/workspaceAssetStore.d.ts +122 -0
  466. package/dist/storage/workspaceAssetStore.js +496 -0
  467. package/dist/storage/workspaceAssetStore.test.d.ts +1 -0
  468. package/dist/storage/workspaceAssetStore.test.js +501 -0
  469. package/dist/sync/cloudSyncApi.d.ts +33 -2
  470. package/dist/sync/cloudSyncApi.js +37 -15
  471. package/dist/sync/cloudSyncApi.test.js +60 -3
  472. package/dist/sync/index.d.ts +2 -0
  473. package/dist/sync/index.js +3 -0
  474. package/dist/sync/syncService.d.ts +25 -0
  475. package/dist/sync/syncService.js +184 -16
  476. package/dist/sync/syncService.test.js +289 -25
  477. package/dist/sync/workspaceRepair.d.ts +114 -0
  478. package/dist/sync/workspaceRepair.js +566 -0
  479. package/dist/sync/workspaceSyncModel.d.ts +230 -2
  480. package/dist/sync/workspaceSyncModel.js +456 -17
  481. package/dist/sync/workspaceSyncModel.test.js +642 -0
  482. package/dist/sync/workspaceSyncState.d.ts +12 -0
  483. package/dist/sync/workspaceSyncState.js +12 -0
  484. package/dist/sync/workspaceSyncSurface.d.ts +33 -0
  485. package/dist/sync/workspaceSyncSurface.js +74 -0
  486. package/dist/types.d.ts +143 -18
  487. package/dist/types.js +9 -24
  488. package/dist/ui/assets/AgentsModule-TVmCgizS.js +1 -0
  489. package/dist/ui/assets/AnnotatedAttachmentWorkspace-BaS2VwIr.css +1 -0
  490. package/dist/ui/assets/AnnotatedAttachmentWorkspace-CAyhnPeR.js +3 -0
  491. package/dist/ui/assets/DocumentWorkspace-BOCw5e4D.js +250 -0
  492. package/dist/ui/assets/DocumentWorkspace-C_8T8oz-.css +1 -0
  493. package/dist/ui/assets/InitiativesModule-CN0r02Oi.js +1 -0
  494. package/dist/ui/assets/PlansPage-BlVC_lRq.css +1 -0
  495. package/dist/ui/assets/PlansPage-FcQSNLZd.js +1 -0
  496. package/dist/ui/assets/TaskSettings-BwB9NtmJ.css +1 -0
  497. package/dist/ui/assets/TaskSettings-Cw5zYD1L.js +8 -0
  498. package/dist/ui/assets/WorkflowsModule-CY9R2zPB.js +5 -0
  499. package/dist/ui/assets/index-Bzqy5QGm.js +6 -0
  500. package/dist/ui/assets/index-DxRiI3tY.css +1 -0
  501. package/dist/ui/assets/vendor-dnd-DRzYolkg.js +5 -0
  502. package/dist/ui/assets/{vendor-icons-ZFG3SGwo.js → vendor-icons-QZyhEwgT.js} +1 -1
  503. package/dist/ui/assets/{vendor-markdown-CKYkQHfj.js → vendor-markdown-BUxTU7dS.js} +1 -1
  504. package/dist/ui/assets/vendor-react-CKJs5o3c.js +61 -0
  505. package/dist/ui/assets/vendor-router-BbWMxlnO.js +3 -0
  506. package/dist/ui/branding/logos/logo.png +0 -0
  507. package/dist/ui/branding/logos/logo_dark.svg +27 -0
  508. package/dist/ui/branding/logos/logo_favicon.svg +35 -0
  509. package/dist/ui/branding/logos/logo_light.svg +27 -0
  510. package/dist/ui/favicon/apple-touch-icon.png +0 -0
  511. package/dist/ui/favicon/archive/phoenix/apple-touch-icon.png +0 -0
  512. package/dist/ui/favicon/archive/phoenix/favicon.ico +0 -0
  513. package/dist/ui/favicon/archive/phoenix/site.webmanifest +1 -0
  514. package/dist/ui/favicon/favicon-96x96.png +0 -0
  515. package/dist/ui/favicon/favicon.ico +0 -0
  516. package/dist/ui/favicon/favicon.svg +17 -0
  517. package/dist/ui/favicon/site.webmanifest +21 -1
  518. package/dist/ui/favicon/web-app-manifest-192x192.png +0 -0
  519. package/dist/ui/favicon/web-app-manifest-512x512.png +0 -0
  520. package/dist/ui/index.html +10 -7
  521. package/dist/ui/product/screen_01.png +0 -0
  522. package/dist/ui/product/screen_02.png +0 -0
  523. package/dist/ui/product/screen_03.png +0 -0
  524. package/dist/utils/annotatedAttachments.d.ts +20 -0
  525. package/dist/utils/annotatedAttachments.js +74 -0
  526. package/dist/utils/annotatedAttachments.test.d.ts +1 -0
  527. package/dist/utils/annotatedAttachments.test.js +108 -0
  528. package/dist/utils/assignees.d.ts +26 -0
  529. package/dist/utils/assignees.js +132 -0
  530. package/dist/utils/canonicalAssetKind.d.ts +16 -0
  531. package/dist/utils/canonicalAssetKind.js +39 -0
  532. package/dist/utils/canonicalAssetKind.test.d.ts +1 -0
  533. package/dist/utils/canonicalAssetKind.test.js +24 -0
  534. package/dist/utils/coalescedRefresh.d.ts +5 -0
  535. package/dist/utils/coalescedRefresh.js +16 -0
  536. package/dist/utils/coalescedRefresh.test.d.ts +1 -0
  537. package/dist/utils/coalescedRefresh.test.js +30 -0
  538. package/dist/utils/constants.d.ts +16 -3
  539. package/dist/utils/constants.icons.test.js +2 -1
  540. package/dist/utils/constants.js +70 -13
  541. package/dist/utils/contextAssetEvents.d.ts +7 -0
  542. package/dist/utils/contextAssetEvents.js +6 -0
  543. package/dist/utils/contextFiles.d.ts +14 -3
  544. package/dist/utils/contextFiles.js +40 -8
  545. package/dist/utils/documentManagerApi.d.ts +6 -0
  546. package/dist/utils/documentManagerApi.js +19 -0
  547. package/dist/utils/documentNames.d.ts +24 -0
  548. package/dist/utils/documentNames.js +91 -0
  549. package/dist/utils/documentReferences.d.ts +9 -0
  550. package/dist/utils/documentReferences.js +11 -0
  551. package/dist/utils/entityReferences.d.ts +9 -0
  552. package/dist/utils/entityReferences.js +32 -0
  553. package/dist/utils/imageReferences.d.ts +9 -0
  554. package/dist/utils/imageReferences.js +11 -0
  555. package/dist/utils/planParser.d.ts +2 -2
  556. package/dist/utils/planParser.js +11 -11
  557. package/dist/utils/planParser.test.d.ts +1 -0
  558. package/dist/{__tests__ → utils}/planParser.test.js +22 -22
  559. package/dist/utils/planningReferences.d.ts +17 -0
  560. package/dist/utils/planningReferences.js +30 -0
  561. package/dist/utils/planningReferences.test.d.ts +1 -0
  562. package/dist/utils/planningReferences.test.js +17 -0
  563. package/dist/utils/taskActivity.d.ts +9 -0
  564. package/dist/utils/taskActivity.js +147 -0
  565. package/dist/utils/taskActivity.test.d.ts +1 -0
  566. package/dist/utils/taskActivity.test.js +34 -0
  567. package/dist/utils/taskDraftDefaults.d.ts +21 -0
  568. package/dist/utils/taskDraftDefaults.js +40 -0
  569. package/dist/utils/taskDraftDefaults.test.d.ts +1 -0
  570. package/dist/utils/taskDraftDefaults.test.js +34 -0
  571. package/dist/utils/taskNormalization.d.ts +25 -0
  572. package/dist/utils/taskNormalization.js +161 -0
  573. package/dist/utils/taskNormalization.test.d.ts +1 -0
  574. package/dist/utils/taskNormalization.test.js +158 -0
  575. package/dist/utils/taskReferences.d.ts +5 -0
  576. package/dist/utils/taskReferences.js +11 -0
  577. package/dist/utils/taskforceApiClient.d.ts +2 -0
  578. package/dist/utils/taskforceApiClient.js +101 -3
  579. package/dist/utils/taskforceApiClient.test.d.ts +1 -0
  580. package/dist/utils/taskforceApiClient.test.js +44 -0
  581. package/dist/utils/taxonomyFilterOptions.d.ts +2 -0
  582. package/dist/utils/taxonomyFilterOptions.js +17 -0
  583. package/dist/utils/taxonomyFormDefaults.d.ts +3 -0
  584. package/dist/utils/taxonomyFormDefaults.js +28 -0
  585. package/dist/utils/taxonomyFormDefaults.test.d.ts +1 -0
  586. package/dist/utils/taxonomyFormDefaults.test.js +63 -0
  587. package/dist/utils/taxonomyLifecycle.d.ts +3 -0
  588. package/dist/utils/taxonomyLifecycle.js +17 -0
  589. package/dist/utils/taxonomySorting.d.ts +7 -0
  590. package/dist/utils/taxonomySorting.js +74 -0
  591. package/dist/utils/theme.d.ts +15 -0
  592. package/dist/utils/theme.js +23 -0
  593. package/dist/utils/uiNotice.d.ts +7 -0
  594. package/dist/utils/uiNotice.js +6 -0
  595. package/dist/utils/uiNotice.test.d.ts +1 -0
  596. package/dist/utils/uiNotice.test.js +18 -0
  597. package/dist/utils/workspaceIdentity.d.ts +14 -0
  598. package/dist/utils/workspaceIdentity.js +21 -0
  599. package/dist/utils/workspaceIdentity.test.js +30 -1
  600. package/dist/utils/workspaceSyncPresentation.d.ts +20 -0
  601. package/dist/utils/workspaceSyncPresentation.js +21 -0
  602. package/dist/utils/workspaceSyncPresentation.test.d.ts +1 -0
  603. package/dist/utils/workspaceSyncPresentation.test.js +36 -0
  604. package/package.json +28 -23
  605. package/scripts/bootstrap-playwright-auth.mjs +155 -0
  606. package/scripts/check-compat-boundaries.mjs +41 -0
  607. package/scripts/check-env.ts +9 -2
  608. package/scripts/debug-login.mjs +32 -0
  609. package/scripts/migrate-planning-model.ts +233 -0
  610. package/scripts/migrate-task-data-assets.mjs +408 -0
  611. package/scripts/playwright-auth.sh +11 -0
  612. package/scripts/run-dev-proxy.sh +2 -0
  613. package/scripts/update-homebrew-formula.sh +2 -2
  614. package/scripts/with-esbuild.sh +11 -0
  615. package/src/resources/templates/WORKFLOW_V2_POLICY.md +1 -1
  616. package/src/resources/templates/workflow-sources/workflowDocs.mjs +62 -52
  617. package/src/resources/templates/workflows/collaborate.yaml +11 -5
  618. package/src/resources/templates/workflows/do.yaml +8 -2
  619. package/src/resources/templates/workflows/evaluate.yaml +13 -7
  620. package/src/resources/templates/workflows/execute.yaml +40 -23
  621. package/src/resources/templates/workflows/plan.yaml +15 -8
  622. package/src/resources/templates/workflows/review.yaml +14 -8
  623. package/dist/TaskforceScreenshot.d.ts +0 -11
  624. package/dist/TaskforceScreenshot.js +0 -113
  625. package/dist/compat/priorityCompat.d.ts +0 -2
  626. package/dist/compat/priorityCompat.js +0 -24
  627. package/dist/components/features/settings/TaxonomyManager 2.d.ts +0 -52
  628. package/dist/components/features/settings/TaxonomyManager 2.js +0 -75
  629. package/dist/components/task/TaskKanban 2.d.ts +0 -76
  630. package/dist/components/task/TaskKanban 2.js +0 -1004
  631. package/dist/components/task/TaskScreenshotSection.d.ts +0 -15
  632. package/dist/components/task/TaskScreenshotSection.js +0 -22
  633. package/dist/components/views/StandaloneLayout 2.d.ts +0 -8
  634. package/dist/components/views/StandaloneLayout 2.js +0 -1660
  635. package/dist/core/InitiativeTemplates.test.js +0 -50
  636. package/dist/core/ParentLifecycle.test.js +0 -98
  637. package/dist/migrations/clientMigrations.d.ts +0 -9
  638. package/dist/migrations/clientMigrations.js +0 -74
  639. package/dist/migrations/flags.d.ts +0 -6
  640. package/dist/migrations/flags.js +0 -8
  641. package/dist/migrations/taskMigrations.d.ts +0 -71
  642. package/dist/migrations/taskMigrations.js +0 -236
  643. package/dist/migrations/taskMigrations.test.js +0 -34
  644. package/dist/server/routes.billing.js +0 -991
  645. package/dist/server/routes.billing.test.js +0 -387
  646. package/dist/server/routes.sync.integration.test.js +0 -470
  647. package/dist/server/routes.sync.js +0 -1141
  648. package/dist/soak/syncSoakHarness.d.ts +0 -6
  649. package/dist/soak/syncSoakHarness.js +0 -10
  650. package/dist/ui/assets/index-0W5vyCpn.css +0 -1
  651. package/dist/ui/assets/index-MCZuNNfn.js +0 -23
  652. package/dist/ui/assets/logo_white_01-0Vx-iIIv.png +0 -0
  653. package/dist/ui/assets/vendor-dnd-BI1K77C1.js +0 -5
  654. package/dist/ui/assets/vendor-react-DdIDsh7f.js +0 -9
  655. package/dist/ui/assets/vendor-router-BtiNU7Dl.js +0 -3
  656. package/dist/utils/taskHierarchy.d.ts +0 -4
  657. package/dist/utils/taskHierarchy.js +0 -69
  658. package/dist/utils/taskHierarchy.test.js +0 -38
  659. package/dist/utils/taskParenting.d.ts +0 -3
  660. package/dist/utils/taskParenting.js +0 -24
  661. package/dist/utils/taskParenting.test.js +0 -21
  662. package/dist/utils/taskRelations.d.ts +0 -6
  663. package/dist/utils/taskRelations.js +0 -24
  664. package/dist/utils/taskRelations.test.js +0 -34
  665. package/scripts/check-compat-boundaries.js +0 -48
  666. /package/dist/{__tests__/planParser.test.d.ts → TaskforceCore.filter-persistence.test.d.ts} +0 -0
  667. /package/dist/{__tests__/releaseVersion.test.d.ts → TaskforceCore.routing.test.d.ts} +0 -0
  668. /package/dist/{__tests__/structuredCommentValidation.test.d.ts → annotatedAttachments/AnnotatedAttachmentSessionStore.test.d.ts} +0 -0
  669. /package/dist/{__tests__/structuredDocValidation.test.d.ts → annotatedAttachments/payload.test.d.ts} +0 -0
  670. /package/dist/{__tests__/templateEngine.test.d.ts → annotatedAttachments/types.js} +0 -0
  671. /package/dist/{__tests__/templates.test.d.ts → compat/workspaceSyncCompat.test.d.ts} +0 -0
  672. /package/dist/{__tests__/workflowDocumentFixtures.test.d.ts → components/features/AgentsModule.test.d.ts} +0 -0
  673. /package/dist/{__tests__/workflowExportMatrix.test.d.ts → components/features/AnnotatedAttachmentWorkspace.test.d.ts} +0 -0
  674. /package/dist/{__tests__/workflowExportSnapshots.test.d.ts → components/features/DocumentWorkspace.test.d.ts} +0 -0
  675. /package/dist/{__tests__/workflowGeneration.test.d.ts → components/features/settings/TaxonomyLibraryManager.test.d.ts} +0 -0
  676. /package/dist/{__tests__/workflowV2Policy.test.d.ts → components/task/TaskActionHeader.test.d.ts} +0 -0
  677. /package/dist/{core/InitiativeTemplates.test.d.ts → components/task/TaskKanban.planning-drop.test.d.ts} +0 -0
  678. /package/dist/{core/ParentLifecycle.test.d.ts → components/task/TaskStatusActions.test.d.ts} +0 -0
  679. /package/dist/{migrations/taskMigrations.test.d.ts → components/ui/TopNoticeLayer.test.d.ts} +0 -0
  680. /package/dist/{server/routes.billing.test.d.ts → components/views/AppShellHeader.test.d.ts} +0 -0
  681. /package/dist/{server/routes.sync.integration.test.d.ts → components/views/PlanComparisonPage.test.d.ts} +0 -0
  682. /package/dist/{utils/taskHierarchy.test.d.ts → components/views/chrome/WorkspaceChromeSections.test.d.ts} +0 -0
  683. /package/dist/{utils/taskParenting.test.d.ts → components/views/chrome/workspaceChrome.test.d.ts} +0 -0
  684. /package/dist/{utils/taskRelations.test.d.ts → components/views/panels/DocumentFilterToolbar.test.d.ts} +0 -0
  685. /package/dist/public/{android-chrome-192x192.png → archive/phoenix/android-chrome-192x192.png} +0 -0
  686. /package/dist/public/{android-chrome-512x512.png → archive/phoenix/android-chrome-512x512.png} +0 -0
  687. /package/dist/public/{favicon-16x16.png → archive/phoenix/favicon-16x16.png} +0 -0
  688. /package/dist/public/{favicon-32x32.png → archive/phoenix/favicon-32x32.png} +0 -0
  689. /package/dist/public/{favicon.png → archive/phoenix/favicon.png} +0 -0
  690. /package/dist/{__tests__ → services}/workflowExportSnapshots.test.js +0 -0
  691. /package/dist/{__tests__ → services}/workflowGeneration.test.js +0 -0
  692. /package/dist/ui/favicon/{android-chrome-192x192.png → archive/phoenix/android-chrome-192x192.png} +0 -0
  693. /package/dist/ui/favicon/{android-chrome-512x512.png → archive/phoenix/android-chrome-512x512.png} +0 -0
  694. /package/dist/ui/favicon/{favicon-16x16.png → archive/phoenix/favicon-16x16.png} +0 -0
  695. /package/dist/ui/favicon/{favicon-32x32.png → archive/phoenix/favicon-32x32.png} +0 -0
  696. /package/dist/ui/favicon/{favicon.png → archive/phoenix/favicon.png} +0 -0
@@ -1,6 +1,23 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2
2
  import { act, renderHook, waitFor } from '@testing-library/react';
3
3
  import { useSyncOrchestrator } from './useSyncOrchestrator';
4
+ class MockWebSocket {
5
+ static instances = [];
6
+ url;
7
+ constructor(url) {
8
+ this.url = url;
9
+ MockWebSocket.instances.push(this);
10
+ }
11
+ close() {
12
+ // noop for orchestration gating tests
13
+ }
14
+ addEventListener() {
15
+ // noop for orchestration gating tests
16
+ }
17
+ send() {
18
+ // noop for orchestration gating tests
19
+ }
20
+ }
4
21
  const { ensureCloudWorkspaceReadyForSyncServiceMock, runWorkspacePullSyncServiceMock, runWorkspacePushSyncServiceMock, syncUserGlobalSettingsServiceMock } = vi.hoisted(() => ({
5
22
  ensureCloudWorkspaceReadyForSyncServiceMock: vi.fn(),
6
23
  runWorkspacePullSyncServiceMock: vi.fn(),
@@ -23,6 +40,7 @@ function buildInput(overrides) {
23
40
  currentWorkspaceId: 'workspace-local-active',
24
41
  cloudAuthConfigured: true,
25
42
  runtimeMode: 'local',
43
+ authSessionResolved: true,
26
44
  isAuthenticated: true,
27
45
  authUserId: 'user-1',
28
46
  projectName: 'Test Project',
@@ -31,6 +49,8 @@ function buildInput(overrides) {
31
49
  realtimeSyncEnabled: false,
32
50
  tasks: [],
33
51
  archivedTasks: [],
52
+ initiatives: [],
53
+ workstreams: [],
34
54
  taxonomies: [],
35
55
  setupState: null,
36
56
  globalTheme: 'dark',
@@ -47,36 +67,14 @@ function buildInput(overrides) {
47
67
  setSetupState: vi.fn(),
48
68
  setLocale: vi.fn(),
49
69
  setGlobalWeekStartsOn: vi.fn(),
70
+ fetchPlanningEntities: vi.fn(async () => { }),
50
71
  ...overrides
51
72
  };
52
73
  }
53
- describe('useSyncOrchestrator retry closure', () => {
74
+ describe('useSyncOrchestrator', () => {
54
75
  beforeEach(() => {
55
76
  localStorage.clear();
56
77
  ensureCloudWorkspaceReadyForSyncServiceMock.mockResolvedValue({ success: true });
57
- runWorkspacePullSyncServiceMock.mockResolvedValue({
58
- success: false,
59
- kind: 'pull_http',
60
- status: 503,
61
- cursor: null,
62
- pages: 0,
63
- appliedChanges: 0,
64
- pullRequestMs: 1,
65
- applyMs: 0,
66
- pulledDeleteTaskIds: new Set(),
67
- pulledActiveUpserts: false,
68
- pulledArchivedUpserts: false
69
- });
70
- runWorkspacePushSyncServiceMock.mockResolvedValue({
71
- success: true,
72
- syncedAt: new Date().toISOString(),
73
- changeCount: 0,
74
- deleteCount: 0,
75
- requestMs: 1,
76
- currentTaskIds: new Set(),
77
- pushedWatermarks: new Map(),
78
- deleteTaskIds: new Set()
79
- });
80
78
  syncUserGlobalSettingsServiceMock.mockResolvedValue({
81
79
  success: true,
82
80
  mode: 'pulled',
@@ -89,10 +87,13 @@ describe('useSyncOrchestrator retry closure', () => {
89
87
  json: () => Promise.resolve({
90
88
  success: true,
91
89
  state: {
92
- cloudSyncEnabled: true,
93
- sourceOfTruth: 'cloud',
94
- onboardingCompleted: true,
95
- pullCursor: ''
90
+ version: 2,
91
+ enabled: true,
92
+ phase: 'active',
93
+ pullCursor: null,
94
+ lastPullAt: null,
95
+ lastPushAt: null,
96
+ lastSyncedAt: null
96
97
  }
97
98
  })
98
99
  });
@@ -103,90 +104,325 @@ describe('useSyncOrchestrator retry closure', () => {
103
104
  if (url.includes('/api/taskforce/sync/workspace/documents')) {
104
105
  return Promise.resolve({ ok: true, json: () => Promise.resolve({ documents: [] }) });
105
106
  }
107
+ if (url.includes('/api/taskforce/sync/workspace/annotated-attachments')) {
108
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ sessions: [] }) });
109
+ }
106
110
  if (url.includes('/api/taskforce/sync/events')) {
107
111
  return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
108
112
  }
109
- return Promise.resolve({ ok: true, json: () => Promise.resolve({}) });
113
+ if (url.includes('/api/taskforce/tasks')) {
114
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ tasks: [] }) });
115
+ }
116
+ if (url.includes('/api/taskforce/archive')) {
117
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ archived: [] }) });
118
+ }
119
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
110
120
  }));
111
121
  });
112
- afterEach(() => {
122
+ afterEach(async () => {
123
+ await Promise.resolve();
124
+ await Promise.resolve();
125
+ vi.useRealTimers();
113
126
  vi.unstubAllGlobals();
114
127
  vi.clearAllMocks();
128
+ MockWebSocket.instances = [];
115
129
  });
116
- it('uses latest pull callback when delayed retry fires after auth state changes', async () => {
130
+ it('uses the latest retry callback after auth state changes', async () => {
131
+ vi.useFakeTimers();
132
+ runWorkspacePullSyncServiceMock.mockResolvedValue({
133
+ success: false,
134
+ kind: 'pull_http',
135
+ status: 503,
136
+ transient: true,
137
+ retryAfterMs: 250,
138
+ cursor: null,
139
+ pages: 0,
140
+ appliedChanges: 0,
141
+ pullRequestMs: 1,
142
+ applyMs: 0,
143
+ pulledDeleteTaskIds: new Set(),
144
+ pulledActiveUpserts: false,
145
+ pulledArchivedUpserts: false
146
+ });
117
147
  let input = buildInput();
118
- const { result, rerender } = renderHook((props) => useSyncOrchestrator(props), {
148
+ const { result, rerender, unmount } = renderHook((props) => useSyncOrchestrator(props), {
119
149
  initialProps: input
120
150
  });
121
151
  act(() => {
122
152
  result.current.applyWorkspaceSyncStateSnapshot({
123
- cloudSyncEnabled: true,
124
- sourceOfTruth: 'cloud',
125
- onboardingCompleted: true,
126
- pullCursor: ''
153
+ enabled: true,
154
+ phase: 'active',
155
+ pullCursor: null
127
156
  });
128
157
  });
129
- await waitFor(() => {
130
- expect(result.current.workspaceCloudSyncEnabled).toBe(true);
131
- });
132
158
  await act(async () => {
133
159
  await result.current.pullWorkspaceChangesFromCloud();
134
160
  });
135
- await waitFor(() => {
136
- expect(runWorkspacePullSyncServiceMock.mock.calls.length).toBeGreaterThanOrEqual(1);
137
- });
138
- await waitFor(() => {
139
- expect(result.current.workspaceRetryAt).not.toBeNull();
140
- });
161
+ const pullCallsBeforeRetry = runWorkspacePullSyncServiceMock.mock.calls.length;
162
+ expect(pullCallsBeforeRetry).toBeGreaterThanOrEqual(1);
163
+ expect(result.current.workspaceRetryAt).not.toBeNull();
141
164
  input = buildInput({
142
165
  isAuthenticated: false,
143
166
  checkAuthSession: vi.fn(async () => false)
144
167
  });
145
168
  rerender(input);
146
169
  await act(async () => {
147
- await new Promise((resolve) => setTimeout(resolve, 250));
170
+ await vi.runOnlyPendingTimersAsync();
148
171
  });
149
- expect(runWorkspacePullSyncServiceMock.mock.calls.length).toBeGreaterThanOrEqual(1);
172
+ expect(runWorkspacePullSyncServiceMock).toHaveBeenCalledTimes(pullCallsBeforeRetry);
173
+ unmount();
150
174
  });
151
- it('skips pull when another tab holds the workspace lease (non-leader coordination)', async () => {
152
- const leaseKey = 'taskforce.sync.pullLease.v1.workspace-local-active';
153
- window.localStorage.setItem(leaseKey, JSON.stringify({
154
- owner: 'other-tab',
155
- acquiredAt: Date.now(),
156
- expiresAt: Date.now() + 30_000
175
+ it('does not enable realtime until auth session is resolved with a non-anonymous user', async () => {
176
+ vi.stubGlobal('WebSocket', MockWebSocket);
177
+ const { result, rerender, unmount } = renderHook((props) => useSyncOrchestrator(props), {
178
+ initialProps: buildInput({
179
+ realtimeSyncEnabled: true,
180
+ authSessionResolved: false,
181
+ authUserId: 'anonymous'
182
+ })
183
+ });
184
+ act(() => {
185
+ result.current.applyWorkspaceSyncStateSnapshot({
186
+ enabled: true,
187
+ phase: 'active',
188
+ pullCursor: null
189
+ });
190
+ });
191
+ expect(MockWebSocket.instances).toHaveLength(0);
192
+ rerender(buildInput({
193
+ realtimeSyncEnabled: true,
194
+ authSessionResolved: true,
195
+ authUserId: 'anonymous'
196
+ }));
197
+ expect(MockWebSocket.instances).toHaveLength(0);
198
+ rerender(buildInput({
199
+ realtimeSyncEnabled: true,
200
+ authSessionResolved: true,
201
+ authUserId: 'user-1'
157
202
  }));
158
- vi.stubGlobal('navigator', { locks: undefined });
159
- const { result } = renderHook((props) => useSyncOrchestrator(props), {
203
+ await waitFor(() => {
204
+ expect(MockWebSocket.instances).toHaveLength(1);
205
+ });
206
+ expect(MockWebSocket.instances[0]?.url).toBe('wss://api.example.com/taskforce-ws');
207
+ unmount();
208
+ });
209
+ it('retries transient push failures automatically', async () => {
210
+ runWorkspacePushSyncServiceMock
211
+ .mockResolvedValueOnce({
212
+ success: false,
213
+ status: 503,
214
+ transient: true,
215
+ retryAfterMs: 200,
216
+ requestMs: 1,
217
+ changeCount: 1,
218
+ deleteCount: 0,
219
+ currentTaskIds: new Set(),
220
+ deleteTaskIds: new Set(),
221
+ currentDocumentPaths: new Set(),
222
+ deleteDocumentPaths: new Set(),
223
+ currentDocumentWatermarks: new Map(),
224
+ pushedWatermarks: new Map(),
225
+ emittedEventIds: []
226
+ })
227
+ .mockResolvedValueOnce({
228
+ success: true,
229
+ syncedAt: '2026-03-15T15:00:00.000Z',
230
+ requestMs: 1,
231
+ changeCount: 1,
232
+ deleteCount: 0,
233
+ currentTaskIds: new Set(['task-1']),
234
+ deleteTaskIds: new Set(),
235
+ currentDocumentPaths: new Set(),
236
+ deleteDocumentPaths: new Set(),
237
+ currentDocumentWatermarks: new Map(),
238
+ pushedWatermarks: new Map([['task-1', '2026-03-14T12:00:00.000Z']]),
239
+ emittedEventIds: []
240
+ });
241
+ const task = {
242
+ id: 'task-1',
243
+ status: 'task',
244
+ title: 'Retry me',
245
+ createdAt: '2026-03-14T12:00:00.000Z',
246
+ updatedAt: '2026-03-14T12:00:00.000Z'
247
+ };
248
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
249
+ initialProps: buildInput({ tasks: [task] })
250
+ });
251
+ act(() => {
252
+ result.current.applyWorkspaceSyncStateSnapshot({
253
+ enabled: true,
254
+ phase: 'provision-local',
255
+ pullCursor: null
256
+ });
257
+ });
258
+ expect(result.current.workspaceCloudSyncEnabled).toBe(true);
259
+ expect(result.current.workspaceSyncPhase).toBe('provision-local');
260
+ await act(async () => {
261
+ await result.current.pushWorkspaceChangesToCloud('sig-push-retry');
262
+ });
263
+ expect(runWorkspacePushSyncServiceMock).toHaveBeenCalledTimes(1);
264
+ expect(result.current.isWorkspaceRetryPending()).toBe(true);
265
+ await act(async () => {
266
+ await result.current.pushWorkspaceChangesToCloud('sig-push-retry');
267
+ });
268
+ await waitFor(() => {
269
+ expect(runWorkspacePushSyncServiceMock).toHaveBeenCalledTimes(2);
270
+ });
271
+ expect(result.current.workspaceSyncPhase).toBe('active');
272
+ expect(result.current.workspaceLastPushAt).toBe('2026-03-15T15:00:00.000Z');
273
+ await act(async () => {
274
+ await Promise.resolve();
275
+ await Promise.resolve();
276
+ });
277
+ unmount();
278
+ });
279
+ it('keeps the last workspace error visible while a retry attempt is in flight', async () => {
280
+ let resolveRetryPull = null;
281
+ runWorkspacePullSyncServiceMock
282
+ .mockResolvedValueOnce({
283
+ success: false,
284
+ kind: 'apply_all_candidates',
285
+ status: 400,
286
+ transient: true,
287
+ hasTransientApplyFailure: true,
288
+ error: 'Apply failed during bootstrap',
289
+ failures: ['/api/taskforce/sync/workspace/apply-local:400'],
290
+ cursor: null,
291
+ pages: 0,
292
+ appliedChanges: 0,
293
+ pullRequestMs: 1,
294
+ applyMs: 1,
295
+ pulledDeleteTaskIds: new Set(),
296
+ pulledActiveUpserts: false,
297
+ pulledArchivedUpserts: false,
298
+ documentDecryptFailures: []
299
+ })
300
+ .mockImplementationOnce(() => new Promise((resolve) => {
301
+ resolveRetryPull = resolve;
302
+ }));
303
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
160
304
  initialProps: buildInput()
161
305
  });
162
306
  act(() => {
163
307
  result.current.applyWorkspaceSyncStateSnapshot({
164
- cloudSyncEnabled: true,
165
- sourceOfTruth: 'cloud',
166
- onboardingCompleted: true,
167
- pullCursor: ''
308
+ enabled: true,
309
+ phase: 'attach-cloud',
310
+ pullCursor: null
168
311
  });
169
312
  });
313
+ await waitFor(() => {
314
+ expect(result.current.workspaceLastErrorMessage).toBe('Apply failed during bootstrap');
315
+ expect(result.current.isWorkspaceRetryPending()).toBe(true);
316
+ });
317
+ act(() => {
318
+ void result.current.retryWorkspaceCloudSync();
319
+ });
320
+ await waitFor(() => {
321
+ expect(runWorkspacePullSyncServiceMock).toHaveBeenCalledTimes(2);
322
+ expect(result.current.workspaceSyncBusy).toBe(true);
323
+ expect(result.current.workspaceLastErrorMessage).toBe('Apply failed during bootstrap');
324
+ });
170
325
  await act(async () => {
171
- const pulled = await result.current.pullWorkspaceChangesFromCloud();
172
- expect(pulled).toBe(false);
326
+ resolveRetryPull?.({
327
+ success: true,
328
+ syncedAt: '2026-03-15T19:30:00.000Z',
329
+ cursor: null,
330
+ pages: 1,
331
+ appliedChanges: 0,
332
+ pullRequestMs: 1,
333
+ applyMs: 0,
334
+ pulledDeleteTaskIds: new Set(),
335
+ pulledActiveUpserts: false,
336
+ pulledArchivedUpserts: false,
337
+ documentDecryptFailures: []
338
+ });
339
+ });
340
+ await waitFor(() => {
341
+ expect(result.current.workspaceSyncBusy).toBe(false);
342
+ expect(result.current.workspaceLastPullAt).toBe('2026-03-15T19:30:00.000Z');
173
343
  });
174
- expect(runWorkspacePullSyncServiceMock).not.toHaveBeenCalled();
344
+ unmount();
175
345
  });
176
- it('persists pull cursor/timestamps against the active workspace after workspace switch', async () => {
346
+ it('finishes provision-local bootstrap by moving to active after the first push', async () => {
347
+ runWorkspacePushSyncServiceMock.mockResolvedValue({
348
+ success: true,
349
+ syncedAt: '2026-03-15T18:00:00.000Z',
350
+ requestMs: 1,
351
+ changeCount: 0,
352
+ deleteCount: 0,
353
+ currentTaskIds: new Set(),
354
+ deleteTaskIds: new Set(),
355
+ currentDocumentPaths: new Set(),
356
+ deleteDocumentPaths: new Set(),
357
+ currentDocumentWatermarks: new Map(),
358
+ pushedWatermarks: new Map(),
359
+ emittedEventIds: []
360
+ });
361
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
362
+ initialProps: buildInput()
363
+ });
364
+ act(() => {
365
+ result.current.applyWorkspaceSyncStateSnapshot({
366
+ enabled: true,
367
+ phase: 'provision-local',
368
+ pullCursor: null
369
+ });
370
+ });
371
+ await waitFor(() => {
372
+ expect(result.current.workspaceSyncPhase).toBe('provision-local');
373
+ });
374
+ await act(async () => {
375
+ await result.current.pushWorkspaceChangesToCloud('sig-bootstrap');
376
+ });
377
+ await waitFor(() => {
378
+ expect(result.current.workspaceSyncPhase).toBe('active');
379
+ expect(result.current.workspaceLastPushAt).toBe('2026-03-15T18:00:00.000Z');
380
+ });
381
+ await act(async () => {
382
+ await Promise.resolve();
383
+ await Promise.resolve();
384
+ });
385
+ unmount();
386
+ });
387
+ it('finishes attach-cloud bootstrap after the first successful pull, including zero-change pulls', async () => {
177
388
  runWorkspacePullSyncServiceMock.mockResolvedValue({
178
389
  success: true,
179
- cursor: 'cursor-next',
390
+ syncedAt: '2026-03-15T19:00:00.000Z',
391
+ cursor: null,
180
392
  pages: 1,
181
393
  appliedChanges: 0,
182
- pullRequestMs: 2,
183
- applyMs: 1,
184
- syncedAt: '2026-02-23T00:00:00.000Z',
394
+ pullRequestMs: 1,
395
+ applyMs: 0,
185
396
  pulledDeleteTaskIds: new Set(),
186
397
  pulledActiveUpserts: false,
187
- pulledArchivedUpserts: false
398
+ pulledArchivedUpserts: false,
399
+ documentDecryptFailures: []
400
+ });
401
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
402
+ initialProps: buildInput()
188
403
  });
189
- const uiStatePosts = [];
404
+ act(() => {
405
+ result.current.applyWorkspaceSyncStateSnapshot({
406
+ enabled: true,
407
+ phase: 'attach-cloud',
408
+ pullCursor: null
409
+ });
410
+ });
411
+ await waitFor(() => {
412
+ expect(result.current.workspaceSyncPhase).toBe('active');
413
+ expect(result.current.workspaceLastPullAt).toBe('2026-03-15T19:00:00.000Z');
414
+ });
415
+ unmount();
416
+ });
417
+ it('does not auto-push local state immediately after attach-cloud bootstrap completes', async () => {
418
+ vi.useFakeTimers();
419
+ const task = {
420
+ id: 'task-1',
421
+ status: 'task',
422
+ title: 'Local stale task',
423
+ createdAt: '2026-03-14T12:00:00.000Z',
424
+ updatedAt: '2026-03-14T12:00:00.000Z'
425
+ };
190
426
  vi.stubGlobal('fetch', vi.fn((url, init) => {
191
427
  if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
192
428
  return Promise.resolve({
@@ -194,75 +430,338 @@ describe('useSyncOrchestrator retry closure', () => {
194
430
  json: () => Promise.resolve({
195
431
  success: true,
196
432
  state: {
197
- cloudSyncEnabled: true,
198
- sourceOfTruth: 'cloud',
199
- onboardingCompleted: true,
200
- pullCursor: ''
433
+ version: 2,
434
+ enabled: true,
435
+ phase: 'attach-cloud',
436
+ pullCursor: null,
437
+ lastPullAt: null,
438
+ lastPushAt: null,
439
+ lastSyncedAt: null
201
440
  }
202
441
  })
203
442
  });
204
443
  }
205
444
  if (url.includes('/api/taskforce/ui-state') && String(init?.method || '').toUpperCase() === 'POST') {
206
- const body = JSON.parse(String(init?.body || '{}'));
207
- uiStatePosts.push(body);
208
445
  return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
209
446
  }
210
447
  if (url.includes('/api/taskforce/sync/workspace/documents')) {
211
448
  return Promise.resolve({ ok: true, json: () => Promise.resolve({ documents: [] }) });
212
449
  }
450
+ if (url.includes('/api/taskforce/sync/workspace/annotated-attachments')) {
451
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ sessions: [] }) });
452
+ }
213
453
  if (url.includes('/api/taskforce/sync/events')) {
214
454
  return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
215
455
  }
216
- return Promise.resolve({ ok: true, json: () => Promise.resolve({}) });
456
+ if (url.includes('/api/taskforce/tasks')) {
457
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ tasks: [] }) });
458
+ }
459
+ if (url.includes('/api/taskforce/archive')) {
460
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ archived: [] }) });
461
+ }
462
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
217
463
  }));
218
- let input = buildInput({ currentWorkspaceId: 'workspace-a' });
219
- const { result, rerender } = renderHook((props) => useSyncOrchestrator(props), {
220
- initialProps: input
464
+ runWorkspacePullSyncServiceMock.mockResolvedValue({
465
+ success: true,
466
+ syncedAt: '2026-03-15T19:00:00.000Z',
467
+ cursor: null,
468
+ pages: 1,
469
+ appliedChanges: 0,
470
+ pullRequestMs: 1,
471
+ applyMs: 0,
472
+ pulledDeleteTaskIds: new Set(),
473
+ pulledActiveUpserts: false,
474
+ pulledArchivedUpserts: false,
475
+ documentDecryptFailures: []
476
+ });
477
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
478
+ initialProps: buildInput({ tasks: [task] })
221
479
  });
222
480
  act(() => {
223
481
  result.current.applyWorkspaceSyncStateSnapshot({
224
- cloudSyncEnabled: true,
225
- sourceOfTruth: 'cloud',
226
- onboardingCompleted: true,
227
- pullCursor: ''
482
+ enabled: true,
483
+ phase: 'attach-cloud',
484
+ pullCursor: null
228
485
  });
229
486
  });
230
487
  await act(async () => {
231
- await result.current.pullWorkspaceChangesFromCloud();
488
+ await vi.advanceTimersByTimeAsync(2000);
489
+ });
490
+ expect(result.current.workspaceSyncPhase).toBe('active');
491
+ expect(runWorkspacePushSyncServiceMock).not.toHaveBeenCalled();
492
+ unmount();
493
+ });
494
+ it('prevents duplicate local windows from running the same pull concurrently', async () => {
495
+ let resolveFirstPull = null;
496
+ runWorkspacePullSyncServiceMock.mockImplementationOnce(() => new Promise((resolve) => {
497
+ resolveFirstPull = resolve;
498
+ }));
499
+ const firstHook = renderHook((props) => useSyncOrchestrator(props), {
500
+ initialProps: buildInput()
501
+ });
502
+ const secondHook = renderHook((props) => useSyncOrchestrator(props), {
503
+ initialProps: buildInput()
504
+ });
505
+ act(() => {
506
+ firstHook.result.current.applyWorkspaceSyncStateSnapshot({
507
+ enabled: true,
508
+ phase: 'active',
509
+ pullCursor: null
510
+ });
511
+ });
512
+ await waitFor(() => {
513
+ expect(runWorkspacePullSyncServiceMock.mock.calls.length).toBeGreaterThanOrEqual(1);
514
+ expect(firstHook.result.current.workspaceSyncBusy).toBe(true);
515
+ });
516
+ const callsWhileFirstWindowOwnsLease = runWorkspacePullSyncServiceMock.mock.calls.length;
517
+ act(() => {
518
+ secondHook.result.current.applyWorkspaceSyncStateSnapshot({
519
+ enabled: true,
520
+ phase: 'active',
521
+ pullCursor: null
522
+ });
523
+ });
524
+ await waitFor(() => {
525
+ expect(secondHook.result.current.workspaceLastErrorMessage).toMatch(/another local window/i);
526
+ });
527
+ expect(runWorkspacePullSyncServiceMock).toHaveBeenCalledTimes(callsWhileFirstWindowOwnsLease);
528
+ await act(async () => {
529
+ resolveFirstPull?.({
530
+ success: true,
531
+ syncedAt: '2026-03-15T20:00:00.000Z',
532
+ cursor: null,
533
+ pages: 1,
534
+ appliedChanges: 0,
535
+ pullRequestMs: 1,
536
+ applyMs: 0,
537
+ pulledDeleteTaskIds: new Set(),
538
+ pulledActiveUpserts: false,
539
+ pulledArchivedUpserts: false,
540
+ documentDecryptFailures: []
541
+ });
542
+ });
543
+ firstHook.unmount();
544
+ secondHook.unmount();
545
+ });
546
+ it('marks stalled bootstrap as error and keeps repair actionable', async () => {
547
+ vi.useFakeTimers();
548
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
549
+ initialProps: buildInput({
550
+ isAuthenticated: false,
551
+ checkAuthSession: vi.fn(async () => false)
552
+ })
232
553
  });
233
- input = buildInput({ currentWorkspaceId: 'workspace-b' });
234
- rerender(input);
235
554
  act(() => {
236
555
  result.current.applyWorkspaceSyncStateSnapshot({
237
- cloudSyncEnabled: true,
238
- sourceOfTruth: 'cloud',
239
- onboardingCompleted: true,
240
- pullCursor: ''
556
+ enabled: true,
557
+ phase: 'attach-cloud',
558
+ pullCursor: null
241
559
  });
242
560
  });
243
561
  await act(async () => {
244
- await result.current.pullWorkspaceChangesFromCloud();
562
+ await vi.advanceTimersByTimeAsync(130_000);
563
+ await Promise.resolve();
564
+ await Promise.resolve();
565
+ });
566
+ expect(result.current.workspaceSyncPhase).toBe('error');
567
+ expect(result.current.workspaceLastErrorMessage).toMatch(/stalled/i);
568
+ expect(result.current.workspaceSyncRecommendedAction).toMatch(/repair/i);
569
+ unmount();
570
+ });
571
+ it('does not mark bootstrap stalled while pull is slow but making progress', async () => {
572
+ vi.useFakeTimers();
573
+ runWorkspacePullSyncServiceMock.mockImplementation(async (input) => {
574
+ input.onPagePulled?.();
575
+ await new Promise((resolve) => {
576
+ setTimeout(resolve, 70_000);
577
+ });
578
+ input.onChangesApplied?.(200);
579
+ await new Promise((resolve) => {
580
+ setTimeout(resolve, 70_000);
581
+ });
582
+ return {
583
+ success: true,
584
+ syncedAt: '2026-03-15T20:30:00.000Z',
585
+ cursor: null,
586
+ pages: 2,
587
+ appliedChanges: 200,
588
+ pullRequestMs: 140_000,
589
+ applyMs: 100,
590
+ pulledDeleteTaskIds: new Set(),
591
+ pulledActiveUpserts: true,
592
+ pulledArchivedUpserts: false,
593
+ documentDecryptFailures: []
594
+ };
595
+ });
596
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
597
+ initialProps: buildInput()
598
+ });
599
+ act(() => {
600
+ result.current.applyWorkspaceSyncStateSnapshot({
601
+ enabled: true,
602
+ phase: 'attach-cloud',
603
+ pullCursor: null
604
+ });
605
+ });
606
+ await act(async () => {
607
+ await vi.advanceTimersByTimeAsync(130_000);
608
+ await Promise.resolve();
609
+ await Promise.resolve();
610
+ });
611
+ expect(result.current.workspaceSyncPhase).toBe('attach-cloud');
612
+ expect(result.current.workspaceLastErrorMessage).toBeNull();
613
+ await act(async () => {
614
+ await vi.advanceTimersByTimeAsync(20_000);
615
+ await Promise.resolve();
616
+ await Promise.resolve();
617
+ });
618
+ expect(result.current.workspaceSyncPhase).toBe('active');
619
+ expect(result.current.workspaceLastPullAt).toBe('2026-03-15T20:30:00.000Z');
620
+ unmount();
621
+ });
622
+ it('does not mark bootstrap stalled while the first pull page is still in flight without progress callbacks yet', async () => {
623
+ vi.useFakeTimers();
624
+ let resolvePull = null;
625
+ runWorkspacePullSyncServiceMock.mockImplementation(() => new Promise((resolve) => {
626
+ resolvePull = resolve;
627
+ }));
628
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
629
+ initialProps: buildInput()
630
+ });
631
+ act(() => {
632
+ result.current.applyWorkspaceSyncStateSnapshot({
633
+ enabled: true,
634
+ phase: 'attach-cloud',
635
+ pullCursor: null
636
+ });
637
+ });
638
+ await act(async () => {
639
+ await vi.advanceTimersByTimeAsync(130_000);
640
+ await Promise.resolve();
641
+ await Promise.resolve();
642
+ });
643
+ expect(result.current.workspaceSyncPhase).toBe('attach-cloud');
644
+ expect(result.current.workspaceLastErrorMessage).toBeNull();
645
+ await act(async () => {
646
+ resolvePull?.({
647
+ success: true,
648
+ syncedAt: '2026-03-15T20:45:00.000Z',
649
+ cursor: null,
650
+ pages: 1,
651
+ appliedChanges: 0,
652
+ pullRequestMs: 130_000,
653
+ applyMs: 0,
654
+ pulledDeleteTaskIds: new Set(),
655
+ pulledActiveUpserts: false,
656
+ pulledArchivedUpserts: false,
657
+ documentDecryptFailures: []
658
+ });
659
+ await Promise.resolve();
660
+ await Promise.resolve();
245
661
  });
246
- const syncPatchPosts = uiStatePosts.filter((entry) => entry?.stateKey === 'workspace-sync');
247
- const workspaceIds = syncPatchPosts.map((entry) => entry?.workspaceId).filter(Boolean);
248
- expect(workspaceIds).toContain('workspace-a');
249
- expect(workspaceIds).toContain('workspace-b');
662
+ expect(result.current.workspaceSyncPhase).toBe('active');
663
+ expect(result.current.workspaceLastPullAt).toBe('2026-03-15T20:45:00.000Z');
664
+ unmount();
250
665
  });
251
- it('surfaces document decryption warning and reports structured apply error event', async () => {
666
+ it('repair resets bootstrap state and retries attach-cloud deterministically', async () => {
252
667
  runWorkspacePullSyncServiceMock.mockResolvedValue({
253
668
  success: true,
254
- cursor: 'cursor-warning',
669
+ syncedAt: '2026-03-15T21:00:00.000Z',
670
+ cursor: null,
255
671
  pages: 1,
256
- appliedChanges: 1,
257
- pullRequestMs: 2,
258
- applyMs: 1,
259
- syncedAt: '2026-02-23T00:00:00.000Z',
672
+ appliedChanges: 0,
673
+ pullRequestMs: 1,
674
+ applyMs: 0,
260
675
  pulledDeleteTaskIds: new Set(),
261
676
  pulledActiveUpserts: false,
262
677
  pulledArchivedUpserts: false,
263
- documentDecryptFailures: ['docs/secret.md']
678
+ documentDecryptFailures: []
264
679
  });
265
- const syncEventBodies = [];
680
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
681
+ initialProps: buildInput()
682
+ });
683
+ act(() => {
684
+ result.current.applyWorkspaceSyncStateSnapshot({
685
+ enabled: true,
686
+ phase: 'attach-cloud',
687
+ pullCursor: 'stale-cursor'
688
+ });
689
+ result.current.applyWorkspaceSyncStateSnapshot({
690
+ enabled: true,
691
+ phase: 'error',
692
+ pullCursor: 'stale-cursor',
693
+ lastErrorMessage: 'Workspace sync initial cloud pull stalled. Press Repair to restart sync for this workspace.'
694
+ });
695
+ });
696
+ await act(async () => {
697
+ await result.current.resetWorkspaceSyncCursorAndPull();
698
+ });
699
+ expect(runWorkspacePullSyncServiceMock.mock.calls.length).toBeGreaterThanOrEqual(1);
700
+ expect(runWorkspacePushSyncServiceMock).not.toHaveBeenCalled();
701
+ expect(result.current.workspacePullCursorRef.current).toBeNull();
702
+ expect(result.current.workspaceSyncPhase).toBe('active');
703
+ expect(result.current.workspaceLastPullAt).toBe('2026-03-15T21:00:00.000Z');
704
+ unmount();
705
+ });
706
+ it('blocks same-window push and pull reentry while repair is active', async () => {
707
+ let resolveRepairPull = null;
708
+ runWorkspacePullSyncServiceMock.mockImplementationOnce(() => new Promise((resolve) => {
709
+ resolveRepairPull = resolve;
710
+ }));
711
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
712
+ initialProps: buildInput()
713
+ });
714
+ act(() => {
715
+ result.current.applyWorkspaceSyncStateSnapshot({
716
+ enabled: true,
717
+ phase: 'attach-cloud',
718
+ pullCursor: 'stale-cursor'
719
+ });
720
+ result.current.applyWorkspaceSyncStateSnapshot({
721
+ enabled: true,
722
+ phase: 'error',
723
+ pullCursor: 'stale-cursor',
724
+ lastErrorMessage: 'Workspace sync initial cloud pull stalled. Press Repair to restart sync for this workspace.'
725
+ });
726
+ });
727
+ let repairPromise = null;
728
+ await act(async () => {
729
+ repairPromise = result.current.resetWorkspaceSyncCursorAndPull();
730
+ await Promise.resolve();
731
+ await Promise.resolve();
732
+ });
733
+ expect(runWorkspacePullSyncServiceMock).toHaveBeenCalledTimes(1);
734
+ await act(async () => {
735
+ const pushed = await result.current.pushWorkspaceChangesToCloud('sig-during-repair');
736
+ const pulled = await result.current.pullWorkspaceChangesFromCloud();
737
+ expect(pushed).toBe(false);
738
+ expect(pulled).toBe(false);
739
+ });
740
+ expect(runWorkspacePushSyncServiceMock).not.toHaveBeenCalled();
741
+ expect(runWorkspacePullSyncServiceMock).toHaveBeenCalledTimes(1);
742
+ await act(async () => {
743
+ resolveRepairPull?.({
744
+ success: true,
745
+ syncedAt: '2026-03-15T21:05:00.000Z',
746
+ cursor: null,
747
+ pages: 1,
748
+ appliedChanges: 0,
749
+ pullRequestMs: 1,
750
+ applyMs: 0,
751
+ pulledDeleteTaskIds: new Set(),
752
+ pulledActiveUpserts: false,
753
+ pulledArchivedUpserts: false,
754
+ documentDecryptFailures: []
755
+ });
756
+ await repairPromise;
757
+ await Promise.resolve();
758
+ await Promise.resolve();
759
+ });
760
+ expect(result.current.workspaceSyncPhase).toBe('active');
761
+ expect(result.current.workspaceLastPullAt).toBe('2026-03-15T21:05:00.000Z');
762
+ unmount();
763
+ });
764
+ it('forces a full ai-profile push during manual retry even when the workspace signature is unchanged', async () => {
266
765
  vi.stubGlobal('fetch', vi.fn((url, init) => {
267
766
  if (url.includes('/api/taskforce/ui-state?key=workspace-sync')) {
268
767
  return Promise.resolve({
@@ -270,10 +769,13 @@ describe('useSyncOrchestrator retry closure', () => {
270
769
  json: () => Promise.resolve({
271
770
  success: true,
272
771
  state: {
273
- cloudSyncEnabled: true,
274
- sourceOfTruth: 'cloud',
275
- onboardingCompleted: true,
276
- pullCursor: ''
772
+ version: 2,
773
+ enabled: true,
774
+ phase: 'active',
775
+ pullCursor: null,
776
+ lastPullAt: null,
777
+ lastPushAt: null,
778
+ lastSyncedAt: null
277
779
  }
278
780
  })
279
781
  });
@@ -281,87 +783,111 @@ describe('useSyncOrchestrator retry closure', () => {
281
783
  if (url.includes('/api/taskforce/ui-state') && String(init?.method || '').toUpperCase() === 'POST') {
282
784
  return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
283
785
  }
786
+ if (url.includes('/api/taskforce/sync/workspace/ai-profiles')) {
787
+ return Promise.resolve({
788
+ ok: true,
789
+ json: () => Promise.resolve({
790
+ aiProfiles: [{
791
+ id: 'ai-profile-codex',
792
+ workspaceId: 'workspace-local-active',
793
+ profileToken: 'token-codex',
794
+ name: 'Codex',
795
+ username: 'codex',
796
+ icon: 'Bot',
797
+ color: '#0ea5e9',
798
+ createdAt: '2026-03-15T18:00:00.000Z',
799
+ updatedAt: '2026-03-15T18:00:00.000Z',
800
+ lastActiveAt: '2026-03-15T18:00:00.000Z'
801
+ }]
802
+ })
803
+ });
804
+ }
284
805
  if (url.includes('/api/taskforce/sync/workspace/documents')) {
285
806
  return Promise.resolve({ ok: true, json: () => Promise.resolve({ documents: [] }) });
286
807
  }
808
+ if (url.includes('/api/taskforce/sync/workspace/annotated-attachments')) {
809
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ sessions: [] }) });
810
+ }
811
+ if (url.includes('/api/taskforce/sync/workspace/assets')) {
812
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ assets: [] }) });
813
+ }
287
814
  if (url.includes('/api/taskforce/sync/events')) {
288
- syncEventBodies.push(JSON.parse(String(init?.body || '{}')));
289
815
  return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
290
816
  }
291
- return Promise.resolve({ ok: true, json: () => Promise.resolve({}) });
817
+ if (url.includes('/api/taskforce/tasks')) {
818
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ tasks: [] }) });
819
+ }
820
+ if (url.includes('/api/taskforce/archive')) {
821
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ archived: [] }) });
822
+ }
823
+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) });
292
824
  }));
293
- const { result } = renderHook((props) => useSyncOrchestrator(props), {
294
- initialProps: buildInput()
295
- });
296
- act(() => {
297
- result.current.applyWorkspaceSyncStateSnapshot({
298
- cloudSyncEnabled: true,
299
- sourceOfTruth: 'cloud',
300
- onboardingCompleted: true,
301
- pullCursor: ''
302
- });
303
- });
304
- await waitFor(() => {
305
- expect(result.current.workspaceCloudSyncEnabled).toBe(true);
306
- });
307
- await act(async () => {
308
- await result.current.pullWorkspaceChangesFromCloud();
309
- });
310
- await waitFor(() => {
311
- expect(result.current.workspaceLastWarningMessage).toBe('Some synced documents could not be decrypted (1).');
312
- });
313
- expect(syncEventBodies.some((entry) => entry.eventType === 'apply' && entry.status === 'error')).toBe(true);
314
- });
315
- it('forces a pull retry when pending push is blocked on hydration for too long', async () => {
316
- vi.useFakeTimers();
317
825
  runWorkspacePullSyncServiceMock.mockResolvedValue({
318
- success: false,
319
- kind: 'pull_http',
320
- status: 503,
321
- retryAfterMs: 60_000,
826
+ success: true,
827
+ syncedAt: '2026-03-15T22:00:00.000Z',
322
828
  cursor: null,
323
- pages: 0,
829
+ pages: 1,
324
830
  appliedChanges: 0,
325
831
  pullRequestMs: 1,
326
832
  applyMs: 0,
327
833
  pulledDeleteTaskIds: new Set(),
328
834
  pulledActiveUpserts: false,
329
- pulledArchivedUpserts: false
835
+ pulledArchivedUpserts: false,
836
+ documentDecryptFailures: []
330
837
  });
331
- try {
332
- const { result } = renderHook((props) => useSyncOrchestrator(props), {
333
- initialProps: buildInput()
334
- });
335
- act(() => {
336
- result.current.applyWorkspaceSyncStateSnapshot({
337
- cloudSyncEnabled: true,
338
- sourceOfTruth: 'cloud',
339
- onboardingCompleted: true,
340
- pullCursor: ''
341
- });
342
- });
343
- await act(async () => {
344
- await result.current.pullWorkspaceChangesFromCloud();
345
- });
346
- expect(runWorkspacePullSyncServiceMock.mock.calls.length).toBeGreaterThanOrEqual(1);
347
- expect(result.current.isWorkspacePullRetryPending()).toBe(true);
348
- await act(async () => {
349
- await result.current.pushWorkspaceChangesToCloud('sig-1');
350
- });
351
- expect(result.current.workspaceLastWarningMessage).toBe('Local changes queued — waiting for initial cloud pull before upload.');
352
- await act(async () => {
353
- await vi.advanceTimersByTimeAsync(46_000);
354
- });
355
- await act(async () => {
356
- await result.current.pushWorkspaceChangesToCloud('sig-2');
357
- });
358
- await act(async () => {
359
- await vi.advanceTimersByTimeAsync(250);
360
- });
361
- expect(runWorkspacePullSyncServiceMock.mock.calls.length).toBeGreaterThanOrEqual(2);
362
- }
363
- finally {
364
- vi.useRealTimers();
365
- }
838
+ runWorkspacePushSyncServiceMock.mockResolvedValue({
839
+ success: true,
840
+ syncedAt: '2026-03-15T22:00:01.000Z',
841
+ requestMs: 1,
842
+ changeCount: 1,
843
+ deleteCount: 0,
844
+ currentTaskIds: new Set(),
845
+ deleteTaskIds: new Set(),
846
+ currentAiProfileIds: new Set(['ai-profile-codex']),
847
+ currentAiProfileWatermarks: new Map([['ai-profile-codex', '2026-03-15T18:00:00.000Z']]),
848
+ currentDocumentPaths: new Set(),
849
+ deleteDocumentPaths: new Set(),
850
+ currentDocumentWatermarks: new Map(),
851
+ currentAssetPaths: new Set(),
852
+ deleteAssetPaths: new Set(),
853
+ currentAssetWatermarks: new Map(),
854
+ currentDocumentReviewSessionIds: new Set(),
855
+ deleteDocumentReviewSessionIds: new Set(),
856
+ currentDocumentReviewSessionWatermarks: new Map(),
857
+ currentAnnotatedAttachmentSessionIds: new Set(),
858
+ deleteAnnotatedAttachmentSessionIds: new Set(),
859
+ currentAnnotatedAttachmentSessionWatermarks: new Map(),
860
+ pushedWatermarks: new Map(),
861
+ emittedEventIds: []
862
+ });
863
+ const { result, unmount } = renderHook((props) => useSyncOrchestrator(props), {
864
+ initialProps: buildInput()
865
+ });
866
+ runWorkspacePushSyncServiceMock.mockClear();
867
+ await act(async () => {
868
+ await result.current.retryWorkspaceCloudSync();
869
+ });
870
+ await waitFor(() => {
871
+ expect(runWorkspacePushSyncServiceMock.mock.calls.length).toBeGreaterThanOrEqual(1);
872
+ });
873
+ const retryPayloads = runWorkspacePushSyncServiceMock.mock.calls
874
+ .map((call) => call?.[0]?.payload)
875
+ .filter(Boolean);
876
+ expect(retryPayloads).toEqual(expect.arrayContaining([
877
+ expect.objectContaining({
878
+ changes: expect.arrayContaining([
879
+ expect.objectContaining({
880
+ op: 'ai-profile-upsert',
881
+ profile: expect.objectContaining({
882
+ id: 'ai-profile-codex',
883
+ workspaceId: 'workspace-local-active',
884
+ name: 'Codex'
885
+ })
886
+ })
887
+ ])
888
+ })
889
+ ]));
890
+ expect(result.current.workspaceSyncPendingChanges).toBe(0);
891
+ unmount();
366
892
  });
367
893
  });