@sema-agent/client-core 0.94.0 → 0.96.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 +521 -0
- package/README.md +104 -57
- package/dist/adapt/arms.js +12 -7
- package/dist/adapt/panelTasks.js +4 -10
- package/dist/adapt/toolCards.d.ts +1 -0
- package/dist/adapt/toolCards.js +18 -5
- package/dist/adapt/wireShapes.js +5 -24
- package/dist/adapter/activeRunSelfHeal.d.ts +12 -3
- package/dist/adapter/activeRunSelfHeal.js +50 -16
- package/dist/adapter/downstream/eventToSdkMessage.js +33 -18
- package/dist/adapter/downstream/terminalToSdkResult.js +19 -12
- package/dist/adapter/runStream.js +30 -46
- 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 +7 -5
- package/dist/agentSession/engineSessionBackgroundStop.js +25 -17
- package/dist/agentsWireCaps.d.ts +2 -0
- package/dist/agentsWireCaps.js +13 -2
- package/dist/approvalDecidedByCapability.d.ts +0 -1
- package/dist/approvalDecidedByCapability.js +2 -7
- package/dist/approvalsStreamLiveCapability.d.ts +0 -1
- package/dist/approvalsStreamLiveCapability.js +2 -6
- 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 +0 -5
- package/dist/callerCwdCapability.js +2 -13
- package/dist/centerWiringCapability.d.ts +1 -7
- package/dist/centerWiringCapability.js +18 -27
- package/dist/classifierStatus.js +4 -4
- package/dist/classifierVerdictWire.js +4 -16
- package/dist/clientSlice.js +1 -1
- package/dist/cloudConfigWireCaps.d.ts +3 -3
- package/dist/cloudConfigWireCaps.js +85 -43
- package/dist/compensations.js +1 -1
- package/dist/coreValuePorts.d.ts +11 -7
- package/dist/coreValuePorts.js +5 -8
- package/dist/credentialProvenance.d.ts +28 -0
- package/dist/credentialProvenance.js +76 -0
- package/dist/cycleOrder.d.ts +15 -0
- package/dist/cycleOrder.js +45 -0
- package/dist/decideFailureNote.js +7 -2
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/decideReceipt.js +39 -14
- package/dist/declared/supportFloorDeclared.d.ts +1 -0
- package/dist/declared/supportFloorDeclared.js +5 -0
- package/dist/deviceExecutorManagementCapability.d.ts +0 -1
- package/dist/deviceExecutorManagementCapability.js +7 -16
- package/dist/deviceRebind.d.ts +88 -0
- package/dist/deviceRebind.js +242 -0
- package/dist/displayUntrusted.d.ts +8 -3
- package/dist/displayUntrusted.js +661 -63
- 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 +13 -2
- package/dist/engineCapsCache.js +276 -44
- package/dist/engineCredentialRequirement.d.ts +9 -0
- package/dist/engineCredentialRequirement.js +23 -0
- package/dist/engineDirectory.d.ts +79 -0
- package/dist/engineDirectory.js +186 -0
- package/dist/engineEnvSourcing.d.ts +53 -0
- package/dist/engineEnvSourcing.js +81 -0
- package/dist/engineErrorCodes.d.ts +28 -4
- package/dist/engineErrorCodes.js +68 -25
- package/dist/engineIdentity.js +2 -0
- package/dist/engineNoticeCodes.d.ts +17 -0
- package/dist/engineNoticeCodes.js +57 -3
- package/dist/engineWireSdk.js +2 -2
- package/dist/engineWordRenames.d.ts +8 -0
- package/dist/engineWordRenames.js +13 -0
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +18 -23
- package/dist/fileHistoryCaptureCapability.d.ts +14 -1
- package/dist/fileHistoryCaptureCapability.js +72 -6
- package/dist/fileHistoryLegNotice.d.ts +3 -2
- package/dist/fileHistoryLegNotice.js +51 -2
- package/dist/fleet/bgSubagentRow.d.ts +15 -0
- package/dist/fleet/bgSubagentRow.js +67 -0
- package/dist/fleet/fleetLedger.d.ts +3 -0
- package/dist/fleet/fleetLedger.js +153 -122
- package/dist/fleet/fleetProjection.d.ts +1 -3
- package/dist/fleet/fleetProjection.js +19 -19
- 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/fleetTaskDesc.js +4 -17
- package/dist/gateOutcome.d.ts +12 -1
- package/dist/gateOutcome.js +87 -18
- package/dist/gateVocabulary.d.ts +7 -2
- package/dist/gateVocabulary.js +5 -1
- package/dist/generated/engineAskFaceTables.js +1 -1
- package/dist/generated/engineFactTables.d.ts +5 -3
- package/dist/generated/engineFactTables.js +17 -4
- package/dist/generated/engineNoticeTables.js +12 -3
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +17 -0
- package/dist/generated/settingsSchemaFns.d.ts +13 -0
- package/dist/generated/settingsSchemaFns.js +75 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/headlessPermissionModeWire.d.ts +1 -1
- package/dist/headlessPermissionModeWire.js +1 -1
- 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 +7 -0
- package/dist/hitl/approvalEndingCause.js +71 -0
- package/dist/hitl/approvalHolds.d.ts +12 -2
- package/dist/hitl/approvalHolds.js +53 -2
- package/dist/hitl/approvalsFeed.js +23 -11
- package/dist/hitl/askGateWire.d.ts +2 -1
- package/dist/hitl/askGateWire.js +26 -1
- package/dist/hitl/askParkRowRouting.js +1 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +15 -10
- package/dist/hitl/crashConverged.js +2 -0
- package/dist/hitl/decisionConflict.d.ts +3 -0
- package/dist/hitl/decisionConflict.js +41 -0
- package/dist/hitl/decisionRefusal.d.ts +12 -0
- package/dist/hitl/decisionRefusal.js +63 -4
- package/dist/hitl/frameRouter.d.ts +0 -1
- package/dist/hitl/frameRouter.js +32 -57
- package/dist/hitl/gateLedger.d.ts +5 -0
- package/dist/hitl/gateLedger.js +21 -0
- package/dist/hitl/hitlBridge.d.ts +17 -2
- package/dist/hitl/hitlBridge.js +91 -55
- package/dist/hitl/hitlHostSurface.js +3 -11
- package/dist/hitl/livePendingAsk.d.ts +16 -6
- package/dist/hitl/livePendingAsk.js +36 -4
- package/dist/hitl/localAllowRule.d.ts +1 -0
- package/dist/hitl/localAllowRule.js +2 -2
- package/dist/hitl/noAllowCause.d.ts +2 -1
- package/dist/hitl/noAllowCause.js +3 -2
- package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
- package/dist/hitl/parkExpiryJudgements.js +46 -0
- package/dist/hitl/parkResolver.d.ts +4 -7
- package/dist/hitl/parkResolver.js +12 -34
- package/dist/hitl/parkRowBirthWait.d.ts +1 -0
- package/dist/hitl/parkRowBirthWait.js +2 -2
- package/dist/hitl/persistedRulesWire.js +5 -1
- package/dist/hitl/planReviewWire.d.ts +3 -2
- package/dist/hitl/planReviewWire.js +154 -50
- package/dist/hitl/replayedApproval.d.ts +9 -0
- package/dist/hitl/replayedApproval.js +139 -10
- package/dist/hitl/resumeRunningCard.d.ts +2 -0
- package/dist/hitl/resumeRunningCard.js +15 -4
- package/dist/hitl/sessionPolicyDeliverable.js +8 -6
- package/dist/hitl/standingRows.d.ts +18 -0
- package/dist/hitl/standingRows.js +127 -0
- package/dist/hitl/toolApprovalWire.d.ts +39 -7
- package/dist/hitl/toolApprovalWire.js +351 -61
- package/dist/hookMatcherVerdict.d.ts +1 -9
- package/dist/hookMatcherVerdict.js +21 -61
- package/dist/hooksWireCaps.js +40 -8
- package/dist/host.d.ts +5 -0
- package/dist/host.js +3 -1
- package/dist/hostCallbackGuard.d.ts +2 -0
- package/dist/hostCallbackGuard.js +31 -0
- package/dist/index.d.ts +48 -17
- package/dist/index.js +36 -15
- package/dist/interactiveInterrupt.d.ts +8 -0
- package/dist/interactiveInterrupt.js +54 -0
- package/dist/limitsWire.d.ts +5 -0
- package/dist/limitsWire.js +49 -3
- package/dist/liveModelCatalog.d.ts +95 -0
- package/dist/liveModelCatalog.js +297 -32
- 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 -5
- package/dist/mcpProbeCapability.js +2 -12
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +10 -5
- package/dist/memoryComplianceCapability.d.ts +0 -5
- package/dist/memoryComplianceCapability.js +2 -12
- package/dist/memoryOriginCapability.d.ts +0 -5
- package/dist/memoryOriginCapability.js +2 -12
- package/dist/memorySpecWire.js +2 -2
- 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 +2 -2
- package/dist/modelIdentityResolvability.js +14 -12
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/noticePresentation.d.ts +68 -0
- package/dist/noticePresentation.js +247 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +0 -2
- package/dist/outputStyleSeatCapability.js +2 -10
- package/dist/ownKey.d.ts +8 -0
- package/dist/ownKey.js +66 -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/peerFrames.js +13 -9
- package/dist/peerLaneCapability.d.ts +0 -1
- package/dist/peerLaneCapability.js +2 -6
- package/dist/permissionModesCapability.d.ts +0 -5
- package/dist/permissionModesCapability.js +5 -16
- package/dist/permissionRuleIssue.js +0 -3
- package/dist/permissionRulesWriteCapability.d.ts +0 -1
- package/dist/permissionRulesWriteCapability.js +2 -6
- package/dist/permissionsAllowGrantCapability.d.ts +0 -1
- package/dist/permissionsAllowGrantCapability.js +3 -9
- package/dist/permissionsDeclaration.d.ts +8 -0
- package/dist/permissionsDeclaration.js +101 -41
- package/dist/printPermissionOutcome.d.ts +12 -0
- package/dist/printPermissionOutcome.js +50 -0
- package/dist/printToolResultFrame.d.ts +1 -0
- package/dist/printToolResultFrame.js +5 -17
- package/dist/promptBlockedCopy.d.ts +5 -0
- package/dist/promptBlockedCopy.js +35 -0
- package/dist/promptDelivery.js +0 -8
- package/dist/protocolSegment.d.ts +9 -6
- package/dist/protocolSegment.js +31 -21
- package/dist/providerRejection.d.ts +4 -0
- package/dist/providerRejection.js +75 -14
- package/dist/replayBody.d.ts +12 -0
- package/dist/replayBody.js +25 -0
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +127 -32
- package/dist/retryStatus.d.ts +9 -1
- package/dist/retryStatus.js +9 -2
- package/dist/rewindArchiveCapability.d.ts +5 -14
- package/dist/rewindArchiveCapability.js +18 -61
- package/dist/rewindArchiveReading.d.ts +15 -0
- package/dist/rewindArchiveReading.js +56 -0
- 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/ruleCompileVerdict.d.ts +9 -1
- package/dist/ruleCompileVerdict.js +29 -4
- package/dist/runTerminal.d.ts +15 -12
- package/dist/runTerminal.js +60 -35
- package/dist/sandboxWire.js +13 -0
- package/dist/sdkRegistryTransit.d.ts +2 -1
- package/dist/sdkRegistryTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +0 -5
- package/dist/sealedKeyCapability.js +3 -15
- package/dist/seam.js +4 -2
- package/dist/seatContract.d.ts +125 -34
- package/dist/seatContract.js +583 -179
- 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 +2 -6
- package/dist/sessionReadRedactionCapability.d.ts +0 -5
- package/dist/sessionReadRedactionCapability.js +2 -13
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +66 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -2
- package/dist/sessionSyncFileHistoryCapability.js +2 -9
- package/dist/skillToolListsCapability.d.ts +0 -2
- package/dist/skillToolListsCapability.js +2 -9
- package/dist/skillsWireCaps.d.ts +4 -0
- package/dist/skillsWireCaps.js +66 -1
- package/dist/sqlEngineCapability.d.ts +0 -1
- package/dist/sqlEngineCapability.js +9 -14
- package/dist/steerPriorityCapability.d.ts +0 -2
- package/dist/steerPriorityCapability.js +3 -12
- package/dist/storePostureCapability.d.ts +1 -5
- package/dist/storePostureCapability.js +16 -22
- package/dist/streamDrainingLegs.d.ts +6 -0
- package/dist/streamDrainingLegs.js +23 -0
- package/dist/subagent/engineCompactWire.js +13 -38
- 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/engineSubagentSteer.js +7 -5
- package/dist/subagent/engineSubagentTail.d.ts +0 -1
- package/dist/subagent/engineSubagentTail.js +7 -32
- package/dist/subagentContentStore.js +7 -18
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +15 -14
- package/dist/systemReminderTag.d.ts +1 -0
- package/dist/systemReminderTag.js +8 -0
- package/dist/terminalStatuses.d.ts +30 -0
- package/dist/terminalStatuses.js +67 -0
- package/dist/toolHistoryMismatch.d.ts +0 -3
- package/dist/toolHistoryMismatch.js +3 -7
- package/dist/toolResult.d.ts +6 -1
- package/dist/toolResult.js +90 -37
- package/dist/toolResultContent.d.ts +2 -0
- package/dist/toolResultContent.js +63 -0
- package/dist/types/engineState.d.ts +2 -1
- package/dist/usageAnalytics.d.ts +146 -0
- package/dist/usageAnalytics.js +335 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -2
- package/dist/userInvokedSkillsCapability.js +2 -9
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +3 -7
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireErrorTriage.d.ts +2 -0
- package/dist/wireErrorTriage.js +34 -5
- package/dist/wireFailureShape.d.ts +23 -2
- package/dist/wireFailureShape.js +88 -43
- package/dist/wireRefusalCopy.js +2 -18
- package/dist/workflowClient.js +7 -11
- package/dist/workflowsJournalCapability.d.ts +0 -1
- package/dist/workflowsJournalCapability.js +2 -6
- package/dist/writeProtectionCapability.d.ts +0 -1
- package/dist/writeProtectionCapability.js +5 -10
- package/docs/INTEGRATION-CLIENTS.md +2279 -27
- package/package.json +5 -5
- package/dist/engineCapsGenerationGuard.d.ts +0 -4
- package/dist/engineCapsGenerationGuard.js +0 -19
- 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
|
@@ -4,9 +4,11 @@ import { putOwnKey, readFrameStringKey } from '../../ownKey.js';
|
|
|
4
4
|
import { REDACTION_MARKER_PREFIX, washCredentials } from '../../displayUntrusted.js';
|
|
5
5
|
import { readEffectiveReasoning, readEffectiveMemoryScopes } from '../../effectiveFacts.js';
|
|
6
6
|
import { isReviewPark, readRunTerminal, runTerminalCode, runTerminalGateToolName, } from '../../runTerminal.js';
|
|
7
|
+
import { doneResultView } from '../../replayBody.js';
|
|
7
8
|
import { toCcModelUsage } from './turnUsageToModelUsage.js';
|
|
8
9
|
import { LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, OUTPUT_INVALID, isCorruptSessionCode, isRewindFamilyCode, } from '../../engineErrorCodes.js';
|
|
9
10
|
import { corruptSessionContent } from '../../corruptSessionCopy.js';
|
|
11
|
+
import { runBlockedText } from '../../promptBlockedCopy.js';
|
|
10
12
|
import { abortCauseNoteOf, readAbortCause } from '../../runCancelContext.js';
|
|
11
13
|
function withTerminalNote(text, code, frame) {
|
|
12
14
|
const withCorrupt = isCorruptSessionCode(code) ? `${text}\n${corruptSessionContent()}` : text;
|
|
@@ -79,6 +81,11 @@ function permissionDenialParts(stats, observed) {
|
|
|
79
81
|
const hr = stats?.humanReview;
|
|
80
82
|
const gatesRaw = hr !== null && typeof hr === 'object' ? hr.gates : undefined;
|
|
81
83
|
const denials = [];
|
|
84
|
+
const mergedKindOf = (callId) => (denialKindByCallId?.has(callId) === true ? denialKindByCallId.get(callId) : undefined);
|
|
85
|
+
const settledAsAbort = (callId) => {
|
|
86
|
+
const k = mergedKindOf(callId);
|
|
87
|
+
return isCcToolDenialKind(k) && !isCcToolDenialKindADenial(k);
|
|
88
|
+
};
|
|
82
89
|
const gates = Array.isArray(gatesRaw) ? gatesRaw : [];
|
|
83
90
|
let complete = Array.isArray(gatesRaw);
|
|
84
91
|
for (const g of gates) {
|
|
@@ -100,6 +107,8 @@ function permissionDenialParts(stats, observed) {
|
|
|
100
107
|
const toolName = nonEmptyStr(row.toolName);
|
|
101
108
|
const toolArg = nonEmptyStr(row.toolArg);
|
|
102
109
|
const toolUseId = nonEmptyStr(row.toolCallId);
|
|
110
|
+
if (toolUseId !== undefined && settledAsAbort(toolUseId))
|
|
111
|
+
continue;
|
|
103
112
|
const rawInput = row.toolInput;
|
|
104
113
|
const ledgerInput = rawInput !== null && typeof rawInput === 'object' && !Array.isArray(rawInput)
|
|
105
114
|
? rawInput
|
|
@@ -151,9 +160,9 @@ function permissionDenialParts(stats, observed) {
|
|
|
151
160
|
for (const [callId, toolNameRaw] of deniedToolNameByCallId) {
|
|
152
161
|
if (typeof callId !== 'string' || callId.length === 0 || ledgerDeniedIds.has(callId))
|
|
153
162
|
continue;
|
|
154
|
-
|
|
155
|
-
if (isCcToolDenialKind(mergedKind) && !isCcToolDenialKindADenial(mergedKind))
|
|
163
|
+
if (settledAsAbort(callId))
|
|
156
164
|
continue;
|
|
165
|
+
const mergedKind = mergedKindOf(callId);
|
|
157
166
|
if (ledgerHasIdlessDenial) {
|
|
158
167
|
complete = false;
|
|
159
168
|
continue;
|
|
@@ -178,7 +187,8 @@ function permissionDenialParts(stats, observed) {
|
|
|
178
187
|
complete = false;
|
|
179
188
|
}
|
|
180
189
|
const ccList = denials.filter((d) => d.tool_name !== undefined && d.tool_use_id !== undefined && d.tool_input !== undefined);
|
|
181
|
-
const
|
|
190
|
+
const streamCoversRun = observed?.streamSawRunOpen === true && observed.deniedToolNameByCallId !== undefined;
|
|
191
|
+
const claimable = complete && ccList.length === denials.length && streamCoversRun;
|
|
182
192
|
const zeroOutputDenied = denials.length > 0 && observed?.streamSawRunOpen === true && observed.successfulToolEndObserved === false;
|
|
183
193
|
return {
|
|
184
194
|
permission_denials: ccList,
|
|
@@ -511,14 +521,16 @@ function errorResult(ctx, parts) {
|
|
|
511
521
|
});
|
|
512
522
|
}
|
|
513
523
|
export function doneToSdkResult(ev, ctx, observed) {
|
|
514
|
-
const
|
|
524
|
+
const view = doneResultView(ev.result);
|
|
525
|
+
const rRaw = view.engine;
|
|
515
526
|
const rec = typeof rRaw === 'object' && rRaw !== null ? rRaw : {};
|
|
516
527
|
const r = rec;
|
|
517
528
|
const stats = r.stats;
|
|
518
|
-
const
|
|
529
|
+
const nestedSid = r.sessionId;
|
|
530
|
+
const echoedSid = typeof nestedSid === 'string' && nestedSid.length > 0 ? nestedSid : view.row?.sessionId;
|
|
519
531
|
if (typeof echoedSid === 'string' && echoedSid.length > 0)
|
|
520
532
|
ctx.sessionId = echoedSid;
|
|
521
|
-
const terminal = readRunTerminal(
|
|
533
|
+
const terminal = readRunTerminal(ev.result);
|
|
522
534
|
const durationMs = elapsedMs(ctx);
|
|
523
535
|
const errorCode = runTerminalCode(terminal);
|
|
524
536
|
const degraded = degradedOf(r);
|
|
@@ -548,15 +560,10 @@ export function doneToSdkResult(ev, ctx, observed) {
|
|
|
548
560
|
});
|
|
549
561
|
}
|
|
550
562
|
if (terminal?.kind === 'blocked') {
|
|
551
|
-
const blockedReason = terminal.reason;
|
|
552
563
|
return errorResult(ctx, {
|
|
553
564
|
...errorBase,
|
|
554
565
|
subtype: 'error_during_execution',
|
|
555
|
-
errors: [
|
|
556
|
-
blockedReason !== undefined
|
|
557
|
-
? `Run blocked: ${blockedReason}`
|
|
558
|
-
: 'Run blocked (the agent reported it cannot proceed)',
|
|
559
|
-
],
|
|
566
|
+
errors: [runBlockedText(terminal)],
|
|
560
567
|
});
|
|
561
568
|
}
|
|
562
569
|
if (terminal?.kind === 'paused') {
|
|
@@ -3,13 +3,15 @@ import { eventToSdkMessage, turnEndUsage } from './downstream/eventToSdkMessage.
|
|
|
3
3
|
import { turnUsageToModelUsage } from './downstream/turnUsageToModelUsage.js';
|
|
4
4
|
import { readRunCostFacts, terminalToSdkResult, TOOL_INPUT_JOIN_MAX_CALLS } from './downstream/terminalToSdkResult.js';
|
|
5
5
|
import { coerceOutput, publishSubagentContentEvent } from '../subagentContentStore.js';
|
|
6
|
-
import {
|
|
6
|
+
import { OUTPUT_INVALID, activeRunBusyCarrierOf, classifyActiveRunBusy, isCorruptSessionCode, isLimitsExceededCode } from '../engineErrorCodes.js';
|
|
7
|
+
import { doneResultView } from '../replayBody.js';
|
|
7
8
|
import { corruptSessionContent } from '../corruptSessionCopy.js';
|
|
8
9
|
import { abortCauseNoteOf } from '../runCancelContext.js';
|
|
9
10
|
import { classifyToolHistoryMismatch, noteToolHistoryTerminal, openToolHistoryGeneration, TOOL_HISTORY_REWIND_SENTENCE, toolHistoryMismatchRowKey, toolHistoryRepeatSentence, toolHistoryRewindOffered, } from '../toolHistoryMismatch.js';
|
|
10
11
|
import { isReviewPark, readRunTerminal, runTerminalCode } from '../runTerminal.js';
|
|
11
12
|
import { providerRejectionResend } from '../providerRejection.js';
|
|
12
13
|
import { washCredentials } from '../displayUntrusted.js';
|
|
14
|
+
import { PROMPT_BLOCKED_BY_HOOK_ROW_LEAD, runBlockedText } from '../promptBlockedCopy.js';
|
|
13
15
|
import { ccToolDenialKindForToolEnd, gateDeniedBy, gateOutcomeOf } from '../gateOutcome.js';
|
|
14
16
|
import { resumeReopenContent, resumeReopenFromError, suspendedReopenOf } from '../hitl/suspendedReopen.js';
|
|
15
17
|
import { isCcToolDenialKind, isCcToolDenialKindADenial, isGateDeniedByWord } from '../gateVocabulary.js';
|
|
@@ -52,30 +54,10 @@ export function pendingGateIsProvablyDifferent(prev, next) {
|
|
|
52
54
|
return a !== b;
|
|
53
55
|
}
|
|
54
56
|
export function activeRunBusySignal(ev) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const type = ev.type;
|
|
58
|
-
let carrier;
|
|
59
|
-
if (type === 'done') {
|
|
60
|
-
const result = ev.result;
|
|
61
|
-
if (typeof result !== 'object' || result === null)
|
|
62
|
-
return null;
|
|
63
|
-
if (result.status !== 'failed')
|
|
64
|
-
return null;
|
|
65
|
-
carrier = result;
|
|
66
|
-
}
|
|
67
|
-
else if (type === 'failed') {
|
|
68
|
-
carrier = ev;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
const cls = classifyActiveRunBusy({
|
|
74
|
-
errorCode: typeof carrier.errorCode === 'string' ? carrier.errorCode : undefined,
|
|
75
|
-
activeTaskId: carrier.activeTaskId,
|
|
76
|
-
});
|
|
77
|
-
if (!cls.busy)
|
|
57
|
+
const read = busyReadOfFrame(ev);
|
|
58
|
+
if (read === null || !read.cls.busy)
|
|
78
59
|
return null;
|
|
60
|
+
const { carrier, cls } = read;
|
|
79
61
|
const status = carrier.activeTaskStatus;
|
|
80
62
|
const rawGate = carrier.pendingGate;
|
|
81
63
|
let pendingGate = null;
|
|
@@ -99,19 +81,22 @@ export function activeRunBusySignal(ev) {
|
|
|
99
81
|
...(typeof msIdle === 'number' && Number.isFinite(msIdle) && msIdle >= 0 ? { msSinceLastActivity: msIdle } : {}),
|
|
100
82
|
};
|
|
101
83
|
}
|
|
102
|
-
function
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
84
|
+
function busyReadOfFrame(ev, doneTerminal, preReadActiveTaskId) {
|
|
85
|
+
const carrier = activeRunBusyCarrierOf(ev);
|
|
86
|
+
if (carrier === null)
|
|
87
|
+
return null;
|
|
88
|
+
const isDone = ev.type === 'done';
|
|
89
|
+
const terminal = isDone ? (doneTerminal !== undefined ? doneTerminal : readRunTerminal(ev.result)) : null;
|
|
90
|
+
const flatCode = typeof carrier.errorCode === 'string' ? carrier.errorCode : undefined;
|
|
91
|
+
const activeTaskId = preReadActiveTaskId !== undefined ? preReadActiveTaskId.value : carrier.activeTaskId;
|
|
92
|
+
const cls = classifyActiveRunBusy({ errorCode: (isDone ? runTerminalCode(terminal) : undefined) ?? flatCode, activeTaskId });
|
|
93
|
+
return { carrier, cls };
|
|
109
94
|
}
|
|
110
95
|
export const RUN_STOPPED_MESSAGE_PREFIX = 'Run stopped';
|
|
111
96
|
export const RUN_BLOCKED_MESSAGE_PREFIX = 'Run blocked';
|
|
112
97
|
export function isGovernanceStopRowText(text) {
|
|
113
98
|
const t = text.trimStart();
|
|
114
|
-
return t.startsWith(`${RUN_STOPPED_MESSAGE_PREFIX}:`) || t.startsWith(`${RUN_BLOCKED_MESSAGE_PREFIX}`);
|
|
99
|
+
return t.startsWith(`${RUN_STOPPED_MESSAGE_PREFIX}:`) || t.startsWith(`${RUN_BLOCKED_MESSAGE_PREFIX}`) || t.startsWith(PROMPT_BLOCKED_BY_HOOK_ROW_LEAD);
|
|
115
100
|
}
|
|
116
101
|
export const MODEL_OUTPUT_ERROR_PREFIX = 'Model output error';
|
|
117
102
|
export function isModelOutputErrorText(text) {
|
|
@@ -132,13 +117,17 @@ function syntheticTerminalRow(ctx, text, historyKey, resend) {
|
|
|
132
117
|
parent_tool_use_id: null,
|
|
133
118
|
_sema_api_error_message: true,
|
|
134
119
|
...(historyKey !== undefined ? { _sema_tool_history_mismatch: historyKey } : {}),
|
|
135
|
-
...(resend !== undefined ? { _sema_provider_rejection_resend: { resend: resend.resend, text: resend.text } } : {}),
|
|
120
|
+
...(resend !== undefined ? { _sema_provider_rejection_resend: { resend: resend.resend, text: resend.text, kind: resend.kind } } : {}),
|
|
136
121
|
});
|
|
137
122
|
}
|
|
138
123
|
function engineRunIdOf(result) {
|
|
139
124
|
const v = result?.runId;
|
|
140
125
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
141
126
|
}
|
|
127
|
+
function engineResultOf(result) {
|
|
128
|
+
const v = doneResultView(result);
|
|
129
|
+
return v.replay ? (v.engine ?? result) : result;
|
|
130
|
+
}
|
|
142
131
|
function engineSessionIdOf(result) {
|
|
143
132
|
const v = result?.sessionId;
|
|
144
133
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
@@ -160,19 +149,14 @@ function terminalRowFacts(ev) {
|
|
|
160
149
|
: doneTerminal?.kind === 'failed'
|
|
161
150
|
? (doneTerminal.message ?? doneTerminal.code ?? 'run failed')
|
|
162
151
|
: doneTerminal?.kind === 'blocked'
|
|
163
|
-
? (doneTerminal
|
|
164
|
-
? `Run blocked: ${doneTerminal.reason}`
|
|
165
|
-
: 'Run blocked (the agent reported it cannot proceed)')
|
|
152
|
+
? runBlockedText(doneTerminal)
|
|
166
153
|
: null;
|
|
167
154
|
const errText = errTextRaw === '' ? null : errTextRaw;
|
|
168
155
|
if (errText === null)
|
|
169
156
|
return { doneTerminal, errText, activeTaskId: undefined, busy: { busy: false, handle: null }, governance: false };
|
|
170
157
|
const activeTaskId = (ev.type === 'done' ? ev.result?.activeTaskId : undefined) ??
|
|
171
158
|
(ev.type === 'failed' ? ev.activeTaskId : undefined);
|
|
172
|
-
const busy =
|
|
173
|
-
errorCode: ev.type === 'failed' ? ev.errorCode : runTerminalCode(doneTerminal),
|
|
174
|
-
activeTaskId,
|
|
175
|
-
});
|
|
159
|
+
const busy = busyReadOfFrame(ev, doneTerminal, { value: activeTaskId })?.cls ?? { busy: false, handle: null };
|
|
176
160
|
const governance = isGovernanceTerminal({
|
|
177
161
|
status: ev.type === 'failed' ? undefined : doneTerminal?.kind === 'blocked' ? 'blocked' : undefined,
|
|
178
162
|
errorCode: ev.type === 'failed' ? ev.errorCode : runTerminalCode(doneTerminal),
|
|
@@ -283,7 +267,7 @@ function apiErrorTerminalFromFacts(x, facts) {
|
|
|
283
267
|
return none();
|
|
284
268
|
if (type === 'failed')
|
|
285
269
|
return { carrier: mintToolHistoryCarrier(nonEmptyStr(ownDataBit(x, 'errorCode')), undefined, nonEmptyStr(ownDataBit(x, 'errorMessage'))), detail: undefined };
|
|
286
|
-
const result = type === 'done' ? plainObjectOf(ownDataBit(x, 'result')) : x;
|
|
270
|
+
const result = type === 'done' ? plainObjectOf(engineResultOf(ownDataBit(x, 'result'))) : x;
|
|
287
271
|
if (result === undefined)
|
|
288
272
|
return none();
|
|
289
273
|
const snap = ownTerminalSnapshot(result);
|
|
@@ -666,12 +650,12 @@ async function* runStreamInner(events, ctx, handle = {}) {
|
|
|
666
650
|
const abortNote = abortCauseNoteOf(ev);
|
|
667
651
|
const historyTerminal = apiErrorTerminalOfRowFrame(ev, rowFacts);
|
|
668
652
|
const historyMismatch = classifyToolHistoryMismatch(historyTerminal.carrier);
|
|
669
|
-
const historyEchoedSid = ev.type === 'done' ? engineSessionIdOf(ev.result) : undefined;
|
|
653
|
+
const historyEchoedSid = ev.type === 'done' ? engineSessionIdOf(engineResultOf(ev.result)) : undefined;
|
|
670
654
|
const historyRepeat = noteToolHistoryTerminal({
|
|
671
655
|
sessionId: historyEchoedSid ?? ctx.sessionId,
|
|
672
656
|
sessionEchoed: historyEchoedSid !== undefined,
|
|
673
657
|
generation: historyGeneration,
|
|
674
|
-
runId: ev.type === 'done' ? engineRunIdOf(ev.result) : undefined,
|
|
658
|
+
runId: ev.type === 'done' ? engineRunIdOf(engineResultOf(ev.result)) : undefined,
|
|
675
659
|
replay: ev.type === 'done' && ev.replay === true,
|
|
676
660
|
mismatch: historyMismatch,
|
|
677
661
|
});
|
|
@@ -684,12 +668,12 @@ async function* runStreamInner(events, ctx, handle = {}) {
|
|
|
684
668
|
yield syntheticTerminalRow(ctx, `${sessionUnreadable ? `${rowText}\n${corruptSessionContent()}` : rowText}${abortNote !== undefined ? `\n${abortNote}` : ''}${rewindLine}${resendLine}`, historyMismatch === null ? undefined : toolHistoryMismatchRowKey(historyMismatch, historyRepeat, rewindOffered), resend);
|
|
685
669
|
}
|
|
686
670
|
else {
|
|
687
|
-
const echoedSid = ev.type === 'done' ? engineSessionIdOf(ev.result) : undefined;
|
|
671
|
+
const echoedSid = ev.type === 'done' ? engineSessionIdOf(engineResultOf(ev.result)) : undefined;
|
|
688
672
|
noteToolHistoryTerminal({
|
|
689
673
|
sessionId: echoedSid ?? ctx.sessionId,
|
|
690
674
|
sessionEchoed: echoedSid !== undefined,
|
|
691
675
|
generation: historyGeneration,
|
|
692
|
-
runId: ev.type === 'done' ? engineRunIdOf(ev.result) : undefined,
|
|
676
|
+
runId: ev.type === 'done' ? engineRunIdOf(engineResultOf(ev.result)) : undefined,
|
|
693
677
|
replay: ev.type === 'done' && ev.replay === true,
|
|
694
678
|
mismatch: null,
|
|
695
679
|
});
|
|
@@ -701,7 +685,7 @@ async function* runStreamInner(events, ctx, handle = {}) {
|
|
|
701
685
|
catch { }
|
|
702
686
|
}
|
|
703
687
|
if (ev.type === 'done' && ctx.emitChrome) {
|
|
704
|
-
const doneStats = ev.result?.stats;
|
|
688
|
+
const doneStats = engineResultOf(ev.result)?.stats;
|
|
705
689
|
const costFacts = readRunCostFacts(doneStats, { usageMissingObserved });
|
|
706
690
|
if (costFacts !== undefined) {
|
|
707
691
|
emitChromeFireAndForget(ctx, { kind: 'run_cost_reconciled', laneProof: mainLane(), ...costFacts.reconcile });
|
package/dist/adapter/types.d.ts
CHANGED
|
@@ -31,6 +31,13 @@ export declare function stamp<T extends {
|
|
|
31
31
|
uuid: string;
|
|
32
32
|
session_id: string;
|
|
33
33
|
};
|
|
34
|
+
export interface ToolUseSideChannelsStripped<B extends object> {
|
|
35
|
+
readonly block: Omit<B, 'label' | 'eventId' | 'parentToolCallId'>;
|
|
36
|
+
readonly eventId?: string;
|
|
37
|
+
readonly parentToolCallId?: string;
|
|
38
|
+
readonly label?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare function stripToolUseSideChannels<B extends object>(block: B): ToolUseSideChannelsStripped<B>;
|
|
34
41
|
export declare const SEGMENT_END_IDENTITY_KEYS: readonly ["parentToolCallId", "sourceTaskId", "bgAgentId"];
|
|
35
42
|
export declare function isSubFlowSegmentEnd(m: object): boolean;
|
|
36
43
|
export declare function snapshotSegmentIdentity(m: object): Record<string, unknown> | null;
|
package/dist/adapter/types.js
CHANGED
|
@@ -14,6 +14,21 @@ export function uuid() {
|
|
|
14
14
|
export function stamp(ctx, body) {
|
|
15
15
|
return { ...body, uuid: body.uuid ?? uuid(), session_id: ctx.sessionId };
|
|
16
16
|
}
|
|
17
|
+
export function stripToolUseSideChannels(block) {
|
|
18
|
+
const out = { ...block };
|
|
19
|
+
const eventId = typeof out.eventId === 'string' ? out.eventId : undefined;
|
|
20
|
+
const parentToolCallId = typeof out.parentToolCallId === 'string' ? out.parentToolCallId : undefined;
|
|
21
|
+
const label = typeof out.label === 'string' ? out.label : undefined;
|
|
22
|
+
delete out.label;
|
|
23
|
+
delete out.eventId;
|
|
24
|
+
delete out.parentToolCallId;
|
|
25
|
+
return {
|
|
26
|
+
block: out,
|
|
27
|
+
...(eventId !== undefined ? { eventId } : {}),
|
|
28
|
+
...(parentToolCallId !== undefined ? { parentToolCallId } : {}),
|
|
29
|
+
...(label !== undefined ? { label } : {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
17
32
|
export const SEGMENT_END_IDENTITY_KEYS = Object.freeze(['parentToolCallId', 'sourceTaskId', 'bgAgentId']);
|
|
18
33
|
export function isSubFlowSegmentEnd(m) {
|
|
19
34
|
const rec = m;
|
|
@@ -157,7 +157,11 @@ export function createBackgroundView(client, opts) {
|
|
|
157
157
|
}
|
|
158
158
|
catch (err) {
|
|
159
159
|
debugLog(`assistant.tasks degrade: ${String(err)}`);
|
|
160
|
-
const health = capsApprovals === false || isNotImplemented(err)
|
|
160
|
+
const health = capsApprovals === false || isNotImplemented(err)
|
|
161
|
+
? 'not-configured'
|
|
162
|
+
: isReadCredentialRefusal(err)
|
|
163
|
+
? 'unauthorized'
|
|
164
|
+
: 'unavailable';
|
|
161
165
|
return { health, tasks: [] };
|
|
162
166
|
}
|
|
163
167
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { errCodes } from '../controlRouter.js';
|
|
2
2
|
import { hostLog } from '../host.js';
|
|
3
|
+
import { isSessionIdPathSegment } from '../sessionIdSegment.js';
|
|
4
|
+
import { ownDataField } from '../ownKey.js';
|
|
3
5
|
const unavailable = (why) => ({
|
|
4
6
|
kind: 'unavailable',
|
|
5
7
|
why,
|
|
@@ -57,12 +59,12 @@ export function isEngineAgentRegistryListingSuperseded(listing) {
|
|
|
57
59
|
return registryListingProvenanceOf(listing)?.superseded === true;
|
|
58
60
|
}
|
|
59
61
|
function listFaceOn(caps) {
|
|
60
|
-
if (typeof caps !== 'object' || caps === null
|
|
62
|
+
if (typeof caps !== 'object' || caps === null)
|
|
61
63
|
return false;
|
|
62
|
-
const bg = caps
|
|
63
|
-
if (typeof bg !== 'object' || bg === null
|
|
64
|
+
const bg = ownDataField(caps, 'background');
|
|
65
|
+
if (typeof bg !== 'object' || bg === null)
|
|
64
66
|
return false;
|
|
65
|
-
return bg
|
|
67
|
+
return ownDataField(bg, 'listFace') === true;
|
|
66
68
|
}
|
|
67
69
|
function readRow(v) {
|
|
68
70
|
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
@@ -95,7 +97,7 @@ export async function readEngineAgentRegistry(client, sessionId, caps, opts) {
|
|
|
95
97
|
async function readOnce(client, sessionId, caps, opts) {
|
|
96
98
|
if (!listFaceOn(caps))
|
|
97
99
|
return unavailable('no_list_face');
|
|
98
|
-
if (
|
|
100
|
+
if (!isSessionIdPathSegment(sessionId)) {
|
|
99
101
|
noteReadFailed('bad session id');
|
|
100
102
|
return unavailable('read_failed');
|
|
101
103
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { engineCapNestedValue } from '../engineCapsCache.js';
|
|
2
2
|
import { isStatusDerivedCoarseCode } from '../engineErrorCodes.js';
|
|
3
3
|
import { clientHasVerbs, engineWireFor, INJECTED_WIRE_SETTLE_MS, noAnswerDetailFrom, sendOnce, settleInjected } from '../engineWireFor.js';
|
|
4
4
|
import { engineWireDebugEnabled } from '../engineWireTarget.js';
|
|
5
5
|
import { hostLog } from '../host.js';
|
|
6
|
+
import { isSessionIdPathSegment } from '../sessionIdSegment.js';
|
|
6
7
|
import { wireFailureTextsOf } from '../wireFailureShape.js';
|
|
7
8
|
import { DEFAULT_SESSION_KEY } from '../sessionSlot.js';
|
|
8
9
|
const NOTHING_SENT = ' — nothing sent';
|
|
9
|
-
const DETAIL_BAD_SESSION = `the session id must be a non-empty string${NOTHING_SENT}`;
|
|
10
|
+
const DETAIL_BAD_SESSION = `the session id must be a non-empty string that is not a dot segment${NOTHING_SENT}`;
|
|
10
11
|
const DETAIL_BAD_INCLUDE_RETAINED = `includeRetained must be true or false (the engine has no default for it)${NOTHING_SENT}`;
|
|
11
12
|
const DETAIL_BAD_OPTIONS = `the options could not be read${NOTHING_SENT}`;
|
|
12
13
|
const DETAIL_BAD_ARGUMENTS = `the arguments could not be read${NOTHING_SENT}`;
|
|
@@ -17,6 +18,8 @@ const DETAIL_NO_TARGET = `no engine connection is installed for this session${NO
|
|
|
17
18
|
const DETAIL_NO_CLIENT = `an engine client could not be built from the installed connection${NOTHING_SENT}`;
|
|
18
19
|
const DETAIL_CAPS_KEY_REQUIRED = `capability evidence for background.exitFaces is not available under the key the host named (capsBaseUrl)${NOTHING_SENT}`;
|
|
19
20
|
const DETAIL_CAPS_UNOBSERVED = `the engine capabilities have not been read for this connection yet — wait for the capability probe to settle, then call again${NOTHING_SENT}`;
|
|
21
|
+
const DETAIL_CAPS_UNREADABLE = `the engine reported its capabilities in a form this client cannot read, so whether it offers the session background stop is unknown — calling again on this connection will not change that${NOTHING_SENT}`;
|
|
22
|
+
const DETAIL_CAPS_UNKNOWN_GENERIC = `whether the engine offers the session background stop is unknown${NOTHING_SENT}`;
|
|
20
23
|
const DETAIL_NO_EXIT_FACE = `this engine does not offer the session background stop (capabilities.background.exitFaces is not true); background tasks may keep running${NOTHING_SENT}`;
|
|
21
24
|
function refusedDetail(why) {
|
|
22
25
|
switch (why) {
|
|
@@ -66,22 +69,27 @@ function unavailable(why, detail) {
|
|
|
66
69
|
function usableStopClient(client) {
|
|
67
70
|
return clientHasVerbs(client, [['sessions', 'backgroundStop']]);
|
|
68
71
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
return { why: 'capability_unknown', detail: DETAIL_CAPS_UNOBSERVED };
|
|
72
|
+
function capsUnknownDetail(reason) {
|
|
73
|
+
switch (reason) {
|
|
74
|
+
case 'unobserved':
|
|
75
|
+
return DETAIL_CAPS_UNOBSERVED;
|
|
76
|
+
case 'unreadable':
|
|
77
|
+
return DETAIL_CAPS_UNREADABLE;
|
|
78
|
+
default: {
|
|
79
|
+
const unreachable = reason;
|
|
80
|
+
void unreachable;
|
|
81
|
+
return DETAIL_CAPS_UNKNOWN_GENERIC;
|
|
82
|
+
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
function exitFaceGate(capsKey) {
|
|
86
|
+
const v = engineCapNestedValue(capsKey, 'background', 'exitFaces');
|
|
87
|
+
if (v.kind === 'unobserved')
|
|
88
|
+
return { why: 'capability_unknown', detail: capsUnknownDetail('unobserved') };
|
|
89
|
+
if (v.kind === 'unreadable')
|
|
90
|
+
return { why: 'capability_unknown', detail: capsUnknownDetail('unreadable') };
|
|
91
|
+
return v.kind === 'value' && v.value === true ? null : { why: 'no_exit_face', detail: DETAIL_NO_EXIT_FACE };
|
|
92
|
+
}
|
|
85
93
|
function readReceipt(v) {
|
|
86
94
|
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
87
95
|
return undefined;
|
|
@@ -202,7 +210,7 @@ export async function stopEngineSessionBackground(sessionId, body, opts) {
|
|
|
202
210
|
let signal;
|
|
203
211
|
let sessionKey;
|
|
204
212
|
try {
|
|
205
|
-
if (
|
|
213
|
+
if (!isSessionIdPathSegment(sessionId))
|
|
206
214
|
return unavailable('bad_input', DETAIL_BAD_SESSION);
|
|
207
215
|
const flag = typeof body === 'object' && body !== null && Object.hasOwn(body, 'includeRetained') ? body.includeRetained : undefined;
|
|
208
216
|
if (typeof flag !== 'boolean')
|
package/dist/agentsWireCaps.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export type TaskAgentWireSkill = {
|
|
|
15
15
|
name: string;
|
|
16
16
|
description: string;
|
|
17
17
|
content: string;
|
|
18
|
+
allowedTools?: string[];
|
|
19
|
+
disallowedTools?: string[];
|
|
18
20
|
};
|
|
19
21
|
export declare const AGENT_MEMORY_WORDS: ReadonlySet<string>;
|
|
20
22
|
export type TaskAgentWireMemory = {
|
package/dist/agentsWireCaps.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hostEnv } from './hostEnv.js';
|
|
2
|
+
import { ownDataField } from './ownKey.js';
|
|
2
3
|
import { makeEngineWireClient } from './engineWireSdk.js';
|
|
3
4
|
import { frozenSet } from './frozenSet.js';
|
|
4
5
|
import { settleWithinDeadline } from './abortableSleep.js';
|
|
@@ -289,7 +290,7 @@ export async function engineSupportsTaskAgents(baseUrl, opts) {
|
|
|
289
290
|
if (typeof injected?.capabilities !== 'function')
|
|
290
291
|
return undefined;
|
|
291
292
|
const got = await settleWithinDeadline(opts.timeoutMs ?? 3000, (signal) => injected.capabilities({ signal }));
|
|
292
|
-
return got.kind === 'value' ? got.value
|
|
293
|
+
return got.kind === 'value' ? taskAgentsOf(got.value) : undefined;
|
|
293
294
|
}
|
|
294
295
|
const client = makeEngineWireClient({
|
|
295
296
|
baseUrl,
|
|
@@ -302,7 +303,17 @@ export async function engineSupportsTaskAgents(baseUrl, opts) {
|
|
|
302
303
|
return undefined;
|
|
303
304
|
try {
|
|
304
305
|
const caps = await client.capabilities();
|
|
305
|
-
return caps
|
|
306
|
+
return taskAgentsOf(caps);
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function taskAgentsOf(caps) {
|
|
313
|
+
if (caps === null || typeof caps !== 'object')
|
|
314
|
+
return false;
|
|
315
|
+
try {
|
|
316
|
+
return ownDataField(caps, 'taskAgents') === true;
|
|
306
317
|
}
|
|
307
318
|
catch {
|
|
308
319
|
return undefined;
|
|
@@ -12,5 +12,4 @@ export declare function noteEngineCapsForApprovalDecidedBy(baseUrl: string, caps
|
|
|
12
12
|
}): void;
|
|
13
13
|
export declare function observedApprovalDecidedBy(baseUrl?: string | undefined): ApprovalDecidedByReading;
|
|
14
14
|
export declare function approvalDecidedByAdmitted(reading: ApprovalDecidedByReading | undefined): boolean;
|
|
15
|
-
export declare function forgetApprovalDecidedByReading(baseUrl: string | undefined): void;
|
|
16
15
|
export declare function __resetApprovalDecidedByReadingsForTests(): void;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
-
import { readOwnDataValue } from './ownKey.js';
|
|
3
|
+
import { ownDataField, readOwnDataValue } from './ownKey.js';
|
|
4
4
|
export function projectApprovalDecidedByCapability(caps) {
|
|
5
5
|
try {
|
|
6
6
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
7
7
|
return undefined;
|
|
8
|
-
|
|
9
|
-
return { kind: 'not_reported' };
|
|
10
|
-
const v = caps.approvalDecidedBy;
|
|
8
|
+
const v = ownDataField(caps, 'approvalDecidedBy');
|
|
11
9
|
if (v === undefined)
|
|
12
10
|
return { kind: 'not_reported' };
|
|
13
11
|
return v === true ? { kind: 'present', value: true } : undefined;
|
|
@@ -39,9 +37,6 @@ export function approvalDecidedByAdmitted(reading) {
|
|
|
39
37
|
return false;
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
|
-
export function forgetApprovalDecidedByReading(baseUrl) {
|
|
43
|
-
reader.forget(baseUrl);
|
|
44
|
-
}
|
|
45
40
|
export function __resetApprovalDecidedByReadingsForTests() {
|
|
46
41
|
reader.__resetForTests();
|
|
47
42
|
}
|
|
@@ -13,5 +13,4 @@ export declare function noteEngineCapsForApprovalsStreamLive(baseUrl: string, ca
|
|
|
13
13
|
export declare function observedApprovalsStreamLive(baseUrl?: string | undefined): ApprovalsStreamLiveReading;
|
|
14
14
|
export declare function livePendingNeedsReconcile(reading: ApprovalsStreamLiveReading): boolean;
|
|
15
15
|
export declare function approvalsStreamLiveDoctorDetail(reading: ApprovalsStreamLiveReading): string;
|
|
16
|
-
export declare function forgetApprovalsStreamLiveReading(baseUrl: string | undefined): void;
|
|
17
16
|
export declare function __resetApprovalsStreamLiveReadingsForTests(): void;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
export function projectApprovalsStreamLiveCapability(caps) {
|
|
4
5
|
try {
|
|
5
6
|
if (caps === null || typeof caps !== 'object')
|
|
6
7
|
return undefined;
|
|
7
8
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
8
9
|
return undefined;
|
|
9
|
-
|
|
10
|
-
return { kind: 'not_reported' };
|
|
11
|
-
const v = caps.approvalsStreamLive;
|
|
10
|
+
const v = ownDataField(caps, 'approvalsStreamLive');
|
|
12
11
|
if (v === undefined)
|
|
13
12
|
return { kind: 'not_reported' };
|
|
14
13
|
if (typeof v !== 'boolean')
|
|
@@ -45,9 +44,6 @@ export function approvalsStreamLiveDoctorDetail(reading) {
|
|
|
45
44
|
: 'live approval push off on this deployment (no checkpoint store or tool approvals disabled; the engine reports one bit for both, so this client cannot tell which) — suspended asks are only visible through the reconcile cadence, so the client polls for them';
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
export function forgetApprovalsStreamLiveReading(baseUrl) {
|
|
49
|
-
reader.forget(baseUrl);
|
|
50
|
-
}
|
|
51
47
|
export function __resetApprovalsStreamLiveReadingsForTests() {
|
|
52
48
|
reader.__resetForTests();
|
|
53
49
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function atMostOnceFailureClass(e: unknown): 'rejected' | 'unknown';
|
|
2
|
+
export interface AtMostOnceVerdict {
|
|
3
|
+
readonly delivery: 'rejected' | 'unknown';
|
|
4
|
+
readonly status?: number;
|
|
5
|
+
readonly code?: string;
|
|
6
|
+
readonly name?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function atMostOnceVerdictOf(e: unknown): AtMostOnceVerdict;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { errCodes, steeringRefusedBeforeEngine, steeringStatusIs4xx } from './controlRouter.js';
|
|
2
|
+
function errorSlot(e, key) {
|
|
3
|
+
if (e === null || e === undefined)
|
|
4
|
+
return undefined;
|
|
5
|
+
try {
|
|
6
|
+
return e[key];
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function atMostOnceFailureClass(e) {
|
|
13
|
+
const s = atMostOnceSnapshotOf(e);
|
|
14
|
+
if (steeringStatusIs4xx(s))
|
|
15
|
+
return 'rejected';
|
|
16
|
+
return steeringRefusedBeforeEngine(s) !== undefined ? 'rejected' : 'unknown';
|
|
17
|
+
}
|
|
18
|
+
function atMostOnceSnapshotOf(e) {
|
|
19
|
+
return {
|
|
20
|
+
status: errorSlot(e, 'status'),
|
|
21
|
+
statusCode: errorSlot(e, 'statusCode'),
|
|
22
|
+
errorCode: errorSlot(e, 'errorCode'),
|
|
23
|
+
name: errorSlot(e, 'name'),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function atMostOnceVerdictOf(e) {
|
|
27
|
+
const snapshot = atMostOnceSnapshotOf(e);
|
|
28
|
+
const delivery = atMostOnceFailureClass(snapshot);
|
|
29
|
+
const { status, code, name } = errCodes(snapshot);
|
|
30
|
+
return {
|
|
31
|
+
delivery,
|
|
32
|
+
...(status !== undefined ? { status } : {}),
|
|
33
|
+
...(code !== undefined && code !== '' ? { code } : {}),
|
|
34
|
+
...(name !== undefined && name !== '' ? { name } : {}),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -7,5 +7,4 @@ export declare function noteEngineCapsForAttachmentSeat(baseUrl: string, caps: u
|
|
|
7
7
|
generation?: number;
|
|
8
8
|
}): void;
|
|
9
9
|
export declare function observedAttachmentSeat(baseUrl?: string | undefined): AttachmentSeatReading;
|
|
10
|
-
export declare function forgetAttachmentSeatReading(baseUrl: string | undefined): void;
|
|
11
10
|
export declare function __resetAttachmentSeatReadingsForTests(): void;
|
|
@@ -19,9 +19,6 @@ export function noteEngineCapsForAttachmentSeat(baseUrl, caps, opts) {
|
|
|
19
19
|
export function observedAttachmentSeat(baseUrl = engineWireTarget()?.baseUrl) {
|
|
20
20
|
return reader.observed(baseUrl);
|
|
21
21
|
}
|
|
22
|
-
export function forgetAttachmentSeatReading(baseUrl) {
|
|
23
|
-
reader.forget(baseUrl);
|
|
24
|
-
}
|
|
25
22
|
export function __resetAttachmentSeatReadingsForTests() {
|
|
26
23
|
reader.__resetForTests();
|
|
27
24
|
}
|
|
@@ -23,8 +23,14 @@ const OPT_IN_KEYS = [
|
|
|
23
23
|
'mcpInstructions',
|
|
24
24
|
];
|
|
25
25
|
const DEFAULT_ON_ONLY_KEYS = ['agentListing', 'skillsListing'];
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const PRODUCT_DEFAULT_KEYS = ['backgroundTasks', 'toolsDelta', 'todoReminder'];
|
|
27
|
+
function productDefaultAttachments() {
|
|
28
|
+
const out = {};
|
|
29
|
+
for (const k of PRODUCT_DEFAULT_KEYS)
|
|
30
|
+
out[k] = true;
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
const _attachmentsKeyPins = [true, true, true, true, true, true, true];
|
|
28
34
|
void _attachmentsKeyPins;
|
|
29
35
|
const TODO_REMINDER_MODES = ['baseline', 'off'];
|
|
30
36
|
export class AttachmentsSpecRefused extends TypeError {
|
|
@@ -61,11 +67,11 @@ function judgeAttachmentsEnv(raw) {
|
|
|
61
67
|
return { ok: false, refusal: { kind: 'retired_key', token, why: named.why, entry: i + 1, key: named.key, retired: named } };
|
|
62
68
|
}
|
|
63
69
|
if (tokens.length === 0)
|
|
64
|
-
return { ok: true, spec:
|
|
70
|
+
return { ok: true, spec: productDefaultAttachments() };
|
|
65
71
|
if (tokens.length === 1 && (tokens[0] === 'full' || tokens[0] === 'all'))
|
|
66
72
|
return { ok: true, spec: allLiteralTrue() };
|
|
67
73
|
if (tokens.length === 1 && !isKnownToken(tokens[0])) {
|
|
68
|
-
return { ok: true, spec:
|
|
74
|
+
return { ok: true, spec: productDefaultAttachments() };
|
|
69
75
|
}
|
|
70
76
|
const spec = {};
|
|
71
77
|
for (const [i, token] of tokens.entries()) {
|
|
@@ -74,8 +80,7 @@ function judgeAttachmentsEnv(raw) {
|
|
|
74
80
|
continue;
|
|
75
81
|
}
|
|
76
82
|
if (token === 'default') {
|
|
77
|
-
|
|
78
|
-
spec[k] = true;
|
|
83
|
+
Object.assign(spec, productDefaultAttachments());
|
|
79
84
|
continue;
|
|
80
85
|
}
|
|
81
86
|
if (token.startsWith('-')) {
|