@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,6 +1,7 @@
1
1
  import type { AgentClient } from '@sema-agent/sdk';
2
2
  import { type WiringManifestMcpEntryView } from './adapter/downstream/eventToSdkMessage.js';
3
3
  import { type McpEngineLegHealth } from './mcpLiveness.js';
4
+ import { type ScenarioRefusalReading } from './scenarioRefusal.js';
4
5
  export interface McpPanelServerView {
5
6
  name: string;
6
7
  status: string;
@@ -16,14 +17,22 @@ export interface McpPanelLastLegView {
16
17
  at: string;
17
18
  mcp: WiringManifestMcpEntryView[];
18
19
  }
19
- export interface McpPanelView {
20
+ export interface McpPanelServersView {
20
21
  asOf: string;
22
+ lastLegMcp?: McpPanelLastLegView;
23
+ lastLegMcpUnreadable?: true;
21
24
  servers: McpPanelServerView[];
22
25
  degraded?: true;
26
+ }
27
+ export interface McpPanelRefusalView {
28
+ asOf: string;
23
29
  lastLegMcp?: McpPanelLastLegView;
24
30
  lastLegMcpUnreadable?: true;
31
+ scenarioRefusal: ScenarioRefusalReading;
25
32
  }
33
+ export type McpPanelView = McpPanelServersView | McpPanelRefusalView;
26
34
  export declare function projectMcpPanel(body: unknown): McpPanelView | undefined;
35
+ export declare function mcpPanelRefusalOf(view: McpPanelView | undefined): ScenarioRefusalReading | undefined;
27
36
  export declare function fetchMcpPanel(client: Pick<AgentClient, 'sessions'>, sessionId: string, opts?: {
28
37
  signal?: AbortSignal;
29
38
  }): Promise<McpPanelView | undefined>;
package/dist/mcpPanel.js CHANGED
@@ -3,6 +3,7 @@ import { isSessionIdPathSegment } from './sessionIdSegment.js';
3
3
  import { projectMcpSection } from './adapter/downstream/eventToSdkMessage.js';
4
4
  import { capForDisplay } from './fleetTaskDesc.js';
5
5
  import { mcpLivenessRollupOf } from './mcpLiveness.js';
6
+ import { scenarioRefusalOf } from './scenarioRefusal.js';
6
7
  const MCP_PANEL_ERROR_MAX = 200;
7
8
  const MCP_PANEL_WORD_MAX = 40;
8
9
  const MCP_PANEL_NAMES_MAX = 8;
@@ -40,19 +41,29 @@ export function projectMcpPanel(body) {
40
41
  return undefined;
41
42
  if (!nonEmpty(body.asOf))
42
43
  return undefined;
43
- if (!Array.isArray(body.servers))
44
+ const refusal = scenarioRefusalOf(body);
45
+ if (refusal === null)
44
46
  return undefined;
45
- const servers = [];
46
- for (const r of body.servers) {
47
- const row = projectServerRow(r);
48
- if (row !== undefined)
49
- servers.push(row);
47
+ let view;
48
+ if (refusal !== undefined) {
49
+ view = { asOf: body.asOf, scenarioRefusal: refusal };
50
+ }
51
+ else {
52
+ if (!Array.isArray(body.servers))
53
+ return undefined;
54
+ const servers = [];
55
+ for (const r of body.servers) {
56
+ const row = projectServerRow(r);
57
+ if (row !== undefined)
58
+ servers.push(row);
59
+ }
60
+ if (body.servers.length > 0 && servers.length === 0)
61
+ return undefined;
62
+ const sv = { asOf: body.asOf, servers };
63
+ if (body.degraded === true)
64
+ sv.degraded = true;
65
+ view = sv;
50
66
  }
51
- if (body.servers.length > 0 && servers.length === 0)
52
- return undefined;
53
- const view = { asOf: body.asOf, servers };
54
- if (body.degraded === true)
55
- view.degraded = true;
56
67
  if ('lastLegMcp' in body) {
57
68
  const leg = projectLastLeg(body.lastLegMcp);
58
69
  if (leg !== undefined)
@@ -62,6 +73,20 @@ export function projectMcpPanel(body) {
62
73
  }
63
74
  return view;
64
75
  }
76
+ export function mcpPanelRefusalOf(view) {
77
+ try {
78
+ if (view === null || typeof view !== 'object')
79
+ return undefined;
80
+ const d = Object.getOwnPropertyDescriptor(view, 'scenarioRefusal');
81
+ if (d === undefined || !('value' in d))
82
+ return undefined;
83
+ const r = d.value;
84
+ return r !== null && typeof r === 'object' && !Array.isArray(r) ? r : undefined;
85
+ }
86
+ catch {
87
+ return undefined;
88
+ }
89
+ }
65
90
  export async function fetchMcpPanel(client, sessionId, opts) {
66
91
  if (!isSessionIdPathSegment(sessionId))
67
92
  return undefined;
@@ -98,12 +123,14 @@ void _mcpPanelShapePin;
98
123
  export function mcpEngineLegPresence(view) {
99
124
  if (view === undefined)
100
125
  return 'unknown';
101
- if (view.servers.length > 0)
102
- return 'present';
103
126
  if (view.lastLegMcp !== undefined)
104
127
  return 'present';
105
128
  if (view.lastLegMcpUnreadable === true)
106
129
  return 'present';
130
+ if (!('servers' in view))
131
+ return 'unknown';
132
+ if (view.servers.length > 0)
133
+ return 'present';
107
134
  if (view.degraded === true)
108
135
  return 'present';
109
136
  return 'absent';
@@ -1,3 +1,4 @@
1
+ import type { UiLanguage } from './env/uiLanguage.js';
1
2
  export type McpProbeReading = {
2
3
  kind: 'unobserved';
3
4
  } | {
@@ -12,4 +13,4 @@ export type McpProbeReading = {
12
13
  export declare function projectMcpProbeCapability(caps: unknown): McpProbeReading | undefined;
13
14
  export declare function observedMcpProbe(baseUrl?: string | undefined): McpProbeReading;
14
15
  export declare function mcpProbeAvailable(reading: McpProbeReading): 'yes' | 'no' | 'unknown';
15
- export declare function mcpProbeDoctorDetail(reading: McpProbeReading): string;
16
+ export declare function mcpProbeDoctorDetail(reading: McpProbeReading, 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 projectMcpProbeCapability(caps) {
5
6
  try {
@@ -30,22 +31,17 @@ export function mcpProbeAvailable(reading) {
30
31
  return 'no';
31
32
  return 'unknown';
32
33
  }
33
- export function mcpProbeDoctorDetail(reading) {
34
+ export function mcpProbeDoctorDetail(reading, lang) {
34
35
  switch (reading.kind) {
35
36
  case 'unreadable':
36
- return unreadableReadingDetail('per-server MCP status face');
37
+ return unreadableReadingDetail(renderMessage(msg('notice.capability.subject.mcpProbe'), lang), lang);
37
38
  case 'unobserved':
38
- return ('per-server MCP status face not observed — the engine reports whether it has one on /v1/capabilities; ' +
39
- '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)');
39
+ return renderMessage(msg('notice.capability.mcpProbe.unobserved'), lang);
40
40
  case 'not_reported':
41
- return ('per-server MCP status face not reported by this engine — this binary predates the face, so that path is not expected to exist here ' +
42
- '(asking it usually answers with a machine-readable route-not-found, though a timeout or an uncoded gateway answer still says nothing either way); ' +
43
- 'prefer the session panel last-leg roster where that panel carries one, and otherwise show this reason rather than an entry that cannot answer');
41
+ return renderMessage(msg('notice.capability.mcpProbe.notReported'), lang);
44
42
  case 'absent':
45
- return ('per-server MCP status face reported off on this deployment — this engine answers no readings there; ' +
46
- 'this client does not guess why, and whether caller-supplied declarations are honored is a separate position with its own answer');
43
+ return renderMessage(msg('notice.capability.mcpProbe.absent'), lang);
47
44
  case 'present':
48
- return ('per-server MCP status face on — this engine dials its own declared MCP servers on request, with no run, ' +
49
- 'and a probe of caller-supplied declarations answers with the very same body shape');
45
+ return renderMessage(msg('notice.capability.mcpProbe.present'), lang);
50
46
  }
51
47
  }
@@ -1,6 +1,7 @@
1
1
  import type { McpProbeFace, McpServerSpec } from '@sema-agent/sdk';
2
2
  import { type WiringManifestMcpEntryView } from './adapter/downstream/eventToSdkMessage.js';
3
3
  import { type McpProbeReading } from './mcpProbeCapability.js';
4
+ import { type ScenarioRefusalReading } from './scenarioRefusal.js';
4
5
  export interface McpProbeFacade {
5
6
  mcpCapabilities(opts?: {
6
7
  signal?: AbortSignal;
@@ -9,7 +10,7 @@ export interface McpProbeFacade {
9
10
  signal?: AbortSignal;
10
11
  }): Promise<McpProbeFace>;
11
12
  }
12
- export declare const MCP_PROBE_REFUSAL_CAUSES: readonly ["face_absent", "client_too_old", "unreadable_request", "injection_not_honored", "body_shape", "field_invalid", "body_unparseable", "payload_too_large", "rate_limited", "unauthorized", "principal_required", "principal_unverified"];
13
+ export declare const MCP_PROBE_REFUSAL_CAUSES: readonly ["face_absent", "client_too_old", "unreadable_request", "injection_not_honored", "body_shape", "field_invalid", "body_unparseable", "payload_too_large", "rate_limited", "unauthorized", "principal_required", "principal_unverified", "scenario_refused"];
13
14
  export type McpProbeRefusalCause = (typeof MCP_PROBE_REFUSAL_CAUSES)[number];
14
15
  export declare const MCP_PROBE_UNKNOWN_WHYS: readonly ["no_verdict", "probe_incomplete", "server_fault", "result_unreadable", "index_misaligned", "unclassified"];
15
16
  export type McpProbeUnknownWhy = (typeof MCP_PROBE_UNKNOWN_WHYS)[number];
@@ -18,6 +19,7 @@ export type McpProbeRefused = {
18
19
  cause: McpProbeRefusalCause;
19
20
  message: string;
20
21
  retryAfterSec?: number;
22
+ scenarioRefusal?: ScenarioRefusalReading;
21
23
  };
22
24
  export type McpProbeUnknown = {
23
25
  status: 'unknown';
@@ -35,13 +37,18 @@ export type McpProbeOutcome = {
35
37
  status: 'face';
36
38
  face: McpProbeFaceView;
37
39
  } | McpProbeRefused | McpProbeUnknown;
40
+ export type McpDeploymentOutcome = {
41
+ status: 'face';
42
+ face: McpProbeFaceView;
43
+ declaredBy: 'deployment';
44
+ } | McpProbeRefused | McpProbeUnknown;
38
45
  export declare function classifyMcpProbeFailure(e: unknown): McpProbeFailure;
39
46
  export interface McpCapabilitiesCall {
40
47
  capability: McpProbeReading;
41
48
  }
42
49
  export declare function readMcpCapabilities(facade: McpProbeFacade, call: McpCapabilitiesCall, opts?: {
43
50
  signal?: AbortSignal;
44
- }): Promise<McpProbeOutcome>;
51
+ }): Promise<McpDeploymentOutcome>;
45
52
  export interface McpProbeServersCall {
46
53
  specs: McpServerSpec[];
47
54
  capability: McpProbeReading;
@@ -1,6 +1,7 @@
1
1
  import { projectMcpSection } from './adapter/downstream/eventToSdkMessage.js';
2
2
  import { wireFailureShapeOf } from './wireFailureShape.js';
3
3
  import { mcpProbeAvailable } from './mcpProbeCapability.js';
4
+ import { scenarioRefusalFromError } from './scenarioRefusal.js';
4
5
  export const MCP_PROBE_REFUSAL_CAUSES = Object.freeze([
5
6
  'face_absent',
6
7
  'client_too_old',
@@ -14,6 +15,7 @@ export const MCP_PROBE_REFUSAL_CAUSES = Object.freeze([
14
15
  'unauthorized',
15
16
  'principal_required',
16
17
  'principal_unverified',
18
+ 'scenario_refused',
17
19
  ]);
18
20
  export const MCP_PROBE_UNKNOWN_WHYS = Object.freeze([
19
21
  'no_verdict',
@@ -168,6 +170,9 @@ export async function readMcpCapabilities(facade, call, opts) {
168
170
  res = await facade.mcpCapabilities(opts);
169
171
  }
170
172
  catch (e) {
173
+ const refusal = scenarioRefusalFromError(e);
174
+ if (refusal !== null)
175
+ return { ...refusedBy('scenario_refused', wireFailureShapeOf(e).message), scenarioRefusal: refusal };
171
176
  return classifyMcpProbeFailure(e);
172
177
  }
173
178
  const narrowed = narrowProbeFace(res);
@@ -175,7 +180,7 @@ export async function readMcpCapabilities(facade, call, opts) {
175
180
  return unknownBy(narrowed.why, `the per-server MCP status call answered 2xx with a body this client cannot stand behind (${narrowed.what}) — refusing to present it as a reading, ` +
176
181
  'because a normal-looking empty list is exactly the false answer this face exists to remove');
177
182
  }
178
- return { status: 'face', face: narrowed.face };
183
+ return { status: 'face', face: narrowed.face, declaredBy: 'deployment' };
179
184
  }
180
185
  export async function probeMcpServers(facade, call, opts) {
181
186
  if (typeof facade?.probeMcp !== 'function') {
@@ -1,5 +1,6 @@
1
- import type { TaskRequest } from '@sema-agent/sdk';
2
- export type McpServerSpec = NonNullable<TaskRequest['mcpServers']>[number];
1
+ import type { McpServerSpec } from '@sema-agent/sdk';
2
+ import type { UiLanguage } from './env/uiLanguage.js';
3
+ export type { McpServerSpec };
3
4
  export declare const MCP_CAPS: {
4
5
  readonly items: 32;
5
6
  };
@@ -10,9 +11,53 @@ export interface McpConfigLike {
10
11
  env?: Record<string, string>;
11
12
  url?: string;
12
13
  headers?: Record<string, string>;
14
+ principalHeader?: string;
15
+ assertionHeader?: string;
13
16
  allowTools?: string[];
17
+ elicitation?: {} | null | undefined;
14
18
  toolFaces?: unknown;
15
19
  toolAxes?: unknown;
16
20
  }
21
+ export type McpHttpIdentityHeaders = {
22
+ readonly kind: 'ok';
23
+ readonly principalHeader?: string;
24
+ readonly assertionHeader?: string;
25
+ } | {
26
+ readonly kind: 'both_set';
27
+ };
28
+ export declare function readMcpHttpIdentityHeaders(transport: object): McpHttpIdentityHeaders;
17
29
  export declare function mcpConfigToSpec(name: string, c: McpConfigLike): McpServerSpec | null;
18
30
  export declare function mcpConfigsToSpecs(servers: Record<string, McpConfigLike> | undefined): McpServerSpec[];
31
+ export type McpToolAxesVerdict = {
32
+ readonly kind: 'ok';
33
+ readonly toolAxes?: Readonly<Record<string, object>>;
34
+ } | {
35
+ readonly kind: 'bad';
36
+ readonly problem: string;
37
+ } | {
38
+ readonly kind: 'unavailable';
39
+ };
40
+ export declare function mcpToolAxesVerdict(declared: {} | null | undefined): McpToolAxesVerdict;
41
+ export declare function mcpElicitationVerdict(declared: {} | null | undefined): {
42
+ readonly kind: 'ok';
43
+ readonly elicitation?: boolean;
44
+ } | {
45
+ readonly kind: 'bad';
46
+ };
47
+ export type McpConfigDropReason = 'name_blank' | 'name_edge_whitespace' | 'name_collides_after_trim' | 'tool_axes_invalid' | 'elicitation_invalid';
48
+ export interface McpConfigDropped {
49
+ readonly name: string;
50
+ readonly reason: McpConfigDropReason;
51
+ readonly problem?: string;
52
+ readonly notice: string;
53
+ }
54
+ export interface McpConfigProjection {
55
+ readonly specs: McpServerSpec[];
56
+ readonly dropped: readonly McpConfigDropped[];
57
+ }
58
+ export interface ProjectMcpConfigsOptions {
59
+ readonly sourceLabel?: (serverName: string) => string | undefined;
60
+ readonly lang?: UiLanguage;
61
+ }
62
+ export declare function projectMcpConfigs(servers: Record<string, McpConfigLike> | undefined, opts?: ProjectMcpConfigsOptions): McpConfigProjection;
63
+ export declare function mcpAssertionHeaderNotSentNotice(specs: readonly McpServerSpec[]): string | undefined;
@@ -1,14 +1,51 @@
1
+ import { guardedRead } from './ownKey.js';
2
+ import { readMcpToolAxes } from './coreValuePorts.js';
3
+ import { capForDisplay } from './fleetTaskDesc.js';
4
+ import { msg, renderMessage } from './i18n/translate.js';
5
+ const _mcpServerSpecPin = true;
6
+ void _mcpServerSpecPin;
1
7
  export const MCP_CAPS = { items: 32 };
2
- function transparentKeys(c) {
8
+ function transparentKeys(c, axes, elicitation) {
3
9
  return {
4
10
  ...(c.toolFaces !== undefined ? { toolFaces: c.toolFaces } : {}),
5
- ...(c.toolAxes !== undefined ? { toolAxes: c.toolAxes } : {}),
11
+ ...(axes !== undefined ? { toolAxes: axes } : {}),
12
+ ...(elicitation !== undefined ? { elicitation } : {}),
13
+ };
14
+ }
15
+ function presentHeaderName(v) {
16
+ return typeof v === 'string' && v.length > 0 ? v : undefined;
17
+ }
18
+ export function readMcpHttpIdentityHeaders(transport) {
19
+ const t = transport;
20
+ const principalHeader = presentHeaderName(t.principalHeader);
21
+ const assertionHeader = presentHeaderName(t.assertionHeader);
22
+ if (principalHeader !== undefined && assertionHeader !== undefined)
23
+ return { kind: 'both_set' };
24
+ return {
25
+ kind: 'ok',
26
+ ...(principalHeader !== undefined ? { principalHeader } : {}),
27
+ ...(assertionHeader !== undefined ? { assertionHeader } : {}),
6
28
  };
7
29
  }
8
30
  export function mcpConfigToSpec(name, c) {
9
- const n = (name ?? '').trim();
10
- if (!n)
11
- return null;
31
+ return mcpConfigEntry(name, c).spec;
32
+ }
33
+ function mcpConfigEntry(name, c) {
34
+ if (mcpNameFlaw(name) !== undefined)
35
+ return { spec: null };
36
+ const declared = c.toolAxes;
37
+ const verdict = mcpToolAxesVerdict(declared);
38
+ const elDeclared = c.elicitation;
39
+ const elVerdict = mcpElicitationVerdict(elDeclared);
40
+ if (verdict.kind === 'bad' || elVerdict.kind === 'bad') {
41
+ const rest = specOf(name, c, undefined, undefined);
42
+ if (rest === null)
43
+ return { spec: null };
44
+ return verdict.kind === 'bad' ? { spec: null, axesProblem: verdict.problem } : { spec: null, elicitationInvalid: true };
45
+ }
46
+ return { spec: specOf(name, c, verdict.kind === 'ok' ? verdict.toolAxes : declared, elVerdict.elicitation) };
47
+ }
48
+ function specOf(n, c, axes, elicitation) {
12
49
  const kind = c.type ?? 'stdio';
13
50
  if (kind === 'stdio') {
14
51
  if (!c.command)
@@ -21,34 +58,145 @@ export function mcpConfigToSpec(name, c) {
21
58
  ...(c.args && c.args.length > 0 ? { args: c.args } : {}),
22
59
  ...(c.env ? { env: c.env } : {}),
23
60
  },
24
- ...(c.allowTools && c.allowTools.length > 0 ? { allowTools: c.allowTools } : {}),
25
- ...transparentKeys(c),
61
+ ...(Array.isArray(c.allowTools) ? { allowTools: c.allowTools } : {}),
62
+ ...transparentKeys(c, axes, elicitation),
26
63
  };
27
64
  }
28
65
  if (kind === 'http') {
29
66
  if (!c.url)
30
67
  return null;
68
+ const id = readMcpHttpIdentityHeaders(c);
69
+ if (id.kind === 'both_set')
70
+ return null;
31
71
  return {
32
72
  name: n,
33
73
  transport: {
34
74
  kind: 'http',
35
75
  url: c.url,
36
76
  ...(c.headers ? { headers: c.headers } : {}),
77
+ ...(id.principalHeader !== undefined ? { principalHeader: id.principalHeader } : {}),
78
+ ...(id.assertionHeader !== undefined ? { assertionHeader: id.assertionHeader } : {}),
37
79
  },
38
- ...(c.allowTools && c.allowTools.length > 0 ? { allowTools: c.allowTools } : {}),
39
- ...transparentKeys(c),
80
+ ...(Array.isArray(c.allowTools) ? { allowTools: c.allowTools } : {}),
81
+ ...transparentKeys(c, axes, elicitation),
40
82
  };
41
83
  }
42
84
  return null;
43
85
  }
44
86
  export function mcpConfigsToSpecs(servers) {
45
- const out = [];
46
- for (const [name, c] of Object.entries(servers ?? {})) {
47
- if (out.length >= MCP_CAPS.items)
87
+ return projectMcpConfigs(servers).specs;
88
+ }
89
+ export function mcpToolAxesVerdict(declared) {
90
+ if (declared === undefined)
91
+ return Object.freeze({ kind: 'ok' });
92
+ const read = readMcpToolAxes(declared);
93
+ if (read === undefined || read === null || typeof read !== 'object')
94
+ return Object.freeze({ kind: 'unavailable' });
95
+ if (read.ok === true) {
96
+ const copy = read.toolAxes;
97
+ return Object.freeze(typeof copy === 'object' && copy !== null ? { kind: 'ok', toolAxes: copy } : { kind: 'ok' });
98
+ }
99
+ if (read.ok === false) {
100
+ const problem = read.problem;
101
+ return Object.freeze({ kind: 'bad', problem: typeof problem === 'string' && problem.length > 0 ? problem : renderMessage(msg('config.mcp.toolAxesFallbackProblem')) });
102
+ }
103
+ return Object.freeze({ kind: 'unavailable' });
104
+ }
105
+ export function mcpElicitationVerdict(declared) {
106
+ if (declared === undefined)
107
+ return Object.freeze({ kind: 'ok' });
108
+ return typeof declared === 'boolean' ? Object.freeze({ kind: 'ok', elicitation: declared }) : Object.freeze({ kind: 'bad' });
109
+ }
110
+ function mcpNameFlaw(name) {
111
+ if (typeof name !== 'string')
112
+ return 'name_blank';
113
+ const t = name.trim();
114
+ if (t.length === 0)
115
+ return 'name_blank';
116
+ return t === name ? undefined : 'name_edge_whitespace';
117
+ }
118
+ const DROP_NAME_SHOWN = 80;
119
+ const DROP_LABEL_SHOWN = 140;
120
+ const DROP_PROBLEM_SHOWN = 300;
121
+ function dropNotice(name, reason, problem, opts) {
122
+ let label;
123
+ try {
124
+ label = opts?.sourceLabel?.(name);
125
+ }
126
+ catch {
127
+ label = undefined;
128
+ }
129
+ const where = typeof label === 'string' && label.length > 0 ? ` (${capForDisplay(label, DROP_LABEL_SHOWN)})` : '';
130
+ const quoted = `"${capForDisplay(name, DROP_NAME_SHOWN)}"`;
131
+ const ref = reason === 'tool_axes_invalid'
132
+ ? msg('config.mcp.toolAxesInvalid', { name: quoted, where, problem: capForDisplay(problem ?? renderMessage(msg('config.mcp.toolAxesFallbackProblem')), DROP_PROBLEM_SHOWN) })
133
+ : reason === 'elicitation_invalid'
134
+ ? msg('config.mcp.elicitationInvalid', { name: quoted, where })
135
+ : reason === 'name_blank'
136
+ ? msg('config.mcp.nameBlank', { name: quoted, where })
137
+ : reason === 'name_collides_after_trim'
138
+ ? msg('config.mcp.nameCollides', { name: quoted, where })
139
+ : msg('config.mcp.nameEdgeWhitespace', { name: quoted, where });
140
+ return renderMessage(ref, opts?.lang);
141
+ }
142
+ export function projectMcpConfigs(servers, opts) {
143
+ const specs = [];
144
+ const dropped = [];
145
+ const entries = Object.entries(servers ?? {});
146
+ const exactNames = new Set();
147
+ const trimmedCount = new Map();
148
+ for (const [name] of entries) {
149
+ const flaw = mcpNameFlaw(name);
150
+ if (flaw === undefined)
151
+ exactNames.add(name);
152
+ else if (flaw === 'name_edge_whitespace')
153
+ trimmedCount.set(name.trim(), (trimmedCount.get(name.trim()) ?? 0) + 1);
154
+ }
155
+ for (const [name, c] of entries) {
156
+ if (specs.length >= MCP_CAPS.items)
48
157
  break;
49
- const spec = mcpConfigToSpec(name, c);
50
- if (spec)
51
- out.push(spec);
158
+ const flaw = mcpNameFlaw(name);
159
+ if (flaw !== undefined) {
160
+ const reason = flaw === 'name_edge_whitespace' && (exactNames.has(name.trim()) || (trimmedCount.get(name.trim()) ?? 0) > 1) ? 'name_collides_after_trim' : flaw;
161
+ dropped.push({ name, reason, notice: dropNotice(name, reason, undefined, opts) });
162
+ continue;
163
+ }
164
+ const out = mcpConfigEntry(name, c);
165
+ if (out.spec !== null) {
166
+ specs.push(out.spec);
167
+ continue;
168
+ }
169
+ if (out.axesProblem !== undefined) {
170
+ dropped.push({ name, reason: 'tool_axes_invalid', problem: out.axesProblem, notice: dropNotice(name, 'tool_axes_invalid', out.axesProblem, opts) });
171
+ }
172
+ else if (out.elicitationInvalid === true) {
173
+ dropped.push({ name, reason: 'elicitation_invalid', notice: dropNotice(name, 'elicitation_invalid', undefined, opts) });
174
+ }
175
+ }
176
+ return { specs, dropped: Object.freeze(dropped) };
177
+ }
178
+ function assertionDeclaringServerName(spec) {
179
+ const t = spec?.transport;
180
+ if (t?.kind !== 'http')
181
+ return undefined;
182
+ const declared = t.assertionHeader;
183
+ return typeof declared === 'string' && declared.length > 0 && typeof spec?.name === 'string' ? spec.name : undefined;
184
+ }
185
+ const ASSERTION_NOTICE_NAMES_SHOWN = 5;
186
+ export function mcpAssertionHeaderNotSentNotice(specs) {
187
+ const count = guardedRead(() => (Array.isArray(specs) ? specs.length : 0)) ?? 0;
188
+ const names = [];
189
+ for (let i = 0; i < count; i++) {
190
+ const name = guardedRead(() => assertionDeclaringServerName(specs[i]));
191
+ if (name !== undefined)
192
+ names.push(name);
52
193
  }
53
- return out;
194
+ if (names.length === 0)
195
+ return undefined;
196
+ const distinct = [...new Set(names)];
197
+ const parts = distinct.slice(0, ASSERTION_NOTICE_NAMES_SHOWN).map((x) => `"${x}"`);
198
+ if (distinct.length > ASSERTION_NOTICE_NAMES_SHOWN)
199
+ parts.push(`+${distinct.length - ASSERTION_NOTICE_NAMES_SHOWN} more`);
200
+ return (`MCP servers that declare an assertion header (assertionHeader): ${parts.join(', ')} — server versions up to 7.131.0 accept this setting but do not send the header, ` +
201
+ 'and this client cannot tell whether the engine it uses sends it; a connector that requires the header will refuse requests from these servers');
54
202
  }
@@ -1,10 +1,11 @@
1
- export type MemoryEntryOriginMark = 'marked' | 'unmarked' | 'undecidable';
1
+ import type { MemoryErasedBinding } from '@sema-agent/sdk';
2
+ export type MemoryEntryOriginMarkReading = 'marked' | 'unmarked' | 'undecidable';
2
3
  export interface MemoryExportEntryRow {
3
4
  id: string;
4
5
  slug: string;
5
6
  scope: string;
6
7
  rev: string;
7
- originMark: MemoryEntryOriginMark;
8
+ originMark: MemoryEntryOriginMarkReading;
8
9
  }
9
10
  export type MemoryExportUnreadableCause = 'body_unreadable' | 'envelope_absent' | 'envelope_unreadable' | 'too_many_rows' | 'rows_unreadable';
10
11
  export type MemoryExportReading = {
@@ -36,13 +37,7 @@ export type ScopeExternalOriginVerdict = {
36
37
  export declare function scopeExternalOriginVerdict(reading: MemoryExportReading, asked: {
37
38
  originAware: boolean;
38
39
  }): ScopeExternalOriginVerdict;
39
- export type MemoryErasedBinding = {
40
- state: 'bound';
41
- scope: string;
42
- slug: string;
43
- } | {
44
- state: 'unbound';
45
- };
40
+ export type { MemoryErasedBinding };
46
41
  export interface MemoryErasedRow {
47
42
  id: string;
48
43
  rev: string;
@@ -1,3 +1,4 @@
1
+ import { readThrownSlot, THROWN_SLOT_UNREADABLE } from './wireFailureShape.js';
1
2
  function nonEmptyString(v) {
2
3
  return typeof v === 'string' && v !== '';
3
4
  }
@@ -216,16 +217,10 @@ export function readMemoryEraseReceipt(body) {
216
217
  return { kind: 'malformed', why: 'body_unreadable' };
217
218
  o = body;
218
219
  envelopeSeen = ['v', 'requestId', 'status', 'erased', 'notFound'].some((k) => Object.hasOwn(o, k));
219
- rawV = Object.hasOwn(o, 'v') ? o.v : undefined;
220
- rawRequestId = o.requestId;
221
- rawStatus = o.status;
222
- rawEvidence = o.evidenceCapability;
223
- rawCustody = o.custodyState;
224
- rawSelected = o.resolvedIds;
225
- rawErased = o.erased;
226
- rawNotFound = o.notFound;
227
- rawPreviously = Object.hasOwn(o, 'erasedPreviously') ? o.erasedPreviously : undefined;
228
- rawConflicts = o.conflicts;
220
+ const slots = ['v', 'requestId', 'status', 'evidenceCapability', 'custodyState', 'resolvedIds', 'erased', 'notFound', 'erasedPreviously', 'conflicts'].map((k) => readThrownSlot(o, k, 'data'));
221
+ if (slots.includes(THROWN_SLOT_UNREADABLE))
222
+ return { kind: 'malformed', why: 'body_unreadable' };
223
+ [rawV, rawRequestId, rawStatus, rawEvidence, rawCustody, rawSelected, rawErased, rawNotFound, rawPreviously, rawConflicts] = slots;
229
224
  }
230
225
  catch {
231
226
  return { kind: 'malformed', why: 'body_unreadable' };
@@ -25,7 +25,6 @@ export interface TierGroupsView {
25
25
  export interface DeleteWarningsInput {
26
26
  id: string;
27
27
  doc: {
28
- atModelAllowlist?: unknown;
29
28
  atMention?: unknown;
30
29
  tierGroups?: unknown;
31
30
  } | null;
@@ -35,7 +34,6 @@ export interface DeleteWarningsInput {
35
34
  export interface DeleteBlockersInput {
36
35
  id: string;
37
36
  doc: {
38
- default?: unknown;
39
37
  roles?: unknown;
40
38
  } | null;
41
39
  rosters: {
@@ -22,9 +22,7 @@ export function computeDeleteWarnings(input) {
22
22
  if (before.mode === 'only' && after.mode === 'none') {
23
23
  out.push({
24
24
  kind: 'allowlist-empties',
25
- consequence: am.from === 'atModelAllowlist'
26
- ? 'it is the last usable model on your @-mention allowlist — deleting it empties the list, which means EVERY enabled model becomes @-mentionable'
27
- : 'it is the last usable model on your @-mention allowlist — deleting it leaves no model that can be @-mentioned',
25
+ consequence: 'it is the last usable model on your @-mention allowlist — deleting it leaves no model that can be @-mentioned',
28
26
  });
29
27
  }
30
28
  }
@@ -58,24 +56,17 @@ export function computeDeleteBlockers(input) {
58
56
  fix: 'fix or re-save models.json so it can be read, then delete this model',
59
57
  });
60
58
  }
61
- if (policy.defaultUnreadable) {
62
- out.push({
63
- kind: 'unreadable',
64
- where: 'models.json `default` (the default model could not be read)',
65
- fix: 'fix or re-save models.json so its default model can be read, then delete this model',
66
- });
67
- }
68
59
  const dm = policy.defaultModel;
69
60
  if (dm !== undefined && dm.name === id) {
70
61
  out.push({
71
62
  kind: 'default',
72
- where: dm.from === 'default' ? 'models.json `default`' : 'models.json roles.default',
63
+ where: 'models.json roles.default',
73
64
  fix: 'point another model at the default first (Model Hub: select it and press u), then delete this one',
74
65
  });
75
66
  }
76
67
  if (doc && isPlainObject(doc.roles)) {
77
68
  for (const [role, target] of Object.entries(doc.roles)) {
78
- if (role === 'default' && dm?.from === 'roles.default')
69
+ if (role === 'default' && dm !== undefined)
79
70
  continue;
80
71
  if (!isPlainObject(target) || typeof target.model !== 'string')
81
72
  continue;
@@ -1,20 +1,15 @@
1
1
  import { type SettingsAtMention } from '../generated/settingsSchemaFns.js';
2
2
  export interface CanonicalDefaultModel {
3
3
  readonly name: string;
4
- readonly from: 'default' | 'roles.default';
5
4
  }
6
5
  export type CanonicalAtMention = {
7
6
  readonly kind: 'read';
8
7
  readonly value: SettingsAtMention;
9
- readonly from: 'atMention' | 'atModelAllowlist';
10
- readonly unreadableEntries: number;
11
8
  } | {
12
9
  readonly kind: 'unreadable';
13
- readonly from: 'atMention' | 'atModelAllowlist';
14
10
  };
15
11
  export interface CanonicalModelsPolicy {
16
12
  readonly defaultModel?: CanonicalDefaultModel;
17
- readonly defaultUnreadable?: true;
18
13
  readonly atMention?: CanonicalAtMention;
19
14
  readonly unreadable?: true;
20
15
  }