@proxysoul/soulforge 2.20.1 → 2.20.3
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 +676 -420
- 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.3",
|
|
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") {
|
|
@@ -403175,6 +403196,108 @@ var init_prerequisites = __esm(() => {
|
|
|
403175
403196
|
];
|
|
403176
403197
|
});
|
|
403177
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
|
+
|
|
403178
403301
|
// src/index.tsx
|
|
403179
403302
|
var exports_src = {};
|
|
403180
403303
|
__export(exports_src, {
|
|
@@ -403498,6 +403621,24 @@ async function start2(opts) {
|
|
|
403498
403621
|
} catch {}
|
|
403499
403622
|
}
|
|
403500
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 {}
|
|
403501
403642
|
opts.createRoot(r).render(/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(AppRoot, {
|
|
403502
403643
|
opts
|
|
403503
403644
|
}, undefined, false, undefined, this));
|
|
@@ -405790,13 +405931,13 @@ function buildPrepareStep({
|
|
|
405790
405931
|
})
|
|
405791
405932
|
};
|
|
405792
405933
|
const json3 = JSON.stringify(exportData, null, 2);
|
|
405793
|
-
import("fs").then(({ mkdirSync:
|
|
405934
|
+
import("fs").then(({ mkdirSync: mkdirSync21, writeFileSync: writeFileSync16 }) => {
|
|
405794
405935
|
const dir = `${getCwd()}/.soulforge/api-export`;
|
|
405795
|
-
|
|
405936
|
+
mkdirSync21(dir, { recursive: true });
|
|
405796
405937
|
const subDir = agentId ? `${dir}/subagents/${agentId}` : dir;
|
|
405797
|
-
|
|
405938
|
+
mkdirSync21(subDir, { recursive: true });
|
|
405798
405939
|
const file2 = `${subDir}/step-${String(stepNumber).padStart(2, "0")}.json`;
|
|
405799
|
-
|
|
405940
|
+
writeFileSync16(file2, json3, "utf-8");
|
|
405800
405941
|
});
|
|
405801
405942
|
}
|
|
405802
405943
|
const contextSize = lastStep?.usage.inputTokens ?? 0;
|
|
@@ -406020,8 +406161,8 @@ var init_step_utils = __esm(() => {
|
|
|
406020
406161
|
|
|
406021
406162
|
// src/core/platform/clipboard.ts
|
|
406022
406163
|
import { execFile as execFile2, spawnSync as spawnSync6 } from "child_process";
|
|
406023
|
-
import { readFileSync as
|
|
406024
|
-
import { join as
|
|
406164
|
+
import { readFileSync as readFileSync20, unlinkSync as unlinkSync7 } from "fs";
|
|
406165
|
+
import { join as join38 } from "path";
|
|
406025
406166
|
function trySpawn(cmd, args2, text2) {
|
|
406026
406167
|
try {
|
|
406027
406168
|
const opts = {
|
|
@@ -406072,7 +406213,7 @@ function cleanup(tmpFile) {
|
|
|
406072
406213
|
} catch {}
|
|
406073
406214
|
}
|
|
406074
406215
|
function readImageDarwin() {
|
|
406075
|
-
const tmpFile =
|
|
406216
|
+
const tmpFile = join38(tmpDir(), `soulforge-clipboard-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.png`);
|
|
406076
406217
|
const script = [
|
|
406077
406218
|
"try",
|
|
406078
406219
|
" set pngData to the clipboard as \xABclass PNGf\xBB",
|
|
@@ -406095,7 +406236,7 @@ function readImageDarwin() {
|
|
|
406095
406236
|
return;
|
|
406096
406237
|
}
|
|
406097
406238
|
try {
|
|
406098
|
-
const data =
|
|
406239
|
+
const data = readFileSync20(tmpFile);
|
|
406099
406240
|
unlinkSync7(tmpFile);
|
|
406100
406241
|
if (data.length > 0) {
|
|
406101
406242
|
resolve14({ data, mediaType: "image/png" });
|
|
@@ -406126,7 +406267,7 @@ function readImageLinux() {
|
|
|
406126
406267
|
});
|
|
406127
406268
|
}
|
|
406128
406269
|
function readImageWindows() {
|
|
406129
|
-
const tmpFile =
|
|
406270
|
+
const tmpFile = join38(tmpDir(), `soulforge-clipboard-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.png`);
|
|
406130
406271
|
const ps = [
|
|
406131
406272
|
"param([Parameter(Mandatory)][string]$OutFile)",
|
|
406132
406273
|
"$ErrorActionPreference = 'SilentlyContinue';",
|
|
@@ -406145,7 +406286,7 @@ function readImageWindows() {
|
|
|
406145
406286
|
return;
|
|
406146
406287
|
}
|
|
406147
406288
|
try {
|
|
406148
|
-
const data =
|
|
406289
|
+
const data = readFileSync20(tmpFile);
|
|
406149
406290
|
unlinkSync7(tmpFile);
|
|
406150
406291
|
if (data.length > 0) {
|
|
406151
406292
|
resolve14({ data, mediaType: "image/png" });
|
|
@@ -406175,8 +406316,8 @@ __export(exports_export, {
|
|
|
406175
406316
|
exportToClipboard: () => exportToClipboard,
|
|
406176
406317
|
exportChat: () => exportChat
|
|
406177
406318
|
});
|
|
406178
|
-
import { mkdirSync as
|
|
406179
|
-
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";
|
|
406180
406321
|
function formatTimestamp(ts) {
|
|
406181
406322
|
const d2 = new Date(ts);
|
|
406182
406323
|
return d2.toLocaleString("en-US", {
|
|
@@ -406338,18 +406479,18 @@ function exportChat(messages, opts) {
|
|
|
406338
406479
|
const ext = format === "json" ? ".json" : ".md";
|
|
406339
406480
|
let outPath;
|
|
406340
406481
|
if (opts.outPath) {
|
|
406341
|
-
outPath = opts.outPath.startsWith("/") ? opts.outPath :
|
|
406482
|
+
outPath = opts.outPath.startsWith("/") ? opts.outPath : join39(opts.cwd, opts.outPath);
|
|
406342
406483
|
} else {
|
|
406343
|
-
const exportDir =
|
|
406344
|
-
|
|
406484
|
+
const exportDir = join39(opts.cwd, ".soulforge", "exports");
|
|
406485
|
+
mkdirSync21(exportDir, { recursive: true });
|
|
406345
406486
|
const stamp = new Date().toISOString().slice(0, 19).replace(/[T:]/g, "-");
|
|
406346
406487
|
const slug = slugify3(title);
|
|
406347
|
-
outPath =
|
|
406488
|
+
outPath = join39(exportDir, `${slug}-${stamp}${ext}`);
|
|
406348
406489
|
}
|
|
406349
406490
|
const parentDir = dirname14(outPath);
|
|
406350
|
-
|
|
406491
|
+
mkdirSync21(parentDir, { recursive: true });
|
|
406351
406492
|
const content = format === "json" ? exportToJson(messages) : exportToMarkdown(messages, title);
|
|
406352
|
-
|
|
406493
|
+
writeFileSync16(outPath, content, "utf-8");
|
|
406353
406494
|
const visible = messages.filter((m2) => m2.role !== "system" || m2.showInChat).length;
|
|
406354
406495
|
return { path: outPath, messageCount: visible, format };
|
|
406355
406496
|
}
|
|
@@ -406359,12 +406500,12 @@ var init_export = __esm(() => {
|
|
|
406359
406500
|
|
|
406360
406501
|
// src/core/commands/session.ts
|
|
406361
406502
|
async function handleExportAll(ctx) {
|
|
406362
|
-
const { mkdirSync:
|
|
406363
|
-
const { join:
|
|
406364
|
-
const exportDir =
|
|
406365
|
-
|
|
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 });
|
|
406366
406507
|
const stamp = new Date().toISOString().slice(0, 19).replace(/[T:]/g, "-");
|
|
406367
|
-
const outPath =
|
|
406508
|
+
const outPath = join40(exportDir, `diagnostic-${stamp}.json`);
|
|
406368
406509
|
const activeModel = ctx.chat.activeModel;
|
|
406369
406510
|
const systemPrompt = ctx.contextManager.buildSystemPrompt(activeModel);
|
|
406370
406511
|
const coreMessages = ctx.chat.coreMessages;
|
|
@@ -406412,7 +406553,7 @@ async function handleExportAll(ctx) {
|
|
|
406412
406553
|
coreMessageCount: coreMessages.length,
|
|
406413
406554
|
systemPromptLength: systemPrompt.length
|
|
406414
406555
|
};
|
|
406415
|
-
|
|
406556
|
+
writeFileSync17(outPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
406416
406557
|
const relPath = outPath.startsWith(ctx.cwd) ? outPath.slice(ctx.cwd.length + 1) : outPath;
|
|
406417
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)`);
|
|
406418
406559
|
const { dirname: dirname15 } = await import("path");
|
|
@@ -406582,8 +406723,8 @@ var init_session = __esm(async () => {
|
|
|
406582
406723
|
|
|
406583
406724
|
// src/core/commands/storage.ts
|
|
406584
406725
|
import { Database as Database5 } from "bun:sqlite";
|
|
406585
|
-
import { existsSync as
|
|
406586
|
-
import { join as
|
|
406726
|
+
import { existsSync as existsSync36, rmSync as rmSync3 } from "fs";
|
|
406727
|
+
import { join as join40 } from "path";
|
|
406587
406728
|
function openStorageMenu(ctx) {
|
|
406588
406729
|
const show = () => {
|
|
406589
406730
|
const s = computeStorageSizes(ctx.cwd);
|
|
@@ -406696,8 +406837,8 @@ function openStorageMenu(ctx) {
|
|
|
406696
406837
|
const cleared = sm.clearAllSessions();
|
|
406697
406838
|
sysMsg(ctx, `Cleared ${String(cleared)} sessions (freed ~${formatBytes(s.sessions)}).`);
|
|
406698
406839
|
} else if (value === "clear-history") {
|
|
406699
|
-
const historyPath =
|
|
406700
|
-
if (
|
|
406840
|
+
const historyPath = join40(s.globalDir, "history.db");
|
|
406841
|
+
if (existsSync36(historyPath) && s.history > 0) {
|
|
406701
406842
|
const ok = await confirm({
|
|
406702
406843
|
title: "Clear search history?",
|
|
406703
406844
|
message: `Prompt history and stash entries (${formatBytes(s.history)}) will be deleted globally. This cannot be undone.`,
|
|
@@ -406716,8 +406857,8 @@ function openStorageMenu(ctx) {
|
|
|
406716
406857
|
}
|
|
406717
406858
|
}
|
|
406718
406859
|
} else if (value === "clear-plans") {
|
|
406719
|
-
const plansDir =
|
|
406720
|
-
if (
|
|
406860
|
+
const plansDir = join40(s.projectDir, "plans");
|
|
406861
|
+
if (existsSync36(plansDir) && s.plans > 0) {
|
|
406721
406862
|
const ok = await confirm({
|
|
406722
406863
|
title: "Clear plans?",
|
|
406723
406864
|
message: `All saved plans (${formatBytes(s.plans)}) for this project will be deleted. This cannot be undone.`,
|
|
@@ -406731,13 +406872,13 @@ function openStorageMenu(ctx) {
|
|
|
406731
406872
|
} else if (value === "vacuum") {
|
|
406732
406873
|
let freed = 0;
|
|
406733
406874
|
const dbs = [
|
|
406734
|
-
|
|
406735
|
-
|
|
406736
|
-
|
|
406737
|
-
|
|
406875
|
+
join40(s.projectDir, "repomap.db"),
|
|
406876
|
+
join40(s.projectDir, "memory.db"),
|
|
406877
|
+
join40(s.globalDir, "history.db"),
|
|
406878
|
+
join40(s.globalDir, "memory.db")
|
|
406738
406879
|
];
|
|
406739
406880
|
for (const dbPath of dbs) {
|
|
406740
|
-
if (!
|
|
406881
|
+
if (!existsSync36(dbPath))
|
|
406741
406882
|
continue;
|
|
406742
406883
|
try {
|
|
406743
406884
|
const before = fileSize(dbPath);
|
|
@@ -407809,8 +407950,8 @@ __export(exports_addons, {
|
|
|
407809
407950
|
autoInstallFromEnv: () => autoInstallFromEnv,
|
|
407810
407951
|
ADDON_NAMES: () => ADDON_NAMES
|
|
407811
407952
|
});
|
|
407812
|
-
import { existsSync as
|
|
407813
|
-
import { join as
|
|
407953
|
+
import { existsSync as existsSync37, rmSync as rmSync4 } from "fs";
|
|
407954
|
+
import { join as join41 } from "path";
|
|
407814
407955
|
function isAddonInstalled(name39) {
|
|
407815
407956
|
if (name39 === "proxy") {
|
|
407816
407957
|
return getVendoredPath("cli-proxy-api") !== null || commandExists("cli-proxy-api") || commandExists("cliproxyapi");
|
|
@@ -407841,7 +407982,7 @@ function listAddons() {
|
|
|
407841
407982
|
const record2 = cfg.addons?.[name39];
|
|
407842
407983
|
const vendored = isVendoredAddonInstalled(name39);
|
|
407843
407984
|
const installed2 = isAddonInstalled(name39);
|
|
407844
|
-
const path = vendored ?
|
|
407985
|
+
const path = vendored ? join41(BIN_DIR2, ADDON_BIN[name39]) : undefined;
|
|
407845
407986
|
return {
|
|
407846
407987
|
name: name39,
|
|
407847
407988
|
installed: installed2,
|
|
@@ -407896,8 +408037,8 @@ async function removeAddon(name39, onStatus) {
|
|
|
407896
408037
|
stopProxy2();
|
|
407897
408038
|
} catch {}
|
|
407898
408039
|
}
|
|
407899
|
-
const binPath =
|
|
407900
|
-
if (
|
|
408040
|
+
const binPath = join41(BIN_DIR2, ADDON_BIN[name39]);
|
|
408041
|
+
if (existsSync37(binPath)) {
|
|
407901
408042
|
try {
|
|
407902
408043
|
rmSync4(binPath, { force: true });
|
|
407903
408044
|
} catch (err2) {
|
|
@@ -407907,10 +408048,10 @@ async function removeAddon(name39, onStatus) {
|
|
|
407907
408048
|
const prefix = ADDON_INSTALL_PREFIX[name39];
|
|
407908
408049
|
try {
|
|
407909
408050
|
const { readdirSync: readdirSync10 } = await import("fs");
|
|
407910
|
-
if (
|
|
408051
|
+
if (existsSync37(INSTALLS_DIR2)) {
|
|
407911
408052
|
for (const entry of readdirSync10(INSTALLS_DIR2)) {
|
|
407912
408053
|
if (entry.startsWith(prefix) && /\d/.test(entry.slice(prefix.length, prefix.length + 1))) {
|
|
407913
|
-
rmSync4(
|
|
408054
|
+
rmSync4(join41(INSTALLS_DIR2, entry), { recursive: true, force: true });
|
|
407914
408055
|
}
|
|
407915
408056
|
}
|
|
407916
408057
|
}
|
|
@@ -408087,8 +408228,8 @@ var init_addons = __esm(() => {
|
|
|
408087
408228
|
init_platform();
|
|
408088
408229
|
init_install();
|
|
408089
408230
|
ADDON_NAMES = ["proxy", "neovim"];
|
|
408090
|
-
BIN_DIR2 =
|
|
408091
|
-
INSTALLS_DIR2 =
|
|
408231
|
+
BIN_DIR2 = join41(dataDir(), "bin");
|
|
408232
|
+
INSTALLS_DIR2 = join41(dataDir(), "installs");
|
|
408092
408233
|
ADDON_BIN = {
|
|
408093
408234
|
proxy: `cli-proxy-api${EXE}`,
|
|
408094
408235
|
neovim: `nvim${EXE}`
|
|
@@ -409381,7 +409522,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
|
|
|
409381
409522
|
});
|
|
409382
409523
|
const hasFiles = files != null && files.length > 0;
|
|
409383
409524
|
const imageUrls = hasFiles ? files.map((file2) => convertImageModelFileToDataUri(file2)) : [];
|
|
409384
|
-
const
|
|
409525
|
+
const endpoint2 = hasFiles ? "/images/edits" : "/images/generations";
|
|
409385
409526
|
const body2 = {
|
|
409386
409527
|
model: this.modelId,
|
|
409387
409528
|
prompt,
|
|
@@ -409417,7 +409558,7 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
|
|
|
409417
409558
|
const baseURL2 = (_a31 = this.config.baseURL) != null ? _a31 : "https://api.x.ai/v1";
|
|
409418
409559
|
const currentDate = (_d = (_c = (_b16 = this.config._internal) == null ? undefined : _b16.currentDate) == null ? undefined : _c.call(_b16)) != null ? _d : /* @__PURE__ */ new Date;
|
|
409419
409560
|
const { value: response, responseHeaders } = await postJsonToApi({
|
|
409420
|
-
url: `${baseURL2}${
|
|
409561
|
+
url: `${baseURL2}${endpoint2}`,
|
|
409421
409562
|
headers: combineHeaders(this.config.headers(), headers),
|
|
409422
409563
|
body: body2,
|
|
409423
409564
|
failedResponseHandler: xaiFailedResponseHandler,
|
|
@@ -410306,16 +410447,16 @@ var webSourceSchema, xSourceSchema, newsSourceSchema, rssSourceSchema, searchSou
|
|
|
410306
410447
|
}
|
|
410307
410448
|
}
|
|
410308
410449
|
const baseURL2 = (_d = this.config.baseURL) != null ? _d : "https://api.x.ai/v1";
|
|
410309
|
-
let
|
|
410450
|
+
let endpoint2;
|
|
410310
410451
|
if (isEdit) {
|
|
410311
|
-
|
|
410452
|
+
endpoint2 = `${baseURL2}/videos/edits`;
|
|
410312
410453
|
} else if (isExtension) {
|
|
410313
|
-
|
|
410454
|
+
endpoint2 = `${baseURL2}/videos/extensions`;
|
|
410314
410455
|
} else {
|
|
410315
|
-
|
|
410456
|
+
endpoint2 = `${baseURL2}/videos/generations`;
|
|
410316
410457
|
}
|
|
410317
410458
|
const { value: createResponse } = await postJsonToApi({
|
|
410318
|
-
url:
|
|
410459
|
+
url: endpoint2,
|
|
410319
410460
|
headers: combineHeaders(this.config.headers(), options.headers),
|
|
410320
410461
|
body: body2,
|
|
410321
410462
|
failedResponseHandler: xaiFailedResponseHandler,
|
|
@@ -411297,6 +411438,7 @@ __export(exports_providers, {
|
|
|
411297
411438
|
minimax: () => minimax2,
|
|
411298
411439
|
lmstudio: () => lmstudio,
|
|
411299
411440
|
llmgateway: () => llmgateway2,
|
|
411441
|
+
isBuiltinProvider: () => isBuiltinProvider,
|
|
411300
411442
|
groq: () => groq2,
|
|
411301
411443
|
google: () => google2,
|
|
411302
411444
|
githubModels: () => githubModels,
|
|
@@ -411338,6 +411480,9 @@ function registerCustomProviders(configs) {
|
|
|
411338
411480
|
function getProvider(id) {
|
|
411339
411481
|
return providerMap.get(id);
|
|
411340
411482
|
}
|
|
411483
|
+
function isBuiltinProvider(id) {
|
|
411484
|
+
return BUILTIN_PROVIDER_IDS.has(id);
|
|
411485
|
+
}
|
|
411341
411486
|
function getAllProviders() {
|
|
411342
411487
|
return allProviders;
|
|
411343
411488
|
}
|
|
@@ -411350,7 +411495,7 @@ function getProviderSecretEntries() {
|
|
|
411350
411495
|
keyUrl: p.keyUrl
|
|
411351
411496
|
}));
|
|
411352
411497
|
}
|
|
411353
|
-
var BUILTIN_PROVIDERS, allProviders, providerMap, changeListeners;
|
|
411498
|
+
var BUILTIN_PROVIDERS, allProviders, providerMap, changeListeners, BUILTIN_PROVIDER_IDS;
|
|
411354
411499
|
var init_providers = __esm(() => {
|
|
411355
411500
|
init_anthropic();
|
|
411356
411501
|
init_bedrock();
|
|
@@ -411425,6 +411570,7 @@ var init_providers = __esm(() => {
|
|
|
411425
411570
|
allProviders = [...BUILTIN_PROVIDERS];
|
|
411426
411571
|
providerMap = new Map(allProviders.map((p) => [p.id, p]));
|
|
411427
411572
|
changeListeners = [];
|
|
411573
|
+
BUILTIN_PROVIDER_IDS = new Set(BUILTIN_PROVIDERS.map((p) => p.id));
|
|
411428
411574
|
});
|
|
411429
411575
|
|
|
411430
411576
|
// src/core/llm/models.ts
|
|
@@ -411939,6 +412085,25 @@ var init_models = __esm(() => {
|
|
|
411939
412085
|
});
|
|
411940
412086
|
|
|
411941
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
|
+
});
|
|
411942
412107
|
function parseModelId(modelId) {
|
|
411943
412108
|
const slash = modelId.indexOf("/");
|
|
411944
412109
|
if (slash === -1)
|
|
@@ -412124,6 +412289,16 @@ function getEffectiveCaps(modelId) {
|
|
|
412124
412289
|
function isAnthropicNative(modelId) {
|
|
412125
412290
|
return detectModelFamily(modelId) === "claude";
|
|
412126
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
|
+
}
|
|
412127
412302
|
function getSupportedClaudeEfforts(modelId) {
|
|
412128
412303
|
const base = extractBaseModel2(modelId);
|
|
412129
412304
|
if (!base.startsWith("claude"))
|
|
@@ -412138,7 +412313,7 @@ function getSupportedClaudeEfforts(modelId) {
|
|
|
412138
412313
|
return ["max", "high", "medium", "low"];
|
|
412139
412314
|
}
|
|
412140
412315
|
if (base.includes("opus-4-5") || base.includes("opus-4.5")) {
|
|
412141
|
-
return ["high", "medium", "low"];
|
|
412316
|
+
return ["max", "high", "medium", "low"];
|
|
412142
412317
|
}
|
|
412143
412318
|
return ["high", "medium", "low"];
|
|
412144
412319
|
}
|
|
@@ -412157,6 +412332,25 @@ function clampEffort(modelId, effort) {
|
|
|
412157
412332
|
}
|
|
412158
412333
|
return supported[supported.length - 1] ?? null;
|
|
412159
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
|
+
}
|
|
412160
412354
|
function supportsProgrammaticToolCalling(modelId) {
|
|
412161
412355
|
const base = extractBaseModel2(modelId);
|
|
412162
412356
|
const gen = getClaudeGen(base);
|
|
@@ -412585,7 +412779,7 @@ function buildGroqOptions(config2) {
|
|
|
412585
412779
|
function isDeepSeekReasoner(base) {
|
|
412586
412780
|
return base === "deepseek-reasoner" || base.includes("reasoner") || base.endsWith("-think");
|
|
412587
412781
|
}
|
|
412588
|
-
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;
|
|
412589
412783
|
var init_provider_options = __esm(() => {
|
|
412590
412784
|
init_models();
|
|
412591
412785
|
init_providers();
|
|
@@ -412704,6 +412898,14 @@ var init_provider_options = __esm(() => {
|
|
|
412704
412898
|
"claude-2",
|
|
412705
412899
|
"claude-instant"
|
|
412706
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
|
+
];
|
|
412707
412909
|
CACHE_EPHEMERAL_5M = {
|
|
412708
412910
|
cacheControl: { type: "ephemeral", ttl: "5m" }
|
|
412709
412911
|
};
|
|
@@ -413106,7 +413308,7 @@ var init_embedder = __esm(() => {
|
|
|
413106
413308
|
|
|
413107
413309
|
// src/core/memory/db.ts
|
|
413108
413310
|
import { Database as Database6 } from "bun:sqlite";
|
|
413109
|
-
import { chmodSync as chmodSync4, existsSync as
|
|
413311
|
+
import { chmodSync as chmodSync4, existsSync as existsSync38, mkdirSync as mkdirSync22 } from "fs";
|
|
413110
413312
|
import { dirname as dirname15 } from "path";
|
|
413111
413313
|
|
|
413112
413314
|
class MemoryDB {
|
|
@@ -413117,8 +413319,8 @@ class MemoryDB {
|
|
|
413117
413319
|
this.scope = scope;
|
|
413118
413320
|
if (dbPath !== ":memory:") {
|
|
413119
413321
|
const dir = dirname15(dbPath);
|
|
413120
|
-
if (!
|
|
413121
|
-
|
|
413322
|
+
if (!existsSync38(dir))
|
|
413323
|
+
mkdirSync22(dir, { recursive: true });
|
|
413122
413324
|
}
|
|
413123
413325
|
this.legacyBackupPath = dbPath !== ":memory:" ? rotateLegacyDb(dbPath) : null;
|
|
413124
413326
|
this.db = new Database6(dbPath);
|
|
@@ -414001,7 +414203,7 @@ function codePointCount(s) {
|
|
|
414001
414203
|
return n;
|
|
414002
414204
|
}
|
|
414003
414205
|
function rotateLegacyDb(dbPath) {
|
|
414004
|
-
if (!
|
|
414206
|
+
if (!existsSync38(dbPath))
|
|
414005
414207
|
return null;
|
|
414006
414208
|
let needsRotation = false;
|
|
414007
414209
|
let probe = null;
|
|
@@ -414023,7 +414225,7 @@ function rotateLegacyDb(dbPath) {
|
|
|
414023
414225
|
try {
|
|
414024
414226
|
safeRename(dbPath, backup);
|
|
414025
414227
|
for (const suffix of ["-wal", "-shm"]) {
|
|
414026
|
-
if (
|
|
414228
|
+
if (existsSync38(dbPath + suffix)) {
|
|
414027
414229
|
try {
|
|
414028
414230
|
safeRename(dbPath + suffix, backup + suffix);
|
|
414029
414231
|
} catch {}
|
|
@@ -414094,8 +414296,8 @@ var init_db2 = __esm(() => {
|
|
|
414094
414296
|
});
|
|
414095
414297
|
|
|
414096
414298
|
// src/core/memory/manager.ts
|
|
414097
|
-
import { existsSync as
|
|
414098
|
-
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";
|
|
414099
414301
|
|
|
414100
414302
|
class MemoryManager {
|
|
414101
414303
|
globalDb;
|
|
@@ -414121,22 +414323,22 @@ class MemoryManager {
|
|
|
414121
414323
|
constructor(cwd, globalDir) {
|
|
414122
414324
|
this.cwd = cwd;
|
|
414123
414325
|
this._globalDir = globalDir ?? configDir();
|
|
414124
|
-
const globalPath =
|
|
414125
|
-
const projectPath =
|
|
414326
|
+
const globalPath = join42(this._globalDir, "memory.db");
|
|
414327
|
+
const projectPath = join42(cwd, ".soulforge", "memory.db");
|
|
414126
414328
|
this.globalDb = new MemoryDB(globalPath, "global");
|
|
414127
414329
|
this.projectDb = new MemoryDB(projectPath, "project");
|
|
414128
414330
|
this.loadConfig();
|
|
414129
414331
|
}
|
|
414130
414332
|
configPath(scope) {
|
|
414131
|
-
return scope === "global" ?
|
|
414333
|
+
return scope === "global" ? join42(this._globalDir, CONFIG_FILE) : join42(this.cwd, ".soulforge", CONFIG_FILE);
|
|
414132
414334
|
}
|
|
414133
414335
|
loadConfig() {
|
|
414134
414336
|
for (const scope of ["project", "global"]) {
|
|
414135
414337
|
const path = this.configPath(scope);
|
|
414136
|
-
if (!
|
|
414338
|
+
if (!existsSync39(path))
|
|
414137
414339
|
continue;
|
|
414138
414340
|
try {
|
|
414139
|
-
const data = JSON.parse(
|
|
414341
|
+
const data = JSON.parse(readFileSync21(path, "utf-8"));
|
|
414140
414342
|
if (data.writeScope && data.readScope) {
|
|
414141
414343
|
this._scopeConfig = { writeScope: data.writeScope, readScope: data.readScope };
|
|
414142
414344
|
this._settingsScope = scope;
|
|
@@ -414150,15 +414352,15 @@ class MemoryManager {
|
|
|
414150
414352
|
saveConfig(to) {
|
|
414151
414353
|
const path = this.configPath(to);
|
|
414152
414354
|
const dir = dirname16(path);
|
|
414153
|
-
if (!
|
|
414154
|
-
|
|
414355
|
+
if (!existsSync39(dir))
|
|
414356
|
+
mkdirSync23(dir, { recursive: true });
|
|
414155
414357
|
const payload = { ...this._scopeConfig, cleanup: this._cleanup };
|
|
414156
|
-
|
|
414358
|
+
writeFileSync17(path, JSON.stringify(payload, null, 2), "utf-8");
|
|
414157
414359
|
this._settingsScope = to;
|
|
414158
414360
|
}
|
|
414159
414361
|
deleteConfig(from) {
|
|
414160
414362
|
const path = this.configPath(from);
|
|
414161
|
-
if (
|
|
414363
|
+
if (existsSync39(path))
|
|
414162
414364
|
rmSync5(path);
|
|
414163
414365
|
if (from === this._settingsScope) {
|
|
414164
414366
|
this._settingsScope = "project";
|
|
@@ -414383,7 +414585,7 @@ class MemoryManager {
|
|
|
414383
414585
|
}
|
|
414384
414586
|
deleteConfigOnly(from) {
|
|
414385
414587
|
const path = this.configPath(from);
|
|
414386
|
-
if (
|
|
414588
|
+
if (existsSync39(path)) {
|
|
414387
414589
|
try {
|
|
414388
414590
|
rmSync5(path);
|
|
414389
414591
|
} catch {}
|
|
@@ -415674,7 +415876,7 @@ __export(exports_tee, {
|
|
|
415674
415876
|
saveTee: () => saveTee
|
|
415675
415877
|
});
|
|
415676
415878
|
import { mkdir, readdir as readdir3, unlink, writeFile as writeFile3 } from "fs/promises";
|
|
415677
|
-
import { join as
|
|
415879
|
+
import { join as join43 } from "path";
|
|
415678
415880
|
async function ensureDir2() {
|
|
415679
415881
|
if (dirReady)
|
|
415680
415882
|
return;
|
|
@@ -415688,7 +415890,7 @@ async function pruneOldFiles() {
|
|
|
415688
415890
|
if (toRemove > 0) {
|
|
415689
415891
|
for (const f of files.slice(0, toRemove)) {
|
|
415690
415892
|
try {
|
|
415691
|
-
await unlink(
|
|
415893
|
+
await unlink(join43(TEE_DIR, f));
|
|
415692
415894
|
} catch {}
|
|
415693
415895
|
}
|
|
415694
415896
|
}
|
|
@@ -415699,7 +415901,7 @@ async function saveTee(label, content) {
|
|
|
415699
415901
|
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
415700
415902
|
const safeName = label.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 40);
|
|
415701
415903
|
const filename = `${ts}_${safeName}.txt`;
|
|
415702
|
-
const filepath =
|
|
415904
|
+
const filepath = join43(TEE_DIR, filename);
|
|
415703
415905
|
let toWrite = content;
|
|
415704
415906
|
if (content.length > MAX_TEE_BYTES) {
|
|
415705
415907
|
const half = Math.floor(MAX_TEE_BYTES / 2);
|
|
@@ -415745,7 +415947,7 @@ function withTimeout2(p, ms, label) {
|
|
|
415745
415947
|
var TEE_DIR, MAX_TEE_FILES = 20, MAX_TEE_BYTES = 512000, dirReady = false;
|
|
415746
415948
|
var init_tee = __esm(() => {
|
|
415747
415949
|
init_platform();
|
|
415748
|
-
TEE_DIR =
|
|
415950
|
+
TEE_DIR = join43(userDataDir(), "tee");
|
|
415749
415951
|
});
|
|
415750
415952
|
|
|
415751
415953
|
// src/core/tools/tool-timeout.ts
|
|
@@ -415776,7 +415978,7 @@ __export(exports_project, {
|
|
|
415776
415978
|
detectNativeChecks: () => detectNativeChecks
|
|
415777
415979
|
});
|
|
415778
415980
|
import { access, readdir as readdir4, readFile as readFile9 } from "fs/promises";
|
|
415779
|
-
import { dirname as dirname17, join as
|
|
415981
|
+
import { dirname as dirname17, join as join44 } from "path";
|
|
415780
415982
|
function shellQuote(s) {
|
|
415781
415983
|
return `'${s.replace(/'/g, "'\\''")}'`;
|
|
415782
415984
|
}
|
|
@@ -415799,7 +416001,7 @@ async function detectProfile(cwd) {
|
|
|
415799
416001
|
};
|
|
415800
416002
|
const has = async (f) => {
|
|
415801
416003
|
try {
|
|
415802
|
-
await access(
|
|
416004
|
+
await access(join44(cwd, f));
|
|
415803
416005
|
return true;
|
|
415804
416006
|
} catch {
|
|
415805
416007
|
return false;
|
|
@@ -415943,7 +416145,7 @@ async function detectProfile(cwd) {
|
|
|
415943
416145
|
const gw = await has("gradlew") ? "./gradlew" : "gradle";
|
|
415944
416146
|
profile.test = `${gw} test`;
|
|
415945
416147
|
profile.build = `${gw} build`;
|
|
415946
|
-
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"));
|
|
415947
416149
|
if (buildFile.includes("spotless"))
|
|
415948
416150
|
profile.lint = `${gw} spotlessCheck`;
|
|
415949
416151
|
else if (buildFile.includes("ktlint"))
|
|
@@ -416027,7 +416229,7 @@ async function detectJsPm(cwd) {
|
|
|
416027
416229
|
for (let i2 = 0;i2 < 5; i2++) {
|
|
416028
416230
|
for (const [file2, pm] of lockfiles) {
|
|
416029
416231
|
try {
|
|
416030
|
-
await access(
|
|
416232
|
+
await access(join44(dir, file2));
|
|
416031
416233
|
return pm;
|
|
416032
416234
|
} catch {}
|
|
416033
416235
|
}
|
|
@@ -416040,7 +416242,7 @@ async function detectJsPm(cwd) {
|
|
|
416040
416242
|
}
|
|
416041
416243
|
async function readPackageScripts(cwd) {
|
|
416042
416244
|
try {
|
|
416043
|
-
const pkg = JSON.parse(await readFile9(
|
|
416245
|
+
const pkg = JSON.parse(await readFile9(join44(cwd, "package.json"), "utf-8"));
|
|
416044
416246
|
return pkg.scripts ?? {};
|
|
416045
416247
|
} catch {
|
|
416046
416248
|
return {};
|
|
@@ -416049,7 +416251,7 @@ async function readPackageScripts(cwd) {
|
|
|
416049
416251
|
async function detectJsLinter(cwd, runner = "") {
|
|
416050
416252
|
const has = async (f) => {
|
|
416051
416253
|
try {
|
|
416052
|
-
await access(
|
|
416254
|
+
await access(join44(cwd, f));
|
|
416053
416255
|
return true;
|
|
416054
416256
|
} catch {
|
|
416055
416257
|
return false;
|
|
@@ -416067,7 +416269,7 @@ async function detectJsLinter(cwd, runner = "") {
|
|
|
416067
416269
|
async function detectJsFormatter(cwd, runner = "") {
|
|
416068
416270
|
const has = async (f) => {
|
|
416069
416271
|
try {
|
|
416070
|
-
await access(
|
|
416272
|
+
await access(join44(cwd, f));
|
|
416071
416273
|
return true;
|
|
416072
416274
|
} catch {
|
|
416073
416275
|
return false;
|
|
@@ -416085,7 +416287,7 @@ async function detectJsFormatter(cwd, runner = "") {
|
|
|
416085
416287
|
async function detectFormatAndLint(cwd, runner = "") {
|
|
416086
416288
|
const has = async (f) => {
|
|
416087
416289
|
try {
|
|
416088
|
-
await access(
|
|
416290
|
+
await access(join44(cwd, f));
|
|
416089
416291
|
return true;
|
|
416090
416292
|
} catch {
|
|
416091
416293
|
return false;
|
|
@@ -416100,7 +416302,7 @@ async function detectFormatAndLint(cwd, runner = "") {
|
|
|
416100
416302
|
async function detectJsTypecheck(cwd) {
|
|
416101
416303
|
const has = async (f) => {
|
|
416102
416304
|
try {
|
|
416103
|
-
await access(
|
|
416305
|
+
await access(join44(cwd, f));
|
|
416104
416306
|
return true;
|
|
416105
416307
|
} catch {
|
|
416106
416308
|
return false;
|
|
@@ -416118,7 +416320,7 @@ async function detectJsTypecheck(cwd) {
|
|
|
416118
416320
|
async function detectNativeChecks(cwd) {
|
|
416119
416321
|
const has = async (f) => {
|
|
416120
416322
|
try {
|
|
416121
|
-
await access(
|
|
416323
|
+
await access(join44(cwd, f));
|
|
416122
416324
|
return true;
|
|
416123
416325
|
} catch {
|
|
416124
416326
|
return false;
|
|
@@ -416165,7 +416367,7 @@ async function detectNativeChecks(cwd) {
|
|
|
416165
416367
|
async function discoverPackages(cwd) {
|
|
416166
416368
|
const has = async (f) => {
|
|
416167
416369
|
try {
|
|
416168
|
-
await access(
|
|
416370
|
+
await access(join44(cwd, f));
|
|
416169
416371
|
return true;
|
|
416170
416372
|
} catch {
|
|
416171
416373
|
return false;
|
|
@@ -416178,20 +416380,20 @@ async function discoverPackages(cwd) {
|
|
|
416178
416380
|
const base = glob.replace(/\/?\*.*$/, "");
|
|
416179
416381
|
if (!base)
|
|
416180
416382
|
continue;
|
|
416181
|
-
await scanDir(
|
|
416383
|
+
await scanDir(join44(cwd, base), cwd, packages, "package.json");
|
|
416182
416384
|
}
|
|
416183
416385
|
}
|
|
416184
416386
|
if (await has("Cargo.toml")) {
|
|
416185
416387
|
try {
|
|
416186
|
-
const cargo = await readFile9(
|
|
416388
|
+
const cargo = await readFile9(join44(cwd, "Cargo.toml"), "utf-8");
|
|
416187
416389
|
const membersMatch = cargo.match(/members\s*=\s*\[([\s\S]*?)\]/);
|
|
416188
416390
|
if (membersMatch?.[1]) {
|
|
416189
416391
|
const members = membersMatch[1].match(/["']([^"']+)["']/g)?.map((m2) => m2.replace(/["']/g, "")) ?? [];
|
|
416190
416392
|
for (const member of members) {
|
|
416191
416393
|
if (member.includes("*")) {
|
|
416192
|
-
await scanDir(
|
|
416193
|
-
} else if (await has(
|
|
416194
|
-
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);
|
|
416195
416397
|
}
|
|
416196
416398
|
}
|
|
416197
416399
|
}
|
|
@@ -416199,12 +416401,12 @@ async function discoverPackages(cwd) {
|
|
|
416199
416401
|
}
|
|
416200
416402
|
if (await has("go.work")) {
|
|
416201
416403
|
try {
|
|
416202
|
-
const goWork = await readFile9(
|
|
416404
|
+
const goWork = await readFile9(join44(cwd, "go.work"), "utf-8");
|
|
416203
416405
|
const useMatch = goWork.match(/use\s*\(([\s\S]*?)\)/);
|
|
416204
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()) ?? [];
|
|
416205
416407
|
for (const dir of dirs) {
|
|
416206
|
-
if (await has(
|
|
416207
|
-
await addPackage(packages,
|
|
416408
|
+
if (await has(join44(dir, "go.mod"))) {
|
|
416409
|
+
await addPackage(packages, join44(cwd, dir), cwd);
|
|
416208
416410
|
}
|
|
416209
416411
|
}
|
|
416210
416412
|
} catch {}
|
|
@@ -416214,7 +416416,7 @@ async function discoverPackages(cwd) {
|
|
|
416214
416416
|
async function getJsWorkspaceGlobs(cwd) {
|
|
416215
416417
|
const has = async (f) => {
|
|
416216
416418
|
try {
|
|
416217
|
-
await access(
|
|
416419
|
+
await access(join44(cwd, f));
|
|
416218
416420
|
return true;
|
|
416219
416421
|
} catch {
|
|
416220
416422
|
return false;
|
|
@@ -416222,7 +416424,7 @@ async function getJsWorkspaceGlobs(cwd) {
|
|
|
416222
416424
|
};
|
|
416223
416425
|
if (await has("pnpm-workspace.yaml")) {
|
|
416224
416426
|
try {
|
|
416225
|
-
const raw = await readFile9(
|
|
416427
|
+
const raw = await readFile9(join44(cwd, "pnpm-workspace.yaml"), "utf-8");
|
|
416226
416428
|
const quoted = raw.match(/['"]([^'"]+)['"]/g)?.map((g3) => g3.replace(/['"]/g, "")) ?? [];
|
|
416227
416429
|
if (quoted.length > 0)
|
|
416228
416430
|
return quoted;
|
|
@@ -416232,7 +416434,7 @@ async function getJsWorkspaceGlobs(cwd) {
|
|
|
416232
416434
|
}
|
|
416233
416435
|
if (await has("package.json")) {
|
|
416234
416436
|
try {
|
|
416235
|
-
const pkg = JSON.parse(await readFile9(
|
|
416437
|
+
const pkg = JSON.parse(await readFile9(join44(cwd, "package.json"), "utf-8"));
|
|
416236
416438
|
const w2 = pkg.workspaces;
|
|
416237
416439
|
return Array.isArray(w2) ? w2 : Array.isArray(w2?.packages) ? w2.packages : [];
|
|
416238
416440
|
} catch {}
|
|
@@ -416245,9 +416447,9 @@ async function scanDir(dir, rootCwd, packages, marker31) {
|
|
|
416245
416447
|
for (const entry of entries) {
|
|
416246
416448
|
if (!entry.isDirectory())
|
|
416247
416449
|
continue;
|
|
416248
|
-
const pkgDir =
|
|
416450
|
+
const pkgDir = join44(dir, entry.name);
|
|
416249
416451
|
try {
|
|
416250
|
-
await access(
|
|
416452
|
+
await access(join44(pkgDir, marker31));
|
|
416251
416453
|
await addPackage(packages, pkgDir, rootCwd);
|
|
416252
416454
|
} catch {}
|
|
416253
416455
|
}
|
|
@@ -416259,14 +416461,14 @@ async function addPackage(packages, pkgDir, rootCwd) {
|
|
|
416259
416461
|
let name39 = rel;
|
|
416260
416462
|
try {
|
|
416261
416463
|
try {
|
|
416262
|
-
await access(
|
|
416263
|
-
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"));
|
|
416264
416466
|
if (pkg.name)
|
|
416265
416467
|
name39 = pkg.name;
|
|
416266
416468
|
} catch {
|
|
416267
416469
|
try {
|
|
416268
|
-
await access(
|
|
416269
|
-
const cargo = await readFile9(
|
|
416470
|
+
await access(join44(pkgDir, "Cargo.toml"));
|
|
416471
|
+
const cargo = await readFile9(join44(pkgDir, "Cargo.toml"), "utf-8");
|
|
416270
416472
|
const nameMatch = cargo.match(/name\s*=\s*["']([^"']+)["']/);
|
|
416271
416473
|
if (nameMatch?.[1])
|
|
416272
416474
|
name39 = nameMatch[1];
|
|
@@ -416348,7 +416550,7 @@ async function resolveRunScript(profile, script, cwd) {
|
|
|
416348
416550
|
if (scripts[script]) {
|
|
416349
416551
|
const has = async (f) => {
|
|
416350
416552
|
try {
|
|
416351
|
-
await access(
|
|
416553
|
+
await access(join44(cwd, f));
|
|
416352
416554
|
return true;
|
|
416353
416555
|
} catch {
|
|
416354
416556
|
return false;
|
|
@@ -416425,7 +416627,7 @@ var init_project = __esm(() => {
|
|
|
416425
416627
|
name: "project",
|
|
416426
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.",
|
|
416427
416629
|
execute: async (args2) => {
|
|
416428
|
-
const cwd = args2.cwd ?
|
|
416630
|
+
const cwd = args2.cwd ? join44(getCwd(), args2.cwd) : getCwd();
|
|
416429
416631
|
if (args2.action === "list") {
|
|
416430
416632
|
const packages = await discoverPackages(cwd);
|
|
416431
416633
|
return { success: true, output: formatPackageList(packages) };
|
|
@@ -416917,7 +417119,7 @@ function contentHash2(s) {
|
|
|
416917
417119
|
|
|
416918
417120
|
// src/core/tools/ts-project-detect.ts
|
|
416919
417121
|
import { access as access2 } from "fs/promises";
|
|
416920
|
-
import { join as
|
|
417122
|
+
import { join as join45 } from "path";
|
|
416921
417123
|
function hasTsJsExtension(path) {
|
|
416922
417124
|
const dot = path.lastIndexOf(".");
|
|
416923
417125
|
if (dot === -1)
|
|
@@ -416929,7 +417131,7 @@ async function isTsJsProject(cwd = process.cwd()) {
|
|
|
416929
417131
|
return _cachedIsTsJs;
|
|
416930
417132
|
const check2 = async (f) => {
|
|
416931
417133
|
try {
|
|
416932
|
-
await access2(
|
|
417134
|
+
await access2(join45(cwd, f));
|
|
416933
417135
|
return true;
|
|
416934
417136
|
} catch {
|
|
416935
417137
|
return false;
|
|
@@ -432057,7 +432259,7 @@ var init_grep = __esm(() => {
|
|
|
432057
432259
|
|
|
432058
432260
|
// src/core/tools/list-dir.ts
|
|
432059
432261
|
import { readdir as readdir5, stat as stat3 } from "fs/promises";
|
|
432060
|
-
import { join as
|
|
432262
|
+
import { join as join46, relative as relative7, resolve as resolve23 } from "path";
|
|
432061
432263
|
function formatEntry(name39, isDir, meta3) {
|
|
432062
432264
|
if (isDir)
|
|
432063
432265
|
return `\uD83D\uDCC1 ${name39}/`;
|
|
@@ -432104,10 +432306,10 @@ async function listDirFS(absPath, displayPath3, maxDepth, currentDepth, budget)
|
|
|
432104
432306
|
} catch {
|
|
432105
432307
|
return { output: `\u274C ${displayPath3} \u2014 cannot read directory`, count: 0 };
|
|
432106
432308
|
}
|
|
432107
|
-
const visible = rawEntries.filter((name39) => (!name39.startsWith(".") || name39 === ".gitignore") && !isForbidden(
|
|
432309
|
+
const visible = rawEntries.filter((name39) => (!name39.startsWith(".") || name39 === ".gitignore") && !isForbidden(join46(absPath, name39)));
|
|
432108
432310
|
const classified = await Promise.all(visible.map(async (name39) => {
|
|
432109
432311
|
try {
|
|
432110
|
-
const s = await stat3(
|
|
432312
|
+
const s = await stat3(join46(absPath, name39));
|
|
432111
432313
|
return { name: name39, isDir: s.isDirectory() };
|
|
432112
432314
|
} catch {
|
|
432113
432315
|
return { name: name39, isDir: false };
|
|
@@ -432127,7 +432329,7 @@ async function listDirFS(absPath, displayPath3, maxDepth, currentDepth, budget)
|
|
|
432127
432329
|
lines.push(`${indent}\uD83D\uDCC1 ${name39}/`);
|
|
432128
432330
|
count++;
|
|
432129
432331
|
if (currentDepth + 1 < maxDepth && count < budget) {
|
|
432130
|
-
const childAbs =
|
|
432332
|
+
const childAbs = join46(absPath, name39);
|
|
432131
432333
|
const childDisplay = `${displayPath3}/${name39}`;
|
|
432132
432334
|
const sub = await listDirFS(childAbs, childDisplay, maxDepth, currentDepth + 1, budget - count);
|
|
432133
432335
|
if (sub.count > 0) {
|
|
@@ -434985,7 +435187,7 @@ var MAX_BYTES2 = 512, UTF8_BOUNDARY_RESERVE = 3;
|
|
|
434985
435187
|
var init_lib2 = () => {};
|
|
434986
435188
|
|
|
434987
435189
|
// src/core/tools/binary-detect.ts
|
|
434988
|
-
import { existsSync as
|
|
435190
|
+
import { existsSync as existsSync40, statSync as statSync7 } from "fs";
|
|
434989
435191
|
import { extname as extname3, resolve as resolve28 } from "path";
|
|
434990
435192
|
function binaryHint(ext) {
|
|
434991
435193
|
if (IMAGE_EXTS.has(ext))
|
|
@@ -435006,7 +435208,7 @@ function binaryHint(ext) {
|
|
|
435006
435208
|
}
|
|
435007
435209
|
function checkBinaryFile(filePath) {
|
|
435008
435210
|
try {
|
|
435009
|
-
if (!
|
|
435211
|
+
if (!existsSync40(filePath))
|
|
435010
435212
|
return null;
|
|
435011
435213
|
const stat5 = statSync7(filePath);
|
|
435012
435214
|
if (!stat5.isFile())
|
|
@@ -436146,7 +436348,7 @@ async function locateSymbol(router2, symbol31, hint) {
|
|
|
436146
436348
|
return null;
|
|
436147
436349
|
}
|
|
436148
436350
|
async function findProjectRoot2(file2) {
|
|
436149
|
-
const { dirname: dirname22, join:
|
|
436351
|
+
const { dirname: dirname22, join: join47 } = __require("path");
|
|
436150
436352
|
let dir = dirname22(file2);
|
|
436151
436353
|
const cwd2 = getCwd();
|
|
436152
436354
|
while (dir.length >= cwd2.length) {
|
|
@@ -436158,7 +436360,7 @@ async function findProjectRoot2(file2) {
|
|
|
436158
436360
|
"pyproject.toml"
|
|
436159
436361
|
]) {
|
|
436160
436362
|
try {
|
|
436161
|
-
await statAsync9(
|
|
436363
|
+
await statAsync9(join47(dir, marker31));
|
|
436162
436364
|
return dir;
|
|
436163
436365
|
} catch {}
|
|
436164
436366
|
}
|
|
@@ -436992,9 +437194,9 @@ __export(exports_image, {
|
|
|
436992
437194
|
import { execSync as execSync3, spawn as spawn14 } from "child_process";
|
|
436993
437195
|
import {
|
|
436994
437196
|
closeSync as closeSync2,
|
|
436995
|
-
existsSync as
|
|
437197
|
+
existsSync as existsSync41,
|
|
436996
437198
|
openSync as openSync2,
|
|
436997
|
-
readFileSync as
|
|
437199
|
+
readFileSync as readFileSync22,
|
|
436998
437200
|
statSync as statSync8,
|
|
436999
437201
|
unlinkSync as unlinkSync8,
|
|
437000
437202
|
writeSync
|
|
@@ -437191,7 +437393,7 @@ function imageToHalfBlockArt(filePath, opts) {
|
|
|
437191
437393
|
return null;
|
|
437192
437394
|
let png;
|
|
437193
437395
|
try {
|
|
437194
|
-
const data =
|
|
437396
|
+
const data = readFileSync22(filePath);
|
|
437195
437397
|
png = decodePng(data);
|
|
437196
437398
|
} catch {
|
|
437197
437399
|
return null;
|
|
@@ -437319,7 +437521,7 @@ function getPngDimensions(data) {
|
|
|
437319
437521
|
}
|
|
437320
437522
|
function safeUnlink(path) {
|
|
437321
437523
|
try {
|
|
437322
|
-
if (
|
|
437524
|
+
if (existsSync41(path))
|
|
437323
437525
|
unlinkSync8(path);
|
|
437324
437526
|
} catch {}
|
|
437325
437527
|
}
|
|
@@ -437498,18 +437700,18 @@ var init_tool_progress = __esm(() => {
|
|
|
437498
437700
|
// src/core/tools/show-image.ts
|
|
437499
437701
|
import { spawn as spawn15, spawnSync as spawnSync7 } from "child_process";
|
|
437500
437702
|
import {
|
|
437501
|
-
existsSync as
|
|
437703
|
+
existsSync as existsSync42,
|
|
437502
437704
|
readdirSync as readdirSync10,
|
|
437503
|
-
readFileSync as
|
|
437705
|
+
readFileSync as readFileSync23,
|
|
437504
437706
|
statSync as statSync9,
|
|
437505
437707
|
unlinkSync as unlinkSync9,
|
|
437506
|
-
writeFileSync as
|
|
437708
|
+
writeFileSync as writeFileSync18
|
|
437507
437709
|
} from "fs";
|
|
437508
437710
|
import { tmpdir as tmpdir4 } from "os";
|
|
437509
437711
|
import { basename as basename7, extname as extname7, resolve as resolve34 } from "path";
|
|
437510
437712
|
function safeUnlink2(path) {
|
|
437511
437713
|
try {
|
|
437512
|
-
if (
|
|
437714
|
+
if (existsSync42(path))
|
|
437513
437715
|
unlinkSync9(path);
|
|
437514
437716
|
} catch {}
|
|
437515
437717
|
}
|
|
@@ -437518,7 +437720,7 @@ async function convertToPng(data, ext, signal) {
|
|
|
437518
437720
|
const srcPath = resolve34(tmpdir4(), `${id}${ext}`);
|
|
437519
437721
|
const dstPath = resolve34(tmpdir4(), `${id}.png`);
|
|
437520
437722
|
try {
|
|
437521
|
-
|
|
437723
|
+
writeFileSync18(srcPath, data);
|
|
437522
437724
|
const converters = [
|
|
437523
437725
|
["ffmpeg", ["-y", "-i", srcPath, "-frames:v", "1", dstPath]],
|
|
437524
437726
|
["sips", ["-s", "format", "png", srcPath, "--out", dstPath]],
|
|
@@ -437528,8 +437730,8 @@ async function convertToPng(data, ext, signal) {
|
|
|
437528
437730
|
for (const [cmd, cmdArgs] of converters) {
|
|
437529
437731
|
try {
|
|
437530
437732
|
const result = await spawnAsync(cmd, cmdArgs, { timeout: 1e4, signal });
|
|
437531
|
-
if (result.code === 0 &&
|
|
437532
|
-
return
|
|
437733
|
+
if (result.code === 0 && existsSync42(dstPath))
|
|
437734
|
+
return readFileSync23(dstPath);
|
|
437533
437735
|
} catch {}
|
|
437534
437736
|
}
|
|
437535
437737
|
return null;
|
|
@@ -437604,7 +437806,7 @@ async function resizeImageToTarget(data, name39, targetBytes, signal) {
|
|
|
437604
437806
|
const srcPath = resolve34(tmpdir4(), `${id}${ext}`);
|
|
437605
437807
|
const dstPath = resolve34(tmpdir4(), `${id}-resized${ext}`);
|
|
437606
437808
|
try {
|
|
437607
|
-
|
|
437809
|
+
writeFileSync18(srcPath, data);
|
|
437608
437810
|
const scales = [0.9, 0.8, 0.7, 0.6, 0.5];
|
|
437609
437811
|
if (hasFfmpeg()) {
|
|
437610
437812
|
for (const scale of scales) {
|
|
@@ -437618,8 +437820,8 @@ async function resizeImageToTarget(data, name39, targetBytes, signal) {
|
|
|
437618
437820
|
"2",
|
|
437619
437821
|
dstPath
|
|
437620
437822
|
], { timeout: 30000, signal });
|
|
437621
|
-
if (result.code === 0 &&
|
|
437622
|
-
const resized =
|
|
437823
|
+
if (result.code === 0 && existsSync42(dstPath)) {
|
|
437824
|
+
const resized = readFileSync23(dstPath);
|
|
437623
437825
|
if (resized.length > 0 && resized.length <= targetBytes)
|
|
437624
437826
|
return resized;
|
|
437625
437827
|
}
|
|
@@ -437635,8 +437837,8 @@ async function resizeImageToTarget(data, name39, targetBytes, signal) {
|
|
|
437635
437837
|
for (const scale of scales) {
|
|
437636
437838
|
const targetWidth = Math.round(origWidth * scale);
|
|
437637
437839
|
const result = await spawnAsync("sips", ["--resampleWidth", String(targetWidth), srcPath, "--out", dstPath], { timeout: 30000, signal });
|
|
437638
|
-
if (result.code === 0 &&
|
|
437639
|
-
const resized =
|
|
437840
|
+
if (result.code === 0 && existsSync42(dstPath)) {
|
|
437841
|
+
const resized = readFileSync23(dstPath);
|
|
437640
437842
|
if (resized.length > 0 && resized.length <= targetBytes)
|
|
437641
437843
|
return resized;
|
|
437642
437844
|
}
|
|
@@ -437733,7 +437935,7 @@ async function videoToGif(videoPath, toolCallId, maxDuration = MAX_GIF_DURATION,
|
|
|
437733
437935
|
"1",
|
|
437734
437936
|
palettePath
|
|
437735
437937
|
], { timeout: 60000, signal });
|
|
437736
|
-
if (pass1.code !== 0 || !
|
|
437938
|
+
if (pass1.code !== 0 || !existsSync42(palettePath))
|
|
437737
437939
|
return null;
|
|
437738
437940
|
progress(toolCallId, "FFMPEG", `${msg}\u2026 (encoding)`);
|
|
437739
437941
|
const pass2 = await spawnAsync("ffmpeg", [
|
|
@@ -437760,8 +437962,8 @@ async function videoToGif(videoPath, toolCallId, maxDuration = MAX_GIF_DURATION,
|
|
|
437760
437962
|
});
|
|
437761
437963
|
if (pass2.code !== 0)
|
|
437762
437964
|
return null;
|
|
437763
|
-
if (
|
|
437764
|
-
const data =
|
|
437965
|
+
if (existsSync42(gifPath)) {
|
|
437966
|
+
const data = readFileSync23(gifPath);
|
|
437765
437967
|
if (data.length > 0 && data.length <= MAX_IMAGE_SIZE2)
|
|
437766
437968
|
return data;
|
|
437767
437969
|
}
|
|
@@ -437781,8 +437983,8 @@ async function videoToFrame(videoPath, toolCallId, signal) {
|
|
|
437781
437983
|
try {
|
|
437782
437984
|
progress(toolCallId, "FFMPEG", "Extracting frame\u2026");
|
|
437783
437985
|
const result = await spawnAsync("ffmpeg", ["-y", "-i", videoPath, "-frames:v", "1", "-q:v", "2", framePath], { timeout: 15000, signal });
|
|
437784
|
-
if (result.code === 0 &&
|
|
437785
|
-
const data =
|
|
437986
|
+
if (result.code === 0 && existsSync42(framePath)) {
|
|
437987
|
+
const data = readFileSync23(framePath);
|
|
437786
437988
|
if (data.length > 0 && data.length <= MAX_IMAGE_SIZE2)
|
|
437787
437989
|
return data;
|
|
437788
437990
|
}
|
|
@@ -437826,7 +438028,7 @@ ${INSTALL_FFMPEG}` };
|
|
|
437826
438028
|
error: `Video too large (${String(Math.round(buf.length / 1024 / 1024))}MB). Max: 20MB.`
|
|
437827
438029
|
};
|
|
437828
438030
|
}
|
|
437829
|
-
|
|
438031
|
+
writeFileSync18(videoPath, buf);
|
|
437830
438032
|
return await convertLocalVideo(videoPath, urlName, toolCallId, signal);
|
|
437831
438033
|
} catch (e) {
|
|
437832
438034
|
return { error: `Fetch failed: ${e instanceof Error ? e.message : String(e)}` };
|
|
@@ -437878,7 +438080,7 @@ ${INSTALL_YTDLP}`
|
|
|
437878
438080
|
videoPath,
|
|
437879
438081
|
url2
|
|
437880
438082
|
], { timeout: 120000, signal, onStderr });
|
|
437881
|
-
if (dlResult.code !== 0 || !
|
|
438083
|
+
if (dlResult.code !== 0 || !existsSync42(videoPath)) {
|
|
437882
438084
|
safeUnlink2(videoPath);
|
|
437883
438085
|
progress(toolCallId, "YT-DL", `${dlMsg}\u2026 (retrying lowest quality)`);
|
|
437884
438086
|
dlResult = await spawnAsync("yt-dlp", ["-f", "worst", "-o", videoPath, url2], {
|
|
@@ -437887,7 +438089,7 @@ ${INSTALL_YTDLP}`
|
|
|
437887
438089
|
onStderr
|
|
437888
438090
|
});
|
|
437889
438091
|
}
|
|
437890
|
-
if (dlResult.code === 0 &&
|
|
438092
|
+
if (dlResult.code === 0 && existsSync42(videoPath)) {
|
|
437891
438093
|
if (supportsKittyAnimation()) {
|
|
437892
438094
|
for (let attempt = 0;attempt < 2; attempt++) {
|
|
437893
438095
|
const gif = await videoToGif(videoPath, toolCallId, MAX_GIF_DURATION, signal);
|
|
@@ -437916,8 +438118,8 @@ ${INSTALL_YTDLP}`
|
|
|
437916
438118
|
], { timeout: 30000, signal });
|
|
437917
438119
|
const thumbFile = `${thumbBase}.png`;
|
|
437918
438120
|
cleanupFiles.push(thumbFile);
|
|
437919
|
-
if (thumbResult.code === 0 &&
|
|
437920
|
-
const data =
|
|
438121
|
+
if (thumbResult.code === 0 && existsSync42(thumbFile)) {
|
|
438122
|
+
const data = readFileSync23(thumbFile);
|
|
437921
438123
|
if (data.length > 0 && data.length <= MAX_IMAGE_SIZE2) {
|
|
437922
438124
|
const suffix = hasFfmpeg() ? " (video download failed, showing thumbnail)" : " (install ffmpeg for animated GIF)";
|
|
437923
438125
|
return { data, name: `${urlName}-thumbnail.png${suffix}`, isGif: false };
|
|
@@ -437971,7 +438173,7 @@ async function extractGifFrames(data, signal, maxWidth = GIF_FRAME_MAX_WIDTH) {
|
|
|
437971
438173
|
const srcPath = resolve34(tmpdir4(), `${id}.gif`);
|
|
437972
438174
|
const outPattern = resolve34(tmpdir4(), `${id}-frame-%04d.png`);
|
|
437973
438175
|
try {
|
|
437974
|
-
|
|
438176
|
+
writeFileSync18(srcPath, data);
|
|
437975
438177
|
const delays = parseGifDelays(data);
|
|
437976
438178
|
let extracted = false;
|
|
437977
438179
|
try {
|
|
@@ -438007,7 +438209,7 @@ async function extractGifFrames(data, signal, maxWidth = GIF_FRAME_MAX_WIDTH) {
|
|
|
438007
438209
|
return null;
|
|
438008
438210
|
const frames = [];
|
|
438009
438211
|
for (const file2 of frameFiles) {
|
|
438010
|
-
const png =
|
|
438212
|
+
const png = readFileSync23(file2);
|
|
438011
438213
|
frames.push({ png, delay: delays[frames.length] ?? 100 });
|
|
438012
438214
|
}
|
|
438013
438215
|
return frames.length > 0 ? frames : null;
|
|
@@ -438140,7 +438342,7 @@ async function showImage(args2, cwd2, toolCallId, signal) {
|
|
|
438140
438342
|
};
|
|
438141
438343
|
}
|
|
438142
438344
|
try {
|
|
438143
|
-
data =
|
|
438345
|
+
data = readFileSync23(filePath);
|
|
438144
438346
|
if (data.length > MAX_IMAGE_SIZE2) {
|
|
438145
438347
|
const resized = await resizeImageToTarget(data, args2.path, TARGET_IMAGE_SIZE, signal);
|
|
438146
438348
|
if (resized) {
|
|
@@ -438252,12 +438454,12 @@ async function restoreSessionImages(messages, cwd2) {
|
|
|
438252
438454
|
name39 = result.name;
|
|
438253
438455
|
} else {
|
|
438254
438456
|
const filePath = resolve34(cwd2, path);
|
|
438255
|
-
if (!
|
|
438457
|
+
if (!existsSync42(filePath))
|
|
438256
438458
|
continue;
|
|
438257
438459
|
const stat5 = statSync9(filePath);
|
|
438258
438460
|
if (!stat5.isFile() || stat5.size > MAX_IMAGE_SIZE2)
|
|
438259
438461
|
continue;
|
|
438260
|
-
data =
|
|
438462
|
+
data = readFileSync23(filePath);
|
|
438261
438463
|
name39 = path;
|
|
438262
438464
|
}
|
|
438263
438465
|
if (!data)
|
|
@@ -438344,9 +438546,9 @@ var init_show_image = __esm(() => {
|
|
|
438344
438546
|
});
|
|
438345
438547
|
|
|
438346
438548
|
// src/core/skills/manager.ts
|
|
438347
|
-
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";
|
|
438348
438550
|
import { homedir as homedir13 } from "os";
|
|
438349
|
-
import { dirname as dirname22, join as
|
|
438551
|
+
import { dirname as dirname22, join as join47 } from "path";
|
|
438350
438552
|
async function searchSkills(query2) {
|
|
438351
438553
|
const url2 = `https://skills.sh/api/search?q=${encodeURIComponent(query2)}`;
|
|
438352
438554
|
const res = await fetch(url2);
|
|
@@ -438415,12 +438617,12 @@ function listInstalledSkills() {
|
|
|
438415
438617
|
const byName = new Map;
|
|
438416
438618
|
const seenPaths = new Set;
|
|
438417
438619
|
const dirs = [
|
|
438418
|
-
{ path:
|
|
438419
|
-
{ path:
|
|
438420
|
-
{ path:
|
|
438421
|
-
{ path:
|
|
438422
|
-
{ path:
|
|
438423
|
-
{ 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" }
|
|
438424
438626
|
];
|
|
438425
438627
|
for (const dir of dirs) {
|
|
438426
438628
|
try {
|
|
@@ -438434,15 +438636,15 @@ function scanSkillDir(dir, scope, byName, seenPaths) {
|
|
|
438434
438636
|
for (const entry of entries2) {
|
|
438435
438637
|
if (entry.name.startsWith("."))
|
|
438436
438638
|
continue;
|
|
438437
|
-
const full =
|
|
438639
|
+
const full = join47(dir, entry.name);
|
|
438438
438640
|
const isDir = entry.isDirectory() || entry.isSymbolicLink() && isDirectorySafe(full);
|
|
438439
438641
|
if (isDir) {
|
|
438440
438642
|
try {
|
|
438441
|
-
const skillPath =
|
|
438643
|
+
const skillPath = join47(full, "SKILL.md");
|
|
438442
438644
|
const resolved = realpathSync4(skillPath);
|
|
438443
438645
|
if (seenPaths.has(resolved))
|
|
438444
438646
|
continue;
|
|
438445
|
-
|
|
438647
|
+
readFileSync24(skillPath, "utf-8");
|
|
438446
438648
|
seenPaths.add(resolved);
|
|
438447
438649
|
byName.set(entry.name, { name: entry.name, path: skillPath, scope });
|
|
438448
438650
|
} catch {}
|
|
@@ -438464,12 +438666,12 @@ function isDirectorySafe(path) {
|
|
|
438464
438666
|
}
|
|
438465
438667
|
}
|
|
438466
438668
|
function loadSkill(path) {
|
|
438467
|
-
return
|
|
438669
|
+
return readFileSync24(path, "utf-8");
|
|
438468
438670
|
}
|
|
438469
438671
|
function removeInstalledSkill(skill) {
|
|
438470
438672
|
try {
|
|
438471
438673
|
const dir = dirname22(skill.path);
|
|
438472
|
-
if (
|
|
438674
|
+
if (existsSync43(dir)) {
|
|
438473
438675
|
rmSync6(dir, { recursive: true });
|
|
438474
438676
|
return true;
|
|
438475
438677
|
}
|
|
@@ -439747,7 +439949,7 @@ ${enriched}`
|
|
|
439747
439949
|
|
|
439748
439950
|
// src/core/tools/soul-grep.ts
|
|
439749
439951
|
import { spawn as spawn17 } from "child_process";
|
|
439750
|
-
import { existsSync as
|
|
439952
|
+
import { existsSync as existsSync44 } from "fs";
|
|
439751
439953
|
function resolveDepSearch(dep, explicitPath) {
|
|
439752
439954
|
const noIgnoreFollow = ["--no-ignore", "--follow"];
|
|
439753
439955
|
if (explicitPath) {
|
|
@@ -439759,7 +439961,7 @@ function resolveDepSearch(dep, explicitPath) {
|
|
|
439759
439961
|
const FLAT_ROOTS = ["node_modules", "vendor", "bower_components"];
|
|
439760
439962
|
for (const root of FLAT_ROOTS) {
|
|
439761
439963
|
const candidate = `${root}/${dep}`;
|
|
439762
|
-
if (
|
|
439964
|
+
if (existsSync44(candidate)) {
|
|
439763
439965
|
return { searchPath: candidate, extraArgs: noIgnoreFollow, resolved: true, dep };
|
|
439764
439966
|
}
|
|
439765
439967
|
}
|
|
@@ -439971,7 +440173,7 @@ var init_soul_grep = __esm(() => {
|
|
|
439971
440173
|
|
|
439972
440174
|
// src/core/tools/soul-impact.ts
|
|
439973
440175
|
import { readFile as readFile19 } from "fs/promises";
|
|
439974
|
-
import { join as
|
|
440176
|
+
import { join as join48, relative as relative13 } from "path";
|
|
439975
440177
|
async function showDependents(repoMap, relPath) {
|
|
439976
440178
|
const dependents = await repoMap.getFileDependents(relPath);
|
|
439977
440179
|
if (dependents.length === 0) {
|
|
@@ -440070,7 +440272,7 @@ async function grepDependents(cwd2, relPath) {
|
|
|
440070
440272
|
try {
|
|
440071
440273
|
const out2 = await execFileAsync("rg", ["-l", "--glob=!node_modules", "--glob=!.git", "--max-count=1", escaped, "."], { cwd: cwd2, timeout: 1e4, maxBuffer: 512000 });
|
|
440072
440274
|
const files = out2.split(`
|
|
440073
|
-
`).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);
|
|
440074
440276
|
if (files.length === 0) {
|
|
440075
440277
|
return {
|
|
440076
440278
|
success: true,
|
|
@@ -440091,7 +440293,7 @@ ${files.map((f) => ` ${f}`).join(`
|
|
|
440091
440293
|
}
|
|
440092
440294
|
}
|
|
440093
440295
|
async function grepDependencies(cwd2, relPath) {
|
|
440094
|
-
const absPath =
|
|
440296
|
+
const absPath = join48(cwd2, relPath);
|
|
440095
440297
|
try {
|
|
440096
440298
|
const content = await readFile19(absPath, "utf-8");
|
|
440097
440299
|
const importRe = /(?:import|from|require)\s*[(\s]['"`]([^'"`]+)['"`]/g;
|
|
@@ -440346,23 +440548,23 @@ var init_soul_query = __esm(() => {
|
|
|
440346
440548
|
|
|
440347
440549
|
// src/core/tools/structural-edit.ts
|
|
440348
440550
|
import { spawn as spawn18 } from "child_process";
|
|
440349
|
-
import { existsSync as
|
|
440350
|
-
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";
|
|
440351
440553
|
function resolveAstGrep(cwd2) {
|
|
440352
440554
|
const vendored = getVendoredPath("ast-grep");
|
|
440353
440555
|
if (vendored)
|
|
440354
440556
|
return vendored;
|
|
440355
|
-
const binDir =
|
|
440557
|
+
const binDir = join49(cwd2, "node_modules", ".bin");
|
|
440356
440558
|
const localCandidates = IS_WIN ? ["ast-grep.cmd", "ast-grep.exe", "ast-grep.ps1", "ast-grep", "sg.cmd", "sg.exe", "sg"] : ["ast-grep", "sg"];
|
|
440357
440559
|
for (const name39 of localCandidates) {
|
|
440358
|
-
const candidate =
|
|
440359
|
-
if (
|
|
440560
|
+
const candidate = join49(binDir, name39);
|
|
440561
|
+
if (existsSync45(candidate))
|
|
440360
440562
|
return candidate;
|
|
440361
440563
|
}
|
|
440362
|
-
const nativeDir =
|
|
440564
|
+
const nativeDir = join49(cwd2, "node_modules", "@ast-grep", "cli");
|
|
440363
440565
|
for (const name39 of [`ast-grep${EXE2}`, `sg${EXE2}`]) {
|
|
440364
|
-
const candidate =
|
|
440365
|
-
if (
|
|
440566
|
+
const candidate = join49(nativeDir, name39);
|
|
440567
|
+
if (existsSync45(candidate))
|
|
440366
440568
|
return candidate;
|
|
440367
440569
|
}
|
|
440368
440570
|
return findOnPath("ast-grep") ?? findOnPath("sg") ?? null;
|
|
@@ -440462,7 +440664,7 @@ var init_structural_edit = __esm(() => {
|
|
|
440462
440664
|
error: "forbidden"
|
|
440463
440665
|
};
|
|
440464
440666
|
}
|
|
440465
|
-
if (!
|
|
440667
|
+
if (!existsSync45(abs)) {
|
|
440466
440668
|
return { success: false, output: `File not found: ${args2.file}`, error: "not found" };
|
|
440467
440669
|
}
|
|
440468
440670
|
const ext = extname9(abs).toLowerCase();
|
|
@@ -441667,7 +441869,7 @@ var init_bus_cache = __esm(() => {
|
|
|
441667
441869
|
|
|
441668
441870
|
// src/core/tools/interactive.ts
|
|
441669
441871
|
import { mkdir as mkdir6, writeFile as writeFile10 } from "fs/promises";
|
|
441670
|
-
import { join as
|
|
441872
|
+
import { join as join50 } from "path";
|
|
441671
441873
|
function planFileName2(sessionId) {
|
|
441672
441874
|
return sessionId ? `plan-${sessionId}.md` : "plan.md";
|
|
441673
441875
|
}
|
|
@@ -441803,11 +442005,11 @@ ${errors4.map((e) => `- ${e}`).join(`
|
|
|
441803
442005
|
lines.push(`- ${v2}`);
|
|
441804
442006
|
}
|
|
441805
442007
|
}
|
|
441806
|
-
const dir =
|
|
442008
|
+
const dir = join50(cwd2, ".soulforge", "plans");
|
|
441807
442009
|
await mkdir6(dir, { recursive: true });
|
|
441808
442010
|
const planContent = lines.join(`
|
|
441809
442011
|
`) + validationWarnings;
|
|
441810
|
-
await writeFile10(
|
|
442012
|
+
await writeFile10(join50(dir, fname), planContent);
|
|
441811
442013
|
const plan = {
|
|
441812
442014
|
title: args2.title,
|
|
441813
442015
|
depth,
|
|
@@ -443839,7 +444041,7 @@ var init_explore = __esm(() => {
|
|
|
443839
444041
|
|
|
443840
444042
|
// src/utils/image-compress.ts
|
|
443841
444043
|
import { spawn as spawn19 } from "child_process";
|
|
443842
|
-
import { existsSync as
|
|
444044
|
+
import { existsSync as existsSync46, readFileSync as readFileSync25, unlinkSync as unlinkSync10, writeFileSync as writeFileSync19 } from "fs";
|
|
443843
444045
|
import { tmpdir as tmpdir5 } from "os";
|
|
443844
444046
|
import { resolve as resolve40 } from "path";
|
|
443845
444047
|
async function compressImageForApi(data, mediaType) {
|
|
@@ -443850,13 +444052,13 @@ async function compressImageForApi(data, mediaType) {
|
|
|
443850
444052
|
const srcPath = resolve40(tmpdir5(), `${id}-src.png`);
|
|
443851
444053
|
const dstPath = resolve40(tmpdir5(), `${id}-dst.jpg`);
|
|
443852
444054
|
try {
|
|
443853
|
-
|
|
444055
|
+
writeFileSync19(srcPath, data);
|
|
443854
444056
|
const qualities = [85, 70, 50, 30];
|
|
443855
444057
|
for (const q2 of qualities) {
|
|
443856
444058
|
safeUnlink3(dstPath);
|
|
443857
444059
|
const ok2 = IS_DARWIN ? await trySips(srcPath, dstPath, q2) : await tryFfmpegOrMagick(srcPath, dstPath, q2);
|
|
443858
|
-
if (ok2 &&
|
|
443859
|
-
const compressed =
|
|
444060
|
+
if (ok2 && existsSync46(dstPath)) {
|
|
444061
|
+
const compressed = readFileSync25(dstPath);
|
|
443860
444062
|
if (compressed.length <= MAX_RAW_BYTES) {
|
|
443861
444063
|
return { data: compressed, mediaType: "image/jpeg" };
|
|
443862
444064
|
}
|
|
@@ -443864,8 +444066,8 @@ async function compressImageForApi(data, mediaType) {
|
|
|
443864
444066
|
}
|
|
443865
444067
|
safeUnlink3(dstPath);
|
|
443866
444068
|
const ok = IS_DARWIN ? await trySipsResize(srcPath, dstPath, 50, 30) : await tryFfmpegOrMagickResize(srcPath, dstPath, 50, 30);
|
|
443867
|
-
if (ok &&
|
|
443868
|
-
const compressed =
|
|
444069
|
+
if (ok && existsSync46(dstPath)) {
|
|
444070
|
+
const compressed = readFileSync25(dstPath);
|
|
443869
444071
|
if (compressed.length <= MAX_RAW_BYTES) {
|
|
443870
444072
|
return { data: compressed, mediaType: "image/jpeg" };
|
|
443871
444073
|
}
|
|
@@ -444001,7 +444203,7 @@ function spawnStdout(cmd, args2) {
|
|
|
444001
444203
|
}
|
|
444002
444204
|
function safeUnlink3(path) {
|
|
444003
444205
|
try {
|
|
444004
|
-
if (
|
|
444206
|
+
if (existsSync46(path))
|
|
444005
444207
|
unlinkSync10(path);
|
|
444006
444208
|
} catch {}
|
|
444007
444209
|
}
|
|
@@ -444013,7 +444215,7 @@ var init_image_compress = __esm(() => {
|
|
|
444013
444215
|
|
|
444014
444216
|
// src/core/agents/agent-results.ts
|
|
444015
444217
|
import { mkdir as mkdir7, readdir as readdir6, rm as rm2, writeFile as writeFile11 } from "fs/promises";
|
|
444016
|
-
import { join as
|
|
444218
|
+
import { join as join51 } from "path";
|
|
444017
444219
|
function extractFinalText(result) {
|
|
444018
444220
|
for (let i2 = result.steps.length - 1;i2 >= 0; i2--) {
|
|
444019
444221
|
const step = result.steps[i2];
|
|
@@ -444053,9 +444255,9 @@ function busFooter(filesExamined, filesEdited) {
|
|
|
444053
444255
|
`);
|
|
444054
444256
|
}
|
|
444055
444257
|
async function writeAgentContext(dispatchId, agentId, task, agentResult, findings, agentText, cwd2, tabId) {
|
|
444056
|
-
const dir = tabId ? dispatchDir(cwd2, tabId, dispatchId) :
|
|
444258
|
+
const dir = tabId ? dispatchDir(cwd2, tabId, dispatchId) : join51(cwd2, ".soulforge", "dispatch", dispatchId);
|
|
444057
444259
|
await mkdir7(dir, { recursive: true });
|
|
444058
|
-
const filePath =
|
|
444260
|
+
const filePath = join51(dir, `${agentId}.md`);
|
|
444059
444261
|
const lines = [];
|
|
444060
444262
|
lines.push(`# Agent: ${agentId} (${task.role})`);
|
|
444061
444263
|
lines.push(`Task: ${task.task.slice(0, 300)}`);
|
|
@@ -444111,19 +444313,19 @@ async function writeAgentContext(dispatchId, agentId, task, agentResult, finding
|
|
|
444111
444313
|
return filePath;
|
|
444112
444314
|
}
|
|
444113
444315
|
async function cleanupDispatchDir(cwd2, tabId, keepDispatchId) {
|
|
444114
|
-
const tabDir =
|
|
444316
|
+
const tabDir = join51(cwd2, ".soulforge", "dispatch", `tab-${tabId}`);
|
|
444115
444317
|
try {
|
|
444116
444318
|
for (const entry of await readdir6(tabDir)) {
|
|
444117
444319
|
if (entry !== keepDispatchId) {
|
|
444118
444320
|
try {
|
|
444119
|
-
await rm2(
|
|
444321
|
+
await rm2(join51(tabDir, entry), { recursive: true });
|
|
444120
444322
|
} catch {}
|
|
444121
444323
|
}
|
|
444122
444324
|
}
|
|
444123
444325
|
} catch {}
|
|
444124
444326
|
}
|
|
444125
444327
|
function dispatchDir(cwd2, tabId, dispatchId) {
|
|
444126
|
-
return
|
|
444328
|
+
return join51(cwd2, ".soulforge", "dispatch", `tab-${tabId}`, dispatchId);
|
|
444127
444329
|
}
|
|
444128
444330
|
var TRUNCATE_THRESHOLD = 4000, HEAD_CHARS = 2000, TAIL_CHARS = 1000;
|
|
444129
444331
|
var init_agent_results = () => {};
|
|
@@ -445070,10 +445272,10 @@ async function createAgent(task, models, bus, parentToolCallId) {
|
|
|
445070
445272
|
v2 && typeof v2 === "object" ? Object.keys(v2) : v2
|
|
445071
445273
|
])) : null
|
|
445072
445274
|
};
|
|
445073
|
-
import("fs").then(({ mkdirSync:
|
|
445275
|
+
import("fs").then(({ mkdirSync: mkdirSync24, writeFileSync: writeFileSync20 }) => {
|
|
445074
445276
|
const dir = `${getCwd()}/.soulforge/api-export/subagents/${task.agentId}`;
|
|
445075
|
-
|
|
445076
|
-
|
|
445277
|
+
mkdirSync24(dir, { recursive: true });
|
|
445278
|
+
writeFileSync20(`${dir}/config.json`, JSON.stringify(configData, null, 2), "utf-8");
|
|
445077
445279
|
});
|
|
445078
445280
|
}
|
|
445079
445281
|
return { agent: agent2, modelId, tier };
|
|
@@ -445183,10 +445385,10 @@ function buildSubagentTools(models) {
|
|
|
445183
445385
|
exists = true;
|
|
445184
445386
|
}
|
|
445185
445387
|
if (!exists) {
|
|
445186
|
-
const { existsSync:
|
|
445388
|
+
const { existsSync: existsSync47 } = __require("fs");
|
|
445187
445389
|
const { resolve: resolvePath, isAbsolute: isAbsolute2 } = __require("path");
|
|
445188
445390
|
const abs = isAbsolute2(norm) ? norm : resolvePath(cwd2, norm);
|
|
445189
|
-
if (
|
|
445391
|
+
if (existsSync47(abs))
|
|
445190
445392
|
exists = true;
|
|
445191
445393
|
}
|
|
445192
445394
|
if (exists) {
|
|
@@ -446072,10 +446274,10 @@ ${dump2}`);
|
|
|
446072
446274
|
};
|
|
446073
446275
|
})
|
|
446074
446276
|
};
|
|
446075
|
-
import("fs").then(({ mkdirSync:
|
|
446277
|
+
import("fs").then(({ mkdirSync: mkdirSync24, writeFileSync: writeFileSync20 }) => {
|
|
446076
446278
|
const dir = `${getCwd()}/.soulforge/api-export`;
|
|
446077
|
-
|
|
446078
|
-
|
|
446279
|
+
mkdirSync24(dir, { recursive: true });
|
|
446280
|
+
writeFileSync20(`${dir}/forge-step-${String(stepNumber).padStart(2, "0")}.json`, JSON.stringify(exportData, null, 2), "utf-8");
|
|
446079
446281
|
});
|
|
446080
446282
|
}
|
|
446081
446283
|
if (sanitized !== messages && !result.messages) {
|
|
@@ -447029,7 +447231,7 @@ var init_prompts = __esm(() => {
|
|
|
447029
447231
|
});
|
|
447030
447232
|
|
|
447031
447233
|
// src/core/workers/intelligence-client.ts
|
|
447032
|
-
import { join as
|
|
447234
|
+
import { join as join52 } from "path";
|
|
447033
447235
|
var IS_COMPILED2, IS_DIST2, IntelligenceClient;
|
|
447034
447236
|
var init_intelligence_client = __esm(() => {
|
|
447035
447237
|
init_errors();
|
|
@@ -447052,7 +447254,7 @@ var init_intelligence_client = __esm(() => {
|
|
|
447052
447254
|
onStaleSymbols = null;
|
|
447053
447255
|
static SCAN_IDLE_TIMEOUT = 600000;
|
|
447054
447256
|
constructor(cwd2) {
|
|
447055
|
-
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");
|
|
447056
447258
|
super(workerPath, { cwd: cwd2 });
|
|
447057
447259
|
this._cwd = cwd2;
|
|
447058
447260
|
const ws = useWorkerStore.getState();
|
|
@@ -447522,11 +447724,11 @@ class SoulMapSnapshot {
|
|
|
447522
447724
|
var init_soul_map_snapshot = () => {};
|
|
447523
447725
|
|
|
447524
447726
|
// src/core/context/toolchain.ts
|
|
447525
|
-
import { existsSync as
|
|
447526
|
-
import { join as
|
|
447727
|
+
import { existsSync as existsSync47 } from "fs";
|
|
447728
|
+
import { join as join53 } from "path";
|
|
447527
447729
|
function detectToolchain(cwd2) {
|
|
447528
447730
|
for (const [file2, tool4] of TOOLCHAIN_MARKERS) {
|
|
447529
|
-
if (
|
|
447731
|
+
if (existsSync47(join53(cwd2, file2)))
|
|
447530
447732
|
return tool4;
|
|
447531
447733
|
}
|
|
447532
447734
|
return null;
|
|
@@ -447784,9 +447986,9 @@ __export(exports_manager2, {
|
|
|
447784
447986
|
extractConversationTerms: () => extractConversationTerms,
|
|
447785
447987
|
ContextManager: () => ContextManager
|
|
447786
447988
|
});
|
|
447787
|
-
import { existsSync as
|
|
447989
|
+
import { existsSync as existsSync48 } from "fs";
|
|
447788
447990
|
import { readFile as readFile20 } from "fs/promises";
|
|
447789
|
-
import { join as
|
|
447991
|
+
import { join as join54 } from "path";
|
|
447790
447992
|
var DEFAULT_CONTEXT_WINDOW2 = 200000, ContextManager;
|
|
447791
447993
|
var init_manager6 = __esm(() => {
|
|
447792
447994
|
init_dist5();
|
|
@@ -448447,8 +448649,8 @@ ${instructions}` : banner;
|
|
|
448447
448649
|
return 0;
|
|
448448
448650
|
}
|
|
448449
448651
|
const { Database: Database7 } = await import("bun:sqlite");
|
|
448450
|
-
const { join:
|
|
448451
|
-
const dbPath =
|
|
448652
|
+
const { join: join55 } = await import("path");
|
|
448653
|
+
const dbPath = join55(this.cwd, ".soulforge", "repomap.db");
|
|
448452
448654
|
const db = new Database7(dbPath);
|
|
448453
448655
|
db.run("PRAGMA journal_mode = WAL");
|
|
448454
448656
|
db.run("PRAGMA busy_timeout = 5000");
|
|
@@ -448461,7 +448663,7 @@ ${instructions}` : banner;
|
|
|
448461
448663
|
continue;
|
|
448462
448664
|
const pathLabel = file2.path.length > 30 ? `...${file2.path.slice(-27)}` : file2.path;
|
|
448463
448665
|
store.setLspProgress(`${String(fi + 1)}/${String(files.length)}: ${pathLabel}`);
|
|
448464
|
-
const absPath =
|
|
448666
|
+
const absPath = join55(this.cwd, file2.path);
|
|
448465
448667
|
let raw;
|
|
448466
448668
|
try {
|
|
448467
448669
|
raw = await documentSymbols2(absPath);
|
|
@@ -448949,8 +449151,8 @@ ${skillBlocks}
|
|
|
448949
449151
|
let richBlockCount = 0;
|
|
448950
449152
|
const memoryMarkers = memoryMarkersForPaths(changed.slice(0, 15));
|
|
448951
449153
|
for (const file2 of changed.slice(0, 15)) {
|
|
448952
|
-
const absPath =
|
|
448953
|
-
const fileExists =
|
|
449154
|
+
const absPath = join54(this.cwd, file2);
|
|
449155
|
+
const fileExists = existsSync48(absPath);
|
|
448954
449156
|
const block = this.soulMapDiffBlocks.get(file2);
|
|
448955
449157
|
const provenance = this.classifyDeltaFile(absPath, file2, memoryMarkers.get(file2));
|
|
448956
449158
|
if (!fileExists) {
|
|
@@ -448989,7 +449191,7 @@ ${skillBlocks}
|
|
|
448989
449191
|
tags.push("[mentioned]");
|
|
448990
449192
|
if (this.editorFile === absPath)
|
|
448991
449193
|
tags.push("[open]");
|
|
448992
|
-
if (this.soulMapNewFilesEmitted.has(rel) &&
|
|
449194
|
+
if (this.soulMapNewFilesEmitted.has(rel) && existsSync48(absPath)) {
|
|
448993
449195
|
tags.push("[modified-since-new]");
|
|
448994
449196
|
}
|
|
448995
449197
|
const failure = this.recentToolFailures.find((f) => f.target === absPath || f.target === rel);
|
|
@@ -449092,7 +449294,7 @@ ${skillBlocks}
|
|
|
449092
449294
|
];
|
|
449093
449295
|
for (const check2 of checks3) {
|
|
449094
449296
|
try {
|
|
449095
|
-
await readFile20(
|
|
449297
|
+
await readFile20(join54(this.cwd, check2.file), "utf-8");
|
|
449096
449298
|
const toolchain = this.detectToolchain();
|
|
449097
449299
|
const profileStr = this.buildProfileString();
|
|
449098
449300
|
const info2 = `${check2.label}${toolchain ? ` \xB7 Toolchain: ${toolchain}` : ""}${profileStr}`;
|
|
@@ -466520,7 +466722,7 @@ var init_output = __esm(() => {
|
|
|
466520
466722
|
});
|
|
466521
466723
|
|
|
466522
466724
|
// src/headless/run.ts
|
|
466523
|
-
import { existsSync as
|
|
466725
|
+
import { existsSync as existsSync49, readFileSync as readFileSync26 } from "fs";
|
|
466524
466726
|
import { resolve as resolve41 } from "path";
|
|
466525
466727
|
function reraiseOrExit(code) {
|
|
466526
466728
|
if (code === EXIT_ABORT) {
|
|
@@ -466546,6 +466748,22 @@ async function setupAgent(opts, merged) {
|
|
|
466546
466748
|
process.exit(EXIT_ERROR);
|
|
466547
466749
|
}
|
|
466548
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 {}
|
|
466549
466767
|
const repoMapDisabled = merged.repoMap === false || opts.noRepomap || process.env.SOULFORGE_NO_REPOMAP === "1";
|
|
466550
466768
|
const contextManager = await ContextManager.createAsync(cwd2, (step) => {
|
|
466551
466769
|
if (showProgress)
|
|
@@ -466851,13 +467069,13 @@ async function runPrompt(opts, merged) {
|
|
|
466851
467069
|
const fileParts = [];
|
|
466852
467070
|
for (const file2 of opts.include) {
|
|
466853
467071
|
const fullPath = resolve41(env.cwd, file2);
|
|
466854
|
-
if (!
|
|
467072
|
+
if (!existsSync49(fullPath)) {
|
|
466855
467073
|
stderrWarn(`--include file not found: ${file2}`);
|
|
466856
467074
|
continue;
|
|
466857
467075
|
}
|
|
466858
467076
|
try {
|
|
466859
467077
|
fileParts.push(`[${file2}]
|
|
466860
|
-
${
|
|
467078
|
+
${readFileSync26(fullPath, "utf-8")}`);
|
|
466861
467079
|
} catch {}
|
|
466862
467080
|
}
|
|
466863
467081
|
if (fileParts.length > 0) {
|
|
@@ -467267,7 +467485,7 @@ var init_run = __esm(() => {
|
|
|
467267
467485
|
});
|
|
467268
467486
|
|
|
467269
467487
|
// src/hearth/tab-loop.ts
|
|
467270
|
-
import { randomUUID as
|
|
467488
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
467271
467489
|
|
|
467272
467490
|
class TabLoop {
|
|
467273
467491
|
tabId;
|
|
@@ -467333,7 +467551,7 @@ class TabLoop {
|
|
|
467333
467551
|
return this.loopPromise;
|
|
467334
467552
|
}
|
|
467335
467553
|
enqueuePrompt(text3) {
|
|
467336
|
-
const id =
|
|
467554
|
+
const id = randomUUID4();
|
|
467337
467555
|
if (this.closed)
|
|
467338
467556
|
return null;
|
|
467339
467557
|
const waiter = this.waiters.shift();
|
|
@@ -467399,7 +467617,7 @@ var init_tab_loop = __esm(() => {
|
|
|
467399
467617
|
});
|
|
467400
467618
|
|
|
467401
467619
|
// src/hearth/workspace.ts
|
|
467402
|
-
import { randomUUID as
|
|
467620
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
467403
467621
|
|
|
467404
467622
|
class ChatWorkspace {
|
|
467405
467623
|
surface;
|
|
@@ -467422,7 +467640,7 @@ class ChatWorkspace {
|
|
|
467422
467640
|
this.binding = deps.binding;
|
|
467423
467641
|
this.hearthConfig = deps.hearthConfig;
|
|
467424
467642
|
this.log = deps.log ?? (() => {});
|
|
467425
|
-
this.sessionId =
|
|
467643
|
+
this.sessionId = randomUUID5();
|
|
467426
467644
|
this.buildCallbacksOverride = deps.buildCallbacks;
|
|
467427
467645
|
this.onTabEvent = deps.onTabEvent;
|
|
467428
467646
|
const globalCfg = loadConfig();
|
|
@@ -467438,7 +467656,7 @@ class ChatWorkspace {
|
|
|
467438
467656
|
if (this.tabs.size >= this.binding.maxTabs) {
|
|
467439
467657
|
throw new Error(`max tabs reached (${String(this.binding.maxTabs)})`);
|
|
467440
467658
|
}
|
|
467441
|
-
const tabId =
|
|
467659
|
+
const tabId = randomUUID5();
|
|
467442
467660
|
const tabLabel = label ?? `TAB-${String(this.tabs.size + 1)}`;
|
|
467443
467661
|
const callbacks = this.buildCallbacksOverride?.({ tabId }) ?? buildHearthCallbacks({
|
|
467444
467662
|
surface: this.surface,
|
|
@@ -467596,11 +467814,11 @@ var init_workspace = __esm(() => {
|
|
|
467596
467814
|
import {
|
|
467597
467815
|
appendFileSync as appendFileSync4,
|
|
467598
467816
|
chmodSync as chmodSync5,
|
|
467599
|
-
existsSync as
|
|
467600
|
-
mkdirSync as
|
|
467601
|
-
readFileSync as
|
|
467817
|
+
existsSync as existsSync50,
|
|
467818
|
+
mkdirSync as mkdirSync24,
|
|
467819
|
+
readFileSync as readFileSync27,
|
|
467602
467820
|
unlinkSync as unlinkSync11,
|
|
467603
|
-
writeFileSync as
|
|
467821
|
+
writeFileSync as writeFileSync20
|
|
467604
467822
|
} from "fs";
|
|
467605
467823
|
import { createServer as createServer2 } from "net";
|
|
467606
467824
|
import { dirname as dirname23 } from "path";
|
|
@@ -467676,12 +467894,18 @@ class HearthDaemon {
|
|
|
467676
467894
|
this.log(`hearth starting \u2014 socket: ${this.config.daemon.socketPath}`);
|
|
467677
467895
|
const pidPath = DEFAULT_PID_PATH;
|
|
467678
467896
|
try {
|
|
467679
|
-
|
|
467680
|
-
|
|
467897
|
+
mkdirSync24(dirname23(pidPath), { recursive: true, mode: 448 });
|
|
467898
|
+
writeFileSync20(pidPath, String(process.pid), { mode: 384 });
|
|
467681
467899
|
} catch (err2) {
|
|
467682
467900
|
this.log(`pidfile write failed: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
467683
467901
|
}
|
|
467684
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 {}
|
|
467685
467909
|
const tuiOwner = readBridgeOwner();
|
|
467686
467910
|
this.tuiOwnerPid = tuiOwner && tuiOwner !== process.pid ? tuiOwner : null;
|
|
467687
467911
|
if (this.tuiOwnerPid) {
|
|
@@ -467714,7 +467938,7 @@ class HearthDaemon {
|
|
|
467714
467938
|
await new Promise((res) => this.socketServer?.close(() => res()));
|
|
467715
467939
|
this.socketServer = null;
|
|
467716
467940
|
}
|
|
467717
|
-
if (
|
|
467941
|
+
if (existsSync50(this.config.daemon.socketPath)) {
|
|
467718
467942
|
try {
|
|
467719
467943
|
unlinkSync11(this.config.daemon.socketPath);
|
|
467720
467944
|
} catch (e) {
|
|
@@ -467854,8 +468078,8 @@ class HearthDaemon {
|
|
|
467854
468078
|
}
|
|
467855
468079
|
async startSocket() {
|
|
467856
468080
|
const path = this.config.daemon.socketPath;
|
|
467857
|
-
|
|
467858
|
-
if (
|
|
468081
|
+
mkdirSync24(dirname23(path), { recursive: true, mode: 448 });
|
|
468082
|
+
if (existsSync50(path)) {
|
|
467859
468083
|
try {
|
|
467860
468084
|
unlinkSync11(path);
|
|
467861
468085
|
} catch (e) {
|
|
@@ -468728,10 +468952,10 @@ class HearthDaemon {
|
|
|
468728
468952
|
}
|
|
468729
468953
|
restoreWorkspaces() {
|
|
468730
468954
|
const stateFile = this.config.daemon.stateFile;
|
|
468731
|
-
if (!
|
|
468955
|
+
if (!existsSync50(stateFile))
|
|
468732
468956
|
return;
|
|
468733
468957
|
try {
|
|
468734
|
-
const parsed = JSON.parse(
|
|
468958
|
+
const parsed = JSON.parse(readFileSync27(stateFile, "utf-8"));
|
|
468735
468959
|
for (const entry of parsed.workspaces ?? []) {
|
|
468736
468960
|
const surface = this.host.getSurface(entry.surfaceId);
|
|
468737
468961
|
const binding = resolveChatBinding(this.config, entry.surfaceId, entry.externalId);
|
|
@@ -468766,8 +468990,8 @@ class HearthDaemon {
|
|
|
468766
468990
|
activeTabId: ws.getActiveTabId() ?? undefined
|
|
468767
468991
|
}))
|
|
468768
468992
|
};
|
|
468769
|
-
|
|
468770
|
-
|
|
468993
|
+
mkdirSync24(dirname23(this.config.daemon.stateFile), { recursive: true, mode: 448 });
|
|
468994
|
+
writeFileSync20(this.config.daemon.stateFile, JSON.stringify(state, null, 2), { mode: 384 });
|
|
468771
468995
|
} catch (err2) {
|
|
468772
468996
|
this.log(`persist failed: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
468773
468997
|
}
|
|
@@ -468781,8 +469005,8 @@ function createFileLogger(logPath) {
|
|
|
468781
469005
|
return () => {};
|
|
468782
469006
|
try {
|
|
468783
469007
|
const dir = dirname23(logPath);
|
|
468784
|
-
if (!
|
|
468785
|
-
|
|
469008
|
+
if (!existsSync50(dir))
|
|
469009
|
+
mkdirSync24(dir, { recursive: true });
|
|
468786
469010
|
} catch {}
|
|
468787
469011
|
return (line2) => {
|
|
468788
469012
|
try {
|
|
@@ -468810,7 +469034,7 @@ __export(exports_cli, {
|
|
|
468810
469034
|
runHearthCli: () => runHearthCli,
|
|
468811
469035
|
parseHearthArgs: () => parseHearthArgs
|
|
468812
469036
|
});
|
|
468813
|
-
import { existsSync as
|
|
469037
|
+
import { existsSync as existsSync51 } from "fs";
|
|
468814
469038
|
function parseHearthArgs(argv) {
|
|
468815
469039
|
const [sub, ...rest] = argv;
|
|
468816
469040
|
if (!sub || sub === "help" || sub === "--help" || sub === "-h")
|
|
@@ -468915,7 +469139,7 @@ async function runStart(detach) {
|
|
|
468915
469139
|
async function runStop() {
|
|
468916
469140
|
const config2 = loadHearthConfig();
|
|
468917
469141
|
const sock = config2.daemon.socketPath;
|
|
468918
|
-
if (!
|
|
469142
|
+
if (!existsSync51(sock)) {
|
|
468919
469143
|
process.stderr.write(`daemon not running
|
|
468920
469144
|
`);
|
|
468921
469145
|
return 1;
|
|
@@ -469036,7 +469260,7 @@ async function runDoctor() {
|
|
|
469036
469260
|
lines.push(` chats: ${String(chats)} paired`);
|
|
469037
469261
|
}
|
|
469038
469262
|
lines.push("");
|
|
469039
|
-
lines.push(`daemon: ${
|
|
469263
|
+
lines.push(`daemon: ${existsSync51(config2.daemon.socketPath) ? "socket present" : "socket absent"}`);
|
|
469040
469264
|
const testToken = `bot123456:ABC-${"x".repeat(40)}`;
|
|
469041
469265
|
const { redact: redact2 } = await Promise.resolve().then(() => (init_redact(), exports_redact));
|
|
469042
469266
|
const scrubbed = redact2(testToken);
|
|
@@ -469049,7 +469273,7 @@ async function runDoctor() {
|
|
|
469049
469273
|
async function runLogs(follow) {
|
|
469050
469274
|
const config2 = loadHearthConfig();
|
|
469051
469275
|
const path = config2.daemon.logFile;
|
|
469052
|
-
if (!
|
|
469276
|
+
if (!existsSync51(path)) {
|
|
469053
469277
|
process.stderr.write(`log file missing: ${path}
|
|
469054
469278
|
`);
|
|
469055
469279
|
return 1;
|
|
@@ -469095,8 +469319,8 @@ var init_cli = __esm(() => {
|
|
|
469095
469319
|
|
|
469096
469320
|
// src/hearth/approve-cli.ts
|
|
469097
469321
|
var exports_approve_cli = {};
|
|
469098
|
-
import { existsSync as
|
|
469099
|
-
import { join as
|
|
469322
|
+
import { existsSync as existsSync52, readFileSync as readFileSync28 } from "fs";
|
|
469323
|
+
import { join as join55, resolve as resolvePath } from "path";
|
|
469100
469324
|
function expandHome3(p2) {
|
|
469101
469325
|
return expandHome(p2);
|
|
469102
469326
|
}
|
|
@@ -469114,22 +469338,22 @@ function matchesGlob(path, patterns) {
|
|
|
469114
469338
|
}
|
|
469115
469339
|
function readStdinSync() {
|
|
469116
469340
|
try {
|
|
469117
|
-
return
|
|
469341
|
+
return readFileSync28(0, "utf-8");
|
|
469118
469342
|
} catch {
|
|
469119
469343
|
return "";
|
|
469120
469344
|
}
|
|
469121
469345
|
}
|
|
469122
469346
|
function getSocketPath() {
|
|
469123
|
-
return process.env.SOULFORGE_HEARTH_SOCKET ??
|
|
469347
|
+
return process.env.SOULFORGE_HEARTH_SOCKET ?? join55(configDir(), "hearth.sock");
|
|
469124
469348
|
}
|
|
469125
469349
|
function loadExtraDenylist(cwd2) {
|
|
469126
|
-
const paths = [
|
|
469350
|
+
const paths = [join55(configDir(), "hearth.json"), join55(cwd2, ".soulforge", "hearth.json")];
|
|
469127
469351
|
const extras = new Set;
|
|
469128
469352
|
for (const p2 of paths) {
|
|
469129
|
-
if (!
|
|
469353
|
+
if (!existsSync52(p2))
|
|
469130
469354
|
continue;
|
|
469131
469355
|
try {
|
|
469132
|
-
const parsed = JSON.parse(
|
|
469356
|
+
const parsed = JSON.parse(readFileSync28(p2, "utf-8"));
|
|
469133
469357
|
for (const glob of parsed.defaults?.readDenylistExtra ?? [])
|
|
469134
469358
|
extras.add(glob);
|
|
469135
469359
|
for (const surface of Object.values(parsed.surfaces ?? {})) {
|
|
@@ -469248,7 +469472,7 @@ async function runDenyRead(hook) {
|
|
|
469248
469472
|
}
|
|
469249
469473
|
async function runHealth() {
|
|
469250
469474
|
const sock = getSocketPath();
|
|
469251
|
-
if (!
|
|
469475
|
+
if (!existsSync52(sock)) {
|
|
469252
469476
|
process.stderr.write(`socket missing: ${sock}
|
|
469253
469477
|
`);
|
|
469254
469478
|
return 1;
|
|
@@ -469684,32 +469908,32 @@ var init_headless = __esm(() => {
|
|
|
469684
469908
|
});
|
|
469685
469909
|
|
|
469686
469910
|
// src/core/presets/registry.ts
|
|
469687
|
-
import { existsSync as
|
|
469688
|
-
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";
|
|
469689
469913
|
function getCacheDirInternal() {
|
|
469690
|
-
return
|
|
469914
|
+
return join56(configDir(), "presets");
|
|
469691
469915
|
}
|
|
469692
469916
|
function getRegistryCacheFile() {
|
|
469693
|
-
return
|
|
469917
|
+
return join56(getCacheDirInternal(), "registry.json");
|
|
469694
469918
|
}
|
|
469695
469919
|
function ensureCacheDir() {
|
|
469696
469920
|
const dir = getCacheDirInternal();
|
|
469697
|
-
if (!
|
|
469698
|
-
|
|
469921
|
+
if (!existsSync53(dir))
|
|
469922
|
+
mkdirSync25(dir, { recursive: true, mode: 448 });
|
|
469699
469923
|
}
|
|
469700
469924
|
function readCachedRegistry() {
|
|
469701
469925
|
const file2 = getRegistryCacheFile();
|
|
469702
|
-
if (!
|
|
469926
|
+
if (!existsSync53(file2))
|
|
469703
469927
|
return null;
|
|
469704
469928
|
try {
|
|
469705
|
-
return JSON.parse(
|
|
469929
|
+
return JSON.parse(readFileSync29(file2, "utf-8"));
|
|
469706
469930
|
} catch {
|
|
469707
469931
|
return null;
|
|
469708
469932
|
}
|
|
469709
469933
|
}
|
|
469710
469934
|
function cacheAge() {
|
|
469711
469935
|
const file2 = getRegistryCacheFile();
|
|
469712
|
-
if (!
|
|
469936
|
+
if (!existsSync53(file2))
|
|
469713
469937
|
return Number.POSITIVE_INFINITY;
|
|
469714
469938
|
try {
|
|
469715
469939
|
return Date.now() - statSync11(file2).mtimeMs;
|
|
@@ -469748,7 +469972,7 @@ async function fetchRegistry(force = false) {
|
|
|
469748
469972
|
throw new Error(`Registry too large (${text3.length} bytes, max ${MAX_REGISTRY_BYTES})`);
|
|
469749
469973
|
}
|
|
469750
469974
|
const parsed = validateRegistry(JSON.parse(text3), REGISTRY_URL);
|
|
469751
|
-
|
|
469975
|
+
writeFileSync21(getRegistryCacheFile(), text3);
|
|
469752
469976
|
return parsed;
|
|
469753
469977
|
} catch (err2) {
|
|
469754
469978
|
const cached3 = readCachedRegistry();
|
|
@@ -469773,8 +469997,8 @@ var init_registry2 = __esm(() => {
|
|
|
469773
469997
|
});
|
|
469774
469998
|
|
|
469775
469999
|
// src/core/presets/loader.ts
|
|
469776
|
-
import { existsSync as
|
|
469777
|
-
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";
|
|
469778
470002
|
function isUrl3(s2) {
|
|
469779
470003
|
return /^https?:\/\//i.test(s2);
|
|
469780
470004
|
}
|
|
@@ -469806,7 +470030,7 @@ function validatePreset(raw2, origin) {
|
|
|
469806
470030
|
return parsed.data;
|
|
469807
470031
|
}
|
|
469808
470032
|
function cacheFile(name39, version2) {
|
|
469809
|
-
return
|
|
470033
|
+
return join57(getCacheDir(), `${name39}@${version2}.json`);
|
|
469810
470034
|
}
|
|
469811
470035
|
async function fetchPresetFromUrl(url2) {
|
|
469812
470036
|
if (!/^https:\/\//i.test(url2)) {
|
|
@@ -469829,7 +470053,7 @@ async function fetchPresetFromUrl(url2) {
|
|
|
469829
470053
|
const parsed = JSON.parse(text3);
|
|
469830
470054
|
const validated = validatePreset(parsed, url2);
|
|
469831
470055
|
try {
|
|
469832
|
-
|
|
470056
|
+
writeFileSync22(cacheFile(validated.name, validated.version), text3);
|
|
469833
470057
|
} catch {}
|
|
469834
470058
|
return validated;
|
|
469835
470059
|
} finally {
|
|
@@ -469839,7 +470063,7 @@ async function fetchPresetFromUrl(url2) {
|
|
|
469839
470063
|
function resolveLocalPath(spec3) {
|
|
469840
470064
|
const expanded = expandHome(spec3);
|
|
469841
470065
|
const abs = resolve42(expanded);
|
|
469842
|
-
if (!
|
|
470066
|
+
if (!existsSync54(abs))
|
|
469843
470067
|
throw new Error(`Preset file not found: ${abs}`);
|
|
469844
470068
|
const stat5 = lstatSync2(abs);
|
|
469845
470069
|
if (stat5.isSymbolicLink()) {
|
|
@@ -469858,7 +470082,7 @@ async function resolvePreset(spec3) {
|
|
|
469858
470082
|
}
|
|
469859
470083
|
if (looksLikePath(spec3) || spec3.endsWith(".json")) {
|
|
469860
470084
|
const abs = resolveLocalPath(spec3);
|
|
469861
|
-
const raw2 = JSON.parse(
|
|
470085
|
+
const raw2 = JSON.parse(readFileSync30(abs, "utf-8"));
|
|
469862
470086
|
return { preset: validatePreset(raw2, abs), source: "path", origin: abs };
|
|
469863
470087
|
}
|
|
469864
470088
|
const registry2 = await fetchRegistry();
|
|
@@ -469963,10 +470187,10 @@ var init_merge2 = __esm(() => {
|
|
|
469963
470187
|
});
|
|
469964
470188
|
|
|
469965
470189
|
// src/core/presets/init.ts
|
|
469966
|
-
import { existsSync as
|
|
469967
|
-
import { join as
|
|
470190
|
+
import { existsSync as existsSync55, readFileSync as readFileSync31 } from "fs";
|
|
470191
|
+
import { join as join58 } from "path";
|
|
469968
470192
|
function getGlobalConfigFile() {
|
|
469969
|
-
return
|
|
470193
|
+
return join58(configDir(), "config.json");
|
|
469970
470194
|
}
|
|
469971
470195
|
function isValidPresetSpec(spec3) {
|
|
469972
470196
|
if (spec3.length < 2)
|
|
@@ -469974,10 +470198,10 @@ function isValidPresetSpec(spec3) {
|
|
|
469974
470198
|
return VALID_SPEC.test(spec3);
|
|
469975
470199
|
}
|
|
469976
470200
|
function readPresetSpecs(file2) {
|
|
469977
|
-
if (!
|
|
470201
|
+
if (!existsSync55(file2))
|
|
469978
470202
|
return [];
|
|
469979
470203
|
try {
|
|
469980
|
-
const cfg = JSON.parse(
|
|
470204
|
+
const cfg = JSON.parse(readFileSync31(file2, "utf-8"));
|
|
469981
470205
|
if (!Array.isArray(cfg.presets))
|
|
469982
470206
|
return [];
|
|
469983
470207
|
const out2 = [];
|
|
@@ -470007,7 +470231,7 @@ function dedupe(list) {
|
|
|
470007
470231
|
}
|
|
470008
470232
|
async function initPresetsFromEnv(opts = {}) {
|
|
470009
470233
|
const cwd2 = opts.cwd ?? process.cwd();
|
|
470010
|
-
const projectFile =
|
|
470234
|
+
const projectFile = join58(cwd2, ".soulforge", "config.json");
|
|
470011
470235
|
const globalSpecs = readPresetSpecs(getGlobalConfigFile());
|
|
470012
470236
|
const projectSpecs = readPresetSpecs(projectFile);
|
|
470013
470237
|
const cliSpecs = (process.env.SOULFORGE_PRESETS ?? "").split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
@@ -470073,29 +470297,29 @@ var init_init = __esm(() => {
|
|
|
470073
470297
|
});
|
|
470074
470298
|
|
|
470075
470299
|
// src/core/presets/persist.ts
|
|
470076
|
-
import { existsSync as
|
|
470077
|
-
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";
|
|
470078
470302
|
function getGlobalDir() {
|
|
470079
470303
|
return configDir();
|
|
470080
470304
|
}
|
|
470081
470305
|
function getGlobalFile() {
|
|
470082
|
-
return
|
|
470306
|
+
return join59(getGlobalDir(), "config.json");
|
|
470083
470307
|
}
|
|
470084
470308
|
function resolveScopeFile(scope, cwd2) {
|
|
470085
470309
|
if (scope === "global") {
|
|
470086
470310
|
const dir2 = getGlobalDir();
|
|
470087
|
-
if (!
|
|
470088
|
-
|
|
470311
|
+
if (!existsSync56(dir2))
|
|
470312
|
+
mkdirSync26(dir2, { recursive: true, mode: 448 });
|
|
470089
470313
|
return getGlobalFile();
|
|
470090
470314
|
}
|
|
470091
470315
|
const dir = ensureSoulforgeDir(cwd2);
|
|
470092
|
-
return
|
|
470316
|
+
return join59(dir, "config.json");
|
|
470093
470317
|
}
|
|
470094
470318
|
function readJsonObject(file2) {
|
|
470095
|
-
if (!
|
|
470319
|
+
if (!existsSync56(file2))
|
|
470096
470320
|
return {};
|
|
470097
470321
|
try {
|
|
470098
|
-
const parsed = JSON.parse(
|
|
470322
|
+
const parsed = JSON.parse(readFileSync32(file2, "utf-8"));
|
|
470099
470323
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
470100
470324
|
} catch {
|
|
470101
470325
|
return {};
|
|
@@ -470119,7 +470343,7 @@ function appendPresets(scope, specs, cwd2 = process.cwd()) {
|
|
|
470119
470343
|
const current = Array.isArray(currentRaw) ? currentRaw.filter((s2) => typeof s2 === "string") : [];
|
|
470120
470344
|
const merged = dedupeAppend(current, specs.filter(Boolean));
|
|
470121
470345
|
existing.presets = merged;
|
|
470122
|
-
|
|
470346
|
+
writeFileSync23(file2, JSON.stringify(existing, null, 2));
|
|
470123
470347
|
return { file: file2, before: current, after: merged };
|
|
470124
470348
|
}
|
|
470125
470349
|
function removePresets(scope, specs, cwd2 = process.cwd()) {
|
|
@@ -470134,8 +470358,8 @@ function removePresets(scope, specs, cwd2 = process.cwd()) {
|
|
|
470134
470358
|
} else {
|
|
470135
470359
|
existing.presets = filtered;
|
|
470136
470360
|
}
|
|
470137
|
-
if (
|
|
470138
|
-
|
|
470361
|
+
if (existsSync56(file2)) {
|
|
470362
|
+
writeFileSync23(file2, JSON.stringify(existing, null, 2));
|
|
470139
470363
|
}
|
|
470140
470364
|
return { file: file2, before: current, after: filtered };
|
|
470141
470365
|
}
|
|
@@ -475927,7 +476151,7 @@ function buildAssistantMessage({
|
|
|
475927
476151
|
|
|
475928
476152
|
// src/hooks/useChat.ts
|
|
475929
476153
|
import { readFile as readFile21 } from "fs/promises";
|
|
475930
|
-
import { join as
|
|
476154
|
+
import { join as join60 } from "path";
|
|
475931
476155
|
function pruneOldToolResults(msgs) {
|
|
475932
476156
|
let protectedTokens = 0;
|
|
475933
476157
|
let prunableTokens = 0;
|
|
@@ -477005,7 +477229,7 @@ ${description}`,
|
|
|
477005
477229
|
if (action === "execute" || action === "clear_execute") {
|
|
477006
477230
|
let content = null;
|
|
477007
477231
|
try {
|
|
477008
|
-
content = await readFile21(
|
|
477232
|
+
content = await readFile21(join60(cwd2, ".soulforge", "plans", planFileName(sessionIdRef.current)), "utf-8");
|
|
477009
477233
|
} catch {
|
|
477010
477234
|
content = planContent;
|
|
477011
477235
|
}
|
|
@@ -480150,8 +480374,8 @@ var init_ImageDisplay = __esm(() => {
|
|
|
480150
480374
|
});
|
|
480151
480375
|
|
|
480152
480376
|
// src/core/utils/syntax.ts
|
|
480153
|
-
import { existsSync as
|
|
480154
|
-
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";
|
|
480155
480379
|
import {
|
|
480156
480380
|
addDefaultParsers,
|
|
480157
480381
|
getTreeSitterClient,
|
|
@@ -480173,8 +480397,8 @@ function discoverParsers() {
|
|
|
480173
480397
|
continue;
|
|
480174
480398
|
const highlights = resolve43(langDir, "highlights.scm");
|
|
480175
480399
|
const injections = resolve43(langDir, "injections.scm");
|
|
480176
|
-
const hasHighlights =
|
|
480177
|
-
const hasInjections =
|
|
480400
|
+
const hasHighlights = existsSync57(highlights);
|
|
480401
|
+
const hasInjections = existsSync57(injections);
|
|
480178
480402
|
if (!hasHighlights)
|
|
480179
480403
|
continue;
|
|
480180
480404
|
const parser = {
|
|
@@ -480218,19 +480442,19 @@ var init_syntax = __esm(() => {
|
|
|
480218
480442
|
init_platform();
|
|
480219
480443
|
IS_COMPILED3 = isCompiledBinary(import.meta.url);
|
|
480220
480444
|
IS_DIST3 = !IS_COMPILED3 && import.meta.dir.includes("/dist");
|
|
480221
|
-
bundledAssets =
|
|
480222
|
-
distAssets =
|
|
480445
|
+
bundledAssets = join61(dataDir(), "opentui-assets");
|
|
480446
|
+
distAssets = join61(import.meta.dir, "opentui-assets");
|
|
480223
480447
|
if (IS_COMPILED3) {
|
|
480224
480448
|
coreAssetsDir = bundledAssets;
|
|
480225
480449
|
} else if (IS_DIST3) {
|
|
480226
|
-
coreAssetsDir =
|
|
480450
|
+
coreAssetsDir = existsSync57(distAssets) ? distAssets : bundledAssets;
|
|
480227
480451
|
} else {
|
|
480228
480452
|
try {
|
|
480229
480453
|
coreAssetsDir = resolve43(dirname24(__require.resolve("@opentui/core")), "assets");
|
|
480230
480454
|
} catch {
|
|
480231
480455
|
coreAssetsDir = bundledAssets;
|
|
480232
480456
|
}
|
|
480233
|
-
if (!
|
|
480457
|
+
if (!existsSync57(coreAssetsDir))
|
|
480234
480458
|
coreAssetsDir = bundledAssets;
|
|
480235
480459
|
}
|
|
480236
480460
|
MARKDOWN_INJECTION_MAP = {
|
|
@@ -480264,14 +480488,14 @@ var init_syntax = __esm(() => {
|
|
|
480264
480488
|
};
|
|
480265
480489
|
addDefaultParsers(discoverParsers());
|
|
480266
480490
|
if (IS_COMPILED3) {
|
|
480267
|
-
const worker =
|
|
480268
|
-
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)) {
|
|
480269
480493
|
process.env.OTUI_TREE_SITTER_WORKER_PATH = worker;
|
|
480270
480494
|
}
|
|
480271
480495
|
} else if (IS_DIST3) {
|
|
480272
480496
|
try {
|
|
480273
480497
|
const coreWorker = resolve43(dirname24(__require.resolve("@opentui/core")), "parser.worker.js");
|
|
480274
|
-
if (
|
|
480498
|
+
if (existsSync57(coreWorker)) {
|
|
480275
480499
|
process.env.OTUI_TREE_SITTER_WORKER_PATH = coreWorker;
|
|
480276
480500
|
}
|
|
480277
480501
|
} catch {}
|
|
@@ -484405,7 +484629,7 @@ var init_tool_grouping = __esm(() => {
|
|
|
484405
484629
|
|
|
484406
484630
|
// src/components/chat/MessageList.tsx
|
|
484407
484631
|
import { readFile as readFile23 } from "fs/promises";
|
|
484408
|
-
import { join as
|
|
484632
|
+
import { join as join62 } from "path";
|
|
484409
484633
|
import { TextAttributes as TextAttributes9 } from "@opentui/core";
|
|
484410
484634
|
function useReasoningExpanded() {
|
|
484411
484635
|
return import_react58.useContext(ReasoningExpandedContext);
|
|
@@ -484895,7 +485119,7 @@ function WritePlanCall({
|
|
|
484895
485119
|
import_react58.useEffect(() => {
|
|
484896
485120
|
if (!planFile)
|
|
484897
485121
|
return;
|
|
484898
|
-
readFile23(
|
|
485122
|
+
readFile23(join62(getCwd(), planFile), "utf-8").then(setMarkdown).catch(() => setMarkdown(null));
|
|
484899
485123
|
}, [planFile]);
|
|
484900
485124
|
if (!plan)
|
|
484901
485125
|
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ToolCallRow, {
|
|
@@ -491244,7 +491468,7 @@ var init_TerminalList = __esm(() => {
|
|
|
491244
491468
|
|
|
491245
491469
|
// src/components/layout/TabInstance.tsx
|
|
491246
491470
|
import { unlink as unlink3 } from "fs/promises";
|
|
491247
|
-
import { join as
|
|
491471
|
+
import { join as join63 } from "path";
|
|
491248
491472
|
import { TextAttributes as TextAttributes19 } from "@opentui/core";
|
|
491249
491473
|
function getScrollbarVisible(tk) {
|
|
491250
491474
|
return {
|
|
@@ -491554,7 +491778,7 @@ var init_TabInstance = __esm(async () => {
|
|
|
491554
491778
|
useCheckpointStore.getState().cleanupGitTags(tabId, cwd2);
|
|
491555
491779
|
}
|
|
491556
491780
|
useCheckpointStore.getState().clear(tabId);
|
|
491557
|
-
const p3 =
|
|
491781
|
+
const p3 = join63(cwd2, ".soulforge", "plans", planFileName(chat.sessionId));
|
|
491558
491782
|
unlink3(p3).catch(() => {});
|
|
491559
491783
|
};
|
|
491560
491784
|
}, [contextManager, tabId, cwd2, chat.sessionId]);
|
|
@@ -491711,7 +491935,7 @@ var init_TabInstance = __esm(async () => {
|
|
|
491711
491935
|
chat.setMessages(updated);
|
|
491712
491936
|
}, [chat.messages.length]);
|
|
491713
491937
|
const cleanupPlanFile = import_react83.useCallback(() => {
|
|
491714
|
-
const p3 =
|
|
491938
|
+
const p3 = join63(cwd2, ".soulforge", "plans", planFileName(chat.sessionId));
|
|
491715
491939
|
unlink3(p3).catch(() => {});
|
|
491716
491940
|
}, [cwd2, chat.sessionId]);
|
|
491717
491941
|
const onAcceptPlan = import_react83.useCallback(() => {
|
|
@@ -498640,7 +498864,7 @@ function StatusDashboard({
|
|
|
498640
498864
|
Promise.resolve().then(() => (init_service(), exports_service))
|
|
498641
498865
|
]);
|
|
498642
498866
|
const cfg = loadHearthConfig2();
|
|
498643
|
-
const { existsSync:
|
|
498867
|
+
const { existsSync: existsSync58 } = await import("fs");
|
|
498644
498868
|
const svc = await getServiceStatus2();
|
|
498645
498869
|
const persistence = {
|
|
498646
498870
|
installed: svc.installed,
|
|
@@ -498648,7 +498872,7 @@ function StatusDashboard({
|
|
|
498648
498872
|
platform: svc.platform,
|
|
498649
498873
|
unitLabel: svc.unitLabel
|
|
498650
498874
|
};
|
|
498651
|
-
if (!
|
|
498875
|
+
if (!existsSync58(cfg.daemon.socketPath)) {
|
|
498652
498876
|
if (!stopped)
|
|
498653
498877
|
setHearth({
|
|
498654
498878
|
running: false,
|
|
@@ -501671,9 +501895,9 @@ var init_hearth2 = __esm(() => {
|
|
|
501671
501895
|
|
|
501672
501896
|
// src/components/settings/HearthSettings.tsx
|
|
501673
501897
|
import { spawn as spawn21 } from "child_process";
|
|
501674
|
-
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";
|
|
501675
501899
|
import { tmpdir as tmpdir6 } from "os";
|
|
501676
|
-
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";
|
|
501677
501901
|
import { decodePasteBytes as decodePasteBytes6, TextAttributes as TextAttributes26 } from "@opentui/core";
|
|
501678
501902
|
function surfaceIdFrom(kind, id) {
|
|
501679
501903
|
return `${kind}:${id}`;
|
|
@@ -501697,7 +501921,7 @@ function formatUptime(ms) {
|
|
|
501697
501921
|
return `${String(h3)}h ${String(m5 % 60)}m`;
|
|
501698
501922
|
}
|
|
501699
501923
|
async function probeDaemon(socketPath) {
|
|
501700
|
-
if (!
|
|
501924
|
+
if (!existsSync58(socketPath))
|
|
501701
501925
|
return { running: false };
|
|
501702
501926
|
try {
|
|
501703
501927
|
const res = await socketRequest({ op: "health", v: HEARTH_PROTOCOL_VERSION }, { path: socketPath, timeoutMs: 1200 });
|
|
@@ -501717,7 +501941,7 @@ async function probeDaemon(socketPath) {
|
|
|
501717
501941
|
}
|
|
501718
501942
|
}
|
|
501719
501943
|
async function issuePairingCodeViaDaemon(socketPath, surfaceId) {
|
|
501720
|
-
if (!
|
|
501944
|
+
if (!existsSync58(socketPath)) {
|
|
501721
501945
|
return { error: "Daemon not running \u2014 start it from the Daemon tab first." };
|
|
501722
501946
|
}
|
|
501723
501947
|
try {
|
|
@@ -502015,11 +502239,11 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502015
502239
|
const path = config2.daemon.logFile;
|
|
502016
502240
|
const read = () => {
|
|
502017
502241
|
try {
|
|
502018
|
-
if (!
|
|
502242
|
+
if (!existsSync58(path)) {
|
|
502019
502243
|
setLogLines(["(log file not yet created \u2014 start the daemon from the Daemon tab)"]);
|
|
502020
502244
|
return;
|
|
502021
502245
|
}
|
|
502022
|
-
const raw2 =
|
|
502246
|
+
const raw2 = readFileSync33(path, "utf-8");
|
|
502023
502247
|
const lines = raw2.split(`
|
|
502024
502248
|
`).filter(Boolean).slice(-1000);
|
|
502025
502249
|
setLogLines(lines);
|
|
@@ -502069,7 +502293,7 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502069
502293
|
flashMsg("err", "could not locate a soulforge launcher \u2014 set SOULFORGE_HEARTH_LAUNCHER or run `soulforge hearth start` manually");
|
|
502070
502294
|
return;
|
|
502071
502295
|
}
|
|
502072
|
-
const bootLog =
|
|
502296
|
+
const bootLog = join64(tmpdir6(), `soulforge-hearth-boot-${String(Date.now())}.log`);
|
|
502073
502297
|
appendFileSync5(bootLog, `# ${new Date().toISOString()} starting via ${launcher.kind}
|
|
502074
502298
|
` + `# cmd: ${launcher.cmd} ${launcher.args.join(" ")}
|
|
502075
502299
|
|
|
@@ -502122,10 +502346,10 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502122
502346
|
return;
|
|
502123
502347
|
}
|
|
502124
502348
|
}
|
|
502125
|
-
const pidPath =
|
|
502349
|
+
const pidPath = join64(configDir(), "hearth.pid");
|
|
502126
502350
|
let pid = null;
|
|
502127
|
-
if (
|
|
502128
|
-
const raw2 =
|
|
502351
|
+
if (existsSync58(pidPath)) {
|
|
502352
|
+
const raw2 = readFileSync33(pidPath, "utf-8").trim();
|
|
502129
502353
|
const n = Number.parseInt(raw2, 10);
|
|
502130
502354
|
if (!Number.isNaN(n) && n > 0)
|
|
502131
502355
|
pid = n;
|
|
@@ -502161,7 +502385,7 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502161
502385
|
logBackgroundError("hearth-settings", err2 instanceof Error ? err2.message : String(err2));
|
|
502162
502386
|
return;
|
|
502163
502387
|
}
|
|
502164
|
-
if (!
|
|
502388
|
+
if (!existsSync58(next.daemon.socketPath))
|
|
502165
502389
|
return;
|
|
502166
502390
|
socketRequest({ op: "reload", v: HEARTH_PROTOCOL_VERSION }, { path: next.daemon.socketPath, timeoutMs: 8000 }).then((res) => {
|
|
502167
502391
|
const parts2 = [];
|
|
@@ -504726,22 +504950,22 @@ function renderAddAllowed(_w, _rows, mode, t) {
|
|
|
504726
504950
|
}
|
|
504727
504951
|
function resolveLauncher() {
|
|
504728
504952
|
const envOverride = process.env.SOULFORGE_HEARTH_LAUNCHER;
|
|
504729
|
-
if (envOverride &&
|
|
504953
|
+
if (envOverride && existsSync58(envOverride)) {
|
|
504730
504954
|
return { kind: "env", cmd: envOverride, args: [] };
|
|
504731
504955
|
}
|
|
504732
504956
|
const checkout = findSourceCheckout(process.argv[1] ?? process.cwd());
|
|
504733
504957
|
if (checkout) {
|
|
504734
|
-
const bootTsx =
|
|
504735
|
-
const distEntry =
|
|
504736
|
-
const bin =
|
|
504737
|
-
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)) {
|
|
504738
504962
|
const bunBin = process.execPath.includes("bun") ? process.execPath : findBinaryOnPath("bun") ?? "bun";
|
|
504739
504963
|
return { kind: "dev-bun", cmd: bunBin, args: [bootTsx] };
|
|
504740
504964
|
}
|
|
504741
|
-
if (
|
|
504965
|
+
if (existsSync58(distEntry)) {
|
|
504742
504966
|
return { kind: "dist", cmd: distEntry, args: [] };
|
|
504743
504967
|
}
|
|
504744
|
-
if (
|
|
504968
|
+
if (existsSync58(bin) && isExecutable(bin)) {
|
|
504745
504969
|
return { kind: "dev-bin", cmd: bin, args: [] };
|
|
504746
504970
|
}
|
|
504747
504971
|
}
|
|
@@ -504751,12 +504975,12 @@ function resolveLauncher() {
|
|
|
504751
504975
|
return null;
|
|
504752
504976
|
}
|
|
504753
504977
|
function findSourceCheckout(startPath) {
|
|
504754
|
-
let dir = startPath &&
|
|
504978
|
+
let dir = startPath && existsSync58(startPath) ? resolve45(dirname25(startPath)) : resolve45(process.cwd());
|
|
504755
504979
|
for (let i4 = 0;i4 < 6; i4++) {
|
|
504756
|
-
const pkg =
|
|
504757
|
-
if (
|
|
504980
|
+
const pkg = join64(dir, "package.json");
|
|
504981
|
+
if (existsSync58(pkg)) {
|
|
504758
504982
|
try {
|
|
504759
|
-
const parsed = JSON.parse(
|
|
504983
|
+
const parsed = JSON.parse(readFileSync33(pkg, "utf-8"));
|
|
504760
504984
|
if (parsed.name === "@proxysoul/soulforge" || parsed.module?.includes("boot.tsx")) {
|
|
504761
504985
|
return dir;
|
|
504762
504986
|
}
|
|
@@ -504783,13 +505007,13 @@ function isExecutable(p3) {
|
|
|
504783
505007
|
}
|
|
504784
505008
|
function findBinaryOnPath(name39) {
|
|
504785
505009
|
const resolved = findOnPath(name39);
|
|
504786
|
-
if (resolved &&
|
|
505010
|
+
if (resolved && existsSync58(resolved) && isExecutable(resolved))
|
|
504787
505011
|
return resolved;
|
|
504788
505012
|
const exts = IS_WIN ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean) : [""];
|
|
504789
505013
|
for (const dir of (process.env.PATH ?? "").split(delimiter2)) {
|
|
504790
505014
|
for (const ext of exts) {
|
|
504791
|
-
const candidate =
|
|
504792
|
-
if (
|
|
505015
|
+
const candidate = join64(dir, name39 + ext);
|
|
505016
|
+
if (existsSync58(candidate) && isExecutable(candidate))
|
|
504793
505017
|
return candidate;
|
|
504794
505018
|
}
|
|
504795
505019
|
}
|
|
@@ -504797,9 +505021,9 @@ function findBinaryOnPath(name39) {
|
|
|
504797
505021
|
}
|
|
504798
505022
|
function readTailSafe(path, maxLines) {
|
|
504799
505023
|
try {
|
|
504800
|
-
if (!
|
|
505024
|
+
if (!existsSync58(path))
|
|
504801
505025
|
return null;
|
|
504802
|
-
const raw2 =
|
|
505026
|
+
const raw2 = readFileSync33(path, "utf-8");
|
|
504803
505027
|
const lines = raw2.split(`
|
|
504804
505028
|
`).filter(Boolean).slice(-maxLines);
|
|
504805
505029
|
const joined = lines.join(" \xB7 ");
|
|
@@ -504878,9 +505102,9 @@ var init_HearthSettings = __esm(async () => {
|
|
|
504878
505102
|
|
|
504879
505103
|
// src/core/intelligence/backends/lsp/installer.ts
|
|
504880
505104
|
import { spawn as spawn22 } from "child_process";
|
|
504881
|
-
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";
|
|
504882
505106
|
import { homedir as homedir14 } from "os";
|
|
504883
|
-
import { join as
|
|
505107
|
+
import { join as join65 } from "path";
|
|
504884
505108
|
function parsePurl(id) {
|
|
504885
505109
|
const match2 = id.match(/^pkg:(\w+)\/(.+?)@(.+)$/);
|
|
504886
505110
|
if (!match2)
|
|
@@ -504946,16 +505170,16 @@ function getToolchainRequirement(method) {
|
|
|
504946
505170
|
function loadRegistry() {
|
|
504947
505171
|
if (registryCache)
|
|
504948
505172
|
return registryCache;
|
|
504949
|
-
if (
|
|
505173
|
+
if (existsSync59(MASON_REGISTRY_LOCAL)) {
|
|
504950
505174
|
try {
|
|
504951
|
-
const raw2 =
|
|
505175
|
+
const raw2 = readFileSync34(MASON_REGISTRY_LOCAL, "utf-8");
|
|
504952
505176
|
registryCache = JSON.parse(raw2);
|
|
504953
505177
|
return registryCache;
|
|
504954
505178
|
} catch {}
|
|
504955
505179
|
}
|
|
504956
|
-
if (
|
|
505180
|
+
if (existsSync59(REGISTRY_CACHE)) {
|
|
504957
505181
|
try {
|
|
504958
|
-
const raw2 =
|
|
505182
|
+
const raw2 = readFileSync34(REGISTRY_CACHE, "utf-8");
|
|
504959
505183
|
registryCache = JSON.parse(raw2);
|
|
504960
505184
|
return registryCache;
|
|
504961
505185
|
} catch {}
|
|
@@ -504963,7 +505187,7 @@ function loadRegistry() {
|
|
|
504963
505187
|
return [];
|
|
504964
505188
|
}
|
|
504965
505189
|
async function downloadRegistry() {
|
|
504966
|
-
|
|
505190
|
+
mkdirSync27(configDir(), { recursive: true });
|
|
504967
505191
|
try {
|
|
504968
505192
|
const releaseResp = await fetch(MASON_REGISTRY_RELEASE_URL, {
|
|
504969
505193
|
headers: { Accept: "application/vnd.github.v3+json", "User-Agent": "SoulForge" }
|
|
@@ -504978,15 +505202,15 @@ async function downloadRegistry() {
|
|
|
504978
505202
|
if (!zipResp.ok)
|
|
504979
505203
|
throw new Error(`Download HTTP ${String(zipResp.status)}`);
|
|
504980
505204
|
const zipBuf = await zipResp.arrayBuffer();
|
|
504981
|
-
const tmpZip =
|
|
504982
|
-
|
|
505205
|
+
const tmpZip = join65(configDir(), "mason-registry.zip");
|
|
505206
|
+
writeFileSync24(tmpZip, Buffer.from(zipBuf));
|
|
504983
505207
|
const result = extractArchive(tmpZip, configDir());
|
|
504984
505208
|
if (!result.success)
|
|
504985
505209
|
throw new Error(`Extract failed: ${result.error}`);
|
|
504986
505210
|
unlinkSync12(tmpZip);
|
|
504987
|
-
const jsonPath =
|
|
504988
|
-
const text3 =
|
|
504989
|
-
|
|
505211
|
+
const jsonPath = join65(configDir(), "registry.json");
|
|
505212
|
+
const text3 = readFileSync34(jsonPath, "utf-8");
|
|
505213
|
+
writeFileSync24(REGISTRY_CACHE, text3);
|
|
504990
505214
|
unlinkSync12(jsonPath);
|
|
504991
505215
|
registryCache = JSON.parse(text3);
|
|
504992
505216
|
return registryCache;
|
|
@@ -505020,8 +505244,8 @@ function loadVersions() {
|
|
|
505020
505244
|
if (versionCache)
|
|
505021
505245
|
return versionCache;
|
|
505022
505246
|
try {
|
|
505023
|
-
if (
|
|
505024
|
-
versionCache = JSON.parse(
|
|
505247
|
+
if (existsSync59(VERSIONS_FILE)) {
|
|
505248
|
+
versionCache = JSON.parse(readFileSync34(VERSIONS_FILE, "utf-8"));
|
|
505025
505249
|
return versionCache;
|
|
505026
505250
|
}
|
|
505027
505251
|
} catch {}
|
|
@@ -505030,8 +505254,8 @@ function loadVersions() {
|
|
|
505030
505254
|
function saveVersions(map2) {
|
|
505031
505255
|
versionCache = map2;
|
|
505032
505256
|
try {
|
|
505033
|
-
|
|
505034
|
-
|
|
505257
|
+
mkdirSync27(configDir(), { recursive: true });
|
|
505258
|
+
writeFileSync24(VERSIONS_FILE, JSON.stringify(map2, null, 2), "utf-8");
|
|
505035
505259
|
} catch {}
|
|
505036
505260
|
}
|
|
505037
505261
|
function recordInstalledVersion(pkg) {
|
|
@@ -505058,7 +505282,7 @@ function checkPackageStatus(pkg) {
|
|
|
505058
505282
|
const winSuffixes = IS_WIN ? [EXE, CMD_EXT, ""] : [""];
|
|
505059
505283
|
const probe = (dir, bin) => {
|
|
505060
505284
|
for (const sfx of winSuffixes) {
|
|
505061
|
-
if (
|
|
505285
|
+
if (existsSync59(join65(dir, bin + sfx)))
|
|
505062
505286
|
return true;
|
|
505063
505287
|
}
|
|
505064
505288
|
return false;
|
|
@@ -505071,12 +505295,12 @@ function checkPackageStatus(pkg) {
|
|
|
505071
505295
|
source = "PATH";
|
|
505072
505296
|
break;
|
|
505073
505297
|
}
|
|
505074
|
-
if (probe(
|
|
505298
|
+
if (probe(join65(SOULFORGE_LSP_DIR, "node_modules", ".bin"), bin)) {
|
|
505075
505299
|
installed2 = true;
|
|
505076
505300
|
source = "soulforge";
|
|
505077
505301
|
break;
|
|
505078
505302
|
}
|
|
505079
|
-
if (probe(
|
|
505303
|
+
if (probe(join65(SOULFORGE_LSP_DIR, "bin"), bin)) {
|
|
505080
505304
|
installed2 = true;
|
|
505081
505305
|
source = "soulforge";
|
|
505082
505306
|
break;
|
|
@@ -505149,7 +505373,7 @@ async function installPackage(pkg, onProgress) {
|
|
|
505149
505373
|
const purl = parsePurl(pkg.source.id);
|
|
505150
505374
|
if (!purl)
|
|
505151
505375
|
return { success: false, error: "Cannot parse package source" };
|
|
505152
|
-
|
|
505376
|
+
mkdirSync27(SOULFORGE_LSP_DIR, { recursive: true });
|
|
505153
505377
|
const log = (msg) => onProgress?.(msg);
|
|
505154
505378
|
try {
|
|
505155
505379
|
switch (purl.type) {
|
|
@@ -505160,8 +505384,8 @@ async function installPackage(pkg, onProgress) {
|
|
|
505160
505384
|
const bunBin = (() => {
|
|
505161
505385
|
if (commandExists("bun"))
|
|
505162
505386
|
return "bun";
|
|
505163
|
-
const sfBin =
|
|
505164
|
-
if (
|
|
505387
|
+
const sfBin = join65(dataDir(), "bin", `bun${EXE}`);
|
|
505388
|
+
if (existsSync59(sfBin))
|
|
505165
505389
|
return sfBin;
|
|
505166
505390
|
return "bun";
|
|
505167
505391
|
})();
|
|
@@ -505172,23 +505396,23 @@ async function installPackage(pkg, onProgress) {
|
|
|
505172
505396
|
}
|
|
505173
505397
|
case "pypi": {
|
|
505174
505398
|
log(`Installing ${purl.name} via pip3...`);
|
|
505175
|
-
const binDir =
|
|
505176
|
-
const pipDir =
|
|
505177
|
-
|
|
505178
|
-
|
|
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 });
|
|
505179
505403
|
await runCommand("pip3", ["install", "--target", pipDir, `${purl.name}==${purl.version}`], log);
|
|
505180
505404
|
if (pkg.bin) {
|
|
505181
505405
|
const moduleName = purl.name.replace(/-/g, "_");
|
|
505182
505406
|
for (const binName of Object.keys(pkg.bin)) {
|
|
505183
505407
|
if (IS_WIN) {
|
|
505184
|
-
const wrapper =
|
|
505185
|
-
|
|
505408
|
+
const wrapper = join65(binDir, binName + CMD_EXT);
|
|
505409
|
+
writeFileSync24(wrapper, `@echo off\r
|
|
505186
505410
|
set "PYTHONPATH=${pipDir};%PYTHONPATH%"\r
|
|
505187
505411
|
python -m ${moduleName} %*\r
|
|
505188
505412
|
`);
|
|
505189
505413
|
} else {
|
|
505190
|
-
const wrapper =
|
|
505191
|
-
|
|
505414
|
+
const wrapper = join65(binDir, binName);
|
|
505415
|
+
writeFileSync24(wrapper, `#!/usr/bin/env bash
|
|
505192
505416
|
PYTHONPATH="${pipDir}:$PYTHONPATH" exec python3 -m ${moduleName} "$@"
|
|
505193
505417
|
`);
|
|
505194
505418
|
chmodSync6(wrapper, 493);
|
|
@@ -505199,22 +505423,22 @@ PYTHONPATH="${pipDir}:$PYTHONPATH" exec python3 -m ${moduleName} "$@"
|
|
|
505199
505423
|
}
|
|
505200
505424
|
case "golang": {
|
|
505201
505425
|
log(`Installing ${purl.namespace}/${purl.name} via go install...`);
|
|
505202
|
-
const binDir =
|
|
505203
|
-
|
|
505426
|
+
const binDir = join65(SOULFORGE_LSP_DIR, "bin");
|
|
505427
|
+
mkdirSync27(binDir, { recursive: true });
|
|
505204
505428
|
const fullPkg = `${purl.namespace}/${purl.name}@${purl.version}`;
|
|
505205
505429
|
await runCommand("go", ["install", fullPkg], log, { GOBIN: binDir });
|
|
505206
505430
|
break;
|
|
505207
505431
|
}
|
|
505208
505432
|
case "cargo": {
|
|
505209
505433
|
log(`Installing ${purl.name} via cargo...`);
|
|
505210
|
-
|
|
505434
|
+
mkdirSync27(join65(SOULFORGE_LSP_DIR, "bin"), { recursive: true });
|
|
505211
505435
|
await runCommand("cargo", ["install", purl.name, "--version", purl.version, "--root", SOULFORGE_LSP_DIR], log);
|
|
505212
505436
|
break;
|
|
505213
505437
|
}
|
|
505214
505438
|
case "github": {
|
|
505215
505439
|
log(`Downloading ${purl.namespace}/${purl.name} from GitHub...`);
|
|
505216
|
-
const binDir =
|
|
505217
|
-
|
|
505440
|
+
const binDir = join65(SOULFORGE_LSP_DIR, "bin");
|
|
505441
|
+
mkdirSync27(binDir, { recursive: true });
|
|
505218
505442
|
const asset = findPlatformAsset(pkg);
|
|
505219
505443
|
if (!asset) {
|
|
505220
505444
|
const target = getMasonTarget();
|
|
@@ -505225,17 +505449,17 @@ PYTHONPATH="${pipDir}:$PYTHONPATH" exec python3 -m ${moduleName} "$@"
|
|
|
505225
505449
|
}
|
|
505226
505450
|
const version2 = purl.version;
|
|
505227
505451
|
const fileUrl = `https://github.com/${purl.namespace}/${purl.name}/releases/download/${version2}/${resolveAssetTemplate(asset.file, version2)}`;
|
|
505228
|
-
const tmpDir2 =
|
|
505229
|
-
|
|
505452
|
+
const tmpDir2 = join65(SOULFORGE_LSP_DIR, ".tmp");
|
|
505453
|
+
mkdirSync27(tmpDir2, { recursive: true });
|
|
505230
505454
|
log(`Downloading ${fileUrl}...`);
|
|
505231
|
-
await runCommand("curl", ["-fSL", "-o",
|
|
505232
|
-
const downloadPath =
|
|
505455
|
+
await runCommand("curl", ["-fSL", "-o", join65(tmpDir2, "download"), fileUrl], log);
|
|
505456
|
+
const downloadPath = join65(tmpDir2, "download");
|
|
505233
505457
|
const lower2 = asset.file.toLowerCase();
|
|
505234
505458
|
let archivePath = downloadPath;
|
|
505235
505459
|
if (lower2.endsWith(".tar.gz") || lower2.endsWith(".tgz") || lower2.endsWith(".tar.xz") || lower2.endsWith(".zip")) {
|
|
505236
505460
|
const { safeRename: safeRename2 } = await Promise.resolve().then(() => (init_platform(), exports_platform));
|
|
505237
505461
|
const ext = lower2.endsWith(".tgz") ? ".tar.gz" : lower2.endsWith(".tar.gz") ? ".tar.gz" : lower2.endsWith(".tar.xz") ? ".tar.xz" : ".zip";
|
|
505238
|
-
archivePath =
|
|
505462
|
+
archivePath = join65(tmpDir2, `download${ext}`);
|
|
505239
505463
|
try {
|
|
505240
505464
|
safeRename2(downloadPath, archivePath);
|
|
505241
505465
|
} catch {}
|
|
@@ -505250,20 +505474,20 @@ PYTHONPATH="${pipDir}:$PYTHONPATH" exec python3 -m ${moduleName} "$@"
|
|
|
505250
505474
|
const baseCandidates = [
|
|
505251
505475
|
resolvedBin,
|
|
505252
505476
|
binName,
|
|
505253
|
-
|
|
505254
|
-
|
|
505477
|
+
join65(purl.name, resolvedBin),
|
|
505478
|
+
join65(purl.name, binName)
|
|
505255
505479
|
];
|
|
505256
505480
|
const candidates = [];
|
|
505257
505481
|
for (const c of baseCandidates) {
|
|
505258
505482
|
for (const ext of winExts) {
|
|
505259
|
-
candidates.push(
|
|
505483
|
+
candidates.push(join65(tmpDir2, c + ext));
|
|
505260
505484
|
}
|
|
505261
505485
|
}
|
|
505262
505486
|
for (const candidate of candidates) {
|
|
505263
|
-
if (
|
|
505487
|
+
if (existsSync59(candidate)) {
|
|
505264
505488
|
const { copyFileSync: copyFileSync2 } = await import("fs");
|
|
505265
505489
|
const srcExt = candidate.endsWith(".exe") ? ".exe" : candidate.endsWith(".cmd") ? ".cmd" : "";
|
|
505266
|
-
const dest =
|
|
505490
|
+
const dest = join65(binDir, binName + (IS_WIN ? srcExt : ""));
|
|
505267
505491
|
copyFileSync2(candidate, dest);
|
|
505268
505492
|
if (!IS_WIN)
|
|
505269
505493
|
chmodSync6(dest, 493);
|
|
@@ -505299,7 +505523,7 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505299
505523
|
const suffixes = IS_WIN ? [EXE, CMD_EXT, ""] : [""];
|
|
505300
505524
|
for (const sfx of suffixes) {
|
|
505301
505525
|
try {
|
|
505302
|
-
unlinkSync13(
|
|
505526
|
+
unlinkSync13(join65(dir, bin + sfx));
|
|
505303
505527
|
} catch {}
|
|
505304
505528
|
}
|
|
505305
505529
|
};
|
|
@@ -505312,8 +505536,8 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505312
505536
|
const bunBin = (() => {
|
|
505313
505537
|
if (commandExists("bun"))
|
|
505314
505538
|
return "bun";
|
|
505315
|
-
const sfBin =
|
|
505316
|
-
if (
|
|
505539
|
+
const sfBin = join65(dataDir(), "bin", `bun${EXE}`);
|
|
505540
|
+
if (existsSync59(sfBin))
|
|
505317
505541
|
return sfBin;
|
|
505318
505542
|
return "bun";
|
|
505319
505543
|
})();
|
|
@@ -505323,7 +505547,7 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505323
505547
|
});
|
|
505324
505548
|
if (removeResult.status !== 0) {
|
|
505325
505549
|
for (const bin of binaries) {
|
|
505326
|
-
removeBin(
|
|
505550
|
+
removeBin(join65(SOULFORGE_LSP_DIR, "node_modules", ".bin"), bin);
|
|
505327
505551
|
}
|
|
505328
505552
|
}
|
|
505329
505553
|
break;
|
|
@@ -505331,13 +505555,13 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505331
505555
|
case "pypi": {
|
|
505332
505556
|
log(`Removing ${purl.name}...`);
|
|
505333
505557
|
const { rmSync: rmSync7 } = await import("fs");
|
|
505334
|
-
const pipDir =
|
|
505335
|
-
const pkgDir =
|
|
505558
|
+
const pipDir = join65(SOULFORGE_LSP_DIR, "pip-packages");
|
|
505559
|
+
const pkgDir = join65(pipDir, purl.name.replace(/-/g, "_"));
|
|
505336
505560
|
try {
|
|
505337
505561
|
rmSync7(pkgDir, { recursive: true, force: true });
|
|
505338
505562
|
} catch {}
|
|
505339
505563
|
for (const bin of binaries) {
|
|
505340
|
-
removeBin(
|
|
505564
|
+
removeBin(join65(SOULFORGE_LSP_DIR, "bin"), bin);
|
|
505341
505565
|
}
|
|
505342
505566
|
break;
|
|
505343
505567
|
}
|
|
@@ -505345,14 +505569,14 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505345
505569
|
case "cargo": {
|
|
505346
505570
|
log(`Removing ${purl.name} binaries...`);
|
|
505347
505571
|
for (const bin of binaries) {
|
|
505348
|
-
removeBin(
|
|
505572
|
+
removeBin(join65(SOULFORGE_LSP_DIR, "bin"), bin);
|
|
505349
505573
|
}
|
|
505350
505574
|
break;
|
|
505351
505575
|
}
|
|
505352
505576
|
case "github": {
|
|
505353
505577
|
log(`Removing ${purl.name} binaries...`);
|
|
505354
505578
|
for (const bin of binaries) {
|
|
505355
|
-
removeBin(
|
|
505579
|
+
removeBin(join65(SOULFORGE_LSP_DIR, "bin"), bin);
|
|
505356
505580
|
}
|
|
505357
505581
|
break;
|
|
505358
505582
|
}
|
|
@@ -505443,11 +505667,11 @@ var SOULFORGE_LSP_DIR, VERSIONS_FILE, MASON_REGISTRY_LOCAL, MASON_REGISTRY_RELEA
|
|
|
505443
505667
|
var init_installer = __esm(() => {
|
|
505444
505668
|
init_archive();
|
|
505445
505669
|
init_platform();
|
|
505446
|
-
SOULFORGE_LSP_DIR =
|
|
505447
|
-
VERSIONS_FILE =
|
|
505448
|
-
MASON_REGISTRY_LOCAL = IS_WIN ?
|
|
505449
|
-
REGISTRY_CACHE =
|
|
505450
|
-
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");
|
|
505451
505675
|
pathCache = new Map;
|
|
505452
505676
|
PROJECT_INDICATORS = {
|
|
505453
505677
|
TypeScript: ["tsconfig.json", "*.ts", "*.tsx"],
|
|
@@ -505475,8 +505699,8 @@ var init_installer = __esm(() => {
|
|
|
505475
505699
|
});
|
|
505476
505700
|
|
|
505477
505701
|
// src/components/settings/LspInstallSearch.tsx
|
|
505478
|
-
import { existsSync as
|
|
505479
|
-
import { join as
|
|
505702
|
+
import { existsSync as existsSync60 } from "fs";
|
|
505703
|
+
import { join as join66 } from "path";
|
|
505480
505704
|
import { TextAttributes as TextAttributes27 } from "@opentui/core";
|
|
505481
505705
|
function methodLabel(status) {
|
|
505482
505706
|
if (status.requiresToolchain && !status.toolchainAvailable) {
|
|
@@ -505624,7 +505848,7 @@ function LspInstallSearch({
|
|
|
505624
505848
|
const defaultScopeCursor = detectScope("disabledLspServers") === "project" ? 0 : 1;
|
|
505625
505849
|
const [scopeCursor, setScopeCursor] = import_react144.useState(defaultScopeCursor);
|
|
505626
505850
|
const downloadAttemptedRef = import_react144.useRef(false);
|
|
505627
|
-
const isInProject =
|
|
505851
|
+
const isInProject = existsSync60(join66(cwd2, ".git"));
|
|
505628
505852
|
const { width: termCols, height: termRows } = useTerminalDimensions();
|
|
505629
505853
|
const containerRows = termRows - 2;
|
|
505630
505854
|
const popupWidth = Math.min(MAX_POPUP_WIDTH3, Math.floor(termCols * 0.9));
|
|
@@ -507698,6 +507922,8 @@ function readValuesFromLayer(layer) {
|
|
|
507698
507922
|
v4.xaiReasoningEffort = layer.performance.xaiReasoningEffort;
|
|
507699
507923
|
if (layer.performance?.deepseekThinking !== undefined)
|
|
507700
507924
|
v4.deepseekThinking = layer.performance.deepseekThinking;
|
|
507925
|
+
if (layer.performance?.deepseekReasoningEffort !== undefined)
|
|
507926
|
+
v4.deepseekReasoningEffort = layer.performance.deepseekReasoningEffort;
|
|
507701
507927
|
if (layer.performance?.openrouterReasoningEffort !== undefined)
|
|
507702
507928
|
v4.openrouterReasoningEffort = layer.performance.openrouterReasoningEffort;
|
|
507703
507929
|
if (layer.performance?.openrouterReasoningMaxTokens !== undefined)
|
|
@@ -507773,6 +507999,8 @@ function buildPatch(key3, value) {
|
|
|
507773
507999
|
return { performance: { xaiReasoningEffort: value } };
|
|
507774
508000
|
case "deepseekThinking":
|
|
507775
508001
|
return { performance: { deepseekThinking: value } };
|
|
508002
|
+
case "deepseekReasoningEffort":
|
|
508003
|
+
return { performance: { deepseekReasoningEffort: value } };
|
|
507776
508004
|
case "openrouterReasoningEffort":
|
|
507777
508005
|
return { performance: { openrouterReasoningEffort: value } };
|
|
507778
508006
|
case "openrouterReasoningMaxTokens": {
|
|
@@ -507827,6 +508055,17 @@ function detectInitialScope(project2) {
|
|
|
507827
508055
|
return "project";
|
|
507828
508056
|
return "global";
|
|
507829
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
|
+
}
|
|
507830
508069
|
function ProviderSettings({
|
|
507831
508070
|
visible,
|
|
507832
508071
|
globalConfig: globalConfig2,
|
|
@@ -507843,6 +508082,7 @@ function ProviderSettings({
|
|
|
507843
508082
|
const [cursor, setCursor] = import_react150.useState(0);
|
|
507844
508083
|
const [scope, setScope] = import_react150.useState(() => detectInitialScope(projectConfig));
|
|
507845
508084
|
const vals = effectiveValues(globalConfig2, projectConfig);
|
|
508085
|
+
const activeModel = projectConfig?.defaultModel ?? globalConfig2.defaultModel ?? "";
|
|
507846
508086
|
const items = TAB_ITEMS[tab];
|
|
507847
508087
|
const tabIdx = TABS6.indexOf(tab);
|
|
507848
508088
|
const firstRowIdx = items.findIndex((i4) => i4.type !== "section" && i4.type !== "info");
|
|
@@ -507893,10 +508133,11 @@ function ProviderSettings({
|
|
|
507893
508133
|
return;
|
|
507894
508134
|
}
|
|
507895
508135
|
if (item.type === "cycle" && item.options) {
|
|
508136
|
+
const opts = resolveOptions(item.key, item.options, activeModel);
|
|
507896
508137
|
const current = String(vals[item.key]);
|
|
507897
|
-
const currentIdx =
|
|
507898
|
-
const nextIdx = (currentIdx + 1) %
|
|
507899
|
-
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);
|
|
507900
508141
|
}
|
|
507901
508142
|
};
|
|
507902
508143
|
useKeyboard((evt) => {
|
|
@@ -508087,7 +508328,7 @@ function ProviderSettings({
|
|
|
508087
508328
|
]
|
|
508088
508329
|
}, undefined, true, undefined, this);
|
|
508089
508330
|
} else {
|
|
508090
|
-
const opts = item.options ?? [];
|
|
508331
|
+
const opts = resolveOptions(item.key, item.options ?? [], activeModel);
|
|
508091
508332
|
const currentValue = item.type === "budget" ? String(vals.budgetTokens) : String(raw2);
|
|
508092
508333
|
const valColor = disabled ? t.textDim : currentValue === "off" ? t.textMuted : t.brandAlt;
|
|
508093
508334
|
body4 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
@@ -508187,8 +508428,9 @@ function ProviderSettings({
|
|
|
508187
508428
|
]
|
|
508188
508429
|
}, undefined, true, undefined, this);
|
|
508189
508430
|
}
|
|
508190
|
-
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;
|
|
508191
508432
|
var init_ProviderSettings = __esm(async () => {
|
|
508433
|
+
init_provider_options();
|
|
508192
508434
|
init_theme();
|
|
508193
508435
|
init_shared();
|
|
508194
508436
|
init_ui2();
|
|
@@ -508300,9 +508542,9 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508300
508542
|
{
|
|
508301
508543
|
key: "openaiReasoningEffort",
|
|
508302
508544
|
label: "Effort",
|
|
508303
|
-
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)",
|
|
508304
508546
|
type: "cycle",
|
|
508305
|
-
options: ["off", "none", "minimal", "low", "medium", "high"
|
|
508547
|
+
options: ["off", "none", "minimal", "low", "medium", "high"]
|
|
508306
508548
|
},
|
|
508307
508549
|
{
|
|
508308
508550
|
key: "openaiReasoningSummary",
|
|
@@ -508396,13 +508638,20 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508396
508638
|
DEEPSEEK_ITEMS = [
|
|
508397
508639
|
{
|
|
508398
508640
|
type: "info",
|
|
508399
|
-
text: "
|
|
508641
|
+
text: "V4 Pro / V4 Flash take Effort (high|max). Thinking toggle applies to deepseek-chat / V3 only \u2014 deepseek-reasoner always thinks."
|
|
508400
508642
|
},
|
|
508401
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
|
+
},
|
|
508402
508651
|
{
|
|
508403
508652
|
key: "deepseekThinking",
|
|
508404
508653
|
label: "Thinking",
|
|
508405
|
-
desc: "Enable chain-of-thought generation on deepseek-chat",
|
|
508654
|
+
desc: "Enable chain-of-thought generation on deepseek-chat / V3",
|
|
508406
508655
|
type: "cycle",
|
|
508407
508656
|
options: ["off", "enabled"]
|
|
508408
508657
|
}
|
|
@@ -508438,7 +508687,7 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508438
508687
|
COMPAT_ITEMS = [
|
|
508439
508688
|
{
|
|
508440
508689
|
type: "info",
|
|
508441
|
-
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."
|
|
508442
508691
|
},
|
|
508443
508692
|
{ type: "section", label: "Shared effort" },
|
|
508444
508693
|
{
|
|
@@ -508501,6 +508750,7 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508501
508750
|
googleIncludeThoughts: false,
|
|
508502
508751
|
xaiReasoningEffort: "off",
|
|
508503
508752
|
deepseekThinking: "off",
|
|
508753
|
+
deepseekReasoningEffort: "off",
|
|
508504
508754
|
openrouterReasoningEffort: "off",
|
|
508505
508755
|
openrouterReasoningMaxTokens: "off",
|
|
508506
508756
|
openrouterExcludeReasoning: false,
|
|
@@ -508511,6 +508761,13 @@ var init_ProviderSettings = __esm(async () => {
|
|
|
508511
508761
|
groqReasoningFormat: "off",
|
|
508512
508762
|
cacheTtl: "5m"
|
|
508513
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
|
+
};
|
|
508514
508771
|
});
|
|
508515
508772
|
|
|
508516
508773
|
// src/components/settings/RepoMapStatusPopup.tsx
|
|
@@ -509402,8 +509659,8 @@ var init_RouterSettings = __esm(async () => {
|
|
|
509402
509659
|
});
|
|
509403
509660
|
|
|
509404
509661
|
// src/components/settings/SkillSearch.tsx
|
|
509405
|
-
import { existsSync as
|
|
509406
|
-
import { join as
|
|
509662
|
+
import { existsSync as existsSync61 } from "fs";
|
|
509663
|
+
import { join as join67 } from "path";
|
|
509407
509664
|
import { TextAttributes as TextAttributes29 } from "@opentui/core";
|
|
509408
509665
|
function SearchSkillRow({
|
|
509409
509666
|
skill,
|
|
@@ -509549,7 +509806,7 @@ function SkillSearch({ visible, contextManager, onClose, onSystemMessage }) {
|
|
|
509549
509806
|
const [pendingInstall, setPendingInstall] = import_react156.useState(null);
|
|
509550
509807
|
const [scopeCursor, setScopeCursor] = import_react156.useState(0);
|
|
509551
509808
|
const debounceRef = import_react156.useRef(null);
|
|
509552
|
-
const isInProject =
|
|
509809
|
+
const isInProject = existsSync61(join67(getCwd(), ".git"));
|
|
509553
509810
|
const { width: termCols, height: termRows } = useTerminalDimensions();
|
|
509554
509811
|
const containerRows = termRows - 2;
|
|
509555
509812
|
const popupWidth = Math.min(MAX_POPUP_WIDTH5, Math.floor(termCols * 0.88));
|
|
@@ -510024,8 +510281,8 @@ var init_ToolsPopup = __esm(async () => {
|
|
|
510024
510281
|
});
|
|
510025
510282
|
|
|
510026
510283
|
// src/components/modals/MemoryBrowser.tsx
|
|
510027
|
-
import { existsSync as
|
|
510028
|
-
import { join as
|
|
510284
|
+
import { existsSync as existsSync62 } from "fs";
|
|
510285
|
+
import { join as join68 } from "path";
|
|
510029
510286
|
function timeAgo2(iso) {
|
|
510030
510287
|
const ms = Date.now() - Date.parse(iso);
|
|
510031
510288
|
if (!Number.isFinite(ms) || ms < 0)
|
|
@@ -510084,7 +510341,7 @@ function MemoryBrowser({ visible, contextManager, cwd: cwd2, onClose, onSystemMe
|
|
|
510084
510341
|
}, []);
|
|
510085
510342
|
const fileExists = import_react160.useCallback((p3) => {
|
|
510086
510343
|
try {
|
|
510087
|
-
return
|
|
510344
|
+
return existsSync62(join68(cwd2, p3));
|
|
510088
510345
|
} catch {
|
|
510089
510346
|
return false;
|
|
510090
510347
|
}
|
|
@@ -510830,12 +511087,12 @@ __export(exports_claim, {
|
|
|
510830
511087
|
bindClaimedSessions: () => bindClaimedSessions,
|
|
510831
511088
|
autoClaimDaemonWorkspaces: () => autoClaimDaemonWorkspaces
|
|
510832
511089
|
});
|
|
510833
|
-
import { existsSync as
|
|
511090
|
+
import { existsSync as existsSync63 } from "fs";
|
|
510834
511091
|
async function autoClaimDaemonWorkspaces(cwd2) {
|
|
510835
511092
|
const config2 = loadHearthConfig(cwd2);
|
|
510836
511093
|
const socketPath = config2.daemon.socketPath;
|
|
510837
511094
|
const out2 = { sessions: [], errors: [] };
|
|
510838
|
-
if (!
|
|
511095
|
+
if (!existsSync63(socketPath))
|
|
510839
511096
|
return out2;
|
|
510840
511097
|
let list;
|
|
510841
511098
|
try {
|
|
@@ -510902,7 +511159,7 @@ var exports_App = {};
|
|
|
510902
511159
|
__export(exports_App, {
|
|
510903
511160
|
App: () => App
|
|
510904
511161
|
});
|
|
510905
|
-
import { join as
|
|
511162
|
+
import { join as join69 } from "path";
|
|
510906
511163
|
import { TextAttributes as TextAttributes30 } from "@opentui/core";
|
|
510907
511164
|
function truncate5(str, max) {
|
|
510908
511165
|
return str.length > max ? `${str.slice(0, max - 1)}\u2026` : str;
|
|
@@ -511159,9 +511416,8 @@ function App({
|
|
|
511159
511416
|
};
|
|
511160
511417
|
}, []);
|
|
511161
511418
|
const copyToClipboard3 = import_react164.useCallback((text3) => {
|
|
511162
|
-
|
|
511163
|
-
|
|
511164
|
-
}
|
|
511419
|
+
renderer2.copyToClipboardOSC52(text3);
|
|
511420
|
+
copyToClipboard2(text3);
|
|
511165
511421
|
}, [renderer2]);
|
|
511166
511422
|
import_react164.useEffect(() => {
|
|
511167
511423
|
setProviderStatuses(getCachedProviderStatuses() ?? bootProviders);
|
|
@@ -511803,7 +512059,7 @@ function App({
|
|
|
511803
512059
|
(async () => {
|
|
511804
512060
|
try {
|
|
511805
512061
|
const { mkdir: mkdir8, writeFile: writeFile12 } = await import("fs/promises");
|
|
511806
|
-
const dir =
|
|
512062
|
+
const dir = join69(cwd2, ".soulforge");
|
|
511807
512063
|
await mkdir8(dir, { recursive: true });
|
|
511808
512064
|
const activeChat = tabMgr.getActiveChat();
|
|
511809
512065
|
const layout = tabMgr.tabs.map((t2) => ({
|
|
@@ -511811,7 +512067,7 @@ function App({
|
|
|
511811
512067
|
label: t2.label,
|
|
511812
512068
|
activeModel: t2.id === tabMgr.activeTabId ? activeChat?.activeModel : undefined
|
|
511813
512069
|
}));
|
|
511814
|
-
await writeFile12(
|
|
512070
|
+
await writeFile12(join69(dir, "tabs.json"), JSON.stringify(layout, null, 2));
|
|
511815
512071
|
} catch {}
|
|
511816
512072
|
})();
|
|
511817
512073
|
}, [tabMgr.tabCount, tabMgr.activeTabId]);
|
|
@@ -512932,8 +513188,8 @@ init_theme();
|
|
|
512932
513188
|
init_resolve_cwd();
|
|
512933
513189
|
init_splash();
|
|
512934
513190
|
init_errors();
|
|
512935
|
-
import { existsSync as
|
|
512936
|
-
import { join as
|
|
513191
|
+
import { existsSync as existsSync64, readFileSync as readFileSync35 } from "fs";
|
|
513192
|
+
import { join as join70 } from "path";
|
|
512937
513193
|
globalThis.AI_SDK_LOG_WARNINGS = false;
|
|
512938
513194
|
installGlobalFetch();
|
|
512939
513195
|
reapOrphanedLspProcesses();
|
|
@@ -513007,13 +513263,13 @@ if (cliArgs.includes("--presets") || cliArgs[0] === "presets") {
|
|
|
513007
513263
|
}
|
|
513008
513264
|
var IS_COMPILED4 = isCompiledBinary(import.meta.url);
|
|
513009
513265
|
if (IS_COMPILED4) {
|
|
513010
|
-
const bundledWorker =
|
|
513011
|
-
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH &&
|
|
513266
|
+
const bundledWorker = join70(dataDir(), "opentui-assets", "parser.worker.js");
|
|
513267
|
+
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH && existsSync64(bundledWorker)) {
|
|
513012
513268
|
process.env.OTUI_TREE_SITTER_WORKER_PATH = bundledWorker;
|
|
513013
513269
|
}
|
|
513014
513270
|
}
|
|
513015
513271
|
try {
|
|
513016
|
-
const raw2 =
|
|
513272
|
+
const raw2 = readFileSync35(join70(configDir(), "config.json"), "utf-8");
|
|
513017
513273
|
const cfg = JSON.parse(raw2);
|
|
513018
513274
|
if (cfg.theme?.name)
|
|
513019
513275
|
applyTheme(cfg.theme.name, cfg.theme?.transparent, {
|