@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
|
@@ -1,76 +1,39 @@
|
|
|
1
1
|
export interface EngineTaskOutputResult {
|
|
2
|
-
/** 累积后的输出正文(游标两形兼容,见头注)。 */
|
|
3
2
|
content: string;
|
|
4
|
-
/** wire output 投影原样的常用位(UI 一律以这些 flags 为准,别解析 content 猜状态)。 */
|
|
5
3
|
status?: string;
|
|
6
4
|
stoppedBy?: string;
|
|
7
5
|
partialResult?: boolean;
|
|
8
6
|
}
|
|
9
|
-
/** 测试钩:清累积缓存。 */
|
|
10
7
|
export declare function __resetTaskHandleWireForTests(): void;
|
|
11
|
-
/**
|
|
12
|
-
* 读一个引擎侧任务句柄的输出(新面 A)。null = 读不到(无 wire / caps 缺 / 无宿主 run / 404
|
|
13
|
-
* 域外或已 reap / 网错)——调用方回落既有渲染(receipt/outputFile tail)。绝不 throw。
|
|
14
|
-
*/
|
|
15
8
|
export declare function fetchEngineTaskOutput(handle: string, opts?: {
|
|
16
9
|
signal?: AbortSignal;
|
|
17
10
|
}): Promise<EngineTaskOutputResult | null>;
|
|
18
|
-
/**
|
|
19
|
-
* [1505] 契约标记判别(头注):spool 全量 → 替换;cursor 增量 → append;无标记 → 保守
|
|
20
|
-
* append-if-changed(与上次逐字节相同视为幂等重读,不重复)。空 content 不动累积。
|
|
21
|
-
* 🔴 B6 提出成具名纯函数 —— 它是这条读面唯一会「把输出显示成两遍」的地方,值得被直接断言。
|
|
22
|
-
* 🔴 REF-CC-域词表-06:标记判读本身**提单源**到 `toolResult.ts` 的 `spoolMarkerOf`(它与本文件
|
|
23
|
-
* 曾经各写一份 `.includes()` 判读,同一个协议标记有两处互不知情的判读点——现在两处判读结果
|
|
24
|
-
* 对同一输入恒一致,因为已经是同一个函数)。
|
|
25
|
-
*/
|
|
26
|
-
/** 0.73.3(CC-60 A-D3):`cursorSemantics` 机读位(server ≥7.77.0 `taskOutput` 面):"cursor" = 读了就消费 ⇒ append;"full" = 全量重读安全 ⇒ 替换。
|
|
27
|
-
* **缺席 / 认不出 ⇒ 现行文案标记臂兜底**(老 server 不发这个键;sdk 头注逐字「别把缺席当 full」)。 */
|
|
28
|
-
/**
|
|
29
|
-
* 回体 `output` 里参与合并判据的两枚提示位(sdk `SubagentOutputResult.output` 的子集;运行期仍按自有键结构读,不信任声明形)。
|
|
30
|
-
*/
|
|
31
11
|
export interface TaskOutputMergeHint {
|
|
32
12
|
readonly type?: string;
|
|
33
13
|
readonly retrieval_status?: string;
|
|
34
14
|
}
|
|
35
15
|
export declare function mergeTaskOutput(prev: string, fresh: string, cursorSemantics?: string, output?: TaskOutputMergeHint | null): string;
|
|
36
|
-
export type EngineTaskStopOutcome =
|
|
37
|
-
/** 200:停止动作完成(status = wire 终态照实;重复 stop 幂等)。 */
|
|
38
|
-
{
|
|
16
|
+
export type EngineTaskStopOutcome = {
|
|
39
17
|
ok: true;
|
|
40
18
|
status?: string;
|
|
41
19
|
stoppedBy?: string;
|
|
42
|
-
}
|
|
43
|
-
/** 409 stop.not_landed:kill 没落地,进程可能还在跑——UI 绝不能渲染成「已停止」。 */
|
|
44
|
-
| {
|
|
20
|
+
} | {
|
|
45
21
|
ok: false;
|
|
46
22
|
reason: 'not_landed';
|
|
47
23
|
detail?: string;
|
|
48
|
-
}
|
|
49
|
-
/** 409 stop.not_local(server 1.250+ durable 臂):任务在**别的实例**上还在跑,此处没有 kill
|
|
50
|
-
* 被尝试——「别处在跑,此处停不了」,非失败重试件([1518]§一)。UI 同样不翻行。 */
|
|
51
|
-
| {
|
|
24
|
+
} | {
|
|
52
25
|
ok: false;
|
|
53
26
|
reason: 'not_local';
|
|
54
27
|
detail?: string;
|
|
55
|
-
}
|
|
56
|
-
/** 409 stop.parked(server 1.263 parked 状态机):子代停在待审批检查点——不是在跑,也不该被
|
|
57
|
-
* stop 杀(人先 /decide);409 stop.park_resume_won:复活赛跑输给了别处的 resume。两者 UI
|
|
58
|
-
* 都不翻行(fleet 行渲染词汇已由 coerceTaskStatus 映射 'awaiting approval')。 */
|
|
59
|
-
| {
|
|
28
|
+
} | {
|
|
60
29
|
ok: false;
|
|
61
30
|
reason: 'parked' | 'park_resume_won';
|
|
62
31
|
detail?: string;
|
|
63
|
-
}
|
|
64
|
-
/** 409 stop.park_arbiter_unreachable(core 1.397 三分,G13 补齐的第五形):仲裁店不可达 ⇒
|
|
65
|
-
* **真相未知**(既不是「停了」也不是「没落地」)。UI 同样不翻行,但文案必须说「状态未知」——
|
|
66
|
-
* 塌进 not_landed 就是把「不知道」渲染成一个具体的失败原因。 */
|
|
67
|
-
| {
|
|
32
|
+
} | {
|
|
68
33
|
ok: false;
|
|
69
34
|
reason: 'park_arbiter_unreachable';
|
|
70
35
|
detail?: string;
|
|
71
|
-
}
|
|
72
|
-
/** 未知/未来 `stop.*` 码(开集 default)。不翻行;`detail` 带原文供诊断。 */
|
|
73
|
-
| {
|
|
36
|
+
} | {
|
|
74
37
|
ok: false;
|
|
75
38
|
reason: 'unknown_conflict';
|
|
76
39
|
detail?: string;
|
|
@@ -79,31 +42,7 @@ export type EngineTaskStopOutcome =
|
|
|
79
42
|
reason: 'unavailable' | 'error';
|
|
80
43
|
detail?: string;
|
|
81
44
|
};
|
|
82
|
-
/**
|
|
83
|
-
* 🔴 **G13 删债(先红后绿)**:taskStop 的 409 冲突分类 —— 手抄 code 判 → typed
|
|
84
|
-
* `TaskStopConflictError`(SDK 把**任何** `stop.*` 前缀码映到该类,errors.js:277-278;
|
|
85
|
-
* SDK 自己的注释还点名了壳的手抄位置 `engineTaskHandleWire.ts:186-197`)。
|
|
86
|
-
*
|
|
87
|
-
* 手抄版的实际缺陷(pure 门先红实证):SDK 明列**五**形,手抄只认前四形 ⇒ 第五形
|
|
88
|
-
* `stop.park_arbiter_unreachable`(core 1.397 三分:仲裁店不可达 ⇒ **真相未知**)静默塌进
|
|
89
|
-
* `not_landed`。
|
|
90
|
-
* 🔴 后果方向先定正负号([anchor-on-the-deciding-quantity]):门控的量 = 「UI 翻不翻这一行」,
|
|
91
|
-
* 五形与 default **全都是不翻** ⇒ 这不是安全缺陷,是**诚实缺陷** —— 把「真相未知」渲染成
|
|
92
|
-
* 「kill 没落地」,用户与诊断双双被误导。所以修法是给第五形一个自己的名字,而不是调整门。
|
|
93
|
-
*
|
|
94
|
-
* 开集纪律:`switch` 留 `default`(未来新 `stop.*` 码落 `unknown_conflict`,照样不翻行、
|
|
95
|
-
* 照样带原始 `code`),绝不塌进任何一个已知形 —— 塌进去就等于替 server 编了一个它没说的原因。
|
|
96
|
-
*/
|
|
97
45
|
export declare function classifyTaskStopConflict(e: unknown): EngineTaskStopOutcome;
|
|
98
|
-
/**
|
|
99
|
-
* 🟢 B8 ALLOW 清单登记(REF-CC-域词表-05,属主=client-core 规范重构轮,到期复议=SDK typed 错误类
|
|
100
|
-
* 覆盖全部 `stop.*` 码后或 2026-Q4 复审以先到者为准):兜底字面认码,前置合取 = typed
|
|
101
|
-
* `TaskStopConflictError` 缺席时才落到这里(见 `stopEngineTask` 的 `if (e instanceof
|
|
102
|
-
* TaskStopConflictError || status === 409)`)。同批同表的另两处:`detachWire.ts`
|
|
103
|
-
* `DETACH_DURABLE_OFF_400_ANCHOR`(server 契约话)、`classifierVerdictWire.ts`
|
|
104
|
-
* `CLASSIFIER_DENY_SIGNATURE`(core lockstep 机器签名)——三处互指,理由逐条写在各自站点。
|
|
105
|
-
*/
|
|
106
|
-
/** 停一个引擎侧任务句柄(新面 B)。只有 ok:true(=HTTP 200)算停了。绝不 throw。 */
|
|
107
46
|
export declare function stopEngineTask(handle: string, opts?: {
|
|
108
47
|
signal?: AbortSignal;
|
|
109
48
|
}): Promise<EngineTaskStopOutcome>;
|
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ⇄ B6 批搬迁(2026-07-27,设计稿 §3 B6):cli `src/sema/engineTaskHandleWire.ts` 整搬。
|
|
3
|
-
*
|
|
4
|
-
* 🔴 搬迁差分:`wireConfig()` → `engineWireTarget()`;`getActiveEngineTaskId()` →
|
|
5
|
-
* `activeEngineRunId()`;`logForDebugging` → `hostLog`;`process.env.SEMA_DEBUG` 前置判
|
|
6
|
-
* → `engineWireDebugEnabled()`。
|
|
7
|
-
*
|
|
8
|
-
* ── 以下为原文件的领域说明(逐字保留)────────────────────────────────────────────────────────
|
|
9
|
-
*
|
|
10
|
-
* engineTaskHandleWire — CC TaskOutput/TaskStop 人侧对位的 wire 消费([1501] server 1.246.0 /
|
|
11
|
-
* SDK 0.0.67 提货)。
|
|
12
|
-
*
|
|
13
|
-
* Wire(两面都是出生即强制带 `?session=`,与 subagentOutput 同姿势;非阻塞、副本本地):
|
|
14
|
-
* · 读:`GET /v1/runs/:id/tasks/:handle/output?session=` → SDK `runs.taskOutput`
|
|
15
|
-
* · 停:`POST /v1/runs/:id/tasks/:handle/stop?session=` → SDK `runs.taskStop`
|
|
16
|
-
* · :id = 宿主 run;:handle = canonical 句柄 ONLY(b… bash / m… monitor / a… agent)——
|
|
17
|
-
* 不收名字、不收 legacy shellId,传了就是 404;workflow(w…/wa…)恒 404(journal 是那边的
|
|
18
|
-
* 读面,永不打这里)。
|
|
19
|
-
* · 能力门 = capabilities.taskHandles(engineCapsCache 通用缓存,[1501] 明令:用能力位判断,
|
|
20
|
-
* 别 trial-by-501/404)。老引擎(≤1.245)缺该键 → 两动词都回落 null/不可用,version-safe。
|
|
21
|
-
*
|
|
22
|
-
* 读面游标语义([1501]§一 + [1505] must-fix 修正,UI 必须按此做):是否「读即消费」取决于句柄
|
|
23
|
-
* 形态——spooled 腿全量可重读、GET 幂等;cursor-only 腿每次 GET 只出新字节、读走就没了。
|
|
24
|
-
* 两形判别用 **wire 契约自带标记**(server [1505] 钉版承诺稳定,变更走 CHANGELOG+协作板;core
|
|
25
|
-
* CC-verbatim 固定形):content 含 `--- stdout (full, re-readable) ---` = spool 全量形 → 整体
|
|
26
|
-
* 替换;含 `--- new stdout ---` = cursor 增量形 → append。初版的「前缀延展」启发式被 [1505]
|
|
27
|
-
* 否决——spool content 首行 `status: <displayStatus>` 在任务完成时刻从 running 翻 exited,
|
|
28
|
-
* 前缀检测恰在最常见时刻失败 → 全量被 append = 输出重复。无标记(极端/未知形)按保守形
|
|
29
|
-
* append-if-changed 处理;空 content 不动累积。绝不假设重拉能拿到同样字节。
|
|
30
|
-
*
|
|
31
|
-
* ⚠️ cursor-only 腿双消费者 caveat([1505]):同一 b* 句柄若同时被模型侧 TaskOutput 工具读,
|
|
32
|
-
* 两个消费者互抢增量(工具读走的字节本读面拿不到,反之亦然),端侧累积在该形下不保证完整;
|
|
33
|
-
* spool 腿(server 正常接线下的常态)无此问题。UI 在 cursor 形下不承诺完整性。
|
|
34
|
-
*
|
|
35
|
-
* 停面语义([1501]§二):**只有 200 算停了**;409 `stop.not_landed` = kill 没落地、进程可能
|
|
36
|
-
* 还在跑(UI 绝不能渲染成「已停止」);终态句柄重复 stop 幂等诚实(200,状态照实)。
|
|
37
|
-
*
|
|
38
|
-
* `?filter=` 禁用(带了=400):CC 的 filter 语义由调用方拿回 content 后本地做,本模块不透传。
|
|
39
|
-
*/
|
|
40
1
|
import { TaskStopConflictError } from '@sema-agent/sdk';
|
|
41
2
|
import { hostLog } from '../host.js';
|
|
42
3
|
import { makeEngineWireClient } from '../engineWireSdk.js';
|
|
@@ -45,23 +6,8 @@ import { engineSessionParamFor } from '../engineSessionParam.js';
|
|
|
45
6
|
import { resolveOwnerContext } from './engineSubagentResume.js';
|
|
46
7
|
import { engineTaskHandlesCapable } from './engineRowStopGate.js';
|
|
47
8
|
import { noteBgOwnerAbsence } from './subagentOwnerAbsence.js';
|
|
48
|
-
// REF-CC-域词表-06 提单源:spool 全量/增量判读的单一真源现在在 toolResult.ts(它也消费同一份
|
|
49
|
-
// 协议标记表 PROTOCOL_MARKERS)—— 本文件不再自己 `.includes()` 抄一份判读。
|
|
50
9
|
import { spoolMarkerOf } from '../toolResult.js';
|
|
51
|
-
// G1 去字面化(2026-08-04):`stop.*` 五形的码字面收编进 `engineErrorCodes.ts` 单一真源。
|
|
52
|
-
// 顺序敏感的兜底认码数组也一并搬过去(顺序即语义,见那边的头注),本文件只 import。
|
|
53
10
|
import { STOP_CONFLICT_CODES, STOP_NOT_LANDED, STOP_NOT_LOCAL, STOP_PARKED, STOP_PARK_ARBITER_UNREACHABLE, STOP_PARK_RESUME_WON, } from '../engineErrorCodes.js';
|
|
54
|
-
// 能力门同步读口:真源在零依赖叶 `engineRowStopGate`(batch-stop 同步分类不拉本模块 SDK 图)。
|
|
55
|
-
// ⚠️ 此处**不再 re-export**——它与原定义同进 index.ts 的 `export *` barrel 会构成双出口,
|
|
56
|
-
// esbuild 对 star-export 歧义直接 build 失败(tsc 同源 symbol 不报=假绿;0.8.0 壳收批实撞,
|
|
57
|
-
// idle-terminal-settle 套逮住)。包内消费者直接 import 原叶。
|
|
58
|
-
/** 宿主 run 解析:fleet 行/通知帧喂的 parent 映射(行 id=`${runId} ${handle}` 的 parentId 投影,
|
|
59
|
-
* engineSide bash/monitor 行的出生帧即带)。
|
|
60
|
-
* 🔴 #242 批 3([4000] Q3=B 裁定执行,行为翻面):台账缺席即**诚实缺席**,绝不回落
|
|
61
|
-
* `activeEngineRunId()` —— 旧回落读的是 fetch 时刻的活跃 run,不是 register 时刻的宿主(头注
|
|
62
|
-
* 旧说法与实现不符):跨 turn 读旧句柄时回落值必错(404 撞别的 run),stop 打错 run 更坏。
|
|
63
|
-
* 缺席不静默(noteBgOwnerAbsence warn 留痕);两个消费口各自 fail-soft(output→null 回落
|
|
64
|
-
* receipt/outputFile 渲染,stop→unavailable + detail,UI 不翻行)。 */
|
|
65
11
|
function resolveHostRun(handle) {
|
|
66
12
|
const runId = resolveOwnerContext(handle).runId;
|
|
67
13
|
if (!runId) {
|
|
@@ -70,35 +16,15 @@ function resolveHostRun(handle) {
|
|
|
70
16
|
}
|
|
71
17
|
return runId;
|
|
72
18
|
}
|
|
73
|
-
/**
|
|
74
|
-
* 🔴 会话**二态**(design/285 批 3,与 tail / output / steer 三腿同一口径):
|
|
75
|
-
* · 句柄登记时**捕到了会话**(批 2 起 fleet 行帧腿经 ingress 三值同写)⇒ 用**行登记的**会话 ——
|
|
76
|
-
* 它与本腿寻址用的 `runId` 同源同拍,是唯一自洽的组合;
|
|
77
|
-
* · 没有随行会话 ⇒ 退**本槽的**现势会话(遵 [1498]③ 无条件带 session 的双版本兼容纪律)。
|
|
78
|
-
*
|
|
79
|
-
* 🔴 **为什么本腿也改**(设计稿 D6 原本只点名 tail/output,施工轮扩到本腿,同形存量族扫):
|
|
80
|
-
* 病形 = 「台账取的 runId 配现势 session」—— 两面出生即强制带 `?session=`(见文件头注),
|
|
81
|
-
* 对 session-bound 的旧 run 是确定性 404。批 2 落地之前本腿的行**没有**随行会话,这一格不可达;
|
|
82
|
-
* 批 2 让 fleet 行帧腿开始写 session 之后,它与 tail/output 变成同一个形。只修 tail/output 而
|
|
83
|
-
* 留下本腿 = 同一根因只修当格。停行(`stopEngineTask`)尤其不能留:它是有副作用的动作。
|
|
84
|
-
* 空串归一仍只在 `engineSessionParamFor` 一处,本函数不重铸。
|
|
85
|
-
*/
|
|
86
19
|
function sessionOf(ctx) {
|
|
87
20
|
const s = ctx.record?.sessionId ?? engineSessionParamFor(ctx.key);
|
|
88
21
|
return s !== undefined ? { session: s } : {};
|
|
89
22
|
}
|
|
90
|
-
// 游标累积(按 handle;进程内存态,与查看态生命周期同级——端重启即空,重读从引擎再取)
|
|
91
23
|
const accumulated = new Map();
|
|
92
|
-
/** 测试钩:清累积缓存。 */
|
|
93
24
|
export function __resetTaskHandleWireForTests() {
|
|
94
25
|
accumulated.clear();
|
|
95
26
|
}
|
|
96
|
-
/**
|
|
97
|
-
* 读一个引擎侧任务句柄的输出(新面 A)。null = 读不到(无 wire / caps 缺 / 无宿主 run / 404
|
|
98
|
-
* 域外或已 reap / 网错)——调用方回落既有渲染(receipt/outputFile tail)。绝不 throw。
|
|
99
|
-
*/
|
|
100
27
|
export async function fetchEngineTaskOutput(handle, opts) {
|
|
101
|
-
// design/285 批 3(D7b):wire target 与 caps 门都按**这条句柄所属的槽**取,不再写死默认槽。
|
|
102
28
|
const owner = resolveOwnerContext(handle);
|
|
103
29
|
const cfg = engineWireTargetFor(owner.key);
|
|
104
30
|
if (!cfg || !engineTaskHandlesCapable(owner.key))
|
|
@@ -116,15 +42,10 @@ export async function fetchEngineTaskOutput(handle, opts) {
|
|
|
116
42
|
try {
|
|
117
43
|
const r = await client.runs.taskOutput(runId, handle, {
|
|
118
44
|
...(opts?.signal ? { signal: opts.signal } : {}),
|
|
119
|
-
// design/285 批 3:会话二态(行登记的优先,缺则退本槽现势)——判据本体见 sessionOf 头注。
|
|
120
45
|
...(sessionOf(owner)),
|
|
121
46
|
});
|
|
122
47
|
const fresh = typeof r?.content === 'string' ? r.content : '';
|
|
123
48
|
const prev = accumulated.get(handle) ?? '';
|
|
124
|
-
// A-D3:机读位优先 —— sdk 9.7.1 `SubagentOutputResult.cursorSemantics` 是**回体顶层**键(与 `output` 并列;generic taskOutput 面才铸,
|
|
125
|
-
// 窄面 subagentOutput 不带 ⇒ 缺席走文案臂)。异源对抗复审:首版读成 `output.cursorSemantics`,正常回体恒回落文案臂。
|
|
126
|
-
// 0.77.1 CC-109(server ≥7.92.0):机读位缺席时把回体 `output` 的 `type` / `retrieval_status` 交给合并判据(见 mergeTaskOutput 头注);
|
|
127
|
-
// 声明形只到 `TaskOutputMergeHint`(sdk 回体 `output` 的子集),运行期在 `terminalOutputHint` 里再按自有键结构读一遍(不信任声明形)。
|
|
128
49
|
const cursorSemantics = r?.cursorSemantics;
|
|
129
50
|
const output = r?.output;
|
|
130
51
|
const merged = mergeTaskOutput(prev, fresh, typeof cursorSemantics === 'string' ? cursorSemantics : undefined, output);
|
|
@@ -153,10 +74,6 @@ export function mergeTaskOutput(prev, fresh, cursorSemantics, output) {
|
|
|
153
74
|
return fresh;
|
|
154
75
|
if (cursorSemantics === 'cursor')
|
|
155
76
|
return prev + fresh;
|
|
156
|
-
// 🔴 机读位缺席(0.77.1 CC-109,server ≥7.92.0 判据换源 core `details.replay`):
|
|
157
|
-
// · `type: background_agent / workflow` 的 poll 面**不铸**这一位(终局结果面,再 poll 答同一段文本)⇒ 整段替换,绝不追加;
|
|
158
|
-
// · `retrieval_status` 在场且不是 `success`(not_ready / error 无已消费正文)⇒ 那段 `content` 是一句状态说明不是输出体 ⇒ 不合并;
|
|
159
|
-
// · 其余(老 server / background_bash 无机读位)才走下面的文案臂。判据只在缺席时看 `output`,在场的机读位永远优先。
|
|
160
77
|
const hint = terminalOutputHint(output);
|
|
161
78
|
if (hint === 'not_output')
|
|
162
79
|
return prev;
|
|
@@ -169,7 +86,6 @@ export function mergeTaskOutput(prev, fresh, cursorSemantics, output) {
|
|
|
169
86
|
return prev + fresh;
|
|
170
87
|
return fresh === prev ? prev : prev + fresh;
|
|
171
88
|
}
|
|
172
|
-
/** 回体 `output` 的两枚提示位(只读自有键,坏形一律 `undefined` = 没提示)。 */
|
|
173
89
|
function terminalOutputHint(output) {
|
|
174
90
|
if (output === null || typeof output !== 'object' || Array.isArray(output))
|
|
175
91
|
return undefined;
|
|
@@ -182,31 +98,9 @@ function terminalOutputHint(output) {
|
|
|
182
98
|
return 'snapshot';
|
|
183
99
|
return undefined;
|
|
184
100
|
}
|
|
185
|
-
/**
|
|
186
|
-
* 🔴 **G13 删债(先红后绿)**:taskStop 的 409 冲突分类 —— 手抄 code 判 → typed
|
|
187
|
-
* `TaskStopConflictError`(SDK 把**任何** `stop.*` 前缀码映到该类,errors.js:277-278;
|
|
188
|
-
* SDK 自己的注释还点名了壳的手抄位置 `engineTaskHandleWire.ts:186-197`)。
|
|
189
|
-
*
|
|
190
|
-
* 手抄版的实际缺陷(pure 门先红实证):SDK 明列**五**形,手抄只认前四形 ⇒ 第五形
|
|
191
|
-
* `stop.park_arbiter_unreachable`(core 1.397 三分:仲裁店不可达 ⇒ **真相未知**)静默塌进
|
|
192
|
-
* `not_landed`。
|
|
193
|
-
* 🔴 后果方向先定正负号([anchor-on-the-deciding-quantity]):门控的量 = 「UI 翻不翻这一行」,
|
|
194
|
-
* 五形与 default **全都是不翻** ⇒ 这不是安全缺陷,是**诚实缺陷** —— 把「真相未知」渲染成
|
|
195
|
-
* 「kill 没落地」,用户与诊断双双被误导。所以修法是给第五形一个自己的名字,而不是调整门。
|
|
196
|
-
*
|
|
197
|
-
* 开集纪律:`switch` 留 `default`(未来新 `stop.*` 码落 `unknown_conflict`,照样不翻行、
|
|
198
|
-
* 照样带原始 `code`),绝不塌进任何一个已知形 —— 塌进去就等于替 server 编了一个它没说的原因。
|
|
199
|
-
*/
|
|
200
101
|
export function classifyTaskStopConflict(e) {
|
|
201
102
|
const detail = e instanceof Error ? e.message : String(e);
|
|
202
103
|
const raw = e?.errorCode;
|
|
203
|
-
// typed 优先:SDK typed 错误(APIError 族)的机器码属性是 **`errorCode`**(peer 地板 >=2.0.0 恒有)。
|
|
204
|
-
// 🔴 2026-07-30 提货批实锤:此前这里读 `.code` —— 那是 0.x SDK 的属性名,1.0.0 错误层级重做后
|
|
205
|
-
// typed 类只带 `.errorCode`,于是五形分类整体塌 `unknown_conflict`。本仓 pure 门没抓到,因为
|
|
206
|
-
// 测试 fixture 也是手搓 `{status, code}` 老形 —— 实现与 fixture 同错互证(假绿)。壳的
|
|
207
|
-
// run-bulk-stop-engine-rows 门用**真 SDK** 打假 HTTP 引擎才现形(跨仓交叉验证)。修后 fixture
|
|
208
|
-
// 改锚实装 SDK 的 TaskStopConflictError 真类,fixture 再也漂不动。
|
|
209
|
-
// 兜底(非 typed 抛点):errorCode 非串时从 message 里认字面 —— 回落,不是主判据。
|
|
210
104
|
const code = typeof raw === 'string'
|
|
211
105
|
? raw
|
|
212
106
|
: (STOP_CONFLICT_CODES.find(c => detail.includes(c)) ?? '');
|
|
@@ -222,24 +116,10 @@ export function classifyTaskStopConflict(e) {
|
|
|
222
116
|
case STOP_NOT_LANDED:
|
|
223
117
|
return { ok: false, reason: 'not_landed', detail };
|
|
224
118
|
default:
|
|
225
|
-
// 开集:未知/未来 `stop.*`(以及 code 完全缺席的残破形)。诚实说「有冲突但我不认识它」,
|
|
226
|
-
// 不冒充 not_landed。UI 处置与其余五形相同(不翻行)。
|
|
227
119
|
return { ok: false, reason: 'unknown_conflict', detail };
|
|
228
120
|
}
|
|
229
121
|
}
|
|
230
|
-
/**
|
|
231
|
-
* 🟢 B8 ALLOW 清单登记(REF-CC-域词表-05,属主=client-core 规范重构轮,到期复议=SDK typed 错误类
|
|
232
|
-
* 覆盖全部 `stop.*` 码后或 2026-Q4 复审以先到者为准):兜底字面认码,前置合取 = typed
|
|
233
|
-
* `TaskStopConflictError` 缺席时才落到这里(见 `stopEngineTask` 的 `if (e instanceof
|
|
234
|
-
* TaskStopConflictError || status === 409)`)。同批同表的另两处:`detachWire.ts`
|
|
235
|
-
* `DETACH_DURABLE_OFF_400_ANCHOR`(server 契约话)、`classifierVerdictWire.ts`
|
|
236
|
-
* `CLASSIFIER_DENY_SIGNATURE`(core lockstep 机器签名)——三处互指,理由逐条写在各自站点。
|
|
237
|
-
*/
|
|
238
|
-
/* 兜底字面认码用的已知集(顺序 = 长码优先,避免 `stop.parked` 抢走 `stop.park_resume_won`)
|
|
239
|
-
* 已随 G1 去字面化搬到 `engineErrorCodes.ts` 的 `STOP_CONFLICT_CODES` —— 顺序即语义那条注也在那边。 */
|
|
240
|
-
/** 停一个引擎侧任务句柄(新面 B)。只有 ok:true(=HTTP 200)算停了。绝不 throw。 */
|
|
241
122
|
export async function stopEngineTask(handle, opts) {
|
|
242
|
-
// design/285 批 3(D7b):同 `fetchEngineTaskOutput` —— 停行是有副作用的动作,打错引擎更坏。
|
|
243
123
|
const owner = resolveOwnerContext(handle);
|
|
244
124
|
const cfg = engineWireTargetFor(owner.key);
|
|
245
125
|
if (!cfg || !engineTaskHandlesCapable(owner.key))
|
|
@@ -257,7 +137,6 @@ export async function stopEngineTask(handle, opts) {
|
|
|
257
137
|
try {
|
|
258
138
|
const r = await client.runs.taskStop(runId, handle, {
|
|
259
139
|
...(opts?.signal ? { signal: opts.signal } : {}),
|
|
260
|
-
// design/285 批 3:会话二态(行登记的优先,缺则退本槽现势)——判据本体见 sessionOf 头注。
|
|
261
140
|
...(sessionOf(owner)),
|
|
262
141
|
});
|
|
263
142
|
const out = r?.output ?? {};
|
|
@@ -274,11 +153,6 @@ export async function stopEngineTask(handle, opts) {
|
|
|
274
153
|
const status = e?.status;
|
|
275
154
|
const detail = e instanceof Error ? e.message : String(e);
|
|
276
155
|
hostLog('debug', `[task-handle] stop ${handle} via run ${runId}: ${typeof status === 'number' ? status : detail.slice(0, 160)}`);
|
|
277
|
-
// [1521]F2 订正:server 文案句里不含 errorCode 字面(message 判恒 miss=死分形),而 SDK
|
|
278
|
-
// APIError.code 一直透 errorCode——锚 code(对文案措辞变化免疫),message 兜底保留。
|
|
279
|
-
// 🔴 G13:判别锚从 `status===409` 换成 **typed 类**(`TaskStopConflictError`)—— SDK 把任何
|
|
280
|
-
// `stop.*` 码都映到它,以后 server 换 HTTP 码(或同码复用别的语义)时这条腿不会失灵;
|
|
281
|
-
// status 判保留为兜底(老 SDK 不抛 typed 类时仍要认)。
|
|
282
156
|
if (e instanceof TaskStopConflictError || status === 409) {
|
|
283
157
|
return classifyTaskStopConflict(e);
|
|
284
158
|
}
|
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* subagentOwnerAbsence — #242 批 3(协作板 [4000] Q3=B 裁定落地):bg 子代宿主 run 台账缺席时的
|
|
3
|
-
* **响亮留痕**单源。
|
|
4
|
-
*
|
|
5
|
-
* 三条读面腿(`engineSubagentTail` / `engineTaskHandleWire` / `engineSubagentOutput`)此前一律
|
|
6
|
-
* `getBgParentRun(x) ?? activeEngineRunId()` 无条件回落 —— 与 resume 腿的 `resolveOwnerRunId`
|
|
7
|
-
* (指名了行就诚实缺席,绝不回落)口径相反。Q3 裁定统一到 resume 口径:**台账缺席即诚实缺席,
|
|
8
|
-
* 绝不回落**。理由(壳 `subagentOwnerLedger` 对抗复审结论,已入包表头注):进程级
|
|
9
|
-
* `activeEngineRunId()` 被并发 main/fork 流互相覆写、又被每个 query 的 finally 清空,回落出来的
|
|
10
|
-
* 宿主可能是**别的 run** —— 错值比缺席更坏(读面打到不相干的 run;stop 打错 run 甚至可能停掉
|
|
11
|
-
* 别人的同名句柄)。
|
|
12
|
-
*
|
|
13
|
-
* 但缺席也不许**静默空转**(clay 原话「有问题必暴露」):本模块对每个 (腿, taskId) 组合 warn
|
|
14
|
-
* **一次**(查看态 watcher / 面板 tick 会按拍重试同一缺席,逐次 warn = 刷屏;去重集有界 FIFO)。
|
|
15
|
-
* 消费方照旧 fail-soft 返回缺席值(null/不开流)—— 响亮的是留痕,不是抛错。
|
|
16
|
-
*
|
|
17
|
-
* 🔴 独立小叶而不进 `subagentContentStore`(台账属主):那个 store 是**零 import 的内核闭包件**
|
|
18
|
-
* (portability 门的 runStream 闭包文件数棘轮只许降),拉 `host.js` 进去会撑大内核闭包;三条腿
|
|
19
|
-
* 都在 `subagent/`、都已依赖 host,落这里零新增图边。
|
|
20
|
-
*/
|
|
21
1
|
import { hostLog } from '../host.js';
|
|
22
2
|
const noted = new Set();
|
|
23
3
|
const MAX_NOTED = 512;
|
|
24
|
-
/** 台账缺席留痕(每 (leg, taskId) 至多一条 warn;绝不 throw)。 */
|
|
25
4
|
export function noteBgOwnerAbsence(leg, taskId) {
|
|
26
5
|
const key = `${leg}:${taskId}`;
|
|
27
6
|
if (noted.has(key))
|
|
@@ -36,13 +15,9 @@ export function noteBgOwnerAbsence(leg, taskId) {
|
|
|
36
15
|
hostLog('warn', `[subagent-owner] ${leg}: no host-run mapping for ${taskId} — not connecting (owner ledger absent ⇒ honest absence; active-run fallback removed per [4000] Q3)`);
|
|
37
16
|
}
|
|
38
17
|
catch {
|
|
39
|
-
// 诊断端口自己抛错(P-F4):①绝不向三腿调用方外溢(留痕是旁路,不是三腿的失败模式);
|
|
40
|
-
// ②撤销去重键 —— warn 没真发出去,留痕机会不许被一次坏端口永久烧掉,端口恢复后
|
|
41
|
-
// 下一次同键缺席仍会 warn 一次。
|
|
42
18
|
noted.delete(key);
|
|
43
19
|
}
|
|
44
20
|
}
|
|
45
|
-
/** 测试钩:清留痕去重集(同进程多组断言之间互不污染)。 */
|
|
46
21
|
export function __resetBgOwnerAbsenceForTests() {
|
|
47
22
|
noted.clear();
|
|
48
23
|
}
|