@sema-agent/client-core 0.93.1 → 0.95.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 +554 -0
- package/README.md +89 -55
- package/dist/adapt/arms.js +13 -11
- package/dist/adapt/panelTasks.js +4 -10
- package/dist/adapt/toolCards.js +2 -2
- package/dist/adapt/wireShapes.js +3 -8
- package/dist/adapter/activeRunSelfHeal.d.ts +8 -3
- package/dist/adapter/activeRunSelfHeal.js +20 -12
- package/dist/adapter/downstream/eventToSdkMessage.js +24 -17
- package/dist/adapter/downstream/terminalToSdkResult.js +13 -6
- package/dist/adapter/runStream.js +2 -1
- package/dist/adapter/types.d.ts +7 -0
- package/dist/adapter/types.js +15 -0
- package/dist/agentSession/backgroundView.js +5 -1
- package/dist/agentSession/engineAgentRegistryRead.js +2 -1
- package/dist/agentSession/engineSessionBackgroundStop.js +5 -3
- package/dist/agentsWireCaps.d.ts +17 -0
- package/dist/agentsWireCaps.js +111 -1
- package/dist/approvalDecidedByCapability.d.ts +0 -1
- package/dist/approvalDecidedByCapability.js +2 -7
- package/dist/approvalReachWire.d.ts +18 -0
- package/dist/approvalReachWire.js +58 -0
- package/dist/approvalsStreamLiveCapability.d.ts +0 -1
- package/dist/approvalsStreamLiveCapability.js +15 -14
- package/dist/atMostOnce.d.ts +8 -0
- package/dist/atMostOnce.js +36 -0
- package/dist/attachmentSeatCapability.d.ts +0 -1
- package/dist/attachmentSeatCapability.js +0 -3
- package/dist/attachmentsWireCaps.js +11 -6
- package/dist/bashExitReading.d.ts +10 -0
- package/dist/bashExitReading.js +12 -0
- package/dist/callerCwdCapability.d.ts +15 -0
- package/dist/callerCwdCapability.js +42 -0
- package/dist/centerWiringCapability.d.ts +1 -3
- package/dist/centerWiringCapability.js +18 -21
- package/dist/classifierStatus.js +4 -4
- package/dist/cloudConfigWireCaps.js +43 -21
- package/dist/compensations.js +1 -1
- package/dist/controlRouter.js +3 -10
- package/dist/coreValuePorts.d.ts +64 -1
- package/dist/coreValuePorts.js +30 -0
- package/dist/cycleOrder.d.ts +15 -0
- package/dist/cycleOrder.js +45 -0
- package/dist/decideFailureNote.js +4 -1
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/decideReceipt.js +41 -13
- package/dist/declared/supportFloorDeclared.d.ts +1 -0
- package/dist/declared/supportFloorDeclared.js +5 -0
- package/dist/detachWire.d.ts +1 -4
- package/dist/detachWire.js +1 -1
- package/dist/deviceExecutorManagementCapability.d.ts +0 -1
- package/dist/deviceExecutorManagementCapability.js +36 -40
- package/dist/deviceFlowPolling.d.ts +5 -0
- package/dist/deviceFlowPolling.js +28 -0
- package/dist/deviceRebind.d.ts +88 -0
- package/dist/deviceRebind.js +242 -0
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +963 -30
- package/dist/engineAgentAbsence.d.ts +2 -2
- package/dist/engineAgentPanelStore.d.ts +8 -18
- package/dist/engineAgentPanelStore.js +19 -537
- package/dist/engineCapReader.d.ts +6 -6
- package/dist/engineCapReader.js +30 -43
- package/dist/engineCapsCache.d.ts +7 -2
- package/dist/engineCapsCache.js +64 -26
- package/dist/engineCredentialRequirement.d.ts +9 -0
- package/dist/engineCredentialRequirement.js +23 -0
- package/dist/engineEnvSourcing.d.ts +53 -0
- package/dist/engineEnvSourcing.js +81 -0
- package/dist/engineErrorCodes.d.ts +19 -4
- package/dist/engineErrorCodes.js +39 -21
- package/dist/engineIdentity.js +2 -0
- package/dist/engineNoticeCodes.d.ts +22 -2
- package/dist/engineNoticeCodes.js +73 -6
- package/dist/engineRefusedToolName.d.ts +1 -0
- package/dist/engineRefusedToolName.js +8 -0
- package/dist/engineWireSdk.js +2 -2
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +28 -28
- package/dist/fileHistoryCaptureCapability.d.ts +0 -1
- package/dist/fileHistoryCaptureCapability.js +13 -12
- package/dist/fileHistoryLegNotice.d.ts +14 -2
- package/dist/fileHistoryLegNotice.js +101 -15
- package/dist/fleet/fleetLedger.d.ts +2 -0
- package/dist/fleet/fleetLedger.js +74 -52
- package/dist/fleet/fleetProjection.d.ts +0 -3
- package/dist/fleet/fleetProjection.js +9 -16
- package/dist/fleetAgentPanelProjection.d.ts +4 -17
- package/dist/fleetAgentPanelProjection.js +7 -197
- package/dist/fleetAgentRowLike.d.ts +16 -0
- package/dist/fleetAgentRowLike.js +1 -0
- package/dist/gateOutcome.d.ts +2 -1
- package/dist/gateOutcome.js +33 -18
- package/dist/gateVocabulary.js +1 -1
- package/dist/generated/engineAskFaceTables.d.ts +3 -0
- package/dist/generated/engineAskFaceTables.js +12 -0
- package/dist/generated/engineFactTables.d.ts +4 -2
- package/dist/generated/engineFactTables.js +13 -0
- package/dist/generated/engineNoticeTables.d.ts +5 -0
- package/dist/generated/engineNoticeTables.js +7 -0
- package/dist/generated/sdkFactTables.d.ts +5 -0
- package/dist/generated/sdkFactTables.js +34 -0
- package/dist/generated/settingsSchemaFns.d.ts +10 -0
- package/dist/generated/settingsSchemaFns.js +22 -0
- package/dist/generated/settingsSchemaTables.d.ts +3 -0
- package/dist/generated/settingsSchemaTables.js +3 -0
- package/dist/headlessPermissionModeWire.d.ts +2 -2
- package/dist/headlessPermissionModeWire.js +11 -21
- package/dist/headlessReconnectWire.js +49 -20
- package/dist/hitl/allowRuleShadow.d.ts +1 -1
- package/dist/hitl/allowRuleShadow.js +49 -8
- package/dist/hitl/approvalCompleteParked.d.ts +1 -0
- package/dist/hitl/approvalCompleteParked.js +14 -0
- package/dist/hitl/approvalEndingCause.d.ts +5 -0
- package/dist/hitl/approvalEndingCause.js +61 -0
- package/dist/hitl/approvalHolds.d.ts +46 -0
- package/dist/hitl/approvalHolds.js +140 -0
- package/dist/hitl/approvalOutcomeNote.js +2 -1
- package/dist/hitl/approvalResolution.js +9 -1
- package/dist/hitl/approvalsFeed.js +23 -6
- package/dist/hitl/askGateWire.d.ts +2 -1
- package/dist/hitl/askGateWire.js +29 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +8 -2
- package/dist/hitl/automaticAnswerVerdict.js +71 -23
- package/dist/hitl/crashConverged.js +2 -0
- package/dist/hitl/decisionConflict.d.ts +3 -0
- package/dist/hitl/decisionConflict.js +43 -0
- package/dist/hitl/decisionRefusal.d.ts +23 -0
- package/dist/hitl/decisionRefusal.js +88 -0
- package/dist/hitl/frameRouter.d.ts +10 -0
- package/dist/hitl/frameRouter.js +71 -32
- package/dist/hitl/gateLedger.d.ts +8 -0
- package/dist/hitl/gateLedger.js +38 -0
- package/dist/hitl/hitlBridge.d.ts +14 -3
- package/dist/hitl/hitlBridge.js +75 -62
- package/dist/hitl/hitlHostSurface.d.ts +3 -0
- package/dist/hitl/hitlHostSurface.js +17 -15
- package/dist/hitl/livePendingAsk.d.ts +16 -6
- package/dist/hitl/livePendingAsk.js +36 -4
- package/dist/hitl/localAllowRule.js +2 -1
- package/dist/hitl/noAllowCause.d.ts +9 -0
- package/dist/hitl/noAllowCause.js +26 -0
- package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
- package/dist/hitl/parkExpiryJudgements.js +46 -0
- package/dist/hitl/parkResolver.d.ts +3 -7
- package/dist/hitl/parkResolver.js +55 -28
- package/dist/hitl/parkRowBirthWait.js +2 -1
- package/dist/hitl/persistedRulesWire.d.ts +6 -1
- package/dist/hitl/persistedRulesWire.js +16 -4
- package/dist/hitl/planReviewWire.d.ts +2 -3
- package/dist/hitl/planReviewWire.js +86 -39
- package/dist/hitl/replayedApproval.d.ts +8 -0
- package/dist/hitl/replayedApproval.js +125 -10
- package/dist/hitl/resumeRunningCard.d.ts +2 -0
- package/dist/hitl/resumeRunningCard.js +15 -4
- package/dist/hitl/sessionPolicyDeliverable.d.ts +1 -1
- package/dist/hitl/sessionPolicyDeliverable.js +3 -8
- package/dist/hitl/sessionPolicyWire.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +50 -5
- package/dist/hitl/toolApprovalWire.js +368 -56
- package/dist/hooksWireCaps.js +38 -6
- package/dist/host.d.ts +5 -0
- package/dist/host.js +3 -1
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +25 -0
- package/dist/humanTurnRead.d.ts +15 -1
- package/dist/humanTurnRead.js +28 -2
- package/dist/index.d.ts +45 -14
- package/dist/index.js +33 -12
- package/dist/interactiveInterrupt.d.ts +8 -0
- package/dist/interactiveInterrupt.js +54 -0
- package/dist/limitsWire.d.ts +5 -1
- package/dist/limitsWire.js +51 -13
- package/dist/liveModelCatalog.d.ts +109 -0
- package/dist/liveModelCatalog.js +344 -18
- package/dist/mcpEngineLeg.d.ts +25 -0
- package/dist/mcpEngineLeg.js +71 -15
- package/dist/mcpPanel.js +2 -1
- package/dist/mcpProbeCapability.d.ts +0 -1
- package/dist/mcpProbeCapability.js +13 -12
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +20 -10
- package/dist/memoryComplianceCapability.d.ts +0 -1
- package/dist/memoryComplianceCapability.js +14 -13
- package/dist/memoryOriginCapability.d.ts +0 -1
- package/dist/memoryOriginCapability.js +14 -13
- package/dist/memoryVerbsWire.d.ts +1 -1
- package/dist/memoryVerbsWire.js +4 -0
- package/dist/model/liveCatalogShape.d.ts +14 -0
- package/dist/model/liveCatalogShape.js +71 -0
- package/dist/model/modelSupplyRules.d.ts +1 -0
- package/dist/model/modelSupplyRules.js +30 -9
- package/dist/model/modelsPolicy.d.ts +21 -0
- package/dist/model/modelsPolicy.js +90 -0
- package/dist/modelIdentityResolvability.d.ts +4 -2
- package/dist/modelIdentityResolvability.js +25 -5
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +15 -0
- package/dist/outputStyleSeatCapability.js +42 -0
- package/dist/ownKey.d.ts +7 -0
- package/dist/ownKey.js +58 -0
- package/dist/panelReduce.d.ts +114 -0
- package/dist/panelReduce.js +1135 -0
- package/dist/panelStateHolder.d.ts +17 -0
- package/dist/panelStateHolder.js +201 -0
- package/dist/peerLaneCapability.d.ts +0 -1
- package/dist/peerLaneCapability.js +15 -14
- package/dist/permissionModesCapability.d.ts +0 -1
- package/dist/permissionModesCapability.js +5 -10
- package/dist/permissionRuleIssue.js +1 -1
- package/dist/permissionRulesWriteCapability.d.ts +0 -1
- package/dist/permissionRulesWriteCapability.js +15 -14
- package/dist/permissionsAllowGrantCapability.d.ts +2 -1
- package/dist/permissionsAllowGrantCapability.js +35 -19
- package/dist/permissionsDeclaration.d.ts +16 -1
- package/dist/permissionsDeclaration.js +142 -15
- package/dist/printToolResultFrame.js +2 -10
- package/dist/promptDelivery.js +0 -8
- package/dist/protocolSegment.d.ts +1 -0
- package/dist/protocolSegment.js +13 -1
- package/dist/request/taskRequest.d.ts +11 -3
- package/dist/request/taskRequest.js +13 -1
- package/dist/resultFrameKeys.d.ts +4 -0
- package/dist/resultFrameKeys.js +13 -0
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +132 -31
- package/dist/retryStatus.js +6 -4
- package/dist/rewindArchiveCapability.d.ts +2 -1
- package/dist/rewindArchiveCapability.js +28 -15
- package/dist/rewindEngineAction.d.ts +21 -0
- package/dist/rewindEngineAction.js +36 -0
- package/dist/rewindWireCaps.d.ts +2 -1
- package/dist/rewindWireCaps.js +1 -0
- package/dist/{hitl/rosterMountedNames.d.ts → rosterMountedNames.d.ts} +1 -1
- package/dist/runCancelContext.js +2 -1
- package/dist/runTerminal.d.ts +0 -11
- package/dist/runTerminal.js +4 -27
- package/dist/sdkRegistryTransit.d.ts +2 -1
- package/dist/sdkRegistryTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +0 -1
- package/dist/sealedKeyCapability.js +19 -20
- package/dist/seatContract.d.ts +85 -28
- package/dist/seatContract.js +512 -148
- package/dist/sessionIdSegment.d.ts +1 -0
- package/dist/sessionIdSegment.js +11 -0
- package/dist/sessionMemoryErase.d.ts +1 -1
- package/dist/sessionMemoryErase.js +6 -1
- package/dist/sessionMemoryStatus.js +3 -2
- package/dist/sessionPolicyCapability.d.ts +0 -1
- package/dist/sessionPolicyCapability.js +14 -13
- package/dist/sessionReadRedactionCapability.d.ts +15 -0
- package/dist/sessionReadRedactionCapability.js +42 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -1
- package/dist/sessionSyncFileHistoryCapability.js +13 -12
- package/dist/skillToolListsCapability.d.ts +0 -1
- package/dist/skillToolListsCapability.js +13 -12
- package/dist/skillsWireCaps.d.ts +4 -0
- package/dist/skillsWireCaps.js +66 -1
- package/dist/sqlEngineCapability.d.ts +0 -1
- package/dist/sqlEngineCapability.js +21 -21
- package/dist/steerPriorityCapability.d.ts +0 -1
- package/dist/steerPriorityCapability.js +18 -19
- package/dist/storePostureCapability.d.ts +1 -1
- package/dist/storePostureCapability.js +16 -16
- package/dist/streamDrainingLegs.d.ts +6 -0
- package/dist/streamDrainingLegs.js +23 -0
- package/dist/subagent/agentStateDetail.d.ts +1 -0
- package/dist/subagent/agentStateDetail.js +41 -0
- package/dist/subagent/engineCompactWire.d.ts +15 -0
- package/dist/subagent/engineCompactWire.js +82 -45
- package/dist/subagent/engineDelegatedPrompt.js +10 -6
- package/dist/subagent/engineSubagentOutput.d.ts +0 -1
- package/dist/subagent/engineSubagentOutput.js +5 -20
- package/dist/subagent/engineSubagentTail.d.ts +0 -1
- package/dist/subagent/engineSubagentTail.js +7 -32
- package/dist/subagentContentStore.js +3 -3
- package/dist/supportFloor.js +2 -5
- package/dist/taskRequestWords.d.ts +2 -4
- package/dist/taskRequestWords.js +3 -2
- package/dist/terminalStatuses.d.ts +30 -0
- package/dist/terminalStatuses.js +67 -0
- package/dist/toolResult.d.ts +5 -0
- package/dist/toolResult.js +88 -36
- package/dist/types/engineState.d.ts +2 -1
- package/dist/usageAnalytics.d.ts +146 -0
- package/dist/usageAnalytics.js +311 -0
- package/dist/userAttachmentEnvelope.d.ts +22 -1
- package/dist/userAttachmentEnvelope.js +90 -2
- package/dist/userInvokedSkillsCapability.d.ts +0 -1
- package/dist/userInvokedSkillsCapability.js +13 -12
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +20 -19
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireErrorTriage.d.ts +11 -0
- package/dist/wireErrorTriage.js +35 -0
- package/dist/wireFailureShape.d.ts +10 -0
- package/dist/wireFailureShape.js +72 -5
- package/dist/wireRefusalCopy.d.ts +6 -1
- package/dist/wireRefusalCopy.js +23 -25
- package/dist/wiringInstructionsAttribution.d.ts +10 -0
- package/dist/wiringInstructionsAttribution.js +67 -0
- package/dist/workflowClient.js +19 -2
- package/dist/workflowsJournalCapability.d.ts +0 -1
- package/dist/workflowsJournalCapability.js +13 -12
- package/dist/writeProtectionCapability.d.ts +0 -1
- package/dist/writeProtectionCapability.js +26 -26
- package/docs/INTEGRATION-CLIENTS.md +1733 -52
- package/package.json +5 -5
- package/dist/askSurvivesStandingAnswer.d.ts +0 -13
- package/dist/askSurvivesStandingAnswer.js +0 -53
- package/dist/engineCapsGenerationGuard.d.ts +0 -4
- package/dist/engineCapsGenerationGuard.js +0 -19
- package/dist/hitl/askSurvivesPosture.d.ts +0 -20
- package/dist/hitl/askSurvivesPosture.js +0 -48
- package/dist/panelRunningHistory.d.ts +0 -22
- package/dist/panelRunningHistory.js +0 -82
- package/dist/registryConflict.d.ts +0 -3
- package/dist/registryConflict.js +0 -44
- /package/dist/{hitl/rosterMountedNames.js → rosterMountedNames.js} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { hasCoreValuePort, protocolOf, retiredToolNames, ruleToolGrammarOf } from './coreValuePorts.js';
|
|
2
|
-
import { protocolSegmentOf } from './protocolSegment.js';
|
|
1
|
+
import { compileAllowList, hasCoreValuePort, protocolOf, retiredToolNames, ruleToolGrammarOf } from './coreValuePorts.js';
|
|
2
|
+
import { clientOwnedServerPrefix, protocolSegmentOf } from './protocolSegment.js';
|
|
3
3
|
import { ruleCompileVerdict } from './ruleCompileVerdict.js';
|
|
4
|
-
import { allowRulesGate } from './permissionsAllowGrantCapability.js';
|
|
5
|
-
|
|
4
|
+
import { allowRulesGate, allowWireForm } from './permissionsAllowGrantCapability.js';
|
|
5
|
+
import { THROWN_SLOT_UNREADABLE, readThrownSlot } from './wireFailureShape.js';
|
|
6
|
+
export const WIRE_RULE_TRUST_ORDER = Object.freeze([
|
|
6
7
|
'policySettings',
|
|
7
8
|
'cliArg',
|
|
8
9
|
'flagSettings',
|
|
@@ -10,7 +11,8 @@ const RULE_TRUST_ORDER = [
|
|
|
10
11
|
'userSettings',
|
|
11
12
|
'localSettings',
|
|
12
13
|
'projectSettings',
|
|
13
|
-
];
|
|
14
|
+
]);
|
|
15
|
+
const RULE_TRUST_ORDER = WIRE_RULE_TRUST_ORDER;
|
|
14
16
|
export const PERMISSIONS_KEPT_REASONS = Object.freeze([
|
|
15
17
|
'allow_capability_off',
|
|
16
18
|
'settings_read_not_clean',
|
|
@@ -25,6 +27,7 @@ export const PERMISSIONS_KEPT_REASONS = Object.freeze([
|
|
|
25
27
|
'content_form_not_grantable',
|
|
26
28
|
'judge_failed',
|
|
27
29
|
'duplicate',
|
|
30
|
+
'voids_allow_list',
|
|
28
31
|
]);
|
|
29
32
|
function normalizeLegacyToolName(name) {
|
|
30
33
|
switch (name) {
|
|
@@ -104,7 +107,7 @@ function sentFate(wire, toolName, unchecked) {
|
|
|
104
107
|
? { sent: true, wire, unchecked, unreachable: segment.minted !== undefined ? { minted: segment.minted } : {} }
|
|
105
108
|
: { sent: true, wire, unchecked };
|
|
106
109
|
}
|
|
107
|
-
function judgeList(rules, behavior) {
|
|
110
|
+
function judgeList(rules, behavior, allowForm = 'grant') {
|
|
108
111
|
let portsChecked = false;
|
|
109
112
|
return rules.map((rule) => {
|
|
110
113
|
if (rule === '')
|
|
@@ -138,8 +141,16 @@ function judgeList(rules, behavior) {
|
|
|
138
141
|
return kept(issue);
|
|
139
142
|
if (ruleToolGrammarOf(parsed.toolName) === 'path' && parsed.ruleContent.startsWith('~/'))
|
|
140
143
|
return kept('home_relative_path');
|
|
141
|
-
if (behavior === 'allow')
|
|
142
|
-
|
|
144
|
+
if (behavior === 'allow') {
|
|
145
|
+
if (allowForm !== 'layer')
|
|
146
|
+
return kept('content_form_not_grantable');
|
|
147
|
+
const segment = protocolSegmentOf(parsed.toolName);
|
|
148
|
+
if (segment.kind === 'unminted')
|
|
149
|
+
return kept('unminted_protocol_segment');
|
|
150
|
+
if (segment.kind === 'unknown')
|
|
151
|
+
return kept('judge_failed');
|
|
152
|
+
return { sent: true, wire: rule, unchecked: false };
|
|
153
|
+
}
|
|
143
154
|
const verdict = compileVerdict(rule, behavior);
|
|
144
155
|
if (verdict === 'refused')
|
|
145
156
|
return kept('compile_refused');
|
|
@@ -149,7 +160,50 @@ function judgeList(rules, behavior) {
|
|
|
149
160
|
function outsideSettingsFiles(origin) {
|
|
150
161
|
return origin === 'cliArg' || origin === 'session';
|
|
151
162
|
}
|
|
152
|
-
function
|
|
163
|
+
function allowListVoiders(sent) {
|
|
164
|
+
const roster = new Set();
|
|
165
|
+
try {
|
|
166
|
+
const inertOf = (list) => {
|
|
167
|
+
const r = compileAllowList(list, 'allow', roster);
|
|
168
|
+
if (r === undefined || !Array.isArray(r.inert))
|
|
169
|
+
return undefined;
|
|
170
|
+
const out = new Map();
|
|
171
|
+
for (const i of r.inert) {
|
|
172
|
+
if (i === null || typeof i !== 'object' || typeof i.entry !== 'string' || typeof i.reason !== 'string')
|
|
173
|
+
return undefined;
|
|
174
|
+
if (!out.has(i.entry))
|
|
175
|
+
out.set(i.entry, i.reason);
|
|
176
|
+
}
|
|
177
|
+
return out;
|
|
178
|
+
};
|
|
179
|
+
const whole = inertOf(sent);
|
|
180
|
+
if (whole === undefined)
|
|
181
|
+
return 'unknown';
|
|
182
|
+
const alone = new Map();
|
|
183
|
+
for (const e of sent) {
|
|
184
|
+
const one = inertOf([e]);
|
|
185
|
+
if (one === undefined)
|
|
186
|
+
return 'unknown';
|
|
187
|
+
alone.set(e, one.get(e));
|
|
188
|
+
}
|
|
189
|
+
const collateral = [...whole].filter(([e]) => alone.get(e) === undefined);
|
|
190
|
+
if (collateral.length === 0)
|
|
191
|
+
return new Set();
|
|
192
|
+
const reasons = new Set(collateral.map(([, r]) => r));
|
|
193
|
+
const culprits = new Set(sent.filter((e) => { const r = alone.get(e); return r !== undefined && reasons.has(r); }));
|
|
194
|
+
if (culprits.size === 0)
|
|
195
|
+
return 'unknown';
|
|
196
|
+
const rest = sent.filter((e) => !culprits.has(e));
|
|
197
|
+
const after = inertOf(rest);
|
|
198
|
+
if (after === undefined || [...after.keys()].some((e) => alone.get(e) === undefined))
|
|
199
|
+
return 'unknown';
|
|
200
|
+
return culprits;
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
return 'unknown';
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function judgeBucket(raw, behavior, originOf, cli, settingsGate, allowForm = 'grant', dropWire, owned = []) {
|
|
153
207
|
const firstSlot = new Map();
|
|
154
208
|
for (const s of raw)
|
|
155
209
|
if (!firstSlot.has(s.rule))
|
|
@@ -171,6 +225,9 @@ function judgeBucket(raw, behavior, originOf, cli, settingsGate) {
|
|
|
171
225
|
const place = (slot, fate) => {
|
|
172
226
|
if (!fate.sent)
|
|
173
227
|
return fate;
|
|
228
|
+
const dropped = dropWire?.(fate.wire);
|
|
229
|
+
if (dropped !== undefined)
|
|
230
|
+
return kept(dropped);
|
|
174
231
|
if (winnerOf.has(fate.wire))
|
|
175
232
|
return kept('duplicate');
|
|
176
233
|
winnerOf.set(fate.wire, slot);
|
|
@@ -179,7 +236,7 @@ function judgeBucket(raw, behavior, originOf, cli, settingsGate) {
|
|
|
179
236
|
};
|
|
180
237
|
const appendGroup = (group, origin) => {
|
|
181
238
|
const held = settingsGate !== undefined && !outsideSettingsFiles(origin);
|
|
182
|
-
const fates = held ? group.map(() => kept(settingsGate)) : judgeList(group, behavior);
|
|
239
|
+
const fates = held ? group.map(() => kept(settingsGate)) : judgeList(group, behavior, allowForm);
|
|
183
240
|
group.forEach((r, k) => fateOfRule.set(r, place(firstSlot.get(r), fates[k])));
|
|
184
241
|
};
|
|
185
242
|
RULE_TRUST_ORDER.forEach((origin, rank) => {
|
|
@@ -187,6 +244,7 @@ function judgeBucket(raw, behavior, originOf, cli, settingsGate) {
|
|
|
187
244
|
cli.slots.forEach((s, k) => (cliFates[k] = place(s, cliFates[k])));
|
|
188
245
|
appendGroup(groups[rank], origin);
|
|
189
246
|
});
|
|
247
|
+
const ownedFates = owned.map((fate, k) => place({ rule: fate.sent ? fate.wire : '', list: 'allow', at: -1 - k }, fate));
|
|
190
248
|
appendGroup(unknownOrigin, undefined);
|
|
191
249
|
const fates = raw.map((s) => {
|
|
192
250
|
const f = fateOfRule.get(s.rule);
|
|
@@ -194,7 +252,15 @@ function judgeBucket(raw, behavior, originOf, cli, settingsGate) {
|
|
|
194
252
|
return f;
|
|
195
253
|
return f.sent || f.reason === 'duplicate' ? kept('duplicate') : f;
|
|
196
254
|
});
|
|
197
|
-
return { sent, fates: [...fates, ...cliFates], winnerOf };
|
|
255
|
+
return { sent, fates: [...fates, ...cliFates], winnerOf, ownedFates };
|
|
256
|
+
}
|
|
257
|
+
function clientOwnedFate(server) {
|
|
258
|
+
if (server.length === 0)
|
|
259
|
+
return kept('empty_rule');
|
|
260
|
+
const prefix = clientOwnedServerPrefix(server);
|
|
261
|
+
if (typeof prefix !== 'string' || prefix.length <= 2 || !prefix.endsWith('__'))
|
|
262
|
+
return kept('judge_failed');
|
|
263
|
+
return judgeList([`${prefix}*`], 'allow')[0];
|
|
198
264
|
}
|
|
199
265
|
const WHO = 'permissionsDeclaration';
|
|
200
266
|
function ownField(obj, key, where) {
|
|
@@ -248,6 +314,7 @@ function assemble(input, caps) {
|
|
|
248
314
|
const ask = ruleList(ownField(input, 'ask', ''), 'ask');
|
|
249
315
|
const allow = ruleList(ownField(input, 'allow', ''), 'allow');
|
|
250
316
|
const cliDeny = ruleList(ownField(input, 'cliDeny', ''), 'cliDeny');
|
|
317
|
+
const ownedServers = [...new Set(ruleList(ownField(input, 'clientOwnedServers', ''), 'clientOwnedServers') ?? [])];
|
|
251
318
|
const originsRaw = ownField(input, 'origins', '');
|
|
252
319
|
let origins = {};
|
|
253
320
|
if (originsRaw !== undefined && originsRaw !== null) {
|
|
@@ -267,9 +334,18 @@ function assemble(input, caps) {
|
|
|
267
334
|
const allowSlots = slotsOf(allow, 'allow');
|
|
268
335
|
const denyJ = judgeBucket(denySlots, 'deny', origins.deny, cli);
|
|
269
336
|
const askJ = judgeBucket(askSlots, 'ask', origins.ask, undefined);
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
337
|
+
const allowForm = allowWireForm(caps) === 'layer' ? 'layer' : 'grant';
|
|
338
|
+
const settingsGate = gate === 'settings_read_not_clean' ? 'settings_read_not_clean' : undefined;
|
|
339
|
+
let allowJ = gate === 'capability_off'
|
|
340
|
+
? { sent: [], fates: allowSlots.map(() => kept('allow_capability_off')), winnerOf: new Map(), ownedFates: ownedServers.map(() => kept('allow_capability_off')) }
|
|
341
|
+
: judgeBucket(allowSlots, 'allow', origins.allow, undefined, settingsGate, allowForm, undefined, ownedServers.map(clientOwnedFate));
|
|
342
|
+
if (gate !== 'capability_off' && allowForm === 'layer' && allowJ.sent.length > 0) {
|
|
343
|
+
const voiders = allowListVoiders(allowJ.sent);
|
|
344
|
+
if (voiders === 'unknown' || voiders.size > 0) {
|
|
345
|
+
const drop = voiders === 'unknown' ? () => 'judge_failed' : (w) => (voiders.has(w) ? 'voids_allow_list' : undefined);
|
|
346
|
+
allowJ = judgeBucket(allowSlots, 'allow', origins.allow, undefined, settingsGate, allowForm, drop, ownedServers.map(clientOwnedFate));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
273
349
|
const buckets = {};
|
|
274
350
|
if (denyJ.sent.length > 0)
|
|
275
351
|
buckets.deny = [...denyJ.sent];
|
|
@@ -286,6 +362,11 @@ function assemble(input, caps) {
|
|
|
286
362
|
['ask', askSlots, askJ],
|
|
287
363
|
['allow', allowSlots, allowJ],
|
|
288
364
|
];
|
|
365
|
+
const clientOwned = ownedServers.map((server, k) => {
|
|
366
|
+
const f = allowJ.ownedFates[k];
|
|
367
|
+
const minted = f.sent ? f.wire : undefined;
|
|
368
|
+
return f.sent ? { server, rule: minted, sent: true } : { server, sent: false, reason: f.reason };
|
|
369
|
+
});
|
|
289
370
|
for (const [bucket, slots, j] of rows) {
|
|
290
371
|
slots.forEach((s, k) => {
|
|
291
372
|
const f = j.fates[k];
|
|
@@ -294,6 +375,8 @@ function assemble(input, caps) {
|
|
|
294
375
|
});
|
|
295
376
|
for (const wire of j.sent) {
|
|
296
377
|
const winner = j.winnerOf.get(wire);
|
|
378
|
+
if (winner.at < 0)
|
|
379
|
+
continue;
|
|
297
380
|
if (winner.rule !== wire)
|
|
298
381
|
rewritten.push({ from: winner.rule, to: wire, bucket });
|
|
299
382
|
const f = (winner.list === 'cliDeny' ? j.fates[denySlots.length + winner.at] : j.fates[winner.at]);
|
|
@@ -304,7 +387,7 @@ function assemble(input, caps) {
|
|
|
304
387
|
}
|
|
305
388
|
}
|
|
306
389
|
}
|
|
307
|
-
return { buckets, report: { kept: keptRows, rewritten, unchecked, unreachable } };
|
|
390
|
+
return { buckets, report: { kept: keptRows, rewritten, unchecked, unreachable, ...(clientOwned.length > 0 ? { clientOwned } : {}) } };
|
|
308
391
|
}
|
|
309
392
|
export function permissionsDeclaration(input, caps) {
|
|
310
393
|
const { buckets } = assemble(input, caps);
|
|
@@ -314,3 +397,47 @@ export function permissionsDeclarationReport(input, caps) {
|
|
|
314
397
|
const { buckets, report } = assemble(input, caps);
|
|
315
398
|
return { ...(Object.keys(buckets).length > 0 ? { permissions: buckets } : {}), ...report };
|
|
316
399
|
}
|
|
400
|
+
const ALLOW_KEPT_ROWS_READ_MAX = 4096;
|
|
401
|
+
function allowHeldBySettingsReadCount(report) {
|
|
402
|
+
if (typeof report !== 'object' || report === null)
|
|
403
|
+
return 0;
|
|
404
|
+
const kept = readThrownSlot(report, 'kept');
|
|
405
|
+
if (typeof kept !== 'object' || kept === null)
|
|
406
|
+
return 0;
|
|
407
|
+
const length = readThrownSlot(kept, 'length');
|
|
408
|
+
if (typeof length !== 'number' || !Number.isInteger(length) || length <= 0)
|
|
409
|
+
return 0;
|
|
410
|
+
let n = 0;
|
|
411
|
+
for (let i = 0; i < Math.min(length, ALLOW_KEPT_ROWS_READ_MAX); i++) {
|
|
412
|
+
const row = readThrownSlot(kept, String(i));
|
|
413
|
+
if (typeof row === 'object' && row !== null && readThrownSlot(row, 'reason') === 'settings_read_not_clean')
|
|
414
|
+
n++;
|
|
415
|
+
}
|
|
416
|
+
return n;
|
|
417
|
+
}
|
|
418
|
+
export function permissionsAllowKeptNotice(report, settingsRead, facts) {
|
|
419
|
+
const held = allowHeldBySettingsReadCount(report);
|
|
420
|
+
if (held <= 0)
|
|
421
|
+
return undefined;
|
|
422
|
+
const readFact = (key) => {
|
|
423
|
+
if (typeof facts !== 'object' || facts === null)
|
|
424
|
+
return undefined;
|
|
425
|
+
const v = readThrownSlot(facts, key);
|
|
426
|
+
return v === THROWN_SLOT_UNREADABLE ? undefined : v;
|
|
427
|
+
};
|
|
428
|
+
const rawCount = readFact('problemCount');
|
|
429
|
+
const rawWhere = readFact('where');
|
|
430
|
+
const managedPending = readFact('managedPolicyPending') === true;
|
|
431
|
+
const count = typeof rawCount === 'number' && Number.isInteger(rawCount) && rawCount >= 1 ? rawCount : undefined;
|
|
432
|
+
const where = typeof rawWhere === 'string' && rawWhere.length >= 1 && rawWhere.length <= 200 && !/\p{Cc}/u.test(rawWhere) ? rawWhere : undefined;
|
|
433
|
+
const head = `${String(held)} permissions.allow rule${held === 1 ? ' was' : 's were'} not sent to the engine for this run because `;
|
|
434
|
+
if (settingsRead === 'partial' && managedPending && count === 1) {
|
|
435
|
+
return (`${head}the managed policy for your account has not been received yet (sema keeps fetching it; allow rules apply once it arrives). ` +
|
|
436
|
+
'Run again once it has been received (deny and ask rules, and rules given with --allowedTools, are still sent).');
|
|
437
|
+
}
|
|
438
|
+
const why = settingsRead === 'partial'
|
|
439
|
+
? `the settings read reported ${count === undefined ? 'problems' : `${String(count)} problem${count === 1 ? '' : 's'}`}${where === undefined ? '' : ` (${where})`}`
|
|
440
|
+
: 'the health of this settings read could not be checked';
|
|
441
|
+
return (`${head}${why}; an allow rule from a settings file is only sent from a settings read with no problems. Fix the reported settings, then run again ` +
|
|
442
|
+
'(deny and ask rules from this read, and rules given with --allowedTools, are still sent).');
|
|
443
|
+
}
|
|
@@ -2,20 +2,12 @@ import { isCcToolDenialKind } from './gateVocabulary.js';
|
|
|
2
2
|
export { flattenWireOutput as flattenToolOutput } from './adapt/wireShapes.js';
|
|
3
3
|
import { flattenWireOutput } from './adapt/wireShapes.js';
|
|
4
4
|
import { parseModelFacingBash } from './toolResult.js';
|
|
5
|
+
import { bashExitOf, bashExitReadingFailed } from './bashExitReading.js';
|
|
5
6
|
import { toolResultEnvelopeParts, toolResultOutcomeOf } from './adapt/toolCards.js';
|
|
6
7
|
function bashExitCodeFailed(toolName, text, structured) {
|
|
7
8
|
if (typeof toolName !== 'string' || toolName.toLowerCase() !== 'bash')
|
|
8
9
|
return false;
|
|
9
|
-
|
|
10
|
-
if (typeof st?.returnCodeInterpretation === 'string' && st.returnCodeInterpretation.length > 0)
|
|
11
|
-
return false;
|
|
12
|
-
const ec = st?.exitCode;
|
|
13
|
-
if (typeof ec === 'number')
|
|
14
|
-
return ec !== 0;
|
|
15
|
-
if (parseModelFacingBash(text)?.note !== undefined)
|
|
16
|
-
return false;
|
|
17
|
-
const m = /^exit code: (\d+)\b/.exec(text);
|
|
18
|
-
return m !== null && m[1] !== '0';
|
|
10
|
+
return bashExitReadingFailed(bashExitOf(structured, () => parseModelFacingBash(text)));
|
|
19
11
|
}
|
|
20
12
|
export function toolEndResultToUserFrame(arm) {
|
|
21
13
|
if (typeof arm.toolCallId !== 'string' || arm.toolCallId.length === 0)
|
package/dist/promptDelivery.js
CHANGED
|
@@ -132,14 +132,6 @@ export function frameProvesDelivery(event) {
|
|
|
132
132
|
const type = event.type;
|
|
133
133
|
if (typeof type !== 'string' || type.length === 0 || PRE_RUN_FRAME_TYPES.has(type))
|
|
134
134
|
return false;
|
|
135
|
-
if (type === 'done') {
|
|
136
|
-
const result = event.result;
|
|
137
|
-
if (typeof result === 'object' && result !== null && !Array.isArray(result) && result.status === undefined) {
|
|
138
|
-
const r = result;
|
|
139
|
-
if (activeRunBusySignal({ type: 'failed', errorCode: r.errorCode, activeTaskId: r.activeTaskId }) !== null)
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
135
|
return activeRunBusySignal(event) === null;
|
|
144
136
|
}
|
|
145
137
|
catch {
|
package/dist/protocolSegment.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasCoreValuePort, mintNamespacePrefix, protocolOf } from './coreValuePorts.js';
|
|
1
|
+
import { hasCoreValuePort, mcpNamespace, mintNamespacePrefix, protocolOf } from './coreValuePorts.js';
|
|
2
2
|
import { CORE_PROTOCOL_PREFIXES } from './generated/toolNameTables.js';
|
|
3
3
|
export function protocolSegmentOf(name) {
|
|
4
4
|
if (CORE_PROTOCOL_PREFIXES.some((prefix) => name.startsWith(prefix) && name.slice(prefix.length).split('__')[0] === ''))
|
|
@@ -29,3 +29,15 @@ export function protocolSegmentOf(name) {
|
|
|
29
29
|
return { kind: 'unknown' };
|
|
30
30
|
return minted === `${ns.prefix}${peer}__` ? { kind: 'ok' } : { kind: 'unminted', minted };
|
|
31
31
|
}
|
|
32
|
+
export function clientOwnedServerPrefix(server) {
|
|
33
|
+
try {
|
|
34
|
+
const ns = mcpNamespace();
|
|
35
|
+
if (ns === undefined)
|
|
36
|
+
return undefined;
|
|
37
|
+
const prefix = mintNamespacePrefix(ns, server);
|
|
38
|
+
return typeof prefix === 'string' ? prefix : undefined;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { TaskRequest } from '@sema-agent/sdk';
|
|
2
|
+
import { type OutputStyleSeatReading } from '../outputStyleSeatCapability.js';
|
|
3
|
+
import { type ApprovalReachWord } from '../approvalReachWire.js';
|
|
2
4
|
export type RequestLane = 'interactive' | 'print' | 'utility';
|
|
3
5
|
export type TaskRequestLike = Record<string, unknown>;
|
|
4
6
|
export interface RequestFieldSpec {
|
|
@@ -10,7 +12,7 @@ export interface RequestFieldSpec {
|
|
|
10
12
|
whyUtilityLane: string;
|
|
11
13
|
}
|
|
12
14
|
export declare const REQUEST_FIELD_MATRIX: readonly RequestFieldSpec[];
|
|
13
|
-
export declare const LIVE_DEFAULT_FIELDS: readonly ["cwd", "additionalDirectories", "additionalReadDirectories", "forwardSubagentEvents", "retainSubagentSessions", "agents", "appendSystemPrompt|settings.outputStyle", "suggestNextPrompts", "compactionModel", "sessionId(三态解析)"];
|
|
15
|
+
export declare const LIVE_DEFAULT_FIELDS: readonly ["cwd", "additionalDirectories", "additionalReadDirectories", "forwardSubagentEvents", "retainSubagentSessions", "agents", "appendSystemPrompt|settings.outputStyle", "outputStyle(每轮一句座,见位才落)", "suggestNextPrompts", "compactionModel", "sessionId(三态解析)"];
|
|
14
16
|
export interface TaskRequestInput {
|
|
15
17
|
objective: string;
|
|
16
18
|
sessionId: string;
|
|
@@ -38,6 +40,7 @@ export interface TaskRequestInput {
|
|
|
38
40
|
limits?: Record<string, unknown>;
|
|
39
41
|
interactiveTools?: false;
|
|
40
42
|
oneShot?: true;
|
|
43
|
+
approvalReach?: ApprovalReachWord;
|
|
41
44
|
excludeAllTools?: true;
|
|
42
45
|
outputSchema?: NonNullable<TaskRequest['outputSchema']>;
|
|
43
46
|
outputRetries?: number;
|
|
@@ -48,10 +51,10 @@ export interface TaskRequestInput {
|
|
|
48
51
|
maxThinkingTokens?: number;
|
|
49
52
|
memoryCapture?: 'off';
|
|
50
53
|
memory?: 'off';
|
|
51
|
-
fileHistory?: '
|
|
54
|
+
fileHistory?: TaskRequest['fileHistory'];
|
|
52
55
|
inheritEnv?: InheritEnvWord;
|
|
53
56
|
requireExistingSession?: TaskRequest['requireExistingSession'];
|
|
54
|
-
disableSkills?:
|
|
57
|
+
disableSkills?: TaskRequest['disableSkills'];
|
|
55
58
|
rewind?: Record<string, unknown>;
|
|
56
59
|
repo?: string;
|
|
57
60
|
council?: boolean;
|
|
@@ -133,6 +136,11 @@ export interface LiveDefaultsInput {
|
|
|
133
136
|
forAppend: string;
|
|
134
137
|
forOutputStyle: string;
|
|
135
138
|
};
|
|
139
|
+
outputStyleSeat?: {
|
|
140
|
+
name: string;
|
|
141
|
+
turnReminder?: string;
|
|
142
|
+
};
|
|
143
|
+
outputStyleSeatReading?: OutputStyleSeatReading;
|
|
136
144
|
suggestNextPrompts?: boolean;
|
|
137
145
|
compactionModel?: string;
|
|
138
146
|
capturedSessionId?: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { refuseBadDisableSkills, refuseDisableSkillsConflict } from '../disableSkillsWire.js';
|
|
2
2
|
import { ATTACHMENTS_SPEC_KEYS, AttachmentsSpecRefused } from '../attachmentsWireCaps.js';
|
|
3
3
|
import { retiredAttachmentsKeyOf } from '../taskRequestWords.js';
|
|
4
|
+
import { outputStyleSeatAdmitted } from '../outputStyleSeatCapability.js';
|
|
5
|
+
import { refuseBadApprovalReach } from '../approvalReachWire.js';
|
|
4
6
|
export const REQUEST_FIELD_MATRIX = [
|
|
5
7
|
{ field: 'objective', lanes: ['interactive', 'print', 'utility'], live: false, why: '本 turn 的真实输入,每条车道都必需', whyUtilityLane: '恒座:三条车道都必须带上本次提交的模型面输入' },
|
|
6
8
|
{ field: 'sessionId', lanes: ['interactive', 'print', 'utility'], live: false, why: '单命名空间(TP-A Step 2):壳 id 即引擎 session id;print 在非 live 下保留 mock 常量', whyUtilityLane: '恒座:side-channel 提交走**独立**会话 id(壳另铸一个,绝不复用用户会话那一个 —— 复用会把这次提交的转录混进用户会话)' },
|
|
@@ -48,6 +50,7 @@ export const REQUEST_FIELD_MATRIX = [
|
|
|
48
50
|
{ field: 'resumeAt/resumeAtMode/restoreFiles/rewindFilesTo', lanes: ['interactive'], live: false, why: 'E18 `/rewind` 是交互命令;四键同生同灭(CC-145:core 6.0.0 起 both 臂发 restoreFiles;CC-223 起退役键 rewindFiles 不再有座 —— 交它按表外子键响亮拒;resumeAtMode 是 both/conversation 两臂恒带的排他截语义位)', whyUtilityLane: '无座:回退是交互命令,而 side-channel 是一次性的独立会话,没有可回退的历史' },
|
|
49
51
|
{ field: 'clientContext', lanes: ['interactive'], live: false, why: 'IANA 时区 + 可选邮箱 → core 本地化 `# Environment` 的 today;print 同样跑在用户机器上,缺席让引擎误标 (UTC)', gap: true, whyUtilityLane: '无座:本地化 today 的用途在用户会话的环境段,而 side-channel 的系统提示由壳整段给出 —— 这一列我判不准要不要(与本行 `gap` 同一条待办:要补先单独立项)' },
|
|
50
52
|
{ field: 'scratchpadDir', lanes: ['interactive'], live: true, why: '[816]③ per-session 暂存目录;print 也有 session,缺席让 `-p` 的工具写不进 exemptDir', gap: true, whyUtilityLane: '无座:per-session 暂存目录是给**工具**写的,零工具面上没人写' },
|
|
53
|
+
{ field: 'approvalReach', lanes: ['print'], live: true, why: '「这条运行上没有人能答审批」的**逐运行声明**(服务端 7.118.0 提交体键,值闭集由引擎 `APPROVAL_REACH` 派生;声明在场 ⇒ 这条腿的问不发活卡、第一个要审批的调用停驻或拒)。只有无人值守车道有座:那里「审批函数在 ≠ 有人能答」;交互车道恒有人坐在对面能答,声明 none 会把能答的人挡在外面。🔴 只在能力读数为真时由片段口 `approvalReachDeclaration` 给值(老服务端对表外键整份 400)', whyUtilityLane: '无座:side-channel 强制零工具面(`excludeAllTools`),没有门控调用、不会问审批 ⇒ 声明没有对象;带上它只会在不认识这一键的老服务端上给这条提交多一种 400' },
|
|
51
54
|
];
|
|
52
55
|
export const LIVE_DEFAULT_FIELDS = Object.freeze([
|
|
53
56
|
'cwd',
|
|
@@ -57,6 +60,7 @@ export const LIVE_DEFAULT_FIELDS = Object.freeze([
|
|
|
57
60
|
'retainSubagentSessions',
|
|
58
61
|
'agents',
|
|
59
62
|
'appendSystemPrompt|settings.outputStyle',
|
|
63
|
+
'outputStyle(每轮一句座,见位才落)',
|
|
60
64
|
'suggestNextPrompts',
|
|
61
65
|
'compactionModel',
|
|
62
66
|
'sessionId(三态解析)',
|
|
@@ -143,6 +147,7 @@ const INPUT_KEY_ROUTES = {
|
|
|
143
147
|
limits: row('limits'),
|
|
144
148
|
interactiveTools: row('interactiveTools'),
|
|
145
149
|
oneShot: row('oneShot'),
|
|
150
|
+
approvalReach: row('approvalReach'),
|
|
146
151
|
outputSchema: row('outputSchema'),
|
|
147
152
|
outputRetries: row('outputRetries'),
|
|
148
153
|
maxCostUsd: row('maxCostUsd'),
|
|
@@ -586,7 +591,7 @@ export function parseMaxCostUsd(text) {
|
|
|
586
591
|
return { ok: false, why: 'not_positive' };
|
|
587
592
|
return { ok: true, value };
|
|
588
593
|
}
|
|
589
|
-
const ACCESSOR_READ_ORDER = ['live', 'memoryCapture', 'memory', 'settings', 'maxCostUsd', 'excludeAllTools', 'maxTokens', 'outputRetries', 'fileHistory', 'inheritEnv', 'requireExistingSession', 'disableSkills'];
|
|
594
|
+
const ACCESSOR_READ_ORDER = ['live', 'memoryCapture', 'memory', 'settings', 'maxCostUsd', 'excludeAllTools', 'maxTokens', 'outputRetries', 'fileHistory', 'inheritEnv', 'requireExistingSession', 'disableSkills', 'approvalReach'];
|
|
590
595
|
function dataFirstSnapshot(input, afterData) {
|
|
591
596
|
let descs;
|
|
592
597
|
try {
|
|
@@ -657,6 +662,7 @@ export function assembleTaskRequest(input, lane) {
|
|
|
657
662
|
const inheritEnvIn = src.inheritEnv;
|
|
658
663
|
const requireExistingSessionIn = src.requireExistingSession;
|
|
659
664
|
const disableSkillsIn = src.disableSkills;
|
|
665
|
+
const approvalReachIn = src.approvalReach;
|
|
660
666
|
const INPUT_KEYS = Object.keys(INPUT_KEY_ROUTES);
|
|
661
667
|
const i = snapshotByName(src, INPUT_KEYS, {
|
|
662
668
|
live,
|
|
@@ -670,6 +676,7 @@ export function assembleTaskRequest(input, lane) {
|
|
|
670
676
|
inheritEnv: inheritEnvIn,
|
|
671
677
|
requireExistingSession: requireExistingSessionIn,
|
|
672
678
|
disableSkills: disableSkillsIn,
|
|
679
|
+
approvalReach: approvalReachIn,
|
|
673
680
|
settings: settingsIn,
|
|
674
681
|
});
|
|
675
682
|
const SETTINGS_KEYS = Object.keys(SETTINGS_KEY_ROUTES);
|
|
@@ -684,6 +691,7 @@ export function assembleTaskRequest(input, lane) {
|
|
|
684
691
|
refuseBadInheritEnv(inheritEnvIn);
|
|
685
692
|
refuseBadRequireExistingSession(requireExistingSessionIn);
|
|
686
693
|
refuseBadDisableSkills(disableSkillsIn, 'buildTaskRequest');
|
|
694
|
+
refuseBadApprovalReach(approvalReachIn, 'buildTaskRequest');
|
|
687
695
|
const rewindRoute = INPUT_KEY_ROUTES.rewind;
|
|
688
696
|
const RETIRED_REWIND_FILES_KEY = 'rewindFiles';
|
|
689
697
|
const REWIND_KEYS = rewindRoute.via === 'matrix' ? rewindRoute.field.split('/') : [];
|
|
@@ -839,6 +847,7 @@ export function assembleTaskRequest(input, lane) {
|
|
|
839
847
|
...(on('inheritEnv') ? { inheritEnv: inheritEnvIn } : {}),
|
|
840
848
|
...(on('requireExistingSession') ? { requireExistingSession: true } : {}),
|
|
841
849
|
...(on('disableSkills') ? { disableSkills: true } : {}),
|
|
850
|
+
...(on('approvalReach') ? { approvalReach: approvalReachIn } : {}),
|
|
842
851
|
...(Object.keys(settingsOut).length > 0 ? { settings: settingsOut } : {}),
|
|
843
852
|
};
|
|
844
853
|
return Object.freeze({ request: out, omitted: Object.freeze([...omitted, ...lateOmitted]) });
|
|
@@ -875,6 +884,9 @@ export function applyLiveRequestDefaults(req, host) {
|
|
|
875
884
|
out.settings = { ...settings, outputStyle: host.selfKnowledge.forOutputStyle };
|
|
876
885
|
}
|
|
877
886
|
}
|
|
887
|
+
if (out.outputStyle === undefined && host.outputStyleSeat !== undefined && outputStyleSeatAdmitted(host.outputStyleSeatReading)) {
|
|
888
|
+
out.outputStyle = { ...host.outputStyleSeat };
|
|
889
|
+
}
|
|
878
890
|
if (out.suggestNextPrompts === undefined &&
|
|
879
891
|
out.verify === undefined &&
|
|
880
892
|
out.cascade === undefined &&
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function resultErrorCodeOf(frame: unknown): string | undefined;
|
|
2
|
+
export declare function resultSelectedModelOf(frame: unknown): string | undefined;
|
|
3
|
+
export declare function resultSalvagedResultOf(frame: unknown): string | undefined;
|
|
4
|
+
export declare function resultParkFailedReasonOf(frame: unknown): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { readFrameStringKey } from './ownKey.js';
|
|
2
|
+
export function resultErrorCodeOf(frame) {
|
|
3
|
+
return readFrameStringKey(frame, '_sema_error_code');
|
|
4
|
+
}
|
|
5
|
+
export function resultSelectedModelOf(frame) {
|
|
6
|
+
return readFrameStringKey(frame, '_sema_selected_model');
|
|
7
|
+
}
|
|
8
|
+
export function resultSalvagedResultOf(frame) {
|
|
9
|
+
return readFrameStringKey(frame, '_sema_salvaged_result');
|
|
10
|
+
}
|
|
11
|
+
export function resultParkFailedReasonOf(frame) {
|
|
12
|
+
return readFrameStringKey(frame, '_sema_park_failed_reason');
|
|
13
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RESUME_CONTEXT_UNAVAILABLE } from './engineErrorCodes.js';
|
|
1
|
+
import { RESUME_CONTEXT_UNAVAILABLE, CHECKPOINT_UNSUPPORTED_VERSION, CHECKPOINT_WALLTIME_AXIS_RETIRED, CHECKPOINT_CONFIG_REFUSED } from './engineErrorCodes.js';
|
|
2
2
|
export declare const RESUME_REFUSAL_CODES: readonly string[];
|
|
3
3
|
export interface ResumeRefusalDetail {
|
|
4
4
|
code: string;
|
|
@@ -50,6 +50,8 @@ export declare function parkedResumeStartupContent(detail: ParkedResumeStartupDe
|
|
|
50
50
|
export interface CheckpointUnsupportedVersionDetail {
|
|
51
51
|
code: 'checkpoint.unsupported_version';
|
|
52
52
|
retriable: true;
|
|
53
|
+
writerVersion?: string;
|
|
54
|
+
readerVersion?: string;
|
|
53
55
|
}
|
|
54
56
|
export declare function checkpointUnsupportedVersionFromError(err: unknown): CheckpointUnsupportedVersionDetail | null;
|
|
55
57
|
export type CheckpointUnsupportedParkKind = 'tool_approval' | 'plan_review' | 'resource_park' | 'wake' | 'workflow_host';
|
|
@@ -58,3 +60,18 @@ export interface CheckpointUnsupportedVersionContext {
|
|
|
58
60
|
readonly runId?: string;
|
|
59
61
|
}
|
|
60
62
|
export declare function checkpointUnsupportedVersionContent(detail: CheckpointUnsupportedVersionDetail, ctx?: CheckpointUnsupportedVersionContext): string;
|
|
63
|
+
export type RefusedParkCode = typeof CHECKPOINT_UNSUPPORTED_VERSION | typeof CHECKPOINT_WALLTIME_AXIS_RETIRED | typeof CHECKPOINT_CONFIG_REFUSED;
|
|
64
|
+
export interface RefusedParkFacts {
|
|
65
|
+
readonly code: RefusedParkCode;
|
|
66
|
+
readonly field?: string;
|
|
67
|
+
readonly stillPending?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export declare function refusedParkFromError(failure: unknown): RefusedParkFacts | null;
|
|
70
|
+
export interface RefusedParkContentInput {
|
|
71
|
+
readonly what: string;
|
|
72
|
+
readonly facts: RefusedParkFacts;
|
|
73
|
+
readonly lane: 'interactive' | 'print';
|
|
74
|
+
readonly runId?: string;
|
|
75
|
+
}
|
|
76
|
+
export declare function refusedParkContent(input: RefusedParkContentInput): string;
|
|
77
|
+
export declare function refusedParkBlockedContent(taskId: string, lane?: 'interactive' | 'print'): string;
|