@sema-agent/client-core 0.95.0 → 0.97.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 +269 -0
- package/README.md +61 -31
- package/dist/adapt/arms.js +7 -1
- package/dist/adapt/toolCards.d.ts +1 -0
- package/dist/adapt/toolCards.js +16 -3
- package/dist/adapt/wireShapes.js +2 -16
- package/dist/adapter/activeRunSelfHeal.d.ts +4 -2
- package/dist/adapter/activeRunSelfHeal.js +32 -6
- package/dist/adapter/downstream/eventToSdkMessage.js +11 -3
- package/dist/adapter/downstream/terminalToSdkResult.js +14 -11
- package/dist/adapter/runStream.js +30 -47
- package/dist/agentSession/backgroundView.js +2 -15
- package/dist/agentSession/engineAgentRegistryRead.js +5 -4
- package/dist/agentSession/engineSessionBackgroundStop.js +22 -15
- package/dist/agentsWireCaps.d.ts +1 -1
- package/dist/agentsWireCaps.js +29 -12
- package/dist/approvalDecidedByCapability.d.ts +2 -0
- package/dist/approvalDecidedByCapability.js +0 -1
- package/dist/approvalsStreamLiveCapability.d.ts +2 -0
- package/dist/approvalsStreamLiveCapability.js +3 -2
- package/dist/attachmentSeatCapability.d.ts +2 -0
- package/dist/attachmentSeatCapability.js +0 -1
- package/dist/callerCwdCapability.d.ts +2 -4
- package/dist/callerCwdCapability.js +0 -7
- package/dist/centerWiringCapability.d.ts +2 -4
- package/dist/centerWiringCapability.js +4 -9
- package/dist/classifierVerdictWire.js +4 -16
- package/dist/clientSlice.js +1 -1
- package/dist/cloudConfigWireCaps.d.ts +4 -4
- package/dist/cloudConfigWireCaps.js +241 -85
- package/dist/coreValuePorts.d.ts +11 -7
- package/dist/coreValuePorts.js +5 -8
- package/dist/credentialProvenance.d.ts +28 -0
- package/dist/credentialProvenance.js +76 -0
- package/dist/decideFailureNote.js +3 -1
- package/dist/decideReceipt.js +7 -10
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/deviceExecutorManagementCapability.d.ts +2 -0
- package/dist/deviceExecutorManagementCapability.js +3 -2
- package/dist/displayUntrusted.d.ts +10 -3
- package/dist/displayUntrusted.js +371 -60
- package/dist/engineCapReader.d.ts +8 -2
- package/dist/engineCapReader.js +15 -7
- package/dist/engineCapsCache.d.ts +17 -3
- package/dist/engineCapsCache.js +268 -43
- package/dist/engineDirectory.d.ts +79 -0
- package/dist/engineDirectory.js +186 -0
- package/dist/engineErrorCodes.d.ts +17 -1
- package/dist/engineErrorCodes.js +46 -16
- package/dist/engineNoticeCodes.d.ts +17 -0
- package/dist/engineNoticeCodes.js +54 -1
- package/dist/executionLaneCapability.d.ts +2 -0
- package/dist/executionLaneCapability.js +3 -2
- package/dist/fileHistoryCaptureCapability.d.ts +16 -0
- package/dist/fileHistoryCaptureCapability.js +98 -2
- package/dist/fileHistoryLegNotice.js +4 -0
- package/dist/fleet/bgSubagentRow.d.ts +15 -0
- package/dist/fleet/bgSubagentRow.js +67 -0
- package/dist/fleet/fleetLedger.d.ts +1 -0
- package/dist/fleet/fleetLedger.js +164 -126
- package/dist/fleet/fleetProjection.d.ts +1 -0
- package/dist/fleet/fleetProjection.js +10 -3
- package/dist/fleetTaskDesc.js +4 -17
- package/dist/gateOutcome.d.ts +12 -1
- package/dist/gateOutcome.js +56 -1
- package/dist/gateVocabulary.d.ts +2 -2
- package/dist/gateVocabulary.js +4 -3
- package/dist/generated/engineAskFaceTables.js +1 -1
- package/dist/generated/engineFactTables.d.ts +5 -3
- package/dist/generated/engineFactTables.js +17 -4
- package/dist/generated/engineNoticeTables.js +12 -3
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +7 -0
- package/dist/generated/settingsSchemaFns.d.ts +3 -0
- package/dist/generated/settingsSchemaFns.js +53 -0
- package/dist/generated/toolNameTables.d.ts +1 -1
- package/dist/generated/toolNameTables.js +1 -42
- package/dist/hitl/approvalDecisionNoteAudit.js +2 -2
- package/dist/hitl/approvalEndingCause.d.ts +2 -0
- package/dist/hitl/approvalEndingCause.js +26 -21
- package/dist/hitl/approvalHolds.d.ts +16 -1
- package/dist/hitl/approvalHolds.js +52 -12
- package/dist/hitl/askGateWire.js +1 -0
- package/dist/hitl/askParkRowRouting.js +1 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +13 -10
- package/dist/hitl/decisionConflict.js +4 -5
- package/dist/hitl/decisionRefusal.d.ts +8 -0
- package/dist/hitl/decisionRefusal.js +55 -14
- package/dist/hitl/frameRouter.d.ts +3 -1
- package/dist/hitl/frameRouter.js +58 -39
- package/dist/hitl/gateLedger.d.ts +0 -5
- package/dist/hitl/gateLedger.js +0 -21
- package/dist/hitl/hitlBridge.d.ts +6 -2
- package/dist/hitl/hitlBridge.js +46 -11
- package/dist/hitl/localAllowRule.d.ts +1 -0
- package/dist/hitl/localAllowRule.js +2 -2
- package/dist/hitl/noAllowCause.d.ts +2 -1
- package/dist/hitl/noAllowCause.js +3 -2
- package/dist/hitl/parkResolver.d.ts +1 -0
- package/dist/hitl/parkResolver.js +14 -56
- package/dist/hitl/parkRowBirthWait.d.ts +1 -0
- package/dist/hitl/parkRowBirthWait.js +2 -2
- package/dist/hitl/planReviewWire.d.ts +1 -0
- package/dist/hitl/planReviewWire.js +98 -20
- package/dist/hitl/replayedApproval.d.ts +3 -3
- package/dist/hitl/replayedApproval.js +21 -16
- package/dist/hitl/sessionPolicyDeliverable.d.ts +0 -1
- package/dist/hitl/sessionPolicyDeliverable.js +17 -17
- package/dist/hitl/sessionPolicyWire.d.ts +2 -0
- package/dist/hitl/sessionPolicyWire.js +15 -3
- package/dist/hitl/standingRows.d.ts +19 -0
- package/dist/hitl/standingRows.js +148 -0
- package/dist/hitl/suspendedReopen.js +2 -1
- package/dist/hitl/toolApprovalWire.d.ts +22 -10
- package/dist/hitl/toolApprovalWire.js +286 -47
- package/dist/hookMatcherVerdict.d.ts +1 -9
- package/dist/hookMatcherVerdict.js +21 -61
- package/dist/hooksWireCaps.js +2 -2
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +6 -0
- package/dist/index.d.ts +26 -12
- package/dist/index.js +20 -10
- package/dist/liveModelCatalog.d.ts +13 -0
- package/dist/liveModelCatalog.js +56 -0
- package/dist/mcpProbeCapability.d.ts +2 -4
- package/dist/mcpProbeCapability.js +3 -8
- package/dist/mcpWireCaps.d.ts +1 -0
- package/dist/mcpWireCaps.js +4 -1
- package/dist/memoryComplianceCapability.d.ts +2 -4
- package/dist/memoryComplianceCapability.js +3 -8
- package/dist/memoryOriginCapability.d.ts +2 -4
- package/dist/memoryOriginCapability.js +3 -8
- package/dist/memorySpecWire.js +2 -2
- package/dist/modelIdentityResolvability.d.ts +2 -2
- package/dist/modelIdentityResolvability.js +14 -5
- package/dist/noticePresentation.d.ts +68 -0
- package/dist/noticePresentation.js +247 -0
- package/dist/outputStyleSeatCapability.d.ts +2 -1
- package/dist/outputStyleSeatCapability.js +0 -4
- package/dist/ownKey.d.ts +2 -0
- package/dist/ownKey.js +18 -0
- package/dist/peerFrames.js +13 -9
- package/dist/peerLaneCapability.d.ts +2 -0
- package/dist/peerLaneCapability.js +3 -2
- package/dist/permissionModesCapability.d.ts +2 -4
- package/dist/permissionModesCapability.js +0 -7
- package/dist/permissionRuleIssue.js +0 -3
- package/dist/permissionRulesWriteCapability.d.ts +2 -0
- package/dist/permissionRulesWriteCapability.js +3 -2
- package/dist/permissionsAllowGrantCapability.d.ts +2 -0
- package/dist/permissionsAllowGrantCapability.js +4 -2
- package/dist/permissionsDeclaration.d.ts +2 -0
- package/dist/permissionsDeclaration.js +72 -59
- package/dist/printPermissionOutcome.d.ts +12 -0
- package/dist/printPermissionOutcome.js +50 -0
- package/dist/printToolResultFrame.d.ts +1 -0
- package/dist/printToolResultFrame.js +5 -9
- package/dist/promptBlockedCopy.d.ts +5 -0
- package/dist/promptBlockedCopy.js +35 -0
- package/dist/protocolSegment.d.ts +9 -6
- package/dist/protocolSegment.js +31 -21
- package/dist/providerRejection.d.ts +4 -0
- package/dist/providerRejection.js +75 -14
- package/dist/replayBody.d.ts +12 -0
- package/dist/replayBody.js +25 -0
- package/dist/request/taskRequest.d.ts +1 -4
- package/dist/request/taskRequest.js +74 -19
- package/dist/resumeRefusalCopy.js +9 -25
- package/dist/retryStatus.d.ts +9 -1
- package/dist/retryStatus.js +9 -2
- package/dist/rewindArchiveCapability.d.ts +3 -13
- package/dist/rewindArchiveCapability.js +12 -58
- package/dist/rewindArchiveReading.d.ts +17 -0
- package/dist/rewindArchiveReading.js +55 -0
- package/dist/ruleCompileVerdict.d.ts +9 -1
- package/dist/ruleCompileVerdict.js +29 -4
- package/dist/runTerminal.d.ts +48 -5
- package/dist/runTerminal.js +215 -12
- package/dist/sandboxWire.js +13 -0
- package/dist/sdkWireTransit.d.ts +2 -1
- package/dist/sdkWireTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +2 -4
- package/dist/sealedKeyCapability.js +0 -7
- package/dist/seam.js +4 -2
- package/dist/seatContract.d.ts +76 -11
- package/dist/seatContract.js +222 -27
- package/dist/sessionPolicyCapability.d.ts +2 -0
- package/dist/sessionPolicyCapability.js +3 -2
- package/dist/sessionReadRedactionCapability.d.ts +2 -4
- package/dist/sessionReadRedactionCapability.js +0 -7
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +66 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +2 -1
- package/dist/sessionSyncFileHistoryCapability.js +3 -5
- package/dist/skillToolListsCapability.d.ts +2 -1
- package/dist/skillToolListsCapability.js +3 -5
- package/dist/sqlEngineCapability.d.ts +2 -0
- package/dist/sqlEngineCapability.js +4 -3
- package/dist/steerPriorityCapability.d.ts +2 -1
- package/dist/steerPriorityCapability.js +3 -5
- package/dist/storePostureCapability.d.ts +2 -4
- package/dist/storePostureCapability.js +4 -9
- package/dist/subagent/engineSubagentSteer.js +7 -5
- package/dist/subagentContentStore.js +4 -15
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +13 -9
- package/dist/systemReminderTag.d.ts +1 -0
- package/dist/systemReminderTag.js +8 -0
- package/dist/toolHistoryBadTurn.js +3 -2
- package/dist/toolHistoryMismatch.d.ts +0 -3
- package/dist/toolHistoryMismatch.js +3 -7
- package/dist/toolResult.d.ts +12 -1
- package/dist/toolResult.js +55 -1
- package/dist/toolResultContent.d.ts +2 -0
- package/dist/toolResultContent.js +63 -0
- package/dist/usageAnalytics.js +40 -16
- package/dist/userInvokedSkillsCapability.d.ts +2 -1
- package/dist/userInvokedSkillsCapability.js +3 -5
- package/dist/webSearchBackendCapability.d.ts +2 -0
- package/dist/webSearchBackendCapability.js +3 -2
- package/dist/wireErrorTriage.d.ts +2 -0
- package/dist/wireErrorTriage.js +91 -38
- package/dist/wireFailureShape.d.ts +20 -3
- package/dist/wireFailureShape.js +128 -72
- package/dist/workflowsJournalCapability.d.ts +2 -0
- package/dist/workflowsJournalCapability.js +3 -2
- package/dist/writeProtectionCapability.d.ts +2 -0
- package/dist/writeProtectionCapability.js +3 -2
- package/docs/INTEGRATION-CLIENTS.md +1784 -20
- package/package.json +5 -5
- package/dist/engineRefusedToolName.d.ts +0 -1
- package/dist/engineRefusedToolName.js +0 -8
package/dist/wireFailureShape.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { guardedRead, ownDataField, readOwnDataValue } from './ownKey.js';
|
|
1
2
|
export const THROWN_SLOT_UNREADABLE = Symbol('thrown-slot-unreadable');
|
|
2
3
|
export function readThrownSlot(o, key, own = false) {
|
|
3
4
|
try {
|
|
5
|
+
if (own === 'data') {
|
|
6
|
+
if (o === null || o === undefined)
|
|
7
|
+
return THROWN_SLOT_UNREADABLE;
|
|
8
|
+
return typeof o === 'object' || typeof o === 'function' ? ownDataField(o, key) : undefined;
|
|
9
|
+
}
|
|
4
10
|
if (own && !Object.hasOwn(o, key))
|
|
5
11
|
return undefined;
|
|
6
12
|
return o[key];
|
|
@@ -21,34 +27,95 @@ export function thrownIsInstanceOf(e, cls) {
|
|
|
21
27
|
return false;
|
|
22
28
|
}
|
|
23
29
|
}
|
|
30
|
+
const EXTRA_KEY = 'extra';
|
|
31
|
+
const EXTRA_CHAIN_DEPTH_MAX = 64;
|
|
32
|
+
function extraSlotOf(o) {
|
|
33
|
+
let node = o;
|
|
34
|
+
for (let depth = 0; node !== null; depth++) {
|
|
35
|
+
if (depth > EXTRA_CHAIN_DEPTH_MAX)
|
|
36
|
+
throw new RangeError('prototype chain too deep to read');
|
|
37
|
+
const d = Object.getOwnPropertyDescriptor(node, EXTRA_KEY);
|
|
38
|
+
if (d !== undefined) {
|
|
39
|
+
const isData = Object.hasOwn(d, 'value');
|
|
40
|
+
if (node === o)
|
|
41
|
+
return isData ? { kind: 'own-data', value: d.value } : { kind: 'own-accessor' };
|
|
42
|
+
return !isData && typeof d.get === 'function' && isSdkErrorClassPrototype(node) ? { kind: 'sdk-class' } : { kind: 'none' };
|
|
43
|
+
}
|
|
44
|
+
node = Object.getPrototypeOf(node);
|
|
45
|
+
}
|
|
46
|
+
return { kind: 'none' };
|
|
47
|
+
}
|
|
48
|
+
function isSdkErrorClassPrototype(holder) {
|
|
49
|
+
if (holder === Object.prototype || !isClassPrototype(holder))
|
|
50
|
+
return false;
|
|
51
|
+
let node = Object.getPrototypeOf(holder);
|
|
52
|
+
for (let depth = 0; node !== null; depth++) {
|
|
53
|
+
if (depth > EXTRA_CHAIN_DEPTH_MAX)
|
|
54
|
+
throw new RangeError('prototype chain too deep to read');
|
|
55
|
+
if (isBuiltinErrorPrototype(node))
|
|
56
|
+
return true;
|
|
57
|
+
node = Object.getPrototypeOf(node);
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
function classConstructorOf(node) {
|
|
62
|
+
const ctor = Object.getOwnPropertyDescriptor(node, 'constructor');
|
|
63
|
+
if (ctor === undefined || !Object.hasOwn(ctor, 'value') || typeof ctor.value !== 'function')
|
|
64
|
+
return undefined;
|
|
65
|
+
const fn = ctor.value;
|
|
66
|
+
const p = Object.getOwnPropertyDescriptor(fn, 'prototype');
|
|
67
|
+
return p !== undefined && Object.hasOwn(p, 'value') && p.value === node ? fn : undefined;
|
|
68
|
+
}
|
|
69
|
+
function isClassPrototype(node) {
|
|
70
|
+
return classConstructorOf(node) !== undefined;
|
|
71
|
+
}
|
|
72
|
+
const BUILTIN_ERROR_SOURCE = /^function Error\(\)\s*\{\s*\[native code\]\s*\}$/;
|
|
73
|
+
function isBuiltinErrorPrototype(node) {
|
|
74
|
+
const fn = classConstructorOf(node);
|
|
75
|
+
if (fn === undefined)
|
|
76
|
+
return false;
|
|
77
|
+
const n = Object.getOwnPropertyDescriptor(fn, 'name');
|
|
78
|
+
if (n === undefined || !Object.hasOwn(n, 'value') || n.value !== 'Error')
|
|
79
|
+
return false;
|
|
80
|
+
if (!BUILTIN_ERROR_SOURCE.test(Function.prototype.toString.call(fn)))
|
|
81
|
+
return false;
|
|
82
|
+
return ['message', 'name', 'toString'].every((k) => Object.getOwnPropertyDescriptor(node, k) !== undefined);
|
|
83
|
+
}
|
|
84
|
+
export function readThrownExtra(o) {
|
|
85
|
+
if (o === null || o === undefined || (typeof o !== 'object' && typeof o !== 'function'))
|
|
86
|
+
return { state: 'absent' };
|
|
87
|
+
let slot;
|
|
88
|
+
try {
|
|
89
|
+
const at = extraSlotOf(o);
|
|
90
|
+
if (at.kind === 'own-accessor')
|
|
91
|
+
return { state: 'unreadable' };
|
|
92
|
+
if (at.kind === 'none')
|
|
93
|
+
return { state: 'absent' };
|
|
94
|
+
slot = at.kind === 'own-data' ? at.value : Reflect.get(o, EXTRA_KEY);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return { state: 'unreadable' };
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
if (typeof slot !== 'object' || slot === null || Array.isArray(slot))
|
|
101
|
+
return { state: 'absent' };
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return { state: 'unreadable' };
|
|
105
|
+
}
|
|
106
|
+
return { state: 'object', value: slot };
|
|
107
|
+
}
|
|
24
108
|
function readErrorSlot(obj, key, accept) {
|
|
25
109
|
try {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
top = o[key];
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
top = undefined;
|
|
33
|
-
}
|
|
110
|
+
const topRaw = readThrownSlot(obj, key, 'data');
|
|
111
|
+
const top = topRaw === THROWN_SLOT_UNREADABLE ? undefined : topRaw;
|
|
34
112
|
if (accept(top))
|
|
35
113
|
return top;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
extra = o['extra'];
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
extra = undefined;
|
|
42
|
-
}
|
|
43
|
-
if (typeof extra !== 'object' || extra === null || Array.isArray(extra))
|
|
114
|
+
const reading = readThrownExtra(obj);
|
|
115
|
+
if (reading.state !== 'object')
|
|
44
116
|
return undefined;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
fromExtra = Object.hasOwn(extra, key) ? extra[key] : undefined;
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
fromExtra = undefined;
|
|
51
|
-
}
|
|
117
|
+
const extra = reading.value;
|
|
118
|
+
const fromExtra = guardedRead(() => readOwnDataValue(extra, key));
|
|
52
119
|
return accept(fromExtra) ? fromExtra : undefined;
|
|
53
120
|
}
|
|
54
121
|
catch {
|
|
@@ -98,28 +165,25 @@ export function readErrorStrictStringList(o, key) {
|
|
|
98
165
|
return undefined;
|
|
99
166
|
}
|
|
100
167
|
}
|
|
168
|
+
export const WIRE_FAILURE_UNRENDERABLE_TEXT = 'the call failed with an error this client could not render';
|
|
169
|
+
function userFacingReasonOf(e, ownMessage) {
|
|
170
|
+
if (ownMessage !== undefined)
|
|
171
|
+
return ownMessage;
|
|
172
|
+
if (typeof e === 'string')
|
|
173
|
+
return e !== '' ? e : WIRE_FAILURE_UNRENDERABLE_TEXT;
|
|
174
|
+
if (typeof e === 'number' || typeof e === 'boolean' || typeof e === 'bigint')
|
|
175
|
+
return String(e);
|
|
176
|
+
return WIRE_FAILURE_UNRENDERABLE_TEXT;
|
|
177
|
+
}
|
|
101
178
|
export function wireFailureShapeOf(e) {
|
|
102
179
|
const o = e ?? {};
|
|
103
180
|
const status = readGuarded(o, 'status');
|
|
104
181
|
const errorCode = readGuarded(o, 'errorCode');
|
|
105
182
|
const rawMessage = readGuarded(o, 'message');
|
|
106
183
|
const retryAfterMs = readGuarded(o, 'retryAfterMs');
|
|
107
|
-
|
|
108
|
-
let extraUnreadable =
|
|
109
|
-
|
|
110
|
-
extra = o['extra'];
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
extraUnreadable = true;
|
|
114
|
-
}
|
|
115
|
-
let extraObj;
|
|
116
|
-
try {
|
|
117
|
-
extraObj = typeof extra === 'object' && extra !== null && !Array.isArray(extra) ? extra : undefined;
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
extraObj = undefined;
|
|
121
|
-
extraUnreadable = true;
|
|
122
|
-
}
|
|
184
|
+
const extraReading = readThrownExtra(e);
|
|
185
|
+
let extraUnreadable = extraReading.state === 'unreadable';
|
|
186
|
+
const extraObj = extraReading.state === 'object' ? extraReading.value : undefined;
|
|
123
187
|
let committedPresent = false;
|
|
124
188
|
let committedRaw;
|
|
125
189
|
if (extraObj !== undefined) {
|
|
@@ -156,13 +220,7 @@ export function wireFailureShapeOf(e) {
|
|
|
156
220
|
const bodyVerdict = ownString('verdict');
|
|
157
221
|
const bodyCurrentName = ownString('currentName');
|
|
158
222
|
const ownMessage = typeof rawMessage === 'string' && rawMessage !== '' ? rawMessage : undefined;
|
|
159
|
-
|
|
160
|
-
try {
|
|
161
|
-
message = ownMessage !== undefined ? ownMessage : String(e);
|
|
162
|
-
}
|
|
163
|
-
catch {
|
|
164
|
-
message = WIRE_FAILURE_UNRENDERABLE_TEXT;
|
|
165
|
-
}
|
|
223
|
+
const message = userFacingReasonOf(e, ownMessage);
|
|
166
224
|
const sec = typeof retryAfterMs === 'number' && Number.isFinite(retryAfterMs) && retryAfterMs >= 0
|
|
167
225
|
? Math.ceil(retryAfterMs / 1000)
|
|
168
226
|
: undefined;
|
|
@@ -183,12 +241,10 @@ export function wireFailureShapeOf(e) {
|
|
|
183
241
|
...(bodyVerdict !== undefined ? { bodyVerdict } : {}),
|
|
184
242
|
...(bodyCurrentName !== undefined ? { bodyCurrentName } : {}),
|
|
185
243
|
message,
|
|
186
|
-
...(ownMessage !== undefined ? { ownMessage } : {}),
|
|
187
244
|
};
|
|
188
245
|
}
|
|
189
|
-
export const WIRE_FAILURE_UNRENDERABLE_TEXT = 'the call failed with an error this client could not render';
|
|
190
246
|
export function wireFailureTextsOf(e) {
|
|
191
|
-
const {
|
|
247
|
+
const { message } = wireFailureShapeOf(e);
|
|
192
248
|
let log;
|
|
193
249
|
try {
|
|
194
250
|
log = String(e).slice(0, 300);
|
|
@@ -196,34 +252,34 @@ export function wireFailureTextsOf(e) {
|
|
|
196
252
|
catch {
|
|
197
253
|
log = '<unprintable thrown value>';
|
|
198
254
|
}
|
|
199
|
-
|
|
200
|
-
return { reason: ownMessage, log };
|
|
201
|
-
if (typeof e === 'string')
|
|
202
|
-
return { reason: e !== '' ? e : WIRE_FAILURE_UNRENDERABLE_TEXT, log };
|
|
203
|
-
if (typeof e === 'number' || typeof e === 'boolean' || typeof e === 'bigint')
|
|
204
|
-
return { reason: String(e), log };
|
|
205
|
-
return { reason: WIRE_FAILURE_UNRENDERABLE_TEXT, log };
|
|
255
|
+
return { reason: message, log };
|
|
206
256
|
}
|
|
207
|
-
export function
|
|
208
|
-
const
|
|
209
|
-
let v;
|
|
210
|
-
try {
|
|
211
|
-
v = rec.field;
|
|
212
|
-
}
|
|
213
|
-
catch {
|
|
214
|
-
return undefined;
|
|
215
|
-
}
|
|
216
|
-
return typeof v === 'string' && v !== '' ? v : undefined;
|
|
217
|
-
};
|
|
218
|
-
let extra;
|
|
257
|
+
export function readBlockedBy(o) {
|
|
258
|
+
const judge = (v) => (typeof v === 'string' && v.length > 0 ? { kind: 'named', code: v } : { kind: 'unreadable' });
|
|
219
259
|
try {
|
|
220
|
-
|
|
260
|
+
const top = o['blockedBy'];
|
|
261
|
+
if (top !== undefined)
|
|
262
|
+
return judge(top);
|
|
263
|
+
const reading = readThrownExtra(o);
|
|
264
|
+
if (reading.state === 'unreadable')
|
|
265
|
+
return { kind: 'unreadable' };
|
|
266
|
+
if (reading.state === 'object' && Object.hasOwn(reading.value, 'blockedBy')) {
|
|
267
|
+
return judge(reading.value['blockedBy']);
|
|
268
|
+
}
|
|
269
|
+
return { kind: 'absent' };
|
|
221
270
|
}
|
|
222
271
|
catch {
|
|
223
|
-
|
|
272
|
+
return { kind: 'unreadable' };
|
|
224
273
|
}
|
|
225
|
-
|
|
226
|
-
|
|
274
|
+
}
|
|
275
|
+
export function readRefusalField(o) {
|
|
276
|
+
const str = (rec) => {
|
|
277
|
+
const v = guardedRead(() => readOwnDataValue(rec, 'field'));
|
|
278
|
+
return typeof v === 'string' && v !== '' ? v : undefined;
|
|
279
|
+
};
|
|
280
|
+
const reading = readThrownExtra(o);
|
|
281
|
+
if (reading.state === 'object') {
|
|
282
|
+
const fromExtra = str(reading.value);
|
|
227
283
|
if (fromExtra !== undefined)
|
|
228
284
|
return fromExtra;
|
|
229
285
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
|
-
import { createEngineCapReader } from './engineCapReader.js';
|
|
2
|
+
import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
|
|
3
3
|
import { ownDataField } from './ownKey.js';
|
|
4
4
|
export function projectWorkflowsJournalCapability(caps) {
|
|
5
5
|
try {
|
|
@@ -19,7 +19,6 @@ export function projectWorkflowsJournalCapability(caps) {
|
|
|
19
19
|
const reader = createEngineCapReader({
|
|
20
20
|
name: 'workflowsJournal',
|
|
21
21
|
project: projectWorkflowsJournalCapability,
|
|
22
|
-
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
23
22
|
});
|
|
24
23
|
export function noteEngineCapsForWorkflowsJournal(baseUrl, caps, opts) {
|
|
25
24
|
reader.note(baseUrl, caps, opts);
|
|
@@ -36,6 +35,8 @@ export function workflowsJournalAvailable(reading) {
|
|
|
36
35
|
}
|
|
37
36
|
export function workflowsJournalDoctorDetail(reading) {
|
|
38
37
|
switch (reading.kind) {
|
|
38
|
+
case 'unreadable':
|
|
39
|
+
return unreadableReadingDetail('workflow journal');
|
|
39
40
|
case 'unobserved':
|
|
40
41
|
return 'workflow journal not observed — the engine reports it on /v1/capabilities (workflowsJournal); this process has no usable capabilities reading cached for it (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which)';
|
|
41
42
|
case 'not_reported':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
2
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
3
|
-
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
|
|
4
4
|
import { ownDataField } from './ownKey.js';
|
|
5
5
|
export function projectWriteProtectionCapability(caps) {
|
|
6
6
|
try {
|
|
@@ -65,7 +65,6 @@ export function projectWriteProtectionPosture(wiring) {
|
|
|
65
65
|
const reader = createEngineCapReader({
|
|
66
66
|
name: 'writeProtection',
|
|
67
67
|
project: projectWriteProtectionCapability,
|
|
68
|
-
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
69
68
|
});
|
|
70
69
|
export function noteEngineCapsForWriteProtection(baseUrl, caps, opts) {
|
|
71
70
|
reader.note(baseUrl, caps, opts);
|
|
@@ -76,6 +75,8 @@ export function observedWriteProtection(baseUrl = engineWireTarget()?.baseUrl) {
|
|
|
76
75
|
const WP_DETAIL_MAX = 40;
|
|
77
76
|
export function writeProtectionDoctorDetail(reading) {
|
|
78
77
|
switch (reading.kind) {
|
|
78
|
+
case 'unreadable':
|
|
79
|
+
return unreadableReadingDetail();
|
|
79
80
|
case 'unobserved':
|
|
80
81
|
return ('not observed — the engine reports it on /v1/capabilities; this process has no usable ' +
|
|
81
82
|
'capabilities reading cached for it (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which)');
|