@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,5 +1,8 @@
1
+ import { appendOwnElement, readOwnDataValue } from './ownKey.js';
1
2
  import { frozenJsonCopyOf, liveDefaultModelCopy, liveModelRowCopy } from './model/liveCatalogShape.js';
2
3
  import { msg, renderMessage } from './i18n/translate.js';
4
+ import { quoteUntrustedForSentence } from './displayUntrusted.js';
5
+ import { CC_TIER_ALIASES, TIER_ORDER } from './model/tierVocabulary.js';
3
6
  let catalog = null;
4
7
  let refresher = null;
5
8
  export function setLiveModelCatalog(next) {
@@ -37,7 +40,7 @@ export function normalizeLiveModelRef(ref) {
37
40
  function ownDataOf(o, key) {
38
41
  try {
39
42
  const d = Object.getOwnPropertyDescriptor(o, key);
40
- return d !== undefined && 'value' in d ? d.value : undefined;
43
+ return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
41
44
  }
42
45
  catch {
43
46
  return undefined;
@@ -82,15 +85,20 @@ function targetRowOf(model, cat) {
82
85
  return row === undefined ? { kind: 'none', why: 'model_not_listed' } : { kind: 'row', row };
83
86
  }
84
87
  export function imageVisionOf(model, catalog = getLiveModelCatalog()) {
88
+ return imageVisionReadingOf(model, catalog).vision;
89
+ }
90
+ export function imageVisionReadingOf(model, catalog = getLiveModelCatalog()) {
85
91
  try {
86
92
  const target = targetRowOf(model, catalog);
87
93
  if (target.kind !== 'row')
88
- return 'unknown';
94
+ return { vision: 'unknown' };
89
95
  const vision = ownDataOf(target.row, 'vision');
90
- return vision === true ? 'yes' : vision === false ? 'no' : 'unknown';
96
+ const word = vision === true ? 'yes' : vision === false ? 'no' : 'unknown';
97
+ const name = ownDataOf(target.row, 'name');
98
+ return typeof name === 'string' && name.length > 0 ? { vision: word, model: name } : { vision: word };
91
99
  }
92
100
  catch {
93
- return 'unknown';
101
+ return { vision: 'unknown' };
94
102
  }
95
103
  }
96
104
  const NOT_CLAMPED = Object.freeze({ kind: 'not_clamped' });
@@ -148,13 +156,119 @@ export function liveDefaultModelName() {
148
156
  const d = liveDefaultModelOf(catalog);
149
157
  return d.kind === 'listed' ? d.name : d.kind === 'not_listed' ? d.id : null;
150
158
  }
159
+ function isReservedModelWord(word) {
160
+ return word === 'default' || TIER_ORDER.includes(word) || Object.hasOwn(CC_TIER_ALIASES, word);
161
+ }
162
+ function droppedDisabledNamed(dropped, name) {
163
+ if (dropped.kind !== 'reported')
164
+ return false;
165
+ return dropped.entries.some((e) => e.identity !== undefined && e.identity.enabled === false && (e.identity.name === name || e.identity.id === name));
166
+ }
167
+ function catalogIncomplete(cat, rows, dropped) {
168
+ const models = ownDataOf(cat, 'models');
169
+ const n = Array.isArray(models) ? ownDataOf(models, 'length') : undefined;
170
+ if (typeof n === 'number' && Number.isSafeInteger(n) && n > rows.length)
171
+ return true;
172
+ return dropped.kind === 'reported' ? dropped.entries.length > 0 || dropped.unreadable > 0 : dropped.kind === 'unknown';
173
+ }
174
+ function isPlainRecord(o) {
175
+ const proto = Object.getPrototypeOf(o);
176
+ return proto === Object.prototype || proto === null;
177
+ }
178
+ function rowIdentityUnreadable(row) {
179
+ try {
180
+ const name = Object.getOwnPropertyDescriptor(row, 'name');
181
+ if (name === undefined || !Object.hasOwn(name, 'value') || typeof name.value !== 'string' || name.value.length === 0)
182
+ return true;
183
+ const id = Object.getOwnPropertyDescriptor(row, 'id');
184
+ if (id !== undefined && (!Object.hasOwn(id, 'value') || typeof id.value !== 'string'))
185
+ return true;
186
+ return false;
187
+ }
188
+ catch {
189
+ return true;
190
+ }
191
+ }
192
+ export function modelAcceptanceOf(model, catalog = getLiveModelCatalog()) {
193
+ const name = typeof model === 'string' && model.length > 0 ? model : undefined;
194
+ try {
195
+ if (name === undefined)
196
+ return Object.freeze({ verdict: 'unknown', why: 'model_absent' });
197
+ const reserved = isReservedModelWord(name);
198
+ const unreadable = () => Object.freeze({ verdict: 'unknown', why: reserved ? 'reserved_word' : 'catalog_unreadable', model: name });
199
+ if (catalog === null)
200
+ return Object.freeze({ verdict: 'unknown', why: reserved ? 'reserved_word' : 'catalog_absent', model: name });
201
+ if (typeof catalog !== 'object' || Array.isArray(catalog) || !isPlainRecord(catalog))
202
+ return unreadable();
203
+ const rows = catalogRowsOf(catalog);
204
+ if (rows === undefined || rows.length === 0)
205
+ return unreadable();
206
+ const dm = liveDefaultModelOf(catalog);
207
+ let defaultModel = dm.kind === 'listed' ? dm.name : dm.kind === 'not_listed' ? dm.id : undefined;
208
+ if (defaultModel !== undefined) {
209
+ const defaultRow = liveModelRowOf(catalog, defaultModel);
210
+ if (defaultRow !== undefined && ownDataOf(defaultRow, 'enabled') === false)
211
+ defaultModel = undefined;
212
+ }
213
+ const withDefault = defaultModel === undefined ? {} : { defaultModel };
214
+ const reservedReading = () => Object.freeze({ verdict: 'unknown', why: 'reserved_word', model: name, ...withDefault });
215
+ if (reserved)
216
+ return reservedReading();
217
+ const row = liveModelRowOf(catalog, name);
218
+ if (row !== undefined) {
219
+ const normalized = ownDataOf(row, 'name');
220
+ if (typeof normalized !== 'string' || normalized.length === 0)
221
+ return Object.freeze({ verdict: 'unknown', why: 'catalog_unreadable', model: name });
222
+ if (isReservedModelWord(normalized))
223
+ return reservedReading();
224
+ return ownDataOf(row, 'enabled') === false
225
+ ? Object.freeze({ verdict: 'refused', why: 'disabled', model: name, ...withDefault })
226
+ : Object.freeze({ verdict: 'accepted', why: 'listed', model: name, ...withDefault });
227
+ }
228
+ if (rows.some(rowIdentityUnreadable))
229
+ return Object.freeze({ verdict: 'unknown', why: 'catalog_unreadable', model: name });
230
+ const dropped = droppedModelEntriesOf(catalog);
231
+ if (droppedDisabledNamed(dropped, name))
232
+ return Object.freeze({ verdict: 'refused', why: 'disabled', model: name, ...withDefault });
233
+ if (catalogIncomplete(catalog, rows, dropped))
234
+ return Object.freeze({ verdict: 'unknown', why: 'catalog_incomplete', model: name, ...withDefault });
235
+ return Object.freeze({ verdict: 'refused', why: 'not_listed', model: name, ...withDefault });
236
+ }
237
+ catch {
238
+ return Object.freeze({ verdict: 'unknown', why: 'catalog_unreadable', ...(name !== undefined ? { model: name } : {}) });
239
+ }
240
+ }
241
+ const NOT_SERVED_NAME_MAX = 120;
242
+ export function modelNotServedNotice(reading, lang) {
243
+ try {
244
+ if (reading === null || typeof reading !== 'object')
245
+ return undefined;
246
+ if (ownDataOf(reading, 'verdict') !== 'refused')
247
+ return undefined;
248
+ const why = ownDataOf(reading, 'why');
249
+ if (why !== 'not_listed' && why !== 'disabled')
250
+ return undefined;
251
+ const model = ownDataOf(reading, 'model');
252
+ const shown = typeof model === 'string' && model.length > 0 ? quoteUntrustedForSentence(model, NOT_SERVED_NAME_MAX) : undefined;
253
+ if (shown === undefined)
254
+ return undefined;
255
+ const dm = ownDataOf(reading, 'defaultModel');
256
+ const fallback = typeof dm === 'string' && dm.length > 0 ? quoteUntrustedForSentence(dm, NOT_SERVED_NAME_MAX) : undefined;
257
+ return fallback === undefined
258
+ ? renderMessage(msg('model.notServed.noDefault', { model: shown }), lang)
259
+ : renderMessage(msg('model.notServed.withDefault', { model: shown, default: fallback }), lang);
260
+ }
261
+ catch {
262
+ return undefined;
263
+ }
264
+ }
151
265
  const notReportedDropped = () => Object.freeze({ kind: 'not_reported' });
152
266
  const unknownDropped = (why) => Object.freeze({ kind: 'unknown', why });
153
267
  function ownDataCopy(o) {
154
268
  const out = {};
155
269
  for (const k of Object.keys(o)) {
156
270
  const d = Object.getOwnPropertyDescriptor(o, k);
157
- if (d === undefined || !('value' in d))
271
+ if (d === undefined || !(Object.hasOwn(d, 'value')))
158
272
  return undefined;
159
273
  Object.defineProperty(out, k, { value: d.value, enumerable: true, writable: true, configurable: true });
160
274
  }
@@ -203,7 +317,7 @@ export function droppedModelEntriesOf(catalog = getLiveModelCatalog()) {
203
317
  if (!Object.hasOwn(catalog, 'droppedEntries'))
204
318
  return notReportedDropped();
205
319
  const d = Object.getOwnPropertyDescriptor(catalog, 'droppedEntries');
206
- if (d === undefined || !('value' in d))
320
+ if (d === undefined || !(Object.hasOwn(d, 'value')))
207
321
  return unknownDropped('unreadable');
208
322
  const raw = d.value;
209
323
  if (raw === undefined)
@@ -217,7 +331,7 @@ export function droppedModelEntriesOf(catalog = getLiveModelCatalog()) {
217
331
  let unreadable = 0;
218
332
  for (let i = 0; i < n; i += 1) {
219
333
  const rd = Object.getOwnPropertyDescriptor(raw, String(i));
220
- const row = rd !== undefined && 'value' in rd ? droppedRowOf(rd.value) : undefined;
334
+ const row = rd !== undefined && Object.hasOwn(rd, 'value') ? droppedRowOf(rd.value) : undefined;
221
335
  if (row === undefined)
222
336
  unreadable += 1;
223
337
  else
@@ -237,7 +351,7 @@ export function modelCandidateRejectedOf(catalog = getLiveModelCatalog()) {
237
351
  if (!Object.hasOwn(catalog, 'candidateRejected'))
238
352
  return Object.freeze({ kind: 'not_reported' });
239
353
  const d = Object.getOwnPropertyDescriptor(catalog, 'candidateRejected');
240
- if (d === undefined || !('value' in d))
354
+ if (d === undefined || !(Object.hasOwn(d, 'value')))
241
355
  return unreadable;
242
356
  const v = d.value;
243
357
  if (v === undefined)
@@ -246,22 +360,22 @@ export function modelCandidateRejectedOf(catalog = getLiveModelCatalog()) {
246
360
  return unreadable;
247
361
  const own = (k) => {
248
362
  const od = Object.getOwnPropertyDescriptor(v, k);
249
- return od !== undefined && 'value' in od ? od.value : undefined;
363
+ return od !== undefined && Object.hasOwn(od, 'value') ? od.value : undefined;
250
364
  };
251
365
  const rawDomains = own('domains');
252
366
  const at = own('at');
253
367
  const source = own('source');
254
368
  if (!Array.isArray(rawDomains) || typeof at !== 'string' || at.length === 0 || typeof source !== 'string' || source.length === 0)
255
369
  return unreadable;
256
- const n = Object.getOwnPropertyDescriptor(rawDomains, 'length')?.value;
370
+ const n = readOwnDataValue(rawDomains, 'length');
257
371
  if (typeof n !== 'number' || !Number.isSafeInteger(n) || n <= 0)
258
372
  return unreadable;
259
373
  const domains = [];
260
374
  for (let i = 0; i < n; i += 1) {
261
375
  const id = Object.getOwnPropertyDescriptor(rawDomains, String(i));
262
- if (id === undefined || !('value' in id) || typeof id.value !== 'string' || id.value.length === 0)
376
+ if (id === undefined || !(Object.hasOwn(id, 'value')) || typeof id.value !== 'string' || id.value.length === 0)
263
377
  return unreadable;
264
- domains.push(id.value);
378
+ appendOwnElement(domains, id.value);
265
379
  }
266
380
  return Object.freeze({ kind: 'rejected', domains: Object.freeze(domains), at, source });
267
381
  }
@@ -303,7 +417,7 @@ function envelopeKey(o, key) {
303
417
  const d = Object.getOwnPropertyDescriptor(o, key);
304
418
  if (d === undefined)
305
419
  return { present: false };
306
- if (!('value' in d))
420
+ if (!(Object.hasOwn(d, 'value')))
307
421
  throw new Error('accessor');
308
422
  return { present: true, value: d.value };
309
423
  }
@@ -327,7 +441,7 @@ export function readLiveModelCatalog(body) {
327
441
  let unreadableRows = 0;
328
442
  for (let i = 0; i < len; i += 1) {
329
443
  const d = Object.getOwnPropertyDescriptor(raw, String(i));
330
- const row = d !== undefined && 'value' in d ? liveModelRowCopy(d.value) : undefined;
444
+ const row = d !== undefined && Object.hasOwn(d, 'value') ? liveModelRowCopy(d.value) : undefined;
331
445
  if (row === undefined || names.has(row.name)) {
332
446
  unreadableRows += 1;
333
447
  continue;
@@ -359,13 +473,13 @@ export function readLiveModelCatalog(body) {
359
473
  function droppedEntriesCopy(v) {
360
474
  if (!Array.isArray(v))
361
475
  return frozenJsonCopyOf(v) ?? null;
362
- const n = Object.getOwnPropertyDescriptor(v, 'length')?.value;
476
+ const n = readOwnDataValue(v, 'length');
363
477
  if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0)
364
478
  return null;
365
479
  const out = [];
366
480
  for (let i = 0; i < n; i += 1) {
367
481
  const d = Object.getOwnPropertyDescriptor(v, String(i));
368
- out.push((d !== undefined && 'value' in d ? frozenJsonCopyOf(d.value) : undefined) ?? null);
482
+ appendOwnElement(out, (d !== undefined && Object.hasOwn(d, 'value') ? frozenJsonCopyOf(d.value) : undefined) ?? null);
369
483
  }
370
484
  return Object.freeze(out);
371
485
  }
@@ -398,7 +512,7 @@ export function atMentionOf(model, catalog = getLiveModelCatalog()) {
398
512
  const d = Object.getOwnPropertyDescriptor(target.row, 'atMentionable');
399
513
  if (d === undefined)
400
514
  return Object.freeze({ kind: 'not_governed' });
401
- if (!('value' in d))
515
+ if (!(Object.hasOwn(d, 'value')))
402
516
  return Object.freeze({ kind: 'unknown', why: 'unreadable' });
403
517
  if (d.value === undefined)
404
518
  return Object.freeze({ kind: 'not_governed' });
@@ -420,7 +534,7 @@ export function modelCompatOf(model, catalog = getLiveModelCatalog()) {
420
534
  const d = Object.getOwnPropertyDescriptor(target.row, 'compat');
421
535
  if (d === undefined)
422
536
  return Object.freeze({ kind: 'not_declared' });
423
- if (!('value' in d))
537
+ if (!(Object.hasOwn(d, 'value')))
424
538
  return Object.freeze({ kind: 'unknown', why: 'unreadable' });
425
539
  if (d.value === undefined)
426
540
  return Object.freeze({ kind: 'not_declared' });
package/dist/mcpPanel.js CHANGED
@@ -78,7 +78,7 @@ export function mcpPanelRefusalOf(view) {
78
78
  if (view === null || typeof view !== 'object')
79
79
  return undefined;
80
80
  const d = Object.getOwnPropertyDescriptor(view, 'scenarioRefusal');
81
- if (d === undefined || !('value' in d))
81
+ if (d === undefined || !Object.hasOwn(d, 'value'))
82
82
  return undefined;
83
83
  const r = d.value;
84
84
  return r !== null && typeof r === 'object' && !Array.isArray(r) ? r : undefined;
@@ -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 { msg, renderMessage } from './i18n/translate.js';
4
4
  import { ownDataField } from './ownKey.js';
@@ -21,7 +21,7 @@ const reader = createEngineCapReader({
21
21
  name: 'mcpProbe',
22
22
  project: projectMcpProbeCapability,
23
23
  });
24
- export function observedMcpProbe(baseUrl = engineWireTarget()?.baseUrl) {
24
+ export function observedMcpProbe(baseUrl = engineWireTargetBaseUrl()) {
25
25
  return reader.observed(baseUrl);
26
26
  }
27
27
  export function mcpProbeAvailable(reading) {
@@ -0,0 +1,24 @@
1
+ import type { McpEngineLegConnection } from './mcpEngineLeg.js';
2
+ export interface McpShellConnectionFact {
3
+ readonly status: string;
4
+ readonly serves: 'prompts_resources';
5
+ readonly error?: string;
6
+ }
7
+ export interface McpStatusSupersetKeys {
8
+ readonly _sema_engineLeg?: McpEngineLegConnection;
9
+ readonly _sema_shellConnection?: McpShellConnectionFact;
10
+ }
11
+ export interface McpReconnectSupersetKeys {
12
+ readonly _sema_shellConnection?: McpShellConnectionFact;
13
+ }
14
+ export interface McpStatusSupersetInput {
15
+ readonly engineLeg: McpEngineLegConnection | undefined;
16
+ readonly localClientType: string | undefined;
17
+ readonly localError?: string | undefined;
18
+ }
19
+ export interface McpReconnectSupersetInput {
20
+ readonly localClientType: string | undefined;
21
+ readonly localError?: string | undefined;
22
+ }
23
+ export declare function mcpStatusSupersetKeys(input: McpStatusSupersetInput): McpStatusSupersetKeys;
24
+ export declare function mcpReconnectSupersetKeys(input: McpReconnectSupersetInput): McpReconnectSupersetKeys;
@@ -0,0 +1,45 @@
1
+ import { guardedRead, readOwnDataValue } from './ownKey.js';
2
+ function slot(input, key) {
3
+ return guardedRead(() => readOwnDataValue(input, key));
4
+ }
5
+ function shellConnectionOf(input) {
6
+ const type = slot(input, 'localClientType');
7
+ if (typeof type !== 'string' || type === '')
8
+ return undefined;
9
+ const error = type === 'failed' ? slot(input, 'localError') : undefined;
10
+ return Object.freeze({
11
+ status: type,
12
+ serves: 'prompts_resources',
13
+ ...(typeof error === 'string' && error !== '' ? { error } : {}),
14
+ });
15
+ }
16
+ function frozenCopyOfEngineLeg(leg) {
17
+ if (typeof leg !== 'object' || leg === null)
18
+ return undefined;
19
+ const copy = {};
20
+ let keys;
21
+ try {
22
+ keys = Object.keys(leg);
23
+ }
24
+ catch {
25
+ return undefined;
26
+ }
27
+ for (const k of keys) {
28
+ const v = slot(leg, k);
29
+ if (typeof v === 'string' || typeof v === 'boolean' || (typeof v === 'number' && Number.isFinite(v)))
30
+ Object.defineProperty(copy, k, { value: v, enumerable: true, writable: true, configurable: true });
31
+ }
32
+ return typeof copy['state'] === 'string' ? Object.freeze(copy) : undefined;
33
+ }
34
+ export function mcpStatusSupersetKeys(input) {
35
+ const engineLeg = frozenCopyOfEngineLeg(slot(input, 'engineLeg'));
36
+ const shell = shellConnectionOf(input);
37
+ return Object.freeze({
38
+ ...(engineLeg !== undefined ? { _sema_engineLeg: engineLeg } : {}),
39
+ ...(shell !== undefined ? { _sema_shellConnection: shell } : {}),
40
+ });
41
+ }
42
+ export function mcpReconnectSupersetKeys(input) {
43
+ const shell = shellConnectionOf(input);
44
+ return Object.freeze(shell !== undefined ? { _sema_shellConnection: shell } : {});
45
+ }
@@ -1,3 +1,4 @@
1
+ import { readOwnDataValue } from './ownKey.js';
1
2
  import { checkMcpToolToggleKey } from './seatContract.js';
2
3
  function keyOf(key, index) {
3
4
  const refuse = (why) => new TypeError(`mcpToolTogglesToExcludeTools: keys[${index}] 不是逐工具开关键 { server, tool }(${why})—— 值不回显。` +
@@ -7,7 +8,7 @@ function keyOf(key, index) {
7
8
  throw refuse(`${shape.reason}${shape.field !== undefined ? ` @ ${shape.field}` : ''}`);
8
9
  let snap;
9
10
  try {
10
- snap = { server: Object.getOwnPropertyDescriptor(key, 'server')?.value, tool: Object.getOwnPropertyDescriptor(key, 'tool')?.value };
11
+ snap = { server: readOwnDataValue(key, 'server'), tool: readOwnDataValue(key, 'tool') };
11
12
  }
12
13
  catch {
13
14
  throw refuse('读不出');
@@ -17,6 +17,16 @@ export interface McpConfigLike {
17
17
  toolAxes?: unknown;
18
18
  startupTimeoutMs?: number;
19
19
  }
20
+ export type McpTransportEntryLike = Pick<McpConfigLike, 'type' | 'command' | 'args' | 'env' | 'url' | 'headers' | 'principalHeader' | 'assertionHeader'>;
21
+ export type McpTransportVerdict = {
22
+ readonly kind: 'ok';
23
+ readonly transport: McpServerSpec['transport'];
24
+ readonly lost: readonly McpEntryKeyIssue[];
25
+ } | {
26
+ readonly kind: 'bad';
27
+ readonly key: string;
28
+ readonly detail: string;
29
+ };
20
30
  export type McpHttpIdentityHeaders = {
21
31
  readonly kind: 'ok';
22
32
  readonly principalHeader?: string;
@@ -26,6 +36,7 @@ export type McpHttpIdentityHeaders = {
26
36
  };
27
37
  export declare function readMcpHttpIdentityHeaders(transport: object): McpHttpIdentityHeaders;
28
38
  export declare function mcpConfigToSpec(name: string, c: McpConfigLike): McpServerSpec | null;
39
+ export declare function mcpTransportVerdict(entry: McpTransportEntryLike | null | undefined): McpTransportVerdict;
29
40
  export declare function mcpConfigsToSpecs(servers: Record<string, McpConfigLike> | undefined): McpServerSpec[];
30
41
  export type McpToolAxesVerdict = {
31
42
  readonly kind: 'ok';
@@ -37,13 +48,40 @@ export type McpToolAxesVerdict = {
37
48
  readonly kind: 'unavailable';
38
49
  };
39
50
  export declare function mcpToolAxesVerdict(declared: {} | null | undefined): McpToolAxesVerdict;
51
+ export type McpToolFacesVerdict = {
52
+ readonly kind: 'ok';
53
+ readonly toolFaces?: Readonly<Record<string, object>>;
54
+ } | {
55
+ readonly kind: 'bad';
56
+ readonly problem: string;
57
+ } | {
58
+ readonly kind: 'unavailable';
59
+ };
60
+ export declare function mcpToolFacesVerdict(declared: {} | null | undefined): McpToolFacesVerdict;
40
61
  export declare function mcpElicitationVerdict(declared: {} | null | undefined): {
41
62
  readonly kind: 'ok';
42
63
  readonly elicitation?: boolean;
43
64
  } | {
44
65
  readonly kind: 'bad';
45
66
  };
46
- export type McpConfigDropReason = 'name_blank' | 'name_edge_whitespace' | 'name_collides_after_trim' | 'name_too_long' | 'transport_invalid' | 'identity_headers_both_set' | 'tool_axes_invalid' | 'elicitation_invalid';
67
+ export type McpAllowToolsVerdict = {
68
+ readonly kind: 'ok';
69
+ readonly allowTools?: string[];
70
+ } | {
71
+ readonly kind: 'bad';
72
+ readonly path: string;
73
+ readonly problem: string;
74
+ };
75
+ export declare function mcpAllowToolsVerdict(read: () => {} | null | undefined, keyPrefix?: string): McpAllowToolsVerdict;
76
+ export type McpConfigDropReason = 'name_blank' | 'name_edge_whitespace' | 'name_collides_after_trim' | 'name_too_long' | 'transport_invalid' | 'identity_headers_both_set' | 'tool_axes_invalid' | 'tool_faces_invalid' | 'elicitation_invalid' | 'allow_tools_invalid' | 'entry_not_object' | 'entry_unreadable';
77
+ export type McpServerNameUnusableReason = 'name_blank' | 'name_edge_whitespace' | 'name_collides_after_trim' | 'name_too_long';
78
+ export type McpServerNameVerdict = {
79
+ readonly usable: true;
80
+ } | {
81
+ readonly usable: false;
82
+ readonly reason: McpServerNameUnusableReason;
83
+ };
84
+ export declare function mcpServerNameVerdict(name: string | null | undefined, siblings?: Iterable<string>): McpServerNameVerdict;
47
85
  export interface McpConfigDropped {
48
86
  readonly name: string;
49
87
  readonly reason: McpConfigDropReason;