@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
@@ -12,12 +12,11 @@ const nested = (prefix, verdict) => {
12
12
  const reason = verdict.reason.startsWith(`${prefix}:`) ? verdict.reason : `${prefix}: ${verdict.reason}`;
13
13
  return bad(reason, path);
14
14
  };
15
- const isObject = (v) => typeof v === "object" && v !== null;
16
15
  const isPlainRecord = (v) => {
17
- if (!isObject(v) || Array.isArray(v))
16
+ if (typeof v !== "object" || v === null || Array.isArray(v))
18
17
  return false;
19
18
  const proto = Object.getPrototypeOf(v);
20
- return proto === Object.prototype || proto === null;
19
+ return proto === null || (typeof proto === "object" && Object.getPrototypeOf(proto) === null);
21
20
  };
22
21
  const isAbsent = (v) => typeof v === "undefined";
23
22
  const optionalString = (v) => isAbsent(v) || typeof v === "string";
@@ -137,6 +136,14 @@ const CHROME_EVENT_KIND_TUPLE = [
137
136
  "subagent_lifecycle",
138
137
  "text_segment_end",
139
138
  "thinking_segment_end",
139
+ "retry_status",
140
+ "context_usage",
141
+ "last_turn_usage",
142
+ "bgshell_register",
143
+ "bgshell_settle",
144
+ "memory_saved",
145
+ "result_replayed",
146
+ "tool_parked",
140
147
  ];
141
148
  export const CHROME_EVENT_KINDS = Object.freeze(CHROME_EVENT_KIND_TUPLE);
142
149
  const LANE_PROOF_LANE_TUPLE = ["main", "subagent", "workflow"];
@@ -151,6 +158,53 @@ export const HITL_RESOLUTION_OUTCOMES = [
151
158
  "decline",
152
159
  "cancel",
153
160
  ];
161
+ export const SEAT_STREAM_DELTA_TYPE_OF_CHANNEL = Object.freeze({ text: "text_delta", thinking: "thinking_delta" });
162
+ export function seatStreamDeltaMessage(event, ids) {
163
+ try {
164
+ const channel = ownDataField(event, "channel");
165
+ const text = ownDataField(event, "text");
166
+ const uuid = ownDataField(ids, "uuid");
167
+ const sessionId = ownDataField(ids, "sessionId");
168
+ if (typeof channel !== "string" || !Object.hasOwn(SEAT_STREAM_DELTA_TYPE_OF_CHANNEL, channel))
169
+ return undefined;
170
+ if (typeof text !== "string")
171
+ return undefined;
172
+ if (typeof uuid !== "string" || uuid.length === 0 || typeof sessionId !== "string" || sessionId.length === 0)
173
+ return undefined;
174
+ return {
175
+ type: "stream_event",
176
+ uuid,
177
+ session_id: sessionId,
178
+ event: { type: SEAT_STREAM_DELTA_TYPE_OF_CHANNEL[channel], delta: text },
179
+ parent_tool_use_id: null,
180
+ };
181
+ }
182
+ catch {
183
+ return undefined;
184
+ }
185
+ }
186
+ export function readSeatStreamDelta(message) {
187
+ try {
188
+ if (typeof message !== "object" || message === null)
189
+ return Object.freeze({ kind: "not_stream_event" });
190
+ if (ownDataField(message, "type") !== "stream_event")
191
+ return Object.freeze({ kind: "not_stream_event" });
192
+ const inner = ownDataField(message, "event");
193
+ if (typeof inner !== "object" || inner === null)
194
+ return Object.freeze({ kind: "malformed" });
195
+ const innerType = ownDataField(inner, "type");
196
+ if (typeof innerType !== "string")
197
+ return Object.freeze({ kind: "malformed" });
198
+ const channel = Object.keys(SEAT_STREAM_DELTA_TYPE_OF_CHANNEL).find((c) => SEAT_STREAM_DELTA_TYPE_OF_CHANNEL[c] === innerType);
199
+ if (channel === undefined)
200
+ return Object.freeze({ kind: "unknown_event" });
201
+ const delta = ownDataField(inner, "delta");
202
+ return typeof delta === "string" ? Object.freeze({ kind: "delta", channel, delta }) : Object.freeze({ kind: "malformed" });
203
+ }
204
+ catch {
205
+ return Object.freeze({ kind: "malformed" });
206
+ }
207
+ }
154
208
  export const SEAT_CAPABILITY_NAMES = Object.freeze(["pickFolder", "rewind", "recents", "patchSession"]);
155
209
  const notReported = () => Object.freeze({ kind: "not_reported" });
156
210
  const malformedReading = () => Object.freeze({ kind: "malformed" });
@@ -159,10 +213,7 @@ export function seatCapability(state, name) {
159
213
  if (state === undefined)
160
214
  return notReported();
161
215
  try {
162
- if (typeof state !== "object" || state === null || Array.isArray(state))
163
- return malformedReading();
164
- const proto = Object.getPrototypeOf(state);
165
- if (proto !== Object.prototype && proto !== null)
216
+ if (!isPlainRecord(state))
166
217
  return malformedReading();
167
218
  const desc = Object.getOwnPropertyDescriptor(state, name);
168
219
  if (desc === undefined)
@@ -355,8 +406,8 @@ export const SESSION_ROW_PATCH_REQUEST_KEYS = Object.freeze(["sessionId", "title
355
406
  export const SESSION_SEARCH_RESULT_KEYS = ["sessionId", "title", "matches"];
356
407
  export const GET_TRANSCRIPT_RESULT_KEYS = ["sessionId", "messages"];
357
408
  const checkLocalSessionRecord = seatCheck((s) => {
358
- if (!isObject(s))
359
- return bad("session record is not an object");
409
+ if (!isPlainRecord(s))
410
+ return bad("session record is not a plain object");
360
411
  if (typeof own(s, "sessionId") !== "string")
361
412
  return bad("sessionId must be a string", "sessionId");
362
413
  if (!optionalString(own(s, "engineSessionId")))
@@ -377,7 +428,7 @@ const checkLocalSessionRecord = seatCheck((s) => {
377
428
  return bad("lastActivityAt must be a string when present", "lastActivityAt");
378
429
  const q = own(s, "queuedMessages");
379
430
  if (!isAbsent(q)) {
380
- const okQueue = Array.isArray(q) && ownItems(q).every((row) => isObject(row) && typeof own(row, "uuid") === "string" && typeof own(row, "text") === "string");
431
+ const okQueue = Array.isArray(q) && ownItems(q).every((row) => isPlainRecord(row) && typeof own(row, "uuid") === "string" && typeof own(row, "text") === "string");
381
432
  if (!okQueue)
382
433
  return bad("queuedMessages must be an array of {uuid,text}", "queuedMessages");
383
434
  }
@@ -395,8 +446,8 @@ export function isLocalSessionRecord(s) {
395
446
  return checkLocalSessionRecord(s) === true;
396
447
  }
397
448
  const checkToctouBinding = seatCheck((v) => {
398
- if (!isObject(v))
399
- return bad("toctouBinding must be an object", "toctouBinding");
449
+ if (!isPlainRecord(v))
450
+ return bad("toctouBinding must be a plain object", "toctouBinding");
400
451
  if (typeof own(v, "callId") !== "string")
401
452
  return bad("toctouBinding.callId must be a string", "toctouBinding.callId");
402
453
  if (typeof own(v, "inputHash") !== "string")
@@ -404,8 +455,8 @@ const checkToctouBinding = seatCheck((v) => {
404
455
  return true;
405
456
  });
406
457
  const checkToolPermissionRequest = seatCheck((r) => {
407
- if (!isObject(r))
408
- return bad("tool permission request is not an object");
458
+ if (!isPlainRecord(r))
459
+ return bad("tool permission request is not a plain object");
409
460
  const requestId = own(r, "requestId");
410
461
  if (typeof requestId !== "string")
411
462
  return bad("requestId must be a string", "requestId");
@@ -440,8 +491,8 @@ export function isToolPermissionRequest(r) {
440
491
  return checkToolPermissionRequest(r) === true;
441
492
  }
442
493
  const checkLaneProof = seatCheckAt((v, field) => {
443
- if (!isObject(v))
444
- return bad("laneProof must be an object", field);
494
+ if (!isPlainRecord(v))
495
+ return bad("laneProof must be a plain object", field);
445
496
  const lane = own(v, "lane");
446
497
  if (typeof lane !== "string" || !inTuple(LANE_PROOF_LANE_TUPLE, lane)) {
447
498
  return bad(`laneProof.lane must be one of ${LANE_PROOF_LANE_TUPLE.join("|")}`, `${field}.lane`);
@@ -455,8 +506,8 @@ const checkLaneProof = seatCheckAt((v, field) => {
455
506
  return true;
456
507
  });
457
508
  const checkSeatChromeEnvelope = seatCheckAt((v, field) => {
458
- if (!isObject(v))
459
- return bad("chrome must be an object", field);
509
+ if (!isPlainRecord(v))
510
+ return bad("chrome must be a plain object", field);
460
511
  const kind = own(v, "kind");
461
512
  if (typeof kind !== "string")
462
513
  return bad("chrome.kind must be a string", `${field}.kind`);
@@ -466,8 +517,8 @@ const checkSeatChromeEnvelope = seatCheckAt((v, field) => {
466
517
  return checkLaneProof(own(v, "laneProof"), `${field}.laneProof`);
467
518
  });
468
519
  const checkLocalSessionEvent = seatCheck((v) => {
469
- if (!isObject(v))
470
- return bad("event is not an object");
520
+ if (!isPlainRecord(v))
521
+ return bad("event is not a plain object");
471
522
  const type = own(v, "type");
472
523
  if (typeof type !== "string")
473
524
  return bad("type must be a string", "type");
@@ -476,9 +527,6 @@ const checkLocalSessionEvent = seatCheck((v) => {
476
527
  }
477
528
  if (typeof own(v, "sessionId") !== "string")
478
529
  return bad("sessionId must be a string", "sessionId");
479
- const messages = own(v, "messages");
480
- if (!isAbsent(messages) && !Array.isArray(messages))
481
- return bad("messages must be an array", "messages");
482
530
  if (!optionalString(own(v, "error")))
483
531
  return bad("error must be a string when present", "error");
484
532
  if (!optionalString(own(v, "errorCategory")))
@@ -492,20 +540,12 @@ const checkLocalSessionEvent = seatCheck((v) => {
492
540
  if (verdict !== true)
493
541
  return nested("request", verdict);
494
542
  }
495
- if (!optionalString(own(v, "data")))
496
- return bad("data must be a string when present", "data");
497
543
  const sources = own(v, "sources");
498
544
  if (!isAbsent(sources)) {
499
545
  const okSources = Array.isArray(sources) && ownItems(sources).every((t) => typeof t === "string");
500
546
  if (!okSources)
501
547
  return bad("sources must be a string[]", "sources");
502
548
  }
503
- const mode = own(v, "permissionMode");
504
- if (!isAbsent(mode)) {
505
- if (typeof mode !== "string" || !inTuple(PERMISSION_MODE_INTENTS, mode)) {
506
- return bad(`permissionMode must be one of ${PERMISSION_MODE_INTENTS.join("|")}`, "permissionMode");
507
- }
508
- }
509
549
  const session = own(v, "session");
510
550
  if (!isAbsent(session)) {
511
551
  const verdict = checkLocalSessionRecord(session);
@@ -514,10 +554,6 @@ const checkLocalSessionEvent = seatCheck((v) => {
514
554
  }
515
555
  if (!optionalString(own(v, "userMessageUuid")))
516
556
  return bad("userMessageUuid must be a string when present", "userMessageUuid");
517
- const hasPreClearSession = own(v, "hasPreClearSession");
518
- if (!isAbsent(hasPreClearSession) && typeof hasPreClearSession !== "boolean") {
519
- return bad("hasPreClearSession must be a boolean when present", "hasPreClearSession");
520
- }
521
557
  if (!optionalString(own(v, "requestId")))
522
558
  return bad("requestId must be a string when present", "requestId");
523
559
  const outcome = own(v, "outcome");
@@ -543,8 +579,8 @@ export function isLocalSessionEvent(v) {
543
579
  return checkLocalSessionEvent(v) === true;
544
580
  }
545
581
  const checkAttachmentUploadReceipt = seatCheck((v) => {
546
- if (!isObject(v))
547
- return bad("upload receipt is not an object");
582
+ if (!isPlainRecord(v))
583
+ return bad("upload receipt is not a plain object");
548
584
  if (typeof own(v, "id") !== "string")
549
585
  return bad("id must be a string", "id");
550
586
  if (typeof own(v, "name") !== "string")
@@ -560,43 +596,62 @@ const checkAttachmentUploadReceipt = seatCheck((v) => {
560
596
  export function isAttachmentUploadReceipt(v) {
561
597
  return checkAttachmentUploadReceipt(v) === true;
562
598
  }
599
+ export const APPLY_MODEL_CONFIG_REASONS = Object.freeze([
600
+ "shadowed_by_models_json",
601
+ "cheap_provider_unsupported",
602
+ "invalid_request",
603
+ "write_failed",
604
+ "unavailable",
605
+ ]);
606
+ const APPLY_MODEL_CONFIG_REASON_DETAILS = Object.freeze({
607
+ shadowed_by_models_json: "Models are managed in the local engine setup window on this device — open it to change the model (Engine ▸ Set up local engine…). Nothing was saved here.",
608
+ cheap_provider_unsupported: "The cheap model has to use the default model's provider on this desktop seat (same base URL, API and key). Nothing was saved.",
609
+ invalid_request: "The model configuration was not valid, so it was not applied.",
610
+ write_failed: "The model configuration could not be saved.",
611
+ unavailable: "The model configuration can't be changed from this app right now. Nothing was saved.",
612
+ });
613
+ export function applyModelConfigReasonDetail(reason) {
614
+ if (typeof reason === "string" && inTuple(APPLY_MODEL_CONFIG_REASONS, reason))
615
+ return APPLY_MODEL_CONFIG_REASON_DETAILS[reason];
616
+ return "The seat rejected this configuration.";
617
+ }
563
618
  const checkApplyModelConfigResult = seatCheck((v) => {
564
- if (!isObject(v))
565
- return bad("applyModelConfig result is not an object");
619
+ if (!isPlainRecord(v))
620
+ return bad("applyModelConfig result is not a plain object");
566
621
  const ok = own(v, "ok");
567
622
  if (typeof ok !== "boolean")
568
623
  return bad("ok must be a boolean", "ok");
569
624
  if (typeof own(v, "requiresRestart") !== "boolean")
570
625
  return bad("requiresRestart must be a boolean", "requiresRestart");
571
626
  const reason = own(v, "reason");
572
- if (ok === false && (typeof reason !== "string" || reason.length === 0)) {
573
- return bad("reason must be a non-empty string when ok is false", "reason");
627
+ if (!isAbsent(reason) && (typeof reason !== "string" || !inTuple(APPLY_MODEL_CONFIG_REASONS, reason))) {
628
+ return bad(`reason must be one of ${APPLY_MODEL_CONFIG_REASONS.join("|")} when present`, "reason");
629
+ }
630
+ if (ok === false && isAbsent(reason)) {
631
+ return bad(`reason must be present when ok is false (one of ${APPLY_MODEL_CONFIG_REASONS.join("|")})`, "reason");
574
632
  }
575
- if (reason !== undefined && typeof reason !== "string")
576
- return bad("reason must be a string when present", "reason");
633
+ if (!optionalString(own(v, "detail")))
634
+ return bad("detail must be a string when present", "detail");
577
635
  return true;
578
636
  });
579
637
  const checkLiveModelCatalog = seatCheck((v) => {
580
- if (!isObject(v) || Array.isArray(v))
581
- return bad("model catalog is not an object");
638
+ if (!isPlainRecord(v))
639
+ return bad("model catalog is not a plain object");
582
640
  const models = own(v, "models");
583
641
  if (!Array.isArray(models))
584
642
  return bad("models must be an array", "models");
585
643
  const rows = ownItems(models);
586
644
  const names = new Set();
587
645
  for (let i = 0; i < rows.length; i += 1) {
588
- const row = liveModelRowCopy(rows[i]);
646
+ const row = isPlainRecord(rows[i]) ? liveModelRowCopy(rows[i]) : undefined;
589
647
  if (row === undefined)
590
- return bad(`models[${i}] is not a catalog row (an object whose name is a non-empty string, JSON values only)`, `models[${i}]`);
648
+ return bad(`models[${i}] is not a catalog row (a plain object whose name is a non-empty string, JSON values only)`, `models[${i}]`);
591
649
  if (names.has(row.name))
592
650
  return bad(`models[${i}] repeats the name of an earlier row`, `models[${i}].name`);
593
651
  names.add(row.name);
594
652
  }
595
- const dflt = own(v, "default");
596
- if (typeof dflt !== "string" || dflt.length === 0)
597
- return bad("default must be a non-empty string", "default");
598
653
  const defaultModel = own(v, "defaultModel");
599
- if (!isAbsent(defaultModel) && liveDefaultModelCopy(defaultModel) === undefined) {
654
+ if (!isAbsent(defaultModel) && (!isPlainRecord(defaultModel) || liveDefaultModelCopy(defaultModel) === undefined)) {
600
655
  return bad("defaultModel must be {id: non-empty string, name?: non-empty string} when present", "defaultModel");
601
656
  }
602
657
  return true;
@@ -737,8 +792,8 @@ export function isSessionRowPatchRequest(v) {
737
792
  return checkSessionRowPatchRequest(v) === true;
738
793
  }
739
794
  const checkSendMessageAck = seatCheck((v) => {
740
- if (!isObject(v))
741
- return bad("sendMessage ack is not an object");
795
+ if (!isPlainRecord(v))
796
+ return bad("sendMessage ack is not a plain object");
742
797
  if (typeof own(v, "sessionId") !== "string")
743
798
  return bad("sessionId must be a string", "sessionId");
744
799
  if (typeof own(v, "userMessageUuid") !== "string")
@@ -751,13 +806,13 @@ const checkSendMessageAck = seatCheck((v) => {
751
806
  export function isSendMessageAck(v) {
752
807
  return checkSendMessageAck(v) === true;
753
808
  }
754
- const checkInterruptAck = seatCheck((v) => isObject(v) && typeof own(v, "interrupted") === "boolean" ? true : bad("interrupt ack needs boolean `interrupted`", "interrupted"));
755
- const checkStopAck = seatCheck((v) => isObject(v) && typeof own(v, "stopped") === "boolean" ? true : bad("stop ack needs boolean `stopped`", "stopped"));
756
- const checkOkAck = seatCheck((v) => isObject(v) && typeof own(v, "ok") === "boolean" ? true : bad("ack needs boolean `ok`", "ok"));
809
+ const checkInterruptAck = seatCheck((v) => isPlainRecord(v) && typeof own(v, "interrupted") === "boolean" ? true : bad("interrupt ack needs a plain object with boolean `interrupted`", "interrupted"));
810
+ const checkStopAck = seatCheck((v) => isPlainRecord(v) && typeof own(v, "stopped") === "boolean" ? true : bad("stop ack needs a plain object with boolean `stopped`", "stopped"));
811
+ const checkOkAck = seatCheck((v) => isPlainRecord(v) && typeof own(v, "ok") === "boolean" ? true : bad("ack needs a plain object with boolean `ok`", "ok"));
757
812
  const checkBooleanAck = (v) => typeof v === "boolean" ? true : bad("expected a bare boolean result");
758
813
  const checkGetTranscriptResult = seatCheck((v) => {
759
- if (!isObject(v))
760
- return bad("transcript envelope is not an object");
814
+ if (!isPlainRecord(v))
815
+ return bad("transcript envelope is not a plain object");
761
816
  if (typeof own(v, "sessionId") !== "string")
762
817
  return bad("sessionId must be a string", "sessionId");
763
818
  if (!Array.isArray(own(v, "messages")))
@@ -765,8 +820,8 @@ const checkGetTranscriptResult = seatCheck((v) => {
765
820
  return true;
766
821
  });
767
822
  const checkSessionSearchResult = seatCheck((v) => {
768
- if (!isObject(v))
769
- return bad("search result row is not an object");
823
+ if (!isPlainRecord(v))
824
+ return bad("search result row is not a plain object");
770
825
  if (typeof own(v, "sessionId") !== "string")
771
826
  return bad("sessionId must be a string", "sessionId");
772
827
  if (!optionalString(own(v, "title")))
@@ -774,14 +829,14 @@ const checkSessionSearchResult = seatCheck((v) => {
774
829
  const matches = own(v, "matches");
775
830
  if (!Array.isArray(matches))
776
831
  return bad("matches must be an array", "matches");
777
- const okMatches = ownItems(matches).every((m) => isObject(m) && typeof own(m, "snippet") === "string");
832
+ const okMatches = ownItems(matches).every((m) => isPlainRecord(m) && typeof own(m, "snippet") === "string");
778
833
  if (!okMatches)
779
834
  return bad("matches must be {snippet:string}[]", "matches");
780
835
  return true;
781
836
  });
782
837
  const checkSessionSearchEnvelope = seatCheck((v) => {
783
- if (!isObject(v))
784
- return bad("search envelope is not an object");
838
+ if (!isPlainRecord(v))
839
+ return bad("search envelope is not a plain object");
785
840
  const results = own(v, "results");
786
841
  if (!Array.isArray(results))
787
842
  return bad("results must be an array", "results");
@@ -794,8 +849,8 @@ const checkSessionSearchEnvelope = seatCheck((v) => {
794
849
  return true;
795
850
  });
796
851
  const checkSessionsState = seatCheck((v) => {
797
- if (!isObject(v))
798
- return bad("sessions state is not an object");
852
+ if (!isPlainRecord(v))
853
+ return bad("sessions state is not a plain object");
799
854
  const sessions = own(v, "sessions");
800
855
  if (!Array.isArray(sessions))
801
856
  return bad("sessions must be an array", "sessions");
@@ -808,8 +863,8 @@ const checkSessionsState = seatCheck((v) => {
808
863
  return true;
809
864
  });
810
865
  const checkFocusedSessionState = seatCheck((v) => {
811
- if (!isObject(v))
812
- return bad("focused session state is not an object");
866
+ if (!isPlainRecord(v))
867
+ return bad("focused session state is not a plain object");
813
868
  const sessionId = own(v, "sessionId");
814
869
  if (sessionId !== null && typeof sessionId !== "string") {
815
870
  return bad("sessionId must be a string or null", "sessionId");
@@ -855,10 +910,7 @@ const checkRecentFoldersResult = seatCheck((v) => {
855
910
  return true;
856
911
  });
857
912
  const checkSeatCapabilitiesState = seatCheck((v) => {
858
- if (!isObject(v) || Array.isArray(v))
859
- return bad("seat capabilities state is not an object");
860
- const proto = Object.getPrototypeOf(v);
861
- if (proto !== Object.prototype && proto !== null)
913
+ if (!isPlainRecord(v))
862
914
  return bad("seat capabilities state is not a plain object");
863
915
  for (const k of Reflect.ownKeys(v)) {
864
916
  const name = typeof k === "string" ? k : String(k);
@@ -936,21 +988,18 @@ export const LOCAL_SESSION_EVENT_KEYS = [
936
988
  "type",
937
989
  "sessionId",
938
990
  "message",
939
- "messages",
940
991
  "error",
941
992
  "errorCategory",
942
993
  "code",
943
994
  "request",
944
- "data",
945
995
  "sources",
946
- "permissionMode",
947
996
  "session",
948
997
  "userMessageUuid",
949
- "hasPreClearSession",
950
998
  "requestId",
951
999
  "outcome",
952
1000
  "parked",
953
1001
  "chrome",
1002
+ "_sema_turnFailure",
954
1003
  ];
955
1004
  export const TOOL_PERMISSION_REQUEST_KEYS = [
956
1005
  "requestId",
@@ -1083,17 +1132,13 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
1083
1132
  validated: [
1084
1133
  "type",
1085
1134
  "sessionId",
1086
- "messages",
1087
1135
  "error",
1088
1136
  "errorCategory",
1089
1137
  "code",
1090
1138
  "request",
1091
- "data",
1092
1139
  "sources",
1093
- "permissionMode",
1094
1140
  "session",
1095
1141
  "userMessageUuid",
1096
- "hasPreClearSession",
1097
1142
  "requestId",
1098
1143
  "outcome",
1099
1144
  "parked",
@@ -1104,6 +1149,10 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
1104
1149
  key: "message",
1105
1150
  why: "transcript 面直通位(CC fQe 逐字姿态:SDKMessage 体不做 schema 校验)—— 校它 = 引擎加一种消息体的那天整条转录被门吃掉。",
1106
1151
  },
1152
+ {
1153
+ key: "_sema_turnFailure",
1154
+ why: "turn 失败的呈现判决(CC-378 TK-9),核形在包读口 readSeatTurnFailure(坏形 / 表外类别词 ⇒ undefined、渲染端只渲 error 文本);出站门为它拒掉整条 error 事件 = 宿主 settle 照走、渲染端把失败轮渲成完成,所以门只登键不拒。",
1155
+ },
1107
1156
  ],
1108
1157
  },
1109
1158
  AttachmentUploadReceipt: {
@@ -1114,7 +1163,7 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
1114
1163
  },
1115
1164
  LiveModelCatalog: {
1116
1165
  check: checkLiveModelCatalog,
1117
- validated: ["models", "default", "defaultModel"],
1166
+ validated: ["models", "defaultModel"],
1118
1167
  unchecked: [
1119
1168
  {
1120
1169
  key: "droppedEntries",
@@ -1154,7 +1203,7 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
1154
1203
  },
1155
1204
  ApplyModelConfigResult: {
1156
1205
  check: checkApplyModelConfigResult,
1157
- validated: ["ok", "requiresRestart", "reason"],
1206
+ validated: ["ok", "requiresRestart", "reason", "detail"],
1158
1207
  unchecked: [],
1159
1208
  },
1160
1209
  SendMessageAck: {
@@ -1282,5 +1331,7 @@ const _seatContractPins = [
1282
1331
  true, true,
1283
1332
  true, true, true, true,
1284
1333
  true, true, true, true, true, true,
1334
+ true, true,
1335
+ true, true, true, true,
1285
1336
  ];
1286
1337
  void _seatContractPins;
@@ -10,10 +10,6 @@ export type SessionPolicyReading = {
10
10
  kind: 'present';
11
11
  };
12
12
  export declare function projectSessionPolicyCapability(caps: unknown): SessionPolicyReading | undefined;
13
- export declare function noteEngineCapsForSessionPolicy(baseUrl: string, caps: unknown, opts?: {
14
- generation?: number;
15
- }): void;
16
13
  export declare function observedSessionPolicy(baseUrl?: string | undefined): SessionPolicyReading;
17
14
  export declare function sessionPolicyFaceAvailable(reading: SessionPolicyReading): 'yes' | 'no' | 'unknown';
18
15
  export declare function sessionPolicyDoctorDetail(reading: SessionPolicyReading): string;
19
- export declare function __resetSessionPolicyReadingsForTests(): void;
@@ -21,9 +21,6 @@ const reader = createEngineCapReader({
21
21
  name: 'sessionPolicy',
22
22
  project: projectSessionPolicyCapability,
23
23
  });
24
- export function noteEngineCapsForSessionPolicy(baseUrl, caps, opts) {
25
- reader.note(baseUrl, caps, opts);
26
- }
27
24
  export function observedSessionPolicy(baseUrl = engineWireTarget()?.baseUrl) {
28
25
  return reader.observed(baseUrl);
29
26
  }
@@ -48,6 +45,3 @@ export function sessionPolicyDoctorDetail(reading) {
48
45
  return 'per-session rule face on — this session’s tool rules can be read, and a tightening write is accepted or refused by the engine call by call';
49
46
  }
50
47
  }
51
- export function __resetSessionPolicyReadingsForTests() {
52
- reader.__resetForTests();
53
- }
@@ -10,9 +10,6 @@ export type SessionSyncFileHistoryReading = {
10
10
  kind: 'present';
11
11
  };
12
12
  export declare function projectSessionSyncFileHistoryCapability(caps: unknown): SessionSyncFileHistoryReading | undefined;
13
- export declare function noteEngineCapsForSessionSyncFileHistory(baseUrl: string, caps: unknown, opts?: {
14
- generation?: number;
15
- }): void;
16
13
  export declare function observedSessionSyncFileHistory(baseUrl?: string | undefined): SessionSyncFileHistoryReading;
17
14
  export declare function sessionSyncFileHistoryAvailable(reading: SessionSyncFileHistoryReading): 'yes' | 'no' | 'unknown';
18
15
  export declare function sessionSyncFileHistoryDoctorDetail(reading: SessionSyncFileHistoryReading): string;
@@ -20,9 +20,6 @@ const reader = createEngineCapReader({
20
20
  name: 'sessionSyncFileHistory',
21
21
  project: projectSessionSyncFileHistoryCapability,
22
22
  });
23
- export function noteEngineCapsForSessionSyncFileHistory(baseUrl, caps, opts) {
24
- reader.note(baseUrl, caps, opts);
25
- }
26
23
  export function observedSessionSyncFileHistory(baseUrl = engineWireTarget()?.baseUrl) {
27
24
  return reader.observed(baseUrl);
28
25
  }
@@ -10,9 +10,6 @@ export type SkillToolListsReading = {
10
10
  kind: 'present';
11
11
  };
12
12
  export declare function projectSkillToolListsCapability(caps: unknown): SkillToolListsReading | undefined;
13
- export declare function noteEngineCapsForSkillToolLists(baseUrl: string, caps: unknown, opts?: {
14
- generation?: number;
15
- }): void;
16
13
  export declare function observedSkillToolLists(baseUrl?: string | undefined): SkillToolListsReading;
17
14
  export declare function skillToolListsAvailable(reading: SkillToolListsReading): 'yes' | 'no' | 'unknown';
18
15
  export declare function skillToolListsDoctorDetail(reading: SkillToolListsReading): string;
@@ -20,9 +20,6 @@ const reader = createEngineCapReader({
20
20
  name: 'skillToolLists',
21
21
  project: projectSkillToolListsCapability,
22
22
  });
23
- export function noteEngineCapsForSkillToolLists(baseUrl, caps, opts) {
24
- reader.note(baseUrl, caps, opts);
25
- }
26
23
  export function observedSkillToolLists(baseUrl = engineWireTarget()?.baseUrl) {
27
24
  return reader.observed(baseUrl);
28
25
  }
@@ -16,9 +16,5 @@ export type SqlEngineReading = {
16
16
  view: SqlEngineCapabilityView;
17
17
  };
18
18
  export declare function projectSqlEngineCapability(caps: unknown): SqlEngineReading | undefined;
19
- export declare function noteEngineCapsForSqlEngine(baseUrl: string, caps: unknown, opts?: {
20
- generation?: number;
21
- }): void;
22
19
  export declare function observedSqlEngine(baseUrl?: string | undefined): SqlEngineReading;
23
20
  export declare function sqlEngineDoctorDetail(reading: SqlEngineReading): string;
24
- export declare function __resetSqlEngineReadingsForTests(): void;
@@ -40,9 +40,6 @@ const reader = createEngineCapReader({
40
40
  name: 'sql',
41
41
  project: projectSqlEngineCapability,
42
42
  });
43
- export function noteEngineCapsForSqlEngine(baseUrl, caps, opts) {
44
- reader.note(baseUrl, caps, opts);
45
- }
46
43
  export function observedSqlEngine(baseUrl = engineWireTarget()?.baseUrl) {
47
44
  return reader.observed(baseUrl);
48
45
  }
@@ -72,6 +69,3 @@ export function sqlEngineDoctorDetail(reading) {
72
69
  }
73
70
  }
74
71
  }
75
- export function __resetSqlEngineReadingsForTests() {
76
- reader.__resetForTests();
77
- }
@@ -10,9 +10,6 @@ export type SteerPriorityReading = {
10
10
  };
11
11
  export type SteerPriorityMode = 'engine' | 'advisory' | 'unknown';
12
12
  export declare function projectSteerPriorityCapability(caps: unknown): SteerPriorityReading | undefined;
13
- export declare function noteEngineCapsForSteerPriority(baseUrl: string, caps: unknown, opts?: {
14
- generation?: number;
15
- }): void;
16
13
  export declare function observedSteerPriority(baseUrl?: string | undefined): SteerPriorityReading;
17
14
  export declare function steerPriorityMode(reading: SteerPriorityReading): SteerPriorityMode;
18
15
  export declare function steerPriorityDoctorDetail(reading: SteerPriorityReading): string;
@@ -26,9 +26,6 @@ const reader = createEngineCapReader({
26
26
  name: 'fleet.steerPriority',
27
27
  project: projectSteerPriorityCapability,
28
28
  });
29
- export function noteEngineCapsForSteerPriority(baseUrl, caps, opts) {
30
- reader.note(baseUrl, caps, opts);
31
- }
32
29
  export function observedSteerPriority(baseUrl = engineWireTarget()?.baseUrl) {
33
30
  return reader.observed(baseUrl);
34
31
  }
@@ -1,4 +1,8 @@
1
1
  import { type StreamDrainingDecision } from './wireErrorTriage.js';
2
+ export declare function drainingLegStep<F>(streak: number, frame: F): {
3
+ readonly decision: StreamDrainingDecision;
4
+ readonly streak: number;
5
+ };
2
6
  export interface StreamDrainingLegs<F> {
3
7
  see(frame: F): boolean;
4
8
  legEnded(how: 'returned' | 'threw'): StreamDrainingDecision | undefined;
@@ -1,4 +1,7 @@
1
1
  import { isInStreamDrainingEnd, streamDrainingDecision } from './wireErrorTriage.js';
2
+ export function drainingLegStep(streak, frame) {
3
+ return { decision: streamDrainingDecision(frame, streak), streak: streak + 1 };
4
+ }
2
5
  export function createStreamDrainingLegs() {
3
6
  let consecutive = 0;
4
7
  let drainEnd;
@@ -17,7 +20,9 @@ export function createStreamDrainingLegs() {
17
20
  drainEnd = undefined;
18
21
  if (how !== 'returned' || ended === undefined)
19
22
  return undefined;
20
- return streamDrainingDecision(ended.frame, consecutive++);
23
+ const step = drainingLegStep(consecutive, ended.frame);
24
+ consecutive = step.streak;
25
+ return step.decision;
21
26
  },
22
27
  };
23
28
  }
@@ -20,7 +20,6 @@ export type EngineCompactOutcome = {
20
20
  readonly kind: 'offline';
21
21
  };
22
22
  export declare function isEngineCompactPending(sessionKey?: string): boolean;
23
- export declare function resetManualCompactCapability(): void;
24
23
  export declare function __resetEngineCompactArmForTests(): void;
25
24
  export declare function requestEngineCompact(sessionKey?: string, opts?: {
26
25
  wire?: EngineCompactWire;