@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
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { hostLog, hostTimersFor } from '../host.js';
|
|
2
|
+
import { invokeHostCallbackIsolated } from '../hostCallbackGuard.js';
|
|
2
3
|
import { COMPACT_NOT_RUNNING, isUnavailableFaceCode } from '../engineErrorCodes.js';
|
|
3
4
|
import { surfaceCompactNotRunning } from '../hitl/hitlHostSurface.js';
|
|
4
5
|
import { wireFailureShapeOf, wireFailureTextsOf } from '../wireFailureShape.js';
|
|
5
6
|
import { clientHasVerbs, engineWireFor, INJECTED_WIRE_SETTLE_MS, noAnswerDetailFrom, settleInjected, } from '../engineWireFor.js';
|
|
6
7
|
import { activeEngineRunIdFor, engineSessionParamFor } from '../engineSessionParam.js';
|
|
7
8
|
import { DEFAULT_SESSION_KEY } from '../sessionSlot.js';
|
|
9
|
+
import { engineCapState, kickEngineCapsProbe } from '../engineCapsCache.js';
|
|
8
10
|
function usableCompactClient(client) {
|
|
9
11
|
return clientHasVerbs(client, [['capabilities'], ['runs', 'compact']]);
|
|
10
12
|
}
|
|
@@ -14,43 +16,21 @@ const pendingCompactSinks = new Map();
|
|
|
14
16
|
export function isEngineCompactPending(sessionKey = DEFAULT_SESSION_KEY) {
|
|
15
17
|
return pendingCompactKeys.has(sessionKey);
|
|
16
18
|
}
|
|
17
|
-
const manualCompactCapableByBase = new Map();
|
|
18
|
-
const capabilitiesProbeByBase = new Map();
|
|
19
19
|
function probeManualCompactCapability(wire) {
|
|
20
20
|
const base = wire.kind === 'injected' ? wire.capsBaseUrl : wire.target.baseUrl;
|
|
21
21
|
if (base === undefined)
|
|
22
22
|
return;
|
|
23
|
-
if (
|
|
23
|
+
if (wire.kind === 'injected') {
|
|
24
|
+
const injected = wire.client;
|
|
25
|
+
kickEngineCapsProbe(base, () => settleInjected(COMPACT_PROBE_SETTLE_MS, undefined, (signal) => injected.capabilities({ signal })));
|
|
24
26
|
return;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
caps = await settleInjected(COMPACT_PROBE_SETTLE_MS, undefined, (signal) => injected.capabilities({ signal }));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const client = wire.make({ timeoutMs: 5000 });
|
|
34
|
-
if (!client) {
|
|
35
|
-
capabilitiesProbeByBase.delete(base);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
caps = await client.capabilities();
|
|
39
|
-
}
|
|
40
|
-
if (typeof caps.manualCompact === 'boolean')
|
|
41
|
-
manualCompactCapableByBase.set(base, caps.manualCompact);
|
|
42
|
-
else
|
|
43
|
-
capabilitiesProbeByBase.delete(base);
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
capabilitiesProbeByBase.delete(base);
|
|
47
|
-
}
|
|
48
|
-
})());
|
|
49
|
-
}
|
|
50
|
-
export function resetManualCompactCapability() {
|
|
51
|
-
manualCompactCapableByBase.clear();
|
|
52
|
-
capabilitiesProbeByBase.clear();
|
|
27
|
+
}
|
|
28
|
+
const client = wire.make({ timeoutMs: 5000 });
|
|
29
|
+
if (!client)
|
|
30
|
+
return;
|
|
31
|
+
kickEngineCapsProbe(base, () => client.capabilities());
|
|
53
32
|
}
|
|
33
|
+
export function resetManualCompactCapability() { }
|
|
54
34
|
export function __resetEngineCompactArmForTests() {
|
|
55
35
|
pendingCompactKeys.clear();
|
|
56
36
|
pendingCompactSinks.clear();
|
|
@@ -91,12 +71,7 @@ function emitCompactOutcome(sink, outcome) {
|
|
|
91
71
|
void Promise.resolve().then(() => callSinkIsolated(sink, outcome));
|
|
92
72
|
}
|
|
93
73
|
function callSinkIsolated(sink, outcome) {
|
|
94
|
-
|
|
95
|
-
sink(outcome);
|
|
96
|
-
}
|
|
97
|
-
catch (e) {
|
|
98
|
-
hostLog('debug', `engineCompactWire: onSettled sink threw (ignored): ${wireFailureTextsOf(e).log}`);
|
|
99
|
-
}
|
|
74
|
+
invokeHostCallbackIsolated('engineCompactWire: onSettled sink', () => sink(outcome));
|
|
100
75
|
}
|
|
101
76
|
function fanOutCompactSinks(sinks) {
|
|
102
77
|
if (sinks === undefined || sinks.length === 0)
|
|
@@ -157,7 +132,7 @@ export function requestEngineCompact(sessionKey = DEFAULT_SESSION_KEY, opts) {
|
|
|
157
132
|
return 'offline';
|
|
158
133
|
probeManualCompactCapability(wire);
|
|
159
134
|
const capsKey = wire.kind === 'injected' ? wire.capsBaseUrl : wire.target.baseUrl;
|
|
160
|
-
if (capsKey
|
|
135
|
+
if (engineCapState(capsKey, 'manualCompact') === 'false') {
|
|
161
136
|
hostLog('debug', 'engineCompactWire: engine capabilities report manualCompact:false — verb suppressed (TOC-local runStore-less engine, [488])');
|
|
162
137
|
return 'unsupported';
|
|
163
138
|
}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { stripSystemReminderBlocks } from '../systemReminderTag.js';
|
|
2
2
|
import { hostLog } from '../host.js';
|
|
3
|
+
import { isSessionIdPathSegment } from '../sessionIdSegment.js';
|
|
3
4
|
import { clientHasVerbs, engineWireFor, INJECTED_WIRE_SETTLE_MS, settleInjected } from '../engineWireFor.js';
|
|
4
5
|
import { resolveOwnerContext } from './engineSubagentResume.js';
|
|
6
|
+
import { panelAnchorOf } from '../panelReduce.js';
|
|
7
|
+
import { clearEnginePanelAnchors, panelStateNow, stepEnginePanel } from '../panelStateHolder.js';
|
|
5
8
|
function usableDelegatedPromptClient(client) {
|
|
6
9
|
return clientHasVerbs(client, [['sessions', 'get']]);
|
|
7
10
|
}
|
|
8
11
|
const TAIL_WINDOW = 200;
|
|
9
12
|
const BLOB_CAP = 8 * 1024;
|
|
10
|
-
const transcriptIdByTask = new Map();
|
|
11
13
|
export function recordEngineTranscriptId(taskId, transcriptId) {
|
|
12
14
|
if (!taskId || !transcriptId)
|
|
13
15
|
return;
|
|
14
|
-
|
|
16
|
+
stepEnginePanel({ kind: 'anchor', taskId, transcriptId });
|
|
15
17
|
}
|
|
16
18
|
export function getEngineTranscriptId(taskId) {
|
|
17
|
-
return
|
|
19
|
+
return panelAnchorOf(panelStateNow(), taskId);
|
|
18
20
|
}
|
|
19
21
|
export function __resetEngineDelegatedPromptForTests() {
|
|
20
|
-
|
|
22
|
+
clearEnginePanelAnchors();
|
|
21
23
|
promptHydrateInFlight.clear();
|
|
22
24
|
}
|
|
23
25
|
const promptHydrateInFlight = new Set();
|
|
@@ -94,6 +96,8 @@ export function __setTranscriptWindowReaderForTests(r) {
|
|
|
94
96
|
async function readTranscriptWindow(transcriptId, sessionKey, injectedWire) {
|
|
95
97
|
if (transcriptWindowReader)
|
|
96
98
|
return transcriptWindowReader(transcriptId);
|
|
99
|
+
if (!isSessionIdPathSegment(transcriptId))
|
|
100
|
+
return null;
|
|
97
101
|
const wire = engineWireFor(injectedWire, sessionKey, usableDelegatedPromptClient);
|
|
98
102
|
if (wire.kind === 'no-target' || wire.kind === 'injected-unusable')
|
|
99
103
|
return null;
|
|
@@ -112,8 +116,8 @@ async function readTranscriptWindow(transcriptId, sessionKey, injectedWire) {
|
|
|
112
116
|
export async function fetchDelegatedPrompt(taskId, opts) {
|
|
113
117
|
if (promptHydrateInFlight.has(taskId))
|
|
114
118
|
return { outcome: 'skipped' };
|
|
115
|
-
const transcriptId =
|
|
116
|
-
if (!transcriptId)
|
|
119
|
+
const transcriptId = getEngineTranscriptId(taskId);
|
|
120
|
+
if (!isSessionIdPathSegment(transcriptId))
|
|
117
121
|
return { outcome: 'skipped' };
|
|
118
122
|
promptHydrateInFlight.add(taskId);
|
|
119
123
|
let msgs = null;
|
|
@@ -5,7 +5,6 @@ export type SubagentReportWireClient = {
|
|
|
5
5
|
runs: Pick<AgentClient['runs'], 'subagentOutput'>;
|
|
6
6
|
};
|
|
7
7
|
export type SubagentReportWire = EngineWireInjection<SubagentReportWireClient>;
|
|
8
|
-
export declare function __resetSubagentOutputCapCacheForTests(): void;
|
|
9
8
|
export interface EngineSubagentReport {
|
|
10
9
|
content: string;
|
|
11
10
|
status?: string;
|
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
import { hostLog } from '../host.js';
|
|
2
2
|
import { clientHasVerbs, engineWireFor, INJECTED_WIRE_SETTLE_MS, settleInjected } from '../engineWireFor.js';
|
|
3
|
+
import { engineCapStateVia } from '../engineCapsCache.js';
|
|
3
4
|
import { engineSessionParamFor } from '../engineSessionParam.js';
|
|
4
5
|
import { resolveOwnerContext } from './engineSubagentResume.js';
|
|
5
6
|
import { noteBgOwnerAbsence } from './subagentOwnerAbsence.js';
|
|
6
7
|
function usableReportClient(client) {
|
|
7
8
|
return clientHasVerbs(client, [['capabilities'], ['runs', 'subagentOutput']]);
|
|
8
9
|
}
|
|
9
|
-
const capByBase = new Map();
|
|
10
|
-
const CAP_FALSE_RETRY_TTL_MS = 5 * 60_000;
|
|
11
10
|
async function subagentOutputCapable(client, cacheKey, signal, deadlineMs) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const caps = deadlineMs !== undefined
|
|
17
|
-
? await settleInjected(deadlineMs, signal, (s) => client.capabilities({ signal: s }))
|
|
18
|
-
: await client.capabilities({ ...(signal ? { signal } : {}) });
|
|
19
|
-
const ok = caps.subagentOutput === true;
|
|
20
|
-
if (cacheKey !== undefined)
|
|
21
|
-
capByBase.set(cacheKey, { ok, at: Date.now() });
|
|
22
|
-
return ok;
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export function __resetSubagentOutputCapCacheForTests() {
|
|
29
|
-
capByBase.clear();
|
|
11
|
+
const state = await engineCapStateVia(cacheKey, 'subagentOutput', (s) => deadlineMs !== undefined
|
|
12
|
+
? settleInjected(deadlineMs, s, (x) => client.capabilities({ signal: x }))
|
|
13
|
+
: client.capabilities({ ...(s ? { signal: s } : {}) }), { withinMs: deadlineMs ?? INJECTED_WIRE_SETTLE_MS, ...(signal ? { signal } : {}) });
|
|
14
|
+
return state === 'true';
|
|
30
15
|
}
|
|
31
16
|
export async function fetchEngineSubagentReport(taskId, opts) {
|
|
32
17
|
const { record: owner, runId, key } = resolveOwnerContext(taskId);
|
|
@@ -5,6 +5,7 @@ import { resolveOwnerContext, resolveOwnerRunId } from './engineSubagentResume.j
|
|
|
5
5
|
import { noteBgOwnerAbsence } from './subagentOwnerAbsence.js';
|
|
6
6
|
import { errCodes, steeringRefusedBeforeEngine } from '../controlRouter.js';
|
|
7
7
|
import { ownNonEmptyStringOf } from '../steerReceipt.js';
|
|
8
|
+
import { wireFailureTextsOf } from '../wireFailureShape.js';
|
|
8
9
|
function usableSteerClient(client) {
|
|
9
10
|
return clientHasVerbs(client, [['runs', 'steerSubagent']]);
|
|
10
11
|
}
|
|
@@ -53,14 +54,14 @@ export async function steerEngineSubagent(target, text, childTaskId, opts) {
|
|
|
53
54
|
status = undefined;
|
|
54
55
|
}
|
|
55
56
|
if (status !== undefined) {
|
|
56
|
-
const
|
|
57
|
-
hostLog('debug', `engineSubagentSteer: ${status} ${
|
|
57
|
+
const texts = wireFailureTextsOf(e);
|
|
58
|
+
hostLog('debug', `engineSubagentSteer: ${status} ${texts.log.slice(0, 200)}`);
|
|
58
59
|
const refused = typeof e === 'object' && e !== null ? steeringRefusedBeforeEngine(e) : undefined;
|
|
59
60
|
if (refused !== undefined && refused.safety === 'ledger_unavailable') {
|
|
60
61
|
return { ok: false, reason: 'not-delivered', safety: refused.safety, detail: refused.advice };
|
|
61
62
|
}
|
|
62
63
|
if (status === 409 || status === 404) {
|
|
63
|
-
return { ok: false, reason: 'not-running', detail };
|
|
64
|
+
return { ok: false, reason: 'not-running', detail: texts.reason };
|
|
64
65
|
}
|
|
65
66
|
return { ok: false, reason: 'error', detail: `${status}` };
|
|
66
67
|
}
|
|
@@ -69,7 +70,8 @@ export async function steerEngineSubagent(target, text, childTaskId, opts) {
|
|
|
69
70
|
hostLog('debug', `engineSubagentSteer: may have been received, no answer — ${noAnswer}`);
|
|
70
71
|
return { ok: false, reason: 'error', detail: noAnswer, unconfirmed: true };
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
const texts = wireFailureTextsOf(e);
|
|
74
|
+
hostLog('debug', `engineSubagentSteer: fetch failed ${texts.log}`);
|
|
75
|
+
return { ok: false, reason: 'error', detail: texts.reason };
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -5,7 +5,6 @@ export type SubagentTailWireClient = {
|
|
|
5
5
|
runs: Pick<AgentClient['runs'], 'subagentStream'>;
|
|
6
6
|
};
|
|
7
7
|
export type SubagentTailWire = EngineWireInjection<SubagentTailWireClient>;
|
|
8
|
-
export declare function __resetSubagentStreamCapCacheForTests(): void;
|
|
9
8
|
export interface SubagentActivity {
|
|
10
9
|
taskId: string;
|
|
11
10
|
toolName: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { hostLog } from '../host.js';
|
|
2
|
+
import { invokeHostCallbackIsolated } from '../hostCallbackGuard.js';
|
|
2
3
|
import { clientHasVerbs, engineWireFor, INJECTED_WIRE_SETTLE_MS, settleInjected } from '../engineWireFor.js';
|
|
4
|
+
import { engineCapStateVia } from '../engineCapsCache.js';
|
|
3
5
|
import { engineSessionParamFor } from '../engineSessionParam.js';
|
|
4
6
|
import { resolveOwnerContext } from './engineSubagentResume.js';
|
|
5
7
|
import { coerceOutput, parentToolCallIdOf, publishSubagentContentEvent, settleSubagentContent, } from '../subagentContentStore.js';
|
|
@@ -7,27 +9,11 @@ import { noteBgOwnerAbsence } from './subagentOwnerAbsence.js';
|
|
|
7
9
|
function usableTailClient(client) {
|
|
8
10
|
return clientHasVerbs(client, [['capabilities'], ['runs', 'subagentStream']]);
|
|
9
11
|
}
|
|
10
|
-
const capByBase = new Map();
|
|
11
|
-
const CAP_FALSE_RETRY_TTL_MS = 5 * 60_000;
|
|
12
12
|
async function subagentStreamCapable(client, cacheKey, signal, deadlineMs) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const caps = deadlineMs !== undefined
|
|
18
|
-
? await settleInjected(deadlineMs, signal, (s) => client.capabilities({ signal: s }))
|
|
19
|
-
: await client.capabilities({ ...(signal ? { signal } : {}) });
|
|
20
|
-
const ok = caps.subagentStream === true;
|
|
21
|
-
if (cacheKey !== undefined)
|
|
22
|
-
capByBase.set(cacheKey, { ok, at: Date.now() });
|
|
23
|
-
return ok;
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export function __resetSubagentStreamCapCacheForTests() {
|
|
30
|
-
capByBase.clear();
|
|
13
|
+
const state = await engineCapStateVia(cacheKey, 'subagentStream', (s) => deadlineMs !== undefined
|
|
14
|
+
? settleInjected(deadlineMs, s, (x) => client.capabilities({ signal: x }))
|
|
15
|
+
: client.capabilities({ ...(s ? { signal: s } : {}) }), { withinMs: deadlineMs ?? INJECTED_WIRE_SETTLE_MS, ...(signal ? { signal } : {}) });
|
|
16
|
+
return state === 'true';
|
|
31
17
|
}
|
|
32
18
|
const activeTails = new Map();
|
|
33
19
|
let activitySink = null;
|
|
@@ -106,18 +92,7 @@ export function tailEngineSubagent(taskId, opts) {
|
|
|
106
92
|
}
|
|
107
93
|
switch (ev.event) {
|
|
108
94
|
case 'meta':
|
|
109
|
-
|
|
110
|
-
const out = tailMetaSink?.({ taskId, meta: ev.data });
|
|
111
|
-
if (out !== null && typeof out === 'object' && typeof out.then === 'function') {
|
|
112
|
-
;
|
|
113
|
-
out.then(undefined, (e) => {
|
|
114
|
-
hostLog('debug', `[subagent-tail] ${taskId} meta sink rejected: ${String(e).slice(0, 160)}`);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
catch (e) {
|
|
119
|
-
hostLog('debug', `[subagent-tail] ${taskId} meta sink threw: ${String(e).slice(0, 160)}`);
|
|
120
|
-
}
|
|
95
|
+
invokeHostCallbackIsolated(`[subagent-tail] ${taskId} meta sink`, () => tailMetaSink?.({ taskId, meta: ev.data }));
|
|
121
96
|
continue;
|
|
122
97
|
case 'forward':
|
|
123
98
|
break;
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
+
import { DEFAULT_SESSION_KEY } from './sessionSlot.js';
|
|
2
|
+
import { toolEndOutputText } from './toolResultContent.js';
|
|
1
3
|
export function coerceOutput(v) {
|
|
2
4
|
if (v === undefined || v === null)
|
|
3
5
|
return undefined;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const parts = [];
|
|
8
|
-
for (const block of v) {
|
|
9
|
-
if (block && typeof block === 'object') {
|
|
10
|
-
const b = block;
|
|
11
|
-
if (b.type === 'text' && typeof b.text === 'string')
|
|
12
|
-
parts.push(b.text);
|
|
13
|
-
else if (b.type === 'image')
|
|
14
|
-
parts.push('[image]');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return parts.join('');
|
|
18
|
-
}
|
|
6
|
+
const text = toolEndOutputText(v);
|
|
7
|
+
if (text !== undefined)
|
|
8
|
+
return text;
|
|
19
9
|
try {
|
|
20
10
|
return JSON.stringify(v);
|
|
21
11
|
}
|
|
@@ -648,7 +638,6 @@ export function getBgTerminalFacts(taskId) {
|
|
|
648
638
|
}
|
|
649
639
|
const MAX_BG_PARENT_RUNS = 320;
|
|
650
640
|
const bgParentRun = new Map();
|
|
651
|
-
const DEFAULT_OWNER_SLOT = '__default__';
|
|
652
641
|
let ownerSessionConflictCount = 0;
|
|
653
642
|
let lastOwnerSessionConflict;
|
|
654
643
|
const conflictQuarantine = new Map();
|
|
@@ -703,8 +692,8 @@ export function recordSubagentOwner(taskId, runId, sessionId, sessionKey) {
|
|
|
703
692
|
},
|
|
704
693
|
next: { ...nextPair },
|
|
705
694
|
};
|
|
706
|
-
const priorSlot = prior?.sessionKey ??
|
|
707
|
-
const nextSlot = nextPair.sessionKey ??
|
|
695
|
+
const priorSlot = prior?.sessionKey ?? DEFAULT_SESSION_KEY;
|
|
696
|
+
const nextSlot = nextPair.sessionKey ?? DEFAULT_SESSION_KEY;
|
|
708
697
|
if (priorSlot !== nextSlot) {
|
|
709
698
|
bgParentRun.delete(taskId);
|
|
710
699
|
if (conflictQuarantine.size >= MAX_BG_PARENT_RUNS && !conflictQuarantine.has(taskId)) {
|
package/dist/supportFloor.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export declare const SUPPORT_FLOOR: Readonly<SupportFloor>;
|
|
|
8
8
|
export declare function supportFloorOf(component: unknown): string | undefined;
|
|
9
9
|
export type EngineVersionTier = 'engine' | 'legacy' | 'unknown';
|
|
10
10
|
export declare function engineVersionTier(version: unknown, floor?: string): EngineVersionTier;
|
|
11
|
+
export declare function engineSupportFloorEffective(floor?: string): string;
|
|
11
12
|
export declare function coreVersionTier(version: unknown, floor?: string): EngineVersionTier;
|
package/dist/supportFloor.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
core: '7.35.2',
|
|
4
|
-
sdk: '18.1.0',
|
|
5
|
-
});
|
|
1
|
+
import { DECLARED_SUPPORT_FLOOR } from './declared/supportFloorDeclared.js';
|
|
2
|
+
export const SUPPORT_FLOOR = DECLARED_SUPPORT_FLOOR;
|
|
6
3
|
export function supportFloorOf(component) {
|
|
7
4
|
if (component === 'server' || component === 'core' || component === 'sdk')
|
|
8
5
|
return SUPPORT_FLOOR[component];
|
|
@@ -14,7 +11,8 @@ function releaseTriple(v) {
|
|
|
14
11
|
const m = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(v);
|
|
15
12
|
if (m === null)
|
|
16
13
|
return undefined;
|
|
17
|
-
|
|
14
|
+
const t = [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
15
|
+
return t.every(Number.isSafeInteger) ? t : undefined;
|
|
18
16
|
}
|
|
19
17
|
function compareTriple(a, b) {
|
|
20
18
|
for (let i = 0; i < 3; i++) {
|
|
@@ -25,28 +23,31 @@ function compareTriple(a, b) {
|
|
|
25
23
|
}
|
|
26
24
|
return 0;
|
|
27
25
|
}
|
|
28
|
-
function
|
|
26
|
+
function judgeAgainst(version, base, floor, caller) {
|
|
29
27
|
const baseTriple = releaseTriple(base);
|
|
30
28
|
if (baseTriple === undefined) {
|
|
31
29
|
throw new TypeError(`${caller}: 门槛只接受纯 x.y.z 版本串(整串、无前导零、无前后缀)—— 收到 typeof=${base === null ? 'null' : typeof base}。错误文本只报形状,不回显值。`);
|
|
32
30
|
}
|
|
33
|
-
let need = baseTriple;
|
|
31
|
+
let need = { triple: baseTriple, text: base };
|
|
34
32
|
if (floor !== undefined) {
|
|
35
33
|
const own = releaseTriple(floor);
|
|
36
34
|
if (own === undefined) {
|
|
37
35
|
throw new TypeError(`${caller}: floor 只接受纯 x.y.z 版本串(整串、无前导零、无前后缀)或缺席 —— 收到 typeof=${floor === null ? 'null' : typeof floor}。错误文本只报形状,不回显值。`);
|
|
38
36
|
}
|
|
39
|
-
if (compareTriple(own, need) > 0)
|
|
40
|
-
need = own;
|
|
37
|
+
if (compareTriple(own, need.triple) > 0)
|
|
38
|
+
need = { triple: own, text: floor };
|
|
41
39
|
}
|
|
42
40
|
const got = releaseTriple(version);
|
|
43
41
|
if (got === undefined)
|
|
44
|
-
return 'unknown';
|
|
45
|
-
return compareTriple(got, need) >= 0 ? 'engine' : 'legacy';
|
|
42
|
+
return { need: need.text, tier: 'unknown' };
|
|
43
|
+
return { need: need.text, tier: compareTriple(got, need.triple) >= 0 ? 'engine' : 'legacy' };
|
|
46
44
|
}
|
|
47
45
|
export function engineVersionTier(version, floor) {
|
|
48
|
-
return
|
|
46
|
+
return judgeAgainst(version, SUPPORT_FLOOR.server, floor, 'engineVersionTier').tier;
|
|
47
|
+
}
|
|
48
|
+
export function engineSupportFloorEffective(floor) {
|
|
49
|
+
return judgeAgainst(undefined, SUPPORT_FLOOR.server, floor, 'engineSupportFloorEffective').need;
|
|
49
50
|
}
|
|
50
51
|
export function coreVersionTier(version, floor) {
|
|
51
|
-
return
|
|
52
|
+
return judgeAgainst(version, SUPPORT_FLOOR.core, floor, 'coreVersionTier').tier;
|
|
52
53
|
}
|
|
@@ -5,3 +5,4 @@ export interface SystemReminderOpenTagSpan {
|
|
|
5
5
|
export declare function findSystemReminderOpenTag(text: string, from?: number): SystemReminderOpenTagSpan | null;
|
|
6
6
|
export declare function unwrapSystemReminder(text: string): string;
|
|
7
7
|
export declare function stripSystemReminderBlocks(text: string): string;
|
|
8
|
+
export declare function stripSystemReminderTagTokens(text: string): string;
|
|
@@ -39,3 +39,11 @@ export function stripSystemReminderBlocks(text) {
|
|
|
39
39
|
}
|
|
40
40
|
return pos === 0 ? text : out + text.slice(pos);
|
|
41
41
|
}
|
|
42
|
+
const SYSTEM_REMINDER_TAG_TOKEN = /<[^A-Za-z0-9>]{0,12}system-reminder(?:[^>]{0,200}>)?/gi;
|
|
43
|
+
const SYSTEM_REMINDER_TAG_HEAD = /<[^A-Za-z0-9>]{0,12}system-reminder/i;
|
|
44
|
+
export function stripSystemReminderTagTokens(text) {
|
|
45
|
+
if (typeof text !== 'string')
|
|
46
|
+
return text;
|
|
47
|
+
const once = text.replace(SYSTEM_REMINDER_TAG_TOKEN, ' ');
|
|
48
|
+
return SYSTEM_REMINDER_TAG_HEAD.test(once) ? once.replace(/</g, '<') : once;
|
|
49
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SDKTaskUpdatedMessage } from '@sema-agent/agent-types';
|
|
2
|
+
import { CORE_TERMINAL_CAUSE_KINDS } from './generated/engineFactTables.js';
|
|
3
|
+
export { CORE_TERMINAL_CAUSE_KINDS };
|
|
4
|
+
export type CoreTerminalCauseKind = (typeof CORE_TERMINAL_CAUSE_KINDS)[number];
|
|
5
|
+
export declare function isCoreTerminalCauseKind(kind: unknown): kind is CoreTerminalCauseKind;
|
|
6
|
+
export declare const SDK_RUN_TERMINAL_STATUSES: readonly ["completed", "failed", "blocked", "timeout"];
|
|
7
|
+
export type SdkRunTerminalStatus = (typeof SDK_RUN_TERMINAL_STATUSES)[number];
|
|
8
|
+
export declare function isSdkRunTerminal(status: unknown): status is SdkRunTerminalStatus;
|
|
9
|
+
export declare function isSdkRunTerminalNotSuccess(status: unknown): status is Exclude<SdkRunTerminalStatus, 'completed'>;
|
|
10
|
+
export declare const SDK_PARKED_RUN_STATUSES: readonly ["suspended", "needs_review"];
|
|
11
|
+
export declare function isSdkRunParked(status: unknown): status is (typeof SDK_PARKED_RUN_STATUSES)[number];
|
|
12
|
+
export declare function isSdkRunFrameSynthesizable(status: unknown): boolean;
|
|
13
|
+
export declare const SDK_FLEET_TASK_TERMINAL_STATUSES: readonly ["completed", "failed", "killed"];
|
|
14
|
+
export type SdkFleetTaskTerminalStatus = (typeof SDK_FLEET_TASK_TERMINAL_STATUSES)[number];
|
|
15
|
+
export declare function isSdkFleetTaskTerminal(status: unknown): status is SdkFleetTaskTerminalStatus;
|
|
16
|
+
export declare function isSdkFleetTaskTerminalNotSuccess(status: unknown): status is Exclude<SdkFleetTaskTerminalStatus, 'completed'>;
|
|
17
|
+
export declare const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "cancelled"];
|
|
18
|
+
export type CoreTaskNotificationTerminalStatus = (typeof CORE_TASK_NOTIFICATION_TERMINAL_STATUSES)[number];
|
|
19
|
+
export declare function isCoreTaskNotificationTerminal(status: unknown): status is CoreTaskNotificationTerminalStatus;
|
|
20
|
+
export declare function isCoreTaskNotificationTerminalNotSuccess(status: unknown): status is Exclude<CoreTaskNotificationTerminalStatus, 'completed'>;
|
|
21
|
+
export declare const CORE_SEMA_TASK_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "cancelled"];
|
|
22
|
+
export type CoreSemaTaskTerminalStatus = (typeof CORE_SEMA_TASK_TERMINAL_STATUSES)[number];
|
|
23
|
+
export declare function isCoreSemaTaskTerminal(status: unknown): status is CoreSemaTaskTerminalStatus;
|
|
24
|
+
export declare const CORE_WORKFLOW_RUN_TERMINAL_STATUSES: readonly ["completed", "failed"];
|
|
25
|
+
export declare function isCoreWorkflowRunTerminal(status: unknown): status is (typeof CORE_WORKFLOW_RUN_TERMINAL_STATUSES)[number];
|
|
26
|
+
export declare const CORE_TASK_PROGRESS_TERMINAL_STATUSES: readonly ["completed", "failed"];
|
|
27
|
+
export declare function isCoreTaskProgressTerminal(status: unknown): status is (typeof CORE_TASK_PROGRESS_TERMINAL_STATUSES)[number];
|
|
28
|
+
export declare function isCoreTaskProgressTerminalNotSuccess(status: unknown): status is 'failed';
|
|
29
|
+
export type CcTaskTerminalStatus = Extract<NonNullable<SDKTaskUpdatedMessage['patch']['status']>, 'completed' | 'failed' | 'killed'>;
|
|
30
|
+
export declare function ccTaskTerminalStatusOf(status: unknown): CcTaskTerminalStatus | undefined;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CORE_TERMINAL_CAUSE_KINDS } from './generated/engineFactTables.js';
|
|
2
|
+
function memberOf(table, word) {
|
|
3
|
+
return typeof word === 'string' && table.includes(word);
|
|
4
|
+
}
|
|
5
|
+
function terminalNotSuccessOf(table, word) {
|
|
6
|
+
return word !== 'completed' && memberOf(table, word);
|
|
7
|
+
}
|
|
8
|
+
export { CORE_TERMINAL_CAUSE_KINDS };
|
|
9
|
+
export function isCoreTerminalCauseKind(kind) {
|
|
10
|
+
return memberOf(CORE_TERMINAL_CAUSE_KINDS, kind);
|
|
11
|
+
}
|
|
12
|
+
export const SDK_RUN_TERMINAL_STATUSES = Object.freeze(['completed', 'failed', 'blocked', 'timeout']);
|
|
13
|
+
export function isSdkRunTerminal(status) {
|
|
14
|
+
return memberOf(SDK_RUN_TERMINAL_STATUSES, status);
|
|
15
|
+
}
|
|
16
|
+
export function isSdkRunTerminalNotSuccess(status) {
|
|
17
|
+
return terminalNotSuccessOf(SDK_RUN_TERMINAL_STATUSES, status);
|
|
18
|
+
}
|
|
19
|
+
export const SDK_PARKED_RUN_STATUSES = Object.freeze(['suspended', 'needs_review']);
|
|
20
|
+
export function isSdkRunParked(status) {
|
|
21
|
+
return memberOf(SDK_PARKED_RUN_STATUSES, status);
|
|
22
|
+
}
|
|
23
|
+
export function isSdkRunFrameSynthesizable(status) {
|
|
24
|
+
return isSdkRunTerminal(status) || isSdkRunParked(status);
|
|
25
|
+
}
|
|
26
|
+
export const SDK_FLEET_TASK_TERMINAL_STATUSES = Object.freeze(['completed', 'failed', 'killed']);
|
|
27
|
+
export function isSdkFleetTaskTerminal(status) {
|
|
28
|
+
return memberOf(SDK_FLEET_TASK_TERMINAL_STATUSES, status);
|
|
29
|
+
}
|
|
30
|
+
export function isSdkFleetTaskTerminalNotSuccess(status) {
|
|
31
|
+
return terminalNotSuccessOf(SDK_FLEET_TASK_TERMINAL_STATUSES, status);
|
|
32
|
+
}
|
|
33
|
+
export const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze(['completed', 'failed', 'killed', 'cancelled']);
|
|
34
|
+
export function isCoreTaskNotificationTerminal(status) {
|
|
35
|
+
return memberOf(CORE_TASK_NOTIFICATION_TERMINAL_STATUSES, status);
|
|
36
|
+
}
|
|
37
|
+
export function isCoreTaskNotificationTerminalNotSuccess(status) {
|
|
38
|
+
return terminalNotSuccessOf(CORE_TASK_NOTIFICATION_TERMINAL_STATUSES, status);
|
|
39
|
+
}
|
|
40
|
+
export const CORE_SEMA_TASK_TERMINAL_STATUSES = Object.freeze(['completed', 'failed', 'killed', 'cancelled']);
|
|
41
|
+
export function isCoreSemaTaskTerminal(status) {
|
|
42
|
+
return memberOf(CORE_SEMA_TASK_TERMINAL_STATUSES, status);
|
|
43
|
+
}
|
|
44
|
+
export const CORE_WORKFLOW_RUN_TERMINAL_STATUSES = Object.freeze(['completed', 'failed']);
|
|
45
|
+
export function isCoreWorkflowRunTerminal(status) {
|
|
46
|
+
return memberOf(CORE_WORKFLOW_RUN_TERMINAL_STATUSES, status);
|
|
47
|
+
}
|
|
48
|
+
export const CORE_TASK_PROGRESS_TERMINAL_STATUSES = Object.freeze(['completed', 'failed']);
|
|
49
|
+
export function isCoreTaskProgressTerminal(status) {
|
|
50
|
+
return memberOf(CORE_TASK_PROGRESS_TERMINAL_STATUSES, status);
|
|
51
|
+
}
|
|
52
|
+
export function isCoreTaskProgressTerminalNotSuccess(status) {
|
|
53
|
+
return terminalNotSuccessOf(CORE_TASK_PROGRESS_TERMINAL_STATUSES, status);
|
|
54
|
+
}
|
|
55
|
+
const CC_TASK_TERMINAL_STATUS_OF = Object.freeze({
|
|
56
|
+
completed: 'completed',
|
|
57
|
+
failed: 'failed',
|
|
58
|
+
killed: 'killed',
|
|
59
|
+
cancelled: 'killed',
|
|
60
|
+
blocked: 'failed',
|
|
61
|
+
timeout: 'failed',
|
|
62
|
+
});
|
|
63
|
+
export function ccTaskTerminalStatusOf(status) {
|
|
64
|
+
return typeof status === 'string' && Object.hasOwn(CC_TASK_TERMINAL_STATUS_OF, status)
|
|
65
|
+
? CC_TASK_TERMINAL_STATUS_OF[status]
|
|
66
|
+
: undefined;
|
|
67
|
+
}
|
|
@@ -18,8 +18,6 @@ export declare const TOOL_HISTORY_MISMATCH_ANCHORS: readonly ToolHistoryMismatch
|
|
|
18
18
|
export declare function classifyToolHistoryMismatch(err: ToolHistoryErrorCarrier | null | undefined): ToolHistoryMismatch | null;
|
|
19
19
|
export declare const TOOL_HISTORY_REWIND_SENTENCE = "Run /rewind to recover the conversation.";
|
|
20
20
|
export declare function toolHistoryRepeatSentence(n: number): string;
|
|
21
|
-
type ConversationRewindVerdict = 'available' | 'unavailable' | 'unknown';
|
|
22
|
-
export declare function _wireConversationRewindJudge(judge: (engineBaseUrl: string) => ConversationRewindVerdict): void;
|
|
23
21
|
export declare function toolHistoryRewindOffered(declared: boolean | {
|
|
24
22
|
readonly engineBaseUrl: string;
|
|
25
23
|
} | undefined): boolean;
|
|
@@ -61,4 +59,3 @@ export type ToolHistoryRewindResolution<R> = {
|
|
|
61
59
|
undecidable: ToolHistoryUndecidableReason;
|
|
62
60
|
};
|
|
63
61
|
export declare function resolveToolHistoryRewindTarget<R extends ToolHistoryRow>(rows: readonly (R | null | undefined)[] | null | undefined, mismatch: ToolHistoryMismatch | null | undefined): ToolHistoryRewindResolution<R>;
|
|
64
|
-
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { rewindArchiveReadingAt, rewindConversationAvailability } from './rewindArchiveReading.js';
|
|
1
2
|
export const TOOL_HISTORY_MISMATCH_KINDS = Object.freeze([
|
|
2
3
|
'tool_use_without_result',
|
|
3
4
|
'orphan_tool_result',
|
|
@@ -224,10 +225,6 @@ export const TOOL_HISTORY_REWIND_SENTENCE = 'Run /rewind to recover the conversa
|
|
|
224
225
|
export function toolHistoryRepeatSentence(n) {
|
|
225
226
|
return `The same error has now happened ${n} times in a row; /rewind is the only way to recover this conversation.`;
|
|
226
227
|
}
|
|
227
|
-
let conversationRewindJudge;
|
|
228
|
-
export function _wireConversationRewindJudge(judge) {
|
|
229
|
-
conversationRewindJudge = judge;
|
|
230
|
-
}
|
|
231
228
|
export function toolHistoryRewindOffered(declared) {
|
|
232
229
|
const decl = declared;
|
|
233
230
|
if (decl === true)
|
|
@@ -238,10 +235,9 @@ export function toolHistoryRewindOffered(declared) {
|
|
|
238
235
|
if (Array.isArray(decl))
|
|
239
236
|
return false;
|
|
240
237
|
const base = decl.engineBaseUrl;
|
|
241
|
-
|
|
242
|
-
if (typeof base !== 'string' || base.length === 0 || judge === undefined)
|
|
238
|
+
if (typeof base !== 'string' || base.length === 0)
|
|
243
239
|
return true;
|
|
244
|
-
return
|
|
240
|
+
return rewindConversationAvailability(rewindArchiveReadingAt(base)) !== 'unavailable';
|
|
245
241
|
}
|
|
246
242
|
catch {
|
|
247
243
|
return true;
|
package/dist/toolResult.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const PROTOCOL_MARKERS: {
|
|
|
13
13
|
readonly delegationNoTextResult: "(no text result)";
|
|
14
14
|
readonly delegationTrailer: "Verify this result before concluding. If it leaves more to do, continue or delegate again.";
|
|
15
15
|
readonly delegationTrailerFork: "Verify this result before concluding. If it leaves more to do, continue the work yourself or fork again.";
|
|
16
|
+
readonly delegationFieldLine: RegExp;
|
|
16
17
|
readonly taskOutputLabel: RegExp;
|
|
17
18
|
readonly taskOutputStatus: RegExp;
|
|
18
19
|
readonly taskOutputHeadSlots: RegExp;
|
|
@@ -52,6 +53,10 @@ export type DelegationReportFrame = {
|
|
|
52
53
|
before: string;
|
|
53
54
|
after: string;
|
|
54
55
|
section: 'result' | 'partial_findings' | 'no_text_result';
|
|
56
|
+
status?: string;
|
|
57
|
+
error?: string;
|
|
58
|
+
stats?: string;
|
|
59
|
+
headRest?: string;
|
|
55
60
|
};
|
|
56
61
|
export declare function displayBody(text: unknown, origin?: DisplayBodyOrigin): DisplayBody | undefined;
|
|
57
62
|
export type ModelFacingTaskOutput = {
|
|
@@ -81,7 +86,7 @@ export declare function _resetBackgroundReceiptParseCountForTest(): void;
|
|
|
81
86
|
export type FlattenWireOutput = (output: unknown) => string;
|
|
82
87
|
export declare const TOOL_RESULT_DEGRADED_WIRE_NO_OUTPUT: "wire_carried_no_output";
|
|
83
88
|
export interface ToolResultBody {
|
|
84
|
-
content: unknown;
|
|
89
|
+
content: string | unknown[];
|
|
85
90
|
isError: boolean;
|
|
86
91
|
toolUseResult?: unknown;
|
|
87
92
|
degraded?: typeof TOOL_RESULT_DEGRADED_WIRE_NO_OUTPUT;
|