@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.
Files changed (233) hide show
  1. package/CHANGELOG.md +269 -0
  2. package/README.md +61 -31
  3. package/dist/adapt/arms.js +7 -1
  4. package/dist/adapt/toolCards.d.ts +1 -0
  5. package/dist/adapt/toolCards.js +16 -3
  6. package/dist/adapt/wireShapes.js +2 -16
  7. package/dist/adapter/activeRunSelfHeal.d.ts +4 -2
  8. package/dist/adapter/activeRunSelfHeal.js +32 -6
  9. package/dist/adapter/downstream/eventToSdkMessage.js +11 -3
  10. package/dist/adapter/downstream/terminalToSdkResult.js +14 -11
  11. package/dist/adapter/runStream.js +30 -47
  12. package/dist/agentSession/backgroundView.js +2 -15
  13. package/dist/agentSession/engineAgentRegistryRead.js +5 -4
  14. package/dist/agentSession/engineSessionBackgroundStop.js +22 -15
  15. package/dist/agentsWireCaps.d.ts +1 -1
  16. package/dist/agentsWireCaps.js +29 -12
  17. package/dist/approvalDecidedByCapability.d.ts +2 -0
  18. package/dist/approvalDecidedByCapability.js +0 -1
  19. package/dist/approvalsStreamLiveCapability.d.ts +2 -0
  20. package/dist/approvalsStreamLiveCapability.js +3 -2
  21. package/dist/attachmentSeatCapability.d.ts +2 -0
  22. package/dist/attachmentSeatCapability.js +0 -1
  23. package/dist/callerCwdCapability.d.ts +2 -4
  24. package/dist/callerCwdCapability.js +0 -7
  25. package/dist/centerWiringCapability.d.ts +2 -4
  26. package/dist/centerWiringCapability.js +4 -9
  27. package/dist/classifierVerdictWire.js +4 -16
  28. package/dist/clientSlice.js +1 -1
  29. package/dist/cloudConfigWireCaps.d.ts +4 -4
  30. package/dist/cloudConfigWireCaps.js +241 -85
  31. package/dist/coreValuePorts.d.ts +11 -7
  32. package/dist/coreValuePorts.js +5 -8
  33. package/dist/credentialProvenance.d.ts +28 -0
  34. package/dist/credentialProvenance.js +76 -0
  35. package/dist/decideFailureNote.js +3 -1
  36. package/dist/decideReceipt.js +7 -10
  37. package/dist/declared/supportFloorDeclared.js +3 -3
  38. package/dist/deviceExecutorManagementCapability.d.ts +2 -0
  39. package/dist/deviceExecutorManagementCapability.js +3 -2
  40. package/dist/displayUntrusted.d.ts +10 -3
  41. package/dist/displayUntrusted.js +371 -60
  42. package/dist/engineCapReader.d.ts +8 -2
  43. package/dist/engineCapReader.js +15 -7
  44. package/dist/engineCapsCache.d.ts +17 -3
  45. package/dist/engineCapsCache.js +268 -43
  46. package/dist/engineDirectory.d.ts +79 -0
  47. package/dist/engineDirectory.js +186 -0
  48. package/dist/engineErrorCodes.d.ts +17 -1
  49. package/dist/engineErrorCodes.js +46 -16
  50. package/dist/engineNoticeCodes.d.ts +17 -0
  51. package/dist/engineNoticeCodes.js +54 -1
  52. package/dist/executionLaneCapability.d.ts +2 -0
  53. package/dist/executionLaneCapability.js +3 -2
  54. package/dist/fileHistoryCaptureCapability.d.ts +16 -0
  55. package/dist/fileHistoryCaptureCapability.js +98 -2
  56. package/dist/fileHistoryLegNotice.js +4 -0
  57. package/dist/fleet/bgSubagentRow.d.ts +15 -0
  58. package/dist/fleet/bgSubagentRow.js +67 -0
  59. package/dist/fleet/fleetLedger.d.ts +1 -0
  60. package/dist/fleet/fleetLedger.js +164 -126
  61. package/dist/fleet/fleetProjection.d.ts +1 -0
  62. package/dist/fleet/fleetProjection.js +10 -3
  63. package/dist/fleetTaskDesc.js +4 -17
  64. package/dist/gateOutcome.d.ts +12 -1
  65. package/dist/gateOutcome.js +56 -1
  66. package/dist/gateVocabulary.d.ts +2 -2
  67. package/dist/gateVocabulary.js +4 -3
  68. package/dist/generated/engineAskFaceTables.js +1 -1
  69. package/dist/generated/engineFactTables.d.ts +5 -3
  70. package/dist/generated/engineFactTables.js +17 -4
  71. package/dist/generated/engineNoticeTables.js +12 -3
  72. package/dist/generated/sdkFactTables.d.ts +2 -0
  73. package/dist/generated/sdkFactTables.js +7 -0
  74. package/dist/generated/settingsSchemaFns.d.ts +3 -0
  75. package/dist/generated/settingsSchemaFns.js +53 -0
  76. package/dist/generated/toolNameTables.d.ts +1 -1
  77. package/dist/generated/toolNameTables.js +1 -42
  78. package/dist/hitl/approvalDecisionNoteAudit.js +2 -2
  79. package/dist/hitl/approvalEndingCause.d.ts +2 -0
  80. package/dist/hitl/approvalEndingCause.js +26 -21
  81. package/dist/hitl/approvalHolds.d.ts +16 -1
  82. package/dist/hitl/approvalHolds.js +52 -12
  83. package/dist/hitl/askGateWire.js +1 -0
  84. package/dist/hitl/askParkRowRouting.js +1 -1
  85. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  86. package/dist/hitl/automaticAnswerVerdict.js +13 -10
  87. package/dist/hitl/decisionConflict.js +4 -5
  88. package/dist/hitl/decisionRefusal.d.ts +8 -0
  89. package/dist/hitl/decisionRefusal.js +55 -14
  90. package/dist/hitl/frameRouter.d.ts +3 -1
  91. package/dist/hitl/frameRouter.js +58 -39
  92. package/dist/hitl/gateLedger.d.ts +0 -5
  93. package/dist/hitl/gateLedger.js +0 -21
  94. package/dist/hitl/hitlBridge.d.ts +6 -2
  95. package/dist/hitl/hitlBridge.js +46 -11
  96. package/dist/hitl/localAllowRule.d.ts +1 -0
  97. package/dist/hitl/localAllowRule.js +2 -2
  98. package/dist/hitl/noAllowCause.d.ts +2 -1
  99. package/dist/hitl/noAllowCause.js +3 -2
  100. package/dist/hitl/parkResolver.d.ts +1 -0
  101. package/dist/hitl/parkResolver.js +14 -56
  102. package/dist/hitl/parkRowBirthWait.d.ts +1 -0
  103. package/dist/hitl/parkRowBirthWait.js +2 -2
  104. package/dist/hitl/planReviewWire.d.ts +1 -0
  105. package/dist/hitl/planReviewWire.js +98 -20
  106. package/dist/hitl/replayedApproval.d.ts +3 -3
  107. package/dist/hitl/replayedApproval.js +21 -16
  108. package/dist/hitl/sessionPolicyDeliverable.d.ts +0 -1
  109. package/dist/hitl/sessionPolicyDeliverable.js +17 -17
  110. package/dist/hitl/sessionPolicyWire.d.ts +2 -0
  111. package/dist/hitl/sessionPolicyWire.js +15 -3
  112. package/dist/hitl/standingRows.d.ts +19 -0
  113. package/dist/hitl/standingRows.js +148 -0
  114. package/dist/hitl/suspendedReopen.js +2 -1
  115. package/dist/hitl/toolApprovalWire.d.ts +22 -10
  116. package/dist/hitl/toolApprovalWire.js +286 -47
  117. package/dist/hookMatcherVerdict.d.ts +1 -9
  118. package/dist/hookMatcherVerdict.js +21 -61
  119. package/dist/hooksWireCaps.js +2 -2
  120. package/dist/hostCallbackGuard.d.ts +1 -0
  121. package/dist/hostCallbackGuard.js +6 -0
  122. package/dist/index.d.ts +26 -12
  123. package/dist/index.js +20 -10
  124. package/dist/liveModelCatalog.d.ts +13 -0
  125. package/dist/liveModelCatalog.js +56 -0
  126. package/dist/mcpProbeCapability.d.ts +2 -4
  127. package/dist/mcpProbeCapability.js +3 -8
  128. package/dist/mcpWireCaps.d.ts +1 -0
  129. package/dist/mcpWireCaps.js +4 -1
  130. package/dist/memoryComplianceCapability.d.ts +2 -4
  131. package/dist/memoryComplianceCapability.js +3 -8
  132. package/dist/memoryOriginCapability.d.ts +2 -4
  133. package/dist/memoryOriginCapability.js +3 -8
  134. package/dist/memorySpecWire.js +2 -2
  135. package/dist/modelIdentityResolvability.d.ts +2 -2
  136. package/dist/modelIdentityResolvability.js +14 -5
  137. package/dist/noticePresentation.d.ts +68 -0
  138. package/dist/noticePresentation.js +247 -0
  139. package/dist/outputStyleSeatCapability.d.ts +2 -1
  140. package/dist/outputStyleSeatCapability.js +0 -4
  141. package/dist/ownKey.d.ts +2 -0
  142. package/dist/ownKey.js +18 -0
  143. package/dist/peerFrames.js +13 -9
  144. package/dist/peerLaneCapability.d.ts +2 -0
  145. package/dist/peerLaneCapability.js +3 -2
  146. package/dist/permissionModesCapability.d.ts +2 -4
  147. package/dist/permissionModesCapability.js +0 -7
  148. package/dist/permissionRuleIssue.js +0 -3
  149. package/dist/permissionRulesWriteCapability.d.ts +2 -0
  150. package/dist/permissionRulesWriteCapability.js +3 -2
  151. package/dist/permissionsAllowGrantCapability.d.ts +2 -0
  152. package/dist/permissionsAllowGrantCapability.js +4 -2
  153. package/dist/permissionsDeclaration.d.ts +2 -0
  154. package/dist/permissionsDeclaration.js +72 -59
  155. package/dist/printPermissionOutcome.d.ts +12 -0
  156. package/dist/printPermissionOutcome.js +50 -0
  157. package/dist/printToolResultFrame.d.ts +1 -0
  158. package/dist/printToolResultFrame.js +5 -9
  159. package/dist/promptBlockedCopy.d.ts +5 -0
  160. package/dist/promptBlockedCopy.js +35 -0
  161. package/dist/protocolSegment.d.ts +9 -6
  162. package/dist/protocolSegment.js +31 -21
  163. package/dist/providerRejection.d.ts +4 -0
  164. package/dist/providerRejection.js +75 -14
  165. package/dist/replayBody.d.ts +12 -0
  166. package/dist/replayBody.js +25 -0
  167. package/dist/request/taskRequest.d.ts +1 -4
  168. package/dist/request/taskRequest.js +74 -19
  169. package/dist/resumeRefusalCopy.js +9 -25
  170. package/dist/retryStatus.d.ts +9 -1
  171. package/dist/retryStatus.js +9 -2
  172. package/dist/rewindArchiveCapability.d.ts +3 -13
  173. package/dist/rewindArchiveCapability.js +12 -58
  174. package/dist/rewindArchiveReading.d.ts +17 -0
  175. package/dist/rewindArchiveReading.js +55 -0
  176. package/dist/ruleCompileVerdict.d.ts +9 -1
  177. package/dist/ruleCompileVerdict.js +29 -4
  178. package/dist/runTerminal.d.ts +48 -5
  179. package/dist/runTerminal.js +215 -12
  180. package/dist/sandboxWire.js +13 -0
  181. package/dist/sdkWireTransit.d.ts +2 -1
  182. package/dist/sdkWireTransit.js +1 -0
  183. package/dist/sealedKeyCapability.d.ts +2 -4
  184. package/dist/sealedKeyCapability.js +0 -7
  185. package/dist/seam.js +4 -2
  186. package/dist/seatContract.d.ts +76 -11
  187. package/dist/seatContract.js +222 -27
  188. package/dist/sessionPolicyCapability.d.ts +2 -0
  189. package/dist/sessionPolicyCapability.js +3 -2
  190. package/dist/sessionReadRedactionCapability.d.ts +2 -4
  191. package/dist/sessionReadRedactionCapability.js +0 -7
  192. package/dist/sessionSyncFileHistory.d.ts +4 -0
  193. package/dist/sessionSyncFileHistory.js +66 -0
  194. package/dist/sessionSyncFileHistoryCapability.d.ts +2 -1
  195. package/dist/sessionSyncFileHistoryCapability.js +3 -5
  196. package/dist/skillToolListsCapability.d.ts +2 -1
  197. package/dist/skillToolListsCapability.js +3 -5
  198. package/dist/sqlEngineCapability.d.ts +2 -0
  199. package/dist/sqlEngineCapability.js +4 -3
  200. package/dist/steerPriorityCapability.d.ts +2 -1
  201. package/dist/steerPriorityCapability.js +3 -5
  202. package/dist/storePostureCapability.d.ts +2 -4
  203. package/dist/storePostureCapability.js +4 -9
  204. package/dist/subagent/engineSubagentSteer.js +7 -5
  205. package/dist/subagentContentStore.js +4 -15
  206. package/dist/supportFloor.d.ts +1 -0
  207. package/dist/supportFloor.js +13 -9
  208. package/dist/systemReminderTag.d.ts +1 -0
  209. package/dist/systemReminderTag.js +8 -0
  210. package/dist/toolHistoryBadTurn.js +3 -2
  211. package/dist/toolHistoryMismatch.d.ts +0 -3
  212. package/dist/toolHistoryMismatch.js +3 -7
  213. package/dist/toolResult.d.ts +12 -1
  214. package/dist/toolResult.js +55 -1
  215. package/dist/toolResultContent.d.ts +2 -0
  216. package/dist/toolResultContent.js +63 -0
  217. package/dist/usageAnalytics.js +40 -16
  218. package/dist/userInvokedSkillsCapability.d.ts +2 -1
  219. package/dist/userInvokedSkillsCapability.js +3 -5
  220. package/dist/webSearchBackendCapability.d.ts +2 -0
  221. package/dist/webSearchBackendCapability.js +3 -2
  222. package/dist/wireErrorTriage.d.ts +2 -0
  223. package/dist/wireErrorTriage.js +91 -38
  224. package/dist/wireFailureShape.d.ts +20 -3
  225. package/dist/wireFailureShape.js +128 -72
  226. package/dist/workflowsJournalCapability.d.ts +2 -0
  227. package/dist/workflowsJournalCapability.js +3 -2
  228. package/dist/writeProtectionCapability.d.ts +2 -0
  229. package/dist/writeProtectionCapability.js +3 -2
  230. package/docs/INTEGRATION-CLIENTS.md +1784 -20
  231. package/package.json +5 -5
  232. package/dist/engineRefusedToolName.d.ts +0 -1
  233. package/dist/engineRefusedToolName.js +0 -8
@@ -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 o = obj;
27
- let top;
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
- let extra;
37
- try {
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
- let fromExtra;
46
- try {
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
- let extra;
108
- let extraUnreadable = false;
109
- try {
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
- let message;
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 { ownMessage } = wireFailureShapeOf(e);
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
- if (ownMessage !== undefined)
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 readRefusalField(o) {
208
- const str = (rec) => {
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
- extra = o.extra;
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
- extra = undefined;
272
+ return { kind: 'unreadable' };
224
273
  }
225
- if (typeof extra === 'object' && extra !== null && !Array.isArray(extra)) {
226
- const fromExtra = str(extra);
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,7 @@
1
1
  export type WorkflowsJournalReading = {
2
2
  kind: 'unobserved';
3
+ } | {
4
+ kind: 'unreadable';
3
5
  } | {
4
6
  kind: 'not_reported';
5
7
  } | {
@@ -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':
@@ -3,6 +3,8 @@ export interface WriteProtectionCapabilityView extends Pick<WriteProtectionCapab
3
3
  }
4
4
  export type WriteProtectionReading = {
5
5
  kind: 'unobserved';
6
+ } | {
7
+ kind: 'unreadable';
6
8
  } | {
7
9
  kind: 'not_reported';
8
10
  } | {
@@ -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)');