@sema-agent/client-core 0.99.0 → 0.101.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.
- package/CHANGELOG.md +572 -0
- package/README.md +174 -114
- package/dist/adapt/arms.js +109 -50
- package/dist/adapt/panelTasks.d.ts +2 -1
- package/dist/adapt/panelTasks.js +32 -9
- package/dist/adapt/textStream.d.ts +1 -1
- package/dist/adapt/textStream.js +58 -32
- package/dist/adapt/toolCards.js +9 -8
- package/dist/adapt.js +7 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +31 -2
- package/dist/adapter/activeRunSelfHeal.js +162 -13
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +25 -6
- package/dist/adapter/downstream/eventToSdkMessage.js +157 -20
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
- package/dist/adapter/downstream/terminalToSdkResult.js +219 -39
- package/dist/adapter/downstream/wiringManifestView.d.ts +3 -1
- package/dist/adapter/downstream/wiringManifestView.js +1 -0
- package/dist/adapter/runStream.d.ts +4 -4
- package/dist/adapter/runStream.js +184 -42
- package/dist/adapter/types.d.ts +2 -0
- package/dist/agentsWireCaps.d.ts +9 -7
- package/dist/agentsWireCaps.js +101 -17
- package/dist/approvalDecidedByCapability.js +2 -2
- package/dist/approvalFrameFamilies.d.ts +33 -0
- package/dist/approvalFrameFamilies.js +120 -0
- package/dist/approvalsStreamLiveCapability.js +2 -2
- package/dist/attachmentsWireCaps.js +41 -13
- package/dist/callerCwdCapability.js +2 -2
- package/dist/centerWiringCapability.js +2 -2
- package/dist/clockReading.d.ts +2 -0
- package/dist/clockReading.js +4 -0
- package/dist/cloudConfigWireCaps.d.ts +28 -5
- package/dist/cloudConfigWireCaps.js +334 -103
- package/dist/compactionStatus.d.ts +34 -0
- package/dist/compactionStatus.js +196 -0
- package/dist/coreValuePorts.d.ts +12 -2
- package/dist/coreValuePorts.js +9 -0
- package/dist/decideFailureNote.js +8 -6
- package/dist/decideReceipt.js +2 -2
- package/dist/deviceExecutorManagementCapability.js +2 -2
- package/dist/deviceFlowPolling.js +1 -1
- package/dist/disableSkillsWire.d.ts +1 -1
- package/dist/disableSkillsWire.js +4 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +215 -13
- package/dist/engineAgentPanelStore.d.ts +7 -4
- package/dist/engineCapReader.js +1 -1
- package/dist/engineConfigDrift.js +1 -1
- package/dist/engineErrorCodes.d.ts +23 -6
- package/dist/engineErrorCodes.js +36 -11
- package/dist/engineGenerationConvergence.d.ts +39 -0
- package/dist/engineGenerationConvergence.js +95 -0
- package/dist/engineGenerationPort.d.ts +61 -0
- package/dist/engineGenerationPort.js +144 -0
- package/dist/engineHealthFacts.d.ts +23 -0
- package/dist/engineHealthFacts.js +92 -0
- package/dist/engineIdentity.d.ts +4 -0
- package/dist/engineIdentity.js +11 -0
- package/dist/engineNoticeCodes.d.ts +2 -5
- package/dist/engineRowRef.js +4 -0
- package/dist/engineSessionMessages.js +2 -2
- package/dist/engineToolDirectory.d.ts +3 -0
- package/dist/engineToolDirectory.js +6 -4
- package/dist/engineWireFor.d.ts +99 -0
- package/dist/engineWireFor.js +248 -6
- package/dist/engineWireTarget.d.ts +1 -0
- package/dist/engineWireTarget.js +8 -0
- package/dist/env/uiLanguage.js +1 -1
- package/dist/errorSupplementRoles.d.ts +3 -0
- package/dist/errorSupplementRoles.js +37 -0
- package/dist/eventLeg.d.ts +1 -7
- package/dist/eventLeg.js +7 -8
- package/dist/executionLaneCapability.js +2 -2
- package/dist/fileHistoryCaptureCapability.d.ts +0 -3
- package/dist/fileHistoryCaptureCapability.js +3 -7
- package/dist/finalVerifyWire.d.ts +6 -3
- package/dist/finalVerifyWire.js +6 -23
- package/dist/flagInput.d.ts +4 -0
- package/dist/flagInput.js +24 -0
- package/dist/fleet/fleetLedger.js +5 -2
- package/dist/fleet/fleetProjection.d.ts +1 -0
- package/dist/fleet/fleetProjection.js +15 -2
- package/dist/gateVocabulary.js +3 -0
- package/dist/generated/engineFactTables.d.ts +7 -2
- package/dist/generated/engineFactTables.js +79 -0
- package/dist/generated/engineNoticeTables.js +15 -0
- package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
- package/dist/generated/settingsSchemaActiveTiers.js +14 -0
- package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
- package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
- package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
- package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
- package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
- package/dist/generated/settingsSchemaDefaultModel.js +25 -0
- package/dist/generated/settingsSchemaFns.d.ts +66 -0
- package/dist/generated/settingsSchemaFns.js +38 -0
- package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -0
- package/dist/generated/settingsSchemaMcpRequestEntry.js +156 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
- package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
- package/dist/generated/settingsSchemaSettingsSources.js +58 -0
- package/dist/generated/settingsSchemaTables.d.ts +3 -0
- package/dist/generated/settingsSchemaTables.js +18 -0
- package/dist/generated/settingsSchemaTypes.d.ts +28 -0
- package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlPattern.js +183 -0
- package/dist/headlessPermissionModeWire.d.ts +18 -2
- package/dist/headlessPermissionModeWire.js +30 -19
- package/dist/hitl/allowRuleShadow.js +9 -7
- package/dist/hitl/approvalCardReading.d.ts +3 -0
- package/dist/hitl/approvalCardReading.js +17 -0
- package/dist/hitl/approvalCardReasons.js +2 -2
- package/dist/hitl/approvalCompleteParked.js +1 -1
- package/dist/hitl/approvalDelivery.d.ts +87 -0
- package/dist/hitl/approvalDelivery.js +193 -0
- package/dist/hitl/approvalHolds.d.ts +14 -0
- package/dist/hitl/approvalHolds.js +41 -0
- package/dist/hitl/approvalResolution.d.ts +11 -0
- package/dist/hitl/approvalResolution.js +50 -11
- package/dist/hitl/askClassPair.d.ts +8 -2
- package/dist/hitl/askClassPair.js +31 -4
- package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
- package/dist/hitl/askParkAutoReopenBlock.js +117 -0
- package/dist/hitl/askParkRowRouting.js +4 -1
- package/dist/hitl/attributionLadder.d.ts +62 -0
- package/dist/hitl/attributionLadder.js +138 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
- package/dist/hitl/automaticAnswerVerdict.js +46 -11
- package/dist/hitl/crashConverged.js +2 -2
- package/dist/hitl/decisionConflict.d.ts +6 -2
- package/dist/hitl/decisionConflict.js +24 -9
- package/dist/hitl/decisionLedger.d.ts +55 -0
- package/dist/hitl/decisionLedger.js +156 -0
- package/dist/hitl/decisionRefusal.d.ts +21 -10
- package/dist/hitl/decisionRefusal.js +100 -55
- package/dist/hitl/decisionSend.d.ts +116 -0
- package/dist/hitl/decisionSend.js +563 -0
- package/dist/hitl/frameRouter.d.ts +1 -0
- package/dist/hitl/frameRouter.js +9 -2
- package/dist/hitl/hitlBridge.d.ts +18 -6
- package/dist/hitl/hitlBridge.js +59 -43
- package/dist/hitl/livePendingAsk.js +4 -3
- package/dist/hitl/noAllowCause.js +1 -1
- package/dist/hitl/parkResolver.js +3 -2
- package/dist/hitl/persistedRulesWire.js +1 -0
- package/dist/hitl/planReviewWire.d.ts +4 -0
- package/dist/hitl/planReviewWire.js +104 -106
- package/dist/hitl/resumeRunningCard.d.ts +3 -2
- package/dist/hitl/resumeRunningCard.js +17 -11
- package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
- package/dist/hitl/sessionPolicyDeliverable.js +65 -35
- package/dist/hitl/sessionPolicyWire.d.ts +13 -3
- package/dist/hitl/sessionPolicyWire.js +81 -16
- package/dist/hitl/standingRows.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +9 -10
- package/dist/hitl/toolApprovalWire.js +103 -151
- package/dist/hookMatcherVerdict.d.ts +2 -0
- package/dist/hookMatcherVerdict.js +12 -0
- package/dist/hooksCompactTransition.d.ts +19 -0
- package/dist/hooksCompactTransition.js +41 -0
- package/dist/hooksWireCaps.d.ts +1 -1
- package/dist/hooksWireCaps.js +202 -203
- package/dist/host.d.ts +1 -14
- package/dist/host.js +0 -8
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +1 -1
- package/dist/hostSettingsSource.d.ts +172 -0
- package/dist/hostSettingsSource.js +675 -0
- package/dist/hostTurnSettings.d.ts +114 -19
- package/dist/hostTurnSettings.js +966 -68
- package/dist/httpHookPolicy.d.ts +37 -0
- package/dist/httpHookPolicy.js +176 -0
- package/dist/humanTurn.d.ts +4 -2
- package/dist/humanTurn.js +40 -10
- package/dist/humanTurnRead.js +4 -3
- package/dist/humanTurnSentences.d.ts +10 -0
- package/dist/humanTurnSentences.js +74 -0
- package/dist/i18n/messages.en.d.ts +313 -0
- package/dist/i18n/messages.en.js +326 -13
- package/dist/i18n/messages.zh.js +341 -13
- package/dist/i18n/translate.js +3 -3
- package/dist/index.d.ts +85 -15
- package/dist/index.js +53 -12
- package/dist/inheritEnvCapability.d.ts +4 -1
- package/dist/inheritEnvCapability.js +38 -17
- package/dist/inheritEnvWire.d.ts +2 -1
- package/dist/inheritEnvWire.js +11 -5
- package/dist/injectionLaneNotice.d.ts +5 -0
- package/dist/injectionLaneNotice.js +46 -0
- package/dist/interactiveToolsWire.d.ts +4 -2
- package/dist/interactiveToolsWire.js +5 -5
- package/dist/jsonFaithful.d.ts +20 -0
- package/dist/jsonFaithful.js +152 -0
- package/dist/limitsWire.d.ts +7 -2
- package/dist/limitsWire.js +19 -13
- package/dist/liveInitToolFace.d.ts +6 -1
- package/dist/liveInitToolFace.js +5 -3
- package/dist/liveModelCatalog.d.ts +22 -0
- package/dist/liveModelCatalog.js +132 -18
- package/dist/mcpPanel.js +3 -1
- package/dist/mcpProbeCapability.js +2 -2
- package/dist/mcpReconnect.js +2 -2
- package/dist/mcpStatusSupersetKeys.d.ts +24 -0
- package/dist/mcpStatusSupersetKeys.js +45 -0
- package/dist/mcpToolToggles.d.ts +6 -0
- package/dist/mcpToolToggles.js +47 -0
- package/dist/mcpWireCaps.d.ts +48 -4
- package/dist/mcpWireCaps.js +338 -99
- package/dist/mcpWireTransport.d.ts +4 -0
- package/dist/mcpWireTransport.js +18 -0
- package/dist/memoryComplianceCapability.js +2 -2
- package/dist/memoryOriginCapability.js +2 -2
- package/dist/model/catalogDefault.d.ts +24 -0
- package/dist/model/catalogDefault.js +4 -0
- package/dist/model/liveCatalogShape.js +5 -4
- package/dist/model/modelsPolicy.js +4 -3
- package/dist/model/onboardJudgement.d.ts +1 -0
- package/dist/model/onboardJudgement.js +1 -1
- package/dist/model/subagentModelWord.js +2 -2
- package/dist/modelCapabilityProbe.d.ts +2 -1
- package/dist/modelCapabilityProbe.js +16 -15
- package/dist/modelIdentityResolvability.d.ts +12 -1
- package/dist/modelIdentityResolvability.js +69 -28
- package/dist/modsKernelIdentity.d.ts +10 -0
- package/dist/modsKernelIdentity.js +103 -0
- package/dist/modsKernelTransit.d.ts +8 -0
- package/dist/modsKernelTransit.js +6 -0
- package/dist/notifications.d.ts +30 -12
- package/dist/notifications.js +241 -53
- package/dist/outputStyleSeatCapability.js +2 -2
- package/dist/ownKey.d.ts +37 -0
- package/dist/ownKey.js +238 -2
- package/dist/panelReduce.d.ts +5 -0
- package/dist/panelReduce.js +45 -13
- package/dist/panelStateHolder.d.ts +1 -0
- package/dist/panelStateHolder.js +10 -1
- package/dist/peerFrames.d.ts +1 -1
- package/dist/peerFrames.js +6 -2
- package/dist/peerLaneCapability.js +2 -2
- package/dist/permissionModesCapability.js +4 -4
- package/dist/permissionRuleIssue.d.ts +2 -1
- package/dist/permissionRuleIssue.js +24 -21
- package/dist/permissionRulesWriteCapability.js +2 -2
- package/dist/permissionsAllowGrantCapability.js +2 -2
- package/dist/permissionsDeclaration.d.ts +43 -4
- package/dist/permissionsDeclaration.js +102 -35
- package/dist/pluginHooksWire.d.ts +20 -4
- package/dist/pluginHooksWire.js +101 -60
- package/dist/prepareRefusal.d.ts +9 -0
- package/dist/prepareRefusal.js +90 -0
- package/dist/printInitToolFace.js +2 -2
- package/dist/printModelStatus.js +1 -1
- package/dist/projectMemory.d.ts +32 -0
- package/dist/projectMemory.js +70 -0
- package/dist/promptBlockedCopy.d.ts +2 -1
- package/dist/promptBlockedCopy.js +2 -1
- package/dist/promptDelivery.d.ts +23 -3
- package/dist/promptDelivery.js +169 -30
- package/dist/providerRejection.d.ts +19 -1
- package/dist/providerRejection.js +75 -4
- package/dist/queuedDelivery.d.ts +48 -0
- package/dist/queuedDelivery.js +233 -0
- package/dist/reattachWindow.d.ts +94 -0
- package/dist/reattachWindow.js +127 -0
- package/dist/request/printNotification.d.ts +1 -1
- package/dist/request/printNotification.js +5 -1
- package/dist/request/submissionIdentity.d.ts +37 -0
- package/dist/request/submissionIdentity.js +65 -0
- package/dist/request/taskRequest.d.ts +22 -14
- package/dist/request/taskRequest.js +312 -202
- package/dist/resultFrameKeys.d.ts +1 -0
- package/dist/resultFrameKeys.js +4 -1
- package/dist/resumeRefusalCopy.d.ts +3 -1
- package/dist/resumeRefusalCopy.js +22 -4
- package/dist/retryStatus.d.ts +26 -0
- package/dist/retryStatus.js +133 -28
- package/dist/rewindArchiveCapability.js +2 -2
- package/dist/rewindEngineAction.d.ts +2 -0
- package/dist/rewindEngineAction.js +23 -1
- package/dist/rowKind.d.ts +36 -0
- package/dist/rowKind.js +97 -0
- package/dist/ruleCompileVerdict.d.ts +18 -0
- package/dist/ruleCompileVerdict.js +67 -2
- package/dist/ruleReadings.d.ts +58 -0
- package/dist/ruleReadings.js +132 -0
- package/dist/ruleRefusalSentence.d.ts +8 -0
- package/dist/ruleRefusalSentence.js +64 -0
- package/dist/runCancelContext.d.ts +0 -1
- package/dist/runCancelContext.js +1 -2
- package/dist/runTerminal.d.ts +5 -0
- package/dist/runTerminal.js +52 -17
- package/dist/sandboxWire.d.ts +3 -2
- package/dist/sandboxWire.js +59 -27
- package/dist/scenarioRefusal.d.ts +2 -1
- package/dist/scenarioRefusal.js +6 -6
- package/dist/scenarioSkills.d.ts +20 -0
- package/dist/scenarioSkills.js +72 -0
- package/dist/scenarioWire.d.ts +5 -2
- package/dist/scenarioWire.js +9 -9
- package/dist/sealedKeyCapability.js +2 -2
- package/dist/seam.d.ts +26 -9
- package/dist/seam.js +44 -4
- package/dist/seatContract.d.ts +62 -9
- package/dist/seatContract.js +70 -25
- package/dist/selfOrchestrationDenial.js +1 -1
- package/dist/sessionPolicyCapability.js +2 -2
- package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
- package/dist/sessionRulesChildrenReadLive.js +5 -0
- package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
- package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
- package/dist/sessionSyncFileHistoryCapability.js +2 -2
- package/dist/settingsCredentialKeyPaths.d.ts +8 -0
- package/dist/settingsCredentialKeyPaths.js +274 -0
- package/dist/settingsHooksSalvage.d.ts +1 -0
- package/dist/settingsHooksSalvage.js +7 -1
- package/dist/settingsLayerAdmission.d.ts +4 -0
- package/dist/settingsLayerAdmission.js +16 -0
- package/dist/skillToolListsCapability.js +6 -5
- package/dist/skillsWireCaps.d.ts +14 -3
- package/dist/skillsWireCaps.js +48 -18
- package/dist/slashCommandGate.d.ts +24 -0
- package/dist/slashCommandGate.js +74 -0
- package/dist/slashCommandTable.d.ts +14 -0
- package/dist/slashCommandTable.js +99 -0
- package/dist/sqlEngineCapability.js +2 -2
- package/dist/steerPriorityCapability.js +2 -2
- package/dist/storePostureCapability.js +2 -2
- package/dist/subagent/agentStateDetail.js +1 -1
- package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
- package/dist/subagent/engineDelegatedPrompt.js +38 -7
- package/dist/subagent/engineRowStopGate.js +2 -2
- package/dist/subagent/engineSubagentResume.js +3 -3
- package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
- package/dist/subagent/engineTaskHandleWire.js +10 -0
- package/dist/subagentContentStore.d.ts +1 -0
- package/dist/subagentContentStore.js +135 -27
- package/dist/submitFailure.d.ts +8 -0
- package/dist/submitFailure.js +17 -0
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +7 -0
- package/dist/terminationIntent.d.ts +55 -0
- package/dist/terminationIntent.js +352 -0
- package/dist/toolHistoryMismatch.d.ts +8 -0
- package/dist/toolHistoryMismatch.js +37 -6
- package/dist/toolResult.d.ts +13 -3
- package/dist/toolResult.js +158 -9
- package/dist/toolResultContent.d.ts +13 -0
- package/dist/toolResultContent.js +82 -7
- package/dist/toolRoster.d.ts +18 -0
- package/dist/toolRoster.js +64 -0
- package/dist/toolsFlagNames.d.ts +8 -0
- package/dist/toolsFlagNames.js +110 -0
- package/dist/turnFailurePresentation.js +41 -96
- package/dist/usageLimitAutoResume.d.ts +74 -0
- package/dist/usageLimitAutoResume.js +227 -0
- package/dist/userAttachmentEnvelope.js +1 -1
- package/dist/userAttachmentSeat.js +5 -5
- package/dist/userInvokedSkillsCapability.js +2 -2
- package/dist/webSearchBackendCapability.js +2 -2
- package/dist/wireErrorTriage.js +99 -50
- package/dist/wireFailureShape.d.ts +25 -1
- package/dist/wireFailureShape.js +92 -5
- package/dist/wireRefusalCopy.d.ts +75 -18
- package/dist/wireRefusalCopy.js +532 -148
- package/dist/wiringFleetDoctor.d.ts +3 -0
- package/dist/wiringFleetDoctor.js +21 -0
- package/dist/workflow.d.ts +2 -1
- package/dist/workflow.js +38 -1
- package/dist/workflowClient.d.ts +2 -7
- package/dist/workflowsJournalCapability.js +2 -2
- package/dist/writeProtectionCapability.js +2 -2
- package/docs/INTEGRATION-CLIENTS.md +1013 -190
- package/package.json +15 -4
package/dist/mcpWireCaps.js
CHANGED
|
@@ -1,87 +1,177 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
+
import { snapshotArgs, wireTransportOf } from './mcpWireTransport.js';
|
|
3
|
+
import { appendOwnElement, guardedRead } from './ownKey.js';
|
|
4
|
+
import { readMcpToolAxes, readToolFaces } from './coreValuePorts.js';
|
|
3
5
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
4
6
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
5
7
|
const _mcpServerSpecPin = true;
|
|
6
8
|
void _mcpServerSpecPin;
|
|
7
|
-
|
|
8
|
-
function transparentKeys(c, axes, elicitation) {
|
|
9
|
+
function transparentKeys(startupTimeoutMs, axes, faces, elicitation) {
|
|
9
10
|
return {
|
|
10
|
-
...(
|
|
11
|
+
...(faces !== undefined ? { toolFaces: faces } : {}),
|
|
11
12
|
...(axes !== undefined ? { toolAxes: axes } : {}),
|
|
12
13
|
...(elicitation !== undefined ? { elicitation } : {}),
|
|
14
|
+
...(startupTimeoutMs !== undefined ? { startupTimeoutMs } : {}),
|
|
13
15
|
};
|
|
14
16
|
}
|
|
15
|
-
function presentHeaderName(v) {
|
|
16
|
-
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
17
|
-
}
|
|
18
17
|
export function readMcpHttpIdentityHeaders(transport) {
|
|
19
18
|
const t = transport;
|
|
20
|
-
const principalHeader =
|
|
21
|
-
const assertionHeader =
|
|
19
|
+
const principalHeader = t.principalHeader;
|
|
20
|
+
const assertionHeader = t.assertionHeader;
|
|
22
21
|
if (principalHeader !== undefined && assertionHeader !== undefined)
|
|
23
22
|
return { kind: 'both_set' };
|
|
24
|
-
return {
|
|
25
|
-
kind: 'ok',
|
|
26
|
-
...(principalHeader !== undefined ? { principalHeader } : {}),
|
|
27
|
-
...(assertionHeader !== undefined ? { assertionHeader } : {}),
|
|
28
|
-
};
|
|
23
|
+
return { kind: 'ok', ...SETTINGS_READ_MCP_IDENTITY_HEADERS({ principalHeader, assertionHeader }) };
|
|
29
24
|
}
|
|
30
25
|
export function mcpConfigToSpec(name, c) {
|
|
31
26
|
return mcpConfigEntry(name, c).spec;
|
|
32
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
|
+
}
|
|
33
45
|
function mcpConfigEntry(name, c) {
|
|
34
|
-
if (
|
|
46
|
+
if (!nameUsable(name))
|
|
35
47
|
return { spec: null };
|
|
36
|
-
const
|
|
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;
|
|
37
65
|
const verdict = mcpToolAxesVerdict(declared);
|
|
38
|
-
|
|
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;
|
|
39
78
|
const elVerdict = mcpElicitationVerdict(elDeclared);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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);
|
|
82
|
+
if (rest.kind === 'skip')
|
|
43
83
|
return { spec: null };
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
if (rest.kind === 'both_set')
|
|
85
|
+
return { spec: null, identityBothSet: true };
|
|
86
|
+
if (rest.kind === 'bad')
|
|
87
|
+
return { spec: null, transportBad: rest.issue };
|
|
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 };
|
|
95
|
+
}
|
|
96
|
+
const read = specOf(name, c, own, verdict.kind === 'ok' ? verdict.toolAxes : declared, facesVerdict.kind === 'ok' ? facesVerdict.toolFaces : facesDeclared, elVerdict.elicitation, allowVerdict.allowTools);
|
|
97
|
+
if (read.kind === 'skip')
|
|
98
|
+
return { spec: null };
|
|
99
|
+
if (read.kind === 'both_set')
|
|
100
|
+
return { spec: null, identityBothSet: true };
|
|
101
|
+
if (read.kind === 'bad')
|
|
102
|
+
return { spec: null, transportBad: read.issue };
|
|
103
|
+
return { spec: read.spec, ...(read.lost.length > 0 ? { transportLost: read.lost } : {}) };
|
|
104
|
+
}
|
|
105
|
+
function transportOf(c) {
|
|
106
|
+
let candidate;
|
|
107
|
+
try {
|
|
108
|
+
const kind = c.type ?? 'stdio';
|
|
109
|
+
if (kind === 'stdio') {
|
|
110
|
+
const command = c.command;
|
|
111
|
+
const head = SETTINGS_READ_REQUEST_MCP_TRANSPORT({ kind: 'stdio', command });
|
|
112
|
+
if (!head.ok)
|
|
113
|
+
return { kind: 'bad', issue: head.issue };
|
|
114
|
+
candidate = { kind: 'stdio', command, args: snapshotArgs(c.args), env: c.env };
|
|
115
|
+
}
|
|
116
|
+
else if (kind === 'http') {
|
|
117
|
+
const url = c.url;
|
|
118
|
+
const head = SETTINGS_READ_REQUEST_MCP_TRANSPORT({ kind: 'http', url });
|
|
119
|
+
if (!head.ok)
|
|
120
|
+
return { kind: 'bad', issue: head.issue };
|
|
121
|
+
const principalHeader = c.principalHeader;
|
|
122
|
+
const assertionHeader = c.assertionHeader;
|
|
123
|
+
if (readMcpHttpIdentityHeaders({ principalHeader, assertionHeader }).kind === 'both_set')
|
|
124
|
+
return { kind: 'both_set' };
|
|
125
|
+
candidate = { kind: 'http', url, headers: c.headers, principalHeader, assertionHeader };
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
return { kind: 'skip' };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return transportUnreadableRead();
|
|
133
|
+
}
|
|
134
|
+
let read;
|
|
135
|
+
try {
|
|
136
|
+
read = SETTINGS_READ_REQUEST_MCP_TRANSPORT(candidate);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return transportUnreadableRead();
|
|
140
|
+
}
|
|
141
|
+
if (!read.ok)
|
|
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;
|
|
152
|
+
const spec = {
|
|
153
|
+
name,
|
|
154
|
+
transport: t.transport,
|
|
155
|
+
...(allowTools !== undefined ? { allowTools } : {}),
|
|
156
|
+
...transparentKeys(own.startupTimeoutMs, axes, faces, elicitation),
|
|
157
|
+
};
|
|
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 });
|
|
85
175
|
}
|
|
86
176
|
export function mcpConfigsToSpecs(servers) {
|
|
87
177
|
return projectMcpConfigs(servers).specs;
|
|
@@ -102,23 +192,121 @@ export function mcpToolAxesVerdict(declared) {
|
|
|
102
192
|
}
|
|
103
193
|
return Object.freeze({ kind: 'unavailable' });
|
|
104
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
|
+
}
|
|
105
211
|
export function mcpElicitationVerdict(declared) {
|
|
106
212
|
if (declared === undefined)
|
|
107
213
|
return Object.freeze({ kind: 'ok' });
|
|
108
214
|
return typeof declared === 'boolean' ? Object.freeze({ kind: 'ok', elicitation: declared }) : Object.freeze({ kind: 'bad' });
|
|
109
215
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
+
}
|
|
255
|
+
const nameUsable = (name) => SETTINGS_IS_USABLE_WIRE_NAME(name);
|
|
256
|
+
function mcpNameDropReasonOf(name) {
|
|
257
|
+
if (typeof name !== 'string' || name.trim().length === 0)
|
|
115
258
|
return 'name_blank';
|
|
116
|
-
return
|
|
259
|
+
return name.trim() !== name ? 'name_edge_whitespace' : 'name_too_long';
|
|
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));
|
|
117
303
|
}
|
|
118
304
|
const DROP_NAME_SHOWN = 80;
|
|
119
305
|
const DROP_LABEL_SHOWN = 140;
|
|
120
306
|
const DROP_PROBLEM_SHOWN = 300;
|
|
121
|
-
|
|
307
|
+
const DROP_BAD_NAME_SHOWN = 160;
|
|
308
|
+
const DEGRADED_LOST_SHOWN = 400;
|
|
309
|
+
function dropNotice(name, reason, problem, opts, path) {
|
|
122
310
|
let label;
|
|
123
311
|
try {
|
|
124
312
|
label = opts?.sourceLabel?.(name);
|
|
@@ -128,52 +316,103 @@ function dropNotice(name, reason, problem, opts) {
|
|
|
128
316
|
}
|
|
129
317
|
const where = typeof label === 'string' && label.length > 0 ? ` (${capForDisplay(label, DROP_LABEL_SHOWN)})` : '';
|
|
130
318
|
const quoted = `"${capForDisplay(name, DROP_NAME_SHOWN)}"`;
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
:
|
|
134
|
-
|
|
135
|
-
:
|
|
136
|
-
|
|
137
|
-
:
|
|
138
|
-
|
|
139
|
-
|
|
319
|
+
const badName = () => capForDisplay(SETTINGS_DESCRIBE_BAD_WIRE_NAME(name), DROP_BAD_NAME_SHOWN);
|
|
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 });
|
|
140
343
|
return renderMessage(ref, opts?.lang);
|
|
141
344
|
}
|
|
345
|
+
function degradedNotice(name, lost, opts) {
|
|
346
|
+
let label;
|
|
347
|
+
try {
|
|
348
|
+
label = opts?.sourceLabel?.(name);
|
|
349
|
+
}
|
|
350
|
+
catch {
|
|
351
|
+
label = undefined;
|
|
352
|
+
}
|
|
353
|
+
const where = typeof label === 'string' && label.length > 0 ? ` (${capForDisplay(label, DROP_LABEL_SHOWN)})` : '';
|
|
354
|
+
const quoted = `"${capForDisplay(name, DROP_NAME_SHOWN)}"`;
|
|
355
|
+
const what = capForDisplay(lost.map((l) => `${l.path}: ${l.reason}`).join('; '), DEGRADED_LOST_SHOWN);
|
|
356
|
+
return renderMessage(msg('config.mcp.transportDegraded', { name: quoted, where, lost: what }), opts?.lang);
|
|
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
|
+
}
|
|
142
369
|
export function projectMcpConfigs(servers, opts) {
|
|
143
370
|
const specs = [];
|
|
144
371
|
const dropped = [];
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
for (const [name] of entries) {
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
else if (flaw === 'name_edge_whitespace')
|
|
153
|
-
trimmedCount.set(name.trim(), (trimmedCount.get(name.trim()) ?? 0) + 1);
|
|
154
|
-
}
|
|
155
|
-
for (const [name, c] of entries) {
|
|
156
|
-
if (specs.length >= MCP_CAPS.items)
|
|
157
|
-
break;
|
|
158
|
-
const flaw = mcpNameFlaw(name);
|
|
159
|
-
if (flaw !== undefined) {
|
|
160
|
-
const reason = flaw === 'name_edge_whitespace' && (exactNames.has(name.trim()) || (trimmedCount.get(name.trim()) ?? 0) > 1) ? 'name_collides_after_trim' : flaw;
|
|
161
|
-
dropped.push({ name, reason, notice: dropNotice(name, reason, undefined, opts) });
|
|
372
|
+
const degraded = [];
|
|
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) });
|
|
162
379
|
continue;
|
|
163
380
|
}
|
|
164
|
-
const out = mcpConfigEntry(name, c);
|
|
381
|
+
const out = slotUnreadable ? { spec: null, entryUnreadable: true } : mcpConfigEntry(name, c);
|
|
165
382
|
if (out.spec !== null) {
|
|
166
383
|
specs.push(out.spec);
|
|
384
|
+
if (out.transportLost !== undefined)
|
|
385
|
+
degraded.push({ name, lost: Object.freeze([...out.transportLost]), notice: degradedNotice(name, out.transportLost, opts) });
|
|
167
386
|
continue;
|
|
168
387
|
}
|
|
169
|
-
if (out.
|
|
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) {
|
|
395
|
+
dropped.push({ name, reason: 'identity_headers_both_set', notice: dropNotice(name, 'identity_headers_both_set', undefined, opts) });
|
|
396
|
+
}
|
|
397
|
+
else if (out.transportBad !== undefined) {
|
|
398
|
+
const { path, reason: problem } = out.transportBad;
|
|
399
|
+
dropped.push({ name, reason: 'transport_invalid', problem, path, notice: dropNotice(name, 'transport_invalid', problem, opts, path) });
|
|
400
|
+
}
|
|
401
|
+
else if (out.axesProblem !== undefined) {
|
|
170
402
|
dropped.push({ name, reason: 'tool_axes_invalid', problem: out.axesProblem, notice: dropNotice(name, 'tool_axes_invalid', out.axesProblem, opts) });
|
|
171
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
|
+
}
|
|
172
407
|
else if (out.elicitationInvalid === true) {
|
|
173
408
|
dropped.push({ name, reason: 'elicitation_invalid', notice: dropNotice(name, 'elicitation_invalid', undefined, opts) });
|
|
174
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
|
+
}
|
|
175
414
|
}
|
|
176
|
-
return { specs, dropped: Object.freeze(dropped) };
|
|
415
|
+
return { specs, dropped: Object.freeze(dropped), degraded: Object.freeze(degraded) };
|
|
177
416
|
}
|
|
178
417
|
function assertionDeclaringServerName(spec) {
|
|
179
418
|
const t = spec?.transport;
|
|
@@ -197,6 +436,6 @@ export function mcpAssertionHeaderNotSentNotice(specs) {
|
|
|
197
436
|
const parts = distinct.slice(0, ASSERTION_NOTICE_NAMES_SHOWN).map((x) => `"${x}"`);
|
|
198
437
|
if (distinct.length > ASSERTION_NOTICE_NAMES_SHOWN)
|
|
199
438
|
parts.push(`+${distinct.length - ASSERTION_NOTICE_NAMES_SHOWN} more`);
|
|
200
|
-
return (`MCP servers that declare an assertion header (assertionHeader): ${parts.join(', ')} — server versions up to 7.
|
|
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, ` +
|
|
201
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');
|
|
202
441
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServerSpec } from '@sema-agent/sdk';
|
|
2
|
+
import type { RequestMcpTransport } from './generated/settingsSchemaTypes.js';
|
|
3
|
+
export declare function snapshotArgs(v: {} | null | undefined): {} | null | undefined;
|
|
4
|
+
export declare function wireTransportOf(t: RequestMcpTransport): McpServerSpec['transport'];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const ARGS_SNAPSHOT_MAX = 65_536;
|
|
2
|
+
export function snapshotArgs(v) {
|
|
3
|
+
if (!Array.isArray(v))
|
|
4
|
+
return v;
|
|
5
|
+
const n = v.length;
|
|
6
|
+
if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0 || n > ARGS_SNAPSHOT_MAX)
|
|
7
|
+
return {};
|
|
8
|
+
const out = [];
|
|
9
|
+
for (let i = 0; i < n; i++)
|
|
10
|
+
out.push(v[i]);
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
export function wireTransportOf(t) {
|
|
14
|
+
if (t.kind === 'stdio') {
|
|
15
|
+
return { kind: 'stdio', command: t.command, ...(t.args !== undefined && t.args.length > 0 ? { args: t.args } : {}), ...(t.env !== undefined ? { env: t.env } : {}) };
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 =
|
|
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 {
|
|
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 =
|
|
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;
|
|
@@ -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
|
|
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'
|
|
24
|
+
if (d === undefined || !Object.hasOwn(d, 'value'))
|
|
24
25
|
throw new Unreadable();
|
|
25
|
-
out.
|
|
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'
|
|
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'
|
|
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'
|
|
28
|
+
if (d === undefined || !Object.hasOwn(d, 'value') || typeof d.value !== 'string' || d.value.length === 0)
|
|
28
29
|
return undefined;
|
|
29
|
-
out
|
|
30
|
+
appendOwnElement(out, d.value);
|
|
30
31
|
}
|
|
31
32
|
return { mode: 'only', models: out };
|
|
32
33
|
}
|