@sema-agent/client-core 0.94.0 → 0.96.0

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 (332) hide show
  1. package/CHANGELOG.md +521 -0
  2. package/README.md +104 -57
  3. package/dist/adapt/arms.js +12 -7
  4. package/dist/adapt/panelTasks.js +4 -10
  5. package/dist/adapt/toolCards.d.ts +1 -0
  6. package/dist/adapt/toolCards.js +18 -5
  7. package/dist/adapt/wireShapes.js +5 -24
  8. package/dist/adapter/activeRunSelfHeal.d.ts +12 -3
  9. package/dist/adapter/activeRunSelfHeal.js +50 -16
  10. package/dist/adapter/downstream/eventToSdkMessage.js +33 -18
  11. package/dist/adapter/downstream/terminalToSdkResult.js +19 -12
  12. package/dist/adapter/runStream.js +30 -46
  13. package/dist/adapter/types.d.ts +7 -0
  14. package/dist/adapter/types.js +15 -0
  15. package/dist/agentSession/backgroundView.js +5 -1
  16. package/dist/agentSession/engineAgentRegistryRead.js +7 -5
  17. package/dist/agentSession/engineSessionBackgroundStop.js +25 -17
  18. package/dist/agentsWireCaps.d.ts +2 -0
  19. package/dist/agentsWireCaps.js +13 -2
  20. package/dist/approvalDecidedByCapability.d.ts +0 -1
  21. package/dist/approvalDecidedByCapability.js +2 -7
  22. package/dist/approvalsStreamLiveCapability.d.ts +0 -1
  23. package/dist/approvalsStreamLiveCapability.js +2 -6
  24. package/dist/atMostOnce.d.ts +8 -0
  25. package/dist/atMostOnce.js +36 -0
  26. package/dist/attachmentSeatCapability.d.ts +0 -1
  27. package/dist/attachmentSeatCapability.js +0 -3
  28. package/dist/attachmentsWireCaps.js +11 -6
  29. package/dist/bashExitReading.d.ts +10 -0
  30. package/dist/bashExitReading.js +12 -0
  31. package/dist/callerCwdCapability.d.ts +0 -5
  32. package/dist/callerCwdCapability.js +2 -13
  33. package/dist/centerWiringCapability.d.ts +1 -7
  34. package/dist/centerWiringCapability.js +18 -27
  35. package/dist/classifierStatus.js +4 -4
  36. package/dist/classifierVerdictWire.js +4 -16
  37. package/dist/clientSlice.js +1 -1
  38. package/dist/cloudConfigWireCaps.d.ts +3 -3
  39. package/dist/cloudConfigWireCaps.js +85 -43
  40. package/dist/compensations.js +1 -1
  41. package/dist/coreValuePorts.d.ts +11 -7
  42. package/dist/coreValuePorts.js +5 -8
  43. package/dist/credentialProvenance.d.ts +28 -0
  44. package/dist/credentialProvenance.js +76 -0
  45. package/dist/cycleOrder.d.ts +15 -0
  46. package/dist/cycleOrder.js +45 -0
  47. package/dist/decideFailureNote.js +7 -2
  48. package/dist/decideReceipt.d.ts +2 -1
  49. package/dist/decideReceipt.js +39 -14
  50. package/dist/declared/supportFloorDeclared.d.ts +1 -0
  51. package/dist/declared/supportFloorDeclared.js +5 -0
  52. package/dist/deviceExecutorManagementCapability.d.ts +0 -1
  53. package/dist/deviceExecutorManagementCapability.js +7 -16
  54. package/dist/deviceRebind.d.ts +88 -0
  55. package/dist/deviceRebind.js +242 -0
  56. package/dist/displayUntrusted.d.ts +8 -3
  57. package/dist/displayUntrusted.js +661 -63
  58. package/dist/engineAgentAbsence.d.ts +2 -2
  59. package/dist/engineAgentPanelStore.d.ts +8 -18
  60. package/dist/engineAgentPanelStore.js +19 -537
  61. package/dist/engineCapReader.d.ts +6 -6
  62. package/dist/engineCapReader.js +30 -43
  63. package/dist/engineCapsCache.d.ts +13 -2
  64. package/dist/engineCapsCache.js +276 -44
  65. package/dist/engineCredentialRequirement.d.ts +9 -0
  66. package/dist/engineCredentialRequirement.js +23 -0
  67. package/dist/engineDirectory.d.ts +79 -0
  68. package/dist/engineDirectory.js +186 -0
  69. package/dist/engineEnvSourcing.d.ts +53 -0
  70. package/dist/engineEnvSourcing.js +81 -0
  71. package/dist/engineErrorCodes.d.ts +28 -4
  72. package/dist/engineErrorCodes.js +68 -25
  73. package/dist/engineIdentity.js +2 -0
  74. package/dist/engineNoticeCodes.d.ts +17 -0
  75. package/dist/engineNoticeCodes.js +57 -3
  76. package/dist/engineWireSdk.js +2 -2
  77. package/dist/engineWordRenames.d.ts +8 -0
  78. package/dist/engineWordRenames.js +13 -0
  79. package/dist/executionLaneCapability.d.ts +2 -3
  80. package/dist/executionLaneCapability.js +18 -23
  81. package/dist/fileHistoryCaptureCapability.d.ts +14 -1
  82. package/dist/fileHistoryCaptureCapability.js +72 -6
  83. package/dist/fileHistoryLegNotice.d.ts +3 -2
  84. package/dist/fileHistoryLegNotice.js +51 -2
  85. package/dist/fleet/bgSubagentRow.d.ts +15 -0
  86. package/dist/fleet/bgSubagentRow.js +67 -0
  87. package/dist/fleet/fleetLedger.d.ts +3 -0
  88. package/dist/fleet/fleetLedger.js +153 -122
  89. package/dist/fleet/fleetProjection.d.ts +1 -3
  90. package/dist/fleet/fleetProjection.js +19 -19
  91. package/dist/fleetAgentPanelProjection.d.ts +4 -17
  92. package/dist/fleetAgentPanelProjection.js +7 -197
  93. package/dist/fleetAgentRowLike.d.ts +16 -0
  94. package/dist/fleetAgentRowLike.js +1 -0
  95. package/dist/fleetTaskDesc.js +4 -17
  96. package/dist/gateOutcome.d.ts +12 -1
  97. package/dist/gateOutcome.js +87 -18
  98. package/dist/gateVocabulary.d.ts +7 -2
  99. package/dist/gateVocabulary.js +5 -1
  100. package/dist/generated/engineAskFaceTables.js +1 -1
  101. package/dist/generated/engineFactTables.d.ts +5 -3
  102. package/dist/generated/engineFactTables.js +17 -4
  103. package/dist/generated/engineNoticeTables.js +12 -3
  104. package/dist/generated/sdkFactTables.d.ts +2 -0
  105. package/dist/generated/sdkFactTables.js +17 -0
  106. package/dist/generated/settingsSchemaFns.d.ts +13 -0
  107. package/dist/generated/settingsSchemaFns.js +75 -0
  108. package/dist/generated/toolNameTables.d.ts +1 -0
  109. package/dist/generated/toolNameTables.js +1 -0
  110. package/dist/headlessPermissionModeWire.d.ts +1 -1
  111. package/dist/headlessPermissionModeWire.js +1 -1
  112. package/dist/headlessReconnectWire.js +49 -20
  113. package/dist/hitl/allowRuleShadow.d.ts +1 -1
  114. package/dist/hitl/allowRuleShadow.js +49 -8
  115. package/dist/hitl/approvalCompleteParked.d.ts +1 -0
  116. package/dist/hitl/approvalCompleteParked.js +14 -0
  117. package/dist/hitl/approvalEndingCause.d.ts +7 -0
  118. package/dist/hitl/approvalEndingCause.js +71 -0
  119. package/dist/hitl/approvalHolds.d.ts +12 -2
  120. package/dist/hitl/approvalHolds.js +53 -2
  121. package/dist/hitl/approvalsFeed.js +23 -11
  122. package/dist/hitl/askGateWire.d.ts +2 -1
  123. package/dist/hitl/askGateWire.js +26 -1
  124. package/dist/hitl/askParkRowRouting.js +1 -1
  125. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  126. package/dist/hitl/automaticAnswerVerdict.js +15 -10
  127. package/dist/hitl/crashConverged.js +2 -0
  128. package/dist/hitl/decisionConflict.d.ts +3 -0
  129. package/dist/hitl/decisionConflict.js +41 -0
  130. package/dist/hitl/decisionRefusal.d.ts +12 -0
  131. package/dist/hitl/decisionRefusal.js +63 -4
  132. package/dist/hitl/frameRouter.d.ts +0 -1
  133. package/dist/hitl/frameRouter.js +32 -57
  134. package/dist/hitl/gateLedger.d.ts +5 -0
  135. package/dist/hitl/gateLedger.js +21 -0
  136. package/dist/hitl/hitlBridge.d.ts +17 -2
  137. package/dist/hitl/hitlBridge.js +91 -55
  138. package/dist/hitl/hitlHostSurface.js +3 -11
  139. package/dist/hitl/livePendingAsk.d.ts +16 -6
  140. package/dist/hitl/livePendingAsk.js +36 -4
  141. package/dist/hitl/localAllowRule.d.ts +1 -0
  142. package/dist/hitl/localAllowRule.js +2 -2
  143. package/dist/hitl/noAllowCause.d.ts +2 -1
  144. package/dist/hitl/noAllowCause.js +3 -2
  145. package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
  146. package/dist/hitl/parkExpiryJudgements.js +46 -0
  147. package/dist/hitl/parkResolver.d.ts +4 -7
  148. package/dist/hitl/parkResolver.js +12 -34
  149. package/dist/hitl/parkRowBirthWait.d.ts +1 -0
  150. package/dist/hitl/parkRowBirthWait.js +2 -2
  151. package/dist/hitl/persistedRulesWire.js +5 -1
  152. package/dist/hitl/planReviewWire.d.ts +3 -2
  153. package/dist/hitl/planReviewWire.js +154 -50
  154. package/dist/hitl/replayedApproval.d.ts +9 -0
  155. package/dist/hitl/replayedApproval.js +139 -10
  156. package/dist/hitl/resumeRunningCard.d.ts +2 -0
  157. package/dist/hitl/resumeRunningCard.js +15 -4
  158. package/dist/hitl/sessionPolicyDeliverable.js +8 -6
  159. package/dist/hitl/standingRows.d.ts +18 -0
  160. package/dist/hitl/standingRows.js +127 -0
  161. package/dist/hitl/toolApprovalWire.d.ts +39 -7
  162. package/dist/hitl/toolApprovalWire.js +351 -61
  163. package/dist/hookMatcherVerdict.d.ts +1 -9
  164. package/dist/hookMatcherVerdict.js +21 -61
  165. package/dist/hooksWireCaps.js +40 -8
  166. package/dist/host.d.ts +5 -0
  167. package/dist/host.js +3 -1
  168. package/dist/hostCallbackGuard.d.ts +2 -0
  169. package/dist/hostCallbackGuard.js +31 -0
  170. package/dist/index.d.ts +48 -17
  171. package/dist/index.js +36 -15
  172. package/dist/interactiveInterrupt.d.ts +8 -0
  173. package/dist/interactiveInterrupt.js +54 -0
  174. package/dist/limitsWire.d.ts +5 -0
  175. package/dist/limitsWire.js +49 -3
  176. package/dist/liveModelCatalog.d.ts +95 -0
  177. package/dist/liveModelCatalog.js +297 -32
  178. package/dist/mcpEngineLeg.d.ts +25 -0
  179. package/dist/mcpEngineLeg.js +71 -15
  180. package/dist/mcpPanel.js +2 -1
  181. package/dist/mcpProbeCapability.d.ts +0 -5
  182. package/dist/mcpProbeCapability.js +2 -12
  183. package/dist/mcpReconnect.d.ts +1 -3
  184. package/dist/mcpReconnect.js +10 -5
  185. package/dist/memoryComplianceCapability.d.ts +0 -5
  186. package/dist/memoryComplianceCapability.js +2 -12
  187. package/dist/memoryOriginCapability.d.ts +0 -5
  188. package/dist/memoryOriginCapability.js +2 -12
  189. package/dist/memorySpecWire.js +2 -2
  190. package/dist/memoryVerbsWire.d.ts +1 -1
  191. package/dist/memoryVerbsWire.js +4 -0
  192. package/dist/model/liveCatalogShape.d.ts +14 -0
  193. package/dist/model/liveCatalogShape.js +71 -0
  194. package/dist/model/modelSupplyRules.d.ts +1 -0
  195. package/dist/model/modelSupplyRules.js +30 -9
  196. package/dist/model/modelsPolicy.d.ts +21 -0
  197. package/dist/model/modelsPolicy.js +90 -0
  198. package/dist/modelIdentityResolvability.d.ts +2 -2
  199. package/dist/modelIdentityResolvability.js +14 -12
  200. package/dist/modelSwitchFallback.d.ts +69 -0
  201. package/dist/modelSwitchFallback.js +206 -0
  202. package/dist/noticePresentation.d.ts +68 -0
  203. package/dist/noticePresentation.js +247 -0
  204. package/dist/notifications.js +12 -11
  205. package/dist/outputStyleSeatCapability.d.ts +0 -2
  206. package/dist/outputStyleSeatCapability.js +2 -10
  207. package/dist/ownKey.d.ts +8 -0
  208. package/dist/ownKey.js +66 -0
  209. package/dist/panelReduce.d.ts +114 -0
  210. package/dist/panelReduce.js +1135 -0
  211. package/dist/panelStateHolder.d.ts +17 -0
  212. package/dist/panelStateHolder.js +201 -0
  213. package/dist/peerFrames.js +13 -9
  214. package/dist/peerLaneCapability.d.ts +0 -1
  215. package/dist/peerLaneCapability.js +2 -6
  216. package/dist/permissionModesCapability.d.ts +0 -5
  217. package/dist/permissionModesCapability.js +5 -16
  218. package/dist/permissionRuleIssue.js +0 -3
  219. package/dist/permissionRulesWriteCapability.d.ts +0 -1
  220. package/dist/permissionRulesWriteCapability.js +2 -6
  221. package/dist/permissionsAllowGrantCapability.d.ts +0 -1
  222. package/dist/permissionsAllowGrantCapability.js +3 -9
  223. package/dist/permissionsDeclaration.d.ts +8 -0
  224. package/dist/permissionsDeclaration.js +101 -41
  225. package/dist/printPermissionOutcome.d.ts +12 -0
  226. package/dist/printPermissionOutcome.js +50 -0
  227. package/dist/printToolResultFrame.d.ts +1 -0
  228. package/dist/printToolResultFrame.js +5 -17
  229. package/dist/promptBlockedCopy.d.ts +5 -0
  230. package/dist/promptBlockedCopy.js +35 -0
  231. package/dist/promptDelivery.js +0 -8
  232. package/dist/protocolSegment.d.ts +9 -6
  233. package/dist/protocolSegment.js +31 -21
  234. package/dist/providerRejection.d.ts +4 -0
  235. package/dist/providerRejection.js +75 -14
  236. package/dist/replayBody.d.ts +12 -0
  237. package/dist/replayBody.js +25 -0
  238. package/dist/resumeRefusalCopy.d.ts +18 -1
  239. package/dist/resumeRefusalCopy.js +127 -32
  240. package/dist/retryStatus.d.ts +9 -1
  241. package/dist/retryStatus.js +9 -2
  242. package/dist/rewindArchiveCapability.d.ts +5 -14
  243. package/dist/rewindArchiveCapability.js +18 -61
  244. package/dist/rewindArchiveReading.d.ts +15 -0
  245. package/dist/rewindArchiveReading.js +56 -0
  246. package/dist/rewindEngineAction.d.ts +21 -0
  247. package/dist/rewindEngineAction.js +36 -0
  248. package/dist/rewindWireCaps.d.ts +2 -1
  249. package/dist/rewindWireCaps.js +1 -0
  250. package/dist/ruleCompileVerdict.d.ts +9 -1
  251. package/dist/ruleCompileVerdict.js +29 -4
  252. package/dist/runTerminal.d.ts +15 -12
  253. package/dist/runTerminal.js +60 -35
  254. package/dist/sandboxWire.js +13 -0
  255. package/dist/sdkRegistryTransit.d.ts +2 -1
  256. package/dist/sdkRegistryTransit.js +1 -0
  257. package/dist/sealedKeyCapability.d.ts +0 -5
  258. package/dist/sealedKeyCapability.js +3 -15
  259. package/dist/seam.js +4 -2
  260. package/dist/seatContract.d.ts +125 -34
  261. package/dist/seatContract.js +583 -179
  262. package/dist/sessionIdSegment.d.ts +1 -0
  263. package/dist/sessionIdSegment.js +11 -0
  264. package/dist/sessionMemoryErase.d.ts +1 -1
  265. package/dist/sessionMemoryErase.js +6 -1
  266. package/dist/sessionMemoryStatus.js +3 -2
  267. package/dist/sessionPolicyCapability.d.ts +0 -1
  268. package/dist/sessionPolicyCapability.js +2 -6
  269. package/dist/sessionReadRedactionCapability.d.ts +0 -5
  270. package/dist/sessionReadRedactionCapability.js +2 -13
  271. package/dist/sessionSyncFileHistory.d.ts +4 -0
  272. package/dist/sessionSyncFileHistory.js +66 -0
  273. package/dist/sessionSyncFileHistoryCapability.d.ts +0 -2
  274. package/dist/sessionSyncFileHistoryCapability.js +2 -9
  275. package/dist/skillToolListsCapability.d.ts +0 -2
  276. package/dist/skillToolListsCapability.js +2 -9
  277. package/dist/skillsWireCaps.d.ts +4 -0
  278. package/dist/skillsWireCaps.js +66 -1
  279. package/dist/sqlEngineCapability.d.ts +0 -1
  280. package/dist/sqlEngineCapability.js +9 -14
  281. package/dist/steerPriorityCapability.d.ts +0 -2
  282. package/dist/steerPriorityCapability.js +3 -12
  283. package/dist/storePostureCapability.d.ts +1 -5
  284. package/dist/storePostureCapability.js +16 -22
  285. package/dist/streamDrainingLegs.d.ts +6 -0
  286. package/dist/streamDrainingLegs.js +23 -0
  287. package/dist/subagent/engineCompactWire.js +13 -38
  288. package/dist/subagent/engineDelegatedPrompt.js +10 -6
  289. package/dist/subagent/engineSubagentOutput.d.ts +0 -1
  290. package/dist/subagent/engineSubagentOutput.js +5 -20
  291. package/dist/subagent/engineSubagentSteer.js +7 -5
  292. package/dist/subagent/engineSubagentTail.d.ts +0 -1
  293. package/dist/subagent/engineSubagentTail.js +7 -32
  294. package/dist/subagentContentStore.js +7 -18
  295. package/dist/supportFloor.d.ts +1 -0
  296. package/dist/supportFloor.js +15 -14
  297. package/dist/systemReminderTag.d.ts +1 -0
  298. package/dist/systemReminderTag.js +8 -0
  299. package/dist/terminalStatuses.d.ts +30 -0
  300. package/dist/terminalStatuses.js +67 -0
  301. package/dist/toolHistoryMismatch.d.ts +0 -3
  302. package/dist/toolHistoryMismatch.js +3 -7
  303. package/dist/toolResult.d.ts +6 -1
  304. package/dist/toolResult.js +90 -37
  305. package/dist/toolResultContent.d.ts +2 -0
  306. package/dist/toolResultContent.js +63 -0
  307. package/dist/types/engineState.d.ts +2 -1
  308. package/dist/usageAnalytics.d.ts +146 -0
  309. package/dist/usageAnalytics.js +335 -0
  310. package/dist/userInvokedSkillsCapability.d.ts +0 -2
  311. package/dist/userInvokedSkillsCapability.js +2 -9
  312. package/dist/webSearchBackendCapability.d.ts +0 -1
  313. package/dist/webSearchBackendCapability.js +3 -7
  314. package/dist/webSearchWireCaps.js +3 -11
  315. package/dist/wireErrorTriage.d.ts +2 -0
  316. package/dist/wireErrorTriage.js +34 -5
  317. package/dist/wireFailureShape.d.ts +23 -2
  318. package/dist/wireFailureShape.js +88 -43
  319. package/dist/wireRefusalCopy.js +2 -18
  320. package/dist/workflowClient.js +7 -11
  321. package/dist/workflowsJournalCapability.d.ts +0 -1
  322. package/dist/workflowsJournalCapability.js +2 -6
  323. package/dist/writeProtectionCapability.d.ts +0 -1
  324. package/dist/writeProtectionCapability.js +5 -10
  325. package/docs/INTEGRATION-CLIENTS.md +2279 -27
  326. package/package.json +5 -5
  327. package/dist/engineCapsGenerationGuard.d.ts +0 -4
  328. package/dist/engineCapsGenerationGuard.js +0 -19
  329. package/dist/panelRunningHistory.d.ts +0 -22
  330. package/dist/panelRunningHistory.js +0 -82
  331. package/dist/registryConflict.d.ts +0 -3
  332. package/dist/registryConflict.js +0 -44
@@ -1,4 +1,5 @@
1
1
  import { hostLog } from '../host.js';
2
+ import { invokeHostCallbackIsolated } from '../hostCallbackGuard.js';
2
3
  import { engineWireDebugEnabled } from '../engineWireTarget.js';
3
4
  import { engineSessionParam, engineSessionParamFor } from '../engineSessionParam.js';
4
5
  import { enqueueBgChildNotification, isOwnWorkflowRun } from '../notifications.js';
@@ -7,9 +8,15 @@ import { rowIdTail } from '../workflow.js';
7
8
  import { recordEngineTranscriptId } from '../subagent/engineDelegatedPrompt.js';
8
9
  import { recordFleetRowAgentType } from './fleetRowAgentType.js';
9
10
  import { DEFAULT_SESSION_KEY } from '../sessionSlot.js';
10
- import { TERMINAL_FLEET_TASK_STATUSES, projectTasks, projectWorkflows, wireCycleSeq, wireParentId, } from './fleetProjection.js';
11
+ import { isSdkFleetTaskTerminal, isSdkFleetTaskTerminalNotSuccess } from '../terminalStatuses.js';
12
+ import { projectTasks, projectWorkflows, wireCycleSeq, wireParentId, } from './fleetProjection.js';
11
13
  import { isInStreamDrainingEnd } from '../wireErrorTriage.js';
14
+ import { cycleSeqOrder, cycleSeqValue } from '../cycleOrder.js';
12
15
  export const TERMINAL_RETAIN_MS = 60_000;
16
+ function hasRowId(row) {
17
+ const id = row?.id;
18
+ return typeof id === 'string' && id.length > 0;
19
+ }
13
20
  const liveBgViews = new Map();
14
21
  function viewsFor(sessionKey) {
15
22
  return liveBgViews.get(sessionKey) ?? new Set();
@@ -59,6 +66,16 @@ export function clearAllRetainedFleetRowsFor(sessionKey) {
59
66
  }
60
67
  }
61
68
  }
69
+ export function forgetSettledTerminalRow(id) {
70
+ return forgetSettledTerminalRowFor(DEFAULT_SESSION_KEY, id);
71
+ }
72
+ export function forgetSettledTerminalRowFor(sessionKey, id) {
73
+ let forgotten = false;
74
+ for (const view of viewsFor(sessionKey))
75
+ if (view.forgetSettledTerminal(id))
76
+ forgotten = true;
77
+ return forgotten;
78
+ }
62
79
  export function __resetFleetLedgerRegistryForTests() {
63
80
  liveBgViews.clear();
64
81
  }
@@ -88,7 +105,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
88
105
  if (gen === undefined || tail.length === 0)
89
106
  return;
90
107
  const prior = cycleWatermark.get(tail);
91
- if (prior !== undefined && prior >= gen)
108
+ if (prior !== undefined && cycleSeqOrder(prior, gen) !== 'before')
92
109
  return;
93
110
  cycleWatermark.delete(tail);
94
111
  if (cycleWatermark.size >= CYCLE_WATERMARK_MAX) {
@@ -98,6 +115,25 @@ export function createFleetLedger(hooks = {}, opts = {}) {
98
115
  }
99
116
  cycleWatermark.set(tail, gen);
100
117
  }
118
+ const settledTerminal = new Map();
119
+ const SETTLED_TERMINAL_MAX = 512;
120
+ function noteSettledTerminal(tail, row) {
121
+ if (tail.length === 0 || typeof row.status !== 'string')
122
+ return;
123
+ const gen = wireCycleSeq(row);
124
+ const recordedGen = settledTerminal.get(tail)?.cycleSeq;
125
+ if (cycleSeqOrder(gen, recordedGen) === 'before')
126
+ return;
127
+ if (cycleSeqOrder(gen, cycleWatermark.get(tail)) === 'before')
128
+ return;
129
+ settledTerminal.delete(tail);
130
+ if (settledTerminal.size >= SETTLED_TERMINAL_MAX) {
131
+ const oldest = settledTerminal.keys().next().value;
132
+ if (oldest !== undefined)
133
+ settledTerminal.delete(oldest);
134
+ }
135
+ settledTerminal.set(tail, { status: row.status, cycleSeq: gen });
136
+ }
101
137
  let droppedMalformed = 0;
102
138
  let droppedUnknownFrame = 0;
103
139
  let droppedForeignBgNotification = 0;
@@ -127,14 +163,48 @@ export function createFleetLedger(hooks = {}, opts = {}) {
127
163
  ...(typeof r.name === 'string' && r.name.length > 0 ? { name: r.name } : {}),
128
164
  status: r.status ?? 'unknown',
129
165
  ...(parentId !== undefined ? { parentId } : {}),
166
+ ...(typeof r.sourceLane === 'string' && r.sourceLane.length > 0 ? { sourceLane: r.sourceLane } : {}),
130
167
  ...(retired ? { retiredByNotification: true } : {}),
131
168
  };
132
169
  };
170
+ function settleTerminalRow(row, receivedAtMs) {
171
+ taskMap.delete(row.id);
172
+ rowMeta.delete(row.id);
173
+ retained.set(row.id, { row, expireAt: receivedAtMs + TERMINAL_RETAIN_MS });
174
+ const tail = rowIdTail(row.id);
175
+ for (const id of [...retained.keys()]) {
176
+ if (id !== row.id && rowIdTail(id) === tail)
177
+ retained.delete(id);
178
+ }
179
+ noteSettledTerminal(tail, row);
180
+ }
181
+ function admitRow(row, receivedAtMs) {
182
+ if (isSdkFleetTaskTerminal(row.status)) {
183
+ settleTerminalRow(row, receivedAtMs);
184
+ return;
185
+ }
186
+ taskMap.set(row.id, row);
187
+ rowMeta.set(row.id, { receivedAtMs });
188
+ const tail = rowIdTail(row.id);
189
+ for (const id of [...retained.keys()]) {
190
+ if (rowIdTail(id) === tail)
191
+ retained.delete(id);
192
+ }
193
+ settledTerminal.delete(tail);
194
+ clearBgTerminalFacts(tail);
195
+ }
196
+ function forgetSettledTerminalRowOf(id) {
197
+ if (taskMap.has(id))
198
+ return false;
199
+ const pooled = retained.get(id);
200
+ if (pooled === undefined || pooled.retiredByNotification === true)
201
+ return false;
202
+ retained.delete(id);
203
+ return true;
204
+ }
133
205
  const bgView = {
134
206
  read: () => {
135
- const rows = [...taskMap.values()]
136
- .filter(r => !TERMINAL_FLEET_TASK_STATUSES.has(r.status ?? ''))
137
- .map(r => toBgTask(r, false));
207
+ const rows = [...taskMap.values()].map(r => toBgTask(r, false));
138
208
  const nowMs = nowFn();
139
209
  for (const [id, r] of retained) {
140
210
  if (r.retiredByNotification !== true)
@@ -151,6 +221,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
151
221
  clearRetained: () => {
152
222
  retained.clear();
153
223
  },
224
+ forgetSettledTerminal: id => forgetSettledTerminalRowOf(id),
154
225
  };
155
226
  {
156
227
  let views = liveBgViews.get(sessionKey);
@@ -176,33 +247,35 @@ export function createFleetLedger(hooks = {}, opts = {}) {
176
247
  wfMap.clear();
177
248
  rowMeta.clear();
178
249
  const receivedAtMs = nowFn();
250
+ const rows = [];
179
251
  for (const row of frame.tasks) {
180
- taskMap.set(row.id, row);
181
- rowMeta.set(row.id, { receivedAtMs });
182
- if (!TERMINAL_FLEET_TASK_STATUSES.has(row.status ?? '')) {
183
- const tail = rowIdTail(row.id);
184
- for (const id of [...retained.keys()]) {
185
- if (rowIdTail(id) === tail)
186
- retained.delete(id);
187
- }
188
- clearBgTerminalFacts(tail);
252
+ if (!hasRowId(row)) {
253
+ droppedMalformed++;
254
+ debug('[fleet-frame] MALFORMED snapshot task row dropped(row 或 row.id 缺席 / 非串)');
255
+ continue;
189
256
  }
257
+ rows.push(row);
190
258
  }
259
+ for (const row of rows)
260
+ if (isSdkFleetTaskTerminal(row.status))
261
+ admitRow(row, receivedAtMs);
262
+ for (const row of rows)
263
+ if (!isSdkFleetTaskTerminal(row.status))
264
+ admitRow(row, receivedAtMs);
191
265
  for (const row of frame.workflows)
192
266
  wfMap.set(row.id, row);
193
267
  break;
194
268
  }
195
269
  case 'task': {
196
270
  const row = frame.row;
197
- if (!row?.id) {
271
+ if (!hasRowId(row)) {
198
272
  droppedMalformed++;
199
- debug('[fleet-frame] MALFORMED task frame dropped(row 或 row.id 缺席)');
273
+ debug('[fleet-frame] MALFORMED task frame dropped(row 或 row.id 缺席 / 非串)');
200
274
  break;
201
275
  }
202
276
  const receivedAtMs = nowFn();
203
- taskMap.set(row.id, row);
277
+ admitRow(row, receivedAtMs);
204
278
  raiseCycleWatermark(rowIdTail(row.id), wireCycleSeq(row));
205
- rowMeta.set(row.id, { receivedAtMs });
206
279
  debug(`[fleet-row] id=${row.id} parent=${row.parentId ?? '-'} agentType=${row.agentType ?? '-'}` +
207
280
  ` agentName=${row.agentName ?? '-'} name=${row.name ?? '-'} status=${row.status ?? '-'}` +
208
281
  ` tokens=${row.tokens ?? '-'} parentToolCallId=${row.parentToolCallId ?? '-'}`);
@@ -224,54 +297,37 @@ export function createFleetLedger(hooks = {}, opts = {}) {
224
297
  recordEngineTranscriptId(rowIdTail(row.id), row.transcriptId);
225
298
  }
226
299
  recordFleetRowAgentType(rowIdTail(row.id), row.agentType);
227
- if (TERMINAL_FLEET_TASK_STATUSES.has(row.status ?? '')) {
228
- retained.set(row.id, { row, expireAt: receivedAtMs + TERMINAL_RETAIN_MS });
229
- const tailT = rowIdTail(row.id);
230
- for (const id of [...retained.keys()]) {
231
- if (id !== row.id && rowIdTail(id) === tailT)
232
- retained.delete(id);
233
- }
234
- }
235
- else {
236
- retained.delete(row.id);
237
- const tail = rowIdTail(row.id);
238
- for (const id of [...retained.keys()]) {
239
- if (id !== row.id && rowIdTail(id) === tail)
240
- retained.delete(id);
241
- }
242
- clearBgTerminalFacts(tail);
243
- }
244
300
  break;
245
301
  }
246
302
  case 'task_remove': {
247
303
  const fr = frame;
248
- const removedGen = typeof fr.cycleSeq === 'number' && Number.isInteger(fr.cycleSeq) && fr.cycleSeq >= 1 ? fr.cycleSeq : undefined;
249
- const held = taskMap.get(frame.id);
304
+ const removedGen = cycleSeqValue(fr.cycleSeq);
305
+ const pooledHeld = retained.get(frame.id);
306
+ const held = taskMap.get(frame.id) ?? (pooledHeld !== undefined && pooledHeld.retiredByNotification !== true ? pooledHeld.row : undefined);
250
307
  const heldGen = held !== undefined ? wireCycleSeq(held) : undefined;
251
- const stale = removedGen !== undefined && heldGen !== undefined && removedGen < heldGen;
308
+ const stale = cycleSeqOrder(removedGen, heldGen) === 'before';
309
+ const reason = typeof fr.removeReason === 'string' && fr.removeReason.length > 0 ? fr.removeReason : undefined;
252
310
  if (!stale) {
253
311
  taskMap.delete(frame.id);
254
312
  rowMeta.delete(frame.id);
255
- }
256
- if (hooks.onTaskRemoved !== undefined) {
257
- const reason = typeof fr.removeReason === 'string' && fr.removeReason.length > 0 ? fr.removeReason : undefined;
258
- try {
259
- const out = hooks.onTaskRemoved({
260
- id: frame.id,
261
- ...(reason !== undefined ? { removeReason: reason } : {}),
262
- ...(removedGen !== undefined ? { cycleSeq: removedGen } : {}),
263
- ...(stale ? { stale: true } : {}),
264
- ...(held === undefined ? { unknownRow: true } : {}),
265
- });
266
- if (out && typeof out.then === 'function') {
267
- void Promise.resolve(out).catch((e) => {
268
- hostLog('debug', `[fleet-frame] onTaskRemoved hook rejected: ${String(e).slice(0, 160)}`);
269
- });
313
+ if (reason === undefined) {
314
+ const pooled = retained.get(frame.id);
315
+ if (pooled !== undefined &&
316
+ pooled.row.status === 'killed' &&
317
+ cycleSeqOrder(removedGen, wireCycleSeq(pooled.row)) !== 'before' &&
318
+ forgetSettledTerminalRowOf(frame.id)) {
319
+ debug(`[fleet-frame] settled-level task_remove evicted the stopped row(id=${frame.id})`);
270
320
  }
271
321
  }
272
- catch (e) {
273
- hostLog('debug', `[fleet-frame] onTaskRemoved hook threw: ${String(e).slice(0, 160)}`);
274
- }
322
+ }
323
+ if (hooks.onTaskRemoved !== undefined) {
324
+ invokeHostCallbackIsolated('[fleet-frame] onTaskRemoved hook', () => hooks.onTaskRemoved?.({
325
+ id: frame.id,
326
+ ...(reason !== undefined ? { removeReason: reason } : {}),
327
+ ...(removedGen !== undefined ? { cycleSeq: removedGen } : {}),
328
+ ...(stale ? { stale: true } : {}),
329
+ ...(held === undefined ? { unknownRow: true } : {}),
330
+ }));
275
331
  }
276
332
  break;
277
333
  }
@@ -345,29 +401,30 @@ export function createFleetLedger(hooks = {}, opts = {}) {
345
401
  ? 'own_parent'
346
402
  : 'absent_parent');
347
403
  debug(`[fleet-frame] bg_notification taskId=${n.taskId} status=${n.status} seq=${n.seq ?? '-'} accept=${evidence}`);
404
+ const notifTail = rowIdTail(n.taskId);
348
405
  const rowIds = [];
349
406
  for (const id of taskMap.keys()) {
350
- if (id === n.taskId || rowIdTail(id) === n.taskId)
407
+ if (rowIdTail(id) === notifTail)
351
408
  rowIds.push(id);
352
409
  }
353
- if (TERMINAL_FLEET_TASK_STATUSES.has(n.status)) {
410
+ if (isSdkFleetTaskTerminal(n.status)) {
354
411
  if (typeof n.parentTaskId === 'string' && n.parentTaskId) {
355
412
  recordBgParentRun(n.taskId, n.parentTaskId, ing?.session, ing?.sessionKey);
356
413
  }
357
414
  if (typeof n.transcriptId === 'string' && n.transcriptId.length > 0) {
358
415
  recordEngineTranscriptId(n.taskId, n.transcriptId);
359
416
  }
360
- const isWashGreen = (prior, next) => next === 'completed' && (prior === 'failed' || prior === 'killed');
417
+ const isWashGreen = (prior, next) => next === 'completed' && isSdkFleetTaskTerminalNotSuccess(prior);
361
418
  const coerced = n.status;
362
419
  const nowMs = nowFn();
363
420
  const writtenIds = new Set();
364
421
  let applied = false;
365
422
  let washBlocked = false;
366
423
  let staleBlocked = false;
367
- const notifSeq = typeof n.seq === 'number' && Number.isInteger(n.seq) && n.seq >= 1 ? n.seq : undefined;
424
+ const notifSeq = cycleSeqValue(n.seq);
368
425
  {
369
426
  const mark = cycleWatermark.get(n.taskId);
370
- if (notifSeq !== undefined && mark !== undefined && notifSeq < mark) {
427
+ if (cycleSeqOrder(notifSeq, mark) === 'before') {
371
428
  staleBlocked = true;
372
429
  debug(`[fleet-frame] bg_notification stale-cycle ignored(watermark=${mark} notif-seq=${notifSeq})`);
373
430
  }
@@ -377,56 +434,39 @@ export function createFleetLedger(hooks = {}, opts = {}) {
377
434
  if (!known)
378
435
  continue;
379
436
  const heldGen = wireCycleSeq(known);
380
- if (notifSeq !== undefined && heldGen !== undefined && notifSeq < heldGen) {
437
+ if (cycleSeqOrder(notifSeq, heldGen) === 'before') {
381
438
  staleBlocked = true;
382
439
  debug(`[fleet-frame] bg_notification stale-cycle ignored(row=${id} row-cycle=${heldGen} notif-seq=${notifSeq})`);
383
440
  continue;
384
441
  }
385
- const rowStatus = known.status ?? '';
386
- if (TERMINAL_FLEET_TASK_STATUSES.has(rowStatus)) {
387
- if (isWashGreen(rowStatus, n.status)) {
388
- washBlocked = true;
389
- debug(`[fleet-frame] bg_notification WASH-GREEN blocked(row=${id} row-status=${rowStatus} notif=${n.status})`);
390
- continue;
391
- }
392
- if (rowStatus !== n.status) {
393
- const upgraded = { ...known, status: coerced };
394
- retained.set(id, { row: upgraded, expireAt: nowMs + TERMINAL_RETAIN_MS });
395
- taskMap.set(id, upgraded);
396
- }
397
- writtenIds.add(id);
398
- applied = true;
399
- }
400
- else {
401
- const started = known.startedAt;
402
- const meta = rowMeta.get(id);
403
- const frozenElapsed = typeof started === 'number' && started > 0 && started <= nowMs
404
- ? nowMs - started
405
- : meta !== undefined && isElapsedBase(known.elapsedMs)
406
- ? known.elapsedMs + Math.max(0, nowMs - meta.receivedAtMs)
407
- : known.elapsedMs;
408
- taskMap.delete(id);
409
- rowMeta.delete(id);
410
- retained.set(id, {
411
- row: {
412
- ...known,
413
- status: coerced,
414
- ...(typeof frozenElapsed === 'number' ? { elapsedMs: frozenElapsed } : {}),
415
- },
416
- expireAt: nowMs + TERMINAL_RETAIN_MS,
417
- retiredByNotification: true,
418
- });
419
- writtenIds.add(id);
420
- applied = true;
421
- }
442
+ const started = known.startedAt;
443
+ const meta = rowMeta.get(id);
444
+ const frozenElapsed = typeof started === 'number' && started > 0 && started <= nowMs
445
+ ? nowMs - started
446
+ : meta !== undefined && isElapsedBase(known.elapsedMs)
447
+ ? known.elapsedMs + Math.max(0, nowMs - meta.receivedAtMs)
448
+ : known.elapsedMs;
449
+ taskMap.delete(id);
450
+ rowMeta.delete(id);
451
+ retained.set(id, {
452
+ row: {
453
+ ...known,
454
+ status: coerced,
455
+ ...(typeof frozenElapsed === 'number' ? { elapsedMs: frozenElapsed } : {}),
456
+ },
457
+ expireAt: nowMs + TERMINAL_RETAIN_MS,
458
+ retiredByNotification: true,
459
+ });
460
+ writtenIds.add(id);
461
+ applied = true;
422
462
  }
423
463
  for (const [id, entry] of retained) {
424
464
  if (writtenIds.has(id))
425
465
  continue;
426
- if (id !== n.taskId && rowIdTail(id) !== n.taskId)
466
+ if (rowIdTail(id) !== notifTail)
427
467
  continue;
428
468
  const retainedGen = wireCycleSeq(entry.row);
429
- if (notifSeq !== undefined && retainedGen !== undefined && notifSeq < retainedGen) {
469
+ if (cycleSeqOrder(notifSeq, retainedGen) === 'before') {
430
470
  staleBlocked = true;
431
471
  debug(`[fleet-frame] bg_notification stale-cycle ignored(retained=${id} row-cycle=${retainedGen} notif-seq=${notifSeq})`);
432
472
  continue;
@@ -452,16 +492,18 @@ export function createFleetLedger(hooks = {}, opts = {}) {
452
492
  (applied ||
453
493
  (!washBlocked &&
454
494
  (() => {
455
- const prior = getBgTerminalFacts(n.taskId);
456
- if (prior === undefined)
457
- return true;
458
- if (notifSeq !== undefined && prior.cycleSeq !== undefined) {
459
- if (notifSeq < prior.cycleSeq)
495
+ for (const prior of [getBgTerminalFacts(n.taskId), settledTerminal.get(notifTail)]) {
496
+ if (prior === undefined)
497
+ continue;
498
+ const order = cycleSeqOrder(notifSeq, prior.cycleSeq);
499
+ if (order === 'before')
500
+ return false;
501
+ if (order === 'after')
502
+ continue;
503
+ if (isWashGreen(prior.status, n.status))
460
504
  return false;
461
- if (notifSeq > prior.cycleSeq)
462
- return true;
463
505
  }
464
- return !isWashGreen(prior.status, n.status);
506
+ return true;
465
507
  })()));
466
508
  if (factsAccepted)
467
509
  raiseCycleWatermark(n.taskId, notifSeq);
@@ -487,17 +529,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
487
529
  debug(`[fleet-frame] bg_notification state-plane rejected as wash-green echo(taskId=${n.taskId} notif=${n.status})—— 通知面照常入队`);
488
530
  }
489
531
  }
490
- try {
491
- const out = hooks.onBgNotificationAccepted?.(n, rowIds, evidence);
492
- if (out && typeof out.then === 'function') {
493
- void Promise.resolve(out).catch((e) => {
494
- hostLog('debug', `[fleet-frame] onBgNotificationAccepted hook rejected: ${String(e).slice(0, 160)}`);
495
- });
496
- }
497
- }
498
- catch (e) {
499
- hostLog('debug', `[fleet-frame] onBgNotificationAccepted hook threw: ${String(e).slice(0, 160)}`);
500
- }
532
+ invokeHostCallbackIsolated('[fleet-frame] onBgNotificationAccepted hook', () => hooks.onBgNotificationAccepted?.(n, rowIds, evidence));
501
533
  enqueueBgChildNotification({
502
534
  taskId: n.taskId,
503
535
  status: n.status,
@@ -508,8 +540,6 @@ export function createFleetLedger(hooks = {}, opts = {}) {
508
540
  function project(nowMs, opts) {
509
541
  const viewingTaskId = opts.viewingTaskId;
510
542
  const liveRows = [...taskMap.values()].map(r => {
511
- if (TERMINAL_FLEET_TASK_STATUSES.has(r.status ?? ''))
512
- return r;
513
543
  const started = r.startedAt;
514
544
  if (typeof started === 'number' && started > 0 && started <= nowMs) {
515
545
  return { ...r, elapsedMs: nowMs - started };
@@ -603,6 +633,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
603
633
  wfMap.clear();
604
634
  rowMeta.clear();
605
635
  retained.clear();
636
+ settledTerminal.clear();
606
637
  contentAnchorSet = false;
607
638
  contentAnchor = undefined;
608
639
  debug(`[fleet-frame] 会话锚变更(${from ?? '-'} → ${to ?? '-'})⇒ 清上一会话的行/留存` +
@@ -10,7 +10,6 @@ export interface FleetTaskView {
10
10
  elapsedMs?: number;
11
11
  tokens?: number;
12
12
  tokenDir: 'down' | 'up';
13
- queuedCount?: number;
14
13
  awaitingPlanApproval: boolean;
15
14
  descendantCount: number;
16
15
  viewed: boolean;
@@ -31,6 +30,7 @@ export interface FleetTaskView {
31
30
  }>;
32
31
  cycleSeq?: number;
33
32
  retiredBy?: string;
33
+ workspaceSnapshot?: 'failed';
34
34
  }
35
35
  export interface FleetRowUsage {
36
36
  totalTokens?: number;
@@ -51,9 +51,7 @@ export interface FleetWorkflowView {
51
51
  tokens?: number;
52
52
  failedCount?: number;
53
53
  startedCount?: number;
54
- errorCode?: string;
55
54
  }
56
- export declare const TERMINAL_FLEET_TASK_STATUSES: ReadonlySet<string>;
57
55
  export declare function coerceTaskStatus(s: string): FleetTaskStatus;
58
56
  export declare function coerceWorkflowStatus(s: string | undefined): FleetTaskStatus;
59
57
  export declare const CONTROL_TOOL_VERBS: ReadonlySet<string>;
@@ -1,12 +1,8 @@
1
1
  import { collapseLabel, escapeDisplayControlChars, taskDescFromName } from '../fleetTaskDesc.js';
2
2
  import { rowIdTail } from '../workflow.js';
3
+ import { cycleSeqValue } from '../cycleOrder.js';
3
4
  import { frozenSet } from '../frozenSet.js';
4
5
  import { CORE_RESERVED_AGENT_NAMES } from '../generated/engineFactTables.js';
5
- export const TERMINAL_FLEET_TASK_STATUSES = frozenSet([
6
- 'completed',
7
- 'failed',
8
- 'killed',
9
- ]);
10
6
  export function coerceTaskStatus(s) {
11
7
  switch (s) {
12
8
  case 'queued':
@@ -130,13 +126,15 @@ function wireStoppedBy(r) {
130
126
  return typeof v === 'string' && v.length > 0 ? v : undefined;
131
127
  }
132
128
  export function wireCycleSeq(r) {
133
- const v = r.cycleSeq;
134
- return typeof v === 'number' && Number.isInteger(v) && v > 0 ? v : undefined;
129
+ return cycleSeqValue(r.cycleSeq);
135
130
  }
136
131
  function wireRetiredBy(r) {
137
132
  const v = r.retiredBy;
138
133
  return typeof v === 'string' && v.length > 0 ? v : undefined;
139
134
  }
135
+ function wireWorkspaceSnapshot(r) {
136
+ return r.workspaceSnapshot === 'failed' ? 'failed' : undefined;
137
+ }
140
138
  export function wireResumable(r) {
141
139
  return typeof r.resumable === 'boolean' ? r.resumable : undefined;
142
140
  }
@@ -172,6 +170,7 @@ export function projectTasks(allRows, opts) {
172
170
  const editedFiles = wireEditedFiles(r);
173
171
  const cycleSeq = wireCycleSeq(r);
174
172
  const retiredBy = wireRetiredBy(r);
173
+ const workspaceSnapshot = wireWorkspaceSnapshot(r);
175
174
  const task = {
176
175
  id: r.id,
177
176
  name: deriveAgentLabel(r.agentType, r.agentName, r.name, r.id),
@@ -182,7 +181,6 @@ export function projectTasks(allRows, opts) {
182
181
  ...wireNumberKey('elapsedMs', wireDuration(r.elapsedMs)),
183
182
  ...wireNumberKey('tokens', wireCount(r.tokens)),
184
183
  tokenDir: 'down',
185
- ...wireNumberKey('queuedCount', wireCount(r.queuedCount)),
186
184
  awaitingPlanApproval: r.awaitingPlanApproval ?? false,
187
185
  descendantCount: childCount.get(r.id) ?? 0,
188
186
  viewed: viewingTaskId !== undefined && rowIdTail(r.id) === viewingTaskId,
@@ -197,6 +195,7 @@ export function projectTasks(allRows, opts) {
197
195
  ...(editedFiles !== undefined ? { editedFiles } : {}),
198
196
  ...(cycleSeq !== undefined ? { cycleSeq } : {}),
199
197
  ...(retiredBy !== undefined ? { retiredBy } : {}),
198
+ ...(workspaceSnapshot !== undefined ? { workspaceSnapshot } : {}),
200
199
  };
201
200
  return task;
202
201
  });
@@ -213,7 +212,6 @@ function wireNumberKey(key, v) {
213
212
  export function projectWorkflows(rows) {
214
213
  return rows.map(r => {
215
214
  const startedCount = wireStartedCount(r);
216
- const errorCode = wireErrorCode(r);
217
215
  return {
218
216
  id: r.id,
219
217
  name: collapseLabel(r.name ?? '') || 'Dynamic workflow',
@@ -225,14 +223,9 @@ export function projectWorkflows(rows) {
225
223
  ...wireNumberKey('tokens', wireCount(r.tokens)),
226
224
  ...wireNumberKey('failedCount', wireCount(r.failedCount)),
227
225
  ...(startedCount !== undefined ? { startedCount } : {}),
228
- ...(errorCode !== undefined ? { errorCode } : {}),
229
226
  };
230
227
  });
231
228
  }
232
- function wireErrorCode(r) {
233
- const v = r.errorCode;
234
- return typeof v === 'string' && v.length > 0 ? v : undefined;
235
- }
236
229
  const FLEET_TASK_VIEW_KEY_TUPLE = [
237
230
  'id',
238
231
  'name',
@@ -243,7 +236,6 @@ const FLEET_TASK_VIEW_KEY_TUPLE = [
243
236
  'elapsedMs',
244
237
  'tokens',
245
238
  'tokenDir',
246
- 'queuedCount',
247
239
  'awaitingPlanApproval',
248
240
  'descendantCount',
249
241
  'viewed',
@@ -258,6 +250,7 @@ const FLEET_TASK_VIEW_KEY_TUPLE = [
258
250
  'editedFiles',
259
251
  'cycleSeq',
260
252
  'retiredBy',
253
+ 'workspaceSnapshot',
261
254
  ];
262
255
  export const FLEET_TASK_VIEW_KEYS = FLEET_TASK_VIEW_KEY_TUPLE;
263
256
  const FLEET_WORKFLOW_VIEW_KEY_TUPLE = [
@@ -271,7 +264,6 @@ const FLEET_WORKFLOW_VIEW_KEY_TUPLE = [
271
264
  'tokens',
272
265
  'failedCount',
273
266
  'startedCount',
274
- 'errorCode',
275
267
  ];
276
268
  export const FLEET_WORKFLOW_VIEW_KEYS = FLEET_WORKFLOW_VIEW_KEY_TUPLE;
277
269
  const FLEET_TASK_ROW_WIRE_KEY_TUPLE = [
@@ -300,6 +292,7 @@ const FLEET_TASK_ROW_WIRE_KEY_TUPLE = [
300
292
  'editedFiles',
301
293
  'cycleSeq',
302
294
  'retiredBy',
295
+ 'workspaceSnapshot',
303
296
  ];
304
297
  export const FLEET_TASK_ROW_WIRE_KEYS = FLEET_TASK_ROW_WIRE_KEY_TUPLE;
305
298
  const FLEET_WORKFLOW_ROW_WIRE_KEY_TUPLE = [
@@ -319,9 +312,9 @@ export const FLEET_TASK_ROW_KEYS_NOT_PROJECTED = {
319
312
  sourceLane: {
320
313
  kind: 'by-design',
321
314
  owner: 'client-core 规范重构轮',
322
- reason: 'SDK 3.0.0 新键([2070]① 让位半场:前台 delegation 复合 id 行带 "run-leg" 标)。两仓现零消费面 ——' +
323
- '#95 纪律:没人读的键不盲投。已知潜在消费方=壳 wf-panel 的双生行过滤(现走 taskId 台账补偿),' +
324
- '若迁到本键判别则届时投影并删本条(那是行为改动,单独批)。',
315
+ reason: 'SDK 3.0.0 新键([2070]① 让位半场:前台 delegation 复合 id 行带 "run-leg" 标)。**渲染视图**(FleetTaskView)不投 —— 渲染面没有按车道分支的需求,' +
316
+ '#95 纪律:没人读的键不盲投。🆕 0.96.0 CC-643 起它有了消费者,但住在另一张读面:在飞 bg 读面行(EngineActiveBgTask)投了它,' +
317
+ '「这一行是不是后台子代」的单一判定口 isBackgroundSubagentRow 读它(见 fleet/bgSubagentRow.ts);视图不投的理由不变,不是第二份真源。',
325
318
  },
326
319
  agentType: {
327
320
  kind: 'by-design',
@@ -337,6 +330,13 @@ export const FLEET_TASK_ROW_KEYS_NOT_PROJECTED = {
337
330
  owner: 'client-core 规范重构轮',
338
331
  reason: '同 agentType:两位在本层合成一个身份 label,分开带出去等于把 187 的 tjl 规则推给每个消费端各写一遍。',
339
332
  },
333
+ queuedCount: {
334
+ kind: 'by-design',
335
+ owner: 'client-core 0.95.0 CC-388',
336
+ reason: '幻影键:sdk 行型仍声明它,但任何 server 版本都不发(生产侧已整只删除,零生产者,契约里也从没列过)。' +
337
+ '投影一个永远缺席的可选位 = 假线索(读者以为「队列深度已经报了」),所以视图上不留位。' +
338
+ 'sdk 在下一个 major 删掉这条声明的同批,本条与 `FLEET_TASK_ROW_WIRE_KEYS` 的 `queuedCount` 一起删;真要队列深度 = 带生产者的新键,不是复活这一个。',
339
+ },
340
340
  workflowRunId: {
341
341
  kind: 'by-design',
342
342
  owner: 'client-core 规范重构轮',
@@ -1,20 +1,7 @@
1
- export interface FleetAgentRowLike {
2
- id: string;
3
- name?: string;
4
- description?: string;
5
- status?: string;
6
- tokens?: number;
7
- toolUses?: number;
8
- transcriptId?: string;
9
- currentTool?: {
10
- toolName: string;
11
- target?: string;
12
- };
13
- startedAt?: number;
14
- cycleSeq?: number;
15
- parentToolCallId?: string;
16
- }
17
- export declare const ABSENT_SETTLE_MS = 30000;
1
+ import { ABSENT_SETTLE_MS } from './panelReduce.js';
2
+ import type { FleetAgentRowLike } from './fleetAgentRowLike.js';
3
+ export type { FleetAgentRowLike };
4
+ export { ABSENT_SETTLE_MS };
18
5
  export declare function resetFleetAgentPanelProjection(): void;
19
6
  export declare function resetFleetAgentPanelProjectionFor(sessionKey: string): void;
20
7
  export declare function fleetAgentProjectionSize(): number;