deepcode-ai 1.1.13 → 1.1.15
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 +742 -438
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2210,12 +2210,14 @@ import { createInterface } from "readline";
|
|
|
2210
2210
|
import { Effect as Effect3 } from "effect";
|
|
2211
2211
|
import { z as z22 } from "zod";
|
|
2212
2212
|
import { Effect as Effect2 } from "effect";
|
|
2213
|
+
import fs from "fs";
|
|
2214
|
+
import path22 from "path";
|
|
2213
2215
|
import { createHash } from "crypto";
|
|
2214
2216
|
import { mkdir as mkdir2, readFile, rm as rm2, writeFile as writeFile2 } from "fs/promises";
|
|
2215
|
-
import
|
|
2217
|
+
import path3 from "path";
|
|
2216
2218
|
import { mkdir as mkdir22, readFile as readFile2 } from "fs/promises";
|
|
2217
2219
|
import os from "os";
|
|
2218
|
-
import
|
|
2220
|
+
import path4 from "path";
|
|
2219
2221
|
import { EventEmitter } from "events";
|
|
2220
2222
|
import { z as z3 } from "zod";
|
|
2221
2223
|
import { spawn as spawn3 } from "child_process";
|
|
@@ -2225,34 +2227,36 @@ import { execFile as execFile2 } from "child_process";
|
|
|
2225
2227
|
import { z as z4 } from "zod";
|
|
2226
2228
|
import { spawn as spawn4 } from "child_process";
|
|
2227
2229
|
import { existsSync } from "fs";
|
|
2228
|
-
import path4 from "path";
|
|
2229
|
-
import { mkdir as mkdir3, appendFile } from "fs/promises";
|
|
2230
2230
|
import path5 from "path";
|
|
2231
|
+
import { mkdir as mkdir3, appendFile } from "fs/promises";
|
|
2232
|
+
import path6 from "path";
|
|
2231
2233
|
import os2 from "os";
|
|
2232
2234
|
import { access, realpath } from "fs/promises";
|
|
2233
|
-
import path6 from "path";
|
|
2234
|
-
import os3 from "os";
|
|
2235
2235
|
import path7 from "path";
|
|
2236
|
-
import
|
|
2236
|
+
import os3 from "os";
|
|
2237
2237
|
import path8 from "path";
|
|
2238
|
+
import { mkdir as mkdir4, readFile as readFile3, readdir as readdir2 } from "fs/promises";
|
|
2239
|
+
import path9 from "path";
|
|
2238
2240
|
import { readFile as readFile5 } from "fs/promises";
|
|
2239
|
-
import
|
|
2241
|
+
import path11 from "path";
|
|
2240
2242
|
import { Effect as Effect4 } from "effect";
|
|
2241
2243
|
import { z as z5 } from "zod";
|
|
2242
2244
|
import { lstat as lstat2, mkdir as mkdir6, readFile as readFile6, readdir as readdir4, stat, writeFile as writeFile22 } from "fs/promises";
|
|
2243
|
-
import
|
|
2245
|
+
import path12 from "path";
|
|
2244
2246
|
import { Effect as Effect5 } from "effect";
|
|
2245
2247
|
import { z as z6 } from "zod";
|
|
2246
2248
|
import { Effect as Effect6 } from "effect";
|
|
2247
2249
|
import { z as z7 } from "zod";
|
|
2248
|
-
import
|
|
2250
|
+
import path13 from "path";
|
|
2249
2251
|
import { Effect as Effect7 } from "effect";
|
|
2250
2252
|
import { z as z8 } from "zod";
|
|
2251
2253
|
import { Effect as Effect8 } from "effect";
|
|
2252
2254
|
import { z as z9 } from "zod";
|
|
2253
2255
|
import { Effect as Effect9 } from "effect";
|
|
2254
2256
|
import { z as z10 } from "zod";
|
|
2255
|
-
import
|
|
2257
|
+
import { Effect as Effect10 } from "effect";
|
|
2258
|
+
import { z as z11 } from "zod";
|
|
2259
|
+
import path14 from "path";
|
|
2256
2260
|
import { readdir as readdir5, lstat as lstat3 } from "fs/promises";
|
|
2257
2261
|
var DeepCodeError = class extends Error {
|
|
2258
2262
|
constructor(message, code, cause) {
|
|
@@ -2277,8 +2281,8 @@ var PermissionDeniedError = class extends DeepCodeError {
|
|
|
2277
2281
|
}
|
|
2278
2282
|
};
|
|
2279
2283
|
var PathNotAllowedError = class extends DeepCodeError {
|
|
2280
|
-
constructor(
|
|
2281
|
-
super(`Path is not allowed: ${
|
|
2284
|
+
constructor(path15, reason) {
|
|
2285
|
+
super(`Path is not allowed: ${path15}. ${reason}`, "PATH_NOT_ALLOWED");
|
|
2282
2286
|
this.name = "PathNotAllowedError";
|
|
2283
2287
|
}
|
|
2284
2288
|
};
|
|
@@ -3416,7 +3420,8 @@ var Agent = class {
|
|
|
3416
3420
|
async run(options) {
|
|
3417
3421
|
const session = options.session;
|
|
3418
3422
|
const mode = options.mode ?? this.config.agentMode;
|
|
3419
|
-
const
|
|
3423
|
+
const baseTurnStrategy = this.resolveTurnStrategy(options.input, mode);
|
|
3424
|
+
const turnStrategy = options.systemPrompt ? { ...baseTurnStrategy, systemPrompt: options.systemPrompt } : baseTurnStrategy;
|
|
3420
3425
|
const resolvedTarget = resolveExecutionTarget(
|
|
3421
3426
|
this.config,
|
|
3422
3427
|
session,
|
|
@@ -3700,7 +3705,7 @@ ${assistantText}` : assistantText;
|
|
|
3700
3705
|
break;
|
|
3701
3706
|
}
|
|
3702
3707
|
for (const call of toolCalls) {
|
|
3703
|
-
const result = await this.executeTool(call, session, mode, options.signal, allowedToolNames);
|
|
3708
|
+
const result = await this.executeTool(call, session, mode, options.signal, allowedToolNames, options.onToolActivity);
|
|
3704
3709
|
this.sessions.addMessage(session.id, {
|
|
3705
3710
|
role: "tool",
|
|
3706
3711
|
source: "tool",
|
|
@@ -3719,8 +3724,9 @@ ${assistantText}` : assistantText;
|
|
|
3719
3724
|
let iterations = startingIterations;
|
|
3720
3725
|
const resolvedModel = session.model ?? resolveConfiguredModelForProvider(this.config, session.provider);
|
|
3721
3726
|
const toolProfile = resolveModelExecutionProfile(session.provider, resolvedModel);
|
|
3722
|
-
const
|
|
3723
|
-
const allowedToolNames =
|
|
3727
|
+
const baseAllowedToolNames = turnStrategy.allowTools ? this.allowedToolNamesForMode(mode) : /* @__PURE__ */ new Set();
|
|
3728
|
+
const allowedToolNames = this.applyToolOverrides(baseAllowedToolNames, options);
|
|
3729
|
+
const toolDefinitions = turnStrategy.allowTools ? this.toolDefinitionsForNames(allowedToolNames, toolProfile.toolSchemaMode) : [];
|
|
3724
3730
|
const textToolFallbackEnabled = toolDefinitions.length > 0 && toolProfile.toolCallStrategy !== "native";
|
|
3725
3731
|
while (iterations < maxIterations) {
|
|
3726
3732
|
iterations += 1;
|
|
@@ -3799,7 +3805,7 @@ ${assistantText}` : assistantText;
|
|
|
3799
3805
|
}
|
|
3800
3806
|
if (toolCalls.length === 0) break;
|
|
3801
3807
|
for (const call of toolCalls) {
|
|
3802
|
-
const result = await this.executeTool(call, session, mode, options.signal, allowedToolNames);
|
|
3808
|
+
const result = await this.executeTool(call, session, mode, options.signal, allowedToolNames, options.onToolActivity);
|
|
3803
3809
|
this.sessions.addMessage(session.id, {
|
|
3804
3810
|
role: "tool",
|
|
3805
3811
|
source: "tool",
|
|
@@ -3829,7 +3835,7 @@ ${assistantText}` : assistantText;
|
|
|
3829
3835
|
}
|
|
3830
3836
|
return { path: entry.path, restored: true };
|
|
3831
3837
|
}
|
|
3832
|
-
async executeTool(call, session, mode, signal, allowedToolNames = this.allowedToolNamesForMode(mode)) {
|
|
3838
|
+
async executeTool(call, session, mode, signal, allowedToolNames = this.allowedToolNamesForMode(mode), onToolActivity) {
|
|
3833
3839
|
if (!this.isToolAllowed(call.name, mode)) {
|
|
3834
3840
|
const modeHint = mode === "plan" ? "Switch to BUILD mode (press Tab in the TUI) to enable this tool." : "";
|
|
3835
3841
|
return {
|
|
@@ -3880,7 +3886,7 @@ ${assistantText}` : assistantText;
|
|
|
3880
3886
|
snapshotForUndo: async (filePath) => {
|
|
3881
3887
|
let previousContent = null;
|
|
3882
3888
|
try {
|
|
3883
|
-
previousContent = await import("fs/promises").then((
|
|
3889
|
+
previousContent = await import("fs/promises").then((fs23) => fs23.readFile(filePath, "utf8"));
|
|
3884
3890
|
} catch {
|
|
3885
3891
|
}
|
|
3886
3892
|
const stack = this.undoStacks.get(session.id) ?? [];
|
|
@@ -3894,7 +3900,9 @@ ${assistantText}` : assistantText;
|
|
|
3894
3900
|
message: `Calling ${call.name}`,
|
|
3895
3901
|
metadata: { tool: call.name, args: call.arguments }
|
|
3896
3902
|
});
|
|
3903
|
+
onToolActivity?.(call.name, true);
|
|
3897
3904
|
const result = await Effect.runPromise(tool.execute(parsed.data, context));
|
|
3905
|
+
onToolActivity?.(call.name, false);
|
|
3898
3906
|
const output = typeof result === "string" ? result : JSON.stringify(result, null, 2);
|
|
3899
3907
|
this.logToolActivity(session, {
|
|
3900
3908
|
type: "tool_result",
|
|
@@ -3964,6 +3972,14 @@ ${assistantText}` : assistantText;
|
|
|
3964
3972
|
this.tools.list().filter((tool) => this.isToolAllowed(tool.name, mode)).map((tool) => tool.name)
|
|
3965
3973
|
);
|
|
3966
3974
|
}
|
|
3975
|
+
applyToolOverrides(base, options) {
|
|
3976
|
+
if (!options.allowedTools && !options.disallowedTools) return base;
|
|
3977
|
+
let names = options.allowedTools ? new Set(options.allowedTools) : new Set(base);
|
|
3978
|
+
if (options.disallowedTools) {
|
|
3979
|
+
for (const name of options.disallowedTools) names.delete(name);
|
|
3980
|
+
}
|
|
3981
|
+
return new Set([...names].filter((n) => base.has(n)));
|
|
3982
|
+
}
|
|
3967
3983
|
allowedToolNamesForTaskType(mode, taskType) {
|
|
3968
3984
|
if (taskType === "research") return /* @__PURE__ */ new Set([...PLAN_ALLOWED_TOOLS]);
|
|
3969
3985
|
if (taskType === "verify") return /* @__PURE__ */ new Set(["read_file", "list_dir", "analyze_code", "search_text", "bash"]);
|
|
@@ -4468,19 +4484,73 @@ var McpManager = class {
|
|
|
4468
4484
|
this.clients.length = 0;
|
|
4469
4485
|
}
|
|
4470
4486
|
};
|
|
4487
|
+
function parseFrontmatter(content) {
|
|
4488
|
+
const meta = {};
|
|
4489
|
+
let body = content;
|
|
4490
|
+
const fmMatch = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(content);
|
|
4491
|
+
if (!fmMatch) return { meta, body };
|
|
4492
|
+
const fmBlock = fmMatch[1];
|
|
4493
|
+
body = fmMatch[2];
|
|
4494
|
+
for (const line of fmBlock.split(/\r?\n/)) {
|
|
4495
|
+
const kv = /^(\w[\w-]*):\s*(.*)$/.exec(line.trim());
|
|
4496
|
+
if (!kv) continue;
|
|
4497
|
+
const key = kv[1];
|
|
4498
|
+
const raw = kv[2].trim();
|
|
4499
|
+
if (raw.startsWith("[") && raw.endsWith("]")) {
|
|
4500
|
+
meta[key] = raw.slice(1, -1).split(",").map((s) => s.trim().replace(/^['"]|['"]$/g, "")).filter(Boolean);
|
|
4501
|
+
} else {
|
|
4502
|
+
meta[key] = raw.replace(/^['"]|['"]$/g, "");
|
|
4503
|
+
}
|
|
4504
|
+
}
|
|
4505
|
+
return { meta, body };
|
|
4506
|
+
}
|
|
4507
|
+
function loadAgentConfigs(worktree) {
|
|
4508
|
+
const dir = path22.join(worktree, ".deepcode", "agents");
|
|
4509
|
+
if (!fs.existsSync(dir)) return [];
|
|
4510
|
+
const configs = [];
|
|
4511
|
+
let entries;
|
|
4512
|
+
try {
|
|
4513
|
+
entries = fs.readdirSync(dir);
|
|
4514
|
+
} catch {
|
|
4515
|
+
return [];
|
|
4516
|
+
}
|
|
4517
|
+
for (const entry of entries) {
|
|
4518
|
+
if (!entry.endsWith(".md")) continue;
|
|
4519
|
+
const filePath = path22.join(dir, entry);
|
|
4520
|
+
let content;
|
|
4521
|
+
try {
|
|
4522
|
+
content = fs.readFileSync(filePath, "utf8");
|
|
4523
|
+
} catch {
|
|
4524
|
+
continue;
|
|
4525
|
+
}
|
|
4526
|
+
const { meta, body } = parseFrontmatter(content);
|
|
4527
|
+
const name = typeof meta["name"] === "string" ? meta["name"] : path22.basename(entry, ".md");
|
|
4528
|
+
configs.push({
|
|
4529
|
+
name,
|
|
4530
|
+
description: typeof meta["description"] === "string" ? meta["description"] : void 0,
|
|
4531
|
+
systemPrompt: body.trim(),
|
|
4532
|
+
model: typeof meta["model"] === "string" ? meta["model"] : void 0,
|
|
4533
|
+
allowedTools: Array.isArray(meta["allowed_tools"]) ? meta["allowed_tools"] : void 0,
|
|
4534
|
+
disallowedTools: Array.isArray(meta["disallowed_tools"]) ? meta["disallowed_tools"] : void 0
|
|
4535
|
+
});
|
|
4536
|
+
}
|
|
4537
|
+
return configs;
|
|
4538
|
+
}
|
|
4471
4539
|
var SubagentManager = class {
|
|
4472
|
-
constructor(agent, sessions, defaultProvider, defaultModel, defaultConcurrency = 4) {
|
|
4540
|
+
constructor(agent, sessions, defaultProvider, defaultModel, defaultConcurrency = 4, events) {
|
|
4473
4541
|
this.agent = agent;
|
|
4474
4542
|
this.sessions = sessions;
|
|
4475
4543
|
this.defaultProvider = defaultProvider;
|
|
4476
4544
|
this.defaultModel = defaultModel;
|
|
4477
4545
|
this.defaultConcurrency = defaultConcurrency;
|
|
4546
|
+
this.events = events;
|
|
4478
4547
|
}
|
|
4479
4548
|
agent;
|
|
4480
4549
|
sessions;
|
|
4481
4550
|
defaultProvider;
|
|
4482
4551
|
defaultModel;
|
|
4483
4552
|
defaultConcurrency;
|
|
4553
|
+
events;
|
|
4484
4554
|
async runParallel(tasks, options = {}) {
|
|
4485
4555
|
const concurrency = Math.max(1, options.concurrency ?? Math.min(tasks.length, this.defaultConcurrency));
|
|
4486
4556
|
const results = [];
|
|
@@ -4498,22 +4568,34 @@ var SubagentManager = class {
|
|
|
4498
4568
|
await Promise.all(workers);
|
|
4499
4569
|
return tasks.map((task) => results.find((result) => result.taskId === task.id)).filter(Boolean);
|
|
4500
4570
|
}
|
|
4571
|
+
async forkFrom(parentSessionId, task, signal) {
|
|
4572
|
+
const parentMessages = this.sessions.get(parentSessionId).messages;
|
|
4573
|
+
return this.runOne({ ...task, parentMessages }, signal);
|
|
4574
|
+
}
|
|
4501
4575
|
async runOne(task, signal) {
|
|
4502
4576
|
const session = this.createChildSession(task);
|
|
4577
|
+
this.events?.emit("subagent:start", { taskId: task.id, prompt: task.prompt });
|
|
4503
4578
|
try {
|
|
4504
4579
|
const output = await this.agent.run({
|
|
4505
4580
|
session,
|
|
4506
4581
|
input: task.prompt,
|
|
4507
4582
|
provider: task.provider,
|
|
4508
|
-
signal
|
|
4583
|
+
signal,
|
|
4584
|
+
systemPrompt: task.systemPrompt,
|
|
4585
|
+
allowedTools: task.allowedTools,
|
|
4586
|
+
disallowedTools: task.disallowedTools,
|
|
4587
|
+
onToolActivity: this.events ? (toolName, active) => this.events.emit("subagent:tool", { taskId: task.id, toolName, active }) : void 0
|
|
4509
4588
|
});
|
|
4589
|
+
this.events?.emit("subagent:complete", { taskId: task.id });
|
|
4510
4590
|
return { taskId: task.id, sessionId: session.id, output };
|
|
4511
4591
|
} catch (error) {
|
|
4592
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
4593
|
+
this.events?.emit("subagent:complete", { taskId: task.id, error: errMsg });
|
|
4512
4594
|
return {
|
|
4513
4595
|
taskId: task.id,
|
|
4514
4596
|
sessionId: session.id,
|
|
4515
4597
|
output: "",
|
|
4516
|
-
error:
|
|
4598
|
+
error: errMsg
|
|
4517
4599
|
};
|
|
4518
4600
|
}
|
|
4519
4601
|
}
|
|
@@ -4528,6 +4610,11 @@ var SubagentManager = class {
|
|
|
4528
4610
|
taskId: task.id,
|
|
4529
4611
|
...task.metadata
|
|
4530
4612
|
};
|
|
4613
|
+
if (task.parentMessages?.length) {
|
|
4614
|
+
for (const msg of task.parentMessages) {
|
|
4615
|
+
this.sessions.addMessage(session.id, { role: msg.role, source: msg.source, content: msg.content });
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4531
4618
|
this.sessions.save(session);
|
|
4532
4619
|
return session;
|
|
4533
4620
|
}
|
|
@@ -4557,7 +4644,7 @@ var ToolCache = class {
|
|
|
4557
4644
|
async set(namespace, keyParts, value) {
|
|
4558
4645
|
if (!this.config.cache.enabled) return;
|
|
4559
4646
|
const key = cacheKey(namespace, keyParts);
|
|
4560
|
-
const dir =
|
|
4647
|
+
const dir = path3.join(this.worktree, ".deepcode", "cache");
|
|
4561
4648
|
await mkdir2(dir, { recursive: true });
|
|
4562
4649
|
const now = Date.now();
|
|
4563
4650
|
const entry = {
|
|
@@ -4570,10 +4657,10 @@ var ToolCache = class {
|
|
|
4570
4657
|
`, "utf8");
|
|
4571
4658
|
}
|
|
4572
4659
|
async clear() {
|
|
4573
|
-
await rm2(
|
|
4660
|
+
await rm2(path3.join(this.worktree, ".deepcode", "cache"), { recursive: true, force: true });
|
|
4574
4661
|
}
|
|
4575
4662
|
filePath(key) {
|
|
4576
|
-
return
|
|
4663
|
+
return path3.join(this.worktree, ".deepcode", "cache", `${key}.json`);
|
|
4577
4664
|
}
|
|
4578
4665
|
};
|
|
4579
4666
|
function cacheKey(namespace, keyParts) {
|
|
@@ -4581,12 +4668,12 @@ function cacheKey(namespace, keyParts) {
|
|
|
4581
4668
|
}
|
|
4582
4669
|
var ConfigLoader = class {
|
|
4583
4670
|
resolveConfigPath(options) {
|
|
4584
|
-
return options.configPath ?
|
|
4671
|
+
return options.configPath ? path4.resolve(options.configPath) : path4.join(options.cwd, ".deepcode", "config.json");
|
|
4585
4672
|
}
|
|
4586
4673
|
async load(options) {
|
|
4587
4674
|
const configPath = this.resolveConfigPath(options);
|
|
4588
4675
|
const rawFile = await this.readOptionalJson(configPath);
|
|
4589
|
-
const cwd =
|
|
4676
|
+
const cwd = path4.dirname(configPath) === path4.join(path4.resolve(options.cwd), ".deepcode") ? path4.resolve(options.cwd) : path4.dirname(configPath);
|
|
4590
4677
|
const openrouterApiKeyFile = parseOptionalString(process.env.OPENROUTER_API_KEY_FILE) ?? rawFile.providers?.openrouter?.apiKeyFile;
|
|
4591
4678
|
const anthropicApiKeyFile = parseOptionalString(process.env.ANTHROPIC_API_KEY_FILE) ?? rawFile.providers?.anthropic?.apiKeyFile;
|
|
4592
4679
|
const openaiApiKeyFile = parseOptionalString(process.env.OPENAI_API_KEY_FILE) ?? rawFile.providers?.openai?.apiKeyFile;
|
|
@@ -4668,14 +4755,14 @@ var ConfigLoader = class {
|
|
|
4668
4755
|
if (!parsed.success) {
|
|
4669
4756
|
throw new ConfigError(`Invalid DeepCode config: ${parsed.error.message}`, parsed.error);
|
|
4670
4757
|
}
|
|
4671
|
-
await mkdir22(
|
|
4758
|
+
await mkdir22(path4.dirname(configPath), { recursive: true });
|
|
4672
4759
|
await writeFileAtomic(configPath, `${JSON.stringify(parsed.data, null, 2)}
|
|
4673
4760
|
`);
|
|
4674
4761
|
return configPath;
|
|
4675
4762
|
}
|
|
4676
4763
|
async init(cwd) {
|
|
4677
|
-
const dir =
|
|
4678
|
-
const configPath =
|
|
4764
|
+
const dir = path4.join(cwd, ".deepcode");
|
|
4765
|
+
const configPath = path4.join(dir, "config.json");
|
|
4679
4766
|
await mkdir22(dir, { recursive: true });
|
|
4680
4767
|
const config = DeepCodeConfigSchema.parse({});
|
|
4681
4768
|
await writeFileAtomic(configPath, `${JSON.stringify(config, null, 2)}
|
|
@@ -4727,7 +4814,7 @@ function normalizeLabel(value) {
|
|
|
4727
4814
|
function resolveUserPath(filePath, cwd) {
|
|
4728
4815
|
if (!filePath) return void 0;
|
|
4729
4816
|
const expanded = filePath === "~" ? os.homedir() : filePath.replace(/^~(?=\/|\\)/, os.homedir());
|
|
4730
|
-
return
|
|
4817
|
+
return path4.isAbsolute(expanded) ? expanded : path4.resolve(cwd, expanded);
|
|
4731
4818
|
}
|
|
4732
4819
|
function parseOptionalBoolean(value) {
|
|
4733
4820
|
if (value === void 0) return void 0;
|
|
@@ -4903,13 +4990,13 @@ var GitHubClient = class {
|
|
|
4903
4990
|
}
|
|
4904
4991
|
return parseGitHubRemote(result.stdout.trim());
|
|
4905
4992
|
}
|
|
4906
|
-
async request(
|
|
4993
|
+
async request(path15, init = {}) {
|
|
4907
4994
|
if (!this.options.token) {
|
|
4908
4995
|
throw new Error(
|
|
4909
4996
|
"GitHub token is required. Set GITHUB_TOKEN or .deepcode/config.json github.token."
|
|
4910
4997
|
);
|
|
4911
4998
|
}
|
|
4912
|
-
const response = await fetch(`${this.apiBase}${
|
|
4999
|
+
const response = await fetch(`${this.apiBase}${path15}`, {
|
|
4913
5000
|
...init,
|
|
4914
5001
|
headers: {
|
|
4915
5002
|
accept: "application/vnd.github+json",
|
|
@@ -4925,13 +5012,13 @@ var GitHubClient = class {
|
|
|
4925
5012
|
if (response.status === 204) return void 0;
|
|
4926
5013
|
return await response.json();
|
|
4927
5014
|
}
|
|
4928
|
-
async requestText(
|
|
5015
|
+
async requestText(path15, init = {}) {
|
|
4929
5016
|
if (!this.options.token) {
|
|
4930
5017
|
throw new Error(
|
|
4931
5018
|
"GitHub token is required. Set GITHUB_TOKEN or .deepcode/config.json github.token."
|
|
4932
5019
|
);
|
|
4933
5020
|
}
|
|
4934
|
-
const response = await fetch(`${this.apiBase}${
|
|
5021
|
+
const response = await fetch(`${this.apiBase}${path15}`, {
|
|
4935
5022
|
...init,
|
|
4936
5023
|
headers: {
|
|
4937
5024
|
accept: "application/vnd.github+json",
|
|
@@ -5272,7 +5359,7 @@ var LspClient = class {
|
|
|
5272
5359
|
await this.request("initialize", {
|
|
5273
5360
|
processId: process.pid,
|
|
5274
5361
|
rootUri: toFileUri(this.rootPath),
|
|
5275
|
-
workspaceFolders: [{ uri: toFileUri(this.rootPath), name:
|
|
5362
|
+
workspaceFolders: [{ uri: toFileUri(this.rootPath), name: path5.basename(this.rootPath) }],
|
|
5276
5363
|
capabilities: {
|
|
5277
5364
|
workspace: {
|
|
5278
5365
|
symbol: {
|
|
@@ -5374,7 +5461,7 @@ var LspClient = class {
|
|
|
5374
5461
|
}
|
|
5375
5462
|
};
|
|
5376
5463
|
function pickLanguageServer(servers, rootPath, queryPath) {
|
|
5377
|
-
const extension =
|
|
5464
|
+
const extension = path5.extname(queryPath);
|
|
5378
5465
|
const byExtension = servers.find((server) => server.fileExtensions.includes(extension));
|
|
5379
5466
|
if (byExtension) return byExtension;
|
|
5380
5467
|
const projectFiles = [
|
|
@@ -5384,14 +5471,14 @@ function pickLanguageServer(servers, rootPath, queryPath) {
|
|
|
5384
5471
|
["Cargo.toml", "rust"],
|
|
5385
5472
|
["go.mod", "go"]
|
|
5386
5473
|
];
|
|
5387
|
-
const detected = projectFiles.find(([file]) => pathExists(
|
|
5474
|
+
const detected = projectFiles.find(([file]) => pathExists(path5.join(rootPath, file)))?.[1];
|
|
5388
5475
|
return detected ? servers.find((server) => server.languages.includes(detected)) : servers[0];
|
|
5389
5476
|
}
|
|
5390
5477
|
function pathExists(filePath) {
|
|
5391
5478
|
return existsSync(filePath);
|
|
5392
5479
|
}
|
|
5393
5480
|
function toFileUri(filePath) {
|
|
5394
|
-
return `file://${
|
|
5481
|
+
return `file://${path5.resolve(filePath).replaceAll(path5.sep, "/")}`;
|
|
5395
5482
|
}
|
|
5396
5483
|
function fromFileUri(uri) {
|
|
5397
5484
|
return decodeURIComponent(uri.replace(/^file:\/\//, ""));
|
|
@@ -5399,12 +5486,12 @@ function fromFileUri(uri) {
|
|
|
5399
5486
|
var SECRET_KEY_PATTERN = /(api[_-]?key|token|authorization|secret|password|passwd|credential|private[_-]?key)/i;
|
|
5400
5487
|
var MIN_SECRET_VALUE_LENGTH = 4;
|
|
5401
5488
|
function redactSecrets(value, options = {}) {
|
|
5402
|
-
const
|
|
5489
|
+
const path15 = options.path ?? [];
|
|
5403
5490
|
const secretPlaceholder = options.secretPlaceholder ?? "[redacted]";
|
|
5404
5491
|
const emptySecretPlaceholder = options.emptySecretPlaceholder ?? "[empty]";
|
|
5405
5492
|
const secretValues = options.secretValues ?? collectSecretValues();
|
|
5406
5493
|
if (typeof value === "string") {
|
|
5407
|
-
if (isSecretPath(
|
|
5494
|
+
if (isSecretPath(path15)) {
|
|
5408
5495
|
return value.length > 0 ? secretPlaceholder : emptySecretPlaceholder;
|
|
5409
5496
|
}
|
|
5410
5497
|
return redactText(value, secretValues, secretPlaceholder);
|
|
@@ -5413,7 +5500,7 @@ function redactSecrets(value, options = {}) {
|
|
|
5413
5500
|
return value.map(
|
|
5414
5501
|
(item, index) => redactSecrets(item, {
|
|
5415
5502
|
...options,
|
|
5416
|
-
path: [...
|
|
5503
|
+
path: [...path15, String(index)],
|
|
5417
5504
|
secretValues
|
|
5418
5505
|
})
|
|
5419
5506
|
);
|
|
@@ -5424,7 +5511,7 @@ function redactSecrets(value, options = {}) {
|
|
|
5424
5511
|
key,
|
|
5425
5512
|
redactSecrets(item, {
|
|
5426
5513
|
...options,
|
|
5427
|
-
path: [...
|
|
5514
|
+
path: [...path15, key],
|
|
5428
5515
|
secretValues
|
|
5429
5516
|
})
|
|
5430
5517
|
])
|
|
@@ -5462,8 +5549,8 @@ function collectSecretValues(config) {
|
|
|
5462
5549
|
}
|
|
5463
5550
|
return [...values].sort((left, right) => right.length - left.length);
|
|
5464
5551
|
}
|
|
5465
|
-
function isSecretPath(
|
|
5466
|
-
const key =
|
|
5552
|
+
function isSecretPath(path15) {
|
|
5553
|
+
const key = path15[path15.length - 1] ?? "";
|
|
5467
5554
|
if (/(api[_-]?key|token|secret|credential).*file/i.test(key)) return false;
|
|
5468
5555
|
return SECRET_KEY_PATTERN.test(key);
|
|
5469
5556
|
}
|
|
@@ -6321,10 +6408,10 @@ var AuditLogger = class {
|
|
|
6321
6408
|
}
|
|
6322
6409
|
worktree;
|
|
6323
6410
|
async log(entry) {
|
|
6324
|
-
const dir =
|
|
6411
|
+
const dir = path6.join(this.worktree, ".deepcode");
|
|
6325
6412
|
await mkdir3(dir, { recursive: true });
|
|
6326
6413
|
const payload = redactSecrets({ ...entry, createdAt: entry.createdAt ?? nowIso() });
|
|
6327
|
-
await appendFile(
|
|
6414
|
+
await appendFile(path6.join(dir, "audit.log"), `${JSON.stringify(payload)}
|
|
6328
6415
|
`, "utf8");
|
|
6329
6416
|
}
|
|
6330
6417
|
};
|
|
@@ -6366,7 +6453,7 @@ var PathSecurity = class {
|
|
|
6366
6453
|
return resolved;
|
|
6367
6454
|
}
|
|
6368
6455
|
classify(targetPath) {
|
|
6369
|
-
const candidate =
|
|
6456
|
+
const candidate = path7.normalize(targetPath);
|
|
6370
6457
|
const blacklisted = this.rules.blacklist.some((rule) => globToRegex(rule).test(candidate));
|
|
6371
6458
|
if (blacklisted) {
|
|
6372
6459
|
return "blacklisted";
|
|
@@ -6379,8 +6466,8 @@ var PathSecurity = class {
|
|
|
6379
6466
|
}
|
|
6380
6467
|
async resolvePath(inputPath) {
|
|
6381
6468
|
const expanded = this.expandUserPath(inputPath);
|
|
6382
|
-
const absolute =
|
|
6383
|
-
const normalized2 =
|
|
6469
|
+
const absolute = path7.isAbsolute(expanded) ? expanded : path7.resolve(this.worktree, expanded);
|
|
6470
|
+
const normalized2 = path7.normalize(absolute);
|
|
6384
6471
|
const resolved = await this.resolveExistingParent(normalized2);
|
|
6385
6472
|
return resolved;
|
|
6386
6473
|
}
|
|
@@ -6392,7 +6479,7 @@ var PathSecurity = class {
|
|
|
6392
6479
|
const duplicatedHomePrefix = normalizedHome ? `~/${normalizedHome}` : "";
|
|
6393
6480
|
if (duplicatedHomePrefix && (normalizedInput === duplicatedHomePrefix || normalizedInput.startsWith(`${duplicatedHomePrefix}/`))) {
|
|
6394
6481
|
const absoluteSuffix = normalizedInput.slice(2);
|
|
6395
|
-
return
|
|
6482
|
+
return path7.sep === "\\" ? absoluteSuffix.replace(/\//g, "\\") : `/${absoluteSuffix}`;
|
|
6396
6483
|
}
|
|
6397
6484
|
return inputPath.replace(/^~(?=\/|\\)/, this.home);
|
|
6398
6485
|
}
|
|
@@ -6401,16 +6488,16 @@ var PathSecurity = class {
|
|
|
6401
6488
|
}
|
|
6402
6489
|
async resolveExistingParent(targetPath) {
|
|
6403
6490
|
let cursor = targetPath;
|
|
6404
|
-
while (cursor !==
|
|
6491
|
+
while (cursor !== path7.dirname(cursor)) {
|
|
6405
6492
|
try {
|
|
6406
6493
|
await access(cursor);
|
|
6407
6494
|
const real = await realpath(cursor);
|
|
6408
6495
|
if (targetPath === cursor) {
|
|
6409
6496
|
return real;
|
|
6410
6497
|
}
|
|
6411
|
-
return
|
|
6498
|
+
return path7.join(real, path7.relative(cursor, targetPath));
|
|
6412
6499
|
} catch {
|
|
6413
|
-
cursor =
|
|
6500
|
+
cursor = path7.dirname(cursor);
|
|
6414
6501
|
}
|
|
6415
6502
|
}
|
|
6416
6503
|
return targetPath;
|
|
@@ -6708,16 +6795,16 @@ function whitelistExampleForPath(targetPath) {
|
|
|
6708
6795
|
return "${WORKTREE}/**";
|
|
6709
6796
|
}
|
|
6710
6797
|
const home = process.env.HOME ?? os3.homedir();
|
|
6711
|
-
const normalizedTarget =
|
|
6712
|
-
const normalizedHome =
|
|
6798
|
+
const normalizedTarget = path8.resolve(targetPath);
|
|
6799
|
+
const normalizedHome = path8.resolve(home);
|
|
6713
6800
|
if (normalizedTarget === normalizedHome) {
|
|
6714
6801
|
return "${HOME}/**";
|
|
6715
6802
|
}
|
|
6716
|
-
if (normalizedTarget.startsWith(`${normalizedHome}${
|
|
6717
|
-
const relative2 =
|
|
6803
|
+
if (normalizedTarget.startsWith(`${normalizedHome}${path8.sep}`)) {
|
|
6804
|
+
const relative2 = path8.relative(normalizedHome, normalizedTarget).replaceAll(path8.sep, "/");
|
|
6718
6805
|
return relative2 ? `\${HOME}/${relative2}/**` : "${HOME}/**";
|
|
6719
6806
|
}
|
|
6720
|
-
const normalizedForConfig = normalizedTarget.replaceAll(
|
|
6807
|
+
const normalizedForConfig = normalizedTarget.replaceAll(path8.sep, "/");
|
|
6721
6808
|
if (normalizedForConfig === "/") {
|
|
6722
6809
|
return "/**";
|
|
6723
6810
|
}
|
|
@@ -6777,20 +6864,20 @@ var SessionManager = class {
|
|
|
6777
6864
|
}
|
|
6778
6865
|
async persist(sessionId) {
|
|
6779
6866
|
const session = this.get(sessionId);
|
|
6780
|
-
const dir =
|
|
6867
|
+
const dir = path9.join(this.worktree, ".deepcode", "sessions");
|
|
6781
6868
|
await mkdir4(dir, { recursive: true });
|
|
6782
|
-
const filePath =
|
|
6869
|
+
const filePath = path9.join(dir, `${session.id}.json`);
|
|
6783
6870
|
await writeFileAtomic(filePath, `${JSON.stringify(session, null, 2)}
|
|
6784
6871
|
`);
|
|
6785
6872
|
return filePath;
|
|
6786
6873
|
}
|
|
6787
6874
|
async loadAll() {
|
|
6788
|
-
const dir =
|
|
6875
|
+
const dir = path9.join(this.worktree, ".deepcode", "sessions");
|
|
6789
6876
|
try {
|
|
6790
6877
|
const entries = await readdir2(dir);
|
|
6791
6878
|
const loaded = [];
|
|
6792
6879
|
for (const entry of entries.filter((value) => value.endsWith(".json"))) {
|
|
6793
|
-
const filePath =
|
|
6880
|
+
const filePath = path9.join(dir, entry);
|
|
6794
6881
|
try {
|
|
6795
6882
|
const parsed = JSON.parse(await readFile3(filePath, "utf8"));
|
|
6796
6883
|
const result = SessionSchema.safeParse(parsed);
|
|
@@ -6838,7 +6925,7 @@ var analyzeCodeTool = defineTool({
|
|
|
6838
6925
|
const declarations = content.split(/\r?\n/).map((line, index) => ({ line: index + 1, text: line.trim() })).filter(({ text }) => /^(export\s+)?(class|interface|type|function|const|let|var|def|func)\s+/.test(text));
|
|
6839
6926
|
const result = {
|
|
6840
6927
|
file: filePath,
|
|
6841
|
-
extension:
|
|
6928
|
+
extension: path11.extname(filePath),
|
|
6842
6929
|
lines: content.split(/\r?\n/).length,
|
|
6843
6930
|
declarations
|
|
6844
6931
|
};
|
|
@@ -6907,7 +6994,7 @@ var readFileTool = defineTool({
|
|
|
6907
6994
|
if (cached.hit && cached.value !== void 0) {
|
|
6908
6995
|
context.logActivity({
|
|
6909
6996
|
type: "cache_hit",
|
|
6910
|
-
message: `Cache hit read_file ${
|
|
6997
|
+
message: `Cache hit read_file ${path12.relative(context.worktree, filePath)}`,
|
|
6911
6998
|
metadata: { path: filePath }
|
|
6912
6999
|
});
|
|
6913
7000
|
return cached.value;
|
|
@@ -6918,7 +7005,7 @@ var readFileTool = defineTool({
|
|
|
6918
7005
|
const end = args.limit ? Math.min(lines.length, start + args.limit) : lines.length;
|
|
6919
7006
|
context.logActivity({
|
|
6920
7007
|
type: "file_read",
|
|
6921
|
-
message: `Read ${
|
|
7008
|
+
message: `Read ${path12.relative(context.worktree, filePath)}`,
|
|
6922
7009
|
metadata: { path: filePath, lines: end - start }
|
|
6923
7010
|
});
|
|
6924
7011
|
const output = lines.slice(start, end).map((line, index) => `${String(start + index + 1).padStart(5, " ")} | ${line}`).join("\n");
|
|
@@ -6940,11 +7027,11 @@ var writeFileTool = defineTool({
|
|
|
6940
7027
|
const filePath = await context.pathSecurity.normalize(args.path, { enforceAccess: false });
|
|
6941
7028
|
await context.permissions.ensure({ operation: "write_file", kind: "write", path: filePath });
|
|
6942
7029
|
await context.snapshotForUndo?.(filePath);
|
|
6943
|
-
await mkdir6(
|
|
7030
|
+
await mkdir6(path12.dirname(filePath), { recursive: true });
|
|
6944
7031
|
await writeFile22(filePath, args.content, "utf8");
|
|
6945
7032
|
context.logActivity({
|
|
6946
7033
|
type: "file_written",
|
|
6947
|
-
message: `Wrote ${
|
|
7034
|
+
message: `Wrote ${path12.relative(context.worktree, filePath)}`,
|
|
6948
7035
|
metadata: { path: filePath, bytes: Buffer.byteLength(args.content) }
|
|
6949
7036
|
});
|
|
6950
7037
|
return `File written: ${filePath}`;
|
|
@@ -6977,7 +7064,7 @@ var editFileTool = defineTool({
|
|
|
6977
7064
|
await writeFile22(filePath, next, "utf8");
|
|
6978
7065
|
context.logActivity({
|
|
6979
7066
|
type: "file_edited",
|
|
6980
|
-
message: `Edited ${
|
|
7067
|
+
message: `Edited ${path12.relative(context.worktree, filePath)}`,
|
|
6981
7068
|
metadata: { path: filePath, removedBytes: args.oldString.length, addedBytes: args.newString.length }
|
|
6982
7069
|
});
|
|
6983
7070
|
return `File edited: ${filePath}`;
|
|
@@ -6998,7 +7085,7 @@ var listDirTool = defineTool({
|
|
|
6998
7085
|
const entries = await readdir4(dirPath, { withFileTypes: true });
|
|
6999
7086
|
const rows = await Promise.all(
|
|
7000
7087
|
entries.filter((entry) => entry.name !== "node_modules" && entry.name !== ".git").map(async (entry) => {
|
|
7001
|
-
const fullPath =
|
|
7088
|
+
const fullPath = path12.join(dirPath, entry.name);
|
|
7002
7089
|
try {
|
|
7003
7090
|
const info = await lstat2(fullPath);
|
|
7004
7091
|
const type = entry.isSymbolicLink() ? "link" : entry.isDirectory() ? "dir " : "file";
|
|
@@ -7011,7 +7098,7 @@ var listDirTool = defineTool({
|
|
|
7011
7098
|
);
|
|
7012
7099
|
context.logActivity({
|
|
7013
7100
|
type: "directory_listed",
|
|
7014
|
-
message: `Listed ${
|
|
7101
|
+
message: `Listed ${path12.relative(context.worktree, dirPath) || "."}`,
|
|
7015
7102
|
metadata: { path: dirPath, entries: rows.length }
|
|
7016
7103
|
});
|
|
7017
7104
|
return rows.join("\n");
|
|
@@ -7130,7 +7217,7 @@ var searchTextTool = defineTool({
|
|
|
7130
7217
|
if (cached.hit && cached.value !== void 0) {
|
|
7131
7218
|
context.logActivity({
|
|
7132
7219
|
type: "cache_hit",
|
|
7133
|
-
message: `Cache hit search_text ${
|
|
7220
|
+
message: `Cache hit search_text ${path13.relative(context.worktree, searchPath) || "."}`,
|
|
7134
7221
|
metadata: { pattern: args.pattern }
|
|
7135
7222
|
});
|
|
7136
7223
|
return cached.value;
|
|
@@ -7155,7 +7242,7 @@ var searchTextTool = defineTool({
|
|
|
7155
7242
|
}));
|
|
7156
7243
|
context.logActivity({
|
|
7157
7244
|
type: "text_search",
|
|
7158
|
-
message: `Searched ${
|
|
7245
|
+
message: `Searched ${path13.relative(context.worktree, searchPath) || "."}`,
|
|
7159
7246
|
metadata: { pattern: args.pattern, matches: matches.length }
|
|
7160
7247
|
});
|
|
7161
7248
|
const output = JSON.stringify(matches, null, 2);
|
|
@@ -7195,7 +7282,7 @@ var searchFilesTool = defineTool({
|
|
|
7195
7282
|
throw new Error(result.stderr || `ripgrep exited with ${result.exitCode}`);
|
|
7196
7283
|
}
|
|
7197
7284
|
const needle = args.query.toLowerCase();
|
|
7198
|
-
const files = result.stdout.split(/\r?\n/).filter(Boolean).filter((file) =>
|
|
7285
|
+
const files = result.stdout.split(/\r?\n/).filter(Boolean).filter((file) => path13.basename(file).toLowerCase().includes(needle)).slice(0, 200);
|
|
7199
7286
|
context.logActivity({
|
|
7200
7287
|
type: "file_search",
|
|
7201
7288
|
message: `Found ${files.length} file(s)`,
|
|
@@ -7515,6 +7602,56 @@ function createDefaultToolRegistry() {
|
|
|
7515
7602
|
registry.register(fetchWebTool);
|
|
7516
7603
|
return registry;
|
|
7517
7604
|
}
|
|
7605
|
+
var TaskSchema2 = z11.object({
|
|
7606
|
+
prompt: z11.string().describe("Full task description for the subagent \u2014 be specific and self-contained."),
|
|
7607
|
+
subagent_type: z11.string().optional().describe(
|
|
7608
|
+
"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."
|
|
7609
|
+
),
|
|
7610
|
+
provider: z11.string().optional().describe("Provider override (e.g. 'anthropic', 'openai'). Defaults to current provider."),
|
|
7611
|
+
model: z11.string().optional().describe("Model override. Defaults to current model."),
|
|
7612
|
+
fork: z11.boolean().optional().describe("If true, the subagent starts with the current conversation history as context.")
|
|
7613
|
+
});
|
|
7614
|
+
function createTaskTool(subagents, worktree) {
|
|
7615
|
+
return defineTool({
|
|
7616
|
+
name: "task",
|
|
7617
|
+
description: "Launch a subagent to handle a self-contained task in a child session. The subagent has full access to all tools (read, write, bash, git, search, etc.). Use for parallelizable work, delegating a well-scoped subtask, or specialized analysis. Set fork=true to give the subagent the current conversation history as starting context. Set subagent_type to the name of a named agent defined in .deepcode/agents/*.md.",
|
|
7618
|
+
parameters: TaskSchema2,
|
|
7619
|
+
execute: (args, context) => Effect10.tryPromise(async () => {
|
|
7620
|
+
const taskId = createId("task");
|
|
7621
|
+
let systemPrompt;
|
|
7622
|
+
let allowedTools;
|
|
7623
|
+
let disallowedTools;
|
|
7624
|
+
let resolvedModel = args.model;
|
|
7625
|
+
if (args.subagent_type) {
|
|
7626
|
+
const configs = loadAgentConfigs(worktree);
|
|
7627
|
+
const agentConfig = configs.find((c) => c.name === args.subagent_type);
|
|
7628
|
+
if (!agentConfig) {
|
|
7629
|
+
throw new Error(
|
|
7630
|
+
`Unknown subagent_type '${args.subagent_type}'. Available: ${configs.map((c) => c.name).join(", ") || "(none \u2014 create .deepcode/agents/<name>.md)"}`
|
|
7631
|
+
);
|
|
7632
|
+
}
|
|
7633
|
+
systemPrompt = agentConfig.systemPrompt || void 0;
|
|
7634
|
+
allowedTools = agentConfig.allowedTools;
|
|
7635
|
+
disallowedTools = agentConfig.disallowedTools;
|
|
7636
|
+
if (!resolvedModel && agentConfig.model) resolvedModel = agentConfig.model;
|
|
7637
|
+
}
|
|
7638
|
+
const task = {
|
|
7639
|
+
id: taskId,
|
|
7640
|
+
prompt: args.prompt,
|
|
7641
|
+
provider: args.provider,
|
|
7642
|
+
model: resolvedModel,
|
|
7643
|
+
systemPrompt,
|
|
7644
|
+
allowedTools,
|
|
7645
|
+
disallowedTools
|
|
7646
|
+
};
|
|
7647
|
+
const result = args.fork ? await subagents.forkFrom(context.sessionId, task, context.abortSignal) : await subagents.runOne(task, context.abortSignal);
|
|
7648
|
+
if (result.error) {
|
|
7649
|
+
throw new Error(`Subagent failed: ${result.error}`);
|
|
7650
|
+
}
|
|
7651
|
+
return result.output || "(subagent completed with no output)";
|
|
7652
|
+
})
|
|
7653
|
+
});
|
|
7654
|
+
}
|
|
7518
7655
|
var PROJECT_MARKER2 = ".git";
|
|
7519
7656
|
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
7520
7657
|
".git",
|
|
@@ -7554,7 +7691,7 @@ async function walk(directory, depthRemaining, results, seen) {
|
|
|
7554
7691
|
entries.filter(
|
|
7555
7692
|
(e) => e.isDirectory() && !SKIP_DIRS.has(e.name) && !e.name.startsWith(".")
|
|
7556
7693
|
).map(async (e) => {
|
|
7557
|
-
const fullPath =
|
|
7694
|
+
const fullPath = path14.join(directory, e.name);
|
|
7558
7695
|
try {
|
|
7559
7696
|
const info = await lstat3(fullPath);
|
|
7560
7697
|
if (!info.isSymbolicLink()) {
|
|
@@ -7615,7 +7752,7 @@ async function enrichProjects(paths, concurrency = 8) {
|
|
|
7615
7752
|
}
|
|
7616
7753
|
|
|
7617
7754
|
// ../../packages/cli/dist/index.js
|
|
7618
|
-
import
|
|
7755
|
+
import path10 from "path";
|
|
7619
7756
|
import { writeSync } from "fs";
|
|
7620
7757
|
import { mkdtemp, rm as rm3 } from "fs/promises";
|
|
7621
7758
|
import { tmpdir } from "os";
|
|
@@ -7628,11 +7765,11 @@ import path32 from "path";
|
|
|
7628
7765
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7629
7766
|
import fs6 from "fs";
|
|
7630
7767
|
import path112 from "path";
|
|
7631
|
-
import { isValidElement, useCallback as
|
|
7632
|
-
import { Box as
|
|
7768
|
+
import { isValidElement, useCallback as useCallback23, useEffect as useEffect25, useMemo as useMemo15, useRef as useRef17, useState as useState27 } from "react";
|
|
7769
|
+
import { Box as Box39, Text as Text47, useInput as useInput4, useStdin as useStdin3 } from "ink";
|
|
7633
7770
|
import os4 from "os";
|
|
7634
7771
|
import path62 from "path";
|
|
7635
|
-
import
|
|
7772
|
+
import fs2 from "fs";
|
|
7636
7773
|
import path42 from "path";
|
|
7637
7774
|
|
|
7638
7775
|
// ../../node_modules/.pnpm/fzf@0.5.2/node_modules/fzf/dist/fzf.es.js
|
|
@@ -8766,7 +8903,7 @@ function stringWidth(string, options = {}) {
|
|
|
8766
8903
|
// ../../packages/cli/dist/index.js
|
|
8767
8904
|
import React9 from "react";
|
|
8768
8905
|
import { Text as Text7, Box as Box6 } from "ink";
|
|
8769
|
-
import * as
|
|
8906
|
+
import * as fs22 from "fs";
|
|
8770
8907
|
import * as path72 from "path";
|
|
8771
8908
|
import * as os22 from "os";
|
|
8772
8909
|
import process3 from "process";
|
|
@@ -9549,14 +9686,14 @@ import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
|
9549
9686
|
import { Box as Box22, Text as Text25 } from "ink";
|
|
9550
9687
|
import { jsxs as jsxs21 } from "react/jsx-runtime";
|
|
9551
9688
|
import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
9552
|
-
import { Box as Box31, Text as
|
|
9553
|
-
import { useCallback as
|
|
9689
|
+
import { Box as Box31, Text as Text39, useIsScreenReaderEnabled as useIsScreenReaderEnabled3 } from "ink";
|
|
9690
|
+
import { useCallback as useCallback17, useState as useState222 } from "react";
|
|
9554
9691
|
import { useRef as useRef7 } from "react";
|
|
9555
9692
|
import { Box as Box24, Text as Text26 } from "ink";
|
|
9556
9693
|
import { useEffect as useEffect13, useState as useState11 } from "react";
|
|
9557
9694
|
import { useEffect as useEffect14, useRef as useRef6, useState as useState12 } from "react";
|
|
9558
9695
|
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
9559
|
-
import { useCallback as
|
|
9696
|
+
import { useCallback as useCallback15, useEffect as useEffect21, useMemo as useMemo9, useState as useState19, useRef as useRef12 } from "react";
|
|
9560
9697
|
import { Box as Box27, Text as Text30 } from "ink";
|
|
9561
9698
|
import { Box as Box25, Text as Text28 } from "ink";
|
|
9562
9699
|
import React22 from "react";
|
|
@@ -9574,16 +9711,17 @@ import { useCallback as useCallback11, useMemo as useMemo7, useEffect as useEffe
|
|
|
9574
9711
|
import { useEffect as useEffect17, useReducer as useReducer3, useRef as useRef9 } from "react";
|
|
9575
9712
|
import { useState as useState17, useEffect as useEffect18, useMemo as useMemo6 } from "react";
|
|
9576
9713
|
import { useCallback as useCallback12, useEffect as useEffect20, useMemo as useMemo8, useRef as useRef10 } from "react";
|
|
9714
|
+
import { useState as useState18, useCallback as useCallback13, useRef as useRef11 } from "react";
|
|
9577
9715
|
import * as path102 from "path";
|
|
9578
9716
|
import { createContext as createContext5, useContext as useContext6 } from "react";
|
|
9579
9717
|
import { createContext as createContext6, useContext as useContext7 } from "react";
|
|
9580
9718
|
import { createContext as createContext7, useContext as useContext8 } from "react";
|
|
9581
|
-
import { useCallback as
|
|
9719
|
+
import { useCallback as useCallback14 } from "react";
|
|
9582
9720
|
import { Box as Box26, Text as Text29 } from "ink";
|
|
9583
9721
|
import chalk2 from "chalk";
|
|
9584
9722
|
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
9585
9723
|
import { Fragment as Fragment7, jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
9586
|
-
import { Box as Box28, Text as
|
|
9724
|
+
import { Box as Box28, Text as Text36 } from "ink";
|
|
9587
9725
|
import { Text as Text31 } from "ink";
|
|
9588
9726
|
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
9589
9727
|
import { Text as Text32 } from "ink";
|
|
@@ -9592,44 +9730,48 @@ import { Text as Text33 } from "ink";
|
|
|
9592
9730
|
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
9593
9731
|
import { Text as Text34 } from "ink";
|
|
9594
9732
|
import { jsxs as jsxs31 } from "react/jsx-runtime";
|
|
9595
|
-
import {
|
|
9733
|
+
import { Text as Text35 } from "ink";
|
|
9734
|
+
import { jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9735
|
+
import { useState as useState20, useEffect as useEffect222 } from "react";
|
|
9596
9736
|
import { execFile as execFile22 } from "child_process";
|
|
9597
9737
|
import os42 from "os";
|
|
9598
9738
|
import {
|
|
9599
9739
|
createContext as createContext8,
|
|
9600
|
-
useCallback as
|
|
9740
|
+
useCallback as useCallback16,
|
|
9601
9741
|
useContext as useContext9,
|
|
9602
|
-
useState as
|
|
9742
|
+
useState as useState21
|
|
9603
9743
|
} from "react";
|
|
9604
9744
|
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
9605
|
-
import { jsx as jsx37, jsxs as
|
|
9606
|
-
import { useRef as
|
|
9607
|
-
import { Box as Box29, Text as
|
|
9608
|
-
import { jsx as jsx38, jsxs as
|
|
9609
|
-
import { Box as Box30, Text as
|
|
9610
|
-
import { jsx as jsx39, jsxs as
|
|
9611
|
-
import { jsx as jsx40, jsxs as
|
|
9612
|
-
import { Box as Box32, Text as
|
|
9613
|
-
import { jsx as jsx41, jsxs as
|
|
9614
|
-
import { useCallback as
|
|
9615
|
-
import { Box as Box33, Text as
|
|
9616
|
-
import { jsx as jsx42, jsxs as
|
|
9617
|
-
import { useCallback as
|
|
9618
|
-
import { Box as Box34, Text as
|
|
9619
|
-
import { Fragment as Fragment9, jsx as jsx43, jsxs as
|
|
9620
|
-
import { useCallback as
|
|
9621
|
-
import { Box as Box35, Text as
|
|
9622
|
-
import { jsx as jsx44, jsxs as
|
|
9623
|
-
import { useCallback as
|
|
9624
|
-
import { Box as Box36, Text as
|
|
9625
|
-
import { jsx as jsx45, jsxs as
|
|
9626
|
-
import { useCallback as
|
|
9627
|
-
import { Box as Box37, Text as
|
|
9628
|
-
import { jsx as jsx46, jsxs as
|
|
9629
|
-
import {
|
|
9630
|
-
import { jsx as
|
|
9745
|
+
import { jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9746
|
+
import { useRef as useRef13 } from "react";
|
|
9747
|
+
import { Box as Box29, Text as Text37 } from "ink";
|
|
9748
|
+
import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
9749
|
+
import { Box as Box30, Text as Text38 } from "ink";
|
|
9750
|
+
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9751
|
+
import { jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9752
|
+
import { Box as Box32, Text as Text40 } from "ink";
|
|
9753
|
+
import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9754
|
+
import { useCallback as useCallback18, useMemo as useMemo10, useRef as useRef14 } from "react";
|
|
9755
|
+
import { Box as Box33, Text as Text41 } from "ink";
|
|
9756
|
+
import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9757
|
+
import { useCallback as useCallback19, useMemo as useMemo11, useState as useState23 } from "react";
|
|
9758
|
+
import { Box as Box34, Text as Text42, useInput as useInput2 } from "ink";
|
|
9759
|
+
import { Fragment as Fragment9, jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9760
|
+
import { useCallback as useCallback20, useMemo as useMemo12, useState as useState24 } from "react";
|
|
9761
|
+
import { Box as Box35, Text as Text43 } from "ink";
|
|
9762
|
+
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9763
|
+
import { useCallback as useCallback21, useEffect as useEffect23, useMemo as useMemo13, useRef as useRef15, useState as useState25 } from "react";
|
|
9764
|
+
import { Box as Box36, Text as Text44 } from "ink";
|
|
9765
|
+
import { jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9766
|
+
import { useCallback as useCallback22, useEffect as useEffect24, useMemo as useMemo14, useRef as useRef16, useState as useState26 } from "react";
|
|
9767
|
+
import { Box as Box37, Text as Text45, useInput as useInput3 } from "ink";
|
|
9768
|
+
import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
9769
|
+
import { Box as Box38, Text as Text46 } from "ink";
|
|
9770
|
+
import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
9771
|
+
import { jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
9772
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
9631
9773
|
async function createRuntime(options) {
|
|
9632
|
-
const worktree =
|
|
9774
|
+
const worktree = path10.resolve(options.cwd);
|
|
9633
9775
|
const config = await new ConfigLoader().load({ cwd: worktree, configPath: options.configPath });
|
|
9634
9776
|
const events = new EventBus();
|
|
9635
9777
|
const pathSecurity = new PathSecurity(worktree, config.paths);
|
|
@@ -9669,8 +9811,10 @@ async function createRuntime(options) {
|
|
|
9669
9811
|
sessions,
|
|
9670
9812
|
defaultTarget.provider,
|
|
9671
9813
|
defaultTarget.model,
|
|
9672
|
-
config.subagentConcurrency
|
|
9814
|
+
config.subagentConcurrency,
|
|
9815
|
+
events
|
|
9673
9816
|
);
|
|
9817
|
+
tools.register(createTaskTool(subagents, worktree));
|
|
9674
9818
|
return {
|
|
9675
9819
|
config,
|
|
9676
9820
|
events,
|
|
@@ -10794,7 +10938,7 @@ var ProjectFileSearch = class {
|
|
|
10794
10938
|
if (depth > maxDepth || out.length >= MAX_FILES) return;
|
|
10795
10939
|
let entries;
|
|
10796
10940
|
try {
|
|
10797
|
-
entries =
|
|
10941
|
+
entries = fs2.readdirSync(dir, { withFileTypes: true });
|
|
10798
10942
|
} catch {
|
|
10799
10943
|
return;
|
|
10800
10944
|
}
|
|
@@ -14610,7 +14754,7 @@ var ThemeManager = class {
|
|
|
14610
14754
|
}
|
|
14611
14755
|
loadThemeFromFile(themePath) {
|
|
14612
14756
|
try {
|
|
14613
|
-
const canonicalPath =
|
|
14757
|
+
const canonicalPath = fs22.realpathSync(path72.resolve(themePath));
|
|
14614
14758
|
if (this.customThemes.has(canonicalPath)) {
|
|
14615
14759
|
return this.customThemes.get(canonicalPath);
|
|
14616
14760
|
}
|
|
@@ -14621,7 +14765,7 @@ var ThemeManager = class {
|
|
|
14621
14765
|
);
|
|
14622
14766
|
return void 0;
|
|
14623
14767
|
}
|
|
14624
|
-
const themeContent =
|
|
14768
|
+
const themeContent = fs22.readFileSync(canonicalPath, "utf-8");
|
|
14625
14769
|
const customThemeConfig = JSON.parse(themeContent);
|
|
14626
14770
|
const validation = validateCustomTheme(customThemeConfig);
|
|
14627
14771
|
if (!validation.isValid) {
|
|
@@ -17554,12 +17698,12 @@ var TodoDisplay = ({ todos }) => {
|
|
|
17554
17698
|
return /* @__PURE__ */ jsx12(Box10, { flexDirection: "column", children: todos.map((todo) => /* @__PURE__ */ jsx12(TodoItemRow, { todo }, todo.id)) });
|
|
17555
17699
|
};
|
|
17556
17700
|
var TodoItemRow = ({ todo }) => {
|
|
17557
|
-
const
|
|
17701
|
+
const statusIcon2 = STATUS_ICONS[todo.status];
|
|
17558
17702
|
const isCompleted = todo.status === "completed";
|
|
17559
17703
|
const isInProgress = todo.status === "in_progress";
|
|
17560
17704
|
const itemColor = isCompleted ? Colors.Foreground : isInProgress ? Colors.AccentGreen : Colors.Foreground;
|
|
17561
17705
|
return /* @__PURE__ */ jsxs9(Box10, { flexDirection: "row", minHeight: 1, children: [
|
|
17562
|
-
/* @__PURE__ */ jsx12(Box10, { width: 3, children: /* @__PURE__ */ jsx12(Text11, { color: itemColor, children:
|
|
17706
|
+
/* @__PURE__ */ jsx12(Box10, { width: 3, children: /* @__PURE__ */ jsx12(Text11, { color: itemColor, children: statusIcon2 }) }),
|
|
17563
17707
|
/* @__PURE__ */ jsx12(Box10, { flexGrow: 1, children: /* @__PURE__ */ jsx12(Text11, { color: itemColor, strikethrough: isCompleted, wrap: "wrap", children: todo.content }) })
|
|
17564
17708
|
] });
|
|
17565
17709
|
};
|
|
@@ -22470,7 +22614,7 @@ var ToolStatusIndicator = ({
|
|
|
22470
22614
|
name
|
|
22471
22615
|
}) => {
|
|
22472
22616
|
const isShell = name === SHELL_COMMAND_NAME || name === SHELL_NAME;
|
|
22473
|
-
const
|
|
22617
|
+
const statusColor3 = isShell ? theme.ui.symbol : theme.status.warning;
|
|
22474
22618
|
return /* @__PURE__ */ jsxs16(Box16, { minWidth: STATUS_INDICATOR_WIDTH, children: [
|
|
22475
22619
|
status === "Pending" && /* @__PURE__ */ jsx21(Text19, { color: theme.status.success, children: TOOL_STATUS.PENDING }),
|
|
22476
22620
|
status === "Executing" && /* @__PURE__ */ jsx21(
|
|
@@ -22481,8 +22625,8 @@ var ToolStatusIndicator = ({
|
|
|
22481
22625
|
}
|
|
22482
22626
|
),
|
|
22483
22627
|
status === "Success" && /* @__PURE__ */ jsx21(Text19, { color: theme.status.success, "aria-label": "Success:", children: TOOL_STATUS.SUCCESS }),
|
|
22484
|
-
status === "Confirming" && /* @__PURE__ */ jsx21(Text19, { color:
|
|
22485
|
-
status === "Canceled" && /* @__PURE__ */ jsx21(Text19, { color:
|
|
22628
|
+
status === "Confirming" && /* @__PURE__ */ jsx21(Text19, { color: statusColor3, "aria-label": "Confirming:", children: TOOL_STATUS.CONFIRMING }),
|
|
22629
|
+
status === "Canceled" && /* @__PURE__ */ jsx21(Text19, { color: statusColor3, "aria-label": "Canceled:", bold: true, children: TOOL_STATUS.CANCELED }),
|
|
22486
22630
|
status === "Error" && /* @__PURE__ */ jsx21(Text19, { color: theme.status.error, "aria-label": "Error:", bold: true, children: TOOL_STATUS.ERROR })
|
|
22487
22631
|
] });
|
|
22488
22632
|
};
|
|
@@ -25374,21 +25518,35 @@ function useExportCompletion(buffer, slashCommands) {
|
|
|
25374
25518
|
]
|
|
25375
25519
|
);
|
|
25376
25520
|
}
|
|
25377
|
-
|
|
25378
|
-
state
|
|
25379
|
-
|
|
25380
|
-
|
|
25381
|
-
|
|
25382
|
-
|
|
25383
|
-
|
|
25384
|
-
|
|
25385
|
-
|
|
25386
|
-
},
|
|
25387
|
-
|
|
25388
|
-
|
|
25389
|
-
|
|
25390
|
-
|
|
25391
|
-
|
|
25521
|
+
function useFollowupSuggestionsCLI(options) {
|
|
25522
|
+
const [state, setState] = useState18({ isVisible: false, suggestion: null });
|
|
25523
|
+
const onAcceptRef = useRef11(options?.onAccept);
|
|
25524
|
+
onAcceptRef.current = options?.onAccept;
|
|
25525
|
+
const setSuggestion = useCallback13((text) => {
|
|
25526
|
+
setState({ isVisible: text !== null && text.trim().length > 0, suggestion: text });
|
|
25527
|
+
}, []);
|
|
25528
|
+
const dismiss = useCallback13(() => {
|
|
25529
|
+
setState({ isVisible: false, suggestion: null });
|
|
25530
|
+
}, []);
|
|
25531
|
+
const accept = useCallback13(
|
|
25532
|
+
(_method, opts) => {
|
|
25533
|
+
setState((prev) => {
|
|
25534
|
+
if (prev.suggestion && !opts?.skipOnAccept) {
|
|
25535
|
+
onAcceptRef.current?.(prev.suggestion);
|
|
25536
|
+
}
|
|
25537
|
+
return { isVisible: false, suggestion: null };
|
|
25538
|
+
});
|
|
25539
|
+
},
|
|
25540
|
+
[]
|
|
25541
|
+
);
|
|
25542
|
+
return {
|
|
25543
|
+
state,
|
|
25544
|
+
setSuggestion,
|
|
25545
|
+
accept,
|
|
25546
|
+
dismiss,
|
|
25547
|
+
clear: dismiss,
|
|
25548
|
+
recordKeystroke: dismiss
|
|
25549
|
+
};
|
|
25392
25550
|
}
|
|
25393
25551
|
var HIGHLIGHT_REGEX = /(^\/[a-zA-Z][a-zA-Z0-9:_-]*)|((?<=\s)\/[a-zA-Z][a-zA-Z0-9:_-]*)|(@(?:\\ |[a-zA-Z0-9_./-])+)/g;
|
|
25394
25552
|
function parseInputForHighlighting(text, index, slashCommands) {
|
|
@@ -25567,7 +25725,7 @@ var BaseTextInput = ({
|
|
|
25567
25725
|
isActive = true,
|
|
25568
25726
|
renderLine = defaultRenderLine
|
|
25569
25727
|
}) => {
|
|
25570
|
-
const handleKey =
|
|
25728
|
+
const handleKey = useCallback14(
|
|
25571
25729
|
(key) => {
|
|
25572
25730
|
if (onKeypress?.(key)) {
|
|
25573
25731
|
return;
|
|
@@ -25798,20 +25956,20 @@ var InputPrompt = ({
|
|
|
25798
25956
|
const { setPillFocused: setBgPillFocused } = useBackgroundTaskViewActions();
|
|
25799
25957
|
const hasAgents = agents.size > 0;
|
|
25800
25958
|
const hasBgAgents = bgEntries.length > 0;
|
|
25801
|
-
const [justNavigatedHistory, setJustNavigatedHistory] =
|
|
25802
|
-
const [escPressCount, setEscPressCount] =
|
|
25803
|
-
const [showEscapePrompt, setShowEscapePrompt] =
|
|
25804
|
-
const escapeTimerRef =
|
|
25805
|
-
const [recentPasteTime, setRecentPasteTime] =
|
|
25806
|
-
const pasteTimeoutRef =
|
|
25807
|
-
const [attachments, setAttachments] =
|
|
25808
|
-
const [isAttachmentMode, setIsAttachmentMode] =
|
|
25809
|
-
const [selectedAttachmentIndex, setSelectedAttachmentIndex] =
|
|
25810
|
-
const [pendingPastes, setPendingPastes] =
|
|
25959
|
+
const [justNavigatedHistory, setJustNavigatedHistory] = useState19(false);
|
|
25960
|
+
const [escPressCount, setEscPressCount] = useState19(0);
|
|
25961
|
+
const [showEscapePrompt, setShowEscapePrompt] = useState19(false);
|
|
25962
|
+
const escapeTimerRef = useRef12(null);
|
|
25963
|
+
const [recentPasteTime, setRecentPasteTime] = useState19(null);
|
|
25964
|
+
const pasteTimeoutRef = useRef12(null);
|
|
25965
|
+
const [attachments, setAttachments] = useState19([]);
|
|
25966
|
+
const [isAttachmentMode, setIsAttachmentMode] = useState19(false);
|
|
25967
|
+
const [selectedAttachmentIndex, setSelectedAttachmentIndex] = useState19(-1);
|
|
25968
|
+
const [pendingPastes, setPendingPastes] = useState19(
|
|
25811
25969
|
/* @__PURE__ */ new Map()
|
|
25812
25970
|
);
|
|
25813
|
-
const activePlaceholderIds =
|
|
25814
|
-
const parsePlaceholder =
|
|
25971
|
+
const activePlaceholderIds = useRef12(/* @__PURE__ */ new Map());
|
|
25972
|
+
const parsePlaceholder = useCallback15(
|
|
25815
25973
|
(placeholder2) => {
|
|
25816
25974
|
const match = placeholder2.match(
|
|
25817
25975
|
/^\[Pasted Content (\d+) chars\](?: #(\d+))?$/
|
|
@@ -25823,7 +25981,7 @@ var InputPrompt = ({
|
|
|
25823
25981
|
},
|
|
25824
25982
|
[]
|
|
25825
25983
|
);
|
|
25826
|
-
const freePlaceholderId =
|
|
25984
|
+
const freePlaceholderId = useCallback15((charCount, id) => {
|
|
25827
25985
|
const activeIds = activePlaceholderIds.current.get(charCount);
|
|
25828
25986
|
if (activeIds) {
|
|
25829
25987
|
activeIds.delete(id);
|
|
@@ -25832,14 +25990,14 @@ var InputPrompt = ({
|
|
|
25832
25990
|
}
|
|
25833
25991
|
}
|
|
25834
25992
|
}, []);
|
|
25835
|
-
const [reverseSearchActive, setReverseSearchActive] =
|
|
25836
|
-
const [commandSearchActive, setCommandSearchActive] =
|
|
25837
|
-
const [textBeforeReverseSearch, setTextBeforeReverseSearch] =
|
|
25838
|
-
const [cursorPosition, setCursorPosition] =
|
|
25993
|
+
const [reverseSearchActive, setReverseSearchActive] = useState19(false);
|
|
25994
|
+
const [commandSearchActive, setCommandSearchActive] = useState19(false);
|
|
25995
|
+
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = useState19("");
|
|
25996
|
+
const [cursorPosition, setCursorPosition] = useState19([
|
|
25839
25997
|
0,
|
|
25840
25998
|
0
|
|
25841
25999
|
]);
|
|
25842
|
-
const [expandedSuggestionIndex, setExpandedSuggestionIndex] =
|
|
26000
|
+
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = useState19(-1);
|
|
25843
26001
|
const exportCompletion = useExportCompletion(buffer, slashCommands);
|
|
25844
26002
|
const shellHistory = useShellHistory(config.getProjectRoot());
|
|
25845
26003
|
const shellHistoryData = shellHistory.history;
|
|
@@ -25854,7 +26012,7 @@ var InputPrompt = ({
|
|
|
25854
26012
|
!justNavigatedHistory,
|
|
25855
26013
|
recentSlashCommands
|
|
25856
26014
|
);
|
|
25857
|
-
const midInputGhostTextRef =
|
|
26015
|
+
const midInputGhostTextRef = useRef12(null);
|
|
25858
26016
|
midInputGhostTextRef.current = completion.midInputGhostText;
|
|
25859
26017
|
const reverseSearchCompletion = useReverseSearchCompletion(
|
|
25860
26018
|
buffer,
|
|
@@ -25881,7 +26039,7 @@ var InputPrompt = ({
|
|
|
25881
26039
|
const resetReverseSearchCompletionState = reverseSearchCompletion.resetCompletionState;
|
|
25882
26040
|
const resetCommandSearchCompletionState = commandSearchCompletion.resetCompletionState;
|
|
25883
26041
|
const showCursor = focus && isShellFocused && !isEmbeddedShellFocused && !agentTabBarFocused;
|
|
25884
|
-
const resetEscapeState =
|
|
26042
|
+
const resetEscapeState = useCallback15(() => {
|
|
25885
26043
|
if (escapeTimerRef.current) {
|
|
25886
26044
|
clearTimeout(escapeTimerRef.current);
|
|
25887
26045
|
escapeTimerRef.current = null;
|
|
@@ -25894,7 +26052,7 @@ var InputPrompt = ({
|
|
|
25894
26052
|
onEscapePromptChange(showEscapePrompt);
|
|
25895
26053
|
}
|
|
25896
26054
|
}, [showEscapePrompt, onEscapePromptChange]);
|
|
25897
|
-
const nextLargePastePlaceholder =
|
|
26055
|
+
const nextLargePastePlaceholder = useCallback15((charCount) => {
|
|
25898
26056
|
const activeIds = activePlaceholderIds.current.get(charCount) || /* @__PURE__ */ new Set();
|
|
25899
26057
|
let id = 1;
|
|
25900
26058
|
while (activeIds.has(id)) {
|
|
@@ -25916,9 +26074,9 @@ var InputPrompt = ({
|
|
|
25916
26074
|
},
|
|
25917
26075
|
[]
|
|
25918
26076
|
);
|
|
25919
|
-
const resetHistoryNavRef =
|
|
26077
|
+
const resetHistoryNavRef = useRef12(() => {
|
|
25920
26078
|
});
|
|
25921
|
-
const handleSubmitAndClear =
|
|
26079
|
+
const handleSubmitAndClear = useCallback15(
|
|
25922
26080
|
(submittedValue) => {
|
|
25923
26081
|
exportCompletion.reset();
|
|
25924
26082
|
let finalValue = submittedValue;
|
|
@@ -25970,7 +26128,7 @@ ${finalValue.trim()}`;
|
|
|
25970
26128
|
followup
|
|
25971
26129
|
]
|
|
25972
26130
|
);
|
|
25973
|
-
const customSetTextAndResetCompletionSignal =
|
|
26131
|
+
const customSetTextAndResetCompletionSignal = useCallback15(
|
|
25974
26132
|
(newText) => {
|
|
25975
26133
|
buffer.setText(newText);
|
|
25976
26134
|
setJustNavigatedHistory(true);
|
|
@@ -25987,7 +26145,7 @@ ${finalValue.trim()}`;
|
|
|
25987
26145
|
onChange: customSetTextAndResetCompletionSignal
|
|
25988
26146
|
});
|
|
25989
26147
|
resetHistoryNavRef.current = inputHistory.resetHistoryNav;
|
|
25990
|
-
const prevHasAgentsRef =
|
|
26148
|
+
const prevHasAgentsRef = useRef12(hasAgents);
|
|
25991
26149
|
useEffect21(() => {
|
|
25992
26150
|
if (hasAgents && !prevHasAgentsRef.current) {
|
|
25993
26151
|
inputHistory.resetHistoryNav();
|
|
@@ -26010,7 +26168,7 @@ ${finalValue.trim()}`;
|
|
|
26010
26168
|
resetReverseSearchCompletionState,
|
|
26011
26169
|
resetCommandSearchCompletionState
|
|
26012
26170
|
]);
|
|
26013
|
-
const handleClipboardImage =
|
|
26171
|
+
const handleClipboardImage = useCallback15(async (validated = false) => {
|
|
26014
26172
|
try {
|
|
26015
26173
|
const hasImage = validated || await clipboardHasImage();
|
|
26016
26174
|
if (hasImage) {
|
|
@@ -26031,7 +26189,7 @@ ${finalValue.trim()}`;
|
|
|
26031
26189
|
debugLogger14.error("Error handling clipboard image:", error);
|
|
26032
26190
|
}
|
|
26033
26191
|
}, []);
|
|
26034
|
-
const handleAttachmentDelete =
|
|
26192
|
+
const handleAttachmentDelete = useCallback15((index) => {
|
|
26035
26193
|
setAttachments((prev) => {
|
|
26036
26194
|
const newList = prev.filter((_, i) => i !== index);
|
|
26037
26195
|
if (newList.length === 0) {
|
|
@@ -26043,7 +26201,7 @@ ${finalValue.trim()}`;
|
|
|
26043
26201
|
return newList;
|
|
26044
26202
|
});
|
|
26045
26203
|
}, []);
|
|
26046
|
-
const handleInput =
|
|
26204
|
+
const handleInput = useCallback15(
|
|
26047
26205
|
(key) => {
|
|
26048
26206
|
if (agentTabBarFocused || bgPillFocused) {
|
|
26049
26207
|
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta) {
|
|
@@ -26621,7 +26779,7 @@ ${currentText}`);
|
|
|
26621
26779
|
exportCompletion
|
|
26622
26780
|
]
|
|
26623
26781
|
);
|
|
26624
|
-
const renderLineWithHighlighting =
|
|
26782
|
+
const renderLineWithHighlighting = useCallback15(
|
|
26625
26783
|
(opts) => {
|
|
26626
26784
|
const {
|
|
26627
26785
|
lineText,
|
|
@@ -26727,23 +26885,23 @@ ${currentText}`);
|
|
|
26727
26885
|
}, [promptSuggestion]);
|
|
26728
26886
|
const showAutoAcceptStyling = !shellModeActive && approvalMode === "auto-edit";
|
|
26729
26887
|
const showYoloStyling = !shellModeActive && approvalMode === "yolo";
|
|
26730
|
-
let
|
|
26888
|
+
let statusColor3;
|
|
26731
26889
|
let statusText = "";
|
|
26732
26890
|
if (shellModeActive) {
|
|
26733
|
-
|
|
26891
|
+
statusColor3 = theme.ui.symbol;
|
|
26734
26892
|
statusText = t("Shell mode");
|
|
26735
26893
|
} else if (showYoloStyling) {
|
|
26736
|
-
|
|
26894
|
+
statusColor3 = theme.status.errorDim;
|
|
26737
26895
|
statusText = t("YOLO mode");
|
|
26738
26896
|
} else if (showAutoAcceptStyling) {
|
|
26739
|
-
|
|
26897
|
+
statusColor3 = theme.status.warningDim;
|
|
26740
26898
|
statusText = t("Accepting edits");
|
|
26741
26899
|
}
|
|
26742
|
-
const borderColor = isShellFocused && !isEmbeddedShellFocused && !agentTabBarFocused ?
|
|
26900
|
+
const borderColor = isShellFocused && !isEmbeddedShellFocused && !agentTabBarFocused ? statusColor3 ?? theme.border.focused : theme.border.default;
|
|
26743
26901
|
const prefixNode = /* @__PURE__ */ jsxs27(
|
|
26744
26902
|
Text30,
|
|
26745
26903
|
{
|
|
26746
|
-
color:
|
|
26904
|
+
color: statusColor3 ?? theme.text.accent,
|
|
26747
26905
|
"aria-label": statusText || void 0,
|
|
26748
26906
|
children: [
|
|
26749
26907
|
shellModeActive ? reverseSearchActive ? /* @__PURE__ */ jsxs27(Text30, { color: theme.text.link, "aria-label": SCREEN_READER_USER_PREFIX, children: [
|
|
@@ -26868,13 +27026,21 @@ var ShellModeIndicator = () => /* @__PURE__ */ jsxs30(Text33, { color: theme.ui.
|
|
|
26868
27026
|
/* @__PURE__ */ jsx35(Text33, { color: theme.text.secondary, children: " (esc to disable)" })
|
|
26869
27027
|
] });
|
|
26870
27028
|
function BackgroundTasksPill() {
|
|
26871
|
-
|
|
27029
|
+
const { activeSubagents } = useUIState();
|
|
27030
|
+
const running = activeSubagents.filter((s) => s.status === "running").length;
|
|
27031
|
+
if (running <= 0) return null;
|
|
27032
|
+
return /* @__PURE__ */ jsxs31(Text34, { color: theme.text.accent, children: [
|
|
27033
|
+
" ",
|
|
27034
|
+
running,
|
|
27035
|
+
" task",
|
|
27036
|
+
running !== 1 ? "s" : ""
|
|
27037
|
+
] });
|
|
26872
27038
|
}
|
|
26873
27039
|
function MCPHealthPill() {
|
|
26874
27040
|
const { mcpConnected, mcpTotal } = useUIState();
|
|
26875
27041
|
if (mcpTotal === 0) return null;
|
|
26876
27042
|
const color = mcpConnected === mcpTotal ? theme.status.success : theme.status.warning;
|
|
26877
|
-
return /* @__PURE__ */
|
|
27043
|
+
return /* @__PURE__ */ jsxs32(Text35, { color, children: [
|
|
26878
27044
|
" MCP ",
|
|
26879
27045
|
mcpConnected,
|
|
26880
27046
|
"/",
|
|
@@ -26884,7 +27050,7 @@ function MCPHealthPill() {
|
|
|
26884
27050
|
function useStatusLine() {
|
|
26885
27051
|
const config = useConfig();
|
|
26886
27052
|
const cwd = config.getWorkingDir();
|
|
26887
|
-
const [line, setLine] =
|
|
27053
|
+
const [line, setLine] = useState20(null);
|
|
26888
27054
|
useEffect222(() => {
|
|
26889
27055
|
let cancelled = false;
|
|
26890
27056
|
execFile22("git", ["branch", "--show-current"], { cwd }, (err, stdout) => {
|
|
@@ -26909,11 +27075,11 @@ var VimModeProvider = ({
|
|
|
26909
27075
|
children,
|
|
26910
27076
|
initialVimEnabled = false
|
|
26911
27077
|
}) => {
|
|
26912
|
-
const [vimEnabled, setVimEnabled] =
|
|
26913
|
-
const [vimMode, setVimMode] =
|
|
27078
|
+
const [vimEnabled, setVimEnabled] = useState21(initialVimEnabled);
|
|
27079
|
+
const [vimMode, setVimMode] = useState21(
|
|
26914
27080
|
initialVimEnabled ? "NORMAL" : "INSERT"
|
|
26915
27081
|
);
|
|
26916
|
-
const toggleVimEnabled =
|
|
27082
|
+
const toggleVimEnabled = useCallback16(async () => {
|
|
26917
27083
|
const next = !vimEnabled;
|
|
26918
27084
|
setVimEnabled(next);
|
|
26919
27085
|
setVimMode(next ? "NORMAL" : "INSERT");
|
|
@@ -26951,16 +27117,16 @@ var Footer = () => {
|
|
|
26951
27117
|
const debugMode = config.getDebugMode();
|
|
26952
27118
|
const contextWindowSize = config.getContentGeneratorConfig()?.contextWindowSize;
|
|
26953
27119
|
const suppressHint = statusLineLines.length > 0;
|
|
26954
|
-
const leftBottomContent = uiState.ctrlCPressedOnce ? /* @__PURE__ */ jsx37(
|
|
27120
|
+
const leftBottomContent = uiState.ctrlCPressedOnce ? /* @__PURE__ */ jsx37(Text36, { color: theme.status.warning, children: t("Press Ctrl+C again to exit.") }) : uiState.ctrlDPressedOnce ? /* @__PURE__ */ jsx37(Text36, { color: theme.status.warning, children: t("Press Ctrl+D again to exit.") }) : uiState.showEscapePrompt ? /* @__PURE__ */ jsx37(Text36, { color: theme.text.secondary, children: t("Press Esc again to clear.") }) : uiState.rewindEscPending ? /* @__PURE__ */ jsx37(Text36, { color: theme.text.secondary, children: t("Press Esc again to rewind conversation.") }) : vimEnabled && vimMode === "INSERT" ? /* @__PURE__ */ jsx37(Text36, { color: theme.text.secondary, children: "-- INSERT --" }) : uiState.shellModeActive ? /* @__PURE__ */ jsx37(ShellModeIndicator, {}) : configInitMessage ? /* @__PURE__ */ jsxs33(Text36, { color: theme.text.secondary, children: [
|
|
26955
27121
|
/* @__PURE__ */ jsx37(GeminiSpinner, {}),
|
|
26956
27122
|
" ",
|
|
26957
27123
|
configInitMessage
|
|
26958
|
-
] }) : showAutoAcceptIndicator !== void 0 && showAutoAcceptIndicator !== "default" ? /* @__PURE__ */ jsx37(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }) : suppressHint ? null : /* @__PURE__ */ jsx37(
|
|
27124
|
+
] }) : showAutoAcceptIndicator !== void 0 && showAutoAcceptIndicator !== "default" ? /* @__PURE__ */ jsx37(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }) : suppressHint ? null : /* @__PURE__ */ jsx37(Text36, { color: theme.text.secondary, children: t("? for shortcuts") });
|
|
26959
27125
|
const rightItems = [];
|
|
26960
27126
|
if (sandboxInfo) {
|
|
26961
27127
|
rightItems.push({
|
|
26962
27128
|
key: "sandbox",
|
|
26963
|
-
node: /* @__PURE__ */
|
|
27129
|
+
node: /* @__PURE__ */ jsxs33(Text36, { color: theme.status.success, children: [
|
|
26964
27130
|
"\u{1F512} ",
|
|
26965
27131
|
sandboxInfo
|
|
26966
27132
|
] })
|
|
@@ -26969,13 +27135,13 @@ var Footer = () => {
|
|
|
26969
27135
|
if (debugMode) {
|
|
26970
27136
|
rightItems.push({
|
|
26971
27137
|
key: "debug",
|
|
26972
|
-
node: /* @__PURE__ */ jsx37(
|
|
27138
|
+
node: /* @__PURE__ */ jsx37(Text36, { color: theme.status.warning, children: "Debug Mode" })
|
|
26973
27139
|
});
|
|
26974
27140
|
}
|
|
26975
27141
|
if (promptTokenCount > 0 && contextWindowSize) {
|
|
26976
27142
|
rightItems.push({
|
|
26977
27143
|
key: "context",
|
|
26978
|
-
node: /* @__PURE__ */ jsx37(
|
|
27144
|
+
node: /* @__PURE__ */ jsx37(Text36, { color: theme.text.accent, children: /* @__PURE__ */ jsx37(
|
|
26979
27145
|
ContextUsageDisplay,
|
|
26980
27146
|
{
|
|
26981
27147
|
promptTokenCount,
|
|
@@ -26985,7 +27151,7 @@ var Footer = () => {
|
|
|
26985
27151
|
) })
|
|
26986
27152
|
});
|
|
26987
27153
|
}
|
|
26988
|
-
return /* @__PURE__ */
|
|
27154
|
+
return /* @__PURE__ */ jsxs33(
|
|
26989
27155
|
Box28,
|
|
26990
27156
|
{
|
|
26991
27157
|
flexDirection: isNarrow ? "column" : "row",
|
|
@@ -26994,16 +27160,16 @@ var Footer = () => {
|
|
|
26994
27160
|
paddingX: 2,
|
|
26995
27161
|
gap: isNarrow ? 0 : 1,
|
|
26996
27162
|
children: [
|
|
26997
|
-
/* @__PURE__ */
|
|
26998
|
-
statusLineLines.length > 0 && !uiState.ctrlCPressedOnce && !uiState.ctrlDPressedOnce && statusLineLines.map((line, i) => /* @__PURE__ */ jsx37(
|
|
26999
|
-
/* @__PURE__ */
|
|
27000
|
-
/* @__PURE__ */ jsx37(
|
|
27163
|
+
/* @__PURE__ */ jsxs33(Box28, { flexDirection: "column", flexShrink: isNarrow ? 0 : 1, children: [
|
|
27164
|
+
statusLineLines.length > 0 && !uiState.ctrlCPressedOnce && !uiState.ctrlDPressedOnce && statusLineLines.map((line, i) => /* @__PURE__ */ jsx37(Text36, { dimColor: true, wrap: "truncate", children: line }, `status-line-${i}`)),
|
|
27165
|
+
/* @__PURE__ */ jsxs33(Box28, { flexDirection: "row", flexShrink: 1, children: [
|
|
27166
|
+
/* @__PURE__ */ jsx37(Text36, { wrap: "truncate", children: leftBottomContent }),
|
|
27001
27167
|
/* @__PURE__ */ jsx37(BackgroundTasksPill, {}),
|
|
27002
27168
|
/* @__PURE__ */ jsx37(MCPHealthPill, {})
|
|
27003
27169
|
] })
|
|
27004
27170
|
] }),
|
|
27005
|
-
/* @__PURE__ */ jsx37(Box28, { flexShrink: 0, gap: 1, alignItems: "flex-start", children: rightItems.map(({ key, node }, index) => /* @__PURE__ */
|
|
27006
|
-
index > 0 && /* @__PURE__ */ jsx37(
|
|
27171
|
+
/* @__PURE__ */ jsx37(Box28, { flexShrink: 0, gap: 1, alignItems: "flex-start", children: rightItems.map(({ key, node }, index) => /* @__PURE__ */ jsxs33(Box28, { alignItems: "center", children: [
|
|
27172
|
+
index > 0 && /* @__PURE__ */ jsx37(Text36, { color: theme.text.secondary, children: " | " }),
|
|
27007
27173
|
node
|
|
27008
27174
|
] }, key)) })
|
|
27009
27175
|
]
|
|
@@ -27015,8 +27181,8 @@ var NUM_TIMES_QUEUE_HINT_SHOWN = 3;
|
|
|
27015
27181
|
var QueuedMessageDisplay = ({
|
|
27016
27182
|
messageQueue
|
|
27017
27183
|
}) => {
|
|
27018
|
-
const hintSeenCountRef =
|
|
27019
|
-
const wasEmptyRef =
|
|
27184
|
+
const hintSeenCountRef = useRef13(0);
|
|
27185
|
+
const wasEmptyRef = useRef13(true);
|
|
27020
27186
|
if (messageQueue.length === 0) {
|
|
27021
27187
|
wasEmptyRef.current = true;
|
|
27022
27188
|
return null;
|
|
@@ -27026,17 +27192,17 @@ var QueuedMessageDisplay = ({
|
|
|
27026
27192
|
wasEmptyRef.current = false;
|
|
27027
27193
|
}
|
|
27028
27194
|
const showHint = hintSeenCountRef.current <= NUM_TIMES_QUEUE_HINT_SHOWN;
|
|
27029
|
-
return /* @__PURE__ */
|
|
27195
|
+
return /* @__PURE__ */ jsxs34(Box29, { flexDirection: "column", marginTop: 1, children: [
|
|
27030
27196
|
messageQueue.slice(0, MAX_DISPLAYED_QUEUED_MESSAGES).map((message, index) => {
|
|
27031
27197
|
const preview = message.replace(/\s+/g, " ");
|
|
27032
|
-
return /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, width: "100%", children: /* @__PURE__ */ jsx38(
|
|
27198
|
+
return /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, width: "100%", children: /* @__PURE__ */ jsx38(Text37, { dimColor: true, wrap: "truncate", children: preview }) }, index);
|
|
27033
27199
|
}),
|
|
27034
|
-
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, children: /* @__PURE__ */
|
|
27200
|
+
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, children: /* @__PURE__ */ jsxs34(Text37, { dimColor: true, children: [
|
|
27035
27201
|
"... (+",
|
|
27036
27202
|
messageQueue.length - MAX_DISPLAYED_QUEUED_MESSAGES,
|
|
27037
27203
|
" more)"
|
|
27038
27204
|
] }) }),
|
|
27039
|
-
showHint && /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, children: /* @__PURE__ */ jsx38(
|
|
27205
|
+
showHint && /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, children: /* @__PURE__ */ jsx38(Text37, { dimColor: true, italic: true, children: t("Press \u2191 to edit queued messages") }) })
|
|
27040
27206
|
] });
|
|
27041
27207
|
};
|
|
27042
27208
|
var getNewlineKey = () => process.platform === "win32" ? "ctrl+enter" : "ctrl+j";
|
|
@@ -27064,8 +27230,8 @@ var getShortcuts = () => [
|
|
|
27064
27230
|
{ key: getExternalEditorKey(), description: t("for external editor") },
|
|
27065
27231
|
{ key: "ctrl+o", description: t("to toggle compact mode") }
|
|
27066
27232
|
];
|
|
27067
|
-
var ShortcutItem = ({ shortcut }) => /* @__PURE__ */
|
|
27068
|
-
/* @__PURE__ */ jsx39(
|
|
27233
|
+
var ShortcutItem = ({ shortcut }) => /* @__PURE__ */ jsxs35(Text38, { color: theme.text.secondary, children: [
|
|
27234
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.text.accent, children: shortcut.key }),
|
|
27069
27235
|
" ",
|
|
27070
27236
|
shortcut.description
|
|
27071
27237
|
] });
|
|
@@ -27149,19 +27315,19 @@ var Composer = () => {
|
|
|
27149
27315
|
}
|
|
27150
27316
|
}
|
|
27151
27317
|
}
|
|
27152
|
-
const [showShortcuts, setShowShortcuts] =
|
|
27153
|
-
const handleToggleShortcuts =
|
|
27318
|
+
const [showShortcuts, setShowShortcuts] = useState222(false);
|
|
27319
|
+
const handleToggleShortcuts = useCallback17(() => {
|
|
27154
27320
|
setShowShortcuts((prev) => !prev);
|
|
27155
27321
|
}, []);
|
|
27156
|
-
const [showSuggestions, setShowSuggestions] =
|
|
27157
|
-
const handleSuggestionsVisibilityChange =
|
|
27322
|
+
const [showSuggestions, setShowSuggestions] = useState222(false);
|
|
27323
|
+
const handleSuggestionsVisibilityChange = useCallback17(
|
|
27158
27324
|
(visible) => {
|
|
27159
27325
|
setShowSuggestions(visible);
|
|
27160
27326
|
uiActions.onSuggestionsVisibilityChange(visible);
|
|
27161
27327
|
},
|
|
27162
27328
|
[uiActions]
|
|
27163
27329
|
);
|
|
27164
|
-
return /* @__PURE__ */
|
|
27330
|
+
return /* @__PURE__ */ jsxs36(Box31, { flexDirection: "column", marginTop: 1, children: [
|
|
27165
27331
|
!uiState.embeddedShellFocused && !suppressBottomLoadingIndicator && /* @__PURE__ */ jsx40(
|
|
27166
27332
|
LoadingIndicator,
|
|
27167
27333
|
{
|
|
@@ -27174,7 +27340,7 @@ var Composer = () => {
|
|
|
27174
27340
|
isReceivingContent
|
|
27175
27341
|
}
|
|
27176
27342
|
),
|
|
27177
|
-
!uiState.embeddedShellFocused && suppressBottomLoadingIndicator && /* @__PURE__ */ jsx40(Box31, { paddingLeft: 2, children: /* @__PURE__ */
|
|
27343
|
+
!uiState.embeddedShellFocused && suppressBottomLoadingIndicator && /* @__PURE__ */ jsx40(Box31, { paddingLeft: 2, children: /* @__PURE__ */ jsxs36(Text39, { color: theme.text.secondary, children: [
|
|
27178
27344
|
"(",
|
|
27179
27345
|
t("Esc to cancel"),
|
|
27180
27346
|
")"
|
|
@@ -27582,13 +27748,13 @@ var CommandDialog = ({
|
|
|
27582
27748
|
title,
|
|
27583
27749
|
lines,
|
|
27584
27750
|
footerText = "Press Esc or Enter to close."
|
|
27585
|
-
}) => /* @__PURE__ */ jsx41(Box32, { marginLeft: 2, marginRight: 2, marginTop: 1, flexDirection: "column", children: /* @__PURE__ */
|
|
27586
|
-
/* @__PURE__ */ jsx41(
|
|
27587
|
-
/* @__PURE__ */ jsx41(Box32, { marginTop: 1, flexDirection: "column", children: lines.map((line, index) => /* @__PURE__ */ jsx41(
|
|
27588
|
-
/* @__PURE__ */ jsx41(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx41(
|
|
27751
|
+
}) => /* @__PURE__ */ jsx41(Box32, { marginLeft: 2, marginRight: 2, marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsxs37(Box32, { borderStyle: "round", borderColor: theme.border.default, padding: 1, flexDirection: "column", children: [
|
|
27752
|
+
/* @__PURE__ */ jsx41(Text40, { bold: true, color: theme.text.accent, children: title }),
|
|
27753
|
+
/* @__PURE__ */ jsx41(Box32, { marginTop: 1, flexDirection: "column", children: lines.map((line, index) => /* @__PURE__ */ jsx41(Text40, { color: theme.text.primary, children: line }, index)) }),
|
|
27754
|
+
/* @__PURE__ */ jsx41(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx41(Text40, { color: theme.text.secondary, children: footerText }) })
|
|
27589
27755
|
] }) });
|
|
27590
27756
|
var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
27591
|
-
const originalTheme =
|
|
27757
|
+
const originalTheme = useRef14(themeManager.getActiveTheme().name);
|
|
27592
27758
|
const available = useMemo10(() => themeManager.getAvailableThemes(), []);
|
|
27593
27759
|
const items = useMemo10(
|
|
27594
27760
|
() => available.map((entry) => ({
|
|
@@ -27604,7 +27770,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
|
27604
27770
|
0,
|
|
27605
27771
|
available.findIndex((entry) => entry.name === originalTheme.current)
|
|
27606
27772
|
);
|
|
27607
|
-
const handleEscape =
|
|
27773
|
+
const handleEscape = useCallback18(
|
|
27608
27774
|
(key) => {
|
|
27609
27775
|
if (key.name === "escape") {
|
|
27610
27776
|
themeManager.setActiveTheme(originalTheme.current);
|
|
@@ -27615,14 +27781,14 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
|
27615
27781
|
[onClose, onPreview]
|
|
27616
27782
|
);
|
|
27617
27783
|
useKeypress(handleEscape, { isActive: true });
|
|
27618
|
-
const handleHighlight =
|
|
27784
|
+
const handleHighlight = useCallback18(
|
|
27619
27785
|
(themeName) => {
|
|
27620
27786
|
themeManager.setActiveTheme(themeName);
|
|
27621
27787
|
onPreview();
|
|
27622
27788
|
},
|
|
27623
27789
|
[onPreview]
|
|
27624
27790
|
);
|
|
27625
|
-
return /* @__PURE__ */
|
|
27791
|
+
return /* @__PURE__ */ jsxs38(
|
|
27626
27792
|
Box33,
|
|
27627
27793
|
{
|
|
27628
27794
|
flexDirection: "column",
|
|
@@ -27632,7 +27798,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
|
27632
27798
|
marginLeft: 2,
|
|
27633
27799
|
marginRight: 2,
|
|
27634
27800
|
children: [
|
|
27635
|
-
/* @__PURE__ */ jsx42(
|
|
27801
|
+
/* @__PURE__ */ jsx42(Text41, { bold: true, color: theme.text.accent, children: "Select theme" }),
|
|
27636
27802
|
/* @__PURE__ */ jsx42(
|
|
27637
27803
|
RadioButtonSelect,
|
|
27638
27804
|
{
|
|
@@ -27643,7 +27809,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
|
27643
27809
|
isFocused: true
|
|
27644
27810
|
}
|
|
27645
27811
|
),
|
|
27646
|
-
/* @__PURE__ */ jsx42(
|
|
27812
|
+
/* @__PURE__ */ jsx42(Text41, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter apply \xB7 Esc cancel" })
|
|
27647
27813
|
]
|
|
27648
27814
|
}
|
|
27649
27815
|
);
|
|
@@ -27680,12 +27846,12 @@ var ProviderDialog = ({
|
|
|
27680
27846
|
onTestProvider,
|
|
27681
27847
|
onClose
|
|
27682
27848
|
}) => {
|
|
27683
|
-
const [phase, setPhase] =
|
|
27684
|
-
const [selectedProvider, setSelectedProvider] =
|
|
27685
|
-
const [apiKeyInput, setApiKeyInput] =
|
|
27686
|
-
const [isBusy, setIsBusy] =
|
|
27687
|
-
const [status, setStatus] =
|
|
27688
|
-
const [testLatencyMs, setTestLatencyMs] =
|
|
27849
|
+
const [phase, setPhase] = useState23("providers");
|
|
27850
|
+
const [selectedProvider, setSelectedProvider] = useState23(currentProvider);
|
|
27851
|
+
const [apiKeyInput, setApiKeyInput] = useState23("");
|
|
27852
|
+
const [isBusy, setIsBusy] = useState23(false);
|
|
27853
|
+
const [status, setStatus] = useState23(null);
|
|
27854
|
+
const [testLatencyMs, setTestLatencyMs] = useState23(void 0);
|
|
27689
27855
|
const isLocal = CREDENTIAL_FREE_PROVIDERS.has(selectedProvider);
|
|
27690
27856
|
const keyIsSet = hasApiKey(selectedProvider);
|
|
27691
27857
|
const keyHint = getProviderKeyHint(selectedProvider);
|
|
@@ -27744,7 +27910,7 @@ var ProviderDialog = ({
|
|
|
27744
27910
|
],
|
|
27745
27911
|
[canTest, currentProvider, isLocal, selectedProvider]
|
|
27746
27912
|
);
|
|
27747
|
-
const selectProvider =
|
|
27913
|
+
const selectProvider = useCallback19(
|
|
27748
27914
|
(provider) => {
|
|
27749
27915
|
setSelectedProvider(provider);
|
|
27750
27916
|
setStatus(null);
|
|
@@ -27753,7 +27919,7 @@ var ProviderDialog = ({
|
|
|
27753
27919
|
},
|
|
27754
27920
|
[]
|
|
27755
27921
|
);
|
|
27756
|
-
const runTest =
|
|
27922
|
+
const runTest = useCallback19(async () => {
|
|
27757
27923
|
setIsBusy(true);
|
|
27758
27924
|
setTestLatencyMs(void 0);
|
|
27759
27925
|
setStatus({ text: `Testing ${selectedProvider}\u2026`, ok: true });
|
|
@@ -27775,7 +27941,7 @@ var ProviderDialog = ({
|
|
|
27775
27941
|
setIsBusy(false);
|
|
27776
27942
|
}
|
|
27777
27943
|
}, [onTestProvider, selectedProvider]);
|
|
27778
|
-
const selectAction =
|
|
27944
|
+
const selectAction = useCallback19(
|
|
27779
27945
|
(action) => {
|
|
27780
27946
|
if (isBusy) return;
|
|
27781
27947
|
if (action === "editKey") {
|
|
@@ -27816,7 +27982,7 @@ var ProviderDialog = ({
|
|
|
27816
27982
|
},
|
|
27817
27983
|
[isBusy, onClose, onSelectProvider, onSetDefaultProvider, runTest, selectedProvider]
|
|
27818
27984
|
);
|
|
27819
|
-
const saveApiKey =
|
|
27985
|
+
const saveApiKey = useCallback19(async () => {
|
|
27820
27986
|
const normalized2 = apiKeyInput.trim();
|
|
27821
27987
|
if (!normalized2) {
|
|
27822
27988
|
setStatus({ text: "Type a key before saving.", ok: false });
|
|
@@ -27871,9 +28037,9 @@ var ProviderDialog = ({
|
|
|
27871
28037
|
},
|
|
27872
28038
|
{ isActive: phase === "apiKey" }
|
|
27873
28039
|
);
|
|
27874
|
-
const
|
|
28040
|
+
const statusColor3 = status ? status.ok ? status.text.startsWith("\u2713") ? theme.status.success : theme.text.secondary : theme.status.error : void 0;
|
|
27875
28041
|
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";
|
|
27876
|
-
return /* @__PURE__ */
|
|
28042
|
+
return /* @__PURE__ */ jsxs39(
|
|
27877
28043
|
Box34,
|
|
27878
28044
|
{
|
|
27879
28045
|
flexDirection: "column",
|
|
@@ -27885,13 +28051,13 @@ var ProviderDialog = ({
|
|
|
27885
28051
|
marginRight: 2,
|
|
27886
28052
|
minWidth: 44,
|
|
27887
28053
|
children: [
|
|
27888
|
-
/* @__PURE__ */
|
|
27889
|
-
/* @__PURE__ */ jsx43(
|
|
27890
|
-
phase !== "providers" && /* @__PURE__ */
|
|
27891
|
-
/* @__PURE__ */ jsx43(
|
|
27892
|
-
/* @__PURE__ */ jsx43(
|
|
28054
|
+
/* @__PURE__ */ jsxs39(Box34, { marginBottom: 1, gap: 1, children: [
|
|
28055
|
+
/* @__PURE__ */ jsx43(Text42, { bold: true, color: theme.text.accent, children: "Providers" }),
|
|
28056
|
+
phase !== "providers" && /* @__PURE__ */ jsxs39(Fragment9, { children: [
|
|
28057
|
+
/* @__PURE__ */ jsx43(Text42, { color: theme.text.secondary, children: "\u203A" }),
|
|
28058
|
+
/* @__PURE__ */ jsx43(Text42, { bold: true, color: theme.text.primary, children: selectedProvider })
|
|
27893
28059
|
] }),
|
|
27894
|
-
phase === "providers" && currentModel && /* @__PURE__ */
|
|
28060
|
+
phase === "providers" && currentModel && /* @__PURE__ */ jsxs39(Text42, { color: theme.text.secondary, children: [
|
|
27895
28061
|
" (",
|
|
27896
28062
|
currentModel,
|
|
27897
28063
|
")"
|
|
@@ -27907,23 +28073,23 @@ var ProviderDialog = ({
|
|
|
27907
28073
|
maxItemsToShow: 8,
|
|
27908
28074
|
renderItem: (item, { titleColor }) => {
|
|
27909
28075
|
const { icon, color, label } = getStatusMark(item.provider, item.keyIsSet);
|
|
27910
|
-
return /* @__PURE__ */
|
|
27911
|
-
/* @__PURE__ */ jsx43(
|
|
27912
|
-
/* @__PURE__ */ jsx43(
|
|
27913
|
-
/* @__PURE__ */ jsx43(
|
|
27914
|
-
item.isCurrent && /* @__PURE__ */ jsx43(
|
|
28076
|
+
return /* @__PURE__ */ jsxs39(Box34, { gap: 1, children: [
|
|
28077
|
+
/* @__PURE__ */ jsx43(Text42, { color, children: icon }),
|
|
28078
|
+
/* @__PURE__ */ jsx43(Text42, { color: titleColor, bold: item.isCurrent, children: item.provider.padEnd(12) }),
|
|
28079
|
+
/* @__PURE__ */ jsx43(Text42, { color, dimColor: !item.keyIsSet && !item.isLocal, children: label }),
|
|
28080
|
+
item.isCurrent && /* @__PURE__ */ jsx43(Text42, { color: theme.text.accent, children: "\u25B6" })
|
|
27915
28081
|
] });
|
|
27916
28082
|
}
|
|
27917
28083
|
}
|
|
27918
28084
|
),
|
|
27919
|
-
phase === "actions" && /* @__PURE__ */
|
|
27920
|
-
/* @__PURE__ */
|
|
27921
|
-
/* @__PURE__ */ jsx43(
|
|
27922
|
-
/* @__PURE__ */ jsx43(
|
|
28085
|
+
phase === "actions" && /* @__PURE__ */ jsxs39(Fragment9, { children: [
|
|
28086
|
+
/* @__PURE__ */ jsxs39(Box34, { marginBottom: 1, gap: 1, children: [
|
|
28087
|
+
/* @__PURE__ */ jsx43(Text42, { color: theme.ui.comment, children: "session" }),
|
|
28088
|
+
/* @__PURE__ */ jsx43(Text42, { color: selectedProvider === currentProvider ? theme.text.accent : theme.text.secondary, children: selectedProvider === currentProvider ? "active" : `still using ${currentProvider}` })
|
|
27923
28089
|
] }),
|
|
27924
|
-
/* @__PURE__ */
|
|
27925
|
-
/* @__PURE__ */ jsx43(
|
|
27926
|
-
isLocal ? /* @__PURE__ */ jsx43(
|
|
28090
|
+
/* @__PURE__ */ jsxs39(Box34, { marginBottom: 1, gap: 1, children: [
|
|
28091
|
+
/* @__PURE__ */ jsx43(Text42, { color: theme.ui.comment, children: "key" }),
|
|
28092
|
+
isLocal ? /* @__PURE__ */ jsx43(Text42, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx43(Text42, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx43(Text42, { color: theme.ui.comment, dimColor: true, children: "not configured" })
|
|
27927
28093
|
] }),
|
|
27928
28094
|
/* @__PURE__ */ jsx43(
|
|
27929
28095
|
BaseSelectionList,
|
|
@@ -27933,10 +28099,10 @@ var ProviderDialog = ({
|
|
|
27933
28099
|
isFocused: !isBusy,
|
|
27934
28100
|
showNumbers: false,
|
|
27935
28101
|
maxItemsToShow: 6,
|
|
27936
|
-
renderItem: (item, { titleColor }) => /* @__PURE__ */
|
|
27937
|
-
/* @__PURE__ */ jsx43(
|
|
27938
|
-
/* @__PURE__ */ jsx43(
|
|
27939
|
-
item.hint && /* @__PURE__ */
|
|
28102
|
+
renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs39(Box34, { gap: 1, children: [
|
|
28103
|
+
/* @__PURE__ */ jsx43(Text42, { color: titleColor, children: item.icon }),
|
|
28104
|
+
/* @__PURE__ */ jsx43(Text42, { color: titleColor, children: item.label }),
|
|
28105
|
+
item.hint && /* @__PURE__ */ jsxs39(Text42, { color: theme.ui.comment, dimColor: true, children: [
|
|
27940
28106
|
"(",
|
|
27941
28107
|
item.hint,
|
|
27942
28108
|
")"
|
|
@@ -27945,23 +28111,23 @@ var ProviderDialog = ({
|
|
|
27945
28111
|
}
|
|
27946
28112
|
)
|
|
27947
28113
|
] }),
|
|
27948
|
-
phase === "apiKey" && /* @__PURE__ */
|
|
27949
|
-
/* @__PURE__ */
|
|
27950
|
-
/* @__PURE__ */ jsx43(
|
|
27951
|
-
isLocal ? /* @__PURE__ */ jsx43(
|
|
28114
|
+
phase === "apiKey" && /* @__PURE__ */ jsxs39(Box34, { flexDirection: "column", gap: 1, marginBottom: 1, children: [
|
|
28115
|
+
/* @__PURE__ */ jsxs39(Box34, { gap: 1, children: [
|
|
28116
|
+
/* @__PURE__ */ jsx43(Text42, { color: theme.ui.comment, children: "current" }),
|
|
28117
|
+
isLocal ? /* @__PURE__ */ jsx43(Text42, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx43(Text42, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx43(Text42, { color: theme.ui.comment, dimColor: true, children: "not set" })
|
|
27952
28118
|
] }),
|
|
27953
|
-
/* @__PURE__ */
|
|
27954
|
-
/* @__PURE__ */ jsx43(
|
|
27955
|
-
/* @__PURE__ */ jsx43(Box34, { borderStyle: "single", borderColor: theme.border.focused, paddingX: 1, children: /* @__PURE__ */ jsx43(
|
|
28119
|
+
/* @__PURE__ */ jsxs39(Box34, { gap: 1, children: [
|
|
28120
|
+
/* @__PURE__ */ jsx43(Text42, { color: theme.ui.comment, children: "new key" }),
|
|
28121
|
+
/* @__PURE__ */ jsx43(Box34, { borderStyle: "single", borderColor: theme.border.focused, paddingX: 1, children: /* @__PURE__ */ jsx43(Text42, { color: theme.text.accent, children: apiKeyInput.length > 0 ? maskApiKeyInput(apiKeyInput.length) : /* @__PURE__ */ jsx43(Text42, { color: theme.ui.comment, dimColor: true, children: "paste or type\u2026" }) }) })
|
|
27956
28122
|
] })
|
|
27957
28123
|
] }),
|
|
27958
|
-
status && /* @__PURE__ */ jsx43(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx43(
|
|
27959
|
-
phase === "actions" && testLatencyMs !== void 0 && /* @__PURE__ */
|
|
27960
|
-
/* @__PURE__ */
|
|
28124
|
+
status && /* @__PURE__ */ jsx43(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx43(Text42, { color: statusColor3, children: status.text }) }),
|
|
28125
|
+
phase === "actions" && testLatencyMs !== void 0 && /* @__PURE__ */ jsxs39(Box34, { marginTop: 0, gap: 1, children: [
|
|
28126
|
+
/* @__PURE__ */ jsxs39(Text42, { color: getLatencyColor(testLatencyMs), bold: true, children: [
|
|
27961
28127
|
testLatencyMs,
|
|
27962
28128
|
"ms"
|
|
27963
28129
|
] }),
|
|
27964
|
-
/* @__PURE__ */ jsx43(
|
|
28130
|
+
/* @__PURE__ */ jsx43(Text42, { color: theme.text.secondary, children: testLatencyMs < 300 ? "excellent" : testLatencyMs < 800 ? "good" : "slow" })
|
|
27965
28131
|
] }),
|
|
27966
28132
|
/* @__PURE__ */ jsx43(
|
|
27967
28133
|
Box34,
|
|
@@ -27973,7 +28139,7 @@ var ProviderDialog = ({
|
|
|
27973
28139
|
borderLeft: false,
|
|
27974
28140
|
borderRight: false,
|
|
27975
28141
|
borderColor: theme.ui.comment,
|
|
27976
|
-
children: /* @__PURE__ */
|
|
28142
|
+
children: /* @__PURE__ */ jsxs39(Text42, { color: theme.ui.comment, dimColor: true, children: [
|
|
27977
28143
|
footer,
|
|
27978
28144
|
phase === "actions" && " Test does not change the session."
|
|
27979
28145
|
] })
|
|
@@ -28002,7 +28168,7 @@ var PermissionsDialog = ({
|
|
|
28002
28168
|
onSave,
|
|
28003
28169
|
onClose
|
|
28004
28170
|
}) => {
|
|
28005
|
-
const [modes, setModes] =
|
|
28171
|
+
const [modes, setModes] = useState24(current);
|
|
28006
28172
|
const dirty = useMemo12(
|
|
28007
28173
|
() => PERMISSION_KEYS.some((key) => modes[key] !== current[key]),
|
|
28008
28174
|
[modes, current]
|
|
@@ -28017,7 +28183,7 @@ var PermissionsDialog = ({
|
|
|
28017
28183
|
rows.push({ key: CANCEL_VALUE, value: CANCEL_VALUE, label: "Cancel" });
|
|
28018
28184
|
return rows;
|
|
28019
28185
|
}, [modes, dirty]);
|
|
28020
|
-
const handleSelect =
|
|
28186
|
+
const handleSelect = useCallback20(
|
|
28021
28187
|
(value) => {
|
|
28022
28188
|
if (value === SAVE_VALUE) {
|
|
28023
28189
|
onSave(modes);
|
|
@@ -28032,7 +28198,7 @@ var PermissionsDialog = ({
|
|
|
28032
28198
|
},
|
|
28033
28199
|
[modes, onClose, onSave]
|
|
28034
28200
|
);
|
|
28035
|
-
const handleEscape =
|
|
28201
|
+
const handleEscape = useCallback20(
|
|
28036
28202
|
(key) => {
|
|
28037
28203
|
if (key.name === "escape") {
|
|
28038
28204
|
onClose();
|
|
@@ -28041,7 +28207,7 @@ var PermissionsDialog = ({
|
|
|
28041
28207
|
[onClose]
|
|
28042
28208
|
);
|
|
28043
28209
|
useKeypress(handleEscape, { isActive: true });
|
|
28044
|
-
return /* @__PURE__ */
|
|
28210
|
+
return /* @__PURE__ */ jsxs40(
|
|
28045
28211
|
Box35,
|
|
28046
28212
|
{
|
|
28047
28213
|
flexDirection: "column",
|
|
@@ -28051,9 +28217,9 @@ var PermissionsDialog = ({
|
|
|
28051
28217
|
marginLeft: 2,
|
|
28052
28218
|
marginRight: 2,
|
|
28053
28219
|
children: [
|
|
28054
|
-
/* @__PURE__ */ jsx44(
|
|
28220
|
+
/* @__PURE__ */ jsx44(Text43, { bold: true, color: theme.text.accent, children: "Permission policy" }),
|
|
28055
28221
|
/* @__PURE__ */ jsx44(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
|
|
28056
|
-
/* @__PURE__ */ jsx44(
|
|
28222
|
+
/* @__PURE__ */ jsx44(Text43, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter cycles allow/ask/deny \xB7 Esc cancel" })
|
|
28057
28223
|
]
|
|
28058
28224
|
}
|
|
28059
28225
|
);
|
|
@@ -28068,10 +28234,10 @@ var AuthDialog = ({
|
|
|
28068
28234
|
onPersistToken,
|
|
28069
28235
|
onClose
|
|
28070
28236
|
}) => {
|
|
28071
|
-
const [phase, setPhase] =
|
|
28072
|
-
const [deviceCode, setDeviceCode] =
|
|
28073
|
-
const [message, setMessage] =
|
|
28074
|
-
const abortRef =
|
|
28237
|
+
const [phase, setPhase] = useState25("menu");
|
|
28238
|
+
const [deviceCode, setDeviceCode] = useState25(null);
|
|
28239
|
+
const [message, setMessage] = useState25("");
|
|
28240
|
+
const abortRef = useRef15(null);
|
|
28075
28241
|
const items = useMemo13(
|
|
28076
28242
|
() => [
|
|
28077
28243
|
{ key: "login", value: "login", label: "Login with GitHub" },
|
|
@@ -28080,7 +28246,7 @@ var AuthDialog = ({
|
|
|
28080
28246
|
],
|
|
28081
28247
|
[hasToken]
|
|
28082
28248
|
);
|
|
28083
|
-
const startLogin =
|
|
28249
|
+
const startLogin = useCallback21(async () => {
|
|
28084
28250
|
if (!clientId) {
|
|
28085
28251
|
setMessage(
|
|
28086
28252
|
"No OAuth client configured. Set github.oauthClientId in .deepcode/config.json, or run `deepcode github login` in a terminal."
|
|
@@ -28124,7 +28290,7 @@ var AuthDialog = ({
|
|
|
28124
28290
|
abortRef.current = null;
|
|
28125
28291
|
}
|
|
28126
28292
|
}, [clientId, enterpriseUrl, onPersistToken, scopes, worktree]);
|
|
28127
|
-
const clearToken =
|
|
28293
|
+
const clearToken = useCallback21(async () => {
|
|
28128
28294
|
try {
|
|
28129
28295
|
await onPersistToken(void 0);
|
|
28130
28296
|
setPhase("done");
|
|
@@ -28134,7 +28300,7 @@ var AuthDialog = ({
|
|
|
28134
28300
|
setMessage(error instanceof Error ? error.message : String(error));
|
|
28135
28301
|
}
|
|
28136
28302
|
}, [onPersistToken]);
|
|
28137
|
-
const handleSelect =
|
|
28303
|
+
const handleSelect = useCallback21(
|
|
28138
28304
|
(value) => {
|
|
28139
28305
|
if (value === "login") {
|
|
28140
28306
|
void startLogin();
|
|
@@ -28149,7 +28315,7 @@ var AuthDialog = ({
|
|
|
28149
28315
|
useEffect23(() => () => {
|
|
28150
28316
|
abortRef.current?.abort();
|
|
28151
28317
|
}, []);
|
|
28152
|
-
const handleEscape =
|
|
28318
|
+
const handleEscape = useCallback21(
|
|
28153
28319
|
(key) => {
|
|
28154
28320
|
if (key.name !== "escape") return;
|
|
28155
28321
|
if (phase === "running") {
|
|
@@ -28161,7 +28327,7 @@ var AuthDialog = ({
|
|
|
28161
28327
|
[onClose, phase]
|
|
28162
28328
|
);
|
|
28163
28329
|
useKeypress(handleEscape, { isActive: true });
|
|
28164
|
-
return /* @__PURE__ */
|
|
28330
|
+
return /* @__PURE__ */ jsxs41(
|
|
28165
28331
|
Box36,
|
|
28166
28332
|
{
|
|
28167
28333
|
flexDirection: "column",
|
|
@@ -28171,32 +28337,32 @@ var AuthDialog = ({
|
|
|
28171
28337
|
marginLeft: 2,
|
|
28172
28338
|
marginRight: 2,
|
|
28173
28339
|
children: [
|
|
28174
|
-
/* @__PURE__ */ jsx45(
|
|
28175
|
-
/* @__PURE__ */ jsx45(
|
|
28340
|
+
/* @__PURE__ */ jsx45(Text44, { bold: true, color: theme.text.accent, children: "GitHub authentication" }),
|
|
28341
|
+
/* @__PURE__ */ jsx45(Text44, { color: theme.text.secondary, children: statusSummary }),
|
|
28176
28342
|
phase === "menu" && /* @__PURE__ */ jsx45(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
|
|
28177
|
-
deviceCode && phase === "running" && /* @__PURE__ */
|
|
28178
|
-
/* @__PURE__ */
|
|
28343
|
+
deviceCode && phase === "running" && /* @__PURE__ */ jsxs41(Box36, { flexDirection: "column", marginTop: 1, children: [
|
|
28344
|
+
/* @__PURE__ */ jsxs41(Text44, { children: [
|
|
28179
28345
|
"Open: ",
|
|
28180
|
-
/* @__PURE__ */ jsx45(
|
|
28346
|
+
/* @__PURE__ */ jsx45(Text44, { color: theme.text.accent, children: deviceCode.verificationUri })
|
|
28181
28347
|
] }),
|
|
28182
|
-
/* @__PURE__ */
|
|
28348
|
+
/* @__PURE__ */ jsxs41(Text44, { children: [
|
|
28183
28349
|
"Code: ",
|
|
28184
|
-
/* @__PURE__ */ jsx45(
|
|
28350
|
+
/* @__PURE__ */ jsx45(Text44, { bold: true, color: theme.text.accent, children: deviceCode.userCode })
|
|
28185
28351
|
] }),
|
|
28186
|
-
/* @__PURE__ */
|
|
28352
|
+
/* @__PURE__ */ jsxs41(Text44, { color: theme.text.secondary, children: [
|
|
28187
28353
|
"Expires in ",
|
|
28188
28354
|
Math.round(deviceCode.expiresIn / 60),
|
|
28189
28355
|
" minutes."
|
|
28190
28356
|
] })
|
|
28191
28357
|
] }),
|
|
28192
28358
|
message && /* @__PURE__ */ jsx45(
|
|
28193
|
-
|
|
28359
|
+
Text44,
|
|
28194
28360
|
{
|
|
28195
28361
|
color: phase === "error" ? theme.status.error : phase === "done" ? theme.status.success : theme.text.secondary,
|
|
28196
28362
|
children: message
|
|
28197
28363
|
}
|
|
28198
28364
|
),
|
|
28199
|
-
/* @__PURE__ */ jsx45(
|
|
28365
|
+
/* @__PURE__ */ jsx45(Text44, { color: theme.text.secondary, children: phase === "running" ? "Esc cancel login" : phase === "menu" ? "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc close" : "Esc close" })
|
|
28200
28366
|
]
|
|
28201
28367
|
}
|
|
28202
28368
|
);
|
|
@@ -28242,12 +28408,12 @@ var ModelDialog = ({
|
|
|
28242
28408
|
onSelectModel,
|
|
28243
28409
|
onClose
|
|
28244
28410
|
}) => {
|
|
28245
|
-
const [loadState, setLoadState] =
|
|
28246
|
-
const [models, setModels] =
|
|
28247
|
-
const [errorMsg, setErrorMsg] =
|
|
28248
|
-
const [search, setSearch] =
|
|
28249
|
-
const [activeSelIndex, setActiveSelIndex] =
|
|
28250
|
-
const abortRef =
|
|
28411
|
+
const [loadState, setLoadState] = useState26("loading");
|
|
28412
|
+
const [models, setModels] = useState26([]);
|
|
28413
|
+
const [errorMsg, setErrorMsg] = useState26("");
|
|
28414
|
+
const [search, setSearch] = useState26("");
|
|
28415
|
+
const [activeSelIndex, setActiveSelIndex] = useState26(0);
|
|
28416
|
+
const abortRef = useRef16(null);
|
|
28251
28417
|
useEffect24(() => {
|
|
28252
28418
|
const ctrl = new AbortController();
|
|
28253
28419
|
abortRef.current = ctrl;
|
|
@@ -28280,7 +28446,7 @@ var ModelDialog = ({
|
|
|
28280
28446
|
[activeRowPos, rows.length]
|
|
28281
28447
|
);
|
|
28282
28448
|
const visibleRows = rows.slice(scrollTop, scrollTop + MAX_VISIBLE);
|
|
28283
|
-
const confirm =
|
|
28449
|
+
const confirm = useCallback22(() => {
|
|
28284
28450
|
const row = rows.find((r) => r.kind === "item" && r.selIndex === clampedIndex);
|
|
28285
28451
|
if (row?.kind === "item") onSelectModel(row.model.id);
|
|
28286
28452
|
}, [rows, clampedIndex, onSelectModel]);
|
|
@@ -28323,7 +28489,7 @@ var ModelDialog = ({
|
|
|
28323
28489
|
}, { isActive: true });
|
|
28324
28490
|
const canScrollUp = scrollTop > 0;
|
|
28325
28491
|
const canScrollDown = scrollTop + MAX_VISIBLE < rows.length;
|
|
28326
|
-
return /* @__PURE__ */
|
|
28492
|
+
return /* @__PURE__ */ jsxs42(
|
|
28327
28493
|
Box37,
|
|
28328
28494
|
{
|
|
28329
28495
|
flexDirection: "column",
|
|
@@ -28335,15 +28501,15 @@ var ModelDialog = ({
|
|
|
28335
28501
|
marginRight: 1,
|
|
28336
28502
|
minWidth: 58,
|
|
28337
28503
|
children: [
|
|
28338
|
-
/* @__PURE__ */
|
|
28339
|
-
/* @__PURE__ */
|
|
28340
|
-
/* @__PURE__ */ jsx46(
|
|
28341
|
-
/* @__PURE__ */ jsx46(
|
|
28342
|
-
/* @__PURE__ */ jsx46(
|
|
28504
|
+
/* @__PURE__ */ jsxs42(Box37, { justifyContent: "space-between", marginBottom: 1, children: [
|
|
28505
|
+
/* @__PURE__ */ jsxs42(Box37, { gap: 1, children: [
|
|
28506
|
+
/* @__PURE__ */ jsx46(Text45, { bold: true, color: theme.text.primary, children: "Select model" }),
|
|
28507
|
+
/* @__PURE__ */ jsx46(Text45, { color: theme.text.secondary, children: "for" }),
|
|
28508
|
+
/* @__PURE__ */ jsx46(Text45, { color: theme.text.accent, children: currentProvider })
|
|
28343
28509
|
] }),
|
|
28344
|
-
/* @__PURE__ */ jsx46(
|
|
28510
|
+
/* @__PURE__ */ jsx46(Text45, { color: theme.ui.comment, dimColor: true, children: "esc" })
|
|
28345
28511
|
] }),
|
|
28346
|
-
/* @__PURE__ */
|
|
28512
|
+
/* @__PURE__ */ jsxs42(
|
|
28347
28513
|
Box37,
|
|
28348
28514
|
{
|
|
28349
28515
|
borderStyle: "single",
|
|
@@ -28351,57 +28517,57 @@ var ModelDialog = ({
|
|
|
28351
28517
|
paddingX: 1,
|
|
28352
28518
|
marginBottom: 1,
|
|
28353
28519
|
children: [
|
|
28354
|
-
/* @__PURE__ */ jsx46(
|
|
28355
|
-
search ? /* @__PURE__ */
|
|
28520
|
+
/* @__PURE__ */ jsx46(Text45, { color: theme.ui.comment, children: "\u2315 " }),
|
|
28521
|
+
search ? /* @__PURE__ */ jsxs42(Text45, { color: theme.text.primary, children: [
|
|
28356
28522
|
search,
|
|
28357
|
-
/* @__PURE__ */ jsx46(
|
|
28358
|
-
] }) : /* @__PURE__ */
|
|
28523
|
+
/* @__PURE__ */ jsx46(Text45, { color: theme.text.accent, children: "\u258C" })
|
|
28524
|
+
] }) : /* @__PURE__ */ jsxs42(Text45, { color: theme.ui.comment, dimColor: true, children: [
|
|
28359
28525
|
"Search",
|
|
28360
|
-
/* @__PURE__ */ jsx46(
|
|
28526
|
+
/* @__PURE__ */ jsx46(Text45, { color: theme.text.accent, children: "\u258C" })
|
|
28361
28527
|
] })
|
|
28362
28528
|
]
|
|
28363
28529
|
}
|
|
28364
28530
|
),
|
|
28365
|
-
loadState === "loading" && /* @__PURE__ */ jsx46(Box37, { marginY: 1, children: /* @__PURE__ */ jsx46(
|
|
28366
|
-
loadState === "error" && /* @__PURE__ */
|
|
28367
|
-
/* @__PURE__ */ jsx46(
|
|
28368
|
-
/* @__PURE__ */ jsx46(
|
|
28531
|
+
loadState === "loading" && /* @__PURE__ */ jsx46(Box37, { marginY: 1, children: /* @__PURE__ */ jsx46(Text45, { color: theme.text.secondary, children: "Loading models\u2026" }) }),
|
|
28532
|
+
loadState === "error" && /* @__PURE__ */ jsxs42(Box37, { flexDirection: "column", marginY: 1, children: [
|
|
28533
|
+
/* @__PURE__ */ jsx46(Text45, { color: theme.status.error, children: "\u2717 Could not load models" }),
|
|
28534
|
+
/* @__PURE__ */ jsx46(Text45, { color: theme.ui.comment, dimColor: true, children: errorMsg })
|
|
28369
28535
|
] }),
|
|
28370
|
-
loadState === "ready" && selectableCount === 0 && /* @__PURE__ */ jsx46(Box37, { marginY: 1, children: /* @__PURE__ */
|
|
28536
|
+
loadState === "ready" && selectableCount === 0 && /* @__PURE__ */ jsx46(Box37, { marginY: 1, children: /* @__PURE__ */ jsxs42(Text45, { color: theme.ui.comment, dimColor: true, children: [
|
|
28371
28537
|
'No models match "',
|
|
28372
28538
|
search,
|
|
28373
28539
|
'"'
|
|
28374
28540
|
] }) }),
|
|
28375
|
-
loadState === "ready" && selectableCount > 0 && /* @__PURE__ */
|
|
28376
|
-
canScrollUp && /* @__PURE__ */ jsx46(
|
|
28541
|
+
loadState === "ready" && selectableCount > 0 && /* @__PURE__ */ jsxs42(Box37, { flexDirection: "column", children: [
|
|
28542
|
+
canScrollUp && /* @__PURE__ */ jsx46(Text45, { color: theme.ui.comment, dimColor: true, children: " \u2191" }),
|
|
28377
28543
|
visibleRows.map((row, i) => {
|
|
28378
28544
|
if (row.kind === "header") {
|
|
28379
|
-
return /* @__PURE__ */ jsx46(Box37, { marginTop: i === 0 ? 0 : 1, children: /* @__PURE__ */ jsx46(
|
|
28545
|
+
return /* @__PURE__ */ jsx46(Box37, { marginTop: i === 0 ? 0 : 1, children: /* @__PURE__ */ jsx46(Text45, { color: theme.text.accent, bold: true, children: row.label }) }, `h${i}`);
|
|
28380
28546
|
}
|
|
28381
28547
|
const { model, selIndex } = row;
|
|
28382
28548
|
const isActive = selIndex === clampedIndex;
|
|
28383
28549
|
const isCurrent = model.id === currentModel;
|
|
28384
28550
|
const free = isFree(model);
|
|
28385
28551
|
const group = providerGroup(model);
|
|
28386
|
-
return /* @__PURE__ */
|
|
28387
|
-
/* @__PURE__ */ jsx46(
|
|
28388
|
-
/* @__PURE__ */
|
|
28552
|
+
return /* @__PURE__ */ jsxs42(Box37, { gap: 1, children: [
|
|
28553
|
+
/* @__PURE__ */ jsx46(Text45, { color: isActive ? theme.text.accent : theme.ui.comment, children: isCurrent ? "\u25CF" : isActive ? "\u203A" : " " }),
|
|
28554
|
+
/* @__PURE__ */ jsxs42(Box37, { flexGrow: 1, gap: 1, children: [
|
|
28389
28555
|
/* @__PURE__ */ jsx46(
|
|
28390
|
-
|
|
28556
|
+
Text45,
|
|
28391
28557
|
{
|
|
28392
28558
|
color: isActive ? theme.text.primary : theme.text.secondary,
|
|
28393
28559
|
bold: isActive,
|
|
28394
28560
|
children: model.name
|
|
28395
28561
|
}
|
|
28396
28562
|
),
|
|
28397
|
-
/* @__PURE__ */ jsx46(
|
|
28563
|
+
/* @__PURE__ */ jsx46(Text45, { color: theme.text.accent, dimColor: true, children: group })
|
|
28398
28564
|
] }),
|
|
28399
|
-
free && /* @__PURE__ */ jsx46(
|
|
28565
|
+
free && /* @__PURE__ */ jsx46(Text45, { color: theme.status.success, dimColor: !isActive, children: "Free" })
|
|
28400
28566
|
] }, model.id);
|
|
28401
28567
|
}),
|
|
28402
|
-
canScrollDown && /* @__PURE__ */ jsx46(
|
|
28568
|
+
canScrollDown && /* @__PURE__ */ jsx46(Text45, { color: theme.ui.comment, dimColor: true, children: " \u2193" })
|
|
28403
28569
|
] }),
|
|
28404
|
-
loadState === "ready" && /* @__PURE__ */ jsx46(Box37, { marginTop: 1, children: /* @__PURE__ */
|
|
28570
|
+
loadState === "ready" && /* @__PURE__ */ jsx46(Box37, { marginTop: 1, children: /* @__PURE__ */ jsxs42(Text45, { color: theme.ui.comment, dimColor: true, children: [
|
|
28405
28571
|
selectableCount,
|
|
28406
28572
|
" model",
|
|
28407
28573
|
selectableCount !== 1 ? "s" : "",
|
|
@@ -28417,13 +28583,61 @@ var ModelDialog = ({
|
|
|
28417
28583
|
borderLeft: false,
|
|
28418
28584
|
borderRight: false,
|
|
28419
28585
|
borderColor: theme.ui.comment,
|
|
28420
|
-
children: /* @__PURE__ */ jsx46(
|
|
28586
|
+
children: /* @__PURE__ */ jsx46(Text45, { color: theme.ui.comment, dimColor: true, children: "\u2191\u2193 navigate type to search Enter use for session Esc close" })
|
|
28421
28587
|
}
|
|
28422
28588
|
)
|
|
28423
28589
|
]
|
|
28424
28590
|
}
|
|
28425
28591
|
);
|
|
28426
28592
|
};
|
|
28593
|
+
function statusIcon(entry) {
|
|
28594
|
+
if (entry.status === "done") return "\u2713";
|
|
28595
|
+
if (entry.status === "failed") return "\u2717";
|
|
28596
|
+
return "\u2026";
|
|
28597
|
+
}
|
|
28598
|
+
function statusColor2(entry) {
|
|
28599
|
+
if (entry.status === "done") return theme.status.success;
|
|
28600
|
+
if (entry.status === "failed") return theme.status.error;
|
|
28601
|
+
return theme.text.accent;
|
|
28602
|
+
}
|
|
28603
|
+
var SubagentsPanel = ({ subagents, mainAreaWidth }) => {
|
|
28604
|
+
if (subagents.length === 0) return null;
|
|
28605
|
+
const running = subagents.filter((s) => s.status === "running").length;
|
|
28606
|
+
const title = running > 0 ? `Subagents (${running} running)` : `Subagents (${subagents.length} finishing\u2026)`;
|
|
28607
|
+
return /* @__PURE__ */ jsxs43(
|
|
28608
|
+
Box38,
|
|
28609
|
+
{
|
|
28610
|
+
flexDirection: "column",
|
|
28611
|
+
borderStyle: "round",
|
|
28612
|
+
borderColor: theme.text.accent,
|
|
28613
|
+
marginLeft: 2,
|
|
28614
|
+
marginRight: 2,
|
|
28615
|
+
marginTop: 1,
|
|
28616
|
+
width: Math.min(mainAreaWidth, 80),
|
|
28617
|
+
children: [
|
|
28618
|
+
/* @__PURE__ */ jsx47(Box38, { paddingX: 1, children: /* @__PURE__ */ jsx47(Text46, { bold: true, color: theme.text.accent, children: title }) }),
|
|
28619
|
+
subagents.map((entry) => /* @__PURE__ */ jsxs43(Box38, { flexDirection: "row", paddingX: 1, gap: 1, children: [
|
|
28620
|
+
/* @__PURE__ */ jsx47(Text46, { color: statusColor2(entry), children: statusIcon(entry) }),
|
|
28621
|
+
/* @__PURE__ */ jsxs43(Box38, { flexDirection: "column", flexShrink: 1, children: [
|
|
28622
|
+
/* @__PURE__ */ jsxs43(Text46, { wrap: "truncate", color: theme.text.primary, children: [
|
|
28623
|
+
entry.prompt,
|
|
28624
|
+
entry.prompt.length >= 50 ? "\u2026" : ""
|
|
28625
|
+
] }),
|
|
28626
|
+
entry.status === "running" && entry.currentTool && /* @__PURE__ */ jsxs43(Text46, { color: theme.text.secondary, dimColor: true, children: [
|
|
28627
|
+
" ",
|
|
28628
|
+
"using ",
|
|
28629
|
+
entry.currentTool
|
|
28630
|
+
] }),
|
|
28631
|
+
entry.status === "failed" && entry.error && /* @__PURE__ */ jsxs43(Text46, { color: theme.status.error, dimColor: true, children: [
|
|
28632
|
+
" ",
|
|
28633
|
+
entry.error.slice(0, 60)
|
|
28634
|
+
] })
|
|
28635
|
+
] })
|
|
28636
|
+
] }, entry.taskId))
|
|
28637
|
+
]
|
|
28638
|
+
}
|
|
28639
|
+
);
|
|
28640
|
+
};
|
|
28427
28641
|
function safeStringify(value, maxLength = 220) {
|
|
28428
28642
|
try {
|
|
28429
28643
|
const serialized = JSON.stringify(value);
|
|
@@ -28552,67 +28766,94 @@ function resolveSlashInvocation(rawInput, commands) {
|
|
|
28552
28766
|
args: tokens.slice(consumed).join(" ")
|
|
28553
28767
|
};
|
|
28554
28768
|
}
|
|
28769
|
+
async function generateFollowupSuggestion(runtime, session, lastOutput, signal) {
|
|
28770
|
+
if (!lastOutput.trim()) return null;
|
|
28771
|
+
try {
|
|
28772
|
+
const provider = runtime.providers.get(session.provider);
|
|
28773
|
+
const model = session.model;
|
|
28774
|
+
if (!model) return null;
|
|
28775
|
+
const snippet = lastOutput.trim().slice(-300);
|
|
28776
|
+
const prompt = `[Task: suggest ONE concise follow-up question or action the user might ask next, in under 10 words. Return ONLY the suggestion text, no explanation, no quotes, no punctuation at the end.]
|
|
28777
|
+
|
|
28778
|
+
Assistant just said:
|
|
28779
|
+
${snippet}
|
|
28780
|
+
|
|
28781
|
+
Follow-up suggestion:`;
|
|
28782
|
+
const suggestion = await provider.complete(prompt, {
|
|
28783
|
+
model,
|
|
28784
|
+
maxTokens: 20,
|
|
28785
|
+
temperature: 0.7,
|
|
28786
|
+
signal
|
|
28787
|
+
});
|
|
28788
|
+
const clean = suggestion.trim().replace(/^["']|["']$/g, "").replace(/[.!?]$/, "").split("\n")[0].trim();
|
|
28789
|
+
if (!clean || clean.length < 3 || clean.length > 80) return null;
|
|
28790
|
+
return clean;
|
|
28791
|
+
} catch {
|
|
28792
|
+
return null;
|
|
28793
|
+
}
|
|
28794
|
+
}
|
|
28555
28795
|
var AppContainer = ({ cwd, config, provider, model }) => {
|
|
28556
28796
|
const historyManager = useHistory();
|
|
28557
28797
|
const addHistoryItem = historyManager.addItem;
|
|
28558
|
-
const [initError, setInitError] =
|
|
28559
|
-
const [isInitializing, setIsInitializing] =
|
|
28560
|
-
const [isRunning, setIsRunning] =
|
|
28561
|
-
const [pendingAssistantText, setPendingAssistantText] =
|
|
28562
|
-
const [approvalQueue, setApprovalQueue] =
|
|
28563
|
-
const [providerLabel, setProviderLabel] =
|
|
28564
|
-
const [targetSource, setTargetSource] =
|
|
28565
|
-
const [currentModel, setCurrentModel] =
|
|
28566
|
-
const [agentMode, setAgentMode] =
|
|
28567
|
-
const [streamingState, setStreamingState] =
|
|
28798
|
+
const [initError, setInitError] = useState27(null);
|
|
28799
|
+
const [isInitializing, setIsInitializing] = useState27(true);
|
|
28800
|
+
const [isRunning, setIsRunning] = useState27(false);
|
|
28801
|
+
const [pendingAssistantText, setPendingAssistantText] = useState27("");
|
|
28802
|
+
const [approvalQueue, setApprovalQueue] = useState27([]);
|
|
28803
|
+
const [providerLabel, setProviderLabel] = useState27("(unconfigured)");
|
|
28804
|
+
const [targetSource, setTargetSource] = useState27("config");
|
|
28805
|
+
const [currentModel, setCurrentModel] = useState27("(unconfigured)");
|
|
28806
|
+
const [agentMode, setAgentMode] = useState27("build");
|
|
28807
|
+
const [streamingState, setStreamingState] = useState27(
|
|
28568
28808
|
"idle"
|
|
28569
28809
|
/* Idle */
|
|
28570
28810
|
);
|
|
28571
|
-
const [compactMode, setCompactMode] =
|
|
28572
|
-
const [shellModeActive, setShellModeActive] =
|
|
28573
|
-
const [showEscapePrompt, setShowEscapePrompt] =
|
|
28574
|
-
const [messageQueue, setMessageQueue] =
|
|
28575
|
-
const [historyRemountKey, setHistoryRemountKey] =
|
|
28576
|
-
const [pendingItem, setPendingItem] =
|
|
28577
|
-
const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] =
|
|
28578
|
-
const [lastPromptTokenCount, setLastPromptTokenCount] =
|
|
28579
|
-
const [lastOutputTokenCount, setLastOutputTokenCount] =
|
|
28580
|
-
const [elapsedTime, setElapsedTime] =
|
|
28581
|
-
const [isReceivingContent, setIsReceivingContent] =
|
|
28582
|
-
const [iterationInfo, setIterationInfo] =
|
|
28583
|
-
const [liveToolCalls, setLiveToolCalls] =
|
|
28584
|
-
const [taskPlan, setTaskPlan] =
|
|
28585
|
-
const [taskStreams, setTaskStreams] =
|
|
28586
|
-
const [recentSlashCommandsState, setRecentSlashCommandsState] =
|
|
28587
|
-
const [activeDialog, setActiveDialog] =
|
|
28588
|
-
const [themeName, setThemeName] =
|
|
28589
|
-
const [permissionSummary, setPermissionSummary] =
|
|
28590
|
-
const [authSummary, setAuthSummary] =
|
|
28591
|
-
const [permissionModes, setPermissionModes] =
|
|
28811
|
+
const [compactMode, setCompactMode] = useState27(false);
|
|
28812
|
+
const [shellModeActive, setShellModeActive] = useState27(false);
|
|
28813
|
+
const [showEscapePrompt, setShowEscapePrompt] = useState27(false);
|
|
28814
|
+
const [messageQueue, setMessageQueue] = useState27([]);
|
|
28815
|
+
const [historyRemountKey, setHistoryRemountKey] = useState27(0);
|
|
28816
|
+
const [pendingItem, setPendingItem] = useState27(null);
|
|
28817
|
+
const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = useState27(false);
|
|
28818
|
+
const [lastPromptTokenCount, setLastPromptTokenCount] = useState27(0);
|
|
28819
|
+
const [lastOutputTokenCount, setLastOutputTokenCount] = useState27(0);
|
|
28820
|
+
const [elapsedTime, setElapsedTime] = useState27(0);
|
|
28821
|
+
const [isReceivingContent, setIsReceivingContent] = useState27(false);
|
|
28822
|
+
const [iterationInfo, setIterationInfo] = useState27(null);
|
|
28823
|
+
const [liveToolCalls, setLiveToolCalls] = useState27([]);
|
|
28824
|
+
const [taskPlan, setTaskPlan] = useState27(null);
|
|
28825
|
+
const [taskStreams, setTaskStreams] = useState27({});
|
|
28826
|
+
const [recentSlashCommandsState, setRecentSlashCommandsState] = useState27(/* @__PURE__ */ new Map());
|
|
28827
|
+
const [activeDialog, setActiveDialog] = useState27(null);
|
|
28828
|
+
const [themeName, setThemeName] = useState27("(unknown)");
|
|
28829
|
+
const [permissionSummary, setPermissionSummary] = useState27("(unknown)");
|
|
28830
|
+
const [authSummary, setAuthSummary] = useState27("(unknown)");
|
|
28831
|
+
const [permissionModes, setPermissionModes] = useState27({
|
|
28592
28832
|
read: "allow",
|
|
28593
28833
|
write: "ask",
|
|
28594
28834
|
gitLocal: "allow",
|
|
28595
28835
|
shell: "ask",
|
|
28596
28836
|
dangerous: "ask"
|
|
28597
28837
|
});
|
|
28598
|
-
const [providerConfigVersion, setProviderConfigVersion] =
|
|
28599
|
-
const [, setThemeVersion] =
|
|
28600
|
-
const [mcpConnected, setMcpConnected] =
|
|
28601
|
-
const [mcpTotal, setMcpTotal] =
|
|
28602
|
-
const [,
|
|
28603
|
-
const [
|
|
28604
|
-
const
|
|
28605
|
-
const
|
|
28606
|
-
const
|
|
28607
|
-
const
|
|
28608
|
-
const
|
|
28609
|
-
const
|
|
28610
|
-
const
|
|
28611
|
-
const
|
|
28612
|
-
const
|
|
28613
|
-
const
|
|
28614
|
-
const
|
|
28615
|
-
const
|
|
28838
|
+
const [providerConfigVersion, setProviderConfigVersion] = useState27(0);
|
|
28839
|
+
const [, setThemeVersion] = useState27(0);
|
|
28840
|
+
const [mcpConnected, setMcpConnected] = useState27(0);
|
|
28841
|
+
const [mcpTotal, setMcpTotal] = useState27(0);
|
|
28842
|
+
const [subagentMap, setSubagentMap] = useState27(/* @__PURE__ */ new Map());
|
|
28843
|
+
const [, setDrainTick] = useState27(0);
|
|
28844
|
+
const [pendingCommandConfirmation, setPendingCommandConfirmation] = useState27(null);
|
|
28845
|
+
const runtimeRef = useRef17(null);
|
|
28846
|
+
const sessionRef = useRef17(null);
|
|
28847
|
+
const configAdapterRef = useRef17(null);
|
|
28848
|
+
const abortRef = useRef17(null);
|
|
28849
|
+
const unsubscribeRef = useRef17([]);
|
|
28850
|
+
const lastSubmittedPromptRef = useRef17(null);
|
|
28851
|
+
const runStartedAtRef = useRef17(null);
|
|
28852
|
+
const streamingResponseLengthRef = useRef17(0);
|
|
28853
|
+
const drainingQueueRef = useRef17(false);
|
|
28854
|
+
const messageQueueRef = useRef17([]);
|
|
28855
|
+
const sessionShellAllowlistRef = useRef17(/* @__PURE__ */ new Set());
|
|
28856
|
+
const mainControlsRef = useRef17(null);
|
|
28616
28857
|
const { stdin, setRawMode } = useStdin3();
|
|
28617
28858
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
28618
28859
|
const mainAreaWidth = Math.min(Math.max(terminalWidth - 4, 20), 120);
|
|
@@ -28633,7 +28874,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28633
28874
|
[]
|
|
28634
28875
|
);
|
|
28635
28876
|
const configAdapter = configAdapterRef.current ?? new DeepCodeConfigAdapter(cwd);
|
|
28636
|
-
const isValidPath =
|
|
28877
|
+
const isValidPath = useCallback23(
|
|
28637
28878
|
(candidate) => {
|
|
28638
28879
|
const resolved = path112.resolve(cwd, candidate);
|
|
28639
28880
|
const relative2 = path112.relative(cwd, resolved);
|
|
@@ -28678,9 +28919,9 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28678
28919
|
() => recentSlashCommandsState,
|
|
28679
28920
|
[recentSlashCommandsState]
|
|
28680
28921
|
);
|
|
28681
|
-
const
|
|
28682
|
-
|
|
28683
|
-
const registerSlashCommandUsage =
|
|
28922
|
+
const [promptSuggestion, setPromptSuggestion] = useState27(null);
|
|
28923
|
+
const dismissPromptSuggestion = useCallback23(() => setPromptSuggestion(null), []);
|
|
28924
|
+
const registerSlashCommandUsage = useCallback23((name) => {
|
|
28684
28925
|
setRecentSlashCommandsState((prev) => {
|
|
28685
28926
|
const next = new Map(prev);
|
|
28686
28927
|
const existing = next.get(name);
|
|
@@ -28692,8 +28933,8 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28692
28933
|
return next;
|
|
28693
28934
|
});
|
|
28694
28935
|
}, []);
|
|
28695
|
-
const listAvailableProviders =
|
|
28696
|
-
const getSessionCommandState =
|
|
28936
|
+
const listAvailableProviders = useCallback23(() => PROVIDER_IDS, []);
|
|
28937
|
+
const getSessionCommandState = useCallback23(() => {
|
|
28697
28938
|
const runtime = runtimeRef.current;
|
|
28698
28939
|
const session = sessionRef.current;
|
|
28699
28940
|
const fallbackProvider = runtime?.config.defaultProvider ?? PROVIDER_IDS[0];
|
|
@@ -28705,7 +28946,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28705
28946
|
mode: agentMode
|
|
28706
28947
|
};
|
|
28707
28948
|
}, [agentMode]);
|
|
28708
|
-
const setSessionProvider =
|
|
28949
|
+
const setSessionProvider = useCallback23((provider2) => {
|
|
28709
28950
|
const runtime = runtimeRef.current;
|
|
28710
28951
|
const session = sessionRef.current;
|
|
28711
28952
|
if (!runtime || !session) return;
|
|
@@ -28725,7 +28966,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28725
28966
|
);
|
|
28726
28967
|
}
|
|
28727
28968
|
}, [historyManager]);
|
|
28728
|
-
const setSessionModel =
|
|
28969
|
+
const setSessionModel = useCallback23((model2) => {
|
|
28729
28970
|
const runtime = runtimeRef.current;
|
|
28730
28971
|
const session = sessionRef.current;
|
|
28731
28972
|
if (!runtime || !session) return;
|
|
@@ -28736,7 +28977,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28736
28977
|
setCurrentModel(session.model ?? "(unconfigured)");
|
|
28737
28978
|
setProviderLabel(formatProviderLabel(session.provider, session.model));
|
|
28738
28979
|
}, []);
|
|
28739
|
-
const setSessionMode =
|
|
28980
|
+
const setSessionMode = useCallback23((mode) => {
|
|
28740
28981
|
setAgentMode(mode);
|
|
28741
28982
|
}, []);
|
|
28742
28983
|
const sessionCommandServices = useMemo15(
|
|
@@ -28902,6 +29143,49 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28902
29143
|
setLiveToolCalls((prev) => reduceToolActivity(prev, activity));
|
|
28903
29144
|
})
|
|
28904
29145
|
);
|
|
29146
|
+
unsubscribers.push(
|
|
29147
|
+
runtime.events.on("subagent:start", ({ taskId, prompt }) => {
|
|
29148
|
+
setSubagentMap((prev) => {
|
|
29149
|
+
const next = new Map(prev);
|
|
29150
|
+
next.set(taskId, {
|
|
29151
|
+
taskId,
|
|
29152
|
+
prompt: prompt.slice(0, 50),
|
|
29153
|
+
status: "running",
|
|
29154
|
+
startedAt: Date.now()
|
|
29155
|
+
});
|
|
29156
|
+
return next;
|
|
29157
|
+
});
|
|
29158
|
+
})
|
|
29159
|
+
);
|
|
29160
|
+
unsubscribers.push(
|
|
29161
|
+
runtime.events.on("subagent:tool", ({ taskId, toolName, active }) => {
|
|
29162
|
+
setSubagentMap((prev) => {
|
|
29163
|
+
const entry = prev.get(taskId);
|
|
29164
|
+
if (!entry) return prev;
|
|
29165
|
+
const next = new Map(prev);
|
|
29166
|
+
next.set(taskId, { ...entry, currentTool: active ? toolName : void 0 });
|
|
29167
|
+
return next;
|
|
29168
|
+
});
|
|
29169
|
+
})
|
|
29170
|
+
);
|
|
29171
|
+
unsubscribers.push(
|
|
29172
|
+
runtime.events.on("subagent:complete", ({ taskId, error }) => {
|
|
29173
|
+
setSubagentMap((prev) => {
|
|
29174
|
+
const entry = prev.get(taskId);
|
|
29175
|
+
if (!entry) return prev;
|
|
29176
|
+
const next = new Map(prev);
|
|
29177
|
+
next.set(taskId, { ...entry, status: error ? "failed" : "done", currentTool: void 0, error });
|
|
29178
|
+
setTimeout(() => {
|
|
29179
|
+
setSubagentMap((m) => {
|
|
29180
|
+
const updated = new Map(m);
|
|
29181
|
+
updated.delete(taskId);
|
|
29182
|
+
return updated;
|
|
29183
|
+
});
|
|
29184
|
+
}, 3e3);
|
|
29185
|
+
return next;
|
|
29186
|
+
});
|
|
29187
|
+
})
|
|
29188
|
+
);
|
|
28905
29189
|
unsubscribeRef.current = unsubscribers;
|
|
28906
29190
|
setIsInitializing(false);
|
|
28907
29191
|
addHistoryItem(
|
|
@@ -28929,7 +29213,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28929
29213
|
unsubscribeRef.current = [];
|
|
28930
29214
|
};
|
|
28931
29215
|
}, [addHistoryItem, config, cwd, model, provider]);
|
|
28932
|
-
const resolveApproval =
|
|
29216
|
+
const resolveApproval = useCallback23(
|
|
28933
29217
|
(decision) => {
|
|
28934
29218
|
const runtime = runtimeRef.current;
|
|
28935
29219
|
const current = approvalQueue[0];
|
|
@@ -28942,7 +29226,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28942
29226
|
},
|
|
28943
29227
|
[approvalQueue]
|
|
28944
29228
|
);
|
|
28945
|
-
const appendTurnItems =
|
|
29229
|
+
const appendTurnItems = useCallback23(
|
|
28946
29230
|
(items) => {
|
|
28947
29231
|
const base = Date.now();
|
|
28948
29232
|
for (const item of items) {
|
|
@@ -28951,7 +29235,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28951
29235
|
},
|
|
28952
29236
|
[historyManager]
|
|
28953
29237
|
);
|
|
28954
|
-
const runPrompt =
|
|
29238
|
+
const runPrompt = useCallback23(
|
|
28955
29239
|
async (rawPrompt) => {
|
|
28956
29240
|
const runtime = runtimeRef.current;
|
|
28957
29241
|
const session = sessionRef.current;
|
|
@@ -28960,6 +29244,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28960
29244
|
if (!prompt) return;
|
|
28961
29245
|
historyManager.addItem({ type: "user", text: prompt }, Date.now());
|
|
28962
29246
|
lastSubmittedPromptRef.current = prompt;
|
|
29247
|
+
setPromptSuggestion(null);
|
|
28963
29248
|
setPendingAssistantText("");
|
|
28964
29249
|
setIsRunning(true);
|
|
28965
29250
|
setIsReceivingContent(false);
|
|
@@ -29012,6 +29297,14 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29012
29297
|
turnItems.push({ type: "gemini", text: output.trim() });
|
|
29013
29298
|
}
|
|
29014
29299
|
appendTurnItems(turnItems);
|
|
29300
|
+
const rt = runtimeRef.current;
|
|
29301
|
+
const sess = sessionRef.current;
|
|
29302
|
+
if (rt && sess && output.trim()) {
|
|
29303
|
+
generateFollowupSuggestion(rt, sess, output, controller.signal).then((s) => {
|
|
29304
|
+
if (s) setPromptSuggestion(s);
|
|
29305
|
+
}).catch(() => {
|
|
29306
|
+
});
|
|
29307
|
+
}
|
|
29015
29308
|
} catch (error) {
|
|
29016
29309
|
const aborted = controller.signal.aborted;
|
|
29017
29310
|
const partialMessages = session.messages.slice(startIndex);
|
|
@@ -29033,7 +29326,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29033
29326
|
},
|
|
29034
29327
|
[agentMode, appendTurnItems, historyManager]
|
|
29035
29328
|
);
|
|
29036
|
-
const executeClientToolCommand =
|
|
29329
|
+
const executeClientToolCommand = useCallback23(
|
|
29037
29330
|
async (toolName, toolArgs) => {
|
|
29038
29331
|
const runtime = runtimeRef.current;
|
|
29039
29332
|
const session = sessionRef.current;
|
|
@@ -29126,7 +29419,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29126
29419
|
},
|
|
29127
29420
|
[agentMode, historyManager]
|
|
29128
29421
|
);
|
|
29129
|
-
const applySlashCommandResult =
|
|
29422
|
+
const applySlashCommandResult = useCallback23(
|
|
29130
29423
|
async (result, _rawInvocation) => {
|
|
29131
29424
|
if (!result) return;
|
|
29132
29425
|
switch (result.type) {
|
|
@@ -29187,7 +29480,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29187
29480
|
},
|
|
29188
29481
|
[appendTurnItems, executeClientToolCommand, historyManager, runPrompt]
|
|
29189
29482
|
);
|
|
29190
|
-
const executeSlashCommand =
|
|
29483
|
+
const executeSlashCommand = useCallback23(
|
|
29191
29484
|
async (rawInput, overwriteConfirmed = false) => {
|
|
29192
29485
|
const trimmed = rawInput.trim();
|
|
29193
29486
|
if (!trimmed.startsWith("/")) return false;
|
|
@@ -29260,7 +29553,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29260
29553
|
slashCommands
|
|
29261
29554
|
]
|
|
29262
29555
|
);
|
|
29263
|
-
const executeSubmission =
|
|
29556
|
+
const executeSubmission = useCallback23(
|
|
29264
29557
|
async (value) => {
|
|
29265
29558
|
const trimmed = value.trim();
|
|
29266
29559
|
if (!trimmed) return;
|
|
@@ -29270,7 +29563,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29270
29563
|
},
|
|
29271
29564
|
[executeSlashCommand, runPrompt]
|
|
29272
29565
|
);
|
|
29273
|
-
const handleFinalSubmit =
|
|
29566
|
+
const handleFinalSubmit = useCallback23(
|
|
29274
29567
|
(value) => {
|
|
29275
29568
|
const prompt = value.trim();
|
|
29276
29569
|
if (!prompt) return;
|
|
@@ -29296,7 +29589,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29296
29589
|
isRunning
|
|
29297
29590
|
]
|
|
29298
29591
|
);
|
|
29299
|
-
const handleRetryLastPrompt =
|
|
29592
|
+
const handleRetryLastPrompt = useCallback23(() => {
|
|
29300
29593
|
const lastPrompt = lastSubmittedPromptRef.current;
|
|
29301
29594
|
if (!lastPrompt) {
|
|
29302
29595
|
historyManager.addItem(
|
|
@@ -29311,7 +29604,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29311
29604
|
}
|
|
29312
29605
|
void runPrompt(lastPrompt);
|
|
29313
29606
|
}, [approvalQueue.length, historyManager, isInitializing, isRunning, runPrompt]);
|
|
29314
|
-
const resolveCommandConfirmation =
|
|
29607
|
+
const resolveCommandConfirmation = useCallback23(
|
|
29315
29608
|
(confirmed) => {
|
|
29316
29609
|
const pending = pendingCommandConfirmation;
|
|
29317
29610
|
if (!pending) return;
|
|
@@ -29342,7 +29635,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29342
29635
|
pendingCommandConfirmation
|
|
29343
29636
|
]
|
|
29344
29637
|
);
|
|
29345
|
-
const persistConfig =
|
|
29638
|
+
const persistConfig = useCallback23(
|
|
29346
29639
|
async (mutate) => {
|
|
29347
29640
|
const loader = new ConfigLoader();
|
|
29348
29641
|
const options = { cwd, configPath: config };
|
|
@@ -29351,7 +29644,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29351
29644
|
},
|
|
29352
29645
|
[config, cwd]
|
|
29353
29646
|
);
|
|
29354
|
-
const handleSelectTheme =
|
|
29647
|
+
const handleSelectTheme = useCallback23(
|
|
29355
29648
|
(nextThemeName) => {
|
|
29356
29649
|
themeManager.setActiveTheme(nextThemeName);
|
|
29357
29650
|
setThemeName(themeManager.getActiveTheme().name);
|
|
@@ -29372,7 +29665,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29372
29665
|
},
|
|
29373
29666
|
[cwd, historyManager]
|
|
29374
29667
|
);
|
|
29375
|
-
const handleSavePermissions =
|
|
29668
|
+
const handleSavePermissions = useCallback23(
|
|
29376
29669
|
(modes) => {
|
|
29377
29670
|
setPermissionModes(modes);
|
|
29378
29671
|
setPermissionSummary(formatPermissionSummary(modes));
|
|
@@ -29401,7 +29694,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29401
29694
|
},
|
|
29402
29695
|
[historyManager, persistConfig]
|
|
29403
29696
|
);
|
|
29404
|
-
const handlePersistToken =
|
|
29697
|
+
const handlePersistToken = useCallback23(
|
|
29405
29698
|
async (token) => {
|
|
29406
29699
|
await persistConfig((cfg) => ({
|
|
29407
29700
|
...cfg,
|
|
@@ -29415,12 +29708,12 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29415
29708
|
},
|
|
29416
29709
|
[persistConfig]
|
|
29417
29710
|
);
|
|
29418
|
-
const providerHasApiKey =
|
|
29711
|
+
const providerHasApiKey = useCallback23((provider2) => {
|
|
29419
29712
|
const runtime = runtimeRef.current;
|
|
29420
29713
|
void providerConfigVersion;
|
|
29421
29714
|
return Boolean(runtime?.config.providers[provider2]?.apiKey?.trim());
|
|
29422
29715
|
}, [providerConfigVersion]);
|
|
29423
|
-
const getProviderKeyHint =
|
|
29716
|
+
const getProviderKeyHint = useCallback23((provider2) => {
|
|
29424
29717
|
const runtime = runtimeRef.current;
|
|
29425
29718
|
void providerConfigVersion;
|
|
29426
29719
|
const key = runtime?.config.providers[provider2]?.apiKey?.trim();
|
|
@@ -29428,7 +29721,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29428
29721
|
if (key.length <= 8) return "\u25CF".repeat(key.length);
|
|
29429
29722
|
return `${key.slice(0, 6)}\u25CF\u25CF\u25CF\u25CF${key.slice(-4)}`;
|
|
29430
29723
|
}, [providerConfigVersion]);
|
|
29431
|
-
const handleSaveProviderApiKey =
|
|
29724
|
+
const handleSaveProviderApiKey = useCallback23(
|
|
29432
29725
|
async (provider2, apiKey) => {
|
|
29433
29726
|
await persistConfig((cfg) => ({
|
|
29434
29727
|
...cfg,
|
|
@@ -29453,7 +29746,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29453
29746
|
},
|
|
29454
29747
|
[historyManager, persistConfig]
|
|
29455
29748
|
);
|
|
29456
|
-
const handleSetDefaultProvider =
|
|
29749
|
+
const handleSetDefaultProvider = useCallback23(
|
|
29457
29750
|
async (provider2) => {
|
|
29458
29751
|
const runtime = runtimeRef.current;
|
|
29459
29752
|
const session = sessionRef.current;
|
|
@@ -29495,7 +29788,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29495
29788
|
},
|
|
29496
29789
|
[historyManager, persistConfig]
|
|
29497
29790
|
);
|
|
29498
|
-
const handleTestProvider =
|
|
29791
|
+
const handleTestProvider = useCallback23(
|
|
29499
29792
|
async (provider2) => {
|
|
29500
29793
|
const runtime = runtimeRef.current;
|
|
29501
29794
|
const session = sessionRef.current;
|
|
@@ -29543,7 +29836,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29543
29836
|
},
|
|
29544
29837
|
[]
|
|
29545
29838
|
);
|
|
29546
|
-
const handleFetchModels =
|
|
29839
|
+
const handleFetchModels = useCallback23(
|
|
29547
29840
|
async (provider2, signal) => {
|
|
29548
29841
|
const runtime = runtimeRef.current;
|
|
29549
29842
|
if (!runtime) throw new Error("Runtime not ready.");
|
|
@@ -29551,15 +29844,15 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29551
29844
|
},
|
|
29552
29845
|
[]
|
|
29553
29846
|
);
|
|
29554
|
-
const handleSelectModel =
|
|
29847
|
+
const handleSelectModel = useCallback23(
|
|
29555
29848
|
(modelId) => {
|
|
29556
29849
|
setSessionModel(modelId);
|
|
29557
29850
|
setActiveDialog(null);
|
|
29558
29851
|
},
|
|
29559
29852
|
[setSessionModel]
|
|
29560
29853
|
);
|
|
29561
|
-
const closeDialog =
|
|
29562
|
-
const previewTheme =
|
|
29854
|
+
const closeDialog = useCallback23(() => setActiveDialog(null), []);
|
|
29855
|
+
const previewTheme = useCallback23(() => setThemeVersion((version) => version + 1), []);
|
|
29563
29856
|
useEffect25(() => {
|
|
29564
29857
|
if (drainingQueueRef.current || isRunning || isInitializing || Boolean(initError) || approvalQueue.length > 0 || messageQueue.length === 0) {
|
|
29565
29858
|
return;
|
|
@@ -29684,6 +29977,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29684
29977
|
themeName
|
|
29685
29978
|
]
|
|
29686
29979
|
);
|
|
29980
|
+
const activeSubagents = useMemo15(() => Array.from(subagentMap.values()), [subagentMap]);
|
|
29687
29981
|
const uiState = useMemo15(
|
|
29688
29982
|
() => ({
|
|
29689
29983
|
history: historyManager.history,
|
|
@@ -29714,7 +30008,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29714
30008
|
commandContext,
|
|
29715
30009
|
recentSlashCommands,
|
|
29716
30010
|
embeddedShellFocused: false,
|
|
29717
|
-
promptSuggestion
|
|
30011
|
+
promptSuggestion,
|
|
29718
30012
|
dismissPromptSuggestion,
|
|
29719
30013
|
terminalWidth,
|
|
29720
30014
|
terminalHeight,
|
|
@@ -29740,10 +30034,12 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29740
30034
|
isFeedbackDialogOpen,
|
|
29741
30035
|
showAutoAcceptIndicator: "default",
|
|
29742
30036
|
mcpConnected,
|
|
29743
|
-
mcpTotal
|
|
30037
|
+
mcpTotal,
|
|
30038
|
+
activeSubagents
|
|
29744
30039
|
}),
|
|
29745
30040
|
[
|
|
29746
30041
|
approvalQueue.length,
|
|
30042
|
+
subagentMap,
|
|
29747
30043
|
activeDialog,
|
|
29748
30044
|
buffer,
|
|
29749
30045
|
commandContext,
|
|
@@ -29751,6 +30047,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29751
30047
|
currentModel,
|
|
29752
30048
|
cwd,
|
|
29753
30049
|
dismissPromptSuggestion,
|
|
30050
|
+
promptSuggestion,
|
|
29754
30051
|
elapsedTime,
|
|
29755
30052
|
historyManager,
|
|
29756
30053
|
historyRemountKey,
|
|
@@ -29779,37 +30076,37 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29779
30076
|
userMessages
|
|
29780
30077
|
]
|
|
29781
30078
|
);
|
|
29782
|
-
return /* @__PURE__ */
|
|
29783
|
-
/* @__PURE__ */
|
|
29784
|
-
/* @__PURE__ */
|
|
29785
|
-
/* @__PURE__ */
|
|
29786
|
-
/* @__PURE__ */
|
|
29787
|
-
/* @__PURE__ */
|
|
30079
|
+
return /* @__PURE__ */ jsx48(CompactModeProvider, { value: { compactMode }, children: /* @__PURE__ */ jsx48(ConfigContext.Provider, { value: configAdapter, children: /* @__PURE__ */ jsx48(SettingsContext.Provider, { value: loadedSettings, children: /* @__PURE__ */ jsx48(StreamingContext.Provider, { value: streamingState, children: /* @__PURE__ */ jsx48(VimModeProvider, { initialVimEnabled: loadedSettings.merged.general?.vimMode ?? false, children: /* @__PURE__ */ jsx48(KeypressProvider, { kittyProtocolEnabled: false, config: configAdapter, children: /* @__PURE__ */ jsx48(ShellFocusContext.Provider, { value: true, children: /* @__PURE__ */ jsx48(AgentViewProvider, { children: /* @__PURE__ */ jsx48(BackgroundTaskViewProvider, { children: /* @__PURE__ */ jsx48(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx48(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsxs44(Box39, { flexDirection: "column", flexGrow: 1, children: [
|
|
30080
|
+
/* @__PURE__ */ jsxs44(Box39, { marginLeft: 2, marginRight: 2, marginTop: 1, marginBottom: 1, children: [
|
|
30081
|
+
/* @__PURE__ */ jsx48(Text47, { bold: true, color: theme.text.accent, children: "DeepCode" }),
|
|
30082
|
+
/* @__PURE__ */ jsx48(Text47, { color: theme.text.secondary, children: " Target: " }),
|
|
30083
|
+
/* @__PURE__ */ jsx48(Text47, { color: theme.text.primary, children: providerLabel }),
|
|
30084
|
+
/* @__PURE__ */ jsxs44(Text47, { color: theme.text.secondary, children: [
|
|
29788
30085
|
" (",
|
|
29789
30086
|
targetSource,
|
|
29790
30087
|
")"
|
|
29791
30088
|
] }),
|
|
29792
|
-
/* @__PURE__ */
|
|
29793
|
-
/* @__PURE__ */
|
|
29794
|
-
|
|
30089
|
+
/* @__PURE__ */ jsx48(Text47, { color: theme.text.secondary, children: " Mode: " }),
|
|
30090
|
+
/* @__PURE__ */ jsx48(
|
|
30091
|
+
Text47,
|
|
29795
30092
|
{
|
|
29796
30093
|
bold: true,
|
|
29797
30094
|
color: agentMode === "build" ? theme.status.success : theme.status.warning,
|
|
29798
30095
|
children: agentMode.toUpperCase()
|
|
29799
30096
|
}
|
|
29800
30097
|
),
|
|
29801
|
-
/* @__PURE__ */
|
|
30098
|
+
/* @__PURE__ */ jsxs44(Text47, { color: theme.text.secondary, children: [
|
|
29802
30099
|
" ",
|
|
29803
30100
|
streamingState === "responding" ? "running" : streamingState === "waiting_for_confirmation" ? "waiting-approval" : "idle"
|
|
29804
30101
|
] }),
|
|
29805
|
-
iterationInfo && /* @__PURE__ */
|
|
30102
|
+
iterationInfo && /* @__PURE__ */ jsxs44(Text47, { color: theme.text.secondary, children: [
|
|
29806
30103
|
" ",
|
|
29807
30104
|
"iter ",
|
|
29808
30105
|
iterationInfo.round,
|
|
29809
30106
|
"/",
|
|
29810
30107
|
iterationInfo.max
|
|
29811
30108
|
] }),
|
|
29812
|
-
lastPromptTokenCount > 0 && /* @__PURE__ */
|
|
30109
|
+
lastPromptTokenCount > 0 && /* @__PURE__ */ jsxs44(Text47, { color: theme.text.secondary, children: [
|
|
29813
30110
|
" ",
|
|
29814
30111
|
"\u2191",
|
|
29815
30112
|
formatTokenCount(lastPromptTokenCount),
|
|
@@ -29817,10 +30114,10 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29817
30114
|
formatTokenCount(lastOutputTokenCount)
|
|
29818
30115
|
] })
|
|
29819
30116
|
] }),
|
|
29820
|
-
initError ? /* @__PURE__ */
|
|
30117
|
+
initError ? /* @__PURE__ */ jsx48(Box39, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsxs44(Text47, { color: theme.status.error, children: [
|
|
29821
30118
|
"Failed to initialize runtime: ",
|
|
29822
30119
|
initError
|
|
29823
|
-
] }) }) : /* @__PURE__ */
|
|
30120
|
+
] }) }) : /* @__PURE__ */ jsx48(
|
|
29824
30121
|
MainContent,
|
|
29825
30122
|
{
|
|
29826
30123
|
history: historyManager.history,
|
|
@@ -29834,9 +30131,9 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29834
30131
|
},
|
|
29835
30132
|
historyRemountKey
|
|
29836
30133
|
),
|
|
29837
|
-
approvalQueue.length > 0 && /* @__PURE__ */
|
|
29838
|
-
dialogModel && /* @__PURE__ */
|
|
29839
|
-
activeDialog === "provider" && /* @__PURE__ */
|
|
30134
|
+
approvalQueue.length > 0 && /* @__PURE__ */ jsx48(Box39, { marginLeft: 2, marginRight: 2, marginTop: 1, children: /* @__PURE__ */ jsx48(ApprovalPrompt, { request: approvalQueue[0] }) }),
|
|
30135
|
+
dialogModel && /* @__PURE__ */ jsx48(CommandDialog, { title: dialogModel.title, lines: dialogModel.lines }),
|
|
30136
|
+
activeDialog === "provider" && /* @__PURE__ */ jsx48(
|
|
29840
30137
|
ProviderDialog,
|
|
29841
30138
|
{
|
|
29842
30139
|
providers: listAvailableProviders(),
|
|
@@ -29851,7 +30148,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29851
30148
|
onClose: closeDialog
|
|
29852
30149
|
}
|
|
29853
30150
|
),
|
|
29854
|
-
activeDialog === "model" && /* @__PURE__ */
|
|
30151
|
+
activeDialog === "model" && /* @__PURE__ */ jsx48(
|
|
29855
30152
|
ModelDialog,
|
|
29856
30153
|
{
|
|
29857
30154
|
currentProvider: getSessionCommandState().provider,
|
|
@@ -29861,7 +30158,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29861
30158
|
onClose: closeDialog
|
|
29862
30159
|
}
|
|
29863
30160
|
),
|
|
29864
|
-
activeDialog === "theme" && /* @__PURE__ */
|
|
30161
|
+
activeDialog === "theme" && /* @__PURE__ */ jsx48(
|
|
29865
30162
|
ThemeDialog,
|
|
29866
30163
|
{
|
|
29867
30164
|
onSelect: handleSelectTheme,
|
|
@@ -29869,7 +30166,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29869
30166
|
onPreview: previewTheme
|
|
29870
30167
|
}
|
|
29871
30168
|
),
|
|
29872
|
-
activeDialog === "permissions" && /* @__PURE__ */
|
|
30169
|
+
activeDialog === "permissions" && /* @__PURE__ */ jsx48(
|
|
29873
30170
|
PermissionsDialog,
|
|
29874
30171
|
{
|
|
29875
30172
|
current: permissionModes,
|
|
@@ -29877,7 +30174,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29877
30174
|
onClose: closeDialog
|
|
29878
30175
|
}
|
|
29879
30176
|
),
|
|
29880
|
-
activeDialog === "auth" && runtimeRef.current && /* @__PURE__ */
|
|
30177
|
+
activeDialog === "auth" && runtimeRef.current && /* @__PURE__ */ jsx48(
|
|
29881
30178
|
AuthDialog,
|
|
29882
30179
|
{
|
|
29883
30180
|
clientId: runtimeRef.current.config.github.oauthClientId,
|
|
@@ -29890,7 +30187,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29890
30187
|
onClose: closeDialog
|
|
29891
30188
|
}
|
|
29892
30189
|
),
|
|
29893
|
-
pendingCommandConfirmation && /* @__PURE__ */
|
|
30190
|
+
pendingCommandConfirmation && /* @__PURE__ */ jsx48(
|
|
29894
30191
|
CommandDialog,
|
|
29895
30192
|
{
|
|
29896
30193
|
title: "Confirm action",
|
|
@@ -29902,7 +30199,14 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29902
30199
|
footerText: "Press y or Enter to confirm. Press n or Esc to cancel."
|
|
29903
30200
|
}
|
|
29904
30201
|
),
|
|
29905
|
-
/* @__PURE__ */
|
|
30202
|
+
/* @__PURE__ */ jsx48(
|
|
30203
|
+
SubagentsPanel,
|
|
30204
|
+
{
|
|
30205
|
+
subagents: Array.from(subagentMap.values()),
|
|
30206
|
+
mainAreaWidth
|
|
30207
|
+
}
|
|
30208
|
+
),
|
|
30209
|
+
/* @__PURE__ */ jsx48(Composer, {})
|
|
29906
30210
|
] }) }) }) }) }) }) }) }) }) }) }) });
|
|
29907
30211
|
};
|
|
29908
30212
|
function formatProviderLabel(provider, model) {
|
|
@@ -30004,22 +30308,22 @@ function formatAuthSummary(config) {
|
|
|
30004
30308
|
var ApprovalPrompt = ({ request }) => {
|
|
30005
30309
|
if (!request) return null;
|
|
30006
30310
|
const operationLabel = formatApprovalOperationLabel(request);
|
|
30007
|
-
return /* @__PURE__ */
|
|
30008
|
-
/* @__PURE__ */
|
|
30311
|
+
return /* @__PURE__ */ jsxs44(Box39, { flexDirection: "column", marginTop: 1, children: [
|
|
30312
|
+
/* @__PURE__ */ jsxs44(Text47, { color: theme.status.warning, children: [
|
|
30009
30313
|
"\u26A0 Allow ",
|
|
30010
30314
|
operationLabel,
|
|
30011
30315
|
"?"
|
|
30012
30316
|
] }),
|
|
30013
|
-
request.path && /* @__PURE__ */
|
|
30317
|
+
request.path && /* @__PURE__ */ jsxs44(Text47, { color: theme.text.secondary, children: [
|
|
30014
30318
|
" ",
|
|
30015
30319
|
request.path
|
|
30016
30320
|
] }),
|
|
30017
|
-
request.preview?.command && /* @__PURE__ */
|
|
30321
|
+
request.preview?.command && /* @__PURE__ */ jsxs44(Text47, { color: theme.text.secondary, children: [
|
|
30018
30322
|
" $ ",
|
|
30019
30323
|
request.preview.command,
|
|
30020
30324
|
request.preview.args?.length ? ` ${request.preview.args.join(" ")}` : ""
|
|
30021
30325
|
] }),
|
|
30022
|
-
/* @__PURE__ */
|
|
30326
|
+
/* @__PURE__ */ jsx48(Text47, { color: theme.text.secondary, children: " [\u21B5/y] once [s] session [a] always [n] deny" })
|
|
30023
30327
|
] });
|
|
30024
30328
|
};
|
|
30025
30329
|
function formatApprovalOperationLabel(request) {
|
|
@@ -30080,7 +30384,7 @@ var DeepCodeConfigAdapter = class {
|
|
|
30080
30384
|
}
|
|
30081
30385
|
};
|
|
30082
30386
|
function App(props) {
|
|
30083
|
-
return /* @__PURE__ */
|
|
30387
|
+
return /* @__PURE__ */ jsx49(
|
|
30084
30388
|
AppContainer,
|
|
30085
30389
|
{
|
|
30086
30390
|
cwd: props.cwd,
|