@sema-agent/client-core 0.100.0 → 0.102.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 (358) hide show
  1. package/CHANGELOG.md +452 -0
  2. package/README.md +172 -120
  3. package/dist/adapt/arms.js +51 -16
  4. package/dist/adapt/textStream.js +7 -4
  5. package/dist/adapt/toolCards.d.ts +2 -1
  6. package/dist/adapt/toolCards.js +28 -13
  7. package/dist/adapt.d.ts +1 -1
  8. package/dist/adapt.js +8 -2
  9. package/dist/adapter/activeRunSelfHeal.d.ts +24 -2
  10. package/dist/adapter/activeRunSelfHeal.js +108 -6
  11. package/dist/adapter/downstream/eventToSdkMessage.js +38 -79
  12. package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
  13. package/dist/adapter/downstream/terminalToSdkResult.js +209 -39
  14. package/dist/adapter/downstream/wiringManifestView.d.ts +1 -0
  15. package/dist/adapter/downstream/wiringManifestView.js +138 -0
  16. package/dist/adapter/runStream.d.ts +4 -4
  17. package/dist/adapter/runStream.js +158 -43
  18. package/dist/agentsWireCaps.d.ts +2 -7
  19. package/dist/agentsWireCaps.js +1 -2
  20. package/dist/approvalDecidedByCapability.js +2 -2
  21. package/dist/approvalFrameFamilies.d.ts +33 -0
  22. package/dist/approvalFrameFamilies.js +120 -0
  23. package/dist/approvalsStreamLiveCapability.js +2 -2
  24. package/dist/attachmentsWireCaps.js +41 -13
  25. package/dist/callerCwdCapability.js +2 -2
  26. package/dist/centerWiringCapability.js +2 -2
  27. package/dist/clockReading.d.ts +2 -0
  28. package/dist/clockReading.js +4 -0
  29. package/dist/cloudConfigWireCaps.d.ts +19 -5
  30. package/dist/cloudConfigWireCaps.js +193 -56
  31. package/dist/compensations.js +1 -1
  32. package/dist/coreValuePorts.d.ts +12 -2
  33. package/dist/coreValuePorts.js +9 -0
  34. package/dist/decideFailureNote.js +5 -3
  35. package/dist/decideReceipt.js +2 -2
  36. package/dist/deviceExecutorManagementCapability.js +2 -2
  37. package/dist/deviceFlowPolling.js +1 -1
  38. package/dist/disableSkillsWire.d.ts +1 -1
  39. package/dist/disableSkillsWire.js +4 -3
  40. package/dist/displayUntrusted.d.ts +9 -4
  41. package/dist/displayUntrusted.js +834 -104
  42. package/dist/engineCapReader.js +1 -1
  43. package/dist/engineConfigDrift.js +1 -1
  44. package/dist/engineErrorCodes.d.ts +14 -5
  45. package/dist/engineErrorCodes.js +27 -6
  46. package/dist/engineGenerationConvergence.d.ts +39 -0
  47. package/dist/engineGenerationConvergence.js +95 -0
  48. package/dist/engineGenerationPort.d.ts +61 -0
  49. package/dist/engineGenerationPort.js +144 -0
  50. package/dist/engineHealthFacts.d.ts +23 -0
  51. package/dist/engineHealthFacts.js +92 -0
  52. package/dist/engineIdentity.d.ts +4 -0
  53. package/dist/engineIdentity.js +11 -0
  54. package/dist/engineNoticeCodes.d.ts +2 -5
  55. package/dist/engineRowRef.js +4 -0
  56. package/dist/engineSessionMessages.js +2 -2
  57. package/dist/engineToolDirectory.js +2 -2
  58. package/dist/engineWireFor.d.ts +99 -0
  59. package/dist/engineWireFor.js +248 -6
  60. package/dist/engineWireTarget.d.ts +1 -0
  61. package/dist/engineWireTarget.js +8 -0
  62. package/dist/env/uiLanguage.js +1 -1
  63. package/dist/errorSupplementRoles.d.ts +3 -0
  64. package/dist/errorSupplementRoles.js +37 -0
  65. package/dist/executionLaneCapability.js +2 -2
  66. package/dist/fileHistoryCaptureCapability.js +3 -3
  67. package/dist/finalVerifyWire.d.ts +6 -3
  68. package/dist/finalVerifyWire.js +6 -23
  69. package/dist/flagInput.d.ts +4 -0
  70. package/dist/flagInput.js +24 -0
  71. package/dist/fleet/fleetLedger.js +5 -2
  72. package/dist/fleet/fleetProjection.d.ts +1 -0
  73. package/dist/fleet/fleetProjection.js +16 -3
  74. package/dist/gateVocabulary.js +3 -0
  75. package/dist/generated/engineFactTables.d.ts +7 -3
  76. package/dist/generated/engineFactTables.js +52 -0
  77. package/dist/generated/engineNoticeTables.js +12 -0
  78. package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
  79. package/dist/generated/settingsSchemaActiveTiers.js +14 -0
  80. package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
  81. package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
  82. package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
  83. package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
  84. package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
  85. package/dist/generated/settingsSchemaDefaultModel.js +25 -0
  86. package/dist/generated/settingsSchemaFns.d.ts +54 -0
  87. package/dist/generated/settingsSchemaFns.js +26 -1
  88. package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
  89. package/dist/generated/settingsSchemaMcpRequestEntry.js +1 -7
  90. package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
  91. package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
  92. package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
  93. package/dist/generated/settingsSchemaSettingsSources.js +58 -0
  94. package/dist/generated/settingsSchemaTables.d.ts +2 -0
  95. package/dist/generated/settingsSchemaTables.js +13 -0
  96. package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
  97. package/dist/generated/settingsSchemaUrlPattern.js +183 -0
  98. package/dist/headlessPermissionModeWire.d.ts +18 -2
  99. package/dist/headlessPermissionModeWire.js +30 -19
  100. package/dist/hitl/allowRuleShadow.js +7 -5
  101. package/dist/hitl/approvalCardReading.d.ts +3 -0
  102. package/dist/hitl/approvalCardReading.js +17 -0
  103. package/dist/hitl/approvalCompleteParked.js +1 -1
  104. package/dist/hitl/approvalDelivery.d.ts +87 -0
  105. package/dist/hitl/approvalDelivery.js +193 -0
  106. package/dist/hitl/approvalResolution.d.ts +11 -0
  107. package/dist/hitl/approvalResolution.js +50 -11
  108. package/dist/hitl/askClassPair.d.ts +6 -0
  109. package/dist/hitl/askClassPair.js +30 -3
  110. package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
  111. package/dist/hitl/askParkAutoReopenBlock.js +117 -0
  112. package/dist/hitl/askParkRowRouting.js +4 -1
  113. package/dist/hitl/attributionLadder.d.ts +42 -3
  114. package/dist/hitl/attributionLadder.js +79 -8
  115. package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
  116. package/dist/hitl/automaticAnswerVerdict.js +46 -11
  117. package/dist/hitl/crashConverged.js +2 -2
  118. package/dist/hitl/decisionConflict.d.ts +6 -2
  119. package/dist/hitl/decisionConflict.js +24 -9
  120. package/dist/hitl/decisionRefusal.d.ts +20 -10
  121. package/dist/hitl/decisionRefusal.js +99 -54
  122. package/dist/hitl/decisionSend.d.ts +3 -0
  123. package/dist/hitl/decisionSend.js +87 -103
  124. package/dist/hitl/frameRouter.d.ts +1 -0
  125. package/dist/hitl/frameRouter.js +9 -2
  126. package/dist/hitl/hitlBridge.d.ts +18 -6
  127. package/dist/hitl/hitlBridge.js +41 -37
  128. package/dist/hitl/livePendingAsk.js +4 -3
  129. package/dist/hitl/noAllowCause.js +1 -1
  130. package/dist/hitl/parkResolver.js +3 -2
  131. package/dist/hitl/persistedRulesWire.js +1 -0
  132. package/dist/hitl/planReviewWire.d.ts +4 -0
  133. package/dist/hitl/planReviewWire.js +59 -30
  134. package/dist/hitl/resumeRunningCard.d.ts +3 -2
  135. package/dist/hitl/resumeRunningCard.js +17 -11
  136. package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
  137. package/dist/hitl/sessionPolicyDeliverable.js +62 -29
  138. package/dist/hitl/sessionPolicyWire.d.ts +13 -3
  139. package/dist/hitl/sessionPolicyWire.js +81 -16
  140. package/dist/hitl/standingRows.js +1 -1
  141. package/dist/hitl/toolApprovalWire.d.ts +9 -10
  142. package/dist/hitl/toolApprovalWire.js +72 -54
  143. package/dist/hookMatcherVerdict.d.ts +2 -0
  144. package/dist/hookMatcherVerdict.js +12 -0
  145. package/dist/hooksCompactTransition.d.ts +19 -0
  146. package/dist/hooksCompactTransition.js +41 -0
  147. package/dist/hooksWireCaps.d.ts +1 -1
  148. package/dist/hooksWireCaps.js +202 -203
  149. package/dist/host.d.ts +1 -14
  150. package/dist/host.js +0 -8
  151. package/dist/hostCallbackGuard.d.ts +1 -0
  152. package/dist/hostCallbackGuard.js +1 -1
  153. package/dist/hostSettingsSource.d.ts +172 -0
  154. package/dist/hostSettingsSource.js +675 -0
  155. package/dist/hostTurnSettings.d.ts +73 -17
  156. package/dist/hostTurnSettings.js +594 -97
  157. package/dist/httpHookPolicy.d.ts +37 -0
  158. package/dist/httpHookPolicy.js +176 -0
  159. package/dist/humanTurn.d.ts +2 -1
  160. package/dist/humanTurn.js +37 -7
  161. package/dist/humanTurnRead.js +4 -3
  162. package/dist/humanTurnSentences.d.ts +10 -0
  163. package/dist/humanTurnSentences.js +74 -0
  164. package/dist/i18n/messages.en.d.ts +222 -2
  165. package/dist/i18n/messages.en.js +225 -5
  166. package/dist/i18n/messages.zh.js +237 -5
  167. package/dist/i18n/translate.js +3 -3
  168. package/dist/index.d.ts +77 -15
  169. package/dist/index.js +50 -13
  170. package/dist/inheritEnvCapability.d.ts +3 -1
  171. package/dist/inheritEnvCapability.js +31 -17
  172. package/dist/inheritEnvWire.d.ts +2 -1
  173. package/dist/inheritEnvWire.js +11 -5
  174. package/dist/interactiveHalt.d.ts +3 -1
  175. package/dist/interactiveHalt.js +2 -0
  176. package/dist/interactiveInterrupt.d.ts +2 -0
  177. package/dist/interactiveInterrupt.js +15 -0
  178. package/dist/interactiveToolsWire.d.ts +4 -2
  179. package/dist/interactiveToolsWire.js +5 -5
  180. package/dist/jsonFaithful.d.ts +20 -0
  181. package/dist/jsonFaithful.js +152 -0
  182. package/dist/limitsWire.d.ts +7 -2
  183. package/dist/limitsWire.js +19 -13
  184. package/dist/liveInitToolFace.d.ts +6 -1
  185. package/dist/liveInitToolFace.js +5 -3
  186. package/dist/liveModelCatalog.d.ts +22 -0
  187. package/dist/liveModelCatalog.js +132 -18
  188. package/dist/mcpPanel.js +1 -1
  189. package/dist/mcpProbeCapability.js +2 -2
  190. package/dist/mcpStatusSupersetKeys.d.ts +24 -0
  191. package/dist/mcpStatusSupersetKeys.js +45 -0
  192. package/dist/mcpToolToggles.js +2 -1
  193. package/dist/mcpWireCaps.d.ts +39 -1
  194. package/dist/mcpWireCaps.js +254 -50
  195. package/dist/memoryComplianceCapability.js +2 -2
  196. package/dist/memoryOriginCapability.js +2 -2
  197. package/dist/model/catalogDefault.d.ts +24 -0
  198. package/dist/model/catalogDefault.js +4 -0
  199. package/dist/model/liveCatalogShape.js +5 -4
  200. package/dist/model/modelsPolicy.js +4 -3
  201. package/dist/model/onboardJudgement.d.ts +1 -0
  202. package/dist/model/onboardJudgement.js +1 -1
  203. package/dist/model/subagentModelWord.js +2 -2
  204. package/dist/modelCapabilityProbe.js +6 -6
  205. package/dist/modelIdentityResolvability.d.ts +10 -1
  206. package/dist/modelIdentityResolvability.js +62 -39
  207. package/dist/modsFace.d.ts +8 -0
  208. package/dist/modsFace.js +59 -0
  209. package/dist/modsKernelIdentity.d.ts +10 -0
  210. package/dist/modsKernelIdentity.js +103 -0
  211. package/dist/modsKernelTransit.d.ts +8 -0
  212. package/dist/modsKernelTransit.js +6 -0
  213. package/dist/notifications.d.ts +30 -12
  214. package/dist/notifications.js +241 -53
  215. package/dist/outputStyleSeatCapability.js +2 -2
  216. package/dist/ownKey.d.ts +12 -0
  217. package/dist/ownKey.js +179 -3
  218. package/dist/panelReduce.js +1 -1
  219. package/dist/peerFrames.d.ts +1 -1
  220. package/dist/peerFrames.js +6 -2
  221. package/dist/peerLaneCapability.js +2 -2
  222. package/dist/permissionModesCapability.js +4 -4
  223. package/dist/permissionRuleIssue.js +2 -0
  224. package/dist/permissionRulesWriteCapability.js +2 -2
  225. package/dist/permissionsAllowGrantCapability.js +2 -2
  226. package/dist/permissionsDeclaration.d.ts +43 -4
  227. package/dist/permissionsDeclaration.js +102 -35
  228. package/dist/pluginHooksWire.d.ts +20 -4
  229. package/dist/pluginHooksWire.js +92 -53
  230. package/dist/prepareRefusal.d.ts +3 -2
  231. package/dist/prepareRefusal.js +27 -9
  232. package/dist/printInitToolFace.js +2 -2
  233. package/dist/printModelStatus.js +1 -1
  234. package/dist/printToolResultFrame.js +1 -1
  235. package/dist/projectMemory.d.ts +32 -0
  236. package/dist/projectMemory.js +70 -0
  237. package/dist/promptBlockedCopy.d.ts +2 -1
  238. package/dist/promptBlockedCopy.js +2 -1
  239. package/dist/promptDelivery.d.ts +23 -3
  240. package/dist/promptDelivery.js +169 -30
  241. package/dist/providerRejection.d.ts +19 -1
  242. package/dist/providerRejection.js +75 -4
  243. package/dist/queuedDelivery.d.ts +48 -0
  244. package/dist/queuedDelivery.js +233 -0
  245. package/dist/reattachWindow.d.ts +94 -0
  246. package/dist/reattachWindow.js +127 -0
  247. package/dist/request/printNotification.d.ts +1 -1
  248. package/dist/request/printNotification.js +6 -2
  249. package/dist/request/submissionIdentity.d.ts +37 -0
  250. package/dist/request/submissionIdentity.js +65 -0
  251. package/dist/request/taskRequest.d.ts +33 -4
  252. package/dist/request/taskRequest.js +341 -156
  253. package/dist/resultFrameKeys.d.ts +1 -0
  254. package/dist/resultFrameKeys.js +4 -1
  255. package/dist/retryStatus.d.ts +8 -0
  256. package/dist/retryStatus.js +57 -9
  257. package/dist/rewindArchiveCapability.js +2 -2
  258. package/dist/rewindEngineAction.d.ts +2 -0
  259. package/dist/rewindEngineAction.js +23 -1
  260. package/dist/rowKind.d.ts +36 -0
  261. package/dist/rowKind.js +97 -0
  262. package/dist/ruleCompileVerdict.d.ts +18 -0
  263. package/dist/ruleCompileVerdict.js +67 -2
  264. package/dist/ruleReadings.d.ts +58 -0
  265. package/dist/ruleReadings.js +132 -0
  266. package/dist/ruleRefusalSentence.d.ts +4 -0
  267. package/dist/ruleRefusalSentence.js +9 -3
  268. package/dist/runCancelContext.d.ts +0 -1
  269. package/dist/runCancelContext.js +1 -2
  270. package/dist/runTerminal.d.ts +5 -0
  271. package/dist/runTerminal.js +52 -17
  272. package/dist/sandboxWire.d.ts +1 -1
  273. package/dist/sandboxWire.js +4 -6
  274. package/dist/scenarioRefusal.js +1 -1
  275. package/dist/scenarioSkills.d.ts +20 -0
  276. package/dist/scenarioSkills.js +72 -0
  277. package/dist/scenarioWire.d.ts +5 -2
  278. package/dist/scenarioWire.js +9 -9
  279. package/dist/sealedKeyCapability.js +2 -2
  280. package/dist/seam.d.ts +2 -0
  281. package/dist/seam.js +3 -3
  282. package/dist/seatContract.d.ts +68 -7
  283. package/dist/seatContract.js +84 -25
  284. package/dist/selfOrchestrationDenial.js +1 -1
  285. package/dist/sessionBackground.d.ts +165 -0
  286. package/dist/sessionBackground.js +781 -0
  287. package/dist/sessionBackgroundHandoff.d.ts +54 -0
  288. package/dist/sessionBackgroundHandoff.js +321 -0
  289. package/dist/sessionMap.js +4 -1
  290. package/dist/sessionPolicyCapability.js +2 -2
  291. package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
  292. package/dist/sessionRulesChildrenReadLive.js +5 -0
  293. package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
  294. package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
  295. package/dist/sessionSyncFileHistoryCapability.js +2 -2
  296. package/dist/settingsCredentialKeyPaths.js +55 -15
  297. package/dist/settingsHooksSalvage.d.ts +1 -0
  298. package/dist/settingsHooksSalvage.js +7 -1
  299. package/dist/settingsLayerAdmission.d.ts +4 -0
  300. package/dist/settingsLayerAdmission.js +16 -0
  301. package/dist/skillToolListsCapability.js +6 -5
  302. package/dist/skillsWireCaps.d.ts +14 -0
  303. package/dist/skillsWireCaps.js +47 -16
  304. package/dist/slashCommandGate.d.ts +24 -0
  305. package/dist/slashCommandGate.js +74 -0
  306. package/dist/slashCommandTable.d.ts +14 -0
  307. package/dist/slashCommandTable.js +99 -0
  308. package/dist/sqlEngineCapability.js +2 -2
  309. package/dist/steerPriorityCapability.js +2 -2
  310. package/dist/storePostureCapability.js +2 -2
  311. package/dist/subagent/agentStateDetail.js +1 -1
  312. package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
  313. package/dist/subagent/engineDelegatedPrompt.js +38 -7
  314. package/dist/subagent/engineRowStopGate.js +2 -2
  315. package/dist/subagent/engineSubagentResume.js +3 -3
  316. package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
  317. package/dist/subagent/engineTaskHandleWire.js +10 -0
  318. package/dist/submitFailure.d.ts +8 -0
  319. package/dist/submitFailure.js +17 -0
  320. package/dist/supportFloor.d.ts +1 -0
  321. package/dist/supportFloor.js +7 -0
  322. package/dist/terminationIntent.d.ts +55 -0
  323. package/dist/terminationIntent.js +352 -0
  324. package/dist/thinkingLatch.d.ts +69 -0
  325. package/dist/thinkingLatch.js +255 -0
  326. package/dist/thinkingLatchWords.d.ts +7 -0
  327. package/dist/thinkingLatchWords.js +4 -0
  328. package/dist/toolHistoryMismatch.d.ts +8 -0
  329. package/dist/toolHistoryMismatch.js +37 -6
  330. package/dist/toolResult.d.ts +13 -3
  331. package/dist/toolResult.js +159 -32
  332. package/dist/toolResultContent.d.ts +13 -0
  333. package/dist/toolResultContent.js +82 -7
  334. package/dist/toolRoster.d.ts +18 -0
  335. package/dist/toolRoster.js +64 -0
  336. package/dist/turnFailurePresentation.js +27 -90
  337. package/dist/usageLimitAutoResume.d.ts +74 -0
  338. package/dist/usageLimitAutoResume.js +227 -0
  339. package/dist/userAttachmentEnvelope.js +1 -1
  340. package/dist/userAttachmentSeat.js +5 -5
  341. package/dist/userInvokedSkillsCapability.js +2 -2
  342. package/dist/webSearchBackendCapability.js +2 -2
  343. package/dist/wireErrorTriage.js +99 -50
  344. package/dist/wireFailureShape.d.ts +25 -1
  345. package/dist/wireFailureShape.js +92 -5
  346. package/dist/wireRefusalCopy.d.ts +24 -1
  347. package/dist/wireRefusalCopy.js +253 -32
  348. package/dist/wiringFleetDoctor.d.ts +3 -0
  349. package/dist/wiringFleetDoctor.js +21 -0
  350. package/dist/workflow.d.ts +2 -1
  351. package/dist/workflow.js +38 -1
  352. package/dist/workflowClient.d.ts +2 -7
  353. package/dist/workflowsJournalCapability.js +2 -2
  354. package/dist/writeProtectionCapability.js +2 -2
  355. package/docs/INTEGRATION-CLIENTS.md +907 -182
  356. package/package.json +14 -3
  357. package/dist/argvFlagValue.d.ts +0 -8
  358. package/dist/argvFlagValue.js +0 -37
@@ -1,8 +1,8 @@
1
1
  import { CONFIG_LEGACY_TOOL_NAME } from '../engineErrorCodes.js';
2
2
  import { rosterMountedNames } from '../rosterMountedNames.js';
3
- import { ruleCompileVerdict } from '../ruleCompileVerdict.js';
4
- import { readRuleEntry } from '../coreValuePorts.js';
3
+ import { msg, renderMessage } from '../i18n/translate.js';
5
4
  import { readOwnDataValue } from '../ownKey.js';
5
+ import { denyEntryReading, ruleCompileVerdict } from '../ruleCompileVerdict.js';
6
6
  import { ruleToolNameVerdictOf } from '../protocolSegment.js';
7
7
  import { PREFIXES_IN_PROSE, REFUSED_NAME_FIX } from './refusedToolNameProse.js';
8
8
  import { prepareRefusalNoteOf } from '../prepareRefusal.js';
@@ -16,17 +16,60 @@ const WITHHELD_NOTICE = {
16
16
  not_a_tool_name: 'Not written to this session’s rule record: this entry is not exactly one tool name — it is empty, not text, has spaces around the name, is not a single tool name in rule syntax (for example it contains a backslash or a parenthesis, or is longer than a rule can be), or spells its server or agent peer part in a way the engine never uses when naming tools (for example with a dot or a space), so no tool would ever match it.',
17
17
  legacy_tool_name: `Not written to this session’s rule record: unless a tool by exactly this name is available, the engine refuses it — it is a retired tool name, or it contains "__" but does not start with ${PREFIXES_IN_PROSE} — and with it in that record every later run of this session would fail at startup until that entry is removed from the record. ${REFUSED_NAME_FIX}`,
18
18
  not_in_roster: 'Not written to this session’s rule record: the tool roster supplied for this check has no tool by exactly this name, as a name or an alias, with letter case counted — it may be misspelled, or name a tool this deployment does not provide — so recorded as it is it would block nothing here.',
19
+ namespace_covering_unconfirmed: msg('session.policy.withheld.namespaceCoveringUnconfirmed'),
19
20
  };
20
21
  export const SESSION_POLICY_WITHHELD_WHY = Object.freeze(Object.keys(WITHHELD_NOTICE));
21
22
  const MAX_RULES = 10_000;
22
23
  function unreadable() {
23
24
  return { deliverable: {}, withheld: [], unreadable: true };
24
25
  }
25
- function withheldWhyOf(rule) {
26
+ function namespaceCoveringFormOf(rule) {
27
+ if (rule.trim() !== rule)
28
+ return undefined;
29
+ for (const prefix of COVERING_NAMESPACE_PREFIXES) {
30
+ if (!rule.startsWith(prefix))
31
+ continue;
32
+ const segments = rule.slice(prefix.length).split('__');
33
+ const peer = segments[0];
34
+ if (peer === undefined || peer === '' || peer.includes('*'))
35
+ return undefined;
36
+ if (segments.length === 1)
37
+ return 'peer';
38
+ const tool = segments.slice(1).join('__');
39
+ if (tool === '*')
40
+ return 'tool_star';
41
+ return /^[^*]+\*$/.test(tool) ? 'tool_glob' : undefined;
42
+ }
43
+ return undefined;
44
+ }
45
+ function suppliedNamespaceForms(opts) {
46
+ if (opts === undefined || opts === null || typeof opts !== 'object')
47
+ return 'unsupplied';
48
+ let reading;
49
+ try {
50
+ reading = readOwnDataValue(opts, 'namespaceForms');
51
+ }
52
+ catch {
53
+ return 'unsupplied';
54
+ }
55
+ if (reading === undefined || reading === null)
56
+ return 'unsupplied';
57
+ if (typeof reading !== 'object')
58
+ return 'unconfirmed';
59
+ try {
60
+ return readOwnDataValue(reading, 'kind') === 'confirmed' ? 'confirmed' : 'unconfirmed';
61
+ }
62
+ catch {
63
+ return 'unconfirmed';
64
+ }
65
+ }
66
+ function withheldWhyOf(rule, covering, forms) {
26
67
  if (rule.length === 0)
27
68
  return 'not_a_tool_name';
28
69
  if (/(?:^|[^\\])\(/.test(rule))
29
70
  return 'qualified_deny';
71
+ if (covering !== undefined)
72
+ return forms === 'confirmed' ? undefined : 'namespace_covering_unconfirmed';
30
73
  if (rule.includes('*'))
31
74
  return 'wildcard';
32
75
  for (const prefix of COVERING_NAMESPACE_PREFIXES) {
@@ -80,6 +123,7 @@ export function sessionPolicyDeliverable(behavior, rules, opts) {
80
123
  if (known === 'unreadable')
81
124
  return unreadable();
82
125
  const mounted = known === 'absent' ? undefined : known;
126
+ const forms = suppliedNamespaceForms(opts);
83
127
  const withheld = [];
84
128
  if (behavior === 'ask') {
85
129
  for (const r of entries)
@@ -92,7 +136,8 @@ export function sessionPolicyDeliverable(behavior, rules, opts) {
92
136
  withheld.push({ rule: '', why: 'not_a_tool_name' });
93
137
  continue;
94
138
  }
95
- let why = withheldWhyOf(r);
139
+ const covering = forms === 'unsupplied' ? undefined : namespaceCoveringFormOf(r);
140
+ let why = withheldWhyOf(r, covering, forms);
96
141
  const engineAsked = why === undefined;
97
142
  let currentName;
98
143
  if (engineAsked) {
@@ -125,7 +170,7 @@ export function sessionPolicyDeliverable(behavior, rules, opts) {
125
170
  if (grammar === 'refused')
126
171
  why = 'not_a_tool_name';
127
172
  }
128
- if (why === undefined && mounted !== undefined && !mounted.has(r))
173
+ if (why === undefined && mounted !== undefined && !mounted.has(r) && covering === undefined)
129
174
  why = 'not_in_roster';
130
175
  if (why === undefined)
131
176
  exact.push(r);
@@ -144,32 +189,20 @@ export function sessionPolicyDeliverable(behavior, rules, opts) {
144
189
  return { deliverable: { toolDeny: exact }, withheld };
145
190
  }
146
191
  function entryReadingOf(rule) {
147
- try {
148
- const reading = readRuleEntry(rule, 'deny');
149
- if (typeof reading !== 'object' || reading === null)
150
- return 'unknown';
151
- const kind = readOwnDataValue(reading, 'kind');
152
- if (kind === 'row') {
153
- const compiled = readOwnDataValue(reading, 'compiled');
154
- return typeof compiled === 'object' && compiled !== null ? 'row' : 'unknown';
155
- }
156
- if (kind !== 'inert')
157
- return 'unknown';
158
- const reason = readOwnDataValue(reading, 'reason');
159
- if (reason === 'grammar' || reason === 'content_unsupported')
160
- return { why: 'not_a_tool_name', reason };
161
- if (reason === 'wildcard_all' || reason === 'namespace_wildcard')
162
- return { why: 'wildcard', reason };
163
- return 'unknown';
164
- }
165
- catch {
192
+ const reading = denyEntryReading(rule);
193
+ if (reading.kind === 'row')
194
+ return 'row';
195
+ if (reading.kind === 'unknown')
166
196
  return 'unknown';
167
- }
197
+ const reason = reading.reason;
198
+ return reason === 'grammar' || reason === 'content_unsupported' ? { why: 'not_a_tool_name', reason } : { why: 'wildcard', reason };
168
199
  }
169
- export function sessionPolicyWithheldNotice(why) {
170
- return typeof why === 'string' && Object.hasOwn(WITHHELD_NOTICE, why)
171
- ? WITHHELD_NOTICE[why]
172
- : 'Not written to this session’s rule record.';
200
+ export function sessionPolicyWithheldNotice(why, lang) {
201
+ if (typeof why === 'string' && Object.hasOwn(WITHHELD_NOTICE, why)) {
202
+ const sentence = WITHHELD_NOTICE[why];
203
+ return typeof sentence === 'string' ? sentence : renderMessage(sentence, lang);
204
+ }
205
+ return 'Not written to this session’s rule record.';
173
206
  }
174
207
  export function legacyToolNameFailureNoteOf(code) {
175
208
  return code === CONFIG_LEGACY_TOOL_NAME ? prepareRefusalNoteOf(code) : undefined;
@@ -128,14 +128,24 @@ export interface SessionPolicyInertEntryRefusal {
128
128
  export declare function tightenSessionPolicy(facade: SessionPolicyFacade, req: SessionPolicyTightenRequest, opts?: {
129
129
  signal?: AbortSignal;
130
130
  }): Promise<SessionPolicyTightenOutcome>;
131
- export declare function sessionPolicyTightenNotice(outcome: SessionPolicyTightenOutcome, lang?: UiLanguage): string;
131
+ export interface SessionPolicyTightenFacts {
132
+ readonly agentsStartedBeforeFirstRule?: number | undefined;
133
+ readonly workflowsRunning?: number | undefined;
134
+ readonly untrackedBackgroundItems?: number | undefined;
135
+ readonly inFlightUnreadable?: true | undefined;
136
+ }
137
+ export interface SessionPolicyDeploymentFacts {
138
+ readonly operator?: 'present' | 'absent';
139
+ readonly identityAttach?: 'available' | 'unavailable';
140
+ }
141
+ export declare function sessionPolicyTightenNotice(outcome: SessionPolicyTightenOutcome, lang?: UiLanguage, facts?: SessionPolicyTightenFacts, deployment?: SessionPolicyDeploymentFacts): string;
132
142
  export declare function sessionPolicyReadNotice(outcome: Exclude<SessionPolicyReadOutcome, {
133
143
  kind: 'present';
134
144
  }> | {
135
145
  kind: 'no_target';
136
146
  } | {
137
147
  kind: 'not_started';
138
- }): string;
148
+ }, deployment?: SessionPolicyDeploymentFacts): string;
139
149
  export interface SessionPolicyRemovedEntry {
140
150
  readonly field: 'toolDeny' | 'toolAllow';
141
151
  readonly rule: string;
@@ -178,4 +188,4 @@ export type SessionPolicyRosterRequiredWhy = 'absent' | 'unreadable';
178
188
  export declare function removeRefusedSessionRules(facade: SessionPolicyFacade, sessionId: string, roster: ToolRosterView | undefined, opts?: {
179
189
  signal?: AbortSignal;
180
190
  }): Promise<SessionPolicyRemovalOutcome>;
181
- export declare function sessionPolicyRemovalNotice(outcome: SessionPolicyRemovalOutcome): string;
191
+ export declare function sessionPolicyRemovalNotice(outcome: SessionPolicyRemovalOutcome, deployment?: SessionPolicyDeploymentFacts): string;
@@ -1,3 +1,4 @@
1
+ import { appendOwnElement } from '../ownKey.js';
1
2
  import { wireFailureShapeOf } from '../wireFailureShape.js';
2
3
  import { hostLog } from '../host.js';
3
4
  import { msg, renderMessage } from '../i18n/translate.js';
@@ -97,7 +98,7 @@ function narrowBucket(raw, field) {
97
98
  const x = raw[i];
98
99
  if (typeof x !== 'string')
99
100
  return { ok: false, detail: `rule field "${field}" entry ${i} is not a string` };
100
- list.push(x);
101
+ appendOwnElement(list, x);
101
102
  }
102
103
  return { ok: true, list };
103
104
  }
@@ -195,13 +196,13 @@ export function tightenedSessionRules(prior, add) {
195
196
  if (seen.has(x))
196
197
  continue;
197
198
  seen.add(x);
198
- merged.push(x);
199
+ appendOwnElement(merged, x);
199
200
  }
200
201
  for (const x of al ?? []) {
201
202
  if (seen.has(x))
202
203
  continue;
203
204
  seen.add(x);
204
- merged.push(x);
205
+ appendOwnElement(merged, x);
205
206
  }
206
207
  out[field] = merged;
207
208
  }
@@ -329,7 +330,7 @@ function earlierGrammarEntriesOf(prior, outgoing) {
329
330
  if (name === undefined || name === rule)
330
331
  continue;
331
332
  seen.add(rule);
332
- out.push({ field: 'toolAllow', rule });
333
+ appendOwnElement(out, { field: 'toolAllow', rule });
333
334
  }
334
335
  return out;
335
336
  }
@@ -413,11 +414,67 @@ export async function tightenSessionPolicy(facade, req, opts) {
413
414
  return { kind: 'conflict', rev: second.retryAtRev };
414
415
  }
415
416
  const earlierGrammarNote = (lang) => renderMessage(msg('rules.sessionPolicy.tighten.earlierGrammar'), lang);
416
- export function sessionPolicyTightenNotice(outcome, lang) {
417
+ function factSlot(facts, key) {
418
+ try {
419
+ return ownRead(facts, key);
420
+ }
421
+ catch {
422
+ return undefined;
423
+ }
424
+ }
425
+ function factCount(facts, key) {
426
+ const n = factSlot(facts, key);
427
+ return typeof n === 'number' && Number.isSafeInteger(n) && n >= 1 ? n : undefined;
428
+ }
429
+ function firstRuleWorkFactsOf(facts) {
430
+ const none = { agents: undefined, workflows: undefined, untracked: undefined, unreadable: false };
431
+ if (typeof facts !== 'object' || facts === null)
432
+ return none;
433
+ return {
434
+ agents: factCount(facts, 'agentsStartedBeforeFirstRule'),
435
+ workflows: factCount(facts, 'workflowsRunning'),
436
+ untracked: factCount(facts, 'untrackedBackgroundItems'),
437
+ unreadable: factSlot(facts, 'inFlightUnreadable') === true,
438
+ };
439
+ }
440
+ function deploymentHasNoOperator(d) {
441
+ try {
442
+ return typeof d === 'object' && d !== null && ownRead(d, 'operator') === 'absent';
443
+ }
444
+ catch {
445
+ return false;
446
+ }
447
+ }
448
+ function deploymentHasNoIdentity(d) {
449
+ try {
450
+ return typeof d === 'object' && d !== null && ownRead(d, 'identityAttach') === 'unavailable';
451
+ }
452
+ catch {
453
+ return false;
454
+ }
455
+ }
456
+ export function sessionPolicyTightenNotice(outcome, lang, facts, deployment) {
417
457
  const say = (key, params) => renderMessage(msg(key, params), lang);
418
458
  switch (outcome.kind) {
419
- case 'written':
420
- return say('rules.sessionPolicy.tighten.written', { rev: outcome.rev });
459
+ case 'written': {
460
+ const head = say('rules.sessionPolicy.tighten.written', { rev: outcome.rev });
461
+ const w = firstRuleWorkFactsOf(facts);
462
+ const unseen = msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.unseen');
463
+ if (w.unreadable)
464
+ return `${head} ${renderMessage(msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.unreadable'), lang)} ${renderMessage(unseen, lang)}`;
465
+ const parts = [];
466
+ if (w.agents !== undefined)
467
+ appendOwnElement(parts, msg(w.agents === 1 ? 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.agents.one' : 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.agents.many', { n: w.agents }));
468
+ if (w.workflows !== undefined)
469
+ appendOwnElement(parts, msg(w.workflows === 1 ? 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.workflows.one' : 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.workflows.many', { n: w.workflows }));
470
+ if (w.untracked !== undefined)
471
+ appendOwnElement(parts, msg(w.untracked === 1 ? 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.untracked.one' : 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.untracked.many', { n: w.untracked }));
472
+ const [p0, p1, p2] = parts;
473
+ if (p0 === undefined)
474
+ return head;
475
+ const list = p1 === undefined ? p0 : p2 === undefined ? msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.list.two', { a: p0, b: p1 }) : msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.list.three', { a: p0, b: p1, c: p2 });
476
+ return `${head} ${renderMessage(msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.counts', { list }), lang)} ${renderMessage(unseen, lang)}`;
477
+ }
421
478
  case 'conflict':
422
479
  return say('rules.sessionPolicy.tighten.conflict');
423
480
  case 'loosen_forbidden':
@@ -435,13 +492,13 @@ export function sessionPolicyTightenNotice(outcome, lang) {
435
492
  case 'session_not_found':
436
493
  return say('rules.sessionPolicy.tighten.unknown.sessionNotFound');
437
494
  case 'session_ownerless':
438
- return say('rules.sessionPolicy.tighten.unknown.sessionOwnerless');
495
+ return say(deploymentHasNoIdentity(deployment) ? 'rules.sessionPolicy.tighten.unknown.sessionOwnerless.noIdentity' : 'rules.sessionPolicy.tighten.unknown.sessionOwnerless');
439
496
  case 'unauthorized':
440
497
  return say('rules.sessionPolicy.tighten.unknown.unauthorized');
441
498
  case 'request_rejected':
442
499
  return say('rules.sessionPolicy.tighten.unknown.requestRejected');
443
500
  case 'store_corrupt':
444
- return say('rules.sessionPolicy.tighten.unknown.storeCorrupt');
501
+ return say(deploymentHasNoOperator(deployment) ? 'rules.sessionPolicy.tighten.unknown.storeCorrupt.noOperator' : 'rules.sessionPolicy.tighten.unknown.storeCorrupt');
445
502
  case 'read_unreadable':
446
503
  return say('rules.sessionPolicy.tighten.unknown.readUnreadable');
447
504
  case 'read_failed':
@@ -460,13 +517,15 @@ export function sessionPolicyTightenNotice(outcome, lang) {
460
517
  const READ_NOTICE_GENERIC = 'This session’s rule record could not be shown, so what it holds is not known. Try reading it again.';
461
518
  const READ_NOTICE_NO_TARGET = 'There is no engine connection for this session, so its rule record cannot be read and what it holds is not known. Look again once it is connected.';
462
519
  const READ_NOTICE_NOT_STARTED = 'This session has not begun on the engine yet — nothing has been sent in it — so it has no rule record to read. Send a first message, then look again.';
463
- function readFailureSentence(kind) {
520
+ function readFailureSentence(kind, deployment) {
464
521
  switch (kind) {
465
522
  case 'face-unavailable':
466
523
  return 'This deployment does not keep per-session tool rules, so there is no session rule record to read.';
467
524
  case 'loosen-forbidden':
468
525
  return 'The engine answered this read with a refusal that only applies to relaxing rules, so this session’s rule record could not be read. Try again; if it keeps happening, whoever runs the engine needs to look at it.';
469
526
  case 'store-corrupt':
527
+ if (deploymentHasNoOperator(deployment))
528
+ return renderMessage(msg('rules.sessionPolicy.deployment.noOperator.readStoreCorrupt'));
470
529
  return 'The engine could not establish which version this session’s rules are at, so it would not hand the record over. This needs an operator to look at the rule store.';
471
530
  case 'cas-conflict':
472
531
  return 'The engine reported a version clash on this session’s rule record, so it could not be read this time. Try again.';
@@ -504,7 +563,7 @@ function ownRead(o, key) {
504
563
  const d = Object.getOwnPropertyDescriptor(o, key);
505
564
  return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
506
565
  }
507
- export function sessionPolicyReadNotice(outcome) {
566
+ export function sessionPolicyReadNotice(outcome, deployment) {
508
567
  try {
509
568
  if (outcome === null || typeof outcome !== 'object')
510
569
  return READ_NOTICE_GENERIC;
@@ -513,7 +572,7 @@ export function sessionPolicyReadNotice(outcome) {
513
572
  const failure = ownRead(outcome, 'failure');
514
573
  if (failure === null || typeof failure !== 'object')
515
574
  return READ_NOTICE_GENERIC;
516
- return readFailureSentence(ownRead(failure, 'kind')) ?? READ_NOTICE_GENERIC;
575
+ return readFailureSentence(ownRead(failure, 'kind'), deployment) ?? READ_NOTICE_GENERIC;
517
576
  }
518
577
  if (arm === 'malformed')
519
578
  return readMalformedSentence(ownRead(outcome, 'why')) ?? READ_NOTICE_GENERIC;
@@ -544,20 +603,20 @@ function withoutRefusedEntries(prior, mounted) {
544
603
  const seen = new Set();
545
604
  for (const x of list) {
546
605
  if (mounted.has(x)) {
547
- kept.push(x);
606
+ appendOwnElement(kept, x);
548
607
  continue;
549
608
  }
550
609
  const kind = ruleToolNameVerdictOf(x).kind;
551
610
  if (kind === 'unknown')
552
611
  return 'judge_failed';
553
612
  if (kind === 'current') {
554
- kept.push(x);
613
+ appendOwnElement(kept, x);
555
614
  continue;
556
615
  }
557
616
  if (seen.has(x))
558
617
  continue;
559
618
  seen.add(x);
560
- removed.push({ field, rule: x });
619
+ appendOwnElement(removed, { field, rule: x });
561
620
  }
562
621
  next[field] = kept;
563
622
  }
@@ -656,7 +715,7 @@ export async function removeRefusedSessionRules(facade, sessionId, roster, opts)
656
715
  return second.done;
657
716
  return { kind: 'conflict', rev: second.retryAtRev };
658
717
  }
659
- export function sessionPolicyRemovalNotice(outcome) {
718
+ export function sessionPolicyRemovalNotice(outcome, deployment) {
660
719
  const generic = 'The session’s rule record may not have changed — re-read it before doing anything else.';
661
720
  if (outcome === null || typeof outcome !== 'object')
662
721
  return generic;
@@ -683,6 +742,8 @@ export function sessionPolicyRemovalNotice(outcome) {
683
742
  case 'judge_failed':
684
743
  return 'Nothing was changed: this client could not check which entries in this session’s rule record name a tool the engine refuses (its copy of the engine’s tool-name check is unavailable or gave no clear answer), so it removed none rather than guess. Removing them needs that check available in this client.';
685
744
  case 'loosen_forbidden':
745
+ if (deploymentHasNoOperator(deployment))
746
+ return renderMessage(msg('rules.sessionPolicy.deployment.noOperator.removeLoosenForbidden'));
686
747
  return 'The engine refused to take these entries out of this session’s rule record: on this engine only an operator can remove entries from it, so the record is unchanged. Ask an operator to remove them, or continue in a new session.';
687
748
  case 'conflict':
688
749
  return 'This session’s rule record was changed by someone else while the refused entries were being removed, twice in a row — nothing was changed. Try again once the other change has finished.';
@@ -697,6 +758,8 @@ export function sessionPolicyRemovalNotice(outcome) {
697
758
  case 'unauthorized':
698
759
  return 'This call could not present a verifiable identity, so nothing was changed.';
699
760
  case 'store_corrupt':
761
+ if (deploymentHasNoOperator(deployment))
762
+ return renderMessage(msg('rules.sessionPolicy.deployment.noOperator.removeReadStoreCorrupt'));
700
763
  return 'The engine could not establish which version this session’s rules are at, so nothing was changed. This needs an operator to look at the rule store.';
701
764
  case 'read_unreadable':
702
765
  return 'The session’s current rules could not be read, so nothing was changed — rewriting a record that cannot be read could replace real restrictions.';
@@ -706,6 +769,8 @@ export function sessionPolicyRemovalNotice(outcome) {
706
769
  case 'write_refused':
707
770
  switch (outcome.why) {
708
771
  case 'store_corrupt':
772
+ if (deploymentHasNoOperator(deployment))
773
+ return renderMessage(msg('rules.sessionPolicy.deployment.noOperator.removeWriteStoreCorrupt'));
709
774
  return 'The engine could not establish which version this session’s rules are at and refused to stamp a new one, so nothing was changed. This needs an operator to look at the rule store.';
710
775
  case 'session_not_found':
711
776
  return 'This session is not writable from here — it may not exist, or it may belong to someone else (the engine answers both the same way, so this client cannot tell which); nothing was changed.';
@@ -8,7 +8,7 @@ const UNREADABLE = Symbol('unreadable');
8
8
  function ownData(v, key) {
9
9
  try {
10
10
  const d = Object.getOwnPropertyDescriptor(v, key);
11
- return d !== undefined && 'value' in d ? d.value : undefined;
11
+ return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
12
12
  }
13
13
  catch {
14
14
  return undefined;
@@ -1,4 +1,5 @@
1
1
  import { type HitlClientLike, type DecideOperationObserver } from './hitlBridge.js';
2
+ import { readApprovalCardWord, type ApprovalCardWord } from './approvalCardReading.js';
2
3
  import { type ApprovalAllowRuleShadow } from './allowRuleShadow.js';
3
4
  import type { UiLanguage } from '../env/uiLanguage.js';
4
5
  import type { SessionRuleInertReason } from './sessionPolicyWire.js';
@@ -8,13 +9,15 @@ import { type ApprovalMandateWord } from '../gateVocabulary.js';
8
9
  import type { ToolPermissionRequest } from '../seatContract.js';
9
10
  import { type ApprovalDecidedByReading } from '../approvalDecidedByCapability.js';
10
11
  import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS } from '@sema-agent/sdk';
11
- import type { ApprovalDecidedBy, ToolApprovalDecision as SdkToolApprovalDecision, ToolApprovalRespondAck, ToolApprovalRespondReplayed, PersistedRuleAnchor, RuleOfferMatch, RuleOfferBatchMember, RuleOfferUncoveredDetail, RuleOfferUncoveredReason, AskOrigin, RuleOffersAbsence, DenialLimitKind, DenialLimitFallback, ToolApprovalFrame, RuleOffer as SdkRuleOffer, ToolApprovalCardWord } from '@sema-agent/sdk';
12
+ import type { ApprovalDecidedBy, ApprovalCardDelegation, ToolApprovalDecision as SdkToolApprovalDecision, ToolApprovalRespondAck, ToolApprovalRespondReplayed, PersistedRuleAnchor, RuleOfferMatch, RuleOfferBatchMember, RuleOfferUncoveredDetail, RuleOfferUncoveredReason, AskOrigin, RuleOffersAbsence, DenialLimitKind, DenialLimitFallback, ToolApprovalFrame, RuleOffer as SdkRuleOffer } from '@sema-agent/sdk';
12
13
  export declare function toolNameIsFsWrite(name: string): boolean;
13
14
  export declare function toolNameIsShellExec(name: string): boolean;
14
- export declare function isToolApprovalGate(gate: {
15
+ export interface ToolApprovalGateLike {
15
16
  kind?: unknown;
16
17
  toolName?: unknown;
17
- } | undefined | null): boolean;
18
+ approvalCard?: string | undefined;
19
+ }
20
+ export declare function isToolApprovalGate(gate: ToolApprovalGateLike | undefined | null): boolean;
18
21
  export interface FsApprovalWireDeps {
19
22
  client: HitlClientLike;
20
23
  onPresented?: () => void;
@@ -106,7 +109,7 @@ export interface ApprovalCardRequest {
106
109
  mandate?: ApprovalMandateWord;
107
110
  denialLimitFallback?: DenialLimitFallback;
108
111
  origin?: string;
109
- approvalCard?: ToolApprovalCardWord;
112
+ approvalCard?: ApprovalCardWord;
110
113
  askClass?: string;
111
114
  classes?: readonly string[];
112
115
  boundGrants?: BoundSkillGrantsWire;
@@ -162,11 +165,7 @@ export interface ReadRootCandidateView {
162
165
  clearsThisAsk: true;
163
166
  covers?: 'exact';
164
167
  }
165
- export interface ToolApprovalDelegation {
166
- parentToolCallId: string;
167
- depth: number;
168
- agentName?: string;
169
- }
168
+ export type ToolApprovalDelegation = ApprovalCardDelegation;
170
169
  export declare const TOOL_APPROVAL_FRAME_KEYS_MIRROR: readonly ["type", "approvalId", "toolCallId", "toolName", "sourceTaskId", "fromSubagent", "sourceAgentName", "message", "args", "argsOmitted", "governanceForced", "ruleOffers", "ruleOffersAbsence", "denialLimitFallback", "readRootCandidate", "mandated", "mandate", "origin", "approvalCard", "askClass", "classes", "inputHasBidi", "parked", "persistedRuleShadowed", "allowRuleShadowed", "probeCause", "probeReason", "rememberRefused", "boundGrantDigest", "boundGrantAbsence", "boundGrants", "classifierNoRuling", "ruleEvidence", "requiresRealApproval", "expiresInMs", "expiresAtMs", "serverNowMs", "delegation", "outcome", "cause"];
171
170
  export interface ApprovalMandatedFacts {
172
171
  readonly mandated?: true;
@@ -177,7 +176,7 @@ export declare function approvalIsMandated(v: ApprovalMandatedFacts | undefined
177
176
  export declare function readApprovalMandate(v: {
178
177
  readonly mandate?: string;
179
178
  } | undefined | null): ApprovalMandateWord | undefined;
180
- export declare function readApprovalCardWord(carrier: unknown): ToolApprovalCardWord | undefined;
179
+ export { readApprovalCardWord };
181
180
  export declare function toolPermissionRequestAskBits(card: object | null | undefined, requestId?: string): Pick<ToolPermissionRequest, 'mandated' | 'mandate' | 'origin' | 'ruleOffersAbsence' | 'askClass' | 'classes' | 'sessionRow'>;
182
181
  export declare function isFromSubagent(frame: ToolApprovalFrame): boolean;
183
182
  export type ToolApprovalRespondDecision = SdkToolApprovalDecision;