@sema-agent/client-core 0.105.0 → 0.107.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 (152) hide show
  1. package/CHANGELOG.md +301 -0
  2. package/README.md +40 -21
  3. package/dist/adapt/arms.js +10 -1
  4. package/dist/adapter/activeRunSelfHeal.d.ts +21 -2
  5. package/dist/adapter/activeRunSelfHeal.js +129 -28
  6. package/dist/adapter/downstream/eventToSdkMessage.d.ts +0 -5
  7. package/dist/adapter/downstream/eventToSdkMessage.js +20 -19
  8. package/dist/adapter/downstream/terminalToSdkResult.js +2 -3
  9. package/dist/adapter/downstream/wiringManifestView.d.ts +1 -3
  10. package/dist/adapter/downstream/wiringManifestView.js +0 -1
  11. package/dist/adapter/runStream.js +3 -4
  12. package/dist/approvalReachWire.d.ts +1 -0
  13. package/dist/approvalReachWire.js +4 -1
  14. package/dist/approvalSeat.d.ts +21 -0
  15. package/dist/approvalSeat.js +73 -0
  16. package/dist/assistantInbox.d.ts +2 -0
  17. package/dist/assistantInbox.js +3 -0
  18. package/dist/checkpointRowVerdict.d.ts +29 -0
  19. package/dist/checkpointRowVerdict.js +98 -0
  20. package/dist/coreValuePorts.d.ts +12 -1
  21. package/dist/coreValuePorts.js +10 -0
  22. package/dist/decideFailureNote.js +3 -1
  23. package/dist/decideReceipt.d.ts +9 -0
  24. package/dist/decideReceipt.js +29 -1
  25. package/dist/declared/supportFloorDeclared.js +2 -2
  26. package/dist/deviceRebind.d.ts +7 -0
  27. package/dist/deviceRebind.js +39 -5
  28. package/dist/displayUntrusted.d.ts +5 -3
  29. package/dist/displayUntrusted.js +50 -41
  30. package/dist/engineAddress.d.ts +3 -0
  31. package/dist/engineAddress.js +25 -0
  32. package/dist/engineDirectory.js +9 -17
  33. package/dist/engineErrorCodes.d.ts +8 -0
  34. package/dist/engineErrorCodes.js +8 -0
  35. package/dist/engineNoticeCodes.d.ts +38 -3
  36. package/dist/engineNoticeCodes.js +167 -11
  37. package/dist/engineRowRef.js +1 -1
  38. package/dist/errorSupplementRoles.js +4 -1
  39. package/dist/eventLeg.d.ts +2 -2
  40. package/dist/eventLeg.js +2 -1
  41. package/dist/executionLaneCapability.js +3 -2
  42. package/dist/executionLaneWords.d.ts +1 -0
  43. package/dist/executionLaneWords.js +3 -0
  44. package/dist/fleet/fleetProjection.js +26 -5
  45. package/dist/generated/engineFactTables.d.ts +2 -1
  46. package/dist/generated/engineFactTables.js +3 -1
  47. package/dist/generated/engineNoticeTables.js +28 -7
  48. package/dist/generated/sdkFactTables.d.ts +3 -0
  49. package/dist/generated/sdkFactTables.js +15 -0
  50. package/dist/generated/settingsSchemaFns.d.ts +11 -0
  51. package/dist/generated/settingsSchemaFns.js +2 -1
  52. package/dist/generated/settingsSchemaSafetyMergeSpec.js +1 -1
  53. package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -1
  54. package/dist/generated/settingsSchemaSettingsSources.js +22 -2
  55. package/dist/hitl/approvalLiveFace.d.ts +17 -0
  56. package/dist/hitl/approvalLiveFace.js +35 -0
  57. package/dist/hitl/approvalQueueRow.d.ts +21 -0
  58. package/dist/hitl/approvalQueueRow.js +69 -0
  59. package/dist/hitl/approvalResolution.d.ts +5 -1
  60. package/dist/hitl/approvalResolution.js +18 -1
  61. package/dist/hitl/approvalsFeed.d.ts +5 -4
  62. package/dist/hitl/approvalsFeed.js +39 -6
  63. package/dist/hitl/askParkRowRouting.d.ts +4 -3
  64. package/dist/hitl/askParkRowRouting.js +27 -3
  65. package/dist/hitl/automaticAnswerVerdict.js +13 -10
  66. package/dist/hitl/crashConverged.d.ts +5 -1
  67. package/dist/hitl/decisionConflict.js +2 -1
  68. package/dist/hitl/decisionRefusal.js +1 -1
  69. package/dist/hitl/decisionSend.d.ts +3 -0
  70. package/dist/hitl/decisionSend.js +32 -6
  71. package/dist/hitl/frameRouter.js +4 -5
  72. package/dist/hitl/hitlBridge.d.ts +6 -2
  73. package/dist/hitl/hitlBridge.js +53 -7
  74. package/dist/hitl/livePendingAsk.d.ts +5 -0
  75. package/dist/hitl/livePendingAsk.js +10 -3
  76. package/dist/hitl/parkOwnership.js +4 -5
  77. package/dist/hitl/parkResolver.js +9 -5
  78. package/dist/hitl/parkRowBirthWait.d.ts +7 -0
  79. package/dist/hitl/parkRowBirthWait.js +1 -1
  80. package/dist/hitl/parkRowDelegation.d.ts +6 -0
  81. package/dist/hitl/parkRowDelegation.js +33 -0
  82. package/dist/hitl/persistedRulesWire.d.ts +15 -3
  83. package/dist/hitl/persistedRulesWire.js +102 -20
  84. package/dist/hitl/planReviewCard.d.ts +2 -0
  85. package/dist/hitl/planReviewCard.js +21 -0
  86. package/dist/hitl/planReviewWire.d.ts +2 -2
  87. package/dist/hitl/planReviewWire.js +105 -38
  88. package/dist/hitl/sessionAllowRoute.d.ts +7 -0
  89. package/dist/hitl/sessionAllowRoute.js +49 -0
  90. package/dist/hitl/sessionPolicyWire.d.ts +1 -7
  91. package/dist/hitl/sessionPolicyWire.js +3 -43
  92. package/dist/hitl/standingRows.js +10 -10
  93. package/dist/hitl/subagentSource.d.ts +1 -0
  94. package/dist/hitl/subagentSource.js +13 -0
  95. package/dist/hitl/toolApprovalWire.d.ts +3 -2
  96. package/dist/hitl/toolApprovalWire.js +100 -44
  97. package/dist/hostSettingsSource.d.ts +4 -1
  98. package/dist/hostSettingsSource.js +11 -6
  99. package/dist/hostTurnSettings.d.ts +4 -5
  100. package/dist/hostTurnSettings.js +80 -19
  101. package/dist/i18n/messages.en.d.ts +41 -12
  102. package/dist/i18n/messages.en.js +42 -13
  103. package/dist/i18n/messages.zh.js +45 -13
  104. package/dist/index.d.ts +22 -2
  105. package/dist/index.js +12 -2
  106. package/dist/injectionLaneNotice.js +2 -1
  107. package/dist/liveInitToolFace.js +0 -1
  108. package/dist/liveModelCatalog.d.ts +15 -0
  109. package/dist/liveModelCatalog.js +40 -0
  110. package/dist/mcpWireCaps.js +1 -1
  111. package/dist/modelCapabilityProbe.js +66 -33
  112. package/dist/noticePresentation.js +2 -0
  113. package/dist/ownKey.d.ts +0 -1
  114. package/dist/ownKey.js +0 -2
  115. package/dist/permissionsDeclaration.d.ts +2 -2
  116. package/dist/permissionsDeclaration.js +12 -14
  117. package/dist/projectSeed.d.ts +39 -0
  118. package/dist/projectSeed.js +80 -0
  119. package/dist/promptDelivery.js +1 -1
  120. package/dist/replayBody.d.ts +7 -6
  121. package/dist/replayBody.js +62 -7
  122. package/dist/request/taskRequest.js +3 -4
  123. package/dist/ruleCompileVerdict.d.ts +0 -2
  124. package/dist/ruleCompileVerdict.js +0 -31
  125. package/dist/ruleRefusalSentence.js +0 -3
  126. package/dist/runReattachPolicy.d.ts +3 -0
  127. package/dist/runReattachPolicy.js +15 -2
  128. package/dist/runTerminal.js +30 -8
  129. package/dist/sandboxWire.d.ts +0 -3
  130. package/dist/sandboxWire.js +0 -9
  131. package/dist/sdkWireTransit.d.ts +1 -1
  132. package/dist/seam.d.ts +14 -7
  133. package/dist/seam.js +12 -0
  134. package/dist/seatContract.d.ts +58 -7
  135. package/dist/seatContract.js +135 -4
  136. package/dist/serverSupportRange.d.ts +18 -0
  137. package/dist/serverSupportRange.js +25 -0
  138. package/dist/sessionEngine.d.ts +156 -0
  139. package/dist/sessionEngine.js +464 -0
  140. package/dist/sessionMap.d.ts +11 -1
  141. package/dist/sessionMap.js +35 -9
  142. package/dist/sessionMemorySync.d.ts +31 -0
  143. package/dist/sessionMemorySync.js +95 -0
  144. package/dist/sessionRowTag.d.ts +4 -0
  145. package/dist/sessionRowTag.js +18 -0
  146. package/dist/settingsLayerAdmission.d.ts +1 -0
  147. package/dist/settingsLayerAdmission.js +4 -1
  148. package/dist/toolResult.js +1 -1
  149. package/dist/wireRefusalCopy.d.ts +6 -1
  150. package/dist/wireRefusalCopy.js +9 -7
  151. package/docs/INTEGRATION-CLIENTS.md +1393 -18
  152. package/package.json +5 -5
@@ -957,13 +957,14 @@ function hiddenHostEnd(text, from, unitAt) {
957
957
  const c = text.charCodeAt(k);
958
958
  return endsSchemelessHost(c) || c === 0x40 ? k : -1;
959
959
  }
960
+ const IDEOGRAPHIC_SPACE = 0x3000;
960
961
  const NAME_BLANK_RANGES = [
961
962
  [0x00a0, 0x00a0],
962
963
  [0x1680, 0x1680],
963
964
  [0x2000, 0x200a],
964
965
  [0x202f, 0x202f],
965
966
  [0x205f, 0x205f],
966
- [0x3000, 0x3000],
967
+ [IDEOGRAPHIC_SPACE, IDEOGRAPHIC_SPACE],
967
968
  [0x115f, 0x1160],
968
969
  [0x3164, 0x3164],
969
970
  [0xffa0, 0xffa0],
@@ -3593,7 +3594,7 @@ const FACE_MARKED_CHAR = new RegExp(`^(?:[${C0_ALL}${DEL_C1}${LONE_SURROGATE}${L
3593
3594
  const isStrippableControl = (c) => (c <= 0x1f && (c < 0x09 || c > 0x0d)) || (c >= 0x7f && c <= 0x9f);
3594
3595
  class SequenceReader {
3595
3596
  text;
3596
- atomicBlanks;
3597
+ blanks;
3597
3598
  foldBlanks;
3598
3599
  terminator;
3599
3600
  lineBreak;
@@ -3602,9 +3603,9 @@ class SequenceReader {
3602
3603
  breakFrom = -1;
3603
3604
  breakAt = -1;
3604
3605
  foldSpaces;
3605
- constructor(text, atomicBlanks, foldBlanks = false, foldSpaces = false) {
3606
+ constructor(text, blanks, foldBlanks = false, foldSpaces = false) {
3606
3607
  this.text = text;
3607
- this.atomicBlanks = atomicBlanks;
3608
+ this.blanks = blanks;
3608
3609
  this.foldBlanks = foldBlanks;
3609
3610
  this.foldSpaces = foldSpaces;
3610
3611
  this.terminator = /[\u0007\u009c]|\u001b\\|\\u(?:0007|009[cC]|001[bB]\\)/g;
@@ -3615,12 +3616,7 @@ class SequenceReader {
3615
3616
  return false;
3616
3617
  if (escapeTokenAt(this.text, at) !== null)
3617
3618
  return true;
3618
- if (this.atomicBlanks === 'none')
3619
- return false;
3620
- const cp = nameBlankTokenAt(this.text, at);
3621
- if (this.atomicBlanks === 'fillers')
3622
- return cp !== -1 && !isFoldedBlank(cp);
3623
- return this.atomicBlanks === 'all' ? cp !== -1 : isFoldedBlank(cp);
3619
+ return isMarkedNameBlank(this.blanks, nameBlankTokenAt(this.text, at));
3624
3620
  }
3625
3621
  intermediateAt(at) {
3626
3622
  const c = this.text.charCodeAt(at);
@@ -3628,11 +3624,12 @@ class SequenceReader {
3628
3624
  return 1;
3629
3625
  if (this.foldSpaces && ((c >= 0x09 && c <= 0x0d) || c === 0x2028 || c === 0x2029))
3630
3626
  return 1;
3631
- if (!this.foldBlanks)
3632
- return 0;
3633
- if (isFoldedBlank(c))
3627
+ if (this.blankAsSpace(c))
3634
3628
  return 1;
3635
- return c === 0x5c && isFoldedBlank(nameBlankTokenAt(this.text, at)) ? 6 : 0;
3629
+ return c === 0x5c && this.blankAsSpace(nameBlankTokenAt(this.text, at)) ? 6 : 0;
3630
+ }
3631
+ blankAsSpace(cp) {
3632
+ return isFoldedBlank(cp) && (this.foldBlanks || isMarkedNameBlank(this.blanks, cp));
3636
3633
  }
3637
3634
  interruptsAt(at) {
3638
3635
  if (at >= this.text.length)
@@ -3738,7 +3735,7 @@ function nameBlankTokenAt(text, at) {
3738
3735
  return isNameBlank(cp) ? cp : -1;
3739
3736
  }
3740
3737
  function isMarkedNameBlank(net, c) {
3741
- return net === 1 ? isNameBlank(c) : net === 2 ? isNameBlank(c) && !isRegexSpace(c) : false;
3738
+ return net === 1 ? isNameBlank(c) : net === 2 ? isNameBlank(c) && c !== IDEOGRAPHIC_SPACE : false;
3742
3739
  }
3743
3740
  function buildScanView(text, o) {
3744
3741
  const chars = [];
@@ -3748,7 +3745,7 @@ function buildScanView(text, o) {
3748
3745
  const dropped = [];
3749
3746
  const spaceUnits = [];
3750
3747
  const contents = [];
3751
- const seq = new SequenceReader(text, o.blanks === 1 ? 'all' : o.blanks === 2 ? 'fillers' : 'none', o.blanks === 1 || o.fold, o.fold);
3748
+ const seq = new SequenceReader(text, o.blanks, o.fold, o.fold);
3752
3749
  const keep = (ch, s, e, unit = UNIT_NONE) => {
3753
3750
  chars.push(ch);
3754
3751
  starts.push(s);
@@ -3945,7 +3942,7 @@ function screenSurfaces(text, o) {
3945
3942
  if (face === null)
3946
3943
  return { surfaces: [], rawSoft: null, rawPlain: null, contents: [] };
3947
3944
  const unsafe = face.unsafe === null ? null : new RegExp(face.unsafe.source, 'u');
3948
- const keepBlanks = face.keepBlanks === true;
3945
+ const blankNet = face.blanks ?? 0;
3949
3946
  const chars = [];
3950
3947
  const ps = [];
3951
3948
  const pe = [];
@@ -3955,7 +3952,7 @@ function screenSurfaces(text, o) {
3955
3952
  let changed = false;
3956
3953
  const foldable = (at) => {
3957
3954
  const c = text.codePointAt(at) ?? 0;
3958
- return isRegexSpace(c) && !(keepBlanks && isNameBlank(c));
3955
+ return isRegexSpace(c) && !isMarkedNameBlank(blankNet, c);
3959
3956
  };
3960
3957
  let lo = 0;
3961
3958
  let hi = text.length;
@@ -4648,7 +4645,7 @@ export function washCredentials(text) {
4648
4645
  return scanAndMask(text, WASH_OPTIONS, false).text;
4649
4646
  }
4650
4647
  const NAME_BLANKS = NAME_BLANK_RANGES.map(([a, b]) => (a === b ? classEscape(a) : `${classEscape(a)}-${classEscape(b)}`)).join('');
4651
- const NAME_FILLERS = NAME_BLANK_RANGES.filter(([a, b]) => !isRegexSpace(a) && !isRegexSpace(b))
4648
+ const NAME_BLANKS_EXCEPT_IDEOGRAPHIC = NAME_BLANK_RANGES.filter(([a, b]) => !(a <= IDEOGRAPHIC_SPACE && IDEOGRAPHIC_SPACE <= b))
4652
4649
  .map(([a, b]) => (a === b ? classEscape(a) : `${classEscape(a)}-${classEscape(b)}`))
4653
4650
  .join('');
4654
4651
  function classEscape(cp) {
@@ -4777,17 +4774,17 @@ function markOf(ch, mark) {
4777
4774
  return code > 0xffff ? `\\u{${hex}}` : `\\u${hex.padStart(4, '0')}`;
4778
4775
  }
4779
4776
  const FOLD_RUN = /\s+/g;
4780
- const FOLD_RUN_KEEPING_BLANKS = new RegExp(`[^\\S${NAME_BLANKS}]+`, 'g');
4777
+ const FOLD_RUN_BY_NET = [FOLD_RUN, new RegExp(`[^\\S${NAME_BLANKS}]+`, 'g'), new RegExp(`[^\\S${NAME_BLANKS_EXCEPT_IDEOGRAPHIC}]+`, 'g')];
4781
4778
  const EDGE_SPACE = /^ | $/g;
4782
- const foldWhitespace = (s, keepBlanks = false) => keepBlanks ? s.replace(FOLD_RUN_KEEPING_BLANKS, ' ').replace(EDGE_SPACE, '') : s.replace(FOLD_RUN, ' ').trim();
4779
+ const foldWhitespace = (s, net = 0) => net !== 0 ? s.replace(FOLD_RUN_BY_NET[net] ?? FOLD_RUN, ' ').replace(EDGE_SPACE, '') : s.replace(FOLD_RUN, ' ').trim();
4783
4780
  export function applyDisplayFace(text, face) {
4784
4781
  const markAll = (s) => face.unsafe === null ? s : s.replace(face.unsafe, (ch, at, whole) => (faceHitKept(ch, at, whole, face.keepCrlf === true) ? ch : markOf(ch, face.mark)));
4785
- const keepBlanks = face.keepBlanks === true;
4782
+ const net = face.blanks ?? 0;
4786
4783
  if (face.mark === 'space') {
4787
4784
  const marked = markAll(text);
4788
- return face.fold ? foldWhitespace(marked, keepBlanks) : marked;
4785
+ return face.fold ? foldWhitespace(marked, net) : marked;
4789
4786
  }
4790
- return markAll(face.fold ? foldWhitespace(text, keepBlanks) : text);
4787
+ return markAll(face.fold ? foldWhitespace(text, net) : text);
4791
4788
  }
4792
4789
  function markTracked(t, re, mark, ledger, crlf = false) {
4793
4790
  const parts = [];
@@ -4820,11 +4817,11 @@ function markTracked(t, re, mark, ledger, crlf = false) {
4820
4817
  keep(cursor, t.text.length);
4821
4818
  return { text: parts.join(''), ids: Int32Array.from(ids) };
4822
4819
  }
4823
- function foldTracked(t, keepBlanks) {
4820
+ function foldTracked(t, net) {
4824
4821
  const parts = [];
4825
4822
  const ids = [];
4826
4823
  let cursor = 0;
4827
- for (const run of t.text.matchAll(keepBlanks ? FOLD_RUN_KEEPING_BLANKS : FOLD_RUN)) {
4824
+ for (const run of t.text.matchAll(FOLD_RUN_BY_NET[net] ?? FOLD_RUN)) {
4828
4825
  const at = run.index ?? 0;
4829
4826
  parts.push(t.text.slice(cursor, at));
4830
4827
  for (let k = cursor; k < at; k++)
@@ -4849,14 +4846,14 @@ function foldTracked(t, keepBlanks) {
4849
4846
  return { text: folded.slice(from, to), ids: Int32Array.from(ids.slice(from, to)) };
4850
4847
  }
4851
4848
  function faceTracked(t, face, ledger) {
4852
- const keepBlanks = face.keepBlanks === true;
4849
+ const net = face.blanks ?? 0;
4853
4850
  const unsafe = face.unsafe;
4854
4851
  const markAll = (x) => (unsafe === null ? x : markTracked(x, unsafe, face.mark, ledger, face.keepCrlf === true));
4855
4852
  if (face.mark === 'space') {
4856
4853
  const marked = markAll(t);
4857
- return face.fold ? foldTracked(marked, keepBlanks) : marked;
4854
+ return face.fold ? foldTracked(marked, net) : marked;
4858
4855
  }
4859
- return markAll(face.fold ? foldTracked(t, keepBlanks) : t);
4856
+ return markAll(face.fold ? foldTracked(t, net) : t);
4860
4857
  }
4861
4858
  function carryIds(ids, origin) {
4862
4859
  if (origin === undefined)
@@ -4933,7 +4930,7 @@ function collectMarks(t, ledger) {
4933
4930
  export const DISPLAY_DECISION_BODY = Object.freeze({
4934
4931
  foldLines: false,
4935
4932
  keepLayout: 'crlf',
4936
- blanks: 'fillers',
4933
+ blanks: 'except-ideographic',
4937
4934
  mark: 'escape',
4938
4935
  });
4939
4936
  const PUBLIC_UNSAFE_BY_NETS = Object.freeze(Array.from({ length: 24 }, (_, i) => {
@@ -4942,12 +4939,12 @@ const PUBLIC_UNSAFE_BY_NETS = Object.freeze(Array.from({ length: 24 }, (_, i) =>
4942
4939
  const controls = (rest & 4) !== 0;
4943
4940
  const bidi = (rest & 2) !== 0;
4944
4941
  const keep = (rest & 1) !== 0;
4945
- const blanks = net === 1 ? NAME_BLANKS : net === 2 ? NAME_FILLERS : '';
4942
+ const blanks = net === 1 ? NAME_BLANKS : net === 2 ? NAME_BLANKS_EXCEPT_IDEOGRAPHIC : '';
4946
4943
  const members = `${controls ? `${keep ? C0_KEEP_LAYOUT : C0_ALL}${DEL_C1}${LONE_SURROGATE}` : ''}${bidi ? LINE_SEPARATORS : ''}${blanks}`;
4947
4944
  return unsafeClass(members, bidi);
4948
4945
  }));
4949
4946
  function blankNetOf(opts) {
4950
- return opts.blanks === true ? 1 : opts.blanks === 'fillers' ? 2 : 0;
4947
+ return opts.blanks === true ? 1 : opts.blanks === 'except-ideographic' ? 2 : 0;
4951
4948
  }
4952
4949
  const keepsLayout = (opts) => opts.keepLayout === true || opts.keepLayout === 'crlf';
4953
4950
  function publicFace(opts) {
@@ -4955,7 +4952,7 @@ function publicFace(opts) {
4955
4952
  const keep = !fold && keepsLayout(opts);
4956
4953
  const net = blankNetOf(opts);
4957
4954
  const index = ((opts.controls !== false ? 4 : 0) + (opts.bidi !== false ? 2 : 0) + (keep ? 1 : 0)) * 3 + net;
4958
- const face = { unsafe: PUBLIC_UNSAFE_BY_NETS[index] ?? null, fold, mark: opts.mark ?? 'escape', keepBlanks: net === 1 };
4955
+ const face = { unsafe: PUBLIC_UNSAFE_BY_NETS[index] ?? null, fold, mark: opts.mark ?? 'escape', blanks: net };
4959
4956
  return keep && opts.keepLayout === 'crlf' && opts.controls !== false ? { ...face, keepCrlf: true } : face;
4960
4957
  }
4961
4958
  export const ESCAPE_FACE = Object.freeze({ ...publicFace({ foldLines: false }) });
@@ -5074,13 +5071,22 @@ function displayInputText(text) {
5074
5071
  return text === null ? '' : REDACTED_SECRET;
5075
5072
  }
5076
5073
  }
5074
+ const ENCODED_FORM = /\\\\|\\u(?:[0-9A-Fa-f]{4}|\{[0-9A-Fa-f]{1,6}\})/;
5075
+ function pairsByItself(form) {
5076
+ return ENCODED_FORM.test(form.text);
5077
+ }
5078
+ function pairModeOf(o, face) {
5079
+ if (face.mark === 'dot' || face.mark === 'space')
5080
+ return 'off';
5081
+ return o.escapeBackslashes === true ? 'on' : o.escapeBackslashes === 'auto' ? 'auto' : 'off';
5082
+ }
5077
5083
  function renderUntrusted(text, opts, ledger, queryByShape = false, wholeAddress = false) {
5078
5084
  const input = displayInputText(text);
5079
5085
  const o = opts ?? {};
5080
5086
  const face = publicFace(o);
5081
5087
  const scan = scanOptionsOf(o, face, queryByShape, wholeAddress);
5082
- const pairBackslashes = o.escapeBackslashes === true && face.mark !== 'dot' && face.mark !== 'space';
5083
- const book = ledger ?? (pairBackslashes ? { cps: [], lens: [] } : null);
5088
+ const mode = pairModeOf(o, face);
5089
+ const book = ledger ?? (mode !== 'off' ? { cps: [], lens: [] } : null);
5084
5090
  if (book === null) {
5085
5091
  return runDisplaySteps(input, {
5086
5092
  wash: (s) => scanAndMask(s, scan, false).text,
@@ -5089,6 +5095,7 @@ function renderUntrusted(text, opts, ledger, queryByShape = false, wholeAddress
5089
5095
  text: (s) => s,
5090
5096
  });
5091
5097
  }
5098
+ let paired = mode === 'on';
5092
5099
  const out = runDisplaySteps({ text: input, ids: new Int32Array(input.length).fill(-1) }, {
5093
5100
  wash: (t) => {
5094
5101
  const r = scanAndMask(t.text, scan, true);
@@ -5096,18 +5103,20 @@ function renderUntrusted(text, opts, ledger, queryByShape = false, wholeAddress
5096
5103
  },
5097
5104
  paint: (t) => faceTracked(t, face, book),
5098
5105
  cap: (t) => {
5099
- if (pairBackslashes)
5106
+ if (mode === 'auto' && !paired)
5107
+ paired = pairsByItself(t);
5108
+ if (paired)
5100
5109
  return capPaired(t, o.max);
5101
5110
  const cut = capDisplay(t.text, o.max, face.mark);
5102
5111
  return cut === t.text ? t : { text: cut, ids: t.ids.slice(0, cut.length) };
5103
5112
  },
5104
5113
  text: (t) => t.text,
5105
5114
  });
5106
- return pairBackslashes ? pairLiteralBackslashes(out) : out;
5115
+ return { tracked: paired ? pairLiteralBackslashes(out) : out, exact: paired };
5107
5116
  }
5108
5117
  export function displayUntrusted(text, opts = {}) {
5109
5118
  const out = renderUntrusted(text, opts, null);
5110
- return typeof out === 'string' ? out : out.text;
5119
+ return typeof out === 'string' ? out : out.tracked.text;
5111
5120
  }
5112
5121
  export function cleanUntrustedScalar(v) {
5113
5122
  return displayUntrusted(String(v ?? ''), { credentialUrls: false, credentialWords: false, foldLines: false });
@@ -5354,7 +5363,7 @@ export function queryCarriesCredential(query) {
5354
5363
  export function displayConfiguredUrl(url, opts = {}) {
5355
5364
  const reading = typeof url === 'string' ? configuredAddressReading(url) : null;
5356
5365
  const out = renderUntrusted(reading === null ? url : reading.withheld ? REDACTED_SECRET : reading.text, opts, null, 'relaxed', true);
5357
- return typeof out === 'string' ? out : out.text;
5366
+ return typeof out === 'string' ? out : out.tracked.text;
5358
5367
  }
5359
5368
  function parserViewOf(url) {
5360
5369
  return url.replace(/[\t\n\r]/g, '').replace(/^[\u0000-\u0020]+/, '');
@@ -5773,7 +5782,7 @@ export function displayUntrustedMarks(text, opts = {}) {
5773
5782
  const ledger = { cps: [], lens: [] };
5774
5783
  const out = renderUntrusted(text, opts, ledger);
5775
5784
  if (typeof out === 'string')
5776
- return { text: out, marks: [] };
5777
- return { text: out.text, marks: collectMarks(out, ledger) };
5785
+ return { text: out, marks: [], exact: false };
5786
+ return { text: out.tracked.text, marks: collectMarks(out.tracked, ledger), exact: out.exact };
5778
5787
  }
5779
5788
  const isQuoteChar = (c) => c.charCodeAt(0) === 0x22 || c.charCodeAt(0) === 0x27;
@@ -0,0 +1,3 @@
1
+ export declare function tupleOriginUrlOf(raw: string): URL | undefined;
2
+ export declare function carriesNoCredentialSlots(u: URL): boolean;
3
+ export declare function isCenterRelativePath(path: string): boolean;
@@ -0,0 +1,25 @@
1
+ export function tupleOriginUrlOf(raw) {
2
+ try {
3
+ const u = new URL(raw);
4
+ return /^(?:https?|wss?|ftp):$/.test(u.protocol) ? u : undefined;
5
+ }
6
+ catch {
7
+ return undefined;
8
+ }
9
+ }
10
+ export function carriesNoCredentialSlots(u) {
11
+ return u.username === '' && u.password === '' && u.search === '' && u.hash === '';
12
+ }
13
+ export function isCenterRelativePath(path) {
14
+ if (path.length === 0 || path.charCodeAt(0) !== 0x2f)
15
+ return false;
16
+ const second = path.charCodeAt(1);
17
+ if (second === 0x2f || second === 0x5c)
18
+ return false;
19
+ if (/[\s\u0000-\u001f\u007f-\u009f\\?#]/u.test(path))
20
+ return false;
21
+ return path.split('/').every((segment) => {
22
+ const decoded = segment.replace(/%2e/gi, '.');
23
+ return decoded !== '.' && decoded !== '..';
24
+ });
25
+ }
@@ -1,21 +1,9 @@
1
1
  import { guardedRead, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
2
+ import { isCenterRelativePath } from './engineAddress.js';
2
3
  const KIND_WORDS = ['managed'];
3
4
  const POSTURE_WORDS = ['single', 'multi'];
4
5
  const RULE_WORDS = ['only-one', 'none', 'ambiguous'];
5
6
  const UNREADABLE = Object.freeze({ kind: 'unreadable' });
6
- function isCenterRelativePath(path) {
7
- if (path.length === 0 || path.charCodeAt(0) !== 0x2f)
8
- return false;
9
- const second = path.charCodeAt(1);
10
- if (second === 0x2f || second === 0x5c)
11
- return false;
12
- if (/[\s\u0000-\u001f\u007f-\u009f\\?#]/u.test(path))
13
- return false;
14
- return path.split('/').every((segment) => {
15
- const decoded = segment.replace(/%2e/gi, '.');
16
- return decoded !== '.' && decoded !== '..';
17
- });
18
- }
19
7
  function isObj(v) {
20
8
  return typeof v === 'object' && v !== null && !Array.isArray(v);
21
9
  }
@@ -123,6 +111,9 @@ export function projectMeEngine(body) {
123
111
  return undefined;
124
112
  }
125
113
  }
114
+ function sameNameCount(set, name) {
115
+ return set.rows.filter((row) => row.name === name).length + set.unreadableNames.filter((n) => n === name).length;
116
+ }
126
117
  export function decideMeEngine(reading) {
127
118
  try {
128
119
  if (reading === undefined)
@@ -139,7 +130,9 @@ export function decideMeEngine(reading) {
139
130
  if (candidates === undefined)
140
131
  return unresolved('candidates');
141
132
  const picked = target.row;
142
- if (!candidates.rows.some((row) => row.name === picked.name && row.viaCenter === picked.viaCenter))
133
+ if (!candidates.rows.some((row) => row.name === picked.name && row.viaCenter === picked.viaCenter && row.scope === picked.scope))
134
+ return unresolved('conflict');
135
+ if (sameNameCount(candidates, picked.name) > 1)
143
136
  return unresolved('conflict');
144
137
  if (rule.kind === 'listed' && (candidates.rows.length !== 1 || candidates.unreadableRows !== 0))
145
138
  return unresolved('conflict');
@@ -171,12 +164,11 @@ export function engineOverrideOf(set, requested) {
171
164
  if (set === undefined)
172
165
  return { kind: 'unreadable' };
173
166
  const hits = set.rows.filter((row) => row.name === requested);
174
- const hidden = set.unreadableNames.filter((name) => name === requested).length;
175
- if (hits.length + hidden > 1)
167
+ if (sameNameCount(set, requested) > 1)
176
168
  return { kind: 'duplicate', name: requested };
177
169
  if (hits.length === 1)
178
170
  return { kind: 'select', engine: hits[0] };
179
- if (hidden === 1)
171
+ if (set.unreadableNames.some((name) => name === requested))
180
172
  return { kind: 'row-unreadable', name: requested };
181
173
  return { kind: 'not-listed', candidates: set };
182
174
  }
@@ -8,6 +8,7 @@ export declare const LIMITS_MAX_WALLTIME_EXCEEDED = "limits.max_walltime_exceede
8
8
  export declare function isLimitsExceededCode(code: string | undefined): boolean;
9
9
  export declare const USAGE_WINDOW_EXHAUSTED = "usage.window_exhausted";
10
10
  export declare const ENV_LIFETIME_EXPIRED = "env.lifetime_expired";
11
+ export declare const ENV_HOME_UNCONFIRMED = "env.home_unconfirmed";
11
12
  export declare const FLEET_LEASE_UNAVAILABLE = "fleet.lease_unavailable";
12
13
  export declare const CONFIG_LIMIT_INVALID = "config.limit_invalid";
13
14
  export declare const CONFIG_LIMIT_UNKNOWN_KEY = "config.limit_unknown_key";
@@ -42,6 +43,12 @@ export declare const CAPABILITY_IMAGE_INDEX_REQUIRED = "capability.image_index_r
42
43
  export declare const CAPABILITY_K8S_LANE_REQUIRED = "capability.k8s_lane_required";
43
44
  export declare const NOT_FOUND_IMAGE = "not_found.image";
44
45
  export declare const REQUEST_PRECONDITION_UNMET = "request.precondition_unmet";
46
+ export declare const ATTACHMENT_BUNDLE_INVALID = "attachment.bundle_invalid";
47
+ export declare const ATTACHMENT_BUNDLE_LANE_NOT_ISOLATED = "attachment.bundle_lane_not_isolated";
48
+ export declare const ATTACHMENT_BUNDLE_SEED_FIXED = "attachment.bundle_seed_fixed";
49
+ export declare const ATTACHMENT_BOUND_ELSEWHERE = "attachment.bound_elsewhere";
50
+ export declare const CONFLICT_SESSION_MEMORY_UNOBSERVED = "conflict.session_memory_unobserved";
51
+ export declare const CONFLICT_SESSION_ARCHIVE_STAMPED = "conflict.session_archive_stamped";
45
52
  export declare const GATE_PARKED_ERROR_CODE = "gate.parked";
46
53
  export declare const ACTIVE_RUN_BUSY_ERROR_CODE = "conflict.session_active_run";
47
54
  export declare const CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH = "conflict.idempotency_payload_mismatch";
@@ -114,6 +121,7 @@ export declare function isDecideParkMovedCode(code: string | null | undefined):
114
121
  export declare const DECIDE_ROW_UNREVIVABLE = "decide.row_unrevivable";
115
122
  export declare function isDecideRowUnrevivableCode(code: string | null | undefined): boolean;
116
123
  export declare const APPROVAL_STALE = "approval_stale";
124
+ export declare const DECIDE_REQUIRES_BINDING = "decide_requires_binding";
117
125
  export declare const APPROVAL_BINDING_MISMATCH = "approval_binding_mismatch";
118
126
  export declare const CHECKPOINT_INVALID_OUTCOME = "checkpoint.invalid_outcome";
119
127
  export declare const RESUME_OUTCOME_INVALID = "resume_outcome_invalid";
@@ -11,6 +11,7 @@ export function isLimitsExceededCode(code) {
11
11
  }
12
12
  export const USAGE_WINDOW_EXHAUSTED = 'usage.window_exhausted';
13
13
  export const ENV_LIFETIME_EXPIRED = 'env.lifetime_expired';
14
+ export const ENV_HOME_UNCONFIRMED = 'env.home_unconfirmed';
14
15
  export const FLEET_LEASE_UNAVAILABLE = 'fleet.lease_unavailable';
15
16
  export const CONFIG_LIMIT_INVALID = 'config.limit_invalid';
16
17
  export const CONFIG_LIMIT_UNKNOWN_KEY = 'config.limit_unknown_key';
@@ -66,6 +67,12 @@ export const CAPABILITY_IMAGE_INDEX_REQUIRED = 'capability.image_index_required'
66
67
  export const CAPABILITY_K8S_LANE_REQUIRED = 'capability.k8s_lane_required';
67
68
  export const NOT_FOUND_IMAGE = 'not_found.image';
68
69
  export const REQUEST_PRECONDITION_UNMET = 'request.precondition_unmet';
70
+ export const ATTACHMENT_BUNDLE_INVALID = 'attachment.bundle_invalid';
71
+ export const ATTACHMENT_BUNDLE_LANE_NOT_ISOLATED = 'attachment.bundle_lane_not_isolated';
72
+ export const ATTACHMENT_BUNDLE_SEED_FIXED = 'attachment.bundle_seed_fixed';
73
+ export const ATTACHMENT_BOUND_ELSEWHERE = 'attachment.bound_elsewhere';
74
+ export const CONFLICT_SESSION_MEMORY_UNOBSERVED = 'conflict.session_memory_unobserved';
75
+ export const CONFLICT_SESSION_ARCHIVE_STAMPED = 'conflict.session_archive_stamped';
69
76
  export const GATE_PARKED_ERROR_CODE = 'gate.parked';
70
77
  export const ACTIVE_RUN_BUSY_ERROR_CODE = 'conflict.session_active_run';
71
78
  export const CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH = 'conflict.idempotency_payload_mismatch';
@@ -214,6 +221,7 @@ export function isDecideRowUnrevivableCode(code) {
214
221
  return typeof code === 'string' && code === DECIDE_ROW_UNREVIVABLE;
215
222
  }
216
223
  export const APPROVAL_STALE = 'approval_stale';
224
+ export const DECIDE_REQUIRES_BINDING = 'decide_requires_binding';
217
225
  export const APPROVAL_BINDING_MISMATCH = 'approval_binding_mismatch';
218
226
  export const CHECKPOINT_INVALID_OUTCOME = 'checkpoint.invalid_outcome';
219
227
  export const RESUME_OUTCOME_INVALID = 'resume_outcome_invalid';
@@ -197,8 +197,19 @@ export interface UserInputUndrainedFactsView {
197
197
  sessionId?: string;
198
198
  runId?: string;
199
199
  childSessionId?: string;
200
+ inputIds?: readonly string[];
200
201
  }
201
202
  export declare function readUserInputUndrained(notice: unknown): UserInputUndrainedFactsView | undefined;
203
+ export interface UndrainedInputsLedger {
204
+ readonly handed?: readonly string[];
205
+ readonly redelivered?: readonly string[];
206
+ }
207
+ export interface UndrainedInputsVerdict {
208
+ readonly redeliver: readonly string[];
209
+ readonly askUser: readonly string[];
210
+ readonly unattributed: number;
211
+ }
212
+ export declare function undrainedInputsVerdict(facts: Pick<UserInputUndrainedFactsView, 'count' | 'cause' | 'inputIds' | 'childSessionId'> | null | undefined, ledger: UndrainedInputsLedger | null | undefined): UndrainedInputsVerdict | undefined;
202
213
  export declare function userInputUndrainedNotice(facts: Pick<UserInputUndrainedFactsView, 'kind' | 'count' | 'cause' | 'childSessionId'>): string | undefined;
203
214
  export interface TurnInterruptedFactsView {
204
215
  lane: 'input_now' | 'user_halt' | 'unrecognized';
@@ -223,12 +234,14 @@ export interface StreamEndIgnoredFactsView {
223
234
  runId: string;
224
235
  }
225
236
  export declare function readStreamEndIgnored(notice: unknown): StreamEndIgnoredFactsView | undefined;
226
- export interface ContextImageRemovedFactsView {
237
+ export interface ContextMediaRemovedFactsView {
238
+ reason: string;
227
239
  images: number;
240
+ documents: number;
228
241
  sessionId: string;
229
242
  runId: string;
230
243
  }
231
- export declare function readContextImageRemoved(notice: {} | null | undefined): ContextImageRemovedFactsView | undefined;
244
+ export declare function readContextMediaRemoved(notice: {} | null | undefined): ContextMediaRemovedFactsView | undefined;
232
245
  export interface McpAuthorizationRequiredFactsView {
233
246
  server: string;
234
247
  reason: string;
@@ -237,6 +250,26 @@ export interface McpAuthorizationRequiredFactsView {
237
250
  runId: string;
238
251
  }
239
252
  export declare function readMcpAuthorizationRequired(notice: {} | null | undefined): McpAuthorizationRequiredFactsView | undefined;
253
+ interface SessionLineageRerootedCommon {
254
+ recordsDropped: NoticeCountReading;
255
+ recordsTotal: NoticeCountReading;
256
+ entriesOnPath: NoticeCountReading;
257
+ sessionId: string;
258
+ runId: string;
259
+ }
260
+ interface SessionLineageRerootedWhole extends SessionLineageRerootedCommon {
261
+ break: false;
262
+ leaf: string | null;
263
+ }
264
+ interface SessionLineageRerootedBroken extends SessionLineageRerootedCommon {
265
+ break: true;
266
+ leaf: string;
267
+ missingParentId: string;
268
+ rootedAt: string;
269
+ entriesCut: NoticeCountReading;
270
+ }
271
+ export type SessionLineageRerootedFactsView = SessionLineageRerootedWhole | SessionLineageRerootedBroken;
272
+ export declare function readSessionLineageRerooted(notice: {} | null | undefined): SessionLineageRerootedFactsView | undefined;
240
273
  export declare const ENGINE_NOTICE_FACT_READERS: Readonly<{
241
274
  readonly 'mcp.injection_dropped': typeof readMcpInjectionDrop;
242
275
  readonly 'delegation.ask_unresolvable': typeof readAskUnresolvable;
@@ -261,8 +294,10 @@ export declare const ENGINE_NOTICE_FACT_READERS: Readonly<{
261
294
  readonly 'task.turn_interrupted': typeof readTurnInterrupted;
262
295
  readonly 'route.finish_reason_unknown': typeof readFinishReasonUnknown;
263
296
  readonly 'route.stream_end_ignored': typeof readStreamEndIgnored;
264
- readonly 'context.image_removed': typeof readContextImageRemoved;
265
297
  readonly 'mcp.authorization_required': typeof readMcpAuthorizationRequired;
298
+ readonly 'context.media_removed': typeof readContextMediaRemoved;
299
+ readonly 'context.image_removed': typeof readContextMediaRemoved;
300
+ readonly 'session.lineage_rerooted': typeof readSessionLineageRerooted;
266
301
  }>;
267
302
  type FactReaderTable = typeof ENGINE_NOTICE_FACT_READERS;
268
303
  export type EngineNoticeFactsCode = keyof FactReaderTable;