@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
@@ -1,212 +1,22 @@
1
- import { isStaleEngineAgentPanelEnd, publishEngineAgentPanelAbsence, publishEngineAgentPanelEvent } from './engineAgentPanelStore.js';
2
- import { __resetPanelRunningHistoryForTests, notePanelRowRunning, panelRowUnknownToConsumer, panelRowEndedIdentity, holdNewbornTerminalRow, peekHeldNewbornTerminalRow, dropHeldNewbornTerminalRow } from './panelRunningHistory.js';
3
- import { rowIdTail } from './workflow.js';
4
- import { TERMINAL_FLEET_TASK_STATUSES } from './fleet/fleetProjection.js';
1
+ import { ABSENT_SETTLE_MS, panelPresenceSize } from './panelReduce.js';
2
+ import { panelStateNow, stepEnginePanel } from './panelStateHolder.js';
5
3
  import { DEFAULT_SESSION_KEY } from './sessionSlot.js';
6
- import { isTerminalNotSuccess } from './runTerminal.js';
7
- export const ABSENT_SETTLE_MS = 30_000;
8
- const SETTLED_RETENTION_MS = ABSENT_SETTLE_MS * 4;
9
- function currentToolKeyOf(ct) {
10
- if (!ct || typeof ct.toolName !== 'string' || ct.toolName.length === 0)
11
- return undefined;
12
- return `${ct.toolName}\u0000${ct.target ?? ''}`;
13
- }
14
- const seen = new Map();
15
- function seenFor(sessionKey) {
16
- let m = seen.get(sessionKey);
17
- if (!m) {
18
- m = new Map();
19
- seen.set(sessionKey, m);
20
- }
21
- return m;
22
- }
4
+ export { ABSENT_SETTLE_MS };
23
5
  export function resetFleetAgentPanelProjection() {
24
- seen.clear();
25
- __resetPanelRunningHistoryForTests();
6
+ stepEnginePanel({ kind: 'fleet-rows-reset' });
26
7
  }
27
8
  export function resetFleetAgentPanelProjectionFor(sessionKey) {
28
- seen.delete(sessionKey);
9
+ stepEnginePanel({ kind: 'fleet-rows-reset', sessionKey });
29
10
  }
30
11
  export function fleetAgentProjectionSize() {
31
12
  return fleetAgentProjectionSizeFor(DEFAULT_SESSION_KEY);
32
13
  }
33
14
  export function fleetAgentProjectionSizeFor(sessionKey) {
34
- return seen.get(sessionKey)?.size ?? 0;
15
+ return panelPresenceSize(panelStateNow(), sessionKey);
35
16
  }
36
17
  export function projectFleetAgentRows(rows, nowMs = Date.now()) {
37
18
  projectFleetAgentRowsFor(DEFAULT_SESSION_KEY, rows, nowMs);
38
19
  }
39
20
  export function projectFleetAgentRowsFor(sessionKey, rows, nowMs = Date.now()) {
40
- const seenMap = seenFor(sessionKey);
41
- const present = new Set();
42
- for (const row of rows) {
43
- if (!row?.id)
44
- continue;
45
- const taskId = rowIdTail(row.id);
46
- if (!taskId)
47
- continue;
48
- present.add(taskId);
49
- const status = row.status ?? 'running';
50
- const wireTokens = typeof row.tokens === 'number' && Number.isInteger(row.tokens) && row.tokens >= 0 ? row.tokens : undefined;
51
- const tokens = wireTokens;
52
- const toolUses = typeof row.toolUses === 'number' ? row.toolUses : undefined;
53
- const transcriptId = row.transcriptId || undefined;
54
- const parentToolCallId = typeof row.parentToolCallId === 'string' && row.parentToolCallId.length > 0 ? row.parentToolCallId : undefined;
55
- const startedAt = typeof row.startedAt === 'number' && Number.isFinite(row.startedAt) && row.startedAt > 0 ? row.startedAt : undefined;
56
- const cycleSeq = typeof row.cycleSeq === 'number' && Number.isInteger(row.cycleSeq) && row.cycleSeq >= 1 ? row.cycleSeq : undefined;
57
- const currentTool = currentToolKeyOf(row.currentTool) !== undefined ? row.currentTool : undefined;
58
- const currentToolKey = currentToolKeyOf(row.currentTool);
59
- const prev = seenMap.get(taskId);
60
- const rowIdentity = { ...(cycleSeq !== undefined ? { cycleSeq } : {}), ...(startedAt !== undefined ? { startedAt } : {}) };
61
- const prevIdentity = prev !== undefined
62
- ? { ...(prev.cycleSeq !== undefined ? { cycleSeq: prev.cycleSeq } : {}), ...(prev.startedAt !== undefined ? { startedAt: prev.startedAt } : {}) }
63
- : undefined;
64
- if (prev !== undefined && isStaleEngineAgentPanelEnd(rowIdentity, prevIdentity))
65
- continue;
66
- const rowNewerCycle = prev !== undefined && isStaleEngineAgentPanelEnd(prevIdentity, rowIdentity);
67
- const sameCycle = prev !== undefined &&
68
- !prev.settled &&
69
- (startedAt === undefined || prev.startedAt === undefined || prev.startedAt === startedAt) &&
70
- (cycleSeq === undefined || prev.cycleSeq === undefined || prev.cycleSeq === cycleSeq);
71
- const knownTokens = tokens !== undefined ? tokens : sameCycle ? prev?.tokens : undefined;
72
- const carryIdentity = prev !== undefined && !rowNewerCycle;
73
- const knownStartedAt = startedAt !== undefined ? startedAt : carryIdentity ? prev.startedAt : undefined;
74
- const knownCycleSeq = cycleSeq !== undefined ? cycleSeq : carryIdentity ? prev.cycleSeq : undefined;
75
- if (TERMINAL_FLEET_TASK_STATUSES.has(status)) {
76
- const newbornTerminal = prev === undefined && panelRowUnknownToConsumer(taskId);
77
- const settledThisCycle = prev?.settled === true && !rowNewerCycle;
78
- const endedRec = prev === undefined ? panelRowEndedIdentity(taskId) : undefined;
79
- const frameCycle = { ...(cycleSeq !== undefined ? { cycleSeq } : {}), ...(startedAt !== undefined ? { startedAt } : {}) };
80
- if (endedRec !== undefined && isStaleEngineAgentPanelEnd(frameCycle, endedRec))
81
- continue;
82
- const endedSameCycle = endedRec !== undefined && !isStaleEngineAgentPanelEnd(endedRec, frameCycle);
83
- if (newbornTerminal) {
84
- holdNewbornTerminalRow(taskId, {
85
- kind: 'fleet-row',
86
- taskId,
87
- ...(row.name ? { name: row.name } : {}),
88
- ...(row.description ? { description: row.description } : {}),
89
- ...(knownTokens !== undefined ? { totalTokens: knownTokens } : {}),
90
- ...(toolUses !== undefined ? { toolUses } : {}),
91
- ...(transcriptId !== undefined ? { transcriptId } : {}),
92
- ...(parentToolCallId !== undefined ? { parentToolCallId } : {}),
93
- ...(knownStartedAt !== undefined ? { startedAt: knownStartedAt } : {}),
94
- ...(knownCycleSeq !== undefined ? { cycleSeq: knownCycleSeq } : {}),
95
- });
96
- }
97
- else if (!settledThisCycle) {
98
- if (rowNewerCycle ||
99
- (cycleSeq !== undefined && prev?.cycleSeq !== cycleSeq) ||
100
- (tokens !== undefined && prev?.tokens !== tokens) ||
101
- (toolUses !== undefined && prev?.toolUses !== toolUses) ||
102
- (transcriptId !== undefined && prev?.transcriptId !== transcriptId) ||
103
- (parentToolCallId !== undefined && prev?.parentToolCallId !== parentToolCallId) ||
104
- (startedAt !== undefined && prev?.startedAt !== startedAt)) {
105
- publishEngineAgentPanelEvent({
106
- kind: 'fleet-row',
107
- taskId,
108
- ...(row.name ? { name: row.name } : {}),
109
- ...(row.description ? { description: row.description } : {}),
110
- ...(knownTokens !== undefined ? { totalTokens: knownTokens } : {}),
111
- ...(toolUses !== undefined ? { toolUses } : {}),
112
- ...(transcriptId !== undefined ? { transcriptId } : {}),
113
- ...(parentToolCallId !== undefined ? { parentToolCallId } : {}),
114
- ...(knownStartedAt !== undefined ? { startedAt: knownStartedAt } : {}),
115
- ...(knownCycleSeq !== undefined ? { cycleSeq: knownCycleSeq } : {}),
116
- });
117
- }
118
- if (!endedSameCycle)
119
- publishEngineAgentPanelEvent({
120
- kind: 'end',
121
- taskId,
122
- isError: isTerminalNotSuccess(status),
123
- ...(knownCycleSeq !== undefined ? { cycleSeq: knownCycleSeq } : {}),
124
- ...(knownStartedAt !== undefined ? { startedAt: knownStartedAt } : {}),
125
- });
126
- }
127
- seenMap.set(taskId, {
128
- status,
129
- tokens: knownTokens,
130
- toolUses: toolUses !== undefined ? toolUses : prev?.toolUses,
131
- transcriptId: transcriptId !== undefined ? transcriptId : prev?.transcriptId,
132
- parentToolCallId: parentToolCallId !== undefined ? parentToolCallId : prev?.parentToolCallId,
133
- startedAt: knownStartedAt,
134
- cycleSeq: knownCycleSeq,
135
- currentToolKey: currentToolKey !== undefined ? currentToolKey : prev?.currentToolKey,
136
- lastSeenAt: nowMs,
137
- settled: true,
138
- settledAtMs: prev?.settled ? prev.settledAtMs : nowMs,
139
- absentReportedAtMs: undefined,
140
- });
141
- continue;
142
- }
143
- const cycleComparable = (cycleSeq !== undefined && prev?.cycleSeq !== undefined) || (startedAt !== undefined && prev?.startedAt !== undefined);
144
- const staleSnapshotOverHeldRow = prev !== undefined && prev.settled === true && cycleComparable && !rowNewerCycle && peekHeldNewbornTerminalRow(taskId) !== undefined;
145
- if (staleSnapshotOverHeldRow)
146
- continue;
147
- if (!prev ||
148
- prev.settled ||
149
- prev.absentReportedAtMs !== undefined ||
150
- prev.status !== status ||
151
- prev.tokens !== knownTokens ||
152
- (toolUses !== undefined && prev.toolUses !== toolUses) ||
153
- (transcriptId !== undefined && prev.transcriptId !== transcriptId) ||
154
- (parentToolCallId !== undefined && prev.parentToolCallId !== parentToolCallId) ||
155
- (startedAt !== undefined && prev.startedAt !== startedAt) ||
156
- (cycleSeq !== undefined && prev.cycleSeq !== cycleSeq) ||
157
- (currentToolKey !== undefined && prev.currentToolKey !== currentToolKey)) {
158
- notePanelRowRunning(taskId);
159
- dropHeldNewbornTerminalRow(taskId);
160
- publishEngineAgentPanelEvent({
161
- kind: 'fleet-row',
162
- taskId,
163
- ...(row.name ? { name: row.name } : {}),
164
- ...(row.description ? { description: row.description } : {}),
165
- ...(knownTokens !== undefined ? { totalTokens: knownTokens } : {}),
166
- ...(toolUses !== undefined ? { toolUses } : {}),
167
- ...(transcriptId !== undefined ? { transcriptId } : {}),
168
- ...(parentToolCallId !== undefined ? { parentToolCallId } : {}),
169
- ...(knownStartedAt !== undefined ? { startedAt: knownStartedAt } : {}),
170
- ...(knownCycleSeq !== undefined ? { cycleSeq: knownCycleSeq } : {}),
171
- ...(currentTool !== undefined ? { currentTool } : {}),
172
- });
173
- }
174
- seenMap.set(taskId, {
175
- status,
176
- tokens: knownTokens,
177
- toolUses: toolUses !== undefined ? toolUses : prev?.toolUses,
178
- transcriptId: transcriptId !== undefined ? transcriptId : prev?.transcriptId,
179
- parentToolCallId: parentToolCallId !== undefined ? parentToolCallId : prev?.parentToolCallId,
180
- startedAt: knownStartedAt,
181
- cycleSeq: knownCycleSeq,
182
- currentToolKey: currentToolKey !== undefined ? currentToolKey : prev?.currentToolKey,
183
- lastSeenAt: nowMs,
184
- settled: false,
185
- settledAtMs: undefined,
186
- absentReportedAtMs: undefined,
187
- });
188
- }
189
- for (const [taskId, s] of seenMap) {
190
- if (present.has(taskId) || s.settled || s.absentReportedAtMs !== undefined)
191
- continue;
192
- const absentForMs = nowMs - s.lastSeenAt;
193
- if (absentForMs <= ABSENT_SETTLE_MS)
194
- continue;
195
- publishEngineAgentPanelAbsence({ taskId, lastSeenAtMs: s.lastSeenAt, absentForMs });
196
- seenMap.set(taskId, { ...s, absentReportedAtMs: nowMs });
197
- }
198
- for (const [taskId, s] of seenMap) {
199
- if (present.has(taskId))
200
- continue;
201
- if (s.settled) {
202
- const settledAt = s.settledAtMs ?? s.lastSeenAt;
203
- if (nowMs - settledAt > SETTLED_RETENTION_MS)
204
- seenMap.delete(taskId);
205
- }
206
- else if (s.absentReportedAtMs !== undefined && nowMs - s.absentReportedAtMs > SETTLED_RETENTION_MS) {
207
- seenMap.delete(taskId);
208
- }
209
- }
210
- if (seenMap.size === 0)
211
- seen.delete(sessionKey);
21
+ stepEnginePanel({ kind: 'fleet-rows', sessionKey, rows, nowMs });
212
22
  }
@@ -0,0 +1,16 @@
1
+ export interface FleetAgentRowLike {
2
+ id: string;
3
+ name?: string;
4
+ description?: string;
5
+ status?: string;
6
+ tokens?: number;
7
+ toolUses?: number;
8
+ transcriptId?: string;
9
+ currentTool?: {
10
+ toolName: string;
11
+ target?: string;
12
+ };
13
+ startedAt?: number;
14
+ cycleSeq?: number;
15
+ parentToolCallId?: string;
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,25 +1,12 @@
1
- import { applyDisplayFace, LEGACY_ESCAPE_FACE, LEGACY_LABEL_FACE } from './displayUntrusted.js';
1
+ import { applyDisplayFace, ESCAPE_FACE, LABEL_FACE, paintAndCap } from './displayUntrusted.js';
2
2
  export function escapeDisplayControlChars(s) {
3
- return applyDisplayFace(s, LEGACY_ESCAPE_FACE);
3
+ return applyDisplayFace(s, ESCAPE_FACE);
4
4
  }
5
5
  export function capForDisplay(raw, max) {
6
- const escaped = escapeDisplayControlChars(raw);
7
- if (escaped.length <= max)
8
- return escaped;
9
- let cut = max;
10
- const tokenStart = escaped.lastIndexOf('\\', cut - 1);
11
- if (tokenStart >= 0 && tokenStart + 6 > cut && /^\\u[0-9A-F]{4}$/.test(escaped.slice(tokenStart, tokenStart + 6))) {
12
- cut = tokenStart;
13
- }
14
- if (cut > 0) {
15
- const code = escaped.charCodeAt(cut - 1);
16
- if (code >= 0xd800 && code <= 0xdbff)
17
- cut -= 1;
18
- }
19
- return cut > 0 ? escaped.slice(0, cut) : '';
6
+ return paintAndCap(raw, ESCAPE_FACE, typeof max === 'number' && max > 0 ? max : 0);
20
7
  }
21
8
  export function collapseLabel(s) {
22
- return applyDisplayFace(s, LEGACY_LABEL_FACE);
9
+ return applyDisplayFace(s, LABEL_FACE);
23
10
  }
24
11
  export function taskDescFromName(name, agentType, agentName) {
25
12
  if (!name || !agentType)
@@ -32,9 +32,20 @@ export interface GateModeReleaseView {
32
32
  mandate?: string;
33
33
  reason?: string;
34
34
  }
35
- export declare const GATE_MODE_RELEASE_REASON_WORDS: readonly ["rule_unreadable", "write_protection_unresolved"];
35
+ export declare const GATE_MODE_RELEASE_REASON_WORDS: readonly ["rule_unreadable", "target_unresolved"];
36
36
  export type GateModeReleaseReasonWord = (typeof CORE_MODE_RELEASE_REASONS)[number];
37
37
  export declare function isGateModeReleaseReasonWord(v: unknown): v is GateModeReleaseReasonWord;
38
+ export declare function modeReleaseReasonSentence(reason: string | null | undefined): string | undefined;
39
+ export interface ReleaseDisclosureIdentity {
40
+ readonly toolCallId?: string;
41
+ readonly callKey?: string;
42
+ readonly epoch?: string | number;
43
+ }
44
+ export interface ReleaseDisclosureLedger {
45
+ readonly has: (identity: ReleaseDisclosureIdentity | null | undefined) => boolean;
46
+ readonly mark: (identity: ReleaseDisclosureIdentity | null | undefined) => void;
47
+ }
48
+ export declare function createReleaseDisclosureLedger(): ReleaseDisclosureLedger;
38
49
  export interface SettlementWhoView {
39
50
  party: string;
40
51
  approver?: string;
@@ -1,6 +1,8 @@
1
1
  import { ccToolDenialKindForSettledBy, isCcToolDenialKind, isGateDeniedByWord } from './gateVocabulary.js';
2
2
  import { GATE_PARKED_ERROR_CODE } from './engineErrorCodes.js';
3
3
  import { CORE_MODE_RELEASE_REASONS, CORE_SETTLEMENT_KINDS } from './generated/engineFactTables.js';
4
+ import { currentEngineWord } from './engineWordRenames.js';
5
+ import { readAskOrigin, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
4
6
  function str(v) {
5
7
  return typeof v === 'string' && v.length > 0 ? v : undefined;
6
8
  }
@@ -8,6 +10,62 @@ export const GATE_MODE_RELEASE_REASON_WORDS = CORE_MODE_RELEASE_REASONS;
8
10
  export function isGateModeReleaseReasonWord(v) {
9
11
  return typeof v === 'string' && CORE_MODE_RELEASE_REASONS.includes(v);
10
12
  }
13
+ const MODE_RELEASE_SENTENCE_BY_REASON = Object.freeze({
14
+ rule_unreadable: 'The permission mode let this call run without asking, even though it could not be checked against your saved permission rules.',
15
+ target_unresolved: 'The permission mode let this call run without asking, even though it could not be determined where its write lands on disk, so whether it lands on a guarded location is unknown.',
16
+ });
17
+ const MODE_RELEASE_UNRECOGNISED_SENTENCE = 'The permission mode let this call run without asking, for a reason this client does not recognise.';
18
+ export function modeReleaseReasonSentence(reason) {
19
+ try {
20
+ if (typeof reason !== 'string' || reason === '')
21
+ return undefined;
22
+ const word = currentEngineWord(reason);
23
+ return Object.hasOwn(MODE_RELEASE_SENTENCE_BY_REASON, word)
24
+ ? MODE_RELEASE_SENTENCE_BY_REASON[word]
25
+ : MODE_RELEASE_UNRECOGNISED_SENTENCE;
26
+ }
27
+ catch {
28
+ return undefined;
29
+ }
30
+ }
31
+ const RELEASE_DISCLOSURE_LEDGER_MAX = 256;
32
+ function releaseDisclosureKeyOf(identity) {
33
+ try {
34
+ if (typeof identity !== 'object' || identity === null)
35
+ return undefined;
36
+ const callId = readOwnDataNonEmptyString(identity, 'toolCallId');
37
+ if (callId !== undefined) {
38
+ const epoch = readOwnDataValue(identity, 'epoch');
39
+ const scope = typeof epoch === 'string' ? epoch : typeof epoch === 'number' && Number.isFinite(epoch) ? String(epoch) : '';
40
+ return JSON.stringify(['call', scope, callId]);
41
+ }
42
+ const cardKey = readOwnDataNonEmptyString(identity, 'callKey');
43
+ return cardKey !== undefined ? JSON.stringify(['card', cardKey]) : undefined;
44
+ }
45
+ catch {
46
+ return undefined;
47
+ }
48
+ }
49
+ export function createReleaseDisclosureLedger() {
50
+ const said = new Set();
51
+ return Object.freeze({
52
+ has(identity) {
53
+ const key = releaseDisclosureKeyOf(identity);
54
+ return key !== undefined && said.has(key);
55
+ },
56
+ mark(identity) {
57
+ const key = releaseDisclosureKeyOf(identity);
58
+ if (key === undefined || said.has(key))
59
+ return;
60
+ said.add(key);
61
+ if (said.size > RELEASE_DISCLOSURE_LEDGER_MAX) {
62
+ const oldest = said.values().next();
63
+ if (oldest.done !== true)
64
+ said.delete(oldest.value);
65
+ }
66
+ },
67
+ });
68
+ }
11
69
  export const SETTLEMENT_KIND_WORDS = CORE_SETTLEMENT_KINDS;
12
70
  function readWho(v) {
13
71
  if (typeof v !== 'object' || v === null || Array.isArray(v))
@@ -32,7 +90,8 @@ function readSettlement(v) {
32
90
  const who = readWho(s.who);
33
91
  if (kind === undefined || who === undefined)
34
92
  return undefined;
35
- const when = typeof s.when === 'number' && Number.isFinite(s.when) ? s.when : undefined;
93
+ const whenRaw = s.when;
94
+ const when = typeof whenRaw === 'number' && Number.isFinite(whenRaw) ? whenRaw : undefined;
36
95
  const note = str(s.note);
37
96
  return {
38
97
  kind,
@@ -62,7 +121,7 @@ function readModeRelease(raw) {
62
121
  const classes = nonEmptyStringList(r.classes);
63
122
  if (mode === undefined || askClass === undefined || classes === undefined)
64
123
  return undefined;
65
- const origin = str(r.origin);
124
+ const origin = readAskOrigin(r);
66
125
  const mandate = str(r.mandate);
67
126
  const reason = str(r.reason);
68
127
  return {
@@ -94,7 +153,7 @@ function readClassifierRound(raw) {
94
153
  }
95
154
  return view;
96
155
  }
97
- export function gateOutcomeOf(frame) {
156
+ function readGateRecord(frame) {
98
157
  if (typeof frame !== 'object' || frame === null || Array.isArray(frame))
99
158
  return undefined;
100
159
  const g = frame.gate;
@@ -107,7 +166,9 @@ export function gateOutcomeOf(frame) {
107
166
  const dr = d;
108
167
  const dk = str(dr.kind);
109
168
  let disposition;
110
- const classifier = readClassifierRound(dr.classifier);
169
+ let causePresent = false;
170
+ const classifierRaw = dr.classifier;
171
+ const classifier = readClassifierRound(classifierRaw);
111
172
  if (dk === 'allowed') {
112
173
  const released = readModeRelease(dr.released);
113
174
  disposition = {
@@ -120,7 +181,9 @@ export function gateOutcomeOf(frame) {
120
181
  const deniedBy = str(dr.deniedBy);
121
182
  if (deniedBy === undefined)
122
183
  return undefined;
123
- const cause = str(dr.cause);
184
+ const causeRaw = dr.cause;
185
+ causePresent = causeRaw !== undefined;
186
+ const cause = str(causeRaw);
124
187
  const mode = str(dr.mode);
125
188
  const askClass = str(dr.askClass);
126
189
  const classes = nonEmptyStringList(dr.classes);
@@ -137,14 +200,23 @@ export function gateOutcomeOf(frame) {
137
200
  else {
138
201
  return undefined;
139
202
  }
140
- const settlement = readSettlement(raw.settlement);
141
- const origin = str(raw.origin);
203
+ const settlementRaw = raw.settlement;
204
+ const settlement = readSettlement(settlementRaw);
205
+ const origin = readAskOrigin(raw);
142
206
  return {
143
- disposition,
144
- ...(settlement !== undefined ? { settlement } : {}),
145
- ...(origin !== undefined ? { origin } : {}),
207
+ view: {
208
+ disposition,
209
+ ...(settlement !== undefined ? { settlement } : {}),
210
+ ...(origin !== undefined ? { origin } : {}),
211
+ },
212
+ settlementPresent: settlementRaw !== undefined,
213
+ causePresent,
214
+ classifierPresent: classifierRaw !== undefined,
146
215
  };
147
216
  }
217
+ export function gateOutcomeOf(frame) {
218
+ return readGateRecord(frame)?.view;
219
+ }
148
220
  export function isGateParkedToolEnd(frame) {
149
221
  if (typeof frame !== 'object' || frame === null || Array.isArray(frame))
150
222
  return false;
@@ -189,21 +261,19 @@ export function ccToolDenialKindForToolEnd(frame) {
189
261
  return stamped;
190
262
  if (frame._sema_denial_unclassified === true)
191
263
  return undefined;
192
- const outcome = gateOutcomeOf(frame);
264
+ const record = readGateRecord(frame);
265
+ const outcome = record?.view;
193
266
  const kind = outcome?.settlement?.kind;
194
267
  if (kind === 'human_refused')
195
268
  return ccToolDenialKindForSettledBy('human');
196
269
  if (kind === 'policy_refused')
197
270
  return ccToolDenialKindForSettledBy('policy');
198
- const rawGate = frame.gate;
199
- const settlementAbsent = typeof rawGate === 'object' && rawGate !== null && rawGate.settlement === undefined;
200
- if (outcome !== undefined && settlementAbsent && outcome.disposition.kind === 'denied') {
271
+ if (record !== undefined && outcome !== undefined && !record.settlementPresent && outcome.disposition.kind === 'denied') {
201
272
  const by = outcome.disposition.deniedBy;
202
273
  if (by === 'ask_resolution' || !isGateDeniedByWord(by))
203
274
  return undefined;
204
275
  if (DENIED_BY_MAY_CARRY_CAUSE.has(by)) {
205
- const rawDisposition = rawKeyOf(rawGate, 'disposition');
206
- if (rawKeyOf(rawDisposition, 'cause') !== undefined) {
276
+ if (record.causePresent) {
207
277
  const cause = outcome.disposition.cause;
208
278
  if (cause === 'unavailable')
209
279
  return 'automode-unavailable';
@@ -213,14 +283,13 @@ export function ccToolDenialKindForToolEnd(frame) {
213
283
  }
214
284
  if (by === 'classifier')
215
285
  return 'automode-blocked';
216
- if (rawKeyOf(rawDisposition, 'classifier') !== undefined)
286
+ if (record.classifierPresent)
217
287
  return undefined;
218
288
  }
219
289
  return ccToolDenialKindForSettledBy('policy');
220
290
  }
221
291
  return undefined;
222
292
  }
223
- const rawKeyOf = (holder, key) => typeof holder === 'object' && holder !== null ? holder[key] : undefined;
224
293
  const DENIED_BY_MAY_CARRY_CAUSE = new Set(['classifier', 'policy']);
225
294
  const _gateOutcomeShapePin = (w) => w;
226
295
  void _gateOutcomeShapePin;
@@ -1,5 +1,5 @@
1
- import { CORE_DENIED_BY_VALUES } from './generated/engineFactTables.js';
2
- import type { APPROVAL_MANDATE_WORDS } from './hitl/toolApprovalWire.js';
1
+ import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
2
+ import { PRIOR_ENGINE_WORD_RENAMES, type PriorEngineWord } from './engineWordRenames.js';
3
3
  export declare const CC_TOOL_DENIAL_KINDS: readonly ["user-rejected", "permission-rule", "automode-blocked", "automode-unavailable", "automode-parsing-error", "interrupted", "cancelled"];
4
4
  export type CcToolDenialKind = (typeof CC_TOOL_DENIAL_KINDS)[number];
5
5
  export declare function isCcToolDenialKind(v: unknown): v is CcToolDenialKind;
@@ -11,6 +11,11 @@ export declare function isGateDeniedByWord(v: unknown): v is GateDeniedByWord;
11
11
  export declare function gateDeniedByDetail(deniedBy: unknown): string;
12
12
  export declare function askOriginDetail(origin: unknown): string;
13
13
  export declare function mandatedApprovalDetail(): string;
14
+ type RetiredMandateWord = {
15
+ [K in PriorEngineWord]: (typeof PRIOR_ENGINE_WORD_RENAMES)[K] extends (typeof CORE_PERSISTED_RULE_MANDATES)[number] ? K : never;
16
+ }[PriorEngineWord];
17
+ export declare const APPROVAL_MANDATE_WORDS: readonly ((typeof CORE_PERSISTED_RULE_MANDATES)[number] | RetiredMandateWord)[];
14
18
  export type ApprovalMandateWord = (typeof APPROVAL_MANDATE_WORDS)[number];
15
19
  export declare function isApprovalMandateWord(v: unknown): v is ApprovalMandateWord;
16
20
  export declare function approvalMandateDetail(word: ApprovalMandateWord): string;
21
+ export {};
@@ -1,4 +1,5 @@
1
- import { CORE_DENIED_BY_VALUES } from './generated/engineFactTables.js';
1
+ import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
2
+ import { PRIOR_ENGINE_WORD_RENAMES } from './engineWordRenames.js';
2
3
  export const CC_TOOL_DENIAL_KINDS = Object.freeze([
3
4
  'user-rejected',
4
5
  'permission-rule',
@@ -71,6 +72,8 @@ export function askOriginDetail(origin) {
71
72
  export function mandatedApprovalDetail() {
72
73
  return 'no saved allow rule and no remembered answer can retire this question; each call is settled on its own — by you here or by an automatic check the deployment runs — and an answer covers only that call';
73
74
  }
75
+ const RETIRED_MANDATE_WORDS = Object.freeze(Object.keys(PRIOR_ENGINE_WORD_RENAMES).filter((k) => CORE_PERSISTED_RULE_MANDATES.includes(PRIOR_ENGINE_WORD_RENAMES[k])));
76
+ export const APPROVAL_MANDATE_WORDS = Object.freeze([...CORE_PERSISTED_RULE_MANDATES, ...RETIRED_MANDATE_WORDS]);
74
77
  const _mandateWordsPin = true;
75
78
  void _mandateWordsPin;
76
79
  export function isApprovalMandateWord(v) {
@@ -82,6 +85,7 @@ const APPROVAL_MANDATE_SENTENCES = Object.freeze({
82
85
  probe_mandate: 'the check run on this call marked it as needing its own confirmation (the built-in shell check does so for a read outside the directories allowed for this session)',
83
86
  probe_unanswered: 'the check run on this call did not answer (it timed out or failed; this client cannot tell which), so whether the call stays inside the directories allowed for this session is unknown',
84
87
  write_protection: "this change lands on a protected location (the agent's own configuration), which is confirmed one change at a time",
88
+ target_unresolved: 'where this change lands on disk could not be determined (a link on the way could not be examined, or the target could not be resolved), so whether it lands on a guarded location is unknown',
85
89
  write_protection_unresolved: 'the protected-location check could not tell where this change lands, so whether it touches a protected location is unknown',
86
90
  });
87
91
  const APPROVAL_MANDATE_SET = new Set(Object.keys(APPROVAL_MANDATE_SENTENCES));
@@ -7,6 +7,6 @@ export const CORE_SHELL_FACE_TOOL_NAMES = Object.freeze([
7
7
  "Monitor",
8
8
  ]);
9
9
  export const CORE_RELEASABLE_ASK_CLASSES_BY_FACE = Object.freeze({
10
- "shell": Object.freeze(["transcript_write", "rule_unreadable", "write_protection_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
10
+ "shell": Object.freeze(["transcript_write", "rule_unreadable", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
11
11
  "other": Object.freeze(["transcript_write", "rule_unreadable", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
12
12
  });
@@ -8,7 +8,7 @@ export declare const CORE_DENIED_BY_VALUES: readonly ["policy", "hook", "org", "
8
8
  export declare const CORE_PERMISSION_MODE_FOLD_REASONS: readonly string[];
9
9
  export declare const CORE_ENGINE_CARD_TYPES: readonly string[];
10
10
  export declare const CORE_TOOL_DECLARATION_CODES: readonly string[];
11
- export declare const CORE_MODE_RELEASE_REASONS: readonly ["rule_unreadable", "write_protection_unresolved"];
11
+ export declare const CORE_MODE_RELEASE_REASONS: readonly ["rule_unreadable", "target_unresolved"];
12
12
  export declare const CORE_HOOK_TOOL_ALIASES: Readonly<Record<string, string>>;
13
13
  export declare const CORE_ASK_EVIDENCE_ABSENCE_VALUES: readonly ["not_wired", "not_adjudicated", "unavailable", "no_match", "not_reported"];
14
14
  export declare const CORE_SYSTEM_INJECTION_PRIORITIES: readonly ["now", "next", "later"];
@@ -21,9 +21,9 @@ export interface CoreModeArbitrationRow {
21
21
  readonly ruleMayClear: boolean;
22
22
  readonly hookAskFloor: boolean;
23
23
  }
24
- export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "transcript_write" | "org_rule" | "governance_unavailable" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "write_protection_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
24
+ export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "governance_unavailable" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "target_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
25
25
  export declare const CORE_SKILL_GRANT_ORIGINS: readonly ["model", "user", "inherited"];
26
- export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "path_pattern", "domain", "content_unsupported", "grammar", "tool_name", "near_miss"];
26
+ export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss"];
27
27
  export declare const CORE_ALLOW_RULE_MEMBERS: readonly ["hook", "deployment", "persisted", "skill", "request"];
28
28
  export declare const CORE_RULE_TOOL_NAME_VERDICTS: readonly ["current", "retired", "unprefixed_namespace", "unmintable_segment"];
29
29
  export declare const CORE_SETTLEMENT_KINDS: readonly ["human_allowed", "human_refused", "approval_window_expired", "denial_limit_window_expired", "park_sla_expired", "no_approver", "approver_unavailable", "approver_error", "approver_contract", "presentation_failed", "blanket_allow_refused", "policy_allowed", "policy_refused", "task_aborted"];
@@ -32,6 +32,7 @@ export declare const CORE_AUTO_MODE_UNAVAILABLE_CAUSES: readonly ["error", "time
32
32
  export declare const CORE_DEFAULT_TIER_ORDER: readonly ["ultra", "max", "pro", "flash", "lite"];
33
33
  export declare const CORE_CC_MODEL_TIER_ALIASES: Readonly<Record<"fable" | "mythos" | "opus" | "sonnet" | "haiku", (typeof CORE_DEFAULT_TIER_ORDER)[number]>>;
34
34
  export declare const CORE_DURABLE_AGENT_HANDLE_RE: RegExp;
35
+ export declare const CORE_TASK_HANDLE_PREFIXES: Readonly<Record<"background_bash" | "workflow" | "background_agent" | "monitor", string>>;
35
36
  export declare const CORE_PERMISSION_MODE_CLASSES: readonly ["bypass", "prompting"];
36
37
  export declare const CORE_MCP_LIVENESS_STATES: readonly ["reachable", "unreachable", "unknown"];
37
38
  export declare const CORE_RULE_BEHAVIORS: readonly ["deny", "ask", "allow"];
@@ -40,3 +41,4 @@ export declare const CORE_MAX_PENDING_STEER_CHARS: number;
40
41
  export declare const CORE_PROMPT_BLOCK_CAUSES: readonly ["block", "crashed", "timeout", "cancelled"];
41
42
  export declare const CORE_PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions", "dontAsk"];
42
43
  export declare const CORE_APPROVAL_REACH: readonly ["none"];
44
+ export declare const CORE_PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "target_unresolved"];
@@ -113,7 +113,7 @@ export const CORE_TOOL_DECLARATION_CODES = Object.freeze([
113
113
  ]);
114
114
  export const CORE_MODE_RELEASE_REASONS = Object.freeze([
115
115
  "rule_unreadable",
116
- "write_protection_unresolved",
116
+ "target_unresolved",
117
117
  ]);
118
118
  export const CORE_HOOK_TOOL_ALIASES = Object.freeze(Object.assign(Object.create(null), Object.fromEntries([
119
119
  ["ListPeers", "ListAgents"],
@@ -147,6 +147,7 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
147
147
  "ancestor": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
148
148
  "dangerous_delete": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
149
149
  "unverifiable_delete": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
150
+ "unverifiable_shell_text": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
150
151
  "transcript_write": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
151
152
  "org_rule": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
152
153
  "governance_unavailable": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
@@ -157,7 +158,7 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
157
158
  "requires_user_interaction": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
158
159
  "operator_forced": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
159
160
  "shell_floor": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
160
- "write_protection_unresolved": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true }),
161
+ "target_unresolved": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true }),
161
162
  "probe": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
162
163
  "write_protection": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true }),
163
164
  "tool_marks_mcp": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
@@ -176,8 +177,6 @@ export const CORE_SKILL_GRANT_ORIGINS = Object.freeze([
176
177
  export const CORE_ALLOW_ENTRY_INERT_REASONS = Object.freeze([
177
178
  "wildcard_all",
178
179
  "namespace_wildcard",
179
- "path_pattern",
180
- "domain",
181
180
  "content_unsupported",
182
181
  "grammar",
183
182
  "tool_name",
@@ -235,6 +234,12 @@ export const CORE_CC_MODEL_TIER_ALIASES = Object.freeze({
235
234
  "haiku": "lite",
236
235
  });
237
236
  export const CORE_DURABLE_AGENT_HANDLE_RE = Object.freeze(/^a[0-9a-f]{6,32}$/);
237
+ export const CORE_TASK_HANDLE_PREFIXES = Object.freeze({
238
+ "background_bash": "b",
239
+ "workflow": "w",
240
+ "background_agent": "a",
241
+ "monitor": "m",
242
+ });
238
243
  export const CORE_PERMISSION_MODE_CLASSES = Object.freeze([
239
244
  "bypass",
240
245
  "prompting",
@@ -268,3 +273,11 @@ export const CORE_PERMISSION_MODES = Object.freeze([
268
273
  export const CORE_APPROVAL_REACH = Object.freeze([
269
274
  "none",
270
275
  ]);
276
+ export const CORE_PERSISTED_RULE_MANDATES = Object.freeze([
277
+ "operator_always",
278
+ "tool_marks",
279
+ "probe_mandate",
280
+ "probe_unanswered",
281
+ "write_protection",
282
+ "target_unresolved",
283
+ ]);