@sema-agent/client-core 0.97.1 → 0.99.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 (353) hide show
  1. package/CHANGELOG.md +607 -0
  2. package/README.md +96 -46
  3. package/dist/adapt/arms.d.ts +1 -0
  4. package/dist/adapt/arms.js +188 -53
  5. package/dist/adapt/ids.d.ts +12 -1
  6. package/dist/adapt/ids.js +59 -8
  7. package/dist/adapt/instanceLedger.d.ts +50 -0
  8. package/dist/adapt/instanceLedger.js +147 -0
  9. package/dist/adapt/panelTasks.d.ts +1 -1
  10. package/dist/adapt/panelTasks.js +2 -2
  11. package/dist/adapt/textStream.d.ts +1 -0
  12. package/dist/adapt/textStream.js +24 -7
  13. package/dist/adapt/toolCards.d.ts +27 -5
  14. package/dist/adapt/toolCards.js +39 -6
  15. package/dist/adapt/wireShapes.js +6 -2
  16. package/dist/adapt.d.ts +2 -0
  17. package/dist/adapt.js +8 -3
  18. package/dist/adapter/activeRunSelfHeal.d.ts +9 -3
  19. package/dist/adapter/activeRunSelfHeal.js +205 -313
  20. package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
  21. package/dist/adapter/downstream/eventToSdkMessage.js +77 -36
  22. package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
  23. package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
  24. package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
  25. package/dist/adapter/runStream.js +79 -48
  26. package/dist/adapter/types.d.ts +4 -4
  27. package/dist/adapter/types.js +2 -1
  28. package/dist/agentSession/backgroundView.js +2 -1
  29. package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
  30. package/dist/agentSession/engineAgentRegistryRead.js +12 -13
  31. package/dist/agentSession/engineSessionBackgroundStop.js +16 -8
  32. package/dist/agentsWireCaps.d.ts +8 -11
  33. package/dist/agentsWireCaps.js +196 -194
  34. package/dist/approvalDecidedByCapability.d.ts +0 -4
  35. package/dist/approvalDecidedByCapability.js +0 -6
  36. package/dist/approvalsStreamLiveCapability.d.ts +0 -4
  37. package/dist/approvalsStreamLiveCapability.js +0 -6
  38. package/dist/assistantInbox.d.ts +34 -0
  39. package/dist/assistantInbox.js +118 -0
  40. package/dist/centerWiringCapability.js +9 -1
  41. package/dist/clientSlice.d.ts +0 -9
  42. package/dist/clientSlice.js +0 -3
  43. package/dist/cloudConfigWireCaps.d.ts +5 -3
  44. package/dist/cloudConfigWireCaps.js +106 -64
  45. package/dist/compensations.js +1 -1
  46. package/dist/connectorStatus.d.ts +21 -0
  47. package/dist/connectorStatus.js +112 -0
  48. package/dist/controlRouter.d.ts +18 -3
  49. package/dist/controlRouter.js +106 -67
  50. package/dist/coreValuePorts.d.ts +29 -4
  51. package/dist/coreValuePorts.js +10 -0
  52. package/dist/corruptSessionCopy.d.ts +2 -1
  53. package/dist/corruptSessionCopy.js +3 -3
  54. package/dist/decideReceipt.d.ts +2 -2
  55. package/dist/decideReceipt.js +5 -2
  56. package/dist/declared/supportFloorDeclared.js +3 -3
  57. package/dist/detachWire.js +3 -2
  58. package/dist/deviceExecutorManagementCapability.d.ts +0 -4
  59. package/dist/deviceExecutorManagementCapability.js +0 -6
  60. package/dist/deviceRebind.d.ts +49 -1
  61. package/dist/deviceRebind.js +221 -3
  62. package/dist/devicesFace.d.ts +34 -0
  63. package/dist/devicesFace.js +90 -0
  64. package/dist/displayUntrusted.d.ts +2 -0
  65. package/dist/displayUntrusted.js +253 -76
  66. package/dist/engineAgentAbsence.d.ts +1 -1
  67. package/dist/engineAgentPanelStore.d.ts +12 -4
  68. package/dist/engineAgentPanelStore.js +16 -11
  69. package/dist/engineCapReader.d.ts +2 -5
  70. package/dist/engineCapReader.js +8 -10
  71. package/dist/engineCapsCache.d.ts +12 -0
  72. package/dist/engineCapsCache.js +76 -18
  73. package/dist/engineCapsChange.d.ts +2 -0
  74. package/dist/engineCapsChange.js +9 -0
  75. package/dist/engineClosedSets.d.ts +1 -0
  76. package/dist/engineClosedSets.js +4 -1
  77. package/dist/engineErrorCodes.d.ts +11 -3
  78. package/dist/engineErrorCodes.js +11 -8
  79. package/dist/engineIdentity.d.ts +1 -0
  80. package/dist/engineIdentity.js +8 -0
  81. package/dist/engineRowRef.d.ts +28 -0
  82. package/dist/engineRowRef.js +114 -0
  83. package/dist/engineSessionMessages.d.ts +68 -0
  84. package/dist/engineSessionMessages.js +370 -0
  85. package/dist/engineTargetSeat.d.ts +27 -0
  86. package/dist/engineTargetSeat.js +199 -0
  87. package/dist/engineToolDirectory.d.ts +0 -9
  88. package/dist/engineToolDirectory.js +1 -94
  89. package/dist/engineUrl.d.ts +18 -0
  90. package/dist/engineUrl.js +52 -0
  91. package/dist/engineWireFor.js +3 -8
  92. package/dist/env/uiLanguage.d.ts +11 -1
  93. package/dist/env/uiLanguage.js +38 -2
  94. package/dist/eventLeg.d.ts +100 -0
  95. package/dist/eventLeg.js +305 -0
  96. package/dist/executionLaneCapability.d.ts +0 -4
  97. package/dist/executionLaneCapability.js +3 -16
  98. package/dist/fileHistoryCaptureCapability.d.ts +2 -5
  99. package/dist/fileHistoryCaptureCapability.js +13 -21
  100. package/dist/fileHistoryLegNotice.d.ts +2 -1
  101. package/dist/fileHistoryLegNotice.js +3 -3
  102. package/dist/fleet/fleetLedger.d.ts +0 -3
  103. package/dist/fleet/fleetLedger.js +21 -36
  104. package/dist/fleet/fleetProjection.d.ts +2 -2
  105. package/dist/fleet/fleetProjection.js +10 -8
  106. package/dist/frameBinding.d.ts +8 -0
  107. package/dist/frameBinding.js +35 -0
  108. package/dist/gateFailureCodes.d.ts +2 -0
  109. package/dist/gateFailureCodes.js +15 -0
  110. package/dist/gateOutcome.d.ts +3 -1
  111. package/dist/gateOutcome.js +41 -8
  112. package/dist/gateVocabulary.d.ts +10 -4
  113. package/dist/gateVocabulary.js +107 -47
  114. package/dist/generated/engineAskFaceTables.js +2 -2
  115. package/dist/generated/engineFactTables.d.ts +22 -3
  116. package/dist/generated/engineFactTables.js +51 -4
  117. package/dist/generated/engineNoticeTables.js +18 -3
  118. package/dist/generated/settingsSchemaFns.d.ts +6 -0
  119. package/dist/generated/settingsSchemaFns.js +57 -0
  120. package/dist/generated/settingsSchemaHooksClassifier.d.ts +2 -0
  121. package/dist/generated/settingsSchemaHooksClassifier.js +254 -0
  122. package/dist/generated/settingsSchemaTables.d.ts +1 -0
  123. package/dist/generated/settingsSchemaTables.js +4 -0
  124. package/dist/generated/settingsSchemaTypes.d.ts +105 -0
  125. package/dist/generated/settingsSchemaTypes.js +1 -0
  126. package/dist/generated/toolNameTables.d.ts +1 -0
  127. package/dist/generated/toolNameTables.js +1 -0
  128. package/dist/hitl/allowRuleShadow.d.ts +8 -2
  129. package/dist/hitl/allowRuleShadow.js +36 -29
  130. package/dist/hitl/approvalCardReading.d.ts +15 -0
  131. package/dist/hitl/approvalCardReading.js +154 -0
  132. package/dist/hitl/approvalCardReasons.d.ts +14 -0
  133. package/dist/hitl/approvalCardReasons.js +119 -0
  134. package/dist/hitl/approvalHolds.d.ts +50 -15
  135. package/dist/hitl/approvalHolds.js +177 -27
  136. package/dist/hitl/approvalResolution.d.ts +51 -26
  137. package/dist/hitl/approvalResolution.js +86 -122
  138. package/dist/hitl/approvalsFeed.js +6 -18
  139. package/dist/hitl/askClassPair.d.ts +2 -0
  140. package/dist/hitl/askClassPair.js +17 -0
  141. package/dist/hitl/askGateWire.d.ts +20 -2
  142. package/dist/hitl/askGateWire.js +50 -1
  143. package/dist/hitl/askParkRowRouting.d.ts +5 -0
  144. package/dist/hitl/askParkRowRouting.js +32 -1
  145. package/dist/hitl/askSettlementLine.d.ts +28 -0
  146. package/dist/hitl/askSettlementLine.js +99 -0
  147. package/dist/hitl/automaticAnswerVerdict.d.ts +3 -2
  148. package/dist/hitl/automaticAnswerVerdict.js +29 -13
  149. package/dist/hitl/crashConverged.d.ts +11 -20
  150. package/dist/hitl/crashConverged.js +56 -0
  151. package/dist/hitl/crashConvergedNotice.d.ts +6 -3
  152. package/dist/hitl/crashConvergedNotice.js +48 -24
  153. package/dist/hitl/decisionConflict.js +3 -10
  154. package/dist/hitl/decisionRefusal.d.ts +40 -1
  155. package/dist/hitl/decisionRefusal.js +199 -42
  156. package/dist/hitl/frameRouter.d.ts +5 -2
  157. package/dist/hitl/frameRouter.js +27 -24
  158. package/dist/hitl/gateLedger.d.ts +2 -0
  159. package/dist/hitl/gateLedger.js +50 -13
  160. package/dist/hitl/hitlBridge.d.ts +2 -2
  161. package/dist/hitl/hitlBridge.js +13 -10
  162. package/dist/hitl/livePendingAsk.d.ts +3 -3
  163. package/dist/hitl/livePendingAsk.js +7 -18
  164. package/dist/hitl/parkResolver.d.ts +2 -24
  165. package/dist/hitl/parkResolver.js +61 -97
  166. package/dist/hitl/persistedRulesWire.d.ts +25 -0
  167. package/dist/hitl/persistedRulesWire.js +104 -2
  168. package/dist/hitl/planReviewWire.d.ts +31 -13
  169. package/dist/hitl/planReviewWire.js +120 -78
  170. package/dist/hitl/refusedToolNameProse.d.ts +0 -1
  171. package/dist/hitl/refusedToolNameProse.js +0 -3
  172. package/dist/hitl/replayedApproval.d.ts +4 -3
  173. package/dist/hitl/replayedApproval.js +7 -4
  174. package/dist/hitl/sessionPolicyDeliverable.d.ts +2 -0
  175. package/dist/hitl/sessionPolicyDeliverable.js +48 -7
  176. package/dist/hitl/sessionPolicyWire.d.ts +34 -21
  177. package/dist/hitl/sessionPolicyWire.js +179 -70
  178. package/dist/hitl/standingRows.d.ts +20 -2
  179. package/dist/hitl/standingRows.js +69 -8
  180. package/dist/hitl/suspendedReopen.d.ts +2 -1
  181. package/dist/hitl/suspendedReopen.js +7 -10
  182. package/dist/hitl/toolApprovalWire.d.ts +103 -156
  183. package/dist/hitl/toolApprovalWire.js +661 -411
  184. package/dist/hookMatcherVerdict.d.ts +6 -1
  185. package/dist/hookMatcherVerdict.js +14 -7
  186. package/dist/hooksWireCaps.d.ts +2 -2
  187. package/dist/hooksWireCaps.js +174 -81
  188. package/dist/host.d.ts +21 -0
  189. package/dist/hostTurnSettings.d.ts +71 -0
  190. package/dist/hostTurnSettings.js +291 -0
  191. package/dist/humanTurn.d.ts +14 -1
  192. package/dist/humanTurn.js +100 -12
  193. package/dist/humanTurnRead.d.ts +2 -0
  194. package/dist/humanTurnRead.js +22 -1
  195. package/dist/i18n/messages.en.d.ts +703 -0
  196. package/dist/i18n/messages.en.js +701 -0
  197. package/dist/i18n/messages.zh.d.ts +3 -0
  198. package/dist/i18n/messages.zh.js +837 -0
  199. package/dist/i18n/translate.d.ts +25 -0
  200. package/dist/i18n/translate.js +127 -0
  201. package/dist/index.d.ts +78 -29
  202. package/dist/index.js +54 -18
  203. package/dist/inheritEnvCapability.d.ts +32 -0
  204. package/dist/inheritEnvCapability.js +104 -0
  205. package/dist/inheritEnvWire.d.ts +3 -2
  206. package/dist/inheritEnvWire.js +12 -14
  207. package/dist/interactiveHalt.js +17 -6
  208. package/dist/liveModelCatalog.d.ts +3 -3
  209. package/dist/liveModelCatalog.js +15 -13
  210. package/dist/liveQuestionStore.d.ts +2 -21
  211. package/dist/mcpLiveness.d.ts +2 -1
  212. package/dist/mcpPanel.d.ts +10 -1
  213. package/dist/mcpPanel.js +40 -13
  214. package/dist/mcpProbeCapability.d.ts +2 -1
  215. package/dist/mcpProbeCapability.js +7 -11
  216. package/dist/mcpProbeWire.d.ts +9 -2
  217. package/dist/mcpProbeWire.js +6 -1
  218. package/dist/mcpWireCaps.d.ts +47 -2
  219. package/dist/mcpWireCaps.js +164 -16
  220. package/dist/memoryEntriesWire.d.ts +4 -9
  221. package/dist/memoryEntriesWire.js +5 -10
  222. package/dist/model/modelSupplyRules.d.ts +0 -2
  223. package/dist/model/modelSupplyRules.js +3 -12
  224. package/dist/model/modelsPolicy.d.ts +0 -5
  225. package/dist/model/modelsPolicy.js +6 -36
  226. package/dist/model/onboardJudgement.d.ts +93 -0
  227. package/dist/model/onboardJudgement.js +415 -0
  228. package/dist/model/subagentModelWord.d.ts +31 -0
  229. package/dist/model/subagentModelWord.js +261 -0
  230. package/dist/model/tierVocabulary.d.ts +2 -0
  231. package/dist/model/tierVocabulary.js +17 -5
  232. package/dist/modelCapabilityProbe.d.ts +64 -0
  233. package/dist/modelCapabilityProbe.js +600 -0
  234. package/dist/modelIdentityResolvability.d.ts +3 -0
  235. package/dist/modelIdentityResolvability.js +26 -17
  236. package/dist/notifications.d.ts +6 -0
  237. package/dist/notifications.js +71 -23
  238. package/dist/outputStyleSeatCapability.d.ts +0 -3
  239. package/dist/outputStyleSeatCapability.js +0 -3
  240. package/dist/ownKey.d.ts +22 -0
  241. package/dist/ownKey.js +94 -3
  242. package/dist/panelReduce.d.ts +21 -10
  243. package/dist/panelReduce.js +728 -550
  244. package/dist/panelStateHolder.d.ts +3 -7
  245. package/dist/panelStateHolder.js +14 -130
  246. package/dist/peerLaneCapability.d.ts +0 -4
  247. package/dist/peerLaneCapability.js +0 -6
  248. package/dist/permissionRuleIssue.js +2 -0
  249. package/dist/permissionRulesWriteCapability.d.ts +2 -5
  250. package/dist/permissionRulesWriteCapability.js +8 -12
  251. package/dist/permissionWireCaps.d.ts +2 -2
  252. package/dist/permissionWireCaps.js +2 -0
  253. package/dist/permissionsAllowGrantCapability.d.ts +0 -4
  254. package/dist/permissionsAllowGrantCapability.js +0 -6
  255. package/dist/permissionsDeclaration.d.ts +0 -11
  256. package/dist/permissionsDeclaration.js +60 -53
  257. package/dist/pluginHooksWire.d.ts +46 -3
  258. package/dist/pluginHooksWire.js +219 -16
  259. package/dist/preemptWire.d.ts +44 -0
  260. package/dist/preemptWire.js +83 -0
  261. package/dist/printModelStatus.d.ts +63 -0
  262. package/dist/printModelStatus.js +155 -0
  263. package/dist/printToolResultFrame.js +15 -4
  264. package/dist/replayBody.d.ts +3 -0
  265. package/dist/replayBody.js +14 -0
  266. package/dist/request/taskRequest.d.ts +11 -6
  267. package/dist/request/taskRequest.js +112 -19
  268. package/dist/resumeRefusalCopy.d.ts +13 -9
  269. package/dist/resumeRefusalCopy.js +81 -118
  270. package/dist/retryStatus.d.ts +45 -0
  271. package/dist/retryStatus.js +185 -1
  272. package/dist/rewindArchiveCapability.d.ts +0 -4
  273. package/dist/rewindArchiveCapability.js +2 -10
  274. package/dist/rewindArchiveReading.d.ts +0 -1
  275. package/dist/rewindArchiveReading.js +0 -3
  276. package/dist/runCancelContext.d.ts +2 -1
  277. package/dist/runCancelContext.js +4 -2
  278. package/dist/runReattachPolicy.d.ts +31 -0
  279. package/dist/runReattachPolicy.js +46 -0
  280. package/dist/runTerminal.d.ts +3 -6
  281. package/dist/runTerminal.js +8 -9
  282. package/dist/sandboxWire.d.ts +3 -1
  283. package/dist/sandboxWire.js +76 -27
  284. package/dist/scenarioRefusal.d.ts +9 -0
  285. package/dist/scenarioRefusal.js +111 -0
  286. package/dist/scenarioWire.js +1 -1
  287. package/dist/seam.d.ts +48 -2
  288. package/dist/seam.js +25 -4
  289. package/dist/seatContract.d.ts +311 -18
  290. package/dist/seatContract.js +824 -100
  291. package/dist/selfOrchestrationDenial.js +7 -19
  292. package/dist/sessionIdSegment.d.ts +6 -0
  293. package/dist/sessionIdSegment.js +24 -0
  294. package/dist/sessionMemoryStatus.js +6 -11
  295. package/dist/sessionPolicyCapability.d.ts +2 -5
  296. package/dist/sessionPolicyCapability.js +8 -12
  297. package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
  298. package/dist/sessionSyncFileHistoryCapability.js +0 -3
  299. package/dist/settingsHooksSalvage.d.ts +44 -0
  300. package/dist/settingsHooksSalvage.js +211 -0
  301. package/dist/skillToolListsCapability.d.ts +2 -4
  302. package/dist/skillToolListsCapability.js +8 -9
  303. package/dist/sqlEngineCapability.d.ts +0 -4
  304. package/dist/sqlEngineCapability.js +0 -6
  305. package/dist/sseIdleTriage.js +3 -2
  306. package/dist/steerPriorityCapability.d.ts +0 -3
  307. package/dist/steerPriorityCapability.js +0 -3
  308. package/dist/streamDrainingLegs.d.ts +4 -0
  309. package/dist/streamDrainingLegs.js +6 -1
  310. package/dist/subagent/engineCompactWire.d.ts +0 -1
  311. package/dist/subagent/engineCompactWire.js +7 -5
  312. package/dist/subagent/engineSubagentResume.js +15 -9
  313. package/dist/subagent/engineTaskHandleWire.js +4 -7
  314. package/dist/subagentContentStore.d.ts +3 -0
  315. package/dist/subagentContentStore.js +22 -10
  316. package/dist/submitReopen.d.ts +24 -0
  317. package/dist/submitReopen.js +75 -0
  318. package/dist/terminalStatuses.d.ts +3 -0
  319. package/dist/terminalStatuses.js +10 -2
  320. package/dist/toolHistoryMismatch.js +3 -2
  321. package/dist/toolResult.d.ts +10 -1
  322. package/dist/toolResult.js +34 -6
  323. package/dist/toolRoster.d.ts +3 -4
  324. package/dist/toolRoster.js +21 -22
  325. package/dist/turnFailurePresentation.d.ts +39 -0
  326. package/dist/turnFailurePresentation.js +402 -0
  327. package/dist/usageAnalytics.js +6 -11
  328. package/dist/userAttachmentEnvelope.d.ts +1 -0
  329. package/dist/userAttachmentEnvelope.js +37 -7
  330. package/dist/userAttachmentSeat.d.ts +21 -0
  331. package/dist/userAttachmentSeat.js +75 -0
  332. package/dist/userInvokedSkillsCapability.d.ts +11 -4
  333. package/dist/userInvokedSkillsCapability.js +31 -10
  334. package/dist/webSearchBackendCapability.d.ts +0 -4
  335. package/dist/webSearchBackendCapability.js +0 -6
  336. package/dist/wireErrorTriage.d.ts +7 -0
  337. package/dist/wireErrorTriage.js +26 -23
  338. package/dist/wireFailureShape.d.ts +62 -5
  339. package/dist/wireFailureShape.js +106 -5
  340. package/dist/wireRefusalCopy.d.ts +25 -3
  341. package/dist/wireRefusalCopy.js +74 -80
  342. package/dist/workflowsJournalCapability.d.ts +2 -5
  343. package/dist/workflowsJournalCapability.js +8 -12
  344. package/dist/writeProtectionCapability.d.ts +0 -4
  345. package/dist/writeProtectionCapability.js +0 -6
  346. package/docs/INTEGRATION-CLIENTS.md +1775 -56
  347. package/package.json +6 -5
  348. package/dist/attachmentSeatCapability.d.ts +0 -12
  349. package/dist/attachmentSeatCapability.js +0 -23
  350. package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
  351. package/dist/hitl/approvalOutcomeNote.js +0 -29
  352. package/dist/sessionReadRedactionCapability.d.ts +0 -13
  353. package/dist/sessionReadRedactionCapability.js +0 -35
@@ -1,36 +1,25 @@
1
- import { readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField } from './wireFailureShape.js';
2
- import { readOwnNonEmptyString } from './ownKey.js';
3
- import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID, RESUME_POLICY_FOLD_CODE, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
1
+ import { PROTOCOL_ERROR_NAME, THROWN_SLOT_UNREADABLE, protocolErrorNameOf, readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField, readThrownSlot, readThrownStatusSlot } from './wireFailureShape.js';
2
+ import { readOwnDataValue, readOwnNonEmptyString } from './ownKey.js';
3
+ import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID, RESUME_POLICY_FOLD_CODE, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
4
4
  import { capForDisplay } from './fleetTaskDesc.js';
5
5
  import { effectiveWireErrorCode } from './wireErrorTriage.js';
6
6
  import { CORE_TOOL_DECLARATION_CODES } from './generated/engineFactTables.js';
7
+ import { scenarioRefusalFromError } from './scenarioRefusal.js';
7
8
  export const CONFLICT_APPROVAL_SETTLED = 'conflict.approval_settled';
8
9
  export const CONFLICT_RUN_NOT_RUNNING = 'conflict.run_not_running';
9
- function readStringField(o, key) {
10
- const v = o[key];
10
+ function ownNonEmptyStringSlot(o, key) {
11
+ const v = readThrownSlot(o, key, 'data');
11
12
  return typeof v === 'string' && v !== '' ? v : undefined;
12
13
  }
13
14
  export function cancelConflictFromError(err) {
14
- let o;
15
- try {
16
- if (err === null || typeof err !== 'object')
17
- return null;
18
- o = err;
19
- const rawStatus = o.status ?? o.statusCode;
20
- const is409 = rawStatus === 409 || (rawStatus === undefined && o.name === 'ConflictError');
21
- if (!is409)
22
- return null;
23
- }
24
- catch {
15
+ if (err === null || typeof err !== 'object')
25
16
  return null;
26
- }
27
- let code;
28
- try {
29
- code = readStringField(o, 'errorCode');
30
- }
31
- catch {
32
- code = undefined;
33
- }
17
+ const rawStatus = readThrownStatusSlot(err);
18
+ if (rawStatus === THROWN_SLOT_UNREADABLE)
19
+ return null;
20
+ if (!(rawStatus === 409 || (rawStatus === undefined && protocolErrorNameOf(err) === PROTOCOL_ERROR_NAME.ConflictError)))
21
+ return null;
22
+ const code = ownNonEmptyStringSlot(err, 'errorCode');
34
23
  if (code === CONFLICT_APPROVAL_SETTLED)
35
24
  return { kind: 'approval_settled', code };
36
25
  if (code === CONFLICT_RUN_NOT_RUNNING)
@@ -58,17 +47,20 @@ export function usageWindowExhaustedFromError(err) {
58
47
  if (err === null || typeof err !== 'object')
59
48
  return null;
60
49
  const o = err;
61
- if (o.errorCode !== USAGE_WINDOW_EXHAUSTED)
50
+ if (readThrownSlot(o, 'errorCode', 'data') !== USAGE_WINDOW_EXHAUSTED)
51
+ return null;
52
+ const rawStatus = readThrownStatusSlot(o);
53
+ if (rawStatus === THROWN_SLOT_UNREADABLE)
62
54
  return null;
63
- const rawStatus = o.status ?? o.statusCode;
64
- const is429 = rawStatus === 429 || (rawStatus === undefined && (o.name === 'UsageWindowExhaustedError' || o.name === 'RateLimitedError'));
55
+ const protocolName = rawStatus === undefined ? protocolErrorNameOf(o) : undefined;
56
+ const is429 = rawStatus === 429 || (rawStatus === undefined && (protocolName === PROTOCOL_ERROR_NAME.UsageWindowExhaustedError || protocolName === PROTOCOL_ERROR_NAME.RateLimitedError));
65
57
  if (!is429)
66
58
  return null;
67
59
  const rawSec = readErrorNumber(o, 'retryAfterSec');
68
60
  const sec = nonNegativeFinite(rawSec)
69
61
  ? Math.ceil(rawSec)
70
62
  : (() => {
71
- const rawMs = o.retryAfterMs;
63
+ const rawMs = readThrownSlot(o, 'retryAfterMs', 'data');
72
64
  return nonNegativeFinite(rawMs) ? Math.ceil(rawMs / 1000) : undefined;
73
65
  })();
74
66
  return { code: USAGE_WINDOW_EXHAUSTED, ...(sec !== undefined ? { retryAfterSec: sec } : {}) };
@@ -98,13 +90,7 @@ const positiveFinite = (v) => typeof v === 'number' && Number.isFinite(v) && v >
98
90
  export function fleetLeaseUnavailableFromError(err) {
99
91
  if (err === null || typeof err !== 'object')
100
92
  return null;
101
- let code;
102
- try {
103
- code = err.errorCode;
104
- }
105
- catch {
106
- return null;
107
- }
93
+ const code = readThrownSlot(err, 'errorCode', 'data');
108
94
  if (code !== FLEET_LEASE_UNAVAILABLE)
109
95
  return null;
110
96
  const reason = readErrorString(err, 'reason');
@@ -153,33 +139,14 @@ export function fleetLeaseUnavailableContent(detail) {
153
139
  return `${head}${cause}${wait}`;
154
140
  }
155
141
  export function scenarioAssignmentUnknownFromError(err) {
156
- try {
157
- if (err === null || typeof err !== 'object')
158
- return null;
159
- if (effectiveWireErrorCode(err) !== SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE)
160
- return null;
161
- const detail = readErrorRecord(err, 'detail');
162
- const bit = (key) => {
163
- if (detail === undefined)
164
- return undefined;
165
- try {
166
- return Object.hasOwn(detail, key) ? detail[key] : undefined;
167
- }
168
- catch {
169
- return undefined;
170
- }
171
- };
172
- const scenario = bit('scenario');
173
- const source = bit('source');
174
- return {
175
- code: SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE,
176
- ...(typeof scenario === 'string' && scenario.length > 0 ? { scenario } : {}),
177
- ...(source === 'ruling' || source === 'deployment' ? { source } : {}),
178
- };
179
- }
180
- catch {
142
+ const r = scenarioRefusalFromError(err);
143
+ if (r === null)
181
144
  return null;
182
- }
145
+ return {
146
+ code: SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE,
147
+ ...(r.scenario !== undefined ? { scenario: r.scenario } : {}),
148
+ ...(r.source !== undefined ? { source: r.source } : {}),
149
+ };
183
150
  }
184
151
  const SETTLED_BY_NOT_IN_PROOF = 'settled_by_not_in_proof';
185
152
  const DECIDED_BY_NOT_IN_PROOF = 'decided_by_not_in_proof';
@@ -190,11 +157,11 @@ export function denyAttributionRefusalFromError(err, sentAttributionKey) {
190
157
  if (err === null || typeof err !== 'object')
191
158
  return null;
192
159
  const o = err;
193
- const rawStatus = o.status ?? o.statusCode;
160
+ const rawStatus = readThrownStatusSlot(o);
194
161
  const status = typeof rawStatus === 'number' && Number.isFinite(rawStatus) ? rawStatus : undefined;
195
162
  if (status === undefined)
196
163
  return null;
197
- const code = readStringField(o, 'errorCode');
164
+ const code = ownNonEmptyStringSlot(o, 'errorCode');
198
165
  if (code === undefined)
199
166
  return null;
200
167
  if (status === 400 && (code === SETTLED_BY_NOT_IN_PROOF || code === DECIDED_BY_NOT_IN_PROOF))
@@ -245,12 +212,12 @@ export function sessionDeleteConflictFromError(err) {
245
212
  try {
246
213
  if (err === null || typeof err !== 'object')
247
214
  return null;
248
- const o = err;
249
- const rawStatus = o.status ?? o.statusCode;
250
- const is409 = rawStatus === 409 || (rawStatus === undefined && o.name === 'ConflictError');
251
- if (!is409)
215
+ const rawStatus = readThrownStatusSlot(err);
216
+ if (rawStatus === THROWN_SLOT_UNREADABLE)
217
+ return null;
218
+ if (!(rawStatus === 409 || (rawStatus === undefined && protocolErrorNameOf(err) === PROTOCOL_ERROR_NAME.ConflictError)))
252
219
  return null;
253
- const code = readStringField(o, 'errorCode');
220
+ const code = ownNonEmptyStringSlot(err, 'errorCode');
254
221
  if (code === CONFLICT_SESSION_CHILDREN_ALIVE) {
255
222
  const remaining = readErrorStringList(err, 'remaining')?.filter((id) => id.length > 0);
256
223
  return { kind: 'children_alive', code, ...(remaining !== undefined && remaining.length > 0 ? { remaining: Object.freeze(remaining) } : {}) };
@@ -391,13 +358,7 @@ export function toolDeclarationRefusalFromError(err) {
391
358
  try {
392
359
  if (typeof err !== 'object' || err === null)
393
360
  return null;
394
- let code;
395
- try {
396
- code = err.errorCode;
397
- }
398
- catch {
399
- return null;
400
- }
361
+ const code = readThrownSlot(err, 'errorCode', 'data');
401
362
  if (typeof code !== 'string' || !CORE_TOOL_DECLARATION_CODES.includes(code))
402
363
  return null;
403
364
  return Object.freeze({ code });
@@ -547,7 +508,7 @@ function readProp(o, key) {
547
508
  }
548
509
  export function hostPostureRefusalFromError(err, sentRequest) {
549
510
  try {
550
- if (readProp(err, 'errorCode') !== HOST_POSTURE_REFUSED)
511
+ if (readThrownSlot(err, 'errorCode', 'data') !== HOST_POSTURE_REFUSED)
551
512
  return null;
552
513
  const askedWholeEnvironment = readProp(sentRequest, 'inheritEnv') === 'all';
553
514
  const askedOpenWriteFace = readProp(sentRequest, 'permissionMode') === BYPASS_PERMISSIONS ||
@@ -600,11 +561,30 @@ export function hookMatcherRefusalFromError(err) {
600
561
  if (detail === undefined)
601
562
  return undefined;
602
563
  const event = readOwnNonEmptyString(detail, 'event');
603
- const alias = readOwnNonEmptyString(detail, 'alias');
604
- const canonical = readOwnNonEmptyString(detail, 'canonical');
605
- if (event === undefined || alias === undefined || canonical === undefined)
564
+ if (event === undefined)
565
+ return undefined;
566
+ const reasonRaw = readOwnDataValue(detail, 'reason');
567
+ if (reasonRaw === undefined || reasonRaw === 'dead_alias') {
568
+ const alias = readOwnNonEmptyString(detail, 'alias');
569
+ const canonical = readOwnNonEmptyString(detail, 'canonical');
570
+ if (alias === undefined || canonical === undefined)
571
+ return undefined;
572
+ return Object.freeze({ reason: 'alias_without_canonical', event, alias, canonical });
573
+ }
574
+ if (reasonRaw !== 'invalid_regex' && reasonRaw !== 'over_budget')
575
+ return undefined;
576
+ const groupIndex = readOwnDataValue(detail, 'groupIndex');
577
+ if (typeof groupIndex !== 'number' || !Number.isInteger(groupIndex) || groupIndex < 0)
606
578
  return undefined;
607
- return Object.freeze({ event, alias, canonical });
579
+ if (reasonRaw === 'invalid_regex')
580
+ return Object.freeze({ reason: 'invalid_regex', event, groupIndex });
581
+ const budget = readOwnDataValue(detail, 'budgetMs');
582
+ return Object.freeze({
583
+ reason: 'over_budget',
584
+ event,
585
+ groupIndex,
586
+ ...(typeof budget === 'number' && Number.isFinite(budget) && budget > 0 ? { budgetMs: budget } : {}),
587
+ });
608
588
  }
609
589
  catch {
610
590
  return undefined;
@@ -617,3 +597,17 @@ export function autonomyLaneRefusalContent() {
617
597
  return ('The engine did not start this leader run: this deployment runs in plan-only autonomy, and a leader run has no way to have its plan reviewed, ' +
618
598
  'so nothing was started · Submit the work as a regular run instead, or ask whoever operates the engine to change its autonomy setting');
619
599
  }
600
+ export function userAttachmentRefusalFromError(err) {
601
+ return effectiveWireErrorCode(err) === USER_ATTACHMENT_INVALID_ERROR_CODE ? { code: USER_ATTACHMENT_INVALID_ERROR_CODE, retryable: false } : null;
602
+ }
603
+ export function userAttachmentRefusalContent() {
604
+ return ('This message was not sent: the engine refused the files attached to it — together with the message they are more than it can take in one request on this model, ' +
605
+ 'or one of them is in a form it does not accept · Nothing was started and your draft is kept · Remove some attachments or attach smaller parts, then send it again');
606
+ }
607
+ export function userInvokedSkillRefusalFromError(err) {
608
+ return effectiveWireErrorCode(err) === USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE ? { code: USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, retryable: false } : null;
609
+ }
610
+ export function userInvokedSkillRefusalContent() {
611
+ return ('The engine did not start this run: a skill named for it is not one this run has loaded, or skills are turned off for this run · ' +
612
+ 'Nothing was started and your draft is kept · Check the skill name, or load that skill, then send it again');
613
+ }
@@ -1,3 +1,4 @@
1
+ import type { UiLanguage } from './env/uiLanguage.js';
1
2
  export type WorkflowsJournalReading = {
2
3
  kind: 'unobserved';
3
4
  } | {
@@ -10,10 +11,6 @@ export type WorkflowsJournalReading = {
10
11
  kind: 'present';
11
12
  };
12
13
  export declare function projectWorkflowsJournalCapability(caps: unknown): WorkflowsJournalReading | undefined;
13
- export declare function noteEngineCapsForWorkflowsJournal(baseUrl: string, caps: unknown, opts?: {
14
- generation?: number;
15
- }): void;
16
14
  export declare function observedWorkflowsJournal(baseUrl?: string | undefined): WorkflowsJournalReading;
17
15
  export declare function workflowsJournalAvailable(reading: WorkflowsJournalReading): 'yes' | 'no' | 'unknown';
18
- export declare function workflowsJournalDoctorDetail(reading: WorkflowsJournalReading): string;
19
- export declare function __resetWorkflowsJournalReadingsForTests(): void;
16
+ export declare function workflowsJournalDoctorDetail(reading: WorkflowsJournalReading, lang?: UiLanguage): string;
@@ -1,5 +1,6 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
3
+ import { msg, renderMessage } from './i18n/translate.js';
3
4
  import { ownDataField } from './ownKey.js';
4
5
  export function projectWorkflowsJournalCapability(caps) {
5
6
  try {
@@ -20,9 +21,6 @@ const reader = createEngineCapReader({
20
21
  name: 'workflowsJournal',
21
22
  project: projectWorkflowsJournalCapability,
22
23
  });
23
- export function noteEngineCapsForWorkflowsJournal(baseUrl, caps, opts) {
24
- reader.note(baseUrl, caps, opts);
25
- }
26
24
  export function observedWorkflowsJournal(baseUrl = engineWireTarget()?.baseUrl) {
27
25
  return reader.observed(baseUrl);
28
26
  }
@@ -33,20 +31,18 @@ export function workflowsJournalAvailable(reading) {
33
31
  return 'no';
34
32
  return 'unknown';
35
33
  }
36
- export function workflowsJournalDoctorDetail(reading) {
34
+ export function workflowsJournalDoctorDetail(reading, lang) {
35
+ const subject = msg('notice.capability.subject.workflowsJournal');
37
36
  switch (reading.kind) {
38
37
  case 'unreadable':
39
- return unreadableReadingDetail('workflow journal');
38
+ return unreadableReadingDetail(renderMessage(subject, lang), lang);
40
39
  case 'unobserved':
41
- return 'workflow journal not observed — the engine reports it on /v1/capabilities (workflowsJournal); this process has no usable capabilities reading cached for it (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which)';
40
+ return renderMessage(msg('notice.capability.unobserved', { subject, key: 'workflowsJournal' }), lang);
42
41
  case 'not_reported':
43
- return 'workflow journal not reported by this engine — the engine predates the separate flag, so the workflow listing flag still covers the journal';
42
+ return renderMessage(msg('notice.capability.workflowsJournal.notReported'), lang);
44
43
  case 'absent':
45
- return 'no workflow journal on this deployment — workflows can be listed and followed, but their execution journal cannot be read';
44
+ return renderMessage(msg('notice.capability.workflowsJournal.absent'), lang);
46
45
  case 'present':
47
- return 'workflow journal on — a workflow’s execution journal can be read';
46
+ return renderMessage(msg('notice.capability.workflowsJournal.present'), lang);
48
47
  }
49
48
  }
50
- export function __resetWorkflowsJournalReadingsForTests() {
51
- reader.__resetForTests();
52
- }
@@ -24,10 +24,6 @@ export interface WriteProtectionPostureView {
24
24
  droppedDefaultRows?: readonly string[];
25
25
  }
26
26
  export declare function projectWriteProtectionPosture(wiring: unknown): WriteProtectionPostureView | undefined;
27
- export declare function noteEngineCapsForWriteProtection(baseUrl: string, caps: unknown, opts?: {
28
- generation?: number;
29
- }): void;
30
27
  export declare function observedWriteProtection(baseUrl?: string | undefined): WriteProtectionReading;
31
28
  export declare function writeProtectionDoctorDetail(reading: WriteProtectionReading): string;
32
29
  export declare function writeProtectionPostureDetail(posture: WriteProtectionPostureView): string;
33
- export declare function __resetWriteProtectionReadingsForTests(): void;
@@ -66,9 +66,6 @@ const reader = createEngineCapReader({
66
66
  name: 'writeProtection',
67
67
  project: projectWriteProtectionCapability,
68
68
  });
69
- export function noteEngineCapsForWriteProtection(baseUrl, caps, opts) {
70
- reader.note(baseUrl, caps, opts);
71
- }
72
69
  export function observedWriteProtection(baseUrl = engineWireTarget()?.baseUrl) {
73
70
  return reader.observed(baseUrl);
74
71
  }
@@ -113,6 +110,3 @@ export function writeProtectionPostureDetail(posture) {
113
110
  : '';
114
111
  return `source ${source} · ${String(posture.rows.length)} ${posture.rows.length === 1 ? 'name' : 'names'}: ${shown}${more}${dropped}`;
115
112
  }
116
- export function __resetWriteProtectionReadingsForTests() {
117
- reader.__resetForTests();
118
- }