@sema-agent/client-core 0.77.0 → 0.77.2
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 +23 -1
- package/README.md +5 -4
- 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 +1 -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 +13 -358
- package/dist/hitl/persistedRulesWire.js +0 -310
- 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 +1 -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 +0 -249
- package/dist/request/taskRequest.js +10 -496
- 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 +11 -65
- package/dist/subagent/engineTaskHandleWire.js +20 -131
- 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 +62 -1
- package/package.json +1 -1
package/dist/coreValuePorts.d.ts
CHANGED
|
@@ -1,108 +1,52 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* coreValuePorts.ts — 引擎(`@sema-agent/core`)**值级**面的端口注入口(CC-07,0.69.0;cli L-249 到期桶 core-value 清零)。
|
|
3
|
-
*
|
|
4
|
-
* ## 这一格要解决的问题
|
|
5
|
-
* 壳(cli)有五组逻辑必须与引擎**跑同一个函数体**才不分歧:自主循环提示词的组装、权限规则「放宽」判据、
|
|
6
|
-
* 工具策略的组合、工具名的协议/退役/语法判别与规则编译校验、讨论工作流的名字。它们此前在壳里**值级直连**
|
|
7
|
-
* `@sema-agent/core`(cli sdk-isolation 门的 `core-value` 桶,retireBy 已过期),而 web / desktop 座位层
|
|
8
|
-
* 结构上装不了引擎 —— 同一句判据在三端里只有一端有。
|
|
9
|
-
*
|
|
10
|
-
* ## 🔴 为什么是端口注入而不是 `export … from '@sema-agent/core'`
|
|
11
|
-
* 与 `hitl/editedRuleTextPrecheck.ts` 逐字同一条硬约束:本包的可移植门是外部包**等值集**(`{diff, @sema-agent/sdk}`)
|
|
12
|
-
* + `--platform=browser` 真打包,而 core 的 barrel 值级拉 `node:crypto` / `node:fs` / `node:path` ⇒ 一条值级
|
|
13
|
-
* re-export 会把整台引擎焊进每一个装本包的端。⇒ **包声明端口 + 诚实缺席读口;Node 宿主在装配根把 core 的真实现
|
|
14
|
-
* 原样装进来(不许包一层判断);浏览器 lane 留缺席走各自的往返/降级形**。
|
|
15
|
-
*
|
|
16
|
-
* ## 形(逐组,签名与 core 7.18.0 `dist/**.d.ts` 逐字同,只把 core 私有型换成**结构等价的镜像**)
|
|
17
|
-
* · `resolveAutonomousLoopPrompt(prompt, opts?)` → `string | null`(core `tools/loop-tick.d.ts`);
|
|
18
|
-
* · `loosenReasons(prior, next)` → `string[]`(core `core/session-permission-rules`;两参用 sdk 的
|
|
19
|
-
* `SessionPermissionRules`,与 core 同名同形);
|
|
20
|
-
* · `combinePolicies(...policies)` / `createAllowDenyPolicy(opts)` → 工具策略(core `core/tool-policy.d.ts`;
|
|
21
|
-
* 策略对本包是**不透明句柄** {@link CoreToolPolicyHandle}:本包不调 `check`,只把它交回引擎/请求装配);
|
|
22
|
-
* · `MCP_NAMESPACE` / `RETIRED_TOOL_NAMES` / `protocolOf(name)` / `ruleToolGrammarOf(toolName)` /
|
|
23
|
-
* `validatePermissionRules(rules, opts?)`(core `core/protocol-table.d.ts` / `core/permission-rules.d.ts`);
|
|
24
|
-
* · `DISCUSSION_WORKFLOW_NAME`(core 常量 `"discussion"`)。
|
|
25
|
-
*
|
|
26
|
-
* ## 🔴 读口纪律(与 `precheckEditedRuleText` 同律)
|
|
27
|
-
* · 没装 ⇒ 返 `undefined`(**诚实缺席**),绝不返一个编出来的值(空数组 / 默认策略 / `"discussion"` 字面量都算编);
|
|
28
|
-
* · 装的必须是 core 的**同一只**实现,原样装 —— 包一层就把「同一函数体」这条唯一的抗漂移保证拆掉;
|
|
29
|
-
* · core 对调用方 bug 的响亮抛(如 `createAllowDenyPolicy` 的 `config.invalid_tool_name_set`)**原样上抛**,本层不吞;
|
|
30
|
-
* · 装口返回**还原函数**(还原到装之前那一只,不是无脑清空 —— 嵌套装载时无脑清空会抹掉外层)。
|
|
31
|
-
*
|
|
32
|
-
* ## 缺席语义(三端)
|
|
33
|
-
* · cli / desktop 主进程(Node,引擎在场):装配根一处 `installCoreValuePorts({...core 那十件...})`,缺席 = 宿主漏装 = bug;
|
|
34
|
-
* · web / desktop 渲染层:结构上装不了 ⇒ 恒缺席;消费点按 `undefined` 走各自的降级形(不判定、交引擎端裁)。
|
|
35
|
-
* 本口的缺席因此**不是**「宿主忘了装」的同义词,别拿它判部署形态(`hasCoreValuePorts()` 只答「装没装」)。
|
|
36
|
-
*/
|
|
37
1
|
import type { SessionPermissionRules } from '@sema-agent/sdk';
|
|
38
|
-
/** core `AutonomousLoopPromptOptions` 的逐形镜像(三键全可选)。 */
|
|
39
2
|
export interface AutonomousLoopPromptOptionsView {
|
|
40
3
|
firstTick?: boolean;
|
|
41
4
|
persistentVariant?: boolean;
|
|
42
5
|
pushNotification?: boolean;
|
|
43
6
|
}
|
|
44
|
-
/**
|
|
45
|
-
* core `ToolPolicy` 的**不透明句柄**:本包不调 `check`(那是引擎在 run 里做的事),只把策略原样交回。
|
|
46
|
-
* 结构上只钉「有一只 `check`」—— core 的 `ToolPolicy` / `NamedToolPolicy` 都可赋给它;反向刻意不钉。
|
|
47
|
-
*/
|
|
48
7
|
export interface CoreToolPolicyHandle {
|
|
49
8
|
readonly check: (req: never, signal?: AbortSignal) => CorePermissionResultView | Promise<CorePermissionResultView>;
|
|
50
9
|
readonly projection?: object;
|
|
51
10
|
}
|
|
52
|
-
/** core `PermissionResult` 的最小镜像(本包只钉判别位 `action`;其余位在引擎侧)。 */
|
|
53
11
|
export interface CorePermissionResultView {
|
|
54
12
|
readonly action: 'allow' | 'ask' | 'deny' | (string & {});
|
|
55
13
|
}
|
|
56
|
-
/** core `createAllowDenyPolicy` 的入参镜像。 */
|
|
57
14
|
export interface AllowDenyPolicyOptionsView {
|
|
58
15
|
allow?: string[];
|
|
59
16
|
deny?: string[];
|
|
60
|
-
/** 非裸工具名的 entry(规则内容形)怎么办:`throw`(缺省)在构造时拒;`skip` 丢掉并经 `onInvalidNameIssue` 报。 */
|
|
61
17
|
onInvalidName?: 'throw' | 'skip';
|
|
62
18
|
onInvalidNameIssue?: (issue: AllowDenyInvalidNameIssueView) => void;
|
|
63
19
|
}
|
|
64
|
-
/** `onInvalidName: 'skip'` 时逐条报出的那一件。 */
|
|
65
20
|
export interface AllowDenyInvalidNameIssueView {
|
|
66
21
|
entry: string;
|
|
67
22
|
list: 'allow' | 'deny';
|
|
68
23
|
message: string;
|
|
69
24
|
}
|
|
70
|
-
/** core `ProtocolNamespace` 的镜像(`id` 按开集读:core 今天 `mcp` / `a2a` 两词)。 */
|
|
71
25
|
export interface CoreProtocolNamespaceView {
|
|
72
26
|
readonly id: string;
|
|
73
27
|
readonly prefix: string;
|
|
74
28
|
makeName(peer: string, tool: string): string;
|
|
75
|
-
/** 解不出 ⇒ `undefined`(core `ProtocolPeerTool` 对本包不透明,只钉「解出了一个对象」)。 */
|
|
76
29
|
parse(name: string): object | undefined;
|
|
77
30
|
displayGroupKey(name: string): string;
|
|
78
31
|
}
|
|
79
|
-
/** core `PermissionRule` 的逐形镜像。 */
|
|
80
32
|
export interface PermissionRuleView {
|
|
81
33
|
rule: string;
|
|
82
34
|
behavior: 'deny' | 'ask' | 'allow';
|
|
83
35
|
source?: string;
|
|
84
36
|
}
|
|
85
|
-
/**
|
|
86
|
-
* core `PermissionRuleIssue` 的镜像。🔴 `code` 按**开集串**读:core 那张码表(`invalid.*` / `unsupported.*`)属主在引擎,
|
|
87
|
-
* 镜像枚举 = 引擎加员当天把一个合法码判没(#157 词表纪律)。
|
|
88
|
-
*/
|
|
89
37
|
export interface PermissionRuleIssueView {
|
|
90
38
|
rule: string;
|
|
91
39
|
code: string;
|
|
92
40
|
message: string;
|
|
93
41
|
}
|
|
94
|
-
/** core `validatePermissionRules` 第二参的镜像(`Pick<PermissionRulePolicyOptions, …>` 四键)。 */
|
|
95
42
|
export interface ValidatePermissionRulesOptionsView {
|
|
96
43
|
primaryFieldGeneric?: 'reject' | 'allow-lexical';
|
|
97
|
-
/** core `Partial<PermissionRuleCaps>`;本包不钉各帽名(属主在引擎),按对象透传。 */
|
|
98
44
|
caps?: object;
|
|
99
45
|
ruleFaces?: (toolName: string) => object | undefined;
|
|
100
|
-
/** core `PathRuleBases`:`cwd` / `root` / `home` 三基各可选(按开集键读)。 */
|
|
101
46
|
pathBases?: {
|
|
102
47
|
readonly [base: string]: string | undefined;
|
|
103
48
|
};
|
|
104
49
|
}
|
|
105
|
-
/** 十件端口的**形**(每一件的唯一合法实参 = core 导出的同名那一只,原样装)。 */
|
|
106
50
|
export interface CoreValuePorts {
|
|
107
51
|
resolveAutonomousLoopPrompt: (prompt: string, opts?: AutonomousLoopPromptOptionsView) => string | null;
|
|
108
52
|
loosenReasons: (prior: SessionPermissionRules, next: SessionPermissionRules) => string[];
|
|
@@ -115,47 +59,19 @@ export interface CoreValuePorts {
|
|
|
115
59
|
validatePermissionRules: (rules: PermissionRuleView[], opts?: ValidatePermissionRulesOptionsView) => PermissionRuleIssueView[];
|
|
116
60
|
DISCUSSION_WORKFLOW_NAME: string;
|
|
117
61
|
}
|
|
118
|
-
/** 端口名的闭集(读口逐名一一对应;`hasCoreValuePort(name)` 的入参域)。 */
|
|
119
62
|
export declare const CORE_VALUE_PORT_NAMES: readonly ["resolveAutonomousLoopPrompt", "loosenReasons", "combinePolicies", "createAllowDenyPolicy", "MCP_NAMESPACE", "RETIRED_TOOL_NAMES", "protocolOf", "ruleToolGrammarOf", "validatePermissionRules", "DISCUSSION_WORKFLOW_NAME"];
|
|
120
63
|
export type CoreValuePortName = (typeof CORE_VALUE_PORT_NAMES)[number];
|
|
121
|
-
/**
|
|
122
|
-
* 装/卸端口(可以只装一部分:没装的那几件读口照旧缺席)。返回**还原函数**(还原到装之前那一袋)。
|
|
123
|
-
*
|
|
124
|
-
* Node 宿主的装法(**逐字**,别加工):
|
|
125
|
-
* ```ts
|
|
126
|
-
* import { resolveAutonomousLoopPrompt, loosenReasons, combinePolicies, createAllowDenyPolicy,
|
|
127
|
-
* MCP_NAMESPACE, RETIRED_TOOL_NAMES, protocolOf, ruleToolGrammarOf, validatePermissionRules,
|
|
128
|
-
* DISCUSSION_WORKFLOW_NAME } from '@sema-agent/core'
|
|
129
|
-
* installCoreValuePorts({ resolveAutonomousLoopPrompt, loosenReasons, combinePolicies, createAllowDenyPolicy,
|
|
130
|
-
* MCP_NAMESPACE, RETIRED_TOOL_NAMES, protocolOf, ruleToolGrammarOf, validatePermissionRules,
|
|
131
|
-
* DISCUSSION_WORKFLOW_NAME })
|
|
132
|
-
* ```
|
|
133
|
-
* 🔴 传 `null` = 卸;传一袋 = **整袋替换**(不与上一袋合并 —— 合并会让「卸掉一件」这件事无法表达)。
|
|
134
|
-
*/
|
|
135
64
|
export declare function installCoreValuePorts(ports: Partial<CoreValuePorts> | null): () => void;
|
|
136
|
-
/** 装没装(整袋)。`false` 时所有读口缺席。 */
|
|
137
65
|
export declare function hasCoreValuePorts(): boolean;
|
|
138
|
-
/** 某一件装没装(存在性读口哨兵:`boolean` 形)。 */
|
|
139
66
|
export declare function hasCoreValuePort(name: CoreValuePortName): boolean;
|
|
140
|
-
/** 十件里还没装的那几件的名字(宿主自检 / doctor 行用;全装 ⇒ `[]`,整袋没装 ⇒ 十件全列)。 */
|
|
141
67
|
export declare function coreValuePortMisses(): readonly CoreValuePortName[];
|
|
142
|
-
/** 自主循环提示词组装(core `resolveAutonomousLoopPrompt`)。没装 ⇒ `undefined`;装了但 core 判「不组」⇒ `null`(两态不折)。 */
|
|
143
68
|
export declare function resolveAutonomousLoopPrompt(prompt: string, opts?: AutonomousLoopPromptOptionsView): string | null | undefined;
|
|
144
|
-
/** 「`next` 相对 `prior` 放宽了哪些」(core `loosenReasons`;空数组 = 没放宽)。没装 ⇒ `undefined`(不是 `[]`)。 */
|
|
145
69
|
export declare function loosenReasons(prior: SessionPermissionRules, next: SessionPermissionRules): string[] | undefined;
|
|
146
|
-
/** 组合工具策略(core `combinePolicies`,deny-wins)。没装 ⇒ `undefined`。 */
|
|
147
70
|
export declare function combinePolicies(...policies: CoreToolPolicyHandle[]): CoreToolPolicyHandle | undefined;
|
|
148
|
-
/** 白/黑名单策略(core `createAllowDenyPolicy`;`onInvalidName` 缺省 `throw`,core 响亮抛原样上抛)。没装 ⇒ `undefined`。 */
|
|
149
71
|
export declare function createAllowDenyPolicy(opts: AllowDenyPolicyOptionsView): CoreToolPolicyHandle | undefined;
|
|
150
|
-
/** MCP 协议命名空间(core `MCP_NAMESPACE`;`prefix` 今天 `mcp__`)。没装 ⇒ `undefined`。 */
|
|
151
72
|
export declare function mcpNamespace(): CoreProtocolNamespaceView | undefined;
|
|
152
|
-
/** 退役工具名 → 继任名(core `RETIRED_TOOL_NAMES`)。没装 ⇒ `undefined`(不是空 Map)。 */
|
|
153
73
|
export declare function retiredToolNames(): ReadonlyMap<string, string> | undefined;
|
|
154
|
-
/** 名字属于哪个协议命名空间(core `protocolOf`)。没装 ⇒ `undefined`;装了但不属任何协议 ⇒ 也是 `undefined`(两态在这一格上**不可分**,要分先问 `hasCoreValuePort('protocolOf')`)。 */
|
|
155
74
|
export declare function protocolOf(name: string): CoreProtocolNamespaceView | undefined;
|
|
156
|
-
/** 规则内容语法族(core `ruleToolGrammarOf`;`command` / `path`)。没装 ⇒ `undefined`(与「该工具无语法族」同形,要分先问 `hasCoreValuePort`)。 */
|
|
157
75
|
export declare function ruleToolGrammarOf(toolName: string): 'command' | 'path' | undefined;
|
|
158
|
-
/** 规则编译校验(core `validatePermissionRules`;空数组 = 全部编译得了)。没装 ⇒ `undefined`(不是 `[]` —— 那会把「没校」说成「全过」)。 */
|
|
159
76
|
export declare function validatePermissionRules(rules: PermissionRuleView[], opts?: ValidatePermissionRulesOptionsView): PermissionRuleIssueView[] | undefined;
|
|
160
|
-
/** 讨论工作流的名字(core `DISCUSSION_WORKFLOW_NAME`,今天 `"discussion"`)。没装 ⇒ `undefined`(不铸字面量)。 */
|
|
161
77
|
export declare function discussionWorkflowName(): string | undefined;
|
package/dist/coreValuePorts.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** 端口名的闭集(读口逐名一一对应;`hasCoreValuePort(name)` 的入参域)。 */
|
|
2
1
|
export const CORE_VALUE_PORT_NAMES = Object.freeze([
|
|
3
2
|
'resolveAutonomousLoopPrompt',
|
|
4
3
|
'loosenReasons',
|
|
@@ -12,20 +11,6 @@ export const CORE_VALUE_PORT_NAMES = Object.freeze([
|
|
|
12
11
|
'DISCUSSION_WORKFLOW_NAME',
|
|
13
12
|
]);
|
|
14
13
|
let installed = null;
|
|
15
|
-
/**
|
|
16
|
-
* 装/卸端口(可以只装一部分:没装的那几件读口照旧缺席)。返回**还原函数**(还原到装之前那一袋)。
|
|
17
|
-
*
|
|
18
|
-
* Node 宿主的装法(**逐字**,别加工):
|
|
19
|
-
* ```ts
|
|
20
|
-
* import { resolveAutonomousLoopPrompt, loosenReasons, combinePolicies, createAllowDenyPolicy,
|
|
21
|
-
* MCP_NAMESPACE, RETIRED_TOOL_NAMES, protocolOf, ruleToolGrammarOf, validatePermissionRules,
|
|
22
|
-
* DISCUSSION_WORKFLOW_NAME } from '@sema-agent/core'
|
|
23
|
-
* installCoreValuePorts({ resolveAutonomousLoopPrompt, loosenReasons, combinePolicies, createAllowDenyPolicy,
|
|
24
|
-
* MCP_NAMESPACE, RETIRED_TOOL_NAMES, protocolOf, ruleToolGrammarOf, validatePermissionRules,
|
|
25
|
-
* DISCUSSION_WORKFLOW_NAME })
|
|
26
|
-
* ```
|
|
27
|
-
* 🔴 传 `null` = 卸;传一袋 = **整袋替换**(不与上一袋合并 —— 合并会让「卸掉一件」这件事无法表达)。
|
|
28
|
-
*/
|
|
29
14
|
export function installCoreValuePorts(ports) {
|
|
30
15
|
const prev = installed;
|
|
31
16
|
installed = ports === null ? null : { ...ports };
|
|
@@ -33,66 +18,52 @@ export function installCoreValuePorts(ports) {
|
|
|
33
18
|
installed = prev;
|
|
34
19
|
};
|
|
35
20
|
}
|
|
36
|
-
/** 装没装(整袋)。`false` 时所有读口缺席。 */
|
|
37
21
|
export function hasCoreValuePorts() {
|
|
38
22
|
return installed !== null;
|
|
39
23
|
}
|
|
40
|
-
/** 某一件装没装(存在性读口哨兵:`boolean` 形)。 */
|
|
41
24
|
export function hasCoreValuePort(name) {
|
|
42
25
|
return installed !== null && installed[name] !== undefined;
|
|
43
26
|
}
|
|
44
|
-
/** 十件里还没装的那几件的名字(宿主自检 / doctor 行用;全装 ⇒ `[]`,整袋没装 ⇒ 十件全列)。 */
|
|
45
27
|
export function coreValuePortMisses() {
|
|
46
28
|
return CORE_VALUE_PORT_NAMES.filter((n) => installed === null || installed[n] === undefined);
|
|
47
29
|
}
|
|
48
30
|
function port(name) {
|
|
49
31
|
return installed === null ? undefined : installed[name];
|
|
50
32
|
}
|
|
51
|
-
// ── 读口(逐件;没装 ⇒ undefined,绝不编值;core 的响亮抛原样上抛)──────────────────────────────
|
|
52
|
-
/** 自主循环提示词组装(core `resolveAutonomousLoopPrompt`)。没装 ⇒ `undefined`;装了但 core 判「不组」⇒ `null`(两态不折)。 */
|
|
53
33
|
export function resolveAutonomousLoopPrompt(prompt, opts) {
|
|
54
34
|
const fn = port('resolveAutonomousLoopPrompt');
|
|
55
35
|
return fn === undefined ? undefined : fn(prompt, opts);
|
|
56
36
|
}
|
|
57
|
-
/** 「`next` 相对 `prior` 放宽了哪些」(core `loosenReasons`;空数组 = 没放宽)。没装 ⇒ `undefined`(不是 `[]`)。 */
|
|
58
37
|
export function loosenReasons(prior, next) {
|
|
59
38
|
const fn = port('loosenReasons');
|
|
60
39
|
return fn === undefined ? undefined : fn(prior, next);
|
|
61
40
|
}
|
|
62
|
-
/** 组合工具策略(core `combinePolicies`,deny-wins)。没装 ⇒ `undefined`。 */
|
|
63
41
|
export function combinePolicies(...policies) {
|
|
64
42
|
const fn = port('combinePolicies');
|
|
65
43
|
return fn === undefined ? undefined : fn(...policies);
|
|
66
44
|
}
|
|
67
|
-
/** 白/黑名单策略(core `createAllowDenyPolicy`;`onInvalidName` 缺省 `throw`,core 响亮抛原样上抛)。没装 ⇒ `undefined`。 */
|
|
68
45
|
export function createAllowDenyPolicy(opts) {
|
|
69
46
|
const fn = port('createAllowDenyPolicy');
|
|
70
47
|
return fn === undefined ? undefined : fn(opts);
|
|
71
48
|
}
|
|
72
|
-
/** MCP 协议命名空间(core `MCP_NAMESPACE`;`prefix` 今天 `mcp__`)。没装 ⇒ `undefined`。 */
|
|
73
49
|
export function mcpNamespace() {
|
|
74
50
|
return port('MCP_NAMESPACE');
|
|
75
51
|
}
|
|
76
|
-
/** 退役工具名 → 继任名(core `RETIRED_TOOL_NAMES`)。没装 ⇒ `undefined`(不是空 Map)。 */
|
|
77
52
|
export function retiredToolNames() {
|
|
78
53
|
return port('RETIRED_TOOL_NAMES');
|
|
79
54
|
}
|
|
80
|
-
/** 名字属于哪个协议命名空间(core `protocolOf`)。没装 ⇒ `undefined`;装了但不属任何协议 ⇒ 也是 `undefined`(两态在这一格上**不可分**,要分先问 `hasCoreValuePort('protocolOf')`)。 */
|
|
81
55
|
export function protocolOf(name) {
|
|
82
56
|
const fn = port('protocolOf');
|
|
83
57
|
return fn === undefined ? undefined : fn(name);
|
|
84
58
|
}
|
|
85
|
-
/** 规则内容语法族(core `ruleToolGrammarOf`;`command` / `path`)。没装 ⇒ `undefined`(与「该工具无语法族」同形,要分先问 `hasCoreValuePort`)。 */
|
|
86
59
|
export function ruleToolGrammarOf(toolName) {
|
|
87
60
|
const fn = port('ruleToolGrammarOf');
|
|
88
61
|
return fn === undefined ? undefined : fn(toolName);
|
|
89
62
|
}
|
|
90
|
-
/** 规则编译校验(core `validatePermissionRules`;空数组 = 全部编译得了)。没装 ⇒ `undefined`(不是 `[]` —— 那会把「没校」说成「全过」)。 */
|
|
91
63
|
export function validatePermissionRules(rules, opts) {
|
|
92
64
|
const fn = port('validatePermissionRules');
|
|
93
65
|
return fn === undefined ? undefined : fn(rules, opts);
|
|
94
66
|
}
|
|
95
|
-
/** 讨论工作流的名字(core `DISCUSSION_WORKFLOW_NAME`,今天 `"discussion"`)。没装 ⇒ `undefined`(不铸字面量)。 */
|
|
96
67
|
export function discussionWorkflowName() {
|
|
97
68
|
return port('DISCUSSION_WORKFLOW_NAME');
|
|
98
69
|
}
|
package/dist/decideReceipt.d.ts
CHANGED
|
@@ -1,132 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* src/decideReceipt.ts — `/decide` **答了什么**:200 回执的读面 + 三条 workflow 车道拒绝码的
|
|
3
|
-
* 人话铸点(B-070 / L-200,0.65.0;sdk README §9.0.0,server ≥7.69.0)。
|
|
4
|
-
*
|
|
5
|
-
* ── 🔴 这一件修的是什么:**200 ≠ 门已解决** ─────────────────────────────────────────────────
|
|
6
|
-
* sdk README §9.0.0 逐字:「workflow 车道的 200 只是**投递受理** —— 子代的 checkpoint 仍 pending,
|
|
7
|
-
* `/v1/approvals` 上那张卡**可能还在**。据 200 立刻把卡从 UI 抹掉,用户会看到一张『批过了却还在』
|
|
8
|
-
* 的幽灵卡,或者反过来:卡消失了而决定其实在宿主被打断时丢了。」
|
|
9
|
-
* core `runner/contracts.d.ts:1492` 同向:那一步 **launches the run that re-invokes** —— 它启动的是
|
|
10
|
-
* 另一条 run,不是「这件事已经做完了」。
|
|
11
|
-
* ⇒ 本包对 decide 成功的处置因此换了**判据锚**([anchor-on-the-deciding-quantity]):
|
|
12
|
-
* 真正决定「门解没解决」的量是**流上的下一条 running 臂 / 新 run 的事件**,不是那个 200。
|
|
13
|
-
* `hitlBridge.decideRaw` 不再在 200 上清 `active`(见该处注释),`parkResolver` 的重挂腿改按
|
|
14
|
-
* {@link DecideReceiptView.handoffTaskId} 换挂。
|
|
15
|
-
*
|
|
16
|
-
* ── `/decide` 200 的**四种形**(sdk `ApprovalDecisionResult` 顶注逐字)─────────────────────────
|
|
17
|
-
* · **受理形**(≥7.37 durable 部署默认)`{taskId, sessionId, status:"resuming", bindingEnforced:true}`
|
|
18
|
-
* · **终局形**(无 durable run 行 / `verify:true` 的同步长调用)`{taskId?, sessionId, status, errorCode?, …}`
|
|
19
|
-
* · **parked 回执** `{taskId, status:"resuming", decision}`
|
|
20
|
-
* · **幂等回放形**(#368)`{sessionId, idempotent:true, decision, bindingEnforced:true, executionOutcome?}`
|
|
21
|
-
* 🔴 **没有任何键四形都保证** —— 所以本读器对每一位都做诚实缺席,**绝不**靠某一位在不在场去推断
|
|
22
|
-
* 另一件事。
|
|
23
|
-
*
|
|
24
|
-
* ── 🔴 `executionOutcome`:缺席 = 未知,**禁读成 allowed** ───────────────────────────────────
|
|
25
|
-
* sdk `types.d.ts:3809-3813` 逐字:它**只在幂等回放形上**,说的是「那个已决动作**最后被怎么处置**」;
|
|
26
|
-
* 「`decision` 说的是『人批了没有』,这一格说的是『执行时被放行还是被部署复核在 post-CAS 否掉』,
|
|
27
|
-
* 两者**可以相反**」;「🔴 **缺席 = 未知**(判词还没落上 / 记录读不懂 / 命中行之间分歧),**禁读成
|
|
28
|
-
* allowed**」。core `checkpoint-store.d.ts:1785` 同句:「the execution outcome is not known, never
|
|
29
|
-
* 'it was allowed'」。
|
|
30
|
-
* ⇒ 本读器把它读成 `GateOutcomeView | undefined`,**走的是 `gateOutcome.ts` 那一只读器**
|
|
31
|
-
* (把它包回 `{gate: …}` 的形喂进去)——不在这里另写一份门记录读法,否则两处判据必然分叉。
|
|
32
|
-
* 消费端渲卡时:**在场**才说「执行时被放行/被否」,缺席一个字都不说。
|
|
33
|
-
*/
|
|
34
1
|
import { type GateOutcomeView } from './gateOutcome.js';
|
|
35
2
|
import { type ResumeReopenDetail } from './resumeRefusalCopy.js';
|
|
36
|
-
/** 一次 `/decide` 200 的读数。**每一位都可能缺席**(四种形没有共同保证的键)。 */
|
|
37
3
|
export interface DecideReceiptView {
|
|
38
|
-
/** 回体上的 `status`(开集透传;受理形与 parked 回执上是 `"resuming"`,回放形上**没有**这一位)。 */
|
|
39
4
|
status?: string;
|
|
40
|
-
/** 回体上的 `taskId`(开集透传;回放形上没有)。 */
|
|
41
5
|
taskId?: string;
|
|
42
|
-
/** 回体上的 `sessionId`(parked 回执上没有)。 */
|
|
43
6
|
sessionId?: string;
|
|
44
|
-
/** `#368` 幂等回放形的判别式(在场即真)。 */
|
|
45
7
|
idempotent?: true;
|
|
46
|
-
/**
|
|
47
|
-
* 🔴 **「该去盯哪条 run」的换挂句柄** —— 受理形/parked 回执上 `status === "resuming"` 时那个
|
|
48
|
-
* `taskId`。sdk README §9.0.0 逐字:workflow 车道上它是「**宿主新铸**的 run id(poll 它,
|
|
49
|
-
* **不要盯那张卡**)」。
|
|
50
|
-
*
|
|
51
|
-
* 🔴 **它与 {@link taskId} 刻意是两个位**(不是别名):`taskId` 是「回体上写着什么」的原样透传,
|
|
52
|
-
* 本位是「**本包判定**这次 decide 把续跑交到了哪条 run 上」—— 后者带着一个判据
|
|
53
|
-
* (`status === "resuming"` ∧ 非空 `taskId`),而把判据折进透传位会让消费端分不出
|
|
54
|
-
* 「引擎报了一个 taskId」与「这次真的换挂了」。
|
|
55
|
-
* 🔴 **缺席 = 没有换挂句柄**(终局形 / 回放形 / 老 server 的终局体),消费端**照旧用原 taskId**;
|
|
56
|
-
* 绝不把缺席折成「那就是原来那条」——那是把两件事说成一件。
|
|
57
|
-
*/
|
|
58
8
|
handoffTaskId?: string;
|
|
59
|
-
/**
|
|
60
|
-
* 那个**已决动作最后被怎么处置**(只在幂等回放形上;sdk ≥8.6.0 / server ≥7.66.0)。
|
|
61
|
-
* 🔴 **缺席 = 未知,禁读成 allowed**(见模块顶注的两处上游逐字)。
|
|
62
|
-
*/
|
|
63
9
|
executionOutcome?: GateOutcomeView;
|
|
64
|
-
/**
|
|
65
|
-
* 0.74.3 CC-73:**终局形**才有的两位(契约:`verify:true` / 无 run store 的同步长调用在 200 体上回
|
|
66
|
-
* `{ status:"failed", errorCode, retriable:true }`;受理形刻意不带)。在场逐字,缺席不落键;`retriable` 严格布尔,
|
|
67
|
-
* `false` 是 server 说的照带。判「这是不是 reopen 类失败」走 {@link decideReceiptReopen},别在端上凭码猜。
|
|
68
|
-
*/
|
|
69
10
|
errorCode?: string;
|
|
70
11
|
retriable?: boolean;
|
|
71
12
|
}
|
|
72
|
-
/**
|
|
73
|
-
* `/decide` 的 200 体 → {@link DecideReceiptView};不是一只对象 / 一位都读不出 ⇒ `undefined`,
|
|
74
|
-
* 绝不抛。
|
|
75
|
-
*
|
|
76
|
-
* 🔴 **按自有属性读**:一只来自 wire 的对象可以带原型(`Object.create({status:'resuming'})` 上那个
|
|
77
|
-
* 值不是这次回执带来的事实)。
|
|
78
|
-
* 🔴 **不补默认、不折缺席**:读不出 `status` 不等于终局,读不出 `executionOutcome` 不等于 allowed。
|
|
79
|
-
*/
|
|
80
13
|
export declare function readDecideReceipt(result: unknown): DecideReceiptView | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* 0.74.3 CC-73(cli L-56 ①):`/decide` 200 **终局形**是不是 reopen 类失败 —— 三件合取,与 {@link resumeReopenFromError}
|
|
83
|
-
* **同一只**判官(码 ∈ `RESUME_REOPEN_CODES` ∧ `retriable === true`),外加终局形自己的 `status === 'failed'`。
|
|
84
|
-
* 任一件缺 ⇒ `null`:受理形带同码不算(它不是终局)、`retriable` 缺席 / false 不算(凭码不说「卡仍 pending」)。
|
|
85
|
-
* 读数在场 ⇒ 卡仍 pending、决定没被消费、可再决;文案走 `resumeReopenContent(detail)`。
|
|
86
|
-
*/
|
|
87
14
|
export declare function decideReceiptReopen(receipt: DecideReceiptView | undefined): ResumeReopenDetail | null;
|
|
88
|
-
/**
|
|
89
|
-
* 🔴 **这次 decide 的 200 有没有把门解决掉** —— 唯一的诚实答案是「**说不出来**」。
|
|
90
|
-
*
|
|
91
|
-
* 本谓词**刻意不存在**的那个反面(`isDecideResolved`)是 B-070 的病根:不存在任何一位能从 200 体上
|
|
92
|
-
* 读出「门已解决」。所以本包给的是这一个**方向相反**的谓词:它答的是「这个 200 **明说**了续跑还没
|
|
93
|
-
* 做完吗」。
|
|
94
|
-
* · `true` —— 受理形/parked 回执(`status:"resuming"`):引擎**明说**它只是受理了;
|
|
95
|
-
* · `false` —— 别的形:**不代表已解决**,只代表「这个回体没有明说自己是受理形」。
|
|
96
|
-
* ⇒ 两边都不是「解决了」的证据。解决的证据只有一处:**流上的下一条 running 臂 / 新 run 的事件**。
|
|
97
|
-
*/
|
|
98
15
|
export declare function decideAcceptedNotResolved(receipt: DecideReceiptView | undefined): boolean;
|
|
99
|
-
/** {@link decideRefusalFromError} 的结构化读数。 */
|
|
100
16
|
export interface DecideRefusalDetail {
|
|
101
|
-
/** 命中的那一个码({@link DECIDE_WORKFLOW_LANE_CODES} 的成员之一)。 */
|
|
102
17
|
code: string;
|
|
103
|
-
/**
|
|
104
|
-
* 拒体上的 `runId`(sdk README §9.0.0:`DecideWorkflowHostError` 带 `.runId` —— **恢复句柄**)。
|
|
105
|
-
* 🔴 **它不是 `taskId`**:那一节逐字「此前 `DecideError` 的顶注写着『every decide.* body carries
|
|
106
|
-
* `taskId`』——那句话自 7.69.0 起不再成立(workflow 车道的拒体没有 `taskId`,铸一个是假话)」。
|
|
107
|
-
* ⇒ 读不出就缺席,**绝不**拿手上的 taskId 顶上去。
|
|
108
|
-
* 🔴 「两个句柄位**各自只在自己那条车道上在场**,按 `.errorCode` 分,不要互相回落」(同节逐字)。
|
|
109
|
-
*/
|
|
110
18
|
runId?: string;
|
|
111
|
-
/** 这一句人话(**唯一铸点**;三端共用,端零自拼)。 */
|
|
112
19
|
detail: string;
|
|
113
|
-
/**
|
|
114
|
-
* **同一个决定再发一次有没有用**。
|
|
115
|
-
* 🔴 两个码上的取值各有出处(见 `engineErrorCodes.ts` 的逐码顶注),**不是**按严重程度排的:
|
|
116
|
-
* `host_unknown` = `false`(无重试价值);`remember_unsupported` = `true`(去掉 `remember` 重发)。
|
|
117
|
-
* 0.71.0 CC-20:曾有第三码(宿主没停在 park 上,可重发)已随 server 7.72.0 退役,那条车道改铸新 run 不再拒。
|
|
118
|
-
* ⚠️ `true` **不带窗**:server 在这两个码上**从不**铸 `retryAfterSec`(它只在
|
|
119
|
-
* `RESUME_RETRY_LATER_CODES` 那两码上铸)⇒ 端**不许**据此渲一个编出来的倒计时。
|
|
120
|
-
*/
|
|
121
20
|
resendable: boolean;
|
|
122
21
|
}
|
|
123
|
-
/**
|
|
124
|
-
* 一个 decide 失败抛出物 → {@link DecideRefusalDetail};不是这两个码之一 ⇒ `null`。
|
|
125
|
-
*
|
|
126
|
-
* 🔴 **判型是闭集的,消费面是开集的**(与 `resumeRefusalFromError` 逐字同律):不认识的码一律
|
|
127
|
-
* `null` ⇒ 端一个字都不补 ⇒ 机器可读那一行(`API Error: <status> <errorCode> · <msg>`)原样上屏。
|
|
128
|
-
* **绝不按 `decide.` 前缀猜一族码的语义** —— 那个前缀下同时住着「没救」「等时序」「改参数」
|
|
129
|
-
* 三种处置,还住着 `approval_binding_mismatch` 这类**安全信号**(它有自己的 fail-closed 处置,
|
|
130
|
-
* 被这里顺手认领会把一条安全停说成一次可重发的时序问题)。
|
|
131
|
-
*/
|
|
132
22
|
export declare function decideRefusalFromError(e: unknown): DecideRefusalDetail | null;
|
package/dist/decideReceipt.js
CHANGED
|
@@ -1,53 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* src/decideReceipt.ts — `/decide` **答了什么**:200 回执的读面 + 三条 workflow 车道拒绝码的
|
|
3
|
-
* 人话铸点(B-070 / L-200,0.65.0;sdk README §9.0.0,server ≥7.69.0)。
|
|
4
|
-
*
|
|
5
|
-
* ── 🔴 这一件修的是什么:**200 ≠ 门已解决** ─────────────────────────────────────────────────
|
|
6
|
-
* sdk README §9.0.0 逐字:「workflow 车道的 200 只是**投递受理** —— 子代的 checkpoint 仍 pending,
|
|
7
|
-
* `/v1/approvals` 上那张卡**可能还在**。据 200 立刻把卡从 UI 抹掉,用户会看到一张『批过了却还在』
|
|
8
|
-
* 的幽灵卡,或者反过来:卡消失了而决定其实在宿主被打断时丢了。」
|
|
9
|
-
* core `runner/contracts.d.ts:1492` 同向:那一步 **launches the run that re-invokes** —— 它启动的是
|
|
10
|
-
* 另一条 run,不是「这件事已经做完了」。
|
|
11
|
-
* ⇒ 本包对 decide 成功的处置因此换了**判据锚**([anchor-on-the-deciding-quantity]):
|
|
12
|
-
* 真正决定「门解没解决」的量是**流上的下一条 running 臂 / 新 run 的事件**,不是那个 200。
|
|
13
|
-
* `hitlBridge.decideRaw` 不再在 200 上清 `active`(见该处注释),`parkResolver` 的重挂腿改按
|
|
14
|
-
* {@link DecideReceiptView.handoffTaskId} 换挂。
|
|
15
|
-
*
|
|
16
|
-
* ── `/decide` 200 的**四种形**(sdk `ApprovalDecisionResult` 顶注逐字)─────────────────────────
|
|
17
|
-
* · **受理形**(≥7.37 durable 部署默认)`{taskId, sessionId, status:"resuming", bindingEnforced:true}`
|
|
18
|
-
* · **终局形**(无 durable run 行 / `verify:true` 的同步长调用)`{taskId?, sessionId, status, errorCode?, …}`
|
|
19
|
-
* · **parked 回执** `{taskId, status:"resuming", decision}`
|
|
20
|
-
* · **幂等回放形**(#368)`{sessionId, idempotent:true, decision, bindingEnforced:true, executionOutcome?}`
|
|
21
|
-
* 🔴 **没有任何键四形都保证** —— 所以本读器对每一位都做诚实缺席,**绝不**靠某一位在不在场去推断
|
|
22
|
-
* 另一件事。
|
|
23
|
-
*
|
|
24
|
-
* ── 🔴 `executionOutcome`:缺席 = 未知,**禁读成 allowed** ───────────────────────────────────
|
|
25
|
-
* sdk `types.d.ts:3809-3813` 逐字:它**只在幂等回放形上**,说的是「那个已决动作**最后被怎么处置**」;
|
|
26
|
-
* 「`decision` 说的是『人批了没有』,这一格说的是『执行时被放行还是被部署复核在 post-CAS 否掉』,
|
|
27
|
-
* 两者**可以相反**」;「🔴 **缺席 = 未知**(判词还没落上 / 记录读不懂 / 命中行之间分歧),**禁读成
|
|
28
|
-
* allowed**」。core `checkpoint-store.d.ts:1785` 同句:「the execution outcome is not known, never
|
|
29
|
-
* 'it was allowed'」。
|
|
30
|
-
* ⇒ 本读器把它读成 `GateOutcomeView | undefined`,**走的是 `gateOutcome.ts` 那一只读器**
|
|
31
|
-
* (把它包回 `{gate: …}` 的形喂进去)——不在这里另写一份门记录读法,否则两处判据必然分叉。
|
|
32
|
-
* 消费端渲卡时:**在场**才说「执行时被放行/被否」,缺席一个字都不说。
|
|
33
|
-
*/
|
|
34
1
|
import { gateOutcomeOf } from './gateOutcome.js';
|
|
35
2
|
import { resumeReopenFromError } from './resumeRefusalCopy.js';
|
|
36
3
|
import { DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, } from './engineErrorCodes.js';
|
|
37
|
-
/** 受理形/parked 回执上那个**唯一**表示「受理了、还没做完」的状态词(sdk README §9.0.0 逐字)。 */
|
|
38
4
|
const STATUS_RESUMING = 'resuming';
|
|
39
|
-
/** 非空串窄读(与本包其余读面同一条:空串 = 没这一格)。 */
|
|
40
5
|
function str(v) {
|
|
41
6
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
42
7
|
}
|
|
43
|
-
/**
|
|
44
|
-
* `/decide` 的 200 体 → {@link DecideReceiptView};不是一只对象 / 一位都读不出 ⇒ `undefined`,
|
|
45
|
-
* 绝不抛。
|
|
46
|
-
*
|
|
47
|
-
* 🔴 **按自有属性读**:一只来自 wire 的对象可以带原型(`Object.create({status:'resuming'})` 上那个
|
|
48
|
-
* 值不是这次回执带来的事实)。
|
|
49
|
-
* 🔴 **不补默认、不折缺席**:读不出 `status` 不等于终局,读不出 `executionOutcome` 不等于 allowed。
|
|
50
|
-
*/
|
|
51
8
|
export function readDecideReceipt(result) {
|
|
52
9
|
if (typeof result !== 'object' || result === null || Array.isArray(result))
|
|
53
10
|
return undefined;
|
|
@@ -56,11 +13,7 @@ export function readDecideReceipt(result) {
|
|
|
56
13
|
const taskId = Object.hasOwn(r, 'taskId') ? str(r.taskId) : undefined;
|
|
57
14
|
const sessionId = Object.hasOwn(r, 'sessionId') ? str(r.sessionId) : undefined;
|
|
58
15
|
const idempotent = Object.hasOwn(r, 'idempotent') && r.idempotent === true ? true : undefined;
|
|
59
|
-
// 🔴 换挂句柄的判据是**两件合取**:引擎说了「受理了、在续跑」**并且**给了一个非空 run id。
|
|
60
|
-
// 少了前半句,一个终局形的 `taskId`(= 原来那条 run)会被当成「换挂到新 run」;
|
|
61
|
-
// 少了后半句,`status:"resuming"` 但没给 id 时会铸一个空句柄。
|
|
62
16
|
const handoffTaskId = status === STATUS_RESUMING && taskId !== undefined ? taskId : undefined;
|
|
63
|
-
// 🔴 走 `gateOutcome.ts` 的**同一只**读器(包回它认的载体名);不在这里另写一份门记录读法。
|
|
64
17
|
const executionOutcome = Object.hasOwn(r, 'executionOutcome')
|
|
65
18
|
? gateOutcomeOf({ gate: r.executionOutcome })
|
|
66
19
|
: undefined;
|
|
@@ -86,57 +39,23 @@ export function readDecideReceipt(result) {
|
|
|
86
39
|
...(retriable !== undefined ? { retriable } : {}),
|
|
87
40
|
};
|
|
88
41
|
}
|
|
89
|
-
/** 200 终局形上「这是不是 reopen 类失败」的判据词(契约:reopen 类失败仍 `suspended` 且锁在手,200 体 `status:"failed"`)。 */
|
|
90
42
|
const STATUS_FAILED = 'failed';
|
|
91
|
-
/**
|
|
92
|
-
* 0.74.3 CC-73(cli L-56 ①):`/decide` 200 **终局形**是不是 reopen 类失败 —— 三件合取,与 {@link resumeReopenFromError}
|
|
93
|
-
* **同一只**判官(码 ∈ `RESUME_REOPEN_CODES` ∧ `retriable === true`),外加终局形自己的 `status === 'failed'`。
|
|
94
|
-
* 任一件缺 ⇒ `null`:受理形带同码不算(它不是终局)、`retriable` 缺席 / false 不算(凭码不说「卡仍 pending」)。
|
|
95
|
-
* 读数在场 ⇒ 卡仍 pending、决定没被消费、可再决;文案走 `resumeReopenContent(detail)`。
|
|
96
|
-
*/
|
|
97
43
|
export function decideReceiptReopen(receipt) {
|
|
98
44
|
if (receipt === undefined || receipt.status !== STATUS_FAILED)
|
|
99
45
|
return null;
|
|
100
46
|
return resumeReopenFromError(receipt);
|
|
101
47
|
}
|
|
102
|
-
/**
|
|
103
|
-
* 🔴 **这次 decide 的 200 有没有把门解决掉** —— 唯一的诚实答案是「**说不出来**」。
|
|
104
|
-
*
|
|
105
|
-
* 本谓词**刻意不存在**的那个反面(`isDecideResolved`)是 B-070 的病根:不存在任何一位能从 200 体上
|
|
106
|
-
* 读出「门已解决」。所以本包给的是这一个**方向相反**的谓词:它答的是「这个 200 **明说**了续跑还没
|
|
107
|
-
* 做完吗」。
|
|
108
|
-
* · `true` —— 受理形/parked 回执(`status:"resuming"`):引擎**明说**它只是受理了;
|
|
109
|
-
* · `false` —— 别的形:**不代表已解决**,只代表「这个回体没有明说自己是受理形」。
|
|
110
|
-
* ⇒ 两边都不是「解决了」的证据。解决的证据只有一处:**流上的下一条 running 臂 / 新 run 的事件**。
|
|
111
|
-
*/
|
|
112
48
|
export function decideAcceptedNotResolved(receipt) {
|
|
113
49
|
return receipt?.status === STATUS_RESUMING;
|
|
114
50
|
}
|
|
115
|
-
/**
|
|
116
|
-
* `/decide` workflow 车道**拒绝码 → 一句人话**的表(三句刻意逐字互异 —— 三条不同的下一步:
|
|
117
|
-
* 没救 / 等宿主再 park / 去掉一个参数重发)。
|
|
118
|
-
*
|
|
119
|
-
* 🔴 **不复述 server 的 message**(与 `resumeRefusalCopy` 同律):那一行已经在屏上了,本表只补
|
|
120
|
-
* message 里没有的那件事 —— 「我现在该做什么」。
|
|
121
|
-
*/
|
|
122
51
|
const DECIDE_REFUSAL_SENTENCES = Object.freeze({
|
|
123
52
|
[DECIDE_WORKFLOW_HOST_UNKNOWN]: 'no session is attached to this run to receive the decision, so re-sending the same decision cannot help; the approval is still pending and can be decided again once the run is reachable',
|
|
124
53
|
[DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED]: 'this run cannot remember the decision for the session; re-send the same decision without the remember option — nothing was consumed by this refusal',
|
|
125
54
|
});
|
|
126
|
-
/** 按码给出的 `resendable`(单铸;理由逐码写在 `engineErrorCodes.ts` 的顶注里)。 */
|
|
127
55
|
const DECIDE_RESENDABLE = Object.freeze({
|
|
128
56
|
[DECIDE_WORKFLOW_HOST_UNKNOWN]: false,
|
|
129
57
|
[DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED]: true,
|
|
130
58
|
});
|
|
131
|
-
/**
|
|
132
|
-
* 一个 decide 失败抛出物 → {@link DecideRefusalDetail};不是这两个码之一 ⇒ `null`。
|
|
133
|
-
*
|
|
134
|
-
* 🔴 **判型是闭集的,消费面是开集的**(与 `resumeRefusalFromError` 逐字同律):不认识的码一律
|
|
135
|
-
* `null` ⇒ 端一个字都不补 ⇒ 机器可读那一行(`API Error: <status> <errorCode> · <msg>`)原样上屏。
|
|
136
|
-
* **绝不按 `decide.` 前缀猜一族码的语义** —— 那个前缀下同时住着「没救」「等时序」「改参数」
|
|
137
|
-
* 三种处置,还住着 `approval_binding_mismatch` 这类**安全信号**(它有自己的 fail-closed 处置,
|
|
138
|
-
* 被这里顺手认领会把一条安全停说成一次可重发的时序问题)。
|
|
139
|
-
*/
|
|
140
59
|
export function decideRefusalFromError(e) {
|
|
141
60
|
const code = typeof e?.errorCode === 'string'
|
|
142
61
|
? (e.errorCode)
|
|
@@ -145,9 +64,6 @@ export function decideRefusalFromError(e) {
|
|
|
145
64
|
return null;
|
|
146
65
|
const rawRunId = e.runId;
|
|
147
66
|
const runId = typeof rawRunId === 'string' && rawRunId.length > 0 ? rawRunId : undefined;
|
|
148
|
-
// 🔴 按自有属性查表(冻结不移除原型):一个来自 wire 的 `constructor` 会命中 `Object.prototype`
|
|
149
|
-
// 上的**函数**并被当成一句话。命中闭集之后表里必然有句子 —— 读不出仍给一句诚实兜底,
|
|
150
|
-
// 绝不返回 `undefined` 让端去拼。
|
|
151
67
|
const detail = Object.hasOwn(DECIDE_REFUSAL_SENTENCES, code)
|
|
152
68
|
? DECIDE_REFUSAL_SENTENCES[code]
|
|
153
69
|
: undefined;
|