@sema-agent/client-core 0.97.0 → 0.98.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 (281) hide show
  1. package/CHANGELOG.md +429 -0
  2. package/README.md +74 -36
  3. package/dist/adapt/arms.d.ts +1 -0
  4. package/dist/adapt/arms.js +128 -34
  5. package/dist/adapt/ids.d.ts +12 -1
  6. package/dist/adapt/ids.js +59 -8
  7. package/dist/adapt/instanceLedger.d.ts +50 -0
  8. package/dist/adapt/instanceLedger.js +147 -0
  9. package/dist/adapt/textStream.d.ts +1 -0
  10. package/dist/adapt/textStream.js +24 -7
  11. package/dist/adapt/toolCards.d.ts +27 -5
  12. package/dist/adapt/toolCards.js +39 -6
  13. package/dist/adapt/wireShapes.js +6 -2
  14. package/dist/adapt.d.ts +2 -0
  15. package/dist/adapt.js +8 -3
  16. package/dist/adapter/activeRunSelfHeal.d.ts +5 -0
  17. package/dist/adapter/activeRunSelfHeal.js +51 -28
  18. package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
  19. package/dist/adapter/downstream/eventToSdkMessage.js +27 -34
  20. package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
  21. package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
  22. package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
  23. package/dist/adapter/runStream.js +29 -13
  24. package/dist/adapter/types.d.ts +4 -4
  25. package/dist/agentSession/backgroundView.js +2 -1
  26. package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
  27. package/dist/agentSession/engineAgentRegistryRead.js +12 -13
  28. package/dist/agentsWireCaps.d.ts +8 -6
  29. package/dist/agentsWireCaps.js +177 -162
  30. package/dist/approvalDecidedByCapability.d.ts +0 -4
  31. package/dist/approvalDecidedByCapability.js +0 -6
  32. package/dist/approvalsStreamLiveCapability.d.ts +0 -4
  33. package/dist/approvalsStreamLiveCapability.js +0 -6
  34. package/dist/assistantInbox.d.ts +34 -0
  35. package/dist/assistantInbox.js +118 -0
  36. package/dist/centerWiringCapability.js +9 -1
  37. package/dist/clientSlice.d.ts +0 -9
  38. package/dist/clientSlice.js +0 -3
  39. package/dist/cloudConfigWireCaps.d.ts +4 -2
  40. package/dist/cloudConfigWireCaps.js +81 -61
  41. package/dist/compensations.js +1 -1
  42. package/dist/connectorStatus.d.ts +21 -0
  43. package/dist/connectorStatus.js +112 -0
  44. package/dist/controlRouter.d.ts +14 -1
  45. package/dist/controlRouter.js +68 -17
  46. package/dist/coreValuePorts.d.ts +3 -3
  47. package/dist/decideReceipt.d.ts +2 -2
  48. package/dist/decideReceipt.js +5 -2
  49. package/dist/declared/supportFloorDeclared.js +3 -3
  50. package/dist/deviceExecutorManagementCapability.d.ts +0 -4
  51. package/dist/deviceExecutorManagementCapability.js +0 -6
  52. package/dist/deviceRebind.d.ts +49 -1
  53. package/dist/deviceRebind.js +221 -3
  54. package/dist/displayUntrusted.d.ts +1 -0
  55. package/dist/displayUntrusted.js +250 -76
  56. package/dist/engineAgentAbsence.d.ts +1 -1
  57. package/dist/engineAgentPanelStore.d.ts +5 -4
  58. package/dist/engineAgentPanelStore.js +3 -12
  59. package/dist/engineCapReader.d.ts +0 -4
  60. package/dist/engineCapReader.js +1 -5
  61. package/dist/engineCapsCache.d.ts +4 -0
  62. package/dist/engineCapsCache.js +17 -12
  63. package/dist/engineClosedSets.d.ts +1 -0
  64. package/dist/engineClosedSets.js +4 -1
  65. package/dist/engineErrorCodes.d.ts +9 -2
  66. package/dist/engineErrorCodes.js +9 -1
  67. package/dist/engineIdentity.d.ts +1 -0
  68. package/dist/engineIdentity.js +8 -0
  69. package/dist/engineRowRef.d.ts +28 -0
  70. package/dist/engineRowRef.js +111 -0
  71. package/dist/engineSessionMessages.d.ts +67 -0
  72. package/dist/engineSessionMessages.js +364 -0
  73. package/dist/engineToolDirectory.d.ts +18 -0
  74. package/dist/engineToolDirectory.js +85 -0
  75. package/dist/engineUrl.d.ts +18 -0
  76. package/dist/engineUrl.js +52 -0
  77. package/dist/env/uiLanguage.d.ts +9 -0
  78. package/dist/env/uiLanguage.js +35 -0
  79. package/dist/eventLeg.d.ts +92 -0
  80. package/dist/eventLeg.js +285 -0
  81. package/dist/executionLaneCapability.d.ts +0 -4
  82. package/dist/executionLaneCapability.js +3 -16
  83. package/dist/fileHistoryCaptureCapability.d.ts +0 -4
  84. package/dist/fileHistoryCaptureCapability.js +5 -7
  85. package/dist/fleet/fleetLedger.d.ts +0 -3
  86. package/dist/fleet/fleetLedger.js +21 -36
  87. package/dist/fleet/fleetProjection.d.ts +2 -2
  88. package/dist/fleet/fleetProjection.js +10 -8
  89. package/dist/frameBinding.d.ts +5 -0
  90. package/dist/frameBinding.js +23 -0
  91. package/dist/gateFailureCodes.d.ts +2 -0
  92. package/dist/gateFailureCodes.js +15 -0
  93. package/dist/gateOutcome.d.ts +3 -1
  94. package/dist/gateOutcome.js +25 -6
  95. package/dist/gateVocabulary.d.ts +5 -0
  96. package/dist/gateVocabulary.js +64 -2
  97. package/dist/generated/engineAskFaceTables.js +2 -2
  98. package/dist/generated/engineFactTables.d.ts +6 -3
  99. package/dist/generated/engineFactTables.js +22 -4
  100. package/dist/generated/engineNoticeTables.js +9 -0
  101. package/dist/generated/toolNameTables.d.ts +1 -0
  102. package/dist/generated/toolNameTables.js +1 -0
  103. package/dist/hitl/allowRuleShadow.d.ts +6 -1
  104. package/dist/hitl/allowRuleShadow.js +21 -17
  105. package/dist/hitl/approvalCardReading.d.ts +15 -0
  106. package/dist/hitl/approvalCardReading.js +154 -0
  107. package/dist/hitl/approvalCardReasons.d.ts +13 -0
  108. package/dist/hitl/approvalCardReasons.js +120 -0
  109. package/dist/hitl/approvalHolds.d.ts +47 -15
  110. package/dist/hitl/approvalHolds.js +134 -28
  111. package/dist/hitl/approvalResolution.d.ts +51 -26
  112. package/dist/hitl/approvalResolution.js +86 -122
  113. package/dist/hitl/approvalsFeed.js +6 -18
  114. package/dist/hitl/askClassPair.d.ts +2 -0
  115. package/dist/hitl/askClassPair.js +1 -0
  116. package/dist/hitl/askGateWire.d.ts +20 -2
  117. package/dist/hitl/askGateWire.js +49 -1
  118. package/dist/hitl/askParkRowRouting.d.ts +5 -0
  119. package/dist/hitl/askParkRowRouting.js +32 -1
  120. package/dist/hitl/askSettlementLine.d.ts +18 -0
  121. package/dist/hitl/askSettlementLine.js +79 -0
  122. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  123. package/dist/hitl/automaticAnswerVerdict.js +21 -5
  124. package/dist/hitl/crashConverged.d.ts +11 -20
  125. package/dist/hitl/crashConverged.js +56 -0
  126. package/dist/hitl/crashConvergedNotice.d.ts +3 -1
  127. package/dist/hitl/crashConvergedNotice.js +48 -11
  128. package/dist/hitl/decisionConflict.js +3 -10
  129. package/dist/hitl/decisionRefusal.d.ts +40 -1
  130. package/dist/hitl/decisionRefusal.js +199 -42
  131. package/dist/hitl/frameRouter.d.ts +5 -2
  132. package/dist/hitl/frameRouter.js +20 -16
  133. package/dist/hitl/gateLedger.d.ts +2 -0
  134. package/dist/hitl/gateLedger.js +50 -13
  135. package/dist/hitl/hitlBridge.d.ts +1 -2
  136. package/dist/hitl/hitlBridge.js +10 -7
  137. package/dist/hitl/livePendingAsk.d.ts +3 -3
  138. package/dist/hitl/livePendingAsk.js +7 -18
  139. package/dist/hitl/parkResolver.d.ts +2 -24
  140. package/dist/hitl/parkResolver.js +61 -97
  141. package/dist/hitl/persistedRulesWire.d.ts +24 -0
  142. package/dist/hitl/persistedRulesWire.js +122 -2
  143. package/dist/hitl/planReviewWire.d.ts +26 -13
  144. package/dist/hitl/planReviewWire.js +112 -78
  145. package/dist/hitl/refusedToolNameProse.d.ts +0 -1
  146. package/dist/hitl/refusedToolNameProse.js +0 -3
  147. package/dist/hitl/replayedApproval.d.ts +4 -3
  148. package/dist/hitl/replayedApproval.js +7 -4
  149. package/dist/hitl/sessionPolicyDeliverable.js +2 -4
  150. package/dist/hitl/sessionPolicyWire.d.ts +32 -20
  151. package/dist/hitl/sessionPolicyWire.js +162 -52
  152. package/dist/hitl/standingRows.d.ts +20 -2
  153. package/dist/hitl/standingRows.js +69 -8
  154. package/dist/hitl/toolApprovalWire.d.ts +87 -152
  155. package/dist/hitl/toolApprovalWire.js +591 -380
  156. package/dist/hookMatcherVerdict.d.ts +6 -1
  157. package/dist/hookMatcherVerdict.js +14 -7
  158. package/dist/hooksWireCaps.d.ts +2 -2
  159. package/dist/hooksWireCaps.js +59 -55
  160. package/dist/i18n/messages.en.d.ts +121 -0
  161. package/dist/i18n/messages.en.js +119 -0
  162. package/dist/i18n/messages.zh.d.ts +3 -0
  163. package/dist/i18n/messages.zh.js +120 -0
  164. package/dist/i18n/translate.d.ts +25 -0
  165. package/dist/i18n/translate.js +127 -0
  166. package/dist/index.d.ts +53 -18
  167. package/dist/index.js +38 -10
  168. package/dist/inheritEnvCapability.d.ts +31 -0
  169. package/dist/inheritEnvCapability.js +104 -0
  170. package/dist/liveModelCatalog.d.ts +1 -2
  171. package/dist/liveModelCatalog.js +2 -6
  172. package/dist/liveQuestionStore.d.ts +2 -21
  173. package/dist/mcpLiveness.d.ts +2 -1
  174. package/dist/mcpProbeWire.d.ts +6 -1
  175. package/dist/mcpProbeWire.js +1 -1
  176. package/dist/mcpWireCaps.d.ts +13 -2
  177. package/dist/mcpWireCaps.js +48 -0
  178. package/dist/memoryEntriesWire.d.ts +4 -9
  179. package/dist/model/modelSupplyRules.d.ts +0 -2
  180. package/dist/model/modelSupplyRules.js +3 -12
  181. package/dist/model/modelsPolicy.d.ts +0 -5
  182. package/dist/model/modelsPolicy.js +6 -36
  183. package/dist/model/subagentModelWord.d.ts +31 -0
  184. package/dist/model/subagentModelWord.js +261 -0
  185. package/dist/notifications.d.ts +6 -0
  186. package/dist/notifications.js +71 -23
  187. package/dist/outputStyleSeatCapability.d.ts +0 -3
  188. package/dist/outputStyleSeatCapability.js +0 -3
  189. package/dist/ownKey.d.ts +15 -0
  190. package/dist/ownKey.js +60 -3
  191. package/dist/panelReduce.d.ts +15 -9
  192. package/dist/panelReduce.js +680 -549
  193. package/dist/panelStateHolder.d.ts +3 -7
  194. package/dist/panelStateHolder.js +14 -130
  195. package/dist/peerLaneCapability.d.ts +0 -4
  196. package/dist/peerLaneCapability.js +0 -6
  197. package/dist/permissionRulesWriteCapability.d.ts +0 -4
  198. package/dist/permissionRulesWriteCapability.js +0 -6
  199. package/dist/permissionWireCaps.d.ts +2 -2
  200. package/dist/permissionWireCaps.js +2 -0
  201. package/dist/permissionsAllowGrantCapability.d.ts +0 -4
  202. package/dist/permissionsAllowGrantCapability.js +0 -6
  203. package/dist/permissionsDeclaration.d.ts +0 -11
  204. package/dist/permissionsDeclaration.js +60 -53
  205. package/dist/pluginHooksWire.d.ts +1 -1
  206. package/dist/pluginHooksWire.js +3 -6
  207. package/dist/preemptWire.d.ts +44 -0
  208. package/dist/preemptWire.js +83 -0
  209. package/dist/printToolResultFrame.js +15 -4
  210. package/dist/replayBody.d.ts +3 -0
  211. package/dist/replayBody.js +14 -0
  212. package/dist/request/taskRequest.d.ts +0 -1
  213. package/dist/request/taskRequest.js +0 -3
  214. package/dist/resumeRefusalCopy.d.ts +2 -1
  215. package/dist/resumeRefusalCopy.js +38 -2
  216. package/dist/retryStatus.d.ts +8 -0
  217. package/dist/retryStatus.js +106 -1
  218. package/dist/rewindArchiveCapability.d.ts +0 -4
  219. package/dist/rewindArchiveCapability.js +2 -10
  220. package/dist/rewindArchiveReading.d.ts +0 -1
  221. package/dist/rewindArchiveReading.js +0 -3
  222. package/dist/runCancelContext.d.ts +2 -1
  223. package/dist/runCancelContext.js +4 -2
  224. package/dist/runReattachPolicy.d.ts +31 -0
  225. package/dist/runReattachPolicy.js +46 -0
  226. package/dist/runTerminal.d.ts +3 -6
  227. package/dist/runTerminal.js +8 -9
  228. package/dist/sandboxWire.d.ts +3 -1
  229. package/dist/sandboxWire.js +76 -27
  230. package/dist/scenarioWire.js +1 -1
  231. package/dist/seam.d.ts +24 -2
  232. package/dist/seam.js +15 -3
  233. package/dist/seatContract.d.ts +53 -10
  234. package/dist/seatContract.js +132 -81
  235. package/dist/sessionPolicyCapability.d.ts +0 -4
  236. package/dist/sessionPolicyCapability.js +0 -6
  237. package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
  238. package/dist/sessionSyncFileHistoryCapability.js +0 -3
  239. package/dist/skillToolListsCapability.d.ts +0 -3
  240. package/dist/skillToolListsCapability.js +0 -3
  241. package/dist/sqlEngineCapability.d.ts +0 -4
  242. package/dist/sqlEngineCapability.js +0 -6
  243. package/dist/steerPriorityCapability.d.ts +0 -3
  244. package/dist/steerPriorityCapability.js +0 -3
  245. package/dist/streamDrainingLegs.d.ts +4 -0
  246. package/dist/streamDrainingLegs.js +6 -1
  247. package/dist/subagent/engineCompactWire.d.ts +0 -1
  248. package/dist/subagent/engineCompactWire.js +7 -5
  249. package/dist/subagent/engineTaskHandleWire.js +4 -7
  250. package/dist/subagentContentStore.js +1 -11
  251. package/dist/submitReopen.d.ts +24 -0
  252. package/dist/submitReopen.js +75 -0
  253. package/dist/terminalStatuses.d.ts +3 -0
  254. package/dist/terminalStatuses.js +10 -2
  255. package/dist/toolResult.d.ts +10 -1
  256. package/dist/toolResult.js +34 -6
  257. package/dist/toolRoster.d.ts +0 -2
  258. package/dist/toolRoster.js +0 -2
  259. package/dist/turnFailurePresentation.d.ts +28 -0
  260. package/dist/turnFailurePresentation.js +205 -0
  261. package/dist/userInvokedSkillsCapability.d.ts +0 -3
  262. package/dist/userInvokedSkillsCapability.js +0 -3
  263. package/dist/webSearchBackendCapability.d.ts +0 -4
  264. package/dist/webSearchBackendCapability.js +0 -6
  265. package/dist/wireErrorTriage.js +5 -24
  266. package/dist/wireFailureShape.d.ts +62 -5
  267. package/dist/wireFailureShape.js +105 -5
  268. package/dist/wireRefusalCopy.d.ts +12 -2
  269. package/dist/wireRefusalCopy.js +50 -52
  270. package/dist/workflowsJournalCapability.d.ts +0 -4
  271. package/dist/workflowsJournalCapability.js +0 -6
  272. package/dist/writeProtectionCapability.d.ts +0 -4
  273. package/dist/writeProtectionCapability.js +0 -6
  274. package/docs/INTEGRATION-CLIENTS.md +1305 -46
  275. package/package.json +5 -4
  276. package/dist/attachmentSeatCapability.d.ts +0 -12
  277. package/dist/attachmentSeatCapability.js +0 -23
  278. package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
  279. package/dist/hitl/approvalOutcomeNote.js +0 -29
  280. package/dist/sessionReadRedactionCapability.d.ts +0 -13
  281. package/dist/sessionReadRedactionCapability.js +0 -35
@@ -0,0 +1,23 @@
1
+ const frameBindings = new WeakMap();
2
+ export function registerFrameBinding(frame, binding) {
3
+ if (typeof frame !== 'object' || frame === null)
4
+ return;
5
+ if (binding.taskId === undefined && binding.sessionId === undefined)
6
+ return;
7
+ if (frameBindings.has(frame))
8
+ return;
9
+ frameBindings.set(frame, binding);
10
+ }
11
+ export function frameBindingOf(frame) {
12
+ if (typeof frame !== 'object' || frame === null)
13
+ return undefined;
14
+ return frameBindings.get(frame);
15
+ }
16
+ export function inheritFrameBinding(from, to) {
17
+ if (typeof from !== 'object' || from === null || typeof to !== 'object' || to === null || from === to)
18
+ return to;
19
+ const binding = frameBindings.get(from);
20
+ if (binding !== undefined && !frameBindings.has(to))
21
+ frameBindings.set(to, binding);
22
+ return to;
23
+ }
@@ -0,0 +1,2 @@
1
+ export declare function isGateStandingErrorCode(code: string | null | undefined, retriable?: boolean): boolean;
2
+ export declare function isCodeClassifiedGateFailure(code: string | null | undefined, retriable?: boolean): boolean;
@@ -0,0 +1,15 @@
1
+ import { DECIDE_WORKFLOW_PARK_FORKED, DECIDE_WORKFLOW_PARKS_UNREADABLE, PARKED_RESUME_STARTUP_FAILED, RESUME_POLICY_FOLD_CODE, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, isRefusedParkCode } from './engineErrorCodes.js';
2
+ import { RESUME_REFUSAL_CODES } from './resumeRefusalCopy.js';
3
+ export function isGateStandingErrorCode(code, retriable) {
4
+ return (code === RESUME_POLICY_FOLD_CODE ||
5
+ code === 'corrupt' ||
6
+ (isRefusedParkCode(code) && retriable === true) ||
7
+ (typeof code === 'string' && RESUME_REOPEN_CODES.includes(code) && retriable === true) ||
8
+ code === DECIDE_WORKFLOW_PARKS_UNREADABLE ||
9
+ code === DECIDE_WORKFLOW_PARK_FORKED);
10
+ }
11
+ export function isCodeClassifiedGateFailure(code, retriable) {
12
+ return (isGateStandingErrorCode(code, retriable) ||
13
+ code === PARKED_RESUME_STARTUP_FAILED ||
14
+ (typeof code === 'string' && (RESUME_RETRY_LATER_CODES.includes(code) || RESUME_REFUSAL_CODES.includes(code))));
15
+ }
@@ -32,7 +32,7 @@ export interface GateModeReleaseView {
32
32
  mandate?: string;
33
33
  reason?: string;
34
34
  }
35
- export declare const GATE_MODE_RELEASE_REASON_WORDS: readonly ["rule_unreadable", "target_unresolved"];
35
+ export declare const GATE_MODE_RELEASE_REASON_WORDS: readonly ["target_unresolved"];
36
36
  export type GateModeReleaseReasonWord = (typeof CORE_MODE_RELEASE_REASONS)[number];
37
37
  export declare function isGateModeReleaseReasonWord(v: unknown): v is GateModeReleaseReasonWord;
38
38
  export declare function modeReleaseReasonSentence(reason: string | null | undefined): string | undefined;
@@ -58,10 +58,12 @@ export interface SettlementView {
58
58
  when?: number;
59
59
  note?: string;
60
60
  }
61
+ export type GateRecordSeat = 'settlement' | 'cause' | 'classifier';
61
62
  export interface GateOutcomeView {
62
63
  disposition: GateDispositionView;
63
64
  settlement?: SettlementView;
64
65
  origin?: string;
66
+ unreadable?: readonly GateRecordSeat[];
65
67
  }
66
68
  export declare function gateOutcomeOf(frame: unknown): GateOutcomeView | undefined;
67
69
  export declare function isGateParkedToolEnd(frame: unknown): boolean;
@@ -10,7 +10,6 @@ export function isGateModeReleaseReasonWord(v) {
10
10
  return typeof v === 'string' && CORE_MODE_RELEASE_REASONS.includes(v);
11
11
  }
12
12
  const MODE_RELEASE_SENTENCE_BY_REASON = Object.freeze({
13
- rule_unreadable: 'The permission mode let this call run without asking, even though it could not be checked against your saved permission rules.',
14
13
  target_unresolved: 'The permission mode let this call run without asking, even though it could not be determined where its write lands on disk, so whether it lands on a guarded location is unknown.',
15
14
  });
16
15
  const MODE_RELEASE_UNRECOGNISED_SENTENCE = 'The permission mode let this call run without asking, for a reason this client does not recognise.';
@@ -65,6 +64,9 @@ export function createReleaseDisclosureLedger() {
65
64
  });
66
65
  }
67
66
  export const SETTLEMENT_KIND_WORDS = CORE_SETTLEMENT_KINDS;
67
+ function isGateRecordSeat(x) {
68
+ return x === 'settlement' || x === 'cause' || x === 'classifier';
69
+ }
68
70
  function readWho(v) {
69
71
  if (typeof v !== 'object' || v === null || Array.isArray(v))
70
72
  return undefined;
@@ -151,6 +153,15 @@ function readClassifierRound(raw) {
151
153
  }
152
154
  return view;
153
155
  }
156
+ function carriedUnreadableSeats(v) {
157
+ const out = new Set();
158
+ if (!Array.isArray(v))
159
+ return out;
160
+ for (const x of v)
161
+ if (isGateRecordSeat(x))
162
+ out.add(x);
163
+ return out;
164
+ }
154
165
  function readGateRecord(frame) {
155
166
  if (typeof frame !== 'object' || frame === null || Array.isArray(frame))
156
167
  return undefined;
@@ -158,6 +169,7 @@ function readGateRecord(frame) {
158
169
  if (typeof g !== 'object' || g === null || Array.isArray(g))
159
170
  return undefined;
160
171
  const raw = g;
172
+ const carried = carriedUnreadableSeats(raw.unreadable);
161
173
  const d = raw.disposition;
162
174
  if (typeof d !== 'object' || d === null || Array.isArray(d))
163
175
  return undefined;
@@ -180,7 +192,7 @@ function readGateRecord(frame) {
180
192
  if (deniedBy === undefined)
181
193
  return undefined;
182
194
  const causeRaw = dr.cause;
183
- causePresent = causeRaw !== undefined;
195
+ causePresent = causeRaw !== undefined || carried.has('cause');
184
196
  const cause = str(causeRaw);
185
197
  const mode = str(dr.mode);
186
198
  const askClass = str(dr.askClass);
@@ -201,15 +213,24 @@ function readGateRecord(frame) {
201
213
  const settlementRaw = raw.settlement;
202
214
  const settlement = readSettlement(settlementRaw);
203
215
  const origin = readAskOrigin(raw);
216
+ const settlementPresent = settlementRaw !== undefined || carried.has('settlement');
217
+ const classifierPresent = classifierRaw !== undefined || carried.has('classifier');
218
+ const missing = {
219
+ settlement: settlementPresent && settlement === undefined,
220
+ cause: causePresent && disposition.kind === 'denied' && disposition.cause === undefined,
221
+ classifier: classifierPresent && disposition.classifier === undefined,
222
+ };
223
+ const unreadable = Object.keys(missing).filter((seat) => missing[seat]);
204
224
  return {
205
225
  view: {
206
226
  disposition,
207
227
  ...(settlement !== undefined ? { settlement } : {}),
208
228
  ...(origin !== undefined ? { origin } : {}),
229
+ ...(unreadable.length > 0 ? { unreadable: Object.freeze(unreadable) } : {}),
209
230
  },
210
- settlementPresent: settlementRaw !== undefined,
231
+ settlementPresent,
211
232
  causePresent,
212
- classifierPresent: classifierRaw !== undefined,
233
+ classifierPresent,
213
234
  };
214
235
  }
215
236
  export function gateOutcomeOf(frame) {
@@ -257,8 +278,6 @@ export function ccToolDenialKindForToolEnd(frame) {
257
278
  const stamped = frame._sema_denial_kind;
258
279
  if (isCcToolDenialKind(stamped))
259
280
  return stamped;
260
- if (frame._sema_denial_unclassified === true)
261
- return undefined;
262
281
  const record = readGateRecord(frame);
263
282
  const outcome = record?.view;
264
283
  const kind = outcome?.settlement?.kind;
@@ -9,6 +9,11 @@ export declare const GATE_DENIED_BY_WORDS: readonly GateDeniedByWord[];
9
9
  export declare function isGateDeniedByWord(v: unknown): v is GateDeniedByWord;
10
10
  export declare function gateDeniedByDetail(deniedBy: unknown): string;
11
11
  export declare function askOriginDetail(origin: unknown): string;
12
+ export declare function askOriginNoteOf(origin: string | undefined): string | undefined;
13
+ export declare function ruleOffersAbsenceDetail(reason: string | undefined, opts?: {
14
+ readonly deploymentListSessionRow?: boolean;
15
+ }): string | undefined;
16
+ export declare function ruleOfferUncoveredDetail(reason: string | undefined): string;
12
17
  export declare function mandatedApprovalDetail(): string;
13
18
  export declare const APPROVAL_MANDATE_WORDS: readonly (typeof CORE_PERSISTED_RULE_MANDATES)[number][];
14
19
  export type ApprovalMandateWord = (typeof APPROVAL_MANDATE_WORDS)[number];
@@ -1,4 +1,5 @@
1
1
  import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
2
+ import { guardedRead, readOwnDataValue } from './ownKey.js';
2
3
  export const CC_TOOL_DENIAL_KINDS = Object.freeze([
3
4
  'user-rejected',
4
5
  'permission-rule',
@@ -48,6 +49,7 @@ export function gateDeniedByDetail(deniedBy) {
48
49
  }
49
50
  const ASK_ORIGIN_SENTENCES = Object.freeze({
50
51
  content_question: 'the tool itself asked you a question',
52
+ plan_review: 'the model paused its run for your verdict on the plan it proposed',
51
53
  ancestor_marked: 'an ancestor marked this call (an inherited approver-unavailable float, or a durable mandate; this client cannot tell which from the origin alone): it must reach the park with no synchronous decision-maker in between',
52
54
  org_unavailable: 'the organization policy was unavailable, so this call asks',
53
55
  org_rule: 'an organization rule asks about this call',
@@ -57,7 +59,7 @@ const ASK_ORIGIN_SENTENCES = Object.freeze({
57
59
  denial_limit_fallback: 'the auto-mode classifier hit its denial limit and handed this call back to you',
58
60
  shell_gate_tighten: 'the coarse shell check rates this command above the tier it lets through, so it asks',
59
61
  safety_tighten: 'the gate tightened on this call’s own facts (network egress, irreversibility, or a protected write; this client cannot tell which from the origin alone)',
60
- policy: 'this deployment’s permission policy asks about this call',
62
+ policy: 'this deployment’s permission policy, or the permission mode’s default, asks about this call',
61
63
  });
62
64
  export function askOriginDetail(origin) {
63
65
  const known = typeof origin === 'string' && Object.hasOwn(ASK_ORIGIN_SENTENCES, origin)
@@ -66,7 +68,67 @@ export function askOriginDetail(origin) {
66
68
  if (known !== undefined)
67
69
  return known;
68
70
  const word = typeof origin === 'string' && origin.length > 0 ? origin : '(none)';
69
- return `this call asks; its origin ${word} is a word newer than this client, so answer it as usual`;
71
+ return unknownAskOriginSentence(word);
72
+ }
73
+ function unknownAskOriginSentence(word) {
74
+ return `this call asks; its origin ${word === undefined ? '' : `${word} `}is a word newer than this client, so answer it as usual`;
75
+ }
76
+ const ASK_ORIGIN_QUIET = Object.freeze({
77
+ content_question: true,
78
+ plan_review: true,
79
+ ancestor_marked: false,
80
+ org_unavailable: false,
81
+ org_rule: false,
82
+ rule_store_unavailable: false,
83
+ hook: false,
84
+ ask_rule: true,
85
+ denial_limit_fallback: false,
86
+ shell_gate_tighten: false,
87
+ safety_tighten: false,
88
+ policy: true,
89
+ });
90
+ export function askOriginNoteOf(origin) {
91
+ if (typeof origin !== 'string' || origin === '')
92
+ return undefined;
93
+ if (Object.hasOwn(ASK_ORIGIN_QUIET, origin)) {
94
+ return ASK_ORIGIN_QUIET[origin] === true ? undefined : askOriginDetail(origin);
95
+ }
96
+ return unknownAskOriginSentence(undefined);
97
+ }
98
+ const NO_REMEMBER_HEAD = 'no "don\'t ask again" option here';
99
+ const RULE_OFFERS_ABSENCE_LINES = Object.freeze({
100
+ mandated: { line: null },
101
+ allow_outranked: {
102
+ line: `${NO_REMEMBER_HEAD}: an allow rule already matches this call, but this question outranks it — another allow rule would be outranked the same way`,
103
+ },
104
+ ask_rule_matched: {
105
+ line: `${NO_REMEMBER_HEAD}: an ask rule matches this call and keeps asking — an allow rule changes nothing while it stands; to stop being asked, review your ask rules`,
106
+ deploymentList: `${NO_REMEMBER_HEAD}: this deployment asks about every call to this tool and your own rules cannot switch that off — the "in this session" option stops it asking again until the session ends`,
107
+ },
108
+ lane_cannot_speak: { line: `${NO_REMEMBER_HEAD}: this approval lane cannot persist rules` },
109
+ });
110
+ export function ruleOffersAbsenceDetail(reason, opts) {
111
+ if (typeof reason !== 'string' || reason === '')
112
+ return undefined;
113
+ if (Object.hasOwn(RULE_OFFERS_ABSENCE_LINES, reason)) {
114
+ const entry = RULE_OFFERS_ABSENCE_LINES[reason];
115
+ if (entry.line === null)
116
+ return undefined;
117
+ const onList = guardedRead(() => readOwnDataValue(opts, 'deploymentListSessionRow')) === true;
118
+ return onList && entry.deploymentList !== undefined ? entry.deploymentList : entry.line;
119
+ }
120
+ return `${NO_REMEMBER_HEAD} (the reason is one this build does not know yet)`;
121
+ }
122
+ const RULE_OFFER_UNCOVERED_LINES = Object.freeze({
123
+ redirection: 'always asks (shell redirection)',
124
+ no_rule_form: 'no coverable rule form',
125
+ cap_overflow: 'trimmed by the offer cap',
126
+ });
127
+ export function ruleOfferUncoveredDetail(reason) {
128
+ if (typeof reason === 'string' && Object.hasOwn(RULE_OFFER_UNCOVERED_LINES, reason)) {
129
+ return RULE_OFFER_UNCOVERED_LINES[reason];
130
+ }
131
+ return 'a reason this build does not know yet';
70
132
  }
71
133
  export function mandatedApprovalDetail() {
72
134
  return 'no saved allow rule and no remembered answer can retire this question; each call is settled on its own — by you here or by an automatic check the deployment runs — and an answer covers only that call';
@@ -7,6 +7,6 @@ export const CORE_SHELL_FACE_TOOL_NAMES = Object.freeze([
7
7
  "Monitor",
8
8
  ]);
9
9
  export const CORE_RELEASABLE_ASK_CLASSES_BY_FACE = Object.freeze({
10
- "shell": Object.freeze(["transcript_write", "rule_unreadable", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
11
- "other": Object.freeze(["transcript_write", "rule_unreadable", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
10
+ "shell": Object.freeze(["transcript_write", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
11
+ "other": Object.freeze(["transcript_write", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
12
12
  });
@@ -8,7 +8,7 @@ export declare const CORE_DENIED_BY_VALUES: readonly ["policy", "hook", "org", "
8
8
  export declare const CORE_PERMISSION_MODE_FOLD_REASONS: readonly string[];
9
9
  export declare const CORE_ENGINE_CARD_TYPES: readonly string[];
10
10
  export declare const CORE_TOOL_DECLARATION_CODES: readonly string[];
11
- export declare const CORE_MODE_RELEASE_REASONS: readonly ["rule_unreadable", "target_unresolved"];
11
+ export declare const CORE_MODE_RELEASE_REASONS: readonly ["target_unresolved"];
12
12
  export declare const CORE_HOOK_TOOL_ALIASES: Readonly<Record<string, string>>;
13
13
  export declare const CORE_ASK_EVIDENCE_ABSENCE_VALUES: readonly ["not_wired", "not_adjudicated", "unavailable", "no_match", "not_reported"];
14
14
  export declare const CORE_SYSTEM_INJECTION_PRIORITIES: readonly ["now", "next", "later"];
@@ -21,9 +21,9 @@ export interface CoreModeArbitrationRow {
21
21
  readonly ruleMayClear: boolean;
22
22
  readonly hookAskFloor: boolean;
23
23
  }
24
- export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "governance_unavailable" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "target_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
24
+ export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "target_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
25
25
  export declare const CORE_SKILL_GRANT_ORIGINS: readonly ["model", "user", "inherited"];
26
- export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss"];
26
+ export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss", "earlier_grammar"];
27
27
  export declare const CORE_ALLOW_RULE_MEMBERS: readonly ["hook", "deployment", "persisted", "skill", "request"];
28
28
  export declare const CORE_RULE_TOOL_NAME_VERDICTS: readonly ["current", "retired", "unprefixed_namespace", "unmintable_segment"];
29
29
  export declare const CORE_SETTLEMENT_KINDS: readonly ["human_allowed", "human_refused", "approval_window_expired", "denial_limit_window_expired", "park_sla_expired", "no_approver", "approver_unavailable", "approver_error", "approver_contract", "presentation_failed", "blanket_allow_refused", "policy_allowed", "policy_refused", "task_aborted"];
@@ -42,3 +42,6 @@ export declare const CORE_PROMPT_BLOCK_CAUSES: readonly ["block", "crashed", "ti
42
42
  export declare const CORE_PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions", "dontAsk"];
43
43
  export declare const CORE_APPROVAL_REACH: readonly ["none"];
44
44
  export declare const CORE_PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "target_unresolved"];
45
+ export declare const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "cancelled"];
46
+ export declare const CORE_RESUME_STARTUP_CAUSES: readonly ["environment", "session_gone", "tool_unavailable", "configuration", "decision_rejected"];
47
+ export declare const CORE_BUILTIN_SUBAGENT_TYPES: readonly ["Explore", "Plan", "fork", "general-purpose"];
@@ -112,7 +112,6 @@ export const CORE_TOOL_DECLARATION_CODES = Object.freeze([
112
112
  "config.reserved_tool_name",
113
113
  ]);
114
114
  export const CORE_MODE_RELEASE_REASONS = Object.freeze([
115
- "rule_unreadable",
116
115
  "target_unresolved",
117
116
  ]);
118
117
  export const CORE_HOOK_TOOL_ALIASES = Object.freeze(Object.assign(Object.create(null), Object.fromEntries([
@@ -146,12 +145,11 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
146
145
  "hook": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
147
146
  "ancestor": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
148
147
  "dangerous_delete": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
149
- "unverifiable_delete": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
148
+ "unverifiable_delete": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
150
149
  "unverifiable_shell_text": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
151
150
  "transcript_write": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
152
151
  "org_rule": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
153
- "governance_unavailable": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
154
- "rule_unreadable": Object.freeze({ bypassImmune: false, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
152
+ "rule_unreadable": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
155
153
  "ask_rule": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
156
154
  "denial_limit_fallback": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
157
155
  "classifier_no_ruling": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
@@ -181,6 +179,7 @@ export const CORE_ALLOW_ENTRY_INERT_REASONS = Object.freeze([
181
179
  "grammar",
182
180
  "tool_name",
183
181
  "near_miss",
182
+ "earlier_grammar",
184
183
  ]);
185
184
  export const CORE_ALLOW_RULE_MEMBERS = Object.freeze([
186
185
  "hook",
@@ -281,3 +280,22 @@ export const CORE_PERSISTED_RULE_MANDATES = Object.freeze([
281
280
  "write_protection",
282
281
  "target_unresolved",
283
282
  ]);
283
+ export const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze([
284
+ "completed",
285
+ "failed",
286
+ "killed",
287
+ "cancelled",
288
+ ]);
289
+ export const CORE_RESUME_STARTUP_CAUSES = Object.freeze([
290
+ "environment",
291
+ "session_gone",
292
+ "tool_unavailable",
293
+ "configuration",
294
+ "decision_rejected",
295
+ ]);
296
+ export const CORE_BUILTIN_SUBAGENT_TYPES = Object.freeze([
297
+ "Explore",
298
+ "Plan",
299
+ "fork",
300
+ "general-purpose",
301
+ ]);
@@ -8,6 +8,7 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
8
8
  "config.read_face_deployment_clamped",
9
9
  "config.write_face_swapped",
10
10
  "config.write_face_deployment_clamped",
11
+ "config.read_deny_swapped",
11
12
  "config.tool_model_gate_removed",
12
13
  "config.tool_model_gate_unknown_class",
13
14
  "config.tool_model_gate_env_invalid",
@@ -85,10 +86,12 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
85
86
  "skills.listing_truncated",
86
87
  "agents.listing_truncated",
87
88
  "tool_result.offload_put_failed",
89
+ "tool_result.media_refused",
88
90
  "instructions.source_changed",
89
91
  "session.records_skipped",
90
92
  "memory.layer_locked_legacy",
91
93
  "server.model_unreachable",
94
+ "permission.entry_mode_clamped",
92
95
  ]);
93
96
  export const CORE_NOTICE_AUDIENCE = Object.freeze({
94
97
  "config.autocompact_window_clamped": "operator",
@@ -100,6 +103,7 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
100
103
  "config.read_face_deployment_clamped": "operator",
101
104
  "config.write_face_swapped": "operator",
102
105
  "config.write_face_deployment_clamped": "operator",
106
+ "config.read_deny_swapped": "operator",
103
107
  "config.tool_model_gate_removed": "operator",
104
108
  "config.tool_model_gate_unknown_class": "operator",
105
109
  "config.tool_model_gate_env_invalid": "operator",
@@ -177,10 +181,12 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
177
181
  "skills.listing_truncated": "operator",
178
182
  "agents.listing_truncated": "operator",
179
183
  "tool_result.offload_put_failed": "operator",
184
+ "tool_result.media_refused": "operator",
180
185
  "instructions.source_changed": "user",
181
186
  "session.records_skipped": "user",
182
187
  "memory.layer_locked_legacy": "operator",
183
188
  "server.model_unreachable": "user",
189
+ "permission.entry_mode_clamped": "user",
184
190
  });
185
191
  export const CORE_MCP_INJECTION_DROP_REASONS = Object.freeze([
186
192
  "malformed_entry",
@@ -198,6 +204,7 @@ export const CORE_NOTICE_MINTER = Object.freeze({
198
204
  "config.read_face_deployment_clamped": "engine",
199
205
  "config.write_face_swapped": "engine",
200
206
  "config.write_face_deployment_clamped": "engine",
207
+ "config.read_deny_swapped": "engine",
201
208
  "config.tool_model_gate_removed": "engine",
202
209
  "config.tool_model_gate_unknown_class": "engine",
203
210
  "config.tool_model_gate_env_invalid": "engine",
@@ -275,10 +282,12 @@ export const CORE_NOTICE_MINTER = Object.freeze({
275
282
  "skills.listing_truncated": "engine",
276
283
  "agents.listing_truncated": "engine",
277
284
  "tool_result.offload_put_failed": "engine",
285
+ "tool_result.media_refused": "engine",
278
286
  "instructions.source_changed": "server",
279
287
  "session.records_skipped": "server",
280
288
  "memory.layer_locked_legacy": "server",
281
289
  "server.model_unreachable": "server",
290
+ "permission.entry_mode_clamped": "server",
282
291
  });
283
292
  export const CORE_USER_INPUT_UNDRAINED_CAUSES = Object.freeze([
284
293
  "leg_end",
@@ -1,2 +1,3 @@
1
1
  export declare const CORE_PROTOCOL_PREFIXES: readonly ["mcp__", "a2a__"];
2
2
  export declare const CORE_SKILL_TOOL_NAME: "Skill";
3
+ export declare const CORE_BOUND_GRANT_ABSENCES: readonly ["not_bindable", "unreadable"];
@@ -1,2 +1,3 @@
1
1
  export const CORE_PROTOCOL_PREFIXES = ["mcp__", "a2a__"];
2
2
  export const CORE_SKILL_TOOL_NAME = "Skill";
3
+ export const CORE_BOUND_GRANT_ABSENCES = ["not_bindable", "unreadable"];
@@ -11,10 +11,15 @@ export interface AllowRuleShadowedWireMember {
11
11
  readonly omitted?: number;
12
12
  }
13
13
  export interface ApprovalAllowRuleShadow {
14
- readonly source: 'allow_rule_shadowed' | 'legacy_shadowed_rule';
14
+ readonly source: 'allow_rule_shadowed';
15
15
  readonly members: readonly ApprovalAllowRuleShadowMember[];
16
16
  readonly unreadable?: true;
17
17
  }
18
+ export declare const RETIRED_SHADOW_EVIDENCE_LABEL: Readonly<{
19
+ readonly frame: "persistedRuleShadowed";
20
+ readonly row: "riskDescriptor.shadowedRule";
21
+ }>;
22
+ export declare function retiredAllowRuleShadowKeyPresent(carrier: object | null | undefined, leg: 'frame' | 'row'): boolean;
18
23
  export declare function readAllowRuleShadowFromWire(carrier: object | null | undefined, leg: 'frame' | 'row'): ApprovalAllowRuleShadow | undefined;
19
24
  export declare function readApprovalAllowRuleShadow(card: object | null | undefined): ApprovalAllowRuleShadow | undefined;
20
25
  export declare function approvalAllowRuleShadowed(card: object | null | undefined): boolean;
@@ -76,20 +76,27 @@ function readNewKeyValue(raw) {
76
76
  return unreadable();
77
77
  return Object.freeze({ source: 'allow_rule_shadowed', members: Object.freeze(members) });
78
78
  }
79
- function readLegacyValue(raw) {
80
- if (typeof raw !== 'string' || raw.trim() === '')
81
- return undefined;
82
- return Object.freeze({
83
- source: 'legacy_shadowed_rule',
84
- members: Object.freeze([freezeMember({ member: 'persisted', known: true, entries: Object.freeze([raw]) })]),
85
- });
86
- }
87
79
  function ownValue(v, key) {
88
80
  return Object.hasOwn(v, key) ? v[key] : undefined;
89
81
  }
90
82
  function keyValue(v, key) {
91
83
  return v[key];
92
84
  }
85
+ const RETIRED_SHADOW_KEY = Object.freeze({ frame: 'persistedRuleShadowed', row: 'shadowedRule' });
86
+ export const RETIRED_SHADOW_EVIDENCE_LABEL = Object.freeze({ frame: 'persistedRuleShadowed', row: 'riskDescriptor.shadowedRule' });
87
+ export function retiredAllowRuleShadowKeyPresent(carrier, leg) {
88
+ try {
89
+ if (typeof carrier !== 'object' || carrier === null)
90
+ return false;
91
+ const host = leg === 'row' ? keyValue(carrier, 'riskDescriptor') : carrier;
92
+ if (typeof host !== 'object' || host === null)
93
+ return false;
94
+ return RETIRED_SHADOW_KEY[leg] in host;
95
+ }
96
+ catch {
97
+ return true;
98
+ }
99
+ }
93
100
  function readMemberAt(arr, i) {
94
101
  const d = Object.getOwnPropertyDescriptor(arr, i);
95
102
  return d !== undefined && 'value' in d ? readMemberRecord(d.value) : freezeMember({ known: false, malformed: true });
@@ -105,10 +112,7 @@ export function readAllowRuleShadowFromWire(carrier, leg) {
105
112
  }
106
113
  if (host === undefined)
107
114
  return undefined;
108
- const fresh = readNewKeyValue(keyValue(host, 'allowRuleShadowed'));
109
- if (fresh !== undefined)
110
- return fresh;
111
- return readLegacyValue(keyValue(host, leg === 'row' ? 'shadowedRule' : 'persistedRuleShadowed'));
115
+ return readNewKeyValue(keyValue(host, 'allowRuleShadowed'));
112
116
  }
113
117
  catch {
114
118
  return unreadable();
@@ -119,7 +123,7 @@ function readStampedValue(raw) {
119
123
  return unreadable();
120
124
  const source = ownValue(raw, 'source');
121
125
  const members = ownValue(raw, 'members');
122
- if ((source !== 'allow_rule_shadowed' && source !== 'legacy_shadowed_rule') || !Array.isArray(members))
126
+ if (source !== 'allow_rule_shadowed' || !Array.isArray(members))
123
127
  return unreadable();
124
128
  const length = members.length;
125
129
  if (typeof length !== 'number' || !Number.isSafeInteger(length))
@@ -159,7 +163,7 @@ const ENTRY_MAX = 4096;
159
163
  const MEMBER_MAX = 64;
160
164
  const ENTRIES_SHOWN = 5;
161
165
  const UNREADABLE_LINE = 'An allow rule matched this call but cannot clear it; which rule could not be read, so this one is confirmed individually.';
162
- function legacySingleEntry(shadow) {
166
+ function singlePersistedEntry(shadow) {
163
167
  if (shadow.unreadable === true || shadow.members.length !== 1)
164
168
  return undefined;
165
169
  const m = shadow.members[0];
@@ -196,9 +200,9 @@ export function allowRuleShadowSentence(card) {
196
200
  try {
197
201
  if (shadow.unreadable === true || shadow.members.length === 0)
198
202
  return UNREADABLE_LINE;
199
- const legacy = legacySingleEntry(shadow);
200
- if (legacy !== undefined) {
201
- return `Your saved permission rule ${legacy} still exists — it just cannot clear this particular call, so this one is confirmed individually.`;
203
+ const single = singlePersistedEntry(shadow);
204
+ if (single !== undefined) {
205
+ return `Your saved permission rule ${single} still exists — it just cannot clear this particular call, so this one is confirmed individually.`;
202
206
  }
203
207
  return `Allow rules matched this call but cannot clear it, so this one is confirmed individually — ${shadow.members.map(memberPhrase).join(' · ')}.`;
204
208
  }
@@ -0,0 +1,15 @@
1
+ import type { ApprovalCardRequest } from './toolApprovalWire.js';
2
+ export declare function readRequiresRealApproval(carrier: object | null | undefined): boolean;
3
+ export interface ApprovalWindowKeys {
4
+ readonly expiresInMs?: number;
5
+ readonly expiresAtMs?: number;
6
+ readonly serverNowMs?: number;
7
+ readonly receivedAtMs?: number;
8
+ }
9
+ export interface ApprovalWindowReadOpts {
10
+ readonly windowIsCurrent?: boolean;
11
+ readonly receivedAtMs?: number;
12
+ readonly unknownShape?: boolean;
13
+ }
14
+ export declare function approvalWindowKeysOf(carrier: object | null | undefined, opts?: ApprovalWindowReadOpts | null): Readonly<ApprovalWindowKeys>;
15
+ export declare function probeCauseRowsOf(card: Pick<ApprovalCardRequest, 'probeCause'> | null | undefined): readonly string[] | undefined;