@sema-agent/client-core 0.93.1 → 0.95.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 (321) hide show
  1. package/CHANGELOG.md +554 -0
  2. package/README.md +89 -55
  3. package/dist/adapt/arms.js +13 -11
  4. package/dist/adapt/panelTasks.js +4 -10
  5. package/dist/adapt/toolCards.js +2 -2
  6. package/dist/adapt/wireShapes.js +3 -8
  7. package/dist/adapter/activeRunSelfHeal.d.ts +8 -3
  8. package/dist/adapter/activeRunSelfHeal.js +20 -12
  9. package/dist/adapter/downstream/eventToSdkMessage.js +24 -17
  10. package/dist/adapter/downstream/terminalToSdkResult.js +13 -6
  11. package/dist/adapter/runStream.js +2 -1
  12. package/dist/adapter/types.d.ts +7 -0
  13. package/dist/adapter/types.js +15 -0
  14. package/dist/agentSession/backgroundView.js +5 -1
  15. package/dist/agentSession/engineAgentRegistryRead.js +2 -1
  16. package/dist/agentSession/engineSessionBackgroundStop.js +5 -3
  17. package/dist/agentsWireCaps.d.ts +17 -0
  18. package/dist/agentsWireCaps.js +111 -1
  19. package/dist/approvalDecidedByCapability.d.ts +0 -1
  20. package/dist/approvalDecidedByCapability.js +2 -7
  21. package/dist/approvalReachWire.d.ts +18 -0
  22. package/dist/approvalReachWire.js +58 -0
  23. package/dist/approvalsStreamLiveCapability.d.ts +0 -1
  24. package/dist/approvalsStreamLiveCapability.js +15 -14
  25. package/dist/atMostOnce.d.ts +8 -0
  26. package/dist/atMostOnce.js +36 -0
  27. package/dist/attachmentSeatCapability.d.ts +0 -1
  28. package/dist/attachmentSeatCapability.js +0 -3
  29. package/dist/attachmentsWireCaps.js +11 -6
  30. package/dist/bashExitReading.d.ts +10 -0
  31. package/dist/bashExitReading.js +12 -0
  32. package/dist/callerCwdCapability.d.ts +15 -0
  33. package/dist/callerCwdCapability.js +42 -0
  34. package/dist/centerWiringCapability.d.ts +1 -3
  35. package/dist/centerWiringCapability.js +18 -21
  36. package/dist/classifierStatus.js +4 -4
  37. package/dist/cloudConfigWireCaps.js +43 -21
  38. package/dist/compensations.js +1 -1
  39. package/dist/controlRouter.js +3 -10
  40. package/dist/coreValuePorts.d.ts +64 -1
  41. package/dist/coreValuePorts.js +30 -0
  42. package/dist/cycleOrder.d.ts +15 -0
  43. package/dist/cycleOrder.js +45 -0
  44. package/dist/decideFailureNote.js +4 -1
  45. package/dist/decideReceipt.d.ts +2 -1
  46. package/dist/decideReceipt.js +41 -13
  47. package/dist/declared/supportFloorDeclared.d.ts +1 -0
  48. package/dist/declared/supportFloorDeclared.js +5 -0
  49. package/dist/detachWire.d.ts +1 -4
  50. package/dist/detachWire.js +1 -1
  51. package/dist/deviceExecutorManagementCapability.d.ts +0 -1
  52. package/dist/deviceExecutorManagementCapability.js +36 -40
  53. package/dist/deviceFlowPolling.d.ts +5 -0
  54. package/dist/deviceFlowPolling.js +28 -0
  55. package/dist/deviceRebind.d.ts +88 -0
  56. package/dist/deviceRebind.js +242 -0
  57. package/dist/displayUntrusted.d.ts +1 -0
  58. package/dist/displayUntrusted.js +963 -30
  59. package/dist/engineAgentAbsence.d.ts +2 -2
  60. package/dist/engineAgentPanelStore.d.ts +8 -18
  61. package/dist/engineAgentPanelStore.js +19 -537
  62. package/dist/engineCapReader.d.ts +6 -6
  63. package/dist/engineCapReader.js +30 -43
  64. package/dist/engineCapsCache.d.ts +7 -2
  65. package/dist/engineCapsCache.js +64 -26
  66. package/dist/engineCredentialRequirement.d.ts +9 -0
  67. package/dist/engineCredentialRequirement.js +23 -0
  68. package/dist/engineEnvSourcing.d.ts +53 -0
  69. package/dist/engineEnvSourcing.js +81 -0
  70. package/dist/engineErrorCodes.d.ts +19 -4
  71. package/dist/engineErrorCodes.js +39 -21
  72. package/dist/engineIdentity.js +2 -0
  73. package/dist/engineNoticeCodes.d.ts +22 -2
  74. package/dist/engineNoticeCodes.js +73 -6
  75. package/dist/engineRefusedToolName.d.ts +1 -0
  76. package/dist/engineRefusedToolName.js +8 -0
  77. package/dist/engineWireSdk.js +2 -2
  78. package/dist/executionLaneCapability.d.ts +2 -3
  79. package/dist/executionLaneCapability.js +28 -28
  80. package/dist/fileHistoryCaptureCapability.d.ts +0 -1
  81. package/dist/fileHistoryCaptureCapability.js +13 -12
  82. package/dist/fileHistoryLegNotice.d.ts +14 -2
  83. package/dist/fileHistoryLegNotice.js +101 -15
  84. package/dist/fleet/fleetLedger.d.ts +2 -0
  85. package/dist/fleet/fleetLedger.js +74 -52
  86. package/dist/fleet/fleetProjection.d.ts +0 -3
  87. package/dist/fleet/fleetProjection.js +9 -16
  88. package/dist/fleetAgentPanelProjection.d.ts +4 -17
  89. package/dist/fleetAgentPanelProjection.js +7 -197
  90. package/dist/fleetAgentRowLike.d.ts +16 -0
  91. package/dist/fleetAgentRowLike.js +1 -0
  92. package/dist/gateOutcome.d.ts +2 -1
  93. package/dist/gateOutcome.js +33 -18
  94. package/dist/gateVocabulary.js +1 -1
  95. package/dist/generated/engineAskFaceTables.d.ts +3 -0
  96. package/dist/generated/engineAskFaceTables.js +12 -0
  97. package/dist/generated/engineFactTables.d.ts +4 -2
  98. package/dist/generated/engineFactTables.js +13 -0
  99. package/dist/generated/engineNoticeTables.d.ts +5 -0
  100. package/dist/generated/engineNoticeTables.js +7 -0
  101. package/dist/generated/sdkFactTables.d.ts +5 -0
  102. package/dist/generated/sdkFactTables.js +34 -0
  103. package/dist/generated/settingsSchemaFns.d.ts +10 -0
  104. package/dist/generated/settingsSchemaFns.js +22 -0
  105. package/dist/generated/settingsSchemaTables.d.ts +3 -0
  106. package/dist/generated/settingsSchemaTables.js +3 -0
  107. package/dist/headlessPermissionModeWire.d.ts +2 -2
  108. package/dist/headlessPermissionModeWire.js +11 -21
  109. package/dist/headlessReconnectWire.js +49 -20
  110. package/dist/hitl/allowRuleShadow.d.ts +1 -1
  111. package/dist/hitl/allowRuleShadow.js +49 -8
  112. package/dist/hitl/approvalCompleteParked.d.ts +1 -0
  113. package/dist/hitl/approvalCompleteParked.js +14 -0
  114. package/dist/hitl/approvalEndingCause.d.ts +5 -0
  115. package/dist/hitl/approvalEndingCause.js +61 -0
  116. package/dist/hitl/approvalHolds.d.ts +46 -0
  117. package/dist/hitl/approvalHolds.js +140 -0
  118. package/dist/hitl/approvalOutcomeNote.js +2 -1
  119. package/dist/hitl/approvalResolution.js +9 -1
  120. package/dist/hitl/approvalsFeed.js +23 -6
  121. package/dist/hitl/askGateWire.d.ts +2 -1
  122. package/dist/hitl/askGateWire.js +29 -1
  123. package/dist/hitl/automaticAnswerVerdict.d.ts +8 -2
  124. package/dist/hitl/automaticAnswerVerdict.js +71 -23
  125. package/dist/hitl/crashConverged.js +2 -0
  126. package/dist/hitl/decisionConflict.d.ts +3 -0
  127. package/dist/hitl/decisionConflict.js +43 -0
  128. package/dist/hitl/decisionRefusal.d.ts +23 -0
  129. package/dist/hitl/decisionRefusal.js +88 -0
  130. package/dist/hitl/frameRouter.d.ts +10 -0
  131. package/dist/hitl/frameRouter.js +71 -32
  132. package/dist/hitl/gateLedger.d.ts +8 -0
  133. package/dist/hitl/gateLedger.js +38 -0
  134. package/dist/hitl/hitlBridge.d.ts +14 -3
  135. package/dist/hitl/hitlBridge.js +75 -62
  136. package/dist/hitl/hitlHostSurface.d.ts +3 -0
  137. package/dist/hitl/hitlHostSurface.js +17 -15
  138. package/dist/hitl/livePendingAsk.d.ts +16 -6
  139. package/dist/hitl/livePendingAsk.js +36 -4
  140. package/dist/hitl/localAllowRule.js +2 -1
  141. package/dist/hitl/noAllowCause.d.ts +9 -0
  142. package/dist/hitl/noAllowCause.js +26 -0
  143. package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
  144. package/dist/hitl/parkExpiryJudgements.js +46 -0
  145. package/dist/hitl/parkResolver.d.ts +3 -7
  146. package/dist/hitl/parkResolver.js +55 -28
  147. package/dist/hitl/parkRowBirthWait.js +2 -1
  148. package/dist/hitl/persistedRulesWire.d.ts +6 -1
  149. package/dist/hitl/persistedRulesWire.js +16 -4
  150. package/dist/hitl/planReviewWire.d.ts +2 -3
  151. package/dist/hitl/planReviewWire.js +86 -39
  152. package/dist/hitl/replayedApproval.d.ts +8 -0
  153. package/dist/hitl/replayedApproval.js +125 -10
  154. package/dist/hitl/resumeRunningCard.d.ts +2 -0
  155. package/dist/hitl/resumeRunningCard.js +15 -4
  156. package/dist/hitl/sessionPolicyDeliverable.d.ts +1 -1
  157. package/dist/hitl/sessionPolicyDeliverable.js +3 -8
  158. package/dist/hitl/sessionPolicyWire.js +1 -1
  159. package/dist/hitl/toolApprovalWire.d.ts +50 -5
  160. package/dist/hitl/toolApprovalWire.js +368 -56
  161. package/dist/hooksWireCaps.js +38 -6
  162. package/dist/host.d.ts +5 -0
  163. package/dist/host.js +3 -1
  164. package/dist/hostCallbackGuard.d.ts +1 -0
  165. package/dist/hostCallbackGuard.js +25 -0
  166. package/dist/humanTurnRead.d.ts +15 -1
  167. package/dist/humanTurnRead.js +28 -2
  168. package/dist/index.d.ts +45 -14
  169. package/dist/index.js +33 -12
  170. package/dist/interactiveInterrupt.d.ts +8 -0
  171. package/dist/interactiveInterrupt.js +54 -0
  172. package/dist/limitsWire.d.ts +5 -1
  173. package/dist/limitsWire.js +51 -13
  174. package/dist/liveModelCatalog.d.ts +109 -0
  175. package/dist/liveModelCatalog.js +344 -18
  176. package/dist/mcpEngineLeg.d.ts +25 -0
  177. package/dist/mcpEngineLeg.js +71 -15
  178. package/dist/mcpPanel.js +2 -1
  179. package/dist/mcpProbeCapability.d.ts +0 -1
  180. package/dist/mcpProbeCapability.js +13 -12
  181. package/dist/mcpReconnect.d.ts +1 -3
  182. package/dist/mcpReconnect.js +20 -10
  183. package/dist/memoryComplianceCapability.d.ts +0 -1
  184. package/dist/memoryComplianceCapability.js +14 -13
  185. package/dist/memoryOriginCapability.d.ts +0 -1
  186. package/dist/memoryOriginCapability.js +14 -13
  187. package/dist/memoryVerbsWire.d.ts +1 -1
  188. package/dist/memoryVerbsWire.js +4 -0
  189. package/dist/model/liveCatalogShape.d.ts +14 -0
  190. package/dist/model/liveCatalogShape.js +71 -0
  191. package/dist/model/modelSupplyRules.d.ts +1 -0
  192. package/dist/model/modelSupplyRules.js +30 -9
  193. package/dist/model/modelsPolicy.d.ts +21 -0
  194. package/dist/model/modelsPolicy.js +90 -0
  195. package/dist/modelIdentityResolvability.d.ts +4 -2
  196. package/dist/modelIdentityResolvability.js +25 -5
  197. package/dist/modelSwitchFallback.d.ts +69 -0
  198. package/dist/modelSwitchFallback.js +206 -0
  199. package/dist/notifications.js +12 -11
  200. package/dist/outputStyleSeatCapability.d.ts +15 -0
  201. package/dist/outputStyleSeatCapability.js +42 -0
  202. package/dist/ownKey.d.ts +7 -0
  203. package/dist/ownKey.js +58 -0
  204. package/dist/panelReduce.d.ts +114 -0
  205. package/dist/panelReduce.js +1135 -0
  206. package/dist/panelStateHolder.d.ts +17 -0
  207. package/dist/panelStateHolder.js +201 -0
  208. package/dist/peerLaneCapability.d.ts +0 -1
  209. package/dist/peerLaneCapability.js +15 -14
  210. package/dist/permissionModesCapability.d.ts +0 -1
  211. package/dist/permissionModesCapability.js +5 -10
  212. package/dist/permissionRuleIssue.js +1 -1
  213. package/dist/permissionRulesWriteCapability.d.ts +0 -1
  214. package/dist/permissionRulesWriteCapability.js +15 -14
  215. package/dist/permissionsAllowGrantCapability.d.ts +2 -1
  216. package/dist/permissionsAllowGrantCapability.js +35 -19
  217. package/dist/permissionsDeclaration.d.ts +16 -1
  218. package/dist/permissionsDeclaration.js +142 -15
  219. package/dist/printToolResultFrame.js +2 -10
  220. package/dist/promptDelivery.js +0 -8
  221. package/dist/protocolSegment.d.ts +1 -0
  222. package/dist/protocolSegment.js +13 -1
  223. package/dist/request/taskRequest.d.ts +11 -3
  224. package/dist/request/taskRequest.js +13 -1
  225. package/dist/resultFrameKeys.d.ts +4 -0
  226. package/dist/resultFrameKeys.js +13 -0
  227. package/dist/resumeRefusalCopy.d.ts +18 -1
  228. package/dist/resumeRefusalCopy.js +132 -31
  229. package/dist/retryStatus.js +6 -4
  230. package/dist/rewindArchiveCapability.d.ts +2 -1
  231. package/dist/rewindArchiveCapability.js +28 -15
  232. package/dist/rewindEngineAction.d.ts +21 -0
  233. package/dist/rewindEngineAction.js +36 -0
  234. package/dist/rewindWireCaps.d.ts +2 -1
  235. package/dist/rewindWireCaps.js +1 -0
  236. package/dist/{hitl/rosterMountedNames.d.ts → rosterMountedNames.d.ts} +1 -1
  237. package/dist/runCancelContext.js +2 -1
  238. package/dist/runTerminal.d.ts +0 -11
  239. package/dist/runTerminal.js +4 -27
  240. package/dist/sdkRegistryTransit.d.ts +2 -1
  241. package/dist/sdkRegistryTransit.js +1 -0
  242. package/dist/sealedKeyCapability.d.ts +0 -1
  243. package/dist/sealedKeyCapability.js +19 -20
  244. package/dist/seatContract.d.ts +85 -28
  245. package/dist/seatContract.js +512 -148
  246. package/dist/sessionIdSegment.d.ts +1 -0
  247. package/dist/sessionIdSegment.js +11 -0
  248. package/dist/sessionMemoryErase.d.ts +1 -1
  249. package/dist/sessionMemoryErase.js +6 -1
  250. package/dist/sessionMemoryStatus.js +3 -2
  251. package/dist/sessionPolicyCapability.d.ts +0 -1
  252. package/dist/sessionPolicyCapability.js +14 -13
  253. package/dist/sessionReadRedactionCapability.d.ts +15 -0
  254. package/dist/sessionReadRedactionCapability.js +42 -0
  255. package/dist/sessionSyncFileHistoryCapability.d.ts +0 -1
  256. package/dist/sessionSyncFileHistoryCapability.js +13 -12
  257. package/dist/skillToolListsCapability.d.ts +0 -1
  258. package/dist/skillToolListsCapability.js +13 -12
  259. package/dist/skillsWireCaps.d.ts +4 -0
  260. package/dist/skillsWireCaps.js +66 -1
  261. package/dist/sqlEngineCapability.d.ts +0 -1
  262. package/dist/sqlEngineCapability.js +21 -21
  263. package/dist/steerPriorityCapability.d.ts +0 -1
  264. package/dist/steerPriorityCapability.js +18 -19
  265. package/dist/storePostureCapability.d.ts +1 -1
  266. package/dist/storePostureCapability.js +16 -16
  267. package/dist/streamDrainingLegs.d.ts +6 -0
  268. package/dist/streamDrainingLegs.js +23 -0
  269. package/dist/subagent/agentStateDetail.d.ts +1 -0
  270. package/dist/subagent/agentStateDetail.js +41 -0
  271. package/dist/subagent/engineCompactWire.d.ts +15 -0
  272. package/dist/subagent/engineCompactWire.js +82 -45
  273. package/dist/subagent/engineDelegatedPrompt.js +10 -6
  274. package/dist/subagent/engineSubagentOutput.d.ts +0 -1
  275. package/dist/subagent/engineSubagentOutput.js +5 -20
  276. package/dist/subagent/engineSubagentTail.d.ts +0 -1
  277. package/dist/subagent/engineSubagentTail.js +7 -32
  278. package/dist/subagentContentStore.js +3 -3
  279. package/dist/supportFloor.js +2 -5
  280. package/dist/taskRequestWords.d.ts +2 -4
  281. package/dist/taskRequestWords.js +3 -2
  282. package/dist/terminalStatuses.d.ts +30 -0
  283. package/dist/terminalStatuses.js +67 -0
  284. package/dist/toolResult.d.ts +5 -0
  285. package/dist/toolResult.js +88 -36
  286. package/dist/types/engineState.d.ts +2 -1
  287. package/dist/usageAnalytics.d.ts +146 -0
  288. package/dist/usageAnalytics.js +311 -0
  289. package/dist/userAttachmentEnvelope.d.ts +22 -1
  290. package/dist/userAttachmentEnvelope.js +90 -2
  291. package/dist/userInvokedSkillsCapability.d.ts +0 -1
  292. package/dist/userInvokedSkillsCapability.js +13 -12
  293. package/dist/webSearchBackendCapability.d.ts +0 -1
  294. package/dist/webSearchBackendCapability.js +20 -19
  295. package/dist/webSearchWireCaps.js +3 -11
  296. package/dist/wireErrorTriage.d.ts +11 -0
  297. package/dist/wireErrorTriage.js +35 -0
  298. package/dist/wireFailureShape.d.ts +10 -0
  299. package/dist/wireFailureShape.js +72 -5
  300. package/dist/wireRefusalCopy.d.ts +6 -1
  301. package/dist/wireRefusalCopy.js +23 -25
  302. package/dist/wiringInstructionsAttribution.d.ts +10 -0
  303. package/dist/wiringInstructionsAttribution.js +67 -0
  304. package/dist/workflowClient.js +19 -2
  305. package/dist/workflowsJournalCapability.d.ts +0 -1
  306. package/dist/workflowsJournalCapability.js +13 -12
  307. package/dist/writeProtectionCapability.d.ts +0 -1
  308. package/dist/writeProtectionCapability.js +26 -26
  309. package/docs/INTEGRATION-CLIENTS.md +1733 -52
  310. package/package.json +5 -5
  311. package/dist/askSurvivesStandingAnswer.d.ts +0 -13
  312. package/dist/askSurvivesStandingAnswer.js +0 -53
  313. package/dist/engineCapsGenerationGuard.d.ts +0 -4
  314. package/dist/engineCapsGenerationGuard.js +0 -19
  315. package/dist/hitl/askSurvivesPosture.d.ts +0 -20
  316. package/dist/hitl/askSurvivesPosture.js +0 -48
  317. package/dist/panelRunningHistory.d.ts +0 -22
  318. package/dist/panelRunningHistory.js +0 -82
  319. package/dist/registryConflict.d.ts +0 -3
  320. package/dist/registryConflict.js +0 -44
  321. /package/dist/{hitl/rosterMountedNames.js → rosterMountedNames.js} +0 -0
@@ -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
+ }
@@ -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,18 +1,22 @@
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
- if (caps === null || typeof caps !== 'object')
5
- return undefined;
6
- if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
7
- return undefined;
8
- if (!Object.hasOwn(caps, 'peerLane'))
9
- return { kind: 'not_reported' };
10
- const v = caps.peerLane;
11
- if (v === undefined)
12
- return { kind: 'not_reported' };
13
- if (typeof v !== 'boolean')
5
+ try {
6
+ if (caps === null || typeof caps !== 'object')
7
+ return undefined;
8
+ if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
9
+ return undefined;
10
+ const v = ownDataField(caps, 'peerLane');
11
+ if (v === undefined)
12
+ return { kind: 'not_reported' };
13
+ if (typeof v !== 'boolean')
14
+ return undefined;
15
+ return v ? { kind: 'present' } : { kind: 'absent' };
16
+ }
17
+ catch {
14
18
  return undefined;
15
- return v ? { kind: 'present' } : { kind: 'absent' };
19
+ }
16
20
  }
17
21
  const reader = createEngineCapReader({
18
22
  name: 'peerLane',
@@ -44,9 +48,6 @@ export function peerLaneDoctorDetail(reading) {
44
48
  return 'cross-session lane on — this engine can discover and deliver across sessions for the same caller';
45
49
  }
46
50
  }
47
- export function forgetPeerLaneReading(baseUrl) {
48
- reader.forget(baseUrl);
49
- }
50
51
  export function __resetPeerLaneReadingsForTests() {
51
52
  reader.__resetForTests();
52
53
  }
@@ -12,5 +12,4 @@ export declare function noteEngineCapsForPermissionModes(baseUrl: string, caps:
12
12
  }): void;
13
13
  export declare function observedPermissionModes(baseUrl?: string | undefined): PermissionModesReading;
14
14
  export declare function permissionModeAdmitted(reading: PermissionModesReading | undefined, mode: string): boolean;
15
- export declare function forgetPermissionModesReading(baseUrl: string | undefined): void;
16
15
  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);
@@ -63,9 +61,6 @@ export function permissionModeAdmitted(reading, mode) {
63
61
  return false;
64
62
  }
65
63
  }
66
- export function forgetPermissionModesReading(baseUrl) {
67
- reader.forget(baseUrl);
68
- }
69
64
  export function __resetPermissionModesReadingsForTests() {
70
65
  reader.__resetForTests();
71
66
  }
@@ -31,7 +31,7 @@ const ISSUE_SENTENCES = Object.freeze({
31
31
  'unsupported.param_unknown': 'this parameter rule is not supported: the tool carries no such parameter, so it could never match',
32
32
  'unsupported.param_non_scalar': 'this parameter rule is not supported: that parameter holds an object or an array, so it could never match',
33
33
  'unsupported.tool_unknown': "this rule is not supported on this leg: the resolver it supplied does not know the tool, so the rule's face cannot be checked",
34
- 'unsupported.path_base': 'this path rule is not supported as spelled: it needs a base this policy was not given, so it would reach nothing and is refused rather than compiled',
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
37
  'invalid.allow_param_rule': 'this rule is invalid: an allow rule cannot carry a parameter pattern — only bare tool rules auto-allow',
@@ -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,18 +1,22 @@
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
- if (caps === null || typeof caps !== 'object')
5
- return undefined;
6
- if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
7
- return undefined;
8
- if (!Object.hasOwn(caps, 'permissionRulesWrite'))
9
- return { kind: 'not_reported' };
10
- const v = caps.permissionRulesWrite;
11
- if (v === undefined)
12
- return { kind: 'not_reported' };
13
- if (typeof v !== 'boolean')
5
+ try {
6
+ if (caps === null || typeof caps !== 'object')
7
+ return undefined;
8
+ if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
9
+ return undefined;
10
+ const v = ownDataField(caps, 'permissionRulesWrite');
11
+ if (v === undefined)
12
+ return { kind: 'not_reported' };
13
+ if (typeof v !== 'boolean')
14
+ return undefined;
15
+ return v ? { kind: 'present' } : { kind: 'absent' };
16
+ }
17
+ catch {
14
18
  return undefined;
15
- return v ? { kind: 'present' } : { kind: 'absent' };
19
+ }
16
20
  }
17
21
  const reader = createEngineCapReader({
18
22
  name: 'permissionRulesWrite',
@@ -40,9 +44,6 @@ export function permissionRulesWriteDoctorDetail(reading) {
40
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';
41
45
  }
42
46
  }
43
- export function forgetPermissionRulesWriteReading(baseUrl) {
44
- reader.forget(baseUrl);
45
- }
46
47
  export function __resetPermissionRulesWriteReadingsForTests() {
47
48
  reader.__resetForTests();
48
49
  }
@@ -5,6 +5,7 @@ export type PermissionsAllowGrantReading = {
5
5
  } | {
6
6
  kind: 'present';
7
7
  grants: boolean;
8
+ layer?: boolean;
8
9
  };
9
10
  export declare function projectPermissionsAllowGrantCapability(caps: unknown): PermissionsAllowGrantReading | undefined;
10
11
  export declare function noteEngineCapsForPermissionsAllowGrant(baseUrl: string, caps: unknown, opts?: {
@@ -12,7 +13,7 @@ export declare function noteEngineCapsForPermissionsAllowGrant(baseUrl: string,
12
13
  }): void;
13
14
  export declare function observedPermissionsAllowGrant(baseUrl?: string | undefined): PermissionsAllowGrantReading;
14
15
  export declare function permissionsAllowGrantAvailable(reading: PermissionsAllowGrantReading): boolean;
16
+ export declare function allowWireForm(reading: PermissionsAllowGrantReading): 'layer' | 'grant' | 'off';
15
17
  export declare function allowRulesGate(reading: PermissionsAllowGrantReading, settingsRead: 'clean' | 'partial' | 'unreadable' | undefined): 'open' | 'capability_off' | 'settings_read_not_clean';
16
18
  export declare function permissionsAllowGrantDoctorDetail(reading: PermissionsAllowGrantReading, settingsRead?: 'clean' | 'partial' | 'unreadable'): string;
17
- export declare function forgetPermissionsAllowGrantReading(baseUrl: string | undefined): void;
18
19
  export declare function __resetPermissionsAllowGrantReadingsForTests(): void;
@@ -1,25 +1,36 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
+ import { ownDataField } from './ownKey.js';
4
+ import { hasCoreValuePort } from './coreValuePorts.js';
3
5
  const ALLOW_GRANT_CAP_PATH = ['settings', 'permissions', 'allowGrant'];
6
+ const ALLOW_LAYER_CAP_LEAF = 'allowLayer';
4
7
  export function projectPermissionsAllowGrantCapability(caps) {
5
- if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
6
- return undefined;
7
- let node = caps;
8
- for (let i = 0; i < ALLOW_GRANT_CAP_PATH.length; i++) {
9
- const seg = ALLOW_GRANT_CAP_PATH[i];
10
- if (!Object.hasOwn(node, seg))
11
- return { kind: 'not_reported' };
12
- const v = node[seg];
13
- if (v === undefined)
14
- return { kind: 'not_reported' };
15
- if (i === ALLOW_GRANT_CAP_PATH.length - 1) {
16
- return typeof v === 'boolean' ? { kind: 'present', grants: v } : undefined;
17
- }
18
- if (v === null || typeof v !== 'object' || Array.isArray(v))
8
+ try {
9
+ if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
19
10
  return undefined;
20
- node = v;
11
+ let node = caps;
12
+ for (let i = 0; i < ALLOW_GRANT_CAP_PATH.length; i++) {
13
+ const seg = ALLOW_GRANT_CAP_PATH[i];
14
+ const v = ownDataField(node, seg);
15
+ if (v === undefined)
16
+ return { kind: 'not_reported' };
17
+ if (i === ALLOW_GRANT_CAP_PATH.length - 1) {
18
+ if (typeof v !== 'boolean')
19
+ return undefined;
20
+ const layer = ownDataField(node, ALLOW_LAYER_CAP_LEAF);
21
+ if (layer === undefined)
22
+ return { kind: 'present', grants: v };
23
+ return typeof layer === 'boolean' ? { kind: 'present', grants: v, layer } : undefined;
24
+ }
25
+ if (v === null || typeof v !== 'object' || Array.isArray(v))
26
+ return undefined;
27
+ node = v;
28
+ }
29
+ return undefined;
30
+ }
31
+ catch {
32
+ return undefined;
21
33
  }
22
- return undefined;
23
34
  }
24
35
  const reader = createEngineCapReader({
25
36
  name: ALLOW_GRANT_CAP_PATH.join('.'),
@@ -44,6 +55,11 @@ export function permissionsAllowGrantAvailable(reading) {
44
55
  return false;
45
56
  }
46
57
  }
58
+ export function allowWireForm(reading) {
59
+ if (!permissionsAllowGrantAvailable(reading))
60
+ return 'off';
61
+ return ownReadingField(reading, 'layer') === true && hasCoreValuePort('compileAllowList') ? 'layer' : 'grant';
62
+ }
47
63
  export function allowRulesGate(reading, settingsRead) {
48
64
  if (!permissionsAllowGrantAvailable(reading))
49
65
  return 'capability_off';
@@ -62,6 +78,9 @@ function ownReadingField(reading, key) {
62
78
  export function permissionsAllowGrantDoctorDetail(reading, settingsRead) {
63
79
  const gate = allowRulesGate(reading, settingsRead);
64
80
  if (gate === 'open') {
81
+ if (allowWireForm(reading) === 'layer') {
82
+ return 'allow rules sent to the engine, content forms included — a matching call is not asked, except for the kinds of question the engine always puts to a person, and an entry the engine reads as granting nothing is reported when the run starts';
83
+ }
65
84
  return 'allow rules sent to the engine — it reads them as rules, not as an exclusive list: a matching call counts as answered for, and the engine still raises its own prompts where it requires them';
66
85
  }
67
86
  if (gate === 'settings_read_not_clean') {
@@ -81,9 +100,6 @@ export function permissionsAllowGrantDoctorDetail(reading, settingsRead) {
81
100
  }
82
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';
83
102
  }
84
- export function forgetPermissionsAllowGrantReading(baseUrl) {
85
- reader.forget(baseUrl);
86
- }
87
103
  export function __resetPermissionsAllowGrantReadingsForTests() {
88
104
  reader.__resetForTests();
89
105
  }
@@ -1,4 +1,5 @@
1
1
  import { type PermissionsAllowGrantReading } from './permissionsAllowGrantCapability.js';
2
+ export declare const WIRE_RULE_TRUST_ORDER: readonly ["policySettings", "cliArg", "flagSettings", "session", "userSettings", "localSettings", "projectSettings"];
2
3
  declare const RULE_TRUST_ORDER: readonly ["policySettings", "cliArg", "flagSettings", "session", "userSettings", "localSettings", "projectSettings"];
3
4
  export type WireRuleOrigin = (typeof RULE_TRUST_ORDER)[number];
4
5
  export interface WireRuleOrigins {
@@ -13,6 +14,7 @@ export interface PermissionsDeclarationInput {
13
14
  readonly origins?: WireRuleOrigins;
14
15
  readonly cliDeny?: readonly string[];
15
16
  readonly settingsRead: 'clean' | 'partial' | 'unreadable';
17
+ readonly clientOwnedServers?: readonly string[];
16
18
  }
17
19
  export interface PermissionsDeclarationBuckets {
18
20
  deny?: string[];
@@ -22,7 +24,7 @@ export interface PermissionsDeclarationBuckets {
22
24
  export interface PermissionsDeclaration {
23
25
  permissions?: PermissionsDeclarationBuckets;
24
26
  }
25
- export declare const PERMISSIONS_KEPT_REASONS: readonly ["allow_capability_off", "settings_read_not_clean", "empty_rule", "paren_in_tool_name", "retired_tool_name", "unprefixed_namespaced_name", "incomplete_protocol_name", "unminted_protocol_segment", "home_relative_path", "compile_refused", "content_form_not_grantable", "judge_failed", "duplicate"];
27
+ export declare const PERMISSIONS_KEPT_REASONS: readonly ["allow_capability_off", "settings_read_not_clean", "empty_rule", "paren_in_tool_name", "retired_tool_name", "unprefixed_namespaced_name", "incomplete_protocol_name", "unminted_protocol_segment", "home_relative_path", "compile_refused", "content_form_not_grantable", "judge_failed", "duplicate", "voids_allow_list"];
26
28
  export type PermissionsKeptReason = (typeof PERMISSIONS_KEPT_REASONS)[number];
27
29
  export interface PermissionsKeptRule {
28
30
  rule: string;
@@ -48,7 +50,20 @@ export interface PermissionsDeclarationReport extends PermissionsDeclaration {
48
50
  rewritten: PermissionsRewrittenRule[];
49
51
  unchecked: PermissionsUncheckedRule[];
50
52
  unreachable: PermissionsUnreachableRule[];
53
+ clientOwned?: PermissionsClientOwnedStatement[];
54
+ }
55
+ export interface PermissionsClientOwnedStatement {
56
+ server: string;
57
+ rule?: string;
58
+ sent: boolean;
59
+ reason?: PermissionsKeptReason;
51
60
  }
52
61
  export declare function permissionsDeclaration(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading): PermissionsDeclaration;
53
62
  export declare function permissionsDeclarationReport(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading): PermissionsDeclarationReport;
63
+ export interface PermissionsAllowKeptFacts {
64
+ readonly problemCount?: number;
65
+ readonly managedPolicyPending?: true;
66
+ readonly where?: string;
67
+ }
68
+ export declare function permissionsAllowKeptNotice(report: Pick<PermissionsDeclarationReport, 'kept'>, settingsRead: 'clean' | 'partial' | 'unreadable', facts?: PermissionsAllowKeptFacts): string | undefined;
54
69
  export {};