@nomad-e/bluma-cli 0.24.1 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +769 -588
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -581,7 +581,7 @@ function getRuntimeConfig() {
581
581
  const mergedFeatures = { ...defaults.features, ...parseFeatures(parsed.features) };
582
582
  return {
583
583
  model: typeof parsed.model === "string" && parsed.model.trim() ? parsed.model.trim() : defaults.model,
584
- reasoningEffort: parsed.reasoningEffort === "low" || parsed.reasoningEffort === "medium" || parsed.reasoningEffort === "high" ? parsed.reasoningEffort : defaults.reasoningEffort,
584
+ reasoningEffort: parsed.reasoningEffort === "low" || parsed.reasoningEffort === "medium" || parsed.reasoningEffort === "high" || parsed.reasoningEffort === "off" ? parsed.reasoningEffort : defaults.reasoningEffort,
585
585
  outputStyle: parsed.outputStyle === "compact" || parsed.outputStyle === "brief" || parsed.outputStyle === "default" ? parsed.outputStyle : defaults.outputStyle,
586
586
  permissionMode,
587
587
  sandboxEnabled: typeof parsed.sandboxEnabled === "boolean" ? parsed.sandboxEnabled : defaults.sandboxEnabled,
@@ -2333,7 +2333,98 @@ function computeEffectiveInputBudget(rawBudget, toolDefinitions = [], options) {
2333
2333
  effectiveBudget
2334
2334
  };
2335
2335
  }
2336
- var MESSAGE_OVERHEAD_TOKENS, CONVERSATION_BASE_OVERHEAD, cachedEncoding, cacheVersion, cachedVersion, cachedCount, tokenStringCache, TOKEN_STRING_CACHE_MAX, DEFAULT_OUTPUT_TOKEN_RESERVE, DEFAULT_PROTOCOL_OVERHEAD_TOKENS;
2336
+ function estimateProviderInputTokens(messages, tools = [], options) {
2337
+ const protocolOverheadTokens = options?.protocolOverheadTokens ?? DEFAULT_PROTOCOL_OVERHEAD_TOKENS;
2338
+ return countTokens(messages, false) + countToolDefinitionsTokens(tools) + protocolOverheadTokens;
2339
+ }
2340
+ function truncateStringContent(content, maxChars) {
2341
+ if (content.length <= maxChars) return content;
2342
+ const budget = Math.max(120, maxChars - TRUNCATION_SUFFIX.length);
2343
+ return `${content.slice(0, budget)}${TRUNCATION_SUFFIX}`;
2344
+ }
2345
+ function shrinkMessageContent(msg, ratio) {
2346
+ const m = msg;
2347
+ if (typeof m.content === "string" && m.content.length > 0) {
2348
+ const nextLen = Math.max(200, Math.floor(m.content.length * ratio));
2349
+ return { ...msg, content: truncateStringContent(m.content, nextLen) };
2350
+ }
2351
+ if (Array.isArray(m.content)) {
2352
+ const text = m.content.filter((part) => part && typeof part === "object" && part.type === "text").map((part) => String(part.text ?? "")).join("\n");
2353
+ if (text.length > 0) {
2354
+ const nextLen = Math.max(200, Math.floor(text.length * ratio));
2355
+ return { ...msg, content: truncateStringContent(text, nextLen) };
2356
+ }
2357
+ }
2358
+ if (m.content != null) {
2359
+ const serialized = JSON.stringify(m.content);
2360
+ const nextLen = Math.max(200, Math.floor(serialized.length * ratio));
2361
+ return { ...msg, content: truncateStringContent(serialized, nextLen) };
2362
+ }
2363
+ if (Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {
2364
+ const cloned = m.tool_calls.map((call) => {
2365
+ const args = call?.function?.arguments;
2366
+ if (typeof args !== "string" || args.length === 0) return call;
2367
+ const nextLen = Math.max(120, Math.floor(args.length * ratio));
2368
+ return {
2369
+ ...call,
2370
+ function: {
2371
+ ...call.function,
2372
+ arguments: truncateStringContent(args, nextLen)
2373
+ }
2374
+ };
2375
+ });
2376
+ return { ...msg, tool_calls: cloned };
2377
+ }
2378
+ return msg;
2379
+ }
2380
+ function truncateMessagesToTokenBudget(messages, tokenBudget) {
2381
+ if (messages.length === 0 || tokenBudget <= 0) {
2382
+ return messages;
2383
+ }
2384
+ const result = messages.map((msg) => ({ ...msg }));
2385
+ const truncatableRoles = /* @__PURE__ */ new Set(["tool", "assistant"]);
2386
+ const truncatableIndices = [];
2387
+ for (let i = 0; i < result.length; i += 1) {
2388
+ const role = result[i].role;
2389
+ if (role && truncatableRoles.has(role)) {
2390
+ truncatableIndices.push(i);
2391
+ }
2392
+ }
2393
+ const recount = () => {
2394
+ invalidateTokenCache();
2395
+ return countTokens(result, true);
2396
+ };
2397
+ let tokens = recount();
2398
+ if (tokens <= tokenBudget) {
2399
+ return result;
2400
+ }
2401
+ const proportionalRatio = Math.min(0.85, Math.max(0.05, tokenBudget / tokens));
2402
+ for (const idx of truncatableIndices) {
2403
+ result[idx] = shrinkMessageContent(result[idx], proportionalRatio);
2404
+ }
2405
+ tokens = recount();
2406
+ let ratio = proportionalRatio * 0.5;
2407
+ for (let pass = 0; pass < 4 && tokens > tokenBudget; pass += 1) {
2408
+ for (const idx of truncatableIndices) {
2409
+ result[idx] = shrinkMessageContent(result[idx], ratio);
2410
+ }
2411
+ tokens = recount();
2412
+ ratio *= 0.5;
2413
+ }
2414
+ if (tokens > tokenBudget) {
2415
+ const sysIdx = result.findIndex((m) => m.role === "system");
2416
+ if (sysIdx >= 0) {
2417
+ let sysRatio = 0.5;
2418
+ for (let i = 0; i < 3 && tokens > tokenBudget; i += 1) {
2419
+ result[sysIdx] = shrinkMessageContent(result[sysIdx], sysRatio);
2420
+ tokens = recount();
2421
+ sysRatio *= 0.5;
2422
+ }
2423
+ }
2424
+ }
2425
+ return result;
2426
+ }
2427
+ var MESSAGE_OVERHEAD_TOKENS, CONVERSATION_BASE_OVERHEAD, cachedEncoding, cacheVersion, cachedVersion, cachedCount, tokenStringCache, TOKEN_STRING_CACHE_MAX, DEFAULT_OUTPUT_TOKEN_RESERVE, DEFAULT_PROTOCOL_OVERHEAD_TOKENS, TRUNCATION_SUFFIX;
2337
2428
  var init_token_counter = __esm({
2338
2429
  "src/app/agent/core/context-api/token_counter.ts"() {
2339
2430
  "use strict";
@@ -2347,6 +2438,7 @@ var init_token_counter = __esm({
2347
2438
  TOKEN_STRING_CACHE_MAX = 4096;
2348
2439
  DEFAULT_OUTPUT_TOKEN_RESERVE = 8192;
2349
2440
  DEFAULT_PROTOCOL_OVERHEAD_TOKENS = 512;
2441
+ TRUNCATION_SUFFIX = "\n\n[\u2026 truncated for context budget \u2026]";
2350
2442
  }
2351
2443
  });
2352
2444
 
@@ -2389,18 +2481,18 @@ function inspectConversationContext(history, options = {}) {
2389
2481
  const budgetUsedPercent = Math.round(totalTokens / tokenBudget * 100);
2390
2482
  const recommendations = [];
2391
2483
  if (budgetUsedPercent > 80) {
2392
- recommendations.push("\u26A0\uFE0F Contexto quase cheio. Considera /export e uma sess\xE3o nova ou pedir compress\xE3o ao agente.");
2484
+ recommendations.push("\u26A0\uFE0F Context nearly full. Consider /export and a new session, or ask the agent to compress.");
2393
2485
  } else if (budgetUsedPercent > 60) {
2394
- recommendations.push("\u{1F4A1} Uso de contexto moderado. A compress\xE3o autom\xE1tica pode ativar em breve.");
2486
+ recommendations.push("\u{1F4A1} Moderate context usage. Auto-compression may kick in soon.");
2395
2487
  }
2396
2488
  if (toolTokens > totalTokens * 0.4) {
2397
2489
  recommendations.push("\u{1F4CB} Resultados de tools ocupam muito contexto.");
2398
2490
  }
2399
2491
  if (history.length > 100) {
2400
- recommendations.push(`\u{1F4DD} ${history.length} mensagens no hist\xF3rico.`);
2492
+ recommendations.push(`\u{1F4DD} ${history.length} messages in history.`);
2401
2493
  }
2402
2494
  if (recommendations.length === 0) {
2403
- recommendations.push("\u2705 Contexto saud\xE1vel.");
2495
+ recommendations.push("\u2705 Healthy context.");
2404
2496
  }
2405
2497
  const result = {
2406
2498
  totalTokens,
@@ -3204,7 +3296,7 @@ __export(exportConversation_exports, {
3204
3296
  formatConversationMarkdown: () => formatConversationMarkdown,
3205
3297
  resolveExportOutputPath: () => resolveExportOutputPath
3206
3298
  });
3207
- import { promises as fs49 } from "fs";
3299
+ import { promises as fs48 } from "fs";
3208
3300
  import path54 from "path";
3209
3301
  function extractTextParts2(content) {
3210
3302
  if (typeof content === "string") {
@@ -3234,7 +3326,7 @@ function extractTextParts2(content) {
3234
3326
  return parts.join("\n").trim();
3235
3327
  }
3236
3328
  function formatBlock(text, language = "") {
3237
- if (!text) return "_\uFF08vazio\uFF09_";
3329
+ if (!text) return "_(empty)_";
3238
3330
  const fence = "```";
3239
3331
  const lang = language ? language : "";
3240
3332
  return `${fence}${lang}
@@ -3271,7 +3363,7 @@ function formatUserSection(msg) {
3271
3363
  const text = extractTextParts2(msg.content);
3272
3364
  if (!text && name !== "ui_slash_command") return null;
3273
3365
  if (name === "ui_slash_command") {
3274
- return `> **Comando:** \`${text.replace(/\n/g, " ")}\`
3366
+ return `> **Command:** \`${text.replace(/\n/g, " ")}\`
3275
3367
  `;
3276
3368
  }
3277
3369
  return `${text}
@@ -3289,7 +3381,7 @@ function formatAssistantSection(msg) {
3289
3381
  for (const call of toolCalls) {
3290
3382
  const toolName = String(call?.function?.name ?? "tool").trim() || "tool";
3291
3383
  const args = formatJsonValue(call?.function?.arguments);
3292
- lines.push(`#### Chamada \u2014 \`${toolName}\``);
3384
+ lines.push(`#### Call \u2014 \`${toolName}\``);
3293
3385
  if (args) {
3294
3386
  lines.push("");
3295
3387
  lines.push(formatBlock(args, "json"));
@@ -3297,15 +3389,15 @@ function formatAssistantSection(msg) {
3297
3389
  }
3298
3390
  }
3299
3391
  }
3300
- return lines.join("\n").trim() || "_\uFF08sem texto\uFF09_";
3392
+ return lines.join("\n").trim() || "_(no text)_";
3301
3393
  }
3302
3394
  function formatToolSection(msg) {
3303
3395
  const name = String(msg.name ?? "tool").trim() || "tool";
3304
3396
  const raw = msg.content;
3305
3397
  const text = typeof raw === "string" ? raw.trim() : formatJsonValue(raw);
3306
- const body = text || "_\uFF08vazio\uFF09_";
3398
+ const body = text || "_(empty)_";
3307
3399
  const looksJson = body.startsWith("{") && body.endsWith("}") || body.startsWith("[") && body.endsWith("]");
3308
- return `#### Resultado \u2014 \`${name}\`
3400
+ return `#### Result \u2014 \`${name}\`
3309
3401
 
3310
3402
  ${formatBlock(body, looksJson ? "json" : "")}
3311
3403
  `;
@@ -3313,13 +3405,13 @@ ${formatBlock(body, looksJson ? "json" : "")}
3313
3405
  function formatConversationMarkdown(sessionId, messages) {
3314
3406
  const exportedAt = (/* @__PURE__ */ new Date()).toISOString();
3315
3407
  const lines = [
3316
- "# BluMa \u2014 Export da conversa",
3408
+ "# BluMa \u2014 Conversation export",
3317
3409
  "",
3318
- "| Campo | Valor |",
3410
+ "| Field | Value |",
3319
3411
  "|-------|-------|",
3320
- `| **Sess\xE3o** | \`${sessionId}\` |`,
3321
- `| **Exportado** | ${exportedAt} |`,
3322
- `| **Mensagens** | ${messages.length} |`,
3412
+ `| **Session** | \`${sessionId}\` |`,
3413
+ `| **Exported** | ${exportedAt} |`,
3414
+ `| **Messages** | ${messages.length} |`,
3323
3415
  "",
3324
3416
  "---",
3325
3417
  ""
@@ -3334,12 +3426,12 @@ function formatConversationMarkdown(sessionId, messages) {
3334
3426
  if (!body) continue;
3335
3427
  turn += 1;
3336
3428
  included += 1;
3337
- lines.push(`## ${turn}. Utilizador`, "", body, "", "---", "");
3429
+ lines.push(`## ${turn}. User`, "", body, "", "---", "");
3338
3430
  continue;
3339
3431
  }
3340
3432
  if (role === "assistant") {
3341
3433
  included += 1;
3342
- lines.push(`## ${turn > 0 ? `${turn}. ` : ""}Assistente`, "", formatAssistantSection(msg), "", "---", "");
3434
+ lines.push(`## ${turn > 0 ? `${turn}. ` : ""}Assistant`, "", formatAssistantSection(msg), "", "---", "");
3343
3435
  continue;
3344
3436
  }
3345
3437
  if (role === "tool") {
@@ -3350,13 +3442,13 @@ function formatConversationMarkdown(sessionId, messages) {
3350
3442
  const fallback = extractTextParts2(msg.content);
3351
3443
  if (fallback) {
3352
3444
  included += 1;
3353
- lines.push(`## ${role || "mensagem"}`, "", fallback, "", "---", "");
3445
+ lines.push(`## ${role || "message"}`, "", fallback, "", "---", "");
3354
3446
  }
3355
3447
  }
3356
3448
  if (included === 0) {
3357
- lines.push("_Nenhuma mensagem vis\xEDvel para exportar nesta sess\xE3o._", "");
3449
+ lines.push("_No visible messages to export in this session._", "");
3358
3450
  }
3359
- lines.push("", "_Gerado por BluMa `/export`._", "");
3451
+ lines.push("", "_Generated by BluMa `/export`._", "");
3360
3452
  return lines.join("\n");
3361
3453
  }
3362
3454
  function resolveExportOutputPath(sessionId, options) {
@@ -3385,13 +3477,13 @@ async function exportConversationToFile(options) {
3385
3477
  if (visible.length === 0) {
3386
3478
  return {
3387
3479
  success: false,
3388
- error: "N\xE3o h\xE1 mensagens para exportar nesta sess\xE3o."
3480
+ error: "No messages to export in this session."
3389
3481
  };
3390
3482
  }
3391
3483
  const markdown = formatConversationMarkdown(sessionId, history);
3392
3484
  const filePath = resolveExportOutputPath(sessionId, { outputPath, defaultExportDir });
3393
- await fs49.mkdir(path54.dirname(filePath), { recursive: true });
3394
- await fs49.writeFile(filePath, markdown, "utf-8");
3485
+ await fs48.mkdir(path54.dirname(filePath), { recursive: true });
3486
+ await fs48.writeFile(filePath, markdown, "utf-8");
3395
3487
  return {
3396
3488
  success: true,
3397
3489
  filePath,
@@ -3433,7 +3525,7 @@ async function runCtxInspect(options) {
3433
3525
  budgetUsedPercent: 0,
3434
3526
  anchorExists: false,
3435
3527
  compressedTurns: 0,
3436
- recommendations: ["N\xE3o h\xE1 hist\xF3rico nesta sess\xE3o para inspecionar."]
3528
+ recommendations: ["No history in this session to inspect."]
3437
3529
  };
3438
3530
  }
3439
3531
  return inspectConversationContext(history, {
@@ -3447,15 +3539,15 @@ async function runCtxInspect(options) {
3447
3539
  function formatCtxInspectLines(result) {
3448
3540
  const lines = [
3449
3541
  `Tokens: ${result.totalTokens.toLocaleString()} / ${result.tokenBudget.toLocaleString()} (${result.budgetUsedPercent}%)`,
3450
- `Mensagens: ${result.totalMessages} \xB7 system ${result.systemTokens} \xB7 user ${result.userTokens} \xB7 assistant ${result.assistantTokens} \xB7 tool ${result.toolTokens}`,
3451
- result.anchorExists ? `Compress\xE3o: anchor ativo (${result.compressedTurns} fatias)` : "Compress\xE3o: sem anchor"
3542
+ `Messages: ${result.totalMessages} \xB7 system ${result.systemTokens} \xB7 user ${result.userTokens} \xB7 assistant ${result.assistantTokens} \xB7 tool ${result.toolTokens}`,
3543
+ result.anchorExists ? `Compression: active anchor (${result.compressedTurns} slices)` : "Compression: no anchor"
3452
3544
  ];
3453
3545
  for (const rec of result.recommendations) {
3454
3546
  lines.push(rec);
3455
3547
  }
3456
3548
  if (result.messages?.length) {
3457
3549
  lines.push("");
3458
- lines.push("\xDAltimas mensagens:");
3550
+ lines.push("Recent messages:");
3459
3551
  for (const m of result.messages) {
3460
3552
  lines.push(
3461
3553
  ` [${m.index}] ${m.role} (~${m.tokens} tok): ${m.contentPreview.replace(/\s+/g, " ").slice(0, 120)}`
@@ -14299,7 +14391,7 @@ var getInstance = (stdout, createInstance) => {
14299
14391
 
14300
14392
  // src/main.ts
14301
14393
  import { EventEmitter as EventEmitter7 } from "events";
14302
- import fs53 from "fs";
14394
+ import fs52 from "fs";
14303
14395
  import path58 from "path";
14304
14396
  import { fileURLToPath as fileURLToPath8 } from "url";
14305
14397
  import { spawn as spawn6 } from "child_process";
@@ -14588,7 +14680,7 @@ var getSlashCommands = () => [
14588
14680
  },
14589
14681
  {
14590
14682
  name: "/effort",
14591
- description: "open a menu to set reasoning effort: low, medium, high",
14683
+ description: "open a menu to set reasoning effort: low, medium, high, off",
14592
14684
  category: "inspect"
14593
14685
  },
14594
14686
  {
@@ -25099,6 +25191,7 @@ var HistoryCompressor = class {
25099
25191
  const thresholdTokens = tokenBudget * compressThreshold;
25100
25192
  let pendingSlices = turnSlices.slice(sliceCount, recentStart);
25101
25193
  let pendingFlat = pendingSlices.flat();
25194
+ invalidateTokenCache();
25102
25195
  let messages = this.assembleMessages(systemMessages, pendingFlat, recentFlat);
25103
25196
  let tokens = countTokens(messages, true);
25104
25197
  contextEventBus.emit("context:compression_start", {
@@ -25151,7 +25244,7 @@ var HistoryCompressor = class {
25151
25244
  }
25152
25245
  if (tokens > tokenBudget) {
25153
25246
  invalidateTokenCache();
25154
- const { capped, slices: cappedSlices } = this.enforceHardCap(
25247
+ const { capped } = this.enforceHardCap(
25155
25248
  systemMessages,
25156
25249
  recentSlices,
25157
25250
  tokenBudget
@@ -25159,6 +25252,11 @@ var HistoryCompressor = class {
25159
25252
  messages = capped;
25160
25253
  tokens = countTokens(messages, true);
25161
25254
  }
25255
+ if (tokens > tokenBudget) {
25256
+ invalidateTokenCache();
25257
+ messages = truncateMessagesToTokenBudget(messages, tokenBudget);
25258
+ tokens = countTokens(messages, true);
25259
+ }
25162
25260
  contextEventBus.emit("context:compression_end", {
25163
25261
  isCompressing: false,
25164
25262
  progress: 100,
@@ -25192,11 +25290,13 @@ var HistoryCompressor = class {
25192
25290
  enforceHardCap(systemMessages, recentSlices, tokenBudget) {
25193
25291
  let slices = [...recentSlices];
25194
25292
  let flat = slices.flat();
25293
+ invalidateTokenCache();
25195
25294
  let messages = this.assembleMessages(systemMessages, [], flat);
25196
25295
  let tokens = countTokens(messages, true);
25197
25296
  while (tokens > tokenBudget && slices.length > 1) {
25198
25297
  slices = slices.slice(1);
25199
25298
  flat = slices.flat();
25299
+ invalidateTokenCache();
25200
25300
  messages = this.assembleMessages(systemMessages, [], flat);
25201
25301
  tokens = countTokens(messages, true);
25202
25302
  }
@@ -25331,9 +25431,13 @@ function partitionConversationIntoTurnSlices(conversationHistory) {
25331
25431
  }
25332
25432
  return turns;
25333
25433
  }
25334
- var STATIC_CONTEXT_INPUT_BUDGET = 96e3;
25434
+ var STATIC_CONTEXT_WINDOW = 131072;
25435
+ var CONTEXT_TOKENIZER_SAFETY_MARGIN = 8192;
25436
+ function getContextWindowForModel(_modelName = "") {
25437
+ return STATIC_CONTEXT_WINDOW;
25438
+ }
25335
25439
  function getContextInputBudgetForModel(_modelName = "") {
25336
- return STATIC_CONTEXT_INPUT_BUDGET;
25440
+ return STATIC_CONTEXT_WINDOW - CONTEXT_TOKENIZER_SAFETY_MARGIN;
25337
25441
  }
25338
25442
 
25339
25443
  // src/app/agent/core/llm/llm.ts
@@ -25363,6 +25467,54 @@ function extractStreamingDelta(previous, next) {
25363
25467
  return curr;
25364
25468
  }
25365
25469
 
25470
+ // src/app/agent/core/llm/llm_errors.ts
25471
+ function collectErrorText(error) {
25472
+ if (error instanceof Error) {
25473
+ const parts = [error.message];
25474
+ const cause = error.cause;
25475
+ if (cause instanceof Error) {
25476
+ parts.push(cause.message);
25477
+ } else if (typeof cause === "string") {
25478
+ parts.push(cause);
25479
+ }
25480
+ return parts.join(" ");
25481
+ }
25482
+ if (typeof error === "string") {
25483
+ return error;
25484
+ }
25485
+ if (error && typeof error === "object") {
25486
+ const anyError = error;
25487
+ const chunks = [];
25488
+ if (typeof anyError.message === "string") chunks.push(anyError.message);
25489
+ if (typeof anyError.error === "string") chunks.push(anyError.error);
25490
+ if (typeof anyError.body === "string") chunks.push(anyError.body);
25491
+ return chunks.join(" ");
25492
+ }
25493
+ return "";
25494
+ }
25495
+ function isContextWindowValidationError(error) {
25496
+ const lower = collectErrorText(error).toLowerCase();
25497
+ return lower.includes("vllmvalidationerror") || lower.includes("vllm.exceptions") || lower.includes("maximum context length") || lower.includes("input prompt contains at least") || lower.includes("requested 0 output tokens") || lower.includes("reduce the length of the input prompt") || lower.includes("context length") || lower.includes("parameter=input_tokens");
25498
+ }
25499
+ function formatLlmUiError(error) {
25500
+ const rawMessage = error instanceof Error ? error.message : typeof error === "string" ? error : "Unknown error during LLM request.";
25501
+ const lower = rawMessage.toLowerCase();
25502
+ let message2 = "An unexpected error occurred while contacting the model.";
25503
+ if (lower.includes("timeout") || lower.includes("etimedout") || lower.includes("upstream_timeout")) {
25504
+ message2 = "BluMa took too long to respond.";
25505
+ } else if (lower.includes("connection") || lower.includes("econnrefused") || lower.includes("ehostunreach") || lower.includes("enotfound")) {
25506
+ message2 = "Could not connect to the model service.";
25507
+ } else if (lower.includes("401") || lower.includes("403") || lower.includes("unauthorized") || lower.includes("forbidden")) {
25508
+ message2 = "Authentication or authorization failed when contacting the model.";
25509
+ } else if (lower.includes("api")) {
25510
+ message2 = "Model API communication error.";
25511
+ }
25512
+ return {
25513
+ message: message2,
25514
+ rawMessage
25515
+ };
25516
+ }
25517
+
25366
25518
  // src/app/agent/core/llm/llm.ts
25367
25519
  init_logger();
25368
25520
  var llmLog = logger.child("llm");
@@ -25469,7 +25621,9 @@ function resolveReasoningEffortForRequest(params, runtimeConfig = getRuntimeConf
25469
25621
  if (policy.isSandbox) {
25470
25622
  return "low";
25471
25623
  }
25472
- return params.reasoning?.effort ?? runtimeConfig.reasoningEffort;
25624
+ const effort = params.reasoning?.effort ?? runtimeConfig.reasoningEffort;
25625
+ if (effort === "off") return void 0;
25626
+ return effort;
25473
25627
  }
25474
25628
  function buildChatCompletionRequestBody(params, runtimeConfig = getRuntimeConfig(), stream = false, options) {
25475
25629
  const tools = params.tools;
@@ -25754,6 +25908,9 @@ var LLMService = class {
25754
25908
  return resp;
25755
25909
  } catch (error) {
25756
25910
  lastError = error;
25911
+ if (isContextWindowValidationError(error)) {
25912
+ throw error;
25913
+ }
25757
25914
  logLLMRetry(stage, params, i, fallbacks.length, error, false);
25758
25915
  if (!isBadRequestLike(error)) {
25759
25916
  throw error;
@@ -25801,6 +25958,9 @@ var LLMService = class {
25801
25958
  break;
25802
25959
  } catch (error) {
25803
25960
  lastError = error;
25961
+ if (isContextWindowValidationError(error)) {
25962
+ throw error;
25963
+ }
25804
25964
  logLLMRetry(stage, params, i, fallbacks.length, error, true);
25805
25965
  if (!isBadRequestLike(error)) {
25806
25966
  throw error;
@@ -26878,6 +27038,9 @@ var BluMaToolRunner = class {
26878
27038
  }
26879
27039
  };
26880
27040
 
27041
+ // src/app/agent/bluma/core/bluma_turn_coordinator.ts
27042
+ init_token_counter();
27043
+
26881
27044
  // src/app/agent/session_manager/session_archive.ts
26882
27045
  init_bluma_app_dir();
26883
27046
  import path43 from "path";
@@ -26895,31 +27058,6 @@ async function archivePrunedConversationMessages(sessionId, messages) {
26895
27058
  return archiveFile;
26896
27059
  }
26897
27060
 
26898
- // src/app/agent/core/llm/llm_errors.ts
26899
- function isContextWindowValidationError(error) {
26900
- const rawMessage = error instanceof Error ? error.message : typeof error === "string" ? error : "";
26901
- const lower = rawMessage.toLowerCase();
26902
- return lower.includes("vllmvalidationerror") || lower.includes("maximum context length") || lower.includes("input prompt contains at least") || lower.includes("requested 0 output tokens") || lower.includes("context length");
26903
- }
26904
- function formatLlmUiError(error) {
26905
- const rawMessage = error instanceof Error ? error.message : typeof error === "string" ? error : "Unknown error during LLM request.";
26906
- const lower = rawMessage.toLowerCase();
26907
- let message2 = "Ocorreu um erro inesperado ao contactar o modelo.";
26908
- if (lower.includes("timeout") || lower.includes("etimedout") || lower.includes("upstream_timeout")) {
26909
- message2 = "O BluMa demorou demasiado a responder.";
26910
- } else if (lower.includes("connection") || lower.includes("econnrefused") || lower.includes("ehostunreach") || lower.includes("enotfound")) {
26911
- message2 = "N\xE3o foi poss\xEDvel conectar ao servi\xE7o do modelo.";
26912
- } else if (lower.includes("401") || lower.includes("403") || lower.includes("unauthorized") || lower.includes("forbidden")) {
26913
- message2 = "Falha de autentica\xE7\xE3o/autoriza\xE7\xE3o ao contactar o modelo.";
26914
- } else if (lower.includes("api")) {
26915
- message2 = "Erro de comunica\xE7\xE3o com a API do modelo.";
26916
- }
26917
- return {
26918
- message: message2,
26919
- rawMessage
26920
- };
26921
- }
26922
-
26923
27061
  // src/app/agent/core/llm/tool_call_normalizer.ts
26924
27062
  import { randomUUID } from "crypto";
26925
27063
  var ToolCallNormalizer = class {
@@ -27232,15 +27370,21 @@ var BluMaTurnCoordinator = class {
27232
27370
  history_preview: summarizeHistoryForLog(this.deps.history, 6)
27233
27371
  });
27234
27372
  const modelName = this.deps.llm.getModelName ? this.deps.llm.getModelName() : "auto";
27373
+ const toolDefinitions = this.deps.mcpClient.getAvailableTools();
27374
+ const providerContextWindow = getContextWindowForModel(modelName);
27235
27375
  const baseTokenBudget = getContextInputBudgetForModel(modelName);
27236
- const retryTokenBudget = Math.max(48e3, Math.floor(baseTokenBudget * 0.75));
27237
- const tokenBudgets = [baseTokenBudget, retryTokenBudget];
27376
+ const tokenBudgets = [
27377
+ baseTokenBudget,
27378
+ Math.max(48e3, Math.floor(baseTokenBudget * 0.75)),
27379
+ Math.max(32e3, Math.floor(baseTokenBudget * 0.5)),
27380
+ Math.max(24e3, Math.floor(baseTokenBudget * 0.35))
27381
+ ];
27238
27382
  const llmService = this.deps.llm;
27239
27383
  for (let attempt = 0; attempt < tokenBudgets.length; attempt += 1) {
27240
27384
  const tokenBudget = tokenBudgets[attempt];
27241
27385
  try {
27242
27386
  const {
27243
- messages: contextWindow,
27387
+ messages: builtContextWindow,
27244
27388
  prunedHistory,
27245
27389
  archivedMessages
27246
27390
  } = await this.deps.compressor.buildContextWindow(
@@ -27249,17 +27393,25 @@ var BluMaTurnCoordinator = class {
27249
27393
  this.deps.getLlmUserContext(),
27250
27394
  {
27251
27395
  tokenBudget,
27252
- toolDefinitions: this.deps.mcpClient.getAvailableTools(),
27396
+ toolDefinitions,
27253
27397
  skipSanitize: true
27254
27398
  // already sanitized above
27255
27399
  }
27256
27400
  );
27401
+ const contextWindow = this.fitContextWindowForProvider(
27402
+ builtContextWindow,
27403
+ toolDefinitions,
27404
+ providerContextWindow,
27405
+ tokenBudget
27406
+ );
27257
27407
  this.turnLog.debug("Context window prepared", {
27258
27408
  history_length: this.deps.history.length,
27259
27409
  context_window_length: contextWindow.length,
27260
27410
  pruned_history_length: prunedHistory?.length ?? null,
27261
27411
  archived_messages: archivedMessages.length,
27262
27412
  token_budget: tokenBudget,
27413
+ estimated_provider_input: estimateProviderInputTokens(contextWindow, toolDefinitions),
27414
+ provider_context_window: providerContextWindow,
27263
27415
  context_preview: summarizeHistoryForLog(contextWindow, 8)
27264
27416
  });
27265
27417
  if (prunedHistory) {
@@ -27387,6 +27539,29 @@ var BluMaTurnCoordinator = class {
27387
27539
  this.deps.persistSession();
27388
27540
  await this.continueConversation();
27389
27541
  }
27542
+ /**
27543
+ * Pre-flight guard: ensure estimated provider input stays below
27544
+ * context_window - max_output before calling vLLM.
27545
+ */
27546
+ fitContextWindowForProvider(messages, toolDefinitions, providerContextWindow, tokenBudget) {
27547
+ const maxProviderInput = providerContextWindow - DEFAULT_OUTPUT_TOKEN_RESERVE - 2048;
27548
+ let fitted = messages;
27549
+ let estimated = estimateProviderInputTokens(fitted, toolDefinitions);
27550
+ if (estimated <= maxProviderInput) {
27551
+ return fitted;
27552
+ }
27553
+ const messageBudget = computeEffectiveInputBudget(tokenBudget, toolDefinitions).effectiveBudget;
27554
+ fitted = truncateMessagesToTokenBudget(fitted, messageBudget);
27555
+ estimated = estimateProviderInputTokens(fitted, toolDefinitions);
27556
+ if (estimated > maxProviderInput) {
27557
+ const tighterBudget = Math.max(
27558
+ 8e3,
27559
+ Math.floor(messageBudget * (maxProviderInput / Math.max(estimated, 1)))
27560
+ );
27561
+ fitted = truncateMessagesToTokenBudget(fitted, tighterBudget);
27562
+ }
27563
+ return fitted;
27564
+ }
27390
27565
  async handleStreamingResponse(contextWindow) {
27391
27566
  const llmService = this.deps.llm;
27392
27567
  let accumulatedContent = "";
@@ -31296,7 +31471,7 @@ var WorkerTranscript = ({ sessionId, title, onClose }) => {
31296
31471
  /* @__PURE__ */ jsx19(Text, { dimColor: true, children: ` \xB7 ${title || sessionId.slice(0, 8)}...` }),
31297
31472
  /* @__PURE__ */ jsx19(Text, { dimColor: true, children: " \xB7 ESC fechar" })
31298
31473
  ] }),
31299
- /* @__PURE__ */ jsx19(Box_default, { flexDirection: "column", height: 20, children: messages.length === 0 ? /* @__PURE__ */ jsx19(Text, { dimColor: true, color: BLUMA_TERMINAL.muted, italic: true, children: "Nenhuma mensagem..." }) : messages.map((msg) => /* @__PURE__ */ jsxs10(Box_default, { flexDirection: "column", marginTop: 0, children: [
31474
+ /* @__PURE__ */ jsx19(Box_default, { flexDirection: "column", height: 20, children: messages.length === 0 ? /* @__PURE__ */ jsx19(Text, { dimColor: true, color: BLUMA_TERMINAL.muted, italic: true, children: "No messages..." }) : messages.map((msg) => /* @__PURE__ */ jsxs10(Box_default, { flexDirection: "column", marginTop: 0, children: [
31300
31475
  /* @__PURE__ */ jsxs10(Box_default, { flexDirection: "row", flexWrap: "wrap", alignItems: "baseline", children: [
31301
31476
  /* @__PURE__ */ jsxs10(Text, { dimColor: true, color: BLUMA_TERMINAL.muted, children: [
31302
31477
  "[",
@@ -33707,14 +33882,6 @@ import React22, { Suspense, useState as useState12 } from "react";
33707
33882
  import { structuredPatch } from "diff";
33708
33883
  var CONTEXT_LINES = 3;
33709
33884
  var DIFF_TIMEOUT_MS = 5e3;
33710
- function adjustHunkLineNumbers(hunks, offset) {
33711
- if (offset === 0) return hunks;
33712
- return hunks.map((h) => ({
33713
- ...h,
33714
- oldStart: h.oldStart + offset,
33715
- newStart: h.newStart + offset
33716
- }));
33717
- }
33718
33885
  var AMPERSAND_TOKEN = "<<:AMPERSAND_TOKEN:>>";
33719
33886
  var DOLLAR_TOKEN = "<<:DOLLAR_TOKEN:>>";
33720
33887
  function escapeForDiff(s) {
@@ -33796,84 +33963,6 @@ function patchToUnifiedDiffText(filePath, patch) {
33796
33963
  return text;
33797
33964
  }
33798
33965
 
33799
- // src/app/ui/utils/readEditContext.ts
33800
- import { promises as fs43 } from "fs";
33801
- var CHUNK_SIZE = 64 * 1024;
33802
- var CONTEXT_LINES2 = 3;
33803
- async function openForScan(filePath) {
33804
- try {
33805
- return await fs43.open(filePath, "r");
33806
- } catch (e) {
33807
- if (e.code === "ENOENT") return null;
33808
- throw e;
33809
- }
33810
- }
33811
- async function readCapped(handle, maxBytes = CHUNK_SIZE * 16) {
33812
- const stats = await handle.stat();
33813
- const size = Math.min(stats.size, maxBytes);
33814
- if (size === 0) return "";
33815
- const buffer = Buffer.alloc(size);
33816
- const { bytesRead } = await handle.read(buffer, 0, size, 0);
33817
- if (bytesRead === 0) return "";
33818
- return buffer.toString("utf8", 0, bytesRead).replace(/\r\n/g, "\n");
33819
- }
33820
- async function scanForContext(handle, oldString, contextLines = CONTEXT_LINES2) {
33821
- const content = await readCapped(handle);
33822
- if (content === null) {
33823
- return { content: "", lineOffset: 1, truncated: true };
33824
- }
33825
- const idx = content.indexOf(oldString);
33826
- if (idx === -1) {
33827
- return { content: "", lineOffset: 1, truncated: true };
33828
- }
33829
- let startPos = idx;
33830
- let linesBefore = 0;
33831
- while (startPos > 0 && linesBefore < contextLines) {
33832
- const prevNewline = content.lastIndexOf("\n", startPos - 1);
33833
- if (prevNewline === -1) break;
33834
- startPos = prevNewline;
33835
- linesBefore++;
33836
- }
33837
- if (startPos > 0 && content[startPos] === "\n") {
33838
- startPos++;
33839
- }
33840
- const endOfOld = idx + oldString.length;
33841
- let endPos = endOfOld;
33842
- let linesAfter = 0;
33843
- while (endPos < content.length && linesAfter < contextLines) {
33844
- const nextNewline = content.indexOf("\n", endPos);
33845
- if (nextNewline === -1) {
33846
- endPos = content.length;
33847
- break;
33848
- }
33849
- endPos = nextNewline + 1;
33850
- linesAfter++;
33851
- }
33852
- const linesBeforeStart = content.substring(0, startPos).split("\n").length;
33853
- return {
33854
- content: content.substring(startPos, endPos),
33855
- lineOffset: linesBeforeStart,
33856
- truncated: endPos < content.length || startPos > 0
33857
- };
33858
- }
33859
- async function readEditContext(filePath, oldString, contextLines = CONTEXT_LINES2) {
33860
- const handle = await openForScan(filePath);
33861
- if (handle === null) return null;
33862
- try {
33863
- if (oldString.length >= CHUNK_SIZE) {
33864
- const content = await readCapped(handle);
33865
- return {
33866
- content: content ?? "",
33867
- lineOffset: 1,
33868
- truncated: false
33869
- };
33870
- }
33871
- return await scanForContext(handle, oldString, contextLines);
33872
- } finally {
33873
- await handle.close();
33874
- }
33875
- }
33876
-
33877
33966
  // src/app/ui/components/SimpleDiff.tsx
33878
33967
  import { parsePatch, diffWordsWithSpace } from "diff";
33879
33968
  import { jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -34388,30 +34477,8 @@ var TERMINAL_RULE_CHAR = "\u2500";
34388
34477
 
34389
34478
  // src/app/ui/components/FileEditToolDiff.tsx
34390
34479
  import { jsx as jsx42 } from "react/jsx-runtime";
34391
- async function loadDiffData(filePath, oldString, newString, replaceAll) {
34392
- if (oldString.length >= CHUNK_SIZE) {
34393
- return diffToolInputsOnly(filePath, oldString, newString);
34394
- }
34395
- try {
34396
- const ctx = await readEditContext(filePath, oldString, CONTEXT_LINES);
34397
- if (ctx === null || ctx.truncated || ctx.content === "") {
34398
- return diffToolInputsOnly(filePath, oldString, newString);
34399
- }
34400
- const { patch } = getPatchForEdit({
34401
- filePath,
34402
- fileContents: ctx.content,
34403
- oldString,
34404
- newString,
34405
- replaceAll
34406
- });
34407
- return {
34408
- patch: adjustHunkLineNumbers(patch, ctx.lineOffset - 1),
34409
- firstLine: ctx.lineOffset === 1 ? ctx.content.split("\n")[0] ?? null : null,
34410
- fileContent: ctx.content
34411
- };
34412
- } catch (e) {
34413
- return diffToolInputsOnly(filePath, oldString, newString);
34414
- }
34480
+ async function loadDiffData(filePath, oldString, newString, _replaceAll) {
34481
+ return diffToolInputsOnly(filePath, oldString, newString);
34415
34482
  }
34416
34483
  function diffToolInputsOnly(filePath, oldString, newString) {
34417
34484
  const { patch } = getPatchForEdit({
@@ -34428,9 +34495,9 @@ function diffToolInputsOnly(filePath, oldString, newString) {
34428
34495
  }
34429
34496
  function DiffFrame({ children, placeholder }) {
34430
34497
  if (placeholder) {
34431
- return /* @__PURE__ */ jsx42(Box_default, { borderStyle: "dashed", borderColor: "subtle", borderLeft: false, borderRight: false, children: /* @__PURE__ */ jsx42(Text, { dimColor: true, children: "\u2026" }) });
34498
+ return /* @__PURE__ */ jsx42(Box_default, { children: /* @__PURE__ */ jsx42(Text, { dimColor: true, children: "\u2026" }) });
34432
34499
  }
34433
- return /* @__PURE__ */ jsx42(Box_default, { borderStyle: "dashed", borderColor: "subtle", borderLeft: false, borderRight: false, children });
34500
+ return /* @__PURE__ */ jsx42(Box_default, { children });
34434
34501
  }
34435
34502
  function DiffBody({
34436
34503
  promise,
@@ -34495,9 +34562,106 @@ function EditToolDiffPanel({
34495
34562
  ) }) : hasDiffText ? /* @__PURE__ */ jsx43(Box_default, { marginTop: 0, children: /* @__PURE__ */ jsx43(SimpleDiff, { text: diffText, maxHeight }) }) : /* @__PURE__ */ jsx43(Box_default, { marginTop: 0, children: /* @__PURE__ */ jsx43(Text, { dimColor: true, wrap: "wrap", children: "Diff preview unavailable" }) }) });
34496
34563
  }
34497
34564
 
34565
+ // src/app/ui/utils/editToolDiffUtils.ts
34566
+ var DIFF_OF_CHANGES = /Diff of changes:\r?\n/;
34567
+ function isRecord2(value) {
34568
+ return typeof value === "object" && value !== null && !Array.isArray(value);
34569
+ }
34570
+ function cleanText(value) {
34571
+ if (typeof value !== "string") return null;
34572
+ const text = value.trim();
34573
+ return text.length > 0 ? text : null;
34574
+ }
34575
+ function extractDiffFromEditMessage(message2) {
34576
+ if (!message2 || typeof message2 !== "string") return null;
34577
+ const match = message2.match(DIFF_OF_CHANGES);
34578
+ if (!match || match.index === void 0) return null;
34579
+ const rest = message2.slice(match.index + match[0].length).trim();
34580
+ return rest.length > 0 ? rest : null;
34581
+ }
34582
+ function extractDiffFromEditResult(result) {
34583
+ const normalized = normalizeToolResult(result);
34584
+ if (normalized.status === "error") {
34585
+ return null;
34586
+ }
34587
+ const data = normalized.data;
34588
+ if (typeof data === "string") {
34589
+ return extractDiffFromEditMessage(data) ?? cleanText(data);
34590
+ }
34591
+ if (isRecord2(data)) {
34592
+ const directFields = [
34593
+ data.combinedDiff,
34594
+ data.diff,
34595
+ data.patch,
34596
+ data.result_diff
34597
+ ];
34598
+ for (const field of directFields) {
34599
+ const text = cleanText(field);
34600
+ if (text) return text;
34601
+ }
34602
+ const message2 = cleanText(data.message);
34603
+ if (message2) {
34604
+ return extractDiffFromEditMessage(message2) ?? message2;
34605
+ }
34606
+ }
34607
+ return null;
34608
+ }
34609
+
34498
34610
  // src/app/agent/tools/EditTool/UI.tsx
34499
34611
  import { diffLines as diffLines2 } from "diff";
34500
34612
  import { Fragment as Fragment4, jsx as jsx44, jsxs as jsxs27 } from "react/jsx-runtime";
34613
+ function isEditPayloadError(payload) {
34614
+ if (!payload || typeof payload !== "object") return false;
34615
+ const p = payload;
34616
+ return Boolean(p.error || p.success === false);
34617
+ }
34618
+ function canRenderArgsDiff(args) {
34619
+ const p = args;
34620
+ return typeof p?.file_path === "string" && typeof p?.old_string === "string" && typeof p?.new_string === "string";
34621
+ }
34622
+ function renderArgsDiffPanel(args) {
34623
+ return /* @__PURE__ */ jsx44(
34624
+ EditToolDiffPanel,
34625
+ {
34626
+ filePath: args.file_path,
34627
+ isNewFile: args.old_string === "",
34628
+ oldString: args.old_string,
34629
+ newString: args.new_string
34630
+ }
34631
+ );
34632
+ }
34633
+ function renderEditDiffBody({
34634
+ args,
34635
+ result,
34636
+ payload
34637
+ }) {
34638
+ const diffFromResult = payload != null ? extractDiffFromEditResult(result ?? payload) : null;
34639
+ const filePath = typeof payload?.file_path === "string" && payload.file_path || (canRenderArgsDiff(args) ? args.file_path : "unknown");
34640
+ if (diffFromResult) {
34641
+ return /* @__PURE__ */ jsx44(
34642
+ EditToolDiffPanel,
34643
+ {
34644
+ filePath,
34645
+ isNewFile: Boolean(payload?.is_new_file ?? args?.old_string === ""),
34646
+ diffText: diffFromResult
34647
+ }
34648
+ );
34649
+ }
34650
+ if (canRenderArgsDiff(args)) {
34651
+ return renderArgsDiffPanel(args);
34652
+ }
34653
+ if (payload != null) {
34654
+ const node = renderToolResultMessage12(payload, result);
34655
+ if (node) return /* @__PURE__ */ jsx44(Fragment4, { children: node });
34656
+ }
34657
+ return /* @__PURE__ */ jsxs27(Fragment4, { children: [
34658
+ renderToolUseMessage12({ args }),
34659
+ args?.edits && /* @__PURE__ */ jsxs27(Text, { dimColor: true, children: [
34660
+ "Edits to be applied: ",
34661
+ args.edits.length
34662
+ ] })
34663
+ ] });
34664
+ }
34501
34665
  function countLineDiff(oldText, newText) {
34502
34666
  const parts = diffLines2(oldText.replace(/\r\n/g, "\n"), newText.replace(/\r\n/g, "\n"));
34503
34667
  let added = 0;
@@ -34614,24 +34778,10 @@ function renderToolMessage11({
34614
34778
  /* @__PURE__ */ jsx44(ToolUseLoader, { state: state2 ?? "pending" }),
34615
34779
  renderToolHeader12({ args })
34616
34780
  ] }),
34617
- /* @__PURE__ */ jsx44(Box_default, { flexDirection: "column", paddingLeft: 1, marginTop: 0, children: payload != null ? renderToolResultMessage12(payload) : /* @__PURE__ */ jsx44(Fragment4, { children: args?.file_path && args?.old_string !== void 0 && args?.new_string !== void 0 ? /* @__PURE__ */ jsx44(
34618
- EditToolDiffPanel,
34619
- {
34620
- filePath: args.file_path,
34621
- isNewFile: args.old_string === "",
34622
- oldString: args.old_string,
34623
- newString: args.new_string
34624
- }
34625
- ) : /* @__PURE__ */ jsxs27(Fragment4, { children: [
34626
- renderToolUseMessage12({ args }),
34627
- args?.edits && /* @__PURE__ */ jsxs27(Text, { dimColor: true, children: [
34628
- "Edits to be applied: ",
34629
- args.edits.length
34630
- ] })
34631
- ] }) }) })
34781
+ /* @__PURE__ */ jsx44(Box_default, { flexDirection: "column", paddingLeft: 1, marginTop: 0, children: payload != null && isEditPayloadError(payload) ? renderToolResultMessage12(payload, result) : renderEditDiffBody({ args, result, payload }) })
34632
34782
  ] }) }) });
34633
34783
  }
34634
- function renderToolResultMessage12(result) {
34784
+ function renderToolResultMessage12(result, rawResult) {
34635
34785
  if (!result || result.error) {
34636
34786
  return /* @__PURE__ */ jsx44(Box_default, { flexDirection: "column", marginLeft: 1, children: /* @__PURE__ */ jsxs27(Box_default, { flexDirection: "row", children: [
34637
34787
  /* @__PURE__ */ jsx44(Text, { color: BLUMA_TERMINAL.subtle, children: "\u2514\u2500 " }),
@@ -34651,12 +34801,16 @@ function renderToolResultMessage12(result) {
34651
34801
  }
34652
34802
  ) }, `result-edit-${idx}`)) });
34653
34803
  }
34654
- return /* @__PURE__ */ jsx44(Box_default, { flexDirection: "column", children: result.diff && /* @__PURE__ */ jsx44(Box_default, { marginLeft: 1, children: /* @__PURE__ */ jsx44(
34804
+ const diffText = (typeof result.diff === "string" && result.diff.trim() ? result.diff : null) ?? extractDiffFromEditResult(rawResult ?? result);
34805
+ if (!diffText) {
34806
+ return null;
34807
+ }
34808
+ return /* @__PURE__ */ jsx44(Box_default, { flexDirection: "column", children: /* @__PURE__ */ jsx44(Box_default, { marginLeft: 1, children: /* @__PURE__ */ jsx44(
34655
34809
  EditToolDiffPanel,
34656
34810
  {
34657
34811
  filePath: result.file_path,
34658
34812
  isNewFile: result.is_new_file ?? false,
34659
- diffText: result.diff
34813
+ diffText
34660
34814
  }
34661
34815
  ) }) });
34662
34816
  }
@@ -35452,7 +35606,7 @@ var loadSkillTool = createTool({
35452
35606
  });
35453
35607
 
35454
35608
  // src/app/agent/tools/FileWriteTool/UI.tsx
35455
- import fs44 from "fs";
35609
+ import fs43 from "fs";
35456
35610
  import { diffLines as diffLines3 } from "diff";
35457
35611
  import { jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";
35458
35612
  function getFilePath(args) {
@@ -35467,7 +35621,7 @@ function getFilePath(args) {
35467
35621
  function readExistingFileText(filePath) {
35468
35622
  if (!filePath) return "";
35469
35623
  try {
35470
- return fs44.readFileSync(filePath, "utf-8");
35624
+ return fs43.readFileSync(filePath, "utf-8");
35471
35625
  } catch {
35472
35626
  return "";
35473
35627
  }
@@ -35507,6 +35661,20 @@ function buildUnifiedDiffText(filePath, oldContent, newContent) {
35507
35661
  });
35508
35662
  return patchToUnifiedDiffText(filePath, patch);
35509
35663
  }
35664
+ function isFileWritePayloadError(payload) {
35665
+ if (!payload || typeof payload !== "object") return false;
35666
+ const p = payload;
35667
+ return Boolean(p.error || p.status === "error" || p.success === false);
35668
+ }
35669
+ function renderArgsFileWriteDiff(args) {
35670
+ const filePath = getFilePath(args);
35671
+ const content = args.content;
35672
+ if (!filePath || !content.trim()) return null;
35673
+ const isNewFile = !args.hasExistingContent;
35674
+ const previousContent = isNewFile ? "" : readExistingFileText(filePath);
35675
+ const diffText = buildUnifiedDiffText(filePath, previousContent, content);
35676
+ return /* @__PURE__ */ jsx54(Box_default, { width: "100%", flexGrow: 1, flexDirection: "column", children: /* @__PURE__ */ jsx54(SimpleDiff, { text: diffText, maxHeight: 2e3 }) });
35677
+ }
35510
35678
  function userFacingName20(args) {
35511
35679
  if (!args) return "Wrote";
35512
35680
  const p = getFilePath(args)?.split("/").pop() ?? "...";
@@ -35544,7 +35712,13 @@ function renderToolMessage20({
35544
35712
  /* @__PURE__ */ jsx54(ToolUseLoader, { state: state2 ?? "pending" }),
35545
35713
  renderToolHeader21({ args: p })
35546
35714
  ] }),
35547
- /* @__PURE__ */ jsx54(Box_default, { flexDirection: "column", paddingLeft: 1, children: payload != null ? renderToolResultMessage21(payload, { filePath, content }) : /* @__PURE__ */ jsx54(Box_default, { flexDirection: "column", children: /* @__PURE__ */ jsx54(Box_default, { marginTop: 0, width: "100%", children: content ? /* @__PURE__ */ jsx54(Box_default, { width: "100%", flexGrow: 1, flexDirection: "column", children: /* @__PURE__ */ jsx54(SimpleDiff, { text: diffText, maxHeight: 2e3 }) }) : /* @__PURE__ */ jsxs37(Text, { dimColor: true, children: [
35715
+ /* @__PURE__ */ jsx54(Box_default, { flexDirection: "column", paddingLeft: 1, children: payload != null && isFileWritePayloadError(payload) ? renderToolResultMessage21(payload, { filePath, content }) : content.trim() && filePath ? renderArgsFileWriteDiff(p) ?? /* @__PURE__ */ jsxs37(Text, { dimColor: true, children: [
35716
+ "Writing to ",
35717
+ filePath,
35718
+ " (",
35719
+ content.length,
35720
+ " bytes)"
35721
+ ] }) : payload != null ? renderToolResultMessage21(payload, { filePath, content, args: p }) : /* @__PURE__ */ jsx54(Box_default, { flexDirection: "column", children: /* @__PURE__ */ jsx54(Box_default, { marginTop: 0, width: "100%", children: content ? /* @__PURE__ */ jsx54(Box_default, { width: "100%", flexGrow: 1, flexDirection: "column", children: /* @__PURE__ */ jsx54(SimpleDiff, { text: diffText, maxHeight: 2e3 }) }) : /* @__PURE__ */ jsxs37(Text, { dimColor: true, children: [
35548
35722
  "Writing to ",
35549
35723
  filePath ?? "...",
35550
35724
  " (",
@@ -35568,14 +35742,21 @@ function renderToolResultMessage21(result, context) {
35568
35742
  const resultFilePath = filePath || context?.filePath || "file.txt";
35569
35743
  const previousContent = typeof payload.previous_content === "string" ? payload.previous_content : void 0;
35570
35744
  const currentContent = typeof payload.content === "string" ? payload.content : typeof context?.args?.content === "string" ? (context?.args).content : typeof context?.content === "string" ? context.content : void 0;
35571
- const canRenderDiff = typeof currentContent === "string" && currentContent.trim() && typeof previousContent === "string";
35745
+ const argsContent = typeof context?.args?.content === "string" ? (context?.args).content : void 0;
35746
+ const effectiveContent = currentContent ?? argsContent;
35747
+ const effectivePrevious = typeof previousContent === "string" ? previousContent : effectiveContent && resultFilePath ? readExistingFileText(resultFilePath) : void 0;
35748
+ const canRenderDiff = typeof effectiveContent === "string" && effectiveContent.trim() && typeof effectivePrevious === "string";
35572
35749
  return /* @__PURE__ */ jsx54(Box_default, { flexDirection: "column", children: canRenderDiff ? /* @__PURE__ */ jsx54(Box_default, { width: "100%", flexGrow: 1, children: /* @__PURE__ */ jsx54(
35573
35750
  SimpleDiff,
35574
35751
  {
35575
- text: buildUnifiedDiffText(resultFilePath, previousContent ?? "", currentContent ?? ""),
35752
+ text: buildUnifiedDiffText(
35753
+ resultFilePath,
35754
+ effectivePrevious ?? "",
35755
+ effectiveContent ?? ""
35756
+ ),
35576
35757
  maxHeight: 2e3
35577
35758
  }
35578
- ) }) : typeof currentContent === "string" && currentContent.trim() ? /* @__PURE__ */ jsx54(
35759
+ ) }) : typeof effectiveContent === "string" && effectiveContent.trim() ? /* @__PURE__ */ jsx54(
35579
35760
  Box_default,
35580
35761
  {
35581
35762
  width: "100%",
@@ -35583,7 +35764,7 @@ function renderToolResultMessage21(result, context) {
35583
35764
  children: /* @__PURE__ */ jsx54(
35584
35765
  HighlightedCode,
35585
35766
  {
35586
- code: currentContent,
35767
+ code: effectiveContent,
35587
35768
  filePath: resultFilePath,
35588
35769
  maxLines: 2e3
35589
35770
  }
@@ -38409,7 +38590,7 @@ import {
38409
38590
 
38410
38591
  // src/app/ui/hooks/useAtCompletion.ts
38411
38592
  import { useEffect as useEffect11, useRef as useRef4, useState as useState13 } from "react";
38412
- import fs45 from "fs";
38593
+ import fs44 from "fs";
38413
38594
  import path51 from "path";
38414
38595
  var MAX_RESULTS3 = 50;
38415
38596
  var DEFAULT_RECURSIVE_DEPTH = 2;
@@ -38444,7 +38625,7 @@ function listPathSuggestions(baseDir, pattern) {
38444
38625
  while (queue.length && results.length < MAX_RESULTS3) {
38445
38626
  const node = queue.shift();
38446
38627
  try {
38447
- const entries = fs45.readdirSync(node.dir, { withFileTypes: true });
38628
+ const entries = fs44.readdirSync(node.dir, { withFileTypes: true });
38448
38629
  for (const entry of entries) {
38449
38630
  if (isIgnoredName(entry.name)) continue;
38450
38631
  const entryAbs = path51.join(node.dir, entry.name);
@@ -38461,7 +38642,7 @@ function listPathSuggestions(baseDir, pattern) {
38461
38642
  }
38462
38643
  }
38463
38644
  } else {
38464
- const entries = fs45.readdirSync(listDir, { withFileTypes: true });
38645
+ const entries = fs44.readdirSync(listDir, { withFileTypes: true });
38465
38646
  for (const entry of entries) {
38466
38647
  if (filterPrefix && !entry.name.startsWith(filterPrefix)) continue;
38467
38648
  if (isIgnoredName(entry.name)) continue;
@@ -38668,7 +38849,7 @@ var SlashSubmenuInlineComponent = ({ menu }) => {
38668
38849
  var SlashSubmenuInline = memo15(SlashSubmenuInlineComponent);
38669
38850
 
38670
38851
  // src/app/ui/utils/clipboardImage.ts
38671
- import fs46 from "fs";
38852
+ import fs45 from "fs";
38672
38853
  import os32 from "os";
38673
38854
  import path52 from "path";
38674
38855
  import { spawn as spawn5, execFile as execFileCb, execSync as execSync4 } from "child_process";
@@ -38820,14 +39001,14 @@ function resolveHelperBinary(cmd) {
38820
39001
  for (const dir of unixClipboardHelperDirs()) {
38821
39002
  const full = path52.join(dir, cmd);
38822
39003
  try {
38823
- fs46.accessSync(full, fs46.constants.X_OK);
39004
+ fs45.accessSync(full, fs45.constants.X_OK);
38824
39005
  return full;
38825
39006
  } catch {
38826
39007
  }
38827
39008
  }
38828
39009
  for (const dir of unixClipboardHelperDirs()) {
38829
39010
  const full = path52.join(dir, cmd);
38830
- if (fs46.existsSync(full)) {
39011
+ if (fs45.existsSync(full)) {
38831
39012
  return full;
38832
39013
  }
38833
39014
  }
@@ -38872,13 +39053,13 @@ function writeBufferIfImage(baseDir, buf) {
38872
39053
  baseDir,
38873
39054
  `clip-${Date.now()}-${Math.random().toString(36).slice(2, 8)}${ext}`
38874
39055
  );
38875
- fs46.writeFileSync(out, buf);
39056
+ fs45.writeFileSync(out, buf);
38876
39057
  return out;
38877
39058
  }
38878
39059
  function unlinkQuiet(p) {
38879
39060
  try {
38880
- if (fs46.existsSync(p)) {
38881
- fs46.unlinkSync(p);
39061
+ if (fs45.existsSync(p)) {
39062
+ fs45.unlinkSync(p);
38882
39063
  }
38883
39064
  } catch {
38884
39065
  }
@@ -38895,12 +39076,12 @@ async function tryDarwinClipboardy(baseDir) {
38895
39076
  return null;
38896
39077
  }
38897
39078
  for (const src of tmpPaths) {
38898
- if (!src || !fs46.existsSync(src)) {
39079
+ if (!src || !fs45.existsSync(src)) {
38899
39080
  continue;
38900
39081
  }
38901
39082
  let st;
38902
39083
  try {
38903
- st = fs46.statSync(src);
39084
+ st = fs45.statSync(src);
38904
39085
  } catch {
38905
39086
  continue;
38906
39087
  }
@@ -38913,7 +39094,7 @@ async function tryDarwinClipboardy(baseDir) {
38913
39094
  baseDir,
38914
39095
  `clip-${Date.now()}-${Math.random().toString(36).slice(2, 8)}${safeExt}`
38915
39096
  );
38916
- fs46.copyFileSync(src, out);
39097
+ fs45.copyFileSync(src, out);
38917
39098
  for (const p of tmpPaths) {
38918
39099
  unlinkQuiet(p);
38919
39100
  }
@@ -38934,7 +39115,7 @@ async function tryWindowsPowerShell(outFile) {
38934
39115
  "v1.0",
38935
39116
  "powershell.exe"
38936
39117
  ) : "powershell.exe";
38937
- if (!fs46.existsSync(ps)) {
39118
+ if (!fs45.existsSync(ps)) {
38938
39119
  return false;
38939
39120
  }
38940
39121
  const script = "$ErrorActionPreference='Stop';Add-Type -AssemblyName System.Windows.Forms;Add-Type -AssemblyName System.Drawing;$img=[System.Windows.Forms.Clipboard]::GetImage();if($null -eq $img){exit 2};$img.Save($env:BLUMA_CLIP_OUT,[System.Drawing.Imaging.ImageFormat]::Png);exit 0";
@@ -38956,7 +39137,7 @@ async function tryWindowsPowerShell(outFile) {
38956
39137
  return false;
38957
39138
  }
38958
39139
  try {
38959
- const st = fs46.statSync(outFile);
39140
+ const st = fs45.statSync(outFile);
38960
39141
  return st.size >= 80 && st.size <= CLIPBOARD_MAX_BYTES;
38961
39142
  } catch {
38962
39143
  return false;
@@ -39043,8 +39224,8 @@ async function tryClipboardTextAsImageFile(baseDir) {
39043
39224
  const abs = parseClipboardTextAsImagePath(t);
39044
39225
  if (!abs) return null;
39045
39226
  try {
39046
- if (!fs46.existsSync(abs)) return null;
39047
- const st = fs46.statSync(abs);
39227
+ if (!fs45.existsSync(abs)) return null;
39228
+ const st = fs45.statSync(abs);
39048
39229
  if (!st.isFile() || st.size > CLIPBOARD_MAX_BYTES || st.size < 20) return null;
39049
39230
  } catch {
39050
39231
  return null;
@@ -39055,7 +39236,7 @@ async function tryClipboardTextAsImageFile(baseDir) {
39055
39236
  `clip-${Date.now()}-${Math.random().toString(36).slice(2, 8)}${ext}`
39056
39237
  );
39057
39238
  try {
39058
- fs46.copyFileSync(abs, out);
39239
+ fs45.copyFileSync(abs, out);
39059
39240
  return out;
39060
39241
  } catch {
39061
39242
  return null;
@@ -39087,11 +39268,11 @@ printf '%s' "$OUT"
39087
39268
  maxBuffer: 4096
39088
39269
  });
39089
39270
  const written = String(stdout ?? "").trim();
39090
- if (written !== outPath || !fs46.existsSync(outPath)) {
39271
+ if (written !== outPath || !fs45.existsSync(outPath)) {
39091
39272
  unlinkQuiet(outPath);
39092
39273
  return null;
39093
39274
  }
39094
- const buf = fs46.readFileSync(outPath);
39275
+ const buf = fs45.readFileSync(outPath);
39095
39276
  unlinkQuiet(outPath);
39096
39277
  return writeBufferIfImage(baseDir, buf);
39097
39278
  } catch {
@@ -39112,8 +39293,8 @@ async function tryNativeClipboardImage() {
39112
39293
  }
39113
39294
  try {
39114
39295
  const result = readClipboardImageNative();
39115
- if (fs46.existsSync(result.path)) {
39116
- const st = fs46.statSync(result.path);
39296
+ if (fs45.existsSync(result.path)) {
39297
+ const st = fs45.statSync(result.path);
39117
39298
  if (st.size >= 80 && st.size <= CLIPBOARD_MAX_BYTES) {
39118
39299
  return result.path;
39119
39300
  }
@@ -39124,7 +39305,7 @@ async function tryNativeClipboardImage() {
39124
39305
  }
39125
39306
  async function readClipboardImageToTempFile() {
39126
39307
  const baseDir = path52.join(os32.homedir(), ".cache", "bluma", "clipboard");
39127
- fs46.mkdirSync(baseDir, { recursive: true });
39308
+ fs45.mkdirSync(baseDir, { recursive: true });
39128
39309
  const nativeResult = await tryNativeClipboardImage();
39129
39310
  if (nativeResult) {
39130
39311
  return nativeResult;
@@ -39183,7 +39364,7 @@ function expandLargePastePlaceholder(value, pending) {
39183
39364
  }
39184
39365
 
39185
39366
  // src/app/ui/components/InputPrompt.tsx
39186
- import fs47 from "fs";
39367
+ import fs46 from "fs";
39187
39368
  import { Fragment as Fragment7, jsx as jsx79, jsxs as jsxs62 } from "react/jsx-runtime";
39188
39369
  var persistedInputState = { text: "", cursorPosition: 0 };
39189
39370
  var StaticCursor = () => /* @__PURE__ */ jsx79(Box_default, { flexDirection: "row", flexWrap: "nowrap", children: /* @__PURE__ */ jsx79(Text, { bold: true, color: BLUMA_TERMINAL.m3OnSurface, children: "\u2588 " }) });
@@ -39350,7 +39531,7 @@ var InputPrompt = memo16(({
39350
39531
  return;
39351
39532
  }
39352
39533
  if (routeText.startsWith("/")) {
39353
- const isFilePath = map.size > 0 && fs47.existsSync(routeText.split(/\s+/)[0]);
39534
+ const isFilePath = map.size > 0 && fs46.existsSync(routeText.split(/\s+/)[0]);
39354
39535
  if (isFilePath) {
39355
39536
  uiEventBus.emit("user_overlay", {
39356
39537
  kind: "message",
@@ -40425,7 +40606,7 @@ var AssistantMessageDisplay = memo22(AssistantMessageDisplayComponent);
40425
40606
 
40426
40607
  // src/app/ui/utils/sessionHistoryRender.tsx
40427
40608
  import { jsx as jsx89, jsxs as jsxs72 } from "react/jsx-runtime";
40428
- function isRecord2(value) {
40609
+ function isRecord3(value) {
40429
40610
  return typeof value === "object" && value !== null && !Array.isArray(value);
40430
40611
  }
40431
40612
  function parseJsonMaybe(value) {
@@ -40456,7 +40637,7 @@ function extractTextParts(content) {
40456
40637
  }
40457
40638
  const parts = [];
40458
40639
  for (const part of content) {
40459
- if (!isRecord2(part)) continue;
40640
+ if (!isRecord3(part)) continue;
40460
40641
  if (part.type === "text" && typeof part.text === "string") {
40461
40642
  const text = part.text.trim();
40462
40643
  if (text) parts.push(text);
@@ -40485,7 +40666,7 @@ function renderUserContent(content) {
40485
40666
  return /* @__PURE__ */ jsx89(ChatUserMessage, { children: /* @__PURE__ */ jsx89(Text, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: fallback }) });
40486
40667
  }
40487
40668
  const imageParts = content.filter((part) => {
40488
- if (!isRecord2(part)) return false;
40669
+ if (!isRecord3(part)) return false;
40489
40670
  return part.type === "image_url" || part.type === "input_image" || "image_url" in part;
40490
40671
  });
40491
40672
  const text = extractTextParts(content);
@@ -40935,8 +41116,8 @@ var runModelSet = (_agentRef, model, _setIsProcessing, _markTurnStarted) => {
40935
41116
  return slashSuccess("Model", "updated");
40936
41117
  };
40937
41118
  var runEffortSet = (_agentRef, effort, _setIsProcessing, _markTurnStarted) => {
40938
- if (!["low", "medium", "high"].includes(effort)) {
40939
- return slashError("Effort: use low, medium, or high.");
41119
+ if (!["low", "medium", "high", "off"].includes(effort)) {
41120
+ return slashError("Effort: use low, medium, high, or off.");
40940
41121
  }
40941
41122
  setRuntimeConfig({ reasoningEffort: effort });
40942
41123
  return slashSuccess("Effort", "updated");
@@ -41359,7 +41540,7 @@ function buildSkillsView(skills, options) {
41359
41540
  };
41360
41541
  }
41361
41542
  function formatSkillDescription(skill) {
41362
- return truncate4(skill.description || "sem descri\xE7\xE3o");
41543
+ return truncate4(skill.description || "no description");
41363
41544
  }
41364
41545
 
41365
41546
  // src/app/ui/components/slash-commands/renderers/infoRenderers.tsx
@@ -41386,16 +41567,16 @@ var renderSkills = (filter) => {
41386
41567
  /* @__PURE__ */ jsxs78(Text, { dimColor: true, children: [
41387
41568
  " ",
41388
41569
  "\xB7 ",
41389
- view.total === 0 ? "nenhuma" : `${view.total} total`,
41570
+ view.total === 0 ? "none" : `${view.total} total`,
41390
41571
  countSummary ? ` (${countSummary})` : ""
41391
41572
  ] })
41392
41573
  ] }),
41393
41574
  filter?.trim() ? /* @__PURE__ */ jsxs78(Text, { dimColor: true, children: [
41394
- 'Filtro: "',
41575
+ 'Filter: "',
41395
41576
  filter.trim(),
41396
41577
  '"'
41397
- ] }) : /* @__PURE__ */ jsx95(Text, { dimColor: true, children: "Uso: /skills ou /skills <filtro>" }),
41398
- /* @__PURE__ */ jsx95(Box_default, { flexDirection: "column", marginTop: 1, children: view.total === 0 ? /* @__PURE__ */ jsx95(Text, { dimColor: true, children: "Nenhuma skill corresponde ao filtro." }) : view.groups.map((group) => /* @__PURE__ */ jsxs78(Box_default, { flexDirection: "column", marginBottom: 1, children: [
41578
+ ] }) : /* @__PURE__ */ jsx95(Text, { dimColor: true, children: "Usage: /skills or /skills <filter>" }),
41579
+ /* @__PURE__ */ jsx95(Box_default, { flexDirection: "column", marginTop: 1, children: view.total === 0 ? /* @__PURE__ */ jsx95(Text, { dimColor: true, children: "No skills match the filter." }) : view.groups.map((group) => /* @__PURE__ */ jsxs78(Box_default, { flexDirection: "column", marginBottom: 1, children: [
41399
41580
  /* @__PURE__ */ jsxs78(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: [
41400
41581
  group.label,
41401
41582
  " ",
@@ -41417,15 +41598,15 @@ var renderSkills = (filter) => {
41417
41598
  ] }, `${group.source}-${skill.name}`))
41418
41599
  ] }, group.source)) }),
41419
41600
  view.conflictWarnings.length > 0 ? /* @__PURE__ */ jsxs78(Box_default, { flexDirection: "column", marginTop: 1, children: [
41420
- /* @__PURE__ */ jsx95(Text, { bold: true, color: "yellow", children: "Conflitos de nome" }),
41601
+ /* @__PURE__ */ jsx95(Text, { bold: true, color: "yellow", children: "Name conflicts" }),
41421
41602
  view.conflictWarnings.map((w, i) => /* @__PURE__ */ jsxs78(Text, { dimColor: true, wrap: "truncate", children: [
41422
41603
  "\xB7 ",
41423
41604
  w
41424
41605
  ] }, i))
41425
41606
  ] }) : null,
41426
- /* @__PURE__ */ jsx95(Box_default, { marginTop: 1, children: /* @__PURE__ */ jsx95(Text, { dimColor: true, children: "Carregar: o agente usa load_skill <nome>" }) })
41607
+ /* @__PURE__ */ jsx95(Box_default, { marginTop: 1, children: /* @__PURE__ */ jsx95(Text, { dimColor: true, children: "Load: the agent uses load_skill <name>" }) })
41427
41608
  ] }),
41428
- { title: "Skills", subtitle: "Por origem: nativas \u2192 projeto \u2192 global" }
41609
+ { title: "Skills", subtitle: "By source: bundled \u2192 project \u2192 global" }
41429
41610
  );
41430
41611
  };
41431
41612
  var renderMcp = (filter) => {
@@ -41477,7 +41658,7 @@ var renderCtxInspect = (lines) => {
41477
41658
  /* @__PURE__ */ jsxs78(Fragment15, { children: [
41478
41659
  /* @__PURE__ */ jsxs78(Box_default, { marginBottom: 1, children: [
41479
41660
  /* @__PURE__ */ jsx95(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Context" }),
41480
- /* @__PURE__ */ jsx95(Text, { dimColor: true, children: " \xB7 inspe\xE7\xE3o da conversa atual" })
41661
+ /* @__PURE__ */ jsx95(Text, { dimColor: true, children: " \xB7 current conversation inspection" })
41481
41662
  ] }),
41482
41663
  /* @__PURE__ */ jsx95(Box_default, { flexDirection: "column", children: lines.map((line, i) => /* @__PURE__ */ jsx95(Text, { dimColor: line === "", children: line === "" ? " " : line }, i)) })
41483
41664
  ] })
@@ -41485,16 +41666,6 @@ var renderCtxInspect = (lines) => {
41485
41666
  };
41486
41667
 
41487
41668
  // src/app/ui/components/slash-commands/renderers/staticRenderers.tsx
41488
- import { Fragment as Fragment16, jsx as jsx96, jsxs as jsxs79 } from "react/jsx-runtime";
41489
- var renderExportUsage = () => {
41490
- return outBox(
41491
- /* @__PURE__ */ jsxs79(Fragment16, { children: [
41492
- /* @__PURE__ */ jsx96(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Export" }),
41493
- /* @__PURE__ */ jsx96(Text, { dimColor: true, children: " \xB7 exporta a conversa atual para Markdown no diret\xF3rio de trabalho" }),
41494
- /* @__PURE__ */ jsx96(Text, { dimColor: true, children: " \xB7 uso: /export ou /export caminho/para/ficheiro.md" })
41495
- ] })
41496
- );
41497
- };
41498
41669
  var renderSettingsUnknown = () => {
41499
41670
  return usageBox("Settings", "Unknown setting. Use /settings to see available options.");
41500
41671
  };
@@ -41505,7 +41676,7 @@ var renderSettingsEditUsage = () => {
41505
41676
  // src/app/agent/core/thread/thread_store.ts
41506
41677
  init_bluma_app_dir();
41507
41678
  import path53 from "path";
41508
- import { promises as fs48 } from "fs";
41679
+ import { promises as fs47 } from "fs";
41509
41680
  import { randomUUID as randomUUID2 } from "crypto";
41510
41681
  var INDEX_VERSION = 1;
41511
41682
  var fileLocks2 = /* @__PURE__ */ new Map();
@@ -41540,10 +41711,10 @@ var ThreadStore = class {
41540
41711
  * Inicializa o diretório de threads
41541
41712
  */
41542
41713
  async initialize() {
41543
- await fs48.mkdir(this.threadsDir, { recursive: true });
41544
- await fs48.mkdir(this.archiveDir, { recursive: true });
41714
+ await fs47.mkdir(this.threadsDir, { recursive: true });
41715
+ await fs47.mkdir(this.archiveDir, { recursive: true });
41545
41716
  try {
41546
- await fs48.access(this.indexPath);
41717
+ await fs47.access(this.indexPath);
41547
41718
  } catch {
41548
41719
  await this.saveIndex({ version: INDEX_VERSION, threads: [], lastUpdated: (/* @__PURE__ */ new Date()).toISOString() });
41549
41720
  }
@@ -41572,7 +41743,7 @@ var ThreadStore = class {
41572
41743
  async loadIndex() {
41573
41744
  return withFileLock2(this.indexPath, async () => {
41574
41745
  try {
41575
- const content = await fs48.readFile(this.indexPath, "utf-8");
41746
+ const content = await fs47.readFile(this.indexPath, "utf-8");
41576
41747
  return JSON.parse(content);
41577
41748
  } catch {
41578
41749
  return { version: INDEX_VERSION, threads: [], lastUpdated: (/* @__PURE__ */ new Date()).toISOString() };
@@ -41583,8 +41754,8 @@ var ThreadStore = class {
41583
41754
  return withFileLock2(this.indexPath, async () => {
41584
41755
  index.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
41585
41756
  const tempPath = `${this.indexPath}.${Date.now()}.tmp`;
41586
- await fs48.writeFile(tempPath, JSON.stringify(index, null, 2), "utf-8");
41587
- await fs48.rename(tempPath, this.indexPath);
41757
+ await fs47.writeFile(tempPath, JSON.stringify(index, null, 2), "utf-8");
41758
+ await fs47.rename(tempPath, this.indexPath);
41588
41759
  });
41589
41760
  }
41590
41761
  // ==================== Git Info ====================
@@ -41654,7 +41825,7 @@ var ThreadStore = class {
41654
41825
  messages: params.initialMessages || []
41655
41826
  };
41656
41827
  const historyPath = this.buildDatedThreadHistoryPath(threadId);
41657
- await fs48.mkdir(path53.dirname(historyPath), { recursive: true });
41828
+ await fs47.mkdir(path53.dirname(historyPath), { recursive: true });
41658
41829
  await this.saveHistoryAtPath(historyPath, history);
41659
41830
  const index = await this.loadIndex();
41660
41831
  index.threads.unshift({
@@ -41709,7 +41880,7 @@ var ThreadStore = class {
41709
41880
  compressedSliceCount: source.history.compressedSliceCount
41710
41881
  };
41711
41882
  const historyPath = this.buildDatedThreadHistoryPath(newThreadId);
41712
- await fs48.mkdir(path53.dirname(historyPath), { recursive: true });
41883
+ await fs47.mkdir(path53.dirname(historyPath), { recursive: true });
41713
41884
  await this.saveHistoryAtPath(historyPath, history);
41714
41885
  const index = await this.loadIndex();
41715
41886
  index.threads.unshift({
@@ -41784,7 +41955,7 @@ var ThreadStore = class {
41784
41955
  const oldPath = entry.historyPath || this.getLegacyHistoryPath(threadId);
41785
41956
  const newPath = path53.join(this.archiveDir, `${threadId}.jsonl`);
41786
41957
  try {
41787
- await fs48.rename(oldPath, newPath);
41958
+ await fs47.rename(oldPath, newPath);
41788
41959
  } catch (e) {
41789
41960
  if (e.code !== "ENOENT") throw e;
41790
41961
  }
@@ -41807,9 +41978,9 @@ var ThreadStore = class {
41807
41978
  if (entry.status === "active") return true;
41808
41979
  const oldPath = path53.join(this.archiveDir, `${threadId}.jsonl`);
41809
41980
  const newPath = this.buildDatedThreadHistoryPath(threadId);
41810
- await fs48.mkdir(path53.dirname(newPath), { recursive: true });
41981
+ await fs47.mkdir(path53.dirname(newPath), { recursive: true });
41811
41982
  try {
41812
- await fs48.rename(oldPath, newPath);
41983
+ await fs47.rename(oldPath, newPath);
41813
41984
  } catch (e) {
41814
41985
  if (e.code !== "ENOENT") throw e;
41815
41986
  }
@@ -41830,7 +42001,7 @@ var ThreadStore = class {
41830
42001
  if (entryIndex === -1) return false;
41831
42002
  const entry = index.threads[entryIndex];
41832
42003
  try {
41833
- await fs48.unlink(entry.historyPath);
42004
+ await fs47.unlink(entry.historyPath);
41834
42005
  } catch {
41835
42006
  }
41836
42007
  index.threads.splice(entryIndex, 1);
@@ -41854,14 +42025,14 @@ var ThreadStore = class {
41854
42025
  const entry = index.threads.find((t) => t.threadId === threadId);
41855
42026
  if (entry?.historyPath) {
41856
42027
  try {
41857
- await fs48.access(entry.historyPath);
42028
+ await fs47.access(entry.historyPath);
41858
42029
  return entry.historyPath;
41859
42030
  } catch {
41860
42031
  }
41861
42032
  }
41862
42033
  const legacy = this.getLegacyHistoryPath(threadId);
41863
42034
  try {
41864
- await fs48.access(legacy);
42035
+ await fs47.access(legacy);
41865
42036
  return legacy;
41866
42037
  } catch {
41867
42038
  return entry?.historyPath ?? legacy;
@@ -41878,9 +42049,9 @@ var ThreadStore = class {
41878
42049
  for (const msg of history.messages) {
41879
42050
  lines.push(JSON.stringify({ type: "message", ...msg }));
41880
42051
  }
41881
- await fs48.mkdir(path53.dirname(historyPath), { recursive: true }).catch(() => {
42052
+ await fs47.mkdir(path53.dirname(historyPath), { recursive: true }).catch(() => {
41882
42053
  });
41883
- await fs48.writeFile(historyPath, lines.join("\n") + "\n", "utf-8");
42054
+ await fs47.writeFile(historyPath, lines.join("\n") + "\n", "utf-8");
41884
42055
  }
41885
42056
  /**
41886
42057
  * Guarda o histórico de uma thread
@@ -41902,7 +42073,7 @@ var ThreadStore = class {
41902
42073
  ].filter((p, i, arr) => Boolean(p) && arr.indexOf(p) === i);
41903
42074
  for (const historyPath of pathsToTry) {
41904
42075
  try {
41905
- const content = await fs48.readFile(historyPath, "utf-8");
42076
+ const content = await fs47.readFile(historyPath, "utf-8");
41906
42077
  const lines = content.split("\n").filter(Boolean);
41907
42078
  const history = {
41908
42079
  threadId,
@@ -41937,7 +42108,7 @@ var ThreadStore = class {
41937
42108
  const entry = index.threads.find((t) => t.threadId === threadId);
41938
42109
  if (!entry) throw new Error(`Thread not found: ${threadId}`);
41939
42110
  const lines = messages.map((msg) => JSON.stringify({ type: "message", ...msg }));
41940
- await fs48.appendFile(entry.historyPath, lines.join("\n") + "\n", "utf-8");
42111
+ await fs47.appendFile(entry.historyPath, lines.join("\n") + "\n", "utf-8");
41941
42112
  entry.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
41942
42113
  await this.saveIndex(index);
41943
42114
  }
@@ -42202,10 +42373,10 @@ function getThreadManager() {
42202
42373
  }
42203
42374
 
42204
42375
  // src/app/ui/components/slash-commands/renderers/threadRenderers.tsx
42205
- import { Fragment as Fragment17, jsx as jsx97, jsxs as jsxs80 } from "react/jsx-runtime";
42376
+ import { Fragment as Fragment16, jsx as jsx96, jsxs as jsxs79 } from "react/jsx-runtime";
42206
42377
  function formatDate(iso) {
42207
42378
  const d = new Date(iso);
42208
- return d.toLocaleString("pt-PT", {
42379
+ return d.toLocaleString("en-US", {
42209
42380
  day: "2-digit",
42210
42381
  month: "2-digit",
42211
42382
  hour: "2-digit",
@@ -42219,10 +42390,10 @@ function formatRelativeTime(iso) {
42219
42390
  const diffMins = Math.floor(diffMs / 6e4);
42220
42391
  const diffHours = Math.floor(diffMs / 36e5);
42221
42392
  const diffDays = Math.floor(diffMs / 864e5);
42222
- if (diffMins < 1) return "agora";
42223
- if (diffMins < 60) return `h\xE1 ${diffMins}m`;
42224
- if (diffHours < 24) return `h\xE1 ${diffHours}h`;
42225
- if (diffDays < 7) return `h\xE1 ${diffDays}d`;
42393
+ if (diffMins < 1) return "now";
42394
+ if (diffMins < 60) return `${diffMins}m ago`;
42395
+ if (diffHours < 24) return `${diffHours}h ago`;
42396
+ if (diffDays < 7) return `${diffDays}d ago`;
42226
42397
  return formatDate(iso);
42227
42398
  }
42228
42399
  function truncate5(str, max) {
@@ -42233,45 +42404,45 @@ async function renderCurrentThread() {
42233
42404
  const manager = getThreadManager();
42234
42405
  const metadata = await manager.getActiveThread();
42235
42406
  if (!metadata) {
42236
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", gap: 1, children: [
42237
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.err, children: "Nenhuma thread ativa" }),
42238
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Cria uma nova com: /thread new [nome]" })
42407
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", gap: 1, children: [
42408
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.err, children: "No active thread" }),
42409
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Create one with: /thread new [name]" })
42239
42410
  ] }) });
42240
42411
  }
42241
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", gap: 1, children: [
42242
- /* @__PURE__ */ jsx97(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Thread Atual" }),
42243
- /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
42244
- /* @__PURE__ */ jsxs80(Text, { children: [
42245
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "ID: " }),
42246
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.accent, children: metadata.threadId })
42412
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", gap: 1, children: [
42413
+ /* @__PURE__ */ jsx96(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Thread Atual" }),
42414
+ /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
42415
+ /* @__PURE__ */ jsxs79(Text, { children: [
42416
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "ID: " }),
42417
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.accent, children: metadata.threadId })
42247
42418
  ] }),
42248
- /* @__PURE__ */ jsxs80(Text, { children: [
42249
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Nome: " }),
42250
- /* @__PURE__ */ jsx97(Text, { children: metadata.name || "(sem nome)" })
42419
+ /* @__PURE__ */ jsxs79(Text, { children: [
42420
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Nome: " }),
42421
+ /* @__PURE__ */ jsx96(Text, { children: metadata.name || "(unnamed)" })
42251
42422
  ] }),
42252
- /* @__PURE__ */ jsxs80(Text, { children: [
42253
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Preview: " }),
42254
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: truncate5(metadata.preview, 60) })
42423
+ /* @__PURE__ */ jsxs79(Text, { children: [
42424
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Preview: " }),
42425
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: truncate5(metadata.preview, 60) })
42255
42426
  ] }),
42256
- /* @__PURE__ */ jsxs80(Text, { children: [
42257
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Modelo: " }),
42258
- /* @__PURE__ */ jsx97(Text, { children: metadata.model })
42427
+ /* @__PURE__ */ jsxs79(Text, { children: [
42428
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Modelo: " }),
42429
+ /* @__PURE__ */ jsx96(Text, { children: metadata.model })
42259
42430
  ] }),
42260
- /* @__PURE__ */ jsxs80(Text, { children: [
42261
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "CWD: " }),
42262
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: metadata.cwd })
42431
+ /* @__PURE__ */ jsxs79(Text, { children: [
42432
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "CWD: " }),
42433
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: metadata.cwd })
42263
42434
  ] }),
42264
- metadata.gitInfo && /* @__PURE__ */ jsxs80(Text, { children: [
42265
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Git: " }),
42266
- /* @__PURE__ */ jsxs80(Text, { dimColor: true, children: [
42435
+ metadata.gitInfo && /* @__PURE__ */ jsxs79(Text, { children: [
42436
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Git: " }),
42437
+ /* @__PURE__ */ jsxs79(Text, { dimColor: true, children: [
42267
42438
  metadata.gitInfo.branch || "?",
42268
42439
  " @ ",
42269
42440
  truncate5(metadata.gitInfo.sha || "?", 8)
42270
42441
  ] })
42271
42442
  ] }),
42272
- /* @__PURE__ */ jsxs80(Text, { children: [
42273
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Tokens: " }),
42274
- /* @__PURE__ */ jsxs80(Text, { children: [
42443
+ /* @__PURE__ */ jsxs79(Text, { children: [
42444
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Tokens: " }),
42445
+ /* @__PURE__ */ jsxs79(Text, { children: [
42275
42446
  metadata.tokenUsage.totalTokens.toLocaleString(),
42276
42447
  " (",
42277
42448
  metadata.tokenUsage.inputTokens.toLocaleString(),
@@ -42281,17 +42452,17 @@ async function renderCurrentThread() {
42281
42452
  " out)"
42282
42453
  ] })
42283
42454
  ] }),
42284
- /* @__PURE__ */ jsxs80(Text, { children: [
42285
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Criada: " }),
42286
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: formatDate(metadata.createdAt) })
42455
+ /* @__PURE__ */ jsxs79(Text, { children: [
42456
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Criada: " }),
42457
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: formatDate(metadata.createdAt) })
42287
42458
  ] }),
42288
- /* @__PURE__ */ jsxs80(Text, { children: [
42289
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Atualizada: " }),
42290
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: formatRelativeTime(metadata.updatedAt) })
42459
+ /* @__PURE__ */ jsxs79(Text, { children: [
42460
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Atualizada: " }),
42461
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: formatRelativeTime(metadata.updatedAt) })
42291
42462
  ] }),
42292
- metadata.forkedFromId && /* @__PURE__ */ jsxs80(Text, { children: [
42293
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Fork de: " }),
42294
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.accent, children: metadata.forkedFromId })
42463
+ metadata.forkedFromId && /* @__PURE__ */ jsxs79(Text, { children: [
42464
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Fork de: " }),
42465
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.accent, children: metadata.forkedFromId })
42295
42466
  ] })
42296
42467
  ] })
42297
42468
  ] }) });
@@ -42308,20 +42479,20 @@ async function renderThreadList(args) {
42308
42479
  searchTerm
42309
42480
  });
42310
42481
  if (result.threads.length === 0) {
42311
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", gap: 1, children: [
42312
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Nenhuma thread encontrada" }),
42313
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Cria uma nova com: /thread new [nome]" })
42482
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", gap: 1, children: [
42483
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "No threads found" }),
42484
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Create one with: /thread new [name]" })
42314
42485
  ] }) });
42315
42486
  }
42316
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", gap: 1, children: [
42317
- /* @__PURE__ */ jsxs80(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: [
42487
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", gap: 1, children: [
42488
+ /* @__PURE__ */ jsxs79(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: [
42318
42489
  "Threads (",
42319
42490
  result.total,
42320
42491
  " total",
42321
42492
  result.hasMore ? "+" : "",
42322
42493
  ")"
42323
42494
  ] }),
42324
- /* @__PURE__ */ jsx97(Box_default, { flexDirection: "column", gap: 1, children: result.threads.map((thread, idx) => /* @__PURE__ */ jsx97(
42495
+ /* @__PURE__ */ jsx96(Box_default, { flexDirection: "column", gap: 1, children: result.threads.map((thread, idx) => /* @__PURE__ */ jsx96(
42325
42496
  ThreadListItem,
42326
42497
  {
42327
42498
  thread,
@@ -42335,18 +42506,18 @@ async function renderThreadList(args) {
42335
42506
  var ThreadListItem = ({ thread, isActive, index }) => {
42336
42507
  const statusColor = thread.status === "archived" ? BLUMA_TERMINAL.warning : BLUMA_TERMINAL.success;
42337
42508
  const name = thread.name || truncate5(thread.preview, 40);
42338
- return /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", children: [
42339
- /* @__PURE__ */ jsxs80(Box_default, { gap: 1, children: [
42340
- /* @__PURE__ */ jsxs80(Text, { dimColor: true, children: [
42509
+ return /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", children: [
42510
+ /* @__PURE__ */ jsxs79(Box_default, { gap: 1, children: [
42511
+ /* @__PURE__ */ jsxs79(Text, { dimColor: true, children: [
42341
42512
  index,
42342
42513
  "."
42343
42514
  ] }),
42344
- isActive && /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.accent, children: "\u25CF" }),
42345
- /* @__PURE__ */ jsx97(Text, { bold: isActive, color: isActive ? BLUMA_TERMINAL.accent : void 0, children: name }),
42346
- thread.status === "archived" && /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.warning, children: "[arquivada]" }),
42347
- thread.forkedFromId && /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "(fork)" })
42515
+ isActive && /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.accent, children: "\u25CF" }),
42516
+ /* @__PURE__ */ jsx96(Text, { bold: isActive, color: isActive ? BLUMA_TERMINAL.accent : void 0, children: name }),
42517
+ thread.status === "archived" && /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.warning, children: "[arquivada]" }),
42518
+ thread.forkedFromId && /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "(fork)" })
42348
42519
  ] }),
42349
- /* @__PURE__ */ jsx97(Box_default, { paddingLeft: 4, children: /* @__PURE__ */ jsxs80(Text, { dimColor: true, children: [
42520
+ /* @__PURE__ */ jsx96(Box_default, { paddingLeft: 4, children: /* @__PURE__ */ jsxs79(Text, { dimColor: true, children: [
42350
42521
  "ID: ",
42351
42522
  thread.threadId,
42352
42523
  " \u2022 ",
@@ -42368,19 +42539,19 @@ async function runThreadNew(args) {
42368
42539
  // Será definido pelo agent
42369
42540
  cwd: process.cwd()
42370
42541
  });
42371
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", gap: 1, children: [
42372
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Nova thread criada" }),
42373
- /* @__PURE__ */ jsx97(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs80(Text, { children: [
42374
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "ID: " }),
42375
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.accent, children: metadata.threadId })
42542
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", gap: 1, children: [
42543
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Nova thread criada" }),
42544
+ /* @__PURE__ */ jsx96(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs79(Text, { children: [
42545
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "ID: " }),
42546
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.accent, children: metadata.threadId })
42376
42547
  ] }) }),
42377
- metadata.name && /* @__PURE__ */ jsx97(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs80(Text, { children: [
42378
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Nome: " }),
42379
- /* @__PURE__ */ jsx97(Text, { children: metadata.name })
42548
+ metadata.name && /* @__PURE__ */ jsx96(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs79(Text, { children: [
42549
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Nome: " }),
42550
+ /* @__PURE__ */ jsx96(Text, { children: metadata.name })
42380
42551
  ] }) })
42381
42552
  ] }) });
42382
42553
  } catch (e) {
42383
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42554
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42384
42555
  "Erro ao criar thread: ",
42385
42556
  e.message
42386
42557
  ] }) });
@@ -42388,31 +42559,31 @@ async function runThreadNew(args) {
42388
42559
  }
42389
42560
  async function runThreadResume(args) {
42390
42561
  if (args.length === 0) {
42391
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.err, children: "Uso: /thread resume <id>" }) });
42562
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.err, children: "Usage: /thread resume <id>" }) });
42392
42563
  }
42393
42564
  const threadId = args[0];
42394
42565
  const manager = getThreadManager();
42395
42566
  try {
42396
42567
  const metadata = await manager.loadThread(threadId);
42397
42568
  if (!metadata) {
42398
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42399
- "Thread n\xE3o encontrada: ",
42569
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42570
+ "Thread not found: ",
42400
42571
  threadId
42401
42572
  ] }) });
42402
42573
  }
42403
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", gap: 1, children: [
42404
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Thread retomada" }),
42405
- /* @__PURE__ */ jsx97(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs80(Text, { children: [
42406
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "ID: " }),
42407
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.accent, children: metadata.threadId })
42574
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", gap: 1, children: [
42575
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Thread retomada" }),
42576
+ /* @__PURE__ */ jsx96(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs79(Text, { children: [
42577
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "ID: " }),
42578
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.accent, children: metadata.threadId })
42408
42579
  ] }) }),
42409
- /* @__PURE__ */ jsx97(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs80(Text, { children: [
42410
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Mensagens: " }),
42411
- /* @__PURE__ */ jsx97(Text, { children: manager.getActiveHistory()?.messages.length || 0 })
42580
+ /* @__PURE__ */ jsx96(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs79(Text, { children: [
42581
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Mensagens: " }),
42582
+ /* @__PURE__ */ jsx96(Text, { children: manager.getActiveHistory()?.messages.length || 0 })
42412
42583
  ] }) })
42413
42584
  ] }) });
42414
42585
  } catch (e) {
42415
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42586
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42416
42587
  "Erro ao retomar thread: ",
42417
42588
  e.message
42418
42589
  ] }) });
@@ -42424,21 +42595,21 @@ async function runThreadFork(args) {
42424
42595
  try {
42425
42596
  const metadata = await manager.forkActiveThread(name);
42426
42597
  if (!metadata) {
42427
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.err, children: "Nenhuma thread ativa para fazer fork" }) });
42598
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.err, children: "No active thread to fork" }) });
42428
42599
  }
42429
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", gap: 1, children: [
42430
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Thread fork criada" }),
42431
- /* @__PURE__ */ jsx97(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs80(Text, { children: [
42432
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Nova ID: " }),
42433
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.accent, children: metadata.threadId })
42600
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", gap: 1, children: [
42601
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Thread fork criada" }),
42602
+ /* @__PURE__ */ jsx96(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs79(Text, { children: [
42603
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Nova ID: " }),
42604
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.accent, children: metadata.threadId })
42434
42605
  ] }) }),
42435
- /* @__PURE__ */ jsx97(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs80(Text, { children: [
42436
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Original: " }),
42437
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.accent, children: metadata.forkedFromId })
42606
+ /* @__PURE__ */ jsx96(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs79(Text, { children: [
42607
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Original: " }),
42608
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.accent, children: metadata.forkedFromId })
42438
42609
  ] }) })
42439
42610
  ] }) });
42440
42611
  } catch (e) {
42441
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42612
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42442
42613
  "Erro ao fazer fork: ",
42443
42614
  e.message
42444
42615
  ] }) });
@@ -42446,18 +42617,18 @@ async function runThreadFork(args) {
42446
42617
  }
42447
42618
  async function runThreadRename(args) {
42448
42619
  if (args.length === 0) {
42449
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.err, children: "Uso: /thread rename <nome>" }) });
42620
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.err, children: "Usage: /thread rename <name>" }) });
42450
42621
  }
42451
42622
  const name = args.join(" ");
42452
42623
  const manager = getThreadManager();
42453
42624
  try {
42454
42625
  await manager.renameThread(name);
42455
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.success, children: [
42626
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.success, children: [
42456
42627
  "\u2713 Thread renomeada para: ",
42457
42628
  name
42458
42629
  ] }) });
42459
42630
  } catch (e) {
42460
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42631
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42461
42632
  "Erro ao renomear: ",
42462
42633
  e.message
42463
42634
  ] }) });
@@ -42468,11 +42639,11 @@ async function runThreadArchive() {
42468
42639
  try {
42469
42640
  const result = await manager.archiveActiveThread();
42470
42641
  if (!result) {
42471
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.err, children: "Nenhuma thread ativa para arquivar" }) });
42642
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.err, children: "No active thread to archive" }) });
42472
42643
  }
42473
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Thread arquivada" }) });
42644
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Thread arquivada" }) });
42474
42645
  } catch (e) {
42475
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42646
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42476
42647
  "Erro ao arquivar: ",
42477
42648
  e.message
42478
42649
  ] }) });
@@ -42480,21 +42651,21 @@ async function runThreadArchive() {
42480
42651
  }
42481
42652
  async function runThreadUnarchive(args) {
42482
42653
  if (args.length === 0) {
42483
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.err, children: "Uso: /thread unarchive <id>" }) });
42654
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.err, children: "Usage: /thread unarchive <id>" }) });
42484
42655
  }
42485
42656
  const threadId = args[0];
42486
42657
  const manager = getThreadManager();
42487
42658
  try {
42488
42659
  const result = await manager.unarchiveThread(threadId);
42489
42660
  if (!result) {
42490
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42491
- "Thread n\xE3o encontrada: ",
42661
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42662
+ "Thread not found: ",
42492
42663
  threadId
42493
42664
  ] }) });
42494
42665
  }
42495
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Thread desarquivada" }) });
42666
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.success, children: "\u2713 Thread desarquivada" }) });
42496
42667
  } catch (e) {
42497
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42668
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42498
42669
  "Erro ao desarquivar: ",
42499
42670
  e.message
42500
42671
  ] }) });
@@ -42502,24 +42673,24 @@ async function runThreadUnarchive(args) {
42502
42673
  }
42503
42674
  async function runThreadDelete(args) {
42504
42675
  if (args.length === 0) {
42505
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.err, children: "Uso: /thread delete <id>" }) });
42676
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.err, children: "Usage: /thread delete <id>" }) });
42506
42677
  }
42507
42678
  const threadId = args[0];
42508
42679
  const store2 = getThreadStore();
42509
42680
  try {
42510
42681
  const result = await store2.deleteThread(threadId);
42511
42682
  if (!result) {
42512
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42513
- "Thread n\xE3o encontrada: ",
42683
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42684
+ "Thread not found: ",
42514
42685
  threadId
42515
42686
  ] }) });
42516
42687
  }
42517
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.success, children: [
42688
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.success, children: [
42518
42689
  "\u2713 Thread apagada: ",
42519
42690
  threadId
42520
42691
  ] }) });
42521
42692
  } catch (e) {
42522
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42693
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42523
42694
  "Erro ao apagar: ",
42524
42695
  e.message
42525
42696
  ] }) });
@@ -42532,35 +42703,35 @@ async function renderThreadStats() {
42532
42703
  try {
42533
42704
  const stats = await store2.getStats();
42534
42705
  const active = await manager.getActiveThread();
42535
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", gap: 1, children: [
42536
- /* @__PURE__ */ jsx97(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Estat\xEDsticas de Threads" }),
42537
- /* @__PURE__ */ jsxs80(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
42538
- /* @__PURE__ */ jsxs80(Text, { children: [
42539
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Total: " }),
42540
- /* @__PURE__ */ jsx97(Text, { children: stats.total })
42706
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", gap: 1, children: [
42707
+ /* @__PURE__ */ jsx96(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Estat\xEDsticas de Threads" }),
42708
+ /* @__PURE__ */ jsxs79(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
42709
+ /* @__PURE__ */ jsxs79(Text, { children: [
42710
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Total: " }),
42711
+ /* @__PURE__ */ jsx96(Text, { children: stats.total })
42541
42712
  ] }),
42542
- /* @__PURE__ */ jsxs80(Text, { children: [
42543
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Ativas: " }),
42544
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.success, children: stats.active })
42713
+ /* @__PURE__ */ jsxs79(Text, { children: [
42714
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Ativas: " }),
42715
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.success, children: stats.active })
42545
42716
  ] }),
42546
- /* @__PURE__ */ jsxs80(Text, { children: [
42547
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Arquivadas: " }),
42548
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.warning, children: stats.archived })
42717
+ /* @__PURE__ */ jsxs79(Text, { children: [
42718
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Arquivadas: " }),
42719
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.warning, children: stats.archived })
42549
42720
  ] }),
42550
- active && /* @__PURE__ */ jsxs80(Fragment17, { children: [
42551
- /* @__PURE__ */ jsxs80(Text, { children: [
42552
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Thread ativa: " }),
42553
- /* @__PURE__ */ jsx97(Text, { color: BLUMA_TERMINAL.accent, children: active.threadId })
42721
+ active && /* @__PURE__ */ jsxs79(Fragment16, { children: [
42722
+ /* @__PURE__ */ jsxs79(Text, { children: [
42723
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Thread ativa: " }),
42724
+ /* @__PURE__ */ jsx96(Text, { color: BLUMA_TERMINAL.accent, children: active.threadId })
42554
42725
  ] }),
42555
- /* @__PURE__ */ jsxs80(Text, { children: [
42556
- /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Tokens usados: " }),
42557
- /* @__PURE__ */ jsx97(Text, { children: active.tokenUsage.totalTokens.toLocaleString() })
42726
+ /* @__PURE__ */ jsxs79(Text, { children: [
42727
+ /* @__PURE__ */ jsx96(Text, { dimColor: true, children: "Tokens usados: " }),
42728
+ /* @__PURE__ */ jsx96(Text, { children: active.tokenUsage.totalTokens.toLocaleString() })
42558
42729
  ] })
42559
42730
  ] })
42560
42731
  ] })
42561
42732
  ] }) });
42562
42733
  } catch (e) {
42563
- return /* @__PURE__ */ jsx97(MessageResponse, { children: /* @__PURE__ */ jsxs80(Text, { color: BLUMA_TERMINAL.err, children: [
42734
+ return /* @__PURE__ */ jsx96(MessageResponse, { children: /* @__PURE__ */ jsxs79(Text, { color: BLUMA_TERMINAL.err, children: [
42564
42735
  "Erro: ",
42565
42736
  e.message
42566
42737
  ] }) });
@@ -42568,7 +42739,7 @@ async function renderThreadStats() {
42568
42739
  }
42569
42740
 
42570
42741
  // src/app/ui/components/SlashCommands.tsx
42571
- import { Fragment as Fragment18, jsx as jsx98, jsxs as jsxs81 } from "react/jsx-runtime";
42742
+ import { Fragment as Fragment17, jsx as jsx97, jsxs as jsxs80 } from "react/jsx-runtime";
42572
42743
  var SLASH_COMMANDS_WITH_INTERNAL_PROMPTS = /* @__PURE__ */ new Set([
42573
42744
  "review",
42574
42745
  "commit",
@@ -42657,9 +42828,9 @@ var SlashCommands = ({
42657
42828
  {
42658
42829
  id: Date.now(),
42659
42830
  component: outBox(
42660
- /* @__PURE__ */ jsxs81(Box_default, { children: [
42661
- /* @__PURE__ */ jsx98(Text, { color: "green", children: "[ok]" }),
42662
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: " History cleared" })
42831
+ /* @__PURE__ */ jsxs80(Box_default, { children: [
42832
+ /* @__PURE__ */ jsx97(Text, { color: "green", children: "[ok]" }),
42833
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: " History cleared" })
42663
42834
  ] })
42664
42835
  )
42665
42836
  }
@@ -42852,7 +43023,7 @@ var SlashCommands = ({
42852
43023
  setHistory((prev) => prev.concat({
42853
43024
  id: Date.now(),
42854
43025
  component: outBox(
42855
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: formatTodoResult(result) })
43026
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: formatTodoResult(result) })
42856
43027
  )
42857
43028
  }));
42858
43029
  })();
@@ -42881,9 +43052,9 @@ var SlashCommands = ({
42881
43052
  setHistory((prev) => prev.concat({
42882
43053
  id: Date.now(),
42883
43054
  component: outBox(
42884
- /* @__PURE__ */ jsxs81(Fragment18, { children: [
42885
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: result.message }),
42886
- result.activeTask ? /* @__PURE__ */ jsxs81(Text, { dimColor: true, children: [
43055
+ /* @__PURE__ */ jsxs80(Fragment17, { children: [
43056
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: result.message }),
43057
+ result.activeTask ? /* @__PURE__ */ jsxs80(Text, { dimColor: true, children: [
42887
43058
  result.activeTask.mode,
42888
43059
  " \xB7 ",
42889
43060
  result.activeTask.taskName,
@@ -42913,7 +43084,7 @@ var SlashCommands = ({
42913
43084
  const modes = ["default", "plan", "accept_edits"];
42914
43085
  if (!sub || sub === "show" || sub === "menu") {
42915
43086
  if (openPermissionsMenu) {
42916
- return /* @__PURE__ */ jsx98(
43087
+ return /* @__PURE__ */ jsx97(
42917
43088
  SlashCommandMenu,
42918
43089
  {
42919
43090
  commandLine: input.trim(),
@@ -42975,7 +43146,7 @@ var SlashCommands = ({
42975
43146
  const modes = ["default", "coordinator", "plan", "agent"];
42976
43147
  if (!sub || sub === "show" || sub === "menu") {
42977
43148
  if (openAgentMenu) {
42978
- return /* @__PURE__ */ jsx98(
43149
+ return /* @__PURE__ */ jsx97(
42979
43150
  SlashCommandMenu,
42980
43151
  {
42981
43152
  commandLine: input.trim(),
@@ -43062,7 +43233,7 @@ var SlashCommands = ({
43062
43233
  const normalized = value === "show" || value === "menu" ? "" : value;
43063
43234
  if (!normalized) {
43064
43235
  if (openEffortMenu) {
43065
- return /* @__PURE__ */ jsx98(
43236
+ return /* @__PURE__ */ jsx97(
43066
43237
  SlashCommandMenu,
43067
43238
  {
43068
43239
  commandLine: input.trim(),
@@ -43091,6 +43262,14 @@ var SlashCommands = ({
43091
43262
  setEffortMenuResolved(true);
43092
43263
  appendResult(runEffortSet(agentRef, "high"));
43093
43264
  }
43265
+ },
43266
+ {
43267
+ label: "off",
43268
+ description: "No reasoning",
43269
+ action: () => {
43270
+ setEffortMenuResolved(true);
43271
+ appendResult(runEffortSet(agentRef, "off"));
43272
+ }
43094
43273
  }
43095
43274
  ],
43096
43275
  footer: "Enter to confirm \xB7 Esc cancel",
@@ -43103,7 +43282,7 @@ var SlashCommands = ({
43103
43282
  if (effortMenuResolved) return null;
43104
43283
  return null;
43105
43284
  }
43106
- if (!["low", "medium", "high"].includes(normalized)) {
43285
+ if (!["low", "medium", "high", "off"].includes(normalized)) {
43107
43286
  return usageBox("Effort", "Use /effort menu to select level.");
43108
43287
  }
43109
43288
  return runEffortSet(agentRef, normalized);
@@ -43113,7 +43292,7 @@ var SlashCommands = ({
43113
43292
  const normalized = value === "show" || value === "menu" ? "" : value;
43114
43293
  if (!normalized) {
43115
43294
  if (openStyleMenu) {
43116
- return /* @__PURE__ */ jsx98(
43295
+ return /* @__PURE__ */ jsx97(
43117
43296
  SlashCommandMenu,
43118
43297
  {
43119
43298
  commandLine: input.trim(),
@@ -43164,7 +43343,7 @@ var SlashCommands = ({
43164
43343
  const normalized = value === "show" || value === "menu" ? "" : value;
43165
43344
  if (!normalized) {
43166
43345
  if (openSandboxMenu) {
43167
- return /* @__PURE__ */ jsx98(
43346
+ return /* @__PURE__ */ jsx97(
43168
43347
  SlashCommandMenu,
43169
43348
  {
43170
43349
  commandLine: input.trim(),
@@ -43262,27 +43441,11 @@ var SlashCommands = ({
43262
43441
  setHistory(
43263
43442
  (prev) => prev.concat({
43264
43443
  id: Date.now(),
43265
- component: result.success ? outBox(
43266
- /* @__PURE__ */ jsxs81(Fragment18, { children: [
43267
- /* @__PURE__ */ jsx98(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Export" }),
43268
- /* @__PURE__ */ jsxs81(Text, { dimColor: true, children: [
43269
- " ",
43270
- "\xB7 ",
43271
- result.messageCount,
43272
- " mensagem(ns) \u2192 ",
43273
- result.filePath
43274
- ] })
43275
- ] })
43276
- ) : outBox(
43277
- /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
43278
- "Export falhou: ",
43279
- result.error ?? "erro desconhecido"
43280
- ] })
43281
- )
43444
+ component: /* @__PURE__ */ jsx97(ChatBlock, { marginBottom: 1, children: /* @__PURE__ */ jsx97(Text, { children: result.success ? `Exported \u2192 ${result.filePath}` : `Export failed: ${result.error ?? "unknown error"}` }) })
43282
43445
  })
43283
43446
  );
43284
43447
  })();
43285
- return renderExportUsage();
43448
+ return null;
43286
43449
  }
43287
43450
  if (cmd === "ctx") {
43288
43451
  const modeArg = (args[0] || "summary").toLowerCase();
@@ -43306,9 +43469,9 @@ var SlashCommands = ({
43306
43469
  );
43307
43470
  })();
43308
43471
  return outBox(
43309
- /* @__PURE__ */ jsxs81(Fragment18, { children: [
43310
- /* @__PURE__ */ jsx98(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Context" }),
43311
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: " \xB7 a inspecionar\u2026" })
43472
+ /* @__PURE__ */ jsxs80(Fragment17, { children: [
43473
+ /* @__PURE__ */ jsx97(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Context" }),
43474
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: " \xB7 a inspecionar\u2026" })
43312
43475
  ] })
43313
43476
  );
43314
43477
  }
@@ -43362,7 +43525,7 @@ Report the commit hash and summary when done.`;
43362
43525
  setHistory((prev) => prev.concat({
43363
43526
  id: Date.now(),
43364
43527
  component: outBox(
43365
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
43528
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
43366
43529
  "Failed to execute /commit: ",
43367
43530
  e?.message || String(e)
43368
43531
  ] }) })
@@ -43456,7 +43619,7 @@ Report the PR URL, number, title, and summary when done.`;
43456
43619
  setHistory((prev) => prev.concat({
43457
43620
  id: Date.now(),
43458
43621
  component: outBox(
43459
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
43622
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
43460
43623
  "Failed to execute /pr: ",
43461
43624
  e?.message || String(e)
43462
43625
  ] }) })
@@ -43617,7 +43780,7 @@ Report the release version, tag, changelog summary, and verification results whe
43617
43780
  setHistory((prev) => prev.concat({
43618
43781
  id: Date.now(),
43619
43782
  component: outBox(
43620
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
43783
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
43621
43784
  "Failed to execute /release: ",
43622
43785
  e?.message || String(e)
43623
43786
  ] }) })
@@ -43628,9 +43791,9 @@ Report the release version, tag, changelog summary, and verification results whe
43628
43791
  const bumpType = args.find((a) => ["major", "minor", "patch", "premajor", "preminor", "prepatch", "prerelease"].includes(a)) || "auto-detect";
43629
43792
  const dryRun = args.includes("--dry-run") || args.includes("--dryrun");
43630
43793
  return outBox(
43631
- /* @__PURE__ */ jsxs81(Box_default, { children: [
43632
- /* @__PURE__ */ jsx98(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Release" }),
43633
- /* @__PURE__ */ jsxs81(Text, { dimColor: true, children: [
43794
+ /* @__PURE__ */ jsxs80(Box_default, { children: [
43795
+ /* @__PURE__ */ jsx97(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "Release" }),
43796
+ /* @__PURE__ */ jsxs80(Text, { dimColor: true, children: [
43634
43797
  " \xB7 ",
43635
43798
  bumpType,
43636
43799
  dryRun ? " (dry-run)" : ""
@@ -43775,7 +43938,7 @@ Start the review now.`;
43775
43938
  setHistory((prev) => prev.concat({
43776
43939
  id: Date.now(),
43777
43940
  component: outBox(
43778
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
43941
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
43779
43942
  "Failed to execute /review: ",
43780
43943
  e?.message || String(e)
43781
43944
  ] }) })
@@ -43789,10 +43952,10 @@ Start the review now.`;
43789
43952
  const target = args.join(" ") || "";
43790
43953
  if (!target) {
43791
43954
  return outBox(
43792
- /* @__PURE__ */ jsxs81(Fragment18, { children: [
43793
- /* @__PURE__ */ jsx98(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/explain" }),
43794
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Explain a file, function, or code snippet." }),
43795
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Usage: /explain <file> [line-range or function-name]" })
43955
+ /* @__PURE__ */ jsxs80(Fragment17, { children: [
43956
+ /* @__PURE__ */ jsx97(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/explain" }),
43957
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Explain a file, function, or code snippet." }),
43958
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Usage: /explain <file> [line-range or function-name]" })
43796
43959
  ] })
43797
43960
  );
43798
43961
  }
@@ -43805,7 +43968,7 @@ Start the review now.`;
43805
43968
  setHistory((prev) => prev.concat({
43806
43969
  id: Date.now(),
43807
43970
  component: outBox(
43808
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
43971
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
43809
43972
  "Failed to execute /explain: ",
43810
43973
  e?.message || String(e)
43811
43974
  ] }) })
@@ -43826,7 +43989,7 @@ Start the review now.`;
43826
43989
  setHistory((prev) => prev.concat({
43827
43990
  id: Date.now(),
43828
43991
  component: outBox(
43829
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
43992
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
43830
43993
  "Failed to execute /fix: ",
43831
43994
  e?.message || String(e)
43832
43995
  ] }) })
@@ -43860,17 +44023,17 @@ Start the review now.`;
43860
44023
  const description = args.join(" ") || "";
43861
44024
  if (!description) {
43862
44025
  return outBox(
43863
- /* @__PURE__ */ jsxs81(Fragment18, { children: [
43864
- /* @__PURE__ */ jsx98(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/debug" }),
43865
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Debug Coordinator mode \u2014 spawn workers to investigate, fix & verify in parallel." }),
43866
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Usage: /debug <describe the problem, symptom, or error>" }),
43867
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: " " }),
43868
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "The agent will:" }),
43869
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: " \u2022 Act as Debug Coordinator \u2014 orchestrate a team of workers" }),
43870
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: " \u2022 Spawn parallel researchers to investigate different hypotheses" }),
43871
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: " \u2022 Synthesize findings and direct the fix" }),
43872
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: " \u2022 Spawn a fix worker + verification worker" }),
43873
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: " \u2022 Not stop until root cause is found, fixed, and proven" })
44026
+ /* @__PURE__ */ jsxs80(Fragment17, { children: [
44027
+ /* @__PURE__ */ jsx97(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/debug" }),
44028
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Debug Coordinator mode \u2014 spawn workers to investigate, fix & verify in parallel." }),
44029
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Usage: /debug <describe the problem, symptom, or error>" }),
44030
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: " " }),
44031
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "The agent will:" }),
44032
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: " \u2022 Act as Debug Coordinator \u2014 orchestrate a team of workers" }),
44033
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: " \u2022 Spawn parallel researchers to investigate different hypotheses" }),
44034
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: " \u2022 Synthesize findings and direct the fix" }),
44035
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: " \u2022 Spawn a fix worker + verification worker" }),
44036
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: " \u2022 Not stop until root cause is found, fixed, and proven" })
43874
44037
  ] })
43875
44038
  );
43876
44039
  }
@@ -44027,7 +44190,7 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
44027
44190
  setHistory((prev) => prev.concat({
44028
44191
  id: Date.now(),
44029
44192
  component: outBox(
44030
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
44193
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
44031
44194
  "Failed to execute /debug: ",
44032
44195
  e?.message || String(e)
44033
44196
  ] }) })
@@ -44041,10 +44204,10 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
44041
44204
  const description = args.join(" ") || "";
44042
44205
  if (!description) {
44043
44206
  return outBox(
44044
- /* @__PURE__ */ jsxs81(Fragment18, { children: [
44045
- /* @__PURE__ */ jsx98(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/bug" }),
44046
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Alias for /debug \u2014 Debug Coordinator mode." }),
44047
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Usage: /bug <describe the problem> (or use /debug)" })
44207
+ /* @__PURE__ */ jsxs80(Fragment17, { children: [
44208
+ /* @__PURE__ */ jsx97(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/bug" }),
44209
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Alias for /debug \u2014 Debug Coordinator mode." }),
44210
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Usage: /bug <describe the problem> (or use /debug)" })
44048
44211
  ] })
44049
44212
  );
44050
44213
  }
@@ -44201,7 +44364,7 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
44201
44364
  setHistory((prev) => prev.concat({
44202
44365
  id: Date.now(),
44203
44366
  component: outBox(
44204
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
44367
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
44205
44368
  "Failed to execute /bug: ",
44206
44369
  e?.message || String(e)
44207
44370
  ] }) })
@@ -44227,7 +44390,7 @@ Start coordinating now. Triage the problem, then spawn your research workers.`
44227
44390
  setHistory((prev) => prev.concat({
44228
44391
  id: Date.now(),
44229
44392
  component: outBox(
44230
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
44393
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
44231
44394
  "Failed to execute /test: ",
44232
44395
  e?.message || String(e)
44233
44396
  ] }) })
@@ -44256,7 +44419,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
44256
44419
  setHistory((prev) => prev.concat({
44257
44420
  id: Date.now(),
44258
44421
  component: outBox(
44259
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
44422
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
44260
44423
  "Failed to execute /optimize: ",
44261
44424
  e?.message || String(e)
44262
44425
  ] }) })
@@ -44270,10 +44433,10 @@ Read the relevant files, identify optimization opportunities, and suggest specif
44270
44433
  const target = args.join(" ") || "";
44271
44434
  if (!target) {
44272
44435
  return outBox(
44273
- /* @__PURE__ */ jsxs81(Fragment18, { children: [
44274
- /* @__PURE__ */ jsx98(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/refactor" }),
44275
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Refactor code to improve structure without changing behavior." }),
44276
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Usage: /refactor <file or description of refactoring>" })
44436
+ /* @__PURE__ */ jsxs80(Fragment17, { children: [
44437
+ /* @__PURE__ */ jsx97(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/refactor" }),
44438
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Refactor code to improve structure without changing behavior." }),
44439
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Usage: /refactor <file or description of refactoring>" })
44277
44440
  ] })
44278
44441
  );
44279
44442
  }
@@ -44292,7 +44455,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
44292
44455
  setHistory((prev) => prev.concat({
44293
44456
  id: Date.now(),
44294
44457
  component: outBox(
44295
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
44458
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
44296
44459
  "Failed to execute /refactor: ",
44297
44460
  e?.message || String(e)
44298
44461
  ] }) })
@@ -44306,10 +44469,10 @@ Read the relevant files, identify optimization opportunities, and suggest specif
44306
44469
  const target = args.join(" ") || "";
44307
44470
  if (!target) {
44308
44471
  return outBox(
44309
- /* @__PURE__ */ jsxs81(Fragment18, { children: [
44310
- /* @__PURE__ */ jsx98(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/document" }),
44311
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Generate documentation for a file, module, or function." }),
44312
- /* @__PURE__ */ jsx98(Text, { dimColor: true, children: "Usage: /document <file or module> [--format jsdoc|markdown|readme]" })
44472
+ /* @__PURE__ */ jsxs80(Fragment17, { children: [
44473
+ /* @__PURE__ */ jsx97(Text, { bold: true, color: COMMAND_HEADER_COLOR, children: "/document" }),
44474
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Generate documentation for a file, module, or function." }),
44475
+ /* @__PURE__ */ jsx97(Text, { dimColor: true, children: "Usage: /document <file or module> [--format jsdoc|markdown|readme]" })
44313
44476
  ] })
44314
44477
  );
44315
44478
  }
@@ -44328,7 +44491,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
44328
44491
  setHistory((prev) => prev.concat({
44329
44492
  id: Date.now(),
44330
44493
  component: outBox(
44331
- /* @__PURE__ */ jsx98(Box_default, { children: /* @__PURE__ */ jsxs81(Text, { color: "red", children: [
44494
+ /* @__PURE__ */ jsx97(Box_default, { children: /* @__PURE__ */ jsxs80(Text, { color: "red", children: [
44332
44495
  "Failed to execute /document: ",
44333
44496
  e?.message || String(e)
44334
44497
  ] }) })
@@ -44354,7 +44517,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
44354
44517
  }
44355
44518
  return renderSettingsUnknown();
44356
44519
  }
44357
- return outBox(/* @__PURE__ */ jsxs81(Text, { color: "red", children: [
44520
+ return outBox(/* @__PURE__ */ jsxs80(Text, { color: "red", children: [
44358
44521
  "Command not recognized: /",
44359
44522
  cmd
44360
44523
  ] }));
@@ -44362,7 +44525,7 @@ Read the relevant files, identify optimization opportunities, and suggest specif
44362
44525
  const slashPath = input.trim().toLowerCase();
44363
44526
  const invokesAgent = shouldInvokeAgentForCommand(slashPath) || shouldInvokeAgentForCommand(slashPath.startsWith("/") ? slashPath.slice(1) : slashPath) || (cmd ? shouldInvokeAgentForCommand(`/${cmd}`) : false);
44364
44527
  const suppressIfAgent = (node) => invokesAgent ? null : node;
44365
- return /* @__PURE__ */ jsxs81(Fragment18, { children: [
44528
+ return /* @__PURE__ */ jsxs80(Fragment17, { children: [
44366
44529
  suppressIfAgent(render()),
44367
44530
  suppressIfAgent(renderedContent)
44368
44531
  ] });
@@ -44375,15 +44538,15 @@ import semverGt from "semver/functions/gt.js";
44375
44538
  import semverValid from "semver/functions/valid.js";
44376
44539
  import { fileURLToPath as fileURLToPath7 } from "url";
44377
44540
  import path55 from "path";
44378
- import fs50 from "fs";
44541
+ import fs49 from "fs";
44379
44542
  var BLUMA_PACKAGE_NAME = "@nomad-e/bluma-cli";
44380
44543
  function findBlumaPackageJson(startDir) {
44381
44544
  let dir = startDir;
44382
44545
  for (let i = 0; i < 12; i++) {
44383
44546
  const candidate = path55.join(dir, "package.json");
44384
- if (fs50.existsSync(candidate)) {
44547
+ if (fs49.existsSync(candidate)) {
44385
44548
  try {
44386
- const raw = fs50.readFileSync(candidate, "utf8");
44549
+ const raw = fs49.readFileSync(candidate, "utf8");
44387
44550
  const parsed = JSON.parse(raw);
44388
44551
  if (parsed?.name === BLUMA_PACKAGE_NAME && parsed?.version) {
44389
44552
  return { name: parsed.name, version: String(parsed.version) };
@@ -44414,8 +44577,8 @@ function resolveInstalledBlumaPackage() {
44414
44577
  if (argv1 && !argv1.startsWith("-")) {
44415
44578
  try {
44416
44579
  let resolved = argv1;
44417
- if (path55.isAbsolute(argv1) && fs50.existsSync(argv1)) {
44418
- resolved = fs50.realpathSync(argv1);
44580
+ if (path55.isAbsolute(argv1) && fs49.existsSync(argv1)) {
44581
+ resolved = fs49.realpathSync(argv1);
44419
44582
  } else {
44420
44583
  resolved = path55.resolve(process.cwd(), argv1);
44421
44584
  }
@@ -44466,7 +44629,7 @@ Run: npm i -g ${BLUMA_PACKAGE_NAME} to update.`;
44466
44629
  init_sandbox_policy();
44467
44630
 
44468
44631
  // src/app/ui/components/UpdateNotice.tsx
44469
- import { jsx as jsx99, jsxs as jsxs82 } from "react/jsx-runtime";
44632
+ import { jsx as jsx98, jsxs as jsxs81 } from "react/jsx-runtime";
44470
44633
  function parseUpdateMessage(msg) {
44471
44634
  const lines = msg.split(/\r?\n/).map((l) => l.trim());
44472
44635
  const first = lines[0] || "";
@@ -44482,24 +44645,24 @@ function parseUpdateMessage(msg) {
44482
44645
  }
44483
44646
  var UpdateNotice = ({ message: message2 }) => {
44484
44647
  const { name, current, latest: latest2, hint } = parseUpdateMessage(message2);
44485
- return /* @__PURE__ */ jsx99(ChatBlock, { marginBottom: 0, children: /* @__PURE__ */ jsx99(MessageResponse, { children: /* @__PURE__ */ jsxs82(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
44486
- name && current && latest2 ? /* @__PURE__ */ jsx99(Text, { color: BLUMA_TERMINAL.accent, bold: true, children: name }) : null,
44487
- name && current && latest2 ? /* @__PURE__ */ jsxs82(Text, { dimColor: true, children: [
44648
+ return /* @__PURE__ */ jsx98(ChatBlock, { marginBottom: 0, children: /* @__PURE__ */ jsx98(MessageResponse, { children: /* @__PURE__ */ jsxs81(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
44649
+ name && current && latest2 ? /* @__PURE__ */ jsx98(Text, { color: BLUMA_TERMINAL.accent, bold: true, children: name }) : null,
44650
+ name && current && latest2 ? /* @__PURE__ */ jsxs81(Text, { dimColor: true, children: [
44488
44651
  current,
44489
44652
  " \u2192 ",
44490
44653
  latest2
44491
- ] }) : /* @__PURE__ */ jsx99(Text, { dimColor: true, children: message2 }),
44492
- hint ? /* @__PURE__ */ jsx99(Box_default, { marginTop: 1, children: /* @__PURE__ */ jsx99(Text, { dimColor: true, children: hint }) }) : null
44654
+ ] }) : /* @__PURE__ */ jsx98(Text, { dimColor: true, children: message2 }),
44655
+ hint ? /* @__PURE__ */ jsx98(Box_default, { marginTop: 1, children: /* @__PURE__ */ jsx98(Text, { dimColor: true, children: hint }) }) : null
44493
44656
  ] }) }) });
44494
44657
  };
44495
44658
  var UpdateNotice_default = UpdateNotice;
44496
44659
 
44497
44660
  // src/app/ui/components/ErrorMessage.tsx
44498
- import { jsx as jsx100, jsxs as jsxs83 } from "react/jsx-runtime";
44499
- var ErrorMessage = ({ message: message2, details, hint }) => /* @__PURE__ */ jsx100(ChatBlock, { marginBottom: 0, children: /* @__PURE__ */ jsx100(MessageResponse, { children: /* @__PURE__ */ jsxs83(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
44500
- /* @__PURE__ */ jsx100(Text, { color: BLUMA_TERMINAL.err, children: message2 }),
44501
- details ? /* @__PURE__ */ jsx100(Box_default, { marginTop: 1, children: /* @__PURE__ */ jsx100(Text, { dimColor: true, children: details }) }) : null,
44502
- hint ? /* @__PURE__ */ jsx100(Box_default, { marginTop: 1, children: /* @__PURE__ */ jsxs83(Text, { dimColor: true, children: [
44661
+ import { jsx as jsx99, jsxs as jsxs82 } from "react/jsx-runtime";
44662
+ var ErrorMessage = ({ message: message2, details, hint }) => /* @__PURE__ */ jsx99(ChatBlock, { marginBottom: 0, children: /* @__PURE__ */ jsx99(MessageResponse, { children: /* @__PURE__ */ jsxs82(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
44663
+ /* @__PURE__ */ jsx99(Text, { color: BLUMA_TERMINAL.err, children: message2 }),
44664
+ details ? /* @__PURE__ */ jsx99(Box_default, { marginTop: 1, children: /* @__PURE__ */ jsx99(Text, { dimColor: true, children: details }) }) : null,
44665
+ hint ? /* @__PURE__ */ jsx99(Box_default, { marginTop: 1, children: /* @__PURE__ */ jsxs82(Text, { dimColor: true, children: [
44503
44666
  "hint: ",
44504
44667
  hint
44505
44668
  ] }) }) : null
@@ -44529,7 +44692,7 @@ function collapseRepeatedReasoningLines(text) {
44529
44692
  }
44530
44693
 
44531
44694
  // src/app/ui/components/ReasoningDisplay.tsx
44532
- import { jsx as jsx101 } from "react/jsx-runtime";
44695
+ import { jsx as jsx100 } from "react/jsx-runtime";
44533
44696
  var ReasoningDisplayComponent = ({
44534
44697
  reasoning,
44535
44698
  collapsed = false
@@ -44538,13 +44701,13 @@ var ReasoningDisplayComponent = ({
44538
44701
  if (!normalized) {
44539
44702
  return null;
44540
44703
  }
44541
- return /* @__PURE__ */ jsx101(MessageResponse2, { children: /* @__PURE__ */ jsx101(Box_default, { flexDirection: "row", alignItems: "flex-start", width: "100%", marginBottom: 1, children: /* @__PURE__ */ jsx101(Box_default, { flexDirection: "column", flexGrow: 1, children: /* @__PURE__ */ jsx101(Text, { color: BLUMA_TERMINAL.dim, children: normalized }) }) }) });
44704
+ return /* @__PURE__ */ jsx100(MessageResponse2, { children: /* @__PURE__ */ jsx100(Box_default, { flexDirection: "row", alignItems: "flex-start", width: "100%", marginBottom: 1, children: /* @__PURE__ */ jsx100(Box_default, { flexDirection: "column", flexGrow: 1, children: /* @__PURE__ */ jsx100(Text, { color: BLUMA_TERMINAL.dim, children: normalized }) }) }) });
44542
44705
  };
44543
44706
  var ReasoningDisplay = memo23(ReasoningDisplayComponent);
44544
44707
 
44545
44708
  // src/app/ui/components/ExpandedPreviewBlock.tsx
44546
44709
  import { memo as memo24 } from "react";
44547
- import { jsx as jsx102, jsxs as jsxs84 } from "react/jsx-runtime";
44710
+ import { jsx as jsx101, jsxs as jsxs83 } from "react/jsx-runtime";
44548
44711
  function ExpandedPreviewBlockComponent({ data }) {
44549
44712
  const cols = typeof process.stdout?.columns === "number" ? process.stdout.columns : 80;
44550
44713
  const rule = TERMINAL_RULE_CHAR.repeat(Math.max(8, cols));
@@ -44552,28 +44715,28 @@ function ExpandedPreviewBlockComponent({ data }) {
44552
44715
  const cap = EXPAND_OVERLAY_MAX_LINES;
44553
44716
  const shown = lines.slice(0, cap);
44554
44717
  const rest = lines.length - cap;
44555
- return /* @__PURE__ */ jsx102(ChatBlock, { marginBottom: 0, children: /* @__PURE__ */ jsxs84(MessageResponse, { children: [
44556
- /* @__PURE__ */ jsx102(Text, { color: "white", children: rule }),
44557
- /* @__PURE__ */ jsxs84(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
44558
- /* @__PURE__ */ jsx102(Text, { color: BLUMA_TERMINAL.accent, bold: true, children: "expand (Ctrl+O)" }),
44559
- /* @__PURE__ */ jsx102(Text, { dimColor: true, children: data.title }),
44560
- /* @__PURE__ */ jsxs84(Text, { dimColor: true, children: [
44718
+ return /* @__PURE__ */ jsx101(ChatBlock, { marginBottom: 0, children: /* @__PURE__ */ jsxs83(MessageResponse, { children: [
44719
+ /* @__PURE__ */ jsx101(Text, { color: "white", children: rule }),
44720
+ /* @__PURE__ */ jsxs83(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
44721
+ /* @__PURE__ */ jsx101(Text, { color: BLUMA_TERMINAL.accent, bold: true, children: "expand (Ctrl+O)" }),
44722
+ /* @__PURE__ */ jsx101(Text, { dimColor: true, children: data.title }),
44723
+ /* @__PURE__ */ jsxs83(Text, { dimColor: true, children: [
44561
44724
  "+",
44562
44725
  data.linesHidden,
44563
44726
  " lines were clipped in chat \xB7 below: up to ",
44564
44727
  cap,
44565
44728
  " lines \xB7 use read_file_lines before edit_tool"
44566
44729
  ] }),
44567
- /* @__PURE__ */ jsxs84(Box_default, { flexDirection: "column", marginTop: 1, children: [
44568
- shown.map((line, i) => /* @__PURE__ */ jsx102(Text, { dimColor: true, children: line.slice(0, 200) }, i)),
44569
- rest > 0 ? /* @__PURE__ */ jsxs84(Text, { dimColor: true, children: [
44730
+ /* @__PURE__ */ jsxs83(Box_default, { flexDirection: "column", marginTop: 1, children: [
44731
+ shown.map((line, i) => /* @__PURE__ */ jsx101(Text, { dimColor: true, children: line.slice(0, 200) }, i)),
44732
+ rest > 0 ? /* @__PURE__ */ jsxs83(Text, { dimColor: true, children: [
44570
44733
  "\u2026 +",
44571
44734
  rest,
44572
44735
  " more lines in this chunk"
44573
44736
  ] }) : null
44574
44737
  ] })
44575
44738
  ] }),
44576
- /* @__PURE__ */ jsx102(Text, { color: "white", children: rule })
44739
+ /* @__PURE__ */ jsx101(Text, { color: "white", children: rule })
44577
44740
  ] }) });
44578
44741
  }
44579
44742
  var ExpandedPreviewBlock = memo24(ExpandedPreviewBlockComponent);
@@ -45238,16 +45401,16 @@ function usePlanMode() {
45238
45401
 
45239
45402
  // src/app/hooks/useAgentMode.ts
45240
45403
  import { useState as useState22, useEffect as useEffect21, useCallback as useCallback9 } from "react";
45241
- import * as fs51 from "fs";
45404
+ import * as fs50 from "fs";
45242
45405
  import * as path56 from "path";
45243
45406
  import { homedir as homedir4 } from "os";
45244
45407
  var SETTINGS_PATH = path56.join(homedir4(), ".bluma", "settings.json");
45245
45408
  function readAgentModeFromFile() {
45246
45409
  try {
45247
- if (!fs51.existsSync(SETTINGS_PATH)) {
45410
+ if (!fs50.existsSync(SETTINGS_PATH)) {
45248
45411
  return "default";
45249
45412
  }
45250
- const content = fs51.readFileSync(SETTINGS_PATH, "utf-8");
45413
+ const content = fs50.readFileSync(SETTINGS_PATH, "utf-8");
45251
45414
  const settings = JSON.parse(content);
45252
45415
  return settings.agentMode || "default";
45253
45416
  } catch (error) {
@@ -45266,16 +45429,16 @@ function useAgentMode() {
45266
45429
  }, []);
45267
45430
  const updateAgentMode = useCallback9((mode) => {
45268
45431
  try {
45269
- if (!fs51.existsSync(SETTINGS_PATH)) {
45270
- fs51.mkdirSync(path56.dirname(SETTINGS_PATH), { recursive: true });
45432
+ if (!fs50.existsSync(SETTINGS_PATH)) {
45433
+ fs50.mkdirSync(path56.dirname(SETTINGS_PATH), { recursive: true });
45271
45434
  }
45272
45435
  let settings = {};
45273
- if (fs51.existsSync(SETTINGS_PATH)) {
45274
- const content = fs51.readFileSync(SETTINGS_PATH, "utf-8");
45436
+ if (fs50.existsSync(SETTINGS_PATH)) {
45437
+ const content = fs50.readFileSync(SETTINGS_PATH, "utf-8");
45275
45438
  settings = JSON.parse(content);
45276
45439
  }
45277
45440
  settings.agentMode = mode;
45278
- fs51.writeFileSync(SETTINGS_PATH, JSON.stringify(settings, null, 2), "utf-8");
45441
+ fs50.writeFileSync(SETTINGS_PATH, JSON.stringify(settings, null, 2), "utf-8");
45279
45442
  setAgentMode(mode);
45280
45443
  } catch (error) {
45281
45444
  console.error("Failed to update agent mode:", error);
@@ -45295,7 +45458,7 @@ function useAgentMode() {
45295
45458
 
45296
45459
  // src/ink/components/ScrollBox.tsx
45297
45460
  import { useImperativeHandle, useRef as useRef11, useState as useState23 } from "react";
45298
- import { jsx as jsx103 } from "react/jsx-runtime";
45461
+ import { jsx as jsx102 } from "react/jsx-runtime";
45299
45462
  function ScrollBox({
45300
45463
  children,
45301
45464
  ref,
@@ -45401,7 +45564,7 @@ function ScrollBox({
45401
45564
  // every render (which re-registers the ref = churn).
45402
45565
  []
45403
45566
  );
45404
- return /* @__PURE__ */ jsx103("ink-box", { ref: (el) => {
45567
+ return /* @__PURE__ */ jsx102("ink-box", { ref: (el) => {
45405
45568
  domRef.current = el;
45406
45569
  if (el) el.scrollTop ??= 0;
45407
45570
  }, style: {
@@ -45414,7 +45577,7 @@ function ScrollBox({
45414
45577
  overflowY: "scroll"
45415
45578
  }, ...stickyScroll ? {
45416
45579
  stickyScroll: true
45417
- } : {}, children: /* @__PURE__ */ jsx103(Box_default, { flexDirection: "column", flexGrow: 1, flexShrink: 0, width: "100%", children }) });
45580
+ } : {}, children: /* @__PURE__ */ jsx102(Box_default, { flexDirection: "column", flexGrow: 1, flexShrink: 0, width: "100%", children }) });
45418
45581
  }
45419
45582
  var ScrollBox_default = ScrollBox;
45420
45583
 
@@ -45479,6 +45642,20 @@ function useVirtualScroll(scrollRef, itemKeys, columns) {
45479
45642
  prevVpRef.current = next;
45480
45643
  setViewportHeight(next);
45481
45644
  }
45645
+ if (next === 0) {
45646
+ let cancelled = false;
45647
+ queueMicrotask(() => {
45648
+ if (cancelled) return;
45649
+ const vh = scrollRef.current?.getViewportHeight() ?? 0;
45650
+ if (vh !== 0 && vh !== prevVpRef.current) {
45651
+ prevVpRef.current = vh;
45652
+ setViewportHeight(vh);
45653
+ }
45654
+ });
45655
+ return () => {
45656
+ cancelled = true;
45657
+ };
45658
+ }
45482
45659
  });
45483
45660
  const isSticky = scrollRef.current?.isSticky() ?? true;
45484
45661
  const n = itemKeys.length;
@@ -45500,6 +45677,10 @@ function useVirtualScroll(scrollRef, itemKeys, columns) {
45500
45677
  const range = useMemo7(() => {
45501
45678
  if (n === 0) return [0, 0];
45502
45679
  if (viewportHeight <= 0) {
45680
+ if (isSticky) {
45681
+ const lo3 = Math.max(0, n - COLD_START_COUNT);
45682
+ return [lo3, n];
45683
+ }
45503
45684
  return [0, Math.min(n, COLD_START_COUNT)];
45504
45685
  }
45505
45686
  const absScrollTop = Math.abs(scrollTop);
@@ -45590,7 +45771,7 @@ function useSyncExternalStore5(subscribe, getSnapshot, getServerSnapshot) {
45590
45771
  }
45591
45772
 
45592
45773
  // src/app/ui/BlumaSession.tsx
45593
- import { Fragment as Fragment19, jsx as jsx104, jsxs as jsxs85 } from "react/jsx-runtime";
45774
+ import { Fragment as Fragment18, jsx as jsx103, jsxs as jsxs84 } from "react/jsx-runtime";
45594
45775
  var blumaUpdateRegistryCheckStarted = false;
45595
45776
  var BLOCKING_COMMANDS = /* @__PURE__ */ new Set(["init"]);
45596
45777
  var COMMAND_HEADER_COLOR2 = BLUMA_TERMINAL.accent;
@@ -45633,25 +45814,25 @@ function UserMessageWithOptionalImages({
45633
45814
  const cap = stripped2.trim();
45634
45815
  const capDisp = cap.length > 800 ? `${cap.slice(0, 800)}\u2026` : cap;
45635
45816
  const fallbackDisp = raw.length > 800 ? `${raw.slice(0, 800)}\u2026` : raw;
45636
- return /* @__PURE__ */ jsx104(ChatUserMessage, { children: pathStrs.length > 0 ? /* @__PURE__ */ jsx104(
45817
+ return /* @__PURE__ */ jsx103(ChatUserMessage, { children: pathStrs.length > 0 ? /* @__PURE__ */ jsx103(
45637
45818
  ChatUserImageBlock,
45638
45819
  {
45639
45820
  imageCount: pathStrs.length,
45640
45821
  caption: cap.length > 0 ? capDisp : null,
45641
45822
  captionDim: true
45642
45823
  }
45643
- ) : /* @__PURE__ */ jsx104(Text, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: fallbackDisp }) });
45824
+ ) : /* @__PURE__ */ jsx103(Text, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: fallbackDisp }) });
45644
45825
  }
45645
45826
  const displayRaw = raw.length > 1e4 ? `${raw.substring(0, 1e4)}...` : raw;
45646
45827
  const paths2 = collectImagePathStrings(displayRaw);
45647
45828
  const stripped = paths2.length > 0 ? stripImagePathStrings(displayRaw, paths2) : displayRaw;
45648
- return /* @__PURE__ */ jsx104(ChatUserMessage, { children: paths2.length > 0 ? /* @__PURE__ */ jsx104(
45829
+ return /* @__PURE__ */ jsx103(ChatUserMessage, { children: paths2.length > 0 ? /* @__PURE__ */ jsx103(
45649
45830
  ChatUserImageBlock,
45650
45831
  {
45651
45832
  imageCount: paths2.length,
45652
45833
  caption: stripped.trim().length > 0 ? stripped : null
45653
45834
  }
45654
- ) : /* @__PURE__ */ jsx104(Text, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: displayRaw }) });
45835
+ ) : /* @__PURE__ */ jsx103(Text, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: displayRaw }) });
45655
45836
  }
45656
45837
  var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45657
45838
  const agentInstance = useRef13(null);
@@ -45733,7 +45914,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45733
45914
  ...prev,
45734
45915
  {
45735
45916
  id,
45736
- component: /* @__PURE__ */ jsx104(ChatMeta, { children: "Ctrl+O: no truncated preview to expand" }, id)
45917
+ component: /* @__PURE__ */ jsx103(ChatMeta, { children: "Ctrl+O: no truncated preview to expand" }, id)
45737
45918
  }
45738
45919
  ];
45739
45920
  }
@@ -45741,7 +45922,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45741
45922
  ...prev,
45742
45923
  {
45743
45924
  id,
45744
- component: /* @__PURE__ */ jsx104(ExpandedPreviewBlock, { data: p }, id)
45925
+ component: /* @__PURE__ */ jsx103(ExpandedPreviewBlock, { data: p }, id)
45745
45926
  }
45746
45927
  ];
45747
45928
  });
@@ -45763,7 +45944,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45763
45944
  ...prev,
45764
45945
  {
45765
45946
  id: nextId2,
45766
- component: /* @__PURE__ */ jsx104(UpdateNotice_default, { message: msg })
45947
+ component: /* @__PURE__ */ jsx103(UpdateNotice_default, { message: msg })
45767
45948
  }
45768
45949
  ];
45769
45950
  });
@@ -45781,7 +45962,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45781
45962
  ...prev,
45782
45963
  {
45783
45964
  id,
45784
- component: /* @__PURE__ */ jsx104(ChatMeta, { children: "cancelled (Esc)" })
45965
+ component: /* @__PURE__ */ jsx103(ChatMeta, { children: "cancelled (Esc)" })
45785
45966
  }
45786
45967
  ];
45787
45968
  });
@@ -45807,7 +45988,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45807
45988
  ...prev,
45808
45989
  {
45809
45990
  id,
45810
- component: /* @__PURE__ */ jsx104(ChatUserMessage, { children: /* @__PURE__ */ jsx104(Text, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: text }) })
45991
+ component: /* @__PURE__ */ jsx103(ChatUserMessage, { children: /* @__PURE__ */ jsx103(Text, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: text }) })
45811
45992
  }
45812
45993
  ];
45813
45994
  });
@@ -45823,7 +46004,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45823
46004
  ...prev,
45824
46005
  {
45825
46006
  id,
45826
- component: /* @__PURE__ */ jsxs85(ChatMeta, { children: [
46007
+ component: /* @__PURE__ */ jsxs84(ChatMeta, { children: [
45827
46008
  "Failed to initialize: ",
45828
46009
  error instanceof Error ? error.message : String(error)
45829
46010
  ] })
@@ -45841,7 +46022,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45841
46022
  ...prev,
45842
46023
  {
45843
46024
  id,
45844
- component: /* @__PURE__ */ jsx104(
46025
+ component: /* @__PURE__ */ jsx103(
45845
46026
  ErrorMessage_default,
45846
46027
  {
45847
46028
  message: "Slash command cannot be executed while Bluma is working."
@@ -45867,7 +46048,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45867
46048
  ...prev,
45868
46049
  {
45869
46050
  id,
45870
- component: /* @__PURE__ */ jsx104(ChatMeta, { children: "Usage: /img ./screenshot.png \u2014 optional text after the path is sent too" })
46051
+ component: /* @__PURE__ */ jsx103(ChatMeta, { children: "Usage: /img ./screenshot.png \u2014 optional text after the path is sent too" })
45871
46052
  }
45872
46053
  ];
45873
46054
  });
@@ -45886,7 +46067,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45886
46067
  ...prev,
45887
46068
  {
45888
46069
  id,
45889
- component: /* @__PURE__ */ jsx104(UserMessageWithOptionalImages, { raw: payload, variant: "slash-img" })
46070
+ component: /* @__PURE__ */ jsx103(UserMessageWithOptionalImages, { raw: payload, variant: "slash-img" })
45890
46071
  }
45891
46072
  ];
45892
46073
  });
@@ -45922,12 +46103,12 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45922
46103
  if (!willOpenInlineSlashSubmenu(text)) {
45923
46104
  next.push({
45924
46105
  id: nextHistoryId(next),
45925
- component: /* @__PURE__ */ jsx104(ChatUserMessage, { children: /* @__PURE__ */ jsx104(Text, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: text }) })
46106
+ component: /* @__PURE__ */ jsx103(ChatUserMessage, { children: /* @__PURE__ */ jsx103(Text, { color: BLUMA_TERMINAL.m3OnSurface, wrap: "wrap", children: text }) })
45926
46107
  });
45927
46108
  }
45928
46109
  next.push({
45929
46110
  id: nextHistoryId(next),
45930
- component: /* @__PURE__ */ jsx104(
46111
+ component: /* @__PURE__ */ jsx103(
45931
46112
  SlashCommands_default,
45932
46113
  {
45933
46114
  input: text,
@@ -45962,7 +46143,7 @@ var BlumaSessionComponent = ({ eventBus, sessionId, cliVersion }) => {
45962
46143
  ...prev,
45963
46144
  {
45964
46145
  id,
45965
- component: /* @__PURE__ */ jsx104(ChatUserMessage, { children: /* @__PURE__ */ jsxs85(Text, { bold: true, color: "white", children: [
46146
+ component: /* @__PURE__ */ jsx103(ChatUserMessage, { children: /* @__PURE__ */ jsxs84(Text, { bold: true, color: "white", children: [
45966
46147
  "$ !",
45967
46148
  command
45968
46149
  ] }) })
@@ -45988,7 +46169,7 @@ Please use command_status to check the result and report back to the user.`;
45988
46169
  ...prev,
45989
46170
  {
45990
46171
  id,
45991
- component: /* @__PURE__ */ jsxs85(Text, { color: "red", children: [
46172
+ component: /* @__PURE__ */ jsxs84(Text, { color: "red", children: [
45992
46173
  "Failed to execute: ",
45993
46174
  result.error || result.message
45994
46175
  ] })
@@ -46006,7 +46187,7 @@ Please use command_status to check the result and report back to the user.`;
46006
46187
  ...prev,
46007
46188
  {
46008
46189
  id,
46009
- component: /* @__PURE__ */ jsxs85(Text, { color: "red", children: [
46190
+ component: /* @__PURE__ */ jsxs84(Text, { color: "red", children: [
46010
46191
  "Error: ",
46011
46192
  err.message
46012
46193
  ] })
@@ -46026,7 +46207,7 @@ Please use command_status to check the result and report back to the user.`;
46026
46207
  ...prev,
46027
46208
  {
46028
46209
  id,
46029
- component: /* @__PURE__ */ jsx104(UserMessageWithOptionalImages, { raw: text, variant: "plain" })
46210
+ component: /* @__PURE__ */ jsx103(UserMessageWithOptionalImages, { raw: text, variant: "plain" })
46030
46211
  }
46031
46212
  ];
46032
46213
  });
@@ -46048,7 +46229,7 @@ Please use command_status to check the result and report back to the user.`;
46048
46229
  ...prev,
46049
46230
  {
46050
46231
  id,
46051
- component: /* @__PURE__ */ jsx104(UserMessageWithOptionalImages, { raw: message2.content, variant: "plain" })
46232
+ component: /* @__PURE__ */ jsx103(UserMessageWithOptionalImages, { raw: message2.content, variant: "plain" })
46052
46233
  }
46053
46234
  ];
46054
46235
  });
@@ -46094,7 +46275,7 @@ Please use command_status to check the result and report back to the user.`;
46094
46275
  const r = String(reasoning ?? "").trim();
46095
46276
  if (!r) return;
46096
46277
  setHistory((prev) => {
46097
- const component = /* @__PURE__ */ jsx104(ReasoningDisplay, { reasoning: r });
46278
+ const component = /* @__PURE__ */ jsx103(ReasoningDisplay, { reasoning: r });
46098
46279
  if (activeReasoningHistoryIdRef.current !== null) {
46099
46280
  const index = prev.findIndex((item) => item.id === activeReasoningHistoryIdRef.current);
46100
46281
  if (index >= 0) {
@@ -46114,7 +46295,7 @@ Please use command_status to check the result and report back to the user.`;
46114
46295
  const key = reasoningDedupeKey(t);
46115
46296
  lastStreamAssistantKeyRef.current = key;
46116
46297
  setHistory((prev) => {
46117
- const nextComponent = /* @__PURE__ */ jsx104(AssistantMessageDisplay, { content });
46298
+ const nextComponent = /* @__PURE__ */ jsx103(AssistantMessageDisplay, { content });
46118
46299
  const lastAssistantIndex = findLastHistoryIndex(
46119
46300
  prev,
46120
46301
  (item) => item.component.type === AssistantMessageDisplay
@@ -46289,14 +46470,14 @@ Please use command_status to check the result and report back to the user.`;
46289
46470
  }
46290
46471
  let newComponent = null;
46291
46472
  if (parsed.type === "debug") {
46292
- newComponent = /* @__PURE__ */ jsx104(ChatMeta, { children: parsed.message });
46473
+ newComponent = /* @__PURE__ */ jsx103(ChatMeta, { children: parsed.message });
46293
46474
  } else if (parsed.type === "protocol_violation") {
46294
- newComponent = /* @__PURE__ */ jsx104(ChatBlock, { marginBottom: 0, children: /* @__PURE__ */ jsx104(MessageResponse, { children: /* @__PURE__ */ jsxs85(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
46295
- /* @__PURE__ */ jsx104(Text, { dimColor: true, children: parsed.content }),
46296
- /* @__PURE__ */ jsx104(Text, { dimColor: true, children: parsed.message })
46475
+ newComponent = /* @__PURE__ */ jsx103(ChatBlock, { marginBottom: 0, children: /* @__PURE__ */ jsx103(MessageResponse, { children: /* @__PURE__ */ jsxs84(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
46476
+ /* @__PURE__ */ jsx103(Text, { dimColor: true, children: parsed.content }),
46477
+ /* @__PURE__ */ jsx103(Text, { dimColor: true, children: parsed.message })
46297
46478
  ] }) }) });
46298
46479
  } else if (parsed.type === "error") {
46299
- newComponent = /* @__PURE__ */ jsx104(
46480
+ newComponent = /* @__PURE__ */ jsx103(
46300
46481
  ErrorMessage_default,
46301
46482
  {
46302
46483
  message: parsed.message,
@@ -46320,7 +46501,7 @@ Please use command_status to check the result and report back to the user.`;
46320
46501
  if (parsed.tool_call_id) {
46321
46502
  setToolResultStatus(parsed.tool_call_id, "running");
46322
46503
  }
46323
- newComponent = tn ? /* @__PURE__ */ jsx104(
46504
+ newComponent = tn ? /* @__PURE__ */ jsx103(
46324
46505
  ToolMessage,
46325
46506
  {
46326
46507
  toolName: tn,
@@ -46346,11 +46527,11 @@ Please use command_status to check the result and report back to the user.`;
46346
46527
  }
46347
46528
  newComponent = null;
46348
46529
  } else if (parsed.type === "user_overlay") {
46349
- newComponent = /* @__PURE__ */ jsx104(ChatUserMessage, { children: /* @__PURE__ */ jsx104(Text, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: parsed.payload }) });
46530
+ newComponent = /* @__PURE__ */ jsx103(ChatUserMessage, { children: /* @__PURE__ */ jsx103(Text, { color: BLUMA_TERMINAL.m3OnSurface, bold: true, wrap: "wrap", children: parsed.payload }) });
46350
46531
  } else if (parsed.type === "reasoning") {
46351
46532
  setIsReasoning(true);
46352
46533
  } else if (parsed.type === "log") {
46353
- newComponent = /* @__PURE__ */ jsxs85(ChatMeta, { children: [
46534
+ newComponent = /* @__PURE__ */ jsxs84(ChatMeta, { children: [
46354
46535
  parsed.message,
46355
46536
  parsed.payload ? `: ${parsed.payload}` : ""
46356
46537
  ] });
@@ -46361,7 +46542,7 @@ Please use command_status to check the result and report back to the user.`;
46361
46542
  newComponent = null;
46362
46543
  } else {
46363
46544
  lastStreamAssistantKeyRef.current = key || null;
46364
- newComponent = /* @__PURE__ */ jsx104(AssistantMessageDisplay, { content: body });
46545
+ newComponent = /* @__PURE__ */ jsx103(AssistantMessageDisplay, { content: body });
46365
46546
  }
46366
46547
  }
46367
46548
  if (newComponent) {
@@ -46403,7 +46584,7 @@ Please use command_status to check the result and report back to the user.`;
46403
46584
  if (!msg) return;
46404
46585
  setHistory((prev) => {
46405
46586
  const id = nextHistoryId(prev);
46406
- return [...prev, { id, component: /* @__PURE__ */ jsx104(ChatMeta, { children: msg }) }];
46587
+ return [...prev, { id, component: /* @__PURE__ */ jsx103(ChatMeta, { children: msg }) }];
46407
46588
  });
46408
46589
  };
46409
46590
  uiEventBus.on("user_overlay", handleUiOverlay);
@@ -46471,9 +46652,9 @@ Please use command_status to check the result and report back to the user.`;
46471
46652
  const mountedItems = useMemo8(() => {
46472
46653
  return history.slice(lo, hi);
46473
46654
  }, [history, lo, hi]);
46474
- const transcript = useMemo8(() => /* @__PURE__ */ jsx104(Fragment19, { children: /* @__PURE__ */ jsx104(ScrollBox_default, { ref: scrollBoxRef, stickyScroll: true, flexDirection: "column", flexGrow: 1, minHeight: 0, width: "100%", children: /* @__PURE__ */ jsxs85(Box_default, { flexDirection: "column", minHeight: 0, width: "100%", children: [
46475
- topSpacer > 0 && /* @__PURE__ */ jsx104(Box_default, { height: topSpacer }),
46476
- mountedItems.map((item) => /* @__PURE__ */ jsx104(
46655
+ const transcript = useMemo8(() => /* @__PURE__ */ jsx103(Fragment18, { children: /* @__PURE__ */ jsx103(ScrollBox_default, { ref: scrollBoxRef, stickyScroll: true, flexDirection: "column", flexGrow: 1, minHeight: 0, width: "100%", children: /* @__PURE__ */ jsxs84(Box_default, { flexDirection: "column", minHeight: 0, width: "100%", children: [
46656
+ topSpacer > 0 && /* @__PURE__ */ jsx103(Box_default, { height: topSpacer }),
46657
+ mountedItems.map((item) => /* @__PURE__ */ jsx103(
46477
46658
  Box_default,
46478
46659
  {
46479
46660
  flexDirection: "column",
@@ -46482,8 +46663,8 @@ Please use command_status to check the result and report back to the user.`;
46482
46663
  },
46483
46664
  item.id
46484
46665
  )),
46485
- bottomSpacer > 0 && /* @__PURE__ */ jsx104(Box_default, { height: bottomSpacer }),
46486
- /* @__PURE__ */ jsx104(
46666
+ bottomSpacer > 0 && /* @__PURE__ */ jsx103(Box_default, { height: bottomSpacer }),
46667
+ /* @__PURE__ */ jsx103(
46487
46668
  StreamingText,
46488
46669
  {
46489
46670
  eventBus,
@@ -46501,7 +46682,7 @@ Please use command_status to check the result and report back to the user.`;
46501
46682
  measureRef,
46502
46683
  liveToolName
46503
46684
  ]);
46504
- const bottomDock = useMemo8(() => /* @__PURE__ */ jsx104(
46685
+ const bottomDock = useMemo8(() => /* @__PURE__ */ jsx103(
46505
46686
  BlumaBottomDock,
46506
46687
  {
46507
46688
  eventBus,
@@ -46551,10 +46732,10 @@ Please use command_status to check the result and report back to the user.`;
46551
46732
  statusMessage,
46552
46733
  workdir
46553
46734
  ]);
46554
- const header = useMemo8(() => /* @__PURE__ */ jsx104(Header, { sessionId, workdir, cliVersion }), [cliVersion, sessionId, workdir]);
46555
- const overlay = useMemo8(() => /* @__PURE__ */ jsx104(BlumaWorkersOverlay, { sessionId }), [sessionId]);
46556
- const floating = useMemo8(() => /* @__PURE__ */ jsx104(CoordinatorTaskPanel, {}), []);
46557
- return /* @__PURE__ */ jsx104(
46735
+ const header = useMemo8(() => /* @__PURE__ */ jsx103(Header, { sessionId, workdir, cliVersion }), [cliVersion, sessionId, workdir]);
46736
+ const overlay = useMemo8(() => /* @__PURE__ */ jsx103(BlumaWorkersOverlay, { sessionId }), [sessionId]);
46737
+ const floating = useMemo8(() => /* @__PURE__ */ jsx103(CoordinatorTaskPanel, {}), []);
46738
+ return /* @__PURE__ */ jsx103(
46558
46739
  BlumaViewport,
46559
46740
  {
46560
46741
  header,
@@ -46742,7 +46923,7 @@ import { memo as memo26, useCallback as useCallback12, useEffect as useEffect23,
46742
46923
  // src/app/agent/session_manager/session_resume_browser.ts
46743
46924
  init_bluma_app_dir();
46744
46925
  import path57 from "path";
46745
- import { promises as fs52 } from "fs";
46926
+ import { promises as fs51 } from "fs";
46746
46927
  function getSessionsRoot() {
46747
46928
  return path57.join(getPreferredAppDir(), "sessions");
46748
46929
  }
@@ -46765,9 +46946,9 @@ async function sessionEntryFromFile(absPath, sessionId) {
46765
46946
  let preview = "(no messages)";
46766
46947
  let lastActivityMs = Date.now();
46767
46948
  try {
46768
- const st = await fs52.stat(absPath);
46949
+ const st = await fs51.stat(absPath);
46769
46950
  lastActivityMs = st.mtimeMs;
46770
- const raw = await fs52.readFile(absPath, "utf-8");
46951
+ const raw = await fs51.readFile(absPath, "utf-8");
46771
46952
  const data = JSON.parse(raw);
46772
46953
  preview = previewFromHistory(data.conversation_history);
46773
46954
  const iso = data.last_updated || data.created_at;
@@ -46802,8 +46983,8 @@ async function listSessionBrowserEntries(cwdRel) {
46802
46983
  }
46803
46984
  let dirents;
46804
46985
  try {
46805
- await fs52.mkdir(absDir, { recursive: true });
46806
- dirents = await fs52.readdir(absDir, { withFileTypes: true });
46986
+ await fs51.mkdir(absDir, { recursive: true });
46987
+ dirents = await fs51.readdir(absDir, { withFileTypes: true });
46807
46988
  } catch {
46808
46989
  return out;
46809
46990
  }
@@ -46853,7 +47034,7 @@ function childCwd(cwdRel, dirName) {
46853
47034
  }
46854
47035
 
46855
47036
  // src/app/ui/components/SessionResumePicker.tsx
46856
- import { jsx as jsx105, jsxs as jsxs86 } from "react/jsx-runtime";
47037
+ import { jsx as jsx104, jsxs as jsxs85 } from "react/jsx-runtime";
46857
47038
  var VISIBLE_DEFAULT = 10;
46858
47039
  function formatRelativeTime2(ms) {
46859
47040
  const diffMs = Date.now() - ms;
@@ -46964,8 +47145,8 @@ var SessionResumePickerComponent = ({
46964
47145
  });
46965
47146
  const scrollHint2 = total > visibleCount ? ` \xB7 ${scrollTop + 1}\u2013${Math.min(scrollTop + visibleCount, total)} / ${total}` : total > 0 ? ` \xB7 ${total} item${total === 1 ? "" : "s"}` : "";
46966
47147
  const ruleW = Math.min(56, (stdout?.columns ?? 80) - 4);
46967
- return /* @__PURE__ */ jsxs86(Box_default, { flexDirection: "column", paddingX: 1, paddingY: 1, width: "100%", children: [
46968
- /* @__PURE__ */ jsx105(
47148
+ return /* @__PURE__ */ jsxs85(Box_default, { flexDirection: "column", paddingX: 1, paddingY: 1, width: "100%", children: [
47149
+ /* @__PURE__ */ jsx104(
46969
47150
  BlumaBrandHeader,
46970
47151
  {
46971
47152
  actionTitle: "Resume session",
@@ -46973,7 +47154,7 @@ var SessionResumePickerComponent = ({
46973
47154
  ruleWidth: ruleW
46974
47155
  }
46975
47156
  ),
46976
- /* @__PURE__ */ jsxs86(
47157
+ /* @__PURE__ */ jsxs85(
46977
47158
  Box_default,
46978
47159
  {
46979
47160
  flexDirection: "column",
@@ -46985,29 +47166,29 @@ var SessionResumePickerComponent = ({
46985
47166
  width: "100%",
46986
47167
  marginTop: 0,
46987
47168
  children: [
46988
- /* @__PURE__ */ jsxs86(Text, { dimColor: true, wrap: "wrap", children: [
47169
+ /* @__PURE__ */ jsxs85(Text, { dimColor: true, wrap: "wrap", children: [
46989
47170
  "~/",
46990
47171
  breadcrumb,
46991
47172
  scrollHint2
46992
47173
  ] }),
46993
- /* @__PURE__ */ jsx105(Box_default, { marginY: 1, flexDirection: "column", minHeight: 2, children: loading ? /* @__PURE__ */ jsx105(Text, { dimColor: true, children: "Loading\u2026" }) : total === 0 ? /* @__PURE__ */ jsxs86(Box_default, { flexDirection: "column", children: [
46994
- /* @__PURE__ */ jsx105(Text, { color: BLUMA_TERMINAL.muted, children: "Empty folder." }),
46995
- /* @__PURE__ */ jsx105(Text, { dimColor: true, children: "\u2190 back \xB7 Esc exit" })
47174
+ /* @__PURE__ */ jsx104(Box_default, { marginY: 1, flexDirection: "column", minHeight: 2, children: loading ? /* @__PURE__ */ jsx104(Text, { dimColor: true, children: "Loading\u2026" }) : total === 0 ? /* @__PURE__ */ jsxs85(Box_default, { flexDirection: "column", children: [
47175
+ /* @__PURE__ */ jsx104(Text, { color: BLUMA_TERMINAL.muted, children: "Empty folder." }),
47176
+ /* @__PURE__ */ jsx104(Text, { dimColor: true, children: "\u2190 back \xB7 Esc exit" })
46996
47177
  ] }) : windowItems.map((entry, idx) => {
46997
47178
  const realIndex = scrollTop + idx;
46998
47179
  const isSelected = realIndex === selectedIndex;
46999
47180
  if (entry.kind === "up") {
47000
- return /* @__PURE__ */ jsxs86(Box_default, { flexDirection: "row", gap: 1, children: [
47001
- /* @__PURE__ */ jsx105(Text, { color: isSelected ? BLUMA_TERMINAL.blue : BLUMA_TERMINAL.subtle, children: isSelected ? "\u203A" : " " }),
47002
- /* @__PURE__ */ jsx105(Text, { bold: isSelected, color: isSelected ? BLUMA_TERMINAL.blue : BLUMA_TERMINAL.muted, children: ".." }),
47003
- /* @__PURE__ */ jsx105(Text, { dimColor: !isSelected, children: "back" })
47181
+ return /* @__PURE__ */ jsxs85(Box_default, { flexDirection: "row", gap: 1, children: [
47182
+ /* @__PURE__ */ jsx104(Text, { color: isSelected ? BLUMA_TERMINAL.blue : BLUMA_TERMINAL.subtle, children: isSelected ? "\u203A" : " " }),
47183
+ /* @__PURE__ */ jsx104(Text, { bold: isSelected, color: isSelected ? BLUMA_TERMINAL.blue : BLUMA_TERMINAL.muted, children: ".." }),
47184
+ /* @__PURE__ */ jsx104(Text, { dimColor: !isSelected, children: "back" })
47004
47185
  ] }, "up");
47005
47186
  }
47006
47187
  if (entry.kind === "dir") {
47007
- return /* @__PURE__ */ jsxs86(Box_default, { flexDirection: "row", gap: 1, children: [
47008
- /* @__PURE__ */ jsx105(Text, { color: isSelected ? BLUMA_TERMINAL.blue : BLUMA_TERMINAL.subtle, children: isSelected ? "\u203A" : " " }),
47009
- /* @__PURE__ */ jsx105(Text, { color: isSelected ? BLUMA_TERMINAL.orange : BLUMA_TERMINAL.muted, children: isSelected ? "\u25B8" : "\u25B9" }),
47010
- /* @__PURE__ */ jsxs86(
47188
+ return /* @__PURE__ */ jsxs85(Box_default, { flexDirection: "row", gap: 1, children: [
47189
+ /* @__PURE__ */ jsx104(Text, { color: isSelected ? BLUMA_TERMINAL.blue : BLUMA_TERMINAL.subtle, children: isSelected ? "\u203A" : " " }),
47190
+ /* @__PURE__ */ jsx104(Text, { color: isSelected ? BLUMA_TERMINAL.orange : BLUMA_TERMINAL.muted, children: isSelected ? "\u25B8" : "\u25B9" }),
47191
+ /* @__PURE__ */ jsxs85(
47011
47192
  Text,
47012
47193
  {
47013
47194
  bold: isSelected,
@@ -47020,16 +47201,16 @@ var SessionResumePickerComponent = ({
47020
47201
  )
47021
47202
  ] }, `dir-${entry.name}`);
47022
47203
  }
47023
- return /* @__PURE__ */ jsxs86(
47204
+ return /* @__PURE__ */ jsxs85(
47024
47205
  Box_default,
47025
47206
  {
47026
47207
  flexDirection: "column",
47027
47208
  marginBottom: 0,
47028
47209
  children: [
47029
- /* @__PURE__ */ jsxs86(Box_default, { flexDirection: "row", gap: 1, children: [
47030
- /* @__PURE__ */ jsx105(Text, { color: isSelected ? BLUMA_TERMINAL.blue : BLUMA_TERMINAL.subtle, children: isSelected ? "\u203A" : " " }),
47031
- /* @__PURE__ */ jsx105(Text, { color: isSelected ? BLUMA_TERMINAL.success : BLUMA_TERMINAL.muted, children: isSelected ? "\u25CF" : "\u25CB" }),
47032
- /* @__PURE__ */ jsx105(
47210
+ /* @__PURE__ */ jsxs85(Box_default, { flexDirection: "row", gap: 1, children: [
47211
+ /* @__PURE__ */ jsx104(Text, { color: isSelected ? BLUMA_TERMINAL.blue : BLUMA_TERMINAL.subtle, children: isSelected ? "\u203A" : " " }),
47212
+ /* @__PURE__ */ jsx104(Text, { color: isSelected ? BLUMA_TERMINAL.success : BLUMA_TERMINAL.muted, children: isSelected ? "\u25CF" : "\u25CB" }),
47213
+ /* @__PURE__ */ jsx104(
47033
47214
  Text,
47034
47215
  {
47035
47216
  bold: isSelected,
@@ -47040,7 +47221,7 @@ var SessionResumePickerComponent = ({
47040
47221
  }
47041
47222
  )
47042
47223
  ] }),
47043
- /* @__PURE__ */ jsx105(Box_default, { paddingLeft: 4, children: /* @__PURE__ */ jsxs86(Text, { dimColor: true, children: [
47224
+ /* @__PURE__ */ jsx104(Box_default, { paddingLeft: 4, children: /* @__PURE__ */ jsxs85(Text, { dimColor: true, children: [
47044
47225
  entry.label,
47045
47226
  " \xB7 ",
47046
47227
  formatRelativeTime2(entry.lastActivityMs)
@@ -47050,8 +47231,8 @@ var SessionResumePickerComponent = ({
47050
47231
  `sess-${entry.sessionId}`
47051
47232
  );
47052
47233
  }) }),
47053
- /* @__PURE__ */ jsx105(Text, { dimColor: true, children: "\u2500".repeat(Math.min(52, (stdout?.columns ?? 80) - 6)) }),
47054
- /* @__PURE__ */ jsx105(Text, { dimColor: true, children: "\u2191\u2193 move \xB7 Enter open / resume \xB7 \u2190 back \xB7 Esc cancel" })
47234
+ /* @__PURE__ */ jsx104(Text, { dimColor: true, children: "\u2500".repeat(Math.min(52, (stdout?.columns ?? 80) - 6)) }),
47235
+ /* @__PURE__ */ jsx104(Text, { dimColor: true, children: "\u2191\u2193 move \xB7 Enter open / resume \xB7 \u2190 back \xB7 Esc cancel" })
47055
47236
  ]
47056
47237
  }
47057
47238
  )
@@ -47187,9 +47368,9 @@ async function runAgentMode() {
47187
47368
  try {
47188
47369
  if (inputFileIndex !== -1 && args[inputFileIndex + 1]) {
47189
47370
  const filePath = args[inputFileIndex + 1];
47190
- rawPayload = fs53.readFileSync(filePath, "utf-8");
47371
+ rawPayload = fs52.readFileSync(filePath, "utf-8");
47191
47372
  } else {
47192
- rawPayload = fs53.readFileSync(0, "utf-8");
47373
+ rawPayload = fs52.readFileSync(0, "utf-8");
47193
47374
  }
47194
47375
  } catch (err) {
47195
47376
  writeAgentEvent(registrySessionId, {
@@ -47440,7 +47621,7 @@ function readCliPackageVersion() {
47440
47621
  try {
47441
47622
  const base = path58.dirname(fileURLToPath8(import.meta.url));
47442
47623
  const pkgPath = path58.join(base, "..", "package.json");
47443
- const j = JSON.parse(fs53.readFileSync(pkgPath, "utf8"));
47624
+ const j = JSON.parse(fs52.readFileSync(pkgPath, "utf8"));
47444
47625
  return String(j.version || "0.0.0");
47445
47626
  } catch {
47446
47627
  return "0.0.0";
@@ -47566,7 +47747,7 @@ function startBackgroundAgent() {
47566
47747
  process.exit(1);
47567
47748
  }
47568
47749
  const filePath = args[inputFileIndex + 1];
47569
- const rawPayload = fs53.readFileSync(filePath, "utf-8");
47750
+ const rawPayload = fs52.readFileSync(filePath, "utf-8");
47570
47751
  const envelope = JSON.parse(rawPayload);
47571
47752
  const sessionId = envelope.session_id || envelope.message_id || uuidv412();
47572
47753
  registerSession({