@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/sandboxWire.d.ts
CHANGED
|
@@ -13,52 +13,14 @@ export type SandboxParseResult = {
|
|
|
13
13
|
ok: false;
|
|
14
14
|
error: string;
|
|
15
15
|
};
|
|
16
|
-
/**
|
|
17
|
-
* Parse `--sandbox` out of an argv slice (everything before a bare `--`; both `--sandbox <v>` and
|
|
18
|
-
* `--sandbox=<v>` forms). No flag ⇒ `{mode:'default'}`. Repeated flag ⇒ LAST wins (commander convention).
|
|
19
|
-
* Missing value / flag-shaped value / empty / over-long ⇒ fail-LOUD parse error (never a silent default —
|
|
20
|
-
* a mis-typed environment choice must not quietly run on the wrong image).
|
|
21
|
-
*
|
|
22
|
-
* 🔴 [2393] sweep-F10(2026-08-03 全窗复审)**承诺范围如实收窄**(裁定:行为不改,话改):
|
|
23
|
-
* 「fail-LOUD,never a silent default」这句话现在**不**覆盖一种输入 —— 同一个旗**重复出现**且
|
|
24
|
-
* 前一次缺值/非法、后一次合法(`--sandbox --sandbox foo`):
|
|
25
|
-
* 收编前是 per-occurrence eager validate,在**第一个**缺值 occurrence 上就 fail-loud;收编后走
|
|
26
|
-
* `lastFlagValue`('invalidate' 缺省)= 后一次合法 occurrence 覆盖前一次,整体接受。
|
|
27
|
-
* 为什么裁定不改回去:本模块自己写着的契约就是「Repeated flag ⇒ LAST wins(commander convention)」,
|
|
28
|
-
* eager-validate 违反的正是这条契约(它让**被覆盖掉的**那一次决定整条命令的成败)。
|
|
29
|
-
* 剩下的形(唯一一次出现却缺值 / 值是旗形 / 空 / 超长 / 带空白)**仍然全部 fail-loud** —— 那才是
|
|
30
|
-
* 「打错一个字就悄悄跑在别的镜像上」真正要防的那一族。
|
|
31
|
-
* ⚠️ `docs/REFACTOR-LEDGER.md` REF-CC-143 的处置列此前写的是「缺值策略**统一** fail-loud」,
|
|
32
|
-
* 与落地的两策略叶(`'invalidate'` / `'latch-previous'`)相悖,已同批改正(sweep-F11)。 */
|
|
33
16
|
export declare function parseSandboxArgv(argv: readonly string[]): SandboxParseResult;
|
|
34
|
-
/** The request-body stamp for a selection: EXPLICIT ⇒ `{sandboxImageProfile}`, default/auto ⇒ nothing
|
|
35
|
-
* (auto is advisory-by-prompt — the submit itself never carries a profile, per clay's c) 口径). */
|
|
36
17
|
export declare function sandboxRequestFields(sel: SandboxSelection | undefined): {
|
|
37
18
|
sandboxImageProfile?: string;
|
|
38
19
|
};
|
|
39
|
-
/**
|
|
40
|
-
* The `--sandbox auto` advisory block. Design choices (each deliberate):
|
|
41
|
-
* - Conditional on the tool being mounted: `SelectEnvironment` reaches the model via the deployment's
|
|
42
|
-
* `spec.tools` injection (service select-environment-tool.ts RFC A2) — a worker without it must degrade
|
|
43
|
-
* HONESTLY (model says so and continues on the default), not hallucinate a selection.
|
|
44
|
-
* - The `Sandbox: <profile> — <reason>` reply line IS the run-card echo (可观测可纠正): the tool call
|
|
45
|
-
* renders as a normal tool card and the choice+reason line lands in the assistant reply — zero new
|
|
46
|
-
* renderer machinery, zero new server endpoints.
|
|
47
|
-
* - Boundary honesty: the server applies a session's selection from the NEXT task boundary ([440] F3),
|
|
48
|
-
* so the advisory says so — the model must not promise the current turn already runs on the new image.
|
|
49
|
-
*/
|
|
50
20
|
export declare const AUTO_SANDBOX_ADVISORY: string;
|
|
51
|
-
/** Prefix an objective with the auto-select advisory (one-shot — the caller owns the latch). */
|
|
52
21
|
export declare function wrapObjectiveWithAutoSandboxAdvisory(objective: string): string;
|
|
53
22
|
export declare const SANDBOX_K8S_ONLY_400_ANCHOR = "only supported on the k8s sandbox backend";
|
|
54
23
|
export declare const SANDBOX_NO_IMAGE_INDEX_400_ANCHOR = "requires the image index";
|
|
55
24
|
export declare const SANDBOX_NO_PUBLISHED_IMAGE_404_ANCHOR = "no published sandbox image for profile";
|
|
56
25
|
export declare const SANDBOX_CASCADE_CONFLICT_400_ANCHOR = "not supported together with cascade/verify";
|
|
57
|
-
/**
|
|
58
|
-
* Map a submit failure → the sandbox DEGRADATION HINT, or undefined when the error is not sandbox-shaped.
|
|
59
|
-
* Keys on the server's honest reject texts (the four `SANDBOX_*_ANCHOR` constants above) — status+substring,
|
|
60
|
-
* the same recognize-by-wire-shape idiom the quota/scenario copy modules use. The caller renders it under
|
|
61
|
-
* the raw "API Error: …" row (original message preserved — the hint supplements, never masks, the server's
|
|
62
|
-
* own words).
|
|
63
|
-
*/
|
|
64
26
|
export declare function sandboxDegradeHint(err: unknown): string | undefined;
|
package/dist/sandboxWire.js
CHANGED
|
@@ -1,60 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* src/sema/sandboxWire.ts — [686]② `--sandbox` TRI-STATE flag (clay 拍, 2026-07-13): the CLI face of the
|
|
3
|
-
* per-task SANDBOX IMAGE PROFILE the server already ships end-to-end (`TaskRequest.sandboxImageProfile`
|
|
4
|
-
* per-task binding + the model-facing `SelectEnvironment` tool + the `GET /v1/images` catalog).
|
|
5
|
-
*
|
|
6
|
-
* TRI-STATE (clay 口径):
|
|
7
|
-
* a) DEFAULT (no flag) → NO `sandboxImageProfile` on the POST body — the worker's default image runs.
|
|
8
|
-
* b) `--sandbox <profile>` → EXPLICIT: stamp `sandboxImageProfile` (SDK types.ts:115 → service
|
|
9
|
-
* main.ts:2316 resolves profile→digest FAIL-CLOSED with the caller's principal — we only ever send the
|
|
10
|
-
* PROFILE, never a digest). Vocabulary = the live catalog (`sema cloud images list` / GET /v1/images) —
|
|
11
|
-
* the shell does NOT pre-validate against it (fail-closed admission is the server's job; a typo comes
|
|
12
|
-
* back as an honest 404, mapped to a hint by sandboxDegradeHint below).
|
|
13
|
-
* c) `--sandbox auto` → ADVISORY: the submit carries NO profile; instead the FIRST live turn's
|
|
14
|
-
* objective is prefixed with an advisory block asking the model to drive the `SelectEnvironment` tool
|
|
15
|
-
* itself (list → pick → report `Sandbox: <profile> — <reason>` in its reply, so the choice + reason are
|
|
16
|
-
* visible on the run card and correctable by the user). NOT a hard route — server keeps zero new
|
|
17
|
-
* endpoints; the tool's session binding takes effect from the NEXT task boundary ([440] F3 contract).
|
|
18
|
-
*
|
|
19
|
-
* LANE HONESTY (诚实不撒谎 UI, [686] constraint): the profile only works on the k8s sandbox lane — an
|
|
20
|
-
* e2b/host-lane worker (including the local TOC self-spawned engine) 400s the submit honestly
|
|
21
|
-
* (service main.ts:2323 "sandboxImageProfile is only supported on the k8s sandbox backend"). The shell does
|
|
22
|
-
* NOT pre-judge the lane (no caps sniffing before submit — per [686]: "不预判 lane,收到 400 再提示");
|
|
23
|
-
* it maps the server's honest reject into a degradation hint (sandboxDegradeHint) rendered on the error row.
|
|
24
|
-
* So on the local self-spawned engine `--sandbox <profile>` = a LOUD per-turn failure with an actionable
|
|
25
|
-
* hint — never a silent ignore (silently dropping the user's explicit environment choice would be lying).
|
|
26
|
-
*/
|
|
27
1
|
import { lastFlagValue } from './argvFlagValue.js';
|
|
28
|
-
/** Mirror of the server's own body validation (server.ts:4651): non-empty, ≤128 chars. Validating locally
|
|
29
|
-
* just converts a guaranteed 400 into an immediate CLI error — same rule, earlier and cheaper. */
|
|
30
2
|
const MAX_PROFILE_LEN = 128;
|
|
31
3
|
const USAGE_HINT = "sema: --sandbox expects a profile name or 'auto'.\n" +
|
|
32
4
|
' --sandbox <profile> run on that sandbox image profile (k8s-lane workers; list: sema cloud images list)\n' +
|
|
33
5
|
' --sandbox auto let the model pick via its SelectEnvironment tool (advisory — choice + reason shown in the reply)\n' +
|
|
34
6
|
' (no flag) the worker default image';
|
|
35
|
-
/**
|
|
36
|
-
* Parse `--sandbox` out of an argv slice (everything before a bare `--`; both `--sandbox <v>` and
|
|
37
|
-
* `--sandbox=<v>` forms). No flag ⇒ `{mode:'default'}`. Repeated flag ⇒ LAST wins (commander convention).
|
|
38
|
-
* Missing value / flag-shaped value / empty / over-long ⇒ fail-LOUD parse error (never a silent default —
|
|
39
|
-
* a mis-typed environment choice must not quietly run on the wrong image).
|
|
40
|
-
*
|
|
41
|
-
* 🔴 [2393] sweep-F10(2026-08-03 全窗复审)**承诺范围如实收窄**(裁定:行为不改,话改):
|
|
42
|
-
* 「fail-LOUD,never a silent default」这句话现在**不**覆盖一种输入 —— 同一个旗**重复出现**且
|
|
43
|
-
* 前一次缺值/非法、后一次合法(`--sandbox --sandbox foo`):
|
|
44
|
-
* 收编前是 per-occurrence eager validate,在**第一个**缺值 occurrence 上就 fail-loud;收编后走
|
|
45
|
-
* `lastFlagValue`('invalidate' 缺省)= 后一次合法 occurrence 覆盖前一次,整体接受。
|
|
46
|
-
* 为什么裁定不改回去:本模块自己写着的契约就是「Repeated flag ⇒ LAST wins(commander convention)」,
|
|
47
|
-
* eager-validate 违反的正是这条契约(它让**被覆盖掉的**那一次决定整条命令的成败)。
|
|
48
|
-
* 剩下的形(唯一一次出现却缺值 / 值是旗形 / 空 / 超长 / 带空白)**仍然全部 fail-loud** —— 那才是
|
|
49
|
-
* 「打错一个字就悄悄跑在别的镜像上」真正要防的那一族。
|
|
50
|
-
* ⚠️ `docs/REFACTOR-LEDGER.md` REF-CC-143 的处置列此前写的是「缺值策略**统一** fail-loud」,
|
|
51
|
-
* 与落地的两策略叶(`'invalidate'` / `'latch-previous'`)相悖,已同批改正(sweep-F11)。 */
|
|
52
7
|
export function parseSandboxArgv(argv) {
|
|
53
|
-
// REF-CC-143(dup-07)收编:extraction 改吃共用 lastFlagValue(argvFlagValue.ts)——scan-all-then-
|
|
54
|
-
// validate-once, matching this module's own documented "Repeated flag ⇒ LAST wins" contract (the
|
|
55
|
-
// former per-occurrence eager-validate loop actually violated that contract: an earlier INVALID
|
|
56
|
-
// occurrence overridden by a later VALID one used to fail-loud on the earlier one instead of
|
|
57
|
-
// honoring the later value — fixed as a side effect of the consolidation, not a logic rewrite).
|
|
58
8
|
const flag = lastFlagValue(argv, '--sandbox');
|
|
59
9
|
if (!flag.present)
|
|
60
10
|
return { ok: true, sel: { mode: 'default' } };
|
|
@@ -63,10 +13,6 @@ export function parseSandboxArgv(argv) {
|
|
|
63
13
|
const v = flag.raw.trim();
|
|
64
14
|
if (v.length === 0)
|
|
65
15
|
return { ok: false, error: USAGE_HINT };
|
|
66
|
-
// audit #17: a bare `--sandbox` EATS the following positional — `-p --sandbox 'say hi'`
|
|
67
|
-
// consumed the prompt as the profile, then died on an unrelated "Input must be provided…"
|
|
68
|
-
// error. Profile names never contain whitespace; a value that does is almost certainly the
|
|
69
|
-
// user's prompt — say exactly that instead of silently mis-parsing.
|
|
70
16
|
if (/\s/.test(v)) {
|
|
71
17
|
return {
|
|
72
18
|
ok: false,
|
|
@@ -84,49 +30,21 @@ export function parseSandboxArgv(argv) {
|
|
|
84
30
|
const sel = v === 'auto' ? { mode: 'auto' } : { mode: 'explicit', profile: v };
|
|
85
31
|
return { ok: true, sel };
|
|
86
32
|
}
|
|
87
|
-
/** The request-body stamp for a selection: EXPLICIT ⇒ `{sandboxImageProfile}`, default/auto ⇒ nothing
|
|
88
|
-
* (auto is advisory-by-prompt — the submit itself never carries a profile, per clay's c) 口径). */
|
|
89
33
|
export function sandboxRequestFields(sel) {
|
|
90
34
|
return sel?.mode === 'explicit' ? { sandboxImageProfile: sel.profile } : {};
|
|
91
35
|
}
|
|
92
|
-
/**
|
|
93
|
-
* The `--sandbox auto` advisory block. Design choices (each deliberate):
|
|
94
|
-
* - Conditional on the tool being mounted: `SelectEnvironment` reaches the model via the deployment's
|
|
95
|
-
* `spec.tools` injection (service select-environment-tool.ts RFC A2) — a worker without it must degrade
|
|
96
|
-
* HONESTLY (model says so and continues on the default), not hallucinate a selection.
|
|
97
|
-
* - The `Sandbox: <profile> — <reason>` reply line IS the run-card echo (可观测可纠正): the tool call
|
|
98
|
-
* renders as a normal tool card and the choice+reason line lands in the assistant reply — zero new
|
|
99
|
-
* renderer machinery, zero new server endpoints.
|
|
100
|
-
* - Boundary honesty: the server applies a session's selection from the NEXT task boundary ([440] F3),
|
|
101
|
-
* so the advisory says so — the model must not promise the current turn already runs on the new image.
|
|
102
|
-
*/
|
|
103
36
|
export const AUTO_SANDBOX_ADVISORY = '<sandbox-auto-select>\n' +
|
|
104
37
|
'The user launched this session with `--sandbox auto`: choose the best sandbox environment (image profile) for the work in this session yourself.\n' +
|
|
105
38
|
'If a SelectEnvironment tool is available: call it with no arguments to list the available profiles and their capabilities, then select the one that best fits the task (keep the default if nothing fits better). After deciding, report your choice on its own line, exactly in this form: `Sandbox: <profile> — <one-line reason>` (use `Sandbox: default — <reason>` if you kept the default). Note the selection takes effect from the next task boundary — the current turn keeps the environment it started with.\n' +
|
|
106
39
|
'If no SelectEnvironment tool is available, briefly say so and continue in the default environment.\n' +
|
|
107
40
|
'</sandbox-auto-select>';
|
|
108
|
-
/** Prefix an objective with the auto-select advisory (one-shot — the caller owns the latch). */
|
|
109
41
|
export function wrapObjectiveWithAutoSandboxAdvisory(objective) {
|
|
110
42
|
return `${AUTO_SANDBOX_ADVISORY}\n\n${objective}`;
|
|
111
43
|
}
|
|
112
|
-
// ── REF-CC-124(域词表-03,P3 wave1 卡C-argv):四条拒绝 hint 判别锚常量化 ─────────────────────────
|
|
113
|
-
// ALLOW 登记(与 detachWire.DETACH_DURABLE_OFF_400_ANCHOR 同形):这四条锚的是**另一个仓**
|
|
114
|
-
// (ai-agent-service)当下的拒绝原文(main.ts SelectEnvironment 校验分支 / per-task-image.ts 镜像
|
|
115
|
-
// 索引缺席分支 / server.ts submit 校验分支)——只留文件名+分支语义,不锚外仓行号(它们会腐烂,
|
|
116
|
-
// wave1 回炉 advisory 修:server 改字即静默失效,失效方向只丢 hint、不误伤,是本族里后果最轻的
|
|
117
|
-
// 一处,故过渡期常量化而非阻断发车)。
|
|
118
|
-
// 候 server 5.0.0 errorCode 换轨,#117(上游到货后这四条整族改吃 errorCode,判别不再靠字符串锚)。
|
|
119
44
|
export const SANDBOX_K8S_ONLY_400_ANCHOR = 'only supported on the k8s sandbox backend';
|
|
120
45
|
export const SANDBOX_NO_IMAGE_INDEX_400_ANCHOR = 'requires the image index';
|
|
121
46
|
export const SANDBOX_NO_PUBLISHED_IMAGE_404_ANCHOR = 'no published sandbox image for profile';
|
|
122
47
|
export const SANDBOX_CASCADE_CONFLICT_400_ANCHOR = 'not supported together with cascade/verify';
|
|
123
|
-
/**
|
|
124
|
-
* Map a submit failure → the sandbox DEGRADATION HINT, or undefined when the error is not sandbox-shaped.
|
|
125
|
-
* Keys on the server's honest reject texts (the four `SANDBOX_*_ANCHOR` constants above) — status+substring,
|
|
126
|
-
* the same recognize-by-wire-shape idiom the quota/scenario copy modules use. The caller renders it under
|
|
127
|
-
* the raw "API Error: …" row (original message preserved — the hint supplements, never masks, the server's
|
|
128
|
-
* own words).
|
|
129
|
-
*/
|
|
130
48
|
export function sandboxDegradeHint(err) {
|
|
131
49
|
const e = err;
|
|
132
50
|
if (typeof e?.status !== 'number' || typeof e?.message !== 'string')
|
package/dist/scenarioWire.d.ts
CHANGED
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* src/sema/scenarioWire.ts — `--scenario <name>` wire (clay 拍, 2026-07-15): expose the engine's
|
|
3
|
-
* REQUEST-LEVEL scenario routing axis on the headless `-p` path. The server has shipped scenario
|
|
4
|
-
* routing since day one (ai-agent-service capabilities/scenarios.ts — `TaskRequest.scenario` picks the
|
|
5
|
-
* tool roster + prompt provider per request: default / code-review / scan / oa / team + center-declared
|
|
6
|
-
* overlays); the shell simply never exposed the field to users. This module is the CLI face.
|
|
7
|
-
*
|
|
8
|
-
* PRECEDENCE (flag > settings > default):
|
|
9
|
-
* a) `--scenario <name>` (explicit flag) → stamp `TaskRequest.scenario`.
|
|
10
|
-
* b) `SEMA_HEADLESS_SCENARIO` env — the settings lane: → stamp when no flag. Set it in the user
|
|
11
|
-
* settings.json `env` block (seeded into process.env by the SAME 1a-envseed both the REPL boot and
|
|
12
|
-
* printModeEngine run), the lane every other wire config rides (SEMA_SELF_ORCHESTRATION,
|
|
13
|
-
* SEMA_WEBSEARCH_*, SEMA_ENABLE_FORK). One mechanism serves both "env var" and "settings file".
|
|
14
|
-
* c) neither → NO stamp = today's behaviour, verbatim.
|
|
15
|
-
*
|
|
16
|
-
* VOCABULARY = the server's scenario registry (builtin + center-declared). The shell does NOT
|
|
17
|
-
* pre-validate against it (the registry is deployment-side truth): an UNKNOWN name falls back to the
|
|
18
|
-
* `default` scenario server-side (scenarios.ts selectScenario — safe), and a center allowlist violation
|
|
19
|
-
* comes back as an honest 400 `scenario_not_allowed` (already rendered by scenarioNotAllowedCopy.ts).
|
|
20
|
-
* We only mirror the server's NAME-SHAPE rule (scenarios.ts:318 SCENARIO_NAME_RE) locally — same rule,
|
|
21
|
-
* earlier and cheaper, and it keeps prompt-looking values (whitespace etc.) from being eaten as a name.
|
|
22
|
-
*
|
|
23
|
-
* NOTE (mock-key shadow): the seam also uses `scenario` as the MOCK transcript selector
|
|
24
|
-
* (seamQuery.selectScenario / SEMA_SCENARIO). liveClient strips those mock keys before a live forward;
|
|
25
|
-
* a `--scenario` value that collides with a mock key (e.g. `bash`) is therefore equivalent to `default`
|
|
26
|
-
* on the live engine — which is exactly what the server would resolve for it anyway (no such scenario).
|
|
27
|
-
*
|
|
28
|
-
* SEMA_SCENARIO (the mock harness opt-in — "never spawn a real engine", printModeEngine.ts) is
|
|
29
|
-
* deliberately NOT reused here: it selects offline mock transcripts, not live engine routing.
|
|
30
|
-
*/
|
|
31
1
|
import { type EnvLike } from './hostEnv.js';
|
|
32
|
-
/** Mirror of the server's scenario NAME shape (ai-agent-service scenarios.ts:318). */
|
|
33
2
|
export declare const SCENARIO_NAME_RE: RegExp;
|
|
34
|
-
/** Settings-lane env knob (settings.json `env` block → 1a-envseed → process.env). */
|
|
35
3
|
export declare const HEADLESS_SCENARIO_ENV = "SEMA_HEADLESS_SCENARIO";
|
|
36
4
|
export type ScenarioParseResult = {
|
|
37
5
|
ok: true;
|
|
@@ -40,34 +8,6 @@ export type ScenarioParseResult = {
|
|
|
40
8
|
ok: false;
|
|
41
9
|
error: string;
|
|
42
10
|
};
|
|
43
|
-
/**
|
|
44
|
-
* Parse `--scenario` out of an argv slice (everything before a bare `--`; both `--scenario <v>` and
|
|
45
|
-
* `--scenario=<v>` forms — the sandboxWire idiom). No flag ⇒ `{ok:true}` with no scenario. Repeated
|
|
46
|
-
* flag ⇒ LAST wins (commander convention). Missing value / flag-shaped value / name-shape violation ⇒
|
|
47
|
-
* fail-LOUD parse error (never a silent default — a mis-typed routing choice must not quietly run on
|
|
48
|
-
* the wrong tool surface; same stance as `--sandbox`).
|
|
49
|
-
*
|
|
50
|
-
* 🔴 [2393] sweep-F10(2026-08-03 全窗复审)**承诺范围如实收窄**(裁定:行为不改,话改):
|
|
51
|
-
* 「fail-LOUD,never a silent default」这句话现在**不**覆盖一种输入 —— 同一个旗**重复出现**且
|
|
52
|
-
* 前一次缺值/非法、后一次合法(`--scenario --scenario foo`):
|
|
53
|
-
* 收编前是 per-occurrence eager validate,在**第一个**缺值 occurrence 上就 fail-loud;收编后走
|
|
54
|
-
* `lastFlagValue`('invalidate' 缺省)= 后一次合法 occurrence 覆盖前一次,整体接受。
|
|
55
|
-
* 为什么裁定不改回去:本模块自己写着的契约就是「Repeated flag ⇒ LAST wins(commander convention)」,
|
|
56
|
-
* eager-validate 违反的正是这条契约(它让**被覆盖掉的**那一次决定整条命令的成败)。
|
|
57
|
-
* 剩下的形(唯一一次出现却缺值 / 值是旗形 / 空 / 超长 / 带空白)**仍然全部 fail-loud** —— 那才是
|
|
58
|
-
* 「打错一个字就悄悄跑在别的镜像上」真正要防的那一族。
|
|
59
|
-
* ⚠️ `docs/REFACTOR-LEDGER.md` REF-CC-143 的处置列此前写的是「缺值策略**统一** fail-loud」,
|
|
60
|
-
* 与落地的两策略叶(`'invalidate'` / `'latch-previous'`)相悖,已同批改正(sweep-F11)。 */
|
|
61
11
|
export declare function parseScenarioArgv(argv: readonly string[]): ScenarioParseResult;
|
|
62
|
-
/**
|
|
63
|
-
* The settings-lane default (`SEMA_HEADLESS_SCENARIO`). FAIL-SOFT on a bad value (stderr warning +
|
|
64
|
-
* no stamp): a settings-file typo must not hard-brick every headless run the way an explicit flag
|
|
65
|
-
* typo fails the one run it was typed on.
|
|
66
|
-
*/
|
|
67
12
|
export declare function headlessScenarioFromEnv(env?: EnvLike): string | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Resolve the scenario for a headless `-p` submit: explicit `--scenario` flag > `SEMA_HEADLESS_SCENARIO`
|
|
70
|
-
* settings default > none (= the engine's default scenario, today's behaviour). Flag parse errors
|
|
71
|
-
* propagate fail-loud; the caller exits.
|
|
72
|
-
*/
|
|
73
13
|
export declare function scenarioForPrint(argv: string[], env?: EnvLike): ScenarioParseResult;
|
package/dist/scenarioWire.js
CHANGED
|
@@ -1,75 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* src/sema/scenarioWire.ts — `--scenario <name>` wire (clay 拍, 2026-07-15): expose the engine's
|
|
3
|
-
* REQUEST-LEVEL scenario routing axis on the headless `-p` path. The server has shipped scenario
|
|
4
|
-
* routing since day one (ai-agent-service capabilities/scenarios.ts — `TaskRequest.scenario` picks the
|
|
5
|
-
* tool roster + prompt provider per request: default / code-review / scan / oa / team + center-declared
|
|
6
|
-
* overlays); the shell simply never exposed the field to users. This module is the CLI face.
|
|
7
|
-
*
|
|
8
|
-
* PRECEDENCE (flag > settings > default):
|
|
9
|
-
* a) `--scenario <name>` (explicit flag) → stamp `TaskRequest.scenario`.
|
|
10
|
-
* b) `SEMA_HEADLESS_SCENARIO` env — the settings lane: → stamp when no flag. Set it in the user
|
|
11
|
-
* settings.json `env` block (seeded into process.env by the SAME 1a-envseed both the REPL boot and
|
|
12
|
-
* printModeEngine run), the lane every other wire config rides (SEMA_SELF_ORCHESTRATION,
|
|
13
|
-
* SEMA_WEBSEARCH_*, SEMA_ENABLE_FORK). One mechanism serves both "env var" and "settings file".
|
|
14
|
-
* c) neither → NO stamp = today's behaviour, verbatim.
|
|
15
|
-
*
|
|
16
|
-
* VOCABULARY = the server's scenario registry (builtin + center-declared). The shell does NOT
|
|
17
|
-
* pre-validate against it (the registry is deployment-side truth): an UNKNOWN name falls back to the
|
|
18
|
-
* `default` scenario server-side (scenarios.ts selectScenario — safe), and a center allowlist violation
|
|
19
|
-
* comes back as an honest 400 `scenario_not_allowed` (already rendered by scenarioNotAllowedCopy.ts).
|
|
20
|
-
* We only mirror the server's NAME-SHAPE rule (scenarios.ts:318 SCENARIO_NAME_RE) locally — same rule,
|
|
21
|
-
* earlier and cheaper, and it keeps prompt-looking values (whitespace etc.) from being eaten as a name.
|
|
22
|
-
*
|
|
23
|
-
* NOTE (mock-key shadow): the seam also uses `scenario` as the MOCK transcript selector
|
|
24
|
-
* (seamQuery.selectScenario / SEMA_SCENARIO). liveClient strips those mock keys before a live forward;
|
|
25
|
-
* a `--scenario` value that collides with a mock key (e.g. `bash`) is therefore equivalent to `default`
|
|
26
|
-
* on the live engine — which is exactly what the server would resolve for it anyway (no such scenario).
|
|
27
|
-
*
|
|
28
|
-
* SEMA_SCENARIO (the mock harness opt-in — "never spawn a real engine", printModeEngine.ts) is
|
|
29
|
-
* deliberately NOT reused here: it selects offline mock transcripts, not live engine routing.
|
|
30
|
-
*/
|
|
31
1
|
import { hostEnv } from './hostEnv.js';
|
|
32
2
|
import { lastFlagValue } from './argvFlagValue.js';
|
|
33
|
-
/** Mirror of the server's scenario NAME shape (ai-agent-service scenarios.ts:318). */
|
|
34
3
|
export const SCENARIO_NAME_RE = /^[a-z][a-z0-9-]{1,31}$/;
|
|
35
|
-
/** Settings-lane env knob (settings.json `env` block → 1a-envseed → process.env). */
|
|
36
4
|
export const HEADLESS_SCENARIO_ENV = 'SEMA_HEADLESS_SCENARIO';
|
|
37
5
|
const USAGE_HINT = "sema: --scenario expects a scenario name (lowercase letters/digits/hyphens, starting with a letter, ≤32 chars).\n" +
|
|
38
6
|
' --scenario <name> route this run through the named engine scenario (deployment-defined tool\n' +
|
|
39
7
|
' roster + system prompt; unknown names fall back to the default scenario)\n' +
|
|
40
8
|
' (no flag) the default scenario — today\'s behaviour';
|
|
41
|
-
/**
|
|
42
|
-
* Parse `--scenario` out of an argv slice (everything before a bare `--`; both `--scenario <v>` and
|
|
43
|
-
* `--scenario=<v>` forms — the sandboxWire idiom). No flag ⇒ `{ok:true}` with no scenario. Repeated
|
|
44
|
-
* flag ⇒ LAST wins (commander convention). Missing value / flag-shaped value / name-shape violation ⇒
|
|
45
|
-
* fail-LOUD parse error (never a silent default — a mis-typed routing choice must not quietly run on
|
|
46
|
-
* the wrong tool surface; same stance as `--sandbox`).
|
|
47
|
-
*
|
|
48
|
-
* 🔴 [2393] sweep-F10(2026-08-03 全窗复审)**承诺范围如实收窄**(裁定:行为不改,话改):
|
|
49
|
-
* 「fail-LOUD,never a silent default」这句话现在**不**覆盖一种输入 —— 同一个旗**重复出现**且
|
|
50
|
-
* 前一次缺值/非法、后一次合法(`--scenario --scenario foo`):
|
|
51
|
-
* 收编前是 per-occurrence eager validate,在**第一个**缺值 occurrence 上就 fail-loud;收编后走
|
|
52
|
-
* `lastFlagValue`('invalidate' 缺省)= 后一次合法 occurrence 覆盖前一次,整体接受。
|
|
53
|
-
* 为什么裁定不改回去:本模块自己写着的契约就是「Repeated flag ⇒ LAST wins(commander convention)」,
|
|
54
|
-
* eager-validate 违反的正是这条契约(它让**被覆盖掉的**那一次决定整条命令的成败)。
|
|
55
|
-
* 剩下的形(唯一一次出现却缺值 / 值是旗形 / 空 / 超长 / 带空白)**仍然全部 fail-loud** —— 那才是
|
|
56
|
-
* 「打错一个字就悄悄跑在别的镜像上」真正要防的那一族。
|
|
57
|
-
* ⚠️ `docs/REFACTOR-LEDGER.md` REF-CC-143 的处置列此前写的是「缺值策略**统一** fail-loud」,
|
|
58
|
-
* 与落地的两策略叶(`'invalidate'` / `'latch-previous'`)相悖,已同批改正(sweep-F11)。 */
|
|
59
9
|
export function parseScenarioArgv(argv) {
|
|
60
|
-
// REF-CC-143(dup-07)收编:extraction 改吃共用 lastFlagValue(argvFlagValue.ts)——scan-all-then-
|
|
61
|
-
// validate-once, matching this function's own documented "Repeated flag ⇒ LAST wins" contract (the
|
|
62
|
-
// former per-occurrence eager-validate loop actually violated that contract the same way sandboxWire's
|
|
63
|
-
// did: an earlier INVALID occurrence overridden by a later VALID one used to fail-loud on the earlier
|
|
64
|
-
// one instead of honoring the later value — fixed as a side effect of the consolidation).
|
|
65
10
|
const flag = lastFlagValue(argv, '--scenario');
|
|
66
11
|
if (!flag.present)
|
|
67
12
|
return { ok: true };
|
|
68
13
|
if (flag.raw === undefined)
|
|
69
14
|
return { ok: false, error: USAGE_HINT };
|
|
70
15
|
const v = flag.raw.trim();
|
|
71
|
-
// sandboxWire audit #17 lesson: a bare `--scenario` EATS the following positional — a value with
|
|
72
|
-
// whitespace is almost certainly the user's prompt; say exactly that instead of mis-parsing.
|
|
73
16
|
if (/\s/.test(v)) {
|
|
74
17
|
return {
|
|
75
18
|
ok: false,
|
|
@@ -83,27 +26,16 @@ export function parseScenarioArgv(argv) {
|
|
|
83
26
|
}
|
|
84
27
|
return { ok: true, scenario: v };
|
|
85
28
|
}
|
|
86
|
-
/**
|
|
87
|
-
* The settings-lane default (`SEMA_HEADLESS_SCENARIO`). FAIL-SOFT on a bad value (stderr warning +
|
|
88
|
-
* no stamp): a settings-file typo must not hard-brick every headless run the way an explicit flag
|
|
89
|
-
* typo fails the one run it was typed on.
|
|
90
|
-
*/
|
|
91
29
|
export function headlessScenarioFromEnv(env = hostEnv()) {
|
|
92
30
|
const v = env[HEADLESS_SCENARIO_ENV]?.trim();
|
|
93
31
|
if (!v)
|
|
94
32
|
return undefined;
|
|
95
33
|
if (!SCENARIO_NAME_RE.test(v)) {
|
|
96
|
-
// eslint-disable-next-line no-console
|
|
97
34
|
console.error(`[sema] ${HEADLESS_SCENARIO_ENV}="${v}" is not a valid scenario name (want ${String(SCENARIO_NAME_RE)}) — ignoring the settings default`);
|
|
98
35
|
return undefined;
|
|
99
36
|
}
|
|
100
37
|
return v;
|
|
101
38
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Resolve the scenario for a headless `-p` submit: explicit `--scenario` flag > `SEMA_HEADLESS_SCENARIO`
|
|
104
|
-
* settings default > none (= the engine's default scenario, today's behaviour). Flag parse errors
|
|
105
|
-
* propagate fail-loud; the caller exits.
|
|
106
|
-
*/
|
|
107
39
|
export function scenarioForPrint(argv, env = hostEnv()) {
|
|
108
40
|
const parsed = parseScenarioArgv(argv);
|
|
109
41
|
if (!parsed.ok)
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
export interface ScratchpadDirField {
|
|
2
2
|
scratchpadDir?: string;
|
|
3
3
|
}
|
|
4
|
-
/**
|
|
5
|
-
* Per-turn scratchpadDir stamp。gate off(tengu_scratch)⇒ 空对象(请求形状不变,mock parity)。
|
|
6
|
-
* 路径 per-session 稳定(sessionId 定 getScratchpadDir),重复调用幂等。
|
|
7
|
-
*
|
|
8
|
-
* 与 cli 的差分记账:
|
|
9
|
-
* · `ensureScratchpadDir` 在壳里是 async(mkdir 0o700),这里 **两种返回都吞**(端可给同步实现);
|
|
10
|
-
* 建失败只影响引擎首写时自建(server 半场也建),**不阻 turn** —— 与 cli 逐字同语义。
|
|
11
|
-
* · fs 口缺席(浏览器宿主)⇒ 返回空对象 = 不 stamp。additive 字段缺席对引擎无害,
|
|
12
|
-
* 但会计一次 `hostPortMisses().fs`,让「Node 宿主漏装」与「浏览器本就没有」在自检里可区分。
|
|
13
|
-
*/
|
|
14
4
|
export declare function scratchpadDirField(): ScratchpadDirField;
|
|
15
|
-
/** 测试钩:复位 module 级建目录闩。 */
|
|
16
5
|
export declare function _resetScratchpadEnsuredForTest(): void;
|
|
@@ -1,36 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ⇄ B4 批搬迁(2026-07-27,多端改造设计稿 §3 B4 第五件):cli `src/sema/scratchpadWireCaps.ts` 搬入。
|
|
3
|
-
* 拆缝 = 两条外向边换 host port:`utils/permissions/filesystem`(getScratchpadDir /
|
|
4
|
-
* isScratchpadEnabled / ensureScratchpadDir)→ `hostFs()`;`utils/debug.logForDebugging` → `hostLog()`。
|
|
5
|
-
* 本文件是 B2 判给 B4 的两件「宿主耦合 WireCaps」里的**小的那件**,同时充当 `FsPort` 的端到端证明。
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* scratchpad 域的 wire 半场([816] 壳侧承诺③ / [819]④ / [820]③,2026-07-14)。
|
|
9
|
-
*
|
|
10
|
-
* 链路:core `TaskSpec.envFacts.scratchpadDir` 字段 + 提示词消费链(buildScratchpadSection)1.257.3
|
|
11
|
-
* 起全在;server 半场 = buildEnvFacts 填字段 + 建目录 + 塞进 createFsWriteGatePolicy 的 exemptDirs。
|
|
12
|
-
* 客户端把 getScratchpadDir()(CC 同型:`/tmp/claude-{uid}/{sanitized-cwd}/{sessionId}/scratchpad`)
|
|
13
|
-
* stamp 到 `TaskRequest.scratchpadDir` —— server 半场没到时字段发了引擎忽略 = 无害(additive 铁律);
|
|
14
|
-
* 到货后 server 以客户端带的路径为准(本机 TOC 引擎与壳同 fs,壳造的目录引擎直接可写),或自造(TOB 远端)。
|
|
15
|
-
*
|
|
16
|
-
* 🔴 [1840] 勘误:G3 `scratchpadDir` **不是死键** —— server 已把「死键」的说法收回改接单
|
|
17
|
-
* ([816]③/[820]③ additive 预挂)。别再按「没人读」把这条 stamp 删掉。
|
|
18
|
-
*
|
|
19
|
-
* 🔴 单实例纪律:本模块持 module 级 `ensured` 闩(整进程只 fire-and-forget 建一次目录)。
|
|
20
|
-
* 两份实例 = 建两次(幂等无害),但与本包其余台账同理,壳侧必须只解析到一份。
|
|
21
|
-
*/
|
|
22
1
|
import { hostFs, hostLog } from './host.js';
|
|
23
2
|
let ensured = false;
|
|
24
|
-
/**
|
|
25
|
-
* Per-turn scratchpadDir stamp。gate off(tengu_scratch)⇒ 空对象(请求形状不变,mock parity)。
|
|
26
|
-
* 路径 per-session 稳定(sessionId 定 getScratchpadDir),重复调用幂等。
|
|
27
|
-
*
|
|
28
|
-
* 与 cli 的差分记账:
|
|
29
|
-
* · `ensureScratchpadDir` 在壳里是 async(mkdir 0o700),这里 **两种返回都吞**(端可给同步实现);
|
|
30
|
-
* 建失败只影响引擎首写时自建(server 半场也建),**不阻 turn** —— 与 cli 逐字同语义。
|
|
31
|
-
* · fs 口缺席(浏览器宿主)⇒ 返回空对象 = 不 stamp。additive 字段缺席对引擎无害,
|
|
32
|
-
* 但会计一次 `hostPortMisses().fs`,让「Node 宿主漏装」与「浏览器本就没有」在自检里可区分。
|
|
33
|
-
*/
|
|
34
3
|
export function scratchpadDirField() {
|
|
35
4
|
try {
|
|
36
5
|
const fs = hostFs();
|
|
@@ -59,7 +28,6 @@ export function scratchpadDirField() {
|
|
|
59
28
|
return {};
|
|
60
29
|
}
|
|
61
30
|
}
|
|
62
|
-
/** 测试钩:复位 module 级建目录闩。 */
|
|
63
31
|
export function _resetScratchpadEnsuredForTest() {
|
|
64
32
|
ensured = false;
|
|
65
33
|
}
|
package/dist/sdkWireTransit.d.ts
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* src/sdkWireTransit.ts — SDK **wire 面**的转口口(L-61 存量清零;clay 令 C-R43「所有欠账绝不延期」)。
|
|
3
|
-
*
|
|
4
|
-
* ── 为什么开这一只(与 `engineHttpTools.ts` 的分界)──────────────────────────────────────────
|
|
5
|
-
* `engineHttpTools.ts` 转的是两件**纯工具**(URL builder / 存活探针)。本文件转的是 wire 面的
|
|
6
|
-
* **客户端类**、**帧谓词**与**型面** —— 端至今只能直连 `@sema-agent/sdk` 去取它们
|
|
7
|
-
* (cli sdk-isolation 存量册 `sdk-value` 桶的剩余条目),而「壳对引擎 wire 的一切消费必须经本包」
|
|
8
|
-
* 这条公约对它们一直不成立。
|
|
9
|
-
*
|
|
10
|
-
* 🔴 **为什么 0.68.2 之前把 `AgentClient` 记成 declined,现在改成转口**(改口要给理由,不能只改结论):
|
|
11
|
-
* 此前的理由是「转口一个客户端类 = 本包为它的连接姿势/鉴权头/重试语义背书」。这条**顾虑仍然
|
|
12
|
-
* 成立**,但它指向的是「端该不该直接 new 一个 AgentClient」这个**设计问题**,而不是「这条 import
|
|
13
|
-
* 该不该经本包」这个**归层问题**——把两者绑在一起的代价是:归层这件事被一个未排期的设计件
|
|
14
|
-
* 无限期挡住(存量窗已因此过期两代)。⇒ 分开处理:
|
|
15
|
-
* · **归层现在做**(本文件,原样转口,零包装);
|
|
16
|
-
* · **设计件照旧欠着**:本包已有的自有路 `makeEngineWireClient` 才是推荐姿势,端上新码一律走
|
|
17
|
-
* 那一条;本转口口只给**存量**用,不是新码的入口。这一条写在这里,不靠人记得。
|
|
18
|
-
*
|
|
19
|
-
* 🔴 **原样转口,一个字节都不加工**(与 `engineHttpTools.ts` 同一条纪律):不包装、不改签名、
|
|
20
|
-
* 不补默认值 —— 包一层就是把「同一实现」这条唯一的抗漂移保证亲手拆掉。
|
|
21
|
-
*
|
|
22
|
-
* ── 可移植门为什么不受影响(实测,不是推断)────────────────────────────────────────────────
|
|
23
|
-
* · `@sema-agent/sdk` **本来就在** `EXPECTED_PACKAGES_INDEX` 等值集里(本包已有值级 SDK import)
|
|
24
|
-
* ⇒ 集合一个字节不动;
|
|
25
|
-
* · SDK 的 `dist/` 全树 **零 `node:` 内建**(实测:`grep -rl "node:" dist/*.js` 空),传输走全局
|
|
26
|
-
* `fetch`/`AbortController` = web 标准 ⇒ ③ 段的 `--platform=browser` 真打包面零风险;
|
|
27
|
-
* · 型面转口是 `export type`,编译后整段消失 ⇒ 闭包扫描的「剥 type-only」那一步本来就不看它。
|
|
28
|
-
*/
|
|
29
1
|
export { AgentClient } from '@sema-agent/sdk';
|
|
30
2
|
export { isApprovalRequestFrameV1, isApprovalRevokeFrameV1 } from '@sema-agent/sdk';
|
|
31
|
-
/**
|
|
32
|
-
* ── ③ wire **型面**(零运行期,`export type`)────────────────────────────────────────────────
|
|
33
|
-
*
|
|
34
|
-
* 🔴 **射程写明**(免得下一棒把这里当成「SDK 型面的全量镜像」):本表**只**收端上存量直连实际用到
|
|
35
|
-
* 的那些名字,一个不多。全量镜像是另一件事(会把本包的 `.d.ts` 与 SDK 的每一次型面改动绑死),
|
|
36
|
-
* 与 `@sema-agent/agent-types` 的**CC 形**全量镜像不是一回事 —— 那边镜的是 CC SDK 的会话词汇,
|
|
37
|
-
* 这边是引擎 wire 的请求/事件/回执形。
|
|
38
|
-
* 🔴 **谁是权威**:权威恒是 `@sema-agent/sdk` 本身。本文件是**别名**,上游改名 ⇒ 本文件当场编译红,
|
|
39
|
-
* 端跟着红 —— 这正是型面转口相对「端各自直连」唯一多出来的那点好处(红在一处,不是散在九处)。
|
|
40
|
-
*/
|
|
41
3
|
export type { TaskRequest, SessionPermissionRules, SemaSettings, SkillSpec, AgentEvent, RunReceipt, CancelAck, RunRecord, ToolApprovalRespondAck, FleetTaskRow, FleetWorkflowRow, ApprovalCard, ApprovalRequestFrame, ApprovalRiskAxes, AskDecisionAck, AskDecisionBody, } from '@sema-agent/sdk';
|
package/dist/sdkWireTransit.js
CHANGED
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* src/sdkWireTransit.ts — SDK **wire 面**的转口口(L-61 存量清零;clay 令 C-R43「所有欠账绝不延期」)。
|
|
3
|
-
*
|
|
4
|
-
* ── 为什么开这一只(与 `engineHttpTools.ts` 的分界)──────────────────────────────────────────
|
|
5
|
-
* `engineHttpTools.ts` 转的是两件**纯工具**(URL builder / 存活探针)。本文件转的是 wire 面的
|
|
6
|
-
* **客户端类**、**帧谓词**与**型面** —— 端至今只能直连 `@sema-agent/sdk` 去取它们
|
|
7
|
-
* (cli sdk-isolation 存量册 `sdk-value` 桶的剩余条目),而「壳对引擎 wire 的一切消费必须经本包」
|
|
8
|
-
* 这条公约对它们一直不成立。
|
|
9
|
-
*
|
|
10
|
-
* 🔴 **为什么 0.68.2 之前把 `AgentClient` 记成 declined,现在改成转口**(改口要给理由,不能只改结论):
|
|
11
|
-
* 此前的理由是「转口一个客户端类 = 本包为它的连接姿势/鉴权头/重试语义背书」。这条**顾虑仍然
|
|
12
|
-
* 成立**,但它指向的是「端该不该直接 new 一个 AgentClient」这个**设计问题**,而不是「这条 import
|
|
13
|
-
* 该不该经本包」这个**归层问题**——把两者绑在一起的代价是:归层这件事被一个未排期的设计件
|
|
14
|
-
* 无限期挡住(存量窗已因此过期两代)。⇒ 分开处理:
|
|
15
|
-
* · **归层现在做**(本文件,原样转口,零包装);
|
|
16
|
-
* · **设计件照旧欠着**:本包已有的自有路 `makeEngineWireClient` 才是推荐姿势,端上新码一律走
|
|
17
|
-
* 那一条;本转口口只给**存量**用,不是新码的入口。这一条写在这里,不靠人记得。
|
|
18
|
-
*
|
|
19
|
-
* 🔴 **原样转口,一个字节都不加工**(与 `engineHttpTools.ts` 同一条纪律):不包装、不改签名、
|
|
20
|
-
* 不补默认值 —— 包一层就是把「同一实现」这条唯一的抗漂移保证亲手拆掉。
|
|
21
|
-
*
|
|
22
|
-
* ── 可移植门为什么不受影响(实测,不是推断)────────────────────────────────────────────────
|
|
23
|
-
* · `@sema-agent/sdk` **本来就在** `EXPECTED_PACKAGES_INDEX` 等值集里(本包已有值级 SDK import)
|
|
24
|
-
* ⇒ 集合一个字节不动;
|
|
25
|
-
* · SDK 的 `dist/` 全树 **零 `node:` 内建**(实测:`grep -rl "node:" dist/*.js` 空),传输走全局
|
|
26
|
-
* `fetch`/`AbortController` = web 标准 ⇒ ③ 段的 `--platform=browser` 真打包面零风险;
|
|
27
|
-
* · 型面转口是 `export type`,编译后整段消失 ⇒ 闭包扫描的「剥 type-only」那一步本来就不看它。
|
|
28
|
-
*/
|
|
29
|
-
// ── ① 客户端类(存量转口;新码走 `makeEngineWireClient`)────────────────────────────────────
|
|
30
1
|
export { AgentClient } from '@sema-agent/sdk';
|
|
31
|
-
// ── ② 流内审批帧的**信封谓词**(v1 窄化判据;端拿它判「这一帧是不是我认得的那一代」)──────────
|
|
32
2
|
export { isApprovalRequestFrameV1, isApprovalRevokeFrameV1 } from '@sema-agent/sdk';
|