@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
package/dist/adapt/arms.js
CHANGED
|
@@ -9,9 +9,11 @@ import { recordEngineToolLabel } from '../engineToolLabelStore.js';
|
|
|
9
9
|
import { registerSubagentAlias, registerSubagentContentAlias } from '../subagentContentStore.js';
|
|
10
10
|
import { readAsyncLaunchedAgentReceipt } from '../toolResult.js';
|
|
11
11
|
import { recordWorkflowAgentTaskId } from '../workflow.js';
|
|
12
|
-
import {
|
|
12
|
+
import { isCoreTaskNotificationTerminal, isCoreTaskNotificationTerminalNotSuccess, isCoreTaskProgressTerminal, isCoreTaskProgressTerminalNotSuccess } from '../terminalStatuses.js';
|
|
13
13
|
import { readToolHistoryMismatchKey } from '../toolHistoryMismatch.js';
|
|
14
14
|
import { readProviderRejectionResendKey } from '../providerRejection.js';
|
|
15
|
+
import { readFrameStringKey } from '../ownKey.js';
|
|
16
|
+
import { washCredentials } from '../displayUntrusted.js';
|
|
15
17
|
import { resolveEnginePanelTaskId } from '../engineAgentPanelStore.js';
|
|
16
18
|
import { fleetRowAgentType } from '../fleet/fleetRowAgentType.js';
|
|
17
19
|
import { chrome, mainLane, transcript, messageIdentityOf } from './ids.js';
|
|
@@ -126,12 +128,13 @@ const assistantArm = function* (m, { ctx, idOf, text, cards, inst }) {
|
|
|
126
128
|
}
|
|
127
129
|
const textBlock = blocks.find(b => b?.type === 'text');
|
|
128
130
|
if (textBlock && typeof textBlock.text === 'string' && textBlock.text.length > 0) {
|
|
129
|
-
|
|
131
|
+
const rowText = m._sema_api_error_message === true ? washCredentials(textBlock.text) : textBlock.text;
|
|
132
|
+
text.appendAnswer(rowText);
|
|
130
133
|
text.beginAssistantMessage();
|
|
131
134
|
yield* text.takeThinking();
|
|
132
135
|
yield transcript({
|
|
133
136
|
type: 'assistant',
|
|
134
|
-
message: { role: 'assistant', content: [{ type: 'text', text:
|
|
137
|
+
message: { role: 'assistant', content: [{ type: 'text', text: rowText }], ...messageIdentityOf(m, ctx) },
|
|
135
138
|
uuid: idOf(m),
|
|
136
139
|
session_id: ctx.sessionId,
|
|
137
140
|
parent_tool_use_id: null,
|
|
@@ -139,7 +142,7 @@ const assistantArm = function* (m, { ctx, idOf, text, cards, inst }) {
|
|
|
139
142
|
...toolHistoryKeyCarry(m),
|
|
140
143
|
...providerResendKeyCarry(m),
|
|
141
144
|
}, ctx.now());
|
|
142
|
-
text.markEmittedText(
|
|
145
|
+
text.markEmittedText(rowText);
|
|
143
146
|
}
|
|
144
147
|
const thinkingBlock = blocks.find(b => b?.type === 'thinking');
|
|
145
148
|
if (thinkingBlock && typeof thinkingBlock.thinking === 'string') {
|
|
@@ -569,7 +572,6 @@ const toolEndResultArm = function* (m, { idOf, cards, panel }) {
|
|
|
569
572
|
});
|
|
570
573
|
}
|
|
571
574
|
};
|
|
572
|
-
const TERMINAL_TICK_STATUSES = new Set(['completed', 'failed']);
|
|
573
575
|
const taskProgressArm = function* (m, { ctx, cards, panel, inst }) {
|
|
574
576
|
const taskIdRaw = m.taskId;
|
|
575
577
|
const taskId = typeof taskIdRaw === 'string' ? taskIdRaw : undefined;
|
|
@@ -658,9 +660,9 @@ const taskProgressArm = function* (m, { ctx, cards, panel, inst }) {
|
|
|
658
660
|
totalTokens: typeof usage.totalTokens === 'number' ? usage.totalTokens : 0,
|
|
659
661
|
},
|
|
660
662
|
});
|
|
661
|
-
if (
|
|
663
|
+
if (isCoreTaskProgressTerminal(m.status) && !panel.isLiveBound(taskId)) {
|
|
662
664
|
ctx.probe?.('tick', JSON.stringify({ t: ctx.now(), taskId, lane: 'foreground', settle: m.status }));
|
|
663
|
-
yield* panel.settleFromTerminalTick(taskId, m.status
|
|
665
|
+
yield* panel.settleFromTerminalTick(taskId, isCoreTaskProgressTerminalNotSuccess(m.status));
|
|
664
666
|
}
|
|
665
667
|
};
|
|
666
668
|
const streamEventArm = function* (m, { text }) {
|
|
@@ -712,9 +714,9 @@ const resultArm = function* (m, { ctx, idOf, text, cards, panel, flags }) {
|
|
|
712
714
|
return lowerBound && ot === 0 ? undefined : ot;
|
|
713
715
|
});
|
|
714
716
|
yield* text.takeAnswerSegment();
|
|
715
|
-
const salvaged = m
|
|
717
|
+
const salvaged = readFrameStringKey(m, '_sema_salvaged_result');
|
|
716
718
|
const errorEnvelope = typeof m.subtype === 'string' && m.subtype.startsWith(ERROR_SUBTYPE_PREFIX);
|
|
717
|
-
const terminalText =
|
|
719
|
+
const terminalText = salvaged !== undefined ? salvaged : !errorEnvelope && typeof m.result === 'string' ? m.result : '';
|
|
718
720
|
const committed = text.lastCommittedAnswerText;
|
|
719
721
|
const terminalIdentity = messageIdentityOf(m, ctx);
|
|
720
722
|
const emitTerminal = function* (body, tag) {
|
|
@@ -763,7 +765,7 @@ const taskNotificationArm = function* (m, { ctx, idOf, panel, inst }) {
|
|
|
763
765
|
return;
|
|
764
766
|
const taskId = fields.taskId;
|
|
765
767
|
const rawStatus = fields.status;
|
|
766
|
-
const terminal =
|
|
768
|
+
const terminal = isCoreTaskNotificationTerminal(rawStatus);
|
|
767
769
|
const settleAllowed = n.task_type === undefined || n.task_type === 'background_bash' || n.task_type === 'monitor';
|
|
768
770
|
if (settleAllowed && terminal) {
|
|
769
771
|
yield chrome({
|
|
@@ -795,7 +797,7 @@ const taskNotificationArm = function* (m, { ctx, idOf, panel, inst }) {
|
|
|
795
797
|
});
|
|
796
798
|
dropQueuedNotificationsForRun(taskId);
|
|
797
799
|
if (n.task_type !== 'background_bash' && n.task_type !== 'monitor') {
|
|
798
|
-
yield* panel.settleFromNotification(taskId, rawStatus
|
|
800
|
+
yield* panel.settleFromNotification(taskId, isCoreTaskNotificationTerminalNotSuccess(rawStatus));
|
|
799
801
|
}
|
|
800
802
|
}
|
|
801
803
|
const peerFrame = classifyPeerNotification(n);
|
package/dist/adapt/panelTasks.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { clearEnginePanelTaskResident, clearEnginePanelTaskResidentByWire, markEnginePanelTaskResident } from '../engineAgentPanelStore.js';
|
|
2
|
+
import { panelEndFact } from '../panelReduce.js';
|
|
2
3
|
import { chrome, mainLane } from './ids.js';
|
|
3
4
|
import { SUBAGENT_TOOL_NAMES } from './wireShapes.js';
|
|
4
5
|
export function createPanelTaskLedger(ctx, cards, inst) {
|
|
5
6
|
const taskCardBinding = new Map();
|
|
6
|
-
const boundToolCalls = new Set();
|
|
7
7
|
const livePanelTasks = new Set();
|
|
8
8
|
const endedPanelTasks = new Set();
|
|
9
9
|
const liveBoundPanelTasks = new Set();
|
|
@@ -33,7 +33,6 @@ export function createPanelTaskLedger(ctx, cards, inst) {
|
|
|
33
33
|
return undefined;
|
|
34
34
|
const target = parentToolCallId;
|
|
35
35
|
taskCardBinding.set(taskId, target);
|
|
36
|
-
boundToolCalls.add(target);
|
|
37
36
|
if (cards.has(target))
|
|
38
37
|
liveBoundPanelTasks.add(taskId);
|
|
39
38
|
ctx.probe?.('bind', `bind ${taskId} -> ${target} via=explicit`);
|
|
@@ -85,12 +84,7 @@ export function createPanelTaskLedger(ctx, cards, inst) {
|
|
|
85
84
|
yield chrome({
|
|
86
85
|
kind: 'panel_task',
|
|
87
86
|
laneProof: mintLane(),
|
|
88
|
-
event: {
|
|
89
|
-
kind: 'end',
|
|
90
|
-
taskId,
|
|
91
|
-
isError,
|
|
92
|
-
...(cardId !== null && report !== undefined ? { report } : {}),
|
|
93
|
-
},
|
|
87
|
+
event: panelEndFact(taskId, isError, cardId !== null && report !== undefined ? { report } : undefined),
|
|
94
88
|
});
|
|
95
89
|
}
|
|
96
90
|
},
|
|
@@ -102,7 +96,7 @@ export function createPanelTaskLedger(ctx, cards, inst) {
|
|
|
102
96
|
yield chrome({
|
|
103
97
|
kind: 'panel_task',
|
|
104
98
|
laneProof: mainLane(),
|
|
105
|
-
event:
|
|
99
|
+
event: panelEndFact(taskId, isError),
|
|
106
100
|
});
|
|
107
101
|
if (inst.hasFiredSubagentStart(taskId)) {
|
|
108
102
|
yield chrome({
|
|
@@ -144,7 +138,7 @@ export function createPanelTaskLedger(ctx, cards, inst) {
|
|
|
144
138
|
yield chrome({
|
|
145
139
|
kind: 'panel_task',
|
|
146
140
|
laneProof: mintLane(),
|
|
147
|
-
event:
|
|
141
|
+
event: panelEndFact(taskId, isError),
|
|
148
142
|
});
|
|
149
143
|
},
|
|
150
144
|
};
|
package/dist/adapt/toolCards.js
CHANGED
|
@@ -34,15 +34,15 @@ export function createToolCardLedger(ctx, idOf) {
|
|
|
34
34
|
let lastLiveTodos = [];
|
|
35
35
|
function* buildToolResult(p, end) {
|
|
36
36
|
const isError = end?.isError ?? false;
|
|
37
|
+
const parentToolCallId = end?.parentToolCallId ?? p.parentToolCallId;
|
|
37
38
|
if ((p.name === 'Bash' || p.name === 'Monitor') && !isError) {
|
|
38
39
|
const outputText = end?.output !== undefined ? flattenWireOutput(end.output) : undefined;
|
|
39
40
|
const reg = detectEngineBgShellDetach(p.name, p.rawInput, end?.structured, outputText) ??
|
|
40
41
|
detectEngineBgShellReceipt(p.name, p.rawInput, outputText, end?.structured);
|
|
41
42
|
if (reg !== null) {
|
|
42
|
-
yield chrome({ kind: 'bgshell_register', laneProof: mainLane(), taskId: reg.taskId, registration: reg });
|
|
43
|
+
yield chrome({ kind: 'bgshell_register', laneProof: parentToolCallId === undefined ? mainLane() : { lane: 'subagent', parentToolCallId }, taskId: reg.taskId, registration: reg });
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
const parentToolCallId = end?.parentToolCallId ?? p.parentToolCallId;
|
|
46
46
|
const outcome = toolResultOutcomeOf(p.name, end, p.rawInput, parentToolCallId === undefined ? 'leader' : 'subagent', (err) => {
|
|
47
47
|
if (p.name !== 'TodoWrite')
|
|
48
48
|
return null;
|
package/dist/adapt/wireShapes.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { frozenSet } from '../frozenSet.js';
|
|
2
|
+
import { stripToolUseSideChannels } from '../adapter/types.js';
|
|
2
3
|
export const FLUSH_INTERVAL_MS = 100;
|
|
3
4
|
export const IDLE_FLUSH_MS = 1500;
|
|
4
5
|
export const SUBAGENT_TOOL_NAMES = frozenSet(['Task', 'Agent', 'Fork']);
|
|
@@ -47,14 +48,8 @@ export function shortTaskLabel(task) {
|
|
|
47
48
|
return label || 'subagent';
|
|
48
49
|
}
|
|
49
50
|
export function sanitizeToolUseBlock(block) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const eventId = typeof out.eventId === 'string' ? out.eventId : undefined;
|
|
53
|
-
const parentToolCallId = typeof out.parentToolCallId === 'string' ? out.parentToolCallId : undefined;
|
|
54
|
-
const label = typeof out.label === 'string' ? out.label : undefined;
|
|
55
|
-
delete out.label;
|
|
56
|
-
delete out.eventId;
|
|
57
|
-
delete out.parentToolCallId;
|
|
51
|
+
const rawInput = block.input;
|
|
52
|
+
const { block: out, eventId, parentToolCallId, label } = stripToolUseSideChannels(block);
|
|
58
53
|
if (out.input && typeof out.input === 'object') {
|
|
59
54
|
const cleaned = {};
|
|
60
55
|
for (const [k, val] of Object.entries(out.input)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ActiveRunBusySignal } from './runStream.js';
|
|
2
2
|
import type { PlanReviewReopenTrigger } from '../hitl/planReviewWire.js';
|
|
3
|
+
import { atMostOnceFailureClass } from '../atMostOnce.js';
|
|
3
4
|
export declare const PLAN_REVIEW_GATE_KIND = "plan_review";
|
|
4
5
|
export declare const PLAN_REVIEW_GATE_KINDS: readonly string[];
|
|
5
6
|
export declare const ASK_PARK_GATE_KINDS: readonly string[];
|
|
@@ -9,7 +10,6 @@ export declare function askParkForeignGateKind(row: {
|
|
|
9
10
|
export declare const PLAN_REVIEW_STATES: readonly string[];
|
|
10
11
|
export declare const ASK_PARK_STATES: readonly string[];
|
|
11
12
|
export declare const RUNNING_STATES: readonly string[];
|
|
12
|
-
export declare const CLAIM_RELEASED_STATES: readonly string[];
|
|
13
13
|
export declare const CLAIM_HELD_STATES: readonly string[];
|
|
14
14
|
export interface DurableRunRecordView {
|
|
15
15
|
readonly status?: unknown;
|
|
@@ -47,6 +47,7 @@ export interface RunningChoiceRequest {
|
|
|
47
47
|
status: string;
|
|
48
48
|
canSteer: boolean;
|
|
49
49
|
canCancel: boolean;
|
|
50
|
+
canAttach?: true;
|
|
50
51
|
}
|
|
51
52
|
export interface StaleParkChoiceRequest {
|
|
52
53
|
taskId: string;
|
|
@@ -62,7 +63,8 @@ export interface ActiveRunSelfHealDeps {
|
|
|
62
63
|
trigger?: PlanReviewReopenTrigger;
|
|
63
64
|
}) => ReopenCardVerdict | Promise<ReopenCardVerdict>;
|
|
64
65
|
reopenAskPark?: (taskId: string) => Promise<ReopenCardVerdict>;
|
|
65
|
-
offerRunningChoice?: (req: RunningChoiceRequest) => Promise<'steer' | 'cancel' | 'wait'>;
|
|
66
|
+
offerRunningChoice?: (req: RunningChoiceRequest) => Promise<'steer' | 'cancel' | 'wait' | 'attach'>;
|
|
67
|
+
canAttachRunning?: boolean;
|
|
66
68
|
offerStaleParkChoice?: (req: StaleParkChoiceRequest) => Promise<'cancel' | 'wait'>;
|
|
67
69
|
deniedMessage?: string;
|
|
68
70
|
signal?: AbortSignal;
|
|
@@ -134,6 +136,9 @@ export type SelfHealOutcome = {
|
|
|
134
136
|
taskId: string;
|
|
135
137
|
detail: string;
|
|
136
138
|
delivery: 'rejected' | 'unknown';
|
|
139
|
+
} | {
|
|
140
|
+
kind: 'running-attach';
|
|
141
|
+
taskId: string;
|
|
137
142
|
} | {
|
|
138
143
|
kind: 'running-cancelled';
|
|
139
144
|
taskId: string;
|
|
@@ -191,7 +196,7 @@ export interface SelfHealFollowDeclaration {
|
|
|
191
196
|
following?: boolean;
|
|
192
197
|
}
|
|
193
198
|
export declare function readCancelRequested(body: unknown): boolean | undefined;
|
|
194
|
-
export
|
|
199
|
+
export { atMostOnceFailureClass };
|
|
195
200
|
export declare function clearRunningChoiceOffer(taskId: string, sessionId?: string): void;
|
|
196
201
|
export declare function __resetRunningChoiceLedgerForTests(): void;
|
|
197
202
|
export interface ClaimReleaseVerdict {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { abortableSleep } from '../abortableSleep.js';
|
|
2
2
|
import { corruptStoredRowContent, corruptStoredRowWhere, effectiveWireErrorCode } from '../wireErrorTriage.js';
|
|
3
|
-
import { steerBodyOf,
|
|
3
|
+
import { steerBodyOf, UNOBSERVED_STEER_PRIORITY } from '../controlRouter.js';
|
|
4
|
+
import { atMostOnceFailureClass } from '../atMostOnce.js';
|
|
4
5
|
import { readSteerReceipt } from '../steerReceipt.js';
|
|
6
|
+
import { resumeAttachReplayDisclosure, runningAttachOffered } from '../hitl/resumeRunningCard.js';
|
|
7
|
+
import { isSdkRunTerminal, SDK_PARKED_RUN_STATUSES } from '../terminalStatuses.js';
|
|
5
8
|
export const PLAN_REVIEW_GATE_KIND = 'plan_review';
|
|
6
9
|
export const PLAN_REVIEW_GATE_KINDS = Object.freeze([PLAN_REVIEW_GATE_KIND, 'dry_run_review']);
|
|
7
10
|
export const ASK_PARK_GATE_KINDS = Object.freeze(['human', 'irreversible_ask', 'policy_ask', 'tool_approval']);
|
|
@@ -12,8 +15,7 @@ export function askParkForeignGateKind(row) {
|
|
|
12
15
|
export const PLAN_REVIEW_STATES = Object.freeze(['needs_review']);
|
|
13
16
|
export const ASK_PARK_STATES = Object.freeze(['suspended']);
|
|
14
17
|
export const RUNNING_STATES = Object.freeze(['running']);
|
|
15
|
-
export const
|
|
16
|
-
export const CLAIM_HELD_STATES = Object.freeze(['running', 'suspended', 'needs_review']);
|
|
18
|
+
export const CLAIM_HELD_STATES = Object.freeze(['running', ...SDK_PARKED_RUN_STATUSES]);
|
|
17
19
|
export function selfHealSubmissionDisposition(outcome) {
|
|
18
20
|
switch (outcome.kind) {
|
|
19
21
|
case 'decision-pending':
|
|
@@ -29,6 +31,8 @@ export function selfHealSubmissionDisposition(outcome) {
|
|
|
29
31
|
return 'not-delivered';
|
|
30
32
|
case 'running-steered':
|
|
31
33
|
return 'handed-off';
|
|
34
|
+
case 'running-attach':
|
|
35
|
+
return 'not-delivered';
|
|
32
36
|
default:
|
|
33
37
|
return 'not-delivered';
|
|
34
38
|
}
|
|
@@ -261,11 +265,7 @@ function reopenedOfOutcome(outcome) {
|
|
|
261
265
|
return null;
|
|
262
266
|
}
|
|
263
267
|
}
|
|
264
|
-
export
|
|
265
|
-
if (typeof e === 'object' && e !== null && steeringStatusIs4xx(e))
|
|
266
|
-
return 'rejected';
|
|
267
|
-
return typeof e === 'object' && e !== null && steeringRefusedBeforeEngine(e) !== undefined ? 'rejected' : 'unknown';
|
|
268
|
-
}
|
|
268
|
+
export { atMostOnceFailureClass };
|
|
269
269
|
const CANCEL_RELEASE_WAIT_MS = 10_000;
|
|
270
270
|
const RUNNING_LIVENESS_RECHECK_TIMEOUT_MS = 4_000;
|
|
271
271
|
const runningChoiceDeclined = new Set();
|
|
@@ -365,7 +365,7 @@ export async function waitForClaimRelease(taskId, deps) {
|
|
|
365
365
|
if (holder === 'released') {
|
|
366
366
|
return { released: true, waitedMs: waited(), aborted: false, lastStatus: status, lastHolder: holder };
|
|
367
367
|
}
|
|
368
|
-
if (
|
|
368
|
+
if (isSdkRunTerminal(status)) {
|
|
369
369
|
return { released: true, waitedMs: waited(), aborted: false, lastStatus: status, lastHolder: holder };
|
|
370
370
|
}
|
|
371
371
|
}
|
|
@@ -698,7 +698,8 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
698
698
|
const text = typeof deps?.deniedMessage === 'string' ? deps.deniedMessage : '';
|
|
699
699
|
const canSteer = typeof runs?.steer === 'function' && text.length > 0;
|
|
700
700
|
const canCancel = typeof runs?.cancel === 'function' && typeof runs?.get === 'function';
|
|
701
|
-
|
|
701
|
+
const canAttach = runningAttachOffered(deps?.canAttachRunning);
|
|
702
|
+
if (!canSteer && !canCancel && !canAttach)
|
|
702
703
|
return notParked;
|
|
703
704
|
if (injected && !canSteer)
|
|
704
705
|
return notParked;
|
|
@@ -715,7 +716,7 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
715
716
|
return planReviewArm(taskId, busy, deps);
|
|
716
717
|
if (ASK_PARK_STATES.includes(fresh))
|
|
717
718
|
return askParkArm(taskId, busy, runs, deps);
|
|
718
|
-
if (
|
|
719
|
+
if (isSdkRunTerminal(fresh))
|
|
719
720
|
return { kind: 'running-settled', taskId, status: fresh };
|
|
720
721
|
return { kind: 'not-parked', taskId, status: fresh };
|
|
721
722
|
}
|
|
@@ -733,7 +734,7 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
733
734
|
}
|
|
734
735
|
else if (typeof offer === 'function') {
|
|
735
736
|
try {
|
|
736
|
-
choice = (await offer({ taskId, status, canSteer, canCancel })) ?? 'wait';
|
|
737
|
+
choice = (await offer({ taskId, status, canSteer, canCancel, ...(canAttach ? { canAttach: true } : {}) })) ?? 'wait';
|
|
737
738
|
offerDelivered = true;
|
|
738
739
|
}
|
|
739
740
|
catch {
|
|
@@ -783,6 +784,8 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
783
784
|
confirmedHeld: verdict.confirmedHeld,
|
|
784
785
|
};
|
|
785
786
|
}
|
|
787
|
+
if (choice === 'attach' && canAttach)
|
|
788
|
+
return { kind: 'running-attach', taskId };
|
|
786
789
|
return notParked;
|
|
787
790
|
}
|
|
788
791
|
export const INTERACTIVE_WAY_OUT = 'run /clear to keep working in a fresh session';
|
|
@@ -841,6 +844,9 @@ const NO_CARD_VIEW_ATTACHED = 'this session has no view attached that can show d
|
|
|
841
844
|
function injectedSubmissionRow(outcome, following = false) {
|
|
842
845
|
const lead = INJECTED_LEAD;
|
|
843
846
|
const id = 'taskId' in outcome && outcome.taskId ? ` (id ${outcome.taskId})` : '';
|
|
847
|
+
if (outcome.kind === 'running-attach') {
|
|
848
|
+
return `${lead} was not delivered: you chose to watch the reply already in progress${id} instead, and sema is replaying that reply here, so the part already shown above will appear again below. sema did not retry, so the model has not seen it.`;
|
|
849
|
+
}
|
|
844
850
|
if (outcome.kind === 'running-steer-failed') {
|
|
845
851
|
return outcome.delivery === 'unknown'
|
|
846
852
|
? `${lead} was passed to the reply already in progress${id}, but its delivery could not be confirmed ` +
|
|
@@ -1057,6 +1063,8 @@ function activeRunSelfHealBaseRow(outcome, signal, wayOut, following = false, ke
|
|
|
1057
1063
|
`to it (${outcome.detail}). A steer is not safe to send twice, so sema did NOT retry it, and it did NOT ` +
|
|
1058
1064
|
`cancel that run. That run may or may not have received your message — watch what it does next ` +
|
|
1059
1065
|
`before sending it again.`);
|
|
1066
|
+
case 'running-attach':
|
|
1067
|
+
return (`${resumeAttachReplayDisclosure(outcome.taskId)} Your message was NOT sent; send it again once that run has finished.`);
|
|
1060
1068
|
case 'running-cancelled':
|
|
1061
1069
|
return outcome.releaseConfirmedByEngine === true
|
|
1062
1070
|
? `You chose to cancel run ${outcome.taskId}. The engine confirmed it is no longer holding this session, ` +
|
|
@@ -5,8 +5,10 @@ import { ccToolDenialKindForToolEnd, gateOutcomeOf } from '../../gateOutcome.js'
|
|
|
5
5
|
import { projectToolRoster, projectToolRosterDelta } from '../../toolRoster.js';
|
|
6
6
|
import { projectHandsSection } from '../../handsSeam.js';
|
|
7
7
|
import { readMcpLiveness } from '../../mcpLiveness.js';
|
|
8
|
-
import {
|
|
8
|
+
import { markMcpSectionDroppedNamedRows } from '../../ownKey.js';
|
|
9
|
+
import { SEGMENT_END_IDENTITY_KEYS, stripToolUseSideChannels } from '../types.js';
|
|
9
10
|
import { frozenSet } from '../../frozenSet.js';
|
|
11
|
+
import { isCoreWorkflowRunTerminal } from '../../terminalStatuses.js';
|
|
10
12
|
function armBody(body) {
|
|
11
13
|
return body;
|
|
12
14
|
}
|
|
@@ -104,13 +106,13 @@ export function eventToSdkMessage(ev, ctx) {
|
|
|
104
106
|
if (typeof ev.runId !== 'string' || ev.runId.length === 0) {
|
|
105
107
|
return dropped('malformed', 'workflow_complete');
|
|
106
108
|
}
|
|
107
|
-
if (ev.status
|
|
109
|
+
if (!isCoreWorkflowRunTerminal(ev.status)) {
|
|
108
110
|
return dropped('malformed', 'workflow_complete');
|
|
109
111
|
}
|
|
110
112
|
return projected(stamp(ctx, armBody({
|
|
111
113
|
type: 'workflow_complete',
|
|
112
114
|
runId: ev.runId,
|
|
113
|
-
status: ev.status
|
|
115
|
+
status: ev.status,
|
|
114
116
|
summary: typeof ev.summary === 'string' ? ev.summary : '',
|
|
115
117
|
})));
|
|
116
118
|
}
|
|
@@ -126,20 +128,21 @@ export function eventToSdkMessage(ev, ctx) {
|
|
|
126
128
|
delta: ev.delta,
|
|
127
129
|
...(ev.parentToolCallId !== undefined ? { parentToolCallId: ev.parentToolCallId } : {}),
|
|
128
130
|
}));
|
|
129
|
-
case 'tool_start':
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
], ev.eventId, ev.parentToolCallId));
|
|
131
|
+
case 'tool_start': {
|
|
132
|
+
const toolUse = {
|
|
133
|
+
type: 'tool_use',
|
|
134
|
+
id: ev.toolCallId,
|
|
135
|
+
name: ev.toolName,
|
|
136
|
+
input: ev.args,
|
|
137
|
+
...(typeof ev.label === 'string' && ev.label.length > 0 ? { label: ev.label } : {}),
|
|
138
|
+
...(ev.eventId !== undefined ? { eventId: ev.eventId } : {}),
|
|
139
|
+
...(ev.parentToolCallId !== undefined
|
|
140
|
+
? { parentToolCallId: ev.parentToolCallId }
|
|
141
|
+
: {}),
|
|
142
|
+
};
|
|
143
|
+
const outBlock = ctx.lane === 'print' ? stripToolUseSideChannels(toolUse).block : toolUse;
|
|
144
|
+
return projected(assistantArm(ctx, [outBlock], ev.eventId, ev.parentToolCallId));
|
|
145
|
+
}
|
|
143
146
|
case 'compacted': {
|
|
144
147
|
const raw = ev;
|
|
145
148
|
const freedTokens = typeof raw.freedTokens === 'number' && Number.isFinite(raw.freedTokens) && raw.freedTokens >= 0 ? raw.freedTokens : undefined;
|
|
@@ -470,12 +473,15 @@ export function projectMcpSection(raw) {
|
|
|
470
473
|
if (!Array.isArray(raw))
|
|
471
474
|
return undefined;
|
|
472
475
|
const rows = [];
|
|
476
|
+
const droppedNamed = new Map();
|
|
473
477
|
for (const e of raw) {
|
|
474
478
|
if (typeof e !== 'object' || e === null || Array.isArray(e))
|
|
475
479
|
continue;
|
|
476
480
|
const r = e;
|
|
477
481
|
const name = typeof r.name === 'string' && r.name.length > 0 ? r.name : undefined;
|
|
478
482
|
const status = typeof r.status === 'string' && r.status.length > 0 ? r.status : undefined;
|
|
483
|
+
if (name !== undefined && status === undefined)
|
|
484
|
+
droppedNamed.set(name, (droppedNamed.get(name) ?? 0) + 1);
|
|
479
485
|
if (name === undefined || status === undefined)
|
|
480
486
|
continue;
|
|
481
487
|
rows.push({
|
|
@@ -491,6 +497,7 @@ export function projectMcpSection(raw) {
|
|
|
491
497
|
}
|
|
492
498
|
if (raw.length > 0 && rows.length === 0)
|
|
493
499
|
return undefined;
|
|
500
|
+
markMcpSectionDroppedNamedRows(rows, droppedNamed);
|
|
494
501
|
return rows;
|
|
495
502
|
}
|
|
496
503
|
function projectModelGateSection(raw) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isCcToolDenialKind, isCcToolDenialKindADenial, isGateDeniedByWord } from '../../gateVocabulary.js';
|
|
2
2
|
import { stamp } from '../types.js';
|
|
3
|
-
import { putOwnKey } from '../../ownKey.js';
|
|
3
|
+
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';
|
|
@@ -79,6 +79,11 @@ function permissionDenialParts(stats, observed) {
|
|
|
79
79
|
const hr = stats?.humanReview;
|
|
80
80
|
const gatesRaw = hr !== null && typeof hr === 'object' ? hr.gates : undefined;
|
|
81
81
|
const denials = [];
|
|
82
|
+
const mergedKindOf = (callId) => (denialKindByCallId?.has(callId) === true ? denialKindByCallId.get(callId) : undefined);
|
|
83
|
+
const settledAsAbort = (callId) => {
|
|
84
|
+
const k = mergedKindOf(callId);
|
|
85
|
+
return isCcToolDenialKind(k) && !isCcToolDenialKindADenial(k);
|
|
86
|
+
};
|
|
82
87
|
const gates = Array.isArray(gatesRaw) ? gatesRaw : [];
|
|
83
88
|
let complete = Array.isArray(gatesRaw);
|
|
84
89
|
for (const g of gates) {
|
|
@@ -100,6 +105,8 @@ function permissionDenialParts(stats, observed) {
|
|
|
100
105
|
const toolName = nonEmptyStr(row.toolName);
|
|
101
106
|
const toolArg = nonEmptyStr(row.toolArg);
|
|
102
107
|
const toolUseId = nonEmptyStr(row.toolCallId);
|
|
108
|
+
if (toolUseId !== undefined && settledAsAbort(toolUseId))
|
|
109
|
+
continue;
|
|
103
110
|
const rawInput = row.toolInput;
|
|
104
111
|
const ledgerInput = rawInput !== null && typeof rawInput === 'object' && !Array.isArray(rawInput)
|
|
105
112
|
? rawInput
|
|
@@ -151,9 +158,9 @@ function permissionDenialParts(stats, observed) {
|
|
|
151
158
|
for (const [callId, toolNameRaw] of deniedToolNameByCallId) {
|
|
152
159
|
if (typeof callId !== 'string' || callId.length === 0 || ledgerDeniedIds.has(callId))
|
|
153
160
|
continue;
|
|
154
|
-
|
|
155
|
-
if (isCcToolDenialKind(mergedKind) && !isCcToolDenialKindADenial(mergedKind))
|
|
161
|
+
if (settledAsAbort(callId))
|
|
156
162
|
continue;
|
|
163
|
+
const mergedKind = mergedKindOf(callId);
|
|
157
164
|
if (ledgerHasIdlessDenial) {
|
|
158
165
|
complete = false;
|
|
159
166
|
continue;
|
|
@@ -178,7 +185,8 @@ function permissionDenialParts(stats, observed) {
|
|
|
178
185
|
complete = false;
|
|
179
186
|
}
|
|
180
187
|
const ccList = denials.filter((d) => d.tool_name !== undefined && d.tool_use_id !== undefined && d.tool_input !== undefined);
|
|
181
|
-
const
|
|
188
|
+
const streamCoversRun = observed?.streamSawRunOpen === true && observed.deniedToolNameByCallId !== undefined;
|
|
189
|
+
const claimable = complete && ccList.length === denials.length && streamCoversRun;
|
|
182
190
|
const zeroOutputDenied = denials.length > 0 && observed?.streamSawRunOpen === true && observed.successfulToolEndObserved === false;
|
|
183
191
|
return {
|
|
184
192
|
permission_denials: ccList,
|
|
@@ -522,8 +530,7 @@ export function doneToSdkResult(ev, ctx, observed) {
|
|
|
522
530
|
const durationMs = elapsedMs(ctx);
|
|
523
531
|
const errorCode = runTerminalCode(terminal);
|
|
524
532
|
const degraded = degradedOf(r);
|
|
525
|
-
const
|
|
526
|
-
const parkFailedReason = typeof parkFailedRaw === 'string' && parkFailedRaw.length > 0 ? parkFailedRaw : undefined;
|
|
533
|
+
const parkFailedReason = readFrameStringKey(ev, '_sema_park_failed_reason');
|
|
527
534
|
const errorBase = { durationMs, stats, model: r.model, errorCode, degraded, observed, facts: effectiveFactParts(rec), parkFailedReason, abortCause: abortCauseWordOf(ev) };
|
|
528
535
|
if (terminal?.kind === 'failed') {
|
|
529
536
|
const failedCode = terminal.code;
|
|
@@ -60,7 +60,8 @@ export function activeRunBusySignal(ev) {
|
|
|
60
60
|
const result = ev.result;
|
|
61
61
|
if (typeof result !== 'object' || result === null)
|
|
62
62
|
return null;
|
|
63
|
-
|
|
63
|
+
const status = result.status;
|
|
64
|
+
if (status !== 'failed' && (status !== undefined || Array.isArray(result)))
|
|
64
65
|
return null;
|
|
65
66
|
carrier = result;
|
|
66
67
|
}
|
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,6 @@
|
|
|
1
1
|
import { errCodes } from '../controlRouter.js';
|
|
2
2
|
import { hostLog } from '../host.js';
|
|
3
|
+
import { isSessionIdPathSegment } from '../sessionIdSegment.js';
|
|
3
4
|
const unavailable = (why) => ({
|
|
4
5
|
kind: 'unavailable',
|
|
5
6
|
why,
|
|
@@ -95,7 +96,7 @@ export async function readEngineAgentRegistry(client, sessionId, caps, opts) {
|
|
|
95
96
|
async function readOnce(client, sessionId, caps, opts) {
|
|
96
97
|
if (!listFaceOn(caps))
|
|
97
98
|
return unavailable('no_list_face');
|
|
98
|
-
if (
|
|
99
|
+
if (!isSessionIdPathSegment(sessionId)) {
|
|
99
100
|
noteReadFailed('bad session id');
|
|
100
101
|
return unavailable('read_failed');
|
|
101
102
|
}
|
|
@@ -3,9 +3,11 @@ 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';
|
|
7
|
+
import { wireFailureTextsOf } from '../wireFailureShape.js';
|
|
6
8
|
import { DEFAULT_SESSION_KEY } from '../sessionSlot.js';
|
|
7
9
|
const NOTHING_SENT = ' — nothing sent';
|
|
8
|
-
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}`;
|
|
9
11
|
const DETAIL_BAD_INCLUDE_RETAINED = `includeRetained must be true or false (the engine has no default for it)${NOTHING_SENT}`;
|
|
10
12
|
const DETAIL_BAD_OPTIONS = `the options could not be read${NOTHING_SENT}`;
|
|
11
13
|
const DETAIL_BAD_ARGUMENTS = `the arguments could not be read${NOTHING_SENT}`;
|
|
@@ -164,7 +166,7 @@ function classifyFailure(e) {
|
|
|
164
166
|
try {
|
|
165
167
|
if (typeof e !== 'object' || e === null) {
|
|
166
168
|
note('error (non-object failure)');
|
|
167
|
-
return { kind: 'error', detail: `the stop request failed: ${
|
|
169
|
+
return { kind: 'error', detail: `the stop request failed: ${wireFailureTextsOf(e).reason.slice(0, 200)}` };
|
|
168
170
|
}
|
|
169
171
|
const d = diagOf(e);
|
|
170
172
|
if (d.status === undefined && d.errorCode === undefined) {
|
|
@@ -201,7 +203,7 @@ export async function stopEngineSessionBackground(sessionId, body, opts) {
|
|
|
201
203
|
let signal;
|
|
202
204
|
let sessionKey;
|
|
203
205
|
try {
|
|
204
|
-
if (
|
|
206
|
+
if (!isSessionIdPathSegment(sessionId))
|
|
205
207
|
return unavailable('bad_input', DETAIL_BAD_SESSION);
|
|
206
208
|
const flag = typeof body === 'object' && body !== null && Object.hasOwn(body, 'includeRetained') ? body.includeRetained : undefined;
|
|
207
209
|
if (typeof flag !== 'boolean')
|
package/dist/agentsWireCaps.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type EngineProbeOpts, type WireAuthTokenSource } from './engineWireSdk.js';
|
|
2
2
|
import type { ReasoningEffort } from './effortWire.js';
|
|
3
|
+
import type { ToolRosterView } from './toolRoster.js';
|
|
3
4
|
export declare const MAX_TASK_AGENTS = 32;
|
|
4
5
|
export declare const MAX_AGENT_NAME_CHARS = 64;
|
|
5
6
|
export declare const MAX_AGENT_TEXT_CHARS = 4096;
|
|
@@ -14,6 +15,8 @@ export type TaskAgentWireSkill = {
|
|
|
14
15
|
name: string;
|
|
15
16
|
description: string;
|
|
16
17
|
content: string;
|
|
18
|
+
allowedTools?: string[];
|
|
19
|
+
disallowedTools?: string[];
|
|
17
20
|
};
|
|
18
21
|
export declare const AGENT_MEMORY_WORDS: ReadonlySet<string>;
|
|
19
22
|
export type TaskAgentWireMemory = {
|
|
@@ -56,11 +59,25 @@ export type ProjectAgentsDeps = {
|
|
|
56
59
|
};
|
|
57
60
|
effortToThinking: (effort: unknown) => WireThinkingLevel | undefined;
|
|
58
61
|
skillSpecs?: TaskAgentWireSkill[];
|
|
62
|
+
toolRoster?: ToolRosterView | null;
|
|
63
|
+
withholdRefusedDenyLists?: boolean;
|
|
64
|
+
agentSourceLabel?: (agentName: string) => string | undefined;
|
|
59
65
|
};
|
|
60
66
|
export type ProjectAgentsResult = {
|
|
61
67
|
agents: TaskAgentWireItem[] | undefined;
|
|
62
68
|
warnings: string[];
|
|
69
|
+
toolListFlaws?: readonly AgentToolListFlaw[];
|
|
63
70
|
};
|
|
71
|
+
export type AgentToolListFlawKind = 'retired' | 'unprefixed_namespace' | 'case_twin';
|
|
72
|
+
export interface AgentToolListFlaw {
|
|
73
|
+
readonly agent: string;
|
|
74
|
+
readonly list: 'tools' | 'disallowedTools';
|
|
75
|
+
readonly entry: string;
|
|
76
|
+
readonly kind: AgentToolListFlawKind;
|
|
77
|
+
readonly currentName?: string;
|
|
78
|
+
readonly toolName?: string;
|
|
79
|
+
}
|
|
80
|
+
export declare function agentToolListFlaws(agents: readonly TaskAgentWireItem[] | undefined, roster?: ToolRosterView | null): AgentToolListFlaw[];
|
|
64
81
|
export declare function projectAgentsForWire(defs: readonly AgentDefLike[], deps: ProjectAgentsDeps): ProjectAgentsResult;
|
|
65
82
|
export declare function engineSupportsTaskAgents(baseUrl: string, opts?: EngineProbeOpts): Promise<boolean | undefined>;
|
|
66
83
|
export type WireConfig = {
|