@sema-agent/client-core 0.94.0 → 0.96.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 (332) hide show
  1. package/CHANGELOG.md +521 -0
  2. package/README.md +104 -57
  3. package/dist/adapt/arms.js +12 -7
  4. package/dist/adapt/panelTasks.js +4 -10
  5. package/dist/adapt/toolCards.d.ts +1 -0
  6. package/dist/adapt/toolCards.js +18 -5
  7. package/dist/adapt/wireShapes.js +5 -24
  8. package/dist/adapter/activeRunSelfHeal.d.ts +12 -3
  9. package/dist/adapter/activeRunSelfHeal.js +50 -16
  10. package/dist/adapter/downstream/eventToSdkMessage.js +33 -18
  11. package/dist/adapter/downstream/terminalToSdkResult.js +19 -12
  12. package/dist/adapter/runStream.js +30 -46
  13. package/dist/adapter/types.d.ts +7 -0
  14. package/dist/adapter/types.js +15 -0
  15. package/dist/agentSession/backgroundView.js +5 -1
  16. package/dist/agentSession/engineAgentRegistryRead.js +7 -5
  17. package/dist/agentSession/engineSessionBackgroundStop.js +25 -17
  18. package/dist/agentsWireCaps.d.ts +2 -0
  19. package/dist/agentsWireCaps.js +13 -2
  20. package/dist/approvalDecidedByCapability.d.ts +0 -1
  21. package/dist/approvalDecidedByCapability.js +2 -7
  22. package/dist/approvalsStreamLiveCapability.d.ts +0 -1
  23. package/dist/approvalsStreamLiveCapability.js +2 -6
  24. package/dist/atMostOnce.d.ts +8 -0
  25. package/dist/atMostOnce.js +36 -0
  26. package/dist/attachmentSeatCapability.d.ts +0 -1
  27. package/dist/attachmentSeatCapability.js +0 -3
  28. package/dist/attachmentsWireCaps.js +11 -6
  29. package/dist/bashExitReading.d.ts +10 -0
  30. package/dist/bashExitReading.js +12 -0
  31. package/dist/callerCwdCapability.d.ts +0 -5
  32. package/dist/callerCwdCapability.js +2 -13
  33. package/dist/centerWiringCapability.d.ts +1 -7
  34. package/dist/centerWiringCapability.js +18 -27
  35. package/dist/classifierStatus.js +4 -4
  36. package/dist/classifierVerdictWire.js +4 -16
  37. package/dist/clientSlice.js +1 -1
  38. package/dist/cloudConfigWireCaps.d.ts +3 -3
  39. package/dist/cloudConfigWireCaps.js +85 -43
  40. package/dist/compensations.js +1 -1
  41. package/dist/coreValuePorts.d.ts +11 -7
  42. package/dist/coreValuePorts.js +5 -8
  43. package/dist/credentialProvenance.d.ts +28 -0
  44. package/dist/credentialProvenance.js +76 -0
  45. package/dist/cycleOrder.d.ts +15 -0
  46. package/dist/cycleOrder.js +45 -0
  47. package/dist/decideFailureNote.js +7 -2
  48. package/dist/decideReceipt.d.ts +2 -1
  49. package/dist/decideReceipt.js +39 -14
  50. package/dist/declared/supportFloorDeclared.d.ts +1 -0
  51. package/dist/declared/supportFloorDeclared.js +5 -0
  52. package/dist/deviceExecutorManagementCapability.d.ts +0 -1
  53. package/dist/deviceExecutorManagementCapability.js +7 -16
  54. package/dist/deviceRebind.d.ts +88 -0
  55. package/dist/deviceRebind.js +242 -0
  56. package/dist/displayUntrusted.d.ts +8 -3
  57. package/dist/displayUntrusted.js +661 -63
  58. package/dist/engineAgentAbsence.d.ts +2 -2
  59. package/dist/engineAgentPanelStore.d.ts +8 -18
  60. package/dist/engineAgentPanelStore.js +19 -537
  61. package/dist/engineCapReader.d.ts +6 -6
  62. package/dist/engineCapReader.js +30 -43
  63. package/dist/engineCapsCache.d.ts +13 -2
  64. package/dist/engineCapsCache.js +276 -44
  65. package/dist/engineCredentialRequirement.d.ts +9 -0
  66. package/dist/engineCredentialRequirement.js +23 -0
  67. package/dist/engineDirectory.d.ts +79 -0
  68. package/dist/engineDirectory.js +186 -0
  69. package/dist/engineEnvSourcing.d.ts +53 -0
  70. package/dist/engineEnvSourcing.js +81 -0
  71. package/dist/engineErrorCodes.d.ts +28 -4
  72. package/dist/engineErrorCodes.js +68 -25
  73. package/dist/engineIdentity.js +2 -0
  74. package/dist/engineNoticeCodes.d.ts +17 -0
  75. package/dist/engineNoticeCodes.js +57 -3
  76. package/dist/engineWireSdk.js +2 -2
  77. package/dist/engineWordRenames.d.ts +8 -0
  78. package/dist/engineWordRenames.js +13 -0
  79. package/dist/executionLaneCapability.d.ts +2 -3
  80. package/dist/executionLaneCapability.js +18 -23
  81. package/dist/fileHistoryCaptureCapability.d.ts +14 -1
  82. package/dist/fileHistoryCaptureCapability.js +72 -6
  83. package/dist/fileHistoryLegNotice.d.ts +3 -2
  84. package/dist/fileHistoryLegNotice.js +51 -2
  85. package/dist/fleet/bgSubagentRow.d.ts +15 -0
  86. package/dist/fleet/bgSubagentRow.js +67 -0
  87. package/dist/fleet/fleetLedger.d.ts +3 -0
  88. package/dist/fleet/fleetLedger.js +153 -122
  89. package/dist/fleet/fleetProjection.d.ts +1 -3
  90. package/dist/fleet/fleetProjection.js +19 -19
  91. package/dist/fleetAgentPanelProjection.d.ts +4 -17
  92. package/dist/fleetAgentPanelProjection.js +7 -197
  93. package/dist/fleetAgentRowLike.d.ts +16 -0
  94. package/dist/fleetAgentRowLike.js +1 -0
  95. package/dist/fleetTaskDesc.js +4 -17
  96. package/dist/gateOutcome.d.ts +12 -1
  97. package/dist/gateOutcome.js +87 -18
  98. package/dist/gateVocabulary.d.ts +7 -2
  99. package/dist/gateVocabulary.js +5 -1
  100. package/dist/generated/engineAskFaceTables.js +1 -1
  101. package/dist/generated/engineFactTables.d.ts +5 -3
  102. package/dist/generated/engineFactTables.js +17 -4
  103. package/dist/generated/engineNoticeTables.js +12 -3
  104. package/dist/generated/sdkFactTables.d.ts +2 -0
  105. package/dist/generated/sdkFactTables.js +17 -0
  106. package/dist/generated/settingsSchemaFns.d.ts +13 -0
  107. package/dist/generated/settingsSchemaFns.js +75 -0
  108. package/dist/generated/toolNameTables.d.ts +1 -0
  109. package/dist/generated/toolNameTables.js +1 -0
  110. package/dist/headlessPermissionModeWire.d.ts +1 -1
  111. package/dist/headlessPermissionModeWire.js +1 -1
  112. package/dist/headlessReconnectWire.js +49 -20
  113. package/dist/hitl/allowRuleShadow.d.ts +1 -1
  114. package/dist/hitl/allowRuleShadow.js +49 -8
  115. package/dist/hitl/approvalCompleteParked.d.ts +1 -0
  116. package/dist/hitl/approvalCompleteParked.js +14 -0
  117. package/dist/hitl/approvalEndingCause.d.ts +7 -0
  118. package/dist/hitl/approvalEndingCause.js +71 -0
  119. package/dist/hitl/approvalHolds.d.ts +12 -2
  120. package/dist/hitl/approvalHolds.js +53 -2
  121. package/dist/hitl/approvalsFeed.js +23 -11
  122. package/dist/hitl/askGateWire.d.ts +2 -1
  123. package/dist/hitl/askGateWire.js +26 -1
  124. package/dist/hitl/askParkRowRouting.js +1 -1
  125. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  126. package/dist/hitl/automaticAnswerVerdict.js +15 -10
  127. package/dist/hitl/crashConverged.js +2 -0
  128. package/dist/hitl/decisionConflict.d.ts +3 -0
  129. package/dist/hitl/decisionConflict.js +41 -0
  130. package/dist/hitl/decisionRefusal.d.ts +12 -0
  131. package/dist/hitl/decisionRefusal.js +63 -4
  132. package/dist/hitl/frameRouter.d.ts +0 -1
  133. package/dist/hitl/frameRouter.js +32 -57
  134. package/dist/hitl/gateLedger.d.ts +5 -0
  135. package/dist/hitl/gateLedger.js +21 -0
  136. package/dist/hitl/hitlBridge.d.ts +17 -2
  137. package/dist/hitl/hitlBridge.js +91 -55
  138. package/dist/hitl/hitlHostSurface.js +3 -11
  139. package/dist/hitl/livePendingAsk.d.ts +16 -6
  140. package/dist/hitl/livePendingAsk.js +36 -4
  141. package/dist/hitl/localAllowRule.d.ts +1 -0
  142. package/dist/hitl/localAllowRule.js +2 -2
  143. package/dist/hitl/noAllowCause.d.ts +2 -1
  144. package/dist/hitl/noAllowCause.js +3 -2
  145. package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
  146. package/dist/hitl/parkExpiryJudgements.js +46 -0
  147. package/dist/hitl/parkResolver.d.ts +4 -7
  148. package/dist/hitl/parkResolver.js +12 -34
  149. package/dist/hitl/parkRowBirthWait.d.ts +1 -0
  150. package/dist/hitl/parkRowBirthWait.js +2 -2
  151. package/dist/hitl/persistedRulesWire.js +5 -1
  152. package/dist/hitl/planReviewWire.d.ts +3 -2
  153. package/dist/hitl/planReviewWire.js +154 -50
  154. package/dist/hitl/replayedApproval.d.ts +9 -0
  155. package/dist/hitl/replayedApproval.js +139 -10
  156. package/dist/hitl/resumeRunningCard.d.ts +2 -0
  157. package/dist/hitl/resumeRunningCard.js +15 -4
  158. package/dist/hitl/sessionPolicyDeliverable.js +8 -6
  159. package/dist/hitl/standingRows.d.ts +18 -0
  160. package/dist/hitl/standingRows.js +127 -0
  161. package/dist/hitl/toolApprovalWire.d.ts +39 -7
  162. package/dist/hitl/toolApprovalWire.js +351 -61
  163. package/dist/hookMatcherVerdict.d.ts +1 -9
  164. package/dist/hookMatcherVerdict.js +21 -61
  165. package/dist/hooksWireCaps.js +40 -8
  166. package/dist/host.d.ts +5 -0
  167. package/dist/host.js +3 -1
  168. package/dist/hostCallbackGuard.d.ts +2 -0
  169. package/dist/hostCallbackGuard.js +31 -0
  170. package/dist/index.d.ts +48 -17
  171. package/dist/index.js +36 -15
  172. package/dist/interactiveInterrupt.d.ts +8 -0
  173. package/dist/interactiveInterrupt.js +54 -0
  174. package/dist/limitsWire.d.ts +5 -0
  175. package/dist/limitsWire.js +49 -3
  176. package/dist/liveModelCatalog.d.ts +95 -0
  177. package/dist/liveModelCatalog.js +297 -32
  178. package/dist/mcpEngineLeg.d.ts +25 -0
  179. package/dist/mcpEngineLeg.js +71 -15
  180. package/dist/mcpPanel.js +2 -1
  181. package/dist/mcpProbeCapability.d.ts +0 -5
  182. package/dist/mcpProbeCapability.js +2 -12
  183. package/dist/mcpReconnect.d.ts +1 -3
  184. package/dist/mcpReconnect.js +10 -5
  185. package/dist/memoryComplianceCapability.d.ts +0 -5
  186. package/dist/memoryComplianceCapability.js +2 -12
  187. package/dist/memoryOriginCapability.d.ts +0 -5
  188. package/dist/memoryOriginCapability.js +2 -12
  189. package/dist/memorySpecWire.js +2 -2
  190. package/dist/memoryVerbsWire.d.ts +1 -1
  191. package/dist/memoryVerbsWire.js +4 -0
  192. package/dist/model/liveCatalogShape.d.ts +14 -0
  193. package/dist/model/liveCatalogShape.js +71 -0
  194. package/dist/model/modelSupplyRules.d.ts +1 -0
  195. package/dist/model/modelSupplyRules.js +30 -9
  196. package/dist/model/modelsPolicy.d.ts +21 -0
  197. package/dist/model/modelsPolicy.js +90 -0
  198. package/dist/modelIdentityResolvability.d.ts +2 -2
  199. package/dist/modelIdentityResolvability.js +14 -12
  200. package/dist/modelSwitchFallback.d.ts +69 -0
  201. package/dist/modelSwitchFallback.js +206 -0
  202. package/dist/noticePresentation.d.ts +68 -0
  203. package/dist/noticePresentation.js +247 -0
  204. package/dist/notifications.js +12 -11
  205. package/dist/outputStyleSeatCapability.d.ts +0 -2
  206. package/dist/outputStyleSeatCapability.js +2 -10
  207. package/dist/ownKey.d.ts +8 -0
  208. package/dist/ownKey.js +66 -0
  209. package/dist/panelReduce.d.ts +114 -0
  210. package/dist/panelReduce.js +1135 -0
  211. package/dist/panelStateHolder.d.ts +17 -0
  212. package/dist/panelStateHolder.js +201 -0
  213. package/dist/peerFrames.js +13 -9
  214. package/dist/peerLaneCapability.d.ts +0 -1
  215. package/dist/peerLaneCapability.js +2 -6
  216. package/dist/permissionModesCapability.d.ts +0 -5
  217. package/dist/permissionModesCapability.js +5 -16
  218. package/dist/permissionRuleIssue.js +0 -3
  219. package/dist/permissionRulesWriteCapability.d.ts +0 -1
  220. package/dist/permissionRulesWriteCapability.js +2 -6
  221. package/dist/permissionsAllowGrantCapability.d.ts +0 -1
  222. package/dist/permissionsAllowGrantCapability.js +3 -9
  223. package/dist/permissionsDeclaration.d.ts +8 -0
  224. package/dist/permissionsDeclaration.js +101 -41
  225. package/dist/printPermissionOutcome.d.ts +12 -0
  226. package/dist/printPermissionOutcome.js +50 -0
  227. package/dist/printToolResultFrame.d.ts +1 -0
  228. package/dist/printToolResultFrame.js +5 -17
  229. package/dist/promptBlockedCopy.d.ts +5 -0
  230. package/dist/promptBlockedCopy.js +35 -0
  231. package/dist/promptDelivery.js +0 -8
  232. package/dist/protocolSegment.d.ts +9 -6
  233. package/dist/protocolSegment.js +31 -21
  234. package/dist/providerRejection.d.ts +4 -0
  235. package/dist/providerRejection.js +75 -14
  236. package/dist/replayBody.d.ts +12 -0
  237. package/dist/replayBody.js +25 -0
  238. package/dist/resumeRefusalCopy.d.ts +18 -1
  239. package/dist/resumeRefusalCopy.js +127 -32
  240. package/dist/retryStatus.d.ts +9 -1
  241. package/dist/retryStatus.js +9 -2
  242. package/dist/rewindArchiveCapability.d.ts +5 -14
  243. package/dist/rewindArchiveCapability.js +18 -61
  244. package/dist/rewindArchiveReading.d.ts +15 -0
  245. package/dist/rewindArchiveReading.js +56 -0
  246. package/dist/rewindEngineAction.d.ts +21 -0
  247. package/dist/rewindEngineAction.js +36 -0
  248. package/dist/rewindWireCaps.d.ts +2 -1
  249. package/dist/rewindWireCaps.js +1 -0
  250. package/dist/ruleCompileVerdict.d.ts +9 -1
  251. package/dist/ruleCompileVerdict.js +29 -4
  252. package/dist/runTerminal.d.ts +15 -12
  253. package/dist/runTerminal.js +60 -35
  254. package/dist/sandboxWire.js +13 -0
  255. package/dist/sdkRegistryTransit.d.ts +2 -1
  256. package/dist/sdkRegistryTransit.js +1 -0
  257. package/dist/sealedKeyCapability.d.ts +0 -5
  258. package/dist/sealedKeyCapability.js +3 -15
  259. package/dist/seam.js +4 -2
  260. package/dist/seatContract.d.ts +125 -34
  261. package/dist/seatContract.js +583 -179
  262. package/dist/sessionIdSegment.d.ts +1 -0
  263. package/dist/sessionIdSegment.js +11 -0
  264. package/dist/sessionMemoryErase.d.ts +1 -1
  265. package/dist/sessionMemoryErase.js +6 -1
  266. package/dist/sessionMemoryStatus.js +3 -2
  267. package/dist/sessionPolicyCapability.d.ts +0 -1
  268. package/dist/sessionPolicyCapability.js +2 -6
  269. package/dist/sessionReadRedactionCapability.d.ts +0 -5
  270. package/dist/sessionReadRedactionCapability.js +2 -13
  271. package/dist/sessionSyncFileHistory.d.ts +4 -0
  272. package/dist/sessionSyncFileHistory.js +66 -0
  273. package/dist/sessionSyncFileHistoryCapability.d.ts +0 -2
  274. package/dist/sessionSyncFileHistoryCapability.js +2 -9
  275. package/dist/skillToolListsCapability.d.ts +0 -2
  276. package/dist/skillToolListsCapability.js +2 -9
  277. package/dist/skillsWireCaps.d.ts +4 -0
  278. package/dist/skillsWireCaps.js +66 -1
  279. package/dist/sqlEngineCapability.d.ts +0 -1
  280. package/dist/sqlEngineCapability.js +9 -14
  281. package/dist/steerPriorityCapability.d.ts +0 -2
  282. package/dist/steerPriorityCapability.js +3 -12
  283. package/dist/storePostureCapability.d.ts +1 -5
  284. package/dist/storePostureCapability.js +16 -22
  285. package/dist/streamDrainingLegs.d.ts +6 -0
  286. package/dist/streamDrainingLegs.js +23 -0
  287. package/dist/subagent/engineCompactWire.js +13 -38
  288. package/dist/subagent/engineDelegatedPrompt.js +10 -6
  289. package/dist/subagent/engineSubagentOutput.d.ts +0 -1
  290. package/dist/subagent/engineSubagentOutput.js +5 -20
  291. package/dist/subagent/engineSubagentSteer.js +7 -5
  292. package/dist/subagent/engineSubagentTail.d.ts +0 -1
  293. package/dist/subagent/engineSubagentTail.js +7 -32
  294. package/dist/subagentContentStore.js +7 -18
  295. package/dist/supportFloor.d.ts +1 -0
  296. package/dist/supportFloor.js +15 -14
  297. package/dist/systemReminderTag.d.ts +1 -0
  298. package/dist/systemReminderTag.js +8 -0
  299. package/dist/terminalStatuses.d.ts +30 -0
  300. package/dist/terminalStatuses.js +67 -0
  301. package/dist/toolHistoryMismatch.d.ts +0 -3
  302. package/dist/toolHistoryMismatch.js +3 -7
  303. package/dist/toolResult.d.ts +6 -1
  304. package/dist/toolResult.js +90 -37
  305. package/dist/toolResultContent.d.ts +2 -0
  306. package/dist/toolResultContent.js +63 -0
  307. package/dist/types/engineState.d.ts +2 -1
  308. package/dist/usageAnalytics.d.ts +146 -0
  309. package/dist/usageAnalytics.js +335 -0
  310. package/dist/userInvokedSkillsCapability.d.ts +0 -2
  311. package/dist/userInvokedSkillsCapability.js +2 -9
  312. package/dist/webSearchBackendCapability.d.ts +0 -1
  313. package/dist/webSearchBackendCapability.js +3 -7
  314. package/dist/webSearchWireCaps.js +3 -11
  315. package/dist/wireErrorTriage.d.ts +2 -0
  316. package/dist/wireErrorTriage.js +34 -5
  317. package/dist/wireFailureShape.d.ts +23 -2
  318. package/dist/wireFailureShape.js +88 -43
  319. package/dist/wireRefusalCopy.js +2 -18
  320. package/dist/workflowClient.js +7 -11
  321. package/dist/workflowsJournalCapability.d.ts +0 -1
  322. package/dist/workflowsJournalCapability.js +2 -6
  323. package/dist/writeProtectionCapability.d.ts +0 -1
  324. package/dist/writeProtectionCapability.js +5 -10
  325. package/docs/INTEGRATION-CLIENTS.md +2279 -27
  326. package/package.json +5 -5
  327. package/dist/engineCapsGenerationGuard.d.ts +0 -4
  328. package/dist/engineCapsGenerationGuard.js +0 -19
  329. package/dist/panelRunningHistory.d.ts +0 -22
  330. package/dist/panelRunningHistory.js +0 -82
  331. package/dist/registryConflict.d.ts +0 -3
  332. package/dist/registryConflict.js +0 -44
@@ -0,0 +1,17 @@
1
+ import type { EngineAgentPanelAbsence, EngineAgentPanelEvent } from './engineAgentPanelStore.js';
2
+ import { type PanelDelta, type PanelFrame, type PanelReduceState } from './panelReduce.js';
3
+ export declare function panelStateNow(): PanelReduceState;
4
+ export declare function stepEnginePanel(frame: PanelFrame): void;
5
+ export declare function replaceEnginePanelState(fn: (s: PanelReduceState) => PanelReduceState): void;
6
+ export declare function clearEnginePanelIdentity(): void;
7
+ export declare function clearEnginePanelAnchors(): void;
8
+ export declare function resetEnginePanelHolder(): void;
9
+ type Listener = (ev: EngineAgentPanelEvent) => void;
10
+ export declare function subscribeLegacyEvents(fn: Listener): () => void;
11
+ type AbsenceListener = (ev: EngineAgentPanelAbsence) => void;
12
+ export declare function subscribeAbsence(fn: AbsenceListener): () => void;
13
+ export declare function resetAbsenceChannel(): void;
14
+ type RowListener = (d: PanelDelta) => void;
15
+ export declare function subscribeRows(fn: RowListener): () => void;
16
+ export declare function clearEnginePanelRows(): void;
17
+ export {};
@@ -0,0 +1,201 @@
1
+ import { createPanelReduceState, isNewEngineAgentPanelCycle, panelClearAnchors, panelClearIdentity, panelClearRows, panelRowSnapshot, stepPanelFrame, } from './panelReduce.js';
2
+ let state = createPanelReduceState();
3
+ export function panelStateNow() {
4
+ return state;
5
+ }
6
+ export function stepEnginePanel(frame) {
7
+ const r = stepPanelFrame(state, frame);
8
+ state = r.state;
9
+ if (rowListener !== null)
10
+ rowQueue.push(...r.deltas);
11
+ for (const f of r.facts) {
12
+ if (f.ch === 'event')
13
+ deliverLegacyEvent(f.ev);
14
+ else
15
+ deliverAbsence(f.absence);
16
+ }
17
+ drainRows();
18
+ }
19
+ export function replaceEnginePanelState(fn) {
20
+ state = fn(state);
21
+ }
22
+ export function clearEnginePanelIdentity() {
23
+ state = panelClearIdentity(state);
24
+ }
25
+ export function clearEnginePanelAnchors() {
26
+ state = panelClearAnchors(state);
27
+ }
28
+ export function resetEnginePanelHolder() {
29
+ state = createPanelReduceState();
30
+ listener = null;
31
+ buffer.length = 0;
32
+ absenceListener = null;
33
+ absenceBuffer.clear();
34
+ rowListener = null;
35
+ rowQueue.length = 0;
36
+ }
37
+ const MAX_BUFFER = 200;
38
+ let listener = null;
39
+ const buffer = [];
40
+ function launchAnchorChanged(prev, next) {
41
+ if (prev.kind !== 'fleet-row' || next.kind !== 'fleet-row')
42
+ return false;
43
+ return isNewEngineAgentPanelCycle(prev, next);
44
+ }
45
+ function deliverLegacyEvent(ev) {
46
+ if (ev.kind !== 'sweep')
47
+ absenceBuffer.delete(ev.taskId);
48
+ if (listener) {
49
+ try {
50
+ listener(ev);
51
+ }
52
+ catch {
53
+ }
54
+ return;
55
+ }
56
+ if (ev.kind === 'sweep' && buffer.length > 0 && buffer[buffer.length - 1]?.kind === 'sweep')
57
+ return;
58
+ const progress = ev.kind === 'tick' || ev.kind === 'fleet-row';
59
+ if (progress) {
60
+ const kind = ev.kind;
61
+ const taskId = ev.taskId;
62
+ let i = -1;
63
+ for (let at = buffer.length - 1; at >= 0; at--) {
64
+ const b = buffer[at];
65
+ if (b === undefined)
66
+ continue;
67
+ if (b.kind === 'sweep')
68
+ break;
69
+ if (b.kind === 'end') {
70
+ if (b.taskId === taskId)
71
+ break;
72
+ continue;
73
+ }
74
+ if (b.taskId !== taskId)
75
+ continue;
76
+ if (b.kind === kind && !launchAnchorChanged(b, ev))
77
+ i = at;
78
+ break;
79
+ }
80
+ if (i >= 0) {
81
+ const merged = { ...buffer[i], ...ev };
82
+ buffer.splice(i, 1);
83
+ buffer.push(merged);
84
+ return;
85
+ }
86
+ }
87
+ if (buffer.length < MAX_BUFFER) {
88
+ buffer.push(ev);
89
+ return;
90
+ }
91
+ const evictAt = buffer.findIndex(b => b.kind === 'tick' || b.kind === 'fleet-row');
92
+ if (evictAt >= 0) {
93
+ buffer.splice(evictAt, 1);
94
+ buffer.push(ev);
95
+ return;
96
+ }
97
+ buffer.shift();
98
+ buffer.push(ev);
99
+ }
100
+ export function subscribeLegacyEvents(fn) {
101
+ listener = fn;
102
+ if (buffer.length > 0) {
103
+ const pending = buffer.splice(0, buffer.length);
104
+ for (const ev of pending) {
105
+ try {
106
+ fn(ev);
107
+ }
108
+ catch {
109
+ }
110
+ }
111
+ }
112
+ return () => {
113
+ if (listener === fn)
114
+ listener = null;
115
+ };
116
+ }
117
+ const MAX_ABSENCE_BUFFER = 200;
118
+ let absenceListener = null;
119
+ const absenceBuffer = new Map();
120
+ function deliverAbsence(ev) {
121
+ if (absenceListener) {
122
+ try {
123
+ absenceListener(ev);
124
+ }
125
+ catch {
126
+ }
127
+ return;
128
+ }
129
+ absenceBuffer.delete(ev.taskId);
130
+ absenceBuffer.set(ev.taskId, ev);
131
+ if (absenceBuffer.size > MAX_ABSENCE_BUFFER) {
132
+ const oldest = absenceBuffer.keys().next().value;
133
+ if (oldest !== undefined)
134
+ absenceBuffer.delete(oldest);
135
+ }
136
+ }
137
+ export function subscribeAbsence(fn) {
138
+ absenceListener = fn;
139
+ if (absenceBuffer.size > 0) {
140
+ const pending = [...absenceBuffer.values()];
141
+ absenceBuffer.clear();
142
+ for (const ev of pending) {
143
+ try {
144
+ fn(ev);
145
+ }
146
+ catch {
147
+ }
148
+ }
149
+ }
150
+ return () => {
151
+ if (absenceListener === fn)
152
+ absenceListener = null;
153
+ };
154
+ }
155
+ export function resetAbsenceChannel() {
156
+ absenceListener = null;
157
+ absenceBuffer.clear();
158
+ }
159
+ let rowListener = null;
160
+ const rowQueue = [];
161
+ let rowDraining = false;
162
+ function drainRows() {
163
+ if (rowListener === null) {
164
+ rowQueue.length = 0;
165
+ return;
166
+ }
167
+ if (rowDraining)
168
+ return;
169
+ rowDraining = true;
170
+ try {
171
+ while (rowQueue.length > 0) {
172
+ const d = rowQueue.shift();
173
+ const fn = rowListener;
174
+ if (fn === null) {
175
+ rowQueue.length = 0;
176
+ break;
177
+ }
178
+ try {
179
+ fn(d);
180
+ }
181
+ catch {
182
+ }
183
+ }
184
+ }
185
+ finally {
186
+ rowDraining = false;
187
+ }
188
+ }
189
+ export function subscribeRows(fn) {
190
+ rowListener = fn;
191
+ rowQueue.length = 0;
192
+ rowQueue.push(...panelRowSnapshot(state));
193
+ drainRows();
194
+ return () => {
195
+ if (rowListener === fn)
196
+ rowListener = null;
197
+ };
198
+ }
199
+ export function clearEnginePanelRows() {
200
+ state = panelClearRows(state);
201
+ }
@@ -1,4 +1,4 @@
1
- import { applyDisplayFace, LEGACY_NAME_FACE } from './displayUntrusted.js';
1
+ import { applyDisplayFace, PEER_NAME_FACE } from './displayUntrusted.js';
2
2
  import { CORE_ENGINE_AUTHORITY_ENVELOPE_TAGS, CORE_PERMISSION_MODE_CLASSES } from './generated/engineFactTables.js';
3
3
  const WIRE_KEY_FROM = 'from';
4
4
  const WIRE_KEY_BODY = 'body';
@@ -42,14 +42,16 @@ function nonEmptyString(v) {
42
42
  function finiteNumber(v) {
43
43
  return typeof v === 'number' && Number.isFinite(v) ? v : undefined;
44
44
  }
45
- function provenanceAgrees(n, lane, carrierFrom) {
45
+ function provenanceAgrees(n, lane, carrierFromRaw) {
46
46
  const prov = dataProp(n, WIRE_KEY_PROVENANCE);
47
47
  if (prov === null || typeof prov !== 'object')
48
48
  return false;
49
49
  if (dataProp(prov, WIRE_KEY_KIND) !== lane)
50
50
  return false;
51
- const provFrom = cleanName(dataProp(prov, WIRE_KEY_FROM));
52
- if (provFrom === undefined || (carrierFrom !== undefined && provFrom !== carrierFrom))
51
+ const provFromRaw = dataProp(prov, WIRE_KEY_FROM);
52
+ if (typeof provFromRaw !== 'string' || cleanName(provFromRaw) === undefined)
53
+ return false;
54
+ if (carrierFromRaw !== undefined && provFromRaw !== carrierFromRaw)
53
55
  return false;
54
56
  const taskId = nonEmptyString(dataProp(n, WIRE_KEY_TASK_ID));
55
57
  if (taskId === undefined || nonEmptyString(dataProp(prov, WIRE_KEY_PROV_TASK_ID)) !== taskId)
@@ -61,9 +63,10 @@ export function classifyPeerNotification(n) {
61
63
  const seq = finiteNumber(dataProp(n, WIRE_KEY_SEQ));
62
64
  const agentMessage = dataProp(n, WIRE_KEY_AGENT_MESSAGE);
63
65
  if (agentMessage !== undefined) {
64
- const from = cleanName(dataProp(agentMessage, WIRE_KEY_FROM));
66
+ const fromRaw = dataProp(agentMessage, WIRE_KEY_FROM);
67
+ const from = cleanName(fromRaw);
65
68
  const body = dataProp(agentMessage, WIRE_KEY_BODY);
66
- if (from !== undefined && typeof body === 'string' && provenanceAgrees(n, 'agent_message', from)) {
69
+ if (from !== undefined && typeof fromRaw === 'string' && typeof body === 'string' && provenanceAgrees(n, 'agent_message', fromRaw)) {
67
70
  const agentType = nonEmptyString(dataProp(dataProp(n, WIRE_KEY_PROVENANCE), WIRE_KEY_AGENT_TYPE));
68
71
  return {
69
72
  lane: 'agent_message',
@@ -77,9 +80,10 @@ export function classifyPeerNotification(n) {
77
80
  }
78
81
  const crossSessionMessage = dataProp(n, WIRE_KEY_CROSS_SESSION_MESSAGE);
79
82
  if (crossSessionMessage !== undefined) {
80
- const from = cleanName(dataProp(crossSessionMessage, WIRE_KEY_FROM));
83
+ const fromRaw = dataProp(crossSessionMessage, WIRE_KEY_FROM);
84
+ const from = cleanName(fromRaw);
81
85
  const body = dataProp(crossSessionMessage, WIRE_KEY_BODY);
82
- if (from === undefined || typeof body !== 'string' || !provenanceAgrees(n, 'cross_session_message', from))
86
+ if (from === undefined || typeof fromRaw !== 'string' || typeof body !== 'string' || !provenanceAgrees(n, 'cross_session_message', fromRaw))
83
87
  return null;
84
88
  const fromSession = nonEmptyString(dataProp(crossSessionMessage, WIRE_KEY_FROM_SESSION));
85
89
  const fromName = cleanName(dataProp(crossSessionMessage, WIRE_KEY_FROM_NAME));
@@ -117,7 +121,7 @@ function neutralizeAuthorityTags(text) {
117
121
  function cleanName(v) {
118
122
  if (typeof v !== 'string')
119
123
  return undefined;
120
- const t = applyDisplayFace(v, LEGACY_NAME_FACE);
124
+ const t = applyDisplayFace(v, PEER_NAME_FACE);
121
125
  return t.length > 0 ? t : undefined;
122
126
  }
123
127
  function escapeEnvelopeTag(tag, text) {
@@ -14,5 +14,4 @@ export declare function noteEngineCapsForPeerLane(baseUrl: string, caps: unknown
14
14
  export declare function observedPeerLane(baseUrl?: string | undefined): PeerLaneReading;
15
15
  export declare function peerLaneAvailable(reading: PeerLaneReading): 'yes' | 'no' | 'unknown';
16
16
  export declare function peerLaneDoctorDetail(reading: PeerLaneReading): string;
17
- export declare function forgetPeerLaneReading(baseUrl: string | undefined): void;
18
17
  export declare function __resetPeerLaneReadingsForTests(): void;
@@ -1,14 +1,13 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
+ import { ownDataField } from './ownKey.js';
3
4
  export function projectPeerLaneCapability(caps) {
4
5
  try {
5
6
  if (caps === null || typeof caps !== 'object')
6
7
  return undefined;
7
8
  if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
8
9
  return undefined;
9
- if (!Object.hasOwn(caps, 'peerLane'))
10
- return { kind: 'not_reported' };
11
- const v = caps.peerLane;
10
+ const v = ownDataField(caps, 'peerLane');
12
11
  if (v === undefined)
13
12
  return { kind: 'not_reported' };
14
13
  if (typeof v !== 'boolean')
@@ -49,9 +48,6 @@ export function peerLaneDoctorDetail(reading) {
49
48
  return 'cross-session lane on — this engine can discover and deliver across sessions for the same caller';
50
49
  }
51
50
  }
52
- export function forgetPeerLaneReading(baseUrl) {
53
- reader.forget(baseUrl);
54
- }
55
51
  export function __resetPeerLaneReadingsForTests() {
56
52
  reader.__resetForTests();
57
53
  }
@@ -7,10 +7,5 @@ export type PermissionModesReading = {
7
7
  modes: readonly string[];
8
8
  };
9
9
  export declare function projectPermissionModesCapability(caps: unknown): PermissionModesReading | undefined;
10
- export declare function noteEngineCapsForPermissionModes(baseUrl: string, caps: unknown, opts?: {
11
- generation?: number;
12
- }): void;
13
10
  export declare function observedPermissionModes(baseUrl?: string | undefined): PermissionModesReading;
14
11
  export declare function permissionModeAdmitted(reading: PermissionModesReading | undefined, mode: string): boolean;
15
- export declare function forgetPermissionModesReading(baseUrl: string | undefined): void;
16
- export declare function __resetPermissionModesReadingsForTests(): void;
@@ -1,16 +1,16 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
- import { readOwnDataValue } from './ownKey.js';
3
+ import { ownDataField, readOwnDataValue } from './ownKey.js';
4
4
  function readModesStrict(v) {
5
5
  try {
6
6
  if (!Array.isArray(v))
7
7
  return undefined;
8
- const length = v.length;
9
- if (length === 0)
8
+ const length = ownDataField(v, 'length');
9
+ if (typeof length !== 'number' || length === 0)
10
10
  return undefined;
11
11
  const modes = [];
12
12
  for (let i = 0; i < length; i++) {
13
- const item = readOwnDataValue(v, String(i));
13
+ const item = ownDataField(v, String(i));
14
14
  if (typeof item !== 'string' || item.length === 0)
15
15
  return undefined;
16
16
  modes.push(item);
@@ -25,9 +25,7 @@ export function projectPermissionModesCapability(caps) {
25
25
  try {
26
26
  if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
27
27
  return undefined;
28
- if (!Object.hasOwn(caps, 'permissionModes'))
29
- return { kind: 'not_reported' };
30
- const v = caps.permissionModes;
28
+ const v = ownDataField(caps, 'permissionModes');
31
29
  if (v === undefined)
32
30
  return { kind: 'not_reported' };
33
31
  const modes = readModesStrict(v);
@@ -42,9 +40,6 @@ const reader = createEngineCapReader({
42
40
  project: projectPermissionModesCapability,
43
41
  makeUnobserved: () => ({ kind: 'unobserved' }),
44
42
  });
45
- export function noteEngineCapsForPermissionModes(baseUrl, caps, opts) {
46
- reader.note(baseUrl, caps, opts);
47
- }
48
43
  export function observedPermissionModes(baseUrl = engineWireTarget()?.baseUrl) {
49
44
  return reader.observed(baseUrl);
50
45
  }
@@ -63,9 +58,3 @@ export function permissionModeAdmitted(reading, mode) {
63
58
  return false;
64
59
  }
65
60
  }
66
- export function forgetPermissionModesReading(baseUrl) {
67
- reader.forget(baseUrl);
68
- }
69
- export function __resetPermissionModesReadingsForTests() {
70
- reader.__resetForTests();
71
- }
@@ -34,9 +34,6 @@ const ISSUE_SENTENCES = Object.freeze({
34
34
  'unsupported.path_base': 'this path rule is not supported as spelled: the base it is relative to is missing or is not a usable absolute path, so it would reach nothing and is refused rather than compiled',
35
35
  'unsupported.mcp_paren': 'a parenthesised parameter rule is not supported on an MCP tool name',
36
36
  'unsupported.covering_paren': 'a parenthesised parameter rule is not supported on a covering protocol name — the parameter grammar is keyed by an exact tool name, so no mounted tool could ever bear it',
37
- 'invalid.allow_param_rule': 'this rule is invalid: an allow rule cannot carry a parameter pattern — only bare tool rules auto-allow',
38
- 'unsupported.bash_prefix': 'a standing approval for a command belongs in the persisted-rule store, so this allow rule is not supported here (deny and ask rules with the same shape do compile)',
39
- 'unsupported.file_glob': 'a standing approval by path belongs in the consent store, so this allow rule is not supported here (deny and ask path rules do compile)',
40
37
  });
41
38
  const PARAM_SPLIT_WITH_COLON = 'this rule is invalid: a parameter rule is written name:pattern, and the name before the colon or the pattern after it is empty';
42
39
  const PARAM_SPLIT_NO_COLON = 'this rule is invalid: there is no colon inside the parentheses, so this is not a parameter rule (a parameter rule is written name:pattern)';
@@ -14,5 +14,4 @@ export declare function noteEngineCapsForPermissionRulesWrite(baseUrl: string, c
14
14
  export declare function observedPermissionRulesWrite(baseUrl?: string | undefined): PermissionRulesWriteReading;
15
15
  export declare function permissionRulesWriteAvailable(reading: PermissionRulesWriteReading): boolean;
16
16
  export declare function permissionRulesWriteDoctorDetail(reading: PermissionRulesWriteReading): string;
17
- export declare function forgetPermissionRulesWriteReading(baseUrl: string | undefined): void;
18
17
  export declare function __resetPermissionRulesWriteReadingsForTests(): void;
@@ -1,14 +1,13 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
+ import { ownDataField } from './ownKey.js';
3
4
  export function projectPermissionRulesWriteCapability(caps) {
4
5
  try {
5
6
  if (caps === null || typeof caps !== 'object')
6
7
  return undefined;
7
8
  if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
8
9
  return undefined;
9
- if (!Object.hasOwn(caps, 'permissionRulesWrite'))
10
- return { kind: 'not_reported' };
11
- const v = caps.permissionRulesWrite;
10
+ const v = ownDataField(caps, 'permissionRulesWrite');
12
11
  if (v === undefined)
13
12
  return { kind: 'not_reported' };
14
13
  if (typeof v !== 'boolean')
@@ -45,9 +44,6 @@ export function permissionRulesWriteDoctorDetail(reading) {
45
44
  return 'permission-rule write entry reachable for this call — a per-call attempt still answers for itself whether the direction, text, and scope are accepted';
46
45
  }
47
46
  }
48
- export function forgetPermissionRulesWriteReading(baseUrl) {
49
- reader.forget(baseUrl);
50
- }
51
47
  export function __resetPermissionRulesWriteReadingsForTests() {
52
48
  reader.__resetForTests();
53
49
  }
@@ -16,5 +16,4 @@ export declare function permissionsAllowGrantAvailable(reading: PermissionsAllow
16
16
  export declare function allowWireForm(reading: PermissionsAllowGrantReading): 'layer' | 'grant' | 'off';
17
17
  export declare function allowRulesGate(reading: PermissionsAllowGrantReading, settingsRead: 'clean' | 'partial' | 'unreadable' | undefined): 'open' | 'capability_off' | 'settings_read_not_clean';
18
18
  export declare function permissionsAllowGrantDoctorDetail(reading: PermissionsAllowGrantReading, settingsRead?: 'clean' | 'partial' | 'unreadable'): string;
19
- export declare function forgetPermissionsAllowGrantReading(baseUrl: string | undefined): void;
20
19
  export declare function __resetPermissionsAllowGrantReadingsForTests(): void;
@@ -1,5 +1,6 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
+ import { ownDataField } from './ownKey.js';
3
4
  import { hasCoreValuePort } from './coreValuePorts.js';
4
5
  const ALLOW_GRANT_CAP_PATH = ['settings', 'permissions', 'allowGrant'];
5
6
  const ALLOW_LAYER_CAP_LEAF = 'allowLayer';
@@ -10,17 +11,13 @@ export function projectPermissionsAllowGrantCapability(caps) {
10
11
  let node = caps;
11
12
  for (let i = 0; i < ALLOW_GRANT_CAP_PATH.length; i++) {
12
13
  const seg = ALLOW_GRANT_CAP_PATH[i];
13
- if (!Object.hasOwn(node, seg))
14
- return { kind: 'not_reported' };
15
- const v = node[seg];
14
+ const v = ownDataField(node, seg);
16
15
  if (v === undefined)
17
16
  return { kind: 'not_reported' };
18
17
  if (i === ALLOW_GRANT_CAP_PATH.length - 1) {
19
18
  if (typeof v !== 'boolean')
20
19
  return undefined;
21
- if (!Object.hasOwn(node, ALLOW_LAYER_CAP_LEAF))
22
- return { kind: 'present', grants: v };
23
- const layer = node[ALLOW_LAYER_CAP_LEAF];
20
+ const layer = ownDataField(node, ALLOW_LAYER_CAP_LEAF);
24
21
  if (layer === undefined)
25
22
  return { kind: 'present', grants: v };
26
23
  return typeof layer === 'boolean' ? { kind: 'present', grants: v, layer } : undefined;
@@ -103,9 +100,6 @@ export function permissionsAllowGrantDoctorDetail(reading, settingsRead) {
103
100
  }
104
101
  return 'allow rules kept on this side — no usable capabilities reading is cached for this engine (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which), so allow rules are not sent and matching approvals are still answered here';
105
102
  }
106
- export function forgetPermissionsAllowGrantReading(baseUrl) {
107
- reader.forget(baseUrl);
108
- }
109
103
  export function __resetPermissionsAllowGrantReadingsForTests() {
110
104
  reader.__resetForTests();
111
105
  }
@@ -30,6 +30,8 @@ export interface PermissionsKeptRule {
30
30
  rule: string;
31
31
  bucket: 'deny' | 'ask' | 'allow';
32
32
  reason: PermissionsKeptReason;
33
+ code?: string;
34
+ message?: string;
33
35
  }
34
36
  export interface PermissionsRewrittenRule {
35
37
  from: string;
@@ -60,4 +62,10 @@ export interface PermissionsClientOwnedStatement {
60
62
  }
61
63
  export declare function permissionsDeclaration(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading): PermissionsDeclaration;
62
64
  export declare function permissionsDeclarationReport(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading): PermissionsDeclarationReport;
65
+ export interface PermissionsAllowKeptFacts {
66
+ readonly problemCount?: number;
67
+ readonly managedPolicyPending?: true;
68
+ readonly where?: string;
69
+ }
70
+ export declare function permissionsAllowKeptNotice(report: Pick<PermissionsDeclarationReport, 'kept'>, settingsRead: 'clean' | 'partial' | 'unreadable', facts?: PermissionsAllowKeptFacts): string | undefined;
63
71
  export {};