@proxysoul/soulforge 2.20.5 → 2.20.6
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 +202 -150
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65799,6 +65799,17 @@ function resolveModel(modelId) {
|
|
|
65799
65799
|
throw new Error(`Unknown provider "${providerId}"`);
|
|
65800
65800
|
}
|
|
65801
65801
|
const base = provider.createModel(model);
|
|
65802
|
+
const family = detectModelFamily(modelId);
|
|
65803
|
+
const NATIVE_REASONING_FAMILIES = new Set([
|
|
65804
|
+
"claude",
|
|
65805
|
+
"openai",
|
|
65806
|
+
"google",
|
|
65807
|
+
"xai",
|
|
65808
|
+
"deepseek-reasoner"
|
|
65809
|
+
]);
|
|
65810
|
+
if (NATIVE_REASONING_FAMILIES.has(family)) {
|
|
65811
|
+
return base;
|
|
65812
|
+
}
|
|
65802
65813
|
return wrapLanguageModel({
|
|
65803
65814
|
model: base,
|
|
65804
65815
|
middleware: [
|
|
@@ -65817,6 +65828,7 @@ var cachedStatuses = null, providerStatusListeners, activeProviderId = null, pro
|
|
|
65817
65828
|
var init_provider = __esm(() => {
|
|
65818
65829
|
init_dist5();
|
|
65819
65830
|
init_secrets();
|
|
65831
|
+
init_provider_options();
|
|
65820
65832
|
init_providers();
|
|
65821
65833
|
providerStatusListeners = new Set;
|
|
65822
65834
|
providerSwitchListeners = new Set;
|
|
@@ -71935,7 +71947,7 @@ var package_default;
|
|
|
71935
71947
|
var init_package = __esm(() => {
|
|
71936
71948
|
package_default = {
|
|
71937
71949
|
name: "@proxysoul/soulforge",
|
|
71938
|
-
version: "2.20.
|
|
71950
|
+
version: "2.20.6",
|
|
71939
71951
|
description: "Graph-powered code intelligence \u2014 multi-agent coding with codebase-aware AI",
|
|
71940
71952
|
repository: {
|
|
71941
71953
|
type: "git",
|
|
@@ -403550,7 +403562,7 @@ async function start2(opts) {
|
|
|
403550
403562
|
}
|
|
403551
403563
|
try {
|
|
403552
403564
|
const { sendBeacon: sendBeacon2, maybeShowTelemetryNotice: maybeShowTelemetryNotice2 } = await Promise.resolve().then(() => (init_telemetry(), exports_telemetry));
|
|
403553
|
-
const { detectModelFamily, telemetryModelInfo } = await Promise.resolve().then(() => (init_provider_options(), exports_provider_options));
|
|
403565
|
+
const { detectModelFamily: detectModelFamily2, telemetryModelInfo } = await Promise.resolve().then(() => (init_provider_options(), exports_provider_options));
|
|
403554
403566
|
const { CURRENT_VERSION: CURRENT_VERSION2, detectInstallMethod: detectInstallMethod2 } = await Promise.resolve().then(() => (init_version(), exports_version));
|
|
403555
403567
|
const { loadConfig: loadConfig2, saveGlobalConfig: saveGlobalConfig2 } = await Promise.resolve().then(() => (init_config2(), exports_config2));
|
|
403556
403568
|
const cfg = loadConfig2();
|
|
@@ -403561,7 +403573,7 @@ async function start2(opts) {
|
|
|
403561
403573
|
surface: "tui",
|
|
403562
403574
|
version: CURRENT_VERSION2,
|
|
403563
403575
|
install: detectInstallMethod2(),
|
|
403564
|
-
family: hasModel ?
|
|
403576
|
+
family: hasModel ? detectModelFamily2(cfg.defaultModel) : undefined,
|
|
403565
403577
|
provider: info2?.provider,
|
|
403566
403578
|
model: info2?.model
|
|
403567
403579
|
}, cfg.telemetry);
|
|
@@ -406088,7 +406100,7 @@ var init_step_utils = __esm(() => {
|
|
|
406088
406100
|
|
|
406089
406101
|
// src/core/platform/clipboard.ts
|
|
406090
406102
|
import { execFile as execFile2, spawnSync as spawnSync6 } from "child_process";
|
|
406091
|
-
import { readFileSync as readFileSync20, unlinkSync as unlinkSync7 } from "fs";
|
|
406103
|
+
import { existsSync as existsSync36, readFileSync as readFileSync20, unlinkSync as unlinkSync7 } from "fs";
|
|
406092
406104
|
import { join as join38 } from "path";
|
|
406093
406105
|
function trySpawn(cmd, args2, text2) {
|
|
406094
406106
|
try {
|
|
@@ -406193,20 +406205,37 @@ function readImageLinux() {
|
|
|
406193
406205
|
});
|
|
406194
406206
|
});
|
|
406195
406207
|
}
|
|
406208
|
+
function resolveWindowsPowerShell() {
|
|
406209
|
+
const onPath = findOnPath("powershell");
|
|
406210
|
+
if (onPath)
|
|
406211
|
+
return onPath;
|
|
406212
|
+
const fullPath = join38(process.env.SystemRoot ?? "C:\\Windows", "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
406213
|
+
if (existsSync36(fullPath))
|
|
406214
|
+
return fullPath;
|
|
406215
|
+
return findOnPath("pwsh");
|
|
406216
|
+
}
|
|
406196
406217
|
function readImageWindows() {
|
|
406218
|
+
const exe = resolveWindowsPowerShell();
|
|
406219
|
+
if (!exe)
|
|
406220
|
+
return Promise.resolve(null);
|
|
406197
406221
|
const tmpFile = join38(tmpDir(), `soulforge-clipboard-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.png`);
|
|
406198
406222
|
const ps = [
|
|
406199
406223
|
"param([Parameter(Mandatory)][string]$OutFile)",
|
|
406200
406224
|
"$ErrorActionPreference = 'SilentlyContinue';",
|
|
406201
406225
|
"Add-Type -AssemblyName System.Windows.Forms;",
|
|
406202
406226
|
"Add-Type -AssemblyName System.Drawing;",
|
|
406227
|
+
"$png = [System.Windows.Forms.Clipboard]::GetData('PNG');",
|
|
406228
|
+
"if ($png -is [System.IO.MemoryStream]) {",
|
|
406229
|
+
" [System.IO.File]::WriteAllBytes($OutFile, $png.ToArray());",
|
|
406230
|
+
" Write-Output 'ok'; exit 0;",
|
|
406231
|
+
"}",
|
|
406203
406232
|
"$img = [System.Windows.Forms.Clipboard]::GetImage();",
|
|
406204
406233
|
"if ($img -eq $null) { Write-Output 'no-image'; exit 0 };",
|
|
406205
406234
|
"$img.Save($OutFile, [System.Drawing.Imaging.ImageFormat]::Png);",
|
|
406206
406235
|
"Write-Output 'ok'"
|
|
406207
406236
|
].join(" ");
|
|
406208
406237
|
return new Promise((resolve14) => {
|
|
406209
|
-
execFile2(
|
|
406238
|
+
execFile2(exe, ["-NoProfile", "-NonInteractive", "-STA", "-Command", ps, "-OutFile", tmpFile], { timeout: 1e4, windowsHide: true }, (err2, stdout) => {
|
|
406210
406239
|
if (err2 || !stdout.toString().trim().startsWith("ok")) {
|
|
406211
406240
|
cleanup(tmpFile);
|
|
406212
406241
|
resolve14(null);
|
|
@@ -406650,7 +406679,7 @@ var init_session = __esm(async () => {
|
|
|
406650
406679
|
|
|
406651
406680
|
// src/core/commands/storage.ts
|
|
406652
406681
|
import { Database as Database5 } from "bun:sqlite";
|
|
406653
|
-
import { existsSync as
|
|
406682
|
+
import { existsSync as existsSync37, rmSync as rmSync3 } from "fs";
|
|
406654
406683
|
import { join as join40 } from "path";
|
|
406655
406684
|
function openStorageMenu(ctx) {
|
|
406656
406685
|
const show = () => {
|
|
@@ -406765,7 +406794,7 @@ function openStorageMenu(ctx) {
|
|
|
406765
406794
|
sysMsg(ctx, `Cleared ${String(cleared)} sessions (freed ~${formatBytes(s.sessions)}).`);
|
|
406766
406795
|
} else if (value === "clear-history") {
|
|
406767
406796
|
const historyPath = join40(s.globalDir, "history.db");
|
|
406768
|
-
if (
|
|
406797
|
+
if (existsSync37(historyPath) && s.history > 0) {
|
|
406769
406798
|
const ok = await confirm({
|
|
406770
406799
|
title: "Clear search history?",
|
|
406771
406800
|
message: `Prompt history and stash entries (${formatBytes(s.history)}) will be deleted globally. This cannot be undone.`,
|
|
@@ -406785,7 +406814,7 @@ function openStorageMenu(ctx) {
|
|
|
406785
406814
|
}
|
|
406786
406815
|
} else if (value === "clear-plans") {
|
|
406787
406816
|
const plansDir = join40(s.projectDir, "plans");
|
|
406788
|
-
if (
|
|
406817
|
+
if (existsSync37(plansDir) && s.plans > 0) {
|
|
406789
406818
|
const ok = await confirm({
|
|
406790
406819
|
title: "Clear plans?",
|
|
406791
406820
|
message: `All saved plans (${formatBytes(s.plans)}) for this project will be deleted. This cannot be undone.`,
|
|
@@ -406805,7 +406834,7 @@ function openStorageMenu(ctx) {
|
|
|
406805
406834
|
join40(s.globalDir, "memory.db")
|
|
406806
406835
|
];
|
|
406807
406836
|
for (const dbPath of dbs) {
|
|
406808
|
-
if (!
|
|
406837
|
+
if (!existsSync37(dbPath))
|
|
406809
406838
|
continue;
|
|
406810
406839
|
try {
|
|
406811
406840
|
const before = fileSize(dbPath);
|
|
@@ -407877,7 +407906,7 @@ __export(exports_addons, {
|
|
|
407877
407906
|
autoInstallFromEnv: () => autoInstallFromEnv,
|
|
407878
407907
|
ADDON_NAMES: () => ADDON_NAMES
|
|
407879
407908
|
});
|
|
407880
|
-
import { existsSync as
|
|
407909
|
+
import { existsSync as existsSync38, rmSync as rmSync4 } from "fs";
|
|
407881
407910
|
import { join as join41 } from "path";
|
|
407882
407911
|
function isAddonInstalled(name39) {
|
|
407883
407912
|
if (name39 === "proxy") {
|
|
@@ -407965,7 +407994,7 @@ async function removeAddon(name39, onStatus) {
|
|
|
407965
407994
|
} catch {}
|
|
407966
407995
|
}
|
|
407967
407996
|
const binPath = join41(BIN_DIR2, ADDON_BIN[name39]);
|
|
407968
|
-
if (
|
|
407997
|
+
if (existsSync38(binPath)) {
|
|
407969
407998
|
try {
|
|
407970
407999
|
rmSync4(binPath, { force: true });
|
|
407971
408000
|
} catch (err2) {
|
|
@@ -407975,7 +408004,7 @@ async function removeAddon(name39, onStatus) {
|
|
|
407975
408004
|
const prefix = ADDON_INSTALL_PREFIX[name39];
|
|
407976
408005
|
try {
|
|
407977
408006
|
const { readdirSync: readdirSync10 } = await import("fs");
|
|
407978
|
-
if (
|
|
408007
|
+
if (existsSync38(INSTALLS_DIR2)) {
|
|
407979
408008
|
for (const entry of readdirSync10(INSTALLS_DIR2)) {
|
|
407980
408009
|
if (entry.startsWith(prefix) && /\d/.test(entry.slice(prefix.length, prefix.length + 1))) {
|
|
407981
408010
|
rmSync4(join41(INSTALLS_DIR2, entry), { recursive: true, force: true });
|
|
@@ -413235,7 +413264,7 @@ var init_embedder = __esm(() => {
|
|
|
413235
413264
|
|
|
413236
413265
|
// src/core/memory/db.ts
|
|
413237
413266
|
import { Database as Database6 } from "bun:sqlite";
|
|
413238
|
-
import { chmodSync as chmodSync4, existsSync as
|
|
413267
|
+
import { chmodSync as chmodSync4, existsSync as existsSync39, mkdirSync as mkdirSync22 } from "fs";
|
|
413239
413268
|
import { dirname as dirname15 } from "path";
|
|
413240
413269
|
|
|
413241
413270
|
class MemoryDB {
|
|
@@ -413246,7 +413275,7 @@ class MemoryDB {
|
|
|
413246
413275
|
this.scope = scope;
|
|
413247
413276
|
if (dbPath !== ":memory:") {
|
|
413248
413277
|
const dir = dirname15(dbPath);
|
|
413249
|
-
if (!
|
|
413278
|
+
if (!existsSync39(dir))
|
|
413250
413279
|
mkdirSync22(dir, { recursive: true });
|
|
413251
413280
|
}
|
|
413252
413281
|
this.legacyBackupPath = dbPath !== ":memory:" ? rotateLegacyDb(dbPath) : null;
|
|
@@ -414130,7 +414159,7 @@ function codePointCount(s) {
|
|
|
414130
414159
|
return n;
|
|
414131
414160
|
}
|
|
414132
414161
|
function rotateLegacyDb(dbPath) {
|
|
414133
|
-
if (!
|
|
414162
|
+
if (!existsSync39(dbPath))
|
|
414134
414163
|
return null;
|
|
414135
414164
|
let needsRotation = false;
|
|
414136
414165
|
let probe = null;
|
|
@@ -414152,7 +414181,7 @@ function rotateLegacyDb(dbPath) {
|
|
|
414152
414181
|
try {
|
|
414153
414182
|
safeRename(dbPath, backup);
|
|
414154
414183
|
for (const suffix of ["-wal", "-shm"]) {
|
|
414155
|
-
if (
|
|
414184
|
+
if (existsSync39(dbPath + suffix)) {
|
|
414156
414185
|
try {
|
|
414157
414186
|
safeRename(dbPath + suffix, backup + suffix);
|
|
414158
414187
|
} catch {}
|
|
@@ -414223,7 +414252,7 @@ var init_db2 = __esm(() => {
|
|
|
414223
414252
|
});
|
|
414224
414253
|
|
|
414225
414254
|
// src/core/memory/manager.ts
|
|
414226
|
-
import { existsSync as
|
|
414255
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync23, readFileSync as readFileSync21, rmSync as rmSync5, writeFileSync as writeFileSync17 } from "fs";
|
|
414227
414256
|
import { dirname as dirname16, join as join42 } from "path";
|
|
414228
414257
|
|
|
414229
414258
|
class MemoryManager {
|
|
@@ -414262,7 +414291,7 @@ class MemoryManager {
|
|
|
414262
414291
|
loadConfig() {
|
|
414263
414292
|
for (const scope of ["project", "global"]) {
|
|
414264
414293
|
const path = this.configPath(scope);
|
|
414265
|
-
if (!
|
|
414294
|
+
if (!existsSync40(path))
|
|
414266
414295
|
continue;
|
|
414267
414296
|
try {
|
|
414268
414297
|
const data = JSON.parse(readFileSync21(path, "utf-8"));
|
|
@@ -414279,7 +414308,7 @@ class MemoryManager {
|
|
|
414279
414308
|
saveConfig(to) {
|
|
414280
414309
|
const path = this.configPath(to);
|
|
414281
414310
|
const dir = dirname16(path);
|
|
414282
|
-
if (!
|
|
414311
|
+
if (!existsSync40(dir))
|
|
414283
414312
|
mkdirSync23(dir, { recursive: true });
|
|
414284
414313
|
const payload = { ...this._scopeConfig, cleanup: this._cleanup };
|
|
414285
414314
|
writeFileSync17(path, JSON.stringify(payload, null, 2), "utf-8");
|
|
@@ -414287,7 +414316,7 @@ class MemoryManager {
|
|
|
414287
414316
|
}
|
|
414288
414317
|
deleteConfig(from) {
|
|
414289
414318
|
const path = this.configPath(from);
|
|
414290
|
-
if (
|
|
414319
|
+
if (existsSync40(path))
|
|
414291
414320
|
rmSync5(path);
|
|
414292
414321
|
if (from === this._settingsScope) {
|
|
414293
414322
|
this._settingsScope = "project";
|
|
@@ -414512,7 +414541,7 @@ class MemoryManager {
|
|
|
414512
414541
|
}
|
|
414513
414542
|
deleteConfigOnly(from) {
|
|
414514
414543
|
const path = this.configPath(from);
|
|
414515
|
-
if (
|
|
414544
|
+
if (existsSync40(path)) {
|
|
414516
414545
|
try {
|
|
414517
414546
|
rmSync5(path);
|
|
414518
414547
|
} catch {}
|
|
@@ -435120,7 +435149,7 @@ var MAX_BYTES2 = 512, UTF8_BOUNDARY_RESERVE = 3;
|
|
|
435120
435149
|
var init_lib2 = () => {};
|
|
435121
435150
|
|
|
435122
435151
|
// src/core/tools/binary-detect.ts
|
|
435123
|
-
import { existsSync as
|
|
435152
|
+
import { existsSync as existsSync41, statSync as statSync7 } from "fs";
|
|
435124
435153
|
import { extname as extname3, resolve as resolve28 } from "path";
|
|
435125
435154
|
function binaryHint(ext) {
|
|
435126
435155
|
if (IMAGE_EXTS.has(ext))
|
|
@@ -435141,7 +435170,7 @@ function binaryHint(ext) {
|
|
|
435141
435170
|
}
|
|
435142
435171
|
function checkBinaryFile(filePath) {
|
|
435143
435172
|
try {
|
|
435144
|
-
if (!
|
|
435173
|
+
if (!existsSync41(filePath))
|
|
435145
435174
|
return null;
|
|
435146
435175
|
const stat5 = statSync7(filePath);
|
|
435147
435176
|
if (!stat5.isFile())
|
|
@@ -437127,7 +437156,7 @@ __export(exports_image, {
|
|
|
437127
437156
|
import { execSync as execSync3, spawn as spawn14 } from "child_process";
|
|
437128
437157
|
import {
|
|
437129
437158
|
closeSync as closeSync2,
|
|
437130
|
-
existsSync as
|
|
437159
|
+
existsSync as existsSync42,
|
|
437131
437160
|
openSync as openSync2,
|
|
437132
437161
|
readFileSync as readFileSync22,
|
|
437133
437162
|
statSync as statSync8,
|
|
@@ -437454,7 +437483,7 @@ function getPngDimensions(data) {
|
|
|
437454
437483
|
}
|
|
437455
437484
|
function safeUnlink(path) {
|
|
437456
437485
|
try {
|
|
437457
|
-
if (
|
|
437486
|
+
if (existsSync42(path))
|
|
437458
437487
|
unlinkSync8(path);
|
|
437459
437488
|
} catch {}
|
|
437460
437489
|
}
|
|
@@ -437633,7 +437662,7 @@ var init_tool_progress = __esm(() => {
|
|
|
437633
437662
|
// src/core/tools/show-image.ts
|
|
437634
437663
|
import { spawn as spawn15, spawnSync as spawnSync7 } from "child_process";
|
|
437635
437664
|
import {
|
|
437636
|
-
existsSync as
|
|
437665
|
+
existsSync as existsSync43,
|
|
437637
437666
|
readdirSync as readdirSync10,
|
|
437638
437667
|
readFileSync as readFileSync23,
|
|
437639
437668
|
statSync as statSync9,
|
|
@@ -437644,7 +437673,7 @@ import { tmpdir as tmpdir4 } from "os";
|
|
|
437644
437673
|
import { basename as basename7, extname as extname7, resolve as resolve34 } from "path";
|
|
437645
437674
|
function safeUnlink2(path) {
|
|
437646
437675
|
try {
|
|
437647
|
-
if (
|
|
437676
|
+
if (existsSync43(path))
|
|
437648
437677
|
unlinkSync9(path);
|
|
437649
437678
|
} catch {}
|
|
437650
437679
|
}
|
|
@@ -437663,7 +437692,7 @@ async function convertToPng(data, ext, signal) {
|
|
|
437663
437692
|
for (const [cmd, cmdArgs] of converters) {
|
|
437664
437693
|
try {
|
|
437665
437694
|
const result = await spawnAsync(cmd, cmdArgs, { timeout: 1e4, signal });
|
|
437666
|
-
if (result.code === 0 &&
|
|
437695
|
+
if (result.code === 0 && existsSync43(dstPath))
|
|
437667
437696
|
return readFileSync23(dstPath);
|
|
437668
437697
|
} catch {}
|
|
437669
437698
|
}
|
|
@@ -437753,7 +437782,7 @@ async function resizeImageToTarget(data, name39, targetBytes, signal) {
|
|
|
437753
437782
|
"2",
|
|
437754
437783
|
dstPath
|
|
437755
437784
|
], { timeout: 30000, signal });
|
|
437756
|
-
if (result.code === 0 &&
|
|
437785
|
+
if (result.code === 0 && existsSync43(dstPath)) {
|
|
437757
437786
|
const resized = readFileSync23(dstPath);
|
|
437758
437787
|
if (resized.length > 0 && resized.length <= targetBytes)
|
|
437759
437788
|
return resized;
|
|
@@ -437770,7 +437799,7 @@ async function resizeImageToTarget(data, name39, targetBytes, signal) {
|
|
|
437770
437799
|
for (const scale of scales) {
|
|
437771
437800
|
const targetWidth = Math.round(origWidth * scale);
|
|
437772
437801
|
const result = await spawnAsync("sips", ["--resampleWidth", String(targetWidth), srcPath, "--out", dstPath], { timeout: 30000, signal });
|
|
437773
|
-
if (result.code === 0 &&
|
|
437802
|
+
if (result.code === 0 && existsSync43(dstPath)) {
|
|
437774
437803
|
const resized = readFileSync23(dstPath);
|
|
437775
437804
|
if (resized.length > 0 && resized.length <= targetBytes)
|
|
437776
437805
|
return resized;
|
|
@@ -437868,7 +437897,7 @@ async function videoToGif(videoPath, toolCallId, maxDuration = MAX_GIF_DURATION,
|
|
|
437868
437897
|
"1",
|
|
437869
437898
|
palettePath
|
|
437870
437899
|
], { timeout: 60000, signal });
|
|
437871
|
-
if (pass1.code !== 0 || !
|
|
437900
|
+
if (pass1.code !== 0 || !existsSync43(palettePath))
|
|
437872
437901
|
return null;
|
|
437873
437902
|
progress(toolCallId, "FFMPEG", `${msg}\u2026 (encoding)`);
|
|
437874
437903
|
const pass2 = await spawnAsync("ffmpeg", [
|
|
@@ -437895,7 +437924,7 @@ async function videoToGif(videoPath, toolCallId, maxDuration = MAX_GIF_DURATION,
|
|
|
437895
437924
|
});
|
|
437896
437925
|
if (pass2.code !== 0)
|
|
437897
437926
|
return null;
|
|
437898
|
-
if (
|
|
437927
|
+
if (existsSync43(gifPath)) {
|
|
437899
437928
|
const data = readFileSync23(gifPath);
|
|
437900
437929
|
if (data.length > 0 && data.length <= MAX_IMAGE_SIZE2)
|
|
437901
437930
|
return data;
|
|
@@ -437916,7 +437945,7 @@ async function videoToFrame(videoPath, toolCallId, signal) {
|
|
|
437916
437945
|
try {
|
|
437917
437946
|
progress(toolCallId, "FFMPEG", "Extracting frame\u2026");
|
|
437918
437947
|
const result = await spawnAsync("ffmpeg", ["-y", "-i", videoPath, "-frames:v", "1", "-q:v", "2", framePath], { timeout: 15000, signal });
|
|
437919
|
-
if (result.code === 0 &&
|
|
437948
|
+
if (result.code === 0 && existsSync43(framePath)) {
|
|
437920
437949
|
const data = readFileSync23(framePath);
|
|
437921
437950
|
if (data.length > 0 && data.length <= MAX_IMAGE_SIZE2)
|
|
437922
437951
|
return data;
|
|
@@ -438013,7 +438042,7 @@ ${INSTALL_YTDLP}`
|
|
|
438013
438042
|
videoPath,
|
|
438014
438043
|
url2
|
|
438015
438044
|
], { timeout: 120000, signal, onStderr });
|
|
438016
|
-
if (dlResult.code !== 0 || !
|
|
438045
|
+
if (dlResult.code !== 0 || !existsSync43(videoPath)) {
|
|
438017
438046
|
safeUnlink2(videoPath);
|
|
438018
438047
|
progress(toolCallId, "YT-DL", `${dlMsg}\u2026 (retrying lowest quality)`);
|
|
438019
438048
|
dlResult = await spawnAsync("yt-dlp", ["-f", "worst", "-o", videoPath, url2], {
|
|
@@ -438022,7 +438051,7 @@ ${INSTALL_YTDLP}`
|
|
|
438022
438051
|
onStderr
|
|
438023
438052
|
});
|
|
438024
438053
|
}
|
|
438025
|
-
if (dlResult.code === 0 &&
|
|
438054
|
+
if (dlResult.code === 0 && existsSync43(videoPath)) {
|
|
438026
438055
|
if (supportsKittyAnimation()) {
|
|
438027
438056
|
for (let attempt = 0;attempt < 2; attempt++) {
|
|
438028
438057
|
const gif = await videoToGif(videoPath, toolCallId, MAX_GIF_DURATION, signal);
|
|
@@ -438051,7 +438080,7 @@ ${INSTALL_YTDLP}`
|
|
|
438051
438080
|
], { timeout: 30000, signal });
|
|
438052
438081
|
const thumbFile = `${thumbBase}.png`;
|
|
438053
438082
|
cleanupFiles.push(thumbFile);
|
|
438054
|
-
if (thumbResult.code === 0 &&
|
|
438083
|
+
if (thumbResult.code === 0 && existsSync43(thumbFile)) {
|
|
438055
438084
|
const data = readFileSync23(thumbFile);
|
|
438056
438085
|
if (data.length > 0 && data.length <= MAX_IMAGE_SIZE2) {
|
|
438057
438086
|
const suffix = hasFfmpeg() ? " (video download failed, showing thumbnail)" : " (install ffmpeg for animated GIF)";
|
|
@@ -438387,7 +438416,7 @@ async function restoreSessionImages(messages, cwd2) {
|
|
|
438387
438416
|
name39 = result.name;
|
|
438388
438417
|
} else {
|
|
438389
438418
|
const filePath = resolve34(cwd2, path);
|
|
438390
|
-
if (!
|
|
438419
|
+
if (!existsSync43(filePath))
|
|
438391
438420
|
continue;
|
|
438392
438421
|
const stat5 = statSync9(filePath);
|
|
438393
438422
|
if (!stat5.isFile() || stat5.size > MAX_IMAGE_SIZE2)
|
|
@@ -438479,7 +438508,7 @@ var init_show_image = __esm(() => {
|
|
|
438479
438508
|
});
|
|
438480
438509
|
|
|
438481
438510
|
// src/core/skills/manager.ts
|
|
438482
|
-
import { existsSync as
|
|
438511
|
+
import { existsSync as existsSync44, readdirSync as readdirSync11, readFileSync as readFileSync24, realpathSync as realpathSync4, rmSync as rmSync6, statSync as statSync10 } from "fs";
|
|
438483
438512
|
import { homedir as homedir13 } from "os";
|
|
438484
438513
|
import { dirname as dirname22, join as join47 } from "path";
|
|
438485
438514
|
async function searchSkills(query2) {
|
|
@@ -438604,7 +438633,7 @@ function loadSkill(path) {
|
|
|
438604
438633
|
function removeInstalledSkill(skill) {
|
|
438605
438634
|
try {
|
|
438606
438635
|
const dir = dirname22(skill.path);
|
|
438607
|
-
if (
|
|
438636
|
+
if (existsSync44(dir)) {
|
|
438608
438637
|
rmSync6(dir, { recursive: true });
|
|
438609
438638
|
return true;
|
|
438610
438639
|
}
|
|
@@ -439882,7 +439911,7 @@ ${enriched}`
|
|
|
439882
439911
|
|
|
439883
439912
|
// src/core/tools/soul-grep.ts
|
|
439884
439913
|
import { spawn as spawn17 } from "child_process";
|
|
439885
|
-
import { existsSync as
|
|
439914
|
+
import { existsSync as existsSync45 } from "fs";
|
|
439886
439915
|
function resolveDepSearch(dep, explicitPath) {
|
|
439887
439916
|
const noIgnoreFollow = ["--no-ignore", "--follow"];
|
|
439888
439917
|
if (explicitPath) {
|
|
@@ -439894,7 +439923,7 @@ function resolveDepSearch(dep, explicitPath) {
|
|
|
439894
439923
|
const FLAT_ROOTS = ["node_modules", "vendor", "bower_components"];
|
|
439895
439924
|
for (const root of FLAT_ROOTS) {
|
|
439896
439925
|
const candidate = `${root}/${dep}`;
|
|
439897
|
-
if (
|
|
439926
|
+
if (existsSync45(candidate)) {
|
|
439898
439927
|
return { searchPath: candidate, extraArgs: noIgnoreFollow, resolved: true, dep };
|
|
439899
439928
|
}
|
|
439900
439929
|
}
|
|
@@ -440481,7 +440510,7 @@ var init_soul_query = __esm(() => {
|
|
|
440481
440510
|
|
|
440482
440511
|
// src/core/tools/structural-edit.ts
|
|
440483
440512
|
import { spawn as spawn18 } from "child_process";
|
|
440484
|
-
import { existsSync as
|
|
440513
|
+
import { existsSync as existsSync46 } from "fs";
|
|
440485
440514
|
import { extname as extname9, join as join49, resolve as resolve37 } from "path";
|
|
440486
440515
|
function resolveAstGrep(cwd2) {
|
|
440487
440516
|
const vendored = getVendoredPath("ast-grep");
|
|
@@ -440491,13 +440520,13 @@ function resolveAstGrep(cwd2) {
|
|
|
440491
440520
|
const localCandidates = IS_WIN ? ["ast-grep.cmd", "ast-grep.exe", "ast-grep.ps1", "ast-grep", "sg.cmd", "sg.exe", "sg"] : ["ast-grep", "sg"];
|
|
440492
440521
|
for (const name39 of localCandidates) {
|
|
440493
440522
|
const candidate = join49(binDir, name39);
|
|
440494
|
-
if (
|
|
440523
|
+
if (existsSync46(candidate))
|
|
440495
440524
|
return candidate;
|
|
440496
440525
|
}
|
|
440497
440526
|
const nativeDir = join49(cwd2, "node_modules", "@ast-grep", "cli");
|
|
440498
440527
|
for (const name39 of [`ast-grep${EXE2}`, `sg${EXE2}`]) {
|
|
440499
440528
|
const candidate = join49(nativeDir, name39);
|
|
440500
|
-
if (
|
|
440529
|
+
if (existsSync46(candidate))
|
|
440501
440530
|
return candidate;
|
|
440502
440531
|
}
|
|
440503
440532
|
return findOnPath("ast-grep") ?? findOnPath("sg") ?? null;
|
|
@@ -440597,7 +440626,7 @@ var init_structural_edit = __esm(() => {
|
|
|
440597
440626
|
error: "forbidden"
|
|
440598
440627
|
};
|
|
440599
440628
|
}
|
|
440600
|
-
if (!
|
|
440629
|
+
if (!existsSync46(abs)) {
|
|
440601
440630
|
return { success: false, output: `File not found: ${args2.file}`, error: "not found" };
|
|
440602
440631
|
}
|
|
440603
440632
|
const ext = extname9(abs).toLowerCase();
|
|
@@ -443974,7 +444003,7 @@ var init_explore = __esm(() => {
|
|
|
443974
444003
|
|
|
443975
444004
|
// src/utils/image-compress.ts
|
|
443976
444005
|
import { spawn as spawn19 } from "child_process";
|
|
443977
|
-
import { existsSync as
|
|
444006
|
+
import { existsSync as existsSync47, readFileSync as readFileSync25, unlinkSync as unlinkSync10, writeFileSync as writeFileSync19 } from "fs";
|
|
443978
444007
|
import { tmpdir as tmpdir5 } from "os";
|
|
443979
444008
|
import { resolve as resolve40 } from "path";
|
|
443980
444009
|
async function compressImageForApi(data, mediaType) {
|
|
@@ -443990,7 +444019,7 @@ async function compressImageForApi(data, mediaType) {
|
|
|
443990
444019
|
for (const q2 of qualities) {
|
|
443991
444020
|
safeUnlink3(dstPath);
|
|
443992
444021
|
const ok2 = IS_DARWIN ? await trySips(srcPath, dstPath, q2) : await tryFfmpegOrMagick(srcPath, dstPath, q2);
|
|
443993
|
-
if (ok2 &&
|
|
444022
|
+
if (ok2 && existsSync47(dstPath)) {
|
|
443994
444023
|
const compressed = readFileSync25(dstPath);
|
|
443995
444024
|
if (compressed.length <= MAX_RAW_BYTES) {
|
|
443996
444025
|
return { data: compressed, mediaType: "image/jpeg" };
|
|
@@ -443999,7 +444028,7 @@ async function compressImageForApi(data, mediaType) {
|
|
|
443999
444028
|
}
|
|
444000
444029
|
safeUnlink3(dstPath);
|
|
444001
444030
|
const ok = IS_DARWIN ? await trySipsResize(srcPath, dstPath, 50, 30) : await tryFfmpegOrMagickResize(srcPath, dstPath, 50, 30);
|
|
444002
|
-
if (ok &&
|
|
444031
|
+
if (ok && existsSync47(dstPath)) {
|
|
444003
444032
|
const compressed = readFileSync25(dstPath);
|
|
444004
444033
|
if (compressed.length <= MAX_RAW_BYTES) {
|
|
444005
444034
|
return { data: compressed, mediaType: "image/jpeg" };
|
|
@@ -444136,7 +444165,7 @@ function spawnStdout(cmd, args2) {
|
|
|
444136
444165
|
}
|
|
444137
444166
|
function safeUnlink3(path) {
|
|
444138
444167
|
try {
|
|
444139
|
-
if (
|
|
444168
|
+
if (existsSync47(path))
|
|
444140
444169
|
unlinkSync10(path);
|
|
444141
444170
|
} catch {}
|
|
444142
444171
|
}
|
|
@@ -445318,10 +445347,10 @@ function buildSubagentTools(models) {
|
|
|
445318
445347
|
exists = true;
|
|
445319
445348
|
}
|
|
445320
445349
|
if (!exists) {
|
|
445321
|
-
const { existsSync:
|
|
445350
|
+
const { existsSync: existsSync48 } = __require("fs");
|
|
445322
445351
|
const { resolve: resolvePath, isAbsolute: isAbsolute2 } = __require("path");
|
|
445323
445352
|
const abs = isAbsolute2(norm) ? norm : resolvePath(cwd2, norm);
|
|
445324
|
-
if (
|
|
445353
|
+
if (existsSync48(abs))
|
|
445325
445354
|
exists = true;
|
|
445326
445355
|
}
|
|
445327
445356
|
if (exists) {
|
|
@@ -447657,11 +447686,11 @@ class SoulMapSnapshot {
|
|
|
447657
447686
|
var init_soul_map_snapshot = () => {};
|
|
447658
447687
|
|
|
447659
447688
|
// src/core/context/toolchain.ts
|
|
447660
|
-
import { existsSync as
|
|
447689
|
+
import { existsSync as existsSync48 } from "fs";
|
|
447661
447690
|
import { join as join53 } from "path";
|
|
447662
447691
|
function detectToolchain(cwd2) {
|
|
447663
447692
|
for (const [file2, tool4] of TOOLCHAIN_MARKERS) {
|
|
447664
|
-
if (
|
|
447693
|
+
if (existsSync48(join53(cwd2, file2)))
|
|
447665
447694
|
return tool4;
|
|
447666
447695
|
}
|
|
447667
447696
|
return null;
|
|
@@ -447919,7 +447948,7 @@ __export(exports_manager2, {
|
|
|
447919
447948
|
extractConversationTerms: () => extractConversationTerms,
|
|
447920
447949
|
ContextManager: () => ContextManager
|
|
447921
447950
|
});
|
|
447922
|
-
import { existsSync as
|
|
447951
|
+
import { existsSync as existsSync49 } from "fs";
|
|
447923
447952
|
import { readFile as readFile20 } from "fs/promises";
|
|
447924
447953
|
import { join as join54 } from "path";
|
|
447925
447954
|
var DEFAULT_CONTEXT_WINDOW2 = 200000, ContextManager;
|
|
@@ -448203,7 +448232,16 @@ var init_manager6 = __esm(() => {
|
|
|
448203
448232
|
} else {
|
|
448204
448233
|
semanticTask = this.repoMap.detectPersistedSemanticMode().then((persisted) => this.setSemanticSummaries(persisted === "off" ? "ast" : persisted));
|
|
448205
448234
|
}
|
|
448206
|
-
|
|
448235
|
+
try {
|
|
448236
|
+
await Promise.all([semanticTask, this.warmRepoMapCache()]);
|
|
448237
|
+
} catch (e) {
|
|
448238
|
+
logBackgroundError("context-manager", `post-scan semantic/cache task failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
448239
|
+
const store = useRepoMapStore.getState();
|
|
448240
|
+
if (store.semanticProgress.includes("waiting for soul map")) {
|
|
448241
|
+
store.setSemanticStatus("off");
|
|
448242
|
+
store.setSemanticProgress("");
|
|
448243
|
+
}
|
|
448244
|
+
}
|
|
448207
448245
|
} else {
|
|
448208
448246
|
this.repoMapReady = false;
|
|
448209
448247
|
this.syncRepoMapStore("error");
|
|
@@ -449085,7 +449123,7 @@ ${skillBlocks}
|
|
|
449085
449123
|
const memoryMarkers = memoryMarkersForPaths(changed.slice(0, 15));
|
|
449086
449124
|
for (const file2 of changed.slice(0, 15)) {
|
|
449087
449125
|
const absPath = join54(this.cwd, file2);
|
|
449088
|
-
const fileExists =
|
|
449126
|
+
const fileExists = existsSync49(absPath);
|
|
449089
449127
|
const block = this.soulMapDiffBlocks.get(file2);
|
|
449090
449128
|
const provenance = this.classifyDeltaFile(absPath, file2, memoryMarkers.get(file2));
|
|
449091
449129
|
if (!fileExists) {
|
|
@@ -449124,7 +449162,7 @@ ${skillBlocks}
|
|
|
449124
449162
|
tags.push("[mentioned]");
|
|
449125
449163
|
if (this.editorFile === absPath)
|
|
449126
449164
|
tags.push("[open]");
|
|
449127
|
-
if (this.soulMapNewFilesEmitted.has(rel) &&
|
|
449165
|
+
if (this.soulMapNewFilesEmitted.has(rel) && existsSync49(absPath)) {
|
|
449128
449166
|
tags.push("[modified-since-new]");
|
|
449129
449167
|
}
|
|
449130
449168
|
const failure = this.recentToolFailures.find((f) => f.target === absPath || f.target === rel);
|
|
@@ -466655,7 +466693,7 @@ var init_output = __esm(() => {
|
|
|
466655
466693
|
});
|
|
466656
466694
|
|
|
466657
466695
|
// src/headless/run.ts
|
|
466658
|
-
import { existsSync as
|
|
466696
|
+
import { existsSync as existsSync50, readFileSync as readFileSync26 } from "fs";
|
|
466659
466697
|
import { resolve as resolve41 } from "path";
|
|
466660
466698
|
function reraiseOrExit(code) {
|
|
466661
466699
|
if (code === EXIT_ABORT) {
|
|
@@ -467002,7 +467040,7 @@ async function runPrompt(opts, merged) {
|
|
|
467002
467040
|
const fileParts = [];
|
|
467003
467041
|
for (const file2 of opts.include) {
|
|
467004
467042
|
const fullPath = resolve41(env.cwd, file2);
|
|
467005
|
-
if (!
|
|
467043
|
+
if (!existsSync50(fullPath)) {
|
|
467006
467044
|
stderrWarn(`--include file not found: ${file2}`);
|
|
467007
467045
|
continue;
|
|
467008
467046
|
}
|
|
@@ -467747,7 +467785,7 @@ var init_workspace = __esm(() => {
|
|
|
467747
467785
|
import {
|
|
467748
467786
|
appendFileSync as appendFileSync4,
|
|
467749
467787
|
chmodSync as chmodSync5,
|
|
467750
|
-
existsSync as
|
|
467788
|
+
existsSync as existsSync51,
|
|
467751
467789
|
mkdirSync as mkdirSync24,
|
|
467752
467790
|
readFileSync as readFileSync27,
|
|
467753
467791
|
unlinkSync as unlinkSync11,
|
|
@@ -467871,7 +467909,7 @@ class HearthDaemon {
|
|
|
467871
467909
|
await new Promise((res) => this.socketServer?.close(() => res()));
|
|
467872
467910
|
this.socketServer = null;
|
|
467873
467911
|
}
|
|
467874
|
-
if (
|
|
467912
|
+
if (existsSync51(this.config.daemon.socketPath)) {
|
|
467875
467913
|
try {
|
|
467876
467914
|
unlinkSync11(this.config.daemon.socketPath);
|
|
467877
467915
|
} catch (e) {
|
|
@@ -468012,7 +468050,7 @@ class HearthDaemon {
|
|
|
468012
468050
|
async startSocket() {
|
|
468013
468051
|
const path = this.config.daemon.socketPath;
|
|
468014
468052
|
mkdirSync24(dirname23(path), { recursive: true, mode: 448 });
|
|
468015
|
-
if (
|
|
468053
|
+
if (existsSync51(path)) {
|
|
468016
468054
|
try {
|
|
468017
468055
|
unlinkSync11(path);
|
|
468018
468056
|
} catch (e) {
|
|
@@ -468885,7 +468923,7 @@ class HearthDaemon {
|
|
|
468885
468923
|
}
|
|
468886
468924
|
restoreWorkspaces() {
|
|
468887
468925
|
const stateFile = this.config.daemon.stateFile;
|
|
468888
|
-
if (!
|
|
468926
|
+
if (!existsSync51(stateFile))
|
|
468889
468927
|
return;
|
|
468890
468928
|
try {
|
|
468891
468929
|
const parsed = JSON.parse(readFileSync27(stateFile, "utf-8"));
|
|
@@ -468938,7 +468976,7 @@ function createFileLogger(logPath) {
|
|
|
468938
468976
|
return () => {};
|
|
468939
468977
|
try {
|
|
468940
468978
|
const dir = dirname23(logPath);
|
|
468941
|
-
if (!
|
|
468979
|
+
if (!existsSync51(dir))
|
|
468942
468980
|
mkdirSync24(dir, { recursive: true });
|
|
468943
468981
|
} catch {}
|
|
468944
468982
|
return (line2) => {
|
|
@@ -468967,7 +469005,7 @@ __export(exports_cli, {
|
|
|
468967
469005
|
runHearthCli: () => runHearthCli,
|
|
468968
469006
|
parseHearthArgs: () => parseHearthArgs
|
|
468969
469007
|
});
|
|
468970
|
-
import { existsSync as
|
|
469008
|
+
import { existsSync as existsSync52 } from "fs";
|
|
468971
469009
|
function parseHearthArgs(argv) {
|
|
468972
469010
|
const [sub, ...rest] = argv;
|
|
468973
469011
|
if (!sub || sub === "help" || sub === "--help" || sub === "-h")
|
|
@@ -469072,7 +469110,7 @@ async function runStart(detach) {
|
|
|
469072
469110
|
async function runStop() {
|
|
469073
469111
|
const config2 = loadHearthConfig();
|
|
469074
469112
|
const sock = config2.daemon.socketPath;
|
|
469075
|
-
if (!
|
|
469113
|
+
if (!existsSync52(sock)) {
|
|
469076
469114
|
process.stderr.write(`daemon not running
|
|
469077
469115
|
`);
|
|
469078
469116
|
return 1;
|
|
@@ -469193,7 +469231,7 @@ async function runDoctor() {
|
|
|
469193
469231
|
lines.push(` chats: ${String(chats)} paired`);
|
|
469194
469232
|
}
|
|
469195
469233
|
lines.push("");
|
|
469196
|
-
lines.push(`daemon: ${
|
|
469234
|
+
lines.push(`daemon: ${existsSync52(config2.daemon.socketPath) ? "socket present" : "socket absent"}`);
|
|
469197
469235
|
const testToken = `bot123456:ABC-${"x".repeat(40)}`;
|
|
469198
469236
|
const { redact: redact2 } = await Promise.resolve().then(() => (init_redact(), exports_redact));
|
|
469199
469237
|
const scrubbed = redact2(testToken);
|
|
@@ -469206,7 +469244,7 @@ async function runDoctor() {
|
|
|
469206
469244
|
async function runLogs(follow) {
|
|
469207
469245
|
const config2 = loadHearthConfig();
|
|
469208
469246
|
const path = config2.daemon.logFile;
|
|
469209
|
-
if (!
|
|
469247
|
+
if (!existsSync52(path)) {
|
|
469210
469248
|
process.stderr.write(`log file missing: ${path}
|
|
469211
469249
|
`);
|
|
469212
469250
|
return 1;
|
|
@@ -469252,7 +469290,7 @@ var init_cli = __esm(() => {
|
|
|
469252
469290
|
|
|
469253
469291
|
// src/hearth/approve-cli.ts
|
|
469254
469292
|
var exports_approve_cli = {};
|
|
469255
|
-
import { existsSync as
|
|
469293
|
+
import { existsSync as existsSync53, readFileSync as readFileSync28 } from "fs";
|
|
469256
469294
|
import { join as join55, resolve as resolvePath } from "path";
|
|
469257
469295
|
function expandHome3(p2) {
|
|
469258
469296
|
return expandHome(p2);
|
|
@@ -469283,7 +469321,7 @@ function loadExtraDenylist(cwd2) {
|
|
|
469283
469321
|
const paths = [join55(configDir(), "hearth.json"), join55(cwd2, ".soulforge", "hearth.json")];
|
|
469284
469322
|
const extras = new Set;
|
|
469285
469323
|
for (const p2 of paths) {
|
|
469286
|
-
if (!
|
|
469324
|
+
if (!existsSync53(p2))
|
|
469287
469325
|
continue;
|
|
469288
469326
|
try {
|
|
469289
469327
|
const parsed = JSON.parse(readFileSync28(p2, "utf-8"));
|
|
@@ -469405,7 +469443,7 @@ async function runDenyRead(hook) {
|
|
|
469405
469443
|
}
|
|
469406
469444
|
async function runHealth() {
|
|
469407
469445
|
const sock = getSocketPath();
|
|
469408
|
-
if (!
|
|
469446
|
+
if (!existsSync53(sock)) {
|
|
469409
469447
|
process.stderr.write(`socket missing: ${sock}
|
|
469410
469448
|
`);
|
|
469411
469449
|
return 1;
|
|
@@ -469841,7 +469879,7 @@ var init_headless = __esm(() => {
|
|
|
469841
469879
|
});
|
|
469842
469880
|
|
|
469843
469881
|
// src/core/presets/registry.ts
|
|
469844
|
-
import { existsSync as
|
|
469882
|
+
import { existsSync as existsSync54, mkdirSync as mkdirSync25, readFileSync as readFileSync29, statSync as statSync11, writeFileSync as writeFileSync21 } from "fs";
|
|
469845
469883
|
import { join as join56 } from "path";
|
|
469846
469884
|
function getCacheDirInternal() {
|
|
469847
469885
|
return join56(configDir(), "presets");
|
|
@@ -469851,12 +469889,12 @@ function getRegistryCacheFile() {
|
|
|
469851
469889
|
}
|
|
469852
469890
|
function ensureCacheDir() {
|
|
469853
469891
|
const dir = getCacheDirInternal();
|
|
469854
|
-
if (!
|
|
469892
|
+
if (!existsSync54(dir))
|
|
469855
469893
|
mkdirSync25(dir, { recursive: true, mode: 448 });
|
|
469856
469894
|
}
|
|
469857
469895
|
function readCachedRegistry() {
|
|
469858
469896
|
const file2 = getRegistryCacheFile();
|
|
469859
|
-
if (!
|
|
469897
|
+
if (!existsSync54(file2))
|
|
469860
469898
|
return null;
|
|
469861
469899
|
try {
|
|
469862
469900
|
return JSON.parse(readFileSync29(file2, "utf-8"));
|
|
@@ -469866,7 +469904,7 @@ function readCachedRegistry() {
|
|
|
469866
469904
|
}
|
|
469867
469905
|
function cacheAge() {
|
|
469868
469906
|
const file2 = getRegistryCacheFile();
|
|
469869
|
-
if (!
|
|
469907
|
+
if (!existsSync54(file2))
|
|
469870
469908
|
return Number.POSITIVE_INFINITY;
|
|
469871
469909
|
try {
|
|
469872
469910
|
return Date.now() - statSync11(file2).mtimeMs;
|
|
@@ -469930,7 +469968,7 @@ var init_registry2 = __esm(() => {
|
|
|
469930
469968
|
});
|
|
469931
469969
|
|
|
469932
469970
|
// src/core/presets/loader.ts
|
|
469933
|
-
import { existsSync as
|
|
469971
|
+
import { existsSync as existsSync55, lstatSync as lstatSync2, readFileSync as readFileSync30, writeFileSync as writeFileSync22 } from "fs";
|
|
469934
469972
|
import { isAbsolute as isAbsolute2, join as join57, resolve as resolve42 } from "path";
|
|
469935
469973
|
function isUrl3(s2) {
|
|
469936
469974
|
return /^https?:\/\//i.test(s2);
|
|
@@ -469996,7 +470034,7 @@ async function fetchPresetFromUrl(url2) {
|
|
|
469996
470034
|
function resolveLocalPath(spec3) {
|
|
469997
470035
|
const expanded = expandHome(spec3);
|
|
469998
470036
|
const abs = resolve42(expanded);
|
|
469999
|
-
if (!
|
|
470037
|
+
if (!existsSync55(abs))
|
|
470000
470038
|
throw new Error(`Preset file not found: ${abs}`);
|
|
470001
470039
|
const stat5 = lstatSync2(abs);
|
|
470002
470040
|
if (stat5.isSymbolicLink()) {
|
|
@@ -470120,7 +470158,7 @@ var init_merge2 = __esm(() => {
|
|
|
470120
470158
|
});
|
|
470121
470159
|
|
|
470122
470160
|
// src/core/presets/init.ts
|
|
470123
|
-
import { existsSync as
|
|
470161
|
+
import { existsSync as existsSync56, readFileSync as readFileSync31 } from "fs";
|
|
470124
470162
|
import { join as join58 } from "path";
|
|
470125
470163
|
function getGlobalConfigFile() {
|
|
470126
470164
|
return join58(configDir(), "config.json");
|
|
@@ -470131,7 +470169,7 @@ function isValidPresetSpec(spec3) {
|
|
|
470131
470169
|
return VALID_SPEC.test(spec3);
|
|
470132
470170
|
}
|
|
470133
470171
|
function readPresetSpecs(file2) {
|
|
470134
|
-
if (!
|
|
470172
|
+
if (!existsSync56(file2))
|
|
470135
470173
|
return [];
|
|
470136
470174
|
try {
|
|
470137
470175
|
const cfg = JSON.parse(readFileSync31(file2, "utf-8"));
|
|
@@ -470230,7 +470268,7 @@ var init_init = __esm(() => {
|
|
|
470230
470268
|
});
|
|
470231
470269
|
|
|
470232
470270
|
// src/core/presets/persist.ts
|
|
470233
|
-
import { existsSync as
|
|
470271
|
+
import { existsSync as existsSync57, mkdirSync as mkdirSync26, readFileSync as readFileSync32, writeFileSync as writeFileSync23 } from "fs";
|
|
470234
470272
|
import { join as join59 } from "path";
|
|
470235
470273
|
function getGlobalDir() {
|
|
470236
470274
|
return configDir();
|
|
@@ -470241,7 +470279,7 @@ function getGlobalFile() {
|
|
|
470241
470279
|
function resolveScopeFile(scope, cwd2) {
|
|
470242
470280
|
if (scope === "global") {
|
|
470243
470281
|
const dir2 = getGlobalDir();
|
|
470244
|
-
if (!
|
|
470282
|
+
if (!existsSync57(dir2))
|
|
470245
470283
|
mkdirSync26(dir2, { recursive: true, mode: 448 });
|
|
470246
470284
|
return getGlobalFile();
|
|
470247
470285
|
}
|
|
@@ -470249,7 +470287,7 @@ function resolveScopeFile(scope, cwd2) {
|
|
|
470249
470287
|
return join59(dir, "config.json");
|
|
470250
470288
|
}
|
|
470251
470289
|
function readJsonObject(file2) {
|
|
470252
|
-
if (!
|
|
470290
|
+
if (!existsSync57(file2))
|
|
470253
470291
|
return {};
|
|
470254
470292
|
try {
|
|
470255
470293
|
const parsed = JSON.parse(readFileSync32(file2, "utf-8"));
|
|
@@ -470291,7 +470329,7 @@ function removePresets(scope, specs, cwd2 = process.cwd()) {
|
|
|
470291
470329
|
} else {
|
|
470292
470330
|
existing.presets = filtered;
|
|
470293
470331
|
}
|
|
470294
|
-
if (
|
|
470332
|
+
if (existsSync57(file2)) {
|
|
470295
470333
|
writeFileSync23(file2, JSON.stringify(existing, null, 2));
|
|
470296
470334
|
}
|
|
470297
470335
|
return { file: file2, before: current, after: filtered };
|
|
@@ -480312,7 +480350,7 @@ var init_ImageDisplay = __esm(() => {
|
|
|
480312
480350
|
});
|
|
480313
480351
|
|
|
480314
480352
|
// src/core/utils/syntax.ts
|
|
480315
|
-
import { existsSync as
|
|
480353
|
+
import { existsSync as existsSync58, readdirSync as readdirSync12 } from "fs";
|
|
480316
480354
|
import { dirname as dirname24, join as join61, resolve as resolve43 } from "path";
|
|
480317
480355
|
import {
|
|
480318
480356
|
addDefaultParsers,
|
|
@@ -480335,8 +480373,8 @@ function discoverParsers() {
|
|
|
480335
480373
|
continue;
|
|
480336
480374
|
const highlights = resolve43(langDir, "highlights.scm");
|
|
480337
480375
|
const injections = resolve43(langDir, "injections.scm");
|
|
480338
|
-
const hasHighlights =
|
|
480339
|
-
const hasInjections =
|
|
480376
|
+
const hasHighlights = existsSync58(highlights);
|
|
480377
|
+
const hasInjections = existsSync58(injections);
|
|
480340
480378
|
if (!hasHighlights)
|
|
480341
480379
|
continue;
|
|
480342
480380
|
const parser = {
|
|
@@ -480385,14 +480423,14 @@ var init_syntax = __esm(() => {
|
|
|
480385
480423
|
if (IS_COMPILED3) {
|
|
480386
480424
|
coreAssetsDir = bundledAssets;
|
|
480387
480425
|
} else if (IS_DIST3) {
|
|
480388
|
-
coreAssetsDir =
|
|
480426
|
+
coreAssetsDir = existsSync58(distAssets) ? distAssets : bundledAssets;
|
|
480389
480427
|
} else {
|
|
480390
480428
|
try {
|
|
480391
480429
|
coreAssetsDir = resolve43(dirname24(__require.resolve("@opentui/core")), "assets");
|
|
480392
480430
|
} catch {
|
|
480393
480431
|
coreAssetsDir = bundledAssets;
|
|
480394
480432
|
}
|
|
480395
|
-
if (!
|
|
480433
|
+
if (!existsSync58(coreAssetsDir))
|
|
480396
480434
|
coreAssetsDir = bundledAssets;
|
|
480397
480435
|
}
|
|
480398
480436
|
MARKDOWN_INJECTION_MAP = {
|
|
@@ -480427,13 +480465,13 @@ var init_syntax = __esm(() => {
|
|
|
480427
480465
|
addDefaultParsers(discoverParsers());
|
|
480428
480466
|
if (IS_COMPILED3) {
|
|
480429
480467
|
const worker = join61(dataDir(), "opentui-assets", "parser.worker.js");
|
|
480430
|
-
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH &&
|
|
480468
|
+
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH && existsSync58(worker)) {
|
|
480431
480469
|
process.env.OTUI_TREE_SITTER_WORKER_PATH = worker;
|
|
480432
480470
|
}
|
|
480433
480471
|
} else if (IS_DIST3) {
|
|
480434
480472
|
try {
|
|
480435
480473
|
const coreWorker = resolve43(dirname24(__require.resolve("@opentui/core")), "parser.worker.js");
|
|
480436
|
-
if (
|
|
480474
|
+
if (existsSync58(coreWorker)) {
|
|
480437
480475
|
process.env.OTUI_TREE_SITTER_WORKER_PATH = coreWorker;
|
|
480438
480476
|
}
|
|
480439
480477
|
} catch {}
|
|
@@ -486931,6 +486969,7 @@ var init_FinalResponseView = __esm(() => {
|
|
|
486931
486969
|
init_useHover();
|
|
486932
486970
|
init_shared();
|
|
486933
486971
|
init_ImageDisplay();
|
|
486972
|
+
init_ReasoningBlock();
|
|
486934
486973
|
init_StreamSegmentList();
|
|
486935
486974
|
init_ToolCallDisplay();
|
|
486936
486975
|
init_tool_formatters();
|
|
@@ -487215,25 +487254,32 @@ var init_FinalResponseView = __esm(() => {
|
|
|
487215
487254
|
liveToolCalls,
|
|
487216
487255
|
loadingStartedAt,
|
|
487217
487256
|
messagesLength,
|
|
487218
|
-
finalResponseCalled
|
|
487257
|
+
finalResponseCalled,
|
|
487258
|
+
showReasoning = true,
|
|
487259
|
+
reasoningExpanded = false
|
|
487219
487260
|
}) {
|
|
487261
|
+
const t = useTheme();
|
|
487220
487262
|
const firstToolsIdx = import_react62.useMemo(() => segments.findIndex((s2) => s2.type === "tools"), [segments]);
|
|
487221
|
-
const
|
|
487222
|
-
|
|
487223
|
-
|
|
487263
|
+
const reasoningSegs = import_react62.useMemo(() => showReasoning ? segments.filter((s2) => s2.type === "reasoning") : [], [segments, showReasoning]);
|
|
487264
|
+
const reasoningNode = reasoningSegs.length > 0 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
487265
|
+
flexDirection: "column",
|
|
487266
|
+
children: reasoningSegs.map((seg) => /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ReasoningBlock, {
|
|
487267
|
+
content: seg.content,
|
|
487268
|
+
expanded: reasoningExpanded,
|
|
487269
|
+
isStreaming: !seg.done,
|
|
487270
|
+
id: seg.id
|
|
487271
|
+
}, seg.id, false, undefined, this))
|
|
487272
|
+
}, undefined, false, undefined, this) : null;
|
|
487273
|
+
const leading = import_react62.useMemo(() => {
|
|
487274
|
+
const end = firstToolsIdx < 0 ? segments.length : firstToolsIdx;
|
|
487224
487275
|
const parts2 = [];
|
|
487225
|
-
for (
|
|
487276
|
+
for (let i4 = 0;i4 < end; i4++) {
|
|
487277
|
+
const seg = segments[i4];
|
|
487226
487278
|
if (seg?.type === "text" && seg.content.length > 0)
|
|
487227
487279
|
parts2.push(seg.content);
|
|
487228
487280
|
}
|
|
487229
487281
|
return parts2.length > 0 ? parts2.join("") : null;
|
|
487230
487282
|
}, [segments, firstToolsIdx]);
|
|
487231
|
-
const opening2 = import_react62.useMemo(() => {
|
|
487232
|
-
if (firstToolsIdx <= 0)
|
|
487233
|
-
return null;
|
|
487234
|
-
const first = segments[0];
|
|
487235
|
-
return first?.type === "text" ? first.content : null;
|
|
487236
|
-
}, [segments, firstToolsIdx]);
|
|
487237
487283
|
const trailingText = import_react62.useMemo(() => {
|
|
487238
487284
|
if (!finalResponseCalled)
|
|
487239
487285
|
return null;
|
|
@@ -487287,24 +487333,24 @@ var init_FinalResponseView = __esm(() => {
|
|
|
487287
487333
|
const hasDispatch = import_react62.useMemo(() => liveToolCalls.some((tc) => SUBAGENT_NAMES.has(tc.toolName)), [liveToolCalls]);
|
|
487288
487334
|
const hasEdits = import_react62.useMemo(() => liveToolCalls.some((tc) => FINAL_RESPONSE_EDIT_TOOLS.has(tc.toolName)), [liveToolCalls]);
|
|
487289
487335
|
const dispatchActive = liveToolCalls.some((tc) => SUBAGENT_NAMES.has(tc.toolName) && tc.state === "running");
|
|
487290
|
-
const allToolsDone = tools.length > 0 && tools.every((
|
|
487336
|
+
const allToolsDone = tools.length > 0 && tools.every((t2) => t2.done);
|
|
487291
487337
|
const pendingNarration = allToolsDone && !dispatchActive && !trailingText;
|
|
487292
|
-
|
|
487293
|
-
|
|
487294
|
-
|
|
487295
|
-
|
|
487296
|
-
|
|
487297
|
-
|
|
487298
|
-
}, undefined, false, undefined, this)
|
|
487338
|
+
const hasVisibleBody = !!reasoningNode || tools.length > 0 || !!leading || !!trailingText;
|
|
487339
|
+
if (!hasVisibleBody) {
|
|
487340
|
+
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
487341
|
+
fg: t.textMuted,
|
|
487342
|
+
attributes: TextAttributes11.ITALIC,
|
|
487343
|
+
children: "Thinking\u2026"
|
|
487299
487344
|
}, undefined, false, undefined, this);
|
|
487300
487345
|
}
|
|
487301
487346
|
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
487302
487347
|
flexDirection: "column",
|
|
487303
487348
|
children: [
|
|
487304
|
-
|
|
487349
|
+
reasoningNode,
|
|
487350
|
+
leading ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
487305
487351
|
flexDirection: "column",
|
|
487306
487352
|
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(DripText, {
|
|
487307
|
-
content:
|
|
487353
|
+
content: leading,
|
|
487308
487354
|
streaming: true
|
|
487309
487355
|
}, undefined, false, undefined, this)
|
|
487310
487356
|
}, undefined, false, undefined, this) : null,
|
|
@@ -487421,6 +487467,7 @@ var init_InputBox = __esm(async () => {
|
|
|
487421
487467
|
init_history();
|
|
487422
487468
|
init_icons();
|
|
487423
487469
|
init_theme();
|
|
487470
|
+
init_errors();
|
|
487424
487471
|
init_ui();
|
|
487425
487472
|
init_clipboard2();
|
|
487426
487473
|
init_image_compress();
|
|
@@ -487789,14 +487836,16 @@ var init_InputBox = __esm(async () => {
|
|
|
487789
487836
|
};
|
|
487790
487837
|
}, [isFocused, renderer2]);
|
|
487791
487838
|
useKeyboard((evt) => {
|
|
487792
|
-
if (isFocused && evt.ctrl && evt.name === "v") {
|
|
487839
|
+
if (isFocused && (evt.ctrl || evt.meta) && evt.name === "v") {
|
|
487793
487840
|
if (imageLoadingRef.current)
|
|
487794
487841
|
return;
|
|
487795
487842
|
imageLoadingRef.current = true;
|
|
487796
487843
|
readClipboardImageAsync().then(async (clipImg) => {
|
|
487797
487844
|
imageLoadingRef.current = false;
|
|
487798
|
-
if (!clipImg)
|
|
487845
|
+
if (!clipImg) {
|
|
487846
|
+
logBackgroundError("clipboard", "No image found on clipboard (or read failed)");
|
|
487799
487847
|
return;
|
|
487848
|
+
}
|
|
487800
487849
|
const ta = textareaRef.current;
|
|
487801
487850
|
if (!ta)
|
|
487802
487851
|
return;
|
|
@@ -487810,8 +487859,9 @@ var init_InputBox = __esm(async () => {
|
|
|
487810
487859
|
});
|
|
487811
487860
|
ta.insertText(`[${label}] `);
|
|
487812
487861
|
syncImageExtmarks(ta);
|
|
487813
|
-
}).catch(() => {
|
|
487862
|
+
}).catch((err2) => {
|
|
487814
487863
|
imageLoadingRef.current = false;
|
|
487864
|
+
logBackgroundError("clipboard", `Image paste failed: ${toErrorMessage(err2)}`);
|
|
487815
487865
|
});
|
|
487816
487866
|
return;
|
|
487817
487867
|
}
|
|
@@ -492084,7 +492134,9 @@ var init_TabInstance = __esm(async () => {
|
|
|
492084
492134
|
liveToolCalls: chat.liveToolCalls,
|
|
492085
492135
|
loadingStartedAt: loadingStartedAtRef.current,
|
|
492086
492136
|
messagesLength: chat.messages.length,
|
|
492087
|
-
finalResponseCalled: chat.finalResponseCalled
|
|
492137
|
+
finalResponseCalled: chat.finalResponseCalled,
|
|
492138
|
+
showReasoning,
|
|
492139
|
+
reasoningExpanded
|
|
492088
492140
|
}, undefined, false, undefined, this)
|
|
492089
492141
|
]
|
|
492090
492142
|
}, undefined, true, undefined, this)
|
|
@@ -498818,7 +498870,7 @@ function StatusDashboard({
|
|
|
498818
498870
|
Promise.resolve().then(() => (init_service(), exports_service))
|
|
498819
498871
|
]);
|
|
498820
498872
|
const cfg = loadHearthConfig2();
|
|
498821
|
-
const { existsSync:
|
|
498873
|
+
const { existsSync: existsSync59 } = await import("fs");
|
|
498822
498874
|
const svc = await getServiceStatus2();
|
|
498823
498875
|
const persistence = {
|
|
498824
498876
|
installed: svc.installed,
|
|
@@ -498826,7 +498878,7 @@ function StatusDashboard({
|
|
|
498826
498878
|
platform: svc.platform,
|
|
498827
498879
|
unitLabel: svc.unitLabel
|
|
498828
498880
|
};
|
|
498829
|
-
if (!
|
|
498881
|
+
if (!existsSync59(cfg.daemon.socketPath)) {
|
|
498830
498882
|
if (!stopped)
|
|
498831
498883
|
setHearth({
|
|
498832
498884
|
running: false,
|
|
@@ -501849,7 +501901,7 @@ var init_hearth2 = __esm(() => {
|
|
|
501849
501901
|
|
|
501850
501902
|
// src/components/settings/HearthSettings.tsx
|
|
501851
501903
|
import { spawn as spawn21 } from "child_process";
|
|
501852
|
-
import { appendFileSync as appendFileSync5, existsSync as
|
|
501904
|
+
import { appendFileSync as appendFileSync5, existsSync as existsSync59, readFileSync as readFileSync33, statSync as statSync12, watch as watch3 } from "fs";
|
|
501853
501905
|
import { tmpdir as tmpdir6 } from "os";
|
|
501854
501906
|
import { delimiter as delimiter2, dirname as dirname25, join as join64, resolve as resolve45 } from "path";
|
|
501855
501907
|
import { decodePasteBytes as decodePasteBytes6, TextAttributes as TextAttributes27 } from "@opentui/core";
|
|
@@ -501875,7 +501927,7 @@ function formatUptime(ms) {
|
|
|
501875
501927
|
return `${String(h3)}h ${String(m5 % 60)}m`;
|
|
501876
501928
|
}
|
|
501877
501929
|
async function probeDaemon(socketPath) {
|
|
501878
|
-
if (!
|
|
501930
|
+
if (!existsSync59(socketPath))
|
|
501879
501931
|
return { running: false };
|
|
501880
501932
|
try {
|
|
501881
501933
|
const res = await socketRequest({ op: "health", v: HEARTH_PROTOCOL_VERSION }, { path: socketPath, timeoutMs: 1200 });
|
|
@@ -501895,7 +501947,7 @@ async function probeDaemon(socketPath) {
|
|
|
501895
501947
|
}
|
|
501896
501948
|
}
|
|
501897
501949
|
async function issuePairingCodeViaDaemon(socketPath, surfaceId) {
|
|
501898
|
-
if (!
|
|
501950
|
+
if (!existsSync59(socketPath)) {
|
|
501899
501951
|
return { error: "Daemon not running \u2014 start it from the Daemon tab first." };
|
|
501900
501952
|
}
|
|
501901
501953
|
try {
|
|
@@ -502193,7 +502245,7 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502193
502245
|
const path = config2.daemon.logFile;
|
|
502194
502246
|
const read = () => {
|
|
502195
502247
|
try {
|
|
502196
|
-
if (!
|
|
502248
|
+
if (!existsSync59(path)) {
|
|
502197
502249
|
setLogLines(["(log file not yet created \u2014 start the daemon from the Daemon tab)"]);
|
|
502198
502250
|
return;
|
|
502199
502251
|
}
|
|
@@ -502302,7 +502354,7 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502302
502354
|
}
|
|
502303
502355
|
const pidPath = join64(configDir(), "hearth.pid");
|
|
502304
502356
|
let pid = null;
|
|
502305
|
-
if (
|
|
502357
|
+
if (existsSync59(pidPath)) {
|
|
502306
502358
|
const raw2 = readFileSync33(pidPath, "utf-8").trim();
|
|
502307
502359
|
const n = Number.parseInt(raw2, 10);
|
|
502308
502360
|
if (!Number.isNaN(n) && n > 0)
|
|
@@ -502339,7 +502391,7 @@ function HearthSettings({ visible, onClose }) {
|
|
|
502339
502391
|
logBackgroundError("hearth-settings", err2 instanceof Error ? err2.message : String(err2));
|
|
502340
502392
|
return;
|
|
502341
502393
|
}
|
|
502342
|
-
if (!
|
|
502394
|
+
if (!existsSync59(next.daemon.socketPath))
|
|
502343
502395
|
return;
|
|
502344
502396
|
socketRequest({ op: "reload", v: HEARTH_PROTOCOL_VERSION }, { path: next.daemon.socketPath, timeoutMs: 8000 }).then((res) => {
|
|
502345
502397
|
const parts2 = [];
|
|
@@ -504904,7 +504956,7 @@ function renderAddAllowed(_w, _rows, mode, t) {
|
|
|
504904
504956
|
}
|
|
504905
504957
|
function resolveLauncher() {
|
|
504906
504958
|
const envOverride = process.env.SOULFORGE_HEARTH_LAUNCHER;
|
|
504907
|
-
if (envOverride &&
|
|
504959
|
+
if (envOverride && existsSync59(envOverride)) {
|
|
504908
504960
|
return { kind: "env", cmd: envOverride, args: [] };
|
|
504909
504961
|
}
|
|
504910
504962
|
const checkout = findSourceCheckout(process.argv[1] ?? process.cwd());
|
|
@@ -504912,14 +504964,14 @@ function resolveLauncher() {
|
|
|
504912
504964
|
const bootTsx = join64(checkout, "src", "boot.tsx");
|
|
504913
504965
|
const distEntry = join64(checkout, "dist", "bin.sh");
|
|
504914
504966
|
const bin = join64(checkout, "bin", "soulforge");
|
|
504915
|
-
if (
|
|
504967
|
+
if (existsSync59(bootTsx)) {
|
|
504916
504968
|
const bunBin = process.execPath.includes("bun") ? process.execPath : findBinaryOnPath("bun") ?? "bun";
|
|
504917
504969
|
return { kind: "dev-bun", cmd: bunBin, args: [bootTsx] };
|
|
504918
504970
|
}
|
|
504919
|
-
if (
|
|
504971
|
+
if (existsSync59(distEntry)) {
|
|
504920
504972
|
return { kind: "dist", cmd: distEntry, args: [] };
|
|
504921
504973
|
}
|
|
504922
|
-
if (
|
|
504974
|
+
if (existsSync59(bin) && isExecutable(bin)) {
|
|
504923
504975
|
return { kind: "dev-bin", cmd: bin, args: [] };
|
|
504924
504976
|
}
|
|
504925
504977
|
}
|
|
@@ -504929,10 +504981,10 @@ function resolveLauncher() {
|
|
|
504929
504981
|
return null;
|
|
504930
504982
|
}
|
|
504931
504983
|
function findSourceCheckout(startPath) {
|
|
504932
|
-
let dir = startPath &&
|
|
504984
|
+
let dir = startPath && existsSync59(startPath) ? resolve45(dirname25(startPath)) : resolve45(process.cwd());
|
|
504933
504985
|
for (let i4 = 0;i4 < 6; i4++) {
|
|
504934
504986
|
const pkg = join64(dir, "package.json");
|
|
504935
|
-
if (
|
|
504987
|
+
if (existsSync59(pkg)) {
|
|
504936
504988
|
try {
|
|
504937
504989
|
const parsed = JSON.parse(readFileSync33(pkg, "utf-8"));
|
|
504938
504990
|
if (parsed.name === "@proxysoul/soulforge" || parsed.module?.includes("boot.tsx")) {
|
|
@@ -504961,13 +505013,13 @@ function isExecutable(p3) {
|
|
|
504961
505013
|
}
|
|
504962
505014
|
function findBinaryOnPath(name39) {
|
|
504963
505015
|
const resolved = findOnPath(name39);
|
|
504964
|
-
if (resolved &&
|
|
505016
|
+
if (resolved && existsSync59(resolved) && isExecutable(resolved))
|
|
504965
505017
|
return resolved;
|
|
504966
505018
|
const exts = IS_WIN ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean) : [""];
|
|
504967
505019
|
for (const dir of (process.env.PATH ?? "").split(delimiter2)) {
|
|
504968
505020
|
for (const ext of exts) {
|
|
504969
505021
|
const candidate = join64(dir, name39 + ext);
|
|
504970
|
-
if (
|
|
505022
|
+
if (existsSync59(candidate) && isExecutable(candidate))
|
|
504971
505023
|
return candidate;
|
|
504972
505024
|
}
|
|
504973
505025
|
}
|
|
@@ -504975,7 +505027,7 @@ function findBinaryOnPath(name39) {
|
|
|
504975
505027
|
}
|
|
504976
505028
|
function readTailSafe(path, maxLines) {
|
|
504977
505029
|
try {
|
|
504978
|
-
if (!
|
|
505030
|
+
if (!existsSync59(path))
|
|
504979
505031
|
return null;
|
|
504980
505032
|
const raw2 = readFileSync33(path, "utf-8");
|
|
504981
505033
|
const lines = raw2.split(`
|
|
@@ -505056,7 +505108,7 @@ var init_HearthSettings = __esm(async () => {
|
|
|
505056
505108
|
|
|
505057
505109
|
// src/core/intelligence/backends/lsp/installer.ts
|
|
505058
505110
|
import { spawn as spawn22 } from "child_process";
|
|
505059
|
-
import { chmodSync as chmodSync6, existsSync as
|
|
505111
|
+
import { chmodSync as chmodSync6, existsSync as existsSync60, mkdirSync as mkdirSync27, readFileSync as readFileSync34, unlinkSync as unlinkSync12, writeFileSync as writeFileSync24 } from "fs";
|
|
505060
505112
|
import { homedir as homedir14 } from "os";
|
|
505061
505113
|
import { join as join65 } from "path";
|
|
505062
505114
|
function parsePurl(id) {
|
|
@@ -505124,14 +505176,14 @@ function getToolchainRequirement(method) {
|
|
|
505124
505176
|
function loadRegistry() {
|
|
505125
505177
|
if (registryCache)
|
|
505126
505178
|
return registryCache;
|
|
505127
|
-
if (
|
|
505179
|
+
if (existsSync60(MASON_REGISTRY_LOCAL)) {
|
|
505128
505180
|
try {
|
|
505129
505181
|
const raw2 = readFileSync34(MASON_REGISTRY_LOCAL, "utf-8");
|
|
505130
505182
|
registryCache = JSON.parse(raw2);
|
|
505131
505183
|
return registryCache;
|
|
505132
505184
|
} catch {}
|
|
505133
505185
|
}
|
|
505134
|
-
if (
|
|
505186
|
+
if (existsSync60(REGISTRY_CACHE)) {
|
|
505135
505187
|
try {
|
|
505136
505188
|
const raw2 = readFileSync34(REGISTRY_CACHE, "utf-8");
|
|
505137
505189
|
registryCache = JSON.parse(raw2);
|
|
@@ -505198,7 +505250,7 @@ function loadVersions() {
|
|
|
505198
505250
|
if (versionCache)
|
|
505199
505251
|
return versionCache;
|
|
505200
505252
|
try {
|
|
505201
|
-
if (
|
|
505253
|
+
if (existsSync60(VERSIONS_FILE)) {
|
|
505202
505254
|
versionCache = JSON.parse(readFileSync34(VERSIONS_FILE, "utf-8"));
|
|
505203
505255
|
return versionCache;
|
|
505204
505256
|
}
|
|
@@ -505236,7 +505288,7 @@ function checkPackageStatus(pkg) {
|
|
|
505236
505288
|
const winSuffixes = IS_WIN ? [EXE, CMD_EXT, ""] : [""];
|
|
505237
505289
|
const probe = (dir, bin) => {
|
|
505238
505290
|
for (const sfx of winSuffixes) {
|
|
505239
|
-
if (
|
|
505291
|
+
if (existsSync60(join65(dir, bin + sfx)))
|
|
505240
505292
|
return true;
|
|
505241
505293
|
}
|
|
505242
505294
|
return false;
|
|
@@ -505339,7 +505391,7 @@ async function installPackage(pkg, onProgress) {
|
|
|
505339
505391
|
if (commandExists("bun"))
|
|
505340
505392
|
return "bun";
|
|
505341
505393
|
const sfBin = join65(dataDir(), "bin", `bun${EXE}`);
|
|
505342
|
-
if (
|
|
505394
|
+
if (existsSync60(sfBin))
|
|
505343
505395
|
return sfBin;
|
|
505344
505396
|
return "bun";
|
|
505345
505397
|
})();
|
|
@@ -505438,7 +505490,7 @@ PYTHONPATH="${pipDir}:$PYTHONPATH" exec python3 -m ${moduleName} "$@"
|
|
|
505438
505490
|
}
|
|
505439
505491
|
}
|
|
505440
505492
|
for (const candidate of candidates) {
|
|
505441
|
-
if (
|
|
505493
|
+
if (existsSync60(candidate)) {
|
|
505442
505494
|
const { copyFileSync: copyFileSync2 } = await import("fs");
|
|
505443
505495
|
const srcExt = candidate.endsWith(".exe") ? ".exe" : candidate.endsWith(".cmd") ? ".cmd" : "";
|
|
505444
505496
|
const dest = join65(binDir, binName + (IS_WIN ? srcExt : ""));
|
|
@@ -505491,7 +505543,7 @@ async function uninstallPackage(pkg, onProgress) {
|
|
|
505491
505543
|
if (commandExists("bun"))
|
|
505492
505544
|
return "bun";
|
|
505493
505545
|
const sfBin = join65(dataDir(), "bin", `bun${EXE}`);
|
|
505494
|
-
if (
|
|
505546
|
+
if (existsSync60(sfBin))
|
|
505495
505547
|
return sfBin;
|
|
505496
505548
|
return "bun";
|
|
505497
505549
|
})();
|
|
@@ -505653,7 +505705,7 @@ var init_installer = __esm(() => {
|
|
|
505653
505705
|
});
|
|
505654
505706
|
|
|
505655
505707
|
// src/components/settings/LspInstallSearch.tsx
|
|
505656
|
-
import { existsSync as
|
|
505708
|
+
import { existsSync as existsSync61 } from "fs";
|
|
505657
505709
|
import { join as join66 } from "path";
|
|
505658
505710
|
import { TextAttributes as TextAttributes28 } from "@opentui/core";
|
|
505659
505711
|
function methodLabel(status) {
|
|
@@ -505802,7 +505854,7 @@ function LspInstallSearch({
|
|
|
505802
505854
|
const defaultScopeCursor = detectScope("disabledLspServers") === "project" ? 0 : 1;
|
|
505803
505855
|
const [scopeCursor, setScopeCursor] = import_react144.useState(defaultScopeCursor);
|
|
505804
505856
|
const downloadAttemptedRef = import_react144.useRef(false);
|
|
505805
|
-
const isInProject =
|
|
505857
|
+
const isInProject = existsSync61(join66(cwd2, ".git"));
|
|
505806
505858
|
const { width: termCols, height: termRows } = useTerminalDimensions();
|
|
505807
505859
|
const containerRows = termRows - 2;
|
|
505808
505860
|
const popupWidth = Math.min(MAX_POPUP_WIDTH3, Math.floor(termCols * 0.9));
|
|
@@ -509639,7 +509691,7 @@ var init_RouterSettings = __esm(async () => {
|
|
|
509639
509691
|
});
|
|
509640
509692
|
|
|
509641
509693
|
// src/components/settings/SkillSearch.tsx
|
|
509642
|
-
import { existsSync as
|
|
509694
|
+
import { existsSync as existsSync62 } from "fs";
|
|
509643
509695
|
import { join as join67 } from "path";
|
|
509644
509696
|
import { TextAttributes as TextAttributes30 } from "@opentui/core";
|
|
509645
509697
|
function SearchSkillRow({
|
|
@@ -509786,7 +509838,7 @@ function SkillSearch({ visible, contextManager, onClose, onSystemMessage }) {
|
|
|
509786
509838
|
const [pendingInstall, setPendingInstall] = import_react156.useState(null);
|
|
509787
509839
|
const [scopeCursor, setScopeCursor] = import_react156.useState(0);
|
|
509788
509840
|
const debounceRef = import_react156.useRef(null);
|
|
509789
|
-
const isInProject =
|
|
509841
|
+
const isInProject = existsSync62(join67(getCwd(), ".git"));
|
|
509790
509842
|
const { width: termCols, height: termRows } = useTerminalDimensions();
|
|
509791
509843
|
const containerRows = termRows - 2;
|
|
509792
509844
|
const popupWidth = Math.min(MAX_POPUP_WIDTH5, Math.floor(termCols * 0.88));
|
|
@@ -510261,7 +510313,7 @@ var init_ToolsPopup = __esm(async () => {
|
|
|
510261
510313
|
});
|
|
510262
510314
|
|
|
510263
510315
|
// src/components/modals/MemoryBrowser.tsx
|
|
510264
|
-
import { existsSync as
|
|
510316
|
+
import { existsSync as existsSync63 } from "fs";
|
|
510265
510317
|
import { join as join68 } from "path";
|
|
510266
510318
|
function timeAgo2(iso) {
|
|
510267
510319
|
const ms = Date.now() - Date.parse(iso);
|
|
@@ -510321,7 +510373,7 @@ function MemoryBrowser({ visible, contextManager, cwd: cwd2, onClose, onSystemMe
|
|
|
510321
510373
|
}, []);
|
|
510322
510374
|
const fileExists = import_react160.useCallback((p3) => {
|
|
510323
510375
|
try {
|
|
510324
|
-
return
|
|
510376
|
+
return existsSync63(join68(cwd2, p3));
|
|
510325
510377
|
} catch {
|
|
510326
510378
|
return false;
|
|
510327
510379
|
}
|
|
@@ -511067,12 +511119,12 @@ __export(exports_claim, {
|
|
|
511067
511119
|
bindClaimedSessions: () => bindClaimedSessions,
|
|
511068
511120
|
autoClaimDaemonWorkspaces: () => autoClaimDaemonWorkspaces
|
|
511069
511121
|
});
|
|
511070
|
-
import { existsSync as
|
|
511122
|
+
import { existsSync as existsSync64 } from "fs";
|
|
511071
511123
|
async function autoClaimDaemonWorkspaces(cwd2) {
|
|
511072
511124
|
const config2 = loadHearthConfig(cwd2);
|
|
511073
511125
|
const socketPath = config2.daemon.socketPath;
|
|
511074
511126
|
const out2 = { sessions: [], errors: [] };
|
|
511075
|
-
if (!
|
|
511127
|
+
if (!existsSync64(socketPath))
|
|
511076
511128
|
return out2;
|
|
511077
511129
|
let list;
|
|
511078
511130
|
try {
|
|
@@ -513168,7 +513220,7 @@ init_theme();
|
|
|
513168
513220
|
init_resolve_cwd();
|
|
513169
513221
|
init_splash();
|
|
513170
513222
|
init_errors();
|
|
513171
|
-
import { existsSync as
|
|
513223
|
+
import { existsSync as existsSync65, readFileSync as readFileSync35 } from "fs";
|
|
513172
513224
|
import { join as join70 } from "path";
|
|
513173
513225
|
globalThis.AI_SDK_LOG_WARNINGS = false;
|
|
513174
513226
|
installGlobalFetch();
|
|
@@ -513244,7 +513296,7 @@ if (cliArgs.includes("--presets") || cliArgs[0] === "presets") {
|
|
|
513244
513296
|
var IS_COMPILED4 = isCompiledBinary(import.meta.url);
|
|
513245
513297
|
if (IS_COMPILED4) {
|
|
513246
513298
|
const bundledWorker = join70(dataDir(), "opentui-assets", "parser.worker.js");
|
|
513247
|
-
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH &&
|
|
513299
|
+
if (!process.env.OTUI_TREE_SITTER_WORKER_PATH && existsSync65(bundledWorker)) {
|
|
513248
513300
|
process.env.OTUI_TREE_SITTER_WORKER_PATH = bundledWorker;
|
|
513249
513301
|
}
|
|
513250
513302
|
}
|