@sema-agent/client-core 0.97.1 → 0.99.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 +607 -0
- package/README.md +96 -46
- package/dist/adapt/arms.d.ts +1 -0
- package/dist/adapt/arms.js +188 -53
- package/dist/adapt/ids.d.ts +12 -1
- package/dist/adapt/ids.js +59 -8
- package/dist/adapt/instanceLedger.d.ts +50 -0
- package/dist/adapt/instanceLedger.js +147 -0
- package/dist/adapt/panelTasks.d.ts +1 -1
- package/dist/adapt/panelTasks.js +2 -2
- package/dist/adapt/textStream.d.ts +1 -0
- package/dist/adapt/textStream.js +24 -7
- package/dist/adapt/toolCards.d.ts +27 -5
- package/dist/adapt/toolCards.js +39 -6
- package/dist/adapt/wireShapes.js +6 -2
- package/dist/adapt.d.ts +2 -0
- package/dist/adapt.js +8 -3
- package/dist/adapter/activeRunSelfHeal.d.ts +9 -3
- package/dist/adapter/activeRunSelfHeal.js +205 -313
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +77 -36
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
- package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
- package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
- package/dist/adapter/runStream.js +79 -48
- package/dist/adapter/types.d.ts +4 -4
- package/dist/adapter/types.js +2 -1
- package/dist/agentSession/backgroundView.js +2 -1
- package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
- package/dist/agentSession/engineAgentRegistryRead.js +12 -13
- package/dist/agentSession/engineSessionBackgroundStop.js +16 -8
- package/dist/agentsWireCaps.d.ts +8 -11
- package/dist/agentsWireCaps.js +196 -194
- package/dist/approvalDecidedByCapability.d.ts +0 -4
- package/dist/approvalDecidedByCapability.js +0 -6
- package/dist/approvalsStreamLiveCapability.d.ts +0 -4
- package/dist/approvalsStreamLiveCapability.js +0 -6
- package/dist/assistantInbox.d.ts +34 -0
- package/dist/assistantInbox.js +118 -0
- package/dist/centerWiringCapability.js +9 -1
- package/dist/clientSlice.d.ts +0 -9
- package/dist/clientSlice.js +0 -3
- package/dist/cloudConfigWireCaps.d.ts +5 -3
- package/dist/cloudConfigWireCaps.js +106 -64
- package/dist/compensations.js +1 -1
- package/dist/connectorStatus.d.ts +21 -0
- package/dist/connectorStatus.js +112 -0
- package/dist/controlRouter.d.ts +18 -3
- package/dist/controlRouter.js +106 -67
- package/dist/coreValuePorts.d.ts +29 -4
- package/dist/coreValuePorts.js +10 -0
- package/dist/corruptSessionCopy.d.ts +2 -1
- package/dist/corruptSessionCopy.js +3 -3
- package/dist/decideReceipt.d.ts +2 -2
- package/dist/decideReceipt.js +5 -2
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/detachWire.js +3 -2
- package/dist/deviceExecutorManagementCapability.d.ts +0 -4
- package/dist/deviceExecutorManagementCapability.js +0 -6
- package/dist/deviceRebind.d.ts +49 -1
- package/dist/deviceRebind.js +221 -3
- package/dist/devicesFace.d.ts +34 -0
- package/dist/devicesFace.js +90 -0
- package/dist/displayUntrusted.d.ts +2 -0
- package/dist/displayUntrusted.js +253 -76
- package/dist/engineAgentAbsence.d.ts +1 -1
- package/dist/engineAgentPanelStore.d.ts +12 -4
- package/dist/engineAgentPanelStore.js +16 -11
- package/dist/engineCapReader.d.ts +2 -5
- package/dist/engineCapReader.js +8 -10
- package/dist/engineCapsCache.d.ts +12 -0
- package/dist/engineCapsCache.js +76 -18
- package/dist/engineCapsChange.d.ts +2 -0
- package/dist/engineCapsChange.js +9 -0
- package/dist/engineClosedSets.d.ts +1 -0
- package/dist/engineClosedSets.js +4 -1
- package/dist/engineErrorCodes.d.ts +11 -3
- package/dist/engineErrorCodes.js +11 -8
- package/dist/engineIdentity.d.ts +1 -0
- package/dist/engineIdentity.js +8 -0
- package/dist/engineRowRef.d.ts +28 -0
- package/dist/engineRowRef.js +114 -0
- package/dist/engineSessionMessages.d.ts +68 -0
- package/dist/engineSessionMessages.js +370 -0
- package/dist/engineTargetSeat.d.ts +27 -0
- package/dist/engineTargetSeat.js +199 -0
- package/dist/engineToolDirectory.d.ts +0 -9
- package/dist/engineToolDirectory.js +1 -94
- package/dist/engineUrl.d.ts +18 -0
- package/dist/engineUrl.js +52 -0
- package/dist/engineWireFor.js +3 -8
- package/dist/env/uiLanguage.d.ts +11 -1
- package/dist/env/uiLanguage.js +38 -2
- package/dist/eventLeg.d.ts +100 -0
- package/dist/eventLeg.js +305 -0
- package/dist/executionLaneCapability.d.ts +0 -4
- package/dist/executionLaneCapability.js +3 -16
- package/dist/fileHistoryCaptureCapability.d.ts +2 -5
- package/dist/fileHistoryCaptureCapability.js +13 -21
- package/dist/fileHistoryLegNotice.d.ts +2 -1
- package/dist/fileHistoryLegNotice.js +3 -3
- package/dist/fleet/fleetLedger.d.ts +0 -3
- package/dist/fleet/fleetLedger.js +21 -36
- package/dist/fleet/fleetProjection.d.ts +2 -2
- package/dist/fleet/fleetProjection.js +10 -8
- package/dist/frameBinding.d.ts +8 -0
- package/dist/frameBinding.js +35 -0
- package/dist/gateFailureCodes.d.ts +2 -0
- package/dist/gateFailureCodes.js +15 -0
- package/dist/gateOutcome.d.ts +3 -1
- package/dist/gateOutcome.js +41 -8
- package/dist/gateVocabulary.d.ts +10 -4
- package/dist/gateVocabulary.js +107 -47
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +22 -3
- package/dist/generated/engineFactTables.js +51 -4
- package/dist/generated/engineNoticeTables.js +18 -3
- package/dist/generated/settingsSchemaFns.d.ts +6 -0
- package/dist/generated/settingsSchemaFns.js +57 -0
- package/dist/generated/settingsSchemaHooksClassifier.d.ts +2 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +254 -0
- package/dist/generated/settingsSchemaTables.d.ts +1 -0
- package/dist/generated/settingsSchemaTables.js +4 -0
- package/dist/generated/settingsSchemaTypes.d.ts +105 -0
- package/dist/generated/settingsSchemaTypes.js +1 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +8 -2
- package/dist/hitl/allowRuleShadow.js +36 -29
- package/dist/hitl/approvalCardReading.d.ts +15 -0
- package/dist/hitl/approvalCardReading.js +154 -0
- package/dist/hitl/approvalCardReasons.d.ts +14 -0
- package/dist/hitl/approvalCardReasons.js +119 -0
- package/dist/hitl/approvalHolds.d.ts +50 -15
- package/dist/hitl/approvalHolds.js +177 -27
- package/dist/hitl/approvalResolution.d.ts +51 -26
- package/dist/hitl/approvalResolution.js +86 -122
- package/dist/hitl/approvalsFeed.js +6 -18
- package/dist/hitl/askClassPair.d.ts +2 -0
- package/dist/hitl/askClassPair.js +17 -0
- package/dist/hitl/askGateWire.d.ts +20 -2
- package/dist/hitl/askGateWire.js +50 -1
- package/dist/hitl/askParkRowRouting.d.ts +5 -0
- package/dist/hitl/askParkRowRouting.js +32 -1
- package/dist/hitl/askSettlementLine.d.ts +28 -0
- package/dist/hitl/askSettlementLine.js +99 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +3 -2
- package/dist/hitl/automaticAnswerVerdict.js +29 -13
- package/dist/hitl/crashConverged.d.ts +11 -20
- package/dist/hitl/crashConverged.js +56 -0
- package/dist/hitl/crashConvergedNotice.d.ts +6 -3
- package/dist/hitl/crashConvergedNotice.js +48 -24
- package/dist/hitl/decisionConflict.js +3 -10
- package/dist/hitl/decisionRefusal.d.ts +40 -1
- package/dist/hitl/decisionRefusal.js +199 -42
- package/dist/hitl/frameRouter.d.ts +5 -2
- package/dist/hitl/frameRouter.js +27 -24
- package/dist/hitl/gateLedger.d.ts +2 -0
- package/dist/hitl/gateLedger.js +50 -13
- package/dist/hitl/hitlBridge.d.ts +2 -2
- package/dist/hitl/hitlBridge.js +13 -10
- package/dist/hitl/livePendingAsk.d.ts +3 -3
- package/dist/hitl/livePendingAsk.js +7 -18
- package/dist/hitl/parkResolver.d.ts +2 -24
- package/dist/hitl/parkResolver.js +61 -97
- package/dist/hitl/persistedRulesWire.d.ts +25 -0
- package/dist/hitl/persistedRulesWire.js +104 -2
- package/dist/hitl/planReviewWire.d.ts +31 -13
- package/dist/hitl/planReviewWire.js +120 -78
- package/dist/hitl/refusedToolNameProse.d.ts +0 -1
- package/dist/hitl/refusedToolNameProse.js +0 -3
- package/dist/hitl/replayedApproval.d.ts +4 -3
- package/dist/hitl/replayedApproval.js +7 -4
- package/dist/hitl/sessionPolicyDeliverable.d.ts +2 -0
- package/dist/hitl/sessionPolicyDeliverable.js +48 -7
- package/dist/hitl/sessionPolicyWire.d.ts +34 -21
- package/dist/hitl/sessionPolicyWire.js +179 -70
- package/dist/hitl/standingRows.d.ts +20 -2
- package/dist/hitl/standingRows.js +69 -8
- package/dist/hitl/suspendedReopen.d.ts +2 -1
- package/dist/hitl/suspendedReopen.js +7 -10
- package/dist/hitl/toolApprovalWire.d.ts +103 -156
- package/dist/hitl/toolApprovalWire.js +661 -411
- package/dist/hookMatcherVerdict.d.ts +6 -1
- package/dist/hookMatcherVerdict.js +14 -7
- package/dist/hooksWireCaps.d.ts +2 -2
- package/dist/hooksWireCaps.js +174 -81
- package/dist/host.d.ts +21 -0
- package/dist/hostTurnSettings.d.ts +71 -0
- package/dist/hostTurnSettings.js +291 -0
- package/dist/humanTurn.d.ts +14 -1
- package/dist/humanTurn.js +100 -12
- package/dist/humanTurnRead.d.ts +2 -0
- package/dist/humanTurnRead.js +22 -1
- package/dist/i18n/messages.en.d.ts +703 -0
- package/dist/i18n/messages.en.js +701 -0
- package/dist/i18n/messages.zh.d.ts +3 -0
- package/dist/i18n/messages.zh.js +837 -0
- package/dist/i18n/translate.d.ts +25 -0
- package/dist/i18n/translate.js +127 -0
- package/dist/index.d.ts +78 -29
- package/dist/index.js +54 -18
- package/dist/inheritEnvCapability.d.ts +32 -0
- package/dist/inheritEnvCapability.js +104 -0
- package/dist/inheritEnvWire.d.ts +3 -2
- package/dist/inheritEnvWire.js +12 -14
- package/dist/interactiveHalt.js +17 -6
- package/dist/liveModelCatalog.d.ts +3 -3
- package/dist/liveModelCatalog.js +15 -13
- package/dist/liveQuestionStore.d.ts +2 -21
- package/dist/mcpLiveness.d.ts +2 -1
- package/dist/mcpPanel.d.ts +10 -1
- package/dist/mcpPanel.js +40 -13
- package/dist/mcpProbeCapability.d.ts +2 -1
- package/dist/mcpProbeCapability.js +7 -11
- package/dist/mcpProbeWire.d.ts +9 -2
- package/dist/mcpProbeWire.js +6 -1
- package/dist/mcpWireCaps.d.ts +47 -2
- package/dist/mcpWireCaps.js +164 -16
- package/dist/memoryEntriesWire.d.ts +4 -9
- package/dist/memoryEntriesWire.js +5 -10
- package/dist/model/modelSupplyRules.d.ts +0 -2
- package/dist/model/modelSupplyRules.js +3 -12
- package/dist/model/modelsPolicy.d.ts +0 -5
- package/dist/model/modelsPolicy.js +6 -36
- package/dist/model/onboardJudgement.d.ts +93 -0
- package/dist/model/onboardJudgement.js +415 -0
- package/dist/model/subagentModelWord.d.ts +31 -0
- package/dist/model/subagentModelWord.js +261 -0
- package/dist/model/tierVocabulary.d.ts +2 -0
- package/dist/model/tierVocabulary.js +17 -5
- package/dist/modelCapabilityProbe.d.ts +64 -0
- package/dist/modelCapabilityProbe.js +600 -0
- package/dist/modelIdentityResolvability.d.ts +3 -0
- package/dist/modelIdentityResolvability.js +26 -17
- package/dist/notifications.d.ts +6 -0
- package/dist/notifications.js +71 -23
- package/dist/outputStyleSeatCapability.d.ts +0 -3
- package/dist/outputStyleSeatCapability.js +0 -3
- package/dist/ownKey.d.ts +22 -0
- package/dist/ownKey.js +94 -3
- package/dist/panelReduce.d.ts +21 -10
- package/dist/panelReduce.js +728 -550
- package/dist/panelStateHolder.d.ts +3 -7
- package/dist/panelStateHolder.js +14 -130
- package/dist/peerLaneCapability.d.ts +0 -4
- package/dist/peerLaneCapability.js +0 -6
- package/dist/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.d.ts +2 -5
- package/dist/permissionRulesWriteCapability.js +8 -12
- package/dist/permissionWireCaps.d.ts +2 -2
- package/dist/permissionWireCaps.js +2 -0
- package/dist/permissionsAllowGrantCapability.d.ts +0 -4
- package/dist/permissionsAllowGrantCapability.js +0 -6
- package/dist/permissionsDeclaration.d.ts +0 -11
- package/dist/permissionsDeclaration.js +60 -53
- package/dist/pluginHooksWire.d.ts +46 -3
- package/dist/pluginHooksWire.js +219 -16
- package/dist/preemptWire.d.ts +44 -0
- package/dist/preemptWire.js +83 -0
- package/dist/printModelStatus.d.ts +63 -0
- package/dist/printModelStatus.js +155 -0
- package/dist/printToolResultFrame.js +15 -4
- package/dist/replayBody.d.ts +3 -0
- package/dist/replayBody.js +14 -0
- package/dist/request/taskRequest.d.ts +11 -6
- package/dist/request/taskRequest.js +112 -19
- package/dist/resumeRefusalCopy.d.ts +13 -9
- package/dist/resumeRefusalCopy.js +81 -118
- package/dist/retryStatus.d.ts +45 -0
- package/dist/retryStatus.js +185 -1
- package/dist/rewindArchiveCapability.d.ts +0 -4
- package/dist/rewindArchiveCapability.js +2 -10
- package/dist/rewindArchiveReading.d.ts +0 -1
- package/dist/rewindArchiveReading.js +0 -3
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +4 -2
- package/dist/runReattachPolicy.d.ts +31 -0
- package/dist/runReattachPolicy.js +46 -0
- package/dist/runTerminal.d.ts +3 -6
- package/dist/runTerminal.js +8 -9
- package/dist/sandboxWire.d.ts +3 -1
- package/dist/sandboxWire.js +76 -27
- package/dist/scenarioRefusal.d.ts +9 -0
- package/dist/scenarioRefusal.js +111 -0
- package/dist/scenarioWire.js +1 -1
- package/dist/seam.d.ts +48 -2
- package/dist/seam.js +25 -4
- package/dist/seatContract.d.ts +311 -18
- package/dist/seatContract.js +824 -100
- package/dist/selfOrchestrationDenial.js +7 -19
- package/dist/sessionIdSegment.d.ts +6 -0
- package/dist/sessionIdSegment.js +24 -0
- package/dist/sessionMemoryStatus.js +6 -11
- package/dist/sessionPolicyCapability.d.ts +2 -5
- package/dist/sessionPolicyCapability.js +8 -12
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
- package/dist/sessionSyncFileHistoryCapability.js +0 -3
- package/dist/settingsHooksSalvage.d.ts +44 -0
- package/dist/settingsHooksSalvage.js +211 -0
- package/dist/skillToolListsCapability.d.ts +2 -4
- package/dist/skillToolListsCapability.js +8 -9
- package/dist/sqlEngineCapability.d.ts +0 -4
- package/dist/sqlEngineCapability.js +0 -6
- package/dist/sseIdleTriage.js +3 -2
- package/dist/steerPriorityCapability.d.ts +0 -3
- package/dist/steerPriorityCapability.js +0 -3
- package/dist/streamDrainingLegs.d.ts +4 -0
- package/dist/streamDrainingLegs.js +6 -1
- package/dist/subagent/engineCompactWire.d.ts +0 -1
- package/dist/subagent/engineCompactWire.js +7 -5
- package/dist/subagent/engineSubagentResume.js +15 -9
- package/dist/subagent/engineTaskHandleWire.js +4 -7
- package/dist/subagentContentStore.d.ts +3 -0
- package/dist/subagentContentStore.js +22 -10
- package/dist/submitReopen.d.ts +24 -0
- package/dist/submitReopen.js +75 -0
- package/dist/terminalStatuses.d.ts +3 -0
- package/dist/terminalStatuses.js +10 -2
- package/dist/toolHistoryMismatch.js +3 -2
- package/dist/toolResult.d.ts +10 -1
- package/dist/toolResult.js +34 -6
- package/dist/toolRoster.d.ts +3 -4
- package/dist/toolRoster.js +21 -22
- package/dist/turnFailurePresentation.d.ts +39 -0
- package/dist/turnFailurePresentation.js +402 -0
- package/dist/usageAnalytics.js +6 -11
- package/dist/userAttachmentEnvelope.d.ts +1 -0
- package/dist/userAttachmentEnvelope.js +37 -7
- package/dist/userAttachmentSeat.d.ts +21 -0
- package/dist/userAttachmentSeat.js +75 -0
- package/dist/userInvokedSkillsCapability.d.ts +11 -4
- package/dist/userInvokedSkillsCapability.js +31 -10
- package/dist/webSearchBackendCapability.d.ts +0 -4
- package/dist/webSearchBackendCapability.js +0 -6
- package/dist/wireErrorTriage.d.ts +7 -0
- package/dist/wireErrorTriage.js +26 -23
- package/dist/wireFailureShape.d.ts +62 -5
- package/dist/wireFailureShape.js +106 -5
- package/dist/wireRefusalCopy.d.ts +25 -3
- package/dist/wireRefusalCopy.js +74 -80
- package/dist/workflowsJournalCapability.d.ts +2 -5
- package/dist/workflowsJournalCapability.js +8 -12
- package/dist/writeProtectionCapability.d.ts +0 -4
- package/dist/writeProtectionCapability.js +0 -6
- package/docs/INTEGRATION-CLIENTS.md +1775 -56
- package/package.json +6 -5
- package/dist/attachmentSeatCapability.d.ts +0 -12
- package/dist/attachmentSeatCapability.js +0 -23
- package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
- package/dist/hitl/approvalOutcomeNote.js +0 -29
- package/dist/sessionReadRedactionCapability.d.ts +0 -13
- package/dist/sessionReadRedactionCapability.js +0 -35
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
1
2
|
interface EngineCapReaderSpec<R> {
|
|
2
3
|
name: string;
|
|
3
4
|
project: (caps: unknown) => R | undefined;
|
|
@@ -9,14 +10,10 @@ type ReaderUnreadable = {
|
|
|
9
10
|
kind: 'unreadable';
|
|
10
11
|
};
|
|
11
12
|
interface EngineCapReader<R> {
|
|
12
|
-
note(baseUrl: string, caps: unknown, opts?: {
|
|
13
|
-
generation?: number;
|
|
14
|
-
}): void;
|
|
15
13
|
observed(baseUrl: string | undefined): R | ReaderUnobserved | ReaderUnreadable;
|
|
16
|
-
__resetForTests(): void;
|
|
17
14
|
}
|
|
18
15
|
export declare function createEngineCapReader<R>(spec: EngineCapReaderSpec<R>): EngineCapReader<R>;
|
|
19
|
-
export declare function unreadableReadingDetail(subject?: string): string;
|
|
16
|
+
export declare function unreadableReadingDetail(subject?: string, lang?: UiLanguage): string;
|
|
20
17
|
export type StoreSeat = {
|
|
21
18
|
kind: 'object';
|
|
22
19
|
store: object;
|
package/dist/engineCapReader.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { engineCapsLandingOf } from './engineCapsCache.js';
|
|
2
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
2
3
|
import { ownDataField } from './ownKey.js';
|
|
3
|
-
const
|
|
4
|
-
const
|
|
4
|
+
const UNOBSERVED = Object.freeze({ kind: 'unobserved' });
|
|
5
|
+
const UNREADABLE = Object.freeze({ kind: 'unreadable' });
|
|
6
|
+
const unobserved = () => UNOBSERVED;
|
|
7
|
+
const unreadable = () => UNREADABLE;
|
|
5
8
|
function freezeReading(reading, seen = new Set()) {
|
|
6
9
|
if (reading === null || typeof reading !== 'object' || seen.has(reading))
|
|
7
10
|
return reading;
|
|
@@ -15,9 +18,8 @@ function freezeReading(reading, seen = new Set()) {
|
|
|
15
18
|
}
|
|
16
19
|
const PROJECTING = Symbol('projecting');
|
|
17
20
|
export function createEngineCapReader(spec) {
|
|
18
|
-
|
|
21
|
+
const memo = new WeakMap();
|
|
19
22
|
return {
|
|
20
|
-
note(_baseUrl, _caps, _opts) { },
|
|
21
23
|
observed(baseUrl) {
|
|
22
24
|
if (typeof baseUrl !== 'string' || baseUrl === '')
|
|
23
25
|
return unobserved();
|
|
@@ -48,14 +50,10 @@ export function createEngineCapReader(spec) {
|
|
|
48
50
|
mine.set(landing, done);
|
|
49
51
|
return done.reading === undefined ? unreadable() : done.reading;
|
|
50
52
|
},
|
|
51
|
-
__resetForTests() {
|
|
52
|
-
memo = new WeakMap();
|
|
53
|
-
},
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
|
-
export function unreadableReadingDetail(subject) {
|
|
57
|
-
|
|
58
|
-
return `${head} — the engine's /v1/capabilities report arrived, but this entry is not in a form this client reads, so it is shown as unknown, not as absent; probing the same engine again will not change it while the engine reports it this way`;
|
|
55
|
+
export function unreadableReadingDetail(subject, lang) {
|
|
56
|
+
return renderMessage(typeof subject === 'string' && subject.length > 0 ? msg('notice.capability.unreadable.subject', { subject }) : msg('notice.capability.unreadable.bare'), lang);
|
|
59
57
|
}
|
|
60
58
|
export function storeSeatOf(caps) {
|
|
61
59
|
try {
|
|
@@ -6,6 +6,11 @@ export type EngineCapsLanding = {
|
|
|
6
6
|
} | {
|
|
7
7
|
readonly kind: 'unreadable';
|
|
8
8
|
};
|
|
9
|
+
export interface EngineCapsChange {
|
|
10
|
+
readonly kind: 'landed' | 'invalidated' | 'replaced';
|
|
11
|
+
readonly baseUrl: string;
|
|
12
|
+
readonly generation: number;
|
|
13
|
+
}
|
|
9
14
|
export declare function engineCapsGeneration(baseUrl: string): number;
|
|
10
15
|
export declare function engineCapsLandingOf(baseUrl: string | undefined): EngineCapsLanding;
|
|
11
16
|
export declare function kickEngineCapsProbe(baseUrl: string, probe: () => Promise<unknown>): void;
|
|
@@ -18,6 +23,10 @@ export declare function engineCapStateVia(baseUrl: string | undefined, key: stri
|
|
|
18
23
|
withinMs?: number;
|
|
19
24
|
signal?: AbortSignal;
|
|
20
25
|
}): Promise<EngineCapState>;
|
|
26
|
+
export declare function engineCapValueVia(baseUrl: string | undefined, key: string, probe: (signal?: AbortSignal) => Promise<object | null | undefined>, opts?: {
|
|
27
|
+
withinMs?: number;
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}): Promise<EngineCapValueState>;
|
|
21
30
|
export declare function engineCapTrue(baseUrl: string | undefined, key: string): boolean;
|
|
22
31
|
export declare function engineCapNestedTrue(baseUrl: string | undefined, parentKey: string, key: string): boolean;
|
|
23
32
|
export declare function engineCapNestedValue(baseUrl: string | undefined, parentKey: string, key: string): EngineCapValueState;
|
|
@@ -38,6 +47,9 @@ export declare function engineCapString(baseUrl: string | undefined, key: string
|
|
|
38
47
|
export declare function invalidateEngineCaps(baseUrl: string | undefined, probe?: () => Promise<unknown>): void;
|
|
39
48
|
export type EngineCapsProbeRotation = 'started' | 'registered' | 'ignored';
|
|
40
49
|
export declare function rotateEngineCapsProbe(baseUrl: string | undefined, probe: () => Promise<unknown>): EngineCapsProbeRotation;
|
|
50
|
+
export type EngineCapsReprobe = 'reprobed' | 'no_probe' | 'ignored';
|
|
51
|
+
export declare function invalidateEngineCapsAndReprobe(baseUrl: string | undefined): EngineCapsReprobe;
|
|
52
|
+
export declare function registerCapsChangeDelivery(baseUrl: string | undefined, deliver: (change: EngineCapsChange) => void): () => void;
|
|
41
53
|
export declare function refreshEngineCapsOnce(baseUrl: string | undefined, opts?: {
|
|
42
54
|
withinMs?: number;
|
|
43
55
|
}): Promise<'settled' | 'timed_out' | 'no_probe'>;
|
package/dist/engineCapsCache.js
CHANGED
|
@@ -4,11 +4,11 @@ const NOT_LANDED = Object.freeze({ kind: 'not_landed' });
|
|
|
4
4
|
const capsByBase = new Map();
|
|
5
5
|
const inFlight = new Set();
|
|
6
6
|
const settleByBase = new Map();
|
|
7
|
-
const
|
|
7
|
+
const stateByBase = new Map();
|
|
8
8
|
const probeByBase = new Map();
|
|
9
9
|
const refreshByBase = new Map();
|
|
10
10
|
function capsGeneration(baseUrl) {
|
|
11
|
-
return
|
|
11
|
+
return stateByBase.get(baseUrl)?.gen ?? 0;
|
|
12
12
|
}
|
|
13
13
|
export function engineCapsGeneration(baseUrl) {
|
|
14
14
|
return capsGeneration(baseUrl);
|
|
@@ -169,6 +169,7 @@ function landCapsSnapshot(baseUrl, gen, caps) {
|
|
|
169
169
|
? Object.freeze({ kind: 'unreadable' })
|
|
170
170
|
: Object.freeze({ kind: 'landed', caps: snapshot });
|
|
171
171
|
capsByBase.set(baseUrl, record);
|
|
172
|
+
publishCapsChange(baseUrl, 'landed');
|
|
172
173
|
return 'landed';
|
|
173
174
|
}
|
|
174
175
|
function snapshotCapsBody(body) {
|
|
@@ -197,7 +198,7 @@ function snapshotCapsBody(body) {
|
|
|
197
198
|
length = ld.value;
|
|
198
199
|
}
|
|
199
200
|
const proto = isArray ? null : Object.getPrototypeOf(src);
|
|
200
|
-
out = isArray ? new Array(length) : proto
|
|
201
|
+
out = isArray ? new Array(length) : isPlainRecordPrototype(proto) ? {} : Object.create(FOREIGN_PROTOTYPE);
|
|
201
202
|
}
|
|
202
203
|
catch {
|
|
203
204
|
return UNREADABLE_NODE;
|
|
@@ -257,9 +258,6 @@ function slotInLanding(landing, key) {
|
|
|
257
258
|
return capSlotIn(landing.caps, key);
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
|
-
function capStateIn(caps, key) {
|
|
261
|
-
return stateOfSlot(capSlotIn(caps, key));
|
|
262
|
-
}
|
|
263
261
|
function stateOfSlot(slot) {
|
|
264
262
|
switch (slot.kind) {
|
|
265
263
|
case 'unobserved':
|
|
@@ -293,24 +291,30 @@ async function untilSettledOrAborted(p, signal) {
|
|
|
293
291
|
}
|
|
294
292
|
}
|
|
295
293
|
export async function engineCapStateVia(baseUrl, key, probe, opts) {
|
|
294
|
+
return stateOfSlot(await capSlotVia(baseUrl, key, probe, opts));
|
|
295
|
+
}
|
|
296
|
+
export async function engineCapValueVia(baseUrl, key, probe, opts) {
|
|
297
|
+
return valueStateOfSlot(await capSlotVia(baseUrl, key, probe, opts));
|
|
298
|
+
}
|
|
299
|
+
async function capSlotVia(baseUrl, key, probe, opts) {
|
|
296
300
|
const signal = opts?.signal;
|
|
297
301
|
if (!baseUrl) {
|
|
298
302
|
try {
|
|
299
303
|
if (signal?.aborted)
|
|
300
|
-
return
|
|
304
|
+
return SLOT_UNOBSERVED;
|
|
301
305
|
const body = await probe(signal);
|
|
302
|
-
return isPlainCapsBody(body) ?
|
|
306
|
+
return isPlainCapsBody(body) ? capSlotIn(body, key) : SLOT_UNOBSERVED;
|
|
303
307
|
}
|
|
304
308
|
catch {
|
|
305
|
-
return
|
|
309
|
+
return SLOT_UNOBSERVED;
|
|
306
310
|
}
|
|
307
311
|
}
|
|
308
|
-
const now =
|
|
309
|
-
if (now !== '
|
|
312
|
+
const now = slotInLanding(engineCapsLandingOf(baseUrl), key);
|
|
313
|
+
if (now.kind !== 'unobserved')
|
|
310
314
|
return now;
|
|
311
315
|
kickEngineCapsProbe(baseUrl, () => probe());
|
|
312
316
|
await untilSettledOrAborted(engineCapsSettled(baseUrl, opts?.withinMs !== undefined ? { withinMs: opts.withinMs } : undefined), signal);
|
|
313
|
-
return
|
|
317
|
+
return slotInLanding(engineCapsLandingOf(baseUrl), key);
|
|
314
318
|
}
|
|
315
319
|
export function engineCapTrue(baseUrl, key) {
|
|
316
320
|
return engineCapState(baseUrl, key) === 'true';
|
|
@@ -352,18 +356,25 @@ export function invalidateEngineCaps(baseUrl, probe) {
|
|
|
352
356
|
return;
|
|
353
357
|
if (probe === undefined)
|
|
354
358
|
probeByBase.delete(baseUrl);
|
|
355
|
-
const
|
|
359
|
+
const hadLanding = capsByBase.has(baseUrl);
|
|
360
|
+
const hadState = hadLanding ||
|
|
356
361
|
inFlight.has(baseUrl) ||
|
|
357
362
|
settleByBase.has(baseUrl) ||
|
|
358
|
-
|
|
363
|
+
stateByBase.get(baseUrl)?.gen !== undefined;
|
|
359
364
|
if (hadState) {
|
|
360
|
-
|
|
365
|
+
const st = stateByBase.get(baseUrl);
|
|
366
|
+
if (st === undefined)
|
|
367
|
+
stateByBase.set(baseUrl, { gen: 1, subscribers: new Set() });
|
|
368
|
+
else
|
|
369
|
+
st.gen = capsGeneration(baseUrl) + 1;
|
|
361
370
|
capsByBase.delete(baseUrl);
|
|
362
371
|
inFlight.delete(baseUrl);
|
|
363
372
|
settleByBase.get(baseUrl)?.wake();
|
|
364
373
|
}
|
|
365
374
|
if (probe !== undefined)
|
|
366
375
|
kickEngineCapsProbe(baseUrl, probe);
|
|
376
|
+
if (hadLanding)
|
|
377
|
+
publishCapsChange(baseUrl, probe !== undefined ? 'replaced' : 'invalidated');
|
|
367
378
|
}
|
|
368
379
|
export function rotateEngineCapsProbe(baseUrl, probe) {
|
|
369
380
|
try {
|
|
@@ -378,6 +389,51 @@ export function rotateEngineCapsProbe(baseUrl, probe) {
|
|
|
378
389
|
return 'ignored';
|
|
379
390
|
}
|
|
380
391
|
}
|
|
392
|
+
export function invalidateEngineCapsAndReprobe(baseUrl) {
|
|
393
|
+
try {
|
|
394
|
+
if (typeof baseUrl !== 'string' || baseUrl === '')
|
|
395
|
+
return 'ignored';
|
|
396
|
+
const probe = probeByBase.get(baseUrl);
|
|
397
|
+
if (probe === undefined)
|
|
398
|
+
return 'no_probe';
|
|
399
|
+
invalidateEngineCaps(baseUrl, probe);
|
|
400
|
+
return 'reprobed';
|
|
401
|
+
}
|
|
402
|
+
catch {
|
|
403
|
+
return 'ignored';
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
export function registerCapsChangeDelivery(baseUrl, deliver) {
|
|
407
|
+
if (typeof baseUrl !== 'string' || baseUrl === '' || typeof deliver !== 'function')
|
|
408
|
+
return () => { };
|
|
409
|
+
let st = stateByBase.get(baseUrl);
|
|
410
|
+
if (st === undefined) {
|
|
411
|
+
st = { gen: undefined, subscribers: new Set() };
|
|
412
|
+
stateByBase.set(baseUrl, st);
|
|
413
|
+
}
|
|
414
|
+
const sub = { deliver, live: true };
|
|
415
|
+
const owner = st;
|
|
416
|
+
owner.subscribers.add(sub);
|
|
417
|
+
return () => {
|
|
418
|
+
if (!sub.live)
|
|
419
|
+
return;
|
|
420
|
+
sub.live = false;
|
|
421
|
+
owner.subscribers.delete(sub);
|
|
422
|
+
if (owner.subscribers.size === 0 && owner.gen === undefined && stateByBase.get(baseUrl) === owner)
|
|
423
|
+
stateByBase.delete(baseUrl);
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
function publishCapsChange(baseUrl, kind) {
|
|
427
|
+
const subs = stateByBase.get(baseUrl)?.subscribers;
|
|
428
|
+
if (subs === undefined || subs.size === 0)
|
|
429
|
+
return;
|
|
430
|
+
const change = Object.freeze({ kind, baseUrl, generation: capsGeneration(baseUrl) });
|
|
431
|
+
for (const sub of [...subs]) {
|
|
432
|
+
if (!sub.live)
|
|
433
|
+
continue;
|
|
434
|
+
sub.deliver(change);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
381
437
|
export async function refreshEngineCapsOnce(baseUrl, opts) {
|
|
382
438
|
try {
|
|
383
439
|
if (typeof baseUrl !== 'string' || baseUrl === '')
|
|
@@ -424,8 +480,7 @@ function isPlainCapsBody(caps) {
|
|
|
424
480
|
return false;
|
|
425
481
|
if (Array.isArray(caps))
|
|
426
482
|
return false;
|
|
427
|
-
|
|
428
|
-
if (proto !== null && Object.getPrototypeOf(proto) !== null)
|
|
483
|
+
if (!isPlainRecordPrototype(Object.getPrototypeOf(caps)))
|
|
429
484
|
return false;
|
|
430
485
|
for (const key of Reflect.ownKeys(caps))
|
|
431
486
|
Object.getOwnPropertyDescriptor(caps, key);
|
|
@@ -435,6 +490,9 @@ function isPlainCapsBody(caps) {
|
|
|
435
490
|
return false;
|
|
436
491
|
}
|
|
437
492
|
}
|
|
493
|
+
function isPlainRecordPrototype(proto) {
|
|
494
|
+
return proto === null || (typeof proto === 'object' && Object.getPrototypeOf(proto) === null);
|
|
495
|
+
}
|
|
438
496
|
async function awaitRefreshWithin(entry, budget) {
|
|
439
497
|
if (budget === undefined) {
|
|
440
498
|
await entry.promise;
|
|
@@ -449,7 +507,7 @@ export function __resetEngineCapsCacheForTests() {
|
|
|
449
507
|
capsByBase.clear();
|
|
450
508
|
inFlight.clear();
|
|
451
509
|
settleByBase.clear();
|
|
452
|
-
|
|
510
|
+
stateByBase.clear();
|
|
453
511
|
probeByBase.clear();
|
|
454
512
|
refreshByBase.clear();
|
|
455
513
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { registerCapsChangeDelivery } from './engineCapsCache.js';
|
|
2
|
+
import { invokeHostCallbackIsolated } from './hostCallbackGuard.js';
|
|
3
|
+
export function onEngineCapsChange(baseUrl, listener) {
|
|
4
|
+
if (typeof listener !== 'function')
|
|
5
|
+
return () => { };
|
|
6
|
+
return registerCapsChangeDelivery(baseUrl, (change) => {
|
|
7
|
+
invokeHostCallbackIsolated('engineCapsChange: listener', () => listener(change));
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const ASK_EVIDENCE_ABSENCE_VALUES: readonly ["not_wired", "not_adjudicated", "unavailable", "no_match", "not_reported"];
|
|
2
2
|
export declare const SYSTEM_INJECTION_PRIORITIES: readonly ["now", "next", "later"];
|
|
3
|
+
export declare const BUILTIN_SUBAGENT_TYPES: readonly ["Explore", "Plan", "fork", "general-purpose"];
|
package/dist/engineClosedSets.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { CORE_ASK_EVIDENCE_ABSENCE_VALUES, CORE_SYSTEM_INJECTION_PRIORITIES } from './generated/engineFactTables.js';
|
|
1
|
+
import { CORE_ASK_EVIDENCE_ABSENCE_VALUES, CORE_BUILTIN_SUBAGENT_TYPES, CORE_SYSTEM_INJECTION_PRIORITIES } from './generated/engineFactTables.js';
|
|
2
2
|
export const ASK_EVIDENCE_ABSENCE_VALUES = CORE_ASK_EVIDENCE_ABSENCE_VALUES;
|
|
3
3
|
export const SYSTEM_INJECTION_PRIORITIES = CORE_SYSTEM_INJECTION_PRIORITIES;
|
|
4
|
+
export const BUILTIN_SUBAGENT_TYPES = CORE_BUILTIN_SUBAGENT_TYPES;
|
|
5
|
+
const _builtinSubagentTypePins = [true];
|
|
6
|
+
void _builtinSubagentTypePins;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RunDeathVerdictCode } from '@sema-agent/sdk';
|
|
1
2
|
export declare const LIMITS_MAX_TOKENS_EXCEEDED = "limits.max_tokens_exceeded";
|
|
2
3
|
export declare const LIMITS_MAX_COST_EXCEEDED = "limits.max_cost_exceeded";
|
|
3
4
|
export declare const LIMITS_MAX_TURNS_EXCEEDED = "limits.max_turns_exceeded";
|
|
@@ -18,7 +19,8 @@ export declare const CONFIG_IMAGE_INVALID = "config.image_invalid";
|
|
|
18
19
|
export declare function imageInvalidFailureNoteOf(code: string | undefined): string | undefined;
|
|
19
20
|
export declare const CONFIG_AGENT_UNKNOWN_TOOL = "config.agent.unknown_tool";
|
|
20
21
|
export declare const CONFIG_OUTPUT_STYLE_INVALID = "config.output_style_invalid";
|
|
21
|
-
export declare const
|
|
22
|
+
export declare const RULES_INERT_ENTRY = "rules.inert_entry";
|
|
23
|
+
export declare const RULES_INVALID_SHAPE = "rules.invalid_shape";
|
|
22
24
|
export declare function isRulesRefusalCode(code: string | undefined): boolean;
|
|
23
25
|
export declare const DELEGATION_CONCURRENCY_CAP = "delegation.concurrency_cap";
|
|
24
26
|
export declare const DELEGATION_SESSION_CAP = "delegation.session_cap";
|
|
@@ -48,13 +50,14 @@ export declare function classifyActiveRunBusy(input: {
|
|
|
48
50
|
}): BusyClassification;
|
|
49
51
|
export declare function activeRunBusyCarrierOf(ev: unknown): Record<string, unknown> | null;
|
|
50
52
|
export declare const CORRUPT_SESSION_ERROR_CODE = "corrupt_session";
|
|
53
|
+
export declare const CORRUPT_ROW_ERROR_CODE = "corrupt";
|
|
54
|
+
export declare const MEMORY_CONTROL_PLANE_CORRUPT = "internal.memory_control_plane_corrupt";
|
|
51
55
|
export declare function isCorruptSessionCode(code: string | null | undefined): boolean;
|
|
52
56
|
export declare const STOP_PARK_ARBITER_UNREACHABLE = "stop.park_arbiter_unreachable";
|
|
53
57
|
export declare const STOP_PARK_RESUME_WON = "stop.park_resume_won";
|
|
54
58
|
export declare const STOP_NOT_LANDED = "stop.not_landed";
|
|
55
59
|
export declare const STOP_NOT_LOCAL = "stop.not_local";
|
|
56
60
|
export declare const STOP_PARKED = "stop.parked";
|
|
57
|
-
export declare const STOP_CONFLICT_CODES: readonly ["stop.park_arbiter_unreachable", "stop.park_resume_won", "stop.not_landed", "stop.not_local", "stop.parked"];
|
|
58
61
|
export declare const OUTPUT_INVALID = "output.invalid";
|
|
59
62
|
export declare const RESUME_POLICY_FOLD_CODE = "resume_blocked_by_policy";
|
|
60
63
|
export declare const STATUS_DERIVED_COARSE_CODES: readonly ["request.rejected", "auth.unauthorized", "auth.forbidden", "not_found.resource", "request.payload_too_large", "request.unprocessable", "limit.rate_exceeded", "capability.unavailable", "internal.error"];
|
|
@@ -91,10 +94,13 @@ export declare const DECIDE_WORKFLOW_LANE_CODES: readonly string[];
|
|
|
91
94
|
export declare const DECIDE_NOT_PARKED = "decide.not_parked";
|
|
92
95
|
export declare const DECIDE_GATE_MOVED = "decide.gate_moved";
|
|
93
96
|
export declare const DECIDE_CLAIM_LOST = "decide.claim_lost";
|
|
97
|
+
export declare const CONFLICT_NOT_RESUMABLE = "conflict.not_resumable";
|
|
98
|
+
export declare const GATE_NOT_TOOL_APPROVAL = "gate_not_tool_approval";
|
|
94
99
|
export declare const DECIDE_PARK_MOVED_CODES: readonly string[];
|
|
95
100
|
export declare function isDecideParkMovedCode(code: string | null | undefined): boolean;
|
|
96
101
|
export declare const APPROVAL_STALE = "approval_stale";
|
|
97
102
|
export declare const APPROVAL_BINDING_MISMATCH = "approval_binding_mismatch";
|
|
103
|
+
export declare const CHECKPOINT_INVALID_OUTCOME = "checkpoint.invalid_outcome";
|
|
98
104
|
export declare const RESUME_OUTCOME_INVALID = "resume_outcome_invalid";
|
|
99
105
|
export declare const CHECKPOINT_ALREADY_RESOLVED = "checkpoint.already_resolved";
|
|
100
106
|
export declare const NOT_FOUND_APPROVAL = "not_found.approval";
|
|
@@ -106,7 +112,7 @@ export declare const ASK_GONE = "gone.ask";
|
|
|
106
112
|
export declare const ASK_GONE_PARKED = "gone.ask_parked";
|
|
107
113
|
export declare const ASK_GONE_DENIED_WORD: "routing_failure_fail_closed";
|
|
108
114
|
export declare const RUN_DEATH_VERDICT_CODES: readonly ["run.stalled", "run.orphaned", "approval.expired"];
|
|
109
|
-
export type RunDeathVerdictCode
|
|
115
|
+
export type { RunDeathVerdictCode };
|
|
110
116
|
export declare const RUN_STALLED: "run.stalled";
|
|
111
117
|
export declare const RUN_ORPHANED: "run.orphaned";
|
|
112
118
|
export declare const APPROVAL_EXPIRED: "approval.expired";
|
|
@@ -121,6 +127,8 @@ export declare function isWorkflowParkRefusalCode(code: unknown): boolean;
|
|
|
121
127
|
export declare const DRAINING_ERROR_CODE = "draining";
|
|
122
128
|
export declare const SCENARIO_NOT_ALLOWED_ERROR_CODE = "scenario_not_allowed";
|
|
123
129
|
export declare const SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE = "state.scenario_assignment_unknown";
|
|
130
|
+
export declare const USER_ATTACHMENT_INVALID_ERROR_CODE = "config.user_attachment_invalid";
|
|
131
|
+
export declare const USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE = "config.user_invoked_skill_unknown";
|
|
124
132
|
export declare const STREAM_MAX_DURATION = "STREAM_MAX_DURATION";
|
|
125
133
|
export type ModelFallbackReason = 'inherit_no_tier_binding';
|
|
126
134
|
export declare const MODEL_FALLBACK_INHERIT_NO_TIER_BINDING: ModelFallbackReason;
|
package/dist/engineErrorCodes.js
CHANGED
|
@@ -28,7 +28,8 @@ export function imageInvalidFailureNoteOf(code) {
|
|
|
28
28
|
}
|
|
29
29
|
export const CONFIG_AGENT_UNKNOWN_TOOL = 'config.agent.unknown_tool';
|
|
30
30
|
export const CONFIG_OUTPUT_STYLE_INVALID = 'config.output_style_invalid';
|
|
31
|
-
export const
|
|
31
|
+
export const RULES_INERT_ENTRY = 'rules.inert_entry';
|
|
32
|
+
export const RULES_INVALID_SHAPE = 'rules.invalid_shape';
|
|
32
33
|
const RULES_ERROR_CODE_PREFIX = 'rules.';
|
|
33
34
|
export function isRulesRefusalCode(code) {
|
|
34
35
|
return typeof code === 'string' && code.startsWith(RULES_ERROR_CODE_PREFIX);
|
|
@@ -100,6 +101,8 @@ export function activeRunBusyCarrierOf(ev) {
|
|
|
100
101
|
return null;
|
|
101
102
|
}
|
|
102
103
|
export const CORRUPT_SESSION_ERROR_CODE = 'corrupt_session';
|
|
104
|
+
export const CORRUPT_ROW_ERROR_CODE = 'corrupt';
|
|
105
|
+
export const MEMORY_CONTROL_PLANE_CORRUPT = 'internal.memory_control_plane_corrupt';
|
|
103
106
|
export function isCorruptSessionCode(code) {
|
|
104
107
|
return code === CORRUPT_SESSION_ERROR_CODE;
|
|
105
108
|
}
|
|
@@ -108,13 +111,6 @@ export const STOP_PARK_RESUME_WON = 'stop.park_resume_won';
|
|
|
108
111
|
export const STOP_NOT_LANDED = 'stop.not_landed';
|
|
109
112
|
export const STOP_NOT_LOCAL = 'stop.not_local';
|
|
110
113
|
export const STOP_PARKED = 'stop.parked';
|
|
111
|
-
export const STOP_CONFLICT_CODES = Object.freeze([
|
|
112
|
-
STOP_PARK_ARBITER_UNREACHABLE,
|
|
113
|
-
STOP_PARK_RESUME_WON,
|
|
114
|
-
STOP_NOT_LANDED,
|
|
115
|
-
STOP_NOT_LOCAL,
|
|
116
|
-
STOP_PARKED,
|
|
117
|
-
]);
|
|
118
114
|
export const OUTPUT_INVALID = 'output.invalid';
|
|
119
115
|
export const RESUME_POLICY_FOLD_CODE = 'resume_blocked_by_policy';
|
|
120
116
|
export const STATUS_DERIVED_COARSE_CODES = SDK_STATUS_DERIVED_COARSE_CODES;
|
|
@@ -181,16 +177,21 @@ export const DECIDE_WORKFLOW_LANE_CODES = Object.freeze([
|
|
|
181
177
|
export const DECIDE_NOT_PARKED = 'decide.not_parked';
|
|
182
178
|
export const DECIDE_GATE_MOVED = 'decide.gate_moved';
|
|
183
179
|
export const DECIDE_CLAIM_LOST = 'decide.claim_lost';
|
|
180
|
+
export const CONFLICT_NOT_RESUMABLE = 'conflict.not_resumable';
|
|
181
|
+
export const GATE_NOT_TOOL_APPROVAL = 'gate_not_tool_approval';
|
|
184
182
|
export const DECIDE_PARK_MOVED_CODES = Object.freeze([
|
|
185
183
|
DECIDE_NOT_PARKED,
|
|
186
184
|
DECIDE_GATE_MOVED,
|
|
187
185
|
DECIDE_CLAIM_LOST,
|
|
186
|
+
CONFLICT_NOT_RESUMABLE,
|
|
187
|
+
GATE_NOT_TOOL_APPROVAL,
|
|
188
188
|
]);
|
|
189
189
|
export function isDecideParkMovedCode(code) {
|
|
190
190
|
return typeof code === 'string' && DECIDE_PARK_MOVED_CODES.includes(code);
|
|
191
191
|
}
|
|
192
192
|
export const APPROVAL_STALE = 'approval_stale';
|
|
193
193
|
export const APPROVAL_BINDING_MISMATCH = 'approval_binding_mismatch';
|
|
194
|
+
export const CHECKPOINT_INVALID_OUTCOME = 'checkpoint.invalid_outcome';
|
|
194
195
|
export const RESUME_OUTCOME_INVALID = 'resume_outcome_invalid';
|
|
195
196
|
export const CHECKPOINT_ALREADY_RESOLVED = 'checkpoint.already_resolved';
|
|
196
197
|
export const NOT_FOUND_APPROVAL = 'not_found.approval';
|
|
@@ -258,6 +259,8 @@ export function isWorkflowParkRefusalCode(code) {
|
|
|
258
259
|
export const DRAINING_ERROR_CODE = 'draining';
|
|
259
260
|
export const SCENARIO_NOT_ALLOWED_ERROR_CODE = 'scenario_not_allowed';
|
|
260
261
|
export const SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE = 'state.scenario_assignment_unknown';
|
|
262
|
+
export const USER_ATTACHMENT_INVALID_ERROR_CODE = 'config.user_attachment_invalid';
|
|
263
|
+
export const USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE = 'config.user_invoked_skill_unknown';
|
|
261
264
|
export const STREAM_MAX_DURATION = 'STREAM_MAX_DURATION';
|
|
262
265
|
export const MODEL_FALLBACK_INHERIT_NO_TIER_BINDING = 'inherit_no_tier_binding';
|
|
263
266
|
export function asModelFallbackReason(v) {
|
package/dist/engineIdentity.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export type EngineIdentityVerdict = 'changed' | 'same' | 'unknown';
|
|
|
9
9
|
export declare function engineIdentityVerdict(a: unknown, b: unknown): EngineIdentityVerdict;
|
|
10
10
|
export declare function engineIdentityChangedBy(a: unknown, b: unknown): keyof EngineIdentityView | undefined;
|
|
11
11
|
export declare function engineIdentityChanged(a: unknown, b: unknown): boolean;
|
|
12
|
+
export declare function toolKillCauseAcrossEngineIdentity(before: object | null | undefined, after: object | null | undefined): 'engine_restarted' | undefined;
|
package/dist/engineIdentity.js
CHANGED
|
@@ -55,3 +55,11 @@ export function engineIdentityChangedBy(a, b) {
|
|
|
55
55
|
export function engineIdentityChanged(a, b) {
|
|
56
56
|
return engineIdentityVerdict(a, b) === 'changed';
|
|
57
57
|
}
|
|
58
|
+
export function toolKillCauseAcrossEngineIdentity(before, after) {
|
|
59
|
+
try {
|
|
60
|
+
return engineIdentityVerdict(before, after) === 'changed' ? 'engine_restarted' : undefined;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentEvent } from '@sema-agent/sdk';
|
|
2
|
+
export interface EngineRowRef {
|
|
3
|
+
readonly eventId?: string;
|
|
4
|
+
readonly taskId?: string;
|
|
5
|
+
readonly sessionId?: string;
|
|
6
|
+
}
|
|
7
|
+
export type SameEngineRefVerdict = 'same' | 'different' | 'unknown';
|
|
8
|
+
export interface EngineBoundRun {
|
|
9
|
+
readonly taskId?: string;
|
|
10
|
+
readonly sessionId?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function engineRefOf(row: object | null | undefined): EngineRowRef | undefined;
|
|
13
|
+
export declare function sameEngineRef(a: object | null | undefined, b: object | null | undefined): SameEngineRefVerdict;
|
|
14
|
+
export declare function wireEventIdOf(ev: object): string | undefined;
|
|
15
|
+
export declare function envelopeUuidOf(eventId: string, envelopeType: string): string;
|
|
16
|
+
export type TerminalUuidLabel = 'result' | 'terminal-row' | 'outcome-unknown';
|
|
17
|
+
export declare function terminalUuidOf(runId: string, label: TerminalUuidLabel): string;
|
|
18
|
+
export declare function readBoundRun(call: () => EngineBoundRun | undefined): EngineBoundRun | undefined;
|
|
19
|
+
export declare function mintEngineRowRef(eventId: string, bound: EngineBoundRun | undefined): EngineRowRef;
|
|
20
|
+
export declare function terminalRunIdOf(ev: Extract<AgentEvent, {
|
|
21
|
+
type: 'done';
|
|
22
|
+
} | {
|
|
23
|
+
type: 'failed';
|
|
24
|
+
}>): string | undefined;
|
|
25
|
+
export declare const TRANSCRIPT_ROW_SIDECAR_KEYS: readonly string[];
|
|
26
|
+
export declare function parkHeldCallIdOf(carrier: {} | null | undefined): string | undefined;
|
|
27
|
+
export declare function parkedToolEndRoleOf(frame: {} | null | undefined): 'held' | 'collateral' | undefined;
|
|
28
|
+
export declare function isUnsettledHeldToolEnd(frame: {} | null | undefined): boolean;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { guardedRead, readFrameStringKey, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
2
|
+
import { GATE_PARKED_ERROR_CODE } from './engineErrorCodes.js';
|
|
3
|
+
import { isCcToolDenialKind } from './gateVocabulary.js';
|
|
4
|
+
import { doneResultView } from './replayBody.js';
|
|
5
|
+
import { TRANSCRIPT_ID_NAMESPACE, uuidV5 } from './uuidV5.js';
|
|
6
|
+
const ENGINE_REF_KEY = '_sema_engine_ref';
|
|
7
|
+
function refFromCarrier(carrier) {
|
|
8
|
+
const out = {};
|
|
9
|
+
for (const k of ['eventId', 'taskId', 'sessionId']) {
|
|
10
|
+
const v = guardedRead(() => readOwnDataNonEmptyString(carrier, k));
|
|
11
|
+
if (v !== undefined)
|
|
12
|
+
out[k] = v;
|
|
13
|
+
}
|
|
14
|
+
return out.eventId !== undefined || out.taskId !== undefined || out.sessionId !== undefined ? out : undefined;
|
|
15
|
+
}
|
|
16
|
+
export function engineRefOf(row) {
|
|
17
|
+
if (typeof row !== 'object' || row === null)
|
|
18
|
+
return undefined;
|
|
19
|
+
const carrier = guardedRead(() => readOwnDataValue(row, ENGINE_REF_KEY));
|
|
20
|
+
if (typeof carrier !== 'object' || carrier === null)
|
|
21
|
+
return undefined;
|
|
22
|
+
if (guardedRead(() => (Array.isArray(carrier) ? undefined : true)) !== true)
|
|
23
|
+
return undefined;
|
|
24
|
+
return refFromCarrier(carrier);
|
|
25
|
+
}
|
|
26
|
+
export function sameEngineRef(a, b) {
|
|
27
|
+
const ra = engineRefOf(a);
|
|
28
|
+
const rb = engineRefOf(b);
|
|
29
|
+
if (ra?.eventId !== undefined && rb?.eventId !== undefined)
|
|
30
|
+
return ra.eventId === rb.eventId ? 'same' : 'different';
|
|
31
|
+
if (ra?.taskId !== undefined && rb?.taskId !== undefined && ra.taskId !== rb.taskId)
|
|
32
|
+
return 'different';
|
|
33
|
+
if (ra?.sessionId !== undefined && rb?.sessionId !== undefined && ra.sessionId !== rb.sessionId)
|
|
34
|
+
return 'different';
|
|
35
|
+
return 'unknown';
|
|
36
|
+
}
|
|
37
|
+
export function wireEventIdOf(ev) {
|
|
38
|
+
return guardedRead(() => readOwnDataNonEmptyString(ev, 'eventId'));
|
|
39
|
+
}
|
|
40
|
+
export function envelopeUuidOf(eventId, envelopeType) {
|
|
41
|
+
return uuidV5(TRANSCRIPT_ID_NAMESPACE, `ev_${eventId}#${envelopeType}`);
|
|
42
|
+
}
|
|
43
|
+
export function terminalUuidOf(runId, label) {
|
|
44
|
+
return uuidV5(TRANSCRIPT_ID_NAMESPACE, `run_${runId}#${label}`);
|
|
45
|
+
}
|
|
46
|
+
export function readBoundRun(call) {
|
|
47
|
+
let raw;
|
|
48
|
+
try {
|
|
49
|
+
raw = call();
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
if (typeof raw !== 'object' || raw === null)
|
|
55
|
+
return undefined;
|
|
56
|
+
const then = guardedRead(() => raw.then);
|
|
57
|
+
if (typeof then === 'function') {
|
|
58
|
+
void Promise.resolve(raw).then(undefined, () => undefined);
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const taskId = guardedRead(() => readOwnDataNonEmptyString(raw, 'taskId'));
|
|
62
|
+
const sessionId = guardedRead(() => readOwnDataNonEmptyString(raw, 'sessionId'));
|
|
63
|
+
if (taskId === undefined && sessionId === undefined)
|
|
64
|
+
return undefined;
|
|
65
|
+
return { ...(taskId !== undefined ? { taskId } : {}), ...(sessionId !== undefined ? { sessionId } : {}) };
|
|
66
|
+
}
|
|
67
|
+
export function mintEngineRowRef(eventId, bound) {
|
|
68
|
+
return {
|
|
69
|
+
eventId,
|
|
70
|
+
...(bound?.taskId !== undefined ? { taskId: bound.taskId } : {}),
|
|
71
|
+
...(bound?.sessionId !== undefined ? { sessionId: bound.sessionId } : {}),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export function terminalRunIdOf(ev) {
|
|
75
|
+
if (ev.type !== 'done')
|
|
76
|
+
return undefined;
|
|
77
|
+
const v = (doneResultView(ev.result).engine ?? ev.result)?.runId;
|
|
78
|
+
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
79
|
+
}
|
|
80
|
+
export const TRANSCRIPT_ROW_SIDECAR_KEYS = Object.freeze([
|
|
81
|
+
'_sema_segment_id',
|
|
82
|
+
'_sema_engine_ref',
|
|
83
|
+
'_sema_replay',
|
|
84
|
+
'_sema_api_error_message',
|
|
85
|
+
'_sema_tool_history_mismatch',
|
|
86
|
+
'_sema_provider_rejection_resend',
|
|
87
|
+
'_sema_tool_recovered',
|
|
88
|
+
'_sema_degraded',
|
|
89
|
+
'_sema_denial_kind',
|
|
90
|
+
'_sema_gate',
|
|
91
|
+
'_sema_not_executed',
|
|
92
|
+
'_sema_collateral_abort',
|
|
93
|
+
'_sema_interrupted_never_started',
|
|
94
|
+
'_sema_approval_window_expired',
|
|
95
|
+
'_sema_denial_limit_window_expired',
|
|
96
|
+
'_sema_api_error_status',
|
|
97
|
+
'_sema_api_error_code',
|
|
98
|
+
'_sema_provider_condition',
|
|
99
|
+
]);
|
|
100
|
+
export function parkHeldCallIdOf(carrier) {
|
|
101
|
+
return readFrameStringKey(carrier, 'toolCallId');
|
|
102
|
+
}
|
|
103
|
+
export function parkedToolEndRoleOf(frame) {
|
|
104
|
+
if (readFrameStringKey(frame, 'errorCode') !== GATE_PARKED_ERROR_CODE)
|
|
105
|
+
return undefined;
|
|
106
|
+
const gated = readFrameStringKey(frame, 'gatedCallId');
|
|
107
|
+
const call = readFrameStringKey(frame, 'toolCallId');
|
|
108
|
+
if (gated === undefined || call === undefined)
|
|
109
|
+
return undefined;
|
|
110
|
+
return gated === call ? 'held' : 'collateral';
|
|
111
|
+
}
|
|
112
|
+
export function isUnsettledHeldToolEnd(frame) {
|
|
113
|
+
return parkedToolEndRoleOf(frame) === 'held' && !isCcToolDenialKind(readFrameStringKey(frame, '_sema_denial_kind'));
|
|
114
|
+
}
|