@sema-agent/client-core 0.110.0 → 0.111.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 +169 -0
- package/README.md +50 -18
- package/dist/abortableSleep.d.ts +7 -0
- package/dist/abortableSleep.js +37 -0
- package/dist/adapt/arms.js +25 -4
- package/dist/adapt/toolCards.d.ts +3 -1
- package/dist/adapt/toolCards.js +4 -2
- package/dist/adapter/activeRunSelfHeal.d.ts +39 -0
- package/dist/adapter/activeRunSelfHeal.js +171 -3
- package/dist/adapter/downstream/eventToSdkMessage.js +10 -10
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +2 -0
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -0
- package/dist/adapter/runStream.d.ts +5 -0
- package/dist/adapter/runStream.js +15 -3
- package/dist/attachmentRoute.d.ts +20 -0
- package/dist/attachmentRoute.js +39 -0
- package/dist/attachmentsWireCaps.js +1 -1
- package/dist/builtinOutputStyles.d.ts +12 -0
- package/dist/builtinOutputStyles.js +147 -0
- package/dist/compactionStatus.d.ts +9 -0
- package/dist/compactionStatus.js +29 -5
- package/dist/controlRouter.js +2 -1
- package/dist/coreValuePorts.d.ts +39 -1
- package/dist/coreValuePorts.js +10 -0
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +6 -0
- package/dist/engineHealthFacts.d.ts +11 -0
- package/dist/engineHealthFacts.js +21 -0
- package/dist/engineHealthProbeVerdict.d.ts +23 -0
- package/dist/engineHealthProbeVerdict.js +115 -0
- package/dist/engineNoticeCodes.js +5 -7
- package/dist/engineRepoint.d.ts +12 -5
- package/dist/engineRepoint.js +44 -19
- package/dist/engineRowRef.d.ts +3 -0
- package/dist/engineRowRef.js +11 -1
- package/dist/engineSwapCrossing.d.ts +57 -0
- package/dist/engineSwapCrossing.js +297 -0
- package/dist/engineUnavailable.d.ts +44 -0
- package/dist/engineUnavailable.js +492 -0
- package/dist/eventLeg.js +3 -3
- package/dist/generated/sdkFactTables.d.ts +1 -1
- package/dist/generated/sdkFactTables.js +1 -0
- package/dist/generated/settingsSchemaTables.d.ts +4 -0
- package/dist/generated/settingsSchemaTables.js +1 -0
- package/dist/hitl/approvalDelivery.d.ts +1 -0
- package/dist/hitl/approvalDelivery.js +1 -1
- package/dist/hitl/approvalResolution.d.ts +1 -1
- package/dist/hitl/approvalResolution.js +2 -1
- package/dist/hitl/askGateWire.js +5 -6
- package/dist/hitl/decisionRefusal.d.ts +2 -0
- package/dist/hitl/decisionRefusal.js +7 -8
- package/dist/hitl/decisionRefusalCarrier.d.ts +3 -0
- package/dist/hitl/decisionRefusalCarrier.js +348 -0
- package/dist/hitl/decisionSend.d.ts +7 -0
- package/dist/hitl/decisionSend.js +34 -12
- package/dist/hitl/editedApprovalAcceptance.js +1 -1
- package/dist/hitl/elicitationRefusal.d.ts +4 -0
- package/dist/hitl/elicitationRefusal.js +23 -0
- package/dist/hitl/frameRouter.d.ts +2 -2
- package/dist/hitl/frameRouter.js +8 -15
- package/dist/hitl/gateIdentity.d.ts +5 -0
- package/dist/hitl/gateIdentity.js +23 -0
- package/dist/hitl/hitlBridge.d.ts +6 -0
- package/dist/hitl/hitlBridge.js +10 -4
- package/dist/hitl/hitlHostSurface.d.ts +2 -1
- package/dist/hitl/hitlHostSurface.js +7 -2
- package/dist/hitl/localAllowRedemption.d.ts +67 -0
- package/dist/hitl/localAllowRedemption.js +256 -0
- package/dist/hitl/parkResolver.js +7 -4
- package/dist/hitl/persistedRulesWire.d.ts +16 -0
- package/dist/hitl/persistedRulesWire.js +70 -0
- package/dist/hitl/planReviewWire.d.ts +3 -0
- package/dist/hitl/planReviewWire.js +23 -6
- package/dist/hitl/policyDenyCause.d.ts +1 -1
- package/dist/hitl/policyDenyCause.js +1 -1
- package/dist/hitl/resumeRunningCard.d.ts +1 -0
- package/dist/hitl/resumeRunningCard.js +1 -0
- package/dist/hitl/screenCardCarriers.d.ts +15 -0
- package/dist/hitl/screenCardCarriers.js +41 -0
- package/dist/hitl/screenDecisionCards.d.ts +98 -0
- package/dist/hitl/screenDecisionCards.js +362 -0
- package/dist/hitl/standingRows.d.ts +3 -1
- package/dist/hitl/standingRows.js +18 -0
- package/dist/hitl/toolApprovalWire.d.ts +30 -8
- package/dist/hitl/toolApprovalWire.js +264 -121
- package/dist/hooksWireCaps.js +3 -3
- package/dist/hostSettingNoticeArm.d.ts +3 -0
- package/dist/hostSettingNoticeArm.js +12 -0
- package/dist/hostTurnSettings.d.ts +3 -0
- package/dist/hostTurnSettings.js +38 -5
- package/dist/humanTurnRead.js +11 -1
- package/dist/i18n/messages.en.d.ts +129 -0
- package/dist/i18n/messages.en.js +135 -7
- package/dist/i18n/messages.zh.js +142 -6
- package/dist/i18n/translate.d.ts +3 -0
- package/dist/i18n/translate.js +78 -10
- package/dist/i18n/zh.d.ts +1 -0
- package/dist/i18n/zh.js +1 -0
- package/dist/index.d.ts +43 -17
- package/dist/index.js +30 -12
- package/dist/interactiveHalt.js +2 -1
- package/dist/interactiveInterrupt.js +20 -2
- package/dist/liveModelCatalog.js +2 -2
- package/dist/localEngineSeatReading.d.ts +2 -2
- package/dist/localEngineSeatReading.js +5 -3
- package/dist/localEngineSpawn.d.ts +0 -7
- package/dist/localEngineSpawn.js +0 -92
- package/dist/localEngineStep.d.ts +2 -2
- package/dist/localEngineStep.js +2 -0
- package/dist/mcpReconnect.js +3 -3
- package/dist/mcpWireCaps.js +1 -1
- package/dist/model/engineModelWords.d.ts +3 -0
- package/dist/model/engineModelWords.js +13 -0
- package/dist/model/subagentModelWord.d.ts +21 -2
- package/dist/model/subagentModelWord.js +100 -29
- package/dist/modelCapabilityProbe.js +3 -40
- package/dist/notifications.d.ts +19 -0
- package/dist/notifications.js +114 -12
- package/dist/ownKey.d.ts +6 -0
- package/dist/ownKey.js +31 -0
- package/dist/pendingUserRow.d.ts +4 -0
- package/dist/pendingUserRow.js +16 -0
- package/dist/permissionsDeclaration.d.ts +1 -0
- package/dist/permissionsDeclaration.js +11 -1
- package/dist/planReviewCardFacts.d.ts +3 -0
- package/dist/planReviewCardFacts.js +52 -2
- package/dist/pluginHooksWire.d.ts +9 -1
- package/dist/pluginHooksWire.js +40 -6
- package/dist/printToolResultFrame.js +4 -2
- package/dist/promptBlockedCopy.js +11 -6
- package/dist/promptSuggestionBatch.d.ts +7 -0
- package/dist/promptSuggestionBatch.js +9 -0
- package/dist/promptSuggestionsTail.d.ts +39 -0
- package/dist/promptSuggestionsTail.js +116 -0
- package/dist/request/taskRequest.js +10 -6
- package/dist/requestCoordinate.d.ts +1 -0
- package/dist/requestCoordinate.js +13 -0
- package/dist/rewindArchiveReading.js +4 -4
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +1 -0
- package/dist/runPermissionModeSwitch.js +2 -2
- package/dist/scenarioRefusal.js +11 -13
- package/dist/scenarioSkills.js +11 -6
- package/dist/seam.d.ts +16 -2
- package/dist/seam.js +10 -0
- package/dist/seatContract.d.ts +109 -9
- package/dist/seatContract.js +218 -15
- package/dist/sessionCostReading.d.ts +70 -0
- package/dist/sessionCostReading.js +150 -0
- package/dist/sessionHooksRoster.d.ts +4 -0
- package/dist/sessionHooksRoster.js +158 -0
- package/dist/sessionMemoryStatus.js +2 -2
- package/dist/sessionReadRedaction.d.ts +7 -0
- package/dist/sessionReadRedaction.js +26 -0
- package/dist/sessionSyncFileHistory.js +8 -9
- package/dist/settingsHooksSalvage.js +2 -1
- package/dist/sseIdleTriage.js +2 -1
- package/dist/storeDurabilityWord.d.ts +15 -0
- package/dist/storeDurabilityWord.js +18 -0
- package/dist/storePostureCapability.d.ts +7 -3
- package/dist/storePostureCapability.js +69 -39
- package/dist/subagent/engineSubagentResume.js +2 -2
- package/dist/subagent/engineSubagentTail.js +2 -1
- package/dist/subagentContentStore.d.ts +11 -0
- package/dist/subagentContentStore.js +28 -2
- package/dist/toolResult.d.ts +1 -0
- package/dist/toolResult.js +2 -0
- package/dist/userAttachmentEnvelope.d.ts +2 -1
- package/dist/userAttachmentEnvelope.js +10 -0
- package/dist/wireErrorTriage.js +2 -1
- package/dist/wireFailureShape.d.ts +4 -0
- package/dist/wireFailureShape.js +141 -19
- package/dist/wireRefusalCopy.d.ts +6 -5
- package/dist/wireRefusalCopy.js +49 -92
- package/docs/INTEGRATION-CLIENTS.md +2118 -17
- package/package.json +6 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { RequestLane } from './request/taskRequest.js';
|
|
2
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
3
|
+
export declare const ENGINE_UNAVAILABLE_REASONS: readonly ["not_running", "not_answering", "address_refused", "version_refused", "model_setup", "credential_conflict", "credential_refused", "data_root_refused"];
|
|
4
|
+
export type EngineUnavailableReason = (typeof ENGINE_UNAVAILABLE_REASONS)[number];
|
|
5
|
+
export type EngineBootRefusalReason = Extract<EngineUnavailableReason, 'model_setup' | 'credential_conflict' | 'credential_refused' | 'data_root_refused'>;
|
|
6
|
+
export declare const ENGINE_INSTALL_SHAPES: readonly ["npm-global", "managed", "npm-local", "dev", "app", "unknown"];
|
|
7
|
+
export type EngineInstallShape = (typeof ENGINE_INSTALL_SHAPES)[number];
|
|
8
|
+
export type EngineBootRefusalForm = {
|
|
9
|
+
readonly kind: 'embedded';
|
|
10
|
+
readonly install: EngineInstallShape;
|
|
11
|
+
readonly dataDir?: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'deployment';
|
|
14
|
+
};
|
|
15
|
+
export type EngineDataRootVariant = 'newer_root' | 'unreadable' | 'unknown';
|
|
16
|
+
export type EngineBootWayOut = 'newer_build' | 'separate_data_root' | 'restore_backup' | 'repair_access';
|
|
17
|
+
export declare const ENGINE_BOOT_REFUSAL_CODES: Readonly<Record<string, EngineBootRefusalReason>>;
|
|
18
|
+
export interface LocalEngineBootRefusal {
|
|
19
|
+
readonly code?: string;
|
|
20
|
+
readonly hint?: string;
|
|
21
|
+
readonly text: string;
|
|
22
|
+
readonly reason?: EngineBootRefusalReason;
|
|
23
|
+
readonly restartWouldHelp?: false;
|
|
24
|
+
readonly variant?: EngineDataRootVariant;
|
|
25
|
+
readonly findings?: readonly string[];
|
|
26
|
+
readonly highWater?: string;
|
|
27
|
+
readonly engineVersion?: string;
|
|
28
|
+
readonly markerPath?: string;
|
|
29
|
+
readonly waysOut?: readonly EngineBootWayOut[];
|
|
30
|
+
}
|
|
31
|
+
export declare function engineBootRefusalOf(lines: readonly string[], scrub: (s: string) => string): LocalEngineBootRefusal | undefined;
|
|
32
|
+
export declare function engineBootRefusalSentence(refusal: LocalEngineBootRefusal, lang?: UiLanguage, form?: EngineBootRefusalForm): string | undefined;
|
|
33
|
+
export interface EngineUnavailableFacts {
|
|
34
|
+
readonly reason?: EngineUnavailableReason;
|
|
35
|
+
readonly code?: string;
|
|
36
|
+
readonly detail?: string;
|
|
37
|
+
readonly refusal?: LocalEngineBootRefusal;
|
|
38
|
+
readonly engineExitCode?: number | null;
|
|
39
|
+
readonly engineSignal?: string | null;
|
|
40
|
+
readonly pid?: number;
|
|
41
|
+
readonly answer?: 'silent' | 'answered' | 'drain-stuck';
|
|
42
|
+
readonly form?: EngineBootRefusalForm;
|
|
43
|
+
}
|
|
44
|
+
export declare function engineUnavailableLine(facts: EngineUnavailableFacts, lane: RequestLane, lang?: UiLanguage): string | undefined;
|
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
import { appendOwnElement, readOwnDataValue } from './ownKey.js';
|
|
2
|
+
import { compareReleaseVersions } from './supportFloor.js';
|
|
3
|
+
import { LOCAL_ENGINE_SPAWN_ENV } from './localEngineSpawn.js';
|
|
4
|
+
import { SETTINGS_MODEL_PLANE_REFUSAL_CODES, SETTINGS_WEB_ADMIN_TOKEN_ENV } from './generated/settingsSchemaTables.js';
|
|
5
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
6
|
+
export const ENGINE_UNAVAILABLE_REASONS = Object.freeze([
|
|
7
|
+
'not_running',
|
|
8
|
+
'not_answering',
|
|
9
|
+
'address_refused',
|
|
10
|
+
'version_refused',
|
|
11
|
+
'model_setup',
|
|
12
|
+
'credential_conflict',
|
|
13
|
+
'credential_refused',
|
|
14
|
+
'data_root_refused',
|
|
15
|
+
]);
|
|
16
|
+
export const ENGINE_INSTALL_SHAPES = Object.freeze(['npm-global', 'managed', 'npm-local', 'dev', 'app', 'unknown']);
|
|
17
|
+
const SCHEMA_MISMATCH_CODE = 'config.schema_mismatch';
|
|
18
|
+
const WAYS_OUT_ANCHOR = /Ways out \(these three and no others\):/;
|
|
19
|
+
const MARKER_ROLE = /^the local engine high-water marker$/;
|
|
20
|
+
export const ENGINE_BOOT_REFUSAL_CODES = Object.freeze(Object.fromEntries([
|
|
21
|
+
...SETTINGS_MODEL_PLANE_REFUSAL_CODES.map((c) => [c, 'model_setup']),
|
|
22
|
+
['config.anthropic_credential_conflict', 'credential_conflict'],
|
|
23
|
+
['config.center_credential_malformed', 'credential_refused'],
|
|
24
|
+
['config.center_credential_user_session_multi_tenant', 'credential_refused'],
|
|
25
|
+
[SCHEMA_MISMATCH_CODE, 'data_root_refused'],
|
|
26
|
+
]));
|
|
27
|
+
function isRecord(v) {
|
|
28
|
+
if (typeof v !== 'object' || v === null)
|
|
29
|
+
return false;
|
|
30
|
+
try {
|
|
31
|
+
return !Array.isArray(v);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function own(v, key) {
|
|
38
|
+
if (!isRecord(v))
|
|
39
|
+
return undefined;
|
|
40
|
+
try {
|
|
41
|
+
return readOwnDataValue(v, key);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function parseJsonLine(t) {
|
|
48
|
+
try {
|
|
49
|
+
return JSON.parse(t);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function deepFreeze(v) {
|
|
56
|
+
if (typeof v === 'object' && v !== null && !Object.isFrozen(v)) {
|
|
57
|
+
for (const k of Object.keys(v))
|
|
58
|
+
deepFreeze(v[k]);
|
|
59
|
+
Object.freeze(v);
|
|
60
|
+
}
|
|
61
|
+
return v;
|
|
62
|
+
}
|
|
63
|
+
function flat(s) {
|
|
64
|
+
return s.replace(/\s+/g, ' ').trim();
|
|
65
|
+
}
|
|
66
|
+
function stripEndStop(s) {
|
|
67
|
+
return s.replace(/[.。]+$/u, '');
|
|
68
|
+
}
|
|
69
|
+
const isRelease = (v) => compareReleaseVersions(v, v) !== undefined;
|
|
70
|
+
const CODE_TOKEN = '(config\\.[A-Za-z0-9_.-]*[A-Za-z0-9_])';
|
|
71
|
+
function refusalCodesIn(text) {
|
|
72
|
+
const out = [];
|
|
73
|
+
for (const m of text.matchAll(new RegExp(`\\[${CODE_TOKEN}\\]`, 'g')))
|
|
74
|
+
out.push({ at: m.index ?? 0, code: m[1] });
|
|
75
|
+
for (const m of text.matchAll(new RegExp(`(?:^|\\n)[ \\t]*(?:[A-Za-z]*Error(?: \\[[^\\]\\n]*\\])?:[ \\t]*)?${CODE_TOKEN}:`, 'g')))
|
|
76
|
+
out.push({ at: m.index ?? 0, code: m[1] });
|
|
77
|
+
out.sort((a, b) => a.at - b.at);
|
|
78
|
+
const seen = [];
|
|
79
|
+
for (const { code } of out)
|
|
80
|
+
if (!seen.includes(code))
|
|
81
|
+
seen.push(code);
|
|
82
|
+
return seen;
|
|
83
|
+
}
|
|
84
|
+
const BOOT_REFUSAL_MAX_CHARS = 800;
|
|
85
|
+
const BOOT_REFUSAL_MAX_HINTS = 2;
|
|
86
|
+
const BOOT_REFUSAL_MAX_FINDINGS = 8;
|
|
87
|
+
const CONFIG_CODE = /^config\.[A-Za-z0-9_.-]+$/;
|
|
88
|
+
function capSentence(s) {
|
|
89
|
+
const t = s.trim();
|
|
90
|
+
return t.length > BOOT_REFUSAL_MAX_CHARS ? `${t.slice(0, BOOT_REFUSAL_MAX_CHARS)}…` : t;
|
|
91
|
+
}
|
|
92
|
+
function dataRootReadingOf(text) {
|
|
93
|
+
if (!text.includes(SCHEMA_MISMATCH_CODE) || !WAYS_OUT_ANCHOR.test(text))
|
|
94
|
+
return undefined;
|
|
95
|
+
const lines = text.split(/\r?\n/);
|
|
96
|
+
const at = lines.findIndex((l) => l.includes(`${SCHEMA_MISMATCH_CODE}:`));
|
|
97
|
+
if (at < 0)
|
|
98
|
+
return undefined;
|
|
99
|
+
const first = lines[at];
|
|
100
|
+
const lead = first.lastIndexOf(`${SCHEMA_MISMATCH_CODE}: `);
|
|
101
|
+
const head = capSentence(lead >= 0 ? first.slice(lead) : first);
|
|
102
|
+
if (head.length === 0)
|
|
103
|
+
return undefined;
|
|
104
|
+
const findings = [];
|
|
105
|
+
let highWater;
|
|
106
|
+
let engineVersion;
|
|
107
|
+
let markerPath;
|
|
108
|
+
let newer = false;
|
|
109
|
+
let unreadable = false;
|
|
110
|
+
for (let i = at + 1; i < lines.length && findings.length < BOOT_REFUSAL_MAX_FINDINGS; i++) {
|
|
111
|
+
const l = lines[i];
|
|
112
|
+
if (WAYS_OUT_ANCHOR.test(l) || !/^\s+\S/.test(l))
|
|
113
|
+
break;
|
|
114
|
+
const f = capSentence(l);
|
|
115
|
+
findings.push(f);
|
|
116
|
+
const hw = /: engine high-water (\S+) — .*NEWER than this build \(([^()\s]+)\)/.exec(f);
|
|
117
|
+
if (hw !== null) {
|
|
118
|
+
newer = true;
|
|
119
|
+
if (isRelease(hw[1]))
|
|
120
|
+
highWater = hw[1];
|
|
121
|
+
if (isRelease(hw[2]))
|
|
122
|
+
engineVersion = hw[2];
|
|
123
|
+
const p = /^\S+ \(the local engine high-water marker\) at (.+?): engine high-water /.exec(f);
|
|
124
|
+
if (p !== null)
|
|
125
|
+
markerPath = p[1];
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (/: UNKNOWN field\(s\) .*NEWER than this build/.test(f)) {
|
|
129
|
+
newer = true;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const un = /^\S+ \(([^()]*)\) at (.+?): unreadable \([^()\s]+\)/.exec(f);
|
|
133
|
+
if (un !== null) {
|
|
134
|
+
unreadable = true;
|
|
135
|
+
if (MARKER_ROLE.test(un[1]))
|
|
136
|
+
markerPath = un[2];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
variant: newer ? 'newer_root' : unreadable ? 'unreadable' : 'unknown',
|
|
141
|
+
findings: [head, ...findings],
|
|
142
|
+
...(highWater !== undefined ? { highWater } : {}),
|
|
143
|
+
...(engineVersion !== undefined ? { engineVersion } : {}),
|
|
144
|
+
...(markerPath !== undefined ? { markerPath } : {}),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function classifyRefusalText(text) {
|
|
148
|
+
for (const code of refusalCodesIn(text)) {
|
|
149
|
+
if (!Object.hasOwn(ENGINE_BOOT_REFUSAL_CODES, code))
|
|
150
|
+
continue;
|
|
151
|
+
const reason = ENGINE_BOOT_REFUSAL_CODES[code];
|
|
152
|
+
if (reason !== 'data_root_refused')
|
|
153
|
+
return { reason, code };
|
|
154
|
+
const dataRoot = dataRootReadingOf(text);
|
|
155
|
+
if (dataRoot !== undefined)
|
|
156
|
+
return { reason, code, dataRoot };
|
|
157
|
+
}
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
export function engineBootRefusalOf(lines, scrub) {
|
|
161
|
+
try {
|
|
162
|
+
const clean = (s) => {
|
|
163
|
+
try {
|
|
164
|
+
const out = scrub(s);
|
|
165
|
+
return typeof out === 'string' ? out : undefined;
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const hints = [];
|
|
172
|
+
let code;
|
|
173
|
+
let hint;
|
|
174
|
+
let fatal;
|
|
175
|
+
let fatalClass;
|
|
176
|
+
let fatalCode;
|
|
177
|
+
let entryClass;
|
|
178
|
+
const list = Array.isArray(lines) ? [...lines] : [];
|
|
179
|
+
const plain = [];
|
|
180
|
+
for (const raw of list) {
|
|
181
|
+
if (typeof raw !== 'string')
|
|
182
|
+
continue;
|
|
183
|
+
const t0 = raw.trim();
|
|
184
|
+
if (!t0.startsWith('{')) {
|
|
185
|
+
plain.push(raw);
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const line = clean(raw);
|
|
189
|
+
if (line === undefined)
|
|
190
|
+
continue;
|
|
191
|
+
const t = line.trim();
|
|
192
|
+
if (!t.startsWith('{'))
|
|
193
|
+
continue;
|
|
194
|
+
const o = parseJsonLine(t);
|
|
195
|
+
if (!isRecord(o))
|
|
196
|
+
continue;
|
|
197
|
+
const m = own(o, 'msg');
|
|
198
|
+
const err = own(o, 'err');
|
|
199
|
+
if (m === 'fatal' && typeof err === 'string' && err.trim() !== '') {
|
|
200
|
+
const full = clean(err);
|
|
201
|
+
const s = full === undefined ? undefined : full.replace(/^\s*Error:\s*/, '');
|
|
202
|
+
if (s !== undefined && s.trim() !== '') {
|
|
203
|
+
fatal = capSentence(s);
|
|
204
|
+
fatalClass = classifyRefusalText(s);
|
|
205
|
+
fatalCode = refusalCodesIn(s).find((x) => CONFIG_CODE.test(x));
|
|
206
|
+
}
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
const c = own(o, 'code');
|
|
210
|
+
const h = own(o, 'hint');
|
|
211
|
+
if (typeof c === 'string' && CONFIG_CODE.test(c) && typeof h === 'string' && h.trim() !== '') {
|
|
212
|
+
const model = own(o, 'model');
|
|
213
|
+
const who = typeof model === 'string' && model !== '' ? `"${model}": ` : '';
|
|
214
|
+
const s = clean(`${who}${h}`);
|
|
215
|
+
const cc = clean(c);
|
|
216
|
+
if (s === undefined || cc === undefined || !CONFIG_CODE.test(cc))
|
|
217
|
+
continue;
|
|
218
|
+
const sentence = capSentence(s);
|
|
219
|
+
code = cc;
|
|
220
|
+
const ch = clean(h);
|
|
221
|
+
hint = ch === undefined ? undefined : capSentence(ch);
|
|
222
|
+
if (Object.hasOwn(ENGINE_BOOT_REFUSAL_CODES, cc) && ENGINE_BOOT_REFUSAL_CODES[cc] !== 'data_root_refused')
|
|
223
|
+
entryClass = { reason: ENGINE_BOOT_REFUSAL_CODES[cc], code: cc };
|
|
224
|
+
if (hints.includes(sentence))
|
|
225
|
+
continue;
|
|
226
|
+
hints.push(sentence);
|
|
227
|
+
if (hints.length > BOOT_REFUSAL_MAX_HINTS)
|
|
228
|
+
hints.shift();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
let text;
|
|
232
|
+
let cls = fatalClass ?? entryClass;
|
|
233
|
+
const parts = [...hints, ...(fatal !== undefined ? [fatal] : [])];
|
|
234
|
+
if (parts.length > 0)
|
|
235
|
+
text = parts.join('\n');
|
|
236
|
+
if (cls === undefined) {
|
|
237
|
+
let from = -1;
|
|
238
|
+
for (let i = plain.length - 1; i >= 0; i--)
|
|
239
|
+
if (plain[i].includes(SCHEMA_MISMATCH_CODE)) {
|
|
240
|
+
from = i;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
if (from >= 0) {
|
|
244
|
+
const block = clean(plain.slice(from).join('\n'));
|
|
245
|
+
const got = block === undefined ? undefined : classifyRefusalText(block);
|
|
246
|
+
if (block !== undefined && got !== undefined) {
|
|
247
|
+
cls = got;
|
|
248
|
+
if (text === undefined)
|
|
249
|
+
text = capSentence(block);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (text === undefined)
|
|
254
|
+
return undefined;
|
|
255
|
+
if (code === undefined)
|
|
256
|
+
code = cls?.code ?? fatalCode;
|
|
257
|
+
const dr = cls?.dataRoot;
|
|
258
|
+
return deepFreeze({
|
|
259
|
+
...(code !== undefined ? { code } : {}),
|
|
260
|
+
...(hint !== undefined ? { hint } : {}),
|
|
261
|
+
text,
|
|
262
|
+
...(cls !== undefined ? { reason: cls.reason, restartWouldHelp: false } : {}),
|
|
263
|
+
...(dr !== undefined
|
|
264
|
+
? {
|
|
265
|
+
variant: dr.variant,
|
|
266
|
+
findings: dr.findings,
|
|
267
|
+
...(dr.highWater !== undefined ? { highWater: dr.highWater } : {}),
|
|
268
|
+
...(dr.engineVersion !== undefined ? { engineVersion: dr.engineVersion } : {}),
|
|
269
|
+
...(dr.markerPath !== undefined ? { markerPath: dr.markerPath } : {}),
|
|
270
|
+
waysOut: ['newer_build', 'separate_data_root', 'restore_backup', 'repair_access'],
|
|
271
|
+
}
|
|
272
|
+
: {}),
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function againOf(retry, form) {
|
|
280
|
+
if (retry === 'command')
|
|
281
|
+
return msg('engine.unavailable.again.command');
|
|
282
|
+
return msg(form !== undefined && form.kind === 'embedded' && form.install === 'app' ? 'engine.unavailable.again.app' : 'engine.unavailable.again.session');
|
|
283
|
+
}
|
|
284
|
+
function configDirKey() {
|
|
285
|
+
for (const row of LOCAL_ENGINE_SPAWN_ENV)
|
|
286
|
+
if (row.value.kind === 'path' && row.value.slot === 'configHome' && !row.userOverridable)
|
|
287
|
+
return row.key;
|
|
288
|
+
return undefined;
|
|
289
|
+
}
|
|
290
|
+
function formOf(v) {
|
|
291
|
+
const kind = own(v, 'kind');
|
|
292
|
+
if (kind === 'deployment')
|
|
293
|
+
return { kind: 'deployment' };
|
|
294
|
+
if (kind !== 'embedded')
|
|
295
|
+
return undefined;
|
|
296
|
+
const install = own(v, 'install');
|
|
297
|
+
if (typeof install !== 'string' || !ENGINE_INSTALL_SHAPES.includes(install))
|
|
298
|
+
return undefined;
|
|
299
|
+
const dataDir = own(v, 'dataDir');
|
|
300
|
+
return { kind: 'embedded', install: install, ...(typeof dataDir === 'string' && dataDir.trim() !== '' ? { dataDir: flat(dataDir) } : {}) };
|
|
301
|
+
}
|
|
302
|
+
function dataRootWaysOut(form, highWater, retry) {
|
|
303
|
+
const again = againOf(retry, form);
|
|
304
|
+
if (form.kind === 'deployment') {
|
|
305
|
+
const who = highWater !== undefined ? msg('engine.bootRefusal.who.buildAtLeast', { version: highWater }) : msg('engine.bootRefusal.who.build');
|
|
306
|
+
return msg('engine.bootRefusal.waysOut', {
|
|
307
|
+
newer: msg('engine.bootRefusal.newer.deployment', { who }),
|
|
308
|
+
separate: msg('engine.bootRefusal.separate.deployment'),
|
|
309
|
+
restore: msg('engine.bootRefusal.restoreDeployment'),
|
|
310
|
+
repair: msg('engine.bootRefusal.repairDeployment'),
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
const app = form.install === 'app';
|
|
314
|
+
const who = app
|
|
315
|
+
? highWater !== undefined ? msg('engine.bootRefusal.who.appAtLeast', { version: highWater }) : msg('engine.bootRefusal.who.app')
|
|
316
|
+
: highWater !== undefined ? msg('engine.bootRefusal.who.semaAtLeast', { version: highWater }) : msg('engine.bootRefusal.who.sema');
|
|
317
|
+
const newerKey = form.install === 'npm-global' || form.install === 'managed'
|
|
318
|
+
? 'engine.bootRefusal.newer.update'
|
|
319
|
+
: form.install === 'npm-local'
|
|
320
|
+
? 'engine.bootRefusal.newer.projectLocal'
|
|
321
|
+
: form.install === 'dev'
|
|
322
|
+
? 'engine.bootRefusal.newer.devTree'
|
|
323
|
+
: app
|
|
324
|
+
? 'engine.bootRefusal.newer.app'
|
|
325
|
+
: 'engine.bootRefusal.newer.unknown';
|
|
326
|
+
const key = configDirKey() ?? '';
|
|
327
|
+
return msg('engine.bootRefusal.waysOut', {
|
|
328
|
+
newer: msg(newerKey, { who, again }),
|
|
329
|
+
separate: msg(app ? 'engine.bootRefusal.separate.app' : 'engine.bootRefusal.separate.embedded', { key }),
|
|
330
|
+
restore: msg('engine.bootRefusal.restore', { folder: form.dataDir ?? msg('engine.bootRefusal.folder.default'), again }),
|
|
331
|
+
repair: msg('engine.bootRefusal.repair', { again }),
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function armFix(reason, retry, facts, form) {
|
|
335
|
+
const again = againOf(retry, form);
|
|
336
|
+
switch (reason) {
|
|
337
|
+
case 'model_setup':
|
|
338
|
+
return msg('engine.unavailable.fix.modelSetup', { again });
|
|
339
|
+
case 'credential_conflict':
|
|
340
|
+
return msg('engine.unavailable.fix.credentialConflict', { again });
|
|
341
|
+
case 'credential_refused':
|
|
342
|
+
if (facts.code === 'config.center_credential_malformed')
|
|
343
|
+
return msg('engine.unavailable.fix.credentialMalformed', { again, tokenFile: SETTINGS_WEB_ADMIN_TOKEN_ENV.tokenFile });
|
|
344
|
+
if (facts.code === 'config.center_credential_user_session_multi_tenant') {
|
|
345
|
+
return msg('engine.unavailable.fix.credentialMultiTenant', { again, token: SETTINGS_WEB_ADMIN_TOKEN_ENV.token, tokenFile: SETTINGS_WEB_ADMIN_TOKEN_ENV.tokenFile });
|
|
346
|
+
}
|
|
347
|
+
return msg('engine.unavailable.fix.credential', { again });
|
|
348
|
+
case 'not_answering': {
|
|
349
|
+
const wait = msg(facts.answer === 'silent' ? 'engine.unavailable.wait.respond' : facts.answer === 'drain-stuck' ? 'engine.unavailable.wait.exit' : 'engine.unavailable.wait.healthy');
|
|
350
|
+
return facts.pid !== undefined ? msg('engine.unavailable.fix.waitPid', { wait, again, pid: facts.pid }) : msg('engine.unavailable.fix.wait', { wait, again });
|
|
351
|
+
}
|
|
352
|
+
case 'address_refused':
|
|
353
|
+
case 'version_refused':
|
|
354
|
+
return undefined;
|
|
355
|
+
default:
|
|
356
|
+
return msg('engine.unavailable.fix.diagnose', { retry: msg(retry === 'command' ? 'engine.unavailable.retry.command' : 'engine.unavailable.retry.session') });
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function refusalView(r) {
|
|
360
|
+
const text = own(r, 'text');
|
|
361
|
+
const code = own(r, 'code');
|
|
362
|
+
const reason = own(r, 'reason');
|
|
363
|
+
const findingsRaw = own(r, 'findings');
|
|
364
|
+
let findings;
|
|
365
|
+
try {
|
|
366
|
+
if (Array.isArray(findingsRaw)) {
|
|
367
|
+
const fs = [];
|
|
368
|
+
const n = readOwnDataValue(findingsRaw, 'length');
|
|
369
|
+
for (let i = 0; typeof n === 'number' && i < n && i < BOOT_REFUSAL_MAX_FINDINGS + 1; i++) {
|
|
370
|
+
const f = readOwnDataValue(findingsRaw, String(i));
|
|
371
|
+
if (typeof f === 'string' && f.trim() !== '')
|
|
372
|
+
appendOwnElement(fs, f);
|
|
373
|
+
}
|
|
374
|
+
if (fs.length > 0)
|
|
375
|
+
findings = fs;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
findings = undefined;
|
|
380
|
+
}
|
|
381
|
+
const hw = own(r, 'highWater');
|
|
382
|
+
const validReason = typeof reason === 'string' && Object.values(ENGINE_BOOT_REFUSAL_CODES).includes(reason) ? reason : undefined;
|
|
383
|
+
return {
|
|
384
|
+
...(typeof text === 'string' && text.trim() !== '' ? { text } : {}),
|
|
385
|
+
...(typeof code === 'string' && CONFIG_CODE.test(code) ? { code } : {}),
|
|
386
|
+
...(validReason !== undefined ? { reason: validReason } : {}),
|
|
387
|
+
...(findings !== undefined ? { findings } : {}),
|
|
388
|
+
...(typeof hw === 'string' && isRelease(hw) ? { highWater: hw } : {}),
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
export function engineBootRefusalSentence(refusal, lang, form) {
|
|
392
|
+
try {
|
|
393
|
+
const r = refusalView(refusal);
|
|
394
|
+
if (r.text === undefined)
|
|
395
|
+
return undefined;
|
|
396
|
+
const f = formOf(form);
|
|
397
|
+
if (f !== undefined && r.reason !== undefined) {
|
|
398
|
+
if (r.reason === 'data_root_refused' && r.findings !== undefined) {
|
|
399
|
+
return renderMessage(msg('engine.bootRefusal.withWaysOut', { reason: flat(r.findings.join(' ')), waysOut: dataRootWaysOut(f, r.highWater, 'session') }), lang);
|
|
400
|
+
}
|
|
401
|
+
const fix = r.reason !== 'data_root_refused' ? armFix(r.reason, 'session', r.code !== undefined ? { code: r.code } : {}, f) : undefined;
|
|
402
|
+
if (fix !== undefined)
|
|
403
|
+
return renderMessage(msg('engine.bootRefusal.withFix', { reason: `${stripEndStop(r.text.trim())}.`, fix }), lang);
|
|
404
|
+
}
|
|
405
|
+
return renderMessage(msg('localEngine.bootRefusal', { reason: r.text }), lang);
|
|
406
|
+
}
|
|
407
|
+
catch {
|
|
408
|
+
return undefined;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
const LANE_RETRY = Object.freeze({ interactive: 'session', print: 'command', utility: 'session' });
|
|
412
|
+
const HOST_CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
413
|
+
export function engineUnavailableLine(facts, lane, lang) {
|
|
414
|
+
try {
|
|
415
|
+
if (typeof lane !== 'string' || !Object.hasOwn(LANE_RETRY, lane))
|
|
416
|
+
return undefined;
|
|
417
|
+
if (!isRecord(facts))
|
|
418
|
+
return undefined;
|
|
419
|
+
const retry = LANE_RETRY[lane];
|
|
420
|
+
const hostReasonRaw = own(facts, 'reason');
|
|
421
|
+
const hostReason = typeof hostReasonRaw === 'string' && ENGINE_UNAVAILABLE_REASONS.includes(hostReasonRaw) ? hostReasonRaw : undefined;
|
|
422
|
+
const codeRaw = own(facts, 'code');
|
|
423
|
+
const hostCode = typeof codeRaw === 'string' && HOST_CODE.test(codeRaw) ? codeRaw : undefined;
|
|
424
|
+
const detailRaw = own(facts, 'detail');
|
|
425
|
+
const hostDetail = typeof detailRaw === 'string' && detailRaw.trim() !== '' ? flat(detailRaw) : undefined;
|
|
426
|
+
const exitRaw = own(facts, 'engineExitCode');
|
|
427
|
+
const sigRaw = own(facts, 'engineSignal');
|
|
428
|
+
const pidRaw = own(facts, 'pid');
|
|
429
|
+
const pid = typeof pidRaw === 'number' && Number.isInteger(pidRaw) && pidRaw > 0 ? pidRaw : undefined;
|
|
430
|
+
const answerRaw = own(facts, 'answer');
|
|
431
|
+
const answer = answerRaw === 'silent' || answerRaw === 'answered' || answerRaw === 'drain-stuck' ? answerRaw : undefined;
|
|
432
|
+
const refusal = refusalView(own(facts, 'refusal'));
|
|
433
|
+
const form = formOf(own(facts, 'form'));
|
|
434
|
+
const reason = refusal.reason ?? hostReason;
|
|
435
|
+
const tag = `reason=${hostCode ?? reason ?? 'unknown'} ` +
|
|
436
|
+
`engine_exit=${typeof exitRaw === 'number' && Number.isFinite(exitRaw) ? String(exitRaw) : 'none'} ` +
|
|
437
|
+
`engine_signal=${typeof sigRaw === 'string' && /^[A-Z][A-Z0-9]{0,15}$/.test(sigRaw) ? sigRaw : 'none'}`;
|
|
438
|
+
let detail;
|
|
439
|
+
let fix;
|
|
440
|
+
if (refusal.reason !== undefined && refusal.text !== undefined) {
|
|
441
|
+
if (refusal.reason === 'data_root_refused' && form !== undefined && refusal.findings !== undefined) {
|
|
442
|
+
detail = flat(refusal.findings.join(' '));
|
|
443
|
+
fix = dataRootWaysOut(form, refusal.highWater, retry);
|
|
444
|
+
}
|
|
445
|
+
else if (refusal.reason === 'data_root_refused') {
|
|
446
|
+
detail = flat(refusal.text);
|
|
447
|
+
fix = undefined;
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
detail = flat(refusal.text);
|
|
451
|
+
fix = armFix(refusal.reason, retry, refusal.code !== undefined ? { code: refusal.code } : {}, form);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
else if (reason === 'data_root_refused') {
|
|
455
|
+
detail = hostDetail;
|
|
456
|
+
fix = form !== undefined ? dataRootWaysOut(form, undefined, retry) : undefined;
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
detail = hostDetail;
|
|
460
|
+
fix = armFix(reason, retry, { ...(hostCode !== undefined ? { code: hostCode } : {}), ...(pid !== undefined ? { pid } : {}), ...(answer !== undefined ? { answer } : {}) }, form);
|
|
461
|
+
}
|
|
462
|
+
const head = reason === undefined
|
|
463
|
+
? msg('engine.unavailable.head.unknown')
|
|
464
|
+
: reason === 'not_answering'
|
|
465
|
+
? msg(answer === 'silent' ? 'engine.unavailable.head.notAnswering' : answer === 'drain-stuck' ? 'engine.unavailable.head.drainStuck' : 'engine.unavailable.head.noHealthyAnswer')
|
|
466
|
+
: reason === 'address_refused'
|
|
467
|
+
? msg('engine.unavailable.head.addressRefused')
|
|
468
|
+
: reason === 'version_refused'
|
|
469
|
+
? msg('engine.unavailable.head.versionRefused')
|
|
470
|
+
: reason === 'not_running' || (reason === 'model_setup' && refusal.reason === undefined)
|
|
471
|
+
? msg('engine.unavailable.head.notRunning')
|
|
472
|
+
: msg('engine.unavailable.head.refused');
|
|
473
|
+
let ref;
|
|
474
|
+
if (reason === 'address_refused' || reason === 'version_refused') {
|
|
475
|
+
ref = detail !== undefined ? msg('engine.unavailable.lineRefusedUse', { tag, head, detail }) : msg('engine.unavailable.lineRefusedUseNoDetail', { tag, head });
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
ref =
|
|
479
|
+
fix === undefined
|
|
480
|
+
? detail !== undefined
|
|
481
|
+
? msg('engine.unavailable.lineNoFix', { tag, head, detail })
|
|
482
|
+
: msg('engine.unavailable.lineBare', { tag, head })
|
|
483
|
+
: detail !== undefined
|
|
484
|
+
? msg('engine.unavailable.line', { tag, head, detail: stripEndStop(detail), fix })
|
|
485
|
+
: msg('engine.unavailable.lineNoDetail', { tag, head, fix });
|
|
486
|
+
}
|
|
487
|
+
return flat(renderMessage(ref, lang));
|
|
488
|
+
}
|
|
489
|
+
catch {
|
|
490
|
+
return undefined;
|
|
491
|
+
}
|
|
492
|
+
}
|
package/dist/eventLeg.js
CHANGED
|
@@ -9,7 +9,6 @@ import { hostLog } from './host.js';
|
|
|
9
9
|
import { guardedRead, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
10
10
|
import { settleEngineClosedApproval } from './hitl/approvalHolds.js';
|
|
11
11
|
import { approvalCompleteParked } from './hitl/approvalCompleteParked.js';
|
|
12
|
-
import { setBridgeRunHandleFallback } from './hitl/frameRouter.js';
|
|
13
12
|
export const EVENT_LEG_KINDS = Object.freeze(['live', 'durable', 'continuation']);
|
|
14
13
|
export const EVENT_LEG_TABLE = Object.freeze({
|
|
15
14
|
live: Object.freeze({ stages: Object.freeze(['bindRun', 'stampOwner', 'hitlFrames', 'askBridge', 'idleTriage']), windowIsCurrent: true }),
|
|
@@ -249,7 +248,9 @@ export function composeEventLeg(source, leg, ports) {
|
|
|
249
248
|
return;
|
|
250
249
|
if (!isCurrentNow() || ports.signal?.aborted === true)
|
|
251
250
|
return;
|
|
252
|
-
|
|
251
|
+
const legRun = lastBound?.taskId;
|
|
252
|
+
const named = event.runId === undefined && legRun !== undefined ? Object.freeze({ ...event, runId: legRun }) : event;
|
|
253
|
+
callPort('askBridge.onBreak', () => port.call(hostBridge, named));
|
|
253
254
|
};
|
|
254
255
|
const deps = hostView(hostBridge, {
|
|
255
256
|
runsEvents: () => runsEvents,
|
|
@@ -259,7 +260,6 @@ export function composeEventLeg(source, leg, ports) {
|
|
|
259
260
|
},
|
|
260
261
|
onBreak: () => onBreak,
|
|
261
262
|
});
|
|
262
|
-
setBridgeRunHandleFallback(deps, () => lastBound?.taskId);
|
|
263
263
|
inner = bridgeAskUserQuestionGates(inner, deps, { ...(ports.signal !== undefined ? { signal: ports.signal } : {}), ...(legRunId !== undefined ? { taskId: legRunId } : {}) });
|
|
264
264
|
}
|
|
265
265
|
const baseUrl = ports.idleTriage?.baseUrl;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_ABORT_CAUSES: readonly ["client_disconnected", "ask_park_grace_exhausted", "cancel_verb"];
|
|
1
|
+
export declare const SDK_ABORT_CAUSES: readonly ["client_disconnected", "ask_park_grace_exhausted", "cancel_verb", "stall_verdict"];
|
|
2
2
|
export declare const SDK_STATUS_DERIVED_COARSE_CODES: readonly ["request.rejected", "auth.unauthorized", "auth.forbidden", "not_found.resource", "request.payload_too_large", "request.unprocessable", "limit.rate_exceeded", "capability.unavailable", "internal.error"];
|
|
3
3
|
export declare const SDK_DENY_REASON_ROUTING_FAILURE: "routing_failure_fail_closed";
|
|
4
4
|
export declare const SDK_ASK_ROW_ENDING_CAUSES: readonly ["routing_failure_fail_closed", "run_cancelled", "run_exited", "batch_aborted", "batch_sibling_withdrawn", "batch_bound_elsewhere", "adhoc_leg_no_durable_domain", "orphan_ttl_exceeded", "crashed_before_park", "shutdown_before_park"];
|
|
@@ -14,4 +14,8 @@ export declare const SETTINGS_MCP_CONTENT_ORIGINS: readonly ["local", "execution
|
|
|
14
14
|
export declare const SETTINGS_MIN_TRUST_WORDS: readonly ["local", "session", "project", "global", "managed", "task"];
|
|
15
15
|
export declare const SETTINGS_WORKSPACE_TRUST_STATES: readonly ["accepted", "declined", "no_trust_step"];
|
|
16
16
|
export declare const SETTINGS_MODEL_PLANE_REFUSAL_CODES: readonly ["config.default_model_missing", "config.model_refused_name_minted", "config.model_route_endpoint_missing", "config.gateway_fallback_without_primary", "config.catalog_replaces_env_models"];
|
|
17
|
+
export declare const SETTINGS_WEB_ADMIN_TOKEN_ENV: Readonly<{
|
|
18
|
+
readonly token: "SEMA_WEB_ADMIN_TOKEN";
|
|
19
|
+
readonly tokenFile: "SEMA_WEB_ADMIN_TOKEN_FILE";
|
|
20
|
+
}>;
|
|
17
21
|
export declare const SETTINGS_NO_EXECUTION_TARGET_LANES: readonly ["none"];
|
|
@@ -70,6 +70,7 @@ export const SETTINGS_MODEL_PLANE_REFUSAL_CODES = Object.freeze([
|
|
|
70
70
|
"config.gateway_fallback_without_primary",
|
|
71
71
|
"config.catalog_replaces_env_models",
|
|
72
72
|
]);
|
|
73
|
+
export const SETTINGS_WEB_ADMIN_TOKEN_ENV = Object.freeze({ token: "SEMA_WEB_ADMIN_TOKEN", tokenFile: "SEMA_WEB_ADMIN_TOKEN_FILE" });
|
|
73
74
|
export const SETTINGS_NO_EXECUTION_TARGET_LANES = Object.freeze([
|
|
74
75
|
"none",
|
|
75
76
|
]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type AnswerCapture, type TopCauseReading, type TopLocalCodeReading, type UnansweredCapture } from '../engineWireFor.js';
|
|
2
2
|
import { type AttributionLadderState, type AttributionLadderStep } from './attributionLadder.js';
|
|
3
3
|
import { type RefusalCarrier, type SafetyStopHead } from './hitlBridge.js';
|
|
4
|
+
export declare const RETRY_BUDGET_MS = 8000;
|
|
4
5
|
export declare const PARKING_WAIT_CAP_MS = 5000;
|
|
5
6
|
export interface DeliveryTiming {
|
|
6
7
|
readonly delays?: readonly number[];
|
|
@@ -5,7 +5,7 @@ import { isSlotCarrier, readThrownSlot, THROWN_SLOT_UNREADABLE } from '../wireFa
|
|
|
5
5
|
import { deliverWithAttributionLadder, localCodeReadOf, topCauseReadOf } from './attributionLadder.js';
|
|
6
6
|
import { GATE_FAILURE_CODES, refusalCarrierOf, safetyStopHeadOf } from './hitlBridge.js';
|
|
7
7
|
const RETRY_DELAYS_MS = Object.freeze([500, 1_000, 2_000]);
|
|
8
|
-
const RETRY_BUDGET_MS = 8_000;
|
|
8
|
+
export const RETRY_BUDGET_MS = 8_000;
|
|
9
9
|
export const PARKING_WAIT_CAP_MS = 5_000;
|
|
10
10
|
let timingOverride;
|
|
11
11
|
export function setDeliveryTimingForTests(t) {
|
|
@@ -60,7 +60,7 @@ export declare function isApprovalDecided(r: ApprovalResolution): r is ApprovalR
|
|
|
60
60
|
export declare function approvalNotSentCause(r: ApprovalResolution): ApprovalNotSentCause | undefined;
|
|
61
61
|
export declare function approvalUnsettledCause(r: ApprovalResolution): ApprovalUnsettledCause | undefined;
|
|
62
62
|
export declare const APPROVAL_NOTE_RETRACTED_DETAIL = "the card was retracted (this host no longer has a decision port for it)";
|
|
63
|
-
export declare const APPROVAL_NOTE_EDIT_REFUSED_DETAIL
|
|
63
|
+
export declare const APPROVAL_NOTE_EDIT_REFUSED_DETAIL: string;
|
|
64
64
|
export declare function approvalResolutionDetail(r: ApprovalResolution): string | undefined;
|
|
65
65
|
export declare function approvalResolutionStatusTag(r: ApprovalResolution): string;
|
|
66
66
|
export declare function unsettledCauseOfReading(reading: DecisionRefusalReading): 'engine_refused' | 'engine_error' | 'no_answer';
|
|
@@ -5,6 +5,7 @@ import { carrierReadOf, isLocalSafetyStop, localCodeReadOf, topCauseReadOf } fro
|
|
|
5
5
|
import { directFailureReadingOf, transportReadingOf } from './approvalDelivery.js';
|
|
6
6
|
import { ownReadingSlot } from '../engineWireFor.js';
|
|
7
7
|
import { CHECKPOINT_ROW_BAR_SENTENCE, unboundWayOutContent } from '../checkpointRowVerdict.js';
|
|
8
|
+
import { msg, renderMessage } from '../i18n/translate.js';
|
|
8
9
|
export const APPROVAL_RESOLUTION_LANES = Object.freeze(['respond', 'decide', 'ask']);
|
|
9
10
|
export const APPROVAL_NOT_SENT_CAUSES = Object.freeze([
|
|
10
11
|
'retracted',
|
|
@@ -45,7 +46,7 @@ export function approvalUnsettledCause(r) {
|
|
|
45
46
|
return r.cause;
|
|
46
47
|
}
|
|
47
48
|
export const APPROVAL_NOTE_RETRACTED_DETAIL = 'the card was retracted (this host no longer has a decision port for it)';
|
|
48
|
-
export const APPROVAL_NOTE_EDIT_REFUSED_DETAIL = '
|
|
49
|
+
export const APPROVAL_NOTE_EDIT_REFUSED_DETAIL = renderMessage(msg('approval.editRefusal.stem'));
|
|
49
50
|
const NOT_SENT_SENTENCES = Object.freeze({
|
|
50
51
|
retracted: APPROVAL_NOTE_RETRACTED_DETAIL,
|
|
51
52
|
edit_refused: APPROVAL_NOTE_EDIT_REFUSED_DETAIL,
|