orkestrator 2.36.3-beta → 2.36.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.
@@ -17,6 +17,7 @@ var TEXT_RULES = [
17
17
  pattern: /\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/g,
18
18
  replacement: "[redacted]"
19
19
  },
20
+ { pattern: /\bok[ab]_[A-Za-z0-9_-]{16,}/g, replacement: "[redacted]" },
20
21
  { pattern: /\bgh[pousr]_[A-Za-z0-9]{16,}/g, replacement: "[redacted]" },
21
22
  { pattern: /\bgithub_pat_[A-Za-z0-9_]{20,}/g, replacement: "[redacted]" },
22
23
  { pattern: /\b(?:sk|rk|pk)-[A-Za-z0-9_-]{12,}/g, replacement: "[redacted]" },
@@ -257,6 +258,12 @@ var BACKEND_LOG_AREAS = defineLogAreas({
257
258
  "startup.looped-review-pending": "Cleanup of the retired Looped Review stays pending.",
258
259
  "notice.failed": "A background notice after a turn or prompt failed; `step` says which.",
259
260
  "artifacts.live-unavailable": "Live interactive artifacts are unavailable.",
261
+ "previous-run": {
262
+ description: "This start read how the previous run ended: `outcome` is `clean` when it reached the end of shutdown and `crashed` when it did not, `ranForMs` its length and `lastSeenAgoMs` the time since its last health row.",
263
+ essential: true,
264
+ fields: { outcome: "label", ranForMs: "number", lastSeenAgoMs: "number" }
265
+ },
266
+ "health.write-failed": "A health summary row could not be written or read; the next sample retries.",
260
267
  "shutdown.step-failed": "One part of shutdown failed and the rest went on; `step` says which.",
261
268
  "shutdown.signal-received": {
262
269
  description: "A signal started shutdown, which tells a clean quit from the backend being killed.",
@@ -300,7 +307,8 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
300
307
  description: "What every long-lived bridge does the same way: its sweep and its shutdown.",
301
308
  events: {
302
309
  "idle-sweep.failed": "An idle sweep threw; the next tick retries.",
303
- "shutdown.failed": "Releasing the bridge failed during shutdown; it still exits."
310
+ "shutdown.failed": "Releasing the bridge failed during shutdown; it still exits.",
311
+ "credential.not-hardened": "The bridge could not mark itself non-dumpable, so a same-uid process can read its memory; `reason` says why."
304
312
  }
305
313
  },
306
314
  "bridge.acp": {
@@ -434,7 +442,6 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
434
442
  "parent.gone": "The backend that launched this bridge has gone; stopping turns and shutting down.",
435
443
  "queue.overflow": "The notification queue passed a bound and dropped its backlog.",
436
444
  "queue.task-failed": "A task on a per-thread queue failed.",
437
- "raw-log.write-failed": "Appending to the raw Codex log failed.",
438
445
  "recorder.notice": "The notification recorder needs attention: it is on, or was asked for without its confirmation.",
439
446
  "recorder.threw": "The notification recorder threw.",
440
447
  "recorder.write-failed": "Writing a notification recording failed; its lines were dropped.",
@@ -640,6 +647,7 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
640
647
  environment: {
641
648
  description: "Environment naming, setup, status, moves, deletion and cleanup afterwards.",
642
649
  events: {
650
+ "cleanup.sessions-failed": "Session metadata cleanup failed during environment deletion; deletion continues.",
643
651
  "cleanup.branch-kept": "A deleted environment's local branch was kept, as it may hold unmerged work.",
644
652
  "rename.failed": "Naming an environment from its pending prompt failed for the first time.",
645
653
  "rename.still-failing": "That rename is still failing; written at the 2nd, 4th, 8th... failure.",
@@ -713,6 +721,7 @@ var GATEWAY_LOG_AREAS = defineLogAreas({
713
721
  "websocket.upgrade-failed": "A WebSocket upgrade failed.",
714
722
  "events.client-dropped": "An event-stream client buffered too much and was dropped; it reconnects and refetches.",
715
723
  "proxy.client-disconnected": "A proxy client went away, so its upstream request was aborted.",
724
+ "traffic.burst": "Connections or requests spiked. Counts by source address, route class, client family, listener and registered invoke command; never request content.",
716
725
  "throttle.suppressed": "Repeats of the throttled `site` were counted over a window, not written.",
717
726
  "throttle.recovered": "The throttled `site` succeeded again, so its fault has cleared.",
718
727
  "throttle.evicted": "The tracked-key limit dropped the `site`, so no recovered line follows unless it fails again."
@@ -846,6 +855,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
846
855
  "native-agent": {
847
856
  description: "Native agent sessions and what the backend reads from their bridges.",
848
857
  events: {
858
+ "session.bridge-replaced-for-policy": "An idle bridge was stopped so a resume could apply the user's wider execution policy.",
849
859
  "catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
850
860
  "compact.instructions-ignored": "A bridge compacted without confirming the instructions sent with /compact: it predates them.",
851
861
  "handoff.summary-read-failed": "Change summaries could not be read for a handoff, so the carrier says they are unmeasured.",
@@ -911,7 +921,8 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
911
921
  "coordinator-servers.unavailable": "OpenCode coordinator research servers are unavailable.",
912
922
  "monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
913
923
  "worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
914
- "request.failed": "Handling a request event failed, so the stream restarts. Error class only."
924
+ "request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
925
+ "credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
915
926
  }
916
927
  }
917
928
  });
@@ -939,6 +950,7 @@ var PREVIEW_LOG_AREAS = defineLogAreas({
939
950
  "publication.start-failed": "Private preview publication did not start.",
940
951
  "publication.reconfigure-failed": "Preview publication could not be reconfigured.",
941
952
  "publication.listening": "Private preview origins are listening.",
953
+ "publication.same-site": "The preview domain is the same site as the application; publication runs with a warning.",
942
954
  "certificate.reloaded": "The preview certificate was reloaded.",
943
955
  "access.revoked-close-failed": "A revoked preview resource could not be closed. Error class only.",
944
956
  "registry.invalid-definition": "An invalid stored preview service definition was ignored.",
@@ -1247,10 +1259,19 @@ var STORAGE_LOG_AREAS = defineLogAreas({
1247
1259
  "retired.turn-cleanup-pending": "Cleanup of a retired Looped Review turn did not finish and stays pending.",
1248
1260
  "handoffs.prune-failed": "Pruning agent handoffs that nothing references failed; a later prune retries.",
1249
1261
  "desktop-connections.malformed": "Stored desktop connection settings were malformed, so the local connection is used.",
1262
+ "config.restrict-mode-failed": "A config file holding provider secrets could not be set to owner-only; the backend carries on.",
1250
1263
  "legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
1251
1264
  "legacy-json.archive-failed": "Imported JSON store files could not be archived.",
1265
+ "lease.timed-out": "A waiter gave up on a lease; `lease` and `family` name it, `holderAgeMs` is the time since its holder's last heartbeat (null when the holder had just gone), `waitedMs` how long the waiter waited.",
1252
1266
  "lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
1253
- "scrub.checkpoint-failed": "Deleted content could not be scrubbed from the WAL because the truncating checkpoint failed or was blocked; the next checkpoint retries.",
1267
+ "scrub.vacuum-failed": "Deleted-content page reclamation failed; the checkpoint is attempted independently.",
1268
+ "scrub.checkpoint-failed": "Deleted content could not be scrubbed from the WAL yet because the truncating checkpoint failed or a reader held an older snapshot; it is retried without waiting until it succeeds.",
1269
+ "upkeep.vacuum-failed": "Periodic page reclamation failed; the next upkeep pass retries.",
1270
+ "optimize.failed": "Refreshing the query planner's statistics failed; queries still run and the next check retries.",
1271
+ "ledger.moved": "The change-tracking ledger was moved out of the main database into its own file; `rows` and `durationMs` say how much and how long.",
1272
+ "snapshot.top-tables-failed": "The sampled table sizes from a finished snapshot could not be saved; the snapshot stands and the next one retries.",
1273
+ "snapshot.ledger-skipped": "The daily change-tracking ledger snapshot was skipped because the disk or the snapshot budget lacks room; `retryAt` says when it tries again.",
1274
+ "snapshot.ledger-failed": "The daily change-tracking ledger snapshot failed; `retryAt` says when it tries again, if known.",
1254
1275
  ...THROTTLE_LOG_EVENTS
1255
1276
  }
1256
1277
  }
@@ -1267,6 +1288,7 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
1267
1288
  "consolidation.consume-deferred": "Consuming a review consolidation result failed; it stays pending and is retried.",
1268
1289
  "dispatch.prepare-failed": "Attaching the agent before dispatch failed; the prompt request does the same work and answers authoritatively.",
1269
1290
  "interaction.resolved": "A human interaction on a pipeline stage resolved. Metadata only.",
1291
+ "user-message.background-send-refused": "The bridge refused a queued user message during a background wait; it stays queued and is retried.",
1270
1292
  "transcripts.migrated": "A transcript migration pass moved stage transcripts; counts only.",
1271
1293
  "transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
1272
1294
  "restore.skipped": "A pipeline could not be restored at startup and was skipped.",
@@ -1304,6 +1326,8 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
1304
1326
  description: "Change tracking: turn capture, evidence pulls and measurements.",
1305
1327
  events: {
1306
1328
  "journal-import.failed": "Importing surviving OpenCode command journals as legacy summaries failed.",
1329
+ "measurement-drain.failed": "Draining an owner's superseded measurements failed; the retention pass retries.",
1330
+ "retention.failed": "A retention pass failed partway; what it deleted stands and the next pass goes on.",
1307
1331
  "projection.failed": "Projecting a change event onto its environment failed.",
1308
1332
  "startup.reconcile-failed": "Reconciling change tracking at startup failed.",
1309
1333
  "turn-start.capture-failed": "Capturing a turn's start failed, so the turn is untracked.",
@@ -1334,7 +1358,16 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
1334
1358
  coordinator: {
1335
1359
  description: "Coordinators: delegations, status wakes and their store.",
1336
1360
  events: {
1361
+ ...THROTTLE_LOG_EVENTS,
1337
1362
  "delegation.open-failed": "A delegation could not be opened; `source` says for what.",
1363
+ "delegation.reconcile-failed": "One delegation could not be settled; the rest of the pass still ran and the next one retries.",
1364
+ "delegation.wake-failed": "One delegation's wake could not be delivered; the rest of the pass still ran and the next one retries.",
1365
+ "delegation.wake-held": "A wake is waiting on a state the user can change (messaging off, conversation limit), and is not counted as a failure.",
1366
+ "delegation.wake-pass-failed": "A delegation wake pass could not run; the next sweep retries.",
1367
+ "delegation.wake-retire-failed": "A wake that keeps failing could not be given up on; the next pass retries.",
1368
+ "delegation.wake-retire-notice-failed": "The one notice for a wake being retired could not be sent; the wake stays owed and the next pass retries.",
1369
+ "delegation.wake-retired": "A wake kept failing and was given up on; `kind` is the last failure.",
1370
+ "mail.reconcile-failed": "One coordinator's mail could not be reconciled; the sweep carried on with the others.",
1338
1371
  "deliver-now.drain-failed": "The mail delivery pass after deliverNow failed; the next sweep delivers.",
1339
1372
  "mail.move-failed": "Mail could not move to the new main coordinator.",
1340
1373
  "work.move-failed": "Work could not move to the main coordinator.",
@@ -1459,6 +1492,8 @@ var DOCKER_LOG_AREAS = defineLogAreas({
1459
1492
  "portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
1460
1493
  "git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
1461
1494
  "git-mirror.refreshed": "A project's Git mirror was built or updated.",
1495
+ "git-mirror.seeded": "A project's Git mirror was built from its host checkout and only what the remote added to it.",
1496
+ "git-mirror.seed-skipped": "A project's host checkout could not seed its Git mirror, so the build downloads everything.",
1462
1497
  "git-mirror.refresh-failed": "A project's Git mirror could not be updated. New clones still work, from the mirror as it was or from the remote.",
1463
1498
  "git-mirror.low-disk": "A project's Git mirror was not updated: the disk is nearly full.",
1464
1499
  "git-mirror.oversized": "A project's repository is too large for a Git mirror, so its environments keep the blobless clone.",
@@ -1470,6 +1505,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
1470
1505
  "git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
1471
1506
  "project-seed.refused": "A project .env, .env.local or opencode.json was not copied into a new container: a link, not a regular file, outside the project, too large or unreadable.",
1472
1507
  "opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
1508
+ "log-driver.unbounded": "The Docker daemon offers neither the local nor the json-file log driver, so new containers keep its default driver, whose log may be uncapped. Written once per backend.",
1473
1509
  "lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
1474
1510
  "login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
1475
1511
  "login-keeper.refresh-failed": "Refreshing the host Claude login failed. Fixed text: CLI output can hold credentials.",
@@ -1493,6 +1529,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
1493
1529
  essential: true,
1494
1530
  fields: { staleForMs: "number" }
1495
1531
  },
1532
+ "writer-lease.listener-failed": "The callback told about a lost registry writer lease threw, so the schedules settings learn of the loss only at their next read.",
1496
1533
  "writer-lease.not-acquired": {
1497
1534
  description: "This backend started without the registry writer lease, for the fixed `reason` given. A second backend on one data directory is normal: it serves reads, runs no schedules and refuses container changes.",
1498
1535
  essential: true,
@@ -2147,6 +2184,7 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
2147
2184
  events: {
2148
2185
  "events.disconnected": "The main event stream dropped; it reconnects and replays.",
2149
2186
  "terminal-stream.disconnected": "A terminal event stream dropped; it reconnects.",
2187
+ "relayed-stream.disconnected": "The relayed node event stream dropped; it reconnects.",
2150
2188
  "connection-listener.failed": "A main stream connection state listener threw.",
2151
2189
  "event-listener.failed": "A listener for a gateway event threw.",
2152
2190
  "stream-listener.failed": "A listener for the stream-connected notice threw."
@@ -3277,9 +3315,76 @@ function createBridgeDiagnostics(bridge, state, metrics) {
3277
3315
  }
3278
3316
  var bufferedFlushes = new Set;
3279
3317
 
3318
+ // ../protocol/src/node/bridge-credential.ts
3319
+ import { createHash as createHash2, randomBytes, timingSafeEqual } from "node:crypto";
3320
+ import { createRequire } from "node:module";
3321
+ var BRIDGE_TOKEN_PREFIX = "okb_";
3322
+ var PR_SET_DUMPABLE = 4;
3323
+ var VERIFIER_PATTERN = /^[0-9a-f]{64}$/;
3324
+ var log3 = createLogger("bridge.lifecycle");
3325
+ function mintBridgeToken() {
3326
+ return `${BRIDGE_TOKEN_PREFIX}${randomBytes(32).toString("base64url")}`;
3327
+ }
3328
+ function bridgeTokenVerifier(token) {
3329
+ return createHash2("sha256").update(token).digest("hex");
3330
+ }
3331
+ function bridgeTokenVerifierEnv(tokenEnv) {
3332
+ return `${tokenEnv}_SHA256`;
3333
+ }
3334
+ function credentialFromVerifier(verifier, plainToken) {
3335
+ const expected = Buffer.from(verifier, "hex");
3336
+ return {
3337
+ plainToken,
3338
+ matches(candidate) {
3339
+ if (!candidate)
3340
+ return false;
3341
+ return timingSafeEqual(expected, createHash2("sha256").update(candidate).digest());
3342
+ }
3343
+ };
3344
+ }
3345
+ function bridgeCredentialFromToken(token) {
3346
+ return credentialFromVerifier(bridgeTokenVerifier(token), token);
3347
+ }
3348
+ function markProcessNonDumpable(loadFfi = () => createRequire(import.meta.url)("bun:ffi")) {
3349
+ if (process.platform !== "linux" || !process.versions.bun)
3350
+ return false;
3351
+ try {
3352
+ const { dlopen, FFIType } = loadFfi();
3353
+ const libc = dlopen("libc.so.6", {
3354
+ prctl: {
3355
+ args: [FFIType.i32, FFIType.u64, FFIType.u64, FFIType.u64, FFIType.u64],
3356
+ returns: FFIType.i32
3357
+ }
3358
+ });
3359
+ try {
3360
+ if (libc.symbols.prctl(PR_SET_DUMPABLE, 0n, 0n, 0n, 0n) === 0)
3361
+ return true;
3362
+ } finally {
3363
+ libc.close();
3364
+ }
3365
+ log3.warn("credential.not-hardened", { reason: "prctl-refused" });
3366
+ } catch {
3367
+ log3.warn("credential.not-hardened", { reason: "ffi-unavailable" });
3368
+ }
3369
+ return false;
3370
+ }
3371
+ function loadBridgeCredential(tokenEnv, options = {}) {
3372
+ const env = options.env ?? process.env;
3373
+ const verifierEnv = bridgeTokenVerifierEnv(tokenEnv);
3374
+ const verifier = env[verifierEnv]?.trim();
3375
+ const token = env[tokenEnv]?.trim();
3376
+ delete env[verifierEnv];
3377
+ delete env[tokenEnv];
3378
+ if (verifier) {
3379
+ (options.harden ?? markProcessNonDumpable)();
3380
+ return VERIFIER_PATTERN.test(verifier) ? credentialFromVerifier(verifier, undefined) : bridgeCredentialFromToken(mintBridgeToken());
3381
+ }
3382
+ return bridgeCredentialFromToken(token || mintBridgeToken());
3383
+ }
3384
+
3280
3385
  // ../../bridges/acp-bridge/src/acp-context.ts
3281
3386
  import { spawn as spawn2 } from "node:child_process";
3282
- import { createHmac, randomBytes as randomBytes2, timingSafeEqual } from "node:crypto";
3387
+ import { createHmac, randomBytes as randomBytes3, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
3283
3388
  import { resolve as resolve3 } from "node:path";
3284
3389
 
3285
3390
  // ../protocol/src/capacity-retry.ts
@@ -12104,7 +12209,7 @@ import { spawn } from "node:child_process";
12104
12209
  import { constants } from "node:fs";
12105
12210
  import { lstat, open as open2, realpath } from "node:fs/promises";
12106
12211
  import { dirname, isAbsolute, join as join2, relative, resolve, sep } from "node:path";
12107
- import { randomBytes } from "node:crypto";
12212
+ import { randomBytes as randomBytes2 } from "node:crypto";
12108
12213
 
12109
12214
  // ../protocol/src/coordinator-web-research.ts
12110
12215
  var DEFAULT_COORDINATOR_RESEARCH_MCP_SERVERS = Object.freeze([{ name: "context7", url: "https://mcp.context7.com/mcp" }]);
@@ -12520,7 +12625,7 @@ class AcpClientMethods {
12520
12625
  }
12521
12626
  const cwd = await secureTerminalCwd(request.cwd, this.workspaceRoot);
12522
12627
  const outputLimit = Math.min(MAX_TERMINAL_OUTPUT_BYTES, Number.isSafeInteger(request.outputByteLimit) && (request.outputByteLimit ?? 0) > 0 ? request.outputByteLimit : DEFAULT_TERMINAL_OUTPUT_BYTES);
12523
- const terminalId = randomBytes(16).toString("hex");
12628
+ const terminalId = randomBytes2(16).toString("hex");
12524
12629
  const child = this.spawnTerminalImpl(request.command, request.args ?? [], {
12525
12630
  cwd,
12526
12631
  env: withoutBridgeControlEnvironment({
@@ -12918,7 +13023,7 @@ function grokQuestionTimeoutFromEnv(env) {
12918
13023
  }
12919
13024
 
12920
13025
  // ../../bridges/acp-bridge/src/acp-mcp-inventory.ts
12921
- import { createHash as createHash2 } from "node:crypto";
13026
+ import { createHash as createHash3 } from "node:crypto";
12922
13027
  import { readFile, stat } from "node:fs/promises";
12923
13028
  import { homedir as homedir2 } from "node:os";
12924
13029
  import { join as join4, resolve as resolve2 } from "node:path";
@@ -13009,7 +13114,7 @@ function grokMcpConfigFiles(options = { cwd: process.cwd() }) {
13009
13114
  }
13010
13115
  async function fileDigest(file) {
13011
13116
  try {
13012
- return `sha256:${createHash2("sha256").update(await readFile(file)).digest("base64url")}`;
13117
+ return `sha256:${createHash3("sha256").update(await readFile(file)).digest("base64url")}`;
13013
13118
  } catch {
13014
13119
  return "absent";
13015
13120
  }
@@ -13017,7 +13122,7 @@ async function fileDigest(file) {
13017
13122
  async function grokMcpConfigFingerprint(files) {
13018
13123
  const [user, project] = await Promise.all([fileDigest(files.user), fileDigest(files.project)]);
13019
13124
  return {
13020
- fingerprint: createHash2("sha256").update(`user=${user}\x00project=${project}`).digest("base64url"),
13125
+ fingerprint: createHash3("sha256").update(`user=${user}\x00project=${project}`).digest("base64url"),
13021
13126
  sources: { user, project }
13022
13127
  };
13023
13128
  }
@@ -13076,26 +13181,20 @@ function grokMcpConfigStatus(loaded, current) {
13076
13181
  }
13077
13182
 
13078
13183
  // ../../bridges/acp-bridge/src/acp-context.ts
13079
- var log3 = createLogger("bridge.acp");
13184
+ var log4 = createLogger("bridge.acp");
13080
13185
  var CURSOR_TODO_STATUSES = ["pending", "in_progress", "completed", "cancelled"];
13081
13186
  var providerConfig = loadAcpProviderConfig();
13082
13187
  var provider = providerConfig.id;
13083
13188
  var port = parsePort(process.env.PORT);
13084
13189
  var hostname = process.env.HOSTNAME?.trim() || "127.0.0.1";
13085
13190
  var workingDirectory = resolve3(process.env.CWD?.trim() || process.cwd());
13086
- var authToken = process.env.ACP_BRIDGE_TOKEN?.trim() || randomBytes2(32).toString("base64url");
13087
- delete process.env.ACP_BRIDGE_TOKEN;
13191
+ var bridgeCredential = loadBridgeCredential("ACP_BRIDGE_TOKEN");
13192
+ var authToken = bridgeCredential.plainToken ?? "";
13193
+ var externalSessionKey = randomBytes3(32);
13088
13194
  var executable = providerConfig.executable;
13089
13195
  var stateDirectory = process.env.ACP_STATE_DIR?.trim();
13090
13196
  var stateFile = stateDirectory ? resolve3(stateDirectory, "state.json") : null;
13091
13197
  var sessions = new Map;
13092
- var cursorDiscoveryRevision = 0;
13093
- function currentCursorDiscoveryRevision() {
13094
- return cursorDiscoveryRevision;
13095
- }
13096
- function bumpCursorDiscoveryRevision() {
13097
- cursorDiscoveryRevision = cursorDiscoveryRevision >= Number.MAX_SAFE_INTEGER ? 0 : cursorDiscoveryRevision + 1;
13098
- }
13099
13198
  var acpToolSourceStates = new WeakMap;
13100
13199
  var saturatedText = new WeakSet;
13101
13200
  var trimmedToolCalls = new WeakMap;
@@ -13209,18 +13308,6 @@ var CLOSE_ATTACH_WAIT_MS = parseDuration(process.env.ACP_CLOSE_ATTACH_WAIT_MS, 5
13209
13308
  var CLOSE_CANCEL_WAIT_MS = parseDuration(process.env.ACP_CLOSE_CANCEL_WAIT_MS, 2000);
13210
13309
  var CLOSE_SESSION_WAIT_MS = parseDuration(process.env.ACP_CLOSE_SESSION_WAIT_MS, 2000);
13211
13310
  var SESSION_CLOSING_ERROR = "Session is closing";
13212
- var CURSOR_BACKGROUND_WAIT_MS = parseDuration(process.env.ACP_CURSOR_BACKGROUND_WAIT_MS, 30 * 60000);
13213
- var MAX_CURSOR_BACKGROUND_CONTINUATIONS = 4;
13214
- var MAX_CURSOR_CHILD_RESULT_BYTES = 64 * 1024;
13215
- var MAX_CURSOR_CHILD_PARTS = 64;
13216
- var MAX_CURSOR_TRANSCRIPT_HYDRATE_CHILDREN = 8;
13217
- var MAX_CURSOR_SETTLED_CLAIMS = 64;
13218
- var CURSOR_JSONL_SOURCE_PREFIX = "cursor-jsonl:";
13219
- var MAX_CURSOR_DISCOVERY_ENTRIES = 4096;
13220
- var CURSOR_CHILD_DISCOVERY_SKEW_MS = 5000;
13221
- var MAX_CURSOR_CHILD_PROMPT_BYTES = 4 * 1024;
13222
- var MAX_CURSOR_CHILD_PROMPT_RECORDS = 8;
13223
- var CURSOR_BACKGROUND_CONTINUATION_PREFIX = "Background subagent finished.";
13224
13311
  var POLICY_DENIAL_MAX_CONTINUATIONS = 8;
13225
13312
  var RETRIABLE_PROVIDER_RETRY_POLICY = {
13226
13313
  ...DEFAULT_CAPACITY_RETRY_POLICY,
@@ -13315,7 +13402,7 @@ class AcpProcess {
13315
13402
  }
13316
13403
  this.child.once("error", (error) => this.#close(error));
13317
13404
  this.child.once("exit", (code, signal) => {
13318
- log3.warn("agent.exited", {
13405
+ log4.warn("agent.exited", {
13319
13406
  provider,
13320
13407
  pid: this.child.pid ?? null,
13321
13408
  code,
@@ -13562,7 +13649,7 @@ function activeSessionReservations() {
13562
13649
  var EXTERNAL_SESSION_PREFIX = "acp-session:";
13563
13650
  function externalSessionToken(acpSessionId) {
13564
13651
  const encoded = Buffer.from(acpSessionId).toString("base64url");
13565
- const signature = createHmac("sha256", authToken).update(encoded).digest("base64url");
13652
+ const signature = createHmac("sha256", externalSessionKey).update(encoded).digest("base64url");
13566
13653
  return `${EXTERNAL_SESSION_PREFIX}${encoded}.${signature}`;
13567
13654
  }
13568
13655
  function parseExternalSessionToken(value) {
@@ -13576,14 +13663,14 @@ function parseExternalSessionToken(value) {
13576
13663
  const signature = token.slice(separator + 1);
13577
13664
  if (!encoded || encoded.length > 1024 || !signature)
13578
13665
  return null;
13579
- const expected = createHmac("sha256", authToken).update(encoded).digest();
13666
+ const expected = createHmac("sha256", externalSessionKey).update(encoded).digest();
13580
13667
  let supplied;
13581
13668
  try {
13582
13669
  supplied = Buffer.from(signature, "base64url");
13583
13670
  } catch {
13584
13671
  return null;
13585
13672
  }
13586
- if (supplied.length !== expected.length || !timingSafeEqual(supplied, expected))
13673
+ if (supplied.length !== expected.length || !timingSafeEqual2(supplied, expected))
13587
13674
  return null;
13588
13675
  let decoded;
13589
13676
  try {
@@ -14420,7 +14507,7 @@ function encodedStringBytes(value, previous) {
14420
14507
  // ../../bridges/acp-bridge/src/acp-persist-writer.ts
14421
14508
  import { promises as fs2 } from "node:fs";
14422
14509
  import { dirname as dirname2 } from "node:path";
14423
- import { randomBytes as randomBytes3 } from "node:crypto";
14510
+ import { randomBytes as randomBytes4 } from "node:crypto";
14424
14511
 
14425
14512
  // ../protocol/src/node/transcript-window.ts
14426
14513
  import { Buffer as Buffer4 } from "node:buffer";
@@ -14510,7 +14597,7 @@ function boundTranscriptResponse(messages, maximumBytes, options = {}) {
14510
14597
  }
14511
14598
 
14512
14599
  // ../../bridges/acp-bridge/src/acp-persist-writer.ts
14513
- var log4 = createLogger("bridge.acp");
14600
+ var log5 = createLogger("bridge.acp");
14514
14601
  function boundPersistedSnapshot(snapshot) {
14515
14602
  const bounded = {
14516
14603
  ...snapshot,
@@ -14665,10 +14752,7 @@ function persistedSnapshot() {
14665
14752
  ...state.commandsRevision === undefined ? {} : { commandsRevision: state.commandsRevision },
14666
14753
  ...state.commandsTruncated ? { commandsTruncated: true } : {},
14667
14754
  ...state.title ? { title: state.title } : {},
14668
- ...state.subagentLimitExceeded ? { subagentLimitExceeded: true } : {},
14669
- ...state.settledCursorAgentIds.size > 0 ? {
14670
- settledCursorAgentIds: Array.from(state.settledCursorAgentIds).slice(-MAX_CURSOR_SETTLED_CLAIMS)
14671
- } : {}
14755
+ ...state.subagentLimitExceeded ? { subagentLimitExceeded: true } : {}
14672
14756
  }))
14673
14757
  };
14674
14758
  return boundPersistedSnapshot(snapshot);
@@ -14707,7 +14791,7 @@ function schedulePersist() {
14707
14791
  await writePersistedState();
14708
14792
  });
14709
14793
  setPersistenceTail(operation.catch((error) => {
14710
- log4.warn("state.persist-failed", { error: formatLogError(error, { stack: false }) });
14794
+ log5.warn("state.persist-failed", { error: formatLogError(error, { stack: false }) });
14711
14795
  }));
14712
14796
  }
14713
14797
  function persistState() {
@@ -14727,16 +14811,16 @@ async function writePersistedState() {
14727
14811
  throw new Error("ACP persisted state exceeds its byte limit");
14728
14812
  }
14729
14813
  await fs2.mkdir(dirname2(file), { recursive: true, mode: 448 });
14730
- const temporary = `${file}.${process.pid}.${randomBytes3(6).toString("hex")}.tmp`;
14814
+ const temporary = `${file}.${process.pid}.${randomBytes4(6).toString("hex")}.tmp`;
14731
14815
  await fs2.writeFile(temporary, payload, { mode: 384 });
14732
14816
  await fs2.rename(temporary, file);
14733
14817
  }
14734
14818
 
14735
14819
  // ../../bridges/acp-bridge/src/acp-rows.ts
14736
- import { randomBytes as randomBytes4 } from "node:crypto";
14820
+ import { randomBytes as randomBytes5 } from "node:crypto";
14737
14821
 
14738
14822
  // ../protocol/src/node/revised-rows.ts
14739
- import { createHash as createHash3 } from "node:crypto";
14823
+ import { createHash as createHash4 } from "node:crypto";
14740
14824
  var RECENTLY_REVISED_ROWS_MAX = 128;
14741
14825
 
14742
14826
  class RecentlyRevisedRows {
@@ -14774,7 +14858,7 @@ class RecentlyRevisedRows {
14774
14858
  function revisedRowsReconciliationToken(overflowVersion, omitted) {
14775
14859
  if (overflowVersion === 0 && omitted.length === 0)
14776
14860
  return;
14777
- const digest = createHash3("sha256").update(String(overflowVersion));
14861
+ const digest = createHash4("sha256").update(String(overflowVersion));
14778
14862
  for (const row of omitted)
14779
14863
  digest.update(JSON.stringify(row) ?? "null");
14780
14864
  return digest.digest("hex");
@@ -14823,7 +14907,7 @@ function currentAssistantMessage(state) {
14823
14907
  if (!message || message.role !== "assistant" || rowIsFull(message) || state.status !== "running" && state.historyReplay !== "hydrate") {
14824
14908
  const modelId = boundedModelId(state.sessionConfig.composer.selectedModelId);
14825
14909
  message = {
14826
- id: randomBytes4(12).toString("hex"),
14910
+ id: randomBytes5(12).toString("hex"),
14827
14911
  role: "assistant",
14828
14912
  content: "",
14829
14913
  parts: [],
@@ -15759,44 +15843,12 @@ function ensureAcpToolSource(part) {
15759
15843
  acpToolSourceStates.set(part, source);
15760
15844
  return source;
15761
15845
  }
15762
- function recordCursorTaskPrompt(part, prompt) {
15763
- const bounded = truncateUtf8(prompt.trim(), MAX_CURSOR_CHILD_PROMPT_BYTES);
15764
- if (!bounded)
15765
- return false;
15766
- const source = ensureAcpToolSource(part);
15767
- if (source.cursorTask?.prompt)
15768
- return false;
15769
- source.cursorTask = { ...source.cursorTask, prompt: bounded };
15770
- renderAcpToolSource(part, source);
15771
- return true;
15772
- }
15773
- function toolPartAgentId(part) {
15774
- if (typeof part.toolArgs?.agentId === "string") {
15775
- return truncateUtf8(part.toolArgs.agentId.trim(), MAX_TOOL_ID_BYTES);
15776
- }
15777
- if (typeof part.toolArgs?.agent_id === "string") {
15778
- return truncateUtf8(part.toolArgs.agent_id.trim(), MAX_TOOL_ID_BYTES);
15779
- }
15780
- const lifecycle = toolCallLifecycle(part.toolOutput);
15781
- if (typeof lifecycle?.agentId === "string") {
15782
- return truncateUtf8(lifecycle.agentId.trim(), MAX_TOOL_ID_BYTES);
15783
- }
15784
- if (typeof lifecycle?.agent_id === "string") {
15785
- return truncateUtf8(lifecycle.agent_id.trim(), MAX_TOOL_ID_BYTES);
15786
- }
15787
- return;
15788
- }
15789
15846
  function syncActiveSubagentTool(state, part) {
15790
15847
  if (part.agentState === "active") {
15791
- const agentId = toolPartAgentId(part);
15792
- const reportedPrompt = part.cursorTaskPromptReported === true && typeof part.toolArgs?.prompt === "string" ? truncateUtf8(part.toolArgs.prompt.trim(), MAX_CURSOR_CHILD_PROMPT_BYTES) : undefined;
15793
15848
  const activated = activateSubagent(state, part.toolUseId, {
15794
15849
  ...typeof part.toolArgs?.description === "string" ? { description: truncateUtf8(part.toolArgs.description.trim(), MAX_TOOL_TITLE_BYTES) } : {},
15795
15850
  ...typeof part.toolArgs?.subagent_type === "string" ? { subagentType: truncateUtf8(part.toolArgs.subagent_type.trim(), MAX_TOOL_NAME_BYTES) } : {},
15796
- ...part.toolState ? { toolState: part.toolState } : {},
15797
- ...reportedPrompt ? { reportedPrompt } : {},
15798
- ...agentId ? { agentId, agentIdDiscovered: false } : {},
15799
- ...agentId ? { agentIdSettlementSafe: false } : {}
15851
+ ...part.toolState ? { toolState: part.toolState } : {}
15800
15852
  });
15801
15853
  if (!activated) {
15802
15854
  part.agentState = "failed";
@@ -15833,32 +15885,25 @@ function activateSubagent(state, toolUseId, descriptor) {
15833
15885
  state.child?.notify("session/cancel", { sessionId: state.acpSessionId });
15834
15886
  return false;
15835
15887
  }
15836
- const wasActive = state.activeSubagentToolIds.has(toolUseId);
15837
15888
  const previous = state.activeSubagentDescriptors.get(toolUseId);
15838
15889
  const next = {
15839
15890
  ...previous,
15840
15891
  ...descriptor,
15841
- agentId: descriptor.agentId ?? previous?.agentId,
15842
15892
  description: descriptor.description ?? previous?.description,
15843
15893
  subagentType: descriptor.subagentType ?? previous?.subagentType,
15844
15894
  toolState: descriptor.toolState ?? previous?.toolState
15845
15895
  };
15846
15896
  state.activeSubagentToolIds.add(toolUseId);
15847
15897
  state.activeSubagentDescriptors.set(toolUseId, next);
15848
- if (!wasActive || previous?.agentId !== next.agentId || previous?.agentIdDiscovered !== next.agentIdDiscovered || previous?.agentIdSettlementSafe !== next.agentIdSettlementSafe || previous?.reportedPrompt !== next.reportedPrompt) {
15849
- bumpCursorDiscoveryRevision();
15850
- }
15851
15898
  return true;
15852
15899
  }
15853
15900
  function settleActiveSubagent(state, toolUseId) {
15854
- const activeDeleted = state.activeSubagentToolIds.delete(toolUseId);
15855
- const descriptorDeleted = state.activeSubagentDescriptors.delete(toolUseId);
15901
+ state.activeSubagentToolIds.delete(toolUseId);
15902
+ state.activeSubagentDescriptors.delete(toolUseId);
15856
15903
  for (const [subagentId, mappedToolUseId] of state.subagentToolIds) {
15857
15904
  if (mappedToolUseId === toolUseId)
15858
15905
  state.subagentToolIds.delete(subagentId);
15859
15906
  }
15860
- if (activeDeleted || descriptorDeleted)
15861
- bumpCursorDiscoveryRevision();
15862
15907
  }
15863
15908
  var MAX_CURSOR_TASK_PROMPT_BYTES = 64 * 1024;
15864
15909
  var TASK_LAUNCH_ARG_KEYS = [
@@ -16340,8 +16385,6 @@ function applyCursorTask(state, params) {
16340
16385
  }
16341
16386
  }
16342
16387
  renderAcpToolSource(part, source);
16343
- if (prompt)
16344
- part.cursorTaskPromptReported = true;
16345
16388
  if (part.agentState === "finished" || part.agentState === "failed") {
16346
16389
  stampSubagentRuntimeDuration(part);
16347
16390
  }
@@ -16349,7 +16392,6 @@ function applyCursorTask(state, params) {
16349
16392
  commitToolPartMutation(state, part, source);
16350
16393
  }
16351
16394
  function failAllActiveSubagents(state) {
16352
- const hadActiveSubagents = state.activeSubagentToolIds.size > 0 || state.activeSubagentDescriptors.size > 0;
16353
16395
  for (const message of state.messages) {
16354
16396
  for (const part of message.parts) {
16355
16397
  if (part.type !== "tool-invocation" || !state.activeSubagentToolIds.has(part.toolUseId))
@@ -16365,8 +16407,6 @@ function failAllActiveSubagents(state) {
16365
16407
  state.activeSubagentToolIds.clear();
16366
16408
  state.activeSubagentDescriptors.clear();
16367
16409
  state.subagentToolIds.clear();
16368
- if (hadActiveSubagents)
16369
- bumpCursorDiscoveryRevision();
16370
16410
  }
16371
16411
  function settleEvictedSubagentFromToolUpdate(state, toolUseId, update) {
16372
16412
  const toolState = mapAcpToolState(update.status);
@@ -16702,7 +16742,7 @@ var DEFAULT_WORKFLOW_RESULT_TOOLS_SETTINGS = {
16702
16742
  };
16703
16743
 
16704
16744
  // ../../bridges/acp-bridge/src/acp-session.ts
16705
- import { randomBytes as randomBytes7 } from "node:crypto";
16745
+ import { randomBytes as randomBytes8 } from "node:crypto";
16706
16746
  import { resolve as resolve7 } from "node:path";
16707
16747
 
16708
16748
  // ../../bridges/acp-bridge/src/session-config.ts
@@ -17930,18 +17970,18 @@ async function readJournal(path, maxEntries) {
17930
17970
  }
17931
17971
 
17932
17972
  // ../../bridges/acp-bridge/src/grok-interjection.ts
17933
- import { createHash as createHash4, randomBytes as randomBytes5 } from "node:crypto";
17973
+ import { createHash as createHash5, randomBytes as randomBytes6 } from "node:crypto";
17934
17974
  var GROK_INTERJECT_METHOD = "_x.ai/interject";
17935
17975
  var GROK_INTERJECTION_NOTIFICATION = "_x.ai/session/interjection";
17936
17976
  var MAX_GROK_INTERJECTION_JOURNAL = 256;
17937
17977
  var MAX_GROK_INTERJECTION_ID_BYTES = 512;
17938
17978
  var MAX_GROK_INTERJECTION_TEXT_BYTES = 64 * 1024;
17939
- var grokBridgeGeneration = randomBytes5(12).toString("base64url");
17979
+ var grokBridgeGeneration = randomBytes6(12).toString("base64url");
17940
17980
  function grokRunId(promptSequence) {
17941
17981
  return `grok:${grokBridgeGeneration}:${promptSequence}`;
17942
17982
  }
17943
17983
  function grokInterjectionDigest(text) {
17944
- return createHash4("sha256").update(text).digest("hex");
17984
+ return createHash5("sha256").update(text).digest("hex");
17945
17985
  }
17946
17986
  function parseGrokInterjectResult(value) {
17947
17987
  if (!isObject6(value) || value.status !== "queued")
@@ -18033,7 +18073,7 @@ function applyGrokInterjectionBroadcast(journal, acpSessionId, method, params, n
18033
18073
  return broadcast;
18034
18074
  }
18035
18075
  async function probeGrokInterjectionExtension(requester) {
18036
- const probeId = `orkestrator-qualification-${randomBytes5(12).toString("base64url")}`;
18076
+ const probeId = `orkestrator-qualification-${randomBytes6(12).toString("base64url")}`;
18037
18077
  try {
18038
18078
  await requestGrokInterjection(requester, {
18039
18079
  sessionId: probeId,
@@ -18069,7 +18109,7 @@ function isObject6(value) {
18069
18109
  }
18070
18110
 
18071
18111
  // ../../bridges/acp-bridge/src/acp-commands.ts
18072
- import { randomBytes as randomBytes6 } from "node:crypto";
18112
+ import { randomBytes as randomBytes7 } from "node:crypto";
18073
18113
 
18074
18114
  // ../protocol/src/agent-command-catalogue.ts
18075
18115
  var NATIVE_AGENT_COMMAND_CATALOGUE_VERSION = 1;
@@ -18200,7 +18240,7 @@ function commandUnavailableResponse(message) {
18200
18240
  }
18201
18241
 
18202
18242
  // ../../bridges/acp-bridge/src/acp-commands.ts
18203
- var COMMAND_CATALOGUE_GENERATION = `${provider}:${randomBytes6(8).toString("hex")}`;
18243
+ var COMMAND_CATALOGUE_GENERATION = `${provider}:${randomBytes7(8).toString("hex")}`;
18204
18244
  var COMMAND_ROWS_BYTE_BUDGET = COMMAND_CATALOGUE_LIMITS.maxWireBytes - 16 * 1024;
18205
18245
  var PROVIDER_LABEL = `${provider.charAt(0).toUpperCase()}${provider.slice(1)}`;
18206
18246
  function commandId(name) {
@@ -18372,7 +18412,7 @@ function compactCommandSelection(state) {
18372
18412
  }
18373
18413
 
18374
18414
  // ../../bridges/acp-bridge/src/acp-persistence.ts
18375
- var log5 = createLogger("bridge.acp");
18415
+ var log6 = createLogger("bridge.acp");
18376
18416
  async function listNormalizedModels(signal) {
18377
18417
  const live = mergeComposerCatalog(provider, [
18378
18418
  ...catalogCache ? [catalogCache] : [],
@@ -18420,14 +18460,14 @@ function restoreSessionConfig(candidate) {
18420
18460
  const restored = parsePersistedAcpSessionConfig(provider, candidate.sessionConfig);
18421
18461
  if (restored)
18422
18462
  return restored;
18423
- log5.warn("state.session-config-reset");
18463
+ log6.warn("state.session-config-reset");
18424
18464
  return emptySessionConfig();
18425
18465
  }
18426
18466
  if (candidate.composer !== undefined) {
18427
18467
  const composer = parsePersistedComposerState(provider, candidate.composer);
18428
18468
  if (composer)
18429
18469
  return { ...emptySessionConfig(), composer };
18430
- log5.warn("state.composer-reset");
18470
+ log6.warn("state.composer-reset");
18431
18471
  }
18432
18472
  return emptySessionConfig();
18433
18473
  }
@@ -18508,9 +18548,8 @@ async function restorePersistedState() {
18508
18548
  await loadPersistedState();
18509
18549
  } catch (error) {
18510
18550
  sessions.clear();
18511
- bumpCursorDiscoveryRevision();
18512
18551
  clientSessionKeys.clear();
18513
- log5.warn("state.discarded", { error: formatLogError(error, { stack: false }) });
18552
+ log6.warn("state.discarded", { error: formatLogError(error, { stack: false }) });
18514
18553
  const file = stateFile;
18515
18554
  if (!file)
18516
18555
  return;
@@ -18562,7 +18601,6 @@ async function loadPersistedState() {
18562
18601
  messages,
18563
18602
  activeSubagentToolIds: new Set,
18564
18603
  activeSubagentDescriptors: new Map,
18565
- settledCursorAgentIds: new Set,
18566
18604
  subagentLimitExceeded: candidate.subagentLimitExceeded === true,
18567
18605
  subagentToolIds: new Map,
18568
18606
  cursorTodos: restoreCursorTodosFromMessages(messages),
@@ -18749,7 +18787,6 @@ function normalizeBridgePart(value, index, messageId) {
18749
18787
  ...isObject3(value.toolArgs) ? { toolArgs: boundedToolArguments(value.toolArgs) } : {},
18750
18788
  ...toolState ? { toolState } : {},
18751
18789
  ...agentState ? { agentState } : {},
18752
- ...value.cursorTaskPromptReported === true ? { cursorTaskPromptReported: true } : {},
18753
18790
  ...toolTitle ? { toolTitle } : {},
18754
18791
  ...toolOutput !== undefined ? { toolOutput } : {},
18755
18792
  ...toolError !== undefined ? { toolError } : {},
@@ -18786,10 +18823,178 @@ function isStringTuple(value) {
18786
18823
  return Array.isArray(value) && value.length === 2 && typeof value[0] === "string";
18787
18824
  }
18788
18825
 
18826
+ // ../protocol/src/rich-content-policy.ts
18827
+ var KIB = 1024;
18828
+ var MIB = 1024 * KIB;
18829
+ var CODE_BLOCK_POLICY = {
18830
+ maxHighlightBytes: 32 * KIB,
18831
+ maxHighlightLines: 2000,
18832
+ initialVisualLines: 24
18833
+ };
18834
+ var MERMAID_POLICY = {
18835
+ maxSourceBytes: 32 * KIB,
18836
+ maxEdges: 250,
18837
+ maxSvgBytes: 1 * MIB,
18838
+ maxSvgElements: 5000,
18839
+ renderTimeoutMs: 5000
18840
+ };
18841
+ var CHART_POLICY = {
18842
+ maxPayloadBytes: 256 * KIB,
18843
+ maxSeries: 6,
18844
+ maxBarCategories: 100,
18845
+ maxCartesianPoints: 2000,
18846
+ maxDonutSlices: 24,
18847
+ maxTitleCharacters: 200,
18848
+ maxLabelCharacters: 200,
18849
+ maxDescriptionCharacters: 2000,
18850
+ maxSourceNotes: 8,
18851
+ maxSourceNoteCharacters: 500,
18852
+ maxIdCharacters: 64,
18853
+ maxUnitCharacters: 32,
18854
+ maxAbsoluteValue: 1000000000000000,
18855
+ maxJsonDepth: 16
18856
+ };
18857
+ var WORKFLOW_SNAPSHOT_POLICY = {
18858
+ maxNormalizedBytes: 256 * KIB,
18859
+ maxNodes: 200,
18860
+ maxEdges: 400,
18861
+ maxIdCharacters: 128,
18862
+ maxLabelCharacters: 200,
18863
+ maxDescriptionCharacters: 2000,
18864
+ maxRawStatusCharacters: 100,
18865
+ maxLinksPerNode: 8
18866
+ };
18867
+ var STATIC_HTML_POLICY = {
18868
+ maxSourceBytes: 256 * KIB,
18869
+ maxPreparedBytes: 16 * MIB,
18870
+ maxElements: 5000
18871
+ };
18872
+ var STATIC_PRESENTATION_POLICY = {
18873
+ maxDocumentBytes: STATIC_HTML_POLICY.maxSourceBytes,
18874
+ maxElements: STATIC_HTML_POLICY.maxElements,
18875
+ maxFramesPerWindow: 4,
18876
+ renderTimeoutMs: 15000,
18877
+ maxSizeChangesPerWindow: 16,
18878
+ sizeChangeWindowMs: 5000,
18879
+ maxRefusedMessages: 100,
18880
+ maxSearchTextCharacters: 64 * KIB,
18881
+ searchTextChunkCharacters: 2 * KIB
18882
+ };
18883
+ var INTERACTIVE_HTML_POLICY = {
18884
+ maxAuthoredBytes: 512 * KIB,
18885
+ maxAssets: 32,
18886
+ maxAssetBytesTotal: 10 * MIB,
18887
+ maxDependencies: 4,
18888
+ maxPreparedBytes: 16 * MIB,
18889
+ maxRuntimeElements: 1e4,
18890
+ maxProbeSteps: 20,
18891
+ maxProbeStepMs: 2000,
18892
+ defaultWaitVisibleMs: 1000,
18893
+ maxProbeTextCharacters: 1024,
18894
+ probeTargetPattern: /^[A-Za-z][A-Za-z0-9_-]{0,63}$/
18895
+ };
18896
+ var PREVIEW_CAPTURE_POLICY = {
18897
+ maxPngBytes: 8 * MIB,
18898
+ maxPixels: 12000000,
18899
+ maxDimension: 4096,
18900
+ minDimension: 240,
18901
+ maxCapturesPerReceipt: 3,
18902
+ defaultViewport: { width: 960, height: 640, deviceScaleFactor: 1 }
18903
+ };
18904
+ var PREVIEW_ADMISSION_POLICY = {
18905
+ runningPerEnvironment: 1,
18906
+ runningGlobal: 2,
18907
+ queuedPerEnvironment: 8,
18908
+ queuedGlobal: 16,
18909
+ nonterminalPerConversation: 2,
18910
+ queuedMetadataBytesGlobal: 8 * MIB,
18911
+ queueWaitMs: 15000,
18912
+ workerWallMs: 30000,
18913
+ readinessMs: 5000,
18914
+ operationDeadlineMs: 45000,
18915
+ cleanupGraceMs: 2000,
18916
+ workerMemoryBytes: 1024 * MIB,
18917
+ workerCpus: 2,
18918
+ workerPids: 128
18919
+ };
18920
+ var FRONTEND_RENDER_POLICY = {
18921
+ highlightConcurrency: 2,
18922
+ diagramConcurrency: 1,
18923
+ maxQueuedJobs: 32,
18924
+ maxQueuedSourceBytes: 2 * MIB,
18925
+ maxSettledCacheEntries: 128,
18926
+ maxSettledCacheBytes: 16 * MIB,
18927
+ maxInactiveViewStateEntries: 500,
18928
+ maxActiveViewStateEntries: 200,
18929
+ maxPinnedViewStateEntries: 50,
18930
+ liveExecutableHostsPerWindow: 1,
18931
+ imageDecodeMaxPixels: 40000000,
18932
+ pdfPreviewMaxPages: 100,
18933
+ pdfPreviewMaxBytes: 20 * MIB
18934
+ };
18935
+ var PDF_POLICY = {
18936
+ maxPages: 100,
18937
+ maxBytes: 20 * MIB,
18938
+ thumbnailMaxDimension: 1024,
18939
+ thumbnailMaxPngBytes: 4 * MIB,
18940
+ imageDecodeMaxPixels: 40000000,
18941
+ printMarginMm: 10,
18942
+ previewCacheEntries: 32,
18943
+ previewCacheBytes: 16 * MIB
18944
+ };
18945
+ var DIAGNOSTIC_POLICY = {
18946
+ maxPersistedEntries: 50,
18947
+ maxEntryBytes: 2 * KIB,
18948
+ maxPersistedBytes: 32 * KIB,
18949
+ maxToolFieldErrors: 20,
18950
+ maxToolDiagnosticBytes: 8 * KIB
18951
+ };
18952
+ var ARTIFACT_TOOL_POLICY = {
18953
+ maxResultBytes: 16 * KIB,
18954
+ maxSourceSliceBytes: 8 * KIB,
18955
+ maxTitleCharacters: 120,
18956
+ maxSummaryCharacters: 400,
18957
+ maxRequestKeyCharacters: 128,
18958
+ maxRepairRevisions: 2,
18959
+ maxTransientRetries: 2,
18960
+ maxUnpublishedArtifactsPerConversation: 100,
18961
+ maxRevisionsPerArtifact: 100,
18962
+ assetStoreBytesPerEnvironment: 1024 * MIB,
18963
+ scopeCapabilityTtlMs: 24 * 60 * 60 * 1000
18964
+ };
18965
+ var ARTIFACT_RETENTION_POLICY = {
18966
+ cleanupIntervalMs: 60 * 60 * 1000,
18967
+ abandonedStagingMs: 60 * 60 * 1000,
18968
+ unpublishedDraftMs: 7 * 24 * 60 * 60 * 1000,
18969
+ unreferencedPreviewAssetMs: 24 * 60 * 60 * 1000
18970
+ };
18971
+ var FRAME_CHANNEL_POLICY = {
18972
+ maxMessageBytes: 8 * KIB,
18973
+ messagesPerSecond: 20,
18974
+ burst: 40,
18975
+ sizeUpdatesPerSecond: 4,
18976
+ minInlineHeight: 120,
18977
+ maxInlineHeight: 1600,
18978
+ maxLinkCharacters: 2048,
18979
+ maxLinkLabelCharacters: 200
18980
+ };
18981
+
18789
18982
  // ../protocol/src/agent-system-instructions.ts
18790
- var AGENT_IMAGE_PREVIEW_INSTRUCTION = "Orkestrator renders Markdown images inline in the transcript. When you show the user an image in your reply (a screenshot, rendered preview, or chart) using Markdown image syntax, reference it by its absolute path. In a managed worktree or container environment, save the file inside the working directory, preferably in a git-ignored folder so preview files stay out of the change set. Local image previews are limited to Orkestrator-managed workspace storage or the container's /workspace. Project-home checkouts are excluded from host preview reads, even when they are the working directory, so images saved there cannot be previewed from a local Markdown path. Paths outside previewable storage, such as /tmp, also show a placeholder.";
18983
+ var AGENT_IMAGE_PREVIEW_INSTRUCTION = "Orkestrator renders Markdown images inline in the transcript. When you show the user an image in your reply (a photograph, screenshot, rendered preview, or a requested image file) using Markdown image syntax, reference it by its absolute path. In a managed worktree or container environment, save the file inside the working directory, preferably in a git-ignored folder so preview files stay out of the change set. Local image previews are limited to Orkestrator-managed workspace storage or the container's /workspace. Project-home checkouts are excluded from host preview reads, even when they are the working directory, so images saved there cannot be previewed from a local Markdown path. Paths outside previewable storage, such as /tmp, also show a placeholder.";
18791
18984
  var AGENT_DOCUMENT_INSTRUCTION = "When the user asks for a document (a report, design doc, plan, analysis, guide, or other writing to keep), prefer writing it as a Markdown file in a `docs/` folder at the root of the working directory, and tell the user the file's path. Project instructions (such as AGENTS.md or CLAUDE.md), local skills, and the user's own request take priority over this default when they say where or how to write documents.";
18985
+ var AGENT_CHART_SPEC_SHAPES = "bar adds xAxis:{kind:'category',label}, yAxis:{label,unit?}, categories:[{id,label}], series:[{id,label,points:[{categoryId,value|null}]}] (one point per category); " + "line/area/scatter add xAxis:{kind:'number'|'utc-time',label,unit?}, yAxis:{label,unit?}, series:[{id,label,points:[{x,y|null}]}]; " + "donut adds valueLabel, unit?, slices:[{id,label,value}]";
18986
+ var AGENT_CHART_FENCE_EXAMPLE = '{"schemaVersion":1,"kind":"bar","title":"Passing tests","description":"Passing tests per suite.","xAxis":{"kind":"category","label":"Suite"},"yAxis":{"label":"Tests"},"categories":[{"id":"unit","label":"Unit"},{"id":"browser","label":"Browser"}],"series":[{"id":"passed","label":"Passed","points":[{"categoryId":"unit","value":40},{"categoryId":"browser","value":8}]}]}';
18987
+ var AGENT_VISUAL_OUTPUT_INSTRUCTION = [
18988
+ "Orkestrator displays rich visuals directly in the conversation; choose one when it helps answer the question.",
18989
+ `Flows, architecture, sequences and relationships: a \`mermaid\` code fence. Standard bar, line, area, scatter and donut charts: a \`chart\` code fence holding one ChartSpecV1 JSON object with schemaVersion 1, kind, title and description; ${AGENT_CHART_SPEC_SHAPES}. For example: ${AGENT_CHART_FENCE_EXAMPLE}.`,
18990
+ "When this session has the Orkestrator artifact tools, use them for durable visuals: create_artifact, preview_artifact, get_artifact_operation to inspect the diagnostics and capture, then publish_artifact, and respect their repair limits.",
18991
+ `A custom report, timeline or layout combining text and graphics is an html-static artifact: self-contained HTML, CSS and inline SVG, with no scripts or network resources. Its verified document is displayed in the transcript as real, selectable content, so keep it within ${STATIC_PRESENTATION_POLICY.maxDocumentBytes / 1024} KiB and ${STATIC_PRESENTATION_POLICY.maxElements} elements, use fluid widths, let content set the height (no 100vh on the root), and colour it with the --ork-foreground, --ork-muted-foreground, --ork-background, --ork-border, --ork-primary and --ork-chart-1 to --ork-chart-8 CSS variables, which follow the application theme. Always give them a fallback, such as var(--ork-foreground, #18181b), because the preview defines none of them.`,
18992
+ "Behaviour that needs authored JavaScript, such as a calculator or a filterable dashboard, is an html-interactive artifact; it runs when the reader activates it.",
18993
+ "Use ordinary images only for photographs, screenshots and requested image files.",
18994
+ "HTML, SVG and JavaScript code fences are shown as source and a file path alone publishes nothing: a visual is in the conversation only once publish_artifact succeeds. If verification is unavailable, say so and use a supported form such as a Mermaid or chart fence."
18995
+ ].join(" ");
18792
18996
  var GENERAL_AGENT_INSTRUCTIONS = [
18997
+ AGENT_VISUAL_OUTPUT_INSTRUCTION,
18793
18998
  AGENT_IMAGE_PREVIEW_INSTRUCTION,
18794
18999
  AGENT_DOCUMENT_INSTRUCTION
18795
19000
  ];
@@ -19038,7 +19243,7 @@ class InteractionDeadline {
19038
19243
  }
19039
19244
 
19040
19245
  // ../../bridges/acp-bridge/src/acp-command-changes.ts
19041
- import { createHash as createHash6 } from "node:crypto";
19246
+ import { createHash as createHash7 } from "node:crypto";
19042
19247
  import { resolve as resolve6 } from "node:path";
19043
19248
 
19044
19249
  // ../protocol/src/node/workspace-change-probe.ts
@@ -20040,7 +20245,7 @@ function workspaceObservationReportIssues(value) {
20040
20245
  }
20041
20246
 
20042
20247
  // ../protocol/src/node/change-tracking/evidence-spool.ts
20043
- import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypto";
20248
+ import { createHash as createHash6, randomUUID as randomUUID2 } from "node:crypto";
20044
20249
  import { readdirSync, readFileSync as readFileSync2 } from "node:fs";
20045
20250
  import { appendFile as appendFile2, mkdir as mkdir2, rename as rename2, rm as rm3, writeFile as writeFile2 } from "node:fs/promises";
20046
20251
  import { join as join7 } from "node:path";
@@ -20056,10 +20261,10 @@ var DEFAULT_EVIDENCE_SPOOL_LIMITS = {
20056
20261
  var ENTRIES_FILE = "entries.jsonl";
20057
20262
  var BODY_DIRECTORY = "bodies";
20058
20263
  function evidenceBodyId(bytes) {
20059
- return `sha256:${createHash5("sha256").update(bytes).digest("hex")}`;
20264
+ return `sha256:${createHash6("sha256").update(bytes).digest("hex")}`;
20060
20265
  }
20061
20266
  function stableEvidenceId(...parts) {
20062
- const hash = createHash5("sha256");
20267
+ const hash = createHash6("sha256");
20063
20268
  for (const part of parts)
20064
20269
  hash.update(`${part ?? ""}\x00`);
20065
20270
  return hash.digest("hex").slice(0, 40);
@@ -20702,7 +20907,7 @@ function canonicalEvidence(evidence) {
20702
20907
  }
20703
20908
 
20704
20909
  // ../../bridges/acp-bridge/src/change-evidence.ts
20705
- var log6 = createLogger("bridge.acp");
20910
+ var log7 = createLogger("bridge.acp");
20706
20911
  var MAX_DIFF_BLOCKS_PER_CALL = 100;
20707
20912
  var MAX_HELD_DIFF_BYTES = 32 * 1024 * 1024;
20708
20913
  var MAX_SEEN_CALL_IDS = 8192;
@@ -21001,7 +21206,7 @@ function recordAcpToolEvidence(state, part, update) {
21001
21206
  if (isTerminal(phase))
21002
21207
  settleRecord(state, part, record);
21003
21208
  } catch (error) {
21004
- log6.warn("evidence.record-failed", {
21209
+ log7.warn("evidence.record-failed", {
21005
21210
  errorClass: error instanceof Error ? error.name : "unknown"
21006
21211
  });
21007
21212
  }
@@ -21045,7 +21250,7 @@ function recordAcpShellObservation(state, toolUseId, observation) {
21045
21250
  ...observation.unavailableReason ? { unavailableReason: observation.unavailableReason } : {}
21046
21251
  });
21047
21252
  } catch (error) {
21048
- log6.warn("evidence.shell-record-failed", {
21253
+ log7.warn("evidence.shell-record-failed", {
21049
21254
  errorClass: error instanceof Error ? error.name : "unknown"
21050
21255
  });
21051
21256
  }
@@ -21077,14 +21282,14 @@ function endAcpTurnEvidence(state, outcome) {
21077
21282
  const writers = state.activeSubagentToolIds.size > 0 || turn.backgroundLaunched ? "may-write" : "quiescent";
21078
21283
  changeEvidenceRecorder().turn({ conversationId: state.id, turnId: turn.turnId }, outcome, writers);
21079
21284
  } catch (error) {
21080
- log6.warn("evidence.turn-record-failed", {
21285
+ log7.warn("evidence.turn-record-failed", {
21081
21286
  errorClass: error instanceof Error ? error.name : "unknown"
21082
21287
  });
21083
21288
  }
21084
21289
  }
21085
21290
 
21086
21291
  // ../../bridges/acp-bridge/src/acp-command-changes.ts
21087
- var log7 = createLogger("bridge.acp");
21292
+ var log8 = createLogger("bridge.acp");
21088
21293
  var MAX_WINDOWS_PER_SESSION = 256;
21089
21294
  var MAX_CACHED_JOURNALS = MAX_RESUMABLE_SESSIONS;
21090
21295
  var probe;
@@ -21198,7 +21403,7 @@ function closeWindow(active, state, toolUseId, role) {
21198
21403
  recordAcpShellObservation(state, toolUseId, observation);
21199
21404
  recordCommandChange(state, toolUseId, legacyCommandChange(observation));
21200
21405
  }).catch((error) => {
21201
- log7.warn("command-change.record-failed", {
21406
+ log8.warn("command-change.record-failed", {
21202
21407
  errorClass: error instanceof Error ? error.name : "unknown"
21203
21408
  });
21204
21409
  });
@@ -21257,7 +21462,7 @@ async function applyJournaledCommandChanges(state) {
21257
21462
  function journalFor(acpSessionId) {
21258
21463
  if (!journalDirectory || !acpSessionId)
21259
21464
  return;
21260
- const name = createHash6("sha256").update(acpSessionId).digest("hex").slice(0, 40);
21465
+ const name = createHash7("sha256").update(acpSessionId).digest("hex").slice(0, 40);
21261
21466
  const path = resolve6(journalDirectory, `${name}.jsonl`);
21262
21467
  let journal = journals.get(path);
21263
21468
  if (journal) {
@@ -21415,13 +21620,12 @@ async function resumeSessionReserved(acpSessionId, signal, patch, policy, agentM
21415
21620
  throw new HttpError(410, `${provider} cannot reload persisted ACP sessions`);
21416
21621
  }
21417
21622
  state = {
21418
- id: randomBytes7(16).toString("hex"),
21623
+ id: randomBytes8(16).toString("hex"),
21419
21624
  acpSessionId,
21420
21625
  status: "idle",
21421
21626
  messages: [],
21422
21627
  activeSubagentToolIds: new Set,
21423
21628
  activeSubagentDescriptors: new Map,
21424
- settledCursorAgentIds: new Set,
21425
21629
  subagentLimitExceeded: false,
21426
21630
  subagentToolIds: new Map,
21427
21631
  cursorTodos: [],
@@ -21480,10 +21684,8 @@ async function resumeSessionReserved(acpSessionId, signal, patch, policy, agentM
21480
21684
  await persistState();
21481
21685
  return state;
21482
21686
  } catch (error) {
21483
- if (state && sessions.get(state.id) === state) {
21687
+ if (state && sessions.get(state.id) === state)
21484
21688
  sessions.delete(state.id);
21485
- bumpCursorDiscoveryRevision();
21486
- }
21487
21689
  if (state)
21488
21690
  clearApprovals(state);
21489
21691
  await child.close();
@@ -21575,7 +21777,7 @@ async function createSessionReserved(clientSessionKey, signal, spawnOptions = {}
21575
21777
  if (!isObject3(created) || typeof created.sessionId !== "string") {
21576
21778
  throw new Error(`${provider} returned an invalid ACP session`);
21577
21779
  }
21578
- const id = randomBytes7(16).toString("hex");
21780
+ const id = randomBytes8(16).toString("hex");
21579
21781
  const sessionConfig = normalizeAcpSessionConfig(provider, created);
21580
21782
  rememberCatalog(sessionConfig.composer);
21581
21783
  const state = newSessionState(id, clientSessionKey, created.sessionId, child, sessionConfig, spawnOptions);
@@ -21592,10 +21794,8 @@ async function createSessionReserved(clientSessionKey, signal, spawnOptions = {}
21592
21794
  return state;
21593
21795
  } catch (error) {
21594
21796
  state.dispatching = false;
21595
- if (sessions.get(id) === state) {
21797
+ if (sessions.get(id) === state)
21596
21798
  sessions.delete(id);
21597
- bumpCursorDiscoveryRevision();
21598
- }
21599
21799
  if (clientSessionKey && clientSessionKeys.get(clientSessionKey) === id) {
21600
21800
  clientSessionKeys.delete(clientSessionKey);
21601
21801
  }
@@ -21616,7 +21816,6 @@ function newSessionState(id, clientSessionKey, acpSessionId, child, sessionConfi
21616
21816
  messages: [],
21617
21817
  activeSubagentToolIds: new Set,
21618
21818
  activeSubagentDescriptors: new Map,
21619
- settledCursorAgentIds: new Set,
21620
21819
  subagentLimitExceeded: false,
21621
21820
  subagentToolIds: new Map,
21622
21821
  cursorTodos: [],
@@ -21647,7 +21846,7 @@ function newSessionState(id, clientSessionKey, acpSessionId, child, sessionConfi
21647
21846
  };
21648
21847
  }
21649
21848
  async function createDeferredSession(clientSessionKey, spawnOptions) {
21650
- const id = randomBytes7(16).toString("hex");
21849
+ const id = randomBytes8(16).toString("hex");
21651
21850
  const empty = normalizeAcpSessionConfig(provider, {});
21652
21851
  const sessionConfig = withRequestedSelection({ ...empty, composer: { ...empty.composer, models: catalogCache?.models ?? [] } }, composerPatchFromSpawn(spawnOptions));
21653
21852
  const state = newSessionState(id, clientSessionKey, "", null, sessionConfig, spawnOptions);
@@ -22359,7 +22558,7 @@ function parkPermission(state, child, requestId, params) {
22359
22558
  }
22360
22559
  ];
22361
22560
  }).slice(0, 20) : [];
22362
- const id = randomBytes7(12).toString("hex");
22561
+ const id = randomBytes8(12).toString("hex");
22363
22562
  const requestedAt = Date.now();
22364
22563
  const promptSequence = state.promptSequence;
22365
22564
  const toolCallId = isObject3(params.toolCall) ? params.toolCall.toolCallId : undefined;
@@ -22416,7 +22615,7 @@ function permissionTitle(params) {
22416
22615
  return title.slice(0, 500);
22417
22616
  }
22418
22617
  function appendNonTextContent(state, update, role) {
22419
- const messageId = randomBytes7(12).toString("hex");
22618
+ const messageId = randomBytes8(12).toString("hex");
22420
22619
  const parts = contentBlockParts(update.content, messageId, 0);
22421
22620
  if (parts.length === 0)
22422
22621
  return;
@@ -22556,7 +22755,7 @@ function applySessionUpdate(state, params) {
22556
22755
  if (!message) {
22557
22756
  const modelId = role === "assistant" ? boundedModelId(state.sessionConfig.composer.selectedModelId) : undefined;
22558
22757
  message = {
22559
- id: randomBytes7(12).toString("hex"),
22758
+ id: randomBytes8(12).toString("hex"),
22560
22759
  role,
22561
22760
  content: "",
22562
22761
  parts: [],
@@ -22983,7 +23182,7 @@ function setPromptJournal(state, entry) {
22983
23182
  state.promptJournal.set(entry.requestId, entry);
22984
23183
  }
22985
23184
  // ../../bridges/acp-bridge/src/acp-prompt.ts
22986
- import { randomBytes as randomBytes8 } from "node:crypto";
23185
+ import { randomBytes as randomBytes9 } from "node:crypto";
22987
23186
 
22988
23187
  // ../../bridges/acp-bridge/src/structured-prompt-marker.ts
22989
23188
  var STRUCTURED_PROMPT_INSTRUCTION_PREFIX = "End your turn with exactly one JSON value";
@@ -23060,7 +23259,7 @@ function openRetryCard(state, text) {
23060
23259
  type: "retry",
23061
23260
  content: text,
23062
23261
  toolState: "pending",
23063
- sourcePartId: randomBytes8(12).toString("hex"),
23262
+ sourcePartId: randomBytes9(12).toString("hex"),
23064
23263
  sourceMessageId: message.id,
23065
23264
  createdAt: new Date().toISOString()
23066
23265
  };
@@ -23462,6 +23661,18 @@ async function forkAcpSession(state, upToMessageId, signal) {
23462
23661
 
23463
23662
  // ../protocol/src/human-prompts.ts
23464
23663
  var HUMAN_PROMPT_SCAN_BYTES = 16 * 1024;
23664
+ var HUMAN_PROMPT_KINDS = new Set([
23665
+ "sign-in",
23666
+ "device-code",
23667
+ "press-enter",
23668
+ "secret",
23669
+ "host-key"
23670
+ ]);
23671
+ var HUMAN_PROMPT_SOURCES = new Set([
23672
+ "user-command",
23673
+ "agent-tool",
23674
+ "agent-background-task"
23675
+ ]);
23465
23676
  var HUMAN_PROMPT_OBSERVATION_ROWS = 64;
23466
23677
  function humanPromptObservation(messages, tasks) {
23467
23678
  const object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
@@ -23514,7 +23725,7 @@ function humanPromptObservation(messages, tasks) {
23514
23725
  }
23515
23726
 
23516
23727
  // ../../bridges/acp-bridge/src/acp-http.ts
23517
- import { randomBytes as randomBytes9, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
23728
+ import { randomBytes as randomBytes10 } from "node:crypto";
23518
23729
  import { pathToFileURL } from "node:url";
23519
23730
  import { gzip } from "node:zlib";
23520
23731
 
@@ -23953,7 +24164,7 @@ var DEFAULT_MCP_MANAGEMENT_ROLLOUT = Object.freeze({
23953
24164
 
23954
24165
  // ../protocol/src/node/bridge-transcript-summary.ts
23955
24166
  import { Buffer as Buffer5 } from "node:buffer";
23956
- import { createHash as createHash7 } from "node:crypto";
24167
+ import { createHash as createHash8 } from "node:crypto";
23957
24168
 
23958
24169
  // ../protocol/src/node/progressive-transcript.ts
23959
24170
  var BRIDGE_TRANSCRIPT_MAX_MESSAGES = 100;
@@ -24119,7 +24330,7 @@ function digestPayload(payload) {
24119
24330
  const serialized = JSON.stringify(payload);
24120
24331
  return {
24121
24332
  bytes: Buffer5.byteLength(serialized),
24122
- digest: createHash7("sha256").update(serialized).digest("base64url").slice(0, 32)
24333
+ digest: createHash8("sha256").update(serialized).digest("base64url").slice(0, 32)
24123
24334
  };
24124
24335
  }
24125
24336
  function topLevelKey(part, index) {
@@ -24555,10 +24766,8 @@ async function runClose(state) {
24555
24766
  schedulePersist();
24556
24767
  return "pending";
24557
24768
  }
24558
- if (sessions.get(state.id) === state) {
24769
+ if (sessions.get(state.id) === state)
24559
24770
  sessions.delete(state.id);
24560
- bumpCursorDiscoveryRevision();
24561
- }
24562
24771
  const clientKey = state.clientSessionKey;
24563
24772
  if (clientKey !== undefined && clientSessionKeys.get(clientKey) === state.id) {
24564
24773
  clientSessionKeys.delete(clientKey);
@@ -24834,7 +25043,8 @@ function holdParkedRequest(state, family, id, held) {
24834
25043
  }
24835
25044
 
24836
25045
  // ../../bridges/acp-bridge/src/acp-http.ts
24837
- var TRANSCRIPT_GENERATION = randomBytes9(16).toString("hex");
25046
+ var TRANSCRIPT_GENERATION = randomBytes10(16).toString("hex");
25047
+ var log9 = createLogger("bridge.acp");
24838
25048
 
24839
25049
  class CommandUnavailableError extends Error {
24840
25050
  }
@@ -24883,7 +25093,17 @@ async function route(request, response, clientSignal) {
24883
25093
  return json(response, 200, { models });
24884
25094
  }
24885
25095
  if (url.pathname === "/session/list" && request.method === "GET") {
24886
- return json(response, 200, { sessions: await listResumableSessions() });
25096
+ try {
25097
+ return json(response, 200, { sessions: await listResumableSessions() });
25098
+ } catch (error) {
25099
+ if (error instanceof HttpError || error instanceof CredentialError)
25100
+ throw error;
25101
+ log9.warn("http.route-failed", {
25102
+ method: request.method,
25103
+ error: formatLogError(error, { message: false })
25104
+ });
25105
+ return json(response, 500, { error: "Failed to read session history" });
25106
+ }
24887
25107
  }
24888
25108
  if (url.pathname === "/session/resume" && request.method === "POST") {
24889
25109
  const body = await readJson(request);
@@ -25271,7 +25491,7 @@ async function route(request, response, clientSignal) {
25271
25491
  }
25272
25492
  throw error;
25273
25493
  }
25274
- const userMessageId = randomBytes9(12).toString("hex");
25494
+ const userMessageId = randomBytes10(12).toString("hex");
25275
25495
  const userVisiblePrompt = selectedCommand ? displayPrompt || prompt : prompt;
25276
25496
  state.messages.push({
25277
25497
  id: userMessageId,
@@ -25494,11 +25714,7 @@ function authenticated(request) {
25494
25714
  Array.isArray(dedicated) ? dedicated[0] : dedicated,
25495
25715
  request.headers.authorization?.replace(/^Bearer\s+/i, "")
25496
25716
  ];
25497
- const right = Buffer.from(authToken);
25498
- return candidates.some((candidate) => {
25499
- const left = Buffer.from(candidate?.trim() || "");
25500
- return left.length === right.length && timingSafeEqual2(left, right);
25501
- });
25717
+ return candidates.some((candidate) => bridgeCredential.matches(candidate?.trim()));
25502
25718
  }
25503
25719
  function isTrustedBridgeOrigin(origin) {
25504
25720
  if (!origin)
@@ -25644,6 +25860,7 @@ function installFatalRejectionGuard(options) {
25644
25860
  const APP_PATH = /(?:^|\/)((?:apps\/(?:backend|desktop|web|web-public)|packages\/(?:protocol|cli|toolchain)|bridges\/[\w-]+|[\w-]+-bridge)\/.*)$/;
25645
25861
  const PACKAGED_PATH = /\/((?:app\.asar(?:\.unpacked)?|resources)\/.*)$/i;
25646
25862
  const CREDENTIALS = [
25863
+ { pattern: /\bok[ab]_[A-Za-z0-9_-]{16,}/g, replacement: "[redacted]" },
25647
25864
  {
25648
25865
  pattern: /([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+(?::[^/\s@]*)?@/gi,
25649
25866
  replacement: "$1[redacted]@"
@@ -25771,9 +25988,9 @@ function installFatalRejectionGuard(options) {
25771
25988
  }
25772
25989
 
25773
25990
  // ../protocol/src/node/process-failure-log.ts
25774
- var log8 = createLogger("process");
25991
+ var log10 = createLogger("process");
25775
25992
  function logUnhandledRejection(reason) {
25776
- log8.throttled("error", "rejection.unhandled", {
25993
+ log10.throttled("error", "rejection.unhandled", {
25777
25994
  error: reason,
25778
25995
  fields: () => ({ error: formatLogError(reason, { message: false }) })
25779
25996
  });
@@ -25806,7 +26023,7 @@ function watchClientDisconnect(request, response, onDisconnect) {
25806
26023
  }
25807
26024
 
25808
26025
  // ../../bridges/acp-bridge/src/acp-server.ts
25809
- var log9 = createLogger("bridge.acp");
26026
+ var log11 = createLogger("bridge.acp");
25810
26027
  configureBridgeLogger();
25811
26028
  await restorePersistedState();
25812
26029
  var server = createServer((request, response) => {
@@ -25821,13 +26038,13 @@ var server = createServer((request, response) => {
25821
26038
  return;
25822
26039
  }
25823
26040
  if (error instanceof PolicyWideningRefusedError) {
25824
- log9.warn("session.policy-widening-refused", { widened: error.widened.join(",") });
26041
+ log11.warn("session.policy-widening-refused", { widened: error.widened.join(",") });
25825
26042
  json(response, 403, error.refusal());
25826
26043
  return;
25827
26044
  }
25828
26045
  const status = error instanceof HttpError ? error.status : 500;
25829
26046
  if (status === 500 && !controller.signal.aborted) {
25830
- log9.warn("http.route-failed", {
26047
+ log11.warn("http.route-failed", {
25831
26048
  method: request.method,
25832
26049
  error: formatLogError(error, { message: false })
25833
26050
  });
@@ -25835,7 +26052,7 @@ var server = createServer((request, response) => {
25835
26052
  json(response, status, { error: error instanceof Error ? error.message : String(error) });
25836
26053
  }).finally(stopWatchingClient);
25837
26054
  });
25838
- server.listen(port, hostname, () => log9.info("server.listening", { provider, hostname, port }));
26055
+ server.listen(port, hostname, () => log11.info("server.listening", { provider, hostname, port }));
25839
26056
  var shutdownPromise = null;
25840
26057
  function shutdown() {
25841
26058
  if (shutdownPromise)
@@ -25877,10 +26094,6 @@ export {
25877
26094
  CLOSE_ATTACH_WAIT_MS,
25878
26095
  CLOSE_CANCEL_WAIT_MS,
25879
26096
  CLOSE_SESSION_WAIT_MS,
25880
- CURSOR_BACKGROUND_CONTINUATION_PREFIX,
25881
- CURSOR_BACKGROUND_WAIT_MS,
25882
- CURSOR_CHILD_DISCOVERY_SKEW_MS,
25883
- CURSOR_JSONL_SOURCE_PREFIX,
25884
26097
  CURSOR_TODO_STATUSES,
25885
26098
  DIFF_CONTEXT_LINES,
25886
26099
  EXTERNAL_SESSION_PREFIX,
@@ -25894,17 +26107,9 @@ export {
25894
26107
  MAX_APPROVALS_PER_SESSION,
25895
26108
  MAX_BODY_BYTES,
25896
26109
  MAX_CHILD_PARTS_PER_CALL,
25897
- MAX_CURSOR_BACKGROUND_CONTINUATIONS,
25898
- MAX_CURSOR_CHILD_PARTS,
25899
- MAX_CURSOR_CHILD_PROMPT_BYTES,
25900
- MAX_CURSOR_CHILD_PROMPT_RECORDS,
25901
- MAX_CURSOR_CHILD_RESULT_BYTES,
25902
- MAX_CURSOR_DISCOVERY_ENTRIES,
25903
- MAX_CURSOR_SETTLED_CLAIMS,
25904
26110
  MAX_CURSOR_TASK_PROMPT_BYTES,
25905
26111
  MAX_CURSOR_TODOS,
25906
26112
  MAX_CURSOR_TODO_CANDIDATES,
25907
- MAX_CURSOR_TRANSCRIPT_HYDRATE_CHILDREN,
25908
26113
  MAX_DIFF_EDIT_DISTANCE,
25909
26114
  MAX_EVICTED_TOOL_CALL_IDS,
25910
26115
  MAX_GROK_INTERJECTION_ID_BYTES,
@@ -25996,7 +26201,7 @@ export {
25996
26201
  boundedNullableString,
25997
26202
  boundedString2 as boundedString,
25998
26203
  boundedToolArguments,
25999
- bumpCursorDiscoveryRevision,
26204
+ bridgeCredential,
26000
26205
  catalogCache,
26001
26206
  catalogProbe,
26002
26207
  clearApprovals,
@@ -26012,7 +26217,6 @@ export {
26012
26217
  createDisplayDiff,
26013
26218
  createSession,
26014
26219
  createSessionReserved,
26015
- currentCursorDiscoveryRevision,
26016
26220
  cursorSubagentTypeLabel,
26017
26221
  cursorTaskNamedState,
26018
26222
  diffFileLines,
@@ -26113,7 +26317,6 @@ export {
26113
26317
  raceAbort,
26114
26318
  readJson,
26115
26319
  reconcileStaleToolParts,
26116
- recordCursorTaskPrompt,
26117
26320
  recordTurnUsage,
26118
26321
  rememberCatalog,
26119
26322
  rememberHistoryMessage,
@@ -26178,7 +26381,6 @@ export {
26178
26381
  toolCallContentText,
26179
26382
  toolCallLifecycle,
26180
26383
  toolCallLocationPath,
26181
- toolPartAgentId,
26182
26384
  trimNoticePartId,
26183
26385
  trimPartsTo,
26184
26386
  trimmedToolCalls,