vivus-agent 1.1.36 → 1.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +1444 -329
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S node --max-old-space-size=8192 --expose-gc
2
2
  // Vivus CLI — local AI coding agent
3
- // Built from source at 2026-08-06T08:10:41.070Z
3
+ // Built from source at 2026-08-06T11:53:23.102Z
4
4
  import { createRequire } from "node:module";
5
5
  var __create = Object.create;
6
6
  var __getProtoOf = Object.getPrototypeOf;
@@ -108228,7 +108228,7 @@ var init_auth = __esm(() => {
108228
108228
 
108229
108229
  // src/utils/userAgent.ts
108230
108230
  function getVivusCodeUserAgent() {
108231
- return `vivus/${"1.1.36+7725484"}`;
108231
+ return `vivus/${"1.1.37+d527bcf"}`;
108232
108232
  }
108233
108233
 
108234
108234
  // src/utils/workloadContext.ts
@@ -108250,7 +108250,7 @@ function getUserAgent() {
108250
108250
  const clientApp = process.env.VIVUS_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.VIVUS_AGENT_SDK_CLIENT_APP}` : "";
108251
108251
  const workload = getWorkload();
108252
108252
  const workloadSuffix = workload ? `, workload/${workload}` : "";
108253
- return `vivus-cli/${"1.1.36+7725484"} (${process.env.USER_TYPE}, ${process.env.VIVUS_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
108253
+ return `vivus-cli/${"1.1.37+d527bcf"} (${process.env.USER_TYPE}, ${process.env.VIVUS_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
108254
108254
  }
108255
108255
  function getMCPUserAgent() {
108256
108256
  const parts = [];
@@ -108264,7 +108264,7 @@ function getMCPUserAgent() {
108264
108264
  parts.push(`client-app/${process.env.VIVUS_AGENT_SDK_CLIENT_APP}`);
108265
108265
  }
108266
108266
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
108267
- return `vivus/${"1.1.36+7725484"}${suffix}`;
108267
+ return `vivus/${"1.1.37+d527bcf"}${suffix}`;
108268
108268
  }
108269
108269
  function getWebFetchUserAgent() {
108270
108270
  return `Vivus-User (${getVivusCodeUserAgent()}; +https://support.anthropic.com/)`;
@@ -108402,7 +108402,7 @@ var init_user = __esm(() => {
108402
108402
  deviceId,
108403
108403
  sessionId: getSessionId(),
108404
108404
  email: getEmail(),
108405
- appVersion: "1.1.36+7725484",
108405
+ appVersion: "1.1.37+d527bcf",
108406
108406
  platform: getHostPlatformForAnalytics(),
108407
108407
  organizationUuid,
108408
108408
  accountUuid,
@@ -119713,7 +119713,7 @@ var init_metadata = __esm(() => {
119713
119713
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
119714
119714
  WHITESPACE_REGEX = /\s+/;
119715
119715
  getVersionBase = memoize_default(() => {
119716
- const match = "1.1.36+7725484".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
119716
+ const match = "1.1.37+d527bcf".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
119717
119717
  return match ? match[0] : undefined;
119718
119718
  });
119719
119719
  buildEnvContext = memoize_default(async () => {
@@ -119753,9 +119753,9 @@ var init_metadata = __esm(() => {
119753
119753
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
119754
119754
  isVivusCodeAction: isEnvTruthy(process.env.VIVUS_CODE_ACTION),
119755
119755
  isVivusAiAuth: isVivusAISubscriber(),
119756
- version: "1.1.36+7725484",
119756
+ version: "1.1.37+d527bcf",
119757
119757
  versionBase: getVersionBase(),
119758
- buildTime: "2026-08-06T08:10:40.644Z",
119758
+ buildTime: "2026-08-06T11:53:22.560Z",
119759
119759
  deploymentEnvironment: env3.detectDeploymentEnvironment(),
119760
119760
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
119761
119761
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -120423,7 +120423,7 @@ function initialize1PEventLogging() {
120423
120423
  const platform2 = getPlatform();
120424
120424
  const attributes = {
120425
120425
  [import_semantic_conventions.ATTR_SERVICE_NAME]: "vivus",
120426
- [import_semantic_conventions.ATTR_SERVICE_VERSION]: "1.1.36+7725484"
120426
+ [import_semantic_conventions.ATTR_SERVICE_VERSION]: "1.1.37+d527bcf"
120427
120427
  };
120428
120428
  if (platform2 === "wsl") {
120429
120429
  const wslVersion = getWslVersion();
@@ -120450,7 +120450,7 @@ function initialize1PEventLogging() {
120450
120450
  })
120451
120451
  ]
120452
120452
  });
120453
- firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.anthropic.vivus_code.events", "1.1.36+7725484");
120453
+ firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.anthropic.vivus_code.events", "1.1.37+d527bcf");
120454
120454
  }
120455
120455
  async function reinitialize1PEventLoggingIfConfigChanged() {
120456
120456
  if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
@@ -121127,6 +121127,12 @@ function isAutoMemoryEnabled() {
121127
121127
  }
121128
121128
  return true;
121129
121129
  }
121130
+ function isExtractModeActive() {
121131
+ if (!getFeatureValue_CACHED_MAY_BE_STALE("tengu_passport_quail", true)) {
121132
+ return false;
121133
+ }
121134
+ return !getIsNonInteractiveSession() || getFeatureValue_CACHED_MAY_BE_STALE("tengu_slate_thimble", true);
121135
+ }
121130
121136
  function getMemoryBaseDir() {
121131
121137
  if (process.env.VIVUS_CODE_REMOTE_MEMORY_DIR) {
121132
121138
  return process.env.VIVUS_CODE_REMOTE_MEMORY_DIR;
@@ -162664,7 +162670,7 @@ function getAttributionHeader(fingerprint) {
162664
162670
  if (!isAttributionHeaderEnabled()) {
162665
162671
  return "";
162666
162672
  }
162667
- const version2 = `${"1.1.36+7725484"}.${fingerprint}`;
162673
+ const version2 = `${"1.1.37+d527bcf"}.${fingerprint}`;
162668
162674
  const entrypoint = process.env.VIVUS_CODE_ENTRYPOINT ?? "unknown";
162669
162675
  const cch = "";
162670
162676
  const workload = getWorkload();
@@ -175827,7 +175833,7 @@ function getTelemetryAttributes() {
175827
175833
  attributes["session.id"] = sessionId;
175828
175834
  }
175829
175835
  if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
175830
- attributes["app.version"] = "1.1.36+7725484";
175836
+ attributes["app.version"] = "1.1.37+d527bcf";
175831
175837
  }
175832
175838
  const oauthAccount = getOauthAccountInfo();
175833
175839
  if (oauthAccount) {
@@ -242397,7 +242403,7 @@ function computeFingerprint(messageText, version2) {
242397
242403
  }
242398
242404
  function computeFingerprintFromMessages(messages) {
242399
242405
  const firstMessageText = extractFirstMessageText(messages);
242400
- return computeFingerprint(firstMessageText, "1.1.36+7725484");
242406
+ return computeFingerprint(firstMessageText, "1.1.37+d527bcf");
242401
242407
  }
242402
242408
  var FINGERPRINT_SALT = "59cf53e54c78";
242403
242409
  var init_fingerprint = () => {};
@@ -242439,7 +242445,7 @@ async function sideQuery(opts) {
242439
242445
  betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
242440
242446
  }
242441
242447
  const messageText = extractFirstUserMessageText(messages);
242442
- const fingerprint = computeFingerprint(messageText, "1.1.36+7725484");
242448
+ const fingerprint = computeFingerprint(messageText, "1.1.37+d527bcf");
242443
242449
  const attributionHeader = getAttributionHeader(fingerprint);
242444
242450
  const systemBlocks = [
242445
242451
  attributionHeader ? { type: "text", text: attributionHeader } : null,
@@ -243591,7 +243597,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
243591
243597
  const client2 = new Client({
243592
243598
  name: "vivus",
243593
243599
  title: "Vivus",
243594
- version: "1.1.36+7725484",
243600
+ version: "1.1.37+d527bcf",
243595
243601
  description: "Anthropic's agentic coding tool",
243596
243602
  websiteUrl: PRODUCT_URL
243597
243603
  }, {
@@ -243945,7 +243951,7 @@ var init_client6 = __esm(() => {
243945
243951
  const client2 = new Client({
243946
243952
  name: "vivus",
243947
243953
  title: "Vivus",
243948
- version: "1.1.36+7725484",
243954
+ version: "1.1.37+d527bcf",
243949
243955
  description: "Anthropic's agentic coding tool",
243950
243956
  websiteUrl: PRODUCT_URL
243951
243957
  }, {
@@ -246006,7 +246012,7 @@ function getInstallationEnv() {
246006
246012
  return;
246007
246013
  }
246008
246014
  function getVivusCodeVersion() {
246009
- return "1.1.36+7725484";
246015
+ return "1.1.37+d527bcf";
246010
246016
  }
246011
246017
  async function getInstalledVSCodeExtensionVersion(command) {
246012
246018
  const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
@@ -302093,7 +302099,7 @@ async function initializeBetaTracing(resource) {
302093
302099
  });
302094
302100
  import_api_logs.logs.setGlobalLoggerProvider(loggerProvider);
302095
302101
  setLoggerProvider(loggerProvider);
302096
- const eventLogger = import_api_logs.logs.getLogger("com.anthropic.vivus_code.events", "1.1.36+7725484");
302102
+ const eventLogger = import_api_logs.logs.getLogger("com.anthropic.vivus_code.events", "1.1.37+d527bcf");
302097
302103
  setEventLogger(eventLogger);
302098
302104
  process.on("beforeExit", async () => {
302099
302105
  await loggerProvider?.forceFlush();
@@ -302133,7 +302139,7 @@ async function initializeTelemetry() {
302133
302139
  const platform5 = getPlatform();
302134
302140
  const baseAttributes = {
302135
302141
  [import_semantic_conventions2.ATTR_SERVICE_NAME]: "vivus",
302136
- [import_semantic_conventions2.ATTR_SERVICE_VERSION]: "1.1.36+7725484"
302142
+ [import_semantic_conventions2.ATTR_SERVICE_VERSION]: "1.1.37+d527bcf"
302137
302143
  };
302138
302144
  if (platform5 === "wsl") {
302139
302145
  const wslVersion = getWslVersion();
@@ -302178,7 +302184,7 @@ async function initializeTelemetry() {
302178
302184
  } catch {}
302179
302185
  };
302180
302186
  registerCleanup(shutdownTelemetry2);
302181
- return meterProvider2.getMeter("com.anthropic.vivus_code", "1.1.36+7725484");
302187
+ return meterProvider2.getMeter("com.anthropic.vivus_code", "1.1.37+d527bcf");
302182
302188
  }
302183
302189
  const meterProvider = new import_sdk_metrics2.MeterProvider({
302184
302190
  resource,
@@ -302198,7 +302204,7 @@ async function initializeTelemetry() {
302198
302204
  });
302199
302205
  import_api_logs.logs.setGlobalLoggerProvider(loggerProvider);
302200
302206
  setLoggerProvider(loggerProvider);
302201
- const eventLogger = import_api_logs.logs.getLogger("com.anthropic.vivus_code.events", "1.1.36+7725484");
302207
+ const eventLogger = import_api_logs.logs.getLogger("com.anthropic.vivus_code.events", "1.1.37+d527bcf");
302202
302208
  setEventLogger(eventLogger);
302203
302209
  logForDebugging("[3P telemetry] Event logger set successfully");
302204
302210
  process.on("beforeExit", async () => {
@@ -302260,7 +302266,7 @@ Current timeout: ${timeoutMs}ms
302260
302266
  }
302261
302267
  };
302262
302268
  registerCleanup(shutdownTelemetry);
302263
- return meterProvider.getMeter("com.anthropic.vivus_code", "1.1.36+7725484");
302269
+ return meterProvider.getMeter("com.anthropic.vivus_code", "1.1.37+d527bcf");
302264
302270
  }
302265
302271
  async function flushTelemetry() {
302266
302272
  const meterProvider = getMeterProvider();
@@ -302946,9 +302952,9 @@ async function assertMinVersion() {
302946
302952
  if (false) {}
302947
302953
  try {
302948
302954
  const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
302949
- if (versionConfig.minVersion && lt("1.1.36+7725484", versionConfig.minVersion)) {
302955
+ if (versionConfig.minVersion && lt("1.1.37+d527bcf", versionConfig.minVersion)) {
302950
302956
  console.error(`
302951
- It looks like your version of Vivus (${"1.1.36+7725484"}) needs an update.
302957
+ It looks like your version of Vivus (${"1.1.37+d527bcf"}) needs an update.
302952
302958
  A newer version (${versionConfig.minVersion} or higher) is required to continue.
302953
302959
 
302954
302960
  To update, please run:
@@ -303164,7 +303170,7 @@ async function installGlobalPackage(specificVersion) {
303164
303170
  logError2(new AutoUpdaterError("Another process is currently installing an update"));
303165
303171
  logEvent("tengu_auto_updater_lock_contention", {
303166
303172
  pid: process.pid,
303167
- currentVersion: "1.1.36+7725484"
303173
+ currentVersion: "1.1.37+d527bcf"
303168
303174
  });
303169
303175
  return "in_progress";
303170
303176
  }
@@ -303173,7 +303179,7 @@ async function installGlobalPackage(specificVersion) {
303173
303179
  if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
303174
303180
  logError2(new Error("Windows NPM detected in WSL environment"));
303175
303181
  logEvent("tengu_auto_updater_windows_npm_in_wsl", {
303176
- currentVersion: "1.1.36+7725484"
303182
+ currentVersion: "1.1.37+d527bcf"
303177
303183
  });
303178
303184
  console.error(`
303179
303185
  Error: Windows NPM detected in WSL
@@ -303706,7 +303712,7 @@ function detectLinuxGlobPatternWarnings() {
303706
303712
  }
303707
303713
  async function getDoctorDiagnostic() {
303708
303714
  const installationType = await getCurrentInstallationType();
303709
- const version2 = typeof MACRO !== "undefined" ? "1.1.36+7725484" : "unknown";
303715
+ const version2 = typeof MACRO !== "undefined" ? "1.1.37+d527bcf" : "unknown";
303710
303716
  const installationPath = await getInstallationPath();
303711
303717
  const invokedBinary = getInvokedBinary();
303712
303718
  const multipleInstallations = await detectMultipleInstallations();
@@ -304639,8 +304645,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
304639
304645
  const maxVersion = await getMaxVersion();
304640
304646
  if (maxVersion && gt(version2, maxVersion)) {
304641
304647
  logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
304642
- if (gte("1.1.36+7725484", maxVersion)) {
304643
- logForDebugging(`Native installer: current version ${"1.1.36+7725484"} is already at or above maxVersion ${maxVersion}, skipping update`);
304648
+ if (gte("1.1.37+d527bcf", maxVersion)) {
304649
+ logForDebugging(`Native installer: current version ${"1.1.37+d527bcf"} is already at or above maxVersion ${maxVersion}, skipping update`);
304644
304650
  logEvent("tengu_native_update_skipped_max_version", {
304645
304651
  latency_ms: Date.now() - startTime,
304646
304652
  max_version: maxVersion,
@@ -304651,7 +304657,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
304651
304657
  version2 = maxVersion;
304652
304658
  }
304653
304659
  }
304654
- if (!forceReinstall && version2 === "1.1.36+7725484" && await versionIsAvailable(version2) && await isPossibleVivusBinary(executablePath)) {
304660
+ if (!forceReinstall && version2 === "1.1.37+d527bcf" && await versionIsAvailable(version2) && await isPossibleVivusBinary(executablePath)) {
304655
304661
  logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
304656
304662
  logEvent("tengu_native_update_complete", {
304657
304663
  latency_ms: Date.now() - startTime,
@@ -354143,6 +354149,395 @@ var init_systemPrompt = __esm(() => {
354143
354149
  init_envUtils();
354144
354150
  });
354145
354151
 
354152
+ // src/services/contextCollapse/store.ts
354153
+ function notify2() {
354154
+ for (const cb of subscribers2)
354155
+ cb();
354156
+ }
354157
+ function subscribe3(cb) {
354158
+ subscribers2.add(cb);
354159
+ return () => subscribers2.delete(cb);
354160
+ }
354161
+ function getCommitted() {
354162
+ return committed;
354163
+ }
354164
+ function addCommitted(commit) {
354165
+ committed.push(commit);
354166
+ notify2();
354167
+ }
354168
+ function getStaged() {
354169
+ return staged;
354170
+ }
354171
+ function addStaged(item) {
354172
+ staged.push(item);
354173
+ notify2();
354174
+ }
354175
+ function clearStaged() {
354176
+ staged = [];
354177
+ notify2();
354178
+ }
354179
+ function nextCollapseId() {
354180
+ collapseIdCounter += 1;
354181
+ return String(collapseIdCounter);
354182
+ }
354183
+ function seedCollapseIdCounterFrom(ids) {
354184
+ for (const id of ids) {
354185
+ const n2 = Number.parseInt(id, 10);
354186
+ if (Number.isFinite(n2) && n2 > collapseIdCounter) {
354187
+ collapseIdCounter = n2;
354188
+ }
354189
+ }
354190
+ }
354191
+ function setArmed(value) {
354192
+ armed = value;
354193
+ }
354194
+ function getLastSpawnTokens() {
354195
+ return lastSpawnTokens;
354196
+ }
354197
+ function setLastSpawnTokens(tokens) {
354198
+ lastSpawnTokens = tokens;
354199
+ }
354200
+ function isSpawnInProgress() {
354201
+ return spawnInProgress;
354202
+ }
354203
+ function setSpawnInProgress(value) {
354204
+ spawnInProgress = value;
354205
+ }
354206
+ function getHealth() {
354207
+ return health;
354208
+ }
354209
+ function recordSpawn() {
354210
+ health.totalSpawns += 1;
354211
+ notify2();
354212
+ }
354213
+ function recordEmptySpawn() {
354214
+ health.totalEmptySpawns += 1;
354215
+ if (!health.emptySpawnWarningEmitted) {
354216
+ health.emptySpawnWarningEmitted = true;
354217
+ }
354218
+ notify2();
354219
+ }
354220
+ function recordError() {
354221
+ health.totalErrors += 1;
354222
+ notify2();
354223
+ }
354224
+ function resetAll() {
354225
+ committed = [];
354226
+ staged = [];
354227
+ collapseIdCounter = 0;
354228
+ armed = true;
354229
+ lastSpawnTokens = 0;
354230
+ spawnInProgress = false;
354231
+ health.totalSpawns = 0;
354232
+ health.totalErrors = 0;
354233
+ health.totalEmptySpawns = 0;
354234
+ health.emptySpawnWarningEmitted = false;
354235
+ notify2();
354236
+ }
354237
+ var committed, staged, collapseIdCounter = 0, armed = true, lastSpawnTokens = 0, spawnInProgress = false, health, subscribers2;
354238
+ var init_store = __esm(() => {
354239
+ committed = [];
354240
+ staged = [];
354241
+ health = {
354242
+ totalSpawns: 0,
354243
+ totalErrors: 0,
354244
+ totalEmptySpawns: 0,
354245
+ emptySpawnWarningEmitted: false
354246
+ };
354247
+ subscribers2 = new Set;
354248
+ });
354249
+
354250
+ // src/services/contextCollapse/operations.ts
354251
+ var exports_operations = {};
354252
+ __export(exports_operations, {
354253
+ projectView: () => projectView
354254
+ });
354255
+ function getUuid(message) {
354256
+ return message.uuid;
354257
+ }
354258
+ function projectView(messages) {
354259
+ const committed2 = getCommitted();
354260
+ if (committed2.length === 0)
354261
+ return messages;
354262
+ const indexByUuid = new Map;
354263
+ messages.forEach((m, i2) => {
354264
+ const uuid3 = getUuid(m);
354265
+ if (uuid3)
354266
+ indexByUuid.set(uuid3, i2);
354267
+ });
354268
+ const spans = [];
354269
+ for (const commit of committed2) {
354270
+ const startIdx = indexByUuid.get(commit.firstArchivedUuid);
354271
+ const endIdx = indexByUuid.get(commit.lastArchivedUuid);
354272
+ if (startIdx === undefined || endIdx === undefined || startIdx > endIdx) {
354273
+ continue;
354274
+ }
354275
+ spans.push({ startIdx, endIdx, commit });
354276
+ }
354277
+ if (spans.length === 0)
354278
+ return messages;
354279
+ spans.sort((a2, b) => a2.startIdx - b.startIdx);
354280
+ const result = [];
354281
+ let cursor = 0;
354282
+ for (const span of spans) {
354283
+ if (span.startIdx < cursor)
354284
+ continue;
354285
+ result.push(...messages.slice(cursor, span.startIdx));
354286
+ if (span.commit.archived.length === 0) {
354287
+ span.commit.archived = messages.slice(span.startIdx, span.endIdx + 1);
354288
+ }
354289
+ result.push(createUserMessage({
354290
+ content: span.commit.summaryContent,
354291
+ isMeta: true,
354292
+ isCompactSummary: true,
354293
+ uuid: span.commit.summaryUuid
354294
+ }));
354295
+ cursor = span.endIdx + 1;
354296
+ }
354297
+ result.push(...messages.slice(cursor));
354298
+ return result;
354299
+ }
354300
+ var init_operations = __esm(() => {
354301
+ init_messages3();
354302
+ init_store();
354303
+ });
354304
+
354305
+ // src/services/contextCollapse/summarize.ts
354306
+ async function summarizeSegment(segment2, toolUseContext) {
354307
+ if (segment2.length === 0)
354308
+ return null;
354309
+ try {
354310
+ const transcript = buildTranscriptForClassifier(segment2, toolUseContext.options.tools);
354311
+ if (!transcript.trim())
354312
+ return null;
354313
+ const response = await sideQuery({
354314
+ model: toolUseContext.options.mainLoopModel,
354315
+ system: SUMMARY_SYSTEM_PROMPT,
354316
+ messages: [{ role: "user", content: transcript }],
354317
+ max_tokens: 1024,
354318
+ thinking: false,
354319
+ signal: toolUseContext.abortController.signal,
354320
+ querySource: "marble_origami"
354321
+ });
354322
+ const text2 = extractTextContent(response.content).trim();
354323
+ return text2.length > 0 ? text2 : null;
354324
+ } catch (e) {
354325
+ logForDebugging(`[contextCollapse] summarizeSegment failed: ${errorMessage(e)}`);
354326
+ return null;
354327
+ }
354328
+ }
354329
+ var SUMMARY_SYSTEM_PROMPT = `You are summarizing an older portion of an AI coding agent's conversation so it can be safely dropped from the model's context window while the important information survives.
354330
+
354331
+ Write a dense, factual summary of the conversation segment given below, covering:
354332
+ - What the user asked for, and any constraints or preferences they stated
354333
+ - What was actually done: files changed, commands run, decisions made, and the outcome of each
354334
+ - Any open threads, TODOs, or unresolved questions left at the end of the segment
354335
+ - Specific facts a later turn might need to reference again: file paths, names, values, error messages
354336
+
354337
+ Do not editorialize, do not add commentary, and do not include anything not actually present in the transcript below. Output plain text only — no markdown headers, no bullet re-formatting beyond what's natural for the content.`;
354338
+ var init_summarize = __esm(() => {
354339
+ init_errors();
354340
+ init_debug();
354341
+ init_yoloClassifier();
354342
+ init_messages3();
354343
+ init_sideQuery();
354344
+ });
354345
+
354346
+ // src/services/contextCollapse/index.ts
354347
+ var exports_contextCollapse = {};
354348
+ __export(exports_contextCollapse, {
354349
+ subscribe: () => subscribe4,
354350
+ resetContextCollapse: () => resetContextCollapse,
354351
+ recoverFromOverflow: () => recoverFromOverflow,
354352
+ projectView: () => projectView,
354353
+ isWithheldPromptTooLong: () => isWithheldPromptTooLong,
354354
+ isContextCollapseEnabled: () => isContextCollapseEnabled,
354355
+ initContextCollapse: () => initContextCollapse,
354356
+ getStats: () => getStats,
354357
+ getCommittedForInspect: () => getCommittedForInspect,
354358
+ applyCollapsesIfNeeded: () => applyCollapsesIfNeeded
354359
+ });
354360
+ import { randomUUID as randomUUID18 } from "crypto";
354361
+ function isContextCollapseEnabled() {
354362
+ const envOverride = process.env.VIVUS_CONTEXT_COLLAPSE;
354363
+ if (envOverride !== undefined)
354364
+ return isEnvTruthy(envOverride);
354365
+ return true;
354366
+ }
354367
+ function initContextCollapse() {
354368
+ logForDebugging("[contextCollapse] initialized");
354369
+ }
354370
+ function resetContextCollapse() {
354371
+ resetAll();
354372
+ }
354373
+ function getStats() {
354374
+ const committed2 = getCommitted();
354375
+ return {
354376
+ collapsedSpans: committed2.length,
354377
+ collapsedMessages: committed2.reduce((sum, c4) => sum + c4.archived.length, 0),
354378
+ stagedSpans: getStaged().length,
354379
+ health: { ...getHealth() }
354380
+ };
354381
+ }
354382
+ function subscribe4(cb) {
354383
+ return subscribe3(cb);
354384
+ }
354385
+ function getCommittedForInspect(collapseId) {
354386
+ const commit = getCommitted().find((c4) => c4.collapseId === collapseId);
354387
+ return commit ? { summary: commit.summary, archived: commit.archived } : null;
354388
+ }
354389
+ function getUuid2(message) {
354390
+ return message.uuid;
354391
+ }
354392
+ function findFrontierIndex(messages) {
354393
+ let lastUuid;
354394
+ for (const c4 of getCommitted())
354395
+ lastUuid = c4.lastArchivedUuid;
354396
+ for (const s of getStaged())
354397
+ lastUuid = s.endUuid;
354398
+ if (!lastUuid)
354399
+ return 0;
354400
+ const idx = messages.findIndex((m) => getUuid2(m) === lastUuid);
354401
+ return idx === -1 ? 0 : idx + 1;
354402
+ }
354403
+ function pickSegmentToCollapse(messages) {
354404
+ const start = findFrontierIndex(messages);
354405
+ const end = messages.length - 1 - PRESERVED_TAIL_MESSAGES;
354406
+ if (end - start + 1 < MIN_SEGMENT_MESSAGES)
354407
+ return null;
354408
+ return messages.slice(start, end + 1);
354409
+ }
354410
+ function mintCommit(summary, firstArchivedUuid, lastArchivedUuid) {
354411
+ const collapseId = nextCollapseId();
354412
+ return {
354413
+ collapseId,
354414
+ summaryUuid: randomUUID18(),
354415
+ summaryContent: `<collapsed id="${collapseId}">${summary}</collapsed>`,
354416
+ summary,
354417
+ firstArchivedUuid,
354418
+ lastArchivedUuid,
354419
+ archived: []
354420
+ };
354421
+ }
354422
+ function commitAllStaged() {
354423
+ const items = getStaged();
354424
+ if (items.length === 0)
354425
+ return 0;
354426
+ for (const item of items) {
354427
+ addCommitted(mintCommit(item.summary, item.startUuid, item.endUuid));
354428
+ }
354429
+ clearStaged();
354430
+ return items.length;
354431
+ }
354432
+ async function trySpawn(messages, toolUseContext, blocking) {
354433
+ if (isSpawnInProgress())
354434
+ return;
354435
+ setSpawnInProgress(true);
354436
+ recordSpawn();
354437
+ try {
354438
+ const segment2 = pickSegmentToCollapse(messages);
354439
+ if (!segment2) {
354440
+ recordEmptySpawn();
354441
+ return;
354442
+ }
354443
+ const summary = await summarizeSegment(segment2, toolUseContext);
354444
+ if (!summary) {
354445
+ recordEmptySpawn();
354446
+ return;
354447
+ }
354448
+ const firstArchivedUuid = getUuid2(segment2[0]);
354449
+ const lastArchivedUuid = getUuid2(segment2[segment2.length - 1]);
354450
+ if (!firstArchivedUuid || !lastArchivedUuid) {
354451
+ recordEmptySpawn();
354452
+ return;
354453
+ }
354454
+ if (blocking) {
354455
+ addCommitted(mintCommit(summary, firstArchivedUuid, lastArchivedUuid));
354456
+ } else {
354457
+ addStaged({
354458
+ startUuid: firstArchivedUuid,
354459
+ endUuid: lastArchivedUuid,
354460
+ summary,
354461
+ risk: 0,
354462
+ stagedAt: Date.now()
354463
+ });
354464
+ }
354465
+ setLastSpawnTokens(tokenCountWithEstimation(messages));
354466
+ } catch (e) {
354467
+ recordError();
354468
+ logForDebugging(`[contextCollapse] spawn failed: ${errorMessage(e)}`);
354469
+ } finally {
354470
+ setSpawnInProgress(false);
354471
+ }
354472
+ }
354473
+ async function applyCollapsesIfNeeded(messages, toolUseContext, querySource) {
354474
+ if (!isContextCollapseEnabled())
354475
+ return { messages };
354476
+ if (querySource && EXCLUDED_SOURCES.has(querySource)) {
354477
+ return { messages };
354478
+ }
354479
+ try {
354480
+ let view = projectView(messages);
354481
+ const model = toolUseContext.options.mainLoopModel;
354482
+ const tokenCount = tokenCountWithEstimation(view);
354483
+ const effectiveWindow = getEffectiveContextWindowSize(model);
354484
+ const ratio = effectiveWindow > 0 ? tokenCount / effectiveWindow : 0;
354485
+ if (ratio >= BLOCKING_THRESHOLD) {
354486
+ if (getStaged().length > 0) {
354487
+ commitAllStaged();
354488
+ view = projectView(messages);
354489
+ } else if (!isSpawnInProgress()) {
354490
+ await trySpawn(messages, toolUseContext, true);
354491
+ view = projectView(messages);
354492
+ }
354493
+ } else if (ratio >= NONBLOCKING_THRESHOLD) {
354494
+ if (!isSpawnInProgress() && tokenCount - getLastSpawnTokens() >= RESPAWN_TOKEN_GAP) {
354495
+ trySpawn(messages, toolUseContext, false).catch((e) => {
354496
+ logForDebugging(`[contextCollapse] background spawn rejected: ${errorMessage(e)}`);
354497
+ });
354498
+ }
354499
+ }
354500
+ return { messages: view };
354501
+ } catch (e) {
354502
+ logForDebugging(`[contextCollapse] applyCollapsesIfNeeded failed: ${errorMessage(e)}`);
354503
+ return { messages };
354504
+ }
354505
+ }
354506
+ function isWithheldPromptTooLong(message, isPromptTooLongMessage2, querySource) {
354507
+ if (!isContextCollapseEnabled())
354508
+ return false;
354509
+ if (querySource && EXCLUDED_SOURCES.has(querySource))
354510
+ return false;
354511
+ if (!message || message.type !== "assistant") {
354512
+ return false;
354513
+ }
354514
+ try {
354515
+ if (!isPromptTooLongMessage2(message))
354516
+ return false;
354517
+ } catch {
354518
+ return false;
354519
+ }
354520
+ return getStaged().length > 0;
354521
+ }
354522
+ function recoverFromOverflow(messages, _querySource) {
354523
+ const committedCount = commitAllStaged();
354524
+ const view = projectView(messages);
354525
+ return { messages: view, committed: committedCount };
354526
+ }
354527
+ var NONBLOCKING_THRESHOLD = 0.9, BLOCKING_THRESHOLD = 0.95, PRESERVED_TAIL_MESSAGES = 20, MIN_SEGMENT_MESSAGES = 8, RESPAWN_TOKEN_GAP = 2000, EXCLUDED_SOURCES;
354528
+ var init_contextCollapse = __esm(() => {
354529
+ init_debug();
354530
+ init_errors();
354531
+ init_envUtils();
354532
+ init_autoCompact();
354533
+ init_tokens();
354534
+ init_operations();
354535
+ init_summarize();
354536
+ init_store();
354537
+ init_operations();
354538
+ EXCLUDED_SOURCES = new Set(["compact", "session_memory", "marble_origami"]);
354539
+ });
354540
+
354146
354541
  // src/utils/analyzeContext.ts
354147
354542
  async function countTokensWithFallback(messages, tools) {
354148
354543
  try {
@@ -354642,7 +355037,12 @@ async function analyzeContextUsage(messages, model, getToolPermissionContext, to
354642
355037
  let reservedTokens = 0;
354643
355038
  let skipReservedBuffer = false;
354644
355039
  if (false) {}
354645
- if (false) {}
355040
+ if (true) {
355041
+ const { isContextCollapseEnabled: isContextCollapseEnabled2 } = (init_contextCollapse(), __toCommonJS(exports_contextCollapse));
355042
+ if (isContextCollapseEnabled2()) {
355043
+ skipReservedBuffer = true;
355044
+ }
355045
+ }
354646
355046
  if (skipReservedBuffer) {} else if (isAutoCompact && autoCompactThreshold !== undefined) {
354647
355047
  reservedTokens = contextWindow - autoCompactThreshold;
354648
355048
  cats.push({
@@ -355148,7 +355548,7 @@ var init_toolSearch = __esm(() => {
355148
355548
  });
355149
355549
 
355150
355550
  // src/services/vcr.ts
355151
- import { createHash as createHash20, randomUUID as randomUUID18 } from "crypto";
355551
+ import { createHash as createHash20, randomUUID as randomUUID19 } from "crypto";
355152
355552
  import { mkdir as mkdir24, readFile as readFile29, writeFile as writeFile26 } from "fs/promises";
355153
355553
  import { dirname as dirname43, join as join98 } from "path";
355154
355554
  function shouldUseVCR() {
@@ -355201,7 +355601,7 @@ async function withVCR(messages, f) {
355201
355601
  try {
355202
355602
  const cached3 = jsonParse(await readFile29(filename, { encoding: "utf8" }));
355203
355603
  cached3.output.forEach(addCachedCostToTotalSessionCost);
355204
- return cached3.output.map((message, index) => mapMessage(message, hydrateValue, index, randomUUID18()));
355604
+ return cached3.output.map((message, index) => mapMessage(message, hydrateValue, index, randomUUID19()));
355205
355605
  } catch (e) {
355206
355606
  const code = getErrnoCode(e);
355207
355607
  if (code !== "ENOENT") {
@@ -355898,7 +356298,11 @@ var init_systemPromptSections = __esm(() => {
355898
356298
  function runPostCompactCleanup(querySource) {
355899
356299
  const isMainThreadCompact = querySource === undefined || querySource.startsWith("repl_main_thread") || querySource === "sdk";
355900
356300
  resetMicrocompactState();
355901
- if (false) {}
356301
+ if (true) {
356302
+ if (isMainThreadCompact) {
356303
+ (init_contextCollapse(), __toCommonJS(exports_contextCollapse)).resetContextCollapse();
356304
+ }
356305
+ }
355902
356306
  if (isMainThreadCompact) {
355903
356307
  getUserContext.cache.clear?.();
355904
356308
  resetGetMemoryFilesCache("compact");
@@ -356515,12 +356919,21 @@ async function shouldAutoCompact(messages, model, querySource, snipTokensFreed =
356515
356919
  if (querySource === "session_memory" || querySource === "compact") {
356516
356920
  return false;
356517
356921
  }
356518
- if (false) {}
356922
+ if (true) {
356923
+ if (querySource === "marble_origami") {
356924
+ return false;
356925
+ }
356926
+ }
356519
356927
  if (!isAutoCompactEnabled()) {
356520
356928
  return false;
356521
356929
  }
356522
356930
  if (false) {}
356523
- if (false) {}
356931
+ if (true) {
356932
+ const { isContextCollapseEnabled: isContextCollapseEnabled2 } = (init_contextCollapse(), __toCommonJS(exports_contextCollapse));
356933
+ if (isContextCollapseEnabled2()) {
356934
+ return false;
356935
+ }
356936
+ }
356524
356937
  const tokenCount = tokenCountWithEstimation(messages) - snipTokensFreed;
356525
356938
  const threshold = getAutoCompactThreshold(model);
356526
356939
  const effectiveWindow = getEffectiveContextWindowSize(model);
@@ -359147,6 +359560,64 @@ var init_config5 = __esm(() => {
359147
359560
  });
359148
359561
 
359149
359562
  // src/services/extractMemories/prompts.ts
359563
+ function opener(newMessageCount, existingMemories) {
359564
+ const manifest = existingMemories.length > 0 ? `
359565
+
359566
+ ## Existing memory files
359567
+
359568
+ ${existingMemories}
359569
+
359570
+ Check this list before writing — update an existing file rather than creating a duplicate.` : "";
359571
+ return [
359572
+ `You are now acting as the memory extraction subagent. Analyze the most recent ~${newMessageCount} messages above and use them to update your persistent memory systems.`,
359573
+ "",
359574
+ `Available tools: ${FILE_READ_TOOL_NAME}, ${GREP_TOOL_NAME}, ${GLOB_TOOL_NAME}, read-only ${BASH_TOOL_NAME} (ls/find/cat/stat/wc/head/tail and similar), and ${FILE_EDIT_TOOL_NAME}/${FILE_WRITE_TOOL_NAME} for paths inside the memory directory only. ${BASH_TOOL_NAME} rm is not permitted. All other tools — MCP, Agent, write-capable ${BASH_TOOL_NAME}, etc — will be denied.`,
359575
+ "",
359576
+ `You have a limited turn budget. ${FILE_EDIT_TOOL_NAME} requires a prior ${FILE_READ_TOOL_NAME} of the same file, so the efficient strategy is: turn 1 — issue all ${FILE_READ_TOOL_NAME} calls in parallel for every file you might update; turn 2 — issue all ${FILE_WRITE_TOOL_NAME}/${FILE_EDIT_TOOL_NAME} calls in parallel. Do not interleave reads and writes across multiple turns.`,
359577
+ "",
359578
+ `You MUST only use content from the last ~${newMessageCount} messages to update your persistent memories. Do not waste any turns attempting to investigate or verify that content further — no grepping source files, no reading code to confirm a pattern exists, no git commands.` + manifest
359579
+ ].join(`
359580
+ `);
359581
+ }
359582
+ function buildExtractAutoOnlyPrompt(newMessageCount, existingMemories, skipIndex = false) {
359583
+ const howToSave = skipIndex ? [
359584
+ "## How to save memories",
359585
+ "",
359586
+ "Write each memory to its own file (e.g., `user_role.md`, `feedback_testing.md`) using this frontmatter format:",
359587
+ "",
359588
+ ...MEMORY_FRONTMATTER_EXAMPLE,
359589
+ "",
359590
+ "- Organize memory semantically by topic, not chronologically",
359591
+ "- Update or remove memories that turn out to be wrong or outdated",
359592
+ "- Do not write duplicate memories. First check if there is an existing memory you can update before writing a new one."
359593
+ ] : [
359594
+ "## How to save memories",
359595
+ "",
359596
+ "Saving a memory is a two-step process:",
359597
+ "",
359598
+ "**Step 1** — write the memory to its own file (e.g., `user_role.md`, `feedback_testing.md`) using this frontmatter format:",
359599
+ "",
359600
+ ...MEMORY_FRONTMATTER_EXAMPLE,
359601
+ "",
359602
+ "**Step 2** — add a pointer to that file in `MEMORY.md`. `MEMORY.md` is an index, not a memory — each entry should be one line, under ~150 characters: `- [Title](file.md) — one-line hook`. It has no frontmatter. Never write memory content directly into `MEMORY.md`.",
359603
+ "",
359604
+ "- `MEMORY.md` is always loaded into your system prompt — lines after 200 will be truncated, so keep the index concise",
359605
+ "- Organize memory semantically by topic, not chronologically",
359606
+ "- Update or remove memories that turn out to be wrong or outdated",
359607
+ "- Do not write duplicate memories. First check if there is an existing memory you can update before writing a new one."
359608
+ ];
359609
+ return [
359610
+ opener(newMessageCount, existingMemories),
359611
+ "",
359612
+ "If the user explicitly asks you to remember something, save it immediately as whichever type fits best. If they ask you to forget something, find and remove the relevant entry.",
359613
+ "",
359614
+ ...TYPES_SECTION_INDIVIDUAL,
359615
+ ...WHAT_NOT_TO_SAVE_SECTION,
359616
+ "",
359617
+ ...howToSave
359618
+ ].join(`
359619
+ `);
359620
+ }
359150
359621
  var init_prompts2 = __esm(() => {
359151
359622
  init_memoryTypes();
359152
359623
  init_prompt2();
@@ -359155,6 +359626,64 @@ var init_prompts2 = __esm(() => {
359155
359626
  });
359156
359627
 
359157
359628
  // src/services/extractMemories/extractMemories.ts
359629
+ var exports_extractMemories = {};
359630
+ __export(exports_extractMemories, {
359631
+ initExtractMemories: () => initExtractMemories,
359632
+ executeExtractMemories: () => executeExtractMemories,
359633
+ drainPendingExtraction: () => drainPendingExtraction,
359634
+ createAutoMemCanUseTool: () => createAutoMemCanUseTool
359635
+ });
359636
+ import { basename as basename29 } from "path";
359637
+ function isModelVisibleMessage(message) {
359638
+ return message.type === "user" || message.type === "assistant";
359639
+ }
359640
+ function countModelVisibleMessagesSince(messages, sinceUuid) {
359641
+ if (sinceUuid === null || sinceUuid === undefined) {
359642
+ return count2(messages, isModelVisibleMessage);
359643
+ }
359644
+ let foundStart = false;
359645
+ let n2 = 0;
359646
+ for (const message of messages) {
359647
+ if (!foundStart) {
359648
+ if (message.uuid === sinceUuid) {
359649
+ foundStart = true;
359650
+ }
359651
+ continue;
359652
+ }
359653
+ if (isModelVisibleMessage(message)) {
359654
+ n2++;
359655
+ }
359656
+ }
359657
+ if (!foundStart) {
359658
+ return count2(messages, isModelVisibleMessage);
359659
+ }
359660
+ return n2;
359661
+ }
359662
+ function hasMemoryWritesSince(messages, sinceUuid) {
359663
+ let foundStart = sinceUuid === undefined;
359664
+ for (const message of messages) {
359665
+ if (!foundStart) {
359666
+ if (message.uuid === sinceUuid) {
359667
+ foundStart = true;
359668
+ }
359669
+ continue;
359670
+ }
359671
+ if (message.type !== "assistant") {
359672
+ continue;
359673
+ }
359674
+ const content = message.message.content;
359675
+ if (!Array.isArray(content)) {
359676
+ continue;
359677
+ }
359678
+ for (const block2 of content) {
359679
+ const filePath = getWrittenFilePath(block2);
359680
+ if (filePath !== undefined && isAutoMemPath(filePath)) {
359681
+ return true;
359682
+ }
359683
+ }
359684
+ }
359685
+ return false;
359686
+ }
359158
359687
  function denyAutoMemTool(tool, reason) {
359159
359688
  logForDebugging(`[autoMem] denied ${tool.name}: ${reason}`);
359160
359689
  logEvent("tengu_auto_mem_tool_denied", {
@@ -359190,6 +359719,191 @@ function createAutoMemCanUseTool(memoryDir) {
359190
359719
  return denyAutoMemTool(tool, `only ${FILE_READ_TOOL_NAME}, ${GREP_TOOL_NAME}, ${GLOB_TOOL_NAME}, read-only ${BASH_TOOL_NAME}, and ${FILE_EDIT_TOOL_NAME}/${FILE_WRITE_TOOL_NAME} within ${memoryDir} are allowed`);
359191
359720
  };
359192
359721
  }
359722
+ function getWrittenFilePath(block2) {
359723
+ if (block2.type !== "tool_use" || block2.name !== FILE_EDIT_TOOL_NAME && block2.name !== FILE_WRITE_TOOL_NAME) {
359724
+ return;
359725
+ }
359726
+ const input = block2.input;
359727
+ if (typeof input === "object" && input !== null && "file_path" in input) {
359728
+ const fp = input.file_path;
359729
+ return typeof fp === "string" ? fp : undefined;
359730
+ }
359731
+ return;
359732
+ }
359733
+ function extractWrittenPaths(agentMessages) {
359734
+ const paths2 = [];
359735
+ for (const message of agentMessages) {
359736
+ if (message.type !== "assistant") {
359737
+ continue;
359738
+ }
359739
+ const content = message.message.content;
359740
+ if (!Array.isArray(content)) {
359741
+ continue;
359742
+ }
359743
+ for (const block2 of content) {
359744
+ const filePath = getWrittenFilePath(block2);
359745
+ if (filePath !== undefined) {
359746
+ paths2.push(filePath);
359747
+ }
359748
+ }
359749
+ }
359750
+ return uniq(paths2);
359751
+ }
359752
+ function initExtractMemories() {
359753
+ const inFlightExtractions = new Set;
359754
+ let lastMemoryMessageUuid;
359755
+ let hasLoggedGateFailure = false;
359756
+ let inProgress = false;
359757
+ let turnsSinceLastExtraction = 0;
359758
+ let pendingContext;
359759
+ async function runExtraction({
359760
+ context,
359761
+ appendSystemMessage,
359762
+ isTrailingRun
359763
+ }) {
359764
+ const { messages } = context;
359765
+ const memoryDir = getAutoMemPath();
359766
+ const newMessageCount = countModelVisibleMessagesSince(messages, lastMemoryMessageUuid);
359767
+ if (hasMemoryWritesSince(messages, lastMemoryMessageUuid)) {
359768
+ logForDebugging("[extractMemories] skipping — conversation already wrote to memory files");
359769
+ const lastMessage = messages.at(-1);
359770
+ if (lastMessage?.uuid) {
359771
+ lastMemoryMessageUuid = lastMessage.uuid;
359772
+ }
359773
+ logEvent("tengu_extract_memories_skipped_direct_write", {
359774
+ message_count: newMessageCount
359775
+ });
359776
+ return;
359777
+ }
359778
+ const teamMemoryEnabled = false;
359779
+ const skipIndex = getFeatureValue_CACHED_MAY_BE_STALE("tengu_moth_copse", false);
359780
+ const canUseTool = createAutoMemCanUseTool(memoryDir);
359781
+ const cacheSafeParams = createCacheSafeParams(context);
359782
+ if (!isTrailingRun) {
359783
+ turnsSinceLastExtraction++;
359784
+ if (turnsSinceLastExtraction < (getFeatureValue_CACHED_MAY_BE_STALE("tengu_bramble_lintel", null) ?? 1)) {
359785
+ return;
359786
+ }
359787
+ }
359788
+ turnsSinceLastExtraction = 0;
359789
+ inProgress = true;
359790
+ const startTime = Date.now();
359791
+ try {
359792
+ logForDebugging(`[extractMemories] starting — ${newMessageCount} new messages, memoryDir=${memoryDir}`);
359793
+ const existingMemories = formatMemoryManifest(await scanMemoryFiles(memoryDir, createAbortController().signal));
359794
+ const userPrompt = buildExtractAutoOnlyPrompt(newMessageCount, existingMemories, skipIndex);
359795
+ const result = await runForkedAgent({
359796
+ promptMessages: [createUserMessage({ content: userPrompt })],
359797
+ cacheSafeParams,
359798
+ canUseTool,
359799
+ querySource: "extract_memories",
359800
+ forkLabel: "extract_memories",
359801
+ skipTranscript: true,
359802
+ maxTurns: 5
359803
+ });
359804
+ const lastMessage = messages.at(-1);
359805
+ if (lastMessage?.uuid) {
359806
+ lastMemoryMessageUuid = lastMessage.uuid;
359807
+ }
359808
+ const writtenPaths = extractWrittenPaths(result.messages);
359809
+ const turnCount = count2(result.messages, (m) => m.type === "assistant");
359810
+ const totalInput = result.totalUsage.input_tokens + result.totalUsage.cache_creation_input_tokens + result.totalUsage.cache_read_input_tokens;
359811
+ const hitPct = totalInput > 0 ? (result.totalUsage.cache_read_input_tokens / totalInput * 100).toFixed(1) : "0.0";
359812
+ logForDebugging(`[extractMemories] finished — ${writtenPaths.length} files written, cache: read=${result.totalUsage.cache_read_input_tokens} create=${result.totalUsage.cache_creation_input_tokens} input=${result.totalUsage.input_tokens} (${hitPct}% hit)`);
359813
+ if (writtenPaths.length > 0) {
359814
+ logForDebugging(`[extractMemories] memories saved: ${writtenPaths.join(", ")}`);
359815
+ } else {
359816
+ logForDebugging("[extractMemories] no memories saved this run");
359817
+ }
359818
+ const memoryPaths = writtenPaths.filter((p) => basename29(p) !== ENTRYPOINT_NAME);
359819
+ const teamCount = 0;
359820
+ logEvent("tengu_extract_memories_extraction", {
359821
+ input_tokens: result.totalUsage.input_tokens,
359822
+ output_tokens: result.totalUsage.output_tokens,
359823
+ cache_read_input_tokens: result.totalUsage.cache_read_input_tokens,
359824
+ cache_creation_input_tokens: result.totalUsage.cache_creation_input_tokens,
359825
+ message_count: newMessageCount,
359826
+ turn_count: turnCount,
359827
+ files_written: writtenPaths.length,
359828
+ memories_saved: memoryPaths.length,
359829
+ team_memories_saved: teamCount,
359830
+ duration_ms: Date.now() - startTime
359831
+ });
359832
+ logForDebugging(`[extractMemories] writtenPaths=${writtenPaths.length} memoryPaths=${memoryPaths.length} appendSystemMessage defined=${appendSystemMessage != null}`);
359833
+ if (memoryPaths.length > 0) {
359834
+ const msg = createMemorySavedMessage(memoryPaths);
359835
+ if (false) {}
359836
+ appendSystemMessage?.(msg);
359837
+ }
359838
+ } catch (error41) {
359839
+ logForDebugging(`[extractMemories] error: ${error41}`);
359840
+ logEvent("tengu_extract_memories_error", {
359841
+ duration_ms: Date.now() - startTime
359842
+ });
359843
+ } finally {
359844
+ inProgress = false;
359845
+ const trailing = pendingContext;
359846
+ pendingContext = undefined;
359847
+ if (trailing) {
359848
+ logForDebugging("[extractMemories] running trailing extraction for stashed context");
359849
+ await runExtraction({
359850
+ context: trailing.context,
359851
+ appendSystemMessage: trailing.appendSystemMessage,
359852
+ isTrailingRun: true
359853
+ });
359854
+ }
359855
+ }
359856
+ }
359857
+ async function executeExtractMemoriesImpl(context, appendSystemMessage) {
359858
+ if (context.toolUseContext.agentId) {
359859
+ return;
359860
+ }
359861
+ if (!getFeatureValue_CACHED_MAY_BE_STALE("tengu_passport_quail", true)) {
359862
+ if (process.env.USER_TYPE === "ant" && !hasLoggedGateFailure) {
359863
+ hasLoggedGateFailure = true;
359864
+ logEvent("tengu_extract_memories_gate_disabled", {});
359865
+ }
359866
+ return;
359867
+ }
359868
+ if (!isAutoMemoryEnabled()) {
359869
+ return;
359870
+ }
359871
+ if (getIsRemoteMode()) {
359872
+ return;
359873
+ }
359874
+ if (inProgress) {
359875
+ logForDebugging("[extractMemories] extraction in progress — stashing for trailing run");
359876
+ logEvent("tengu_extract_memories_coalesced", {});
359877
+ pendingContext = { context, appendSystemMessage };
359878
+ return;
359879
+ }
359880
+ await runExtraction({ context, appendSystemMessage });
359881
+ }
359882
+ extractor = async (context, appendSystemMessage) => {
359883
+ const p = executeExtractMemoriesImpl(context, appendSystemMessage);
359884
+ inFlightExtractions.add(p);
359885
+ try {
359886
+ await p;
359887
+ } finally {
359888
+ inFlightExtractions.delete(p);
359889
+ }
359890
+ };
359891
+ drainer = async (timeoutMs = 60000) => {
359892
+ if (inFlightExtractions.size === 0)
359893
+ return;
359894
+ await Promise.race([
359895
+ Promise.all(inFlightExtractions).catch(() => {}),
359896
+ new Promise((r) => setTimeout(r, timeoutMs).unref())
359897
+ ]);
359898
+ };
359899
+ }
359900
+ async function executeExtractMemories(context, appendSystemMessage) {
359901
+ await extractor?.(context, appendSystemMessage);
359902
+ }
359903
+ async function drainPendingExtraction(timeoutMs) {
359904
+ await drainer(timeoutMs);
359905
+ }
359906
+ var extractor = null, drainer = async () => {};
359193
359907
  var init_extractMemories = __esm(() => {
359194
359908
  init_state();
359195
359909
  init_memdir();
@@ -359272,7 +359986,7 @@ var init_consolidationPrompt = __esm(() => {
359272
359986
 
359273
359987
  // src/utils/listSessionsImpl.ts
359274
359988
  import { readdir as readdir19, stat as stat33 } from "fs/promises";
359275
- import { basename as basename29, join as join100 } from "path";
359989
+ import { basename as basename30, join as join100 } from "path";
359276
359990
  async function listCandidates(projectDir, doStat, projectPath) {
359277
359991
  let names;
359278
359992
  try {
@@ -359655,7 +360369,9 @@ async function* handleStopHooks(messagesForQuery, assistantMessages, systemPromp
359655
360369
  if (!isEnvDefinedFalsy(process.env.VIVUS_CODE_ENABLE_PROMPT_SUGGESTION)) {
359656
360370
  executePromptSuggestion(stopHookContext);
359657
360371
  }
359658
- if (false) {}
360372
+ if (!toolUseContext.agentId && isExtractModeActive()) {
360373
+ extractMemoriesModule.executeExtractMemories(stopHookContext, toolUseContext.appendSystemMessage);
360374
+ }
359659
360375
  if (!toolUseContext.agentId) {
359660
360376
  executeAutoDream(stopHookContext, toolUseContext.appendSystemMessage);
359661
360377
  }
@@ -359855,6 +360571,7 @@ async function* handleStopHooks(messagesForQuery, assistantMessages, systemPromp
359855
360571
  return { blockingErrors: [], preventContinuation: false };
359856
360572
  }
359857
360573
  }
360574
+ var extractMemoriesModule;
359858
360575
  var init_stopHooks = __esm(() => {
359859
360576
  init_shortcutFormat();
359860
360577
  init_paths();
@@ -359870,6 +360587,7 @@ var init_stopHooks = __esm(() => {
359870
360587
  init_promptSuggestion();
359871
360588
  init_envUtils();
359872
360589
  init_forkedAgent();
360590
+ extractMemoriesModule = (init_extractMemories(), __toCommonJS(exports_extractMemories));
359873
360591
  });
359874
360592
 
359875
360593
  // src/query/config.ts
@@ -359891,13 +360609,13 @@ var init_config6 = __esm(() => {
359891
360609
  });
359892
360610
 
359893
360611
  // src/query/deps.ts
359894
- import { randomUUID as randomUUID19 } from "crypto";
360612
+ import { randomUUID as randomUUID20 } from "crypto";
359895
360613
  function productionDeps() {
359896
360614
  return {
359897
360615
  callModel: queryModelWithStreaming,
359898
360616
  microcompact: microcompactMessages,
359899
360617
  autocompact: autoCompactIfNeeded,
359900
- uuid: randomUUID19
360618
+ uuid: randomUUID20
359901
360619
  };
359902
360620
  }
359903
360621
  var init_deps = __esm(() => {
@@ -360021,7 +360739,10 @@ async function* queryLoop(params, consumedCommandUuids) {
360021
360739
  messagesForQuery = microcompactResult.messages;
360022
360740
  const pendingCacheEdits2 = undefined;
360023
360741
  queryCheckpoint("query_microcompact_end");
360024
- if (false) {}
360742
+ if (contextCollapse) {
360743
+ const collapseResult = await contextCollapse.applyCollapsesIfNeeded(messagesForQuery, toolUseContext, querySource);
360744
+ messagesForQuery = collapseResult.messages;
360745
+ }
360025
360746
  const fullSystemPrompt = asSystemPrompt(appendSystemContext(systemPrompt, systemContext));
360026
360747
  queryCheckpoint("query_autocompact_start");
360027
360748
  const { compactionResult, consecutiveFailures } = await deps.autocompact(messagesForQuery, toolUseContext, {
@@ -360095,7 +360816,9 @@ async function* queryLoop(params, consumedCommandUuids) {
360095
360816
  queryCheckpoint("query_setup_end");
360096
360817
  const dumpPromptsFetch = config3.gates.isAnt ? createDumpPromptsFetch(toolUseContext.agentId ?? config3.sessionId) : undefined;
360097
360818
  let collapseOwnsIt = false;
360098
- if (false) {}
360819
+ if (true) {
360820
+ collapseOwnsIt = (contextCollapse?.isContextCollapseEnabled() ?? false) && isAutoCompactEnabled();
360821
+ }
360099
360822
  const mediaRecoveryEnabled = reactiveCompact?.isReactiveCompactEnabled() ?? false;
360100
360823
  if (!compactionResult && querySource !== "compact" && querySource !== "session_memory" && !(reactiveCompact?.isReactiveCompactEnabled() && isAutoCompactEnabled()) && !collapseOwnsIt) {
360101
360824
  const { isAtBlockingLimit } = calculateTokenWarningState(tokenCountWithEstimation(messagesForQuery) - snipTokensFreed, toolUseContext.options.mainLoopModel);
@@ -360205,7 +360928,11 @@ async function* queryLoop(params, consumedCommandUuids) {
360205
360928
  }
360206
360929
  }
360207
360930
  let withheld = false;
360208
- if (false) {}
360931
+ if (true) {
360932
+ if (contextCollapse?.isWithheldPromptTooLong(message, isPromptTooLongMessage, querySource)) {
360933
+ withheld = true;
360934
+ }
360935
+ }
360209
360936
  if (reactiveCompact?.isWithheldPromptTooLong(message)) {
360210
360937
  withheld = true;
360211
360938
  }
@@ -360326,7 +361053,28 @@ async function* queryLoop(params, consumedCommandUuids) {
360326
361053
  const isWithheld413 = lastMessage?.type === "assistant" && lastMessage.isApiErrorMessage && isPromptTooLongMessage(lastMessage);
360327
361054
  const isWithheldMedia = mediaRecoveryEnabled && reactiveCompact?.isWithheldMediaSizeError(lastMessage);
360328
361055
  if (isWithheld413) {
360329
- if (false) {}
361056
+ if (contextCollapse && state.transition?.reason !== "collapse_drain_retry") {
361057
+ const drained = contextCollapse.recoverFromOverflow(messagesForQuery, querySource);
361058
+ if (drained.committed > 0) {
361059
+ const next2 = {
361060
+ messages: drained.messages,
361061
+ toolUseContext,
361062
+ autoCompactTracking: tracking,
361063
+ maxOutputTokensRecoveryCount,
361064
+ hasAttemptedReactiveCompact,
361065
+ maxOutputTokensOverride: undefined,
361066
+ pendingToolUseSummary: undefined,
361067
+ stopHookActive: undefined,
361068
+ turnCount,
361069
+ transition: {
361070
+ reason: "collapse_drain_retry",
361071
+ committed: drained.committed
361072
+ }
361073
+ };
361074
+ state = next2;
361075
+ continue;
361076
+ }
361077
+ }
360330
361078
  }
360331
361079
  if ((isWithheld413 || isWithheldMedia) && reactiveCompact) {
360332
361080
  const compacted = await reactiveCompact.tryReactiveCompact({
@@ -360369,7 +361117,11 @@ async function* queryLoop(params, consumedCommandUuids) {
360369
361117
  yield lastMessage;
360370
361118
  executeStopFailureHooks(lastMessage, toolUseContext);
360371
361119
  return { reason: isWithheldMedia ? "image_error" : "prompt_too_long" };
360372
- } else if (false) {}
361120
+ } else if (isWithheld413) {
361121
+ yield lastMessage;
361122
+ executeStopFailureHooks(lastMessage, toolUseContext);
361123
+ return { reason: "prompt_too_long" };
361124
+ }
360373
361125
  if (isWithheldMaxOutputTokens(lastMessage)) {
360374
361126
  const capEnabled = getFeatureValue_CACHED_MAY_BE_STALE("tengu_otk_slot_v1", false);
360375
361127
  if (capEnabled && maxOutputTokensOverride === undefined && !process.env.VIVUS_CODE_MAX_OUTPUT_TOKENS) {
@@ -360650,7 +361402,7 @@ async function* queryLoop(params, consumedCommandUuids) {
360650
361402
  __callDispose(__stack, _err, _hasErr);
360651
361403
  }
360652
361404
  }
360653
- var reactiveCompact = null, skillPrefetch = null, MAX_OUTPUT_TOKENS_RECOVERY_LIMIT = 3;
361405
+ var reactiveCompact = null, contextCollapse, skillPrefetch = null, MAX_OUTPUT_TOKENS_RECOVERY_LIMIT = 3;
360654
361406
  var init_query2 = __esm(() => {
360655
361407
  init_withRetry();
360656
361408
  init_autoCompact();
@@ -360687,6 +361439,7 @@ var init_query2 = __esm(() => {
360687
361439
  init_deps();
360688
361440
  init_state();
360689
361441
  init_tokenBudget2();
361442
+ contextCollapse = (init_contextCollapse(), __toCommonJS(exports_contextCollapse));
360690
361443
  });
360691
361444
 
360692
361445
  // src/services/api/emptyUsage.ts
@@ -360759,7 +361512,7 @@ function getAnthropicEnvMetadata() {
360759
361512
  function getBuildAgeMinutes() {
360760
361513
  if (false)
360761
361514
  ;
360762
- const buildTime = new Date("2026-08-06T08:10:40.644Z").getTime();
361515
+ const buildTime = new Date("2026-08-06T11:53:22.560Z").getTime();
360763
361516
  if (isNaN(buildTime))
360764
361517
  return;
360765
361518
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -361210,7 +361963,7 @@ var init_denialTracking = __esm(() => {
361210
361963
  });
361211
361964
 
361212
361965
  // src/utils/forkedAgent.ts
361213
- import { randomUUID as randomUUID20 } from "crypto";
361966
+ import { randomUUID as randomUUID21 } from "crypto";
361214
361967
  function saveCacheSafeParams(params) {
361215
361968
  lastCacheSafeParams = params;
361216
361969
  }
@@ -361319,7 +362072,7 @@ function createSubagentContext(parentContext, overrides) {
361319
362072
  agentId: overrides?.agentId ?? createAgentId(),
361320
362073
  agentType: overrides?.agentType,
361321
362074
  queryTracking: {
361322
- chainId: randomUUID20(),
362075
+ chainId: randomUUID21(),
361323
362076
  depth: (parentContext.queryTracking?.depth ?? -1) + 1
361324
362077
  },
361325
362078
  fileReadingLimits: parentContext.fileReadingLimits,
@@ -362239,7 +362992,7 @@ var init_queryHelpers = __esm(() => {
362239
362992
  });
362240
362993
 
362241
362994
  // src/services/PromptSuggestion/speculation.ts
362242
- import { randomUUID as randomUUID21 } from "crypto";
362995
+ import { randomUUID as randomUUID22 } from "crypto";
362243
362996
  import { rm as rm9 } from "fs";
362244
362997
  import { appendFile as appendFile5, copyFile as copyFile8, mkdir as mkdir26 } from "fs/promises";
362245
362998
  import { dirname as dirname44, isAbsolute as isAbsolute23, join as join102, relative as relative17 } from "path";
@@ -362429,7 +363182,7 @@ async function startSpeculation(suggestionText, context, setAppState, isPipeline
362429
363182
  if (!isSpeculationEnabled())
362430
363183
  return;
362431
363184
  abortSpeculation(setAppState);
362432
- const id = randomUUID21().slice(0, 8);
363185
+ const id = randomUUID22().slice(0, 8);
362433
363186
  const abortController = createChildAbortController(context.toolUseContext.abortController);
362434
363187
  if (abortController.signal.aborted)
362435
363188
  return;
@@ -364430,7 +365183,7 @@ var init_conversationRecovery = __esm(() => {
364430
365183
  });
364431
365184
 
364432
365185
  // src/services/api/filesApi.ts
364433
- import { randomUUID as randomUUID22 } from "crypto";
365186
+ import { randomUUID as randomUUID23 } from "crypto";
364434
365187
  import * as fs8 from "fs/promises";
364435
365188
  import * as path17 from "path";
364436
365189
  function getDefaultApiBaseUrl() {
@@ -364614,7 +365367,7 @@ async function uploadFile(filePath, relativePath, config3, opts) {
364614
365367
  success: false
364615
365368
  };
364616
365369
  }
364617
- const boundary = `----FormBoundary${randomUUID22()}`;
365370
+ const boundary = `----FormBoundary${randomUUID23()}`;
364618
365371
  const filename = path17.basename(relativePath);
364619
365372
  const bodyParts = [];
364620
365373
  bodyParts.push(Buffer.from(`--${boundary}\r
@@ -364751,11 +365504,11 @@ var init_filesApi = __esm(() => {
364751
365504
  });
364752
365505
 
364753
365506
  // src/utils/tempfile.ts
364754
- import { createHash as createHash22, randomUUID as randomUUID23 } from "crypto";
365507
+ import { createHash as createHash22, randomUUID as randomUUID24 } from "crypto";
364755
365508
  import { tmpdir as tmpdir7 } from "os";
364756
365509
  import { join as join104 } from "path";
364757
365510
  function generateTempFilePath(prefix = "vivus-prompt", extension2 = ".md", options2) {
364758
- const id = options2?.contentHash ? createHash22("sha256").update(options2.contentHash).digest("hex").slice(0, 16) : randomUUID23();
365511
+ const id = options2?.contentHash ? createHash22("sha256").update(options2.contentHash).digest("hex").slice(0, 16) : randomUUID24();
364759
365512
  return join104(tmpdir7(), `${prefix}-${id}${extension2}`);
364760
365513
  }
364761
365514
  var init_tempfile = () => {};
@@ -364930,7 +365683,7 @@ __export(exports_teleport, {
364930
365683
  checkOutTeleportedSessionBranch: () => checkOutTeleportedSessionBranch,
364931
365684
  archiveRemoteSession: () => archiveRemoteSession
364932
365685
  });
364933
- import { randomUUID as randomUUID24 } from "crypto";
365686
+ import { randomUUID as randomUUID25 } from "crypto";
364934
365687
  function createTeleportResumeSystemMessage(branchError) {
364935
365688
  if (branchError === null) {
364936
365689
  return createSystemMessage("Session resumed", "suggestion");
@@ -365647,7 +366400,7 @@ async function teleportToRemote(options2) {
365647
366400
  type: "event",
365648
366401
  data: {
365649
366402
  type: "control_request",
365650
- request_id: `set-mode-${randomUUID24()}`,
366403
+ request_id: `set-mode-${randomUUID25()}`,
365651
366404
  request: {
365652
366405
  subtype: "set_permission_mode",
365653
366406
  mode: options2.permissionMode,
@@ -365660,7 +366413,7 @@ async function teleportToRemote(options2) {
365660
366413
  events2.push({
365661
366414
  type: "event",
365662
366415
  data: {
365663
- uuid: randomUUID24(),
366416
+ uuid: randomUUID25(),
365664
366417
  session_id: "",
365665
366418
  type: "user",
365666
366419
  parent_tool_use_id: null,
@@ -394154,6 +394907,116 @@ __export(exports_VerifyPlanExecutionTool, {
394154
394907
  });
394155
394908
  var VerifyPlanExecutionTool = null;
394156
394909
 
394910
+ // src/tools/CtxInspectTool/constants.ts
394911
+ var CTX_INSPECT_TOOL_NAME = "CtxInspect";
394912
+
394913
+ // src/tools/CtxInspectTool/prompt.ts
394914
+ var DESCRIPTION19 = "Inspect context-collapse state: which older parts of the conversation have been summarized (or are staged to be), and their summaries.", PROMPT8 = `Use this tool to see what the context-collapse system has done to your own context window: which older spans of the conversation have already been summarized and replaced with a placeholder, which spans are staged (summarized but not yet committed), and the plain-text summary for a given span.
394915
+
394916
+ Call with no arguments for an overview (counts + health). Pass \`collapseId\` (from the overview) to see the full summary text and, if still available in this session, the original archived messages for that span.`;
394917
+
394918
+ // src/tools/CtxInspectTool/CtxInspectTool.ts
394919
+ var exports_CtxInspectTool = {};
394920
+ __export(exports_CtxInspectTool, {
394921
+ CtxInspectTool: () => CtxInspectTool
394922
+ });
394923
+ var inputSchema39, outputSchema32, CtxInspectTool;
394924
+ var init_CtxInspectTool = __esm(() => {
394925
+ init_v4();
394926
+ init_Tool();
394927
+ init_contextCollapse();
394928
+ inputSchema39 = lazySchema(() => exports_external.strictObject({
394929
+ collapseId: exports_external.string().optional().describe("Optional: show the full summary (and archived messages, if still available) for this collapse span. Omit for an overview.")
394930
+ }));
394931
+ outputSchema32 = lazySchema(() => exports_external.object({
394932
+ enabled: exports_external.boolean(),
394933
+ collapsedSpans: exports_external.number(),
394934
+ collapsedMessages: exports_external.number(),
394935
+ stagedSpans: exports_external.number(),
394936
+ health: exports_external.object({
394937
+ totalSpawns: exports_external.number(),
394938
+ totalErrors: exports_external.number(),
394939
+ totalEmptySpawns: exports_external.number()
394940
+ }),
394941
+ span: exports_external.object({
394942
+ collapseId: exports_external.string(),
394943
+ summary: exports_external.string(),
394944
+ archivedMessageCount: exports_external.number()
394945
+ }).nullable().optional()
394946
+ }));
394947
+ CtxInspectTool = buildTool({
394948
+ name: CTX_INSPECT_TOOL_NAME,
394949
+ searchHint: "inspect context-collapse summarization state",
394950
+ maxResultSizeChars: 20000,
394951
+ strict: true,
394952
+ async description() {
394953
+ return DESCRIPTION19;
394954
+ },
394955
+ async prompt() {
394956
+ return PROMPT8;
394957
+ },
394958
+ get inputSchema() {
394959
+ return inputSchema39();
394960
+ },
394961
+ get outputSchema() {
394962
+ return outputSchema32();
394963
+ },
394964
+ userFacingName() {
394965
+ return "Inspect context";
394966
+ },
394967
+ shouldDefer: true,
394968
+ isReadOnly() {
394969
+ return true;
394970
+ },
394971
+ isConcurrencySafe() {
394972
+ return true;
394973
+ },
394974
+ toAutoClassifierInput(input) {
394975
+ return input.collapseId ? `collapseId=${input.collapseId}` : "overview";
394976
+ },
394977
+ async checkPermissions(input) {
394978
+ return { behavior: "allow", updatedInput: input };
394979
+ },
394980
+ renderToolUseMessage() {
394981
+ return null;
394982
+ },
394983
+ async call({ collapseId }) {
394984
+ const stats = getStats();
394985
+ const enabled = isContextCollapseEnabled();
394986
+ if (!collapseId) {
394987
+ return {
394988
+ enabled,
394989
+ collapsedSpans: stats.collapsedSpans,
394990
+ collapsedMessages: stats.collapsedMessages,
394991
+ stagedSpans: stats.stagedSpans,
394992
+ health: {
394993
+ totalSpawns: stats.health.totalSpawns,
394994
+ totalErrors: stats.health.totalErrors,
394995
+ totalEmptySpawns: stats.health.totalEmptySpawns
394996
+ }
394997
+ };
394998
+ }
394999
+ const commit = getCommittedForInspect(collapseId);
395000
+ return {
395001
+ enabled,
395002
+ collapsedSpans: stats.collapsedSpans,
395003
+ collapsedMessages: stats.collapsedMessages,
395004
+ stagedSpans: stats.stagedSpans,
395005
+ health: {
395006
+ totalSpawns: stats.health.totalSpawns,
395007
+ totalErrors: stats.health.totalErrors,
395008
+ totalEmptySpawns: stats.health.totalEmptySpawns
395009
+ },
395010
+ span: commit ? {
395011
+ collapseId,
395012
+ summary: commit.summary,
395013
+ archivedMessageCount: commit.archived.length
395014
+ } : null
395015
+ };
395016
+ }
395017
+ });
395018
+ });
395019
+
394157
395020
  // src/tools.ts
394158
395021
  function parseToolPreset(preset) {
394159
395022
  const presetString = preset.toLowerCase();
@@ -394191,7 +395054,7 @@ function getAllBaseTools() {
394191
395054
  ...WebBrowserTool ? [WebBrowserTool] : [],
394192
395055
  ...isTodoV2Enabled() ? [TaskCreateTool, TaskGetTool, TaskUpdateTool, TaskListTool] : [],
394193
395056
  ...OverflowTestTool ? [OverflowTestTool] : [],
394194
- ...CtxInspectTool ? [CtxInspectTool] : [],
395057
+ ...CtxInspectTool2 ? [CtxInspectTool2] : [],
394195
395058
  ...TerminalCaptureTool ? [TerminalCaptureTool] : [],
394196
395059
  ...isEnvTruthy(process.env.ENABLE_LSP_TOOL) ? [LSPTool] : [],
394197
395060
  ...isWorktreeModeEnabled() ? [EnterWorktreeTool, ExitWorktreeTool] : [],
@@ -394226,7 +395089,7 @@ function assembleToolPool(permissionContext, mcpTools) {
394226
395089
  const byName = (a2, b) => a2.name.localeCompare(b.name);
394227
395090
  return uniqBy_default([...builtInTools].sort(byName).concat(allowedMcpTools.sort(byName)), "name");
394228
395091
  }
394229
- var REPLTool2, SuggestBackgroundPRTool2, SleepTool = null, cronTools, RemoteTriggerTool = null, MonitorTool = null, SendUserFileTool = null, PushNotificationTool = null, SubscribePRTool = null, getTeamCreateTool = () => (init_TeamCreateTool(), __toCommonJS(exports_TeamCreateTool)).TeamCreateTool, getTeamDeleteTool = () => (init_TeamDeleteTool(), __toCommonJS(exports_TeamDeleteTool)).TeamDeleteTool, getSendMessageTool = () => (init_SendMessageTool(), __toCommonJS(exports_SendMessageTool)).SendMessageTool, VerifyPlanExecutionTool2, OverflowTestTool = null, CtxInspectTool = null, TerminalCaptureTool = null, WebBrowserTool = null, SnipTool = null, ListPeersTool = null, WorkflowTool = null, getPowerShellTool2 = () => {
395092
+ var REPLTool2, SuggestBackgroundPRTool2, SleepTool = null, cronTools, RemoteTriggerTool = null, MonitorTool = null, SendUserFileTool = null, PushNotificationTool = null, SubscribePRTool = null, getTeamCreateTool = () => (init_TeamCreateTool(), __toCommonJS(exports_TeamCreateTool)).TeamCreateTool, getTeamDeleteTool = () => (init_TeamDeleteTool(), __toCommonJS(exports_TeamDeleteTool)).TeamDeleteTool, getSendMessageTool = () => (init_SendMessageTool(), __toCommonJS(exports_SendMessageTool)).SendMessageTool, VerifyPlanExecutionTool2, OverflowTestTool = null, CtxInspectTool2, TerminalCaptureTool = null, WebBrowserTool = null, SnipTool = null, ListPeersTool = null, WorkflowTool = null, getPowerShellTool2 = () => {
394230
395093
  if (!isPowerShellToolEnabled())
394231
395094
  return null;
394232
395095
  return (init_PowerShellTool(), __toCommonJS(exports_PowerShellTool)).PowerShellTool;
@@ -394304,6 +395167,7 @@ var init_tools2 = __esm(() => {
394304
395167
  SuggestBackgroundPRTool2 = process.env.USER_TYPE === "ant" ? __toCommonJS(exports_SuggestBackgroundPRTool).SuggestBackgroundPRTool : null;
394305
395168
  cronTools = [];
394306
395169
  VerifyPlanExecutionTool2 = process.env.VIVUS_CODE_VERIFY_PLAN === "true" ? __toCommonJS(exports_VerifyPlanExecutionTool).VerifyPlanExecutionTool : null;
395170
+ CtxInspectTool2 = (init_CtxInspectTool(), __toCommonJS(exports_CtxInspectTool)).CtxInspectTool;
394307
395171
  TOOL_PRESETS = ["default"];
394308
395172
  });
394309
395173
 
@@ -395431,7 +396295,7 @@ var init_markdownConfigLoader = __esm(() => {
395431
396295
  });
395432
396296
 
395433
396297
  // src/outputStyles/loadOutputStylesDir.ts
395434
- import { basename as basename31 } from "path";
396298
+ import { basename as basename32 } from "path";
395435
396299
  var getOutputStyleDirStyles;
395436
396300
  var init_loadOutputStylesDir = __esm(() => {
395437
396301
  init_memoize();
@@ -395445,7 +396309,7 @@ var init_loadOutputStylesDir = __esm(() => {
395445
396309
  const markdownFiles = await loadMarkdownFilesForSubdir("output-styles", cwd2);
395446
396310
  const styles5 = markdownFiles.map(({ filePath, frontmatter, content, source }) => {
395447
396311
  try {
395448
- const fileName = basename31(filePath);
396312
+ const fileName = basename32(filePath);
395449
396313
  const styleName = fileName.replace(/\.md$/, "");
395450
396314
  const name = frontmatter["name"] || styleName;
395451
396315
  const description = coerceDescriptionToString(frontmatter["description"], styleName) ?? extractDescriptionFromMarkdown(content, `Custom ${styleName} output style`);
@@ -395630,7 +396494,7 @@ ${EXPLANATORY_FEATURE_PROMPT}`
395630
396494
  });
395631
396495
 
395632
396496
  // src/utils/messages.ts
395633
- import { randomUUID as randomUUID25 } from "crypto";
396497
+ import { randomUUID as randomUUID26 } from "crypto";
395634
396498
  function getTeammateMailbox() {
395635
396499
  return init_teammateMailbox(), __toCommonJS(exports_teammateMailbox);
395636
396500
  }
@@ -395704,10 +396568,10 @@ function baseCreateAssistantMessage({
395704
396568
  }) {
395705
396569
  return {
395706
396570
  type: "assistant",
395707
- uuid: randomUUID25(),
396571
+ uuid: randomUUID26(),
395708
396572
  timestamp: new Date().toISOString(),
395709
396573
  message: {
395710
- id: randomUUID25(),
396574
+ id: randomUUID26(),
395711
396575
  container: null,
395712
396576
  model: SYNTHETIC_MODEL,
395713
396577
  role: "assistant",
@@ -395788,7 +396652,7 @@ function createUserMessage({
395788
396652
  isVirtual,
395789
396653
  isCompactSummary,
395790
396654
  summarizeMetadata,
395791
- uuid: uuid3 || randomUUID25(),
396655
+ uuid: uuid3 || randomUUID26(),
395792
396656
  timestamp: timestamp ?? new Date().toISOString(),
395793
396657
  toolUseResult,
395794
396658
  mcpMeta,
@@ -395857,7 +396721,7 @@ function createProgressMessage({
395857
396721
  data,
395858
396722
  toolUseID,
395859
396723
  parentToolUseID,
395860
- uuid: randomUUID25(),
396724
+ uuid: randomUUID26(),
395861
396725
  timestamp: new Date().toISOString()
395862
396726
  };
395863
396727
  }
@@ -398164,7 +399028,7 @@ function createSystemMessage(content, level, toolUseID, preventContinuation) {
398164
399028
  content,
398165
399029
  isMeta: false,
398166
399030
  timestamp: new Date().toISOString(),
398167
- uuid: randomUUID25(),
399031
+ uuid: randomUUID26(),
398168
399032
  toolUseID,
398169
399033
  level,
398170
399034
  ...preventContinuation && { preventContinuation }
@@ -398179,7 +399043,7 @@ function createPermissionRetryMessage(commands) {
398179
399043
  level: "info",
398180
399044
  isMeta: false,
398181
399045
  timestamp: new Date().toISOString(),
398182
- uuid: randomUUID25()
399046
+ uuid: randomUUID26()
398183
399047
  };
398184
399048
  }
398185
399049
  function createStopHookSummaryMessage(hookCount, hookInfos, hookErrors, preventedContinuation, stopReason, hasOutput, level, toolUseID, hookLabel, totalDurationMs) {
@@ -398194,7 +399058,7 @@ function createStopHookSummaryMessage(hookCount, hookInfos, hookErrors, prevente
398194
399058
  hasOutput,
398195
399059
  level,
398196
399060
  timestamp: new Date().toISOString(),
398197
- uuid: randomUUID25(),
399061
+ uuid: randomUUID26(),
398198
399062
  toolUseID,
398199
399063
  hookLabel,
398200
399064
  totalDurationMs
@@ -398210,7 +399074,7 @@ function createTurnDurationMessage(durationMs, budget, messageCount) {
398210
399074
  budgetNudges: budget?.nudges,
398211
399075
  messageCount,
398212
399076
  timestamp: new Date().toISOString(),
398213
- uuid: randomUUID25(),
399077
+ uuid: randomUUID26(),
398214
399078
  isMeta: false
398215
399079
  };
398216
399080
  }
@@ -398220,7 +399084,7 @@ function createMemorySavedMessage(writtenPaths) {
398220
399084
  subtype: "memory_saved",
398221
399085
  writtenPaths,
398222
399086
  timestamp: new Date().toISOString(),
398223
- uuid: randomUUID25(),
399087
+ uuid: randomUUID26(),
398224
399088
  isMeta: false
398225
399089
  };
398226
399090
  }
@@ -398229,7 +399093,7 @@ function createAgentsKilledMessage() {
398229
399093
  type: "system",
398230
399094
  subtype: "agents_killed",
398231
399095
  timestamp: new Date().toISOString(),
398232
- uuid: randomUUID25(),
399096
+ uuid: randomUUID26(),
398233
399097
  isMeta: false
398234
399098
  };
398235
399099
  }
@@ -398240,7 +399104,7 @@ function createCommandInputMessage(content) {
398240
399104
  content,
398241
399105
  level: "info",
398242
399106
  timestamp: new Date().toISOString(),
398243
- uuid: randomUUID25(),
399107
+ uuid: randomUUID26(),
398244
399108
  isMeta: false
398245
399109
  };
398246
399110
  }
@@ -398251,7 +399115,7 @@ function createCompactBoundaryMessage(trigger, preTokens, lastPreCompactMessageU
398251
399115
  content: `Conversation compacted`,
398252
399116
  isMeta: false,
398253
399117
  timestamp: new Date().toISOString(),
398254
- uuid: randomUUID25(),
399118
+ uuid: randomUUID26(),
398255
399119
  level: "info",
398256
399120
  compactMetadata: {
398257
399121
  trigger,
@@ -398275,7 +399139,7 @@ function createSystemAPIErrorMessage(error41, retryInMs, retryAttempt, maxRetrie
398275
399139
  retryAttempt,
398276
399140
  maxRetries,
398277
399141
  timestamp: new Date().toISOString(),
398278
- uuid: randomUUID25()
399142
+ uuid: randomUUID26()
398279
399143
  };
398280
399144
  }
398281
399145
  function isCompactBoundaryMessage(message) {
@@ -398544,7 +399408,7 @@ function createToolUseSummaryMessage(summary, precedingToolUseIds) {
398544
399408
  type: "tool_use_summary",
398545
399409
  summary,
398546
399410
  precedingToolUseIds,
398547
- uuid: randomUUID25(),
399411
+ uuid: randomUUID26(),
398548
399412
  timestamp: new Date().toISOString()
398549
399413
  };
398550
399414
  }
@@ -399166,9 +400030,9 @@ var init_hookHelpers = __esm(() => {
399166
400030
  });
399167
400031
 
399168
400032
  // src/utils/hooks/execPromptHook.ts
399169
- import { randomUUID as randomUUID26 } from "crypto";
400033
+ import { randomUUID as randomUUID27 } from "crypto";
399170
400034
  async function execPromptHook(hook, hookName, hookEvent, jsonInput, signal, toolUseContext, messages, toolUseID) {
399171
- const effectiveToolUseID = toolUseID || `hook-${randomUUID26()}`;
400035
+ const effectiveToolUseID = toolUseID || `hook-${randomUUID27()}`;
399172
400036
  try {
399173
400037
  const processedPrompt = addArgumentsToPrompt(hook.prompt, jsonInput);
399174
400038
  logForDebugging(`Hooks: Processing prompt hook with prompt: ${processedPrompt}`);
@@ -399322,9 +400186,9 @@ var init_execPromptHook = __esm(() => {
399322
400186
  });
399323
400187
 
399324
400188
  // src/utils/hooks/execAgentHook.ts
399325
- import { randomUUID as randomUUID27 } from "crypto";
400189
+ import { randomUUID as randomUUID28 } from "crypto";
399326
400190
  async function execAgentHook(hook, hookName, hookEvent, jsonInput, signal, toolUseContext, toolUseID, _messages, agentName) {
399327
- const effectiveToolUseID = toolUseID || `hook-${randomUUID27()}`;
400191
+ const effectiveToolUseID = toolUseID || `hook-${randomUUID28()}`;
399328
400192
  const transcriptPath = toolUseContext.agentId ? getAgentTranscriptPath(toolUseContext.agentId) : getTranscriptPath();
399329
400193
  const hookStartTime = Date.now();
399330
400194
  try {
@@ -399359,7 +400223,7 @@ When done, return your result using the ${SYNTHETIC_OUTPUT_TOOL_NAME} tool with:
399359
400223
  ]);
399360
400224
  const model = hook.model ?? getSmallFastModel();
399361
400225
  const MAX_AGENT_TURNS = 50;
399362
- const hookAgentId = asAgentId(`hook-agent-${randomUUID27()}`);
400226
+ const hookAgentId = asAgentId(`hook-agent-${randomUUID28()}`);
399363
400227
  const agentToolUseContext = {
399364
400228
  ...toolUseContext,
399365
400229
  agentId: hookAgentId,
@@ -399851,9 +400715,9 @@ __export(exports_hooks, {
399851
400715
  executeConfigChangeHooks: () => executeConfigChangeHooks,
399852
400716
  createBaseHookInput: () => createBaseHookInput
399853
400717
  });
399854
- import { basename as basename32 } from "path";
400718
+ import { basename as basename33 } from "path";
399855
400719
  import { spawn as spawn9 } from "child_process";
399856
- import { randomUUID as randomUUID28 } from "crypto";
400720
+ import { randomUUID as randomUUID29 } from "crypto";
399857
400721
  function getSessionEndHookTimeoutMs() {
399858
400722
  const raw = process.env.VIVUS_CODE_SESSIONEND_HOOKS_TIMEOUT_MS;
399859
400723
  const parsed = raw ? parseInt(raw, 10) : NaN;
@@ -400687,7 +401551,7 @@ async function getMatchingHooks(appState, sessionId, hookEvent, hookInput, tools
400687
401551
  matchQuery = hookInput.load_reason;
400688
401552
  break;
400689
401553
  case "FileChanged":
400690
- matchQuery = basename32(hookInput.file_path);
401554
+ matchQuery = basename33(hookInput.file_path);
400691
401555
  break;
400692
401556
  default:
400693
401557
  break;
@@ -400896,7 +401760,7 @@ async function* executeHooks({
400896
401760
  parentToolUseID: toolUseID,
400897
401761
  toolUseID,
400898
401762
  timestamp: new Date().toISOString(),
400899
- uuid: randomUUID28()
401763
+ uuid: randomUUID29()
400900
401764
  }
400901
401765
  };
400902
401766
  }
@@ -400958,7 +401822,7 @@ async function* executeHooks({
400958
401822
  const { signal: abortSignal, cleanup } = createCombinedAbortSignal(signal, {
400959
401823
  timeoutMs: commandTimeoutMs
400960
401824
  });
400961
- const hookId = randomUUID28();
401825
+ const hookId = randomUUID29();
400962
401826
  const hookStartMs = Date.now();
400963
401827
  const hookCommand = getHookDisplayText(hook);
400964
401828
  try {
@@ -401606,7 +402470,7 @@ async function executeHooksOutsideREPL({
401606
402470
  const callbackTimeoutMs = hook.timeout ? hook.timeout * 1000 : timeoutMs;
401607
402471
  const { signal: abortSignal2, cleanup: cleanup2 } = createCombinedAbortSignal(signal, { timeoutMs: callbackTimeoutMs });
401608
402472
  try {
401609
- const toolUseID = randomUUID28();
402473
+ const toolUseID = randomUUID29();
401610
402474
  const json2 = await hook.callback(hookInput, toolUseID, abortSignal2, hookIndex);
401611
402475
  cleanup2?.();
401612
402476
  if (isAsyncHookJSONOutput(json2)) {
@@ -401717,7 +402581,7 @@ async function executeHooksOutsideREPL({
401717
402581
  const commandTimeoutMs = hook.timeout ? hook.timeout * 1000 : timeoutMs;
401718
402582
  const { signal: abortSignal, cleanup } = createCombinedAbortSignal(signal, { timeoutMs: commandTimeoutMs });
401719
402583
  try {
401720
- const result = await execCommandHook(hook, hookEvent, hookName, jsonInput, abortSignal, randomUUID28(), hookIndex, pluginRoot, pluginId);
402584
+ const result = await execCommandHook(hook, hookEvent, hookName, jsonInput, abortSignal, randomUUID29(), hookIndex, pluginRoot, pluginId);
401721
402585
  cleanup?.();
401722
402586
  if (result.aborted) {
401723
402587
  logForDebugging(`${hookName} [${hook.command}] cancelled`);
@@ -401918,7 +402782,7 @@ async function* executeStopHooks(permissionMode, signal, timeoutMs = TOOL_HOOK_E
401918
402782
  };
401919
402783
  yield* executeHooks({
401920
402784
  hookInput,
401921
- toolUseID: randomUUID28(),
402785
+ toolUseID: randomUUID29(),
401922
402786
  signal,
401923
402787
  timeoutMs,
401924
402788
  toolUseContext,
@@ -401935,7 +402799,7 @@ async function* executeTeammateIdleHooks(teammateName, teamName, permissionMode,
401935
402799
  };
401936
402800
  yield* executeHooks({
401937
402801
  hookInput,
401938
- toolUseID: randomUUID28(),
402802
+ toolUseID: randomUUID29(),
401939
402803
  signal,
401940
402804
  timeoutMs
401941
402805
  });
@@ -401952,7 +402816,7 @@ async function* executeTaskCreatedHooks(taskId, taskSubject, taskDescription, te
401952
402816
  };
401953
402817
  yield* executeHooks({
401954
402818
  hookInput,
401955
- toolUseID: randomUUID28(),
402819
+ toolUseID: randomUUID29(),
401956
402820
  signal,
401957
402821
  timeoutMs,
401958
402822
  toolUseContext
@@ -401970,7 +402834,7 @@ async function* executeTaskCompletedHooks(taskId, taskSubject, taskDescription,
401970
402834
  };
401971
402835
  yield* executeHooks({
401972
402836
  hookInput,
401973
- toolUseID: randomUUID28(),
402837
+ toolUseID: randomUUID29(),
401974
402838
  signal,
401975
402839
  timeoutMs,
401976
402840
  toolUseContext
@@ -401989,7 +402853,7 @@ async function* executeUserPromptSubmitHooks(prompt, permissionMode, toolUseCont
401989
402853
  };
401990
402854
  yield* executeHooks({
401991
402855
  hookInput,
401992
- toolUseID: randomUUID28(),
402856
+ toolUseID: randomUUID29(),
401993
402857
  signal: toolUseContext.abortController.signal,
401994
402858
  timeoutMs: TOOL_HOOK_EXECUTION_TIMEOUT_MS,
401995
402859
  toolUseContext,
@@ -402006,7 +402870,7 @@ async function* executeSessionStartHooks(source, sessionId, agentType, model, si
402006
402870
  };
402007
402871
  yield* executeHooks({
402008
402872
  hookInput,
402009
- toolUseID: randomUUID28(),
402873
+ toolUseID: randomUUID29(),
402010
402874
  matchQuery: source,
402011
402875
  signal,
402012
402876
  timeoutMs,
@@ -402021,7 +402885,7 @@ async function* executeSetupHooks(trigger, signal, timeoutMs = TOOL_HOOK_EXECUTI
402021
402885
  };
402022
402886
  yield* executeHooks({
402023
402887
  hookInput,
402024
- toolUseID: randomUUID28(),
402888
+ toolUseID: randomUUID29(),
402025
402889
  matchQuery: trigger,
402026
402890
  signal,
402027
402891
  timeoutMs,
@@ -402037,7 +402901,7 @@ async function* executeSubagentStartHooks(agentId, agentType, signal, timeoutMs
402037
402901
  };
402038
402902
  yield* executeHooks({
402039
402903
  hookInput,
402040
- toolUseID: randomUUID28(),
402904
+ toolUseID: randomUUID29(),
402041
402905
  matchQuery: agentType,
402042
402906
  signal,
402043
402907
  timeoutMs
@@ -402400,7 +403264,7 @@ async function executeStatusLineCommand(statusLineInput, signal, timeoutMs = 500
402400
403264
  const abortSignal = signal || AbortSignal.timeout(timeoutMs);
402401
403265
  try {
402402
403266
  const jsonInput = jsonStringify(statusLineInput);
402403
- const result = await execCommandHook(statusLine, "StatusLine", "statusLine", jsonInput, abortSignal, randomUUID28());
403267
+ const result = await execCommandHook(statusLine, "StatusLine", "statusLine", jsonInput, abortSignal, randomUUID29());
402404
403268
  if (result.aborted) {
402405
403269
  return;
402406
403270
  }
@@ -402444,7 +403308,7 @@ async function executeFileSuggestionCommand(fileSuggestionInput, signal, timeout
402444
403308
  try {
402445
403309
  const jsonInput = jsonStringify(fileSuggestionInput);
402446
403310
  const hook = { type: "command", command: fileSuggestion.command };
402447
- const result = await execCommandHook(hook, "FileSuggestion", "FileSuggestion", jsonInput, abortSignal, randomUUID28());
403311
+ const result = await execCommandHook(hook, "FileSuggestion", "FileSuggestion", jsonInput, abortSignal, randomUUID29());
402448
403312
  if (result.aborted || result.status !== 0) {
402449
403313
  return [];
402450
403314
  }
@@ -402695,7 +403559,7 @@ import {
402695
403559
  symlink as symlink5,
402696
403560
  utimes as utimes2
402697
403561
  } from "fs/promises";
402698
- import { basename as basename33, dirname as dirname47, join as join107 } from "path";
403562
+ import { basename as basename34, dirname as dirname47, join as join107 } from "path";
402699
403563
  function validateWorktreeSlug(slug) {
402700
403564
  if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
402701
403565
  throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
@@ -402738,7 +403602,7 @@ function restoreWorktreeSession(session) {
402738
403602
  currentWorktreeSession = session;
402739
403603
  }
402740
403604
  function generateTmuxSessionName(repoPath, branch) {
402741
- const repoName = basename33(repoPath);
403605
+ const repoName = basename34(repoPath);
402742
403606
  const combined = `${repoName}_${branch}`;
402743
403607
  return combined.replace(/[/.]/g, "_");
402744
403608
  }
@@ -404241,7 +405105,7 @@ function insertBlockAfterToolResults(content, block2) {
404241
405105
  }
404242
405106
 
404243
405107
  // src/services/api/vivus.ts
404244
- import { randomUUID as randomUUID29 } from "crypto";
405108
+ import { randomUUID as randomUUID30 } from "crypto";
404245
405109
  function getExtraBodyParams(betaHeaders) {
404246
405110
  const extraBodyStr = process.env.VIVUS_CODE_EXTRA_BODY;
404247
405111
  let result = {};
@@ -405024,7 +405888,7 @@ ${deferredToolList}
405024
405888
  if (!options2.agentId) {
405025
405889
  headlessProfilerCheckpoint("api_request_sent");
405026
405890
  }
405027
- clientRequestId = getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl() ? randomUUID29() : undefined;
405891
+ clientRequestId = getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl() ? randomUUID30() : undefined;
405028
405892
  const result = await anthropic.beta.messages.create({ ...params, stream: true }, {
405029
405893
  signal,
405030
405894
  ...clientRequestId && {
@@ -405254,7 +406118,7 @@ ${deferredToolList}
405254
406118
  },
405255
406119
  requestId: streamRequestId ?? undefined,
405256
406120
  type: "assistant",
405257
- uuid: randomUUID29(),
406121
+ uuid: randomUUID30(),
405258
406122
  timestamp: new Date().toISOString(),
405259
406123
  ...process.env.USER_TYPE === "ant" && research !== undefined && { research },
405260
406124
  ...advisorModel && { advisorModel }
@@ -405434,7 +406298,7 @@ ${deferredToolList}
405434
406298
  },
405435
406299
  requestId: streamRequestId ?? undefined,
405436
406300
  type: "assistant",
405437
- uuid: randomUUID29(),
406301
+ uuid: randomUUID30(),
405438
406302
  timestamp: new Date().toISOString(),
405439
406303
  ...process.env.USER_TYPE === "ant" && research !== undefined && {
405440
406304
  research
@@ -405488,7 +406352,7 @@ ${deferredToolList}
405488
406352
  },
405489
406353
  requestId: streamRequestId ?? undefined,
405490
406354
  type: "assistant",
405491
- uuid: randomUUID29(),
406355
+ uuid: randomUUID30(),
405492
406356
  timestamp: new Date().toISOString(),
405493
406357
  ...process.env.USER_TYPE === "ant" && research !== undefined && { research },
405494
406358
  ...advisorModel && { advisorModel }
@@ -408613,7 +409477,7 @@ var init_filesystem = __esm(() => {
408613
409477
  });
408614
409478
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
408615
409479
  const nonce = randomBytes17(16).toString("hex");
408616
- return join108(getVivusTempDir(), "bundled-skills", "1.1.36+7725484", nonce);
409480
+ return join108(getVivusTempDir(), "bundled-skills", "1.1.37+d527bcf", nonce);
408617
409481
  });
408618
409482
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
408619
409483
  });
@@ -408687,7 +409551,7 @@ var init_validation3 = __esm(() => {
408687
409551
  });
408688
409552
 
408689
409553
  // src/utils/suggestions/directoryCompletion.ts
408690
- import { basename as basename34, dirname as dirname49, join as join109, sep as sep26 } from "path";
409554
+ import { basename as basename35, dirname as dirname49, join as join109, sep as sep26 } from "path";
408691
409555
  function parsePartialPath(partialPath, basePath) {
408692
409556
  if (!partialPath) {
408693
409557
  const directory2 = basePath || getCwd();
@@ -408698,7 +409562,7 @@ function parsePartialPath(partialPath, basePath) {
408698
409562
  return { directory: resolved, prefix: "" };
408699
409563
  }
408700
409564
  const directory = dirname49(resolved);
408701
- const prefix = basename34(partialPath);
409565
+ const prefix = basename35(partialPath);
408702
409566
  return { directory, prefix };
408703
409567
  }
408704
409568
  async function scanDirectory(dirPath) {
@@ -409745,7 +410609,7 @@ function ScrollBox({
409745
410609
  const [, forceRender] = import_react93.useState(0);
409746
410610
  const listenersRef = import_react93.useRef(new Set);
409747
410611
  const renderQueuedRef = import_react93.useRef(false);
409748
- const notify2 = () => {
410612
+ const notify3 = () => {
409749
410613
  for (const l of listenersRef.current)
409750
410614
  l();
409751
410615
  };
@@ -409753,7 +410617,7 @@ function ScrollBox({
409753
410617
  markScrollActivity();
409754
410618
  markDirty(el);
409755
410619
  markCommitStart();
409756
- notify2();
410620
+ notify3();
409757
410621
  if (renderQueuedRef.current)
409758
410622
  return;
409759
410623
  renderQueuedRef.current = true;
@@ -409801,7 +410665,7 @@ function ScrollBox({
409801
410665
  el.pendingScrollDelta = undefined;
409802
410666
  el.stickyScroll = true;
409803
410667
  markDirty(el);
409804
- notify2();
410668
+ notify3();
409805
410669
  forceRender((n2) => n2 + 1);
409806
410670
  },
409807
410671
  getScrollTop() {
@@ -410373,7 +411237,7 @@ function Feedback({
410373
411237
  platform: env3.platform,
410374
411238
  gitRepo: envInfo.isGit,
410375
411239
  terminal: env3.terminal,
410376
- version: "1.1.36+7725484",
411240
+ version: "1.1.37+d527bcf",
410377
411241
  transcript: normalizeMessagesForAPI(messages),
410378
411242
  errors: sanitizedErrors,
410379
411243
  lastApiRequest: getLastAPIRequest(),
@@ -410565,7 +411429,7 @@ function Feedback({
410565
411429
  ", ",
410566
411430
  env3.terminal,
410567
411431
  ", v",
410568
- "1.1.36+7725484"
411432
+ "1.1.37+d527bcf"
410569
411433
  ]
410570
411434
  }, undefined, true, undefined, this)
410571
411435
  ]
@@ -410671,7 +411535,7 @@ ${sanitizedDescription}
410671
411535
  ` + `**Environment Info**
410672
411536
  ` + `- Platform: ${env3.platform}
410673
411537
  ` + `- Terminal: ${env3.terminal}
410674
- ` + `- Version: ${"1.1.36+7725484"}
411538
+ ` + `- Version: ${"1.1.37+d527bcf"}
410675
411539
  ` + `- Feedback ID: ${feedbackId}
410676
411540
  ` + `
410677
411541
  **Errors**
@@ -411891,7 +412755,7 @@ var exports_conversation = {};
411891
412755
  __export(exports_conversation, {
411892
412756
  clearConversation: () => clearConversation
411893
412757
  });
411894
- import { randomUUID as randomUUID30 } from "crypto";
412758
+ import { randomUUID as randomUUID31 } from "crypto";
411895
412759
  async function clearConversation({
411896
412760
  setMessages,
411897
412761
  readFileState,
@@ -411933,7 +412797,7 @@ async function clearConversation({
411933
412797
  setMessages(() => []);
411934
412798
  if (false) {}
411935
412799
  if (setConversationId) {
411936
- setConversationId(randomUUID30());
412800
+ setConversationId(randomUUID31());
411937
412801
  }
411938
412802
  clearSessionCaches(preservedAgentIds);
411939
412803
  setCwd(getOriginalCwd());
@@ -413803,7 +414667,7 @@ function buildPrimarySection() {
413803
414667
  }, undefined, false, undefined, this);
413804
414668
  return [{
413805
414669
  label: "Version",
413806
- value: "1.1.36+7725484"
414670
+ value: "1.1.37+d527bcf"
413807
414671
  }, {
413808
414672
  label: "Session name",
413809
414673
  value: nameValue
@@ -417585,7 +418449,7 @@ function Config({
417585
418449
  }
417586
418450
  }, undefined, false, undefined, this)
417587
418451
  }, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_dev_runtime178.jsxDEV(ChannelDowngradeDialog, {
417588
- currentVersion: "1.1.36+7725484",
418452
+ currentVersion: "1.1.37+d527bcf",
417589
418453
  onChoice: (choice) => {
417590
418454
  setShowSubmenu(null);
417591
418455
  setTabsHidden(false);
@@ -417597,7 +418461,7 @@ function Config({
417597
418461
  autoUpdatesChannel: "stable"
417598
418462
  };
417599
418463
  if (choice === "stay") {
417600
- newSettings.minimumVersion = "1.1.36+7725484";
418464
+ newSettings.minimumVersion = "1.1.37+d527bcf";
417601
418465
  }
417602
418466
  updateSettingsForSource("userSettings", newSettings);
417603
418467
  setSettingsData((prev_27) => ({
@@ -419116,7 +419980,82 @@ var init_ContextSuggestions = __esm(() => {
419116
419980
  // src/components/ContextVisualization.tsx
419117
419981
  function CollapseStatus() {
419118
419982
  const $2 = import_compiler_runtime147.c(2);
419119
- if (false) {}
419983
+ if (true) {
419984
+ let t0;
419985
+ let t1;
419986
+ if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
419987
+ t1 = Symbol.for("react.early_return_sentinel");
419988
+ bb0: {
419989
+ const {
419990
+ getStats: getStats2,
419991
+ isContextCollapseEnabled: isContextCollapseEnabled2
419992
+ } = (init_contextCollapse(), __toCommonJS(exports_contextCollapse));
419993
+ if (!isContextCollapseEnabled2()) {
419994
+ t1 = null;
419995
+ break bb0;
419996
+ }
419997
+ const s = getStats2();
419998
+ const {
419999
+ health: h2
420000
+ } = s;
420001
+ const parts = [];
420002
+ if (s.collapsedSpans > 0) {
420003
+ parts.push(`${s.collapsedSpans} ${plural(s.collapsedSpans, "span")} summarized (${s.collapsedMessages} msgs)`);
420004
+ }
420005
+ if (s.stagedSpans > 0) {
420006
+ parts.push(`${s.stagedSpans} staged`);
420007
+ }
420008
+ const summary = parts.length > 0 ? parts.join(", ") : h2.totalSpawns > 0 ? `${h2.totalSpawns} ${plural(h2.totalSpawns, "spawn")}, nothing staged yet` : "waiting for first trigger";
420009
+ let line2 = null;
420010
+ if (h2.totalErrors > 0) {
420011
+ line2 = /* @__PURE__ */ jsx_dev_runtime185.jsxDEV(ThemedText, {
420012
+ color: "warning",
420013
+ children: [
420014
+ "Collapse errors: ",
420015
+ h2.totalErrors,
420016
+ "/",
420017
+ h2.totalSpawns,
420018
+ " spawns failed",
420019
+ h2.lastError ? ` (last: ${h2.lastError.slice(0, 60)})` : ""
420020
+ ]
420021
+ }, undefined, true, undefined, this);
420022
+ } else {
420023
+ if (h2.emptySpawnWarningEmitted) {
420024
+ line2 = /* @__PURE__ */ jsx_dev_runtime185.jsxDEV(ThemedText, {
420025
+ color: "warning",
420026
+ children: [
420027
+ "Collapse idle: ",
420028
+ h2.totalEmptySpawns,
420029
+ " consecutive empty runs"
420030
+ ]
420031
+ }, undefined, true, undefined, this);
420032
+ }
420033
+ }
420034
+ t0 = /* @__PURE__ */ jsx_dev_runtime185.jsxDEV(jsx_dev_runtime185.Fragment, {
420035
+ children: [
420036
+ /* @__PURE__ */ jsx_dev_runtime185.jsxDEV(ThemedText, {
420037
+ dimColor: true,
420038
+ children: [
420039
+ "Context strategy: collapse (",
420040
+ summary,
420041
+ ")"
420042
+ ]
420043
+ }, undefined, true, undefined, this),
420044
+ line2
420045
+ ]
420046
+ }, undefined, true, undefined, this);
420047
+ }
420048
+ $2[0] = t0;
420049
+ $2[1] = t1;
420050
+ } else {
420051
+ t0 = $2[0];
420052
+ t1 = $2[1];
420053
+ }
420054
+ if (t1 !== Symbol.for("react.early_return_sentinel")) {
420055
+ return t1;
420056
+ }
420057
+ return t0;
420058
+ }
419120
420059
  return null;
419121
420060
  }
419122
420061
  function groupBySource(items) {
@@ -419958,7 +420897,12 @@ __export(exports_context, {
419958
420897
  });
419959
420898
  function toApiView(messages) {
419960
420899
  let view = getMessagesAfterCompactBoundary(messages);
419961
- if (false) {}
420900
+ if (true) {
420901
+ const {
420902
+ projectView: projectView2
420903
+ } = (init_operations(), __toCommonJS(exports_operations));
420904
+ view = projectView2(view);
420905
+ }
419962
420906
  return view;
419963
420907
  }
419964
420908
  async function call15(onDone, context) {
@@ -420012,7 +420956,10 @@ async function collectContextData(context) {
420012
420956
  }
420013
420957
  } = context;
420014
420958
  let apiView = getMessagesAfterCompactBoundary(messages);
420015
- if (false) {}
420959
+ if (true) {
420960
+ const { projectView: projectView2 } = (init_operations(), __toCommonJS(exports_operations));
420961
+ apiView = projectView2(apiView);
420962
+ }
420016
420963
  const { messages: compactedMessages } = await microcompactMessages(apiView);
420017
420964
  const appState = getAppState();
420018
420965
  return analyzeContextUsage(compactedMessages, mainLoopModel, async () => appState.toolPermissionContext, tools, agentDefinitions, undefined, { options: { customSystemPrompt, appendSystemPrompt } }, undefined, apiView);
@@ -420046,7 +420993,33 @@ function formatContextAsMarkdownTable(data) {
420046
420993
  `;
420047
420994
  output += `**Tokens:** ${formatTokens(totalTokens)} / ${formatTokens(rawMaxTokens)} (${percentage}%)
420048
420995
  `;
420049
- if (false) {}
420996
+ if (true) {
420997
+ const { getStats: getStats2, isContextCollapseEnabled: isContextCollapseEnabled2 } = (init_contextCollapse(), __toCommonJS(exports_contextCollapse));
420998
+ if (isContextCollapseEnabled2()) {
420999
+ const s = getStats2();
421000
+ const { health: h2 } = s;
421001
+ const parts = [];
421002
+ if (s.collapsedSpans > 0) {
421003
+ parts.push(`${s.collapsedSpans} ${plural(s.collapsedSpans, "span")} summarized (${s.collapsedMessages} messages)`);
421004
+ }
421005
+ if (s.stagedSpans > 0)
421006
+ parts.push(`${s.stagedSpans} staged`);
421007
+ const summary = parts.length > 0 ? parts.join(", ") : h2.totalSpawns > 0 ? `${h2.totalSpawns} ${plural(h2.totalSpawns, "spawn")}, nothing staged yet` : "waiting for first trigger";
421008
+ output += `**Context strategy:** collapse (${summary})
421009
+ `;
421010
+ if (h2.totalErrors > 0) {
421011
+ output += `**Collapse errors:** ${h2.totalErrors}/${h2.totalSpawns} spawns failed`;
421012
+ if (h2.lastError) {
421013
+ output += ` (last: ${h2.lastError.slice(0, 80)})`;
421014
+ }
421015
+ output += `
421016
+ `;
421017
+ } else if (h2.emptySpawnWarningEmitted) {
421018
+ output += `**Collapse idle:** ${h2.totalEmptySpawns} consecutive empty runs
421019
+ `;
421020
+ }
421021
+ }
421022
+ }
420050
421023
  output += `
420051
421024
  `;
420052
421025
  const visibleCategories = categories.filter((cat2) => cat2.tokens > 0 && cat2.name !== "Free space" && cat2.name !== "Autocompact buffer");
@@ -424519,12 +425492,12 @@ import {
424519
425492
  spawn as spawn10,
424520
425493
  spawnSync as spawnSync4
424521
425494
  } from "child_process";
424522
- import { basename as basename35 } from "path";
425495
+ import { basename as basename36 } from "path";
424523
425496
  function isCommandAvailable3(command3) {
424524
425497
  return !!whichSync(command3);
424525
425498
  }
424526
425499
  function classifyGuiEditor(editor) {
424527
- const base2 = basename35(editor.split(" ")[0] ?? "");
425500
+ const base2 = basename36(editor.split(" ")[0] ?? "");
424528
425501
  return GUI_EDITORS.find((g) => base2.includes(g));
424529
425502
  }
424530
425503
  function guiGotoArgv(guiFamily, filePath, line) {
@@ -424561,7 +425534,7 @@ function openFileInExternalEditor(filePath, line) {
424561
425534
  const inkInstance = instances_default.get(process.stdout);
424562
425535
  if (!inkInstance)
424563
425536
  return false;
424564
- const useGotoLine = line && PLUS_N_EDITORS.test(basename35(base2));
425537
+ const useGotoLine = line && PLUS_N_EDITORS.test(basename36(base2));
424565
425538
  inkInstance.enterAlternateScreen();
424566
425539
  try {
424567
425540
  const syncOpts = { stdio: "inherit" };
@@ -425683,7 +426656,7 @@ function HelpV2(t0) {
425683
426656
  let t6;
425684
426657
  if ($2[31] !== tabs) {
425685
426658
  t6 = /* @__PURE__ */ jsx_dev_runtime205.jsxDEV(Tabs, {
425686
- title: `Vivus v${"1.1.36+7725484"}`,
426659
+ title: `Vivus v${"1.1.37+d527bcf"}`,
425687
426660
  color: "professionalBlue",
425688
426661
  defaultTab: "general",
425689
426662
  children: tabs
@@ -431747,7 +432720,7 @@ var init_channelPermissions = __esm(() => {
431747
432720
  });
431748
432721
 
431749
432722
  // src/services/mcp/useManageMCPConnections.ts
431750
- import { basename as basename36 } from "path";
432723
+ import { basename as basename37 } from "path";
431751
432724
  function getErrorKey(error41) {
431752
432725
  const plugin = "plugin" in error41 ? error41.plugin : "no-plugin";
431753
432726
  return `${error41.type}:${error41.source}:${plugin}`;
@@ -432124,7 +433097,7 @@ function useManageMCPConnections(dynamicMcpConfig, isStrictMcpConfig = false) {
432124
433097
  else if (serverConfig.scope === "vivus")
432125
433098
  counts.vivusai++;
432126
433099
  if (process.env.USER_TYPE === "ant" && !isMcpServerDisabled(name) && (serverConfig.type === undefined || serverConfig.type === "stdio") && "command" in serverConfig) {
432127
- stdioCommands.push(basename36(serverConfig.command));
433100
+ stdioCommands.push(basename37(serverConfig.command));
432128
433101
  }
432129
433102
  }
432130
433103
  logEvent("tengu_mcp_servers", {
@@ -449909,7 +450882,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
449909
450882
  return [];
449910
450883
  }
449911
450884
  }
449912
- async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.1.36+7725484") {
450885
+ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.1.37+d527bcf") {
449913
450886
  if (process.env.USER_TYPE === "ant") {
449914
450887
  const changelog = "";
449915
450888
  if (changelog) {
@@ -449936,7 +450909,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.1.36+77
449936
450909
  releaseNotes
449937
450910
  };
449938
450911
  }
449939
- function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.1.36+7725484") {
450912
+ function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.1.37+d527bcf") {
449940
450913
  if (process.env.USER_TYPE === "ant") {
449941
450914
  const changelog = "";
449942
450915
  if (changelog) {
@@ -451106,7 +452079,7 @@ function getRecentActivitySync() {
451106
452079
  return cachedActivity;
451107
452080
  }
451108
452081
  function getLogoDisplayData() {
451109
- const version2 = process.env.DEMO_VERSION ?? "1.1.36+7725484";
452082
+ const version2 = process.env.DEMO_VERSION ?? "1.1.37+d527bcf";
451110
452083
  const serverUrl = getDirectConnectServerUrl();
451111
452084
  const displayPath = process.env.DEMO_VERSION ? "/code/vivus" : getDisplayPath(getCwd());
451112
452085
  const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
@@ -452633,7 +453606,7 @@ function LogoV2() {
452633
453606
  if ($2[2] === Symbol.for("react.memo_cache_sentinel")) {
452634
453607
  t2 = () => {
452635
453608
  const currentConfig = getGlobalConfig();
452636
- if (currentConfig.lastReleaseNotesSeen === "1.1.36+7725484") {
453609
+ if (currentConfig.lastReleaseNotesSeen === "1.1.37+d527bcf") {
452637
453610
  return;
452638
453611
  }
452639
453612
  saveGlobalConfig(_temp329);
@@ -453309,12 +454282,12 @@ function LogoV2() {
453309
454282
  return t41;
453310
454283
  }
453311
454284
  function _temp329(current) {
453312
- if (current.lastReleaseNotesSeen === "1.1.36+7725484") {
454285
+ if (current.lastReleaseNotesSeen === "1.1.37+d527bcf") {
453313
454286
  return current;
453314
454287
  }
453315
454288
  return {
453316
454289
  ...current,
453317
- lastReleaseNotesSeen: "1.1.36+7725484"
454290
+ lastReleaseNotesSeen: "1.1.37+d527bcf"
453318
454291
  };
453319
454292
  }
453320
454293
  function _temp245(s_0) {
@@ -454246,8 +455219,8 @@ function useVirtualScroll(scrollRef, itemKeys, columns) {
454246
455219
  const frozenRange = freezeRendersRef.current > 0 ? prevRangeRef.current : null;
454247
455220
  const listOriginRef = import_react152.useRef(0);
454248
455221
  const spacerRef = import_react152.useRef(null);
454249
- const subscribe3 = import_react152.useCallback((listener2) => scrollRef.current?.subscribe(listener2) ?? NOOP_UNSUB, [scrollRef]);
454250
- import_react152.useSyncExternalStore(subscribe3, () => {
455222
+ const subscribe5 = import_react152.useCallback((listener2) => scrollRef.current?.subscribe(listener2) ?? NOOP_UNSUB, [scrollRef]);
455223
+ import_react152.useSyncExternalStore(subscribe5, () => {
454251
455224
  const s = scrollRef.current;
454252
455225
  if (!s)
454253
455226
  return NaN;
@@ -454725,7 +455698,7 @@ function FullscreenLayout(t0) {
454725
455698
  } else {
454726
455699
  t5 = $2[2];
454727
455700
  }
454728
- const subscribe3 = t5;
455701
+ const subscribe5 = t5;
454729
455702
  let t6;
454730
455703
  if ($2[3] !== dividerYRef || $2[4] !== scrollRef) {
454731
455704
  t6 = () => {
@@ -454742,7 +455715,7 @@ function FullscreenLayout(t0) {
454742
455715
  } else {
454743
455716
  t6 = $2[5];
454744
455717
  }
454745
- const pillVisible = import_react154.useSyncExternalStore(subscribe3, t6);
455718
+ const pillVisible = import_react154.useSyncExternalStore(subscribe5, t6);
454746
455719
  let t7;
454747
455720
  if ($2[6] === Symbol.for("react.memo_cache_sentinel")) {
454748
455721
  t7 = [];
@@ -455816,8 +456789,8 @@ function StickyTracker({
455816
456789
  const {
455817
456790
  setStickyPrompt
455818
456791
  } = import_react155.useContext(ScrollChromeContext);
455819
- const subscribe3 = import_react155.useCallback((listener2) => scrollRef.current?.subscribe(listener2) ?? NOOP_UNSUB2, [scrollRef]);
455820
- import_react155.useSyncExternalStore(subscribe3, () => {
456792
+ const subscribe5 = import_react155.useCallback((listener2) => scrollRef.current?.subscribe(listener2) ?? NOOP_UNSUB2, [scrollRef]);
456793
+ import_react155.useSyncExternalStore(subscribe5, () => {
455821
456794
  const s = scrollRef.current;
455822
456795
  if (!s)
455823
456796
  return NaN;
@@ -463292,7 +464265,7 @@ var init_InProcessTeammateDetailDialog = __esm(() => {
463292
464265
  });
463293
464266
 
463294
464267
  // src/utils/messages/mappers.ts
463295
- import { randomUUID as randomUUID31 } from "crypto";
464268
+ import { randomUUID as randomUUID32 } from "crypto";
463296
464269
  function toInternalMessages(messages) {
463297
464270
  return messages.flatMap((message) => {
463298
464271
  switch (message.type) {
@@ -463311,7 +464284,7 @@ function toInternalMessages(messages) {
463311
464284
  {
463312
464285
  type: "user",
463313
464286
  message: message.message,
463314
- uuid: message.uuid ?? randomUUID31(),
464287
+ uuid: message.uuid ?? randomUUID32(),
463315
464288
  timestamp: message.timestamp ?? new Date().toISOString(),
463316
464289
  isMeta: message.isSynthetic
463317
464290
  }
@@ -473107,7 +474080,7 @@ __export(exports_branch, {
473107
474080
  deriveFirstPrompt: () => deriveFirstPrompt,
473108
474081
  call: () => call49
473109
474082
  });
473110
- import { randomUUID as randomUUID32 } from "crypto";
474083
+ import { randomUUID as randomUUID33 } from "crypto";
473111
474084
  import { mkdir as mkdir35, readFile as readFile43, writeFile as writeFile37 } from "fs/promises";
473112
474085
  function deriveFirstPrompt(firstUserMessage) {
473113
474086
  const content = firstUserMessage?.message?.content;
@@ -473119,7 +474092,7 @@ function deriveFirstPrompt(firstUserMessage) {
473119
474092
  return raw.replace(/\s+/g, " ").trim().slice(0, 100) || "Branched conversation";
473120
474093
  }
473121
474094
  async function createFork(customTitle) {
473122
- const forkSessionId = randomUUID32();
474095
+ const forkSessionId = randomUUID33();
473123
474096
  const originalSessionId = getSessionId();
473124
474097
  const projectDir = getProjectDir2(getOriginalCwd());
473125
474098
  const forkSessionPath = getTranscriptPathForSession(forkSessionId);
@@ -479616,7 +480589,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
479616
480589
  smapsRollup,
479617
480590
  platform: process.platform,
479618
480591
  nodeVersion: process.version,
479619
- ccVersion: "1.1.36+7725484"
480592
+ ccVersion: "1.1.37+d527bcf"
479620
480593
  };
479621
480594
  }
479622
480595
  async function performHeapDump(trigger = "manual", dumpNumber = 0) {
@@ -480202,7 +481175,7 @@ var init_bridge_kick = __esm(() => {
480202
481175
  var call56 = async () => {
480203
481176
  return {
480204
481177
  type: "text",
480205
- value: `${"1.1.36+7725484"} (built ${"2026-08-06T08:10:40.644Z"})`
481178
+ value: `${"1.1.37+d527bcf"} (built ${"2026-08-06T11:53:22.560Z"})`
480206
481179
  };
480207
481180
  }, version2, version_default;
480208
481181
  var init_version = __esm(() => {
@@ -485963,7 +486936,7 @@ var init_screenshotClipboard = __esm(() => {
485963
486936
 
485964
486937
  // src/utils/stats.ts
485965
486938
  import { open as open16 } from "fs/promises";
485966
- import { basename as basename39, join as join134, sep as sep31 } from "path";
486939
+ import { basename as basename40, join as join134, sep as sep31 } from "path";
485967
486940
  async function processSessionFiles(sessionFiles, options2 = {}) {
485968
486941
  const { fromDate, toDate } = options2;
485969
486942
  const fs10 = getFsImplementation();
@@ -486021,7 +486994,7 @@ async function processSessionFiles(sessionFiles, options2 = {}) {
486021
486994
  logForDebugging(`Failed to read session file ${sessionFile}: ${errorMessage(error41)}`);
486022
486995
  continue;
486023
486996
  }
486024
- const sessionId = basename39(sessionFile, ".jsonl");
486997
+ const sessionId = basename40(sessionFile, ".jsonl");
486025
486998
  const messages = [];
486026
486999
  for (const entry of entries) {
486027
487000
  if (isTranscriptMessage(entry)) {
@@ -489485,7 +490458,7 @@ function generateHtmlReport(data, insights) {
489485
490458
  </html>`;
489486
490459
  }
489487
490460
  function buildExportData(data, insights, facets, remoteStats) {
489488
- const version3 = typeof MACRO !== "undefined" ? "1.1.36+7725484" : "unknown";
490461
+ const version3 = typeof MACRO !== "undefined" ? "1.1.37+d527bcf" : "unknown";
489489
490462
  const remote_hosts_collected = remoteStats?.hosts.filter((h2) => h2.sessionCount > 0).map((h2) => h2.name);
489490
490463
  const facets_summary = {
489491
490464
  total: facets.size,
@@ -490773,7 +491746,7 @@ import {
490773
491746
  unlink as unlink22,
490774
491747
  writeFile as writeFile42
490775
491748
  } from "fs/promises";
490776
- import { basename as basename40, dirname as dirname57, join as join136 } from "path";
491749
+ import { basename as basename41, dirname as dirname57, join as join136 } from "path";
490777
491750
  function isTranscriptMessage(entry) {
490778
491751
  return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
490779
491752
  }
@@ -493207,7 +494180,7 @@ async function getSessionFilesWithMtime(projectDir) {
493207
494180
  for (const dirent of dirents) {
493208
494181
  if (!dirent.isFile() || !dirent.name.endsWith(".jsonl"))
493209
494182
  continue;
493210
- const sessionId = validateUuid2(basename40(dirent.name, ".jsonl"));
494183
+ const sessionId = validateUuid2(basename41(dirent.name, ".jsonl"));
493211
494184
  if (!sessionId)
493212
494185
  continue;
493213
494186
  candidates.push({ sessionId, filePath: join136(projectDir, dirent.name) });
@@ -493596,7 +494569,7 @@ var init_sessionStorage = __esm(() => {
493596
494569
  init_settings2();
493597
494570
  init_slowOperations();
493598
494571
  init_uuid();
493599
- VERSION5 = typeof MACRO !== "undefined" ? "1.1.36+7725484" : "unknown";
494572
+ VERSION5 = typeof MACRO !== "undefined" ? "1.1.37+d527bcf" : "unknown";
493600
494573
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
493601
494574
  SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
493602
494575
  EPHEMERAL_PROGRESS_TYPES = new Set([
@@ -493848,7 +494821,7 @@ var init_memdir = __esm(() => {
493848
494821
 
493849
494822
  // src/utils/vivusmd.ts
493850
494823
  import {
493851
- basename as basename41,
494824
+ basename as basename42,
493852
494825
  dirname as dirname58,
493853
494826
  extname as extname13,
493854
494827
  isAbsolute as isAbsolute25,
@@ -496446,7 +497419,7 @@ var init_inboundMessages = __esm(() => {
496446
497419
  });
496447
497420
 
496448
497421
  // src/utils/messages/systemInit.ts
496449
- import { randomUUID as randomUUID33 } from "crypto";
497422
+ import { randomUUID as randomUUID34 } from "crypto";
496450
497423
  function sdkCompatToolName(name) {
496451
497424
  return name === AGENT_TOOL_NAME ? LEGACY_AGENT_TOOL_NAME : name;
496452
497425
  }
@@ -496468,7 +497441,7 @@ function buildSystemInitMessage(inputs) {
496468
497441
  slash_commands: inputs.commands.filter((c4) => c4.userInvocable !== false).map((c4) => c4.name),
496469
497442
  apiKeySource: getAnthropicApiKeyWithSource().source,
496470
497443
  betas: getSdkBetas(),
496471
- vivus_code_version: "1.1.36+7725484",
497444
+ vivus_code_version: "1.1.37+d527bcf",
496472
497445
  output_style: outputStyle2,
496473
497446
  agents: inputs.agents.map((agent) => agent.agentType),
496474
497447
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -496477,7 +497450,7 @@ function buildSystemInitMessage(inputs) {
496477
497450
  path: plugin2.path,
496478
497451
  source: plugin2.source
496479
497452
  })),
496480
- uuid: randomUUID33()
497453
+ uuid: randomUUID34()
496481
497454
  };
496482
497455
  if (false) {}
496483
497456
  initMessage.fast_mode_state = getFastModeState(inputs.model, inputs.fastMode);
@@ -496561,7 +497534,7 @@ __export(exports_MessageSelector, {
496561
497534
  messagesAfterAreOnlySynthetic: () => messagesAfterAreOnlySynthetic,
496562
497535
  MessageSelector: () => MessageSelector
496563
497536
  });
496564
- import { randomUUID as randomUUID34 } from "crypto";
497537
+ import { randomUUID as randomUUID35 } from "crypto";
496565
497538
  import * as path23 from "path";
496566
497539
  function isTextBlock2(block2) {
496567
497540
  return block2.type === "text";
@@ -496581,7 +497554,7 @@ function MessageSelector({
496581
497554
  const fileHistory = useAppState((s) => s.fileHistory);
496582
497555
  const [error41, setError] = import_react200.useState(undefined);
496583
497556
  const isFileHistoryEnabled = fileHistoryEnabled();
496584
- const currentUUID = import_react200.useMemo(randomUUID34, []);
497557
+ const currentUUID = import_react200.useMemo(randomUUID35, []);
496585
497558
  const messageOptions = import_react200.useMemo(() => [...messages.filter(selectableUserMessagesFilter), {
496586
497559
  ...createUserMessage({
496587
497560
  content: ""
@@ -502454,8 +503427,8 @@ var init_FileEditToolDiff = __esm(() => {
502454
503427
  });
502455
503428
 
502456
503429
  // src/hooks/useDiffInIDE.ts
502457
- import { randomUUID as randomUUID35 } from "crypto";
502458
- import { basename as basename43 } from "path";
503430
+ import { randomUUID as randomUUID36 } from "crypto";
503431
+ import { basename as basename44 } from "path";
502459
503432
  function useDiffInIDE({
502460
503433
  onChange,
502461
503434
  toolUseContext,
@@ -502465,8 +503438,8 @@ function useDiffInIDE({
502465
503438
  }) {
502466
503439
  const isUnmounted = import_react211.useRef(false);
502467
503440
  const [hasError, setHasError] = import_react211.useState(false);
502468
- const sha = import_react211.useMemo(() => randomUUID35().slice(0, 6), []);
502469
- const tabName = import_react211.useMemo(() => `✻ [Vivus] ${basename43(filePath)} (${sha}) ⧉`, [filePath, sha]);
503441
+ const sha = import_react211.useMemo(() => randomUUID36().slice(0, 6), []);
503442
+ const tabName = import_react211.useMemo(() => `✻ [Vivus] ${basename44(filePath)} (${sha}) ⧉`, [filePath, sha]);
502470
503443
  const shouldShowDiffInIDE = hasAccessToIDEExtensionDiffFeature(toolUseContext.options.mcpClients) && getGlobalConfig().diffTool === "auto" && !filePath.endsWith(".ipynb");
502471
503444
  const ideName = getConnectedIdeName(toolUseContext.options.mcpClients) ?? "IDE";
502472
503445
  async function showDiff() {
@@ -502648,7 +503621,7 @@ var init_useDiffInIDE = __esm(() => {
502648
503621
  });
502649
503622
 
502650
503623
  // src/components/ShowInIDEPrompt.tsx
502651
- import { basename as basename44, relative as relative27 } from "path";
503624
+ import { basename as basename45, relative as relative27 } from "path";
502652
503625
  function ShowInIDEPrompt(t0) {
502653
503626
  const $2 = import_compiler_runtime297.c(36);
502654
503627
  const {
@@ -502705,7 +503678,7 @@ function ShowInIDEPrompt(t0) {
502705
503678
  }
502706
503679
  let t4;
502707
503680
  if ($2[5] !== filePath) {
502708
- t4 = basename44(filePath);
503681
+ t4 = basename45(filePath);
502709
503682
  $2[5] = filePath;
502710
503683
  $2[6] = t4;
502711
503684
  } else {
@@ -502866,7 +503839,7 @@ var init_ShowInIDEPrompt = __esm(() => {
502866
503839
 
502867
503840
  // src/components/permissions/FilePermissionDialog/permissionOptions.tsx
502868
503841
  import { homedir as homedir35 } from "os";
502869
- import { basename as basename45, join as join139, sep as sep33 } from "path";
503842
+ import { basename as basename46, join as join139, sep as sep33 } from "path";
502870
503843
  function isInVivusFolder(filePath) {
502871
503844
  const absolutePath = expandPath(filePath);
502872
503845
  const vivusFolderPath = expandPath(`${getOriginalCwd()}/.vivus`);
@@ -502948,7 +503921,7 @@ function getFilePermissionOptions({
502948
503921
  }
502949
503922
  } else {
502950
503923
  const dirPath = getDirectoryForPath(filePath);
502951
- const dirName = basename45(dirPath) || "this directory";
503924
+ const dirName = basename46(dirPath) || "this directory";
502952
503925
  if (operationType === "read") {
502953
503926
  sessionLabel = /* @__PURE__ */ jsx_dev_runtime383.jsxDEV(ThemedText, {
502954
503927
  children: [
@@ -503447,7 +504420,7 @@ var init_FilePermissionDialog = __esm(() => {
503447
504420
  });
503448
504421
 
503449
504422
  // src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.tsx
503450
- import { basename as basename46, relative as relative29 } from "path";
504423
+ import { basename as basename47, relative as relative29 } from "path";
503451
504424
  function SedEditPermissionRequest(t0) {
503452
504425
  const $2 = import_compiler_runtime298.c(9);
503453
504426
  let props;
@@ -503623,7 +504596,7 @@ function SedEditPermissionRequestInner(t0) {
503623
504596
  }
503624
504597
  let t10;
503625
504598
  if ($2[16] !== filePath) {
503626
- t10 = basename46(filePath);
504599
+ t10 = basename47(filePath);
503627
504600
  $2[16] = filePath;
503628
504601
  $2[17] = t10;
503629
504602
  } else {
@@ -503835,7 +504808,7 @@ var init_useShellPermissionFeedback = __esm(() => {
503835
504808
  });
503836
504809
 
503837
504810
  // src/components/permissions/shellPermissionHelpers.tsx
503838
- import { basename as basename47, sep as sep34 } from "path";
504811
+ import { basename as basename48, sep as sep34 } from "path";
503839
504812
  function commandListDisplay(commands) {
503840
504813
  switch (commands.length) {
503841
504814
  case 0:
@@ -503886,7 +504859,7 @@ function commandListDisplayTruncated(commands) {
503886
504859
  function formatPathList(paths2) {
503887
504860
  if (paths2.length === 0)
503888
504861
  return "";
503889
- const names = paths2.map((p) => basename47(p) || p);
504862
+ const names = paths2.map((p) => basename48(p) || p);
503890
504863
  if (names.length === 1) {
503891
504864
  return /* @__PURE__ */ jsx_dev_runtime386.jsxDEV(ThemedText, {
503892
504865
  children: [
@@ -503952,7 +504925,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
503952
504925
  if (hasReadPaths && !hasDirectories && !hasCommands) {
503953
504926
  if (readPaths.length === 1) {
503954
504927
  const firstPath = readPaths[0];
503955
- const dirName = basename47(firstPath) || firstPath;
504928
+ const dirName = basename48(firstPath) || firstPath;
503956
504929
  return /* @__PURE__ */ jsx_dev_runtime386.jsxDEV(ThemedText, {
503957
504930
  children: [
503958
504931
  "Yes, allow reading from ",
@@ -503976,7 +504949,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
503976
504949
  if (hasDirectories && !hasReadPaths && !hasCommands) {
503977
504950
  if (directories.length === 1) {
503978
504951
  const firstDir = directories[0];
503979
- const dirName = basename47(firstDir) || firstDir;
504952
+ const dirName = basename48(firstDir) || firstDir;
503980
504953
  return /* @__PURE__ */ jsx_dev_runtime386.jsxDEV(ThemedText, {
503981
504954
  children: [
503982
504955
  "Yes, and always allow access to ",
@@ -506282,7 +507255,7 @@ function createSingleEditDiffConfig(filePath, oldString, newString, replaceAll)
506282
507255
  }
506283
507256
 
506284
507257
  // src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx
506285
- import { basename as basename48, relative as relative30 } from "path";
507258
+ import { basename as basename49, relative as relative30 } from "path";
506286
507259
  function FileEditPermissionRequest(props) {
506287
507260
  const $2 = import_compiler_runtime303.c(51);
506288
507261
  const parseInput = _temp181;
@@ -506325,7 +507298,7 @@ function FileEditPermissionRequest(props) {
506325
507298
  t3 = " ";
506326
507299
  T0 = ThemedText;
506327
507300
  t0 = true;
506328
- t1 = basename48(file_path);
507301
+ t1 = basename49(file_path);
506329
507302
  $2[0] = props.onDone;
506330
507303
  $2[1] = props.onReject;
506331
507304
  $2[2] = props.toolUseConfirm;
@@ -506752,7 +507725,7 @@ var init_FileWriteToolDiff = __esm(() => {
506752
507725
  });
506753
507726
 
506754
507727
  // src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx
506755
- import { basename as basename49, relative as relative31 } from "path";
507728
+ import { basename as basename50, relative as relative31 } from "path";
506756
507729
  function FileWritePermissionRequest(props) {
506757
507730
  const $2 = import_compiler_runtime306.c(30);
506758
507731
  const parseInput = _temp186;
@@ -506819,7 +507792,7 @@ function FileWritePermissionRequest(props) {
506819
507792
  }
506820
507793
  let t9;
506821
507794
  if ($2[7] !== file_path) {
506822
- t9 = basename49(file_path);
507795
+ t9 = basename50(file_path);
506823
507796
  $2[7] = file_path;
506824
507797
  $2[8] = t9;
506825
507798
  } else {
@@ -507224,7 +508197,7 @@ var init_NotebookEditToolDiff = __esm(() => {
507224
508197
  });
507225
508198
 
507226
508199
  // src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.tsx
507227
- import { basename as basename50 } from "path";
508200
+ import { basename as basename51 } from "path";
507228
508201
  function NotebookEditPermissionRequest(props) {
507229
508202
  const $2 = import_compiler_runtime308.c(52);
507230
508203
  const parseInput = _temp188;
@@ -507268,7 +508241,7 @@ function NotebookEditPermissionRequest(props) {
507268
508241
  t4 = " ";
507269
508242
  T0 = ThemedText;
507270
508243
  t0 = true;
507271
- t1 = basename50(notebook_path);
508244
+ t1 = basename51(notebook_path);
507272
508245
  $2[0] = props.onDone;
507273
508246
  $2[1] = props.onReject;
507274
508247
  $2[2] = props.toolUseConfirm;
@@ -511180,7 +512153,7 @@ var init_useVoiceEnabled = __esm(() => {
511180
512153
  function getSemverPart(version3) {
511181
512154
  return `${import_semver12.major(version3, { loose: true })}.${import_semver12.minor(version3, { loose: true })}.${import_semver12.patch(version3, { loose: true })}`;
511182
512155
  }
511183
- function useUpdateNotification(updatedVersion, initialVersion = "1.1.36+7725484") {
512156
+ function useUpdateNotification(updatedVersion, initialVersion = "1.1.37+d527bcf") {
511184
512157
  const [lastNotifiedSemver, setLastNotifiedSemver] = import_react228.useState(() => getSemverPart(initialVersion));
511185
512158
  if (!updatedVersion) {
511186
512159
  return null;
@@ -511220,7 +512193,7 @@ function AutoUpdater({
511220
512193
  return;
511221
512194
  }
511222
512195
  if (false) {}
511223
- const currentVersion = "1.1.36+7725484";
512196
+ const currentVersion = "1.1.37+d527bcf";
511224
512197
  const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
511225
512198
  let latestVersion = await getLatestVersion(channel);
511226
512199
  const isDisabled = isAutoUpdaterDisabled();
@@ -511433,12 +512406,12 @@ function NativeAutoUpdater({
511433
512406
  logEvent("tengu_native_auto_updater_start", {});
511434
512407
  try {
511435
512408
  const maxVersion = await getMaxVersion();
511436
- if (maxVersion && gt("1.1.36+7725484", maxVersion)) {
512409
+ if (maxVersion && gt("1.1.37+d527bcf", maxVersion)) {
511437
512410
  const msg = await getMaxVersionMessage();
511438
512411
  setMaxVersionIssue(msg ?? "affects your version");
511439
512412
  }
511440
512413
  const result = await installLatest(channel);
511441
- const currentVersion = "1.1.36+7725484";
512414
+ const currentVersion = "1.1.37+d527bcf";
511442
512415
  const latencyMs = Date.now() - startTime;
511443
512416
  if (result.lockFailed) {
511444
512417
  logEvent("tengu_native_auto_updater_lock_contention", {
@@ -511575,17 +512548,17 @@ function PackageManagerAutoUpdater(t0) {
511575
512548
  const maxVersion = await getMaxVersion();
511576
512549
  if (maxVersion && latest && gt(latest, maxVersion)) {
511577
512550
  logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
511578
- if (gte("1.1.36+7725484", maxVersion)) {
511579
- logForDebugging(`PackageManagerAutoUpdater: current version ${"1.1.36+7725484"} is already at or above maxVersion ${maxVersion}, skipping update`);
512551
+ if (gte("1.1.37+d527bcf", maxVersion)) {
512552
+ logForDebugging(`PackageManagerAutoUpdater: current version ${"1.1.37+d527bcf"} is already at or above maxVersion ${maxVersion}, skipping update`);
511580
512553
  setUpdateAvailable(false);
511581
512554
  return;
511582
512555
  }
511583
512556
  latest = maxVersion;
511584
512557
  }
511585
- const hasUpdate = latest && !gte("1.1.36+7725484", latest) && !shouldSkipVersion(latest);
512558
+ const hasUpdate = latest && !gte("1.1.37+d527bcf", latest) && !shouldSkipVersion(latest);
511586
512559
  setUpdateAvailable(!!hasUpdate);
511587
512560
  if (hasUpdate) {
511588
- logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.1.36+7725484"} -> ${latest}`);
512561
+ logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.1.37+d527bcf"} -> ${latest}`);
511589
512562
  }
511590
512563
  };
511591
512564
  $2[0] = t1;
@@ -511619,7 +512592,7 @@ function PackageManagerAutoUpdater(t0) {
511619
512592
  wrap: "truncate",
511620
512593
  children: [
511621
512594
  "currentVersion: ",
511622
- "1.1.36+7725484"
512595
+ "1.1.37+d527bcf"
511623
512596
  ]
511624
512597
  }, undefined, true, undefined, this);
511625
512598
  $2[3] = verbose;
@@ -511774,7 +512747,7 @@ var init_AutoUpdaterWrapper = __esm(() => {
511774
512747
  });
511775
512748
 
511776
512749
  // src/components/IdeStatusIndicator.tsx
511777
- import { basename as basename51 } from "path";
512750
+ import { basename as basename52 } from "path";
511778
512751
  function IdeStatusIndicator(t0) {
511779
512752
  const $2 = import_compiler_runtime318.c(7);
511780
512753
  const {
@@ -511814,7 +512787,7 @@ function IdeStatusIndicator(t0) {
511814
512787
  if (ideSelection.filePath) {
511815
512788
  let t1;
511816
512789
  if ($2[3] !== ideSelection.filePath) {
511817
- t1 = basename51(ideSelection.filePath);
512790
+ t1 = basename52(ideSelection.filePath);
511818
512791
  $2[3] = ideSelection.filePath;
511819
512792
  $2[4] = t1;
511820
512793
  } else {
@@ -511917,6 +512890,80 @@ var init_compactWarningHook = __esm(() => {
511917
512890
  });
511918
512891
 
511919
512892
  // src/components/TokenWarning.tsx
512893
+ function CollapseLabel(t0) {
512894
+ const $2 = import_compiler_runtime319.c(8);
512895
+ const {
512896
+ upgradeMessage
512897
+ } = t0;
512898
+ let t1;
512899
+ if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
512900
+ t1 = (init_contextCollapse(), __toCommonJS(exports_contextCollapse));
512901
+ $2[0] = t1;
512902
+ } else {
512903
+ t1 = $2[0];
512904
+ }
512905
+ const {
512906
+ getStats: getStats2,
512907
+ subscribe: subscribe5
512908
+ } = t1;
512909
+ let t2;
512910
+ if ($2[1] === Symbol.for("react.memo_cache_sentinel")) {
512911
+ t2 = () => {
512912
+ const s = getStats2();
512913
+ const idleWarn = s.health.emptySpawnWarningEmitted ? 1 : 0;
512914
+ return `${s.collapsedSpans}|${s.stagedSpans}|${s.health.totalErrors}|${s.health.totalEmptySpawns}|${idleWarn}`;
512915
+ };
512916
+ $2[1] = t2;
512917
+ } else {
512918
+ t2 = $2[1];
512919
+ }
512920
+ const snapshot2 = import_react234.useSyncExternalStore(subscribe5, t2);
512921
+ let t3;
512922
+ if ($2[2] !== snapshot2) {
512923
+ t3 = snapshot2.split("|").map(Number);
512924
+ $2[2] = snapshot2;
512925
+ $2[3] = t3;
512926
+ } else {
512927
+ t3 = $2[3];
512928
+ }
512929
+ const [collapsed, staged2, errors4, emptySpawns, idleWarn_0] = t3;
512930
+ const total = collapsed + staged2;
512931
+ if (errors4 > 0 || idleWarn_0) {
512932
+ const problem = errors4 > 0 ? `collapse errors: ${errors4}` : `collapse idle (${emptySpawns} empty runs)`;
512933
+ const t42 = total > 0 ? `${collapsed} / ${total} summarized · ${problem}` : problem;
512934
+ let t52;
512935
+ if ($2[4] !== t42) {
512936
+ t52 = /* @__PURE__ */ jsx_dev_runtime412.jsxDEV(ThemedText, {
512937
+ color: "warning",
512938
+ wrap: "truncate",
512939
+ children: t42
512940
+ }, undefined, false, undefined, this);
512941
+ $2[4] = t42;
512942
+ $2[5] = t52;
512943
+ } else {
512944
+ t52 = $2[5];
512945
+ }
512946
+ return t52;
512947
+ }
512948
+ if (total === 0) {
512949
+ return null;
512950
+ }
512951
+ const label = `${collapsed} / ${total} summarized`;
512952
+ const t4 = upgradeMessage ? `${label} · ${upgradeMessage}` : label;
512953
+ let t5;
512954
+ if ($2[6] !== t4) {
512955
+ t5 = /* @__PURE__ */ jsx_dev_runtime412.jsxDEV(ThemedText, {
512956
+ dimColor: true,
512957
+ wrap: "truncate",
512958
+ children: t4
512959
+ }, undefined, false, undefined, this);
512960
+ $2[6] = t4;
512961
+ $2[7] = t5;
512962
+ } else {
512963
+ t5 = $2[7];
512964
+ }
512965
+ return t5;
512966
+ }
511920
512967
  function TokenWarning(t0) {
511921
512968
  const $2 = import_compiler_runtime319.c(13);
511922
512969
  const {
@@ -511961,7 +513008,14 @@ function TokenWarning(t0) {
511961
513008
  let reactiveOnlyMode = false;
511962
513009
  let collapseMode = false;
511963
513010
  if (false) {}
511964
- if (false) {}
513011
+ if (true) {
513012
+ const {
513013
+ isContextCollapseEnabled: isContextCollapseEnabled2
513014
+ } = (init_contextCollapse(), __toCommonJS(exports_contextCollapse));
513015
+ if (isContextCollapseEnabled2()) {
513016
+ collapseMode = true;
513017
+ }
513018
+ }
511965
513019
  if (reactiveOnlyMode || collapseMode) {
511966
513020
  const effectiveWindow = getEffectiveContextWindowSize(model);
511967
513021
  let t42;
@@ -511975,7 +513029,21 @@ function TokenWarning(t0) {
511975
513029
  }
511976
513030
  displayPercentLeft = Math.max(0, t42);
511977
513031
  }
511978
- if (collapseMode && false) {}
513032
+ if (collapseMode && true) {
513033
+ let t42;
513034
+ if ($2[8] === Symbol.for("react.memo_cache_sentinel")) {
513035
+ t42 = /* @__PURE__ */ jsx_dev_runtime412.jsxDEV(ThemedBox_default, {
513036
+ flexDirection: "row",
513037
+ children: /* @__PURE__ */ jsx_dev_runtime412.jsxDEV(CollapseLabel, {
513038
+ upgradeMessage
513039
+ }, undefined, false, undefined, this)
513040
+ }, undefined, false, undefined, this);
513041
+ $2[8] = t42;
513042
+ } else {
513043
+ t42 = $2[8];
513044
+ }
513045
+ return t42;
513046
+ }
511979
513047
  const autocompactLabel = reactiveOnlyMode ? `${100 - displayPercentLeft}% context used` : `${displayPercentLeft}% until auto-compact`;
511980
513048
  let t4;
511981
513049
  if ($2[9] !== autocompactLabel || $2[10] !== isAboveErrorThreshold || $2[11] !== percentLeft) {
@@ -515626,7 +516694,7 @@ var init_slackChannelSuggestions = __esm(() => {
515626
516694
  });
515627
516695
 
515628
516696
  // src/hooks/unifiedSuggestions.ts
515629
- import { basename as basename52 } from "path";
516697
+ import { basename as basename53 } from "path";
515630
516698
  function createSuggestionFromSource(source) {
515631
516699
  switch (source.type) {
515632
516700
  case "file":
@@ -515688,7 +516756,7 @@ async function generateUnifiedSuggestions(query2, mcpResources, agents2, showOnE
515688
516756
  displayText: suggestion.displayText,
515689
516757
  description: suggestion.description,
515690
516758
  path: suggestion.displayText,
515691
- filename: basename52(suggestion.displayText),
516759
+ filename: basename53(suggestion.displayText),
515692
516760
  score: suggestion.metadata?.score
515693
516761
  }));
515694
516762
  const mcpSources = Object.values(mcpResources).flat().map((resource) => ({
@@ -517070,7 +518138,7 @@ var init_AutoModeOptInDialog = __esm(() => {
517070
518138
  });
517071
518139
 
517072
518140
  // src/components/BridgeDialog.tsx
517073
- import { basename as basename53 } from "path";
518141
+ import { basename as basename54 } from "path";
517074
518142
  function BridgeDialog(t0) {
517075
518143
  const $2 = import_compiler_runtime323.c(87);
517076
518144
  const {
@@ -517093,7 +518161,7 @@ function BridgeDialog(t0) {
517093
518161
  const [branchName, setBranchName] = import_react243.useState("");
517094
518162
  let t1;
517095
518163
  if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
517096
- t1 = basename53(getOriginalCwd());
518164
+ t1 = basename54(getOriginalCwd());
517097
518165
  $2[0] = t1;
517098
518166
  } else {
517099
518167
  t1 = $2[0];
@@ -517682,7 +518750,7 @@ var init_teamDiscovery = __esm(() => {
517682
518750
  });
517683
518751
 
517684
518752
  // src/components/teams/TeamsDialog.tsx
517685
- import { randomUUID as randomUUID36 } from "crypto";
518753
+ import { randomUUID as randomUUID37 } from "crypto";
517686
518754
  function TeamsDialog({
517687
518755
  initialTeams,
517688
518756
  onDone
@@ -518306,7 +519374,7 @@ async function killTeammate(paneId, backendType, teamName, teammateId, teammateN
518306
519374
  },
518307
519375
  inbox: {
518308
519376
  messages: [...prev.inbox.messages, {
518309
- id: randomUUID36(),
519377
+ id: randomUUID37(),
518310
519378
  from: "system",
518311
519379
  text: jsonStringify({
518312
519380
  type: "teammate_terminated",
@@ -519708,7 +520776,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
519708
520776
  project_dir: getOriginalCwd(),
519709
520777
  added_dirs: addedDirs
519710
520778
  },
519711
- version: "1.1.36+7725484",
520779
+ version: "1.1.37+d527bcf",
519712
520780
  output_style: {
519713
520781
  name: outputStyleName
519714
520782
  },
@@ -524031,7 +525099,7 @@ function normalizeControlMessageKeys(obj) {
524031
525099
  }
524032
525100
 
524033
525101
  // src/bridge/bridgeMessaging.ts
524034
- import { randomUUID as randomUUID37 } from "crypto";
525102
+ import { randomUUID as randomUUID38 } from "crypto";
524035
525103
  function isSDKMessage(value) {
524036
525104
  return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
524037
525105
  }
@@ -524239,7 +525307,7 @@ function makeResultMessage(sessionId) {
524239
525307
  modelUsage: {},
524240
525308
  permission_denials: [],
524241
525309
  session_id: sessionId,
524242
- uuid: randomUUID37()
525310
+ uuid: randomUUID38()
524243
525311
  };
524244
525312
  }
524245
525313
 
@@ -524283,7 +525351,7 @@ var init_bridgeMessaging = __esm(() => {
524283
525351
  });
524284
525352
 
524285
525353
  // src/remote/SessionsWebSocket.ts
524286
- import { randomUUID as randomUUID38 } from "crypto";
525354
+ import { randomUUID as randomUUID39 } from "crypto";
524287
525355
  function isSessionsMessage(value) {
524288
525356
  if (typeof value !== "object" || value === null || !("type" in value)) {
524289
525357
  return false;
@@ -524467,7 +525535,7 @@ class SessionsWebSocket {
524467
525535
  }
524468
525536
  const controlRequest = {
524469
525537
  type: "control_request",
524470
- request_id: randomUUID38(),
525538
+ request_id: randomUUID39(),
524471
525539
  request
524472
525540
  };
524473
525541
  logForDebugging(`[SessionsWebSocket] Sending control request: ${request.subtype}`);
@@ -524659,11 +525727,11 @@ var init_RemoteSessionManager = __esm(() => {
524659
525727
  });
524660
525728
 
524661
525729
  // src/remote/remotePermissionBridge.ts
524662
- import { randomUUID as randomUUID39 } from "crypto";
525730
+ import { randomUUID as randomUUID40 } from "crypto";
524663
525731
  function createSyntheticAssistantMessage(request, requestId) {
524664
525732
  return {
524665
525733
  type: "assistant",
524666
- uuid: randomUUID39(),
525734
+ uuid: randomUUID40(),
524667
525735
  message: {
524668
525736
  id: `remote-${requestId}`,
524669
525737
  type: "message",
@@ -525466,7 +526534,7 @@ var init_useDirectConnect = __esm(() => {
525466
526534
  });
525467
526535
 
525468
526536
  // src/hooks/useSSHSession.ts
525469
- import { randomUUID as randomUUID40 } from "crypto";
526537
+ import { randomUUID as randomUUID41 } from "crypto";
525470
526538
  function useSSHSession({
525471
526539
  session: session2,
525472
526540
  setMessages,
@@ -525564,7 +526632,7 @@ function useSSHSession({
525564
526632
  subtype: "informational",
525565
526633
  content: `SSH connection dropped — reconnecting (attempt ${attempt}/${max})...`,
525566
526634
  timestamp: new Date().toISOString(),
525567
- uuid: randomUUID40(),
526635
+ uuid: randomUUID41(),
525568
526636
  level: "warning"
525569
526637
  };
525570
526638
  setMessages((prev) => [...prev, msg]);
@@ -526473,7 +527541,9 @@ __export(exports_backgroundHousekeeping, {
526473
527541
  function startBackgroundHousekeeping() {
526474
527542
  initMagicDocs();
526475
527543
  initSkillImprovement();
526476
- if (false) {}
527544
+ if (true) {
527545
+ extractMemoriesModule2.initExtractMemories();
527546
+ }
526477
527547
  initAutoDream();
526478
527548
  autoUpdateMarketplacesAndPluginsInBackground();
526479
527549
  if (false) {}
@@ -526502,7 +527572,7 @@ function startBackgroundHousekeeping() {
526502
527572
  interval.unref();
526503
527573
  }
526504
527574
  }
526505
- var RECURRING_CLEANUP_INTERVAL_MS, DELAY_VERY_SLOW_OPERATIONS_THAT_HAPPEN_EVERY_SESSION;
527575
+ var extractMemoriesModule2, RECURRING_CLEANUP_INTERVAL_MS, DELAY_VERY_SLOW_OPERATIONS_THAT_HAPPEN_EVERY_SESSION;
526506
527576
  var init_backgroundHousekeeping = __esm(() => {
526507
527577
  init_autoDream();
526508
527578
  init_magicDocs();
@@ -526511,6 +527581,7 @@ var init_backgroundHousekeeping = __esm(() => {
526511
527581
  init_cleanup2();
526512
527582
  init_nativeInstaller();
526513
527583
  init_pluginAutoupdate();
527584
+ extractMemoriesModule2 = (init_extractMemories(), __toCommonJS(exports_extractMemories));
526514
527585
  RECURRING_CLEANUP_INTERVAL_MS = 24 * 60 * 60 * 1000;
526515
527586
  DELAY_VERY_SLOW_OPERATIONS_THAT_HAPPEN_EVERY_SESSION = 10 * 60 * 1000;
526516
527587
  });
@@ -527602,7 +528673,7 @@ var init_PermissionContext = __esm(() => {
527602
528673
  });
527603
528674
 
527604
528675
  // src/hooks/toolPermission/handlers/interactiveHandler.ts
527605
- import { randomUUID as randomUUID41 } from "crypto";
528676
+ import { randomUUID as randomUUID42 } from "crypto";
527606
528677
  function handleInteractivePermission(params, resolve40) {
527607
528678
  const {
527608
528679
  ctx,
@@ -527616,7 +528687,7 @@ function handleInteractivePermission(params, resolve40) {
527616
528687
  let userInteracted = false;
527617
528688
  let checkmarkTransitionTimer;
527618
528689
  let checkmarkAbortHandler;
527619
- const bridgeRequestId = bridgeCallbacks ? randomUUID41() : undefined;
528690
+ const bridgeRequestId = bridgeCallbacks ? randomUUID42() : undefined;
527620
528691
  let channelUnsubscribe;
527621
528692
  const permissionPromptStartTimeMs = Date.now();
527622
528693
  const displayInput = result.updatedInput ?? ctx.input;
@@ -528038,9 +529109,9 @@ function matchesKeepGoingKeyword(input) {
528038
529109
  }
528039
529110
 
528040
529111
  // src/utils/processUserInput/processTextPrompt.ts
528041
- import { randomUUID as randomUUID42 } from "crypto";
529112
+ import { randomUUID as randomUUID43 } from "crypto";
528042
529113
  function processTextPrompt(input, imageContentBlocks, imagePasteIds, attachmentMessages, uuid3, permissionMode, isMeta) {
528043
- const promptId = randomUUID42();
529114
+ const promptId = randomUUID43();
528044
529115
  setPromptId(promptId);
528045
529116
  const userPromptText = typeof input === "string" ? input : input.find((block2) => block2.type === "text")?.text || "";
528046
529117
  startInteractionSpan(userPromptText);
@@ -528174,7 +529245,7 @@ var exports_processBashCommand = {};
528174
529245
  __export(exports_processBashCommand, {
528175
529246
  processBashCommand: () => processBashCommand
528176
529247
  });
528177
- import { randomUUID as randomUUID43 } from "crypto";
529248
+ import { randomUUID as randomUUID44 } from "crypto";
528178
529249
  async function processBashCommand(inputString, precedingInputBlocks, attachmentMessages, context2, setToolJSX) {
528179
529250
  const usePowerShell = isPowerShellToolEnabled() && resolveDefaultShell() === "powershell";
528180
529251
  logEvent("tengu_input_bash", {
@@ -528238,7 +529309,7 @@ async function processBashCommand(inputString, precedingInputBlocks, attachmentM
528238
529309
  const mapped = await processToolResultBlock(shellTool, {
528239
529310
  ...data,
528240
529311
  stderr: ""
528241
- }, randomUUID43());
529312
+ }, randomUUID44());
528242
529313
  const stdout = typeof mapped.content === "string" ? mapped.content : escapeXml(data.stdout);
528243
529314
  return {
528244
529315
  messages: [createSyntheticUserCaveatMessage(), userMessage, ...attachmentMessages, createUserMessage({
@@ -528287,7 +529358,7 @@ var init_processBashCommand = __esm(() => {
528287
529358
  });
528288
529359
 
528289
529360
  // src/utils/processUserInput/processUserInput.ts
528290
- import { randomUUID as randomUUID44 } from "crypto";
529361
+ import { randomUUID as randomUUID45 } from "crypto";
528291
529362
  async function processUserInput({
528292
529363
  input,
528293
529364
  preExpansionInput,
@@ -528349,7 +529420,7 @@ Original prompt: ${input}`, "warning")
528349
529420
  type: "hook_additional_context",
528350
529421
  content: hookResult.additionalContexts.map(applyTruncation),
528351
529422
  hookName: "UserPromptSubmit",
528352
- toolUseID: `hook-${randomUUID44()}`,
529423
+ toolUseID: `hook-${randomUUID45()}`,
528353
529424
  hookEvent: "UserPromptSubmit"
528354
529425
  }));
528355
529426
  }
@@ -528933,9 +530004,9 @@ var init_useQueueProcessor = __esm(() => {
528933
530004
  // src/hooks/useMailboxBridge.ts
528934
530005
  function useMailboxBridge({ isLoading, onSubmitMessage }) {
528935
530006
  const mailbox = useMailbox();
528936
- const subscribe3 = import_react278.useMemo(() => mailbox.subscribe.bind(mailbox), [mailbox]);
530007
+ const subscribe5 = import_react278.useMemo(() => mailbox.subscribe.bind(mailbox), [mailbox]);
528937
530008
  const getSnapshot = import_react278.useCallback(() => mailbox.revision, [mailbox]);
528938
- const revision = import_react278.useSyncExternalStore(subscribe3, getSnapshot);
530009
+ const revision = import_react278.useSyncExternalStore(subscribe5, getSnapshot);
528939
530010
  import_react278.useEffect(() => {
528940
530011
  if (isLoading)
528941
530012
  return;
@@ -529125,7 +530196,7 @@ async function resetForTesting2(overrides) {
529125
530196
  disposed3 = false;
529126
530197
  testOverrides2 = overrides ?? null;
529127
530198
  }
529128
- var FILE_STABILITY_THRESHOLD_MS3 = 1000, FILE_STABILITY_POLL_INTERVAL_MS3 = 500, RELOAD_DEBOUNCE_MS = 300, POLLING_INTERVAL_MS3 = 2000, USE_POLLING, watcher4 = null, reloadTimer = null, pendingChangedPaths, initialized4 = false, disposed3 = false, dynamicSkillsCallbackRegistered = false, unregisterCleanup = null, skillsChanged, testOverrides2 = null, subscribe3, skillChangeDetector;
530199
+ var FILE_STABILITY_THRESHOLD_MS3 = 1000, FILE_STABILITY_POLL_INTERVAL_MS3 = 500, RELOAD_DEBOUNCE_MS = 300, POLLING_INTERVAL_MS3 = 2000, USE_POLLING, watcher4 = null, reloadTimer = null, pendingChangedPaths, initialized4 = false, disposed3 = false, dynamicSkillsCallbackRegistered = false, unregisterCleanup = null, skillsChanged, testOverrides2 = null, subscribe5, skillChangeDetector;
529129
530200
  var init_skillChangeDetector = __esm(() => {
529130
530201
  init_esm3();
529131
530202
  init_state();
@@ -529140,11 +530211,11 @@ var init_skillChangeDetector = __esm(() => {
529140
530211
  USE_POLLING = typeof Bun !== "undefined";
529141
530212
  pendingChangedPaths = new Set;
529142
530213
  skillsChanged = createSignal();
529143
- subscribe3 = skillsChanged.subscribe;
530214
+ subscribe5 = skillsChanged.subscribe;
529144
530215
  skillChangeDetector = {
529145
530216
  initialize: initialize4,
529146
530217
  dispose: dispose3,
529147
- subscribe: subscribe3,
530218
+ subscribe: subscribe5,
529148
530219
  resetForTesting: resetForTesting2
529149
530220
  };
529150
530221
  });
@@ -529659,7 +530730,7 @@ __export(exports_asciicast, {
529659
530730
  _resetRecordingStateForTesting: () => _resetRecordingStateForTesting
529660
530731
  });
529661
530732
  import { appendFile as appendFile6, rename as rename10 } from "fs/promises";
529662
- import { basename as basename54, dirname as dirname59, join as join142 } from "path";
530733
+ import { basename as basename55, dirname as dirname59, join as join142 } from "path";
529663
530734
  function getRecordFilePath() {
529664
530735
  if (recordingState.filePath !== null) {
529665
530736
  return recordingState.filePath;
@@ -529705,8 +530776,8 @@ async function renameRecordingForSession() {
529705
530776
  return;
529706
530777
  }
529707
530778
  await recorder?.flush();
529708
- const oldName = basename54(oldPath);
529709
- const newName = basename54(newPath);
530779
+ const oldName = basename55(oldPath);
530780
+ const newName = basename55(newPath);
529710
530781
  try {
529711
530782
  await rename10(oldPath, newPath);
529712
530783
  recordingState.filePath = newPath;
@@ -529809,6 +530880,37 @@ var init_asciicast = __esm(() => {
529809
530880
  };
529810
530881
  });
529811
530882
 
530883
+ // src/services/contextCollapse/persist.ts
530884
+ var exports_persist = {};
530885
+ __export(exports_persist, {
530886
+ restoreFromEntries: () => restoreFromEntries
530887
+ });
530888
+ function restoreFromEntries(commits, snapshot2) {
530889
+ resetAll();
530890
+ for (const commit of commits) {
530891
+ addCommitted({
530892
+ collapseId: commit.collapseId,
530893
+ summaryUuid: commit.summaryUuid,
530894
+ summaryContent: commit.summaryContent,
530895
+ summary: commit.summary,
530896
+ firstArchivedUuid: commit.firstArchivedUuid,
530897
+ lastArchivedUuid: commit.lastArchivedUuid,
530898
+ archived: []
530899
+ });
530900
+ }
530901
+ seedCollapseIdCounterFrom(commits.map((c4) => c4.collapseId));
530902
+ if (snapshot2) {
530903
+ for (const item of snapshot2.staged) {
530904
+ addStaged(item);
530905
+ }
530906
+ setArmed(snapshot2.armed);
530907
+ setLastSpawnTokens(snapshot2.lastSpawnTokens);
530908
+ }
530909
+ }
530910
+ var init_persist = __esm(() => {
530911
+ init_store();
530912
+ });
530913
+
529812
530914
  // src/utils/sessionRestore.ts
529813
530915
  import { dirname as dirname60 } from "path";
529814
530916
  function extractTodosFromTranscript(messages) {
@@ -529834,7 +530936,9 @@ function restoreSessionStateFromLog(result, setAppState) {
529834
530936
  });
529835
530937
  }
529836
530938
  if (false) {}
529837
- if (false) {}
530939
+ if (true) {
530940
+ (init_persist(), __toCommonJS(exports_persist)).restoreFromEntries(result.contextCollapseCommits ?? [], result.contextCollapseSnapshot);
530941
+ }
529838
530942
  if (!isTodoV2Enabled() && result.messages && result.messages.length > 0) {
529839
530943
  const todos = extractTodosFromTranscript(result.messages);
529840
530944
  if (todos.length > 0) {
@@ -529963,7 +531067,9 @@ async function processResumedConversation(result, opts, context2) {
529963
531067
  restoreWorktreeForResume(result.worktreeSession);
529964
531068
  adoptResumedSessionFile();
529965
531069
  }
529966
- if (false) {}
531070
+ if (true) {
531071
+ (init_persist(), __toCommonJS(exports_persist)).restoreFromEntries(result.contextCollapseCommits ?? [], result.contextCollapseSnapshot);
531072
+ }
529967
531073
  restoreModelFromTranscript(result.messages);
529968
531074
  const { agentDefinition: restoredAgent, agentType: resumedAgentType } = restoreAgentFromSession(result.agentSetting, context2.mainThreadAgentDefinition, context2.agentDefinitions);
529969
531075
  if (false) {}
@@ -530012,7 +531118,7 @@ var init_sessionRestore = __esm(() => {
530012
531118
  });
530013
531119
 
530014
531120
  // src/hooks/useInboxPoller.ts
530015
- import { randomUUID as randomUUID45 } from "crypto";
531121
+ import { randomUUID as randomUUID46 } from "crypto";
530016
531122
  function getAgentNameToPoll(appState) {
530017
531123
  if (isInProcessTeammate()) {
530018
531124
  return;
@@ -530429,7 +531535,7 @@ function useInboxPoller({
530429
531535
  messages: [
530430
531536
  ...prev.inbox.messages,
530431
531537
  {
530432
- id: randomUUID45(),
531538
+ id: randomUUID46(),
530433
531539
  from: "system",
530434
531540
  text: jsonStringify({
530435
531541
  type: "teammate_terminated",
@@ -530469,7 +531575,7 @@ ${messageContent}
530469
531575
  messages: [
530470
531576
  ...prev.inbox.messages,
530471
531577
  ...regularMessages.map((m) => ({
530472
- id: randomUUID45(),
531578
+ id: randomUUID46(),
530473
531579
  from: m.from,
530474
531580
  text: m.text,
530475
531581
  timestamp: m.timestamp,
@@ -531322,7 +532428,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
531322
532428
  } catch {}
531323
532429
  const data = {
531324
532430
  trigger,
531325
- version: "1.1.36+7725484",
532431
+ version: "1.1.37+d527bcf",
531326
532432
  platform: process.platform,
531327
532433
  transcript,
531328
532434
  subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
@@ -531373,7 +532479,7 @@ var init_submitTranscriptShare = __esm(() => {
531373
532479
  });
531374
532480
 
531375
532481
  // src/components/FeedbackSurvey/useSurveyState.tsx
531376
- import { randomUUID as randomUUID46 } from "crypto";
532482
+ import { randomUUID as randomUUID47 } from "crypto";
531377
532483
  function useSurveyState({
531378
532484
  hideThanksAfterMs,
531379
532485
  onOpen,
@@ -531384,7 +532490,7 @@ function useSurveyState({
531384
532490
  }) {
531385
532491
  const [state2, setState] = import_react292.useState("closed");
531386
532492
  const [lastResponse, setLastResponse] = import_react292.useState(null);
531387
- const appearanceId = import_react292.useRef(randomUUID46());
532493
+ const appearanceId = import_react292.useRef(randomUUID47());
531388
532494
  const lastResponseRef = import_react292.useRef(null);
531389
532495
  const showThanksThenClose = import_react292.useCallback(() => {
531390
532496
  setState("thanks");
@@ -531402,7 +532508,7 @@ function useSurveyState({
531402
532508
  return;
531403
532509
  }
531404
532510
  setState("open");
531405
- appearanceId.current = randomUUID46();
532511
+ appearanceId.current = randomUUID47();
531406
532512
  onOpen(appearanceId.current);
531407
532513
  }, [state2, onOpen]);
531408
532514
  const handleSelect = import_react292.useCallback((selected) => {
@@ -534156,13 +535262,13 @@ function permissionPromptToolResultToPermissionDecision(result, tool, input, too
534156
535262
  decisionReason
534157
535263
  };
534158
535264
  }
534159
- var inputSchema39, decisionClassificationField, PermissionAllowResultSchema, PermissionDenyResultSchema, outputSchema32;
535265
+ var inputSchema40, decisionClassificationField, PermissionAllowResultSchema, PermissionDenyResultSchema, outputSchema33;
534160
535266
  var init_PermissionPromptToolResultSchema = __esm(() => {
534161
535267
  init_v4();
534162
535268
  init_debug();
534163
535269
  init_PermissionUpdate();
534164
535270
  init_PermissionUpdateSchema();
534165
- inputSchema39 = lazySchema(() => v4_default.object({
535271
+ inputSchema40 = lazySchema(() => v4_default.object({
534166
535272
  tool_name: v4_default.string().describe("The name of the tool requesting permission"),
534167
535273
  input: v4_default.record(v4_default.string(), v4_default.unknown()).describe("The input for the tool"),
534168
535274
  tool_use_id: v4_default.string().optional().describe("The unique tool use request ID")
@@ -534185,7 +535291,7 @@ var init_PermissionPromptToolResultSchema = __esm(() => {
534185
535291
  toolUseID: v4_default.string().optional(),
534186
535292
  decisionClassification: decisionClassificationField()
534187
535293
  }));
534188
- outputSchema32 = lazySchema(() => v4_default.union([PermissionAllowResultSchema(), PermissionDenyResultSchema()]));
535294
+ outputSchema33 = lazySchema(() => v4_default.union([PermissionAllowResultSchema(), PermissionDenyResultSchema()]));
534189
535295
  });
534190
535296
 
534191
535297
  // src/cli/ndjsonSafeStringify.ts
@@ -534202,7 +535308,7 @@ var init_ndjsonSafeStringify = __esm(() => {
534202
535308
  });
534203
535309
 
534204
535310
  // src/cli/structuredIO.ts
534205
- import { randomUUID as randomUUID47 } from "crypto";
535311
+ import { randomUUID as randomUUID48 } from "crypto";
534206
535312
  function serializeDecisionReason(reason) {
534207
535313
  if (!reason) {
534208
535314
  return;
@@ -534452,7 +535558,7 @@ class StructuredIO {
534452
535558
  writeToStdout(ndjsonSafeStringify(message) + `
534453
535559
  `);
534454
535560
  }
534455
- async sendRequest(request, schema, signal, requestId = randomUUID47()) {
535561
+ async sendRequest(request, schema, signal, requestId = randomUUID48()) {
534456
535562
  const message = {
534457
535563
  type: "control_request",
534458
535564
  request_id: requestId,
@@ -534518,7 +535624,7 @@ class StructuredIO {
534518
535624
  parentSignal.addEventListener("abort", onParentAbort, { once: true });
534519
535625
  try {
534520
535626
  const hookPromise = executePermissionRequestHooksForSDK(tool.name, toolUseID, input, toolUseContext, mainPermissionResult.suggestions).then((decision) => ({ source: "hook", decision }));
534521
- const requestId = randomUUID47();
535627
+ const requestId = randomUUID48();
534522
535628
  onPermissionPrompt?.(buildRequiresActionDetails(tool, input, toolUseID, requestId));
534523
535629
  const sdkPromise = this.sendRequest({
534524
535630
  subtype: "can_use_tool",
@@ -534529,7 +535635,7 @@ class StructuredIO {
534529
535635
  decision_reason: serializeDecisionReason(mainPermissionResult.decisionReason),
534530
535636
  tool_use_id: toolUseID,
534531
535637
  agent_id: toolUseContext.agentId
534532
- }, outputSchema32(), hookAbortController.signal, requestId).then((result) => ({ source: "sdk", result }));
535638
+ }, outputSchema33(), hookAbortController.signal, requestId).then((result) => ({ source: "sdk", result }));
534533
535639
  const winner = await Promise.race([hookPromise, sdkPromise]);
534534
535640
  if (winner.source === "hook") {
534535
535641
  if (winner.decision) {
@@ -534598,9 +535704,9 @@ class StructuredIO {
534598
535704
  subtype: "can_use_tool",
534599
535705
  tool_name: SANDBOX_NETWORK_ACCESS_TOOL_NAME,
534600
535706
  input: { host: hostPattern.host },
534601
- tool_use_id: randomUUID47(),
535707
+ tool_use_id: randomUUID48(),
534602
535708
  description: `Allow network connection to ${hostPattern.host}?`
534603
- }, outputSchema32());
535709
+ }, outputSchema33());
534604
535710
  return result.behavior === "allow";
534605
535711
  } catch {
534606
535712
  return false;
@@ -538646,7 +539752,7 @@ __export(exports_REPL, {
538646
539752
  import { dirname as dirname61, join as join145 } from "path";
538647
539753
  import { tmpdir as tmpdir12 } from "os";
538648
539754
  import { writeFile as writeFile45 } from "fs/promises";
538649
- import { randomUUID as randomUUID48 } from "crypto";
539755
+ import { randomUUID as randomUUID49 } from "crypto";
538650
539756
  function TranscriptModeFooter(t0) {
538651
539757
  const $2 = import_compiler_runtime368.c(9);
538652
539758
  const {
@@ -539404,7 +540510,7 @@ function REPL({
539404
540510
  const [isMessageSelectorVisible, setIsMessageSelectorVisible] = import_react318.useState(false);
539405
540511
  const [messageSelectorPreselect, setMessageSelectorPreselect] = import_react318.useState(undefined);
539406
540512
  const [showCostDialog, setShowCostDialog] = import_react318.useState(false);
539407
- const [conversationId, setConversationId] = import_react318.useState(randomUUID48());
540513
+ const [conversationId, setConversationId] = import_react318.useState(randomUUID49());
539408
540514
  const [idleReturnPending, setIdleReturnPending] = import_react318.useState(null);
539409
540515
  const skipIdleCheckRef = import_react318.useRef(false);
539410
540516
  const lastQueryCompletionTimeRef = import_react318.useRef(lastQueryCompletionTime);
@@ -540137,7 +541243,7 @@ Error: sandbox required but unavailable: ${reason}
540137
541243
  } else {
540138
541244
  setMessages(() => [newMessage]);
540139
541245
  }
540140
- setConversationId(randomUUID48());
541246
+ setConversationId(randomUUID49());
540141
541247
  if (false) {}
540142
541248
  } else if (newMessage.type === "progress" && isEphemeralToolProgress(newMessage.data.type)) {
540143
541249
  setMessages((oldMessages) => {
@@ -540213,7 +541319,7 @@ Error: sandbox required but unavailable: ${reason}
540213
541319
  });
540214
541320
  if (!shouldQuery) {
540215
541321
  if (newMessages.some(isCompactBoundaryMessage)) {
540216
- setConversationId(randomUUID48());
541322
+ setConversationId(randomUUID49());
540217
541323
  if (false) {}
540218
541324
  }
540219
541325
  resetLoadingState();
@@ -540828,9 +541934,11 @@ Error: sandbox required but unavailable: ${reason}
540828
541934
  rewindToMessageIndex: messageIndex
540829
541935
  });
540830
541936
  setMessages(prev.slice(0, messageIndex));
540831
- setConversationId(randomUUID48());
541937
+ setConversationId(randomUUID49());
540832
541938
  resetMicrocompactState();
540833
- if (false) {}
541939
+ if (true) {
541940
+ (init_contextCollapse(), __toCommonJS(exports_contextCollapse)).resetContextCollapse();
541941
+ }
540834
541942
  setAppState((prev2) => ({
540835
541943
  ...prev2,
540836
541944
  toolPermissionContext: message.permissionMode && prev2.toolPermissionContext.mode !== message.permissionMode ? {
@@ -541999,7 +543107,7 @@ Note: ctrl + z now suspends Vivus, ctrl + _ undoes input.
541999
543107
  setMessages(postCompact);
542000
543108
  }
542001
543109
  if (false) {}
542002
- setConversationId(randomUUID48());
543110
+ setConversationId(randomUUID49());
542003
543111
  runPostCompactCleanup(context2.options.querySource);
542004
543112
  if (direction === "from") {
542005
543113
  const r = textForResubmit(message);
@@ -542777,7 +543885,7 @@ function WelcomeV2() {
542777
543885
  dimColor: true,
542778
543886
  children: [
542779
543887
  "v",
542780
- "1.1.36+7725484",
543888
+ "1.1.37+d527bcf",
542781
543889
  " "
542782
543890
  ]
542783
543891
  }, undefined, true, undefined, this)
@@ -542977,7 +544085,7 @@ function WelcomeV2() {
542977
544085
  dimColor: true,
542978
544086
  children: [
542979
544087
  "v",
542980
- "1.1.36+7725484",
544088
+ "1.1.37+d527bcf",
542981
544089
  " "
542982
544090
  ]
542983
544091
  }, undefined, true, undefined, this)
@@ -543203,7 +544311,7 @@ function AppleTerminalWelcomeV2(t0) {
543203
544311
  dimColor: true,
543204
544312
  children: [
543205
544313
  "v",
543206
- "1.1.36+7725484",
544314
+ "1.1.37+d527bcf",
543207
544315
  " "
543208
544316
  ]
543209
544317
  }, undefined, true, undefined, this);
@@ -543457,7 +544565,7 @@ function AppleTerminalWelcomeV2(t0) {
543457
544565
  dimColor: true,
543458
544566
  children: [
543459
544567
  "v",
543460
- "1.1.36+7725484",
544568
+ "1.1.37+d527bcf",
543461
544569
  " "
543462
544570
  ]
543463
544571
  }, undefined, true, undefined, this);
@@ -546066,7 +547174,9 @@ function ResumeConversation({
546066
547174
  adoptResumedSessionFile();
546067
547175
  }
546068
547176
  }
546069
- if (false) {}
547177
+ if (true) {
547178
+ (init_persist(), __toCommonJS(exports_persist)).restoreFromEntries(result_3.contextCollapseCommits ?? [], result_3.contextCollapseSnapshot);
547179
+ }
546070
547180
  logEvent("tengu_session_resumed", {
546071
547181
  entrypoint: "picker",
546072
547182
  success: true,
@@ -546528,7 +547638,7 @@ function appendToLog(path25, message) {
546528
547638
  cwd: getFsImplementation().cwd(),
546529
547639
  userType: process.env.USER_TYPE,
546530
547640
  sessionId: getSessionId(),
546531
- version: "1.1.36+7725484"
547641
+ version: "1.1.37+d527bcf"
546532
547642
  };
546533
547643
  getLogWriter(path25).write(messageWithTimestamp);
546534
547644
  }
@@ -546978,7 +548088,9 @@ To attach: ${source_default.bold(`tmux attach -t ${tmuxSessionName}`)}`));
546978
548088
  logForDiagnosticsNoPII("info", "setup_background_jobs_starting");
546979
548089
  if (!isBareMode()) {
546980
548090
  initSessionMemory();
546981
- if (false) {}
548091
+ if (true) {
548092
+ (init_contextCollapse(), __toCommonJS(exports_contextCollapse)).initContextCollapse();
548093
+ }
546982
548094
  }
546983
548095
  lockCurrentVersion();
546984
548096
  logForDiagnosticsNoPII("info", "setup_background_jobs_launched");
@@ -547502,7 +548614,7 @@ function coalescePatches(base2, overlay) {
547502
548614
  var init_WorkerStateUploader = () => {};
547503
548615
 
547504
548616
  // src/cli/transports/ccrClient.ts
547505
- import { randomUUID as randomUUID49 } from "crypto";
548617
+ import { randomUUID as randomUUID50 } from "crypto";
547506
548618
  function alwaysValidStatus() {
547507
548619
  return true;
547508
548620
  }
@@ -547861,7 +548973,7 @@ class CCRClient {
547861
548973
  return {
547862
548974
  payload: {
547863
548975
  ...msg,
547864
- uuid: typeof msg.uuid === "string" ? msg.uuid : randomUUID49()
548976
+ uuid: typeof msg.uuid === "string" ? msg.uuid : randomUUID50()
547865
548977
  }
547866
548978
  };
547867
548979
  }
@@ -547885,7 +548997,7 @@ class CCRClient {
547885
548997
  payload: {
547886
548998
  type: eventType,
547887
548999
  ...payload,
547888
- uuid: typeof payload.uuid === "string" ? payload.uuid : randomUUID49()
549000
+ uuid: typeof payload.uuid === "string" ? payload.uuid : randomUUID50()
547889
549001
  },
547890
549002
  ...isCompaction && { is_compaction: true },
547891
549003
  ...agentId && { agent_id: agentId }
@@ -549393,7 +550505,7 @@ var init_queryContext = __esm(() => {
549393
550505
  });
549394
550506
 
549395
550507
  // src/QueryEngine.ts
549396
- import { randomUUID as randomUUID50 } from "crypto";
550508
+ import { randomUUID as randomUUID51 } from "crypto";
549397
550509
 
549398
550510
  class QueryEngine {
549399
550511
  config;
@@ -549690,7 +550802,7 @@ class QueryEngine {
549690
550802
  modelUsage: getModelUsage(),
549691
550803
  permission_denials: this.permissionDenials,
549692
550804
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
549693
- uuid: randomUUID50()
550805
+ uuid: randomUUID51()
549694
550806
  };
549695
550807
  return;
549696
550808
  }
@@ -549803,7 +550915,7 @@ class QueryEngine {
549803
550915
  event: message.event,
549804
550916
  session_id: getSessionId(),
549805
550917
  parent_tool_use_id: null,
549806
- uuid: randomUUID50()
550918
+ uuid: randomUUID51()
549807
550919
  };
549808
550920
  }
549809
550921
  break;
@@ -549835,7 +550947,7 @@ class QueryEngine {
549835
550947
  modelUsage: getModelUsage(),
549836
550948
  permission_denials: this.permissionDenials,
549837
550949
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
549838
- uuid: randomUUID50(),
550950
+ uuid: randomUUID51(),
549839
550951
  errors: [
549840
550952
  `Reached maximum number of turns (${message.attachment.maxTurns})`
549841
550953
  ]
@@ -549930,7 +551042,7 @@ class QueryEngine {
549930
551042
  modelUsage: getModelUsage(),
549931
551043
  permission_denials: this.permissionDenials,
549932
551044
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
549933
- uuid: randomUUID50(),
551045
+ uuid: randomUUID51(),
549934
551046
  errors: [`Reached maximum budget ($${maxBudgetUsd})`]
549935
551047
  };
549936
551048
  return;
@@ -549959,7 +551071,7 @@ class QueryEngine {
549959
551071
  modelUsage: getModelUsage(),
549960
551072
  permission_denials: this.permissionDenials,
549961
551073
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
549962
- uuid: randomUUID50(),
551074
+ uuid: randomUUID51(),
549963
551075
  errors: [
549964
551076
  `Failed to provide valid structured output after ${maxRetries} attempts`
549965
551077
  ]
@@ -549991,7 +551103,7 @@ class QueryEngine {
549991
551103
  modelUsage: getModelUsage(),
549992
551104
  permission_denials: this.permissionDenials,
549993
551105
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
549994
- uuid: randomUUID50(),
551106
+ uuid: randomUUID51(),
549995
551107
  errors: (() => {
549996
551108
  const all4 = getInMemoryErrors();
549997
551109
  const start = errorLogWatermark ? all4.lastIndexOf(errorLogWatermark) + 1 : 0;
@@ -550028,7 +551140,7 @@ class QueryEngine {
550028
551140
  permission_denials: this.permissionDenials,
550029
551141
  structured_output: structuredOutputFromTool,
550030
551142
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
550031
- uuid: randomUUID50()
551143
+ uuid: randomUUID51()
550032
551144
  };
550033
551145
  }
550034
551146
  interrupt() {
@@ -550205,9 +551317,9 @@ var init_idleTimeout = __esm(() => {
550205
551317
  });
550206
551318
 
550207
551319
  // src/bridge/inboundAttachments.ts
550208
- import { randomUUID as randomUUID51 } from "crypto";
551320
+ import { randomUUID as randomUUID52 } from "crypto";
550209
551321
  import { mkdir as mkdir43, writeFile as writeFile47 } from "fs/promises";
550210
- import { basename as basename55, join as join148 } from "path";
551322
+ import { basename as basename56, join as join148 } from "path";
550211
551323
  function debug(msg) {
550212
551324
  logForDebugging(`[bridge:inbound-attach] ${msg}`);
550213
551325
  }
@@ -550219,7 +551331,7 @@ function extractInboundAttachments(msg) {
550219
551331
  return parsed.success ? parsed.data : [];
550220
551332
  }
550221
551333
  function sanitizeFileName(name) {
550222
- const base2 = basename55(name).replace(/[^a-zA-Z0-9._-]/g, "_");
551334
+ const base2 = basename56(name).replace(/[^a-zA-Z0-9._-]/g, "_");
550223
551335
  return base2 || "attachment";
550224
551336
  }
550225
551337
  function uploadsDir() {
@@ -550250,7 +551362,7 @@ async function resolveOne(att) {
550250
551362
  return;
550251
551363
  }
550252
551364
  const safeName = sanitizeFileName(att.file_name);
550253
- const prefix = (att.file_uuid.slice(0, 8) || randomUUID51().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
551365
+ const prefix = (att.file_uuid.slice(0, 8) || randomUUID52().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
550254
551366
  const dir = uploadsDir();
550255
551367
  const outPath = join148(dir, `${prefix}-${safeName}`);
550256
551368
  try {
@@ -550314,11 +551426,11 @@ var init_inboundAttachments = __esm(() => {
550314
551426
  });
550315
551427
 
550316
551428
  // src/utils/sessionUrl.ts
550317
- import { randomUUID as randomUUID52 } from "crypto";
551429
+ import { randomUUID as randomUUID53 } from "crypto";
550318
551430
  function parseSessionIdentifier(resumeIdentifier) {
550319
551431
  if (resumeIdentifier.toLowerCase().endsWith(".jsonl")) {
550320
551432
  return {
550321
- sessionId: randomUUID52(),
551433
+ sessionId: randomUUID53(),
550322
551434
  ingressUrl: null,
550323
551435
  isUrl: false,
550324
551436
  jsonlFile: resumeIdentifier,
@@ -550337,7 +551449,7 @@ function parseSessionIdentifier(resumeIdentifier) {
550337
551449
  try {
550338
551450
  const url3 = new URL(resumeIdentifier);
550339
551451
  return {
550340
- sessionId: randomUUID52(),
551452
+ sessionId: randomUUID53(),
550341
551453
  ingressUrl: url3.href,
550342
551454
  isUrl: true,
550343
551455
  jsonlFile: null,
@@ -550513,8 +551625,8 @@ async function getEnvLessBridgeConfig() {
550513
551625
  }
550514
551626
  async function checkEnvLessBridgeMinVersion() {
550515
551627
  const cfg = await getEnvLessBridgeConfig();
550516
- if (cfg.min_version && lt("1.1.36+7725484", cfg.min_version)) {
550517
- return `Your version of Vivus (${"1.1.36+7725484"}) is too old for Remote Control.
551628
+ if (cfg.min_version && lt("1.1.37+d527bcf", cfg.min_version)) {
551629
+ return `Your version of Vivus (${"1.1.37+d527bcf"}) is too old for Remote Control.
550518
551630
  Version ${cfg.min_version} or higher is required. Run \`vivus update\` to update.`;
550519
551631
  }
550520
551632
  return null;
@@ -550946,7 +552058,7 @@ var init_bridgePointer = __esm(() => {
550946
552058
  });
550947
552059
 
550948
552060
  // src/bridge/replBridge.ts
550949
- import { randomUUID as randomUUID53 } from "crypto";
552061
+ import { randomUUID as randomUUID54 } from "crypto";
550950
552062
  async function initBridgeCore(params) {
550951
552063
  const {
550952
552064
  dir,
@@ -550988,7 +552100,7 @@ async function initBridgeCore(params) {
550988
552100
  const rawApi = createBridgeApiClient({
550989
552101
  baseUrl,
550990
552102
  getAccessToken,
550991
- runnerVersion: "1.1.36+7725484",
552103
+ runnerVersion: "1.1.37+d527bcf",
550992
552104
  onDebug: logForDebugging,
550993
552105
  onAuth401,
550994
552106
  getTrustedDeviceToken
@@ -551003,9 +552115,9 @@ async function initBridgeCore(params) {
551003
552115
  spawnMode: "single-session",
551004
552116
  verbose: false,
551005
552117
  sandbox: false,
551006
- bridgeId: randomUUID53(),
552118
+ bridgeId: randomUUID54(),
551007
552119
  workerType,
551008
- environmentId: randomUUID53(),
552120
+ environmentId: randomUUID54(),
551009
552121
  reuseEnvironmentId: prior?.environmentId,
551010
552122
  apiBaseUrl: baseUrl,
551011
552123
  sessionIngressUrl
@@ -552855,7 +553967,7 @@ __export(exports_print, {
552855
553967
  import { readFile as readFile52, stat as stat49 } from "fs/promises";
552856
553968
  import { dirname as dirname65 } from "path";
552857
553969
  import { cwd as cwd2 } from "process";
552858
- import { randomUUID as randomUUID54 } from "crypto";
553970
+ import { randomUUID as randomUUID55 } from "crypto";
552859
553971
  function trackReceivedMessageUuid(uuid3) {
552860
553972
  if (receivedMessageUuids.has(uuid3)) {
552861
553973
  return false;
@@ -552975,7 +554087,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
552975
554087
  hook_id: event.hookId,
552976
554088
  hook_name: event.hookName,
552977
554089
  hook_event: event.hookEvent,
552978
- uuid: randomUUID54(),
554090
+ uuid: randomUUID55(),
552979
554091
  session_id: getSessionId()
552980
554092
  };
552981
554093
  case "progress":
@@ -552988,7 +554100,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
552988
554100
  stdout: event.stdout,
552989
554101
  stderr: event.stderr,
552990
554102
  output: event.output,
552991
- uuid: randomUUID54(),
554103
+ uuid: randomUUID55(),
552992
554104
  session_id: getSessionId()
552993
554105
  };
552994
554106
  case "response":
@@ -553003,7 +554115,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
553003
554115
  stderr: event.stderr,
553004
554116
  exit_code: event.exitCode,
553005
554117
  outcome: event.outcome,
553006
- uuid: randomUUID54(),
554118
+ uuid: randomUUID55(),
553007
554119
  session_id: getSessionId()
553008
554120
  };
553009
554121
  }
@@ -553161,7 +554273,9 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
553161
554273
  }
553162
554274
  }
553163
554275
  logHeadlessProfilerTurn();
553164
- if (false) {}
554276
+ if (isExtractModeActive()) {
554277
+ await extractMemoriesModule3.drainPendingExtraction();
554278
+ }
553165
554279
  gracefulShutdownSync(lastMessage?.type === "result" && lastMessage?.is_error ? 1 : 0);
553166
554280
  }
553167
554281
  function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initialMessages, canUseTool, sdkMcpConfigs, getAppState, setAppState, agents2, options2, turnInterruptionState) {
@@ -553201,7 +554315,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
553201
554315
  subtype: "status",
553202
554316
  status: null,
553203
554317
  permissionMode: newMode,
553204
- uuid: randomUUID54(),
554318
+ uuid: randomUUID55(),
553205
554319
  session_id: getSessionId()
553206
554320
  });
553207
554321
  }
@@ -553222,7 +554336,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
553222
554336
  isAuthenticating: status2.isAuthenticating,
553223
554337
  output: status2.output,
553224
554338
  error: status2.error,
553225
- uuid: randomUUID54(),
554339
+ uuid: randomUUID55(),
553226
554340
  session_id: getSessionId()
553227
554341
  });
553228
554342
  });
@@ -553233,7 +554347,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
553233
554347
  output.enqueue({
553234
554348
  type: "rate_limit_event",
553235
554349
  rate_limit_info: rateLimitInfo,
553236
- uuid: randomUUID54(),
554350
+ uuid: randomUUID55(),
553237
554351
  session_id: getSessionId()
553238
554352
  });
553239
554353
  }
@@ -553249,7 +554363,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
553249
554363
  enqueue({
553250
554364
  mode: "prompt",
553251
554365
  value: turnInterruptionState.message.message.content,
553252
- uuid: randomUUID54()
554366
+ uuid: randomUUID55()
553253
554367
  });
553254
554368
  }
553255
554369
  const modelOptions = getModelOptions();
@@ -553342,7 +554456,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
553342
554456
  subtype: "elicitation_complete",
553343
554457
  mcp_server_name: serverName,
553344
554458
  elicitation_id: elicitationId,
553345
- uuid: randomUUID54(),
554459
+ uuid: randomUUID55(),
553346
554460
  session_id: getSessionId()
553347
554461
  });
553348
554462
  });
@@ -553687,7 +554801,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
553687
554801
  duration_ms: durationMsMatch ? parseInt(durationMsMatch[1], 10) : 0
553688
554802
  } : undefined,
553689
554803
  session_id: getSessionId(),
553690
- uuid: randomUUID54()
554804
+ uuid: randomUUID55()
553691
554805
  });
553692
554806
  }
553693
554807
  }
@@ -553761,7 +554875,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
553761
554875
  subtype: "status",
553762
554876
  status: status2,
553763
554877
  session_id: getSessionId(),
553764
- uuid: randomUUID54()
554878
+ uuid: randomUUID55()
553765
554879
  });
553766
554880
  }
553767
554881
  })) {
@@ -553809,7 +554923,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
553809
554923
  const suggestionMsg = {
553810
554924
  type: "prompt_suggestion",
553811
554925
  suggestion: result.suggestion,
553812
- uuid: randomUUID54(),
554926
+ uuid: randomUUID55(),
553813
554927
  session_id: getSessionId()
553814
554928
  };
553815
554929
  const lastEmittedEntry = {
@@ -553899,7 +555013,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
553899
555013
  usage: EMPTY_USAGE,
553900
555014
  modelUsage: {},
553901
555015
  permission_denials: [],
553902
- uuid: randomUUID54(),
555016
+ uuid: randomUUID55(),
553903
555017
  errors: [
553904
555018
  errorMessage(error41),
553905
555019
  ...getInMemoryErrors().map((_) => _.error)
@@ -553983,7 +555097,7 @@ ${m.text}
553983
555097
  enqueue({
553984
555098
  mode: "prompt",
553985
555099
  value: formatted,
553986
- uuid: randomUUID54()
555100
+ uuid: randomUUID55()
553987
555101
  });
553988
555102
  run();
553989
555103
  return;
@@ -553994,7 +555108,7 @@ ${m.text}
553994
555108
  enqueue({
553995
555109
  mode: "prompt",
553996
555110
  value: SHUTDOWN_TEAM_PROMPT,
553997
- uuid: randomUUID54()
555111
+ uuid: randomUUID55()
553998
555112
  });
553999
555113
  run();
554000
555114
  return;
@@ -554018,7 +555132,7 @@ ${m.text}
554018
555132
  enqueue({
554019
555133
  mode: "prompt",
554020
555134
  value: SHUTDOWN_TEAM_PROMPT,
554021
- uuid: randomUUID54()
555135
+ uuid: randomUUID55()
554022
555136
  });
554023
555137
  run();
554024
555138
  } else {
@@ -554767,7 +555881,7 @@ ${m.text}
554767
555881
  subtype: "bridge_state",
554768
555882
  state: state2,
554769
555883
  detail,
554770
- uuid: randomUUID54(),
555884
+ uuid: randomUUID55(),
554771
555885
  session_id: getSessionId()
554772
555886
  });
554773
555887
  },
@@ -554925,7 +556039,7 @@ function createCanUseToolWithPermissionPrompt(permissionPromptTool) {
554925
556039
  if (!permissionToolResultBlockParam.content || !Array.isArray(permissionToolResultBlockParam.content) || !permissionToolResultBlockParam.content[0] || permissionToolResultBlockParam.content[0].type !== "text" || typeof permissionToolResultBlockParam.content[0].text !== "string") {
554926
556040
  throw new Error('Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.');
554927
556041
  }
554928
- return permissionPromptToolResultToPermissionDecision(outputSchema32().parse(safeParseJSON(permissionToolResultBlockParam.content[0].text)), permissionPromptTool, input, toolUseContext);
556042
+ return permissionPromptToolResultToPermissionDecision(outputSchema33().parse(safeParseJSON(permissionToolResultBlockParam.content[0].text)), permissionPromptTool, input, toolUseContext);
554929
556043
  };
554930
556044
  return canUseTool;
554931
556045
  }
@@ -555075,7 +556189,7 @@ async function handleInitializeRequest(request, requestId, initialized5, output,
555075
556189
  isAuthenticating: status2.isAuthenticating,
555076
556190
  output: status2.output,
555077
556191
  error: status2.error,
555078
- uuid: randomUUID54(),
556192
+ uuid: randomUUID55(),
555079
556193
  session_id: getSessionId()
555080
556194
  });
555081
556195
  }
@@ -555274,7 +556388,7 @@ function emitLoadError(message, outputFormat) {
555274
556388
  usage: EMPTY_USAGE,
555275
556389
  modelUsage: {},
555276
556390
  permission_denials: [],
555277
- uuid: randomUUID54(),
556391
+ uuid: randomUUID55(),
555278
556392
  errors: [message]
555279
556393
  };
555280
556394
  process.stdout.write(jsonStringify(errorResult) + `
@@ -555655,7 +556769,7 @@ async function reconcileMcpServers(desiredConfigs, currentState2, setAppState) {
555655
556769
  newState
555656
556770
  };
555657
556771
  }
555658
- var SHUTDOWN_TEAM_PROMPT = `<system-reminder>
556772
+ var extractMemoriesModule3, SHUTDOWN_TEAM_PROMPT = `<system-reminder>
555659
556773
  You are running in non-interactive mode and cannot return a response to the user until your team is shut down.
555660
556774
 
555661
556775
  You MUST shut down your team before preparing your final response:
@@ -555788,6 +556902,7 @@ var init_print = __esm(() => {
555788
556902
  init_growthbook();
555789
556903
  init_errors();
555790
556904
  init_paths();
556905
+ extractMemoriesModule3 = (init_extractMemories(), __toCommonJS(exports_extractMemories));
555791
556906
  receivedMessageUuids = new Set;
555792
556907
  receivedMessageUuidsOrder = [];
555793
556908
  });
@@ -556664,7 +557779,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
556664
557779
  setCwd(cwd3);
556665
557780
  const server = new Server({
556666
557781
  name: "vivus/tengu",
556667
- version: "1.1.36+7725484"
557782
+ version: "1.1.37+d527bcf"
556668
557783
  }, {
556669
557784
  capabilities: {
556670
557785
  tools: {}
@@ -556675,11 +557790,11 @@ async function startMCPServer(cwd3, debug2, verbose) {
556675
557790
  const tools = getTools(toolPermissionContext);
556676
557791
  return {
556677
557792
  tools: await Promise.all(tools.map(async (tool) => {
556678
- let outputSchema33;
557793
+ let outputSchema34;
556679
557794
  if (tool.outputSchema) {
556680
557795
  const convertedSchema = zodToJsonSchema3(tool.outputSchema);
556681
557796
  if (typeof convertedSchema === "object" && convertedSchema !== null && "type" in convertedSchema && convertedSchema.type === "object") {
556682
- outputSchema33 = convertedSchema;
557797
+ outputSchema34 = convertedSchema;
556683
557798
  }
556684
557799
  }
556685
557800
  return {
@@ -556690,7 +557805,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
556690
557805
  agents: []
556691
557806
  }),
556692
557807
  inputSchema: zodToJsonSchema3(tool.inputSchema),
556693
- outputSchema: outputSchema33
557808
+ outputSchema: outputSchema34
556694
557809
  };
556695
557810
  }))
556696
557811
  };
@@ -557218,7 +558333,7 @@ __export(exports_plugins, {
557218
558333
  VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
557219
558334
  VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
557220
558335
  });
557221
- import { basename as basename56, dirname as dirname66 } from "path";
558336
+ import { basename as basename57, dirname as dirname66 } from "path";
557222
558337
  function handleMarketplaceError(error41, action2) {
557223
558338
  logError2(error41);
557224
558339
  cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error41)}`);
@@ -557252,7 +558367,7 @@ async function pluginValidateHandler(manifestPath, options2) {
557252
558367
  let contentResults = [];
557253
558368
  if (result.fileType === "plugin") {
557254
558369
  const manifestDir = dirname66(result.filePath);
557255
- if (basename56(manifestDir) === ".vivus-plugin" || basename56(manifestDir) === ".claude-plugin") {
558370
+ if (basename57(manifestDir) === ".vivus-plugin" || basename57(manifestDir) === ".claude-plugin") {
557256
558371
  contentResults = await validatePluginContents(dirname66(manifestDir));
557257
558372
  for (const r of contentResults) {
557258
558373
  console.log(`Validating ${r.fileType}: ${r.filePath}
@@ -558397,7 +559512,7 @@ __export(exports_update, {
558397
559512
  });
558398
559513
  async function update() {
558399
559514
  logEvent("tengu_update_check", {});
558400
- writeToStdout(`Current version: ${"1.1.36+7725484"}
559515
+ writeToStdout(`Current version: ${"1.1.37+d527bcf"}
558401
559516
  `);
558402
559517
  const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
558403
559518
  writeToStdout(`Checking for updates to ${channel} version...
@@ -558472,8 +559587,8 @@ async function update() {
558472
559587
  writeToStdout(`Vivus is managed by Homebrew.
558473
559588
  `);
558474
559589
  const latest = await getLatestVersion(channel);
558475
- if (latest && !gte("1.1.36+7725484", latest)) {
558476
- writeToStdout(`Update available: ${"1.1.36+7725484"} → ${latest}
559590
+ if (latest && !gte("1.1.37+d527bcf", latest)) {
559591
+ writeToStdout(`Update available: ${"1.1.37+d527bcf"} → ${latest}
558477
559592
  `);
558478
559593
  writeToStdout(`
558479
559594
  `);
@@ -558489,8 +559604,8 @@ async function update() {
558489
559604
  writeToStdout(`Vivus is managed by winget.
558490
559605
  `);
558491
559606
  const latest = await getLatestVersion(channel);
558492
- if (latest && !gte("1.1.36+7725484", latest)) {
558493
- writeToStdout(`Update available: ${"1.1.36+7725484"} → ${latest}
559607
+ if (latest && !gte("1.1.37+d527bcf", latest)) {
559608
+ writeToStdout(`Update available: ${"1.1.37+d527bcf"} → ${latest}
558494
559609
  `);
558495
559610
  writeToStdout(`
558496
559611
  `);
@@ -558506,8 +559621,8 @@ async function update() {
558506
559621
  writeToStdout(`Vivus is managed by apk.
558507
559622
  `);
558508
559623
  const latest = await getLatestVersion(channel);
558509
- if (latest && !gte("1.1.36+7725484", latest)) {
558510
- writeToStdout(`Update available: ${"1.1.36+7725484"} → ${latest}
559624
+ if (latest && !gte("1.1.37+d527bcf", latest)) {
559625
+ writeToStdout(`Update available: ${"1.1.37+d527bcf"} → ${latest}
558511
559626
  `);
558512
559627
  writeToStdout(`
558513
559628
  `);
@@ -558572,11 +559687,11 @@ async function update() {
558572
559687
  `);
558573
559688
  await gracefulShutdown(1);
558574
559689
  }
558575
- if (result.latestVersion === "1.1.36+7725484") {
558576
- writeToStdout(source_default.green(`Vivus is up to date (${"1.1.36+7725484"})`) + `
559690
+ if (result.latestVersion === "1.1.37+d527bcf") {
559691
+ writeToStdout(source_default.green(`Vivus is up to date (${"1.1.37+d527bcf"})`) + `
558577
559692
  `);
558578
559693
  } else {
558579
- writeToStdout(source_default.green(`Successfully updated from ${"1.1.36+7725484"} to version ${result.latestVersion}`) + `
559694
+ writeToStdout(source_default.green(`Successfully updated from ${"1.1.37+d527bcf"} to version ${result.latestVersion}`) + `
558580
559695
  `);
558581
559696
  await regenerateCompletionCache();
558582
559697
  }
@@ -558633,12 +559748,12 @@ async function update() {
558633
559748
  `);
558634
559749
  await gracefulShutdown(1);
558635
559750
  }
558636
- if (latestVersion === "1.1.36+7725484") {
558637
- writeToStdout(source_default.green(`Vivus is up to date (${"1.1.36+7725484"})`) + `
559751
+ if (latestVersion === "1.1.37+d527bcf") {
559752
+ writeToStdout(source_default.green(`Vivus is up to date (${"1.1.37+d527bcf"})`) + `
558638
559753
  `);
558639
559754
  await gracefulShutdown(0);
558640
559755
  }
558641
- writeToStdout(`New version available: ${latestVersion} (current: ${"1.1.36+7725484"})
559756
+ writeToStdout(`New version available: ${latestVersion} (current: ${"1.1.37+d527bcf"})
558642
559757
  `);
558643
559758
  writeToStdout(`Installing update...
558644
559759
  `);
@@ -558683,7 +559798,7 @@ async function update() {
558683
559798
  logForDebugging(`update: Installation status: ${status2}`);
558684
559799
  switch (status2) {
558685
559800
  case "success":
558686
- writeToStdout(source_default.green(`Successfully updated from ${"1.1.36+7725484"} to version ${latestVersion}`) + `
559801
+ writeToStdout(source_default.green(`Successfully updated from ${"1.1.37+d527bcf"} to version ${latestVersion}`) + `
558687
559802
  `);
558688
559803
  await regenerateCompletionCache();
558689
559804
  break;
@@ -559657,7 +560772,7 @@ function completeOnboarding() {
559657
560772
  saveGlobalConfig((current) => ({
559658
560773
  ...current,
559659
560774
  hasCompletedOnboarding: true,
559660
- lastOnboardingVersion: "1.1.36+7725484"
560775
+ lastOnboardingVersion: "1.1.37+d527bcf"
559661
560776
  }));
559662
560777
  }
559663
560778
  function showDialog(root2, renderer) {
@@ -561784,14 +562899,14 @@ var SKILL_FILES = {
561784
562899
 
561785
562900
  // src/skills/bundled/verify.ts
561786
562901
  var { frontmatter, content: SKILL_BODY } = parseFrontmatter(SKILL_MD);
561787
- var DESCRIPTION19 = typeof frontmatter.description === "string" ? frontmatter.description : "Verify a code change does what it should by running the app.";
562902
+ var DESCRIPTION20 = typeof frontmatter.description === "string" ? frontmatter.description : "Verify a code change does what it should by running the app.";
561788
562903
  function registerVerifySkill() {
561789
562904
  if (process.env.USER_TYPE !== "ant") {
561790
562905
  return;
561791
562906
  }
561792
562907
  registerBundledSkill({
561793
562908
  name: "verify",
561794
- description: DESCRIPTION19,
562909
+ description: DESCRIPTION20,
561795
562910
  userInvocable: true,
561796
562911
  files: SKILL_FILES,
561797
562912
  async getPromptForCommand(args) {
@@ -563876,7 +564991,7 @@ ${customInstructions}` : customInstructions;
563876
564991
  }
563877
564992
  }
563878
564993
  logForDiagnosticsNoPII("info", "started", {
563879
- version: "1.1.36+7725484",
564994
+ version: "1.1.37+d527bcf",
563880
564995
  is_native_binary: isInBundledMode()
563881
564996
  });
563882
564997
  registerCleanup(async () => {
@@ -564674,7 +565789,7 @@ Usage: vivus --remote "your task description"`, () => gracefulShutdown(1));
564674
565789
  pendingHookMessages
564675
565790
  }, renderAndRun);
564676
565791
  }
564677
- }).version("1.1.36+7725484 (Vivus)", "-v, --version", "Output the version number");
565792
+ }).version("1.1.37+d527bcf (Vivus)", "-v, --version", "Output the version number");
564678
565793
  program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
564679
565794
  program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
564680
565795
  if (canUserConfigureAdvisor()) {