@taskforcehq/taskforce 0.3.329 → 0.3.330

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 (321) hide show
  1. package/dist/Taskforce.module.css +290 -45
  2. package/dist/components/features/AiProfilesModule.js +3 -5
  3. package/dist/components/features/TaskSettings.js +70 -14
  4. package/dist/components/features/TaskforceAgentsModule.d.ts +1 -2
  5. package/dist/components/features/TaskforceAgentsModule.js +586 -116
  6. package/dist/components/features/agentConnections/AgentConnectionControl.d.ts +15 -0
  7. package/dist/components/features/agentConnections/AgentConnectionControl.js +125 -0
  8. package/dist/components/features/agentConnections/ModelConnectionsPanel.d.ts +18 -0
  9. package/dist/components/features/agentConnections/ModelConnectionsPanel.js +393 -0
  10. package/dist/components/features/agentConnections/modelConnectionsApi.d.ts +65 -0
  11. package/dist/components/features/agentConnections/modelConnectionsApi.js +129 -0
  12. package/dist/components/features/taskforceAgentAssignments/AgentBehaviorAssignments.js +15 -24
  13. package/dist/components/features/taskforceAgentEditorModel.d.ts +2 -1
  14. package/dist/components/features/taskforceAgentEditorModel.js +3 -1
  15. package/dist/components/features/workflowManager/workflowManagerApi.d.ts +1 -1
  16. package/dist/components/features/workflowManager/workflowManagerApi.js +3 -0
  17. package/dist/components/task/TaskWorkflowAssignmentField.js +68 -10
  18. package/dist/components/views/StandaloneLayout.js +27 -26
  19. package/dist/components/views/standalone/modals/SyncStatusModal.d.ts +4 -3
  20. package/dist/components/views/standalone/modals/SyncStatusModal.js +33 -38
  21. package/dist/config/envSchema.js +48 -1
  22. package/dist/core/McpTokenService.d.ts +23 -1
  23. package/dist/core/McpTokenService.js +93 -10
  24. package/dist/core/TaskChecklistCommandService.d.ts +27 -0
  25. package/dist/core/TaskChecklistCommandService.js +83 -5
  26. package/dist/core/TaskLifecycleCommandService.d.ts +3 -1
  27. package/dist/core/TaskLifecycleCommandService.js +6 -2
  28. package/dist/core/Taskforce.d.ts +32 -0
  29. package/dist/core/Taskforce.js +125 -4
  30. package/dist/core/types.d.ts +8 -0
  31. package/dist/documentReviews/commandService.d.ts +2 -1
  32. package/dist/documentReviews/commandService.js +6 -3
  33. package/dist/hooks/sync/orchestratorShared.d.ts +1 -0
  34. package/dist/hooks/sync/orchestratorShared.js +2 -0
  35. package/dist/hooks/sync/useLocalSyncCoordinatorSnapshot.d.ts +3 -0
  36. package/dist/hooks/sync/useLocalSyncCoordinatorSnapshot.js +85 -9
  37. package/dist/hooks/sync/useSyncStatusControls.d.ts +4 -1
  38. package/dist/hooks/sync/useSyncStatusControls.js +47 -11
  39. package/dist/hooks/useSyncOrchestrator.d.ts +3 -0
  40. package/dist/hooks/useSyncOrchestrator.js +111 -2
  41. package/dist/hooks/useTaskData.d.ts +31 -1
  42. package/dist/hooks/useTaskData.js +29 -7
  43. package/dist/hooks/useTaskMutations.d.ts +3 -1
  44. package/dist/hooks/useTaskMutations.js +46 -12
  45. package/dist/hooks/useTaskforce.d.ts +2 -0
  46. package/dist/hooks/useTaskforce.js +11 -2
  47. package/dist/mcp/clientRegistry.d.ts +2 -2
  48. package/dist/mcp/clientRegistry.js +1 -1
  49. package/dist/mcp/documentAssetRegistrar.js +9 -6
  50. package/dist/mcp/durableTaskMutationRouter.d.ts +4 -1
  51. package/dist/mcp/durableTaskMutationRouter.js +10 -0
  52. package/dist/mcp/durableTaskRelationshipMutationRouter.js +4 -0
  53. package/dist/mcp/httpProtocolRouting.d.ts +10 -0
  54. package/dist/mcp/httpProtocolRouting.js +19 -0
  55. package/dist/mcp/localCliHealth.d.ts +2 -2
  56. package/dist/mcp/localCliHealth.js +2 -2
  57. package/dist/mcp/localServiceProxy.d.ts +1 -0
  58. package/dist/mcp/localServiceProxy.js +530 -68
  59. package/dist/mcp/planningAttachmentCommandAdapter.d.ts +3 -1
  60. package/dist/mcp/planningAttachmentCommandAdapter.js +20 -2
  61. package/dist/mcp/runtime.d.ts +54 -79
  62. package/dist/mcp/runtime.js +384 -97
  63. package/dist/mcp/taskPlanningRegistrar.js +23 -4
  64. package/dist/mcp/toolProfiles.d.ts +2 -0
  65. package/dist/mcp/toolProfiles.js +10 -0
  66. package/dist/mcp/toolRegistry.d.ts +1 -0
  67. package/dist/mcp/toolRegistry.js +1 -0
  68. package/dist/mcp/workflowExecutionRegistrar.js +4 -4
  69. package/dist/migrations/taskSchemaMigrations.d.ts +5 -0
  70. package/dist/migrations/taskSchemaMigrations.js +415 -0
  71. package/dist/runtime/appGates.d.ts +2 -1
  72. package/dist/runtime/appGates.js +7 -0
  73. package/dist/server/index.d.ts +3 -0
  74. package/dist/server/index.js +108 -11
  75. package/dist/server/localDatabaseIdentity.js +4 -1
  76. package/dist/server/localServiceLease.js +2 -1
  77. package/dist/server/localServiceSessions.d.ts +14 -17
  78. package/dist/server/localServiceSessions.js +308 -94
  79. package/dist/server/localWorkspaceSyncServerRuntime.js +12 -14
  80. package/dist/server/routes/admin.d.ts +4 -0
  81. package/dist/server/routes/admin.js +112 -3
  82. package/dist/server/routes/agents.d.ts +7 -0
  83. package/dist/server/routes/agents.js +277 -24
  84. package/dist/server/routes/billing.js +5 -1
  85. package/dist/server/routes/durableTaskHttpRouters.d.ts +2 -0
  86. package/dist/server/routes/executorPhaseAApprovals.d.ts +19 -0
  87. package/dist/server/routes/executorPhaseAApprovals.js +140 -0
  88. package/dist/server/routes/executorPhaseAIssuerRedemptions.d.ts +11 -0
  89. package/dist/server/routes/executorPhaseAIssuerRedemptions.js +24 -0
  90. package/dist/server/routes/githubReviewEvidence.d.ts +19 -0
  91. package/dist/server/routes/githubReviewEvidence.js +116 -0
  92. package/dist/server/routes/localService.d.ts +15 -4
  93. package/dist/server/routes/localService.js +136 -40
  94. package/dist/server/routes/modelConnections.d.ts +24 -0
  95. package/dist/server/routes/modelConnections.js +205 -0
  96. package/dist/server/routes/shared.d.ts +19 -0
  97. package/dist/server/routes/shared.js +95 -19
  98. package/dist/server/routes/sync.js +1 -0
  99. package/dist/server/routes/syncAuxRoutes.js +5 -1
  100. package/dist/server/routes/syncPushRoutes.d.ts +1 -0
  101. package/dist/server/routes/syncPushRoutes.js +1 -0
  102. package/dist/server/routes/syncV3FeedRoutes.js +10 -1
  103. package/dist/server/routes/syncV3OperationRoutes.js +35 -9
  104. package/dist/server/routes/tasks.js +21 -2
  105. package/dist/server/routes/workflows.js +9 -1
  106. package/dist/server/routes.js +59 -0
  107. package/dist/services/codexAppServerModelGateway.d.ts +54 -5
  108. package/dist/services/codexAppServerModelGateway.js +246 -21
  109. package/dist/services/codexDeviceCodeLoginManager.d.ts +39 -0
  110. package/dist/services/codexDeviceCodeLoginManager.js +265 -0
  111. package/dist/services/codexModelProviderConnectionLifecycle.d.ts +8 -0
  112. package/dist/services/codexModelProviderConnectionLifecycle.js +73 -0
  113. package/dist/services/executorPhaseAApprovalRuntime.d.ts +14 -0
  114. package/dist/services/executorPhaseAApprovalRuntime.js +24 -0
  115. package/dist/services/executorPhaseAApprovalService.d.ts +40 -0
  116. package/dist/services/executorPhaseAApprovalService.js +609 -0
  117. package/dist/services/executorPhaseADriftEvaluator.d.ts +78 -0
  118. package/dist/services/executorPhaseADriftEvaluator.js +93 -0
  119. package/dist/services/executorPhaseAIssuerCore.d.ts +126 -0
  120. package/dist/services/executorPhaseAIssuerCore.js +295 -0
  121. package/dist/services/executorPhaseAIssuerRedemptionService.d.ts +34 -0
  122. package/dist/services/executorPhaseAIssuerRedemptionService.js +158 -0
  123. package/dist/services/githubReviewEvidenceRuntime.d.ts +14 -0
  124. package/dist/services/githubReviewEvidenceRuntime.js +30 -0
  125. package/dist/services/githubReviewEvidenceService.d.ts +93 -0
  126. package/dist/services/githubReviewEvidenceService.js +336 -0
  127. package/dist/services/modelGateway.d.ts +7 -0
  128. package/dist/services/modelProviderConnectionService.d.ts +71 -0
  129. package/dist/services/modelProviderConnectionService.js +279 -0
  130. package/dist/services/modelProviderCredentialHome.d.ts +32 -0
  131. package/dist/services/modelProviderCredentialHome.js +271 -0
  132. package/dist/services/ownerScopedModelConnectionGateway.d.ts +12 -0
  133. package/dist/services/ownerScopedModelConnectionGateway.js +30 -0
  134. package/dist/services/taskforceAgentConnectionBindingService.d.ts +66 -0
  135. package/dist/services/taskforceAgentConnectionBindingService.js +185 -0
  136. package/dist/services/taskforceAgentMcpBridge.d.ts +1 -1
  137. package/dist/services/taskforceAgentMcpBridge.js +7 -24
  138. package/dist/shared/adminEdgeProxy.d.ts +5 -0
  139. package/dist/shared/adminEdgeProxy.js +94 -0
  140. package/dist/shared/adminProxySessionCookies.d.ts +16 -0
  141. package/dist/shared/adminProxySessionCookies.js +86 -0
  142. package/dist/shared/aiProfileColors.d.ts +31 -1
  143. package/dist/shared/aiProfileColors.js +14 -6
  144. package/dist/shared/executorPhaseAApprovalGoldenVector.json +269 -0
  145. package/dist/shared/executorPhaseAApprovalReceipt.d.ts +112 -0
  146. package/dist/shared/executorPhaseAApprovalReceipt.js +58 -0
  147. package/dist/shared/executorPhaseAApprovalTrustPolicy.json +10 -0
  148. package/dist/shared/executorPhaseADriftContracts.d.ts +37 -0
  149. package/dist/shared/executorPhaseADriftContracts.js +63 -0
  150. package/dist/shared/executorPhaseAIssuerContracts.d.ts +75 -0
  151. package/dist/shared/executorPhaseAIssuerContracts.js +90 -0
  152. package/dist/shared/executorPhaseARunAuthorization.d.ts +120 -0
  153. package/dist/shared/executorPhaseARunAuthorization.js +232 -0
  154. package/dist/shared/executorPhaseASchemaValidation.d.ts +7 -0
  155. package/dist/shared/executorPhaseASchemaValidation.js +53 -0
  156. package/dist/shared/executorPhaseASchemas/approval-receipt.schema.json +106 -0
  157. package/dist/shared/executorPhaseASchemas/drift-attestation.schema.json +54 -0
  158. package/dist/shared/executorPhaseASchemas/drift-request.schema.json +47 -0
  159. package/dist/shared/executorPhaseASchemas/foundation-manifest.schema.json +29 -0
  160. package/dist/shared/executorPhaseASchemas/issuer-audit-record.schema.json +24 -0
  161. package/dist/shared/executorPhaseASchemas/issuer-proof.schema.json +43 -0
  162. package/dist/shared/executorPhaseASchemas/issuer-redemption-request.schema.json +18 -0
  163. package/dist/shared/executorPhaseASchemas/issuer-redemption-response.schema.json +39 -0
  164. package/dist/shared/executorPhaseASchemas/logical-envelope.schema.json +149 -0
  165. package/dist/shared/executorPhaseASchemas/preflight-report.schema.json +216 -0
  166. package/dist/shared/executorPhaseASchemas/run-capability.schema.json +111 -0
  167. package/dist/shared/executorPhaseASchemas/sender-proof.schema.json +37 -0
  168. package/dist/shared/executorPhaseASchemas/workload-grant.schema.json +68 -0
  169. package/dist/shared/executorPhaseASchemas/workload-jwt-claims.schema.json +67 -0
  170. package/dist/shared/executorPhaseATiming.d.ts +1 -0
  171. package/dist/shared/executorPhaseATiming.js +1 -0
  172. package/dist/shared/planningIdentity.js +1 -1
  173. package/dist/shared/productLogoKeys.d.ts +2 -0
  174. package/dist/shared/productLogoKeys.js +18 -0
  175. package/dist/shared/taskforceAgentDefinition.d.ts +0 -1
  176. package/dist/shared/taskforceAgentDefinition.js +6 -9
  177. package/dist/shared/taskforceAgentModels.js +7 -3
  178. package/dist/shared/userFeatureGrants.d.ts +4 -0
  179. package/dist/shared/userFeatureGrants.js +7 -0
  180. package/dist/storage/executorPhaseAApprovalReceiptStore.d.ts +37 -0
  181. package/dist/storage/executorPhaseAApprovalReceiptStore.js +81 -0
  182. package/dist/storage/executorPhaseARunAuthorizationStore.d.ts +103 -0
  183. package/dist/storage/executorPhaseARunAuthorizationStore.js +492 -0
  184. package/dist/storage/githubReviewEvidenceInstallationStore.d.ts +26 -0
  185. package/dist/storage/githubReviewEvidenceInstallationStore.js +89 -0
  186. package/dist/storage/modelProviderConnectionStore.d.ts +99 -0
  187. package/dist/storage/modelProviderConnectionStore.js +446 -0
  188. package/dist/storage/postgresAdapter.d.ts +4 -0
  189. package/dist/storage/postgresAdapter.js +11 -0
  190. package/dist/storage/postgresWorker.js +9 -1
  191. package/dist/storage/postgresWorkerProtocol.d.ts +1 -0
  192. package/dist/storage/taskforceAgentConnectionBindingStore.d.ts +31 -0
  193. package/dist/storage/taskforceAgentConnectionBindingStore.js +84 -0
  194. package/dist/sync/coordinator/localSyncExecutionPermitStore.js +60 -29
  195. package/dist/sync/coordinator/localWorkspaceSyncPendingV2PushProgress.d.ts +10 -0
  196. package/dist/sync/coordinator/localWorkspaceSyncPendingV2PushProgress.js +29 -0
  197. package/dist/sync/coordinator/localWorkspaceSyncRunnerState.d.ts +15 -1
  198. package/dist/sync/coordinator/localWorkspaceSyncRunnerState.js +99 -2
  199. package/dist/sync/coordinator/workspaceSyncCredentialBroker.d.ts +1 -0
  200. package/dist/sync/coordinator/workspaceSyncCredentialBroker.js +33 -4
  201. package/dist/sync/engine/workspaceSyncContentLifecycleAdapter.d.ts +2 -1
  202. package/dist/sync/engine/workspaceSyncContentVersionStore.d.ts +38 -0
  203. package/dist/sync/engine/workspaceSyncContentVersionStore.js +50 -1
  204. package/dist/sync/engine/workspaceSyncEngineLifecyclePolicy.js +6 -6
  205. package/dist/sync/engine/workspaceSyncEnginePushCompletion.d.ts +14 -0
  206. package/dist/sync/engine/workspaceSyncEnginePushCompletion.js +84 -0
  207. package/dist/sync/engine/workspaceSyncEngineRecovery.js +1 -0
  208. package/dist/sync/engine/workspaceSyncEngineRuntime.d.ts +1 -0
  209. package/dist/sync/engine/workspaceSyncEngineRuntime.js +1 -0
  210. package/dist/sync/engine/workspaceSyncEngineServerRunnerOperations.js +112 -38
  211. package/dist/sync/engine/workspaceSyncEngineServerSnapshotReader.js +6 -0
  212. package/dist/sync/engine/workspaceSyncEngineTransfers.js +3 -1
  213. package/dist/sync/engine/workspaceSyncV2ChangeDispatcher.d.ts +1 -0
  214. package/dist/sync/engine/workspaceSyncV2ChangeDispatcher.js +29 -0
  215. package/dist/sync/syncApplyHandlers.d.ts +2 -0
  216. package/dist/sync/syncApplyHandlers.js +10 -1
  217. package/dist/sync/syncService.d.ts +15 -0
  218. package/dist/sync/syncService.js +83 -18
  219. package/dist/sync/taskforceAgentSyncAuthorization.d.ts +16 -0
  220. package/dist/sync/taskforceAgentSyncAuthorization.js +20 -0
  221. package/dist/sync/v3/combinedFeedCapability.js +4 -0
  222. package/dist/sync/v3/durableInitiativeMutationRouter.js +18 -10
  223. package/dist/sync/v3/durableOperationReplay.d.ts +14 -0
  224. package/dist/sync/v3/durableOperationReplay.js +18 -0
  225. package/dist/sync/v3/durableTaskAttachmentLinksMutationRouter.js +3 -0
  226. package/dist/sync/v3/durableTaskChecklistMutationRouter.d.ts +2 -1
  227. package/dist/sync/v3/durableTaskChecklistMutationRouter.js +58 -15
  228. package/dist/sync/v3/durableTaskCommentMutationRouter.js +3 -0
  229. package/dist/sync/v3/durableTaskHttpRootMutationRouter.d.ts +1 -1
  230. package/dist/sync/v3/durableTaskHttpRootMutationRouter.js +10 -0
  231. package/dist/sync/v3/durableTaxonomyMutationRouter.js +5 -0
  232. package/dist/sync/v3/durableWorkflowRuntimeMutationRouter.d.ts +11 -0
  233. package/dist/sync/v3/durableWorkflowRuntimeMutationRouter.js +39 -10
  234. package/dist/sync/v3/durableWorkstreamMutationRouter.js +18 -10
  235. package/dist/sync/v3/durableWorkstreamTaskOrderMutationRouter.js +16 -5
  236. package/dist/sync/v3/localOutboxDispatchRuntime.js +2 -2
  237. package/dist/sync/v3/localTaskChecklistOutboxHandler.js +16 -2
  238. package/dist/sync/v3/localTaskChecklistOutboxService.d.ts +4 -0
  239. package/dist/sync/v3/localTaskChecklistOutboxService.js +14 -1
  240. package/dist/sync/v3/localTaskStatusOutboxService.d.ts +8 -0
  241. package/dist/sync/v3/localTaskStatusOutboxService.js +219 -12
  242. package/dist/sync/v3/syncDurabilityStore.d.ts +34 -0
  243. package/dist/sync/v3/syncDurabilityStore.js +168 -2
  244. package/dist/sync/v3/taskChecklistMutationService.d.ts +11 -0
  245. package/dist/sync/v3/taskChecklistMutationService.js +44 -1
  246. package/dist/sync/v3/taskStatusMutationService.d.ts +29 -1
  247. package/dist/sync/v3/taskStatusMutationService.js +119 -3
  248. package/dist/sync/v3/workflowAssignmentSync.d.ts +5 -0
  249. package/dist/sync/v3/workflowAssignmentSync.js +27 -0
  250. package/dist/sync/v3/workspaceSyncJournalReader.js +1 -1
  251. package/dist/sync/v3/workspaceSyncOperationRetentionService.d.ts +16 -0
  252. package/dist/sync/v3/workspaceSyncOperationRetentionService.js +83 -0
  253. package/dist/sync/v3/workspaceSyncV3CloudOperationHandler.d.ts +1 -0
  254. package/dist/sync/v3/workspaceSyncV3CloudOperationHandler.js +9 -2
  255. package/dist/sync/v3/workspaceSyncV3CombinedRepairBaseline.d.ts +7 -0
  256. package/dist/sync/v3/workspaceSyncV3CombinedRepairBaseline.js +44 -32
  257. package/dist/sync/v3/workspaceSyncV3CombinedRepairMaterialization.d.ts +9 -5
  258. package/dist/sync/v3/workspaceSyncV3CombinedRepairMaterialization.js +54 -38
  259. package/dist/sync/v3/workspaceSyncV3CombinedRepairSnapshot.d.ts +10 -0
  260. package/dist/sync/v3/workspaceSyncV3CombinedRepairSnapshot.js +70 -31
  261. package/dist/sync/v3/workspaceSyncV3CombinedWireContract.d.ts +2 -1
  262. package/dist/sync/v3/workspaceSyncV3CombinedWireContract.js +16 -0
  263. package/dist/sync/v3/workspaceSyncV3CoverageRegistry.js +6 -0
  264. package/dist/sync/v3/workspaceSyncV3OperationProtocol.d.ts +3 -0
  265. package/dist/sync/v3/workspaceSyncV3OperatorDiagnostics.d.ts +5 -0
  266. package/dist/sync/v3/workspaceSyncV3OperatorDiagnostics.js +36 -2
  267. package/dist/sync/v3/workspaceSyncV3RepairSnapshotRetentionService.d.ts +17 -0
  268. package/dist/sync/v3/workspaceSyncV3RepairSnapshotRetentionService.js +64 -0
  269. package/dist/sync/v3/workspaceSyncV3WorkflowTaskCoverCoverage.d.ts +7 -0
  270. package/dist/sync/v3/workspaceSyncV3WorkflowTaskCoverCoverage.js +33 -0
  271. package/dist/sync/v3/workspaceSyncV3WorkflowTaskCoverWireContract.d.ts +7 -0
  272. package/dist/sync/v3/workspaceSyncV3WorkflowTaskCoverWireContract.js +8 -0
  273. package/dist/sync/workspaceRepair.d.ts +5 -2
  274. package/dist/sync/workspaceRepair.js +161 -6
  275. package/dist/sync/workspaceSyncModel.d.ts +21 -0
  276. package/dist/sync/workspaceSyncModel.js +35 -7
  277. package/dist/sync/workspaceSyncState.d.ts +1 -0
  278. package/dist/sync/workspaceSyncV2SnapshotBuilder.d.ts +6 -0
  279. package/dist/sync/workspaceSyncV2SnapshotBuilder.js +5 -0
  280. package/dist/ui/assets/AiIdentityRosterCard-OcSz1PkK.js +1 -0
  281. package/dist/ui/assets/AiProfilesModule-ByhYW5Xi.js +1 -0
  282. package/dist/ui/assets/{AnnotatedAttachmentWorkspace-B68Wg-RV.js → AnnotatedAttachmentWorkspace-BTM6nIg_.js} +1 -1
  283. package/dist/ui/assets/{AssetTraySortControl-C8Rztyal.js → AssetTraySortControl-DabEG8L4.js} +1 -1
  284. package/dist/ui/assets/{ContextAttachmentManager-Cj3c7X9y.js → ContextAttachmentManager-Coa8yVGM.js} +1 -1
  285. package/dist/ui/assets/{DocumentWorkspace-B5uvzems.js → DocumentWorkspace-BB0qhdix.js} +1 -1
  286. package/dist/ui/assets/{EntityActivityTimeline-BVFvCB5R.js → EntityActivityTimeline-CZ8x4UJE.js} +1 -1
  287. package/dist/ui/assets/{PlanningModule-B5DWQOGz.js → PlanningModule-pRPjR7v5.js} +1 -1
  288. package/dist/ui/assets/{PlansPage-AY4cGWco.js → PlansPage-D86pZSSl.js} +1 -1
  289. package/dist/ui/assets/{TaskContextUpload-DZxTVesW.js → TaskContextUpload-BVIkU9yT.js} +1 -1
  290. package/dist/ui/assets/TaskSettings-Cv1mNhv_.js +12 -0
  291. package/dist/ui/assets/TaskforceAgentsModule-b-8R25cJ.css +1 -0
  292. package/dist/ui/assets/TaskforceAgentsModule-gmH-PD2q.js +24 -0
  293. package/dist/ui/assets/{WorkflowManagerModule-DEr5di_r.js → WorkflowManagerModule-DbfnHJ-f.js} +1 -1
  294. package/dist/ui/assets/index-BZ-hdZSk.css +1 -0
  295. package/dist/ui/assets/index-CTsDBaef.js +7 -0
  296. package/dist/ui/assets/{vendor-icons-D9Lpw-j4.js → vendor-icons-Bsq-mcEn.js} +1 -1
  297. package/dist/ui/branding/logos/letterhead_dark.png +0 -0
  298. package/dist/ui/branding/logos/letterhead_light.png +0 -0
  299. package/dist/ui/branding/logos/signature_dark.png +0 -0
  300. package/dist/ui/branding/logos/signature_light.png +0 -0
  301. package/dist/ui/index.html +3 -3
  302. package/dist/utils/aiProfileDefaultLogo.js +16 -48
  303. package/dist/utils/httpSetCookie.d.ts +1 -0
  304. package/dist/utils/httpSetCookie.js +4 -1
  305. package/dist/utils/localRuntimeUrl.d.ts +1 -0
  306. package/dist/utils/localRuntimeUrl.js +14 -0
  307. package/dist/utils/productLogoRegistry.d.ts +2 -0
  308. package/dist/utils/productLogoRegistry.js +36 -0
  309. package/dist/utils/syncStatusPresentation.d.ts +4 -0
  310. package/dist/utils/syncStatusPresentation.js +17 -0
  311. package/dist/utils/taskEvents.d.ts +2 -0
  312. package/dist/utils/workspaceSyncPresentation.d.ts +1 -1
  313. package/dist/utils/workspaceSyncPresentation.js +23 -17
  314. package/package.json +22 -4
  315. package/dist/ui/assets/AiIdentityRosterCard-BZM4aQnM.js +0 -1
  316. package/dist/ui/assets/AiProfilesModule-BbAEWtHH.js +0 -1
  317. package/dist/ui/assets/TaskSettings-BeWAuyZj.js +0 -12
  318. package/dist/ui/assets/TaskforceAgentsModule-BifCYtjR.js +0 -21
  319. package/dist/ui/assets/TaskforceAgentsModule-D6IC0S7Q.css +0 -1
  320. package/dist/ui/assets/index-I5zhdtgt.js +0 -7
  321. package/dist/ui/assets/index-VRFsx3wz.css +0 -1
@@ -1,4 +1,4 @@
1
- import { createHash } from 'crypto';
1
+ import { createHash, randomUUID } from 'crypto';
2
2
  import { compareWorkspaceMutationOrdering } from '../workspaceSyncSurface.js';
3
3
  import { canonicalWorkspaceSyncJson } from '../v3/canonicalWorkspaceSyncJson.js';
4
4
  export class WorkspaceSyncContentVersionConflictError extends Error {
@@ -577,9 +577,58 @@ export class WorkspaceSyncContentVersionStore {
577
577
  contentSha256: null,
578
578
  sizeBytes: null,
579
579
  });
580
+ // Only a tombstone that's actually newly accepted (didn't early-return
581
+ // above as superseded/no-op) gets a provenance record — provenance
582
+ // tracks admission events, not every replayed/no-op call.
583
+ this.recordTombstoneProvenance(input);
580
584
  return this.requireHead(input);
581
585
  })();
582
586
  }
587
+ recordTombstoneProvenance(input) {
588
+ const provenance = input.provenance;
589
+ this.db.prepare(`
590
+ INSERT INTO workspace_sync_content_tombstone_provenance (
591
+ id, tenant_id, workspace_id, kind, logical_path, source,
592
+ operation_id, actor_id, source_runtime, source_updated_at,
593
+ repair_involved, recorded_at
594
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
595
+ `).run(randomUUID(), input.tenantId, input.workspaceId, input.kind, input.logicalPath, provenance?.source || 'unknown', provenance?.operationId || null, provenance?.actorId || null, provenance?.sourceRuntime || null, input.sourceUpdatedAt, provenance?.repairInvolved === true ? 1 : 0, input.publishedAt);
596
+ }
597
+ /** Queryable read side for tombstone provenance — most recent admission first. */
598
+ listTombstoneProvenance(input) {
599
+ const limit = Math.max(1, Math.min(500, Math.floor(Number(input.limit) || 100)));
600
+ const conditions = ['tenant_id = ?', 'workspace_id = ?'];
601
+ const params = [input.tenantId, input.workspaceId];
602
+ if (input.kind) {
603
+ conditions.push('kind = ?');
604
+ params.push(input.kind);
605
+ }
606
+ if (input.logicalPath) {
607
+ conditions.push('logical_path = ?');
608
+ params.push(input.logicalPath);
609
+ }
610
+ const rows = this.db.prepare(`
611
+ SELECT *
612
+ FROM workspace_sync_content_tombstone_provenance
613
+ WHERE ${conditions.join(' AND ')}
614
+ ORDER BY recorded_at DESC
615
+ LIMIT ?
616
+ `).all(...params, limit);
617
+ return rows.map((row) => ({
618
+ id: String(row.id || ''),
619
+ tenantId: String(row.tenant_id || ''),
620
+ workspaceId: String(row.workspace_id || ''),
621
+ kind: row.kind === 'document' ? 'document' : 'asset',
622
+ logicalPath: String(row.logical_path || ''),
623
+ source: String(row.source || 'unknown'),
624
+ operationId: row.operation_id == null ? null : String(row.operation_id),
625
+ actorId: row.actor_id == null ? null : String(row.actor_id),
626
+ sourceRuntime: row.source_runtime == null ? null : String(row.source_runtime),
627
+ sourceUpdatedAt: String(row.source_updated_at || ''),
628
+ repairInvolved: Number(row.repair_involved) === 1,
629
+ recordedAt: String(row.recorded_at || ''),
630
+ }));
631
+ }
583
632
  resolveHead(input) {
584
633
  const head = this.getHead(input);
585
634
  return head ? { source: 'versioned', head } : { source: 'legacy' };
@@ -25,7 +25,7 @@ export function resolveWorkspaceSyncPresentation({ enabled, phase, busy, retryAt
25
25
  summary: busy
26
26
  ? 'Uploading this workspace to cloud for the first time.'
27
27
  : 'Preparing the first upload to cloud.',
28
- recommendedAction: 'Keep this window open while the first upload finishes. If it seems stalled, press Sync.'
28
+ recommendedAction: 'Keep this window open while the first upload finishes.'
29
29
  };
30
30
  }
31
31
  if (phase === 'attach-cloud') {
@@ -71,14 +71,14 @@ export function resolveWorkspaceSyncPresentation({ enabled, phase, busy, retryAt
71
71
  return {
72
72
  status: 'attention',
73
73
  summary: 'Sync hit a temporary problem and will retry automatically.',
74
- recommendedAction: 'Wait for the automatic retry, or press Sync to retry now.'
74
+ recommendedAction: 'Wait for the automatic retry.'
75
75
  };
76
76
  }
77
77
  if (lastErrorMessage || phase === 'error') {
78
78
  return {
79
79
  status: 'attention',
80
80
  summary: 'Sync needs attention before it can continue.',
81
- recommendedAction: 'Press Sync to retry. If the same error keeps returning, press Repair.'
81
+ recommendedAction: 'Keep sync enabled. If the same error keeps returning, press Repair.'
82
82
  };
83
83
  }
84
84
  if (pendingChanges > 0 || (durableOutbox?.pending || 0) > 0 || (durableOutbox?.inFlight || 0) > 0) {
@@ -104,14 +104,14 @@ export function resolveWorkspaceSyncPresentation({ enabled, phase, busy, retryAt
104
104
  summary: lastPushMs === null
105
105
  ? 'This device has not completed its first cloud pull.'
106
106
  : 'Cloud uploads are working, but this device has not completed a cloud pull.',
107
- recommendedAction: 'Press Retry now. If the cloud check still does not complete, press Repair and copy the report.'
107
+ recommendedAction: 'Keep sync enabled. If the cloud check still does not complete, press Repair and copy the report.'
108
108
  };
109
109
  }
110
110
  if (lastErrorMs !== null && lastErrorMs > lastPullMs) {
111
111
  return {
112
112
  status: 'attention',
113
113
  summary: 'A sync issue occurred after the last successful cloud pull.',
114
- recommendedAction: 'Press Retry now to verify cloud changes can still be received. If the issue returns, copy the report.'
114
+ recommendedAction: 'Wait for the automatic retry. If the issue returns, copy the report.'
115
115
  };
116
116
  }
117
117
  const pullIsStale = Number.isFinite(nowMs)
@@ -122,7 +122,7 @@ export function resolveWorkspaceSyncPresentation({ enabled, phase, busy, retryAt
122
122
  summary: lastPushMs !== null && lastPushMs > lastPullMs
123
123
  ? 'Cloud uploads are succeeding, but this device has not received cloud changes recently.'
124
124
  : 'This device has not checked for cloud changes recently.',
125
- recommendedAction: 'Press Retry now to check cloud changes. If Last cloud check does not advance, press Repair and copy the report.'
125
+ recommendedAction: 'Keep sync enabled. If Last cloud check does not advance, press Repair and copy the report.'
126
126
  };
127
127
  }
128
128
  return {
@@ -1,4 +1,5 @@
1
1
  import type { WorkspaceSyncChange, WorkspaceSyncDurableTaskRevision, WorkspaceSyncTaskSnapshot } from '../workspaceSyncModel.js';
2
+ import type { WorkspaceSyncV2ProjectionExclusion } from '../v3/workspaceSyncV2ProjectionExclusions.js';
2
3
  export declare const WORKSPACE_SYNC_ENGINE_V2_PUSH_BOUNDARY_VERSION: 1;
3
4
  /**
4
5
  * Stable attempt-wide boundary shared by every V2 push batch. Individual
@@ -18,3 +19,16 @@ export interface WorkspaceSyncEngineAppliedTaskUpsert {
18
19
  }
19
20
  export declare function workspaceSyncEngineExpectedTaskEchoIds(changes: readonly WorkspaceSyncChange[]): string[];
20
21
  export declare function parseWorkspaceSyncEngineAppliedTaskUpserts(value: unknown, expectedTaskIds: readonly string[]): WorkspaceSyncEngineAppliedTaskUpsert[];
22
+ export declare function createWorkspaceSyncEngineV2SettlementIdentityProjection(input: {
23
+ operationIdentity: string;
24
+ changes: readonly WorkspaceSyncChange[];
25
+ appliedTaskUpserts: readonly WorkspaceSyncEngineAppliedTaskUpsert[];
26
+ excludedProjections?: readonly WorkspaceSyncV2ProjectionExclusion[];
27
+ }): {
28
+ version: 1;
29
+ operationIdentity: string;
30
+ taskUpserts: Array<{
31
+ archived: boolean;
32
+ task: Record<string, unknown>;
33
+ }>;
34
+ };
@@ -1,3 +1,4 @@
1
+ import { canonicalWorkspaceSyncJson } from '../v3/canonicalWorkspaceSyncJson.js';
1
2
  export const WORKSPACE_SYNC_ENGINE_V2_PUSH_BOUNDARY_VERSION = 1;
2
3
  export function createWorkspaceSyncEngineV2PushBoundary(batchOperationIdentities) {
3
4
  if (!Array.isArray(batchOperationIdentities)
@@ -85,3 +86,86 @@ export function parseWorkspaceSyncEngineAppliedTaskUpserts(value, expectedTaskId
85
86
  }
86
87
  return normalized;
87
88
  }
89
+ function taskSettlementProjection(task, preserveReferenceNumber) {
90
+ const { updatedAt: _updatedAt, ...stableTask } = structuredClone(task);
91
+ if (!preserveReferenceNumber)
92
+ delete stableTask.referenceNumber;
93
+ return stableTask;
94
+ }
95
+ function taskSettlementOwnedProjection(input) {
96
+ // The cloud echo is authoritative for the complete task row, but this V2
97
+ // page may own only carrier fields. Validate exactly that remaining V2
98
+ // surface; V3-owned fields are checked by their own acknowledgement/feed.
99
+ const task = taskSettlementProjection(input.task, input.preserveReferenceNumber);
100
+ const rootOwnedByV3 = input.excludedProjections.has('task/root-v1');
101
+ const commentsOwnedByV3 = input.excludedProjections.has('task-comments/full-v1');
102
+ const checklistOwnedByV3 = input.excludedProjections.has('task-checklist/full-v1');
103
+ const attachmentLinksV1OwnedByV3 = input.excludedProjections
104
+ .has('task-attachment-links/full-v1');
105
+ const attachmentLinksV2OwnedByV3 = input.excludedProjections
106
+ .has('task-attachment-links/full-v2');
107
+ if (rootOwnedByV3) {
108
+ for (const key of Object.keys(task)) {
109
+ if (![
110
+ 'id',
111
+ 'comments',
112
+ 'checklistItems',
113
+ 'attachments',
114
+ 'cardCoverAssetId',
115
+ ].includes(key)) {
116
+ delete task[key];
117
+ }
118
+ }
119
+ }
120
+ if (commentsOwnedByV3)
121
+ delete task.comments;
122
+ if (checklistOwnedByV3)
123
+ delete task.checklistItems;
124
+ if (attachmentLinksV1OwnedByV3 || attachmentLinksV2OwnedByV3) {
125
+ delete task.attachments;
126
+ }
127
+ if (attachmentLinksV2OwnedByV3)
128
+ delete task.cardCoverAssetId;
129
+ return {
130
+ ...(rootOwnedByV3 ? {} : { archived: input.archived }),
131
+ task,
132
+ };
133
+ }
134
+ export function createWorkspaceSyncEngineV2SettlementIdentityProjection(input) {
135
+ const operationIdentity = String(input.operationIdentity || '').trim();
136
+ if (!operationIdentity || operationIdentity !== input.operationIdentity) {
137
+ throw new TypeError('The V2 push settlement operation identity is invalid.');
138
+ }
139
+ const expectedTaskUpserts = input.changes.filter((change) => change.op === 'upsert');
140
+ if (expectedTaskUpserts.length !== input.appliedTaskUpserts.length) {
141
+ throw new TypeError('The V2 push authoritative settlement projection is incomplete.');
142
+ }
143
+ const expectedProjection = expectedTaskUpserts.map((change) => ({
144
+ archived: change.archived,
145
+ task: taskSettlementProjection(change.task, change.task.referenceNumber !== undefined && change.task.referenceNumber !== null),
146
+ }));
147
+ const excludedProjections = new Set(input.excludedProjections || []);
148
+ const expectedOwnedProjection = expectedTaskUpserts.map((change) => (taskSettlementOwnedProjection({
149
+ archived: change.archived,
150
+ task: change.task,
151
+ preserveReferenceNumber: change.task.referenceNumber !== undefined
152
+ && change.task.referenceNumber !== null,
153
+ excludedProjections,
154
+ })));
155
+ const authoritativeOwnedProjection = input.appliedTaskUpserts.map((entry, index) => (taskSettlementOwnedProjection({
156
+ archived: entry.archived,
157
+ task: entry.task,
158
+ preserveReferenceNumber: expectedTaskUpserts[index]?.task.referenceNumber !== undefined
159
+ && expectedTaskUpserts[index]?.task.referenceNumber !== null,
160
+ excludedProjections,
161
+ })));
162
+ if (canonicalWorkspaceSyncJson(authoritativeOwnedProjection)
163
+ !== canonicalWorkspaceSyncJson(expectedOwnedProjection)) {
164
+ throw new TypeError('The V2 push authoritative settlement does not match the canonical request state.');
165
+ }
166
+ return {
167
+ version: 1,
168
+ operationIdentity,
169
+ taskUpserts: expectedProjection,
170
+ };
171
+ }
@@ -10,6 +10,7 @@ function resetWorkspaceSyncStatePushBaselines(runtime) {
10
10
  runtime.lastPushedInitiativeWatermarks.current = new Map();
11
11
  runtime.lastPushedWorkstreamIds.current = new Set();
12
12
  runtime.lastPushedWorkstreamWatermarks.current = new Map();
13
+ runtime.lastPushedPlanningIdentityWatermarks.current = new Map();
13
14
  runtime.lastPushedAiProfileIds.current = new Set();
14
15
  runtime.lastPushedAiProfileWatermarks.current = new Map();
15
16
  runtime.lastPushedAiProfileChangeKeys.current = new Map();
@@ -26,6 +26,7 @@ export interface WorkspaceSyncEngineRuntime {
26
26
  lastPushedInitiativeWatermarks: WorkspaceSyncMutableValue<Map<string, string>>;
27
27
  lastPushedWorkstreamIds: WorkspaceSyncMutableValue<Set<string>>;
28
28
  lastPushedWorkstreamWatermarks: WorkspaceSyncMutableValue<Map<string, string>>;
29
+ lastPushedPlanningIdentityWatermarks: WorkspaceSyncMutableValue<Map<string, string>>;
29
30
  lastPushedAiProfileIds: WorkspaceSyncMutableValue<Set<string>>;
30
31
  lastPushedAiProfileWatermarks: WorkspaceSyncMutableValue<Map<string, string>>;
31
32
  lastPushedAiProfileChangeKeys: WorkspaceSyncMutableValue<Map<string, string>>;
@@ -24,6 +24,7 @@ export function createWorkspaceSyncEngineRuntime() {
24
24
  lastPushedInitiativeWatermarks: mutable(new Map()),
25
25
  lastPushedWorkstreamIds: mutable(new Set()),
26
26
  lastPushedWorkstreamWatermarks: mutable(new Map()),
27
+ lastPushedPlanningIdentityWatermarks: mutable(new Map()),
27
28
  lastPushedAiProfileIds: mutable(new Set()),
28
29
  lastPushedAiProfileWatermarks: mutable(new Map()),
29
30
  lastPushedAiProfileChangeKeys: mutable(new Map()),
@@ -1,5 +1,5 @@
1
1
  import { createHash } from 'crypto';
2
- import { createLocalWorkspaceSyncPendingV2Push, decodeWorkspaceSyncPayload, fingerprintLocalWorkspaceSyncPreparedPlan, isLocalWorkspaceSyncPullFairnessDue, } from '../coordinator/localWorkspaceSyncRunnerState.js';
2
+ import { createLocalWorkspaceSyncPendingV2Push, decodeWorkspaceSyncPayload, fingerprintLocalWorkspaceSyncPreparedPlan, isLocalWorkspaceSyncPullFairnessDue, upgradeLocalWorkspaceSyncPendingV2PushSettlement, } from '../coordinator/localWorkspaceSyncRunnerState.js';
3
3
  import { isTransientWorkspaceSyncStatus, runWorkspacePullSyncService, runWorkspacePushSyncService, } from '../syncService.js';
4
4
  import { hydrateWorkspaceSyncV3AttachmentAsset } from '../v3/workspaceSyncV3AttachmentAssetHydration.js';
5
5
  import { runWorkspaceSyncV3CombinedProjectionCycle } from '../v3/workspaceSyncV3CombinedFeedOrchestrator.js';
@@ -527,6 +527,13 @@ export function createWorkspaceSyncEngineServerRunnerOperations(options) {
527
527
  forceAllAiProfiles: checkpoint.pendingV2Push.forceAllAiProfiles,
528
528
  repairMode: checkpoint.pendingV2Push.repairMode,
529
529
  };
530
+ if (checkpoint.pendingV2Push.preparedPlan
531
+ && checkpoint.pendingV2Push.settlementVersion !== 1) {
532
+ persist({
533
+ ...checkpoint,
534
+ pendingV2Push: upgradeLocalWorkspaceSyncPendingV2PushSettlement(checkpoint.pendingV2Push),
535
+ });
536
+ }
530
537
  }
531
538
  else {
532
539
  const forcedContentPaths = pushRetryKind === 'v2-content-push'
@@ -573,23 +580,26 @@ export function createWorkspaceSyncEngineServerRunnerOperations(options) {
573
580
  preparedPlan: checkpoint.pendingV2Push?.preparedPlan,
574
581
  acknowledgedNonApplyingBatchOperationIdentities: checkpoint.pendingV2Push
575
582
  ?.acknowledgedNonApplyingBatchOperationIdentities,
583
+ settledBatchOperationIdentities: checkpoint.pendingV2Push?.settledBatchOperationIdentities,
576
584
  onPreparedPlan: ({ plan, acknowledgedOperationIdentities, }) => {
577
585
  const pendingV2Push = checkpoint.pendingV2Push;
578
586
  if (!pendingV2Push) {
579
587
  throw new WorkspaceSyncEngineServerRunnerOperationError('The frozen V2 push disappeared while recording its prepared plan.', 'SYNC_RUNNER_PUSH_CHECKPOINT_INVALID');
580
588
  }
589
+ const preparedPendingV2Push = {
590
+ ...pendingV2Push,
591
+ preparedPlan: plan,
592
+ preparedPlanFingerprint: fingerprintLocalWorkspaceSyncPreparedPlan(plan),
593
+ acknowledgedNonApplyingBatchOperationIdentities: [
594
+ ...acknowledgedOperationIdentities,
595
+ ],
596
+ };
581
597
  persist({
582
598
  ...checkpoint,
583
- pendingV2Push: {
584
- ...pendingV2Push,
585
- preparedPlan: plan,
586
- preparedPlanFingerprint: fingerprintLocalWorkspaceSyncPreparedPlan(plan),
587
- acknowledgedNonApplyingBatchOperationIdentities: [
588
- ...acknowledgedOperationIdentities,
589
- ],
590
- },
599
+ pendingV2Push: upgradeLocalWorkspaceSyncPendingV2PushSettlement(preparedPendingV2Push),
591
600
  });
592
- persistedAcknowledgementCount = acknowledgedOperationIdentities.length;
601
+ persistedAcknowledgementCount =
602
+ acknowledgedOperationIdentities.length;
593
603
  },
594
604
  onNonApplyingBatchAcknowledged: ({ acknowledgedOperationIdentities }) => {
595
605
  const pendingV2Push = checkpoint.pendingV2Push;
@@ -609,8 +619,76 @@ export function createWorkspaceSyncEngineServerRunnerOperations(options) {
609
619
  - persistedAcknowledgementCount
610
620
  >= NON_APPLYING_ACKNOWLEDGEMENT_CHECKPOINT_INTERVAL) {
611
621
  persist(checkpoint);
612
- persistedAcknowledgementCount = acknowledgedOperationIdentities.length;
622
+ persistedAcknowledgementCount =
623
+ acknowledgedOperationIdentities.length;
624
+ }
625
+ },
626
+ onAcceptedBatchSettled: async ({ operationIdentity, settlementIdentityFingerprint, appliedTaskUpserts, transferReceipt, pushBoundary, excludedProjections, }) => {
627
+ const pendingV2Push = checkpoint.pendingV2Push;
628
+ if (!pendingV2Push
629
+ || pendingV2Push.settlementVersion !== 1
630
+ || !pendingV2Push.settledBatchOperationIdentities
631
+ || !pendingV2Push.settledBatchContributions) {
632
+ throw new WorkspaceSyncEngineServerRunnerOperationError('The frozen V2 push settlement checkpoint is unavailable.', 'SYNC_RUNNER_PUSH_CHECKPOINT_INVALID');
633
+ }
634
+ if (pendingV2Push.settledBatchOperationIdentities.includes(operationIdentity)) {
635
+ throw new WorkspaceSyncEngineServerRunnerOperationError('The accepted V2 push page was already settled locally.', 'SYNC_RUNNER_PUSH_CHECKPOINT_INVALID');
636
+ }
637
+ if (checkpoint.retry?.kind !== pushRetryKind) {
638
+ setRetry(pushRetryKind, 'Accepted V2 push page local settlement is pending.');
639
+ }
640
+ const completionGroup = options.remoteServices.buildV2PushApplyCompletionGroup({
641
+ workspaceId,
642
+ pushBoundary,
643
+ receipts: [transferReceipt],
644
+ });
645
+ if (!completionGroup) {
646
+ throw new WorkspaceSyncEngineServerRunnerOperationError('Accepted V2 push page is missing an atomic local apply completion group.', 'SYNC_RUNNER_PUSH_APPLY_COMPLETION_INVALID');
647
+ }
648
+ const nextCheckpoint = {
649
+ ...checkpoint,
650
+ pendingV2Push: {
651
+ ...checkpoint.pendingV2Push,
652
+ settledBatchOperationIdentities: [
653
+ ...checkpoint.pendingV2Push
654
+ .settledBatchOperationIdentities,
655
+ operationIdentity,
656
+ ],
657
+ settledBatchContributions: [
658
+ ...checkpoint.pendingV2Push
659
+ .settledBatchContributions,
660
+ {
661
+ operationIdentity,
662
+ settlementIdentityFingerprint,
663
+ appliedTaskUpserts: structuredClone(appliedTaskUpserts),
664
+ },
665
+ ],
666
+ },
667
+ };
668
+ const commitState = {};
669
+ const applyResult = await localServices.applyV2Batch(workspaceId, appliedTaskUpserts.map((entry) => ({
670
+ op: 'upsert',
671
+ archived: entry.archived === true,
672
+ task: entry.task,
673
+ ...(entry.durableRevision
674
+ ? { durableRevision: entry.durableRevision }
675
+ : {}),
676
+ })), {
677
+ repairMode: attemptOptions.repairMode,
678
+ excludedProjections,
679
+ completionGroup,
680
+ commitServerCheckpoint: () => {
681
+ const persisted = input.persistCheckpoint(nextCheckpoint);
682
+ commitState.checkpoint = structuredClone(persisted.checkpoint);
683
+ return commitState.checkpoint;
684
+ },
685
+ });
686
+ if (!applyResult.ok || !commitState.checkpoint) {
687
+ throw new WorkspaceSyncEngineServerRunnerOperationError(!applyResult.ok
688
+ ? authoritativeV2ApplyFailureMessage(applyResult)
689
+ : 'Accepted V2 push page did not commit its settlement checkpoint.', 'SYNC_RUNNER_PUSH_AUTHORITATIVE_APPLY_FAILED');
613
690
  }
691
+ checkpoint = structuredClone(commitState.checkpoint);
614
692
  },
615
693
  });
616
694
  onResult?.(result);
@@ -630,7 +708,19 @@ export function createWorkspaceSyncEngineServerRunnerOperations(options) {
630
708
  }
631
709
  fail(pushRetryKind, message, 'SYNC_RUNNER_PUSH_FAILED', result.retryAfterMs);
632
710
  }
633
- for (const entry of result.appliedTaskUpserts || []) {
711
+ const serviceTaskUpserts = result.appliedTaskUpserts || [];
712
+ const pushTransferReceipts = result.pushTransferReceipts || [];
713
+ const settledTaskUpserts = checkpoint.pendingV2Push
714
+ ?.settledBatchContributions
715
+ ?.flatMap((entry) => entry.appliedTaskUpserts) || [];
716
+ const terminalTaskUpserts = pushTransferReceipts.length > 0
717
+ ? serviceTaskUpserts
718
+ : [];
719
+ result.appliedTaskUpserts = [
720
+ ...settledTaskUpserts,
721
+ ...terminalTaskUpserts,
722
+ ];
723
+ for (const entry of result.appliedTaskUpserts) {
634
724
  const taskId = String(entry.task.id || '').trim();
635
725
  const watermark = String(entry.task.updatedAt || entry.task.createdAt || '').trim();
636
726
  if (!taskId || !watermark)
@@ -645,14 +735,6 @@ export function createWorkspaceSyncEngineServerRunnerOperations(options) {
645
735
  result,
646
736
  });
647
737
  const syncedAt = result.syncedAt || input.now;
648
- const appliedTaskUpserts = result.appliedTaskUpserts || [];
649
- const pushTransferReceipts = result.pushTransferReceipts || [];
650
- if (appliedTaskUpserts.length > 0) {
651
- // Persist the retry obligation before entering the atomic local
652
- // apply. If that transaction rolls back after its checkpoint
653
- // callback, the runner resumes from this durable revision.
654
- setRetry(pushRetryKind, 'Authoritative V2 push echo local commit is pending.');
655
- }
656
738
  const baseNextCheckpoint = {
657
739
  ...checkpoint,
658
740
  controlState: 'pushing',
@@ -666,10 +748,8 @@ export function createWorkspaceSyncEngineServerRunnerOperations(options) {
666
748
  const nextCheckpoint = transformTerminalCheckpoint
667
749
  ? transformTerminalCheckpoint(baseNextCheckpoint, result, signature)
668
750
  : baseNextCheckpoint;
669
- if (appliedTaskUpserts.length > 0) {
670
- const abandonPushReceipts = async (errorCode) => {
671
- if (pushTransferReceipts.length === 0)
672
- return;
751
+ if (terminalTaskUpserts.length > 0) {
752
+ const abandonTerminalReceipts = async (errorCode = 'WORKSPACE_SYNC_V2_PUSH_AUTHORITATIVE_APPLY_FAILED') => {
673
753
  try {
674
754
  await options.remoteServices.abandonTransferReceipts({
675
755
  workspaceId,
@@ -679,10 +759,9 @@ export function createWorkspaceSyncEngineServerRunnerOperations(options) {
679
759
  }
680
760
  catch {
681
761
  // The durable retry checkpoint remains authoritative.
682
- // The next exact replay will recover the retained or
683
- // ambiguous permit through the gateway.
684
762
  }
685
763
  };
764
+ setRetry(pushRetryKind, 'Authoritative V2 push echo local commit is pending.');
686
765
  const completionGroup = result.pushBoundary
687
766
  ? options.remoteServices.buildV2PushApplyCompletionGroup({
688
767
  workspaceId,
@@ -691,13 +770,13 @@ export function createWorkspaceSyncEngineServerRunnerOperations(options) {
691
770
  })
692
771
  : undefined;
693
772
  if (!completionGroup) {
694
- await abandonPushReceipts('WORKSPACE_SYNC_V2_PUSH_APPLY_COMPLETION_INVALID');
773
+ await abandonTerminalReceipts('WORKSPACE_SYNC_V2_PUSH_APPLY_COMPLETION_INVALID');
695
774
  throw new WorkspaceSyncEngineServerRunnerOperationError('Accepted V2 push echoes are missing an atomic local apply completion group.', 'SYNC_RUNNER_PUSH_APPLY_COMPLETION_INVALID');
696
775
  }
697
776
  const commitState = {};
698
777
  let applyResult;
699
778
  try {
700
- applyResult = await localServices.applyV2Batch(workspaceId, appliedTaskUpserts.map((entry) => ({
779
+ applyResult = await localServices.applyV2Batch(workspaceId, terminalTaskUpserts.map((entry) => ({
701
780
  op: 'upsert',
702
781
  archived: entry.archived === true,
703
782
  task: entry.task,
@@ -707,34 +786,29 @@ export function createWorkspaceSyncEngineServerRunnerOperations(options) {
707
786
  })), {
708
787
  repairMode: attemptOptions.repairMode,
709
788
  excludedProjections: result.effectiveV2ExcludedProjections,
710
- ...(completionGroup ? { completionGroup } : {}),
789
+ completionGroup,
711
790
  commitServerCheckpoint: () => {
712
791
  const persisted = input.persistCheckpoint(nextCheckpoint, {
713
792
  beforeCommit: beforeTerminalPersist
714
793
  ? () => beforeTerminalPersist(result)
715
794
  : undefined,
716
795
  });
717
- commitState.checkpoint =
718
- structuredClone(persisted.checkpoint);
796
+ commitState.checkpoint = structuredClone(persisted.checkpoint);
719
797
  return commitState.checkpoint;
720
798
  },
721
799
  });
722
800
  }
723
801
  catch (error) {
724
- await abandonPushReceipts('WORKSPACE_SYNC_V2_PUSH_AUTHORITATIVE_APPLY_FAILED');
802
+ await abandonTerminalReceipts();
725
803
  throw new WorkspaceSyncEngineServerRunnerOperationError(errorMessage(error, 'Authoritative V2 push echo apply failed.'), 'SYNC_RUNNER_PUSH_AUTHORITATIVE_APPLY_FAILED');
726
804
  }
727
805
  if (!applyResult.ok || !commitState.checkpoint) {
728
- await abandonPushReceipts('WORKSPACE_SYNC_V2_PUSH_AUTHORITATIVE_APPLY_FAILED');
806
+ await abandonTerminalReceipts();
729
807
  throw new WorkspaceSyncEngineServerRunnerOperationError(!applyResult.ok
730
808
  ? authoritativeV2ApplyFailureMessage(applyResult)
731
809
  : 'Authoritative V2 push echo did not commit the server checkpoint.', 'SYNC_RUNNER_PUSH_AUTHORITATIVE_APPLY_FAILED');
732
810
  }
733
- const committedCheckpoint = commitState.checkpoint;
734
- if (!committedCheckpoint) {
735
- throw new WorkspaceSyncEngineServerRunnerOperationError('The authoritative V2 push echo apply did not commit its runner checkpoint.', 'SYNC_RUNNER_PUSH_CHECKPOINT_NOT_COMMITTED');
736
- }
737
- checkpoint = structuredClone(committedCheckpoint);
811
+ checkpoint = structuredClone(commitState.checkpoint);
738
812
  }
739
813
  else {
740
814
  persist(nextCheckpoint, {
@@ -28,6 +28,7 @@ export function toWorkspaceSyncV2PushBaseline(snapshot, currentTaxonomyStateFing
28
28
  lastPushedInitiativeWatermarks: new Map(),
29
29
  lastPushedWorkstreamIds: new Set(),
30
30
  lastPushedWorkstreamWatermarks: new Map(),
31
+ lastPushedPlanningIdentityWatermarks: new Map(),
31
32
  lastPushedAiProfileIds: new Set(),
32
33
  lastPushedAiProfileWatermarks: new Map(),
33
34
  lastPushedAiProfileChangeKeys: new Map(),
@@ -57,6 +58,7 @@ export function toWorkspaceSyncV2PushBaseline(snapshot, currentTaxonomyStateFing
57
58
  || snapshot.taxonomyStateFingerprint === currentTaxonomyStateFingerprint;
58
59
  const initiativeWatermarks = stringMap(snapshot.initiativeWatermarks);
59
60
  const workstreamWatermarks = stringMap(snapshot.workstreamWatermarks);
61
+ const planningIdentityWatermarks = stringMap(snapshot.planningIdentityWatermarks);
60
62
  const aiProfileWatermarks = stringMap(snapshot.aiProfileWatermarks);
61
63
  const documentWatermarks = stringMap(snapshot.documentWatermarks);
62
64
  const assetWatermarks = stringMap(snapshot.assetWatermarks);
@@ -76,6 +78,7 @@ export function toWorkspaceSyncV2PushBaseline(snapshot, currentTaxonomyStateFing
76
78
  lastPushedInitiativeWatermarks: initiativeWatermarks,
77
79
  lastPushedWorkstreamIds: new Set(workstreamWatermarks.keys()),
78
80
  lastPushedWorkstreamWatermarks: workstreamWatermarks,
81
+ lastPushedPlanningIdentityWatermarks: planningIdentityWatermarks,
79
82
  lastPushedAiProfileIds: new Set(aiProfileWatermarks.keys()),
80
83
  lastPushedAiProfileWatermarks: aiProfileWatermarks,
81
84
  lastPushedAiProfileChangeKeys: stringMap(snapshot.aiProfileChangeKeys),
@@ -146,6 +149,9 @@ export function createWorkspaceSyncEngineServerPushCandidateProvider(snapshotRea
146
149
  taskRelationshipChangeKeys: sortedEntries(taskRelationshipChangeKeys),
147
150
  initiativeWatermarks: sortedEntries(result.currentInitiativeWatermarks),
148
151
  workstreamWatermarks: sortedEntries(result.currentWorkstreamWatermarks),
152
+ planningIdentityWatermarks: sortedEntries(result.currentPlanningIdentityWatermarks
153
+ || payload.currentPlanningIdentityWatermarks
154
+ || stringMap(previousBaseline?.planningIdentityWatermarks)),
149
155
  aiProfileWatermarks: sortedEntries(result.currentAiProfileWatermarks),
150
156
  aiProfileChangeKeys: sortedEntries(aiProfileChangeKeys),
151
157
  taskforceAgentWatermarks: sortedEntries(result.currentTaskforceAgentWatermarks),
@@ -173,7 +173,7 @@ export function createWorkspaceSyncV3TransferBindings(input) {
173
173
  };
174
174
  }
175
175
  export function createWorkspaceTransferCoordinator({ cloudAuthConfigured, runtimeMode, initiativeFeedActivationEnabled, combinedFeedActivationEnabled, combinedFeedCoverage, workspaceCloudSyncEnabled, currentWorkspaceId, workspaceSyncPhase, isAuthenticated, checkAuthSession, resolveCloudAuthUrl, ensureCloudWorkspaceReadyForSync, ensureWorkspaceSyncReady, handleSyncAuthFailure, clearWorkspaceRetry, clearWorkspaceIssue, isWorkspaceRetryPending, isDurableRecoveryBlockingOrdinaryPush, isExecutionAuthorized = () => true, scheduleWorkspaceSyncRetry, persistWorkspaceSyncPatchSafely, persistWorkspaceSyncPatchBestEffort, persistWorkspaceSyncWatermarksSnapshotBestEffort, refreshWorkspaceAiProfilePushBaselineFromPersistence, reportSyncEvent, acquireWorkspaceSyncLease, releaseWorkspaceSyncLease, recordWorkspaceSyncCompletion, reportWorkspaceWindowContention, refreshWorkspaceSyncMarkdownDocumentsSnapshot, refreshWorkspaceSyncAiProfilesSnapshot, refreshWorkspaceSyncAssetsSnapshot, refreshWorkspaceSyncTaxonomySnapshot, refreshWorkspaceSyncPlanningEntitiesSnapshot, refreshWorkspaceSyncDocumentReviewSessionsSnapshot, refreshWorkspaceSyncAnnotatedAttachmentSessionsSnapshot, refreshWorkspaceSyncTaskforceAgentsSnapshot, refreshLocalWorkspaceTaskCollections, buildWorkspaceSyncPayload, buildWorkspaceSyncSignature, seedWorkspaceSnapshotPushBaseline, shouldSuppressAttachBootstrapPush, recordSuppressedEventIds, runtime, localServices, remoteServices, setWorkspaceSyncBusy, setUserGlobalSyncStatus, setUserGlobalSyncError, setWorkspaceLastErrorMessage, setWorkspaceLastErrorAt, setWorkspaceLastPullAt, setWorkspaceLastPushAt, setWorkspaceSyncPendingChanges, setTasks, setArchivedTasks, now, scheduleTask, logDebug = () => undefined, notifyAiProfilesMutated = () => undefined, notifyAgentsMutated = () => undefined, notifyAgentSkillsMutated = () => undefined }) {
176
- const { repairMode: workspaceRepairModeRef, forceFullAiProfilePush: workspaceForceFullAiProfilePushRef, pushInFlight: workspacePushInFlightRef, pullInFlight: workspacePullInFlightRef, pullAfterPushRequested: workspacePullAfterPushRequestedRef, pendingPushReplay: workspacePendingPushReplayRef, blockedPushSignature: workspaceBlockedPushSignatureRef, lastPushedSignature: workspaceLastPushedSignatureRef, pendingSignature: workspacePendingSignatureRef, lastPushedTaskIds: workspaceLastPushedTaskIdsRef, deletedTaskIds: workspaceDeletedTaskIdsRef, deletedTaskWatermarks: workspaceDeletedTaskWatermarksRef, pullCursor: workspacePullCursorRef, lastPushedWatermarks: workspaceLastPushedWatermarksRef, lastPushedTaskChangeKeys: workspaceLastPushedTaskChangeKeysRef, lastPushedTaskRelationshipChangeKeys: workspaceLastPushedTaskRelationshipChangeKeysRef, lastPushedTaxonomyChangeKey: workspaceLastPushedTaxonomyChangeKeyRef, lastPushedInitiativeIds: workspaceLastPushedInitiativeIdsRef, lastPushedInitiativeWatermarks: workspaceLastPushedInitiativeWatermarksRef, lastPushedWorkstreamIds: workspaceLastPushedWorkstreamIdsRef, lastPushedWorkstreamWatermarks: workspaceLastPushedWorkstreamWatermarksRef, lastPushedAiProfileIds: workspaceLastPushedAiProfileIdsRef, lastPushedAiProfileWatermarks: workspaceLastPushedAiProfileWatermarksRef, lastPushedAiProfileChangeKeys: workspaceLastPushedAiProfileChangeKeysRef, lastPushedDocumentPaths: workspaceLastPushedDocumentPathsRef, lastPushedDocumentWatermarks: workspaceLastPushedDocumentWatermarksRef, lastPushedAssetPaths: workspaceLastPushedAssetPathsRef, lastPushedAssetWatermarks: workspaceLastPushedAssetWatermarksRef, lastPushedDocumentReviewSessionIds: workspaceLastPushedDocumentReviewSessionIdsRef, lastPushedDocumentReviewSessionWatermarks: workspaceLastPushedDocumentReviewSessionWatermarksRef, lastPushedDocumentReviewCommentIds: workspaceLastPushedDocumentReviewCommentIdsRef, lastPushedDocumentReviewCommentWatermarks: workspaceLastPushedDocumentReviewCommentWatermarksRef, lastPushedAnnotatedAttachmentSessionIds: workspaceLastPushedAnnotatedAttachmentSessionIdsRef, lastPushedAnnotatedAttachmentSessionWatermarks: workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef, lastPushedTaskforceAgentIds: workspaceLastPushedTaskforceAgentIdsRef, lastPushedTaskforceAgentWatermarks: workspaceLastPushedTaskforceAgentWatermarksRef, lastPushedTaskforceAgentSkillIds: workspaceLastPushedTaskforceAgentSkillIdsRef, lastPushedTaskforceAgentSkillWatermarks: workspaceLastPushedTaskforceAgentSkillWatermarksRef, lastPushedAgentConversationIds: workspaceLastPushedAgentConversationIdsRef, lastPushedAgentConversationWatermarks: workspaceLastPushedAgentConversationWatermarksRef, lastPushedTaskEventWatermarks: workspaceLastPushedTaskEventWatermarksRef, baselineResetReason: workspaceBaselineResetReasonRef, captureAttachBootstrapBaseline: workspaceCaptureAttachBootstrapBaselineRef, startupFullReconcileRan: workspaceStartupFullReconcileRanRef, startupFullReconcileRequested: workspaceStartupFullReconcileRequestedRef, fullReconcileInFlight: workspaceFullReconcileInFlightRef, bootstrapLastProgressAtMs: bootstrapLastProgressAtRef, realtimeSuppressedEventQueue: realtimeSuppressedEventQueueRef, } = runtime;
176
+ const { repairMode: workspaceRepairModeRef, forceFullAiProfilePush: workspaceForceFullAiProfilePushRef, pushInFlight: workspacePushInFlightRef, pullInFlight: workspacePullInFlightRef, pullAfterPushRequested: workspacePullAfterPushRequestedRef, pendingPushReplay: workspacePendingPushReplayRef, blockedPushSignature: workspaceBlockedPushSignatureRef, lastPushedSignature: workspaceLastPushedSignatureRef, pendingSignature: workspacePendingSignatureRef, lastPushedTaskIds: workspaceLastPushedTaskIdsRef, deletedTaskIds: workspaceDeletedTaskIdsRef, deletedTaskWatermarks: workspaceDeletedTaskWatermarksRef, pullCursor: workspacePullCursorRef, lastPushedWatermarks: workspaceLastPushedWatermarksRef, lastPushedTaskChangeKeys: workspaceLastPushedTaskChangeKeysRef, lastPushedTaskRelationshipChangeKeys: workspaceLastPushedTaskRelationshipChangeKeysRef, lastPushedTaxonomyChangeKey: workspaceLastPushedTaxonomyChangeKeyRef, lastPushedInitiativeIds: workspaceLastPushedInitiativeIdsRef, lastPushedInitiativeWatermarks: workspaceLastPushedInitiativeWatermarksRef, lastPushedWorkstreamIds: workspaceLastPushedWorkstreamIdsRef, lastPushedWorkstreamWatermarks: workspaceLastPushedWorkstreamWatermarksRef, lastPushedPlanningIdentityWatermarks: workspaceLastPushedPlanningIdentityWatermarksRef, lastPushedAiProfileIds: workspaceLastPushedAiProfileIdsRef, lastPushedAiProfileWatermarks: workspaceLastPushedAiProfileWatermarksRef, lastPushedAiProfileChangeKeys: workspaceLastPushedAiProfileChangeKeysRef, lastPushedDocumentPaths: workspaceLastPushedDocumentPathsRef, lastPushedDocumentWatermarks: workspaceLastPushedDocumentWatermarksRef, lastPushedAssetPaths: workspaceLastPushedAssetPathsRef, lastPushedAssetWatermarks: workspaceLastPushedAssetWatermarksRef, lastPushedDocumentReviewSessionIds: workspaceLastPushedDocumentReviewSessionIdsRef, lastPushedDocumentReviewSessionWatermarks: workspaceLastPushedDocumentReviewSessionWatermarksRef, lastPushedDocumentReviewCommentIds: workspaceLastPushedDocumentReviewCommentIdsRef, lastPushedDocumentReviewCommentWatermarks: workspaceLastPushedDocumentReviewCommentWatermarksRef, lastPushedAnnotatedAttachmentSessionIds: workspaceLastPushedAnnotatedAttachmentSessionIdsRef, lastPushedAnnotatedAttachmentSessionWatermarks: workspaceLastPushedAnnotatedAttachmentSessionWatermarksRef, lastPushedTaskforceAgentIds: workspaceLastPushedTaskforceAgentIdsRef, lastPushedTaskforceAgentWatermarks: workspaceLastPushedTaskforceAgentWatermarksRef, lastPushedTaskforceAgentSkillIds: workspaceLastPushedTaskforceAgentSkillIdsRef, lastPushedTaskforceAgentSkillWatermarks: workspaceLastPushedTaskforceAgentSkillWatermarksRef, lastPushedAgentConversationIds: workspaceLastPushedAgentConversationIdsRef, lastPushedAgentConversationWatermarks: workspaceLastPushedAgentConversationWatermarksRef, lastPushedTaskEventWatermarks: workspaceLastPushedTaskEventWatermarksRef, baselineResetReason: workspaceBaselineResetReasonRef, captureAttachBootstrapBaseline: workspaceCaptureAttachBootstrapBaselineRef, startupFullReconcileRan: workspaceStartupFullReconcileRanRef, startupFullReconcileRequested: workspaceStartupFullReconcileRequestedRef, fullReconcileInFlight: workspaceFullReconcileInFlightRef, bootstrapLastProgressAtMs: bootstrapLastProgressAtRef, realtimeSuppressedEventQueue: realtimeSuppressedEventQueueRef, } = runtime;
177
177
  const scheduledTasks = new Map();
178
178
  let disposed = false;
179
179
  const scheduleCoordinatorTask = (key, callback, delayMs) => {
@@ -467,6 +467,8 @@ export function createWorkspaceTransferCoordinator({ cloudAuthConfigured, runtim
467
467
  workspaceLastPushedInitiativeWatermarksRef.current = new Map(pushResult.currentInitiativeWatermarks);
468
468
  workspaceLastPushedWorkstreamIdsRef.current = new Set(pushResult.currentWorkstreamIds);
469
469
  workspaceLastPushedWorkstreamWatermarksRef.current = new Map(pushResult.currentWorkstreamWatermarks);
470
+ workspaceLastPushedPlanningIdentityWatermarksRef.current = new Map(pushResult.currentPlanningIdentityWatermarks
471
+ || payload.currentPlanningIdentityWatermarks);
470
472
  workspaceLastPushedAiProfileIdsRef.current = new Set(pushResult.currentAiProfileIds);
471
473
  workspaceLastPushedAiProfileWatermarksRef.current = new Map(pushResult.currentAiProfileWatermarks);
472
474
  workspaceLastPushedAiProfileChangeKeysRef.current = pushResult.currentAiProfileChangeKeys
@@ -12,6 +12,7 @@ type SyncCore = TaskforceCore & TaskforceSyncCapable;
12
12
  type ContentSyncState = ReturnType<typeof createContentSyncState>;
13
13
  export interface WorkspaceSyncV2DispatchOptions {
14
14
  allowReferenceNumberReassignment?: boolean;
15
+ actorUserId?: string;
15
16
  workspaceMembers?: WorkspaceSyncWorkspaceMemberSnapshot[];
16
17
  coexistenceDirection?: TaskMetadataCoexistenceDirection;
17
18
  assertedActiveV3TaskMetadataIds?: ReadonlySet<string>;