@proxysoul/soulforge 2.20.0 → 2.20.2
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 +688 -419
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71927,7 +71927,7 @@ var package_default;
|
|
|
71927
71927
|
var init_package = __esm(() => {
|
|
71928
71928
|
package_default = {
|
|
71929
71929
|
name: "@proxysoul/soulforge",
|
|
71930
|
-
version: "2.20.
|
|
71930
|
+
version: "2.20.2",
|
|
71931
71931
|
description: "Graph-powered code intelligence \u2014 multi-agent coding with codebase-aware AI",
|
|
71932
71932
|
repository: {
|
|
71933
71933
|
type: "git",
|
|
@@ -72056,6 +72056,18 @@ var init_package = __esm(() => {
|
|
|
72056
72056
|
});
|
|
72057
72057
|
|
|
72058
72058
|
// src/core/version.ts
|
|
72059
|
+
var exports_version = {};
|
|
72060
|
+
__export(exports_version, {
|
|
72061
|
+
performUpgrade: () => performUpgrade,
|
|
72062
|
+
isNewer: () => isNewer,
|
|
72063
|
+
isDismissed: () => isDismissed,
|
|
72064
|
+
getUpgradeCommand: () => getUpgradeCommand,
|
|
72065
|
+
getUpgradeArgs: () => getUpgradeArgs,
|
|
72066
|
+
dismissVersion: () => dismissVersion,
|
|
72067
|
+
detectInstallMethod: () => detectInstallMethod,
|
|
72068
|
+
checkForUpdate: () => checkForUpdate,
|
|
72069
|
+
CURRENT_VERSION: () => CURRENT_VERSION
|
|
72070
|
+
});
|
|
72059
72071
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
72060
72072
|
import { existsSync as existsSync13, lstatSync, mkdirSync as mkdirSync11, readFileSync as readFileSync11, writeFileSync as writeFileSync10 } from "fs";
|
|
72061
72073
|
import { join as join16 } from "path";
|
|
@@ -72430,6 +72442,11 @@ function getCompatReasoningBody(modelId, config2) {
|
|
|
72430
72442
|
return {};
|
|
72431
72443
|
const base = baseModel(modelId);
|
|
72432
72444
|
let effort = config2.performance?.compatReasoningEffort;
|
|
72445
|
+
if (provider === "deepseek") {
|
|
72446
|
+
const d = config2.performance?.deepseekReasoningEffort;
|
|
72447
|
+
if (d && d !== "off")
|
|
72448
|
+
effort = d;
|
|
72449
|
+
}
|
|
72433
72450
|
if (provider === "groq") {
|
|
72434
72451
|
const g = config2.performance?.groqReasoningEffort;
|
|
72435
72452
|
if (g)
|
|
@@ -72438,18 +72455,22 @@ function getCompatReasoningBody(modelId, config2) {
|
|
|
72438
72455
|
if (!effort || effort === "off") {
|
|
72439
72456
|
const e = config2.performance?.effort;
|
|
72440
72457
|
if (e && e !== "off") {
|
|
72441
|
-
effort = e === "max" ? "xhigh" : e;
|
|
72458
|
+
effort = e === "max" && provider !== "deepseek" ? "xhigh" : e;
|
|
72442
72459
|
}
|
|
72443
72460
|
}
|
|
72444
72461
|
if (!effort || effort === "off")
|
|
72445
72462
|
return {};
|
|
72463
|
+
if (provider === "deepseek") {
|
|
72464
|
+
const dsEffort = effort === "max" || effort === "xhigh" ? "max" : "high";
|
|
72465
|
+
return { reasoning_effort: dsEffort };
|
|
72466
|
+
}
|
|
72446
72467
|
const isClaude = base.startsWith("claude");
|
|
72447
72468
|
if (isClaude && provider === "opencode-zen") {
|
|
72448
72469
|
if (isAdaptiveOnly(base)) {
|
|
72449
72470
|
return { thinking: { type: "adaptive" } };
|
|
72450
72471
|
}
|
|
72451
72472
|
const explicitBudget = config2.thinking?.budgetTokens;
|
|
72452
|
-
const budget = explicitBudget ?? { low: 2048, medium: 5000, high: 1e4, xhigh: 20000 }[effort] ?? 5000;
|
|
72473
|
+
const budget = explicitBudget ?? { low: 2048, medium: 5000, high: 1e4, xhigh: 20000, max: 32000 }[effort] ?? 5000;
|
|
72453
72474
|
return { thinking: { type: "enabled", budget_tokens: budget } };
|
|
72454
72475
|
}
|
|
72455
72476
|
if (isClaude && provider !== "proxy") {
|
|
@@ -72459,6 +72480,12 @@ function getCompatReasoningBody(modelId, config2) {
|
|
|
72459
72480
|
return { reasoning_effort: "default" };
|
|
72460
72481
|
}
|
|
72461
72482
|
const isDashscope = /qwen|glm-|kimi-/.test(base);
|
|
72483
|
+
if (provider === "llmgateway") {
|
|
72484
|
+
const body3 = { reasoning_effort: effort };
|
|
72485
|
+
if (isDashscope)
|
|
72486
|
+
body3.enable_thinking = true;
|
|
72487
|
+
return body3;
|
|
72488
|
+
}
|
|
72462
72489
|
const body2 = {
|
|
72463
72490
|
reasoning_effort: effort,
|
|
72464
72491
|
reasoning: { effort }
|
|
@@ -72480,7 +72507,8 @@ var init_compat_reasoning = __esm(() => {
|
|
|
72480
72507
|
"opencode-zen",
|
|
72481
72508
|
"lmstudio",
|
|
72482
72509
|
"ollama",
|
|
72483
|
-
"proxy"
|
|
72510
|
+
"proxy",
|
|
72511
|
+
"llmgateway"
|
|
72484
72512
|
]);
|
|
72485
72513
|
});
|
|
72486
72514
|
|
|
@@ -84918,7 +84946,9 @@ var init_context_windows = __esm(() => {
|
|
|
84918
84946
|
var llmgateway2;
|
|
84919
84947
|
var init_llmgateway = __esm(() => {
|
|
84920
84948
|
init_dist13();
|
|
84949
|
+
init_config2();
|
|
84921
84950
|
init_secrets();
|
|
84951
|
+
init_compat_reasoning();
|
|
84922
84952
|
init_context_windows();
|
|
84923
84953
|
llmgateway2 = {
|
|
84924
84954
|
id: "llmgateway",
|
|
@@ -84935,13 +84965,16 @@ var init_llmgateway = __esm(() => {
|
|
|
84935
84965
|
if (!apiKey) {
|
|
84936
84966
|
throw new Error("LLM_GATEWAY_API_KEY is not set");
|
|
84937
84967
|
}
|
|
84968
|
+
const reasoningBody = getCompatReasoningBody(`llmgateway/${modelId}`, loadConfig());
|
|
84969
|
+
const reasoningFetch = createReasoningFetchWrapper(reasoningBody);
|
|
84938
84970
|
const provider = createLLMGateway({
|
|
84939
84971
|
apiKey,
|
|
84940
84972
|
headers: {
|
|
84941
84973
|
"X-Source": "soulforge",
|
|
84942
84974
|
"HTTP-Referer": "https://soulforge.proxysoul.com",
|
|
84943
84975
|
"X-Title": "SoulForge"
|
|
84944
|
-
}
|
|
84976
|
+
},
|
|
84977
|
+
...reasoningFetch ? { fetch: reasoningFetch } : {}
|
|
84945
84978
|
});
|
|
84946
84979
|
return provider.chat(modelId);
|
|
84947
84980
|
},
|
|
@@ -403163,6 +403196,108 @@ var init_prerequisites = __esm(() => {
|
|
|
403163
403196
|
];
|
|
403164
403197
|
});
|
|
403165
403198
|
|
|
403199
|
+
// src/core/telemetry.ts
|
|
403200
|
+
var exports_telemetry = {};
|
|
403201
|
+
__export(exports_telemetry, {
|
|
403202
|
+
telemetryDisabled: () => telemetryDisabled,
|
|
403203
|
+
sendBeacon: () => sendBeacon,
|
|
403204
|
+
maybeShowTelemetryNotice: () => maybeShowTelemetryNotice
|
|
403205
|
+
});
|
|
403206
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
403207
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync20, readFileSync as readFileSync19, writeFileSync as writeFileSync15 } from "fs";
|
|
403208
|
+
import { join as join37 } from "path";
|
|
403209
|
+
function truthy(v2) {
|
|
403210
|
+
if (!v2)
|
|
403211
|
+
return false;
|
|
403212
|
+
const s = v2.toLowerCase();
|
|
403213
|
+
return s === "1" || s === "true" || s === "yes";
|
|
403214
|
+
}
|
|
403215
|
+
function telemetryDisabled(configEnabled) {
|
|
403216
|
+
if (truthy(process.env.DO_NOT_TRACK))
|
|
403217
|
+
return true;
|
|
403218
|
+
if (process.env.SOULFORGE_TELEMETRY !== undefined) {
|
|
403219
|
+
if (!truthy(process.env.SOULFORGE_TELEMETRY))
|
|
403220
|
+
return true;
|
|
403221
|
+
}
|
|
403222
|
+
if (configEnabled === false)
|
|
403223
|
+
return true;
|
|
403224
|
+
return false;
|
|
403225
|
+
}
|
|
403226
|
+
function endpoint() {
|
|
403227
|
+
return process.env.SOULFORGE_TELEMETRY_URL || DEFAULT_ENDPOINT;
|
|
403228
|
+
}
|
|
403229
|
+
function anonId() {
|
|
403230
|
+
try {
|
|
403231
|
+
const dir = configDir();
|
|
403232
|
+
if (!existsSync35(dir))
|
|
403233
|
+
mkdirSync20(dir, { recursive: true, mode: 448 });
|
|
403234
|
+
const file2 = join37(dir, ID_FILE);
|
|
403235
|
+
if (existsSync35(file2)) {
|
|
403236
|
+
const data = JSON.parse(readFileSync19(file2, "utf-8"));
|
|
403237
|
+
if (data.id)
|
|
403238
|
+
return data.id;
|
|
403239
|
+
}
|
|
403240
|
+
const id = randomUUID3();
|
|
403241
|
+
writeFileSync15(file2, JSON.stringify({ id, ts: Date.now() }), { mode: 384 });
|
|
403242
|
+
return id;
|
|
403243
|
+
} catch {
|
|
403244
|
+
return randomUUID3();
|
|
403245
|
+
}
|
|
403246
|
+
}
|
|
403247
|
+
function maybeShowTelemetryNotice(config2, markShown) {
|
|
403248
|
+
if (telemetryDisabled(config2.telemetry))
|
|
403249
|
+
return;
|
|
403250
|
+
if (config2.telemetryNoticeShown)
|
|
403251
|
+
return;
|
|
403252
|
+
try {
|
|
403253
|
+
process.stderr.write(`\x1B[2mSoulForge collects anonymous usage stats (version, OS, surface \u2014 no prompts, paths, or keys).
|
|
403254
|
+
` + `Opt out: set "telemetry": false in config, or DO_NOT_TRACK=1.\x1B[0m
|
|
403255
|
+
`);
|
|
403256
|
+
markShown();
|
|
403257
|
+
} catch {}
|
|
403258
|
+
}
|
|
403259
|
+
function normArch() {
|
|
403260
|
+
const a = process.arch;
|
|
403261
|
+
if (a === "arm64")
|
|
403262
|
+
return "arm64";
|
|
403263
|
+
if (a === "x64")
|
|
403264
|
+
return "x64";
|
|
403265
|
+
return "other";
|
|
403266
|
+
}
|
|
403267
|
+
function sendBeacon(fields, configEnabled) {
|
|
403268
|
+
if (telemetryDisabled(configEnabled))
|
|
403269
|
+
return;
|
|
403270
|
+
try {
|
|
403271
|
+
const params = new URLSearchParams({
|
|
403272
|
+
e: fields.event ?? "session_start",
|
|
403273
|
+
sf: fields.surface,
|
|
403274
|
+
v: fields.version.slice(0, 24),
|
|
403275
|
+
os: process.platform,
|
|
403276
|
+
ar: normArch(),
|
|
403277
|
+
id: anonId()
|
|
403278
|
+
});
|
|
403279
|
+
if (fields.install)
|
|
403280
|
+
params.set("im", fields.install.slice(0, 16));
|
|
403281
|
+
if (fields.family)
|
|
403282
|
+
params.set("mf", fields.family.slice(0, 20));
|
|
403283
|
+
if (fields.provider)
|
|
403284
|
+
params.set("pv", fields.provider.slice(0, 24));
|
|
403285
|
+
if (fields.model)
|
|
403286
|
+
params.set("md", fields.model.slice(0, 32));
|
|
403287
|
+
const url2 = `${endpoint()}?${params.toString()}`;
|
|
403288
|
+
fetch(url2, {
|
|
403289
|
+
method: "GET",
|
|
403290
|
+
headers: { "user-agent": `soulforge/${fields.version.slice(0, 24)}` },
|
|
403291
|
+
signal: AbortSignal.timeout(1500),
|
|
403292
|
+
keepalive: true
|
|
403293
|
+
}).catch(() => {});
|
|
403294
|
+
} catch {}
|
|
403295
|
+
}
|
|
403296
|
+
var DEFAULT_ENDPOINT = "https://t.soulforge.proxysoul.com/b", ID_FILE = "anon-id.json";
|
|
403297
|
+
var init_telemetry = __esm(() => {
|
|
403298
|
+
init_platform();
|
|
403299
|
+
});
|
|
403300
|
+
|
|
403166
403301
|
// src/index.tsx
|
|
403167
403302
|
var exports_src = {};
|
|
403168
403303
|
__export(exports_src, {
|
|
@@ -403486,6 +403621,24 @@ async function start2(opts) {
|
|
|
403486
403621
|
} catch {}
|
|
403487
403622
|
}
|
|
403488
403623
|
}
|
|
403624
|
+
try {
|
|
403625
|
+
const { sendBeacon: sendBeacon2, maybeShowTelemetryNotice: maybeShowTelemetryNotice2 } = await Promise.resolve().then(() => (init_telemetry(), exports_telemetry));
|
|
403626
|
+
const { detectModelFamily, telemetryModelInfo } = await Promise.resolve().then(() => (init_provider_options(), exports_provider_options));
|
|
403627
|
+
const { CURRENT_VERSION: CURRENT_VERSION2, detectInstallMethod: detectInstallMethod2 } = await Promise.resolve().then(() => (init_version(), exports_version));
|
|
403628
|
+
const { loadConfig: loadConfig2, saveGlobalConfig: saveGlobalConfig2 } = await Promise.resolve().then(() => (init_config2(), exports_config2));
|
|
403629
|
+
const cfg = loadConfig2();
|
|
403630
|
+
maybeShowTelemetryNotice2(cfg, () => saveGlobalConfig2({ telemetryNoticeShown: true }));
|
|
403631
|
+
const hasModel = cfg.defaultModel !== "none";
|
|
403632
|
+
const info2 = hasModel ? telemetryModelInfo(cfg.defaultModel) : undefined;
|
|
403633
|
+
sendBeacon2({
|
|
403634
|
+
surface: "tui",
|
|
403635
|
+
version: CURRENT_VERSION2,
|
|
403636
|
+
install: detectInstallMethod2(),
|
|
403637
|
+
family: hasModel ? detectModelFamily(cfg.defaultModel) : undefined,
|
|
403638
|
+
provider: info2?.provider,
|
|
403639
|
+
model: info2?.model
|
|
403640
|
+
}, cfg.telemetry);
|
|
403641
|
+
} catch {}
|
|
403489
403642
|
opts.createRoot(r).render(/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(AppRoot, {
|
|
403490
403643
|
opts
|
|
403491
403644
|
}, undefined, false, undefined, this));
|
|
@@ -405778,13 +405931,13 @@ function buildPrepareStep({
|
|
|
405778
405931
|
})
|
|
405779
405932
|
};
|
|
405780
405933
|
const json3 = JSON.stringify(exportData, null, 2);
|
|
405781
|
-
import("fs").then(({ mkdirSync:
|
|
405934
|
+
import("fs").then(({ mkdirSync: mkdirSync21, writeFileSync: writeFileSync16 }) => {
|
|
405782
405935
|
const dir = `${getCwd()}/.soulforge/api-export`;
|
|
405783
|
-
|
|
405936
|
+
mkdirSync21(dir, { recursive: true });
|
|
405784
405937
|
const subDir = agentId ? `${dir}/subagents/${agentId}` : dir;
|
|
405785
|
-
|
|
405938
|
+
mkdirSync21(subDir, { recursive: true });
|
|
405786
405939
|
const file2 = `${subDir}/step-${String(stepNumber).padStart(2, "0")}.json`;
|
|
405787
|
-
|
|
405940
|
+
writeFileSync16(file2, json3, "utf-8");
|
|
405788
405941
|
});
|
|
405789
405942
|
}
|
|
405790
405943
|
const contextSize = lastStep?.usage.inputTokens ?? 0;
|
|
@@ -406008,8 +406161,8 @@ var init_step_utils = __esm(() => {
|
|
|
406008
406161
|
|
|
406009
406162
|
// src/core/platform/clipboard.ts
|
|
406010
406163
|
import { execFile as execFile2, spawnSync as spawnSync6 } from "child_process";
|
|
406011
|
-
import { readFileSync as
|
|
406012
|
-
import { join as
|
|
406164
|
+
import { readFileSync as readFileSync20, unlinkSync as unlinkSync7 } from "fs";
|
|
406165
|
+
import { join as join38 } from "path";
|
|
406013
406166
|
function trySpawn(cmd, args2, text2) {
|
|
406014
406167
|
try {
|
|
406015
406168
|
const opts = {
|
|
@@ -406060,7 +406213,7 @@ function cleanup(tmpFile) {
|
|
|
406060
406213
|
} catch {}
|
|
406061
406214
|
}
|
|
406062
406215
|
function readImageDarwin() {
|
|
406063
|
-
const tmpFile =
|
|
406216
|
+
const tmpFile = join38(tmpDir(), `soulforge-clipboard-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.png`);
|
|
406064
406217
|
const script = [
|
|
406065
406218
|
"try",
|
|
406066
406219
|
" set pngData to the clipboard as \xABclass PNGf\xBB",
|
|
@@ -406083,7 +406236,7 @@ function readImageDarwin() {
|
|
|
406083
406236
|
return;
|
|
406084
406237
|
}
|
|
406085
406238
|
try {
|
|
406086
|
-
const data =
|
|
406239
|
+
const data = readFileSync20(tmpFile);
|
|
406087
406240
|
unlinkSync7(tmpFile);
|
|
406088
406241
|
if (data.length > 0) {
|
|
406089
406242
|
resolve14({ data, mediaType: "image/png" });
|
|
@@ -406114,7 +406267,7 @@ function readImageLinux() {
|
|
|
406114
406267
|
});
|
|
406115
406268
|
}
|
|
406116
406269
|
function readImageWindows() {
|
|
406117
|
-
const tmpFile =
|
|
406270
|
+
const tmpFile = join38(tmpDir(), `soulforge-clipboard-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.png`);
|
|
406118
406271
|
const ps = [
|
|
406119
406272
|
"param([Parameter(Mandatory)][string]$OutFile)",
|
|
406120
406273
|
"$ErrorActionPreference = 'SilentlyContinue';",
|
|
@@ -406133,7 +406286,7 @@ function readImageWindows() {
|
|
|
406133
406286
|
return;
|
|
406134
406287
|
}
|
|
406135
406288
|
try {
|
|
406136
|
-
const data =
|
|
406289
|
+
const data = readFileSync20(tmpFile);
|
|
406137
406290
|
unlinkSync7(tmpFile);
|
|
406138
406291
|
if (data.length > 0) {
|
|
406139
406292
|
resolve14({ data, mediaType: "image/png" });
|
|
@@ -406163,8 +406316,8 @@ __export(exports_export, {
|
|
|
406163
406316
|
exportToClipboard: () => exportToClipboard,
|
|
406164
406317
|
exportChat: () => exportChat
|
|
406165
406318
|
});
|
|
406166
|
-
import { mkdirSync as
|
|
406167
|
-
import { dirname as dirname14, join as
|
|
406319
|
+
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync16 } from "fs";
|
|
406320
|
+
import { dirname as dirname14, join as join39 } from "path";
|
|
406168
406321
|
function formatTimestamp(ts) {
|
|
406169
406322
|
const d2 = new Date(ts);
|
|
406170
406323
|
return d2.toLocaleString("en-US", {
|
|
@@ -406326,18 +406479,18 @@ function exportChat(messages, opts) {
|
|
|
406326
406479
|
const ext = format === "json" ? ".json" : ".md";
|
|
406327
406480
|
let outPath;
|
|
406328
406481
|
if (opts.outPath) {
|
|
406329
|
-
outPath = opts.outPath.startsWith("/") ? opts.outPath :
|
|
406482
|
+
outPath = opts.outPath.startsWith("/") ? opts.outPath : join39(opts.cwd, opts.outPath);
|
|
406330
406483
|
} else {
|
|
406331
|
-
const exportDir =
|
|
406332
|
-
|
|
406484
|
+
const exportDir = join39(opts.cwd, ".soulforge", "exports");
|
|
406485
|
+
mkdirSync21(exportDir, { recursive: true });
|
|
406333
406486
|
const stamp = new Date().toISOString().slice(0, 19).replace(/[T:]/g, "-");
|
|
406334
406487
|
const slug = slugify3(title);
|
|
406335
|
-
outPath =
|
|
406488
|
+
outPath = join39(exportDir, `${slug}-${stamp}${ext}`);
|
|
406336
406489
|
}
|
|
406337
406490
|
const parentDir = dirname14(outPath);
|
|
406338
|
-
|
|
406491
|
+
mkdirSync21(parentDir, { recursive: true });
|
|
406339
406492
|
const content = format === "json" ? exportToJson(messages) : exportToMarkdown(messages, title);
|
|
406340
|
-
|
|
406493
|
+
writeFileSync16(outPath, content, "utf-8");
|
|
406341
406494
|
const visible = messages.filter((m2) => m2.role !== "system" || m2.showInChat).length;
|
|
406342
406495
|
return { path: outPath, messageCount: visible, format };
|
|
406343
406496
|
}
|
|
@@ -406347,12 +406500,12 @@ var init_export = __esm(() => {
|
|
|
406347
406500
|
|
|
406348
406501
|
// src/core/commands/session.ts
|
|
406349
406502
|
async function handleExportAll(ctx) {
|
|
406350
|
-
const { mkdirSync:
|
|
406351
|
-
const { join:
|
|
406352
|
-
const exportDir =
|
|
406353
|
-
|
|
406503
|
+
const { mkdirSync: mkdirSync22, writeFileSync: writeFileSync17 } = await import("fs");
|
|
406504
|
+
const { join: join40 } = await import("path");
|
|
406505
|
+
const exportDir = join40(ctx.cwd, ".soulforge", "exports");
|
|
406506
|
+
mkdirSync22(exportDir, { recursive: true });
|
|
406354
406507
|
const stamp = new Date().toISOString().slice(0, 19).replace(/[T:]/g, "-");
|
|
406355
|
-
const outPath =
|
|
406508
|
+
const outPath = join40(exportDir, `diagnostic-${stamp}.json`);
|
|
406356
406509
|
const activeModel = ctx.chat.activeModel;
|
|
406357
406510
|
const systemPrompt = ctx.contextManager.buildSystemPrompt(activeModel);
|
|
406358
406511
|
const coreMessages = ctx.chat.coreMessages;
|
|
@@ -406400,7 +406553,7 @@ async function handleExportAll(ctx) {
|
|
|
406400
406553
|
coreMessageCount: coreMessages.length,
|
|
406401
406554
|
systemPromptLength: systemPrompt.length
|
|
406402
406555
|
};
|
|
406403
|
-
|
|
406556
|
+
writeFileSync17(outPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
406404
406557
|
const relPath = outPath.startsWith(ctx.cwd) ? outPath.slice(ctx.cwd.length + 1) : outPath;
|
|
406405
406558
|
sysMsg(ctx, `Diagnostic export \u2192 \`${relPath}\` (system prompt: ${String(Math.round(systemPrompt.length / 4))} tokens, ${String(coreMessages.length)} core messages, ${String(chatMessages.length)} chat messages)`);
|
|
406406
406559
|
const { dirname: dirname15 } = await import("path");
|
|
@@ -406570,8 +406723,8 @@ var init_session = __esm(async () => {
|
|
|
406570
406723
|
|
|
406571
406724
|
// src/core/commands/storage.ts
|
|
406572
406725
|
import { Database as Database5 } from "bun:sqlite";
|
|
406573
|
-
import { existsSync as
|
|
406574
|
-
import { join as
|
|
406726
|
+
import { existsSync as existsSync36, rmSync as rmSync3 } from "fs";
|
|
406727
|
+
import { join as join40 } from "path";
|
|
406575
406728
|
function openStorageMenu(ctx) {
|
|
406576
406729
|
const show = () => {
|
|
406577
406730
|
const s = computeStorageSizes(ctx.cwd);
|
|
@@ -406684,8 +406837,8 @@ function openStorageMenu(ctx) {
|
|
|
406684
406837
|
const cleared = sm.clearAllSessions();
|
|
406685
406838
|
sysMsg(ctx, `Cleared ${String(cleared)} sessions (freed ~${formatBytes(s.sessions)}).`);
|
|
406686
406839
|
} else if (value === "clear-history") {
|
|
406687
|
-
const historyPath =
|
|
406688
|
-
if (
|
|
406840
|
+
const historyPath = join40(s.globalDir, "history.db");
|
|
406841
|
+
if (existsSync36(historyPath) && s.history > 0) {
|
|
406689
406842
|
const ok = await confirm({
|
|
406690
406843
|
title: "Clear search history?",
|
|
406691
406844
|
message: `Prompt history and stash entries (${formatBytes(s.history)}) will be deleted globally. This cannot be undone.`,
|
|
@@ -406704,8 +406857,8 @@ function openStorageMenu(ctx) {
|
|
|
406704
406857
|
}
|
|
406705
406858
|
}
|
|
406706
406859
|
} else if (value === "clear-plans") {
|
|
406707
|
-
const plansDir =
|
|
406708
|
-
if (
|
|
406860
|
+
const plansDir = join40(s.projectDir, "plans");
|
|
406861
|
+
if (existsSync36(plansDir) && s.plans > 0) {
|
|
406709
406862
|
const ok = await confirm({
|
|
406710
406863
|
title: "Clear plans?",
|
|
406711
406864
|
message: `All saved plans (${formatBytes(s.plans)}) for this project will be deleted. This cannot be undone.`,
|
|
@@ -406719,13 +406872,13 @@ function openStorageMenu(ctx) {
|
|
|
406719
406872
|
} else if (value === "vacuum") {
|
|
406720
406873
|
let freed = 0;
|
|
406721
406874
|
const dbs = [
|
|
406722
|
-
|
|
406723
|
-
|
|
406724
|
-
|
|
406725
|
-
|
|
406875
|
+
join40(s.projectDir, "repomap.db"),
|
|
406876
|
+
join40(s.projectDir, "memory.db"),
|
|
406877
|
+
join40(s.globalDir, "history.db"),
|
|
406878
|
+
join40(s.globalDir, "memory.db")
|
|
406726
406879
|
];
|
|
406727
406880
|
for (const dbPath of dbs) {
|
|
406728
|
-
if (!
|
|
406881
|
+
if (!existsSync36(dbPath))
|
|
406729
406882
|
continue;
|
|
406730
406883
|
try {
|
|
406731
406884
|
const before = fileSize(dbPath);
|
|
@@ -407797,8 +407950,8 @@ __export(exports_addons, {
|
|
|
407797
407950
|
autoInstallFromEnv: () => autoInstallFromEnv,
|
|
407798
407951
|
ADDON_NAMES: () => ADDON_NAMES
|
|
407799
407952
|
});
|
|
407800
|
-
import { existsSync as
|
|
407801
|
-
import { join as
|
|
407953
|
+
import { existsSync as existsSync37, rmSync as rmSync4 } from "fs";
|
|
407954
|
+
import { join as join41 } from "path";
|
|
407802
407955
|
function isAddonInstalled(name39) {
|
|
407803
407956
|
if (name39 === "proxy") {
|
|
407804
407957
|
return getVendoredPath("cli-proxy-api") !== null || commandExists("cli-proxy-api") || commandExists("cliproxyapi");
|
|
@@ -407829,7 +407982,7 @@ function listAddons() {
|
|
|
407829
407982
|
const record2 = cfg.addons?.[name39];
|
|
407830
407983
|
const vendored = isVendoredAddonInstalled(name39);
|
|
407831
407984
|
const installed2 = isAddonInstalled(name39);
|
|
407832
|
-
const path = vendored ?
|
|
407985
|
+
const path = vendored ? join41(BIN_DIR2, ADDON_BIN[name39]) : undefined;
|
|
407833
407986
|
return {
|
|
407834
407987
|
name: name39,
|
|
407835
407988
|
installed: installed2,
|
|
@@ -407884,8 +408037,8 @@ async function removeAddon(name39, onStatus) {
|
|
|
407884
408037
|
stopProxy2();
|
|
407885
408038
|
} catch {}
|
|
407886
408039
|
}
|
|
407887
|
-
const binPath =
|
|
407888
|
-
if (
|
|
408040
|
+
const binPath = join41(BIN_DIR2, ADDON_BIN[name39]);
|
|
408041
|
+
if (existsSync37(binPath)) {
|
|
407889
408042
|
try {
|
|
407890
408043
|
rmSync4(binPath, { force: true });
|
|
407891
408044
|
} catch (err2) {
|
|
@@ -407895,10 +408048,10 @@ async function removeAddon(name39, onStatus) {
|
|
|
407895
408048
|
const prefix = ADDON_INSTALL_PREFIX[name39];
|
|
407896
408049
|
try {
|
|
407897
408050
|
const { readdirSync: readdirSync10 } = await import("fs");
|
|
407898
|
-
if (
|
|
408051
|
+
if (existsSync37(INSTALLS_DIR2)) {
|
|
407899
408052
|
for (const entry of readdirSync10(INSTALLS_DIR2)) {
|
|
407900
408053
|
if (entry.startsWith(prefix) && /\d/.test(entry.slice(prefix.length, prefix.length + 1))) {
|
|
407901
|
-
rmSync4(
|
|
408054
|
+
rmSync4(join41(INSTALLS_DIR2, entry), { recursive: true, force: true });
|
|
407902
408055
|
}
|
|
407903
408056
|
}
|
|
407904
408057
|
}
|
|
@@ -408075,8 +408228,8 @@ var init_addons = __esm(() => {
|
|
|
408075
408228
|
init_platform();
|
|
408076
408229
|
init_install();
|
|
408077
408230
|
ADDON_NAMES = ["proxy", "neovim"];
|
|
408078
|
-
BIN_DIR2 =
|
|
408079
|
-
INSTALLS_DIR2 =
|
|
408231
|
+
BIN_DIR2 = join41(dataDir(), "bin");
|
|
408232
|
+
INSTALLS_DIR2 = join41(dataDir(), "installs");
|
|
408080
408233
|
ADDON_BIN = {
|
|
408081
408234
|
proxy: `cli-proxy-api${EXE}`,
|
|
408082
408235
|
neovim: `nvim${EXE}`
|
|
@@ -409369,7 +409522,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
|
|
|
409369
409522
|
});
|
|
409370
409523
|
const hasFiles = files != null && files.length > 0;
|
|
409371
409524
|
const imageUrls = hasFiles ? files.map((file2) => convertImageModelFileToDataUri(file2)) : [];
|
|
409372
|
-
const
|
|
409525
|
+
const endpoint2 = hasFiles ? "/images/edits" : "/images/generations";
|
|
409373
409526
|
const body2 = {
|
|
409374
409527
|
model: this.modelId,
|
|
409375
409528
|
prompt,
|
|
@@ -409405,7 +409558,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
|
|
|
409405
409558
|
const baseURL2 = (_a31 = this.config.baseURL) != null ? _a31 : "https://api.x.ai/v1";
|
|
409406
409559
|
const currentDate = (_d = (_c = (_b16 = this.config._internal) == null ? undefined : _b16.currentDate) == null ? undefined : _c.call(_b16)) != null ? _d : /* @__PURE__ */ new Date;
|
|
409407
409560
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
409408
|
-
url: `${baseURL2}${
|
|
409561
|
+
url: `${baseURL2}${endpoint2}`,
|
|
409409
409562
|
headers: combineHeaders(this.config.headers(), headers),
|
|
409410
409563
|
body: body2,
|
|
409411
409564
|
failedResponseHandler: xaiFailedResponseHandler,
|
|
@@ -410294,16 +410447,16 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
|
|
|
410294
410447
|
}
|
|
410295
410448
|
}
|
|
410296
410449
|
const baseURL2 = (_d = this.config.baseURL) != null ? _d : "https://api.x.ai/v1";
|
|
410297
|
-
let
|
|
410450
|
+
let endpoint2;
|
|
410298
410451
|
if (isEdit) {
|
|
410299
|
-
|
|
410452
|
+
endpoint2 = `${baseURL2}/videos/edits`;
|
|
410300
410453
|
} else if (isExtension) {
|
|
410301
|
-
|
|
410454
|
+
endpoint2 = `${baseURL2}/videos/extensions`;
|
|
410302
410455
|
} else {
|
|
410303
|
-
|
|
410456
|
+
endpoint2 = `${baseURL2}/videos/generations`;
|
|
410304
410457
|
}
|
|
410305
410458
|
const { value: createResponse } = await postJsonToApi({
|
|
410306
|
-
url:
|
|
410459
|
+
url: endpoint2,
|
|
410307
410460
|
headers: combineHeaders(this.config.headers(), options.headers),
|
|
410308
410461
|
body: body2,
|
|
410309
410462
|
failedResponseHandler: xaiFailedResponseHandler,
|
|
@@ -411285,6 +411438,7 @@ __export(exports_providers, {
|
|
|
411285
411438
|
minimax: () => minimax2,
|
|
411286
411439
|
lmstudio: () => lmstudio,
|
|
411287
411440
|
llmgateway: () => llmgateway2,
|
|
411441
|
+
isBuiltinProvider: () => isBuiltinProvider,
|
|
411288
411442
|
groq: () => groq2,
|
|
411289
411443
|
google: () => google2,
|
|
411290
411444
|
githubModels: () => githubModels,
|
|
@@ -411326,6 +411480,9 @@ function registerCustomProviders(configs) {
|
|
|
411326
411480
|
function getProvider(id) {
|
|
411327
411481
|
return providerMap.get(id);
|
|
411328
411482
|
}
|
|
411483
|
+
function isBuiltinProvider(id) {
|
|
411484
|
+
return BUILTIN_PROVIDER_IDS.has(id);
|
|
411485
|
+
}
|
|
411329
411486
|
function getAllProviders() {
|
|
411330
411487
|
return allProviders;
|
|
411331
411488
|
}
|
|
@@ -411338,7 +411495,7 @@ function getProviderSecretEntries() {
|
|
|
411338
411495
|
keyUrl: p.keyUrl
|
|
411339
411496
|
}));
|
|
411340
411497
|
}
|
|
411341
|
-
var BUILTIN_PROVIDERS, allProviders, providerMap, changeListeners;
|
|
411498
|
+
var BUILTIN_PROVIDERS, allProviders, providerMap, changeListeners, BUILTIN_PROVIDER_IDS;
|
|
411342
411499
|
var init_providers = __esm(() => {
|
|
411343
411500
|
init_anthropic();
|
|
411344
411501
|
init_bedrock();
|
|
@@ -411413,6 +411570,7 @@ var init_providers = __esm(() => {
|
|
|
411413
411570
|
allProviders = [...BUILTIN_PROVIDERS];
|
|
411414
411571
|
providerMap = new Map(allProviders.map((p) => [p.id, p]));
|
|
411415
411572
|
changeListeners = [];
|
|
411573
|
+
BUILTIN_PROVIDER_IDS = new Set(BUILTIN_PROVIDERS.map((p) => p.id));
|
|
411416
411574
|
});
|
|
411417
411575
|
|
|
411418
411576
|
// src/core/llm/models.ts
|
|
@@ -411927,6 +412085,25 @@ var init_models = __esm(() => {
|
|
|
411927
412085
|
});
|
|
411928
412086
|
|
|
411929
412087
|
// src/core/llm/provider-options.ts
|
|
412088
|
+
var exports_provider_options = {};
|
|
412089
|
+
__export(exports_provider_options, {
|
|
412090
|
+
telemetryModelInfo: () => telemetryModelInfo,
|
|
412091
|
+
supportsTemperature: () => supportsTemperature2,
|
|
412092
|
+
supportsProgrammaticToolCalling: () => supportsProgrammaticToolCalling,
|
|
412093
|
+
isProviderOptionsError: () => isProviderOptionsError,
|
|
412094
|
+
isAnthropicNative: () => isAnthropicNative,
|
|
412095
|
+
getSupportedEfforts: () => getSupportedEfforts,
|
|
412096
|
+
getSupportedClaudeEfforts: () => getSupportedClaudeEfforts,
|
|
412097
|
+
getModelId: () => getModelId2,
|
|
412098
|
+
getEphemeralCache: () => getEphemeralCache,
|
|
412099
|
+
getAnthropicToolVersions: () => getAnthropicToolVersions,
|
|
412100
|
+
extractBaseModel: () => extractBaseModel2,
|
|
412101
|
+
detectModelFamily: () => detectModelFamily,
|
|
412102
|
+
degradeProviderOptions: () => degradeProviderOptions,
|
|
412103
|
+
clampEffort: () => clampEffort,
|
|
412104
|
+
buildProviderOptions: () => buildProviderOptions,
|
|
412105
|
+
EPHEMERAL_CACHE: () => EPHEMERAL_CACHE
|
|
412106
|
+
});
|
|
411930
412107
|
function parseModelId(modelId) {
|
|
411931
412108
|
const slash = modelId.indexOf("/");
|
|
411932
412109
|
if (slash === -1)
|
|
@@ -412112,6 +412289,16 @@ function getEffectiveCaps(modelId) {
|
|
|
412112
412289
|
function isAnthropicNative(modelId) {
|
|
412113
412290
|
return detectModelFamily(modelId) === "claude";
|
|
412114
412291
|
}
|
|
412292
|
+
function telemetryModelInfo(modelId) {
|
|
412293
|
+
const slash = modelId.indexOf("/");
|
|
412294
|
+
const rawProvider = slash >= 0 ? modelId.slice(0, slash) : "";
|
|
412295
|
+
const builtin = isBuiltinProvider(rawProvider);
|
|
412296
|
+
const provider = builtin ? rawProvider : "custom";
|
|
412297
|
+
const base = extractBaseModel2(modelId);
|
|
412298
|
+
const known = builtin && TELEMETRY_MODEL_PATTERNS.some((re) => re.test(base));
|
|
412299
|
+
const model = known ? base.slice(0, 32) : "other";
|
|
412300
|
+
return { provider, model };
|
|
412301
|
+
}
|
|
412115
412302
|
function getSupportedClaudeEfforts(modelId) {
|
|
412116
412303
|
const base = extractBaseModel2(modelId);
|
|
412117
412304
|
if (!base.startsWith("claude"))
|
|
@@ -412126,7 +412313,7 @@ function getSupportedClaudeEfforts(modelId) {
|
|
|
412126
412313
|
return ["max", "high", "medium", "low"];
|
|
412127
412314
|
}
|
|
412128
412315
|
if (base.includes("opus-4-5") || base.includes("opus-4.5")) {
|
|
412129
|
-
return ["high", "medium", "low"];
|
|
412316
|
+
return ["max", "high", "medium", "low"];
|
|
412130
412317
|
}
|
|
412131
412318
|
return ["high", "medium", "low"];
|
|
412132
412319
|
}
|
|
@@ -412145,6 +412332,25 @@ function clampEffort(modelId, effort) {
|
|
|
412145
412332
|
}
|
|
412146
412333
|
return supported[supported.length - 1] ?? null;
|
|
412147
412334
|
}
|
|
412335
|
+
function getSupportedEfforts(modelId) {
|
|
412336
|
+
const family = detectModelFamily(modelId);
|
|
412337
|
+
const base = extractBaseModel2(modelId);
|
|
412338
|
+
if (family === "claude") {
|
|
412339
|
+
const efforts = getSupportedClaudeEfforts(modelId);
|
|
412340
|
+
return efforts ? ["off", ...efforts] : null;
|
|
412341
|
+
}
|
|
412342
|
+
if (family === "deepseek")
|
|
412343
|
+
return ["off", "high", "max"];
|
|
412344
|
+
if (family === "openai") {
|
|
412345
|
+
const isReasoning = base.startsWith("o1") || base.startsWith("o3") || base.startsWith("o4") || base.startsWith("gpt-5");
|
|
412346
|
+
return isReasoning ? ["off", "none", "minimal", "low", "medium", "high"] : null;
|
|
412347
|
+
}
|
|
412348
|
+
if (family === "xai")
|
|
412349
|
+
return ["off", "low", "medium", "high"];
|
|
412350
|
+
if (family === "google")
|
|
412351
|
+
return ["off", "minimal", "low", "medium", "high"];
|
|
412352
|
+
return null;
|
|
412353
|
+
}
|
|
412148
412354
|
function supportsProgrammaticToolCalling(modelId) {
|
|
412149
412355
|
const base = extractBaseModel2(modelId);
|
|
412150
412356
|
const gen = getClaudeGen(base);
|
|
@@ -412573,7 +412779,7 @@ function buildGroqOptions(config2) {
|
|
|
412573
412779
|
function isDeepSeekReasoner(base) {
|
|
412574
412780
|
return base === "deepseek-reasoner" || base.includes("reasoner") || base.endsWith("-think");
|
|
412575
412781
|
}
|
|
412576
|
-
var parseOpusVersion2, isAdaptiveOnly2, extractBaseModel2, getModelId2, supportsTemperature2, NO_SUPPORT, ANTHROPIC_FULL, OPENAI_FULL, GOOGLE_FULL, XAI_FULL, DEEPSEEK_FULL, OPENROUTER_FULL, GATEWAY_FULL, COMPAT_ONLY, PROVIDER_CONSTRAINTS, LEGACY_PREFIXES, CACHE_EPHEMERAL_5M, CACHE_EPHEMERAL_1H, EPHEMERAL_CACHE_5M, EPHEMERAL_CACHE_1H, EPHEMERAL_CACHE;
|
|
412782
|
+
var parseOpusVersion2, isAdaptiveOnly2, extractBaseModel2, getModelId2, supportsTemperature2, NO_SUPPORT, ANTHROPIC_FULL, OPENAI_FULL, GOOGLE_FULL, XAI_FULL, DEEPSEEK_FULL, OPENROUTER_FULL, GATEWAY_FULL, COMPAT_ONLY, PROVIDER_CONSTRAINTS, LEGACY_PREFIXES, TELEMETRY_MODEL_PATTERNS, CACHE_EPHEMERAL_5M, CACHE_EPHEMERAL_1H, EPHEMERAL_CACHE_5M, EPHEMERAL_CACHE_1H, EPHEMERAL_CACHE;
|
|
412577
412783
|
var init_provider_options = __esm(() => {
|
|
412578
412784
|
init_models();
|
|
412579
412785
|
init_providers();
|
|
@@ -412692,6 +412898,14 @@ var init_provider_options = __esm(() => {
|
|
|
412692
412898
|
"claude-2",
|
|
412693
412899
|
"claude-instant"
|
|
412694
412900
|
];
|
|
412901
|
+
TELEMETRY_MODEL_PATTERNS = [
|
|
412902
|
+
/^claude-[a-z]+-\d+(?:[.-]\d+)?(?:-\d{8})?$/,
|
|
412903
|
+
/^gpt-[a-z0-9.]+(?:-[a-z0-9.]+)?$/,
|
|
412904
|
+
/^o[1-9](?:-[a-z]+)?$/,
|
|
412905
|
+
/^gemini-[0-9.]+-[a-z]+(?:-[a-z0-9]+)?$/,
|
|
412906
|
+
/^grok-[0-9]+(?:-[a-z]+)?$/,
|
|
412907
|
+
/^deepseek-[a-z]+(?:-[a-z0-9]+)?$/
|
|
412908
|
+
];
|
|
412695
412909
|
CACHE_EPHEMERAL_5M = {
|
|
412696
412910
|
cacheControl: { type: "ephemeral", ttl: "5m" }
|
|
412697
412911
|
};
|
|
@@ -413094,7 +413308,7 @@ var init_embedder = __esm(() => {
|
|
|
413094
413308
|
|
|
413095
413309
|
// src/core/memory/db.ts
|
|
413096
413310
|
import { Database as Database6 } from "bun:sqlite";
|
|
413097
|
-
import { chmodSync as chmodSync4, existsSync as
|
|
413311
|
+
import { chmodSync as chmodSync4, existsSync as existsSync38, mkdirSync as mkdirSync22 } from "fs";
|
|
413098
413312
|
import { dirname as dirname15 } from "path";
|
|
413099
413313
|
|
|
413100
413314
|
class MemoryDB {
|
|
@@ -413105,8 +413319,8 @@ class MemoryDB {
|
|
|
413105
413319
|
this.scope = scope;
|
|
413106
413320
|
if (dbPath !== ":memory:") {
|
|
413107
413321
|
const dir = dirname15(dbPath);
|
|
413108
|
-
if (!
|
|
413109
|
-
|
|
413322
|
+
if (!existsSync38(dir))
|
|
413323
|
+
mkdirSync22(dir, { recursive: true });
|
|
413110
413324
|
}
|
|
413111
413325
|
this.legacyBackupPath = dbPath !== ":memory:" ? rotateLegacyDb(dbPath) : null;
|
|
413112
413326
|
this.db = new Database6(dbPath);
|
|
@@ -413989,7 +414203,7 @@ function codePointCount(s) {
|
|
|
413989
414203
|
return n;
|
|
413990
414204
|
}
|
|
413991
414205
|
function rotateLegacyDb(dbPath) {
|
|
413992
|
-
if (!
|
|
414206
|
+
if (!existsSync38(dbPath))
|
|
413993
414207
|
return null;
|
|
413994
414208
|
let needsRotation = false;
|
|
413995
414209
|
let probe = null;
|
|
@@ -414011,7 +414225,7 @@ function rotateLegacyDb(dbPath) {
|
|
|
414011
414225
|
try {
|
|
414012
414226
|
safeRename(dbPath, backup);
|
|
414013
414227
|
for (const suffix of ["-wal", "-shm"]) {
|
|
414014
|
-
if (
|
|
414228
|
+
if (existsSync38(dbPath + suffix)) {
|
|
414015
414229
|
try {
|
|
414016
414230
|
safeRename(dbPath + suffix, backup + suffix);
|
|
414017
414231
|
} catch {}
|
|
@@ -414082,8 +414296,8 @@ var init_db2 = __esm(() => {
|
|
|
414082
414296
|
});
|
|
414083
414297
|
|
|
414084
414298
|
// src/core/memory/manager.ts
|
|
414085
|
-
import { existsSync as
|
|
414086
|
-
import { dirname as dirname16, join as
|
|
414299
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync23, readFileSync as readFileSync21, rmSync as rmSync5, writeFileSync as writeFileSync17 } from "fs";
|
|
414300
|
+
import { dirname as dirname16, join as join42 } from "path";
|
|
414087
414301
|
|
|
414088
414302
|
class MemoryManager {
|
|
414089
414303
|
globalDb;
|
|
@@ -414109,22 +414323,22 @@ class MemoryManager {
|
|
|
414109
414323
|
constructor(cwd, globalDir) {
|
|
414110
414324
|
this.cwd = cwd;
|
|
414111
414325
|
this._globalDir = globalDir ?? configDir();
|
|
414112
|
-
const globalPath =
|
|
414113
|
-
const projectPath =
|
|
414326
|
+
const globalPath = join42(this._globalDir, "memory.db");
|
|
414327
|
+
const projectPath = join42(cwd, ".soulforge", "memory.db");
|
|
414114
414328
|
this.globalDb = new MemoryDB(globalPath, "global");
|
|
414115
414329
|
this.projectDb = new MemoryDB(projectPath, "project");
|
|
414116
414330
|
this.loadConfig();
|
|
414117
414331
|
}
|
|
414118
414332
|
configPath(scope) {
|
|
414119
|
-
return scope === "global" ?
|
|
414333
|
+
return scope === "global" ? join42(this._globalDir, CONFIG_FILE) : join42(this.cwd, ".soulforge", CONFIG_FILE);
|
|
414120
414334
|
}
|
|
414121
414335
|
loadConfig() {
|
|
414122
414336
|
for (const scope of ["project", "global"]) {
|
|
414123
414337
|
const path = this.configPath(scope);
|
|
414124
|
-
if (!
|
|
414338
|
+
if (!existsSync39(path))
|
|
414125
414339
|
continue;
|
|
414126
414340
|
try {
|
|
414127
|
-
const data = JSON.parse(
|
|
414341
|
+
const data = JSON.parse(readFileSync21(path, "utf-8"));
|
|
414128
414342
|
if (data.writeScope && data.readScope) {
|
|
414129
414343
|
this._scopeConfig = { writeScope: data.writeScope, readScope: data.readScope };
|
|
414130
414344
|
this._settingsScope = scope;
|
|
@@ -414138,15 +414352,15 @@ class MemoryManager {
|
|
|
414138
414352
|
saveConfig(to) {
|
|
414139
414353
|
const path = this.configPath(to);
|
|
414140
414354
|
const dir = dirname16(path);
|
|
414141
|
-
if (!
|
|
414142
|
-
|
|
414355
|
+
if (!existsSync39(dir))
|
|
414356
|
+
mkdirSync23(dir, { recursive: true });
|
|
414143
414357
|
const payload = { ...this._scopeConfig, cleanup: this._cleanup };
|
|
414144
|
-
|
|
414358
|
+
writeFileSync17(path, JSON.stringify(payload, null, 2), "utf-8");
|
|
414145
414359
|
this._settingsScope = to;
|
|
414146
414360
|
}
|
|
414147
414361
|
deleteConfig(from) {
|
|
414148
414362
|
const path = this.configPath(from);
|
|
414149
|
-
if (
|
|
414363
|
+
if (existsSync39(path))
|
|
414150
414364
|
rmSync5(path);
|
|
414151
414365
|
if (from === this._settingsScope) {
|
|
414152
414366
|
this._settingsScope = "project";
|
|
@@ -414371,7 +414585,7 @@ class MemoryManager {
|
|
|
414371
414585
|
}
|
|
414372
414586
|
deleteConfigOnly(from) {
|
|
414373
414587
|
const path = this.configPath(from);
|
|
414374
|
-
if (
|
|
414588
|
+
if (existsSync39(path)) {
|
|
414375
414589
|
try {
|
|
414376
414590
|
rmSync5(path);
|
|
414377
414591
|
} catch {}
|
|
@@ -415662,7 +415876,7 @@ __export(exports_tee, {
|
|
|
415662
415876
|
saveTee: () => saveTee
|
|
415663
415877
|
});
|
|
415664
415878
|
import { mkdir, readdir as readdir3, unlink, writeFile as writeFile3 } from "fs/promises";
|
|
415665
|
-
import { join as
|
|
415879
|
+
import { join as join43 } from "path";
|
|
415666
415880
|
async function ensureDir2() {
|
|
415667
415881
|
if (dirReady)
|
|
415668
415882
|
return;
|
|
@@ -415676,7 +415890,7 @@ async function pruneOldFiles() {
|
|
|
415676
415890
|
if (toRemove > 0) {
|
|
415677
415891
|
for (const f of files.slice(0, toRemove)) {
|
|
415678
415892
|
try {
|
|
415679
|
-
await unlink(
|
|
415893
|
+
await unlink(join43(TEE_DIR, f));
|
|
415680
415894
|
} catch {}
|
|
415681
415895
|
}
|
|
415682
415896
|
}
|
|
@@ -415687,7 +415901,7 @@ async function saveTee(label, content) {
|
|
|
415687
415901
|
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
415688
415902
|
const safeName = label.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 40);
|
|
415689
415903
|
const filename = `${ts}_${safeName}.txt`;
|
|
415690
|
-
const filepath =
|
|
415904
|
+
const filepath = join43(TEE_DIR, filename);
|
|
415691
415905
|
let toWrite = content;
|
|
415692
415906
|
if (content.length > MAX_TEE_BYTES) {
|
|
415693
415907
|
const half = Math.floor(MAX_TEE_BYTES / 2);
|
|
@@ -415733,7 +415947,7 @@ function withTimeout2(p, ms, label) {
|
|
|
415733
415947
|
var TEE_DIR, MAX_TEE_FILES = 20, MAX_TEE_BYTES = 512000, dirReady = false;
|
|
415734
415948
|
var init_tee = __esm(() => {
|
|
415735
415949
|
init_platform();
|
|
415736
|
-
TEE_DIR =
|
|
415950
|
+
TEE_DIR = join43(userDataDir(), "tee");
|
|
415737
415951
|
});
|
|
415738
415952
|
|
|
415739
415953
|
// src/core/tools/tool-timeout.ts
|
|
@@ -415764,7 +415978,7 @@ __export(exports_project, {
|
|
|
415764
415978
|
detectNativeChecks: () => detectNativeChecks
|
|
415765
415979
|
});
|
|
415766
415980
|
import { access, readdir as readdir4, readFile as readFile9 } from "fs/promises";
|
|
415767
|
-
import { dirname as dirname17, join as
|
|
415981
|
+
import { dirname as dirname17, join as join44 } from "path";
|
|
415768
415982
|
function shellQuote(s) {
|
|
415769
415983
|
return `'${s.replace(/'/g, "'\\''")}'`;
|
|
415770
415984
|
}
|
|
@@ -415787,7 +416001,7 @@ async function detectProfile(cwd) {
|
|
|
415787
416001
|
};
|
|
415788
416002
|
const has = async (f) => {
|
|
415789
416003
|
try {
|
|
415790
|
-
await access(
|
|
416004
|
+
await access(join44(cwd, f));
|
|
415791
416005
|
return true;
|
|
415792
416006
|
} catch {
|
|
415793
416007
|
return false;
|
|
@@ -415931,7 +416145,7 @@ async function detectProfile(cwd) {
|
|
|
415931
416145
|
const gw = await has("gradlew") ? "./gradlew" : "gradle";
|
|
415932
416146
|
profile.test = `${gw} test`;
|
|
415933
416147
|
profile.build = `${gw} build`;
|
|
415934
|
-
const buildFile = await has("build.gradle.kts") ? await readSafe(
|
|
416148
|
+
const buildFile = await has("build.gradle.kts") ? await readSafe(join44(cwd, "build.gradle.kts")) : await readSafe(join44(cwd, "build.gradle"));
|
|
415935
416149
|
if (buildFile.includes("spotless"))
|
|
415936
416150
|
profile.lint = `${gw} spotlessCheck`;
|
|
415937
416151
|
else if (buildFile.includes("ktlint"))
|
|
@@ -416015,7 +416229,7 @@ async function detectJsPm(cwd) {
|
|
|
416015
416229
|
for (let i2 = 0;i2 < 5; i2++) {
|
|
416016
416230
|
for (const [file2, pm] of lockfiles) {
|
|
416017
416231
|
try {
|
|
416018
|
-
await access(
|
|
416232
|
+
await access(join44(dir, file2));
|
|
416019
416233
|
return pm;
|
|
416020
416234
|
} catch {}
|
|
416021
416235
|
}
|
|
@@ -416028,7 +416242,7 @@ async function detectJsPm(cwd) {
|
|
|
416028
416242
|
}
|
|
416029
416243
|
async function readPackageScripts(cwd) {
|
|
416030
416244
|
try {
|
|
416031
|
-
const pkg = JSON.parse(await readFile9(
|
|
416245
|
+
const pkg = JSON.parse(await readFile9(join44(cwd, "package.json"), "utf-8"));
|
|
416032
416246
|
return pkg.scripts ?? {};
|
|
416033
416247
|
} catch {
|
|
416034
416248
|
return {};
|
|
@@ -416037,7 +416251,7 @@ async function readPackageScripts(cwd) {
|
|
|
416037
416251
|
async function detectJsLinter(cwd, runner = "") {
|
|
416038
416252
|
const has = async (f) => {
|
|
416039
416253
|
try {
|
|
416040
|
-
await access(
|
|
416254
|
+
await access(join44(cwd, f));
|
|
416041
416255
|
return true;
|
|
416042
416256
|
} catch {
|
|
416043
416257
|
return false;
|
|
@@ -416055,7 +416269,7 @@ async function detectJsLinter(cwd, runner = "") {
|
|
|
416055
416269
|
async function detectJsFormatter(cwd, runner = "") {
|
|
416056
416270
|
const has = async (f) => {
|
|
416057
416271
|
try {
|
|
416058
|
-
await access(
|
|
416272
|
+
await access(join44(cwd, f));
|
|
416059
416273
|
return true;
|
|
416060
416274
|
} catch {
|
|
416061
416275
|
return false;
|
|
@@ -416073,7 +416287,7 @@ async function detectJsFormatter(cwd, runner = "") {
|
|
|
416073
416287
|
async function detectFormatAndLint(cwd, runner = "") {
|
|
416074
416288
|
const has = async (f) => {
|
|
416075
416289
|
try {
|
|
416076
|
-
await access(
|
|
416290
|
+
await access(join44(cwd, f));
|
|
416077
416291
|
return true;
|
|
416078
416292
|
} catch {
|
|
416079
416293
|
return false;
|
|
@@ -416088,7 +416302,7 @@ async function detectFormatAndLint(cwd, runner = "") {
|
|
|
416088
416302
|
async function detectJsTypecheck(cwd) {
|
|
416089
416303
|
const has = async (f) => {
|
|
416090
416304
|
try {
|
|
416091
|
-
await access(
|
|
416305
|
+
await access(join44(cwd, f));
|
|
416092
416306
|
return true;
|
|
416093
416307
|
} catch {
|
|
416094
416308
|
return false;
|
|
@@ -416106,7 +416320,7 @@ async function detectJsTypecheck(cwd) {
|
|
|
416106
416320
|
async function detectNativeChecks(cwd) {
|
|
416107
416321
|
const has = async (f) => {
|
|
416108
416322
|
try {
|
|
416109
|
-
await access(
|
|
416323
|
+
await access(join44(cwd, f));
|
|
416110
416324
|
return true;
|
|
416111
416325
|
} catch {
|
|
416112
416326
|
return false;
|
|
@@ -416153,7 +416367,7 @@ async function detectNativeChecks(cwd) {
|
|
|
416153
416367
|
async function discoverPackages(cwd) {
|
|
416154
416368
|
const has = async (f) => {
|
|
416155
416369
|
try {
|
|
416156
|
-
await access(
|
|
416370
|
+
await access(join44(cwd, f));
|
|
416157
416371
|
return true;
|
|
416158
416372
|
} catch {
|
|
416159
416373
|
return false;
|
|
@@ -416166,20 +416380,20 @@ async function discoverPackages(cwd) {
|
|
|
416166
416380
|
const base = glob.replace(/\/?\*.*$/, "");
|
|
416167
416381
|
if (!base)
|
|
416168
416382
|
continue;
|
|
416169
|
-
await scanDir(
|
|
416383
|
+
await scanDir(join44(cwd, base), cwd, packages, "package.json");
|
|
416170
416384
|
}
|
|
416171
416385
|
}
|
|
416172
416386
|
if (await has("Cargo.toml")) {
|
|
416173
416387
|
try {
|
|
416174
|
-
const cargo = await readFile9(
|
|
416388
|
+
const cargo = await readFile9(join44(cwd, "Cargo.toml"), "utf-8");
|
|
416175
416389
|
const membersMatch = cargo.match(/members\s*=\s*\[([\s\S]*?)\]/);
|
|
416176
416390
|
if (membersMatch?.[1]) {
|
|
416177
416391
|
const members = membersMatch[1].match(/["']([^"']+)["']/g)?.map((m2) => m2.replace(/["']/g, "")) ?? [];
|
|
416178
416392
|
for (const member of members) {
|
|
416179
416393
|
if (member.includes("*")) {
|
|
416180
|
-
await scanDir(
|
|
416181
|
-
} else if (await has(
|
|
416182
|
-
await addPackage(packages,
|
|
416394
|
+
await scanDir(join44(cwd, member.replace(/\/?\*$/, "")), cwd, packages, "Cargo.toml");
|
|
416395
|
+
} else if (await has(join44(member, "Cargo.toml"))) {
|
|
416396
|
+
await addPackage(packages, join44(cwd, member), cwd);
|
|
416183
416397
|
}
|
|
416184
416398
|
}
|
|
416185
416399
|
}
|
|
@@ -416187,12 +416401,12 @@ async function discoverPackages(cwd) {
|
|
|
416187
416401
|
}
|
|
416188
416402
|
if (await has("go.work")) {
|
|
416189
416403
|
try {
|
|
416190
|
-
const goWork = await readFile9(
|
|
416404
|
+
const goWork = await readFile9(join44(cwd, "go.work"), "utf-8");
|
|
416191
416405
|
const useMatch = goWork.match(/use\s*\(([\s\S]*?)\)/);
|
|
416192
416406
|
const dirs = useMatch?.[1] ? useMatch[1].match(/^\s*(\S+)/gm)?.map((d2) => d2.trim()) ?? [] : goWork.match(/^use\s+(\S+)/gm)?.map((d2) => d2.replace(/^use\s+/, "").trim()) ?? [];
|
|
416193
416407
|
for (const dir of dirs) {
|
|
416194
|
-
if (await has(
|
|
416195
|
-
await addPackage(packages,
|
|
416408
|
+
if (await has(join44(dir, "go.mod"))) {
|
|
416409
|
+
await addPackage(packages, join44(cwd, dir), cwd);
|
|
416196
416410
|
}
|
|
416197
416411
|
}
|
|
416198
416412
|
} catch {}
|
|
@@ -416202,7 +416416,7 @@ async function discoverPackages(cwd) {
|
|
|
416202
416416
|
async function getJsWorkspaceGlobs(cwd) {
|
|
416203
416417
|
const has = async (f) => {
|
|
416204
416418
|
try {
|
|
416205
|
-
await access(
|
|
416419
|
+
await access(join44(cwd, f));
|
|
416206
416420
|
return true;
|
|
416207
416421
|
} catch {
|
|
416208
416422
|
return false;
|
|
@@ -416210,7 +416424,7 @@ async function getJsWorkspaceGlobs(cwd) {
|
|
|
416210
416424
|
};
|
|
416211
416425
|
if (await has("pnpm-workspace.yaml")) {
|
|
416212
416426
|
try {
|
|
416213
|
-
const raw = await readFile9(
|
|
416427
|
+
const raw = await readFile9(join44(cwd, "pnpm-workspace.yaml"), "utf-8");
|
|
416214
416428
|
const quoted = raw.match(/['"]([^'"]+)['"]/g)?.map((g3) => g3.replace(/['"]/g, "")) ?? [];
|
|
416215
416429
|
if (quoted.length > 0)
|
|
416216
416430
|
return quoted;
|
|
@@ -416220,7 +416434,7 @@ async function getJsWorkspaceGlobs(cwd) {
|
|
|
416220
416434
|
}
|
|
416221
416435
|
if (await has("package.json")) {
|
|
416222
416436
|
try {
|
|
416223
|
-
const pkg = JSON.parse(await readFile9(
|
|
416437
|
+
const pkg = JSON.parse(await readFile9(join44(cwd, "package.json"), "utf-8"));
|
|
416224
416438
|
const w2 = pkg.workspaces;
|
|
416225
416439
|
return Array.isArray(w2) ? w2 : Array.isArray(w2?.packages) ? w2.packages : [];
|
|
416226
416440
|
} catch {}
|
|
@@ -416233,9 +416447,9 @@ async function scanDir(dir, rootCwd, packages, marker31) {
|
|
|
416233
416447
|
for (const entry of entries) {
|
|
416234
416448
|
if (!entry.isDirectory())
|
|
416235
416449
|
continue;
|
|
416236
|
-
const pkgDir =
|
|
416450
|
+
const pkgDir = join44(dir, entry.name);
|
|
416237
416451
|
try {
|
|
416238
|
-
await access(
|
|
416452
|
+
await access(join44(pkgDir, marker31));
|
|
416239
416453
|
await addPackage(packages, pkgDir, rootCwd);
|
|
416240
416454
|
} catch {}
|
|
416241
416455
|
}
|
|
@@ -416247,14 +416461,14 @@ async function addPackage(packages, pkgDir, rootCwd) {
|
|
|
416247
416461
|
let name39 = rel;
|
|
416248
416462
|
try {
|
|
416249
416463
|
try {
|
|
416250
|
-
await access(
|
|
416251
|
-
const pkg = JSON.parse(await readFile9(
|
|
416464
|
+
await access(join44(pkgDir, "package.json"));
|
|
416465
|
+
const pkg = JSON.parse(await readFile9(join44(pkgDir, "package.json"), "utf-8"));
|
|
416252
416466
|
if (pkg.name)
|
|
416253
416467
|
name39 = pkg.name;
|
|
416254
416468
|
} catch {
|
|
416255
416469
|
try {
|
|
416256
|
-
await access(
|
|
416257
|
-
const cargo = await readFile9(
|
|
416470
|
+
await access(join44(pkgDir, "Cargo.toml"));
|
|
416471
|
+
const cargo = await readFile9(join44(pkgDir, "Cargo.toml"), "utf-8");
|
|
416258
416472
|
const nameMatch = cargo.match(/name\s*=\s*["']([^"']+)["']/);
|
|
416259
416473
|
if (nameMatch?.[1])
|
|
416260
416474
|
name39 = nameMatch[1];
|
|
@@ -416336,7 +416550,7 @@ async function resolveRunScript(profile, script, cwd) {
|
|
|
416336
416550
|
if (scripts[script]) {
|
|
416337
416551
|
const has = async (f) => {
|
|
416338
416552
|
try {
|
|
416339
|
-
await access(
|
|
416553
|
+
await access(join44(cwd, f));
|
|
416340
416554
|
return true;
|
|
416341
416555
|
} catch {
|
|
416342
416556
|
return false;
|
|
@@ -416413,7 +416627,7 @@ var init_project = __esm(() => {
|
|
|
416413
416627
|
name: "project",
|
|
416414
416628
|
description: "[TIER-1] Verify after every edit \u2014 auto-detected toolchain. " + "Actions: check (typecheck+lint+test in parallel), test, build, lint, format, typecheck, run, list. " + "Use check after edits for full verification in one call. Fix only the failed step, then re-run just that action.",
|
|
416415
416629
|
execute: async (args2) => {
|
|
416416
|
-
const cwd = args2.cwd ?
|
|
416630
|
+
const cwd = args2.cwd ? join44(getCwd(), args2.cwd) : getCwd();
|
|
416417
416631
|
if (args2.action === "list") {
|
|
416418
416632
|
const packages = await discoverPackages(cwd);
|
|
416419
416633
|
return { success: true, output: formatPackageList(packages) };
|
|
@@ -416905,7 +417119,7 @@ function contentHash2(s) {
|
|
|
416905
417119
|
|
|
416906
417120
|
// src/core/tools/ts-project-detect.ts
|
|
416907
417121
|
import { access as access2 } from "fs/promises";
|
|
416908
|
-
import { join as
|
|
417122
|
+
import { join as join45 } from "path";
|
|
416909
417123
|
function hasTsJsExtension(path) {
|
|
416910
417124
|
const dot = path.lastIndexOf(".");
|
|
416911
417125
|
if (dot === -1)
|
|
@@ -416917,7 +417131,7 @@ async function isTsJsProject(cwd = process.cwd()) {
|
|
|
416917
417131
|
return _cachedIsTsJs;
|
|
416918
417132
|
const check2 = async (f) => {
|
|
416919
417133
|
try {
|
|
416920
|
-
await access2(
|
|
417134
|
+
await access2(join45(cwd, f));
|
|
416921
417135
|
return true;
|
|
416922
417136
|
} catch {
|
|
416923
417137
|
return false;
|
|
@@ -432045,7 +432259,7 @@ var init_grep = __esm(() => {
|
|
|
432045
432259
|
|
|
432046
432260
|
// src/core/tools/list-dir.ts
|
|
432047
432261
|
import { readdir as readdir5, stat as stat3 } from "fs/promises";
|
|
432048
|
-
import { join as
|
|
432262
|
+
import { join as join46, relative as relative7, resolve as resolve23 } from "path";
|
|
432049
432263
|
function formatEntry(name39, isDir, meta3) {
|
|
432050
432264
|
if (isDir)
|
|
432051
432265
|
return `\uD83D\uDCC1 ${name39}/`;
|
|
@@ -432092,10 +432306,10 @@ async function listDirFS(absPath, displayPath3, maxDepth, currentDepth, budget)
|
|
|
432092
432306
|
} catch {
|
|
432093
432307
|
return { output: `\u274C ${displayPath3} \u2014 cannot read directory`, count: 0 };
|
|
432094
432308
|
}
|
|
432095
|
-
const visible = rawEntries.filter((name39) => (!name39.startsWith(".") || name39 === ".gitignore") && !isForbidden(
|
|
432309
|
+
const visible = rawEntries.filter((name39) => (!name39.startsWith(".") || name39 === ".gitignore") && !isForbidden(join46(absPath, name39)));
|
|
432096
432310
|
const classified = await Promise.all(visible.map(async (name39) => {
|
|
432097
432311
|
try {
|
|
432098
|
-
const s = await stat3(
|
|
432312
|
+
const s = await stat3(join46(absPath, name39));
|
|
432099
432313
|
return { name: name39, isDir: s.isDirectory() };
|
|
432100
432314
|
} catch {
|
|
432101
432315
|
return { name: name39, isDir: false };
|
|
@@ -432115,7 +432329,7 @@ async function listDirFS(absPath, displayPath3, maxDepth, currentDepth, budget)
|
|
|
432115
432329
|
lines.push(`${indent}\uD83D\uDCC1 ${name39}/`);
|
|
432116
432330
|
count++;
|
|
432117
432331
|
if (currentDepth + 1 < maxDepth && count < budget) {
|
|
432118
|
-
const childAbs =
|
|
432332
|
+
const childAbs = join46(absPath, name39);
|
|
432119
432333
|
const childDisplay = `${displayPath3}/${name39}`;
|
|
432120
432334
|
const sub = await listDirFS(childAbs, childDisplay, maxDepth, currentDepth + 1, budget - count);
|
|
432121
432335
|
if (sub.count > 0) {
|
|
@@ -434973,7 +435187,7 @@ var MAX_BYTES2 = 512, UTF8_BOUNDARY_RESERVE = 3;
|
|
|
434973
435187
|
var init_lib2 = () => {};
|
|
434974
435188
|
|
|
434975
435189
|
// src/core/tools/binary-detect.ts
|
|
434976
|
-
import { existsSync as
|
|
435190
|
+
import { existsSync as existsSync40, statSync as statSync7 } from "fs";
|
|
434977
435191
|
import { extname as extname3, resolve as resolve28 } from "path";
|
|
434978
435192
|
function binaryHint(ext) {
|
|
434979
435193
|
if (IMAGE_EXTS.has(ext))
|
|
@@ -434994,7 +435208,7 @@ function binaryHint(ext) {
|
|
|
434994
435208
|
}
|
|
434995
435209
|
function checkBinaryFile(filePath) {
|
|
434996
435210
|
try {
|
|
434997
|
-
if (!
|
|
435211
|
+
if (!existsSync40(filePath))
|
|
434998
435212
|
return null;
|
|
434999
435213
|
const stat5 = statSync7(filePath);
|
|
435000
435214
|
if (!stat5.isFile())
|
|
@@ -436134,7 +436348,7 @@ async function locateSymbol(router2, symbol31, hint) {
|
|
|
436134
436348
|
return null;
|
|
436135
436349
|
}
|
|
436136
436350
|
async function findProjectRoot2(file2) {
|
|
436137
|
-
const { dirname: dirname22, join:
|
|
436351
|
+
const { dirname: dirname22, join: join47 } = __require("path");
|
|
436138
436352
|
let dir = dirname22(file2);
|
|
436139
436353
|
const cwd2 = getCwd();
|
|
436140
436354
|
while (dir.length >= cwd2.length) {
|
|
@@ -436146,7 +436360,7 @@ async function findProjectRoot2(file2) {
|
|
|
436146
436360
|
"pyproject.toml"
|
|
436147
436361
|
]) {
|
|
436148
436362
|
try {
|
|
436149
|
-
await statAsync9(
|
|
436363
|
+
await statAsync9(join47(dir, marker31));
|
|
436150
436364
|
return dir;
|
|
436151
436365
|
} catch {}
|
|
436152
436366
|
}
|
|
@@ -436980,9 +437194,9 @@ __export(exports_image, {
|
|
|
436980
437194
|
import { execSync as execSync3, spawn as spawn14 } from "child_process";
|
|
436981
437195
|
import {
|
|
436982
437196
|
closeSync as closeSync2,
|
|
436983
|
-
existsSync as
|
|
437197
|
+
existsSync as existsSync41,
|
|
436984
437198
|
openSync as openSync2,
|
|
436985
|
-
readFileSync as
|
|
437199
|
+
readFileSync as readFileSync22,
|
|
436986
437200
|
statSync as statSync8,
|
|
436987
437201
|
unlinkSync as unlinkSync8,
|
|
436988
437202
|
writeSync
|
|
@@ -437179,7 +437393,7 @@ function imageToHalfBlockArt(filePath, opts) {
|
|
|
437179
437393
|
return null;
|
|
437180
437394
|
let png;
|
|
437181
437395
|
try {
|
|
437182
|
-
const data =
|
|
437396
|
+
const data = readFileSync22(filePath);
|
|
437183
437397
|
png = decodePng(data);
|
|
437184
437398
|
} catch {
|
|
437185
437399
|
return null;
|
|
@@ -437307,7 +437521,7 @@ function getPngDimensions(data) {
|
|
|
437307
437521
|
}
|
|
437308
437522
|
function safeUnlink(path) {
|
|
437309
437523
|
try {
|
|
437310
|
-
if (
|
|
437524
|
+
if (existsSync41(path))
|
|
437311
437525
|
unlinkSync8(path);
|
|
437312
437526
|
} catch {}
|
|
437313
437527
|
}
|
|
@@ -437486,18 +437700,18 @@ var init_tool_progress = __esm(() => {
|
|
|
437486
437700
|
// src/core/tools/show-image.ts
|
|
437487
437701
|
import { spawn as spawn15, spawnSync as spawnSync7 } from "child_process";
|
|
437488
437702
|
import {
|
|
437489
|
-
existsSync as
|
|
437703
|
+
existsSync as existsSync42,
|
|
437490
437704
|
readdirSync as readdirSync10,
|
|
437491
|
-
readFileSync as
|
|
437705
|
+
readFileSync as readFileSync23,
|
|
437492
437706
|
statSync as statSync9,
|
|
437493
437707
|
unlinkSync as unlinkSync9,
|
|
437494
|
-
writeFileSync as
|
|
437708
|
+
writeFileSync as writeFileSync18
|
|
437495
437709
|
} from "fs";
|
|
437496
437710
|
import { tmpdir as tmpdir4 } from "os";
|
|
437497
437711
|
import { basename as basename7, extname as extname7, resolve as resolve34 } from "path";
|
|
437498
437712
|
function safeUnlink2(path) {
|
|
437499
437713
|
try {
|
|
437500
|
-
if (
|
|
437714
|
+
if (existsSync42(path))
|
|
437501
437715
|
unlinkSync9(path);
|
|
437502
437716
|
} catch {}
|
|
437503
437717
|
}
|
|
@@ -437506,7 +437720,7 @@ async function convertToPng(data, ext, signal) {
|
|
|
437506
437720
|
const srcPath = resolve34(tmpdir4(), `${id}${ext}`);
|
|
437507
437721
|
const dstPath = resolve34(tmpdir4(), `${id}.png`);
|
|
437508
437722
|
try {
|
|
437509
|
-
|
|
437723
|
+
writeFileSync18(srcPath, data);
|
|
437510
437724
|
const converters = [
|
|
437511
437725
|
["ffmpeg", ["-y", "-i", srcPath, "-frames:v", "1", dstPath]],
|
|
437512
437726
|
["sips", ["-s", "format", "png", srcPath, "--out", dstPath]],
|
|
@@ -437516,8 +437730,8 @@ async function convertToPng(data, ext, signal) {
|
|
|
437516
437730
|
for (const [cmd, cmdArgs] of converters) {
|
|
437517
437731
|
try {
|
|
437518
437732
|
const result = await spawnAsync(cmd, cmdArgs, { timeout: 1e4, signal });
|
|
437519
|
-
if (result.code === 0 &&
|
|
437520
|
-
return
|
|
437733
|
+
if (result.code === 0 && existsSync42(dstPath))
|
|
437734
|
+
return readFileSync23(dstPath);
|
|
437521
437735
|
} catch {}
|
|
437522
437736
|
}
|
|
437523
437737
|
return null;
|
|
@@ -437592,7 +437806,7 @@ async function resizeImageToTarget(data, name39, targetBytes, signal) {
|
|
|
437592
437806
|
const srcPath = resolve34(tmpdir4(), `${id}${ext}`);
|
|
437593
437807
|
const dstPath = resolve34(tmpdir4(), `${id}-resized${ext}`);
|
|
437594
437808
|
try {
|
|
437595
|
-
|
|
437809
|
+
writeFileSync18(srcPath, data);
|
|
437596
437810
|
const scales = [0.9, 0.8, 0.7, 0.6, 0.5];
|
|
437597
437811
|
if (hasFfmpeg()) {
|
|
437598
437812
|
for (const scale of scales) {
|
|
@@ -437606,8 +437820,8 @@ async function resizeImageToTarget(data, name39, targetBytes, signal) {
|
|
|
437606
437820
|
"2",
|
|
437607
437821
|
dstPath
|
|
437608
437822
|
], { timeout: 30000, signal });
|
|
437609
|
-
if (result.code === 0 &&
|
|
437610
|
-
const resized =
|
|
437823
|
+
if (result.code === 0 && existsSync42(dstPath)) {
|
|
437824
|
+
const resized = readFileSync23(dstPath);
|
|
437611
437825
|
if (resized.length > 0 && resized.length <= targetBytes)
|
|
437612
437826
|
return resized;
|
|
437613
437827
|
}
|
|
@@ -437623,8 +437837,8 @@ async function resizeImageToTarget(data, name39, targetBytes, signal) {
|
|
|
437623
437837
|
for (const scale of scales) {
|
|
437624
437838
|
const targetWidth = Math.round(origWidth * scale);
|
|
437625
437839
|
const result = await spawnAsync("sips", ["--resampleWidth", String(targetWidth), srcPath, "--out", dstPath], { timeout: 30000, signal });
|
|
437626
|
-
if (result.code === 0 &&
|
|
437627
|
-
const resized =
|
|
437840
|
+
if (result.code === 0 && existsSync42(dstPath)) {
|
|
437841
|
+
const resized = readFileSync23(dstPath);
|
|
437628
437842
|
if (resized.length > 0 && resized.length <= targetBytes)
|
|
437629
437843
|
return resized;
|
|
437630
437844
|
}
|
|
@@ -437721,7 +437935,7 @@ async function videoToGif(videoPath, toolCallId, maxDuration = MAX_GIF_DURATION,
|
|
|
437721
437935
|
"1",
|
|
437722
437936
|
palettePath
|
|
437723
437937
|
], { timeout: 60000, signal });
|
|
437724
|
-
if (pass1.code !== 0 || !
|
|
437938
|
+
if (pass1.code !== 0 || !existsSync42(palettePath))
|
|
437725
437939
|
return null;
|
|
437726
437940
|
progress(toolCallId, "FFMPEG", `${msg}\u2026 (encoding)`);
|
|
437727
437941
|
const pass2 = await spawnAsync("ffmpeg", [
|
|
@@ -437748,8 +437962,8 @@ async function videoToGif(videoPath, toolCallId, maxDuration = MAX_GIF_DURATION,
|
|
|
437748
437962
|
});
|
|
437749
437963
|
if (pass2.code !== 0)
|
|
437750
437964
|
return null;
|
|
437751
|
-
if (
|
|
437752
|
-
const data =
|
|
437965
|
+
if (existsSync42(gifPath)) {
|
|
437966
|
+
const data = readFileSync23(gifPath);
|
|
437753
437967
|
if (data.length > 0 && data.length <= MAX_IMAGE_SIZE2)
|
|
437754
437968
|
return data;
|
|
437755
437969
|
}
|
|
@@ -437769,8 +437983,8 @@ async function videoToFrame(videoPath, toolCallId, signal) {
|
|
|
437769
437983
|
try {
|
|
437770
437984
|
progress(toolCallId, "FFMPEG", "Extracting frame\u2026");
|
|
437771
437985
|
const result = await spawnAsync("ffmpeg", ["-y", "-i", videoPath, "-frames:v", "1", "-q:v", "2", framePath], { timeout: 15000, signal });
|
|
437772
|
-
if (result.code === 0 &&
|
|
437773
|
-
const data =
|
|
437986
|
+
if (result.code === 0 && existsSync42(framePath)) {
|
|
437987
|
+
const data = readFileSync23(framePath);
|
|
437774
437988
|
if (data.length > 0 && data.length <= MAX_IMAGE_SIZE2)
|
|
437775
437989
|
return data;
|
|
437776
437990
|
}
|
|
@@ -437814,7 +438028,7 @@ ${INSTALL_FFMPEG}` };
|
|
|
437814
438028
|
error: `Video too large (${String(Math.round(buf.length / 1024 / 1024))}MB). Max: 20MB.`
|
|
437815
438029
|
};
|
|
437816
438030
|
}
|
|
437817
|
-
|
|
438031
|
+
writeFileSync18(videoPath, buf);
|
|
437818
438032
|
return await convertLocalVideo(videoPath, urlName, toolCallId, signal);
|
|
437819
438033
|
} catch (e) {
|
|
437820
438034
|
return { error: `Fetch failed: ${e instanceof Error ? e.message : String(e)}` };
|
|
@@ -437866,7 +438080,7 @@ ${INSTALL_YTDLP}`
|
|
|
437866
438080
|
videoPath,
|
|
437867
438081
|
url2
|
|
437868
438082
|
], { timeout: 120000, signal, onStderr });
|
|
437869
|
-
if (dlResult.code !== 0 || !
|
|
438083
|
+
if (dlResult.code !== 0 || !existsSync42(videoPath)) {
|
|
437870
438084
|
safeUnlink2(videoPath);
|
|
437871
438085
|
progress(toolCallId, "YT-DL", `${dlMsg}\u2026 (retrying lowest quality)`);
|
|
437872
438086
|
dlResult = await spawnAsync("yt-dlp", ["-f", "worst", "-o", videoPath, url2], {
|
|
@@ -437875,7 +438089,7 @@ ${INSTALL_YTDLP}`
|
|
|
437875
438089
|
onStderr
|
|
437876
438090
|
});
|
|
437877
438091
|
}
|
|
437878
|
-
if (dlResult.code === 0 &&
|
|
438092
|
+
if (dlResult.code === 0 && existsSync42(videoPath)) {
|
|
437879
438093
|
if (supportsKittyAnimation()) {
|
|
437880
438094
|
for (let attempt = 0;attempt < 2; attempt++) {
|
|
437881
438095
|
const gif = await videoToGif(videoPath, toolCallId, MAX_GIF_DURATION, signal);
|
|
@@ -437904,8 +438118,8 @@ ${INSTALL_YTDLP}`
|
|
|
437904
438118
|
], { timeout: 30000, signal });
|
|
437905
438119
|
const thumbFile = `${thumbBase}.png`;
|
|
437906
438120
|
cleanupFiles.push(thumbFile);
|
|
437907
|
-
if (thumbResult.code === 0 &&
|
|
437908
|
-
const data =
|
|
438121
|
+
if (thumbResult.code === 0 && existsSync42(thumbFile)) {
|
|
438122
|
+
const data = readFileSync23(thumbFile);
|
|
437909
438123
|
if (data.length > 0 && data.length <= MAX_IMAGE_SIZE2) {
|
|
437910
438124
|
const suffix = hasFfmpeg() ? " (video download failed, showing thumbnail)" : " (install ffmpeg for animated GIF)";
|
|
437911
438125
|
return { data, name: `${urlName}-thumbnail.png${suffix}`, isGif: false };
|
|
@@ -437959,7 +438173,7 @@ async function extractGifFrames(data, signal, maxWidth = GIF_FRAME_MAX_WIDTH) {
|
|
|
437959
438173
|
const srcPath = resolve34(tmpdir4(), `${id}.gif`);
|
|
437960
438174
|
const outPattern = resolve34(tmpdir4(), `${id}-frame-%04d.png`);
|
|
437961
438175
|
try {
|
|
437962
|
-
|
|
438176
|
+
writeFileSync18(srcPath, data);
|
|
437963
438177
|
const delays = parseGifDelays(data);
|
|
437964
438178
|
let extracted = false;
|
|
437965
438179
|
try {
|
|
@@ -437995,7 +438209,7 @@ async function extractGifFrames(data, signal, maxWidth = GIF_FRAME_MAX_WIDTH) {
|
|
|
437995
438209
|
return null;
|
|
437996
438210
|
const frames = [];
|
|
437997
438211
|
for (const file2 of frameFiles) {
|
|
437998
|
-
const png =
|
|
438212
|
+
const png = readFileSync23(file2);
|
|
437999
438213
|
frames.push({ png, delay: delays[frames.length] ?? 100 });
|
|
438000
438214
|
}
|
|
438001
438215
|
return frames.length > 0 ? frames : null;
|
|
@@ -438128,7 +438342,7 @@ async function showImage(args2, cwd2, toolCallId, signal) {
|
|
|
438128
438342
|
};
|
|
438129
438343
|
}
|
|
438130
438344
|
try {
|
|
438131
|
-
data =
|
|
438345
|
+
data = readFileSync23(filePath);
|
|
438132
438346
|
if (data.length > MAX_IMAGE_SIZE2) {
|
|
438133
438347
|
const resized = await resizeImageToTarget(data, args2.path, TARGET_IMAGE_SIZE, signal);
|
|
438134
438348
|
if (resized) {
|
|
@@ -438240,12 +438454,12 @@ async function restoreSessionImages(messages, cwd2) {
|
|
|
438240
438454
|
name39 = result.name;
|
|
438241
438455
|
} else {
|
|
438242
438456
|
const filePath = resolve34(cwd2, path);
|
|
438243
|
-
if (!
|
|
438457
|
+
if (!existsSync42(filePath))
|
|
438244
438458
|
continue;
|
|
438245
438459
|
const stat5 = statSync9(filePath);
|
|
438246
438460
|
if (!stat5.isFile() || stat5.size > MAX_IMAGE_SIZE2)
|
|
438247
438461
|
continue;
|
|
438248
|
-
data =
|
|
438462
|
+
data = readFileSync23(filePath);
|
|
438249
438463
|
name39 = path;
|
|
438250
438464
|
}
|
|
438251
438465
|
if (!data)
|
|
@@ -438332,9 +438546,9 @@ var init_show_image = __esm(() => {
|
|
|
438332
438546
|
});
|
|
438333
438547
|
|
|
438334
438548
|
// src/core/skills/manager.ts
|
|
438335
|
-
import { existsSync as
|
|
438549
|
+
import { existsSync as existsSync43, readdirSync as readdirSync11, readFileSync as readFileSync24, realpathSync as realpathSync4, rmSync as rmSync6, statSync as statSync10 } from "fs";
|
|
438336
438550
|
import { homedir as homedir13 } from "os";
|
|
438337
|
-
import { dirname as dirname22, join as
|
|
438551
|
+
import { dirname as dirname22, join as join47 } from "path";
|
|
438338
438552
|
async function searchSkills(query2) {
|
|
438339
438553
|
const url2 = `https://skills.sh/api/search?q=${encodeURIComponent(query2)}`;
|
|
438340
438554
|
const res = await fetch(url2);
|
|
@@ -438403,12 +438617,12 @@ function listInstalledSkills() {
|
|
|
438403
438617
|
const byName = new Map;
|
|
438404
438618
|
const seenPaths = new Set;
|
|
438405
438619
|
const dirs = [
|
|
438406
|
-
{ path:
|
|
438407
|
-
{ path:
|
|
438408
|
-
{ path:
|
|
438409
|
-
{ path:
|
|
438410
|
-
{ path:
|
|
438411
|
-
{ path:
|
|
438620
|
+
{ path: join47(homedir13(), ".soulforge", "skills"), scope: "global" },
|
|
438621
|
+
{ path: join47(homedir13(), ".agents", "skills"), scope: "global" },
|
|
438622
|
+
{ path: join47(homedir13(), ".claude", "skills"), scope: "global" },
|
|
438623
|
+
{ path: join47(getCwd(), ".soulforge", "skills"), scope: "project" },
|
|
438624
|
+
{ path: join47(getCwd(), ".agents", "skills"), scope: "project" },
|
|
438625
|
+
{ path: join47(getCwd(), ".claude", "skills"), scope: "project" }
|
|
438412
438626
|
];
|
|
438413
438627
|
for (const dir of dirs) {
|
|
438414
438628
|
try {
|
|
@@ -438422,15 +438636,15 @@ function scanSkillDir(dir, scope, byName, seenPaths) {
|
|
|
438422
438636
|
for (const entry of entries2) {
|
|
438423
438637
|
if (entry.name.startsWith("."))
|
|
438424
438638
|
continue;
|
|
438425
|
-
const full =
|
|
438639
|
+
const full = join47(dir, entry.name);
|
|
438426
438640
|
const isDir = entry.isDirectory() || entry.isSymbolicLink() && isDirectorySafe(full);
|
|
438427
438641
|
if (isDir) {
|
|
438428
438642
|
try {
|
|
438429
|
-
const skillPath =
|
|
438643
|
+
const skillPath = join47(full, "SKILL.md");
|
|
438430
438644
|
const resolved = realpathSync4(skillPath);
|
|
438431
438645
|
if (seenPaths.has(resolved))
|
|
438432
438646
|
continue;
|
|
438433
|
-
|
|
438647
|
+
readFileSync24(skillPath, "utf-8");
|
|
438434
438648
|
seenPaths.add(resolved);
|
|
438435
438649
|
byName.set(entry.name, { name: entry.name, path: skillPath, scope });
|
|
438436
438650
|
} catch {}
|
|
@@ -438452,12 +438666,12 @@ function isDirectorySafe(path) {
|
|
|
438452
438666
|
}
|
|
438453
438667
|
}
|
|
438454
438668
|
function loadSkill(path) {
|
|
438455
|
-
return
|
|
438669
|
+
return readFileSync24(path, "utf-8");
|
|
438456
438670
|
}
|
|
438457
438671
|
function removeInstalledSkill(skill) {
|
|
438458
438672
|
try {
|
|
438459
438673
|
const dir = dirname22(skill.path);
|
|
438460
|
-
if (
|
|
438674
|
+
if (existsSync43(dir)) {
|
|
438461
438675
|
rmSync6(dir, { recursive: true });
|
|
438462
438676
|
return true;
|
|
438463
438677
|
}
|
|
@@ -439735,7 +439949,7 @@ ${enriched}`
|
|
|
439735
439949
|
|
|
439736
439950
|
// src/core/tools/soul-grep.ts
|
|
439737
439951
|
import { spawn as spawn17 } from "child_process";
|
|
439738
|
-
import { existsSync as
|
|
439952
|
+
import { existsSync as existsSync44 } from "fs";
|
|
439739
439953
|
function resolveDepSearch(dep, explicitPath) {
|
|
439740
439954
|
const noIgnoreFollow = ["--no-ignore", "--follow"];
|
|
439741
439955
|
if (explicitPath) {
|
|
@@ -439747,7 +439961,7 @@ function resolveDepSearch(dep, explicitPath) {
|
|
|
439747
439961
|
const FLAT_ROOTS = ["node_modules", "vendor", "bower_components"];
|
|
439748
439962
|
for (const root of FLAT_ROOTS) {
|
|
439749
439963
|
const candidate = `${root}/${dep}`;
|
|
439750
|
-
if (
|
|
439964
|
+
if (existsSync44(candidate)) {
|
|
439751
439965
|
return { searchPath: candidate, extraArgs: noIgnoreFollow, resolved: true, dep };
|
|
439752
439966
|
}
|
|
439753
439967
|
}
|
|
@@ -439959,7 +440173,7 @@ var init_soul_grep = __esm(() => {
|
|
|
439959
440173
|
|
|
439960
440174
|
// src/core/tools/soul-impact.ts
|
|
439961
440175
|
import { readFile as readFile19 } from "fs/promises";
|
|
439962
|
-
import { join as
|
|
440176
|
+
import { join as join48, relative as relative13 } from "path";
|
|
439963
440177
|
async function showDependents(repoMap, relPath) {
|
|
439964
440178
|
const dependents = await repoMap.getFileDependents(relPath);
|
|
439965
440179
|
if (dependents.length === 0) {
|
|
@@ -440058,7 +440272,7 @@ async function grepDependents(cwd2, relPath) {
|
|
|
440058
440272
|
try {
|
|
440059
440273
|
const out2 = await execFileAsync("rg", ["-l", "--glob=!node_modules", "--glob=!.git", "--max-count=1", escaped, "."], { cwd: cwd2, timeout: 1e4, maxBuffer: 512000 });
|
|
440060
440274
|
const files = out2.split(`
|
|
440061
|
-
`).filter(Boolean).map((f) => f.replace(/^\.\//, "")).filter((f) => f !== relPath && isForbidden(
|
|
440275
|
+
`).filter(Boolean).map((f) => f.replace(/^\.\//, "")).filter((f) => f !== relPath && isForbidden(join48(cwd2, f)) === null);
|
|
440062
440276
|
if (files.length === 0) {
|
|
440063
440277
|
return {
|
|
440064
440278
|
success: true,
|
|
@@ -440079,7 +440293,7 @@ ${files.map((f) => ` ${f}`).join(`
|
|
|
440079
440293
|
}
|
|
440080
440294
|
}
|
|
440081
440295
|
async function grepDependencies(cwd2, relPath) {
|
|
440082
|
-
const absPath =
|
|
440296
|
+
const absPath = join48(cwd2, relPath);
|
|
440083
440297
|
try {
|
|
440084
440298
|
const content = await readFile19(absPath, "utf-8");
|
|
440085
440299
|
const importRe = /(?:import|from|require)\s*[(\s]['"`]([^'"`]+)['"`]/g;
|
|
@@ -440334,23 +440548,23 @@ var init_soul_query = __esm(() => {
|
|
|
440334
440548
|
|
|
440335
440549
|
// src/core/tools/structural-edit.ts
|
|
440336
440550
|
import { spawn as spawn18 } from "child_process";
|
|
440337
|
-
import { existsSync as
|
|
440338
|
-
import { extname as extname9, join as
|
|
440551
|
+
import { existsSync as existsSync45 } from "fs";
|
|
440552
|
+
import { extname as extname9, join as join49, resolve as resolve37 } from "path";
|
|
440339
440553
|
function resolveAstGrep(cwd2) {
|
|
440340
440554
|
const vendored = getVendoredPath("ast-grep");
|
|
440341
440555
|
if (vendored)
|
|
440342
440556
|
return vendored;
|
|
440343
|
-
const binDir =
|
|
440557
|
+
const binDir = join49(cwd2, "node_modules", ".bin");
|
|
440344
440558
|
const localCandidates = IS_WIN ? ["ast-grep.cmd", "ast-grep.exe", "ast-grep.ps1", "ast-grep", "sg.cmd", "sg.exe", "sg"] : ["ast-grep", "sg"];
|
|
440345
440559
|
for (const name39 of localCandidates) {
|
|
440346
|
-
const candidate =
|
|
440347
|
-
if (
|
|
440560
|
+
const candidate = join49(binDir, name39);
|
|
440561
|
+
if (existsSync45(candidate))
|
|
440348
440562
|
return candidate;
|
|
440349
440563
|
}
|
|
440350
|
-
const nativeDir =
|
|
440564
|
+
const nativeDir = join49(cwd2, "node_modules", "@ast-grep", "cli");
|
|
440351
440565
|
for (const name39 of [`ast-grep${EXE2}`, `sg${EXE2}`]) {
|
|
440352
|
-
const candidate =
|
|
440353
|
-
if (
|
|
440566
|
+
const candidate = join49(nativeDir, name39);
|
|
440567
|
+
if (existsSync45(candidate))
|
|
440354
440568
|
return candidate;
|
|
440355
440569
|
}
|
|
440356
440570
|
return findOnPath("ast-grep") ?? findOnPath("sg") ?? null;
|
|
@@ -440450,7 +440664,7 @@ var init_structural_edit = __esm(() => {
|
|
|
440450
440664
|
error: "forbidden"
|
|
440451
440665
|
};
|
|
440452
440666
|
}
|
|
440453
|
-
if (!
|
|
440667
|
+
if (!existsSync45(abs)) {
|
|
440454
440668
|
return { success: false, output: `File not found: ${args2.file}`, error: "not found" };
|
|
440455
440669
|
}
|
|
440456
440670
|
const ext = extname9(abs).toLowerCase();
|
|
@@ -441655,7 +441869,7 @@ var init_bus_cache = __esm(() => {
|
|
|
441655
441869
|
|
|
441656
441870
|
// src/core/tools/interactive.ts
|
|
441657
441871
|
import { mkdir as mkdir6, writeFile as writeFile10 } from "fs/promises";
|
|
441658
|
-
import { join as
|
|
441872
|
+
import { join as join50 } from "path";
|
|
441659
441873
|
function planFileName2(sessionId) {
|
|
441660
441874
|
return sessionId ? `plan-${sessionId}.md` : "plan.md";
|
|
441661
441875
|
}
|
|
@@ -441791,11 +442005,11 @@ ${errors4.map((e) => `- ${e}`).join(`
|
|
|
441791
442005
|
lines.push(`- ${v2}`);
|
|
441792
442006
|
}
|
|
441793
442007
|
}
|
|
441794
|
-
const dir =
|
|
442008
|
+
const dir = join50(cwd2, ".soulforge", "plans");
|
|
441795
442009
|
await mkdir6(dir, { recursive: true });
|
|
441796
442010
|
const planContent = lines.join(`
|
|
441797
442011
|
`) + validationWarnings;
|
|
441798
|
-
await writeFile10(
|
|
442012
|
+
await writeFile10(join50(dir, fname), planContent);
|
|
441799
442013
|
const plan = {
|
|
441800
442014
|
title: args2.title,
|
|
441801
442015
|
depth,
|
|
@@ -443827,7 +444041,7 @@ var init_explore = __esm(() => {
|
|
|
443827
444041
|
|
|
443828
444042
|
// src/utils/image-compress.ts
|
|
443829
444043
|
import { spawn as spawn19 } from "child_process";
|
|
443830
|
-
import { existsSync as
|
|
444044
|
+
import { existsSync as existsSync46, readFileSync as readFileSync25, unlinkSync as unlinkSync10, writeFileSync as writeFileSync19 } from "fs";
|
|
443831
444045
|
import { tmpdir as tmpdir5 } from "os";
|
|
443832
444046
|
import { resolve as resolve40 } from "path";
|
|
443833
444047
|
async function compressImageForApi(data, mediaType) {
|
|
@@ -443838,13 +444052,13 @@ async function compressImageForApi(data, mediaType) {
|
|
|
443838
444052
|
const srcPath = resolve40(tmpdir5(), `${id}-src.png`);
|
|
443839
444053
|
const dstPath = resolve40(tmpdir5(), `${id}-dst.jpg`);
|
|
443840
444054
|
try {
|
|
443841
|
-
|
|
444055
|
+
writeFileSync19(srcPath, data);
|
|
443842
444056
|
const qualities = [85, 70, 50, 30];
|
|
443843
444057
|
for (const q2 of qualities) {
|
|
443844
444058
|
safeUnlink3(dstPath);
|
|
443845
444059
|
const ok2 = IS_DARWIN ? await trySips(srcPath, dstPath, q2) : await tryFfmpegOrMagick(srcPath, dstPath, q2);
|
|
443846
|
-
if (ok2 &&
|
|
443847
|
-
const compressed =
|
|
444060
|
+
if (ok2 && existsSync46(dstPath)) {
|
|
444061
|
+
const compressed = readFileSync25(dstPath);
|
|
443848
444062
|
if (compressed.length <= MAX_RAW_BYTES) {
|
|
443849
444063
|
return { data: compressed, mediaType: "image/jpeg" };
|
|
443850
444064
|
}
|
|
@@ -443852,8 +444066,8 @@ async function compressImageForApi(data, mediaType) {
|
|
|
443852
444066
|
}
|
|
443853
444067
|
safeUnlink3(dstPath);
|
|
443854
444068
|
const ok = IS_DARWIN ? await trySipsResize(srcPath, dstPath, 50, 30) : await tryFfmpegOrMagickResize(srcPath, dstPath, 50, 30);
|
|
443855
|
-
if (ok &&
|
|
443856
|
-
const compressed =
|
|
444069
|
+
if (ok && existsSync46(dstPath)) {
|
|
444070
|
+
const compressed = readFileSync25(dstPath);
|
|
443857
444071
|
if (compressed.length <= MAX_RAW_BYTES) {
|
|
443858
444072
|
return { data: compressed, mediaType: "image/jpeg" };
|
|
443859
444073
|
}
|
|
@@ -443989,7 +444203,7 @@ function spawnStdout(cmd, args2) {
|
|
|
443989
444203
|
}
|
|
443990
444204
|
function safeUnlink3(path) {
|
|
443991
444205
|
try {
|
|
443992
|
-
if (
|
|
444206
|
+
if (existsSync46(path))
|
|
443993
444207
|
unlinkSync10(path);
|
|
443994
444208
|
} catch {}
|
|
443995
444209
|
}
|
|
@@ -444001,7 +444215,7 @@ var init_image_compress = __esm(() => {
|
|
|
444001
444215
|
|
|
444002
444216
|
// src/core/agents/agent-results.ts
|
|
444003
444217
|
import { mkdir as mkdir7, readdir as readdir6, rm as rm2, writeFile as writeFile11 } from "fs/promises";
|
|
444004
|
-
import { join as
|
|
444218
|
+
import { join as join51 } from "path";
|
|
444005
444219
|
function extractFinalText(result) {
|
|
444006
444220
|
for (let i2 = result.steps.length - 1;i2 >= 0; i2--) {
|
|
444007
444221
|
const step = result.steps[i2];
|
|
@@ -444041,9 +444255,9 @@ function busFooter(filesExamined, filesEdited) {
|
|
|
444041
444255
|
`);
|
|
444042
444256
|
}
|
|
444043
444257
|
async function writeAgentContext(dispatchId, agentId, task, agentResult, findings, agentText, cwd2, tabId) {
|
|
444044
|
-
const dir = tabId ? dispatchDir(cwd2, tabId, dispatchId) :
|
|
444258
|
+
const dir = tabId ? dispatchDir(cwd2, tabId, dispatchId) : join51(cwd2, ".soulforge", "dispatch", dispatchId);
|
|
444045
444259
|
await mkdir7(dir, { recursive: true });
|
|
444046
|
-
const filePath =
|
|
444260
|
+
const filePath = join51(dir, `${agentId}.md`);
|
|
444047
444261
|
const lines = [];
|
|
444048
444262
|
lines.push(`# Agent: ${agentId} (${task.role})`);
|
|
444049
444263
|
lines.push(`Task: ${task.task.slice(0, 300)}`);
|
|
@@ -444099,19 +444313,19 @@ async function writeAgentContext(dispatchId, agentId, task, agentResult, finding
|
|
|
444099
444313
|
return filePath;
|
|
444100
444314
|
}
|
|
444101
444315
|
async function cleanupDispatchDir(cwd2, tabId, keepDispatchId) {
|
|
444102
|
-
const tabDir =
|
|
444316
|
+
const tabDir = join51(cwd2, ".soulforge", "dispatch", `tab-${tabId}`);
|
|
444103
444317
|
try {
|
|
444104
444318
|
for (const entry of await readdir6(tabDir)) {
|
|
444105
444319
|
if (entry !== keepDispatchId) {
|
|
444106
444320
|
try {
|
|
444107
|
-
await rm2(
|
|
444321
|
+
await rm2(join51(tabDir, entry), { recursive: true });
|
|
444108
444322
|
} catch {}
|
|
444109
444323
|
}
|
|
444110
444324
|
}
|
|
444111
444325
|
} catch {}
|
|
444112
444326
|
}
|
|
444113
444327
|
function dispatchDir(cwd2, tabId, dispatchId) {
|
|
444114
|
-
return
|
|
444328
|
+
return join51(cwd2, ".soulforge", "dispatch", `tab-${tabId}`, dispatchId);
|
|
444115
444329
|
}
|
|
444116
444330
|
var TRUNCATE_THRESHOLD = 4000, HEAD_CHARS = 2000, TAIL_CHARS = 1000;
|
|
444117
444331
|
var init_agent_results = () => {};
|
|
@@ -445058,10 +445272,10 @@ async function createAgent(task, models, bus, parentToolCallId) {
|
|
|
445058
445272
|
v2 && typeof v2 === "object" ? Object.keys(v2) : v2
|
|
445059
445273
|
])) : null
|
|
445060
445274
|
};
|
|
445061
|
-
import("fs").then(({ mkdirSync:
|
|
445275
|
+
import("fs").then(({ mkdirSync: mkdirSync24, writeFileSync: writeFileSync20 }) => {
|
|
445062
445276
|
const dir = `${getCwd()}/.soulforge/api-export/subagents/${task.agentId}`;
|
|
445063
|
-
|
|
445064
|
-
|
|
445277
|
+
mkdirSync24(dir, { recursive: true });
|
|
445278
|
+
writeFileSync20(`${dir}/config.json`, JSON.stringify(configData, null, 2), "utf-8");
|
|
445065
445279
|
});
|
|
445066
445280
|
}
|
|
445067
445281
|
return { agent: agent2, modelId, tier };
|
|
@@ -445171,10 +445385,10 @@ function buildSubagentTools(models) {
|
|
|
445171
445385
|
exists = true;
|
|
445172
445386
|
}
|
|
445173
445387
|
if (!exists) {
|
|
445174
|
-
const { existsSync:
|
|
445388
|
+
const { existsSync: existsSync47 } = __require("fs");
|
|
445175
445389
|
const { resolve: resolvePath, isAbsolute: isAbsolute2 } = __require("path");
|
|
445176
445390
|
const abs = isAbsolute2(norm) ? norm : resolvePath(cwd2, norm);
|
|
445177
|
-
if (
|
|
445391
|
+
if (existsSync47(abs))
|
|
445178
445392
|
exists = true;
|
|
445179
445393
|
}
|
|
445180
445394
|
if (exists) {
|
|
@@ -446060,10 +446274,10 @@ ${dump2}`);
|
|
|
446060
446274
|
};
|
|
446061
446275
|
})
|
|
446062
446276
|
};
|
|
446063
|
-
import("fs").then(({ mkdirSync:
|
|
446277
|
+
import("fs").then(({ mkdirSync: mkdirSync24, writeFileSync: writeFileSync20 }) => {
|
|
446064
446278
|
const dir = `${getCwd()}/.soulforge/api-export`;
|
|
446065
|
-
|
|
446066
|
-
|
|
446279
|
+
mkdirSync24(dir, { recursive: true });
|
|
446280
|
+
writeFileSync20(`${dir}/forge-step-${String(stepNumber).padStart(2, "0")}.json`, JSON.stringify(exportData, null, 2), "utf-8");
|
|
446067
446281
|
});
|
|
446068
446282
|
}
|
|
446069
446283
|
if (sanitized !== messages && !result.messages) {
|
|
@@ -447017,7 +447231,7 @@ var init_prompts = __esm(() => {
|
|
|
447017
447231
|
});
|
|
447018
447232
|
|
|
447019
447233
|
// src/core/workers/intelligence-client.ts
|
|
447020
|
-
import { join as
|
|
447234
|
+
import { join as join52 } from "path";
|
|
447021
447235
|
var IS_COMPILED2, IS_DIST2, IntelligenceClient;
|
|
447022
447236
|
var init_intelligence_client = __esm(() => {
|
|
447023
447237
|
init_errors();
|
|
@@ -447040,7 +447254,7 @@ var init_intelligence_client = __esm(() => {
|
|
|
447040
447254
|
onStaleSymbols = null;
|
|
447041
447255
|
static SCAN_IDLE_TIMEOUT = 600000;
|
|
447042
447256
|
constructor(cwd2) {
|
|
447043
|
-
const workerPath = IS_COMPILED2 ?
|
|
447257
|
+
const workerPath = IS_COMPILED2 ? join52(dataDir(), "workers", "intelligence.worker.js") : IS_DIST2 ? join52(import.meta.dir, "workers", "intelligence.worker.js") : join52(import.meta.dir, "intelligence.worker.ts");
|
|
447044
447258
|
super(workerPath, { cwd: cwd2 });
|
|
447045
447259
|
this._cwd = cwd2;
|
|
447046
447260
|
const ws = useWorkerStore.getState();
|
|
@@ -447510,11 +447724,11 @@ class SoulMapSnapshot {
|
|
|
447510
447724
|
var init_soul_map_snapshot = () => {};
|
|
447511
447725
|
|
|
447512
447726
|
// src/core/context/toolchain.ts
|
|
447513
|
-
import { existsSync as
|
|
447514
|
-
import { join as
|
|
447727
|
+
import { existsSync as existsSync47 } from "fs";
|
|
447728
|
+
import { join as join53 } from "path";
|
|
447515
447729
|
function detectToolchain(cwd2) {
|
|
447516
447730
|
for (const [file2, tool4] of TOOLCHAIN_MARKERS) {
|
|
447517
|
-
if (
|
|
447731
|
+
if (existsSync47(join53(cwd2, file2)))
|
|
447518
447732
|
return tool4;
|
|
447519
447733
|
}
|
|
447520
447734
|
return null;
|
|
@@ -447772,9 +447986,9 @@ __export(exports_manager2, {
|
|
|
447772
447986
|
extractConversationTerms: () => extractConversationTerms,
|
|
447773
447987
|
ContextManager: () => ContextManager
|
|
447774
447988
|
});
|
|
447775
|
-
import { existsSync as
|
|
447989
|
+
import { existsSync as existsSync48 } from "fs";
|
|
447776
447990
|
import { readFile as readFile20 } from "fs/promises";
|
|
447777
|
-
import { join as
|
|
447991
|
+
import { join as join54 } from "path";
|
|
447778
447992
|
var DEFAULT_CONTEXT_WINDOW2 = 200000, ContextManager;
|
|
447779
447993
|
var init_manager6 = __esm(() => {
|
|
447780
447994
|
init_dist5();
|
|
@@ -448435,8 +448649,8 @@ ${instructions}` : banner;
|
|
|
448435
448649
|
return 0;
|
|
448436
448650
|
}
|
|
448437
448651
|
const { Database: Database7 } = await import("bun:sqlite");
|
|
448438
|
-
const { join:
|
|
448439
|
-
const dbPath =
|
|
448652
|
+
const { join: join55 } = await import("path");
|
|
448653
|
+
const dbPath = join55(this.cwd, ".soulforge", "repomap.db");
|
|
448440
448654
|
const db = new Database7(dbPath);
|
|
448441
448655
|
db.run("PRAGMA journal_mode = WAL");
|
|
448442
448656
|
db.run("PRAGMA busy_timeout = 5000");
|
|
@@ -448449,7 +448663,7 @@ ${instructions}` : banner;
|
|
|
448449
448663
|
continue;
|
|
448450
448664
|
const pathLabel = file2.path.length > 30 ? `...${file2.path.slice(-27)}` : file2.path;
|
|
448451
448665
|
store.setLspProgress(`${String(fi + 1)}/${String(files.length)}: ${pathLabel}`);
|
|
448452
|
-
const absPath =
|
|
448666
|
+
const absPath = join55(this.cwd, file2.path);
|
|
448453
448667
|
let raw;
|
|
448454
448668
|
try {
|
|
448455
448669
|
raw = await documentSymbols2(absPath);
|
|
@@ -448937,8 +449151,8 @@ ${skillBlocks}
|
|
|
448937
449151
|
let richBlockCount = 0;
|
|
448938
449152
|
const memoryMarkers = memoryMarkersForPaths(changed.slice(0, 15));
|
|
448939
449153
|
for (const file2 of changed.slice(0, 15)) {
|
|
448940
|
-
const absPath =
|
|
448941
|
-
const fileExists =
|
|
449154
|
+
const absPath = join54(this.cwd, file2);
|
|
449155
|
+
const fileExists = existsSync48(absPath);
|
|
448942
449156
|
const block = this.soulMapDiffBlocks.get(file2);
|
|
448943
449157
|
const provenance = this.classifyDeltaFile(absPath, file2, memoryMarkers.get(file2));
|
|
448944
449158
|
if (!fileExists) {
|
|
@@ -448977,7 +449191,7 @@ ${skillBlocks}
|
|
|
448977
449191
|
tags.push("[mentioned]");
|
|
448978
449192
|
if (this.editorFile === absPath)
|
|
448979
449193
|
tags.push("[open]");
|
|
448980
|
-
if (this.soulMapNewFilesEmitted.has(rel) &&
|
|
449194
|
+
if (this.soulMapNewFilesEmitted.has(rel) && existsSync48(absPath)) {
|
|
448981
449195
|
tags.push("[modified-since-new]");
|
|
448982
449196
|
}
|
|
448983
449197
|
const failure = this.recentToolFailures.find((f) => f.target === absPath || f.target === rel);
|
|
@@ -449080,7 +449294,7 @@ ${skillBlocks}
|
|
|
449080
449294
|
];
|
|
449081
449295
|
for (const check2 of checks3) {
|
|
449082
449296
|
try {
|
|
449083
|
-
await readFile20(
|
|
449297
|
+
await readFile20(join54(this.cwd, check2.file), "utf-8");
|
|
449084
449298
|
const toolchain = this.detectToolchain();
|
|
449085
449299
|
const profileStr = this.buildProfileString();
|
|
449086
449300
|
const info2 = `${check2.label}${toolchain ? ` \xB7 Toolchain: ${toolchain}` : ""}${profileStr}`;
|
|
@@ -466508,7 +466722,7 @@ var init_output = __esm(() => {
|
|
|
466508
466722
|
});
|
|
466509
466723
|
|
|
466510
466724
|
// src/headless/run.ts
|
|
466511
|
-
import { existsSync as
|
|
466725
|
+
import { existsSync as existsSync49, readFileSync as readFileSync26 } from "fs";
|
|
466512
466726
|
import { resolve as resolve41 } from "path";
|
|
466513
466727
|
function reraiseOrExit(code) {
|
|
466514
466728
|
if (code === EXIT_ABORT) {
|
|
@@ -466534,6 +466748,22 @@ async function setupAgent(opts, merged) {
|
|
|
466534
466748
|
process.exit(EXIT_ERROR);
|
|
466535
466749
|
}
|
|
466536
466750
|
const providerOpts = await buildProviderOptions(modelId, merged);
|
|
466751
|
+
try {
|
|
466752
|
+
const { sendBeacon: sendBeacon2, maybeShowTelemetryNotice: maybeShowTelemetryNotice2 } = await Promise.resolve().then(() => (init_telemetry(), exports_telemetry));
|
|
466753
|
+
const { detectModelFamily: detectModelFamily2, telemetryModelInfo: telemetryModelInfo2 } = await Promise.resolve().then(() => (init_provider_options(), exports_provider_options));
|
|
466754
|
+
const { CURRENT_VERSION: CURRENT_VERSION2, detectInstallMethod: detectInstallMethod2 } = await Promise.resolve().then(() => (init_version(), exports_version));
|
|
466755
|
+
const { saveGlobalConfig: saveGlobalConfig2 } = await Promise.resolve().then(() => (init_config2(), exports_config2));
|
|
466756
|
+
maybeShowTelemetryNotice2(merged, () => saveGlobalConfig2({ telemetryNoticeShown: true }));
|
|
466757
|
+
const info2 = telemetryModelInfo2(modelId);
|
|
466758
|
+
sendBeacon2({
|
|
466759
|
+
surface: "headless",
|
|
466760
|
+
version: CURRENT_VERSION2,
|
|
466761
|
+
install: detectInstallMethod2(),
|
|
466762
|
+
family: detectModelFamily2(modelId),
|
|
466763
|
+
provider: info2.provider,
|
|
466764
|
+
model: info2.model
|
|
466765
|
+
}, merged.telemetry);
|
|
466766
|
+
} catch {}
|
|
466537
466767
|
const repoMapDisabled = merged.repoMap === false || opts.noRepomap || process.env.SOULFORGE_NO_REPOMAP === "1";
|
|
466538
466768
|
const contextManager = await ContextManager.createAsync(cwd2, (step) => {
|
|
466539
466769
|
if (showProgress)
|
|
@@ -466839,13 +467069,13 @@ async function runPrompt(opts, merged) {
|
|
|
466839
467069
|
const fileParts = [];
|
|
466840
467070
|
for (const file2 of opts.include) {
|
|
466841
467071
|
const fullPath = resolve41(env.cwd, file2);
|
|
466842
|
-
if (!
|
|
467072
|
+
if (!existsSync49(fullPath)) {
|
|
466843
467073
|
stderrWarn(`--include file not found: ${file2}`);
|
|
466844
467074
|
continue;
|
|
466845
467075
|
}
|
|
466846
467076
|
try {
|
|
466847
467077
|
fileParts.push(`[${file2}]
|
|
466848
|
-
${
|
|
467078
|
+
${readFileSync26(fullPath, "utf-8")}`);
|
|
466849
467079
|
} catch {}
|
|
466850
467080
|
}
|
|
466851
467081
|
if (fileParts.length > 0) {
|
|
@@ -467255,7 +467485,7 @@ var init_run = __esm(() => {
|
|
|
467255
467485
|
});
|
|
467256
467486
|
|
|
467257
467487
|
// src/hearth/tab-loop.ts
|
|
467258
|
-
import { randomUUID as
|
|
467488
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
467259
467489
|
|
|
467260
467490
|
class TabLoop {
|
|
467261
467491
|
tabId;
|
|
@@ -467321,7 +467551,7 @@ class TabLoop {
|
|
|
467321
467551
|
return this.loopPromise;
|
|
467322
467552
|
}
|
|
467323
467553
|
enqueuePrompt(text3) {
|
|
467324
|
-
const id =
|
|
467554
|
+
const id = randomUUID4();
|
|
467325
467555
|
if (this.closed)
|
|
467326
467556
|
return null;
|
|
467327
467557
|
const waiter = this.waiters.shift();
|
|
@@ -467387,7 +467617,7 @@ var init_tab_loop = __esm(() => {
|
|
|
467387
467617
|
});
|
|
467388
467618
|
|
|
467389
467619
|
// src/hearth/workspace.ts
|
|
467390
|
-
import { randomUUID as
|
|
467620
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
467391
467621
|
|
|
467392
467622
|
class ChatWorkspace {
|
|
467393
467623
|
surface;
|
|
@@ -467410,7 +467640,7 @@ class ChatWorkspace {
|
|
|
467410
467640
|
this.binding = deps.binding;
|
|
467411
467641
|
this.hearthConfig = deps.hearthConfig;
|
|
467412
467642
|
this.log = deps.log ?? (() => {});
|
|
467413
|
-
this.sessionId =
|
|
467643
|
+
this.sessionId = randomUUID5();
|
|
467414
467644
|
this.buildCallbacksOverride = deps.buildCallbacks;
|
|
467415
467645
|
this.onTabEvent = deps.onTabEvent;
|
|
467416
467646
|
const globalCfg = loadConfig();
|
|
@@ -467426,7 +467656,7 @@ class ChatWorkspace {
|
|
|
467426
467656
|
if (this.tabs.size >= this.binding.maxTabs) {
|
|
467427
467657
|
throw new Error(`max tabs reached (${String(this.binding.maxTabs)})`);
|
|
467428
467658
|
}
|
|
467429
|
-
const tabId =
|
|
467659
|
+
const tabId = randomUUID5();
|
|
467430
467660
|
const tabLabel = label ?? `TAB-${String(this.tabs.size + 1)}`;
|
|
467431
467661
|
const callbacks = this.buildCallbacksOverride?.({ tabId }) ?? buildHearthCallbacks({
|
|
467432
467662
|
surface: this.surface,
|
|
@@ -467584,11 +467814,11 @@ var init_workspace = __esm(() => {
|
|
|
467584
467814
|
import {
|
|
467585
467815
|
appendFileSync as appendFileSync4,
|
|
467586
467816
|
chmodSync as chmodSync5,
|
|
467587
|
-
existsSync as
|
|
467588
|
-
mkdirSync as
|
|
467589
|
-
readFileSync as
|
|
467817
|
+
existsSync as existsSync50,
|
|
467818
|
+
mkdirSync as mkdirSync24,
|
|
467819
|
+
readFileSync as readFileSync27,
|
|
467590
467820
|
unlinkSync as unlinkSync11,
|
|
467591
|
-
writeFileSync as
|
|
467821
|
+
writeFileSync as writeFileSync20
|
|
467592
467822
|
} from "fs";
|
|
467593
467823
|
import { createServer as createServer2 } from "net";
|
|
467594
467824
|
import { dirname as dirname23 } from "path";
|
|
@@ -467664,12 +467894,18 @@ class HearthDaemon {
|
|
|
467664
467894
|
this.log(`hearth starting \u2014 socket: ${this.config.daemon.socketPath}`);
|
|
467665
467895
|
const pidPath = DEFAULT_PID_PATH;
|
|
467666
467896
|
try {
|
|
467667
|
-
|
|
467668
|
-
|
|
467897
|
+
mkdirSync24(dirname23(pidPath), { recursive: true, mode: 448 });
|
|
467898
|
+
writeFileSync20(pidPath, String(process.pid), { mode: 384 });
|
|
467669
467899
|
} catch (err2) {
|
|
467670
467900
|
this.log(`pidfile write failed: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
467671
467901
|
}
|
|
467672
467902
|
await this.startSocket();
|
|
467903
|
+
try {
|
|
467904
|
+
const { sendBeacon: sendBeacon2 } = await Promise.resolve().then(() => (init_telemetry(), exports_telemetry));
|
|
467905
|
+
const { CURRENT_VERSION: CURRENT_VERSION2, detectInstallMethod: detectInstallMethod2 } = await Promise.resolve().then(() => (init_version(), exports_version));
|
|
467906
|
+
const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config2(), exports_config2));
|
|
467907
|
+
sendBeacon2({ surface: "hearth", version: CURRENT_VERSION2, install: detectInstallMethod2() }, loadConfig2().telemetry);
|
|
467908
|
+
} catch {}
|
|
467673
467909
|
const tuiOwner = readBridgeOwner();
|
|
467674
467910
|
this.tuiOwnerPid = tuiOwner && tuiOwner !== process.pid ? tuiOwner : null;
|
|
467675
467911
|
if (this.tuiOwnerPid) {
|
|
@@ -467702,7 +467938,7 @@ class HearthDaemon {
|
|
|
467702
467938
|
await new Promise((res) => this.socketServer?.close(() => res()));
|
|
467703
467939
|
this.socketServer = null;
|
|
467704
467940
|
}
|
|
467705
|
-
if (
|
|
467941
|
+
if (existsSync50(this.config.daemon.socketPath)) {
|
|
467706
467942
|
try {
|
|
467707
467943
|
unlinkSync11(this.config.daemon.socketPath);
|
|
467708
467944
|
} catch (e) {
|
|
@@ -467842,8 +468078,8 @@ class HearthDaemon {
|
|
|
467842
468078
|
}
|
|
467843
468079
|
async startSocket() {
|
|
467844
468080
|
const path = this.config.daemon.socketPath;
|
|
467845
|
-
|
|
467846
|
-
if (
|
|
468081
|
+
mkdirSync24(dirname23(path), { recursive: true, mode: 448 });
|
|
468082
|
+
if (existsSync50(path)) {
|
|
467847
468083
|
try {
|
|
467848
468084
|
unlinkSync11(path);
|
|
467849
468085
|
} catch (e) {
|
|
@@ -468716,10 +468952,10 @@ class HearthDaemon {
|
|
|
468716
468952
|
}
|
|
468717
468953
|
restoreWorkspaces() {
|
|
468718
468954
|
const stateFile = this.config.daemon.stateFile;
|
|
468719
|
-
if (!
|
|
468955
|
+
if (!existsSync50(stateFile))
|
|
468720
468956
|
return;
|
|
468721
468957
|
try {
|
|
468722
|
-
const parsed = JSON.parse(
|
|
468958
|
+
const parsed = JSON.parse(readFileSync27(stateFile, "utf-8"));
|
|
468723
468959
|
for (const entry of parsed.workspaces ?? []) {
|
|
468724
468960
|
const surface = this.host.getSurface(entry.surfaceId);
|
|
468725
468961
|
const binding = resolveChatBinding(this.config, entry.surfaceId, entry.externalId);
|
|
@@ -468754,8 +468990,8 @@ class HearthDaemon {
|
|
|
468754
468990
|
activeTabId: ws.getActiveTabId() ?? undefined
|
|
468755
468991
|
}))
|
|
468756
468992
|
};
|
|
468757
|
-
|
|
468758
|
-
|
|
468993
|
+
mkdirSync24(dirname23(this.config.daemon.stateFile), { recursive: true, mode: 448 });
|
|
468994
|
+
writeFileSync20(this.config.daemon.stateFile, JSON.stringify(state, null, 2), { mode: 384 });
|
|
468759
468995
|
} catch (err2) {
|
|
468760
468996
|
this.log(`persist failed: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
468761
468997
|
}
|
|
@@ -468769,8 +469005,8 @@ function createFileLogger(logPath) {
|
|
|
468769
469005
|
return () => {};
|
|
468770
469006
|
try {
|
|
468771
469007
|
const dir = dirname23(logPath);
|
|
468772
|
-
if (!
|
|
468773
|
-
|
|
469008
|
+
if (!existsSync50(dir))
|
|
469009
|
+
mkdirSync24(dir, { recursive: true });
|
|
468774
469010
|
} catch {}
|
|
468775
469011
|
return (line2) => {
|
|
468776
469012
|
try {
|
|
@@ -468798,7 +469034,7 @@ __export(exports_cli, {
|
|
|
468798
469034
|
runHearthCli: () => runHearthCli,
|
|
468799
469035
|
parseHearthArgs: () => parseHearthArgs
|
|
468800
469036
|
});
|
|
468801
|
-
import { existsSync as
|
|
469037
|
+
import { existsSync as existsSync51 } from "fs";
|
|
468802
469038
|
function parseHearthArgs(argv) {
|
|
468803
469039
|
const [sub, ...rest] = argv;
|
|
468804
469040
|
if (!sub || sub === "help" || sub === "--help" || sub === "-h")
|
|
@@ -468903,7 +469139,7 @@ async function runStart(detach) {
|
|
|
468903
469139
|
async function runStop() {
|
|
468904
469140
|
const config2 = loadHearthConfig();
|
|
468905
469141
|
const sock = config2.daemon.socketPath;
|
|
468906
|
-
if (!
|
|
469142
|
+
if (!existsSync51(sock)) {
|
|
468907
469143
|
process.stderr.write(`daemon not running
|
|
468908
469144
|
`);
|
|
468909
469145
|
return 1;
|
|
@@ -469024,7 +469260,7 @@ async function runDoctor() {
|
|
|
469024
469260
|
lines.push(` chats: ${String(chats)} paired`);
|
|
469025
469261
|
}
|
|
469026
469262
|
lines.push("");
|
|
469027
|
-
lines.push(`daemon: ${
|
|
469263
|
+
lines.push(`daemon: ${existsSync51(config2.daemon.socketPath) ? "socket present" : "socket absent"}`);
|
|
469028
469264
|
const testToken = `bot123456:ABC-${"x".repeat(40)}`;
|
|
469029
469265
|
const { redact: redact2 } = await Promise.resolve().then(() => (init_redact(), exports_redact));
|
|
469030
469266
|
const scrubbed = redact2(testToken);
|
|
@@ -469037,7 +469273,7 @@ async function runDoctor() {
|
|
|
469037
469273
|
async function runLogs(follow) {
|
|
469038
469274
|
const config2 = loadHearthConfig();
|
|
469039
469275
|
const path = config2.daemon.logFile;
|
|
469040
|
-
if (!
|
|
469276
|
+
if (!existsSync51(path)) {
|
|
469041
469277
|
process.stderr.write(`log file missing: ${path}
|
|
469042
469278
|
`);
|
|
469043
469279
|
return 1;
|
|
@@ -469083,8 +469319,8 @@ var init_cli = __esm(() => {
|
|
|
469083
469319
|
|
|
469084
469320
|
// src/hearth/approve-cli.ts
|
|
469085
469321
|
var exports_approve_cli = {};
|
|
469086
|
-
import { existsSync as
|
|
469087
|
-
import { join as
|
|
469322
|
+
import { existsSync as existsSync52, readFileSync as readFileSync28 } from "fs";
|
|
469323
|
+
import { join as join55, resolve as resolvePath } from "path";
|
|
469088
469324
|
function expandHome3(p2) {
|
|
469089
469325
|
return expandHome(p2);
|
|
469090
469326
|
}
|
|
@@ -469102,22 +469338,22 @@ function matchesGlob(path, patterns) {
|
|
|
469102
469338
|
}
|
|
469103
469339
|
function readStdinSync() {
|
|
469104
469340
|
try {
|
|
469105
|
-
return
|
|
469341
|
+
return readFileSync28(0, "utf-8");
|
|
469106
469342
|
} catch {
|
|
469107
469343
|
return "";
|
|
469108
469344
|
}
|
|
469109
469345
|
}
|
|
469110
469346
|
function getSocketPath() {
|
|
469111
|
-
return process.env.SOULFORGE_HEARTH_SOCKET ??
|
|
469347
|
+
return process.env.SOULFORGE_HEARTH_SOCKET ?? join55(configDir(), "hearth.sock");
|
|
469112
469348
|
}
|
|
469113
469349
|
function loadExtraDenylist(cwd2) {
|
|
469114
|
-
const paths = [
|
|
469350
|
+
const paths = [join55(configDir(), "hearth.json"), join55(cwd2, ".soulforge", "hearth.json")];
|
|
469115
469351
|
const extras = new Set;
|
|
469116
469352
|
for (const p2 of paths) {
|
|
469117
|
-
if (!
|
|
469353
|
+
if (!existsSync52(p2))
|
|
469118
469354
|
continue;
|
|
469119
469355
|
try {
|
|
469120
|
-
const parsed = JSON.parse(
|
|
469356
|
+
const parsed = JSON.parse(readFileSync28(p2, "utf-8"));
|
|
469121
469357
|
for (const glob of parsed.defaults?.readDenylistExtra ?? [])
|
|
469122
469358
|
extras.add(glob);
|
|
469123
469359
|
for (const surface of Object.values(parsed.surfaces ?? {})) {
|
|
@@ -469236,7 +469472,7 @@ async function runDenyRead(hook) {
|
|
|
469236
469472
|
}
|
|
469237
469473
|
async function runHealth() {
|
|
469238
469474
|
const sock = getSocketPath();
|
|
469239
|
-
if (!
|
|
469475
|
+
if (!existsSync52(sock)) {
|
|
469240
469476
|
process.stderr.write(`socket missing: ${sock}
|
|
469241
469477
|
`);
|
|
469242
469478
|
return 1;
|
|
@@ -469672,32 +469908,32 @@ var init_headless = __esm(() => {
|
|
|
469672
469908
|
});
|
|
469673
469909
|
|
|
469674
469910
|
// src/core/presets/registry.ts
|
|
469675
|
-
import { existsSync as
|
|
469676
|
-
import { join as
|
|
469911
|
+
import { existsSync as existsSync53, mkdirSync as mkdirSync25, readFileSync as readFileSync29, statSync as statSync11, writeFileSync as writeFileSync21 } from "fs";
|
|
469912
|
+
import { join as join56 } from "path";
|
|
469677
469913
|
function getCacheDirInternal() {
|
|
469678
|
-
return
|
|
469914
|
+
return join56(configDir(), "presets");
|
|
469679
469915
|
}
|
|
469680
469916
|
function getRegistryCacheFile() {
|
|
469681
|
-
return
|
|
469917
|
+
return join56(getCacheDirInternal(), "registry.json");
|
|
469682
469918
|
}
|
|
469683
469919
|
function ensureCacheDir() {
|
|
469684
469920
|
const dir = getCacheDirInternal();
|
|
469685
|
-
if (!
|
|
469686
|
-
|
|
469921
|
+
if (!existsSync53(dir))
|
|
469922
|
+
mkdirSync25(dir, { recursive: true, mode: 448 });
|
|
469687
469923
|
}
|
|
469688
469924
|
function readCachedRegistry() {
|
|
469689
469925
|
const file2 = getRegistryCacheFile();
|
|
469690
|
-
if (!
|
|
469926
|
+
if (!existsSync53(file2))
|
|
469691
469927
|
return null;
|
|
469692
469928
|
try {
|
|
469693
|
-
return JSON.parse(
|
|
469929
|
+
return JSON.parse(readFileSync29(file2, "utf-8"));
|
|
469694
469930
|
} catch {
|
|
469695
469931
|
return null;
|
|
469696
469932
|
}
|
|
469697
469933
|
}
|
|
469698
469934
|
function cacheAge() {
|
|
469699
469935
|
const file2 = getRegistryCacheFile();
|
|
469700
|
-
if (!
|
|
469936
|
+
if (!existsSync53(file2))
|
|
469701
469937
|
return Number.POSITIVE_INFINITY;
|
|
469702
469938
|
try {
|
|
469703
469939
|
return Date.now() - statSync11(file2).mtimeMs;
|
|
@@ -469736,7 +469972,7 @@ async function fetchRegistry(force = false) {
|
|
|
469736
469972
|
throw new Error(`Registry too large (${text3.length} bytes, max ${MAX_REGISTRY_BYTES})`);
|
|
469737
469973
|
}
|
|
469738
469974
|
const parsed = validateRegistry(JSON.parse(text3), REGISTRY_URL);
|
|
469739
|
-
|
|
469975
|
+
writeFileSync21(getRegistryCacheFile(), text3);
|
|
469740
469976
|
return parsed;
|
|
469741
469977
|
} catch (err2) {
|
|
469742
469978
|
const cached3 = readCachedRegistry();
|
|
@@ -469761,8 +469997,8 @@ var init_registry2 = __esm(() => {
|
|
|
469761
469997
|
});
|
|
469762
469998
|
|
|
469763
469999
|
// src/core/presets/loader.ts
|
|
469764
|
-
import { existsSync as
|
|
469765
|
-
import { isAbsolute as isAbsolute2, join as
|
|
470000
|
+
import { existsSync as existsSync54, lstatSync as lstatSync2, readFileSync as readFileSync30, writeFileSync as writeFileSync22 } from "fs";
|
|
470001
|
+
import { isAbsolute as isAbsolute2, join as join57, resolve as resolve42 } from "path";
|
|
469766
470002
|
function isUrl3(s2) {
|
|
469767
470003
|
return /^https?:\/\//i.test(s2);
|
|
469768
470004
|
}
|
|
@@ -469794,7 +470030,7 @@ function validatePreset(raw2, origin) {
|
|
|
469794
470030
|
return parsed.data;
|
|
469795
470031
|
}
|
|
469796
470032
|
function cacheFile(name39, version2) {
|
|
469797
|
-
return
|
|
470033
|
+
return join57(getCacheDir(), `${name39}@${version2}.json`);
|
|
469798
470034
|
}
|
|
469799
470035
|
async function fetchPresetFromUrl(url2) {
|
|
469800
470036
|
if (!/^https:\/\//i.test(url2)) {
|
|
@@ -469817,7 +470053,7 @@ async function fetchPresetFromUrl(url2) {
|
|
|
469817
470053
|
const parsed = JSON.parse(text3);
|
|
469818
470054
|
const validated = validatePreset(parsed, url2);
|
|
469819
470055
|
try {
|
|
469820
|
-
|
|
470056
|
+
writeFileSync22(cacheFile(validated.name, validated.version), text3);
|
|
469821
470057
|
} catch {}
|
|
469822
470058
|
return validated;
|
|
469823
470059
|
} finally {
|
|
@@ -469827,7 +470063,7 @@ async function fetchPresetFromUrl(url2) {
|
|
|
469827
470063
|
function resolveLocalPath(spec3) {
|
|
469828
470064
|
const expanded = expandHome(spec3);
|
|
469829
470065
|
const abs = resolve42(expanded);
|
|
469830
|
-
if (!
|
|
470066
|
+
if (!existsSync54(abs))
|
|
469831
470067
|
throw new Error(`Preset file not found: ${abs}`);
|
|
469832
470068
|
const stat5 = lstatSync2(abs);
|
|
469833
470069
|
if (stat5.isSymbolicLink()) {
|
|
@@ -469846,7 +470082,7 @@ async function resolvePreset(spec3) {
|
|
|
469846
470082
|
}
|
|
469847
470083
|
if (looksLikePath(spec3) || spec3.endsWith(".json")) {
|
|
469848
470084
|
const abs = resolveLocalPath(spec3);
|
|
469849
|
-
const raw2 = JSON.parse(
|
|
470085
|
+
const raw2 = JSON.parse(readFileSync30(abs, "utf-8"));
|
|
469850
470086
|
return { preset: validatePreset(raw2, abs), source: "path", origin: abs };
|
|
469851
470087
|
}
|
|
469852
470088
|
const registry2 = await fetchRegistry();
|
|
@@ -469951,10 +470187,10 @@ var init_merge2 = __esm(() => {
|
|
|
469951
470187
|
});
|
|
469952
470188
|
|
|
469953
470189
|
// src/core/presets/init.ts
|
|
469954
|
-
import { existsSync as
|
|
469955
|
-
import { join as
|
|
470190
|
+
import { existsSync as existsSync55, readFileSync as readFileSync31 } from "fs";
|
|
470191
|
+
import { join as join58 } from "path";
|
|
469956
470192
|
function getGlobalConfigFile() {
|
|
469957
|
-
return
|
|
470193
|
+
return join58(configDir(), "config.json");
|
|
469958
470194
|
}
|
|
469959
470195
|
function isValidPresetSpec(spec3) {
|
|
469960
470196
|
if (spec3.length < 2)
|
|
@@ -469962,10 +470198,10 @@ function isValidPresetSpec(spec3) {
|
|
|
469962
470198
|
return VALID_SPEC.test(spec3);
|
|
469963
470199
|
}
|
|
469964
470200
|
function readPresetSpecs(file2) {
|
|
469965
|
-
if (!
|
|
470201
|
+
if (!existsSync55(file2))
|
|
469966
470202
|
return [];
|
|
469967
470203
|
try {
|
|
469968
|
-
const cfg = JSON.parse(
|
|
470204
|
+
const cfg = JSON.parse(readFileSync31(file2, "utf-8"));
|
|
469969
470205
|
if (!Array.isArray(cfg.presets))
|
|
469970
470206
|
return [];
|
|
469971
470207
|
const out2 = [];
|
|
@@ -469995,7 +470231,7 @@ function dedupe(list) {
|
|
|
469995
470231
|
}
|
|
469996
470232
|
async function initPresetsFromEnv(opts = {}) {
|
|
469997
470233
|
const cwd2 = opts.cwd ?? process.cwd();
|
|
469998
|
-
const projectFile =
|
|
470234
|
+
const projectFile = join58(cwd2, ".soulforge", "config.json");
|
|
469999
470235
|
const globalSpecs = readPresetSpecs(getGlobalConfigFile());
|
|
470000
470236
|
const projectSpecs = readPresetSpecs(projectFile);
|
|
470001
470237
|
const cliSpecs = (process.env.SOULFORGE_PRESETS ?? "").split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
@@ -470061,29 +470297,29 @@ var init_init = __esm(() => {
|
|
|
470061
470297
|
});
|
|
470062
470298
|
|
|
470063
470299
|
// src/core/presets/persist.ts
|
|
470064
|
-
import { existsSync as
|
|
470065
|
-
import { join as
|
|
470300
|
+
import { existsSync as existsSync56, mkdirSync as mkdirSync26, readFileSync as readFileSync32, writeFileSync as writeFileSync23 } from "fs";
|
|
470301
|
+
import { join as join59 } from "path";
|
|
470066
470302
|
function getGlobalDir() {
|
|
470067
470303
|
return configDir();
|
|
470068
470304
|
}
|
|
470069
470305
|
function getGlobalFile() {
|
|
470070
|
-
return
|
|
470306
|
+
return join59(getGlobalDir(), "config.json");
|
|
470071
470307
|
}
|
|
470072
470308
|
function resolveScopeFile(scope, cwd2) {
|
|
470073
470309
|
if (scope === "global") {
|
|
470074
470310
|
const dir2 = getGlobalDir();
|
|
470075
|
-
if (!
|
|
470076
|
-
|
|
470311
|
+
if (!existsSync56(dir2))
|
|
470312
|
+
mkdirSync26(dir2, { recursive: true, mode: 448 });
|
|
470077
470313
|
return getGlobalFile();
|
|
470078
470314
|
}
|
|
470079
470315
|
const dir = ensureSoulforgeDir(cwd2);
|
|
470080
|
-
return
|
|
470316
|
+
return join59(dir, "config.json");
|
|
470081
470317
|
}
|
|
470082
470318
|
function readJsonObject(file2) {
|
|
470083
|
-
if (!
|
|
470319
|
+
if (!existsSync56(file2))
|
|
470084
470320
|
return {};
|
|
470085
470321
|
try {
|
|
470086
|
-
const parsed = JSON.parse(
|
|
470322
|
+
const parsed = JSON.parse(readFileSync32(file2, "utf-8"));
|
|
470087
470323
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
470088
470324
|
} catch {
|
|
470089
470325
|
return {};
|
|
@@ -470107,7 +470343,7 @@ function appendPresets(scope, specs, cwd2 = process.cwd()) {
|
|
|
470107
470343
|
const current = Array.isArray(currentRaw) ? currentRaw.filter((s2) => typeof s2 === "string") : [];
|
|
470108
470344
|
const merged = dedupeAppend(current, specs.filter(Boolean));
|
|
470109
470345
|
existing.presets = merged;
|
|
470110
|
-
|
|
470346
|
+
writeFileSync23(file2, JSON.stringify(existing, null, 2));
|
|
470111
470347
|
return { file: file2, before: current, after: merged };
|
|
470112
470348
|
}
|
|
470113
470349
|
function removePresets(scope, specs, cwd2 = process.cwd()) {
|
|
@@ -470122,8 +470358,8 @@ function removePresets(scope, specs, cwd2 = process.cwd()) {
|
|
|
470122
470358
|
} else {
|
|
470123
470359
|
existing.presets = filtered;
|
|
470124
470360
|
}
|
|
470125
|
-
if (
|
|
470126
|
-
|
|
470361
|
+
if (existsSync56(file2)) {
|
|
470362
|
+
writeFileSync23(file2, JSON.stringify(existing, null, 2));
|
|
470127
470363
|
}
|
|
470128
470364
|
return { file: file2, before: current, after: filtered };
|
|
470129
470365
|
}
|
|
@@ -475915,7 +476151,7 @@ function buildAssistantMessage({
|
|
|
475915
476151
|
|
|
475916
476152
|
// src/hooks/useChat.ts
|
|
475917
476153
|
import { readFile as readFile21 } from "fs/promises";
|
|
475918
|
-
import { join as
|
|
476154
|
+
import { join as join60 } from "path";
|
|
475919
476155
|
function pruneOldToolResults(msgs) {
|
|
475920
476156
|
let protectedTokens = 0;
|
|
475921
476157
|
let prunableTokens = 0;
|
|
@@ -476993,7 +477229,7 @@ ${description}`,
|
|
|
476993
477229
|
if (action === "execute" || action === "clear_execute") {
|
|
476994
477230
|
let content = null;
|
|
476995
477231
|
try {
|
|
476996
|
-
content = await readFile21(
|
|
477232
|
+
content = await readFile21(join60(cwd2, ".soulforge", "plans", planFileName(sessionIdRef.current)), "utf-8");
|
|
476997
477233
|
} catch {
|
|
476998
477234
|
content = planContent;
|
|
476999
477235
|
}
|
|
@@ -480138,8 +480374,8 @@ var init_ImageDisplay = __esm(() => {
|
|
|
480138
480374
|
});
|
|
480139
480375
|
|
|
480140
480376
|
// src/core/utils/syntax.ts
|
|
480141
|
-
import { existsSync as
|
|
480142
|
-
import { dirname as dirname24, join as
|
|
480377
|
+
import { existsSync as existsSync57, readdirSync as readdirSync12 } from "fs";
|
|
480378
|
+
import { dirname as dirname24, join as join61, resolve as resolve43 } from "path";
|
|
480143
480379
|
import {
|
|
480144
480380
|
addDefaultParsers,
|
|
480145
480381
|
getTreeSitterClient,
|
|
@@ -480161,8 +480397,8 @@ function discoverParsers() {
|
|
|
480161
480397
|
continue;
|
|
480162
480398
|
const highlights = resolve43(langDir, "highlights.scm");
|
|
480163
480399
|
const injections = resolve43(langDir, "injections.scm");
|
|
480164
|
-
const hasHighlights =
|
|
480165
|
-
const hasInjections =
|
|
480400
|
+
const hasHighlights = existsSync57(highlights);
|
|
480401
|
+
const hasInjections = existsSync57(injections);
|
|
480166
480402
|
if (!hasHighlights)
|
|
480167
480403
|
continue;
|
|
480168
480404
|
const parser = {
|
|
@@ -480206,19 +480442,19 @@ var init_syntax = __esm(() => {
|
|
|
480206
480442
|
init_platform();
|
|
480207
480443
|
IS_COMPILED3 = isCompiledBinary(import.meta.url);
|
|
480208
480444
|
IS_DIST3 = !IS_COMPILED3 && import.meta.dir.includes("/dist");
|
|
480209
|
-
bundledAssets =
|
|
480210
|
-
distAssets =
|
|
480445
|
+
bundledAssets = join61(dataDir(), "opentui-assets");
|
|
480446
|
+
distAssets = join61(import.meta.dir, "opentui-assets");
|
|
480211
480447
|
if (IS_COMPILED3) {
|
|
480212
480448
|
coreAssetsDir = bundledAssets;
|
|
480213
480449
|
} else if (IS_DIST3) {
|
|
480214
|
-
coreAssetsDir =
|
|
480450
|
+
coreAssetsDir = existsSync57(distAssets) ? distAssets : bundledAssets;
|
|
480215
480451
|
} else {
|
|
480216
480452
|
try {
|
|
480217
480453
|
coreAssetsDir = resolve43(dirname24(__require.resolve("@opentui/core")), "assets");
|
|
480218
480454
|
} catch {
|
|
480219
480455
|
coreAssetsDir = bundledAssets;
|
|
480220
480456
|
}
|
|
480221
|
-
if (!
|
|
480457
|
+
if (!existsSync57(coreAssetsDir))
|
|
480222
480458
|
coreAssetsDir = bundledAssets;
|
|
480223
480459
|
}
|
|
480224
480460
|
MARKDOWN_INJECTION_MAP = {
|
|
@@ -480252,14 +480488,14 @@ var init_syntax = __esm(() => {
|
|
|
480252
480488
|
};
|
|
480253
480489
|
addDefaultParsers(discoverParsers());
|
|
480254
480490
|
if (IS_COMPILED3) {
|
|
480255
|
-
const worker =
|
|
480256
|
-
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH &&
|
|
480491
|
+
const worker = join61(dataDir(), "opentui-assets", "parser.worker.js");
|
|
480492
|
+
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH && existsSync57(worker)) {
|
|
480257
480493
|
process.env.OTUI_TREE_SITTER_WORKER_PATH = worker;
|
|
480258
480494
|
}
|
|
480259
480495
|
} else if (IS_DIST3) {
|
|
480260
480496
|
try {
|
|
480261
480497
|
const coreWorker = resolve43(dirname24(__require.resolve("@opentui/core")), "parser.worker.js");
|
|
480262
|
-
if (
|
|
480498
|
+
if (existsSync57(coreWorker)) {
|
|
480263
480499
|
process.env.OTUI_TREE_SITTER_WORKER_PATH = coreWorker;
|
|
480264
480500
|
}
|
|
480265
480501
|
} catch {}
|
|
@@ -484393,7 +484629,7 @@ var init_tool_grouping = __esm(() => {
|
|
|
484393
484629
|
|
|
484394
484630
|
// src/components/chat/MessageList.tsx
|
|
484395
484631
|
import { readFile as readFile23 } from "fs/promises";
|
|
484396
|
-
import { join as
|
|
484632
|
+
import { join as join62 } from "path";
|
|
484397
484633
|
import { TextAttributes as TextAttributes9 } from "@opentui/core";
|
|
484398
484634
|
function useReasoningExpanded() {
|
|
484399
484635
|
return import_react58.useContext(ReasoningExpandedContext);
|
|
@@ -484883,7 +485119,7 @@ function WritePlanCall({
|
|
|
484883
485119
|
import_react58.useEffect(() => {
|
|
484884
485120
|
if (!planFile)
|
|
484885
485121
|
return;
|
|
484886
|
-
readFile23(
|
|
485122
|
+
readFile23(join62(getCwd(), planFile), "utf-8").then(setMarkdown).catch(() => setMarkdown(null));
|
|
484887
485123
|
}, [planFile]);
|
|
484888
485124
|
if (!plan)
|
|
484889
485125
|
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ToolCallRow, {
|
|
@@ -491232,7 +491468,7 @@ var init_TerminalList = __esm(() => {
|
|
|
491232
491468
|
|
|
491233
491469
|
// src/components/layout/TabInstance.tsx
|
|
491234
491470
|
import { unlink as unlink3 } from "fs/promises";
|
|
491235
|
-
import { join as
|
|
491471
|
+
import { join as join63 } from "path";
|
|
491236
491472
|
import { TextAttributes as TextAttributes19 } from "@opentui/core";
|
|
491237
491473
|
function getScrollbarVisible(tk) {
|
|
491238
491474
|
return {
|
|
@@ -491542,7 +491778,7 @@ var init_TabInstance = __esm(async () => {
|
|
|
491542
491778
|
useCheckpointStore.getState().cleanupGitTags(tabId, cwd2);
|
|
491543
491779
|
}
|
|
491544
491780
|
useCheckpointStore.getState().clear(tabId);
|
|
491545
|
-
const p3 =
|
|
491781
|
+
const p3 = join63(cwd2, ".soulforge", "plans", planFileName(chat.sessionId));
|
|
491546
491782
|
unlink3(p3).catch(() => {});
|
|
491547
491783
|
};
|
|
491548
491784
|
}, [contextManager, tabId, cwd2, chat.sessionId]);
|
|
@@ -491699,7 +491935,7 @@ var init_TabInstance = __esm(async () => {
|
|
|
491699
491935
|
chat.setMessages(updated);
|
|
491700
491936
|
}, [chat.messages.length]);
|
|
491701
491937
|
const cleanupPlanFile = import_react83.useCallback(() => {
|
|
491702
|
-
const p3 =
|
|
491938
|
+
const p3 = join63(cwd2, ".soulforge", "plans", planFileName(chat.sessionId));
|
|
491703
491939
|
unlink3(p3).catch(() => {});
|
|
491704
491940
|
}, [cwd2, chat.sessionId]);
|
|
491705
491941
|
const onAcceptPlan = import_react83.useCallback(() => {
|
|
@@ -498628,7 +498864,7 @@ function StatusDashboard({
|
|
|
498628
498864
|
Promise.resolve().then(() => (init_service(), exports_service))
|
|
498629
498865
|
]);
|
|
498630
498866
|
const cfg = loadHearthConfig2();
|
|
498631
|
-
const { existsSync:
|
|
498867
|
+
const { existsSync: existsSync58 } = await import("fs");
|
|
498632
498868
|
const svc = await getServiceStatus2();
|
|
498633
498869
|
const persistence = {
|
|
498634
498870
|
installed: svc.installed,
|
|
@@ -498636,7 +498872,7 @@ function StatusDashboard({
|
|
|
498636
498872
|
platform: svc.platform,
|
|
498637
498873
|
unitLabel: svc.unitLabel
|
|
498638
498874
|
};
|
|
498639
|
-
if (!
|
|
498875
|
+
if (!existsSync58(cfg.daemon.socketPath)) {
|
|
498640
498876
|
if (!stopped)
|
|
498641
498877
|
setHearth({
|
|
498642
498878
|
running: false,
|
|
@@ -501659,9 +501895,9 @@ var init_hearth2 = __esm(() => {
|
|
|
501659
501895
|
|
|
501660
501896
|
// src/components/settings/HearthSettings.tsx
|
|
501661
501897
|
import { spawn as spawn21 } from "child_process";
|
|
501662
|
-
import { appendFileSync as appendFileSync5, existsSync as
|
|
501898
|
+
import { appendFileSync as appendFileSync5, existsSync as existsSync58, readFileSync as readFileSync33, statSync as statSync12, watch as watch3 } from "fs";
|
|
501663
501899
|
import { tmpdir as tmpdir6 } from "os";
|
|
501664
|
-
import { delimiter as delimiter2, dirname as dirname25, join as
|
|
501900
|
+
import { delimiter as delimiter2, dirname as dirname25, join as join64, resolve as resolve45 } from "path";
|
|
501665
501901
|
import { decodePasteBytes as decodePasteBytes6, TextAttributes as TextAttributes26 } from "@opentui/core";
|
|
501666
501902
|
function surfaceIdFrom(kind, id) {
|
|
501667
501903
|
return `${kind}:${id}`;
|
|
@@ -501685,7 +501921,7 @@ function formatUptime(ms) {
|
|
|
501685
501921
|
return `${String(h3)}h ${String(m5 % 60)}m`;
|
|
501686
501922
|
}
|
|
501687
501923
|
async function probeDaemon(socketPath) {
|
|
501688
|
-
if (!
|
|
501924
|
+
if (!existsSync58(socketPath))
|
|
501689
501925
|
return { running: false };
|
|
501690
501926
|
try {
|
|
501691
501927
|
const res = await socketRequest({ op: "health", v: HEARTH_PROTOCOL_VERSION }, { path: socketPath, timeoutMs: 1200 });
|
|
@@ -501705,7 +501941,7 @@ async function probeDaemon(socketPath) {
|
|
|
501705
501941
|
}
|
|
501706
501942
|
}
|
|
501707
501943
|
async function issuePairingCodeViaDaemon(socketPath, surfaceId) {
|
|
501708
|
-
if (!
|
|
501944
|
+
if (!existsSync58(socketPath)) {
|
|
501709
501945
|
return { error: "Daemon not running \u2014 start it from the Daemon tab first." };
|
|
501710
501946
|
}
|
|
501711
501947
|
try {
|
|
@@ -502003,11 +502239,11 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502003
502239
|
const path = config2.daemon.logFile;
|
|
502004
502240
|
const read = () => {
|
|
502005
502241
|
try {
|
|
502006
|
-
if (!
|
|
502242
|
+
if (!existsSync58(path)) {
|
|
502007
502243
|
setLogLines(["(log file not yet created \u2014 start the daemon from the Daemon tab)"]);
|
|
502008
502244
|
return;
|
|
502009
502245
|
}
|
|
502010
|
-
const raw2 =
|
|
502246
|
+
const raw2 = readFileSync33(path, "utf-8");
|
|
502011
502247
|
const lines = raw2.split(`
|
|
502012
502248
|
`).filter(Boolean).slice(-1000);
|
|
502013
502249
|
setLogLines(lines);
|
|
@@ -502057,7 +502293,7 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502057
502293
|
flashMsg("err", "could not locate a soulforge launcher \u2014 set SOULFORGE_HEARTH_LAUNCHER or run `soulforge hearth start` manually");
|
|
502058
502294
|
return;
|
|
502059
502295
|
}
|
|
502060
|
-
const bootLog =
|
|
502296
|
+
const bootLog = join64(tmpdir6(), `soulforge-hearth-boot-${String(Date.now())}.log`);
|
|
502061
502297
|
appendFileSync5(bootLog, `# ${new Date().toISOString()} starting via ${launcher.kind}
|
|
502062
502298
|
` + `# cmd: ${launcher.cmd} ${launcher.args.join(" ")}
|
|
502063
502299
|
|
|
@@ -502110,10 +502346,10 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502110
502346
|
return;
|
|
502111
502347
|
}
|
|
502112
502348
|
}
|
|
502113
|
-
const pidPath =
|
|
502349
|
+
const pidPath = join64(configDir(), "hearth.pid");
|
|
502114
502350
|
let pid = null;
|
|
502115
|
-
if (
|
|
502116
|
-
const raw2 =
|
|
502351
|
+
if (existsSync58(pidPath)) {
|
|
502352
|
+
const raw2 = readFileSync33(pidPath, "utf-8").trim();
|
|
502117
502353
|
const n = Number.parseInt(raw2, 10);
|
|
502118
502354
|
if (!Number.isNaN(n) && n > 0)
|
|
502119
502355
|
pid = n;
|
|
@@ -502149,7 +502385,7 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502149
502385
|
logBackgroundError("hearth-settings", err2 instanceof Error ? err2.message : String(err2));
|
|
502150
502386
|
return;
|
|
502151
502387
|
}
|
|
502152
|
-
if (!
|
|
502388
|
+
if (!existsSync58(next.daemon.socketPath))
|
|
502153
502389
|
return;
|
|
502154
502390
|
socketRequest({ op: "reload", v: HEARTH_PROTOCOL_VERSION }, { path: next.daemon.socketPath, timeoutMs: 8000 }).then((res) => {
|
|
502155
502391
|
const parts2 = [];
|
|
@@ -504714,22 +504950,22 @@ function renderAddAllowed(_w, _rows, mode, t) {
|
|
|
504714
504950
|
}
|
|
504715
504951
|
function resolveLauncher() {
|
|
504716
504952
|
const envOverride = process.env.SOULFORGE_HEARTH_LAUNCHER;
|
|
504717
|
-
if (envOverride &&
|
|
504953
|
+
if (envOverride && existsSync58(envOverride)) {
|
|
504718
504954
|
return { kind: "env", cmd: envOverride, args: [] };
|
|
504719
504955
|
}
|
|
504720
504956
|
const checkout = findSourceCheckout(process.argv[1] ?? process.cwd());
|
|
504721
504957
|
if (checkout) {
|
|
504722
|
-
const bootTsx =
|
|
504723
|
-
const distEntry =
|
|
504724
|
-
const bin =
|
|
504725
|
-
if (
|
|
504958
|
+
const bootTsx = join64(checkout, "src", "boot.tsx");
|
|
504959
|
+
const distEntry = join64(checkout, "dist", "bin.sh");
|
|
504960
|
+
const bin = join64(checkout, "bin", "soulforge");
|
|
504961
|
+
if (existsSync58(bootTsx)) {
|
|
504726
504962
|
const bunBin = process.execPath.includes("bun") ? process.execPath : findBinaryOnPath("bun") ?? "bun";
|
|
504727
504963
|
return { kind: "dev-bun", cmd: bunBin, args: [bootTsx] };
|
|
504728
504964
|
}
|
|
504729
|
-
if (
|
|
504965
|
+
if (existsSync58(distEntry)) {
|
|
504730
504966
|
return { kind: "dist", cmd: distEntry, args: [] };
|
|
504731
504967
|
}
|
|
504732
|
-
if (
|
|
504968
|
+
if (existsSync58(bin) && isExecutable(bin)) {
|
|
504733
504969
|
return { kind: "dev-bin", cmd: bin, args: [] };
|
|
504734
504970
|
}
|
|
504735
504971
|
}
|
|
@@ -504739,12 +504975,12 @@ function resolveLauncher() {
|
|
|
504739
504975
|
return null;
|
|
504740
504976
|
}
|
|
504741
504977
|
function findSourceCheckout(startPath) {
|
|
504742
|
-
let dir = startPath &&
|
|
504978
|
+
let dir = startPath && existsSync58(startPath) ? resolve45(dirname25(startPath)) : resolve45(process.cwd());
|
|
504743
504979
|
for (let i4 = 0;i4 < 6; i4++) {
|
|
504744
|
-
const pkg =
|
|
504745
|
-
if (
|
|
504980
|
+
const pkg = join64(dir, "package.json");
|
|
504981
|
+
if (existsSync58(pkg)) {
|
|
504746
504982
|
try {
|
|
504747
|
-
const parsed = JSON.parse(
|
|
504983
|
+
const parsed = JSON.parse(readFileSync33(pkg, "utf-8"));
|
|
504748
504984
|
if (parsed.name === "@proxysoul/soulforge" || parsed.module?.includes("boot.tsx")) {
|
|
504749
504985
|
return dir;
|
|
504750
504986
|
}
|
|
@@ -504771,13 +505007,13 @@ function isExecutable(p3) {
|
|
|
504771
505007
|
}
|
|
504772
505008
|
function findBinaryOnPath(name39) {
|
|
504773
505009
|
const resolved = findOnPath(name39);
|
|
504774
|
-
if (resolved &&
|
|
505010
|
+
if (resolved && existsSync58(resolved) && isExecutable(resolved))
|
|
504775
505011
|
return resolved;
|
|
504776
505012
|
const exts = IS_WIN ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean) : [""];
|
|
504777
505013
|
for (const dir of (process.env.PATH ?? "").split(delimiter2)) {
|
|
504778
505014
|
for (const ext of exts) {
|
|
504779
|
-
const candidate =
|
|
504780
|
-
if (
|
|
505015
|
+
const candidate = join64(dir, name39 + ext);
|
|
505016
|
+
if (existsSync58(candidate) && isExecutable(candidate))
|
|
504781
505017
|
return candidate;
|
|
504782
505018
|
}
|
|
504783
505019
|
}
|
|
@@ -504785,9 +505021,9 @@ function findBinaryOnPath(name39) {
|
|
|
504785
505021
|
}
|
|
504786
505022
|
function readTailSafe(path, maxLines) {
|
|
504787
505023
|
try {
|
|
504788
|
-
if (!
|
|
505024
|
+
if (!existsSync58(path))
|
|
504789
505025
|
return null;
|
|
504790
|
-
const raw2 =
|
|
505026
|
+
const raw2 = readFileSync33(path, "utf-8");
|
|
504791
505027
|
const lines = raw2.split(`
|
|
504792
505028
|
`).filter(Boolean).slice(-maxLines);
|
|
504793
505029
|
const joined = lines.join(" \xB7 ");
|
|
@@ -504866,9 +505102,9 @@ var init_HearthSettings = __esm(async () => {
|
|
|
504866
505102
|
|
|
504867
505103
|
// src/core/intelligence/backends/lsp/installer.ts
|
|
504868
505104
|
import { spawn as spawn22 } from "child_process";
|
|
504869
|
-
import { chmodSync as chmodSync6, existsSync as
|
|
505105
|
+
import { chmodSync as chmodSync6, existsSync as existsSync59, mkdirSync as mkdirSync27, readFileSync as readFileSync34, unlinkSync as unlinkSync12, writeFileSync as writeFileSync24 } from "fs";
|
|
504870
505106
|
import { homedir as homedir14 } from "os";
|
|
504871
|
-
import { join as
|
|
505107
|
+
import { join as join65 } from "path";
|
|
504872
505108
|
function parsePurl(id) {
|
|
504873
505109
|
const match2 = id.match(/^pkg:(\w+)\/(.+?)@(.+)$/);
|
|
504874
505110
|
if (!match2)
|
|
@@ -504934,16 +505170,16 @@ function getToolchainRequirement(method) {
|
|
|
504934
505170
|
function loadRegistry() {
|
|
504935
505171
|
if (registryCache)
|
|
504936
505172
|
return registryCache;
|
|
504937
|
-
if (
|
|
505173
|
+
if (existsSync59(MASON_REGISTRY_LOCAL)) {
|
|
504938
505174
|
try {
|
|
504939
|
-
const raw2 =
|
|
505175
|
+
const raw2 = readFileSync34(MASON_REGISTRY_LOCAL, "utf-8");
|
|
504940
505176
|
registryCache = JSON.parse(raw2);
|
|
504941
505177
|
return registryCache;
|
|
504942
505178
|
} catch {}
|
|
504943
505179
|
}
|
|
504944
|
-
if (
|
|
505180
|
+
if (existsSync59(REGISTRY_CACHE)) {
|
|
504945
505181
|
try {
|
|
504946
|
-
const raw2 =
|
|
505182
|
+
const raw2 = readFileSync34(REGISTRY_CACHE, "utf-8");
|
|
504947
505183
|
registryCache = JSON.parse(raw2);
|
|
504948
505184
|
return registryCache;
|
|
504949
505185
|
} catch {}
|
|
@@ -504951,7 +505187,7 @@ function loadRegistry() {
|
|
|
504951
505187
|
return [];
|
|
504952
505188
|
}
|
|
504953
505189
|
async function downloadRegistry() {
|
|
504954
|
-
|
|
505190
|
+
mkdirSync27(configDir(), { recursive: true });
|
|
504955
505191
|
try {
|
|
504956
505192
|
const releaseResp = await fetch(MASON_REGISTRY_RELEASE_URL, {
|
|
504957
505193
|
headers: { Accept: "application/vnd.github.v3+json", "User-Agent": "SoulForge" }
|
|
@@ -504966,15 +505202,15 @@ async function downloadRegistry() {
|
|
|
504966
505202
|
if (!zipResp.ok)
|
|
504967
505203
|
throw new Error(`Download HTTP ${String(zipResp.status)}`);
|
|
504968
505204
|
const zipBuf = await zipResp.arrayBuffer();
|
|
504969
|
-
const tmpZip =
|
|
504970
|
-
|
|
505205
|
+
const tmpZip = join65(configDir(), "mason-registry.zip");
|
|
505206
|
+
writeFileSync24(tmpZip, Buffer.from(zipBuf));
|
|
504971
505207
|
const result = extractArchive(tmpZip, configDir());
|
|
504972
505208
|
if (!result.success)
|
|
504973
505209
|
throw new Error(`Extract failed: ${result.error}`);
|
|
504974
505210
|
unlinkSync12(tmpZip);
|
|
504975
|
-
const jsonPath =
|
|
504976
|
-
const text3 =
|
|
504977
|
-
|
|
505211
|
+
const jsonPath = join65(configDir(), "registry.json");
|
|
505212
|
+
const text3 = readFileSync34(jsonPath, "utf-8");
|
|
505213
|
+
writeFileSync24(REGISTRY_CACHE, text3);
|
|
504978
505214
|
unlinkSync12(jsonPath);
|
|
504979
505215
|
registryCache = JSON.parse(text3);
|
|
504980
505216
|
return registryCache;
|
|
@@ -505008,8 +505244,8 @@ function loadVersions() {
|
|
|
505008
505244
|
if (versionCache)
|
|
505009
505245
|
return versionCache;
|
|
505010
505246
|
try {
|
|
505011
|
-
if (
|
|
505012
|
-
versionCache = JSON.parse(
|
|
505247
|
+
if (existsSync59(VERSIONS_FILE)) {
|
|
505248
|
+
versionCache = JSON.parse(readFileSync34(VERSIONS_FILE, "utf-8"));
|
|
505013
505249
|
return versionCache;
|
|
505014
505250
|
}
|
|
505015
505251
|
} catch {}
|
|
@@ -505018,8 +505254,8 @@ function loadVersions() {
|
|
|
505018
505254
|
function saveVersions(map2) {
|
|
505019
505255
|
versionCache = map2;
|
|
505020
505256
|
try {
|
|
505021
|
-
|
|
505022
|
-
|
|
505257
|
+
mkdirSync27(configDir(), { recursive: true });
|
|
505258
|
+
writeFileSync24(VERSIONS_FILE, JSON.stringify(map2, null, 2), "utf-8");
|
|
505023
505259
|
} catch {}
|
|
505024
505260
|
}
|
|
505025
505261
|
function recordInstalledVersion(pkg) {
|
|
@@ -505046,7 +505282,7 @@ function checkPackageStatus(pkg) {
|
|
|
505046
505282
|
const winSuffixes = IS_WIN ? [EXE, CMD_EXT, ""] : [""];
|
|
505047
505283
|
const probe = (dir, bin) => {
|
|
505048
505284
|
for (const sfx of winSuffixes) {
|
|
505049
|
-
if (
|
|
505285
|
+
if (existsSync59(join65(dir, bin + sfx)))
|
|
505050
505286
|
return true;
|
|
505051
505287
|
}
|
|
505052
505288
|
return false;
|
|
@@ -505059,12 +505295,12 @@ function checkPackageStatus(pkg) {
|
|
|
505059
505295
|
source = "PATH";
|
|
505060
505296
|
break;
|
|
505061
505297
|
}
|
|
505062
|
-
if (probe(
|
|
505298
|
+
if (probe(join65(SOULFORGE_LSP_DIR, "node_modules", ".bin"), bin)) {
|
|
505063
505299
|
installed2 = true;
|
|
505064
505300
|
source = "soulforge";
|
|
505065
505301
|
break;
|
|
505066
505302
|
}
|
|
505067
|
-
if (probe(
|
|
505303
|
+
if (probe(join65(SOULFORGE_LSP_DIR, "bin"), bin)) {
|
|
505068
505304
|
installed2 = true;
|
|
505069
505305
|
source = "soulforge";
|
|
505070
505306
|
break;
|
|
@@ -505137,7 +505373,7 @@ async function installPackage(pkg, onProgress) {
|
|
|
505137
505373
|
const purl = parsePurl(pkg.source.id);
|
|
505138
505374
|
if (!purl)
|
|
505139
505375
|
return { success: false, error: "Cannot parse package source" };
|
|
505140
|
-
|
|
505376
|
+
mkdirSync27(SOULFORGE_LSP_DIR, { recursive: true });
|
|
505141
505377
|
const log = (msg) => onProgress?.(msg);
|
|
505142
505378
|
try {
|
|
505143
505379
|
switch (purl.type) {
|
|
@@ -505148,8 +505384,8 @@ async function installPackage(pkg, onProgress) {
|
|
|
505148
505384
|
const bunBin = (() => {
|
|
505149
505385
|
if (commandExists("bun"))
|
|
505150
505386
|
return "bun";
|
|
505151
|
-
const sfBin =
|
|
505152
|
-
if (
|
|
505387
|
+
const sfBin = join65(dataDir(), "bin", `bun${EXE}`);
|
|
505388
|
+
if (existsSync59(sfBin))
|
|
505153
505389
|
return sfBin;
|
|
505154
505390
|
return "bun";
|
|
505155
505391
|
})();
|
|
@@ -505160,23 +505396,23 @@ async function installPackage(pkg, onProgress) {
|
|
|
505160
505396
|
}
|
|
505161
505397
|
case "pypi": {
|
|
505162
505398
|
log(`Installing ${purl.name} via pip3...`);
|
|
505163
|
-
const binDir =
|
|
505164
|
-
const pipDir =
|
|
505165
|
-
|
|
505166
|
-
|
|
505399
|
+
const binDir = join65(SOULFORGE_LSP_DIR, "bin");
|
|
505400
|
+
const pipDir = join65(SOULFORGE_LSP_DIR, "pip-packages");
|
|
505401
|
+
mkdirSync27(binDir, { recursive: true });
|
|
505402
|
+
mkdirSync27(pipDir, { recursive: true });
|
|
505167
505403
|
await runCommand("pip3", ["install", "--target", pipDir, `${purl.name}==${purl.version}`], log);
|
|
505168
505404
|
if (pkg.bin) {
|
|
505169
505405
|
const moduleName = purl.name.replace(/-/g, "_");
|
|
505170
505406
|
for (const binName of Object.keys(pkg.bin)) {
|
|
505171
505407
|
if (IS_WIN) {
|
|
505172
|
-
const wrapper =
|
|
505173
|
-
|
|
505408
|
+
const wrapper = join65(binDir, binName + CMD_EXT);
|
|
505409
|
+
writeFileSync24(wrapper, `@echo off\r
|
|
505174
505410
|
set "PYTHONPATH=${pipDir};%PYTHONPATH%"\r
|
|
505175
505411
|
python -m ${moduleName} %*\r
|
|
505176
505412
|
`);
|
|
505177
505413
|
} else {
|
|
505178
|
-
const wrapper =
|
|
505179
|
-
|
|
505414
|
+
const wrapper = join65(binDir, binName);
|
|
505415
|
+
writeFileSync24(wrapper, `#!/usr/bin/env bash
|
|
505180
505416
|
PYTHONPATH="${pipDir}:$PYTHONPATH" exec python3 -m ${moduleName} "$@"
|
|
505181
505417
|
`);
|
|
505182
505418
|
chmodSync6(wrapper, 493);
|
|
@@ -505187,22 +505423,22 @@ PYTHONPATH="${pipDir}:$PYTHONPATH" exec python3 -m ${moduleName} "$@"
|
|
|
505187
505423
|
}
|
|
505188
505424
|
case "golang": {
|
|
505189
505425
|
log(`Installing ${purl.namespace}/${purl.name} via go install...`);
|
|
505190
|
-
const binDir =
|
|
505191
|
-
|
|
505426
|
+
const binDir = join65(SOULFORGE_LSP_DIR, "bin");
|
|
505427
|
+
mkdirSync27(binDir, { recursive: true });
|
|
505192
505428
|
const fullPkg = `${purl.namespace}/${purl.name}@${purl.version}`;
|
|
505193
505429
|
await runCommand("go", ["install", fullPkg], log, { GOBIN: binDir });
|
|
505194
505430
|
break;
|
|
505195
505431
|
}
|
|
505196
505432
|
case "cargo": {
|
|
505197
505433
|
log(`Installing ${purl.name} via cargo...`);
|
|
505198
|
-
|
|
505434
|
+
mkdirSync27(join65(SOULFORGE_LSP_DIR, "bin"), { recursive: true });
|
|
505199
505435
|
await runCommand("cargo", ["install", purl.name, "--version", purl.version, "--root", SOULFORGE_LSP_DIR], log);
|
|
505200
505436
|
break;
|
|
505201
505437
|
}
|
|
505202
505438
|
case "github": {
|
|
505203
505439
|
log(`Downloading ${purl.namespace}/${purl.name} from GitHub...`);
|
|
505204
|
-
const binDir =
|
|
505205
|
-
|
|
505440
|
+
const binDir = join65(SOULFORGE_LSP_DIR, "bin");
|
|
505441
|
+
mkdirSync27(binDir, { recursive: true });
|
|
505206
505442
|
const asset = findPlatformAsset(pkg);
|
|
505207
505443
|
if (!asset) {
|
|
505208
505444
|
const target = getMasonTarget();
|
|
@@ -505213,17 +505449,17 @@ PYTHONPATH="${pipDir}:$PYTHONPATH" exec python3 -m ${moduleName} "$@"
|
|
|
505213
505449
|
}
|
|
505214
505450
|
const version2 = purl.version;
|
|
505215
505451
|
const fileUrl = `https://github.com/${purl.namespace}/${purl.name}/releases/download/${version2}/${resolveAssetTemplate(asset.file, version2)}`;
|
|
505216
|
-
const tmpDir2 =
|
|
505217
|
-
|
|
505452
|
+
const tmpDir2 = join65(SOULFORGE_LSP_DIR, ".tmp");
|
|
505453
|
+
mkdirSync27(tmpDir2, { recursive: true });
|
|
505218
505454
|
log(`Downloading ${fileUrl}...`);
|
|
505219
|
-
await runCommand("curl", ["-fSL", "-o",
|
|
505220
|
-
const downloadPath =
|
|
505455
|
+
await runCommand("curl", ["-fSL", "-o", join65(tmpDir2, "download"), fileUrl], log);
|
|
505456
|
+
const downloadPath = join65(tmpDir2, "download");
|
|
505221
505457
|
const lower2 = asset.file.toLowerCase();
|
|
505222
505458
|
let archivePath = downloadPath;
|
|
505223
505459
|
if (lower2.endsWith(".tar.gz") || lower2.endsWith(".tgz") || lower2.endsWith(".tar.xz") || lower2.endsWith(".zip")) {
|
|
505224
505460
|
const { safeRename: safeRename2 } = await Promise.resolve().then(() => (init_platform(), exports_platform));
|
|
505225
505461
|
const ext = lower2.endsWith(".tgz") ? ".tar.gz" : lower2.endsWith(".tar.gz") ? ".tar.gz" : lower2.endsWith(".tar.xz") ? ".tar.xz" : ".zip";
|
|
505226
|
-
archivePath =
|
|
505462
|
+
archivePath = join65(tmpDir2, `download${ext}`);
|
|
505227
505463
|
try {
|
|
505228
505464
|
safeRename2(downloadPath, archivePath);
|
|
505229
505465
|
} catch {}
|
|
@@ -505238,20 +505474,20 @@ PYTHONPATH="${pipDir}:$PYTHONPATH" exec python3 -m ${moduleName} "$@"
|
|
|
505238
505474
|
const baseCandidates = [
|
|
505239
505475
|
resolvedBin,
|
|
505240
505476
|
binName,
|
|
505241
|
-
|
|
505242
|
-
|
|
505477
|
+
join65(purl.name, resolvedBin),
|
|
505478
|
+
join65(purl.name, binName)
|
|
505243
505479
|
];
|
|
505244
505480
|
const candidates = [];
|
|
505245
505481
|
for (const c of baseCandidates) {
|
|
505246
505482
|
for (const ext of winExts) {
|
|
505247
|
-
candidates.push(
|
|
505483
|
+
candidates.push(join65(tmpDir2, c + ext));
|
|
505248
505484
|
}
|
|
505249
505485
|
}
|
|
505250
505486
|
for (const candidate of candidates) {
|
|
505251
|
-
if (
|
|
505487
|
+
if (existsSync59(candidate)) {
|
|
505252
505488
|
const { copyFileSync: copyFileSync2 } = await import("fs");
|
|
505253
505489
|
const srcExt = candidate.endsWith(".exe") ? ".exe" : candidate.endsWith(".cmd") ? ".cmd" : "";
|
|
505254
|
-
const dest =
|
|
505490
|
+
const dest = join65(binDir, binName + (IS_WIN ? srcExt : ""));
|
|
505255
505491
|
copyFileSync2(candidate, dest);
|
|
505256
505492
|
if (!IS_WIN)
|
|
505257
505493
|
chmodSync6(dest, 493);
|
|
@@ -505287,7 +505523,7 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505287
505523
|
const suffixes = IS_WIN ? [EXE, CMD_EXT, ""] : [""];
|
|
505288
505524
|
for (const sfx of suffixes) {
|
|
505289
505525
|
try {
|
|
505290
|
-
unlinkSync13(
|
|
505526
|
+
unlinkSync13(join65(dir, bin + sfx));
|
|
505291
505527
|
} catch {}
|
|
505292
505528
|
}
|
|
505293
505529
|
};
|
|
@@ -505300,8 +505536,8 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505300
505536
|
const bunBin = (() => {
|
|
505301
505537
|
if (commandExists("bun"))
|
|
505302
505538
|
return "bun";
|
|
505303
|
-
const sfBin =
|
|
505304
|
-
if (
|
|
505539
|
+
const sfBin = join65(dataDir(), "bin", `bun${EXE}`);
|
|
505540
|
+
if (existsSync59(sfBin))
|
|
505305
505541
|
return sfBin;
|
|
505306
505542
|
return "bun";
|
|
505307
505543
|
})();
|
|
@@ -505311,7 +505547,7 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505311
505547
|
});
|
|
505312
505548
|
if (removeResult.status !== 0) {
|
|
505313
505549
|
for (const bin of binaries) {
|
|
505314
|
-
removeBin(
|
|
505550
|
+
removeBin(join65(SOULFORGE_LSP_DIR, "node_modules", ".bin"), bin);
|
|
505315
505551
|
}
|
|
505316
505552
|
}
|
|
505317
505553
|
break;
|
|
@@ -505319,13 +505555,13 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505319
505555
|
case "pypi": {
|
|
505320
505556
|
log(`Removing ${purl.name}...`);
|
|
505321
505557
|
const { rmSync: rmSync7 } = await import("fs");
|
|
505322
|
-
const pipDir =
|
|
505323
|
-
const pkgDir =
|
|
505558
|
+
const pipDir = join65(SOULFORGE_LSP_DIR, "pip-packages");
|
|
505559
|
+
const pkgDir = join65(pipDir, purl.name.replace(/-/g, "_"));
|
|
505324
505560
|
try {
|
|
505325
505561
|
rmSync7(pkgDir, { recursive: true, force: true });
|
|
505326
505562
|
} catch {}
|
|
505327
505563
|
for (const bin of binaries) {
|
|
505328
|
-
removeBin(
|
|
505564
|
+
removeBin(join65(SOULFORGE_LSP_DIR, "bin"), bin);
|
|
505329
505565
|
}
|
|
505330
505566
|
break;
|
|
505331
505567
|
}
|
|
@@ -505333,14 +505569,14 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505333
505569
|
case "cargo": {
|
|
505334
505570
|
log(`Removing ${purl.name} binaries...`);
|
|
505335
505571
|
for (const bin of binaries) {
|
|
505336
|
-
removeBin(
|
|
505572
|
+
removeBin(join65(SOULFORGE_LSP_DIR, "bin"), bin);
|
|
505337
505573
|
}
|
|
505338
505574
|
break;
|
|
505339
505575
|
}
|
|
505340
505576
|
case "github": {
|
|
505341
505577
|
log(`Removing ${purl.name} binaries...`);
|
|
505342
505578
|
for (const bin of binaries) {
|
|
505343
|
-
removeBin(
|
|
505579
|
+
removeBin(join65(SOULFORGE_LSP_DIR, "bin"), bin);
|
|
505344
505580
|
}
|
|
505345
505581
|
break;
|
|
505346
505582
|
}
|
|
@@ -505431,11 +505667,11 @@ var SOULFORGE_LSP_DIR, VERSIONS_FILE, MASON_REGISTRY_LOCAL, MASON_REGISTRY_RELEA
|
|
|
505431
505667
|
var init_installer = __esm(() => {
|
|
505432
505668
|
init_archive();
|
|
505433
505669
|
init_platform();
|
|
505434
|
-
SOULFORGE_LSP_DIR =
|
|
505435
|
-
VERSIONS_FILE =
|
|
505436
|
-
MASON_REGISTRY_LOCAL = IS_WIN ?
|
|
505437
|
-
REGISTRY_CACHE =
|
|
505438
|
-
MASON_BIN_DIR2 =
|
|
505670
|
+
SOULFORGE_LSP_DIR = join65(dataDir(), "lsp-servers");
|
|
505671
|
+
VERSIONS_FILE = join65(configDir(), "lsp-versions.json");
|
|
505672
|
+
MASON_REGISTRY_LOCAL = IS_WIN ? join65(localAppData() ?? join65(homedir14(), "AppData", "Local"), "nvim-data", "mason", "registries", "github", "mason-org", "mason-registry", "registry.json") : join65(homedir14(), ".local", "share", "nvim", "mason", "registries", "github", "mason-org", "mason-registry", "registry.json");
|
|
505673
|
+
REGISTRY_CACHE = join65(configDir(), "mason-registry.json");
|
|
505674
|
+
MASON_BIN_DIR2 = join65(dataDir(), "mason", "bin");
|
|
505439
505675
|
pathCache = new Map;
|
|
505440
505676
|
PROJECT_INDICATORS = {
|
|
505441
505677
|
TypeScript: ["tsconfig.json", "*.ts", "*.tsx"],
|
|
@@ -505463,8 +505699,8 @@ var init_installer = __esm(() => {
|
|
|
505463
505699
|
});
|
|
505464
505700
|
|
|
505465
505701
|
// src/components/settings/LspInstallSearch.tsx
|
|
505466
|
-
import { existsSync as
|
|
505467
|
-
import { join as
|
|
505702
|
+
import { existsSync as existsSync60 } from "fs";
|
|
505703
|
+
import { join as join66 } from "path";
|
|
505468
505704
|
import { TextAttributes as TextAttributes27 } from "@opentui/core";
|
|
505469
505705
|
function methodLabel(status) {
|
|
505470
505706
|
if (status.requiresToolchain && !status.toolchainAvailable) {
|
|
@@ -505612,7 +505848,7 @@ function LspInstallSearch({
|
|
|
505612
505848
|
const defaultScopeCursor = detectScope("disabledLspServers") === "project" ? 0 : 1;
|
|
505613
505849
|
const [scopeCursor, setScopeCursor] = import_react144.useState(defaultScopeCursor);
|
|
505614
505850
|
const downloadAttemptedRef = import_react144.useRef(false);
|
|
505615
|
-
const isInProject =
|
|
505851
|
+
const isInProject = existsSync60(join66(cwd2, ".git"));
|
|
505616
505852
|
const { width: termCols, height: termRows } = useTerminalDimensions();
|
|
505617
505853
|
const containerRows = termRows - 2;
|
|
505618
505854
|
const popupWidth = Math.min(MAX_POPUP_WIDTH3, Math.floor(termCols * 0.9));
|
|
@@ -507686,6 +507922,8 @@ function readValuesFromLayer(layer) {
|
|
|
507686
507922
|
v4.xaiReasoningEffort = layer.performance.xaiReasoningEffort;
|
|
507687
507923
|
if (layer.performance?.deepseekThinking !== undefined)
|
|
507688
507924
|
v4.deepseekThinking = layer.performance.deepseekThinking;
|
|
507925
|
+
if (layer.performance?.deepseekReasoningEffort !== undefined)
|
|
507926
|
+
v4.deepseekReasoningEffort = layer.performance.deepseekReasoningEffort;
|
|
507689
507927
|
if (layer.performance?.openrouterReasoningEffort !== undefined)
|
|
507690
507928
|
v4.openrouterReasoningEffort = layer.performance.openrouterReasoningEffort;
|
|
507691
507929
|
if (layer.performance?.openrouterReasoningMaxTokens !== undefined)
|
|
@@ -507761,6 +507999,8 @@ function buildPatch(key3, value) {
|
|
|
507761
507999
|
return { performance: { xaiReasoningEffort: value } };
|
|
507762
508000
|
case "deepseekThinking":
|
|
507763
508001
|
return { performance: { deepseekThinking: value } };
|
|
508002
|
+
case "deepseekReasoningEffort":
|
|
508003
|
+
return { performance: { deepseekReasoningEffort: value } };
|
|
507764
508004
|
case "openrouterReasoningEffort":
|
|
507765
508005
|
return { performance: { openrouterReasoningEffort: value } };
|
|
507766
508006
|
case "openrouterReasoningMaxTokens": {
|
|
@@ -507815,6 +508055,17 @@ function detectInitialScope(project2) {
|
|
|
507815
508055
|
return "project";
|
|
507816
508056
|
return "global";
|
|
507817
508057
|
}
|
|
508058
|
+
function resolveOptions(key3, staticOpts, activeModel) {
|
|
508059
|
+
const resolver = EFFORT_KEY_MODELS[key3];
|
|
508060
|
+
if (!resolver)
|
|
508061
|
+
return staticOpts;
|
|
508062
|
+
const supported = getSupportedEfforts(resolver(activeModel));
|
|
508063
|
+
if (!supported)
|
|
508064
|
+
return staticOpts;
|
|
508065
|
+
const allowed = new Set(supported);
|
|
508066
|
+
const filtered = staticOpts.filter((o3) => allowed.has(o3));
|
|
508067
|
+
return filtered.length > 0 ? filtered : staticOpts;
|
|
508068
|
+
}
|
|
507818
508069
|
function ProviderSettings({
|
|
507819
508070
|
visible,
|
|
507820
508071
|
globalConfig: globalConfig2,
|
|
@@ -507831,6 +508082,7 @@ function ProviderSettings({
|
|
|
507831
508082
|
const [cursor, setCursor] = import_react150.useState(0);
|
|
507832
508083
|
const [scope, setScope] = import_react150.useState(() => detectInitialScope(projectConfig));
|
|
507833
508084
|
const vals = effectiveValues(globalConfig2, projectConfig);
|
|
508085
|
+
const activeModel = projectConfig?.defaultModel ?? globalConfig2.defaultModel ?? "";
|
|
507834
508086
|
const items = TAB_ITEMS[tab];
|
|
507835
508087
|
const tabIdx = TABS6.indexOf(tab);
|
|
507836
508088
|
const firstRowIdx = items.findIndex((i4) => i4.type !== "section" && i4.type !== "info");
|
|
@@ -507881,10 +508133,11 @@ function ProviderSettings({
|
|
|
507881
508133
|
return;
|
|
507882
508134
|
}
|
|
507883
508135
|
if (item.type === "cycle" && item.options) {
|
|
508136
|
+
const opts = resolveOptions(item.key, item.options, activeModel);
|
|
507884
508137
|
const current = String(vals[item.key]);
|
|
507885
|
-
const currentIdx =
|
|
507886
|
-
const nextIdx = (currentIdx + 1) %
|
|
507887
|
-
onUpdate(buildPatch(item.key,
|
|
508138
|
+
const currentIdx = opts.indexOf(current);
|
|
508139
|
+
const nextIdx = (currentIdx + 1) % opts.length;
|
|
508140
|
+
onUpdate(buildPatch(item.key, opts[nextIdx]), scope);
|
|
507888
508141
|
}
|
|
507889
508142
|
};
|
|
507890
508143
|
useKeyboard((evt) => {
|
|
@@ -508075,7 +508328,7 @@ function ProviderSettings({
|
|
|
508075
508328
|
]
|
|
508076
508329
|
}, undefined, true, undefined, this);
|
|
508077
508330
|
} else {
|
|
508078
|
-
const opts = item.options ?? [];
|
|
508331
|
+
const opts = resolveOptions(item.key, item.options ?? [], activeModel);
|
|
508079
508332
|
const currentValue = item.type === "budget" ? String(vals.budgetTokens) : String(raw2);
|
|
508080
508333
|
const valColor = disabled ? t.textDim : currentValue === "off" ? t.textMuted : t.brandAlt;
|
|
508081
508334
|
body4 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
@@ -508175,8 +508428,9 @@ function ProviderSettings({
|
|
|
508175
508428
|
]
|
|
508176
508429
|
}, undefined, true, undefined, this);
|
|
508177
508430
|
}
|
|
508178
|
-
var import_react150, MAX_POPUP_WIDTH4 = 110, CHROME_ROWS6 = 10, TABS6, CLAUDE_ITEMS, OPENAI_ITEMS, GENERAL_ITEMS, GOOGLE_ITEMS, XAI_ITEMS, DEEPSEEK_ITEMS, OPENROUTER_ITEMS, COMPAT_ITEMS, TAB_ITEMS, DEFAULTS;
|
|
508431
|
+
var import_react150, MAX_POPUP_WIDTH4 = 110, CHROME_ROWS6 = 10, TABS6, CLAUDE_ITEMS, OPENAI_ITEMS, GENERAL_ITEMS, GOOGLE_ITEMS, XAI_ITEMS, DEEPSEEK_ITEMS, OPENROUTER_ITEMS, COMPAT_ITEMS, TAB_ITEMS, DEFAULTS, EFFORT_KEY_MODELS;
|
|
508179
508432
|
var init_ProviderSettings = __esm(async () => {
|
|
508433
|
+
init_provider_options();
|
|
508180
508434
|
init_theme();
|
|
508181
508435
|
init_shared();
|
|
508182
508436
|
init_ui2();
|
|
@@ -508288,9 +508542,9 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508288
508542
|
{
|
|
508289
508543
|
key: "openaiReasoningEffort",
|
|
508290
508544
|
label: "Effort",
|
|
508291
|
-
desc: "o3 \xB7 o4 \xB7 gpt-5 \u2014 reasoning depth",
|
|
508545
|
+
desc: "o3 \xB7 o4 \xB7 gpt-5.x \u2014 reasoning depth. none = fastest (latency-sensitive)",
|
|
508292
508546
|
type: "cycle",
|
|
508293
|
-
options: ["off", "none", "minimal", "low", "medium", "high"
|
|
508547
|
+
options: ["off", "none", "minimal", "low", "medium", "high"]
|
|
508294
508548
|
},
|
|
508295
508549
|
{
|
|
508296
508550
|
key: "openaiReasoningSummary",
|
|
@@ -508384,13 +508638,20 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508384
508638
|
DEEPSEEK_ITEMS = [
|
|
508385
508639
|
{
|
|
508386
508640
|
type: "info",
|
|
508387
|
-
text: "
|
|
508641
|
+
text: "V4 Pro / V4 Flash take Effort (high|max). Thinking toggle applies to deepseek-chat / V3 only \u2014 deepseek-reasoner always thinks."
|
|
508388
508642
|
},
|
|
508389
508643
|
{ type: "section", label: "Reasoning" },
|
|
508644
|
+
{
|
|
508645
|
+
key: "deepseekReasoningEffort",
|
|
508646
|
+
label: "Effort",
|
|
508647
|
+
desc: "DeepSeek V4 \u2014 API accepts only high | max (xhigh folds to max)",
|
|
508648
|
+
type: "cycle",
|
|
508649
|
+
options: ["off", "high", "max"]
|
|
508650
|
+
},
|
|
508390
508651
|
{
|
|
508391
508652
|
key: "deepseekThinking",
|
|
508392
508653
|
label: "Thinking",
|
|
508393
|
-
desc: "Enable chain-of-thought generation on deepseek-chat",
|
|
508654
|
+
desc: "Enable chain-of-thought generation on deepseek-chat / V3",
|
|
508394
508655
|
type: "cycle",
|
|
508395
508656
|
options: ["off", "enabled"]
|
|
508396
508657
|
}
|
|
@@ -508426,7 +508687,7 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508426
508687
|
COMPAT_ITEMS = [
|
|
508427
508688
|
{
|
|
508428
508689
|
type: "info",
|
|
508429
|
-
text: "
|
|
508690
|
+
text: "Catch-all for providers without their own tab: Groq \xB7 Fireworks \xB7 OpenCode Zen \xB7 OpenCode Go \xB7 LM Studio \xB7 Ollama \xB7 Copilot \xB7 GitHub Models \xB7 MiniMax \xB7 Proxy \xB7 LLM Gateway (non-Claude lane). DeepSeek has its own tab."
|
|
508430
508691
|
},
|
|
508431
508692
|
{ type: "section", label: "Shared effort" },
|
|
508432
508693
|
{
|
|
@@ -508489,6 +508750,7 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508489
508750
|
googleIncludeThoughts: false,
|
|
508490
508751
|
xaiReasoningEffort: "off",
|
|
508491
508752
|
deepseekThinking: "off",
|
|
508753
|
+
deepseekReasoningEffort: "off",
|
|
508492
508754
|
openrouterReasoningEffort: "off",
|
|
508493
508755
|
openrouterReasoningMaxTokens: "off",
|
|
508494
508756
|
openrouterExcludeReasoning: false,
|
|
@@ -508499,6 +508761,13 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508499
508761
|
groqReasoningFormat: "off",
|
|
508500
508762
|
cacheTtl: "5m"
|
|
508501
508763
|
};
|
|
508764
|
+
EFFORT_KEY_MODELS = {
|
|
508765
|
+
effort: (m5) => m5,
|
|
508766
|
+
deepseekReasoningEffort: () => "deepseek/deepseek-v4-pro",
|
|
508767
|
+
openaiReasoningEffort: () => "openai/gpt-5",
|
|
508768
|
+
xaiReasoningEffort: () => "xai/grok-4",
|
|
508769
|
+
googleThinkingLevel: () => "google/gemini-3-pro"
|
|
508770
|
+
};
|
|
508502
508771
|
});
|
|
508503
508772
|
|
|
508504
508773
|
// src/components/settings/RepoMapStatusPopup.tsx
|
|
@@ -509390,8 +509659,8 @@ var init_RouterSettings = __esm(async () => {
|
|
|
509390
509659
|
});
|
|
509391
509660
|
|
|
509392
509661
|
// src/components/settings/SkillSearch.tsx
|
|
509393
|
-
import { existsSync as
|
|
509394
|
-
import { join as
|
|
509662
|
+
import { existsSync as existsSync61 } from "fs";
|
|
509663
|
+
import { join as join67 } from "path";
|
|
509395
509664
|
import { TextAttributes as TextAttributes29 } from "@opentui/core";
|
|
509396
509665
|
function SearchSkillRow({
|
|
509397
509666
|
skill,
|
|
@@ -509537,7 +509806,7 @@ function SkillSearch({ visible, contextManager, onClose, onSystemMessage }) {
|
|
|
509537
509806
|
const [pendingInstall, setPendingInstall] = import_react156.useState(null);
|
|
509538
509807
|
const [scopeCursor, setScopeCursor] = import_react156.useState(0);
|
|
509539
509808
|
const debounceRef = import_react156.useRef(null);
|
|
509540
|
-
const isInProject =
|
|
509809
|
+
const isInProject = existsSync61(join67(getCwd(), ".git"));
|
|
509541
509810
|
const { width: termCols, height: termRows } = useTerminalDimensions();
|
|
509542
509811
|
const containerRows = termRows - 2;
|
|
509543
509812
|
const popupWidth = Math.min(MAX_POPUP_WIDTH5, Math.floor(termCols * 0.88));
|
|
@@ -510012,8 +510281,8 @@ var init_ToolsPopup = __esm(async () => {
|
|
|
510012
510281
|
});
|
|
510013
510282
|
|
|
510014
510283
|
// src/components/modals/MemoryBrowser.tsx
|
|
510015
|
-
import { existsSync as
|
|
510016
|
-
import { join as
|
|
510284
|
+
import { existsSync as existsSync62 } from "fs";
|
|
510285
|
+
import { join as join68 } from "path";
|
|
510017
510286
|
function timeAgo2(iso) {
|
|
510018
510287
|
const ms = Date.now() - Date.parse(iso);
|
|
510019
510288
|
if (!Number.isFinite(ms) || ms < 0)
|
|
@@ -510072,7 +510341,7 @@ function MemoryBrowser({ visible, contextManager, cwd: cwd2, onClose, onSystemMe
|
|
|
510072
510341
|
}, []);
|
|
510073
510342
|
const fileExists = import_react160.useCallback((p3) => {
|
|
510074
510343
|
try {
|
|
510075
|
-
return
|
|
510344
|
+
return existsSync62(join68(cwd2, p3));
|
|
510076
510345
|
} catch {
|
|
510077
510346
|
return false;
|
|
510078
510347
|
}
|
|
@@ -510818,12 +511087,12 @@ __export(exports_claim, {
|
|
|
510818
511087
|
bindClaimedSessions: () => bindClaimedSessions,
|
|
510819
511088
|
autoClaimDaemonWorkspaces: () => autoClaimDaemonWorkspaces
|
|
510820
511089
|
});
|
|
510821
|
-
import { existsSync as
|
|
511090
|
+
import { existsSync as existsSync63 } from "fs";
|
|
510822
511091
|
async function autoClaimDaemonWorkspaces(cwd2) {
|
|
510823
511092
|
const config2 = loadHearthConfig(cwd2);
|
|
510824
511093
|
const socketPath = config2.daemon.socketPath;
|
|
510825
511094
|
const out2 = { sessions: [], errors: [] };
|
|
510826
|
-
if (!
|
|
511095
|
+
if (!existsSync63(socketPath))
|
|
510827
511096
|
return out2;
|
|
510828
511097
|
let list;
|
|
510829
511098
|
try {
|
|
@@ -510890,7 +511159,7 @@ var exports_App = {};
|
|
|
510890
511159
|
__export(exports_App, {
|
|
510891
511160
|
App: () => App
|
|
510892
511161
|
});
|
|
510893
|
-
import { join as
|
|
511162
|
+
import { join as join69 } from "path";
|
|
510894
511163
|
import { TextAttributes as TextAttributes30 } from "@opentui/core";
|
|
510895
511164
|
function truncate5(str, max) {
|
|
510896
511165
|
return str.length > max ? `${str.slice(0, max - 1)}\u2026` : str;
|
|
@@ -511791,7 +512060,7 @@ function App({
|
|
|
511791
512060
|
(async () => {
|
|
511792
512061
|
try {
|
|
511793
512062
|
const { mkdir: mkdir8, writeFile: writeFile12 } = await import("fs/promises");
|
|
511794
|
-
const dir =
|
|
512063
|
+
const dir = join69(cwd2, ".soulforge");
|
|
511795
512064
|
await mkdir8(dir, { recursive: true });
|
|
511796
512065
|
const activeChat = tabMgr.getActiveChat();
|
|
511797
512066
|
const layout = tabMgr.tabs.map((t2) => ({
|
|
@@ -511799,7 +512068,7 @@ function App({
|
|
|
511799
512068
|
label: t2.label,
|
|
511800
512069
|
activeModel: t2.id === tabMgr.activeTabId ? activeChat?.activeModel : undefined
|
|
511801
512070
|
}));
|
|
511802
|
-
await writeFile12(
|
|
512071
|
+
await writeFile12(join69(dir, "tabs.json"), JSON.stringify(layout, null, 2));
|
|
511803
512072
|
} catch {}
|
|
511804
512073
|
})();
|
|
511805
512074
|
}, [tabMgr.tabCount, tabMgr.activeTabId]);
|
|
@@ -512920,8 +513189,8 @@ init_theme();
|
|
|
512920
513189
|
init_resolve_cwd();
|
|
512921
513190
|
init_splash();
|
|
512922
513191
|
init_errors();
|
|
512923
|
-
import { existsSync as
|
|
512924
|
-
import { join as
|
|
513192
|
+
import { existsSync as existsSync64, readFileSync as readFileSync35 } from "fs";
|
|
513193
|
+
import { join as join70 } from "path";
|
|
512925
513194
|
globalThis.AI_SDK_LOG_WARNINGS = false;
|
|
512926
513195
|
installGlobalFetch();
|
|
512927
513196
|
reapOrphanedLspProcesses();
|
|
@@ -512995,13 +513264,13 @@ if (cliArgs.includes("--presets") || cliArgs[0] === "presets") {
|
|
|
512995
513264
|
}
|
|
512996
513265
|
var IS_COMPILED4 = isCompiledBinary(import.meta.url);
|
|
512997
513266
|
if (IS_COMPILED4) {
|
|
512998
|
-
const bundledWorker =
|
|
512999
|
-
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH &&
|
|
513267
|
+
const bundledWorker = join70(dataDir(), "opentui-assets", "parser.worker.js");
|
|
513268
|
+
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH && existsSync64(bundledWorker)) {
|
|
513000
513269
|
process.env.OTUI_TREE_SITTER_WORKER_PATH = bundledWorker;
|
|
513001
513270
|
}
|
|
513002
513271
|
}
|
|
513003
513272
|
try {
|
|
513004
|
-
const raw2 =
|
|
513273
|
+
const raw2 = readFileSync35(join70(configDir(), "config.json"), "utf-8");
|
|
513005
513274
|
const cfg = JSON.parse(raw2);
|
|
513006
513275
|
if (cfg.theme?.name)
|
|
513007
513276
|
applyTheme(cfg.theme.name, cfg.theme?.transparent, {
|