@sema-agent/client-core 0.108.0 → 0.110.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 (179) hide show
  1. package/CHANGELOG.md +294 -0
  2. package/README.md +77 -40
  3. package/dist/adapt/arms.js +41 -13
  4. package/dist/adapt/textStream.d.ts +2 -0
  5. package/dist/adapt/textStream.js +37 -16
  6. package/dist/adapter/activeRunSelfHeal.js +1 -1
  7. package/dist/adapter/downstream/eventToSdkMessage.js +11 -5
  8. package/dist/agentSession/engineAgentRegistryRead.js +2 -0
  9. package/dist/bashExitReading.d.ts +12 -0
  10. package/dist/bashExitReading.js +44 -0
  11. package/dist/checkpointRowVerdict.d.ts +1 -1
  12. package/dist/checkpointRowVerdict.js +4 -2
  13. package/dist/compensations.js +1 -1
  14. package/dist/declared/supportFloorDeclared.js +1 -1
  15. package/dist/displayUntrusted.js +132 -14
  16. package/dist/engineAgentAbsence.d.ts +2 -0
  17. package/dist/engineAgentAbsence.js +28 -0
  18. package/dist/engineErrorCodes.d.ts +7 -0
  19. package/dist/engineErrorCodes.js +7 -0
  20. package/dist/engineHealthFacts.d.ts +26 -0
  21. package/dist/engineHealthFacts.js +63 -4
  22. package/dist/engineInlineTaskStats.d.ts +4 -3
  23. package/dist/engineInlineTaskStats.js +18 -2
  24. package/dist/engineNoticeCodes.d.ts +138 -0
  25. package/dist/engineNoticeCodes.js +662 -55
  26. package/dist/engineRepoint.d.ts +140 -0
  27. package/dist/engineRepoint.js +285 -0
  28. package/dist/engineRowRef.js +2 -0
  29. package/dist/engineSessionMessages.d.ts +2 -1
  30. package/dist/engineSessionMessages.js +5 -0
  31. package/dist/errorSupplementRoles.js +5 -1
  32. package/dist/fleet/fleetProjection.js +3 -2
  33. package/dist/fleetTaskDesc.js +3 -3
  34. package/dist/generated/engineFactTables.d.ts +3 -0
  35. package/dist/generated/engineFactTables.js +18 -0
  36. package/dist/generated/engineNoticeTables.js +3 -0
  37. package/dist/generated/sdkFactTables.d.ts +1 -0
  38. package/dist/generated/sdkFactTables.js +4 -0
  39. package/dist/hitl/approvalAskers.d.ts +6 -0
  40. package/dist/hitl/approvalAskers.js +30 -0
  41. package/dist/hitl/approvalCardReasons.js +25 -4
  42. package/dist/hitl/approvalRequestFrameReading.d.ts +21 -0
  43. package/dist/hitl/approvalRequestFrameReading.js +90 -0
  44. package/dist/hitl/approvalResolution.d.ts +8 -1
  45. package/dist/hitl/approvalResolution.js +4 -0
  46. package/dist/hitl/approvalsFeed.js +1 -1
  47. package/dist/hitl/askGateWire.js +0 -2
  48. package/dist/hitl/askParkRowRouting.js +5 -2
  49. package/dist/hitl/automaticAnswerVerdict.d.ts +5 -2
  50. package/dist/hitl/automaticAnswerVerdict.js +18 -4
  51. package/dist/hitl/decisionConflict.d.ts +2 -1
  52. package/dist/hitl/decisionConflict.js +10 -4
  53. package/dist/hitl/decisionRefusal.js +1 -0
  54. package/dist/hitl/decisionSend.d.ts +3 -0
  55. package/dist/hitl/decisionSend.js +29 -11
  56. package/dist/hitl/editedApprovalAcceptance.d.ts +25 -0
  57. package/dist/hitl/editedApprovalAcceptance.js +26 -0
  58. package/dist/hitl/frameRouter.js +13 -19
  59. package/dist/hitl/gateLedger.d.ts +0 -4
  60. package/dist/hitl/gateLedger.js +0 -19
  61. package/dist/hitl/hitlBridge.d.ts +5 -0
  62. package/dist/hitl/hitlBridge.js +13 -9
  63. package/dist/hitl/hitlHostSurface.d.ts +1 -0
  64. package/dist/hitl/hitlHostSurface.js +7 -2
  65. package/dist/hitl/hostWithdrawal.d.ts +15 -0
  66. package/dist/hitl/hostWithdrawal.js +38 -0
  67. package/dist/hitl/livePendingAsk.js +17 -16
  68. package/dist/hitl/localAllowRule.js +2 -1
  69. package/dist/hitl/noAllowCause.d.ts +1 -1
  70. package/dist/hitl/noAllowCause.js +4 -2
  71. package/dist/hitl/parkExpiryJudgements.js +26 -1
  72. package/dist/hitl/parkOwnership.d.ts +2 -0
  73. package/dist/hitl/parkOwnership.js +48 -8
  74. package/dist/hitl/parkResolver.js +32 -16
  75. package/dist/hitl/parkedUnresumable.d.ts +13 -0
  76. package/dist/hitl/parkedUnresumable.js +80 -0
  77. package/dist/hitl/permissionRuleScope.d.ts +4 -0
  78. package/dist/hitl/permissionRuleScope.js +31 -0
  79. package/dist/hitl/persistedRulesWire.d.ts +2 -0
  80. package/dist/hitl/persistedRulesWire.js +13 -12
  81. package/dist/hitl/planReviewWire.js +14 -4
  82. package/dist/hitl/sessionAllowRoute.js +5 -4
  83. package/dist/hitl/sessionPolicyWire.js +6 -4
  84. package/dist/hitl/standingRows.d.ts +2 -5
  85. package/dist/hitl/standingRows.js +30 -15
  86. package/dist/hitl/toolApprovalWire.d.ts +42 -9
  87. package/dist/hitl/toolApprovalWire.js +267 -44
  88. package/dist/hooksWireCaps.js +35 -4
  89. package/dist/hostSettingsSource.js +2 -0
  90. package/dist/hostTurnSettings.d.ts +10 -4
  91. package/dist/hostTurnSettings.js +112 -5
  92. package/dist/i18n/messages.en.d.ts +251 -0
  93. package/dist/i18n/messages.en.js +254 -2
  94. package/dist/i18n/messages.zh.js +264 -2
  95. package/dist/index.d.ts +48 -12
  96. package/dist/index.js +29 -7
  97. package/dist/inheritEnvCapability.js +2 -0
  98. package/dist/inputAuthor.d.ts +16 -0
  99. package/dist/inputAuthor.js +44 -0
  100. package/dist/interruptRefusalNote.d.ts +2 -0
  101. package/dist/interruptRefusalNote.js +17 -0
  102. package/dist/liveModelCatalog.d.ts +2 -0
  103. package/dist/liveModelCatalog.js +21 -7
  104. package/dist/liveQuestionStore.d.ts +4 -1
  105. package/dist/liveQuestionStore.js +12 -3
  106. package/dist/localEngineJudge.d.ts +75 -0
  107. package/dist/localEngineJudge.js +242 -0
  108. package/dist/localEngineOccupancy.d.ts +88 -0
  109. package/dist/localEngineOccupancy.js +269 -0
  110. package/dist/localEngineSeatReading.d.ts +29 -0
  111. package/dist/localEngineSeatReading.js +294 -0
  112. package/dist/localEngineSpawn.d.ts +113 -0
  113. package/dist/localEngineSpawn.js +486 -0
  114. package/dist/localEngineStep.d.ts +286 -0
  115. package/dist/localEngineStep.js +1086 -0
  116. package/dist/localEngineStopLadder.d.ts +29 -0
  117. package/dist/localEngineStopLadder.js +139 -0
  118. package/dist/localEngineSwapCard.d.ts +43 -0
  119. package/dist/localEngineSwapCard.js +205 -0
  120. package/dist/localEngineTiming.d.ts +8 -0
  121. package/dist/localEngineTiming.js +8 -0
  122. package/dist/mcpEngineLeg.d.ts +3 -0
  123. package/dist/mcpEngineLeg.js +38 -1
  124. package/dist/mcpPanel.js +2 -0
  125. package/dist/mcpReconnect.d.ts +9 -1
  126. package/dist/mcpReconnect.js +132 -20
  127. package/dist/mcpWireCaps.js +2 -2
  128. package/dist/memoryEntriesWire.d.ts +1 -1
  129. package/dist/memoryEntriesWire.js +5 -0
  130. package/dist/modelCapabilityProbe.js +4 -3
  131. package/dist/modsFace.d.ts +8 -1
  132. package/dist/modsFace.js +27 -0
  133. package/dist/noticePresentation.d.ts +2 -0
  134. package/dist/noticePresentation.js +79 -1
  135. package/dist/notifications.d.ts +17 -6
  136. package/dist/notifications.js +67 -19
  137. package/dist/ownKey.d.ts +5 -0
  138. package/dist/ownKey.js +8 -1
  139. package/dist/peerFrames.d.ts +40 -2
  140. package/dist/peerFrames.js +158 -3
  141. package/dist/pluginHooksWire.d.ts +2 -1
  142. package/dist/pluginHooksWire.js +56 -1
  143. package/dist/replayBody.js +10 -2
  144. package/dist/request/taskRequest.d.ts +5 -0
  145. package/dist/request/taskRequest.js +138 -21
  146. package/dist/resumeRefusalCopy.d.ts +1 -3
  147. package/dist/resumeRefusalCopy.js +2 -1
  148. package/dist/retryStatus.d.ts +2 -2
  149. package/dist/retryStatus.js +2 -0
  150. package/dist/ruleReadings.js +1 -1
  151. package/dist/seam.d.ts +24 -2
  152. package/dist/seam.js +15 -2
  153. package/dist/seatContract.d.ts +125 -10
  154. package/dist/seatContract.js +373 -7
  155. package/dist/sessionBackground.js +4 -1
  156. package/dist/sessionBackgroundHandoff.js +2 -1
  157. package/dist/sessionEngine.d.ts +2 -0
  158. package/dist/sessionEngine.js +111 -0
  159. package/dist/sessionMemoryStatus.d.ts +2 -1
  160. package/dist/sessionSyncFileHistory.d.ts +4 -0
  161. package/dist/sessionSyncFileHistory.js +28 -0
  162. package/dist/sseIdleTriage.d.ts +13 -1
  163. package/dist/sseIdleTriage.js +24 -6
  164. package/dist/subagent/engineSubagentTail.js +6 -0
  165. package/dist/subagentContentStore.d.ts +12 -0
  166. package/dist/subagentContentStore.js +72 -11
  167. package/dist/terminalStatuses.d.ts +1 -0
  168. package/dist/terminalStatuses.js +4 -1
  169. package/dist/toolResult.js +18 -5
  170. package/dist/turnFailurePresentation.js +9 -2
  171. package/dist/typePins.d.ts +11 -0
  172. package/dist/usageAnalytics.d.ts +17 -0
  173. package/dist/usageAnalytics.js +44 -2
  174. package/dist/wireFailureShape.d.ts +22 -5
  175. package/dist/wireFailureShape.js +47 -26
  176. package/dist/wireRefusalCopy.d.ts +31 -1
  177. package/dist/wireRefusalCopy.js +167 -2
  178. package/docs/INTEGRATION-CLIENTS.md +3269 -21
  179. package/package.json +5 -5
@@ -1099,6 +1099,69 @@ class InnerWordIndex {
1099
1099
  this.spanClose ??= codeSpanClose(this.text, this.plain);
1100
1100
  return this.spanClose[i] ?? -1;
1101
1101
  }
1102
+ eventNext = null;
1103
+ runEnd = null;
1104
+ restFrom = null;
1105
+ tailEnd = null;
1106
+ bareEndFrom(k) {
1107
+ const text = this.text;
1108
+ const n = text.length;
1109
+ if (this.eventNext === null || this.runEnd === null || this.restFrom === null) {
1110
+ const ev = new Int32Array(n + 1).fill(n);
1111
+ const run = new Int32Array(n + 1).fill(n);
1112
+ for (let x = n - 1; x >= 0; x--) {
1113
+ const ch = text.charAt(x);
1114
+ const sep = ch === VIEW_SEPARATOR;
1115
+ ev[x] = sep || isBareValueStop(ch) ? x : (ev[x + 1] ?? n);
1116
+ run[x] = sep ? (run[x + 1] ?? n) : x;
1117
+ }
1118
+ this.eventNext = ev;
1119
+ this.runEnd = run;
1120
+ this.restFrom = new Int32Array(n + 1).fill(-1);
1121
+ }
1122
+ const ev = this.eventNext;
1123
+ const run = this.runEnd;
1124
+ const rest = this.restFrom;
1125
+ const pendingRest = [];
1126
+ let j = k;
1127
+ let end;
1128
+ for (;;) {
1129
+ const x = ev[j] ?? n;
1130
+ if (x >= n || text.charAt(x) !== VIEW_SEPARATOR) {
1131
+ end = x;
1132
+ break;
1133
+ }
1134
+ const p = run[x] ?? n;
1135
+ if (credentialWordStartsNear(text, p, this.tokenInner)) {
1136
+ end = x;
1137
+ break;
1138
+ }
1139
+ const known = rest[p] ?? -1;
1140
+ if (known !== -1) {
1141
+ end = known;
1142
+ break;
1143
+ }
1144
+ pendingRest.push(p);
1145
+ j = p;
1146
+ }
1147
+ for (const p of pendingRest)
1148
+ rest[p] = end;
1149
+ return end;
1150
+ }
1151
+ closingTailEnd(t) {
1152
+ if (this.tailEnd === null) {
1153
+ const text = this.text;
1154
+ const n = text.length;
1155
+ const punct = new Int32Array(n + 1).fill(n);
1156
+ for (let x = n - 1; x >= 0; x--)
1157
+ punct[x] = TRAILING_PUNCTUATION.has(text.charAt(x)) ? (punct[x + 1] ?? n) : x;
1158
+ const tail = new Int32Array(n + 1).fill(n);
1159
+ for (let x = n - 1; x >= 0; x--)
1160
+ tail[x] = text.charCodeAt(x) === 0x60 ? (tail[x + 1] ?? n) : (punct[x] ?? n);
1161
+ this.tailEnd = tail;
1162
+ }
1163
+ return this.tailEnd[t] ?? this.text.length;
1164
+ }
1102
1165
  next(q) {
1103
1166
  let best = null;
1104
1167
  for (const p of this.probes) {
@@ -1231,7 +1294,16 @@ function scanSecretValue(text, from, idx) {
1231
1294
  let cut = false;
1232
1295
  let j = i;
1233
1296
  const closingTick = idx === undefined ? -1 : idx.closingTickFrom(i);
1234
- while (j < text.length) {
1297
+ if (idx !== undefined) {
1298
+ const end0 = idx.bareEndFrom(i);
1299
+ if (pending !== null && pending.start < end0 && innerWordFits(text, pending)) {
1300
+ cut = true;
1301
+ j = pending.start;
1302
+ }
1303
+ else
1304
+ j = end0;
1305
+ }
1306
+ while (idx === undefined && j < text.length) {
1235
1307
  if (pending !== null && j >= pending.start) {
1236
1308
  if (j === pending.start && innerWordFits(text, pending)) {
1237
1309
  cut = true;
@@ -1246,7 +1318,7 @@ function scanSecretValue(text, from, idx) {
1246
1318
  let p = j;
1247
1319
  while (p < text.length && text[p] === VIEW_SEPARATOR)
1248
1320
  p++;
1249
- if (credentialWordStartsNear(text, p, idx?.tokenInner ?? true))
1321
+ if (credentialWordStartsNear(text, p, true))
1250
1322
  break;
1251
1323
  j = p;
1252
1324
  continue;
@@ -1255,13 +1327,8 @@ function scanSecretValue(text, from, idx) {
1255
1327
  }
1256
1328
  while (j > i && text[j - 1] === VIEW_SEPARATOR)
1257
1329
  j--;
1258
- if (closingTick > i && closingTick < j) {
1259
- let t = closingTick;
1260
- while (t < j && text.charCodeAt(t) === 0x60)
1261
- t++;
1262
- while (t < j && TRAILING_PUNCTUATION.has(text.charAt(t)))
1263
- t++;
1264
- if (t === j && text.charCodeAt(closingTick) === 0x60) {
1330
+ if (idx !== undefined && closingTick > i && closingTick < j) {
1331
+ if (idx.closingTailEnd(closingTick) >= j && text.charCodeAt(closingTick) === 0x60) {
1265
1332
  j = closingTick;
1266
1333
  while (j > i && text[j - 1] === VIEW_SEPARATOR)
1267
1334
  j--;
@@ -2473,11 +2540,50 @@ function envSchemeWordReading(text, at) {
2473
2540
  }
2474
2541
  return k > e && ENV_ASSIGNMENT_AHEAD.test(text.slice(k, k + 256)) ? { end: e, beforeAssignment: true } : null;
2475
2542
  }
2476
- function labelCandidates(S, pass, regions, out, blocks, outer = false) {
2543
+ const SCHEME_ADJACENT_SOURCE = String.raw `${SCHEME_LEFT_STRICT}(?<![/\\.@])(bearer|basic)(?=[A-Za-z0-9._~+/-])`;
2544
+ const SCHEME_ADJACENT_STRONG_MIN = 8;
2545
+ const SCHEME_ADJACENT_WEAK_MIN = 20;
2546
+ const SCHEME_ADJACENT_WINDOW = 96;
2547
+ function schemeAdjacentAccepted(scheme, win) {
2548
+ if (ADDRESS_SCHEME_RE.test(win))
2549
+ return true;
2550
+ let w = 0;
2551
+ while (w < win.length && isKeyWordChar(win.charCodeAt(w)))
2552
+ w++;
2553
+ if (w > 0 && isProseKnownLiteral(win.slice(0, w)))
2554
+ return true;
2555
+ const connector = (c) => c === 0x2d || c === 0x5f || c === 0x7e || c === 0x2b;
2556
+ let h = 0;
2557
+ while (h < win.length) {
2558
+ const c = win.charCodeAt(h);
2559
+ if (!(isAlnumCode(c) || connector(c) || c === 0x2e || c === 0x2f))
2560
+ break;
2561
+ h++;
2562
+ }
2563
+ const H = win.slice(0, h);
2564
+ const head = H.charCodeAt(0);
2565
+ if (head === 0x2e || head === 0x2f)
2566
+ return false;
2567
+ const upper = /[A-Z]/.test(H);
2568
+ const digit = /[0-9]/.test(H);
2569
+ if (H.length < (upper || digit ? SCHEME_ADJACENT_STRONG_MIN : SCHEME_ADJACENT_WEAK_MIN))
2570
+ return false;
2571
+ if (upper && digit && /[a-z]/.test(H))
2572
+ return true;
2573
+ const first = /^(?:[A-Z]?[a-z]+|[A-Z]+(?![a-z]))/.exec(connector(head) ? H.slice(1) : H);
2574
+ if (first !== null && schemeFollowerReleased(scheme, first[0], false))
2575
+ return false;
2576
+ if (connector(head) || /^(?:[A-Z][a-z]+)+$/.test(H.split(/[-._~+\/]/, 1)[0] ?? ''))
2577
+ return false;
2578
+ return true;
2579
+ }
2580
+ function labelCandidates(S, pass, regions, out, blocks, mode = 'strict') {
2477
2581
  const text = S.text;
2582
+ const outer = mode === 'outer';
2583
+ const adjacent = mode === 'adjacent' && pass === 'scheme';
2478
2584
  const unitAt = (k) => S.unitAt(k);
2479
2585
  const strictSource = pass === 'label' ? SECRET_LABELLED_WORD.source : SECRET_SCHEME_WORD.source;
2480
- const re = new RegExp(outer ? (pass === 'label' ? LABEL_WORD_OUTER_SOURCE : SCHEME_WORD_OUTER_SOURCE) : strictSource, 'gi');
2586
+ const re = new RegExp(adjacent ? SCHEME_ADJACENT_SOURCE : outer ? (pass === 'label' ? LABEL_WORD_OUTER_SOURCE : SCHEME_WORD_OUTER_SOURCE) : strictSource, 'gi');
2481
2587
  const strictAt = outer ? new RegExp(strictSource, 'iy') : null;
2482
2588
  const schemePass = pass !== 'label';
2483
2589
  const tokenPass = pass === 'token';
@@ -2744,6 +2850,8 @@ function labelCandidates(S, pass, regions, out, blocks, outer = false) {
2744
2850
  continue;
2745
2851
  if (schemePass && labelStartsAt(text, hit.index))
2746
2852
  continue;
2853
+ if (adjacent && !schemeAdjacentAccepted(label, text.slice(hit.index + hit[0].length, hit.index + hit[0].length + SCHEME_ADJACENT_WINDOW)))
2854
+ continue;
2747
2855
  let from = hit.index + hit[0].length;
2748
2856
  if (!schemePass && text.charCodeAt(from) === 0x3e && text.charCodeAt(from - 1) === 0x3d && labelQuotedAt(text, hit.index, hit[0].slice(label.length))) {
2749
2857
  let k = from + 1;
@@ -3102,6 +3210,9 @@ function longestAlnumRun(word) {
3102
3210
  }
3103
3211
  return best;
3104
3212
  }
3213
+ function isProseKnownLiteral(word) {
3214
+ return SECRET_LITERAL_RE.test(word) && (longestAlnumRun(word) >= PROSE_LITERAL_MIN_RUN || shortLiteralTail(word));
3215
+ }
3105
3216
  const JWT_WORD = /^eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{4,}$/;
3106
3217
  const PEM_BEGIN_SOURCE = `${PRIVATE_KEY_PEM_HEADER.source}(?: BLOCK)?-----`;
3107
3218
  const PEM_CASE_FLAGS = PRIVATE_KEY_PEM_HEADER.flags.includes('i') ? 'i' : '';
@@ -3569,7 +3680,7 @@ function proseLiteralEdits(text) {
3569
3680
  fileAt = fileUrlPositions(text);
3570
3681
  const localPath = prev === '\\' || prev === '.' || (slashSegment && fileAt != null && fileAt[i] === 1);
3571
3682
  const pathish = slashSegment || localPath;
3572
- if (!localPath && SECRET_LITERAL_RE.test(word) && (longestAlnumRun(word) >= PROSE_LITERAL_MIN_RUN || shortLiteralTail(word))) {
3683
+ if (!localPath && isProseKnownLiteral(word)) {
3573
3684
  pushEdit(edits, text, i + escHead, end, REDACTED_SECRET);
3574
3685
  }
3575
3686
  else if (!localPath) {
@@ -4393,8 +4504,14 @@ function runLabelPasses(S, regions, cands, blocks) {
4393
4504
  labelCandidates(S, 'scheme', regions, cands, blocks);
4394
4505
  labelCandidates(S, 'token', regions, cands, blocks);
4395
4506
  labelCandidates(S, 'label', regions, cands, blocks);
4396
- labelCandidates(S, 'scheme', regions, cands, blocks, true);
4397
- labelCandidates(S, 'label', regions, cands, blocks, true);
4507
+ labelCandidates(S, 'scheme', regions, cands, blocks, 'outer');
4508
+ labelCandidates(S, 'label', regions, cands, blocks, 'outer');
4509
+ emitRow('scheme-adjacent', (phases) => {
4510
+ const adjacent = [];
4511
+ labelCandidates(S, 'scheme', regions, adjacent, blocks, 'adjacent');
4512
+ for (const c of adjacent)
4513
+ cands.push({ ...c, phases });
4514
+ });
4398
4515
  }
4399
4516
  function collectCandidates(text, o, nested) {
4400
4517
  const V = buildScanView(text, o);
@@ -4486,6 +4603,7 @@ const RULES_BY_VERSION = {
4486
4603
  form: { host: 'hooks.slack.com', trailingDot: true, pathKinds: ['services', 'workflows', 'triggers'], tailClass: 'A-Za-z0-9+/_-', minTailLength: 40 },
4487
4604
  },
4488
4605
  ],
4606
+ '0.110.0': [{ id: 'scheme-adjacent', ticket: 'CC-1282', kind: 'generator' }],
4489
4607
  };
4490
4608
  const RULE_ROWS_ARE_GENERATORS = true;
4491
4609
  void RULE_ROWS_ARE_GENERATORS;
@@ -56,6 +56,7 @@ export interface EngineAgentRegistryRowView {
56
56
  readonly description?: string;
57
57
  readonly createdAt?: number;
58
58
  readonly sessionId?: string;
59
+ readonly retained?: true;
59
60
  }
60
61
  export type EngineAgentRegistryUnavailableWhy = 'no_list_face' | 'capability_unknown' | 'route_absent' | 'ownership_required' | 'read_failed';
61
62
  export type EngineAgentRegistryListing = {
@@ -75,6 +76,7 @@ export interface EngineAgentRegistryReadingOptions {
75
76
  readonly sessionId?: string;
76
77
  }
77
78
  export declare function engineAgentRegistryReadingOf(listing: EngineAgentRegistryListing | null | undefined, registryKey: string | null | undefined, opts?: EngineAgentRegistryReadingOptions | null): EngineAgentRegistryReading;
79
+ export declare function localEngineSessionShellsOf(listings: readonly (EngineAgentRegistryListing | null | undefined)[]): number | 'unknown';
78
80
  export interface EngineAgentRegistryMissingRow {
79
81
  readonly id: string;
80
82
  readonly status: string;
@@ -214,6 +214,34 @@ function readingFromRecord(rec, registryKey, opts) {
214
214
  const single = ownOpt(opts, 'singleReplica');
215
215
  return single.given && single.value === true && REGISTRY_AGENT_HANDLE_RE.test(registryKey) ? 'not_listed' : 'unknown';
216
216
  }
217
+ const SESSION_SHELL_TYPES = new Set(Object.keys({ background_bash: true, monitor: true }));
218
+ export function localEngineSessionShellsOf(listings) {
219
+ try {
220
+ if (!Array.isArray(listings))
221
+ return 'unknown';
222
+ let count = 0;
223
+ for (let i = 0; i < listings.length; i++) {
224
+ if (!Object.hasOwn(listings, i))
225
+ return 'unknown';
226
+ const rec = registryListingProvenanceOf(listings[i]);
227
+ if (rec === undefined || rec.superseded || rec.rawRowCount >= REGISTRY_LIST_LIMIT)
228
+ return 'unknown';
229
+ for (const r of rec.rows) {
230
+ if (!SESSION_SHELL_TYPES.has(r.type) || r.retained === true)
231
+ continue;
232
+ const reading = registryStatusReading(r.status);
233
+ if (reading === 'unknown')
234
+ return 'unknown';
235
+ if (reading === 'running')
236
+ count++;
237
+ }
238
+ }
239
+ return count;
240
+ }
241
+ catch {
242
+ return 'unknown';
243
+ }
244
+ }
217
245
  function keySetOf(v) {
218
246
  if (v instanceof Set)
219
247
  return (k) => v.has(k);
@@ -49,6 +49,10 @@ export declare const ATTACHMENT_BUNDLE_SEED_FIXED = "attachment.bundle_seed_fixe
49
49
  export declare const ATTACHMENT_BOUND_ELSEWHERE = "attachment.bound_elsewhere";
50
50
  export declare const CONFLICT_SESSION_MEMORY_UNOBSERVED = "conflict.session_memory_unobserved";
51
51
  export declare const CONFLICT_SESSION_ARCHIVE_STAMPED = "conflict.session_archive_stamped";
52
+ export declare const REQUEST_ENV_CREDENTIAL_REFUSED = "request.env_credential_refused";
53
+ export declare const CONFLICT_SESSION_ID_RETIRED = "conflict.session_id_retired";
54
+ export declare const LIMIT_RATE_EXCEEDED = "limit.rate_exceeded";
55
+ export declare const RATE_EXCEEDED_RUN_CONCURRENCY_CAP = "run_concurrency_cap";
52
56
  export declare const GATE_PARKED_ERROR_CODE = "gate.parked";
53
57
  export declare const ACTIVE_RUN_BUSY_ERROR_CODE = "conflict.session_active_run";
54
58
  export declare const CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH = "conflict.idempotency_payload_mismatch";
@@ -150,6 +154,9 @@ export declare const APPROVAL_EXPIRED: "approval.expired";
150
154
  export declare function runDeathVerdictNoteOf(code: string | undefined): string | undefined;
151
155
  export declare const CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED = "capability.operator_principals_required";
152
156
  export declare const COMPACT_NOT_RUNNING = "compact.not_running";
157
+ export declare const INTERRUPT_NOTHING_IN_FLIGHT = "interrupt.nothing_in_flight";
158
+ export declare const INTERRUPT_NOT_HELD = "interrupt.not_held";
159
+ export declare const STEERING_NOT_RUNNING = "steering.not_running";
153
160
  export declare function isUnavailableFaceCode(code: string | undefined): boolean;
154
161
  export type OperatorGateRefusal = 'operator_only' | 'operators_unconfigured';
155
162
  export declare function operatorGateRefusalContent(cause: OperatorGateRefusal): string | undefined;
@@ -73,6 +73,10 @@ export const ATTACHMENT_BUNDLE_SEED_FIXED = 'attachment.bundle_seed_fixed';
73
73
  export const ATTACHMENT_BOUND_ELSEWHERE = 'attachment.bound_elsewhere';
74
74
  export const CONFLICT_SESSION_MEMORY_UNOBSERVED = 'conflict.session_memory_unobserved';
75
75
  export const CONFLICT_SESSION_ARCHIVE_STAMPED = 'conflict.session_archive_stamped';
76
+ export const REQUEST_ENV_CREDENTIAL_REFUSED = 'request.env_credential_refused';
77
+ export const CONFLICT_SESSION_ID_RETIRED = 'conflict.session_id_retired';
78
+ export const LIMIT_RATE_EXCEEDED = 'limit.rate_exceeded';
79
+ export const RATE_EXCEEDED_RUN_CONCURRENCY_CAP = 'run_concurrency_cap';
76
80
  export const GATE_PARKED_ERROR_CODE = 'gate.parked';
77
81
  export const ACTIVE_RUN_BUSY_ERROR_CODE = 'conflict.session_active_run';
78
82
  export const CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH = 'conflict.idempotency_payload_mismatch';
@@ -270,6 +274,9 @@ export function runDeathVerdictNoteOf(code) {
270
274
  }
271
275
  export const CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED = 'capability.operator_principals_required';
272
276
  export const COMPACT_NOT_RUNNING = 'compact.not_running';
277
+ export const INTERRUPT_NOTHING_IN_FLIGHT = 'interrupt.nothing_in_flight';
278
+ export const INTERRUPT_NOT_HELD = 'interrupt.not_held';
279
+ export const STEERING_NOT_RUNNING = 'steering.not_running';
273
280
  export function isUnavailableFaceCode(code) {
274
281
  return typeof code === 'string' && (code.startsWith('capability.') || code.startsWith('feature.'));
275
282
  }
@@ -8,6 +8,7 @@ export interface EngineHealthAuthFacts {
8
8
  readonly required: boolean;
9
9
  readonly kinds: readonly (HealthAuthKind | (string & {}))[];
10
10
  readonly identityAttach: 'available' | 'unavailable';
11
+ readonly serviceTokenActsForDeployment?: boolean;
11
12
  }
12
13
  export interface EngineHealthDrainingFacts {
13
14
  readonly actionId: string;
@@ -17,6 +18,19 @@ export interface EngineHealthDrainingFacts {
17
18
  export interface EngineHealthLeaseFacts {
18
19
  readonly lingerMs: number;
19
20
  readonly tickMs: number;
21
+ readonly firstAttach?: EngineHealthFirstAttachFacts;
22
+ }
23
+ export interface EngineHealthFirstAttachFacts {
24
+ readonly windowMs: number;
25
+ readonly since: number;
26
+ readonly attachedAt: number | null;
27
+ }
28
+ export interface EngineHealthInflightFacts {
29
+ readonly total: number;
30
+ readonly http?: number;
31
+ readonly leader?: number;
32
+ readonly sessionResident?: number;
33
+ readonly backgroundAgents?: number;
20
34
  }
21
35
  export interface EngineHealthFacts {
22
36
  readonly center?: EngineHealthCenterFacts;
@@ -24,5 +38,17 @@ export interface EngineHealthFacts {
24
38
  readonly operator?: 'present' | 'absent';
25
39
  readonly draining?: EngineHealthDrainingFacts;
26
40
  readonly engineLease?: EngineHealthLeaseFacts;
41
+ readonly inflight?: EngineHealthInflightFacts;
42
+ readonly version?: string;
43
+ readonly dataRoot?: string;
27
44
  }
45
+ export type ModsDeploymentPackagesReading = {
46
+ readonly kind: 'present';
47
+ readonly count: number;
48
+ } | {
49
+ readonly kind: 'absent';
50
+ } | {
51
+ readonly kind: 'unreadable';
52
+ };
53
+ export declare function readModsDeploymentPackages(health: object | null | undefined): ModsDeploymentPackagesReading;
28
54
  export declare function readEngineHealthFacts(health: object | null | undefined): EngineHealthFacts;
@@ -1,5 +1,5 @@
1
- import { readOwnDataValue } from './ownKey.js';
2
- const _healthFactsMatchSdk = [true, true, true, true, true, true];
1
+ import { ownDataField, readOwnDataValue } from './ownKey.js';
2
+ const _healthFactsMatchSdk = [true, true, true, true, true, true, true, true, true, true];
3
3
  void _healthFactsMatchSdk;
4
4
  const ENGINE_SIGNAL_KEY = 'engineSignal';
5
5
  function isObject(v) {
@@ -51,7 +51,10 @@ function authOf(raw) {
51
51
  return undefined;
52
52
  kinds.push(word);
53
53
  }
54
- return Object.freeze({ required, kinds: Object.freeze(kinds), identityAttach });
54
+ const actsRaw = readOwnDataValue(raw, 'serviceTokenActsForDeployment');
55
+ if (actsRaw !== undefined && typeof actsRaw !== 'boolean')
56
+ return undefined;
57
+ return Object.freeze({ required, kinds: Object.freeze(kinds), identityAttach, ...(typeof actsRaw === 'boolean' ? { serviceTokenActsForDeployment: actsRaw } : {}) });
55
58
  }
56
59
  function drainingOf(health) {
57
60
  const signal = readOwnDataValue(health, ENGINE_SIGNAL_KEY);
@@ -67,6 +70,17 @@ function drainingOf(health) {
67
70
  return undefined;
68
71
  return Object.freeze({ actionId, since, deadlineAt });
69
72
  }
73
+ function firstAttachOf(raw) {
74
+ if (!isObject(raw))
75
+ return undefined;
76
+ const windowMs = epochMs(readOwnDataValue(raw, 'windowMs'));
77
+ const since = epochMs(readOwnDataValue(raw, 'since'));
78
+ const attachedRaw = readOwnDataValue(raw, 'attachedAt');
79
+ const attachedAt = attachedRaw === null ? null : epochMs(attachedRaw);
80
+ if (windowMs === undefined || since === undefined || attachedAt === undefined)
81
+ return undefined;
82
+ return Object.freeze({ windowMs, since, attachedAt });
83
+ }
70
84
  function leaseOf(raw) {
71
85
  if (!isObject(raw))
72
86
  return undefined;
@@ -74,7 +88,26 @@ function leaseOf(raw) {
74
88
  const tickMs = epochMs(readOwnDataValue(raw, 'tickMs'));
75
89
  if (lingerMs === undefined || tickMs === undefined)
76
90
  return undefined;
77
- return Object.freeze({ lingerMs, tickMs });
91
+ const firstRaw = readOwnDataValue(raw, 'firstAttach');
92
+ const firstAttach = firstRaw === undefined ? undefined : firstAttachOf(firstRaw);
93
+ if (firstRaw !== undefined && firstAttach === undefined)
94
+ return undefined;
95
+ return Object.freeze({ lingerMs, tickMs, ...(firstAttach !== undefined ? { firstAttach } : {}) });
96
+ }
97
+ function inflightOf(health) {
98
+ const total = epochMs(readOwnDataValue(health, 'inflight'));
99
+ if (total === undefined)
100
+ return undefined;
101
+ const raw = guarded(() => readOwnDataValue(health, 'inflightBreakdown'));
102
+ const parts = {};
103
+ if (isObject(raw)) {
104
+ for (const key of ['http', 'leader', 'sessionResident', 'backgroundAgents']) {
105
+ const v = guarded(() => epochMs(readOwnDataValue(raw, key)));
106
+ if (v !== undefined)
107
+ parts[key] = v;
108
+ }
109
+ }
110
+ return Object.freeze({ total, ...parts });
78
111
  }
79
112
  function guarded(read) {
80
113
  try {
@@ -84,6 +117,26 @@ function guarded(read) {
84
117
  return undefined;
85
118
  }
86
119
  }
120
+ export function readModsDeploymentPackages(health) {
121
+ try {
122
+ if (!isObject(health))
123
+ return Object.freeze({ kind: 'unreadable' });
124
+ const mods = ownDataField(health, 'mods');
125
+ if (mods === undefined)
126
+ return Object.freeze({ kind: 'absent' });
127
+ if (!isObject(mods))
128
+ return Object.freeze({ kind: 'unreadable' });
129
+ const n = ownDataField(mods, 'deploymentPackages');
130
+ if (n === undefined)
131
+ return Object.freeze({ kind: 'absent' });
132
+ if (typeof n === 'number' && Number.isSafeInteger(n) && n >= 1)
133
+ return Object.freeze({ kind: 'present', count: n });
134
+ return Object.freeze({ kind: 'unreadable' });
135
+ }
136
+ catch {
137
+ return Object.freeze({ kind: 'unreadable' });
138
+ }
139
+ }
87
140
  export function readEngineHealthFacts(health) {
88
141
  if (!isObject(health))
89
142
  return Object.freeze({});
@@ -93,11 +146,17 @@ export function readEngineHealthFacts(health) {
93
146
  const operator = operatorRaw === 'present' || operatorRaw === 'absent' ? operatorRaw : undefined;
94
147
  const draining = guarded(() => drainingOf(health));
95
148
  const engineLease = guarded(() => leaseOf(readOwnDataValue(health, 'engineLease')));
149
+ const inflight = guarded(() => inflightOf(health));
150
+ const version = guarded(() => nonEmptyString(readOwnDataValue(health, 'version')));
151
+ const dataRoot = guarded(() => nonEmptyString(readOwnDataValue(health, 'dataRoot')));
96
152
  return Object.freeze({
97
153
  ...(center !== undefined ? { center } : {}),
98
154
  ...(auth !== undefined ? { auth } : {}),
99
155
  ...(operator !== undefined ? { operator } : {}),
100
156
  ...(draining !== undefined ? { draining } : {}),
101
157
  ...(engineLease !== undefined ? { engineLease } : {}),
158
+ ...(inflight !== undefined ? { inflight } : {}),
159
+ ...(version !== undefined ? { version } : {}),
160
+ ...(dataRoot !== undefined ? { dataRoot } : {}),
102
161
  });
103
162
  }
@@ -1,14 +1,15 @@
1
1
  import type { InlineTaskTick } from './seam.js';
2
2
  export interface EngineInlineTaskStats {
3
- toolUses: number;
4
- totalTokens: number;
5
- durationMs: number;
3
+ toolUses?: number;
4
+ totalTokens?: number;
5
+ durationMs?: number;
6
6
  currentAction?: string;
7
7
  model?: string;
8
8
  done: boolean;
9
9
  isError: boolean;
10
10
  }
11
11
  export declare function publishEngineInlineTaskTick(cardId: string, tick: InlineTaskTick): void;
12
+ export declare function publishEngineInlineTaskModel(cardId: string, model: string): void;
12
13
  export declare function settleEngineInlineTaskStats(cardId: string, isError: boolean): void;
13
14
  export declare function settleAllEngineInlineTaskStats(): void;
14
15
  export declare function getEngineInlineTaskStats(cardId: string): EngineInlineTaskStats | undefined;
@@ -13,7 +13,23 @@ export function publishEngineInlineTaskTick(cardId, tick) {
13
13
  const prev = statsByCardId.get(cardId);
14
14
  if (prev?.done)
15
15
  return;
16
- statsByCardId.set(cardId, { ...tick, done: false, isError: false });
16
+ const { model: tickModel, ...counts } = tick;
17
+ const model = typeof tickModel === 'string' && tickModel.length > 0 ? tickModel : prev?.model;
18
+ statsByCardId.set(cardId, { ...counts, ...(model !== undefined ? { model } : {}), done: false, isError: false });
19
+ emit();
20
+ }
21
+ export function publishEngineInlineTaskModel(cardId, model) {
22
+ if (typeof model !== 'string' || model.length === 0)
23
+ return;
24
+ const prev = statsByCardId.get(cardId);
25
+ if (prev === undefined) {
26
+ statsByCardId.set(cardId, { model, done: false, isError: false });
27
+ }
28
+ else {
29
+ if (prev.model === model)
30
+ return;
31
+ statsByCardId.set(cardId, { ...prev, model });
32
+ }
17
33
  emit();
18
34
  }
19
35
  export function settleEngineInlineTaskStats(cardId, isError) {
@@ -40,7 +56,7 @@ export function getEngineInlineTaskStats(cardId) {
40
56
  export function getSoleLiveEngineInlineTaskStats() {
41
57
  let sole;
42
58
  for (const s of statsByCardId.values()) {
43
- if (s.done)
59
+ if (s.done || s.toolUses === undefined)
44
60
  continue;
45
61
  if (sole !== undefined)
46
62
  return undefined;