@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function subagentStateDetail(carrier: unknown): string | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { displayUntrusted } from '../displayUntrusted.js';
|
|
2
|
+
function own(v, key) {
|
|
3
|
+
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
4
|
+
return undefined;
|
|
5
|
+
try {
|
|
6
|
+
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
7
|
+
return d !== undefined && 'value' in d ? d.value : undefined;
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const finite = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : undefined);
|
|
14
|
+
const word = (v) => (typeof v === 'string' && v.trim() !== '' ? displayUntrusted(v, { max: 64 }) : undefined);
|
|
15
|
+
function span(ms) {
|
|
16
|
+
const s = Math.floor(ms / 1000);
|
|
17
|
+
if (s < 60)
|
|
18
|
+
return `${String(s)} s`;
|
|
19
|
+
const m = Math.floor(s / 60);
|
|
20
|
+
if (m < 60)
|
|
21
|
+
return `${String(m)} min`;
|
|
22
|
+
return `${String(Math.floor(m / 60))} h`;
|
|
23
|
+
}
|
|
24
|
+
export function subagentStateDetail(carrier) {
|
|
25
|
+
const st = own(carrier, 'agentState');
|
|
26
|
+
const status = word(own(st, 'status'));
|
|
27
|
+
if (status === undefined)
|
|
28
|
+
return undefined;
|
|
29
|
+
const readAt = finite(own(st, 'readAt'));
|
|
30
|
+
const last = finite(own(st, 'lastActivityAt'));
|
|
31
|
+
const activity = readAt !== undefined && last !== undefined && last <= readAt ? `last activity ${span(readAt - last)} ago` : 'last activity unknown';
|
|
32
|
+
const approval = own(st, 'approval');
|
|
33
|
+
const approvalState = word(own(approval, 'state'));
|
|
34
|
+
let approvalPart = '';
|
|
35
|
+
if (approvalState !== undefined) {
|
|
36
|
+
const deadline = finite(own(approval, 'deadline'));
|
|
37
|
+
const when = deadline === undefined || readAt === undefined ? '' : deadline > readAt ? ` (deadline in ${span(deadline - readAt)})` : ' (deadline passed)';
|
|
38
|
+
approvalPart = ` · approval ${approvalState}${when}`;
|
|
39
|
+
}
|
|
40
|
+
return `Subagent state: ${status} · ${activity}${approvalPart}`;
|
|
41
|
+
}
|
|
@@ -5,11 +5,26 @@ export type EngineCompactWireClient = {
|
|
|
5
5
|
runs: Pick<AgentClient['runs'], 'compact'>;
|
|
6
6
|
};
|
|
7
7
|
export type EngineCompactWire = EngineWireInjection<EngineCompactWireClient>;
|
|
8
|
+
export type EngineCompactOutcome = {
|
|
9
|
+
readonly kind: 'accepted';
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'refused';
|
|
12
|
+
readonly status: number;
|
|
13
|
+
readonly errorCode?: string;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'failed';
|
|
16
|
+
readonly detail: string;
|
|
17
|
+
readonly status?: number;
|
|
18
|
+
readonly unconfirmed?: true;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: 'offline';
|
|
21
|
+
};
|
|
8
22
|
export declare function isEngineCompactPending(sessionKey?: string): boolean;
|
|
9
23
|
export declare function resetManualCompactCapability(): void;
|
|
10
24
|
export declare function __resetEngineCompactArmForTests(): void;
|
|
11
25
|
export declare function requestEngineCompact(sessionKey?: string, opts?: {
|
|
12
26
|
wire?: EngineCompactWire;
|
|
27
|
+
onSettled?: (outcome: EngineCompactOutcome) => void;
|
|
13
28
|
}): 'fired' | 'armed' | 'offline' | 'unsupported';
|
|
14
29
|
export declare function onEngineTaskBound(taskId: string, sessionKey?: string, opts?: {
|
|
15
30
|
wire?: EngineCompactWire;
|
|
@@ -1,54 +1,39 @@
|
|
|
1
1
|
import { hostLog, hostTimersFor } from '../host.js';
|
|
2
|
-
import {
|
|
2
|
+
import { invokeHostCallbackIsolated } from '../hostCallbackGuard.js';
|
|
3
|
+
import { COMPACT_NOT_RUNNING, isUnavailableFaceCode } from '../engineErrorCodes.js';
|
|
4
|
+
import { surfaceCompactNotRunning } from '../hitl/hitlHostSurface.js';
|
|
5
|
+
import { wireFailureShapeOf, wireFailureTextsOf } from '../wireFailureShape.js';
|
|
6
|
+
import { clientHasVerbs, engineWireFor, INJECTED_WIRE_SETTLE_MS, noAnswerDetailFrom, settleInjected, } from '../engineWireFor.js';
|
|
3
7
|
import { activeEngineRunIdFor, engineSessionParamFor } from '../engineSessionParam.js';
|
|
4
8
|
import { DEFAULT_SESSION_KEY } from '../sessionSlot.js';
|
|
9
|
+
import { engineCapState, kickEngineCapsProbe } from '../engineCapsCache.js';
|
|
5
10
|
function usableCompactClient(client) {
|
|
6
11
|
return clientHasVerbs(client, [['capabilities'], ['runs', 'compact']]);
|
|
7
12
|
}
|
|
8
13
|
const COMPACT_PROBE_SETTLE_MS = 5000;
|
|
9
14
|
const pendingCompactKeys = new Set();
|
|
15
|
+
const pendingCompactSinks = new Map();
|
|
10
16
|
export function isEngineCompactPending(sessionKey = DEFAULT_SESSION_KEY) {
|
|
11
17
|
return pendingCompactKeys.has(sessionKey);
|
|
12
18
|
}
|
|
13
|
-
const manualCompactCapableByBase = new Map();
|
|
14
|
-
const capabilitiesProbeByBase = new Map();
|
|
15
19
|
function probeManualCompactCapability(wire) {
|
|
16
20
|
const base = wire.kind === 'injected' ? wire.capsBaseUrl : wire.target.baseUrl;
|
|
17
21
|
if (base === undefined)
|
|
18
22
|
return;
|
|
19
|
-
if (
|
|
23
|
+
if (wire.kind === 'injected') {
|
|
24
|
+
const injected = wire.client;
|
|
25
|
+
kickEngineCapsProbe(base, () => settleInjected(COMPACT_PROBE_SETTLE_MS, undefined, (signal) => injected.capabilities({ signal })));
|
|
20
26
|
return;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
caps = await settleInjected(COMPACT_PROBE_SETTLE_MS, undefined, (signal) => injected.capabilities({ signal }));
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
const client = wire.make({ timeoutMs: 5000 });
|
|
30
|
-
if (!client) {
|
|
31
|
-
capabilitiesProbeByBase.delete(base);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
caps = await client.capabilities();
|
|
35
|
-
}
|
|
36
|
-
if (typeof caps.manualCompact === 'boolean')
|
|
37
|
-
manualCompactCapableByBase.set(base, caps.manualCompact);
|
|
38
|
-
else
|
|
39
|
-
capabilitiesProbeByBase.delete(base);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
capabilitiesProbeByBase.delete(base);
|
|
43
|
-
}
|
|
44
|
-
})());
|
|
45
|
-
}
|
|
46
|
-
export function resetManualCompactCapability() {
|
|
47
|
-
manualCompactCapableByBase.clear();
|
|
48
|
-
capabilitiesProbeByBase.clear();
|
|
27
|
+
}
|
|
28
|
+
const client = wire.make({ timeoutMs: 5000 });
|
|
29
|
+
if (!client)
|
|
30
|
+
return;
|
|
31
|
+
kickEngineCapsProbe(base, () => client.capabilities());
|
|
49
32
|
}
|
|
33
|
+
export function resetManualCompactCapability() { }
|
|
50
34
|
export function __resetEngineCompactArmForTests() {
|
|
51
35
|
pendingCompactKeys.clear();
|
|
36
|
+
pendingCompactSinks.clear();
|
|
52
37
|
}
|
|
53
38
|
function deferFire(ms, fn, why, sessionKey) {
|
|
54
39
|
const timers = hostTimersFor(sessionKey);
|
|
@@ -80,26 +65,65 @@ function freezeCompactShot(taskId, sessionKey, wire) {
|
|
|
80
65
|
...(sid !== undefined ? { session: sid } : {}),
|
|
81
66
|
};
|
|
82
67
|
}
|
|
83
|
-
|
|
68
|
+
function emitCompactOutcome(sink, outcome) {
|
|
69
|
+
if (sink === undefined)
|
|
70
|
+
return;
|
|
71
|
+
void Promise.resolve().then(() => callSinkIsolated(sink, outcome));
|
|
72
|
+
}
|
|
73
|
+
function callSinkIsolated(sink, outcome) {
|
|
74
|
+
invokeHostCallbackIsolated('engineCompactWire: onSettled sink', () => sink(outcome));
|
|
75
|
+
}
|
|
76
|
+
function fanOutCompactSinks(sinks) {
|
|
77
|
+
if (sinks === undefined || sinks.length === 0)
|
|
78
|
+
return undefined;
|
|
79
|
+
return (outcome) => {
|
|
80
|
+
for (const s of sinks)
|
|
81
|
+
callSinkIsolated(s, outcome);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function compactFailureOutcomeOf(e) {
|
|
85
|
+
const shape = wireFailureShapeOf(e);
|
|
86
|
+
const status = typeof shape.status === 'number' && Number.isFinite(shape.status) ? shape.status : undefined;
|
|
87
|
+
const code = shape.errorCode !== undefined && shape.errorCode !== '' ? shape.errorCode : undefined;
|
|
88
|
+
if (status !== undefined) {
|
|
89
|
+
if ((status >= 400 && status < 500) || isUnavailableFaceCode(code)) {
|
|
90
|
+
return { kind: 'refused', status, ...(code !== undefined ? { errorCode: code } : {}) };
|
|
91
|
+
}
|
|
92
|
+
return { kind: 'failed', status, detail: wireFailureTextsOf(e).reason };
|
|
93
|
+
}
|
|
94
|
+
const noAnswer = typeof e === 'object' && e !== null ? noAnswerDetailFrom(e) : null;
|
|
95
|
+
if (noAnswer !== null)
|
|
96
|
+
return { kind: 'failed', detail: noAnswer, unconfirmed: true };
|
|
97
|
+
return { kind: 'failed', detail: wireFailureTextsOf(e).reason };
|
|
98
|
+
}
|
|
99
|
+
async function postCompact(shot, sink, retriesLeft = 1) {
|
|
84
100
|
const client = shot.client();
|
|
85
|
-
if (!client)
|
|
101
|
+
if (!client) {
|
|
102
|
+
emitCompactOutcome(sink, { kind: 'offline' });
|
|
86
103
|
return;
|
|
104
|
+
}
|
|
87
105
|
const taskId = shot.taskId;
|
|
88
106
|
try {
|
|
89
107
|
const fire = (signal) => client.runs.compact(taskId, { ...(shot.session !== undefined ? { session: shot.session } : {}), ...(signal ? { signal } : {}) });
|
|
90
108
|
const ack = shot.injected ? await settleInjected(INJECTED_WIRE_SETTLE_MS, undefined, fire) : await fire(undefined);
|
|
91
109
|
hostLog('debug', `engineCompactWire: POST compact ${taskId} → ok${ack?.status ? ` (${ack.status})` : ''}`);
|
|
110
|
+
emitCompactOutcome(sink, { kind: 'accepted' });
|
|
92
111
|
}
|
|
93
112
|
catch (e) {
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
hostLog('debug', `engineCompactWire: POST compact ${taskId} → ${status}`);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
return;
|
|
113
|
+
const outcome = compactFailureOutcomeOf(e);
|
|
114
|
+
if (outcome.kind === 'refused' || (outcome.kind === 'failed' && outcome.status !== undefined)) {
|
|
115
|
+
hostLog('debug', `engineCompactWire: POST compact ${taskId} → ${outcome.status}`);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
hostLog('debug', `engineCompactWire: compact fire failed (best-effort): ${wireFailureTextsOf(e).log}`);
|
|
101
119
|
}
|
|
102
|
-
|
|
120
|
+
if (outcome.kind === 'refused' && outcome.status === 404 && retriesLeft > 0) {
|
|
121
|
+
if (deferFire(2000, () => void postCompact(shot, sink, retriesLeft - 1), '404 单次重试', shot.sessionKey))
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (outcome.kind === 'refused' && outcome.errorCode === COMPACT_NOT_RUNNING)
|
|
125
|
+
surfaceCompactNotRunning(shot.sessionKey);
|
|
126
|
+
emitCompactOutcome(sink, outcome);
|
|
103
127
|
}
|
|
104
128
|
}
|
|
105
129
|
export function requestEngineCompact(sessionKey = DEFAULT_SESSION_KEY, opts) {
|
|
@@ -108,18 +132,29 @@ export function requestEngineCompact(sessionKey = DEFAULT_SESSION_KEY, opts) {
|
|
|
108
132
|
return 'offline';
|
|
109
133
|
probeManualCompactCapability(wire);
|
|
110
134
|
const capsKey = wire.kind === 'injected' ? wire.capsBaseUrl : wire.target.baseUrl;
|
|
111
|
-
if (capsKey
|
|
135
|
+
if (engineCapState(capsKey, 'manualCompact') === 'false') {
|
|
112
136
|
hostLog('debug', 'engineCompactWire: engine capabilities report manualCompact:false — verb suppressed (TOC-local runStore-less engine, [488])');
|
|
113
137
|
return 'unsupported';
|
|
114
138
|
}
|
|
115
139
|
const taskId = activeEngineRunIdFor(sessionKey);
|
|
140
|
+
const rawSink = opts?.onSettled;
|
|
141
|
+
const sink = typeof rawSink === 'function' ? rawSink : undefined;
|
|
116
142
|
if (taskId) {
|
|
117
143
|
const shot = freezeCompactShot(taskId, sessionKey, wire);
|
|
118
144
|
if (shot !== null)
|
|
119
|
-
void postCompact(shot);
|
|
145
|
+
void postCompact(shot, sink);
|
|
146
|
+
else
|
|
147
|
+
emitCompactOutcome(sink, { kind: 'offline' });
|
|
120
148
|
return 'fired';
|
|
121
149
|
}
|
|
122
150
|
pendingCompactKeys.add(sessionKey);
|
|
151
|
+
if (sink !== undefined) {
|
|
152
|
+
const sinks = pendingCompactSinks.get(sessionKey);
|
|
153
|
+
if (sinks === undefined)
|
|
154
|
+
pendingCompactSinks.set(sessionKey, [sink]);
|
|
155
|
+
else
|
|
156
|
+
sinks.push(sink);
|
|
157
|
+
}
|
|
123
158
|
return 'armed';
|
|
124
159
|
}
|
|
125
160
|
const BOUND_FIRE_DELAY_MS = 1500;
|
|
@@ -132,7 +167,9 @@ export function onEngineTaskBound(taskId, sessionKey = DEFAULT_SESSION_KEY, opts
|
|
|
132
167
|
const shot = freezeCompactShot(taskId, sessionKey, wire);
|
|
133
168
|
if (shot === null)
|
|
134
169
|
return;
|
|
135
|
-
|
|
170
|
+
const sink = fanOutCompactSinks(pendingCompactSinks.get(sessionKey));
|
|
171
|
+
if (deferFire(BOUND_FIRE_DELAY_MS, () => void postCompact(shot, sink), 'bind 后发射', sessionKey)) {
|
|
136
172
|
pendingCompactKeys.delete(sessionKey);
|
|
173
|
+
pendingCompactSinks.delete(sessionKey);
|
|
137
174
|
}
|
|
138
175
|
}
|
|
@@ -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,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,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_SESSION_KEY } from './sessionSlot.js';
|
|
1
2
|
export function coerceOutput(v) {
|
|
2
3
|
if (v === undefined || v === null)
|
|
3
4
|
return undefined;
|
|
@@ -648,7 +649,6 @@ export function getBgTerminalFacts(taskId) {
|
|
|
648
649
|
}
|
|
649
650
|
const MAX_BG_PARENT_RUNS = 320;
|
|
650
651
|
const bgParentRun = new Map();
|
|
651
|
-
const DEFAULT_OWNER_SLOT = '__default__';
|
|
652
652
|
let ownerSessionConflictCount = 0;
|
|
653
653
|
let lastOwnerSessionConflict;
|
|
654
654
|
const conflictQuarantine = new Map();
|
|
@@ -703,8 +703,8 @@ export function recordSubagentOwner(taskId, runId, sessionId, sessionKey) {
|
|
|
703
703
|
},
|
|
704
704
|
next: { ...nextPair },
|
|
705
705
|
};
|
|
706
|
-
const priorSlot = prior?.sessionKey ??
|
|
707
|
-
const nextSlot = nextPair.sessionKey ??
|
|
706
|
+
const priorSlot = prior?.sessionKey ?? DEFAULT_SESSION_KEY;
|
|
707
|
+
const nextSlot = nextPair.sessionKey ?? DEFAULT_SESSION_KEY;
|
|
708
708
|
if (priorSlot !== nextSlot) {
|
|
709
709
|
bgParentRun.delete(taskId);
|
|
710
710
|
if (conflictQuarantine.size >= MAX_BG_PARENT_RUNS && !conflictQuarantine.has(taskId)) {
|
package/dist/supportFloor.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
core: '7.35.2',
|
|
4
|
-
sdk: '12.0.1',
|
|
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];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { TaskRequest } from '@sema-agent/sdk';
|
|
2
2
|
export type TaskRequestReasoningEffort = NonNullable<TaskRequest['reasoningEffort']>;
|
|
3
3
|
export declare const REASONING_EFFORT_WORDS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
4
|
-
type
|
|
5
|
-
export
|
|
6
|
-
export declare const PERMISSION_MODE_WORDS: readonly ["default", "plan", "acceptEdits", "bypassPermissions", "auto", "dontAsk"];
|
|
4
|
+
export type TaskRequestPermissionMode = NonNullable<TaskRequest['permissionMode']>;
|
|
5
|
+
export declare const PERMISSION_MODE_WORDS: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions", "dontAsk"];
|
|
7
6
|
export interface RetiredAttachmentsKey {
|
|
8
7
|
readonly key: string;
|
|
9
8
|
readonly why: string;
|
|
@@ -11,4 +10,3 @@ export interface RetiredAttachmentsKey {
|
|
|
11
10
|
readonly remedy: string;
|
|
12
11
|
}
|
|
13
12
|
export declare function retiredAttachmentsKeyOf(nameOrToken: string, form?: 'token' | 'key'): RetiredAttachmentsKey | undefined;
|
|
14
|
-
export {};
|
package/dist/taskRequestWords.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { CORE_PERMISSION_MODES } from './generated/engineFactTables.js';
|
|
1
2
|
export const REASONING_EFFORT_WORDS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
2
|
-
export const PERMISSION_MODE_WORDS =
|
|
3
|
-
const _taskRequestWordPins = [true, true, true, true];
|
|
3
|
+
export const PERMISSION_MODE_WORDS = CORE_PERMISSION_MODES;
|
|
4
|
+
const _taskRequestWordPins = [true, true, true, true, true, true];
|
|
4
5
|
void _taskRequestWordPins;
|
|
5
6
|
export function retiredAttachmentsKeyOf(nameOrToken, form = 'token') {
|
|
6
7
|
const lower = nameOrToken.trim().toLowerCase();
|
|
@@ -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
|
+
}
|
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 = {
|