@sema-agent/client-core 0.94.0 → 0.96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/CHANGELOG.md +521 -0
  2. package/README.md +104 -57
  3. package/dist/adapt/arms.js +12 -7
  4. package/dist/adapt/panelTasks.js +4 -10
  5. package/dist/adapt/toolCards.d.ts +1 -0
  6. package/dist/adapt/toolCards.js +18 -5
  7. package/dist/adapt/wireShapes.js +5 -24
  8. package/dist/adapter/activeRunSelfHeal.d.ts +12 -3
  9. package/dist/adapter/activeRunSelfHeal.js +50 -16
  10. package/dist/adapter/downstream/eventToSdkMessage.js +33 -18
  11. package/dist/adapter/downstream/terminalToSdkResult.js +19 -12
  12. package/dist/adapter/runStream.js +30 -46
  13. package/dist/adapter/types.d.ts +7 -0
  14. package/dist/adapter/types.js +15 -0
  15. package/dist/agentSession/backgroundView.js +5 -1
  16. package/dist/agentSession/engineAgentRegistryRead.js +7 -5
  17. package/dist/agentSession/engineSessionBackgroundStop.js +25 -17
  18. package/dist/agentsWireCaps.d.ts +2 -0
  19. package/dist/agentsWireCaps.js +13 -2
  20. package/dist/approvalDecidedByCapability.d.ts +0 -1
  21. package/dist/approvalDecidedByCapability.js +2 -7
  22. package/dist/approvalsStreamLiveCapability.d.ts +0 -1
  23. package/dist/approvalsStreamLiveCapability.js +2 -6
  24. package/dist/atMostOnce.d.ts +8 -0
  25. package/dist/atMostOnce.js +36 -0
  26. package/dist/attachmentSeatCapability.d.ts +0 -1
  27. package/dist/attachmentSeatCapability.js +0 -3
  28. package/dist/attachmentsWireCaps.js +11 -6
  29. package/dist/bashExitReading.d.ts +10 -0
  30. package/dist/bashExitReading.js +12 -0
  31. package/dist/callerCwdCapability.d.ts +0 -5
  32. package/dist/callerCwdCapability.js +2 -13
  33. package/dist/centerWiringCapability.d.ts +1 -7
  34. package/dist/centerWiringCapability.js +18 -27
  35. package/dist/classifierStatus.js +4 -4
  36. package/dist/classifierVerdictWire.js +4 -16
  37. package/dist/clientSlice.js +1 -1
  38. package/dist/cloudConfigWireCaps.d.ts +3 -3
  39. package/dist/cloudConfigWireCaps.js +85 -43
  40. package/dist/compensations.js +1 -1
  41. package/dist/coreValuePorts.d.ts +11 -7
  42. package/dist/coreValuePorts.js +5 -8
  43. package/dist/credentialProvenance.d.ts +28 -0
  44. package/dist/credentialProvenance.js +76 -0
  45. package/dist/cycleOrder.d.ts +15 -0
  46. package/dist/cycleOrder.js +45 -0
  47. package/dist/decideFailureNote.js +7 -2
  48. package/dist/decideReceipt.d.ts +2 -1
  49. package/dist/decideReceipt.js +39 -14
  50. package/dist/declared/supportFloorDeclared.d.ts +1 -0
  51. package/dist/declared/supportFloorDeclared.js +5 -0
  52. package/dist/deviceExecutorManagementCapability.d.ts +0 -1
  53. package/dist/deviceExecutorManagementCapability.js +7 -16
  54. package/dist/deviceRebind.d.ts +88 -0
  55. package/dist/deviceRebind.js +242 -0
  56. package/dist/displayUntrusted.d.ts +8 -3
  57. package/dist/displayUntrusted.js +661 -63
  58. package/dist/engineAgentAbsence.d.ts +2 -2
  59. package/dist/engineAgentPanelStore.d.ts +8 -18
  60. package/dist/engineAgentPanelStore.js +19 -537
  61. package/dist/engineCapReader.d.ts +6 -6
  62. package/dist/engineCapReader.js +30 -43
  63. package/dist/engineCapsCache.d.ts +13 -2
  64. package/dist/engineCapsCache.js +276 -44
  65. package/dist/engineCredentialRequirement.d.ts +9 -0
  66. package/dist/engineCredentialRequirement.js +23 -0
  67. package/dist/engineDirectory.d.ts +79 -0
  68. package/dist/engineDirectory.js +186 -0
  69. package/dist/engineEnvSourcing.d.ts +53 -0
  70. package/dist/engineEnvSourcing.js +81 -0
  71. package/dist/engineErrorCodes.d.ts +28 -4
  72. package/dist/engineErrorCodes.js +68 -25
  73. package/dist/engineIdentity.js +2 -0
  74. package/dist/engineNoticeCodes.d.ts +17 -0
  75. package/dist/engineNoticeCodes.js +57 -3
  76. package/dist/engineWireSdk.js +2 -2
  77. package/dist/engineWordRenames.d.ts +8 -0
  78. package/dist/engineWordRenames.js +13 -0
  79. package/dist/executionLaneCapability.d.ts +2 -3
  80. package/dist/executionLaneCapability.js +18 -23
  81. package/dist/fileHistoryCaptureCapability.d.ts +14 -1
  82. package/dist/fileHistoryCaptureCapability.js +72 -6
  83. package/dist/fileHistoryLegNotice.d.ts +3 -2
  84. package/dist/fileHistoryLegNotice.js +51 -2
  85. package/dist/fleet/bgSubagentRow.d.ts +15 -0
  86. package/dist/fleet/bgSubagentRow.js +67 -0
  87. package/dist/fleet/fleetLedger.d.ts +3 -0
  88. package/dist/fleet/fleetLedger.js +153 -122
  89. package/dist/fleet/fleetProjection.d.ts +1 -3
  90. package/dist/fleet/fleetProjection.js +19 -19
  91. package/dist/fleetAgentPanelProjection.d.ts +4 -17
  92. package/dist/fleetAgentPanelProjection.js +7 -197
  93. package/dist/fleetAgentRowLike.d.ts +16 -0
  94. package/dist/fleetAgentRowLike.js +1 -0
  95. package/dist/fleetTaskDesc.js +4 -17
  96. package/dist/gateOutcome.d.ts +12 -1
  97. package/dist/gateOutcome.js +87 -18
  98. package/dist/gateVocabulary.d.ts +7 -2
  99. package/dist/gateVocabulary.js +5 -1
  100. package/dist/generated/engineAskFaceTables.js +1 -1
  101. package/dist/generated/engineFactTables.d.ts +5 -3
  102. package/dist/generated/engineFactTables.js +17 -4
  103. package/dist/generated/engineNoticeTables.js +12 -3
  104. package/dist/generated/sdkFactTables.d.ts +2 -0
  105. package/dist/generated/sdkFactTables.js +17 -0
  106. package/dist/generated/settingsSchemaFns.d.ts +13 -0
  107. package/dist/generated/settingsSchemaFns.js +75 -0
  108. package/dist/generated/toolNameTables.d.ts +1 -0
  109. package/dist/generated/toolNameTables.js +1 -0
  110. package/dist/headlessPermissionModeWire.d.ts +1 -1
  111. package/dist/headlessPermissionModeWire.js +1 -1
  112. package/dist/headlessReconnectWire.js +49 -20
  113. package/dist/hitl/allowRuleShadow.d.ts +1 -1
  114. package/dist/hitl/allowRuleShadow.js +49 -8
  115. package/dist/hitl/approvalCompleteParked.d.ts +1 -0
  116. package/dist/hitl/approvalCompleteParked.js +14 -0
  117. package/dist/hitl/approvalEndingCause.d.ts +7 -0
  118. package/dist/hitl/approvalEndingCause.js +71 -0
  119. package/dist/hitl/approvalHolds.d.ts +12 -2
  120. package/dist/hitl/approvalHolds.js +53 -2
  121. package/dist/hitl/approvalsFeed.js +23 -11
  122. package/dist/hitl/askGateWire.d.ts +2 -1
  123. package/dist/hitl/askGateWire.js +26 -1
  124. package/dist/hitl/askParkRowRouting.js +1 -1
  125. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  126. package/dist/hitl/automaticAnswerVerdict.js +15 -10
  127. package/dist/hitl/crashConverged.js +2 -0
  128. package/dist/hitl/decisionConflict.d.ts +3 -0
  129. package/dist/hitl/decisionConflict.js +41 -0
  130. package/dist/hitl/decisionRefusal.d.ts +12 -0
  131. package/dist/hitl/decisionRefusal.js +63 -4
  132. package/dist/hitl/frameRouter.d.ts +0 -1
  133. package/dist/hitl/frameRouter.js +32 -57
  134. package/dist/hitl/gateLedger.d.ts +5 -0
  135. package/dist/hitl/gateLedger.js +21 -0
  136. package/dist/hitl/hitlBridge.d.ts +17 -2
  137. package/dist/hitl/hitlBridge.js +91 -55
  138. package/dist/hitl/hitlHostSurface.js +3 -11
  139. package/dist/hitl/livePendingAsk.d.ts +16 -6
  140. package/dist/hitl/livePendingAsk.js +36 -4
  141. package/dist/hitl/localAllowRule.d.ts +1 -0
  142. package/dist/hitl/localAllowRule.js +2 -2
  143. package/dist/hitl/noAllowCause.d.ts +2 -1
  144. package/dist/hitl/noAllowCause.js +3 -2
  145. package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
  146. package/dist/hitl/parkExpiryJudgements.js +46 -0
  147. package/dist/hitl/parkResolver.d.ts +4 -7
  148. package/dist/hitl/parkResolver.js +12 -34
  149. package/dist/hitl/parkRowBirthWait.d.ts +1 -0
  150. package/dist/hitl/parkRowBirthWait.js +2 -2
  151. package/dist/hitl/persistedRulesWire.js +5 -1
  152. package/dist/hitl/planReviewWire.d.ts +3 -2
  153. package/dist/hitl/planReviewWire.js +154 -50
  154. package/dist/hitl/replayedApproval.d.ts +9 -0
  155. package/dist/hitl/replayedApproval.js +139 -10
  156. package/dist/hitl/resumeRunningCard.d.ts +2 -0
  157. package/dist/hitl/resumeRunningCard.js +15 -4
  158. package/dist/hitl/sessionPolicyDeliverable.js +8 -6
  159. package/dist/hitl/standingRows.d.ts +18 -0
  160. package/dist/hitl/standingRows.js +127 -0
  161. package/dist/hitl/toolApprovalWire.d.ts +39 -7
  162. package/dist/hitl/toolApprovalWire.js +351 -61
  163. package/dist/hookMatcherVerdict.d.ts +1 -9
  164. package/dist/hookMatcherVerdict.js +21 -61
  165. package/dist/hooksWireCaps.js +40 -8
  166. package/dist/host.d.ts +5 -0
  167. package/dist/host.js +3 -1
  168. package/dist/hostCallbackGuard.d.ts +2 -0
  169. package/dist/hostCallbackGuard.js +31 -0
  170. package/dist/index.d.ts +48 -17
  171. package/dist/index.js +36 -15
  172. package/dist/interactiveInterrupt.d.ts +8 -0
  173. package/dist/interactiveInterrupt.js +54 -0
  174. package/dist/limitsWire.d.ts +5 -0
  175. package/dist/limitsWire.js +49 -3
  176. package/dist/liveModelCatalog.d.ts +95 -0
  177. package/dist/liveModelCatalog.js +297 -32
  178. package/dist/mcpEngineLeg.d.ts +25 -0
  179. package/dist/mcpEngineLeg.js +71 -15
  180. package/dist/mcpPanel.js +2 -1
  181. package/dist/mcpProbeCapability.d.ts +0 -5
  182. package/dist/mcpProbeCapability.js +2 -12
  183. package/dist/mcpReconnect.d.ts +1 -3
  184. package/dist/mcpReconnect.js +10 -5
  185. package/dist/memoryComplianceCapability.d.ts +0 -5
  186. package/dist/memoryComplianceCapability.js +2 -12
  187. package/dist/memoryOriginCapability.d.ts +0 -5
  188. package/dist/memoryOriginCapability.js +2 -12
  189. package/dist/memorySpecWire.js +2 -2
  190. package/dist/memoryVerbsWire.d.ts +1 -1
  191. package/dist/memoryVerbsWire.js +4 -0
  192. package/dist/model/liveCatalogShape.d.ts +14 -0
  193. package/dist/model/liveCatalogShape.js +71 -0
  194. package/dist/model/modelSupplyRules.d.ts +1 -0
  195. package/dist/model/modelSupplyRules.js +30 -9
  196. package/dist/model/modelsPolicy.d.ts +21 -0
  197. package/dist/model/modelsPolicy.js +90 -0
  198. package/dist/modelIdentityResolvability.d.ts +2 -2
  199. package/dist/modelIdentityResolvability.js +14 -12
  200. package/dist/modelSwitchFallback.d.ts +69 -0
  201. package/dist/modelSwitchFallback.js +206 -0
  202. package/dist/noticePresentation.d.ts +68 -0
  203. package/dist/noticePresentation.js +247 -0
  204. package/dist/notifications.js +12 -11
  205. package/dist/outputStyleSeatCapability.d.ts +0 -2
  206. package/dist/outputStyleSeatCapability.js +2 -10
  207. package/dist/ownKey.d.ts +8 -0
  208. package/dist/ownKey.js +66 -0
  209. package/dist/panelReduce.d.ts +114 -0
  210. package/dist/panelReduce.js +1135 -0
  211. package/dist/panelStateHolder.d.ts +17 -0
  212. package/dist/panelStateHolder.js +201 -0
  213. package/dist/peerFrames.js +13 -9
  214. package/dist/peerLaneCapability.d.ts +0 -1
  215. package/dist/peerLaneCapability.js +2 -6
  216. package/dist/permissionModesCapability.d.ts +0 -5
  217. package/dist/permissionModesCapability.js +5 -16
  218. package/dist/permissionRuleIssue.js +0 -3
  219. package/dist/permissionRulesWriteCapability.d.ts +0 -1
  220. package/dist/permissionRulesWriteCapability.js +2 -6
  221. package/dist/permissionsAllowGrantCapability.d.ts +0 -1
  222. package/dist/permissionsAllowGrantCapability.js +3 -9
  223. package/dist/permissionsDeclaration.d.ts +8 -0
  224. package/dist/permissionsDeclaration.js +101 -41
  225. package/dist/printPermissionOutcome.d.ts +12 -0
  226. package/dist/printPermissionOutcome.js +50 -0
  227. package/dist/printToolResultFrame.d.ts +1 -0
  228. package/dist/printToolResultFrame.js +5 -17
  229. package/dist/promptBlockedCopy.d.ts +5 -0
  230. package/dist/promptBlockedCopy.js +35 -0
  231. package/dist/promptDelivery.js +0 -8
  232. package/dist/protocolSegment.d.ts +9 -6
  233. package/dist/protocolSegment.js +31 -21
  234. package/dist/providerRejection.d.ts +4 -0
  235. package/dist/providerRejection.js +75 -14
  236. package/dist/replayBody.d.ts +12 -0
  237. package/dist/replayBody.js +25 -0
  238. package/dist/resumeRefusalCopy.d.ts +18 -1
  239. package/dist/resumeRefusalCopy.js +127 -32
  240. package/dist/retryStatus.d.ts +9 -1
  241. package/dist/retryStatus.js +9 -2
  242. package/dist/rewindArchiveCapability.d.ts +5 -14
  243. package/dist/rewindArchiveCapability.js +18 -61
  244. package/dist/rewindArchiveReading.d.ts +15 -0
  245. package/dist/rewindArchiveReading.js +56 -0
  246. package/dist/rewindEngineAction.d.ts +21 -0
  247. package/dist/rewindEngineAction.js +36 -0
  248. package/dist/rewindWireCaps.d.ts +2 -1
  249. package/dist/rewindWireCaps.js +1 -0
  250. package/dist/ruleCompileVerdict.d.ts +9 -1
  251. package/dist/ruleCompileVerdict.js +29 -4
  252. package/dist/runTerminal.d.ts +15 -12
  253. package/dist/runTerminal.js +60 -35
  254. package/dist/sandboxWire.js +13 -0
  255. package/dist/sdkRegistryTransit.d.ts +2 -1
  256. package/dist/sdkRegistryTransit.js +1 -0
  257. package/dist/sealedKeyCapability.d.ts +0 -5
  258. package/dist/sealedKeyCapability.js +3 -15
  259. package/dist/seam.js +4 -2
  260. package/dist/seatContract.d.ts +125 -34
  261. package/dist/seatContract.js +583 -179
  262. package/dist/sessionIdSegment.d.ts +1 -0
  263. package/dist/sessionIdSegment.js +11 -0
  264. package/dist/sessionMemoryErase.d.ts +1 -1
  265. package/dist/sessionMemoryErase.js +6 -1
  266. package/dist/sessionMemoryStatus.js +3 -2
  267. package/dist/sessionPolicyCapability.d.ts +0 -1
  268. package/dist/sessionPolicyCapability.js +2 -6
  269. package/dist/sessionReadRedactionCapability.d.ts +0 -5
  270. package/dist/sessionReadRedactionCapability.js +2 -13
  271. package/dist/sessionSyncFileHistory.d.ts +4 -0
  272. package/dist/sessionSyncFileHistory.js +66 -0
  273. package/dist/sessionSyncFileHistoryCapability.d.ts +0 -2
  274. package/dist/sessionSyncFileHistoryCapability.js +2 -9
  275. package/dist/skillToolListsCapability.d.ts +0 -2
  276. package/dist/skillToolListsCapability.js +2 -9
  277. package/dist/skillsWireCaps.d.ts +4 -0
  278. package/dist/skillsWireCaps.js +66 -1
  279. package/dist/sqlEngineCapability.d.ts +0 -1
  280. package/dist/sqlEngineCapability.js +9 -14
  281. package/dist/steerPriorityCapability.d.ts +0 -2
  282. package/dist/steerPriorityCapability.js +3 -12
  283. package/dist/storePostureCapability.d.ts +1 -5
  284. package/dist/storePostureCapability.js +16 -22
  285. package/dist/streamDrainingLegs.d.ts +6 -0
  286. package/dist/streamDrainingLegs.js +23 -0
  287. package/dist/subagent/engineCompactWire.js +13 -38
  288. package/dist/subagent/engineDelegatedPrompt.js +10 -6
  289. package/dist/subagent/engineSubagentOutput.d.ts +0 -1
  290. package/dist/subagent/engineSubagentOutput.js +5 -20
  291. package/dist/subagent/engineSubagentSteer.js +7 -5
  292. package/dist/subagent/engineSubagentTail.d.ts +0 -1
  293. package/dist/subagent/engineSubagentTail.js +7 -32
  294. package/dist/subagentContentStore.js +7 -18
  295. package/dist/supportFloor.d.ts +1 -0
  296. package/dist/supportFloor.js +15 -14
  297. package/dist/systemReminderTag.d.ts +1 -0
  298. package/dist/systemReminderTag.js +8 -0
  299. package/dist/terminalStatuses.d.ts +30 -0
  300. package/dist/terminalStatuses.js +67 -0
  301. package/dist/toolHistoryMismatch.d.ts +0 -3
  302. package/dist/toolHistoryMismatch.js +3 -7
  303. package/dist/toolResult.d.ts +6 -1
  304. package/dist/toolResult.js +90 -37
  305. package/dist/toolResultContent.d.ts +2 -0
  306. package/dist/toolResultContent.js +63 -0
  307. package/dist/types/engineState.d.ts +2 -1
  308. package/dist/usageAnalytics.d.ts +146 -0
  309. package/dist/usageAnalytics.js +335 -0
  310. package/dist/userInvokedSkillsCapability.d.ts +0 -2
  311. package/dist/userInvokedSkillsCapability.js +2 -9
  312. package/dist/webSearchBackendCapability.d.ts +0 -1
  313. package/dist/webSearchBackendCapability.js +3 -7
  314. package/dist/webSearchWireCaps.js +3 -11
  315. package/dist/wireErrorTriage.d.ts +2 -0
  316. package/dist/wireErrorTriage.js +34 -5
  317. package/dist/wireFailureShape.d.ts +23 -2
  318. package/dist/wireFailureShape.js +88 -43
  319. package/dist/wireRefusalCopy.js +2 -18
  320. package/dist/workflowClient.js +7 -11
  321. package/dist/workflowsJournalCapability.d.ts +0 -1
  322. package/dist/workflowsJournalCapability.js +2 -6
  323. package/dist/writeProtectionCapability.d.ts +0 -1
  324. package/dist/writeProtectionCapability.js +5 -10
  325. package/docs/INTEGRATION-CLIENTS.md +2279 -27
  326. package/package.json +5 -5
  327. package/dist/engineCapsGenerationGuard.d.ts +0 -4
  328. package/dist/engineCapsGenerationGuard.js +0 -19
  329. package/dist/panelRunningHistory.d.ts +0 -22
  330. package/dist/panelRunningHistory.js +0 -82
  331. package/dist/registryConflict.d.ts +0 -3
  332. package/dist/registryConflict.js +0 -44
@@ -1,3 +1,4 @@
1
+ import { frozenJsonCopyOf, liveDefaultModelCopy, liveModelRowCopy } from './model/liveCatalogShape.js';
1
2
  let catalog = null;
2
3
  let refresher = null;
3
4
  export function setLiveModelCatalog(next) {
@@ -42,6 +43,12 @@ function ownDataOf(o, key) {
42
43
  }
43
44
  }
44
45
  function liveModelRowOf(cat, ref) {
46
+ const rows = catalogRowsOf(cat);
47
+ if (rows === undefined)
48
+ return undefined;
49
+ return rows.find((row) => ownDataOf(row, 'name') === ref) ?? rows.find((row) => ownDataOf(row, 'id') === ref);
50
+ }
51
+ function catalogRowsOf(cat) {
45
52
  const models = ownDataOf(cat, 'models');
46
53
  if (!Array.isArray(models))
47
54
  return undefined;
@@ -54,25 +61,31 @@ function liveModelRowOf(cat, ref) {
54
61
  if (row !== null && typeof row === 'object')
55
62
  rows.push(row);
56
63
  }
57
- return rows.find((row) => ownDataOf(row, 'name') === ref) ?? rows.find((row) => ownDataOf(row, 'id') === ref);
64
+ return rows;
65
+ }
66
+ function targetRowOf(model, cat) {
67
+ if (model !== undefined && typeof model !== 'string')
68
+ return { kind: 'none', why: 'unreadable' };
69
+ if (cat === null || typeof cat !== 'object' || Array.isArray(cat))
70
+ return { kind: 'none', why: 'no_catalog' };
71
+ let target = model !== undefined && model.length > 0 ? model : undefined;
72
+ if (target === undefined) {
73
+ const d = liveDefaultModelOf(cat);
74
+ if (d.kind === 'unknown' && d.why === 'unreadable')
75
+ return { kind: 'none', why: 'unreadable' };
76
+ if (d.kind !== 'listed')
77
+ return { kind: 'none', why: 'model_not_listed' };
78
+ target = d.name;
79
+ }
80
+ const row = liveModelRowOf(cat, target);
81
+ return row === undefined ? { kind: 'none', why: 'model_not_listed' } : { kind: 'row', row };
58
82
  }
59
83
  export function imageVisionOf(model, catalog = getLiveModelCatalog()) {
60
84
  try {
61
- if (model !== undefined && typeof model !== 'string')
62
- return 'unknown';
63
- if (catalog === null || typeof catalog !== 'object' || Array.isArray(catalog))
64
- return 'unknown';
65
- let target = model !== undefined && model.length > 0 ? model : undefined;
66
- if (target === undefined) {
67
- const def = ownDataOf(catalog, 'default');
68
- target = typeof def === 'string' && def.length > 0 ? def : undefined;
69
- }
70
- if (target === undefined)
71
- return 'unknown';
72
- const row = liveModelRowOf(catalog, target);
73
- if (row === undefined)
85
+ const target = targetRowOf(model, catalog);
86
+ if (target.kind !== 'row')
74
87
  return 'unknown';
75
- const vision = ownDataOf(row, 'vision');
88
+ const vision = ownDataOf(target.row, 'vision');
76
89
  return vision === true ? 'yes' : vision === false ? 'no' : 'unknown';
77
90
  }
78
91
  catch {
@@ -84,20 +97,10 @@ const NOT_APPLICABLE = Object.freeze({ kind: 'not_applicable' });
84
97
  const unknownEffort = (why) => Object.freeze({ kind: 'unknown', why });
85
98
  export function effortLevelsOf(model, catalog = getLiveModelCatalog()) {
86
99
  try {
87
- if (model !== undefined && typeof model !== 'string')
88
- return unknownEffort('unreadable');
89
- if (catalog === null || typeof catalog !== 'object' || Array.isArray(catalog))
90
- return unknownEffort('no_catalog');
91
- let target = model !== undefined && model.length > 0 ? model : undefined;
92
- if (target === undefined) {
93
- const def = ownDataOf(catalog, 'default');
94
- target = typeof def === 'string' && def.length > 0 ? def : undefined;
95
- }
96
- if (target === undefined)
97
- return unknownEffort('model_not_listed');
98
- const row = liveModelRowOf(catalog, target);
99
- if (row === undefined)
100
- return unknownEffort('model_not_listed');
100
+ const target = targetRowOf(model, catalog);
101
+ if (target.kind !== 'row')
102
+ return unknownEffort(target.why);
103
+ const row = target.row;
101
104
  const levels = ownDataOf(row, 'supportedEffortLevels');
102
105
  if (levels !== undefined) {
103
106
  if (!Array.isArray(levels))
@@ -141,9 +144,89 @@ export function effortLevelHonored(reading, level) {
141
144
  }
142
145
  }
143
146
  export function liveDefaultModelName() {
144
- if (!catalog?.default)
145
- return null;
146
- return normalizeLiveModelRef(catalog.default);
147
+ const d = liveDefaultModelOf(catalog);
148
+ return d.kind === 'listed' ? d.name : d.kind === 'not_listed' ? d.id : null;
149
+ }
150
+ const notReportedDropped = () => Object.freeze({ kind: 'not_reported' });
151
+ const unknownDropped = (why) => Object.freeze({ kind: 'unknown', why });
152
+ function ownDataCopy(o) {
153
+ const out = {};
154
+ for (const k of Object.keys(o)) {
155
+ const d = Object.getOwnPropertyDescriptor(o, k);
156
+ if (d === undefined || !('value' in d))
157
+ return undefined;
158
+ Object.defineProperty(out, k, { value: d.value, enumerable: true, writable: true, configurable: true });
159
+ }
160
+ return out;
161
+ }
162
+ function isDroppedRow(r) {
163
+ const index = r.index;
164
+ if (typeof index !== 'number' || !Number.isSafeInteger(index) || index < 0)
165
+ return false;
166
+ if (typeof r.reasonCode !== 'string' || r.reasonCode.length === 0)
167
+ return false;
168
+ if (!Object.hasOwn(r, 'identity'))
169
+ return true;
170
+ const id = r.identity;
171
+ if (id === null || typeof id !== 'object' || Array.isArray(id) || !Object.isFrozen(id))
172
+ return false;
173
+ const idr = id;
174
+ for (const k of ['name', 'id'])
175
+ if (Object.hasOwn(idr, k) && (typeof idr[k] !== 'string' || idr[k] === ''))
176
+ return false;
177
+ return !Object.hasOwn(idr, 'enabled') || typeof idr.enabled === 'boolean';
178
+ }
179
+ function droppedRowOf(row) {
180
+ if (row === null || typeof row !== 'object' || Array.isArray(row))
181
+ return undefined;
182
+ const copy = ownDataCopy(row);
183
+ if (copy === undefined)
184
+ return undefined;
185
+ if (Object.hasOwn(copy, 'identity')) {
186
+ const id = copy.identity;
187
+ if (id === null || typeof id !== 'object' || Array.isArray(id))
188
+ return undefined;
189
+ const idCopy = ownDataCopy(id);
190
+ if (idCopy === undefined)
191
+ return undefined;
192
+ copy.identity = Object.freeze(idCopy);
193
+ }
194
+ if (!isDroppedRow(copy))
195
+ return undefined;
196
+ return Object.freeze(copy);
197
+ }
198
+ export function droppedModelEntriesOf(catalog = getLiveModelCatalog()) {
199
+ try {
200
+ if (catalog === null || typeof catalog !== 'object' || Array.isArray(catalog))
201
+ return unknownDropped('no_catalog');
202
+ if (!Object.hasOwn(catalog, 'droppedEntries'))
203
+ return notReportedDropped();
204
+ const d = Object.getOwnPropertyDescriptor(catalog, 'droppedEntries');
205
+ if (d === undefined || !('value' in d))
206
+ return unknownDropped('unreadable');
207
+ const raw = d.value;
208
+ if (raw === undefined)
209
+ return notReportedDropped();
210
+ if (!Array.isArray(raw))
211
+ return unknownDropped('malformed');
212
+ const n = ownDataOf(raw, 'length');
213
+ if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0)
214
+ return unknownDropped('unreadable');
215
+ const entries = [];
216
+ let unreadable = 0;
217
+ for (let i = 0; i < n; i += 1) {
218
+ const rd = Object.getOwnPropertyDescriptor(raw, String(i));
219
+ const row = rd !== undefined && 'value' in rd ? droppedRowOf(rd.value) : undefined;
220
+ if (row === undefined)
221
+ unreadable += 1;
222
+ else
223
+ entries.push(row);
224
+ }
225
+ return Object.freeze({ kind: 'reported', entries: Object.freeze(entries), unreadable });
226
+ }
227
+ catch {
228
+ return unknownDropped('unreadable');
229
+ }
147
230
  }
148
231
  const ROUTE_PAIRING_OK = new Set(['ok:per-model', 'ok:paired', 'ok:unpinned', 'ok:keyless']);
149
232
  const ROUTE_PAIRING_BROKEN = new Set(['broken:credential_mismatch', 'broken:credential_missing']);
@@ -156,3 +239,185 @@ export function routePairingVerdict(v) {
156
239
  return { verdict: 'broken', posture: v };
157
240
  return { verdict: 'unknown', posture: v };
158
241
  }
242
+ const unreadableCatalog = (why) => Object.freeze({ kind: 'unreadable', why });
243
+ function envelopeKey(o, key) {
244
+ const d = Object.getOwnPropertyDescriptor(o, key);
245
+ if (d === undefined)
246
+ return { present: false };
247
+ if (!('value' in d))
248
+ throw new Error('accessor');
249
+ return { present: true, value: d.value };
250
+ }
251
+ export function readLiveModelCatalog(body) {
252
+ try {
253
+ if (body === null || typeof body !== 'object' || Array.isArray(body))
254
+ return unreadableCatalog('not_an_object');
255
+ const modelsKey = envelopeKey(body, 'models');
256
+ const defaultKey = envelopeKey(body, 'default');
257
+ const defaultModelKey = envelopeKey(body, 'defaultModel');
258
+ const droppedKey = envelopeKey(body, 'droppedEntries');
259
+ const raw = modelsKey.present ? modelsKey.value : undefined;
260
+ if (!Array.isArray(raw))
261
+ return unreadableCatalog('models_not_array');
262
+ const def = defaultKey.present ? defaultKey.value : undefined;
263
+ if (typeof def !== 'string' || def.length === 0)
264
+ return unreadableCatalog('default_missing');
265
+ const n = envelopeKey(raw, 'length');
266
+ const len = n.present ? n.value : undefined;
267
+ if (typeof len !== 'number' || !Number.isSafeInteger(len) || len < 0)
268
+ return unreadableCatalog('unreadable');
269
+ const models = [];
270
+ const names = new Set();
271
+ let unreadableRows = 0;
272
+ for (let i = 0; i < len; i += 1) {
273
+ const d = Object.getOwnPropertyDescriptor(raw, String(i));
274
+ const row = d !== undefined && 'value' in d ? liveModelRowCopy(d.value) : undefined;
275
+ if (row === undefined || names.has(row.name)) {
276
+ unreadableRows += 1;
277
+ continue;
278
+ }
279
+ names.add(row.name);
280
+ models.push(row);
281
+ }
282
+ const out = { models: Object.freeze(models), default: def };
283
+ let defaultModelMalformed = false;
284
+ if (defaultModelKey.present && defaultModelKey.value !== undefined) {
285
+ const dm = liveDefaultModelCopy(defaultModelKey.value);
286
+ if (dm === undefined)
287
+ defaultModelMalformed = true;
288
+ else
289
+ out.defaultModel = dm;
290
+ }
291
+ if (droppedKey.present && droppedKey.value !== undefined) {
292
+ const dropped = droppedEntriesCopy(droppedKey.value);
293
+ out.droppedEntries = dropped;
294
+ }
295
+ return Object.freeze({ kind: 'read', catalog: Object.freeze(out), unreadableRows, ...(defaultModelMalformed ? { defaultModelMalformed: true } : {}) });
296
+ }
297
+ catch {
298
+ return unreadableCatalog('unreadable');
299
+ }
300
+ }
301
+ function droppedEntriesCopy(v) {
302
+ if (!Array.isArray(v))
303
+ return frozenJsonCopyOf(v) ?? null;
304
+ const n = Object.getOwnPropertyDescriptor(v, 'length')?.value;
305
+ if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0)
306
+ return null;
307
+ const out = [];
308
+ for (let i = 0; i < n; i += 1) {
309
+ const d = Object.getOwnPropertyDescriptor(v, String(i));
310
+ out.push((d !== undefined && 'value' in d ? frozenJsonCopyOf(d.value) : undefined) ?? null);
311
+ }
312
+ return Object.freeze(out);
313
+ }
314
+ const nonEmptyString = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
315
+ export function liveDefaultModelOf(catalog = getLiveModelCatalog()) {
316
+ try {
317
+ if (catalog === null || typeof catalog !== 'object' || Array.isArray(catalog))
318
+ return Object.freeze({ kind: 'unknown', why: 'no_catalog' });
319
+ const dm = liveDefaultModelCopy(ownDataOf(catalog, 'defaultModel'));
320
+ if (dm === undefined)
321
+ return Object.freeze({ kind: 'unknown', why: 'not_reported' });
322
+ const dmName = dm.name;
323
+ const dmId = dm.id;
324
+ if (dmName !== undefined && catalogRowsOf(catalog)?.some((row) => ownDataOf(row, 'name') === dmName) === true) {
325
+ return Object.freeze({ kind: 'listed', name: dmName, from: 'defaultModel.name' });
326
+ }
327
+ const row = catalogRowsOf(catalog)?.find((r) => ownDataOf(r, 'id') === dmId);
328
+ const name = row !== undefined ? nonEmptyString(ownDataOf(row, 'name')) : undefined;
329
+ return name !== undefined ? Object.freeze({ kind: 'listed', name, from: 'defaultModel.id' }) : Object.freeze({ kind: 'not_listed', id: dmId });
330
+ }
331
+ catch {
332
+ return Object.freeze({ kind: 'unknown', why: 'unreadable' });
333
+ }
334
+ }
335
+ export function atMentionOf(model, catalog = getLiveModelCatalog()) {
336
+ try {
337
+ const target = targetRowOf(model, catalog);
338
+ if (target.kind !== 'row')
339
+ return Object.freeze({ kind: 'unknown', why: target.why });
340
+ const d = Object.getOwnPropertyDescriptor(target.row, 'atMentionable');
341
+ if (d === undefined)
342
+ return Object.freeze({ kind: 'not_governed' });
343
+ if (!('value' in d))
344
+ return Object.freeze({ kind: 'unknown', why: 'unreadable' });
345
+ if (d.value === undefined)
346
+ return Object.freeze({ kind: 'not_governed' });
347
+ if (d.value === true)
348
+ return Object.freeze({ kind: 'allowed' });
349
+ if (d.value === false)
350
+ return Object.freeze({ kind: 'refused' });
351
+ return Object.freeze({ kind: 'unknown', why: 'malformed' });
352
+ }
353
+ catch {
354
+ return Object.freeze({ kind: 'unknown', why: 'unreadable' });
355
+ }
356
+ }
357
+ export function modelCompatOf(model, catalog = getLiveModelCatalog()) {
358
+ try {
359
+ const target = targetRowOf(model, catalog);
360
+ if (target.kind !== 'row')
361
+ return Object.freeze({ kind: 'unknown', why: target.why });
362
+ const d = Object.getOwnPropertyDescriptor(target.row, 'compat');
363
+ if (d === undefined)
364
+ return Object.freeze({ kind: 'not_declared' });
365
+ if (!('value' in d))
366
+ return Object.freeze({ kind: 'unknown', why: 'unreadable' });
367
+ if (d.value === undefined)
368
+ return Object.freeze({ kind: 'not_declared' });
369
+ if (d.value === null || typeof d.value !== 'object' || Array.isArray(d.value))
370
+ return Object.freeze({ kind: 'unknown', why: 'malformed' });
371
+ const copy = frozenJsonCopyOf(d.value);
372
+ if (copy === undefined || copy === null || typeof copy !== 'object')
373
+ return Object.freeze({ kind: 'unknown', why: 'unreadable' });
374
+ if (Object.keys(copy).length === 0)
375
+ return Object.freeze({ kind: 'unknown', why: 'malformed' });
376
+ return Object.freeze({ kind: 'declared', compat: copy });
377
+ }
378
+ catch {
379
+ return Object.freeze({ kind: 'unknown', why: 'unreadable' });
380
+ }
381
+ }
382
+ const positiveFinite = (v) => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : undefined);
383
+ export function liveModelRowsOf(catalog = getLiveModelCatalog()) {
384
+ try {
385
+ if (catalog === null || typeof catalog !== 'object' || Array.isArray(catalog))
386
+ return null;
387
+ const rows = catalogRowsOf(catalog);
388
+ if (rows === undefined)
389
+ return null;
390
+ const def = liveDefaultModelOf(catalog);
391
+ const seen = new Set();
392
+ const out = [];
393
+ for (const row of rows) {
394
+ const name = nonEmptyString(ownDataOf(row, 'name'));
395
+ if (name === undefined || seen.has(name))
396
+ continue;
397
+ seen.add(name);
398
+ const id = nonEmptyString(ownDataOf(row, 'id'));
399
+ const provider = nonEmptyString(ownDataOf(row, 'provider'));
400
+ const reasoning = ownDataOf(row, 'reasoning');
401
+ const contextWindow = positiveFinite(ownDataOf(row, 'contextWindow'));
402
+ const maxOutputTokens = positiveFinite(ownDataOf(row, 'maxOutputTokens'));
403
+ out.push(Object.freeze({
404
+ name,
405
+ ...(id !== undefined ? { id } : {}),
406
+ ...(provider !== undefined ? { provider } : {}),
407
+ ...(typeof reasoning === 'boolean' ? { reasoning } : {}),
408
+ ...(contextWindow !== undefined ? { contextWindow } : {}),
409
+ ...(maxOutputTokens !== undefined ? { maxOutputTokens } : {}),
410
+ isDefault: def.kind === 'listed' && def.name === name,
411
+ vision: imageVisionOf(name, catalog),
412
+ effort: effortLevelsOf(name, catalog),
413
+ routePairing: Object.freeze(routePairingVerdict(ownDataOf(row, 'routePairing'))),
414
+ atMention: atMentionOf(name, catalog),
415
+ compat: modelCompatOf(name, catalog),
416
+ }));
417
+ }
418
+ return Object.freeze(out);
419
+ }
420
+ catch {
421
+ return null;
422
+ }
423
+ }
@@ -15,6 +15,31 @@ export type McpEngineLegLiveness = {
15
15
  state: string;
16
16
  };
17
17
  export declare function mcpEngineLegLivenessOf(serverName: string, rows: readonly WiringManifestMcpEntryView[] | null | undefined): McpEngineLegLiveness;
18
+ export type McpEngineLegConnection = {
19
+ state: 'connected';
20
+ toolCount?: number;
21
+ } | {
22
+ state: 'not_connected';
23
+ cause: 'failed';
24
+ errorCode?: string;
25
+ delivered?: string;
26
+ httpStatus?: number;
27
+ } | {
28
+ state: 'not_connected';
29
+ cause: 'skipped' | 'not_listed';
30
+ } | {
31
+ state: 'unknown';
32
+ cause: 'unobserved' | 'unreadable';
33
+ } | {
34
+ state: 'unknown';
35
+ cause: 'ambiguous';
36
+ rows: number;
37
+ } | {
38
+ state: 'unknown';
39
+ cause: 'unrecognized_status';
40
+ status: string;
41
+ };
42
+ export declare function mcpEngineLegConnectionOf(serverName: string, rows: readonly WiringManifestMcpEntryView[] | null | undefined): McpEngineLegConnection;
18
43
  export interface McpDetailLegNoteInput {
19
44
  localClientFailed: boolean;
20
45
  engineHostedToolCount: number | undefined;
@@ -1,4 +1,5 @@
1
1
  import { isMcpLivenessState } from './mcpLiveness.js';
2
+ import { mcpSectionDroppedNamedRowsOf } from './ownKey.js';
2
3
  void true;
3
4
  void true;
4
5
  void true;
@@ -18,6 +19,26 @@ const readKey = (o, k) => {
18
19
  }
19
20
  };
20
21
  export function mcpEngineLegLivenessOf(serverName, rows) {
22
+ const hit = findMcpLegRow(serverName, rows);
23
+ if (hit.kind === 'row-unreadable')
24
+ return { kind: 'unreadable' };
25
+ if (hit.kind !== 'row')
26
+ return hit;
27
+ const first = hit.row;
28
+ const flag = readKey(first, 'livenessUnreadable');
29
+ if (flag === UNREADABLE_CELL || flag === true)
30
+ return { kind: 'unreadable' };
31
+ const cell = readKey(first, 'liveness');
32
+ if (cell === ABSENT_CELL)
33
+ return { kind: 'absent' };
34
+ if (cell === UNREADABLE_CELL || cell === null || typeof cell !== 'object')
35
+ return { kind: 'unreadable' };
36
+ const state = readKey(cell, 'state');
37
+ if (typeof state !== 'string' || state === '')
38
+ return { kind: 'unreadable' };
39
+ return { kind: 'observed', state };
40
+ }
41
+ function findMcpLegRow(serverName, rows) {
21
42
  let isArray = false;
22
43
  try {
23
44
  isArray = Array.isArray(rows);
@@ -56,22 +77,57 @@ export function mcpEngineLegLivenessOf(serverName, rows) {
56
77
  }
57
78
  if (incomplete)
58
79
  return { kind: 'unobserved' };
59
- if (matches >= 2)
60
- return { kind: 'ambiguous', rows: matches };
61
- if (matches === 0)
80
+ const dropped = mcpSectionDroppedNamedRowsOf(rows, serverName);
81
+ const total = matches + dropped;
82
+ if (total >= 2)
83
+ return { kind: 'ambiguous', rows: total };
84
+ if (total === 0)
62
85
  return { kind: 'not-listed' };
63
- const flag = readKey(first, 'livenessUnreadable');
64
- if (flag === UNREADABLE_CELL || flag === true)
65
- return { kind: 'unreadable' };
66
- const cell = readKey(first, 'liveness');
67
- if (cell === ABSENT_CELL)
68
- return { kind: 'absent' };
69
- if (cell === UNREADABLE_CELL || cell === null || typeof cell !== 'object')
70
- return { kind: 'unreadable' };
71
- const state = readKey(cell, 'state');
72
- if (typeof state !== 'string' || state === '')
73
- return { kind: 'unreadable' };
74
- return { kind: 'observed', state };
86
+ if (first === undefined)
87
+ return { kind: 'row-unreadable' };
88
+ return { kind: 'row', row: first };
89
+ }
90
+ const MCP_LEG_CONNECT_STATUS_ARMS = Object.freeze({
91
+ connected: 'connected',
92
+ failed: 'failed',
93
+ skipped: 'skipped',
94
+ });
95
+ void true;
96
+ export function mcpEngineLegConnectionOf(serverName, rows) {
97
+ const hit = findMcpLegRow(serverName, rows);
98
+ if (hit.kind === 'unobserved')
99
+ return { state: 'unknown', cause: 'unobserved' };
100
+ if (hit.kind === 'ambiguous')
101
+ return { state: 'unknown', cause: 'ambiguous', rows: hit.rows };
102
+ if (hit.kind === 'not-listed')
103
+ return { state: 'not_connected', cause: 'not_listed' };
104
+ if (hit.kind === 'row-unreadable')
105
+ return { state: 'unknown', cause: 'unreadable' };
106
+ const row = hit.row;
107
+ const status = readKey(row, 'status');
108
+ if (typeof status !== 'string' || status === '')
109
+ return { state: 'unknown', cause: 'unreadable' };
110
+ const arm = Object.hasOwn(MCP_LEG_CONNECT_STATUS_ARMS, status)
111
+ ? MCP_LEG_CONNECT_STATUS_ARMS[status]
112
+ : undefined;
113
+ if (arm === undefined)
114
+ return { state: 'unknown', cause: 'unrecognized_status', status };
115
+ if (arm === 'skipped')
116
+ return { state: 'not_connected', cause: 'skipped' };
117
+ if (arm === 'connected') {
118
+ const n = readKey(row, 'toolCount');
119
+ return typeof n === 'number' && Number.isInteger(n) && n >= 0 ? { state: 'connected', toolCount: n } : { state: 'connected' };
120
+ }
121
+ const errorCode = readKey(row, 'errorCode');
122
+ const delivered = readKey(row, 'delivered');
123
+ const httpStatus = readKey(row, 'httpStatus');
124
+ return {
125
+ state: 'not_connected',
126
+ cause: 'failed',
127
+ ...(typeof errorCode === 'string' && errorCode !== '' ? { errorCode } : {}),
128
+ ...(typeof delivered === 'string' && delivered !== '' ? { delivered } : {}),
129
+ ...(typeof httpStatus === 'number' && Number.isFinite(httpStatus) ? { httpStatus } : {}),
130
+ };
75
131
  }
76
132
  const rosterReadingOf = (v) => {
77
133
  if (v === UNREADABLE_CELL)
package/dist/mcpPanel.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { hostLog } from './host.js';
2
+ import { isSessionIdPathSegment } from './sessionIdSegment.js';
2
3
  import { projectMcpSection } from './adapter/downstream/eventToSdkMessage.js';
3
4
  import { capForDisplay } from './fleetTaskDesc.js';
4
5
  import { mcpLivenessRollupOf } from './mcpLiveness.js';
@@ -62,7 +63,7 @@ export function projectMcpPanel(body) {
62
63
  return view;
63
64
  }
64
65
  export async function fetchMcpPanel(client, sessionId, opts) {
65
- if (typeof sessionId !== 'string' || sessionId.length === 0)
66
+ if (!isSessionIdPathSegment(sessionId))
66
67
  return undefined;
67
68
  let body;
68
69
  try {
@@ -8,11 +8,6 @@ export type McpProbeReading = {
8
8
  kind: 'present';
9
9
  };
10
10
  export declare function projectMcpProbeCapability(caps: unknown): McpProbeReading | undefined;
11
- export declare function noteEngineCapsForMcpProbe(baseUrl: string, caps: unknown, opts?: {
12
- generation?: number;
13
- }): void;
14
11
  export declare function observedMcpProbe(baseUrl?: string | undefined): McpProbeReading;
15
12
  export declare function mcpProbeAvailable(reading: McpProbeReading): 'yes' | 'no' | 'unknown';
16
13
  export declare function mcpProbeDoctorDetail(reading: McpProbeReading): string;
17
- export declare function forgetMcpProbeReading(baseUrl: string | undefined): void;
18
- export declare function __resetMcpProbeReadingsForTests(): void;
@@ -1,12 +1,11 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
+ import { ownDataField } from './ownKey.js';
3
4
  export function projectMcpProbeCapability(caps) {
4
5
  try {
5
6
  if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
6
7
  return undefined;
7
- if (!Object.hasOwn(caps, 'mcpProbe'))
8
- return { kind: 'not_reported' };
9
- const v = caps.mcpProbe;
8
+ const v = ownDataField(caps, 'mcpProbe');
10
9
  if (v === undefined)
11
10
  return { kind: 'not_reported' };
12
11
  if (typeof v !== 'boolean')
@@ -22,9 +21,6 @@ const reader = createEngineCapReader({
22
21
  project: projectMcpProbeCapability,
23
22
  makeUnobserved: () => ({ kind: 'unobserved' }),
24
23
  });
25
- export function noteEngineCapsForMcpProbe(baseUrl, caps, opts) {
26
- reader.note(baseUrl, caps, opts);
27
- }
28
24
  export function observedMcpProbe(baseUrl = engineWireTarget()?.baseUrl) {
29
25
  return reader.observed(baseUrl);
30
26
  }
@@ -52,9 +48,3 @@ export function mcpProbeDoctorDetail(reading) {
52
48
  'and a probe of caller-supplied declarations answers with the very same body shape');
53
49
  }
54
50
  }
55
- export function forgetMcpProbeReading(baseUrl) {
56
- reader.forget(baseUrl);
57
- }
58
- export function __resetMcpProbeReadingsForTests() {
59
- reader.__resetForTests();
60
- }
@@ -62,9 +62,7 @@ export type McpReconnectVerdict = {
62
62
  };
63
63
  export interface McpReconnectClientLike {
64
64
  sessions: {
65
- mcpReconnect?: (sessionId: string, body: {
66
- server: string;
67
- }, opts?: {
65
+ mcpReconnect?: (sessionId: string, server: string, opts?: {
68
66
  signal?: AbortSignal;
69
67
  }) => Promise<unknown>;
70
68
  };
@@ -1,10 +1,14 @@
1
1
  import { capForDisplay } from './fleetTaskDesc.js';
2
+ import { ownDataField } from './ownKey.js';
3
+ import { isSessionIdPathSegment } from './sessionIdSegment.js';
2
4
  export const MCP_RECONNECT_OUTCOMES = Object.freeze(['accepted', 'refused', 'unsupported']);
3
5
  export const MCP_RECONNECT_TRANSACTION_NOTICE = 'Reconnecting closes the current connection before dialing again. On a healthy server this is a transaction, ' +
4
6
  'not a refresh: a failed re-dial leaves the server down and withdraws its tools from the model until a later re-dial succeeds.';
5
7
  export const MCP_RECONNECT_UNSETTLED_NOTICE = 'The MCP re-dial did not settle within the time this request waits, so there is no result yet: the re-dial was not cancelled and may still be running. ' +
6
8
  "Check the server's state before re-dialing it again — a second request that arrives after the dial has settled closes the connection and dials once more.";
7
9
  const UNSETTLED_CODE = 'state.mcp_reconnect_unsettled';
10
+ const _sdkClientIsAnInjection = [true];
11
+ void _sdkClientIsAnInjection;
8
12
  const RECONNECT_TEXT_MAX = 200;
9
13
  const RECONNECT_WORD_MAX = 40;
10
14
  const SERVER_NAME_MAX = 190;
@@ -137,7 +141,7 @@ export function classifyMcpReconnectFailure(e) {
137
141
  return { kind: 'failed', error: e };
138
142
  }
139
143
  export async function reconnectMcpServer(client, sessionId, server, opts) {
140
- if (!nonEmpty(sessionId))
144
+ if (!isSessionIdPathSegment(sessionId))
141
145
  return { kind: 'invalid' };
142
146
  if (!nonEmpty(server) || server.length > SERVER_NAME_MAX)
143
147
  return { kind: 'invalid' };
@@ -148,7 +152,7 @@ export async function reconnectMcpServer(client, sessionId, server, opts) {
148
152
  if (opts?.signal?.aborted === true) {
149
153
  return { kind: 'failed', error: opts.signal.reason ?? new Error('mcpReconnect: aborted before the verb was called') };
150
154
  }
151
- const raw = await client.sessions.mcpReconnect(sessionId, { server }, opts?.signal ? { signal: opts.signal } : undefined);
155
+ const raw = await client.sessions.mcpReconnect(sessionId, server, opts?.signal ? { signal: opts.signal } : undefined);
152
156
  if (isUnsettledBody(raw))
153
157
  return unsettledVerdict(raw);
154
158
  const view = projectMcpReconnectResult(raw);
@@ -166,11 +170,12 @@ export function projectMcpReconnectCapability(caps) {
166
170
  try {
167
171
  if (!isRecord(caps))
168
172
  return undefined;
169
- if (!Object.hasOwn(caps, 'mcpReconnect') || caps.mcpReconnect === undefined)
173
+ const v = ownDataField(caps, 'mcpReconnect');
174
+ if (v === undefined)
170
175
  return 'not_reported';
171
- if (caps.mcpReconnect === true)
176
+ if (v === true)
172
177
  return 'available';
173
- if (caps.mcpReconnect === false)
178
+ if (v === false)
174
179
  return 'unavailable';
175
180
  return undefined;
176
181
  }
@@ -9,11 +9,6 @@ export type MemoryComplianceReading = {
9
9
  kind: 'present';
10
10
  };
11
11
  export declare function projectMemoryComplianceCapability(caps: unknown): MemoryComplianceReading | undefined;
12
- export declare function noteEngineCapsForMemoryCompliance(baseUrl: string, caps: unknown, opts?: {
13
- generation?: number;
14
- }): void;
15
12
  export declare function observedMemoryCompliance(baseUrl?: string | undefined): MemoryComplianceReading;
16
13
  export declare function memoryComplianceVerbsAvailable(reading: MemoryComplianceReading): 'yes' | 'no' | 'unknown';
17
14
  export declare function memoryComplianceDoctorDetail(reading: MemoryComplianceReading): string;
18
- export declare function forgetMemoryComplianceReading(baseUrl: string | undefined): void;
19
- export declare function __resetMemoryComplianceReadingsForTests(): void;