@sema-agent/client-core 0.97.1 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +607 -0
- package/README.md +96 -46
- package/dist/adapt/arms.d.ts +1 -0
- package/dist/adapt/arms.js +188 -53
- package/dist/adapt/ids.d.ts +12 -1
- package/dist/adapt/ids.js +59 -8
- package/dist/adapt/instanceLedger.d.ts +50 -0
- package/dist/adapt/instanceLedger.js +147 -0
- package/dist/adapt/panelTasks.d.ts +1 -1
- package/dist/adapt/panelTasks.js +2 -2
- package/dist/adapt/textStream.d.ts +1 -0
- package/dist/adapt/textStream.js +24 -7
- package/dist/adapt/toolCards.d.ts +27 -5
- package/dist/adapt/toolCards.js +39 -6
- package/dist/adapt/wireShapes.js +6 -2
- package/dist/adapt.d.ts +2 -0
- package/dist/adapt.js +8 -3
- package/dist/adapter/activeRunSelfHeal.d.ts +9 -3
- package/dist/adapter/activeRunSelfHeal.js +205 -313
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +77 -36
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
- package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
- package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
- package/dist/adapter/runStream.js +79 -48
- package/dist/adapter/types.d.ts +4 -4
- package/dist/adapter/types.js +2 -1
- package/dist/agentSession/backgroundView.js +2 -1
- package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
- package/dist/agentSession/engineAgentRegistryRead.js +12 -13
- package/dist/agentSession/engineSessionBackgroundStop.js +16 -8
- package/dist/agentsWireCaps.d.ts +8 -11
- package/dist/agentsWireCaps.js +196 -194
- package/dist/approvalDecidedByCapability.d.ts +0 -4
- package/dist/approvalDecidedByCapability.js +0 -6
- package/dist/approvalsStreamLiveCapability.d.ts +0 -4
- package/dist/approvalsStreamLiveCapability.js +0 -6
- package/dist/assistantInbox.d.ts +34 -0
- package/dist/assistantInbox.js +118 -0
- package/dist/centerWiringCapability.js +9 -1
- package/dist/clientSlice.d.ts +0 -9
- package/dist/clientSlice.js +0 -3
- package/dist/cloudConfigWireCaps.d.ts +5 -3
- package/dist/cloudConfigWireCaps.js +106 -64
- package/dist/compensations.js +1 -1
- package/dist/connectorStatus.d.ts +21 -0
- package/dist/connectorStatus.js +112 -0
- package/dist/controlRouter.d.ts +18 -3
- package/dist/controlRouter.js +106 -67
- package/dist/coreValuePorts.d.ts +29 -4
- package/dist/coreValuePorts.js +10 -0
- package/dist/corruptSessionCopy.d.ts +2 -1
- package/dist/corruptSessionCopy.js +3 -3
- package/dist/decideReceipt.d.ts +2 -2
- package/dist/decideReceipt.js +5 -2
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/detachWire.js +3 -2
- package/dist/deviceExecutorManagementCapability.d.ts +0 -4
- package/dist/deviceExecutorManagementCapability.js +0 -6
- package/dist/deviceRebind.d.ts +49 -1
- package/dist/deviceRebind.js +221 -3
- package/dist/devicesFace.d.ts +34 -0
- package/dist/devicesFace.js +90 -0
- package/dist/displayUntrusted.d.ts +2 -0
- package/dist/displayUntrusted.js +253 -76
- package/dist/engineAgentAbsence.d.ts +1 -1
- package/dist/engineAgentPanelStore.d.ts +12 -4
- package/dist/engineAgentPanelStore.js +16 -11
- package/dist/engineCapReader.d.ts +2 -5
- package/dist/engineCapReader.js +8 -10
- package/dist/engineCapsCache.d.ts +12 -0
- package/dist/engineCapsCache.js +76 -18
- package/dist/engineCapsChange.d.ts +2 -0
- package/dist/engineCapsChange.js +9 -0
- package/dist/engineClosedSets.d.ts +1 -0
- package/dist/engineClosedSets.js +4 -1
- package/dist/engineErrorCodes.d.ts +11 -3
- package/dist/engineErrorCodes.js +11 -8
- package/dist/engineIdentity.d.ts +1 -0
- package/dist/engineIdentity.js +8 -0
- package/dist/engineRowRef.d.ts +28 -0
- package/dist/engineRowRef.js +114 -0
- package/dist/engineSessionMessages.d.ts +68 -0
- package/dist/engineSessionMessages.js +370 -0
- package/dist/engineTargetSeat.d.ts +27 -0
- package/dist/engineTargetSeat.js +199 -0
- package/dist/engineToolDirectory.d.ts +0 -9
- package/dist/engineToolDirectory.js +1 -94
- package/dist/engineUrl.d.ts +18 -0
- package/dist/engineUrl.js +52 -0
- package/dist/engineWireFor.js +3 -8
- package/dist/env/uiLanguage.d.ts +11 -1
- package/dist/env/uiLanguage.js +38 -2
- package/dist/eventLeg.d.ts +100 -0
- package/dist/eventLeg.js +305 -0
- package/dist/executionLaneCapability.d.ts +0 -4
- package/dist/executionLaneCapability.js +3 -16
- package/dist/fileHistoryCaptureCapability.d.ts +2 -5
- package/dist/fileHistoryCaptureCapability.js +13 -21
- package/dist/fileHistoryLegNotice.d.ts +2 -1
- package/dist/fileHistoryLegNotice.js +3 -3
- package/dist/fleet/fleetLedger.d.ts +0 -3
- package/dist/fleet/fleetLedger.js +21 -36
- package/dist/fleet/fleetProjection.d.ts +2 -2
- package/dist/fleet/fleetProjection.js +10 -8
- package/dist/frameBinding.d.ts +8 -0
- package/dist/frameBinding.js +35 -0
- package/dist/gateFailureCodes.d.ts +2 -0
- package/dist/gateFailureCodes.js +15 -0
- package/dist/gateOutcome.d.ts +3 -1
- package/dist/gateOutcome.js +41 -8
- package/dist/gateVocabulary.d.ts +10 -4
- package/dist/gateVocabulary.js +107 -47
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +22 -3
- package/dist/generated/engineFactTables.js +51 -4
- package/dist/generated/engineNoticeTables.js +18 -3
- package/dist/generated/settingsSchemaFns.d.ts +6 -0
- package/dist/generated/settingsSchemaFns.js +57 -0
- package/dist/generated/settingsSchemaHooksClassifier.d.ts +2 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +254 -0
- package/dist/generated/settingsSchemaTables.d.ts +1 -0
- package/dist/generated/settingsSchemaTables.js +4 -0
- package/dist/generated/settingsSchemaTypes.d.ts +105 -0
- package/dist/generated/settingsSchemaTypes.js +1 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +8 -2
- package/dist/hitl/allowRuleShadow.js +36 -29
- package/dist/hitl/approvalCardReading.d.ts +15 -0
- package/dist/hitl/approvalCardReading.js +154 -0
- package/dist/hitl/approvalCardReasons.d.ts +14 -0
- package/dist/hitl/approvalCardReasons.js +119 -0
- package/dist/hitl/approvalHolds.d.ts +50 -15
- package/dist/hitl/approvalHolds.js +177 -27
- package/dist/hitl/approvalResolution.d.ts +51 -26
- package/dist/hitl/approvalResolution.js +86 -122
- package/dist/hitl/approvalsFeed.js +6 -18
- package/dist/hitl/askClassPair.d.ts +2 -0
- package/dist/hitl/askClassPair.js +17 -0
- package/dist/hitl/askGateWire.d.ts +20 -2
- package/dist/hitl/askGateWire.js +50 -1
- package/dist/hitl/askParkRowRouting.d.ts +5 -0
- package/dist/hitl/askParkRowRouting.js +32 -1
- package/dist/hitl/askSettlementLine.d.ts +28 -0
- package/dist/hitl/askSettlementLine.js +99 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +3 -2
- package/dist/hitl/automaticAnswerVerdict.js +29 -13
- package/dist/hitl/crashConverged.d.ts +11 -20
- package/dist/hitl/crashConverged.js +56 -0
- package/dist/hitl/crashConvergedNotice.d.ts +6 -3
- package/dist/hitl/crashConvergedNotice.js +48 -24
- package/dist/hitl/decisionConflict.js +3 -10
- package/dist/hitl/decisionRefusal.d.ts +40 -1
- package/dist/hitl/decisionRefusal.js +199 -42
- package/dist/hitl/frameRouter.d.ts +5 -2
- package/dist/hitl/frameRouter.js +27 -24
- package/dist/hitl/gateLedger.d.ts +2 -0
- package/dist/hitl/gateLedger.js +50 -13
- package/dist/hitl/hitlBridge.d.ts +2 -2
- package/dist/hitl/hitlBridge.js +13 -10
- package/dist/hitl/livePendingAsk.d.ts +3 -3
- package/dist/hitl/livePendingAsk.js +7 -18
- package/dist/hitl/parkResolver.d.ts +2 -24
- package/dist/hitl/parkResolver.js +61 -97
- package/dist/hitl/persistedRulesWire.d.ts +25 -0
- package/dist/hitl/persistedRulesWire.js +104 -2
- package/dist/hitl/planReviewWire.d.ts +31 -13
- package/dist/hitl/planReviewWire.js +120 -78
- package/dist/hitl/refusedToolNameProse.d.ts +0 -1
- package/dist/hitl/refusedToolNameProse.js +0 -3
- package/dist/hitl/replayedApproval.d.ts +4 -3
- package/dist/hitl/replayedApproval.js +7 -4
- package/dist/hitl/sessionPolicyDeliverable.d.ts +2 -0
- package/dist/hitl/sessionPolicyDeliverable.js +48 -7
- package/dist/hitl/sessionPolicyWire.d.ts +34 -21
- package/dist/hitl/sessionPolicyWire.js +179 -70
- package/dist/hitl/standingRows.d.ts +20 -2
- package/dist/hitl/standingRows.js +69 -8
- package/dist/hitl/suspendedReopen.d.ts +2 -1
- package/dist/hitl/suspendedReopen.js +7 -10
- package/dist/hitl/toolApprovalWire.d.ts +103 -156
- package/dist/hitl/toolApprovalWire.js +661 -411
- package/dist/hookMatcherVerdict.d.ts +6 -1
- package/dist/hookMatcherVerdict.js +14 -7
- package/dist/hooksWireCaps.d.ts +2 -2
- package/dist/hooksWireCaps.js +174 -81
- package/dist/host.d.ts +21 -0
- package/dist/hostTurnSettings.d.ts +71 -0
- package/dist/hostTurnSettings.js +291 -0
- package/dist/humanTurn.d.ts +14 -1
- package/dist/humanTurn.js +100 -12
- package/dist/humanTurnRead.d.ts +2 -0
- package/dist/humanTurnRead.js +22 -1
- package/dist/i18n/messages.en.d.ts +703 -0
- package/dist/i18n/messages.en.js +701 -0
- package/dist/i18n/messages.zh.d.ts +3 -0
- package/dist/i18n/messages.zh.js +837 -0
- package/dist/i18n/translate.d.ts +25 -0
- package/dist/i18n/translate.js +127 -0
- package/dist/index.d.ts +78 -29
- package/dist/index.js +54 -18
- package/dist/inheritEnvCapability.d.ts +32 -0
- package/dist/inheritEnvCapability.js +104 -0
- package/dist/inheritEnvWire.d.ts +3 -2
- package/dist/inheritEnvWire.js +12 -14
- package/dist/interactiveHalt.js +17 -6
- package/dist/liveModelCatalog.d.ts +3 -3
- package/dist/liveModelCatalog.js +15 -13
- package/dist/liveQuestionStore.d.ts +2 -21
- package/dist/mcpLiveness.d.ts +2 -1
- package/dist/mcpPanel.d.ts +10 -1
- package/dist/mcpPanel.js +40 -13
- package/dist/mcpProbeCapability.d.ts +2 -1
- package/dist/mcpProbeCapability.js +7 -11
- package/dist/mcpProbeWire.d.ts +9 -2
- package/dist/mcpProbeWire.js +6 -1
- package/dist/mcpWireCaps.d.ts +47 -2
- package/dist/mcpWireCaps.js +164 -16
- package/dist/memoryEntriesWire.d.ts +4 -9
- package/dist/memoryEntriesWire.js +5 -10
- package/dist/model/modelSupplyRules.d.ts +0 -2
- package/dist/model/modelSupplyRules.js +3 -12
- package/dist/model/modelsPolicy.d.ts +0 -5
- package/dist/model/modelsPolicy.js +6 -36
- package/dist/model/onboardJudgement.d.ts +93 -0
- package/dist/model/onboardJudgement.js +415 -0
- package/dist/model/subagentModelWord.d.ts +31 -0
- package/dist/model/subagentModelWord.js +261 -0
- package/dist/model/tierVocabulary.d.ts +2 -0
- package/dist/model/tierVocabulary.js +17 -5
- package/dist/modelCapabilityProbe.d.ts +64 -0
- package/dist/modelCapabilityProbe.js +600 -0
- package/dist/modelIdentityResolvability.d.ts +3 -0
- package/dist/modelIdentityResolvability.js +26 -17
- package/dist/notifications.d.ts +6 -0
- package/dist/notifications.js +71 -23
- package/dist/outputStyleSeatCapability.d.ts +0 -3
- package/dist/outputStyleSeatCapability.js +0 -3
- package/dist/ownKey.d.ts +22 -0
- package/dist/ownKey.js +94 -3
- package/dist/panelReduce.d.ts +21 -10
- package/dist/panelReduce.js +728 -550
- package/dist/panelStateHolder.d.ts +3 -7
- package/dist/panelStateHolder.js +14 -130
- package/dist/peerLaneCapability.d.ts +0 -4
- package/dist/peerLaneCapability.js +0 -6
- package/dist/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.d.ts +2 -5
- package/dist/permissionRulesWriteCapability.js +8 -12
- package/dist/permissionWireCaps.d.ts +2 -2
- package/dist/permissionWireCaps.js +2 -0
- package/dist/permissionsAllowGrantCapability.d.ts +0 -4
- package/dist/permissionsAllowGrantCapability.js +0 -6
- package/dist/permissionsDeclaration.d.ts +0 -11
- package/dist/permissionsDeclaration.js +60 -53
- package/dist/pluginHooksWire.d.ts +46 -3
- package/dist/pluginHooksWire.js +219 -16
- package/dist/preemptWire.d.ts +44 -0
- package/dist/preemptWire.js +83 -0
- package/dist/printModelStatus.d.ts +63 -0
- package/dist/printModelStatus.js +155 -0
- package/dist/printToolResultFrame.js +15 -4
- package/dist/replayBody.d.ts +3 -0
- package/dist/replayBody.js +14 -0
- package/dist/request/taskRequest.d.ts +11 -6
- package/dist/request/taskRequest.js +112 -19
- package/dist/resumeRefusalCopy.d.ts +13 -9
- package/dist/resumeRefusalCopy.js +81 -118
- package/dist/retryStatus.d.ts +45 -0
- package/dist/retryStatus.js +185 -1
- package/dist/rewindArchiveCapability.d.ts +0 -4
- package/dist/rewindArchiveCapability.js +2 -10
- package/dist/rewindArchiveReading.d.ts +0 -1
- package/dist/rewindArchiveReading.js +0 -3
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +4 -2
- package/dist/runReattachPolicy.d.ts +31 -0
- package/dist/runReattachPolicy.js +46 -0
- package/dist/runTerminal.d.ts +3 -6
- package/dist/runTerminal.js +8 -9
- package/dist/sandboxWire.d.ts +3 -1
- package/dist/sandboxWire.js +76 -27
- package/dist/scenarioRefusal.d.ts +9 -0
- package/dist/scenarioRefusal.js +111 -0
- package/dist/scenarioWire.js +1 -1
- package/dist/seam.d.ts +48 -2
- package/dist/seam.js +25 -4
- package/dist/seatContract.d.ts +311 -18
- package/dist/seatContract.js +824 -100
- package/dist/selfOrchestrationDenial.js +7 -19
- package/dist/sessionIdSegment.d.ts +6 -0
- package/dist/sessionIdSegment.js +24 -0
- package/dist/sessionMemoryStatus.js +6 -11
- package/dist/sessionPolicyCapability.d.ts +2 -5
- package/dist/sessionPolicyCapability.js +8 -12
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
- package/dist/sessionSyncFileHistoryCapability.js +0 -3
- package/dist/settingsHooksSalvage.d.ts +44 -0
- package/dist/settingsHooksSalvage.js +211 -0
- package/dist/skillToolListsCapability.d.ts +2 -4
- package/dist/skillToolListsCapability.js +8 -9
- package/dist/sqlEngineCapability.d.ts +0 -4
- package/dist/sqlEngineCapability.js +0 -6
- package/dist/sseIdleTriage.js +3 -2
- package/dist/steerPriorityCapability.d.ts +0 -3
- package/dist/steerPriorityCapability.js +0 -3
- package/dist/streamDrainingLegs.d.ts +4 -0
- package/dist/streamDrainingLegs.js +6 -1
- package/dist/subagent/engineCompactWire.d.ts +0 -1
- package/dist/subagent/engineCompactWire.js +7 -5
- package/dist/subagent/engineSubagentResume.js +15 -9
- package/dist/subagent/engineTaskHandleWire.js +4 -7
- package/dist/subagentContentStore.d.ts +3 -0
- package/dist/subagentContentStore.js +22 -10
- package/dist/submitReopen.d.ts +24 -0
- package/dist/submitReopen.js +75 -0
- package/dist/terminalStatuses.d.ts +3 -0
- package/dist/terminalStatuses.js +10 -2
- package/dist/toolHistoryMismatch.js +3 -2
- package/dist/toolResult.d.ts +10 -1
- package/dist/toolResult.js +34 -6
- package/dist/toolRoster.d.ts +3 -4
- package/dist/toolRoster.js +21 -22
- package/dist/turnFailurePresentation.d.ts +39 -0
- package/dist/turnFailurePresentation.js +402 -0
- package/dist/usageAnalytics.js +6 -11
- package/dist/userAttachmentEnvelope.d.ts +1 -0
- package/dist/userAttachmentEnvelope.js +37 -7
- package/dist/userAttachmentSeat.d.ts +21 -0
- package/dist/userAttachmentSeat.js +75 -0
- package/dist/userInvokedSkillsCapability.d.ts +11 -4
- package/dist/userInvokedSkillsCapability.js +31 -10
- package/dist/webSearchBackendCapability.d.ts +0 -4
- package/dist/webSearchBackendCapability.js +0 -6
- package/dist/wireErrorTriage.d.ts +7 -0
- package/dist/wireErrorTriage.js +26 -23
- package/dist/wireFailureShape.d.ts +62 -5
- package/dist/wireFailureShape.js +106 -5
- package/dist/wireRefusalCopy.d.ts +25 -3
- package/dist/wireRefusalCopy.js +74 -80
- package/dist/workflowsJournalCapability.d.ts +2 -5
- package/dist/workflowsJournalCapability.js +8 -12
- package/dist/writeProtectionCapability.d.ts +0 -4
- package/dist/writeProtectionCapability.js +0 -6
- package/docs/INTEGRATION-CLIENTS.md +1775 -56
- package/package.json +6 -5
- package/dist/attachmentSeatCapability.d.ts +0 -12
- package/dist/attachmentSeatCapability.js +0 -23
- package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
- package/dist/hitl/approvalOutcomeNote.js +0 -29
- package/dist/sessionReadRedactionCapability.d.ts +0 -13
- package/dist/sessionReadRedactionCapability.js +0 -35
package/dist/mcpPanel.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AgentClient } from '@sema-agent/sdk';
|
|
2
2
|
import { type WiringManifestMcpEntryView } from './adapter/downstream/eventToSdkMessage.js';
|
|
3
3
|
import { type McpEngineLegHealth } from './mcpLiveness.js';
|
|
4
|
+
import { type ScenarioRefusalReading } from './scenarioRefusal.js';
|
|
4
5
|
export interface McpPanelServerView {
|
|
5
6
|
name: string;
|
|
6
7
|
status: string;
|
|
@@ -16,14 +17,22 @@ export interface McpPanelLastLegView {
|
|
|
16
17
|
at: string;
|
|
17
18
|
mcp: WiringManifestMcpEntryView[];
|
|
18
19
|
}
|
|
19
|
-
export interface
|
|
20
|
+
export interface McpPanelServersView {
|
|
20
21
|
asOf: string;
|
|
22
|
+
lastLegMcp?: McpPanelLastLegView;
|
|
23
|
+
lastLegMcpUnreadable?: true;
|
|
21
24
|
servers: McpPanelServerView[];
|
|
22
25
|
degraded?: true;
|
|
26
|
+
}
|
|
27
|
+
export interface McpPanelRefusalView {
|
|
28
|
+
asOf: string;
|
|
23
29
|
lastLegMcp?: McpPanelLastLegView;
|
|
24
30
|
lastLegMcpUnreadable?: true;
|
|
31
|
+
scenarioRefusal: ScenarioRefusalReading;
|
|
25
32
|
}
|
|
33
|
+
export type McpPanelView = McpPanelServersView | McpPanelRefusalView;
|
|
26
34
|
export declare function projectMcpPanel(body: unknown): McpPanelView | undefined;
|
|
35
|
+
export declare function mcpPanelRefusalOf(view: McpPanelView | undefined): ScenarioRefusalReading | undefined;
|
|
27
36
|
export declare function fetchMcpPanel(client: Pick<AgentClient, 'sessions'>, sessionId: string, opts?: {
|
|
28
37
|
signal?: AbortSignal;
|
|
29
38
|
}): Promise<McpPanelView | undefined>;
|
package/dist/mcpPanel.js
CHANGED
|
@@ -3,6 +3,7 @@ import { isSessionIdPathSegment } from './sessionIdSegment.js';
|
|
|
3
3
|
import { projectMcpSection } from './adapter/downstream/eventToSdkMessage.js';
|
|
4
4
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
5
5
|
import { mcpLivenessRollupOf } from './mcpLiveness.js';
|
|
6
|
+
import { scenarioRefusalOf } from './scenarioRefusal.js';
|
|
6
7
|
const MCP_PANEL_ERROR_MAX = 200;
|
|
7
8
|
const MCP_PANEL_WORD_MAX = 40;
|
|
8
9
|
const MCP_PANEL_NAMES_MAX = 8;
|
|
@@ -40,19 +41,29 @@ export function projectMcpPanel(body) {
|
|
|
40
41
|
return undefined;
|
|
41
42
|
if (!nonEmpty(body.asOf))
|
|
42
43
|
return undefined;
|
|
43
|
-
|
|
44
|
+
const refusal = scenarioRefusalOf(body);
|
|
45
|
+
if (refusal === null)
|
|
44
46
|
return undefined;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
let view;
|
|
48
|
+
if (refusal !== undefined) {
|
|
49
|
+
view = { asOf: body.asOf, scenarioRefusal: refusal };
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
if (!Array.isArray(body.servers))
|
|
53
|
+
return undefined;
|
|
54
|
+
const servers = [];
|
|
55
|
+
for (const r of body.servers) {
|
|
56
|
+
const row = projectServerRow(r);
|
|
57
|
+
if (row !== undefined)
|
|
58
|
+
servers.push(row);
|
|
59
|
+
}
|
|
60
|
+
if (body.servers.length > 0 && servers.length === 0)
|
|
61
|
+
return undefined;
|
|
62
|
+
const sv = { asOf: body.asOf, servers };
|
|
63
|
+
if (body.degraded === true)
|
|
64
|
+
sv.degraded = true;
|
|
65
|
+
view = sv;
|
|
50
66
|
}
|
|
51
|
-
if (body.servers.length > 0 && servers.length === 0)
|
|
52
|
-
return undefined;
|
|
53
|
-
const view = { asOf: body.asOf, servers };
|
|
54
|
-
if (body.degraded === true)
|
|
55
|
-
view.degraded = true;
|
|
56
67
|
if ('lastLegMcp' in body) {
|
|
57
68
|
const leg = projectLastLeg(body.lastLegMcp);
|
|
58
69
|
if (leg !== undefined)
|
|
@@ -62,6 +73,20 @@ export function projectMcpPanel(body) {
|
|
|
62
73
|
}
|
|
63
74
|
return view;
|
|
64
75
|
}
|
|
76
|
+
export function mcpPanelRefusalOf(view) {
|
|
77
|
+
try {
|
|
78
|
+
if (view === null || typeof view !== 'object')
|
|
79
|
+
return undefined;
|
|
80
|
+
const d = Object.getOwnPropertyDescriptor(view, 'scenarioRefusal');
|
|
81
|
+
if (d === undefined || !('value' in d))
|
|
82
|
+
return undefined;
|
|
83
|
+
const r = d.value;
|
|
84
|
+
return r !== null && typeof r === 'object' && !Array.isArray(r) ? r : undefined;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
65
90
|
export async function fetchMcpPanel(client, sessionId, opts) {
|
|
66
91
|
if (!isSessionIdPathSegment(sessionId))
|
|
67
92
|
return undefined;
|
|
@@ -98,12 +123,14 @@ void _mcpPanelShapePin;
|
|
|
98
123
|
export function mcpEngineLegPresence(view) {
|
|
99
124
|
if (view === undefined)
|
|
100
125
|
return 'unknown';
|
|
101
|
-
if (view.servers.length > 0)
|
|
102
|
-
return 'present';
|
|
103
126
|
if (view.lastLegMcp !== undefined)
|
|
104
127
|
return 'present';
|
|
105
128
|
if (view.lastLegMcpUnreadable === true)
|
|
106
129
|
return 'present';
|
|
130
|
+
if (!('servers' in view))
|
|
131
|
+
return 'unknown';
|
|
132
|
+
if (view.servers.length > 0)
|
|
133
|
+
return 'present';
|
|
107
134
|
if (view.degraded === true)
|
|
108
135
|
return 'present';
|
|
109
136
|
return 'absent';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
1
2
|
export type McpProbeReading = {
|
|
2
3
|
kind: 'unobserved';
|
|
3
4
|
} | {
|
|
@@ -12,4 +13,4 @@ export type McpProbeReading = {
|
|
|
12
13
|
export declare function projectMcpProbeCapability(caps: unknown): McpProbeReading | undefined;
|
|
13
14
|
export declare function observedMcpProbe(baseUrl?: string | undefined): McpProbeReading;
|
|
14
15
|
export declare function mcpProbeAvailable(reading: McpProbeReading): 'yes' | 'no' | 'unknown';
|
|
15
|
-
export declare function mcpProbeDoctorDetail(reading: McpProbeReading): string;
|
|
16
|
+
export declare function mcpProbeDoctorDetail(reading: McpProbeReading, lang?: UiLanguage): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
|
|
3
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
3
4
|
import { ownDataField } from './ownKey.js';
|
|
4
5
|
export function projectMcpProbeCapability(caps) {
|
|
5
6
|
try {
|
|
@@ -30,22 +31,17 @@ export function mcpProbeAvailable(reading) {
|
|
|
30
31
|
return 'no';
|
|
31
32
|
return 'unknown';
|
|
32
33
|
}
|
|
33
|
-
export function mcpProbeDoctorDetail(reading) {
|
|
34
|
+
export function mcpProbeDoctorDetail(reading, lang) {
|
|
34
35
|
switch (reading.kind) {
|
|
35
36
|
case 'unreadable':
|
|
36
|
-
return unreadableReadingDetail('
|
|
37
|
+
return unreadableReadingDetail(renderMessage(msg('notice.capability.subject.mcpProbe'), lang), lang);
|
|
37
38
|
case 'unobserved':
|
|
38
|
-
return ('
|
|
39
|
-
'this process has no usable capabilities reading cached for it (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which)');
|
|
39
|
+
return renderMessage(msg('notice.capability.mcpProbe.unobserved'), lang);
|
|
40
40
|
case 'not_reported':
|
|
41
|
-
return ('
|
|
42
|
-
'(asking it usually answers with a machine-readable route-not-found, though a timeout or an uncoded gateway answer still says nothing either way); ' +
|
|
43
|
-
'prefer the session panel last-leg roster where that panel carries one, and otherwise show this reason rather than an entry that cannot answer');
|
|
41
|
+
return renderMessage(msg('notice.capability.mcpProbe.notReported'), lang);
|
|
44
42
|
case 'absent':
|
|
45
|
-
return ('
|
|
46
|
-
'this client does not guess why, and whether caller-supplied declarations are honored is a separate position with its own answer');
|
|
43
|
+
return renderMessage(msg('notice.capability.mcpProbe.absent'), lang);
|
|
47
44
|
case 'present':
|
|
48
|
-
return ('
|
|
49
|
-
'and a probe of caller-supplied declarations answers with the very same body shape');
|
|
45
|
+
return renderMessage(msg('notice.capability.mcpProbe.present'), lang);
|
|
50
46
|
}
|
|
51
47
|
}
|
package/dist/mcpProbeWire.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { McpProbeFace, McpServerSpec } from '@sema-agent/sdk';
|
|
2
2
|
import { type WiringManifestMcpEntryView } from './adapter/downstream/eventToSdkMessage.js';
|
|
3
3
|
import { type McpProbeReading } from './mcpProbeCapability.js';
|
|
4
|
+
import { type ScenarioRefusalReading } from './scenarioRefusal.js';
|
|
4
5
|
export interface McpProbeFacade {
|
|
5
6
|
mcpCapabilities(opts?: {
|
|
6
7
|
signal?: AbortSignal;
|
|
@@ -9,7 +10,7 @@ export interface McpProbeFacade {
|
|
|
9
10
|
signal?: AbortSignal;
|
|
10
11
|
}): Promise<McpProbeFace>;
|
|
11
12
|
}
|
|
12
|
-
export declare const MCP_PROBE_REFUSAL_CAUSES: readonly ["face_absent", "client_too_old", "unreadable_request", "injection_not_honored", "body_shape", "field_invalid", "body_unparseable", "payload_too_large", "rate_limited", "unauthorized", "principal_required", "principal_unverified"];
|
|
13
|
+
export declare const MCP_PROBE_REFUSAL_CAUSES: readonly ["face_absent", "client_too_old", "unreadable_request", "injection_not_honored", "body_shape", "field_invalid", "body_unparseable", "payload_too_large", "rate_limited", "unauthorized", "principal_required", "principal_unverified", "scenario_refused"];
|
|
13
14
|
export type McpProbeRefusalCause = (typeof MCP_PROBE_REFUSAL_CAUSES)[number];
|
|
14
15
|
export declare const MCP_PROBE_UNKNOWN_WHYS: readonly ["no_verdict", "probe_incomplete", "server_fault", "result_unreadable", "index_misaligned", "unclassified"];
|
|
15
16
|
export type McpProbeUnknownWhy = (typeof MCP_PROBE_UNKNOWN_WHYS)[number];
|
|
@@ -18,6 +19,7 @@ export type McpProbeRefused = {
|
|
|
18
19
|
cause: McpProbeRefusalCause;
|
|
19
20
|
message: string;
|
|
20
21
|
retryAfterSec?: number;
|
|
22
|
+
scenarioRefusal?: ScenarioRefusalReading;
|
|
21
23
|
};
|
|
22
24
|
export type McpProbeUnknown = {
|
|
23
25
|
status: 'unknown';
|
|
@@ -35,13 +37,18 @@ export type McpProbeOutcome = {
|
|
|
35
37
|
status: 'face';
|
|
36
38
|
face: McpProbeFaceView;
|
|
37
39
|
} | McpProbeRefused | McpProbeUnknown;
|
|
40
|
+
export type McpDeploymentOutcome = {
|
|
41
|
+
status: 'face';
|
|
42
|
+
face: McpProbeFaceView;
|
|
43
|
+
declaredBy: 'deployment';
|
|
44
|
+
} | McpProbeRefused | McpProbeUnknown;
|
|
38
45
|
export declare function classifyMcpProbeFailure(e: unknown): McpProbeFailure;
|
|
39
46
|
export interface McpCapabilitiesCall {
|
|
40
47
|
capability: McpProbeReading;
|
|
41
48
|
}
|
|
42
49
|
export declare function readMcpCapabilities(facade: McpProbeFacade, call: McpCapabilitiesCall, opts?: {
|
|
43
50
|
signal?: AbortSignal;
|
|
44
|
-
}): Promise<
|
|
51
|
+
}): Promise<McpDeploymentOutcome>;
|
|
45
52
|
export interface McpProbeServersCall {
|
|
46
53
|
specs: McpServerSpec[];
|
|
47
54
|
capability: McpProbeReading;
|
package/dist/mcpProbeWire.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { projectMcpSection } from './adapter/downstream/eventToSdkMessage.js';
|
|
2
2
|
import { wireFailureShapeOf } from './wireFailureShape.js';
|
|
3
3
|
import { mcpProbeAvailable } from './mcpProbeCapability.js';
|
|
4
|
+
import { scenarioRefusalFromError } from './scenarioRefusal.js';
|
|
4
5
|
export const MCP_PROBE_REFUSAL_CAUSES = Object.freeze([
|
|
5
6
|
'face_absent',
|
|
6
7
|
'client_too_old',
|
|
@@ -14,6 +15,7 @@ export const MCP_PROBE_REFUSAL_CAUSES = Object.freeze([
|
|
|
14
15
|
'unauthorized',
|
|
15
16
|
'principal_required',
|
|
16
17
|
'principal_unverified',
|
|
18
|
+
'scenario_refused',
|
|
17
19
|
]);
|
|
18
20
|
export const MCP_PROBE_UNKNOWN_WHYS = Object.freeze([
|
|
19
21
|
'no_verdict',
|
|
@@ -168,6 +170,9 @@ export async function readMcpCapabilities(facade, call, opts) {
|
|
|
168
170
|
res = await facade.mcpCapabilities(opts);
|
|
169
171
|
}
|
|
170
172
|
catch (e) {
|
|
173
|
+
const refusal = scenarioRefusalFromError(e);
|
|
174
|
+
if (refusal !== null)
|
|
175
|
+
return { ...refusedBy('scenario_refused', wireFailureShapeOf(e).message), scenarioRefusal: refusal };
|
|
171
176
|
return classifyMcpProbeFailure(e);
|
|
172
177
|
}
|
|
173
178
|
const narrowed = narrowProbeFace(res);
|
|
@@ -175,7 +180,7 @@ export async function readMcpCapabilities(facade, call, opts) {
|
|
|
175
180
|
return unknownBy(narrowed.why, `the per-server MCP status call answered 2xx with a body this client cannot stand behind (${narrowed.what}) — refusing to present it as a reading, ` +
|
|
176
181
|
'because a normal-looking empty list is exactly the false answer this face exists to remove');
|
|
177
182
|
}
|
|
178
|
-
return { status: 'face', face: narrowed.face };
|
|
183
|
+
return { status: 'face', face: narrowed.face, declaredBy: 'deployment' };
|
|
179
184
|
}
|
|
180
185
|
export async function probeMcpServers(facade, call, opts) {
|
|
181
186
|
if (typeof facade?.probeMcp !== 'function') {
|
package/dist/mcpWireCaps.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { McpServerSpec } from '@sema-agent/sdk';
|
|
2
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
3
|
+
export type { McpServerSpec };
|
|
3
4
|
export declare const MCP_CAPS: {
|
|
4
5
|
readonly items: 32;
|
|
5
6
|
};
|
|
@@ -10,9 +11,53 @@ export interface McpConfigLike {
|
|
|
10
11
|
env?: Record<string, string>;
|
|
11
12
|
url?: string;
|
|
12
13
|
headers?: Record<string, string>;
|
|
14
|
+
principalHeader?: string;
|
|
15
|
+
assertionHeader?: string;
|
|
13
16
|
allowTools?: string[];
|
|
17
|
+
elicitation?: {} | null | undefined;
|
|
14
18
|
toolFaces?: unknown;
|
|
15
19
|
toolAxes?: unknown;
|
|
16
20
|
}
|
|
21
|
+
export type McpHttpIdentityHeaders = {
|
|
22
|
+
readonly kind: 'ok';
|
|
23
|
+
readonly principalHeader?: string;
|
|
24
|
+
readonly assertionHeader?: string;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'both_set';
|
|
27
|
+
};
|
|
28
|
+
export declare function readMcpHttpIdentityHeaders(transport: object): McpHttpIdentityHeaders;
|
|
17
29
|
export declare function mcpConfigToSpec(name: string, c: McpConfigLike): McpServerSpec | null;
|
|
18
30
|
export declare function mcpConfigsToSpecs(servers: Record<string, McpConfigLike> | undefined): McpServerSpec[];
|
|
31
|
+
export type McpToolAxesVerdict = {
|
|
32
|
+
readonly kind: 'ok';
|
|
33
|
+
readonly toolAxes?: Readonly<Record<string, object>>;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: 'bad';
|
|
36
|
+
readonly problem: string;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: 'unavailable';
|
|
39
|
+
};
|
|
40
|
+
export declare function mcpToolAxesVerdict(declared: {} | null | undefined): McpToolAxesVerdict;
|
|
41
|
+
export declare function mcpElicitationVerdict(declared: {} | null | undefined): {
|
|
42
|
+
readonly kind: 'ok';
|
|
43
|
+
readonly elicitation?: boolean;
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: 'bad';
|
|
46
|
+
};
|
|
47
|
+
export type McpConfigDropReason = 'name_blank' | 'name_edge_whitespace' | 'name_collides_after_trim' | 'tool_axes_invalid' | 'elicitation_invalid';
|
|
48
|
+
export interface McpConfigDropped {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly reason: McpConfigDropReason;
|
|
51
|
+
readonly problem?: string;
|
|
52
|
+
readonly notice: string;
|
|
53
|
+
}
|
|
54
|
+
export interface McpConfigProjection {
|
|
55
|
+
readonly specs: McpServerSpec[];
|
|
56
|
+
readonly dropped: readonly McpConfigDropped[];
|
|
57
|
+
}
|
|
58
|
+
export interface ProjectMcpConfigsOptions {
|
|
59
|
+
readonly sourceLabel?: (serverName: string) => string | undefined;
|
|
60
|
+
readonly lang?: UiLanguage;
|
|
61
|
+
}
|
|
62
|
+
export declare function projectMcpConfigs(servers: Record<string, McpConfigLike> | undefined, opts?: ProjectMcpConfigsOptions): McpConfigProjection;
|
|
63
|
+
export declare function mcpAssertionHeaderNotSentNotice(specs: readonly McpServerSpec[]): string | undefined;
|
package/dist/mcpWireCaps.js
CHANGED
|
@@ -1,14 +1,51 @@
|
|
|
1
|
+
import { guardedRead } from './ownKey.js';
|
|
2
|
+
import { readMcpToolAxes } from './coreValuePorts.js';
|
|
3
|
+
import { capForDisplay } from './fleetTaskDesc.js';
|
|
4
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
5
|
+
const _mcpServerSpecPin = true;
|
|
6
|
+
void _mcpServerSpecPin;
|
|
1
7
|
export const MCP_CAPS = { items: 32 };
|
|
2
|
-
function transparentKeys(c) {
|
|
8
|
+
function transparentKeys(c, axes, elicitation) {
|
|
3
9
|
return {
|
|
4
10
|
...(c.toolFaces !== undefined ? { toolFaces: c.toolFaces } : {}),
|
|
5
|
-
...(
|
|
11
|
+
...(axes !== undefined ? { toolAxes: axes } : {}),
|
|
12
|
+
...(elicitation !== undefined ? { elicitation } : {}),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function presentHeaderName(v) {
|
|
16
|
+
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
17
|
+
}
|
|
18
|
+
export function readMcpHttpIdentityHeaders(transport) {
|
|
19
|
+
const t = transport;
|
|
20
|
+
const principalHeader = presentHeaderName(t.principalHeader);
|
|
21
|
+
const assertionHeader = presentHeaderName(t.assertionHeader);
|
|
22
|
+
if (principalHeader !== undefined && assertionHeader !== undefined)
|
|
23
|
+
return { kind: 'both_set' };
|
|
24
|
+
return {
|
|
25
|
+
kind: 'ok',
|
|
26
|
+
...(principalHeader !== undefined ? { principalHeader } : {}),
|
|
27
|
+
...(assertionHeader !== undefined ? { assertionHeader } : {}),
|
|
6
28
|
};
|
|
7
29
|
}
|
|
8
30
|
export function mcpConfigToSpec(name, c) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
31
|
+
return mcpConfigEntry(name, c).spec;
|
|
32
|
+
}
|
|
33
|
+
function mcpConfigEntry(name, c) {
|
|
34
|
+
if (mcpNameFlaw(name) !== undefined)
|
|
35
|
+
return { spec: null };
|
|
36
|
+
const declared = c.toolAxes;
|
|
37
|
+
const verdict = mcpToolAxesVerdict(declared);
|
|
38
|
+
const elDeclared = c.elicitation;
|
|
39
|
+
const elVerdict = mcpElicitationVerdict(elDeclared);
|
|
40
|
+
if (verdict.kind === 'bad' || elVerdict.kind === 'bad') {
|
|
41
|
+
const rest = specOf(name, c, undefined, undefined);
|
|
42
|
+
if (rest === null)
|
|
43
|
+
return { spec: null };
|
|
44
|
+
return verdict.kind === 'bad' ? { spec: null, axesProblem: verdict.problem } : { spec: null, elicitationInvalid: true };
|
|
45
|
+
}
|
|
46
|
+
return { spec: specOf(name, c, verdict.kind === 'ok' ? verdict.toolAxes : declared, elVerdict.elicitation) };
|
|
47
|
+
}
|
|
48
|
+
function specOf(n, c, axes, elicitation) {
|
|
12
49
|
const kind = c.type ?? 'stdio';
|
|
13
50
|
if (kind === 'stdio') {
|
|
14
51
|
if (!c.command)
|
|
@@ -21,34 +58,145 @@ export function mcpConfigToSpec(name, c) {
|
|
|
21
58
|
...(c.args && c.args.length > 0 ? { args: c.args } : {}),
|
|
22
59
|
...(c.env ? { env: c.env } : {}),
|
|
23
60
|
},
|
|
24
|
-
...(
|
|
25
|
-
...transparentKeys(c),
|
|
61
|
+
...(Array.isArray(c.allowTools) ? { allowTools: c.allowTools } : {}),
|
|
62
|
+
...transparentKeys(c, axes, elicitation),
|
|
26
63
|
};
|
|
27
64
|
}
|
|
28
65
|
if (kind === 'http') {
|
|
29
66
|
if (!c.url)
|
|
30
67
|
return null;
|
|
68
|
+
const id = readMcpHttpIdentityHeaders(c);
|
|
69
|
+
if (id.kind === 'both_set')
|
|
70
|
+
return null;
|
|
31
71
|
return {
|
|
32
72
|
name: n,
|
|
33
73
|
transport: {
|
|
34
74
|
kind: 'http',
|
|
35
75
|
url: c.url,
|
|
36
76
|
...(c.headers ? { headers: c.headers } : {}),
|
|
77
|
+
...(id.principalHeader !== undefined ? { principalHeader: id.principalHeader } : {}),
|
|
78
|
+
...(id.assertionHeader !== undefined ? { assertionHeader: id.assertionHeader } : {}),
|
|
37
79
|
},
|
|
38
|
-
...(
|
|
39
|
-
...transparentKeys(c),
|
|
80
|
+
...(Array.isArray(c.allowTools) ? { allowTools: c.allowTools } : {}),
|
|
81
|
+
...transparentKeys(c, axes, elicitation),
|
|
40
82
|
};
|
|
41
83
|
}
|
|
42
84
|
return null;
|
|
43
85
|
}
|
|
44
86
|
export function mcpConfigsToSpecs(servers) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
87
|
+
return projectMcpConfigs(servers).specs;
|
|
88
|
+
}
|
|
89
|
+
export function mcpToolAxesVerdict(declared) {
|
|
90
|
+
if (declared === undefined)
|
|
91
|
+
return Object.freeze({ kind: 'ok' });
|
|
92
|
+
const read = readMcpToolAxes(declared);
|
|
93
|
+
if (read === undefined || read === null || typeof read !== 'object')
|
|
94
|
+
return Object.freeze({ kind: 'unavailable' });
|
|
95
|
+
if (read.ok === true) {
|
|
96
|
+
const copy = read.toolAxes;
|
|
97
|
+
return Object.freeze(typeof copy === 'object' && copy !== null ? { kind: 'ok', toolAxes: copy } : { kind: 'ok' });
|
|
98
|
+
}
|
|
99
|
+
if (read.ok === false) {
|
|
100
|
+
const problem = read.problem;
|
|
101
|
+
return Object.freeze({ kind: 'bad', problem: typeof problem === 'string' && problem.length > 0 ? problem : renderMessage(msg('config.mcp.toolAxesFallbackProblem')) });
|
|
102
|
+
}
|
|
103
|
+
return Object.freeze({ kind: 'unavailable' });
|
|
104
|
+
}
|
|
105
|
+
export function mcpElicitationVerdict(declared) {
|
|
106
|
+
if (declared === undefined)
|
|
107
|
+
return Object.freeze({ kind: 'ok' });
|
|
108
|
+
return typeof declared === 'boolean' ? Object.freeze({ kind: 'ok', elicitation: declared }) : Object.freeze({ kind: 'bad' });
|
|
109
|
+
}
|
|
110
|
+
function mcpNameFlaw(name) {
|
|
111
|
+
if (typeof name !== 'string')
|
|
112
|
+
return 'name_blank';
|
|
113
|
+
const t = name.trim();
|
|
114
|
+
if (t.length === 0)
|
|
115
|
+
return 'name_blank';
|
|
116
|
+
return t === name ? undefined : 'name_edge_whitespace';
|
|
117
|
+
}
|
|
118
|
+
const DROP_NAME_SHOWN = 80;
|
|
119
|
+
const DROP_LABEL_SHOWN = 140;
|
|
120
|
+
const DROP_PROBLEM_SHOWN = 300;
|
|
121
|
+
function dropNotice(name, reason, problem, opts) {
|
|
122
|
+
let label;
|
|
123
|
+
try {
|
|
124
|
+
label = opts?.sourceLabel?.(name);
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
label = undefined;
|
|
128
|
+
}
|
|
129
|
+
const where = typeof label === 'string' && label.length > 0 ? ` (${capForDisplay(label, DROP_LABEL_SHOWN)})` : '';
|
|
130
|
+
const quoted = `"${capForDisplay(name, DROP_NAME_SHOWN)}"`;
|
|
131
|
+
const ref = reason === 'tool_axes_invalid'
|
|
132
|
+
? msg('config.mcp.toolAxesInvalid', { name: quoted, where, problem: capForDisplay(problem ?? renderMessage(msg('config.mcp.toolAxesFallbackProblem')), DROP_PROBLEM_SHOWN) })
|
|
133
|
+
: reason === 'elicitation_invalid'
|
|
134
|
+
? msg('config.mcp.elicitationInvalid', { name: quoted, where })
|
|
135
|
+
: reason === 'name_blank'
|
|
136
|
+
? msg('config.mcp.nameBlank', { name: quoted, where })
|
|
137
|
+
: reason === 'name_collides_after_trim'
|
|
138
|
+
? msg('config.mcp.nameCollides', { name: quoted, where })
|
|
139
|
+
: msg('config.mcp.nameEdgeWhitespace', { name: quoted, where });
|
|
140
|
+
return renderMessage(ref, opts?.lang);
|
|
141
|
+
}
|
|
142
|
+
export function projectMcpConfigs(servers, opts) {
|
|
143
|
+
const specs = [];
|
|
144
|
+
const dropped = [];
|
|
145
|
+
const entries = Object.entries(servers ?? {});
|
|
146
|
+
const exactNames = new Set();
|
|
147
|
+
const trimmedCount = new Map();
|
|
148
|
+
for (const [name] of entries) {
|
|
149
|
+
const flaw = mcpNameFlaw(name);
|
|
150
|
+
if (flaw === undefined)
|
|
151
|
+
exactNames.add(name);
|
|
152
|
+
else if (flaw === 'name_edge_whitespace')
|
|
153
|
+
trimmedCount.set(name.trim(), (trimmedCount.get(name.trim()) ?? 0) + 1);
|
|
154
|
+
}
|
|
155
|
+
for (const [name, c] of entries) {
|
|
156
|
+
if (specs.length >= MCP_CAPS.items)
|
|
48
157
|
break;
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
|
|
158
|
+
const flaw = mcpNameFlaw(name);
|
|
159
|
+
if (flaw !== undefined) {
|
|
160
|
+
const reason = flaw === 'name_edge_whitespace' && (exactNames.has(name.trim()) || (trimmedCount.get(name.trim()) ?? 0) > 1) ? 'name_collides_after_trim' : flaw;
|
|
161
|
+
dropped.push({ name, reason, notice: dropNotice(name, reason, undefined, opts) });
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const out = mcpConfigEntry(name, c);
|
|
165
|
+
if (out.spec !== null) {
|
|
166
|
+
specs.push(out.spec);
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (out.axesProblem !== undefined) {
|
|
170
|
+
dropped.push({ name, reason: 'tool_axes_invalid', problem: out.axesProblem, notice: dropNotice(name, 'tool_axes_invalid', out.axesProblem, opts) });
|
|
171
|
+
}
|
|
172
|
+
else if (out.elicitationInvalid === true) {
|
|
173
|
+
dropped.push({ name, reason: 'elicitation_invalid', notice: dropNotice(name, 'elicitation_invalid', undefined, opts) });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return { specs, dropped: Object.freeze(dropped) };
|
|
177
|
+
}
|
|
178
|
+
function assertionDeclaringServerName(spec) {
|
|
179
|
+
const t = spec?.transport;
|
|
180
|
+
if (t?.kind !== 'http')
|
|
181
|
+
return undefined;
|
|
182
|
+
const declared = t.assertionHeader;
|
|
183
|
+
return typeof declared === 'string' && declared.length > 0 && typeof spec?.name === 'string' ? spec.name : undefined;
|
|
184
|
+
}
|
|
185
|
+
const ASSERTION_NOTICE_NAMES_SHOWN = 5;
|
|
186
|
+
export function mcpAssertionHeaderNotSentNotice(specs) {
|
|
187
|
+
const count = guardedRead(() => (Array.isArray(specs) ? specs.length : 0)) ?? 0;
|
|
188
|
+
const names = [];
|
|
189
|
+
for (let i = 0; i < count; i++) {
|
|
190
|
+
const name = guardedRead(() => assertionDeclaringServerName(specs[i]));
|
|
191
|
+
if (name !== undefined)
|
|
192
|
+
names.push(name);
|
|
52
193
|
}
|
|
53
|
-
|
|
194
|
+
if (names.length === 0)
|
|
195
|
+
return undefined;
|
|
196
|
+
const distinct = [...new Set(names)];
|
|
197
|
+
const parts = distinct.slice(0, ASSERTION_NOTICE_NAMES_SHOWN).map((x) => `"${x}"`);
|
|
198
|
+
if (distinct.length > ASSERTION_NOTICE_NAMES_SHOWN)
|
|
199
|
+
parts.push(`+${distinct.length - ASSERTION_NOTICE_NAMES_SHOWN} more`);
|
|
200
|
+
return (`MCP servers that declare an assertion header (assertionHeader): ${parts.join(', ')} — server versions up to 7.131.0 accept this setting but do not send the header, ` +
|
|
201
|
+
'and this client cannot tell whether the engine it uses sends it; a connector that requires the header will refuse requests from these servers');
|
|
54
202
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import type { MemoryErasedBinding } from '@sema-agent/sdk';
|
|
2
|
+
export type MemoryEntryOriginMarkReading = 'marked' | 'unmarked' | 'undecidable';
|
|
2
3
|
export interface MemoryExportEntryRow {
|
|
3
4
|
id: string;
|
|
4
5
|
slug: string;
|
|
5
6
|
scope: string;
|
|
6
7
|
rev: string;
|
|
7
|
-
originMark:
|
|
8
|
+
originMark: MemoryEntryOriginMarkReading;
|
|
8
9
|
}
|
|
9
10
|
export type MemoryExportUnreadableCause = 'body_unreadable' | 'envelope_absent' | 'envelope_unreadable' | 'too_many_rows' | 'rows_unreadable';
|
|
10
11
|
export type MemoryExportReading = {
|
|
@@ -36,13 +37,7 @@ export type ScopeExternalOriginVerdict = {
|
|
|
36
37
|
export declare function scopeExternalOriginVerdict(reading: MemoryExportReading, asked: {
|
|
37
38
|
originAware: boolean;
|
|
38
39
|
}): ScopeExternalOriginVerdict;
|
|
39
|
-
export type MemoryErasedBinding
|
|
40
|
-
state: 'bound';
|
|
41
|
-
scope: string;
|
|
42
|
-
slug: string;
|
|
43
|
-
} | {
|
|
44
|
-
state: 'unbound';
|
|
45
|
-
};
|
|
40
|
+
export type { MemoryErasedBinding };
|
|
46
41
|
export interface MemoryErasedRow {
|
|
47
42
|
id: string;
|
|
48
43
|
rev: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readThrownSlot, THROWN_SLOT_UNREADABLE } from './wireFailureShape.js';
|
|
1
2
|
function nonEmptyString(v) {
|
|
2
3
|
return typeof v === 'string' && v !== '';
|
|
3
4
|
}
|
|
@@ -216,16 +217,10 @@ export function readMemoryEraseReceipt(body) {
|
|
|
216
217
|
return { kind: 'malformed', why: 'body_unreadable' };
|
|
217
218
|
o = body;
|
|
218
219
|
envelopeSeen = ['v', 'requestId', 'status', 'erased', 'notFound'].some((k) => Object.hasOwn(o, k));
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
rawEvidence =
|
|
223
|
-
rawCustody = o.custodyState;
|
|
224
|
-
rawSelected = o.resolvedIds;
|
|
225
|
-
rawErased = o.erased;
|
|
226
|
-
rawNotFound = o.notFound;
|
|
227
|
-
rawPreviously = Object.hasOwn(o, 'erasedPreviously') ? o.erasedPreviously : undefined;
|
|
228
|
-
rawConflicts = o.conflicts;
|
|
220
|
+
const slots = ['v', 'requestId', 'status', 'evidenceCapability', 'custodyState', 'resolvedIds', 'erased', 'notFound', 'erasedPreviously', 'conflicts'].map((k) => readThrownSlot(o, k, 'data'));
|
|
221
|
+
if (slots.includes(THROWN_SLOT_UNREADABLE))
|
|
222
|
+
return { kind: 'malformed', why: 'body_unreadable' };
|
|
223
|
+
[rawV, rawRequestId, rawStatus, rawEvidence, rawCustody, rawSelected, rawErased, rawNotFound, rawPreviously, rawConflicts] = slots;
|
|
229
224
|
}
|
|
230
225
|
catch {
|
|
231
226
|
return { kind: 'malformed', why: 'body_unreadable' };
|
|
@@ -25,7 +25,6 @@ export interface TierGroupsView {
|
|
|
25
25
|
export interface DeleteWarningsInput {
|
|
26
26
|
id: string;
|
|
27
27
|
doc: {
|
|
28
|
-
atModelAllowlist?: unknown;
|
|
29
28
|
atMention?: unknown;
|
|
30
29
|
tierGroups?: unknown;
|
|
31
30
|
} | null;
|
|
@@ -35,7 +34,6 @@ export interface DeleteWarningsInput {
|
|
|
35
34
|
export interface DeleteBlockersInput {
|
|
36
35
|
id: string;
|
|
37
36
|
doc: {
|
|
38
|
-
default?: unknown;
|
|
39
37
|
roles?: unknown;
|
|
40
38
|
} | null;
|
|
41
39
|
rosters: {
|
|
@@ -22,9 +22,7 @@ export function computeDeleteWarnings(input) {
|
|
|
22
22
|
if (before.mode === 'only' && after.mode === 'none') {
|
|
23
23
|
out.push({
|
|
24
24
|
kind: 'allowlist-empties',
|
|
25
|
-
consequence:
|
|
26
|
-
? 'it is the last usable model on your @-mention allowlist — deleting it empties the list, which means EVERY enabled model becomes @-mentionable'
|
|
27
|
-
: 'it is the last usable model on your @-mention allowlist — deleting it leaves no model that can be @-mentioned',
|
|
25
|
+
consequence: 'it is the last usable model on your @-mention allowlist — deleting it leaves no model that can be @-mentioned',
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
28
|
}
|
|
@@ -58,24 +56,17 @@ export function computeDeleteBlockers(input) {
|
|
|
58
56
|
fix: 'fix or re-save models.json so it can be read, then delete this model',
|
|
59
57
|
});
|
|
60
58
|
}
|
|
61
|
-
if (policy.defaultUnreadable) {
|
|
62
|
-
out.push({
|
|
63
|
-
kind: 'unreadable',
|
|
64
|
-
where: 'models.json `default` (the default model could not be read)',
|
|
65
|
-
fix: 'fix or re-save models.json so its default model can be read, then delete this model',
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
59
|
const dm = policy.defaultModel;
|
|
69
60
|
if (dm !== undefined && dm.name === id) {
|
|
70
61
|
out.push({
|
|
71
62
|
kind: 'default',
|
|
72
|
-
where:
|
|
63
|
+
where: 'models.json roles.default',
|
|
73
64
|
fix: 'point another model at the default first (Model Hub: select it and press u), then delete this one',
|
|
74
65
|
});
|
|
75
66
|
}
|
|
76
67
|
if (doc && isPlainObject(doc.roles)) {
|
|
77
68
|
for (const [role, target] of Object.entries(doc.roles)) {
|
|
78
|
-
if (role === 'default' && dm
|
|
69
|
+
if (role === 'default' && dm !== undefined)
|
|
79
70
|
continue;
|
|
80
71
|
if (!isPlainObject(target) || typeof target.model !== 'string')
|
|
81
72
|
continue;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { type SettingsAtMention } from '../generated/settingsSchemaFns.js';
|
|
2
2
|
export interface CanonicalDefaultModel {
|
|
3
3
|
readonly name: string;
|
|
4
|
-
readonly from: 'default' | 'roles.default';
|
|
5
4
|
}
|
|
6
5
|
export type CanonicalAtMention = {
|
|
7
6
|
readonly kind: 'read';
|
|
8
7
|
readonly value: SettingsAtMention;
|
|
9
|
-
readonly from: 'atMention' | 'atModelAllowlist';
|
|
10
|
-
readonly unreadableEntries: number;
|
|
11
8
|
} | {
|
|
12
9
|
readonly kind: 'unreadable';
|
|
13
|
-
readonly from: 'atMention' | 'atModelAllowlist';
|
|
14
10
|
};
|
|
15
11
|
export interface CanonicalModelsPolicy {
|
|
16
12
|
readonly defaultModel?: CanonicalDefaultModel;
|
|
17
|
-
readonly defaultUnreadable?: true;
|
|
18
13
|
readonly atMention?: CanonicalAtMention;
|
|
19
14
|
readonly unreadable?: true;
|
|
20
15
|
}
|