@sema-agent/client-core 0.100.0 → 0.102.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 (358) hide show
  1. package/CHANGELOG.md +452 -0
  2. package/README.md +172 -120
  3. package/dist/adapt/arms.js +51 -16
  4. package/dist/adapt/textStream.js +7 -4
  5. package/dist/adapt/toolCards.d.ts +2 -1
  6. package/dist/adapt/toolCards.js +28 -13
  7. package/dist/adapt.d.ts +1 -1
  8. package/dist/adapt.js +8 -2
  9. package/dist/adapter/activeRunSelfHeal.d.ts +24 -2
  10. package/dist/adapter/activeRunSelfHeal.js +108 -6
  11. package/dist/adapter/downstream/eventToSdkMessage.js +38 -79
  12. package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
  13. package/dist/adapter/downstream/terminalToSdkResult.js +209 -39
  14. package/dist/adapter/downstream/wiringManifestView.d.ts +1 -0
  15. package/dist/adapter/downstream/wiringManifestView.js +138 -0
  16. package/dist/adapter/runStream.d.ts +4 -4
  17. package/dist/adapter/runStream.js +158 -43
  18. package/dist/agentsWireCaps.d.ts +2 -7
  19. package/dist/agentsWireCaps.js +1 -2
  20. package/dist/approvalDecidedByCapability.js +2 -2
  21. package/dist/approvalFrameFamilies.d.ts +33 -0
  22. package/dist/approvalFrameFamilies.js +120 -0
  23. package/dist/approvalsStreamLiveCapability.js +2 -2
  24. package/dist/attachmentsWireCaps.js +41 -13
  25. package/dist/callerCwdCapability.js +2 -2
  26. package/dist/centerWiringCapability.js +2 -2
  27. package/dist/clockReading.d.ts +2 -0
  28. package/dist/clockReading.js +4 -0
  29. package/dist/cloudConfigWireCaps.d.ts +19 -5
  30. package/dist/cloudConfigWireCaps.js +193 -56
  31. package/dist/compensations.js +1 -1
  32. package/dist/coreValuePorts.d.ts +12 -2
  33. package/dist/coreValuePorts.js +9 -0
  34. package/dist/decideFailureNote.js +5 -3
  35. package/dist/decideReceipt.js +2 -2
  36. package/dist/deviceExecutorManagementCapability.js +2 -2
  37. package/dist/deviceFlowPolling.js +1 -1
  38. package/dist/disableSkillsWire.d.ts +1 -1
  39. package/dist/disableSkillsWire.js +4 -3
  40. package/dist/displayUntrusted.d.ts +9 -4
  41. package/dist/displayUntrusted.js +834 -104
  42. package/dist/engineCapReader.js +1 -1
  43. package/dist/engineConfigDrift.js +1 -1
  44. package/dist/engineErrorCodes.d.ts +14 -5
  45. package/dist/engineErrorCodes.js +27 -6
  46. package/dist/engineGenerationConvergence.d.ts +39 -0
  47. package/dist/engineGenerationConvergence.js +95 -0
  48. package/dist/engineGenerationPort.d.ts +61 -0
  49. package/dist/engineGenerationPort.js +144 -0
  50. package/dist/engineHealthFacts.d.ts +23 -0
  51. package/dist/engineHealthFacts.js +92 -0
  52. package/dist/engineIdentity.d.ts +4 -0
  53. package/dist/engineIdentity.js +11 -0
  54. package/dist/engineNoticeCodes.d.ts +2 -5
  55. package/dist/engineRowRef.js +4 -0
  56. package/dist/engineSessionMessages.js +2 -2
  57. package/dist/engineToolDirectory.js +2 -2
  58. package/dist/engineWireFor.d.ts +99 -0
  59. package/dist/engineWireFor.js +248 -6
  60. package/dist/engineWireTarget.d.ts +1 -0
  61. package/dist/engineWireTarget.js +8 -0
  62. package/dist/env/uiLanguage.js +1 -1
  63. package/dist/errorSupplementRoles.d.ts +3 -0
  64. package/dist/errorSupplementRoles.js +37 -0
  65. package/dist/executionLaneCapability.js +2 -2
  66. package/dist/fileHistoryCaptureCapability.js +3 -3
  67. package/dist/finalVerifyWire.d.ts +6 -3
  68. package/dist/finalVerifyWire.js +6 -23
  69. package/dist/flagInput.d.ts +4 -0
  70. package/dist/flagInput.js +24 -0
  71. package/dist/fleet/fleetLedger.js +5 -2
  72. package/dist/fleet/fleetProjection.d.ts +1 -0
  73. package/dist/fleet/fleetProjection.js +16 -3
  74. package/dist/gateVocabulary.js +3 -0
  75. package/dist/generated/engineFactTables.d.ts +7 -3
  76. package/dist/generated/engineFactTables.js +52 -0
  77. package/dist/generated/engineNoticeTables.js +12 -0
  78. package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
  79. package/dist/generated/settingsSchemaActiveTiers.js +14 -0
  80. package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
  81. package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
  82. package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
  83. package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
  84. package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
  85. package/dist/generated/settingsSchemaDefaultModel.js +25 -0
  86. package/dist/generated/settingsSchemaFns.d.ts +54 -0
  87. package/dist/generated/settingsSchemaFns.js +26 -1
  88. package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
  89. package/dist/generated/settingsSchemaMcpRequestEntry.js +1 -7
  90. package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
  91. package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
  92. package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
  93. package/dist/generated/settingsSchemaSettingsSources.js +58 -0
  94. package/dist/generated/settingsSchemaTables.d.ts +2 -0
  95. package/dist/generated/settingsSchemaTables.js +13 -0
  96. package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
  97. package/dist/generated/settingsSchemaUrlPattern.js +183 -0
  98. package/dist/headlessPermissionModeWire.d.ts +18 -2
  99. package/dist/headlessPermissionModeWire.js +30 -19
  100. package/dist/hitl/allowRuleShadow.js +7 -5
  101. package/dist/hitl/approvalCardReading.d.ts +3 -0
  102. package/dist/hitl/approvalCardReading.js +17 -0
  103. package/dist/hitl/approvalCompleteParked.js +1 -1
  104. package/dist/hitl/approvalDelivery.d.ts +87 -0
  105. package/dist/hitl/approvalDelivery.js +193 -0
  106. package/dist/hitl/approvalResolution.d.ts +11 -0
  107. package/dist/hitl/approvalResolution.js +50 -11
  108. package/dist/hitl/askClassPair.d.ts +6 -0
  109. package/dist/hitl/askClassPair.js +30 -3
  110. package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
  111. package/dist/hitl/askParkAutoReopenBlock.js +117 -0
  112. package/dist/hitl/askParkRowRouting.js +4 -1
  113. package/dist/hitl/attributionLadder.d.ts +42 -3
  114. package/dist/hitl/attributionLadder.js +79 -8
  115. package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
  116. package/dist/hitl/automaticAnswerVerdict.js +46 -11
  117. package/dist/hitl/crashConverged.js +2 -2
  118. package/dist/hitl/decisionConflict.d.ts +6 -2
  119. package/dist/hitl/decisionConflict.js +24 -9
  120. package/dist/hitl/decisionRefusal.d.ts +20 -10
  121. package/dist/hitl/decisionRefusal.js +99 -54
  122. package/dist/hitl/decisionSend.d.ts +3 -0
  123. package/dist/hitl/decisionSend.js +87 -103
  124. package/dist/hitl/frameRouter.d.ts +1 -0
  125. package/dist/hitl/frameRouter.js +9 -2
  126. package/dist/hitl/hitlBridge.d.ts +18 -6
  127. package/dist/hitl/hitlBridge.js +41 -37
  128. package/dist/hitl/livePendingAsk.js +4 -3
  129. package/dist/hitl/noAllowCause.js +1 -1
  130. package/dist/hitl/parkResolver.js +3 -2
  131. package/dist/hitl/persistedRulesWire.js +1 -0
  132. package/dist/hitl/planReviewWire.d.ts +4 -0
  133. package/dist/hitl/planReviewWire.js +59 -30
  134. package/dist/hitl/resumeRunningCard.d.ts +3 -2
  135. package/dist/hitl/resumeRunningCard.js +17 -11
  136. package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
  137. package/dist/hitl/sessionPolicyDeliverable.js +62 -29
  138. package/dist/hitl/sessionPolicyWire.d.ts +13 -3
  139. package/dist/hitl/sessionPolicyWire.js +81 -16
  140. package/dist/hitl/standingRows.js +1 -1
  141. package/dist/hitl/toolApprovalWire.d.ts +9 -10
  142. package/dist/hitl/toolApprovalWire.js +72 -54
  143. package/dist/hookMatcherVerdict.d.ts +2 -0
  144. package/dist/hookMatcherVerdict.js +12 -0
  145. package/dist/hooksCompactTransition.d.ts +19 -0
  146. package/dist/hooksCompactTransition.js +41 -0
  147. package/dist/hooksWireCaps.d.ts +1 -1
  148. package/dist/hooksWireCaps.js +202 -203
  149. package/dist/host.d.ts +1 -14
  150. package/dist/host.js +0 -8
  151. package/dist/hostCallbackGuard.d.ts +1 -0
  152. package/dist/hostCallbackGuard.js +1 -1
  153. package/dist/hostSettingsSource.d.ts +172 -0
  154. package/dist/hostSettingsSource.js +675 -0
  155. package/dist/hostTurnSettings.d.ts +73 -17
  156. package/dist/hostTurnSettings.js +594 -97
  157. package/dist/httpHookPolicy.d.ts +37 -0
  158. package/dist/httpHookPolicy.js +176 -0
  159. package/dist/humanTurn.d.ts +2 -1
  160. package/dist/humanTurn.js +37 -7
  161. package/dist/humanTurnRead.js +4 -3
  162. package/dist/humanTurnSentences.d.ts +10 -0
  163. package/dist/humanTurnSentences.js +74 -0
  164. package/dist/i18n/messages.en.d.ts +222 -2
  165. package/dist/i18n/messages.en.js +225 -5
  166. package/dist/i18n/messages.zh.js +237 -5
  167. package/dist/i18n/translate.js +3 -3
  168. package/dist/index.d.ts +77 -15
  169. package/dist/index.js +50 -13
  170. package/dist/inheritEnvCapability.d.ts +3 -1
  171. package/dist/inheritEnvCapability.js +31 -17
  172. package/dist/inheritEnvWire.d.ts +2 -1
  173. package/dist/inheritEnvWire.js +11 -5
  174. package/dist/interactiveHalt.d.ts +3 -1
  175. package/dist/interactiveHalt.js +2 -0
  176. package/dist/interactiveInterrupt.d.ts +2 -0
  177. package/dist/interactiveInterrupt.js +15 -0
  178. package/dist/interactiveToolsWire.d.ts +4 -2
  179. package/dist/interactiveToolsWire.js +5 -5
  180. package/dist/jsonFaithful.d.ts +20 -0
  181. package/dist/jsonFaithful.js +152 -0
  182. package/dist/limitsWire.d.ts +7 -2
  183. package/dist/limitsWire.js +19 -13
  184. package/dist/liveInitToolFace.d.ts +6 -1
  185. package/dist/liveInitToolFace.js +5 -3
  186. package/dist/liveModelCatalog.d.ts +22 -0
  187. package/dist/liveModelCatalog.js +132 -18
  188. package/dist/mcpPanel.js +1 -1
  189. package/dist/mcpProbeCapability.js +2 -2
  190. package/dist/mcpStatusSupersetKeys.d.ts +24 -0
  191. package/dist/mcpStatusSupersetKeys.js +45 -0
  192. package/dist/mcpToolToggles.js +2 -1
  193. package/dist/mcpWireCaps.d.ts +39 -1
  194. package/dist/mcpWireCaps.js +254 -50
  195. package/dist/memoryComplianceCapability.js +2 -2
  196. package/dist/memoryOriginCapability.js +2 -2
  197. package/dist/model/catalogDefault.d.ts +24 -0
  198. package/dist/model/catalogDefault.js +4 -0
  199. package/dist/model/liveCatalogShape.js +5 -4
  200. package/dist/model/modelsPolicy.js +4 -3
  201. package/dist/model/onboardJudgement.d.ts +1 -0
  202. package/dist/model/onboardJudgement.js +1 -1
  203. package/dist/model/subagentModelWord.js +2 -2
  204. package/dist/modelCapabilityProbe.js +6 -6
  205. package/dist/modelIdentityResolvability.d.ts +10 -1
  206. package/dist/modelIdentityResolvability.js +62 -39
  207. package/dist/modsFace.d.ts +8 -0
  208. package/dist/modsFace.js +59 -0
  209. package/dist/modsKernelIdentity.d.ts +10 -0
  210. package/dist/modsKernelIdentity.js +103 -0
  211. package/dist/modsKernelTransit.d.ts +8 -0
  212. package/dist/modsKernelTransit.js +6 -0
  213. package/dist/notifications.d.ts +30 -12
  214. package/dist/notifications.js +241 -53
  215. package/dist/outputStyleSeatCapability.js +2 -2
  216. package/dist/ownKey.d.ts +12 -0
  217. package/dist/ownKey.js +179 -3
  218. package/dist/panelReduce.js +1 -1
  219. package/dist/peerFrames.d.ts +1 -1
  220. package/dist/peerFrames.js +6 -2
  221. package/dist/peerLaneCapability.js +2 -2
  222. package/dist/permissionModesCapability.js +4 -4
  223. package/dist/permissionRuleIssue.js +2 -0
  224. package/dist/permissionRulesWriteCapability.js +2 -2
  225. package/dist/permissionsAllowGrantCapability.js +2 -2
  226. package/dist/permissionsDeclaration.d.ts +43 -4
  227. package/dist/permissionsDeclaration.js +102 -35
  228. package/dist/pluginHooksWire.d.ts +20 -4
  229. package/dist/pluginHooksWire.js +92 -53
  230. package/dist/prepareRefusal.d.ts +3 -2
  231. package/dist/prepareRefusal.js +27 -9
  232. package/dist/printInitToolFace.js +2 -2
  233. package/dist/printModelStatus.js +1 -1
  234. package/dist/printToolResultFrame.js +1 -1
  235. package/dist/projectMemory.d.ts +32 -0
  236. package/dist/projectMemory.js +70 -0
  237. package/dist/promptBlockedCopy.d.ts +2 -1
  238. package/dist/promptBlockedCopy.js +2 -1
  239. package/dist/promptDelivery.d.ts +23 -3
  240. package/dist/promptDelivery.js +169 -30
  241. package/dist/providerRejection.d.ts +19 -1
  242. package/dist/providerRejection.js +75 -4
  243. package/dist/queuedDelivery.d.ts +48 -0
  244. package/dist/queuedDelivery.js +233 -0
  245. package/dist/reattachWindow.d.ts +94 -0
  246. package/dist/reattachWindow.js +127 -0
  247. package/dist/request/printNotification.d.ts +1 -1
  248. package/dist/request/printNotification.js +6 -2
  249. package/dist/request/submissionIdentity.d.ts +37 -0
  250. package/dist/request/submissionIdentity.js +65 -0
  251. package/dist/request/taskRequest.d.ts +33 -4
  252. package/dist/request/taskRequest.js +341 -156
  253. package/dist/resultFrameKeys.d.ts +1 -0
  254. package/dist/resultFrameKeys.js +4 -1
  255. package/dist/retryStatus.d.ts +8 -0
  256. package/dist/retryStatus.js +57 -9
  257. package/dist/rewindArchiveCapability.js +2 -2
  258. package/dist/rewindEngineAction.d.ts +2 -0
  259. package/dist/rewindEngineAction.js +23 -1
  260. package/dist/rowKind.d.ts +36 -0
  261. package/dist/rowKind.js +97 -0
  262. package/dist/ruleCompileVerdict.d.ts +18 -0
  263. package/dist/ruleCompileVerdict.js +67 -2
  264. package/dist/ruleReadings.d.ts +58 -0
  265. package/dist/ruleReadings.js +132 -0
  266. package/dist/ruleRefusalSentence.d.ts +4 -0
  267. package/dist/ruleRefusalSentence.js +9 -3
  268. package/dist/runCancelContext.d.ts +0 -1
  269. package/dist/runCancelContext.js +1 -2
  270. package/dist/runTerminal.d.ts +5 -0
  271. package/dist/runTerminal.js +52 -17
  272. package/dist/sandboxWire.d.ts +1 -1
  273. package/dist/sandboxWire.js +4 -6
  274. package/dist/scenarioRefusal.js +1 -1
  275. package/dist/scenarioSkills.d.ts +20 -0
  276. package/dist/scenarioSkills.js +72 -0
  277. package/dist/scenarioWire.d.ts +5 -2
  278. package/dist/scenarioWire.js +9 -9
  279. package/dist/sealedKeyCapability.js +2 -2
  280. package/dist/seam.d.ts +2 -0
  281. package/dist/seam.js +3 -3
  282. package/dist/seatContract.d.ts +68 -7
  283. package/dist/seatContract.js +84 -25
  284. package/dist/selfOrchestrationDenial.js +1 -1
  285. package/dist/sessionBackground.d.ts +165 -0
  286. package/dist/sessionBackground.js +781 -0
  287. package/dist/sessionBackgroundHandoff.d.ts +54 -0
  288. package/dist/sessionBackgroundHandoff.js +321 -0
  289. package/dist/sessionMap.js +4 -1
  290. package/dist/sessionPolicyCapability.js +2 -2
  291. package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
  292. package/dist/sessionRulesChildrenReadLive.js +5 -0
  293. package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
  294. package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
  295. package/dist/sessionSyncFileHistoryCapability.js +2 -2
  296. package/dist/settingsCredentialKeyPaths.js +55 -15
  297. package/dist/settingsHooksSalvage.d.ts +1 -0
  298. package/dist/settingsHooksSalvage.js +7 -1
  299. package/dist/settingsLayerAdmission.d.ts +4 -0
  300. package/dist/settingsLayerAdmission.js +16 -0
  301. package/dist/skillToolListsCapability.js +6 -5
  302. package/dist/skillsWireCaps.d.ts +14 -0
  303. package/dist/skillsWireCaps.js +47 -16
  304. package/dist/slashCommandGate.d.ts +24 -0
  305. package/dist/slashCommandGate.js +74 -0
  306. package/dist/slashCommandTable.d.ts +14 -0
  307. package/dist/slashCommandTable.js +99 -0
  308. package/dist/sqlEngineCapability.js +2 -2
  309. package/dist/steerPriorityCapability.js +2 -2
  310. package/dist/storePostureCapability.js +2 -2
  311. package/dist/subagent/agentStateDetail.js +1 -1
  312. package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
  313. package/dist/subagent/engineDelegatedPrompt.js +38 -7
  314. package/dist/subagent/engineRowStopGate.js +2 -2
  315. package/dist/subagent/engineSubagentResume.js +3 -3
  316. package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
  317. package/dist/subagent/engineTaskHandleWire.js +10 -0
  318. package/dist/submitFailure.d.ts +8 -0
  319. package/dist/submitFailure.js +17 -0
  320. package/dist/supportFloor.d.ts +1 -0
  321. package/dist/supportFloor.js +7 -0
  322. package/dist/terminationIntent.d.ts +55 -0
  323. package/dist/terminationIntent.js +352 -0
  324. package/dist/thinkingLatch.d.ts +69 -0
  325. package/dist/thinkingLatch.js +255 -0
  326. package/dist/thinkingLatchWords.d.ts +7 -0
  327. package/dist/thinkingLatchWords.js +4 -0
  328. package/dist/toolHistoryMismatch.d.ts +8 -0
  329. package/dist/toolHistoryMismatch.js +37 -6
  330. package/dist/toolResult.d.ts +13 -3
  331. package/dist/toolResult.js +159 -32
  332. package/dist/toolResultContent.d.ts +13 -0
  333. package/dist/toolResultContent.js +82 -7
  334. package/dist/toolRoster.d.ts +18 -0
  335. package/dist/toolRoster.js +64 -0
  336. package/dist/turnFailurePresentation.js +27 -90
  337. package/dist/usageLimitAutoResume.d.ts +74 -0
  338. package/dist/usageLimitAutoResume.js +227 -0
  339. package/dist/userAttachmentEnvelope.js +1 -1
  340. package/dist/userAttachmentSeat.js +5 -5
  341. package/dist/userInvokedSkillsCapability.js +2 -2
  342. package/dist/webSearchBackendCapability.js +2 -2
  343. package/dist/wireErrorTriage.js +99 -50
  344. package/dist/wireFailureShape.d.ts +25 -1
  345. package/dist/wireFailureShape.js +92 -5
  346. package/dist/wireRefusalCopy.d.ts +24 -1
  347. package/dist/wireRefusalCopy.js +253 -32
  348. package/dist/wiringFleetDoctor.d.ts +3 -0
  349. package/dist/wiringFleetDoctor.js +21 -0
  350. package/dist/workflow.d.ts +2 -1
  351. package/dist/workflow.js +38 -1
  352. package/dist/workflowClient.d.ts +2 -7
  353. package/dist/workflowsJournalCapability.js +2 -2
  354. package/dist/writeProtectionCapability.js +2 -2
  355. package/docs/INTEGRATION-CLIENTS.md +907 -182
  356. package/package.json +14 -3
  357. package/dist/argvFlagValue.d.ts +0 -8
  358. package/dist/argvFlagValue.js +0 -37
@@ -1,17 +1,17 @@
1
1
  import { SETTINGS_DESCRIBE_BAD_WIRE_NAME, SETTINGS_IS_USABLE_WIRE_NAME, SETTINGS_READ_MCP_IDENTITY_HEADERS, SETTINGS_READ_REQUEST_MCP_TRANSPORT, } from './generated/settingsSchemaFns.js';
2
2
  import { snapshotArgs, wireTransportOf } from './mcpWireTransport.js';
3
- import { guardedRead } from './ownKey.js';
4
- import { readMcpToolAxes } from './coreValuePorts.js';
3
+ import { appendOwnElement, guardedRead } from './ownKey.js';
4
+ import { readMcpToolAxes, readToolFaces } from './coreValuePorts.js';
5
5
  import { capForDisplay } from './fleetTaskDesc.js';
6
6
  import { msg, renderMessage } from './i18n/translate.js';
7
7
  const _mcpServerSpecPin = true;
8
8
  void _mcpServerSpecPin;
9
- function transparentKeys(c, axes, elicitation) {
9
+ function transparentKeys(startupTimeoutMs, axes, faces, elicitation) {
10
10
  return {
11
- ...(c.toolFaces !== undefined ? { toolFaces: c.toolFaces } : {}),
11
+ ...(faces !== undefined ? { toolFaces: faces } : {}),
12
12
  ...(axes !== undefined ? { toolAxes: axes } : {}),
13
13
  ...(elicitation !== undefined ? { elicitation } : {}),
14
- ...(c.startupTimeoutMs !== undefined ? { startupTimeoutMs: c.startupTimeoutMs } : {}),
14
+ ...(startupTimeoutMs !== undefined ? { startupTimeoutMs } : {}),
15
15
  };
16
16
  }
17
17
  export function readMcpHttpIdentityHeaders(transport) {
@@ -25,24 +25,75 @@ export function readMcpHttpIdentityHeaders(transport) {
25
25
  export function mcpConfigToSpec(name, c) {
26
26
  return mcpConfigEntry(name, c).spec;
27
27
  }
28
+ function entryShapeOf(c) {
29
+ try {
30
+ return typeof c === 'object' && c !== null && !Array.isArray(c) ? 'object' : 'not_object';
31
+ }
32
+ catch {
33
+ return 'unreadable';
34
+ }
35
+ }
36
+ function readEntryOwnKeys(c) {
37
+ try {
38
+ const allowTools = c.allowTools;
39
+ return { toolAxes: c.toolAxes, elicitation: c.elicitation, allowTools, startupTimeoutMs: c.startupTimeoutMs };
40
+ }
41
+ catch {
42
+ return undefined;
43
+ }
44
+ }
28
45
  function mcpConfigEntry(name, c) {
29
46
  if (!nameUsable(name))
30
47
  return { spec: null };
31
- const declared = c.toolAxes;
48
+ const shape = entryShapeOf(c);
49
+ if (shape === 'not_object')
50
+ return { spec: null, entryNotObject: true };
51
+ if (shape === 'unreadable')
52
+ return { spec: null, entryUnreadable: true };
53
+ const own = readEntryOwnKeys(c);
54
+ if (own === undefined) {
55
+ const t = transportOf(c);
56
+ if (t.kind === 'skip')
57
+ return { spec: null };
58
+ if (t.kind === 'both_set')
59
+ return { spec: null, identityBothSet: true };
60
+ if (t.kind === 'bad')
61
+ return { spec: null, transportBad: t.issue };
62
+ return { spec: null, entryUnreadable: true };
63
+ }
64
+ const declared = own.toolAxes;
32
65
  const verdict = mcpToolAxesVerdict(declared);
33
- const elDeclared = c.elicitation;
66
+ let facesDeclared;
67
+ let facesUnreadable = false;
68
+ try {
69
+ facesDeclared = c.toolFaces;
70
+ }
71
+ catch {
72
+ facesUnreadable = true;
73
+ }
74
+ const facesVerdict = facesUnreadable
75
+ ? Object.freeze({ kind: 'bad', problem: renderMessage(msg('config.mcp.toolFacesUnreadable')) })
76
+ : mcpToolFacesVerdict(facesDeclared);
77
+ const elDeclared = own.elicitation;
34
78
  const elVerdict = mcpElicitationVerdict(elDeclared);
35
- if (verdict.kind === 'bad' || elVerdict.kind === 'bad') {
36
- const rest = specOf(name, c, undefined, undefined);
79
+ const allowVerdict = mcpAllowToolsVerdict(() => own.allowTools, `mcpServers.${capForDisplay(name, DROP_NAME_SHOWN)}.`);
80
+ if (verdict.kind === 'bad' || facesVerdict.kind === 'bad' || elVerdict.kind === 'bad' || allowVerdict.kind === 'bad') {
81
+ const rest = specOf(name, c, own, undefined, undefined, undefined, undefined);
37
82
  if (rest.kind === 'skip')
38
83
  return { spec: null };
39
84
  if (rest.kind === 'both_set')
40
85
  return { spec: null, identityBothSet: true };
41
86
  if (rest.kind === 'bad')
42
87
  return { spec: null, transportBad: rest.issue };
43
- return verdict.kind === 'bad' ? { spec: null, axesProblem: verdict.problem } : { spec: null, elicitationInvalid: true };
88
+ if (verdict.kind === 'bad')
89
+ return { spec: null, axesProblem: verdict.problem };
90
+ if (facesVerdict.kind === 'bad')
91
+ return { spec: null, facesProblem: facesVerdict.problem };
92
+ if (elVerdict.kind === 'bad')
93
+ return { spec: null, elicitationInvalid: true };
94
+ return allowVerdict.kind === 'bad' ? { spec: null, allowToolsInvalid: { path: allowVerdict.path, problem: allowVerdict.problem } } : { spec: null };
44
95
  }
45
- const read = specOf(name, c, verdict.kind === 'ok' ? verdict.toolAxes : declared, elVerdict.elicitation);
96
+ const read = specOf(name, c, own, verdict.kind === 'ok' ? verdict.toolAxes : declared, facesVerdict.kind === 'ok' ? facesVerdict.toolFaces : facesDeclared, elVerdict.elicitation, allowVerdict.allowTools);
46
97
  if (read.kind === 'skip')
47
98
  return { spec: null };
48
99
  if (read.kind === 'both_set')
@@ -51,7 +102,7 @@ function mcpConfigEntry(name, c) {
51
102
  return { spec: null, transportBad: read.issue };
52
103
  return { spec: read.spec, ...(read.lost.length > 0 ? { transportLost: read.lost } : {}) };
53
104
  }
54
- function specOf(name, c, axes, elicitation) {
105
+ function transportOf(c) {
55
106
  let candidate;
56
107
  try {
57
108
  const kind = c.type ?? 'stdio';
@@ -78,18 +129,49 @@ function specOf(name, c, axes, elicitation) {
78
129
  }
79
130
  }
80
131
  catch {
81
- return { kind: 'bad', issue: { path: 'transport', reason: renderMessage(msg('config.mcp.transportUnreadable')) } };
132
+ return transportUnreadableRead();
133
+ }
134
+ let read;
135
+ try {
136
+ read = SETTINGS_READ_REQUEST_MCP_TRANSPORT(candidate);
137
+ }
138
+ catch {
139
+ return transportUnreadableRead();
82
140
  }
83
- const read = SETTINGS_READ_REQUEST_MCP_TRANSPORT(candidate);
84
141
  if (!read.ok)
85
142
  return { kind: 'bad', issue: read.issue };
143
+ return { kind: 'ok', transport: wireTransportOf(read.transport), lost: read.lost };
144
+ }
145
+ function transportUnreadableRead() {
146
+ return { kind: 'bad', issue: { path: 'transport', reason: renderMessage(msg('config.mcp.transportUnreadable')) } };
147
+ }
148
+ function specOf(name, c, own, axes, faces, elicitation, allowTools) {
149
+ const t = transportOf(c);
150
+ if (t.kind !== 'ok')
151
+ return t;
86
152
  const spec = {
87
153
  name,
88
- transport: wireTransportOf(read.transport),
89
- ...(Array.isArray(c.allowTools) ? { allowTools: c.allowTools } : {}),
90
- ...transparentKeys(c, axes, elicitation),
154
+ transport: t.transport,
155
+ ...(allowTools !== undefined ? { allowTools } : {}),
156
+ ...transparentKeys(own.startupTimeoutMs, axes, faces, elicitation),
91
157
  };
92
- return { kind: 'ok', spec, lost: read.lost };
158
+ return { kind: 'ok', spec, lost: t.lost };
159
+ }
160
+ export function mcpTransportVerdict(entry) {
161
+ const shape = entryShapeOf(entry);
162
+ if (shape !== 'object')
163
+ return transportBadVerdict('transport', renderMessage(msg(shape === 'not_object' ? 'config.mcp.entryNotObjectProblem' : 'config.mcp.transportUnreadable')));
164
+ const t = transportOf(entry);
165
+ if (t.kind === 'ok')
166
+ return Object.freeze({ kind: 'ok', transport: t.transport, lost: Object.freeze([...t.lost]) });
167
+ if (t.kind === 'bad')
168
+ return transportBadVerdict(t.issue.path, t.issue.reason);
169
+ if (t.kind === 'both_set')
170
+ return transportBadVerdict('transport', renderMessage(msg('config.mcp.transportIdentityBothSetProblem')));
171
+ return transportBadVerdict('transport.kind', renderMessage(msg('config.mcp.transportTypeUnsupported')));
172
+ }
173
+ function transportBadVerdict(key, detail) {
174
+ return Object.freeze({ kind: 'bad', key, detail });
93
175
  }
94
176
  export function mcpConfigsToSpecs(servers) {
95
177
  return projectMcpConfigs(servers).specs;
@@ -110,17 +192,115 @@ export function mcpToolAxesVerdict(declared) {
110
192
  }
111
193
  return Object.freeze({ kind: 'unavailable' });
112
194
  }
195
+ export function mcpToolFacesVerdict(declared) {
196
+ if (declared === undefined)
197
+ return Object.freeze({ kind: 'ok' });
198
+ const read = readToolFaces(declared);
199
+ if (read === undefined || read === null || typeof read !== 'object')
200
+ return Object.freeze({ kind: 'unavailable' });
201
+ if (read.ok === true) {
202
+ const copy = read.faces;
203
+ return Object.freeze(typeof copy === 'object' && copy !== null ? { kind: 'ok', toolFaces: copy } : { kind: 'ok' });
204
+ }
205
+ if (read.ok === false) {
206
+ const problem = read.problem;
207
+ return Object.freeze({ kind: 'bad', problem: typeof problem === 'string' && problem.length > 0 ? problem : renderMessage(msg('config.mcp.toolFacesFallbackProblem')) });
208
+ }
209
+ return Object.freeze({ kind: 'unavailable' });
210
+ }
113
211
  export function mcpElicitationVerdict(declared) {
114
212
  if (declared === undefined)
115
213
  return Object.freeze({ kind: 'ok' });
116
214
  return typeof declared === 'boolean' ? Object.freeze({ kind: 'ok', elicitation: declared }) : Object.freeze({ kind: 'bad' });
117
215
  }
216
+ const ALLOW_TOOLS_READ_BUDGET = 100_000;
217
+ export function mcpAllowToolsVerdict(read, keyPrefix = '') {
218
+ const bad = (path, key, got) => Object.freeze({ kind: 'bad', path, problem: renderMessage(msg(key, { path: `${keyPrefix}${path}`, got: got ?? '' })) });
219
+ let declared;
220
+ try {
221
+ declared = read();
222
+ }
223
+ catch {
224
+ return bad('allowTools', 'config.mcp.allowToolsUnreadable');
225
+ }
226
+ if (declared === undefined)
227
+ return Object.freeze({ kind: 'ok' });
228
+ try {
229
+ if (!Array.isArray(declared))
230
+ return bad('allowTools', 'config.mcp.allowToolsNotArray', declared === null ? 'null' : typeof declared);
231
+ const lengthDesc = Object.getOwnPropertyDescriptor(declared, 'length');
232
+ const length = lengthDesc !== undefined && Object.hasOwn(lengthDesc, 'value') ? lengthDesc.value : undefined;
233
+ if (typeof length !== 'number' || !Number.isSafeInteger(length) || length < 0)
234
+ return bad('allowTools', 'config.mcp.allowToolsUnreadable');
235
+ if (length > ALLOW_TOOLS_READ_BUDGET)
236
+ return bad('allowTools', 'config.mcp.allowToolsTooMany', String(ALLOW_TOOLS_READ_BUDGET));
237
+ const copy = [];
238
+ for (let i = 0; i < length; i++) {
239
+ const d = Object.getOwnPropertyDescriptor(declared, String(i));
240
+ if (d === undefined)
241
+ return bad(`allowTools[${i}]`, 'config.mcp.allowToolsHole');
242
+ if (!Object.hasOwn(d, 'value'))
243
+ return bad(`allowTools[${i}]`, 'config.mcp.allowToolsUnreadable');
244
+ const el = d.value;
245
+ if (typeof el !== 'string')
246
+ return bad(`allowTools[${i}]`, 'config.mcp.allowToolsElementNotString', el === null ? 'null' : Array.isArray(el) ? 'array' : typeof el);
247
+ appendOwnElement(copy, el);
248
+ }
249
+ return Object.freeze({ kind: 'ok', allowTools: copy });
250
+ }
251
+ catch {
252
+ return bad('allowTools', 'config.mcp.allowToolsUnreadable');
253
+ }
254
+ }
118
255
  const nameUsable = (name) => SETTINGS_IS_USABLE_WIRE_NAME(name);
119
256
  function mcpNameDropReasonOf(name) {
120
257
  if (typeof name !== 'string' || name.trim().length === 0)
121
258
  return 'name_blank';
122
259
  return name.trim() !== name ? 'name_edge_whitespace' : 'name_too_long';
123
260
  }
261
+ const _nameReasonsPin = true;
262
+ void _nameReasonsPin;
263
+ function nameSiblingsOf(siblings) {
264
+ if (siblings === undefined || siblings === null)
265
+ return undefined;
266
+ if (typeof siblings[Symbol.iterator] !== 'function') {
267
+ throw new TypeError('mcpServerNameVerdict: siblings must be an iterable of server names (or absent)');
268
+ }
269
+ const usable = new Set();
270
+ const variants = new Map();
271
+ for (const entry of siblings) {
272
+ const sibling = entry;
273
+ if (typeof sibling !== 'string')
274
+ continue;
275
+ if (nameUsable(sibling))
276
+ usable.add(sibling);
277
+ else if (mcpNameDropReasonOf(sibling) === 'name_edge_whitespace') {
278
+ const trimmed = sibling.trim();
279
+ const set = variants.get(trimmed);
280
+ if (set === undefined)
281
+ variants.set(trimmed, new Set([sibling]));
282
+ else
283
+ set.add(sibling);
284
+ }
285
+ }
286
+ return { usable, variants };
287
+ }
288
+ function nameVerdictAmong(name, among) {
289
+ if (nameUsable(name))
290
+ return Object.freeze({ usable: true });
291
+ const reason = mcpNameDropReasonOf(name);
292
+ if (reason === 'name_edge_whitespace' && among !== undefined && typeof name === 'string') {
293
+ const trimmed = name.trim();
294
+ const others = among.variants.get(trimmed);
295
+ if (among.usable.has(trimmed) || (others !== undefined && (others.size > 1 || !others.has(name)))) {
296
+ return Object.freeze({ usable: false, reason: 'name_collides_after_trim' });
297
+ }
298
+ }
299
+ return Object.freeze({ usable: false, reason });
300
+ }
301
+ export function mcpServerNameVerdict(name, siblings) {
302
+ return nameVerdictAmong(name, nameSiblingsOf(siblings));
303
+ }
124
304
  const DROP_NAME_SHOWN = 80;
125
305
  const DROP_LABEL_SHOWN = 140;
126
306
  const DROP_PROBLEM_SHOWN = 300;
@@ -137,21 +317,29 @@ function dropNotice(name, reason, problem, opts, path) {
137
317
  const where = typeof label === 'string' && label.length > 0 ? ` (${capForDisplay(label, DROP_LABEL_SHOWN)})` : '';
138
318
  const quoted = `"${capForDisplay(name, DROP_NAME_SHOWN)}"`;
139
319
  const badName = () => capForDisplay(SETTINGS_DESCRIBE_BAD_WIRE_NAME(name), DROP_BAD_NAME_SHOWN);
140
- const ref = reason === 'tool_axes_invalid'
141
- ? msg('config.mcp.toolAxesInvalid', { name: quoted, where, problem: capForDisplay(problem ?? renderMessage(msg('config.mcp.toolAxesFallbackProblem')), DROP_PROBLEM_SHOWN) })
142
- : reason === 'elicitation_invalid'
143
- ? msg('config.mcp.elicitationInvalid', { name: quoted, where })
144
- : reason === 'identity_headers_both_set'
145
- ? msg('config.mcp.identityHeadersBothSet', { name: quoted, where })
146
- : reason === 'transport_invalid'
147
- ? msg('config.mcp.transportInvalid', { name: quoted, where, path: capForDisplay(path ?? 'transport', DROP_NAME_SHOWN), problem: capForDisplay(problem ?? '', DROP_PROBLEM_SHOWN) })
148
- : reason === 'name_blank'
149
- ? msg('config.mcp.nameBlank', { name: badName(), where })
150
- : reason === 'name_collides_after_trim'
151
- ? msg('config.mcp.nameCollides', { name: badName(), where })
152
- : reason === 'name_too_long'
153
- ? msg('config.mcp.nameTooLong', { name: badName(), where })
154
- : msg('config.mcp.nameEdgeWhitespace', { name: badName(), where });
320
+ const ref = reason === 'entry_not_object'
321
+ ? msg('config.mcp.entryNotObject', { name: quoted, where })
322
+ : reason === 'entry_unreadable'
323
+ ? msg('config.mcp.entryUnreadable', { name: quoted, where })
324
+ : reason === 'tool_axes_invalid'
325
+ ? msg('config.mcp.toolAxesInvalid', { name: quoted, where, problem: capForDisplay(problem ?? renderMessage(msg('config.mcp.toolAxesFallbackProblem')), DROP_PROBLEM_SHOWN) })
326
+ : reason === 'tool_faces_invalid'
327
+ ? msg('config.mcp.toolFacesInvalid', { name: quoted, where, problem: capForDisplay(problem ?? renderMessage(msg('config.mcp.toolFacesFallbackProblem')), DROP_PROBLEM_SHOWN) })
328
+ : reason === 'elicitation_invalid'
329
+ ? msg('config.mcp.elicitationInvalid', { name: quoted, where })
330
+ : reason === 'allow_tools_invalid'
331
+ ? msg('config.mcp.allowToolsInvalid', { name: quoted, where, problem: capForDisplay(problem ?? '', DROP_PROBLEM_SHOWN) })
332
+ : reason === 'identity_headers_both_set'
333
+ ? msg('config.mcp.identityHeadersBothSet', { name: quoted, where })
334
+ : reason === 'transport_invalid'
335
+ ? msg('config.mcp.transportInvalid', { name: quoted, where, path: capForDisplay(path ?? 'transport', DROP_NAME_SHOWN), problem: capForDisplay(problem ?? '', DROP_PROBLEM_SHOWN) })
336
+ : reason === 'name_blank'
337
+ ? msg('config.mcp.nameBlank', { name: badName(), where })
338
+ : reason === 'name_collides_after_trim'
339
+ ? msg('config.mcp.nameCollides', { name: badName(), where })
340
+ : reason === 'name_too_long'
341
+ ? msg('config.mcp.nameTooLong', { name: badName(), where })
342
+ : msg('config.mcp.nameEdgeWhitespace', { name: badName(), where });
155
343
  return renderMessage(ref, opts?.lang);
156
344
  }
157
345
  function degradedNotice(name, lost, opts) {
@@ -167,34 +355,43 @@ function degradedNotice(name, lost, opts) {
167
355
  const what = capForDisplay(lost.map((l) => `${l.path}: ${l.reason}`).join('; '), DEGRADED_LOST_SHOWN);
168
356
  return renderMessage(msg('config.mcp.transportDegraded', { name: quoted, where, lost: what }), opts?.lang);
169
357
  }
358
+ function entriesOf(servers) {
359
+ const table = servers ?? {};
360
+ return Object.keys(table).map((name) => {
361
+ try {
362
+ return [name, table[name], false];
363
+ }
364
+ catch {
365
+ return [name, undefined, true];
366
+ }
367
+ });
368
+ }
170
369
  export function projectMcpConfigs(servers, opts) {
171
370
  const specs = [];
172
371
  const dropped = [];
173
372
  const degraded = [];
174
- const entries = Object.entries(servers ?? {});
175
- const exactNames = new Set();
176
- const trimmedCount = new Map();
177
- for (const [name] of entries) {
178
- if (nameUsable(name))
179
- exactNames.add(name);
180
- else if (mcpNameDropReasonOf(name) === 'name_edge_whitespace')
181
- trimmedCount.set(name.trim(), (trimmedCount.get(name.trim()) ?? 0) + 1);
182
- }
183
- for (const [name, c] of entries) {
184
- if (!nameUsable(name)) {
185
- const flaw = mcpNameDropReasonOf(name);
186
- const reason = flaw === 'name_edge_whitespace' && (exactNames.has(name.trim()) || (trimmedCount.get(name.trim()) ?? 0) > 1) ? 'name_collides_after_trim' : flaw;
187
- dropped.push({ name, reason, notice: dropNotice(name, reason, undefined, opts) });
373
+ const entries = entriesOf(servers);
374
+ const among = nameSiblingsOf(entries.map(([name]) => name));
375
+ for (const [name, c, slotUnreadable] of entries) {
376
+ const nameVerdict = nameVerdictAmong(name, among);
377
+ if (!nameVerdict.usable) {
378
+ dropped.push({ name, reason: nameVerdict.reason, notice: dropNotice(name, nameVerdict.reason, undefined, opts) });
188
379
  continue;
189
380
  }
190
- const out = mcpConfigEntry(name, c);
381
+ const out = slotUnreadable ? { spec: null, entryUnreadable: true } : mcpConfigEntry(name, c);
191
382
  if (out.spec !== null) {
192
383
  specs.push(out.spec);
193
384
  if (out.transportLost !== undefined)
194
385
  degraded.push({ name, lost: Object.freeze([...out.transportLost]), notice: degradedNotice(name, out.transportLost, opts) });
195
386
  continue;
196
387
  }
197
- if (out.identityBothSet === true) {
388
+ if (out.entryNotObject === true) {
389
+ dropped.push({ name, reason: 'entry_not_object', notice: dropNotice(name, 'entry_not_object', undefined, opts) });
390
+ }
391
+ else if (out.entryUnreadable === true) {
392
+ dropped.push({ name, reason: 'entry_unreadable', notice: dropNotice(name, 'entry_unreadable', undefined, opts) });
393
+ }
394
+ else if (out.identityBothSet === true) {
198
395
  dropped.push({ name, reason: 'identity_headers_both_set', notice: dropNotice(name, 'identity_headers_both_set', undefined, opts) });
199
396
  }
200
397
  else if (out.transportBad !== undefined) {
@@ -204,9 +401,16 @@ export function projectMcpConfigs(servers, opts) {
204
401
  else if (out.axesProblem !== undefined) {
205
402
  dropped.push({ name, reason: 'tool_axes_invalid', problem: out.axesProblem, notice: dropNotice(name, 'tool_axes_invalid', out.axesProblem, opts) });
206
403
  }
404
+ else if (out.facesProblem !== undefined) {
405
+ dropped.push({ name, reason: 'tool_faces_invalid', problem: out.facesProblem, notice: dropNotice(name, 'tool_faces_invalid', out.facesProblem, opts) });
406
+ }
207
407
  else if (out.elicitationInvalid === true) {
208
408
  dropped.push({ name, reason: 'elicitation_invalid', notice: dropNotice(name, 'elicitation_invalid', undefined, opts) });
209
409
  }
410
+ else if (out.allowToolsInvalid !== undefined) {
411
+ const { path, problem } = out.allowToolsInvalid;
412
+ dropped.push({ name, reason: 'allow_tools_invalid', problem, path, notice: dropNotice(name, 'allow_tools_invalid', problem, opts, path) });
413
+ }
210
414
  }
211
415
  return { specs, dropped: Object.freeze(dropped), degraded: Object.freeze(degraded) };
212
416
  }
@@ -232,6 +436,6 @@ export function mcpAssertionHeaderNotSentNotice(specs) {
232
436
  const parts = distinct.slice(0, ASSERTION_NOTICE_NAMES_SHOWN).map((x) => `"${x}"`);
233
437
  if (distinct.length > ASSERTION_NOTICE_NAMES_SHOWN)
234
438
  parts.push(`+${distinct.length - ASSERTION_NOTICE_NAMES_SHOWN} more`);
235
- return (`MCP servers that declare an assertion header (assertionHeader): ${parts.join(', ')} — server versions up to 7.132.0 accept this setting but do not send the header, ` +
439
+ return (`MCP servers that declare an assertion header (assertionHeader): ${parts.join(', ')} — server versions up to 7.134.0 accept this setting but do not send the header, ` +
236
440
  'and this client cannot tell whether the engine it uses sends it; a connector that requires the header will refuse requests from these servers');
237
441
  }
@@ -1,4 +1,4 @@
1
- import { engineWireTarget } from './engineWireTarget.js';
1
+ import { engineWireTargetBaseUrl } from './engineWireTarget.js';
2
2
  import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
3
3
  import { ownDataField } from './ownKey.js';
4
4
  export const MEMORY_ENGINE_REQUIRED_CODE = 'capability.memory_engine_required';
@@ -22,7 +22,7 @@ const reader = createEngineCapReader({
22
22
  name: 'memoryCompliance',
23
23
  project: projectMemoryComplianceCapability,
24
24
  });
25
- export function observedMemoryCompliance(baseUrl = engineWireTarget()?.baseUrl) {
25
+ export function observedMemoryCompliance(baseUrl = engineWireTargetBaseUrl()) {
26
26
  return reader.observed(baseUrl);
27
27
  }
28
28
  export function memoryComplianceVerbsAvailable(reading) {
@@ -1,4 +1,4 @@
1
- import { engineWireTarget } from './engineWireTarget.js';
1
+ import { engineWireTargetBaseUrl } from './engineWireTarget.js';
2
2
  import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
3
3
  import { ownDataField } from './ownKey.js';
4
4
  import { MEMORY_ENGINE_REQUIRED_CODE } from './memoryComplianceCapability.js';
@@ -22,7 +22,7 @@ const reader = createEngineCapReader({
22
22
  name: 'memoryOrigin',
23
23
  project: projectMemoryOriginCapability,
24
24
  });
25
- export function observedMemoryOrigin(baseUrl = engineWireTarget()?.baseUrl) {
25
+ export function observedMemoryOrigin(baseUrl = engineWireTargetBaseUrl()) {
26
26
  return reader.observed(baseUrl);
27
27
  }
28
28
  export function memoryOriginVerbsAvailable(reading) {
@@ -0,0 +1,24 @@
1
+ import { SETTINGS_RESOLVE_CATALOG_DEFAULT_MODEL, type SETTINGS_DEFAULT_ROLE_TIER_LADDER } from '../generated/settingsSchemaFns.js';
2
+ export type CatalogDefaultModelsInput = Parameters<typeof SETTINGS_RESOLVE_CATALOG_DEFAULT_MODEL>[0];
3
+ export type CatalogDefaultSource = 'roles.default' | 'fallback' | `tierGroup.${(typeof SETTINGS_DEFAULT_ROLE_TIER_LADDER)[number]}`;
4
+ export interface CatalogDefaultDangling {
5
+ readonly source: Exclude<CatalogDefaultSource, 'fallback'>;
6
+ readonly name: string;
7
+ }
8
+ export interface CatalogDefaultSelectCriteria {
9
+ readonly tier?: string | undefined;
10
+ readonly needs?: readonly string[] | undefined;
11
+ readonly prefer?: string | undefined;
12
+ }
13
+ export interface CatalogDefaultNamed {
14
+ readonly kind: 'named';
15
+ readonly name: string;
16
+ readonly source: CatalogDefaultSource;
17
+ readonly dangling: readonly CatalogDefaultDangling[];
18
+ }
19
+ export interface CatalogDefaultSelect {
20
+ readonly kind: 'select';
21
+ readonly select: CatalogDefaultSelectCriteria;
22
+ }
23
+ export type CatalogDefaultModel = CatalogDefaultNamed | CatalogDefaultSelect;
24
+ export declare function resolveCatalogDefaultModel(models: CatalogDefaultModelsInput, has: (name: string) => boolean, fallback: string): CatalogDefaultModel;
@@ -0,0 +1,4 @@
1
+ import { SETTINGS_RESOLVE_CATALOG_DEFAULT_MODEL } from '../generated/settingsSchemaFns.js';
2
+ export function resolveCatalogDefaultModel(models, has, fallback) {
3
+ return SETTINGS_RESOLVE_CATALOG_DEFAULT_MODEL(models, has, fallback);
4
+ }
@@ -14,22 +14,23 @@ function frozenJsonCopy(v, depth) {
14
14
  if (typeof v !== 'object')
15
15
  throw new Unreadable();
16
16
  if (Array.isArray(v)) {
17
- const n = Object.getOwnPropertyDescriptor(v, 'length')?.value;
17
+ const ld = Object.getOwnPropertyDescriptor(v, 'length');
18
+ const n = ld !== undefined && Object.hasOwn(ld, 'value') ? ld.value : undefined;
18
19
  if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0)
19
20
  throw new Unreadable();
20
21
  const out = [];
21
22
  for (let i = 0; i < n; i += 1) {
22
23
  const d = Object.getOwnPropertyDescriptor(v, String(i));
23
- if (d === undefined || !('value' in d))
24
+ if (d === undefined || !Object.hasOwn(d, 'value'))
24
25
  throw new Unreadable();
25
- out.push(frozenJsonCopy(d.value, depth + 1));
26
+ Object.defineProperty(out, out.length, { value: frozenJsonCopy(d.value, depth + 1), writable: true, enumerable: true, configurable: true });
26
27
  }
27
28
  return Object.freeze(out);
28
29
  }
29
30
  const out = {};
30
31
  for (const k of Object.keys(v)) {
31
32
  const d = Object.getOwnPropertyDescriptor(v, k);
32
- if (d === undefined || !('value' in d))
33
+ if (d === undefined || !Object.hasOwn(d, 'value'))
33
34
  throw new Unreadable();
34
35
  if (d.value === undefined)
35
36
  continue;
@@ -1,8 +1,9 @@
1
+ import { appendOwnElement } from '../ownKey.js';
1
2
  import { SETTINGS_AT_MENTION_MODES } from '../generated/settingsSchemaFns.js';
2
3
  function ownData(o, key) {
3
4
  try {
4
5
  const d = Object.getOwnPropertyDescriptor(o, key);
5
- return d !== undefined && 'value' in d ? d.value : undefined;
6
+ return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
6
7
  }
7
8
  catch {
8
9
  return undefined;
@@ -24,9 +25,9 @@ function atMentionOf(v) {
24
25
  const out = [];
25
26
  for (let i = 0; i < list.length; i += 1) {
26
27
  const d = Object.getOwnPropertyDescriptor(list, i);
27
- if (d === undefined || !('value' in d) || typeof d.value !== 'string' || d.value.length === 0)
28
+ if (d === undefined || !Object.hasOwn(d, 'value') || typeof d.value !== 'string' || d.value.length === 0)
28
29
  return undefined;
29
- out.push(d.value);
30
+ appendOwnElement(out, d.value);
30
31
  }
31
32
  return { mode: 'only', models: out };
32
33
  }
@@ -50,6 +50,7 @@ export type OnboardWriteVerdict = {
50
50
  readonly refusal: 'probe_failed' | 'probe_unverified';
51
51
  };
52
52
  export declare function onboardWriteVerdict(verdict: OnboardProbeVerdict, acceptUnverified?: boolean): OnboardWriteVerdict;
53
+ export declare const KEY_SLOT_PREFIX = "SEMA_MODEL_KEY_";
53
54
  export declare function keyEnvNameForEntry(entryName: string): string;
54
55
  export declare function poolEntryNameOf(modelId: string, channel: string, taken: ReadonlySet<string>): string;
55
56
  export interface OnboardPlanEntry {
@@ -206,7 +206,7 @@ export function onboardWriteVerdict(verdict, acceptUnverified) {
206
206
  return Object.freeze({ write: false, refusal: 'probe_failed' });
207
207
  return acceptUnverified === true ? Object.freeze({ write: true, unverified: true }) : Object.freeze({ write: false, refusal: 'probe_unverified' });
208
208
  }
209
- const KEY_SLOT_PREFIX = 'SEMA_MODEL_KEY_';
209
+ export const KEY_SLOT_PREFIX = 'SEMA_MODEL_KEY_';
210
210
  export function keyEnvNameForEntry(entryName) {
211
211
  const base = String(entryName).toUpperCase().replace(/[^A-Z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'ENTRY';
212
212
  return `${KEY_SLOT_PREFIX}${base}`;
@@ -8,7 +8,7 @@ function ownData(v, key) {
8
8
  return undefined;
9
9
  try {
10
10
  const d = Object.getOwnPropertyDescriptor(v, key);
11
- return d !== undefined && 'value' in d ? d.value : undefined;
11
+ return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
12
12
  }
13
13
  catch {
14
14
  return undefined;
@@ -74,7 +74,7 @@ function ownSlot(v, key) {
74
74
  const d = Object.getOwnPropertyDescriptor(v, key);
75
75
  if (d === undefined)
76
76
  return { kind: 'absent' };
77
- return 'value' in d ? { kind: 'value', value: d.value } : { kind: 'unreadable' };
77
+ return Object.hasOwn(d, 'value') ? { kind: 'value', value: d.value } : { kind: 'unreadable' };
78
78
  }
79
79
  catch {
80
80
  return { kind: 'unreadable' };
@@ -1,5 +1,6 @@
1
1
  import { displayUntrusted } from './displayUntrusted.js';
2
2
  import { abortableSleep } from './abortableSleep.js';
3
+ import { causeSlotProtected, walkCauseChain } from './engineWireFor.js';
3
4
  import { readThrownSlot } from './wireFailureShape.js';
4
5
  import { guardedRead, readOwnDataValue } from './ownKey.js';
5
6
  import { msg, renderMessage } from './i18n/translate.js';
@@ -467,18 +468,17 @@ function nearestFromCatalogText(text, modelId) {
467
468
  }
468
469
  function unwrapFetchCause(e) {
469
470
  const parts = [];
470
- let cur = e;
471
- for (let i = 0; i < 4 && cur !== null && typeof cur === 'object'; i++) {
472
- const code = readThrownSlot(cur, 'code');
473
- const message = readThrownSlot(cur, 'message');
471
+ walkCauseChain(e, (layer) => {
472
+ const code = readThrownSlot(layer, 'code');
473
+ const message = readThrownSlot(layer, 'message');
474
474
  const c = typeof code === 'string' && code !== '' ? code : undefined;
475
475
  const m = typeof message === 'string' && message !== '' ? message : undefined;
476
476
  if (c !== undefined)
477
477
  parts.push(m !== undefined && m !== c ? `${c} ${m}` : c);
478
478
  else if (m !== undefined)
479
479
  parts.push(m);
480
- cur = readThrownSlot(cur, 'cause');
481
- }
480
+ return undefined;
481
+ }, causeSlotProtected);
482
482
  if (parts.length === 0 && typeof e === 'string')
483
483
  parts.push(e);
484
484
  return [...new Set(parts)].join(' ← ');
@@ -17,8 +17,11 @@ export interface LocalEngineModelIdentityReading {
17
17
  engine: 'local';
18
18
  lanes: ModelIdentityLanes;
19
19
  engineAnswer?: EngineAnswerObservation;
20
- engineAcceptsCatalogDefault?: boolean;
21
20
  catalogAdoption?: EngineCatalogAdoptionReading;
21
+ catalogFacts?: {
22
+ readonly listed?: number;
23
+ readonly shapeRefused?: boolean;
24
+ };
22
25
  routeGap?: ModelRouteGapReading;
23
26
  }
24
27
  export type ModelRouteGapReading = 'endpoint_missing' | 'lane_credential_missing' | 'none';
@@ -30,6 +33,12 @@ export type ModelIdentityReading = LocalEngineModelIdentityReading | RemoteEngin
30
33
  export type ModelIdentityResolvability = 'resolvable' | 'not_resolvable' | 'unknown';
31
34
  export type ModelSetupDecision = 'offer_setup' | 'offer_route_setup' | 'explain_unconfigured' | 'explain_route_gap' | 'explain_route_unconfigurable' | 'proceed';
32
35
  export declare function modelIdentityResolvability(reading: ModelIdentityReading): ModelIdentityResolvability;
36
+ export interface ModelIdentityCatalogDeviation {
37
+ readonly kind: 'catalog_lane_overridden_by_facts';
38
+ readonly reported: ModelIdentityLaneReading | 'unusable';
39
+ readonly derived: 'partial' | 'absent';
40
+ }
41
+ export declare function modelIdentityCatalogDeviationOf(reading: ModelIdentityReading): ModelIdentityCatalogDeviation | undefined;
33
42
  export declare function modelRouteGapSentence(lane: ModelIdentityLane, gap: ModelRouteGapReading, lang?: UiLanguage): string | undefined;
34
43
  export declare function modelRouteGapFact(gap: ModelRouteGapReading, lang?: UiLanguage): string | undefined;
35
44
  export declare function modelIdentityDetail(reading: ModelIdentityReading): string;