@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
@@ -4,9 +4,11 @@ import { putOwnKey, readFrameStringKey } from '../../ownKey.js';
4
4
  import { REDACTION_MARKER_PREFIX, washCredentials } from '../../displayUntrusted.js';
5
5
  import { readEffectiveReasoning, readEffectiveMemoryScopes } from '../../effectiveFacts.js';
6
6
  import { isReviewPark, readRunTerminal, runTerminalCode, runTerminalGateToolName, } from '../../runTerminal.js';
7
+ import { doneResultView } from '../../replayBody.js';
7
8
  import { toCcModelUsage } from './turnUsageToModelUsage.js';
8
9
  import { LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, OUTPUT_INVALID, isCorruptSessionCode, isRewindFamilyCode, } from '../../engineErrorCodes.js';
9
10
  import { corruptSessionContent } from '../../corruptSessionCopy.js';
11
+ import { runBlockedText } from '../../promptBlockedCopy.js';
10
12
  import { abortCauseNoteOf, readAbortCause } from '../../runCancelContext.js';
11
13
  function withTerminalNote(text, code, frame) {
12
14
  const withCorrupt = isCorruptSessionCode(code) ? `${text}\n${corruptSessionContent()}` : text;
@@ -79,6 +81,11 @@ function permissionDenialParts(stats, observed) {
79
81
  const hr = stats?.humanReview;
80
82
  const gatesRaw = hr !== null && typeof hr === 'object' ? hr.gates : undefined;
81
83
  const denials = [];
84
+ const mergedKindOf = (callId) => (denialKindByCallId?.has(callId) === true ? denialKindByCallId.get(callId) : undefined);
85
+ const settledAsAbort = (callId) => {
86
+ const k = mergedKindOf(callId);
87
+ return isCcToolDenialKind(k) && !isCcToolDenialKindADenial(k);
88
+ };
82
89
  const gates = Array.isArray(gatesRaw) ? gatesRaw : [];
83
90
  let complete = Array.isArray(gatesRaw);
84
91
  for (const g of gates) {
@@ -100,6 +107,8 @@ function permissionDenialParts(stats, observed) {
100
107
  const toolName = nonEmptyStr(row.toolName);
101
108
  const toolArg = nonEmptyStr(row.toolArg);
102
109
  const toolUseId = nonEmptyStr(row.toolCallId);
110
+ if (toolUseId !== undefined && settledAsAbort(toolUseId))
111
+ continue;
103
112
  const rawInput = row.toolInput;
104
113
  const ledgerInput = rawInput !== null && typeof rawInput === 'object' && !Array.isArray(rawInput)
105
114
  ? rawInput
@@ -151,9 +160,9 @@ function permissionDenialParts(stats, observed) {
151
160
  for (const [callId, toolNameRaw] of deniedToolNameByCallId) {
152
161
  if (typeof callId !== 'string' || callId.length === 0 || ledgerDeniedIds.has(callId))
153
162
  continue;
154
- const mergedKind = denialKindByCallId?.has(callId) === true ? denialKindByCallId.get(callId) : undefined;
155
- if (isCcToolDenialKind(mergedKind) && !isCcToolDenialKindADenial(mergedKind))
163
+ if (settledAsAbort(callId))
156
164
  continue;
165
+ const mergedKind = mergedKindOf(callId);
157
166
  if (ledgerHasIdlessDenial) {
158
167
  complete = false;
159
168
  continue;
@@ -178,7 +187,8 @@ function permissionDenialParts(stats, observed) {
178
187
  complete = false;
179
188
  }
180
189
  const ccList = denials.filter((d) => d.tool_name !== undefined && d.tool_use_id !== undefined && d.tool_input !== undefined);
181
- const claimable = complete && ccList.length === denials.length;
190
+ const streamCoversRun = observed?.streamSawRunOpen === true && observed.deniedToolNameByCallId !== undefined;
191
+ const claimable = complete && ccList.length === denials.length && streamCoversRun;
182
192
  const zeroOutputDenied = denials.length > 0 && observed?.streamSawRunOpen === true && observed.successfulToolEndObserved === false;
183
193
  return {
184
194
  permission_denials: ccList,
@@ -511,14 +521,16 @@ function errorResult(ctx, parts) {
511
521
  });
512
522
  }
513
523
  export function doneToSdkResult(ev, ctx, observed) {
514
- const rRaw = ev.result;
524
+ const view = doneResultView(ev.result);
525
+ const rRaw = view.engine;
515
526
  const rec = typeof rRaw === 'object' && rRaw !== null ? rRaw : {};
516
527
  const r = rec;
517
528
  const stats = r.stats;
518
- const echoedSid = r.sessionId;
529
+ const nestedSid = r.sessionId;
530
+ const echoedSid = typeof nestedSid === 'string' && nestedSid.length > 0 ? nestedSid : view.row?.sessionId;
519
531
  if (typeof echoedSid === 'string' && echoedSid.length > 0)
520
532
  ctx.sessionId = echoedSid;
521
- const terminal = readRunTerminal(rRaw);
533
+ const terminal = readRunTerminal(ev.result);
522
534
  const durationMs = elapsedMs(ctx);
523
535
  const errorCode = runTerminalCode(terminal);
524
536
  const degraded = degradedOf(r);
@@ -548,15 +560,10 @@ export function doneToSdkResult(ev, ctx, observed) {
548
560
  });
549
561
  }
550
562
  if (terminal?.kind === 'blocked') {
551
- const blockedReason = terminal.reason;
552
563
  return errorResult(ctx, {
553
564
  ...errorBase,
554
565
  subtype: 'error_during_execution',
555
- errors: [
556
- blockedReason !== undefined
557
- ? `Run blocked: ${blockedReason}`
558
- : 'Run blocked (the agent reported it cannot proceed)',
559
- ],
566
+ errors: [runBlockedText(terminal)],
560
567
  });
561
568
  }
562
569
  if (terminal?.kind === 'paused') {
@@ -3,13 +3,15 @@ import { eventToSdkMessage, turnEndUsage } from './downstream/eventToSdkMessage.
3
3
  import { turnUsageToModelUsage } from './downstream/turnUsageToModelUsage.js';
4
4
  import { readRunCostFacts, terminalToSdkResult, TOOL_INPUT_JOIN_MAX_CALLS } from './downstream/terminalToSdkResult.js';
5
5
  import { coerceOutput, publishSubagentContentEvent } from '../subagentContentStore.js';
6
- import { ACTIVE_RUN_BUSY_ERROR_CODE, OUTPUT_INVALID, isCorruptSessionCode, isLimitsExceededCode } from '../engineErrorCodes.js';
6
+ import { OUTPUT_INVALID, activeRunBusyCarrierOf, classifyActiveRunBusy, isCorruptSessionCode, isLimitsExceededCode } from '../engineErrorCodes.js';
7
+ import { doneResultView } from '../replayBody.js';
7
8
  import { corruptSessionContent } from '../corruptSessionCopy.js';
8
9
  import { abortCauseNoteOf } from '../runCancelContext.js';
9
10
  import { classifyToolHistoryMismatch, noteToolHistoryTerminal, openToolHistoryGeneration, TOOL_HISTORY_REWIND_SENTENCE, toolHistoryMismatchRowKey, toolHistoryRepeatSentence, toolHistoryRewindOffered, } from '../toolHistoryMismatch.js';
10
11
  import { isReviewPark, readRunTerminal, runTerminalCode } from '../runTerminal.js';
11
12
  import { providerRejectionResend } from '../providerRejection.js';
12
13
  import { washCredentials } from '../displayUntrusted.js';
14
+ import { PROMPT_BLOCKED_BY_HOOK_ROW_LEAD, runBlockedText } from '../promptBlockedCopy.js';
13
15
  import { ccToolDenialKindForToolEnd, gateDeniedBy, gateOutcomeOf } from '../gateOutcome.js';
14
16
  import { resumeReopenContent, resumeReopenFromError, suspendedReopenOf } from '../hitl/suspendedReopen.js';
15
17
  import { isCcToolDenialKind, isCcToolDenialKindADenial, isGateDeniedByWord } from '../gateVocabulary.js';
@@ -52,30 +54,10 @@ export function pendingGateIsProvablyDifferent(prev, next) {
52
54
  return a !== b;
53
55
  }
54
56
  export function activeRunBusySignal(ev) {
55
- if (typeof ev !== 'object' || ev === null || !('type' in ev))
56
- return null;
57
- const type = ev.type;
58
- let carrier;
59
- if (type === 'done') {
60
- const result = ev.result;
61
- if (typeof result !== 'object' || result === null)
62
- return null;
63
- if (result.status !== 'failed')
64
- return null;
65
- carrier = result;
66
- }
67
- else if (type === 'failed') {
68
- carrier = ev;
69
- }
70
- else {
71
- return null;
72
- }
73
- const cls = classifyActiveRunBusy({
74
- errorCode: typeof carrier.errorCode === 'string' ? carrier.errorCode : undefined,
75
- activeTaskId: carrier.activeTaskId,
76
- });
77
- if (!cls.busy)
57
+ const read = busyReadOfFrame(ev);
58
+ if (read === null || !read.cls.busy)
78
59
  return null;
60
+ const { carrier, cls } = read;
79
61
  const status = carrier.activeTaskStatus;
80
62
  const rawGate = carrier.pendingGate;
81
63
  let pendingGate = null;
@@ -99,19 +81,22 @@ export function activeRunBusySignal(ev) {
99
81
  ...(typeof msIdle === 'number' && Number.isFinite(msIdle) && msIdle >= 0 ? { msSinceLastActivity: msIdle } : {}),
100
82
  };
101
83
  }
102
- function classifyActiveRunBusy(input) {
103
- const handle = typeof input.activeTaskId === 'string' && input.activeTaskId.length > 0 ? input.activeTaskId : null;
104
- if (input.errorCode === ACTIVE_RUN_BUSY_ERROR_CODE)
105
- return { busy: true, handle };
106
- if (typeof input.activeTaskId === 'string')
107
- return { busy: true, handle };
108
- return { busy: false, handle };
84
+ function busyReadOfFrame(ev, doneTerminal, preReadActiveTaskId) {
85
+ const carrier = activeRunBusyCarrierOf(ev);
86
+ if (carrier === null)
87
+ return null;
88
+ const isDone = ev.type === 'done';
89
+ const terminal = isDone ? (doneTerminal !== undefined ? doneTerminal : readRunTerminal(ev.result)) : null;
90
+ const flatCode = typeof carrier.errorCode === 'string' ? carrier.errorCode : undefined;
91
+ const activeTaskId = preReadActiveTaskId !== undefined ? preReadActiveTaskId.value : carrier.activeTaskId;
92
+ const cls = classifyActiveRunBusy({ errorCode: (isDone ? runTerminalCode(terminal) : undefined) ?? flatCode, activeTaskId });
93
+ return { carrier, cls };
109
94
  }
110
95
  export const RUN_STOPPED_MESSAGE_PREFIX = 'Run stopped';
111
96
  export const RUN_BLOCKED_MESSAGE_PREFIX = 'Run blocked';
112
97
  export function isGovernanceStopRowText(text) {
113
98
  const t = text.trimStart();
114
- return t.startsWith(`${RUN_STOPPED_MESSAGE_PREFIX}:`) || t.startsWith(`${RUN_BLOCKED_MESSAGE_PREFIX}`);
99
+ return t.startsWith(`${RUN_STOPPED_MESSAGE_PREFIX}:`) || t.startsWith(`${RUN_BLOCKED_MESSAGE_PREFIX}`) || t.startsWith(PROMPT_BLOCKED_BY_HOOK_ROW_LEAD);
115
100
  }
116
101
  export const MODEL_OUTPUT_ERROR_PREFIX = 'Model output error';
117
102
  export function isModelOutputErrorText(text) {
@@ -132,13 +117,17 @@ function syntheticTerminalRow(ctx, text, historyKey, resend) {
132
117
  parent_tool_use_id: null,
133
118
  _sema_api_error_message: true,
134
119
  ...(historyKey !== undefined ? { _sema_tool_history_mismatch: historyKey } : {}),
135
- ...(resend !== undefined ? { _sema_provider_rejection_resend: { resend: resend.resend, text: resend.text } } : {}),
120
+ ...(resend !== undefined ? { _sema_provider_rejection_resend: { resend: resend.resend, text: resend.text, kind: resend.kind } } : {}),
136
121
  });
137
122
  }
138
123
  function engineRunIdOf(result) {
139
124
  const v = result?.runId;
140
125
  return typeof v === 'string' && v.length > 0 ? v : undefined;
141
126
  }
127
+ function engineResultOf(result) {
128
+ const v = doneResultView(result);
129
+ return v.replay ? (v.engine ?? result) : result;
130
+ }
142
131
  function engineSessionIdOf(result) {
143
132
  const v = result?.sessionId;
144
133
  return typeof v === 'string' && v.length > 0 ? v : undefined;
@@ -160,19 +149,14 @@ function terminalRowFacts(ev) {
160
149
  : doneTerminal?.kind === 'failed'
161
150
  ? (doneTerminal.message ?? doneTerminal.code ?? 'run failed')
162
151
  : doneTerminal?.kind === 'blocked'
163
- ? (doneTerminal.reason
164
- ? `Run blocked: ${doneTerminal.reason}`
165
- : 'Run blocked (the agent reported it cannot proceed)')
152
+ ? runBlockedText(doneTerminal)
166
153
  : null;
167
154
  const errText = errTextRaw === '' ? null : errTextRaw;
168
155
  if (errText === null)
169
156
  return { doneTerminal, errText, activeTaskId: undefined, busy: { busy: false, handle: null }, governance: false };
170
157
  const activeTaskId = (ev.type === 'done' ? ev.result?.activeTaskId : undefined) ??
171
158
  (ev.type === 'failed' ? ev.activeTaskId : undefined);
172
- const busy = classifyActiveRunBusy({
173
- errorCode: ev.type === 'failed' ? ev.errorCode : runTerminalCode(doneTerminal),
174
- activeTaskId,
175
- });
159
+ const busy = busyReadOfFrame(ev, doneTerminal, { value: activeTaskId })?.cls ?? { busy: false, handle: null };
176
160
  const governance = isGovernanceTerminal({
177
161
  status: ev.type === 'failed' ? undefined : doneTerminal?.kind === 'blocked' ? 'blocked' : undefined,
178
162
  errorCode: ev.type === 'failed' ? ev.errorCode : runTerminalCode(doneTerminal),
@@ -283,7 +267,7 @@ function apiErrorTerminalFromFacts(x, facts) {
283
267
  return none();
284
268
  if (type === 'failed')
285
269
  return { carrier: mintToolHistoryCarrier(nonEmptyStr(ownDataBit(x, 'errorCode')), undefined, nonEmptyStr(ownDataBit(x, 'errorMessage'))), detail: undefined };
286
- const result = type === 'done' ? plainObjectOf(ownDataBit(x, 'result')) : x;
270
+ const result = type === 'done' ? plainObjectOf(engineResultOf(ownDataBit(x, 'result'))) : x;
287
271
  if (result === undefined)
288
272
  return none();
289
273
  const snap = ownTerminalSnapshot(result);
@@ -666,12 +650,12 @@ async function* runStreamInner(events, ctx, handle = {}) {
666
650
  const abortNote = abortCauseNoteOf(ev);
667
651
  const historyTerminal = apiErrorTerminalOfRowFrame(ev, rowFacts);
668
652
  const historyMismatch = classifyToolHistoryMismatch(historyTerminal.carrier);
669
- const historyEchoedSid = ev.type === 'done' ? engineSessionIdOf(ev.result) : undefined;
653
+ const historyEchoedSid = ev.type === 'done' ? engineSessionIdOf(engineResultOf(ev.result)) : undefined;
670
654
  const historyRepeat = noteToolHistoryTerminal({
671
655
  sessionId: historyEchoedSid ?? ctx.sessionId,
672
656
  sessionEchoed: historyEchoedSid !== undefined,
673
657
  generation: historyGeneration,
674
- runId: ev.type === 'done' ? engineRunIdOf(ev.result) : undefined,
658
+ runId: ev.type === 'done' ? engineRunIdOf(engineResultOf(ev.result)) : undefined,
675
659
  replay: ev.type === 'done' && ev.replay === true,
676
660
  mismatch: historyMismatch,
677
661
  });
@@ -684,12 +668,12 @@ async function* runStreamInner(events, ctx, handle = {}) {
684
668
  yield syntheticTerminalRow(ctx, `${sessionUnreadable ? `${rowText}\n${corruptSessionContent()}` : rowText}${abortNote !== undefined ? `\n${abortNote}` : ''}${rewindLine}${resendLine}`, historyMismatch === null ? undefined : toolHistoryMismatchRowKey(historyMismatch, historyRepeat, rewindOffered), resend);
685
669
  }
686
670
  else {
687
- const echoedSid = ev.type === 'done' ? engineSessionIdOf(ev.result) : undefined;
671
+ const echoedSid = ev.type === 'done' ? engineSessionIdOf(engineResultOf(ev.result)) : undefined;
688
672
  noteToolHistoryTerminal({
689
673
  sessionId: echoedSid ?? ctx.sessionId,
690
674
  sessionEchoed: echoedSid !== undefined,
691
675
  generation: historyGeneration,
692
- runId: ev.type === 'done' ? engineRunIdOf(ev.result) : undefined,
676
+ runId: ev.type === 'done' ? engineRunIdOf(engineResultOf(ev.result)) : undefined,
693
677
  replay: ev.type === 'done' && ev.replay === true,
694
678
  mismatch: null,
695
679
  });
@@ -701,7 +685,7 @@ async function* runStreamInner(events, ctx, handle = {}) {
701
685
  catch { }
702
686
  }
703
687
  if (ev.type === 'done' && ctx.emitChrome) {
704
- const doneStats = ev.result?.stats;
688
+ const doneStats = engineResultOf(ev.result)?.stats;
705
689
  const costFacts = readRunCostFacts(doneStats, { usageMissingObserved });
706
690
  if (costFacts !== undefined) {
707
691
  emitChromeFireAndForget(ctx, { kind: 'run_cost_reconciled', laneProof: mainLane(), ...costFacts.reconcile });
@@ -31,6 +31,13 @@ export declare function stamp<T extends {
31
31
  uuid: string;
32
32
  session_id: string;
33
33
  };
34
+ export interface ToolUseSideChannelsStripped<B extends object> {
35
+ readonly block: Omit<B, 'label' | 'eventId' | 'parentToolCallId'>;
36
+ readonly eventId?: string;
37
+ readonly parentToolCallId?: string;
38
+ readonly label?: string;
39
+ }
40
+ export declare function stripToolUseSideChannels<B extends object>(block: B): ToolUseSideChannelsStripped<B>;
34
41
  export declare const SEGMENT_END_IDENTITY_KEYS: readonly ["parentToolCallId", "sourceTaskId", "bgAgentId"];
35
42
  export declare function isSubFlowSegmentEnd(m: object): boolean;
36
43
  export declare function snapshotSegmentIdentity(m: object): Record<string, unknown> | null;
@@ -14,6 +14,21 @@ export function uuid() {
14
14
  export function stamp(ctx, body) {
15
15
  return { ...body, uuid: body.uuid ?? uuid(), session_id: ctx.sessionId };
16
16
  }
17
+ export function stripToolUseSideChannels(block) {
18
+ const out = { ...block };
19
+ const eventId = typeof out.eventId === 'string' ? out.eventId : undefined;
20
+ const parentToolCallId = typeof out.parentToolCallId === 'string' ? out.parentToolCallId : undefined;
21
+ const label = typeof out.label === 'string' ? out.label : undefined;
22
+ delete out.label;
23
+ delete out.eventId;
24
+ delete out.parentToolCallId;
25
+ return {
26
+ block: out,
27
+ ...(eventId !== undefined ? { eventId } : {}),
28
+ ...(parentToolCallId !== undefined ? { parentToolCallId } : {}),
29
+ ...(label !== undefined ? { label } : {}),
30
+ };
31
+ }
17
32
  export const SEGMENT_END_IDENTITY_KEYS = Object.freeze(['parentToolCallId', 'sourceTaskId', 'bgAgentId']);
18
33
  export function isSubFlowSegmentEnd(m) {
19
34
  const rec = m;
@@ -157,7 +157,11 @@ export function createBackgroundView(client, opts) {
157
157
  }
158
158
  catch (err) {
159
159
  debugLog(`assistant.tasks degrade: ${String(err)}`);
160
- const health = capsApprovals === false || isNotImplemented(err) ? 'not-configured' : 'unavailable';
160
+ const health = capsApprovals === false || isNotImplemented(err)
161
+ ? 'not-configured'
162
+ : isReadCredentialRefusal(err)
163
+ ? 'unauthorized'
164
+ : 'unavailable';
161
165
  return { health, tasks: [] };
162
166
  }
163
167
  }
@@ -1,5 +1,7 @@
1
1
  import { errCodes } from '../controlRouter.js';
2
2
  import { hostLog } from '../host.js';
3
+ import { isSessionIdPathSegment } from '../sessionIdSegment.js';
4
+ import { ownDataField } from '../ownKey.js';
3
5
  const unavailable = (why) => ({
4
6
  kind: 'unavailable',
5
7
  why,
@@ -57,12 +59,12 @@ export function isEngineAgentRegistryListingSuperseded(listing) {
57
59
  return registryListingProvenanceOf(listing)?.superseded === true;
58
60
  }
59
61
  function listFaceOn(caps) {
60
- if (typeof caps !== 'object' || caps === null || !Object.hasOwn(caps, 'background'))
62
+ if (typeof caps !== 'object' || caps === null)
61
63
  return false;
62
- const bg = caps.background;
63
- if (typeof bg !== 'object' || bg === null || !Object.hasOwn(bg, 'listFace'))
64
+ const bg = ownDataField(caps, 'background');
65
+ if (typeof bg !== 'object' || bg === null)
64
66
  return false;
65
- return bg.listFace === true;
67
+ return ownDataField(bg, 'listFace') === true;
66
68
  }
67
69
  function readRow(v) {
68
70
  if (typeof v !== 'object' || v === null || Array.isArray(v))
@@ -95,7 +97,7 @@ export async function readEngineAgentRegistry(client, sessionId, caps, opts) {
95
97
  async function readOnce(client, sessionId, caps, opts) {
96
98
  if (!listFaceOn(caps))
97
99
  return unavailable('no_list_face');
98
- if (typeof sessionId !== 'string' || sessionId.length === 0) {
100
+ if (!isSessionIdPathSegment(sessionId)) {
99
101
  noteReadFailed('bad session id');
100
102
  return unavailable('read_failed');
101
103
  }
@@ -1,12 +1,13 @@
1
- import { engineCapValue } from '../engineCapsCache.js';
1
+ import { engineCapNestedValue } from '../engineCapsCache.js';
2
2
  import { isStatusDerivedCoarseCode } from '../engineErrorCodes.js';
3
3
  import { clientHasVerbs, engineWireFor, INJECTED_WIRE_SETTLE_MS, noAnswerDetailFrom, sendOnce, settleInjected } from '../engineWireFor.js';
4
4
  import { engineWireDebugEnabled } from '../engineWireTarget.js';
5
5
  import { hostLog } from '../host.js';
6
+ import { isSessionIdPathSegment } from '../sessionIdSegment.js';
6
7
  import { wireFailureTextsOf } from '../wireFailureShape.js';
7
8
  import { DEFAULT_SESSION_KEY } from '../sessionSlot.js';
8
9
  const NOTHING_SENT = ' — nothing sent';
9
- const DETAIL_BAD_SESSION = `the session id must be a non-empty string${NOTHING_SENT}`;
10
+ const DETAIL_BAD_SESSION = `the session id must be a non-empty string that is not a dot segment${NOTHING_SENT}`;
10
11
  const DETAIL_BAD_INCLUDE_RETAINED = `includeRetained must be true or false (the engine has no default for it)${NOTHING_SENT}`;
11
12
  const DETAIL_BAD_OPTIONS = `the options could not be read${NOTHING_SENT}`;
12
13
  const DETAIL_BAD_ARGUMENTS = `the arguments could not be read${NOTHING_SENT}`;
@@ -17,6 +18,8 @@ const DETAIL_NO_TARGET = `no engine connection is installed for this session${NO
17
18
  const DETAIL_NO_CLIENT = `an engine client could not be built from the installed connection${NOTHING_SENT}`;
18
19
  const DETAIL_CAPS_KEY_REQUIRED = `capability evidence for background.exitFaces is not available under the key the host named (capsBaseUrl)${NOTHING_SENT}`;
19
20
  const DETAIL_CAPS_UNOBSERVED = `the engine capabilities have not been read for this connection yet — wait for the capability probe to settle, then call again${NOTHING_SENT}`;
21
+ const DETAIL_CAPS_UNREADABLE = `the engine reported its capabilities in a form this client cannot read, so whether it offers the session background stop is unknown — calling again on this connection will not change that${NOTHING_SENT}`;
22
+ const DETAIL_CAPS_UNKNOWN_GENERIC = `whether the engine offers the session background stop is unknown${NOTHING_SENT}`;
20
23
  const DETAIL_NO_EXIT_FACE = `this engine does not offer the session background stop (capabilities.background.exitFaces is not true); background tasks may keep running${NOTHING_SENT}`;
21
24
  function refusedDetail(why) {
22
25
  switch (why) {
@@ -66,22 +69,27 @@ function unavailable(why, detail) {
66
69
  function usableStopClient(client) {
67
70
  return clientHasVerbs(client, [['sessions', 'backgroundStop']]);
68
71
  }
69
- function exitFaceGate(capsKey) {
70
- try {
71
- const v = engineCapValue(capsKey, 'background');
72
- if (v.kind === 'unobserved')
73
- return { why: 'capability_unknown', detail: DETAIL_CAPS_UNOBSERVED };
74
- if (v.kind !== 'value')
75
- return { why: 'no_exit_face', detail: DETAIL_NO_EXIT_FACE };
76
- const bg = v.value;
77
- if (typeof bg !== 'object' || bg === null || !Object.hasOwn(bg, 'exitFaces'))
78
- return { why: 'no_exit_face', detail: DETAIL_NO_EXIT_FACE };
79
- return bg.exitFaces === true ? null : { why: 'no_exit_face', detail: DETAIL_NO_EXIT_FACE };
80
- }
81
- catch {
82
- return { why: 'capability_unknown', detail: DETAIL_CAPS_UNOBSERVED };
72
+ function capsUnknownDetail(reason) {
73
+ switch (reason) {
74
+ case 'unobserved':
75
+ return DETAIL_CAPS_UNOBSERVED;
76
+ case 'unreadable':
77
+ return DETAIL_CAPS_UNREADABLE;
78
+ default: {
79
+ const unreachable = reason;
80
+ void unreachable;
81
+ return DETAIL_CAPS_UNKNOWN_GENERIC;
82
+ }
83
83
  }
84
84
  }
85
+ function exitFaceGate(capsKey) {
86
+ const v = engineCapNestedValue(capsKey, 'background', 'exitFaces');
87
+ if (v.kind === 'unobserved')
88
+ return { why: 'capability_unknown', detail: capsUnknownDetail('unobserved') };
89
+ if (v.kind === 'unreadable')
90
+ return { why: 'capability_unknown', detail: capsUnknownDetail('unreadable') };
91
+ return v.kind === 'value' && v.value === true ? null : { why: 'no_exit_face', detail: DETAIL_NO_EXIT_FACE };
92
+ }
85
93
  function readReceipt(v) {
86
94
  if (typeof v !== 'object' || v === null || Array.isArray(v))
87
95
  return undefined;
@@ -202,7 +210,7 @@ export async function stopEngineSessionBackground(sessionId, body, opts) {
202
210
  let signal;
203
211
  let sessionKey;
204
212
  try {
205
- if (typeof sessionId !== 'string' || sessionId.length === 0)
213
+ if (!isSessionIdPathSegment(sessionId))
206
214
  return unavailable('bad_input', DETAIL_BAD_SESSION);
207
215
  const flag = typeof body === 'object' && body !== null && Object.hasOwn(body, 'includeRetained') ? body.includeRetained : undefined;
208
216
  if (typeof flag !== 'boolean')
@@ -15,6 +15,8 @@ export type TaskAgentWireSkill = {
15
15
  name: string;
16
16
  description: string;
17
17
  content: string;
18
+ allowedTools?: string[];
19
+ disallowedTools?: string[];
18
20
  };
19
21
  export declare const AGENT_MEMORY_WORDS: ReadonlySet<string>;
20
22
  export type TaskAgentWireMemory = {
@@ -1,4 +1,5 @@
1
1
  import { hostEnv } from './hostEnv.js';
2
+ import { ownDataField } from './ownKey.js';
2
3
  import { makeEngineWireClient } from './engineWireSdk.js';
3
4
  import { frozenSet } from './frozenSet.js';
4
5
  import { settleWithinDeadline } from './abortableSleep.js';
@@ -289,7 +290,7 @@ export async function engineSupportsTaskAgents(baseUrl, opts) {
289
290
  if (typeof injected?.capabilities !== 'function')
290
291
  return undefined;
291
292
  const got = await settleWithinDeadline(opts.timeoutMs ?? 3000, (signal) => injected.capabilities({ signal }));
292
- return got.kind === 'value' ? got.value?.taskAgents === true : undefined;
293
+ return got.kind === 'value' ? taskAgentsOf(got.value) : undefined;
293
294
  }
294
295
  const client = makeEngineWireClient({
295
296
  baseUrl,
@@ -302,7 +303,17 @@ export async function engineSupportsTaskAgents(baseUrl, opts) {
302
303
  return undefined;
303
304
  try {
304
305
  const caps = await client.capabilities();
305
- return caps?.taskAgents === true;
306
+ return taskAgentsOf(caps);
307
+ }
308
+ catch {
309
+ return undefined;
310
+ }
311
+ }
312
+ function taskAgentsOf(caps) {
313
+ if (caps === null || typeof caps !== 'object')
314
+ return false;
315
+ try {
316
+ return ownDataField(caps, 'taskAgents') === true;
306
317
  }
307
318
  catch {
308
319
  return undefined;
@@ -12,5 +12,4 @@ export declare function noteEngineCapsForApprovalDecidedBy(baseUrl: string, caps
12
12
  }): void;
13
13
  export declare function observedApprovalDecidedBy(baseUrl?: string | undefined): ApprovalDecidedByReading;
14
14
  export declare function approvalDecidedByAdmitted(reading: ApprovalDecidedByReading | undefined): boolean;
15
- export declare function forgetApprovalDecidedByReading(baseUrl: string | undefined): void;
16
15
  export declare function __resetApprovalDecidedByReadingsForTests(): void;
@@ -1,13 +1,11 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
- import { readOwnDataValue } from './ownKey.js';
3
+ import { ownDataField, readOwnDataValue } from './ownKey.js';
4
4
  export function projectApprovalDecidedByCapability(caps) {
5
5
  try {
6
6
  if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
7
7
  return undefined;
8
- if (!Object.hasOwn(caps, 'approvalDecidedBy'))
9
- return { kind: 'not_reported' };
10
- const v = caps.approvalDecidedBy;
8
+ const v = ownDataField(caps, 'approvalDecidedBy');
11
9
  if (v === undefined)
12
10
  return { kind: 'not_reported' };
13
11
  return v === true ? { kind: 'present', value: true } : undefined;
@@ -39,9 +37,6 @@ export function approvalDecidedByAdmitted(reading) {
39
37
  return false;
40
38
  }
41
39
  }
42
- export function forgetApprovalDecidedByReading(baseUrl) {
43
- reader.forget(baseUrl);
44
- }
45
40
  export function __resetApprovalDecidedByReadingsForTests() {
46
41
  reader.__resetForTests();
47
42
  }
@@ -13,5 +13,4 @@ export declare function noteEngineCapsForApprovalsStreamLive(baseUrl: string, ca
13
13
  export declare function observedApprovalsStreamLive(baseUrl?: string | undefined): ApprovalsStreamLiveReading;
14
14
  export declare function livePendingNeedsReconcile(reading: ApprovalsStreamLiveReading): boolean;
15
15
  export declare function approvalsStreamLiveDoctorDetail(reading: ApprovalsStreamLiveReading): string;
16
- export declare function forgetApprovalsStreamLiveReading(baseUrl: string | undefined): void;
17
16
  export declare function __resetApprovalsStreamLiveReadingsForTests(): void;
@@ -1,14 +1,13 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
+ import { ownDataField } from './ownKey.js';
3
4
  export function projectApprovalsStreamLiveCapability(caps) {
4
5
  try {
5
6
  if (caps === null || typeof caps !== 'object')
6
7
  return undefined;
7
8
  if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
8
9
  return undefined;
9
- if (!Object.hasOwn(caps, 'approvalsStreamLive'))
10
- return { kind: 'not_reported' };
11
- const v = caps.approvalsStreamLive;
10
+ const v = ownDataField(caps, 'approvalsStreamLive');
12
11
  if (v === undefined)
13
12
  return { kind: 'not_reported' };
14
13
  if (typeof v !== 'boolean')
@@ -45,9 +44,6 @@ export function approvalsStreamLiveDoctorDetail(reading) {
45
44
  : 'live approval push off on this deployment (no checkpoint store or tool approvals disabled; the engine reports one bit for both, so this client cannot tell which) — suspended asks are only visible through the reconcile cadence, so the client polls for them';
46
45
  }
47
46
  }
48
- export function forgetApprovalsStreamLiveReading(baseUrl) {
49
- reader.forget(baseUrl);
50
- }
51
47
  export function __resetApprovalsStreamLiveReadingsForTests() {
52
48
  reader.__resetForTests();
53
49
  }
@@ -0,0 +1,8 @@
1
+ export declare function atMostOnceFailureClass(e: unknown): 'rejected' | 'unknown';
2
+ export interface AtMostOnceVerdict {
3
+ readonly delivery: 'rejected' | 'unknown';
4
+ readonly status?: number;
5
+ readonly code?: string;
6
+ readonly name?: string;
7
+ }
8
+ export declare function atMostOnceVerdictOf(e: unknown): AtMostOnceVerdict;
@@ -0,0 +1,36 @@
1
+ import { errCodes, steeringRefusedBeforeEngine, steeringStatusIs4xx } from './controlRouter.js';
2
+ function errorSlot(e, key) {
3
+ if (e === null || e === undefined)
4
+ return undefined;
5
+ try {
6
+ return e[key];
7
+ }
8
+ catch {
9
+ return undefined;
10
+ }
11
+ }
12
+ export function atMostOnceFailureClass(e) {
13
+ const s = atMostOnceSnapshotOf(e);
14
+ if (steeringStatusIs4xx(s))
15
+ return 'rejected';
16
+ return steeringRefusedBeforeEngine(s) !== undefined ? 'rejected' : 'unknown';
17
+ }
18
+ function atMostOnceSnapshotOf(e) {
19
+ return {
20
+ status: errorSlot(e, 'status'),
21
+ statusCode: errorSlot(e, 'statusCode'),
22
+ errorCode: errorSlot(e, 'errorCode'),
23
+ name: errorSlot(e, 'name'),
24
+ };
25
+ }
26
+ export function atMostOnceVerdictOf(e) {
27
+ const snapshot = atMostOnceSnapshotOf(e);
28
+ const delivery = atMostOnceFailureClass(snapshot);
29
+ const { status, code, name } = errCodes(snapshot);
30
+ return {
31
+ delivery,
32
+ ...(status !== undefined ? { status } : {}),
33
+ ...(code !== undefined && code !== '' ? { code } : {}),
34
+ ...(name !== undefined && name !== '' ? { name } : {}),
35
+ };
36
+ }
@@ -7,5 +7,4 @@ export declare function noteEngineCapsForAttachmentSeat(baseUrl: string, caps: u
7
7
  generation?: number;
8
8
  }): void;
9
9
  export declare function observedAttachmentSeat(baseUrl?: string | undefined): AttachmentSeatReading;
10
- export declare function forgetAttachmentSeatReading(baseUrl: string | undefined): void;
11
10
  export declare function __resetAttachmentSeatReadingsForTests(): void;
@@ -19,9 +19,6 @@ export function noteEngineCapsForAttachmentSeat(baseUrl, caps, opts) {
19
19
  export function observedAttachmentSeat(baseUrl = engineWireTarget()?.baseUrl) {
20
20
  return reader.observed(baseUrl);
21
21
  }
22
- export function forgetAttachmentSeatReading(baseUrl) {
23
- reader.forget(baseUrl);
24
- }
25
22
  export function __resetAttachmentSeatReadingsForTests() {
26
23
  reader.__resetForTests();
27
24
  }
@@ -23,8 +23,14 @@ const OPT_IN_KEYS = [
23
23
  'mcpInstructions',
24
24
  ];
25
25
  const DEFAULT_ON_ONLY_KEYS = ['agentListing', 'skillsListing'];
26
- const DEFAULT_PAIR = ['backgroundTasks', 'toolsDelta'];
27
- const _attachmentsKeyPins = [true, true, true, true, true, true];
26
+ const PRODUCT_DEFAULT_KEYS = ['backgroundTasks', 'toolsDelta', 'todoReminder'];
27
+ function productDefaultAttachments() {
28
+ const out = {};
29
+ for (const k of PRODUCT_DEFAULT_KEYS)
30
+ out[k] = true;
31
+ return out;
32
+ }
33
+ const _attachmentsKeyPins = [true, true, true, true, true, true, true];
28
34
  void _attachmentsKeyPins;
29
35
  const TODO_REMINDER_MODES = ['baseline', 'off'];
30
36
  export class AttachmentsSpecRefused extends TypeError {
@@ -61,11 +67,11 @@ function judgeAttachmentsEnv(raw) {
61
67
  return { ok: false, refusal: { kind: 'retired_key', token, why: named.why, entry: i + 1, key: named.key, retired: named } };
62
68
  }
63
69
  if (tokens.length === 0)
64
- return { ok: true, spec: { backgroundTasks: true, toolsDelta: true } };
70
+ return { ok: true, spec: productDefaultAttachments() };
65
71
  if (tokens.length === 1 && (tokens[0] === 'full' || tokens[0] === 'all'))
66
72
  return { ok: true, spec: allLiteralTrue() };
67
73
  if (tokens.length === 1 && !isKnownToken(tokens[0])) {
68
- return { ok: true, spec: { backgroundTasks: true, toolsDelta: true } };
74
+ return { ok: true, spec: productDefaultAttachments() };
69
75
  }
70
76
  const spec = {};
71
77
  for (const [i, token] of tokens.entries()) {
@@ -74,8 +80,7 @@ function judgeAttachmentsEnv(raw) {
74
80
  continue;
75
81
  }
76
82
  if (token === 'default') {
77
- for (const k of DEFAULT_PAIR)
78
- spec[k] = true;
83
+ Object.assign(spec, productDefaultAttachments());
79
84
  continue;
80
85
  }
81
86
  if (token.startsWith('-')) {