deepcode-ai 1.2.11 → 1.2.13

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.
package/dist/index.js CHANGED
@@ -2233,12 +2233,11 @@ var SessionTelemetrySchema = z.object({
2233
2233
  });
2234
2234
 
2235
2235
  // ../../packages/core/dist/index.js
2236
- import { z as z2 } from "zod";
2237
2236
  import { execFile, spawn } from "child_process";
2238
2237
  import { spawn as spawn2 } from "child_process";
2239
2238
  import { createInterface } from "readline";
2240
2239
  import { Effect as Effect3 } from "effect";
2241
- import { z as z22 } from "zod";
2240
+ import { z as z2 } from "zod";
2242
2241
  import { Effect as Effect2 } from "effect";
2243
2242
  import fs from "fs";
2244
2243
  import path22 from "path";
@@ -2249,12 +2248,12 @@ import { mkdir as mkdir22, readFile as readFile2 } from "fs/promises";
2249
2248
  import os from "os";
2250
2249
  import path4 from "path";
2251
2250
  import { EventEmitter } from "events";
2252
- import { z as z3 } from "zod";
2251
+ import { z as z22 } from "zod";
2253
2252
  import { spawn as spawn3 } from "child_process";
2254
2253
  import { URL as URL2 } from "url";
2255
2254
  import { URLSearchParams } from "url";
2256
2255
  import { execFile as execFile2 } from "child_process";
2257
- import { z as z4 } from "zod";
2256
+ import { z as z3 } from "zod";
2258
2257
  import { spawn as spawn4 } from "child_process";
2259
2258
  import { existsSync } from "fs";
2260
2259
  import path5 from "path";
@@ -2270,24 +2269,24 @@ import path9 from "path";
2270
2269
  import { readFile as readFile5 } from "fs/promises";
2271
2270
  import path11 from "path";
2272
2271
  import { Effect as Effect4 } from "effect";
2273
- import { z as z5 } from "zod";
2272
+ import { z as z4 } from "zod";
2274
2273
  import { lstat as lstat2, mkdir as mkdir6, readFile as readFile6, readdir as readdir4, stat, writeFile as writeFile22 } from "fs/promises";
2275
2274
  import path12 from "path";
2276
2275
  import { Effect as Effect5 } from "effect";
2277
- import { z as z6 } from "zod";
2276
+ import { z as z5 } from "zod";
2278
2277
  import { Effect as Effect6 } from "effect";
2279
- import { z as z7 } from "zod";
2278
+ import { z as z6 } from "zod";
2280
2279
  import path13 from "path";
2281
2280
  import { Effect as Effect7 } from "effect";
2282
- import { z as z8 } from "zod";
2281
+ import { z as z7 } from "zod";
2283
2282
  import { Effect as Effect8 } from "effect";
2284
- import { z as z9 } from "zod";
2283
+ import { z as z8 } from "zod";
2285
2284
  import { Effect as Effect9 } from "effect";
2286
- import { z as z10 } from "zod";
2285
+ import { z as z9 } from "zod";
2287
2286
  import { Effect as Effect10 } from "effect";
2288
- import { z as z11 } from "zod";
2287
+ import { z as z10 } from "zod";
2289
2288
  import { Effect as Effect11 } from "effect";
2290
- import { z as z12 } from "zod";
2289
+ import { z as z11 } from "zod";
2291
2290
  import { zodToJsonSchema as zodToJsonSchema2 } from "zod-to-json-schema";
2292
2291
  import path14 from "path";
2293
2292
  import { readdir as readdir5, lstat as lstat3 } from "fs/promises";
@@ -2547,139 +2546,6 @@ function failoverOrder(primary) {
2547
2546
  (provider) => provider !== primary
2548
2547
  );
2549
2548
  }
2550
- var TaskStatusSchema = z2.enum(["pending", "running", "completed", "failed"]);
2551
- var TaskSchema = z2.object({
2552
- id: z2.string().min(1).max(50).regex(/^[a-z0-9-]+$/),
2553
- description: z2.string().min(1).max(500),
2554
- type: z2.enum(["research", "code", "test", "verify"]),
2555
- dependencies: z2.array(z2.string()).default([]),
2556
- status: TaskStatusSchema,
2557
- result: z2.string().optional(),
2558
- error: z2.string().optional()
2559
- });
2560
- var TaskPlanSchema = z2.object({
2561
- objective: z2.string().min(1),
2562
- tasks: z2.array(TaskSchema),
2563
- raw: z2.string().optional(),
2564
- currentTaskId: z2.string().optional()
2565
- });
2566
- var PlannedTaskSchema = z2.object({
2567
- id: z2.string().min(1).max(50).regex(/^[a-z0-9-]+$/),
2568
- description: z2.string().min(1).max(500),
2569
- type: z2.enum(["research", "code", "test", "verify"]),
2570
- dependencies: z2.array(z2.string()).default([])
2571
- });
2572
- var PlannedTaskArraySchema = z2.array(PlannedTaskSchema).min(1, "At least one task is required.");
2573
- var READ_ONLY_DISCOVERY_VERB_PATTERN = /\b(?:list|show|find|search|inspect|check|track|listar|mostre|mostrar|busque|buscar|procure|procurar|inspecione|verifique|rastrear|rastreie)\b/i;
2574
- var READ_ONLY_DISCOVERY_NOUN_PATTERN = /\b(?:project|projects|repo|repos|repository|repositories|directory|directories|folder|folders|workspace|projeto|projetos|repositorio|repositorios|diretorio|diretorios|pasta|pastas)\b/i;
2575
- var READ_ONLY_MUTATION_PATTERN = /\b(?:git\s+init|git\s+add|git\s+commit|git\s+push|git\s+tag|git\s+stash|initialize\s+(?:a\s+)?git\s+repository|initialise\s+(?:a\s+)?git\s+repository|create\s+(?:a\s+)?\.?gitignore|stage\s+all\s+files|commit\s+all\s+files)\b/i;
2576
- function isReadOnlyDiscoveryObjective(objective) {
2577
- return READ_ONLY_DISCOVERY_VERB_PATTERN.test(objective) && READ_ONLY_DISCOVERY_NOUN_PATTERN.test(objective);
2578
- }
2579
- var TaskPlanner = class {
2580
- async plan(objective, complete) {
2581
- const readOnlyDiscoveryObjective = isReadOnlyDiscoveryObjective(objective);
2582
- const raw = await complete(`Create an execution plan for this coding task.
2583
- Return only JSON in this shape:
2584
- [
2585
- {"id":"short-id","description":"specific action","type":"research|code|test|verify","dependencies":[]}
2586
- ]
2587
-
2588
- Requirements:
2589
- - Each task must have a unique ID (lowercase, alphanumeric with hyphens)
2590
- - Description should be specific and actionable
2591
- - Type must be one of: research, code, test, verify
2592
- - Dependencies must reference existing task IDs
2593
- - Tasks should be ordered logically
2594
- ${readOnlyDiscoveryObjective ? `- This is a read-only discovery request; prefer the fewest inspection steps needed
2595
- - Do not propose initializing git repositories, creating .gitignore, staging files, committing, or pushing
2596
- - Do not propose filesystem mutations for this request` : ""}
2597
-
2598
- Task:
2599
- ${objective}`);
2600
- try {
2601
- const parsedRaw = JSON.parse(raw);
2602
- const validationResult = PlannedTaskArraySchema.safeParse(parsedRaw);
2603
- if (!validationResult.success) {
2604
- throw new Error(`Invalid task plan format: ${validationResult.error.message}`);
2605
- }
2606
- const taskIds = new Set(validationResult.data.map((t2) => t2.id));
2607
- for (const task of validationResult.data) {
2608
- for (const dep of task.dependencies) {
2609
- if (!taskIds.has(dep)) {
2610
- throw new Error(`Task "${task.id}" has unknown dependency: "${dep}"`);
2611
- }
2612
- }
2613
- if (readOnlyDiscoveryObjective && READ_ONLY_MUTATION_PATTERN.test(task.description)) {
2614
- throw new Error(`Unsafe mutating task in read-only plan: "${task.description}"`);
2615
- }
2616
- }
2617
- return {
2618
- objective,
2619
- raw,
2620
- tasks: validationResult.data.map((task) => ({
2621
- id: task.id,
2622
- description: task.description,
2623
- type: task.type,
2624
- dependencies: task.dependencies,
2625
- status: "pending"
2626
- }))
2627
- };
2628
- } catch (error) {
2629
- if (error instanceof SyntaxError) {
2630
- throw new Error(`Invalid JSON in task plan: ${error.message}`);
2631
- }
2632
- throw error;
2633
- }
2634
- }
2635
- /**
2636
- * Get the next task that can be executed (all dependencies completed)
2637
- */
2638
- getNextTask(plan) {
2639
- return this.getRunnableTasks(plan)[0];
2640
- }
2641
- /**
2642
- * Get all tasks that can be executed in parallel (dependencies satisfied, status pending)
2643
- */
2644
- getRunnableTasks(plan) {
2645
- const completedIds = new Set(
2646
- plan.tasks.filter((t2) => t2.status === "completed").map((t2) => t2.id)
2647
- );
2648
- return plan.tasks.filter((task) => {
2649
- if (task.status !== "pending") return false;
2650
- return task.dependencies.every((dep) => completedIds.has(dep));
2651
- });
2652
- }
2653
- /**
2654
- * Update task status
2655
- */
2656
- updateTaskStatus(plan, taskId, status, result, error) {
2657
- const task = plan.tasks.find((t2) => t2.id === taskId);
2658
- if (task) {
2659
- task.status = status;
2660
- if (result !== void 0) task.result = result;
2661
- if (error !== void 0) task.error = error;
2662
- }
2663
- }
2664
- /**
2665
- * Check if all tasks are completed
2666
- */
2667
- isComplete(plan) {
2668
- return plan.tasks.length > 0 && plan.tasks.every((t2) => t2.status === "completed");
2669
- }
2670
- hasFailures(plan) {
2671
- return plan.tasks.some((t2) => t2.status === "failed");
2672
- }
2673
- /**
2674
- * Get progress summary
2675
- */
2676
- getProgress(plan) {
2677
- const completed = plan.tasks.filter((t2) => t2.status === "completed").length;
2678
- const total = plan.tasks.length;
2679
- const percentage = total === 0 ? 0 : Math.round(completed / total * 100);
2680
- return { completed, total, percentage };
2681
- }
2682
- };
2683
2549
  function estimateTokens(messages) {
2684
2550
  return Math.ceil(
2685
2551
  messages.reduce((sum, m) => {
@@ -3479,7 +3345,6 @@ var Agent = class {
3479
3345
  permissions;
3480
3346
  pathSecurity;
3481
3347
  eventBus;
3482
- planner = new TaskPlanner();
3483
3348
  /** Per-session undo stacks. Each write_file / edit_file pushes one entry. */
3484
3349
  undoStacks = /* @__PURE__ */ new Map();
3485
3350
  /** Active token budget for the current run(), keyed by sessionId. */
@@ -3522,8 +3387,6 @@ Caminho: ${selectedPath}`;
3522
3387
  } else {
3523
3388
  session.metadata.pendingProjectList = void 0;
3524
3389
  }
3525
- session.metadata.plan = void 0;
3526
- session.metadata.planError = void 0;
3527
3390
  const directResponse = turnStrategy.kind === "chat" && !turnStrategy.allowTools ? directLocalResponse(turnStrategy.intent) : void 0;
3528
3391
  if (directResponse) {
3529
3392
  session.metadata.lastTurnUsedLlm = false;
@@ -3560,48 +3423,14 @@ Caminho: ${selectedPath}`;
3560
3423
  );
3561
3424
  }
3562
3425
  await this.assertModelAvailable(session, resolvedTarget.provider, effectiveModel, options.signal);
3563
- session.status = "planning";
3564
3426
  this.activeBudgets.set(session.id, new SessionBudget(this.config.tokenBudget));
3565
3427
  try {
3566
- const planningProvider = this.providerManager.get(resolvedTarget.provider);
3567
- let plan;
3568
- if (turnStrategy.shouldPlan) {
3569
- try {
3570
- plan = await this.planner.plan(
3571
- options.input,
3572
- (prompt) => planningProvider.complete(prompt, {
3573
- model: resolvedModel,
3574
- maxTokens: Math.min(this.config.maxTokens, 512),
3575
- temperature: 0,
3576
- signal: options.signal,
3577
- onUsage: (inputTokens, outputTokens) => {
3578
- this.recordUsage(session.id, inputTokens, outputTokens);
3579
- }
3580
- })
3581
- );
3582
- session.metadata.plan = plan;
3583
- } catch (error) {
3584
- if (error instanceof BudgetExceededError) {
3585
- throw error;
3586
- }
3587
- if (options.signal?.aborted) {
3588
- throw error;
3589
- }
3590
- session.metadata.planError = formatErrorChain(error);
3591
- this.eventBus.emit("app:warn", {
3592
- message: formatPlanningFailureWarning(error),
3593
- context: { error: session.metadata.planError }
3594
- });
3595
- }
3596
- }
3597
3428
  let finalText = "";
3598
- let iterations = 0;
3429
+ const iterations = 0;
3599
3430
  const maxIterations = this.config.maxIterations;
3600
3431
  session.status = "executing";
3601
3432
  if (turnStrategy.kind === "utility") {
3602
3433
  finalText = await this.executeUtilityTurn(session, options.input, mode, options);
3603
- } else if (plan && mode === "build") {
3604
- finalText = await this.executePlan(plan, session, mode, options);
3605
3434
  } else {
3606
3435
  finalText = await this.executeTraditional(session, mode, maxIterations, iterations, options, turnStrategy);
3607
3436
  }
@@ -3651,209 +3480,7 @@ Caminho: ${selectedPath}`;
3651
3480
  }
3652
3481
  }
3653
3482
  /**
3654
- * Execute tasks from plan in parallel rounds, respecting dependencies
3655
- */
3656
- async executePlan(plan, session, mode, options) {
3657
- let finalText = `Executing plan: ${plan.objective}
3658
-
3659
- `;
3660
- let rounds = 0;
3661
- const maxRounds = this.config.maxIterations;
3662
- while (rounds < maxRounds) {
3663
- const runnableTasks = this.planner.getRunnableTasks(plan);
3664
- if (runnableTasks.length === 0) {
3665
- if (this.planner.hasFailures(plan)) {
3666
- const failedTasks = plan.tasks.filter((t2) => t2.status === "failed");
3667
- finalText += `
3668
- \u2717 Execution stopped due to failed tasks: ${failedTasks.map((t2) => t2.id).join(", ")}`;
3669
- } else if (this.planner.isComplete(plan)) {
3670
- finalText += "\n\u2713 All tasks completed successfully!";
3671
- } else {
3672
- finalText += "\n\u26A0 Plan contained no runnable tasks.";
3673
- }
3674
- break;
3675
- }
3676
- for (const task of runnableTasks) {
3677
- this.planner.updateTaskStatus(plan, task.id, "running");
3678
- options.onTaskUpdate?.(task, plan);
3679
- }
3680
- const progress = this.planner.getProgress(plan);
3681
- const parallel = runnableTasks.length > 1;
3682
- const taskLines = await Promise.all(
3683
- runnableTasks.map(async (task, taskIndex) => {
3684
- const taskPrompt = this.buildTaskPrompt(plan, task, progress);
3685
- const executionSession = parallel ? this.createChildSession(session, task.id) : session;
3686
- const maxAttempts = 1 + this.config.taskRetries;
3687
- let lastError;
3688
- const taskOptions = options.onChunkForTask ? { ...options, onChunk: (text) => options.onChunkForTask(task.id, text) } : options;
3689
- for (let attempt = 0; attempt < maxAttempts; attempt++) {
3690
- const prompt = lastError ? `${taskPrompt}
3691
-
3692
- Previous attempt failed: ${lastError}
3693
- Try a different approach.` : taskPrompt;
3694
- try {
3695
- const result = await this.executeTaskWithLLM(prompt, executionSession, mode, taskOptions, task.type);
3696
- this.planner.updateTaskStatus(plan, task.id, "completed", result);
3697
- options.onTaskUpdate?.(task, plan);
3698
- return `[${progress.completed + taskIndex + 1}/${progress.total}] \u2713 ${task.description}`;
3699
- } catch (error) {
3700
- if (error instanceof BudgetExceededError) {
3701
- throw error;
3702
- }
3703
- lastError = error instanceof Error ? error.message : String(error);
3704
- }
3705
- }
3706
- this.planner.updateTaskStatus(plan, task.id, "failed", void 0, lastError);
3707
- options.onTaskUpdate?.(task, plan);
3708
- return `[${progress.completed + taskIndex + 1}/${progress.total}] \u2717 ${task.description} \u2014 ${lastError}`;
3709
- })
3710
- );
3711
- finalText += `${taskLines.join("\n")}
3712
- `;
3713
- rounds++;
3714
- options.onIteration?.(rounds, maxRounds);
3715
- if (this.planner.hasFailures(plan) && this.config.strictMode) break;
3716
- if (this.planner.isComplete(plan)) {
3717
- finalText += "\n\u2713 All tasks completed successfully!";
3718
- break;
3719
- }
3720
- }
3721
- if (rounds >= maxRounds) {
3722
- finalText += "\n\u26A0 Reached maximum rounds limit. Some tasks may not have been executed.";
3723
- }
3724
- return finalText;
3725
- }
3726
- /**
3727
- * Build a prompt for the current task with context
3728
- */
3729
- buildTaskPrompt(plan, task, progress) {
3730
- const completedTasks = plan.tasks.filter((t2) => t2.status === "completed");
3731
- const contextLimit = (t2) => t2.type === "research" ? 800 : 200;
3732
- const context = completedTasks.length > 0 ? `
3733
-
3734
- Context from completed tasks:
3735
- ${completedTasks.map((t2) => `- ${t2.description}: ${t2.result?.slice(0, contextLimit(t2)) || "Done"}...`).join("\n")}` : "";
3736
- return `You are working on the following objective: "${plan.objective}"
3737
-
3738
- Current task (${progress.completed + 1}/${progress.total} - ${progress.percentage}% complete):
3739
- ID: ${task.id}
3740
- Type: ${task.type}
3741
- Description: ${task.description}
3742
- ${task.dependencies.length > 0 ? `Dependencies: ${task.dependencies.join(", ")}` : ""}
3743
-
3744
- ${context}
3745
-
3746
- Execute this task using the available tools. Return a summary of what was done.`;
3747
- }
3748
- /**
3749
- * Execute a single task using LLM and tools
3750
- */
3751
- async executeTaskWithLLM(prompt, session, mode, options, taskType) {
3752
- const taskPrompt = this.createInternalPromptMessage(prompt);
3753
- const allowedToolNames = this.allowedToolNamesForTaskType(mode, taskType, this.getRevealedTools(session));
3754
- const resolvedModel = session.model ?? resolveConfiguredModelForProvider(this.config, session.provider);
3755
- const toolProfile = resolveModelExecutionProfile(session.provider, resolvedModel);
3756
- const maxTaskIterations = 10;
3757
- let taskIterations = 0;
3758
- let finalAssistantText = "";
3759
- while (taskIterations < maxTaskIterations) {
3760
- taskIterations++;
3761
- this.enforceBudget(session.id);
3762
- const toolDefinitions = this.toolDefinitionsForNames(allowedToolNames, toolProfile.toolSchemaMode);
3763
- const textToolFallbackEnabled = toolDefinitions.length > 0 && toolProfile.toolCallStrategy !== "native";
3764
- const chunks = this.providerManager.chat(
3765
- this.messagesForSystemPrompt(
3766
- session,
3767
- this.systemPromptForMode(mode),
3768
- true,
3769
- [taskPrompt],
3770
- textToolFallbackEnabled ? buildFallbackToolCallPrompt(allowedToolNames) : void 0,
3771
- mode === "build" ? this.buildDeferredToolsHint(session) : void 0
3772
- ),
3773
- {
3774
- preferredProvider: options.provider ?? session.provider,
3775
- failover: this.failoverOrder(options.provider ?? session.provider),
3776
- model: resolvedModel,
3777
- maxTokens: this.config.maxTokens,
3778
- temperature: this.config.temperature,
3779
- tools: toolDefinitions,
3780
- toolChoice: this.resolveTaskToolChoice(
3781
- taskIterations,
3782
- toolDefinitions.length,
3783
- toolProfile.supportsRequiredToolChoice
3784
- ),
3785
- signal: options.signal
3786
- }
3787
- );
3788
- let assistantText = "";
3789
- const toolCalls = [];
3790
- const xmlFilter = textToolFallbackEnabled ? new XmlToolCallStreamFilter() : null;
3791
- for await (const chunk of chunks) {
3792
- if (chunk.type === "delta") {
3793
- assistantText += chunk.content;
3794
- if (textToolFallbackEnabled) {
3795
- const visible = xmlFilter.filter(chunk.content);
3796
- if (visible) options.onChunk?.(visible);
3797
- } else {
3798
- options.onChunk?.(chunk.content);
3799
- }
3800
- }
3801
- if (chunk.type === "tool_call") {
3802
- toolCalls.push(chunk.call);
3803
- }
3804
- if (chunk.type === "usage") {
3805
- options.onUsage?.(chunk.inputTokens, chunk.outputTokens);
3806
- this.recordUsage(session.id, chunk.inputTokens, chunk.outputTokens);
3807
- }
3808
- }
3809
- if (textToolFallbackEnabled) {
3810
- const flushed = xmlFilter.flush();
3811
- if (flushed) options.onChunk?.(flushed);
3812
- }
3813
- const turnResult = textToolFallbackEnabled ? applyFallbackToolCallParsing(assistantText, toolCalls, allowedToolNames) : { assistantText, toolCalls };
3814
- assistantText = turnResult.assistantText;
3815
- const nextToolCalls = [...turnResult.toolCalls];
3816
- toolCalls.length = 0;
3817
- toolCalls.push(...nextToolCalls);
3818
- if (assistantText.trim() || toolCalls.length > 0) {
3819
- this.sessions.addMessage(session.id, {
3820
- role: "assistant",
3821
- source: "assistant",
3822
- content: assistantText,
3823
- toolCalls: toolCalls.length > 0 ? toolCalls : void 0
3824
- });
3825
- finalAssistantText = finalAssistantText ? `${finalAssistantText}
3826
- ${assistantText}` : assistantText;
3827
- }
3828
- if (toolCalls.length === 0) {
3829
- break;
3830
- }
3831
- for (const call of toolCalls) {
3832
- const result = await this.executeTool(
3833
- call,
3834
- session,
3835
- mode,
3836
- options.signal,
3837
- allowedToolNames,
3838
- options.onToolActivity,
3839
- (names) => {
3840
- for (const name of names) {
3841
- if (this.tools.get(name)) allowedToolNames.add(name);
3842
- }
3843
- }
3844
- );
3845
- this.sessions.addMessage(session.id, {
3846
- role: "tool",
3847
- source: "tool",
3848
- content: truncateToolOutput(result.output),
3849
- toolCallId: call.id
3850
- });
3851
- }
3852
- }
3853
- return finalAssistantText.trim();
3854
- }
3855
- /**
3856
- * Traditional execution loop (fallback when planning fails or in plan mode)
3483
+ * Traditional execution loop
3857
3484
  */
3858
3485
  async executeTraditional(session, mode, maxIterations, startingIterations, options, turnStrategy) {
3859
3486
  let finalText = "";
@@ -3946,7 +3573,8 @@ ${assistantText}` : assistantText;
3946
3573
  });
3947
3574
  }
3948
3575
  if (toolCalls.length === 0) break;
3949
- for (const call of toolCalls) {
3576
+ for (let callIdx = 0; callIdx < toolCalls.length; callIdx++) {
3577
+ const call = toolCalls[callIdx];
3950
3578
  const result = await this.executeTool(
3951
3579
  call,
3952
3580
  session,
@@ -3975,6 +3603,14 @@ ${assistantText}` : assistantText;
3975
3603
  consecutiveErrorCount = 1;
3976
3604
  }
3977
3605
  if (consecutiveErrorCount >= 3) {
3606
+ for (let j = callIdx + 1; j < toolCalls.length; j++) {
3607
+ this.sessions.addMessage(session.id, {
3608
+ role: "tool",
3609
+ source: "tool",
3610
+ content: "[Execu\xE7\xE3o cancelada: erros id\xEAnticos repetidos]",
3611
+ toolCallId: toolCalls[j].id
3612
+ });
3613
+ }
3978
3614
  const abortMsg = `
3979
3615
  [${call.name} falhou com o mesmo erro ${consecutiveErrorCount} vezes seguidas. Abortando para evitar loop. Tente uma abordagem diferente.]`;
3980
3616
  finalText += abortMsg;
@@ -4038,7 +3674,7 @@ ${assistantText}` : assistantText;
4038
3674
  if (call.name === "write_file") {
4039
3675
  const args = call.arguments;
4040
3676
  if (!args?.path || !args?.content) {
4041
- hint = " Your output was likely truncated before the tool call completed. Use multiple edit_file calls to apply changes in smaller chunks instead of rewriting the whole file.";
3677
+ hint = " Sua sa\xEDda foi provavelmente truncada antes da chamada completar. Use m\xFAltiplas chamadas edit_file para aplicar as mudan\xE7as em partes menores em vez de reescrever o arquivo inteiro.";
4042
3678
  }
4043
3679
  }
4044
3680
  return {
@@ -4125,15 +3761,6 @@ ${assistantText}` : assistantText;
4125
3761
  session.activities.push(full);
4126
3762
  this.eventBus.emit("activity", full);
4127
3763
  }
4128
- resolveTaskToolChoice(taskIteration, toolCount, supportsRequiredToolChoice) {
4129
- if (toolCount === 0) {
4130
- return void 0;
4131
- }
4132
- if (taskIteration === 1 && supportsRequiredToolChoice) {
4133
- return "required";
4134
- }
4135
- return "auto";
4136
- }
4137
3764
  resolveTraditionalToolChoice(turnStrategy, mode, firstIteration, toolCount, supportsRequiredToolChoice) {
4138
3765
  if (toolCount === 0) {
4139
3766
  return void 0;
@@ -4174,15 +3801,6 @@ ${assistantText}` : assistantText;
4174
3801
  }
4175
3802
  return new Set([...names].filter((n) => base.has(n)));
4176
3803
  }
4177
- allowedToolNamesForTaskType(mode, taskType, revealedTools) {
4178
- if (taskType === "research") return /* @__PURE__ */ new Set([...PLAN_ALLOWED_TOOLS]);
4179
- if (taskType === "verify") return /* @__PURE__ */ new Set(["read_file", "list_dir", "analyze_code", "search_text", "bash"]);
4180
- const base = this.allowedToolNamesForMode(mode);
4181
- for (const name of revealedTools ?? []) {
4182
- if (this.tools.get(name)) base.add(name);
4183
- }
4184
- return base;
4185
- }
4186
3804
  toolDefinitionsForNames(names, schemaMode = "full") {
4187
3805
  return this.tools.list().filter((tool) => names.has(tool.name)).map((tool) => ({
4188
3806
  type: "function",
@@ -4196,16 +3814,6 @@ ${assistantText}` : assistantText;
4196
3814
  }
4197
3815
  }));
4198
3816
  }
4199
- createChildSession(parent, taskId) {
4200
- const child = this.sessions.create({ provider: parent.provider, model: parent.model });
4201
- child.worktree = parent.worktree;
4202
- child.metadata = { parentSessionId: parent.id, taskId };
4203
- this.sessions.save(child);
4204
- return child;
4205
- }
4206
- systemPromptForMode(mode) {
4207
- return mode === "plan" ? PLAN_SYSTEM_PROMPT : BUILD_SYSTEM_PROMPT;
4208
- }
4209
3817
  messagesForSystemPrompt(session, systemPrompt, toolsEnabled, extraMessages = [], fallbackToolPrompt, deferredToolsHint) {
4210
3818
  return [
4211
3819
  {
@@ -4236,15 +3844,6 @@ ${assistantText}` : assistantText;
4236
3844
  ...extraMessages
4237
3845
  ];
4238
3846
  }
4239
- createInternalPromptMessage(content) {
4240
- return {
4241
- id: createId("msg"),
4242
- role: "user",
4243
- source: "agent_internal",
4244
- content,
4245
- createdAt: nowIso()
4246
- };
4247
- }
4248
3847
  isSessionMessageSafeForModel(message) {
4249
3848
  if (!isModelContextMessage(message)) {
4250
3849
  return false;
@@ -4518,45 +4117,6 @@ Modelos dispon\xEDveis: ${modelList}`,
4518
4117
  }
4519
4118
  }
4520
4119
  };
4521
- function formatPlanningFailureWarning(error) {
4522
- if (error instanceof ProviderError) {
4523
- const provider = formatProviderName(error.provider);
4524
- const status = typeof error.statusCode === "number" ? ` (${error.statusCode})` : "";
4525
- if (error.statusCode === 429) {
4526
- return `Task planning skipped: ${provider} rate limit hit${status}. Continuing without structured plan.`;
4527
- }
4528
- if (error.statusCode && error.statusCode >= 500) {
4529
- return `Task planning skipped: ${provider} returned a temporary service error${status}. Continuing without structured plan.`;
4530
- }
4531
- return `Task planning failed: ${compactPlanningError(error.message)}. Continuing without structured plan.`;
4532
- }
4533
- const detail = error instanceof Error ? error.message : String(error);
4534
- return `Task planning failed: ${compactPlanningError(detail)}. Continuing without structured plan.`;
4535
- }
4536
- function compactPlanningError(message) {
4537
- const firstLine2 = message.replace(/\s+/g, " ").trim();
4538
- return firstLine2.length > 240 ? `${firstLine2.slice(0, 237)}...` : firstLine2;
4539
- }
4540
- function formatProviderName(provider) {
4541
- switch (provider) {
4542
- case "openrouter":
4543
- return "OpenRouter";
4544
- case "openai":
4545
- return "OpenAI";
4546
- case "anthropic":
4547
- return "Anthropic";
4548
- case "deepseek":
4549
- return "DeepSeek";
4550
- case "groq":
4551
- return "Groq";
4552
- case "ollama":
4553
- return "Ollama";
4554
- case "opencode":
4555
- return "OpenCode";
4556
- default:
4557
- return provider;
4558
- }
4559
- }
4560
4120
  function truncateForMetadata(value, maxLength = 2e3) {
4561
4121
  return value.length > maxLength ? `${value.slice(0, maxLength)}...` : value;
4562
4122
  }
@@ -4680,7 +4240,7 @@ function adaptMcpTool(client, tool, serverName) {
4680
4240
  return defineTool({
4681
4241
  name: qualifiedName,
4682
4242
  description: tool.description ?? tool.name,
4683
- parameters: z22.record(z22.unknown()).default({}),
4243
+ parameters: z2.record(z2.unknown()).default({}),
4684
4244
  deferred: true,
4685
4245
  execute: (args) => Effect3.tryPromise({
4686
4246
  try: () => client.callTool(tool.name, args),
@@ -5172,10 +4732,10 @@ var EventBus = class {
5172
4732
  }
5173
4733
  }
5174
4734
  };
5175
- var GitHubAuthenticatedUserSchema = z3.object({
5176
- login: z3.string(),
5177
- id: z3.number(),
5178
- html_url: z3.string().url()
4735
+ var GitHubAuthenticatedUserSchema = z22.object({
4736
+ login: z22.string(),
4737
+ id: z22.number(),
4738
+ html_url: z22.string().url()
5179
4739
  }).passthrough();
5180
4740
  var GitHubClient = class {
5181
4741
  constructor(options) {
@@ -5443,22 +5003,22 @@ function runStreamingCommand(command, args, options) {
5443
5003
  });
5444
5004
  });
5445
5005
  }
5446
- var DeviceCodeResponseSchema = z4.object({
5447
- device_code: z4.string().min(1),
5448
- user_code: z4.string().min(1),
5449
- verification_uri: z4.string().url(),
5450
- expires_in: z4.number().int().positive(),
5451
- interval: z4.number().int().positive().default(5)
5006
+ var DeviceCodeResponseSchema = z3.object({
5007
+ device_code: z3.string().min(1),
5008
+ user_code: z3.string().min(1),
5009
+ verification_uri: z3.string().url(),
5010
+ expires_in: z3.number().int().positive(),
5011
+ interval: z3.number().int().positive().default(5)
5452
5012
  }).passthrough();
5453
- var AccessTokenResponseSchema = z4.object({
5454
- access_token: z4.string().min(1),
5455
- token_type: z4.string().min(1),
5456
- scope: z4.string().default("")
5013
+ var AccessTokenResponseSchema = z3.object({
5014
+ access_token: z3.string().min(1),
5015
+ token_type: z3.string().min(1),
5016
+ scope: z3.string().default("")
5457
5017
  }).passthrough();
5458
- var OAuthErrorResponseSchema = z4.object({
5459
- error: z4.string().min(1),
5460
- error_description: z4.string().optional(),
5461
- interval: z4.number().int().positive().optional()
5018
+ var OAuthErrorResponseSchema = z3.object({
5019
+ error: z3.string().min(1),
5020
+ error_description: z3.string().optional(),
5021
+ interval: z3.number().int().positive().optional()
5462
5022
  }).passthrough();
5463
5023
  var GitHubOAuthDeviceFlow = class {
5464
5024
  constructor(options = {}) {
@@ -7391,8 +6951,8 @@ async function quarantineFileIfPossible(filePath) {
7391
6951
  var analyzeCodeTool = defineTool({
7392
6952
  name: "analyze_code",
7393
6953
  description: "Analyze source code structure using lightweight language-aware heuristics.",
7394
- parameters: z5.object({
7395
- path: z5.string()
6954
+ parameters: z4.object({
6955
+ path: z4.string()
7396
6956
  }),
7397
6957
  execute: (args, context) => Effect4.tryPromise({
7398
6958
  try: async () => {
@@ -7414,8 +6974,8 @@ var analyzeCodeTool = defineTool({
7414
6974
  var lintTool = defineTool({
7415
6975
  name: "lint",
7416
6976
  description: "Run project lint script. Uses package manager scripts when present.",
7417
- parameters: z5.object({
7418
- fix: z5.boolean().default(false)
6977
+ parameters: z4.object({
6978
+ fix: z4.boolean().default(false)
7419
6979
  }),
7420
6980
  execute: (args, context) => Effect4.tryPromise({
7421
6981
  try: async () => {
@@ -7435,8 +6995,8 @@ var lintTool = defineTool({
7435
6995
  var testTool = defineTool({
7436
6996
  name: "test",
7437
6997
  description: "Run project tests with pnpm.",
7438
- parameters: z5.object({
7439
- pattern: z5.string().optional()
6998
+ parameters: z4.object({
6999
+ pattern: z4.string().optional()
7440
7000
  }),
7441
7001
  execute: (args, context) => Effect4.tryPromise({
7442
7002
  try: async () => {
@@ -7456,10 +7016,10 @@ var testTool = defineTool({
7456
7016
  var readFileTool = defineTool({
7457
7017
  name: "read_file",
7458
7018
  description: "Read a project file and return line-numbered content. Supports offset and limit.",
7459
- parameters: z6.object({
7460
- path: z6.string(),
7461
- offset: z6.number().int().min(0).optional(),
7462
- limit: z6.number().int().positive().max(2e3).optional()
7019
+ parameters: z5.object({
7020
+ path: z5.string(),
7021
+ offset: z5.number().int().min(0).optional(),
7022
+ limit: z5.number().int().positive().max(2e3).optional()
7463
7023
  }),
7464
7024
  execute: (args, context) => Effect5.tryPromise({
7465
7025
  try: async () => {
@@ -7495,9 +7055,9 @@ var readFileTool = defineTool({
7495
7055
  var writeFileTool = defineTool({
7496
7056
  name: "write_file",
7497
7057
  description: "Create or overwrite a file. Parent directories are created when needed.",
7498
- parameters: z6.object({
7499
- path: z6.string(),
7500
- content: z6.string()
7058
+ parameters: z5.object({
7059
+ path: z5.string(),
7060
+ content: z5.string()
7501
7061
  }),
7502
7062
  execute: (args, context) => Effect5.tryPromise({
7503
7063
  try: async () => {
@@ -7519,10 +7079,10 @@ var writeFileTool = defineTool({
7519
7079
  var editFileTool = defineTool({
7520
7080
  name: "edit_file",
7521
7081
  description: "Replace exactly one occurrence of oldString in a file.",
7522
- parameters: z6.object({
7523
- path: z6.string(),
7524
- oldString: z6.string().min(1),
7525
- newString: z6.string()
7082
+ parameters: z5.object({
7083
+ path: z5.string(),
7084
+ oldString: z5.string().min(1),
7085
+ newString: z5.string()
7526
7086
  }),
7527
7087
  execute: (args, context) => Effect5.tryPromise({
7528
7088
  try: async () => {
@@ -7552,8 +7112,8 @@ var editFileTool = defineTool({
7552
7112
  var listDirTool = defineTool({
7553
7113
  name: "list_dir",
7554
7114
  description: "List directory entries with type, size, and relative path.",
7555
- parameters: z6.object({
7556
- path: z6.string().default(".")
7115
+ parameters: z5.object({
7116
+ path: z5.string().default(".")
7557
7117
  }),
7558
7118
  execute: (args, context) => Effect5.tryPromise({
7559
7119
  try: async () => {
@@ -7586,7 +7146,7 @@ var listDirTool = defineTool({
7586
7146
  }
7587
7147
  })
7588
7148
  });
7589
- var GitOperationSchema = z7.enum([
7149
+ var GitOperationSchema = z6.enum([
7590
7150
  "status",
7591
7151
  "diff",
7592
7152
  "add",
@@ -7600,9 +7160,9 @@ var GitOperationSchema = z7.enum([
7600
7160
  var gitTool = defineTool({
7601
7161
  name: "git",
7602
7162
  description: "Run supported git operations with permission checks.",
7603
- parameters: z7.object({
7163
+ parameters: z6.object({
7604
7164
  operation: GitOperationSchema,
7605
- args: z7.record(z7.unknown()).default({})
7165
+ args: z6.record(z6.unknown()).default({})
7606
7166
  }),
7607
7167
  execute: (args, context) => Effect6.tryPromise({
7608
7168
  try: async () => {
@@ -7674,12 +7234,12 @@ function readJsonLines(input) {
7674
7234
  var searchTextTool = defineTool({
7675
7235
  name: "search_text",
7676
7236
  description: "Search text or regex patterns using ripgrep. Returns JSON match rows.",
7677
- parameters: z8.object({
7678
- pattern: z8.string().min(1),
7679
- path: z8.string().default("."),
7680
- include: z8.string().optional(),
7681
- context: z8.number().int().min(0).max(10).default(2),
7682
- caseSensitive: z8.boolean().default(true)
7237
+ parameters: z7.object({
7238
+ pattern: z7.string().min(1),
7239
+ path: z7.string().default("."),
7240
+ include: z7.string().optional(),
7241
+ context: z7.number().int().min(0).max(10).default(2),
7242
+ caseSensitive: z7.boolean().default(true)
7683
7243
  }),
7684
7244
  execute: (args, context) => Effect7.tryPromise({
7685
7245
  try: async () => {
@@ -7732,9 +7292,9 @@ var searchTextTool = defineTool({
7732
7292
  var searchFilesTool = defineTool({
7733
7293
  name: "search_files",
7734
7294
  description: "Find files by name using ripgrep file listing.",
7735
- parameters: z8.object({
7736
- query: z8.string().min(1),
7737
- path: z8.string().default(".")
7295
+ parameters: z7.object({
7296
+ query: z7.string().min(1),
7297
+ path: z7.string().default(".")
7738
7298
  }),
7739
7299
  execute: (args, context) => Effect7.tryPromise({
7740
7300
  try: async () => {
@@ -7825,9 +7385,9 @@ async function heuristicSymbolSearch(query, searchPath, worktree, signal) {
7825
7385
  var searchSymbolsTool = defineTool({
7826
7386
  name: "search_symbols",
7827
7387
  description: "Search workspace symbols. Uses LSP when configured; falls back to heuristic ripgrep-based extraction.",
7828
- parameters: z8.object({
7829
- query: z8.string().min(1),
7830
- path: z8.string().default(".")
7388
+ parameters: z7.object({
7389
+ query: z7.string().min(1),
7390
+ path: z7.string().default(".")
7831
7391
  }),
7832
7392
  execute: (args, context) => Effect7.tryPromise({
7833
7393
  try: async () => {
@@ -7918,10 +7478,10 @@ function classifyShellCommand(command) {
7918
7478
  var bashTool = defineTool({
7919
7479
  name: "bash",
7920
7480
  description: "Execute a shell command in the project directory with timeout and permission checks.",
7921
- parameters: z9.object({
7922
- command: z9.string().min(1),
7923
- cwd: z9.string().default("."),
7924
- timeout: z9.number().int().positive().max(600).default(60)
7481
+ parameters: z8.object({
7482
+ command: z8.string().min(1),
7483
+ cwd: z8.string().default("."),
7484
+ timeout: z8.number().int().positive().max(600).default(60)
7925
7485
  }),
7926
7486
  execute: (args, context) => Effect8.tryPromise({
7927
7487
  try: async () => {
@@ -7978,9 +7538,9 @@ var fetchWebTool = defineTool({
7978
7538
  Returns the content as text. Supports HTTP and HTTPS URLs.
7979
7539
  Use this to look up documentation, library APIs, or other web resources relevant to the task.
7980
7540
  Note: This tool requires explicit approval and may be restricted by web.allowlist/web.blacklist configuration.`,
7981
- parameters: z10.object({
7982
- url: z10.string().url().describe("URL to fetch (must start with http:// or https://)"),
7983
- maxLength: z10.number().int().positive().max(5e4).optional().describe("Maximum content length to return (default: 10000)")
7541
+ parameters: z9.object({
7542
+ url: z9.string().url().describe("URL to fetch (must start with http:// or https://)"),
7543
+ maxLength: z9.number().int().positive().max(5e4).optional().describe("Maximum content length to return (default: 10000)")
7984
7544
  }),
7985
7545
  execute: (args, context) => Effect9.tryPromise({
7986
7546
  try: async () => {
@@ -8087,20 +7647,20 @@ function createDefaultToolRegistry() {
8087
7647
  registry.register(fetchWebTool);
8088
7648
  return registry;
8089
7649
  }
8090
- var TaskSchema2 = z11.object({
8091
- prompt: z11.string().describe("Full task description for the subagent \u2014 be specific and self-contained."),
8092
- subagent_type: z11.string().optional().describe(
7650
+ var TaskSchema = z10.object({
7651
+ prompt: z10.string().describe("Full task description for the subagent \u2014 be specific and self-contained."),
7652
+ subagent_type: z10.string().optional().describe(
8093
7653
  "Named agent type from .deepcode/agents/*.md (e.g. 'code-reviewer'). When set, the subagent uses the named agent's system prompt and tool restrictions."
8094
7654
  ),
8095
- provider: z11.string().optional().describe("Provider override (e.g. 'anthropic', 'openai'). Defaults to current provider."),
8096
- model: z11.string().optional().describe("Model override. Defaults to current model."),
8097
- fork: z11.boolean().optional().describe("If true, the subagent starts with the current conversation history as context.")
7655
+ provider: z10.string().optional().describe("Provider override (e.g. 'anthropic', 'openai'). Defaults to current provider."),
7656
+ model: z10.string().optional().describe("Model override. Defaults to current model."),
7657
+ fork: z10.boolean().optional().describe("If true, the subagent starts with the current conversation history as context.")
8098
7658
  });
8099
7659
  function createTaskTool(subagents, worktree, sessions) {
8100
7660
  return defineTool({
8101
7661
  name: "task",
8102
7662
  description: "Launch a subagent to handle a self-contained task in a child session. Use for parallelizable work, delegating a well-scoped subtask, or specialized analysis. Built-in subagent_type values: code-reviewer (read-only code analysis), test-runner (run tests and interpret output), refactor (surgical code changes without behavior change). Set fork=true to give the subagent the current conversation history as starting context. Custom agents can be defined in .deepcode/agents/<name>.md.",
8103
- parameters: TaskSchema2,
7663
+ parameters: TaskSchema,
8104
7664
  execute: (args, context) => Effect10.tryPromise(async () => {
8105
7665
  const taskId = createId("task");
8106
7666
  let systemPrompt;
@@ -8144,8 +7704,8 @@ function createToolSearchTool(registry) {
8144
7704
  return defineTool({
8145
7705
  name: "tool_search",
8146
7706
  description: "Search and activate deferred tools (MCP integrations) by name or description keyword. Call this before using a tool that is not in the current schema. Matched tools are revealed and available in subsequent calls this session.",
8147
- parameters: z12.object({
8148
- query: z12.string().min(1).describe("Keyword to search in tool names and descriptions")
7707
+ parameters: z11.object({
7708
+ query: z11.string().min(1).describe("Keyword to search in tool names and descriptions")
8149
7709
  }),
8150
7710
  execute: (args, context) => Effect11.tryPromise({
8151
7711
  try: async () => {
@@ -8301,10 +7861,10 @@ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
8301
7861
  import fs2 from "fs";
8302
7862
  import os4 from "os";
8303
7863
  import path62 from "path";
8304
- import fs8 from "fs";
8305
- import path15 from "path";
7864
+ import fs9 from "fs";
7865
+ import path16 from "path";
8306
7866
  import { isValidElement, useCallback as useCallback27, useEffect as useEffect28, useMemo as useMemo19, useRef as useRef18, useState as useState30 } from "react";
8307
- import { Box as Box42, Text as Text50, useInput as useInput6, useStdin as useStdin3 } from "ink";
7867
+ import { Box as Box47, Text as Text55, useInput as useInput6, useStdin as useStdin3 } from "ink";
8308
7868
  import os22 from "os";
8309
7869
  import path92 from "path";
8310
7870
  import fs22 from "fs";
@@ -9277,8 +8837,8 @@ import * as path82 from "path";
9277
8837
  import { promisify } from "util";
9278
8838
  import { useState as useState3, useRef, useCallback as useCallback3, useMemo as useMemo2 } from "react";
9279
8839
  import { useCallback as useCallback8, useEffect as useEffect14, useMemo as useMemo6, useRef as useRef6, useState as useState12 } from "react";
9280
- import { Box as Box24, Static } from "ink";
9281
- import { Box as Box22, Text as Text25 } from "ink";
8840
+ import { Box as Box26, Static } from "ink";
8841
+ import { Box as Box25, Text as Text28 } from "ink";
9282
8842
  import { Box as Box8, Text as Text9 } from "ink";
9283
8843
 
9284
8844
  // ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
@@ -10221,25 +9781,31 @@ import { Box as Box20, Text as Text23 } from "ink";
10221
9781
  import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
10222
9782
  import React21, { useContext as useContext5 } from "react";
10223
9783
  import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
9784
+ import { Box as Box22, Text as Text25 } from "ink";
10224
9785
  import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
10225
9786
  import { Box as Box23, Text as Text26 } from "ink";
10226
- import { jsxs as jsxs22 } from "react/jsx-runtime";
9787
+ import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
9788
+ import { Box as Box24, Text as Text27 } from "ink";
9789
+ import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
9790
+ import { jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
10227
9791
  import { createContext as createContext5, useContext as useContext6 } from "react";
10228
- import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
10229
- import { Box as Box32, Text as Text40, useIsScreenReaderEnabled as useIsScreenReaderEnabled3 } from "ink";
9792
+ import { jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
9793
+ import { Box as Box27, Text as Text29 } from "ink";
9794
+ import { jsx as jsx32 } from "react/jsx-runtime";
9795
+ import { Box as Box35, Text as Text43, useIsScreenReaderEnabled as useIsScreenReaderEnabled3 } from "ink";
10230
9796
  import { useCallback as useCallback19, useState as useState24 } from "react";
10231
9797
  import { useRef as useRef8 } from "react";
10232
- import { Box as Box25, Text as Text27 } from "ink";
9798
+ import { Box as Box28, Text as Text30 } from "ink";
10233
9799
  import { useEffect as useEffect15, useState as useState13 } from "react";
10234
9800
  import { useEffect as useEffect16, useRef as useRef7, useState as useState14 } from "react";
10235
- import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
9801
+ import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
10236
9802
  import { useCallback as useCallback17, useEffect as useEffect23, useMemo as useMemo11, useState as useState21, useRef as useRef13 } from "react";
10237
- import { Box as Box28, Text as Text31 } from "ink";
10238
- import { Box as Box26, Text as Text29 } from "ink";
9803
+ import { Box as Box31, Text as Text34 } from "ink";
9804
+ import { Box as Box29, Text as Text32 } from "ink";
10239
9805
  import React25 from "react";
10240
- import { Text as Text28 } from "ink";
10241
- import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
10242
- import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
9806
+ import { Text as Text31 } from "ink";
9807
+ import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
9808
+ import { jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
10243
9809
  import { useState as useState15, useCallback as useCallback9 } from "react";
10244
9810
  import chalk3 from "chalk";
10245
9811
  import { useState as useState16, useEffect as useEffect17, useCallback as useCallback10 } from "react";
@@ -10256,21 +9822,21 @@ import * as path132 from "path";
10256
9822
  import { createContext as createContext6, useContext as useContext7 } from "react";
10257
9823
  import { createContext as createContext7, useContext as useContext8 } from "react";
10258
9824
  import { useCallback as useCallback16 } from "react";
10259
- import { Box as Box27, Text as Text30 } from "ink";
9825
+ import { Box as Box30, Text as Text33 } from "ink";
10260
9826
  import chalk2 from "chalk";
10261
- import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
10262
- import { Fragment as Fragment7, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
10263
- import { Box as Box29, Text as Text37 } from "ink";
10264
- import { Text as Text32 } from "ink";
10265
- import { Fragment as Fragment8, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
10266
- import { Text as Text33 } from "ink";
10267
- import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
10268
- import { Text as Text34 } from "ink";
10269
- import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
9827
+ import { jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
9828
+ import { Fragment as Fragment8, jsx as jsx37, jsxs as jsxs30 } from "react/jsx-runtime";
9829
+ import { Box as Box32, Text as Text40 } from "ink";
10270
9830
  import { Text as Text35 } from "ink";
10271
- import { jsxs as jsxs32 } from "react/jsx-runtime";
9831
+ import { Fragment as Fragment9, jsx as jsx38, jsxs as jsxs31 } from "react/jsx-runtime";
10272
9832
  import { Text as Text36 } from "ink";
10273
- import { jsxs as jsxs33 } from "react/jsx-runtime";
9833
+ import { jsx as jsx39, jsxs as jsxs32 } from "react/jsx-runtime";
9834
+ import { Text as Text37 } from "ink";
9835
+ import { jsx as jsx40, jsxs as jsxs33 } from "react/jsx-runtime";
9836
+ import { Text as Text38 } from "ink";
9837
+ import { jsxs as jsxs34 } from "react/jsx-runtime";
9838
+ import { Text as Text39 } from "ink";
9839
+ import { jsxs as jsxs35 } from "react/jsx-runtime";
10274
9840
  import { useState as useState222, useEffect as useEffect24 } from "react";
10275
9841
  import { execFile as execFile22 } from "child_process";
10276
9842
  import os5 from "os";
@@ -10280,43 +9846,53 @@ import {
10280
9846
  useContext as useContext9,
10281
9847
  useState as useState23
10282
9848
  } from "react";
10283
- import { jsx as jsx37 } from "react/jsx-runtime";
10284
- import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
9849
+ import { jsx as jsx41 } from "react/jsx-runtime";
9850
+ import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
10285
9851
  import { useRef as useRef14 } from "react";
10286
- import { Box as Box30, Text as Text38 } from "ink";
10287
- import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
10288
- import { Box as Box31, Text as Text39 } from "ink";
10289
- import { jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
10290
- import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
10291
9852
  import { Box as Box33, Text as Text41 } from "ink";
10292
- import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
10293
- import { useCallback as useCallback20, useMemo as useMemo12, useRef as useRef15 } from "react";
9853
+ import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
10294
9854
  import { Box as Box34, Text as Text42 } from "ink";
10295
- import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
9855
+ import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
9856
+ import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
9857
+ import { createContext as createContext9, useContext as useContext10 } from "react";
9858
+ import { Box as Box36, Text as Text44 } from "ink";
9859
+ import { useContext as useContext11 } from "react";
9860
+ import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
9861
+ import { Box as Box37, Text as Text45 } from "ink";
9862
+ import os6 from "os";
9863
+ import { Fragment as Fragment10, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
9864
+ import os7 from "os";
9865
+ import path142 from "path";
9866
+ import fs7 from "fs/promises";
9867
+ import { Box as Box38, Text as Text46 } from "ink";
9868
+ import { jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
9869
+ import { useCallback as useCallback20, useMemo as useMemo12, useRef as useRef15 } from "react";
9870
+ import { Box as Box39, Text as Text47 } from "ink";
9871
+ import { jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
10296
9872
  import { useCallback as useCallback21, useMemo as useMemo13, useState as useState25 } from "react";
10297
- import { Box as Box35, Text as Text43, useInput as useInput3 } from "ink";
10298
- import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
9873
+ import { Box as Box40, Text as Text48, useInput as useInput3 } from "ink";
9874
+ import { Fragment as Fragment11, jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
10299
9875
  import { useCallback as useCallback22, useMemo as useMemo14, useState as useState26 } from "react";
10300
- import { Box as Box36, Text as Text44 } from "ink";
10301
- import { jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
9876
+ import { Box as Box41, Text as Text49 } from "ink";
9877
+ import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
10302
9878
  import { useCallback as useCallback23, useEffect as useEffect25, useMemo as useMemo15, useRef as useRef16, useState as useState27 } from "react";
10303
- import { Box as Box37, Text as Text45 } from "ink";
10304
- import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
9879
+ import { Box as Box42, Text as Text50 } from "ink";
9880
+ import { jsx as jsx52, jsxs as jsxs46 } from "react/jsx-runtime";
10305
9881
  import { useCallback as useCallback24, useEffect as useEffect26, useMemo as useMemo16, useRef as useRef17, useState as useState28 } from "react";
10306
- import { Box as Box38, Text as Text46, useInput as useInput4 } from "ink";
10307
- import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
10308
- import fs7 from "fs";
10309
- import path142 from "path";
9882
+ import { Box as Box43, Text as Text51, useInput as useInput4 } from "ink";
9883
+ import { jsx as jsx53, jsxs as jsxs47 } from "react/jsx-runtime";
9884
+ import fs8 from "fs";
9885
+ import path15 from "path";
10310
9886
  import { useCallback as useCallback25, useMemo as useMemo17 } from "react";
10311
- import { Box as Box39, Text as Text47 } from "ink";
10312
- import { jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
9887
+ import { Box as Box44, Text as Text52 } from "ink";
9888
+ import { jsx as jsx54, jsxs as jsxs48 } from "react/jsx-runtime";
10313
9889
  import { useCallback as useCallback26, useEffect as useEffect27, useMemo as useMemo18, useState as useState29 } from "react";
10314
- import { Box as Box40, Text as Text48, useInput as useInput5 } from "ink";
10315
- import { jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
10316
- import { Box as Box41, Text as Text49 } from "ink";
10317
- import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
10318
- import { jsx as jsx51, jsxs as jsxs47 } from "react/jsx-runtime";
10319
- import { jsx as jsx52 } from "react/jsx-runtime";
9890
+ import { Box as Box45, Text as Text53, useInput as useInput5 } from "ink";
9891
+ import { jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
9892
+ import { Box as Box46, Text as Text54 } from "ink";
9893
+ import { jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
9894
+ import { jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
9895
+ import { jsx as jsx58 } from "react/jsx-runtime";
10320
9896
  async function createRuntime(options) {
10321
9897
  const worktree = path10.resolve(options.cwd);
10322
9898
  const config = await new ConfigLoader().load({ cwd: worktree, configPath: options.configPath });
@@ -11909,7 +11485,7 @@ function parseVersion(version) {
11909
11485
  if (!match) return null;
11910
11486
  return [Number(match[1]), Number(match[2]), Number(match[3])];
11911
11487
  }
11912
- var VERSION = "1.2.11".length > 0 ? "1.2.11" : "0.0.0-dev";
11488
+ var VERSION = "1.2.13".length > 0 ? "1.2.13" : "0.0.0-dev";
11913
11489
  async function updateCommand() {
11914
11490
  writeStdoutLine(`Current version: ${VERSION}`);
11915
11491
  const update = await checkForUpdate(VERSION, { force: true });
@@ -15965,6 +15541,7 @@ var OverflowStateContext = createContext(
15965
15541
  var OverflowActionsContext = createContext(
15966
15542
  void 0
15967
15543
  );
15544
+ var useOverflowState = () => useContext(OverflowStateContext);
15968
15545
  var useOverflowActions = () => useContext(OverflowActionsContext);
15969
15546
  var enableDebugLog = false;
15970
15547
  var debugLogger4 = createDebugLogger("MAX_SIZED_BOX");
@@ -23641,7 +23218,7 @@ var ToolStatusIndicator = ({
23641
23218
  name
23642
23219
  }) => {
23643
23220
  const isShell = name === SHELL_COMMAND_NAME || name === SHELL_NAME;
23644
- const statusColor3 = isShell ? theme.ui.symbol : theme.status.warning;
23221
+ const statusColor2 = isShell ? theme.ui.symbol : theme.status.warning;
23645
23222
  return /* @__PURE__ */ jsxs17(Box17, { minWidth: STATUS_INDICATOR_WIDTH, children: [
23646
23223
  status === "Pending" && /* @__PURE__ */ jsx22(Text20, { color: theme.status.success, children: TOOL_STATUS.PENDING }),
23647
23224
  status === "Executing" && /* @__PURE__ */ jsx22(
@@ -23652,8 +23229,8 @@ var ToolStatusIndicator = ({
23652
23229
  }
23653
23230
  ),
23654
23231
  status === "Success" && /* @__PURE__ */ jsx22(Text20, { color: theme.status.success, "aria-label": "Success:", children: TOOL_STATUS.SUCCESS }),
23655
- status === "Confirming" && /* @__PURE__ */ jsx22(Text20, { color: statusColor3, "aria-label": "Confirming:", children: TOOL_STATUS.CONFIRMING }),
23656
- status === "Canceled" && /* @__PURE__ */ jsx22(Text20, { color: statusColor3, "aria-label": "Canceled:", bold: true, children: TOOL_STATUS.CANCELED }),
23232
+ status === "Confirming" && /* @__PURE__ */ jsx22(Text20, { color: statusColor2, "aria-label": "Confirming:", children: TOOL_STATUS.CONFIRMING }),
23233
+ status === "Canceled" && /* @__PURE__ */ jsx22(Text20, { color: statusColor2, "aria-label": "Canceled:", bold: true, children: TOOL_STATUS.CANCELED }),
23657
23234
  status === "Error" && /* @__PURE__ */ jsx22(Text20, { color: theme.status.error, "aria-label": "Error:", bold: true, children: TOOL_STATUS.ERROR })
23658
23235
  ] });
23659
23236
  };
@@ -24466,27 +24043,279 @@ var ToolGroupMessage = ({
24466
24043
  }
24467
24044
  );
24468
24045
  };
24469
- var HistoryItemDisplay = ({
24470
- item,
24471
- availableTerminalHeight,
24472
- terminalWidth,
24473
- mainAreaWidth,
24474
- isPending,
24475
- isFocused = true,
24476
- activeShellPtyId,
24477
- embeddedShellFocused,
24478
- compactLabel,
24479
- summaryAbsorbed = false
24046
+ function getCompressionText(compression) {
24047
+ const { isPending, originalTokenCount, newTokenCount, compressionStatus } = compression;
24048
+ if (isPending) return "Comprimindo hist\xF3rico...";
24049
+ const orig = originalTokenCount ?? 0;
24050
+ const next = newTokenCount ?? 0;
24051
+ switch (compressionStatus) {
24052
+ case 1:
24053
+ return `Hist\xF3rico comprimido: ${orig} \u2192 ${next} tokens.`;
24054
+ case 2:
24055
+ return orig < 5e4 ? "Compress\xE3o sem benef\xEDcio para esse tamanho de hist\xF3rico." : "Compress\xE3o n\xE3o reduziu o tamanho. Verifique o prompt de compress\xE3o.";
24056
+ case 3:
24057
+ return "N\xE3o foi poss\xEDvel comprimir: erro na contagem de tokens.";
24058
+ case 5:
24059
+ return "Nada para comprimir.";
24060
+ default:
24061
+ return "";
24062
+ }
24063
+ }
24064
+ function CompressionMessage({
24065
+ compression
24066
+ }) {
24067
+ const text = getCompressionText(compression);
24068
+ return /* @__PURE__ */ jsxs21(Box22, { flexDirection: "row", children: [
24069
+ /* @__PURE__ */ jsx27(Box22, { marginRight: 1, children: compression.isPending ? /* @__PURE__ */ jsx27(build_default, { type: "dots" }) : /* @__PURE__ */ jsx27(Text25, { color: theme.text.accent, children: "\u2726" }) }),
24070
+ /* @__PURE__ */ jsx27(Text25, { color: compression.isPending ? theme.text.accent : theme.status.success, children: text })
24071
+ ] });
24072
+ }
24073
+ function getSummaryText(summary) {
24074
+ if (summary.isPending) {
24075
+ switch (summary.stage) {
24076
+ case "generating":
24077
+ return "Gerando resumo do projeto...";
24078
+ case "saving":
24079
+ return "Salvando resumo...";
24080
+ default:
24081
+ return "Processando resumo...";
24082
+ }
24083
+ }
24084
+ const base = "Resumo gerado e salvo com sucesso!";
24085
+ return summary.filePath ? `${base} Salvo em: ${summary.filePath}` : base;
24086
+ }
24087
+ var SummaryMessage = ({ summary }) => /* @__PURE__ */ jsxs22(Box23, { flexDirection: "row", children: [
24088
+ /* @__PURE__ */ jsx28(Box23, { marginRight: 1, children: summary.isPending ? /* @__PURE__ */ jsx28(build_default, { type: "dots" }) : /* @__PURE__ */ jsx28(Text26, { color: theme.status.success, children: "\u2713" }) }),
24089
+ /* @__PURE__ */ jsx28(Text26, { color: summary.isPending ? theme.text.accent : theme.status.success, children: getSummaryText(summary) })
24090
+ ] });
24091
+ var FILLED = "\u2588";
24092
+ var BUFFER = "\u2592";
24093
+ var EMPTY = "\u2591";
24094
+ var CONTENT_WIDTH = 56;
24095
+ function fmtTokens(n) {
24096
+ if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
24097
+ if (n >= 1e3) return `${(n / 1e3).toFixed(1)}k`;
24098
+ return String(n);
24099
+ }
24100
+ function fmtPct(tokens, total) {
24101
+ if (total <= 0) return "0.0";
24102
+ const p = tokens / total * 100;
24103
+ return p > 100 ? ">100" : p.toFixed(1);
24104
+ }
24105
+ function truncate(s, max) {
24106
+ return s.length <= max ? s : `${s.slice(0, max - 1)}\u2026`;
24107
+ }
24108
+ var ProgressBar = ({ usedPct, bufferPct, width }) => {
24109
+ const used = Math.round(Math.min(usedPct, 100) / 100 * width);
24110
+ const buffer = Math.round(Math.min(bufferPct, 100 - usedPct) / 100 * width);
24111
+ const free = Math.max(0, width - used - buffer);
24112
+ const usedColor = usedPct > 80 ? theme.status.error : usedPct > 60 ? theme.status.warning : theme.text.accent;
24113
+ return /* @__PURE__ */ jsxs23(Text27, { children: [
24114
+ /* @__PURE__ */ jsx29(Text27, { color: usedColor, children: FILLED.repeat(Math.max(0, used)) }),
24115
+ /* @__PURE__ */ jsx29(Text27, { color: theme.text.secondary, children: EMPTY.repeat(Math.max(0, free)) }),
24116
+ /* @__PURE__ */ jsx29(Text27, { color: theme.status.warning, children: BUFFER.repeat(Math.max(0, buffer)) })
24117
+ ] });
24118
+ };
24119
+ var CategoryRow = ({ symbol, label, tokens, total, symbolColor, overLimit }) => /* @__PURE__ */ jsxs23(Box24, { width: CONTENT_WIDTH, children: [
24120
+ /* @__PURE__ */ jsx29(Box24, { width: 2, children: /* @__PURE__ */ jsx29(Text27, { color: symbolColor ?? theme.text.secondary, children: symbol }) }),
24121
+ /* @__PURE__ */ jsx29(Box24, { width: 24, children: /* @__PURE__ */ jsx29(Text27, { color: theme.text.primary, children: label }) }),
24122
+ /* @__PURE__ */ jsx29(Box24, { flexGrow: 1, justifyContent: "flex-end", children: /* @__PURE__ */ jsxs23(Text27, { color: overLimit ? theme.status.error : theme.text.secondary, children: [
24123
+ fmtTokens(tokens),
24124
+ " tokens (",
24125
+ fmtPct(tokens, total),
24126
+ "%)"
24127
+ ] }) })
24128
+ ] });
24129
+ var DetailRow = ({
24130
+ name,
24131
+ tokens
24132
+ }) => /* @__PURE__ */ jsxs23(Box24, { width: CONTENT_WIDTH, paddingLeft: 2, children: [
24133
+ /* @__PURE__ */ jsxs23(Text27, { color: theme.text.secondary, children: [
24134
+ "\u2514",
24135
+ " "
24136
+ ] }),
24137
+ /* @__PURE__ */ jsx29(Box24, { width: 32, children: /* @__PURE__ */ jsx29(Text27, { color: theme.text.link, children: truncate(name, 30) }) }),
24138
+ /* @__PURE__ */ jsx29(Box24, { flexGrow: 1, justifyContent: "flex-end", children: /* @__PURE__ */ jsxs23(Text27, { color: theme.text.secondary, children: [
24139
+ fmtTokens(tokens),
24140
+ " tokens"
24141
+ ] }) })
24142
+ ] });
24143
+ var ContextUsage = ({
24144
+ modelName,
24145
+ totalTokens,
24146
+ contextWindowSize,
24147
+ breakdown,
24148
+ builtinTools,
24149
+ mcpTools,
24150
+ memoryFiles,
24151
+ skills,
24152
+ isEstimated,
24153
+ showDetails = false
24154
+ }) => {
24155
+ const pct = contextWindowSize > 0 ? totalTokens / contextWindowSize * 100 : 0;
24156
+ const overLimit = pct > 100;
24157
+ const bufferPct = contextWindowSize > 0 ? breakdown.autocompactBuffer / contextWindowSize * 100 : 0;
24158
+ const sortDesc = (arr) => [...arr].sort((a, b) => b.tokens - a.tokens);
24159
+ return /* @__PURE__ */ jsxs23(
24160
+ Box24,
24161
+ {
24162
+ borderStyle: "round",
24163
+ borderColor: theme.border.default,
24164
+ flexDirection: "column",
24165
+ paddingY: 1,
24166
+ paddingX: 2,
24167
+ children: [
24168
+ /* @__PURE__ */ jsx29(Text27, { bold: true, color: theme.text.accent, children: "Uso do Contexto" }),
24169
+ /* @__PURE__ */ jsx29(Box24, { height: 1 }),
24170
+ isEstimated ? /* @__PURE__ */ jsx29(Box24, { marginBottom: 1, children: /* @__PURE__ */ jsx29(Text27, { color: theme.status.warning, italic: true, children: "Estimativa \u2014 envie uma mensagem para ver o uso real." }) }) : /* @__PURE__ */ jsxs23(Fragment7, { children: [
24171
+ /* @__PURE__ */ jsxs23(Box24, { width: CONTENT_WIDTH, marginBottom: 1, children: [
24172
+ /* @__PURE__ */ jsxs23(Text27, { color: theme.text.secondary, children: [
24173
+ "Modelo: ",
24174
+ modelName
24175
+ ] }),
24176
+ /* @__PURE__ */ jsx29(Box24, { flexGrow: 1, justifyContent: "flex-end", children: /* @__PURE__ */ jsxs23(Text27, { color: theme.text.secondary, children: [
24177
+ "Janela: ",
24178
+ fmtTokens(contextWindowSize),
24179
+ " tokens"
24180
+ ] }) })
24181
+ ] }),
24182
+ /* @__PURE__ */ jsx29(Box24, { width: CONTENT_WIDTH, children: /* @__PURE__ */ jsx29(
24183
+ ProgressBar,
24184
+ {
24185
+ usedPct: Math.min(pct, 100),
24186
+ bufferPct,
24187
+ width: CONTENT_WIDTH
24188
+ }
24189
+ ) }),
24190
+ overLimit && /* @__PURE__ */ jsx29(Box24, { marginBottom: 1, children: /* @__PURE__ */ jsx29(Text27, { color: theme.status.error, children: "Contexto excede o limite! Use /compact ou /clear para reduzir." }) }),
24191
+ /* @__PURE__ */ jsx29(Box24, { height: 1 }),
24192
+ /* @__PURE__ */ jsx29(
24193
+ CategoryRow,
24194
+ {
24195
+ symbol: FILLED,
24196
+ label: "Usado",
24197
+ tokens: totalTokens,
24198
+ total: contextWindowSize,
24199
+ symbolColor: overLimit ? theme.status.error : theme.text.accent,
24200
+ overLimit
24201
+ }
24202
+ ),
24203
+ /* @__PURE__ */ jsx29(
24204
+ CategoryRow,
24205
+ {
24206
+ symbol: EMPTY,
24207
+ label: "Livre",
24208
+ tokens: breakdown.freeSpace,
24209
+ total: contextWindowSize,
24210
+ symbolColor: theme.text.secondary
24211
+ }
24212
+ ),
24213
+ /* @__PURE__ */ jsx29(
24214
+ CategoryRow,
24215
+ {
24216
+ symbol: BUFFER,
24217
+ label: "Buffer de compress\xE3o",
24218
+ tokens: breakdown.autocompactBuffer,
24219
+ total: contextWindowSize,
24220
+ symbolColor: theme.status.warning
24221
+ }
24222
+ ),
24223
+ /* @__PURE__ */ jsx29(Box24, { height: 1 }),
24224
+ /* @__PURE__ */ jsx29(Text27, { bold: true, color: theme.text.primary, children: "Por categoria" })
24225
+ ] }),
24226
+ /* @__PURE__ */ jsx29(
24227
+ CategoryRow,
24228
+ {
24229
+ symbol: FILLED,
24230
+ label: "System prompt",
24231
+ tokens: breakdown.systemPrompt,
24232
+ total: contextWindowSize,
24233
+ symbolColor: theme.text.accent
24234
+ }
24235
+ ),
24236
+ breakdown.builtinTools > 0 && /* @__PURE__ */ jsx29(
24237
+ CategoryRow,
24238
+ {
24239
+ symbol: FILLED,
24240
+ label: "Ferramentas built-in",
24241
+ tokens: breakdown.builtinTools,
24242
+ total: contextWindowSize,
24243
+ symbolColor: theme.text.accent
24244
+ }
24245
+ ),
24246
+ breakdown.mcpTools > 0 && /* @__PURE__ */ jsx29(
24247
+ CategoryRow,
24248
+ {
24249
+ symbol: FILLED,
24250
+ label: "Ferramentas MCP",
24251
+ tokens: breakdown.mcpTools,
24252
+ total: contextWindowSize,
24253
+ symbolColor: theme.text.accent
24254
+ }
24255
+ ),
24256
+ breakdown.memoryFiles > 0 && /* @__PURE__ */ jsx29(
24257
+ CategoryRow,
24258
+ {
24259
+ symbol: FILLED,
24260
+ label: "Arquivos de mem\xF3ria",
24261
+ tokens: breakdown.memoryFiles,
24262
+ total: contextWindowSize,
24263
+ symbolColor: theme.text.accent
24264
+ }
24265
+ ),
24266
+ !isEstimated && /* @__PURE__ */ jsx29(
24267
+ CategoryRow,
24268
+ {
24269
+ symbol: FILLED,
24270
+ label: "Mensagens",
24271
+ tokens: breakdown.messages,
24272
+ total: contextWindowSize,
24273
+ symbolColor: theme.text.accent
24274
+ }
24275
+ ),
24276
+ showDetails ? /* @__PURE__ */ jsxs23(Fragment7, { children: [
24277
+ builtinTools.length > 0 && /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", marginTop: 1, children: [
24278
+ /* @__PURE__ */ jsx29(Text27, { bold: true, color: theme.text.primary, children: "Ferramentas built-in" }),
24279
+ sortDesc(builtinTools).map((t2) => /* @__PURE__ */ jsx29(DetailRow, { name: t2.name, tokens: t2.tokens }, t2.name))
24280
+ ] }),
24281
+ mcpTools.length > 0 && /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", marginTop: 1, children: [
24282
+ /* @__PURE__ */ jsx29(Text27, { bold: true, color: theme.text.primary, children: "Ferramentas MCP" }),
24283
+ sortDesc(mcpTools).map((t2) => /* @__PURE__ */ jsx29(DetailRow, { name: t2.name, tokens: t2.tokens }, t2.name))
24284
+ ] }),
24285
+ memoryFiles.length > 0 && /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", marginTop: 1, children: [
24286
+ /* @__PURE__ */ jsx29(Text27, { bold: true, color: theme.text.primary, children: "Arquivos de mem\xF3ria" }),
24287
+ sortDesc(memoryFiles).map((f) => /* @__PURE__ */ jsx29(DetailRow, { name: f.path, tokens: f.tokens }, f.path))
24288
+ ] }),
24289
+ skills.length > 0 && /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", marginTop: 1, children: [
24290
+ /* @__PURE__ */ jsx29(Text27, { bold: true, color: theme.text.primary, children: "Skills" }),
24291
+ skills.map((sk) => /* @__PURE__ */ jsx29(DetailRow, { name: sk.name, tokens: sk.tokens }, sk.name))
24292
+ ] })
24293
+ ] }) : /* @__PURE__ */ jsx29(Box24, { marginTop: 1, children: /* @__PURE__ */ jsx29(Text27, { color: theme.text.secondary, italic: true, children: "Use /context detail para ver o detalhamento por item." }) })
24294
+ ]
24295
+ }
24296
+ );
24297
+ };
24298
+ var HistoryItemDisplay = ({
24299
+ item,
24300
+ availableTerminalHeight,
24301
+ terminalWidth,
24302
+ mainAreaWidth,
24303
+ isPending,
24304
+ isFocused = true,
24305
+ activeShellPtyId,
24306
+ embeddedShellFocused,
24307
+ compactLabel,
24308
+ summaryAbsorbed = false
24480
24309
  }) => {
24481
24310
  const { compactMode } = useCompactMode();
24482
24311
  const safeItem = escapeAnsiCtrlCodes(item);
24483
24312
  const contentWidth = terminalWidth - 4;
24484
24313
  const boxWidth = mainAreaWidth ?? contentWidth;
24485
24314
  const marginTop = safeItem.type === "gemini_content" || safeItem.type === "gemini_thought_content" ? 0 : 1;
24486
- return /* @__PURE__ */ jsxs21(Box22, { flexDirection: "column", marginTop, marginLeft: 2, marginRight: 2, children: [
24487
- safeItem.type === "user" && /* @__PURE__ */ jsx27(UserMessage, { text: safeItem.text }),
24488
- safeItem.type === "user_shell" && /* @__PURE__ */ jsx27(UserShellMessage, { text: safeItem.text }),
24489
- safeItem.type === "gemini" && /* @__PURE__ */ jsx27(
24315
+ return /* @__PURE__ */ jsxs24(Box25, { flexDirection: "column", marginTop, marginLeft: 2, marginRight: 2, children: [
24316
+ safeItem.type === "user" && /* @__PURE__ */ jsx30(UserMessage, { text: safeItem.text }),
24317
+ safeItem.type === "user_shell" && /* @__PURE__ */ jsx30(UserShellMessage, { text: safeItem.text }),
24318
+ safeItem.type === "gemini" && /* @__PURE__ */ jsx30(
24490
24319
  AssistantMessage,
24491
24320
  {
24492
24321
  text: safeItem.text,
@@ -24495,7 +24324,7 @@ var HistoryItemDisplay = ({
24495
24324
  contentWidth
24496
24325
  }
24497
24326
  ),
24498
- safeItem.type === "gemini_content" && /* @__PURE__ */ jsx27(
24327
+ safeItem.type === "gemini_content" && /* @__PURE__ */ jsx30(
24499
24328
  AssistantMessageContent,
24500
24329
  {
24501
24330
  text: safeItem.text,
@@ -24504,7 +24333,7 @@ var HistoryItemDisplay = ({
24504
24333
  contentWidth
24505
24334
  }
24506
24335
  ),
24507
- !compactMode && safeItem.type === "gemini_thought" && /* @__PURE__ */ jsx27(
24336
+ !compactMode && safeItem.type === "gemini_thought" && /* @__PURE__ */ jsx30(
24508
24337
  ThinkMessage,
24509
24338
  {
24510
24339
  text: safeItem.text,
@@ -24513,7 +24342,7 @@ var HistoryItemDisplay = ({
24513
24342
  contentWidth
24514
24343
  }
24515
24344
  ),
24516
- !compactMode && safeItem.type === "gemini_thought_content" && /* @__PURE__ */ jsx27(
24345
+ !compactMode && safeItem.type === "gemini_thought_content" && /* @__PURE__ */ jsx30(
24517
24346
  ThinkMessageContent,
24518
24347
  {
24519
24348
  text: safeItem.text,
@@ -24522,11 +24351,11 @@ var HistoryItemDisplay = ({
24522
24351
  contentWidth
24523
24352
  }
24524
24353
  ),
24525
- safeItem.type === "info" && /* @__PURE__ */ jsx27(InfoMessage, { text: safeItem.text }),
24526
- safeItem.type === "success" && /* @__PURE__ */ jsx27(SuccessMessage, { text: safeItem.text }),
24527
- safeItem.type === "warning" && /* @__PURE__ */ jsx27(WarningMessage, { text: safeItem.text }),
24528
- safeItem.type === "error" && /* @__PURE__ */ jsx27(ErrorMessage, { text: safeItem.text }),
24529
- safeItem.type === "tool_group" && /* @__PURE__ */ jsx27(
24354
+ safeItem.type === "info" && /* @__PURE__ */ jsx30(InfoMessage, { text: safeItem.text }),
24355
+ safeItem.type === "success" && /* @__PURE__ */ jsx30(SuccessMessage, { text: safeItem.text }),
24356
+ safeItem.type === "warning" && /* @__PURE__ */ jsx30(WarningMessage, { text: safeItem.text }),
24357
+ safeItem.type === "error" && /* @__PURE__ */ jsx30(ErrorMessage, { text: safeItem.text }),
24358
+ safeItem.type === "tool_group" && /* @__PURE__ */ jsx30(
24530
24359
  ToolGroupMessage,
24531
24360
  {
24532
24361
  toolCalls: safeItem.tools,
@@ -24543,111 +24372,58 @@ var HistoryItemDisplay = ({
24543
24372
  compactLabel
24544
24373
  }
24545
24374
  ),
24546
- safeItem.type === "tool_use_summary" && (!compactMode || !summaryAbsorbed) && /* @__PURE__ */ jsx27(Box22, { paddingLeft: 1, children: /* @__PURE__ */ jsxs21(Text25, { dimColor: true, children: [
24375
+ safeItem.type === "context_usage" && /* @__PURE__ */ jsx30(
24376
+ ContextUsage,
24377
+ {
24378
+ modelName: safeItem.modelName,
24379
+ totalTokens: safeItem.totalTokens,
24380
+ contextWindowSize: safeItem.contextWindowSize,
24381
+ breakdown: safeItem.breakdown,
24382
+ builtinTools: safeItem.builtinTools,
24383
+ mcpTools: safeItem.mcpTools,
24384
+ memoryFiles: safeItem.memoryFiles,
24385
+ skills: safeItem.skills,
24386
+ isEstimated: safeItem.isEstimated,
24387
+ showDetails: safeItem.showDetails
24388
+ }
24389
+ ),
24390
+ safeItem.type === "compression" && /* @__PURE__ */ jsx30(CompressionMessage, { compression: safeItem.compression }),
24391
+ safeItem.type === "summary" && /* @__PURE__ */ jsx30(SummaryMessage, { summary: safeItem.summary }),
24392
+ safeItem.type === "tool_use_summary" && (!compactMode || !summaryAbsorbed) && /* @__PURE__ */ jsx30(Box25, { paddingLeft: 1, children: /* @__PURE__ */ jsxs24(Text28, { dimColor: true, children: [
24547
24393
  "\u25CF ",
24548
24394
  safeItem.summary
24549
24395
  ] }) }),
24550
- safeItem.type === "retry_countdown" && /* @__PURE__ */ jsx27(WarningMessage, { text: safeItem.text }),
24551
- safeItem.type === "away_recap" && /* @__PURE__ */ jsx27(InfoMessage, { text: safeItem.text }),
24552
- safeItem.type === "memory_saved" && /* @__PURE__ */ jsx27(
24396
+ safeItem.type === "retry_countdown" && /* @__PURE__ */ jsx30(WarningMessage, { text: safeItem.text }),
24397
+ safeItem.type === "away_recap" && /* @__PURE__ */ jsx30(InfoMessage, { text: safeItem.text }),
24398
+ safeItem.type === "memory_saved" && /* @__PURE__ */ jsx30(
24553
24399
  InfoMessage,
24554
24400
  {
24555
24401
  text: `${safeItem.verb ?? "Saved"} ${safeItem.writtenCount} ${safeItem.writtenCount === 1 ? "memory file" : "memory files"}.`
24556
24402
  }
24557
24403
  ),
24558
- shouldRenderFallback(safeItem.type) && safeItem.text && /* @__PURE__ */ jsx27(InfoMessage, { text: safeItem.text }),
24559
- safeItem.type === "quit" && /* @__PURE__ */ jsx27(InfoMessage, { text: `Session ended. Duration: ${safeItem.duration}`, width: boxWidth })
24404
+ shouldRenderFallback(safeItem.type) && safeItem.text && /* @__PURE__ */ jsx30(InfoMessage, { text: safeItem.text }),
24405
+ safeItem.type === "quit" && /* @__PURE__ */ jsx30(InfoMessage, { text: `Session ended. Duration: ${safeItem.duration}`, width: boxWidth })
24560
24406
  ] });
24561
24407
  };
24562
24408
  function shouldRenderFallback(type) {
24563
24409
  return type === "notification" || type === "extensions_list" || type === "model_stats" || type === "tool_stats" || type === "stats";
24564
24410
  }
24565
- var InfoMessage = ({ text }) => /* @__PURE__ */ jsxs21(Text25, { color: theme.text.secondary, children: [
24411
+ var InfoMessage = ({ text }) => /* @__PURE__ */ jsxs24(Text28, { color: theme.text.secondary, children: [
24566
24412
  "\u2139 ",
24567
24413
  text
24568
24414
  ] });
24569
- var SuccessMessage = ({ text }) => /* @__PURE__ */ jsxs21(Text25, { color: theme.status.success, children: [
24415
+ var SuccessMessage = ({ text }) => /* @__PURE__ */ jsxs24(Text28, { color: theme.status.success, children: [
24570
24416
  "\u2713 ",
24571
24417
  text
24572
24418
  ] });
24573
- var WarningMessage = ({ text }) => /* @__PURE__ */ jsxs21(Text25, { color: theme.status.warning, children: [
24419
+ var WarningMessage = ({ text }) => /* @__PURE__ */ jsxs24(Text28, { color: theme.status.warning, children: [
24574
24420
  "\u26A0 ",
24575
24421
  text
24576
24422
  ] });
24577
- var ErrorMessage = ({ text }) => /* @__PURE__ */ jsxs21(Text25, { color: theme.status.error, children: [
24423
+ var ErrorMessage = ({ text }) => /* @__PURE__ */ jsxs24(Text28, { color: theme.status.error, children: [
24578
24424
  "\u2717 ",
24579
24425
  text
24580
24426
  ] });
24581
- var STATUS_ICON = {
24582
- pending: "\u25CB",
24583
- running: "\u25D0",
24584
- completed: "\u2713",
24585
- failed: "\u2717"
24586
- };
24587
- function statusColor(status) {
24588
- switch (status) {
24589
- case "completed":
24590
- return theme.status.success;
24591
- case "failed":
24592
- return theme.status.error;
24593
- case "running":
24594
- return theme.text.accent;
24595
- default:
24596
- return theme.text.secondary;
24597
- }
24598
- }
24599
- function streamTail(stream, max = 100) {
24600
- const lines = stream.split(/\r?\n/).filter((line) => line.trim().length > 0);
24601
- const last = lines[lines.length - 1] ?? "";
24602
- return last.length > max ? `${last.slice(0, max - 1)}\u2026` : last;
24603
- }
24604
- var TaskPlanPanel = ({ plan, taskStreams }) => {
24605
- const completed = plan.tasks.filter((task) => task.status === "completed").length;
24606
- return /* @__PURE__ */ jsxs22(
24607
- Box23,
24608
- {
24609
- flexDirection: "column",
24610
- marginTop: 1,
24611
- marginLeft: 2,
24612
- marginRight: 2,
24613
- borderStyle: "round",
24614
- borderColor: theme.border.default,
24615
- paddingX: 1,
24616
- children: [
24617
- /* @__PURE__ */ jsxs22(Text26, { bold: true, color: theme.text.accent, children: [
24618
- "Plan \xB7 ",
24619
- plan.objective,
24620
- " ",
24621
- /* @__PURE__ */ jsxs22(Text26, { color: theme.text.secondary, children: [
24622
- "(",
24623
- completed,
24624
- "/",
24625
- plan.tasks.length,
24626
- ")"
24627
- ] })
24628
- ] }),
24629
- plan.tasks.map((task) => {
24630
- const tail = task.status === "running" ? streamTail(taskStreams[task.id] ?? "") : "";
24631
- return /* @__PURE__ */ jsxs22(Box23, { flexDirection: "column", children: [
24632
- /* @__PURE__ */ jsxs22(Text26, { color: statusColor(task.status), children: [
24633
- STATUS_ICON[task.status],
24634
- " ",
24635
- task.description,
24636
- task.error ? /* @__PURE__ */ jsxs22(Text26, { color: theme.status.error, children: [
24637
- " \u2014 ",
24638
- task.error
24639
- ] }) : null
24640
- ] }),
24641
- tail ? /* @__PURE__ */ jsxs22(Text26, { color: theme.text.secondary, children: [
24642
- " ",
24643
- tail
24644
- ] }) : null
24645
- ] }, task.id);
24646
- })
24647
- ]
24648
- }
24649
- );
24650
- };
24651
24427
  var UIActionsContext = createContext5(null);
24652
24428
  var useUIActions = () => {
24653
24429
  const context = useContext6(UIActionsContext);
@@ -24756,8 +24532,6 @@ var MainContent = ({
24756
24532
  historyRemountKey,
24757
24533
  pendingAssistantText,
24758
24534
  liveToolCalls,
24759
- taskPlan,
24760
- taskStreams,
24761
24535
  terminalWidth,
24762
24536
  mainAreaWidth,
24763
24537
  isFocused = true
@@ -24844,8 +24618,8 @@ var MainContent = ({
24844
24618
  return () => clearImmediate(handle);
24845
24619
  }, [replayCount, mergedHistory.length]);
24846
24620
  const visibleHistory = mergedHistory.length - replayCount <= PROGRESSIVE_REPLAY_CHUNK_SIZE ? mergedHistory : mergedHistory.slice(0, replayCount);
24847
- return /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", flexGrow: 1, children: [
24848
- /* @__PURE__ */ jsx28(Static, { items: visibleHistory, children: (item) => /* @__PURE__ */ jsx28(
24621
+ return /* @__PURE__ */ jsxs25(Box26, { flexDirection: "column", flexGrow: 1, children: [
24622
+ /* @__PURE__ */ jsx31(Static, { items: visibleHistory, children: (item) => /* @__PURE__ */ jsx31(
24849
24623
  HistoryItemDisplay,
24850
24624
  {
24851
24625
  item,
@@ -24858,7 +24632,7 @@ var MainContent = ({
24858
24632
  },
24859
24633
  item.id
24860
24634
  ) }, historyRemountKey),
24861
- pendingAssistantText.trim().length > 0 && /* @__PURE__ */ jsx28(
24635
+ pendingAssistantText.trim().length > 0 && /* @__PURE__ */ jsx31(
24862
24636
  HistoryItemDisplay,
24863
24637
  {
24864
24638
  item: { id: -1, type: "gemini", text: pendingAssistantText },
@@ -24868,7 +24642,7 @@ var MainContent = ({
24868
24642
  isFocused
24869
24643
  }
24870
24644
  ),
24871
- liveToolCalls.length > 0 && /* @__PURE__ */ jsx28(
24645
+ liveToolCalls.length > 0 && /* @__PURE__ */ jsx31(
24872
24646
  HistoryItemDisplay,
24873
24647
  {
24874
24648
  item: { id: -2, type: "tool_group", tools: liveToolCalls },
@@ -24878,10 +24652,17 @@ var MainContent = ({
24878
24652
  isFocused,
24879
24653
  compactLabel: getCompactLabel({ type: "tool_group", tools: liveToolCalls })
24880
24654
  }
24881
- ),
24882
- taskPlan && /* @__PURE__ */ jsx28(TaskPlanPanel, { plan: taskPlan, taskStreams })
24655
+ )
24883
24656
  ] });
24884
24657
  };
24658
+ var ShowMoreLines = ({ constrainHeight }) => {
24659
+ const overflowState = useOverflowState();
24660
+ const streamingState = useStreamingContext();
24661
+ if (overflowState === void 0 || overflowState.overflowingIds.size === 0 || !constrainHeight || !(streamingState === "idle" || streamingState === "waiting_for_confirmation")) {
24662
+ return null;
24663
+ }
24664
+ return /* @__PURE__ */ jsx32(Box27, { children: /* @__PURE__ */ jsx32(Text29, { color: theme.text.secondary, wrap: "truncate", children: "Press ctrl-s to show more lines" }) });
24665
+ };
24885
24666
  function useTerminalSize() {
24886
24667
  const [size, setSize] = useState13({
24887
24668
  columns: process.stdout.columns || 80,
@@ -24981,34 +24762,34 @@ var LoadingIndicator = ({
24981
24762
  time: timeStr,
24982
24763
  tokens: tokenStr
24983
24764
  }) : null;
24984
- return /* @__PURE__ */ jsxs24(Box25, { paddingLeft: 2, flexDirection: "column", children: [
24985
- /* @__PURE__ */ jsxs24(
24986
- Box25,
24765
+ return /* @__PURE__ */ jsxs26(Box28, { paddingLeft: 2, flexDirection: "column", children: [
24766
+ /* @__PURE__ */ jsxs26(
24767
+ Box28,
24987
24768
  {
24988
24769
  width: "100%",
24989
24770
  flexDirection: isNarrow ? "column" : "row",
24990
24771
  alignItems: isNarrow ? "flex-start" : "center",
24991
24772
  children: [
24992
- /* @__PURE__ */ jsxs24(Box25, { children: [
24993
- /* @__PURE__ */ jsx29(Box25, { marginRight: 1, children: /* @__PURE__ */ jsx29(
24773
+ /* @__PURE__ */ jsxs26(Box28, { children: [
24774
+ /* @__PURE__ */ jsx33(Box28, { marginRight: 1, children: /* @__PURE__ */ jsx33(
24994
24775
  GeminiRespondingSpinner,
24995
24776
  {
24996
24777
  nonRespondingDisplay: streamingState === "waiting_for_confirmation" ? "\u280F" : ""
24997
24778
  }
24998
24779
  ) }),
24999
- primaryText && /* @__PURE__ */ jsx29(Text27, { color: theme.text.accent, wrap: "truncate-end", children: primaryText }),
25000
- !isNarrow && cancelAndTimerContent && /* @__PURE__ */ jsxs24(Text27, { color: theme.text.secondary, children: [
24780
+ primaryText && /* @__PURE__ */ jsx33(Text30, { color: theme.text.accent, wrap: "truncate-end", children: primaryText }),
24781
+ !isNarrow && cancelAndTimerContent && /* @__PURE__ */ jsxs26(Text30, { color: theme.text.secondary, children: [
25001
24782
  " ",
25002
24783
  cancelAndTimerContent
25003
24784
  ] })
25004
24785
  ] }),
25005
- !isNarrow && /* @__PURE__ */ jsx29(Box25, { flexGrow: 1 }),
25006
- !isNarrow && rightContent && /* @__PURE__ */ jsx29(Box25, { children: rightContent })
24786
+ !isNarrow && /* @__PURE__ */ jsx33(Box28, { flexGrow: 1 }),
24787
+ !isNarrow && rightContent && /* @__PURE__ */ jsx33(Box28, { children: rightContent })
25007
24788
  ]
25008
24789
  }
25009
24790
  ),
25010
- isNarrow && cancelAndTimerContent && /* @__PURE__ */ jsx29(Box25, { children: /* @__PURE__ */ jsx29(Text27, { color: theme.text.secondary, children: cancelAndTimerContent }) }),
25011
- isNarrow && rightContent && /* @__PURE__ */ jsx29(Box25, { children: rightContent })
24791
+ isNarrow && cancelAndTimerContent && /* @__PURE__ */ jsx33(Box28, { children: /* @__PURE__ */ jsx33(Text30, { color: theme.text.secondary, children: cancelAndTimerContent }) }),
24792
+ isNarrow && rightContent && /* @__PURE__ */ jsx33(Box28, { children: rightContent })
25012
24793
  ] });
25013
24794
  };
25014
24795
  var MAX_WIDTH = 150;
@@ -25022,7 +24803,7 @@ var _PrepareLabel = ({
25022
24803
  const hasMatch = matchedIndex !== void 0 && matchedIndex >= 0 && matchedIndex < label.length && userInput.length > 0;
25023
24804
  if (!hasMatch) {
25024
24805
  const display = isExpanded ? label : label.length > MAX_WIDTH ? label.slice(0, MAX_WIDTH) + "..." : label;
25025
- return /* @__PURE__ */ jsx30(Text28, { wrap: "wrap", color: textColor, children: display });
24806
+ return /* @__PURE__ */ jsx34(Text31, { wrap: "wrap", color: textColor, children: display });
25026
24807
  }
25027
24808
  const matchLength = userInput.length;
25028
24809
  let before = "";
@@ -25061,10 +24842,10 @@ var _PrepareLabel = ({
25061
24842
  after = after.length >= 3 ? after.slice(0, -3) + "..." : "...";
25062
24843
  }
25063
24844
  }
25064
- return /* @__PURE__ */ jsxs25(Text28, { color: textColor, wrap: "wrap", children: [
24845
+ return /* @__PURE__ */ jsxs27(Text31, { color: textColor, wrap: "wrap", children: [
25065
24846
  before,
25066
- match ? match.split(/(\s+)/).map((part, index) => /* @__PURE__ */ jsx30(
25067
- Text28,
24847
+ match ? match.split(/(\s+)/).map((part, index) => /* @__PURE__ */ jsx34(
24848
+ Text31,
25068
24849
  {
25069
24850
  color: theme.background.primary,
25070
24851
  backgroundColor: theme.text.primary,
@@ -25088,7 +24869,7 @@ function SuggestionsDisplay({
25088
24869
  expandedIndex
25089
24870
  }) {
25090
24871
  if (isLoading) {
25091
- return /* @__PURE__ */ jsx31(Box26, { width, children: /* @__PURE__ */ jsx31(Text29, { color: "gray", children: t("Loading suggestions...") }) });
24872
+ return /* @__PURE__ */ jsx35(Box29, { width, children: /* @__PURE__ */ jsx35(Text32, { color: "gray", children: t("Loading suggestions...") }) });
25092
24873
  }
25093
24874
  if (suggestions.length === 0) {
25094
24875
  return null;
@@ -25104,8 +24885,8 @@ function SuggestionsDisplay({
25104
24885
  ...suggestions.map((s) => getFullLabel(s).length)
25105
24886
  );
25106
24887
  const commandColumnWidth = mode === "slash" ? Math.min(maxLabelLength, Math.floor(width * 0.5)) : 0;
25107
- return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", width, children: [
25108
- scrollOffset > 0 && /* @__PURE__ */ jsx31(Text29, { color: theme.text.primary, children: "\u25B2" }),
24888
+ return /* @__PURE__ */ jsxs28(Box29, { flexDirection: "column", width, children: [
24889
+ scrollOffset > 0 && /* @__PURE__ */ jsx35(Text32, { color: theme.text.primary, children: "\u25B2" }),
25109
24890
  visibleSuggestions.map((suggestion, index) => {
25110
24891
  const originalIndex = startIndex + index;
25111
24892
  const isActive = originalIndex === activeIndex;
@@ -25118,7 +24899,7 @@ function SuggestionsDisplay({
25118
24899
  width - commandColumnWidth - 2 - expansionIndicatorWidth,
25119
24900
  1
25120
24901
  );
25121
- const labelElement = /* @__PURE__ */ jsx31(
24902
+ const labelElement = /* @__PURE__ */ jsx35(
25122
24903
  PrepareLabel,
25123
24904
  {
25124
24905
  label: displayLabel,
@@ -25128,39 +24909,39 @@ function SuggestionsDisplay({
25128
24909
  isExpanded
25129
24910
  }
25130
24911
  );
25131
- return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "row", children: [
25132
- /* @__PURE__ */ jsx31(
25133
- Box26,
24912
+ return /* @__PURE__ */ jsxs28(Box29, { flexDirection: "row", children: [
24913
+ /* @__PURE__ */ jsx35(
24914
+ Box29,
25134
24915
  {
25135
24916
  ...mode === "slash" ? { width: commandColumnWidth, flexShrink: 0 } : { flexShrink: 1 },
25136
- children: /* @__PURE__ */ jsxs26(Box26, { children: [
24917
+ children: /* @__PURE__ */ jsxs28(Box29, { children: [
25137
24918
  labelElement,
25138
- suggestion.argumentHint && /* @__PURE__ */ jsxs26(Text29, { color: theme.text.secondary, children: [
24919
+ suggestion.argumentHint && /* @__PURE__ */ jsxs28(Text32, { color: theme.text.secondary, children: [
25139
24920
  " ",
25140
24921
  suggestion.argumentHint
25141
24922
  ] }),
25142
- suggestion.sourceBadge && /* @__PURE__ */ jsxs26(Text29, { color: textColor, children: [
24923
+ suggestion.sourceBadge && /* @__PURE__ */ jsxs28(Text32, { color: textColor, children: [
25143
24924
  " ",
25144
24925
  suggestion.sourceBadge
25145
24926
  ] })
25146
24927
  ] })
25147
24928
  }
25148
24929
  ),
25149
- suggestion.description && /* @__PURE__ */ jsx31(
25150
- Box26,
24930
+ suggestion.description && /* @__PURE__ */ jsx35(
24931
+ Box29,
25151
24932
  {
25152
24933
  width: descriptionColumnWidth,
25153
24934
  flexGrow: 1,
25154
24935
  flexShrink: 1,
25155
24936
  paddingLeft: 2,
25156
- children: /* @__PURE__ */ jsx31(Text29, { color: textColor, wrap: "wrap", children: suggestion.description })
24937
+ children: /* @__PURE__ */ jsx35(Text32, { color: textColor, wrap: "wrap", children: suggestion.description })
25157
24938
  }
25158
24939
  ),
25159
- isActive && isLong && /* @__PURE__ */ jsx31(Box26, { children: /* @__PURE__ */ jsx31(Text29, { color: Colors.Gray, children: isExpanded ? " \u2190 " : " \u2192 " }) })
24940
+ isActive && isLong && /* @__PURE__ */ jsx35(Box29, { children: /* @__PURE__ */ jsx35(Text32, { color: Colors.Gray, children: isExpanded ? " \u2190 " : " \u2192 " }) })
25160
24941
  ] }, `${suggestion.value}-${originalIndex}`);
25161
24942
  }),
25162
- endIndex < suggestions.length && /* @__PURE__ */ jsx31(Text29, { color: "gray", children: "\u25BC" }),
25163
- suggestions.length > MAX_SUGGESTIONS_TO_SHOW && /* @__PURE__ */ jsxs26(Text29, { color: "gray", children: [
24943
+ endIndex < suggestions.length && /* @__PURE__ */ jsx35(Text32, { color: "gray", children: "\u25BC" }),
24944
+ suggestions.length > MAX_SUGGESTIONS_TO_SHOW && /* @__PURE__ */ jsxs28(Text32, { color: "gray", children: [
25164
24945
  "(",
25165
24946
  activeIndex + 1,
25166
24947
  "/",
@@ -26578,10 +26359,10 @@ function useExportCompletion(buffer, slashCommands) {
26578
26359
  const cyclingActiveRef = useRef11(false);
26579
26360
  const nextTextChangeWasUserInputRef = useRef11(false);
26580
26361
  const exportFormatSuggestions = useMemo10(() => {
26581
- const exportCommand = slashCommands.find(
26362
+ const exportCommand2 = slashCommands.find(
26582
26363
  (command) => command.name === EXPORT_COMMAND_INPUT.slice(1)
26583
26364
  );
26584
- const subCommands = exportCommand?.subCommands;
26365
+ const subCommands = exportCommand2?.subCommands;
26585
26366
  if (subCommands && subCommands.length > 0) {
26586
26367
  return subCommands.map((command) => ({
26587
26368
  label: command.name,
@@ -26600,8 +26381,8 @@ function useExportCompletion(buffer, slashCommands) {
26600
26381
  nextTextChangeWasUserInputRef.current = true;
26601
26382
  }, []);
26602
26383
  useEffect222(() => {
26603
- const fmt = getExportFormatFromInput(buffer.text, exportCycleFormats);
26604
- if (nextTextChangeWasUserInputRef.current && fmt !== null && !cyclingActiveRef.current) {
26384
+ const fmt2 = getExportFormatFromInput(buffer.text, exportCycleFormats);
26385
+ if (nextTextChangeWasUserInputRef.current && fmt2 !== null && !cyclingActiveRef.current) {
26605
26386
  cyclingActiveRef.current = true;
26606
26387
  }
26607
26388
  nextTextChangeWasUserInputRef.current = false;
@@ -26910,11 +26691,11 @@ function defaultRenderLine({
26910
26691
  showCursor
26911
26692
  }) {
26912
26693
  if (!isOnCursorLine || !showCursor) {
26913
- return /* @__PURE__ */ jsx32(Text30, { children: lineText || " " });
26694
+ return /* @__PURE__ */ jsx36(Text33, { children: lineText || " " });
26914
26695
  }
26915
26696
  const len = cpLen(lineText);
26916
26697
  if (cursorCol >= len) {
26917
- return /* @__PURE__ */ jsxs27(Text30, { children: [
26698
+ return /* @__PURE__ */ jsxs29(Text33, { children: [
26918
26699
  lineText,
26919
26700
  chalk2.inverse(" ") + "\u200B"
26920
26701
  ] });
@@ -26922,7 +26703,7 @@ function defaultRenderLine({
26922
26703
  const before = cpSlice(lineText, 0, cursorCol);
26923
26704
  const cursorChar = cpSlice(lineText, cursorCol, cursorCol + 1);
26924
26705
  const after = cpSlice(lineText, cursorCol + 1);
26925
- return /* @__PURE__ */ jsxs27(Text30, { children: [
26706
+ return /* @__PURE__ */ jsxs29(Text33, { children: [
26926
26707
  before,
26927
26708
  chalk2.inverse(cursorChar),
26928
26709
  after
@@ -27045,15 +26826,15 @@ var BaseTextInput = ({
27045
26826
  const [cursorVisualRow, cursorVisualCol] = buffer.visualCursor;
27046
26827
  const scrollVisualRow = buffer.visualScrollRow;
27047
26828
  const resolvedBorderColor = borderColor ?? theme.border.focused;
27048
- const resolvedPrefix = prefix ?? /* @__PURE__ */ jsx32(Text30, { color: theme.text.accent, children: "> " });
26829
+ const resolvedPrefix = prefix ?? /* @__PURE__ */ jsx36(Text33, { color: theme.text.accent, children: "> " });
27049
26830
  const columns = process.stdout.columns || 80;
27050
26831
  const labelWidth = topRightLabel ? stringWidth(topRightLabel) + 4 : 0;
27051
26832
  const dashCount = Math.max(1, columns - labelWidth);
27052
26833
  const topBorderLine = topRightLabel ? `${"\u2500".repeat(dashCount)} ${topRightLabel} ${"\u2500".repeat(2)}` : "\u2500".repeat(columns);
27053
- return /* @__PURE__ */ jsxs27(Box27, { flexDirection: "column", children: [
27054
- /* @__PURE__ */ jsx32(Text30, { color: resolvedBorderColor, wrap: "truncate-end", children: topBorderLine }),
27055
- /* @__PURE__ */ jsxs27(
27056
- Box27,
26834
+ return /* @__PURE__ */ jsxs29(Box30, { flexDirection: "column", children: [
26835
+ /* @__PURE__ */ jsx36(Text33, { color: resolvedBorderColor, wrap: "truncate-end", children: topBorderLine }),
26836
+ /* @__PURE__ */ jsxs29(
26837
+ Box30,
27057
26838
  {
27058
26839
  borderStyle: "single",
27059
26840
  borderTop: false,
@@ -27063,13 +26844,13 @@ var BaseTextInput = ({
27063
26844
  borderColor: resolvedBorderColor,
27064
26845
  children: [
27065
26846
  resolvedPrefix,
27066
- /* @__PURE__ */ jsx32(Box27, { flexGrow: 1, flexDirection: "column", children: buffer.text.length === 0 && placeholder ? showCursor ? /* @__PURE__ */ jsxs27(Text30, { children: [
26847
+ /* @__PURE__ */ jsx36(Box30, { flexGrow: 1, flexDirection: "column", children: buffer.text.length === 0 && placeholder ? showCursor ? /* @__PURE__ */ jsxs29(Text33, { children: [
27067
26848
  chalk2.inverse(placeholder.slice(0, 1)),
27068
- /* @__PURE__ */ jsx32(Text30, { color: theme.text.secondary, children: placeholder.slice(1) })
27069
- ] }) : /* @__PURE__ */ jsx32(Text30, { color: theme.text.secondary, children: placeholder }) : linesToRender.map((lineText, idx) => {
26849
+ /* @__PURE__ */ jsx36(Text33, { color: theme.text.secondary, children: placeholder.slice(1) })
26850
+ ] }) : /* @__PURE__ */ jsx36(Text33, { color: theme.text.secondary, children: placeholder }) : linesToRender.map((lineText, idx) => {
27070
26851
  const absoluteVisualIndex = scrollVisualRow + idx;
27071
26852
  const isOnCursorLine = absoluteVisualIndex === cursorVisualRow;
27072
- return /* @__PURE__ */ jsx32(Box27, { height: 1, children: renderLine({
26853
+ return /* @__PURE__ */ jsx36(Box30, { height: 1, children: renderLine({
27073
26854
  lineText,
27074
26855
  isOnCursorLine,
27075
26856
  cursorCol: cursorVisualCol,
@@ -28033,7 +27814,7 @@ ${currentText}`);
28033
27814
  }
28034
27815
  const color = seg.type === "command" || seg.type === "file" ? theme.text.accent : theme.text.primary;
28035
27816
  renderedLine.push(
28036
- /* @__PURE__ */ jsx33(Text31, { color, children: display }, `token-${segIdx}`)
27817
+ /* @__PURE__ */ jsx37(Text34, { color, children: display }, `token-${segIdx}`)
28037
27818
  );
28038
27819
  });
28039
27820
  if (isOnCursorLine && cursorVisualColAbsolute === cpLen(lineText)) {
@@ -28041,31 +27822,31 @@ ${currentText}`);
28041
27822
  if (ghostText && showCursorOpt && ghostText.text.length > 0) {
28042
27823
  if (ghostText.showCursorBeforeText) {
28043
27824
  renderedLine.push(
28044
- /* @__PURE__ */ jsx33(Text31, { children: chalk3.inverse(" ") }, "ghost-cursor")
27825
+ /* @__PURE__ */ jsx37(Text34, { children: chalk3.inverse(" ") }, "ghost-cursor")
28045
27826
  );
28046
27827
  renderedLine.push(
28047
- /* @__PURE__ */ jsx33(Text31, { color: theme.text.secondary, children: ghostText.text }, "ghost-rest")
27828
+ /* @__PURE__ */ jsx37(Text34, { color: theme.text.secondary, children: ghostText.text }, "ghost-rest")
28048
27829
  );
28049
27830
  } else {
28050
27831
  const firstChar = ghostText.text[0];
28051
27832
  const rest = ghostText.text.slice(firstChar.length);
28052
27833
  renderedLine.push(
28053
- /* @__PURE__ */ jsx33(Text31, { children: chalk3.inverse(firstChar) }, "ghost-cursor")
27834
+ /* @__PURE__ */ jsx37(Text34, { children: chalk3.inverse(firstChar) }, "ghost-cursor")
28054
27835
  );
28055
27836
  if (rest.length > 0) {
28056
27837
  renderedLine.push(
28057
- /* @__PURE__ */ jsx33(Text31, { color: theme.text.secondary, children: rest }, "ghost-rest")
27838
+ /* @__PURE__ */ jsx37(Text34, { color: theme.text.secondary, children: rest }, "ghost-rest")
28058
27839
  );
28059
27840
  }
28060
27841
  }
28061
- renderedLine.push(/* @__PURE__ */ jsx33(Text31, { children: `\u200B` }, "ghost-zwsp"));
27842
+ renderedLine.push(/* @__PURE__ */ jsx37(Text34, { children: `\u200B` }, "ghost-zwsp"));
28062
27843
  } else {
28063
27844
  renderedLine.push(
28064
- /* @__PURE__ */ jsx33(Text31, { children: showCursorOpt ? chalk3.inverse(" ") + "\u200B" : " \u200B" }, `cursor-end-${cursorVisualColAbsolute}`)
27845
+ /* @__PURE__ */ jsx37(Text34, { children: showCursorOpt ? chalk3.inverse(" ") + "\u200B" : " \u200B" }, `cursor-end-${cursorVisualColAbsolute}`)
28065
27846
  );
28066
27847
  }
28067
27848
  }
28068
- return /* @__PURE__ */ jsx33(Text31, { children: renderedLine });
27849
+ return /* @__PURE__ */ jsx37(Text34, { children: renderedLine });
28069
27850
  },
28070
27851
  [slashCommands]
28071
27852
  );
@@ -28093,38 +27874,38 @@ ${currentText}`);
28093
27874
  }, [promptSuggestion]);
28094
27875
  const showAutoAcceptStyling = !shellModeActive && approvalMode === "auto-edit";
28095
27876
  const showYoloStyling = !shellModeActive && approvalMode === "yolo";
28096
- let statusColor3;
27877
+ let statusColor2;
28097
27878
  let statusText = "";
28098
27879
  if (shellModeActive) {
28099
- statusColor3 = theme.ui.symbol;
27880
+ statusColor2 = theme.ui.symbol;
28100
27881
  statusText = t("Shell mode");
28101
27882
  } else if (showYoloStyling) {
28102
- statusColor3 = theme.status.errorDim;
27883
+ statusColor2 = theme.status.errorDim;
28103
27884
  statusText = t("YOLO mode");
28104
27885
  } else if (showAutoAcceptStyling) {
28105
- statusColor3 = theme.status.warningDim;
27886
+ statusColor2 = theme.status.warningDim;
28106
27887
  statusText = t("Accepting edits");
28107
27888
  }
28108
- const borderColor = isShellFocused && !isEmbeddedShellFocused && !agentTabBarFocused ? statusColor3 ?? theme.border.focused : theme.border.default;
28109
- const prefixNode = /* @__PURE__ */ jsxs28(
28110
- Text31,
27889
+ const borderColor = isShellFocused && !isEmbeddedShellFocused && !agentTabBarFocused ? statusColor2 ?? theme.border.focused : theme.border.default;
27890
+ const prefixNode = /* @__PURE__ */ jsxs30(
27891
+ Text34,
28111
27892
  {
28112
- color: statusColor3 ?? theme.text.accent,
27893
+ color: statusColor2 ?? theme.text.accent,
28113
27894
  "aria-label": statusText || void 0,
28114
27895
  children: [
28115
- shellModeActive ? reverseSearchActive ? /* @__PURE__ */ jsxs28(Text31, { color: theme.text.link, "aria-label": SCREEN_READER_USER_PREFIX, children: [
27896
+ shellModeActive ? reverseSearchActive ? /* @__PURE__ */ jsxs30(Text34, { color: theme.text.link, "aria-label": SCREEN_READER_USER_PREFIX, children: [
28116
27897
  "(r:)",
28117
27898
  " "
28118
- ] }) : "!" : commandSearchActive ? /* @__PURE__ */ jsx33(Text31, { color: theme.text.accent, children: "(r:) " }) : showYoloStyling ? "*" : ">",
27899
+ ] }) : "!" : commandSearchActive ? /* @__PURE__ */ jsx37(Text34, { color: theme.text.accent, children: "(r:) " }) : showYoloStyling ? "*" : ">",
28119
27900
  " "
28120
27901
  ]
28121
27902
  }
28122
27903
  );
28123
- return /* @__PURE__ */ jsxs28(Fragment7, { children: [
28124
- attachments.length > 0 && /* @__PURE__ */ jsxs28(Box28, { marginLeft: 2, marginBottom: 0, children: [
28125
- /* @__PURE__ */ jsx33(Text31, { color: theme.text.secondary, children: t("Attachments: ") }),
28126
- attachments.map((att, idx) => /* @__PURE__ */ jsxs28(
28127
- Text31,
27904
+ return /* @__PURE__ */ jsxs30(Fragment8, { children: [
27905
+ attachments.length > 0 && /* @__PURE__ */ jsxs30(Box31, { marginLeft: 2, marginBottom: 0, children: [
27906
+ /* @__PURE__ */ jsx37(Text34, { color: theme.text.secondary, children: t("Attachments: ") }),
27907
+ attachments.map((att, idx) => /* @__PURE__ */ jsxs30(
27908
+ Text34,
28128
27909
  {
28129
27910
  color: isAttachmentMode && idx === selectedAttachmentIndex ? theme.status.success : theme.text.secondary,
28130
27911
  children: [
@@ -28137,7 +27918,7 @@ ${currentText}`);
28137
27918
  att.id
28138
27919
  ))
28139
27920
  ] }),
28140
- /* @__PURE__ */ jsx33(
27921
+ /* @__PURE__ */ jsx37(
28141
27922
  BaseTextInput,
28142
27923
  {
28143
27924
  buffer,
@@ -28152,7 +27933,7 @@ ${currentText}`);
28152
27933
  renderLine: renderLineWithHighlighting
28153
27934
  }
28154
27935
  ),
28155
- shouldShowSuggestions && /* @__PURE__ */ jsx33(Box28, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsx33(
27936
+ shouldShowSuggestions && /* @__PURE__ */ jsx37(Box31, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsx37(
28156
27937
  SuggestionsDisplay,
28157
27938
  {
28158
27939
  suggestions: suggestionDisplayProps.suggestions,
@@ -28165,7 +27946,7 @@ ${currentText}`);
28165
27946
  expandedIndex: expandedSuggestionIndex
28166
27947
  }
28167
27948
  ) }),
28168
- attachments.length > 0 && !shouldShowSuggestions && /* @__PURE__ */ jsx33(Box28, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsx33(Text31, { color: theme.text.secondary, children: isAttachmentMode ? t("\u2190 \u2192 select, Delete to remove, \u2193 to exit") : t("\u2191 to manage attachments") }) })
27949
+ attachments.length > 0 && !shouldShowSuggestions && /* @__PURE__ */ jsx37(Box31, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsx37(Text34, { color: theme.text.secondary, children: isAttachmentMode ? t("\u2190 \u2192 select, Delete to remove, \u2193 to exit") : t("\u2191 to manage attachments") }) })
28169
27950
  ] });
28170
27951
  };
28171
27952
  function formatPercentageUsed(percentage) {
@@ -28187,12 +27968,12 @@ var ContextUsageDisplay = ({
28187
27968
  const isOverLimit = percentage > 1;
28188
27969
  const label = terminalWidth < 100 ? t("% used") : t("% context used");
28189
27970
  if (isOverLimit) {
28190
- return /* @__PURE__ */ jsx34(Fragment8, { children: /* @__PURE__ */ jsxs29(Text32, { color: theme.status.error, children: [
27971
+ return /* @__PURE__ */ jsx38(Fragment9, { children: /* @__PURE__ */ jsxs31(Text35, { color: theme.status.error, children: [
28191
27972
  percentageUsed,
28192
27973
  label
28193
27974
  ] }) });
28194
27975
  }
28195
- return /* @__PURE__ */ jsxs29(Text32, { color: theme.text.secondary, children: [
27976
+ return /* @__PURE__ */ jsxs31(Text35, { color: theme.text.secondary, children: [
28196
27977
  percentageUsed,
28197
27978
  label
28198
27979
  ] });
@@ -28224,20 +28005,20 @@ var AutoAcceptIndicator = ({
28224
28005
  default:
28225
28006
  break;
28226
28007
  }
28227
- return /* @__PURE__ */ jsxs30(Text33, { color: textColor, children: [
28008
+ return /* @__PURE__ */ jsxs32(Text36, { color: textColor, children: [
28228
28009
  textContent,
28229
- subText && /* @__PURE__ */ jsx35(Text33, { color: theme.text.secondary, children: subText })
28010
+ subText && /* @__PURE__ */ jsx39(Text36, { color: theme.text.secondary, children: subText })
28230
28011
  ] });
28231
28012
  };
28232
- var ShellModeIndicator = () => /* @__PURE__ */ jsxs31(Text34, { color: theme.ui.symbol, children: [
28013
+ var ShellModeIndicator = () => /* @__PURE__ */ jsxs33(Text37, { color: theme.ui.symbol, children: [
28233
28014
  "shell mode enabled",
28234
- /* @__PURE__ */ jsx36(Text34, { color: theme.text.secondary, children: " (esc to disable)" })
28015
+ /* @__PURE__ */ jsx40(Text37, { color: theme.text.secondary, children: " (esc to disable)" })
28235
28016
  ] });
28236
28017
  function BackgroundTasksPill() {
28237
28018
  const { activeSubagents } = useUIState();
28238
28019
  const running = activeSubagents.filter((s) => s.status === "running").length;
28239
28020
  if (running <= 0) return null;
28240
- return /* @__PURE__ */ jsxs32(Text35, { color: theme.text.accent, children: [
28021
+ return /* @__PURE__ */ jsxs34(Text38, { color: theme.text.accent, children: [
28241
28022
  " ",
28242
28023
  running,
28243
28024
  " task",
@@ -28248,32 +28029,36 @@ function MCPHealthPill() {
28248
28029
  const { mcpConnected, mcpTotal } = useUIState();
28249
28030
  if (mcpTotal === 0) return null;
28250
28031
  const color = mcpConnected === mcpTotal ? theme.status.success : theme.status.warning;
28251
- return /* @__PURE__ */ jsxs33(Text36, { color, children: [
28032
+ return /* @__PURE__ */ jsxs35(Text39, { color, children: [
28252
28033
  " MCP ",
28253
28034
  mcpConnected,
28254
28035
  "/",
28255
28036
  mcpTotal
28256
28037
  ] });
28257
28038
  }
28039
+ var GIT_POLL_INTERVAL_MS = 3e4;
28258
28040
  function useStatusLine() {
28259
28041
  const config = useConfig();
28260
28042
  const cwd = config.getWorkingDir();
28261
- const [line, setLine] = useState222(null);
28043
+ const [branch, setBranch] = useState222(null);
28262
28044
  useEffect24(() => {
28263
- let cancelled = false;
28264
- execFile22("git", ["branch", "--show-current"], { cwd }, (err, stdout) => {
28265
- if (cancelled) return;
28266
- const branch = err ? null : stdout.trim();
28267
- if (!branch) return;
28268
- const home = os5.homedir();
28269
- const displayCwd = cwd.startsWith(home) ? `~${cwd.slice(home.length)}` : cwd;
28270
- setLine(`${displayCwd} [${branch}]`);
28271
- });
28045
+ let alive = true;
28046
+ function poll() {
28047
+ execFile22("git", ["branch", "--show-current"], { cwd }, (err, stdout) => {
28048
+ if (alive) setBranch(err ? null : stdout.trim() || null);
28049
+ });
28050
+ }
28051
+ poll();
28052
+ const timer = setInterval(poll, GIT_POLL_INTERVAL_MS);
28272
28053
  return () => {
28273
- cancelled = true;
28054
+ alive = false;
28055
+ clearInterval(timer);
28274
28056
  };
28275
28057
  }, [cwd]);
28276
- return { lines: line ? [line] : [] };
28058
+ if (!branch) return { lines: [] };
28059
+ const home = os5.homedir();
28060
+ const displayCwd = cwd.startsWith(home) ? `~${cwd.slice(home.length)}` : cwd;
28061
+ return { lines: [`${displayCwd} [${branch}]`] };
28277
28062
  }
28278
28063
  function useConfigInitMessage(_isConfigInitialized) {
28279
28064
  return null;
@@ -28293,7 +28078,7 @@ var VimModeProvider = ({
28293
28078
  setVimMode(next ? "NORMAL" : "INSERT");
28294
28079
  return next;
28295
28080
  }, [vimEnabled]);
28296
- return /* @__PURE__ */ jsx37(
28081
+ return /* @__PURE__ */ jsx41(
28297
28082
  VimModeContext.Provider,
28298
28083
  {
28299
28084
  value: { vimEnabled, vimMode, toggleVimEnabled, setVimMode },
@@ -28325,16 +28110,16 @@ var Footer = () => {
28325
28110
  const debugMode = config.getDebugMode();
28326
28111
  const contextWindowSize = config.getContentGeneratorConfig()?.contextWindowSize;
28327
28112
  const suppressHint = statusLineLines.length > 0;
28328
- const leftBottomContent = uiState.ctrlCPressedOnce ? /* @__PURE__ */ jsx38(Text37, { color: theme.status.warning, children: t("Press Ctrl+C again to exit.") }) : uiState.ctrlDPressedOnce ? /* @__PURE__ */ jsx38(Text37, { color: theme.status.warning, children: t("Press Ctrl+D again to exit.") }) : uiState.showEscapePrompt ? /* @__PURE__ */ jsx38(Text37, { color: theme.text.secondary, children: t("Press Esc again to clear.") }) : uiState.rewindEscPending ? /* @__PURE__ */ jsx38(Text37, { color: theme.text.secondary, children: t("Press Esc again to rewind conversation.") }) : vimEnabled && vimMode === "INSERT" ? /* @__PURE__ */ jsx38(Text37, { color: theme.text.secondary, children: "-- INSERT --" }) : uiState.shellModeActive ? /* @__PURE__ */ jsx38(ShellModeIndicator, {}) : configInitMessage ? /* @__PURE__ */ jsxs34(Text37, { color: theme.text.secondary, children: [
28329
- /* @__PURE__ */ jsx38(GeminiSpinner, {}),
28113
+ const leftBottomContent = uiState.ctrlCPressedOnce ? /* @__PURE__ */ jsx42(Text40, { color: theme.status.warning, children: t("Press Ctrl+C again to exit.") }) : uiState.ctrlDPressedOnce ? /* @__PURE__ */ jsx42(Text40, { color: theme.status.warning, children: t("Press Ctrl+D again to exit.") }) : uiState.showEscapePrompt ? /* @__PURE__ */ jsx42(Text40, { color: theme.text.secondary, children: t("Press Esc again to clear.") }) : uiState.rewindEscPending ? /* @__PURE__ */ jsx42(Text40, { color: theme.text.secondary, children: t("Press Esc again to rewind conversation.") }) : vimEnabled && vimMode === "INSERT" ? /* @__PURE__ */ jsx42(Text40, { color: theme.text.secondary, children: "-- INSERT --" }) : uiState.shellModeActive ? /* @__PURE__ */ jsx42(ShellModeIndicator, {}) : configInitMessage ? /* @__PURE__ */ jsxs36(Text40, { color: theme.text.secondary, children: [
28114
+ /* @__PURE__ */ jsx42(GeminiSpinner, {}),
28330
28115
  " ",
28331
28116
  configInitMessage
28332
- ] }) : showAutoAcceptIndicator !== void 0 && showAutoAcceptIndicator !== "default" ? /* @__PURE__ */ jsx38(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }) : suppressHint ? null : /* @__PURE__ */ jsx38(Text37, { color: theme.text.secondary, children: t("? for shortcuts") });
28117
+ ] }) : showAutoAcceptIndicator !== void 0 && showAutoAcceptIndicator !== "default" ? /* @__PURE__ */ jsx42(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }) : suppressHint ? null : /* @__PURE__ */ jsx42(Text40, { color: theme.text.secondary, children: t("? for shortcuts") });
28333
28118
  const rightItems = [];
28334
28119
  if (sandboxInfo) {
28335
28120
  rightItems.push({
28336
28121
  key: "sandbox",
28337
- node: /* @__PURE__ */ jsxs34(Text37, { color: theme.status.success, children: [
28122
+ node: /* @__PURE__ */ jsxs36(Text40, { color: theme.status.success, children: [
28338
28123
  "\u{1F512} ",
28339
28124
  sandboxInfo
28340
28125
  ] })
@@ -28343,13 +28128,13 @@ var Footer = () => {
28343
28128
  if (debugMode) {
28344
28129
  rightItems.push({
28345
28130
  key: "debug",
28346
- node: /* @__PURE__ */ jsx38(Text37, { color: theme.status.warning, children: "Debug Mode" })
28131
+ node: /* @__PURE__ */ jsx42(Text40, { color: theme.status.warning, children: "Debug Mode" })
28347
28132
  });
28348
28133
  }
28349
28134
  if (promptTokenCount > 0 && contextWindowSize) {
28350
28135
  rightItems.push({
28351
28136
  key: "context",
28352
- node: /* @__PURE__ */ jsx38(Text37, { color: theme.text.accent, children: /* @__PURE__ */ jsx38(
28137
+ node: /* @__PURE__ */ jsx42(Text40, { color: theme.text.accent, children: /* @__PURE__ */ jsx42(
28353
28138
  ContextUsageDisplay,
28354
28139
  {
28355
28140
  promptTokenCount,
@@ -28359,8 +28144,8 @@ var Footer = () => {
28359
28144
  ) })
28360
28145
  });
28361
28146
  }
28362
- return /* @__PURE__ */ jsxs34(
28363
- Box29,
28147
+ return /* @__PURE__ */ jsxs36(
28148
+ Box32,
28364
28149
  {
28365
28150
  flexDirection: isNarrow ? "column" : "row",
28366
28151
  justifyContent: isNarrow ? "flex-start" : "space-between",
@@ -28368,16 +28153,16 @@ var Footer = () => {
28368
28153
  paddingX: 2,
28369
28154
  gap: isNarrow ? 0 : 1,
28370
28155
  children: [
28371
- /* @__PURE__ */ jsxs34(Box29, { flexDirection: "column", flexShrink: isNarrow ? 0 : 1, children: [
28372
- statusLineLines.length > 0 && !uiState.ctrlCPressedOnce && !uiState.ctrlDPressedOnce && statusLineLines.map((line, i) => /* @__PURE__ */ jsx38(Text37, { dimColor: true, wrap: "truncate", children: line }, `status-line-${i}`)),
28373
- /* @__PURE__ */ jsxs34(Box29, { flexDirection: "row", flexShrink: 1, children: [
28374
- /* @__PURE__ */ jsx38(Text37, { wrap: "truncate", children: leftBottomContent }),
28375
- /* @__PURE__ */ jsx38(BackgroundTasksPill, {}),
28376
- /* @__PURE__ */ jsx38(MCPHealthPill, {})
28156
+ /* @__PURE__ */ jsxs36(Box32, { flexDirection: "column", flexShrink: isNarrow ? 0 : 1, children: [
28157
+ statusLineLines.length > 0 && !uiState.ctrlCPressedOnce && !uiState.ctrlDPressedOnce && statusLineLines.map((line, i) => /* @__PURE__ */ jsx42(Text40, { dimColor: true, wrap: "truncate", children: line }, `status-line-${i}`)),
28158
+ /* @__PURE__ */ jsxs36(Box32, { flexDirection: "row", flexShrink: 1, children: [
28159
+ /* @__PURE__ */ jsx42(Text40, { wrap: "truncate", children: leftBottomContent }),
28160
+ /* @__PURE__ */ jsx42(BackgroundTasksPill, {}),
28161
+ /* @__PURE__ */ jsx42(MCPHealthPill, {})
28377
28162
  ] })
28378
28163
  ] }),
28379
- /* @__PURE__ */ jsx38(Box29, { flexShrink: 0, gap: 1, alignItems: "flex-start", children: rightItems.map(({ key, node }, index) => /* @__PURE__ */ jsxs34(Box29, { alignItems: "center", children: [
28380
- index > 0 && /* @__PURE__ */ jsx38(Text37, { color: theme.text.secondary, children: " | " }),
28164
+ /* @__PURE__ */ jsx42(Box32, { flexShrink: 0, gap: 1, alignItems: "flex-start", children: rightItems.map(({ key, node }, index) => /* @__PURE__ */ jsxs36(Box32, { alignItems: "center", children: [
28165
+ index > 0 && /* @__PURE__ */ jsx42(Text40, { color: theme.text.secondary, children: " | " }),
28381
28166
  node
28382
28167
  ] }, key)) })
28383
28168
  ]
@@ -28400,17 +28185,17 @@ var QueuedMessageDisplay = ({
28400
28185
  wasEmptyRef.current = false;
28401
28186
  }
28402
28187
  const showHint = hintSeenCountRef.current <= NUM_TIMES_QUEUE_HINT_SHOWN;
28403
- return /* @__PURE__ */ jsxs35(Box30, { flexDirection: "column", marginTop: 1, children: [
28188
+ return /* @__PURE__ */ jsxs37(Box33, { flexDirection: "column", marginTop: 1, children: [
28404
28189
  messageQueue.slice(0, MAX_DISPLAYED_QUEUED_MESSAGES).map((message, index) => {
28405
28190
  const preview = message.replace(/\s+/g, " ");
28406
- return /* @__PURE__ */ jsx39(Box30, { paddingLeft: 2, width: "100%", children: /* @__PURE__ */ jsx39(Text38, { dimColor: true, wrap: "truncate", children: preview }) }, index);
28191
+ return /* @__PURE__ */ jsx43(Box33, { paddingLeft: 2, width: "100%", children: /* @__PURE__ */ jsx43(Text41, { dimColor: true, wrap: "truncate", children: preview }) }, index);
28407
28192
  }),
28408
- messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ jsx39(Box30, { paddingLeft: 2, children: /* @__PURE__ */ jsxs35(Text38, { dimColor: true, children: [
28193
+ messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ jsx43(Box33, { paddingLeft: 2, children: /* @__PURE__ */ jsxs37(Text41, { dimColor: true, children: [
28409
28194
  "... (+",
28410
28195
  messageQueue.length - MAX_DISPLAYED_QUEUED_MESSAGES,
28411
28196
  " more)"
28412
28197
  ] }) }),
28413
- showHint && /* @__PURE__ */ jsx39(Box30, { paddingLeft: 2, children: /* @__PURE__ */ jsx39(Text38, { dimColor: true, italic: true, children: t("Press \u2191 to edit queued messages") }) })
28198
+ showHint && /* @__PURE__ */ jsx43(Box33, { paddingLeft: 2, children: /* @__PURE__ */ jsx43(Text41, { dimColor: true, italic: true, children: t("Press \u2191 to edit queued messages") }) })
28414
28199
  ] });
28415
28200
  };
28416
28201
  var getNewlineKey = () => process.platform === "win32" ? "ctrl+enter" : "ctrl+j";
@@ -28438,8 +28223,8 @@ var getShortcuts = () => [
28438
28223
  { key: getExternalEditorKey(), description: t("for external editor") },
28439
28224
  { key: "ctrl+o", description: t("to toggle compact mode") }
28440
28225
  ];
28441
- var ShortcutItem = ({ shortcut }) => /* @__PURE__ */ jsxs36(Text39, { color: theme.text.secondary, children: [
28442
- /* @__PURE__ */ jsx40(Text39, { color: theme.text.accent, children: shortcut.key }),
28226
+ var ShortcutItem = ({ shortcut }) => /* @__PURE__ */ jsxs38(Text42, { color: theme.text.secondary, children: [
28227
+ /* @__PURE__ */ jsx44(Text42, { color: theme.text.accent, children: shortcut.key }),
28443
28228
  " ",
28444
28229
  shortcut.description
28445
28230
  ] });
@@ -28480,18 +28265,18 @@ var KeyboardShortcuts = () => {
28480
28265
  columns.push(shortcuts.slice(startIndex, startIndex + count));
28481
28266
  startIndex += count;
28482
28267
  }
28483
- return /* @__PURE__ */ jsx40(
28484
- Box31,
28268
+ return /* @__PURE__ */ jsx44(
28269
+ Box34,
28485
28270
  {
28486
28271
  flexDirection: "row",
28487
28272
  marginLeft: MARGIN_LEFT,
28488
28273
  marginRight: MARGIN_RIGHT,
28489
- children: columns.map((column, colIndex) => /* @__PURE__ */ jsx40(
28490
- Box31,
28274
+ children: columns.map((column, colIndex) => /* @__PURE__ */ jsx44(
28275
+ Box34,
28491
28276
  {
28492
28277
  flexDirection: "column",
28493
28278
  marginRight: colIndex < numColumns - 1 ? COLUMN_GAP : 0,
28494
- children: column.map((shortcut) => /* @__PURE__ */ jsx40(ShortcutItem, { shortcut }, shortcut.key))
28279
+ children: column.map((shortcut) => /* @__PURE__ */ jsx44(ShortcutItem, { shortcut }, shortcut.key))
28495
28280
  },
28496
28281
  colIndex
28497
28282
  ))
@@ -28535,8 +28320,8 @@ var Composer = () => {
28535
28320
  },
28536
28321
  [uiActions]
28537
28322
  );
28538
- return /* @__PURE__ */ jsxs37(Box32, { flexDirection: "column", marginTop: 1, children: [
28539
- !uiState.embeddedShellFocused && !suppressBottomLoadingIndicator && /* @__PURE__ */ jsx41(
28323
+ return /* @__PURE__ */ jsxs39(Box35, { flexDirection: "column", marginTop: 1, children: [
28324
+ !uiState.embeddedShellFocused && !suppressBottomLoadingIndicator && /* @__PURE__ */ jsx45(
28540
28325
  LoadingIndicator,
28541
28326
  {
28542
28327
  thought: uiState.streamingState === "waiting_for_confirmation" || config.getAccessibility()?.enableLoadingPhrases === false ? void 0 : uiState.thought,
@@ -28548,13 +28333,13 @@ var Composer = () => {
28548
28333
  isReceivingContent
28549
28334
  }
28550
28335
  ),
28551
- !uiState.embeddedShellFocused && suppressBottomLoadingIndicator && /* @__PURE__ */ jsx41(Box32, { paddingLeft: 2, children: /* @__PURE__ */ jsxs37(Text40, { color: theme.text.secondary, children: [
28336
+ !uiState.embeddedShellFocused && suppressBottomLoadingIndicator && /* @__PURE__ */ jsx45(Box35, { paddingLeft: 2, children: /* @__PURE__ */ jsxs39(Text43, { color: theme.text.secondary, children: [
28552
28337
  "(",
28553
28338
  t("Esc to cancel"),
28554
28339
  ")"
28555
28340
  ] }) }),
28556
- /* @__PURE__ */ jsx41(QueuedMessageDisplay, { messageQueue: uiState.messageQueue }),
28557
- uiState.isInputActive && /* @__PURE__ */ jsx41(
28341
+ /* @__PURE__ */ jsx45(QueuedMessageDisplay, { messageQueue: uiState.messageQueue }),
28342
+ uiState.isInputActive && /* @__PURE__ */ jsx45(
28558
28343
  InputPrompt,
28559
28344
  {
28560
28345
  buffer: uiState.buffer,
@@ -28582,9 +28367,118 @@ var Composer = () => {
28582
28367
  onPromptSuggestionDismiss: uiState.dismissPromptSuggestion
28583
28368
  }
28584
28369
  ),
28585
- uiState.isInputActive && !showSuggestions && (showShortcuts ? /* @__PURE__ */ jsx41(KeyboardShortcuts, {}) : !isScreenReaderEnabled && /* @__PURE__ */ jsx41(Footer, {}))
28370
+ uiState.isInputActive && !showSuggestions && (showShortcuts ? /* @__PURE__ */ jsx45(KeyboardShortcuts, {}) : !isScreenReaderEnabled && /* @__PURE__ */ jsx45(Footer, {}))
28586
28371
  ] });
28587
28372
  };
28373
+ var AppContext = createContext9(null);
28374
+ var Notifications = () => {
28375
+ const appCtx = useContext11(AppContext);
28376
+ const warnings = appCtx?.startupWarnings ?? [];
28377
+ if (warnings.length === 0) return null;
28378
+ return /* @__PURE__ */ jsx46(
28379
+ Box36,
28380
+ {
28381
+ flexDirection: "column",
28382
+ marginLeft: 2,
28383
+ marginRight: 2,
28384
+ marginBottom: 1,
28385
+ children: /* @__PURE__ */ jsx46(
28386
+ Box36,
28387
+ {
28388
+ borderStyle: "round",
28389
+ borderColor: theme.status.warning,
28390
+ paddingX: 1,
28391
+ flexDirection: "column",
28392
+ children: warnings.map((w, i) => /* @__PURE__ */ jsxs40(Text44, { color: theme.status.warning, children: [
28393
+ "\u26A0 ",
28394
+ w
28395
+ ] }, i))
28396
+ }
28397
+ )
28398
+ }
28399
+ );
28400
+ };
28401
+ function tildeify(p) {
28402
+ const home = os6.homedir();
28403
+ return p.startsWith(home) ? `~${p.slice(home.length)}` : p;
28404
+ }
28405
+ function statusLabel(state) {
28406
+ switch (state) {
28407
+ case "responding":
28408
+ return { text: "running", color: theme.status.success };
28409
+ case "waiting_for_confirmation":
28410
+ return { text: "awaiting approval", color: theme.status.warning };
28411
+ default:
28412
+ return { text: "idle", color: theme.text.secondary };
28413
+ }
28414
+ }
28415
+ function fmt(n) {
28416
+ if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
28417
+ if (n >= 1e3) return `${(n / 1e3).toFixed(1)}k`;
28418
+ return String(n);
28419
+ }
28420
+ var AppHeader = ({
28421
+ version,
28422
+ cwd,
28423
+ providerLabel,
28424
+ mode,
28425
+ iterationInfo
28426
+ }) => {
28427
+ const {
28428
+ streamingState,
28429
+ sessionStats: { lastPromptTokenCount, lastOutputTokenCount },
28430
+ terminalWidth
28431
+ } = useUIState();
28432
+ const status = statusLabel(streamingState);
28433
+ const displayDir = tildeify(cwd);
28434
+ const hasTokens = lastPromptTokenCount > 0;
28435
+ return /* @__PURE__ */ jsxs41(
28436
+ Box37,
28437
+ {
28438
+ flexDirection: "column",
28439
+ marginLeft: 2,
28440
+ marginRight: 2,
28441
+ marginTop: 1,
28442
+ marginBottom: 1,
28443
+ children: [
28444
+ /* @__PURE__ */ jsxs41(Box37, { flexDirection: "row", flexWrap: "nowrap", width: terminalWidth - 4, children: [
28445
+ /* @__PURE__ */ jsx47(Text45, { bold: true, color: theme.text.accent, children: "DeepCode" }),
28446
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.secondary, children: ` v${version}` }),
28447
+ providerLabel && /* @__PURE__ */ jsxs41(Fragment10, { children: [
28448
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.secondary, children: " " }),
28449
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.primary, children: providerLabel })
28450
+ ] }),
28451
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.secondary, children: " " }),
28452
+ /* @__PURE__ */ jsx47(
28453
+ Text45,
28454
+ {
28455
+ bold: true,
28456
+ color: mode === "build" ? theme.status.success : theme.status.warning,
28457
+ children: mode.toUpperCase()
28458
+ }
28459
+ ),
28460
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.secondary, children: " " }),
28461
+ /* @__PURE__ */ jsx47(Text45, { color: status.color, children: status.text }),
28462
+ iterationInfo && /* @__PURE__ */ jsxs41(Text45, { color: theme.text.secondary, children: [
28463
+ " ",
28464
+ "iter ",
28465
+ iterationInfo.round,
28466
+ "/",
28467
+ iterationInfo.max
28468
+ ] }),
28469
+ hasTokens && /* @__PURE__ */ jsxs41(Text45, { color: theme.text.secondary, children: [
28470
+ " ",
28471
+ "\u2191",
28472
+ fmt(lastPromptTokenCount),
28473
+ " \u2193",
28474
+ fmt(lastOutputTokenCount)
28475
+ ] })
28476
+ ] }),
28477
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.secondary, dimColor: true, children: displayDir })
28478
+ ]
28479
+ }
28480
+ );
28481
+ };
28588
28482
  async function diffAction(context) {
28589
28483
  const { config } = context.services;
28590
28484
  if (!config) {
@@ -28771,6 +28665,228 @@ var diffCommand = {
28771
28665
  supportedModes: ["interactive", "non_interactive", "acp"],
28772
28666
  action: diffAction
28773
28667
  };
28668
+ var EXPORT_FORMATS = ["markdown", "json"];
28669
+ function formatTimestamp(iso) {
28670
+ try {
28671
+ return new Date(iso).toLocaleString();
28672
+ } catch {
28673
+ return iso;
28674
+ }
28675
+ }
28676
+ function toMarkdown({ messages, cwd, model }) {
28677
+ const lines = [];
28678
+ const now = (/* @__PURE__ */ new Date()).toISOString();
28679
+ lines.push(`# DeepCode Session Export`);
28680
+ lines.push(``);
28681
+ lines.push(`**Exported:** ${formatTimestamp(now)}`);
28682
+ lines.push(`**Directory:** ${cwd}`);
28683
+ if (model) lines.push(`**Model:** ${model}`);
28684
+ lines.push(``);
28685
+ lines.push(`---`);
28686
+ lines.push(``);
28687
+ for (const msg of messages) {
28688
+ if (msg.source === "ui" || msg.source === "agent_internal") continue;
28689
+ if (msg.role === "system") {
28690
+ lines.push(`> *[system]*`);
28691
+ lines.push(``);
28692
+ continue;
28693
+ }
28694
+ if (msg.role === "user") {
28695
+ lines.push(`## User`);
28696
+ lines.push(``);
28697
+ lines.push(msg.content);
28698
+ lines.push(``);
28699
+ continue;
28700
+ }
28701
+ if (msg.role === "assistant") {
28702
+ lines.push(`## Assistant`);
28703
+ lines.push(``);
28704
+ if (msg.toolCalls && msg.toolCalls.length > 0) {
28705
+ for (const call of msg.toolCalls) {
28706
+ lines.push(`**Tool:** \`${call.name}\``);
28707
+ lines.push(``);
28708
+ try {
28709
+ lines.push("```json");
28710
+ lines.push(JSON.stringify(call.arguments, null, 2));
28711
+ lines.push("```");
28712
+ } catch {
28713
+ lines.push(String(call.arguments));
28714
+ }
28715
+ lines.push(``);
28716
+ }
28717
+ }
28718
+ if (msg.content) {
28719
+ lines.push(msg.content);
28720
+ lines.push(``);
28721
+ }
28722
+ continue;
28723
+ }
28724
+ if (msg.role === "tool") {
28725
+ lines.push(`*[tool result]*`);
28726
+ lines.push(``);
28727
+ const preview = msg.content.slice(0, 500);
28728
+ lines.push("```");
28729
+ lines.push(preview + (msg.content.length > 500 ? "\n\u2026" : ""));
28730
+ lines.push("```");
28731
+ lines.push(``);
28732
+ continue;
28733
+ }
28734
+ }
28735
+ return lines.join("\n");
28736
+ }
28737
+ function toJson({ messages, cwd, model }) {
28738
+ const exportable = messages.filter(
28739
+ (m) => m.source !== "ui" && m.source !== "agent_internal"
28740
+ );
28741
+ return JSON.stringify(
28742
+ {
28743
+ exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
28744
+ cwd,
28745
+ model,
28746
+ messages: exportable
28747
+ },
28748
+ null,
28749
+ 2
28750
+ );
28751
+ }
28752
+ function generateFilename(format, cwd) {
28753
+ const dirName = path142.basename(cwd);
28754
+ const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
28755
+ const ext = format === "markdown" ? "md" : "json";
28756
+ return `deepcode-${dirName}-${ts}.${ext}`;
28757
+ }
28758
+ async function exportSession(opts) {
28759
+ const content = opts.format === "markdown" ? toMarkdown(opts) : toJson(opts);
28760
+ const downloadsDir = path142.join(os7.homedir(), "Downloads");
28761
+ let outputDir = opts.cwd;
28762
+ try {
28763
+ await fs7.access(downloadsDir);
28764
+ outputDir = downloadsDir;
28765
+ } catch {
28766
+ }
28767
+ const filename = generateFilename(opts.format, opts.cwd);
28768
+ const outPath = path142.join(outputDir, filename);
28769
+ await fs7.writeFile(outPath, content, "utf8");
28770
+ return outPath;
28771
+ }
28772
+ var exportCommand = {
28773
+ name: "export",
28774
+ description: "Export session history to a file",
28775
+ kind: "built-in",
28776
+ supportedModes: ["interactive"],
28777
+ subCommands: EXPORT_FORMATS.map((fmt2) => ({
28778
+ name: fmt2,
28779
+ description: fmt2 === "markdown" ? "Markdown (.md)" : "JSON (.json)",
28780
+ kind: "built-in",
28781
+ supportedModes: ["interactive"],
28782
+ action: async () => ({
28783
+ type: "message",
28784
+ messageType: "info",
28785
+ content: `Use /export ${fmt2} from the top-level command.`
28786
+ })
28787
+ })),
28788
+ action: async (context, args) => {
28789
+ const fmt2 = args?.trim() ?? "markdown";
28790
+ if (!EXPORT_FORMATS.includes(fmt2)) {
28791
+ return {
28792
+ type: "message",
28793
+ messageType: "error",
28794
+ content: `Unknown format "${fmt2}". Available: ${EXPORT_FORMATS.join(", ")}`
28795
+ };
28796
+ }
28797
+ const messages = context.ui.getMessages?.() ?? [];
28798
+ const cwd = context.ui.getCwd?.() ?? process.cwd();
28799
+ const model = context.services.session?.getState().model;
28800
+ if (messages.length === 0) {
28801
+ return { type: "message", messageType: "info", content: "Nothing to export yet." };
28802
+ }
28803
+ try {
28804
+ const outPath = await exportSession({ messages, cwd, model, format: fmt2 });
28805
+ return { type: "message", messageType: "info", content: `Exported to: ${outPath}` };
28806
+ } catch (err) {
28807
+ const msg = err instanceof Error ? err.message : String(err);
28808
+ return { type: "message", messageType: "error", content: `Export failed: ${msg}` };
28809
+ }
28810
+ }
28811
+ };
28812
+ var CONTEXT_WINDOW_DEFAULT = 128e3;
28813
+ var AUTOCOMPACT_BUFFER_FRACTION = 0.2;
28814
+ function estimateTokens2(messages) {
28815
+ return Math.ceil(
28816
+ messages.reduce((sum, m) => {
28817
+ let chars = m.content.length;
28818
+ if (m.toolCalls) {
28819
+ chars += m.toolCalls.reduce(
28820
+ (s, tc) => s + tc.name.length + JSON.stringify(tc.arguments).length,
28821
+ 0
28822
+ );
28823
+ }
28824
+ return sum + chars;
28825
+ }, 0) / 4
28826
+ );
28827
+ }
28828
+ function buildContextUsageItem(messages, modelName, showDetails) {
28829
+ const contextWindowSize = CONTEXT_WINDOW_DEFAULT;
28830
+ const autocompactBuffer = Math.round(contextWindowSize * AUTOCOMPACT_BUFFER_FRACTION);
28831
+ const systemMsgs = messages.filter(
28832
+ (m) => m.role === "system" || m.source === "agent_internal"
28833
+ );
28834
+ const conversationMsgs = messages.filter(
28835
+ (m) => m.role !== "system" && m.source !== "agent_internal" && m.source !== "ui"
28836
+ );
28837
+ const systemTokens = estimateTokens2(systemMsgs);
28838
+ const conversationTokens = estimateTokens2(conversationMsgs);
28839
+ const totalTokens = systemTokens + conversationTokens;
28840
+ const freeSpace = Math.max(0, contextWindowSize - totalTokens - autocompactBuffer);
28841
+ const breakdown = {
28842
+ systemPrompt: systemTokens,
28843
+ builtinTools: 0,
28844
+ mcpTools: 0,
28845
+ memoryFiles: 0,
28846
+ skills: 0,
28847
+ messages: conversationTokens,
28848
+ freeSpace,
28849
+ autocompactBuffer
28850
+ };
28851
+ return {
28852
+ type: "context_usage",
28853
+ modelName: modelName || "(desconhecido)",
28854
+ totalTokens,
28855
+ contextWindowSize,
28856
+ breakdown,
28857
+ builtinTools: [],
28858
+ mcpTools: [],
28859
+ memoryFiles: [],
28860
+ skills: [],
28861
+ isEstimated: true,
28862
+ showDetails
28863
+ };
28864
+ }
28865
+ var contextCommand = {
28866
+ name: "context",
28867
+ description: "Exibe o uso estimado da janela de contexto",
28868
+ kind: "built-in",
28869
+ supportedModes: ["interactive"],
28870
+ subCommands: [
28871
+ {
28872
+ name: "detail",
28873
+ description: "Exibe o detalhamento por categoria",
28874
+ kind: "built-in",
28875
+ supportedModes: ["interactive"],
28876
+ action: async (context) => {
28877
+ const messages = context.ui.getMessages?.() ?? [];
28878
+ const model = context.services.session?.getState().model ?? "";
28879
+ context.ui.addItem(buildContextUsageItem(messages, model, true), Date.now());
28880
+ }
28881
+ }
28882
+ ],
28883
+ action: async (context, args) => {
28884
+ const showDetails = args?.trim() === "detail";
28885
+ const messages = context.ui.getMessages?.() ?? [];
28886
+ const model = context.services.session?.getState().model ?? "";
28887
+ context.ui.addItem(buildContextUsageItem(messages, model, showDetails), Date.now());
28888
+ }
28889
+ };
28774
28890
  var clearCommand = {
28775
28891
  name: "clear",
28776
28892
  get description() {
@@ -29056,10 +29172,10 @@ var CommandDialog = ({
29056
29172
  title,
29057
29173
  lines,
29058
29174
  footerText = "Press Esc or Enter to close."
29059
- }) => /* @__PURE__ */ jsx42(Box33, { marginLeft: 2, marginRight: 2, marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsxs38(Box33, { borderStyle: "round", borderColor: theme.border.default, padding: 1, flexDirection: "column", children: [
29060
- /* @__PURE__ */ jsx42(Text41, { bold: true, color: theme.text.accent, children: title }),
29061
- /* @__PURE__ */ jsx42(Box33, { marginTop: 1, flexDirection: "column", children: lines.map((line, index) => /* @__PURE__ */ jsx42(Text41, { color: theme.text.primary, children: line }, index)) }),
29062
- /* @__PURE__ */ jsx42(Box33, { marginTop: 1, children: /* @__PURE__ */ jsx42(Text41, { color: theme.text.secondary, children: footerText }) })
29175
+ }) => /* @__PURE__ */ jsx48(Box38, { marginLeft: 2, marginRight: 2, marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsxs42(Box38, { borderStyle: "round", borderColor: theme.border.default, padding: 1, flexDirection: "column", children: [
29176
+ /* @__PURE__ */ jsx48(Text46, { bold: true, color: theme.text.accent, children: title }),
29177
+ /* @__PURE__ */ jsx48(Box38, { marginTop: 1, flexDirection: "column", children: lines.map((line, index) => /* @__PURE__ */ jsx48(Text46, { color: theme.text.primary, children: line }, index)) }),
29178
+ /* @__PURE__ */ jsx48(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx48(Text46, { color: theme.text.secondary, children: footerText }) })
29063
29179
  ] }) });
29064
29180
  var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
29065
29181
  const originalTheme = useRef15(themeManager.getActiveTheme().name);
@@ -29096,8 +29212,8 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
29096
29212
  },
29097
29213
  [onPreview]
29098
29214
  );
29099
- return /* @__PURE__ */ jsxs39(
29100
- Box34,
29215
+ return /* @__PURE__ */ jsxs43(
29216
+ Box39,
29101
29217
  {
29102
29218
  flexDirection: "column",
29103
29219
  borderStyle: "round",
@@ -29106,8 +29222,8 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
29106
29222
  marginLeft: 2,
29107
29223
  marginRight: 2,
29108
29224
  children: [
29109
- /* @__PURE__ */ jsx43(Text42, { bold: true, color: theme.text.accent, children: "Select theme" }),
29110
- /* @__PURE__ */ jsx43(
29225
+ /* @__PURE__ */ jsx49(Text47, { bold: true, color: theme.text.accent, children: "Select theme" }),
29226
+ /* @__PURE__ */ jsx49(
29111
29227
  RadioButtonSelect,
29112
29228
  {
29113
29229
  items,
@@ -29117,7 +29233,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
29117
29233
  isFocused: true
29118
29234
  }
29119
29235
  ),
29120
- /* @__PURE__ */ jsx43(Text42, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter apply \xB7 Esc cancel" })
29236
+ /* @__PURE__ */ jsx49(Text47, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter apply \xB7 Esc cancel" })
29121
29237
  ]
29122
29238
  }
29123
29239
  );
@@ -29345,10 +29461,10 @@ var ProviderDialog = ({
29345
29461
  },
29346
29462
  { isActive: phase === "apiKey" }
29347
29463
  );
29348
- const statusColor3 = status ? status.ok ? status.text.startsWith("\u2713") ? theme.status.success : theme.text.secondary : theme.status.error : void 0;
29464
+ const statusColor2 = status ? status.ok ? status.text.startsWith("\u2713") ? theme.status.success : theme.text.secondary : theme.status.error : void 0;
29349
29465
  const footer = phase === "apiKey" ? "Enter save Ctrl+U clear Esc cancel" : phase === "providers" ? "\u2191\u2193 navigate Enter select Esc close" : "\u2191\u2193 navigate Enter confirm Esc back";
29350
- return /* @__PURE__ */ jsxs40(
29351
- Box35,
29466
+ return /* @__PURE__ */ jsxs44(
29467
+ Box40,
29352
29468
  {
29353
29469
  flexDirection: "column",
29354
29470
  borderStyle: "round",
@@ -29359,19 +29475,19 @@ var ProviderDialog = ({
29359
29475
  marginRight: 2,
29360
29476
  minWidth: 44,
29361
29477
  children: [
29362
- /* @__PURE__ */ jsxs40(Box35, { marginBottom: 1, gap: 1, children: [
29363
- /* @__PURE__ */ jsx44(Text43, { bold: true, color: theme.text.accent, children: "Providers" }),
29364
- phase !== "providers" && /* @__PURE__ */ jsxs40(Fragment9, { children: [
29365
- /* @__PURE__ */ jsx44(Text43, { color: theme.text.secondary, children: "\u203A" }),
29366
- /* @__PURE__ */ jsx44(Text43, { bold: true, color: theme.text.primary, children: selectedProvider })
29478
+ /* @__PURE__ */ jsxs44(Box40, { marginBottom: 1, gap: 1, children: [
29479
+ /* @__PURE__ */ jsx50(Text48, { bold: true, color: theme.text.accent, children: "Providers" }),
29480
+ phase !== "providers" && /* @__PURE__ */ jsxs44(Fragment11, { children: [
29481
+ /* @__PURE__ */ jsx50(Text48, { color: theme.text.secondary, children: "\u203A" }),
29482
+ /* @__PURE__ */ jsx50(Text48, { bold: true, color: theme.text.primary, children: selectedProvider })
29367
29483
  ] }),
29368
- phase === "providers" && currentModel && /* @__PURE__ */ jsxs40(Text43, { color: theme.text.secondary, children: [
29484
+ phase === "providers" && currentModel && /* @__PURE__ */ jsxs44(Text48, { color: theme.text.secondary, children: [
29369
29485
  " (",
29370
29486
  currentModel,
29371
29487
  ")"
29372
29488
  ] })
29373
29489
  ] }),
29374
- phase === "providers" && /* @__PURE__ */ jsx44(
29490
+ phase === "providers" && /* @__PURE__ */ jsx50(
29375
29491
  BaseSelectionList,
29376
29492
  {
29377
29493
  items: providerItems,
@@ -29381,25 +29497,25 @@ var ProviderDialog = ({
29381
29497
  maxItemsToShow: 8,
29382
29498
  renderItem: (item, { titleColor }) => {
29383
29499
  const { icon, color, label } = getStatusMark(item.provider, item.keyIsSet);
29384
- return /* @__PURE__ */ jsxs40(Box35, { gap: 1, children: [
29385
- /* @__PURE__ */ jsx44(Text43, { color, children: icon }),
29386
- /* @__PURE__ */ jsx44(Text43, { color: titleColor, bold: item.isCurrent, children: item.provider.padEnd(12) }),
29387
- /* @__PURE__ */ jsx44(Text43, { color, dimColor: !item.keyIsSet && !item.isLocal, children: label }),
29388
- item.isCurrent && /* @__PURE__ */ jsx44(Text43, { color: theme.text.accent, children: "\u25B6" })
29500
+ return /* @__PURE__ */ jsxs44(Box40, { gap: 1, children: [
29501
+ /* @__PURE__ */ jsx50(Text48, { color, children: icon }),
29502
+ /* @__PURE__ */ jsx50(Text48, { color: titleColor, bold: item.isCurrent, children: item.provider.padEnd(12) }),
29503
+ /* @__PURE__ */ jsx50(Text48, { color, dimColor: !item.keyIsSet && !item.isLocal, children: label }),
29504
+ item.isCurrent && /* @__PURE__ */ jsx50(Text48, { color: theme.text.accent, children: "\u25B6" })
29389
29505
  ] });
29390
29506
  }
29391
29507
  }
29392
29508
  ),
29393
- phase === "actions" && /* @__PURE__ */ jsxs40(Fragment9, { children: [
29394
- /* @__PURE__ */ jsxs40(Box35, { marginBottom: 1, gap: 1, children: [
29395
- /* @__PURE__ */ jsx44(Text43, { color: theme.ui.comment, children: "session" }),
29396
- /* @__PURE__ */ jsx44(Text43, { color: selectedProvider === currentProvider ? theme.text.accent : theme.text.secondary, children: selectedProvider === currentProvider ? "active" : `still using ${currentProvider}` })
29509
+ phase === "actions" && /* @__PURE__ */ jsxs44(Fragment11, { children: [
29510
+ /* @__PURE__ */ jsxs44(Box40, { marginBottom: 1, gap: 1, children: [
29511
+ /* @__PURE__ */ jsx50(Text48, { color: theme.ui.comment, children: "session" }),
29512
+ /* @__PURE__ */ jsx50(Text48, { color: selectedProvider === currentProvider ? theme.text.accent : theme.text.secondary, children: selectedProvider === currentProvider ? "active" : `still using ${currentProvider}` })
29397
29513
  ] }),
29398
- /* @__PURE__ */ jsxs40(Box35, { marginBottom: 1, gap: 1, children: [
29399
- /* @__PURE__ */ jsx44(Text43, { color: theme.ui.comment, children: "key" }),
29400
- isLocal ? /* @__PURE__ */ jsx44(Text43, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx44(Text43, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx44(Text43, { color: theme.ui.comment, dimColor: true, children: "not configured" })
29514
+ /* @__PURE__ */ jsxs44(Box40, { marginBottom: 1, gap: 1, children: [
29515
+ /* @__PURE__ */ jsx50(Text48, { color: theme.ui.comment, children: "key" }),
29516
+ isLocal ? /* @__PURE__ */ jsx50(Text48, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx50(Text48, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx50(Text48, { color: theme.ui.comment, dimColor: true, children: "not configured" })
29401
29517
  ] }),
29402
- /* @__PURE__ */ jsx44(
29518
+ /* @__PURE__ */ jsx50(
29403
29519
  BaseSelectionList,
29404
29520
  {
29405
29521
  items: actionItems,
@@ -29407,10 +29523,10 @@ var ProviderDialog = ({
29407
29523
  isFocused: !isBusy,
29408
29524
  showNumbers: false,
29409
29525
  maxItemsToShow: 6,
29410
- renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs40(Box35, { gap: 1, children: [
29411
- /* @__PURE__ */ jsx44(Text43, { color: titleColor, children: item.icon }),
29412
- /* @__PURE__ */ jsx44(Text43, { color: titleColor, children: item.label }),
29413
- item.hint && /* @__PURE__ */ jsxs40(Text43, { color: theme.ui.comment, dimColor: true, children: [
29526
+ renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs44(Box40, { gap: 1, children: [
29527
+ /* @__PURE__ */ jsx50(Text48, { color: titleColor, children: item.icon }),
29528
+ /* @__PURE__ */ jsx50(Text48, { color: titleColor, children: item.label }),
29529
+ item.hint && /* @__PURE__ */ jsxs44(Text48, { color: theme.ui.comment, dimColor: true, children: [
29414
29530
  "(",
29415
29531
  item.hint,
29416
29532
  ")"
@@ -29419,26 +29535,26 @@ var ProviderDialog = ({
29419
29535
  }
29420
29536
  )
29421
29537
  ] }),
29422
- phase === "apiKey" && /* @__PURE__ */ jsxs40(Box35, { flexDirection: "column", gap: 1, marginBottom: 1, children: [
29423
- /* @__PURE__ */ jsxs40(Box35, { gap: 1, children: [
29424
- /* @__PURE__ */ jsx44(Text43, { color: theme.ui.comment, children: "current" }),
29425
- isLocal ? /* @__PURE__ */ jsx44(Text43, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx44(Text43, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx44(Text43, { color: theme.ui.comment, dimColor: true, children: "not set" })
29538
+ phase === "apiKey" && /* @__PURE__ */ jsxs44(Box40, { flexDirection: "column", gap: 1, marginBottom: 1, children: [
29539
+ /* @__PURE__ */ jsxs44(Box40, { gap: 1, children: [
29540
+ /* @__PURE__ */ jsx50(Text48, { color: theme.ui.comment, children: "current" }),
29541
+ isLocal ? /* @__PURE__ */ jsx50(Text48, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx50(Text48, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx50(Text48, { color: theme.ui.comment, dimColor: true, children: "not set" })
29426
29542
  ] }),
29427
- /* @__PURE__ */ jsxs40(Box35, { gap: 1, children: [
29428
- /* @__PURE__ */ jsx44(Text43, { color: theme.ui.comment, children: "new key" }),
29429
- /* @__PURE__ */ jsx44(Box35, { borderStyle: "single", borderColor: theme.border.focused, paddingX: 1, children: /* @__PURE__ */ jsx44(Text43, { color: theme.text.accent, children: apiKeyInput.length > 0 ? maskApiKeyInput(apiKeyInput.length) : /* @__PURE__ */ jsx44(Text43, { color: theme.ui.comment, dimColor: true, children: "paste or type\u2026" }) }) })
29543
+ /* @__PURE__ */ jsxs44(Box40, { gap: 1, children: [
29544
+ /* @__PURE__ */ jsx50(Text48, { color: theme.ui.comment, children: "new key" }),
29545
+ /* @__PURE__ */ jsx50(Box40, { borderStyle: "single", borderColor: theme.border.focused, paddingX: 1, children: /* @__PURE__ */ jsx50(Text48, { color: theme.text.accent, children: apiKeyInput.length > 0 ? maskApiKeyInput(apiKeyInput.length) : /* @__PURE__ */ jsx50(Text48, { color: theme.ui.comment, dimColor: true, children: "paste or type\u2026" }) }) })
29430
29546
  ] })
29431
29547
  ] }),
29432
- status && /* @__PURE__ */ jsx44(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx44(Text43, { color: statusColor3, children: status.text }) }),
29433
- phase === "actions" && testLatencyMs !== void 0 && /* @__PURE__ */ jsxs40(Box35, { marginTop: 0, gap: 1, children: [
29434
- /* @__PURE__ */ jsxs40(Text43, { color: getLatencyColor(testLatencyMs), bold: true, children: [
29548
+ status && /* @__PURE__ */ jsx50(Box40, { marginTop: 1, children: /* @__PURE__ */ jsx50(Text48, { color: statusColor2, children: status.text }) }),
29549
+ phase === "actions" && testLatencyMs !== void 0 && /* @__PURE__ */ jsxs44(Box40, { marginTop: 0, gap: 1, children: [
29550
+ /* @__PURE__ */ jsxs44(Text48, { color: getLatencyColor(testLatencyMs), bold: true, children: [
29435
29551
  testLatencyMs,
29436
29552
  "ms"
29437
29553
  ] }),
29438
- /* @__PURE__ */ jsx44(Text43, { color: theme.text.secondary, children: testLatencyMs < 300 ? "excellent" : testLatencyMs < 800 ? "good" : "slow" })
29554
+ /* @__PURE__ */ jsx50(Text48, { color: theme.text.secondary, children: testLatencyMs < 300 ? "excellent" : testLatencyMs < 800 ? "good" : "slow" })
29439
29555
  ] }),
29440
- /* @__PURE__ */ jsx44(
29441
- Box35,
29556
+ /* @__PURE__ */ jsx50(
29557
+ Box40,
29442
29558
  {
29443
29559
  marginTop: 1,
29444
29560
  borderStyle: "single",
@@ -29447,7 +29563,7 @@ var ProviderDialog = ({
29447
29563
  borderLeft: false,
29448
29564
  borderRight: false,
29449
29565
  borderColor: theme.ui.comment,
29450
- children: /* @__PURE__ */ jsxs40(Text43, { color: theme.ui.comment, dimColor: true, children: [
29566
+ children: /* @__PURE__ */ jsxs44(Text48, { color: theme.ui.comment, dimColor: true, children: [
29451
29567
  footer,
29452
29568
  phase === "actions" && " Test does not change the session."
29453
29569
  ] })
@@ -29515,8 +29631,8 @@ var PermissionsDialog = ({
29515
29631
  [onClose]
29516
29632
  );
29517
29633
  useKeypress(handleEscape, { isActive: true });
29518
- return /* @__PURE__ */ jsxs41(
29519
- Box36,
29634
+ return /* @__PURE__ */ jsxs45(
29635
+ Box41,
29520
29636
  {
29521
29637
  flexDirection: "column",
29522
29638
  borderStyle: "round",
@@ -29525,9 +29641,9 @@ var PermissionsDialog = ({
29525
29641
  marginLeft: 2,
29526
29642
  marginRight: 2,
29527
29643
  children: [
29528
- /* @__PURE__ */ jsx45(Text44, { bold: true, color: theme.text.accent, children: "Permission policy" }),
29529
- /* @__PURE__ */ jsx45(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
29530
- /* @__PURE__ */ jsx45(Text44, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter cycles allow/ask/deny \xB7 Esc cancel" })
29644
+ /* @__PURE__ */ jsx51(Text49, { bold: true, color: theme.text.accent, children: "Permission policy" }),
29645
+ /* @__PURE__ */ jsx51(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
29646
+ /* @__PURE__ */ jsx51(Text49, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter cycles allow/ask/deny \xB7 Esc cancel" })
29531
29647
  ]
29532
29648
  }
29533
29649
  );
@@ -29635,8 +29751,8 @@ var AuthDialog = ({
29635
29751
  [onClose, phase]
29636
29752
  );
29637
29753
  useKeypress(handleEscape, { isActive: true });
29638
- return /* @__PURE__ */ jsxs42(
29639
- Box37,
29754
+ return /* @__PURE__ */ jsxs46(
29755
+ Box42,
29640
29756
  {
29641
29757
  flexDirection: "column",
29642
29758
  borderStyle: "round",
@@ -29645,32 +29761,32 @@ var AuthDialog = ({
29645
29761
  marginLeft: 2,
29646
29762
  marginRight: 2,
29647
29763
  children: [
29648
- /* @__PURE__ */ jsx46(Text45, { bold: true, color: theme.text.accent, children: "GitHub authentication" }),
29649
- /* @__PURE__ */ jsx46(Text45, { color: theme.text.secondary, children: statusSummary }),
29650
- phase === "menu" && /* @__PURE__ */ jsx46(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
29651
- deviceCode && phase === "running" && /* @__PURE__ */ jsxs42(Box37, { flexDirection: "column", marginTop: 1, children: [
29652
- /* @__PURE__ */ jsxs42(Text45, { children: [
29764
+ /* @__PURE__ */ jsx52(Text50, { bold: true, color: theme.text.accent, children: "GitHub authentication" }),
29765
+ /* @__PURE__ */ jsx52(Text50, { color: theme.text.secondary, children: statusSummary }),
29766
+ phase === "menu" && /* @__PURE__ */ jsx52(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
29767
+ deviceCode && phase === "running" && /* @__PURE__ */ jsxs46(Box42, { flexDirection: "column", marginTop: 1, children: [
29768
+ /* @__PURE__ */ jsxs46(Text50, { children: [
29653
29769
  "Open: ",
29654
- /* @__PURE__ */ jsx46(Text45, { color: theme.text.accent, children: deviceCode.verificationUri })
29770
+ /* @__PURE__ */ jsx52(Text50, { color: theme.text.accent, children: deviceCode.verificationUri })
29655
29771
  ] }),
29656
- /* @__PURE__ */ jsxs42(Text45, { children: [
29772
+ /* @__PURE__ */ jsxs46(Text50, { children: [
29657
29773
  "Code: ",
29658
- /* @__PURE__ */ jsx46(Text45, { bold: true, color: theme.text.accent, children: deviceCode.userCode })
29774
+ /* @__PURE__ */ jsx52(Text50, { bold: true, color: theme.text.accent, children: deviceCode.userCode })
29659
29775
  ] }),
29660
- /* @__PURE__ */ jsxs42(Text45, { color: theme.text.secondary, children: [
29776
+ /* @__PURE__ */ jsxs46(Text50, { color: theme.text.secondary, children: [
29661
29777
  "Expires in ",
29662
29778
  Math.round(deviceCode.expiresIn / 60),
29663
29779
  " minutes."
29664
29780
  ] })
29665
29781
  ] }),
29666
- message && /* @__PURE__ */ jsx46(
29667
- Text45,
29782
+ message && /* @__PURE__ */ jsx52(
29783
+ Text50,
29668
29784
  {
29669
29785
  color: phase === "error" ? theme.status.error : phase === "done" ? theme.status.success : theme.text.secondary,
29670
29786
  children: message
29671
29787
  }
29672
29788
  ),
29673
- /* @__PURE__ */ jsx46(Text45, { color: theme.text.secondary, children: phase === "running" ? "Esc cancel login" : phase === "menu" ? "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc close" : "Esc close" })
29789
+ /* @__PURE__ */ jsx52(Text50, { color: theme.text.secondary, children: phase === "running" ? "Esc cancel login" : phase === "menu" ? "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc close" : "Esc close" })
29674
29790
  ]
29675
29791
  }
29676
29792
  );
@@ -29797,8 +29913,8 @@ var ModelDialog = ({
29797
29913
  }, { isActive: true });
29798
29914
  const canScrollUp = scrollTop > 0;
29799
29915
  const canScrollDown = scrollTop + MAX_VISIBLE < rows.length;
29800
- return /* @__PURE__ */ jsxs43(
29801
- Box38,
29916
+ return /* @__PURE__ */ jsxs47(
29917
+ Box43,
29802
29918
  {
29803
29919
  flexDirection: "column",
29804
29920
  borderStyle: "round",
@@ -29809,80 +29925,80 @@ var ModelDialog = ({
29809
29925
  marginRight: 1,
29810
29926
  minWidth: 58,
29811
29927
  children: [
29812
- /* @__PURE__ */ jsxs43(Box38, { justifyContent: "space-between", marginBottom: 1, children: [
29813
- /* @__PURE__ */ jsxs43(Box38, { gap: 1, children: [
29814
- /* @__PURE__ */ jsx47(Text46, { bold: true, color: theme.text.primary, children: "Select model" }),
29815
- /* @__PURE__ */ jsx47(Text46, { color: theme.text.secondary, children: "for" }),
29816
- /* @__PURE__ */ jsx47(Text46, { color: theme.text.accent, children: currentProvider })
29928
+ /* @__PURE__ */ jsxs47(Box43, { justifyContent: "space-between", marginBottom: 1, children: [
29929
+ /* @__PURE__ */ jsxs47(Box43, { gap: 1, children: [
29930
+ /* @__PURE__ */ jsx53(Text51, { bold: true, color: theme.text.primary, children: "Select model" }),
29931
+ /* @__PURE__ */ jsx53(Text51, { color: theme.text.secondary, children: "for" }),
29932
+ /* @__PURE__ */ jsx53(Text51, { color: theme.text.accent, children: currentProvider })
29817
29933
  ] }),
29818
- /* @__PURE__ */ jsx47(Text46, { color: theme.ui.comment, dimColor: true, children: "esc" })
29934
+ /* @__PURE__ */ jsx53(Text51, { color: theme.ui.comment, dimColor: true, children: "esc" })
29819
29935
  ] }),
29820
- /* @__PURE__ */ jsxs43(
29821
- Box38,
29936
+ /* @__PURE__ */ jsxs47(
29937
+ Box43,
29822
29938
  {
29823
29939
  borderStyle: "single",
29824
29940
  borderColor: search ? theme.border.focused : theme.ui.comment,
29825
29941
  paddingX: 1,
29826
29942
  marginBottom: 1,
29827
29943
  children: [
29828
- /* @__PURE__ */ jsx47(Text46, { color: theme.ui.comment, children: "\u2315 " }),
29829
- search ? /* @__PURE__ */ jsxs43(Text46, { color: theme.text.primary, children: [
29944
+ /* @__PURE__ */ jsx53(Text51, { color: theme.ui.comment, children: "\u2315 " }),
29945
+ search ? /* @__PURE__ */ jsxs47(Text51, { color: theme.text.primary, children: [
29830
29946
  search,
29831
- /* @__PURE__ */ jsx47(Text46, { color: theme.text.accent, children: "\u258C" })
29832
- ] }) : /* @__PURE__ */ jsxs43(Text46, { color: theme.ui.comment, dimColor: true, children: [
29947
+ /* @__PURE__ */ jsx53(Text51, { color: theme.text.accent, children: "\u258C" })
29948
+ ] }) : /* @__PURE__ */ jsxs47(Text51, { color: theme.ui.comment, dimColor: true, children: [
29833
29949
  "Search",
29834
- /* @__PURE__ */ jsx47(Text46, { color: theme.text.accent, children: "\u258C" })
29950
+ /* @__PURE__ */ jsx53(Text51, { color: theme.text.accent, children: "\u258C" })
29835
29951
  ] })
29836
29952
  ]
29837
29953
  }
29838
29954
  ),
29839
- loadState === "loading" && /* @__PURE__ */ jsx47(Box38, { marginY: 1, children: /* @__PURE__ */ jsx47(Text46, { color: theme.text.secondary, children: "Loading models\u2026" }) }),
29840
- loadState === "error" && /* @__PURE__ */ jsxs43(Box38, { flexDirection: "column", marginY: 1, children: [
29841
- /* @__PURE__ */ jsx47(Text46, { color: theme.status.error, children: "\u2717 Could not load models" }),
29842
- /* @__PURE__ */ jsx47(Text46, { color: theme.ui.comment, dimColor: true, children: errorMsg })
29955
+ loadState === "loading" && /* @__PURE__ */ jsx53(Box43, { marginY: 1, children: /* @__PURE__ */ jsx53(Text51, { color: theme.text.secondary, children: "Loading models\u2026" }) }),
29956
+ loadState === "error" && /* @__PURE__ */ jsxs47(Box43, { flexDirection: "column", marginY: 1, children: [
29957
+ /* @__PURE__ */ jsx53(Text51, { color: theme.status.error, children: "\u2717 Could not load models" }),
29958
+ /* @__PURE__ */ jsx53(Text51, { color: theme.ui.comment, dimColor: true, children: errorMsg })
29843
29959
  ] }),
29844
- loadState === "ready" && selectableCount === 0 && /* @__PURE__ */ jsx47(Box38, { marginY: 1, children: /* @__PURE__ */ jsxs43(Text46, { color: theme.ui.comment, dimColor: true, children: [
29960
+ loadState === "ready" && selectableCount === 0 && /* @__PURE__ */ jsx53(Box43, { marginY: 1, children: /* @__PURE__ */ jsxs47(Text51, { color: theme.ui.comment, dimColor: true, children: [
29845
29961
  'No models match "',
29846
29962
  search,
29847
29963
  '"'
29848
29964
  ] }) }),
29849
- loadState === "ready" && selectableCount > 0 && /* @__PURE__ */ jsxs43(Box38, { flexDirection: "column", children: [
29850
- canScrollUp && /* @__PURE__ */ jsx47(Text46, { color: theme.ui.comment, dimColor: true, children: " \u2191" }),
29965
+ loadState === "ready" && selectableCount > 0 && /* @__PURE__ */ jsxs47(Box43, { flexDirection: "column", children: [
29966
+ canScrollUp && /* @__PURE__ */ jsx53(Text51, { color: theme.ui.comment, dimColor: true, children: " \u2191" }),
29851
29967
  visibleRows.map((row, i) => {
29852
29968
  if (row.kind === "header") {
29853
- return /* @__PURE__ */ jsx47(Box38, { marginTop: i === 0 ? 0 : 1, children: /* @__PURE__ */ jsx47(Text46, { color: theme.text.accent, bold: true, children: row.label }) }, `h${i}`);
29969
+ return /* @__PURE__ */ jsx53(Box43, { marginTop: i === 0 ? 0 : 1, children: /* @__PURE__ */ jsx53(Text51, { color: theme.text.accent, bold: true, children: row.label }) }, `h${i}`);
29854
29970
  }
29855
29971
  const { model, selIndex } = row;
29856
29972
  const isActive = selIndex === clampedIndex;
29857
29973
  const isCurrent = model.id === currentModel;
29858
29974
  const free = isFree(model);
29859
29975
  const group = providerGroup(model);
29860
- return /* @__PURE__ */ jsxs43(Box38, { gap: 1, children: [
29861
- /* @__PURE__ */ jsx47(Text46, { color: isActive ? theme.text.accent : theme.ui.comment, children: isCurrent ? "\u25CF" : isActive ? "\u203A" : " " }),
29862
- /* @__PURE__ */ jsxs43(Box38, { flexGrow: 1, gap: 1, children: [
29863
- /* @__PURE__ */ jsx47(
29864
- Text46,
29976
+ return /* @__PURE__ */ jsxs47(Box43, { gap: 1, children: [
29977
+ /* @__PURE__ */ jsx53(Text51, { color: isActive ? theme.text.accent : theme.ui.comment, children: isCurrent ? "\u25CF" : isActive ? "\u203A" : " " }),
29978
+ /* @__PURE__ */ jsxs47(Box43, { flexGrow: 1, gap: 1, children: [
29979
+ /* @__PURE__ */ jsx53(
29980
+ Text51,
29865
29981
  {
29866
29982
  color: isActive ? theme.text.primary : theme.text.secondary,
29867
29983
  bold: isActive,
29868
29984
  children: model.name
29869
29985
  }
29870
29986
  ),
29871
- /* @__PURE__ */ jsx47(Text46, { color: theme.text.accent, dimColor: true, children: group })
29987
+ /* @__PURE__ */ jsx53(Text51, { color: theme.text.accent, dimColor: true, children: group })
29872
29988
  ] }),
29873
- free && /* @__PURE__ */ jsx47(Text46, { color: theme.status.success, dimColor: !isActive, children: "Free" })
29989
+ free && /* @__PURE__ */ jsx53(Text51, { color: theme.status.success, dimColor: !isActive, children: "Free" })
29874
29990
  ] }, model.id);
29875
29991
  }),
29876
- canScrollDown && /* @__PURE__ */ jsx47(Text46, { color: theme.ui.comment, dimColor: true, children: " \u2193" })
29992
+ canScrollDown && /* @__PURE__ */ jsx53(Text51, { color: theme.ui.comment, dimColor: true, children: " \u2193" })
29877
29993
  ] }),
29878
- loadState === "ready" && /* @__PURE__ */ jsx47(Box38, { marginTop: 1, children: /* @__PURE__ */ jsxs43(Text46, { color: theme.ui.comment, dimColor: true, children: [
29994
+ loadState === "ready" && /* @__PURE__ */ jsx53(Box43, { marginTop: 1, children: /* @__PURE__ */ jsxs47(Text51, { color: theme.ui.comment, dimColor: true, children: [
29879
29995
  selectableCount,
29880
29996
  " model",
29881
29997
  selectableCount !== 1 ? "s" : "",
29882
29998
  search ? ` \xB7 "${search}"` : ""
29883
29999
  ] }) }),
29884
- /* @__PURE__ */ jsx47(
29885
- Box38,
30000
+ /* @__PURE__ */ jsx53(
30001
+ Box43,
29886
30002
  {
29887
30003
  marginTop: 1,
29888
30004
  borderStyle: "single",
@@ -29891,7 +30007,7 @@ var ModelDialog = ({
29891
30007
  borderLeft: false,
29892
30008
  borderRight: false,
29893
30009
  borderColor: theme.ui.comment,
29894
- children: /* @__PURE__ */ jsx47(Text46, { color: theme.ui.comment, dimColor: true, children: "\u2191\u2193 navigate type to search Enter use for session Esc close" })
30010
+ children: /* @__PURE__ */ jsx53(Text51, { color: theme.ui.comment, dimColor: true, children: "\u2191\u2193 navigate type to search Enter use for session Esc close" })
29895
30011
  }
29896
30012
  )
29897
30013
  ]
@@ -29907,11 +30023,11 @@ var RATINGS = [
29907
30023
  ];
29908
30024
  var CANCEL_VALUE2 = "__cancel__";
29909
30025
  function appendFeedbackEntry(cwd, rating, label) {
29910
- const file = path142.join(cwd, ".deepcode", "feedback.log");
30026
+ const file = path15.join(cwd, ".deepcode", "feedback.log");
29911
30027
  const entry = JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), rating, label });
29912
30028
  try {
29913
- fs7.mkdirSync(path142.dirname(file), { recursive: true });
29914
- fs7.appendFileSync(file, `${entry}
30029
+ fs8.mkdirSync(path15.dirname(file), { recursive: true });
30030
+ fs8.appendFileSync(file, `${entry}
29915
30031
  `, "utf8");
29916
30032
  } catch {
29917
30033
  }
@@ -29945,8 +30061,8 @@ var FeedbackDialog = ({ cwd, onClose }) => {
29945
30061
  [onClose]
29946
30062
  );
29947
30063
  useKeypress(handleEscape, { isActive: true });
29948
- return /* @__PURE__ */ jsxs44(
29949
- Box39,
30064
+ return /* @__PURE__ */ jsxs48(
30065
+ Box44,
29950
30066
  {
29951
30067
  flexDirection: "column",
29952
30068
  borderStyle: "round",
@@ -29955,9 +30071,9 @@ var FeedbackDialog = ({ cwd, onClose }) => {
29955
30071
  marginLeft: 2,
29956
30072
  marginRight: 2,
29957
30073
  children: [
29958
- /* @__PURE__ */ jsx48(Text47, { bold: true, color: theme.text.accent, children: "How useful was DeepCode in this session?" }),
29959
- /* @__PURE__ */ jsx48(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
29960
- /* @__PURE__ */ jsx48(Text47, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter submit \xB7 Esc cancel" })
30074
+ /* @__PURE__ */ jsx54(Text52, { bold: true, color: theme.text.accent, children: "How useful was DeepCode in this session?" }),
30075
+ /* @__PURE__ */ jsx54(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
30076
+ /* @__PURE__ */ jsx54(Text52, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter submit \xB7 Esc cancel" })
29961
30077
  ]
29962
30078
  }
29963
30079
  );
@@ -30038,8 +30154,8 @@ var SessionsDialog = ({ cwd, onSelect, onClose }) => {
30038
30154
  }, { isActive: true });
30039
30155
  const canScrollUp = scrollTop > 0;
30040
30156
  const canScrollDown = scrollTop + MAX_VISIBLE2 < sessions.length;
30041
- return /* @__PURE__ */ jsxs45(
30042
- Box40,
30157
+ return /* @__PURE__ */ jsxs49(
30158
+ Box45,
30043
30159
  {
30044
30160
  flexDirection: "column",
30045
30161
  borderStyle: "round",
@@ -30050,34 +30166,34 @@ var SessionsDialog = ({ cwd, onSelect, onClose }) => {
30050
30166
  marginRight: 1,
30051
30167
  minWidth: 60,
30052
30168
  children: [
30053
- /* @__PURE__ */ jsxs45(Box40, { justifyContent: "space-between", marginBottom: 1, children: [
30054
- /* @__PURE__ */ jsx49(Text48, { bold: true, color: theme.text.primary, children: "Resume session" }),
30055
- /* @__PURE__ */ jsx49(Text48, { color: theme.ui.comment, dimColor: true, children: "esc" })
30169
+ /* @__PURE__ */ jsxs49(Box45, { justifyContent: "space-between", marginBottom: 1, children: [
30170
+ /* @__PURE__ */ jsx55(Text53, { bold: true, color: theme.text.primary, children: "Resume session" }),
30171
+ /* @__PURE__ */ jsx55(Text53, { color: theme.ui.comment, dimColor: true, children: "esc" })
30056
30172
  ] }),
30057
- /* @__PURE__ */ jsxs45(
30058
- Box40,
30173
+ /* @__PURE__ */ jsxs49(
30174
+ Box45,
30059
30175
  {
30060
30176
  borderStyle: "single",
30061
30177
  borderColor: search ? theme.border.focused : theme.ui.comment,
30062
30178
  paddingX: 1,
30063
30179
  marginBottom: 1,
30064
30180
  children: [
30065
- /* @__PURE__ */ jsx49(Text48, { color: theme.ui.comment, children: "\u2315 " }),
30066
- search ? /* @__PURE__ */ jsxs45(Text48, { color: theme.text.primary, children: [
30181
+ /* @__PURE__ */ jsx55(Text53, { color: theme.ui.comment, children: "\u2315 " }),
30182
+ search ? /* @__PURE__ */ jsxs49(Text53, { color: theme.text.primary, children: [
30067
30183
  search,
30068
- /* @__PURE__ */ jsx49(Text48, { color: theme.text.accent, children: "\u258C" })
30069
- ] }) : /* @__PURE__ */ jsxs45(Text48, { color: theme.ui.comment, dimColor: true, children: [
30184
+ /* @__PURE__ */ jsx55(Text53, { color: theme.text.accent, children: "\u258C" })
30185
+ ] }) : /* @__PURE__ */ jsxs49(Text53, { color: theme.ui.comment, dimColor: true, children: [
30070
30186
  "Search",
30071
- /* @__PURE__ */ jsx49(Text48, { color: theme.text.accent, children: "\u258C" })
30187
+ /* @__PURE__ */ jsx55(Text53, { color: theme.text.accent, children: "\u258C" })
30072
30188
  ] })
30073
30189
  ]
30074
30190
  }
30075
30191
  ),
30076
- loadState === "loading" && /* @__PURE__ */ jsx49(Box40, { marginY: 1, children: /* @__PURE__ */ jsx49(Text48, { color: theme.text.secondary, children: "Loading sessions\u2026" }) }),
30077
- loadState === "error" && /* @__PURE__ */ jsx49(Box40, { marginY: 1, children: /* @__PURE__ */ jsx49(Text48, { color: theme.status.error, children: "\u2717 Could not load sessions" }) }),
30078
- loadState === "ready" && sessions.length === 0 && /* @__PURE__ */ jsx49(Box40, { marginY: 1, children: /* @__PURE__ */ jsx49(Text48, { color: theme.ui.comment, dimColor: true, children: search ? `No sessions match "${search}"` : "No sessions found in .deepcode/sessions/" }) }),
30079
- loadState === "ready" && sessions.length > 0 && /* @__PURE__ */ jsxs45(Box40, { flexDirection: "column", children: [
30080
- canScrollUp && /* @__PURE__ */ jsx49(Text48, { color: theme.ui.comment, dimColor: true, children: " \u2191" }),
30192
+ loadState === "loading" && /* @__PURE__ */ jsx55(Box45, { marginY: 1, children: /* @__PURE__ */ jsx55(Text53, { color: theme.text.secondary, children: "Loading sessions\u2026" }) }),
30193
+ loadState === "error" && /* @__PURE__ */ jsx55(Box45, { marginY: 1, children: /* @__PURE__ */ jsx55(Text53, { color: theme.status.error, children: "\u2717 Could not load sessions" }) }),
30194
+ loadState === "ready" && sessions.length === 0 && /* @__PURE__ */ jsx55(Box45, { marginY: 1, children: /* @__PURE__ */ jsx55(Text53, { color: theme.ui.comment, dimColor: true, children: search ? `No sessions match "${search}"` : "No sessions found in .deepcode/sessions/" }) }),
30195
+ loadState === "ready" && sessions.length > 0 && /* @__PURE__ */ jsxs49(Box45, { flexDirection: "column", children: [
30196
+ canScrollUp && /* @__PURE__ */ jsx55(Text53, { color: theme.ui.comment, dimColor: true, children: " \u2191" }),
30081
30197
  visibleSessions.map((session, visIdx) => {
30082
30198
  const globalIdx = scrollTop + visIdx;
30083
30199
  const isActive = globalIdx === clampedIndex;
@@ -30086,11 +30202,11 @@ var SessionsDialog = ({ cwd, onSelect, onClose }) => {
30086
30202
  const target = session.model ? `${session.provider}/${session.model}` : session.provider;
30087
30203
  const msgCount = session.messages.length;
30088
30204
  const preview = sessionLabel2(session);
30089
- return /* @__PURE__ */ jsxs45(Box40, { flexDirection: "column", children: [
30090
- /* @__PURE__ */ jsxs45(Box40, { gap: 1, children: [
30091
- /* @__PURE__ */ jsx49(Text48, { color: isActive ? theme.text.accent : theme.ui.comment, children: isActive ? "\u203A" : " " }),
30092
- /* @__PURE__ */ jsx49(
30093
- Text48,
30205
+ return /* @__PURE__ */ jsxs49(Box45, { flexDirection: "column", children: [
30206
+ /* @__PURE__ */ jsxs49(Box45, { gap: 1, children: [
30207
+ /* @__PURE__ */ jsx55(Text53, { color: isActive ? theme.text.accent : theme.ui.comment, children: isActive ? "\u203A" : " " }),
30208
+ /* @__PURE__ */ jsx55(
30209
+ Text53,
30094
30210
  {
30095
30211
  color: isActive ? theme.text.primary : theme.text.secondary,
30096
30212
  bold: isActive,
@@ -30099,7 +30215,7 @@ var SessionsDialog = ({ cwd, onSelect, onClose }) => {
30099
30215
  }
30100
30216
  )
30101
30217
  ] }),
30102
- isActive && /* @__PURE__ */ jsx49(Box40, { paddingLeft: 2, children: /* @__PURE__ */ jsxs45(Text48, { color: theme.ui.comment, dimColor: true, children: [
30218
+ isActive && /* @__PURE__ */ jsx55(Box45, { paddingLeft: 2, children: /* @__PURE__ */ jsxs49(Text53, { color: theme.ui.comment, dimColor: true, children: [
30103
30219
  shortId,
30104
30220
  " ",
30105
30221
  target,
@@ -30110,16 +30226,16 @@ var SessionsDialog = ({ cwd, onSelect, onClose }) => {
30110
30226
  ] }) })
30111
30227
  ] }, session.id);
30112
30228
  }),
30113
- canScrollDown && /* @__PURE__ */ jsx49(Text48, { color: theme.ui.comment, dimColor: true, children: " \u2193" }),
30114
- /* @__PURE__ */ jsx49(Box40, { marginTop: 1, children: /* @__PURE__ */ jsxs45(Text48, { color: theme.ui.comment, dimColor: true, children: [
30229
+ canScrollDown && /* @__PURE__ */ jsx55(Text53, { color: theme.ui.comment, dimColor: true, children: " \u2193" }),
30230
+ /* @__PURE__ */ jsx55(Box45, { marginTop: 1, children: /* @__PURE__ */ jsxs49(Text53, { color: theme.ui.comment, dimColor: true, children: [
30115
30231
  sessions.length,
30116
30232
  " session",
30117
30233
  sessions.length !== 1 ? "s" : "",
30118
30234
  search ? ` \xB7 "${search}"` : ""
30119
30235
  ] }) })
30120
30236
  ] }),
30121
- /* @__PURE__ */ jsx49(
30122
- Box40,
30237
+ /* @__PURE__ */ jsx55(
30238
+ Box45,
30123
30239
  {
30124
30240
  marginTop: 1,
30125
30241
  borderStyle: "single",
@@ -30128,7 +30244,7 @@ var SessionsDialog = ({ cwd, onSelect, onClose }) => {
30128
30244
  borderLeft: false,
30129
30245
  borderRight: false,
30130
30246
  borderColor: theme.ui.comment,
30131
- children: /* @__PURE__ */ jsx49(Text48, { color: theme.ui.comment, dimColor: true, children: "\u2191\u2193 navigate type to search Enter resume Esc close" })
30247
+ children: /* @__PURE__ */ jsx55(Text53, { color: theme.ui.comment, dimColor: true, children: "\u2191\u2193 navigate type to search Enter resume Esc close" })
30132
30248
  }
30133
30249
  )
30134
30250
  ]
@@ -30140,7 +30256,7 @@ function statusIcon(e) {
30140
30256
  if (e.status === "failed") return "\u2717";
30141
30257
  return "\u2026";
30142
30258
  }
30143
- function statusColor2(e) {
30259
+ function statusColor(e) {
30144
30260
  if (e.status === "done") return theme.status.success;
30145
30261
  if (e.status === "failed") return theme.status.error;
30146
30262
  return theme.text.accent;
@@ -30149,8 +30265,8 @@ var SubagentsPanel = ({ subagents, mainAreaWidth }) => {
30149
30265
  if (subagents.length === 0) return null;
30150
30266
  const running = subagents.filter((s) => s.status === "running").length;
30151
30267
  const title = running > 0 ? `Subagents (${running} running)` : `Subagents (${subagents.length} finishing\u2026)`;
30152
- return /* @__PURE__ */ jsxs46(
30153
- Box41,
30268
+ return /* @__PURE__ */ jsxs50(
30269
+ Box46,
30154
30270
  {
30155
30271
  flexDirection: "column",
30156
30272
  borderStyle: "round",
@@ -30160,25 +30276,25 @@ var SubagentsPanel = ({ subagents, mainAreaWidth }) => {
30160
30276
  marginTop: 1,
30161
30277
  width: Math.min(mainAreaWidth, 80),
30162
30278
  children: [
30163
- /* @__PURE__ */ jsx50(Box41, { paddingX: 1, children: /* @__PURE__ */ jsx50(Text49, { bold: true, color: theme.text.accent, children: title }) }),
30164
- subagents.map((entry) => /* @__PURE__ */ jsxs46(Box41, { flexDirection: "column", paddingX: 1, children: [
30165
- /* @__PURE__ */ jsxs46(Box41, { flexDirection: "row", gap: 1, children: [
30166
- /* @__PURE__ */ jsx50(Text49, { color: statusColor2(entry), children: statusIcon(entry) }),
30167
- /* @__PURE__ */ jsxs46(Text49, { wrap: "truncate", color: theme.text.primary, children: [
30279
+ /* @__PURE__ */ jsx56(Box46, { paddingX: 1, children: /* @__PURE__ */ jsx56(Text54, { bold: true, color: theme.text.accent, children: title }) }),
30280
+ subagents.map((entry) => /* @__PURE__ */ jsxs50(Box46, { flexDirection: "column", paddingX: 1, children: [
30281
+ /* @__PURE__ */ jsxs50(Box46, { flexDirection: "row", gap: 1, children: [
30282
+ /* @__PURE__ */ jsx56(Text54, { color: statusColor(entry), children: statusIcon(entry) }),
30283
+ /* @__PURE__ */ jsxs50(Text54, { wrap: "truncate", color: theme.text.primary, children: [
30168
30284
  entry.prompt,
30169
30285
  entry.prompt.length >= 50 ? "\u2026" : ""
30170
30286
  ] })
30171
30287
  ] }),
30172
- entry.status === "running" && entry.currentTool && /* @__PURE__ */ jsxs46(Text49, { color: theme.text.secondary, dimColor: true, children: [
30288
+ entry.status === "running" && entry.currentTool && /* @__PURE__ */ jsxs50(Text54, { color: theme.text.secondary, dimColor: true, children: [
30173
30289
  " ",
30174
30290
  "using ",
30175
30291
  entry.currentTool
30176
30292
  ] }),
30177
- entry.status === "running" && !entry.currentTool && entry.currentOutput && /* @__PURE__ */ jsxs46(Text49, { color: theme.text.secondary, dimColor: true, wrap: "truncate", children: [
30293
+ entry.status === "running" && !entry.currentTool && entry.currentOutput && /* @__PURE__ */ jsxs50(Text54, { color: theme.text.secondary, dimColor: true, wrap: "truncate", children: [
30178
30294
  " ",
30179
30295
  entry.currentOutput.trimStart()
30180
30296
  ] }),
30181
- entry.status === "failed" && entry.error && /* @__PURE__ */ jsxs46(Text49, { color: theme.status.error, dimColor: true, wrap: "truncate", children: [
30297
+ entry.status === "failed" && entry.error && /* @__PURE__ */ jsxs50(Text54, { color: theme.status.error, dimColor: true, wrap: "truncate", children: [
30182
30298
  " ",
30183
30299
  entry.error.slice(0, 60)
30184
30300
  ] })
@@ -30415,7 +30531,7 @@ function formatModelCatalogSummary2(result) {
30415
30531
  return "model catalog unavailable";
30416
30532
  }
30417
30533
  var APPROVAL_ENTER_ARM_DELAY_MS = 350;
30418
- var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30534
+ var AppContainer = ({ cwd, config, provider, model, resumeSessionId, startupWarnings = [] }) => {
30419
30535
  const historyManager = useHistory();
30420
30536
  const addHistoryItem = historyManager.addItem;
30421
30537
  const [initError, setInitError] = useState30(null);
@@ -30432,6 +30548,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30432
30548
  /* Idle */
30433
30549
  );
30434
30550
  const [compactMode, setCompactMode] = useState30(true);
30551
+ const [constrainHeight, setConstrainHeight] = useState30(true);
30435
30552
  const [shellModeActive, setShellModeActive] = useState30(false);
30436
30553
  const [showEscapePrompt, setShowEscapePrompt] = useState30(false);
30437
30554
  const [messageQueue, setMessageQueue] = useState30([]);
@@ -30443,8 +30560,6 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30443
30560
  const [isReceivingContent, setIsReceivingContent] = useState30(false);
30444
30561
  const [iterationInfo, setIterationInfo] = useState30(null);
30445
30562
  const [liveToolCalls, setLiveToolCalls] = useState30([]);
30446
- const [taskPlan, setTaskPlan] = useState30(null);
30447
- const [taskStreams, setTaskStreams] = useState30({});
30448
30563
  const [recentSlashCommandsState, setRecentSlashCommandsState] = useState30(/* @__PURE__ */ new Map());
30449
30564
  const [activeDialog, setActiveDialog] = useState30(null);
30450
30565
  const [themeName, setThemeName] = useState30("(unknown)");
@@ -30464,6 +30579,10 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30464
30579
  const [subagentMap, setSubagentMap] = useState30(/* @__PURE__ */ new Map());
30465
30580
  const [, setDrainTick] = useState30(0);
30466
30581
  const [pendingCommandConfirmation, setPendingCommandConfirmation] = useState30(null);
30582
+ const appContextValue = useMemo19(
30583
+ () => ({ version: VERSION, startupWarnings }),
30584
+ [startupWarnings]
30585
+ );
30467
30586
  const runtimeRef = useRef18(null);
30468
30587
  const sessionRef = useRef18(null);
30469
30588
  const configAdapterRef = useRef18(null);
@@ -30473,7 +30592,6 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30473
30592
  const runStartedAtRef = useRef18(null);
30474
30593
  const streamingResponseLengthRef = useRef18(0);
30475
30594
  const pendingTextBufferRef = useRef18("");
30476
- const taskStreamsBufferRef = useRef18({});
30477
30595
  const liveToolCallsBufferRef = useRef18([]);
30478
30596
  const subagentChunkBufferRef = useRef18(/* @__PURE__ */ new Map());
30479
30597
  const subagentToolBufferRef = useRef18([]);
@@ -30504,12 +30622,12 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30504
30622
  const configAdapter = configAdapterRef.current ?? new DeepCodeConfigAdapter(cwd);
30505
30623
  const isValidPath = useCallback27(
30506
30624
  (candidate) => {
30507
- const resolved = path15.resolve(cwd, candidate);
30508
- const relative2 = path15.relative(cwd, resolved);
30509
- if (relative2.startsWith("..") || path15.isAbsolute(relative2)) {
30625
+ const resolved = path16.resolve(cwd, candidate);
30626
+ const relative2 = path16.relative(cwd, resolved);
30627
+ if (relative2.startsWith("..") || path16.isAbsolute(relative2)) {
30510
30628
  return false;
30511
30629
  }
30512
- return fs8.existsSync(resolved);
30630
+ return fs9.existsSync(resolved);
30513
30631
  },
30514
30632
  [cwd]
30515
30633
  );
@@ -30535,6 +30653,8 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30535
30653
  undoCommand,
30536
30654
  compactCommand,
30537
30655
  diffCommand,
30656
+ exportCommand,
30657
+ contextCommand,
30538
30658
  providerCommand,
30539
30659
  modelCommand,
30540
30660
  modeCommand,
@@ -30708,7 +30828,9 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30708
30828
  reloadCommands: () => {
30709
30829
  },
30710
30830
  undo: handleUndo,
30711
- compact: handleCompact
30831
+ compact: handleCompact,
30832
+ getMessages: () => sessionRef.current?.messages ?? [],
30833
+ getCwd: () => cwd
30712
30834
  },
30713
30835
  session: {
30714
30836
  sessionShellAllowlist: sessionShellAllowlistRef.current
@@ -30764,18 +30886,6 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30764
30886
  pendingTextBufferRef.current = "";
30765
30887
  setPendingAssistantText((prev) => prev + text);
30766
30888
  }
30767
- const taskBuf = taskStreamsBufferRef.current;
30768
- const taskKeys = Object.keys(taskBuf);
30769
- if (taskKeys.length > 0) {
30770
- taskStreamsBufferRef.current = {};
30771
- setTaskStreams((prev) => {
30772
- const next = { ...prev };
30773
- for (const taskId of taskKeys) {
30774
- next[taskId] = (next[taskId] ?? "") + taskBuf[taskId];
30775
- }
30776
- return next;
30777
- });
30778
- }
30779
30889
  const activities = liveToolCallsBufferRef.current;
30780
30890
  if (activities.length > 0) {
30781
30891
  liveToolCallsBufferRef.current = [];
@@ -31055,7 +31165,6 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31055
31165
  lastSubmittedPromptRef.current = prompt;
31056
31166
  setPromptSuggestion(null);
31057
31167
  pendingTextBufferRef.current = "";
31058
- taskStreamsBufferRef.current = {};
31059
31168
  liveToolCallsBufferRef.current = [];
31060
31169
  subagentChunkBufferRef.current = /* @__PURE__ */ new Map();
31061
31170
  setPendingAssistantText("");
@@ -31063,8 +31172,6 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31063
31172
  setIsReceivingContent(false);
31064
31173
  streamingResponseLengthRef.current = 0;
31065
31174
  setLiveToolCalls([]);
31066
- setTaskPlan(null);
31067
- setTaskStreams({});
31068
31175
  setIterationInfo(null);
31069
31176
  const startIndex = session.messages.length;
31070
31177
  const isFirstTurn = startIndex === 0;
@@ -31081,11 +31188,6 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31081
31188
  pendingTextBufferRef.current += text;
31082
31189
  setIsReceivingContent(true);
31083
31190
  },
31084
- onChunkForTask: (taskId, text) => {
31085
- streamingResponseLengthRef.current += text.length;
31086
- taskStreamsBufferRef.current[taskId] = (taskStreamsBufferRef.current[taskId] ?? "") + text;
31087
- setIsReceivingContent(true);
31088
- },
31089
31191
  onUsage: (inputTokens, outputTokens) => {
31090
31192
  setLastPromptTokenCount(inputTokens);
31091
31193
  setLastOutputTokenCount(outputTokens);
@@ -31094,14 +31196,6 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31094
31196
  setIterationInfo({ round, max });
31095
31197
  liveToolCallsBufferRef.current = [];
31096
31198
  setLiveToolCalls([]);
31097
- },
31098
- onTaskUpdate: (_task, plan) => {
31099
- setTaskPlan({
31100
- objective: plan.objective,
31101
- tasks: plan.tasks.map((task) => ({ ...task })),
31102
- currentTaskId: plan.currentTaskId,
31103
- raw: plan.raw
31104
- });
31105
31199
  }
31106
31200
  });
31107
31201
  const newMessages = session.messages.slice(startIndex);
@@ -31142,14 +31236,11 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31142
31236
  } finally {
31143
31237
  abortRef.current = null;
31144
31238
  pendingTextBufferRef.current = "";
31145
- taskStreamsBufferRef.current = {};
31146
31239
  liveToolCallsBufferRef.current = [];
31147
31240
  subagentChunkBufferRef.current = /* @__PURE__ */ new Map();
31148
31241
  setPendingAssistantText("");
31149
31242
  setIsRunning(false);
31150
31243
  setLiveToolCalls([]);
31151
- setTaskPlan(null);
31152
- setTaskStreams({});
31153
31244
  setIterationInfo(null);
31154
31245
  const sess = sessionRef.current;
31155
31246
  if (sess) {
@@ -31777,6 +31868,13 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31777
31868
  setCompactMode((prev) => !prev);
31778
31869
  return;
31779
31870
  }
31871
+ if (key.ctrl && input === "s") {
31872
+ setConstrainHeight(false);
31873
+ return;
31874
+ }
31875
+ if (!constrainHeight) {
31876
+ setConstrainHeight(true);
31877
+ }
31780
31878
  if (approvalQueue.length > 0) {
31781
31879
  const pressed = input.toLowerCase();
31782
31880
  const enterArmed = approvalPromptVisibleAtRef.current !== null && Date.now() - approvalPromptVisibleAtRef.current >= APPROVAL_ENTER_ARM_DELAY_MS;
@@ -31895,9 +31993,9 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31895
31993
  availableTerminalHeight: void 0,
31896
31994
  staticAreaMaxItemHeight: 200,
31897
31995
  mainControlsRef,
31898
- constrainHeight: false,
31996
+ constrainHeight,
31899
31997
  currentModel,
31900
- sessionName: path15.basename(cwd),
31998
+ sessionName: path16.basename(cwd),
31901
31999
  isConfigInitialized: !isInitializing && !initError,
31902
32000
  sessionStats: {
31903
32001
  lastPromptTokenCount,
@@ -31923,6 +32021,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31923
32021
  buffer,
31924
32022
  commandContext,
31925
32023
  compactMode,
32024
+ constrainHeight,
31926
32025
  currentModel,
31927
32026
  cwd,
31928
32027
  dismissPromptSuggestion,
@@ -31954,64 +32053,38 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31954
32053
  userMessages
31955
32054
  ]
31956
32055
  );
31957
- return /* @__PURE__ */ jsx51(CompactModeProvider, { value: { compactMode }, children: /* @__PURE__ */ jsx51(ConfigContext.Provider, { value: configAdapter, children: /* @__PURE__ */ jsx51(SettingsContext.Provider, { value: loadedSettings, children: /* @__PURE__ */ jsx51(StreamingContext.Provider, { value: streamingState, children: /* @__PURE__ */ jsx51(VimModeProvider, { initialVimEnabled: loadedSettings.merged.general?.vimMode ?? false, children: /* @__PURE__ */ jsx51(KeypressProvider, { kittyProtocolEnabled: false, config: configAdapter, children: /* @__PURE__ */ jsx51(ShellFocusContext.Provider, { value: true, children: /* @__PURE__ */ jsx51(AgentViewProvider, { children: /* @__PURE__ */ jsx51(BackgroundTaskViewProvider, { children: /* @__PURE__ */ jsx51(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx51(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsxs47(Box42, { flexDirection: "column", flexGrow: 1, children: [
31958
- /* @__PURE__ */ jsxs47(Box42, { marginLeft: 2, marginRight: 2, marginTop: 1, marginBottom: 1, children: [
31959
- /* @__PURE__ */ jsx51(Text50, { bold: true, color: theme.text.accent, children: "DeepCode" }),
31960
- /* @__PURE__ */ jsx51(Text50, { color: theme.text.secondary, children: " Target: " }),
31961
- /* @__PURE__ */ jsx51(Text50, { color: theme.text.primary, children: providerLabel }),
31962
- /* @__PURE__ */ jsxs47(Text50, { color: theme.text.secondary, children: [
31963
- " (",
31964
- targetSource,
31965
- ")"
31966
- ] }),
31967
- /* @__PURE__ */ jsx51(Text50, { color: theme.text.secondary, children: " Mode: " }),
31968
- /* @__PURE__ */ jsx51(
31969
- Text50,
32056
+ return /* @__PURE__ */ jsx57(AppContext.Provider, { value: appContextValue, children: /* @__PURE__ */ jsx57(CompactModeProvider, { value: { compactMode }, children: /* @__PURE__ */ jsx57(ConfigContext.Provider, { value: configAdapter, children: /* @__PURE__ */ jsx57(SettingsContext.Provider, { value: loadedSettings, children: /* @__PURE__ */ jsx57(StreamingContext.Provider, { value: streamingState, children: /* @__PURE__ */ jsx57(VimModeProvider, { initialVimEnabled: loadedSettings.merged.general?.vimMode ?? false, children: /* @__PURE__ */ jsx57(KeypressProvider, { kittyProtocolEnabled: false, config: configAdapter, children: /* @__PURE__ */ jsx57(ShellFocusContext.Provider, { value: true, children: /* @__PURE__ */ jsx57(AgentViewProvider, { children: /* @__PURE__ */ jsx57(BackgroundTaskViewProvider, { children: /* @__PURE__ */ jsx57(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx57(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsxs51(Box47, { flexDirection: "column", flexGrow: 1, children: [
32057
+ /* @__PURE__ */ jsx57(
32058
+ AppHeader,
32059
+ {
32060
+ version: VERSION,
32061
+ cwd,
32062
+ providerLabel,
32063
+ mode: agentMode,
32064
+ iterationInfo
32065
+ }
32066
+ ),
32067
+ initError ? /* @__PURE__ */ jsx57(Box47, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsxs51(Text55, { color: theme.status.error, children: [
32068
+ "Failed to initialize runtime: ",
32069
+ initError
32070
+ ] }) }) : /* @__PURE__ */ jsxs51(Box47, { flexDirection: "column", flexGrow: 1, children: [
32071
+ /* @__PURE__ */ jsx57(
32072
+ MainContent,
31970
32073
  {
31971
- bold: true,
31972
- color: agentMode === "build" ? theme.status.success : theme.status.warning,
31973
- children: agentMode.toUpperCase()
32074
+ history: historyManager.history,
32075
+ historyRemountKey,
32076
+ pendingAssistantText,
32077
+ liveToolCalls,
32078
+ terminalWidth,
32079
+ mainAreaWidth,
32080
+ isFocused: approvalQueue.length === 0
31974
32081
  }
31975
32082
  ),
31976
- /* @__PURE__ */ jsxs47(Text50, { color: theme.text.secondary, children: [
31977
- " ",
31978
- streamingState === "responding" ? "running" : streamingState === "waiting_for_confirmation" ? "waiting-approval" : "idle"
31979
- ] }),
31980
- iterationInfo && /* @__PURE__ */ jsxs47(Text50, { color: theme.text.secondary, children: [
31981
- " ",
31982
- "iter ",
31983
- iterationInfo.round,
31984
- "/",
31985
- iterationInfo.max
31986
- ] }),
31987
- lastPromptTokenCount > 0 && /* @__PURE__ */ jsxs47(Text50, { color: theme.text.secondary, children: [
31988
- " ",
31989
- "\u2191",
31990
- formatTokenCount(lastPromptTokenCount),
31991
- " \u2193",
31992
- formatTokenCount(lastOutputTokenCount)
31993
- ] })
32083
+ /* @__PURE__ */ jsx57(ShowMoreLines, { constrainHeight })
31994
32084
  ] }),
31995
- initError ? /* @__PURE__ */ jsx51(Box42, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsxs47(Text50, { color: theme.status.error, children: [
31996
- "Failed to initialize runtime: ",
31997
- initError
31998
- ] }) }) : /* @__PURE__ */ jsx51(
31999
- MainContent,
32000
- {
32001
- history: historyManager.history,
32002
- historyRemountKey,
32003
- pendingAssistantText,
32004
- liveToolCalls,
32005
- taskPlan,
32006
- taskStreams,
32007
- terminalWidth,
32008
- mainAreaWidth,
32009
- isFocused: approvalQueue.length === 0
32010
- }
32011
- ),
32012
- approvalQueue.length > 0 && /* @__PURE__ */ jsx51(Box42, { marginLeft: 2, marginRight: 2, marginTop: 1, children: /* @__PURE__ */ jsx51(ApprovalPrompt, { request: approvalQueue[0] }) }),
32013
- dialogModel && /* @__PURE__ */ jsx51(CommandDialog, { title: dialogModel.title, lines: dialogModel.lines }),
32014
- activeDialog === "provider" && /* @__PURE__ */ jsx51(
32085
+ approvalQueue.length > 0 && /* @__PURE__ */ jsx57(Box47, { marginLeft: 2, marginRight: 2, marginTop: 1, children: /* @__PURE__ */ jsx57(ApprovalPrompt, { request: approvalQueue[0] }) }),
32086
+ dialogModel && /* @__PURE__ */ jsx57(CommandDialog, { title: dialogModel.title, lines: dialogModel.lines }),
32087
+ activeDialog === "provider" && /* @__PURE__ */ jsx57(
32015
32088
  ProviderDialog,
32016
32089
  {
32017
32090
  providers: listAvailableProviders(),
@@ -32026,7 +32099,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
32026
32099
  onClose: closeDialog
32027
32100
  }
32028
32101
  ),
32029
- activeDialog === "model" && /* @__PURE__ */ jsx51(
32102
+ activeDialog === "model" && /* @__PURE__ */ jsx57(
32030
32103
  ModelDialog,
32031
32104
  {
32032
32105
  currentProvider: getSessionCommandState().provider,
@@ -32036,7 +32109,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
32036
32109
  onClose: closeDialog
32037
32110
  }
32038
32111
  ),
32039
- activeDialog === "theme" && /* @__PURE__ */ jsx51(
32112
+ activeDialog === "theme" && /* @__PURE__ */ jsx57(
32040
32113
  ThemeDialog,
32041
32114
  {
32042
32115
  onSelect: handleSelectTheme,
@@ -32044,7 +32117,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
32044
32117
  onPreview: previewTheme
32045
32118
  }
32046
32119
  ),
32047
- activeDialog === "permissions" && /* @__PURE__ */ jsx51(
32120
+ activeDialog === "permissions" && /* @__PURE__ */ jsx57(
32048
32121
  PermissionsDialog,
32049
32122
  {
32050
32123
  current: permissionModes,
@@ -32052,7 +32125,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
32052
32125
  onClose: closeDialog
32053
32126
  }
32054
32127
  ),
32055
- activeDialog === "auth" && runtimeRef.current && /* @__PURE__ */ jsx51(
32128
+ activeDialog === "auth" && runtimeRef.current && /* @__PURE__ */ jsx57(
32056
32129
  AuthDialog,
32057
32130
  {
32058
32131
  clientId: runtimeRef.current.config.github.oauthClientId,
@@ -32065,8 +32138,8 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
32065
32138
  onClose: closeDialog
32066
32139
  }
32067
32140
  ),
32068
- activeDialog === "feedback" && /* @__PURE__ */ jsx51(FeedbackDialog, { cwd, onClose: closeDialog }),
32069
- activeDialog === "sessions" && /* @__PURE__ */ jsx51(
32141
+ activeDialog === "feedback" && /* @__PURE__ */ jsx57(FeedbackDialog, { cwd, onClose: closeDialog }),
32142
+ activeDialog === "sessions" && /* @__PURE__ */ jsx57(
32070
32143
  SessionsDialog,
32071
32144
  {
32072
32145
  cwd,
@@ -32074,7 +32147,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
32074
32147
  onClose: closeDialog
32075
32148
  }
32076
32149
  ),
32077
- pendingCommandConfirmation && /* @__PURE__ */ jsx51(
32150
+ pendingCommandConfirmation && /* @__PURE__ */ jsx57(
32078
32151
  CommandDialog,
32079
32152
  {
32080
32153
  title: "Confirm action",
@@ -32086,15 +32159,16 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
32086
32159
  footerText: "Press y or Enter to confirm. Press n or Esc to cancel."
32087
32160
  }
32088
32161
  ),
32089
- /* @__PURE__ */ jsx51(
32162
+ /* @__PURE__ */ jsx57(
32090
32163
  SubagentsPanel,
32091
32164
  {
32092
32165
  subagents: Array.from(subagentMap.values()),
32093
32166
  mainAreaWidth
32094
32167
  }
32095
32168
  ),
32096
- /* @__PURE__ */ jsx51(Composer, {})
32097
- ] }) }) }) }) }) }) }) }) }) }) }) });
32169
+ /* @__PURE__ */ jsx57(Notifications, {}),
32170
+ /* @__PURE__ */ jsx57(Composer, {})
32171
+ ] }) }) }) }) }) }) }) }) }) }) }) }) });
32098
32172
  };
32099
32173
  function formatProviderLabel(provider, model) {
32100
32174
  return model ? `${provider} \u203A ${model}` : `${provider} \u203A (model unset)`;
@@ -32136,11 +32210,11 @@ function isInteractiveDialog(dialog) {
32136
32210
  return dialog === "theme" || dialog === "permissions" || dialog === "auth" || dialog === "provider" || dialog === "model" || dialog === "feedback" || dialog === "sessions";
32137
32211
  }
32138
32212
  function tuiThemeFilePath(cwd) {
32139
- return path15.join(cwd, ".deepcode", "tui-theme.json");
32213
+ return path16.join(cwd, ".deepcode", "tui-theme.json");
32140
32214
  }
32141
32215
  function readSavedTheme(cwd) {
32142
32216
  try {
32143
- const parsed = JSON.parse(fs8.readFileSync(tuiThemeFilePath(cwd), "utf8"));
32217
+ const parsed = JSON.parse(fs9.readFileSync(tuiThemeFilePath(cwd), "utf8"));
32144
32218
  return typeof parsed.theme === "string" ? parsed.theme : null;
32145
32219
  } catch {
32146
32220
  return null;
@@ -32148,16 +32222,16 @@ function readSavedTheme(cwd) {
32148
32222
  }
32149
32223
  function writeSavedTheme(cwd, themeName) {
32150
32224
  const file = tuiThemeFilePath(cwd);
32151
- fs8.mkdirSync(path15.dirname(file), { recursive: true });
32152
- fs8.writeFileSync(file, `${JSON.stringify({ theme: themeName }, null, 2)}
32225
+ fs9.mkdirSync(path16.dirname(file), { recursive: true });
32226
+ fs9.writeFileSync(file, `${JSON.stringify({ theme: themeName }, null, 2)}
32153
32227
  `);
32154
32228
  }
32155
32229
  function tuiProviderFilePath(cwd) {
32156
- return path15.join(cwd, ".deepcode", "tui-provider.json");
32230
+ return path16.join(cwd, ".deepcode", "tui-provider.json");
32157
32231
  }
32158
32232
  function readSavedProvider(cwd) {
32159
32233
  try {
32160
- const parsed = JSON.parse(fs8.readFileSync(tuiProviderFilePath(cwd), "utf8"));
32234
+ const parsed = JSON.parse(fs9.readFileSync(tuiProviderFilePath(cwd), "utf8"));
32161
32235
  const result = ProviderIdSchema.safeParse(parsed.provider);
32162
32236
  if (!result.success) return null;
32163
32237
  return {
@@ -32170,8 +32244,8 @@ function readSavedProvider(cwd) {
32170
32244
  }
32171
32245
  function writeSavedProvider(cwd, provider, model) {
32172
32246
  const file = tuiProviderFilePath(cwd);
32173
- fs8.mkdirSync(path15.dirname(file), { recursive: true });
32174
- fs8.writeFileSync(file, `${JSON.stringify({ provider, model }, null, 2)}
32247
+ fs9.mkdirSync(path16.dirname(file), { recursive: true });
32248
+ fs9.writeFileSync(file, `${JSON.stringify({ provider, model }, null, 2)}
32175
32249
  `);
32176
32250
  }
32177
32251
  function errorMessage(error) {
@@ -32217,22 +32291,22 @@ function formatAuthSummary(config) {
32217
32291
  var ApprovalPrompt = ({ request }) => {
32218
32292
  if (!request) return null;
32219
32293
  const operationLabel = formatApprovalOperationLabel(request);
32220
- return /* @__PURE__ */ jsxs47(Box42, { flexDirection: "column", marginTop: 1, children: [
32221
- /* @__PURE__ */ jsxs47(Text50, { color: theme.status.warning, children: [
32294
+ return /* @__PURE__ */ jsxs51(Box47, { flexDirection: "column", marginTop: 1, children: [
32295
+ /* @__PURE__ */ jsxs51(Text55, { color: theme.status.warning, children: [
32222
32296
  "\u26A0 Allow ",
32223
32297
  operationLabel,
32224
32298
  "?"
32225
32299
  ] }),
32226
- request.path && /* @__PURE__ */ jsxs47(Text50, { color: theme.text.secondary, children: [
32300
+ request.path && /* @__PURE__ */ jsxs51(Text55, { color: theme.text.secondary, children: [
32227
32301
  " ",
32228
32302
  request.path
32229
32303
  ] }),
32230
- request.preview?.command && /* @__PURE__ */ jsxs47(Text50, { color: theme.text.secondary, children: [
32304
+ request.preview?.command && /* @__PURE__ */ jsxs51(Text55, { color: theme.text.secondary, children: [
32231
32305
  " $ ",
32232
32306
  request.preview.command,
32233
32307
  request.preview.args?.length ? ` ${request.preview.args.join(" ")}` : ""
32234
32308
  ] }),
32235
- /* @__PURE__ */ jsx51(Text50, { color: theme.text.secondary, children: " [\u21B5/y] once [s] session [a] always [n] deny" })
32309
+ /* @__PURE__ */ jsx57(Text55, { color: theme.text.secondary, children: " [\u21B5/y] once [s] session [a] always [n] deny" })
32236
32310
  ] });
32237
32311
  };
32238
32312
  function formatApprovalOperationLabel(request) {
@@ -32293,7 +32367,7 @@ var DeepCodeConfigAdapter = class {
32293
32367
  }
32294
32368
  };
32295
32369
  function App(props) {
32296
- return /* @__PURE__ */ jsx52(
32370
+ return /* @__PURE__ */ jsx58(
32297
32371
  AppContainer,
32298
32372
  {
32299
32373
  cwd: props.cwd,