oh-my-opencode-unguarded 3.10.0 → 3.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -11750,12 +11750,12 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
11750
11750
|
throw new Error(`Unknown format "${name}"`);
|
|
11751
11751
|
return f;
|
|
11752
11752
|
};
|
|
11753
|
-
function addFormats(ajv, list,
|
|
11753
|
+
function addFormats(ajv, list, fs20, exportName) {
|
|
11754
11754
|
var _a;
|
|
11755
11755
|
var _b;
|
|
11756
11756
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
|
|
11757
11757
|
for (const f of list)
|
|
11758
|
-
ajv.addFormat(f,
|
|
11758
|
+
ajv.addFormat(f, fs20[f]);
|
|
11759
11759
|
}
|
|
11760
11760
|
module.exports = exports = formatsPlugin;
|
|
11761
11761
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -11766,7 +11766,7 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
11766
11766
|
var require_windows = __commonJS((exports, module) => {
|
|
11767
11767
|
module.exports = isexe;
|
|
11768
11768
|
isexe.sync = sync;
|
|
11769
|
-
var
|
|
11769
|
+
var fs20 = __require("fs");
|
|
11770
11770
|
function checkPathExt(path11, options) {
|
|
11771
11771
|
var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
|
|
11772
11772
|
if (!pathext) {
|
|
@@ -11791,12 +11791,12 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
11791
11791
|
return checkPathExt(path11, options);
|
|
11792
11792
|
}
|
|
11793
11793
|
function isexe(path11, options, cb) {
|
|
11794
|
-
|
|
11794
|
+
fs20.stat(path11, function(er, stat2) {
|
|
11795
11795
|
cb(er, er ? false : checkStat(stat2, path11, options));
|
|
11796
11796
|
});
|
|
11797
11797
|
}
|
|
11798
11798
|
function sync(path11, options) {
|
|
11799
|
-
return checkStat(
|
|
11799
|
+
return checkStat(fs20.statSync(path11), path11, options);
|
|
11800
11800
|
}
|
|
11801
11801
|
});
|
|
11802
11802
|
|
|
@@ -11804,14 +11804,14 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
11804
11804
|
var require_mode = __commonJS((exports, module) => {
|
|
11805
11805
|
module.exports = isexe;
|
|
11806
11806
|
isexe.sync = sync;
|
|
11807
|
-
var
|
|
11807
|
+
var fs20 = __require("fs");
|
|
11808
11808
|
function isexe(path11, options, cb) {
|
|
11809
|
-
|
|
11809
|
+
fs20.stat(path11, function(er, stat2) {
|
|
11810
11810
|
cb(er, er ? false : checkStat(stat2, options));
|
|
11811
11811
|
});
|
|
11812
11812
|
}
|
|
11813
11813
|
function sync(path11, options) {
|
|
11814
|
-
return checkStat(
|
|
11814
|
+
return checkStat(fs20.statSync(path11), options);
|
|
11815
11815
|
}
|
|
11816
11816
|
function checkStat(stat2, options) {
|
|
11817
11817
|
return stat2.isFile() && checkMode(stat2, options);
|
|
@@ -11833,7 +11833,7 @@ var require_mode = __commonJS((exports, module) => {
|
|
|
11833
11833
|
|
|
11834
11834
|
// node_modules/isexe/index.js
|
|
11835
11835
|
var require_isexe = __commonJS((exports, module) => {
|
|
11836
|
-
var
|
|
11836
|
+
var fs20 = __require("fs");
|
|
11837
11837
|
var core3;
|
|
11838
11838
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
11839
11839
|
core3 = require_windows();
|
|
@@ -12072,16 +12072,16 @@ var require_shebang_command = __commonJS((exports, module) => {
|
|
|
12072
12072
|
|
|
12073
12073
|
// node_modules/cross-spawn/lib/util/readShebang.js
|
|
12074
12074
|
var require_readShebang = __commonJS((exports, module) => {
|
|
12075
|
-
var
|
|
12075
|
+
var fs20 = __require("fs");
|
|
12076
12076
|
var shebangCommand = require_shebang_command();
|
|
12077
12077
|
function readShebang(command) {
|
|
12078
12078
|
const size = 150;
|
|
12079
12079
|
const buffer = Buffer.alloc(size);
|
|
12080
12080
|
let fd;
|
|
12081
12081
|
try {
|
|
12082
|
-
fd =
|
|
12083
|
-
|
|
12084
|
-
|
|
12082
|
+
fd = fs20.openSync(command, "r");
|
|
12083
|
+
fs20.readSync(fd, buffer, 0, size, 0);
|
|
12084
|
+
fs20.closeSync(fd);
|
|
12085
12085
|
} catch (e) {}
|
|
12086
12086
|
return shebangCommand(buffer.toString());
|
|
12087
12087
|
}
|
|
@@ -38277,10 +38277,11 @@ function createBackgroundNotificationHook(manager) {
|
|
|
38277
38277
|
init_logger();
|
|
38278
38278
|
|
|
38279
38279
|
// src/hooks/auto-update-checker/checker/local-dev-path.ts
|
|
38280
|
-
import * as
|
|
38280
|
+
import * as fs8 from "fs";
|
|
38281
38281
|
import { fileURLToPath } from "url";
|
|
38282
38282
|
|
|
38283
38283
|
// src/hooks/auto-update-checker/constants.ts
|
|
38284
|
+
import * as fs7 from "fs";
|
|
38284
38285
|
import * as path5 from "path";
|
|
38285
38286
|
import * as os4 from "os";
|
|
38286
38287
|
var PACKAGE_NAME = "oh-my-opencode-unguarded";
|
|
@@ -38294,6 +38295,21 @@ function getCacheDir3() {
|
|
|
38294
38295
|
}
|
|
38295
38296
|
var CACHE_DIR = getCacheDir3();
|
|
38296
38297
|
var VERSION_FILE = path5.join(CACHE_DIR, "version");
|
|
38298
|
+
function resolveHostCacheDir() {
|
|
38299
|
+
if (process.platform === "win32") {
|
|
38300
|
+
const dotCacheDir = path5.join(os4.homedir(), ".cache", "opencode");
|
|
38301
|
+
if (fs7.existsSync(path5.join(dotCacheDir, "node_modules"))) {
|
|
38302
|
+
return dotCacheDir;
|
|
38303
|
+
}
|
|
38304
|
+
const localAppDataDir = path5.join(process.env.LOCALAPPDATA ?? os4.homedir(), "opencode");
|
|
38305
|
+
if (fs7.existsSync(path5.join(localAppDataDir, "node_modules"))) {
|
|
38306
|
+
return localAppDataDir;
|
|
38307
|
+
}
|
|
38308
|
+
return dotCacheDir;
|
|
38309
|
+
}
|
|
38310
|
+
return path5.join(os4.homedir(), ".cache", "opencode");
|
|
38311
|
+
}
|
|
38312
|
+
var HOST_CACHE_DIR = resolveHostCacheDir();
|
|
38297
38313
|
function getWindowsAppdataDir2() {
|
|
38298
38314
|
if (process.platform !== "win32")
|
|
38299
38315
|
return null;
|
|
@@ -38303,6 +38319,7 @@ var USER_CONFIG_DIR = getOpenCodeConfigDir({ binary: "opencode" });
|
|
|
38303
38319
|
var USER_OPENCODE_CONFIG = path5.join(USER_CONFIG_DIR, "opencode.json");
|
|
38304
38320
|
var USER_OPENCODE_CONFIG_JSONC = path5.join(USER_CONFIG_DIR, "opencode.jsonc");
|
|
38305
38321
|
var INSTALLED_PACKAGE_JSON = path5.join(USER_CONFIG_DIR, "node_modules", PACKAGE_NAME, "package.json");
|
|
38322
|
+
var HOST_INSTALLED_PACKAGE_JSON = path5.join(HOST_CACHE_DIR, "node_modules", PACKAGE_NAME, "package.json");
|
|
38306
38323
|
|
|
38307
38324
|
// src/hooks/auto-update-checker/checker/config-paths.ts
|
|
38308
38325
|
import * as os5 from "os";
|
|
@@ -38341,9 +38358,9 @@ function stripJsonComments(json3) {
|
|
|
38341
38358
|
function getLocalDevPath(directory) {
|
|
38342
38359
|
for (const configPath of getConfigPaths2(directory)) {
|
|
38343
38360
|
try {
|
|
38344
|
-
if (!
|
|
38361
|
+
if (!fs8.existsSync(configPath))
|
|
38345
38362
|
continue;
|
|
38346
|
-
const content =
|
|
38363
|
+
const content = fs8.readFileSync(configPath, "utf-8");
|
|
38347
38364
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
38348
38365
|
const plugins = config2.plugin ?? [];
|
|
38349
38366
|
for (const entry of plugins) {
|
|
@@ -38362,20 +38379,20 @@ function getLocalDevPath(directory) {
|
|
|
38362
38379
|
return null;
|
|
38363
38380
|
}
|
|
38364
38381
|
// src/hooks/auto-update-checker/checker/local-dev-version.ts
|
|
38365
|
-
import * as
|
|
38382
|
+
import * as fs10 from "fs";
|
|
38366
38383
|
|
|
38367
38384
|
// src/hooks/auto-update-checker/checker/package-json-locator.ts
|
|
38368
|
-
import * as
|
|
38385
|
+
import * as fs9 from "fs";
|
|
38369
38386
|
import * as path7 from "path";
|
|
38370
38387
|
function findPackageJsonUp(startPath) {
|
|
38371
38388
|
try {
|
|
38372
|
-
const stat =
|
|
38389
|
+
const stat = fs9.statSync(startPath);
|
|
38373
38390
|
let dir = stat.isDirectory() ? startPath : path7.dirname(startPath);
|
|
38374
38391
|
for (let i2 = 0;i2 < 10; i2++) {
|
|
38375
38392
|
const pkgPath = path7.join(dir, "package.json");
|
|
38376
|
-
if (
|
|
38393
|
+
if (fs9.existsSync(pkgPath)) {
|
|
38377
38394
|
try {
|
|
38378
|
-
const content =
|
|
38395
|
+
const content = fs9.readFileSync(pkgPath, "utf-8");
|
|
38379
38396
|
const pkg = JSON.parse(content);
|
|
38380
38397
|
if (pkg.name === PACKAGE_NAME)
|
|
38381
38398
|
return pkgPath;
|
|
@@ -38399,7 +38416,7 @@ function getLocalDevVersion(directory) {
|
|
|
38399
38416
|
const pkgPath = findPackageJsonUp(localPath);
|
|
38400
38417
|
if (!pkgPath)
|
|
38401
38418
|
return null;
|
|
38402
|
-
const content =
|
|
38419
|
+
const content = fs10.readFileSync(pkgPath, "utf-8");
|
|
38403
38420
|
const pkg = JSON.parse(content);
|
|
38404
38421
|
return pkg.version ?? null;
|
|
38405
38422
|
} catch {
|
|
@@ -38407,16 +38424,16 @@ function getLocalDevVersion(directory) {
|
|
|
38407
38424
|
}
|
|
38408
38425
|
}
|
|
38409
38426
|
// src/hooks/auto-update-checker/checker/plugin-entry.ts
|
|
38410
|
-
import * as
|
|
38427
|
+
import * as fs11 from "fs";
|
|
38411
38428
|
function isExplicitVersionPin(pinnedVersion) {
|
|
38412
38429
|
return /^\d+\.\d+\.\d+/.test(pinnedVersion);
|
|
38413
38430
|
}
|
|
38414
38431
|
function findPluginEntry(directory) {
|
|
38415
38432
|
for (const configPath of getConfigPaths2(directory)) {
|
|
38416
38433
|
try {
|
|
38417
|
-
if (!
|
|
38434
|
+
if (!fs11.existsSync(configPath))
|
|
38418
38435
|
continue;
|
|
38419
|
-
const content =
|
|
38436
|
+
const content = fs11.readFileSync(configPath, "utf-8");
|
|
38420
38437
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
38421
38438
|
const plugins = config2.plugin ?? [];
|
|
38422
38439
|
for (const entry of plugins) {
|
|
@@ -38437,23 +38454,32 @@ function findPluginEntry(directory) {
|
|
|
38437
38454
|
}
|
|
38438
38455
|
// src/hooks/auto-update-checker/checker/cached-version.ts
|
|
38439
38456
|
init_logger();
|
|
38440
|
-
import * as
|
|
38457
|
+
import * as fs12 from "fs";
|
|
38441
38458
|
import * as path8 from "path";
|
|
38442
38459
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
38443
|
-
function
|
|
38460
|
+
function readVersionFromPackageJson(pkgJsonPath) {
|
|
38444
38461
|
try {
|
|
38445
|
-
if (
|
|
38446
|
-
const content =
|
|
38462
|
+
if (fs12.existsSync(pkgJsonPath)) {
|
|
38463
|
+
const content = fs12.readFileSync(pkgJsonPath, "utf-8");
|
|
38447
38464
|
const pkg = JSON.parse(content);
|
|
38448
38465
|
if (pkg.version)
|
|
38449
38466
|
return pkg.version;
|
|
38450
38467
|
}
|
|
38451
38468
|
} catch {}
|
|
38469
|
+
return null;
|
|
38470
|
+
}
|
|
38471
|
+
function getCachedVersion() {
|
|
38472
|
+
const hostVersion = readVersionFromPackageJson(HOST_INSTALLED_PACKAGE_JSON);
|
|
38473
|
+
if (hostVersion)
|
|
38474
|
+
return hostVersion;
|
|
38475
|
+
const configVersion = readVersionFromPackageJson(INSTALLED_PACKAGE_JSON);
|
|
38476
|
+
if (configVersion)
|
|
38477
|
+
return configVersion;
|
|
38452
38478
|
try {
|
|
38453
38479
|
const currentDir = path8.dirname(fileURLToPath2(import.meta.url));
|
|
38454
38480
|
const pkgPath = findPackageJsonUp(currentDir);
|
|
38455
38481
|
if (pkgPath) {
|
|
38456
|
-
const content =
|
|
38482
|
+
const content = fs12.readFileSync(pkgPath, "utf-8");
|
|
38457
38483
|
const pkg = JSON.parse(content);
|
|
38458
38484
|
if (pkg.version)
|
|
38459
38485
|
return pkg.version;
|
|
@@ -38462,10 +38488,10 @@ function getCachedVersion() {
|
|
|
38462
38488
|
log("[auto-update-checker] Failed to resolve version from current directory:", err);
|
|
38463
38489
|
}
|
|
38464
38490
|
try {
|
|
38465
|
-
const execDir = path8.dirname(
|
|
38491
|
+
const execDir = path8.dirname(fs12.realpathSync(process.execPath));
|
|
38466
38492
|
const pkgPath = findPackageJsonUp(execDir);
|
|
38467
38493
|
if (pkgPath) {
|
|
38468
|
-
const content =
|
|
38494
|
+
const content = fs12.readFileSync(pkgPath, "utf-8");
|
|
38469
38495
|
const pkg = JSON.parse(content);
|
|
38470
38496
|
if (pkg.version)
|
|
38471
38497
|
return pkg.version;
|
|
@@ -38477,10 +38503,10 @@ function getCachedVersion() {
|
|
|
38477
38503
|
}
|
|
38478
38504
|
// src/hooks/auto-update-checker/checker/pinned-version-updater.ts
|
|
38479
38505
|
init_logger();
|
|
38480
|
-
import * as
|
|
38506
|
+
import * as fs13 from "fs";
|
|
38481
38507
|
function replacePluginEntry(configPath, oldEntry, newEntry) {
|
|
38482
38508
|
try {
|
|
38483
|
-
const content =
|
|
38509
|
+
const content = fs13.readFileSync(configPath, "utf-8");
|
|
38484
38510
|
const pluginMatch = content.match(/"plugin"\s*:\s*\[/);
|
|
38485
38511
|
if (!pluginMatch || pluginMatch.index === undefined) {
|
|
38486
38512
|
log(`[auto-update-checker] No "plugin" array found in ${configPath}`);
|
|
@@ -38511,7 +38537,7 @@ function replacePluginEntry(configPath, oldEntry, newEntry) {
|
|
|
38511
38537
|
log(`[auto-update-checker] No changes made to ${configPath}`);
|
|
38512
38538
|
return false;
|
|
38513
38539
|
}
|
|
38514
|
-
|
|
38540
|
+
fs13.writeFileSync(configPath, updatedContent, "utf-8");
|
|
38515
38541
|
log(`[auto-update-checker] Updated ${configPath}: ${oldEntry} \u2192 ${newEntry}`);
|
|
38516
38542
|
return true;
|
|
38517
38543
|
} catch (err) {
|
|
@@ -38693,18 +38719,18 @@ async function runBunInstallWithDetails() {
|
|
|
38693
38719
|
init_logger();
|
|
38694
38720
|
|
|
38695
38721
|
// src/hooks/auto-update-checker/cache.ts
|
|
38696
|
-
import * as
|
|
38722
|
+
import * as fs14 from "fs";
|
|
38697
38723
|
import * as path9 from "path";
|
|
38698
38724
|
init_logger();
|
|
38699
38725
|
function stripTrailingCommas(json3) {
|
|
38700
38726
|
return json3.replace(/,(\s*[}\]])/g, "$1");
|
|
38701
38727
|
}
|
|
38702
|
-
function removeFromBunLock(packageName) {
|
|
38703
|
-
const lockPath = path9.join(
|
|
38704
|
-
if (!
|
|
38728
|
+
function removeFromBunLock(dir, packageName) {
|
|
38729
|
+
const lockPath = path9.join(dir, "bun.lock");
|
|
38730
|
+
if (!fs14.existsSync(lockPath))
|
|
38705
38731
|
return false;
|
|
38706
38732
|
try {
|
|
38707
|
-
const content =
|
|
38733
|
+
const content = fs14.readFileSync(lockPath, "utf-8");
|
|
38708
38734
|
const lock = JSON.parse(stripTrailingCommas(content));
|
|
38709
38735
|
let modified = false;
|
|
38710
38736
|
if (lock.workspaces?.[""]?.dependencies?.[packageName]) {
|
|
@@ -38716,38 +38742,55 @@ function removeFromBunLock(packageName) {
|
|
|
38716
38742
|
modified = true;
|
|
38717
38743
|
}
|
|
38718
38744
|
if (modified) {
|
|
38719
|
-
|
|
38720
|
-
log(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
|
|
38745
|
+
fs14.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
|
|
38746
|
+
log(`[auto-update-checker] Removed from bun.lock in ${dir}: ${packageName}`);
|
|
38721
38747
|
}
|
|
38722
38748
|
return modified;
|
|
38723
38749
|
} catch {
|
|
38724
38750
|
return false;
|
|
38725
38751
|
}
|
|
38726
38752
|
}
|
|
38753
|
+
function removeNodeModulesDir(baseDir, packageName) {
|
|
38754
|
+
const pkgDir = path9.join(baseDir, "node_modules", packageName);
|
|
38755
|
+
if (!fs14.existsSync(pkgDir))
|
|
38756
|
+
return false;
|
|
38757
|
+
fs14.rmSync(pkgDir, { recursive: true, force: true });
|
|
38758
|
+
log(`[auto-update-checker] Package removed: ${pkgDir}`);
|
|
38759
|
+
return true;
|
|
38760
|
+
}
|
|
38761
|
+
function removeFromPackageJson(baseDir, packageName) {
|
|
38762
|
+
const pkgJsonPath = path9.join(baseDir, "package.json");
|
|
38763
|
+
if (!fs14.existsSync(pkgJsonPath))
|
|
38764
|
+
return false;
|
|
38765
|
+
try {
|
|
38766
|
+
const content = fs14.readFileSync(pkgJsonPath, "utf-8");
|
|
38767
|
+
const pkgJson = JSON.parse(content);
|
|
38768
|
+
if (pkgJson.dependencies?.[packageName]) {
|
|
38769
|
+
delete pkgJson.dependencies[packageName];
|
|
38770
|
+
fs14.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
38771
|
+
log(`[auto-update-checker] Dependency removed from package.json in ${baseDir}: ${packageName}`);
|
|
38772
|
+
return true;
|
|
38773
|
+
}
|
|
38774
|
+
} catch {}
|
|
38775
|
+
return false;
|
|
38776
|
+
}
|
|
38727
38777
|
function invalidatePackage(packageName = PACKAGE_NAME) {
|
|
38728
38778
|
try {
|
|
38729
|
-
|
|
38730
|
-
const
|
|
38731
|
-
|
|
38732
|
-
|
|
38733
|
-
|
|
38734
|
-
|
|
38735
|
-
|
|
38736
|
-
|
|
38737
|
-
|
|
38738
|
-
|
|
38739
|
-
|
|
38740
|
-
|
|
38741
|
-
|
|
38742
|
-
|
|
38743
|
-
|
|
38744
|
-
fs13.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
38745
|
-
log(`[auto-update-checker] Dependency removed from package.json: ${packageName}`);
|
|
38746
|
-
dependencyRemoved = true;
|
|
38747
|
-
}
|
|
38748
|
-
}
|
|
38749
|
-
lockRemoved = removeFromBunLock(packageName);
|
|
38750
|
-
if (!packageRemoved && !dependencyRemoved && !lockRemoved) {
|
|
38779
|
+
let invalidated = false;
|
|
38780
|
+
const hostRemoved = removeNodeModulesDir(HOST_CACHE_DIR, packageName);
|
|
38781
|
+
const hostPkgJsonRemoved = removeFromPackageJson(HOST_CACHE_DIR, packageName);
|
|
38782
|
+
const hostLockRemoved = removeFromBunLock(HOST_CACHE_DIR, packageName);
|
|
38783
|
+
if (hostRemoved || hostPkgJsonRemoved || hostLockRemoved) {
|
|
38784
|
+
invalidated = true;
|
|
38785
|
+
}
|
|
38786
|
+
if (HOST_CACHE_DIR !== USER_CONFIG_DIR) {
|
|
38787
|
+
const configRemoved = removeNodeModulesDir(USER_CONFIG_DIR, packageName);
|
|
38788
|
+
const configLockRemoved = removeFromBunLock(USER_CONFIG_DIR, packageName);
|
|
38789
|
+
if (configRemoved || configLockRemoved) {
|
|
38790
|
+
invalidated = true;
|
|
38791
|
+
}
|
|
38792
|
+
}
|
|
38793
|
+
if (!invalidated) {
|
|
38751
38794
|
log(`[auto-update-checker] Package not found, nothing to invalidate: ${packageName}`);
|
|
38752
38795
|
return false;
|
|
38753
38796
|
}
|
|
@@ -39010,7 +39053,7 @@ v${latestVersion} available. Restart OpenCode to apply.` : "OpenCode is now on S
|
|
|
39010
39053
|
}
|
|
39011
39054
|
// src/hooks/agent-usage-reminder/storage.ts
|
|
39012
39055
|
import {
|
|
39013
|
-
existsSync as
|
|
39056
|
+
existsSync as existsSync41,
|
|
39014
39057
|
mkdirSync as mkdirSync10,
|
|
39015
39058
|
readFileSync as readFileSync28,
|
|
39016
39059
|
writeFileSync as writeFileSync14,
|
|
@@ -39070,7 +39113,7 @@ function getStoragePath2(sessionID) {
|
|
|
39070
39113
|
}
|
|
39071
39114
|
function loadAgentUsageState(sessionID) {
|
|
39072
39115
|
const filePath = getStoragePath2(sessionID);
|
|
39073
|
-
if (!
|
|
39116
|
+
if (!existsSync41(filePath))
|
|
39074
39117
|
return null;
|
|
39075
39118
|
try {
|
|
39076
39119
|
const content = readFileSync28(filePath, "utf-8");
|
|
@@ -39080,7 +39123,7 @@ function loadAgentUsageState(sessionID) {
|
|
|
39080
39123
|
}
|
|
39081
39124
|
}
|
|
39082
39125
|
function saveAgentUsageState(state3) {
|
|
39083
|
-
if (!
|
|
39126
|
+
if (!existsSync41(AGENT_USAGE_REMINDER_STORAGE)) {
|
|
39084
39127
|
mkdirSync10(AGENT_USAGE_REMINDER_STORAGE, { recursive: true });
|
|
39085
39128
|
}
|
|
39086
39129
|
const filePath = getStoragePath2(state3.sessionID);
|
|
@@ -39088,7 +39131,7 @@ function saveAgentUsageState(state3) {
|
|
|
39088
39131
|
}
|
|
39089
39132
|
function clearAgentUsageState(sessionID) {
|
|
39090
39133
|
const filePath = getStoragePath2(sessionID);
|
|
39091
|
-
if (
|
|
39134
|
+
if (existsSync41(filePath)) {
|
|
39092
39135
|
unlinkSync6(filePath);
|
|
39093
39136
|
}
|
|
39094
39137
|
}
|
|
@@ -40253,7 +40296,7 @@ function createNonInteractiveEnvHook(_ctx) {
|
|
|
40253
40296
|
}
|
|
40254
40297
|
// src/hooks/interactive-bash-session/storage.ts
|
|
40255
40298
|
import {
|
|
40256
|
-
existsSync as
|
|
40299
|
+
existsSync as existsSync42,
|
|
40257
40300
|
mkdirSync as mkdirSync11,
|
|
40258
40301
|
readFileSync as readFileSync29,
|
|
40259
40302
|
writeFileSync as writeFileSync15,
|
|
@@ -40279,7 +40322,7 @@ function getStoragePath3(sessionID) {
|
|
|
40279
40322
|
}
|
|
40280
40323
|
function loadInteractiveBashSessionState(sessionID) {
|
|
40281
40324
|
const filePath = getStoragePath3(sessionID);
|
|
40282
|
-
if (!
|
|
40325
|
+
if (!existsSync42(filePath))
|
|
40283
40326
|
return null;
|
|
40284
40327
|
try {
|
|
40285
40328
|
const content = readFileSync29(filePath, "utf-8");
|
|
@@ -40294,7 +40337,7 @@ function loadInteractiveBashSessionState(sessionID) {
|
|
|
40294
40337
|
}
|
|
40295
40338
|
}
|
|
40296
40339
|
function saveInteractiveBashSessionState(state3) {
|
|
40297
|
-
if (!
|
|
40340
|
+
if (!existsSync42(INTERACTIVE_BASH_SESSION_STORAGE)) {
|
|
40298
40341
|
mkdirSync11(INTERACTIVE_BASH_SESSION_STORAGE, { recursive: true });
|
|
40299
40342
|
}
|
|
40300
40343
|
const filePath = getStoragePath3(state3.sessionID);
|
|
@@ -40307,7 +40350,7 @@ function saveInteractiveBashSessionState(state3) {
|
|
|
40307
40350
|
}
|
|
40308
40351
|
function clearInteractiveBashSessionState(sessionID) {
|
|
40309
40352
|
const filePath = getStoragePath3(sessionID);
|
|
40310
|
-
if (
|
|
40353
|
+
if (existsSync42(filePath)) {
|
|
40311
40354
|
unlinkSync7(filePath);
|
|
40312
40355
|
}
|
|
40313
40356
|
}
|
|
@@ -40703,14 +40746,14 @@ var DEFAULT_STATE_FILE = ".sisyphus/ralph-loop.local.md";
|
|
|
40703
40746
|
var DEFAULT_MAX_ITERATIONS = 100;
|
|
40704
40747
|
var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
40705
40748
|
// src/hooks/ralph-loop/storage.ts
|
|
40706
|
-
import { existsSync as
|
|
40749
|
+
import { existsSync as existsSync43, readFileSync as readFileSync30, writeFileSync as writeFileSync16, unlinkSync as unlinkSync8, mkdirSync as mkdirSync12 } from "fs";
|
|
40707
40750
|
import { dirname as dirname10, join as join50 } from "path";
|
|
40708
40751
|
function getStateFilePath(directory, customPath) {
|
|
40709
40752
|
return customPath ? join50(directory, customPath) : join50(directory, DEFAULT_STATE_FILE);
|
|
40710
40753
|
}
|
|
40711
40754
|
function readState(directory, customPath) {
|
|
40712
40755
|
const filePath = getStateFilePath(directory, customPath);
|
|
40713
|
-
if (!
|
|
40756
|
+
if (!existsSync43(filePath)) {
|
|
40714
40757
|
return null;
|
|
40715
40758
|
}
|
|
40716
40759
|
try {
|
|
@@ -40750,7 +40793,7 @@ function writeState(directory, state3, customPath) {
|
|
|
40750
40793
|
const filePath = getStateFilePath(directory, customPath);
|
|
40751
40794
|
try {
|
|
40752
40795
|
const dir = dirname10(filePath);
|
|
40753
|
-
if (!
|
|
40796
|
+
if (!existsSync43(dir)) {
|
|
40754
40797
|
mkdirSync12(dir, { recursive: true });
|
|
40755
40798
|
}
|
|
40756
40799
|
const sessionIdLine = state3.session_id ? `session_id: "${state3.session_id}"
|
|
@@ -40779,7 +40822,7 @@ ${state3.prompt}
|
|
|
40779
40822
|
function clearState(directory, customPath) {
|
|
40780
40823
|
const filePath = getStateFilePath(directory, customPath);
|
|
40781
40824
|
try {
|
|
40782
|
-
if (
|
|
40825
|
+
if (existsSync43(filePath)) {
|
|
40783
40826
|
unlinkSync8(filePath);
|
|
40784
40827
|
}
|
|
40785
40828
|
return true;
|
|
@@ -40906,7 +40949,7 @@ init_logger();
|
|
|
40906
40949
|
|
|
40907
40950
|
// src/hooks/ralph-loop/completion-promise-detector.ts
|
|
40908
40951
|
init_logger();
|
|
40909
|
-
import { existsSync as
|
|
40952
|
+
import { existsSync as existsSync44, readFileSync as readFileSync31 } from "fs";
|
|
40910
40953
|
|
|
40911
40954
|
// src/hooks/ralph-loop/with-timeout.ts
|
|
40912
40955
|
async function withTimeout(promise2, timeoutMs) {
|
|
@@ -40936,7 +40979,7 @@ function detectCompletionInTranscript(transcriptPath, promise2) {
|
|
|
40936
40979
|
if (!transcriptPath)
|
|
40937
40980
|
return false;
|
|
40938
40981
|
try {
|
|
40939
|
-
if (!
|
|
40982
|
+
if (!existsSync44(transcriptPath))
|
|
40940
40983
|
return false;
|
|
40941
40984
|
const content = readFileSync31(transcriptPath, "utf-8");
|
|
40942
40985
|
const pattern = buildPromisePattern(promise2);
|
|
@@ -41509,7 +41552,7 @@ function findSlashCommandPartIndex(parts) {
|
|
|
41509
41552
|
return -1;
|
|
41510
41553
|
}
|
|
41511
41554
|
// src/hooks/auto-slash-command/executor.ts
|
|
41512
|
-
import { existsSync as
|
|
41555
|
+
import { existsSync as existsSync46, readdirSync as readdirSync12, readFileSync as readFileSync34 } from "fs";
|
|
41513
41556
|
import { join as join56, basename as basename2, dirname as dirname13 } from "path";
|
|
41514
41557
|
// src/features/builtin-commands/templates/init-deep.ts
|
|
41515
41558
|
var INIT_DEEP_TEMPLATE = `# /init-deep
|
|
@@ -42892,11 +42935,11 @@ function deduplicateSkillsByName(skills) {
|
|
|
42892
42935
|
}
|
|
42893
42936
|
|
|
42894
42937
|
// src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
42895
|
-
import { promises as
|
|
42938
|
+
import { promises as fs17 } from "fs";
|
|
42896
42939
|
import { join as join53 } from "path";
|
|
42897
42940
|
|
|
42898
42941
|
// src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
42899
|
-
import { promises as
|
|
42942
|
+
import { promises as fs16 } from "fs";
|
|
42900
42943
|
import { basename } from "path";
|
|
42901
42944
|
|
|
42902
42945
|
// src/shared/skill-path-resolver.ts
|
|
@@ -42917,7 +42960,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
42917
42960
|
}
|
|
42918
42961
|
|
|
42919
42962
|
// src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
42920
|
-
import { promises as
|
|
42963
|
+
import { promises as fs15 } from "fs";
|
|
42921
42964
|
import { join as join52 } from "path";
|
|
42922
42965
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
42923
42966
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
@@ -42936,7 +42979,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
42936
42979
|
async function loadMcpJsonFromDir(skillDir) {
|
|
42937
42980
|
const mcpJsonPath = join52(skillDir, "mcp.json");
|
|
42938
42981
|
try {
|
|
42939
|
-
const content = await
|
|
42982
|
+
const content = await fs15.readFile(mcpJsonPath, "utf-8");
|
|
42940
42983
|
const parsed = JSON.parse(content);
|
|
42941
42984
|
if (parsed && typeof parsed === "object" && "mcpServers" in parsed && parsed.mcpServers) {
|
|
42942
42985
|
return parsed.mcpServers;
|
|
@@ -42957,7 +43000,7 @@ async function loadMcpJsonFromDir(skillDir) {
|
|
|
42957
43000
|
async function loadSkillFromPath(options) {
|
|
42958
43001
|
const namePrefix = options.namePrefix ?? "";
|
|
42959
43002
|
try {
|
|
42960
|
-
const content = await
|
|
43003
|
+
const content = await fs16.readFile(options.skillPath, "utf-8");
|
|
42961
43004
|
const { data, body } = parseFrontmatter(content);
|
|
42962
43005
|
const frontmatterMcp = parseSkillMcpConfigFromFrontmatter(content);
|
|
42963
43006
|
const mcpJsonMcp = await loadMcpJsonFromDir(options.resolvedPath);
|
|
@@ -43018,7 +43061,7 @@ async function loadSkillsFromDir(options) {
|
|
|
43018
43061
|
const namePrefix = options.namePrefix ?? "";
|
|
43019
43062
|
const depth = options.depth ?? 0;
|
|
43020
43063
|
const maxDepth = options.maxDepth ?? 2;
|
|
43021
|
-
const entries = await
|
|
43064
|
+
const entries = await fs17.readdir(options.skillsDir, { withFileTypes: true }).catch(() => []);
|
|
43022
43065
|
const skillMap = new Map;
|
|
43023
43066
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
43024
43067
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
@@ -43028,7 +43071,7 @@ async function loadSkillsFromDir(options) {
|
|
|
43028
43071
|
const dirName = entry.name;
|
|
43029
43072
|
const skillMdPath = join53(resolvedPath, "SKILL.md");
|
|
43030
43073
|
try {
|
|
43031
|
-
await
|
|
43074
|
+
await fs17.access(skillMdPath);
|
|
43032
43075
|
const skill = await loadSkillFromPath({
|
|
43033
43076
|
skillPath: skillMdPath,
|
|
43034
43077
|
resolvedPath,
|
|
@@ -43043,7 +43086,7 @@ async function loadSkillsFromDir(options) {
|
|
|
43043
43086
|
} catch {}
|
|
43044
43087
|
const namedSkillMdPath = join53(resolvedPath, `${dirName}.md`);
|
|
43045
43088
|
try {
|
|
43046
|
-
await
|
|
43089
|
+
await fs17.access(namedSkillMdPath);
|
|
43047
43090
|
const skill = await loadSkillFromPath({
|
|
43048
43091
|
skillPath: namedSkillMdPath,
|
|
43049
43092
|
resolvedPath,
|
|
@@ -43202,7 +43245,7 @@ function builtinToLoadedSkill(builtin) {
|
|
|
43202
43245
|
}
|
|
43203
43246
|
|
|
43204
43247
|
// src/features/opencode-skill-loader/merger/config-skill-entry-loader.ts
|
|
43205
|
-
import { existsSync as
|
|
43248
|
+
import { existsSync as existsSync45, readFileSync as readFileSync32 } from "fs";
|
|
43206
43249
|
import { dirname as dirname11, isAbsolute as isAbsolute4, resolve as resolve5 } from "path";
|
|
43207
43250
|
import { homedir as homedir11 } from "os";
|
|
43208
43251
|
function resolveFilePath5(from, configDir) {
|
|
@@ -43221,7 +43264,7 @@ function resolveFilePath5(from, configDir) {
|
|
|
43221
43264
|
}
|
|
43222
43265
|
function loadSkillFromFile(filePath) {
|
|
43223
43266
|
try {
|
|
43224
|
-
if (!
|
|
43267
|
+
if (!existsSync45(filePath))
|
|
43225
43268
|
return null;
|
|
43226
43269
|
const content = readFileSync32(filePath, "utf-8");
|
|
43227
43270
|
const { data, body } = parseFrontmatter(content);
|
|
@@ -45552,7 +45595,7 @@ async function resolveMultipleSkillsAsync(skillNames, options) {
|
|
|
45552
45595
|
}
|
|
45553
45596
|
// src/features/opencode-skill-loader/config-source-discovery.ts
|
|
45554
45597
|
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
45555
|
-
import { promises as
|
|
45598
|
+
import { promises as fs18 } from "fs";
|
|
45556
45599
|
import { dirname as dirname12, extname, isAbsolute as isAbsolute5, join as join55, relative as relative3 } from "path";
|
|
45557
45600
|
var MAX_RECURSIVE_DEPTH = 10;
|
|
45558
45601
|
function isHttpUrl(path10) {
|
|
@@ -45585,7 +45628,7 @@ async function loadSourcePath(options) {
|
|
|
45585
45628
|
return [];
|
|
45586
45629
|
}
|
|
45587
45630
|
const absolutePath = toAbsolutePath(options.sourcePath, options.configDir);
|
|
45588
|
-
const stat = await
|
|
45631
|
+
const stat = await fs18.stat(absolutePath).catch(() => null);
|
|
45589
45632
|
if (!stat)
|
|
45590
45633
|
return [];
|
|
45591
45634
|
if (stat.isFile()) {
|
|
@@ -45633,7 +45676,7 @@ async function discoverConfigSourceSkills(options) {
|
|
|
45633
45676
|
}
|
|
45634
45677
|
// src/hooks/auto-slash-command/executor.ts
|
|
45635
45678
|
function discoverCommandsFromDir(commandsDir, scope) {
|
|
45636
|
-
if (!
|
|
45679
|
+
if (!existsSync46(commandsDir)) {
|
|
45637
45680
|
return [];
|
|
45638
45681
|
}
|
|
45639
45682
|
const entries = readdirSync12(commandsDir, { withFileTypes: true });
|
|
@@ -45998,14 +46041,14 @@ var NOTEPAD_DIR = "notepads";
|
|
|
45998
46041
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
45999
46042
|
var PROMETHEUS_PLANS_DIR = ".sisyphus/plans";
|
|
46000
46043
|
// src/features/boulder-state/storage.ts
|
|
46001
|
-
import { existsSync as
|
|
46044
|
+
import { existsSync as existsSync47, readFileSync as readFileSync35, writeFileSync as writeFileSync17, mkdirSync as mkdirSync13, readdirSync as readdirSync13 } from "fs";
|
|
46002
46045
|
import { dirname as dirname14, join as join57, basename as basename3 } from "path";
|
|
46003
46046
|
function getBoulderFilePath(directory) {
|
|
46004
46047
|
return join57(directory, BOULDER_DIR, BOULDER_FILE);
|
|
46005
46048
|
}
|
|
46006
46049
|
function readBoulderState(directory) {
|
|
46007
46050
|
const filePath = getBoulderFilePath(directory);
|
|
46008
|
-
if (!
|
|
46051
|
+
if (!existsSync47(filePath)) {
|
|
46009
46052
|
return null;
|
|
46010
46053
|
}
|
|
46011
46054
|
try {
|
|
@@ -46026,7 +46069,7 @@ function writeBoulderState(directory, state3) {
|
|
|
46026
46069
|
const filePath = getBoulderFilePath(directory);
|
|
46027
46070
|
try {
|
|
46028
46071
|
const dir = dirname14(filePath);
|
|
46029
|
-
if (!
|
|
46072
|
+
if (!existsSync47(dir)) {
|
|
46030
46073
|
mkdirSync13(dir, { recursive: true });
|
|
46031
46074
|
}
|
|
46032
46075
|
writeFileSync17(filePath, JSON.stringify(state3, null, 2), "utf-8");
|
|
@@ -46053,7 +46096,7 @@ function appendSessionId(directory, sessionId) {
|
|
|
46053
46096
|
function clearBoulderState(directory) {
|
|
46054
46097
|
const filePath = getBoulderFilePath(directory);
|
|
46055
46098
|
try {
|
|
46056
|
-
if (
|
|
46099
|
+
if (existsSync47(filePath)) {
|
|
46057
46100
|
const { unlinkSync: unlinkSync9 } = __require("fs");
|
|
46058
46101
|
unlinkSync9(filePath);
|
|
46059
46102
|
}
|
|
@@ -46064,7 +46107,7 @@ function clearBoulderState(directory) {
|
|
|
46064
46107
|
}
|
|
46065
46108
|
function findPrometheusPlans(directory) {
|
|
46066
46109
|
const plansDir = join57(directory, PROMETHEUS_PLANS_DIR);
|
|
46067
|
-
if (!
|
|
46110
|
+
if (!existsSync47(plansDir)) {
|
|
46068
46111
|
return [];
|
|
46069
46112
|
}
|
|
46070
46113
|
try {
|
|
@@ -46079,7 +46122,7 @@ function findPrometheusPlans(directory) {
|
|
|
46079
46122
|
}
|
|
46080
46123
|
}
|
|
46081
46124
|
function getPlanProgress(planPath) {
|
|
46082
|
-
if (!
|
|
46125
|
+
if (!existsSync47(planPath)) {
|
|
46083
46126
|
return { total: 0, completed: 0, isComplete: true };
|
|
46084
46127
|
}
|
|
46085
46128
|
try {
|
|
@@ -48038,7 +48081,7 @@ var HOOK_NAME11 = "runtime-fallback";
|
|
|
48038
48081
|
init_logger();
|
|
48039
48082
|
|
|
48040
48083
|
// src/plugin-config.ts
|
|
48041
|
-
import * as
|
|
48084
|
+
import * as fs19 from "fs";
|
|
48042
48085
|
import * as path10 from "path";
|
|
48043
48086
|
|
|
48044
48087
|
// src/config/schema/agent-names.ts
|
|
@@ -48486,8 +48529,8 @@ function parseConfigPartially(rawConfig) {
|
|
|
48486
48529
|
}
|
|
48487
48530
|
function loadConfigFromPath2(configPath, _ctx) {
|
|
48488
48531
|
try {
|
|
48489
|
-
if (
|
|
48490
|
-
const content =
|
|
48532
|
+
if (fs19.existsSync(configPath)) {
|
|
48533
|
+
const content = fs19.readFileSync(configPath, "utf-8");
|
|
48491
48534
|
const rawConfig = parseJsonc(content);
|
|
48492
48535
|
migrateConfigFile(configPath, rawConfig);
|
|
48493
48536
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
@@ -49486,7 +49529,7 @@ function createRuntimeFallbackHook(ctx, options) {
|
|
|
49486
49529
|
};
|
|
49487
49530
|
}
|
|
49488
49531
|
// src/hooks/write-existing-file-guard/hook.ts
|
|
49489
|
-
import { existsSync as
|
|
49532
|
+
import { existsSync as existsSync49, realpathSync as realpathSync4 } from "fs";
|
|
49490
49533
|
import { basename as basename4, dirname as dirname15, isAbsolute as isAbsolute7, join as join59, normalize, relative as relative5, resolve as resolve7 } from "path";
|
|
49491
49534
|
var MAX_TRACKED_SESSIONS = 256;
|
|
49492
49535
|
var MAX_TRACKED_PATHS_PER_SESSION = 1024;
|
|
@@ -49508,7 +49551,7 @@ function isPathInsideDirectory(pathToCheck, directory) {
|
|
|
49508
49551
|
}
|
|
49509
49552
|
function toCanonicalPath(absolutePath) {
|
|
49510
49553
|
let canonicalPath = absolutePath;
|
|
49511
|
-
if (
|
|
49554
|
+
if (existsSync49(absolutePath)) {
|
|
49512
49555
|
try {
|
|
49513
49556
|
canonicalPath = realpathSync4.native(absolutePath);
|
|
49514
49557
|
} catch {
|
|
@@ -49516,7 +49559,7 @@ function toCanonicalPath(absolutePath) {
|
|
|
49516
49559
|
}
|
|
49517
49560
|
} else {
|
|
49518
49561
|
const absoluteDir = dirname15(absolutePath);
|
|
49519
|
-
const resolvedDir =
|
|
49562
|
+
const resolvedDir = existsSync49(absoluteDir) ? realpathSync4.native(absoluteDir) : absoluteDir;
|
|
49520
49563
|
canonicalPath = join59(resolvedDir, basename4(absolutePath));
|
|
49521
49564
|
}
|
|
49522
49565
|
return normalize(canonicalPath);
|
|
@@ -49617,7 +49660,7 @@ function createWriteExistingFileGuardHook(ctx) {
|
|
|
49617
49660
|
return;
|
|
49618
49661
|
}
|
|
49619
49662
|
if (toolName === "read") {
|
|
49620
|
-
if (!
|
|
49663
|
+
if (!existsSync49(resolvedPath) || !input.sessionID) {
|
|
49621
49664
|
return;
|
|
49622
49665
|
}
|
|
49623
49666
|
registerReadPermission(input.sessionID, canonicalPath);
|
|
@@ -49627,7 +49670,7 @@ function createWriteExistingFileGuardHook(ctx) {
|
|
|
49627
49670
|
if (argsRecord && "overwrite" in argsRecord) {
|
|
49628
49671
|
delete argsRecord.overwrite;
|
|
49629
49672
|
}
|
|
49630
|
-
if (!
|
|
49673
|
+
if (!existsSync49(resolvedPath)) {
|
|
49631
49674
|
return;
|
|
49632
49675
|
}
|
|
49633
49676
|
const isSisyphusPath2 = canonicalPath.includes("/.sisyphus/");
|
|
@@ -50701,10 +50744,10 @@ var DEFAULT_MAX_REFERENCES = 200;
|
|
|
50701
50744
|
var DEFAULT_MAX_SYMBOLS = 200;
|
|
50702
50745
|
var DEFAULT_MAX_DIAGNOSTICS = 200;
|
|
50703
50746
|
// src/tools/lsp/server-config-loader.ts
|
|
50704
|
-
import { existsSync as
|
|
50747
|
+
import { existsSync as existsSync50, readFileSync as readFileSync37 } from "fs";
|
|
50705
50748
|
import { join as join60 } from "path";
|
|
50706
50749
|
function loadJsonFile(path11) {
|
|
50707
|
-
if (!
|
|
50750
|
+
if (!existsSync50(path11))
|
|
50708
50751
|
return null;
|
|
50709
50752
|
try {
|
|
50710
50753
|
return parseJsonc(readFileSync37(path11, "utf-8"));
|
|
@@ -50787,14 +50830,14 @@ function getMergedServers() {
|
|
|
50787
50830
|
}
|
|
50788
50831
|
|
|
50789
50832
|
// src/tools/lsp/server-installation.ts
|
|
50790
|
-
import { existsSync as
|
|
50833
|
+
import { existsSync as existsSync51 } from "fs";
|
|
50791
50834
|
import { join as join61 } from "path";
|
|
50792
50835
|
function isServerInstalled(command) {
|
|
50793
50836
|
if (command.length === 0)
|
|
50794
50837
|
return false;
|
|
50795
50838
|
const cmd = command[0];
|
|
50796
50839
|
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
50797
|
-
if (
|
|
50840
|
+
if (existsSync51(cmd))
|
|
50798
50841
|
return true;
|
|
50799
50842
|
}
|
|
50800
50843
|
const isWindows2 = process.platform === "win32";
|
|
@@ -50816,7 +50859,7 @@ function isServerInstalled(command) {
|
|
|
50816
50859
|
const paths = pathEnv.split(pathSeparator);
|
|
50817
50860
|
for (const p of paths) {
|
|
50818
50861
|
for (const suffix of exts) {
|
|
50819
|
-
if (
|
|
50862
|
+
if (existsSync51(join61(p, cmd + suffix))) {
|
|
50820
50863
|
return true;
|
|
50821
50864
|
}
|
|
50822
50865
|
}
|
|
@@ -50832,7 +50875,7 @@ function isServerInstalled(command) {
|
|
|
50832
50875
|
];
|
|
50833
50876
|
for (const base of additionalBases) {
|
|
50834
50877
|
for (const suffix of exts) {
|
|
50835
|
-
if (
|
|
50878
|
+
if (existsSync51(join61(base, cmd + suffix))) {
|
|
50836
50879
|
return true;
|
|
50837
50880
|
}
|
|
50838
50881
|
}
|
|
@@ -50890,13 +50933,13 @@ function getLanguageId(ext) {
|
|
|
50890
50933
|
init_logger();
|
|
50891
50934
|
var {spawn: bunSpawn2 } = globalThis.Bun;
|
|
50892
50935
|
import { spawn as nodeSpawn2 } from "child_process";
|
|
50893
|
-
import { existsSync as
|
|
50936
|
+
import { existsSync as existsSync52, statSync as statSync7 } from "fs";
|
|
50894
50937
|
function shouldUseNodeSpawn() {
|
|
50895
50938
|
return process.platform === "win32";
|
|
50896
50939
|
}
|
|
50897
50940
|
function validateCwd(cwd) {
|
|
50898
50941
|
try {
|
|
50899
|
-
if (!
|
|
50942
|
+
if (!existsSync52(cwd)) {
|
|
50900
50943
|
return { valid: false, error: `Working directory does not exist: ${cwd}` };
|
|
50901
50944
|
}
|
|
50902
50945
|
const stats = statSync7(cwd);
|
|
@@ -51633,17 +51676,17 @@ var lspManager = LSPServerManager.getInstance();
|
|
|
51633
51676
|
// src/tools/lsp/lsp-client-wrapper.ts
|
|
51634
51677
|
import { extname as extname4, resolve as resolve9 } from "path";
|
|
51635
51678
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
51636
|
-
import { existsSync as
|
|
51679
|
+
import { existsSync as existsSync53 } from "fs";
|
|
51637
51680
|
function findWorkspaceRoot(filePath) {
|
|
51638
51681
|
let dir = resolve9(filePath);
|
|
51639
|
-
if (!
|
|
51682
|
+
if (!existsSync53(dir) || !__require("fs").statSync(dir).isDirectory()) {
|
|
51640
51683
|
dir = __require("path").dirname(dir);
|
|
51641
51684
|
}
|
|
51642
51685
|
const markers = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
51643
51686
|
let prevDir = "";
|
|
51644
51687
|
while (dir !== prevDir) {
|
|
51645
51688
|
for (const marker of markers) {
|
|
51646
|
-
if (
|
|
51689
|
+
if (existsSync53(__require("path").join(dir, marker))) {
|
|
51647
51690
|
return dir;
|
|
51648
51691
|
}
|
|
51649
51692
|
}
|
|
@@ -52170,10 +52213,10 @@ var DEFAULT_MAX_MATCHES = 500;
|
|
|
52170
52213
|
// src/tools/ast-grep/sg-cli-path.ts
|
|
52171
52214
|
import { createRequire as createRequire4 } from "module";
|
|
52172
52215
|
import { dirname as dirname16, join as join63 } from "path";
|
|
52173
|
-
import { existsSync as
|
|
52216
|
+
import { existsSync as existsSync55, statSync as statSync8 } from "fs";
|
|
52174
52217
|
|
|
52175
52218
|
// src/tools/ast-grep/downloader.ts
|
|
52176
|
-
import { existsSync as
|
|
52219
|
+
import { existsSync as existsSync54 } from "fs";
|
|
52177
52220
|
import { join as join62 } from "path";
|
|
52178
52221
|
import { homedir as homedir12 } from "os";
|
|
52179
52222
|
import { createRequire as createRequire3 } from "module";
|
|
@@ -52224,7 +52267,7 @@ async function downloadAstGrep(version2 = DEFAULT_VERSION) {
|
|
|
52224
52267
|
const cacheDir = getCacheDir4();
|
|
52225
52268
|
const binaryName = getBinaryName3();
|
|
52226
52269
|
const binaryPath = join62(cacheDir, binaryName);
|
|
52227
|
-
if (
|
|
52270
|
+
if (existsSync54(binaryPath)) {
|
|
52228
52271
|
return binaryPath;
|
|
52229
52272
|
}
|
|
52230
52273
|
const { arch, os: os6 } = platformInfo;
|
|
@@ -52287,7 +52330,7 @@ function findSgCliPathSync() {
|
|
|
52287
52330
|
const cliPackageJsonPath = require2.resolve("@ast-grep/cli/package.json");
|
|
52288
52331
|
const cliDirectory = dirname16(cliPackageJsonPath);
|
|
52289
52332
|
const sgPath = join63(cliDirectory, binaryName);
|
|
52290
|
-
if (
|
|
52333
|
+
if (existsSync55(sgPath) && isValidBinary(sgPath)) {
|
|
52291
52334
|
return sgPath;
|
|
52292
52335
|
}
|
|
52293
52336
|
} catch {}
|
|
@@ -52299,7 +52342,7 @@ function findSgCliPathSync() {
|
|
|
52299
52342
|
const packageDirectory = dirname16(packageJsonPath);
|
|
52300
52343
|
const astGrepBinaryName = process.platform === "win32" ? "ast-grep.exe" : "ast-grep";
|
|
52301
52344
|
const binaryPath = join63(packageDirectory, astGrepBinaryName);
|
|
52302
|
-
if (
|
|
52345
|
+
if (existsSync55(binaryPath) && isValidBinary(binaryPath)) {
|
|
52303
52346
|
return binaryPath;
|
|
52304
52347
|
}
|
|
52305
52348
|
} catch {}
|
|
@@ -52307,7 +52350,7 @@ function findSgCliPathSync() {
|
|
|
52307
52350
|
if (process.platform === "darwin") {
|
|
52308
52351
|
const homebrewPaths = ["/opt/homebrew/bin/sg", "/usr/local/bin/sg"];
|
|
52309
52352
|
for (const path11 of homebrewPaths) {
|
|
52310
|
-
if (
|
|
52353
|
+
if (existsSync55(path11) && isValidBinary(path11)) {
|
|
52311
52354
|
return path11;
|
|
52312
52355
|
}
|
|
52313
52356
|
}
|
|
@@ -52331,14 +52374,14 @@ function setSgCliPath(path11) {
|
|
|
52331
52374
|
}
|
|
52332
52375
|
// src/tools/ast-grep/cli.ts
|
|
52333
52376
|
var {spawn: spawn10 } = globalThis.Bun;
|
|
52334
|
-
import { existsSync as
|
|
52377
|
+
import { existsSync as existsSync57 } from "fs";
|
|
52335
52378
|
|
|
52336
52379
|
// src/tools/ast-grep/cli-binary-path-resolution.ts
|
|
52337
|
-
import { existsSync as
|
|
52380
|
+
import { existsSync as existsSync56 } from "fs";
|
|
52338
52381
|
var resolvedCliPath3 = null;
|
|
52339
52382
|
var initPromise3 = null;
|
|
52340
52383
|
async function getAstGrepPath() {
|
|
52341
|
-
if (resolvedCliPath3 !== null &&
|
|
52384
|
+
if (resolvedCliPath3 !== null && existsSync56(resolvedCliPath3)) {
|
|
52342
52385
|
return resolvedCliPath3;
|
|
52343
52386
|
}
|
|
52344
52387
|
if (initPromise3) {
|
|
@@ -52346,7 +52389,7 @@ async function getAstGrepPath() {
|
|
|
52346
52389
|
}
|
|
52347
52390
|
initPromise3 = (async () => {
|
|
52348
52391
|
const syncPath = findSgCliPathSync();
|
|
52349
|
-
if (syncPath &&
|
|
52392
|
+
if (syncPath && existsSync56(syncPath)) {
|
|
52350
52393
|
resolvedCliPath3 = syncPath;
|
|
52351
52394
|
setSgCliPath(syncPath);
|
|
52352
52395
|
return syncPath;
|
|
@@ -52445,7 +52488,7 @@ async function runSg(options) {
|
|
|
52445
52488
|
const paths = options.paths && options.paths.length > 0 ? options.paths : ["."];
|
|
52446
52489
|
args.push(...paths);
|
|
52447
52490
|
let cliPath = getSgCliPath();
|
|
52448
|
-
if (!cliPath || !
|
|
52491
|
+
if (!cliPath || !existsSync57(cliPath)) {
|
|
52449
52492
|
const downloadedPath = await getAstGrepPath();
|
|
52450
52493
|
if (downloadedPath) {
|
|
52451
52494
|
cliPath = downloadedPath;
|
|
@@ -52699,12 +52742,12 @@ import { resolve as resolve10 } from "path";
|
|
|
52699
52742
|
var {spawn: spawn11 } = globalThis.Bun;
|
|
52700
52743
|
|
|
52701
52744
|
// src/tools/grep/constants.ts
|
|
52702
|
-
import { existsSync as
|
|
52745
|
+
import { existsSync as existsSync59 } from "fs";
|
|
52703
52746
|
import { join as join65, dirname as dirname17 } from "path";
|
|
52704
52747
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
52705
52748
|
|
|
52706
52749
|
// src/tools/grep/downloader.ts
|
|
52707
|
-
import { existsSync as
|
|
52750
|
+
import { existsSync as existsSync58, readdirSync as readdirSync14 } from "fs";
|
|
52708
52751
|
import { join as join64 } from "path";
|
|
52709
52752
|
function findFileRecursive(dir, filename) {
|
|
52710
52753
|
try {
|
|
@@ -52768,7 +52811,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
52768
52811
|
}
|
|
52769
52812
|
const installDir = getInstallDir();
|
|
52770
52813
|
const rgPath = getRgPath();
|
|
52771
|
-
if (
|
|
52814
|
+
if (existsSync58(rgPath)) {
|
|
52772
52815
|
return rgPath;
|
|
52773
52816
|
}
|
|
52774
52817
|
ensureCacheDir(installDir);
|
|
@@ -52783,7 +52826,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
52783
52826
|
await extractZip2(archivePath, installDir);
|
|
52784
52827
|
}
|
|
52785
52828
|
ensureExecutable(rgPath);
|
|
52786
|
-
if (!
|
|
52829
|
+
if (!existsSync58(rgPath)) {
|
|
52787
52830
|
throw new Error("ripgrep binary not found after extraction");
|
|
52788
52831
|
}
|
|
52789
52832
|
return rgPath;
|
|
@@ -52795,7 +52838,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
52795
52838
|
}
|
|
52796
52839
|
function getInstalledRipgrepPath() {
|
|
52797
52840
|
const rgPath = getRgPath();
|
|
52798
|
-
return
|
|
52841
|
+
return existsSync58(rgPath) ? rgPath : null;
|
|
52799
52842
|
}
|
|
52800
52843
|
|
|
52801
52844
|
// src/tools/grep/constants.ts
|
|
@@ -52826,7 +52869,7 @@ function getOpenCodeBundledRg() {
|
|
|
52826
52869
|
join65(execDir, "..", "libexec", rgName)
|
|
52827
52870
|
];
|
|
52828
52871
|
for (const candidate of candidates) {
|
|
52829
|
-
if (
|
|
52872
|
+
if (existsSync59(candidate)) {
|
|
52830
52873
|
return candidate;
|
|
52831
52874
|
}
|
|
52832
52875
|
}
|
|
@@ -53465,10 +53508,10 @@ Use this when a task matches an available skill's or command's description.
|
|
|
53465
53508
|
// src/tools/skill/tools.ts
|
|
53466
53509
|
import { dirname as dirname19 } from "path";
|
|
53467
53510
|
// src/tools/slashcommand/command-discovery.ts
|
|
53468
|
-
import { existsSync as
|
|
53511
|
+
import { existsSync as existsSync60, readdirSync as readdirSync15, readFileSync as readFileSync40 } from "fs";
|
|
53469
53512
|
import { basename as basename5, join as join66 } from "path";
|
|
53470
53513
|
function discoverCommandsFromDir2(commandsDir, scope) {
|
|
53471
|
-
if (!
|
|
53514
|
+
if (!existsSync60(commandsDir))
|
|
53472
53515
|
return [];
|
|
53473
53516
|
const entries = readdirSync15(commandsDir, { withFileTypes: true });
|
|
53474
53517
|
const commands3 = [];
|
|
@@ -53912,7 +53955,7 @@ Has Todos: Yes (12 items, 8 completed)
|
|
|
53912
53955
|
Has Transcript: Yes (234 entries)`;
|
|
53913
53956
|
|
|
53914
53957
|
// src/tools/session-manager/storage.ts
|
|
53915
|
-
import { existsSync as
|
|
53958
|
+
import { existsSync as existsSync61 } from "fs";
|
|
53916
53959
|
import { readdir, readFile } from "fs/promises";
|
|
53917
53960
|
import { join as join68 } from "path";
|
|
53918
53961
|
var sdkClient = null;
|
|
@@ -53933,7 +53976,7 @@ async function getMainSessions(options) {
|
|
|
53933
53976
|
return [];
|
|
53934
53977
|
}
|
|
53935
53978
|
}
|
|
53936
|
-
if (!
|
|
53979
|
+
if (!existsSync61(SESSION_STORAGE))
|
|
53937
53980
|
return [];
|
|
53938
53981
|
const sessions = [];
|
|
53939
53982
|
try {
|
|
@@ -53974,7 +54017,7 @@ async function getAllSessions() {
|
|
|
53974
54017
|
return [];
|
|
53975
54018
|
}
|
|
53976
54019
|
}
|
|
53977
|
-
if (!
|
|
54020
|
+
if (!existsSync61(MESSAGE_STORAGE))
|
|
53978
54021
|
return [];
|
|
53979
54022
|
const sessions = [];
|
|
53980
54023
|
async function scanDirectory(dir) {
|
|
@@ -54043,7 +54086,7 @@ async function readSessionMessages(sessionID) {
|
|
|
54043
54086
|
}
|
|
54044
54087
|
}
|
|
54045
54088
|
const messageDir = getMessageDir(sessionID);
|
|
54046
|
-
if (!messageDir || !
|
|
54089
|
+
if (!messageDir || !existsSync61(messageDir))
|
|
54047
54090
|
return [];
|
|
54048
54091
|
const messages = [];
|
|
54049
54092
|
try {
|
|
@@ -54079,7 +54122,7 @@ async function readSessionMessages(sessionID) {
|
|
|
54079
54122
|
}
|
|
54080
54123
|
async function readParts2(messageID) {
|
|
54081
54124
|
const partDir = join68(PART_STORAGE, messageID);
|
|
54082
|
-
if (!
|
|
54125
|
+
if (!existsSync61(partDir))
|
|
54083
54126
|
return [];
|
|
54084
54127
|
const parts = [];
|
|
54085
54128
|
try {
|
|
@@ -54114,7 +54157,7 @@ async function readSessionTodos(sessionID) {
|
|
|
54114
54157
|
return [];
|
|
54115
54158
|
}
|
|
54116
54159
|
}
|
|
54117
|
-
if (!
|
|
54160
|
+
if (!existsSync61(TODO_DIR2))
|
|
54118
54161
|
return [];
|
|
54119
54162
|
try {
|
|
54120
54163
|
const allFiles = await readdir(TODO_DIR2);
|
|
@@ -54141,10 +54184,10 @@ async function readSessionTodos(sessionID) {
|
|
|
54141
54184
|
return [];
|
|
54142
54185
|
}
|
|
54143
54186
|
async function readSessionTranscript(sessionID) {
|
|
54144
|
-
if (!
|
|
54187
|
+
if (!existsSync61(TRANSCRIPT_DIR2))
|
|
54145
54188
|
return 0;
|
|
54146
54189
|
const transcriptFile = join68(TRANSCRIPT_DIR2, `${sessionID}.jsonl`);
|
|
54147
|
-
if (!
|
|
54190
|
+
if (!existsSync61(transcriptFile))
|
|
54148
54191
|
return 0;
|
|
54149
54192
|
try {
|
|
54150
54193
|
const content = await readFile(transcriptFile, "utf-8");
|
|
@@ -57567,7 +57610,7 @@ var TaskDeleteInputSchema = exports_external.object({
|
|
|
57567
57610
|
|
|
57568
57611
|
// src/features/claude-tasks/storage.ts
|
|
57569
57612
|
import { join as join69, dirname as dirname20, basename as basename7, isAbsolute as isAbsolute8 } from "path";
|
|
57570
|
-
import { existsSync as
|
|
57613
|
+
import { existsSync as existsSync62, mkdirSync as mkdirSync14, readFileSync as readFileSync41, writeFileSync as writeFileSync19, renameSync, unlinkSync as unlinkSync9, readdirSync as readdirSync16 } from "fs";
|
|
57571
57614
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
57572
57615
|
function getTaskDir(config3 = {}) {
|
|
57573
57616
|
const tasksConfig = config3.sisyphus?.tasks;
|
|
@@ -57595,13 +57638,13 @@ function resolveTaskListId(config3 = {}) {
|
|
|
57595
57638
|
return sanitizePathSegment(basename7(process.cwd()));
|
|
57596
57639
|
}
|
|
57597
57640
|
function ensureDir(dirPath) {
|
|
57598
|
-
if (!
|
|
57641
|
+
if (!existsSync62(dirPath)) {
|
|
57599
57642
|
mkdirSync14(dirPath, { recursive: true });
|
|
57600
57643
|
}
|
|
57601
57644
|
}
|
|
57602
57645
|
function readJsonSafe(filePath, schema2) {
|
|
57603
57646
|
try {
|
|
57604
|
-
if (!
|
|
57647
|
+
if (!existsSync62(filePath)) {
|
|
57605
57648
|
return null;
|
|
57606
57649
|
}
|
|
57607
57650
|
const content = readFileSync41(filePath, "utf-8");
|
|
@@ -57624,7 +57667,7 @@ function writeJsonAtomic(filePath, data) {
|
|
|
57624
57667
|
renameSync(tempPath, filePath);
|
|
57625
57668
|
} catch (error45) {
|
|
57626
57669
|
try {
|
|
57627
|
-
if (
|
|
57670
|
+
if (existsSync62(tempPath)) {
|
|
57628
57671
|
unlinkSync9(tempPath);
|
|
57629
57672
|
}
|
|
57630
57673
|
} catch {}
|
|
@@ -57684,7 +57727,7 @@ function acquireLock(dirPath) {
|
|
|
57684
57727
|
acquired: true,
|
|
57685
57728
|
release: () => {
|
|
57686
57729
|
try {
|
|
57687
|
-
if (!
|
|
57730
|
+
if (!existsSync62(lockPath))
|
|
57688
57731
|
return;
|
|
57689
57732
|
const lockContent = readFileSync41(lockPath, "utf-8");
|
|
57690
57733
|
const lockData = JSON.parse(lockContent);
|
|
@@ -57910,7 +57953,7 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
57910
57953
|
}
|
|
57911
57954
|
// src/tools/task/task-list.ts
|
|
57912
57955
|
import { join as join72 } from "path";
|
|
57913
|
-
import { existsSync as
|
|
57956
|
+
import { existsSync as existsSync63, readdirSync as readdirSync17 } from "fs";
|
|
57914
57957
|
function createTaskList(config3) {
|
|
57915
57958
|
return tool({
|
|
57916
57959
|
description: `List all active tasks with summary information.
|
|
@@ -57921,7 +57964,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
57921
57964
|
args: {},
|
|
57922
57965
|
execute: async () => {
|
|
57923
57966
|
const taskDir = getTaskDir(config3);
|
|
57924
|
-
if (!
|
|
57967
|
+
if (!existsSync63(taskDir)) {
|
|
57925
57968
|
return JSON.stringify({ tasks: [] });
|
|
57926
57969
|
}
|
|
57927
57970
|
const files = readdirSync17(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
|
|
@@ -65676,7 +65719,7 @@ class StreamableHTTPClientTransport {
|
|
|
65676
65719
|
}
|
|
65677
65720
|
|
|
65678
65721
|
// src/features/mcp-oauth/storage.ts
|
|
65679
|
-
import { chmodSync as chmodSync2, existsSync as
|
|
65722
|
+
import { chmodSync as chmodSync2, existsSync as existsSync64, mkdirSync as mkdirSync15, readFileSync as readFileSync43, unlinkSync as unlinkSync10, writeFileSync as writeFileSync20 } from "fs";
|
|
65680
65723
|
import { dirname as dirname21, join as join76 } from "path";
|
|
65681
65724
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
65682
65725
|
function getMcpOauthStoragePath() {
|
|
@@ -65717,7 +65760,7 @@ function buildKey(serverHost, resource) {
|
|
|
65717
65760
|
}
|
|
65718
65761
|
function readStore() {
|
|
65719
65762
|
const filePath = getMcpOauthStoragePath();
|
|
65720
|
-
if (!
|
|
65763
|
+
if (!existsSync64(filePath)) {
|
|
65721
65764
|
return null;
|
|
65722
65765
|
}
|
|
65723
65766
|
try {
|
|
@@ -65731,7 +65774,7 @@ function writeStore(store2) {
|
|
|
65731
65774
|
const filePath = getMcpOauthStoragePath();
|
|
65732
65775
|
try {
|
|
65733
65776
|
const dir = dirname21(filePath);
|
|
65734
|
-
if (!
|
|
65777
|
+
if (!existsSync64(dir)) {
|
|
65735
65778
|
mkdirSync15(dir, { recursive: true });
|
|
65736
65779
|
}
|
|
65737
65780
|
writeFileSync20(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -71895,7 +71938,7 @@ function buildAgent(source, model, categories2, gitMasterConfig, browserProvider
|
|
|
71895
71938
|
}
|
|
71896
71939
|
|
|
71897
71940
|
// src/agents/builtin-agents/resolve-file-uri.ts
|
|
71898
|
-
import { existsSync as
|
|
71941
|
+
import { existsSync as existsSync65, readFileSync as readFileSync44 } from "fs";
|
|
71899
71942
|
import { homedir as homedir13 } from "os";
|
|
71900
71943
|
import { isAbsolute as isAbsolute9, resolve as resolve13 } from "path";
|
|
71901
71944
|
function resolvePromptAppend(promptAppend, configDir) {
|
|
@@ -71910,7 +71953,7 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
71910
71953
|
} catch {
|
|
71911
71954
|
return `[WARNING: Malformed file URI (invalid percent-encoding): ${promptAppend}]`;
|
|
71912
71955
|
}
|
|
71913
|
-
if (!
|
|
71956
|
+
if (!existsSync65(filePath)) {
|
|
71914
71957
|
return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
|
|
71915
71958
|
}
|
|
71916
71959
|
try {
|
|
@@ -72935,7 +72978,7 @@ function createSisyphusJuniorAgentWithOverrides(override, systemDefaultModel, us
|
|
|
72935
72978
|
}
|
|
72936
72979
|
createSisyphusJuniorAgentWithOverrides.mode = MODE10;
|
|
72937
72980
|
// src/features/claude-code-agent-loader/loader.ts
|
|
72938
|
-
import { existsSync as
|
|
72981
|
+
import { existsSync as existsSync66, readdirSync as readdirSync19, readFileSync as readFileSync45 } from "fs";
|
|
72939
72982
|
import { join as join77, basename as basename8 } from "path";
|
|
72940
72983
|
function parseToolsConfig(toolsStr) {
|
|
72941
72984
|
if (!toolsStr)
|
|
@@ -72950,7 +72993,7 @@ function parseToolsConfig(toolsStr) {
|
|
|
72950
72993
|
return result;
|
|
72951
72994
|
}
|
|
72952
72995
|
function loadAgentsFromDir(agentsDir, scope) {
|
|
72953
|
-
if (!
|
|
72996
|
+
if (!existsSync66(agentsDir)) {
|
|
72954
72997
|
return [];
|
|
72955
72998
|
}
|
|
72956
72999
|
const entries = readdirSync19(agentsDir, { withFileTypes: true });
|
|
@@ -75397,6 +75440,12 @@ async function applyAgentConfig(params) {
|
|
|
75397
75440
|
};
|
|
75398
75441
|
}
|
|
75399
75442
|
if (params.config.agent) {
|
|
75443
|
+
const allAgents = params.config.agent;
|
|
75444
|
+
for (const [name, config3] of Object.entries(allAgents)) {
|
|
75445
|
+
if (config3 && typeof config3.prompt === "string" && config3.prompt.length > 0) {
|
|
75446
|
+
allAgents[name] = { ...config3, prompt: patchAgentPrompt(config3.prompt) };
|
|
75447
|
+
}
|
|
75448
|
+
}
|
|
75400
75449
|
params.config.agent = remapAgentKeysToDisplayNames(params.config.agent);
|
|
75401
75450
|
params.config.agent = reorderAgentsByPriority(params.config.agent);
|
|
75402
75451
|
}
|
|
@@ -75405,18 +75454,18 @@ async function applyAgentConfig(params) {
|
|
|
75405
75454
|
return agentResult;
|
|
75406
75455
|
}
|
|
75407
75456
|
// src/features/claude-code-command-loader/loader.ts
|
|
75408
|
-
import { promises as
|
|
75457
|
+
import { promises as fs20 } from "fs";
|
|
75409
75458
|
import { join as join78, basename as basename9 } from "path";
|
|
75410
75459
|
init_logger();
|
|
75411
75460
|
async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix = "") {
|
|
75412
75461
|
try {
|
|
75413
|
-
await
|
|
75462
|
+
await fs20.access(commandsDir);
|
|
75414
75463
|
} catch {
|
|
75415
75464
|
return [];
|
|
75416
75465
|
}
|
|
75417
75466
|
let realPath;
|
|
75418
75467
|
try {
|
|
75419
|
-
realPath = await
|
|
75468
|
+
realPath = await fs20.realpath(commandsDir);
|
|
75420
75469
|
} catch (error45) {
|
|
75421
75470
|
log(`Failed to resolve command directory: ${commandsDir}`, error45);
|
|
75422
75471
|
return [];
|
|
@@ -75427,7 +75476,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
75427
75476
|
visited.add(realPath);
|
|
75428
75477
|
let entries;
|
|
75429
75478
|
try {
|
|
75430
|
-
entries = await
|
|
75479
|
+
entries = await fs20.readdir(commandsDir, { withFileTypes: true });
|
|
75431
75480
|
} catch (error45) {
|
|
75432
75481
|
log(`Failed to read command directory: ${commandsDir}`, error45);
|
|
75433
75482
|
return [];
|
|
@@ -75449,7 +75498,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
75449
75498
|
const baseCommandName = basename9(entry.name, ".md");
|
|
75450
75499
|
const commandName = prefix ? `${prefix}:${baseCommandName}` : baseCommandName;
|
|
75451
75500
|
try {
|
|
75452
|
-
const content = await
|
|
75501
|
+
const content = await fs20.readFile(commandPath, "utf-8");
|
|
75453
75502
|
const { data, body } = parseFrontmatter(content);
|
|
75454
75503
|
const wrappedTemplate = `<command-instruction>
|
|
75455
75504
|
${body.trim()}
|
|
@@ -75567,7 +75616,7 @@ function remapCommandAgentFields(commands3) {
|
|
|
75567
75616
|
}
|
|
75568
75617
|
}
|
|
75569
75618
|
// src/features/claude-code-mcp-loader/loader.ts
|
|
75570
|
-
import { existsSync as
|
|
75619
|
+
import { existsSync as existsSync67, readFileSync as readFileSync46 } from "fs";
|
|
75571
75620
|
import { join as join79 } from "path";
|
|
75572
75621
|
import { homedir as homedir14 } from "os";
|
|
75573
75622
|
|
|
@@ -75617,7 +75666,7 @@ function getMcpConfigPaths() {
|
|
|
75617
75666
|
];
|
|
75618
75667
|
}
|
|
75619
75668
|
async function loadMcpConfigFile(filePath) {
|
|
75620
|
-
if (!
|
|
75669
|
+
if (!existsSync67(filePath)) {
|
|
75621
75670
|
return null;
|
|
75622
75671
|
}
|
|
75623
75672
|
try {
|
|
@@ -75632,7 +75681,7 @@ function getSystemMcpServerNames() {
|
|
|
75632
75681
|
const names = new Set;
|
|
75633
75682
|
const paths = getMcpConfigPaths();
|
|
75634
75683
|
for (const { path: path11 } of paths) {
|
|
75635
|
-
if (!
|
|
75684
|
+
if (!existsSync67(path11))
|
|
75636
75685
|
continue;
|
|
75637
75686
|
try {
|
|
75638
75687
|
const content = readFileSync46(path11, "utf-8");
|
|
@@ -75809,7 +75858,7 @@ init_logger();
|
|
|
75809
75858
|
|
|
75810
75859
|
// src/features/claude-code-plugin-loader/discovery.ts
|
|
75811
75860
|
init_logger();
|
|
75812
|
-
import { existsSync as
|
|
75861
|
+
import { existsSync as existsSync68, readFileSync as readFileSync47 } from "fs";
|
|
75813
75862
|
import { homedir as homedir15 } from "os";
|
|
75814
75863
|
import { join as join80 } from "path";
|
|
75815
75864
|
function getPluginsBaseDir() {
|
|
@@ -75823,7 +75872,7 @@ function getInstalledPluginsPath() {
|
|
|
75823
75872
|
}
|
|
75824
75873
|
function loadInstalledPlugins() {
|
|
75825
75874
|
const dbPath = getInstalledPluginsPath();
|
|
75826
|
-
if (!
|
|
75875
|
+
if (!existsSync68(dbPath)) {
|
|
75827
75876
|
return null;
|
|
75828
75877
|
}
|
|
75829
75878
|
try {
|
|
@@ -75842,7 +75891,7 @@ function getClaudeSettingsPath() {
|
|
|
75842
75891
|
}
|
|
75843
75892
|
function loadClaudeSettings() {
|
|
75844
75893
|
const settingsPath = getClaudeSettingsPath();
|
|
75845
|
-
if (!
|
|
75894
|
+
if (!existsSync68(settingsPath)) {
|
|
75846
75895
|
return null;
|
|
75847
75896
|
}
|
|
75848
75897
|
try {
|
|
@@ -75855,7 +75904,7 @@ function loadClaudeSettings() {
|
|
|
75855
75904
|
}
|
|
75856
75905
|
function loadPluginManifest(installPath) {
|
|
75857
75906
|
const manifestPath = join80(installPath, ".claude-plugin", "plugin.json");
|
|
75858
|
-
if (!
|
|
75907
|
+
if (!existsSync68(manifestPath)) {
|
|
75859
75908
|
return null;
|
|
75860
75909
|
}
|
|
75861
75910
|
try {
|
|
@@ -75903,7 +75952,7 @@ function discoverInstalledPlugins(options) {
|
|
|
75903
75952
|
continue;
|
|
75904
75953
|
}
|
|
75905
75954
|
const { installPath, scope, version: version2 } = installation;
|
|
75906
|
-
if (!
|
|
75955
|
+
if (!existsSync68(installPath)) {
|
|
75907
75956
|
errors3.push({
|
|
75908
75957
|
pluginKey,
|
|
75909
75958
|
installPath,
|
|
@@ -75921,21 +75970,21 @@ function discoverInstalledPlugins(options) {
|
|
|
75921
75970
|
pluginKey,
|
|
75922
75971
|
manifest: manifest ?? undefined
|
|
75923
75972
|
};
|
|
75924
|
-
if (
|
|
75973
|
+
if (existsSync68(join80(installPath, "commands"))) {
|
|
75925
75974
|
loadedPlugin.commandsDir = join80(installPath, "commands");
|
|
75926
75975
|
}
|
|
75927
|
-
if (
|
|
75976
|
+
if (existsSync68(join80(installPath, "agents"))) {
|
|
75928
75977
|
loadedPlugin.agentsDir = join80(installPath, "agents");
|
|
75929
75978
|
}
|
|
75930
|
-
if (
|
|
75979
|
+
if (existsSync68(join80(installPath, "skills"))) {
|
|
75931
75980
|
loadedPlugin.skillsDir = join80(installPath, "skills");
|
|
75932
75981
|
}
|
|
75933
75982
|
const hooksPath = join80(installPath, "hooks", "hooks.json");
|
|
75934
|
-
if (
|
|
75983
|
+
if (existsSync68(hooksPath)) {
|
|
75935
75984
|
loadedPlugin.hooksPath = hooksPath;
|
|
75936
75985
|
}
|
|
75937
75986
|
const mcpPath = join80(installPath, ".mcp.json");
|
|
75938
|
-
if (
|
|
75987
|
+
if (existsSync68(mcpPath)) {
|
|
75939
75988
|
loadedPlugin.mcpPath = mcpPath;
|
|
75940
75989
|
}
|
|
75941
75990
|
plugins.push(loadedPlugin);
|
|
@@ -75948,13 +75997,13 @@ function discoverInstalledPlugins(options) {
|
|
|
75948
75997
|
}
|
|
75949
75998
|
|
|
75950
75999
|
// src/features/claude-code-plugin-loader/command-loader.ts
|
|
75951
|
-
import { existsSync as
|
|
76000
|
+
import { existsSync as existsSync69, readdirSync as readdirSync20, readFileSync as readFileSync48 } from "fs";
|
|
75952
76001
|
import { basename as basename10, join as join81 } from "path";
|
|
75953
76002
|
init_logger();
|
|
75954
76003
|
function loadPluginCommands(plugins) {
|
|
75955
76004
|
const commands3 = {};
|
|
75956
76005
|
for (const plugin of plugins) {
|
|
75957
|
-
if (!plugin.commandsDir || !
|
|
76006
|
+
if (!plugin.commandsDir || !existsSync69(plugin.commandsDir))
|
|
75958
76007
|
continue;
|
|
75959
76008
|
const entries = readdirSync20(plugin.commandsDir, { withFileTypes: true });
|
|
75960
76009
|
for (const entry of entries) {
|
|
@@ -75995,13 +76044,13 @@ $ARGUMENTS
|
|
|
75995
76044
|
}
|
|
75996
76045
|
|
|
75997
76046
|
// src/features/claude-code-plugin-loader/skill-loader.ts
|
|
75998
|
-
import { existsSync as
|
|
76047
|
+
import { existsSync as existsSync70, readdirSync as readdirSync21, readFileSync as readFileSync49 } from "fs";
|
|
75999
76048
|
import { join as join82 } from "path";
|
|
76000
76049
|
init_logger();
|
|
76001
76050
|
function loadPluginSkillsAsCommands(plugins) {
|
|
76002
76051
|
const skills2 = {};
|
|
76003
76052
|
for (const plugin of plugins) {
|
|
76004
|
-
if (!plugin.skillsDir || !
|
|
76053
|
+
if (!plugin.skillsDir || !existsSync70(plugin.skillsDir))
|
|
76005
76054
|
continue;
|
|
76006
76055
|
const entries = readdirSync21(plugin.skillsDir, { withFileTypes: true });
|
|
76007
76056
|
for (const entry of entries) {
|
|
@@ -76012,7 +76061,7 @@ function loadPluginSkillsAsCommands(plugins) {
|
|
|
76012
76061
|
continue;
|
|
76013
76062
|
const resolvedPath = resolveSymlink(skillPath);
|
|
76014
76063
|
const skillMdPath = join82(resolvedPath, "SKILL.md");
|
|
76015
|
-
if (!
|
|
76064
|
+
if (!existsSync70(skillMdPath))
|
|
76016
76065
|
continue;
|
|
76017
76066
|
try {
|
|
76018
76067
|
const content = readFileSync49(skillMdPath, "utf-8");
|
|
@@ -76050,7 +76099,7 @@ $ARGUMENTS
|
|
|
76050
76099
|
}
|
|
76051
76100
|
|
|
76052
76101
|
// src/features/claude-code-plugin-loader/agent-loader.ts
|
|
76053
|
-
import { existsSync as
|
|
76102
|
+
import { existsSync as existsSync71, readdirSync as readdirSync22, readFileSync as readFileSync50 } from "fs";
|
|
76054
76103
|
import { basename as basename11, join as join83 } from "path";
|
|
76055
76104
|
init_logger();
|
|
76056
76105
|
function parseToolsConfig2(toolsStr) {
|
|
@@ -76068,7 +76117,7 @@ function parseToolsConfig2(toolsStr) {
|
|
|
76068
76117
|
function loadPluginAgents(plugins) {
|
|
76069
76118
|
const agents = {};
|
|
76070
76119
|
for (const plugin of plugins) {
|
|
76071
|
-
if (!plugin.agentsDir || !
|
|
76120
|
+
if (!plugin.agentsDir || !existsSync71(plugin.agentsDir))
|
|
76072
76121
|
continue;
|
|
76073
76122
|
const entries = readdirSync22(plugin.agentsDir, { withFileTypes: true });
|
|
76074
76123
|
for (const entry of entries) {
|
|
@@ -76102,7 +76151,7 @@ function loadPluginAgents(plugins) {
|
|
|
76102
76151
|
}
|
|
76103
76152
|
|
|
76104
76153
|
// src/features/claude-code-plugin-loader/mcp-server-loader.ts
|
|
76105
|
-
import { existsSync as
|
|
76154
|
+
import { existsSync as existsSync72 } from "fs";
|
|
76106
76155
|
init_logger();
|
|
76107
76156
|
|
|
76108
76157
|
// src/features/claude-code-plugin-loader/plugin-path-resolver.ts
|
|
@@ -76133,7 +76182,7 @@ function resolvePluginPaths(obj, pluginRoot) {
|
|
|
76133
76182
|
async function loadPluginMcpServers(plugins) {
|
|
76134
76183
|
const servers = {};
|
|
76135
76184
|
for (const plugin of plugins) {
|
|
76136
|
-
if (!plugin.mcpPath || !
|
|
76185
|
+
if (!plugin.mcpPath || !existsSync72(plugin.mcpPath))
|
|
76137
76186
|
continue;
|
|
76138
76187
|
try {
|
|
76139
76188
|
const content = await Bun.file(plugin.mcpPath).text();
|
|
@@ -76165,11 +76214,11 @@ async function loadPluginMcpServers(plugins) {
|
|
|
76165
76214
|
|
|
76166
76215
|
// src/features/claude-code-plugin-loader/hook-loader.ts
|
|
76167
76216
|
init_logger();
|
|
76168
|
-
import { existsSync as
|
|
76217
|
+
import { existsSync as existsSync73, readFileSync as readFileSync51 } from "fs";
|
|
76169
76218
|
function loadPluginHooksConfigs(plugins) {
|
|
76170
76219
|
const configs = [];
|
|
76171
76220
|
for (const plugin of plugins) {
|
|
76172
|
-
if (!plugin.hooksPath || !
|
|
76221
|
+
if (!plugin.hooksPath || !existsSync73(plugin.hooksPath))
|
|
76173
76222
|
continue;
|
|
76174
76223
|
try {
|
|
76175
76224
|
const content = readFileSync51(plugin.hooksPath, "utf-8");
|
|
@@ -76771,7 +76820,7 @@ function createChatHeadersHandler(args) {
|
|
|
76771
76820
|
// src/plugin/ultrawork-db-model-override.ts
|
|
76772
76821
|
import { Database } from "bun:sqlite";
|
|
76773
76822
|
import { join as join84 } from "path";
|
|
76774
|
-
import { existsSync as
|
|
76823
|
+
import { existsSync as existsSync74 } from "fs";
|
|
76775
76824
|
function getDbPath() {
|
|
76776
76825
|
return join84(getDataDir(), "opencode", "opencode.db");
|
|
76777
76826
|
}
|
|
@@ -76850,7 +76899,7 @@ function retryViaMicrotask(db, messageId, targetModel, variant, attempt) {
|
|
|
76850
76899
|
function scheduleDeferredModelOverride(messageId, targetModel, variant) {
|
|
76851
76900
|
queueMicrotask(() => {
|
|
76852
76901
|
const dbPath = getDbPath();
|
|
76853
|
-
if (!
|
|
76902
|
+
if (!existsSync74(dbPath)) {
|
|
76854
76903
|
log("[ultrawork-db-override] DB not found, skipping deferred override");
|
|
76855
76904
|
return;
|
|
76856
76905
|
}
|