@sema-agent/client-core 0.94.0 → 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 +341 -0
- package/README.md +70 -47
- package/dist/adapt/arms.js +5 -6
- 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 +11 -3
- 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 +3 -2
- package/dist/agentsWireCaps.d.ts +2 -0
- 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 -1
- package/dist/callerCwdCapability.js +2 -7
- 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/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/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 +1 -0
- package/dist/displayUntrusted.js +313 -11
- 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 +14 -3
- package/dist/engineErrorCodes.js +31 -10
- package/dist/engineIdentity.js +2 -0
- package/dist/engineWireSdk.js +2 -2
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +18 -23
- package/dist/fileHistoryCaptureCapability.d.ts +0 -1
- package/dist/fileHistoryCaptureCapability.js +2 -6
- package/dist/fileHistoryLegNotice.d.ts +3 -2
- package/dist/fileHistoryLegNotice.js +51 -2
- package/dist/fleet/fleetLedger.d.ts +2 -0
- package/dist/fleet/fleetLedger.js +69 -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.js +30 -18
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +17 -0
- package/dist/generated/settingsSchemaFns.d.ts +10 -0
- package/dist/generated/settingsSchemaFns.js +22 -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 +5 -0
- package/dist/hitl/approvalEndingCause.js +61 -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/automaticAnswerVerdict.js +2 -2
- 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 +4 -0
- package/dist/hitl/decisionRefusal.js +26 -1
- package/dist/hitl/frameRouter.js +26 -43
- package/dist/hitl/gateLedger.d.ts +5 -0
- package/dist/hitl/gateLedger.js +21 -0
- package/dist/hitl/hitlBridge.d.ts +12 -1
- package/dist/hitl/hitlBridge.js +68 -53
- 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/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 +50 -26
- package/dist/hitl/persistedRulesWire.js +5 -1
- package/dist/hitl/planReviewWire.d.ts +2 -2
- package/dist/hitl/planReviewWire.js +56 -30
- 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/toolApprovalWire.d.ts +24 -4
- package/dist/hitl/toolApprovalWire.js +115 -38
- 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/index.d.ts +30 -11
- package/dist/index.js +20 -8
- 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 -1
- package/dist/mcpProbeCapability.js +2 -6
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +10 -5
- package/dist/memoryComplianceCapability.d.ts +0 -1
- package/dist/memoryComplianceCapability.js +2 -6
- package/dist/memoryOriginCapability.d.ts +0 -1
- package/dist/memoryOriginCapability.js +2 -6
- 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 +1 -1
- package/dist/modelIdentityResolvability.js +5 -12
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +0 -1
- package/dist/outputStyleSeatCapability.js +2 -7
- package/dist/ownKey.d.ts +6 -0
- package/dist/ownKey.js +48 -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 +2 -6
- package/dist/permissionModesCapability.d.ts +0 -1
- package/dist/permissionModesCapability.js +5 -10
- 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 +6 -0
- package/dist/permissionsDeclaration.js +45 -0
- package/dist/printToolResultFrame.js +2 -10
- package/dist/promptDelivery.js +0 -8
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +126 -15
- package/dist/rewindArchiveCapability.d.ts +2 -1
- package/dist/rewindArchiveCapability.js +15 -7
- 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/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 +3 -9
- package/dist/seatContract.d.ts +54 -25
- package/dist/seatContract.js +394 -171
- 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 -1
- package/dist/sessionReadRedactionCapability.js +2 -7
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -1
- package/dist/sessionSyncFileHistoryCapability.js +2 -6
- package/dist/skillToolListsCapability.d.ts +0 -1
- package/dist/skillToolListsCapability.js +2 -6
- 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 -1
- package/dist/steerPriorityCapability.js +3 -9
- 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/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/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/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/userInvokedSkillsCapability.d.ts +0 -1
- package/dist/userInvokedSkillsCapability.js +2 -6
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +3 -7
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireFailureShape.d.ts +4 -0
- package/dist/wireFailureShape.js +42 -2
- 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 +1033 -26
- 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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { errCodes, steeringRefusedBeforeEngine, steeringStatusIs4xx } from './controlRouter.js';
|
|
2
|
+
function errorSlot(e, key) {
|
|
3
|
+
if (e === null || e === undefined)
|
|
4
|
+
return undefined;
|
|
5
|
+
try {
|
|
6
|
+
return e[key];
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function atMostOnceFailureClass(e) {
|
|
13
|
+
const s = atMostOnceSnapshotOf(e);
|
|
14
|
+
if (steeringStatusIs4xx(s))
|
|
15
|
+
return 'rejected';
|
|
16
|
+
return steeringRefusedBeforeEngine(s) !== undefined ? 'rejected' : 'unknown';
|
|
17
|
+
}
|
|
18
|
+
function atMostOnceSnapshotOf(e) {
|
|
19
|
+
return {
|
|
20
|
+
status: errorSlot(e, 'status'),
|
|
21
|
+
statusCode: errorSlot(e, 'statusCode'),
|
|
22
|
+
errorCode: errorSlot(e, 'errorCode'),
|
|
23
|
+
name: errorSlot(e, 'name'),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function atMostOnceVerdictOf(e) {
|
|
27
|
+
const snapshot = atMostOnceSnapshotOf(e);
|
|
28
|
+
const delivery = atMostOnceFailureClass(snapshot);
|
|
29
|
+
const { status, code, name } = errCodes(snapshot);
|
|
30
|
+
return {
|
|
31
|
+
delivery,
|
|
32
|
+
...(status !== undefined ? { status } : {}),
|
|
33
|
+
...(code !== undefined && code !== '' ? { code } : {}),
|
|
34
|
+
...(name !== undefined && name !== '' ? { name } : {}),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -7,5 +7,4 @@ export declare function noteEngineCapsForAttachmentSeat(baseUrl: string, caps: u
|
|
|
7
7
|
generation?: number;
|
|
8
8
|
}): void;
|
|
9
9
|
export declare function observedAttachmentSeat(baseUrl?: string | undefined): AttachmentSeatReading;
|
|
10
|
-
export declare function forgetAttachmentSeatReading(baseUrl: string | undefined): void;
|
|
11
10
|
export declare function __resetAttachmentSeatReadingsForTests(): void;
|
|
@@ -19,9 +19,6 @@ export function noteEngineCapsForAttachmentSeat(baseUrl, caps, opts) {
|
|
|
19
19
|
export function observedAttachmentSeat(baseUrl = engineWireTarget()?.baseUrl) {
|
|
20
20
|
return reader.observed(baseUrl);
|
|
21
21
|
}
|
|
22
|
-
export function forgetAttachmentSeatReading(baseUrl) {
|
|
23
|
-
reader.forget(baseUrl);
|
|
24
|
-
}
|
|
25
22
|
export function __resetAttachmentSeatReadingsForTests() {
|
|
26
23
|
reader.__resetForTests();
|
|
27
24
|
}
|
|
@@ -23,8 +23,14 @@ const OPT_IN_KEYS = [
|
|
|
23
23
|
'mcpInstructions',
|
|
24
24
|
];
|
|
25
25
|
const DEFAULT_ON_ONLY_KEYS = ['agentListing', 'skillsListing'];
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const PRODUCT_DEFAULT_KEYS = ['backgroundTasks', 'toolsDelta', 'todoReminder'];
|
|
27
|
+
function productDefaultAttachments() {
|
|
28
|
+
const out = {};
|
|
29
|
+
for (const k of PRODUCT_DEFAULT_KEYS)
|
|
30
|
+
out[k] = true;
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
const _attachmentsKeyPins = [true, true, true, true, true, true, true];
|
|
28
34
|
void _attachmentsKeyPins;
|
|
29
35
|
const TODO_REMINDER_MODES = ['baseline', 'off'];
|
|
30
36
|
export class AttachmentsSpecRefused extends TypeError {
|
|
@@ -61,11 +67,11 @@ function judgeAttachmentsEnv(raw) {
|
|
|
61
67
|
return { ok: false, refusal: { kind: 'retired_key', token, why: named.why, entry: i + 1, key: named.key, retired: named } };
|
|
62
68
|
}
|
|
63
69
|
if (tokens.length === 0)
|
|
64
|
-
return { ok: true, spec:
|
|
70
|
+
return { ok: true, spec: productDefaultAttachments() };
|
|
65
71
|
if (tokens.length === 1 && (tokens[0] === 'full' || tokens[0] === 'all'))
|
|
66
72
|
return { ok: true, spec: allLiteralTrue() };
|
|
67
73
|
if (tokens.length === 1 && !isKnownToken(tokens[0])) {
|
|
68
|
-
return { ok: true, spec:
|
|
74
|
+
return { ok: true, spec: productDefaultAttachments() };
|
|
69
75
|
}
|
|
70
76
|
const spec = {};
|
|
71
77
|
for (const [i, token] of tokens.entries()) {
|
|
@@ -74,8 +80,7 @@ function judgeAttachmentsEnv(raw) {
|
|
|
74
80
|
continue;
|
|
75
81
|
}
|
|
76
82
|
if (token === 'default') {
|
|
77
|
-
|
|
78
|
-
spec[k] = true;
|
|
83
|
+
Object.assign(spec, productDefaultAttachments());
|
|
79
84
|
continue;
|
|
80
85
|
}
|
|
81
86
|
if (token.startsWith('-')) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface BashFrameExit {
|
|
2
|
+
readonly exitCode: number | null;
|
|
3
|
+
readonly note?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface BashExitReading {
|
|
6
|
+
readonly exitCode: number | null;
|
|
7
|
+
readonly benignNote: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function bashExitOf(structured: unknown, parseFrame: () => BashFrameExit | null): BashExitReading;
|
|
10
|
+
export declare function bashExitReadingFailed(r: BashExitReading): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function bashExitOf(structured, parseFrame) {
|
|
2
|
+
const s = typeof structured === 'object' && structured !== null ? structured : undefined;
|
|
3
|
+
const interp = typeof s?.returnCodeInterpretation === 'string' && s.returnCodeInterpretation.length > 0 ? s.returnCodeInterpretation : undefined;
|
|
4
|
+
if (s?.type === 'bash' && typeof s.exitCode === 'number')
|
|
5
|
+
return { exitCode: s.exitCode, benignNote: interp };
|
|
6
|
+
const parsed = parseFrame();
|
|
7
|
+
const note = typeof parsed?.note === 'string' && parsed.note.length > 0 ? parsed.note : undefined;
|
|
8
|
+
return { exitCode: parsed?.exitCode ?? null, benignNote: interp ?? note };
|
|
9
|
+
}
|
|
10
|
+
export function bashExitReadingFailed(r) {
|
|
11
|
+
return r.exitCode !== null && r.exitCode !== 0 && r.benignNote === undefined;
|
|
12
|
+
}
|
|
@@ -12,5 +12,4 @@ export declare function noteEngineCapsForCallerCwd(baseUrl: string, caps: unknow
|
|
|
12
12
|
}): void;
|
|
13
13
|
export declare function observedCallerCwd(baseUrl?: string | undefined): CallerCwdReading;
|
|
14
14
|
export declare function callerCwdAdmitted(reading: CallerCwdReading | undefined): boolean;
|
|
15
|
-
export declare function forgetCallerCwdReading(baseUrl: string | undefined): void;
|
|
16
15
|
export declare function __resetCallerCwdReadingsForTests(): void;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
-
import { readOwnDataValue } from './ownKey.js';
|
|
3
|
+
import { ownDataField, readOwnDataValue } from './ownKey.js';
|
|
4
4
|
export function projectCallerCwdCapability(caps) {
|
|
5
5
|
try {
|
|
6
6
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
7
7
|
return undefined;
|
|
8
|
-
|
|
9
|
-
return { kind: 'not_reported' };
|
|
10
|
-
const v = caps.callerCwd;
|
|
8
|
+
const v = ownDataField(caps, 'callerCwd');
|
|
11
9
|
if (v === undefined)
|
|
12
10
|
return { kind: 'not_reported' };
|
|
13
11
|
return typeof v === 'boolean' ? { kind: 'present', value: v } : undefined;
|
|
@@ -39,9 +37,6 @@ export function callerCwdAdmitted(reading) {
|
|
|
39
37
|
return false;
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
|
-
export function forgetCallerCwdReading(baseUrl) {
|
|
43
|
-
reader.forget(baseUrl);
|
|
44
|
-
}
|
|
45
40
|
export function __resetCallerCwdReadingsForTests() {
|
|
46
41
|
reader.__resetForTests();
|
|
47
42
|
}
|
|
@@ -15,11 +15,10 @@ export interface CenterWiringView {
|
|
|
15
15
|
usageReport: boolean;
|
|
16
16
|
issuer: string;
|
|
17
17
|
caller?: CenterWiringCallerView;
|
|
18
|
+
worker?: string;
|
|
18
19
|
}
|
|
19
20
|
export type CenterWiringReading = {
|
|
20
21
|
kind: 'unobserved';
|
|
21
|
-
} | {
|
|
22
|
-
kind: 'not_reported';
|
|
23
22
|
} | {
|
|
24
23
|
kind: 'none';
|
|
25
24
|
} | {
|
|
@@ -34,5 +33,4 @@ export declare function observedCenterWiring(baseUrl?: string | undefined): Cent
|
|
|
34
33
|
export type CallerQuotaLease = 'enforced' | 'not-enforced' | 'exhausted' | 'unobserved' | 'no-lease' | 'unknown';
|
|
35
34
|
export declare function callerQuotaLease(reading: CenterWiringReading): CallerQuotaLease;
|
|
36
35
|
export declare function centerWiringDoctorDetail(reading: CenterWiringReading): string;
|
|
37
|
-
export declare function forgetCenterWiringReading(baseUrl: string | undefined): void;
|
|
38
36
|
export declare function __resetCenterWiringReadingsForTests(): void;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
2
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
3
|
-
import {
|
|
3
|
+
import { createEngineCapReader } from './engineCapReader.js';
|
|
4
|
+
import { ownDataField } from './ownKey.js';
|
|
4
5
|
const nonEmpty = (v) => typeof v === 'string' && v !== '';
|
|
5
6
|
const isPlainObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
6
7
|
function optionalSeat(o, key) {
|
|
7
|
-
|
|
8
|
-
return { state: 'absent' };
|
|
9
|
-
const value = o[key];
|
|
8
|
+
const value = ownDataField(o, key);
|
|
10
9
|
return value === undefined ? { state: 'absent' } : { state: 'value', value };
|
|
11
10
|
}
|
|
12
11
|
export function projectCenterWiringCapability(caps) {
|
|
@@ -20,16 +19,16 @@ export function projectCenterWiringCapability(caps) {
|
|
|
20
19
|
function projectCenterWiringOf(caps) {
|
|
21
20
|
if (!isPlainObject(caps))
|
|
22
21
|
return undefined;
|
|
23
|
-
const cw =
|
|
22
|
+
const cw = ownDataField(caps, 'centerWiring');
|
|
24
23
|
if (cw === undefined)
|
|
25
|
-
return
|
|
24
|
+
return { kind: 'none' };
|
|
26
25
|
if (!isPlainObject(cw))
|
|
27
26
|
return undefined;
|
|
28
|
-
const effectivePull = cw
|
|
29
|
-
const revisionRaw = cw
|
|
30
|
-
const lease = cw
|
|
31
|
-
const usageReport = cw
|
|
32
|
-
const issuer = cw
|
|
27
|
+
const effectivePull = ownDataField(cw, 'effectivePull');
|
|
28
|
+
const revisionRaw = ownDataField(cw, 'effectiveRevision');
|
|
29
|
+
const lease = ownDataField(cw, 'lease');
|
|
30
|
+
const usageReport = ownDataField(cw, 'usageReport');
|
|
31
|
+
const issuer = ownDataField(cw, 'issuer');
|
|
33
32
|
if (typeof effectivePull !== 'boolean' || typeof usageReport !== 'boolean')
|
|
34
33
|
return undefined;
|
|
35
34
|
if (!nonEmpty(lease) || !nonEmpty(issuer))
|
|
@@ -41,8 +40,8 @@ function projectCenterWiringOf(caps) {
|
|
|
41
40
|
else {
|
|
42
41
|
if (!isPlainObject(revisionRaw))
|
|
43
42
|
return undefined;
|
|
44
|
-
const version = revisionRaw
|
|
45
|
-
const updatedAt = revisionRaw
|
|
43
|
+
const version = ownDataField(revisionRaw, 'version');
|
|
44
|
+
const updatedAt = ownDataField(revisionRaw, 'updatedAt');
|
|
46
45
|
if (typeof version !== 'number' || !Number.isFinite(version) || !nonEmpty(updatedAt))
|
|
47
46
|
return undefined;
|
|
48
47
|
effectiveRevision = { version, updatedAt };
|
|
@@ -58,7 +57,7 @@ function projectCenterWiringOf(caps) {
|
|
|
58
57
|
if (callerSeat.state === 'value') {
|
|
59
58
|
if (!isPlainObject(callerSeat.value))
|
|
60
59
|
return undefined;
|
|
61
|
-
const callerLease = callerSeat.value
|
|
60
|
+
const callerLease = ownDataField(callerSeat.value, 'lease');
|
|
62
61
|
if (!nonEmpty(callerLease))
|
|
63
62
|
return undefined;
|
|
64
63
|
const wait = optionalSeat(callerSeat.value, 'retryAfterSec');
|
|
@@ -66,6 +65,9 @@ function projectCenterWiringOf(caps) {
|
|
|
66
65
|
return undefined;
|
|
67
66
|
caller = { lease: callerLease, ...(wait.state === 'value' ? { retryAfterSec: wait.value } : {}) };
|
|
68
67
|
}
|
|
68
|
+
const workerSeat = optionalSeat(cw, 'worker');
|
|
69
|
+
if (workerSeat.state === 'value' && !nonEmpty(workerSeat.value))
|
|
70
|
+
return undefined;
|
|
69
71
|
return {
|
|
70
72
|
kind: 'present',
|
|
71
73
|
view: {
|
|
@@ -77,6 +79,7 @@ function projectCenterWiringOf(caps) {
|
|
|
77
79
|
usageReport,
|
|
78
80
|
issuer,
|
|
79
81
|
...(caller !== undefined ? { caller } : {}),
|
|
82
|
+
...(workerSeat.state === 'value' ? { worker: workerSeat.value } : {}),
|
|
80
83
|
},
|
|
81
84
|
};
|
|
82
85
|
}
|
|
@@ -96,7 +99,7 @@ function guarded(reading) {
|
|
|
96
99
|
return undefined;
|
|
97
100
|
try {
|
|
98
101
|
const kind = reading.kind;
|
|
99
|
-
if (kind === '
|
|
102
|
+
if (kind === 'unobserved' || kind === 'none')
|
|
100
103
|
return { kind };
|
|
101
104
|
if (kind !== 'present')
|
|
102
105
|
return undefined;
|
|
@@ -158,9 +161,6 @@ function failModeClause(v) {
|
|
|
158
161
|
export function centerWiringDoctorDetail(reading) {
|
|
159
162
|
const unobserved = 'center wiring not observed — the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it, so whether this engine is connected to a configuration center is unknown';
|
|
160
163
|
const r = guarded(reading);
|
|
161
|
-
if (r?.kind === 'not_reported') {
|
|
162
|
-
return 'center wiring not reported by this engine; this does not say whether the engine is connected to a configuration center';
|
|
163
|
-
}
|
|
164
164
|
if (r?.kind === 'none') {
|
|
165
165
|
return 'no configuration center on this deployment — the engine runs on its own local configuration; no quota lease or usage reporting goes through a center';
|
|
166
166
|
}
|
|
@@ -194,9 +194,6 @@ export function centerWiringDoctorDetail(reading) {
|
|
|
194
194
|
return unobserved;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
export function forgetCenterWiringReading(baseUrl) {
|
|
198
|
-
reader.forget(baseUrl);
|
|
199
|
-
}
|
|
200
197
|
export function __resetCenterWiringReadingsForTests() {
|
|
201
198
|
reader.__resetForTests();
|
|
202
199
|
}
|
package/dist/classifierStatus.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { classifierDenyCauseOf } from './autoModeUnavailable.js';
|
|
2
|
+
import { readAskOrigin } from './ownKey.js';
|
|
2
3
|
export const CLASSIFIER_STATUS_STATES = Object.freeze([
|
|
3
4
|
'armed',
|
|
4
5
|
'available',
|
|
@@ -8,14 +9,13 @@ const CLASSIFIER_RAN_ORIGINS = new Set(['denial_limit_fallback']);
|
|
|
8
9
|
function askOriginOf(ask) {
|
|
9
10
|
if (typeof ask !== 'object' || ask === null || Array.isArray(ask))
|
|
10
11
|
return undefined;
|
|
11
|
-
const top = ask
|
|
12
|
-
if (
|
|
12
|
+
const top = readAskOrigin(ask);
|
|
13
|
+
if (top !== undefined)
|
|
13
14
|
return top;
|
|
14
15
|
const gate = ask.gate;
|
|
15
16
|
if (typeof gate !== 'object' || gate === null || Array.isArray(gate))
|
|
16
17
|
return undefined;
|
|
17
|
-
|
|
18
|
-
return typeof inner === 'string' && inner.length > 0 ? inner : undefined;
|
|
18
|
+
return readAskOrigin(gate);
|
|
19
19
|
}
|
|
20
20
|
const NOT_A_ROUND_FAILURE = new Set(['parse_error']);
|
|
21
21
|
export function classifierStatusOf(autoMode, ask) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MCP_CAPS } from './mcpWireCaps.js';
|
|
2
2
|
import { toCappedSpec } from './skillsWireCaps.js';
|
|
3
3
|
import { TIER_ORDER } from './model/tierVocabulary.js';
|
|
4
|
+
import { SETTINGS_NARROW_AT_MENTION } from './generated/settingsSchemaFns.js';
|
|
5
|
+
import { modelsPolicyOf } from './model/modelsPolicy.js';
|
|
4
6
|
import { SETTINGS_BUDGET_NUMBER_KEYS, SETTINGS_BUDGET_PER_MODEL_NUMBER_KEYS, SETTINGS_BUDGET_STRING_KEYS, SETTINGS_TIER_GROUP_NAME_RE, } from './generated/settingsSchemaTables.js';
|
|
5
7
|
const asRec = (v) => (typeof v === 'object' && v !== null && !Array.isArray(v) ? v : undefined);
|
|
6
8
|
const asArr = (v) => (Array.isArray(v) ? v : []);
|
|
@@ -174,17 +176,26 @@ function modelsDocOf(models, opts) {
|
|
|
174
176
|
written = stripped.filter((_, i) => acceptedFlags[i]);
|
|
175
177
|
}
|
|
176
178
|
const doc = { models: written };
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
const policy = modelsPolicyOf(m);
|
|
180
|
+
if (policy.unreadable) {
|
|
181
|
+
drop({ key: 'default', reason: 'unreadable' });
|
|
182
|
+
drop({ key: 'atModelAllowlist', at: 'models', reason: 'unreadable' });
|
|
183
|
+
}
|
|
184
|
+
if (policy.defaultUnreadable)
|
|
185
|
+
drop({ key: 'default', reason: 'unreadable' });
|
|
186
|
+
const dm = policy.defaultModel;
|
|
187
|
+
if (accept && dm !== undefined) {
|
|
188
|
+
if (names.has(dm.name))
|
|
189
|
+
doc.default = dm.name;
|
|
181
190
|
else
|
|
182
|
-
drop({ key: 'default',
|
|
191
|
+
drop({ key: 'default', target: dm.name, reason: reasonOf(dm.name) });
|
|
183
192
|
}
|
|
184
193
|
const roles = asRec(m.roles);
|
|
185
194
|
if (roles) {
|
|
186
195
|
const kept = {};
|
|
187
196
|
for (const [role, t] of Object.entries(roles)) {
|
|
197
|
+
if (role === 'default' && accept && dm?.from === 'roles.default')
|
|
198
|
+
continue;
|
|
188
199
|
const tr = asRec(t);
|
|
189
200
|
const model = tr && Object.hasOwn(tr, 'model') ? tr.model : undefined;
|
|
190
201
|
if (typeof model === 'string' && !names.has(model)) {
|
|
@@ -195,19 +206,30 @@ function modelsDocOf(models, opts) {
|
|
|
195
206
|
}
|
|
196
207
|
doc.roles = kept;
|
|
197
208
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
209
|
+
const am = policy.atMention;
|
|
210
|
+
if (am?.kind === 'unreadable') {
|
|
211
|
+
drop({ key: 'atModelAllowlist', at: am.from, reason: 'unreadable' });
|
|
212
|
+
}
|
|
213
|
+
else if (am !== undefined) {
|
|
214
|
+
for (let i = 0; i < am.unreadableEntries; i += 1)
|
|
215
|
+
drop({ key: 'atModelAllowlist', reason: 'unreadable' });
|
|
216
|
+
const v = am.value;
|
|
217
|
+
if (v.mode === 'none') {
|
|
218
|
+
drop({ key: 'atModelAllowlist', at: 'atMention', reason: 'unsupported' });
|
|
205
219
|
}
|
|
206
|
-
else {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
220
|
+
else if (v.mode === 'only') {
|
|
221
|
+
const narrowed = SETTINGS_NARROW_AT_MENTION(v, names);
|
|
222
|
+
if (narrowed.mode === 'only') {
|
|
223
|
+
for (const n of v.models)
|
|
224
|
+
if (!names.has(n))
|
|
225
|
+
drop({ key: 'atModelAllowlist', target: n, reason: reasonOf(n) });
|
|
226
|
+
doc.atModelAllowlist = [...narrowed.models];
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
doc.atModelAllowlist = [...v.models];
|
|
230
|
+
for (const n of v.models)
|
|
231
|
+
issues.push({ key: 'atModelAllowlist', target: n, reason: reasonOf(n), outcome: 'kept' });
|
|
232
|
+
}
|
|
211
233
|
}
|
|
212
234
|
}
|
|
213
235
|
let groupNames;
|
|
@@ -494,8 +516,6 @@ const ENTRY_REJECTED = `is in the catalog, but its entry is one the local engine
|
|
|
494
516
|
function warningNotice(w) {
|
|
495
517
|
const where = quoted(w.domain, 'the configuration');
|
|
496
518
|
switch (w.kind) {
|
|
497
|
-
case 'hosts-grandfathered':
|
|
498
|
-
return { level: 'warn', text: `cloud config warning: host entries exceeding the current limits were skipped by the registry${listOf(w.droppedNames, w.truncatedFrom)}` };
|
|
499
519
|
case 'domain-defaulted':
|
|
500
520
|
return { level: 'warn', text: `cloud config warning: ${where} could not be read by the registry and were served as defaults — what is configured there is not in effect` };
|
|
501
521
|
case 'entry-dropped':
|
|
@@ -504,8 +524,6 @@ function warningNotice(w) {
|
|
|
504
524
|
return { level: 'warn', text: `cloud config warning: the registry dropped unrecognised keys from ${where}${listOf(w.keys, w.truncatedFrom)}` };
|
|
505
525
|
case 'unknown-keys-carried':
|
|
506
526
|
return { level: 'warn', text: `cloud config warning: ${where} carry keys the registry does not recognise, passed on as written (check the spelling)${listOf(w.keys, w.truncatedFrom)}` };
|
|
507
|
-
case 'legacy-governance-lifted':
|
|
508
|
-
return { level: 'info', text: `cloud config note: ${where} were taken from their older location${listOf(w.keys, undefined)}` };
|
|
509
527
|
case 'unread-config-file':
|
|
510
528
|
return { level: 'warn', text: `cloud config warning: a configuration file was not read by the registry${w.file === undefined ? '' : ` (${w.file}${w.why === undefined ? '' : `: ${w.why}`})`}` };
|
|
511
529
|
default:
|
|
@@ -523,6 +541,10 @@ function droppedRefNotice(d) {
|
|
|
523
541
|
case 'roles':
|
|
524
542
|
return { level: 'warn', text: `cloud config: role "${d.at ?? ''}" ${t === undefined ? 'names no readable model' : `points at model "${t}", which ${notServed}`} — the role was left out and falls back along the engine's role chain` };
|
|
525
543
|
case 'atModelAllowlist':
|
|
544
|
+
if (d.reason === 'unsupported')
|
|
545
|
+
return { level: 'warn', text: 'cloud config: the @-mention setting served to you allows no model to be @-mentioned, which the local engine\'s settings format cannot express — it was left out, so @-mentions are not restricted on the local engine' };
|
|
546
|
+
if (d.at !== undefined)
|
|
547
|
+
return { level: 'warn', text: 'cloud config: the @-mention setting served to you could not be read by this client — it was left out, so @-mentions are not restricted on the local engine' };
|
|
526
548
|
return { level: 'warn', text: `cloud config: ${t === undefined ? 'an unreadable @-mention allowlist entry' : `@-mention allowlist entry "${t}" ${notServed} and`} was left out` };
|
|
527
549
|
case 'tierGroups':
|
|
528
550
|
if (d.reason === 'duplicate')
|
package/dist/compensations.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface EngineAgentPanelCycleIdentity {
|
|
2
|
+
readonly cycleSeq?: number;
|
|
3
|
+
readonly startedAt?: number;
|
|
4
|
+
}
|
|
5
|
+
export type CycleOrder = 'before' | 'after' | 'same' | 'unknown';
|
|
6
|
+
export declare function cycleSeqValue(v: unknown): number | undefined;
|
|
7
|
+
export declare function cycleSeqOf(v: EngineAgentPanelCycleIdentity | null | undefined): number | undefined;
|
|
8
|
+
export declare function startedAtOf(v: EngineAgentPanelCycleIdentity | null | undefined): number | undefined;
|
|
9
|
+
export declare function cycleOrder(a: EngineAgentPanelCycleIdentity | null | undefined, b: EngineAgentPanelCycleIdentity | null | undefined): CycleOrder;
|
|
10
|
+
export declare function cycleSeqOrder(a: number | undefined, b: number | undefined): CycleOrder;
|
|
11
|
+
export declare function cycleOf(v: EngineAgentPanelCycleIdentity | null | undefined): EngineAgentPanelCycleIdentity;
|
|
12
|
+
export declare function cycleEmpty(v: EngineAgentPanelCycleIdentity | null | undefined): boolean;
|
|
13
|
+
export declare function cycleKeysChanged(prev: EngineAgentPanelCycleIdentity | null | undefined, next: EngineAgentPanelCycleIdentity | null | undefined): boolean;
|
|
14
|
+
export declare function carryCycle(frame: EngineAgentPanelCycleIdentity, prev: EngineAgentPanelCycleIdentity | undefined, carry: boolean): EngineAgentPanelCycleIdentity;
|
|
15
|
+
export declare function mergeCycle(prefer: EngineAgentPanelCycleIdentity, fallback: EngineAgentPanelCycleIdentity | undefined): EngineAgentPanelCycleIdentity;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function cycleSeqValue(v) {
|
|
2
|
+
return typeof v === 'number' && Number.isInteger(v) && v >= 1 ? v : undefined;
|
|
3
|
+
}
|
|
4
|
+
export function cycleSeqOf(v) {
|
|
5
|
+
return cycleSeqValue(v?.cycleSeq);
|
|
6
|
+
}
|
|
7
|
+
export function startedAtOf(v) {
|
|
8
|
+
const n = v?.startedAt;
|
|
9
|
+
return typeof n === 'number' && Number.isFinite(n) && n > 0 ? n : undefined;
|
|
10
|
+
}
|
|
11
|
+
export function cycleOrder(a, b) {
|
|
12
|
+
const ac = cycleSeqOf(a);
|
|
13
|
+
const bc = cycleSeqOf(b);
|
|
14
|
+
if (ac !== undefined && bc !== undefined)
|
|
15
|
+
return ac < bc ? 'before' : ac > bc ? 'after' : 'same';
|
|
16
|
+
const as = startedAtOf(a);
|
|
17
|
+
const bs = startedAtOf(b);
|
|
18
|
+
if (as !== undefined && bs !== undefined)
|
|
19
|
+
return as < bs ? 'before' : as > bs ? 'after' : 'same';
|
|
20
|
+
return 'unknown';
|
|
21
|
+
}
|
|
22
|
+
export function cycleSeqOrder(a, b) {
|
|
23
|
+
return cycleOrder(a === undefined ? undefined : { cycleSeq: a }, b === undefined ? undefined : { cycleSeq: b });
|
|
24
|
+
}
|
|
25
|
+
export function cycleOf(v) {
|
|
26
|
+
const c = cycleSeqOf(v);
|
|
27
|
+
const s = startedAtOf(v);
|
|
28
|
+
return { ...(c !== undefined ? { cycleSeq: c } : {}), ...(s !== undefined ? { startedAt: s } : {}) };
|
|
29
|
+
}
|
|
30
|
+
export function cycleEmpty(v) {
|
|
31
|
+
return cycleSeqOf(v) === undefined && startedAtOf(v) === undefined;
|
|
32
|
+
}
|
|
33
|
+
export function cycleKeysChanged(prev, next) {
|
|
34
|
+
const nc = cycleSeqOf(next);
|
|
35
|
+
const ns = startedAtOf(next);
|
|
36
|
+
return (nc !== undefined && nc !== cycleSeqOf(prev)) || (ns !== undefined && ns !== startedAtOf(prev));
|
|
37
|
+
}
|
|
38
|
+
export function carryCycle(frame, prev, carry) {
|
|
39
|
+
const c = cycleSeqOf(frame) ?? (carry ? cycleSeqOf(prev) : undefined);
|
|
40
|
+
const s = startedAtOf(frame) ?? (carry ? startedAtOf(prev) : undefined);
|
|
41
|
+
return { ...(c !== undefined ? { cycleSeq: c } : {}), ...(s !== undefined ? { startedAt: s } : {}) };
|
|
42
|
+
}
|
|
43
|
+
export function mergeCycle(prefer, fallback) {
|
|
44
|
+
return carryCycle(prefer, fallback, true);
|
|
45
|
+
}
|
|
@@ -2,6 +2,7 @@ import { corruptStoredRowContent, corruptStoredRowWhere } from './wireErrorTriag
|
|
|
2
2
|
import { checkpointUnsupportedVersionContent, checkpointUnsupportedVersionFromError, parkedResumeStartupContent, parkedResumeStartupFromError, resumePolicyBlockContent, resumePolicyBlockFromError, } from './resumeRefusalCopy.js';
|
|
3
3
|
import { askGoneContent, askGoneFromError, decideParkMovedContent, decideParkMovedFromError } from './decideReceipt.js';
|
|
4
4
|
import { settingsPermissionBucketRefusalContent, settingsPermissionBucketRefusalFromError } from './wireRefusalCopy.js';
|
|
5
|
+
import { DECISION_ANSWER_INVALID_CONTENT, decisionConflictOf } from './hitl/decisionConflict.js';
|
|
5
6
|
export function decideFailureNote(err, decision) {
|
|
6
7
|
const where = corruptStoredRowWhere(err);
|
|
7
8
|
const fold = resumePolicyBlockFromError(err);
|
|
@@ -10,11 +11,13 @@ export function decideFailureNote(err, decision) {
|
|
|
10
11
|
const bucket = settingsPermissionBucketRefusalFromError(err);
|
|
11
12
|
const unsupported = checkpointUnsupportedVersionFromError(err);
|
|
12
13
|
const gone = askGoneFromError(err);
|
|
14
|
+
const answerInvalid = decisionConflictOf(err) === 'answer_invalid';
|
|
13
15
|
return ((where === undefined ? '' : ` — ${corruptStoredRowContent(where)}`) +
|
|
14
16
|
(fold === null ? '' : ` — ${resumePolicyBlockContent(fold)}`) +
|
|
15
17
|
(bucket === null ? '' : ` — ${settingsPermissionBucketRefusalContent(bucket)}`) +
|
|
16
18
|
(startup === null ? '' : ` — ${parkedResumeStartupContent(startup)}`) +
|
|
17
19
|
(moved === null ? '' : ` — ${decideParkMovedContent(moved)}`) +
|
|
18
20
|
(unsupported === null ? '' : ` — ${checkpointUnsupportedVersionContent(unsupported)}`) +
|
|
19
|
-
(gone === null ? '' : ` — ${askGoneContent(gone)}`)
|
|
21
|
+
(gone === null ? '' : ` — ${askGoneContent(gone)}`) +
|
|
22
|
+
(answerInvalid ? ` — ${DECISION_ANSWER_INVALID_CONTENT}` : ''));
|
|
20
23
|
}
|
package/dist/decideReceipt.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type GateOutcomeView } from './gateOutcome.js';
|
|
2
2
|
import { type ResumeReopenDetail } from './hitl/suspendedReopen.js';
|
|
3
3
|
import { type CrashConvergedRow } from './hitl/crashConverged.js';
|
|
4
|
+
import type { AskRowEndingCause } from '@sema-agent/sdk';
|
|
4
5
|
export interface DecideReceiptView {
|
|
5
6
|
status?: string;
|
|
6
7
|
taskId?: string;
|
|
@@ -33,7 +34,7 @@ export declare function decideParkMovedContent(detail: Pick<DecideParkMovedDetai
|
|
|
33
34
|
export interface AskGoneDetail {
|
|
34
35
|
code: 'gone.ask';
|
|
35
36
|
state?: 'VOID' | 'DENIED';
|
|
36
|
-
|
|
37
|
+
endingCause?: AskRowEndingCause;
|
|
37
38
|
holderGone?: CrashConvergedRow['cause'];
|
|
38
39
|
}
|
|
39
40
|
export declare function askGoneFromError(e: unknown): AskGoneDetail | null;
|
package/dist/decideReceipt.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { gateOutcomeOf } from './gateOutcome.js';
|
|
2
2
|
import { resumeReopenFromError } from './hitl/suspendedReopen.js';
|
|
3
|
-
import { ASK_GONE,
|
|
3
|
+
import { ASK_GONE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_PARK_FORKED, DECIDE_WORKFLOW_PARKS_UNREADABLE, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, isDecideParkMovedCode, } from './engineErrorCodes.js';
|
|
4
4
|
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
5
5
|
import { readErrorString, readErrorStrictStringList } from './wireFailureShape.js';
|
|
6
6
|
import { isCrashConvergedCause } from './hitl/crashConverged.js';
|
|
7
|
+
import { askRowEndingCauseFor } from './hitl/approvalEndingCause.js';
|
|
7
8
|
const STATUS_RESUMING = 'resuming';
|
|
8
9
|
function str(v) {
|
|
9
10
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
@@ -132,6 +133,38 @@ export function decideParkMovedContent(detail) {
|
|
|
132
133
|
const extra = code === DECIDE_CLAIM_LOST ? '; if this approval is still listed, wait a little before deciding it again' : '';
|
|
133
134
|
return `${what} · This decision was not applied — fetch the pending approvals again and decide from what is pending now${extra}`;
|
|
134
135
|
}
|
|
136
|
+
function askGoneRawCause(e) {
|
|
137
|
+
let top;
|
|
138
|
+
try {
|
|
139
|
+
top = e.endingCause;
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
top = undefined;
|
|
143
|
+
}
|
|
144
|
+
if (typeof top === 'string')
|
|
145
|
+
return top;
|
|
146
|
+
let extra;
|
|
147
|
+
try {
|
|
148
|
+
extra = e.extra;
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
extra = undefined;
|
|
152
|
+
}
|
|
153
|
+
if (typeof extra === 'object' && extra !== null && !Array.isArray(extra)) {
|
|
154
|
+
let hasCause = false;
|
|
155
|
+
let word;
|
|
156
|
+
try {
|
|
157
|
+
hasCause = Object.hasOwn(extra, 'cause');
|
|
158
|
+
word = hasCause ? extra.cause : undefined;
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
if (hasCause)
|
|
164
|
+
return word;
|
|
165
|
+
}
|
|
166
|
+
return readErrorString(e, 'deniedReason');
|
|
167
|
+
}
|
|
135
168
|
export function askGoneFromError(e) {
|
|
136
169
|
if (typeof e !== 'object' || e === null)
|
|
137
170
|
return null;
|
|
@@ -139,37 +172,32 @@ export function askGoneFromError(e) {
|
|
|
139
172
|
return null;
|
|
140
173
|
const rawState = readErrorString(e, 'state');
|
|
141
174
|
const state = rawState === 'VOID' || rawState === 'DENIED' ? rawState : undefined;
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
? undefined
|
|
145
|
-
: state === 'DENIED'
|
|
146
|
-
? rawReason === ASK_GONE_DENIED_WORD ? rawReason : undefined
|
|
147
|
-
: state === 'VOID' ? rawReason : undefined;
|
|
148
|
-
const holderGone = state === 'VOID' && isCrashConvergedCause(deniedReason) ? deniedReason : undefined;
|
|
175
|
+
const endingCause = askRowEndingCauseFor(state, askGoneRawCause(e));
|
|
176
|
+
const holderGone = state === 'VOID' && isCrashConvergedCause(endingCause) ? endingCause : undefined;
|
|
149
177
|
return {
|
|
150
178
|
code: ASK_GONE,
|
|
151
179
|
...(state !== undefined ? { state } : {}),
|
|
152
|
-
...(
|
|
180
|
+
...(endingCause !== undefined ? { endingCause } : {}),
|
|
153
181
|
...(holderGone !== undefined ? { holderGone } : {}),
|
|
154
182
|
};
|
|
155
183
|
}
|
|
156
184
|
export function askGoneContent(detail) {
|
|
157
185
|
let state;
|
|
158
|
-
let
|
|
186
|
+
let endingCause;
|
|
159
187
|
let holderGone;
|
|
160
188
|
try {
|
|
161
189
|
state = detail.state;
|
|
162
|
-
|
|
190
|
+
endingCause = detail.endingCause;
|
|
163
191
|
holderGone = detail.holderGone;
|
|
164
192
|
}
|
|
165
193
|
catch {
|
|
166
194
|
state = undefined;
|
|
167
|
-
|
|
195
|
+
endingCause = undefined;
|
|
168
196
|
holderGone = undefined;
|
|
169
197
|
}
|
|
170
198
|
const st = state === 'VOID' || state === 'DENIED' ? state : undefined;
|
|
171
199
|
const safety = 'Your answer was not applied and nothing was run on it';
|
|
172
|
-
if (st === 'VOID' && (isCrashConvergedCause(holderGone) || isCrashConvergedCause(
|
|
200
|
+
if (st === 'VOID' && (isCrashConvergedCause(holderGone) || isCrashConvergedCause(endingCause))) {
|
|
173
201
|
return [
|
|
174
202
|
'The engine run that was waiting for this answer ended before the answer arrived',
|
|
175
203
|
safety,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DECLARED_SUPPORT_FLOOR: Readonly<Record<"server" | "core" | "sdk", string>>;
|
|
@@ -20,5 +20,4 @@ export declare function observedDeviceExecutorManagement(baseUrl?: string | unde
|
|
|
20
20
|
export declare function deviceManagementVerbsAvailable(reading: DeviceExecutorManagementReading): 'yes' | 'no' | 'unknown';
|
|
21
21
|
export declare function deviceLaneOpen(reading: DeviceExecutorManagementReading): 'yes' | 'no' | 'unknown';
|
|
22
22
|
export declare function deviceExecutorManagementDoctorDetail(reading: DeviceExecutorManagementReading): string;
|
|
23
|
-
export declare function forgetDeviceExecutorManagementReading(baseUrl: string | undefined): void;
|
|
24
23
|
export declare function __resetDeviceExecutorManagementReadingsForTests(): void;
|