@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
|
@@ -16,17 +16,19 @@ export interface LocalEngineModelIdentityReading {
|
|
|
16
16
|
lanes: ModelIdentityLanes;
|
|
17
17
|
engineAnswer?: EngineAnswerObservation;
|
|
18
18
|
engineAcceptsCatalogDefault?: boolean;
|
|
19
|
+
routeGap?: ModelRouteGapReading;
|
|
19
20
|
}
|
|
21
|
+
export type ModelRouteGapReading = 'endpoint_missing' | 'lane_credential_missing' | 'none';
|
|
20
22
|
export interface RemoteEngineModelIdentityReading {
|
|
21
23
|
engine: 'remote';
|
|
22
24
|
engineAnswer: EngineAnswerObservation;
|
|
23
25
|
}
|
|
24
26
|
export type ModelIdentityReading = LocalEngineModelIdentityReading | RemoteEngineModelIdentityReading;
|
|
25
27
|
export type ModelIdentityResolvability = 'resolvable' | 'not_resolvable' | 'unknown';
|
|
26
|
-
export type ModelSetupDecision = 'offer_setup' | 'explain_unconfigured' | 'proceed';
|
|
28
|
+
export type ModelSetupDecision = 'offer_setup' | 'explain_unconfigured' | 'explain_route_gap' | 'proceed';
|
|
27
29
|
export declare function modelIdentityResolvability(reading: ModelIdentityReading): ModelIdentityResolvability;
|
|
28
30
|
export declare function modelIdentityDetail(reading: ModelIdentityReading): string;
|
|
29
|
-
export declare function modelSetupDecision(
|
|
31
|
+
export declare function modelSetupDecision(reading: ModelIdentityReading, hostCanConfigureModel: boolean): ModelSetupDecision;
|
|
30
32
|
export declare function modelSetupNotice(decision: ModelSetupDecision): string | null;
|
|
31
33
|
export declare function observedEngineAnswer(baseUrl?: string | undefined): EngineAnswerObservation;
|
|
32
34
|
export {};
|
|
@@ -26,6 +26,10 @@ function catalogDefaultEvidence(catalog, accepts) {
|
|
|
26
26
|
void _evidencePin;
|
|
27
27
|
return catalog === 'complete' && accepts === true ? { catalog, engineAccepts: accepts } : undefined;
|
|
28
28
|
}
|
|
29
|
+
function routeGapOf(reading) {
|
|
30
|
+
const v = own(reading, 'routeGap')?.v;
|
|
31
|
+
return v === 'endpoint_missing' || v === 'lane_credential_missing' || v === 'none' ? v : undefined;
|
|
32
|
+
}
|
|
29
33
|
function analyse(reading) {
|
|
30
34
|
try {
|
|
31
35
|
if (!isPlainObject(reading))
|
|
@@ -69,7 +73,10 @@ function analyse(reading) {
|
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
else if (s === 'complete') {
|
|
72
|
-
|
|
76
|
+
const route = routeGapOf(reading);
|
|
77
|
+
if (route === 'endpoint_missing' || route === 'lane_credential_missing')
|
|
78
|
+
return { verdict: 'not_resolvable', why: 'route_gap', lane, gap: route };
|
|
79
|
+
return { verdict: 'resolvable', why: 'lane', lane, route: route === 'none' ? 'none' : 'unreported' };
|
|
73
80
|
}
|
|
74
81
|
if (s === 'partial')
|
|
75
82
|
partial.push(lane);
|
|
@@ -83,7 +90,7 @@ function analyse(reading) {
|
|
|
83
90
|
if (unreadable.length > 0 || unreported.length > 0 || unusable.length > 0 || catalogUnconfirmed !== null) {
|
|
84
91
|
return { verdict: 'unknown', why: 'lanes', unreadable, unreported, unusable, catalogUnconfirmed, catalogRefused };
|
|
85
92
|
}
|
|
86
|
-
return { verdict: 'not_resolvable', partial, catalogRefused };
|
|
93
|
+
return { verdict: 'not_resolvable', why: 'lanes', partial, catalogRefused };
|
|
87
94
|
}
|
|
88
95
|
catch {
|
|
89
96
|
return malformed();
|
|
@@ -121,8 +128,16 @@ export function modelIdentityDetail(reading) {
|
|
|
121
128
|
if (a.why === 'catalog_default') {
|
|
122
129
|
return `${laneLabel('modelCatalogFile')} supplies a model name as its default, and the local engine accepts a catalog default in place of a startup model name, so it can start with it — whether its gateway accepts that name is a separate check`;
|
|
123
130
|
}
|
|
124
|
-
|
|
131
|
+
if (a.route === 'none') {
|
|
132
|
+
return `${laneLabel(a.lane)} supplies a model name and the local engine has a route to reach it, so it can start with it — whether its gateway accepts that name is a separate check`;
|
|
133
|
+
}
|
|
134
|
+
return `${laneLabel(a.lane)} supplies a model name for the local engine — whether the engine also has a route to reach that model (an endpoint, or credentials for the channel it names) and whether its gateway accepts the name are separate checks`;
|
|
125
135
|
case 'not_resolvable': {
|
|
136
|
+
if (a.why === 'route_gap') {
|
|
137
|
+
return a.gap === 'endpoint_missing'
|
|
138
|
+
? `${laneLabel(a.lane)} supplies a model name, but the local engine has no route to reach it — the model rides the OpenAI-compatible route and no gateway address (MODEL_GATEWAY_BASEURL) is set, and the engine refuses to start without one`
|
|
139
|
+
: `${laneLabel(a.lane)} supplies a model name, but the local engine has no route to reach it — the anthropic channel is selected (MODEL_PROVIDER=anthropic), neither ANTHROPIC_API_KEY nor ANTHROPIC_AUTH_TOKEN is set, and there is no gateway address (MODEL_GATEWAY_BASEURL) to fall back to, so the engine cannot start on any route`;
|
|
140
|
+
}
|
|
126
141
|
const others = a.catalogRefused ? a.partial.filter((l) => l !== 'modelCatalogFile') : a.partial;
|
|
127
142
|
const partialClause = others.length > 0
|
|
128
143
|
? `${joinPhrases(others.map(laneLabel))} ${others.length > 1 ? 'carry' : 'carries'} part of a model configuration (such as a gateway address or a credential) but no model name`
|
|
@@ -163,8 +178,11 @@ export function modelIdentityDetail(reading) {
|
|
|
163
178
|
return "this reading of the engine's model configuration could not be interpreted, so whether the engine has a model name is unknown";
|
|
164
179
|
}
|
|
165
180
|
}
|
|
166
|
-
export function modelSetupDecision(
|
|
167
|
-
|
|
181
|
+
export function modelSetupDecision(reading, hostCanConfigureModel) {
|
|
182
|
+
const a = analyse(reading);
|
|
183
|
+
if (a.verdict === 'not_resolvable' && a.why === 'route_gap')
|
|
184
|
+
return 'explain_route_gap';
|
|
185
|
+
if (a.verdict !== 'not_resolvable')
|
|
168
186
|
return 'proceed';
|
|
169
187
|
if (hostCanConfigureModel === true)
|
|
170
188
|
return 'offer_setup';
|
|
@@ -178,6 +196,8 @@ export function modelSetupNotice(decision) {
|
|
|
178
196
|
return 'no model name is configured for the engine, and it does not start without one — opening model setup';
|
|
179
197
|
case 'explain_unconfigured':
|
|
180
198
|
return 'this engine has no model configured, and it cannot be configured from this client — ask whoever runs the engine to set one up';
|
|
199
|
+
case 'explain_route_gap':
|
|
200
|
+
return 'a model name is configured, but the engine has no route to reach that model (a gateway address, or credentials for the channel it names), so it does not start — fix the route; model setup will not help';
|
|
181
201
|
default:
|
|
182
202
|
return null;
|
|
183
203
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export type ModelSwitchProbeLane = 'live' | 'mock' | 'engine_absent' | 'unwired';
|
|
2
|
+
export interface ModelSwitchProbeVerdict {
|
|
3
|
+
readonly valid: boolean;
|
|
4
|
+
readonly error?: string;
|
|
5
|
+
readonly unchecked?: true;
|
|
6
|
+
}
|
|
7
|
+
export interface ModelSwitchProbeInput {
|
|
8
|
+
readonly model: string;
|
|
9
|
+
readonly lane: ModelSwitchProbeLane;
|
|
10
|
+
readonly engineAbsentReason?: string;
|
|
11
|
+
readonly probe?: {
|
|
12
|
+
readonly kind: 'verdict';
|
|
13
|
+
readonly verdict: ModelSwitchProbeVerdict;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'threw';
|
|
16
|
+
readonly error: unknown;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export type ModelSwitchProbeOutcome = {
|
|
20
|
+
readonly ok: true;
|
|
21
|
+
readonly probed: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
readonly ok: false;
|
|
24
|
+
readonly kind: 'rejected';
|
|
25
|
+
readonly model: string;
|
|
26
|
+
readonly reason?: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly ok: false;
|
|
29
|
+
readonly kind: 'unavailable';
|
|
30
|
+
readonly cause: 'unwired' | 'probe_missing' | 'probe_threw' | 'unchecked';
|
|
31
|
+
readonly model: string;
|
|
32
|
+
readonly reason?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function modelSwitchProbeOutcomeOf(input: ModelSwitchProbeInput): ModelSwitchProbeOutcome;
|
|
35
|
+
export interface ModelSwitchProbePorts {
|
|
36
|
+
readonly lane: () => {
|
|
37
|
+
readonly lane: ModelSwitchProbeLane;
|
|
38
|
+
readonly engineAbsentReason?: string;
|
|
39
|
+
} | Promise<{
|
|
40
|
+
readonly lane: ModelSwitchProbeLane;
|
|
41
|
+
readonly engineAbsentReason?: string;
|
|
42
|
+
}>;
|
|
43
|
+
readonly validate: (model: string) => Promise<ModelSwitchProbeVerdict>;
|
|
44
|
+
}
|
|
45
|
+
export declare function runModelSwitchProbe(model: string, ports: ModelSwitchProbePorts): Promise<ModelSwitchProbeOutcome>;
|
|
46
|
+
export interface ModelSwitchFallbackRecord {
|
|
47
|
+
readonly previous: string;
|
|
48
|
+
readonly current: string;
|
|
49
|
+
readonly seq: number;
|
|
50
|
+
}
|
|
51
|
+
export interface ModelSwitchNote {
|
|
52
|
+
readonly sessionId: string;
|
|
53
|
+
readonly to: string | null | undefined;
|
|
54
|
+
readonly lastServed: string | null | undefined;
|
|
55
|
+
}
|
|
56
|
+
export interface ModelSwitchAdvisoryInput {
|
|
57
|
+
readonly frame: unknown;
|
|
58
|
+
readonly sessionId: string;
|
|
59
|
+
readonly streamModel: string | null | undefined;
|
|
60
|
+
readonly lastServed: string | null | undefined;
|
|
61
|
+
}
|
|
62
|
+
export interface ModelSwitchFallbackLedger {
|
|
63
|
+
noteSwitch(input: ModelSwitchNote): ModelSwitchFallbackRecord | undefined;
|
|
64
|
+
peek(sessionId: string): ModelSwitchFallbackRecord | undefined;
|
|
65
|
+
advisoryFor(input: ModelSwitchAdvisoryInput): ModelSwitchFallbackRecord | undefined;
|
|
66
|
+
release(sessionId: string, seq: number): boolean;
|
|
67
|
+
clear(sessionId: string): void;
|
|
68
|
+
}
|
|
69
|
+
export declare function createModelSwitchFallbackLedger(): ModelSwitchFallbackLedger;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { resultErrorCodeOf, resultSelectedModelOf } from './resultFrameKeys.js';
|
|
2
|
+
import { readFrameStringKey, readOwnDataValue } from './ownKey.js';
|
|
3
|
+
const trimmed = (v) => (typeof v === 'string' ? v.trim() : '');
|
|
4
|
+
const reasonOf = (v) => {
|
|
5
|
+
const t = trimmed(v);
|
|
6
|
+
return t.length > 0 ? t : undefined;
|
|
7
|
+
};
|
|
8
|
+
function thrownReason(e) {
|
|
9
|
+
try {
|
|
10
|
+
if (e instanceof Error)
|
|
11
|
+
return reasonOf(e.message);
|
|
12
|
+
return reasonOf(e);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function modelSwitchProbeOutcomeOf(input) {
|
|
19
|
+
let model = '';
|
|
20
|
+
let lane;
|
|
21
|
+
let absent;
|
|
22
|
+
let probe;
|
|
23
|
+
try {
|
|
24
|
+
model = trimmed(input?.model);
|
|
25
|
+
lane = input?.lane;
|
|
26
|
+
absent = reasonOf(input?.engineAbsentReason);
|
|
27
|
+
probe = input?.probe;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return { ok: false, kind: 'unavailable', cause: 'probe_missing', model };
|
|
31
|
+
}
|
|
32
|
+
if (model.length === 0)
|
|
33
|
+
return { ok: true, probed: false };
|
|
34
|
+
if (lane === 'unwired')
|
|
35
|
+
return { ok: false, kind: 'unavailable', cause: 'unwired', model };
|
|
36
|
+
if (lane === 'mock' || (lane === 'engine_absent' && absent === undefined))
|
|
37
|
+
return { ok: true, probed: false };
|
|
38
|
+
if (lane !== 'live' && lane !== 'engine_absent')
|
|
39
|
+
return { ok: false, kind: 'unavailable', cause: 'unwired', model };
|
|
40
|
+
let kind;
|
|
41
|
+
let verdict;
|
|
42
|
+
let error;
|
|
43
|
+
try {
|
|
44
|
+
kind = probe?.kind;
|
|
45
|
+
verdict = kind === 'verdict' ? probe.verdict : undefined;
|
|
46
|
+
error = kind === 'threw' ? probe.error : undefined;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
kind = undefined;
|
|
50
|
+
}
|
|
51
|
+
if (kind === 'threw') {
|
|
52
|
+
const reason = thrownReason(error);
|
|
53
|
+
return { ok: false, kind: 'unavailable', cause: 'probe_threw', model, ...(reason !== undefined ? { reason } : {}) };
|
|
54
|
+
}
|
|
55
|
+
if (kind !== 'verdict' || verdict === null || typeof verdict !== 'object')
|
|
56
|
+
return { ok: false, kind: 'unavailable', cause: 'probe_missing', model };
|
|
57
|
+
let valid;
|
|
58
|
+
let unchecked;
|
|
59
|
+
let why;
|
|
60
|
+
try {
|
|
61
|
+
valid = verdict.valid;
|
|
62
|
+
unchecked = verdict.unchecked;
|
|
63
|
+
why = reasonOf(verdict.error);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return { ok: false, kind: 'unavailable', cause: 'probe_missing', model };
|
|
67
|
+
}
|
|
68
|
+
if (valid === true)
|
|
69
|
+
return { ok: true, probed: lane === 'live' };
|
|
70
|
+
if (unchecked === true) {
|
|
71
|
+
const reason = why ?? absent;
|
|
72
|
+
return { ok: false, kind: 'unavailable', cause: 'unchecked', model, ...(reason !== undefined ? { reason } : {}) };
|
|
73
|
+
}
|
|
74
|
+
return { ok: false, kind: 'rejected', model, ...(why !== undefined ? { reason: why } : {}) };
|
|
75
|
+
}
|
|
76
|
+
export async function runModelSwitchProbe(model, ports) {
|
|
77
|
+
let laneReading;
|
|
78
|
+
try {
|
|
79
|
+
const got = await ports.lane();
|
|
80
|
+
const lane = got?.lane;
|
|
81
|
+
const why = got?.engineAbsentReason;
|
|
82
|
+
laneReading = {
|
|
83
|
+
lane: lane === 'live' || lane === 'mock' || lane === 'engine_absent' || lane === 'unwired' ? lane : 'unwired',
|
|
84
|
+
...(typeof why === 'string' ? { engineAbsentReason: why } : {}),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
laneReading = { lane: 'unwired' };
|
|
89
|
+
}
|
|
90
|
+
const base = { model, ...laneReading };
|
|
91
|
+
const pre = modelSwitchProbeOutcomeOf(base);
|
|
92
|
+
if (pre.ok || (pre.kind === 'unavailable' && pre.cause !== 'probe_missing'))
|
|
93
|
+
return pre;
|
|
94
|
+
try {
|
|
95
|
+
const verdict = await ports.validate(trimmed(model));
|
|
96
|
+
return modelSwitchProbeOutcomeOf({ ...base, probe: { kind: 'verdict', verdict } });
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return modelSwitchProbeOutcomeOf({ ...base, probe: { kind: 'threw', error } });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const EMPTY_STREAM_ERROR_CODE = 'stream_torn';
|
|
103
|
+
const LEDGER_SESSION_CAP = 1024;
|
|
104
|
+
function isEmptyStreamFailureFrame(frame) {
|
|
105
|
+
try {
|
|
106
|
+
if (frame === null || typeof frame !== 'object' || Array.isArray(frame))
|
|
107
|
+
return false;
|
|
108
|
+
if (readFrameStringKey(frame, 'type') !== 'result')
|
|
109
|
+
return false;
|
|
110
|
+
if (readOwnDataValue(frame, 'is_error') !== true)
|
|
111
|
+
return false;
|
|
112
|
+
return resultErrorCodeOf(frame) === EMPTY_STREAM_ERROR_CODE;
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export function createModelSwitchFallbackLedger() {
|
|
119
|
+
const bySession = new Map();
|
|
120
|
+
let lastSeq = 0;
|
|
121
|
+
const drop = (sid) => {
|
|
122
|
+
if (sid.length > 0)
|
|
123
|
+
bySession.delete(sid);
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
noteSwitch(input) {
|
|
127
|
+
let sid = '';
|
|
128
|
+
let current = '';
|
|
129
|
+
let previous = '';
|
|
130
|
+
try {
|
|
131
|
+
sid = trimmed(input?.sessionId);
|
|
132
|
+
current = trimmed(input?.to);
|
|
133
|
+
previous = trimmed(input?.lastServed);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
if (sid.length === 0)
|
|
139
|
+
return undefined;
|
|
140
|
+
if (current.length === 0 || previous.length === 0 || previous === current) {
|
|
141
|
+
drop(sid);
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
lastSeq += 1;
|
|
145
|
+
const rec = Object.freeze({ previous, current, seq: lastSeq });
|
|
146
|
+
bySession.delete(sid);
|
|
147
|
+
bySession.set(sid, rec);
|
|
148
|
+
while (bySession.size > LEDGER_SESSION_CAP) {
|
|
149
|
+
const oldest = bySession.keys().next().value;
|
|
150
|
+
if (oldest === undefined)
|
|
151
|
+
break;
|
|
152
|
+
bySession.delete(oldest);
|
|
153
|
+
}
|
|
154
|
+
return rec;
|
|
155
|
+
},
|
|
156
|
+
peek(sessionId) {
|
|
157
|
+
const sid = trimmed(sessionId);
|
|
158
|
+
return sid.length > 0 ? bySession.get(sid) : undefined;
|
|
159
|
+
},
|
|
160
|
+
advisoryFor(input) {
|
|
161
|
+
let frame;
|
|
162
|
+
let sid = '';
|
|
163
|
+
let streamModel = '';
|
|
164
|
+
let served = '';
|
|
165
|
+
try {
|
|
166
|
+
frame = input?.frame;
|
|
167
|
+
sid = trimmed(input?.sessionId);
|
|
168
|
+
streamModel = trimmed(input?.streamModel);
|
|
169
|
+
served = trimmed(input?.lastServed);
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
if (!isEmptyStreamFailureFrame(frame))
|
|
175
|
+
return undefined;
|
|
176
|
+
if (sid.length === 0)
|
|
177
|
+
return undefined;
|
|
178
|
+
const rec = bySession.get(sid);
|
|
179
|
+
if (rec === undefined)
|
|
180
|
+
return undefined;
|
|
181
|
+
const frameModel = trimmed(resultSelectedModelOf(frame));
|
|
182
|
+
const candidates = frameModel.length > 0 && frameModel !== streamModel ? [streamModel, frameModel] : [streamModel];
|
|
183
|
+
for (const c of candidates) {
|
|
184
|
+
if (c.length === 0 || rec.current !== c)
|
|
185
|
+
continue;
|
|
186
|
+
if (served === c)
|
|
187
|
+
return undefined;
|
|
188
|
+
return rec;
|
|
189
|
+
}
|
|
190
|
+
return undefined;
|
|
191
|
+
},
|
|
192
|
+
release(sessionId, seq) {
|
|
193
|
+
const sid = trimmed(sessionId);
|
|
194
|
+
if (sid.length === 0)
|
|
195
|
+
return false;
|
|
196
|
+
const rec = bySession.get(sid);
|
|
197
|
+
if (rec === undefined || typeof seq !== 'number' || rec.seq !== seq)
|
|
198
|
+
return false;
|
|
199
|
+
bySession.delete(sid);
|
|
200
|
+
return true;
|
|
201
|
+
},
|
|
202
|
+
clear(sessionId) {
|
|
203
|
+
drop(trimmed(sessionId));
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
}
|
package/dist/notifications.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { hostEnv } from './hostEnv.js';
|
|
2
2
|
import { unrefTimer } from './unrefTimer.js';
|
|
3
3
|
import { clearEnginePanelTaskResidentByWire, publishEngineAgentPanelEvent, } from './engineAgentPanelStore.js';
|
|
4
|
-
import {
|
|
4
|
+
import { panelEndFact } from './panelReduce.js';
|
|
5
|
+
import { isCoreTaskNotificationTerminal, isCoreTaskNotificationTerminalNotSuccess } from './terminalStatuses.js';
|
|
6
|
+
import { cycleSeqValue } from './cycleOrder.js';
|
|
5
7
|
function escapeXml(v) {
|
|
6
8
|
return v.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
7
9
|
}
|
|
@@ -130,7 +132,7 @@ export function parseTranscriptNotificationSeeds(messages) {
|
|
|
130
132
|
continue;
|
|
131
133
|
const external = /\btype="external"/.test(attrs);
|
|
132
134
|
renderedKeys.push(`${external ? 'external:' : ''}${taskId}:${status}`);
|
|
133
|
-
if (!external && (
|
|
135
|
+
if (!external && isCoreTaskNotificationTerminal(status)) {
|
|
134
136
|
notifiedKeys.push(taskId);
|
|
135
137
|
}
|
|
136
138
|
seeded++;
|
|
@@ -316,6 +318,10 @@ const BG_FIRST_SEQ = 1;
|
|
|
316
318
|
function normalizeBgSeq(seq) {
|
|
317
319
|
return typeof seq === 'number' && Number.isFinite(seq) && seq >= BG_FIRST_SEQ ? Math.floor(seq) : BG_FIRST_SEQ;
|
|
318
320
|
}
|
|
321
|
+
function notificationCycleOf(n) {
|
|
322
|
+
const cycleSeq = cycleSeqValue(n.seq);
|
|
323
|
+
return cycleSeq !== undefined ? { cycleSeq } : undefined;
|
|
324
|
+
}
|
|
319
325
|
function bgOutstandingKey(taskId, seq) {
|
|
320
326
|
return `${taskId}:${seq}`;
|
|
321
327
|
}
|
|
@@ -570,20 +576,15 @@ export function enqueueBgChildNotification(n) {
|
|
|
570
576
|
return;
|
|
571
577
|
}
|
|
572
578
|
bgNotifiedKeys.add(key);
|
|
573
|
-
const terminal =
|
|
579
|
+
const terminal = isCoreTaskNotificationTerminal(n.status);
|
|
574
580
|
if (terminal) {
|
|
575
581
|
markRunNotified(n.taskId, cycle);
|
|
576
582
|
cardEnqueuedRunIds.add(n.taskId);
|
|
577
583
|
}
|
|
578
584
|
if (terminal) {
|
|
579
585
|
try {
|
|
580
|
-
clearEnginePanelTaskResidentByWire(n.taskId,
|
|
581
|
-
publishEngineAgentPanelEvent(
|
|
582
|
-
kind: 'end',
|
|
583
|
-
taskId: n.taskId,
|
|
584
|
-
isError: isTerminalNotSuccess(n.status),
|
|
585
|
-
...(typeof n.seq === 'number' && Number.isInteger(n.seq) && n.seq >= BG_FIRST_SEQ ? { cycleSeq: n.seq } : {}),
|
|
586
|
-
});
|
|
586
|
+
clearEnginePanelTaskResidentByWire(n.taskId, notificationCycleOf(n));
|
|
587
|
+
publishEngineAgentPanelEvent(panelEndFact(n.taskId, isCoreTaskNotificationTerminalNotSuccess(n.status), notificationCycleOf(n)));
|
|
587
588
|
}
|
|
588
589
|
catch {
|
|
589
590
|
}
|
|
@@ -667,7 +668,7 @@ export function taskNotificationDeliverySupplement(objective) {
|
|
|
667
668
|
return `${SUPPLEMENT_LINE_PREFIX}completed — only this notification delivery failed. Check /tasks for the result.`;
|
|
668
669
|
}
|
|
669
670
|
const statusNote = status && status.length > 0 ? ` (status: ${status})` : '';
|
|
670
|
-
if (
|
|
671
|
+
if (isCoreTaskNotificationTerminal(status)) {
|
|
671
672
|
return `${SUPPLEMENT_LINE_PREFIX}already finished${statusNote} — only this notification delivery failed. Check /tasks for the result.`;
|
|
672
673
|
}
|
|
673
674
|
return `${SUPPLEMENT_LINE_PREFIX}is in a state this client cannot confirm${statusNote} — this notification delivery failed and the task's outcome is unknown here. Check /tasks for its current state.`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type OutputStyleSeatReading = {
|
|
2
|
+
kind: 'unobserved';
|
|
3
|
+
} | {
|
|
4
|
+
kind: 'not_reported';
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'present';
|
|
7
|
+
value: true;
|
|
8
|
+
};
|
|
9
|
+
export declare function projectOutputStyleSeatCapability(caps: unknown): OutputStyleSeatReading | undefined;
|
|
10
|
+
export declare function noteEngineCapsForOutputStyleSeat(baseUrl: string, caps: unknown, opts?: {
|
|
11
|
+
generation?: number;
|
|
12
|
+
}): void;
|
|
13
|
+
export declare function observedOutputStyleSeat(baseUrl?: string | undefined): OutputStyleSeatReading;
|
|
14
|
+
export declare function outputStyleSeatAdmitted(reading: OutputStyleSeatReading | undefined): boolean;
|
|
15
|
+
export declare function __resetOutputStyleSeatReadingsForTests(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
|
+
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField, readOwnDataValue } from './ownKey.js';
|
|
4
|
+
export function projectOutputStyleSeatCapability(caps) {
|
|
5
|
+
try {
|
|
6
|
+
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
7
|
+
return undefined;
|
|
8
|
+
const v = ownDataField(caps, 'outputStyle');
|
|
9
|
+
if (v === undefined)
|
|
10
|
+
return { kind: 'not_reported' };
|
|
11
|
+
return v === true ? { kind: 'present', value: true } : undefined;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const reader = createEngineCapReader({
|
|
18
|
+
name: 'outputStyleSeat',
|
|
19
|
+
project: projectOutputStyleSeatCapability,
|
|
20
|
+
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
21
|
+
});
|
|
22
|
+
export function noteEngineCapsForOutputStyleSeat(baseUrl, caps, opts) {
|
|
23
|
+
reader.note(baseUrl, caps, opts);
|
|
24
|
+
}
|
|
25
|
+
export function observedOutputStyleSeat(baseUrl = engineWireTarget()?.baseUrl) {
|
|
26
|
+
return reader.observed(baseUrl);
|
|
27
|
+
}
|
|
28
|
+
export function outputStyleSeatAdmitted(reading) {
|
|
29
|
+
try {
|
|
30
|
+
if (reading === null || reading === undefined || typeof reading !== 'object' || Array.isArray(reading))
|
|
31
|
+
return false;
|
|
32
|
+
if (readOwnDataValue(reading, 'kind') !== 'present')
|
|
33
|
+
return false;
|
|
34
|
+
return readOwnDataValue(reading, 'value') === true;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function __resetOutputStyleSeatReadingsForTests() {
|
|
41
|
+
reader.__resetForTests();
|
|
42
|
+
}
|
package/dist/ownKey.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export declare function putOwnKey<T>(table: Record<string, T>, key: string, value: T): void;
|
|
2
2
|
export declare function readOwnNonEmptyString(v: object | null | undefined, key: string): string | undefined;
|
|
3
|
+
export declare function readAskOrigin(carrier: object | null | undefined): string | undefined;
|
|
3
4
|
export declare function readOwnDataNonEmptyString(v: object | null | undefined, key: string): string | undefined;
|
|
4
5
|
export declare function readOwnDataValue<T>(v: object | null | undefined, key: string): T | undefined;
|
|
6
|
+
export declare function ownDataField(v: object, key: string): unknown;
|
|
7
|
+
export declare function ownSendableField(v: object, key: string): unknown;
|
|
8
|
+
export declare function ownDataRefusalKeyOf(e: unknown): string | undefined;
|
|
9
|
+
export declare function readFrameStringKey(frame: unknown, key: string): string | undefined;
|
|
10
|
+
export declare function markMcpSectionDroppedNamedRows(rows: object, dropped: ReadonlyMap<string, number>): void;
|
|
11
|
+
export declare function mcpSectionDroppedNamedRowsOf(rows: object | null | undefined, name: string): number;
|
package/dist/ownKey.js
CHANGED
|
@@ -7,6 +7,9 @@ export function readOwnNonEmptyString(v, key) {
|
|
|
7
7
|
const raw = v[key];
|
|
8
8
|
return typeof raw === 'string' && raw !== '' ? raw : undefined;
|
|
9
9
|
}
|
|
10
|
+
export function readAskOrigin(carrier) {
|
|
11
|
+
return readOwnNonEmptyString(carrier, 'origin');
|
|
12
|
+
}
|
|
10
13
|
export function readOwnDataNonEmptyString(v, key) {
|
|
11
14
|
if (typeof v !== 'object' || v === null)
|
|
12
15
|
return undefined;
|
|
@@ -22,3 +25,58 @@ export function readOwnDataValue(v, key) {
|
|
|
22
25
|
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
23
26
|
return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
|
|
24
27
|
}
|
|
28
|
+
export function ownDataField(v, key) {
|
|
29
|
+
return ownField(v, key, false);
|
|
30
|
+
}
|
|
31
|
+
export function ownSendableField(v, key) {
|
|
32
|
+
return ownField(v, key, true);
|
|
33
|
+
}
|
|
34
|
+
export function ownDataRefusalKeyOf(e) {
|
|
35
|
+
return typeof e === 'object' && e !== null ? REFUSAL_KEYS.get(e) : undefined;
|
|
36
|
+
}
|
|
37
|
+
const REFUSAL_KEYS = new WeakMap();
|
|
38
|
+
function ownField(v, key, sendable) {
|
|
39
|
+
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
40
|
+
if (d === undefined)
|
|
41
|
+
return undefined;
|
|
42
|
+
if (!Object.hasOwn(d, 'value') || (sendable && d.enumerable !== true)) {
|
|
43
|
+
const e = new TypeError(`own property "${key}" is not a plain${sendable ? ' enumerable' : ''} data property (accessors are not executed)`);
|
|
44
|
+
REFUSAL_KEYS.set(e, key);
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
return d.value;
|
|
48
|
+
}
|
|
49
|
+
export function readFrameStringKey(frame, key) {
|
|
50
|
+
try {
|
|
51
|
+
if (frame === null || typeof frame !== 'object' || Array.isArray(frame))
|
|
52
|
+
return undefined;
|
|
53
|
+
return readOwnDataNonEmptyString(frame, key);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const DROPPED_NAMED_ROWS = Symbol.for('@sema-agent/client-core/mcpSectionDroppedNamedRows');
|
|
60
|
+
export function markMcpSectionDroppedNamedRows(rows, dropped) {
|
|
61
|
+
if (dropped.size === 0)
|
|
62
|
+
return;
|
|
63
|
+
try {
|
|
64
|
+
Object.defineProperty(rows, DROPPED_NAMED_ROWS, { value: Object.freeze(new Map(dropped)), enumerable: false, writable: false, configurable: false });
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export function mcpSectionDroppedNamedRowsOf(rows, name) {
|
|
70
|
+
try {
|
|
71
|
+
if (rows === null || typeof rows !== 'object')
|
|
72
|
+
return 0;
|
|
73
|
+
const d = Object.getOwnPropertyDescriptor(rows, DROPPED_NAMED_ROWS);
|
|
74
|
+
if (d === undefined || !Object.hasOwn(d, 'value') || !(d.value instanceof Map))
|
|
75
|
+
return 0;
|
|
76
|
+
const n = d.value.get(name);
|
|
77
|
+
return typeof n === 'number' && Number.isInteger(n) && n > 0 ? n : 0;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
82
|
+
}
|