oh-my-opencode-unguarded 3.9.4 → 3.10.1
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/cli/index.js +144 -98
- package/dist/hooks/auto-update-checker/constants.d.ts +2 -0
- package/dist/index.js +278 -210
- package/package.json +17 -17
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
|
}
|
|
@@ -18032,8 +18032,10 @@ function isAnyProviderConnected(providers, availableModels) {
|
|
|
18032
18032
|
}
|
|
18033
18033
|
// src/features/hook-message-injector/injector.ts
|
|
18034
18034
|
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync7, readdirSync, writeFileSync as writeFileSync4 } from "fs";
|
|
18035
|
+
import { randomBytes } from "crypto";
|
|
18035
18036
|
import { join as join12 } from "path";
|
|
18036
18037
|
init_logger();
|
|
18038
|
+
var processPrefix = randomBytes(4).toString("hex");
|
|
18037
18039
|
function convertSDKMessageToStoredMessage(msg) {
|
|
18038
18040
|
const info = msg.info;
|
|
18039
18041
|
if (!info)
|
|
@@ -36667,6 +36669,7 @@ function isHookCommandDisabled(eventType, command, config2) {
|
|
|
36667
36669
|
|
|
36668
36670
|
// src/hooks/claude-code-hooks/execute-http-hook.ts
|
|
36669
36671
|
var DEFAULT_HTTP_HOOK_TIMEOUT_S = 30;
|
|
36672
|
+
var ALLOWED_SCHEMES = new Set(["http:", "https:"]);
|
|
36670
36673
|
function interpolateEnvVars(value, allowedEnvVars) {
|
|
36671
36674
|
const allowedSet = new Set(allowedEnvVars);
|
|
36672
36675
|
return value.replace(/\$\{(\w+)\}|\$(\w+)/g, (_match, bracedVar, bareVar) => {
|
|
@@ -36690,6 +36693,17 @@ function resolveHeaders(hook) {
|
|
|
36690
36693
|
return headers;
|
|
36691
36694
|
}
|
|
36692
36695
|
async function executeHttpHook(hook, stdin) {
|
|
36696
|
+
try {
|
|
36697
|
+
const parsed = new URL(hook.url);
|
|
36698
|
+
if (!ALLOWED_SCHEMES.has(parsed.protocol)) {
|
|
36699
|
+
return {
|
|
36700
|
+
exitCode: 1,
|
|
36701
|
+
stderr: `HTTP hook URL scheme "${parsed.protocol}" is not allowed. Only http: and https: are permitted.`
|
|
36702
|
+
};
|
|
36703
|
+
}
|
|
36704
|
+
} catch {
|
|
36705
|
+
return { exitCode: 1, stderr: `HTTP hook URL is invalid: ${hook.url}` };
|
|
36706
|
+
}
|
|
36693
36707
|
const timeoutS = hook.timeout ?? DEFAULT_HTTP_HOOK_TIMEOUT_S;
|
|
36694
36708
|
const headers = resolveHeaders(hook);
|
|
36695
36709
|
try {
|
|
@@ -36779,8 +36793,9 @@ async function executeUserPromptSubmitHooks(ctx, config2, extendedConfig) {
|
|
|
36779
36793
|
for (const hook of matcher.hooks) {
|
|
36780
36794
|
if (hook.type !== "command" && hook.type !== "http")
|
|
36781
36795
|
continue;
|
|
36782
|
-
|
|
36783
|
-
|
|
36796
|
+
const hookName = getHookIdentifier(hook);
|
|
36797
|
+
if (isHookCommandDisabled("UserPromptSubmit", hookName, extendedConfig ?? null)) {
|
|
36798
|
+
log("UserPromptSubmit hook command skipped (disabled by config)", { command: hookName });
|
|
36784
36799
|
continue;
|
|
36785
36800
|
}
|
|
36786
36801
|
const result = await dispatchHook(hook, JSON.stringify(stdinData), ctx.cwd);
|
|
@@ -37062,11 +37077,11 @@ async function executePreCompactHooks(ctx, config2, extendedConfig) {
|
|
|
37062
37077
|
for (const hook of matcher.hooks) {
|
|
37063
37078
|
if (hook.type !== "command" && hook.type !== "http")
|
|
37064
37079
|
continue;
|
|
37065
|
-
|
|
37066
|
-
|
|
37080
|
+
const hookName = getHookIdentifier(hook);
|
|
37081
|
+
if (isHookCommandDisabled("PreCompact", hookName, extendedConfig ?? null)) {
|
|
37082
|
+
log("PreCompact hook command skipped (disabled by config)", { command: hookName });
|
|
37067
37083
|
continue;
|
|
37068
37084
|
}
|
|
37069
|
-
const hookName = getHookIdentifier(hook);
|
|
37070
37085
|
if (!firstHookName)
|
|
37071
37086
|
firstHookName = hookName;
|
|
37072
37087
|
const result = await dispatchHook(hook, JSON.stringify(stdinData), ctx.cwd);
|
|
@@ -37169,8 +37184,9 @@ async function executeStopHooks(ctx, config2, extendedConfig) {
|
|
|
37169
37184
|
for (const hook of matcher.hooks) {
|
|
37170
37185
|
if (hook.type !== "command" && hook.type !== "http")
|
|
37171
37186
|
continue;
|
|
37172
|
-
|
|
37173
|
-
|
|
37187
|
+
const hookName = getHookIdentifier(hook);
|
|
37188
|
+
if (isHookCommandDisabled("Stop", hookName, extendedConfig ?? null)) {
|
|
37189
|
+
log("Stop hook command skipped (disabled by config)", { command: hookName });
|
|
37174
37190
|
continue;
|
|
37175
37191
|
}
|
|
37176
37192
|
const result = await dispatchHook(hook, JSON.stringify(stdinData), ctx.cwd);
|
|
@@ -37324,11 +37340,11 @@ async function executePostToolUseHooks(ctx, config2, extendedConfig) {
|
|
|
37324
37340
|
for (const hook of matcher.hooks) {
|
|
37325
37341
|
if (hook.type !== "command" && hook.type !== "http")
|
|
37326
37342
|
continue;
|
|
37327
|
-
|
|
37328
|
-
|
|
37343
|
+
const hookName = getHookIdentifier(hook);
|
|
37344
|
+
if (isHookCommandDisabled("PostToolUse", hookName, extendedConfig ?? null)) {
|
|
37345
|
+
log("PostToolUse hook command skipped (disabled by config)", { command: hookName, toolName: ctx.toolName });
|
|
37329
37346
|
continue;
|
|
37330
37347
|
}
|
|
37331
|
-
const hookName = getHookIdentifier(hook);
|
|
37332
37348
|
if (!firstHookName)
|
|
37333
37349
|
firstHookName = hookName;
|
|
37334
37350
|
const result = await dispatchHook(hook, JSON.stringify(stdinData), ctx.cwd);
|
|
@@ -37561,11 +37577,11 @@ async function executePreToolUseHooks(ctx, config2, extendedConfig) {
|
|
|
37561
37577
|
for (const hook of matcher.hooks) {
|
|
37562
37578
|
if (hook.type !== "command" && hook.type !== "http")
|
|
37563
37579
|
continue;
|
|
37564
|
-
|
|
37565
|
-
|
|
37580
|
+
const hookName = getHookIdentifier(hook);
|
|
37581
|
+
if (isHookCommandDisabled("PreToolUse", hookName, extendedConfig ?? null)) {
|
|
37582
|
+
log("PreToolUse hook command skipped (disabled by config)", { command: hookName, toolName: ctx.toolName });
|
|
37566
37583
|
continue;
|
|
37567
37584
|
}
|
|
37568
|
-
const hookName = getHookIdentifier(hook);
|
|
37569
37585
|
if (!firstHookName)
|
|
37570
37586
|
firstHookName = hookName;
|
|
37571
37587
|
const result = await dispatchHook(hook, JSON.stringify(stdinData), ctx.cwd);
|
|
@@ -38261,10 +38277,11 @@ function createBackgroundNotificationHook(manager) {
|
|
|
38261
38277
|
init_logger();
|
|
38262
38278
|
|
|
38263
38279
|
// src/hooks/auto-update-checker/checker/local-dev-path.ts
|
|
38264
|
-
import * as
|
|
38280
|
+
import * as fs8 from "fs";
|
|
38265
38281
|
import { fileURLToPath } from "url";
|
|
38266
38282
|
|
|
38267
38283
|
// src/hooks/auto-update-checker/constants.ts
|
|
38284
|
+
import * as fs7 from "fs";
|
|
38268
38285
|
import * as path5 from "path";
|
|
38269
38286
|
import * as os4 from "os";
|
|
38270
38287
|
var PACKAGE_NAME = "oh-my-opencode-unguarded";
|
|
@@ -38278,6 +38295,21 @@ function getCacheDir3() {
|
|
|
38278
38295
|
}
|
|
38279
38296
|
var CACHE_DIR = getCacheDir3();
|
|
38280
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();
|
|
38281
38313
|
function getWindowsAppdataDir2() {
|
|
38282
38314
|
if (process.platform !== "win32")
|
|
38283
38315
|
return null;
|
|
@@ -38287,6 +38319,7 @@ var USER_CONFIG_DIR = getOpenCodeConfigDir({ binary: "opencode" });
|
|
|
38287
38319
|
var USER_OPENCODE_CONFIG = path5.join(USER_CONFIG_DIR, "opencode.json");
|
|
38288
38320
|
var USER_OPENCODE_CONFIG_JSONC = path5.join(USER_CONFIG_DIR, "opencode.jsonc");
|
|
38289
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");
|
|
38290
38323
|
|
|
38291
38324
|
// src/hooks/auto-update-checker/checker/config-paths.ts
|
|
38292
38325
|
import * as os5 from "os";
|
|
@@ -38325,9 +38358,9 @@ function stripJsonComments(json3) {
|
|
|
38325
38358
|
function getLocalDevPath(directory) {
|
|
38326
38359
|
for (const configPath of getConfigPaths2(directory)) {
|
|
38327
38360
|
try {
|
|
38328
|
-
if (!
|
|
38361
|
+
if (!fs8.existsSync(configPath))
|
|
38329
38362
|
continue;
|
|
38330
|
-
const content =
|
|
38363
|
+
const content = fs8.readFileSync(configPath, "utf-8");
|
|
38331
38364
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
38332
38365
|
const plugins = config2.plugin ?? [];
|
|
38333
38366
|
for (const entry of plugins) {
|
|
@@ -38346,20 +38379,20 @@ function getLocalDevPath(directory) {
|
|
|
38346
38379
|
return null;
|
|
38347
38380
|
}
|
|
38348
38381
|
// src/hooks/auto-update-checker/checker/local-dev-version.ts
|
|
38349
|
-
import * as
|
|
38382
|
+
import * as fs10 from "fs";
|
|
38350
38383
|
|
|
38351
38384
|
// src/hooks/auto-update-checker/checker/package-json-locator.ts
|
|
38352
|
-
import * as
|
|
38385
|
+
import * as fs9 from "fs";
|
|
38353
38386
|
import * as path7 from "path";
|
|
38354
38387
|
function findPackageJsonUp(startPath) {
|
|
38355
38388
|
try {
|
|
38356
|
-
const stat =
|
|
38389
|
+
const stat = fs9.statSync(startPath);
|
|
38357
38390
|
let dir = stat.isDirectory() ? startPath : path7.dirname(startPath);
|
|
38358
38391
|
for (let i2 = 0;i2 < 10; i2++) {
|
|
38359
38392
|
const pkgPath = path7.join(dir, "package.json");
|
|
38360
|
-
if (
|
|
38393
|
+
if (fs9.existsSync(pkgPath)) {
|
|
38361
38394
|
try {
|
|
38362
|
-
const content =
|
|
38395
|
+
const content = fs9.readFileSync(pkgPath, "utf-8");
|
|
38363
38396
|
const pkg = JSON.parse(content);
|
|
38364
38397
|
if (pkg.name === PACKAGE_NAME)
|
|
38365
38398
|
return pkgPath;
|
|
@@ -38383,7 +38416,7 @@ function getLocalDevVersion(directory) {
|
|
|
38383
38416
|
const pkgPath = findPackageJsonUp(localPath);
|
|
38384
38417
|
if (!pkgPath)
|
|
38385
38418
|
return null;
|
|
38386
|
-
const content =
|
|
38419
|
+
const content = fs10.readFileSync(pkgPath, "utf-8");
|
|
38387
38420
|
const pkg = JSON.parse(content);
|
|
38388
38421
|
return pkg.version ?? null;
|
|
38389
38422
|
} catch {
|
|
@@ -38391,16 +38424,16 @@ function getLocalDevVersion(directory) {
|
|
|
38391
38424
|
}
|
|
38392
38425
|
}
|
|
38393
38426
|
// src/hooks/auto-update-checker/checker/plugin-entry.ts
|
|
38394
|
-
import * as
|
|
38427
|
+
import * as fs11 from "fs";
|
|
38395
38428
|
function isExplicitVersionPin(pinnedVersion) {
|
|
38396
38429
|
return /^\d+\.\d+\.\d+/.test(pinnedVersion);
|
|
38397
38430
|
}
|
|
38398
38431
|
function findPluginEntry(directory) {
|
|
38399
38432
|
for (const configPath of getConfigPaths2(directory)) {
|
|
38400
38433
|
try {
|
|
38401
|
-
if (!
|
|
38434
|
+
if (!fs11.existsSync(configPath))
|
|
38402
38435
|
continue;
|
|
38403
|
-
const content =
|
|
38436
|
+
const content = fs11.readFileSync(configPath, "utf-8");
|
|
38404
38437
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
38405
38438
|
const plugins = config2.plugin ?? [];
|
|
38406
38439
|
for (const entry of plugins) {
|
|
@@ -38421,23 +38454,32 @@ function findPluginEntry(directory) {
|
|
|
38421
38454
|
}
|
|
38422
38455
|
// src/hooks/auto-update-checker/checker/cached-version.ts
|
|
38423
38456
|
init_logger();
|
|
38424
|
-
import * as
|
|
38457
|
+
import * as fs12 from "fs";
|
|
38425
38458
|
import * as path8 from "path";
|
|
38426
38459
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
38427
|
-
function
|
|
38460
|
+
function readVersionFromPackageJson(pkgJsonPath) {
|
|
38428
38461
|
try {
|
|
38429
|
-
if (
|
|
38430
|
-
const content =
|
|
38462
|
+
if (fs12.existsSync(pkgJsonPath)) {
|
|
38463
|
+
const content = fs12.readFileSync(pkgJsonPath, "utf-8");
|
|
38431
38464
|
const pkg = JSON.parse(content);
|
|
38432
38465
|
if (pkg.version)
|
|
38433
38466
|
return pkg.version;
|
|
38434
38467
|
}
|
|
38435
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;
|
|
38436
38478
|
try {
|
|
38437
38479
|
const currentDir = path8.dirname(fileURLToPath2(import.meta.url));
|
|
38438
38480
|
const pkgPath = findPackageJsonUp(currentDir);
|
|
38439
38481
|
if (pkgPath) {
|
|
38440
|
-
const content =
|
|
38482
|
+
const content = fs12.readFileSync(pkgPath, "utf-8");
|
|
38441
38483
|
const pkg = JSON.parse(content);
|
|
38442
38484
|
if (pkg.version)
|
|
38443
38485
|
return pkg.version;
|
|
@@ -38446,10 +38488,10 @@ function getCachedVersion() {
|
|
|
38446
38488
|
log("[auto-update-checker] Failed to resolve version from current directory:", err);
|
|
38447
38489
|
}
|
|
38448
38490
|
try {
|
|
38449
|
-
const execDir = path8.dirname(
|
|
38491
|
+
const execDir = path8.dirname(fs12.realpathSync(process.execPath));
|
|
38450
38492
|
const pkgPath = findPackageJsonUp(execDir);
|
|
38451
38493
|
if (pkgPath) {
|
|
38452
|
-
const content =
|
|
38494
|
+
const content = fs12.readFileSync(pkgPath, "utf-8");
|
|
38453
38495
|
const pkg = JSON.parse(content);
|
|
38454
38496
|
if (pkg.version)
|
|
38455
38497
|
return pkg.version;
|
|
@@ -38461,10 +38503,10 @@ function getCachedVersion() {
|
|
|
38461
38503
|
}
|
|
38462
38504
|
// src/hooks/auto-update-checker/checker/pinned-version-updater.ts
|
|
38463
38505
|
init_logger();
|
|
38464
|
-
import * as
|
|
38506
|
+
import * as fs13 from "fs";
|
|
38465
38507
|
function replacePluginEntry(configPath, oldEntry, newEntry) {
|
|
38466
38508
|
try {
|
|
38467
|
-
const content =
|
|
38509
|
+
const content = fs13.readFileSync(configPath, "utf-8");
|
|
38468
38510
|
const pluginMatch = content.match(/"plugin"\s*:\s*\[/);
|
|
38469
38511
|
if (!pluginMatch || pluginMatch.index === undefined) {
|
|
38470
38512
|
log(`[auto-update-checker] No "plugin" array found in ${configPath}`);
|
|
@@ -38495,7 +38537,7 @@ function replacePluginEntry(configPath, oldEntry, newEntry) {
|
|
|
38495
38537
|
log(`[auto-update-checker] No changes made to ${configPath}`);
|
|
38496
38538
|
return false;
|
|
38497
38539
|
}
|
|
38498
|
-
|
|
38540
|
+
fs13.writeFileSync(configPath, updatedContent, "utf-8");
|
|
38499
38541
|
log(`[auto-update-checker] Updated ${configPath}: ${oldEntry} \u2192 ${newEntry}`);
|
|
38500
38542
|
return true;
|
|
38501
38543
|
} catch (err) {
|
|
@@ -38677,18 +38719,18 @@ async function runBunInstallWithDetails() {
|
|
|
38677
38719
|
init_logger();
|
|
38678
38720
|
|
|
38679
38721
|
// src/hooks/auto-update-checker/cache.ts
|
|
38680
|
-
import * as
|
|
38722
|
+
import * as fs14 from "fs";
|
|
38681
38723
|
import * as path9 from "path";
|
|
38682
38724
|
init_logger();
|
|
38683
38725
|
function stripTrailingCommas(json3) {
|
|
38684
38726
|
return json3.replace(/,(\s*[}\]])/g, "$1");
|
|
38685
38727
|
}
|
|
38686
|
-
function removeFromBunLock(packageName) {
|
|
38687
|
-
const lockPath = path9.join(
|
|
38688
|
-
if (!
|
|
38728
|
+
function removeFromBunLock(dir, packageName) {
|
|
38729
|
+
const lockPath = path9.join(dir, "bun.lock");
|
|
38730
|
+
if (!fs14.existsSync(lockPath))
|
|
38689
38731
|
return false;
|
|
38690
38732
|
try {
|
|
38691
|
-
const content =
|
|
38733
|
+
const content = fs14.readFileSync(lockPath, "utf-8");
|
|
38692
38734
|
const lock = JSON.parse(stripTrailingCommas(content));
|
|
38693
38735
|
let modified = false;
|
|
38694
38736
|
if (lock.workspaces?.[""]?.dependencies?.[packageName]) {
|
|
@@ -38700,38 +38742,55 @@ function removeFromBunLock(packageName) {
|
|
|
38700
38742
|
modified = true;
|
|
38701
38743
|
}
|
|
38702
38744
|
if (modified) {
|
|
38703
|
-
|
|
38704
|
-
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}`);
|
|
38705
38747
|
}
|
|
38706
38748
|
return modified;
|
|
38707
38749
|
} catch {
|
|
38708
38750
|
return false;
|
|
38709
38751
|
}
|
|
38710
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
|
+
}
|
|
38711
38777
|
function invalidatePackage(packageName = PACKAGE_NAME) {
|
|
38712
38778
|
try {
|
|
38713
|
-
|
|
38714
|
-
const
|
|
38715
|
-
|
|
38716
|
-
|
|
38717
|
-
|
|
38718
|
-
|
|
38719
|
-
|
|
38720
|
-
|
|
38721
|
-
|
|
38722
|
-
|
|
38723
|
-
|
|
38724
|
-
|
|
38725
|
-
|
|
38726
|
-
|
|
38727
|
-
|
|
38728
|
-
fs13.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
38729
|
-
log(`[auto-update-checker] Dependency removed from package.json: ${packageName}`);
|
|
38730
|
-
dependencyRemoved = true;
|
|
38731
|
-
}
|
|
38732
|
-
}
|
|
38733
|
-
lockRemoved = removeFromBunLock(packageName);
|
|
38734
|
-
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) {
|
|
38735
38794
|
log(`[auto-update-checker] Package not found, nothing to invalidate: ${packageName}`);
|
|
38736
38795
|
return false;
|
|
38737
38796
|
}
|
|
@@ -38994,7 +39053,7 @@ v${latestVersion} available. Restart OpenCode to apply.` : "OpenCode is now on S
|
|
|
38994
39053
|
}
|
|
38995
39054
|
// src/hooks/agent-usage-reminder/storage.ts
|
|
38996
39055
|
import {
|
|
38997
|
-
existsSync as
|
|
39056
|
+
existsSync as existsSync41,
|
|
38998
39057
|
mkdirSync as mkdirSync10,
|
|
38999
39058
|
readFileSync as readFileSync28,
|
|
39000
39059
|
writeFileSync as writeFileSync14,
|
|
@@ -39054,7 +39113,7 @@ function getStoragePath2(sessionID) {
|
|
|
39054
39113
|
}
|
|
39055
39114
|
function loadAgentUsageState(sessionID) {
|
|
39056
39115
|
const filePath = getStoragePath2(sessionID);
|
|
39057
|
-
if (!
|
|
39116
|
+
if (!existsSync41(filePath))
|
|
39058
39117
|
return null;
|
|
39059
39118
|
try {
|
|
39060
39119
|
const content = readFileSync28(filePath, "utf-8");
|
|
@@ -39064,7 +39123,7 @@ function loadAgentUsageState(sessionID) {
|
|
|
39064
39123
|
}
|
|
39065
39124
|
}
|
|
39066
39125
|
function saveAgentUsageState(state3) {
|
|
39067
|
-
if (!
|
|
39126
|
+
if (!existsSync41(AGENT_USAGE_REMINDER_STORAGE)) {
|
|
39068
39127
|
mkdirSync10(AGENT_USAGE_REMINDER_STORAGE, { recursive: true });
|
|
39069
39128
|
}
|
|
39070
39129
|
const filePath = getStoragePath2(state3.sessionID);
|
|
@@ -39072,7 +39131,7 @@ function saveAgentUsageState(state3) {
|
|
|
39072
39131
|
}
|
|
39073
39132
|
function clearAgentUsageState(sessionID) {
|
|
39074
39133
|
const filePath = getStoragePath2(sessionID);
|
|
39075
|
-
if (
|
|
39134
|
+
if (existsSync41(filePath)) {
|
|
39076
39135
|
unlinkSync6(filePath);
|
|
39077
39136
|
}
|
|
39078
39137
|
}
|
|
@@ -40237,7 +40296,7 @@ function createNonInteractiveEnvHook(_ctx) {
|
|
|
40237
40296
|
}
|
|
40238
40297
|
// src/hooks/interactive-bash-session/storage.ts
|
|
40239
40298
|
import {
|
|
40240
|
-
existsSync as
|
|
40299
|
+
existsSync as existsSync42,
|
|
40241
40300
|
mkdirSync as mkdirSync11,
|
|
40242
40301
|
readFileSync as readFileSync29,
|
|
40243
40302
|
writeFileSync as writeFileSync15,
|
|
@@ -40263,7 +40322,7 @@ function getStoragePath3(sessionID) {
|
|
|
40263
40322
|
}
|
|
40264
40323
|
function loadInteractiveBashSessionState(sessionID) {
|
|
40265
40324
|
const filePath = getStoragePath3(sessionID);
|
|
40266
|
-
if (!
|
|
40325
|
+
if (!existsSync42(filePath))
|
|
40267
40326
|
return null;
|
|
40268
40327
|
try {
|
|
40269
40328
|
const content = readFileSync29(filePath, "utf-8");
|
|
@@ -40278,7 +40337,7 @@ function loadInteractiveBashSessionState(sessionID) {
|
|
|
40278
40337
|
}
|
|
40279
40338
|
}
|
|
40280
40339
|
function saveInteractiveBashSessionState(state3) {
|
|
40281
|
-
if (!
|
|
40340
|
+
if (!existsSync42(INTERACTIVE_BASH_SESSION_STORAGE)) {
|
|
40282
40341
|
mkdirSync11(INTERACTIVE_BASH_SESSION_STORAGE, { recursive: true });
|
|
40283
40342
|
}
|
|
40284
40343
|
const filePath = getStoragePath3(state3.sessionID);
|
|
@@ -40291,7 +40350,7 @@ function saveInteractiveBashSessionState(state3) {
|
|
|
40291
40350
|
}
|
|
40292
40351
|
function clearInteractiveBashSessionState(sessionID) {
|
|
40293
40352
|
const filePath = getStoragePath3(sessionID);
|
|
40294
|
-
if (
|
|
40353
|
+
if (existsSync42(filePath)) {
|
|
40295
40354
|
unlinkSync7(filePath);
|
|
40296
40355
|
}
|
|
40297
40356
|
}
|
|
@@ -40687,14 +40746,14 @@ var DEFAULT_STATE_FILE = ".sisyphus/ralph-loop.local.md";
|
|
|
40687
40746
|
var DEFAULT_MAX_ITERATIONS = 100;
|
|
40688
40747
|
var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
40689
40748
|
// src/hooks/ralph-loop/storage.ts
|
|
40690
|
-
import { existsSync as
|
|
40749
|
+
import { existsSync as existsSync43, readFileSync as readFileSync30, writeFileSync as writeFileSync16, unlinkSync as unlinkSync8, mkdirSync as mkdirSync12 } from "fs";
|
|
40691
40750
|
import { dirname as dirname10, join as join50 } from "path";
|
|
40692
40751
|
function getStateFilePath(directory, customPath) {
|
|
40693
40752
|
return customPath ? join50(directory, customPath) : join50(directory, DEFAULT_STATE_FILE);
|
|
40694
40753
|
}
|
|
40695
40754
|
function readState(directory, customPath) {
|
|
40696
40755
|
const filePath = getStateFilePath(directory, customPath);
|
|
40697
|
-
if (!
|
|
40756
|
+
if (!existsSync43(filePath)) {
|
|
40698
40757
|
return null;
|
|
40699
40758
|
}
|
|
40700
40759
|
try {
|
|
@@ -40734,7 +40793,7 @@ function writeState(directory, state3, customPath) {
|
|
|
40734
40793
|
const filePath = getStateFilePath(directory, customPath);
|
|
40735
40794
|
try {
|
|
40736
40795
|
const dir = dirname10(filePath);
|
|
40737
|
-
if (!
|
|
40796
|
+
if (!existsSync43(dir)) {
|
|
40738
40797
|
mkdirSync12(dir, { recursive: true });
|
|
40739
40798
|
}
|
|
40740
40799
|
const sessionIdLine = state3.session_id ? `session_id: "${state3.session_id}"
|
|
@@ -40763,7 +40822,7 @@ ${state3.prompt}
|
|
|
40763
40822
|
function clearState(directory, customPath) {
|
|
40764
40823
|
const filePath = getStateFilePath(directory, customPath);
|
|
40765
40824
|
try {
|
|
40766
|
-
if (
|
|
40825
|
+
if (existsSync43(filePath)) {
|
|
40767
40826
|
unlinkSync8(filePath);
|
|
40768
40827
|
}
|
|
40769
40828
|
return true;
|
|
@@ -40890,7 +40949,7 @@ init_logger();
|
|
|
40890
40949
|
|
|
40891
40950
|
// src/hooks/ralph-loop/completion-promise-detector.ts
|
|
40892
40951
|
init_logger();
|
|
40893
|
-
import { existsSync as
|
|
40952
|
+
import { existsSync as existsSync44, readFileSync as readFileSync31 } from "fs";
|
|
40894
40953
|
|
|
40895
40954
|
// src/hooks/ralph-loop/with-timeout.ts
|
|
40896
40955
|
async function withTimeout(promise2, timeoutMs) {
|
|
@@ -40920,7 +40979,7 @@ function detectCompletionInTranscript(transcriptPath, promise2) {
|
|
|
40920
40979
|
if (!transcriptPath)
|
|
40921
40980
|
return false;
|
|
40922
40981
|
try {
|
|
40923
|
-
if (!
|
|
40982
|
+
if (!existsSync44(transcriptPath))
|
|
40924
40983
|
return false;
|
|
40925
40984
|
const content = readFileSync31(transcriptPath, "utf-8");
|
|
40926
40985
|
const pattern = buildPromisePattern(promise2);
|
|
@@ -41493,7 +41552,7 @@ function findSlashCommandPartIndex(parts) {
|
|
|
41493
41552
|
return -1;
|
|
41494
41553
|
}
|
|
41495
41554
|
// src/hooks/auto-slash-command/executor.ts
|
|
41496
|
-
import { existsSync as
|
|
41555
|
+
import { existsSync as existsSync46, readdirSync as readdirSync12, readFileSync as readFileSync34 } from "fs";
|
|
41497
41556
|
import { join as join56, basename as basename2, dirname as dirname13 } from "path";
|
|
41498
41557
|
// src/features/builtin-commands/templates/init-deep.ts
|
|
41499
41558
|
var INIT_DEEP_TEMPLATE = `# /init-deep
|
|
@@ -42876,11 +42935,11 @@ function deduplicateSkillsByName(skills) {
|
|
|
42876
42935
|
}
|
|
42877
42936
|
|
|
42878
42937
|
// src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
42879
|
-
import { promises as
|
|
42938
|
+
import { promises as fs17 } from "fs";
|
|
42880
42939
|
import { join as join53 } from "path";
|
|
42881
42940
|
|
|
42882
42941
|
// src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
42883
|
-
import { promises as
|
|
42942
|
+
import { promises as fs16 } from "fs";
|
|
42884
42943
|
import { basename } from "path";
|
|
42885
42944
|
|
|
42886
42945
|
// src/shared/skill-path-resolver.ts
|
|
@@ -42901,7 +42960,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
42901
42960
|
}
|
|
42902
42961
|
|
|
42903
42962
|
// src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
42904
|
-
import { promises as
|
|
42963
|
+
import { promises as fs15 } from "fs";
|
|
42905
42964
|
import { join as join52 } from "path";
|
|
42906
42965
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
42907
42966
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
@@ -42920,7 +42979,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
42920
42979
|
async function loadMcpJsonFromDir(skillDir) {
|
|
42921
42980
|
const mcpJsonPath = join52(skillDir, "mcp.json");
|
|
42922
42981
|
try {
|
|
42923
|
-
const content = await
|
|
42982
|
+
const content = await fs15.readFile(mcpJsonPath, "utf-8");
|
|
42924
42983
|
const parsed = JSON.parse(content);
|
|
42925
42984
|
if (parsed && typeof parsed === "object" && "mcpServers" in parsed && parsed.mcpServers) {
|
|
42926
42985
|
return parsed.mcpServers;
|
|
@@ -42941,7 +43000,7 @@ async function loadMcpJsonFromDir(skillDir) {
|
|
|
42941
43000
|
async function loadSkillFromPath(options) {
|
|
42942
43001
|
const namePrefix = options.namePrefix ?? "";
|
|
42943
43002
|
try {
|
|
42944
|
-
const content = await
|
|
43003
|
+
const content = await fs16.readFile(options.skillPath, "utf-8");
|
|
42945
43004
|
const { data, body } = parseFrontmatter(content);
|
|
42946
43005
|
const frontmatterMcp = parseSkillMcpConfigFromFrontmatter(content);
|
|
42947
43006
|
const mcpJsonMcp = await loadMcpJsonFromDir(options.resolvedPath);
|
|
@@ -43002,7 +43061,7 @@ async function loadSkillsFromDir(options) {
|
|
|
43002
43061
|
const namePrefix = options.namePrefix ?? "";
|
|
43003
43062
|
const depth = options.depth ?? 0;
|
|
43004
43063
|
const maxDepth = options.maxDepth ?? 2;
|
|
43005
|
-
const entries = await
|
|
43064
|
+
const entries = await fs17.readdir(options.skillsDir, { withFileTypes: true }).catch(() => []);
|
|
43006
43065
|
const skillMap = new Map;
|
|
43007
43066
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
43008
43067
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
@@ -43012,7 +43071,7 @@ async function loadSkillsFromDir(options) {
|
|
|
43012
43071
|
const dirName = entry.name;
|
|
43013
43072
|
const skillMdPath = join53(resolvedPath, "SKILL.md");
|
|
43014
43073
|
try {
|
|
43015
|
-
await
|
|
43074
|
+
await fs17.access(skillMdPath);
|
|
43016
43075
|
const skill = await loadSkillFromPath({
|
|
43017
43076
|
skillPath: skillMdPath,
|
|
43018
43077
|
resolvedPath,
|
|
@@ -43027,7 +43086,7 @@ async function loadSkillsFromDir(options) {
|
|
|
43027
43086
|
} catch {}
|
|
43028
43087
|
const namedSkillMdPath = join53(resolvedPath, `${dirName}.md`);
|
|
43029
43088
|
try {
|
|
43030
|
-
await
|
|
43089
|
+
await fs17.access(namedSkillMdPath);
|
|
43031
43090
|
const skill = await loadSkillFromPath({
|
|
43032
43091
|
skillPath: namedSkillMdPath,
|
|
43033
43092
|
resolvedPath,
|
|
@@ -43186,7 +43245,7 @@ function builtinToLoadedSkill(builtin) {
|
|
|
43186
43245
|
}
|
|
43187
43246
|
|
|
43188
43247
|
// src/features/opencode-skill-loader/merger/config-skill-entry-loader.ts
|
|
43189
|
-
import { existsSync as
|
|
43248
|
+
import { existsSync as existsSync45, readFileSync as readFileSync32 } from "fs";
|
|
43190
43249
|
import { dirname as dirname11, isAbsolute as isAbsolute4, resolve as resolve5 } from "path";
|
|
43191
43250
|
import { homedir as homedir11 } from "os";
|
|
43192
43251
|
function resolveFilePath5(from, configDir) {
|
|
@@ -43205,7 +43264,7 @@ function resolveFilePath5(from, configDir) {
|
|
|
43205
43264
|
}
|
|
43206
43265
|
function loadSkillFromFile(filePath) {
|
|
43207
43266
|
try {
|
|
43208
|
-
if (!
|
|
43267
|
+
if (!existsSync45(filePath))
|
|
43209
43268
|
return null;
|
|
43210
43269
|
const content = readFileSync32(filePath, "utf-8");
|
|
43211
43270
|
const { data, body } = parseFrontmatter(content);
|
|
@@ -45536,7 +45595,7 @@ async function resolveMultipleSkillsAsync(skillNames, options) {
|
|
|
45536
45595
|
}
|
|
45537
45596
|
// src/features/opencode-skill-loader/config-source-discovery.ts
|
|
45538
45597
|
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
45539
|
-
import { promises as
|
|
45598
|
+
import { promises as fs18 } from "fs";
|
|
45540
45599
|
import { dirname as dirname12, extname, isAbsolute as isAbsolute5, join as join55, relative as relative3 } from "path";
|
|
45541
45600
|
var MAX_RECURSIVE_DEPTH = 10;
|
|
45542
45601
|
function isHttpUrl(path10) {
|
|
@@ -45569,7 +45628,7 @@ async function loadSourcePath(options) {
|
|
|
45569
45628
|
return [];
|
|
45570
45629
|
}
|
|
45571
45630
|
const absolutePath = toAbsolutePath(options.sourcePath, options.configDir);
|
|
45572
|
-
const stat = await
|
|
45631
|
+
const stat = await fs18.stat(absolutePath).catch(() => null);
|
|
45573
45632
|
if (!stat)
|
|
45574
45633
|
return [];
|
|
45575
45634
|
if (stat.isFile()) {
|
|
@@ -45617,7 +45676,7 @@ async function discoverConfigSourceSkills(options) {
|
|
|
45617
45676
|
}
|
|
45618
45677
|
// src/hooks/auto-slash-command/executor.ts
|
|
45619
45678
|
function discoverCommandsFromDir(commandsDir, scope) {
|
|
45620
|
-
if (!
|
|
45679
|
+
if (!existsSync46(commandsDir)) {
|
|
45621
45680
|
return [];
|
|
45622
45681
|
}
|
|
45623
45682
|
const entries = readdirSync12(commandsDir, { withFileTypes: true });
|
|
@@ -45982,14 +46041,14 @@ var NOTEPAD_DIR = "notepads";
|
|
|
45982
46041
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
45983
46042
|
var PROMETHEUS_PLANS_DIR = ".sisyphus/plans";
|
|
45984
46043
|
// src/features/boulder-state/storage.ts
|
|
45985
|
-
import { existsSync as
|
|
46044
|
+
import { existsSync as existsSync47, readFileSync as readFileSync35, writeFileSync as writeFileSync17, mkdirSync as mkdirSync13, readdirSync as readdirSync13 } from "fs";
|
|
45986
46045
|
import { dirname as dirname14, join as join57, basename as basename3 } from "path";
|
|
45987
46046
|
function getBoulderFilePath(directory) {
|
|
45988
46047
|
return join57(directory, BOULDER_DIR, BOULDER_FILE);
|
|
45989
46048
|
}
|
|
45990
46049
|
function readBoulderState(directory) {
|
|
45991
46050
|
const filePath = getBoulderFilePath(directory);
|
|
45992
|
-
if (!
|
|
46051
|
+
if (!existsSync47(filePath)) {
|
|
45993
46052
|
return null;
|
|
45994
46053
|
}
|
|
45995
46054
|
try {
|
|
@@ -46010,7 +46069,7 @@ function writeBoulderState(directory, state3) {
|
|
|
46010
46069
|
const filePath = getBoulderFilePath(directory);
|
|
46011
46070
|
try {
|
|
46012
46071
|
const dir = dirname14(filePath);
|
|
46013
|
-
if (!
|
|
46072
|
+
if (!existsSync47(dir)) {
|
|
46014
46073
|
mkdirSync13(dir, { recursive: true });
|
|
46015
46074
|
}
|
|
46016
46075
|
writeFileSync17(filePath, JSON.stringify(state3, null, 2), "utf-8");
|
|
@@ -46037,7 +46096,7 @@ function appendSessionId(directory, sessionId) {
|
|
|
46037
46096
|
function clearBoulderState(directory) {
|
|
46038
46097
|
const filePath = getBoulderFilePath(directory);
|
|
46039
46098
|
try {
|
|
46040
|
-
if (
|
|
46099
|
+
if (existsSync47(filePath)) {
|
|
46041
46100
|
const { unlinkSync: unlinkSync9 } = __require("fs");
|
|
46042
46101
|
unlinkSync9(filePath);
|
|
46043
46102
|
}
|
|
@@ -46048,7 +46107,7 @@ function clearBoulderState(directory) {
|
|
|
46048
46107
|
}
|
|
46049
46108
|
function findPrometheusPlans(directory) {
|
|
46050
46109
|
const plansDir = join57(directory, PROMETHEUS_PLANS_DIR);
|
|
46051
|
-
if (!
|
|
46110
|
+
if (!existsSync47(plansDir)) {
|
|
46052
46111
|
return [];
|
|
46053
46112
|
}
|
|
46054
46113
|
try {
|
|
@@ -46063,7 +46122,7 @@ function findPrometheusPlans(directory) {
|
|
|
46063
46122
|
}
|
|
46064
46123
|
}
|
|
46065
46124
|
function getPlanProgress(planPath) {
|
|
46066
|
-
if (!
|
|
46125
|
+
if (!existsSync47(planPath)) {
|
|
46067
46126
|
return { total: 0, completed: 0, isComplete: true };
|
|
46068
46127
|
}
|
|
46069
46128
|
try {
|
|
@@ -48022,7 +48081,7 @@ var HOOK_NAME11 = "runtime-fallback";
|
|
|
48022
48081
|
init_logger();
|
|
48023
48082
|
|
|
48024
48083
|
// src/plugin-config.ts
|
|
48025
|
-
import * as
|
|
48084
|
+
import * as fs19 from "fs";
|
|
48026
48085
|
import * as path10 from "path";
|
|
48027
48086
|
|
|
48028
48087
|
// src/config/schema/agent-names.ts
|
|
@@ -48470,8 +48529,8 @@ function parseConfigPartially(rawConfig) {
|
|
|
48470
48529
|
}
|
|
48471
48530
|
function loadConfigFromPath2(configPath, _ctx) {
|
|
48472
48531
|
try {
|
|
48473
|
-
if (
|
|
48474
|
-
const content =
|
|
48532
|
+
if (fs19.existsSync(configPath)) {
|
|
48533
|
+
const content = fs19.readFileSync(configPath, "utf-8");
|
|
48475
48534
|
const rawConfig = parseJsonc(content);
|
|
48476
48535
|
migrateConfigFile(configPath, rawConfig);
|
|
48477
48536
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
@@ -49470,7 +49529,7 @@ function createRuntimeFallbackHook(ctx, options) {
|
|
|
49470
49529
|
};
|
|
49471
49530
|
}
|
|
49472
49531
|
// src/hooks/write-existing-file-guard/hook.ts
|
|
49473
|
-
import { existsSync as
|
|
49532
|
+
import { existsSync as existsSync49, realpathSync as realpathSync4 } from "fs";
|
|
49474
49533
|
import { basename as basename4, dirname as dirname15, isAbsolute as isAbsolute7, join as join59, normalize, relative as relative5, resolve as resolve7 } from "path";
|
|
49475
49534
|
var MAX_TRACKED_SESSIONS = 256;
|
|
49476
49535
|
var MAX_TRACKED_PATHS_PER_SESSION = 1024;
|
|
@@ -49492,7 +49551,7 @@ function isPathInsideDirectory(pathToCheck, directory) {
|
|
|
49492
49551
|
}
|
|
49493
49552
|
function toCanonicalPath(absolutePath) {
|
|
49494
49553
|
let canonicalPath = absolutePath;
|
|
49495
|
-
if (
|
|
49554
|
+
if (existsSync49(absolutePath)) {
|
|
49496
49555
|
try {
|
|
49497
49556
|
canonicalPath = realpathSync4.native(absolutePath);
|
|
49498
49557
|
} catch {
|
|
@@ -49500,7 +49559,7 @@ function toCanonicalPath(absolutePath) {
|
|
|
49500
49559
|
}
|
|
49501
49560
|
} else {
|
|
49502
49561
|
const absoluteDir = dirname15(absolutePath);
|
|
49503
|
-
const resolvedDir =
|
|
49562
|
+
const resolvedDir = existsSync49(absoluteDir) ? realpathSync4.native(absoluteDir) : absoluteDir;
|
|
49504
49563
|
canonicalPath = join59(resolvedDir, basename4(absolutePath));
|
|
49505
49564
|
}
|
|
49506
49565
|
return normalize(canonicalPath);
|
|
@@ -49601,7 +49660,7 @@ function createWriteExistingFileGuardHook(ctx) {
|
|
|
49601
49660
|
return;
|
|
49602
49661
|
}
|
|
49603
49662
|
if (toolName === "read") {
|
|
49604
|
-
if (!
|
|
49663
|
+
if (!existsSync49(resolvedPath) || !input.sessionID) {
|
|
49605
49664
|
return;
|
|
49606
49665
|
}
|
|
49607
49666
|
registerReadPermission(input.sessionID, canonicalPath);
|
|
@@ -49611,7 +49670,7 @@ function createWriteExistingFileGuardHook(ctx) {
|
|
|
49611
49670
|
if (argsRecord && "overwrite" in argsRecord) {
|
|
49612
49671
|
delete argsRecord.overwrite;
|
|
49613
49672
|
}
|
|
49614
|
-
if (!
|
|
49673
|
+
if (!existsSync49(resolvedPath)) {
|
|
49615
49674
|
return;
|
|
49616
49675
|
}
|
|
49617
49676
|
const isSisyphusPath2 = canonicalPath.includes("/.sisyphus/");
|
|
@@ -49955,6 +50014,8 @@ function extractBase64Data(imageData) {
|
|
|
49955
50014
|
}
|
|
49956
50015
|
|
|
49957
50016
|
// src/hooks/read-image-resizer/image-dimensions.ts
|
|
50017
|
+
var HEADER_BYTES = 32768;
|
|
50018
|
+
var HEADER_BASE64_CHARS = Math.ceil(HEADER_BYTES / 3) * 4;
|
|
49958
50019
|
function toImageDimensions(width, height) {
|
|
49959
50020
|
if (!Number.isFinite(width) || !Number.isFinite(height)) {
|
|
49960
50021
|
return null;
|
|
@@ -50068,7 +50129,8 @@ function parseImageDimensions(base64DataUrl, mimeType) {
|
|
|
50068
50129
|
if (!rawBase64) {
|
|
50069
50130
|
return null;
|
|
50070
50131
|
}
|
|
50071
|
-
const
|
|
50132
|
+
const headerBase64 = rawBase64.length > HEADER_BASE64_CHARS ? rawBase64.slice(0, HEADER_BASE64_CHARS) : rawBase64;
|
|
50133
|
+
const buffer = Buffer.from(headerBase64, "base64");
|
|
50072
50134
|
if (buffer.length === 0) {
|
|
50073
50135
|
return null;
|
|
50074
50136
|
}
|
|
@@ -50682,10 +50744,10 @@ var DEFAULT_MAX_REFERENCES = 200;
|
|
|
50682
50744
|
var DEFAULT_MAX_SYMBOLS = 200;
|
|
50683
50745
|
var DEFAULT_MAX_DIAGNOSTICS = 200;
|
|
50684
50746
|
// src/tools/lsp/server-config-loader.ts
|
|
50685
|
-
import { existsSync as
|
|
50747
|
+
import { existsSync as existsSync50, readFileSync as readFileSync37 } from "fs";
|
|
50686
50748
|
import { join as join60 } from "path";
|
|
50687
50749
|
function loadJsonFile(path11) {
|
|
50688
|
-
if (!
|
|
50750
|
+
if (!existsSync50(path11))
|
|
50689
50751
|
return null;
|
|
50690
50752
|
try {
|
|
50691
50753
|
return parseJsonc(readFileSync37(path11, "utf-8"));
|
|
@@ -50768,14 +50830,14 @@ function getMergedServers() {
|
|
|
50768
50830
|
}
|
|
50769
50831
|
|
|
50770
50832
|
// src/tools/lsp/server-installation.ts
|
|
50771
|
-
import { existsSync as
|
|
50833
|
+
import { existsSync as existsSync51 } from "fs";
|
|
50772
50834
|
import { join as join61 } from "path";
|
|
50773
50835
|
function isServerInstalled(command) {
|
|
50774
50836
|
if (command.length === 0)
|
|
50775
50837
|
return false;
|
|
50776
50838
|
const cmd = command[0];
|
|
50777
50839
|
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
50778
|
-
if (
|
|
50840
|
+
if (existsSync51(cmd))
|
|
50779
50841
|
return true;
|
|
50780
50842
|
}
|
|
50781
50843
|
const isWindows2 = process.platform === "win32";
|
|
@@ -50797,7 +50859,7 @@ function isServerInstalled(command) {
|
|
|
50797
50859
|
const paths = pathEnv.split(pathSeparator);
|
|
50798
50860
|
for (const p of paths) {
|
|
50799
50861
|
for (const suffix of exts) {
|
|
50800
|
-
if (
|
|
50862
|
+
if (existsSync51(join61(p, cmd + suffix))) {
|
|
50801
50863
|
return true;
|
|
50802
50864
|
}
|
|
50803
50865
|
}
|
|
@@ -50813,7 +50875,7 @@ function isServerInstalled(command) {
|
|
|
50813
50875
|
];
|
|
50814
50876
|
for (const base of additionalBases) {
|
|
50815
50877
|
for (const suffix of exts) {
|
|
50816
|
-
if (
|
|
50878
|
+
if (existsSync51(join61(base, cmd + suffix))) {
|
|
50817
50879
|
return true;
|
|
50818
50880
|
}
|
|
50819
50881
|
}
|
|
@@ -50871,13 +50933,13 @@ function getLanguageId(ext) {
|
|
|
50871
50933
|
init_logger();
|
|
50872
50934
|
var {spawn: bunSpawn2 } = globalThis.Bun;
|
|
50873
50935
|
import { spawn as nodeSpawn2 } from "child_process";
|
|
50874
|
-
import { existsSync as
|
|
50936
|
+
import { existsSync as existsSync52, statSync as statSync7 } from "fs";
|
|
50875
50937
|
function shouldUseNodeSpawn() {
|
|
50876
50938
|
return process.platform === "win32";
|
|
50877
50939
|
}
|
|
50878
50940
|
function validateCwd(cwd) {
|
|
50879
50941
|
try {
|
|
50880
|
-
if (!
|
|
50942
|
+
if (!existsSync52(cwd)) {
|
|
50881
50943
|
return { valid: false, error: `Working directory does not exist: ${cwd}` };
|
|
50882
50944
|
}
|
|
50883
50945
|
const stats = statSync7(cwd);
|
|
@@ -51614,17 +51676,17 @@ var lspManager = LSPServerManager.getInstance();
|
|
|
51614
51676
|
// src/tools/lsp/lsp-client-wrapper.ts
|
|
51615
51677
|
import { extname as extname4, resolve as resolve9 } from "path";
|
|
51616
51678
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
51617
|
-
import { existsSync as
|
|
51679
|
+
import { existsSync as existsSync53 } from "fs";
|
|
51618
51680
|
function findWorkspaceRoot(filePath) {
|
|
51619
51681
|
let dir = resolve9(filePath);
|
|
51620
|
-
if (!
|
|
51682
|
+
if (!existsSync53(dir) || !__require("fs").statSync(dir).isDirectory()) {
|
|
51621
51683
|
dir = __require("path").dirname(dir);
|
|
51622
51684
|
}
|
|
51623
51685
|
const markers = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
51624
51686
|
let prevDir = "";
|
|
51625
51687
|
while (dir !== prevDir) {
|
|
51626
51688
|
for (const marker of markers) {
|
|
51627
|
-
if (
|
|
51689
|
+
if (existsSync53(__require("path").join(dir, marker))) {
|
|
51628
51690
|
return dir;
|
|
51629
51691
|
}
|
|
51630
51692
|
}
|
|
@@ -52151,10 +52213,10 @@ var DEFAULT_MAX_MATCHES = 500;
|
|
|
52151
52213
|
// src/tools/ast-grep/sg-cli-path.ts
|
|
52152
52214
|
import { createRequire as createRequire4 } from "module";
|
|
52153
52215
|
import { dirname as dirname16, join as join63 } from "path";
|
|
52154
|
-
import { existsSync as
|
|
52216
|
+
import { existsSync as existsSync55, statSync as statSync8 } from "fs";
|
|
52155
52217
|
|
|
52156
52218
|
// src/tools/ast-grep/downloader.ts
|
|
52157
|
-
import { existsSync as
|
|
52219
|
+
import { existsSync as existsSync54 } from "fs";
|
|
52158
52220
|
import { join as join62 } from "path";
|
|
52159
52221
|
import { homedir as homedir12 } from "os";
|
|
52160
52222
|
import { createRequire as createRequire3 } from "module";
|
|
@@ -52205,7 +52267,7 @@ async function downloadAstGrep(version2 = DEFAULT_VERSION) {
|
|
|
52205
52267
|
const cacheDir = getCacheDir4();
|
|
52206
52268
|
const binaryName = getBinaryName3();
|
|
52207
52269
|
const binaryPath = join62(cacheDir, binaryName);
|
|
52208
|
-
if (
|
|
52270
|
+
if (existsSync54(binaryPath)) {
|
|
52209
52271
|
return binaryPath;
|
|
52210
52272
|
}
|
|
52211
52273
|
const { arch, os: os6 } = platformInfo;
|
|
@@ -52268,7 +52330,7 @@ function findSgCliPathSync() {
|
|
|
52268
52330
|
const cliPackageJsonPath = require2.resolve("@ast-grep/cli/package.json");
|
|
52269
52331
|
const cliDirectory = dirname16(cliPackageJsonPath);
|
|
52270
52332
|
const sgPath = join63(cliDirectory, binaryName);
|
|
52271
|
-
if (
|
|
52333
|
+
if (existsSync55(sgPath) && isValidBinary(sgPath)) {
|
|
52272
52334
|
return sgPath;
|
|
52273
52335
|
}
|
|
52274
52336
|
} catch {}
|
|
@@ -52280,7 +52342,7 @@ function findSgCliPathSync() {
|
|
|
52280
52342
|
const packageDirectory = dirname16(packageJsonPath);
|
|
52281
52343
|
const astGrepBinaryName = process.platform === "win32" ? "ast-grep.exe" : "ast-grep";
|
|
52282
52344
|
const binaryPath = join63(packageDirectory, astGrepBinaryName);
|
|
52283
|
-
if (
|
|
52345
|
+
if (existsSync55(binaryPath) && isValidBinary(binaryPath)) {
|
|
52284
52346
|
return binaryPath;
|
|
52285
52347
|
}
|
|
52286
52348
|
} catch {}
|
|
@@ -52288,7 +52350,7 @@ function findSgCliPathSync() {
|
|
|
52288
52350
|
if (process.platform === "darwin") {
|
|
52289
52351
|
const homebrewPaths = ["/opt/homebrew/bin/sg", "/usr/local/bin/sg"];
|
|
52290
52352
|
for (const path11 of homebrewPaths) {
|
|
52291
|
-
if (
|
|
52353
|
+
if (existsSync55(path11) && isValidBinary(path11)) {
|
|
52292
52354
|
return path11;
|
|
52293
52355
|
}
|
|
52294
52356
|
}
|
|
@@ -52312,14 +52374,14 @@ function setSgCliPath(path11) {
|
|
|
52312
52374
|
}
|
|
52313
52375
|
// src/tools/ast-grep/cli.ts
|
|
52314
52376
|
var {spawn: spawn10 } = globalThis.Bun;
|
|
52315
|
-
import { existsSync as
|
|
52377
|
+
import { existsSync as existsSync57 } from "fs";
|
|
52316
52378
|
|
|
52317
52379
|
// src/tools/ast-grep/cli-binary-path-resolution.ts
|
|
52318
|
-
import { existsSync as
|
|
52380
|
+
import { existsSync as existsSync56 } from "fs";
|
|
52319
52381
|
var resolvedCliPath3 = null;
|
|
52320
52382
|
var initPromise3 = null;
|
|
52321
52383
|
async function getAstGrepPath() {
|
|
52322
|
-
if (resolvedCliPath3 !== null &&
|
|
52384
|
+
if (resolvedCliPath3 !== null && existsSync56(resolvedCliPath3)) {
|
|
52323
52385
|
return resolvedCliPath3;
|
|
52324
52386
|
}
|
|
52325
52387
|
if (initPromise3) {
|
|
@@ -52327,7 +52389,7 @@ async function getAstGrepPath() {
|
|
|
52327
52389
|
}
|
|
52328
52390
|
initPromise3 = (async () => {
|
|
52329
52391
|
const syncPath = findSgCliPathSync();
|
|
52330
|
-
if (syncPath &&
|
|
52392
|
+
if (syncPath && existsSync56(syncPath)) {
|
|
52331
52393
|
resolvedCliPath3 = syncPath;
|
|
52332
52394
|
setSgCliPath(syncPath);
|
|
52333
52395
|
return syncPath;
|
|
@@ -52426,7 +52488,7 @@ async function runSg(options) {
|
|
|
52426
52488
|
const paths = options.paths && options.paths.length > 0 ? options.paths : ["."];
|
|
52427
52489
|
args.push(...paths);
|
|
52428
52490
|
let cliPath = getSgCliPath();
|
|
52429
|
-
if (!cliPath || !
|
|
52491
|
+
if (!cliPath || !existsSync57(cliPath)) {
|
|
52430
52492
|
const downloadedPath = await getAstGrepPath();
|
|
52431
52493
|
if (downloadedPath) {
|
|
52432
52494
|
cliPath = downloadedPath;
|
|
@@ -52680,12 +52742,12 @@ import { resolve as resolve10 } from "path";
|
|
|
52680
52742
|
var {spawn: spawn11 } = globalThis.Bun;
|
|
52681
52743
|
|
|
52682
52744
|
// src/tools/grep/constants.ts
|
|
52683
|
-
import { existsSync as
|
|
52745
|
+
import { existsSync as existsSync59 } from "fs";
|
|
52684
52746
|
import { join as join65, dirname as dirname17 } from "path";
|
|
52685
52747
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
52686
52748
|
|
|
52687
52749
|
// src/tools/grep/downloader.ts
|
|
52688
|
-
import { existsSync as
|
|
52750
|
+
import { existsSync as existsSync58, readdirSync as readdirSync14 } from "fs";
|
|
52689
52751
|
import { join as join64 } from "path";
|
|
52690
52752
|
function findFileRecursive(dir, filename) {
|
|
52691
52753
|
try {
|
|
@@ -52749,7 +52811,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
52749
52811
|
}
|
|
52750
52812
|
const installDir = getInstallDir();
|
|
52751
52813
|
const rgPath = getRgPath();
|
|
52752
|
-
if (
|
|
52814
|
+
if (existsSync58(rgPath)) {
|
|
52753
52815
|
return rgPath;
|
|
52754
52816
|
}
|
|
52755
52817
|
ensureCacheDir(installDir);
|
|
@@ -52764,7 +52826,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
52764
52826
|
await extractZip2(archivePath, installDir);
|
|
52765
52827
|
}
|
|
52766
52828
|
ensureExecutable(rgPath);
|
|
52767
|
-
if (!
|
|
52829
|
+
if (!existsSync58(rgPath)) {
|
|
52768
52830
|
throw new Error("ripgrep binary not found after extraction");
|
|
52769
52831
|
}
|
|
52770
52832
|
return rgPath;
|
|
@@ -52776,7 +52838,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
52776
52838
|
}
|
|
52777
52839
|
function getInstalledRipgrepPath() {
|
|
52778
52840
|
const rgPath = getRgPath();
|
|
52779
|
-
return
|
|
52841
|
+
return existsSync58(rgPath) ? rgPath : null;
|
|
52780
52842
|
}
|
|
52781
52843
|
|
|
52782
52844
|
// src/tools/grep/constants.ts
|
|
@@ -52807,7 +52869,7 @@ function getOpenCodeBundledRg() {
|
|
|
52807
52869
|
join65(execDir, "..", "libexec", rgName)
|
|
52808
52870
|
];
|
|
52809
52871
|
for (const candidate of candidates) {
|
|
52810
|
-
if (
|
|
52872
|
+
if (existsSync59(candidate)) {
|
|
52811
52873
|
return candidate;
|
|
52812
52874
|
}
|
|
52813
52875
|
}
|
|
@@ -53446,10 +53508,10 @@ Use this when a task matches an available skill's or command's description.
|
|
|
53446
53508
|
// src/tools/skill/tools.ts
|
|
53447
53509
|
import { dirname as dirname19 } from "path";
|
|
53448
53510
|
// src/tools/slashcommand/command-discovery.ts
|
|
53449
|
-
import { existsSync as
|
|
53511
|
+
import { existsSync as existsSync60, readdirSync as readdirSync15, readFileSync as readFileSync40 } from "fs";
|
|
53450
53512
|
import { basename as basename5, join as join66 } from "path";
|
|
53451
53513
|
function discoverCommandsFromDir2(commandsDir, scope) {
|
|
53452
|
-
if (!
|
|
53514
|
+
if (!existsSync60(commandsDir))
|
|
53453
53515
|
return [];
|
|
53454
53516
|
const entries = readdirSync15(commandsDir, { withFileTypes: true });
|
|
53455
53517
|
const commands3 = [];
|
|
@@ -53893,7 +53955,7 @@ Has Todos: Yes (12 items, 8 completed)
|
|
|
53893
53955
|
Has Transcript: Yes (234 entries)`;
|
|
53894
53956
|
|
|
53895
53957
|
// src/tools/session-manager/storage.ts
|
|
53896
|
-
import { existsSync as
|
|
53958
|
+
import { existsSync as existsSync61 } from "fs";
|
|
53897
53959
|
import { readdir, readFile } from "fs/promises";
|
|
53898
53960
|
import { join as join68 } from "path";
|
|
53899
53961
|
var sdkClient = null;
|
|
@@ -53914,7 +53976,7 @@ async function getMainSessions(options) {
|
|
|
53914
53976
|
return [];
|
|
53915
53977
|
}
|
|
53916
53978
|
}
|
|
53917
|
-
if (!
|
|
53979
|
+
if (!existsSync61(SESSION_STORAGE))
|
|
53918
53980
|
return [];
|
|
53919
53981
|
const sessions = [];
|
|
53920
53982
|
try {
|
|
@@ -53955,7 +54017,7 @@ async function getAllSessions() {
|
|
|
53955
54017
|
return [];
|
|
53956
54018
|
}
|
|
53957
54019
|
}
|
|
53958
|
-
if (!
|
|
54020
|
+
if (!existsSync61(MESSAGE_STORAGE))
|
|
53959
54021
|
return [];
|
|
53960
54022
|
const sessions = [];
|
|
53961
54023
|
async function scanDirectory(dir) {
|
|
@@ -54024,7 +54086,7 @@ async function readSessionMessages(sessionID) {
|
|
|
54024
54086
|
}
|
|
54025
54087
|
}
|
|
54026
54088
|
const messageDir = getMessageDir(sessionID);
|
|
54027
|
-
if (!messageDir || !
|
|
54089
|
+
if (!messageDir || !existsSync61(messageDir))
|
|
54028
54090
|
return [];
|
|
54029
54091
|
const messages = [];
|
|
54030
54092
|
try {
|
|
@@ -54060,7 +54122,7 @@ async function readSessionMessages(sessionID) {
|
|
|
54060
54122
|
}
|
|
54061
54123
|
async function readParts2(messageID) {
|
|
54062
54124
|
const partDir = join68(PART_STORAGE, messageID);
|
|
54063
|
-
if (!
|
|
54125
|
+
if (!existsSync61(partDir))
|
|
54064
54126
|
return [];
|
|
54065
54127
|
const parts = [];
|
|
54066
54128
|
try {
|
|
@@ -54095,7 +54157,7 @@ async function readSessionTodos(sessionID) {
|
|
|
54095
54157
|
return [];
|
|
54096
54158
|
}
|
|
54097
54159
|
}
|
|
54098
|
-
if (!
|
|
54160
|
+
if (!existsSync61(TODO_DIR2))
|
|
54099
54161
|
return [];
|
|
54100
54162
|
try {
|
|
54101
54163
|
const allFiles = await readdir(TODO_DIR2);
|
|
@@ -54122,10 +54184,10 @@ async function readSessionTodos(sessionID) {
|
|
|
54122
54184
|
return [];
|
|
54123
54185
|
}
|
|
54124
54186
|
async function readSessionTranscript(sessionID) {
|
|
54125
|
-
if (!
|
|
54187
|
+
if (!existsSync61(TRANSCRIPT_DIR2))
|
|
54126
54188
|
return 0;
|
|
54127
54189
|
const transcriptFile = join68(TRANSCRIPT_DIR2, `${sessionID}.jsonl`);
|
|
54128
|
-
if (!
|
|
54190
|
+
if (!existsSync61(transcriptFile))
|
|
54129
54191
|
return 0;
|
|
54130
54192
|
try {
|
|
54131
54193
|
const content = await readFile(transcriptFile, "utf-8");
|
|
@@ -57548,7 +57610,7 @@ var TaskDeleteInputSchema = exports_external.object({
|
|
|
57548
57610
|
|
|
57549
57611
|
// src/features/claude-tasks/storage.ts
|
|
57550
57612
|
import { join as join69, dirname as dirname20, basename as basename7, isAbsolute as isAbsolute8 } from "path";
|
|
57551
|
-
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";
|
|
57552
57614
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
57553
57615
|
function getTaskDir(config3 = {}) {
|
|
57554
57616
|
const tasksConfig = config3.sisyphus?.tasks;
|
|
@@ -57576,13 +57638,13 @@ function resolveTaskListId(config3 = {}) {
|
|
|
57576
57638
|
return sanitizePathSegment(basename7(process.cwd()));
|
|
57577
57639
|
}
|
|
57578
57640
|
function ensureDir(dirPath) {
|
|
57579
|
-
if (!
|
|
57641
|
+
if (!existsSync62(dirPath)) {
|
|
57580
57642
|
mkdirSync14(dirPath, { recursive: true });
|
|
57581
57643
|
}
|
|
57582
57644
|
}
|
|
57583
57645
|
function readJsonSafe(filePath, schema2) {
|
|
57584
57646
|
try {
|
|
57585
|
-
if (!
|
|
57647
|
+
if (!existsSync62(filePath)) {
|
|
57586
57648
|
return null;
|
|
57587
57649
|
}
|
|
57588
57650
|
const content = readFileSync41(filePath, "utf-8");
|
|
@@ -57605,7 +57667,7 @@ function writeJsonAtomic(filePath, data) {
|
|
|
57605
57667
|
renameSync(tempPath, filePath);
|
|
57606
57668
|
} catch (error45) {
|
|
57607
57669
|
try {
|
|
57608
|
-
if (
|
|
57670
|
+
if (existsSync62(tempPath)) {
|
|
57609
57671
|
unlinkSync9(tempPath);
|
|
57610
57672
|
}
|
|
57611
57673
|
} catch {}
|
|
@@ -57665,7 +57727,7 @@ function acquireLock(dirPath) {
|
|
|
57665
57727
|
acquired: true,
|
|
57666
57728
|
release: () => {
|
|
57667
57729
|
try {
|
|
57668
|
-
if (!
|
|
57730
|
+
if (!existsSync62(lockPath))
|
|
57669
57731
|
return;
|
|
57670
57732
|
const lockContent = readFileSync41(lockPath, "utf-8");
|
|
57671
57733
|
const lockData = JSON.parse(lockContent);
|
|
@@ -57891,7 +57953,7 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
57891
57953
|
}
|
|
57892
57954
|
// src/tools/task/task-list.ts
|
|
57893
57955
|
import { join as join72 } from "path";
|
|
57894
|
-
import { existsSync as
|
|
57956
|
+
import { existsSync as existsSync63, readdirSync as readdirSync17 } from "fs";
|
|
57895
57957
|
function createTaskList(config3) {
|
|
57896
57958
|
return tool({
|
|
57897
57959
|
description: `List all active tasks with summary information.
|
|
@@ -57902,7 +57964,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
57902
57964
|
args: {},
|
|
57903
57965
|
execute: async () => {
|
|
57904
57966
|
const taskDir = getTaskDir(config3);
|
|
57905
|
-
if (!
|
|
57967
|
+
if (!existsSync63(taskDir)) {
|
|
57906
57968
|
return JSON.stringify({ tasks: [] });
|
|
57907
57969
|
}
|
|
57908
57970
|
const files = readdirSync17(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
|
|
@@ -59656,7 +59718,7 @@ function createToolGuardHooks(args) {
|
|
|
59656
59718
|
const rulesInjector = isHookEnabled("rules-injector") ? safeHook("rules-injector", () => createRulesInjectorHook(ctx, modelCacheState)) : null;
|
|
59657
59719
|
const tasksTodowriteDisabler = isHookEnabled("tasks-todowrite-disabler") ? safeHook("tasks-todowrite-disabler", () => createTasksTodowriteDisablerHook({ experimental: pluginConfig.experimental })) : null;
|
|
59658
59720
|
const writeExistingFileGuard = isHookEnabled("write-existing-file-guard") ? safeHook("write-existing-file-guard", () => createWriteExistingFileGuardHook(ctx)) : null;
|
|
59659
|
-
const hashlineReadEnhancer = isHookEnabled("hashline-read-enhancer") ? safeHook("hashline-read-enhancer", () => createHashlineReadEnhancerHook(ctx, { hashline_edit: { enabled: pluginConfig.hashline_edit ??
|
|
59721
|
+
const hashlineReadEnhancer = isHookEnabled("hashline-read-enhancer") ? safeHook("hashline-read-enhancer", () => createHashlineReadEnhancerHook(ctx, { hashline_edit: { enabled: pluginConfig.hashline_edit ?? false } })) : null;
|
|
59660
59722
|
const jsonErrorRecovery = isHookEnabled("json-error-recovery") ? safeHook("json-error-recovery", () => createJsonErrorRecoveryHook(ctx)) : null;
|
|
59661
59723
|
const readImageResizer = isHookEnabled("read-image-resizer") ? safeHook("read-image-resizer", () => createReadImageResizerHook(ctx)) : null;
|
|
59662
59724
|
return {
|
|
@@ -64382,8 +64444,8 @@ async function random(size) {
|
|
|
64382
64444
|
const evenDistCutoff = Math.pow(2, 8) - Math.pow(2, 8) % mask.length;
|
|
64383
64445
|
let result = "";
|
|
64384
64446
|
while (result.length < size) {
|
|
64385
|
-
const
|
|
64386
|
-
for (const randomByte of
|
|
64447
|
+
const randomBytes2 = await getRandomValues(size - result.length);
|
|
64448
|
+
for (const randomByte of randomBytes2) {
|
|
64387
64449
|
if (randomByte < evenDistCutoff) {
|
|
64388
64450
|
result += mask[randomByte % mask.length];
|
|
64389
64451
|
}
|
|
@@ -65657,7 +65719,7 @@ class StreamableHTTPClientTransport {
|
|
|
65657
65719
|
}
|
|
65658
65720
|
|
|
65659
65721
|
// src/features/mcp-oauth/storage.ts
|
|
65660
|
-
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";
|
|
65661
65723
|
import { dirname as dirname21, join as join76 } from "path";
|
|
65662
65724
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
65663
65725
|
function getMcpOauthStoragePath() {
|
|
@@ -65698,7 +65760,7 @@ function buildKey(serverHost, resource) {
|
|
|
65698
65760
|
}
|
|
65699
65761
|
function readStore() {
|
|
65700
65762
|
const filePath = getMcpOauthStoragePath();
|
|
65701
|
-
if (!
|
|
65763
|
+
if (!existsSync64(filePath)) {
|
|
65702
65764
|
return null;
|
|
65703
65765
|
}
|
|
65704
65766
|
try {
|
|
@@ -65712,7 +65774,7 @@ function writeStore(store2) {
|
|
|
65712
65774
|
const filePath = getMcpOauthStoragePath();
|
|
65713
65775
|
try {
|
|
65714
65776
|
const dir = dirname21(filePath);
|
|
65715
|
-
if (!
|
|
65777
|
+
if (!existsSync64(dir)) {
|
|
65716
65778
|
mkdirSync15(dir, { recursive: true });
|
|
65717
65779
|
}
|
|
65718
65780
|
writeFileSync20(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -65888,10 +65950,10 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
|
|
|
65888
65950
|
|
|
65889
65951
|
// src/features/mcp-oauth/oauth-authorization-flow.ts
|
|
65890
65952
|
import { spawn as spawn13 } from "child_process";
|
|
65891
|
-
import { createHash as createHash2, randomBytes } from "crypto";
|
|
65953
|
+
import { createHash as createHash2, randomBytes as randomBytes2 } from "crypto";
|
|
65892
65954
|
import { createServer } from "http";
|
|
65893
65955
|
function generateCodeVerifier() {
|
|
65894
|
-
return
|
|
65956
|
+
return randomBytes2(32).toString("base64url");
|
|
65895
65957
|
}
|
|
65896
65958
|
function generateCodeChallenge(verifier) {
|
|
65897
65959
|
return createHash2("sha256").update(verifier).digest("base64url");
|
|
@@ -65976,7 +66038,7 @@ function openBrowser(url2) {
|
|
|
65976
66038
|
async function runAuthorizationCodeRedirect(options) {
|
|
65977
66039
|
const verifier = generateCodeVerifier();
|
|
65978
66040
|
const challenge = generateCodeChallenge(verifier);
|
|
65979
|
-
const state3 =
|
|
66041
|
+
const state3 = randomBytes2(16).toString("hex");
|
|
65980
66042
|
const authorizationUrl = buildAuthorizationUrl(options.authorizationEndpoint, {
|
|
65981
66043
|
clientId: options.clientId,
|
|
65982
66044
|
redirectUri: options.redirectUri,
|
|
@@ -71876,7 +71938,7 @@ function buildAgent(source, model, categories2, gitMasterConfig, browserProvider
|
|
|
71876
71938
|
}
|
|
71877
71939
|
|
|
71878
71940
|
// src/agents/builtin-agents/resolve-file-uri.ts
|
|
71879
|
-
import { existsSync as
|
|
71941
|
+
import { existsSync as existsSync65, readFileSync as readFileSync44 } from "fs";
|
|
71880
71942
|
import { homedir as homedir13 } from "os";
|
|
71881
71943
|
import { isAbsolute as isAbsolute9, resolve as resolve13 } from "path";
|
|
71882
71944
|
function resolvePromptAppend(promptAppend, configDir) {
|
|
@@ -71891,7 +71953,7 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
71891
71953
|
} catch {
|
|
71892
71954
|
return `[WARNING: Malformed file URI (invalid percent-encoding): ${promptAppend}]`;
|
|
71893
71955
|
}
|
|
71894
|
-
if (!
|
|
71956
|
+
if (!existsSync65(filePath)) {
|
|
71895
71957
|
return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
|
|
71896
71958
|
}
|
|
71897
71959
|
try {
|
|
@@ -72916,7 +72978,7 @@ function createSisyphusJuniorAgentWithOverrides(override, systemDefaultModel, us
|
|
|
72916
72978
|
}
|
|
72917
72979
|
createSisyphusJuniorAgentWithOverrides.mode = MODE10;
|
|
72918
72980
|
// src/features/claude-code-agent-loader/loader.ts
|
|
72919
|
-
import { existsSync as
|
|
72981
|
+
import { existsSync as existsSync66, readdirSync as readdirSync19, readFileSync as readFileSync45 } from "fs";
|
|
72920
72982
|
import { join as join77, basename as basename8 } from "path";
|
|
72921
72983
|
function parseToolsConfig(toolsStr) {
|
|
72922
72984
|
if (!toolsStr)
|
|
@@ -72931,7 +72993,7 @@ function parseToolsConfig(toolsStr) {
|
|
|
72931
72993
|
return result;
|
|
72932
72994
|
}
|
|
72933
72995
|
function loadAgentsFromDir(agentsDir, scope) {
|
|
72934
|
-
if (!
|
|
72996
|
+
if (!existsSync66(agentsDir)) {
|
|
72935
72997
|
return [];
|
|
72936
72998
|
}
|
|
72937
72999
|
const entries = readdirSync19(agentsDir, { withFileTypes: true });
|
|
@@ -75378,6 +75440,12 @@ async function applyAgentConfig(params) {
|
|
|
75378
75440
|
};
|
|
75379
75441
|
}
|
|
75380
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
|
+
}
|
|
75381
75449
|
params.config.agent = remapAgentKeysToDisplayNames(params.config.agent);
|
|
75382
75450
|
params.config.agent = reorderAgentsByPriority(params.config.agent);
|
|
75383
75451
|
}
|
|
@@ -75386,18 +75454,18 @@ async function applyAgentConfig(params) {
|
|
|
75386
75454
|
return agentResult;
|
|
75387
75455
|
}
|
|
75388
75456
|
// src/features/claude-code-command-loader/loader.ts
|
|
75389
|
-
import { promises as
|
|
75457
|
+
import { promises as fs20 } from "fs";
|
|
75390
75458
|
import { join as join78, basename as basename9 } from "path";
|
|
75391
75459
|
init_logger();
|
|
75392
75460
|
async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix = "") {
|
|
75393
75461
|
try {
|
|
75394
|
-
await
|
|
75462
|
+
await fs20.access(commandsDir);
|
|
75395
75463
|
} catch {
|
|
75396
75464
|
return [];
|
|
75397
75465
|
}
|
|
75398
75466
|
let realPath;
|
|
75399
75467
|
try {
|
|
75400
|
-
realPath = await
|
|
75468
|
+
realPath = await fs20.realpath(commandsDir);
|
|
75401
75469
|
} catch (error45) {
|
|
75402
75470
|
log(`Failed to resolve command directory: ${commandsDir}`, error45);
|
|
75403
75471
|
return [];
|
|
@@ -75408,7 +75476,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
75408
75476
|
visited.add(realPath);
|
|
75409
75477
|
let entries;
|
|
75410
75478
|
try {
|
|
75411
|
-
entries = await
|
|
75479
|
+
entries = await fs20.readdir(commandsDir, { withFileTypes: true });
|
|
75412
75480
|
} catch (error45) {
|
|
75413
75481
|
log(`Failed to read command directory: ${commandsDir}`, error45);
|
|
75414
75482
|
return [];
|
|
@@ -75430,7 +75498,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
75430
75498
|
const baseCommandName = basename9(entry.name, ".md");
|
|
75431
75499
|
const commandName = prefix ? `${prefix}:${baseCommandName}` : baseCommandName;
|
|
75432
75500
|
try {
|
|
75433
|
-
const content = await
|
|
75501
|
+
const content = await fs20.readFile(commandPath, "utf-8");
|
|
75434
75502
|
const { data, body } = parseFrontmatter(content);
|
|
75435
75503
|
const wrappedTemplate = `<command-instruction>
|
|
75436
75504
|
${body.trim()}
|
|
@@ -75548,7 +75616,7 @@ function remapCommandAgentFields(commands3) {
|
|
|
75548
75616
|
}
|
|
75549
75617
|
}
|
|
75550
75618
|
// src/features/claude-code-mcp-loader/loader.ts
|
|
75551
|
-
import { existsSync as
|
|
75619
|
+
import { existsSync as existsSync67, readFileSync as readFileSync46 } from "fs";
|
|
75552
75620
|
import { join as join79 } from "path";
|
|
75553
75621
|
import { homedir as homedir14 } from "os";
|
|
75554
75622
|
|
|
@@ -75598,7 +75666,7 @@ function getMcpConfigPaths() {
|
|
|
75598
75666
|
];
|
|
75599
75667
|
}
|
|
75600
75668
|
async function loadMcpConfigFile(filePath) {
|
|
75601
|
-
if (!
|
|
75669
|
+
if (!existsSync67(filePath)) {
|
|
75602
75670
|
return null;
|
|
75603
75671
|
}
|
|
75604
75672
|
try {
|
|
@@ -75613,7 +75681,7 @@ function getSystemMcpServerNames() {
|
|
|
75613
75681
|
const names = new Set;
|
|
75614
75682
|
const paths = getMcpConfigPaths();
|
|
75615
75683
|
for (const { path: path11 } of paths) {
|
|
75616
|
-
if (!
|
|
75684
|
+
if (!existsSync67(path11))
|
|
75617
75685
|
continue;
|
|
75618
75686
|
try {
|
|
75619
75687
|
const content = readFileSync46(path11, "utf-8");
|
|
@@ -75790,7 +75858,7 @@ init_logger();
|
|
|
75790
75858
|
|
|
75791
75859
|
// src/features/claude-code-plugin-loader/discovery.ts
|
|
75792
75860
|
init_logger();
|
|
75793
|
-
import { existsSync as
|
|
75861
|
+
import { existsSync as existsSync68, readFileSync as readFileSync47 } from "fs";
|
|
75794
75862
|
import { homedir as homedir15 } from "os";
|
|
75795
75863
|
import { join as join80 } from "path";
|
|
75796
75864
|
function getPluginsBaseDir() {
|
|
@@ -75804,7 +75872,7 @@ function getInstalledPluginsPath() {
|
|
|
75804
75872
|
}
|
|
75805
75873
|
function loadInstalledPlugins() {
|
|
75806
75874
|
const dbPath = getInstalledPluginsPath();
|
|
75807
|
-
if (!
|
|
75875
|
+
if (!existsSync68(dbPath)) {
|
|
75808
75876
|
return null;
|
|
75809
75877
|
}
|
|
75810
75878
|
try {
|
|
@@ -75823,7 +75891,7 @@ function getClaudeSettingsPath() {
|
|
|
75823
75891
|
}
|
|
75824
75892
|
function loadClaudeSettings() {
|
|
75825
75893
|
const settingsPath = getClaudeSettingsPath();
|
|
75826
|
-
if (!
|
|
75894
|
+
if (!existsSync68(settingsPath)) {
|
|
75827
75895
|
return null;
|
|
75828
75896
|
}
|
|
75829
75897
|
try {
|
|
@@ -75836,7 +75904,7 @@ function loadClaudeSettings() {
|
|
|
75836
75904
|
}
|
|
75837
75905
|
function loadPluginManifest(installPath) {
|
|
75838
75906
|
const manifestPath = join80(installPath, ".claude-plugin", "plugin.json");
|
|
75839
|
-
if (!
|
|
75907
|
+
if (!existsSync68(manifestPath)) {
|
|
75840
75908
|
return null;
|
|
75841
75909
|
}
|
|
75842
75910
|
try {
|
|
@@ -75884,7 +75952,7 @@ function discoverInstalledPlugins(options) {
|
|
|
75884
75952
|
continue;
|
|
75885
75953
|
}
|
|
75886
75954
|
const { installPath, scope, version: version2 } = installation;
|
|
75887
|
-
if (!
|
|
75955
|
+
if (!existsSync68(installPath)) {
|
|
75888
75956
|
errors3.push({
|
|
75889
75957
|
pluginKey,
|
|
75890
75958
|
installPath,
|
|
@@ -75902,21 +75970,21 @@ function discoverInstalledPlugins(options) {
|
|
|
75902
75970
|
pluginKey,
|
|
75903
75971
|
manifest: manifest ?? undefined
|
|
75904
75972
|
};
|
|
75905
|
-
if (
|
|
75973
|
+
if (existsSync68(join80(installPath, "commands"))) {
|
|
75906
75974
|
loadedPlugin.commandsDir = join80(installPath, "commands");
|
|
75907
75975
|
}
|
|
75908
|
-
if (
|
|
75976
|
+
if (existsSync68(join80(installPath, "agents"))) {
|
|
75909
75977
|
loadedPlugin.agentsDir = join80(installPath, "agents");
|
|
75910
75978
|
}
|
|
75911
|
-
if (
|
|
75979
|
+
if (existsSync68(join80(installPath, "skills"))) {
|
|
75912
75980
|
loadedPlugin.skillsDir = join80(installPath, "skills");
|
|
75913
75981
|
}
|
|
75914
75982
|
const hooksPath = join80(installPath, "hooks", "hooks.json");
|
|
75915
|
-
if (
|
|
75983
|
+
if (existsSync68(hooksPath)) {
|
|
75916
75984
|
loadedPlugin.hooksPath = hooksPath;
|
|
75917
75985
|
}
|
|
75918
75986
|
const mcpPath = join80(installPath, ".mcp.json");
|
|
75919
|
-
if (
|
|
75987
|
+
if (existsSync68(mcpPath)) {
|
|
75920
75988
|
loadedPlugin.mcpPath = mcpPath;
|
|
75921
75989
|
}
|
|
75922
75990
|
plugins.push(loadedPlugin);
|
|
@@ -75929,13 +75997,13 @@ function discoverInstalledPlugins(options) {
|
|
|
75929
75997
|
}
|
|
75930
75998
|
|
|
75931
75999
|
// src/features/claude-code-plugin-loader/command-loader.ts
|
|
75932
|
-
import { existsSync as
|
|
76000
|
+
import { existsSync as existsSync69, readdirSync as readdirSync20, readFileSync as readFileSync48 } from "fs";
|
|
75933
76001
|
import { basename as basename10, join as join81 } from "path";
|
|
75934
76002
|
init_logger();
|
|
75935
76003
|
function loadPluginCommands(plugins) {
|
|
75936
76004
|
const commands3 = {};
|
|
75937
76005
|
for (const plugin of plugins) {
|
|
75938
|
-
if (!plugin.commandsDir || !
|
|
76006
|
+
if (!plugin.commandsDir || !existsSync69(plugin.commandsDir))
|
|
75939
76007
|
continue;
|
|
75940
76008
|
const entries = readdirSync20(plugin.commandsDir, { withFileTypes: true });
|
|
75941
76009
|
for (const entry of entries) {
|
|
@@ -75976,13 +76044,13 @@ $ARGUMENTS
|
|
|
75976
76044
|
}
|
|
75977
76045
|
|
|
75978
76046
|
// src/features/claude-code-plugin-loader/skill-loader.ts
|
|
75979
|
-
import { existsSync as
|
|
76047
|
+
import { existsSync as existsSync70, readdirSync as readdirSync21, readFileSync as readFileSync49 } from "fs";
|
|
75980
76048
|
import { join as join82 } from "path";
|
|
75981
76049
|
init_logger();
|
|
75982
76050
|
function loadPluginSkillsAsCommands(plugins) {
|
|
75983
76051
|
const skills2 = {};
|
|
75984
76052
|
for (const plugin of plugins) {
|
|
75985
|
-
if (!plugin.skillsDir || !
|
|
76053
|
+
if (!plugin.skillsDir || !existsSync70(plugin.skillsDir))
|
|
75986
76054
|
continue;
|
|
75987
76055
|
const entries = readdirSync21(plugin.skillsDir, { withFileTypes: true });
|
|
75988
76056
|
for (const entry of entries) {
|
|
@@ -75993,7 +76061,7 @@ function loadPluginSkillsAsCommands(plugins) {
|
|
|
75993
76061
|
continue;
|
|
75994
76062
|
const resolvedPath = resolveSymlink(skillPath);
|
|
75995
76063
|
const skillMdPath = join82(resolvedPath, "SKILL.md");
|
|
75996
|
-
if (!
|
|
76064
|
+
if (!existsSync70(skillMdPath))
|
|
75997
76065
|
continue;
|
|
75998
76066
|
try {
|
|
75999
76067
|
const content = readFileSync49(skillMdPath, "utf-8");
|
|
@@ -76031,7 +76099,7 @@ $ARGUMENTS
|
|
|
76031
76099
|
}
|
|
76032
76100
|
|
|
76033
76101
|
// src/features/claude-code-plugin-loader/agent-loader.ts
|
|
76034
|
-
import { existsSync as
|
|
76102
|
+
import { existsSync as existsSync71, readdirSync as readdirSync22, readFileSync as readFileSync50 } from "fs";
|
|
76035
76103
|
import { basename as basename11, join as join83 } from "path";
|
|
76036
76104
|
init_logger();
|
|
76037
76105
|
function parseToolsConfig2(toolsStr) {
|
|
@@ -76049,7 +76117,7 @@ function parseToolsConfig2(toolsStr) {
|
|
|
76049
76117
|
function loadPluginAgents(plugins) {
|
|
76050
76118
|
const agents = {};
|
|
76051
76119
|
for (const plugin of plugins) {
|
|
76052
|
-
if (!plugin.agentsDir || !
|
|
76120
|
+
if (!plugin.agentsDir || !existsSync71(plugin.agentsDir))
|
|
76053
76121
|
continue;
|
|
76054
76122
|
const entries = readdirSync22(plugin.agentsDir, { withFileTypes: true });
|
|
76055
76123
|
for (const entry of entries) {
|
|
@@ -76083,7 +76151,7 @@ function loadPluginAgents(plugins) {
|
|
|
76083
76151
|
}
|
|
76084
76152
|
|
|
76085
76153
|
// src/features/claude-code-plugin-loader/mcp-server-loader.ts
|
|
76086
|
-
import { existsSync as
|
|
76154
|
+
import { existsSync as existsSync72 } from "fs";
|
|
76087
76155
|
init_logger();
|
|
76088
76156
|
|
|
76089
76157
|
// src/features/claude-code-plugin-loader/plugin-path-resolver.ts
|
|
@@ -76114,7 +76182,7 @@ function resolvePluginPaths(obj, pluginRoot) {
|
|
|
76114
76182
|
async function loadPluginMcpServers(plugins) {
|
|
76115
76183
|
const servers = {};
|
|
76116
76184
|
for (const plugin of plugins) {
|
|
76117
|
-
if (!plugin.mcpPath || !
|
|
76185
|
+
if (!plugin.mcpPath || !existsSync72(plugin.mcpPath))
|
|
76118
76186
|
continue;
|
|
76119
76187
|
try {
|
|
76120
76188
|
const content = await Bun.file(plugin.mcpPath).text();
|
|
@@ -76146,11 +76214,11 @@ async function loadPluginMcpServers(plugins) {
|
|
|
76146
76214
|
|
|
76147
76215
|
// src/features/claude-code-plugin-loader/hook-loader.ts
|
|
76148
76216
|
init_logger();
|
|
76149
|
-
import { existsSync as
|
|
76217
|
+
import { existsSync as existsSync73, readFileSync as readFileSync51 } from "fs";
|
|
76150
76218
|
function loadPluginHooksConfigs(plugins) {
|
|
76151
76219
|
const configs = [];
|
|
76152
76220
|
for (const plugin of plugins) {
|
|
76153
|
-
if (!plugin.hooksPath || !
|
|
76221
|
+
if (!plugin.hooksPath || !existsSync73(plugin.hooksPath))
|
|
76154
76222
|
continue;
|
|
76155
76223
|
try {
|
|
76156
76224
|
const content = readFileSync51(plugin.hooksPath, "utf-8");
|
|
@@ -76530,7 +76598,7 @@ function createToolRegistry(args) {
|
|
|
76530
76598
|
task_list: createTaskList(pluginConfig),
|
|
76531
76599
|
task_update: createTaskUpdateTool(pluginConfig, ctx)
|
|
76532
76600
|
} : {};
|
|
76533
|
-
const hashlineEnabled = pluginConfig.hashline_edit ??
|
|
76601
|
+
const hashlineEnabled = pluginConfig.hashline_edit ?? false;
|
|
76534
76602
|
const hashlineToolsRecord = hashlineEnabled ? { edit: createHashlineEditTool() } : {};
|
|
76535
76603
|
const allTools = {
|
|
76536
76604
|
...builtinTools,
|
|
@@ -76752,7 +76820,7 @@ function createChatHeadersHandler(args) {
|
|
|
76752
76820
|
// src/plugin/ultrawork-db-model-override.ts
|
|
76753
76821
|
import { Database } from "bun:sqlite";
|
|
76754
76822
|
import { join as join84 } from "path";
|
|
76755
|
-
import { existsSync as
|
|
76823
|
+
import { existsSync as existsSync74 } from "fs";
|
|
76756
76824
|
function getDbPath() {
|
|
76757
76825
|
return join84(getDataDir(), "opencode", "opencode.db");
|
|
76758
76826
|
}
|
|
@@ -76831,7 +76899,7 @@ function retryViaMicrotask(db, messageId, targetModel, variant, attempt) {
|
|
|
76831
76899
|
function scheduleDeferredModelOverride(messageId, targetModel, variant) {
|
|
76832
76900
|
queueMicrotask(() => {
|
|
76833
76901
|
const dbPath = getDbPath();
|
|
76834
|
-
if (!
|
|
76902
|
+
if (!existsSync74(dbPath)) {
|
|
76835
76903
|
log("[ultrawork-db-override] DB not found, skipping deferred override");
|
|
76836
76904
|
return;
|
|
76837
76905
|
}
|