@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
@@ -46,6 +46,10 @@ export interface WorkspaceSyncV3OperatorDiagnosticsSnapshot {
46
46
  materializationsInWindow: number;
47
47
  materializedEntriesInWindow: number;
48
48
  unexpiredMaterializations: number;
49
+ storedMaterializations: number;
50
+ storedEntries: number;
51
+ expiredMaterializations: number;
52
+ expiredEntries: number;
49
53
  };
50
54
  outbox: {
51
55
  captureConfigured: boolean;
@@ -74,6 +78,7 @@ export interface WorkspaceSyncV3OperatorDiagnosticsSnapshot {
74
78
  };
75
79
  server5xx: number;
76
80
  nonTest409: number;
81
+ cursorExpiredResets: number;
77
82
  requestP95Ms: number | null;
78
83
  maxObservedResponseBytes: number | null;
79
84
  };
@@ -116,7 +116,13 @@ export function buildWorkspaceSyncV3OperatorDiagnostics(input) {
116
116
  `).all(tenantId, workspaceId, since, eventLimit + 1);
117
117
  const truncated = eventRows.length > eventLimit;
118
118
  const events = eventRows.slice(0, eventLimit);
119
- const transfer = { pull: { success: 0, error: 0 }, apply: { success: 0, error: 0 }, server5xx: 0, nonTest409: 0 };
119
+ const transfer = {
120
+ pull: { success: 0, error: 0 },
121
+ apply: { success: 0, error: 0 },
122
+ server5xx: 0,
123
+ nonTest409: 0,
124
+ cursorExpiredResets: 0,
125
+ };
120
126
  const requestTimes = [];
121
127
  const observedResponseBytes = [];
122
128
  for (const row of events) {
@@ -131,7 +137,10 @@ export function buildWorkspaceSyncV3OperatorDiagnostics(input) {
131
137
  const requestMs = Number(row.request_ms);
132
138
  if (Number.isFinite(requestMs) && requestMs >= 0)
133
139
  requestTimes.push(requestMs);
134
- const bytes = responseBytes(parseDetails(row.details_json));
140
+ const details = parseDetails(row.details_json);
141
+ if (JSON.stringify(details).includes('CURSOR_EXPIRED'))
142
+ transfer.cursorExpiredResets += 1;
143
+ const bytes = responseBytes(details);
135
144
  if (bytes !== null)
136
145
  observedResponseBytes.push(bytes);
137
146
  }
@@ -143,6 +152,27 @@ export function buildWorkspaceSyncV3OperatorDiagnostics(input) {
143
152
  AND coverage_profile_id = ? AND coverage_version = ? AND coverage_digest = ?
144
153
  AND created_at >= ?
145
154
  `).get(nowIso, tenantId, workspaceId, projection.coverageProfileId, projection.coverageVersion, projection.coverageDigest, since);
155
+ const storedRepairMaterialization = input.db.prepare(`
156
+ SELECT
157
+ COUNT(*) AS count,
158
+ COALESCE(SUM(CASE WHEN expires_at < ? THEN 1 ELSE 0 END), 0) AS expired,
159
+ (SELECT COUNT(*)
160
+ FROM workspace_sync_repair_snapshot_entries entry
161
+ WHERE entry.tenant_id = ? AND entry.workspace_id = ?) AS entries,
162
+ (SELECT COUNT(*)
163
+ FROM workspace_sync_repair_snapshot_entries entry
164
+ WHERE entry.tenant_id = ? AND entry.workspace_id = ?
165
+ AND EXISTS (
166
+ SELECT 1
167
+ FROM workspace_sync_repair_snapshots snapshot
168
+ WHERE snapshot.tenant_id = entry.tenant_id
169
+ AND snapshot.workspace_id = entry.workspace_id
170
+ AND snapshot.snapshot_id = entry.snapshot_id
171
+ AND snapshot.expires_at < ?
172
+ )) AS expired_entries
173
+ FROM workspace_sync_repair_snapshots
174
+ WHERE tenant_id = ? AND workspace_id = ?
175
+ `).get(nowIso, tenantId, workspaceId, tenantId, workspaceId, nowIso, tenantId, workspaceId);
146
176
  const stagedEntry = projection.repair ? input.db.prepare(`
147
177
  SELECT COUNT(*) AS count
148
178
  FROM workspace_sync_coverage_repair_entries
@@ -346,6 +376,10 @@ export function buildWorkspaceSyncV3OperatorDiagnostics(input) {
346
376
  materializationsInWindow: integer(repairMaterialization?.count),
347
377
  materializedEntriesInWindow: integer(repairMaterialization?.entries),
348
378
  unexpiredMaterializations: integer(repairMaterialization?.unexpired),
379
+ storedMaterializations: integer(storedRepairMaterialization?.count),
380
+ storedEntries: integer(storedRepairMaterialization?.entries),
381
+ expiredMaterializations: integer(storedRepairMaterialization?.expired),
382
+ expiredEntries: integer(storedRepairMaterialization?.expired_entries),
349
383
  },
350
384
  outbox: {
351
385
  captureConfigured, dispatchConfigured, automaticSyncEnabled: automaticSync.enabled,
@@ -0,0 +1,17 @@
1
+ import type { DatabaseAdapter } from '../../storage/databaseAdapter.js';
2
+ export declare const DEFAULT_WORKSPACE_SYNC_REPAIR_SNAPSHOT_RETENTION_BATCH_SIZE = 500;
3
+ export interface WorkspaceSyncRepairSnapshotRetentionPolicy {
4
+ batchSize: number;
5
+ }
6
+ export interface WorkspaceSyncRepairSnapshotRetentionResult {
7
+ deletedEntries: number;
8
+ deletedSnapshots: number;
9
+ remainingExpiredSnapshots: number;
10
+ }
11
+ export declare function resolveWorkspaceSyncRepairSnapshotRetentionPolicy(env?: NodeJS.ProcessEnv): WorkspaceSyncRepairSnapshotRetentionPolicy;
12
+ export declare function pruneExpiredWorkspaceSyncRepairSnapshots(input: {
13
+ db: DatabaseAdapter;
14
+ tenantId: string;
15
+ now?: Date;
16
+ policy?: WorkspaceSyncRepairSnapshotRetentionPolicy;
17
+ }): WorkspaceSyncRepairSnapshotRetentionResult;
@@ -0,0 +1,64 @@
1
+ export const DEFAULT_WORKSPACE_SYNC_REPAIR_SNAPSHOT_RETENTION_BATCH_SIZE = 500;
2
+ function positiveInteger(value, fallback) {
3
+ const parsed = Number.parseInt(String(value ?? '').trim(), 10);
4
+ return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : fallback;
5
+ }
6
+ export function resolveWorkspaceSyncRepairSnapshotRetentionPolicy(env = process.env) {
7
+ return {
8
+ batchSize: Math.min(10_000, positiveInteger(env.TASKFORCE_SYNC_REPAIR_SNAPSHOT_RETENTION_BATCH_SIZE, DEFAULT_WORKSPACE_SYNC_REPAIR_SNAPSHOT_RETENTION_BATCH_SIZE)),
9
+ };
10
+ }
11
+ export function pruneExpiredWorkspaceSyncRepairSnapshots(input) {
12
+ const now = (input.now || new Date()).toISOString();
13
+ const policy = input.policy || resolveWorkspaceSyncRepairSnapshotRetentionPolicy();
14
+ return input.db.transaction(() => {
15
+ const snapshot = input.db.prepare(`
16
+ SELECT workspace_id, snapshot_id
17
+ FROM workspace_sync_repair_snapshots
18
+ WHERE tenant_id = ? AND expires_at < ?
19
+ ORDER BY expires_at ASC, workspace_id ASC, snapshot_id ASC
20
+ LIMIT 1
21
+ `).get(input.tenantId, now);
22
+ const workspaceId = String(snapshot?.workspace_id || '').trim();
23
+ const snapshotId = String(snapshot?.snapshot_id || '').trim();
24
+ let deletedEntries = 0;
25
+ let deletedSnapshots = 0;
26
+ if (workspaceId && snapshotId) {
27
+ const entries = input.db.prepare(`
28
+ SELECT entry_index
29
+ FROM workspace_sync_repair_snapshot_entries
30
+ WHERE tenant_id = ? AND workspace_id = ? AND snapshot_id = ?
31
+ ORDER BY entry_index ASC
32
+ LIMIT ?
33
+ `).all(input.tenantId, workspaceId, snapshotId, policy.batchSize);
34
+ if (entries.length > 0) {
35
+ const result = input.db.prepare(`
36
+ DELETE FROM workspace_sync_repair_snapshot_entries
37
+ WHERE tenant_id = ? AND workspace_id = ? AND snapshot_id = ?
38
+ AND entry_index IN (${entries.map(() => '?').join(', ')})
39
+ `).run(input.tenantId, workspaceId, snapshotId, ...entries.map((entry) => entry.entry_index));
40
+ deletedEntries = Number(result.changes || 0);
41
+ }
42
+ const snapshotResult = input.db.prepare(`
43
+ DELETE FROM workspace_sync_repair_snapshots
44
+ WHERE tenant_id = ? AND workspace_id = ? AND snapshot_id = ? AND expires_at < ?
45
+ AND NOT EXISTS (
46
+ SELECT 1
47
+ FROM workspace_sync_repair_snapshot_entries
48
+ WHERE tenant_id = ? AND workspace_id = ? AND snapshot_id = ?
49
+ )
50
+ `).run(input.tenantId, workspaceId, snapshotId, now, input.tenantId, workspaceId, snapshotId);
51
+ deletedSnapshots = Number(snapshotResult.changes || 0);
52
+ }
53
+ const remaining = input.db.prepare(`
54
+ SELECT COUNT(*) AS count
55
+ FROM workspace_sync_repair_snapshots
56
+ WHERE tenant_id = ? AND expires_at < ?
57
+ `).get(input.tenantId, now);
58
+ return {
59
+ deletedEntries,
60
+ deletedSnapshots,
61
+ remainingExpiredSnapshots: Number(remaining?.count || 0),
62
+ };
63
+ })();
64
+ }
@@ -14,4 +14,5 @@ export declare function prepareWorkspaceSyncV3WorkflowRuntimeApply(input: {
14
14
  store: WorkflowStore;
15
15
  workspaceId: string;
16
16
  entries: WorkspaceSyncV3FeedEntry[];
17
+ replaceAuthoritativeHistoryExecutionIds?: ReadonlySet<string>;
17
18
  }): WorkspaceSyncV3WorkflowRuntimeApplyPlan;
@@ -1,5 +1,5 @@
1
1
  import { canonicalWorkspaceSyncJson } from './canonicalWorkspaceSyncJson.js';
2
- import { validateWorkflowExecutionEventSyncPayload, validateWorkflowExecutionRootSyncPayload, validateWorkflowPublishedDefinitionSyncPayload, validateWorkflowRuntimeEventHistory, } from './workflowRuntimeSync.js';
2
+ import { serializeWorkflowPublishedDefinitionSyncPayload, validateWorkflowExecutionEventSyncPayload, validateWorkflowExecutionRootSyncPayload, validateWorkflowPublishedDefinitionSyncPayload, validateWorkflowRuntimeEventHistory, } from './workflowRuntimeSync.js';
3
3
  import { validateWorkspaceSyncV3WorkflowRuntimeFeedEntry } from './workspaceSyncV3WorkflowRuntimeProjection.js';
4
4
  const WORKFLOW_PROJECTIONS = new Set([
5
5
  'workflow-published-definition/full-v2',
@@ -9,6 +9,19 @@ const WORKFLOW_PROJECTIONS = new Set([
9
9
  function compareEvents(left, right) {
10
10
  return canonicalWorkspaceSyncJson(left) === canonicalWorkspaceSyncJson(right);
11
11
  }
12
+ function executionIdentity(root) {
13
+ const execution = root.execution;
14
+ return canonicalWorkspaceSyncJson({
15
+ id: execution.id,
16
+ tenantId: execution.tenantId,
17
+ workspaceId: execution.workspaceId,
18
+ taskId: execution.taskId,
19
+ workflowTemplateId: execution.workflowTemplateId,
20
+ workflowVersionId: execution.workflowVersionId,
21
+ createdByActorId: execution.createdByActorId || null,
22
+ createdAt: execution.createdAt,
23
+ });
24
+ }
12
25
  function mergeEventHistory(input) {
13
26
  const local = [...input.local].sort((left, right) => left.sequenceNumber - right.sequenceNumber);
14
27
  const incoming = [...input.incoming].sort((left, right) => left.sequenceNumber - right.sequenceNumber);
@@ -47,6 +60,19 @@ function derivedTemplate(definition, existing) {
47
60
  deletedAt: null,
48
61
  };
49
62
  }
63
+ function installedPublishedDefinition(store, workspaceId, versionId) {
64
+ const version = store.getVersion(workspaceId, versionId);
65
+ if (!version || version.status !== 'published')
66
+ return null;
67
+ const template = store.getTemplate(workspaceId, version.workflowTemplateId);
68
+ if (!template)
69
+ return null;
70
+ return serializeWorkflowPublishedDefinitionSyncPayload({
71
+ template,
72
+ version,
73
+ steps: store.listSteps(workspaceId, version.id),
74
+ });
75
+ }
50
76
  /**
51
77
  * Builds complete workflow aggregates before any revision is accepted. A root
52
78
  * entry is the atomic install trigger; definition and event entries only carry
@@ -56,6 +82,7 @@ export function prepareWorkspaceSyncV3WorkflowRuntimeApply(input) {
56
82
  const workflowEntries = new Set(input.entries.filter((entry) => WORKFLOW_PROJECTIONS.has(entry.projection)));
57
83
  const definitions = new Map();
58
84
  const roots = new Map();
85
+ const rootEntries = new Map();
59
86
  const eventsByExecution = new Map();
60
87
  for (const entry of workflowEntries) {
61
88
  validateWorkspaceSyncV3WorkflowRuntimeFeedEntry(entry);
@@ -68,10 +95,23 @@ export function prepareWorkspaceSyncV3WorkflowRuntimeApply(input) {
68
95
  }
69
96
  else if (entry.projection === 'workflow-execution/root-v1') {
70
97
  const root = validateWorkflowExecutionRootSyncPayload(entry.payload);
71
- if (roots.has(root.execution.id)) {
72
- throw new Error(`Workflow execution root is duplicated in one apply batch: ${root.execution.id}.`);
98
+ const existing = roots.get(root.execution.id);
99
+ const existingEntry = rootEntries.get(root.execution.id);
100
+ if (existing && existingEntry) {
101
+ if (executionIdentity(existing) !== executionIdentity(root)) {
102
+ throw new Error(`Workflow execution root identity changes in one apply batch: ${root.execution.id}.`);
103
+ }
104
+ const revision = BigInt(entry.entityRevision);
105
+ const existingRevision = BigInt(existingEntry.entityRevision);
106
+ if (revision === existingRevision
107
+ && canonicalWorkspaceSyncJson(existing) !== canonicalWorkspaceSyncJson(root)) {
108
+ throw new Error(`Workflow execution root revision conflicts in one apply batch: ${root.execution.id}.`);
109
+ }
110
+ if (revision <= existingRevision)
111
+ continue;
73
112
  }
74
113
  roots.set(root.execution.id, root);
114
+ rootEntries.set(root.execution.id, entry);
75
115
  }
76
116
  else {
77
117
  const event = validateWorkflowExecutionEventSyncPayload(entry.payload).event;
@@ -87,6 +127,7 @@ export function prepareWorkspaceSyncV3WorkflowRuntimeApply(input) {
87
127
  }
88
128
  const assignments = new Map();
89
129
  for (const [executionId, root] of roots) {
130
+ const replaceAuthoritativeHistory = Boolean(input.replaceAuthoritativeHistoryExecutionIds?.has(executionId));
90
131
  const local = input.store.getAssignmentForExecutionSync(input.workspaceId, executionId);
91
132
  const definition = definitions.get(root.execution.workflowVersionId)
92
133
  || (local ? {
@@ -97,12 +138,13 @@ export function prepareWorkspaceSyncV3WorkflowRuntimeApply(input) {
97
138
  },
98
139
  version: local.version,
99
140
  steps: local.steps,
100
- } : null);
141
+ } : null)
142
+ || installedPublishedDefinition(input.store, input.workspaceId, root.execution.workflowVersionId);
101
143
  if (!definition) {
102
144
  throw new Error(`Workflow execution ${executionId} is missing its published definition.`);
103
145
  }
104
146
  const merged = mergeEventHistory({
105
- local: local?.events || [],
147
+ local: replaceAuthoritativeHistory ? [] : local?.events || [],
106
148
  incoming: eventsByExecution.get(executionId) || [],
107
149
  });
108
150
  const execution = merged.localExtension && local
@@ -131,12 +173,15 @@ export function prepareWorkspaceSyncV3WorkflowRuntimeApply(input) {
131
173
  return;
132
174
  if (entry.projection !== 'workflow-execution/root-v1')
133
175
  return;
176
+ if (rootEntries.get(entry.entityId) !== entry)
177
+ return;
134
178
  const assignment = assignments.get(entry.entityId);
135
179
  if (!assignment)
136
180
  throw new Error(`Workflow execution apply plan is missing ${entry.entityId}.`);
137
181
  input.store.installAssignmentForSync(input.workspaceId, assignment, {
138
182
  authority: 'cloud-execution',
139
183
  expectedTaskId: assignment.execution.taskId,
184
+ replaceAuthoritativeHistory: input.replaceAuthoritativeHistoryExecutionIds?.has(entry.entityId),
140
185
  });
141
186
  },
142
187
  };
@@ -0,0 +1,7 @@
1
+ import type { WorkspaceSyncV3FeedCoveragePolicy, WorkspaceSyncV3FeedEntry, WorkspaceSyncV3FeedOperationProjector } from './workspaceSyncV3Feed.js';
2
+ import type { WorkspaceSyncV3CoverageProfile } from './workspaceSyncV3FeedProfile.js';
3
+ /** Dark v8 candidate: active v7 task-cover ownership plus workflow runtime. */
4
+ export declare const WORKSPACE_SYNC_V3_WORKFLOW_TASK_COVER_COVERAGE_PROFILE: WorkspaceSyncV3CoverageProfile;
5
+ export declare const projectWorkspaceSyncV3WorkflowTaskCoverCoverageOperation: WorkspaceSyncV3FeedOperationProjector;
6
+ export declare const WORKSPACE_SYNC_V3_WORKFLOW_TASK_COVER_COVERAGE_POLICY: WorkspaceSyncV3FeedCoveragePolicy;
7
+ export declare function validateWorkspaceSyncV3WorkflowTaskCoverCoverageFeedEntry(entry: WorkspaceSyncV3FeedEntry): void;
@@ -0,0 +1,33 @@
1
+ import { createHash } from 'crypto';
2
+ import { canonicalWorkspaceSyncJson } from './canonicalWorkspaceSyncJson.js';
3
+ import { projectWorkspaceSyncV3TaskCoverCoverageOperation, validateWorkspaceSyncV3TaskCoverCoverageFeedEntry, WORKSPACE_SYNC_V3_TASK_COVER_COVERAGE_PROFILE, } from './workspaceSyncV3TaskCoverCoverage.js';
4
+ import { WORKSPACE_SYNC_V3_WORKFLOW_RUNTIME_PROJECTIONS } from './workflowRuntimeSync.js';
5
+ import { projectWorkspaceSyncV3WorkflowRuntimeOperation, validateWorkspaceSyncV3WorkflowRuntimeFeedEntry, } from './workspaceSyncV3WorkflowRuntimeProjection.js';
6
+ const projections = Object.freeze([
7
+ ...WORKSPACE_SYNC_V3_TASK_COVER_COVERAGE_PROFILE.projections,
8
+ ...WORKSPACE_SYNC_V3_WORKFLOW_RUNTIME_PROJECTIONS,
9
+ ]);
10
+ const identity = Object.freeze({
11
+ coverageProfileId: 'task-planning-metadata',
12
+ coverageVersion: 8,
13
+ projections,
14
+ });
15
+ /** Dark v8 candidate: active v7 task-cover ownership plus workflow runtime. */
16
+ export const WORKSPACE_SYNC_V3_WORKFLOW_TASK_COVER_COVERAGE_PROFILE = Object.freeze({
17
+ ...identity,
18
+ coverageDigest: createHash('sha256').update(canonicalWorkspaceSyncJson(identity)).digest('hex'),
19
+ });
20
+ export const projectWorkspaceSyncV3WorkflowTaskCoverCoverageOperation = (input) => {
21
+ const workflow = projectWorkspaceSyncV3WorkflowRuntimeOperation(input);
22
+ return workflow || projectWorkspaceSyncV3TaskCoverCoverageOperation(input);
23
+ };
24
+ export const WORKSPACE_SYNC_V3_WORKFLOW_TASK_COVER_COVERAGE_POLICY = Object.freeze({
25
+ profile: WORKSPACE_SYNC_V3_WORKFLOW_TASK_COVER_COVERAGE_PROFILE,
26
+ projectOperation: projectWorkspaceSyncV3WorkflowTaskCoverCoverageOperation,
27
+ });
28
+ export function validateWorkspaceSyncV3WorkflowTaskCoverCoverageFeedEntry(entry) {
29
+ if (entry.projection.startsWith('workflow-')) {
30
+ return validateWorkspaceSyncV3WorkflowRuntimeFeedEntry(entry);
31
+ }
32
+ return validateWorkspaceSyncV3TaskCoverCoverageFeedEntry(entry);
33
+ }
@@ -0,0 +1,7 @@
1
+ export declare const WORKSPACE_SYNC_V3_WORKFLOW_TASK_COVER_COVERAGE_SELECTOR: Readonly<{
2
+ coverageProfileId: "task-planning-metadata";
3
+ coverageVersion: 8;
4
+ coverageDigest: "344c3360d36d383241b212192fe6c2ac1a7694fe521d3b6636559043b7e58253";
5
+ }>;
6
+ /** V2 has neither workflow runtime nor explicit task card-cover projections. */
7
+ export declare const WORKSPACE_SYNC_V3_WORKFLOW_TASK_COVER_EXCLUDED_V2_PROJECTIONS: readonly ("initiative/full-v1" | "taxonomy/full-v1" | "task/root-v1" | "task-relationship/full-v1" | "workstream/full-v1" | "task-comments/full-v1" | "task-checklist/full-v1" | "task-attachment-links/full-v2" | "entity-event/full-v1")[];
@@ -0,0 +1,8 @@
1
+ import { WORKSPACE_SYNC_V3_TASK_COVER_EXCLUDED_V2_PROJECTIONS } from './workspaceSyncV3TaskCoverWireContract.js';
2
+ export const WORKSPACE_SYNC_V3_WORKFLOW_TASK_COVER_COVERAGE_SELECTOR = Object.freeze({
3
+ coverageProfileId: 'task-planning-metadata',
4
+ coverageVersion: 8,
5
+ coverageDigest: '344c3360d36d383241b212192fe6c2ac1a7694fe521d3b6636559043b7e58253',
6
+ });
7
+ /** V2 has neither workflow runtime nor explicit task card-cover projections. */
8
+ export const WORKSPACE_SYNC_V3_WORKFLOW_TASK_COVER_EXCLUDED_V2_PROJECTIONS = WORKSPACE_SYNC_V3_TASK_COVER_EXCLUDED_V2_PROJECTIONS;
@@ -2,6 +2,7 @@ import type { TaskItem } from '../types.js';
2
2
  import type { WorkspaceAssetLinkRole, WorkspaceAssetStore } from '../storage/workspaceAssetStore.js';
3
3
  import { type AiProfileAvatarPathSource } from './aiProfileAvatarSyncPaths.js';
4
4
  import { type WorkspaceSyncPublishedContentResolver } from './engine/workspaceSyncPublishedContentResolver.js';
5
+ import type { WorkspaceSyncContentPullObligationStore } from './engine/workspaceSyncContentPullObligationStore.js';
5
6
  export interface WorkspaceRepairManifestTaskEntry {
6
7
  id: string;
7
8
  archived: boolean;
@@ -52,7 +53,7 @@ export interface WorkspaceRepairManifest {
52
53
  assets: WorkspaceRepairManifestAssetEntry[];
53
54
  assetDeletes: WorkspaceRepairManifestDeleteEntry[];
54
55
  }
55
- export type WorkspaceRepairIssueCode = 'missing_document_metadata' | 'missing_document_file' | 'stale_document_tombstone' | 'published_document_tombstone_conflict' | 'published_document_live_head_conflict' | 'invalid_published_document_content' | 'missing_asset_metadata' | 'missing_asset_file' | 'stale_asset_tombstone' | 'published_asset_tombstone_conflict' | 'published_asset_live_head_conflict' | 'invalid_published_asset_content' | 'stale_asset_link' | 'missing_asset_link';
56
+ export type WorkspaceRepairIssueCode = 'missing_document_metadata' | 'missing_document_file' | 'stale_document_tombstone' | 'published_document_tombstone_conflict' | 'published_document_live_head_conflict' | 'invalid_published_document_content' | 'document_content_unverified' | 'missing_asset_metadata' | 'missing_asset_file' | 'stale_asset_tombstone' | 'published_asset_tombstone_conflict' | 'published_asset_live_head_conflict' | 'invalid_published_asset_content' | 'asset_content_unverified' | 'stale_asset_link' | 'missing_asset_link';
56
57
  export interface WorkspaceRepairIssue {
57
58
  code: WorkspaceRepairIssueCode;
58
59
  entityKind: 'document' | 'asset' | 'link';
@@ -61,7 +62,7 @@ export interface WorkspaceRepairIssue {
61
62
  taskId?: string | null;
62
63
  role?: WorkspaceAssetLinkRole;
63
64
  repairable: boolean;
64
- recommendedAction: 'create-metadata' | 'mark-deleted' | 'revive-metadata' | 'delete-link' | 'create-link' | 'inspect-published-content';
65
+ recommendedAction: 'create-metadata' | 'mark-deleted' | 'revive-metadata' | 'delete-link' | 'create-link' | 'inspect-published-content' | 'retry-pull';
65
66
  detail: string;
66
67
  }
67
68
  export interface WorkspaceRepairScanResult {
@@ -106,4 +107,6 @@ export declare function applyWorkspaceRepair(input: WorkspaceRepairInput & {
106
107
  upsertDocumentWatermark: (workspaceId: string, path: string, contentHash: string, updatedAt: string) => void;
107
108
  repairMissingAssetLinks?: boolean;
108
109
  repairMissingContentFiles?: boolean;
110
+ contentPullObligationStore?: WorkspaceSyncContentPullObligationStore;
111
+ now?: () => string;
109
112
  }): WorkspaceRepairApplyResult;
@@ -6,6 +6,7 @@ import { resolveStorageKeyPathInsideRoot } from '../utils/pathSafety.js';
6
6
  import { compareWorkspaceMutationOrdering } from './workspaceSyncSurface.js';
7
7
  import { relativePathWithinRoot } from '../utils/pathContainment.js';
8
8
  import { listReferencedAiProfileAvatarAssetPaths, } from './aiProfileAvatarSyncPaths.js';
9
+ import { WORKSPACE_CONTENT_MANIFEST_VERSION, createWorkspaceContentMetadataFingerprintV1, } from './workspaceContentManifest.js';
9
10
  function normalizeWorkspaceId(raw) {
10
11
  return String(raw || '').trim() || 'default';
11
12
  }
@@ -110,6 +111,68 @@ function getPrimaryTaskId(store, assetId, workspaceId) {
110
111
  const links = store.listLinksForAsset(assetId, workspaceId, { includeDeleted: false });
111
112
  return links[0]?.taskId || null;
112
113
  }
114
+ function buildContentPullObligationInputForAsset(input) {
115
+ const links = input.store.listLinksForAsset(input.entry.assetId, input.workspaceId, { includeDeleted: false });
116
+ const primaryLink = links[0] || null;
117
+ // Mirrors resolveSyncLinkTarget (src/sync/contentSyncState.ts): a task link has no
118
+ // explicit targetType on the row (it's implied), so it must default to 'task' here
119
+ // rather than null — otherwise this fingerprint diverges from the one a real content
120
+ // manifest read (workspacePullFeed.ts) computes for the same task-linked asset, and
121
+ // the 'exact-version' obligation-resolution path can never match it.
122
+ const primaryLinkTargetId = String(primaryLink?.targetId || primaryLink?.taskId || '').trim();
123
+ const linkTargetType = primaryLinkTargetId
124
+ ? (primaryLink.targetType === 'initiative' || primaryLink.targetType === 'workstream' ? primaryLink.targetType : 'task')
125
+ : null;
126
+ const linkTargetId = linkTargetType ? primaryLinkTargetId : null;
127
+ const taskId = linkTargetType === 'task' ? linkTargetId : null;
128
+ const metadataFingerprint = input.kind === 'document'
129
+ ? createWorkspaceContentMetadataFingerprintV1({
130
+ kind: 'document',
131
+ metadata: {
132
+ assetId: input.entry.assetId,
133
+ documentId: input.entry.documentId,
134
+ referenceNumber: input.entry.referenceNumber,
135
+ version: input.entry.version,
136
+ taskId,
137
+ linkTargetType,
138
+ linkTargetId,
139
+ logicalName: input.entry.logicalName,
140
+ caption: null,
141
+ originalFilename: input.entry.originalFilename,
142
+ linkRole: primaryLink?.role === 'reference' ? 'reference' : 'attachment',
143
+ },
144
+ })
145
+ : createWorkspaceContentMetadataFingerprintV1({
146
+ kind: 'asset',
147
+ metadata: {
148
+ assetId: input.entry.assetId,
149
+ assetKind: input.entry.kind === 'image' ? 'image' : 'file',
150
+ mimeType: input.entry.mimeType,
151
+ referenceNumber: input.entry.referenceNumber,
152
+ taskId,
153
+ linkTargetType,
154
+ linkTargetId,
155
+ logicalName: input.entry.logicalName,
156
+ caption: null,
157
+ originalFilename: input.entry.originalFilename,
158
+ linkRole: primaryLink?.role || 'attachment',
159
+ },
160
+ });
161
+ const manifest = {
162
+ manifestVersion: WORKSPACE_CONTENT_MANIFEST_VERSION,
163
+ kind: input.kind,
164
+ path: input.path,
165
+ sha256: String(input.entry.contentSha256 || ''),
166
+ sizeBytes: Number(input.entry.sizeBytes || 0),
167
+ updatedAt: input.entry.updatedAt,
168
+ metadataFingerprint,
169
+ existsLocally: false,
170
+ };
171
+ return {
172
+ manifest,
173
+ sourceWatermark: input.entry.updatedAt,
174
+ };
175
+ }
113
176
  function decodePathSegment(raw) {
114
177
  try {
115
178
  return decodeURIComponent(raw);
@@ -492,14 +555,14 @@ export function scanWorkspaceRepair(input) {
492
555
  if (!document.existsLocally) {
493
556
  if (!document.contentCheckReliable) {
494
557
  issues.push({
495
- code: 'invalid_published_document_content',
558
+ code: 'document_content_unverified',
496
559
  entityKind: 'document',
497
560
  path: document.path,
498
561
  assetId: document.assetId,
499
562
  taskId: document.taskId,
500
563
  repairable: false,
501
- recommendedAction: 'inspect-published-content',
502
- detail: 'Local document file could not be confirmed missing — the storage root was unreachable or the check was inconclusive. Skipped to avoid converting unavailable content into an authoritative deletion.'
564
+ recommendedAction: 'retry-pull',
565
+ detail: 'Local document file could not be confirmed missing — the storage root was unreachable or the check was inconclusive. Skipped to avoid converting unavailable content into an authoritative deletion; queued for durable retry instead.'
503
566
  });
504
567
  continue;
505
568
  }
@@ -603,14 +666,14 @@ export function scanWorkspaceRepair(input) {
603
666
  continue;
604
667
  if (!asset.contentCheckReliable) {
605
668
  issues.push({
606
- code: 'invalid_published_asset_content',
669
+ code: 'asset_content_unverified',
607
670
  entityKind: 'asset',
608
671
  path: asset.path,
609
672
  assetId: asset.assetId,
610
673
  taskId: asset.taskId,
611
674
  repairable: false,
612
- recommendedAction: 'inspect-published-content',
613
- detail: 'Local asset file could not be confirmed missing — the storage root was unreachable or the check was inconclusive. Skipped to avoid converting unavailable content into an authoritative deletion.'
675
+ recommendedAction: 'retry-pull',
676
+ detail: 'Local asset file could not be confirmed missing — the storage root was unreachable or the check was inconclusive. Skipped to avoid converting unavailable content into an authoritative deletion; queued for durable retry instead.'
614
677
  });
615
678
  continue;
616
679
  }
@@ -771,6 +834,7 @@ export function applyWorkspaceRepair(input) {
771
834
  const actionsApplied = [];
772
835
  const workspaceId = normalizeWorkspaceId(input.workspaceId);
773
836
  const activeTaskIds = new Set((input.tasks || []).map((task) => String(task.id || '').trim()).filter(Boolean));
837
+ const nowIso = () => (input.now ? input.now() : new Date().toISOString());
774
838
  const deletedMetadataByPath = new Map();
775
839
  if (input.workspaceAssetStore) {
776
840
  for (const entry of input.workspaceAssetStore.listAllByWorkspace(workspaceId, { includeDeleted: true })) {
@@ -780,6 +844,69 @@ export function applyWorkspaceRepair(input) {
780
844
  }
781
845
  }
782
846
  for (const issue of scan.issues) {
847
+ if (issue.code === 'document_content_unverified' || issue.code === 'asset_content_unverified') {
848
+ if (!input.contentPullObligationStore || !input.workspaceAssetStore || !issue.assetId || !issue.path) {
849
+ actionsApplied.push({
850
+ code: issue.code,
851
+ path: issue.path,
852
+ assetId: issue.assetId,
853
+ taskId: issue.taskId,
854
+ action: issue.recommendedAction,
855
+ status: 'skipped',
856
+ detail: 'No durable content-pull obligation store is available in this runtime; content-availability uncertainty was reported but not queued for retry.'
857
+ });
858
+ continue;
859
+ }
860
+ try {
861
+ const assetEntry = input.workspaceAssetStore.get(issue.assetId, workspaceId);
862
+ if (!assetEntry) {
863
+ actionsApplied.push({
864
+ code: issue.code,
865
+ path: issue.path,
866
+ assetId: issue.assetId,
867
+ taskId: issue.taskId,
868
+ action: issue.recommendedAction,
869
+ status: 'skipped',
870
+ detail: 'Canonical metadata for this asset was no longer present; skipped queuing a recovery obligation.'
871
+ });
872
+ continue;
873
+ }
874
+ const obligationInput = buildContentPullObligationInputForAsset({
875
+ kind: issue.code === 'document_content_unverified' ? 'document' : 'asset',
876
+ path: issue.path,
877
+ entry: assetEntry,
878
+ store: input.workspaceAssetStore,
879
+ workspaceId,
880
+ });
881
+ input.contentPullObligationStore.upsertMany({
882
+ tenantId: input.tenantId,
883
+ workspaceId,
884
+ obligations: [obligationInput],
885
+ now: nowIso(),
886
+ });
887
+ actionsApplied.push({
888
+ code: issue.code,
889
+ path: issue.path,
890
+ assetId: issue.assetId,
891
+ taskId: issue.taskId,
892
+ action: issue.recommendedAction,
893
+ status: 'applied',
894
+ detail: 'Queued a durable content-pull recovery obligation instead of treating unavailable content as deleted.'
895
+ });
896
+ }
897
+ catch (error) {
898
+ actionsApplied.push({
899
+ code: issue.code,
900
+ path: issue.path,
901
+ assetId: issue.assetId,
902
+ taskId: issue.taskId,
903
+ action: issue.recommendedAction,
904
+ status: 'failed',
905
+ detail: String(error?.message || error || 'Failed to queue a recovery obligation.')
906
+ });
907
+ }
908
+ continue;
909
+ }
783
910
  if (!issue.repairable) {
784
911
  actionsApplied.push({
785
912
  code: issue.code,
@@ -947,6 +1074,34 @@ export function applyWorkspaceRepair(input) {
947
1074
  });
948
1075
  }
949
1076
  }
1077
+ if (input.contentPullObligationStore) {
1078
+ const resolutionClaims = [
1079
+ ...scan.snapshot.documents
1080
+ .filter((entry) => entry.existsLocally && entry.assetId)
1081
+ .map((entry) => ({
1082
+ kind: 'document',
1083
+ path: entry.path,
1084
+ sourceWatermark: entry.updatedAt,
1085
+ resolution: 'at-or-before-watermark',
1086
+ })),
1087
+ ...scan.snapshot.assets
1088
+ .filter((entry) => entry.existsLocally && entry.assetId)
1089
+ .map((entry) => ({
1090
+ kind: 'asset',
1091
+ path: entry.path,
1092
+ sourceWatermark: entry.updatedAt,
1093
+ resolution: 'at-or-before-watermark',
1094
+ })),
1095
+ ];
1096
+ if (resolutionClaims.length > 0) {
1097
+ input.contentPullObligationStore.resolveMany({
1098
+ tenantId: input.tenantId,
1099
+ workspaceId,
1100
+ claims: resolutionClaims,
1101
+ now: nowIso(),
1102
+ });
1103
+ }
1104
+ }
950
1105
  const refreshed = scanWorkspaceRepair(input);
951
1106
  return {
952
1107
  ...refreshed,