@taskforcehq/taskforce 0.3.329 → 0.3.332

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 (363) hide show
  1. package/README.md +7 -2
  2. package/dist/Taskforce.module.css +290 -45
  3. package/dist/components/features/AiProfilesModule.js +3 -5
  4. package/dist/components/features/TaskSettings.js +70 -14
  5. package/dist/components/features/TaskforceAgentsModule.d.ts +1 -2
  6. package/dist/components/features/TaskforceAgentsModule.js +586 -116
  7. package/dist/components/features/agentCapabilities/AgentCapabilitiesPrototype.d.ts +2 -2
  8. package/dist/components/features/agentCapabilities/AgentCapabilitiesPrototype.js +2 -2
  9. package/dist/components/features/agentConnections/AgentConnectionControl.d.ts +15 -0
  10. package/dist/components/features/agentConnections/AgentConnectionControl.js +125 -0
  11. package/dist/components/features/agentConnections/ModelConnectionsPanel.d.ts +18 -0
  12. package/dist/components/features/agentConnections/ModelConnectionsPanel.js +393 -0
  13. package/dist/components/features/agentConnections/modelConnectionsApi.d.ts +65 -0
  14. package/dist/components/features/agentConnections/modelConnectionsApi.js +129 -0
  15. package/dist/components/features/planning/PlanningModule.js +15 -3
  16. package/dist/components/features/planning/planningMetadata.d.ts +10 -0
  17. package/dist/components/features/planning/planningMetadata.js +8 -0
  18. package/dist/components/features/taskforceAgentAssignments/AgentBehaviorAssignments.js +15 -24
  19. package/dist/components/features/taskforceAgentEditorModel.d.ts +2 -1
  20. package/dist/components/features/taskforceAgentEditorModel.js +3 -1
  21. package/dist/components/features/workflowManager/workflowManagerApi.d.ts +1 -1
  22. package/dist/components/features/workflowManager/workflowManagerApi.js +3 -0
  23. package/dist/components/task/TaskWorkflowAssignmentField.js +68 -10
  24. package/dist/components/views/StandaloneLayout.js +62 -27
  25. package/dist/components/views/panels/PlanningDrawer.d.ts +2 -1
  26. package/dist/components/views/panels/PlanningDrawer.js +12 -8
  27. package/dist/components/views/standalone/modals/SyncStatusModal.d.ts +4 -3
  28. package/dist/components/views/standalone/modals/SyncStatusModal.js +33 -38
  29. package/dist/config/envSchema.js +55 -1
  30. package/dist/core/McpTokenService.d.ts +25 -1
  31. package/dist/core/McpTokenService.js +106 -15
  32. package/dist/core/TaskChecklistCommandService.d.ts +27 -0
  33. package/dist/core/TaskChecklistCommandService.js +83 -5
  34. package/dist/core/TaskLifecycleCommandService.d.ts +3 -1
  35. package/dist/core/TaskLifecycleCommandService.js +6 -2
  36. package/dist/core/Taskforce.d.ts +43 -3
  37. package/dist/core/Taskforce.js +158 -7
  38. package/dist/core/types.d.ts +9 -0
  39. package/dist/documentReviews/DocumentReviewCommentStore.d.ts +2 -0
  40. package/dist/documentReviews/DocumentReviewCommentStore.js +28 -9
  41. package/dist/documentReviews/commandService.d.ts +2 -1
  42. package/dist/documentReviews/commandService.js +6 -3
  43. package/dist/hooks/sync/orchestratorShared.d.ts +1 -0
  44. package/dist/hooks/sync/orchestratorShared.js +2 -0
  45. package/dist/hooks/sync/useLocalSyncCoordinatorSnapshot.d.ts +3 -0
  46. package/dist/hooks/sync/useLocalSyncCoordinatorSnapshot.js +85 -9
  47. package/dist/hooks/sync/useSyncStatusControls.d.ts +4 -1
  48. package/dist/hooks/sync/useSyncStatusControls.js +47 -11
  49. package/dist/hooks/useSyncOrchestrator.d.ts +3 -0
  50. package/dist/hooks/useSyncOrchestrator.js +111 -2
  51. package/dist/hooks/useTaskData.d.ts +31 -1
  52. package/dist/hooks/useTaskData.js +29 -7
  53. package/dist/hooks/useTaskMutations.d.ts +3 -1
  54. package/dist/hooks/useTaskMutations.js +46 -12
  55. package/dist/hooks/useTaskforce.d.ts +2 -0
  56. package/dist/hooks/useTaskforce.js +11 -2
  57. package/dist/mcp/clientRegistry.d.ts +2 -2
  58. package/dist/mcp/clientRegistry.js +1 -1
  59. package/dist/mcp/documentAssetRegistrar.js +9 -6
  60. package/dist/mcp/durableTaskMutationRouter.d.ts +4 -1
  61. package/dist/mcp/durableTaskMutationRouter.js +10 -0
  62. package/dist/mcp/durableTaskRelationshipMutationRouter.js +4 -0
  63. package/dist/mcp/httpProtocolRouting.d.ts +11 -0
  64. package/dist/mcp/httpProtocolRouting.js +22 -0
  65. package/dist/mcp/localCliHealth.d.ts +2 -2
  66. package/dist/mcp/localCliHealth.js +2 -2
  67. package/dist/mcp/localServiceProxy.d.ts +1 -0
  68. package/dist/mcp/localServiceProxy.js +530 -68
  69. package/dist/mcp/planningAttachmentCommandAdapter.d.ts +3 -1
  70. package/dist/mcp/planningAttachmentCommandAdapter.js +20 -2
  71. package/dist/mcp/runtime.d.ts +54 -79
  72. package/dist/mcp/runtime.js +408 -102
  73. package/dist/mcp/taskPlanningRegistrar.js +25 -6
  74. package/dist/mcp/toolProfiles.d.ts +2 -0
  75. package/dist/mcp/toolProfiles.js +11 -0
  76. package/dist/mcp/toolRegistry.d.ts +1 -0
  77. package/dist/mcp/toolRegistry.js +9 -8
  78. package/dist/mcp/workflowExecutionRegistrar.js +4 -4
  79. package/dist/migrations/taskSchemaMigrations.d.ts +5 -0
  80. package/dist/migrations/taskSchemaMigrations.js +415 -0
  81. package/dist/runtime/appGates.d.ts +2 -1
  82. package/dist/runtime/appGates.js +7 -0
  83. package/dist/server/buildInfo.d.ts +1 -0
  84. package/dist/server/buildInfo.js +5 -1
  85. package/dist/server/cloudMcpCapacityTelemetry.d.ts +68 -0
  86. package/dist/server/cloudMcpCapacityTelemetry.js +221 -0
  87. package/dist/server/index.d.ts +3 -0
  88. package/dist/server/index.js +108 -11
  89. package/dist/server/localDatabaseIdentity.js +4 -1
  90. package/dist/server/localServiceLease.js +2 -1
  91. package/dist/server/localServiceSessions.d.ts +14 -17
  92. package/dist/server/localServiceSessions.js +308 -94
  93. package/dist/server/localWorkspaceSyncServerRuntime.js +25 -19
  94. package/dist/server/routes/admin.d.ts +4 -0
  95. package/dist/server/routes/admin.js +126 -5
  96. package/dist/server/routes/agents.d.ts +7 -0
  97. package/dist/server/routes/agents.js +277 -24
  98. package/dist/server/routes/billing.js +5 -1
  99. package/dist/server/routes/durableTaskHttpRouters.d.ts +2 -0
  100. package/dist/server/routes/executorPhaseAApprovals.d.ts +19 -0
  101. package/dist/server/routes/executorPhaseAApprovals.js +140 -0
  102. package/dist/server/routes/executorPhaseAIssuerRedemptions.d.ts +11 -0
  103. package/dist/server/routes/executorPhaseAIssuerRedemptions.js +24 -0
  104. package/dist/server/routes/githubReviewEvidence.d.ts +19 -0
  105. package/dist/server/routes/githubReviewEvidence.js +116 -0
  106. package/dist/server/routes/localService.d.ts +15 -4
  107. package/dist/server/routes/localService.js +136 -40
  108. package/dist/server/routes/modelConnections.d.ts +24 -0
  109. package/dist/server/routes/modelConnections.js +205 -0
  110. package/dist/server/routes/shared.d.ts +22 -0
  111. package/dist/server/routes/shared.js +298 -182
  112. package/dist/server/routes/sync.js +1 -0
  113. package/dist/server/routes/syncAuxRoutes.js +5 -1
  114. package/dist/server/routes/syncPushRoutes.d.ts +1 -0
  115. package/dist/server/routes/syncPushRoutes.js +1 -0
  116. package/dist/server/routes/syncV3FeedRoutes.js +10 -1
  117. package/dist/server/routes/syncV3OperationRoutes.js +35 -9
  118. package/dist/server/routes/tasks.js +21 -2
  119. package/dist/server/routes/workflows.js +9 -1
  120. package/dist/server/routes.js +59 -0
  121. package/dist/service/localServiceCli.d.ts +2 -2
  122. package/dist/service/localServiceCli.js +4 -3
  123. package/dist/services/codexAppServerModelGateway.d.ts +54 -5
  124. package/dist/services/codexAppServerModelGateway.js +246 -21
  125. package/dist/services/codexDeviceCodeLoginManager.d.ts +39 -0
  126. package/dist/services/codexDeviceCodeLoginManager.js +265 -0
  127. package/dist/services/codexModelProviderConnectionLifecycle.d.ts +8 -0
  128. package/dist/services/codexModelProviderConnectionLifecycle.js +73 -0
  129. package/dist/services/executorPhaseAApprovalRuntime.d.ts +14 -0
  130. package/dist/services/executorPhaseAApprovalRuntime.js +24 -0
  131. package/dist/services/executorPhaseAApprovalService.d.ts +40 -0
  132. package/dist/services/executorPhaseAApprovalService.js +609 -0
  133. package/dist/services/executorPhaseADriftEvaluator.d.ts +78 -0
  134. package/dist/services/executorPhaseADriftEvaluator.js +93 -0
  135. package/dist/services/executorPhaseAIssuerCore.d.ts +139 -0
  136. package/dist/services/executorPhaseAIssuerCore.js +402 -0
  137. package/dist/services/executorPhaseAIssuerRedemptionService.d.ts +34 -0
  138. package/dist/services/executorPhaseAIssuerRedemptionService.js +158 -0
  139. package/dist/services/githubReviewEvidenceRuntime.d.ts +14 -0
  140. package/dist/services/githubReviewEvidenceRuntime.js +30 -0
  141. package/dist/services/githubReviewEvidenceService.d.ts +93 -0
  142. package/dist/services/githubReviewEvidenceService.js +336 -0
  143. package/dist/services/modelGateway.d.ts +7 -0
  144. package/dist/services/modelProviderConnectionService.d.ts +71 -0
  145. package/dist/services/modelProviderConnectionService.js +279 -0
  146. package/dist/services/modelProviderCredentialHome.d.ts +32 -0
  147. package/dist/services/modelProviderCredentialHome.js +271 -0
  148. package/dist/services/ownerScopedModelConnectionGateway.d.ts +12 -0
  149. package/dist/services/ownerScopedModelConnectionGateway.js +30 -0
  150. package/dist/services/taskforceAgentConnectionBindingService.d.ts +66 -0
  151. package/dist/services/taskforceAgentConnectionBindingService.js +185 -0
  152. package/dist/services/taskforceAgentMcpBridge.d.ts +2 -2
  153. package/dist/services/taskforceAgentMcpBridge.js +42 -29
  154. package/dist/shared/adminEdgeProxy.d.ts +5 -0
  155. package/dist/shared/adminEdgeProxy.js +94 -0
  156. package/dist/shared/adminProxySessionCookies.d.ts +16 -0
  157. package/dist/shared/adminProxySessionCookies.js +86 -0
  158. package/dist/shared/aiProfileColors.d.ts +31 -1
  159. package/dist/shared/aiProfileColors.js +14 -6
  160. package/dist/shared/executorPhaseAApprovalGoldenVector.json +269 -0
  161. package/dist/shared/executorPhaseAApprovalReceipt.d.ts +112 -0
  162. package/dist/shared/executorPhaseAApprovalReceipt.js +58 -0
  163. package/dist/shared/executorPhaseAApprovalTrustPolicy.json +10 -0
  164. package/dist/shared/executorPhaseADriftContracts.d.ts +37 -0
  165. package/dist/shared/executorPhaseADriftContracts.js +63 -0
  166. package/dist/shared/executorPhaseAIssuerContracts.d.ts +75 -0
  167. package/dist/shared/executorPhaseAIssuerContracts.js +90 -0
  168. package/dist/shared/executorPhaseARunAuthorization.d.ts +120 -0
  169. package/dist/shared/executorPhaseARunAuthorization.js +232 -0
  170. package/dist/shared/executorPhaseASchemaValidation.d.ts +7 -0
  171. package/dist/shared/executorPhaseASchemaValidation.js +53 -0
  172. package/dist/shared/executorPhaseASchemas/approval-receipt.schema.json +106 -0
  173. package/dist/shared/executorPhaseASchemas/drift-attestation.schema.json +54 -0
  174. package/dist/shared/executorPhaseASchemas/drift-request.schema.json +47 -0
  175. package/dist/shared/executorPhaseASchemas/foundation-manifest.schema.json +29 -0
  176. package/dist/shared/executorPhaseASchemas/issuer-audit-record.schema.json +24 -0
  177. package/dist/shared/executorPhaseASchemas/issuer-proof.schema.json +43 -0
  178. package/dist/shared/executorPhaseASchemas/issuer-redemption-request.schema.json +18 -0
  179. package/dist/shared/executorPhaseASchemas/issuer-redemption-response.schema.json +39 -0
  180. package/dist/shared/executorPhaseASchemas/logical-envelope.schema.json +149 -0
  181. package/dist/shared/executorPhaseASchemas/preflight-report.schema.json +216 -0
  182. package/dist/shared/executorPhaseASchemas/run-capability.schema.json +111 -0
  183. package/dist/shared/executorPhaseASchemas/sender-proof.schema.json +37 -0
  184. package/dist/shared/executorPhaseASchemas/workload-grant.schema.json +68 -0
  185. package/dist/shared/executorPhaseASchemas/workload-jwt-claims.schema.json +67 -0
  186. package/dist/shared/executorPhaseATiming.d.ts +1 -0
  187. package/dist/shared/executorPhaseATiming.js +1 -0
  188. package/dist/shared/planningIdentity.js +1 -1
  189. package/dist/shared/productLogoKeys.d.ts +2 -0
  190. package/dist/shared/productLogoKeys.js +18 -0
  191. package/dist/shared/taskforceAgentDefinition.d.ts +0 -1
  192. package/dist/shared/taskforceAgentDefinition.js +6 -9
  193. package/dist/shared/taskforceAgentModels.js +7 -3
  194. package/dist/shared/userFeatureGrants.d.ts +4 -0
  195. package/dist/shared/userFeatureGrants.js +7 -0
  196. package/dist/storage/executorPhaseAApprovalReceiptStore.d.ts +37 -0
  197. package/dist/storage/executorPhaseAApprovalReceiptStore.js +81 -0
  198. package/dist/storage/executorPhaseARunAuthorizationStore.d.ts +103 -0
  199. package/dist/storage/executorPhaseARunAuthorizationStore.js +492 -0
  200. package/dist/storage/githubReviewEvidenceInstallationStore.d.ts +26 -0
  201. package/dist/storage/githubReviewEvidenceInstallationStore.js +89 -0
  202. package/dist/storage/modelProviderConnectionStore.d.ts +99 -0
  203. package/dist/storage/modelProviderConnectionStore.js +446 -0
  204. package/dist/storage/postgresAdapter.d.ts +4 -0
  205. package/dist/storage/postgresAdapter.js +14 -1
  206. package/dist/storage/postgresRequestDiagnostics.d.ts +9 -1
  207. package/dist/storage/postgresRequestDiagnostics.js +15 -2
  208. package/dist/storage/postgresWorker.js +20 -2
  209. package/dist/storage/postgresWorkerProtocol.d.ts +7 -0
  210. package/dist/storage/taskforceAgentConnectionBindingStore.d.ts +31 -0
  211. package/dist/storage/taskforceAgentConnectionBindingStore.js +84 -0
  212. package/dist/storage/workflowStore.d.ts +2 -0
  213. package/dist/storage/workflowStore.js +39 -2
  214. package/dist/sync/cloudSyncApi.js +4 -2
  215. package/dist/sync/collaborationSyncState.js +5 -0
  216. package/dist/sync/coordinator/localSyncExecutionPermitStore.js +60 -29
  217. package/dist/sync/coordinator/localWorkspaceSyncPendingV2PushProgress.d.ts +10 -0
  218. package/dist/sync/coordinator/localWorkspaceSyncPendingV2PushProgress.js +29 -0
  219. package/dist/sync/coordinator/localWorkspaceSyncRunner.d.ts +3 -1
  220. package/dist/sync/coordinator/localWorkspaceSyncRunner.js +18 -0
  221. package/dist/sync/coordinator/localWorkspaceSyncRunnerState.d.ts +15 -1
  222. package/dist/sync/coordinator/localWorkspaceSyncRunnerState.js +99 -2
  223. package/dist/sync/coordinator/workspaceSyncCredentialBroker.d.ts +1 -0
  224. package/dist/sync/coordinator/workspaceSyncCredentialBroker.js +33 -4
  225. package/dist/sync/engine/workspaceSyncContentLifecycleAdapter.d.ts +2 -1
  226. package/dist/sync/engine/workspaceSyncContentVersionStore.d.ts +38 -0
  227. package/dist/sync/engine/workspaceSyncContentVersionStore.js +50 -1
  228. package/dist/sync/engine/workspaceSyncEngineLifecyclePolicy.js +6 -6
  229. package/dist/sync/engine/workspaceSyncEnginePushCompletion.d.ts +14 -0
  230. package/dist/sync/engine/workspaceSyncEnginePushCompletion.js +84 -0
  231. package/dist/sync/engine/workspaceSyncEngineRecovery.js +1 -0
  232. package/dist/sync/engine/workspaceSyncEngineRuntime.d.ts +1 -0
  233. package/dist/sync/engine/workspaceSyncEngineRuntime.js +1 -0
  234. package/dist/sync/engine/workspaceSyncEngineServerRunnerOperations.js +112 -38
  235. package/dist/sync/engine/workspaceSyncEngineServerSnapshotReader.js +6 -0
  236. package/dist/sync/engine/workspaceSyncEngineTransfers.js +3 -1
  237. package/dist/sync/engine/workspaceSyncV2ChangeDispatcher.d.ts +1 -0
  238. package/dist/sync/engine/workspaceSyncV2ChangeDispatcher.js +31 -0
  239. package/dist/sync/syncApplyHandlers.d.ts +3 -0
  240. package/dist/sync/syncApplyHandlers.js +81 -15
  241. package/dist/sync/syncService.d.ts +15 -0
  242. package/dist/sync/syncService.js +83 -18
  243. package/dist/sync/taskforceAgentSyncAuthorization.d.ts +16 -0
  244. package/dist/sync/taskforceAgentSyncAuthorization.js +20 -0
  245. package/dist/sync/v3/combinedFeedCapability.js +4 -0
  246. package/dist/sync/v3/durableInitiativeMutationRouter.js +18 -10
  247. package/dist/sync/v3/durableOperationReplay.d.ts +14 -0
  248. package/dist/sync/v3/durableOperationReplay.js +18 -0
  249. package/dist/sync/v3/durableTaskAttachmentLinksMutationRouter.js +3 -0
  250. package/dist/sync/v3/durableTaskChecklistMutationRouter.d.ts +2 -1
  251. package/dist/sync/v3/durableTaskChecklistMutationRouter.js +58 -15
  252. package/dist/sync/v3/durableTaskCommentMutationRouter.js +3 -0
  253. package/dist/sync/v3/durableTaskHttpRootMutationRouter.d.ts +1 -1
  254. package/dist/sync/v3/durableTaskHttpRootMutationRouter.js +10 -0
  255. package/dist/sync/v3/durableTaxonomyMutationRouter.js +5 -0
  256. package/dist/sync/v3/durableWorkflowRuntimeMutationRouter.d.ts +18 -7
  257. package/dist/sync/v3/durableWorkflowRuntimeMutationRouter.js +89 -23
  258. package/dist/sync/v3/durableWorkstreamMutationRouter.js +18 -10
  259. package/dist/sync/v3/durableWorkstreamTaskOrderMutationRouter.js +16 -5
  260. package/dist/sync/v3/localOutboxDispatchRuntime.js +2 -2
  261. package/dist/sync/v3/localOutboxRecoveryPreparationService.js +8 -2
  262. package/dist/sync/v3/localTaskChecklistOutboxHandler.js +16 -2
  263. package/dist/sync/v3/localTaskChecklistOutboxService.d.ts +4 -0
  264. package/dist/sync/v3/localTaskChecklistOutboxService.js +14 -1
  265. package/dist/sync/v3/localTaskCreateOutboxService.d.ts +3 -1
  266. package/dist/sync/v3/localTaskCreateOutboxService.js +6 -1
  267. package/dist/sync/v3/localTaskDeleteOutboxService.js +1 -0
  268. package/dist/sync/v3/localTaskLifecycleOutboxService.d.ts +2 -1
  269. package/dist/sync/v3/localTaskLifecycleOutboxService.js +5 -1
  270. package/dist/sync/v3/localTaskMetadataOutboxService.d.ts +2 -1
  271. package/dist/sync/v3/localTaskMetadataOutboxService.js +6 -2
  272. package/dist/sync/v3/localTaskStatusOutboxService.d.ts +10 -1
  273. package/dist/sync/v3/localTaskStatusOutboxService.js +238 -16
  274. package/dist/sync/v3/syncDurabilityStore.d.ts +36 -1
  275. package/dist/sync/v3/syncDurabilityStore.js +202 -8
  276. package/dist/sync/v3/taskChecklistMutationService.d.ts +11 -0
  277. package/dist/sync/v3/taskChecklistMutationService.js +44 -1
  278. package/dist/sync/v3/taskStatusMutationService.d.ts +29 -1
  279. package/dist/sync/v3/taskStatusMutationService.js +119 -3
  280. package/dist/sync/v3/workflowAssignmentSync.d.ts +5 -0
  281. package/dist/sync/v3/workflowAssignmentSync.js +27 -0
  282. package/dist/sync/v3/workflowRuntimeMutationService.d.ts +5 -0
  283. package/dist/sync/v3/workflowRuntimeMutationService.js +124 -71
  284. package/dist/sync/v3/workspaceSyncJournalReader.js +1 -1
  285. package/dist/sync/v3/workspaceSyncOperationRetentionService.d.ts +16 -0
  286. package/dist/sync/v3/workspaceSyncOperationRetentionService.js +83 -0
  287. package/dist/sync/v3/workspaceSyncV3CloudOperationHandler.d.ts +1 -0
  288. package/dist/sync/v3/workspaceSyncV3CloudOperationHandler.js +9 -2
  289. package/dist/sync/v3/workspaceSyncV3CombinedLocalApply.js +25 -3
  290. package/dist/sync/v3/workspaceSyncV3CombinedRepairBaseline.d.ts +7 -0
  291. package/dist/sync/v3/workspaceSyncV3CombinedRepairBaseline.js +44 -32
  292. package/dist/sync/v3/workspaceSyncV3CombinedRepairMaterialization.d.ts +9 -5
  293. package/dist/sync/v3/workspaceSyncV3CombinedRepairMaterialization.js +54 -38
  294. package/dist/sync/v3/workspaceSyncV3CombinedRepairSnapshot.d.ts +10 -0
  295. package/dist/sync/v3/workspaceSyncV3CombinedRepairSnapshot.js +70 -31
  296. package/dist/sync/v3/workspaceSyncV3CombinedWireContract.d.ts +2 -1
  297. package/dist/sync/v3/workspaceSyncV3CombinedWireContract.js +16 -0
  298. package/dist/sync/v3/workspaceSyncV3CoverageRegistry.js +6 -0
  299. package/dist/sync/v3/workspaceSyncV3Feed.d.ts +1 -0
  300. package/dist/sync/v3/workspaceSyncV3Feed.js +6 -1
  301. package/dist/sync/v3/workspaceSyncV3NestedTaskProjection.d.ts +2 -0
  302. package/dist/sync/v3/workspaceSyncV3NestedTaskProjection.js +49 -18
  303. package/dist/sync/v3/workspaceSyncV3OperationProtocol.d.ts +3 -0
  304. package/dist/sync/v3/workspaceSyncV3OperatorDiagnostics.d.ts +5 -0
  305. package/dist/sync/v3/workspaceSyncV3OperatorDiagnostics.js +36 -2
  306. package/dist/sync/v3/workspaceSyncV3RepairSnapshotRetentionService.d.ts +17 -0
  307. package/dist/sync/v3/workspaceSyncV3RepairSnapshotRetentionService.js +64 -0
  308. package/dist/sync/v3/workspaceSyncV3WorkflowRuntimeApply.d.ts +1 -0
  309. package/dist/sync/v3/workspaceSyncV3WorkflowRuntimeApply.js +50 -5
  310. package/dist/sync/v3/workspaceSyncV3WorkflowTaskCoverCoverage.d.ts +7 -0
  311. package/dist/sync/v3/workspaceSyncV3WorkflowTaskCoverCoverage.js +33 -0
  312. package/dist/sync/v3/workspaceSyncV3WorkflowTaskCoverWireContract.d.ts +7 -0
  313. package/dist/sync/v3/workspaceSyncV3WorkflowTaskCoverWireContract.js +8 -0
  314. package/dist/sync/workspaceRepair.d.ts +5 -2
  315. package/dist/sync/workspaceRepair.js +161 -6
  316. package/dist/sync/workspaceSyncModel.d.ts +21 -0
  317. package/dist/sync/workspaceSyncModel.js +35 -7
  318. package/dist/sync/workspaceSyncState.d.ts +1 -0
  319. package/dist/sync/workspaceSyncV2SnapshotBuilder.d.ts +6 -0
  320. package/dist/sync/workspaceSyncV2SnapshotBuilder.js +5 -0
  321. package/dist/ui/assets/AiIdentityRosterCard-CDMPtnbC.js +1 -0
  322. package/dist/ui/assets/AiProfilesModule-Cww85C4E.js +1 -0
  323. package/dist/ui/assets/{AnnotatedAttachmentWorkspace-B68Wg-RV.js → AnnotatedAttachmentWorkspace-Dt9TKYSH.js} +1 -1
  324. package/dist/ui/assets/{AssetTraySortControl-C8Rztyal.js → AssetTraySortControl-CKgapnxu.js} +1 -1
  325. package/dist/ui/assets/{ContextAttachmentManager-Cj3c7X9y.js → ContextAttachmentManager-T-cEVcOZ.js} +2 -2
  326. package/dist/ui/assets/{DocumentWorkspace-B5uvzems.js → DocumentWorkspace-HD4MUjAZ.js} +1 -1
  327. package/dist/ui/assets/{EntityActivityTimeline-BVFvCB5R.js → EntityActivityTimeline-_V0zfMuh.js} +1 -1
  328. package/dist/ui/assets/PlanningModule-mTkBygsB.js +1 -0
  329. package/dist/ui/assets/{PlansPage-AY4cGWco.js → PlansPage-Btiq06VO.js} +1 -1
  330. package/dist/ui/assets/{TaskContextUpload-DZxTVesW.js → TaskContextUpload-C00NVUpn.js} +1 -1
  331. package/dist/ui/assets/TaskSettings-Cp-L-4xh.js +12 -0
  332. package/dist/ui/assets/TaskforceAgentsModule-Coq9-PUp.js +24 -0
  333. package/dist/ui/assets/TaskforceAgentsModule-b-8R25cJ.css +1 -0
  334. package/dist/ui/assets/{WorkflowManagerModule-DEr5di_r.js → WorkflowManagerModule-CuqRzMmM.js} +1 -1
  335. package/dist/ui/assets/index-BZ-hdZSk.css +1 -0
  336. package/dist/ui/assets/index-DSQINwt9.js +7 -0
  337. package/dist/ui/assets/{vendor-icons-D9Lpw-j4.js → vendor-icons-Bsq-mcEn.js} +1 -1
  338. package/dist/ui/branding/logos/letterhead_dark.png +0 -0
  339. package/dist/ui/branding/logos/letterhead_light.png +0 -0
  340. package/dist/ui/branding/logos/signature_dark.png +0 -0
  341. package/dist/ui/branding/logos/signature_light.png +0 -0
  342. package/dist/ui/index.html +3 -3
  343. package/dist/utils/aiProfileDefaultLogo.js +16 -48
  344. package/dist/utils/httpSetCookie.d.ts +1 -0
  345. package/dist/utils/httpSetCookie.js +4 -1
  346. package/dist/utils/localRuntimeUrl.d.ts +1 -0
  347. package/dist/utils/localRuntimeUrl.js +14 -0
  348. package/dist/utils/productLogoRegistry.d.ts +2 -0
  349. package/dist/utils/productLogoRegistry.js +36 -0
  350. package/dist/utils/syncStatusPresentation.d.ts +4 -0
  351. package/dist/utils/syncStatusPresentation.js +17 -0
  352. package/dist/utils/taskEvents.d.ts +2 -0
  353. package/dist/utils/workspaceSyncPresentation.d.ts +1 -1
  354. package/dist/utils/workspaceSyncPresentation.js +23 -17
  355. package/package.json +24 -4
  356. package/dist/ui/assets/AiIdentityRosterCard-BZM4aQnM.js +0 -1
  357. package/dist/ui/assets/AiProfilesModule-BbAEWtHH.js +0 -1
  358. package/dist/ui/assets/PlanningModule-B5DWQOGz.js +0 -1
  359. package/dist/ui/assets/TaskSettings-BeWAuyZj.js +0 -12
  360. package/dist/ui/assets/TaskforceAgentsModule-BifCYtjR.js +0 -21
  361. package/dist/ui/assets/TaskforceAgentsModule-D6IC0S7Q.css +0 -1
  362. package/dist/ui/assets/index-I5zhdtgt.js +0 -7
  363. package/dist/ui/assets/index-VRFsx3wz.css +0 -1
@@ -15,6 +15,7 @@
15
15
  import type { DatabaseProvider } from '../storage/databaseAdapter.js';
16
16
  export type { TaskforceTheme } from '../utils/theme.js';
17
17
  import type { TaskforceTheme } from '../utils/theme.js';
18
+ import type { InternalUserFeatureKey } from '../shared/userFeatureGrants.js';
18
19
  export interface Comment {
19
20
  id: string;
20
21
  author: string;
@@ -344,6 +345,7 @@ export type SystemRole = 'system_admin' | 'user';
344
345
  export type PermissionMode = 'read-only' | 'read-write';
345
346
  export type AuthTokenPurpose = 'email_verification' | 'password_reset' | 'invite_accept';
346
347
  export type McpAccessTokenScope = 'tasks:read' | 'tasks:write' | 'workspace:read';
348
+ export type McpCloudToolProfile = 'default' | 'extended';
347
349
  export type UserAuthProvider = 'password' | 'google' | 'github' | 'apple';
348
350
  export interface UserAuthIdentity {
349
351
  id: string;
@@ -417,6 +419,7 @@ export interface SystemUserRecord {
417
419
  systemRole: SystemRole;
418
420
  betaAccess: boolean;
419
421
  disabled: boolean;
422
+ internalFeatureGrants: InternalUserFeatureKey[];
420
423
  planId?: string | null;
421
424
  planName?: string | null;
422
425
  planVersionId?: string | null;
@@ -613,6 +616,7 @@ export interface McpAccessTokenRecord {
613
616
  userEmail?: string | null;
614
617
  name: string;
615
618
  scopes: McpAccessTokenScope[];
619
+ toolProfile: McpCloudToolProfile;
616
620
  tokenPrefix: string;
617
621
  status: McpAccessTokenStatus;
618
622
  lastUsedAt?: string | null;
@@ -640,6 +644,7 @@ export interface McpAccessTokenAuthResult {
640
644
  workspaceId: string;
641
645
  userId: string;
642
646
  scopes: McpAccessTokenScope[];
647
+ toolProfile?: McpCloudToolProfile;
643
648
  status: McpAccessTokenStatus;
644
649
  }
645
650
  export interface McpAccessTokenInspectionResult {
@@ -649,12 +654,14 @@ export interface McpAccessTokenInspectionResult {
649
654
  userId: string;
650
655
  name: string;
651
656
  scopes: McpAccessTokenScope[];
657
+ toolProfile: McpCloudToolProfile;
652
658
  status: McpAccessTokenStatus;
653
659
  }
654
660
  export interface McpOAuthClientRecord {
655
661
  id: string;
656
662
  provider: McpOAuthProvider;
657
663
  clientName: string;
664
+ applicationType: 'native' | 'web';
658
665
  productClientId?: string | null;
659
666
  redirectUris: string[];
660
667
  status: McpOAuthClientStatus;
@@ -670,6 +677,7 @@ export interface McpOAuthConnectorGrantRecord {
670
677
  workspaceId: string;
671
678
  userId: string;
672
679
  scopes: McpAccessTokenScope[];
680
+ toolProfile: McpCloudToolProfile;
673
681
  tokenPrefix: string;
674
682
  status: McpOAuthGrantStatus;
675
683
  lastUsedAt?: string | null;
@@ -692,6 +700,7 @@ export interface McpOAuthAccessTokenAuthResult {
692
700
  provider: McpOAuthProvider;
693
701
  productClientId?: string | null;
694
702
  scopes: McpAccessTokenScope[];
703
+ toolProfile?: McpCloudToolProfile;
695
704
  status: McpOAuthGrantStatus;
696
705
  aiProfileId?: string | null;
697
706
  aiProfileToken?: string | null;
@@ -77,6 +77,8 @@ export declare class DocumentReviewCommentStore {
77
77
  threadStatusUpdatedAt?: string | null;
78
78
  resolvedAt?: string | null;
79
79
  resolvedByActorId?: string | null;
80
+ }, options?: {
81
+ allowAuthoritativeThreadReconciliation?: boolean;
80
82
  }): DocumentReviewCommentSyncRecord;
81
83
  softDelete(commentIdRaw: string, workspaceIdRaw: string, deletedAtRaw?: string, deletedByActorIdRaw?: string | null): boolean;
82
84
  replaceForSession(input: {
@@ -235,7 +235,7 @@ export class DocumentReviewCommentStore {
235
235
  : (input.threadStatus === undefined ? existing.threadStatus : input.threadStatus), input.threadStatusUpdatedAt === undefined ? existing.threadStatusUpdatedAt : normalizeNullable(input.threadStatusUpdatedAt), input.resolvedAt === undefined ? existing.resolvedAt : normalizeNullable(input.resolvedAt), input.resolvedByActorId === undefined ? existing.resolvedByActorId : normalizeNullable(input.resolvedByActorId), normalizeId(input.updatedAt) || new Date().toISOString(), input.deletedAt === undefined ? existing.deletedAt : normalizeNullable(input.deletedAt), this.tenantId, normalizeWorkspaceId(input.workspaceId), normalizeId(input.id));
236
236
  return this.get(input.id, input.workspaceId, { includeDeleted: true });
237
237
  }
238
- upsertForSync(input) {
238
+ upsertForSync(input, options) {
239
239
  const existing = this.get(input.id, input.workspaceId, { includeDeleted: true });
240
240
  if (!existing) {
241
241
  return this.create(input);
@@ -248,7 +248,20 @@ export class DocumentReviewCommentStore {
248
248
  ? undefined
249
249
  : normalizeNullable(input.parentCommentId);
250
250
  if (incomingParentCommentId !== undefined && incomingParentCommentId !== existing.parentCommentId) {
251
- throw new Error(`Document review comment ${existing.id} cannot move between threads.`);
251
+ if (options?.allowAuthoritativeThreadReconciliation !== true) {
252
+ throw new Error(`Document review comment ${existing.id} cannot move between threads.`);
253
+ }
254
+ const incomingParent = incomingParentCommentId
255
+ ? this.get(incomingParentCommentId, input.workspaceId, { includeDeleted: true })
256
+ : null;
257
+ if (existing.parentCommentId
258
+ || !incomingParent
259
+ || incomingParent.deletedAt
260
+ || incomingParent.sessionId !== existing.sessionId
261
+ || incomingParent.parentCommentId
262
+ || incomingParent.id === existing.id) {
263
+ throw new Error(`Document review comment ${existing.id} cannot reconcile to an invalid thread root.`);
264
+ }
252
265
  }
253
266
  const incomingThreadStatusUpdatedAt = input.threadStatusUpdatedAt === undefined
254
267
  ? undefined
@@ -283,13 +296,19 @@ export class DocumentReviewCommentStore {
283
296
  AND id = ?
284
297
  `).run(normalizeId(input.sessionId) || existing.sessionId, normalizeId(input.body), input.anchor ? JSON.stringify(input.anchor) : null, normalizeNullable(input.authorActorId), normalizeNullable(input.updatedByActorId), input.deletedByActorId === undefined ? existing.deletedByActorId : normalizeNullable(input.deletedByActorId), nextParentCommentId, nextParentCommentId
285
298
  ? null
286
- : (shouldApplyThreadLifecycle ? input.threadStatus : existing.threadStatus), shouldApplyThreadLifecycle
287
- ? incomingThreadStatusUpdatedAt
288
- : existing.threadStatusUpdatedAt, shouldApplyThreadLifecycle
289
- ? normalizeNullable(input.resolvedAt)
290
- : existing.resolvedAt, shouldApplyThreadLifecycle
291
- ? normalizeNullable(input.resolvedByActorId)
292
- : existing.resolvedByActorId, normalizePositiveInteger(input.order) ?? existing.order, normalizeId(input.createdAt) || existing.createdAt, normalizeId(input.updatedAt) || existing.updatedAt, existing.deletedAt || (input.deletedAt === undefined
299
+ : (shouldApplyThreadLifecycle ? input.threadStatus : existing.threadStatus), nextParentCommentId
300
+ ? null
301
+ : shouldApplyThreadLifecycle
302
+ ? incomingThreadStatusUpdatedAt
303
+ : existing.threadStatusUpdatedAt, nextParentCommentId
304
+ ? null
305
+ : shouldApplyThreadLifecycle
306
+ ? normalizeNullable(input.resolvedAt)
307
+ : existing.resolvedAt, nextParentCommentId
308
+ ? null
309
+ : shouldApplyThreadLifecycle
310
+ ? normalizeNullable(input.resolvedByActorId)
311
+ : existing.resolvedByActorId, normalizePositiveInteger(input.order) ?? existing.order, normalizeId(input.createdAt) || existing.createdAt, normalizeId(input.updatedAt) || existing.updatedAt, existing.deletedAt || (input.deletedAt === undefined
293
312
  ? null
294
313
  : normalizeNullable(input.deletedAt)), this.tenantId, normalizeWorkspaceId(input.workspaceId), normalizeId(input.id));
295
314
  return this.get(input.id, input.workspaceId, { includeDeleted: true });
@@ -6,6 +6,7 @@ export interface ReviewDocumentCommandComment {
6
6
  export interface ReviewDocumentCommandInput {
7
7
  workspaceId: string;
8
8
  assetId: string;
9
+ documentVersion: number | null;
9
10
  documentLabel?: string | null;
10
11
  sessionId?: string | null;
11
12
  title?: string | null;
@@ -43,7 +44,7 @@ export declare class DocumentReviewCommandError extends Error {
43
44
  }
44
45
  export interface ReviewDocumentCommandResult {
45
46
  session: DocumentReviewSession;
46
- sessionAction: 'reused' | 'created';
47
+ sessionAction: 'reused' | 'created' | 'created-for-current-version';
47
48
  postedCommentIds: string[];
48
49
  }
49
50
  export declare function createDocumentReviewCommandService(deps: DocumentReviewCommandServiceDependencies): {
@@ -29,8 +29,9 @@ export function createDocumentReviewCommandService(deps) {
29
29
  workspaceId: input.workspaceId,
30
30
  assetId: input.assetId,
31
31
  }).filter((candidate) => candidate.status === 'open');
32
- if (openSessions.length === 1) {
33
- session = openSessions[0];
32
+ const currentVersionSessions = openSessions.filter((candidate) => candidate.documentVersion === input.documentVersion);
33
+ if (currentVersionSessions.length === 1) {
34
+ session = currentVersionSessions[0];
34
35
  }
35
36
  else {
36
37
  session = deps.createSession({
@@ -40,7 +41,9 @@ export function createDocumentReviewCommandService(deps) {
40
41
  status: 'open',
41
42
  actorId: input.actorId,
42
43
  });
43
- sessionAction = 'created';
44
+ sessionAction = currentVersionSessions.length === 0 && openSessions.length > 0
45
+ ? 'created-for-current-version'
46
+ : 'created';
44
47
  }
45
48
  }
46
49
  const postedCommentIds = [];
@@ -28,6 +28,7 @@ export interface PersistedSyncWatermarks {
28
28
  taskRelationshipChangeKeys?: Map<string, string>;
29
29
  initiativeWatermarks: Map<string, string>;
30
30
  workstreamWatermarks: Map<string, string>;
31
+ planningIdentityWatermarks?: Map<string, string>;
31
32
  aiProfileWatermarks: Map<string, string>;
32
33
  aiProfileChangeKeys?: Map<string, string>;
33
34
  taskforceAgentWatermarks?: Map<string, string>;
@@ -180,6 +180,7 @@ export function buildPersistedSyncWatermarksSnapshot(data) {
180
180
  taskRelationshipChangeKeys: Array.from((data.taskRelationshipChangeKeys || new Map()).entries()),
181
181
  initiativeWatermarks: Array.from(data.initiativeWatermarks.entries()),
182
182
  workstreamWatermarks: Array.from(data.workstreamWatermarks.entries()),
183
+ planningIdentityWatermarks: Array.from((data.planningIdentityWatermarks || new Map()).entries()),
183
184
  aiProfileWatermarks: Array.from(data.aiProfileWatermarks.entries()),
184
185
  aiProfileChangeKeys: Array.from((data.aiProfileChangeKeys || new Map()).entries()),
185
186
  taskforceAgentWatermarks: Array.from((data.taskforceAgentWatermarks || new Map()).entries()),
@@ -214,6 +215,7 @@ export function parsePersistedSyncWatermarksSnapshot(snapshot, taxonomyStateFing
214
215
  taskRelationshipChangeKeys: new Map(Array.isArray(snapshot.taskRelationshipChangeKeys) ? snapshot.taskRelationshipChangeKeys : []),
215
216
  initiativeWatermarks: new Map(Array.isArray(snapshot.initiativeWatermarks) ? snapshot.initiativeWatermarks : []),
216
217
  workstreamWatermarks: new Map(Array.isArray(snapshot.workstreamWatermarks) ? snapshot.workstreamWatermarks : []),
218
+ planningIdentityWatermarks: new Map(Array.isArray(snapshot.planningIdentityWatermarks) ? snapshot.planningIdentityWatermarks : []),
217
219
  aiProfileWatermarks: new Map(Array.isArray(snapshot.aiProfileWatermarks) ? snapshot.aiProfileWatermarks : []),
218
220
  aiProfileChangeKeys: new Map(Array.isArray(snapshot.aiProfileChangeKeys) ? snapshot.aiProfileChangeKeys : []),
219
221
  taskforceAgentWatermarks: new Map(Array.isArray(snapshot.taskforceAgentWatermarks) ? snapshot.taskforceAgentWatermarks : []),
@@ -12,9 +12,12 @@ export declare function useLocalSyncCoordinatorSnapshot(input: {
12
12
  pollIntervalMs?: number;
13
13
  client?: LocalSyncCoordinatorBrowserClient;
14
14
  }): {
15
+ activeCommandType: LocalSyncCoordinatorCommandType | null;
16
+ activePriorityCommandType: LocalSyncCoordinatorCommandType | null;
15
17
  refresh: () => Promise<LocalSyncCoordinatorStatusResponse | null>;
16
18
  issueCommand: (type: Exclude<LocalSyncCoordinatorCommandType, "SwitchWorkspace" | "TransferOwnership">, args?: unknown) => Promise<LocalSyncCoordinatorCommandRecord>;
17
19
  signalWake: (source: "realtime" | "connectivity", eventIds?: string[]) => Promise<boolean>;
20
+ clearCredential: () => Promise<boolean>;
18
21
  switchWorkspace: (targetWorkspaceId: string) => Promise<LocalSyncCoordinatorStatusResponse["state"]>;
19
22
  transferOwnership: (targetMode: "server" | "browser-gateway") => Promise<LocalSyncCoordinatorStatusResponse["state"]>;
20
23
  phase: LocalSyncCoordinatorSnapshotPhase;
@@ -15,8 +15,14 @@ export function useLocalSyncCoordinatorSnapshot(input) {
15
15
  const requestEpochRef = useRef(0);
16
16
  const commandLifecycleRef = useRef(null);
17
17
  const priorityCommandLifecycleRef = useRef(null);
18
+ const [activeCommandType, setActiveCommandType] = useState(null);
19
+ const [activePriorityCommandType, setActivePriorityCommandType] = useState(null);
18
20
  const snapshotRef = useRef(null);
19
21
  snapshotRef.current = state.snapshot;
22
+ useEffect(() => {
23
+ setActiveCommandType(null);
24
+ setActivePriorityCommandType(null);
25
+ }, [input.workspaceId]);
20
26
  const resumePendingCommand = useCallback((scope) => {
21
27
  const existing = commandLifecycleRef.current;
22
28
  if (existing?.workspaceId === input.workspaceId)
@@ -36,14 +42,17 @@ export function useLocalSyncCoordinatorSnapshot(input) {
36
42
  const lifecycle = {
37
43
  workspaceId: input.workspaceId,
38
44
  scope,
45
+ type: pending.type,
39
46
  promise,
40
47
  };
41
48
  commandLifecycleRef.current = lifecycle;
49
+ setActiveCommandType(pending.type);
42
50
  void promise
43
51
  .catch(() => { })
44
52
  .finally(() => {
45
53
  if (commandLifecycleRef.current === lifecycle) {
46
54
  commandLifecycleRef.current = null;
55
+ setActiveCommandType(null);
47
56
  }
48
57
  });
49
58
  return promise;
@@ -68,14 +77,17 @@ export function useLocalSyncCoordinatorSnapshot(input) {
68
77
  const lifecycle = {
69
78
  workspaceId: input.workspaceId,
70
79
  scope,
80
+ type: pending.type,
71
81
  promise,
72
82
  };
73
83
  priorityCommandLifecycleRef.current = lifecycle;
84
+ setActivePriorityCommandType(pending.type);
74
85
  void promise
75
86
  .catch(() => { })
76
87
  .finally(() => {
77
88
  if (priorityCommandLifecycleRef.current === lifecycle) {
78
89
  priorityCommandLifecycleRef.current = null;
90
+ setActivePriorityCommandType(null);
79
91
  }
80
92
  });
81
93
  return promise;
@@ -250,7 +262,7 @@ export function useLocalSyncCoordinatorSnapshot(input) {
250
262
  refresh,
251
263
  ]);
252
264
  const issueCommand = useCallback(async (type, args = null) => {
253
- const snapshot = snapshotRef.current;
265
+ let snapshot = snapshotRef.current;
254
266
  if (!snapshot) {
255
267
  throw new LocalSyncCoordinatorBrowserClientError('The local sync coordinator is not attached.', 'SYNC_COORDINATOR_UNAVAILABLE', 409);
256
268
  }
@@ -258,21 +270,54 @@ export function useLocalSyncCoordinatorSnapshot(input) {
258
270
  if (priorityCommand) {
259
271
  const activePriority = priorityCommandLifecycleRef.current;
260
272
  if (activePriority?.workspaceId === input.workspaceId) {
261
- return activePriority.promise;
273
+ if (activePriority.type === type)
274
+ return activePriority.promise;
275
+ await activePriority.promise;
262
276
  }
263
277
  const resumedPriority = resumePendingPriorityCommand(scopeRef.current);
264
- if (resumedPriority)
265
- return resumedPriority;
278
+ if (resumedPriority) {
279
+ const resumedType = priorityCommandLifecycleRef.current?.type;
280
+ if (resumedType === type)
281
+ return resumedPriority;
282
+ await resumedPriority;
283
+ }
266
284
  }
267
285
  const active = commandLifecycleRef.current;
268
- if (!priorityCommand && active?.workspaceId === input.workspaceId) {
269
- await active.promise;
286
+ if (active?.workspaceId === input.workspaceId) {
287
+ if (active.type === type)
288
+ return active.promise;
289
+ const activeIsToggle = active.type === 'EnableSync' || active.type === 'DisableSync';
290
+ if (!priorityCommand || activeIsToggle)
291
+ await active.promise;
270
292
  }
271
- if (!priorityCommand) {
272
- const resumed = resumePendingCommand(scopeRef.current);
273
- if (resumed)
293
+ const resumed = resumePendingCommand(scopeRef.current);
294
+ if (resumed) {
295
+ const resumedType = commandLifecycleRef.current?.type;
296
+ if (resumedType === type)
297
+ return resumed;
298
+ const resumedIsToggle = resumedType === 'EnableSync' || resumedType === 'DisableSync';
299
+ if (!priorityCommand || resumedIsToggle)
274
300
  await resumed;
275
301
  }
302
+ if (!priorityCommand) {
303
+ const activePriority = priorityCommandLifecycleRef.current;
304
+ if (activePriority?.workspaceId === input.workspaceId) {
305
+ if (activePriority.type === type)
306
+ return activePriority.promise;
307
+ await activePriority.promise;
308
+ }
309
+ const resumedPriority = resumePendingPriorityCommand(scopeRef.current);
310
+ if (resumedPriority) {
311
+ const resumedType = priorityCommandLifecycleRef.current?.type;
312
+ if (resumedType === type)
313
+ return resumedPriority;
314
+ await resumedPriority;
315
+ }
316
+ }
317
+ snapshot = snapshotRef.current;
318
+ if (!snapshot) {
319
+ throw new LocalSyncCoordinatorBrowserClientError('The local sync coordinator is not attached.', 'SYNC_COORDINATOR_UNAVAILABLE', 409);
320
+ }
276
321
  const envelope = {
277
322
  commandId: crypto.randomUUID(),
278
323
  workspaceId: input.workspaceId,
@@ -290,15 +335,28 @@ export function useLocalSyncCoordinatorSnapshot(input) {
290
335
  const lifecycle = {
291
336
  workspaceId: input.workspaceId,
292
337
  scope: scopeRef.current,
338
+ type,
293
339
  promise: commandPromise,
294
340
  };
295
341
  const lifecycleRef = priorityCommand
296
342
  ? priorityCommandLifecycleRef
297
343
  : commandLifecycleRef;
298
344
  lifecycleRef.current = lifecycle;
345
+ if (priorityCommand) {
346
+ setActivePriorityCommandType(type);
347
+ }
348
+ else {
349
+ setActiveCommandType(type);
350
+ }
299
351
  const finalize = () => {
300
352
  if (lifecycleRef.current === lifecycle) {
301
353
  lifecycleRef.current = null;
354
+ if (priorityCommand) {
355
+ setActivePriorityCommandType(null);
356
+ }
357
+ else {
358
+ setActiveCommandType(null);
359
+ }
302
360
  }
303
361
  if (scopeRef.current === lifecycle.scope
304
362
  && input.workspaceId === lifecycle.workspaceId) {
@@ -326,6 +384,18 @@ export function useLocalSyncCoordinatorSnapshot(input) {
326
384
  });
327
385
  return true;
328
386
  }, [client, input.workspaceId]);
387
+ const clearCredential = useCallback(async () => {
388
+ const snapshot = snapshotRef.current;
389
+ if (!snapshot || !input.workspaceId)
390
+ return false;
391
+ await client.clearCredential({
392
+ workspaceId: input.workspaceId,
393
+ coordinatorGeneration: snapshot.state.coordinatorGeneration,
394
+ });
395
+ snapshotRef.current = null;
396
+ setState({ phase: 'idle', snapshot: null, error: null });
397
+ return true;
398
+ }, [client, input.workspaceId]);
329
399
  const switchWorkspace = useCallback(async (targetWorkspaceId) => {
330
400
  const snapshot = snapshotRef.current;
331
401
  const expectedActiveWorkspaceId = String(snapshot?.state.activeWorkspaceId || '').trim();
@@ -381,12 +451,18 @@ export function useLocalSyncCoordinatorSnapshot(input) {
381
451
  }, [client, input.workspaceId, refresh]);
382
452
  return useMemo(() => ({
383
453
  ...state,
454
+ activeCommandType,
455
+ activePriorityCommandType,
384
456
  refresh,
385
457
  issueCommand,
386
458
  signalWake,
459
+ clearCredential,
387
460
  switchWorkspace,
388
461
  transferOwnership,
389
462
  }), [
463
+ activeCommandType,
464
+ activePriorityCommandType,
465
+ clearCredential,
390
466
  issueCommand,
391
467
  refresh,
392
468
  signalWake,
@@ -5,21 +5,24 @@ interface SaveWorkspaceCloudSyncSettingsResult {
5
5
  interface UseSyncStatusControlsInput {
6
6
  canManageWorkspaceSync: boolean;
7
7
  workspaceCloudSyncEnabled: boolean;
8
+ persistedToggleIntent?: WorkspaceSyncToggleIntent;
8
9
  saveWorkspaceCloudSyncSettings: (input: {
9
10
  enabled: boolean;
10
11
  }) => Promise<SaveWorkspaceCloudSyncSettingsResult>;
11
12
  }
13
+ export type WorkspaceSyncToggleIntent = 'enabling' | 'disabling' | null;
12
14
  interface UseSyncStatusControlsResult {
13
15
  showSyncStatusModal: boolean;
14
16
  showSyncEnableWarning: boolean;
15
17
  workspaceSyncToggleBusy: boolean;
16
18
  workspaceSyncError: string | null;
17
19
  syncControlBusy: boolean;
20
+ syncControlIntent: WorkspaceSyncToggleIntent;
18
21
  openSyncStatusModal: () => void;
19
22
  closeSyncStatusModal: () => void;
20
23
  handleWorkspaceSyncToggle: (enabled: boolean) => Promise<void>;
21
24
  cancelSyncEnableWarning: () => void;
22
25
  confirmSyncEnableWarning: () => void;
23
26
  }
24
- export declare function useSyncStatusControls({ canManageWorkspaceSync, workspaceCloudSyncEnabled, saveWorkspaceCloudSyncSettings, }: UseSyncStatusControlsInput): UseSyncStatusControlsResult;
27
+ export declare function useSyncStatusControls({ canManageWorkspaceSync, workspaceCloudSyncEnabled, persistedToggleIntent, saveWorkspaceCloudSyncSettings, }: UseSyncStatusControlsInput): UseSyncStatusControlsResult;
25
28
  export {};
@@ -1,23 +1,58 @@
1
- import { useCallback, useState } from 'react';
2
- export function useSyncStatusControls({ canManageWorkspaceSync, workspaceCloudSyncEnabled, saveWorkspaceCloudSyncSettings, }) {
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ export function useSyncStatusControls({ canManageWorkspaceSync, workspaceCloudSyncEnabled, persistedToggleIntent = null, saveWorkspaceCloudSyncSettings, }) {
3
3
  const [showSyncStatusModal, setShowSyncStatusModal] = useState(false);
4
4
  const [showSyncEnableWarning, setShowSyncEnableWarning] = useState(false);
5
5
  const [workspaceSyncToggleBusy, setWorkspaceSyncToggleBusy] = useState(false);
6
6
  const [workspaceSyncError, setWorkspaceSyncError] = useState(null);
7
+ const [requestedSyncEnabled, setRequestedSyncEnabled] = useState(null);
8
+ const inFlightToggleRef = useRef(null);
9
+ const requestedToggleIntent = requestedSyncEnabled === null
10
+ ? null
11
+ : requestedSyncEnabled ? 'enabling' : 'disabling';
12
+ const syncControlIntent = requestedToggleIntent || persistedToggleIntent;
13
+ useEffect(() => {
14
+ if (requestedSyncEnabled !== null && requestedSyncEnabled === workspaceCloudSyncEnabled) {
15
+ setRequestedSyncEnabled(null);
16
+ }
17
+ }, [requestedSyncEnabled, workspaceCloudSyncEnabled]);
7
18
  const persistWorkspaceSyncToggle = useCallback(async (enabled) => {
8
19
  if (!canManageWorkspaceSync)
9
20
  return;
10
21
  setWorkspaceSyncError(null);
22
+ setRequestedSyncEnabled(enabled);
11
23
  setWorkspaceSyncToggleBusy(true);
12
- try {
13
- const result = await saveWorkspaceCloudSyncSettings({ enabled });
14
- if (!result.success) {
15
- setWorkspaceSyncError(result.error || (enabled ? 'Failed to enable sync.' : 'Failed to disable sync.'));
16
- }
17
- }
18
- finally {
19
- setWorkspaceSyncToggleBusy(false);
24
+ while (inFlightToggleRef.current) {
25
+ const active = inFlightToggleRef.current;
26
+ if (active.enabled === enabled)
27
+ return active.promise;
28
+ await active.promise;
20
29
  }
30
+ setRequestedSyncEnabled(enabled);
31
+ setWorkspaceSyncToggleBusy(true);
32
+ let commandPromise;
33
+ commandPromise = (async () => {
34
+ try {
35
+ const result = await saveWorkspaceCloudSyncSettings({ enabled });
36
+ if (!result.success) {
37
+ setRequestedSyncEnabled(null);
38
+ setWorkspaceSyncError(result.error || (enabled ? 'Failed to enable sync.' : 'Failed to disable sync.'));
39
+ }
40
+ }
41
+ catch (error) {
42
+ setRequestedSyncEnabled(null);
43
+ setWorkspaceSyncError(error instanceof Error && error.message.trim()
44
+ ? error.message
45
+ : enabled ? 'Failed to enable sync.' : 'Failed to disable sync.');
46
+ }
47
+ finally {
48
+ if (inFlightToggleRef.current?.promise === commandPromise) {
49
+ inFlightToggleRef.current = null;
50
+ setWorkspaceSyncToggleBusy(false);
51
+ }
52
+ }
53
+ })();
54
+ inFlightToggleRef.current = { enabled, promise: commandPromise };
55
+ return commandPromise;
21
56
  }, [
22
57
  canManageWorkspaceSync,
23
58
  saveWorkspaceCloudSyncSettings
@@ -50,7 +85,8 @@ export function useSyncStatusControls({ canManageWorkspaceSync, workspaceCloudSy
50
85
  showSyncEnableWarning,
51
86
  workspaceSyncToggleBusy,
52
87
  workspaceSyncError,
53
- syncControlBusy: workspaceSyncToggleBusy,
88
+ syncControlBusy: workspaceSyncToggleBusy || syncControlIntent !== null,
89
+ syncControlIntent,
54
90
  openSyncStatusModal,
55
91
  closeSyncStatusModal,
56
92
  handleWorkspaceSyncToggle,
@@ -79,9 +79,12 @@ export declare function useSyncOrchestrator(input: UseSyncOrchestratorInput): {
79
79
  phase: import("./sync/useLocalSyncCoordinatorSnapshot.js").LocalSyncCoordinatorSnapshotPhase;
80
80
  snapshot: import("../sync/coordinator/localSyncCoordinatorBrowserClient.js").LocalSyncCoordinatorStatusResponse | null;
81
81
  errorMessage: string | null;
82
+ activeCommandType: import("../sync/coordinator/localSyncCoordinatorTypes").LocalSyncCoordinatorCommandType | null;
83
+ activePriorityCommandType: import("../sync/coordinator/localSyncCoordinatorTypes").LocalSyncCoordinatorCommandType | null;
82
84
  } | null;
83
85
  switchLocalCoordinatorWorkspace: (targetWorkspaceId: string) => Promise<boolean>;
84
86
  transferLocalCoordinatorOwnership: (targetMode: "server" | "browser-gateway") => Promise<boolean>;
87
+ clearLocalCoordinatorCredential: () => Promise<boolean>;
85
88
  syncInFlightRef: import("react").RefObject<boolean>;
86
89
  workspaceRetryAt: string | null;
87
90
  isWorkspaceRetryPending: () => boolean;