@sema-agent/client-core 0.97.1 → 0.98.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 (281) hide show
  1. package/CHANGELOG.md +408 -0
  2. package/README.md +74 -37
  3. package/dist/adapt/arms.d.ts +1 -0
  4. package/dist/adapt/arms.js +128 -34
  5. package/dist/adapt/ids.d.ts +12 -1
  6. package/dist/adapt/ids.js +59 -8
  7. package/dist/adapt/instanceLedger.d.ts +50 -0
  8. package/dist/adapt/instanceLedger.js +147 -0
  9. package/dist/adapt/textStream.d.ts +1 -0
  10. package/dist/adapt/textStream.js +24 -7
  11. package/dist/adapt/toolCards.d.ts +27 -5
  12. package/dist/adapt/toolCards.js +39 -6
  13. package/dist/adapt/wireShapes.js +6 -2
  14. package/dist/adapt.d.ts +2 -0
  15. package/dist/adapt.js +8 -3
  16. package/dist/adapter/activeRunSelfHeal.d.ts +5 -0
  17. package/dist/adapter/activeRunSelfHeal.js +51 -28
  18. package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
  19. package/dist/adapter/downstream/eventToSdkMessage.js +27 -34
  20. package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
  21. package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
  22. package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
  23. package/dist/adapter/runStream.js +29 -13
  24. package/dist/adapter/types.d.ts +4 -4
  25. package/dist/agentSession/backgroundView.js +2 -1
  26. package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
  27. package/dist/agentSession/engineAgentRegistryRead.js +12 -13
  28. package/dist/agentsWireCaps.d.ts +8 -8
  29. package/dist/agentsWireCaps.js +168 -175
  30. package/dist/approvalDecidedByCapability.d.ts +0 -4
  31. package/dist/approvalDecidedByCapability.js +0 -6
  32. package/dist/approvalsStreamLiveCapability.d.ts +0 -4
  33. package/dist/approvalsStreamLiveCapability.js +0 -6
  34. package/dist/assistantInbox.d.ts +34 -0
  35. package/dist/assistantInbox.js +118 -0
  36. package/dist/centerWiringCapability.js +9 -1
  37. package/dist/clientSlice.d.ts +0 -9
  38. package/dist/clientSlice.js +0 -3
  39. package/dist/cloudConfigWireCaps.d.ts +4 -2
  40. package/dist/cloudConfigWireCaps.js +81 -61
  41. package/dist/compensations.js +1 -1
  42. package/dist/connectorStatus.d.ts +21 -0
  43. package/dist/connectorStatus.js +112 -0
  44. package/dist/controlRouter.d.ts +14 -1
  45. package/dist/controlRouter.js +68 -17
  46. package/dist/coreValuePorts.d.ts +3 -3
  47. package/dist/decideReceipt.d.ts +2 -2
  48. package/dist/decideReceipt.js +5 -2
  49. package/dist/declared/supportFloorDeclared.js +3 -3
  50. package/dist/deviceExecutorManagementCapability.d.ts +0 -4
  51. package/dist/deviceExecutorManagementCapability.js +0 -6
  52. package/dist/deviceRebind.d.ts +49 -1
  53. package/dist/deviceRebind.js +221 -3
  54. package/dist/displayUntrusted.d.ts +1 -0
  55. package/dist/displayUntrusted.js +250 -76
  56. package/dist/engineAgentAbsence.d.ts +1 -1
  57. package/dist/engineAgentPanelStore.d.ts +5 -4
  58. package/dist/engineAgentPanelStore.js +3 -12
  59. package/dist/engineCapReader.d.ts +0 -4
  60. package/dist/engineCapReader.js +1 -5
  61. package/dist/engineCapsCache.d.ts +4 -0
  62. package/dist/engineCapsCache.js +17 -12
  63. package/dist/engineClosedSets.d.ts +1 -0
  64. package/dist/engineClosedSets.js +4 -1
  65. package/dist/engineErrorCodes.d.ts +9 -2
  66. package/dist/engineErrorCodes.js +9 -1
  67. package/dist/engineIdentity.d.ts +1 -0
  68. package/dist/engineIdentity.js +8 -0
  69. package/dist/engineRowRef.d.ts +28 -0
  70. package/dist/engineRowRef.js +111 -0
  71. package/dist/engineSessionMessages.d.ts +67 -0
  72. package/dist/engineSessionMessages.js +364 -0
  73. package/dist/engineToolDirectory.d.ts +0 -9
  74. package/dist/engineToolDirectory.js +1 -94
  75. package/dist/engineUrl.d.ts +18 -0
  76. package/dist/engineUrl.js +52 -0
  77. package/dist/env/uiLanguage.d.ts +9 -0
  78. package/dist/env/uiLanguage.js +35 -0
  79. package/dist/eventLeg.d.ts +92 -0
  80. package/dist/eventLeg.js +285 -0
  81. package/dist/executionLaneCapability.d.ts +0 -4
  82. package/dist/executionLaneCapability.js +3 -16
  83. package/dist/fileHistoryCaptureCapability.d.ts +0 -4
  84. package/dist/fileHistoryCaptureCapability.js +5 -7
  85. package/dist/fleet/fleetLedger.d.ts +0 -3
  86. package/dist/fleet/fleetLedger.js +21 -36
  87. package/dist/fleet/fleetProjection.d.ts +2 -2
  88. package/dist/fleet/fleetProjection.js +10 -8
  89. package/dist/frameBinding.d.ts +5 -0
  90. package/dist/frameBinding.js +23 -0
  91. package/dist/gateFailureCodes.d.ts +2 -0
  92. package/dist/gateFailureCodes.js +15 -0
  93. package/dist/gateOutcome.d.ts +3 -1
  94. package/dist/gateOutcome.js +25 -6
  95. package/dist/gateVocabulary.d.ts +5 -0
  96. package/dist/gateVocabulary.js +64 -2
  97. package/dist/generated/engineAskFaceTables.js +2 -2
  98. package/dist/generated/engineFactTables.d.ts +6 -3
  99. package/dist/generated/engineFactTables.js +22 -4
  100. package/dist/generated/engineNoticeTables.js +9 -0
  101. package/dist/generated/toolNameTables.d.ts +1 -0
  102. package/dist/generated/toolNameTables.js +1 -0
  103. package/dist/hitl/allowRuleShadow.d.ts +6 -1
  104. package/dist/hitl/allowRuleShadow.js +21 -17
  105. package/dist/hitl/approvalCardReading.d.ts +15 -0
  106. package/dist/hitl/approvalCardReading.js +154 -0
  107. package/dist/hitl/approvalCardReasons.d.ts +13 -0
  108. package/dist/hitl/approvalCardReasons.js +120 -0
  109. package/dist/hitl/approvalHolds.d.ts +47 -15
  110. package/dist/hitl/approvalHolds.js +134 -28
  111. package/dist/hitl/approvalResolution.d.ts +51 -26
  112. package/dist/hitl/approvalResolution.js +86 -122
  113. package/dist/hitl/approvalsFeed.js +6 -18
  114. package/dist/hitl/askClassPair.d.ts +2 -0
  115. package/dist/hitl/askClassPair.js +1 -0
  116. package/dist/hitl/askGateWire.d.ts +20 -2
  117. package/dist/hitl/askGateWire.js +49 -1
  118. package/dist/hitl/askParkRowRouting.d.ts +5 -0
  119. package/dist/hitl/askParkRowRouting.js +32 -1
  120. package/dist/hitl/askSettlementLine.d.ts +18 -0
  121. package/dist/hitl/askSettlementLine.js +79 -0
  122. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  123. package/dist/hitl/automaticAnswerVerdict.js +21 -5
  124. package/dist/hitl/crashConverged.d.ts +11 -20
  125. package/dist/hitl/crashConverged.js +56 -0
  126. package/dist/hitl/crashConvergedNotice.d.ts +3 -1
  127. package/dist/hitl/crashConvergedNotice.js +48 -11
  128. package/dist/hitl/decisionConflict.js +3 -10
  129. package/dist/hitl/decisionRefusal.d.ts +40 -1
  130. package/dist/hitl/decisionRefusal.js +199 -42
  131. package/dist/hitl/frameRouter.d.ts +5 -2
  132. package/dist/hitl/frameRouter.js +20 -16
  133. package/dist/hitl/gateLedger.d.ts +2 -0
  134. package/dist/hitl/gateLedger.js +50 -13
  135. package/dist/hitl/hitlBridge.d.ts +1 -2
  136. package/dist/hitl/hitlBridge.js +10 -7
  137. package/dist/hitl/livePendingAsk.d.ts +3 -3
  138. package/dist/hitl/livePendingAsk.js +7 -18
  139. package/dist/hitl/parkResolver.d.ts +2 -24
  140. package/dist/hitl/parkResolver.js +61 -97
  141. package/dist/hitl/persistedRulesWire.d.ts +24 -0
  142. package/dist/hitl/persistedRulesWire.js +122 -2
  143. package/dist/hitl/planReviewWire.d.ts +26 -13
  144. package/dist/hitl/planReviewWire.js +112 -78
  145. package/dist/hitl/refusedToolNameProse.d.ts +0 -1
  146. package/dist/hitl/refusedToolNameProse.js +0 -3
  147. package/dist/hitl/replayedApproval.d.ts +4 -3
  148. package/dist/hitl/replayedApproval.js +7 -4
  149. package/dist/hitl/sessionPolicyDeliverable.js +2 -4
  150. package/dist/hitl/sessionPolicyWire.d.ts +32 -20
  151. package/dist/hitl/sessionPolicyWire.js +162 -52
  152. package/dist/hitl/standingRows.d.ts +20 -2
  153. package/dist/hitl/standingRows.js +69 -8
  154. package/dist/hitl/toolApprovalWire.d.ts +87 -152
  155. package/dist/hitl/toolApprovalWire.js +591 -380
  156. package/dist/hookMatcherVerdict.d.ts +6 -1
  157. package/dist/hookMatcherVerdict.js +14 -7
  158. package/dist/hooksWireCaps.d.ts +2 -2
  159. package/dist/hooksWireCaps.js +59 -55
  160. package/dist/i18n/messages.en.d.ts +121 -0
  161. package/dist/i18n/messages.en.js +119 -0
  162. package/dist/i18n/messages.zh.d.ts +3 -0
  163. package/dist/i18n/messages.zh.js +120 -0
  164. package/dist/i18n/translate.d.ts +25 -0
  165. package/dist/i18n/translate.js +127 -0
  166. package/dist/index.d.ts +53 -20
  167. package/dist/index.js +38 -11
  168. package/dist/inheritEnvCapability.d.ts +31 -0
  169. package/dist/inheritEnvCapability.js +104 -0
  170. package/dist/liveModelCatalog.d.ts +1 -2
  171. package/dist/liveModelCatalog.js +2 -6
  172. package/dist/liveQuestionStore.d.ts +2 -21
  173. package/dist/mcpLiveness.d.ts +2 -1
  174. package/dist/mcpProbeWire.d.ts +6 -1
  175. package/dist/mcpProbeWire.js +1 -1
  176. package/dist/mcpWireCaps.d.ts +13 -2
  177. package/dist/mcpWireCaps.js +48 -0
  178. package/dist/memoryEntriesWire.d.ts +4 -9
  179. package/dist/model/modelSupplyRules.d.ts +0 -2
  180. package/dist/model/modelSupplyRules.js +3 -12
  181. package/dist/model/modelsPolicy.d.ts +0 -5
  182. package/dist/model/modelsPolicy.js +6 -36
  183. package/dist/model/subagentModelWord.d.ts +31 -0
  184. package/dist/model/subagentModelWord.js +261 -0
  185. package/dist/notifications.d.ts +6 -0
  186. package/dist/notifications.js +71 -23
  187. package/dist/outputStyleSeatCapability.d.ts +0 -3
  188. package/dist/outputStyleSeatCapability.js +0 -3
  189. package/dist/ownKey.d.ts +15 -0
  190. package/dist/ownKey.js +60 -3
  191. package/dist/panelReduce.d.ts +15 -9
  192. package/dist/panelReduce.js +680 -549
  193. package/dist/panelStateHolder.d.ts +3 -7
  194. package/dist/panelStateHolder.js +14 -130
  195. package/dist/peerLaneCapability.d.ts +0 -4
  196. package/dist/peerLaneCapability.js +0 -6
  197. package/dist/permissionRulesWriteCapability.d.ts +0 -4
  198. package/dist/permissionRulesWriteCapability.js +0 -6
  199. package/dist/permissionWireCaps.d.ts +2 -2
  200. package/dist/permissionWireCaps.js +2 -0
  201. package/dist/permissionsAllowGrantCapability.d.ts +0 -4
  202. package/dist/permissionsAllowGrantCapability.js +0 -6
  203. package/dist/permissionsDeclaration.d.ts +0 -11
  204. package/dist/permissionsDeclaration.js +60 -53
  205. package/dist/pluginHooksWire.d.ts +1 -1
  206. package/dist/pluginHooksWire.js +3 -6
  207. package/dist/preemptWire.d.ts +44 -0
  208. package/dist/preemptWire.js +83 -0
  209. package/dist/printToolResultFrame.js +15 -4
  210. package/dist/replayBody.d.ts +3 -0
  211. package/dist/replayBody.js +14 -0
  212. package/dist/request/taskRequest.d.ts +0 -1
  213. package/dist/request/taskRequest.js +0 -3
  214. package/dist/resumeRefusalCopy.d.ts +2 -1
  215. package/dist/resumeRefusalCopy.js +38 -2
  216. package/dist/retryStatus.d.ts +8 -0
  217. package/dist/retryStatus.js +106 -1
  218. package/dist/rewindArchiveCapability.d.ts +0 -4
  219. package/dist/rewindArchiveCapability.js +2 -10
  220. package/dist/rewindArchiveReading.d.ts +0 -1
  221. package/dist/rewindArchiveReading.js +0 -3
  222. package/dist/runCancelContext.d.ts +2 -1
  223. package/dist/runCancelContext.js +4 -2
  224. package/dist/runReattachPolicy.d.ts +31 -0
  225. package/dist/runReattachPolicy.js +46 -0
  226. package/dist/runTerminal.d.ts +3 -6
  227. package/dist/runTerminal.js +8 -9
  228. package/dist/sandboxWire.d.ts +3 -1
  229. package/dist/sandboxWire.js +76 -27
  230. package/dist/scenarioWire.js +1 -1
  231. package/dist/seam.d.ts +24 -2
  232. package/dist/seam.js +15 -3
  233. package/dist/seatContract.d.ts +53 -10
  234. package/dist/seatContract.js +132 -81
  235. package/dist/sessionPolicyCapability.d.ts +0 -4
  236. package/dist/sessionPolicyCapability.js +0 -6
  237. package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
  238. package/dist/sessionSyncFileHistoryCapability.js +0 -3
  239. package/dist/skillToolListsCapability.d.ts +0 -3
  240. package/dist/skillToolListsCapability.js +0 -3
  241. package/dist/sqlEngineCapability.d.ts +0 -4
  242. package/dist/sqlEngineCapability.js +0 -6
  243. package/dist/steerPriorityCapability.d.ts +0 -3
  244. package/dist/steerPriorityCapability.js +0 -3
  245. package/dist/streamDrainingLegs.d.ts +4 -0
  246. package/dist/streamDrainingLegs.js +6 -1
  247. package/dist/subagent/engineCompactWire.d.ts +0 -1
  248. package/dist/subagent/engineCompactWire.js +7 -5
  249. package/dist/subagent/engineTaskHandleWire.js +4 -7
  250. package/dist/subagentContentStore.js +1 -11
  251. package/dist/submitReopen.d.ts +24 -0
  252. package/dist/submitReopen.js +75 -0
  253. package/dist/terminalStatuses.d.ts +3 -0
  254. package/dist/terminalStatuses.js +10 -2
  255. package/dist/toolResult.d.ts +10 -1
  256. package/dist/toolResult.js +34 -6
  257. package/dist/toolRoster.d.ts +0 -2
  258. package/dist/toolRoster.js +0 -2
  259. package/dist/turnFailurePresentation.d.ts +28 -0
  260. package/dist/turnFailurePresentation.js +205 -0
  261. package/dist/userInvokedSkillsCapability.d.ts +0 -3
  262. package/dist/userInvokedSkillsCapability.js +0 -3
  263. package/dist/webSearchBackendCapability.d.ts +0 -4
  264. package/dist/webSearchBackendCapability.js +0 -6
  265. package/dist/wireErrorTriage.js +5 -24
  266. package/dist/wireFailureShape.d.ts +62 -5
  267. package/dist/wireFailureShape.js +105 -5
  268. package/dist/wireRefusalCopy.d.ts +12 -2
  269. package/dist/wireRefusalCopy.js +50 -52
  270. package/dist/workflowsJournalCapability.d.ts +0 -4
  271. package/dist/workflowsJournalCapability.js +0 -6
  272. package/dist/writeProtectionCapability.d.ts +0 -4
  273. package/dist/writeProtectionCapability.js +0 -6
  274. package/docs/INTEGRATION-CLIENTS.md +1253 -46
  275. package/package.json +5 -4
  276. package/dist/attachmentSeatCapability.d.ts +0 -12
  277. package/dist/attachmentSeatCapability.js +0 -23
  278. package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
  279. package/dist/hitl/approvalOutcomeNote.js +0 -29
  280. package/dist/sessionReadRedactionCapability.d.ts +0 -13
  281. package/dist/sessionReadRedactionCapability.js +0 -35
@@ -243,6 +243,22 @@ function schemelessHostEnd(text, from) {
243
243
  const c = text.charCodeAt(k);
244
244
  return endsSchemelessHost(c) || c === 0x27 ? k : -1;
245
245
  }
246
+ const MAX_PORT = 65535;
247
+ function authorityIsHostPort(text, from, to) {
248
+ if (to <= from || schemelessHostEnd(text.slice(0, to), from) !== to)
249
+ return false;
250
+ const colon = text.charCodeAt(from) === 0x5b ? text.indexOf(']:', from) + 1 : text.indexOf(':', from);
251
+ if (colon <= 0 || colon >= to)
252
+ return true;
253
+ const port = text.slice(colon + 1, to);
254
+ return port.length <= 5 && Number(port) <= MAX_PORT;
255
+ }
256
+ function fragmentTerminatorFrom(s, from) {
257
+ for (let k = from; k < s.length; k++)
258
+ if (endsUrlFragmentAt(s, k))
259
+ return true;
260
+ return false;
261
+ }
246
262
  function valueCoreForJudging(value) {
247
263
  if (value.length === 0 || isMarker(value))
248
264
  return '';
@@ -315,33 +331,63 @@ function pathCandidates(src, base, path, opaqueSegments, edits, soft) {
315
331
  pos += segment.length + 1;
316
332
  }
317
333
  }
318
- function urlTokenCandidatesAt(src, start, end, edits, soft, byShape = false) {
319
- const token = src.slice(start, end);
320
- const schemeEnd = token.indexOf('://') + '://'.length;
321
- const scheme = token.slice(0, schemeEnd);
322
- const rest = token.slice(schemeEnd);
334
+ function addressCandidates(src, from, end, opaqueSegments, edits, regions, soft, byShape = false, whole = false, hostRegion = whole) {
335
+ const rest = src.slice(from, end);
323
336
  const authorityEnd = rest.search(/[/?#]/);
324
337
  const authority = authorityEnd === -1 ? rest : rest.slice(0, authorityEnd);
325
- const tailStart = schemeEnd + authority.length;
326
- const tail = token.slice(tailStart);
338
+ const tailStart = from + authority.length;
339
+ const tail = src.slice(tailStart, end);
327
340
  const at = authority.lastIndexOf('@');
328
341
  if (at !== -1 && !userinfoIsWholeMarker(authority.slice(0, at)))
329
- pushEdit(edits, src, start + schemeEnd, start + schemeEnd + at, REDACTED_USERINFO);
342
+ pushEdit(edits, src, from, from + at, REDACTED_USERINFO);
330
343
  const hash = tail.indexOf('#');
331
344
  const beforeHash = hash === -1 ? tail : tail.slice(0, hash);
332
345
  const question = beforeHash.indexOf('?');
333
346
  const path = question === -1 ? beforeHash : beforeHash.slice(0, question);
334
- pathCandidates(src, start + tailStart, path, !/^file:/i.test(scheme), edits, soft);
347
+ pathCandidates(src, tailStart, path, opaqueSegments, edits, soft);
348
+ if (whole) {
349
+ const cut = pathCutAfterFirstLabel(path, true);
350
+ if (cut !== -1 && fragmentTerminatorFrom(path, cut))
351
+ pushEdit(edits, src, tailStart + cut, tailStart + path.length, REDACTED_SECRET);
352
+ }
335
353
  if (question !== -1)
336
- queryCandidates(src, start + tailStart + question + 1, beforeHash.slice(question + 1), edits, soft, byShape);
354
+ queryCandidates(src, tailStart + question + 1, beforeHash.slice(question + 1), edits, soft, byShape);
337
355
  if (hash !== -1) {
338
356
  const rawFragment = tail.slice(hash + 1);
339
- const at = start + tailStart + hash + 1;
340
- if (rawFragment.length > 0 && !slotIsWholeMarker(rawFragment, soft && ((i) => soft(at + i))))
341
- pushEdit(edits, src, start + tailStart + hash + 1, end, REDACTED_FRAGMENT);
357
+ const fragAt = tailStart + hash + 1;
358
+ if (rawFragment.length > 0 && !slotIsWholeMarker(rawFragment, soft && ((i) => soft(fragAt + i))))
359
+ pushEdit(edits, src, fragAt, end, REDACTED_FRAGMENT);
342
360
  }
361
+ if (question !== -1)
362
+ regions.push([tailStart + question + 1, tailStart + beforeHash.length, 'query']);
363
+ if (hash !== -1 && hash + 1 < tail.length)
364
+ regions.push([tailStart + hash + 1, end, 'fragment']);
365
+ if (hostRegion && authority.length > 0) {
366
+ const hostFrom = at === -1 ? from : from + at + 1;
367
+ if (authorityIsHostPort(src, hostFrom, tailStart))
368
+ regions.push([hostFrom, tailStart, 'host']);
369
+ }
370
+ }
371
+ function relativeAddressCandidates(text, out, regions, unitPos, soft, hostRegion = true) {
372
+ let p0 = 0;
373
+ while (p0 < text.length && (isWhitespaceOrControl(text.charAt(p0)) || text.charAt(p0) === VIEW_SEPARATOR))
374
+ p0++;
375
+ const c0 = text.charAt(p0);
376
+ if (c0 !== '/' && c0 !== '?' && c0 !== '#')
377
+ return false;
378
+ let end = text.length;
379
+ while (end > p0 && (text.charAt(end - 1) === VIEW_SEPARATOR || isWhitespaceOrControl(text.charAt(end - 1)) || isUnicodeBlank(text.charCodeAt(end - 1))))
380
+ end--;
381
+ end = trailingCloserEnd(text, p0, p0 + 1, end, unitPos);
382
+ const from = text.startsWith('//', p0) ? p0 + 2 : p0;
383
+ const tokenEdits = [];
384
+ addressCandidates(text, from, end, true, tokenEdits, regions, soft, false, true, hostRegion);
385
+ editsToCandidates(tokenEdits, 'url', out, end);
386
+ return true;
343
387
  }
344
- function urlCandidates(text, out, regions, unitPos = () => false, soft, byShape = false) {
388
+ function urlCandidates(text, out, regions, unitPos = () => false, soft, byShape = false, whole = false, hostRegion = whole) {
389
+ if (whole && relativeAddressCandidates(text, out, regions, unitPos, soft, hostRegion))
390
+ return;
345
391
  let mark = text.indexOf('://');
346
392
  while (mark !== -1) {
347
393
  let start = mark;
@@ -366,7 +412,9 @@ function urlCandidates(text, out, regions, unitPos = () => false, soft, byShape
366
412
  }
367
413
  return at <= firstVisible;
368
414
  };
369
- while (end < text.length) {
415
+ if (whole)
416
+ end = text.length;
417
+ while (!whole && end < text.length) {
370
418
  const ch = text.charAt(end);
371
419
  if (isWhitespaceOrControl(ch))
372
420
  break;
@@ -397,7 +445,7 @@ function urlCandidates(text, out, regions, unitPos = () => false, soft, byShape
397
445
  seenPathSep = true;
398
446
  end++;
399
447
  }
400
- while (end > mark + 3 && text.charAt(end - 1) === VIEW_SEPARATOR)
448
+ while (end > mark + 3 && (text.charAt(end - 1) === VIEW_SEPARATOR || (whole && (isWhitespaceOrControl(text.charAt(end - 1)) || isUnicodeBlank(text.charCodeAt(end - 1))))))
401
449
  end--;
402
450
  let runStart = end;
403
451
  while (runStart > mark + 3 && TRAILING_PUNCTUATION.has(text.charAt(runStart - 1)))
@@ -406,21 +454,8 @@ function urlCandidates(text, out, regions, unitPos = () => false, soft, byShape
406
454
  end = runStart;
407
455
  end = trailingCloserEnd(text, start, mark + 3, end, unitPos);
408
456
  const tokenEdits = [];
409
- urlTokenCandidatesAt(text, start, end, tokenEdits, soft, byShape);
457
+ addressCandidates(text, mark + 3, end, !/^file:/i.test(text.slice(start, mark + 3)), tokenEdits, regions, soft, byShape, whole, hostRegion);
410
458
  editsToCandidates(tokenEdits, 'url', out, end);
411
- const token = text.slice(start, end);
412
- const schemeEnd = token.indexOf('://') + 3;
413
- const rest = token.slice(schemeEnd);
414
- const authorityEnd = rest.search(/[/?#]/);
415
- const tailStart = schemeEnd + (authorityEnd === -1 ? rest.length : authorityEnd);
416
- const tail = token.slice(tailStart);
417
- const hash = tail.indexOf('#');
418
- const beforeHash = hash === -1 ? tail : tail.slice(0, hash);
419
- const question = beforeHash.indexOf('?');
420
- if (question !== -1)
421
- regions.push([start + tailStart + question + 1, start + tailStart + beforeHash.length, 'query']);
422
- if (hash !== -1 && hash + 1 < tail.length)
423
- regions.push([start + tailStart + hash + 1, end, 'fragment']);
424
459
  mark = text.indexOf('://', end > mark + 3 ? end : mark + 3);
425
460
  }
426
461
  }
@@ -914,7 +949,7 @@ function codeSpanClose(text, plain) {
914
949
  }
915
950
  return close;
916
951
  }
917
- const BRACKET_PAIRS = new Map([['(', ')'], ['[', ']']]);
952
+ const BRACKET_PAIRS = new Map([['(', ')'], ['[', ']'], ['{', '}'], ['<', '>']]);
918
953
  class InnerWordIndex {
919
954
  text;
920
955
  tokenInner;
@@ -960,22 +995,34 @@ class InnerWordIndex {
960
995
  }
961
996
  }
962
997
  const WRAPPED_PLACEHOLDER = /^(?:[A-Z]{1,12}(?:_[A-Z]{1,12})*|[a-z]{1,12}(?:-[a-z]{1,12})*)$/;
998
+ const TEMPLATE_PLACEHOLDER = /^[a-z]{1,12}(?:_[a-z]{1,12})+$/;
999
+ function isWrappedPlaceholder(inner, open) {
1000
+ return WRAPPED_PLACEHOLDER.test(inner) || ((open === '{' || open === '<') && TEMPLATE_PLACEHOLDER.test(inner));
1001
+ }
963
1002
  function wrappedValueAt(text, from, idx) {
964
1003
  let k = from;
965
1004
  while (k < text.length && text[k] === VIEW_SEPARATOR)
966
1005
  k++;
967
- const close = BRACKET_PAIRS.get(text.charAt(k));
1006
+ const open = text.charAt(k);
1007
+ const close = BRACKET_PAIRS.get(open);
968
1008
  if (close === undefined || credentialWordStartsAt(text, k + 1, idx.tokenInner))
969
1009
  return null;
970
1010
  const inner = scanSecretValue(text, k + 1, idx);
971
1011
  if (inner === null || inner.start !== k + 1)
972
1012
  return null;
973
- let c = inner.end;
1013
+ let innerEnd = inner.end;
1014
+ let semi = innerEnd;
1015
+ while (semi < text.length && text[semi] === VIEW_SEPARATOR)
1016
+ semi++;
1017
+ const cont = separatorContinuedEnd(text, semi, idx);
1018
+ if (cont !== -1)
1019
+ innerEnd = cont;
1020
+ let c = innerEnd;
974
1021
  while (c < text.length && text[c] === VIEW_SEPARATOR)
975
1022
  c++;
976
1023
  if (text.charAt(c) !== close || (close === ']' && text.charAt(c + 1) === '('))
977
1024
  return null;
978
- return inner;
1025
+ return { start: inner.start, end: innerEnd, open };
979
1026
  }
980
1027
  function tokenSchemeValueEnd(text, start, end, idx) {
981
1028
  if (withoutSeparators(text.slice(start, end)).toLowerCase() !== 'token')
@@ -1115,6 +1162,9 @@ function isDiagnosticWord(value) {
1115
1162
  const bare = value.replace(/^\.+/, '').replace(/[.,;:!?)\]}'"]{0,8}$/, '').toLowerCase();
1116
1163
  return bare === '' || DIAGNOSTIC_VALUE_WORDS.has(bare);
1117
1164
  }
1165
+ export function isDiagnosticValueWord(value) {
1166
+ return typeof value === 'string' && isDiagnosticWord(value);
1167
+ }
1118
1168
  const TOKEN_COUNT_HEAD_WORDS = new Set([
1119
1169
  'max', 'min', 'num', 'n', 'input', 'output', 'total', 'prompt', 'completion', 'thinking', 'reasoning',
1120
1170
  'cache', 'cached', 'context', 'budget', 'used', 'remaining', 'reserved', 'new', 'effective', 'limit',
@@ -1171,7 +1221,7 @@ function isNamedNotValue(label, value) {
1171
1221
  return true;
1172
1222
  return isBacktickedCredentialName(value);
1173
1223
  }
1174
- function schemeIsLabelValue(text, at) {
1224
+ function schemeIsLabelValue(text, at, outer = false) {
1175
1225
  let k = at;
1176
1226
  while (k > 0 && text[k - 1] === VIEW_SEPARATOR)
1177
1227
  k--;
@@ -1180,7 +1230,7 @@ function schemeIsLabelValue(text, at) {
1180
1230
  while (k > 0 && text.charCodeAt(k - 1) === 0x5c)
1181
1231
  k--;
1182
1232
  }
1183
- return k > 0 && labelEndsAt(text, k);
1233
+ return k > 0 && labelEndsAt(text, k, false, outer);
1184
1234
  }
1185
1235
  function labelQuotedAt(text, at, sep) {
1186
1236
  const q = text.charAt(at - 1);
@@ -1299,10 +1349,14 @@ function percentLayers(text) {
1299
1349
  }
1300
1350
  return out;
1301
1351
  }
1302
- function firstLabelCutInPath(path) {
1352
+ function firstLabelCutInPath(path, outer = false) {
1303
1353
  let cut = -1;
1304
- for (const src of [SECRET_SCHEME_WORD, SECRET_LABELLED_WORD]) {
1305
- const hit = new RegExp(src.source, src.flags.replace('g', '')).exec(path);
1354
+ const sources = outer ? [[SCHEME_WORD_OUTER_SOURCE, false], [LABEL_WORD_OUTER_SOURCE, true]] : [[SECRET_SCHEME_WORD.source, false], [SECRET_LABELLED_WORD.source, false]];
1355
+ for (const [source, countExempt] of sources) {
1356
+ const re = new RegExp(source, 'gi');
1357
+ let hit = re.exec(path);
1358
+ while (hit !== null && countExempt && isTokenCountLabel(path, hit.index, hit[1] ?? ''))
1359
+ hit = re.exec(path);
1306
1360
  if (hit === null)
1307
1361
  continue;
1308
1362
  const at = hit.index + hit[0].length;
@@ -1313,11 +1367,11 @@ function firstLabelCutInPath(path) {
1313
1367
  }
1314
1368
  return cut;
1315
1369
  }
1316
- function pathCutAfterFirstLabel(path) {
1317
- let cut = firstLabelCutInPath(path);
1370
+ function pathCutAfterFirstLabel(path, outer = false) {
1371
+ let cut = firstLabelCutInPath(path, outer);
1318
1372
  const { decoded, offsets } = percentDecodeForMatching(path);
1319
1373
  if (decoded !== path) {
1320
- const decodedCut = firstLabelCutInPath(decoded);
1374
+ const decodedCut = firstLabelCutInPath(decoded, outer);
1321
1375
  if (decodedCut !== -1) {
1322
1376
  const mapped = offsets[decodedCut] ?? path.length;
1323
1377
  if (mapped < path.length && (cut === -1 || mapped < cut))
@@ -2130,6 +2184,62 @@ function blockSeqEntries(scan, rawFrom, rawLabel) {
2130
2184
  }
2131
2185
  return out;
2132
2186
  }
2187
+ function separatorContinuedEnd(text, at, idx) {
2188
+ const isSep = (ch) => ch === ';';
2189
+ let end = -1;
2190
+ let p = at;
2191
+ for (;;) {
2192
+ if (!isSep(text.charAt(p)))
2193
+ return end;
2194
+ let k = p;
2195
+ while (k < text.length && (isSep(text.charAt(k)) || text[k] === VIEW_SEPARATOR))
2196
+ k++;
2197
+ if (k >= text.length || isBareValueStop(text.charAt(k)))
2198
+ return end;
2199
+ if (credentialWordStartsAt(text, k, idx.tokenInner) || PAIR_ITEM.test(text.slice(k, k + 256)))
2200
+ return end;
2201
+ const v = scanSecretValue(text, k, idx);
2202
+ if (v === null || v.end <= k)
2203
+ return end;
2204
+ end = v.end;
2205
+ p = v.end;
2206
+ while (p < text.length && text[p] === VIEW_SEPARATOR)
2207
+ p++;
2208
+ }
2209
+ }
2210
+ const ENV_ASSIGNED_NAME = /^[A-Z][A-Z0-9_]*$/;
2211
+ const ENV_ASSIGNMENT_AHEAD = /^[A-Z_][A-Z0-9_]*=[^=\s]/;
2212
+ function envSchemeWordReading(text, at) {
2213
+ if (at < 2 || text.charCodeAt(at - 1) !== 0x3d)
2214
+ return null;
2215
+ let e = at;
2216
+ while (e < text.length && isAlpha(text.charAt(e)))
2217
+ e++;
2218
+ const word = text.slice(at, e).toLowerCase();
2219
+ if (word !== 'bearer' && word !== 'basic')
2220
+ return null;
2221
+ let w = at - 1;
2222
+ while (w > 0 && isKeyWordChar(text.charCodeAt(w - 1)) && text.charCodeAt(w - 1) !== 0x2d)
2223
+ w--;
2224
+ if (!ENV_ASSIGNED_NAME.test(text.slice(w, at - 1)) || !labelEndsAt(text, at, false, true))
2225
+ return null;
2226
+ const inline = (p) => {
2227
+ while (p < text.length && (text[p] === ' ' || text[p] === '\t' || text[p] === VIEW_SEPARATOR))
2228
+ p++;
2229
+ return p;
2230
+ };
2231
+ const k = inline(e);
2232
+ if (k >= text.length)
2233
+ return { end: e, beforeAssignment: false };
2234
+ const c = text.charCodeAt(k);
2235
+ if (c === 0x0a || c === 0x0d || c === 0x2028 || c === 0x2029) {
2236
+ let n = k + 1;
2237
+ if (c === 0x0d && text.charCodeAt(n) === 0x0a)
2238
+ n++;
2239
+ return { end: e, beforeAssignment: ENV_ASSIGNMENT_AHEAD.test(text.slice(inline(n), inline(n) + 256)) };
2240
+ }
2241
+ return k > e && ENV_ASSIGNMENT_AHEAD.test(text.slice(k, k + 256)) ? { end: e, beforeAssignment: true } : null;
2242
+ }
2133
2243
  function labelCandidates(S, pass, regions, out, blocks, outer = false) {
2134
2244
  const text = S.text;
2135
2245
  const unitAt = (k) => S.unitAt(k);
@@ -2354,8 +2464,9 @@ function labelCandidates(S, pass, regions, out, blocks, outer = false) {
2354
2464
  if (regionKind !== null)
2355
2465
  for (const r of regions)
2356
2466
  for (let k = r[0]; k < r[1] && k < text.length; k++)
2357
- regionKind[k] = r[2] === 'query' ? 1 : 2;
2467
+ regionKind[k] = r[2] === 'query' ? 1 : r[2] === 'fragment' ? 2 : 3;
2358
2468
  const inQuery = (k) => regionKind !== null && k < text.length && regionKind[k] === 1;
2469
+ const inHost = (k) => regionKind !== null && k < text.length && regionKind[k] === 3;
2359
2470
  const forbiddenTailAt = (p) => {
2360
2471
  if (!PASSWORD_FORBIDDEN.has(text.charAt(p)))
2361
2472
  return -1;
@@ -2388,6 +2499,10 @@ function labelCandidates(S, pass, regions, out, blocks, outer = false) {
2388
2499
  }
2389
2500
  if (hit.index >= skipFrom && hit.index < skipTo)
2390
2501
  continue;
2502
+ if (inHost(hit.index))
2503
+ continue;
2504
+ if (schemePass && envSchemeWordReading(text, hit.index)?.beforeAssignment === true)
2505
+ continue;
2391
2506
  if (schemePass && (label.toLowerCase() === 'token') !== tokenPass)
2392
2507
  continue;
2393
2508
  if (isTokenCountLabel(text, hit.index, label))
@@ -2407,6 +2522,14 @@ function labelCandidates(S, pass, regions, out, blocks, outer = false) {
2407
2522
  if (isQuoteChar(text.charAt(q)))
2408
2523
  from = k;
2409
2524
  }
2525
+ if (!schemePass) {
2526
+ const ev = envSchemeWordReading(text, from);
2527
+ if (ev !== null) {
2528
+ push(from, ev.end, REDACTED_SECRET);
2529
+ re.lastIndex = ev.end;
2530
+ continue;
2531
+ }
2532
+ }
2410
2533
  const colonSep = isColonSeparator(hit[0].slice((hit[1] ?? '').length));
2411
2534
  let bulletSkipped = false;
2412
2535
  for (;;) {
@@ -2473,12 +2596,25 @@ function labelCandidates(S, pass, regions, out, blocks, outer = false) {
2473
2596
  if (v0s === null) {
2474
2597
  const w = wrappedValueAt(text, from, idx);
2475
2598
  if (w !== null) {
2476
- if (WRAPPED_PLACEHOLDER.test(withoutSeparators(text.slice(w.start, w.end))))
2599
+ if (isWrappedPlaceholder(withoutSeparators(text.slice(w.start, w.end)), w.open))
2477
2600
  continue;
2478
2601
  v0s = w;
2479
2602
  wrapEnd = w.end;
2480
2603
  }
2481
2604
  }
2605
+ if (wrapEnd === -1) {
2606
+ let qq = from;
2607
+ while (text.charCodeAt(qq) === 0x5c)
2608
+ qq++;
2609
+ if (!isQuoteChar(text.charAt(qq))) {
2610
+ let sepAt = v0s === null ? from : v0s.end;
2611
+ while (sepAt < text.length && text[sepAt] === VIEW_SEPARATOR)
2612
+ sepAt++;
2613
+ const cont = separatorContinuedEnd(text, sepAt, idx);
2614
+ if (cont !== -1)
2615
+ v0s = { start: v0s === null ? sepAt : v0s.start, end: cont };
2616
+ }
2617
+ }
2482
2618
  if (v0s === null) {
2483
2619
  let k = from;
2484
2620
  while (k < text.length && text[k] === VIEW_SEPARATOR)
@@ -2602,7 +2738,8 @@ function labelCandidates(S, pass, regions, out, blocks, outer = false) {
2602
2738
  re.lastIndex = quoted ? from : v.end;
2603
2739
  continue;
2604
2740
  }
2605
- if (schemePass && !quoted && schemeFollowerReleased(label, value, text.charCodeAt(hit.index - 1) === 0x2f)) {
2741
+ const labelledScheme = schemePass && label.toLowerCase() !== 'token' && schemeIsLabelValue(text, hit.index, true);
2742
+ if (schemePass && !quoted && !labelledScheme && schemeFollowerReleased(label, value, text.charCodeAt(hit.index - 1) === 0x2f)) {
2606
2743
  re.lastIndex = v.end;
2607
2744
  continue;
2608
2745
  }
@@ -3672,31 +3809,48 @@ function screenSurfaces(text, o) {
3672
3809
  function percentSurfaces(raw, text, base, o) {
3673
3810
  const surfaces = [];
3674
3811
  const contents = [];
3675
- for (const layer of percentLayers(text)) {
3676
- const n = layer.text.length;
3677
- const ps = new Int32Array(n);
3678
- const pe = new Int32Array(n);
3679
- const pdot = new Uint8Array(n);
3680
- for (let k = 0; k < n; k++) {
3681
- const a = layer.ps[k] ?? 0;
3682
- const b = layer.pe[k] ?? 0;
3683
- ps[k] = base === null ? a : (base.ps[a] ?? 0);
3684
- pe[k] = base === null ? b : (base.pe[b - 1] ?? 0);
3685
- if (base !== null && b - a === 1)
3686
- pdot[k] = base.pdot[a] ?? 0;
3687
- }
3688
- const M = { ps, pe, pdot, rawDot: base === null ? new Uint8Array(raw.length) : base.rawDot };
3689
- const VD = buildScanView(layer.text, o);
3690
- const sep = separatedSurface(raw, VD, M);
3691
- surfaces.push(base === null ? { ...sep, rawDot: null } : sep);
3692
- const joined = joinedSurface(raw, VD, false, M);
3693
- if (joined !== null)
3694
- surfaces.push(base === null ? { ...joined, rawDot: null } : joined);
3695
- for (const [a, b] of VD.contents)
3696
- contents.push({ sub: layer.text.slice(a, b), rawAt: (k) => ps[a + k] ?? 0, rawEndAt: (k) => pe[a + k] ?? 0 });
3697
- }
3812
+ for (const layer of percentLayers(text))
3813
+ layerSurfaces(raw, layer, base, o, surfaces, contents);
3698
3814
  return { surfaces, contents };
3699
3815
  }
3816
+ function layerSurfaces(raw, layer, base, o, surfaces, contents, decoded = true) {
3817
+ const n = layer.text.length;
3818
+ const ps = new Int32Array(n);
3819
+ const pe = new Int32Array(n);
3820
+ const pdot = new Uint8Array(n);
3821
+ for (let k = 0; k < n; k++) {
3822
+ const a = layer.ps[k] ?? 0;
3823
+ const b = layer.pe[k] ?? 0;
3824
+ ps[k] = base === null ? a : (base.ps[a] ?? 0);
3825
+ pe[k] = base === null ? b : (base.pe[b - 1] ?? 0);
3826
+ if (base !== null && b - a === 1)
3827
+ pdot[k] = base.pdot[a] ?? 0;
3828
+ }
3829
+ const M = { ps, pe, pdot, rawDot: base === null ? new Uint8Array(raw.length) : base.rawDot };
3830
+ const VD = buildScanView(layer.text, o);
3831
+ const sep = separatedSurface(raw, VD, M);
3832
+ surfaces.push(base === null ? { ...sep, rawDot: null, decoded } : { ...sep, decoded });
3833
+ const joined = joinedSurface(raw, VD, false, M);
3834
+ if (joined !== null)
3835
+ surfaces.push(base === null ? { ...joined, rawDot: null, decoded } : { ...joined, decoded });
3836
+ for (const [a, b] of VD.contents)
3837
+ contents.push({ sub: layer.text.slice(a, b), rawAt: (k) => ps[a + k] ?? 0, rawEndAt: (k) => pe[a + k] ?? 0 });
3838
+ }
3839
+ function parserViewLayer(text) {
3840
+ if (!/[\t\n\r]/.test(text))
3841
+ return null;
3842
+ const chars = [];
3843
+ const ps = [];
3844
+ for (let k = 0; k < text.length; k++) {
3845
+ const c = text.charCodeAt(k);
3846
+ if (c === 0x09 || c === 0x0a || c === 0x0d)
3847
+ continue;
3848
+ chars.push(text.charAt(k));
3849
+ ps.push(k);
3850
+ }
3851
+ const starts = Int32Array.from(ps);
3852
+ return { text: chars.join(''), ps: starts, pe: Int32Array.from(ps, (k) => k + 1) };
3853
+ }
3700
3854
  function finalIsStructural(text, at) {
3701
3855
  if (text.charCodeAt(at) !== 0x5c)
3702
3856
  return false;
@@ -3968,6 +4122,11 @@ function collectCandidates(text, o, nested) {
3968
4122
  const decoded = percentSurfaces(text, text, null, o);
3969
4123
  surfaces.push(...decoded.surfaces);
3970
4124
  const decodedContents = decoded.contents;
4125
+ if (o.wholeAddress === true) {
4126
+ const pv = parserViewLayer(text);
4127
+ if (pv !== null)
4128
+ layerSurfaces(text, pv, null, o, surfaces, decodedContents, false);
4129
+ }
3971
4130
  const raw = [];
3972
4131
  const blocks = { raw: text, view: V, out: raw, lines: [null, null], marks: null };
3973
4132
  const regionSurface = screen.surfaces[0] ?? separated;
@@ -3977,7 +4136,7 @@ function collectCandidates(text, o, nested) {
3977
4136
  const regions = [];
3978
4137
  if (o.urls) {
3979
4138
  const unitPos = (k) => S.dropped(k) || V.rawUnit[S.rawStart(k)] === 1;
3980
- urlCandidates(S.text, cands, regions, unitPos, (k) => unitPos(k) || S.painted(k), o.queryByShape ?? false);
4139
+ urlCandidates(S.text, cands, regions, unitPos, (k) => unitPos(k) || S.painted(k), o.queryByShape ?? false, o.wholeAddress === true, o.wholeAddress === true && S.decoded !== true);
3981
4140
  userinfoCandidates(S, cands, o.words);
3982
4141
  }
3983
4142
  if (o.words) {
@@ -4450,10 +4609,11 @@ function escapeSpacesFor(o, face) {
4450
4609
  }
4451
4610
  return set.size === 0 ? null : set;
4452
4611
  }
4453
- function scanOptionsOf(o, face, queryByShape = false) {
4612
+ function scanOptionsOf(o, face, queryByShape = false, wholeAddress = false) {
4454
4613
  return {
4455
4614
  urls: o.credentialUrls !== false,
4456
4615
  queryByShape,
4616
+ wholeAddress,
4457
4617
  words: o.credentialWords !== false,
4458
4618
  blanks: face.keepBlanks === true,
4459
4619
  fold: face.fold,
@@ -4468,11 +4628,11 @@ export function credentialWashPasses(text, opts = {}) {
4468
4628
  scanAndMask(input, scan, false, stats);
4469
4629
  return { passes: stats.passes, capped: stats.capped };
4470
4630
  }
4471
- function renderUntrusted(text, opts, ledger, queryByShape = false) {
4631
+ function renderUntrusted(text, opts, ledger, queryByShape = false, wholeAddress = false) {
4472
4632
  const input = typeof text === 'string' ? text : String(text ?? '');
4473
4633
  const o = opts ?? {};
4474
4634
  const face = publicFace(o);
4475
- const scan = scanOptionsOf(o, face, queryByShape);
4635
+ const scan = scanOptionsOf(o, face, queryByShape, wholeAddress);
4476
4636
  const pairBackslashes = o.escapeBackslashes === true && face.mark !== 'dot' && face.mark !== 'space';
4477
4637
  const book = ledger ?? (pairBackslashes ? { cps: [], lens: [] } : null);
4478
4638
  if (book === null) {
@@ -4661,10 +4821,23 @@ function queryPartCarriesCredential(key, value, relax) {
4661
4821
  if (relax && isNonSecretFieldName(key) && isReadableWordChain(value))
4662
4822
  return isKnownSecretSegment(value);
4663
4823
  }
4664
- return isOpaqueSecretValue(value) || carriesCredentialStructure(value);
4824
+ if (isOpaqueSecretValue(value) || carriesCredentialStructure(value))
4825
+ return true;
4826
+ let from = 0;
4827
+ for (let i = 0; i <= value.length; i++) {
4828
+ if (i < value.length && !endsUrlFragmentAt(value, i))
4829
+ continue;
4830
+ if (i > from && (from > 0 || i < value.length)) {
4831
+ const chunk = value.slice(from, i);
4832
+ if (isOpaqueSecretValue(chunk) || carriesCredentialStructure(chunk))
4833
+ return true;
4834
+ }
4835
+ from = i + 1;
4836
+ }
4837
+ return false;
4665
4838
  }
4666
4839
  const UPLOAD_PROBE_PREFIX = 'https://q.invalid/?';
4667
- const UPLOAD_SCAN_OPTIONS = Object.freeze({ urls: true, queryByShape: 'strict', words: true, blanks: false, fold: false, face: null, escapeSpaces: null });
4840
+ const UPLOAD_SCAN_OPTIONS = Object.freeze({ urls: true, queryByShape: 'strict', wholeAddress: true, words: true, blanks: false, fold: false, face: null, escapeSpaces: null });
4668
4841
  export function queryCarriesCredential(query) {
4669
4842
  if (typeof query !== 'string' || query.length === 0)
4670
4843
  return false;
@@ -4672,11 +4845,12 @@ export function queryCarriesCredential(query) {
4672
4845
  return scanOnce(probe, UPLOAD_SCAN_OPTIONS, false).text !== probe;
4673
4846
  }
4674
4847
  export function displayConfiguredUrl(url, opts = {}) {
4675
- const out = renderUntrusted(typeof url === 'string' ? configuredUrlScannable(url) : url, opts, null, 'relaxed');
4848
+ const out = renderUntrusted(typeof url === 'string' ? configuredUrlScannable(url) : url, opts, null, 'relaxed', true);
4676
4849
  return typeof out === 'string' ? out : out.text;
4677
4850
  }
4678
4851
  function configuredUrlScannable(url) {
4679
- if (/^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(url) || !/^[A-Za-z][A-Za-z0-9+.-]*:/.test(url))
4852
+ const view = url.replace(/[\t\n\r]/g, '').replace(/^[\u0000-\u0020]+/, '');
4853
+ if (/^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(view) || !/^[A-Za-z][A-Za-z0-9+.-]*:/.test(view))
4680
4854
  return url;
4681
4855
  let u;
4682
4856
  try {
@@ -56,7 +56,7 @@ export interface EngineAgentRegistryRowView {
56
56
  readonly description?: string;
57
57
  readonly createdAt?: number;
58
58
  }
59
- export type EngineAgentRegistryUnavailableWhy = 'no_list_face' | 'route_absent' | 'ownership_required' | 'read_failed';
59
+ export type EngineAgentRegistryUnavailableWhy = 'no_list_face' | 'capability_unknown' | 'route_absent' | 'ownership_required' | 'read_failed';
60
60
  export type EngineAgentRegistryListing = {
61
61
  readonly kind: 'rows';
62
62
  readonly rows: readonly EngineAgentRegistryRowView[];
@@ -33,6 +33,10 @@ export type EngineAgentPanelEvent = {
33
33
  parentToolCallId?: string;
34
34
  wireTaskId?: string;
35
35
  taskIdOrigin?: 'wire';
36
+ final?: {
37
+ totalTokens?: true;
38
+ toolUses?: true;
39
+ };
36
40
  } | {
37
41
  kind: 'end';
38
42
  taskId: string;
@@ -49,12 +53,11 @@ export declare const PANEL_TOOLUSES_LANE_POLICY: Readonly<Record<'tick' | 'fleet
49
53
  export declare function markEnginePanelTaskResident(taskId: string): void;
50
54
  export declare function clearEnginePanelTaskResident(taskId: string): void;
51
55
  export declare function isEnginePanelTaskResident(taskId: string): boolean;
52
- export declare function resolveEnginePanelTaskId(wireTaskId: string, parentToolCallId?: string): EnginePanelTaskIdentity;
56
+ export declare function resolveEnginePanelTaskId(wireTaskId: string): EnginePanelTaskIdentity;
53
57
  export declare function clearEnginePanelTaskResidentByWire(wireTaskId: string, cycle?: EngineAgentPanelCycleIdentity): void;
54
58
  export declare function __resetEngineAgentPanelIdentityForTests(): void;
55
59
  export declare function __resetEnginePanelStateForTests(): void;
56
60
  export declare function publishEngineAgentPanelEvent(ev: EngineAgentPanelEvent): void;
57
- export declare function subscribeEngineAgentPanel(fn: (ev: EngineAgentPanelEvent) => void): () => void;
58
61
  export declare function subscribeEnginePanelRows(fn: (delta: PanelDelta) => void): () => void;
59
62
  export interface EngineAgentPanelAbsence {
60
63
  taskId: string;
@@ -63,5 +66,3 @@ export interface EngineAgentPanelAbsence {
63
66
  wireTaskId?: string;
64
67
  }
65
68
  export declare function publishEngineAgentPanelAbsence(ev: EngineAgentPanelAbsence): void;
66
- export declare function subscribeEngineAgentPanelAbsence(fn: (ev: EngineAgentPanelAbsence) => void): () => void;
67
- export declare function __resetEngineAgentPanelAbsenceForTests(): void;
@@ -1,5 +1,5 @@
1
1
  import { isNewEngineAgentPanelCycle, isStaleEngineAgentPanelEnd, panelIsResident, panelResolveTaskId, MAX_HELD_WIRE_TICK_BEATS, } from './panelReduce.js';
2
- import { clearEnginePanelIdentity, panelStateNow, resetAbsenceChannel, stepEnginePanel, subscribeAbsence, subscribeLegacyEvents, subscribeRows, resetEnginePanelHolder, } from './panelStateHolder.js';
2
+ import { clearEnginePanelIdentity, panelStateNow, stepEnginePanel, subscribeRows, resetEnginePanelHolder } from './panelStateHolder.js';
3
3
  export { isNewEngineAgentPanelCycle, isStaleEngineAgentPanelEnd, MAX_HELD_WIRE_TICK_BEATS };
4
4
  const _panelToolUsesLanePins = [true, true];
5
5
  void _panelToolUsesLanePins;
@@ -16,8 +16,8 @@ export function clearEnginePanelTaskResident(taskId) {
16
16
  export function isEnginePanelTaskResident(taskId) {
17
17
  return panelIsResident(panelStateNow(), taskId);
18
18
  }
19
- export function resolveEnginePanelTaskId(wireTaskId, parentToolCallId) {
20
- return panelResolveTaskId(panelStateNow(), wireTaskId, parentToolCallId);
19
+ export function resolveEnginePanelTaskId(wireTaskId) {
20
+ return panelResolveTaskId(panelStateNow(), wireTaskId);
21
21
  }
22
22
  export function clearEnginePanelTaskResidentByWire(wireTaskId, cycle) {
23
23
  stepEnginePanel({ kind: 'resident-clear-wire', taskId: wireTaskId, ...(cycle !== undefined ? { cycle } : {}) });
@@ -31,18 +31,9 @@ export function __resetEnginePanelStateForTests() {
31
31
  export function publishEngineAgentPanelEvent(ev) {
32
32
  stepEnginePanel(ev);
33
33
  }
34
- export function subscribeEngineAgentPanel(fn) {
35
- return subscribeLegacyEvents(fn);
36
- }
37
34
  export function subscribeEnginePanelRows(fn) {
38
35
  return subscribeRows(fn);
39
36
  }
40
37
  export function publishEngineAgentPanelAbsence(ev) {
41
38
  stepEnginePanel({ kind: 'absence', absence: ev });
42
39
  }
43
- export function subscribeEngineAgentPanelAbsence(fn) {
44
- return subscribeAbsence(fn);
45
- }
46
- export function __resetEngineAgentPanelAbsenceForTests() {
47
- resetAbsenceChannel();
48
- }
@@ -9,11 +9,7 @@ type ReaderUnreadable = {
9
9
  kind: 'unreadable';
10
10
  };
11
11
  interface EngineCapReader<R> {
12
- note(baseUrl: string, caps: unknown, opts?: {
13
- generation?: number;
14
- }): void;
15
12
  observed(baseUrl: string | undefined): R | ReaderUnobserved | ReaderUnreadable;
16
- __resetForTests(): void;
17
13
  }
18
14
  export declare function createEngineCapReader<R>(spec: EngineCapReaderSpec<R>): EngineCapReader<R>;
19
15
  export declare function unreadableReadingDetail(subject?: string): string;
@@ -15,9 +15,8 @@ function freezeReading(reading, seen = new Set()) {
15
15
  }
16
16
  const PROJECTING = Symbol('projecting');
17
17
  export function createEngineCapReader(spec) {
18
- let memo = new WeakMap();
18
+ const memo = new WeakMap();
19
19
  return {
20
- note(_baseUrl, _caps, _opts) { },
21
20
  observed(baseUrl) {
22
21
  if (typeof baseUrl !== 'string' || baseUrl === '')
23
22
  return unobserved();
@@ -48,9 +47,6 @@ export function createEngineCapReader(spec) {
48
47
  mine.set(landing, done);
49
48
  return done.reading === undefined ? unreadable() : done.reading;
50
49
  },
51
- __resetForTests() {
52
- memo = new WeakMap();
53
- },
54
50
  };
55
51
  }
56
52
  export function unreadableReadingDetail(subject) {
@@ -18,6 +18,10 @@ export declare function engineCapStateVia(baseUrl: string | undefined, key: stri
18
18
  withinMs?: number;
19
19
  signal?: AbortSignal;
20
20
  }): Promise<EngineCapState>;
21
+ export declare function engineCapValueVia(baseUrl: string | undefined, key: string, probe: (signal?: AbortSignal) => Promise<object | null | undefined>, opts?: {
22
+ withinMs?: number;
23
+ signal?: AbortSignal;
24
+ }): Promise<EngineCapValueState>;
21
25
  export declare function engineCapTrue(baseUrl: string | undefined, key: string): boolean;
22
26
  export declare function engineCapNestedTrue(baseUrl: string | undefined, parentKey: string, key: string): boolean;
23
27
  export declare function engineCapNestedValue(baseUrl: string | undefined, parentKey: string, key: string): EngineCapValueState;