@sema-agent/client-core 0.99.0 → 0.101.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 (374) hide show
  1. package/CHANGELOG.md +572 -0
  2. package/README.md +174 -114
  3. package/dist/adapt/arms.js +109 -50
  4. package/dist/adapt/panelTasks.d.ts +2 -1
  5. package/dist/adapt/panelTasks.js +32 -9
  6. package/dist/adapt/textStream.d.ts +1 -1
  7. package/dist/adapt/textStream.js +58 -32
  8. package/dist/adapt/toolCards.js +9 -8
  9. package/dist/adapt.js +7 -1
  10. package/dist/adapter/activeRunSelfHeal.d.ts +31 -2
  11. package/dist/adapter/activeRunSelfHeal.js +162 -13
  12. package/dist/adapter/downstream/eventToSdkMessage.d.ts +25 -6
  13. package/dist/adapter/downstream/eventToSdkMessage.js +157 -20
  14. package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
  15. package/dist/adapter/downstream/terminalToSdkResult.js +219 -39
  16. package/dist/adapter/downstream/wiringManifestView.d.ts +3 -1
  17. package/dist/adapter/downstream/wiringManifestView.js +1 -0
  18. package/dist/adapter/runStream.d.ts +4 -4
  19. package/dist/adapter/runStream.js +184 -42
  20. package/dist/adapter/types.d.ts +2 -0
  21. package/dist/agentsWireCaps.d.ts +9 -7
  22. package/dist/agentsWireCaps.js +101 -17
  23. package/dist/approvalDecidedByCapability.js +2 -2
  24. package/dist/approvalFrameFamilies.d.ts +33 -0
  25. package/dist/approvalFrameFamilies.js +120 -0
  26. package/dist/approvalsStreamLiveCapability.js +2 -2
  27. package/dist/attachmentsWireCaps.js +41 -13
  28. package/dist/callerCwdCapability.js +2 -2
  29. package/dist/centerWiringCapability.js +2 -2
  30. package/dist/clockReading.d.ts +2 -0
  31. package/dist/clockReading.js +4 -0
  32. package/dist/cloudConfigWireCaps.d.ts +28 -5
  33. package/dist/cloudConfigWireCaps.js +334 -103
  34. package/dist/compactionStatus.d.ts +34 -0
  35. package/dist/compactionStatus.js +196 -0
  36. package/dist/coreValuePorts.d.ts +12 -2
  37. package/dist/coreValuePorts.js +9 -0
  38. package/dist/decideFailureNote.js +8 -6
  39. package/dist/decideReceipt.js +2 -2
  40. package/dist/deviceExecutorManagementCapability.js +2 -2
  41. package/dist/deviceFlowPolling.js +1 -1
  42. package/dist/disableSkillsWire.d.ts +1 -1
  43. package/dist/disableSkillsWire.js +4 -3
  44. package/dist/displayUntrusted.d.ts +1 -0
  45. package/dist/displayUntrusted.js +215 -13
  46. package/dist/engineAgentPanelStore.d.ts +7 -4
  47. package/dist/engineCapReader.js +1 -1
  48. package/dist/engineConfigDrift.js +1 -1
  49. package/dist/engineErrorCodes.d.ts +23 -6
  50. package/dist/engineErrorCodes.js +36 -11
  51. package/dist/engineGenerationConvergence.d.ts +39 -0
  52. package/dist/engineGenerationConvergence.js +95 -0
  53. package/dist/engineGenerationPort.d.ts +61 -0
  54. package/dist/engineGenerationPort.js +144 -0
  55. package/dist/engineHealthFacts.d.ts +23 -0
  56. package/dist/engineHealthFacts.js +92 -0
  57. package/dist/engineIdentity.d.ts +4 -0
  58. package/dist/engineIdentity.js +11 -0
  59. package/dist/engineNoticeCodes.d.ts +2 -5
  60. package/dist/engineRowRef.js +4 -0
  61. package/dist/engineSessionMessages.js +2 -2
  62. package/dist/engineToolDirectory.d.ts +3 -0
  63. package/dist/engineToolDirectory.js +6 -4
  64. package/dist/engineWireFor.d.ts +99 -0
  65. package/dist/engineWireFor.js +248 -6
  66. package/dist/engineWireTarget.d.ts +1 -0
  67. package/dist/engineWireTarget.js +8 -0
  68. package/dist/env/uiLanguage.js +1 -1
  69. package/dist/errorSupplementRoles.d.ts +3 -0
  70. package/dist/errorSupplementRoles.js +37 -0
  71. package/dist/eventLeg.d.ts +1 -7
  72. package/dist/eventLeg.js +7 -8
  73. package/dist/executionLaneCapability.js +2 -2
  74. package/dist/fileHistoryCaptureCapability.d.ts +0 -3
  75. package/dist/fileHistoryCaptureCapability.js +3 -7
  76. package/dist/finalVerifyWire.d.ts +6 -3
  77. package/dist/finalVerifyWire.js +6 -23
  78. package/dist/flagInput.d.ts +4 -0
  79. package/dist/flagInput.js +24 -0
  80. package/dist/fleet/fleetLedger.js +5 -2
  81. package/dist/fleet/fleetProjection.d.ts +1 -0
  82. package/dist/fleet/fleetProjection.js +15 -2
  83. package/dist/gateVocabulary.js +3 -0
  84. package/dist/generated/engineFactTables.d.ts +7 -2
  85. package/dist/generated/engineFactTables.js +79 -0
  86. package/dist/generated/engineNoticeTables.js +15 -0
  87. package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
  88. package/dist/generated/settingsSchemaActiveTiers.js +14 -0
  89. package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
  90. package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
  91. package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
  92. package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
  93. package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
  94. package/dist/generated/settingsSchemaDefaultModel.js +25 -0
  95. package/dist/generated/settingsSchemaFns.d.ts +66 -0
  96. package/dist/generated/settingsSchemaFns.js +38 -0
  97. package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -0
  98. package/dist/generated/settingsSchemaMcpRequestEntry.js +156 -0
  99. package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
  100. package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
  101. package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
  102. package/dist/generated/settingsSchemaSettingsSources.js +58 -0
  103. package/dist/generated/settingsSchemaTables.d.ts +3 -0
  104. package/dist/generated/settingsSchemaTables.js +18 -0
  105. package/dist/generated/settingsSchemaTypes.d.ts +28 -0
  106. package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
  107. package/dist/generated/settingsSchemaUrlPattern.js +183 -0
  108. package/dist/headlessPermissionModeWire.d.ts +18 -2
  109. package/dist/headlessPermissionModeWire.js +30 -19
  110. package/dist/hitl/allowRuleShadow.js +9 -7
  111. package/dist/hitl/approvalCardReading.d.ts +3 -0
  112. package/dist/hitl/approvalCardReading.js +17 -0
  113. package/dist/hitl/approvalCardReasons.js +2 -2
  114. package/dist/hitl/approvalCompleteParked.js +1 -1
  115. package/dist/hitl/approvalDelivery.d.ts +87 -0
  116. package/dist/hitl/approvalDelivery.js +193 -0
  117. package/dist/hitl/approvalHolds.d.ts +14 -0
  118. package/dist/hitl/approvalHolds.js +41 -0
  119. package/dist/hitl/approvalResolution.d.ts +11 -0
  120. package/dist/hitl/approvalResolution.js +50 -11
  121. package/dist/hitl/askClassPair.d.ts +8 -2
  122. package/dist/hitl/askClassPair.js +31 -4
  123. package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
  124. package/dist/hitl/askParkAutoReopenBlock.js +117 -0
  125. package/dist/hitl/askParkRowRouting.js +4 -1
  126. package/dist/hitl/attributionLadder.d.ts +62 -0
  127. package/dist/hitl/attributionLadder.js +138 -0
  128. package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
  129. package/dist/hitl/automaticAnswerVerdict.js +46 -11
  130. package/dist/hitl/crashConverged.js +2 -2
  131. package/dist/hitl/decisionConflict.d.ts +6 -2
  132. package/dist/hitl/decisionConflict.js +24 -9
  133. package/dist/hitl/decisionLedger.d.ts +55 -0
  134. package/dist/hitl/decisionLedger.js +156 -0
  135. package/dist/hitl/decisionRefusal.d.ts +21 -10
  136. package/dist/hitl/decisionRefusal.js +100 -55
  137. package/dist/hitl/decisionSend.d.ts +116 -0
  138. package/dist/hitl/decisionSend.js +563 -0
  139. package/dist/hitl/frameRouter.d.ts +1 -0
  140. package/dist/hitl/frameRouter.js +9 -2
  141. package/dist/hitl/hitlBridge.d.ts +18 -6
  142. package/dist/hitl/hitlBridge.js +59 -43
  143. package/dist/hitl/livePendingAsk.js +4 -3
  144. package/dist/hitl/noAllowCause.js +1 -1
  145. package/dist/hitl/parkResolver.js +3 -2
  146. package/dist/hitl/persistedRulesWire.js +1 -0
  147. package/dist/hitl/planReviewWire.d.ts +4 -0
  148. package/dist/hitl/planReviewWire.js +104 -106
  149. package/dist/hitl/resumeRunningCard.d.ts +3 -2
  150. package/dist/hitl/resumeRunningCard.js +17 -11
  151. package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
  152. package/dist/hitl/sessionPolicyDeliverable.js +65 -35
  153. package/dist/hitl/sessionPolicyWire.d.ts +13 -3
  154. package/dist/hitl/sessionPolicyWire.js +81 -16
  155. package/dist/hitl/standingRows.js +1 -1
  156. package/dist/hitl/toolApprovalWire.d.ts +9 -10
  157. package/dist/hitl/toolApprovalWire.js +103 -151
  158. package/dist/hookMatcherVerdict.d.ts +2 -0
  159. package/dist/hookMatcherVerdict.js +12 -0
  160. package/dist/hooksCompactTransition.d.ts +19 -0
  161. package/dist/hooksCompactTransition.js +41 -0
  162. package/dist/hooksWireCaps.d.ts +1 -1
  163. package/dist/hooksWireCaps.js +202 -203
  164. package/dist/host.d.ts +1 -14
  165. package/dist/host.js +0 -8
  166. package/dist/hostCallbackGuard.d.ts +1 -0
  167. package/dist/hostCallbackGuard.js +1 -1
  168. package/dist/hostSettingsSource.d.ts +172 -0
  169. package/dist/hostSettingsSource.js +675 -0
  170. package/dist/hostTurnSettings.d.ts +114 -19
  171. package/dist/hostTurnSettings.js +966 -68
  172. package/dist/httpHookPolicy.d.ts +37 -0
  173. package/dist/httpHookPolicy.js +176 -0
  174. package/dist/humanTurn.d.ts +4 -2
  175. package/dist/humanTurn.js +40 -10
  176. package/dist/humanTurnRead.js +4 -3
  177. package/dist/humanTurnSentences.d.ts +10 -0
  178. package/dist/humanTurnSentences.js +74 -0
  179. package/dist/i18n/messages.en.d.ts +313 -0
  180. package/dist/i18n/messages.en.js +326 -13
  181. package/dist/i18n/messages.zh.js +341 -13
  182. package/dist/i18n/translate.js +3 -3
  183. package/dist/index.d.ts +85 -15
  184. package/dist/index.js +53 -12
  185. package/dist/inheritEnvCapability.d.ts +4 -1
  186. package/dist/inheritEnvCapability.js +38 -17
  187. package/dist/inheritEnvWire.d.ts +2 -1
  188. package/dist/inheritEnvWire.js +11 -5
  189. package/dist/injectionLaneNotice.d.ts +5 -0
  190. package/dist/injectionLaneNotice.js +46 -0
  191. package/dist/interactiveToolsWire.d.ts +4 -2
  192. package/dist/interactiveToolsWire.js +5 -5
  193. package/dist/jsonFaithful.d.ts +20 -0
  194. package/dist/jsonFaithful.js +152 -0
  195. package/dist/limitsWire.d.ts +7 -2
  196. package/dist/limitsWire.js +19 -13
  197. package/dist/liveInitToolFace.d.ts +6 -1
  198. package/dist/liveInitToolFace.js +5 -3
  199. package/dist/liveModelCatalog.d.ts +22 -0
  200. package/dist/liveModelCatalog.js +132 -18
  201. package/dist/mcpPanel.js +3 -1
  202. package/dist/mcpProbeCapability.js +2 -2
  203. package/dist/mcpReconnect.js +2 -2
  204. package/dist/mcpStatusSupersetKeys.d.ts +24 -0
  205. package/dist/mcpStatusSupersetKeys.js +45 -0
  206. package/dist/mcpToolToggles.d.ts +6 -0
  207. package/dist/mcpToolToggles.js +47 -0
  208. package/dist/mcpWireCaps.d.ts +48 -4
  209. package/dist/mcpWireCaps.js +338 -99
  210. package/dist/mcpWireTransport.d.ts +4 -0
  211. package/dist/mcpWireTransport.js +18 -0
  212. package/dist/memoryComplianceCapability.js +2 -2
  213. package/dist/memoryOriginCapability.js +2 -2
  214. package/dist/model/catalogDefault.d.ts +24 -0
  215. package/dist/model/catalogDefault.js +4 -0
  216. package/dist/model/liveCatalogShape.js +5 -4
  217. package/dist/model/modelsPolicy.js +4 -3
  218. package/dist/model/onboardJudgement.d.ts +1 -0
  219. package/dist/model/onboardJudgement.js +1 -1
  220. package/dist/model/subagentModelWord.js +2 -2
  221. package/dist/modelCapabilityProbe.d.ts +2 -1
  222. package/dist/modelCapabilityProbe.js +16 -15
  223. package/dist/modelIdentityResolvability.d.ts +12 -1
  224. package/dist/modelIdentityResolvability.js +69 -28
  225. package/dist/modsKernelIdentity.d.ts +10 -0
  226. package/dist/modsKernelIdentity.js +103 -0
  227. package/dist/modsKernelTransit.d.ts +8 -0
  228. package/dist/modsKernelTransit.js +6 -0
  229. package/dist/notifications.d.ts +30 -12
  230. package/dist/notifications.js +241 -53
  231. package/dist/outputStyleSeatCapability.js +2 -2
  232. package/dist/ownKey.d.ts +37 -0
  233. package/dist/ownKey.js +238 -2
  234. package/dist/panelReduce.d.ts +5 -0
  235. package/dist/panelReduce.js +45 -13
  236. package/dist/panelStateHolder.d.ts +1 -0
  237. package/dist/panelStateHolder.js +10 -1
  238. package/dist/peerFrames.d.ts +1 -1
  239. package/dist/peerFrames.js +6 -2
  240. package/dist/peerLaneCapability.js +2 -2
  241. package/dist/permissionModesCapability.js +4 -4
  242. package/dist/permissionRuleIssue.d.ts +2 -1
  243. package/dist/permissionRuleIssue.js +24 -21
  244. package/dist/permissionRulesWriteCapability.js +2 -2
  245. package/dist/permissionsAllowGrantCapability.js +2 -2
  246. package/dist/permissionsDeclaration.d.ts +43 -4
  247. package/dist/permissionsDeclaration.js +102 -35
  248. package/dist/pluginHooksWire.d.ts +20 -4
  249. package/dist/pluginHooksWire.js +101 -60
  250. package/dist/prepareRefusal.d.ts +9 -0
  251. package/dist/prepareRefusal.js +90 -0
  252. package/dist/printInitToolFace.js +2 -2
  253. package/dist/printModelStatus.js +1 -1
  254. package/dist/projectMemory.d.ts +32 -0
  255. package/dist/projectMemory.js +70 -0
  256. package/dist/promptBlockedCopy.d.ts +2 -1
  257. package/dist/promptBlockedCopy.js +2 -1
  258. package/dist/promptDelivery.d.ts +23 -3
  259. package/dist/promptDelivery.js +169 -30
  260. package/dist/providerRejection.d.ts +19 -1
  261. package/dist/providerRejection.js +75 -4
  262. package/dist/queuedDelivery.d.ts +48 -0
  263. package/dist/queuedDelivery.js +233 -0
  264. package/dist/reattachWindow.d.ts +94 -0
  265. package/dist/reattachWindow.js +127 -0
  266. package/dist/request/printNotification.d.ts +1 -1
  267. package/dist/request/printNotification.js +5 -1
  268. package/dist/request/submissionIdentity.d.ts +37 -0
  269. package/dist/request/submissionIdentity.js +65 -0
  270. package/dist/request/taskRequest.d.ts +22 -14
  271. package/dist/request/taskRequest.js +312 -202
  272. package/dist/resultFrameKeys.d.ts +1 -0
  273. package/dist/resultFrameKeys.js +4 -1
  274. package/dist/resumeRefusalCopy.d.ts +3 -1
  275. package/dist/resumeRefusalCopy.js +22 -4
  276. package/dist/retryStatus.d.ts +26 -0
  277. package/dist/retryStatus.js +133 -28
  278. package/dist/rewindArchiveCapability.js +2 -2
  279. package/dist/rewindEngineAction.d.ts +2 -0
  280. package/dist/rewindEngineAction.js +23 -1
  281. package/dist/rowKind.d.ts +36 -0
  282. package/dist/rowKind.js +97 -0
  283. package/dist/ruleCompileVerdict.d.ts +18 -0
  284. package/dist/ruleCompileVerdict.js +67 -2
  285. package/dist/ruleReadings.d.ts +58 -0
  286. package/dist/ruleReadings.js +132 -0
  287. package/dist/ruleRefusalSentence.d.ts +8 -0
  288. package/dist/ruleRefusalSentence.js +64 -0
  289. package/dist/runCancelContext.d.ts +0 -1
  290. package/dist/runCancelContext.js +1 -2
  291. package/dist/runTerminal.d.ts +5 -0
  292. package/dist/runTerminal.js +52 -17
  293. package/dist/sandboxWire.d.ts +3 -2
  294. package/dist/sandboxWire.js +59 -27
  295. package/dist/scenarioRefusal.d.ts +2 -1
  296. package/dist/scenarioRefusal.js +6 -6
  297. package/dist/scenarioSkills.d.ts +20 -0
  298. package/dist/scenarioSkills.js +72 -0
  299. package/dist/scenarioWire.d.ts +5 -2
  300. package/dist/scenarioWire.js +9 -9
  301. package/dist/sealedKeyCapability.js +2 -2
  302. package/dist/seam.d.ts +26 -9
  303. package/dist/seam.js +44 -4
  304. package/dist/seatContract.d.ts +62 -9
  305. package/dist/seatContract.js +70 -25
  306. package/dist/selfOrchestrationDenial.js +1 -1
  307. package/dist/sessionPolicyCapability.js +2 -2
  308. package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
  309. package/dist/sessionRulesChildrenReadLive.js +5 -0
  310. package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
  311. package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
  312. package/dist/sessionSyncFileHistoryCapability.js +2 -2
  313. package/dist/settingsCredentialKeyPaths.d.ts +8 -0
  314. package/dist/settingsCredentialKeyPaths.js +274 -0
  315. package/dist/settingsHooksSalvage.d.ts +1 -0
  316. package/dist/settingsHooksSalvage.js +7 -1
  317. package/dist/settingsLayerAdmission.d.ts +4 -0
  318. package/dist/settingsLayerAdmission.js +16 -0
  319. package/dist/skillToolListsCapability.js +6 -5
  320. package/dist/skillsWireCaps.d.ts +14 -3
  321. package/dist/skillsWireCaps.js +48 -18
  322. package/dist/slashCommandGate.d.ts +24 -0
  323. package/dist/slashCommandGate.js +74 -0
  324. package/dist/slashCommandTable.d.ts +14 -0
  325. package/dist/slashCommandTable.js +99 -0
  326. package/dist/sqlEngineCapability.js +2 -2
  327. package/dist/steerPriorityCapability.js +2 -2
  328. package/dist/storePostureCapability.js +2 -2
  329. package/dist/subagent/agentStateDetail.js +1 -1
  330. package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
  331. package/dist/subagent/engineDelegatedPrompt.js +38 -7
  332. package/dist/subagent/engineRowStopGate.js +2 -2
  333. package/dist/subagent/engineSubagentResume.js +3 -3
  334. package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
  335. package/dist/subagent/engineTaskHandleWire.js +10 -0
  336. package/dist/subagentContentStore.d.ts +1 -0
  337. package/dist/subagentContentStore.js +135 -27
  338. package/dist/submitFailure.d.ts +8 -0
  339. package/dist/submitFailure.js +17 -0
  340. package/dist/supportFloor.d.ts +1 -0
  341. package/dist/supportFloor.js +7 -0
  342. package/dist/terminationIntent.d.ts +55 -0
  343. package/dist/terminationIntent.js +352 -0
  344. package/dist/toolHistoryMismatch.d.ts +8 -0
  345. package/dist/toolHistoryMismatch.js +37 -6
  346. package/dist/toolResult.d.ts +13 -3
  347. package/dist/toolResult.js +158 -9
  348. package/dist/toolResultContent.d.ts +13 -0
  349. package/dist/toolResultContent.js +82 -7
  350. package/dist/toolRoster.d.ts +18 -0
  351. package/dist/toolRoster.js +64 -0
  352. package/dist/toolsFlagNames.d.ts +8 -0
  353. package/dist/toolsFlagNames.js +110 -0
  354. package/dist/turnFailurePresentation.js +41 -96
  355. package/dist/usageLimitAutoResume.d.ts +74 -0
  356. package/dist/usageLimitAutoResume.js +227 -0
  357. package/dist/userAttachmentEnvelope.js +1 -1
  358. package/dist/userAttachmentSeat.js +5 -5
  359. package/dist/userInvokedSkillsCapability.js +2 -2
  360. package/dist/webSearchBackendCapability.js +2 -2
  361. package/dist/wireErrorTriage.js +99 -50
  362. package/dist/wireFailureShape.d.ts +25 -1
  363. package/dist/wireFailureShape.js +92 -5
  364. package/dist/wireRefusalCopy.d.ts +75 -18
  365. package/dist/wireRefusalCopy.js +532 -148
  366. package/dist/wiringFleetDoctor.d.ts +3 -0
  367. package/dist/wiringFleetDoctor.js +21 -0
  368. package/dist/workflow.d.ts +2 -1
  369. package/dist/workflow.js +38 -1
  370. package/dist/workflowClient.d.ts +2 -7
  371. package/dist/workflowsJournalCapability.js +2 -2
  372. package/dist/writeProtectionCapability.js +2 -2
  373. package/docs/INTEGRATION-CLIENTS.md +1013 -190
  374. package/package.json +15 -4
package/dist/ownKey.js CHANGED
@@ -34,6 +34,12 @@ export function readOwnDataValue(v, key) {
34
34
  const d = Object.getOwnPropertyDescriptor(v, key);
35
35
  return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
36
36
  }
37
+ export function carriesAnswerText(text) {
38
+ return text.trim().length > 0;
39
+ }
40
+ export function appendOwnElement(list, value) {
41
+ Object.defineProperty(list, list.length, { value, writable: true, enumerable: true, configurable: true });
42
+ }
37
43
  export function guardedRead(read) {
38
44
  try {
39
45
  return read();
@@ -106,7 +112,7 @@ function contextUsageSectionRowsOf(raw) {
106
112
  for (let i = 0; i < n; i++) {
107
113
  const row = guardedRead(() => contextUsageSectionRowOf(raw, i));
108
114
  if (row !== undefined)
109
- rows.push(row);
115
+ appendOwnElement(rows, row);
110
116
  }
111
117
  return rows.length > 0 ? rows : undefined;
112
118
  }
@@ -157,7 +163,7 @@ export function humanInputAttachmentsOf(frame) {
157
163
  return { ordinal, ...(kind !== undefined ? { kind } : {}), outcome, ...(label !== undefined ? { label } : {}) };
158
164
  });
159
165
  if (row !== undefined)
160
- rows.push(row);
166
+ appendOwnElement(rows, row);
161
167
  }
162
168
  return rows.length > 0 ? rows : undefined;
163
169
  }
@@ -189,3 +195,233 @@ export function mcpSectionDroppedNamedRowsOf(rows, name) {
189
195
  return 0;
190
196
  }
191
197
  }
198
+ export function promptManifestSectionViewOf(row) {
199
+ const o = row;
200
+ const str = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
201
+ const id = str(o.id);
202
+ const chars = typeof o.chars === 'number' && Number.isFinite(o.chars) && o.chars >= 0 ? o.chars : undefined;
203
+ if (id === undefined || chars === undefined)
204
+ return undefined;
205
+ const band = str(o.band);
206
+ const locale = str(o.locale);
207
+ const variant = str(o.variant);
208
+ const contentHash = band !== undefined ? str(o.contentHash) : undefined;
209
+ const slot = str(o.slot);
210
+ return {
211
+ id,
212
+ chars,
213
+ ...(band !== undefined ? { band } : {}),
214
+ ...(locale !== undefined ? { locale } : {}),
215
+ ...(variant !== undefined ? { variant } : {}),
216
+ ...(contentHash !== undefined ? { contentHash } : {}),
217
+ ...(slot !== undefined ? { slot } : {}),
218
+ };
219
+ }
220
+ export function promptManifestIdentityOfFrame(frame) {
221
+ let raw;
222
+ try {
223
+ raw = frame.identity;
224
+ }
225
+ catch {
226
+ return undefined;
227
+ }
228
+ return promptManifestIdentityOf(typeof raw === 'object' && raw !== null ? raw : undefined);
229
+ }
230
+ export function promptManifestIdentityOf(raw) {
231
+ try {
232
+ const plain = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
233
+ const str = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
234
+ if (!plain(raw))
235
+ return undefined;
236
+ const artifact = str(raw.artifact);
237
+ const activatedBy = str(raw.activatedBy);
238
+ const epochRaw = raw.epoch;
239
+ const epoch = typeof epochRaw === 'number' && Number.isInteger(epochRaw) && epochRaw >= 0 ? epochRaw : undefined;
240
+ const layersRaw = raw.layers;
241
+ if (artifact === undefined || activatedBy === undefined || epoch === undefined || !plain(layersRaw))
242
+ return undefined;
243
+ const catalog = str(layersRaw.catalog);
244
+ const binding = str(layersRaw.binding);
245
+ if (catalog === undefined || binding === undefined)
246
+ return undefined;
247
+ const optional = {};
248
+ for (const k of ['center', 'deploy', 'task']) {
249
+ const v = layersRaw[k];
250
+ if (v === undefined)
251
+ continue;
252
+ const t = str(v);
253
+ if (t === undefined)
254
+ return undefined;
255
+ optional[k] = t;
256
+ }
257
+ const renderersRaw = layersRaw.renderers;
258
+ if (!plain(renderersRaw))
259
+ return undefined;
260
+ const entries = [];
261
+ for (const [k, v] of Object.entries(renderersRaw)) {
262
+ if (typeof v !== 'number' || !Number.isFinite(v))
263
+ return undefined;
264
+ appendOwnElement(entries, [k, v]);
265
+ }
266
+ const renderers = Object.fromEntries(entries);
267
+ return { artifact, layers: { catalog, renderers, ...optional, binding }, epoch, activatedBy };
268
+ }
269
+ catch {
270
+ return undefined;
271
+ }
272
+ }
273
+ const SAMPLED = new WeakSet();
274
+ const SAMPLE_MAX_DEPTH = 256;
275
+ export function isOwnSnapshot(v) {
276
+ return isBranded(v);
277
+ }
278
+ function isBranded(v) {
279
+ return typeof v === 'object' && v !== null && SAMPLED.has(v);
280
+ }
281
+ function arrayIndexOfKey(k) {
282
+ if (!/^(?:0|[1-9]\d*)$/.test(k))
283
+ return undefined;
284
+ const n = Number(k);
285
+ return n < 4294967295 ? n : undefined;
286
+ }
287
+ export function ownSnapshot(value) {
288
+ return snapshotOf(value);
289
+ }
290
+ function snapshotOf(value) {
291
+ if (typeof value === 'object' && value !== null) {
292
+ if (SAMPLED.has(value))
293
+ return value;
294
+ return sampleObject(value, 0, { done: new Map(), path: new Set(), seen: new Set(), rework: 0, depthCuts: 0 });
295
+ }
296
+ return samplePrimitive(value);
297
+ }
298
+ export function ownSnapshotWhenTyped(value, word) {
299
+ return snapshotWhenTyped(value, word);
300
+ }
301
+ function snapshotWhenTyped(value, word) {
302
+ if (typeof value !== 'object' || value === null)
303
+ return value;
304
+ if (guardedRead(() => Array.isArray(value)) === true)
305
+ return value;
306
+ const read = guardedRead(() => ({ own: Object.getOwnPropertyDescriptor(value, 'type') }));
307
+ if (read !== undefined) {
308
+ const own = read.own;
309
+ if (own === undefined) {
310
+ if (guardedRead(() => 'type' in value) === false)
311
+ return value;
312
+ }
313
+ else if (Object.hasOwn(own, 'value') && typeof own.value === 'string' && own.value !== '' && own.value !== word) {
314
+ return value;
315
+ }
316
+ }
317
+ return recordOf(value);
318
+ }
319
+ export function ownSnapshotTyped(value) {
320
+ return recordOf(value);
321
+ }
322
+ export function ownSnapshotRecord(value) {
323
+ return recordOf(value);
324
+ }
325
+ function recordOf(value) {
326
+ const s = snapshotOf(value);
327
+ return typeof s === 'object' && s !== null && !Array.isArray(s) ? s : undefined;
328
+ }
329
+ function samplePrimitive(v) {
330
+ return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' ? v : v === null ? null : undefined;
331
+ }
332
+ const SAMPLE_MAX_TRAILING_HOLES = 1024;
333
+ const SAMPLE_MAX_INDEX = 1 << 20;
334
+ const SAMPLE_MAX_REWORK = 2048;
335
+ function sampleValue(v, depth, run) {
336
+ return typeof v === 'object' && v !== null ? sampleObject(v, depth, run) : samplePrimitive(v);
337
+ }
338
+ function sampleObject(src, depth, run) {
339
+ const hit = run.done.get(src);
340
+ if (hit !== undefined)
341
+ return hit ?? undefined;
342
+ if (SAMPLED.has(src))
343
+ return src;
344
+ if (run.path.has(src))
345
+ return undefined;
346
+ if (depth >= SAMPLE_MAX_DEPTH) {
347
+ run.depthCuts++;
348
+ return undefined;
349
+ }
350
+ if (run.seen.has(src)) {
351
+ if (++run.rework > SAMPLE_MAX_REWORK) {
352
+ run.depthCuts++;
353
+ return undefined;
354
+ }
355
+ }
356
+ else {
357
+ run.seen.add(src);
358
+ }
359
+ let isArray;
360
+ let keys;
361
+ try {
362
+ isArray = Array.isArray(src);
363
+ keys = Reflect.ownKeys(src);
364
+ }
365
+ catch {
366
+ run.done.set(src, null);
367
+ return undefined;
368
+ }
369
+ run.path.add(src);
370
+ const cutsBefore = run.depthCuts;
371
+ try {
372
+ const rec = {};
373
+ const arr = [];
374
+ let tail = 0;
375
+ let good = 0;
376
+ let declared = 0;
377
+ for (const k of keys) {
378
+ if (typeof k !== 'string')
379
+ continue;
380
+ if (isArray && k === 'length') {
381
+ const lv = guardedRead(() => {
382
+ const ld = Object.getOwnPropertyDescriptor(src, 'length');
383
+ return ld !== undefined && Object.hasOwn(ld, 'value') ? ld.value : undefined;
384
+ });
385
+ if (typeof lv === 'number' && Number.isInteger(lv) && lv > 0 && lv <= 0xffffffff)
386
+ declared = lv;
387
+ continue;
388
+ }
389
+ const index = isArray ? arrayIndexOfKey(k) : undefined;
390
+ if (isArray && index === undefined)
391
+ continue;
392
+ if (index !== undefined && index >= SAMPLE_MAX_INDEX)
393
+ continue;
394
+ if (index !== undefined && index + 1 > tail)
395
+ tail = index + 1;
396
+ const d = guardedRead(() => Object.getOwnPropertyDescriptor(src, k));
397
+ if (d === undefined)
398
+ continue;
399
+ if (d.enumerable !== true || !Object.hasOwn(d, 'value'))
400
+ continue;
401
+ const child = sampleValue(d.value, depth + 1, run);
402
+ if (child === undefined)
403
+ continue;
404
+ if (index !== undefined) {
405
+ Object.defineProperty(arr, index, { value: child, writable: true, enumerable: true, configurable: true });
406
+ if (index + 1 > good)
407
+ good = index + 1;
408
+ }
409
+ else
410
+ putOwnKey(rec, k, child);
411
+ }
412
+ if (isArray) {
413
+ const want = Math.max(good, Math.min(Math.max(tail, declared), good + SAMPLE_MAX_TRAILING_HOLES));
414
+ if (arr.length < want)
415
+ arr.length = want;
416
+ }
417
+ const out = isArray ? arr : rec;
418
+ Object.freeze(out);
419
+ SAMPLED.add(out);
420
+ if (run.depthCuts === cutsBefore)
421
+ run.done.set(src, out);
422
+ return out;
423
+ }
424
+ finally {
425
+ run.path.delete(src);
426
+ }
427
+ }
@@ -116,6 +116,11 @@ export declare function reducePanelFrame(state: PanelReduceState, frame: PanelFr
116
116
  };
117
117
  export declare function panelRowSnapshot(state: PanelReduceState): PanelDelta[];
118
118
  export declare function panelResolveTaskId(state: PanelReduceState, wireTaskId: string): EnginePanelTaskIdentity;
119
+ export interface PanelSubagentIdentity {
120
+ readonly key: string;
121
+ readonly ids: readonly string[];
122
+ }
123
+ export declare function panelSubagentOf(state: PanelReduceState, id: string): PanelSubagentIdentity | undefined;
119
124
  export declare function panelIsResident(state: PanelReduceState, taskId: string): boolean;
120
125
  export declare function panelAnchorOf(state: PanelReduceState, taskId: string): string | undefined;
121
126
  export declare function panelPresenceSize(state: PanelReduceState, sessionKey: string): number;
@@ -1,6 +1,6 @@
1
1
  import { rowIdTail } from './workflow.js';
2
2
  import { isSdkFleetTaskTerminal, isSdkFleetTaskTerminalNotSuccess } from './terminalStatuses.js';
3
- import { carryCycle, cycleEmpty, cycleKeysChanged, cycleOf, cycleOrder, mergeCycle, } from './cycleOrder.js';
3
+ import { carryCycle, cycleEmpty, cycleKeysChanged, cycleOf, cycleOrder, cycleSeqValue, mergeCycle, } from './cycleOrder.js';
4
4
  export function isStaleEngineAgentPanelEnd(end, current) {
5
5
  return cycleOrder(end, current) === 'before';
6
6
  }
@@ -575,10 +575,26 @@ function fullUsage(key, row) {
575
575
  return undefined;
576
576
  return usageDelta(key, { ...(row.totalTokens !== undefined ? { totalTokens: row.totalTokens } : {}), ...(row.toolUses !== undefined ? { toolUses: row.toolUses } : {}), ...(fin !== undefined ? { final: fin } : {}) });
577
577
  }
578
+ function ownDataOf(o, key) {
579
+ if (typeof o !== 'object' || o === null)
580
+ return undefined;
581
+ try {
582
+ const d = Object.getOwnPropertyDescriptor(o, key);
583
+ return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
584
+ }
585
+ catch {
586
+ return undefined;
587
+ }
588
+ }
589
+ function publisherFinality(f) {
590
+ return { ...(ownDataOf(f, 'totalTokens') === true ? { totalTokens: true } : {}), ...(ownDataOf(f, 'toolUses') === true ? { toolUses: true } : {}) };
591
+ }
578
592
  function fleetCarrier(ev) {
579
- const f = ev.final;
580
- const final = { ...(f?.totalTokens === true ? { totalTokens: true } : {}), ...(f?.toolUses === true ? { toolUses: true } : {}) };
581
- return { totalTokens: ev.totalTokens, toolUses: ev.toolUses, final };
593
+ return { totalTokens: ev.totalTokens, toolUses: ev.toolUses, final: publisherFinality(ownDataOf(ev, 'final')) };
594
+ }
595
+ function tickCycleOf(ev) {
596
+ const c = cycleSeqValue(ownDataOf(ev, 'cycleSeq'));
597
+ return c === undefined ? undefined : { cycleSeq: c };
582
598
  }
583
599
  function finalityOf(tokens, toolUses) {
584
600
  if (tokens === undefined && toolUses === undefined)
@@ -638,17 +654,20 @@ function announce(d, rid) {
638
654
  if (row.phase === 'ended')
639
655
  mintTerminal(d, key, row.isError === true, row.report, 'end');
640
656
  }
641
- function foldTick(d, rid, ev, cardBound) {
657
+ function foldTick(d, rid, ev, cardBound, final) {
642
658
  const r = d.rec(rid);
643
659
  if (r === undefined)
644
660
  return;
645
661
  const row = r.row;
646
662
  const gate = cardBound ? { gateBound: true } : {};
647
663
  const wireId = ev.wireTaskId ?? ev.taskId;
648
- const attributable = !hasCycleSeq(r.cycle) && (r.currentRun === undefined || r.currentRun === wireId);
664
+ const tickCycle = tickCycleOf(ev);
665
+ const attributable = hasCycleSeq(r.cycle)
666
+ ? tickCycle !== undefined && cycleOrder(tickCycle, r.cycle) === 'same'
667
+ : r.currentRun === undefined || r.currentRun === wireId;
649
668
  if (!attributable)
650
669
  d.counts.unattributedTicks++;
651
- const carrier = attributable ? { totalTokens: ev.totalTokens, toolUses: ev.toolUses } : {};
670
+ const carrier = attributable ? { totalTokens: ev.totalTokens, toolUses: ev.toolUses, final } : {};
652
671
  if (row === undefined || !row.announced) {
653
672
  const base = row !== undefined
654
673
  ? { ...row, ...gate, tickSeen: true, fields: { ...row.fields, ...tickFields(ev) } }
@@ -789,28 +808,37 @@ function foldAbsence(d, rid, a) {
789
808
  d.deltas.push({ op: 'upsert', canonicalId: keyOf(r), fields: { absence } });
790
809
  d.put(rid, { row: { ...row, fields: { ...row.fields, absence } } });
791
810
  }
792
- function stripCardBound(ev) {
793
- const { cardBound: _cardBound, ...rest } = ev;
794
- void _cardBound;
795
- return rest;
811
+ function tickFactBase(ev) {
812
+ const out = {};
813
+ for (const k of Reflect.ownKeys(ev)) {
814
+ if (typeof k !== 'string' || k === 'cardBound' || k === 'final' || k === 'cycleSeq')
815
+ continue;
816
+ if (!Object.prototype.propertyIsEnumerable.call(ev, k))
817
+ continue;
818
+ out[k] = Reflect.get(ev, k);
819
+ }
820
+ return out;
796
821
  }
797
822
  function emitTick(d, ev) {
798
823
  const found = d.find(ev.taskId);
799
824
  const fr = found !== undefined ? d.rec(found) : undefined;
800
825
  if (fr !== undefined && formerGeneration(fr, ev.taskId))
801
826
  return;
827
+ const tickCycle = tickCycleOf(ev);
828
+ if (fr !== undefined && tickCycle !== undefined && cycleOrder(tickCycle, genOf(fr)) === 'before')
829
+ return;
802
830
  const rid = found ?? d.create({ id: ev.taskId });
803
831
  d.records.touch(rid);
804
832
  const r = d.rec(rid);
805
833
  if (r === undefined)
806
834
  return;
807
835
  const key = keyOf(r);
808
- const plain = stripCardBound(ev);
836
+ const plain = { ...tickFactBase(ev), ...(tickCycle !== undefined ? { cycleSeq: tickCycle.cycleSeq } : {}) };
809
837
  const fact = key === ev.taskId
810
838
  ? { ...plain, taskIdOrigin: 'wire' }
811
839
  : { ...plain, taskId: key, wireTaskId: ev.taskId, taskIdOrigin: key === r.tail ? 'fleet-row' : 'wire' };
812
840
  d.facts.push({ ch: 'event', ev: fact });
813
- foldTick(d, rid, fact, ev.cardBound === true);
841
+ foldTick(d, rid, fact, ev.cardBound === true, publisherFinality(ownDataOf(ev, 'final')));
814
842
  }
815
843
  function flushHeld(d, wireTaskId) {
816
844
  const held = d.pending.get(wireTaskId);
@@ -1278,6 +1306,10 @@ export function panelResolveTaskId(state, wireTaskId) {
1278
1306
  return { taskId: wireTaskId, origin: 'wire' };
1279
1307
  return { taskId: r.tail, origin: 'fleet-row', ...cycleOf(bindingOf(r, wireTaskId)?.gen) };
1280
1308
  }
1309
+ export function panelSubagentOf(state, id) {
1310
+ const r = recordOfId(state, id);
1311
+ return r === undefined ? undefined : { key: keyOf(r), ids: idsOf(r) };
1312
+ }
1281
1313
  export function panelIsResident(state, taskId) {
1282
1314
  return recordOfId(state, taskId)?.resident === true;
1283
1315
  }
@@ -1,5 +1,6 @@
1
1
  import { type PanelDelta, type PanelFact, type PanelFrame, type PanelReduceState } from './panelReduce.js';
2
2
  export declare function panelStateNow(): PanelReduceState;
3
+ export declare function panelSubagentIdsNow(id: string): readonly string[] | undefined;
3
4
  export declare function stepEnginePanel(frame: PanelFrame): void;
4
5
  export declare function replaceEnginePanelState(fn: (s: PanelReduceState) => PanelReduceState): void;
5
6
  export declare function clearEnginePanelIdentity(): void;
@@ -1,9 +1,17 @@
1
- import { createPanelReduceState, panelClearAnchors, panelClearIdentity, panelClearRows, panelRowSnapshot, stepPanelFrame, } from './panelReduce.js';
1
+ import { createPanelReduceState, panelClearAnchors, panelClearIdentity, panelClearRows, panelRowSnapshot, panelSubagentOf, stepPanelFrame, } from './panelReduce.js';
2
+ import { bindSubagentIdentityReader } from './subagentContentStore.js';
2
3
  let state = createPanelReduceState();
3
4
  export function panelStateNow() {
4
5
  return state;
5
6
  }
7
+ export function panelSubagentIdsNow(id) {
8
+ return panelSubagentOf(state, id)?.ids;
9
+ }
10
+ function bindIdentityReader() {
11
+ bindSubagentIdentityReader(panelSubagentIdsNow);
12
+ }
6
13
  export function stepEnginePanel(frame) {
14
+ bindIdentityReader();
7
15
  const r = stepPanelFrame(state, frame);
8
16
  state = r.state;
9
17
  if (rowListener !== null)
@@ -18,6 +26,7 @@ export function stepEnginePanel(frame) {
18
26
  }
19
27
  }
20
28
  export function replaceEnginePanelState(fn) {
29
+ bindIdentityReader();
21
30
  state = fn(state);
22
31
  }
23
32
  export function clearEnginePanelIdentity() {
@@ -28,7 +28,7 @@ export type CrossSessionNoticeFrame = {
28
28
  text: string;
29
29
  };
30
30
  export type PeerFrameProjection = AgentMessageFrame | CrossSessionMessageFrame | CrossSessionNoticeFrame;
31
- export declare function classifyPeerNotification(n: Record<string, unknown>): PeerFrameProjection | null;
31
+ export declare function classifyPeerNotification(raw: Record<string, unknown>): PeerFrameProjection | null;
32
32
  export declare function renderPeerFrameTranscriptText(p: PeerFrameProjection): string;
33
33
  export declare function parsePeerFrameText(text: string): AgentMessageFrame | CrossSessionMessageFrame | null;
34
34
  export declare function peerFrameDisplayName(p: AgentMessageFrame | CrossSessionMessageFrame): string;
@@ -1,4 +1,5 @@
1
1
  import { applyDisplayFace, PEER_NAME_FACE } from './displayUntrusted.js';
2
+ import { ownSnapshotRecord } from './ownKey.js';
2
3
  import { CORE_ENGINE_AUTHORITY_ENVELOPE_TAGS, CORE_PERMISSION_MODE_CLASSES } from './generated/engineFactTables.js';
3
4
  const WIRE_KEY_FROM = 'from';
4
5
  const WIRE_KEY_BODY = 'body';
@@ -32,7 +33,7 @@ function dataProp(o, key) {
32
33
  catch {
33
34
  return undefined;
34
35
  }
35
- if (d === undefined || !('value' in d))
36
+ if (d === undefined || !Object.hasOwn(d, 'value'))
36
37
  return undefined;
37
38
  return d.value;
38
39
  }
@@ -59,7 +60,10 @@ function provenanceAgrees(n, lane, carrierFromRaw) {
59
60
  const seq = finiteNumber(dataProp(n, WIRE_KEY_SEQ));
60
61
  return seq !== undefined && finiteNumber(dataProp(prov, WIRE_KEY_SEQ)) === seq;
61
62
  }
62
- export function classifyPeerNotification(n) {
63
+ export function classifyPeerNotification(raw) {
64
+ const n = ownSnapshotRecord(raw);
65
+ if (n === undefined)
66
+ return null;
63
67
  const seq = finiteNumber(dataProp(n, WIRE_KEY_SEQ));
64
68
  const agentMessage = dataProp(n, WIRE_KEY_AGENT_MESSAGE);
65
69
  if (agentMessage !== undefined) {
@@ -1,4 +1,4 @@
1
- import { engineWireTarget } from './engineWireTarget.js';
1
+ import { engineWireTargetBaseUrl } from './engineWireTarget.js';
2
2
  import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
3
3
  import { ownDataField } from './ownKey.js';
4
4
  export function projectPeerLaneCapability(caps) {
@@ -22,7 +22,7 @@ const reader = createEngineCapReader({
22
22
  name: 'peerLane',
23
23
  project: projectPeerLaneCapability,
24
24
  });
25
- export function observedPeerLane(baseUrl = engineWireTarget()?.baseUrl) {
25
+ export function observedPeerLane(baseUrl = engineWireTargetBaseUrl()) {
26
26
  return reader.observed(baseUrl);
27
27
  }
28
28
  export function peerLaneAvailable(reading) {
@@ -1,6 +1,6 @@
1
- import { engineWireTarget } from './engineWireTarget.js';
1
+ import { engineWireTargetBaseUrl } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
- import { ownDataField, readOwnDataValue } from './ownKey.js';
3
+ import { appendOwnElement, ownDataField, readOwnDataValue } from './ownKey.js';
4
4
  function readModesStrict(v) {
5
5
  try {
6
6
  if (!Array.isArray(v))
@@ -13,7 +13,7 @@ function readModesStrict(v) {
13
13
  const item = ownDataField(v, String(i));
14
14
  if (typeof item !== 'string' || item.length === 0)
15
15
  return undefined;
16
- modes.push(item);
16
+ appendOwnElement(modes, item);
17
17
  }
18
18
  return modes;
19
19
  }
@@ -39,7 +39,7 @@ const reader = createEngineCapReader({
39
39
  name: 'permissionModes',
40
40
  project: projectPermissionModesCapability,
41
41
  });
42
- export function observedPermissionModes(baseUrl = engineWireTarget()?.baseUrl) {
42
+ export function observedPermissionModes(baseUrl = engineWireTargetBaseUrl()) {
43
43
  return reader.observed(baseUrl);
44
44
  }
45
45
  export function permissionModeAdmitted(reading, mode) {
@@ -1,3 +1,4 @@
1
+ import type { UiLanguage } from './env/uiLanguage.js';
1
2
  export declare const PERMISSION_RULE_ISSUE_CODES: readonly string[];
2
3
  export declare const RETIRED_PERMISSION_RULE_ISSUE_CODES: readonly string[];
3
- export declare function permissionRuleIssueDetail(code: unknown, message: unknown, rule?: string): string;
4
+ export declare function permissionRuleIssueDetail(code: unknown, message: unknown, rule?: string, lang?: UiLanguage): string;
@@ -1,4 +1,5 @@
1
1
  import { capForDisplay, escapeDisplayControlChars } from './fleetTaskDesc.js';
2
+ import { msg, renderMessage } from './i18n/translate.js';
2
3
  export const PERMISSION_RULE_ISSUE_CODES = Object.freeze([
3
4
  'invalid.empty_tool',
4
5
  'invalid.paren',
@@ -13,6 +14,7 @@ export const PERMISSION_RULE_ISSUE_CODES = Object.freeze([
13
14
  'unsupported.param_unknown',
14
15
  'unsupported.param_non_scalar',
15
16
  'unsupported.tool_unknown',
17
+ 'invalid.name_ambiguous',
16
18
  'unsupported.path_base',
17
19
  'unsupported.mcp_paren',
18
20
  'unsupported.covering_paren',
@@ -20,25 +22,26 @@ export const PERMISSION_RULE_ISSUE_CODES = Object.freeze([
20
22
  export const RETIRED_PERMISSION_RULE_ISSUE_CODES = Object.freeze(['unsupported.unknown_param']);
21
23
  const ISSUE_MESSAGE_MAX = 200;
22
24
  const ISSUE_SENTENCES = Object.freeze({
23
- 'invalid.empty_tool': 'this rule is invalid: it names no tool',
24
- 'invalid.paren': 'this rule is invalid: its parentheses do not parse (escape a literal one as \\( or \\))',
25
- 'invalid.tool_name': "this rule is invalid: its tool name is not spelled as a tool name (blanks around the rule, an invisible or disallowed character in the name or before the parenthesis, a leading '-', or the wildcard '*', which names no tool), so it would reach no tool or the wrong one",
26
- 'invalid.param_split': 'this rule is invalid: its parentheses do not hold a parameter rule written name:pattern',
27
- 'invalid.primary_field': "this rule is invalid: it patterns the tool's primary field, which matches the whole trimmed string rather than a prefix",
28
- 'invalid.cap_exceeded': 'this rule set is invalid: it is over one of the deployment caps (rule count, rule length, pattern length, or star count); this client cannot tell which from the code alone',
29
- 'invalid.behavior': 'this rule is invalid: its behavior is neither deny nor ask, so it would never fire',
30
- 'invalid.command_rule': 'this rule is invalid: the command pattern was rejected by the command-rule validator',
31
- 'invalid.entry_type': 'this allow list is invalid: it must be a list of rule strings, and it or one of its entries is not a string',
32
- 'unsupported.allow': 'an allow rule is not supported in a rule set that only says deny or ask — a standing approval belongs on the allow list instead',
33
- 'unsupported.param_unknown': 'this parameter rule is not supported: the tool carries no such parameter, so it could never match',
34
- 'unsupported.param_non_scalar': 'this parameter rule is not supported: that parameter holds an object or an array, so it could never match',
35
- 'unsupported.tool_unknown': "this rule is not supported on this leg: the resolver it supplied does not know the tool, so the rule's face cannot be checked",
36
- 'unsupported.path_base': 'this path rule is not supported as spelled: the base it is relative to is missing or is not a usable absolute path, so it would reach nothing and is refused rather than compiled',
37
- 'unsupported.mcp_paren': 'a parenthesised parameter rule is not supported on an MCP tool name',
38
- 'unsupported.covering_paren': 'a parenthesised parameter rule is not supported on a covering protocol name — the parameter grammar is keyed by an exact tool name, so no mounted tool could ever bear it',
25
+ 'invalid.empty_tool': 'rules.issue.emptyTool',
26
+ 'invalid.paren': 'rules.issue.paren',
27
+ 'invalid.tool_name': 'rules.issue.toolName',
28
+ 'invalid.param_split': 'rules.issue.paramSplit',
29
+ 'invalid.primary_field': 'rules.issue.primaryField',
30
+ 'invalid.cap_exceeded': 'rules.issue.capExceeded',
31
+ 'invalid.behavior': 'rules.issue.behavior',
32
+ 'invalid.command_rule': 'rules.issue.commandRule',
33
+ 'invalid.entry_type': 'rules.issue.entryType',
34
+ 'invalid.name_ambiguous': 'rules.issue.nameAmbiguous',
35
+ 'unsupported.allow': 'rules.issue.allowRule',
36
+ 'unsupported.param_unknown': 'rules.issue.paramUnknown',
37
+ 'unsupported.param_non_scalar': 'rules.issue.paramNonScalar',
38
+ 'unsupported.tool_unknown': 'rules.issue.toolUnknown',
39
+ 'unsupported.path_base': 'rules.issue.pathBase',
40
+ 'unsupported.mcp_paren': 'rules.issue.mcpParen',
41
+ 'unsupported.covering_paren': 'rules.issue.coveringParen',
39
42
  });
40
- const PARAM_SPLIT_WITH_COLON = 'this rule is invalid: a parameter rule is written name:pattern, and the name before the colon or the pattern after it is empty';
41
- const PARAM_SPLIT_NO_COLON = 'this rule is invalid: there is no colon inside the parentheses, so this is not a parameter rule (a parameter rule is written name:pattern)';
43
+ const PARAM_SPLIT_WITH_COLON = 'rules.issue.paramSplitWithColon';
44
+ const PARAM_SPLIT_NO_COLON = 'rules.issue.paramSplitNoColon';
42
45
  function colonInsideParens(rule) {
43
46
  if (typeof rule !== 'string')
44
47
  return undefined;
@@ -53,7 +56,7 @@ function colonInsideParens(rule) {
53
56
  }
54
57
  return undefined;
55
58
  }
56
- export function permissionRuleIssueDetail(code, message, rule) {
59
+ export function permissionRuleIssueDetail(code, message, rule, lang) {
57
60
  const colon = code === 'invalid.param_split' ? colonInsideParens(rule) : undefined;
58
61
  const known = colon !== undefined
59
62
  ? colon ? PARAM_SPLIT_WITH_COLON : PARAM_SPLIT_NO_COLON
@@ -63,7 +66,7 @@ export function permissionRuleIssueDetail(code, message, rule) {
63
66
  : '';
64
67
  const codeWord = typeof code === 'string' && code.length > 0 ? escapeDisplayControlChars(code) : '(no code)';
65
68
  const head = known !== undefined
66
- ? known
67
- : `this rule was refused with ${codeWord}, a code newer than this client`;
69
+ ? renderMessage(msg(known), lang)
70
+ : renderMessage(msg('rules.issue.newerCode', { code: codeWord }), lang);
68
71
  return text.length > 0 ? `${head} — ${text}` : head;
69
72
  }
@@ -1,4 +1,4 @@
1
- import { engineWireTarget } from './engineWireTarget.js';
1
+ import { engineWireTargetBaseUrl } from './engineWireTarget.js';
2
2
  import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
3
3
  import { msg, renderMessage } from './i18n/translate.js';
4
4
  import { ownDataField } from './ownKey.js';
@@ -23,7 +23,7 @@ const reader = createEngineCapReader({
23
23
  name: 'permissionRulesWrite',
24
24
  project: projectPermissionRulesWriteCapability,
25
25
  });
26
- export function observedPermissionRulesWrite(baseUrl = engineWireTarget()?.baseUrl) {
26
+ export function observedPermissionRulesWrite(baseUrl = engineWireTargetBaseUrl()) {
27
27
  return reader.observed(baseUrl);
28
28
  }
29
29
  export function permissionRulesWriteAvailable(reading) {
@@ -1,4 +1,4 @@
1
- import { engineWireTarget } from './engineWireTarget.js';
1
+ import { engineWireTargetBaseUrl } from './engineWireTarget.js';
2
2
  import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
3
3
  import { ownDataField } from './ownKey.js';
4
4
  import { hasCoreValuePort } from './coreValuePorts.js';
@@ -36,7 +36,7 @@ const reader = createEngineCapReader({
36
36
  name: ALLOW_GRANT_CAP_PATH.join('.'),
37
37
  project: projectPermissionsAllowGrantCapability,
38
38
  });
39
- export function observedPermissionsAllowGrant(baseUrl = engineWireTarget()?.baseUrl) {
39
+ export function observedPermissionsAllowGrant(baseUrl = engineWireTargetBaseUrl()) {
40
40
  return reader.observed(baseUrl);
41
41
  }
42
42
  export function permissionsAllowGrantAvailable(reading) {