@sema-agent/client-core 0.109.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 (123) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/README.md +46 -22
  3. package/dist/adapt/arms.js +20 -7
  4. package/dist/adapter/downstream/eventToSdkMessage.js +11 -6
  5. package/dist/declared/supportFloorDeclared.js +1 -1
  6. package/dist/displayUntrusted.js +132 -14
  7. package/dist/engineErrorCodes.d.ts +3 -0
  8. package/dist/engineErrorCodes.js +3 -0
  9. package/dist/engineHealthFacts.d.ts +9 -0
  10. package/dist/engineHealthFacts.js +21 -1
  11. package/dist/engineInlineTaskStats.d.ts +4 -3
  12. package/dist/engineInlineTaskStats.js +18 -2
  13. package/dist/engineNoticeCodes.d.ts +10 -0
  14. package/dist/engineNoticeCodes.js +33 -1
  15. package/dist/engineRepoint.d.ts +140 -0
  16. package/dist/engineRepoint.js +285 -0
  17. package/dist/engineRowRef.js +2 -0
  18. package/dist/engineSessionMessages.d.ts +2 -1
  19. package/dist/engineSessionMessages.js +5 -0
  20. package/dist/errorSupplementRoles.js +2 -1
  21. package/dist/fleet/fleetProjection.js +3 -2
  22. package/dist/generated/engineFactTables.d.ts +2 -0
  23. package/dist/generated/engineFactTables.js +12 -0
  24. package/dist/generated/sdkFactTables.d.ts +1 -0
  25. package/dist/generated/sdkFactTables.js +4 -0
  26. package/dist/hitl/approvalAskers.d.ts +6 -0
  27. package/dist/hitl/approvalAskers.js +30 -0
  28. package/dist/hitl/approvalCardReasons.js +6 -3
  29. package/dist/hitl/approvalRequestFrameReading.d.ts +7 -0
  30. package/dist/hitl/approvalRequestFrameReading.js +11 -0
  31. package/dist/hitl/approvalResolution.d.ts +8 -1
  32. package/dist/hitl/approvalResolution.js +4 -0
  33. package/dist/hitl/askGateWire.js +0 -2
  34. package/dist/hitl/automaticAnswerVerdict.js +2 -2
  35. package/dist/hitl/decisionConflict.js +6 -3
  36. package/dist/hitl/decisionRefusal.js +1 -0
  37. package/dist/hitl/decisionSend.d.ts +3 -0
  38. package/dist/hitl/decisionSend.js +29 -11
  39. package/dist/hitl/editedApprovalAcceptance.d.ts +25 -0
  40. package/dist/hitl/editedApprovalAcceptance.js +26 -0
  41. package/dist/hitl/frameRouter.js +4 -18
  42. package/dist/hitl/gateLedger.d.ts +0 -4
  43. package/dist/hitl/gateLedger.js +0 -19
  44. package/dist/hitl/hitlBridge.d.ts +1 -0
  45. package/dist/hitl/hitlBridge.js +4 -4
  46. package/dist/hitl/hitlHostSurface.d.ts +1 -0
  47. package/dist/hitl/hitlHostSurface.js +7 -2
  48. package/dist/hitl/hostWithdrawal.d.ts +15 -0
  49. package/dist/hitl/hostWithdrawal.js +38 -0
  50. package/dist/hitl/parkResolver.js +25 -9
  51. package/dist/hitl/persistedRulesWire.js +2 -2
  52. package/dist/hitl/planReviewWire.js +14 -4
  53. package/dist/hitl/sessionPolicyWire.js +6 -4
  54. package/dist/hitl/standingRows.d.ts +1 -0
  55. package/dist/hitl/standingRows.js +15 -1
  56. package/dist/hitl/toolApprovalWire.d.ts +35 -8
  57. package/dist/hitl/toolApprovalWire.js +235 -33
  58. package/dist/hooksWireCaps.js +31 -1
  59. package/dist/hostTurnSettings.d.ts +10 -4
  60. package/dist/hostTurnSettings.js +112 -5
  61. package/dist/i18n/messages.en.d.ts +83 -0
  62. package/dist/i18n/messages.en.js +86 -2
  63. package/dist/i18n/messages.zh.js +96 -2
  64. package/dist/index.d.ts +21 -7
  65. package/dist/index.js +14 -4
  66. package/dist/inheritEnvCapability.js +2 -0
  67. package/dist/inputAuthor.d.ts +16 -0
  68. package/dist/inputAuthor.js +44 -0
  69. package/dist/interruptRefusalNote.d.ts +2 -0
  70. package/dist/interruptRefusalNote.js +17 -0
  71. package/dist/liveModelCatalog.d.ts +2 -0
  72. package/dist/liveModelCatalog.js +21 -7
  73. package/dist/liveQuestionStore.d.ts +4 -1
  74. package/dist/liveQuestionStore.js +12 -3
  75. package/dist/mcpEngineLeg.d.ts +3 -0
  76. package/dist/mcpEngineLeg.js +38 -1
  77. package/dist/mcpPanel.js +2 -0
  78. package/dist/mcpReconnect.d.ts +9 -1
  79. package/dist/mcpReconnect.js +121 -16
  80. package/dist/modelCapabilityProbe.js +4 -3
  81. package/dist/modsFace.d.ts +8 -1
  82. package/dist/modsFace.js +27 -0
  83. package/dist/notifications.d.ts +17 -6
  84. package/dist/notifications.js +67 -19
  85. package/dist/ownKey.d.ts +0 -5
  86. package/dist/ownKey.js +0 -7
  87. package/dist/peerFrames.d.ts +40 -2
  88. package/dist/peerFrames.js +158 -3
  89. package/dist/pluginHooksWire.d.ts +2 -1
  90. package/dist/pluginHooksWire.js +56 -1
  91. package/dist/replayBody.js +10 -2
  92. package/dist/request/taskRequest.d.ts +5 -0
  93. package/dist/request/taskRequest.js +138 -21
  94. package/dist/resumeRefusalCopy.d.ts +1 -3
  95. package/dist/resumeRefusalCopy.js +2 -1
  96. package/dist/retryStatus.d.ts +2 -2
  97. package/dist/retryStatus.js +2 -0
  98. package/dist/seam.d.ts +12 -1
  99. package/dist/seam.js +7 -1
  100. package/dist/seatContract.d.ts +86 -9
  101. package/dist/seatContract.js +196 -7
  102. package/dist/sessionBackground.js +2 -1
  103. package/dist/sessionBackgroundHandoff.js +2 -1
  104. package/dist/sessionEngine.d.ts +2 -0
  105. package/dist/sessionEngine.js +111 -0
  106. package/dist/sessionMemoryStatus.d.ts +2 -1
  107. package/dist/sessionSyncFileHistory.d.ts +4 -0
  108. package/dist/sessionSyncFileHistory.js +28 -0
  109. package/dist/sseIdleTriage.d.ts +13 -1
  110. package/dist/sseIdleTriage.js +24 -6
  111. package/dist/subagent/engineSubagentTail.js +6 -0
  112. package/dist/terminalStatuses.d.ts +1 -0
  113. package/dist/terminalStatuses.js +4 -1
  114. package/dist/turnFailurePresentation.js +9 -2
  115. package/dist/typePins.d.ts +11 -0
  116. package/dist/usageAnalytics.d.ts +17 -0
  117. package/dist/usageAnalytics.js +44 -2
  118. package/dist/wireFailureShape.d.ts +2 -5
  119. package/dist/wireFailureShape.js +10 -20
  120. package/dist/wireRefusalCopy.d.ts +10 -0
  121. package/dist/wireRefusalCopy.js +76 -0
  122. package/docs/INTEGRATION-CLIENTS.md +2126 -20
  123. package/package.json +3 -3
@@ -1,12 +1,13 @@
1
1
  import { ccToolDenialKindForToolEnd, gateOutcomeOf } from '../gateOutcome.js';
2
2
  import { terminalOwnerOf } from '../seam.js';
3
3
  import { isSubFlowSegmentEnd, SEGMENT_END_IDENTITY_KEYS, snapshotSegmentIdentity, snapshotIsSubFlow } from '../adapter/types.js';
4
- import { classifyPeerNotification, renderPeerFrameTranscriptText } from '../peerFrames.js';
4
+ import { classifyPeerNotification, renderPeerFrameTranscriptText, sessionBoxNoticeOf } from '../peerFrames.js';
5
5
  import { dropQueuedNotificationsForRun, freezeTaskNotificationFields, isEngineWorkflowNotified, isWorkflowCompletionCardEnqueued, markEngineWorkflowNotified, noteOwnWorkflowRun, normalizeTaskNotification, noteWorkflowCompletionCardEnqueued, renderTaskNotificationXml, taskNotificationRenderKeys } from '../notifications.js';
6
6
  import { retryStatusFromArm } from '../retryStatus.js';
7
7
  import { steeringInjectedToAttachments } from '../steering.js';
8
8
  import { projectDiagnosticsFrame } from '../diagnostics.js';
9
9
  import { recordEngineToolLabel } from '../engineToolLabelStore.js';
10
+ import { publishEngineInlineTaskModel } from '../engineInlineTaskStats.js';
10
11
  import { applySubagentAlias } from '../subagentContentStore.js';
11
12
  import { readAsyncLaunchedAgentReceipt } from '../toolResult.js';
12
13
  import { recordWorkflowAgentTaskId } from '../workflow.js';
@@ -15,7 +16,8 @@ import { readToolHistoryMismatchKey } from '../toolHistoryMismatch.js';
15
16
  import { isMintedRowCcError, readProviderRejectionResendKey } from '../providerRejection.js';
16
17
  import { rowKindOf } from '../rowKind.js';
17
18
  import { terminalCodedDetailOf } from '../runTerminal.js';
18
- import { contextUsageReadingOf, guardedRead, humanInputAttachmentsOf, humanInputAuthorKeys, ownSnapshotRecord, ownSnapshotWhenTyped, readOwnDataNonEmptyString, readOwnDataValue, promptManifestIdentityOfFrame, promptManifestSectionViewOf, readFrameStringKey, readFrameTrueMark, workflowCompletionExtrasOf } from '../ownKey.js';
19
+ import { contextUsageReadingOf, guardedRead, humanInputAttachmentsOf, ownSnapshotRecord, ownSnapshotWhenTyped, readOwnDataNonEmptyString, readOwnDataValue, promptManifestIdentityOfFrame, promptManifestSectionViewOf, readFrameStringKey, readFrameTrueMark, workflowCompletionExtrasOf } from '../ownKey.js';
20
+ import { humanInputAuthorKeys, runOriginKeys } from '../inputAuthor.js';
19
21
  import { CORE_USER_ATTACHMENT_LABEL_MAX } from '../generated/engineFactTables.js';
20
22
  import { ESCAPE_FACE, paintAndCap, washCredentials } from '../displayUntrusted.js';
21
23
  import { resolveEnginePanelTaskId } from '../engineAgentPanelStore.js';
@@ -328,6 +330,7 @@ const humanInputArm = function* (m) {
328
330
  ...(str(m.eventId) !== undefined ? { eventId: str(m.eventId) } : {}),
329
331
  ...humanInputAttachmentsForChrome(m),
330
332
  ...humanInputAuthorKeys(m),
333
+ ...runOriginKeys(m),
331
334
  });
332
335
  };
333
336
  function humanInputAttachmentsForChrome(m) {
@@ -524,7 +527,7 @@ const compactionStartedArm = function* (m) {
524
527
  ...(eventId !== undefined ? { eventId } : {}),
525
528
  });
526
529
  };
527
- const taskStartedArm = function* (m) {
530
+ const taskStartedArm = function* (m, { cards }) {
528
531
  const str = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
529
532
  const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : undefined);
530
533
  const taskId = str(m.taskId);
@@ -551,6 +554,8 @@ const taskStartedArm = function* (m) {
551
554
  const eventId = str(idSnap.eventId);
552
555
  if (agentType !== undefined && workflowRunId === undefined)
553
556
  recordFleetRowAgentType(taskId, agentType);
557
+ if (model !== undefined && parent !== undefined && workflowRunId === undefined && !cards.has(parent))
558
+ publishEngineInlineTaskModel(parent, model);
554
559
  yield chrome({
555
560
  kind: 'subagent_started',
556
561
  laneProof,
@@ -963,7 +968,7 @@ const resultArm = function* (m, { ctx, idOf, text, cards, panel, flags }) {
963
968
  if (isReplayMarked(m))
964
969
  yield chrome({ kind: 'result_replayed', laneProof: mainLane(), text: RESULT_REPLAYED_TEXT });
965
970
  };
966
- const taskNotificationArm = function* (m, { ctx, idOf, panel, inst }) {
971
+ const taskNotificationArm = function* (m, { ctx, idOf, panel, inst, pass }) {
967
972
  const n = ownSnapshotRecord(guardedRead(() => readOwnDataValue(m, 'notification'))) ?? {};
968
973
  const fields = normalizeTaskNotification(n);
969
974
  if (fields === null)
@@ -983,13 +988,18 @@ const taskNotificationArm = function* (m, { ctx, idOf, panel, inst }) {
983
988
  : {}),
984
989
  });
985
990
  }
986
- const dedupKeys = taskNotificationRenderKeys({
991
+ const peerFrame = classifyPeerNotification(n);
992
+ const baseKeys = taskNotificationRenderKeys({
987
993
  taskId,
988
994
  status: rawStatus,
989
995
  ...(typeof n.seq === 'number' || typeof n.seq === 'string' ? { seq: n.seq } : {}),
990
996
  ...(typeof n.task_type === 'string' ? { taskType: n.task_type } : {}),
991
997
  ...(fields.completionId !== undefined ? { completionId: fields.completionId } : {}),
992
998
  });
999
+ const inboxRunId = peerFrame !== null && peerFrame.lane === 'inbox_notice' ? readFrameStringKey(n, 'eventId') : undefined;
1000
+ const dedupKeys = peerFrame !== null && peerFrame.lane === 'inbox_notice'
1001
+ ? [`${baseKeys[0]}@${inboxRunId !== undefined ? `e:${inboxRunId}` : `p:${pass}`}`, ...baseKeys.slice(1)]
1002
+ : baseKeys;
993
1003
  const sameFrameSeen = inst.hasRenderedNotification(dedupKeys[0]);
994
1004
  const sameCompletionSeen = !sameFrameSeen && dedupKeys.slice(1).some((k) => inst.hasRenderedNotification(k));
995
1005
  for (const k of dedupKeys)
@@ -1010,7 +1020,6 @@ const taskNotificationArm = function* (m, { ctx, idOf, panel, inst }) {
1010
1020
  yield* panel.settleFromNotification(taskId, isCoreTaskNotificationTerminalNotSuccess(rawStatus), bgSessionId);
1011
1021
  }
1012
1022
  }
1013
- const peerFrame = classifyPeerNotification(n);
1014
1023
  if (peerFrame === null && n.task_type !== 'external' && isWorkflowCompletionCardEnqueued(taskId))
1015
1024
  return;
1016
1025
  if (peerFrame === null && n.task_type !== 'external')
@@ -1018,6 +1027,10 @@ const taskNotificationArm = function* (m, { ctx, idOf, panel, inst }) {
1018
1027
  const fact = peerFrame === null ? freezeTaskNotificationFields(fields) : undefined;
1019
1028
  if (sameCompletionSeen)
1020
1029
  return;
1030
+ const rowUuid = idOf(m);
1031
+ const boxNotice = peerFrame === null ? undefined : sessionBoxNoticeOf(peerFrame);
1032
+ if (boxNotice !== undefined)
1033
+ yield chrome({ kind: 'session_box_notice', laneProof: mainLane(), ...boxNotice, rowUuid });
1021
1034
  yield transcript({
1022
1035
  type: 'user',
1023
1036
  message: {
@@ -1029,7 +1042,7 @@ const taskNotificationArm = function* (m, { ctx, idOf, panel, inst }) {
1029
1042
  },
1030
1043
  ],
1031
1044
  },
1032
- uuid: idOf(m),
1045
+ uuid: rowUuid,
1033
1046
  session_id: ctx.sessionId,
1034
1047
  ...(fact !== undefined ? { _sema_task_notification: fact } : {}),
1035
1048
  }, ctx.now());
@@ -5,7 +5,8 @@ import { ccToolDenialKindForToolEnd, gateOutcomeOf, toolInputRewriteOf } from '.
5
5
  import { projectToolRoster, projectToolRosterDelta } from '../../toolRoster.js';
6
6
  import { projectHandsSection } from '../../handsSeam.js';
7
7
  import { readMcpAuthorization, readMcpLiveness } from '../../mcpLiveness.js';
8
- import { contextUsageReadingOf, humanInputAttachmentsOf, humanInputAuthorKeys, guardedRead, markMcpSectionDroppedNamedRows, ownSnapshotTyped, promptManifestIdentityOfFrame, promptManifestSectionViewOf, readFrameStringKey, readFrameTrueMark, readOwnDataFiniteNumber, readOwnDataNonEmptyString, workflowCompletionExtrasOf } from '../../ownKey.js';
8
+ import { contextUsageReadingOf, humanInputAttachmentsOf, guardedRead, markMcpSectionDroppedNamedRows, ownSnapshotTyped, promptManifestIdentityOfFrame, promptManifestSectionViewOf, readFrameStringKey, readFrameTrueMark, readOwnDataFiniteNumber, readOwnDataNonEmptyString, workflowCompletionExtrasOf } from '../../ownKey.js';
9
+ import { humanInputAuthorKeys, runOriginKeys } from '../../inputAuthor.js';
9
10
  import { SEGMENT_END_IDENTITY_KEYS, eventSeq, stripToolUseSideChannels } from '../types.js';
10
11
  import { frozenSet } from '../../frozenSet.js';
11
12
  import { isCoreWorkflowRunTerminal } from '../../terminalStatuses.js';
@@ -72,9 +73,6 @@ function streamEventArm(ctx, event) {
72
73
  const projected = (message) => ({ kind: 'message', message });
73
74
  const nothing = (why) => ({ kind: 'none', why });
74
75
  const dropped = (why, type) => ({ kind: 'dropped', why, type });
75
- function isCompactionStartedFrame(ev) {
76
- return ev.type === 'compaction_started';
77
- }
78
76
  const BEYOND_FLOOR_ARMS = Object.freeze(['cross_boundary_taint', 'approval_complete', 'session_titled']);
79
77
  function isBeyondFloorArm(ev) {
80
78
  const word = ev.type;
@@ -111,8 +109,6 @@ function withEngineIdentity(p, ev, ctx, identityFrame = ev) {
111
109
  return projected(Object.assign({}, env, { uuid: envelopeUuidOf(eventId, env.type), _sema_engine_ref: ref }));
112
110
  }
113
111
  function projectEvent(ev, ctx) {
114
- if (isCompactionStartedFrame(ev))
115
- return compactionStartedProjection(ev, ctx);
116
112
  if (isBeyondFloorArm(ev)) {
117
113
  const word = ev.type;
118
114
  if (word === 'cross_boundary_taint')
@@ -127,6 +123,8 @@ function projectEvent(ev, ctx) {
127
123
  switch (ev.type) {
128
124
  case 'task_started':
129
125
  return taskStartedProjection(ev, ctx);
126
+ case 'compaction_started':
127
+ return compactionStartedProjection(ev, ctx);
130
128
  case 'text_end':
131
129
  return textEndProjection(ev, ctx);
132
130
  case 'reasoning_end':
@@ -955,6 +953,7 @@ function humanInputProjection(ev, ctx) {
955
953
  ...(str(ev.parentToolCallId) !== undefined ? { parentToolCallId: str(ev.parentToolCallId) } : {}),
956
954
  ...attachmentsKey(humanInputAttachmentsOf(ev)),
957
955
  ...humanInputAuthorKeys(ev),
956
+ ...runOriginKeys(ev),
958
957
  })));
959
958
  }
960
959
  function attachmentsKey(rows) {
@@ -974,3 +973,9 @@ export function turnEndUsage(ev) {
974
973
  export function gateKind(gate) {
975
974
  return gate?.kind ?? 'human';
976
975
  }
976
+ const _pinCompaction = [true, true, true, true, true, true, true, true, true, true, true];
977
+ void _pinCompaction;
978
+ const _pinMods = [true, true, true, true, true, true, true, true, true, true, true, true, true, true, true];
979
+ void _pinMods;
980
+ const _pinPrompt = [true, true, true, true, true, true, true, true, true, true];
981
+ void _pinPrompt;
@@ -1,5 +1,5 @@
1
1
  export const DECLARED_SUPPORT_FLOOR = Object.freeze({
2
2
  server: "7.139.0",
3
3
  core: "7.60.0",
4
- sdk: "23.1.0",
4
+ sdk: "25.0.0",
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;
@@ -154,6 +154,9 @@ export declare const APPROVAL_EXPIRED: "approval.expired";
154
154
  export declare function runDeathVerdictNoteOf(code: string | undefined): string | undefined;
155
155
  export declare const CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED = "capability.operator_principals_required";
156
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";
157
160
  export declare function isUnavailableFaceCode(code: string | undefined): boolean;
158
161
  export type OperatorGateRefusal = 'operator_only' | 'operators_unconfigured';
159
162
  export declare function operatorGateRefusalContent(cause: OperatorGateRefusal): string | undefined;
@@ -274,6 +274,9 @@ export function runDeathVerdictNoteOf(code) {
274
274
  }
275
275
  export const CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED = 'capability.operator_principals_required';
276
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';
277
280
  export function isUnavailableFaceCode(code) {
278
281
  return typeof code === 'string' && (code.startsWith('capability.') || code.startsWith('feature.'));
279
282
  }
@@ -42,4 +42,13 @@ export interface EngineHealthFacts {
42
42
  readonly version?: string;
43
43
  readonly dataRoot?: string;
44
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;
45
54
  export declare function readEngineHealthFacts(health: object | null | undefined): EngineHealthFacts;
@@ -1,4 +1,4 @@
1
- import { readOwnDataValue } from './ownKey.js';
1
+ import { ownDataField, readOwnDataValue } from './ownKey.js';
2
2
  const _healthFactsMatchSdk = [true, true, true, true, true, true, true, true, true, true];
3
3
  void _healthFactsMatchSdk;
4
4
  const ENGINE_SIGNAL_KEY = 'engineSignal';
@@ -117,6 +117,26 @@ function guarded(read) {
117
117
  return undefined;
118
118
  }
119
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
+ }
120
140
  export function readEngineHealthFacts(health) {
121
141
  if (!isObject(health))
122
142
  return Object.freeze({});
@@ -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;
@@ -394,6 +394,7 @@ export declare function classifierDenialLimitSentence(facts: Pick<ClassifierDeni
394
394
  export declare function taskLateApprovalSentence(facts: Pick<TaskLateApprovalFactsView, 'toolName'>, lang?: UiLanguage): string | undefined;
395
395
  export declare function taskHaltUnconsumedSentence(facts: Pick<TaskHaltUnconsumedFactsView, 'sessionId' | 'runId'>, lang?: UiLanguage): string | undefined;
396
396
  export declare function steeringParkedInputBlockedSentence(facts: Pick<SteeringParkedInputBlockedFactsView, 'sessionId' | 'runId'>, lang?: UiLanguage): string | undefined;
397
+ export declare function modelCapabilityDowngradedSentence(facts: Pick<ModelCapabilityDowngradedFactsView, 'model' | 'capability' | 'status'>, lang?: UiLanguage): string | undefined;
397
398
  export declare function durableGateUnavailableSentence(facts: Pick<DurableGateUnavailableFactsView, 'source' | 'cause' | 'liveApprover' | 'liveQuestionFace'>, lang?: UiLanguage): string | undefined;
398
399
  export type DiscardedDeliveryPathWord = (typeof CORE_DISCARDED_DELIVERY_PATHS)[number];
399
400
  export interface DeliveryDiscardedFactsView {
@@ -403,6 +404,14 @@ export interface DeliveryDiscardedFactsView {
403
404
  path?: DiscardedDeliveryPathWord;
404
405
  }
405
406
  export declare function readDeliveryDiscarded(notice: {} | null | undefined): DeliveryDiscardedFactsView | undefined;
407
+ export interface ModelCapabilityDowngradedFactsView {
408
+ model: string;
409
+ capability: string;
410
+ status: string;
411
+ sessionId: string;
412
+ runId: string;
413
+ }
414
+ export declare function readModelCapabilityDowngraded(notice: {} | null | undefined): ModelCapabilityDowngradedFactsView | undefined;
406
415
  export declare const ENGINE_NOTICE_FACT_READERS: Readonly<{
407
416
  readonly 'mcp.injection_dropped': typeof readMcpInjectionDrop;
408
417
  readonly 'delegation.ask_unresolvable': typeof readAskUnresolvable;
@@ -444,6 +453,7 @@ export declare const ENGINE_NOTICE_FACT_READERS: Readonly<{
444
453
  readonly 'task.halt_unconsumed': typeof readTaskHaltUnconsumed;
445
454
  readonly 'steering.parked_input_blocked': typeof readSteeringParkedInputBlocked;
446
455
  readonly 'delegation.delivery_discarded': typeof readDeliveryDiscarded;
456
+ readonly 'model.capability_downgraded': typeof readModelCapabilityDowngraded;
447
457
  }>;
448
458
  type FactReaderTable = typeof ENGINE_NOTICE_FACT_READERS;
449
459
  export type EngineNoticeFactsCode = keyof FactReaderTable;
@@ -1417,7 +1417,8 @@ function shownName(v) {
1417
1417
  function shownText(v, max) {
1418
1418
  if (v === undefined)
1419
1419
  return undefined;
1420
- const s = displayUntrusted(v, { max });
1420
+ const whole = displayUntrusted(v);
1421
+ const s = whole.length <= max ? whole : `${displayUntrusted(v, { max: max - 1 })}…`;
1421
1422
  return s.length > 0 ? s : undefined;
1422
1423
  }
1423
1424
  function wordLookup(table, word) {
@@ -1658,6 +1659,21 @@ export function steeringParkedInputBlockedSentence(facts, lang) {
1658
1659
  return undefined;
1659
1660
  }
1660
1661
  }
1662
+ export function modelCapabilityDowngradedSentence(facts, lang) {
1663
+ try {
1664
+ const model = shownName(viewStr(facts, 'model'));
1665
+ const capability = viewStr(facts, 'capability');
1666
+ const status = viewStr(facts, 'status');
1667
+ if (model === undefined || capability === undefined || status === undefined)
1668
+ return undefined;
1669
+ if (capability !== 'image' || status !== 'declared_off')
1670
+ return undefined;
1671
+ return renderMessage(msg('notice.model.capabilityDowngraded.image', { model }), lang);
1672
+ }
1673
+ catch {
1674
+ return undefined;
1675
+ }
1676
+ }
1661
1677
  const DURABLE_MANDATE_CLAUSE = Object.freeze({
1662
1678
  force_durable_gate: 'notice.durableGate.mandate.forceDurableGate',
1663
1679
  durable_approval: 'notice.durableGate.mandate.durableApproval',
@@ -1717,6 +1733,21 @@ function readDeliveryDiscardedOf(notice) {
1717
1733
  const path = typeof pathRaw === 'string' && DISCARDED_DELIVERY_PATH_SET.has(pathRaw) ? pathRaw : undefined;
1718
1734
  return { taskId, taskType, sessionId, ...(path !== undefined ? { path } : {}) };
1719
1735
  }
1736
+ export function readModelCapabilityDowngraded(notice) {
1737
+ return guardedRead(notice, (n) => {
1738
+ const o = userCodeDetail(n, 'model.capability_downgraded');
1739
+ if (o === undefined)
1740
+ return undefined;
1741
+ const model = dataStr(o, 'model');
1742
+ const capability = dataStr(o, 'capability');
1743
+ const status = dataStr(o, 'status');
1744
+ const sessionId = dataStr(o, 'sessionId');
1745
+ const runId = dataStr(o, 'runId');
1746
+ if (model === undefined || capability === undefined || status === undefined || sessionId === undefined || runId === undefined)
1747
+ return undefined;
1748
+ return { model, capability, status, sessionId, runId };
1749
+ });
1750
+ }
1720
1751
  export const ENGINE_NOTICE_FACT_READERS = Object.freeze({
1721
1752
  'mcp.injection_dropped': readMcpInjectionDrop,
1722
1753
  'delegation.ask_unresolvable': readAskUnresolvable,
@@ -1758,6 +1789,7 @@ export const ENGINE_NOTICE_FACT_READERS = Object.freeze({
1758
1789
  'task.halt_unconsumed': readTaskHaltUnconsumed,
1759
1790
  'steering.parked_input_blocked': readSteeringParkedInputBlocked,
1760
1791
  'delegation.delivery_discarded': readDeliveryDiscarded,
1792
+ 'model.capability_downgraded': readModelCapabilityDowngraded,
1761
1793
  });
1762
1794
  const _factReaderTablePin = true;
1763
1795
  void _factReaderTablePin;