@sema-agent/client-core 0.94.0 → 0.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +521 -0
- package/README.md +104 -57
- package/dist/adapt/arms.js +12 -7
- package/dist/adapt/panelTasks.js +4 -10
- package/dist/adapt/toolCards.d.ts +1 -0
- package/dist/adapt/toolCards.js +18 -5
- package/dist/adapt/wireShapes.js +5 -24
- package/dist/adapter/activeRunSelfHeal.d.ts +12 -3
- package/dist/adapter/activeRunSelfHeal.js +50 -16
- package/dist/adapter/downstream/eventToSdkMessage.js +33 -18
- package/dist/adapter/downstream/terminalToSdkResult.js +19 -12
- package/dist/adapter/runStream.js +30 -46
- package/dist/adapter/types.d.ts +7 -0
- package/dist/adapter/types.js +15 -0
- package/dist/agentSession/backgroundView.js +5 -1
- package/dist/agentSession/engineAgentRegistryRead.js +7 -5
- package/dist/agentSession/engineSessionBackgroundStop.js +25 -17
- package/dist/agentsWireCaps.d.ts +2 -0
- package/dist/agentsWireCaps.js +13 -2
- package/dist/approvalDecidedByCapability.d.ts +0 -1
- package/dist/approvalDecidedByCapability.js +2 -7
- package/dist/approvalsStreamLiveCapability.d.ts +0 -1
- package/dist/approvalsStreamLiveCapability.js +2 -6
- package/dist/atMostOnce.d.ts +8 -0
- package/dist/atMostOnce.js +36 -0
- package/dist/attachmentSeatCapability.d.ts +0 -1
- package/dist/attachmentSeatCapability.js +0 -3
- package/dist/attachmentsWireCaps.js +11 -6
- package/dist/bashExitReading.d.ts +10 -0
- package/dist/bashExitReading.js +12 -0
- package/dist/callerCwdCapability.d.ts +0 -5
- package/dist/callerCwdCapability.js +2 -13
- package/dist/centerWiringCapability.d.ts +1 -7
- package/dist/centerWiringCapability.js +18 -27
- package/dist/classifierStatus.js +4 -4
- package/dist/classifierVerdictWire.js +4 -16
- package/dist/clientSlice.js +1 -1
- package/dist/cloudConfigWireCaps.d.ts +3 -3
- package/dist/cloudConfigWireCaps.js +85 -43
- package/dist/compensations.js +1 -1
- package/dist/coreValuePorts.d.ts +11 -7
- package/dist/coreValuePorts.js +5 -8
- package/dist/credentialProvenance.d.ts +28 -0
- package/dist/credentialProvenance.js +76 -0
- package/dist/cycleOrder.d.ts +15 -0
- package/dist/cycleOrder.js +45 -0
- package/dist/decideFailureNote.js +7 -2
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/decideReceipt.js +39 -14
- package/dist/declared/supportFloorDeclared.d.ts +1 -0
- package/dist/declared/supportFloorDeclared.js +5 -0
- package/dist/deviceExecutorManagementCapability.d.ts +0 -1
- package/dist/deviceExecutorManagementCapability.js +7 -16
- package/dist/deviceRebind.d.ts +88 -0
- package/dist/deviceRebind.js +242 -0
- package/dist/displayUntrusted.d.ts +8 -3
- package/dist/displayUntrusted.js +661 -63
- package/dist/engineAgentAbsence.d.ts +2 -2
- package/dist/engineAgentPanelStore.d.ts +8 -18
- package/dist/engineAgentPanelStore.js +19 -537
- package/dist/engineCapReader.d.ts +6 -6
- package/dist/engineCapReader.js +30 -43
- package/dist/engineCapsCache.d.ts +13 -2
- package/dist/engineCapsCache.js +276 -44
- package/dist/engineCredentialRequirement.d.ts +9 -0
- package/dist/engineCredentialRequirement.js +23 -0
- package/dist/engineDirectory.d.ts +79 -0
- package/dist/engineDirectory.js +186 -0
- package/dist/engineEnvSourcing.d.ts +53 -0
- package/dist/engineEnvSourcing.js +81 -0
- package/dist/engineErrorCodes.d.ts +28 -4
- package/dist/engineErrorCodes.js +68 -25
- package/dist/engineIdentity.js +2 -0
- package/dist/engineNoticeCodes.d.ts +17 -0
- package/dist/engineNoticeCodes.js +57 -3
- package/dist/engineWireSdk.js +2 -2
- package/dist/engineWordRenames.d.ts +8 -0
- package/dist/engineWordRenames.js +13 -0
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +18 -23
- package/dist/fileHistoryCaptureCapability.d.ts +14 -1
- package/dist/fileHistoryCaptureCapability.js +72 -6
- package/dist/fileHistoryLegNotice.d.ts +3 -2
- package/dist/fileHistoryLegNotice.js +51 -2
- package/dist/fleet/bgSubagentRow.d.ts +15 -0
- package/dist/fleet/bgSubagentRow.js +67 -0
- package/dist/fleet/fleetLedger.d.ts +3 -0
- package/dist/fleet/fleetLedger.js +153 -122
- package/dist/fleet/fleetProjection.d.ts +1 -3
- package/dist/fleet/fleetProjection.js +19 -19
- package/dist/fleetAgentPanelProjection.d.ts +4 -17
- package/dist/fleetAgentPanelProjection.js +7 -197
- package/dist/fleetAgentRowLike.d.ts +16 -0
- package/dist/fleetAgentRowLike.js +1 -0
- package/dist/fleetTaskDesc.js +4 -17
- package/dist/gateOutcome.d.ts +12 -1
- package/dist/gateOutcome.js +87 -18
- package/dist/gateVocabulary.d.ts +7 -2
- package/dist/gateVocabulary.js +5 -1
- package/dist/generated/engineAskFaceTables.js +1 -1
- package/dist/generated/engineFactTables.d.ts +5 -3
- package/dist/generated/engineFactTables.js +17 -4
- package/dist/generated/engineNoticeTables.js +12 -3
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +17 -0
- package/dist/generated/settingsSchemaFns.d.ts +13 -0
- package/dist/generated/settingsSchemaFns.js +75 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/headlessPermissionModeWire.d.ts +1 -1
- package/dist/headlessPermissionModeWire.js +1 -1
- package/dist/headlessReconnectWire.js +49 -20
- package/dist/hitl/allowRuleShadow.d.ts +1 -1
- package/dist/hitl/allowRuleShadow.js +49 -8
- package/dist/hitl/approvalCompleteParked.d.ts +1 -0
- package/dist/hitl/approvalCompleteParked.js +14 -0
- package/dist/hitl/approvalEndingCause.d.ts +7 -0
- package/dist/hitl/approvalEndingCause.js +71 -0
- package/dist/hitl/approvalHolds.d.ts +12 -2
- package/dist/hitl/approvalHolds.js +53 -2
- package/dist/hitl/approvalsFeed.js +23 -11
- package/dist/hitl/askGateWire.d.ts +2 -1
- package/dist/hitl/askGateWire.js +26 -1
- package/dist/hitl/askParkRowRouting.js +1 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +15 -10
- package/dist/hitl/crashConverged.js +2 -0
- package/dist/hitl/decisionConflict.d.ts +3 -0
- package/dist/hitl/decisionConflict.js +41 -0
- package/dist/hitl/decisionRefusal.d.ts +12 -0
- package/dist/hitl/decisionRefusal.js +63 -4
- package/dist/hitl/frameRouter.d.ts +0 -1
- package/dist/hitl/frameRouter.js +32 -57
- package/dist/hitl/gateLedger.d.ts +5 -0
- package/dist/hitl/gateLedger.js +21 -0
- package/dist/hitl/hitlBridge.d.ts +17 -2
- package/dist/hitl/hitlBridge.js +91 -55
- package/dist/hitl/hitlHostSurface.js +3 -11
- package/dist/hitl/livePendingAsk.d.ts +16 -6
- package/dist/hitl/livePendingAsk.js +36 -4
- package/dist/hitl/localAllowRule.d.ts +1 -0
- package/dist/hitl/localAllowRule.js +2 -2
- package/dist/hitl/noAllowCause.d.ts +2 -1
- package/dist/hitl/noAllowCause.js +3 -2
- package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
- package/dist/hitl/parkExpiryJudgements.js +46 -0
- package/dist/hitl/parkResolver.d.ts +4 -7
- package/dist/hitl/parkResolver.js +12 -34
- package/dist/hitl/parkRowBirthWait.d.ts +1 -0
- package/dist/hitl/parkRowBirthWait.js +2 -2
- package/dist/hitl/persistedRulesWire.js +5 -1
- package/dist/hitl/planReviewWire.d.ts +3 -2
- package/dist/hitl/planReviewWire.js +154 -50
- package/dist/hitl/replayedApproval.d.ts +9 -0
- package/dist/hitl/replayedApproval.js +139 -10
- package/dist/hitl/resumeRunningCard.d.ts +2 -0
- package/dist/hitl/resumeRunningCard.js +15 -4
- package/dist/hitl/sessionPolicyDeliverable.js +8 -6
- package/dist/hitl/standingRows.d.ts +18 -0
- package/dist/hitl/standingRows.js +127 -0
- package/dist/hitl/toolApprovalWire.d.ts +39 -7
- package/dist/hitl/toolApprovalWire.js +351 -61
- package/dist/hookMatcherVerdict.d.ts +1 -9
- package/dist/hookMatcherVerdict.js +21 -61
- package/dist/hooksWireCaps.js +40 -8
- package/dist/host.d.ts +5 -0
- package/dist/host.js +3 -1
- package/dist/hostCallbackGuard.d.ts +2 -0
- package/dist/hostCallbackGuard.js +31 -0
- package/dist/index.d.ts +48 -17
- package/dist/index.js +36 -15
- package/dist/interactiveInterrupt.d.ts +8 -0
- package/dist/interactiveInterrupt.js +54 -0
- package/dist/limitsWire.d.ts +5 -0
- package/dist/limitsWire.js +49 -3
- package/dist/liveModelCatalog.d.ts +95 -0
- package/dist/liveModelCatalog.js +297 -32
- package/dist/mcpEngineLeg.d.ts +25 -0
- package/dist/mcpEngineLeg.js +71 -15
- package/dist/mcpPanel.js +2 -1
- package/dist/mcpProbeCapability.d.ts +0 -5
- package/dist/mcpProbeCapability.js +2 -12
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +10 -5
- package/dist/memoryComplianceCapability.d.ts +0 -5
- package/dist/memoryComplianceCapability.js +2 -12
- package/dist/memoryOriginCapability.d.ts +0 -5
- package/dist/memoryOriginCapability.js +2 -12
- package/dist/memorySpecWire.js +2 -2
- package/dist/memoryVerbsWire.d.ts +1 -1
- package/dist/memoryVerbsWire.js +4 -0
- package/dist/model/liveCatalogShape.d.ts +14 -0
- package/dist/model/liveCatalogShape.js +71 -0
- package/dist/model/modelSupplyRules.d.ts +1 -0
- package/dist/model/modelSupplyRules.js +30 -9
- package/dist/model/modelsPolicy.d.ts +21 -0
- package/dist/model/modelsPolicy.js +90 -0
- package/dist/modelIdentityResolvability.d.ts +2 -2
- package/dist/modelIdentityResolvability.js +14 -12
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/noticePresentation.d.ts +68 -0
- package/dist/noticePresentation.js +247 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +0 -2
- package/dist/outputStyleSeatCapability.js +2 -10
- package/dist/ownKey.d.ts +8 -0
- package/dist/ownKey.js +66 -0
- package/dist/panelReduce.d.ts +114 -0
- package/dist/panelReduce.js +1135 -0
- package/dist/panelStateHolder.d.ts +17 -0
- package/dist/panelStateHolder.js +201 -0
- package/dist/peerFrames.js +13 -9
- package/dist/peerLaneCapability.d.ts +0 -1
- package/dist/peerLaneCapability.js +2 -6
- package/dist/permissionModesCapability.d.ts +0 -5
- package/dist/permissionModesCapability.js +5 -16
- package/dist/permissionRuleIssue.js +0 -3
- package/dist/permissionRulesWriteCapability.d.ts +0 -1
- package/dist/permissionRulesWriteCapability.js +2 -6
- package/dist/permissionsAllowGrantCapability.d.ts +0 -1
- package/dist/permissionsAllowGrantCapability.js +3 -9
- package/dist/permissionsDeclaration.d.ts +8 -0
- package/dist/permissionsDeclaration.js +101 -41
- package/dist/printPermissionOutcome.d.ts +12 -0
- package/dist/printPermissionOutcome.js +50 -0
- package/dist/printToolResultFrame.d.ts +1 -0
- package/dist/printToolResultFrame.js +5 -17
- package/dist/promptBlockedCopy.d.ts +5 -0
- package/dist/promptBlockedCopy.js +35 -0
- package/dist/promptDelivery.js +0 -8
- package/dist/protocolSegment.d.ts +9 -6
- package/dist/protocolSegment.js +31 -21
- package/dist/providerRejection.d.ts +4 -0
- package/dist/providerRejection.js +75 -14
- package/dist/replayBody.d.ts +12 -0
- package/dist/replayBody.js +25 -0
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +127 -32
- package/dist/retryStatus.d.ts +9 -1
- package/dist/retryStatus.js +9 -2
- package/dist/rewindArchiveCapability.d.ts +5 -14
- package/dist/rewindArchiveCapability.js +18 -61
- package/dist/rewindArchiveReading.d.ts +15 -0
- package/dist/rewindArchiveReading.js +56 -0
- package/dist/rewindEngineAction.d.ts +21 -0
- package/dist/rewindEngineAction.js +36 -0
- package/dist/rewindWireCaps.d.ts +2 -1
- package/dist/rewindWireCaps.js +1 -0
- package/dist/ruleCompileVerdict.d.ts +9 -1
- package/dist/ruleCompileVerdict.js +29 -4
- package/dist/runTerminal.d.ts +15 -12
- package/dist/runTerminal.js +60 -35
- package/dist/sandboxWire.js +13 -0
- package/dist/sdkRegistryTransit.d.ts +2 -1
- package/dist/sdkRegistryTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +0 -5
- package/dist/sealedKeyCapability.js +3 -15
- package/dist/seam.js +4 -2
- package/dist/seatContract.d.ts +125 -34
- package/dist/seatContract.js +583 -179
- package/dist/sessionIdSegment.d.ts +1 -0
- package/dist/sessionIdSegment.js +11 -0
- package/dist/sessionMemoryErase.d.ts +1 -1
- package/dist/sessionMemoryErase.js +6 -1
- package/dist/sessionMemoryStatus.js +3 -2
- package/dist/sessionPolicyCapability.d.ts +0 -1
- package/dist/sessionPolicyCapability.js +2 -6
- package/dist/sessionReadRedactionCapability.d.ts +0 -5
- package/dist/sessionReadRedactionCapability.js +2 -13
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +66 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -2
- package/dist/sessionSyncFileHistoryCapability.js +2 -9
- package/dist/skillToolListsCapability.d.ts +0 -2
- package/dist/skillToolListsCapability.js +2 -9
- package/dist/skillsWireCaps.d.ts +4 -0
- package/dist/skillsWireCaps.js +66 -1
- package/dist/sqlEngineCapability.d.ts +0 -1
- package/dist/sqlEngineCapability.js +9 -14
- package/dist/steerPriorityCapability.d.ts +0 -2
- package/dist/steerPriorityCapability.js +3 -12
- package/dist/storePostureCapability.d.ts +1 -5
- package/dist/storePostureCapability.js +16 -22
- package/dist/streamDrainingLegs.d.ts +6 -0
- package/dist/streamDrainingLegs.js +23 -0
- package/dist/subagent/engineCompactWire.js +13 -38
- package/dist/subagent/engineDelegatedPrompt.js +10 -6
- package/dist/subagent/engineSubagentOutput.d.ts +0 -1
- package/dist/subagent/engineSubagentOutput.js +5 -20
- package/dist/subagent/engineSubagentSteer.js +7 -5
- package/dist/subagent/engineSubagentTail.d.ts +0 -1
- package/dist/subagent/engineSubagentTail.js +7 -32
- package/dist/subagentContentStore.js +7 -18
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +15 -14
- package/dist/systemReminderTag.d.ts +1 -0
- package/dist/systemReminderTag.js +8 -0
- package/dist/terminalStatuses.d.ts +30 -0
- package/dist/terminalStatuses.js +67 -0
- package/dist/toolHistoryMismatch.d.ts +0 -3
- package/dist/toolHistoryMismatch.js +3 -7
- package/dist/toolResult.d.ts +6 -1
- package/dist/toolResult.js +90 -37
- package/dist/toolResultContent.d.ts +2 -0
- package/dist/toolResultContent.js +63 -0
- package/dist/types/engineState.d.ts +2 -1
- package/dist/usageAnalytics.d.ts +146 -0
- package/dist/usageAnalytics.js +335 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -2
- package/dist/userInvokedSkillsCapability.js +2 -9
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +3 -7
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireErrorTriage.d.ts +2 -0
- package/dist/wireErrorTriage.js +34 -5
- package/dist/wireFailureShape.d.ts +23 -2
- package/dist/wireFailureShape.js +88 -43
- package/dist/wireRefusalCopy.js +2 -18
- package/dist/workflowClient.js +7 -11
- package/dist/workflowsJournalCapability.d.ts +0 -1
- package/dist/workflowsJournalCapability.js +2 -6
- package/dist/writeProtectionCapability.d.ts +0 -1
- package/dist/writeProtectionCapability.js +5 -10
- package/docs/INTEGRATION-CLIENTS.md +2279 -27
- package/package.json +5 -5
- package/dist/engineCapsGenerationGuard.d.ts +0 -4
- package/dist/engineCapsGenerationGuard.js +0 -19
- package/dist/panelRunningHistory.d.ts +0 -22
- package/dist/panelRunningHistory.js +0 -82
- package/dist/registryConflict.d.ts +0 -3
- package/dist/registryConflict.js +0 -44
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
export const MEMORY_ENGINE_REQUIRED_CODE = 'capability.memory_engine_required';
|
|
4
5
|
export function projectMemoryComplianceCapability(caps) {
|
|
5
6
|
try {
|
|
6
7
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
7
8
|
return undefined;
|
|
8
9
|
const c = caps;
|
|
9
|
-
|
|
10
|
-
return { kind: 'not_reported' };
|
|
11
|
-
const v = c.memoryCompliance;
|
|
10
|
+
const v = ownDataField(c, 'memoryCompliance');
|
|
12
11
|
if (v === undefined)
|
|
13
12
|
return { kind: 'not_reported' };
|
|
14
13
|
if (typeof v !== 'boolean')
|
|
@@ -24,9 +23,6 @@ const reader = createEngineCapReader({
|
|
|
24
23
|
project: projectMemoryComplianceCapability,
|
|
25
24
|
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
26
25
|
});
|
|
27
|
-
export function noteEngineCapsForMemoryCompliance(baseUrl, caps, opts) {
|
|
28
|
-
reader.note(baseUrl, caps, opts);
|
|
29
|
-
}
|
|
30
26
|
export function observedMemoryCompliance(baseUrl = engineWireTarget()?.baseUrl) {
|
|
31
27
|
return reader.observed(baseUrl);
|
|
32
28
|
}
|
|
@@ -49,9 +45,3 @@ export function memoryComplianceDoctorDetail(reading) {
|
|
|
49
45
|
return 'memory compliance face on — the entry-provenance and erasure endpoints are mounted and the operator roster is non-empty on this engine; this says the door opens, not that any one call succeeds (a damaged control-plane ledger is a runtime fact and arrives as a typed 500)';
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
|
-
export function forgetMemoryComplianceReading(baseUrl) {
|
|
53
|
-
reader.forget(baseUrl);
|
|
54
|
-
}
|
|
55
|
-
export function __resetMemoryComplianceReadingsForTests() {
|
|
56
|
-
reader.__resetForTests();
|
|
57
|
-
}
|
|
@@ -8,11 +8,6 @@ export type MemoryOriginReading = {
|
|
|
8
8
|
kind: 'present';
|
|
9
9
|
};
|
|
10
10
|
export declare function projectMemoryOriginCapability(caps: unknown): MemoryOriginReading | undefined;
|
|
11
|
-
export declare function noteEngineCapsForMemoryOrigin(baseUrl: string, caps: unknown, opts?: {
|
|
12
|
-
generation?: number;
|
|
13
|
-
}): void;
|
|
14
11
|
export declare function observedMemoryOrigin(baseUrl?: string | undefined): MemoryOriginReading;
|
|
15
12
|
export declare function memoryOriginVerbsAvailable(reading: MemoryOriginReading): 'yes' | 'no' | 'unknown';
|
|
16
13
|
export declare function memoryOriginDoctorDetail(reading: MemoryOriginReading): string;
|
|
17
|
-
export declare function forgetMemoryOriginReading(baseUrl: string | undefined): void;
|
|
18
|
-
export declare function __resetMemoryOriginReadingsForTests(): void;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
import { MEMORY_ENGINE_REQUIRED_CODE } from './memoryComplianceCapability.js';
|
|
4
5
|
export function projectMemoryOriginCapability(caps) {
|
|
5
6
|
try {
|
|
6
7
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
7
8
|
return undefined;
|
|
8
9
|
const c = caps;
|
|
9
|
-
|
|
10
|
-
return { kind: 'not_reported' };
|
|
11
|
-
const v = c.memoryOrigin;
|
|
10
|
+
const v = ownDataField(c, 'memoryOrigin');
|
|
12
11
|
if (v === undefined)
|
|
13
12
|
return { kind: 'not_reported' };
|
|
14
13
|
if (typeof v !== 'boolean')
|
|
@@ -24,9 +23,6 @@ const reader = createEngineCapReader({
|
|
|
24
23
|
project: projectMemoryOriginCapability,
|
|
25
24
|
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
26
25
|
});
|
|
27
|
-
export function noteEngineCapsForMemoryOrigin(baseUrl, caps, opts) {
|
|
28
|
-
reader.note(baseUrl, caps, opts);
|
|
29
|
-
}
|
|
30
26
|
export function observedMemoryOrigin(baseUrl = engineWireTarget()?.baseUrl) {
|
|
31
27
|
return reader.observed(baseUrl);
|
|
32
28
|
}
|
|
@@ -49,9 +45,3 @@ export function memoryOriginDoctorDetail(reading) {
|
|
|
49
45
|
return 'external-origin face on — the origin listing and clearance endpoints are mounted and the operator roster is non-empty on this engine; this says the door opens, not that any one call succeeds, and it says nothing about the listing being complete (the engine has no scope-enumeration read face, so an answer covers only the scopes the caller named and an empty one must never be read as a clean store)';
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
|
-
export function forgetMemoryOriginReading(baseUrl) {
|
|
53
|
-
reader.forget(baseUrl);
|
|
54
|
-
}
|
|
55
|
-
export function __resetMemoryOriginReadingsForTests() {
|
|
56
|
-
reader.__resetForTests();
|
|
57
|
-
}
|
package/dist/memorySpecWire.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH } from './engineErrorCodes.js';
|
|
2
|
-
import {
|
|
2
|
+
import { escapeDisplayControlChars } from './fleetTaskDesc.js';
|
|
3
3
|
export const KNOWN_AGENT_MEMORY_SPEC_KEYS = Object.freeze([
|
|
4
4
|
'enabled',
|
|
5
5
|
'scopeContract',
|
|
@@ -128,7 +128,7 @@ function quotedKeyForDisplay(key) {
|
|
|
128
128
|
let out = '';
|
|
129
129
|
let truncated = false;
|
|
130
130
|
for (const ch of key) {
|
|
131
|
-
const tok = ch === '\\' ? '\\\\' : ch === '"' ? '\\"' :
|
|
131
|
+
const tok = ch === '\\' ? '\\\\' : ch === '"' ? '\\"' : escapeDisplayControlChars(ch);
|
|
132
132
|
if (out.length + tok.length > MEMORY_SPEC_KEY_DISPLAY_MAX) {
|
|
133
133
|
truncated = true;
|
|
134
134
|
break;
|
|
@@ -21,7 +21,7 @@ export interface MemoryFacade {
|
|
|
21
21
|
}
|
|
22
22
|
export declare const MEMORY_VERB_REFUSAL_CAUSES: readonly ["face_absent", "client_too_old", "unreadable_request", "store_absent", "operator_only", "operators_unconfigured", "unauthorized", "service_token_required", "id_invalid", "request_id_required", "body_shape", "query_invalid", "selector_invalid", "evidence_unavailable", "selector_mismatch", "census_incomplete", "clear_unattributed", "clear_invalid", "clear_not_marked", "clear_challenged", "clear_conflict", "clear_pending"];
|
|
23
23
|
export type MemoryVerbRefusalCause = (typeof MEMORY_VERB_REFUSAL_CAUSES)[number];
|
|
24
|
-
export declare const MEMORY_VERB_UNKNOWN_WHYS: readonly ["no_verdict", "server_fault", "control_plane_corrupt", "clear_unknown", "clear_failed", "result_unreadable", "unsupported_version", "identity_mismatch", "unclassified"];
|
|
24
|
+
export declare const MEMORY_VERB_UNKNOWN_WHYS: readonly ["no_verdict", "server_fault", "control_plane_corrupt", "clear_unknown", "clear_failed", "result_unreadable", "unsupported_version", "identity_mismatch", "store_form_refused", "unclassified"];
|
|
25
25
|
export type MemoryVerbUnknownWhy = (typeof MEMORY_VERB_UNKNOWN_WHYS)[number];
|
|
26
26
|
export type MemoryVerbRefused = {
|
|
27
27
|
status: 'refused';
|
package/dist/memoryVerbsWire.js
CHANGED
|
@@ -35,6 +35,7 @@ export const MEMORY_VERB_UNKNOWN_WHYS = Object.freeze([
|
|
|
35
35
|
'result_unreadable',
|
|
36
36
|
'unsupported_version',
|
|
37
37
|
'identity_mismatch',
|
|
38
|
+
'store_form_refused',
|
|
38
39
|
'unclassified',
|
|
39
40
|
]);
|
|
40
41
|
function refusedBy(cause, message) {
|
|
@@ -90,6 +91,9 @@ export function classifyMemoryFailure(e) {
|
|
|
90
91
|
return unknownBy('clear_unknown', message);
|
|
91
92
|
case 'memory.origin_clear_failed':
|
|
92
93
|
return unknownBy('clear_failed', message);
|
|
94
|
+
case 'memory.target_outside_store':
|
|
95
|
+
case 'memory.scope_home_not_directory':
|
|
96
|
+
return unknownBy('store_form_refused', message);
|
|
93
97
|
case 'internal.memory_control_plane_corrupt':
|
|
94
98
|
return unknownBy('control_plane_corrupt', message);
|
|
95
99
|
default:
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type FrozenJsonValue = string | number | boolean | null | readonly FrozenJsonValue[] | {
|
|
2
|
+
readonly [k: string]: FrozenJsonValue;
|
|
3
|
+
};
|
|
4
|
+
export declare function frozenJsonCopyOf(v: unknown): FrozenJsonValue | undefined;
|
|
5
|
+
export declare function liveModelRowCopy(row: unknown): FrozenJsonRow | undefined;
|
|
6
|
+
export type FrozenJsonRow = {
|
|
7
|
+
readonly [k: string]: FrozenJsonValue;
|
|
8
|
+
} & {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function liveDefaultModelCopy(v: unknown): {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly name?: string;
|
|
14
|
+
} | undefined;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const MAX_DEPTH = 16;
|
|
2
|
+
class Unreadable extends Error {
|
|
3
|
+
}
|
|
4
|
+
function frozenJsonCopy(v, depth) {
|
|
5
|
+
if (depth > MAX_DEPTH)
|
|
6
|
+
throw new Unreadable();
|
|
7
|
+
if (v === null || typeof v === 'string' || typeof v === 'boolean')
|
|
8
|
+
return v;
|
|
9
|
+
if (typeof v === 'number') {
|
|
10
|
+
if (!Number.isFinite(v))
|
|
11
|
+
throw new Unreadable();
|
|
12
|
+
return v;
|
|
13
|
+
}
|
|
14
|
+
if (typeof v !== 'object')
|
|
15
|
+
throw new Unreadable();
|
|
16
|
+
if (Array.isArray(v)) {
|
|
17
|
+
const n = Object.getOwnPropertyDescriptor(v, 'length')?.value;
|
|
18
|
+
if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0)
|
|
19
|
+
throw new Unreadable();
|
|
20
|
+
const out = [];
|
|
21
|
+
for (let i = 0; i < n; i += 1) {
|
|
22
|
+
const d = Object.getOwnPropertyDescriptor(v, String(i));
|
|
23
|
+
if (d === undefined || !('value' in d))
|
|
24
|
+
throw new Unreadable();
|
|
25
|
+
out.push(frozenJsonCopy(d.value, depth + 1));
|
|
26
|
+
}
|
|
27
|
+
return Object.freeze(out);
|
|
28
|
+
}
|
|
29
|
+
const out = {};
|
|
30
|
+
for (const k of Object.keys(v)) {
|
|
31
|
+
const d = Object.getOwnPropertyDescriptor(v, k);
|
|
32
|
+
if (d === undefined || !('value' in d))
|
|
33
|
+
throw new Unreadable();
|
|
34
|
+
if (d.value === undefined)
|
|
35
|
+
continue;
|
|
36
|
+
Object.defineProperty(out, k, { value: frozenJsonCopy(d.value, depth + 1), enumerable: true, writable: true, configurable: true });
|
|
37
|
+
}
|
|
38
|
+
return Object.freeze(out);
|
|
39
|
+
}
|
|
40
|
+
export function frozenJsonCopyOf(v) {
|
|
41
|
+
try {
|
|
42
|
+
return frozenJsonCopy(v, 0);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function liveModelRowCopy(row) {
|
|
49
|
+
if (row === null || typeof row !== 'object' || Array.isArray(row))
|
|
50
|
+
return undefined;
|
|
51
|
+
const copy = frozenJsonCopyOf(row);
|
|
52
|
+
if (!isFrozenJsonObject(copy))
|
|
53
|
+
return undefined;
|
|
54
|
+
const name = copy.name;
|
|
55
|
+
return typeof name === 'string' && name.length > 0 ? copy : undefined;
|
|
56
|
+
}
|
|
57
|
+
const isFrozenJsonObject = (v) => v !== undefined && v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
58
|
+
export function liveDefaultModelCopy(v) {
|
|
59
|
+
if (v === null || typeof v !== 'object' || Array.isArray(v))
|
|
60
|
+
return undefined;
|
|
61
|
+
const c = frozenJsonCopyOf(v);
|
|
62
|
+
if (!isFrozenJsonObject(c))
|
|
63
|
+
return undefined;
|
|
64
|
+
const id = c.id;
|
|
65
|
+
const name = c.name;
|
|
66
|
+
if (typeof id !== 'string' || id.length === 0)
|
|
67
|
+
return undefined;
|
|
68
|
+
if (Object.hasOwn(c, 'name') && (typeof name !== 'string' || name.length === 0))
|
|
69
|
+
return undefined;
|
|
70
|
+
return c;
|
|
71
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SETTINGS_NARROW_AT_MENTION } from '../generated/settingsSchemaFns.js';
|
|
2
|
+
import { modelsPolicyOf } from './modelsPolicy.js';
|
|
1
3
|
import { inferFamily } from './providerPresets.js';
|
|
2
4
|
function isPlainObject(v) {
|
|
3
5
|
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
@@ -13,15 +15,16 @@ export function resolveEntryVision(entry) {
|
|
|
13
15
|
export function computeDeleteWarnings(input) {
|
|
14
16
|
const { id, doc, tierGroups, survivingIds } = input;
|
|
15
17
|
const out = [];
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
if (effectiveBefore.length > 0 && effectiveAfter.length === 0) {
|
|
18
|
+
const am = modelsPolicyOf(doc).atMention;
|
|
19
|
+
if (am?.kind === 'read' && am.value.mode === 'only') {
|
|
20
|
+
const before = SETTINGS_NARROW_AT_MENTION(am.value, new Set([id, ...survivingIds]));
|
|
21
|
+
const after = SETTINGS_NARROW_AT_MENTION(am.value, new Set(survivingIds.filter((n) => n !== id)));
|
|
22
|
+
if (before.mode === 'only' && after.mode === 'none') {
|
|
22
23
|
out.push({
|
|
23
24
|
kind: 'allowlist-empties',
|
|
24
|
-
consequence:
|
|
25
|
+
consequence: am.from === 'atModelAllowlist'
|
|
26
|
+
? 'it is the last usable model on your @-mention allowlist — deleting it empties the list, which means EVERY enabled model becomes @-mentionable'
|
|
27
|
+
: 'it is the last usable model on your @-mention allowlist — deleting it leaves no model that can be @-mentioned',
|
|
25
28
|
});
|
|
26
29
|
}
|
|
27
30
|
}
|
|
@@ -47,15 +50,33 @@ export function computeDeleteWarnings(input) {
|
|
|
47
50
|
export function computeDeleteBlockers(input) {
|
|
48
51
|
const { id, doc, rosters } = input;
|
|
49
52
|
const out = [];
|
|
50
|
-
|
|
53
|
+
const policy = modelsPolicyOf(doc);
|
|
54
|
+
if (policy.unreadable) {
|
|
55
|
+
out.push({
|
|
56
|
+
kind: 'unreadable',
|
|
57
|
+
where: 'models.json (the document could not be read)',
|
|
58
|
+
fix: 'fix or re-save models.json so it can be read, then delete this model',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (policy.defaultUnreadable) {
|
|
62
|
+
out.push({
|
|
63
|
+
kind: 'unreadable',
|
|
64
|
+
where: 'models.json `default` (the default model could not be read)',
|
|
65
|
+
fix: 'fix or re-save models.json so its default model can be read, then delete this model',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const dm = policy.defaultModel;
|
|
69
|
+
if (dm !== undefined && dm.name === id) {
|
|
51
70
|
out.push({
|
|
52
71
|
kind: 'default',
|
|
53
|
-
where: 'models.json `default`',
|
|
72
|
+
where: dm.from === 'default' ? 'models.json `default`' : 'models.json roles.default',
|
|
54
73
|
fix: 'point another model at the default first (Model Hub: select it and press u), then delete this one',
|
|
55
74
|
});
|
|
56
75
|
}
|
|
57
76
|
if (doc && isPlainObject(doc.roles)) {
|
|
58
77
|
for (const [role, target] of Object.entries(doc.roles)) {
|
|
78
|
+
if (role === 'default' && dm?.from === 'roles.default')
|
|
79
|
+
continue;
|
|
59
80
|
if (!isPlainObject(target) || typeof target.model !== 'string')
|
|
60
81
|
continue;
|
|
61
82
|
if (target.model !== id)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type SettingsAtMention } from '../generated/settingsSchemaFns.js';
|
|
2
|
+
export interface CanonicalDefaultModel {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly from: 'default' | 'roles.default';
|
|
5
|
+
}
|
|
6
|
+
export type CanonicalAtMention = {
|
|
7
|
+
readonly kind: 'read';
|
|
8
|
+
readonly value: SettingsAtMention;
|
|
9
|
+
readonly from: 'atMention' | 'atModelAllowlist';
|
|
10
|
+
readonly unreadableEntries: number;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'unreadable';
|
|
13
|
+
readonly from: 'atMention' | 'atModelAllowlist';
|
|
14
|
+
};
|
|
15
|
+
export interface CanonicalModelsPolicy {
|
|
16
|
+
readonly defaultModel?: CanonicalDefaultModel;
|
|
17
|
+
readonly defaultUnreadable?: true;
|
|
18
|
+
readonly atMention?: CanonicalAtMention;
|
|
19
|
+
readonly unreadable?: true;
|
|
20
|
+
}
|
|
21
|
+
export declare function modelsPolicyOf(doc: unknown): CanonicalModelsPolicy;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { SETTINGS_AT_MENTION_MODES } from '../generated/settingsSchemaFns.js';
|
|
2
|
+
function ownData(o, key) {
|
|
3
|
+
try {
|
|
4
|
+
const d = Object.getOwnPropertyDescriptor(o, key);
|
|
5
|
+
return d !== undefined && 'value' in d ? d.value : undefined;
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
12
|
+
function atMentionOf(v) {
|
|
13
|
+
try {
|
|
14
|
+
if (!isRecord(v))
|
|
15
|
+
return undefined;
|
|
16
|
+
const mode = ownData(v, 'mode');
|
|
17
|
+
if (typeof mode !== 'string' || !SETTINGS_AT_MENTION_MODES.includes(mode))
|
|
18
|
+
return undefined;
|
|
19
|
+
if (mode !== 'only')
|
|
20
|
+
return { mode: mode };
|
|
21
|
+
const list = ownData(v, 'models');
|
|
22
|
+
if (!Array.isArray(list) || list.length === 0)
|
|
23
|
+
return undefined;
|
|
24
|
+
const out = [];
|
|
25
|
+
for (let i = 0; i < list.length; i += 1) {
|
|
26
|
+
const d = Object.getOwnPropertyDescriptor(list, i);
|
|
27
|
+
if (d === undefined || !('value' in d) || typeof d.value !== 'string' || d.value.length === 0)
|
|
28
|
+
return undefined;
|
|
29
|
+
out.push(d.value);
|
|
30
|
+
}
|
|
31
|
+
return { mode: 'only', models: out };
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function atModelAllowlistOf(v) {
|
|
38
|
+
if (!Array.isArray(v))
|
|
39
|
+
return { kind: 'unreadable', from: 'atModelAllowlist' };
|
|
40
|
+
const names = [];
|
|
41
|
+
let bad = 0;
|
|
42
|
+
for (let i = 0; i < v.length; i += 1) {
|
|
43
|
+
const d = Object.getOwnPropertyDescriptor(v, i);
|
|
44
|
+
const x = d !== undefined && 'value' in d ? d.value : undefined;
|
|
45
|
+
if (typeof x === 'string' && x.length > 0)
|
|
46
|
+
names.push(x);
|
|
47
|
+
else
|
|
48
|
+
bad += 1;
|
|
49
|
+
}
|
|
50
|
+
const value = names.length > 0 ? { mode: 'only', models: names } : { mode: 'all' };
|
|
51
|
+
return { kind: 'read', value, from: 'atModelAllowlist', unreadableEntries: bad };
|
|
52
|
+
}
|
|
53
|
+
export function modelsPolicyOf(doc) {
|
|
54
|
+
try {
|
|
55
|
+
if (!isRecord(doc))
|
|
56
|
+
return {};
|
|
57
|
+
let defaultModel;
|
|
58
|
+
let defaultUnreadable = false;
|
|
59
|
+
if (Object.hasOwn(doc, 'default')) {
|
|
60
|
+
const d = ownData(doc, 'default');
|
|
61
|
+
if (typeof d === 'string' && d.length > 0)
|
|
62
|
+
defaultModel = { name: d, from: 'default' };
|
|
63
|
+
else
|
|
64
|
+
defaultUnreadable = true;
|
|
65
|
+
}
|
|
66
|
+
if (defaultModel === undefined && !defaultUnreadable) {
|
|
67
|
+
const roles = ownData(doc, 'roles');
|
|
68
|
+
const rd = isRecord(roles) ? ownData(roles, 'default') : undefined;
|
|
69
|
+
const model = isRecord(rd) ? ownData(rd, 'model') : undefined;
|
|
70
|
+
if (typeof model === 'string' && model.length > 0)
|
|
71
|
+
defaultModel = { name: model, from: 'roles.default' };
|
|
72
|
+
}
|
|
73
|
+
let atMention;
|
|
74
|
+
if (Object.hasOwn(doc, 'atMention')) {
|
|
75
|
+
const am = atMentionOf(ownData(doc, 'atMention'));
|
|
76
|
+
atMention = am === undefined ? { kind: 'unreadable', from: 'atMention' } : { kind: 'read', value: am, from: 'atMention', unreadableEntries: 0 };
|
|
77
|
+
}
|
|
78
|
+
else if (Object.hasOwn(doc, 'atModelAllowlist')) {
|
|
79
|
+
atMention = atModelAllowlistOf(ownData(doc, 'atModelAllowlist'));
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
...(defaultModel !== undefined ? { defaultModel } : {}),
|
|
83
|
+
...(defaultUnreadable ? { defaultUnreadable: true } : {}),
|
|
84
|
+
...(atMention !== undefined ? { atMention } : {}),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return { unreadable: true };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -25,10 +25,10 @@ export interface RemoteEngineModelIdentityReading {
|
|
|
25
25
|
}
|
|
26
26
|
export type ModelIdentityReading = LocalEngineModelIdentityReading | RemoteEngineModelIdentityReading;
|
|
27
27
|
export type ModelIdentityResolvability = 'resolvable' | 'not_resolvable' | 'unknown';
|
|
28
|
-
export type ModelSetupDecision = 'offer_setup' | 'explain_unconfigured' | 'explain_route_gap' | 'proceed';
|
|
28
|
+
export type ModelSetupDecision = 'offer_setup' | 'offer_route_setup' | 'explain_unconfigured' | 'explain_route_gap' | 'explain_route_unconfigurable' | 'proceed';
|
|
29
29
|
export declare function modelIdentityResolvability(reading: ModelIdentityReading): ModelIdentityResolvability;
|
|
30
30
|
export declare function modelIdentityDetail(reading: ModelIdentityReading): string;
|
|
31
|
-
export declare function modelSetupDecision(
|
|
31
|
+
export declare function modelSetupDecision(reading: ModelIdentityReading, hostCanConfigureModel: boolean, hostCanConfigureRoute?: boolean): ModelSetupDecision;
|
|
32
32
|
export declare function modelSetupNotice(decision: ModelSetupDecision): string | null;
|
|
33
33
|
export declare function observedEngineAnswer(baseUrl?: string | undefined): EngineAnswerObservation;
|
|
34
34
|
export {};
|
|
@@ -178,18 +178,16 @@ export function modelIdentityDetail(reading) {
|
|
|
178
178
|
return "this reading of the engine's model configuration could not be interpreted, so whether the engine has a model name is unknown";
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
export function modelSetupDecision(
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return 'explain_route_gap';
|
|
190
|
-
verdict = a.verdict;
|
|
181
|
+
export function modelSetupDecision(reading, hostCanConfigureModel, hostCanConfigureRoute) {
|
|
182
|
+
const a = analyse(reading);
|
|
183
|
+
if (a.verdict === 'not_resolvable' && a.why === 'route_gap') {
|
|
184
|
+
if (hostCanConfigureRoute === true)
|
|
185
|
+
return 'offer_route_setup';
|
|
186
|
+
if (hostCanConfigureRoute === false)
|
|
187
|
+
return 'explain_route_unconfigurable';
|
|
188
|
+
return 'explain_route_gap';
|
|
191
189
|
}
|
|
192
|
-
if (verdict !== 'not_resolvable')
|
|
190
|
+
if (a.verdict !== 'not_resolvable')
|
|
193
191
|
return 'proceed';
|
|
194
192
|
if (hostCanConfigureModel === true)
|
|
195
193
|
return 'offer_setup';
|
|
@@ -203,8 +201,12 @@ export function modelSetupNotice(decision) {
|
|
|
203
201
|
return 'no model name is configured for the engine, and it does not start without one — opening model setup';
|
|
204
202
|
case 'explain_unconfigured':
|
|
205
203
|
return 'this engine has no model configured, and it cannot be configured from this client — ask whoever runs the engine to set one up';
|
|
204
|
+
case 'offer_route_setup':
|
|
205
|
+
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 — opening setup so the route can be set';
|
|
206
206
|
case 'explain_route_gap':
|
|
207
|
-
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 —
|
|
207
|
+
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 — the route has to be set before the engine can run';
|
|
208
|
+
case 'explain_route_unconfigurable':
|
|
209
|
+
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 — the route cannot be set from this client; ask whoever runs the engine to set it';
|
|
208
210
|
default:
|
|
209
211
|
return null;
|
|
210
212
|
}
|
|
@@ -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;
|