@sema-agent/client-core 0.77.1 → 0.78.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 +42 -1
- package/README.md +6 -5
- package/dist/abortableSleep.d.ts +0 -28
- package/dist/abortableSleep.js +0 -28
- package/dist/adapt/arms.d.ts +0 -46
- package/dist/adapt/arms.js +9 -544
- package/dist/adapt/ids.d.ts +0 -58
- package/dist/adapt/ids.js +0 -63
- package/dist/adapt/instanceLedger.d.ts +0 -25
- package/dist/adapt/instanceLedger.js +0 -20
- package/dist/adapt/panelTasks.d.ts +0 -69
- package/dist/adapt/panelTasks.js +0 -95
- package/dist/adapt/textSegmentAuthority.d.ts +1 -137
- package/dist/adapt/textSegmentAuthority.js +0 -54
- package/dist/adapt/textStream.d.ts +0 -252
- package/dist/adapt/textStream.js +2 -281
- package/dist/adapt/toolCards.d.ts +0 -46
- package/dist/adapt/toolCards.js +0 -23
- package/dist/adapt/turnFlags.d.ts +0 -54
- package/dist/adapt/turnFlags.js +1 -17
- package/dist/adapt/wireShapes.d.ts +0 -92
- package/dist/adapt/wireShapes.js +0 -83
- package/dist/adapt.d.ts +0 -55
- package/dist/adapt.js +1 -120
- package/dist/adapter/activeRunSelfHeal.d.ts +22 -515
- package/dist/adapter/activeRunSelfHeal.js +10 -625
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -305
- package/dist/adapter/downstream/eventToSdkMessage.js +2 -867
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +2 -314
- package/dist/adapter/downstream/terminalToSdkResult.js +13 -560
- package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +0 -95
- package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -31
- package/dist/adapter/runStream.d.ts +0 -206
- package/dist/adapter/runStream.js +6 -596
- package/dist/adapter/types.d.ts +0 -111
- package/dist/adapter/types.js +0 -29
- package/dist/agentSession/backgroundView.d.ts +0 -106
- package/dist/agentSession/backgroundView.js +3 -49
- package/dist/agentSession/contract.d.ts +0 -98
- package/dist/agentSession/contract.js +0 -12
- package/dist/agentsWireCaps.d.ts +0 -72
- package/dist/agentsWireCaps.js +4 -72
- package/dist/approvalsStreamLiveCapability.d.ts +0 -25
- package/dist/approvalsStreamLiveCapability.js +0 -31
- package/dist/argvFlagValue.d.ts +0 -33
- package/dist/argvFlagValue.js +3 -35
- package/dist/attachmentsWireCaps.d.ts +0 -127
- package/dist/attachmentsWireCaps.js +0 -144
- package/dist/autoModeUnavailable.d.ts +0 -120
- package/dist/autoModeUnavailable.js +0 -144
- package/dist/classifierStatus.d.ts +0 -72
- package/dist/classifierStatus.js +0 -167
- package/dist/classifierVerdictWire.d.ts +0 -54
- package/dist/classifierVerdictWire.js +0 -133
- package/dist/clientContextWireCaps.d.ts +0 -37
- package/dist/clientContextWireCaps.js +0 -36
- package/dist/clientSlice.d.ts +0 -63
- package/dist/clientSlice.js +0 -45
- package/dist/cloudConfigWireCaps.d.ts +0 -86
- package/dist/cloudConfigWireCaps.js +2 -65
- package/dist/compensations.d.ts +0 -52
- package/dist/compensations.js +2 -63
- package/dist/controlRouter.d.ts +2 -208
- package/dist/controlRouter.js +1 -129
- package/dist/coreValuePorts.d.ts +0 -84
- package/dist/coreValuePorts.js +0 -29
- package/dist/decideReceipt.d.ts +0 -110
- package/dist/decideReceipt.js +0 -84
- package/dist/detachWire.d.ts +0 -130
- package/dist/detachWire.js +1 -130
- package/dist/deviceExecutorManagementCapability.d.ts +2 -35
- package/dist/deviceExecutorManagementCapability.js +1 -37
- package/dist/diagnostics.d.ts +0 -8
- package/dist/diagnostics.js +0 -8
- package/dist/diff/patch.d.ts +0 -17
- package/dist/diff/patch.js +0 -19
- package/dist/effectiveFacts.d.ts +0 -40
- package/dist/effectiveFacts.js +0 -22
- package/dist/effortWire.d.ts +0 -11
- package/dist/effortWire.js +0 -12
- package/dist/engineAgentPanelStore.d.ts +0 -169
- package/dist/engineAgentPanelStore.js +13 -293
- package/dist/engineCapReader.d.ts +0 -62
- package/dist/engineCapReader.js +1 -43
- package/dist/engineCapsCache.d.ts +0 -177
- package/dist/engineCapsCache.js +0 -199
- package/dist/engineCapsGenerationGuard.d.ts +0 -2
- package/dist/engineCapsGenerationGuard.js +0 -11
- package/dist/engineErrorCodes.d.ts +1 -316
- package/dist/engineErrorCodes.js +0 -427
- package/dist/engineHttpTools.d.ts +0 -29
- package/dist/engineHttpTools.js +0 -29
- package/dist/engineIdentity.d.ts +0 -83
- package/dist/engineIdentity.js +0 -88
- package/dist/engineInlineTaskStats.d.ts +0 -57
- package/dist/engineInlineTaskStats.js +1 -42
- package/dist/engineNoticeCodes.d.ts +0 -190
- package/dist/engineNoticeCodes.js +0 -182
- package/dist/engineSessionParam.d.ts +0 -30
- package/dist/engineSessionParam.js +0 -52
- package/dist/engineToolLabelStore.d.ts +0 -29
- package/dist/engineToolLabelStore.js +0 -31
- package/dist/engineWireSdk.d.ts +0 -90
- package/dist/engineWireSdk.js +0 -74
- package/dist/engineWireTarget.d.ts +0 -14
- package/dist/engineWireTarget.js +0 -39
- package/dist/env/localeGeo.d.ts +0 -12
- package/dist/env/localeGeo.js +2 -77
- package/dist/env/localeTag.d.ts +0 -34
- package/dist/env/localeTag.js +0 -32
- package/dist/env/uiLanguage.d.ts +0 -13
- package/dist/env/uiLanguage.js +0 -25
- package/dist/envFlag.d.ts +0 -37
- package/dist/envFlag.js +0 -40
- package/dist/executionLaneCapability.d.ts +0 -48
- package/dist/executionLaneCapability.js +0 -54
- package/dist/finalVerifyWire.d.ts +0 -67
- package/dist/finalVerifyWire.js +3 -43
- package/dist/fleet/fleetLedger.d.ts +0 -308
- package/dist/fleet/fleetLedger.js +10 -429
- package/dist/fleet/fleetProjection.d.ts +0 -240
- package/dist/fleet/fleetProjection.js +0 -189
- package/dist/fleet/fleetRowAgentType.d.ts +0 -6
- package/dist/fleet/fleetRowAgentType.js +1 -32
- package/dist/fleet/workflowSizeWarning.d.ts +0 -47
- package/dist/fleet/workflowSizeWarning.js +1 -46
- package/dist/fleetAgentPanelProjection.d.ts +0 -48
- package/dist/fleetAgentPanelProjection.js +8 -173
- package/dist/fleetTaskDesc.d.ts +0 -39
- package/dist/fleetTaskDesc.js +0 -69
- package/dist/forkWireCaps.d.ts +0 -23
- package/dist/forkWireCaps.js +1 -24
- package/dist/gateOutcome.d.ts +0 -140
- package/dist/gateOutcome.js +0 -85
- package/dist/gateVocabulary.d.ts +0 -114
- package/dist/gateVocabulary.js +3 -161
- package/dist/goalStopHook.d.ts +0 -127
- package/dist/goalStopHook.js +0 -178
- package/dist/headlessPermissionModeWire.d.ts +0 -76
- package/dist/headlessPermissionModeWire.js +1 -155
- package/dist/headlessReconnectWire.d.ts +0 -84
- package/dist/headlessReconnectWire.js +13 -67
- package/dist/hitl/approvalDecisionNoteAudit.d.ts +0 -49
- package/dist/hitl/approvalDecisionNoteAudit.js +0 -56
- package/dist/hitl/approvalOutcomeNote.d.ts +0 -2
- package/dist/hitl/approvalOutcomeNote.js +0 -20
- package/dist/hitl/approvalResolution.d.ts +0 -113
- package/dist/hitl/approvalResolution.js +0 -66
- package/dist/hitl/approvalsFeed.d.ts +0 -183
- package/dist/hitl/approvalsFeed.js +12 -243
- package/dist/hitl/armedGateRegistry.d.ts +0 -55
- package/dist/hitl/armedGateRegistry.js +0 -146
- package/dist/hitl/askGateWire.d.ts +0 -86
- package/dist/hitl/askGateWire.js +1 -95
- package/dist/hitl/askParkRowRouting.d.ts +0 -123
- package/dist/hitl/askParkRowRouting.js +1 -89
- package/dist/hitl/crashConverged.d.ts +0 -148
- package/dist/hitl/crashConverged.js +0 -214
- package/dist/hitl/editedRuleTextPrecheck.d.ts +0 -109
- package/dist/hitl/editedRuleTextPrecheck.js +0 -71
- package/dist/hitl/frameRouter.d.ts +0 -134
- package/dist/hitl/frameRouter.js +6 -378
- package/dist/hitl/gateIdentity.d.ts +0 -39
- package/dist/hitl/gateIdentity.js +0 -41
- package/dist/hitl/gateLedger.d.ts +0 -267
- package/dist/hitl/gateLedger.js +0 -121
- package/dist/hitl/hitlBridge.d.ts +7 -431
- package/dist/hitl/hitlBridge.js +7 -476
- package/dist/hitl/hitlHostSurface.d.ts +0 -150
- package/dist/hitl/hitlHostSurface.js +0 -169
- package/dist/hitl/livePendingAsk.d.ts +0 -91
- package/dist/hitl/livePendingAsk.js +0 -74
- package/dist/hitl/localAllowRule.d.ts +0 -62
- package/dist/hitl/localAllowRule.js +1 -33
- package/dist/hitl/parkOwnership.d.ts +0 -56
- package/dist/hitl/parkOwnership.js +0 -22
- package/dist/hitl/parkResolver.d.ts +3 -88
- package/dist/hitl/parkResolver.js +8 -349
- package/dist/hitl/parkRowBirthWait.d.ts +2 -26
- package/dist/hitl/parkRowBirthWait.js +3 -93
- package/dist/hitl/persistedRulesWire.d.ts +23 -371
- package/dist/hitl/persistedRulesWire.js +62 -329
- package/dist/hitl/planReviewWire.d.ts +4 -176
- package/dist/hitl/planReviewWire.js +9 -312
- package/dist/hitl/resumeRunningCard.d.ts +0 -105
- package/dist/hitl/resumeRunningCard.js +0 -105
- package/dist/hitl/sessionPolicyWire.d.ts +11 -191
- package/dist/hitl/sessionPolicyWire.js +0 -149
- package/dist/hitl/suspendedReopen.d.ts +3 -24
- package/dist/hitl/suspendedReopen.js +0 -14
- package/dist/hitl/toolApprovalWire.d.ts +5 -1308
- package/dist/hitl/toolApprovalWire.js +5 -945
- package/dist/hooksWireCaps.d.ts +0 -38
- package/dist/hooksWireCaps.js +0 -190
- package/dist/host.d.ts +0 -105
- package/dist/host.js +0 -33
- package/dist/hostEnv.d.ts +0 -14
- package/dist/hostEnv.js +0 -13
- package/dist/imagesWireCaps.d.ts +0 -21
- package/dist/imagesWireCaps.js +0 -22
- package/dist/index.d.ts +0 -134
- package/dist/index.js +0 -476
- package/dist/interactiveHalt.d.ts +5 -153
- package/dist/interactiveHalt.js +0 -111
- package/dist/interactiveToolsWire.d.ts +0 -62
- package/dist/interactiveToolsWire.js +1 -67
- package/dist/leaderConflict.d.ts +0 -59
- package/dist/leaderConflict.js +0 -48
- package/dist/limitsWire.d.ts +0 -125
- package/dist/limitsWire.js +2 -120
- package/dist/liveInitToolFace.d.ts +0 -77
- package/dist/liveInitToolFace.js +1 -109
- package/dist/liveModelCatalog.d.ts +0 -52
- package/dist/liveModelCatalog.js +0 -48
- package/dist/liveQuestionStore.d.ts +0 -87
- package/dist/liveQuestionStore.js +1 -56
- package/dist/mcpLiveness.d.ts +0 -151
- package/dist/mcpLiveness.js +0 -122
- package/dist/mcpPanel.d.ts +0 -104
- package/dist/mcpPanel.js +0 -49
- package/dist/mcpReconnect.d.ts +0 -58
- package/dist/mcpReconnect.js +0 -69
- package/dist/mcpWireCaps.d.ts +0 -55
- package/dist/mcpWireCaps.js +1 -13
- package/dist/memoryComplianceCapability.d.ts +3 -57
- package/dist/memoryComplianceCapability.js +0 -57
- package/dist/memoryEntriesWire.d.ts +6 -198
- package/dist/memoryEntriesWire.js +0 -144
- package/dist/memoryOriginCapability.d.ts +3 -53
- package/dist/memoryOriginCapability.js +0 -50
- package/dist/memorySpecWire.d.ts +0 -116
- package/dist/memorySpecWire.js +0 -150
- package/dist/model/catalog.d.ts +0 -111
- package/dist/model/catalog.js +0 -87
- package/dist/model/catalogLoader.d.ts +0 -114
- package/dist/model/catalogLoader.js +2 -139
- package/dist/model/modelSupplyRules.d.ts +1 -55
- package/dist/model/modelSupplyRules.js +0 -62
- package/dist/model/providerAuth.d.ts +0 -103
- package/dist/model/providerAuth.js +2 -38
- package/dist/model/providerCatalog.d.ts +0 -45
- package/dist/model/providerCatalog.js +0 -37
- package/dist/model/providerPresets.d.ts +0 -33
- package/dist/model/providerPresets.js +2 -91
- package/dist/model/tierVocabulary.d.ts +0 -31
- package/dist/model/tierVocabulary.js +0 -27
- package/dist/modelBudgetRule.d.ts +0 -39
- package/dist/modelBudgetRule.js +0 -39
- package/dist/modelCapabilityProbe.d.ts +0 -175
- package/dist/modelCapabilityProbe.js +0 -147
- package/dist/modelWireCaps.d.ts +0 -13
- package/dist/modelWireCaps.js +0 -13
- package/dist/notifications.d.ts +0 -233
- package/dist/notifications.js +14 -492
- package/dist/oneShotWireCaps.d.ts +0 -34
- package/dist/oneShotWireCaps.js +0 -35
- package/dist/ownKey.d.ts +0 -33
- package/dist/ownKey.js +0 -33
- package/dist/panelRunningHistory.d.ts +0 -28
- package/dist/panelRunningHistory.js +0 -43
- package/dist/peerFrames.d.ts +0 -71
- package/dist/peerFrames.js +0 -168
- package/dist/peerLaneCapability.d.ts +0 -44
- package/dist/peerLaneCapability.js +0 -52
- package/dist/permissionRuleIssue.d.ts +0 -30
- package/dist/permissionRuleIssue.js +0 -78
- package/dist/permissionRulesWriteCapability.d.ts +0 -46
- package/dist/permissionRulesWriteCapability.js +0 -54
- package/dist/permissionWireCaps.d.ts +0 -37
- package/dist/permissionWireCaps.js +0 -37
- package/dist/postureKnob.d.ts +0 -71
- package/dist/postureKnob.js +0 -86
- package/dist/principalWire.d.ts +0 -17
- package/dist/principalWire.js +0 -17
- package/dist/printToolResultFrame.d.ts +0 -100
- package/dist/printToolResultFrame.js +0 -33
- package/dist/promptProfileWireCaps.d.ts +0 -13
- package/dist/promptProfileWireCaps.js +0 -13
- package/dist/readFacePosture.d.ts +0 -43
- package/dist/readFacePosture.js +0 -46
- package/dist/request/printNotification.d.ts +0 -20
- package/dist/request/printNotification.js +0 -55
- package/dist/request/taskRequest.d.ts +1 -249
- package/dist/request/taskRequest.js +20 -498
- package/dist/resumeRefusalCopy.d.ts +0 -136
- package/dist/resumeRefusalCopy.js +1 -117
- package/dist/retainBackgroundWireCaps.d.ts +0 -48
- package/dist/retainBackgroundWireCaps.js +0 -48
- package/dist/retryStatus.d.ts +2 -221
- package/dist/retryStatus.js +0 -107
- package/dist/rewindWireCaps.d.ts +0 -27
- package/dist/rewindWireCaps.js +0 -24
- package/dist/runCancelContext.d.ts +1 -20
- package/dist/runCancelContext.js +0 -34
- package/dist/runTerminal.d.ts +0 -273
- package/dist/runTerminal.js +0 -177
- package/dist/sandboxWire.d.ts +0 -38
- package/dist/sandboxWire.js +0 -82
- package/dist/scenarioWire.d.ts +0 -60
- package/dist/scenarioWire.js +0 -68
- package/dist/scratchpadWireCaps.d.ts +0 -11
- package/dist/scratchpadWireCaps.js +0 -32
- package/dist/sdkWireTransit.d.ts +0 -38
- package/dist/sdkWireTransit.js +0 -30
- package/dist/seam.d.ts +18 -853
- package/dist/seam.js +0 -52
- package/dist/seatContract.d.ts +0 -555
- package/dist/seatContract.js +5 -304
- package/dist/selfOrchestrationDenial.d.ts +0 -189
- package/dist/selfOrchestrationDenial.js +0 -162
- package/dist/selfOrchestrationWireCaps.d.ts +0 -38
- package/dist/selfOrchestrationWireCaps.js +0 -38
- package/dist/sessionMap.d.ts +0 -60
- package/dist/sessionMap.js +0 -37
- package/dist/sessionMemoryStatus.d.ts +11 -114
- package/dist/sessionMemoryStatus.js +0 -112
- package/dist/sessionModelLatch.d.ts +0 -29
- package/dist/sessionModelLatch.js +0 -40
- package/dist/sessionPolicyCapability.d.ts +3 -53
- package/dist/sessionPolicyCapability.js +0 -52
- package/dist/sessionSlot.d.ts +0 -26
- package/dist/sessionSlot.js +0 -17
- package/dist/skillsWireCaps.d.ts +0 -87
- package/dist/skillsWireCaps.js +0 -38
- package/dist/sqlEngineCapability.d.ts +0 -118
- package/dist/sqlEngineCapability.js +0 -134
- package/dist/sseIdleTriage.d.ts +0 -79
- package/dist/sseIdleTriage.js +1 -80
- package/dist/steering.d.ts +0 -54
- package/dist/steering.js +0 -63
- package/dist/subagent/engineCompactWire.d.ts +0 -34
- package/dist/subagent/engineCompactWire.js +4 -134
- package/dist/subagent/engineDelegatedPrompt.d.ts +0 -31
- package/dist/subagent/engineDelegatedPrompt.js +1 -103
- package/dist/subagent/engineRowStopGate.d.ts +0 -20
- package/dist/subagent/engineRowStopGate.js +0 -49
- package/dist/subagent/engineSubagentOutput.d.ts +0 -7
- package/dist/subagent/engineSubagentOutput.js +1 -51
- package/dist/subagent/engineSubagentResume.d.ts +2 -279
- package/dist/subagent/engineSubagentResume.js +2 -129
- package/dist/subagent/engineSubagentSteer.d.ts +0 -26
- package/dist/subagent/engineSubagentSteer.js +0 -63
- package/dist/subagent/engineSubagentTail.d.ts +0 -38
- package/dist/subagent/engineSubagentTail.js +2 -110
- package/dist/subagent/engineTaskHandleWire.d.ts +6 -67
- package/dist/subagent/engineTaskHandleWire.js +0 -126
- package/dist/subagent/subagentOwnerAbsence.d.ts +0 -2
- package/dist/subagent/subagentOwnerAbsence.js +0 -25
- package/dist/subagentContentStore.d.ts +3 -260
- package/dist/subagentContentStore.js +7 -540
- package/dist/systemReminderTag.d.ts +0 -49
- package/dist/systemReminderTag.js +0 -61
- package/dist/toolResult.d.ts +1 -211
- package/dist/toolResult.js +1 -358
- package/dist/toolRoster.d.ts +0 -140
- package/dist/toolRoster.js +0 -66
- package/dist/typePins.d.ts +0 -46
- package/dist/types/engineState.d.ts +0 -71
- package/dist/types/engineState.js +0 -16
- package/dist/ultracodeWireCaps.d.ts +0 -75
- package/dist/ultracodeWireCaps.js +0 -92
- package/dist/unrefTimer.d.ts +0 -27
- package/dist/webSearchBackendCapability.d.ts +0 -72
- package/dist/webSearchBackendCapability.js +0 -79
- package/dist/webSearchWireCaps.d.ts +0 -37
- package/dist/webSearchWireCaps.js +0 -34
- package/dist/websearch/searchProviderPresets.d.ts +0 -81
- package/dist/websearch/searchProviderPresets.js +0 -27
- package/dist/wireErrorTriage.d.ts +4 -160
- package/dist/wireErrorTriage.js +0 -171
- package/dist/wireRefusalCopy.d.ts +0 -28
- package/dist/wireRefusalCopy.js +0 -28
- package/dist/workflow.d.ts +0 -40
- package/dist/workflow.js +0 -52
- package/dist/workflowClient.d.ts +0 -122
- package/dist/workflowClient.js +8 -360
- package/dist/workflowMonitor.d.ts +2 -72
- package/dist/workflowMonitor.js +0 -26
- package/dist/writeProtectionCapability.d.ts +0 -112
- package/dist/writeProtectionCapability.js +0 -109
- package/docs/INTEGRATION-CLIENTS.md +78 -5
- package/package.json +3 -3
package/dist/mcpReconnect.d.ts
CHANGED
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mcpReconnect — 会话内 MCP re-dial 的**三端共用消费口**(0.72.9 CC-30;server ≥7.85.0 S-381 / core 7.22.0 #857;
|
|
3
|
-
* 契约 §G.7c / 附录 B.1 `mcpReconnect`;sdk 9.6.0 尚未声明端点与体,读口 duck-typed 注入,与 `sessionMemoryStatus` 同款)。
|
|
4
|
-
*
|
|
5
|
-
* ── 这一口答的是哪件事 ────────────────────────────────────────────────────────────────────
|
|
6
|
-
* 传输断了的 stdio MCP server 在不结束任务的前提下**重拨一台具名 server**:`POST /v1/sessions/:id/mcp/reconnect { server }`。
|
|
7
|
-
* 壳只有「重连这台」按钮与结果渲染;判定(三态分臂 / 名册在场性 / 失败分诊 / 交易文案)三端各写一遍必各错一遍 ⇒ 归包。
|
|
8
|
-
*
|
|
9
|
-
* ── 🔴 五条契约读法(§G.7c 逐字)──────────────────────────────────────────────────────────
|
|
10
|
-
* ① `outcome` 是**唯一判别键**,三态全部走 200:`accepted`(core reconnected)/ `refused`(core refused **或** not_declared,
|
|
11
|
-
* wire 上刻意不可区分,子理由骑 `reason`)/ `unsupported`(server 自己的词:这条 run 一台 MCP 都没声明;不是 409、不是 refused)。
|
|
12
|
-
* ② `unsupported` **恒五键**(taskId / sessionId / server / outcome / reason):那条臂没有 core 结果,`prefix` / `toolCount` / `added` /
|
|
13
|
-
* `removed` 编成 `0` / `[]` = 替 core 说一句它没说过的话 ⇒ 本读器**按 outcome 分支再读**;accepted / refused 四座缺一 ⇒ 整只畸形。
|
|
14
|
-
* ③ **名册按 `toolNames` 的在场性**:在场非空 = 对该 `prefix` 域断言的名册(**超集**:core 挂载前还滤一道);在场 `[]` = 拨号失败、
|
|
15
|
-
* 这台的工具被撤走(空数组是一句话);整键缺席 = 这条臂从未碰过连接,挂载名册原样不动。真挂上了什么读 `wiring_manifest.tools`。
|
|
16
|
-
* ④ **下一步动作读 `status.errorCode` / `httpStatus`,不解析 `reason`**:`errorCode` 是 core 十词闭集但 server 不枚举 ⇒ 本读器按**开集**
|
|
17
|
-
* 透传(消费端 switch 必带 default);`delivered` 三词 / `transportClosed` 在场即 true(缺席 = 没观察到关闭,**不是**还活着);
|
|
18
|
-
* `error` / `serverInfo` / `reason` 是远端自由文本 —— UNTRUSTED-for-display,呈前消毒封长。
|
|
19
|
-
* ⑤ **交易,不是刷新**(core 原话,契约 🔴 必进 UI):旧连接在拨新号**之前**就被关 ⇒ 一次失败的重拨花掉一条能用的连接。
|
|
20
|
-
* 壳不许只写「重连」—— 措辞单源 {@link MCP_RECONNECT_TRANSACTION_NOTICE}。
|
|
21
|
-
*
|
|
22
|
-
* ── 失败分诊按 `errorCode` 不按 status(与 `classifyMemoryStatusFailure` 同律)────────────────
|
|
23
|
-
* 422 `steering.invalid_content` ⇒ invalid · 409 `steering.not_running` ⇒ not_running(parked / 终态 / 他副本 / 无活流四臂一码)·
|
|
24
|
-
* 501 `capability.run_store_required` ⇒ unsupported/capability · 404 `not_found.route` ⇒ unsupported/route(老 server 无此路由)·
|
|
25
|
-
* 404 `not_found.session` ⇒ not_found(未知 / 非属主同码同串)· 无码 ⇒ failed(**不猜**)。
|
|
26
|
-
*/
|
|
27
|
-
/** `outcome` 三词(契约 §G.7c;`unsupported` 是 server 的词,core 没有它)。 */
|
|
28
1
|
export declare const MCP_RECONNECT_OUTCOMES: readonly string[];
|
|
29
|
-
/**
|
|
30
|
-
* 「重连 = 一次交易」的**唯一措辞铸点**(三端共用;契约 🔴 这句必须进 UI,壳不许只写「重连」)。
|
|
31
|
-
* 零内部车道词;只说用户能据以决策的事实:旧连接先关、失败则工具撤走、直到再拨成功。
|
|
32
|
-
*/
|
|
33
2
|
export declare const MCP_RECONNECT_TRANSACTION_NOTICE: string;
|
|
34
|
-
/** `status`(这一次拨号的新连接时记录)的八键投影;`errorCode` 开集透传。UNTRUSTED 座已消毒封长。 */
|
|
35
3
|
export interface McpReconnectStatusView {
|
|
36
4
|
name: string;
|
|
37
5
|
status: string;
|
|
@@ -43,18 +11,14 @@ export interface McpReconnectStatusView {
|
|
|
43
11
|
version: string;
|
|
44
12
|
};
|
|
45
13
|
error?: string;
|
|
46
|
-
/** 在场即 `true`(core 永不写 false);缺席 = 没观察到关闭,**不是**「还活着」。 */
|
|
47
14
|
transportClosed?: true;
|
|
48
15
|
}
|
|
49
|
-
/** `listingIncomplete`:这次 `tools/list` 没走完 ⇒ 名册不许当全集(缺的一条是未证明缺席,不是被撤走)。 */
|
|
50
16
|
export interface McpReconnectListingIncompleteView {
|
|
51
17
|
reason: string;
|
|
52
|
-
/** 这次 `tools/list` 走到第几页(server 无条件投;非整数 ⇒ 整只畸形)。 */
|
|
53
18
|
pages: number;
|
|
54
19
|
budgetMs?: number;
|
|
55
20
|
error?: string;
|
|
56
21
|
}
|
|
57
|
-
/** 200 体的读视图 —— **按 `outcome` 分形**(`unsupported` 五键 / 其余四座必填)。 */
|
|
58
22
|
export type McpReconnectResultView = {
|
|
59
23
|
outcome: 'unsupported';
|
|
60
24
|
taskId: string;
|
|
@@ -68,16 +32,13 @@ export type McpReconnectResultView = {
|
|
|
68
32
|
server: string;
|
|
69
33
|
prefix: string;
|
|
70
34
|
toolCount: number;
|
|
71
|
-
/** 带命名空间的工具名(相对「一刻之前它挂载了什么」;失败的拨号移除它原有的全部)。**不是**通告 `mcp.server_redialed` 的计数。 */
|
|
72
35
|
added: string[];
|
|
73
36
|
removed: string[];
|
|
74
|
-
/** present-iff 这次结果对自己的 `prefix` 域做了名册断言(见文件头 ③);缺席 ⇒ 名册原样不动。 */
|
|
75
37
|
toolNames?: string[];
|
|
76
38
|
reason?: string;
|
|
77
39
|
status?: McpReconnectStatusView;
|
|
78
40
|
listingIncomplete?: McpReconnectListingIncompleteView;
|
|
79
41
|
};
|
|
80
|
-
/** 消费口的判决。`ok` 之外五档各是一条不同的下一步;`failed` 原错误带出(端要能看到真因)。 */
|
|
81
42
|
export type McpReconnectVerdict = {
|
|
82
43
|
readonly kind: 'ok';
|
|
83
44
|
readonly result: McpReconnectResultView;
|
|
@@ -94,7 +55,6 @@ export type McpReconnectVerdict = {
|
|
|
94
55
|
readonly kind: 'failed';
|
|
95
56
|
readonly error: unknown;
|
|
96
57
|
};
|
|
97
|
-
/** 宿主注入的读口切片(duck-typed;sdk 9.6.0 没有本方法,壳用自己的传输层接 `POST /v1/sessions/:id/mcp/reconnect`)。 */
|
|
98
58
|
export interface McpReconnectClientLike {
|
|
99
59
|
sessions: {
|
|
100
60
|
mcpReconnect?: (sessionId: string, body: {
|
|
@@ -104,28 +64,10 @@ export interface McpReconnectClientLike {
|
|
|
104
64
|
}) => Promise<unknown>;
|
|
105
65
|
};
|
|
106
66
|
}
|
|
107
|
-
/**
|
|
108
|
-
* 200 体 → 读视图;**畸形一律 `undefined`**(不编、不猜)。按 `outcome` 分形读键(文件头 ①②③④)。
|
|
109
|
-
*/
|
|
110
67
|
export declare function projectMcpReconnectResult(body: unknown): McpReconnectResultView | undefined;
|
|
111
|
-
/** 抛出物 → 判决(按 `errorCode`;与 `classifyMemoryStatusFailure` 同律:无码不猜)。 */
|
|
112
68
|
export declare function classifyMcpReconnectFailure(e: unknown): McpReconnectVerdict;
|
|
113
|
-
/**
|
|
114
|
-
* 「重连这台 MCP」的消费口:**永不抛**。本地先按契约把体门(`server` 非空 ≤ 190)判掉,不发一条注定 400 的请求;
|
|
115
|
-
* 回体经 {@link projectMcpReconnectResult} 投影;**回声身份**(`sessionId` / `server`)与请求逐字相等,否则 `failed`(宁缺席不串台,
|
|
116
|
-
* 与 `readSessionMemoryStatus` 同律)。注入口没有方法 ⇒ `unsupported/route`(壳没接线 = 面不存在)。
|
|
117
|
-
*/
|
|
118
69
|
export declare function reconnectMcpServer(client: McpReconnectClientLike, sessionId: string, server: string, opts?: {
|
|
119
70
|
signal?: AbortSignal;
|
|
120
71
|
}): Promise<McpReconnectVerdict>;
|
|
121
|
-
/**
|
|
122
|
-
* 能力位 `GET /v1/capabilities.mcpReconnect`(设施依赖 = runStore ∧ sessionStorage.ownerOf)的三态读:
|
|
123
|
-
* `available` / `unavailable` / `not_reported`(键缺席 = 老 server <7.85.0 **判不了**,不折 unavailable);坏形 ⇒ `undefined`。
|
|
124
|
-
* 纯投影(caps 体由宿主交,本包不另开 tee:这一位只在按钮亮不亮时读一次)。
|
|
125
|
-
*/
|
|
126
72
|
export declare function projectMcpReconnectCapability(caps: unknown): 'available' | 'unavailable' | 'not_reported' | undefined;
|
|
127
|
-
/**
|
|
128
|
-
* 三态 → 一句结果(**唯一措辞铸点**;三端共用;零内部车道词)。`accepted` 带工具计数;`refused` 说清工具已撤走(交易的代价)并带 reason;
|
|
129
|
-
* `unsupported` 说清是这条 run 的装配(未声明 MCP),不是 refused。
|
|
130
|
-
*/
|
|
131
73
|
export declare function mcpReconnectOutcomeDetail(view: McpReconnectResultView): string;
|
package/dist/mcpReconnect.js
CHANGED
|
@@ -1,41 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mcpReconnect — 会话内 MCP re-dial 的**三端共用消费口**(0.72.9 CC-30;server ≥7.85.0 S-381 / core 7.22.0 #857;
|
|
3
|
-
* 契约 §G.7c / 附录 B.1 `mcpReconnect`;sdk 9.6.0 尚未声明端点与体,读口 duck-typed 注入,与 `sessionMemoryStatus` 同款)。
|
|
4
|
-
*
|
|
5
|
-
* ── 这一口答的是哪件事 ────────────────────────────────────────────────────────────────────
|
|
6
|
-
* 传输断了的 stdio MCP server 在不结束任务的前提下**重拨一台具名 server**:`POST /v1/sessions/:id/mcp/reconnect { server }`。
|
|
7
|
-
* 壳只有「重连这台」按钮与结果渲染;判定(三态分臂 / 名册在场性 / 失败分诊 / 交易文案)三端各写一遍必各错一遍 ⇒ 归包。
|
|
8
|
-
*
|
|
9
|
-
* ── 🔴 五条契约读法(§G.7c 逐字)──────────────────────────────────────────────────────────
|
|
10
|
-
* ① `outcome` 是**唯一判别键**,三态全部走 200:`accepted`(core reconnected)/ `refused`(core refused **或** not_declared,
|
|
11
|
-
* wire 上刻意不可区分,子理由骑 `reason`)/ `unsupported`(server 自己的词:这条 run 一台 MCP 都没声明;不是 409、不是 refused)。
|
|
12
|
-
* ② `unsupported` **恒五键**(taskId / sessionId / server / outcome / reason):那条臂没有 core 结果,`prefix` / `toolCount` / `added` /
|
|
13
|
-
* `removed` 编成 `0` / `[]` = 替 core 说一句它没说过的话 ⇒ 本读器**按 outcome 分支再读**;accepted / refused 四座缺一 ⇒ 整只畸形。
|
|
14
|
-
* ③ **名册按 `toolNames` 的在场性**:在场非空 = 对该 `prefix` 域断言的名册(**超集**:core 挂载前还滤一道);在场 `[]` = 拨号失败、
|
|
15
|
-
* 这台的工具被撤走(空数组是一句话);整键缺席 = 这条臂从未碰过连接,挂载名册原样不动。真挂上了什么读 `wiring_manifest.tools`。
|
|
16
|
-
* ④ **下一步动作读 `status.errorCode` / `httpStatus`,不解析 `reason`**:`errorCode` 是 core 十词闭集但 server 不枚举 ⇒ 本读器按**开集**
|
|
17
|
-
* 透传(消费端 switch 必带 default);`delivered` 三词 / `transportClosed` 在场即 true(缺席 = 没观察到关闭,**不是**还活着);
|
|
18
|
-
* `error` / `serverInfo` / `reason` 是远端自由文本 —— UNTRUSTED-for-display,呈前消毒封长。
|
|
19
|
-
* ⑤ **交易,不是刷新**(core 原话,契约 🔴 必进 UI):旧连接在拨新号**之前**就被关 ⇒ 一次失败的重拨花掉一条能用的连接。
|
|
20
|
-
* 壳不许只写「重连」—— 措辞单源 {@link MCP_RECONNECT_TRANSACTION_NOTICE}。
|
|
21
|
-
*
|
|
22
|
-
* ── 失败分诊按 `errorCode` 不按 status(与 `classifyMemoryStatusFailure` 同律)────────────────
|
|
23
|
-
* 422 `steering.invalid_content` ⇒ invalid · 409 `steering.not_running` ⇒ not_running(parked / 终态 / 他副本 / 无活流四臂一码)·
|
|
24
|
-
* 501 `capability.run_store_required` ⇒ unsupported/capability · 404 `not_found.route` ⇒ unsupported/route(老 server 无此路由)·
|
|
25
|
-
* 404 `not_found.session` ⇒ not_found(未知 / 非属主同码同串)· 无码 ⇒ failed(**不猜**)。
|
|
26
|
-
*/
|
|
27
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
28
|
-
/** `outcome` 三词(契约 §G.7c;`unsupported` 是 server 的词,core 没有它)。 */
|
|
29
2
|
export const MCP_RECONNECT_OUTCOMES = Object.freeze(['accepted', 'refused', 'unsupported']);
|
|
30
|
-
/**
|
|
31
|
-
* 「重连 = 一次交易」的**唯一措辞铸点**(三端共用;契约 🔴 这句必须进 UI,壳不许只写「重连」)。
|
|
32
|
-
* 零内部车道词;只说用户能据以决策的事实:旧连接先关、失败则工具撤走、直到再拨成功。
|
|
33
|
-
*/
|
|
34
3
|
export const MCP_RECONNECT_TRANSACTION_NOTICE = 'Reconnecting closes the current connection before dialing again. On a healthy server this is a transaction, ' +
|
|
35
4
|
'not a refresh: a failed re-dial leaves the server down and withdraws its tools from the model until a later re-dial succeeds.';
|
|
36
5
|
const RECONNECT_TEXT_MAX = 200;
|
|
37
6
|
const RECONNECT_WORD_MAX = 40;
|
|
38
|
-
/** 契约 §G.7c:`server` 非空且 ≤ 190 字符(逐字进 core 运维通告 `detail.server`)。 */
|
|
39
7
|
const SERVER_NAME_MAX = 190;
|
|
40
8
|
const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
41
9
|
const nonEmpty = (v) => typeof v === 'string' && v.length > 0;
|
|
@@ -43,8 +11,6 @@ const stringList = (v) => Array.isArray(v) && v.every((t) => typeof t === 'strin
|
|
|
43
11
|
function projectStatus(raw) {
|
|
44
12
|
if (!isRecord(raw) || !nonEmpty(raw.name) || !nonEmpty(raw.status))
|
|
45
13
|
return undefined;
|
|
46
|
-
// `name` 是**身份键**(core `statuses[name]` 的键,与顶层 `server` 同一事实),不是远端自由文本 ⇒ 原样,不封长(opus 替补复审 [low]);
|
|
47
|
-
// 消毒封长只给 serverInfo / error 两座远端文本。
|
|
48
14
|
const view = { name: raw.name, status: raw.status };
|
|
49
15
|
if (nonEmpty(raw.errorCode))
|
|
50
16
|
view.errorCode = raw.errorCode;
|
|
@@ -63,7 +29,6 @@ function projectStatus(raw) {
|
|
|
63
29
|
return view;
|
|
64
30
|
}
|
|
65
31
|
function projectListingIncomplete(raw) {
|
|
66
|
-
// `reason` / `pages` 必填(server 侧无条件投 pages):缺一 = 读不懂这一格,由调用方判整只畸形(在场但坏形 ≠ 缺席)。
|
|
67
32
|
if (!isRecord(raw) || !nonEmpty(raw.reason))
|
|
68
33
|
return undefined;
|
|
69
34
|
if (typeof raw.pages !== 'number' || !Number.isInteger(raw.pages) || raw.pages < 0)
|
|
@@ -75,9 +40,6 @@ function projectListingIncomplete(raw) {
|
|
|
75
40
|
view.error = capForDisplay(raw.error, RECONNECT_TEXT_MAX);
|
|
76
41
|
return view;
|
|
77
42
|
}
|
|
78
|
-
/**
|
|
79
|
-
* 200 体 → 读视图;**畸形一律 `undefined`**(不编、不猜)。按 `outcome` 分形读键(文件头 ①②③④)。
|
|
80
|
-
*/
|
|
81
43
|
export function projectMcpReconnectResult(body) {
|
|
82
44
|
if (!isRecord(body))
|
|
83
45
|
return undefined;
|
|
@@ -88,14 +50,11 @@ export function projectMcpReconnectResult(body) {
|
|
|
88
50
|
return undefined;
|
|
89
51
|
const base = { taskId: body.taskId, sessionId: body.sessionId, server: body.server };
|
|
90
52
|
if (outcome === 'unsupported') {
|
|
91
|
-
// 恒五键:其余键真出现了也不过境。`reason` 是人读文本(server 侧可为空)—— `outcome` 才是唯一判别键,
|
|
92
|
-
// 一句人读文本不许把判别键整只报废(opus 替补复审 [low]):缺席 / 空串 ⇒ 视图无 reason 键。
|
|
93
53
|
const u = { outcome: 'unsupported', ...base };
|
|
94
54
|
if (nonEmpty(body.reason))
|
|
95
55
|
u.reason = capForDisplay(body.reason, RECONNECT_TEXT_MAX);
|
|
96
56
|
return u;
|
|
97
57
|
}
|
|
98
|
-
// accepted / refused:四座必填(core 型上必填,server 原样投),缺一整只畸形。
|
|
99
58
|
const added = stringList(body.added);
|
|
100
59
|
const removed = stringList(body.removed);
|
|
101
60
|
if (!nonEmpty(body.prefix) || typeof body.toolCount !== 'number' || !Number.isInteger(body.toolCount) || body.toolCount < 0)
|
|
@@ -110,8 +69,6 @@ export function projectMcpReconnectResult(body) {
|
|
|
110
69
|
added,
|
|
111
70
|
removed,
|
|
112
71
|
};
|
|
113
|
-
// 🔴 「在场但坏形」≠「缺席」(opus 替补复审 [medium]×2):`toolNames` 缺席 = 名册别动、`listingIncomplete` 缺席 = 名册走完了,
|
|
114
|
-
// 两者在契约上都是**正面指令**;把读不懂的那一格折成缺席 = 替 server 下一条它没下的指令 ⇒ 在场但坏形一律整只畸形。
|
|
115
72
|
if ('toolNames' in body && body.toolNames !== undefined) {
|
|
116
73
|
const toolNames = stringList(body.toolNames);
|
|
117
74
|
if (toolNames === undefined)
|
|
@@ -131,10 +88,7 @@ export function projectMcpReconnectResult(body) {
|
|
|
131
88
|
}
|
|
132
89
|
return view;
|
|
133
90
|
}
|
|
134
|
-
/** 抛出物 → 判决(按 `errorCode`;与 `classifyMemoryStatusFailure` 同律:无码不猜)。 */
|
|
135
91
|
export function classifyMcpReconnectFailure(e) {
|
|
136
|
-
// 🔴 读 `errorCode` 本身包在 try 里(异源对抗复审 [medium]):拒因可以是 Proxy / 带抛 getter 的对象,读一个属性就抛 ⇒
|
|
137
|
-
// 分诊器抛穿「永不抛」。读不出 = 判不出码 ⇒ failed,原拒因原样带出。
|
|
138
92
|
let code;
|
|
139
93
|
try {
|
|
140
94
|
code = typeof e === 'object' && e !== null ? e.errorCode : undefined;
|
|
@@ -146,8 +100,6 @@ export function classifyMcpReconnectFailure(e) {
|
|
|
146
100
|
return { kind: 'invalid' };
|
|
147
101
|
if (code === 'steering.not_running')
|
|
148
102
|
return { kind: 'not_running' };
|
|
149
|
-
// 501 两码并列(附录 B.1:缺 sessionStorage.ownerOf ⇒ `capability.session_ownership_required`,缺 run 账面 ⇒ `capability.run_store_required`)
|
|
150
|
-
// ⇒ 前缀族开集(opus 替补复审 [medium]);`feature.*` = 面在但开关关着,与 capability 分列(与 memory-status 分诊同律)。
|
|
151
103
|
if (typeof code === 'string' && code.startsWith('capability.'))
|
|
152
104
|
return { kind: 'unsupported', reason: 'capability' };
|
|
153
105
|
if (typeof code === 'string' && code.startsWith('feature.'))
|
|
@@ -158,11 +110,6 @@ export function classifyMcpReconnectFailure(e) {
|
|
|
158
110
|
return { kind: 'not_found' };
|
|
159
111
|
return { kind: 'failed', error: e };
|
|
160
112
|
}
|
|
161
|
-
/**
|
|
162
|
-
* 「重连这台 MCP」的消费口:**永不抛**。本地先按契约把体门(`server` 非空 ≤ 190)判掉,不发一条注定 400 的请求;
|
|
163
|
-
* 回体经 {@link projectMcpReconnectResult} 投影;**回声身份**(`sessionId` / `server`)与请求逐字相等,否则 `failed`(宁缺席不串台,
|
|
164
|
-
* 与 `readSessionMemoryStatus` 同律)。注入口没有方法 ⇒ `unsupported/route`(壳没接线 = 面不存在)。
|
|
165
|
-
*/
|
|
166
113
|
export async function reconnectMcpServer(client, sessionId, server, opts) {
|
|
167
114
|
if (!nonEmpty(sessionId))
|
|
168
115
|
return { kind: 'invalid' };
|
|
@@ -172,12 +119,9 @@ export async function reconnectMcpServer(client, sessionId, server, opts) {
|
|
|
172
119
|
const verb = client?.sessions?.mcpReconnect;
|
|
173
120
|
if (typeof verb !== 'function')
|
|
174
121
|
return { kind: 'unsupported', reason: 'route' };
|
|
175
|
-
// 🔴 本地取消闸(异源复审第二轮 [medium]):signal 只转交给注入口不够 —— 壳的传输若忽略它,用户已撤销的操作仍会关掉一条
|
|
176
|
-
// 健康连接并重拨(失败则工具撤走)。破坏性动词在「用户说停」之后一发都不许出。
|
|
177
122
|
if (opts?.signal?.aborted === true) {
|
|
178
123
|
return { kind: 'failed', error: opts.signal.reason ?? new Error('mcpReconnect: aborted before the verb was called') };
|
|
179
124
|
}
|
|
180
|
-
// 方法形调用保接收者(真 SDK 资源方法体走 this.t.request)。
|
|
181
125
|
const raw = await client.sessions.mcpReconnect(sessionId, { server }, opts?.signal ? { signal: opts.signal } : undefined);
|
|
182
126
|
const view = projectMcpReconnectResult(raw);
|
|
183
127
|
if (view === undefined)
|
|
@@ -190,15 +134,9 @@ export async function reconnectMcpServer(client, sessionId, server, opts) {
|
|
|
190
134
|
return classifyMcpReconnectFailure(e);
|
|
191
135
|
}
|
|
192
136
|
}
|
|
193
|
-
/**
|
|
194
|
-
* 能力位 `GET /v1/capabilities.mcpReconnect`(设施依赖 = runStore ∧ sessionStorage.ownerOf)的三态读:
|
|
195
|
-
* `available` / `unavailable` / `not_reported`(键缺席 = 老 server <7.85.0 **判不了**,不折 unavailable);坏形 ⇒ `undefined`。
|
|
196
|
-
* 纯投影(caps 体由宿主交,本包不另开 tee:这一位只在按钮亮不亮时读一次)。
|
|
197
|
-
*/
|
|
198
137
|
export function projectMcpReconnectCapability(caps) {
|
|
199
138
|
if (!isRecord(caps))
|
|
200
139
|
return undefined;
|
|
201
|
-
// 🔴 只认自有键(0.77.1 CC-107,外部验收 [7807]):原型链上的同名键永远不会被序列化上 wire,读成在场 = 凭空造一格;与读器工厂族同律。
|
|
202
140
|
if (!Object.hasOwn(caps, 'mcpReconnect') || caps.mcpReconnect === undefined)
|
|
203
141
|
return 'not_reported';
|
|
204
142
|
if (caps.mcpReconnect === true)
|
|
@@ -207,19 +145,12 @@ export function projectMcpReconnectCapability(caps) {
|
|
|
207
145
|
return 'unavailable';
|
|
208
146
|
return undefined;
|
|
209
147
|
}
|
|
210
|
-
/**
|
|
211
|
-
* 三态 → 一句结果(**唯一措辞铸点**;三端共用;零内部车道词)。`accepted` 带工具计数;`refused` 说清工具已撤走(交易的代价)并带 reason;
|
|
212
|
-
* `unsupported` 说清是这条 run 的装配(未声明 MCP),不是 refused。
|
|
213
|
-
*/
|
|
214
148
|
export function mcpReconnectOutcomeDetail(view) {
|
|
215
149
|
const name = capForDisplay(view.server, RECONNECT_WORD_MAX);
|
|
216
150
|
switch (view.outcome) {
|
|
217
151
|
case 'accepted':
|
|
218
152
|
return `MCP server ${name} was re-dialed: ${view.toolCount} tool${view.toolCount === 1 ? '' : 's'} mounted (${view.added.length} added, ${view.removed.length} removed)`;
|
|
219
153
|
case 'refused': {
|
|
220
|
-
// 🔴 名册按 toolNames 在场性分三句(异源对抗复审 [medium]:此前无条件说「工具已撤走」,把未知名 / 重拨在飞 / 已撤销这些
|
|
221
|
-
// **没碰连接**的拒绝也说成撤了工具,误导用户再来一次破坏性重拨):
|
|
222
|
-
// 缺席 = 这条臂从未碰过连接,名册未动;[] = 拨号失败,工具撤走;非空 = 拒了但对该 prefix 域做了名册断言,如实报数。
|
|
223
154
|
const why = view.reason !== undefined ? ` — ${view.reason}` : '';
|
|
224
155
|
if (view.toolNames === undefined) {
|
|
225
156
|
return `MCP server ${name} was NOT re-dialed; its connection and tools were left untouched${why}`;
|
package/dist/mcpWireCaps.d.ts
CHANGED
|
@@ -1,46 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ⇄ B2 批搬迁(2026-07-27,多端改造设计稿 §3 B2):cli src/sema/mcpWireCaps.ts 逐字搬入(只 import SDK)。
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* src/sema/mcpWireCaps.ts — PURE projection: CC `.mcp.json` server config → core `McpServerSpec` (the wire
|
|
6
|
-
* shape `TaskRequest.mcpServers` carries). Split from mcpWire.ts so it's testable without the heavy
|
|
7
|
-
* `.mcp.json` loader graph (services/mcp/config.ts). Imports only the SDK type (erased at build).
|
|
8
|
-
*
|
|
9
|
-
* core `McpServerSpec.transport` supports ONLY `stdio` + `http` (StreamableHTTP). CC also has sse/sse-ide/
|
|
10
|
-
* ws/ws-ide — core can't mount those (the SSE/WS transport gap, tracked separately) → we SKIP them here
|
|
11
|
-
* (returning null) rather than mis-map. stdio→stdio, http→http; name = the `.mcp.json` record key.
|
|
12
|
-
*
|
|
13
|
-
* Trust: the SHELL only PROJECTS the user's local config; the SERVICE single-user gate (mcpInjectionHonored
|
|
14
|
-
* = requirePrincipal!==true) decides whether to honor it (fail-closed on multi-tenant). So projecting is safe.
|
|
15
|
-
*
|
|
16
|
-
* ── 🔴 0.64.2:逐键白名单重建的**丢键面**(cli L-167①,包侧缺陷)───────────────────────────────
|
|
17
|
-
* 本文件的两条 transport 臂是**逐键重建**(`{name, transport:{…}, allowTools}`),不是 `...c` 全展开。
|
|
18
|
-
* 这是有意的 —— 全展开会把用户 `.mcp.json` 里的任意键原样送上 wire,而 `TaskRequest.mcpServers` 是
|
|
19
|
-
* 引擎的请求面,多一个引擎不认的键既没人判形也没人负责。代价是本仓一贯要根治的那个病形:
|
|
20
|
-
* **上游 additive 加了一个真键,而这条闭集重建静默把它剥掉**([C170] / `hasBidiControls` /
|
|
21
|
-
* 窗三键的同一形)。`toolFaces` 就是这么丢的 —— 运维在 `.mcp.json` 上声明的 per-tool 面(写围栏读的
|
|
22
|
-
* `pathTarget` 那一格)到不了引擎,而**两侧看起来都对**:配置文件里写着,引擎那边只是「没有声明」。
|
|
23
|
-
* ⇒ 处置 = **按上游的透明键表逐名透传**,不是改成全展开。表的属主是 `@sema-agent/settings-schema`
|
|
24
|
-
* 的 mcp 段(`McpServerSpec` 上 `z.unknown()` 的那些键;1.10.0 实装两员:`source` 1.7.2 / `toolFaces`
|
|
25
|
-
* 1.9.0),判据逐字是「解析透明」:形的校验属**引擎摄入侧**,本层一个字节不改也不拒。
|
|
26
|
-
* 🔴 **`source` 今天不在本条腿上**:它是**部署面**(`config.d/mcp.json` / `/effective.mcp`)的分组
|
|
27
|
-
* 标签,消费者是 server;**请求面**的 `McpServerSpec`(sdk 8.8.0 `types.d.ts`)上根本没有这个键 ——
|
|
28
|
-
* 往这里塞它是给 wire 加一个引擎不认的键,而不是透传一件事实。上游哪天把它加到请求面上,
|
|
29
|
-
* 本表按同一条规矩加一行(门里那条「透明键表 ⇄ 本腿透传集」的对账当天红)。
|
|
30
|
-
*/
|
|
31
1
|
import type { TaskRequest } from '@sema-agent/sdk';
|
|
32
|
-
/** The wire shape `TaskRequest.mcpServers` carries. SDK 0.0.44's index no longer re-exports the
|
|
33
|
-
* `McpServerSpec` interface by name (types.d.ts still defines it), so derive it STRUCTURALLY from the
|
|
34
|
-
* exported `TaskRequest` — always exactly what the wire accepts, no drift. Re-exported for the shell
|
|
35
|
-
* (mcpWire.ts / seamQuery.ts import it from HERE, not @sema-ai/sdk). */
|
|
36
2
|
export type McpServerSpec = NonNullable<TaskRequest['mcpServers']>[number];
|
|
37
|
-
/** Server caps mirror the service merge cap (task-mcp.ts: ≤32, fail-closed on malformed). */
|
|
38
3
|
export declare const MCP_CAPS: {
|
|
39
4
|
readonly items: 32;
|
|
40
5
|
};
|
|
41
|
-
/** Structural subset of CC's `McpServerConfig` union (services/mcp/types.ts) this projection reads. */
|
|
42
6
|
export interface McpConfigLike {
|
|
43
|
-
/** discriminator; absent ⇒ stdio (CC: type optional for stdio, back-compat). */
|
|
44
7
|
type?: string;
|
|
45
8
|
command?: string;
|
|
46
9
|
args?: string[];
|
|
@@ -48,25 +11,7 @@ export interface McpConfigLike {
|
|
|
48
11
|
url?: string;
|
|
49
12
|
headers?: Record<string, string>;
|
|
50
13
|
allowTools?: string[];
|
|
51
|
-
/**
|
|
52
|
-
* **透明键**(settings-schema 1.9.0 引入 `McpServerSpec.toolFaces`,`z.unknown()`,2.0.0 同形〔2026-09-16 核 dist/types.d.ts〕;core 7.8.0 design/388
|
|
53
|
-
* 片 1 F7 / server ≥7.66.0)—— 这台 server 的 per-tool 面覆盖层,键 = 工具**裸名**,值形
|
|
54
|
-
* `{ family?, pathTarget?, renderHints?, ruleFace? }`(表的属主是 core,见 sdk `McpToolFace`)。
|
|
55
|
-
*
|
|
56
|
-
* 🔴 **类型是 `unknown`,而且是有意的**:上游把这一格声明成解析透明,理由逐字是「这一域
|
|
57
|
-
* all-or-nothing,任一字段解析拒都会让整套 mcp 服务器静默消失」。本层照抄那条判据 ——
|
|
58
|
-
* **不校形、不改写、不按名剥**,坏形也原样过境。
|
|
59
|
-
* 🔴 **坏形的处置在引擎,不在这里**:JSON 形写坏或出现读器不认的键 ⇒ 引擎让**整条 server 不进**
|
|
60
|
-
* 并在请求腿 `mcp_injection_dropped{dropped:[name]}` 点名;形合而语义坏(`pathTarget.param` 不在
|
|
61
|
-
* 工具物化后的 schema 上)⇒ 引擎拒**那一只**工具并出 `config.tool_face_invalid` 通告。
|
|
62
|
-
* 包在这里替引擎判一次形,只有两种结局:判严了 ⇒ 运维声明的保护被**静默**吞掉(比引擎响亮拒
|
|
63
|
-
* 更坏);判松了 ⇒ 白写一道会漂的第二判官。
|
|
64
|
-
* 缺席 ⇒ 键不铸(`.mcp.json` 是 JSON,`undefined` 只可能来自「没写」)。
|
|
65
|
-
*/
|
|
66
14
|
toolFaces?: unknown;
|
|
67
15
|
}
|
|
68
|
-
/** Map one CC `.mcp.json` server → core `McpServerSpec`, or null when the transport isn't core-supported
|
|
69
|
-
* (sse/sse-ide/ws/ws-ide) or required fields are missing. */
|
|
70
16
|
export declare function mcpConfigToSpec(name: string, c: McpConfigLike): McpServerSpec | null;
|
|
71
|
-
/** Project a `.mcp.json` server map → capped `McpServerSpec[]` (skips unsupported transports + malformed). */
|
|
72
17
|
export declare function mcpConfigsToSpecs(servers: Record<string, McpConfigLike> | undefined): McpServerSpec[];
|
package/dist/mcpWireCaps.js
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
/** Server caps mirror the service merge cap (task-mcp.ts: ≤32, fail-closed on malformed). */
|
|
2
1
|
export const MCP_CAPS = { items: 32 };
|
|
3
|
-
/**
|
|
4
|
-
* 透明键的**原样过境**格(0.64.2)—— 见 {@link McpConfigLike.toolFaces} 与模块顶注。
|
|
5
|
-
* 键在场即铸(`undefined` = 没写),值一个字节不动;`null` / 串 / 数组这些坏形照样过境,由引擎判。
|
|
6
|
-
* 🔴 cast 到 wire 形是**类型面的**让位,不是运行期校验:请求面 `McpServerSpec.toolFaces` 的声明是
|
|
7
|
-
* `Record<string, McpToolFace>`(sdk 8.8.0),而透明键的契约是「什么 JSON 值都可能到」——
|
|
8
|
-
* 在这里按声明形收窄就等于把坏形剥掉,正是本批要修的病。
|
|
9
|
-
*/
|
|
10
2
|
function transparentKeys(c) {
|
|
11
3
|
return c.toolFaces !== undefined ? { toolFaces: c.toolFaces } : {};
|
|
12
4
|
}
|
|
13
|
-
/** Map one CC `.mcp.json` server → core `McpServerSpec`, or null when the transport isn't core-supported
|
|
14
|
-
* (sse/sse-ide/ws/ws-ide) or required fields are missing. */
|
|
15
5
|
export function mcpConfigToSpec(name, c) {
|
|
16
6
|
const n = (name ?? '').trim();
|
|
17
7
|
if (!n)
|
|
18
8
|
return null;
|
|
19
|
-
const kind = c.type ?? 'stdio';
|
|
9
|
+
const kind = c.type ?? 'stdio';
|
|
20
10
|
if (kind === 'stdio') {
|
|
21
11
|
if (!c.command)
|
|
22
12
|
return null;
|
|
@@ -46,10 +36,8 @@ export function mcpConfigToSpec(name, c) {
|
|
|
46
36
|
...transparentKeys(c),
|
|
47
37
|
};
|
|
48
38
|
}
|
|
49
|
-
// sse / sse-ide / ws / ws-ide → core McpServerSpec has no such transport (StreamableHTTP only) → skip.
|
|
50
39
|
return null;
|
|
51
40
|
}
|
|
52
|
-
/** Project a `.mcp.json` server map → capped `McpServerSpec[]` (skips unsupported transports + malformed). */
|
|
53
41
|
export function mcpConfigsToSpecs(servers) {
|
|
54
42
|
const out = [];
|
|
55
43
|
for (const [name, c] of Object.entries(servers ?? {})) {
|
|
@@ -1,73 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* memoryComplianceCapability — `GET /v1/capabilities.memoryCompliance` 的三端共用读面(0.76.1 CC-97a;
|
|
3
|
-
* 与 sql / writeProtection / webSearch.backend / executionLane / approvalsStreamLive /
|
|
4
|
-
* deviceExecutor.management 诸只兄弟同一套四态词汇,四口走共用工厂 {@link createEngineCapReader})。
|
|
5
|
-
*
|
|
6
|
-
* ── 这一位答的是哪一个问题 ────────────────────────────────────────────────────────────────
|
|
7
|
-
* 「**出处问询 / 抹除**两口(`GET /v1/memory/entries/:entryId/provenance` ·
|
|
8
|
-
* `POST /v1/memory/erase`,operator 车道)在这台引擎上在不在」。引擎侧的谓词是**两项合取**:
|
|
9
|
-
* ① 合规面挂上了 —— 挂载期判后端自带引擎控制面归属,缺则整口不挂;
|
|
10
|
-
* ② 这台部署的 operator 名单**非空** —— 空名单下两口对任何身份恒 403。
|
|
11
|
-
* ⚠️ 位为真**只**保证「门能过 + 面在场」,**不**保证这一次调用成功:控制面账本损坏是**运行期**事实
|
|
12
|
-
* (typed 500),引擎刻意不把它编进部署级布尔。
|
|
13
|
-
* ⚠️ 与「治理携出 bundle」那一位**不同源**:两位的第一项查的是后端的**不同面**,一个部署可以有 bundle
|
|
14
|
-
* 复合面而没有控制面归属,反之亦然 —— 任一侧都不许拿来替另一侧作答(合成一位会对其中一半撒谎)。
|
|
15
|
-
* ⚠️ 与 `memoryOrigin`(外源标记人面三口)**同判据不同位**:两族今天查后端的同一个面,但它们是**两个
|
|
16
|
-
* 产品面**,一个部署可以只开其中一族。引擎刻意不合并,即使今天两位恒同值 ⇒ **本包也不合并**:
|
|
17
|
-
* 两只读器各持一张 per-baseUrl 表,一只收到读不懂的回体只删自己那一格
|
|
18
|
-
* ({@link observedMemoryOrigin} 的读数一字不变)。
|
|
19
|
-
*
|
|
20
|
-
* ── 🔴 读法 ─────────────────────────────────────────────────────────────────────────────────
|
|
21
|
-
* ① 引擎铸这一位时**恒在场**(一格布尔,不是条件在场)⇒ **键缺席 = 老引擎根本不报这一位** ⇒
|
|
22
|
-
* `not_reported`(判不出)。折成 `false` 就是替引擎断言「这台没有合规面」。
|
|
23
|
-
* ② `false` 是**明确的否** ⇒ `absent`。wire 上分不出「后端没有控制面归属」与「operator 名单为空」
|
|
24
|
-
* 两种成因(引擎的谓词是合取,回体只有一格布尔)⇒ 措辞**不推因由**。
|
|
25
|
-
* ③ 严格布尔;`null` / 串 / `0` / `1` / 数组 / 对象一律畸形 ⇒ 删格 ⇒ `unobserved`,🔴 绝不折 `absent`
|
|
26
|
-
* (读不懂与「明确的否」是两回事)。
|
|
27
|
-
* ③b caps 回体本身不是对象(`null` / 数组 / 串 / 数)⇒ 畸形删格,**不是** `not_reported`(那一态只说「这是
|
|
28
|
-
* 一份 caps,但没有这一格」)。
|
|
29
|
-
* ④ 判在场用 `hasOwn`:原型链上的同名键永远不会被序列化上 wire,把它读成在场就是凭空造一格读数。
|
|
30
|
-
* ⑤ 「两口能不能用」的判据归包:{@link memoryComplianceVerbsAvailable} —— 只有 `present` 才 `'yes'`,
|
|
31
|
-
* `absent` ⇒ `'no'`(明确的否),其余 ⇒ `'unknown'`(端按 501 试探,不预判)。
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* 记忆治理面缺席时两族(合规两口 / 外源三口)共用的 501 码 —— **本包唯一铸点**,
|
|
35
|
-
* {@link memoryComplianceDoctorDetail} 与 {@link import('./memoryOriginCapability.js')} 的措辞表都取这一个常量,
|
|
36
|
-
* 两处不许各写一遍字面(码字面漂移时只有一处要改)。
|
|
37
|
-
*/
|
|
38
1
|
export declare const MEMORY_ENGINE_REQUIRED_CODE = "capability.memory_engine_required";
|
|
39
|
-
/** 四态读数。`unobserved` 由读口在这一格空缺时铸,不由投影铸。 */
|
|
40
2
|
export type MemoryComplianceReading = {
|
|
41
3
|
kind: 'unobserved';
|
|
42
|
-
}
|
|
43
|
-
/** 键缺席:老引擎不报这一位 ⇒ 判不出(**不是** `absent`)。 */
|
|
44
|
-
| {
|
|
4
|
+
} | {
|
|
45
5
|
kind: 'not_reported';
|
|
46
|
-
}
|
|
47
|
-
/** 位在场且为 `false`:这台部署上两口用不了(成因在 wire 上不可分)。 */
|
|
48
|
-
| {
|
|
6
|
+
} | {
|
|
49
7
|
kind: 'absent';
|
|
50
|
-
}
|
|
51
|
-
/** 位在场且为 `true`:门能过 + 面在场(不承诺这一次调用成功)。 */
|
|
52
|
-
| {
|
|
8
|
+
} | {
|
|
53
9
|
kind: 'present';
|
|
54
10
|
};
|
|
55
|
-
/** caps 回体 → 本格读数;畸形一律 `undefined`(= 这一格不写 ⇒ 读口答 `unobserved`)。 */
|
|
56
11
|
export declare function projectMemoryComplianceCapability(caps: unknown): MemoryComplianceReading | undefined;
|
|
57
|
-
/** 宿主 caps probe 的读面 tee 落点(与诸只兄弟并列)。绝不 throw;畸形 ⇒ 删格;`opts.generation` 关掉旧探测覆盖新读数的竞态。 */
|
|
58
12
|
export declare function noteEngineCapsForMemoryCompliance(baseUrl: string, caps: unknown, opts?: {
|
|
59
13
|
generation?: number;
|
|
60
14
|
}): void;
|
|
61
|
-
/** 本进程观测到的读数;这一格空缺 ⇒ `{kind:'unobserved'}`。 */
|
|
62
15
|
export declare function observedMemoryCompliance(baseUrl?: string | undefined): MemoryComplianceReading;
|
|
63
|
-
/**
|
|
64
|
-
* 「出处问询 / 抹除两口能不能用」的判据单源(三态):只有引擎明说在场才 `'yes'`;明说不在 ⇒ `'no'`;
|
|
65
|
-
* 老引擎不报 / 从没观测 ⇒ `'unknown'`(端按 501 试探,不预判,也不预先藏掉入口)。
|
|
66
|
-
*/
|
|
67
16
|
export declare function memoryComplianceVerbsAvailable(reading: MemoryComplianceReading): 'yes' | 'no' | 'unknown';
|
|
68
|
-
/** doctor 那一行的 detail 串,唯一措辞真源。🔴 两种「读不出」的句子都不许暗示「这台没有合规面」。 */
|
|
69
17
|
export declare function memoryComplianceDoctorDetail(reading: MemoryComplianceReading): string;
|
|
70
|
-
/** 换代失效口(引擎温切成功后调):清成未观测。空串 ⇒ no-op;绝不 throw。 */
|
|
71
18
|
export declare function forgetMemoryComplianceReading(baseUrl: string | undefined): void;
|
|
72
|
-
/** 测试钩子。 */
|
|
73
19
|
export declare function __resetMemoryComplianceReadingsForTests(): void;
|
|
@@ -1,53 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* memoryComplianceCapability — `GET /v1/capabilities.memoryCompliance` 的三端共用读面(0.76.1 CC-97a;
|
|
3
|
-
* 与 sql / writeProtection / webSearch.backend / executionLane / approvalsStreamLive /
|
|
4
|
-
* deviceExecutor.management 诸只兄弟同一套四态词汇,四口走共用工厂 {@link createEngineCapReader})。
|
|
5
|
-
*
|
|
6
|
-
* ── 这一位答的是哪一个问题 ────────────────────────────────────────────────────────────────
|
|
7
|
-
* 「**出处问询 / 抹除**两口(`GET /v1/memory/entries/:entryId/provenance` ·
|
|
8
|
-
* `POST /v1/memory/erase`,operator 车道)在这台引擎上在不在」。引擎侧的谓词是**两项合取**:
|
|
9
|
-
* ① 合规面挂上了 —— 挂载期判后端自带引擎控制面归属,缺则整口不挂;
|
|
10
|
-
* ② 这台部署的 operator 名单**非空** —— 空名单下两口对任何身份恒 403。
|
|
11
|
-
* ⚠️ 位为真**只**保证「门能过 + 面在场」,**不**保证这一次调用成功:控制面账本损坏是**运行期**事实
|
|
12
|
-
* (typed 500),引擎刻意不把它编进部署级布尔。
|
|
13
|
-
* ⚠️ 与「治理携出 bundle」那一位**不同源**:两位的第一项查的是后端的**不同面**,一个部署可以有 bundle
|
|
14
|
-
* 复合面而没有控制面归属,反之亦然 —— 任一侧都不许拿来替另一侧作答(合成一位会对其中一半撒谎)。
|
|
15
|
-
* ⚠️ 与 `memoryOrigin`(外源标记人面三口)**同判据不同位**:两族今天查后端的同一个面,但它们是**两个
|
|
16
|
-
* 产品面**,一个部署可以只开其中一族。引擎刻意不合并,即使今天两位恒同值 ⇒ **本包也不合并**:
|
|
17
|
-
* 两只读器各持一张 per-baseUrl 表,一只收到读不懂的回体只删自己那一格
|
|
18
|
-
* ({@link observedMemoryOrigin} 的读数一字不变)。
|
|
19
|
-
*
|
|
20
|
-
* ── 🔴 读法 ─────────────────────────────────────────────────────────────────────────────────
|
|
21
|
-
* ① 引擎铸这一位时**恒在场**(一格布尔,不是条件在场)⇒ **键缺席 = 老引擎根本不报这一位** ⇒
|
|
22
|
-
* `not_reported`(判不出)。折成 `false` 就是替引擎断言「这台没有合规面」。
|
|
23
|
-
* ② `false` 是**明确的否** ⇒ `absent`。wire 上分不出「后端没有控制面归属」与「operator 名单为空」
|
|
24
|
-
* 两种成因(引擎的谓词是合取,回体只有一格布尔)⇒ 措辞**不推因由**。
|
|
25
|
-
* ③ 严格布尔;`null` / 串 / `0` / `1` / 数组 / 对象一律畸形 ⇒ 删格 ⇒ `unobserved`,🔴 绝不折 `absent`
|
|
26
|
-
* (读不懂与「明确的否」是两回事)。
|
|
27
|
-
* ③b caps 回体本身不是对象(`null` / 数组 / 串 / 数)⇒ 畸形删格,**不是** `not_reported`(那一态只说「这是
|
|
28
|
-
* 一份 caps,但没有这一格」)。
|
|
29
|
-
* ④ 判在场用 `hasOwn`:原型链上的同名键永远不会被序列化上 wire,把它读成在场就是凭空造一格读数。
|
|
30
|
-
* ⑤ 「两口能不能用」的判据归包:{@link memoryComplianceVerbsAvailable} —— 只有 `present` 才 `'yes'`,
|
|
31
|
-
* `absent` ⇒ `'no'`(明确的否),其余 ⇒ `'unknown'`(端按 501 试探,不预判)。
|
|
32
|
-
*/
|
|
33
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
34
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
35
|
-
/**
|
|
36
|
-
* 记忆治理面缺席时两族(合规两口 / 外源三口)共用的 501 码 —— **本包唯一铸点**,
|
|
37
|
-
* {@link memoryComplianceDoctorDetail} 与 {@link import('./memoryOriginCapability.js')} 的措辞表都取这一个常量,
|
|
38
|
-
* 两处不许各写一遍字面(码字面漂移时只有一处要改)。
|
|
39
|
-
*/
|
|
40
3
|
export const MEMORY_ENGINE_REQUIRED_CODE = 'capability.memory_engine_required';
|
|
41
|
-
/** caps 回体 → 本格读数;畸形一律 `undefined`(= 这一格不写 ⇒ 读口答 `unobserved`)。 */
|
|
42
4
|
export function projectMemoryComplianceCapability(caps) {
|
|
43
|
-
// 🔴 数组也是畸形:一个数组回体**不是**引擎对 caps 的回答,从它上面读出「老引擎不报这一位」是替引擎
|
|
44
|
-
// 编了一句它没说的话。`not_reported` 只留给**真的是 caps 对象、但这一格不在**那一形。
|
|
45
5
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
46
6
|
return undefined;
|
|
47
7
|
const c = caps;
|
|
48
8
|
if (!Object.hasOwn(c, 'memoryCompliance'))
|
|
49
9
|
return { kind: 'not_reported' };
|
|
50
|
-
// 🔴 只读一次:校验与分臂若各读一次,变化的 getter 能让校验读到布尔、分臂读到别的东西。
|
|
51
10
|
const v = c.memoryCompliance;
|
|
52
11
|
if (v === undefined)
|
|
53
12
|
return { kind: 'not_reported' };
|
|
@@ -55,30 +14,17 @@ export function projectMemoryComplianceCapability(caps) {
|
|
|
55
14
|
return undefined;
|
|
56
15
|
return v ? { kind: 'present' } : { kind: 'absent' };
|
|
57
16
|
}
|
|
58
|
-
/**
|
|
59
|
-
* 本格的 per-baseUrl 读账 + tee / 读口 / 失效口 / 测试钩四口 —— 能力位读器**共用同一份实现**
|
|
60
|
-
* ({@link createEngineCapReader});本文件只留这一格真正不同的部分:投影函数
|
|
61
|
-
* {@link projectMemoryComplianceCapability}、doctor 措辞表与本位的判据助手。
|
|
62
|
-
* 🔴 Map 在工厂闭包里,**一只读器一张**:收到读不懂的回体只删自己这一格,绝不连坐别的能力面
|
|
63
|
-
* (尤其不连坐同判据的 `memoryOrigin`)。
|
|
64
|
-
*/
|
|
65
17
|
const reader = createEngineCapReader({
|
|
66
18
|
name: 'memoryCompliance',
|
|
67
19
|
project: projectMemoryComplianceCapability,
|
|
68
20
|
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
69
21
|
});
|
|
70
|
-
/** 宿主 caps probe 的读面 tee 落点(与诸只兄弟并列)。绝不 throw;畸形 ⇒ 删格;`opts.generation` 关掉旧探测覆盖新读数的竞态。 */
|
|
71
22
|
export function noteEngineCapsForMemoryCompliance(baseUrl, caps, opts) {
|
|
72
23
|
reader.note(baseUrl, caps, opts);
|
|
73
24
|
}
|
|
74
|
-
/** 本进程观测到的读数;这一格空缺 ⇒ `{kind:'unobserved'}`。 */
|
|
75
25
|
export function observedMemoryCompliance(baseUrl = engineWireTarget()?.baseUrl) {
|
|
76
26
|
return reader.observed(baseUrl);
|
|
77
27
|
}
|
|
78
|
-
/**
|
|
79
|
-
* 「出处问询 / 抹除两口能不能用」的判据单源(三态):只有引擎明说在场才 `'yes'`;明说不在 ⇒ `'no'`;
|
|
80
|
-
* 老引擎不报 / 从没观测 ⇒ `'unknown'`(端按 501 试探,不预判,也不预先藏掉入口)。
|
|
81
|
-
*/
|
|
82
28
|
export function memoryComplianceVerbsAvailable(reading) {
|
|
83
29
|
if (reading.kind === 'present')
|
|
84
30
|
return 'yes';
|
|
@@ -86,7 +32,6 @@ export function memoryComplianceVerbsAvailable(reading) {
|
|
|
86
32
|
return 'no';
|
|
87
33
|
return 'unknown';
|
|
88
34
|
}
|
|
89
|
-
/** doctor 那一行的 detail 串,唯一措辞真源。🔴 两种「读不出」的句子都不许暗示「这台没有合规面」。 */
|
|
90
35
|
export function memoryComplianceDoctorDetail(reading) {
|
|
91
36
|
switch (reading.kind) {
|
|
92
37
|
case 'unobserved':
|
|
@@ -99,11 +44,9 @@ export function memoryComplianceDoctorDetail(reading) {
|
|
|
99
44
|
return 'memory compliance face on — the entry-provenance and erasure endpoints are mounted and the operator roster is non-empty on this engine; this says the door opens, not that any one call succeeds (a damaged control-plane ledger is a runtime fact and arrives as a typed 500)';
|
|
100
45
|
}
|
|
101
46
|
}
|
|
102
|
-
/** 换代失效口(引擎温切成功后调):清成未观测。空串 ⇒ no-op;绝不 throw。 */
|
|
103
47
|
export function forgetMemoryComplianceReading(baseUrl) {
|
|
104
48
|
reader.forget(baseUrl);
|
|
105
49
|
}
|
|
106
|
-
/** 测试钩子。 */
|
|
107
50
|
export function __resetMemoryComplianceReadingsForTests() {
|
|
108
51
|
reader.__resetForTests();
|
|
109
52
|
}
|