@sema-agent/client-core 0.81.0 → 0.82.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 +26 -0
- package/README.md +6 -4
- package/dist/adapt/arms.js +3 -1
- package/dist/adapter/activeRunSelfHeal.js +5 -2
- package/dist/adapter/downstream/terminalToSdkResult.js +4 -1
- package/dist/engineErrorCodes.d.ts +1 -0
- package/dist/engineErrorCodes.js +1 -0
- package/dist/gateOutcome.js +28 -2
- package/dist/hitl/hitlHostSurface.js +7 -4
- package/dist/hitl/parkResolver.js +6 -1
- package/dist/hitl/planReviewWire.js +7 -0
- package/dist/hitl/toolApprovalWire.js +7 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/registryQuotaUsage.d.ts +44 -0
- package/dist/registryQuotaUsage.js +111 -0
- package/dist/rewindArchiveCapability.d.ts +24 -0
- package/dist/rewindArchiveCapability.js +125 -0
- package/dist/toolRoster.d.ts +12 -0
- package/dist/toolRoster.js +35 -0
- package/dist/wireErrorTriage.d.ts +4 -0
- package/dist/wireErrorTriage.js +59 -5
- package/dist/wireFailureShape.js +27 -22
- package/docs/INTEGRATION-CLIENTS.md +112 -8
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type RewindArchiveBit = 'on' | 'off' | 'not_reported' | 'malformed';
|
|
2
|
+
export type RewindArchiveReading = {
|
|
3
|
+
kind: 'unobserved';
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'present';
|
|
6
|
+
conversationAnchor: RewindArchiveBit;
|
|
7
|
+
forkRestore: RewindArchiveBit;
|
|
8
|
+
codeOnly: RewindArchiveBit;
|
|
9
|
+
restoreFilesEpoch: RewindArchiveBit;
|
|
10
|
+
};
|
|
11
|
+
export type RewindArchiveMode = 'both' | 'code';
|
|
12
|
+
export type RewindCodeArchive = 'available' | 'unavailable' | 'unknown';
|
|
13
|
+
export declare function projectRewindArchiveCapability(caps: unknown): RewindArchiveReading | undefined;
|
|
14
|
+
export declare function noteEngineCapsForRewindArchive(baseUrl: string, caps: unknown, opts?: {
|
|
15
|
+
generation?: number;
|
|
16
|
+
}): void;
|
|
17
|
+
export declare function observedRewindArchive(baseUrl?: string | undefined): RewindArchiveReading;
|
|
18
|
+
export declare function rewindCodeArchiveAvailability(reading: RewindArchiveReading, mode: RewindArchiveMode): RewindCodeArchive;
|
|
19
|
+
export declare function rewindArchiveDoctorDetail(reading: RewindArchiveReading, mode: RewindArchiveMode): string;
|
|
20
|
+
export declare function rewindConversationAvailability(reading: RewindArchiveReading): RewindCodeArchive;
|
|
21
|
+
export declare function rewindConversationDoctorDetail(reading: RewindArchiveReading): string;
|
|
22
|
+
export declare function rewindRestoreFilesEpochDetail(reading: RewindArchiveReading): string;
|
|
23
|
+
export declare function forgetRewindArchiveReading(baseUrl: string | undefined): void;
|
|
24
|
+
export declare function __resetRewindArchiveReadingsForTests(): void;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
|
+
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
const CAPS_KEYS = {
|
|
4
|
+
conversationAnchor: 'resumeAt',
|
|
5
|
+
forkRestore: 'rewindFiles',
|
|
6
|
+
codeOnly: 'rewindFilesTo',
|
|
7
|
+
restoreFilesEpoch: 'restoreFiles',
|
|
8
|
+
};
|
|
9
|
+
const _capsKeyPin = true;
|
|
10
|
+
void _capsKeyPin;
|
|
11
|
+
function bitOf(caps, key) {
|
|
12
|
+
if (!Object.hasOwn(caps, key))
|
|
13
|
+
return 'not_reported';
|
|
14
|
+
const v = caps[key];
|
|
15
|
+
if (v === undefined)
|
|
16
|
+
return 'not_reported';
|
|
17
|
+
if (v === true)
|
|
18
|
+
return 'on';
|
|
19
|
+
if (v === false)
|
|
20
|
+
return 'off';
|
|
21
|
+
return 'malformed';
|
|
22
|
+
}
|
|
23
|
+
export function projectRewindArchiveCapability(caps) {
|
|
24
|
+
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
25
|
+
return undefined;
|
|
26
|
+
return {
|
|
27
|
+
kind: 'present',
|
|
28
|
+
conversationAnchor: bitOf(caps, CAPS_KEYS.conversationAnchor),
|
|
29
|
+
forkRestore: bitOf(caps, CAPS_KEYS.forkRestore),
|
|
30
|
+
codeOnly: bitOf(caps, CAPS_KEYS.codeOnly),
|
|
31
|
+
restoreFilesEpoch: bitOf(caps, CAPS_KEYS.restoreFilesEpoch),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const reader = createEngineCapReader({
|
|
35
|
+
name: 'rewindArchive',
|
|
36
|
+
project: projectRewindArchiveCapability,
|
|
37
|
+
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
38
|
+
});
|
|
39
|
+
export function noteEngineCapsForRewindArchive(baseUrl, caps, opts) {
|
|
40
|
+
reader.note(baseUrl, caps, opts);
|
|
41
|
+
}
|
|
42
|
+
export function observedRewindArchive(baseUrl = engineWireTarget()?.baseUrl) {
|
|
43
|
+
return reader.observed(baseUrl);
|
|
44
|
+
}
|
|
45
|
+
export function rewindCodeArchiveAvailability(reading, mode) {
|
|
46
|
+
if (reading.kind !== 'present')
|
|
47
|
+
return 'unknown';
|
|
48
|
+
const bits = mode === 'both' ? [reading.conversationAnchor, reading.forkRestore] : [reading.codeOnly];
|
|
49
|
+
if (bits.some((b) => b === 'off'))
|
|
50
|
+
return 'unavailable';
|
|
51
|
+
if (bits.every((b) => b === 'on'))
|
|
52
|
+
return 'available';
|
|
53
|
+
return 'unknown';
|
|
54
|
+
}
|
|
55
|
+
export function rewindArchiveDoctorDetail(reading, mode) {
|
|
56
|
+
const lane = mode === 'both' ? 'rewind with code restore' : 'code-only rewind';
|
|
57
|
+
if (reading.kind !== 'present') {
|
|
58
|
+
return `${lane} not observed — the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it, so whether the code archive can be restored is unknown`;
|
|
59
|
+
}
|
|
60
|
+
if (mode === 'both' && reading.conversationAnchor === 'off') {
|
|
61
|
+
return `${lane} off on this deployment (no conversation anchors) — rewinding to a message cannot run here at all, with or without the code`;
|
|
62
|
+
}
|
|
63
|
+
const bit = mode === 'both' ? reading.forkRestore : reading.codeOnly;
|
|
64
|
+
if (mode === 'both' && bit === 'on' && reading.conversationAnchor !== 'on') {
|
|
65
|
+
return `${lane}: the file history is on, but this engine does not report conversation anchors in a readable way, so whether a rewind to a message can run is unknown`;
|
|
66
|
+
}
|
|
67
|
+
switch (bit) {
|
|
68
|
+
case 'on':
|
|
69
|
+
return `${lane} on — the engine keeps a file history for this deployment and restores the tracked set on request`;
|
|
70
|
+
case 'off':
|
|
71
|
+
return mode === 'both'
|
|
72
|
+
? `${lane} off on this deployment (no file history store) — the working tree cannot be restored here; whether the conversation alone can be rewound is a separate reading`
|
|
73
|
+
: `${lane} off on this deployment — it needs both a file history store and conversation anchors, and the engine reports at least one missing (it does not say which)`;
|
|
74
|
+
case 'not_reported':
|
|
75
|
+
return `${lane} not reported by this engine — only newer engines advertise it, so this does not say whether the code archive can be restored`;
|
|
76
|
+
case 'malformed':
|
|
77
|
+
return `${lane} reported in a shape this reader cannot read — the value is neither true nor false, so the answer is unknown, not "no"`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export function rewindConversationAvailability(reading) {
|
|
81
|
+
if (reading.kind !== 'present')
|
|
82
|
+
return 'unknown';
|
|
83
|
+
if (reading.conversationAnchor === 'on')
|
|
84
|
+
return 'available';
|
|
85
|
+
if (reading.conversationAnchor === 'off')
|
|
86
|
+
return 'unavailable';
|
|
87
|
+
return 'unknown';
|
|
88
|
+
}
|
|
89
|
+
export function rewindConversationDoctorDetail(reading) {
|
|
90
|
+
const lane = 'rewind to a message';
|
|
91
|
+
if (reading.kind !== 'present') {
|
|
92
|
+
return `${lane} not observed — the engine reports conversation anchors on /v1/capabilities; this process has no usable capabilities reading cached for it, so whether the conversation can be rewound is unknown`;
|
|
93
|
+
}
|
|
94
|
+
switch (reading.conversationAnchor) {
|
|
95
|
+
case 'on':
|
|
96
|
+
return `${lane} on — this deployment keeps conversation anchors, so the conversation can be forked back to an earlier message`;
|
|
97
|
+
case 'off':
|
|
98
|
+
return `${lane} off on this deployment (no conversation anchors) — the conversation cannot be moved back to an earlier message here`;
|
|
99
|
+
case 'not_reported':
|
|
100
|
+
return `conversation anchors not reported by this engine — only newer engines advertise them, so this does not say whether the conversation can be rewound`;
|
|
101
|
+
case 'malformed':
|
|
102
|
+
return `conversation anchors reported in a shape this reader cannot read — the value is neither true nor false, so the answer is unknown, not "no"`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export function rewindRestoreFilesEpochDetail(reading) {
|
|
106
|
+
if (reading.kind !== 'present') {
|
|
107
|
+
return 'restore-files request spelling not observed — this process has no usable capabilities reading for this engine';
|
|
108
|
+
}
|
|
109
|
+
switch (reading.restoreFilesEpoch) {
|
|
110
|
+
case 'on':
|
|
111
|
+
return 'this engine announces the restore-files request key (tracked-set restore semantics)';
|
|
112
|
+
case 'off':
|
|
113
|
+
return 'this engine does not announce the restore-files request key; the client sends it anyway because the older spelling is rejected outright by current engines';
|
|
114
|
+
case 'not_reported':
|
|
115
|
+
return 'this engine does not report the restore-files epoch bit (older engine); the client sends the current spelling regardless';
|
|
116
|
+
case 'malformed':
|
|
117
|
+
return 'the restore-files epoch bit is reported in an unreadable shape; the client sends the current spelling regardless';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function forgetRewindArchiveReading(baseUrl) {
|
|
121
|
+
reader.forget(baseUrl);
|
|
122
|
+
}
|
|
123
|
+
export function __resetRewindArchiveReadingsForTests() {
|
|
124
|
+
reader.__resetForTests();
|
|
125
|
+
}
|
package/dist/toolRoster.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export interface ToolRosterEntryView {
|
|
|
38
38
|
contentOrigin?: string;
|
|
39
39
|
contentOriginProvenance?: string;
|
|
40
40
|
family?: string;
|
|
41
|
+
mountedBy?: string;
|
|
41
42
|
pathTarget?: ToolRosterPathTargetView;
|
|
42
43
|
renderHints?: ToolRosterRenderHintsView;
|
|
43
44
|
ruleFace?: {
|
|
@@ -52,6 +53,17 @@ export interface ToolRosterView {
|
|
|
52
53
|
entries: readonly ToolRosterEntryView[];
|
|
53
54
|
}
|
|
54
55
|
export declare function projectToolRoster(manifest: unknown): ToolRosterView | undefined;
|
|
56
|
+
export type HandsMountedReading = {
|
|
57
|
+
kind: 'mounted';
|
|
58
|
+
rows: number;
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'not-mounted';
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'unknown';
|
|
63
|
+
why: 'no-manifest' | 'no-roster' | 'roster-unreadable' | 'mount-condition-absent';
|
|
64
|
+
};
|
|
65
|
+
export declare function handsMountedFromManifest(manifest: unknown): HandsMountedReading;
|
|
66
|
+
export declare function handsMountedDetail(reading: HandsMountedReading): string;
|
|
55
67
|
export declare function toolRosterNames(roster: ToolRosterView | undefined): readonly string[];
|
|
56
68
|
export interface ToolShim {
|
|
57
69
|
name: string;
|
package/dist/toolRoster.js
CHANGED
|
@@ -64,6 +64,7 @@ function readEntry(raw) {
|
|
|
64
64
|
? { contentOriginProvenance: str(o.contentOriginProvenance) }
|
|
65
65
|
: {}),
|
|
66
66
|
...(str(o.family) !== undefined ? { family: str(o.family) } : {}),
|
|
67
|
+
...(str(o.mountedBy) !== undefined ? { mountedBy: str(o.mountedBy) } : {}),
|
|
67
68
|
...(readPathTarget(o.pathTarget) !== undefined
|
|
68
69
|
? { pathTarget: readPathTarget(o.pathTarget) }
|
|
69
70
|
: {}),
|
|
@@ -119,6 +120,40 @@ export function projectToolRoster(manifest) {
|
|
|
119
120
|
return undefined;
|
|
120
121
|
return readRoster(o.tools);
|
|
121
122
|
}
|
|
123
|
+
export function handsMountedFromManifest(manifest) {
|
|
124
|
+
const o = obj(manifest);
|
|
125
|
+
if (o === undefined)
|
|
126
|
+
return { kind: 'unknown', why: 'no-manifest' };
|
|
127
|
+
if (!('tools' in o))
|
|
128
|
+
return { kind: 'unknown', why: 'no-roster' };
|
|
129
|
+
const roster = readRoster(o.tools);
|
|
130
|
+
if (roster === undefined)
|
|
131
|
+
return { kind: 'unknown', why: 'roster-unreadable' };
|
|
132
|
+
if (roster.entries.length > 0 && roster.entries.every((e) => e.mountedBy === undefined)) {
|
|
133
|
+
return { kind: 'unknown', why: 'mount-condition-absent' };
|
|
134
|
+
}
|
|
135
|
+
const rows = roster.entries.filter((e) => e.mountedBy === 'hands').length;
|
|
136
|
+
return rows > 0 ? { kind: 'mounted', rows } : { kind: 'not-mounted' };
|
|
137
|
+
}
|
|
138
|
+
export function handsMountedDetail(reading) {
|
|
139
|
+
switch (reading.kind) {
|
|
140
|
+
case 'mounted':
|
|
141
|
+
return `this run was assembled with file-and-shell tools mounted (${reading.rows} of them)`;
|
|
142
|
+
case 'not-mounted':
|
|
143
|
+
return 'this leg of the run was assembled with NO built-in file-and-shell tools — the engine reports a roster and not one row was mounted by that condition, so on this leg the model had no tool of the engine\'s own for editing files or running commands (tools mounted by other conditions, such as external servers, and sub-runs delegated to other legs are not covered by this reading)';
|
|
144
|
+
case 'unknown':
|
|
145
|
+
switch (reading.why) {
|
|
146
|
+
case 'no-manifest':
|
|
147
|
+
return 'whether this run has file-and-shell tools is unknown — no assembly manifest was observed for it';
|
|
148
|
+
case 'no-roster':
|
|
149
|
+
return 'whether this run has file-and-shell tools is unknown — the manifest carries no tool roster (the static half never does; only an engine-minted effective manifest reports one)';
|
|
150
|
+
case 'roster-unreadable':
|
|
151
|
+
return 'whether this run has file-and-shell tools is unknown — the tool roster could not be read in the shape this reader knows';
|
|
152
|
+
case 'mount-condition-absent':
|
|
153
|
+
return 'whether this run has file-and-shell tools is unknown — this engine does not report which condition mounted each tool, so an empty count here would be a fact about the reader, not about the run';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
122
157
|
export function toolRosterNames(roster) {
|
|
123
158
|
return roster?.entries.map((e) => e.name) ?? [];
|
|
124
159
|
}
|
|
@@ -4,6 +4,7 @@ export type TurnWireErrorVerdict = {
|
|
|
4
4
|
status: number;
|
|
5
5
|
errorCode?: string;
|
|
6
6
|
message: string;
|
|
7
|
+
storedRowWhere?: string;
|
|
7
8
|
} | {
|
|
8
9
|
kind: 'stream-ended-without-terminal';
|
|
9
10
|
} | {
|
|
@@ -17,6 +18,9 @@ export type TurnWireErrorVerdict = {
|
|
|
17
18
|
export declare function classifyTurnWireError(err: unknown): TurnWireErrorVerdict;
|
|
18
19
|
export declare function isWireTransportError(err: unknown): boolean;
|
|
19
20
|
export declare function isPreStreamDrainingReject(err: unknown): boolean;
|
|
21
|
+
export declare function effectiveWireErrorCode(err: unknown): string | undefined;
|
|
22
|
+
export declare function corruptStoredRowWhere(err: unknown): string | undefined;
|
|
23
|
+
export declare function corruptStoredRowContent(where: string): string;
|
|
20
24
|
export declare function isResumeAtRejection(err: unknown): boolean;
|
|
21
25
|
export declare function drainingRetryDelayMs(err: unknown, attempt: number, opts?: {
|
|
22
26
|
ladder?: readonly number[];
|
package/dist/wireErrorTriage.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { readErrorNumber, readErrorStringList } from './wireFailureShape.js';
|
|
2
|
-
import {
|
|
1
|
+
import { readErrorNumber, readErrorString, readErrorStringList } from './wireFailureShape.js';
|
|
2
|
+
import { capForDisplay } from './fleetTaskDesc.js';
|
|
3
|
+
import { DRAINING_ERROR_CODE, RESUME_AT_ERROR_CODE_PREFIX, RESUME_POLICY_FOLD_CODE, RESUME_RETRY_LATER_CODES, RESUME_USAGE_WINDOW_EXHAUSTED, SCENARIO_NOT_ALLOWED_ERROR_CODE, } from './engineErrorCodes.js';
|
|
3
4
|
export const WIRE_NETWORK_ERROR_PATTERN = /fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|EHOSTUNREACH|ENETUNREACH|EPIPE|socket hang up|UND_ERR|terminated|other side closed/i;
|
|
4
5
|
function wireErrorDetail(err) {
|
|
5
6
|
const e = err;
|
|
@@ -13,7 +14,14 @@ export function classifyTurnWireError(err) {
|
|
|
13
14
|
if (typeof e?.status === 'number') {
|
|
14
15
|
const errorCode = typeof e.errorCode === 'string' && e.errorCode.length > 0 ? e.errorCode : undefined;
|
|
15
16
|
const message = typeof e.message === 'string' && e.message.length > 0 ? e.message : String(err);
|
|
16
|
-
|
|
17
|
+
const storedRowWhere = corruptStoredRowWhere(err);
|
|
18
|
+
return {
|
|
19
|
+
kind: 'http',
|
|
20
|
+
status: e.status,
|
|
21
|
+
...(errorCode !== undefined ? { errorCode } : {}),
|
|
22
|
+
message,
|
|
23
|
+
...(storedRowWhere !== undefined ? { storedRowWhere } : {}),
|
|
24
|
+
};
|
|
17
25
|
}
|
|
18
26
|
const errName = typeof err === 'object' && err !== null && typeof err.name === 'string'
|
|
19
27
|
? err.name
|
|
@@ -41,9 +49,35 @@ const RESUME_AT_TEXT_COMPAT = [
|
|
|
41
49
|
{ status: 404, marker: `(${RESUME_AT_ERROR_CODE_PREFIX}unknown_event)` },
|
|
42
50
|
{ status: 422, marker: `(${RESUME_AT_ERROR_CODE_PREFIX}no_session)` },
|
|
43
51
|
];
|
|
52
|
+
export function effectiveWireErrorCode(err) {
|
|
53
|
+
if (typeof err !== 'object' || err === null)
|
|
54
|
+
return undefined;
|
|
55
|
+
let outerRaw;
|
|
56
|
+
try {
|
|
57
|
+
outerRaw = err.errorCode;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
outerRaw = undefined;
|
|
61
|
+
}
|
|
62
|
+
const outer = typeof outerRaw === 'string' && outerRaw.length > 0 ? outerRaw : undefined;
|
|
63
|
+
if (outer !== RESUME_POLICY_FOLD_CODE)
|
|
64
|
+
return outer;
|
|
65
|
+
const inner = readErrorString(err, 'blockedBy');
|
|
66
|
+
return inner !== undefined && inner.length > 0 ? inner : outer;
|
|
67
|
+
}
|
|
68
|
+
export function corruptStoredRowWhere(err) {
|
|
69
|
+
if (effectiveWireErrorCode(err) !== 'corrupt')
|
|
70
|
+
return undefined;
|
|
71
|
+
const where = readErrorString(err, 'where');
|
|
72
|
+
return where !== undefined && where.trim().length > 0 ? where : undefined;
|
|
73
|
+
}
|
|
74
|
+
export function corruptStoredRowContent(where) {
|
|
75
|
+
return `The engine could not read a stored record this session needs in order to continue. The unreadable row is ${capForDisplay(where, 200)}; whoever operates this engine has to repair or remove that row before this session can continue.`;
|
|
76
|
+
}
|
|
44
77
|
export function isResumeAtRejection(err) {
|
|
45
78
|
const e = err;
|
|
46
|
-
|
|
79
|
+
const code = effectiveWireErrorCode(err);
|
|
80
|
+
if (code !== undefined && code.startsWith(RESUME_AT_ERROR_CODE_PREFIX))
|
|
47
81
|
return true;
|
|
48
82
|
const marker = RESUME_AT_TEXT_COMPAT.find((c) => c.status === e?.status)?.marker;
|
|
49
83
|
if (marker === undefined)
|
|
@@ -62,7 +96,27 @@ export function scenarioDenyFromError(err) {
|
|
|
62
96
|
if (typeof err !== 'object' || err === null)
|
|
63
97
|
return null;
|
|
64
98
|
const e = err;
|
|
65
|
-
|
|
99
|
+
let status;
|
|
100
|
+
try {
|
|
101
|
+
status = e.status;
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
if (status !== 400 && status !== 409)
|
|
107
|
+
return null;
|
|
108
|
+
if (status === 409) {
|
|
109
|
+
let outer;
|
|
110
|
+
try {
|
|
111
|
+
outer = e.errorCode;
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
if (outer !== RESUME_POLICY_FOLD_CODE)
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
if (effectiveWireErrorCode(err) !== SCENARIO_NOT_ALLOWED_ERROR_CODE)
|
|
66
120
|
return null;
|
|
67
121
|
const allowlist = (readErrorStringList(err, 'allowlist') ?? []).filter((x) => x.length > 0);
|
|
68
122
|
return { allowlist };
|
package/dist/wireFailureShape.js
CHANGED
|
@@ -7,33 +7,38 @@ function readGuarded(o, key) {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
function readErrorSlot(obj, key, accept) {
|
|
10
|
-
const o = obj;
|
|
11
|
-
let top;
|
|
12
10
|
try {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
const o = obj;
|
|
12
|
+
let top;
|
|
13
|
+
try {
|
|
14
|
+
top = o[key];
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
top = undefined;
|
|
18
|
+
}
|
|
19
|
+
if (accept(top))
|
|
20
|
+
return top;
|
|
21
|
+
let extra;
|
|
22
|
+
try {
|
|
23
|
+
extra = o['extra'];
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
extra = undefined;
|
|
27
|
+
}
|
|
28
|
+
if (typeof extra !== 'object' || extra === null || Array.isArray(extra))
|
|
29
|
+
return undefined;
|
|
30
|
+
let fromExtra;
|
|
31
|
+
try {
|
|
32
|
+
fromExtra = Object.hasOwn(extra, key) ? extra[key] : undefined;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
fromExtra = undefined;
|
|
36
|
+
}
|
|
37
|
+
return accept(fromExtra) ? fromExtra : undefined;
|
|
23
38
|
}
|
|
24
39
|
catch {
|
|
25
|
-
extra = undefined;
|
|
26
|
-
}
|
|
27
|
-
if (typeof extra !== 'object' || extra === null || Array.isArray(extra))
|
|
28
40
|
return undefined;
|
|
29
|
-
let fromExtra;
|
|
30
|
-
try {
|
|
31
|
-
fromExtra = Object.hasOwn(extra, key) ? extra[key] : undefined;
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
fromExtra = undefined;
|
|
35
41
|
}
|
|
36
|
-
return accept(fromExtra) ? fromExtra : undefined;
|
|
37
42
|
}
|
|
38
43
|
export function readErrorNumber(o, key) {
|
|
39
44
|
const v = readErrorSlot(o, key, (x) => typeof x === 'number');
|