orkestrator 2.35.3-beta → 2.35.4-beta

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.
@@ -1094,8 +1094,12 @@ function jsonArrayBytes(count, total) {
1094
1094
  }
1095
1095
  function planOldestFirstTrim(messages, maximumBytes, options = {}) {
1096
1096
  const measure = options.measure ?? encodedJsonBytes;
1097
- const sizes = messages.map((message) => measure(message));
1098
- let measuredValues = sizes.length;
1097
+ const known = options.messageSizes;
1098
+ if (known && known.length !== messages.length) {
1099
+ throw new Error("planOldestFirstTrim: messageSizes must describe every message");
1100
+ }
1101
+ const sizes = known ? known.slice() : messages.map((message) => measure(message));
1102
+ let measuredValues = known ? 0 : sizes.length;
1099
1103
  let total = sizes.reduce((sum, size) => sum + size, 0);
1100
1104
  let count = messages.length;
1101
1105
  let bytes = jsonArrayBytes(count, total);
@@ -1144,7 +1148,7 @@ function planOldestFirstTrim(messages, maximumBytes, options = {}) {
1144
1148
  function jsonStringContentBytes(value) {
1145
1149
  return value ? Buffer2.byteLength(JSON.stringify(value)) - 2 : 0;
1146
1150
  }
1147
- function boundTranscriptInPlace(state, limits) {
1151
+ function boundTranscriptInPlace(state, limits, rowSizes) {
1148
1152
  let changed = false;
1149
1153
  if (state.messages.length > limits.maxMessages) {
1150
1154
  const removed = state.messages.length - limits.maxMessages;
@@ -1159,12 +1163,15 @@ function boundTranscriptInPlace(state, limits) {
1159
1163
  continue;
1160
1164
  const removed = message.parts.length - limits.maxPartsPerMessage;
1161
1165
  message.parts.splice(0, removed);
1166
+ rowSizes?.invalidateRow(message);
1162
1167
  state.droppedParts += removed;
1163
1168
  state.transcriptTruncated = true;
1164
1169
  changed = true;
1165
1170
  }
1166
1171
  state.uncheckedTranscriptBytes = 0;
1167
- const plan = planOldestFirstTrim(state.messages, limits.maxTranscriptBytes);
1172
+ const plan = planOldestFirstTrim(state.messages, limits.maxTranscriptBytes, {
1173
+ messageSizes: rowSizes?.measureRows(state.messages)
1174
+ });
1168
1175
  if (plan.droppedMessages > 0) {
1169
1176
  const dropped = state.messages.splice(0, plan.droppedMessages);
1170
1177
  state.droppedMessages += dropped.length;
@@ -1174,112 +1181,338 @@ function boundTranscriptInPlace(state, limits) {
1174
1181
  }
1175
1182
  if (plan.droppedParts > 0) {
1176
1183
  state.messages[0].parts.splice(0, plan.droppedParts);
1184
+ rowSizes?.invalidateRow(state.messages[0]);
1177
1185
  state.droppedParts += plan.droppedParts;
1178
1186
  state.transcriptTruncated = true;
1179
1187
  changed = true;
1180
1188
  }
1181
1189
  return changed;
1182
1190
  }
1191
+ var VERIFY_REMEMBERED_SIZES = false;
1183
1192
 
1184
- // ../../bridges/pi-bridge/src/transcript.ts
1185
- var TRUNCATION_NOTICE = `
1193
+ class StaleTranscriptSizeError extends Error {
1194
+ constructor(kind, remembered, measured) {
1195
+ super(`Remembered transcript ${kind} size is stale (${remembered} bytes remembered, ` + `${measured} measured): a write path changed it without noting the change`);
1196
+ this.name = "StaleTranscriptSizeError";
1197
+ }
1198
+ }
1186
1199
 
1187
- [output truncated]`;
1188
- var STREAM_BOUND_INTERVAL_BYTES = Math.min(MAX_TRANSCRIPT_BYTES, 1024 * 1024);
1189
- var TRANSCRIPT_LIMITS = {
1190
- maxMessages: MAX_MESSAGES,
1191
- maxPartsPerMessage: MAX_PARTS_PER_MESSAGE,
1192
- maxTranscriptBytes: MAX_TRANSCRIPT_BYTES
1193
- };
1194
- function appendBounded(carrier, current, addition, limit = MAX_MESSAGE_TEXT_BYTES) {
1195
- if (!addition)
1196
- return current;
1197
- if (saturatedText.has(carrier))
1198
- return current;
1199
- const currentBytes = Buffer.byteLength(current);
1200
- const additionBytes = Buffer.byteLength(addition);
1201
- if (currentBytes + additionBytes <= limit)
1202
- return current + addition;
1203
- const available = limit - currentBytes - Buffer.byteLength(TRUNCATION_NOTICE);
1204
- saturatedText.add(carrier);
1205
- if (available <= 0) {
1206
- return current.endsWith(TRUNCATION_NOTICE) ? current : current + TRUNCATION_NOTICE;
1200
+ class TranscriptRowSizes {
1201
+ #rows = new Map;
1202
+ #verify;
1203
+ constructor(options = {}) {
1204
+ this.#verify = options.verify ?? VERIFY_REMEMBERED_SIZES;
1205
+ }
1206
+ invalidate(id) {
1207
+ this.#rows.delete(id);
1208
+ }
1209
+ invalidateRow(row) {
1210
+ const id = rowId(row);
1211
+ if (id !== undefined)
1212
+ this.#rows.delete(id);
1213
+ }
1214
+ clear() {
1215
+ this.#rows.clear();
1216
+ }
1217
+ get size() {
1218
+ return this.#rows.size;
1219
+ }
1220
+ measureRows(messages, measure = encodedJsonBytes) {
1221
+ const previous = this.#rows;
1222
+ const next = new Map;
1223
+ const newest = messages.length - 1;
1224
+ const sizes = messages.map((row, index) => {
1225
+ const id = rowId(row);
1226
+ const known = id === undefined ? undefined : previous.get(id);
1227
+ const follower = messages[index + 1];
1228
+ let bytes;
1229
+ if (index < newest && known?.row === row && known.follower === follower) {
1230
+ bytes = known.bytes;
1231
+ if (this.#verify) {
1232
+ const measured = measure(row);
1233
+ if (measured !== bytes)
1234
+ throw new StaleTranscriptSizeError("row", bytes, measured);
1235
+ }
1236
+ } else {
1237
+ bytes = measure(row);
1238
+ }
1239
+ if (follower && id !== undefined)
1240
+ next.set(id, { row, follower, bytes });
1241
+ return bytes;
1242
+ });
1243
+ this.#rows = next;
1244
+ return sizes;
1207
1245
  }
1208
- return current + sliceToBytes(addition, available) + TRUNCATION_NOTICE;
1209
1246
  }
1210
- function boundText(value, limit) {
1211
- if (Buffer.byteLength(value) <= limit)
1212
- return value;
1213
- const available = Math.max(0, limit - Buffer.byteLength(TRUNCATION_NOTICE));
1214
- return sliceToBytes(value, available) + TRUNCATION_NOTICE;
1247
+ function rowId(row) {
1248
+ const id = row.id;
1249
+ return typeof id === "string" ? id : undefined;
1250
+ }
1251
+
1252
+ class EncodedObjectSizes {
1253
+ #fields = new WeakMap;
1254
+ #verify;
1255
+ constructor(options = {}) {
1256
+ this.#verify = options.verify ?? VERIFY_REMEMBERED_SIZES;
1257
+ }
1258
+ measure(object) {
1259
+ let fields = this.#fields.get(object);
1260
+ if (!fields) {
1261
+ fields = new Map;
1262
+ this.#fields.set(object, fields);
1263
+ }
1264
+ let bytes = 2;
1265
+ let members = 0;
1266
+ for (const key of Object.keys(object)) {
1267
+ const value = object[key];
1268
+ if (value === undefined || typeof value === "function" || typeof value === "symbol") {
1269
+ fields.delete(key);
1270
+ continue;
1271
+ }
1272
+ let valueBytes;
1273
+ if (typeof value === "string") {
1274
+ valueBytes = encodedStringBytes(value, fields.get(key));
1275
+ fields.set(key, { value, bytes: valueBytes });
1276
+ } else {
1277
+ fields.delete(key);
1278
+ valueBytes = encodedJsonBytes(value);
1279
+ }
1280
+ bytes += encodedJsonBytes(key) + 1 + valueBytes;
1281
+ members += 1;
1282
+ }
1283
+ if (fields.size > members) {
1284
+ for (const key of Array.from(fields.keys())) {
1285
+ if (!Object.hasOwn(object, key))
1286
+ fields.delete(key);
1287
+ }
1288
+ }
1289
+ bytes += Math.max(0, members - 1);
1290
+ if (this.#verify) {
1291
+ const measured = encodedJsonBytes(object);
1292
+ if (measured !== bytes)
1293
+ throw new StaleTranscriptSizeError("part", bytes, measured);
1294
+ }
1295
+ return bytes;
1296
+ }
1297
+ }
1298
+ function encodedStringBytes(value, previous) {
1299
+ if (previous) {
1300
+ if (previous.value === value)
1301
+ return previous.bytes;
1302
+ const before = previous.value;
1303
+ if (value.length > before.length && value.startsWith(before)) {
1304
+ const suffix = value.slice(before.length);
1305
+ const high = before.charCodeAt(before.length - 1);
1306
+ const low = suffix.charCodeAt(0);
1307
+ const splitPair = high >= 55296 && high <= 56319 && low >= 56320 && low <= 57343;
1308
+ return previous.bytes + jsonStringContentBytes(suffix) - (splitPair ? 8 : 0);
1309
+ }
1310
+ }
1311
+ return Buffer2.byteLength(JSON.stringify(value));
1312
+ }
1313
+
1314
+ // ../protocol/src/node/bridge-transcript-bounds.ts
1315
+ function createBridgeTranscriptBounds(options) {
1316
+ const limits = {
1317
+ maxMessages: options.maxMessages,
1318
+ maxPartsPerMessage: options.maxPartsPerMessage,
1319
+ maxTranscriptBytes: options.maxTranscriptBytes
1320
+ };
1321
+ const revisedRows = new WeakMap;
1322
+ const rowSizes = new WeakMap;
1323
+ const sizesFor = (state) => {
1324
+ let sizes = rowSizes.get(state);
1325
+ if (!sizes) {
1326
+ sizes = new TranscriptRowSizes;
1327
+ rowSizes.set(state, sizes);
1328
+ }
1329
+ return sizes;
1330
+ };
1331
+ const noteRowRevised = (state, id) => {
1332
+ rowSizes.get(state)?.invalidate(id);
1333
+ if (state.messages.at(-1)?.id === id)
1334
+ return;
1335
+ let rows = revisedRows.get(state);
1336
+ if (!rows) {
1337
+ rows = new RecentlyRevisedRows;
1338
+ revisedRows.set(state, rows);
1339
+ }
1340
+ rows.note(id);
1341
+ };
1342
+ const boundTranscript = (state) => {
1343
+ const rowsBefore = state.messages.slice();
1344
+ const partsBefore = rowsBefore.map((row) => row.parts.length);
1345
+ const trimmed = boundTranscriptInPlace(state, limits, sizesFor(state));
1346
+ if (!trimmed)
1347
+ return false;
1348
+ const offset = rowsBefore.length - state.messages.length;
1349
+ state.messages.forEach((row, index) => {
1350
+ if (row.parts.length < partsBefore[index + offset])
1351
+ noteRowRevised(state, row.id);
1352
+ });
1353
+ return true;
1354
+ };
1355
+ return {
1356
+ streamIntervalBytes: options.streamIntervalBytes,
1357
+ boundTranscript,
1358
+ boundTranscriptForRead(state) {
1359
+ if (state.uncheckedTranscriptBytes === 0)
1360
+ return;
1361
+ if (boundTranscript(state))
1362
+ state.revision += 1;
1363
+ },
1364
+ streamingBoundDue(state) {
1365
+ return state.messages.length > limits.maxMessages || (state.messages.at(-1)?.parts.length ?? 0) > limits.maxPartsPerMessage || state.uncheckedTranscriptBytes >= options.streamIntervalBytes;
1366
+ },
1367
+ chargeTranscript(state, bytes) {
1368
+ if (bytes > 0)
1369
+ state.uncheckedTranscriptBytes += bytes;
1370
+ },
1371
+ noteRowRevised,
1372
+ rowChanged(state, row) {
1373
+ noteRowRevised(state, row.id);
1374
+ state.revision += 1;
1375
+ },
1376
+ forgetRowSize(state, row) {
1377
+ rowSizes.get(state)?.invalidate(row.id);
1378
+ },
1379
+ revisedRowsOverflowVersion(state) {
1380
+ return revisedRows.get(state)?.overflowVersion ?? 0;
1381
+ },
1382
+ revisedRowIds(state) {
1383
+ const ids = revisedRows.get(state)?.ids();
1384
+ return ids && ids.length > 0 ? ids : undefined;
1385
+ },
1386
+ forgetRevisedRows(state) {
1387
+ revisedRows.get(state)?.clear();
1388
+ rowSizes.get(state)?.clear();
1389
+ }
1390
+ };
1215
1391
  }
1216
- function sliceToBytes(value, limit) {
1217
- if (limit <= 0)
1392
+
1393
+ // ../protocol/src/node/bridge-transcript-text.ts
1394
+ import { Buffer as Buffer3 } from "node:buffer";
1395
+ function sliceUtf8(value, maximumBytes) {
1396
+ if (maximumBytes <= 0)
1218
1397
  return "";
1219
- const buffer = Buffer.from(value);
1220
- if (buffer.length <= limit)
1398
+ const buffer = Buffer3.from(value);
1399
+ if (buffer.length <= maximumBytes)
1221
1400
  return value;
1222
- let end = limit;
1401
+ let end = maximumBytes;
1223
1402
  while (end > 0 && (buffer[end] & 192) === 128)
1224
1403
  end -= 1;
1225
1404
  return buffer.subarray(0, end).toString("utf8");
1226
1405
  }
1227
- function boundTranscript(state) {
1228
- const rowsBefore = state.messages.slice();
1229
- const partsBefore = rowsBefore.map((row) => row.parts.length);
1230
- const trimmed = boundTranscriptInPlace(state, TRANSCRIPT_LIMITS);
1231
- if (!trimmed)
1232
- return false;
1233
- const offset = rowsBefore.length - state.messages.length;
1234
- state.messages.forEach((row, index) => {
1235
- if (row.parts.length < partsBefore[index + offset])
1236
- noteRowRevised(state, row.id);
1237
- });
1238
- return true;
1239
- }
1240
- function boundTranscriptForRead(state) {
1241
- if (state.uncheckedTranscriptBytes === 0)
1242
- return;
1243
- if (boundTranscript(state))
1244
- state.revision += 1;
1406
+ function boundUtf8Text(value, maximumBytes, notice) {
1407
+ if (Buffer3.byteLength(value) <= maximumBytes)
1408
+ return value;
1409
+ const available = Math.max(0, maximumBytes - Buffer3.byteLength(notice));
1410
+ return sliceUtf8(value, available) + notice;
1245
1411
  }
1246
- function boundTranscriptDuringStreaming(state) {
1247
- const newest = state.messages.at(-1);
1248
- if (state.messages.length <= MAX_MESSAGES && (newest?.parts.length ?? 0) <= MAX_PARTS_PER_MESSAGE && state.uncheckedTranscriptBytes < STREAM_BOUND_INTERVAL_BYTES) {
1249
- return;
1412
+
1413
+ class BoundedTextAppender {
1414
+ notice;
1415
+ policy;
1416
+ saturated;
1417
+ #noticeBytes;
1418
+ #lengths = new WeakMap;
1419
+ constructor(options) {
1420
+ this.notice = options.notice;
1421
+ this.policy = options.policy;
1422
+ this.saturated = options.saturated ?? new WeakSet;
1423
+ this.#noticeBytes = Buffer3.byteLength(options.notice);
1424
+ }
1425
+ append(current, addition, maximumBytes, owner, saturate = true) {
1426
+ if (owner && saturate && this.saturated.has(owner))
1427
+ return { value: current, truncated: true };
1428
+ if (!addition)
1429
+ return { value: current, truncated: false };
1430
+ const currentBytes = this.byteLength(current, owner);
1431
+ const additionBytes = Buffer3.byteLength(addition);
1432
+ if (currentBytes + additionBytes <= maximumBytes) {
1433
+ const value = current + addition;
1434
+ if (owner) {
1435
+ this.#lengths.set(owner, {
1436
+ value,
1437
+ bytes: concatenatedBytes(current, currentBytes, addition, additionBytes)
1438
+ });
1439
+ }
1440
+ return { value, truncated: false };
1441
+ }
1442
+ if (owner) {
1443
+ this.#lengths.delete(owner);
1444
+ if (saturate)
1445
+ this.saturated.add(owner);
1446
+ }
1447
+ if (this.policy === "append-notice") {
1448
+ const available = maximumBytes - currentBytes - this.#noticeBytes;
1449
+ if (available <= 0) {
1450
+ const value = current.endsWith(this.notice) ? current : current + this.notice;
1451
+ return { value, truncated: true };
1452
+ }
1453
+ return { value: current + sliceUtf8(addition, available) + this.notice, truncated: true };
1454
+ }
1455
+ const contentLimit = Math.max(0, maximumBytes - this.#noticeBytes);
1456
+ const prefix = currentBytes <= contentLimit ? current : sliceUtf8(current, contentLimit);
1457
+ const prefixBytes = prefix === current ? currentBytes : Buffer3.byteLength(prefix);
1458
+ const usable = Math.max(0, contentLimit - prefixBytes);
1459
+ return {
1460
+ value: prefix + sliceUtf8(addition, usable) + sliceUtf8(this.notice, maximumBytes),
1461
+ truncated: true
1462
+ };
1250
1463
  }
1251
- if (boundTranscript(state))
1252
- state.revision += 1;
1253
- }
1254
- function chargeTranscript(state, bytes) {
1255
- if (bytes > 0)
1256
- state.uncheckedTranscriptBytes += bytes;
1257
- }
1258
- var revisedRows = new WeakMap;
1259
- function noteRowRevised(state, id) {
1260
- if (state.messages.at(-1)?.id === id)
1261
- return;
1262
- let rows = revisedRows.get(state);
1263
- if (!rows) {
1264
- rows = new RecentlyRevisedRows;
1265
- revisedRows.set(state, rows);
1464
+ byteLength(value, owner) {
1465
+ const known = owner ? this.#lengths.get(owner) : undefined;
1466
+ if (known && known.value === value)
1467
+ return known.bytes;
1468
+ return Buffer3.byteLength(value);
1266
1469
  }
1267
- rows.note(id);
1268
1470
  }
1269
- function rowChanged(state, row) {
1270
- noteRowRevised(state, row.id);
1271
- state.revision += 1;
1471
+ function concatenatedBytes(left, leftBytes, right, rightBytes) {
1472
+ const high = left.charCodeAt(left.length - 1);
1473
+ const low = right.charCodeAt(0);
1474
+ const splitPair = high >= 55296 && high <= 56319 && low >= 56320 && low <= 57343;
1475
+ return leftBytes + rightBytes - (splitPair ? 2 : 0);
1272
1476
  }
1273
- function revisedRowsOverflowVersion(state) {
1274
- return revisedRows.get(state)?.overflowVersion ?? 0;
1477
+
1478
+ // ../../bridges/pi-bridge/src/transcript.ts
1479
+ var TRUNCATION_NOTICE = `
1480
+
1481
+ [output truncated]`;
1482
+ var STREAM_BOUND_INTERVAL_BYTES = Math.min(MAX_TRANSCRIPT_BYTES, 1024 * 1024);
1483
+ var bounds = createBridgeTranscriptBounds({
1484
+ maxMessages: MAX_MESSAGES,
1485
+ maxPartsPerMessage: MAX_PARTS_PER_MESSAGE,
1486
+ maxTranscriptBytes: MAX_TRANSCRIPT_BYTES,
1487
+ streamIntervalBytes: STREAM_BOUND_INTERVAL_BYTES
1488
+ });
1489
+ var appender = new BoundedTextAppender({
1490
+ notice: TRUNCATION_NOTICE,
1491
+ policy: "append-notice",
1492
+ saturated: saturatedText
1493
+ });
1494
+ function appendBounded(carrier, current, addition, limit = MAX_MESSAGE_TEXT_BYTES) {
1495
+ return appender.append(current, addition, limit, carrier).value;
1275
1496
  }
1276
- function revisedRowIds(state) {
1277
- const ids = revisedRows.get(state)?.ids();
1278
- return ids && ids.length > 0 ? ids : undefined;
1497
+ function boundText(value, limit) {
1498
+ return boundUtf8Text(value, limit, TRUNCATION_NOTICE);
1279
1499
  }
1280
- function forgetRevisedRows(state) {
1281
- revisedRows.get(state)?.clear();
1500
+ var sliceToBytes = sliceUtf8;
1501
+ var boundTranscript = bounds.boundTranscript;
1502
+ var boundTranscriptForRead = bounds.boundTranscriptForRead;
1503
+ function boundTranscriptDuringStreaming(state) {
1504
+ if (!bounds.streamingBoundDue(state))
1505
+ return;
1506
+ if (boundTranscript(state))
1507
+ state.revision += 1;
1282
1508
  }
1509
+ var chargeTranscript = bounds.chargeTranscript;
1510
+ var noteRowRevised = bounds.noteRowRevised;
1511
+ var rowChanged = bounds.rowChanged;
1512
+ var forgetRowSize = bounds.forgetRowSize;
1513
+ var revisedRowsOverflowVersion = bounds.revisedRowsOverflowVersion;
1514
+ var revisedRowIds = bounds.revisedRowIds;
1515
+ var forgetRevisedRows = bounds.forgetRevisedRows;
1283
1516
 
1284
1517
  // ../../bridges/pi-bridge/src/tool-rendering.ts
1285
1518
  function renderToolCall(source) {
@@ -1726,6 +1959,7 @@ var AGENT_INTERACTION_LIMITS = Object.freeze({
1726
1959
  maxSerializedPayloadBytes: 256 * 1024,
1727
1960
  maxIdLength: 512,
1728
1961
  maxProviderValueLength: 4096,
1962
+ maxSourceNameLength: 256,
1729
1963
  maxJournalEntries: 512,
1730
1964
  maxWorkflowSummaries: 64
1731
1965
  });
@@ -1793,6 +2027,19 @@ var LIMITED_HOLD_REASONS = new Set([
1793
2027
  "provider-limit",
1794
2028
  "upstream-may-expire"
1795
2029
  ]);
2030
+ var AGENT_INTERACTION_SOURCE_KINDS = ["mcp-server"];
2031
+ var SOURCE_SCOPE_LABELS = Object.freeze({
2032
+ user: "user settings",
2033
+ project: "project settings",
2034
+ local: "local settings",
2035
+ dynamic: "session settings",
2036
+ plugin: "a plugin",
2037
+ managed: "managed settings",
2038
+ enterprise: "enterprise settings",
2039
+ claudeai: "a claude.ai connector",
2040
+ agent: "an agent definition",
2041
+ sdk: "the agent host"
2042
+ });
1796
2043
  var UNATTENDED_POLICY_INSTRUCTION = "This is a non-interactive build session: no user can answer a provider input request. " + "If input is unavailable or declined, choose the safest likely assumption yourself, " + "state that assumption, and continue. Never treat the absence of a person as authorization.";
1797
2044
  var INTERACTIVE_AGENT_INTERACTION_POLICY = Object.freeze({
1798
2045
  version: AGENT_INTERACTION_POLICY_VERSION,
@@ -1868,8 +2115,11 @@ var REQUEST_KEYS = new Set([
1868
2115
  "createdAt",
1869
2116
  "updatedAt",
1870
2117
  "expiresAt",
1871
- "hold"
2118
+ "hold",
2119
+ "source"
1872
2120
  ]);
2121
+ var SOURCE_KEYS = new Set(["kind", "name", "scope"]);
2122
+ var SOURCE_KINDS = new Set(AGENT_INTERACTION_SOURCE_KINDS);
1873
2123
  var HOLD_KEYS = new Set(["available", "heldAt", "reason"]);
1874
2124
  var HOLD_REASONS = new Set(AGENT_INTERACTION_HOLD_REASONS);
1875
2125
  var PRESENTATION_KEYS = new Set([
@@ -3564,9 +3814,10 @@ function upsertToolPart(state, message, toolCallId) {
3564
3814
  chargeNewEntry(state, part);
3565
3815
  return part;
3566
3816
  }
3817
+ var toolPartSizes = new EncodedObjectSizes;
3567
3818
  function chargeToolPart(state, part) {
3568
3819
  const source = toolSourceStates.get(part) ?? {};
3569
- const size = Buffer.byteLength(JSON.stringify(part));
3820
+ const size = toolPartSizes.measure(part);
3570
3821
  chargeTranscript(state, Math.max(0, size - (source.chargedBytes ?? 0)));
3571
3822
  source.chargedBytes = size;
3572
3823
  toolSourceStates.set(part, source);
@@ -28486,7 +28737,1623 @@ function newSessionState(clientSessionKey, policy) {
28486
28737
  };
28487
28738
  }
28488
28739
 
28740
+ // ../protocol/src/log-error.ts
28741
+ var MAX_MESSAGE_CHARS = 1024;
28742
+ var MAX_STACK_FRAMES = 8;
28743
+ var MAX_FRAME_CHARS = 240;
28744
+ var MAX_RAW_FRAME_CHARS = 1024;
28745
+ var MAX_CAUSE_DEPTH = 2;
28746
+ var TRUNCATED_MARKER = "...[truncated]";
28747
+ var NAME_PATTERN = /^[A-Za-z_$][\w$.-]{0,63}$/;
28748
+ var CODE_PATTERN = /^[\w.:-]{1,64}$/;
28749
+ var SYSCALL_PATTERN = /^[\w./ -]{1,128}$/;
28750
+ var COMMAND_OUTPUT_FIELDS = ["stdout", "stderr", "cmd", "spawnargs"];
28751
+ var safeErrors = new WeakSet;
28752
+ function isSafeLogError(value) {
28753
+ return typeof value === "object" && value !== null && safeErrors.has(value);
28754
+ }
28755
+ function brand(details) {
28756
+ const safe = Object.freeze(details);
28757
+ safeErrors.add(safe);
28758
+ return safe;
28759
+ }
28760
+ function boundedText3(value, maxChars) {
28761
+ const cut = value.length > maxChars ? `${value.slice(0, maxChars - TRUNCATED_MARKER.length)}${TRUNCATED_MARKER}` : value;
28762
+ return redactSecrets(cut).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]+/g, " ").trim();
28763
+ }
28764
+ var FRAME_LOCATION = /(^|[\s(])((?:[a-z][a-z0-9+.-]*:\/\/[^/\s)]*)?(?:\/|[a-z]:[\\/]|\\\\).*?)(?=:\d+(?::\d+)?\)?(?:,|$)|\)(?:,|$)|,\s|$)/gi;
28765
+ var LOCATION_SCHEME = /^([a-z][a-z0-9+.-]*):\/\/[^/\s)]*/i;
28766
+ var APP_PATH = /(?:^|\/)((?:apps\/(?:backend|desktop|web|web-public)|packages\/(?:protocol|cli|toolchain)|bridges\/[\w-]+|[\w-]+-bridge)\/.*)$/;
28767
+ var PACKAGED_PATH = /\/((?:app\.asar(?:\.unpacked)?|resources)\/.*)$/i;
28768
+ function appRelativeLocation(location) {
28769
+ const scheme = LOCATION_SCHEME.exec(location)?.[1]?.toLowerCase();
28770
+ const isWebUrl = scheme !== undefined && scheme !== "file";
28771
+ const withoutOrigin = location.replace(LOCATION_SCHEME, "");
28772
+ const path = (isWebUrl ? withoutOrigin.split(/[?#]/, 1)[0] : withoutOrigin).replace(/\\/g, "/");
28773
+ const modules = path.lastIndexOf("/node_modules/");
28774
+ if (modules >= 0)
28775
+ return path.slice(modules + 1);
28776
+ const app = APP_PATH.exec(path)?.[1] ?? PACKAGED_PATH.exec(path)?.[1];
28777
+ if (app)
28778
+ return app;
28779
+ if (isWebUrl)
28780
+ return path.replace(/^\/+/, "");
28781
+ return `.../${path.slice(path.lastIndexOf("/") + 1)}`;
28782
+ }
28783
+ function relativeFrame(frame) {
28784
+ return frame.slice(0, MAX_RAW_FRAME_CHARS).replace(FRAME_LOCATION, (_match, lead, location) => `${lead}${appRelativeLocation(location)}`);
28785
+ }
28786
+ function read(target, key) {
28787
+ try {
28788
+ return target[key];
28789
+ } catch {
28790
+ return;
28791
+ }
28792
+ }
28793
+ function matching(value, pattern) {
28794
+ return typeof value === "string" && pattern.test(value) ? value : undefined;
28795
+ }
28796
+ function finite(value) {
28797
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
28798
+ }
28799
+ function isCommandFailure(target, name, message) {
28800
+ return name === "CommandFailedError" || Boolean(message?.startsWith("Command failed")) || COMMAND_OUTPUT_FIELDS.some((field) => read(target, field) !== undefined);
28801
+ }
28802
+ function stackFrames(target, message) {
28803
+ const stack = read(target, "stack");
28804
+ if (typeof stack !== "string")
28805
+ return;
28806
+ const index = message ? stack.indexOf(message) : -1;
28807
+ const body = index >= 0 ? stack.slice(index + message.length) : stack;
28808
+ const frames = body.split(`
28809
+ `).filter((line) => /^\s*at\s/.test(line)).slice(0, MAX_STACK_FRAMES).map((line) => boundedText3(relativeFrame(line), MAX_FRAME_CHARS));
28810
+ return frames.length > 0 ? frames : undefined;
28811
+ }
28812
+ function describe2(error, includeStack, depth) {
28813
+ if (typeof error !== "object" || error === null) {
28814
+ return {
28815
+ name: "NonError",
28816
+ message: typeof error === "string" ? boundedText3(error, MAX_MESSAGE_CHARS) : `[${typeof error}]`
28817
+ };
28818
+ }
28819
+ const rawMessage = read(error, "message");
28820
+ if (!(error instanceof Error) && typeof rawMessage !== "string") {
28821
+ return { name: "NonError", message: "[object]" };
28822
+ }
28823
+ const name = matching(read(error, "name"), NAME_PATTERN) ?? "Error";
28824
+ const message = typeof rawMessage === "string" ? rawMessage : undefined;
28825
+ const commandFailure = isCommandFailure(error, name, message);
28826
+ const stackHoldsMessage = message !== undefined && String(read(error, "stack") ?? "").includes(message);
28827
+ const details = { name };
28828
+ if (commandFailure)
28829
+ details.outputOmitted = true;
28830
+ else if (message)
28831
+ details.message = boundedText3(message, MAX_MESSAGE_CHARS);
28832
+ const code = read(error, "code");
28833
+ const safeCode = finite(code) ?? matching(code, CODE_PATTERN);
28834
+ if (safeCode !== undefined)
28835
+ details.code = safeCode;
28836
+ const errno = finite(read(error, "errno"));
28837
+ if (errno !== undefined)
28838
+ details.errno = errno;
28839
+ const syscall = matching(read(error, "syscall"), SYSCALL_PATTERN);
28840
+ if (syscall)
28841
+ details.syscall = syscall;
28842
+ const exitCode = finite(read(error, "exitCode"));
28843
+ if (exitCode !== undefined)
28844
+ details.exitCode = exitCode;
28845
+ const signal = matching(read(error, "signal"), CODE_PATTERN);
28846
+ if (signal)
28847
+ details.signal = signal;
28848
+ if (includeStack && (!commandFailure || stackHoldsMessage || !message)) {
28849
+ const frames = stackFrames(error, message);
28850
+ if (frames)
28851
+ details.stack = frames;
28852
+ }
28853
+ const members = read(error, "errors");
28854
+ if (Array.isArray(members))
28855
+ details.errorCount = members.length;
28856
+ const cause = read(error, "cause") ?? (Array.isArray(members) ? members[0] : undefined);
28857
+ if (cause !== undefined && cause !== null && depth < MAX_CAUSE_DEPTH) {
28858
+ details.cause = describe2(cause, false, depth + 1);
28859
+ }
28860
+ return details;
28861
+ }
28862
+ function formatLogError(error, options = {}) {
28863
+ try {
28864
+ return brand(describe2(error, options.stack !== false, 0));
28865
+ } catch {
28866
+ return brand({ name: "Error", message: "[unreadable]" });
28867
+ }
28868
+ }
28869
+ function logErrorKind(error) {
28870
+ if (typeof error !== "object" || error === null)
28871
+ return "NonError";
28872
+ if (!(error instanceof Error) && typeof read(error, "message") !== "string")
28873
+ return "NonError";
28874
+ const code = read(error, "code");
28875
+ const safeCode = finite(code) ?? matching(code, CODE_PATTERN);
28876
+ if (safeCode !== undefined)
28877
+ return String(safeCode);
28878
+ return matching(read(error, "name"), NAME_PATTERN) ?? "Error";
28879
+ }
28880
+
28881
+ // ../protocol/src/log-vocabulary/define.ts
28882
+ var THROTTLE_LOG_EVENTS = {
28883
+ "throttle.suppressed": "Repeats of the throttled `site` were counted over a window, not written.",
28884
+ "throttle.recovered": "The throttled `site` succeeded again, so its fault has cleared.",
28885
+ "throttle.evicted": "The tracked-key limit dropped the `site`, so no recovered line follows unless it fails again."
28886
+ };
28887
+ function defineLogAreas(areas) {
28888
+ return areas;
28889
+ }
28890
+
28891
+ // ../protocol/src/log-vocabulary/agent-mail.ts
28892
+ var AGENT_MAIL_LOG_AREAS = defineLogAreas({
28893
+ "agent-mail": {
28894
+ description: "Delivering agent mail into waiting agent sessions.",
28895
+ events: {
28896
+ "delivery.waiting": "The drain passed over a pending message, for a reason it had not yet logged."
28897
+ }
28898
+ }
28899
+ });
28900
+
28901
+ // ../protocol/src/log-vocabulary/backend.ts
28902
+ var BACKEND_LOG_AREAS = defineLogAreas({
28903
+ "build.pipeline": {
28904
+ description: "Build delivery, ticket reconciliation and persisted pipeline recovery.",
28905
+ events: {
28906
+ "delivery-policy.failed": "A ticket delivery edit could not be reconciled with the running build.",
28907
+ "criteria.failed": "Verify could not record criterion results on the ticket.",
28908
+ "transcript-maintenance.failed": "Pipeline transcript maintenance failed.",
28909
+ "hydrate.failed": "The renderer could not load the authoritative pipeline snapshot."
28910
+ }
28911
+ },
28912
+ "backend.activity": {
28913
+ description: "The backend's recurring activity and maintenance jobs.",
28914
+ events: {
28915
+ "job.failed": "One pass of the job named in `scope` failed; its next pass retries.",
28916
+ ...THROTTLE_LOG_EVENTS
28917
+ }
28918
+ }
28919
+ });
28920
+
28921
+ // ../protocol/src/log-vocabulary/bridge.ts
28922
+ var MAX_BRIDGE_DIAGNOSTIC_BYTES = 8192;
28923
+ var BRIDGE_LOG_AREAS = defineLogAreas({
28924
+ "bridge.diagnostics": {
28925
+ description: "Metadata snapshots of bridge turns and processes, written while Save Logs for Debugging is on. docs/architecture/bridge-diagnostics.md reads them.",
28926
+ tag: "bridge-diagnostics",
28927
+ maxStringChars: MAX_BRIDGE_DIAGNOSTIC_BYTES,
28928
+ events: {
28929
+ heartbeat: "The once-a-minute snapshot of a turn or process that is still open.",
28930
+ "send-started": "A turn or process diagnostic scope began.",
28931
+ "send-resolved": "The provider accepted a dispatch.",
28932
+ "cancel-requested": "Cancellation of a turn was requested.",
28933
+ "cancel-settled": "The provider's cancel call returned or failed.",
28934
+ closed: "A diagnostic scope ended, with its final counters.",
28935
+ "snapshot-overflow": "A snapshot exceeded the bound, so only its size was written.",
28936
+ "debug-events": "A batch of allowlisted debug labels with their counts.",
28937
+ "setup-failed": "A Cursor setup step failed and swallowed its error.",
28938
+ "sdk-snapshot": "Cursor's SDK transports and executions at a boundary.",
28939
+ "sdk-snapshot-overflow": "A Cursor SDK snapshot exceeded the bound, so it was omitted."
28940
+ }
28941
+ },
28942
+ "bridge.lifecycle": {
28943
+ description: "What every long-lived bridge does the same way: its sweep and its shutdown.",
28944
+ events: {
28945
+ "idle-sweep.failed": "An idle sweep threw; the next tick retries.",
28946
+ "shutdown.failed": "Releasing the bridge failed during shutdown; it still exits."
28947
+ }
28948
+ },
28949
+ "bridge.acp": {
28950
+ description: "The ACP bridge behind Grok: its routes, sessions, saved state and change evidence.",
28951
+ events: {
28952
+ "command-change.record-failed": "A measured command change could not be recorded.",
28953
+ "evidence.record-failed": "Change evidence could not be recorded; the read loop carries on.",
28954
+ "evidence.shell-record-failed": "A shell observation could not be recorded.",
28955
+ "evidence.turn-record-failed": "Turn change evidence could not be recorded.",
28956
+ "server.listening": "The HTTP server is listening.",
28957
+ "state.composer-reset": "A saved composer state was malformed and was reset.",
28958
+ "state.discarded": "Saved bridge state could not be used and was discarded.",
28959
+ "state.persist-failed": "Saving bridge state failed; a later write retries.",
28960
+ "state.session-config-reset": "A saved session configuration was malformed and was reset."
28961
+ }
28962
+ },
28963
+ "bridge.claude": {
28964
+ description: "The Claude bridge: its routes, sessions, parked interactions and the Agent SDK turn loop.",
28965
+ events: {
28966
+ "commands.read-failed": "The command catalogue read failed; the cached answer stands.",
28967
+ "context-usage.read-failed": "The detailed context usage read failed; the route falls back.",
28968
+ "dispatch.rollback-failed": "Rolling back a prompt dispatch claim failed.",
28969
+ "event-subscriber.failed": "An event subscriber threw; other subscribers still ran.",
28970
+ "http.request-failed": "An HTTP route threw; it answered 500.",
28971
+ "mcp.config-ignored": "An MCP server configuration of an unsupported shape was ignored.",
28972
+ "mcp.read-failed": "Listing MCP servers failed; the route answered 500.",
28973
+ "models.fetch-failed": "Reading the supported models failed; the fallback catalogue is served.",
28974
+ "models.requested": "The model catalogue route was called.",
28975
+ "models.responded": "The model catalogue route answered.",
28976
+ "parent.gone": "The backend that launched this bridge has gone; shutting down.",
28977
+ "plan-approval.responding": "Answering a parked plan approval.",
28978
+ "plan-approval.response-failed": "The plan approval route failed.",
28979
+ "plan-approval.response-received": "The route received a plan approval answer.",
28980
+ "plan-approval.result": "A parked plan approval was answered.",
28981
+ "plan-approval.wait-failed": "A parked plan approval ended without an answer: cancelled, timed out or closed.",
28982
+ "plan-exit.failure-overridden": "ExitPlanMode failed after the user approved; treated as success with a continuation re-prompt.",
28983
+ "plan-mode.record-failed": "Plan mode from a status frame could not be recorded.",
28984
+ "plan.reprompt-approved-failed": "Re-prompting after an approved plan failed.",
28985
+ "plan.reprompt-feedback-failed": "Re-prompting with plan rejection feedback failed.",
28986
+ "plugin.path-missing": "A configured plugin was skipped because its path does not exist.",
28987
+ "plugin.unsafe-path": "An installed plugin was skipped because its install path is unsafe.",
28988
+ "plugins.read-failed": "Listing plugins failed; the route answered 500.",
28989
+ "prompt.accepted": "The route accepted a prompt and answered 202.",
28990
+ "prompt.failed": "A prompt turn failed; the session reports the error.",
28991
+ "prompt.processing-failed": "A prompt accepted by the route failed while processing.",
28992
+ "prompt.received": "A prompt reached the bridge; only its length is logged.",
28993
+ "prompt.send-failed": "A prompt request failed; the route answered with an error.",
28994
+ "query.close-failed": "Stopping the Claude query failed while closing a tab; the close stays pending.",
28995
+ "query.failed": "A Claude query ended with an error result.",
28996
+ "question.answer-failed": "The answer-question route failed.",
28997
+ "question.answering": "Answering a parked question.",
28998
+ "question.answers-prepared": "The route prepared a question answer for the session.",
28999
+ "question.answers-received": "A parked question received its answers.",
29000
+ "question.stale": "An answer arrived for a question no longer pending; the route answered stale.",
29001
+ "question.wait-failed": "A parked question ended without an answer: cancelled, timed out or closed.",
29002
+ "runtime.ended-under-resumed-turn": "The Claude runtime ended while a resumed root turn was still open.",
29003
+ "server.listening": "The HTTP server is listening.",
29004
+ "server.starting": "The HTTP server is about to bind.",
29005
+ "session.compact-failed": "A requested compaction failed.",
29006
+ "session.create-failed": "Creating a session failed; the route answered with an error.",
29007
+ "session.created": "A session was created or recovered.",
29008
+ "session.delete-failed": "Deleting a session failed.",
29009
+ "session.fork-failed": "Forking a session failed.",
29010
+ "session.rename-failed": "Renaming a session failed.",
29011
+ "session.resolve-failed": "A session could not be found or loaded for a request; action names the request.",
29012
+ "session.rewind-failed": "Rewinding session files failed.",
29013
+ "session.task-state-hydrate-failed": "Hydrating session task state failed; the route answered with an error.",
29014
+ "sessions.reconcile-failed": "Reconciling persisted sessions failed; the sessions already known are listed.",
29015
+ "sse.aborted": "The client closed an event stream.",
29016
+ "sse.cleanup": "An event stream connection was released.",
29017
+ "sse.closed": "An event stream was closed by the bridge; the client reconnects and replays.",
29018
+ "sse.handshake-failed": "An event stream failed during its handshake; the client reconnects.",
29019
+ "sse.keepalive-failed": "An event stream keepalive failed, usually a client that has gone; the connection closes.",
29020
+ "sse.opened": "An event stream connection opened.",
29021
+ "sse.subscribe-requested": "A client asked to subscribe to the event stream.",
29022
+ "sse.write-failed": "Writing to an event stream failed; the connection closes and the client reconnects.",
29023
+ "task.candidate-bound-reached": "An unresolved Bash call was not tracked as a background task: the candidate bound is full.",
29024
+ "task.details-persist-failed": "Shell task details could not be saved; the task carries on.",
29025
+ "task.settling-bound-reached": "A settling task was not tracked: the settling bound is full.",
29026
+ "task.stop-failed": "Stopping a background task failed on a control channel that had closed.",
29027
+ "task.stop-route-failed": "The stop-task route failed.",
29028
+ "transcript.background-hydrate-failed": "Hydrating a transcript in the background failed; the next read retries.",
29029
+ "transcript.hydrate-failed": "Hydrating a transcript before a prompt failed; the prompt runs and a later read retries."
29030
+ }
29031
+ },
29032
+ "bridge.codex": {
29033
+ description: "The Codex bridge: its routes, sessions and the app-server child it supervises.",
29034
+ events: {
29035
+ "account.connector-recovery-failed": "Recovering account connectors failed; the account answer stands.",
29036
+ "account.login-reload-failed": "Reloading the stored account login failed.",
29037
+ "account.sign-in-check-failed": "An account sign-in check failed; admission is left unchanged.",
29038
+ "account.usage-read-failed": "Reading account usage failed; the route answers 503.",
29039
+ "app-server.drain-expired": "The drain deadline expired, so app-server restarted with turns still in flight.",
29040
+ "app-server.exited": "app-server exited unexpectedly; the code and signal say how.",
29041
+ "app-server.invariant-violation": "app-server asked for something its configuration forbids.",
29042
+ "app-server.protocol-violation": "app-server wrote a line that is not valid protocol; it was ignored.",
29043
+ "app-server.recording": "Notification recording is on; recordings hold content.",
29044
+ "app-server.stale-reaped": "A stale app-server left by an earlier bridge was stopped.",
29045
+ "app-server.stderr": "Metadata of an app-server stderr line, never its content.",
29046
+ "app-server.stderr-suppressed": "app-server stderr lines beyond the budget were counted, not described.",
29047
+ "approval.cancel-failed": "Cancelling a turn after an approval answer failed.",
29048
+ "approval.present-failed": "Presenting an approval threw; it is auto-declined.",
29049
+ "approval.resolved-callback-failed": "An approval resolved callback threw.",
29050
+ "command-changes.record-failed": "Recording line changes for a command failed; the turn carries on.",
29051
+ "dispatch.reconcile-failed": "A dispatch could not be reconciled against its thread; it stays recovering.",
29052
+ "dispatch.restore-failed": "A journaled dispatch could not be restored after a restart; recovery retries.",
29053
+ "engine.listener-failed": "An engine event listener threw; the others still ran.",
29054
+ "engine.ready": "The app-server engine started.",
29055
+ "engine.start-failed": "The app-server engine failed to start; reported through health.",
29056
+ "engine.stop-failed": "Stopping the Codex engine failed during shutdown; the bridge exits anyway.",
29057
+ "generation.recovery-failed": "Recovering sessions after an app-server generation change failed.",
29058
+ "http.request-failed": "An HTTP route threw; it answered 500.",
29059
+ "idle-sweep.failed": "An idle sweep failed; the next one retries.",
29060
+ "interaction.present-failed": "Presenting an interaction threw; it is cancelled.",
29061
+ "interaction.resolved-callback-failed": "An interaction resolved callback threw.",
29062
+ "journal.persist-failed": "Saving the dispatch journal failed.",
29063
+ "message.publish-failed": "Publishing a message update failed.",
29064
+ "models.cache-persist-failed": "Saving the model cache failed.",
29065
+ "models.debug-read-failed": "`codex debug models` failed; another source is used.",
29066
+ "models.list-failed": "model/list failed; the cached models are served.",
29067
+ "models.refresh-failed": "A background model refresh failed; the cache stands.",
29068
+ "notification.enqueue-failed": "Queueing a notification threw.",
29069
+ "ordered-events.flush-failed": "Flushing before ordered-event reconciliation failed.",
29070
+ "ordered-events.publish-failed": "Publishing an ordered event failed; clients are told to rehydrate.",
29071
+ "ordered-events.reconcile-failed": "Reconciling ordered events failed.",
29072
+ "parent.gone": "The backend that launched this bridge has gone; stopping turns and shutting down.",
29073
+ "queue.task-failed": "A task on a per-thread queue failed.",
29074
+ "raw-log.write-failed": "Appending to the raw Codex log failed.",
29075
+ "recorder.notice": "The notification recorder needs attention: it is on, or was asked for without its confirmation.",
29076
+ "recorder.threw": "The notification recorder threw.",
29077
+ "recorder.write-failed": "Writing a notification recording failed; its lines were dropped.",
29078
+ "registry.persist-failed": "Saving the session registry failed; a later write retries.",
29079
+ "rollout.hydrate-failed": "A rollout could not be read to hydrate a thread.",
29080
+ "runtime-env.refresh-failed": "Refreshing the runtime environment failed; the last values stay.",
29081
+ "runtime-env.refreshed": "Runtime environment variables changed; names only, never values.",
29082
+ "server-request.answer-failed": "Answering a server request failed.",
29083
+ "server-request.flush-timeout": "An answer to a server request did not flush in time.",
29084
+ "server-request.handoff-failed": "Handing a server request to the router threw.",
29085
+ "session.config-apply-failed": "Applying session configuration failed; the route answers unavailable.",
29086
+ "sse.closed": "An event stream was closed by the bridge; the client reconnects and replays.",
29087
+ "sse.keepalive-failed": "An event stream keepalive failed.",
29088
+ "sse.observer-failed": "An event stream observer failed; it reconnects.",
29089
+ "sse.payload-serialize-failed": "An event payload could not be serialized; a placeholder was sent.",
29090
+ "sse.payload-snapshot-failed": "An event payload could not be snapshotted; a placeholder was sent.",
29091
+ "sse.subscriber-failed": "An event stream subscriber failed; it reconnects and replays.",
29092
+ "subagent.activity-load-failed": "Sub-agent activity could not be loaded; the transcript renders without it.",
29093
+ "thread.archive-failed": "Archiving or unarchiving a thread failed.",
29094
+ "thread.fork-failed": "thread/fork failed; the route answers 503.",
29095
+ "thread.fork-hydrate-failed": "A forked thread could not be hydrated and was closed.",
29096
+ "thread.reattach-failed": "A thread could not be re-attached.",
29097
+ "thread.rename-failed": "thread/name/set failed; the bridge title index stays authoritative.",
29098
+ "thread.turns-read-after-revert-failed": "A thread's turns could not be read after a revert.",
29099
+ "thread.turns-read-failed": "A thread's turns could not be read.",
29100
+ "thread.unsubscribe-failed": "thread/unsubscribe failed; the binding is kept so a retry can unsubscribe.",
29101
+ "threads.list-failed": "thread/list failed; sessions come from the rollout parser.",
29102
+ "transcript.serving-last-known": "A thread read failed, so the last known transcript is served.",
29103
+ "turn.capacity-retry-failed": "Retrying a turn after a capacity failure failed.",
29104
+ "turn.capacity-retry-journal-failed": "A capacity retry could not be journaled.",
29105
+ "turn.finalize-failed": "Finalizing a turn failed.",
29106
+ "turns.stopped": "Running turns were stopped because the backend went away."
29107
+ }
29108
+ },
29109
+ "bridge.cursor": {
29110
+ description: "The Cursor bridge: its routes, sessions and saved state.",
29111
+ events: {
29112
+ "agent.archive-failed": "Archiving or unarchiving an agent failed.",
29113
+ "http.route-failed": "An HTTP route failed unexpectedly; its error is not logged because it can hold content.",
29114
+ "startup.closes-failed": "Finishing closes a previous process left behind failed at startup.",
29115
+ "startup.closes-incomplete": "Some closes a previous process left behind did not finish at startup; a retried close finishes them.",
29116
+ "state.publication-failing": "Saving bridge state is failing; new prompts and steers are refused until it recovers.",
29117
+ "state.publication-recovered": "Saving bridge state recovered.",
29118
+ "state.transcripts-shortened": "The state file reached its limit, so some sessions were saved with a shortened transcript copy."
29119
+ }
29120
+ },
29121
+ "bridge.pi": {
29122
+ description: "The Pi bridge: its routes, sessions and saved state.",
29123
+ events: {
29124
+ "http.route-failed": "An HTTP route failed unexpectedly; its error is not logged because it can hold content.",
29125
+ "state.over-budget": "The state file stayed over budget after shedding transcripts, so the write was skipped.",
29126
+ "state.transcripts-shed": "The state file was over budget, so some sessions were saved without their transcript."
29127
+ }
29128
+ }
29129
+ });
29130
+
29131
+ // ../protocol/src/log-vocabulary/desktop.ts
29132
+ var DESKTOP_LOG_AREAS = defineLogAreas({
29133
+ desktop: {
29134
+ description: "The Electron main process: startup, windows, quit and the Local backend's life.",
29135
+ events: {
29136
+ "backend.docker-context-seed-failed": "An agent-test profile fell back to the default Docker context.",
29137
+ "backend.exited": "The Local backend exited unexpectedly; Local work is unavailable.",
29138
+ "backend.exited-recovering": "The Local backend exited just after a remote update; relaunching unattended.",
29139
+ "backend.keychain-link-remove-failed": "An agent-test profile kept a legacy link to the host keychain.",
29140
+ "backend.start-failed": "The Local backend did not start; continuing with remote machines.",
29141
+ "clipboard.write-failed": "Writing text to the system clipboard failed.",
29142
+ "instance.already-running": "Another instance holds this data directory; this one will quit.",
29143
+ "main-thread.stalled": "A timer fired late, so windows, IPC and the stdout reader waited.",
29144
+ "quit.stopping-backend": "The app is quitting and has asked the Local backend to stop.",
29145
+ "relaunch.schedule-failed": "The AppImage relaunch waiter failed; using Electron's relauncher.",
29146
+ "relaunch.service-register-failed": "The AppImage relaunch service was refused; using a detached waiter.",
29147
+ "renderer.gone-giving-up": "A renderer kept dying, so the window is no longer reloaded.",
29148
+ "renderer.gone-reloading": "A renderer died and the window is being reloaded.",
29149
+ "renderer.reload-failed": "Reloading a window after its renderer died failed.",
29150
+ "restart-prompt.failed": "A native restart prompt could not be shown.",
29151
+ "saved-machines.attach-failed": "Saved machines were not imported into the command node yet.",
29152
+ "saved-machines.attached": "Saved machines were imported into the local command node.",
29153
+ "startup.failed": "The application failed to start.",
29154
+ "uncaught-exception": "The main process hit an uncaught exception.",
29155
+ "uncaught-exception.dialog-failed": "The uncaught exception sheet could not be shown.",
29156
+ "window.create-failed": "A menu-driven new window could not be created.",
29157
+ "window.recreate-failed": "The main window could not be recreated on activation.",
29158
+ "window.second-launch-failed": "A second launch could not open a window."
29159
+ }
29160
+ },
29161
+ "desktop.startup": {
29162
+ description: "Renderer startup markers and renderer process failures. These are the only events the renderer can place in the persistent log.",
29163
+ tag: "DesktopStartup",
29164
+ events: {
29165
+ "backend-unavailable": "The renderer could not complete a Local backend read in time.",
29166
+ "bridge-unavailable": "The preload API or connection-list IPC did not answer.",
29167
+ checking: "The renderer began waiting for the desktop connection.",
29168
+ "page-load-failed": "Chromium failed to load the main document.",
29169
+ "preload-failed": "Electron rejected the preload script.",
29170
+ ready: "The renderer reached the desktop connection and may mount the workspace.",
29171
+ "renderer-error": "An uncaught error occurred while the renderer was starting.",
29172
+ "renderer-gone": "A renderer process exited.",
29173
+ "renderer-load-failed": "Importing or mounting the application failed.",
29174
+ "unhandled-rejection": "An unhandled rejection occurred while the renderer was starting."
29175
+ }
29176
+ },
29177
+ "desktop.dialog": {
29178
+ description: "Native dialogs, whose modal loops hold the main thread while they are open.",
29179
+ events: {
29180
+ "attention-failed": "A dialog could not ask for the user's attention.",
29181
+ closed: "A native dialog closed.",
29182
+ "open-failed": "A dialog could not open; it was answered as cancelled.",
29183
+ opening: "A native dialog is opening.",
29184
+ "preview-beforeunload-ignored": "A browser preview's beforeunload handler was ignored.",
29185
+ "renderer-beforeunload-cancelled": "A renderer's beforeunload handler cancelled an unload."
29186
+ }
29187
+ },
29188
+ "backend.client": {
29189
+ description: "The desktop's HTTP and event stream client for a backend.",
29190
+ events: {
29191
+ "event-stream.disconnected": "The event stream dropped; the client reconnects with backoff.",
29192
+ "event-stream.malformed-frame": "An event stream frame could not be parsed and was dropped."
29193
+ }
29194
+ },
29195
+ connections: {
29196
+ description: "The desktop's saved machines and active connection.",
29197
+ events: {
29198
+ "catalogue.legacy-read-failed": "The previous connection list could not be read to migrate.",
29199
+ "catalogue.restored-from-backup": "The device catalogue was unreadable; the backup was used.",
29200
+ "restore.failed": "The previous remote connection could not be restored; using Local.",
29201
+ "secure-storage.waiting": "Startup is waiting on an operating system keychain prompt."
29202
+ }
29203
+ },
29204
+ workspaces: {
29205
+ description: "Workspace realms the desktop holds on other machines.",
29206
+ events: {
29207
+ "route.moved-direct": "A relayed workspace moved to its direct route."
29208
+ }
29209
+ },
29210
+ toolchain: {
29211
+ description: "Preparing the pinned agent toolchain at desktop startup.",
29212
+ events: {
29213
+ "bootstrap-progress.show-failed": "The toolchain progress window could not be shown.",
29214
+ "prepare.failed": "Preparing the pinned agent tools failed."
29215
+ }
29216
+ },
29217
+ "artifact-host": {
29218
+ description: "Live artifact hosts in the desktop app.",
29219
+ events: {
29220
+ "host.ended": "A host ended; fields count its blocked and rejected requests by reason."
29221
+ }
29222
+ }
29223
+ });
29224
+
29225
+ // ../protocol/src/log-vocabulary/environment.ts
29226
+ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
29227
+ environment: {
29228
+ description: "Environment naming, held setup and cleanup after deletion.",
29229
+ events: {
29230
+ "cleanup.branch-kept": "A deleted environment's local branch was kept, as it may hold unmerged work.",
29231
+ "rename.failed": "Naming an environment from its pending prompt failed for the first time.",
29232
+ "rename.still-failing": "That rename is still failing; written at the 2nd, 4th, 8th... failure.",
29233
+ "rename.recovered": "A rename from a pending prompt succeeded after failing.",
29234
+ "setup.attention-not-recorded": "Held setup could not be recorded as needing the user's attention.",
29235
+ "setup.coordinator-not-notified": "The worker's coordinator could not be told that its setup is held for approval.",
29236
+ "setup.unknown-environment": "The renderer was asked to act on the setup of an environment it does not hold.",
29237
+ ...THROTTLE_LOG_EVENTS
29238
+ }
29239
+ }
29240
+ });
29241
+
29242
+ // ../protocol/src/log-vocabulary/gateway.ts
29243
+ var GATEWAY_LOG_AREAS = defineLogAreas({
29244
+ gateway: {
29245
+ description: "The remote gateway other devices and browsers connect through.",
29246
+ events: {
29247
+ "remote.start-failed": "The desktop could not start the remote gateway.",
29248
+ "remote.stop-failed": "The desktop could not stop the remote gateway cleanly."
29249
+ }
29250
+ }
29251
+ });
29252
+
29253
+ // ../protocol/src/log-vocabulary/local-server.ts
29254
+ var LOCAL_SERVER_LOG_AREAS = defineLogAreas({
29255
+ "local-server": {
29256
+ description: "Agent bridge processes the backend runs on the host.",
29257
+ events: {
29258
+ "bridge.not-answering": "A bridge with work in progress fails health checks, so it is not restarted yet.",
29259
+ ...THROTTLE_LOG_EVENTS
29260
+ }
29261
+ }
29262
+ });
29263
+
29264
+ // ../protocol/src/log-vocabulary/git.ts
29265
+ var GIT_LOG_AREAS = defineLogAreas({
29266
+ git: {
29267
+ description: "Git operations the backend runs in environment worktrees and containers.",
29268
+ events: {
29269
+ "branch.rename-failed": "Renaming an environment's branch failed; the stored name is kept.",
29270
+ "branch.push-config-failed": "A branch was renamed but its push settings could not be written; the rename is undone.",
29271
+ "branch.rollback-failed": "Undoing a branch rename failed; the stored name follows whichever branch now exists."
29272
+ }
29273
+ }
29274
+ });
29275
+
29276
+ // ../protocol/src/log-vocabulary/logging.ts
29277
+ var LOGGING_LOG_AREAS = defineLogAreas({
29278
+ logging: {
29279
+ description: "The logger and the on-disk application log themselves.",
29280
+ events: {
29281
+ "capture.started": "Saving logs to disk began for this process.",
29282
+ "capture.stopped": "Saving logs to disk stopped for this process.",
29283
+ "config.invalid": "A logging environment variable held a value that was ignored.",
29284
+ "entries.dropped": "The log queue was full, so entries were dropped and counted.",
29285
+ "policy.changed": "The logging settings changed: saving, retention and levels, with no content.",
29286
+ "policy.bridge-predates-route": "A running bridge has no logging settings route; it applies them at its next start.",
29287
+ "policy.push-failed": "A running bridge did not take the logging settings after retries; its next start resends them.",
29288
+ "prune.failed": "Removing expired log files failed; the next sweep retries.",
29289
+ "write.failed": "Appending to the log file failed.",
29290
+ "unknown-area": "Code outside the type checker asked for an area that is not listed."
29291
+ }
29292
+ }
29293
+ });
29294
+
29295
+ // ../protocol/src/log-vocabulary/models.ts
29296
+ var MODEL_LOG_AREAS = defineLogAreas({
29297
+ models: {
29298
+ description: "Agent model catalogues and their persistent caches.",
29299
+ events: {
29300
+ "cache.write-failed": "A successful catalogue refresh could not update the host cache."
29301
+ }
29302
+ }
29303
+ });
29304
+
29305
+ // ../protocol/src/log-vocabulary/native-agent.ts
29306
+ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
29307
+ "native-agent": {
29308
+ description: "Native agent sessions and what the backend reads from their bridges.",
29309
+ events: {
29310
+ "catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
29311
+ ...THROTTLE_LOG_EVENTS
29312
+ }
29313
+ }
29314
+ });
29315
+
29316
+ // ../protocol/src/log-vocabulary/preview.ts
29317
+ var PREVIEW_LOG_AREAS = defineLogAreas({
29318
+ preview: {
29319
+ description: "Browser and service previews: transports, partitions and captures.",
29320
+ events: {
29321
+ "attachment.release-failed": "Releasing a preview attachment failed; its lease expires it.",
29322
+ "capture-spool.load-failed": "The pending browser capture spool could not be loaded.",
29323
+ "certificate.refresh-failed": "Re-reading the preview certificate failed; the next check retries.",
29324
+ "certificate.renewal-refused": "A renewed certificate does not cover the preview hosts, so it was ignored.",
29325
+ "connection-cleanup.record-failed": "A forgotten connection's cleanup could not be recorded.",
29326
+ "link.open-external-failed": "A preview link could not be opened in the system browser.",
29327
+ "node.record-failed": "A node that owns preview partitions could not be recorded.",
29328
+ "partition.clear-failed": "A preview partition could not be cleared.",
29329
+ "partitions.record-cleared-failed": "Cleared preview partitions could not be recorded.",
29330
+ "partitions.record-nodes-failed": "The nodes that own preview partitions could not be saved.",
29331
+ "partitions.remove-failed": "Cleared preview partition directories could not be removed.",
29332
+ "partitions.retry-forgotten-failed": "Retrying a forgotten preview cleanup failed.",
29333
+ "port-hints.persist-failed": "Preview port hints could not be saved.",
29334
+ "transport.close-failed": "A preview transport could not be closed.",
29335
+ ...THROTTLE_LOG_EVENTS
29336
+ }
29337
+ }
29338
+ });
29339
+
29340
+ // ../protocol/src/log-vocabulary/runtime.ts
29341
+ var RUNTIME_LOG_AREAS = defineLogAreas({
29342
+ "event-loop": {
29343
+ description: "This process's event loop. A stall of 10 seconds or more is written at error, so no level hides it.",
29344
+ events: {
29345
+ stalled: "A timer fired late, so every request in that window waited."
29346
+ }
29347
+ }
29348
+ });
29349
+
29350
+ // ../protocol/src/log-vocabulary/terminal.ts
29351
+ var TERMINAL_LOG_AREAS = defineLogAreas({
29352
+ terminal: {
29353
+ description: "The renderer's terminal. Its lines stay in the browser console, never the saved log.",
29354
+ events: {
29355
+ "input.undelivered": "A keystroke did not reach a shell: `no-session` or `not-delivered`.",
29356
+ "input.resume-failed": "Asking the backend to resume refused terminal input failed.",
29357
+ "input.write-failed": "Writing input to a terminal session threw.",
29358
+ "listener.remove-failed": "Removing a terminal output listener threw.",
29359
+ "listener.released": "A terminal hook unmounted and dropped its output listener.",
29360
+ "session.unmounted": "A terminal hook unmounted; the shell keeps running.",
29361
+ "connect.called": "A terminal hook began connecting to a session.",
29362
+ "output.reconcile-failed": "Output could not be reconciled against the backend snapshot.",
29363
+ "session.stopped-while-disconnected": "A session ended while its event stream was down.",
29364
+ "session.disconnect-failed": "Closing or detaching a terminal session failed.",
29365
+ "session.resize-failed": "Resizing a terminal session failed, other than for a gone session.",
29366
+ "session.id-stored": "A new backend session id was saved for a terminal tab.",
29367
+ "session-key.environment-missing": "A local session key was built with no environment id.",
29368
+ "clipboard.image-failed": "An image pasted into a terminal could not be saved.",
29369
+ "clipboard.copy-failed": "Copying a terminal selection to the clipboard failed.",
29370
+ "clipboard.paste-failed": "A paste into a terminal failed; `target` says which path.",
29371
+ "clipboard.process-failed": "Reading or storing clipboard data for a paste failed.",
29372
+ "clipboard.image-save-failed": "An image from a paste event could not be written to disk.",
29373
+ "environment.ready-detected": "A first tab's output showed that the workspace is ready.",
29374
+ "shell.ready-detected": "A later tab's output showed that its shell is ready.",
29375
+ "setup.scripts-completed": "A setup tab's scripts reported their end by an escape code.",
29376
+ "setup.marked-complete": "The user marked a setup tab complete by hand.",
29377
+ "setup.awaiting-detection": "A first tab connected and is watching output for readiness.",
29378
+ "reconnect.setup-marker-found": "A reconnected tab's buffer already held the setup marker.",
29379
+ "reconnect.setup-marker-absent": "A reconnected first tab's buffer lacked the setup marker.",
29380
+ "reconnect.completed": "A terminal tab finished reconnecting to its session.",
29381
+ "restore.setup-marker-found": "A restored tab's buffer already held the setup marker.",
29382
+ "persistent-sessions.load-failed": "Listing an environment's saved sessions failed.",
29383
+ "persistent-session.restoring": "A tab began restoring from its saved session.",
29384
+ "persistent-session.found": "A tab found its saved session already recorded.",
29385
+ "persistent-session.creating": "A tab began recording a saved session for the sidebar.",
29386
+ "persistent-session.created": "A saved session for the sidebar was recorded.",
29387
+ "persistent-session.create-failed": "Recording a saved session for the sidebar failed.",
29388
+ "persistent-session.status-update-failed": "Marking a saved session connected failed.",
29389
+ "persistent-session.activity-update-failed": "Updating a saved session's activity failed.",
29390
+ "persistent-buffer.loaded": "A saved session's buffer loaded; only its length is logged.",
29391
+ "persistent-buffer.load-failed": "A saved session's buffer could not be loaded.",
29392
+ "persistent-buffer.save-failed": "Saving a session's buffer during cleanup failed.",
29393
+ "buffer.restore-failed": "Writing a saved buffer back into a terminal threw.",
29394
+ "buffer.serialize-failed": "Serializing a terminal's buffer during cleanup threw.",
29395
+ "command.launching": "A tab began launching its command in a new session.",
29396
+ "bootstrap.failed": "A launch request for a new session failed; it may retry.",
29397
+ "setup-session.bind-failed": "Looking up or binding the backend setup session failed.",
29398
+ "setup-tab.stale-removed": "A setup placeholder tab with no session was removed.",
29399
+ "multi-reviews.restore-failed": "Multi-review tabs could not be restored for an environment.",
29400
+ "pane-layout.restore-failed": "An environment's saved pane layout could not be read.",
29401
+ "pane-layout.history-migrate-failed": "Stripping private browser history fields failed.",
29402
+ "pane-layout.snapshot-remove-failed": "Removing an unusable pane layout snapshot failed.",
29403
+ "pane-layout.selection-migrate-failed": "Saving a migrated legacy pane selection failed.",
29404
+ "panes.reset": "An environment's panes were reset: its container changed or stopped.",
29405
+ "tabs.limit-reached": "A new tab was refused because the tab limit was reached.",
29406
+ "tab.created": "A new tab was added to a pane; `tabType` says which kind.",
29407
+ "tab.activated": "Opening a file selected the tab that already held it.",
29408
+ "tab.duplicate-refused": "A new tab was refused because its requested id is in use.",
29409
+ "tab.multi-review-refused": "A multi-review tab was refused for lack of a workflow id.",
29410
+ "tab.split-at-edge": "A dragged tab split a pane at one of its edges.",
29411
+ "tab.reordered": "A dragged tab moved within its pane.",
29412
+ "tab.moved": "A dragged tab moved to another pane.",
29413
+ "drag.ended": "A tab drag ended, whether or not it landed on a target.",
29414
+ "display.state": "The terminal container's overlays and tab count, on each dev render.",
29415
+ "compose.draft-restore-failed": "A saved compose draft could not be read.",
29416
+ "compose.draft-persist-failed": "A compose draft could not be saved or discarded.",
29417
+ "compose.image-too-large": "A pasted image stayed over the attachment limit after resizing.",
29418
+ "compose.image-add-failed": "Adding a pasted image to the compose bar failed.",
29419
+ "compose.image-save-failed": "Saving one compose image for sending failed; the rest proceed.",
29420
+ "compose.send-failed": "Sending from the compose bar failed.",
29421
+ "init-logs.load-failed": "A container's initialization logs could not be loaded.",
29422
+ "init-logs.refresh-stopped": "A container's initialization logs stopped refreshing.",
29423
+ "portal.terminal-created": "The portal host created a terminal for a new tab.",
29424
+ "portal.terminal-disposed": "The portal host disposed a terminal for a removed tab.",
29425
+ "link.open-failed": "Opening a terminal link in the external browser failed.",
29426
+ "canvas.context-unavailable": "A resize canvas had no 2D context; the original is kept.",
29427
+ ...THROTTLE_LOG_EVENTS
29428
+ }
29429
+ },
29430
+ "terminal.setup": {
29431
+ description: "The renderer attaching a backend-managed environment setup terminal.",
29432
+ events: {
29433
+ "session.bind-from-environment": "The environment hook bound a setup session to a tab.",
29434
+ "setup.started-received": "An environment-setup-started event arrived.",
29435
+ "setup.complete-received": "An environment-setup-complete event arrived.",
29436
+ "attach.state-changed": "A setup tab's attach inputs changed; runs per effect pass.",
29437
+ "terminal.preserve-failed": "Keeping a setup terminal's buffer before conversion failed.",
29438
+ "tab.marker-retired": "A setup tab with no live PTY stopped being a setup tab.",
29439
+ "tab.added": "The backend-managed setup tab was added to a new layout.",
29440
+ "session.bind-skipped": "A setup session lookup was already running for this tab.",
29441
+ "session.requested": "A tab asked the backend for its setup session.",
29442
+ "session.unavailable": "The backend had no setup session to give a tab.",
29443
+ "session.bind-started": "A backend setup session was found and is being bound to a tab.",
29444
+ "session.awaited": "The layout is waiting for a setup session before adding the tab.",
29445
+ "reconcile.started": "The reconcile effect found setup tabs that still need a session.",
29446
+ "reconnect-listener.install-failed": "Listening for event stream reconnects failed.",
29447
+ "layout.initial-decided": "An empty layout was evaluated for its setup tab; runs per effect."
29448
+ }
29449
+ }
29450
+ });
29451
+
29452
+ // ../protocol/src/log-vocabulary/tmux.ts
29453
+ var TMUX_LOG_AREAS = defineLogAreas({
29454
+ tmux: {
29455
+ description: "The poll loop behind a Claude tmux tab.",
29456
+ events: {
29457
+ "poll.discovery-failed": "Finding the session's transcript failed; a later tick retries.",
29458
+ "poll.snapshot-failed": "Reading the hook and transcript state failed; the next tick retries.",
29459
+ "poll.drain-pending-failed": "Delivering pending hook events failed; the next tick retries.",
29460
+ "poll.drain-timeouts-failed": "Delivering hook timeouts failed; the next tick retries.",
29461
+ "poll.tail-failed": "Reading new transcript lines failed; the next tick retries.",
29462
+ ...THROTTLE_LOG_EVENTS
29463
+ }
29464
+ }
29465
+ });
29466
+
29467
+ // ../protocol/src/log-vocabulary/updater.ts
29468
+ var UPDATER_LOG_AREAS = defineLogAreas({
29469
+ updater: {
29470
+ description: "Desktop self-update: electron-updater and updates a remote client requested.",
29471
+ events: {
29472
+ "channel.following": "Update checks now follow a different release channel.",
29473
+ "check-report.failed": "A check's result could not be reported.",
29474
+ "check.failed": "An update check failed; the next periodic check retries.",
29475
+ "download.failed": "Downloading or staging an update failed.",
29476
+ downloaded: "An update finished downloading.",
29477
+ "library.message": "One line from electron-updater at its own level. Its debug output, which includes the differential download plan, is off by default.",
29478
+ "remote.check-failed": "A check a remote client requested failed.",
29479
+ "remote.installing": "Installing an update for a remote client.",
29480
+ "remote.read-failed": "Update requests could not be read from the Local backend.",
29481
+ "remote.relaunch-prepare-failed": "Preparing the relaunch after a remote update failed.",
29482
+ "remote.relaunched": "The app relaunched to finish a remote client's update.",
29483
+ "remote.report-failed": "An update report could not reach the Local backend.",
29484
+ "remote.restart-not-recorded": "The backend did not record a restart, so it was not installed.",
29485
+ "remote.unavailable": "Updates requested by remote clients are unavailable in this session.",
29486
+ "restart-prompt.failed": "The restart prompt for a downloaded update failed.",
29487
+ unavailable: "Auto-update could not be set up in this session.",
29488
+ "update.failed": "electron-updater reported an update error."
29489
+ }
29490
+ }
29491
+ });
29492
+
29493
+ // ../protocol/src/log-vocabulary/web-annotations.ts
29494
+ var WEB_ANNOTATIONS_LOG_AREAS = defineLogAreas({
29495
+ "web-annotations": {
29496
+ description: "Web annotation requests and their background reconciler.",
29497
+ events: {
29498
+ "reconcile.failed": "A background reconcile pass failed; the next one retries.",
29499
+ ...THROTTLE_LOG_EVENTS
29500
+ }
29501
+ }
29502
+ });
29503
+
29504
+ // ../protocol/src/log-vocabulary/web-app.ts
29505
+ var WEB_APP_LOG_AREAS = defineLogAreas({
29506
+ "web.app": {
29507
+ description: "The application root: startup checks and restoring state.",
29508
+ events: {
29509
+ "config.load-failed": "The application config could not be loaded.",
29510
+ "docker.check-failed": "A Docker availability probe failed; the result stays unknown.",
29511
+ "docker.checked": "A Docker availability check finished.",
29512
+ "docker.orphans-cleared": "Reconciling with Docker cleared orphaned container references.",
29513
+ "docker.sync-failed": "Reconciling environments with Docker failed; non-fatal.",
29514
+ "prompt-queues.restore-failed": "An environment's prompt queues could not be restored.",
29515
+ "multi-reviews.restore-failed": "An environment's multi reviews could not be restored.",
29516
+ "build-pipelines.migrate-failed": "Migrating legacy build pipelines failed; the next launch retries.",
29517
+ "build-pipelines.restore-failed": "A project's build pipelines could not be restored.",
29518
+ "macos-permissions.check-failed": "Reading macOS file permission status failed.",
29519
+ "cli-check.failed": "One startup CLI check failed; its result stays unknown.",
29520
+ "cli-check.completed": "A startup CLI check finished; one line per tool.",
29521
+ "cli-check.retried": "A user-requested CLI recheck finished.",
29522
+ "cli-check.retry-failed": "A user-requested CLI recheck failed.",
29523
+ "exit.failed": "Exiting through the plugin failed; the window closes instead.",
29524
+ "zoom.native-failed": "Applying native zoom failed; the CSS fallback is used.",
29525
+ "github-cli.status-failed": "Reading the GitHub CLI setup status failed.",
29526
+ "attachments.restore-failed": "Saved prompt attachments could not be restored before startup.",
29527
+ "startup-launch.persist-failed": "Saving the startup agent launch failed; nothing started.",
29528
+ "environment.start-failed": "Starting an environment from the terminal overlay failed.",
29529
+ "project.delete-failed": "Deleting a project from its dialog failed."
29530
+ }
29531
+ },
29532
+ "web.session": {
29533
+ description: "The renderer's terminal and agent session store.",
29534
+ events: {
29535
+ "status.update-failed": "A session status change could not be saved.",
29536
+ "activity.update-failed": "A best-effort session activity update failed.",
29537
+ "environment-sessions.disconnect-failed": "Disconnecting an environment's sessions failed.",
29538
+ "container-sessions.sync-failed": "Syncing sessions with container state failed.",
29539
+ "reorder.failed": "Reordering sessions failed; the list reloads from the backend.",
29540
+ "refresh.manual-failed": "A manual refresh of an agent tab failed."
29541
+ }
29542
+ },
29543
+ "web.action-bar": {
29544
+ description: "The environment action bar.",
29545
+ events: {
29546
+ "editor.open-failed": "The external editor could not be opened.",
29547
+ "run-commands.read-failed": "Reading the project's run commands file failed.",
29548
+ "environment.delete-failed": "Deleting an environment from the action bar failed.",
29549
+ "merge.started": "A user-requested PR merge started.",
29550
+ "merge.completed": "A user-requested PR merge command returned.",
29551
+ "merge.failed": "A user-requested PR merge failed."
29552
+ }
29553
+ }
29554
+ });
29555
+
29556
+ // ../protocol/src/log-vocabulary/web-build-pipeline.ts
29557
+ var WEB_BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
29558
+ "web.build-pipeline": {
29559
+ description: "Build pipelines as the renderer starts, hydrates and shows them.",
29560
+ events: {
29561
+ "build.start-failed": "A build could not be started.",
29562
+ "pipeline.hydrate-failed": "A pipeline read failed; source says who asked for it.",
29563
+ "pipeline.project-mismatch": "A pending tab activation was dropped: wrong project.",
29564
+ "environment.not-found": "A build's environment read returned nothing after creation.",
29565
+ "environment.project-mismatch": "A build's environment was not added: wrong project.",
29566
+ "environment.hydrate-failed": "A build's environment read failed; live sync can recover.",
29567
+ "transcript.load-failed": "A stage transcript read failed and will retry with backoff.",
29568
+ "legacy.state-too-large": "Legacy pipeline state was over the limit and skipped.",
29569
+ "opencode-catalog.load-failed": "The cached OpenCode model list could not be loaded.",
29570
+ "opencode-preferences.load-failed": "OpenCode model preferences could not be loaded."
29571
+ }
29572
+ }
29573
+ });
29574
+
29575
+ // ../protocol/src/log-vocabulary/web-chat.ts
29576
+ var WEB_CHAT_LOG_AREAS = defineLogAreas({
29577
+ "web.chat": {
29578
+ description: "Rendering the agent transcript: messages, rich blocks and question cards.",
29579
+ events: {
29580
+ "message.copy-failed": "A message could not be copied to the clipboard.",
29581
+ "message.long-press-failed": "A user message's long-press action failed.",
29582
+ "message.link-open-failed": "A link in a message could not be opened.",
29583
+ "message.render-failed": "One transcript row failed to render; fields are the bounded diagnostic.",
29584
+ "image-preview.load-failed": "An image in a message could not be loaded for preview.",
29585
+ "session-list.load-failed": "The resume dialog could not fetch the resumable sessions.",
29586
+ "question.submit-failed": "An answer to an agent's question could not be submitted.",
29587
+ "question.dismiss-failed": "An agent's question could not be dismissed.",
29588
+ "rich-block.render-failed": "A rich block's renderer failed and its source is shown instead.",
29589
+ "rich-block.copy-failed": "A rich block's copy action could not write to the clipboard.",
29590
+ "scroll-viewport.not-found": "The scroll viewport was still missing when polling for it ended."
29591
+ }
29592
+ },
29593
+ "web.native-agent": {
29594
+ description: "The native agent tab and its composer.",
29595
+ events: {
29596
+ "model-catalogue.load-failed": "The native model catalogue could not be loaded.",
29597
+ "provider-lock.persist-failed": "The locked agent choice could not be saved.",
29598
+ "compose-draft.persist-failed": "A compose draft could not be saved.",
29599
+ "compose-draft.restore-failed": "A saved compose draft could not be restored.",
29600
+ "compose-draft.discard-failed": "A saved compose draft could not be discarded.",
29601
+ "paste.failed": "Pasting an image into a composer failed unexpectedly.",
29602
+ "agent-state.listen-failed": "Subscribing to a tab's agent state events failed.",
29603
+ "model-favorites.persist-failed": "The favorite model list could not be saved."
29604
+ }
29605
+ }
29606
+ });
29607
+
29608
+ // ../protocol/src/log-vocabulary/web-claude-tmux.ts
29609
+ var WEB_CLAUDE_TMUX_LOG_AREAS = defineLogAreas({
29610
+ "web.claude-tmux": {
29611
+ description: "The renderer's Claude tmux chat tab and interactive terminal.",
29612
+ events: {
29613
+ "sessions.list-failed": "The resume dialog could not list tmux sessions.",
29614
+ "tab.hydrate-failed": "Reading a tab's tmux session from the backend failed.",
29615
+ "models.catalog-unavailable": "The model catalogue failed; the bundled fallback stays.",
29616
+ "queue.promote-failed": "After an interrupt, the next queued prompt did not become the draft.",
29617
+ "files.load-failed": "The file list for @mentions could not be loaded.",
29618
+ "clipboard.image-failed": "An image pasted into the interactive terminal could not be saved.",
29619
+ "terminal.resize-failed": "Resizing the interactive terminal's session failed.",
29620
+ "terminal.recover-failed": "The interactive terminal could not reattach to its session."
29621
+ }
29622
+ }
29623
+ });
29624
+
29625
+ // ../protocol/src/log-vocabulary/web-design.ts
29626
+ var WEB_DESIGN_LOG_AREAS = defineLogAreas({
29627
+ "web.design": {
29628
+ description: "Opening design canvas tabs.",
29629
+ events: {
29630
+ "tab.duplicate-refused": "A design tab was not opened because its id is already in use."
29631
+ }
29632
+ }
29633
+ });
29634
+
29635
+ // ../protocol/src/log-vocabulary/web-environment.ts
29636
+ var WEB_ENVIRONMENT_LOG_AREAS = defineLogAreas({
29637
+ "web.environment": {
29638
+ description: "Environment lifecycle and dialogs as the renderer drives them.",
29639
+ events: {
29640
+ "start.called": "The renderer was asked to start an environment.",
29641
+ "start.unknown-environment": "A start was requested for an id the store does not hold.",
29642
+ "start.snapshot-read": "An environment's state as its start began.",
29643
+ "start.status-set": "The environment was marked as creating before the backend call.",
29644
+ "start.background-requested": "A start is being handed to the backend to run in background.",
29645
+ "start.backend-requested": "A foreground start call to the backend is being made.",
29646
+ "start.backend-completed": "The backend finished a foreground start.",
29647
+ "start.environment-refreshed": "An environment was read back after a foreground start.",
29648
+ "start.worktree-missing": "A local environment started with no worktree path.",
29649
+ "start.failed": "Starting an environment from the renderer failed.",
29650
+ "stop.called": "The renderer was asked to stop an environment.",
29651
+ "stop.status-set": "The environment's status was set while stopping it.",
29652
+ "stop.backend-requested": "A stop call to the backend is being made.",
29653
+ "stop.backend-completed": "The backend finished a stop.",
29654
+ "stop.sessions-disconnecting": "A stopped environment's sessions are being disconnected.",
29655
+ "stop.sessions-disconnected": "A stopped environment's sessions were disconnected.",
29656
+ "stop.failed": "Stopping an environment from the renderer failed.",
29657
+ "restart.failed": "Restarting an environment from the renderer failed.",
29658
+ "status-sync.failed": "An environment's status could not be synced from the backend.",
29659
+ "list.refresh-failed": "A background refresh of a project's environments failed.",
29660
+ "setup-snapshot.reconcile-failed": "An environment's setup state could not be reconciled.",
29661
+ "rename.received": "An environment-renamed event arrived.",
29662
+ "rename.pr-state-cleared": "A rename changed the branch, so stale PR state was cleared.",
29663
+ "unread.clear-failed": "An environment's unread work could not be cleared on the backend.",
29664
+ "create.failed": "Creating an environment from the dialog failed.",
29665
+ "create.port-mappings-invalid": "Creation was refused: a port is not between 1 and 65535.",
29666
+ "create.attachment-read-failed": "A file dropped on the create dialog could not be read.",
29667
+ "auto-start.failed": "A background start after creating an environment was rejected.",
29668
+ "models.pi-seed-failed": "The create dialog could not seed the Pi model catalogue.",
29669
+ "models.opencode-cache-load-failed": "The create dialog could not read cached OpenCode models.",
29670
+ "github-credential.check-failed": "The GitHub credential check before creating failed.",
29671
+ "feature-build.start-failed": "Starting a feature build from the dialog failed.",
29672
+ "settings.extensions-load-failed": "The settings dialog could not load extensions.",
29673
+ "settings.container-reset-failed": "The settings dialog could not reset the container.",
29674
+ "settings.save-failed": "The settings dialog could not save.",
29675
+ "domains.test-failed": "Testing whether network whitelist domains resolve failed.",
29676
+ "network-whitelist.save-failed": "The network whitelist dialog could not save."
29677
+ }
29678
+ },
29679
+ "web.sidebar": {
29680
+ description: "The project and environment sidebar.",
29681
+ events: {
29682
+ "reorder.persist-failed": "A sidebar reorder could not be saved.",
29683
+ "fork.failed": "Forking an environment from the sidebar failed.",
29684
+ "auto-start.started": "Selecting an unstarted local environment is starting it.",
29685
+ "auto-start.failed": "Starting a local environment on selection failed.",
29686
+ "environment.stop-failed": "Stopping a selected environment failed.",
29687
+ "environment.restart-failed": "Restarting a selected environment failed.",
29688
+ "environment.delete-failed": "Deleting an environment from the sidebar failed.",
29689
+ "environments.load-failed": "A project's environments could not be loaded for the sidebar.",
29690
+ "project.add-failed": "Adding a project from the sidebar failed.",
29691
+ "project.create-failed": "Creating a project from scratch failed.",
29692
+ "project.delete-failed": "Deleting a project from the sidebar failed.",
29693
+ "folder.project-remove-failed": "A project could not be removed from its folder.",
29694
+ "folder.rename-failed": "A project folder could not be renamed.",
29695
+ "folder.ungroup-failed": "A project folder could not be removed.",
29696
+ "folder.sort-failed": "A project folder could not be sorted."
29697
+ }
29698
+ },
29699
+ "web.docker": {
29700
+ description: "The Docker settings view.",
29701
+ events: {
29702
+ "data.load-failed": "Container or image data could not be loaded.",
29703
+ "container.stop-failed": "Stopping a container from Docker settings failed.",
29704
+ "container.delete-failed": "Deleting a container from Docker settings failed.",
29705
+ "container.reattach-failed": "Reattaching a container to a project failed."
29706
+ }
29707
+ },
29708
+ "web.project": {
29709
+ description: "Adding a project from the renderer.",
29710
+ events: {
29711
+ "directory-picker.failed": "The directory picker could not be opened.",
29712
+ "git-remote.read-failed": "A chosen directory's git remote could not be read."
29713
+ }
29714
+ }
29715
+ });
29716
+
29717
+ // ../protocol/src/log-vocabulary/web-files.ts
29718
+ var WEB_FILES_LOG_AREAS = defineLogAreas({
29719
+ "web.files": {
29720
+ description: "The files panel, file viewer and file search.",
29721
+ events: {
29722
+ "file.save-failed": "A file could not be saved.",
29723
+ "git-changes.load-failed": "The files panel could not load the git changes.",
29724
+ "file-tree.load-failed": "The file tree could not be loaded.",
29725
+ "changes.refresh-failed": "Refreshing the files panel's changes failed.",
29726
+ "folder.load-failed": "An expanded folder's contents could not be loaded.",
29727
+ "path.copy-failed": "A file's path could not be copied to the clipboard.",
29728
+ "draft.persist-failed": "A file viewer tab's draft could not be saved.",
29729
+ "draft.restore-failed": "A file viewer tab's saved draft could not be restored.",
29730
+ "draft.discard-failed": "A file's saved draft could not be discarded before a reload."
29731
+ }
29732
+ }
29733
+ });
29734
+
29735
+ // ../protocol/src/log-vocabulary/web-github.ts
29736
+ var WEB_GITHUB_LOG_AREAS = defineLogAreas({
29737
+ "web.github": {
29738
+ description: "Pull request and GitHub issue views.",
29739
+ events: {
29740
+ "pull-request.url-failed": "A pull request's URL could not be read.",
29741
+ "pull-request.mode-request-failed": "The pull request monitor refused a watch mode request.",
29742
+ "pull-request.copy-failed": "A pull request value could not be copied to the clipboard.",
29743
+ "comment-edit-draft.clear-failed": "An edited comment's saved draft could not be cleared.",
29744
+ "issue-draft.clear-failed": "An edited issue's saved drafts could not be cleared.",
29745
+ "comment-draft.clear-failed": "A posted comment's draft could not be cleared."
29746
+ }
29747
+ },
29748
+ "web.linear": {
29749
+ description: "The Linear tickets view.",
29750
+ events: {
29751
+ "comment-draft.clear-failed": "A posted comment's draft could not be cleared."
29752
+ }
29753
+ }
29754
+ });
29755
+
29756
+ // ../protocol/src/log-vocabulary/web-kanban.ts
29757
+ var WEB_KANBAN_LOG_AREAS = defineLogAreas({
29758
+ "web.kanban": {
29759
+ description: "The Kanban board, its task dialog and project notes.",
29760
+ events: {
29761
+ "tasks.load-failed": "A project's tasks could not be loaded.",
29762
+ "task.add-failed": "A new task could not be added.",
29763
+ "task.update-failed": "A task's fields could not be updated.",
29764
+ "task.content-update-failed": "A task's content edit could not be saved.",
29765
+ "task.build-status-clear-failed": "A task's build status could not be cleared.",
29766
+ "task.delete-failed": "A task could not be deleted.",
29767
+ "task.move-failed": "A task move failed and its status was rolled back.",
29768
+ "comment.add-failed": "A comment could not be added to a task.",
29769
+ "comment.delete-failed": "A comment could not be deleted from a task.",
29770
+ "image.add-failed": "An image could not be added to a task.",
29771
+ "image.delete-failed": "An image could not be deleted from a task.",
29772
+ "notes.load-failed": "Project notes could not be loaded; the editor stays disabled.",
29773
+ "notes.save-failed": "Project notes could not be saved.",
29774
+ "notes.draft-retained": "A notes save failed; the edit stays in its durable draft.",
29775
+ "draft.restore-failed": "A saved create-task draft could not be restored.",
29776
+ "draft.persist-failed": "A create-task draft could not be saved; phase says when.",
29777
+ "draft.discard-failed": "A create-task draft could not be removed; phase says when.",
29778
+ "build.start-failed": "The task dialog could not start a build for a task.",
29779
+ "build.create-and-start-failed": "The task dialog could not create a task and build it."
29780
+ }
29781
+ },
29782
+ "web.feature-plan": {
29783
+ description: "Feature planning in the renderer.",
29784
+ events: {
29785
+ "features.load-failed": "A project's features could not be loaded.",
29786
+ "feature.create-failed": "A new feature could not be created.",
29787
+ "feature.update-failed": "A feature could not be updated.",
29788
+ "build.claim-failed": "A feature's build could not be claimed for a task.",
29789
+ "build.start-failed": "Starting a build from a feature failed.",
29790
+ "message.append-failed": "A message could not be added to a feature's chat.",
29791
+ "story-message.append-failed": "A message could not be added to a story's chat.",
29792
+ "planning.start-failed": "Feature planning could not be started.",
29793
+ "planning.retry-failed": "Feature planning could not be retried.",
29794
+ "planning.cancel-failed": "Feature planning could not be cancelled.",
29795
+ "drafts.persist-failed": "A project's feature chat drafts could not be saved.",
29796
+ "drafts.restore-failed": "A project's feature chat drafts could not be restored."
29797
+ }
29798
+ }
29799
+ });
29800
+
29801
+ // ../protocol/src/log-vocabulary/web-pane-layout.ts
29802
+ var WEB_PANE_LAYOUT_LOG_AREAS = defineLogAreas({
29803
+ "web.pane-layout": {
29804
+ description: "Panes and tabs in the renderer: moves, splits, teardown and saved layouts.",
29805
+ events: {
29806
+ "persist.failed": "A pane layout could not be written to the backend.",
29807
+ "persist.install-skipped": "A saved layout was not installed: its dependencies did not load.",
29808
+ "persist.settled-handler-failed": "A write-settled handler threw; later handlers still ran.",
29809
+ "environment.activated": "The active environment changed.",
29810
+ "environment.initialized": "An environment's pane state was initialized.",
29811
+ "environment.initialize-skipped": "Initialize was called with no active environment.",
29812
+ "environment.terminals-cleared": "A reset cleared the environment's terminal instances.",
29813
+ "terminal-session.cleanup-started": "A closed tab's terminal session is being cleaned up.",
29814
+ "teardown.pending": "A tab teardown was rejected; the backend keeps it pending and retries.",
29815
+ "browser-preview.destroy-failed": "Destroying a closed browser tab's preview failed.",
29816
+ "handoffs.prune-failed": "Pruning unreferenced agent handoffs failed.",
29817
+ "tab.reactivated": "A tab added twice was activated in its existing pane instead.",
29818
+ "tab.move-started": "A tab move passed its checks and is being applied.",
29819
+ "tab.move-failed": "A tab move was refused; `reason` says which lookup failed.",
29820
+ "tab.initial-prompt-cleared": "A tab's initial prompt was cleared.",
29821
+ "tab.initial-agent-options-cleared": "A tab's initial agent options were cleared.",
29822
+ "pane.split-depth-reached": "A split was refused at the maximum split depth.",
29823
+ "pane.edge-split-started": "An edge split passed its checks and is being applied.",
29824
+ "pane.edge-split-failed": "An edge split was refused; `reason` says which lookup failed.",
29825
+ "pane.close-refused": "Closing the only pane in a layout was refused.",
29826
+ "draft.discard-failed": "A closing tab's draft could not be discarded; the tab stayed open.",
29827
+ "draft.file-conflict-resolve-failed": "Discarding a newer saved file draft failed.",
29828
+ "draft.compose-conflict-resolve-failed": "Discarding a newer saved compose draft failed."
29829
+ }
29830
+ }
29831
+ });
29832
+
29833
+ // ../protocol/src/log-vocabulary/web-settings.ts
29834
+ var WEB_SETTINGS_LOG_AREAS = defineLogAreas({
29835
+ "web.settings": {
29836
+ description: "The settings screens.",
29837
+ events: {
29838
+ "config.save-failed": "Global settings could not be saved.",
29839
+ "config.load-failed": "The settings page could not load the config.",
29840
+ "config.reload-failed": "Re-reading the workspace config after a save failed.",
29841
+ "domains.test-failed": "The domain resolution test could not run.",
29842
+ "github-credentials.propagate-failed": "Propagating GitHub credentials to environments failed.",
29843
+ "credential.save-failed": "A credential could not be saved.",
29844
+ "credential.clear-failed": "A credential could not be cleared.",
29845
+ "gateway-token.save-failed": "The gateway token could not be saved.",
29846
+ "gateway-token.copy-failed": "Copying the gateway token to the clipboard failed.",
29847
+ "web-client-url.copy-failed": "Copying the web client address to the clipboard failed.",
29848
+ "backend-version.read-failed": "The debug tab could not read the backend version.",
29849
+ "messaging.flush-failed": "Saving pending messaging settings on unmount failed.",
29850
+ "directory-picker.failed": "The repository directory picker could not open.",
29851
+ "file-picker.failed": "The repository file picker could not open.",
29852
+ "repository.save-failed": "Repository settings could not be saved.",
29853
+ "model-catalogues.read-failed": "Reading the model catalogues for settings failed."
29854
+ }
29855
+ }
29856
+ });
29857
+
29858
+ // ../protocol/src/log-vocabulary/web-shell.ts
29859
+ var WEB_SHELL_LOG_AREAS = defineLogAreas({
29860
+ "web.startup": {
29861
+ description: "Loading the renderer, after the desktop connection check.",
29862
+ events: {
29863
+ "renderer.load-failed": "Importing or mounting the application failed.",
29864
+ "model-catalogue.restore-failed": "The cached model catalogue could not be restored; bundled fallbacks stay in use."
29865
+ }
29866
+ },
29867
+ "web.window": {
29868
+ description: "Errors nothing in the renderer caught. Bug reports classify these two lines.",
29869
+ events: {
29870
+ "error.unhandled": "A window error event reached the bootstrap handler.",
29871
+ "rejection.unhandled": "A promise rejected with no handler."
29872
+ }
29873
+ },
29874
+ "web.react": {
29875
+ description: "React's root error callbacks and the lazy view boundary.",
29876
+ events: {
29877
+ "root.caught-error": "An error boundary caught a render error.",
29878
+ "root.uncaught-error": "A render error reached the root with no boundary.",
29879
+ "root.recoverable-error": "React recovered from a render error by retrying.",
29880
+ "lazy-view.failed": "A lazily loaded view failed; fields are the bounded diagnostic."
29881
+ }
29882
+ }
29883
+ });
29884
+
29885
+ // ../protocol/src/log-vocabulary/web-sync.ts
29886
+ var WEB_SYNC_LOG_AREAS = defineLogAreas({
29887
+ "web.resource-sync": {
29888
+ description: "Keeping renderer stores current with backend resources.",
29889
+ events: {
29890
+ "handler.threw": "A resource change handler threw; other handlers still ran.",
29891
+ "resync-handler.threw": "A resync handler threw; the resync counts as failed.",
29892
+ "view-safety-check.threw": "A view safety check handler threw; the others still ran.",
29893
+ "snapshots.batch-failed": "A scoped snapshot batch failed; individual reads take over.",
29894
+ "manifest.scoped-check-failed": "The scoped manifest read failed; a full resync runs.",
29895
+ "manifest.check-failed": "The manifest read failed; a full resync runs.",
29896
+ "subscribe.failed": "Subscribing to a resource transport event failed.",
29897
+ "change.malformed": "A resource-changed payload had the wrong shape and was dropped.",
29898
+ "config.refresh-failed": "Refreshing the config store after a change failed.",
29899
+ "pane-layout.refresh-failed": "Refreshing an environment's pane layout failed.",
29900
+ "setup-completion.observe-failed": "Subscribing to setup completion events failed.",
29901
+ "resync.project-failed": "The authoritative project read failed during a store resync.",
29902
+ "resync.environment-failed": "The authoritative environment read failed during a resync.",
29903
+ "resync.read-failed": "One of a store resync's per-environment reads failed.",
29904
+ "resync.pane-failed": "A pane layout read failed during a store resync.",
29905
+ "agent-mail.summary-refresh-failed": "Refreshing the agent mail summary failed.",
29906
+ "agent-mail.mailbox-refresh-failed": "Refreshing one agent mailbox failed.",
29907
+ "prompt-queues.refresh-failed": "Refreshing an environment's prompt queues failed.",
29908
+ "build-pipeline.refresh-failed": "Refreshing one build pipeline failed.",
29909
+ "multi-review.refresh-failed": "Refreshing one multi review workflow failed.",
29910
+ "authoritative.resync-failed": "Re-reading a snapshot after a stream reconnect failed.",
29911
+ "observation.listener-threw": "A native observation invalidation listener threw.",
29912
+ "observation.subscribe-failed": "Subscribing to native observation events failed.",
29913
+ "hydration.status-listener-failed": "A bounded hydration status listener threw.",
29914
+ "hydration.notification-failed": "A bounded hydration change notification threw."
29915
+ }
29916
+ },
29917
+ "web.read-coordinator": {
29918
+ description: "The renderer's coalesced, bounded backend reads.",
29919
+ events: {
29920
+ "listener.threw": "A read state listener threw.",
29921
+ "read.settle-failed": "Applying a finished read's result threw."
29922
+ }
29923
+ },
29924
+ "web.gateway": {
29925
+ description: "The renderer's connection to the gateway: requests and event streams.",
29926
+ events: {
29927
+ "events.disconnected": "The main event stream dropped; it reconnects and replays.",
29928
+ "terminal-stream.disconnected": "A terminal event stream dropped; it reconnects.",
29929
+ "connection-listener.failed": "A main stream connection state listener threw.",
29930
+ "event-listener.failed": "A listener for a gateway event threw.",
29931
+ "stream-listener.failed": "A listener for the stream-connected notice threw."
29932
+ }
29933
+ },
29934
+ "web.federation": {
29935
+ description: "Events from federated nodes as the renderer receives them.",
29936
+ events: {
29937
+ "resync-handler.failed": "A node resync handler failed.",
29938
+ "event-handler.failed": "A handler for an event relayed from a node failed.",
29939
+ "environment.start-failed": "Starting an environment opened in a workspace window failed."
29940
+ }
29941
+ }
29942
+ });
29943
+
29944
+ // ../protocol/src/log-vocabulary/index.ts
29945
+ var LOG_VOCABULARY = {
29946
+ ...AGENT_MAIL_LOG_AREAS,
29947
+ ...BACKEND_LOG_AREAS,
29948
+ ...BRIDGE_LOG_AREAS,
29949
+ ...DESKTOP_LOG_AREAS,
29950
+ ...ENVIRONMENT_LOG_AREAS,
29951
+ ...GATEWAY_LOG_AREAS,
29952
+ ...LOCAL_SERVER_LOG_AREAS,
29953
+ ...GIT_LOG_AREAS,
29954
+ ...LOGGING_LOG_AREAS,
29955
+ ...MODEL_LOG_AREAS,
29956
+ ...NATIVE_AGENT_LOG_AREAS,
29957
+ ...PREVIEW_LOG_AREAS,
29958
+ ...RUNTIME_LOG_AREAS,
29959
+ ...TERMINAL_LOG_AREAS,
29960
+ ...TMUX_LOG_AREAS,
29961
+ ...UPDATER_LOG_AREAS,
29962
+ ...WEB_ANNOTATIONS_LOG_AREAS,
29963
+ ...WEB_APP_LOG_AREAS,
29964
+ ...WEB_BUILD_PIPELINE_LOG_AREAS,
29965
+ ...WEB_CHAT_LOG_AREAS,
29966
+ ...WEB_CLAUDE_TMUX_LOG_AREAS,
29967
+ ...WEB_DESIGN_LOG_AREAS,
29968
+ ...WEB_ENVIRONMENT_LOG_AREAS,
29969
+ ...WEB_FILES_LOG_AREAS,
29970
+ ...WEB_GITHUB_LOG_AREAS,
29971
+ ...WEB_KANBAN_LOG_AREAS,
29972
+ ...WEB_PANE_LAYOUT_LOG_AREAS,
29973
+ ...WEB_SETTINGS_LOG_AREAS,
29974
+ ...WEB_SHELL_LOG_AREAS,
29975
+ ...WEB_SYNC_LOG_AREAS
29976
+ };
29977
+
29978
+ // ../protocol/src/logger.ts
29979
+ var LOG_LEVELS = ["error", "warn", "info", "debug", "trace"];
29980
+ var MAX_FIELD_CHARS = 2048;
29981
+ var TRUNCATION_MARKER_RESERVE = 32;
29982
+ var MAX_FIELDS = 32;
29983
+ var FIELD_NAME_PATTERN = /^[A-Za-z][\w.-]{0,63}$/;
29984
+ var BARE_TEXT_VALUE = /^[\w./:@+,~-]+$/;
29985
+ var THROTTLE_KIND_PATTERN = /^[\w.:-]{1,64}$/;
29986
+ var MAX_THROTTLE_SCOPE_CHARS = 128;
29987
+ var FORBIDDEN_FIELD_NAMES = new Set([
29988
+ "stdout",
29989
+ "stderr",
29990
+ "cmd",
29991
+ "spawnargs",
29992
+ "prompt",
29993
+ "token",
29994
+ "password",
29995
+ "secret",
29996
+ "authorization",
29997
+ "apikey",
29998
+ "cookie",
29999
+ "credentials"
30000
+ ]);
30001
+ var LEVEL_RANK = {
30002
+ error: 0,
30003
+ warn: 1,
30004
+ info: 2,
30005
+ debug: 3,
30006
+ trace: 4
30007
+ };
30008
+ var OUTPUT_METHOD = {
30009
+ error: "error",
30010
+ warn: "warn",
30011
+ info: "info",
30012
+ debug: "debug",
30013
+ trace: "debug"
30014
+ };
30015
+ var consoleSink = ({ method, line }) => {
30016
+ console[method](line);
30017
+ };
30018
+ var DEFAULT_CONFIG = {
30019
+ level: "info",
30020
+ areaLevels: {},
30021
+ format: "text",
30022
+ sink: consoleSink
30023
+ };
30024
+ var config2 = DEFAULT_CONFIG;
30025
+ var generation = 0;
30026
+ function configureLogger(change) {
30027
+ config2 = { ...config2, ...change };
30028
+ generation += 1;
30029
+ }
30030
+ function isLogLevel(value) {
30031
+ return typeof value === "string" && LOG_LEVELS.includes(value);
30032
+ }
30033
+ function areaSpec(area) {
30034
+ return Object.hasOwn(LOG_VOCABULARY, area) ? LOG_VOCABULARY[area] : undefined;
30035
+ }
30036
+ function thresholdRank(area) {
30037
+ for (let scope = area;; scope = scope.slice(0, scope.lastIndexOf("."))) {
30038
+ const level = Object.hasOwn(config2.areaLevels, scope) ? config2.areaLevels[scope] : undefined;
30039
+ if (level)
30040
+ return LEVEL_RANK[level];
30041
+ if (!scope.includes("."))
30042
+ return LEVEL_RANK[config2.level];
30043
+ }
30044
+ }
30045
+ function boundedString(value, maxChars) {
30046
+ if (value.length <= maxChars)
30047
+ return value;
30048
+ const kept = maxChars - TRUNCATION_MARKER_RESERVE;
30049
+ return `${value.slice(0, kept)}...[truncated ${value.length - kept} chars]`;
30050
+ }
30051
+ function sanitizeValue(name, value, maxChars) {
30052
+ if (FORBIDDEN_FIELD_NAMES.has(name.toLowerCase().replace(/[-_.]/g, "")))
30053
+ return "[forbidden]";
30054
+ switch (typeof value) {
30055
+ case "string":
30056
+ return boundedString(value, maxChars);
30057
+ case "number":
30058
+ return Number.isFinite(value) ? value : String(value);
30059
+ case "boolean":
30060
+ return value;
30061
+ case "undefined":
30062
+ return;
30063
+ case "bigint":
30064
+ return value.toString();
30065
+ case "object":
30066
+ if (value === null)
30067
+ return null;
30068
+ if (isSafeLogError(value))
30069
+ return value;
30070
+ if (value instanceof Error)
30071
+ return formatLogError(value);
30072
+ return "[rejected:object]";
30073
+ default:
30074
+ return `[rejected:${typeof value}]`;
30075
+ }
30076
+ }
30077
+ function sanitizeFields(fields, maxChars) {
30078
+ const clean = {};
30079
+ let count = 0;
30080
+ let dropped = 0;
30081
+ for (const name of Object.keys(fields)) {
30082
+ const value = sanitizeValue(name, fields[name], maxChars);
30083
+ if (value === undefined)
30084
+ continue;
30085
+ if (count >= MAX_FIELDS || !FIELD_NAME_PATTERN.test(name)) {
30086
+ dropped += 1;
30087
+ continue;
30088
+ }
30089
+ clean[name] = value;
30090
+ count += 1;
30091
+ }
30092
+ if (dropped > 0)
30093
+ clean.droppedFields = dropped;
30094
+ return count > 0 || dropped > 0 ? clean : undefined;
30095
+ }
30096
+ function textValue(value) {
30097
+ if (typeof value !== "string")
30098
+ return String(value);
30099
+ return BARE_TEXT_VALUE.test(value) ? value : JSON.stringify(value);
30100
+ }
30101
+ function appendTextField(parts, name, value) {
30102
+ if (typeof value !== "object" || value === null) {
30103
+ parts.push(`${name}=${textValue(value)}`);
30104
+ return;
30105
+ }
30106
+ for (const key of Object.keys(value)) {
30107
+ const entry = value[key];
30108
+ if (entry === undefined)
30109
+ continue;
30110
+ if (key === "cause")
30111
+ appendTextField(parts, `${name}.cause`, entry);
30112
+ else if (key === "stack")
30113
+ parts.push(`${name}.stack=${textValue(entry.join(" | "))}`);
30114
+ else
30115
+ parts.push(`${name}.${key}=${textValue(entry)}`);
30116
+ }
30117
+ }
30118
+ function escapeLogLine(line) {
30119
+ return line.replace(/[\u007f-\u009f\u2028\u2029]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
30120
+ }
30121
+ function renderText(record) {
30122
+ const tag = areaSpec(record.area)?.tag ?? record.area;
30123
+ const parts = [`[${tag}]`, record.event];
30124
+ if (record.fields) {
30125
+ for (const name of Object.keys(record.fields))
30126
+ appendTextField(parts, name, record.fields[name]);
30127
+ }
30128
+ return escapeLogLine(parts.join(" "));
30129
+ }
30130
+ function renderJson(record) {
30131
+ return escapeLogLine(JSON.stringify(record));
30132
+ }
30133
+ function deliver(record) {
30134
+ try {
30135
+ config2.sink({
30136
+ method: OUTPUT_METHOD[record.level],
30137
+ line: config2.format === "json" ? renderJson(record) : renderText(record),
30138
+ record
30139
+ });
30140
+ } catch {}
30141
+ }
30142
+ function buildRecord(level, area, event, fields) {
30143
+ const clean = fields ? sanitizeFields(fields, areaSpec(area)?.maxStringChars ?? MAX_FIELD_CHARS) : undefined;
30144
+ return {
30145
+ orklog: 1,
30146
+ ts: new Date().toISOString(),
30147
+ level,
30148
+ area,
30149
+ event,
30150
+ ...clean ? { fields: clean } : {}
30151
+ };
30152
+ }
30153
+ var LOG_THROTTLE_WINDOW_MS = 60000;
30154
+ var LOG_THROTTLE_MAX_KEYS = 512;
30155
+ var LOG_THROTTLE_IDLE_MS = 5 * LOG_THROTTLE_WINDOW_MS;
30156
+ var throttledSites = new Map;
30157
+ var throttledKeyCount = 0;
30158
+ var throttleRecency = 0;
30159
+ var throttleGeneration = generation;
30160
+ var nextThrottleFlushAt = 0;
30161
+ function writeThrottleLine(site, event, fields) {
30162
+ const spec = areaSpec(site.area);
30163
+ if (!spec)
30164
+ return;
30165
+ const listed = Object.hasOwn(spec.events, event);
30166
+ const line = { site: site.event, ...site.scope === undefined ? {} : { scope: site.scope } };
30167
+ deliver(buildRecord(site.level, site.area, listed ? event : "invalid-event", listed ? { ...line, ...fields } : undefined));
30168
+ }
30169
+ function syncThrottleLevels() {
30170
+ if (throttleGeneration === generation)
30171
+ return;
30172
+ throttleGeneration = generation;
30173
+ for (const [siteKey, site] of Array.from(throttledSites)) {
30174
+ if (LEVEL_RANK[site.level] <= thresholdRank(site.area))
30175
+ continue;
30176
+ throttledSites.delete(siteKey);
30177
+ throttledKeyCount -= site.keys.size;
30178
+ }
30179
+ }
30180
+ function rollThrottleWindow(site, kind, key, now) {
30181
+ const elapsed = now - key.windowStart;
30182
+ if (elapsed >= 0 && elapsed < LOG_THROTTLE_WINDOW_MS)
30183
+ return;
30184
+ if (key.pending > 0) {
30185
+ writeThrottleLine(site, "throttle.suppressed", {
30186
+ kind,
30187
+ suppressed: key.pending,
30188
+ windowSeconds: Math.max(0, Math.round(elapsed / 1000))
30189
+ });
30190
+ }
30191
+ key.pending = 0;
30192
+ key.windowStart = now;
30193
+ }
30194
+ function flushDueThrottleWindows(now) {
30195
+ if (now < nextThrottleFlushAt && nextThrottleFlushAt - now <= LOG_THROTTLE_WINDOW_MS)
30196
+ return;
30197
+ nextThrottleFlushAt = now + LOG_THROTTLE_WINDOW_MS;
30198
+ for (const site of throttledSites.values()) {
30199
+ for (const [kind, key] of site.keys)
30200
+ rollThrottleWindow(site, kind, key, now);
30201
+ }
30202
+ }
30203
+ function evictOldestThrottleKey() {
30204
+ let oldest;
30205
+ for (const [siteKey, site] of throttledSites) {
30206
+ for (const [kind, key] of site.keys) {
30207
+ if (!oldest || key.recency < oldest.key.recency)
30208
+ oldest = { siteKey, site, kind, key };
30209
+ }
30210
+ }
30211
+ if (!oldest)
30212
+ return;
30213
+ const { siteKey, site, kind, key } = oldest;
30214
+ writeThrottleLine(site, "throttle.evicted", { kind, suppressed: key.pending });
30215
+ site.keys.delete(kind);
30216
+ throttledKeyCount -= 1;
30217
+ if (site.keys.size === 0)
30218
+ throttledSites.delete(siteKey);
30219
+ }
30220
+ function throttleSiteKey(area, event, scope) {
30221
+ return `${area}\x00${event}\x00${scope ?? ""}`;
30222
+ }
30223
+ function noteThrottledFailure(area, level, event, scope, kind) {
30224
+ const now = Date.now();
30225
+ flushDueThrottleWindows(now);
30226
+ const siteKey = throttleSiteKey(area, event, scope);
30227
+ let site = throttledSites.get(siteKey);
30228
+ let known = site?.keys.get(kind);
30229
+ if (known && now - known.lastFailureAt >= LOG_THROTTLE_IDLE_MS) {
30230
+ site.keys.delete(kind);
30231
+ throttledKeyCount -= 1;
30232
+ if (site.keys.size === 0) {
30233
+ throttledSites.delete(siteKey);
30234
+ site = undefined;
30235
+ }
30236
+ known = undefined;
30237
+ }
30238
+ if (!known && throttledKeyCount >= LOG_THROTTLE_MAX_KEYS) {
30239
+ evictOldestThrottleKey();
30240
+ site = throttledSites.get(siteKey);
30241
+ }
30242
+ site ??= { area, event, scope, level, since: now, failures: 0, keys: new Map };
30243
+ site.level = level;
30244
+ site.failures += 1;
30245
+ throttledSites.delete(siteKey);
30246
+ throttledSites.set(siteKey, site);
30247
+ if (known) {
30248
+ rollThrottleWindow(site, kind, known, now);
30249
+ known.pending += 1;
30250
+ known.lastFailureAt = now;
30251
+ known.recency = ++throttleRecency;
30252
+ site.keys.delete(kind);
30253
+ site.keys.set(kind, known);
30254
+ return false;
30255
+ }
30256
+ site.keys.set(kind, {
30257
+ pending: 0,
30258
+ windowStart: now,
30259
+ lastFailureAt: now,
30260
+ recency: ++throttleRecency
30261
+ });
30262
+ throttledKeyCount += 1;
30263
+ return true;
30264
+ }
30265
+ function noteThrottledSuccess(area, event, scope) {
30266
+ const now = Date.now();
30267
+ flushDueThrottleWindows(now);
30268
+ const siteKey = throttleSiteKey(area, event, scope);
30269
+ const site = throttledSites.get(siteKey);
30270
+ if (!site)
30271
+ return;
30272
+ throttledSites.delete(siteKey);
30273
+ throttledKeyCount -= site.keys.size;
30274
+ let suppressed = 0;
30275
+ for (const key of site.keys.values())
30276
+ suppressed += key.pending;
30277
+ writeThrottleLine(site, "throttle.recovered", {
30278
+ failures: site.failures,
30279
+ kinds: site.keys.size,
30280
+ suppressed,
30281
+ faultSeconds: Math.max(0, Math.round((now - site.since) / 1000))
30282
+ });
30283
+ }
30284
+ function throttleKind(options) {
30285
+ if (options.kind === undefined)
30286
+ return logErrorKind(options.error);
30287
+ return THROTTLE_KIND_PATTERN.test(options.kind) ? options.kind : "invalid-kind";
30288
+ }
30289
+ function resolveFields(fields) {
30290
+ try {
30291
+ return typeof fields === "function" ? fields() : fields;
30292
+ } catch {
30293
+ return { fieldsFailed: true };
30294
+ }
30295
+ }
30296
+ function createLogger(area) {
30297
+ const spec = areaSpec(area);
30298
+ let seenGeneration = -1;
30299
+ let rank = 0;
30300
+ const enabled = (level) => {
30301
+ if (seenGeneration !== generation) {
30302
+ seenGeneration = generation;
30303
+ rank = thresholdRank(area);
30304
+ }
30305
+ return LEVEL_RANK[level] <= rank;
30306
+ };
30307
+ const writeResolved = (level, event, resolved) => {
30308
+ if (!spec) {
30309
+ deliver(buildRecord(level, "logging", "unknown-area", undefined));
30310
+ } else if (Object.hasOwn(spec.events, event)) {
30311
+ deliver(buildRecord(level, area, event, resolved));
30312
+ } else {
30313
+ deliver(buildRecord(level, area, "invalid-event", undefined));
30314
+ }
30315
+ };
30316
+ const write = (level, event, fields) => {
30317
+ if (!enabled(level))
30318
+ return;
30319
+ writeResolved(level, event, resolveFields(fields));
30320
+ };
30321
+ return {
30322
+ error: (event, fields) => write("error", event, fields),
30323
+ warn: (event, fields) => write("warn", event, fields),
30324
+ info: (event, fields) => write("info", event, fields),
30325
+ debug: (event, fields) => write("debug", event, fields),
30326
+ trace: (event, fields) => write("trace", event, fields),
30327
+ throttled: (level, event, options) => {
30328
+ syncThrottleLevels();
30329
+ if (!enabled(level))
30330
+ return;
30331
+ if (!spec || !Object.hasOwn(spec.events, event) || event.startsWith("throttle.") || !Object.hasOwn(spec.events, "throttle.recovered")) {
30332
+ deliver(buildRecord(level, spec ? area : "logging", spec ? "invalid-event" : "unknown-area", undefined));
30333
+ return;
30334
+ }
30335
+ const kind = throttleKind(options);
30336
+ const scope = options.scope?.slice(0, MAX_THROTTLE_SCOPE_CHARS);
30337
+ if (!noteThrottledFailure(area, level, event, scope, kind))
30338
+ return;
30339
+ writeResolved(level, event, {
30340
+ ...scope === undefined ? {} : { scope },
30341
+ kind,
30342
+ ...resolveFields(options.fields)
30343
+ });
30344
+ },
30345
+ recovered: (event, scope) => {
30346
+ syncThrottleLevels();
30347
+ if (throttledKeyCount === 0)
30348
+ return;
30349
+ noteThrottledSuccess(area, event, scope?.slice(0, MAX_THROTTLE_SCOPE_CHARS));
30350
+ },
30351
+ isEnabled: enabled
30352
+ };
30353
+ }
30354
+
28489
30355
  // ../../bridges/pi-bridge/src/persistence.ts
30356
+ var log = createLogger("bridge.pi");
28490
30357
  var tail = Promise.resolve();
28491
30358
  var scheduled = false;
28492
30359
  var shuttingDown = false;
@@ -28545,11 +30412,11 @@ function shedToFit(payload, order) {
28545
30412
  session.transcriptTruncated = true;
28546
30413
  shed += 1;
28547
30414
  if (Buffer.byteLength(JSON.stringify(payload)) <= MAX_STATE_FILE_BYTES) {
28548
- console.warn(`[pi-bridge] state file over budget; persisted ${shed} session(s) without their transcript`);
30415
+ log.warn("state.transcripts-shed", { sessions: shed });
28549
30416
  return true;
28550
30417
  }
28551
30418
  }
28552
- console.warn(`[pi-bridge] state file still over budget after shedding ${shed} transcript(s); skipping write`);
30419
+ log.warn("state.over-budget", { sessions: shed });
28553
30420
  return false;
28554
30421
  }
28555
30422
  async function persistNow(write = { barrier: false }) {
@@ -31973,6 +33840,7 @@ function applyHistoricToolResult(state, message) {
31973
33840
  if (durationMs !== undefined)
31974
33841
  part.toolDurationMs = durationMs;
31975
33842
  replayNestedToolCalls(state.messages[index], toolCallId, message.nestedCalls);
33843
+ forgetRowSize(state, state.messages[index]);
31976
33844
  return;
31977
33845
  }
31978
33846
  }
@@ -32012,6 +33880,7 @@ function pushMessage(state, role, content, parts, createdAt, messageId = randomB
32012
33880
  }
32013
33881
  // ../protocol/src/node/bridge-diagnostics.ts
32014
33882
  import { createHash as createHash4 } from "node:crypto";
33883
+ var log2 = createLogger("bridge.diagnostics");
32015
33884
  var INTERVAL_MS = 60000;
32016
33885
  var MAX_PENDING_TOOLS = 128;
32017
33886
  var MAX_REPORTED_TOOLS = 8;
@@ -32081,7 +33950,16 @@ function identity(value) {
32081
33950
  function readBridgeDebugFlag(value) {
32082
33951
  return value?.trim() === "1";
32083
33952
  }
33953
+ var liveDiagnostics;
33954
+ var liveScopes = new Set;
33955
+ function setLiveBridgeDiagnostics(enabled) {
33956
+ liveDiagnostics = enabled;
33957
+ for (const scope of Array.from(liveScopes))
33958
+ scope.syncActive();
33959
+ }
32084
33960
  function bridgeDebugEnabled(bridge, env = process.env) {
33961
+ if (liveDiagnostics !== undefined && env === process.env)
33962
+ return liveDiagnostics;
32085
33963
  const value = env.ORKESTRATOR_BRIDGE_DEBUG ?? env[`${bridge.toUpperCase()}_BRIDGE_DEBUG`];
32086
33964
  return readBridgeDebugFlag(value);
32087
33965
  }
@@ -32139,17 +34017,25 @@ function safeDiagnosticMetrics(value) {
32139
34017
  result.state = value.state;
32140
34018
  return result;
32141
34019
  }
32142
- var MAX_ENTRY_BYTES = 8192;
32143
- function writeDiagnostic(bridge, payload, write) {
34020
+ function writeBridgeDiagnostic({ bridge, event, payload }) {
34021
+ log2.info(event, { bridge, payload });
34022
+ }
34023
+ function bridgeDiagnosticsActive() {
34024
+ return log2.isEnabled("info");
34025
+ }
34026
+ function writeDiagnostic(bridge, event, payload, write) {
32144
34027
  try {
32145
- let json = JSON.stringify({ bridge, ...payload });
32146
- if (Buffer.byteLength(json) > MAX_ENTRY_BYTES)
32147
- json = JSON.stringify({
32148
- bridge,
32149
- event: "snapshot-overflow",
32150
- omittedBytes: Buffer.byteLength(json)
32151
- });
32152
- write(`[bridge-diagnostics] ${json}`);
34028
+ const json = JSON.stringify({ bridge, event, ...payload });
34029
+ const bytes = Buffer.byteLength(json);
34030
+ if (bytes <= MAX_BRIDGE_DIAGNOSTIC_BYTES) {
34031
+ write({ bridge, event, payload: json });
34032
+ return;
34033
+ }
34034
+ write({
34035
+ bridge,
34036
+ event: "snapshot-overflow",
34037
+ payload: JSON.stringify({ bridge, event: "snapshot-overflow", omittedBytes: bytes })
34038
+ });
32153
34039
  } catch {}
32154
34040
  }
32155
34041
 
@@ -32160,6 +34046,7 @@ class BridgeRunDiagnostics {
32160
34046
  write;
32161
34047
  intervalMs;
32162
34048
  metrics;
34049
+ active;
32163
34050
  counters = {
32164
34051
  stderrBytes: 0,
32165
34052
  requestsSent: 0,
@@ -32187,19 +34074,29 @@ class BridgeRunDiagnostics {
32187
34074
  cancelReason;
32188
34075
  run;
32189
34076
  closed = false;
34077
+ wasActive;
32190
34078
  timer;
32191
- constructor(bridge, state, now = Date.now, write = (line) => console.info(line), intervalMs = INTERVAL_MS, metrics = () => ({})) {
34079
+ constructor(bridge, state, now = Date.now, write = writeBridgeDiagnostic, intervalMs = INTERVAL_MS, metrics = () => ({}), active = () => true) {
32192
34080
  this.bridge = bridge;
32193
34081
  this.state = state;
32194
34082
  this.now = now;
32195
34083
  this.write = write;
32196
34084
  this.intervalMs = intervalMs;
32197
34085
  this.metrics = metrics;
34086
+ this.active = active;
32198
34087
  this.startedAt = this.lastTick = now();
34088
+ this.wasActive = active();
32199
34089
  this.timer = setInterval(() => this.report("heartbeat"), intervalMs);
32200
34090
  this.timer.unref();
34091
+ liveScopes.add(this);
32201
34092
  this.report("send-started");
32202
34093
  }
34094
+ syncActive() {
34095
+ const active = this.active();
34096
+ if (active && !this.wasActive)
34097
+ this.report("heartbeat");
34098
+ this.wasActive = active;
34099
+ }
32203
34100
  sent(runId) {
32204
34101
  this.run = identity(runId);
32205
34102
  this.phase = "following";
@@ -32287,6 +34184,8 @@ class BridgeRunDiagnostics {
32287
34184
  const tickDelayMs = event === "heartbeat" ? Math.max(0, now - this.lastTick - this.intervalMs) : 0;
32288
34185
  if (event === "heartbeat")
32289
34186
  this.lastTick = now;
34187
+ if (!this.active() || !bridgeDiagnosticsActive())
34188
+ return;
32290
34189
  const pendingTools = Array.from(this.pending.entries()).slice(0, MAX_REPORTED_TOOLS).map(([id, tool]) => ({
32291
34190
  id,
32292
34191
  kind: tool.kind,
@@ -32295,8 +34194,7 @@ class BridgeRunDiagnostics {
32295
34194
  ageMs: age(tool.since)
32296
34195
  }));
32297
34196
  try {
32298
- writeDiagnostic(this.bridge, {
32299
- event,
34197
+ writeDiagnostic(this.bridge, event, {
32300
34198
  session: identity(this.state.id),
32301
34199
  run: this.run,
32302
34200
  phase: this.phase,
@@ -32331,12 +34229,13 @@ class BridgeRunDiagnostics {
32331
34229
  this.phase = phase;
32332
34230
  this.report("closed");
32333
34231
  this.closed = true;
34232
+ liveScopes.delete(this);
32334
34233
  clearInterval(this.timer);
32335
34234
  this.pending.clear();
32336
34235
  }
32337
34236
  }
32338
34237
  function createBridgeDiagnostics(bridge, state, metrics) {
32339
- return bridgeDebugEnabled(bridge) ? new BridgeRunDiagnostics(bridge, state, undefined, undefined, undefined, metrics) : undefined;
34238
+ return new BridgeRunDiagnostics(bridge, state, undefined, undefined, undefined, metrics, () => bridgeDebugEnabled(bridge));
32340
34239
  }
32341
34240
 
32342
34241
  // ../protocol/src/structured-output-text.ts
@@ -33324,7 +35223,7 @@ ${lines.join(`
33324
35223
  `)}`;
33325
35224
  }
33326
35225
  // ../protocol/src/node/transcript-window.ts
33327
- import { Buffer as Buffer3 } from "node:buffer";
35226
+ import { Buffer as Buffer4 } from "node:buffer";
33328
35227
  var DEFAULT_ENVELOPE_RESERVE_BYTES = 256;
33329
35228
  var DEFAULT_CONTENT_FALLBACK_BYTES = 1024 * 1024;
33330
35229
  var MAX_TRANSCRIPT_INDEX_DIGITS = 16;
@@ -33348,7 +35247,7 @@ function transcriptTailStart(retained, tailMessages) {
33348
35247
  function retainUtf8Tail(value, maximumBytes) {
33349
35248
  if (maximumBytes <= 0)
33350
35249
  return "";
33351
- const encoded = Buffer3.from(value);
35250
+ const encoded = Buffer4.from(value);
33352
35251
  if (encoded.length <= maximumBytes)
33353
35252
  return value;
33354
35253
  let start = encoded.length - maximumBytes;
@@ -33361,7 +35260,7 @@ function boundTranscriptResponse(messages, maximumBytes, options = {}) {
33361
35260
  const contentFallbackBytes = options.contentFallbackBytes === undefined ? DEFAULT_CONTENT_FALLBACK_BYTES : options.contentFallbackBytes;
33362
35261
  const tail = options.tailMessages;
33363
35262
  const selected = tail !== undefined && messages.length > tail ? messages.slice(-tail) : [...messages];
33364
- const measure = options.measure ?? ((message) => Buffer3.byteLength(JSON.stringify(message)));
35263
+ const measure = options.measure ?? ((message) => Buffer4.byteLength(JSON.stringify(message)));
33365
35264
  const sizes = selected.map((message) => measure(message));
33366
35265
  let bytes = envelope + 2 + sizes.reduce((total, size) => total + size, 0) + Math.max(0, sizes.length - 1);
33367
35266
  let start = 0;
@@ -33373,7 +35272,7 @@ function boundTranscriptResponse(messages, maximumBytes, options = {}) {
33373
35272
  let truncatedContent = false;
33374
35273
  const oldestRetained = selected[start];
33375
35274
  if (bytes > maximumBytes && oldestRetained) {
33376
- const partSizes = oldestRetained.parts.map((part) => Buffer3.byteLength(JSON.stringify(part)));
35275
+ const partSizes = oldestRetained.parts.map((part) => Buffer4.byteLength(JSON.stringify(part)));
33377
35276
  const partCount = partSizes.length;
33378
35277
  while (omittedParts < partCount && bytes > maximumBytes) {
33379
35278
  const shed = partSizes[omittedParts];
@@ -33394,7 +35293,7 @@ function boundTranscriptResponse(messages, maximumBytes, options = {}) {
33394
35293
  };
33395
35294
  omittedParts = oldestRetained.parts.length;
33396
35295
  truncatedContent = true;
33397
- bytes = envelope + 2 + Buffer3.byteLength(JSON.stringify(selected[start]));
35296
+ bytes = envelope + 2 + Buffer4.byteLength(JSON.stringify(selected[start]));
33398
35297
  }
33399
35298
  }
33400
35299
  const bounded = selected.slice(start);
@@ -33566,8 +35465,158 @@ function publicQueue(state) {
33566
35465
  ].map((item, index) => ({ id: `queued:${index}`, ...item }))
33567
35466
  };
33568
35467
  }
35468
+ // ../protocol/src/log-policy.ts
35469
+ var BRIDGE_DIAGNOSTICS_LOG_AREA = "bridge.diagnostics";
35470
+ var MAX_LOG_DETAIL_AREAS = 256;
35471
+ var MAX_LOG_AREA_NAME_CHARS = 64;
35472
+ var LOG_AREA_NAME = /^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)*$/;
35473
+ function parseLogDetail(value) {
35474
+ if (typeof value !== "object" || value === null || Array.isArray(value))
35475
+ return null;
35476
+ const { level, areaLevels } = value;
35477
+ if (!isLogLevel(level))
35478
+ return null;
35479
+ if (areaLevels === undefined)
35480
+ return { level, areaLevels: {} };
35481
+ if (typeof areaLevels !== "object" || areaLevels === null || Array.isArray(areaLevels)) {
35482
+ return null;
35483
+ }
35484
+ const names = Object.keys(areaLevels).sort();
35485
+ if (names.length > MAX_LOG_DETAIL_AREAS)
35486
+ return null;
35487
+ const clean = {};
35488
+ for (const name of names) {
35489
+ const areaLevel = areaLevels[name];
35490
+ if (name.length > MAX_LOG_AREA_NAME_CHARS || !LOG_AREA_NAME.test(name))
35491
+ return null;
35492
+ if (!isLogLevel(areaLevel))
35493
+ return null;
35494
+ clean[name] = areaLevel;
35495
+ }
35496
+ return { level, areaLevels: clean };
35497
+ }
35498
+ var LEVEL_DETAIL = {
35499
+ error: 0,
35500
+ warn: 1,
35501
+ info: 2,
35502
+ debug: 3,
35503
+ trace: 4
35504
+ };
35505
+ function effectiveLogLevel(detail, area) {
35506
+ for (let scope = area;; scope = scope.slice(0, scope.lastIndexOf("."))) {
35507
+ const level = Object.hasOwn(detail.areaLevels, scope) ? detail.areaLevels[scope] : undefined;
35508
+ if (level)
35509
+ return level;
35510
+ if (!scope.includes("."))
35511
+ return detail.level;
35512
+ }
35513
+ }
35514
+ function logDetailEnablesBridgeDiagnostics(detail) {
35515
+ return LEVEL_DETAIL[effectiveLogLevel(detail, BRIDGE_DIAGNOSTICS_LOG_AREA)] >= LEVEL_DETAIL.debug;
35516
+ }
35517
+ var BRIDGE_LOG_POLICY_ROUTE = "/debug/log-policy";
35518
+ function parseBridgeLogPolicy(value) {
35519
+ const detail = parseLogDetail(value);
35520
+ if (!detail)
35521
+ return null;
35522
+ const { seq } = value;
35523
+ return Number.isSafeInteger(seq) && seq >= 0 ? { ...detail, seq } : null;
35524
+ }
35525
+
35526
+ // ../protocol/src/node/logger-environment.ts
35527
+ var LOG_LEVEL_ENV = "ORKESTRATOR_LOG_LEVEL";
35528
+ var LOG_FORMAT_ENV = "ORKESTRATOR_LOG_FORMAT";
35529
+ var BRIDGE_LOG_RELAY_ENV = "ORKESTRATOR_BRIDGE_LOG_RELAY";
35530
+ var bridgeLogLevelOverrides = new WeakMap;
35531
+ function logLevelEnvironmentValue(env) {
35532
+ return env[LOG_LEVEL_ENV] ?? bridgeLogLevelOverrides.get(env);
35533
+ }
35534
+ function parseLogLevels(value) {
35535
+ const parsed = { areaLevels: {}, invalid: [] };
35536
+ for (const entry of (value ?? "").split(",")) {
35537
+ const trimmed = entry.trim();
35538
+ if (!trimmed)
35539
+ continue;
35540
+ const separator = trimmed.indexOf("=");
35541
+ if (separator < 0) {
35542
+ if (isLogLevel(trimmed))
35543
+ parsed.level = trimmed;
35544
+ else
35545
+ parsed.invalid.push(trimmed);
35546
+ continue;
35547
+ }
35548
+ const area = trimmed.slice(0, separator);
35549
+ const level = trimmed.slice(separator + 1);
35550
+ if (isLogLevel(level) && isKnownScope(area))
35551
+ parsed.areaLevels[area] = level;
35552
+ else
35553
+ parsed.invalid.push(trimmed);
35554
+ }
35555
+ return parsed;
35556
+ }
35557
+ function isKnownScope(scope) {
35558
+ return Object.keys(LOG_VOCABULARY).some((area) => area === scope || area.startsWith(`${scope}.`));
35559
+ }
35560
+ function configureLoggerFromEnvironment(env, options = {}) {
35561
+ const levels = parseLogLevels(env[LOG_LEVEL_ENV]);
35562
+ const requestedFormat = env[LOG_FORMAT_ENV];
35563
+ const format = options.relayToSupervisor || requestedFormat === "json" ? "json" : "text";
35564
+ configureLogger({
35565
+ ...levels.level ? { level: levels.level } : {},
35566
+ areaLevels: levels.areaLevels,
35567
+ format
35568
+ });
35569
+ const log = createLogger("logging");
35570
+ if (levels.invalid.length > 0) {
35571
+ log.warn("config.invalid", { variable: LOG_LEVEL_ENV, entries: levels.invalid.length });
35572
+ }
35573
+ if (requestedFormat && requestedFormat !== "json" && requestedFormat !== "text") {
35574
+ log.warn("config.invalid", { variable: LOG_FORMAT_ENV, entries: 1 });
35575
+ }
35576
+ }
35577
+ function configureBridgeLogger(env = process.env) {
35578
+ const relayToSupervisor = env[BRIDGE_LOG_RELAY_ENV] === "1";
35579
+ bridgeLogLevelOverrides.set(env, env[LOG_LEVEL_ENV]);
35580
+ delete env[BRIDGE_LOG_RELAY_ENV];
35581
+ configureLoggerFromEnvironment(env, { relayToSupervisor });
35582
+ delete env[LOG_FORMAT_ENV];
35583
+ delete env[LOG_LEVEL_ENV];
35584
+ }
35585
+
35586
+ // ../protocol/src/node/log-policy.ts
35587
+ function effectiveLogDetail(detail, env = process.env) {
35588
+ const overrides = parseLogLevels(logLevelEnvironmentValue(env));
35589
+ return {
35590
+ level: overrides.level ?? detail.level,
35591
+ areaLevels: { ...detail.areaLevels, ...overrides.areaLevels }
35592
+ };
35593
+ }
35594
+ function applyLogDetail(detail, env = process.env) {
35595
+ const effective = effectiveLogDetail(detail, env);
35596
+ configureLogger(effective);
35597
+ return effective;
35598
+ }
35599
+
35600
+ // ../protocol/src/node/bridge-log-policy.ts
35601
+ var MAX_BRIDGE_LOG_POLICY_BYTES = 64 * 1024;
35602
+ var appliedSeq = -1;
35603
+ function applyBridgeLogPolicy(value, env = process.env) {
35604
+ const policy = parseBridgeLogPolicy(value);
35605
+ if (!policy)
35606
+ return { status: 400, body: { error: "Invalid log policy" } };
35607
+ if (policy.seq < appliedSeq) {
35608
+ return { status: 200, body: { applied: false, stale: true, seq: appliedSeq } };
35609
+ }
35610
+ appliedSeq = policy.seq;
35611
+ const effective = applyLogDetail(policy, env);
35612
+ const diagnostics = logDetailEnablesBridgeDiagnostics(effective);
35613
+ setLiveBridgeDiagnostics(diagnostics);
35614
+ return { status: 200, body: { applied: true, seq: policy.seq, diagnostics } };
35615
+ }
35616
+
33569
35617
  // ../protocol/src/human-prompts.ts
33570
35618
  var HUMAN_PROMPT_SCAN_BYTES = 16 * 1024;
35619
+ var HUMAN_PROMPT_OBSERVATION_ROWS = 64;
33571
35620
  function humanPromptObservation(messages, tasks) {
33572
35621
  const object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
33573
35622
  const parts = [];
@@ -33601,7 +35650,7 @@ function humanPromptObservation(messages, tasks) {
33601
35650
  }
33602
35651
  };
33603
35652
  if (Array.isArray(messages)) {
33604
- for (let i = messages.length - 1;i >= Math.max(0, messages.length - 64); i--) {
35653
+ for (let i = messages.length - 1;i >= Math.max(0, messages.length - HUMAN_PROMPT_OBSERVATION_ROWS); i--) {
33605
35654
  const message = messages[i];
33606
35655
  if (object(message))
33607
35656
  walk(message.parts);
@@ -33675,7 +35724,7 @@ var DEFAULT_MCP_MANAGEMENT_ROLLOUT = Object.freeze({
33675
35724
  });
33676
35725
 
33677
35726
  // ../protocol/src/node/bridge-transcript-summary.ts
33678
- import { Buffer as Buffer4 } from "node:buffer";
35727
+ import { Buffer as Buffer5 } from "node:buffer";
33679
35728
  import { createHash as createHash5 } from "node:crypto";
33680
35729
 
33681
35730
  // ../protocol/src/node/progressive-transcript.ts
@@ -33760,7 +35809,7 @@ var MAX_SUMMARY_DEPTH = 8;
33760
35809
  var NESTED_PART_FIELDS = ["parts", "childTools", "subagentActions"];
33761
35810
  var LOCATOR_PREFIX = "bd1.";
33762
35811
  function encodeLocator(body) {
33763
- const locator = LOCATOR_PREFIX + Buffer4.from(JSON.stringify(body)).toString("base64url");
35812
+ const locator = LOCATOR_PREFIX + Buffer5.from(JSON.stringify(body)).toString("base64url");
33764
35813
  return locator.length <= BRIDGE_DETAIL_LOCATOR_MAX_LENGTH ? locator : undefined;
33765
35814
  }
33766
35815
  function decodeLocator(locator) {
@@ -33768,7 +35817,7 @@ function decodeLocator(locator) {
33768
35817
  return;
33769
35818
  }
33770
35819
  try {
33771
- const body = JSON.parse(Buffer4.from(locator.slice(LOCATOR_PREFIX.length), "base64url").toString("utf8"));
35820
+ const body = JSON.parse(Buffer5.from(locator.slice(LOCATOR_PREFIX.length), "base64url").toString("utf8"));
33772
35821
  if (!isRecord2(body))
33773
35822
  return;
33774
35823
  const { m, p, d } = body;
@@ -33841,7 +35890,7 @@ function measureDetail(part, payload) {
33841
35890
  function digestPayload(payload) {
33842
35891
  const serialized = JSON.stringify(payload);
33843
35892
  return {
33844
- bytes: Buffer4.byteLength(serialized),
35893
+ bytes: Buffer5.byteLength(serialized),
33845
35894
  digest: createHash5("sha256").update(serialized).digest("base64url").slice(0, 32)
33846
35895
  };
33847
35896
  }
@@ -34016,7 +36065,7 @@ function revisedBeforeWindow(messages, startIndex, ids) {
34016
36065
  continue;
34017
36066
  found.delete(id);
34018
36067
  const summary = summarizeBridgeMessage(message);
34019
- const size = Buffer4.byteLength(JSON.stringify(summary));
36068
+ const size = Buffer5.byteLength(JSON.stringify(summary));
34020
36069
  if (revised.length >= BRIDGE_REVISED_MESSAGES_MAX || bytes + size > BRIDGE_REVISED_MESSAGES_MAX_BYTES) {
34021
36070
  omitted.push(summary);
34022
36071
  continue;
@@ -34078,7 +36127,7 @@ function bridgeTranscriptSummaryUpdate(messages, options) {
34078
36127
  }
34079
36128
  var PAGE_CURSOR_PREFIX = "bp1.";
34080
36129
  function encodePageCursor(body) {
34081
- const cursor = PAGE_CURSOR_PREFIX + Buffer4.from(JSON.stringify(body)).toString("base64url");
36130
+ const cursor = PAGE_CURSOR_PREFIX + Buffer5.from(JSON.stringify(body)).toString("base64url");
34082
36131
  return cursor.length <= BRIDGE_PAGE_CURSOR_MAX_LENGTH ? cursor : undefined;
34083
36132
  }
34084
36133
  function decodePageCursor(cursor) {
@@ -34086,7 +36135,7 @@ function decodePageCursor(cursor) {
34086
36135
  return;
34087
36136
  }
34088
36137
  try {
34089
- const body = JSON.parse(Buffer4.from(cursor.slice(PAGE_CURSOR_PREFIX.length), "base64url").toString("utf8"));
36138
+ const body = JSON.parse(Buffer5.from(cursor.slice(PAGE_CURSOR_PREFIX.length), "base64url").toString("utf8"));
34090
36139
  if (!isRecord2(body))
34091
36140
  return;
34092
36141
  const { g, e, b } = body;
@@ -34563,6 +36612,8 @@ async function answerSessionActivityBatch(body, read, options = {}) {
34563
36612
  }
34564
36613
 
34565
36614
  // ../../bridges/pi-bridge/src/http.ts
36615
+ var log3 = createLogger("bridge.pi");
36616
+
34566
36617
  class HttpError extends Error {
34567
36618
  status;
34568
36619
  constructor(status, message) {
@@ -34622,6 +36673,10 @@ async function route(request, response, clientSignal) {
34622
36673
  });
34623
36674
  return json(response, answer.status, answer.body);
34624
36675
  }
36676
+ if (url.pathname === BRIDGE_LOG_POLICY_ROUTE && request.method === "POST") {
36677
+ const answer = applyBridgeLogPolicy(await readJson(request));
36678
+ return json(response, answer.status, answer.body);
36679
+ }
34625
36680
  const handled = await routeGlobal(request, response, url);
34626
36681
  if (handled)
34627
36682
  return;
@@ -34641,7 +36696,7 @@ async function route(request, response, clientSignal) {
34641
36696
  if (error instanceof PromptAttachmentError) {
34642
36697
  return json(response, 400, { error: error.message });
34643
36698
  }
34644
- console.error("[pi-bridge] Unexpected HTTP route failure");
36699
+ log3.error("http.route-failed");
34645
36700
  return json(response, 500, { error: "Internal bridge error" });
34646
36701
  }
34647
36702
  }
@@ -35641,6 +37696,7 @@ function startParentWatchdog(options) {
35641
37696
  }
35642
37697
 
35643
37698
  // ../protocol/src/bridge-lifecycle.ts
37699
+ var log4 = createLogger("bridge.lifecycle");
35644
37700
  var TERMINATION_SIGNALS = ["SIGTERM", "SIGINT"];
35645
37701
  function errorKind(error) {
35646
37702
  if (error instanceof Error)
@@ -35656,11 +37712,9 @@ class BridgeLifecycle {
35656
37712
  #exit = null;
35657
37713
  #options;
35658
37714
  #timers;
35659
- #report;
35660
37715
  constructor(options) {
35661
37716
  this.#options = options;
35662
37717
  this.#timers = options.timers ?? runtimeIntervalTimers;
35663
- this.#report = options.report ?? ((message) => console.error(message));
35664
37718
  }
35665
37719
  get phase() {
35666
37720
  return this.#phase;
@@ -35696,7 +37750,10 @@ class BridgeLifecycle {
35696
37750
  }
35697
37751
  requestExit() {
35698
37752
  this.#exit ??= this.shutdown().then(() => this.#options.exit(0), (error) => {
35699
- this.#report(`${this.#options.label} shutdown failed (${errorKind(error)})`);
37753
+ log4.error("shutdown.failed", {
37754
+ bridge: this.#options.label,
37755
+ errorClass: errorKind(error)
37756
+ });
35700
37757
  this.#options.exit(1);
35701
37758
  });
35702
37759
  return this.#exit;
@@ -35710,7 +37767,10 @@ class BridgeLifecycle {
35710
37767
  try {
35711
37768
  idleSweep.run();
35712
37769
  } catch (error) {
35713
- this.#report(`${this.#options.label} idle sweep failed (${errorKind(error)})`);
37770
+ log4.warn("idle-sweep.failed", {
37771
+ bridge: this.#options.label,
37772
+ errorClass: errorKind(error)
37773
+ });
35714
37774
  }
35715
37775
  }, idleSweep.intervalMs);
35716
37776
  this.#disarmers.push(() => this.#timers.clearInterval(handle));
@@ -35974,6 +38034,7 @@ function installFatalRejectionGuard(options) {
35974
38034
  }
35975
38035
 
35976
38036
  // ../../bridges/pi-bridge/src/index.ts
38037
+ configureBridgeLogger();
35977
38038
  installFatalRejectionGuard({ label: "[pi-bridge]" });
35978
38039
  if (process.env.PI_BRIDGE_LIBRARY_ONLY !== "1") {
35979
38040
  await start();
@@ -36072,6 +38133,7 @@ export {
36072
38133
  expireComposerHydrationRetryForTests,
36073
38134
  fallbackDefaultModelId,
36074
38135
  forgetRevisedRows,
38136
+ forgetRowSize,
36075
38137
  forkSession,
36076
38138
  holdApproval,
36077
38139
  hostname,